Open source CapCut alternative.
TypeScript
Fixed apple script generator
David Lebd02c17b1fbd
diff --git a/apps/Donkey/Package.swift b/apps/Donkey/Package.swiftindex b1217a5a..2e54d464 100644--- a/apps/Donkey/Package.swift+++ b/apps/Donkey/Package.swift@@ -99,6 +99,7 @@ let package = Package(.testTarget(name: "DonkeyRuntimeTests",dependencies: [+ "Donkey","DonkeyAI","DonkeyContracts","DonkeyHarness",diff --git a/apps/Donkey/Sources/DonkeyAI/HostedAppleScriptGenerationAdapter.swift b/apps/Donkey/Sources/DonkeyAI/HostedAppleScriptGenerationAdapter.swiftindex 1354307e..b387f9d9 100644--- a/apps/Donkey/Sources/DonkeyAI/HostedAppleScriptGenerationAdapter.swift+++ b/apps/Donkey/Sources/DonkeyAI/HostedAppleScriptGenerationAdapter.swift@@ -102,7 +102,10 @@ public struct HostedAppleScriptGenerationAdapter: Sendable {return HarnessScriptGenerationOutcome(succeeded: false,summary: "Dynamic AppleScript generation returned an empty script.",- metadata: ["reason": "emptyScriptSource"]+ metadata: [+ "reason": "emptyScriptSource",+ "modelOutput.preview": String(outputText.prefix(800))+ ])}@@ -253,6 +256,30 @@ private struct AppleScriptGenerationWire: Decodable {var summary: Stringvar safetyNotes: [String]var expectedOutput: String++ init(from decoder: Decoder) throws {+ let container = try decoder.container(keyedBy: CodingKeys.self)+ // Only `canGenerate` is essential. Models routinely omit the string/array fields when they+ // don't apply (e.g. no `blockedReason` when `canGenerate` is true), so tolerate their+ // absence instead of failing the whole generation.+ canGenerate = try container.decode(Bool.self, forKey: .canGenerate)+ blockedReason = try container.decodeIfPresent(String.self, forKey: .blockedReason) ?? ""+ summary = try container.decodeIfPresent(String.self, forKey: .summary) ?? ""+ safetyNotes = try container.decodeIfPresent([String].self, forKey: .safetyNotes) ?? []+ expectedOutput = try container.decodeIfPresent(String.self, forKey: .expectedOutput) ?? ""+ // Models name the script field inconsistently (`scriptSource`, `appleScript`, `script`,+ // `source`). Accept any of them so a correct script isn't dropped over a key name.+ scriptSource = try container.decodeIfPresent(String.self, forKey: .scriptSource)+ ?? container.decodeIfPresent(String.self, forKey: .appleScript)+ ?? container.decodeIfPresent(String.self, forKey: .script)+ ?? container.decodeIfPresent(String.self, forKey: .source)+ ?? ""+ }++ private enum CodingKeys: String, CodingKey {+ case canGenerate, blockedReason, scriptSource, summary, safetyNotes, expectedOutput+ case appleScript, script, source+ }}private struct AppleScriptGenerationPromptPayload: Encodable {