Open source CapCut alternative.
TypeScript
Add runtime setup support and repair flows
David Leebbf2eb88008
diff --git a/apps/Donkey/Sources/Donkey/Donkey.swift b/apps/Donkey/Sources/Donkey/Donkey.swiftindex d483f5b0..f222889e 100644--- a/apps/Donkey/Sources/Donkey/Donkey.swift+++ b/apps/Donkey/Sources/Donkey/Donkey.swift@@ -6,7 +6,28 @@ struct Donkey: App {var body: some Scene {Settings {- EmptyView()+ LocalRuntimeSettingsView()}}}++private struct LocalRuntimeSettingsView: View {+ @State private var runtimeSetupController: LocalRuntimeOnboardingWindowController?++ var body: some View {+ VStack(alignment: .leading, spacing: 12) {+ Text("Local Runtimes")+ .font(.headline)+ Text("Reopen setup to install, repair, or recheck Donkey's local model sidecars.")+ .foregroundStyle(.secondary)+ .fixedSize(horizontal: false, vertical: true)+ Button("Set Up Local Runtimes") {+ let controller = LocalRuntimeOnboardingWindowController()+ runtimeSetupController = controller+ controller.showSetup()+ }+ }+ .padding(20)+ .frame(width: 420, alignment: .leading)+ }+}diff --git a/apps/Donkey/Sources/Donkey/LocalRuntimeOnboardingWindowController.swift b/apps/Donkey/Sources/Donkey/LocalRuntimeOnboardingWindowController.swiftindex a3429a6a..92f8e2c4 100644--- a/apps/Donkey/Sources/Donkey/LocalRuntimeOnboardingWindowController.swift+++ b/apps/Donkey/Sources/Donkey/LocalRuntimeOnboardingWindowController.swift@@ -26,11 +26,15 @@ final class LocalRuntimeOnboardingWindowController: NSWindowController {Task {await model.refresh()guard model.needsSetup else { return }- showWindow(nil)- window?.center()- NSApp.activate(ignoringOtherApps: true)+ showSetup()}}++ func showSetup() {+ showWindow(nil)+ window?.center()+ NSApp.activate(ignoringOtherApps: true)+ }}@MainActordiff --git a/apps/Donkey/Sources/Donkey/ManualCaptureDebugLaunchHandler.swift b/apps/Donkey/Sources/Donkey/ManualCaptureDebugLaunchHandler.swiftindex 58f68e2f..f69b6a99 100644--- a/apps/Donkey/Sources/Donkey/ManualCaptureDebugLaunchHandler.swift+++ b/apps/Donkey/Sources/Donkey/ManualCaptureDebugLaunchHandler.swift@@ -62,6 +62,14 @@ struct ManualCaptureDebugLaunchHandler {))return 0+ case .localRuntimeSupport:+ let manager = try LocalModelRuntimeSetupManager()+ printLines(+ ManualCaptureDebugCommandFormatter.lines(+ for: try manager.supportSnapshot()+ )+ )+ return 0case .localRuntimeInstructions:let manager = try LocalModelRuntimeSetupManager()printLines(@@ -84,6 +92,26 @@ struct ManualCaptureDebugLaunchHandler {))return 0+ case .repairLocalRuntime(let runtimeID):+ let manager = try LocalModelRuntimeSetupManager()+ let report = try await manager.repairRuntime(runtimeID: runtimeID)+ printLines([+ "local runtime repaired",+ "runtime=\(report.runtimeID.rawValue)",+ "download=\(report.downloadResult.state.rawValue)",+ "modelPreparation=\(report.modelPreparation.state.rawValue)",+ "health=\(report.health.state.rawValue)"+ ])+ return 0+ case .removeLocalRuntime(let runtimeID):+ let manager = try LocalModelRuntimeSetupManager()+ let removed = try manager.removeRuntime(runtimeID: runtimeID)+ printLines([+ "local runtime removed",+ "runtime=\(runtimeID.rawValue)",+ "removed=\(removed)"+ ])+ return 0}} catch {printError(ManualCaptureDebugCommandFormatter.errorLine(for: error))diff --git a/apps/Donkey/Sources/DonkeyRuntime/LocalModelRuntimeSetup.swift b/apps/Donkey/Sources/DonkeyRuntime/LocalModelRuntimeSetup.swiftindex 552ef08e..d2202b2d 100644--- a/apps/Donkey/Sources/DonkeyRuntime/LocalModelRuntimeSetup.swift+++ b/apps/Donkey/Sources/DonkeyRuntime/LocalModelRuntimeSetup.swift@@ -26,6 +26,8 @@ public enum LocalModelRuntimeSetupError: Error, Equatable, Sendable {case manifestFileHashMismatch(relativePath: String)case manifestMissingDownloadURL(relativePath: String)case manifestMissingSignature+ case manifestUnknownSigningKey(String)+ case manifestInvalidSignature}public enum LocalModelRuntimeDownloadState: String, Codable, Equatable, Sendable {@@ -282,6 +284,82 @@ public struct LocalModelRuntimeModelPreparationReport: Codable, Equatable, Senda}}+public struct LocalModelRuntimeManifestSigningKey: Equatable, Sendable {+ public var keyID: String+ public var publicKeyBase64: String++ public init(keyID: String, publicKeyBase64: String) {+ self.keyID = keyID+ self.publicKeyBase64 = publicKeyBase64+ }+}++public struct LocalModelRuntimeRepairReport: Codable, Equatable, Sendable {+ public var runtimeID: LocalModelRuntimeID+ public var downloadResult: LocalModelRuntimeDownloadResult+ public var modelPreparation: LocalModelRuntimeModelPreparationReport+ public var health: LocalModelRuntimeHealthReport+ public var metadata: [String: String]++ public init(+ runtimeID: LocalModelRuntimeID,+ downloadResult: LocalModelRuntimeDownloadResult,+ modelPreparation: LocalModelRuntimeModelPreparationReport,+ health: LocalModelRuntimeHealthReport,+ metadata: [String: String] = [:]+ ) {+ self.runtimeID = runtimeID+ self.downloadResult = downloadResult+ self.modelPreparation = modelPreparation+ self.health = health+ self.metadata = metadata+ }+}++public struct LocalModelRuntimeSupportStatus: Codable, Equatable, Sendable {+ public var runtimeID: LocalModelRuntimeID+ public var displayName: String+ public var state: LocalModelRuntimeInstallState+ public var environmentVariableName: String+ public var runtimeVersion: String?+ public var modelID: String+ public var sidecarProtocolVersion: String?+ public var reason: String?++ public init(+ runtimeID: LocalModelRuntimeID,+ displayName: String,+ state: LocalModelRuntimeInstallState,+ environmentVariableName: String,+ runtimeVersion: String? = nil,+ modelID: String,+ sidecarProtocolVersion: String? = nil,+ reason: String? = nil+ ) {+ self.runtimeID = runtimeID+ self.displayName = displayName+ self.state = state+ self.environmentVariableName = environmentVariableName+ self.runtimeVersion = runtimeVersion+ self.modelID = modelID+ self.sidecarProtocolVersion = sidecarProtocolVersion+ self.reason = reason+ }+}++public struct LocalModelRuntimeSupportSnapshot: Codable, Equatable, Sendable {+ public var generatedAt: Date+ public var statuses: [LocalModelRuntimeSupportStatus]++ public init(+ generatedAt: Date,+ statuses: [LocalModelRuntimeSupportStatus]+ ) {+ self.generatedAt = generatedAt+ self.statuses = statuses+ }+}+public protocol LocalModelRuntimePackageDownloading: Sendable {func download(from url: URL) async throws -> Data}@@ -319,19 +397,27 @@ public struct LocalModelRuntimeSetupManager: Sendable {public var isExecutableFile: @Sendable (String) -> Boolpublic var now: @Sendable () -> Datepublic var bundledPackageDirectory: @Sendable (LocalModelRuntimeID) -> URL?+ public var trustedManifestSigningKeys: [String: String]+ public var requiresCryptographicManifestSignatures: Boolpublic init(baseDirectory: URL? = nil,specs: [LocalModelRuntimeSpec] = Self.defaultSpecs,isExecutableFile: @escaping @Sendable (String) -> Bool = { FileManager.default.isExecutableFile(atPath: $0) },now: @escaping @Sendable () -> Date = Date.init,- bundledPackageDirectory: @escaping @Sendable (LocalModelRuntimeID) -> URL? = Self.defaultBundledPackageDirectory+ bundledPackageDirectory: @escaping @Sendable (LocalModelRuntimeID) -> URL? = Self.defaultBundledPackageDirectory,+ trustedManifestSigningKeys: [LocalModelRuntimeManifestSigningKey] = Self.defaultTrustedManifestSigningKeys(),+ requiresCryptographicManifestSignatures: Bool = Self.defaultRequiresCryptographicManifestSignatures()) throws {self.baseDirectory = try baseDirectory ?? Self.defaultBaseDirectory()self.specs = specsself.isExecutableFile = isExecutableFileself.now = nowself.bundledPackageDirectory = bundledPackageDirectory+ self.trustedManifestSigningKeys = Dictionary(+ uniqueKeysWithValues: trustedManifestSigningKeys.map { ($0.keyID, $0.publicKeyBase64) }+ )+ self.requiresCryptographicManifestSignatures = requiresCryptographicManifestSignatures}public static let defaultSpecs: [LocalModelRuntimeSpec] = [@@ -424,6 +510,37 @@ public struct LocalModelRuntimeSetupManager: Sendable {return packageDirectory}+ public static func defaultTrustedManifestSigningKeys() -> [LocalModelRuntimeManifestSigningKey] {+ var keys: [LocalModelRuntimeManifestSigningKey] = []+ if let bundledKeys = Bundle.main.object(+ forInfoDictionaryKey: "DonkeyRuntimeManifestPublicKeys"+ ) as? [String: String] {+ keys.append(contentsOf: bundledKeys.map { keyID, publicKey in+ LocalModelRuntimeManifestSigningKey(keyID: keyID, publicKeyBase64: publicKey)+ })+ }++ keys.append(contentsOf: ProcessInfo.processInfo.environment["DONKEY_RUNTIME_MANIFEST_PUBLIC_KEYS"]?+ .split(separator: ",")+ .compactMap { pair -> LocalModelRuntimeManifestSigningKey? in+ let parts = pair.split(separator: "=", maxSplits: 1).map(String.init)+ guard parts.count == 2, !parts[0].isEmpty, !parts[1].isEmpty else {+ return nil+ }+ return LocalModelRuntimeManifestSigningKey(keyID: parts[0], publicKeyBase64: parts[1])+ } ?? [])+ return keys+ }++ public static func defaultRequiresCryptographicManifestSignatures() -> Bool {+ if let bundledValue = Bundle.main.object(+ forInfoDictionaryKey: "DonkeyRuntimeRequiresCryptographicManifestSignatures"+ ) as? Bool {+ return bundledValue+ }+ return ProcessInfo.processInfo.environment["DONKEY_RUNTIME_REQUIRE_CRYPTO_SIGNATURES"] == "1"+ }+private func bundledPackageManifest(for runtimeID: LocalModelRuntimeID) throws -> LocalModelRuntimePackageManifest? {guard let packageDirectory = bundledPackageDirectory(runtimeID) else { return nil }let manifestURL = packageDirectory.appendingPathComponent("manifest.json", isDirectory: false)@@ -512,6 +629,7 @@ public struct LocalModelRuntimeSetupManager: Sendable {|| manifest.signingKeyID?.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty ?? true) {throw LocalModelRuntimeSetupError.manifestMissingSignature}+ try verifyManifestSignatureIfConfigured(manifest, requiresSignature: requiresSignature)}@discardableResult@@ -906,6 +1024,77 @@ public struct LocalModelRuntimeSetupManager: Sendable {try configuredEnvironment()[environmentVariableName]}+ @discardableResult+ public func removeRuntime(+ runtimeID: LocalModelRuntimeID,+ removePackageFiles: Bool = true,+ removeModelWeights: Bool = true+ ) throws -> Bool {+ _ = try spec(for: runtimeID)+ var registry = try loadRegistry()+ guard let installation = registry.installations.removeValue(forKey: runtimeID.rawValue) else {+ return false+ }+ try saveRegistry(registry)++ if removePackageFiles {+ let packageDirectory = URL(fileURLWithPath: installation.downloadedDirectoryPath, isDirectory: true)+ if packageDirectory.path.hasPrefix(baseDirectory.path),+ FileManager.default.fileExists(atPath: packageDirectory.path) {+ try FileManager.default.removeItem(at: packageDirectory)+ }+ }++ if removeModelWeights {+ let cacheDirectory = modelCacheDirectory(for: installation)+ if cacheDirectory.path.hasPrefix(baseDirectory.path),+ FileManager.default.fileExists(atPath: cacheDirectory.path) {+ try FileManager.default.removeItem(at: cacheDirectory)+ }+ }++ return true+ }++ public func repairRuntime(+ runtimeID: LocalModelRuntimeID,+ downloader: any LocalModelRuntimePackageDownloading = URLSessionLocalModelRuntimePackageDownloader()+ ) async throws -> LocalModelRuntimeRepairReport {+ let removed = try removeRuntime(runtimeID: runtimeID)+ let downloadResult = try await downloadAndInstall(runtimeID: runtimeID, downloader: downloader)+ let modelPreparation = try await prepareModelWeights(runtimeID: runtimeID)+ let health = try await recheckHealth(runtimeID: runtimeID)+ return LocalModelRuntimeRepairReport(+ runtimeID: runtimeID,+ downloadResult: downloadResult,+ modelPreparation: modelPreparation,+ health: health,+ metadata: ["removedExistingRuntime": String(removed)]+ )+ }++ public func supportSnapshot() throws -> LocalModelRuntimeSupportSnapshot {+ LocalModelRuntimeSupportSnapshot(+ generatedAt: now(),+ statuses: try statuses().map { status in+ LocalModelRuntimeSupportStatus(+ runtimeID: status.spec.id,+ displayName: status.spec.displayName,+ state: status.state,+ environmentVariableName: status.spec.environmentVariableName,+ runtimeVersion: status.installation?.runtimeVersion,+ modelID: status.installation?.modelID ?? status.spec.modelName,+ sidecarProtocolVersion: status.installation?.sidecarProtocolVersion,+ reason: status.metadata["reason"]+ )+ }+ )+ }++ public func supportExportData() throws -> Data {+ try Self.encoder().encode(supportSnapshot())+ }+private func spec(for runtimeID: LocalModelRuntimeID) throws -> LocalModelRuntimeSpec {guard let spec = specs.first(where: { $0.id == runtimeID }) else {throw LocalModelRuntimeSetupError.unknownRuntime(runtimeID.rawValue)@@ -913,6 +1102,39 @@ public struct LocalModelRuntimeSetupManager: Sendable {return spec}+ private func verifyManifestSignatureIfConfigured(+ _ manifest: LocalModelRuntimePackageManifest,+ requiresSignature: Bool+ ) throws {+ guard requiresSignature else { return }+ guard let signingKeyID = manifest.signingKeyID,+ let signature = manifest.signature,+ !signingKeyID.isEmpty,+ !signature.isEmpty+ else {+ throw LocalModelRuntimeSetupError.manifestMissingSignature+ }++ guard let publicKeyBase64 = trustedManifestSigningKeys[signingKeyID] else {+ if requiresCryptographicManifestSignatures {+ throw LocalModelRuntimeSetupError.manifestUnknownSigningKey(signingKeyID)+ }+ return+ }++ guard let publicKeyData = Data(base64Encoded: publicKeyBase64),+ let signatureData = Data(base64Encoded: signature)+ else {+ throw LocalModelRuntimeSetupError.manifestInvalidSignature+ }++ let publicKey = try Curve25519.Signing.PublicKey(rawRepresentation: publicKeyData)+ let payload = try Self.signaturePayloadData(for: manifest)+ guard publicKey.isValidSignature(signatureData, for: payload) else {+ throw LocalModelRuntimeSetupError.manifestInvalidSignature+ }+ }+private func loadRegistry() throws -> LocalModelRuntimeRegistry {let url = registryURL()guard FileManager.default.fileExists(atPath: url.path) else {@@ -978,6 +1200,42 @@ public struct LocalModelRuntimeSetupManager: Sendable {.map { String(format: "%02x", $0) }.joined()}++ public static func signaturePayloadData(+ for manifest: LocalModelRuntimePackageManifest+ ) throws -> Data {+ try encoder().encode(+ LocalModelRuntimePackageManifestSignaturePayload(+ runtimeID: manifest.runtimeID,+ runtimeVersion: manifest.runtimeVersion,+ modelID: manifest.modelID,+ platform: manifest.platform,+ architecture: manifest.architecture,+ sidecarProtocolVersion: manifest.sidecarProtocolVersion,+ minimumDonkeyVersion: manifest.minimumDonkeyVersion,+ executableRelativePath: manifest.executableRelativePath,+ files: manifest.files,+ signingKeyID: manifest.signingKeyID,+ releaseNotesURL: manifest.releaseNotesURL,+ metadata: manifest.metadata+ )+ )+ }+}++private struct LocalModelRuntimePackageManifestSignaturePayload: Codable, Equatable, Sendable {+ var runtimeID: LocalModelRuntimeID+ var runtimeVersion: String+ var modelID: String+ var platform: String+ var architecture: String+ var sidecarProtocolVersion: String+ var minimumDonkeyVersion: String+ var executableRelativePath: String+ var files: [LocalModelRuntimePackageFile]+ var signingKeyID: String?+ var releaseNotesURL: URL?+ var metadata: [String: String]}private struct LocalModelRuntimeHealthRequest: Codable, Equatable, Sendable {diff --git a/apps/Donkey/Sources/DonkeyRuntime/ManualCaptureDebugCommand.swift b/apps/Donkey/Sources/DonkeyRuntime/ManualCaptureDebugCommand.swiftindex a873f388..c997ab27 100644--- a/apps/Donkey/Sources/DonkeyRuntime/ManualCaptureDebugCommand.swift+++ b/apps/Donkey/Sources/DonkeyRuntime/ManualCaptureDebugCommand.swift@@ -6,8 +6,11 @@ public enum ManualCaptureDebugCommand: Equatable, Sendable {case manualCapture(ManualCaptureDebugCaptureOptions)case dryRunLatencyReport(DryRunLatencyReportDebugOptions)case localRuntimeStatus+ case localRuntimeSupportcase localRuntimeInstructionscase installLocalRuntime(LocalRuntimeInstallDebugOptions)+ case repairLocalRuntime(LocalModelRuntimeID)+ case removeLocalRuntime(LocalModelRuntimeID)}public struct ManualCaptureDebugCaptureOptions: Equatable, Sendable {@@ -91,8 +94,11 @@ public enum ManualCaptureDebugCommandParser {|| argument == "--manual-capture"|| argument == "--dry-run-latency-report"|| argument == "--local-runtime-status"+ || argument == "--local-runtime-support"|| argument == "--local-runtime-instructions"|| argument == "--install-local-runtime"+ || argument == "--repair-local-runtime"+ || argument == "--remove-local-runtime"|| argument == "--window-id"|| argument == "--run-id"|| argument == "--trace-id"@@ -136,12 +142,21 @@ public enum ManualCaptureDebugCommandParser {case "--local-runtime-status":try setMode(.localRuntimeStatus, current: &mode)index += 1+ case "--local-runtime-support":+ try setMode(.localRuntimeSupport, current: &mode)+ index += 1case "--local-runtime-instructions":try setMode(.localRuntimeInstructions, current: &mode)index += 1case "--install-local-runtime":try setMode(.installLocalRuntime, current: &mode)index += 1+ case "--repair-local-runtime":+ try setMode(.repairLocalRuntime, current: &mode)+ index += 1+ case "--remove-local-runtime":+ try setMode(.removeLocalRuntime, current: &mode)+ index += 1case "--window-id":let value = try value(after: argument, in: arguments, at: index)guard let parsed = UInt32(value) else {@@ -235,6 +250,15 @@ public enum ManualCaptureDebugCommandParser {)}return .localRuntimeStatus+ case .localRuntimeSupport:+ guard windowID == nil, runID == nil, traceID == nil, frameCount == 30,+ benchmarkMode == .endToEndDryRun, runtimeID == nil, runtimeSource == nil+ else {+ throw ManualCaptureDebugCommandParseError.unsupportedOption(+ "runtime install options require a runtime lifecycle command"+ )+ }+ return .localRuntimeSupportcase .localRuntimeInstructions:guard windowID == nil, runID == nil, traceID == nil, frameCount == 30,benchmarkMode == .endToEndDryRun, runtimeID == nil, runtimeSource == nil@@ -264,6 +288,30 @@ public enum ManualCaptureDebugCommandParser {sourceDirectory: runtimeSource))+ case .repairLocalRuntime:+ guard windowID == nil, runID == nil, traceID == nil, frameCount == 30,+ benchmarkMode == .endToEndDryRun, runtimeSource == nil+ else {+ throw ManualCaptureDebugCommandParseError.unsupportedOption(+ "capture, benchmark, or source options are not supported with --repair-local-runtime"+ )+ }+ guard let runtimeID else {+ throw ManualCaptureDebugCommandParseError.missingValue("--runtime-id")+ }+ return .repairLocalRuntime(runtimeID)+ case .removeLocalRuntime:+ guard windowID == nil, runID == nil, traceID == nil, frameCount == 30,+ benchmarkMode == .endToEndDryRun, runtimeSource == nil+ else {+ throw ManualCaptureDebugCommandParseError.unsupportedOption(+ "capture, benchmark, or source options are not supported with --remove-local-runtime"+ )+ }+ guard let runtimeID else {+ throw ManualCaptureDebugCommandParseError.missingValue("--runtime-id")+ }+ return .removeLocalRuntime(runtimeID)}}@@ -420,6 +468,29 @@ public enum ManualCaptureDebugCommandFormatter {return lines}+ public static func lines(+ for snapshot: LocalModelRuntimeSupportSnapshot+ ) -> [String] {+ var lines = [+ "local runtime support snapshot",+ "generatedAt=\(ISO8601DateFormatter().string(from: snapshot.generatedAt))"+ ]+ for status in snapshot.statuses {+ lines.append(+ [+ "runtime=\(status.runtimeID.rawValue)",+ "state=\(status.state.rawValue)",+ "runtimeVersion=\(status.runtimeVersion ?? "-")",+ "modelID=\(status.modelID)",+ "protocolVersion=\(status.sidecarProtocolVersion ?? "-")",+ "reason=\(status.reason ?? "-")"+ ]+ .joined(separator: " | ")+ )+ }+ return lines+ }+public static func lines(for installation: LocalModelRuntimeInstallation,spec: LocalModelRuntimeSpec@@ -459,6 +530,9 @@ private enum ManualCaptureDebugCommandMode {case manualCapturecase dryRunLatencyReportcase localRuntimeStatus+ case localRuntimeSupportcase localRuntimeInstructionscase installLocalRuntime+ case repairLocalRuntime+ case removeLocalRuntime}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/LocalModelRuntimeSetupTests.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/LocalModelRuntimeSetupTests.swiftindex 39b7ac84..34a1f08c 100644--- a/apps/Donkey/Tests/DonkeyRuntimeTests/LocalModelRuntimeSetupTests.swift+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/LocalModelRuntimeSetupTests.swift@@ -1,4 +1,5 @@@testable import DonkeyRuntime+import CryptoKitimport Foundationimport Testing@@ -169,6 +170,111 @@ struct LocalModelRuntimeSetupTests {#expect(FileManager.default.fileExists(atPath: status.installation?.executablePath ?? "") == true)}+ @Test+ func cryptographicManifestSignatureIsVerifiedWhenKeyIsTrusted() async throws {+ let root = temporaryDirectory()+ defer { try? FileManager.default.removeItem(at: root) }+ let executableData = Data("#!/bin/sh\necho ok\n".utf8)+ let privateKey = Curve25519.Signing.PrivateKey()+ let publicKeyBase64 = privateKey.publicKey.rawRepresentation.base64EncodedString()+ var manifest = LocalModelRuntimePackageManifest(+ runtimeID: .uiUnderstander,+ runtimeVersion: "1.0.0",+ modelID: "local-ui-understander",+ executableRelativePath: "bin/donkey-ui-understander",+ files: [+ LocalModelRuntimePackageFile(+ relativePath: "bin/donkey-ui-understander",+ downloadURL: URL(string: "https://example.test/ui/bin")!,+ sha256: LocalModelRuntimeSetupManager.sha256Hex(executableData),+ isExecutable: true+ )+ ],+ signingKeyID: "test-release-key"+ )+ let payload = try LocalModelRuntimeSetupManager.signaturePayloadData(for: manifest)+ manifest.signature = try privateKey.signature(for: payload).base64EncodedString()+ let manager = try LocalModelRuntimeSetupManager(+ baseDirectory: root,+ trustedManifestSigningKeys: [+ LocalModelRuntimeManifestSigningKey(+ keyID: "test-release-key",+ publicKeyBase64: publicKeyBase64+ )+ ],+ requiresCryptographicManifestSignatures: true+ )++ let result = try await manager.downloadAndInstall(+ manifest: manifest,+ downloader: FakeRuntimeDownloader(files: [+ URL(string: "https://example.test/ui/bin")!: executableData+ ])+ )++ #expect(result.state == .installed)+ }++ @Test+ func cryptographicManifestSignatureRejectsUnknownKeyAndBadSignature() async throws {+ let root = temporaryDirectory()+ defer { try? FileManager.default.removeItem(at: root) }+ let executableData = Data("#!/bin/sh\necho ok\n".utf8)+ let privateKey = Curve25519.Signing.PrivateKey()+ var manifest = LocalModelRuntimePackageManifest(+ runtimeID: .yoloSegmenter,+ runtimeVersion: "1.0.0",+ modelID: "ultralytics/yolo26n-seg",+ executableRelativePath: "bin/donkey-yolo-segmenter",+ files: [+ LocalModelRuntimePackageFile(+ relativePath: "bin/donkey-yolo-segmenter",+ downloadURL: URL(string: "https://example.test/yolo/bin")!,+ sha256: LocalModelRuntimeSetupManager.sha256Hex(executableData),+ isExecutable: true+ )+ ],+ signingKeyID: "unknown-key"+ )+ let payload = try LocalModelRuntimeSetupManager.signaturePayloadData(for: manifest)+ manifest.signature = try privateKey.signature(for: payload).base64EncodedString()+ let manager = try LocalModelRuntimeSetupManager(+ baseDirectory: root,+ requiresCryptographicManifestSignatures: true+ )++ await #expect(throws: LocalModelRuntimeSetupError.manifestUnknownSigningKey("unknown-key")) {+ _ = try await manager.downloadAndInstall(+ manifest: manifest,+ downloader: FakeRuntimeDownloader(files: [+ URL(string: "https://example.test/yolo/bin")!: executableData+ ])+ )+ }++ let trustedManager = try LocalModelRuntimeSetupManager(+ baseDirectory: root,+ trustedManifestSigningKeys: [+ LocalModelRuntimeManifestSigningKey(+ keyID: "unknown-key",+ publicKeyBase64: privateKey.publicKey.rawRepresentation.base64EncodedString()+ )+ ],+ requiresCryptographicManifestSignatures: true+ )+ var tampered = manifest+ tampered.runtimeVersion = "2.0.0"++ await #expect(throws: LocalModelRuntimeSetupError.manifestInvalidSignature) {+ _ = try await trustedManager.downloadAndInstall(+ manifest: tampered,+ downloader: FakeRuntimeDownloader(files: [+ URL(string: "https://example.test/yolo/bin")!: executableData+ ])+ )+ }+ }+@Testfunc bundledRuntimePackageInstallsWithoutNetworkDownload() async throws {let root = temporaryDirectory()@@ -339,6 +445,47 @@ struct LocalModelRuntimeSetupTests {#expect(report.metadata["modelWeights.status"] == "downloaded")}+ @Test+ func removeRuntimeClearsRegistryAndManagedFiles() throws {+ let root = temporaryDirectory()+ let download = root.appendingPathComponent("Packages/yolo-segmenter/1.0.0", isDirectory: true)+ defer { try? FileManager.default.removeItem(at: root) }+ let executable = try makeExecutable(+ root: download,+ relativePath: "bin/donkey-yolo-segmenter"+ )+ let manager = try LocalModelRuntimeSetupManager(baseDirectory: root)+ try manager.registerExecutable(+ runtimeID: .yoloSegmenter,+ executableURL: executable,+ downloadedDirectory: download,+ runtimeVersion: "1.0.0",+ modelID: "ultralytics/yolo26n-seg"+ )++ let removed = try manager.removeRuntime(runtimeID: .yoloSegmenter)+ let status = try manager.status(for: .yoloSegmenter)++ #expect(removed)+ #expect(status.state == .notInstalled)+ #expect(!FileManager.default.fileExists(atPath: download.path))+ }++ @Test+ func supportExportOmitsUserDataAndIncludesRuntimeStatus() throws {+ let root = temporaryDirectory()+ defer { try? FileManager.default.removeItem(at: root) }+ let manager = try LocalModelRuntimeSetupManager(baseDirectory: root)++ let snapshot = try manager.supportSnapshot()+ let exportData = try manager.supportExportData()+ let exportText = String(decoding: exportData, as: UTF8.self)++ #expect(snapshot.statuses.count == 4)+ #expect(exportText.contains("parakeet-transcriber"))+ #expect(!exportText.contains(root.path))+ }+private func makeExecutable(root: URL,relativePath: Stringdiff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/ManualCaptureDebugCommandTests.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/ManualCaptureDebugCommandTests.swiftindex b314f3f8..e3e37b11 100644--- a/apps/Donkey/Tests/DonkeyRuntimeTests/ManualCaptureDebugCommandTests.swift+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/ManualCaptureDebugCommandTests.swift@@ -63,6 +63,9 @@ struct ManualCaptureDebugCommandTests {#expect(try ManualCaptureDebugCommandParser.parse(arguments: ["Donkey", "--local-runtime-status"]) == .localRuntimeStatus)+ #expect(try ManualCaptureDebugCommandParser.parse(+ arguments: ["Donkey", "--local-runtime-support"]+ ) == .localRuntimeSupport)#expect(try ManualCaptureDebugCommandParser.parse(arguments: ["Donkey", "--local-runtime-instructions"]) == .localRuntimeInstructions)@@ -84,6 +87,13 @@ struct ManualCaptureDebugCommandTests {sourceDirectory: URL(fileURLWithPath: "/tmp/yolo-runtime"))))++ #expect(try ManualCaptureDebugCommandParser.parse(+ arguments: ["Donkey", "--repair-local-runtime", "--runtime-id", "yolo-segmenter"]+ ) == .repairLocalRuntime(.yoloSegmenter))+ #expect(try ManualCaptureDebugCommandParser.parse(+ arguments: ["Donkey", "--remove-local-runtime", "--runtime-id", "yolo-segmenter"]+ ) == .removeLocalRuntime(.yoloSegmenter))}@Test@@ -182,6 +192,12 @@ struct ManualCaptureDebugCommandTests {#expect(instructionLines.contains("expectedExecutable=bin/donkey-parakeet-transcriber"))#expect(statusLines.contains("local runtime status"))#expect(statusLines.contains("runtime=yolo-segmenter | state=notInstalled | env=DONKEY_YOLO_SEGMENTER | executable=- | reason=noRegisteredRuntime"))++ let supportLines = ManualCaptureDebugCommandFormatter.lines(+ for: try manager.supportSnapshot()+ )+ #expect(supportLines.contains("local runtime support snapshot"))+ #expect(supportLines.contains { $0.contains("runtime=local-llm") })}@Testdiff --git a/docs/architecture.md b/docs/architecture.mdindex f88299da..41bcde76 100644--- a/docs/architecture.md+++ b/docs/architecture.md@@ -137,13 +137,13 @@ weights are not bundled in `Donkey.app`. Developer environment variables canoverride sidecar paths, while normal installs resolve through the app-managedruntime registry under Application Support.-The supported setup boundary includes bundled runner packages, manifest and-checksum validation, Application Support registration, health checks, model-prep-hooks, retryable first-run setup, and optional package-local Python wheelhouses.-Release hardening still needs actual offline wheelhouse artifacts, a real-UI-understanding backend, a self-contained command-parser LLM or documented-Ollama prerequisite, cryptographic release-key signature verification, and-repair/remove lifecycle flows.+The supported setup boundary includes bundled runner packages, manifest,+checksum, and configured release-key signature validation, Application Support+registration, health checks, model-prep hooks, retryable first-run setup,+settings access, repair/remove lifecycle helpers, support status export, and+optional package-local Python wheelhouses. Release hardening still needs actual+offline wheelhouse artifacts and a real UI-understanding backend. The command+parser LLM currently uses Ollama as a documented local prerequisite.## Slower AI Harnessdiff --git a/docs/guides/install-donkey.md b/docs/guides/install-donkey.mdindex 856d2d01..56649837 100644--- a/docs/guides/install-donkey.md+++ b/docs/guides/install-donkey.md@@ -73,7 +73,7 @@ dist/Donkey.app/Contents/Resources/LocalRuntimePackages/Parakeet and YOLO runner packages include manifest-tracked Python requirements. On setup, the sidecar creates a managed virtual environment under Application Support and installs those dependencies there. A package-local `wheelhouse/` directory can be added beside `requirements.txt` when the release build needs offline dependency installation for the supported macOS target.-On first launch, Donkey shows one setup button for local runtimes. Setup installs the bundled sidecar packages first, verifies their manifests/checksums, registers them in Application Support, asks them to prepare model weights, and health-checks them. The bundled packages do not include model weights; they contain protocol-speaking runner entrypoints for the local command parser, Parakeet voice transcription, YOLO screenshot segmentation, and UI understanding. If setup fails, clicking the same button retries failed or not-yet-attempted runtimes while keeping completed installs.+On first launch, Donkey shows one setup button for local runtimes. Setup installs the bundled sidecar packages first, verifies their manifests/checksums/signatures, registers them in Application Support, asks them to prepare model weights, and health-checks them. The bundled packages do not include model weights; they contain protocol-speaking runner entrypoints for the local command parser, Parakeet voice transcription, YOLO screenshot segmentation, and UI understanding. If setup fails, clicking the same button retries failed or not-yet-attempted runtimes while keeping completed installs. The setup window can also be reopened from the app settings.Each bundled sidecar supports setup-time model weight preparation. During setup, Donkey calls the sidecar with `prepareModelWeights`; the sidecar downloads or warms the configured model cache and reports cached/downloaded status before health check. The local command-parser LLM is setup-managed too: Donkey packages a `local-llm` sidecar that pulls `qwen3:8b` through Ollama by default, then submitted commands are parsed through `DONKEY_LOCAL_LLM_RUNNER` instead of a direct in-app Ollama request. The Parakeet runner can fetch the Hugging Face snapshot when `huggingface_hub` is available and transcribes through NVIDIA NeMo when the local Python backend is installed.@@ -90,4 +90,24 @@ DONKEY_LOCAL_LLM_MODEL_ID="qwen3:8b" \./scripts/package-donkey-app.sh```+Release runtime manifests can be verified with Curve25519 signing keys embedded+in the app bundle. Provide trusted public keys as comma-separated+`key-id=base64-public-key` pairs and set strict verification when packaging a+release build:++```bash+DONKEY_RUNTIME_MANIFEST_PUBLIC_KEYS="runtime-release-v1=..." \+DONKEY_RUNTIME_REQUIRE_CRYPTO_SIGNATURES="1" \+./scripts/package-donkey-app.sh+```+If a model URL/backend is missing for a file-backed sidecar, Ollama is unavailable for the local LLM sidecar, or Parakeet's local Python backend is missing, setup or runtime calls fail clearly with a retryable needs-attention state instead of pretending the runtime is usable.++Developer diagnostics:++```bash+swift run Donkey -- --local-runtime-status+swift run Donkey -- --local-runtime-support+swift run Donkey -- --repair-local-runtime --runtime-id yolo-segmenter+swift run Donkey -- --remove-local-runtime --runtime-id yolo-segmenter+```diff --git a/docs/guides/minimal-run-coordinator.md b/docs/guides/minimal-run-coordinator.mdindex 0553041b..cdb43844 100644--- a/docs/guides/minimal-run-coordinator.md+++ b/docs/guides/minimal-run-coordinator.md@@ -44,11 +44,11 @@ Donkey also supports the first slow-planner sidecar beside the dry-run reflex loDonkey also supports the first AI harness model registry and router boundary. `AIModelRegistry` stores model roles, providers, literal model ids, endpoints, capabilities, timeouts, prompt versions, eval status, docs URLs, and rollback ids as registry data. `AIModelRouter` routes slow-path jobs by job type, risk, privacy mode, latency tolerance, capabilities, failed-model history, and allowed providers. Privacy-sensitive planner routes prefer local Ollama-compatible entries when they are available. Privacy-sensitive voice-transcription routes prefer local runtime entries and select NVIDIA Parakeet TDT 0.6B v3 only; Whisper fallback has been removed. `ProcessBackedParakeetTranscriptionRuntime` calls a local JSON stdin/stdout sidecar from `DONKEY_PARAKEET_TRANSCRIBER`, and missing configuration or nonzero exits fail clearly instead of silently falling back. `LocalVoiceTranscriptionAdapter` accepts bounded local audio buffers, routes to the selected local runtime model, returns transcript text plus timing/confidence trace metadata, and marks transcripts as inputs to the normal command parser rather than actions. Literal provider model ids should stay in registry entries, not planner/controller logic.-Donkey also supports a reusable local JSON sidecar runner for local model processes. `ProcessBackedLocalJSONSidecarRunner` reads executable paths from environment variables first, then from Donkey's app-managed local runtime registry, validates executability, sends request JSON on stdin, captures stdout/stderr, records exit status and latency metadata, and returns explicit unavailable or failed statuses. Current model sidecars use `DONKEY_LOCAL_LLM_RUNNER`, `DONKEY_YOLO_SEGMENTER`, `DONKEY_PARAKEET_TRANSCRIBER`, and `DONKEY_UI_UNDERSTANDER`. Submitted pointer-prompt commands parse through the local LLM sidecar and validated `TaskIntent` schema; the deterministic parser remains available as a validator and benchmark utility, not as the submitted-command fallback.+Donkey also supports a reusable local JSON sidecar runner for local model processes. `ProcessBackedLocalJSONSidecarRunner` reads executable paths from environment variables first, then from Donkey's app-managed local runtime registry, validates executability, sends request JSON on stdin, captures stdout/stderr, records exit status and latency metadata, and returns explicit unavailable or failed statuses. Current model sidecars use `DONKEY_LOCAL_LLM_RUNNER`, `DONKEY_YOLO_SEGMENTER`, `DONKEY_PARAKEET_TRANSCRIBER`, and `DONKEY_UI_UNDERSTANDER`. Submitted pointer-prompt commands prefer the local LLM sidecar and validated `TaskIntent` schema. If that runtime is unavailable, the built-in deterministic parser may resolve known built-in commands as a local fallback; this keeps benchmark commands local and traceable while still requiring catalog validation before execution.Donkey's live local-app observation path uses Accessibility and bounded screenshots only. `MacLocalAppTaskController` captures Accessibility controls/visible text and, when the task definition includes screenshot local-model observation, concurrently captures a bounded target-window screenshot with ScreenCaptureKit and sends that image to `ProcessBackedLocalUIUnderstandingAdapter`. The adapter output is merged into `LocalAppTaskObservation` as visible text, controls, form fields, confidence, and metadata. Screenshot understanding is observation context only and never emits direct input actions.-Donkey also supports the first post-install local runtime setup boundary. The app package does not ship model weights, but `scripts/package-donkey-app.sh` creates Donkey-compatible sidecar runner packages and embeds them in `Donkey.app/Contents/Resources/LocalRuntimePackages/`. Each package contains a small executable wrapper plus `donkey_runtime_runner.py`, and manifests checksum both files. Parakeet and YOLO packages also include a manifest-tracked `requirements.txt`; the runner creates a managed virtual environment under Application Support, installs those dependencies there, and can use a package-local wheelhouse when one is supplied for offline distribution. `LocalModelRuntimeSetupManager` describes the required Parakeet, YOLO26, UI-understanding, and local command-parser LLM runtime packages, provides user-facing setup instructions, installs bundled package manifests before remote manifests, validates user-downloaded runtime folders, downloads manifest-backed package files when configured, enforces SHA-256 checksums and required signature metadata, caches verified package files under Application Support, asks each installed sidecar to prepare model weights in Application Support, and records executable paths in `~/Library/Application Support/Donkey/LocalModelRuntimes/runtime-installations.json`. The `local-llm` runner uses Ollama `qwen3:8b` when available but reports a non-blocking external-unavailable state during setup when Ollama is absent; submitted commands still have the deterministic local-app parser fallback. The Parakeet runner can prepare a Hugging Face snapshot and calls NVIDIA NeMo for transcription when available; YOLO installs its managed Ultralytics dependency and prepares the selected segmentation model; UI-understanding currently reports a placeholder backend instead of blocking setup on a missing model URL. After registration, sidecar calls can resolve app-managed executables without shell environment variables. The first-run setup window exposes one setup button that installs/downloads, verifies, registers, prepares model weights, and health-checks all required runtimes, with one overall ready or retryable needs-attention state. Retry keeps completed runtime installs and resumes at failed or not-yet-attempted runtimes. Developer launch arguments can print setup instructions, show install status, or register a downloaded runtime folder.+Donkey also supports the first post-install local runtime setup boundary. The app package does not ship model weights, but `scripts/package-donkey-app.sh` creates Donkey-compatible sidecar runner packages and embeds them in `Donkey.app/Contents/Resources/LocalRuntimePackages/`. Each package contains a small executable wrapper plus `donkey_runtime_runner.py`, and manifests checksum both files. Parakeet and YOLO packages also include a manifest-tracked `requirements.txt`; the runner creates a managed virtual environment under Application Support, installs those dependencies there, and can use a package-local wheelhouse when one is supplied for offline distribution. `LocalModelRuntimeSetupManager` describes the required Parakeet, YOLO26, UI-understanding, and local command-parser LLM runtime packages, provides user-facing setup instructions, installs bundled package manifests before remote manifests, validates user-downloaded runtime folders, downloads manifest-backed package files when configured, enforces SHA-256 checksums and required signature metadata, verifies Curve25519 manifest signatures when trusted release keys are configured, caches verified package files under Application Support, asks each installed sidecar to prepare model weights in Application Support, and records executable paths in `~/Library/Application Support/Donkey/LocalModelRuntimes/runtime-installations.json`. The `local-llm` runner uses Ollama `qwen3:8b` when available but reports a non-blocking external-unavailable state during setup when Ollama is absent; submitted commands still have the deterministic local-app parser fallback. The Parakeet runner can prepare a Hugging Face snapshot and calls NVIDIA NeMo for transcription when available; YOLO installs its managed Ultralytics dependency and prepares the selected segmentation model; UI-understanding currently reports a placeholder backend instead of blocking setup on a missing model URL. After registration, sidecar calls can resolve app-managed executables without shell environment variables. The first-run setup window exposes one setup button that installs/downloads, verifies, registers, prepares model weights, and health-checks all required runtimes, with one overall ready or retryable needs-attention state. Retry keeps completed runtime installs and resumes at failed or not-yet-attempted runtimes. Settings can reopen setup, and runtime lifecycle helpers can repair or remove managed installs and export user-data-free support status. Developer launch arguments can print setup instructions, show install status, export support status, repair, remove, or register a downloaded runtime folder.Donkey also supports the first provider-neutral planner-hint adapter boundary using OpenAI's Responses API. `OpenAIPlannerHintAdapter` reads `OPENAI_API_KEY` from the environment, routes through the model registry, sends a structured-output Responses request with `store: false`, decodes a strict planner-hint JSON response, and records a model-call trace with role, provider, model id, prompt version, schema id, latency, timeout, validation status, and source trace/state ids. Missing credentials, cancellation, timeout, rate limit, invalid output, and provider outage return traceable failures without stopping the reflex loop. Official OpenAI docs were rechecked on May 16, 2026 for the Responses API, `text.format` JSON schema structured outputs, `store: false`, and current model registry default guidance.@@ -109,7 +109,7 @@ This is a coordination, in-memory reflex trace, hot-loop contract, deterministic- Use monotonic timestamps for latency math. Wall-clock timestamps are for human labels and trace correlation only.- Use latency reports for any p50/p95/p99 claim. Reports should include dropped frames, stale actions, tick rates, and worst traces.- Keep local-navigation decisions typed and side-effect free until the guarded live-action slice. Metadata projectors may use window, browser-tab, and Accessibility facts when available, but controllers should emit semantic actions only.-- Keep local-model task intents separate from planner hints. A supported local command should first parse to a validated `TaskIntent` through the app-managed local LLM sidecar; deterministic parsing is only validator/benchmark support, and slow planner output may only help app-knowledge lookup or recovery after validation.+- Keep local-model task intents separate from planner hints. A supported local command should first try to parse to a validated `TaskIntent` through the app-managed local LLM sidecar. The deterministic parser may act as a local fallback for known built-in benchmark commands when the sidecar is unavailable; both paths must resolve through catalog validation before execution. Slow planner output may only help app-knowledge lookup or recovery after validation.- Keep local-app task adapter output inspectable before live control. Dry-run steps should show the normalized entities, target app identity, observation boundary, guarded command templates, and verification status before the live runner is allowed to launch, focus, type, or submit.- Keep local task definitions data-driven. Built-ins are examples; local JSON/JSONL definitions in Application Support are the extension point for more apps and workflows.- Keep document form filling review-first. Field detection, data mapping, proposed values, unmapped required fields, unused data keys, and approval IDs must be inspectable before any live fill action is enabled.@@ -119,7 +119,7 @@ This is a coordination, in-memory reflex trace, hot-loop contract, deterministic- Keep model selection in `AIModelRegistry` data. Do not scatter provider model ids through planner code.- Keep local voice transcription as a Parakeet-only model-routed local runtime job. Transcription output is transcript text only and must enter the same validated command path as typed input before any task can run. If `DONKEY_PARAKEET_TRANSCRIBER` is missing or fails, the voice path fails clearly; it must not silently fall back to Whisper or any remote transcription provider.- Keep local model runtimes behind JSON sidecars. Use `DONKEY_YOLO_SEGMENTER`, `DONKEY_PARAKEET_TRANSCRIBER`, and `DONKEY_UI_UNDERSTANDER` for developer overrides, then Donkey's app-managed runtime registry for normal user installs. Return explicit unavailable results when executables are absent.-- Do not bundle model weights in the app. Users download compatible runtime packages after app install; Donkey validates manifests, checksums, signature metadata, executable paths, and health checks, then records executable paths under Application Support.+- Do not bundle model weights in the app. Users download compatible runtime packages after app install; Donkey validates manifests, checksums, signature metadata or configured cryptographic signatures, executable paths, and health checks, then records executable paths under Application Support.- Keep privacy-sensitive Responses API calls configured with `store: false` unless an explicit later policy changes that default.- Treat provider failures as sidecar failures. Missing credentials, timeout, rate limit, invalid output, or outage should leave the controller running on local state and existing valid hints.- Keep memory writes source-linked and scoped. Model-proposed memory writes must pass the deterministic approver before storage; target and user records require TTL or explicit durable retention.@@ -150,6 +150,9 @@ swift run Donkey -- --dry-run-latency-report --frame-count 30swift run Donkey -- --local-runtime-instructionsswift run Donkey -- --install-local-runtime --runtime-id yolo-segmenter --runtime-source <downloaded-runtime-folder>swift run Donkey -- --local-runtime-status+swift run Donkey -- --local-runtime-support+swift run Donkey -- --repair-local-runtime --runtime-id yolo-segmenter+swift run Donkey -- --remove-local-runtime --runtime-id yolo-segmenter```Manual verification on May 16, 2026 confirmed that the list command enumerates current visible Mac windows and that manual capture against a normal Mac app window creates a run folder with 9 ordered coordinator events, one screenshot artifact, and one Accessibility artifact. The verified run targeted a non-frontmost, non-focused Fork window by durable `windowID`.diff --git a/plans/done/22-local-runtime-onboarding.md b/plans/done/22-local-runtime-onboarding.mdindex 4467d56e..4a83c235 100644--- a/plans/done/22-local-runtime-onboarding.md+++ b/plans/done/22-local-runtime-onboarding.md@@ -11,15 +11,19 @@ Donkey now supports a normal post-install runtime setup boundary:- app-managed runtime registry under Application Support- bundled runner packages embedded in `Donkey.app`- manifest validation for runtime id, platform, architecture, executable path,- required signature metadata, and SHA-256 file hashes+ required signature metadata, configured release-key signatures, and SHA-256+ file hashes- package install into managed Application Support directories- setup-time model preparation before health checks- sidecar `healthCheck` protocol- retryable setup that keeps completed installs and resumes failed or missingruntimes+- settings access to reopen setup+- repair/remove lifecycle helpers+- user-data-free support status export- app-registry sidecar resolution when shell environment variables are absent-- developer debug commands for setup instructions, status, and manual runtime- registration+- developer debug commands for setup instructions, status, support status,+ repair, remove, and manual runtime registrationThe supported behavior is documented in:@@ -29,8 +33,6 @@ The supported behavior is documented in:## Follow-Up Work-Remaining release hardening is tracked by `plans/master-plan.md`, not this-completed plan. That includes offline wheelhouse artifacts, final backend-packaging, cryptographic release-key verification, runtime repair/remove flows,-a settings entry to reopen setup, support export, and the final command-parser-LLM prerequisite decision.+Remaining release artifact work is tracked by `plans/master-plan.md`, not this+completed plan. That includes offline wheelhouse artifacts and the real local+UI-understanding backend.diff --git a/plans/master-plan.md b/plans/master-plan.mdindex dc33065d..0358157e 100644--- a/plans/master-plan.md+++ b/plans/master-plan.md@@ -38,37 +38,18 @@ contracts, local runtime setup UI, manifest/checksum installation, model-prephooks, latency reporting, memory/redaction/observability scaffolding, andoptional slow-planner hint path are supported and documented.-The milestone is not release-complete because local runtime packaging is still-not self-contained.+The milestone is not release-complete because local runtime model artifacts are+still not self-contained and the live Weather benchmark still needs a recorded+manual baseline.## What Remains-1. Ship release-grade local runtime packages:- - publish offline wheelhouse-backed Parakeet and YOLO bundles for supported- macOS targets- - decide whether Parakeet's NVIDIA NeMo backend ships prepared or remains an- optional backend+1. Ship release-grade local runtime artifacts:+ - publish offline wheelhouse-backed Parakeet and YOLO bundles for supported macOS targets- replace the UI-understanding placeholder with a real local backend- - replace the Ollama-backed command-parser LLM with a self-contained runner,- or explicitly keep Ollama as a documented prerequisite--2. Harden runtime trust and lifecycle:- - verify runtime manifests with release-key cryptographic signatures, not- signature metadata alone- - add behind-the-scenes repair/remove flows for broken runtime installs- - add a settings entry to reopen runtime setup and a user-data-free support- export for runtime status- - keep the first-run setup button retryable without exposing per-runtime user- customization--3. Clean up command parsing policy:- - decide whether submitted commands may keep deterministic built-in fallback- when the local LLM sidecar is unavailable- - make code, docs, and tests agree on that policy--4. Prove the benchmark:- - run "show me the weather for SF" through a verified Weather result with no- remote dependency in the execution trace++2. Prove the live benchmark:+ - run "show me the weather for SF" through a verified Weather result with no remote dependency in the execution trace- compare latency against a documented manual baseline on the same machine## Invariants@@ -93,5 +74,5 @@ Do not move the active plans to `plans/done/` until:selected rule, input/backend calls, verification, and guardrails.- Voice commands, when enabled, transcribe locally before command parsing.- The hot loop keeps working when the slow AI harness is disabled or failing.-- Runtime packaging, trust verification, and setup repair are release-grade.+- Runtime artifacts are release-grade.- Guides document the supported behavior and boundaries.diff --git a/scripts/package-donkey-app.sh b/scripts/package-donkey-app.shindex b3442124..678d5a55 100755--- a/scripts/package-donkey-app.sh+++ b/scripts/package-donkey-app.sh@@ -11,6 +11,8 @@ APP_VERSION="${DONKEY_APP_VERSION:-0.1.0}"APP_BUILD="${DONKEY_APP_BUILD:-1}"SPARKLE_FEED_URL="${DONKEY_SPARKLE_FEED_URL:-}"SPARKLE_PUBLIC_ED_KEY="${DONKEY_SPARKLE_PUBLIC_ED_KEY:-}"+RUNTIME_MANIFEST_PUBLIC_KEYS="${DONKEY_RUNTIME_MANIFEST_PUBLIC_KEYS:-}"+RUNTIME_REQUIRE_CRYPTO_SIGNATURES="${DONKEY_RUNTIME_REQUIRE_CRYPTO_SIGNATURES:-0}"CONTENTS_DIR="$APP_DIR/Contents"MACOS_DIR="$CONTENTS_DIR/MacOS"RESOURCES_DIR="$CONTENTS_DIR/Resources"@@ -163,6 +165,26 @@ if [ -n "$SPARKLE_FEED_URL" ] && [ -n "$SPARKLE_PUBLIC_ED_KEY" ]; then<string>$SPARKLE_PUBLIC_ED_KEY</string>"fi+RUNTIME_SIGNATURE_PLIST_KEYS=""+if [ -n "$RUNTIME_MANIFEST_PUBLIC_KEYS" ]; then+ RUNTIME_SIGNATURE_PLIST_KEYS=" <key>DonkeyRuntimeRequiresCryptographicManifestSignatures</key>+ <$( [ "$RUNTIME_REQUIRE_CRYPTO_SIGNATURES" = "1" ] && printf true || printf false )/>+ <key>DonkeyRuntimeManifestPublicKeys</key>+ <dict>"+ IFS=',' read -r -a runtime_key_pairs <<< "$RUNTIME_MANIFEST_PUBLIC_KEYS"+ for pair in "${runtime_key_pairs[@]}"; do+ key_id="${pair%%=*}"+ public_key="${pair#*=}"+ if [ -n "$key_id" ] && [ -n "$public_key" ] && [ "$key_id" != "$public_key" ]; then+ RUNTIME_SIGNATURE_PLIST_KEYS="$RUNTIME_SIGNATURE_PLIST_KEYS+ <key>$key_id</key>+ <string>$public_key</string>"+ fi+ done+ RUNTIME_SIGNATURE_PLIST_KEYS="$RUNTIME_SIGNATURE_PLIST_KEYS+ </dict>"+fi+cat > "$CONTENTS_DIR/Info.plist" <<PLIST<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">@@ -191,6 +213,7 @@ cat > "$CONTENTS_DIR/Info.plist" <<PLIST<key>NSAppleEventsUsageDescription</key><string>Donkey uses local app automation only for user-requested actions.</string>$SPARKLE_PLIST_KEYS+$RUNTIME_SIGNATURE_PLIST_KEYS</dict></plist>PLIST