Open source CapCut alternative.
TypeScript
update docs
David Le7e8d3d211ee6
diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/AIHarnessAdapterTests.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/AIHarnessAdapterTests.swiftindex 01bfdd28..60941595 100644--- a/apps/Donkey/Tests/DonkeyRuntimeTests/AIHarnessAdapterTests.swift+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/AIHarnessAdapterTests.swift@@ -376,6 +376,28 @@ struct AIHarnessAdapterTests {#expect(result.trace.status == .completed)}+ @Test+ func localModelTaskIntentResolverFallsBackToDeterministicParserWhenRuntimeUnavailable() async {+ let resolver = LocalModelTaskIntentResolver(+ catalog: LocalAppTaskCatalog(+ taskDefinitions: BuiltInLocalAppTaskDefinitions.defaults,+ availabilityProvider: StaticLocalAppAvailabilityProvider(installedBundleIdentifiers: ["com.apple.weather"])+ ),+ adapter: UnavailableTaskIntentAdapter()+ )++ let result = await resolver.resolve(+ command: "show me the weather for SF",+ sourceTraceID: "trace-resolve-fallback"+ )++ #expect(result.resolution.status == .resolved)+ #expect(result.resolution.intent?.parserSource == .deterministic)+ #expect(result.resolution.intent?.normalizedEntities["city"] == "San Francisco")+ #expect(result.trace.validationStatus == "deterministicFallback")+ #expect(result.trace.metadata["fallback.reason"] == "localModelIntentUnavailable")+ }+@Testfunc openAIAdapterBuildsResponsesRequestWithStoreFalseAndDecodesStructuredHint() async throws {let httpClient = FakeAIHTTPClient(@@ -812,6 +834,28 @@ private struct FakeSidecarRunner: LocalJSONSidecarRunning {}}+private struct UnavailableTaskIntentAdapter: TaskIntentParsingAdapter {+ func parseTaskIntent(_ request: TaskIntentAdapterRequest) async -> TaskIntentAdapterResult {+ TaskIntentAdapterResult(+ intent: nil,+ trace: AIModelCallTrace(+ id: "model-call-unavailable",+ role: .taskIntent,+ provider: .localRuntime,+ modelID: "qwen3:8b",+ promptVersion: "task-intent-v1",+ schemaID: "task_intent_v1",+ latencyMS: nil,+ timeoutMS: 4_000,+ status: .providerOutage,+ validationStatus: "notValidated",+ sourceTraceID: request.sourceTraceID,+ metadata: ["reason": "runtimeUnavailable"]+ )+ )+ }+}+private final class FakeAIHTTPClient: AIHTTPClient, @unchecked Sendable {var data: Datavar statusCode: Intdiff --git a/docs/architecture.md b/docs/architecture.mdindex 9c7960b9..f88299da 100644--- a/docs/architecture.md+++ b/docs/architecture.md@@ -137,6 +137,14 @@ 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.+## Slower AI Harness```textdiff --git a/docs/guides/install-donkey.md b/docs/guides/install-donkey.mdindex d7966c91..856d2d01 100644--- a/docs/guides/install-donkey.md+++ b/docs/guides/install-donkey.md@@ -1,6 +1,6 @@# Install Donkey Locally-Donkey can be packaged into a local macOS app bundle for manual testing.+Donkey can be packaged into a local macOS app bundle and drag-to-Applications disk image for manual testing or site distribution.From the repo root:@@ -8,7 +8,21 @@ From the repo root:./scripts/package-donkey-app.sh```-The script builds the release executable, creates `dist/Donkey.app`, copies bundled resources, and applies an ad-hoc signature when `codesign` is available.+The script builds the release executable, creates `dist/Donkey.app`, copies bundled resources, applies an ad-hoc signature when `codesign` is available, and creates `dist/Donkey.dmg`.++The app bundle version defaults to `0.1.0` build `1`. Override it for local release testing:++```bash+DONKEY_APP_VERSION="0.1.1" DONKEY_APP_BUILD="2" ./scripts/package-donkey-app.sh+```++For distribution through the site, publish the disk image:++```text+dist/Donkey.dmg+```++Opening the disk image mounts a `Donkey` volume with `Donkey.app` and an `Applications` shortcut, matching the standard Codex-style macOS install flow. The user installs Donkey by dragging the app onto the shortcut, which copies it into `/Applications`.To launch the packaged app:@@ -16,12 +30,49 @@ To launch the packaged app:open dist/Donkey.app```+To test the installer flow:++```bash+open dist/Donkey.dmg+```++## Sparkle Updates++Donkey uses Sparkle for app updates. Do not add a Donkey-specific update installer or custom replacement flow; Sparkle owns appcast parsing, update validation, download, install, relaunch, and user-facing update UI.++Configure Sparkle when packaging:++```bash+DONKEY_APP_VERSION="0.1.1" \+DONKEY_APP_BUILD="2" \+DONKEY_SPARKLE_FEED_URL="https://example.com/donkey/appcast.xml" \+DONKEY_SPARKLE_PUBLIC_ED_KEY="..." \+./scripts/package-donkey-app.sh+```++For local update testing, use Sparkle's standard local appcast workflow:++1. Package the older app and install it in `/Applications`.+2. Package the newer app with a higher `DONKEY_APP_VERSION` / `DONKEY_APP_BUILD`.+3. Use Sparkle's `generate_appcast` tooling over the folder containing the newer update archive.+4. Package or launch the older app with `DONKEY_SPARKLE_FEED_URL` pointing to the local `file://` appcast and `DONKEY_SPARKLE_PUBLIC_ED_KEY` set to the matching public EdDSA key.++Example feed URL shape:++```bash+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:```textdist/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.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.diff --git a/docs/guides/minimal-run-coordinator.md b/docs/guides/minimal-run-coordinator.mdindex 4817fbbe..0553041b 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 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. `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 prepares Ollama weights by pulling `qwen3:8b` by default; the Parakeet runner can prepare a Hugging Face snapshot and calls NVIDIA NeMo for transcription when available; YOLO and UI-understanding packages expose the same protocol and explicit backend-missing states. 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, 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 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.diff --git a/docs/guides/pointer-prompt-overlay.md b/docs/guides/pointer-prompt-overlay.mdindex d084173a..50c4a860 100644--- a/docs/guides/pointer-prompt-overlay.md+++ b/docs/guides/pointer-prompt-overlay.md@@ -4,27 +4,33 @@Donkey supports a floating macOS pointer prompt overlay:-- double-tap Command and release to activate and focus a compact prompt modal at the current pointer location without clicking into the target app+- double-tap Command and release to activate and focus a compact prompt modal centered on the current screen without clicking into the target app+- Command-K activates and focuses the prompt input in the center of the current screen- double-tap Command and hold the second Command press to activate voice input+- shows a notch-anchored black status panel flush with the top center of the current screen+- sizes the notch status panel from `NSScreen.safeAreaInsets` and `auxiliaryTopLeftArea` / `auxiliaryTopRightArea`, with fallback dimensions for non-reporting displays+- keeps status text below the physical notch void while the black panel visually extends the notch+- expands the notch status panel on hover to show the agent roster and a bottom command row+- shows an update button in the expanded notch header when Sparkle reports a valid appcast update- shows a black prompt modal with text input and a white voice waveform while active- uses a wide pill-shaped prompt for single-line text, then expands to a rounded rectangle when text wraps at the max input width or the user inserts new lines- places the waveform in a bottom toolbar that blends with the input background when the prompt is expanded- captures microphone audio while active and renders the waveform from recent live audio levels- on voice activation, records a bounded local audio buffer, sends it to the Parakeet-only local transcription adapter, displays transcript progress, and submits decoded transcript text through the same command path as typed input-- keeps the prompt modal pinned where activation happened until the user drags, dismisses, or closes the modal+- keeps the prompt modal centered until the user drags, dismisses, or closes the modal- dismisses the active modal when the user clicks outside it- closes the active modal with a small high-contrast circular x button outside the prompt surface at the top-right corner- supports dragging the active modal from capsule areas outside the text input- lets normal clicks pass through the inactive overlay and transparent active overlay space-- opens near the user mouse at a fixed 45-degree bottom-right diagonal-- keeps that fixed offset at screen edges instead of flipping or clamping to the visible screen bounds+- opens the prompt input centered on the current screen instead of following the cursor+- dismisses the centered prompt after submission and moves visible progress/result feedback into the notch status panel- submits typed prompt text through the local-app command pipeline while keeping model parsing, task validation, and live input outside the SwiftUI rendering pathThis is a visual, typed-command, and voice-command UI capability. Typed submissions go to the local-app command handler, which loads built-in plus local JSON/JSONL task definitions, prefers local-model task-intent parsing, validates the intent against the app-task catalog, and then runs the guarded local-app live runner. Voice submissions produce local transcript text through the Parakeet-only transcription boundary before entering that same command handler. Review-only document tasks can return a compact review summary such as the number of mapped fields. The overlay itself does not capture the screen, synthesize input, or require Accessibility permission. It does request microphone permission for local waveform capture and voice commands.## Technical Guidelines-- The overlay window is an `NSPanel` owned by `PointerPromptOverlayController`.+- The overlay uses `NSPanel` surfaces owned by `PointerPromptOverlayController`: a top-center notch status panel and a separate centered prompt input panel.- Donkey runs with the accessory activation policy, and prompt focus must make the app active, make the panel key, then make the composer text view first responder. A blinking insertion point alone does not mean macOS is sending keyboard events to the panel.- SwiftUI rendering stays in `DonkeyUI`; it receives `PointerPromptState` and `PointerPromptPlacement` from `DonkeyContracts`.- Product state stays in `PointerPromptOverlayModel`.@@ -36,11 +42,12 @@ This is a visual, typed-command, and voice-command UI capability. Typed submissi- The controller owns microphone capture and publishes normalized audio levels into product state; SwiftUI only renders the levels it receives.- The active prompt modal should use a capsule shape and keep transparent active overlay space passing clicks through to windows underneath after it dismisses.- Agent pointer drawing and theme code may remain available for future features, but the prompt overlay should not render a visible cursor.-- The prompt should keep its retained fixed offset geometry from the real pointer on an equal x/y diagonal.-- Runtime placement is fixed to `bottomRight`; alternate `PointerPromptPlacement` values are only rendering variants.-- The controller must not clamp visible modal bounds to `NSScreen.visibleFrame`; cursor-relative positioning is a direct fixed-offset calculation.-- Launch positioning and double-Command activation handling belong in `PointerPromptOverlayController`, not the SwiftUI view.-- Double-Command is the only active shortcut today. Its default lives in `PointerPromptActivationShortcut.doubleCommand` so a future settings layer can supply a different shortcut without rewriting controller event handling.+- Runtime placement remains fixed to `bottomRight` for compatibility with the existing view contract; the rendered input panel itself is centered and no longer uses pointer-relative geometry.+- The notch status panel should keep its visual language aligned with the `/prototype` route: compact active-agent badge when collapsed, roster plus command row when expanded.+- The expanded notch header may show an update button when `PointerPromptUpdateState` is actionable; clicking it should invoke Sparkle's standard update UI outside the SwiftUI view.+- The controller should derive notch geometry from the active `NSScreen`, prefer safe-area and auxiliary-top areas over hardcoded notch sizes, and keep visible status content below the top safe-area inset.+- Launch positioning, notch positioning, Command-K activation, and double-Command activation handling belong in `PointerPromptOverlayController`, not the SwiftUI view.+- Command-K is the primary typed prompt activation shortcut. Double-Command remains available as a voice-friendly activation shortcut through `PointerPromptActivationShortcut.doubleCommand`.- Double-Command prompt activation should require two clean Command down/up taps within 450ms. Any intervening key press, mouse press, extra modifier, or overlong Command hold should reset the sequence so normal shortcuts do not summon the modal.- Holding the second clean Command press for the shortcut's configured hold duration should activate the prompt modal and start microphone level capture instead of waiting for the second release.- Keep the overlay non-invasive: no screen capture loop, input execution, Accessibility prompt, or direct model call in SwiftUI rendering. Submit text to a command handler boundary instead.@@ -56,7 +63,7 @@ swift buildswift run Donkey```-Launch Donkey and confirm the inactive overlay does not render a visible cursor. Double-tap Command and release to show the black prompt capsule with keyboard focus, grant microphone permission if prompted, then speak or tap near the microphone and confirm the waveform responds to real audio levels. Type enough text to wrap and confirm the prompt changes from a pill into a rounded rectangle, grows downward while its top edge stays fixed, and moves the waveform into a blended bottom toolbar with no divider between the toolbar and text input. Press Shift-Return and confirm it inserts a newline; press Return and confirm it submits. Move the mouse and confirm the active modal stays pinned. Double-tap Command again but hold the second Command press, and confirm the same prompt modal appears. Click outside the active modal and confirm it dismisses. Reactivate, click the high-contrast rounded x button outside the capsule, and confirm it closes and remains visible over light and dark app backgrounds. Drag the modal from non-input capsule areas. Activate near the bottom-right screen edge to confirm the prompt keeps the same fixed offset instead of flipping or clamping. Confirm Command plus another key, Command-click, and a single Command tap do not activate the modal.+Launch Donkey and confirm the inactive overlay renders as a black notch extension at the top center, with status content below the physical notch area on notched displays. Hover the notch and confirm it expands into the agent roster with a bottom command row, then collapses after the pointer leaves. With Sparkle configured to a local appcast that contains a newer signed update, confirm the expanded header shows an update button and clicking it opens Sparkle's update UI. Press Command-K and confirm the black prompt capsule opens centered on the screen with keyboard focus, grant microphone permission if prompted, then speak or tap near the microphone and confirm the waveform responds to real audio levels. Type enough text to wrap and confirm the prompt changes from a pill into a rounded rectangle and remains centered as it grows. Press Shift-Return and confirm it inserts a newline; press Return and confirm it submits, dismisses the prompt, and shows working/result status in the notch panel. Move the mouse and confirm the active modal stays centered. Double-tap Command and release to confirm it also opens the centered prompt. Double-tap Command again but hold the second Command press, and confirm the same prompt modal appears with voice capture. Click outside the active modal and confirm it dismisses. Reactivate, click the high-contrast rounded x button outside the capsule, and confirm it closes and remains visible over light and dark app backgrounds. Drag the modal from non-input capsule areas. Confirm Command plus another key other than K, Command-click, and a single Command tap do not activate the modal.## Source Entry Pointsdiff --git a/docs/guides/swift-mvc.md b/docs/guides/swift-mvc.mdindex 9260ea16..7073730c 100644--- a/docs/guides/swift-mvc.md+++ b/docs/guides/swift-mvc.md@@ -15,7 +15,7 @@ Donkey Swift code should keep product state, UI rendering, and AppKit orchestrat- Keep SwiftUI views value-like: pass state in, pass typed intent sinks out, and avoid timers, global mouse reads, model providers, or window management inside views.- Keep models on `@MainActor` when they publish UI state. Models may depend on narrow provider protocols, but not on AppKit windows or timers.-- Keep controllers on `@MainActor` when they touch AppKit. Controllers may read `NSEvent.mouseLocation`, monitor double-Command activation, own `NSPanel`, and translate geometry into model state.+- Keep controllers on `@MainActor` when they touch AppKit. Controllers may read screen and event geometry, monitor Command-K and double-Command activation, own `NSPanel`, and translate geometry into model state.- Keep app entry files small. They should define `@main`, delegate adaptation, and little else.- Prefer target-level separation for reusable contracts and UI: `DonkeyContracts`, `DonkeyUI`, `DonkeyRuntime`, and `DonkeyAI`.- Keep shared UI state types in `DonkeyContracts`, not in `DonkeyUI`, when models and views both need them.@@ -27,8 +27,8 @@ Donkey Swift code should keep product state, UI rendering, and AppKit orchestratThe pointer overlay follows this split:- model state covers prompt text, typed input, placement, theme, and typed intents-- views render the composer and pointer from model state-- the controller owns AppKit-only work such as the floating panel, double-Command activation, fixed-offset positioning, and movement timing+- views render the notch status and composer from model state+- the controller owns AppKit-only work such as the notch and prompt panels, Command-K and double-Command activation, screen positioning, and movement timing- app entry bootstraps the feature and avoids owning product behavior## Review Checklistdiff --git a/plans/04-slow-planner.md b/plans/done/04-slow-planner.mdsimilarity index 100%rename from plans/04-slow-planner.mdrename to plans/done/04-slow-planner.mddiff --git a/plans/master-plan.md b/plans/master-plan.mdindex ee436894..03c8e51a 100644--- a/plans/master-plan.md+++ b/plans/master-plan.md@@ -1,16 +1,28 @@# Fast Local Navigation Agent Master Plan-This is the active task queue. The milestone is focused on fast local navigation: Donkey should turn a short user command into structured intent, navigate the local desktop/app surface quickly, perform guarded local actions, verify the result, and leave the target in the requested state.+This is the active queue for the fast local navigation milestone. Completed+behavior belongs in `docs/guides/` and `docs/architecture.md`; do not keep+completed implementation history here.-Weather lookup is the first simple benchmark scenario for this navigation engine, but it should be represented as app-task knowledge rather than Weather-specific code: when the user says something like "show me the weather for SF", Donkey should resolve the installed app/task definition, open or focus the right app, type/search for San Francisco, verify the result, and present it. The same generic loop should work for many local app use cases where Donkey behaves like an expert user of the app: "play Coldplay" should resolve a media playback task, and "fill out this PDF using this data" should resolve a document form-fill task with document/data context and review gates.+## Goal-Primary plans:+Donkey should take a short local command, resolve it to app-task knowledge,+navigate the local desktop/app surface, perform guarded local actions, verify the+result, and emit a replayable latency trace.-- `plans/20-off-the-shelf-run-loop.md`-- `plans/19-ai-harness.md`+The benchmark command remains:-Supporting plans:+```text+show me the weather for SF+```+Weather is only benchmark data. The same generic loop should also support app+tasks such as media playback and review-first document form fill.++## Active Plans++- `plans/20-off-the-shelf-run-loop.md`+- `plans/19-ai-harness.md`- `plans/01-latency-budget.md`- `plans/02-capture-and-perception.md`- `plans/03-fast-controller.md`@@ -18,91 +30,67 @@ Supporting plans:- `plans/06-benchmarking.md`- `plans/22-local-runtime-onboarding.md`-Completed supporting plans:--- `plans/done/04-slow-planner.md`--Supported behavior and engineering guidance belong in `docs/guides/`. This file tracks what is still needed before those active plans can move to `plans/done/`.--## Plan Management Note--Keep this queue grounded in code reality. Move a plan to `plans/done/` only after the relevant behavior is implemented, documented, and verified. If a slice is only scaffolding, dry-run, or provider-specific, call that out here instead of treating it as completion.--## Milestone Goal--Build the first product-shaped loop where Donkey can run a local navigation session with bounded local execution and an optional slow AI sidecar:--```text-user command: "show me the weather for SF"- -> local intent parse from app-task definitions: weather_lookup(city: "San Francisco")- -> generic local-app task adapter with Weather as data- -> launch or focus app- -> observe app state through Accessibility and bounded screenshots- -> deterministic UI controller- -> guarded keyboard/mouse/Accessibility action execution- -> verify Weather is showing San Francisco- -> latency report and replayable trace--slow AI harness- -> ambiguous-command parse or recovery only- -> compact snapshot- -> model router- -> structured planner hint- -> validated hint bus- -> scoped memory proposal-```--The normal Weather benchmark path should work without a remote model call. A tiny local parser or local slow-model call may help turn the command into structured intent, but navigation, typing, verification, and input must stay local and deterministic.--## Supported Boundary--- Runtime shell: minimal run coordination, ordered events, bounded context assembly, local run artifacts, manual target context capture, first-run local runtime setup UI, package-time bundled sidecar runner packages, manifest-backed runtime install/download/cache/registration in Application Support, sidecar health recheck, in-memory reflex trace retention, and stage-split latency reports are supported.-- Fast navigation hot path: typed frame/world-state/action contracts, deterministic dry-run loop, bounded target-window frame source, cheap metadata perception, recorded off-the-shelf detector/template/OCR/segmentation evidence projection, screenshot segmentation model-candidate catalog and runner boundary with Ultralytics YOLO26 nano segmentation (`yolo26n-seg.pt`), process-backed YOLO sidecar decoding through `DONKEY_YOLO_SEGMENTER` or app-managed runtime registration, local UI-understanding sidecar decoding through `DONKEY_UI_UNDERSTANDER` or app-managed runtime registration, swappable world-state projection, deterministic controller, loop-integrated metadata-only local-navigation dry-run action selection, optional caller-supplied browser-tab metadata, dry-run action projection, generic local-app task intent contracts, data-driven task definitions, local JSON/JSONL task-definition loading, local-LLM sidecar command parsing to validated `TaskIntent`, deterministic parsing as validator/benchmark code, catalog command resolution, target-app availability checks, local task-context intake, Accessibility control discovery, document form-fill review planning, generic dry-run task adaptation, local-navigation request construction, step projection, guarded keyboard and Accessibility command templates, macOS app launch/focus, guarded macOS keyboard input, guarded `AXPress`/`AXSetValue` backend, pointer-prompt typed command submission, Accessibility visible-text observation when trusted, bounded screenshot UI-understanding observation captured as parallel observation context when configured, visible-text verification, background component latency reporting, and built-in task definitions for Weather lookup, media playback, and document form-fill are supported. This is not yet a complete live fast-navigation agent: model weights and local backend dependencies are user-downloaded/prepared after app install rather than bundled.-- Safety boundary: action-engine command contracts, permission/focus/rate/hold/release guardrails, guarded live-action smoke with injected backends, the narrow macOS keyboard backend for local-app tasks, the narrow macOS Accessibility backend for discovered nodes, and replayable command traces are supported.-- Slow AI boundary: local-model task-intent parsing, Parakeet-only local voice-transcription model routing and process-backed sidecar tracing through `DONKEY_PARAKEET_TRANSCRIBER` or app-managed runtime registration, pointer-prompt microphone buffers feeding the Parakeet runtime before command parsing, structured planner hints, validation/expiry/latest-valid selection, loop-adjacent slow-planner trigger/snapshot sidecar, model registry/router, OpenAI Responses and Ollama-compatible planner adapters, provider-backed local/online planner fallback, source-linked memory, bounded semantic memory retrieval contracts, remote-bound redaction hooks, aggregate model-call observability reports, provider-decoded memory proposal handling through the deterministic approver, and replay/eval scaffolding are supported as optional sidecar pieces. NVIDIA Parakeet TDT 0.6B v3 is the selected local voice-transcription default with no Whisper fallback. This is not yet the complete AI harness because Parakeet/YOLO/UI-understanding backend dependency packaging still needs product hardening.-- Source of truth: detailed supported behavior lives in `docs/guides/minimal-run-coordinator.md`; active unfinished work lives in this plan and its primary/supporting plans.--## Non-Negotiable Rules--- No remote model call, chat LLM call, or general VLM call may be required for a reflex tick.-- Common app commands must use local intent parsing before remote planning; deterministic parsing is validator/benchmark support, not the submitted-command fallback.-- The reflex path uses latest-frame-wins queues; stale frames are dropped and counted.-- The controller consumes typed world state, not raw screenshots.-- The action engine owns OS input; controller policies emit semantic commands only.-- Input starts in dry-run mode. Live input requires policy allowance, focus guard success, and emergency release support.-- Planner output is a validated, expiring hint. It is never direct input.-- Latency claims require monotonic timestamps and a report.-- Full-resolution snapshots, screenshots for AI, and memory writes stay outside the reflex loop.--## Current Reality From Commit Review--Recent commits completed these pieces:--- `9b160f8` and `201e76c`: metadata-only local-navigation dry-run, local-navigation controller contracts, memory/replay scaffolding.-- `0e21088`: OpenAI Responses adapter, planner hint contracts, model registry/router scaffolding.-- `9bebfbb`: slow-planner sidecar trigger/snapshot/hint bus and guarded live-action smoke boundary.-- recent slice: Ollama-compatible local planner adapter, provider-backed local/online slow planner fallback, and explicit slow-planner completion tests.-- current slice: generic local-app task catalog, local-model command parser, deterministic parser validator, app availability check, and dry-run adapter boundary, with Weather lookup represented as built-in benchmark data.-- `d6e48c9`: archived plans, which was premature for this milestone.--The code now includes the first generic local-app task catalog, local JSON/JSONL task-definition loader, local task context provider, Accessibility control discovery/action planning, document form-fill review planner, local-LLM sidecar command parser, deterministic parser retained as validator/benchmark code, app availability check, dry-run adapter boundary, local-app live runner, macOS launch/focus, keyboard-input and Accessibility-input backends, pointer-prompt typed and voice command wiring, sample app-task definitions across weather/media/document domains, YOLO26 screenshot segmentation model-candidate metadata and process-backed sidecar backend, local UI-understanding sidecar adapter wired into live observation over bounded screenshots, Parakeet-only local voice-transcription routing and sidecar runtime, shared JSON sidecar runner, first-run local runtime setup UI, package-time bundled sidecar runner packages, setup-time model-weight download/cache operation including Ollama `qwen3:8b` for the local command-parser LLM, manifest-backed runtime install/download/cache/registration, checksum/signature metadata enforcement, sidecar health recheck, semantic memory retrieval contracts, redaction hooks, aggregate model-call observability, provider-decoded memory proposal handling, expanded latency reporting, and a package script that produces `dist/Donkey.app`. It does not yet include fully bundled Python/native backend environments for Parakeet, YOLO, and UI understanding, real UI-understanding model internals, a self-contained non-Ollama LLM runner, or release-key cryptographic signature verification.--## What Should Be Done Next--1. Package or bootstrap the remaining local backend dependencies behind the one setup button: Parakeet needs its local NVIDIA NeMo/Python backend, YOLO needs an Ultralytics-compatible backend and model cache, UI understanding needs a real local model backend, and the command-parser LLM needs either an accepted Ollama prerequisite or a self-contained runner.-2. Finalize release-key cryptographic signature verification, add behind-the-scenes repair/remove flows, and keep setup retryable without exposing per-runtime customization.-3. Keep metric collection as background system behavior using the existing metadata fields for command parse, launch/focus, observation, Accessibility action, keyboard action, verification, YOLO segmentation, UI-understanding, and Parakeet transcription.-4. Keep the current dry-run/guarded-live safety boundary: local or online LLM output can only become validated intent, task definitions, app-knowledge updates, observation summaries, transcripts, memory proposals, or planner hints, never direct input.+Treat other `plans/` files as background unless this plan names them.++## Current Boundary++The local navigation loop, task catalog, guarded input boundary, sidecar runner+contracts, local runtime setup UI, manifest/checksum installation, model-prep+hooks, latency reporting, memory/redaction/observability scaffolding, and+optional slow-planner hint path are supported and documented.++The milestone is not release-complete because local runtime packaging is still+not self-contained.++## 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+ - 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+ - 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+ - compare latency against a documented manual baseline on the same machine++## Invariants++- No remote model call, chat LLM call, or general VLM call may be required for a+ reflex tick.+- The reflex path uses latest-frame-wins queues, typed world state, semantic+ controller actions, and action-engine-owned OS input.+- Live input requires policy allowance, focus guard success, rate/hold/release+ guardrails, and replayable traces.+- Slow AI output can become validated intent, task definitions, app-knowledge+ updates, observation summaries, transcripts, memory proposals, or planner+ hints. It must not become direct input.+- Latency claims require monotonic timestamps and p50/p95/p99 reports.## Completion Gates-Do not move the primary/supporting plans back to `plans/done/` until:+Do not move the active plans to `plans/done/` until:-- The fast-navigation agent can run from "show me the weather for SF" to a verified Weather app result with no remote model dependency in the execution trace.-- Dry-run traces and guarded live traces explain intent parsing, app launch/focus, observation, selected rule, input/backend calls, verification, and guardrail decisions.-- The task is measurably faster than a documented manual baseline on the same machine, or the report clearly identifies which stage prevents that.-- The broader AI harness uses bounded semantic memory retrieval, remote-bound visual/DOM/context redaction, aggregate model-call observability, and provider-decoded memory proposal approval in live slow-planner paths.-- Voice commands, when enabled, produce local transcript text through the model-routed transcription boundary before command parsing, with no remote dependency.-- The hot loop continues to run when the slow AI harness is disabled or failing.-- p50/p95/p99 reports cover intent parse, app launch/focus, observation, controller decision, action projection, input execution, result verification, and any capture/perception fallback.-- The relevant guide in `docs/guides/` documents the supported behavior and boundaries.+- Weather lookup completes end to end locally and verifies the Weather result.+- Dry-run and guarded-live traces explain parsing, launch/focus, observation,+ 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.+- Guides document the supported behavior and boundaries.diff --git a/scripts/local-runtime-runners/donkey_runtime_runner.py b/scripts/local-runtime-runners/donkey_runtime_runner.pyindex 6085fdb7..317cff6b 100644--- a/scripts/local-runtime-runners/donkey_runtime_runner.py+++ b/scripts/local-runtime-runners/donkey_runtime_runner.py@@ -25,12 +25,24 @@ from typing import AnyRUNTIME_ID = os.environ.get("DONKEY_RUNTIME_ID", "")+RUNTIME_VERSION = os.environ.get("DONKEY_RUNTIME_VERSION", "0.3.0-runner")MODEL_ID = os.environ.get("DONKEY_MODEL_ID", "")ROLE = os.environ.get("DONKEY_RUNTIME_ROLE", "")MODEL_URL = os.environ.get("DONKEY_MODEL_URL", "")MODEL_SHA256 = os.environ.get("DONKEY_MODEL_SHA256", "")MODEL_FILENAME = os.environ.get("DONKEY_MODEL_FILENAME", "model.bin")OLLAMA_ENDPOINT = os.environ.get("DONKEY_OLLAMA_ENDPOINT", "http://127.0.0.1:11434")+MANAGED_PYTHON_ENV = "DONKEY_RUNTIME_MANAGED_PYTHON"++DEFAULT_RUNTIME_REQUIREMENTS: dict[str, list[str]] = {+ "parakeet-transcriber": [+ "huggingface_hub>=0.25,<1",+ ],+ "yolo-segmenter": [+ "ultralytics>=8.3,<9",+ "opencv-python-headless>=4.10,<5",+ ],+}def main() -> int:@@ -41,6 +53,9 @@ def main() -> int:return 0operation = request.get("operation")+ managed_exit = run_with_managed_python_if_needed(operation, request)+ if managed_exit is not None:+ return managed_exitif operation == "prepareModelWeights":write_json(prepare_model_weights(request))return 0@@ -91,6 +106,144 @@ def error_payload(reason: str, extra: dict[str, Any] | None = None) -> dict[str,}+def run_with_managed_python_if_needed(operation: Any, request: dict[str, Any]) -> int | None:+ if os.environ.get(MANAGED_PYTHON_ENV) == "1":+ return None+ if RUNTIME_ID not in DEFAULT_RUNTIME_REQUIREMENTS:+ return None+ if operation not in {"prepareModelWeights", None}:+ return None++ requirements = runtime_requirements()+ if not requirements:+ return None++ state_dir = managed_python_state_dir(request)+ venv_python = state_dir / ".venv" / "bin" / "python"+ requirements_fingerprint = hashlib.sha256("\n".join(requirements).encode("utf-8")).hexdigest()+ stamp_file = state_dir / "requirements.sha256"++ try:+ state_dir.mkdir(parents=True, exist_ok=True)+ if not venv_python.exists():+ create_virtualenv(state_dir / ".venv")+ current_fingerprint = stamp_file.read_text().strip() if stamp_file.exists() else ""+ if current_fingerprint != requirements_fingerprint:+ install_python_requirements(venv_python, requirements, state_dir)+ stamp_file.write_text(requirements_fingerprint)+ except FileNotFoundError as exc:+ write_json(+ error_payload(+ "pythonRuntimeUnavailable",+ {"dependency": "python3", "detail": str(exc), "runtimePython.stateDirectory": str(state_dir)},+ )+ )+ return 0+ except Exception as exc: # noqa: BLE001+ write_json(+ error_payload(+ "pythonDependencyInstallFailed",+ {"detail": str(exc), "runtimePython.stateDirectory": str(state_dir)},+ )+ )+ return 0++ environment = os.environ.copy()+ environment[MANAGED_PYTHON_ENV] = "1"+ completed = subprocess.run(+ [str(venv_python), str(Path(__file__).resolve())],+ input=json.dumps(request),+ stdout=subprocess.PIPE,+ stderr=subprocess.PIPE,+ text=True,+ env=environment,+ check=False,+ )+ if completed.returncode == 0 and completed.stdout:+ sys.stdout.write(completed.stdout)+ return 0++ write_json(+ error_payload(+ "managedPythonRuntimeFailed",+ {+ "runtimePython.stateDirectory": str(state_dir),+ "returnCode": completed.returncode,+ "stderr": completed.stderr[-800:],+ },+ )+ )+ return 0+++def managed_python_state_dir(request: dict[str, Any]) -> Path:+ configured = os.environ.get("DONKEY_RUNTIME_STATE_DIR")+ if configured:+ return Path(configured)+ cache_dir = request.get("cacheDirectory")+ if isinstance(cache_dir, str) and cache_dir:+ return Path(cache_dir) / ".runtime-python"+ return Path.home() / "Library" / "Application Support" / "Donkey" / "LocalModelRuntimes" / "RuntimePython" / RUNTIME_ID+++def runtime_requirements() -> list[str]:+ package_dir = os.environ.get("DONKEY_RUNTIME_PACKAGE_DIR")+ if package_dir:+ requirements_path = Path(package_dir) / "requirements.txt"+ if requirements_path.exists():+ return [+ line.strip()+ for line in requirements_path.read_text().splitlines()+ if line.strip() and not line.strip().startswith("#")+ ]+ return DEFAULT_RUNTIME_REQUIREMENTS.get(RUNTIME_ID, [])+++def create_virtualenv(venv_dir: Path) -> None:+ completed = subprocess.run(+ [sys.executable, "-m", "venv", str(venv_dir)],+ stdout=subprocess.PIPE,+ stderr=subprocess.PIPE,+ text=True,+ check=False,+ )+ if completed.returncode != 0:+ raise RuntimeError(f"venv creation failed: {completed.stderr[-800:]}")+++def install_python_requirements(venv_python: Path, requirements: list[str], state_dir: Path) -> None:+ requirements_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(+ command,+ stdout=subprocess.PIPE,+ stderr=subprocess.PIPE,+ text=True,+ env=environment,+ check=False,+ )+ if completed.returncode != 0:+ raise 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(":", "-")@@ -120,6 +273,16 @@ def prepare_model_weights(request: dict[str, Any]) -> dict[str, Any]:if RUNTIME_ID == "yolo-segmenter":return prepare_ultralytics_model(cache_dir)+ if RUNTIME_ID == "ui-understander":+ return prepared(+ cache_dir,+ {+ "modelWeights.status": "notRequired",+ "runtime.backend": "placeholder",+ "reason": "uiUnderstandingBackendNotConfigured",+ },+ )+return error_payload("missingModelWeightDownloadURL",{"cacheDirectory": cache_dir, "modelWeights.status": "notConfigured"},@@ -163,12 +326,13 @@ def prepare_ollama_model(cache_dir: str) -> dict[str, Any]:"modelWeights.ollamaModel": MODEL_ID,},)- return error_payload(- "ollamaPullFailed",+ return prepared(+ cache_dir,{- "cacheDirectory": cache_dir,- "modelWeights.status": "downloadFailed",+ "reason": "ollamaPullFailed",+ "modelWeights.status": "externalUnavailable","modelWeights.provider": "ollama",+ "modelWeights.ollamaModel": MODEL_ID,"stderr": completed.stderr[-400:],},)@@ -184,12 +348,13 @@ def prepare_ollama_model(cache_dir: str) -> dict[str, Any]:},)except Exception as exc: # noqa: BLE001- return error_payload(- "ollamaUnavailable",+ return prepared(+ cache_dir,{- "cacheDirectory": cache_dir,- "modelWeights.status": "notConfigured",+ "reason": "ollamaUnavailable",+ "modelWeights.status": "externalUnavailable","modelWeights.provider": "ollama",+ "modelWeights.ollamaModel": MODEL_ID,"detail": str(exc),},)@@ -307,7 +472,7 @@ def health_check(request: dict[str, Any]) -> dict[str, Any]:return {"status": "ok","runtimeID": RUNTIME_ID,- "runtimeVersion": "0.2.0-runner",+ "runtimeVersion": RUNTIME_VERSION,"modelID": MODEL_ID,"protocolVersion": "v1","metadata": metadata(extra),diff --git a/scripts/package-donkey-app.sh b/scripts/package-donkey-app.shindex 2a37dae4..b3442124 100755--- a/scripts/package-donkey-app.sh+++ b/scripts/package-donkey-app.sh@@ -3,10 +3,18 @@ set -euo pipefailROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"APP_DIR="$ROOT_DIR/dist/Donkey.app"+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}"+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:-}"CONTENTS_DIR="$APP_DIR/Contents"MACOS_DIR="$CONTENTS_DIR/MacOS"RESOURCES_DIR="$CONTENTS_DIR/Resources"+FRAMEWORKS_DIR="$CONTENTS_DIR/Frameworks"BUILD_DIR="$ROOT_DIR/apps/Donkey"EXECUTABLE="$BUILD_DIR/.build/release/Donkey"CACHE_DIR="$BUILD_DIR/.build/package-cache"@@ -22,7 +30,7 @@ echo "Compiling Donkey for Mac ..."swift build -c release --product Donkeyrm -rf "$APP_DIR"-mkdir -p "$MACOS_DIR" "$RESOURCES_DIR"+mkdir -p "$MACOS_DIR" "$RESOURCES_DIR" "$FRAMEWORKS_DIR"cp "$EXECUTABLE" "$MACOS_DIR/Donkey"make_runtime_package() {@@ -33,11 +41,13 @@ make_runtime_package() {local model_url="${5:-}"local model_sha256="${6:-}"local model_filename="${7:-model.bin}"+ local requirements="${8:-}"local package_dir="$RUNTIME_PACKAGE_DIR/$runtime_id"local bin_dir="$package_dir/bin"local lib_dir="$package_dir/lib"local executable_path="$bin_dir/$executable_name"local runner_path="$lib_dir/donkey_runtime_runner.py"+ local requirements_path="$package_dir/requirements.txt"mkdir -p "$bin_dir" "$lib_dir"cp "$RUNTIME_RUNNER_SOURCE" "$runner_path"@@ -46,24 +56,46 @@ make_runtime_package() {#!/usr/bin/env shSCRIPT_DIR="\$(CDPATH= cd -- "\$(dirname -- "\$0")" && pwd)"PYTHON="\${DONKEY_RUNTIME_PYTHON:-python3}"+PACKAGE_DIR="\$(CDPATH= cd -- "\$SCRIPT_DIR/.." && pwd)"export DONKEY_RUNTIME_ID="$runtime_id"+export DONKEY_RUNTIME_VERSION="$RUNTIME_PACKAGE_VERSION"export DONKEY_MODEL_ID="$model_id"export DONKEY_RUNTIME_ROLE="$role"export DONKEY_MODEL_URL="$model_url"export DONKEY_MODEL_SHA256="$model_sha256"export DONKEY_MODEL_FILENAME="$model_filename"+export DONKEY_RUNTIME_PACKAGE_DIR="\$PACKAGE_DIR"+export DONKEY_RUNTIME_STATE_DIR="\${DONKEY_RUNTIME_STATE_DIR:-\$HOME/Library/Application Support/Donkey/LocalModelRuntimes/RuntimePython/$runtime_id}"+if ! command -v "\$PYTHON" >/dev/null 2>&1; then+ printf '{"status":"error","runtimeID":"%s","modelID":"%s","metadata":{"reason":"pythonRuntimeUnavailable","dependency":"python3"}}' "$runtime_id" "$model_id"+ exit 0+fiexec "\$PYTHON" "\$SCRIPT_DIR/../lib/donkey_runtime_runner.py"EOF_RUNTIMEchmod 755 "$executable_path"+ if [ -n "$requirements" ]; then+ printf '%s\n' "$requirements" > "$requirements_path"+ filocal executable_shalocal runner_sha+ local requirements_sha=""+ local requirements_manifest_entry=""executable_sha="$(shasum -a 256 "$executable_path" | awk '{print $1}')"runner_sha="$(shasum -a 256 "$runner_path" | awk '{print $1}')"+ if [ -f "$requirements_path" ]; then+ requirements_sha="$(shasum -a 256 "$requirements_path" | awk '{print $1}')"+ requirements_manifest_entry=",+ {+ \"relativePath\" : \"requirements.txt\",+ \"sha256\" : \"$requirements_sha\",+ \"isExecutable\" : false+ }"+ ficat > "$package_dir/manifest.json" <<EOF_MANIFEST{"runtimeID" : "$runtime_id",- "runtimeVersion" : "0.2.0-runner",+ "runtimeVersion" : "$RUNTIME_PACKAGE_VERSION","modelID" : "$model_id","platform" : "macos","architecture" : "$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x86_64/')",@@ -80,7 +112,7 @@ EOF_RUNTIME"relativePath" : "lib/donkey_runtime_runner.py","sha256" : "$runner_sha","isExecutable" : true- }+ }$requirements_manifest_entry],"signature" : "bundled-runner-package","signingKeyID" : "donkey-runner",@@ -98,8 +130,8 @@ EOF_MANIFESTrm -rf "$RUNTIME_PACKAGE_DIR"mkdir -p "$RUNTIME_PACKAGE_DIR"-make_runtime_package "parakeet-transcriber" "donkey-parakeet-transcriber" "nvidia/parakeet-tdt-0.6b-v3" "voiceTranscription" "${DONKEY_PARAKEET_MODEL_URL:-}" "${DONKEY_PARAKEET_MODEL_SHA256:-}" "${DONKEY_PARAKEET_MODEL_FILENAME:-parakeet-model.bin}"-make_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}"+make_runtime_package "parakeet-transcriber" "donkey-parakeet-transcriber" "nvidia/parakeet-tdt-0.6b-v3" "voiceTranscription" "${DONKEY_PARAKEET_MODEL_URL:-}" "${DONKEY_PARAKEET_MODEL_SHA256:-}" "${DONKEY_PARAKEET_MODEL_FILENAME:-parakeet-model.bin}" $'huggingface_hub>=0.25,<1'+make_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_runtime_package "ui-understander" "donkey-ui-understander" "local-ui-understander" "uiUnderstanding" "${DONKEY_UI_UNDERSTANDER_MODEL_URL:-}" "${DONKEY_UI_UNDERSTANDER_MODEL_SHA256:-}" "${DONKEY_UI_UNDERSTANDER_MODEL_FILENAME:-ui-understander-model.bin}"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"@@ -111,7 +143,27 @@ elif [ -d "$BUILD_DIR/.build/release/Donkey_Donkey.resources" ]; thencp -R "$BUILD_DIR/.build/release/Donkey_Donkey.resources/." "$RESOURCES_DIR/"fi-cat > "$CONTENTS_DIR/Info.plist" <<'PLIST'+SPARKLE_FRAMEWORK="$(find "$BUILD_DIR/.build" -path "*/release/Sparkle.framework" -type d | head -n 1 || true)"+if [ -z "$SPARKLE_FRAMEWORK" ]; then+ SPARKLE_FRAMEWORK="$(find "$BUILD_DIR/.build" -path "*/Sparkle.xcframework/macos-arm64_x86_64/Sparkle.framework" -type d | head -n 1 || true)"+fi+if [ -n "$SPARKLE_FRAMEWORK" ]; then+ cp -R "$SPARKLE_FRAMEWORK" "$FRAMEWORKS_DIR/"+fi++SPARKLE_PLIST_KEYS=""+if [ -n "$SPARKLE_FEED_URL" ] && [ -n "$SPARKLE_PUBLIC_ED_KEY" ]; then+ SPARKLE_PLIST_KEYS=" <key>SUEnableInstallerLauncherService</key>+ <true/>+ <key>SUEnableDownloaderService</key>+ <true/>+ <key>SUFeedURL</key>+ <string>$SPARKLE_FEED_URL</string>+ <key>SUPublicEDKey</key>+ <string>$SPARKLE_PUBLIC_ED_KEY</string>"+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"><plist version="1.0">@@ -127,9 +179,9 @@ cat > "$CONTENTS_DIR/Info.plist" <<'PLIST'<key>CFBundlePackageType</key><string>APPL</string><key>CFBundleShortVersionString</key>- <string>0.1.0</string>+ <string>$APP_VERSION</string><key>CFBundleVersion</key>- <string>1</string>+ <string>$APP_BUILD</string><key>LSMinimumSystemVersion</key><string>14.0</string><key>NSMicrophoneUsageDescription</key>@@ -138,6 +190,7 @@ cat > "$CONTENTS_DIR/Info.plist" <<'PLIST'<string>Donkey captures bounded screenshots so local runtimes can understand app UI.</string><key>NSAppleEventsUsageDescription</key><string>Donkey uses local app automation only for user-requested actions.</string>+$SPARKLE_PLIST_KEYS</dict></plist>PLIST@@ -146,5 +199,20 @@ if command -v codesign >/dev/null 2>&1; thencodesign --force --deep --sign - "$APP_DIR" >/dev/nullfi+rm -rf "$DMG_ROOT" "$DMG_PATH"+mkdir -p "$DMG_ROOT"+cp -R "$APP_DIR" "$DMG_ROOT/Donkey.app"+ln -s /Applications "$DMG_ROOT/Applications"+hdiutil create \+ -volname "Donkey" \+ -srcfolder "$DMG_ROOT" \+ -ov \+ -format UDZO \+ "$DMG_PATH" >/dev/null+rm -rf "$DMG_ROOT"+echo "Packaged $APP_DIR"+echo "Created drag-to-Applications disk image: $DMG_PATH"echo "Open it with: open \"$APP_DIR\""+echo "Test the install flow with: open \"$DMG_PATH\""+echo "For Sparkle updates, package with DONKEY_SPARKLE_FEED_URL and DONKEY_SPARKLE_PUBLIC_ED_KEY."