Skip to content

Open source CapCut alternative.

TypeScript

Expand local app tasks and wire typed prompt execution

David Le389b8d51649c
diff --git a/apps/Donkey/Sources/Donkey/PointerPromptCommandHandler.swift b/apps/Donkey/Sources/Donkey/PointerPromptCommandHandler.swift
new file mode 100644
index 00000000..133abc59
--- /dev/null
+++ b/apps/Donkey/Sources/Donkey/PointerPromptCommandHandler.swift
@@ -0,0 +1,87 @@
+import DonkeyAI
+import DonkeyContracts
+import DonkeyRuntime
+import Foundation
+
+struct PointerPromptCommandHandlingResult: Equatable, Sendable {
+ var status: LocalAppTaskLiveRunStatus
+ var summary: String
+ var traceID: String
+ var metadata: [String: String]
+}
+
+protocol PointerPromptCommandHandling: Sendable {
+ func handleSubmittedCommand(_ command: String) async -> PointerPromptCommandHandlingResult
+}
+
+struct LocalAppPointerPromptCommandHandler: PointerPromptCommandHandling {
+ var catalog: LocalAppTaskCatalog
+ var localModelResolver: LocalModelTaskIntentResolver
+ var liveRunner: LocalAppTaskLiveRunner
+
+ init(
+ catalog: LocalAppTaskCatalog = LocalAppTaskCatalog(taskDefinitions: BuiltInLocalAppTaskDefinitions.defaults),
+ localModelResolver: LocalModelTaskIntentResolver? = nil,
+ liveRunner: LocalAppTaskLiveRunner? = nil
+ ) {
+ self.catalog = catalog
+ self.localModelResolver = localModelResolver ?? LocalModelTaskIntentResolver(catalog: catalog)
+ self.liveRunner = liveRunner ?? LocalAppTaskLiveRunner(catalog: catalog)
+ }
+
+ func handleSubmittedCommand(_ command: String) async -> PointerPromptCommandHandlingResult {
+ let traceID = "pointer-prompt-\(UUID().uuidString)"
+ let localModelResult = await localModelResolver.resolve(
+ command: command,
+ sourceTraceID: traceID
+ )
+ let localModelResolution = localModelResult.resolution
+ let deterministicResolution = catalog.resolve(command: command)
+ let shouldUseDeterministicFallback = localModelResolution.status == .unsupportedCommand
+ && localModelResolution.metadata["reason"] == "localModelIntentUnavailable"
+ && deterministicResolution.status != .unsupportedCommand
+ let resolution = shouldUseDeterministicFallback
+ ? deterministicResolution
+ : localModelResolution
+ let parserSource = shouldUseDeterministicFallback ? "deterministicFallback" : "localModel"
+
+ let result = await liveRunner.run(
+ command: command,
+ traceID: traceID,
+ resolution: resolution,
+ metadata: [
+ "intentParser": parserSource,
+ "modelCallID": localModelResult.trace.id,
+ "modelCallStatus": localModelResult.trace.status.rawValue,
+ "modelValidationStatus": localModelResult.trace.validationStatus
+ ]
+ )
+
+ return PointerPromptCommandHandlingResult(
+ status: result.status,
+ summary: summary(for: result),
+ traceID: traceID,
+ metadata: result.metadata
+ )
+ }
+
+ private func summary(for result: LocalAppTaskLiveRunResult) -> String {
+ switch result.status {
+ case .completed:
+ return "Done"
+ case .needsUserReview:
+ return "Needs review"
+ case .needsConfirmation:
+ if let reason = result.resolution.metadata["reason"] {
+ return "Need \(reason)"
+ }
+ return "Need more detail"
+ case .appUnavailable:
+ return "App unavailable"
+ case .unsupportedCommand:
+ return "Unsupported command"
+ case .failedSafe:
+ return "Stopped safely"
+ }
+ }
+}
diff --git a/apps/Donkey/Sources/Donkey/PointerPromptOverlayModel.swift b/apps/Donkey/Sources/Donkey/PointerPromptOverlayModel.swift
index 03076076..4cad0076 100644
--- a/apps/Donkey/Sources/Donkey/PointerPromptOverlayModel.swift
+++ b/apps/Donkey/Sources/Donkey/PointerPromptOverlayModel.swift
@@ -11,10 +11,14 @@ final class PointerPromptOverlayModel: ObservableObject, PointerPromptIntentSink
@Published var inputTextHeight = PointerPromptLayout.composerInputTextMinimumHeight
@Published var isInputExpanded = false
+ private let commandHandler: any PointerPromptCommandHandling
+
init(
aiProvider: any AIHarnessSnapshotProviding = AIHarnessBoundary(),
+ commandHandler: any PointerPromptCommandHandling = LocalAppPointerPromptCommandHandler(),
theme: PointerPromptTheme = PointerPromptOverlayModel.bundledTheme()
) {
+ self.commandHandler = commandHandler
let aiSnapshot = aiProvider.snapshot()
promptState = PointerPromptState(
promptText: aiSnapshot.suggestedPromptText,
@@ -54,6 +58,15 @@ final class PointerPromptOverlayModel: ObservableObject, PointerPromptIntentSink
inputTextHeight = PointerPromptLayout.composerInputTextMinimumHeight
isInputExpanded = false
promptState.leadingSignalLevel = .thinking
+ promptState.promptText = "Working..."
+ Task { [weak self, commandHandler] in
+ let result = await commandHandler.handleSubmittedCommand(trimmedText)
+ await MainActor.run {
+ guard let self else { return }
+ self.promptState.leadingSignalLevel = result.status == .completed ? .ready : .idle
+ self.promptState.promptText = result.summary
+ }
+ }
case .inputTextHeightChanged(let height):
let clampedHeight = PointerPromptLayout.clampedComposerInputTextHeight(height)
guard abs(inputTextHeight - clampedHeight) > 0.5 else { return }
diff --git a/apps/Donkey/Sources/DonkeyRuntime/LocalAppTaskAdapter.swift b/apps/Donkey/Sources/DonkeyRuntime/LocalAppTaskAdapter.swift
index 75d596aa..9fff27e3 100644
--- a/apps/Donkey/Sources/DonkeyRuntime/LocalAppTaskAdapter.swift
+++ b/apps/Donkey/Sources/DonkeyRuntime/LocalAppTaskAdapter.swift
@@ -60,7 +60,8 @@ public struct LocalAppTaskAdapter: Sendable {
targetApp: definition.targetApp,
steps: steps,
terminalState: verification.terminalState,
- canAttemptGuardedLive: verification.terminalState != .failedSafe,
+ canAttemptGuardedLive: definition.metadata["guardedLiveDefault"] != "reviewOnly"
+ && verification.terminalState != .failedSafe,
verificationConfidence: verification.confidence,
metadata: planMetadata
)
@@ -132,7 +133,7 @@ public struct LocalAppTaskAdapter: Sendable {
return Self.normalizedText(visibleText).contains(Self.normalizedText(expected))
}
- private var targetID: String {
+ public var targetID: String {
"local-app-task-\(slug(definition.taskType))"
}
@@ -143,7 +144,8 @@ public struct LocalAppTaskAdapter: Sendable {
"appName": definition.targetApp.appName,
"bundleIdentifier": definition.targetApp.bundleIdentifier ?? "",
"guardedLiveRequiresInputPolicy": "true",
- "defaultOSInputBackendAvailable": "false"
+ "defaultOSInputBackendAvailable": "true",
+ "defaultOSInputBackend": "mac-keyboard"
].merging(definition.metadata) { current, _ in current }
}
diff --git a/apps/Donkey/Sources/DonkeyRuntime/LocalAppTaskCatalog.swift b/apps/Donkey/Sources/DonkeyRuntime/LocalAppTaskCatalog.swift
index 101a6b8b..cc8f186e 100644
--- a/apps/Donkey/Sources/DonkeyRuntime/LocalAppTaskCatalog.swift
+++ b/apps/Donkey/Sources/DonkeyRuntime/LocalAppTaskCatalog.swift
@@ -178,6 +178,27 @@ public struct LocalAppTaskCatalog: Sendable {
}
public enum BuiltInLocalAppTaskDefinitions {
+ private static var commonWorkflowPrefix: [LocalAppTaskWorkflowStepDefinition] {
+ [
+ LocalAppTaskWorkflowStepDefinition(
+ id: "parse-intent",
+ role: .parseIntent,
+ summary: "Parse the local app task intent"
+ ),
+ LocalAppTaskWorkflowStepDefinition(
+ id: "launch-or-focus",
+ role: .launchOrFocusApp,
+ summary: "Launch or focus the target app"
+ ),
+ LocalAppTaskWorkflowStepDefinition(
+ id: "observe-app",
+ role: .observeApp,
+ summary: "Observe the target app state",
+ metadata: ["strategyOrder": "accessibility,windowMetadata,screenshotForLocalModel"]
+ )
+ ]
+ }
+
public static var weatherLookup: LocalAppTaskDefinition {
LocalAppTaskDefinition(
taskType: "weather_lookup",
@@ -202,23 +223,7 @@ public enum BuiltInLocalAppTaskDefinitions {
]
)
],
- workflowSteps: [
- LocalAppTaskWorkflowStepDefinition(
- id: "parse-intent",
- role: .parseIntent,
- summary: "Parse the local app task intent"
- ),
- LocalAppTaskWorkflowStepDefinition(
- id: "launch-or-focus",
- role: .launchOrFocusApp,
- summary: "Launch or focus the target app"
- ),
- LocalAppTaskWorkflowStepDefinition(
- id: "observe-app",
- role: .observeApp,
- summary: "Observe the target app state",
- metadata: ["strategyOrder": "accessibility,windowMetadata,screenshotForLocalModel"]
- ),
+ workflowSteps: commonWorkflowPrefix + [
LocalAppTaskWorkflowStepDefinition(
id: "focus-search",
role: .focusControl,
@@ -257,7 +262,141 @@ public enum BuiltInLocalAppTaskDefinitions {
)
}
+ public static var mediaPlayback: LocalAppTaskDefinition {
+ LocalAppTaskDefinition(
+ taskType: "media_playback",
+ targetApp: LocalAppTarget(
+ appName: "Music",
+ bundleIdentifier: "com.apple.Music",
+ titleContains: "Music"
+ ),
+ triggerTerms: ["play", "listen to", "put on"],
+ entityRules: [
+ LocalAppTaskEntityRule(
+ name: "query",
+ markers: ["play", "listen to", "put on"],
+ aliases: [
+ "cold play": "Coldplay",
+ "coldplay": "Coldplay"
+ ],
+ metadata: ["capture": "afterTrigger"]
+ )
+ ],
+ workflowSteps: commonWorkflowPrefix + [
+ LocalAppTaskWorkflowStepDefinition(
+ id: "focus-search",
+ role: .focusControl,
+ summary: "Focus the app search control",
+ metadata: [
+ "controlID": "search",
+ "key": "Command+F"
+ ]
+ ),
+ LocalAppTaskWorkflowStepDefinition(
+ id: "enter-media-query",
+ role: .enterText,
+ summary: "Enter the requested media query",
+ metadata: ["entityName": "query"]
+ ),
+ LocalAppTaskWorkflowStepDefinition(
+ id: "submit-media-search",
+ role: .submit,
+ summary: "Submit the media search or playback command",
+ metadata: ["key": "Return"]
+ ),
+ LocalAppTaskWorkflowStepDefinition(
+ id: "verify-media-query",
+ role: .verifyResult,
+ summary: "Verify the requested media is visible or selected"
+ )
+ ],
+ observationStrategies: [.accessibility, .windowMetadata, .screenshotForLocalModel],
+ verificationEntityName: "query",
+ metadata: [
+ "catalogEntry": "built-in-media-playback",
+ "verificationTextKey": "query",
+ "domain": "media",
+ "visualFallback": "localModel",
+ "ocrFallbackDefault": "false"
+ ]
+ )
+ }
+
+ public static var documentFormFill: LocalAppTaskDefinition {
+ LocalAppTaskDefinition(
+ taskType: "document_form_fill",
+ targetApp: LocalAppTarget(
+ appName: "Preview",
+ bundleIdentifier: "com.apple.Preview",
+ titleContains: nil
+ ),
+ triggerTerms: ["fill pdf", "fill out pdf", "complete pdf", "fill form", "fill out this pdf"],
+ entityRules: [
+ LocalAppTaskEntityRule(
+ name: "document",
+ markers: ["fill", "complete"],
+ aliases: [
+ "this pdf": "current PDF",
+ "the pdf": "current PDF",
+ "this form": "current form"
+ ],
+ metadata: ["contextRole": "documentTarget"]
+ ),
+ LocalAppTaskEntityRule(
+ name: "dataSource",
+ markers: ["using", "with", "from"],
+ aliases: [
+ "this data": "provided data",
+ "the data": "provided data",
+ "these details": "provided data"
+ ],
+ metadata: ["contextRole": "structuredInputData"]
+ )
+ ],
+ workflowSteps: commonWorkflowPrefix + [
+ LocalAppTaskWorkflowStepDefinition(
+ id: "observe-form-fields",
+ role: .custom,
+ summary: "Discover fillable fields from Accessibility or bounded local UI understanding",
+ metadata: [
+ "requiresStructuredDataMapping": "true",
+ "preferredObservation": "accessibility,localModel"
+ ]
+ ),
+ LocalAppTaskWorkflowStepDefinition(
+ id: "map-data-to-fields",
+ role: .custom,
+ summary: "Map provided data to detected document fields",
+ metadata: [
+ "requiresUserData": "true",
+ "outputMustBeReviewed": "true"
+ ]
+ ),
+ LocalAppTaskWorkflowStepDefinition(
+ id: "verify-filled-document",
+ role: .verifyResult,
+ summary: "Verify all required fields have a proposed value"
+ )
+ ],
+ observationStrategies: [.accessibility, .screenshotForLocalModel],
+ verificationEntityName: "document",
+ metadata: [
+ "catalogEntry": "built-in-document-form-fill",
+ "domain": "document",
+ "requiresDocumentContext": "true",
+ "requiresStructuredData": "true",
+ "guardedLiveDefault": "reviewOnly",
+ "visualFallback": "localModel",
+ "ocrFallbackDefault": "false"
+ ]
+ )
+ }
+
public static var defaults: [LocalAppTaskDefinition] {
- [weatherLookup]
+ [
+ weatherLookup,
+ mediaPlayback,
+ documentFormFill
+ ]
}
}
diff --git a/apps/Donkey/Sources/DonkeyRuntime/LocalAppTaskIntentParser.swift b/apps/Donkey/Sources/DonkeyRuntime/LocalAppTaskIntentParser.swift
index a5ae16ec..3169e5dd 100644
--- a/apps/Donkey/Sources/DonkeyRuntime/LocalAppTaskIntentParser.swift
+++ b/apps/Donkey/Sources/DonkeyRuntime/LocalAppTaskIntentParser.swift
@@ -73,7 +73,11 @@ public struct LocalAppTaskIntentParser: Sendable {
var usedAlias = false
for rule in definition.entityRules {
- guard let candidate = entityCandidate(from: command, rule: rule) else { continue }
+ guard let candidate = entityCandidate(
+ from: command,
+ rule: rule,
+ definition: definition
+ ) else { continue }
raw[rule.name] = candidate.raw
normalized[rule.name] = candidate.normalized
usedAlias = usedAlias || candidate.usedAlias
@@ -84,7 +88,8 @@ public struct LocalAppTaskIntentParser: Sendable {
private func entityCandidate(
from command: String,
- rule: LocalAppTaskEntityRule
+ rule: LocalAppTaskEntityRule,
+ definition: LocalAppTaskDefinition
) -> (raw: String, normalized: String, usedAlias: Bool)? {
let aliases = rule.aliases.reduce(into: [:]) { result, item in
result[Self.normalizedPhrase(item.key)] = item.value
@@ -107,6 +112,32 @@ public struct LocalAppTaskIntentParser: Sendable {
}
}
+ if rule.metadata["capture"] == "afterTrigger",
+ let candidate = captureAfterTrigger(from: command, definition: definition) {
+ let normalized = aliases[Self.normalizedPhrase(candidate)] ?? titleCased(candidate)
+ return (candidate, normalized, normalized != titleCased(candidate))
+ }
+
+ return nil
+ }
+
+ private func captureAfterTrigger(from command: String, definition: LocalAppTaskDefinition) -> String? {
+ let normalizedCommand = Self.normalizedPhrase(command)
+ let triggers = definition.triggerTerms
+ .map(Self.normalizedPhrase)
+ .sorted { $0.count > $1.count }
+
+ for trigger in triggers {
+ guard normalizedCommand == trigger || normalizedCommand.hasPrefix("\(trigger) ") else {
+ continue
+ }
+
+ let candidate = String(normalizedCommand.dropFirst(trigger.count))
+ .trimmingCharacters(in: .whitespacesAndNewlines)
+ guard !candidate.isEmpty else { continue }
+ return cleanEntityCandidate(candidate)
+ }
+
return nil
}
diff --git a/apps/Donkey/Sources/DonkeyRuntime/LocalAppTaskLiveRunner.swift b/apps/Donkey/Sources/DonkeyRuntime/LocalAppTaskLiveRunner.swift
new file mode 100644
index 00000000..7393a9b6
--- /dev/null
+++ b/apps/Donkey/Sources/DonkeyRuntime/LocalAppTaskLiveRunner.swift
@@ -0,0 +1,470 @@
+@preconcurrency import ApplicationServices
+import AppKit
+import DonkeyContracts
+import Foundation
+
+public enum LocalAppTaskLiveRunStatus: String, Equatable, Sendable {
+ case completed
+ case needsUserReview
+ case unsupportedCommand
+ case needsConfirmation
+ case appUnavailable
+ case failedSafe
+}
+
+public struct LocalAppTaskLiveRunResult: Equatable, Sendable {
+ public var command: String
+ public var traceID: String
+ public var status: LocalAppTaskLiveRunStatus
+ public var resolution: LocalAppTaskCatalogResolution
+ public var initialPlan: LocalAppTaskDryRunPlan?
+ public var finalPlan: LocalAppTaskDryRunPlan?
+ public var observation: LocalAppTaskObservation?
+ public var actionTraces: [ActionEngineCommandTrace]
+ public var metadata: [String: String]
+
+ public init(
+ command: String,
+ traceID: String,
+ status: LocalAppTaskLiveRunStatus,
+ resolution: LocalAppTaskCatalogResolution,
+ initialPlan: LocalAppTaskDryRunPlan? = nil,
+ finalPlan: LocalAppTaskDryRunPlan? = nil,
+ observation: LocalAppTaskObservation? = nil,
+ actionTraces: [ActionEngineCommandTrace] = [],
+ metadata: [String: String] = [:]
+ ) {
+ self.command = command
+ self.traceID = traceID
+ self.status = status
+ self.resolution = resolution
+ self.initialPlan = initialPlan
+ self.finalPlan = finalPlan
+ self.observation = observation
+ self.actionTraces = actionTraces
+ self.metadata = metadata
+ }
+}
+
+public protocol LocalAppTaskAppControlling: Sendable {
+ @MainActor
+ func launchOrFocus(
+ definition: LocalAppTaskDefinition,
+ availability: LocalAppAvailability
+ ) async -> LocalAppTaskObservation
+
+ @MainActor
+ func observe(definition: LocalAppTaskDefinition) async -> LocalAppTaskObservation
+}
+
+public struct LocalAppTaskLiveRunner: Sendable {
+ public typealias ActionEngineFactory = @Sendable (LocalAppTaskDefinition) -> ActionEngineGuardrail
+
+ public var catalog: LocalAppTaskCatalog
+ public var appController: any LocalAppTaskAppControlling
+ public var actionEngineFactory: ActionEngineFactory
+ public var permissionPolicy: ToolCallPolicy
+
+ public init(
+ catalog: LocalAppTaskCatalog = LocalAppTaskCatalog(taskDefinitions: BuiltInLocalAppTaskDefinitions.defaults),
+ appController: any LocalAppTaskAppControlling = MacLocalAppTaskController(),
+ actionEngineFactory: @escaping ActionEngineFactory = Self.defaultActionEngine(for:),
+ permissionPolicy: ToolCallPolicy = ToolCallPolicy(deniedCapabilities: [])
+ ) {
+ self.catalog = catalog
+ self.appController = appController
+ self.actionEngineFactory = actionEngineFactory
+ self.permissionPolicy = permissionPolicy
+ }
+
+ public func run(
+ command: String,
+ traceID: String = "local-app-task-\(UUID().uuidString)"
+ ) async -> LocalAppTaskLiveRunResult {
+ await run(
+ command: command,
+ traceID: traceID,
+ resolution: catalog.resolve(command: command),
+ metadata: ["intentParser": "deterministic"]
+ )
+ }
+
+ public func run(
+ command: String,
+ traceID: String,
+ resolution: LocalAppTaskCatalogResolution,
+ metadata: [String: String] = [:]
+ ) async -> LocalAppTaskLiveRunResult {
+ guard resolution.status == .resolved else {
+ return unresolvedResult(
+ command: command,
+ traceID: traceID,
+ resolution: resolution,
+ metadata: metadata
+ )
+ }
+
+ guard let definition = resolution.definition,
+ var intent = resolution.intent,
+ let availability = resolution.availability
+ else {
+ return LocalAppTaskLiveRunResult(
+ command: command,
+ traceID: traceID,
+ status: .failedSafe,
+ resolution: resolution,
+ metadata: metadata.merging(["reason": "incompleteResolution"]) { current, _ in current }
+ )
+ }
+
+ intent.metadata["traceID"] = traceID
+ let adapter = catalog.adapter(for: definition)
+ let launchObservation = await appController.launchOrFocus(
+ definition: definition,
+ availability: availability
+ )
+ let initialPlan = adapter.dryRunPlan(for: intent, observation: launchObservation)
+ guard initialPlan.canAttemptGuardedLive else {
+ return LocalAppTaskLiveRunResult(
+ command: command,
+ traceID: traceID,
+ status: status(for: initialPlan.terminalState),
+ resolution: resolution,
+ initialPlan: initialPlan,
+ observation: launchObservation,
+ metadata: metadata.merging(["reason": "dryRunPlanBlocked"]) { current, _ in current }
+ )
+ }
+
+ let engine = actionEngineFactory(definition)
+ var actionTraces: [ActionEngineCommandTrace] = []
+ let commands = adapter.guardedKeyboardCommandTemplates(
+ for: intent,
+ issuedAt: Self.now()
+ )
+
+ for (index, actionCommand) in commands.enumerated() {
+ let spacedCommand = actionCommand.withIssuedAt(Self.now(advancedByMilliseconds: Double(index) * 40))
+ let trace = await engine.handle(
+ spacedCommand,
+ permissionPolicy: permissionPolicy
+ )
+ actionTraces.append(trace)
+
+ guard trace.executed || trace.decision == .projectedDryRun else {
+ let finalObservation = await appController.observe(definition: definition)
+ let finalPlan = adapter.dryRunPlan(for: intent, observation: finalObservation)
+ return LocalAppTaskLiveRunResult(
+ command: command,
+ traceID: traceID,
+ status: .failedSafe,
+ resolution: resolution,
+ initialPlan: initialPlan,
+ finalPlan: finalPlan,
+ observation: finalObservation,
+ actionTraces: actionTraces,
+ metadata: metadata.merging(["reason": "actionDenied"]) { current, _ in current }
+ )
+ }
+ }
+
+ try? await Task.sleep(nanoseconds: 700_000_000)
+ let finalObservation = await appController.observe(definition: definition)
+ let finalPlan = adapter.dryRunPlan(for: intent, observation: finalObservation)
+ return LocalAppTaskLiveRunResult(
+ command: command,
+ traceID: traceID,
+ status: status(for: finalPlan.terminalState),
+ resolution: resolution,
+ initialPlan: initialPlan,
+ finalPlan: finalPlan,
+ observation: finalObservation,
+ actionTraces: actionTraces,
+ metadata: metadata.merging([
+ "executedCommandCount": String(actionTraces.filter(\.executed).count),
+ "projectedCommandCount": String(actionTraces.filter { $0.decision == .projectedDryRun }.count)
+ ]) { current, _ in current }
+ )
+ }
+
+ public static func defaultActionEngine(for definition: LocalAppTaskDefinition) -> ActionEngineGuardrail {
+ ActionEngineGuardrail(
+ configuration: ActionEngineConfiguration(liveInputEnabled: true),
+ focusGuard: MacLocalAppFocusGuard(
+ targetID: LocalAppTaskAdapter(definition: definition).targetID,
+ bundleIdentifier: definition.targetApp.bundleIdentifier
+ ),
+ inputBackend: MacKeyboardActionEngineInputBackend()
+ )
+ }
+
+ private func unresolvedResult(
+ command: String,
+ traceID: String,
+ resolution: LocalAppTaskCatalogResolution,
+ metadata: [String: String]
+ ) -> LocalAppTaskLiveRunResult {
+ let status: LocalAppTaskLiveRunStatus
+ switch resolution.status {
+ case .resolved:
+ status = .failedSafe
+ case .needsConfirmation:
+ status = .needsConfirmation
+ case .unsupportedCommand:
+ status = .unsupportedCommand
+ case .appUnavailable:
+ status = .appUnavailable
+ }
+
+ return LocalAppTaskLiveRunResult(
+ command: command,
+ traceID: traceID,
+ status: status,
+ resolution: resolution,
+ metadata: metadata
+ )
+ }
+
+ private func status(for terminalState: LocalAppTaskTerminalState) -> LocalAppTaskLiveRunStatus {
+ switch terminalState {
+ case .completed:
+ return .completed
+ case .needsUserReview:
+ return .needsUserReview
+ case .failedSafe, .timedOut:
+ return .failedSafe
+ }
+ }
+
+ private static func now(advancedByMilliseconds milliseconds: Double = 0) -> RunTraceTimestamp {
+ let now = ProcessInfo.processInfo.systemUptime
+ return RunTraceTimestamp(
+ wallClock: Date().addingTimeInterval(milliseconds / 1_000),
+ monotonicUptimeNanoseconds: UInt64((now * 1_000_000_000) + (milliseconds * 1_000_000))
+ )
+ }
+}
+
+public struct MacLocalAppFocusGuard: ActionEngineFocusGuard {
+ public var targetID: String
+ public var bundleIdentifier: String?
+
+ public init(targetID: String, bundleIdentifier: String?) {
+ self.targetID = targetID
+ self.bundleIdentifier = bundleIdentifier
+ }
+
+ public func targetIsSafeForInput(targetID: String) async -> Bool {
+ guard targetID == self.targetID,
+ let bundleIdentifier
+ else {
+ return false
+ }
+
+ return await MainActor.run {
+ NSWorkspace.shared.frontmostApplication?.bundleIdentifier == bundleIdentifier
+ }
+ }
+}
+
+public struct MacLocalAppTaskController: LocalAppTaskAppControlling {
+ public init() {}
+
+ @MainActor
+ public func launchOrFocus(
+ definition: LocalAppTaskDefinition,
+ availability: LocalAppAvailability
+ ) async -> LocalAppTaskObservation {
+ if let runningApplication = runningApplication(for: definition.targetApp) {
+ runningApplication.activate(options: [.activateAllWindows])
+ } else if let appURL = availability.appURL {
+ await openApplication(at: appURL)
+ }
+
+ try? await Task.sleep(nanoseconds: 350_000_000)
+ return await observe(definition: definition)
+ }
+
+ @MainActor
+ public func observe(definition: LocalAppTaskDefinition) async -> LocalAppTaskObservation {
+ let runningApplication = runningApplication(for: definition.targetApp)
+ let isFocused = NSWorkspace.shared.frontmostApplication?.bundleIdentifier == definition.targetApp.bundleIdentifier
+ let visibleText = accessibilityVisibleText(for: runningApplication)
+ let verificationKey = definition.metadata["verificationTextKey"]
+ ?? definition.verificationEntityName
+ ?? "visibleText"
+ let controls: [String: Bool] = Dictionary(
+ uniqueKeysWithValues: definition.workflowSteps.compactMap { step in
+ guard step.role == .focusControl,
+ let controlID = step.metadata["controlID"]
+ else {
+ return nil
+ }
+ return (controlID, step.metadata["key"] != nil || visibleText != nil)
+ }
+ )
+
+ var textValues: [String: String] = [:]
+ if let visibleText {
+ textValues["visibleText"] = visibleText
+ textValues[verificationKey] = visibleText
+ }
+
+ return LocalAppTaskObservation(
+ appIsRunning: runningApplication != nil,
+ appIsFocused: isFocused,
+ availableControls: controls,
+ visibleText: textValues,
+ confidence: visibleText == nil ? 0.4 : 0.75,
+ metadata: [
+ "observer": "mac-local-app-controller",
+ "accessibilityTrusted": String(AXIsProcessTrusted())
+ ]
+ )
+ }
+
+ @MainActor
+ private func runningApplication(for target: LocalAppTarget) -> NSRunningApplication? {
+ guard let bundleIdentifier = target.bundleIdentifier else { return nil }
+ return NSRunningApplication
+ .runningApplications(withBundleIdentifier: bundleIdentifier)
+ .first
+ }
+
+ @MainActor
+ private func openApplication(at url: URL) async {
+ await withCheckedContinuation { continuation in
+ let configuration = NSWorkspace.OpenConfiguration()
+ configuration.activates = true
+ NSWorkspace.shared.openApplication(
+ at: url,
+ configuration: configuration
+ ) { _, _ in
+ continuation.resume()
+ }
+ }
+ }
+
+ @MainActor
+ private func accessibilityVisibleText(for application: NSRunningApplication?) -> String? {
+ guard AXIsProcessTrusted(),
+ let processIdentifier = application?.processIdentifier
+ else {
+ return nil
+ }
+
+ let appElement = AXUIElementCreateApplication(processIdentifier)
+ let elements = windows(from: appElement)
+ let roots = elements.isEmpty ? [appElement] : elements
+ let values = roots.flatMap { textValues(from: $0, depth: 0, remaining: 160) }
+ let joined = values
+ .map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
+ .filter { !$0.isEmpty }
+ .joined(separator: " ")
+ return joined.isEmpty ? nil : joined
+ }
+
+ @MainActor
+ private func windows(from appElement: AXUIElement) -> [AXUIElement] {
+ var value: CFTypeRef?
+ guard AXUIElementCopyAttributeValue(
+ appElement,
+ kAXWindowsAttribute as CFString,
+ &value
+ ) == .success else {
+ return []
+ }
+
+ return value as? [AXUIElement] ?? []
+ }
+
+ @MainActor
+ private func textValues(
+ from element: AXUIElement,
+ depth: Int,
+ remaining: Int
+ ) -> [String] {
+ guard depth <= 8, remaining > 0 else { return [] }
+
+ var values: [String] = []
+ for attribute in [
+ kAXTitleAttribute,
+ kAXDescriptionAttribute,
+ kAXValueAttribute,
+ kAXHelpAttribute
+ ] {
+ if let text = stringAttribute(attribute as CFString, from: element) {
+ values.append(text)
+ }
+ }
+
+ let children = children(from: element)
+ let nextRemaining = max(0, remaining - values.count)
+ for child in children.prefix(nextRemaining) {
+ values.append(contentsOf: textValues(
+ from: child,
+ depth: depth + 1,
+ remaining: max(0, nextRemaining - values.count)
+ ))
+ if values.count >= remaining {
+ break
+ }
+ }
+
+ return values
+ }
+
+ @MainActor
+ private func children(from element: AXUIElement) -> [AXUIElement] {
+ var value: CFTypeRef?
+ guard AXUIElementCopyAttributeValue(
+ element,
+ kAXChildrenAttribute as CFString,
+ &value
+ ) == .success else {
+ return []
+ }
+
+ return value as? [AXUIElement] ?? []
+ }
+
+ @MainActor
+ private func stringAttribute(_ attribute: CFString, from element: AXUIElement) -> String? {
+ var value: CFTypeRef?
+ guard AXUIElementCopyAttributeValue(element, attribute, &value) == .success,
+ let value
+ else {
+ return nil
+ }
+
+ if let string = value as? String {
+ return string
+ }
+ if let number = value as? NSNumber {
+ return number.stringValue
+ }
+ return nil
+ }
+}
+
+private extension ActionEngineCommand {
+ var commandName: String {
+ metadata["taskType"] ?? id
+ }
+
+ func withIssuedAt(_ issuedAt: RunTraceTimestamp) -> ActionEngineCommand {
+ ActionEngineCommand(
+ id: id,
+ traceID: traceID,
+ targetID: targetID,
+ stateID: stateID,
+ actionID: actionID,
+ kind: kind,
+ issuedAt: issuedAt,
+ targetBounds: targetBounds,
+ key: key,
+ holdDurationMS: holdDurationMS,
+ metadata: metadata
+ )
+ }
+}
diff --git a/apps/Donkey/Sources/DonkeyRuntime/MacKeyboardActionEngineInputBackend.swift b/apps/Donkey/Sources/DonkeyRuntime/MacKeyboardActionEngineInputBackend.swift
new file mode 100644
index 00000000..540d7c51
--- /dev/null
+++ b/apps/Donkey/Sources/DonkeyRuntime/MacKeyboardActionEngineInputBackend.swift
@@ -0,0 +1,192 @@
+import AppKit
+import CoreGraphics
+import DonkeyContracts
+import Foundation
+
+public struct MacKeyboardActionEngineInputBackend: ActionEngineInputBackend {
+ public init() {}
+
+ public func execute(_ command: ActionEngineCommand) async -> ActionEngineInputBackendResult {
+ guard command.kind == .key, let key = command.key else {
+ return result(
+ command: command,
+ executed: false,
+ metadata: ["liveInputBackend": "mac-keyboard", "reason": "unsupportedCommandKind"]
+ )
+ }
+
+ let executed: Bool
+ let inputMode: String
+ if command.metadata["inputRole"] == "textEntry" {
+ executed = postText(key)
+ inputMode = "unicodeText"
+ } else {
+ executed = postKeyCommand(key)
+ inputMode = "keyCommand"
+ }
+
+ if executed {
+ try? await Task.sleep(nanoseconds: 80_000_000)
+ }
+
+ return result(
+ command: command,
+ executed: executed,
+ metadata: [
+ "liveInputBackend": "mac-keyboard",
+ "inputMode": inputMode,
+ "key": key
+ ]
+ )
+ }
+
+ private func result(
+ command: ActionEngineCommand,
+ executed: Bool,
+ metadata: [String: String]
+ ) -> ActionEngineInputBackendResult {
+ ActionEngineInputBackendResult(
+ executed: executed,
+ completedAt: Self.now(),
+ metadata: metadata
+ )
+ }
+
+ private func postText(_ text: String) -> Bool {
+ guard !text.isEmpty,
+ let source = CGEventSource(stateID: .hidSystemState),
+ let event = CGEvent(keyboardEventSource: source, virtualKey: 0, keyDown: true)
+ else {
+ return false
+ }
+
+ let utf16 = Array(text.utf16)
+ utf16.withUnsafeBufferPointer { buffer in
+ event.keyboardSetUnicodeString(
+ stringLength: utf16.count,
+ unicodeString: buffer.baseAddress
+ )
+ }
+ event.post(tap: .cghidEventTap)
+ return true
+ }
+
+ private func postKeyCommand(_ command: String) -> Bool {
+ let parts = command
+ .split(separator: "+")
+ .map { String($0).trimmingCharacters(in: .whitespacesAndNewlines) }
+ .filter { !$0.isEmpty }
+ guard let keyName = parts.last,
+ let keyCode = Self.keyCode(for: keyName),
+ let source = CGEventSource(stateID: .hidSystemState)
+ else {
+ return false
+ }
+
+ let flags = Self.flags(for: Array(parts.dropLast()))
+ guard let keyDown = CGEvent(keyboardEventSource: source, virtualKey: keyCode, keyDown: true),
+ let keyUp = CGEvent(keyboardEventSource: source, virtualKey: keyCode, keyDown: false)
+ else {
+ return false
+ }
+
+ keyDown.flags = flags
+ keyUp.flags = flags
+ keyDown.post(tap: .cghidEventTap)
+ keyUp.post(tap: .cghidEventTap)
+ return true
+ }
+
+ private static func flags(for modifiers: [String]) -> CGEventFlags {
+ var flags: CGEventFlags = []
+ for modifier in modifiers.map({ $0.lowercased() }) {
+ switch modifier {
+ case "command", "cmd", "⌘":
+ flags.insert(.maskCommand)
+ case "shift", "⇧":
+ flags.insert(.maskShift)
+ case "option", "alt", "⌥":
+ flags.insert(.maskAlternate)
+ case "control", "ctrl", "⌃":
+ flags.insert(.maskControl)
+ default:
+ continue
+ }
+ }
+ return flags
+ }
+
+ private static func keyCode(for keyName: String) -> CGKeyCode? {
+ switch keyName.lowercased() {
+ case "return", "enter":
+ return 36
+ case "tab":
+ return 48
+ case "escape", "esc":
+ return 53
+ case "space":
+ return 49
+ case "a":
+ return 0
+ case "b":
+ return 11
+ case "c":
+ return 8
+ case "d":
+ return 2
+ case "e":
+ return 14
+ case "f":
+ return 3
+ case "g":
+ return 5
+ case "h":
+ return 4
+ case "i":
+ return 34
+ case "j":
+ return 38
+ case "k":
+ return 40
+ case "l":
+ return 37
+ case "m":
+ return 46
+ case "n":
+ return 45
+ case "o":
+ return 31
+ case "p":
+ return 35
+ case "q":
+ return 12
+ case "r":
+ return 15
+ case "s":
+ return 1
+ case "t":
+ return 17
+ case "u":
+ return 32
+ case "v":
+ return 9
+ case "w":
+ return 13
+ case "x":
+ return 7
+ case "y":
+ return 16
+ case "z":
+ return 6
+ default:
+ return nil
+ }
+ }
+
+ private static func now() -> RunTraceTimestamp {
+ RunTraceTimestamp(
+ wallClock: Date(),
+ monotonicUptimeNanoseconds: UInt64(ProcessInfo.processInfo.systemUptime * 1_000_000_000)
+ )
+ }
+}
diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/LocalAppTaskTests.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/LocalAppTaskTests.swift
index 55d79e47..2136b9a7 100644
--- a/apps/Donkey/Tests/DonkeyRuntimeTests/LocalAppTaskTests.swift
+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/LocalAppTaskTests.swift
@@ -21,6 +21,35 @@ struct LocalAppTaskTests {
#expect(intent.metadata["entityAliasExpanded"] == "true")
}
+ @Test
+ func deterministicParserBuildsMediaPlaybackIntentWithoutWeatherSpecificCode() throws {
+ let intent = try #require(parser().parse("play cold play"))
+
+ #expect(intent.taskType == "media_playback")
+ #expect(intent.targetApp.appName == "Music")
+ #expect(intent.targetApp.bundleIdentifier == "com.apple.Music")
+ #expect(intent.entities["query"] == "cold play")
+ #expect(intent.normalizedEntities["query"] == "Coldplay")
+ #expect(intent.metadata["catalogEntry"] == "built-in-media-playback")
+ }
+
+ @Test
+ func deterministicParserBuildsDocumentFormFillIntentAsReviewOnlyTask() throws {
+ let intent = try #require(parser().parse("fill out this PDF using this data"))
+
+ #expect(intent.taskType == "document_form_fill")
+ #expect(intent.targetApp.appName == "Preview")
+ #expect(intent.normalizedEntities["document"] == "current PDF")
+ #expect(intent.normalizedEntities["dataSource"] == "provided data")
+ #expect(intent.metadata["requiresDocumentContext"] == "true")
+
+ let plan = LocalAppTaskAdapter(definition: BuiltInLocalAppTaskDefinitions.documentFormFill)
+ .dryRunPlan(for: intent)
+ #expect(plan.canAttemptGuardedLive == false)
+ #expect(plan.metadata["guardedLiveDefault"] == "reviewOnly")
+ #expect(plan.steps.map(\.role).contains(.custom))
+ }
+
@Test
func deterministicParserRequestsConfirmationForMissingRequiredEntity() throws {
let intent = try #require(parser().parse("show me the weather"))
@@ -71,7 +100,8 @@ struct LocalAppTaskTests {
.verifyResult
])
#expect(plan.steps.last?.status == .blocked)
- #expect(plan.metadata["defaultOSInputBackendAvailable"] == "false")
+ #expect(plan.metadata["defaultOSInputBackendAvailable"] == "true")
+ #expect(plan.metadata["defaultOSInputBackend"] == "mac-keyboard")
#expect(plan.metadata["visualFallback"] == "localModel")
#expect(plan.metadata["ocrFallbackDefault"] == "false")
@@ -112,7 +142,11 @@ struct LocalAppTaskTests {
func catalogResolvesCommandAgainstAvailableInstalledAppDefinition() throws {
let catalog = LocalAppTaskCatalog(
taskDefinitions: BuiltInLocalAppTaskDefinitions.defaults,
- availabilityProvider: StaticLocalAppAvailabilityProvider(installedBundleIdentifiers: ["com.apple.weather"])
+ availabilityProvider: StaticLocalAppAvailabilityProvider(installedBundleIdentifiers: [
+ "com.apple.weather",
+ "com.apple.Music",
+ "com.apple.Preview"
+ ])
)
let resolution = catalog.resolve(command: "show me the weather for SF")
@@ -127,6 +161,14 @@ struct LocalAppTaskTests {
let intent = try #require(resolution.intent)
let plan = catalog.adapter(for: definition).dryRunPlan(for: intent)
#expect(plan.steps.map(\.role).contains(.verifyResult))
+
+ let mediaResolution = catalog.resolve(command: "play Coldplay")
+ #expect(mediaResolution.status == .resolved)
+ #expect(mediaResolution.definition?.taskType == "media_playback")
+
+ let documentResolution = catalog.resolve(command: "fill out this PDF using this data")
+ #expect(documentResolution.status == .resolved)
+ #expect(documentResolution.definition?.taskType == "document_form_fill")
}
@Test
@@ -145,8 +187,53 @@ struct LocalAppTaskTests {
#expect(unavailableCatalog.resolve(command: "show me the weather for SF").status == .appUnavailable)
}
+ @Test @MainActor
+ func liveRunnerLaunchesFocusesExecutesGuardedCommandsAndVerifies() async throws {
+ let backend = RecordingLocalAppTaskInputBackend()
+ let controller = FakeLocalAppTaskAppController(
+ launchObservation: LocalAppTaskObservation(
+ appIsRunning: true,
+ appIsFocused: true,
+ availableControls: ["search": true],
+ confidence: 0.5
+ ),
+ finalObservation: LocalAppTaskObservation(
+ appIsRunning: true,
+ appIsFocused: true,
+ availableControls: ["search": true],
+ visibleText: ["city": "San Francisco, CA"],
+ confidence: 0.92
+ )
+ )
+ let catalog = LocalAppTaskCatalog(
+ taskDefinitions: BuiltInLocalAppTaskDefinitions.defaults,
+ availabilityProvider: StaticLocalAppAvailabilityProvider(installedBundleIdentifiers: ["com.apple.weather"])
+ )
+ let runner = LocalAppTaskLiveRunner(
+ catalog: catalog,
+ appController: controller,
+ actionEngineFactory: { _ in
+ ActionEngineGuardrail(
+ configuration: ActionEngineConfiguration(liveInputEnabled: true),
+ inputBackend: backend
+ )
+ },
+ permissionPolicy: ToolCallPolicy(deniedCapabilities: [])
+ )
+
+ let result = await runner.run(command: "show me the weather for SF", traceID: "trace-live-task")
+
+ #expect(result.status == .completed)
+ #expect(result.finalPlan?.terminalState == .completed)
+ #expect(result.actionTraces.count == 3)
+ #expect(result.actionTraces.allSatisfy { $0.executed })
+ #expect(await backend.executedKeys() == ["Command+F", "San Francisco", "Return"])
+ #expect(controller.launchCount == 1)
+ #expect(controller.observeCount == 1)
+ }
+
private func parser() -> LocalAppTaskIntentParser {
- LocalAppTaskIntentParser(taskDefinitions: [BuiltInLocalAppTaskDefinitions.weatherLookup])
+ LocalAppTaskIntentParser(taskDefinitions: BuiltInLocalAppTaskDefinitions.defaults)
}
private func adapter() -> LocalAppTaskAdapter {
@@ -160,3 +247,49 @@ struct LocalAppTaskTests {
)
}
}
+
+@MainActor
+private final class FakeLocalAppTaskAppController: LocalAppTaskAppControlling {
+ private let launchObservation: LocalAppTaskObservation
+ private let finalObservation: LocalAppTaskObservation
+ private(set) var launchCount = 0
+ private(set) var observeCount = 0
+
+ init(
+ launchObservation: LocalAppTaskObservation,
+ finalObservation: LocalAppTaskObservation
+ ) {
+ self.launchObservation = launchObservation
+ self.finalObservation = finalObservation
+ }
+
+ func launchOrFocus(
+ definition: LocalAppTaskDefinition,
+ availability: LocalAppAvailability
+ ) async -> LocalAppTaskObservation {
+ launchCount += 1
+ return launchObservation
+ }
+
+ func observe(definition: LocalAppTaskDefinition) async -> LocalAppTaskObservation {
+ observeCount += 1
+ return finalObservation
+ }
+}
+
+private actor RecordingLocalAppTaskInputBackend: ActionEngineInputBackend {
+ private var keys: [String] = []
+
+ func execute(_ command: ActionEngineCommand) async -> ActionEngineInputBackendResult {
+ keys.append(command.key ?? "")
+ return ActionEngineInputBackendResult(
+ executed: true,
+ completedAt: command.issuedAt,
+ metadata: ["liveInputBackend": "recording-local-app-task"]
+ )
+ }
+
+ func executedKeys() -> [String] {
+ keys
+ }
+}
diff --git a/docs/README.md b/docs/README.md
index fb2d4727..0022988a 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -4,7 +4,7 @@ This folder is the product and engineering source of truth for capabilities that
Plans describe what we might build. Guides describe what Donkey currently supports and how to maintain it.
-There is an active milestone plan in `plans/master-plan.md`. It tracks the unfinished work needed before the fast local navigation and AI-harness roadmap can be considered complete: generic local-app task knowledge, installed-app/task resolution, local-model command parsing with catalog validation, local voice-transcription model selection, local navigation, guarded input, result verification, latency reporting, and optional slow planner recovery. Weather lookup is the first benchmark definition for this generic system, not a Weather-specific architecture.
+There is an active milestone plan in `plans/master-plan.md`. It tracks the unfinished work needed before the fast local navigation and AI-harness roadmap can be considered complete: generic local-app task knowledge, installed-app/task resolution, local-model command parsing with catalog validation, local voice-transcription model selection, local navigation, guarded input, result verification, latency reporting, and optional slow planner recovery. Weather lookup, media playback, and document form-fill are benchmark definitions for this generic system, not source-specific architectures.
## Product Guides
diff --git a/docs/guides/minimal-run-coordinator.md b/docs/guides/minimal-run-coordinator.md
index b1ad8ed8..6b1c91de 100644
--- a/docs/guides/minimal-run-coordinator.md
+++ b/docs/guides/minimal-run-coordinator.md
@@ -18,7 +18,7 @@ Donkey also supports the first real reflex trace shape for the off-the-shelf run
Donkey also supports shared hot-loop contracts for deterministic reflex-loop slices. Frames, crops, coordinate spaces, perception signals, compact world states, controller actions, and action results are typed, Codable, Sendable contracts. Coordinate spaces are explicit across screen, window, crop, and normalized target space. Perception signals carry confidence and monotonic source age, and stale signals are marked on world state instead of being silently reused.
-Donkey also supports a deterministic dry-run reflex loop skeleton. The loop consumes synthetic, recorded, target-window, or local-navigation metadata frame batches through a latest-frame-wins buffer with queue depth 1, counts dropped frames, converts signals into compact world state through a swappable projector, chooses an inspectable semantic action, projects the action in dry-run mode without OS input, and publishes `ReflexTraceRecord` samples through `RunCoordinator`. This skeleton is for contract validation and replayable tests only; continuous streaming capture and a default OS input backend are not supported yet.
+Donkey also supports a deterministic dry-run reflex loop skeleton. The loop consumes synthetic, recorded, target-window, or local-navigation metadata frame batches through a latest-frame-wins buffer with queue depth 1, counts dropped frames, converts signals into compact world state through a swappable projector, chooses an inspectable semantic action, projects the action in dry-run mode without OS input, and publishes `ReflexTraceRecord` samples through `RunCoordinator`. This skeleton is for contract validation and replayable tests only; continuous streaming capture and reflex-loop default OS input are not supported yet.
Donkey also supports a bounded target-window frame source for the dry-run hot-loop boundary. The frame source reuses macOS window selection and safety checks, captures selected windows through ScreenCaptureKit's desktop-independent window path, returns `HotLoopFrame` metadata for a caller-provided maximum frame count, and records capture latency and copy cost with monotonic timestamps. This path does not write screenshot artifacts and does not PNG/JPEG encode or decode frames. High-resolution manual screenshot artifacts remain separate from reflex frames.
@@ -28,15 +28,15 @@ Donkey also supports the first off-the-shelf local vision evidence boundary insi
Donkey also tracks the first screenshot segmentation model candidate for the off-the-shelf vision boundary. `OffTheShelfVisionModelCatalog` lists Ultralytics YOLO26 nano segmentation (`yolo26n-seg.pt`) as the current screenshot/crop segmentation candidate, with official docs rechecked on May 17, 2026. This is catalog metadata only; live screenshot segmentation still requires a local runner, crop pipeline, export/runtime choice, and measured latency before it can enter a guarded live loop.
-Donkey also supports the first action-engine guardrail boundary. `ActionEngineGuardrail` accepts typed tap, swipe, key, mouse, controller, and `releaseAll` commands; checks input permission policy, focus guard status, command rate, and maximum hold duration; tracks held-input state; and records replayable command traces. Live input remains disabled by default and requires explicit configuration, an input-allowing policy, a passing focus guard, and an injected input backend. Allowed non-live commands are projected as dry-run traces, live smoke commands record backend execution evidence, denied commands include explicit denial reasons, and `releaseAll` clears held-input state.
+Donkey also supports the first action-engine guardrail boundary. `ActionEngineGuardrail` accepts typed tap, swipe, key, mouse, controller, and `releaseAll` commands; checks input permission policy, focus guard status, command rate, and maximum hold duration; tracks held-input state; and records replayable command traces. Live input remains disabled by default and requires explicit configuration, an input-allowing policy, a passing focus guard, and an injected input backend. The local-app live runner injects a narrow macOS keyboard backend for guarded key/text commands; other action-engine use still records dry-run traces unless a caller opts into live input. Allowed non-live commands are projected as dry-run traces, live commands record backend execution evidence, denied commands include explicit denial reasons, and `releaseAll` clears held-input state.
Donkey also supports reflex latency reports and a synthetic replay benchmark. `ReflexLatencyReportBuilder` summarizes reflex traces into p50/p95/p99 latency for software-loop, capture, preprocess/crop-normalize, model inference, perception, state update, controller decision, action projection, and input stages, plus capture/perception/controller rates, dropped frames, stale actions, and worst traces. `ReflexReplayBenchmark` can generate deterministic dry-run traces for capture-only, controller-only, or end-to-end dry-run report modes. The installed debug entrypoint can print a CLI-friendly dry-run latency report with `--dry-run-latency-report`.
Donkey also supports the first fast local-navigation dry-run slice end to end through the dry-run reflex loop. `LocalNavigationMetadataFrameSource` can turn macOS window candidate metadata and optional browser-tab metadata supplied by callers into metadata-only hot-loop frames. `LocalNavigationDryRunPerceptionAdapter` and `LocalNavigationDryRunWorldStateProjector` keep the local-navigation path swappable while preserving the no-remote-model fallback. `LocalNavigationControllerPolicy` can choose traceable dry-run semantic actions such as `focusWindow`, `activateCandidate`, `switchTab`, `wait`, or `observe` from typed state. This slice is metadata-only and side-effect free by default; guarded live-action smoke requires an injected backend, and richer visual inference remains future work.
-Donkey also supports the first generic local-app task catalog, intent, and dry-run adapter boundary. `TaskIntent` can represent a parsed task, target app, normalized entities, parser source, confidence, and confirmation state. `LocalAppTaskDefinition` describes app-task knowledge as data: target app metadata, deterministic trigger terms, required entities and aliases, workflow steps, observation strategies, and verification rules. `LocalAppTaskCatalog` resolves validated intents against known task definitions, checks target-app availability through an injected provider, and exposes built-in benchmark definitions such as Weather lookup as data rather than source-specific adapters. `OllamaTaskIntentAdapter` is the supported primary command parser: it sends the user command and available task definitions to a local Ollama-compatible structured-output model, decodes a `TaskIntent`, and validates it against the catalog before execution can proceed. `LocalAppTaskIntentParser` remains a deterministic fallback and test scaffold for known commands, not the preferred command-understanding path. `LocalAppTaskAdapter` can build a target-app local-navigation metadata request, project dry-run workflow steps, emit guarded keyboard command templates for an injected action backend, and verify observed visible text against the requested entity. Default app launch/focus, default OS typing, Accessibility actions, live local-model UI understanding, and live result verification remain unsupported.
+Donkey also supports the first generic local-app task catalog, intent, and live runner boundary. `TaskIntent` can represent a parsed task, target app, normalized entities, parser source, confidence, and confirmation state. `LocalAppTaskDefinition` describes app-task knowledge as data: target app metadata, deterministic trigger terms, required entities and aliases, workflow steps, observation strategies, and verification rules. `LocalAppTaskCatalog` resolves validated intents against known task definitions, checks target-app availability through an injected provider, and exposes built-in definitions such as Weather lookup, Music playback, and PDF/document form-fill as data rather than source-specific adapters. `OllamaTaskIntentAdapter` is the supported primary command parser: it sends the user command and available task definitions to a local Ollama-compatible structured-output model, decodes a `TaskIntent`, and validates it against the catalog before execution can proceed. `LocalAppTaskIntentParser` remains a deterministic fallback and test scaffold for known commands, not the preferred command-understanding path. `LocalAppTaskAdapter` can build a target-app local-navigation metadata request, project dry-run workflow steps, emit guarded keyboard command templates, and verify observed visible text against the requested entity. `LocalAppTaskLiveRunner` can launch or focus the resolved app, execute the task's guarded keyboard templates through `ActionEngineGuardrail`, observe visible Accessibility text when trusted, and return a final verification plan. Review-only tasks, such as document form-fill with external data, can resolve and plan without attempting live input until document/data context and field mapping are available. Accessibility actions, robust control discovery, live local-model UI understanding, and live visual fallback remain unsupported.
-Donkey also supports a guarded live-action smoke boundary for the first local-navigation behavior. `GuardedLiveActionSmokeRunner` requires an end-to-end dry-run result, a latency report with p95 evidence, a non-fallback latest action, explicit input policy allowance, and a passing action-engine focus guard before mapping semantic local-navigation actions to typed action-engine commands. The smoke path records replayable action traces and can execute only through an injected backend; no default OS input backend is enabled.
+Donkey also supports a guarded live-action smoke boundary for local-navigation behavior. `GuardedLiveActionSmokeRunner` requires an end-to-end dry-run result, a latency report with p95 evidence, a non-fallback latest action, explicit input policy allowance, and a passing action-engine focus guard before mapping semantic local-navigation actions to typed action-engine commands. The smoke path records replayable action traces and can execute only through an injected backend.
Donkey also supports slow-path planner hint contracts. `StructuredPlannerHint` carries a goal, policy, priorities, regions of interest, preferred and avoided semantic actions, confidence, expiry, and source trace/frame/state/model-call ids. Planner hints are advisory only; they are validated for unknown actions, unsafe actions, stale state references, low-confidence replacement, and expiry before selection. `PlannerHintSelector` chooses the latest valid hint, and the reflex loop remains able to run without any planner hint.
@@ -73,7 +73,7 @@ Donkey supports a runtime-level manual target context capture service that wires
The installed executable also supports a developer-only launch-argument entrypoint for manual verification. `--list-window-candidates` prints the current candidate-list labels and durable `windowID` values. `--manual-capture` runs one manual capture, optionally with `--window-id <id>`, `--run-id <safe-id>`, and `--trace-id <safe-id>`, then prints the run folder and artifact paths. These commands are non-interactive and exit before showing the pointer prompt overlay.
-This is a coordination, in-memory reflex trace, hot-loop contract, deterministic dry-run skeleton, bounded target-window frame-source, cheap metadata perception, recorded off-the-shelf local vision evidence, screenshot segmentation model-candidate catalog, deterministic controller, local-navigation dry-run, generic local-app task catalog/intent/dry-run adapter, guarded live-action smoke boundary, slow-planner sidecar, action-engine guardrail, latency-report, planner-hint contract, model-registry/router, local voice-transcription model selection, OpenAI and Ollama-compatible planner adapters, memory, replay/eval, target-metadata, single-screenshot artifact, read-only Accessibility snapshot, and manual capture orchestration foundation only. It does not run live transcription, live vision models, or OCR over captured pixels, ship a default OS input backend, perform Accessibility actions, provide a manual capture UI, persist high-volume reflex traces to disk, provide continuous streaming capture, or make model calls required for reflex ticks.
+This is a coordination, in-memory reflex trace, hot-loop contract, deterministic dry-run skeleton, bounded target-window frame-source, cheap metadata perception, recorded off-the-shelf local vision evidence, screenshot segmentation model-candidate catalog, deterministic controller, local-navigation dry-run, generic local-app task catalog/intent/live-runner boundary, sample task definitions across weather/media/document domains, guarded live-action smoke boundary, slow-planner sidecar, action-engine guardrail, latency-report, planner-hint contract, model-registry/router, local voice-transcription model selection, OpenAI and Ollama-compatible planner adapters, memory, replay/eval, target-metadata, single-screenshot artifact, read-only Accessibility snapshot, and manual capture orchestration foundation only. It does not run live transcription, live vision models, or OCR over captured pixels, perform Accessibility actions, provide robust UI control discovery, provide a manual capture UI, persist high-volume reflex traces to disk, provide continuous streaming capture, or make model calls required for reflex ticks.
## Technical Guidelines
@@ -99,12 +99,12 @@ This is a coordination, in-memory reflex trace, hot-loop contract, deterministic
- Keep controller fallback explicit. Low confidence, stale signals, missing affordances, and missing signals should produce traceable `wait` or `observe` actions, not silent no-ops.
- Keep every chosen controller action trace-linked with action id, state id, frame id, policy name, confidence, rationale, fallback metadata, and any compact source-evidence metadata needed to explain the rule.
- Keep action-engine commands typed and replayable. Guardrails must run before live input and record permission, focus, rate-limit, hold-duration, release, backend, issued time, backend completion time, and execution status. Live held-input tracking starts only after the backend reports execution.
-- Keep live OS input disabled unless a caller explicitly configures live mode, allows input in policy, passes focus guard, and supplies an input backend. The default backend does not synthesize OS events.
+- Keep live OS input disabled unless a caller explicitly configures live mode, allows input in policy, passes focus guard, and supplies an input backend. The macOS keyboard backend is narrow: it is for guarded local-app key/text commands, not arbitrary controller output.
- Use monotonic timestamps for latency math. Wall-clock timestamps are for human labels and trace correlation only.
- Use latency reports for any p50/p95/p99 claim. Reports should include dropped frames, stale actions, tick rates, and worst traces.
- Keep local-navigation decisions typed and side-effect free until the guarded live-action slice. Metadata projectors may use window, browser-tab, and Accessibility facts when available, but controllers should emit semantic actions only.
- Keep local-model task intents separate from planner hints. A supported local command should first parse to a validated `TaskIntent` through the local Ollama-compatible command parser; deterministic parsing is only a fallback/validator path, and slow planner output may only help app-knowledge lookup or recovery after validation.
-- Keep local-app task adapter output inspectable before live control. Dry-run steps should show the normalized entities, target app identity, observation boundary, guarded command templates, and verification status before any injected backend is allowed to type or click.
+- Keep local-app task adapter output inspectable before live control. Dry-run steps should show the normalized entities, target app identity, observation boundary, guarded command templates, and verification status before the live runner is allowed to launch, focus, type, or submit.
- Prefer Accessibility and metadata for app observation. When visual interpretation is needed, route bounded screenshot/crop context to a local model UI-understanding path before introducing OCR-specific plumbing; OCR remains an optional measured adapter, not the default fallback.
- Treat planner hints as validated, expiring advice. Controllers may use the latest valid hint, but planner output must never become direct input.
- Keep slow planner work beside the reflex loop. Trigger it from compact state, trace, memory, and artifact references; never await model calls from the hot tick before recording the reflex trace.
diff --git a/docs/guides/pointer-prompt-overlay.md b/docs/guides/pointer-prompt-overlay.md
index adab4e4e..6f3d2163 100644
--- a/docs/guides/pointer-prompt-overlay.md
+++ b/docs/guides/pointer-prompt-overlay.md
@@ -17,9 +17,9 @@ Donkey supports a floating macOS pointer prompt overlay:
- 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
-- keeps runtime and AI harness behavior behind explicit integration boundaries
+- submits typed prompt text through the local-app command pipeline while keeping model parsing, task validation, and live input outside the SwiftUI rendering path
-This is a visual and microphone-level UI capability. It does not capture the screen, send input, call models, transcribe speech, or require Accessibility permission. It does request microphone permission so the waveform can reflect live local audio levels. The AI harness now has a local voice-transcription model route, but the overlay has not yet wired microphone buffers into a speech-to-text adapter.
+This is a visual, typed-command, and microphone-level UI capability. Typed submissions go to the local-app command handler, which prefers local-model task-intent parsing, validates the intent against the app-task catalog, and then runs the guarded local-app live runner. The overlay itself does not capture the screen, synthesize input, transcribe speech, or require Accessibility permission. It does request microphone permission so the waveform can reflect live local audio levels. The AI harness has a local voice-transcription model route, but the overlay has not yet wired microphone buffers into a speech-to-text adapter.
## Technical Guidelines
@@ -42,7 +42,7 @@ This is a visual and microphone-level UI capability. It does not capture the scr
- 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.
- 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 LLM call in this feature.
+- 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.
- Keep voice capture separate from transcription. The overlay may publish bounded local audio buffers to a future transcription adapter, but model execution and command parsing should remain outside the SwiftUI view/controller rendering path.
## Verification
diff --git a/plans/20-off-the-shelf-run-loop.md b/plans/20-off-the-shelf-run-loop.md
index 1461d0d1..97a8f3ec 100644
--- a/plans/20-off-the-shelf-run-loop.md
+++ b/plans/20-off-the-shelf-run-loop.md
@@ -1,6 +1,6 @@
# Off-The-Shelf Run Loop
-> Active status: not complete. The current repo supports metadata-only local-navigation dry-run scaffolding, generic local-app task catalog parsing/adaptation, local-model command parsing, local voice-transcription model selection, target-app availability checks, and guarded live-action smoke, but not a live fast-navigation agent for a concrete command such as "show me the weather for SF".
+> Active status: not complete. The current repo supports metadata-only local-navigation dry-run scaffolding, generic local-app task catalog parsing/adaptation, local-model command parsing, pointer-prompt typed command submission, macOS app launch/focus, guarded macOS keyboard input, local voice-transcription model selection, target-app availability checks, Accessibility visible-text observation when trusted, built-in task definitions across weather/media/document domains, and guarded live-action smoke. It still needs real-session verification and richer control discovery before any benchmark should be treated as done.
## Goal
@@ -510,18 +510,18 @@ The runtime foundation now supports a product-shaped local-navigation slice of t
- p50/p95/p99 latency reports across capture, preprocess, model, perception, state update, controller decision, action projection, and input stages
- action-engine permission, focus, rate, hold-duration, release, and backend-execution guardrails
- guarded live-action smoke through an injected backend only after dry-run latency evidence, explicit input policy allowance, and focus guard success
-- generic local-app task catalog, intent contracts, built-in benchmark definition, local-model command parsing, deterministic fallback parsing, dry-run workflow-step projection, guarded keyboard command templates, and visible-text verification
+- generic local-app task catalog, intent contracts, built-in benchmark definitions across Weather lookup, Music playback, and PDF/document form-fill, local-model command parsing, deterministic fallback parsing, pointer-prompt typed command submission, dry-run workflow-step projection, guarded keyboard command templates, macOS launch/focus, guarded macOS keyboard input, Accessibility visible-text observation when trusted, and visible-text verification
- screenshot segmentation model-candidate metadata for Ultralytics YOLO26 nano segmentation (`yolo26n-seg.pt`)
- optional slow-planner sidecar that publishes only validated hints without blocking reflex latency
-This is still not the full off-the-shelf vision stack and must not be treated as completion. It can replay and trace compact local vision evidence and name a current YOLO segmentation candidate, but it does not ship live local detector/local-model/OCR/segmentation adapters over captured pixels, continuous streaming capture, a default OS input backend, high-volume persisted replay traces, or target-specific visual calibration.
+This is still not the full off-the-shelf vision stack and must not be treated as completion. It can replay and trace compact local vision evidence, name a current YOLO segmentation candidate, and run a guarded keyboard-based local-app task path, but it does not ship live local detector/local-model/OCR/segmentation adapters over captured pixels, continuous streaming capture, Accessibility action execution, robust UI control discovery, high-volume persisted replay traces, or target-specific visual calibration.
## Required Before This Plan Is Done
-- Add measured guarded-live execution for the first local-app task benchmark command "show me the weather for SF".
+- Manually verify measured guarded-live execution for the first local-app task benchmark command "show me the weather for SF".
- Prove fast local navigation from parsed intent, local app observation, deterministic controller state, and guarded live input, not remote planning.
-- Add a default narrow macOS app-control backend for launch/focus/type/select/verify with focus guard and emergency release.
-- Add result verification through Accessibility or local model UI-understanding fallback, with OCR only if a narrow benchmark justifies it.
+- Extend the narrow macOS app-control backend from keyboard-only workflows to Accessibility action/control discovery where available.
+- Add result verification through Accessibility plus local model UI-understanding fallback, with OCR only if a narrow benchmark justifies it.
- Add measured YOLO26 screenshot/crop segmentation inference for visual fallback, including export/runtime choice, crop size, mask quality, and p95 latency.
- Add continuous streaming capture once queue-depth, stale-result, and trace sinks are ready for longer sessions.
- Add durable high-volume replay trace persistence and target-specific benchmark baselines.
diff --git a/plans/master-plan.md b/plans/master-plan.md
index ac600d1c..3cacaac7 100644
--- a/plans/master-plan.md
+++ b/plans/master-plan.md
@@ -2,7 +2,7 @@
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.
-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, using local observation and deterministic control rather than chat reasoning.
+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.
Primary plans:
@@ -56,8 +56,8 @@ The normal Weather benchmark path should work without a remote model call. A tin
## Supported Boundary
- Runtime shell: minimal run coordination, ordered events, bounded context assembly, local run artifacts, manual target context capture, 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 with Ultralytics YOLO26 nano segmentation (`yolo26n-seg.pt`), 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, Ollama-compatible local-model command parsing to validated `TaskIntent`, deterministic parsing as fallback/validator, catalog command resolution, target-app availability checks, generic dry-run task adaptation, local-navigation request construction, step projection, guarded keyboard command templates, visible-text verification, and built-in Weather benchmark data are supported. This is not yet a live fast-navigation agent: there is no default app launch/focus/type backend, no Accessibility action execution, no live local-model UI-understanding fallback, no live YOLO screenshot segmentation runner, no live voice-transcription adapter, and no verified live command-to-result loop.
-- Safety boundary: action-engine command contracts, permission/focus/rate/hold/release guardrails, guarded live-action smoke with an injected backend, and replayable command traces are supported before any default OS input or Accessibility-action backend exists.
+- 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 with Ultralytics YOLO26 nano segmentation (`yolo26n-seg.pt`), 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, Ollama-compatible local-model command parsing to validated `TaskIntent`, deterministic parsing as fallback/validator, catalog command resolution, target-app availability checks, generic dry-run task adaptation, local-navigation request construction, step projection, guarded keyboard command templates, macOS app launch/focus, guarded macOS keyboard input, pointer-prompt typed command submission, Accessibility visible-text observation when trusted, visible-text verification, 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: there is no Accessibility action execution, no robust live control discovery, no live local-model UI-understanding fallback, no live YOLO screenshot segmentation runner, no live voice-transcription adapter, and no manually verified live command-to-result Weather trace yet.
+- 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, and replayable command traces are supported before any Accessibility-action backend exists.
- Slow AI boundary: local-model task-intent parsing, local voice-transcription model routing, 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, and replay/eval scaffolding are supported as optional sidecar pieces. NVIDIA Parakeet TDT 0.6B v3 is the selected local voice-transcription default, with Whisper large-v3-turbo as a local rollback candidate. This is not yet the complete AI harness because semantic retrieval, redaction, aggregate model observability, live microphone transcription, live local visual UI understanding, and provider-decoded memory write proposals remain active.
- 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.
@@ -84,12 +84,12 @@ Recent commits completed these pieces:
- current slice: generic local-app task catalog, local-model command parser, deterministic fallback parser, 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, Ollama-compatible local-model command parser, deterministic fallback parser, app availability check, dry-run adapter boundary, YOLO26 screenshot segmentation model-candidate metadata, and local voice-transcription model routing. It does not yet include default app launch/focus/type execution, Accessibility action execution, live local-model UI understanding over bounded screenshots/crops, live YOLO screenshot segmentation inference, live microphone transcription, live result verification, semantic memory retrieval, remote-input redaction hooks, aggregate model observability, or provider-decoded memory write proposals.
+The code now includes the first generic local-app task catalog, Ollama-compatible local-model command parser, deterministic fallback parser, app availability check, dry-run adapter boundary, local-app live runner, macOS launch/focus and keyboard-input backend, pointer-prompt typed command wiring, sample app-task definitions across weather/media/document domains, YOLO26 screenshot segmentation model-candidate metadata, and local voice-transcription model routing. It does not yet include Accessibility action execution, robust live control discovery, live local-model UI understanding over bounded screenshots/crops, live YOLO screenshot segmentation inference, live microphone transcription, semantic memory retrieval, remote-input redaction hooks, aggregate model observability, or provider-decoded memory write proposals.
## What Should Be Done Next
-1. Extend the generic local-app task adapter from dry-run projection to guarded-live orchestration: launch/focus the target app, observe app state, find the needed control, enter normalized entities, submit/select, and verify the requested result.
-2. Add the default local action backend needed for this narrow first benchmark: app launch/activation plus guarded keyboard typing/clicking or Accessibility actions, with emergency release and focus checks.
+1. Manually verify the pointer-prompt-to-Weather path on a real macOS session: typed command submission, local-model intent parse or deterministic fallback, Weather launch/focus, guarded key/text execution, Accessibility visible-text observation, and final verification trace.
+2. Add robust live control discovery and Accessibility actions for local-app workflows so tasks can find controls instead of relying only on keyboard shortcuts.
3. Add a local model UI-understanding fallback for bounded screenshot/crop context when Accessibility and metadata are insufficient. Prefer this before OCR-specific extraction; OCR can remain a measured optional adapter.
4. Add a measured local screenshot segmentation runner for the YOLO26 candidate only after choosing export/runtime format and crop size; keep it outside live control until p95 latency and mask quality are recorded.
5. Wire pointer-prompt voice input to a local transcription adapter: capture bounded microphone buffers, run the selected local runtime ASR model, emit transcript text, and pass that transcript through the same validated command-intent path as typed input.