Skip to content

Commit cd7e3df

Browse files
authored
fix(macos): drop Textual from chat packaging
* fix(macos): drop Textual from chat packaging * fix(macos): declare concurrency extras dependency
1 parent 0e71ae5 commit cd7e3df

6 files changed

Lines changed: 19 additions & 83 deletions

File tree

apps/macos/Package.resolved

Lines changed: 0 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/macos/Package.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ let package = Package(
2020
.package(url: "https://github.com/apple/swift-log.git", from: "1.10.1"),
2121
.package(url: "https://github.com/sparkle-project/Sparkle", from: "2.9.0"),
2222
.package(url: "https://github.com/steipete/Peekaboo.git", exact: "3.5.2"),
23+
.package(url: "https://github.com/pointfreeco/swift-concurrency-extras", from: "1.3.1"),
2324
.package(path: "../shared/OpenClawKit"),
2425
.package(path: "../swabble"),
2526
],
@@ -54,6 +55,7 @@ let package = Package(
5455
.product(name: "Sparkle", package: "Sparkle"),
5556
.product(name: "PeekabooBridge", package: "Peekaboo"),
5657
.product(name: "PeekabooAutomationKit", package: "Peekaboo"),
58+
.product(name: "ConcurrencyExtras", package: "swift-concurrency-extras"),
5759
],
5860
exclude: [
5961
"Resources/Info.plist",

apps/shared/OpenClawKit/Package.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ let package = Package(
1919
],
2020
dependencies: [
2121
.package(url: "https://github.com/steipete/ElevenLabsKit", exact: "0.1.1"),
22-
.package(url: "https://github.com/gonzalezreal/textual", exact: "0.3.1"),
2322
],
2423
targets: [
2524
.target(
@@ -45,10 +44,6 @@ let package = Package(
4544
name: "OpenClawChatUI",
4645
dependencies: [
4746
"OpenClawKit",
48-
.product(
49-
name: "Textual",
50-
package: "textual",
51-
condition: .when(platforms: [.macOS, .iOS])),
5247
],
5348
path: "Sources/OpenClawChatUI",
5449
swiftSettings: [

apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatMarkdownRenderer.swift

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import Foundation
12
import SwiftUI
2-
import Textual
33

44
public enum ChatMarkdownVariant: String, CaseIterable, Sendable {
55
case standard
@@ -22,46 +22,28 @@ struct ChatMarkdownRenderer: View {
2222
var body: some View {
2323
let processed = ChatMarkdownPreprocessor.preprocess(markdown: self.text)
2424
VStack(alignment: .leading, spacing: 10) {
25-
StructuredText(markdown: processed.cleaned)
26-
.modifier(ChatMarkdownStyle(
27-
variant: self.variant,
28-
context: self.context,
29-
font: self.font,
30-
textColor: self.textColor))
25+
Text(self.markdownText(processed.cleaned))
26+
.font(self.font)
27+
.foregroundStyle(self.textColor)
28+
.tint(self.linkColor)
29+
.textSelection(.enabled)
30+
.lineSpacing(self.variant == .compact ? 2 : 4)
3131

3232
if !processed.images.isEmpty {
3333
InlineImageList(images: processed.images)
3434
}
3535
}
3636
}
37-
}
38-
39-
private struct ChatMarkdownStyle: ViewModifier {
40-
let variant: ChatMarkdownVariant
41-
let context: ChatMarkdownRenderer.Context
42-
let font: Font
43-
let textColor: Color
4437

45-
func body(content: Content) -> some View {
46-
Group {
47-
if self.variant == .compact {
48-
content.textual.structuredTextStyle(.default)
49-
} else {
50-
content.textual.structuredTextStyle(.gitHub)
51-
}
52-
}
53-
.font(self.font)
54-
.foregroundStyle(self.textColor)
55-
.textual.inlineStyle(self.inlineStyle)
56-
.textual.textSelection(.enabled)
38+
private var linkColor: Color {
39+
self.context == .user ? self.textColor : OpenClawChatTheme.accent
5740
}
5841

59-
private var inlineStyle: InlineStyle {
60-
let linkColor: Color = self.context == .user ? self.textColor : OpenClawChatTheme.accent
61-
let codeScale: CGFloat = self.variant == .compact ? 0.85 : 0.9
62-
return InlineStyle()
63-
.code(.monospaced, .fontScale(codeScale))
64-
.link(.foregroundColor(linkColor))
42+
private func markdownText(_ markdown: String) -> AttributedString {
43+
let options = AttributedString.MarkdownParsingOptions(
44+
interpretedSyntax: .full,
45+
failurePolicy: .returnPartiallyParsedIfPossible)
46+
return (try? AttributedString(markdown: markdown, options: options)) ?? AttributedString(markdown)
6547
}
6648
}
6749

scripts/package-mac-app.sh

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -304,33 +304,6 @@ else
304304
exit 1
305305
fi
306306

307-
echo "📦 Copying Textual resources"
308-
TEXTUAL_BUNDLE_DIR="$(build_path_for_arch "$PRIMARY_ARCH")/$BUILD_CONFIG"
309-
TEXTUAL_BUNDLE=""
310-
for candidate in \
311-
"$TEXTUAL_BUNDLE_DIR/textual_Textual.bundle" \
312-
"$TEXTUAL_BUNDLE_DIR/Textual_Textual.bundle"
313-
do
314-
if [ -d "$candidate" ]; then
315-
TEXTUAL_BUNDLE="$candidate"
316-
break
317-
fi
318-
done
319-
if [ -z "$TEXTUAL_BUNDLE" ]; then
320-
TEXTUAL_BUNDLE="$(find "$BUILD_ROOT" -type d \( -name "textual_Textual.bundle" -o -name "Textual_Textual.bundle" \) -print -quit)"
321-
fi
322-
if [ -n "$TEXTUAL_BUNDLE" ] && [ -d "$TEXTUAL_BUNDLE" ]; then
323-
rm -rf "$APP_ROOT/Contents/Resources/$(basename "$TEXTUAL_BUNDLE")"
324-
cp -R "$TEXTUAL_BUNDLE" "$APP_ROOT/Contents/Resources/"
325-
else
326-
if [[ "${ALLOW_MISSING_TEXTUAL_BUNDLE:-0}" == "1" ]]; then
327-
echo "WARN: Textual resource bundle not found (continuing due to ALLOW_MISSING_TEXTUAL_BUNDLE=1)" >&2
328-
else
329-
echo "ERROR: Textual resource bundle not found. Set ALLOW_MISSING_TEXTUAL_BUNDLE=1 to bypass." >&2
330-
exit 1
331-
fi
332-
fi
333-
334307
running_packaged_app_pids() {
335308
command -v pgrep >/dev/null 2>&1 || return 0
336309
local app_binary="$APP_ROOT/Contents/MacOS/OpenClaw"

test/scripts/package-mac-app.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,13 +387,15 @@ describe("package-mac-app plist stamping", () => {
387387
script.indexOf(
388388
'OPENCLAWKIT_BUNDLE="$(build_path_for_arch "$PRIMARY_ARCH")/$BUILD_CONFIG/OpenClawKit_OpenClawKit.bundle"',
389389
),
390-
script.indexOf('echo "📦 Copying Textual resources"'),
390+
script.indexOf("running_packaged_app_pids()"),
391391
);
392392

393393
expect(openClawKitBlock).toContain("ERROR: OpenClawKit resource bundle not found");
394394
expect(openClawKitBlock).toContain("exit 1");
395395
expect(openClawKitBlock).not.toContain("WARN:");
396396
expect(openClawKitBlock).not.toContain("continuing");
397+
expect(script).not.toContain("Textual resource bundle");
398+
expect(script).not.toContain("ALLOW_MISSING_TEXTUAL_BUNDLE");
397399
});
398400

399401
it("does not mask required Info.plist stamp failures", () => {

0 commit comments

Comments
 (0)