Open source CapCut alternative.
TypeScript
Remove bundled runtime package support
David Le6ffe54ccd121
diff --git a/apps/Donkey/Sources/DonkeyRuntime/LocalModelRuntimeSetup.swift b/apps/Donkey/Sources/DonkeyRuntime/LocalModelRuntimeSetup.swiftindex cc8f2498..8b9f4abc 100644--- a/apps/Donkey/Sources/DonkeyRuntime/LocalModelRuntimeSetup.swift+++ b/apps/Donkey/Sources/DonkeyRuntime/LocalModelRuntimeSetup.swift@@ -396,7 +396,6 @@ public struct LocalModelRuntimeSetupManager: Sendable {public var specs: [LocalModelRuntimeSpec]public var isExecutableFile: @Sendable (String) -> Boolpublic var now: @Sendable () -> Date- public var bundledPackageDirectory: @Sendable (LocalModelRuntimeID) -> URL?public var trustedManifestSigningKeys: [String: String]public var requiresCryptographicManifestSignatures: Bool@@ -405,7 +404,6 @@ public struct LocalModelRuntimeSetupManager: Sendable {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,trustedManifestSigningKeys: [LocalModelRuntimeManifestSigningKey] = Self.defaultTrustedManifestSigningKeys(),requiresCryptographicManifestSignatures: Bool = Self.defaultRequiresCryptographicManifestSignatures()) throws {@@ -413,7 +411,6 @@ public struct LocalModelRuntimeSetupManager: Sendable {self.specs = specsself.isExecutableFile = isExecutableFileself.now = now- self.bundledPackageDirectory = bundledPackageDirectoryself.trustedManifestSigningKeys = Dictionary(uniqueKeysWithValues: trustedManifestSigningKeys.map { ($0.keyID, $0.publicKeyBase64) })@@ -428,6 +425,7 @@ public struct LocalModelRuntimeSetupManager: Sendable {expectedExecutableRelativePath: "bin/donkey-parakeet-transcriber",modelName: "nvidia/parakeet-tdt-0.6b-v3",downloadPageURL: URL(string: "https://huggingface.co/nvidia/parakeet-tdt-0.6b-v3"),+ manifestURL: Self.defaultPackageManifestURL(for: .parakeetTranscriber),installSteps: ["Click Set Up in Donkey after installing the app.","Donkey downloads and verifies the compatible Parakeet runtime package.",@@ -442,6 +440,7 @@ public struct LocalModelRuntimeSetupManager: Sendable {expectedExecutableRelativePath: "bin/donkey-yolo-segmenter",modelName: "ultralytics/yolo26n-seg",downloadPageURL: URL(string: "https://docs.ultralytics.com/models/yolo26/"),+ manifestURL: Self.defaultPackageManifestURL(for: .yoloSegmenter),installSteps: ["Click Set Up in Donkey after installing the app.","Donkey downloads and verifies the compatible YOLO26 segmentation runtime package.",@@ -456,6 +455,7 @@ public struct LocalModelRuntimeSetupManager: Sendable {expectedExecutableRelativePath: "bin/donkey-ui-understander",modelName: "apple-vision-text-recognition",downloadPageURL: nil,+ manifestURL: Self.defaultPackageManifestURL(for: .uiUnderstander),installSteps: ["Click Set Up in Donkey after installing the app.","Donkey downloads and verifies the compatible UI-understanding runtime package.",@@ -470,6 +470,7 @@ public struct LocalModelRuntimeSetupManager: Sendable {expectedExecutableRelativePath: "bin/donkey-local-llm",modelName: "qwen3:8b",downloadPageURL: URL(string: "https://ollama.com/library/qwen3"),+ manifestURL: Self.defaultPackageManifestURL(for: .localLLM),installSteps: ["Click Set Up in Donkey after installing the app.","Donkey asks the local LLM runner to download and cache qwen3:8b.",@@ -495,19 +496,42 @@ public struct LocalModelRuntimeSetupManager: Sendable {.appendingPathComponent("LocalModelRuntimes", isDirectory: true)}- public static func defaultBundledPackageDirectory(runtimeID: LocalModelRuntimeID) -> URL? {- guard let resourcesURL = Bundle.main.resourceURL else { return nil }- let packageDirectory = resourcesURL- .appendingPathComponent("LocalRuntimePackages", isDirectory: true)- .appendingPathComponent(runtimeID.rawValue, isDirectory: true)- guard FileManager.default.fileExists(- atPath: packageDirectory- .appendingPathComponent("manifest.json", isDirectory: false)- .path- ) else {- return nil+ public static func defaultPackageManifestURL(for runtimeID: LocalModelRuntimeID) -> URL? {+ if let bundledURLs = Bundle.main.object(+ forInfoDictionaryKey: "DonkeyRuntimePackageManifestURLs"+ ) as? [String: String],+ let value = bundledURLs[runtimeID.rawValue],+ let url = URL(string: value) {+ return url+ }++ if let value = ProcessInfo.processInfo.environment[manifestURLEnvironmentName(for: runtimeID)],+ let url = URL(string: value) {+ return url+ }++ return ProcessInfo.processInfo.environment["DONKEY_RUNTIME_PACKAGE_MANIFEST_URLS"]?+ .split(separator: ",")+ .compactMap { pair -> (String, String)? in+ let parts = pair.split(separator: "=", maxSplits: 1).map(String.init)+ guard parts.count == 2 else { return nil }+ return (parts[0], parts[1])+ }+ .first(where: { runtime, _ in runtime == runtimeID.rawValue })+ .flatMap { _, value in URL(string: value) }+ }++ private static func manifestURLEnvironmentName(for runtimeID: LocalModelRuntimeID) -> String {+ switch runtimeID {+ case .parakeetTranscriber:+ return "DONKEY_PARAKEET_RUNTIME_MANIFEST_URL"+ case .yoloSegmenter:+ return "DONKEY_YOLO_RUNTIME_MANIFEST_URL"+ case .uiUnderstander:+ return "DONKEY_UI_UNDERSTANDER_RUNTIME_MANIFEST_URL"+ case .localLLM:+ return "DONKEY_LOCAL_LLM_RUNTIME_MANIFEST_URL"}- return packageDirectory}public static func defaultTrustedManifestSigningKeys() -> [LocalModelRuntimeManifestSigningKey] {@@ -541,13 +565,6 @@ public struct LocalModelRuntimeSetupManager: Sendable {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)- let manifestData = try Data(contentsOf: manifestURL)- return try Self.decoder().decode(LocalModelRuntimePackageManifest.self, from: manifestData)- }-public func instructions() -> [LocalModelRuntimeInstallInstruction] {specs.map { spec inLocalModelRuntimeInstallInstruction(@@ -574,20 +591,6 @@ public struct LocalModelRuntimeSetupManager: Sendable {)}- if let bundledManifest = try? bundledPackageManifest(for: runtimeID),- bundledManifest.runtimeVersion != installation.runtimeVersion {- return LocalModelRuntimeStatus(- spec: spec,- state: .notInstalled,- installation: installation,- metadata: [- "reason": "bundledRuntimeUpdateAvailable",- "installedRuntimeVersion": installation.runtimeVersion ?? "",- "bundledRuntimeVersion": bundledManifest.runtimeVersion- ]- )- }-let state: LocalModelRuntimeInstallState = isExecutableFile(installation.executablePath)? .installed: .invalidExecutable@@ -758,26 +761,6 @@ public struct LocalModelRuntimeSetupManager: Sendable {downloader: any LocalModelRuntimePackageDownloading = URLSessionLocalModelRuntimePackageDownloader(),requiresSignature: Bool = true) async throws -> LocalModelRuntimeDownloadResult {- if let packageDirectory = bundledPackageDirectory(runtimeID) {- let manifestURL = packageDirectory.appendingPathComponent("manifest.json", isDirectory: false)- let manifestData = try Data(contentsOf: manifestURL)- let manifest = try Self.decoder().decode(LocalModelRuntimePackageManifest.self, from: manifestData)- let installation = try installDownloadedPackage(- manifest: manifest,- packageDirectory: packageDirectory,- requiresSignature: requiresSignature- )- return LocalModelRuntimeDownloadResult(- runtimeID: runtimeID,- state: .installed,- installation: installation,- metadata: [- "download.source": "bundledRuntimePackage",- "download.packageDirectory": packageDirectory.path- ]- )- }-let spec = try spec(for: runtimeID)guard let manifestURL = spec.manifestURL else {throw LocalModelRuntimeSetupError.manifestMissingDownloadURL(relativePath: "manifest")diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/LocalModelRuntimeSetupTests.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/LocalModelRuntimeSetupTests.swiftindex 34a1f08c..5c7db0ed 100644--- a/apps/Donkey/Tests/DonkeyRuntimeTests/LocalModelRuntimeSetupTests.swift+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/LocalModelRuntimeSetupTests.swift@@ -275,54 +275,6 @@ struct LocalModelRuntimeSetupTests {}}- @Test- func bundledRuntimePackageInstallsWithoutNetworkDownload() async throws {- let root = temporaryDirectory()- let package = temporaryDirectory()- defer {- try? FileManager.default.removeItem(at: root)- try? FileManager.default.removeItem(at: package)- }- let executableData = Data("#!/bin/sh\ncat >/dev/null\nprintf '{\"status\":\"ok\",\"runtimeID\":\"yolo-segmenter\",\"runtimeVersion\":\"0.1.0\",\"modelID\":\"bootstrap-yolo26\",\"protocolVersion\":\"v1\",\"metadata\":{}}'\n".utf8)- let executableURL = try makeExecutable(- root: package,- relativePath: "bin/donkey-yolo-segmenter",- data: executableData- )- let manifest = LocalModelRuntimePackageManifest(- runtimeID: .yoloSegmenter,- runtimeVersion: "0.1.0",- modelID: "bootstrap-yolo26",- executableRelativePath: "bin/donkey-yolo-segmenter",- files: [- LocalModelRuntimePackageFile(- relativePath: "bin/donkey-yolo-segmenter",- sha256: LocalModelRuntimeSetupManager.sha256Hex(executableData),- isExecutable: true- )- ],- signature: "bundled-bootstrap-signature",- signingKeyID: "donkey-bootstrap"- )- let manifestData = try JSONEncoder().encode(manifest)- try manifestData.write(to: package.appendingPathComponent("manifest.json", isDirectory: false))- let manager = try LocalModelRuntimeSetupManager(- baseDirectory: root,- bundledPackageDirectory: { runtimeID in- runtimeID == .yoloSegmenter ? package : nil- }- )-- let result = try await manager.downloadAndInstall(runtimeID: .yoloSegmenter)- let status = try manager.status(for: .yoloSegmenter)-- #expect(result.state == .installed)- #expect(result.metadata["download.source"] == "bundledRuntimePackage")- #expect(status.state == .installed)- #expect(status.installation?.executablePath != executableURL.path)- #expect(status.installation?.downloadedDirectoryPath.contains("/Packages/yolo-segmenter/0.1.0") == true)- }-@Testfunc manifestDownloadRejectsMissingSignatureAndBadChecksums() async throws {let root = temporaryDirectory()diff --git a/docs/guides/install-donkey.md b/docs/guides/install-donkey.mdindex 0cb3c5b1..ff2d3264 100644--- a/docs/guides/install-donkey.md+++ b/docs/guides/install-donkey.md@@ -65,24 +65,25 @@ DONKEY_SPARKLE_FEED_URL="file:///Users/me/donkey-updates/appcast.xml"When Sparkle finds a valid signed update, the expanded notch task panel shows an update button in its header. Clicking it invokes Sparkle's standard update UI.-The package script also creates Donkey-compatible sidecar runner packages under `dist/LocalRuntimePackages` and embeds them into:+The package script also creates Donkey-compatible sidecar runner packages under:```text-dist/Donkey.app/Contents/Resources/LocalRuntimePackages/+dist/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. Normal packages do not bundle Python wheelhouses; setup downloads dependencies from the Python package index. Build and explicitly bundle offline wheelhouse artifacts only when the release must install without network access:+These package folders are release artifacts to host outside the app. App packages do not include local runtime packages. On setup, Donkey downloads the configured manifest-backed package, installs it fresh into Application Support, then the sidecar creates a managed virtual environment and installs manifest-tracked Python requirements from the Python package index.++Configure hosted runtime manifest URLs when packaging:```bash-./scripts/build-local-runtime-wheelhouses.sh-DONKEY_BUNDLE_RUNTIME_WHEELHOUSES=1 \- DONKEY_RUNTIME_WHEELHOUSE_ROOT="dist/LocalRuntimeWheelhouses" \- ./scripts/package-donkey-app.sh+DONKEY_RUNTIME_PACKAGE_BASE_URL="https://example.com/donkey/runtimes" \+DONKEY_RUNTIME_PACKAGE_MANIFEST_URLS="parakeet-transcriber=https://example.com/donkey/runtimes/parakeet-transcriber/manifest.json,yolo-segmenter=https://example.com/donkey/runtimes/yolo-segmenter/manifest.json,ui-understander=https://example.com/donkey/runtimes/ui-understander/manifest.json,local-llm=https://example.com/donkey/runtimes/local-llm/manifest.json" \+./scripts/package-donkey-app.sh```-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 Parakeet or YOLO model weights; they contain protocol-speaking runner entrypoints for the local command parser, Parakeet voice transcription, and YOLO screenshot segmentation. UI understanding ships as a local Swift sidecar that uses Apple's on-device Vision text recognition and does not need downloaded model weights. 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.+On first launch, Donkey shows one setup button for local runtimes. Setup downloads the configured sidecar packages, verifies their manifests/checksums/signatures, registers them in Application Support, asks them to prepare model weights, and health-checks them. The packages do not include Parakeet or YOLO model weights; they contain protocol-speaking runner entrypoints for the local command parser, Parakeet voice transcription, and YOLO screenshot segmentation. UI understanding ships as a local Swift sidecar that uses Apple's on-device Vision text recognition and does not need downloaded model weights. 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.+Each 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.Configure model-weight URLs when packaging:diff --git a/docs/guides/minimal-run-coordinator.md b/docs/guides/minimal-run-coordinator.mdindex b7e25d4c..b3c82d77 100644--- a/docs/guides/minimal-run-coordinator.md+++ b/docs/guides/minimal-run-coordinator.md@@ -48,7 +48,7 @@ Donkey also supports a reusable local JSON sidecar runner for local model procesDonkey's live local-app observation path uses Accessibility and bounded screenshots only. `MacLocalAppTaskController` captures Accessibility controls/visible text first and, when the task definition includes screenshot local-model observation, captures a bounded target-window screenshot only if Accessibility/metadata did not provide the verification text or required controls. That screenshot is sent 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 Parakeet or YOLO model weights, but `scripts/package-donkey-app.sh` creates Donkey-compatible sidecar runner packages and embeds them in `Donkey.app/Contents/Resources/LocalRuntimePackages/`. Each Python-backed 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 from the Python package index by default, and uses a package-local wheelhouse only for explicitly requested offline release artifacts. UI understanding ships as a Swift sidecar using Apple's on-device Vision text recognition, so it does not need downloaded model weights. `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. 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 post-install local runtime setup boundary. The app package does not ship local runtime packages or Parakeet/YOLO model weights, but `scripts/package-donkey-app.sh` creates Donkey-compatible sidecar runner package artifacts under `dist/LocalRuntimePackages/` for release hosting. Each Python-backed 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 and installs those dependencies there from the Python package index. UI understanding ships as a Swift sidecar using Apple's on-device Vision text recognition, so it does not need downloaded model weights. `LocalModelRuntimeSetupManager` describes the required Parakeet, YOLO26, UI-understanding, and local command-parser LLM runtime packages, provides user-facing setup instructions, downloads configured manifest-backed package files, validates user-downloaded runtime folders, 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. 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 JSON response containing a planner hint plus optional memory write proposals, 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.@@ -154,7 +154,6 @@ swift run Donkey -- --local-runtime-statusswift run Donkey -- --local-runtime-supportswift run Donkey -- --repair-local-runtime --runtime-id yolo-segmenterswift run Donkey -- --remove-local-runtime --runtime-id yolo-segmenter-./scripts/build-local-runtime-wheelhouses.sh```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/scripts/build-local-runtime-wheelhouses.sh b/scripts/build-local-runtime-wheelhouses.shdeleted file mode 100755index 41978bdc..00000000--- a/scripts/build-local-runtime-wheelhouses.sh+++ /dev/null@@ -1,43 +0,0 @@-#!/usr/bin/env bash-set -euo pipefail--ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"-OUTPUT_DIR="${DONKEY_RUNTIME_WHEELHOUSE_ROOT:-$ROOT_DIR/dist/LocalRuntimeWheelhouses}"-PYTHON="${DONKEY_RUNTIME_PYTHON:-python3}"-PIP_DOWNLOAD_ARGS="${DONKEY_PIP_DOWNLOAD_ARGS:-}"--mkdir -p "$OUTPUT_DIR"--download_wheelhouse() {- local runtime_id="$1"- local requirements="$2"- local runtime_dir="$OUTPUT_DIR/$runtime_id"- local requirements_file- requirements_file="$(mktemp)"-- rm -rf "$runtime_dir"- mkdir -p "$runtime_dir"- printf '%s\n' "$requirements" > "$requirements_file"-- # shellcheck disable=SC2086- "$PYTHON" -m pip download \- --only-binary=:all: \- --dest "$runtime_dir" \- -r "$requirements_file" \- $PIP_DOWNLOAD_ARGS-- rm -f "$requirements_file"- find "$runtime_dir" -maxdepth 1 -type f ! -name SHA256SUMS -print0 | sort -z | xargs -0 shasum -a 256 > "$runtime_dir/SHA256SUMS"-}--parakeet_requirements=$'huggingface_hub>=0.25,<1'-if [ -n "${DONKEY_PARAKEET_EXTRA_REQUIREMENTS:-}" ]; then- parakeet_requirements="$parakeet_requirements-$DONKEY_PARAKEET_EXTRA_REQUIREMENTS"-fi--download_wheelhouse "parakeet-transcriber" "$parakeet_requirements"-download_wheelhouse "yolo-segmenter" $'ultralytics>=8.3,<9\nopencv-python-headless>=4.10,<5'--echo "Built local runtime wheelhouses in $OUTPUT_DIR"-echo "Package them with: DONKEY_RUNTIME_WHEELHOUSE_ROOT=\"$OUTPUT_DIR\" ./scripts/package-donkey-app.sh"diff --git a/scripts/local-runtime-runners/donkey_runtime_runner.py b/scripts/local-runtime-runners/donkey_runtime_runner.pyindex c9233d3a..dfea8bbc 100644--- a/scripts/local-runtime-runners/donkey_runtime_runner.py+++ b/scripts/local-runtime-runners/donkey_runtime_runner.py@@ -215,9 +215,6 @@ def install_python_requirements(venv_python: Path, requirements: list[str], statrequirements_path = state_dir / "requirements.txt"requirements_path.write_text("\n".join(requirements) + "\n")command = [str(venv_python), "-m", "pip", "install", "-r", str(requirements_path)]- wheelhouse = runtime_wheelhouse()- if wheelhouse is not None:- command.extend(["--no-index", "--find-links", str(wheelhouse)])environment = os.environ.copy()environment["PIP_DISABLE_PIP_VERSION_CHECK"] = "1"completed = subprocess.run(@@ -232,18 +229,6 @@ def install_python_requirements(venv_python: Path, requirements: list[str], statraise RuntimeError(f"pip install failed: {completed.stderr[-1200:]}")-def runtime_wheelhouse() -> Path | None:- configured = os.environ.get("DONKEY_RUNTIME_WHEELHOUSE")- if configured and Path(configured).exists():- return Path(configured)- package_dir = os.environ.get("DONKEY_RUNTIME_PACKAGE_DIR")- if package_dir:- candidate = Path(package_dir) / "wheelhouse"- if candidate.exists():- return candidate- return None--def safe_model_dir(cache_dir: str | None = None, model_id: str | None = None) -> Path:root = Path(cache_dir or tempfile.gettempdir())safe_model = (model_id or MODEL_ID or RUNTIME_ID).replace("/", "-").replace(":", "-")diff --git a/scripts/package-donkey-app.sh b/scripts/package-donkey-app.shindex 547a80ce..46120acd 100755--- a/scripts/package-donkey-app.sh+++ b/scripts/package-donkey-app.sh@@ -7,6 +7,8 @@ DMG_PATH="$ROOT_DIR/dist/Donkey.dmg"DMG_ROOT="$ROOT_DIR/dist/DonkeyInstaller"RUNTIME_PACKAGE_DIR="$ROOT_DIR/dist/LocalRuntimePackages"RUNTIME_PACKAGE_VERSION="${DONKEY_RUNTIME_PACKAGE_VERSION:-0.3.0-runner}"+RUNTIME_PACKAGE_BASE_URL="${DONKEY_RUNTIME_PACKAGE_BASE_URL:-}"+RUNTIME_PACKAGE_MANIFEST_URLS="${DONKEY_RUNTIME_PACKAGE_MANIFEST_URLS:-}"APP_VERSION="${DONKEY_APP_VERSION:-0.1.0}"APP_BUILD="${DONKEY_APP_BUILD:-1}"SPARKLE_FEED_URL="${DONKEY_SPARKLE_FEED_URL:-}"@@ -22,19 +24,19 @@ EXECUTABLE="$BUILD_DIR/.build/release/Donkey"UI_UNDERSTANDER_EXECUTABLE="$BUILD_DIR/.build/release/DonkeyUIUnderstandingSidecar"CACHE_DIR="$BUILD_DIR/.build/package-cache"RUNTIME_RUNNER_SOURCE="$ROOT_DIR/scripts/local-runtime-runners/donkey_runtime_runner.py"-RUNTIME_WHEELHOUSE_ROOT="${DONKEY_RUNTIME_WHEELHOUSE_ROOT:-$ROOT_DIR/dist/LocalRuntimeWheelhouses}"-BUNDLE_RUNTIME_WHEELHOUSES="${DONKEY_BUNDLE_RUNTIME_WHEELHOUSES:-0}"mkdir -p "$CACHE_DIR/clang" "$CACHE_DIR/swiftpm" "$CACHE_DIR/home"export CLANG_MODULE_CACHE_PATH="$CACHE_DIR/clang"export SWIFTPM_CACHE_PATH="$CACHE_DIR/swiftpm"export HOME="$CACHE_DIR/home"-if [ "$BUNDLE_RUNTIME_WHEELHOUSES" = "1" ]; then- echo "Runtime wheelhouses will be bundled from $RUNTIME_WHEELHOUSE_ROOT"-else- echo "Runtime wheelhouses will not be bundled; setup will install Python dependencies from the network."-fi+manifest_download_url_entry() {+ local runtime_id="$1"+ local relative_path="$2"+ if [ -n "$RUNTIME_PACKAGE_BASE_URL" ]; then+ printf ',\n "downloadURL" : "%s/%s/%s"' "${RUNTIME_PACKAGE_BASE_URL%/}" "$runtime_id" "$relative_path"+ fi+}cd "$BUILD_DIR"echo "Compiling Donkey for Mac ..."@@ -67,7 +69,6 @@ make_runtime_package() {local executable_path="$bin_dir/$executable_name"local runner_path="$lib_dir/donkey_runtime_runner.py"local requirements_path="$package_dir/requirements.txt"- local wheelhouse_source="$RUNTIME_WHEELHOUSE_ROOT/$runtime_id"mkdir -p "$bin_dir" "$lib_dir"cp "$RUNTIME_RUNNER_SOURCE" "$runner_path"@@ -96,41 +97,28 @@ EOF_RUNTIMEif [ -n "$requirements" ]; thenprintf '%s\n' "$requirements" > "$requirements_path"fi- if [ "$BUNDLE_RUNTIME_WHEELHOUSES" = "1" ] && [ -d "$wheelhouse_source" ]; then- mkdir -p "$package_dir/wheelhouse"- cp -R "$wheelhouse_source/." "$package_dir/wheelhouse/"- filocal executable_shalocal runner_shalocal requirements_sha=""local requirements_manifest_entry=""- local wheelhouse_manifest_entries=""executable_sha="$(shasum -a 256 "$executable_path" | awk '{print $1}')"runner_sha="$(shasum -a 256 "$runner_path" | awk '{print $1}')"+ local executable_download_url_entry+ local runner_download_url_entry+ executable_download_url_entry="$(manifest_download_url_entry "$runtime_id" "bin/$executable_name")"+ runner_download_url_entry="$(manifest_download_url_entry "$runtime_id" "lib/donkey_runtime_runner.py")"if [ -f "$requirements_path" ]; thenrequirements_sha="$(shasum -a 256 "$requirements_path" | awk '{print $1}')"+ local requirements_download_url_entry+ requirements_download_url_entry="$(manifest_download_url_entry "$runtime_id" "requirements.txt")"requirements_manifest_entry=",{- \"relativePath\" : \"requirements.txt\",+ \"relativePath\" : \"requirements.txt\"$requirements_download_url_entry,\"sha256\" : \"$requirements_sha\",\"isExecutable\" : false}"fi- if [ -d "$package_dir/wheelhouse" ]; then- while IFS= read -r wheelhouse_file; do- local wheelhouse_sha- local wheelhouse_relative_path- wheelhouse_sha="$(shasum -a 256 "$wheelhouse_file" | awk '{print $1}')"- wheelhouse_relative_path="${wheelhouse_file#$package_dir/}"- wheelhouse_manifest_entries="$wheelhouse_manifest_entries,- {- \"relativePath\" : \"$wheelhouse_relative_path\",- \"sha256\" : \"$wheelhouse_sha\",- \"isExecutable\" : false- }"- done < <(find "$package_dir/wheelhouse" -type f | sort)- ficat > "$package_dir/manifest.json" <<EOF_MANIFEST{"runtimeID" : "$runtime_id",@@ -143,17 +131,17 @@ EOF_RUNTIME"executableRelativePath" : "bin/$executable_name","files" : [{- "relativePath" : "bin/$executable_name",+ "relativePath" : "bin/$executable_name"$executable_download_url_entry,"sha256" : "$executable_sha","isExecutable" : true},{- "relativePath" : "lib/donkey_runtime_runner.py",+ "relativePath" : "lib/donkey_runtime_runner.py"$runner_download_url_entry,"sha256" : "$runner_sha","isExecutable" : true- }$requirements_manifest_entry$wheelhouse_manifest_entries+ }$requirements_manifest_entry],- "signature" : "bundled-runner-package",+ "signature" : "donkey-runner-package","signingKeyID" : "donkey-runner","metadata" : {"runtime.package" : "donkey-runner-package",@@ -183,6 +171,8 @@ make_binary_runtime_package() {local executable_shaexecutable_sha="$(shasum -a 256 "$executable_path" | awk '{print $1}')"+ local executable_download_url_entry+ executable_download_url_entry="$(manifest_download_url_entry "$runtime_id" "bin/$executable_name")"cat > "$package_dir/manifest.json" <<EOF_MANIFEST{"runtimeID" : "$runtime_id",@@ -195,12 +185,12 @@ make_binary_runtime_package() {"executableRelativePath" : "bin/$executable_name","files" : [{- "relativePath" : "bin/$executable_name",+ "relativePath" : "bin/$executable_name"$executable_download_url_entry,"sha256" : "$executable_sha","isExecutable" : true}],- "signature" : "bundled-runner-package",+ "signature" : "donkey-runner-package","signingKeyID" : "donkey-runner","metadata" : {"runtime.package" : "donkey-binary-runtime-package",@@ -219,7 +209,6 @@ make_runtime_package "parakeet-transcriber" "donkey-parakeet-transcriber" "nvidimake_runtime_package "yolo-segmenter" "donkey-yolo-segmenter" "ultralytics/yolo26n-seg" "screenshotSegmentation" "${DONKEY_YOLO_MODEL_URL:-}" "${DONKEY_YOLO_MODEL_SHA256:-}" "${DONKEY_YOLO_MODEL_FILENAME:-yolo26n-seg.pt}" $'ultralytics>=8.3,<9\nopencv-python-headless>=4.10,<5'make_binary_runtime_package "ui-understander" "donkey-ui-understander" "$UI_UNDERSTANDER_EXECUTABLE" "apple-vision-text-recognition" "uiUnderstanding"make_runtime_package "local-llm" "donkey-local-llm" "${DONKEY_LOCAL_LLM_MODEL_ID:-qwen3:8b}" "localLLM" "" "" "${DONKEY_LOCAL_LLM_MODEL_FILENAME:-ollama-qwen3-8b}"-cp -R "$RUNTIME_PACKAGE_DIR" "$RESOURCES_DIR/LocalRuntimePackages"RESOURCE_BUNDLE="$(find "$BUILD_DIR/.build" -path "*/release/Donkey_Donkey.bundle" -type d | head -n 1 || true)"if [ -n "$RESOURCE_BUNDLE" ]; then@@ -268,6 +257,39 @@ if [ -n "$RUNTIME_MANIFEST_PUBLIC_KEYS" ]; then</dict>"fi+RUNTIME_PACKAGE_MANIFEST_PLIST_KEYS=""+append_runtime_package_manifest_url() {+ local runtime_id="$1"+ local manifest_url="$2"+ if [ -z "$runtime_id" ] || [ -z "$manifest_url" ]; then+ return+ fi+ RUNTIME_PACKAGE_MANIFEST_PLIST_KEYS="$RUNTIME_PACKAGE_MANIFEST_PLIST_KEYS+ <key>$runtime_id</key>+ <string>$manifest_url</string>"+}++if [ -n "$RUNTIME_PACKAGE_MANIFEST_URLS" ]; then+ IFS=',' read -r -a manifest_url_pairs <<< "$RUNTIME_PACKAGE_MANIFEST_URLS"+ for pair in "${manifest_url_pairs[@]}"; do+ runtime_id="${pair%%=*}"+ manifest_url="${pair#*=}"+ if [ "$runtime_id" != "$manifest_url" ]; then+ append_runtime_package_manifest_url "$runtime_id" "$manifest_url"+ fi+ done+fi+append_runtime_package_manifest_url "parakeet-transcriber" "${DONKEY_PARAKEET_RUNTIME_MANIFEST_URL:-}"+append_runtime_package_manifest_url "yolo-segmenter" "${DONKEY_YOLO_RUNTIME_MANIFEST_URL:-}"+append_runtime_package_manifest_url "ui-understander" "${DONKEY_UI_UNDERSTANDER_RUNTIME_MANIFEST_URL:-}"+append_runtime_package_manifest_url "local-llm" "${DONKEY_LOCAL_LLM_RUNTIME_MANIFEST_URL:-}"++if [ -n "$RUNTIME_PACKAGE_MANIFEST_PLIST_KEYS" ]; then+ RUNTIME_PACKAGE_MANIFEST_PLIST_KEYS=" <key>DonkeyRuntimePackageManifestURLs</key>+ <dict>$RUNTIME_PACKAGE_MANIFEST_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">@@ -296,6 +318,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_PACKAGE_MANIFEST_PLIST_KEYS$RUNTIME_SIGNATURE_PLIST_KEYS</dict></plist>