Open source CapCut alternative.
TypeScript
Centralize pointer prompt copy
David Leab0d5ce4e178
diff --git a/apps/Donkey/Sources/Donkey/PointerPromptOverlayController.swift b/apps/Donkey/Sources/Donkey/PointerPromptOverlayController.swiftindex 100ef5f7..bab3fa34 100644--- a/apps/Donkey/Sources/Donkey/PointerPromptOverlayController.swift+++ b/apps/Donkey/Sources/Donkey/PointerPromptOverlayController.swift@@ -814,12 +814,7 @@ final class PointerPromptOverlayController {}private var hasStatusTaskDisplayText: Bool {- let text = model.promptState.promptText- .trimmingCharacters(in: .whitespacesAndNewlines)- .split(whereSeparator: \.isWhitespace)- .joined(separator: " ")-- return !text.isEmpty && text != "Make this so" && text != "Resting"+ PointerPromptCopy.isTaskDisplayText(model.promptState.promptText)}private func inferredVoidWidth(for screen: NSScreen, safeTop: CGFloat) -> CGFloat {diff --git a/apps/Donkey/Sources/DonkeyAI/AIHarnessBoundary.swift b/apps/Donkey/Sources/DonkeyAI/AIHarnessBoundary.swiftindex ddc02204..07b8aa11 100644--- a/apps/Donkey/Sources/DonkeyAI/AIHarnessBoundary.swift+++ b/apps/Donkey/Sources/DonkeyAI/AIHarnessBoundary.swift@@ -11,7 +11,7 @@ public struct AIHarnessBoundary: AIHarnessSnapshotProviding {public func snapshot() -> AIHarnessSnapshot {AIHarnessSnapshot(isPlannerAvailable: false,- suggestedPromptText: "Make this so"+ suggestedPromptText: PointerPromptCopy.defaultPromptPlaceholder)}}diff --git a/apps/Donkey/Sources/DonkeyContracts/PointerPromptContracts.swift b/apps/Donkey/Sources/DonkeyContracts/PointerPromptContracts.swiftindex f7344e45..aa2fefbf 100644--- a/apps/Donkey/Sources/DonkeyContracts/PointerPromptContracts.swift+++ b/apps/Donkey/Sources/DonkeyContracts/PointerPromptContracts.swift@@ -1,6 +1,23 @@import CoreGraphicsimport Foundation+public enum PointerPromptCopy {+ public static let defaultPromptPlaceholder = "What can donkey do for you?"++ public static func normalizedDisplayText(_ text: String) -> String {+ text+ .trimmingCharacters(in: .whitespacesAndNewlines)+ .split(whereSeparator: \.isWhitespace)+ .joined(separator: " ")+ }++ public static func isTaskDisplayText(_ text: String) -> Bool {+ let normalizedText = normalizedDisplayText(text)+ return !normalizedText.isEmpty &&+ normalizedText != defaultPromptPlaceholder+ }+}+public struct PointerPromptState: Equatable, Sendable {public static let defaultVoiceWaveformLevels: [Double] = [0.12,@@ -36,7 +53,7 @@ public struct PointerPromptState: Equatable, Sendable {}public static let productionDefault = PointerPromptState(- promptText: "Make this so",+ promptText: PointerPromptCopy.defaultPromptPlaceholder,leadingSignalLevel: .ready,isActive: true)diff --git a/apps/Donkey/Sources/DonkeyUI/PointerPromptNotchStatusView.swift b/apps/Donkey/Sources/DonkeyUI/PointerPromptNotchStatusView.swiftindex f65b577e..a3f43931 100644--- a/apps/Donkey/Sources/DonkeyUI/PointerPromptNotchStatusView.swift+++ b/apps/Donkey/Sources/DonkeyUI/PointerPromptNotchStatusView.swift@@ -466,7 +466,7 @@ public struct PointerPromptNotchStatusView: View {private var commandInputState: PointerPromptState {PointerPromptState(- promptText: "Ask for follow-up changes",+ promptText: PointerPromptCopy.defaultPromptPlaceholder,isPrimaryActionEnabled: true,leadingSignalLevel: .ready,isActive: isExpanded,@@ -566,7 +566,7 @@ public struct PointerPromptNotchStatusView: View {switch state.leadingSignalLevel {case .idle:- return "Resting"+ return "Idle"case .ready:return "Ready"case .thinking:@@ -636,11 +636,8 @@ public struct PointerPromptNotchStatusView: View {}private var taskDisplayText: String? {- let text = state.promptText- .trimmingCharacters(in: .whitespacesAndNewlines)- .split(whereSeparator: \.isWhitespace)- .joined(separator: " ")- guard !text.isEmpty, text != "Make this so", text != "Resting" else {+ let text = PointerPromptCopy.normalizedDisplayText(state.promptText)+ guard PointerPromptCopy.isTaskDisplayText(text) else {return nil}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/PointerPromptCopyTests.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/PointerPromptCopyTests.swiftnew file mode 100644index 00000000..3e90d35f--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/PointerPromptCopyTests.swift@@ -0,0 +1,19 @@+import DonkeyAI+import DonkeyContracts+import Testing++@Suite+struct PointerPromptCopyTests {+ @Test+ func defaultPromptCopyIsSharedAcrossPromptSurfaces() {+ #expect(PointerPromptState.productionDefault.promptText == PointerPromptCopy.defaultPromptPlaceholder)+ #expect(AIHarnessBoundary().snapshot().suggestedPromptText == PointerPromptCopy.defaultPromptPlaceholder)+ }++ @Test+ func placeholderCopyDoesNotBecomeTaskDisplayText() {+ #expect(!PointerPromptCopy.isTaskDisplayText(PointerPromptCopy.defaultPromptPlaceholder))+ #expect(!PointerPromptCopy.isTaskDisplayText(" \(PointerPromptCopy.defaultPromptPlaceholder) "))+ #expect(PointerPromptCopy.isTaskDisplayText("Open Safari"))+ }+}