agent-device 0.21.23 → 0.21.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.23.apk → agent-device-android-ime-helper-0.21.25.apk} +0 -0
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.25.apk.sha256 +1 -0
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.23.manifest.json → agent-device-android-ime-helper-0.21.25.manifest.json} +4 -4
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.25.apk +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.25.apk.sha256 +1 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.25.manifest.json +16 -0
- package/apple/macos-helper/Sources/AgentDeviceMacOSHelper/SnapshotTraversal.swift +12 -6
- package/apple/macos-helper/Tests/AgentDeviceMacOSHelperTests/RectResponseTests.swift +21 -0
- package/apple/snapshot-bridge/README.md +9 -7
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m +159 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerHttpRequestFraming.swift +139 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerListenerPeer.swift +41 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerListenerToken.swift +25 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandDispatch.swift +56 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +14 -5
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Environment.swift +18 -11
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +8 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +12 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +25 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCaptureTarget.swift +1 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotExecution.swift +29 -5
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedTextEntry.swift +0 -3
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +35 -13
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryConfirmation.swift +59 -26
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryFocus.swift +19 -5
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextTyping.swift +50 -106
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Transport.swift +142 -54
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TypeExecution.swift +4 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +21 -19
- package/dist/src/absence-observation-errors.js +1 -0
- package/dist/src/adapter.js +1 -1
- package/dist/src/adb-executor.js +2 -2
- package/dist/src/adb-failure.js +2 -2
- package/dist/src/adb.js +1 -1
- package/dist/src/agent-browser-lifecycle.js +1 -1
- package/dist/src/agent-browser-process-record.js +1 -1
- package/dist/src/agent-browser-provider.js +1 -1
- package/dist/src/agent-browser-tool.js +1 -1
- package/dist/src/agent-device-client.js +2 -2
- package/dist/src/alert.js +1 -1
- package/dist/src/android-adb.d.ts +3 -2
- package/dist/src/android-adb.js +1 -1
- package/dist/src/android-input-ownership.js +1 -1
- package/dist/src/android-system-surface-disclosure.js +1 -0
- package/dist/src/android-text-entry.js +1 -0
- package/dist/src/android.js +1 -1
- package/dist/src/app-backend.js +1 -1
- package/dist/src/app-helpers.js +1 -1
- package/dist/src/app-inventory.d.ts +4 -0
- package/dist/src/app-launch.js +1 -1
- package/dist/src/app-lifecycle.js +4 -3
- package/dist/src/app-lifecycle2.js +2 -2
- package/dist/src/app-log-files.js +1 -1
- package/dist/src/app-log-reconnect.js +1 -1
- package/dist/src/app-log-runtime2.js +3 -3
- package/dist/src/app-resolution-facade.js +1 -1
- package/dist/src/app-resolution.js +2 -2
- package/dist/src/app-state-runtime.d.ts +15 -0
- package/dist/src/apple-runner-platform.js +1 -1
- package/dist/src/application-lifecycle-interaction.js +1 -1
- package/dist/src/artifact-download.js +1 -1
- package/dist/src/auth.js +1 -1
- package/dist/src/aws-device-farm-connection.js +1 -0
- package/dist/src/back-mode.js +1 -1
- package/dist/src/backend-snapshot-options.js +1 -1
- package/dist/src/boot-diagnostics.js +1 -1
- package/dist/src/browserstack-connection.js +1 -0
- package/dist/src/capture-disclosure.js +1 -0
- package/dist/src/cli-config.js +1 -1
- package/dist/src/cli-help.js +36 -17
- package/dist/src/cli-output.js +1 -1
- package/dist/src/cli-runner.js +3 -1
- package/dist/src/cli.js +3 -4
- package/dist/src/client-companion-tunnel.js +1 -0
- package/dist/src/client-metro.js +1 -1
- package/dist/src/client-types.d.ts +15 -7
- package/dist/src/cloud-artifacts.d.ts +3 -2
- package/dist/src/code-signature-cache.js +1 -1
- package/dist/src/code-signature.js +1 -1
- package/dist/src/command-metadata.js +73 -1
- package/dist/src/command-policy.js +1 -0
- package/dist/src/command-schema.js +3 -3
- package/dist/src/command-surface.js +1 -1
- package/dist/src/command-tools.js +2 -2
- package/dist/src/connection-runtime.js +1 -1
- package/dist/src/connection-verification.js +1 -0
- package/dist/src/connection.js +5 -5
- package/dist/src/contracts.d.ts +1 -1
- package/dist/src/contracts.js +1 -1
- package/dist/src/daemon-client-lease-beat.js +1 -1
- package/dist/src/daemon-client-lifecycle.js +1 -1
- package/dist/src/daemon-client-liveness-probe.js +1 -1
- package/dist/src/daemon-policy-file.js +1 -1
- package/dist/src/daemon-registration-owner.js +1 -1
- package/dist/src/daemon-registration.js +1 -1
- package/dist/src/daemon-resolution.js +3 -1
- package/dist/src/debug-symbols-facade.js +1 -1
- package/dist/src/device-claim-inspection.js +1 -1
- package/dist/src/device-input-state.d.ts +6 -17
- package/dist/src/device-inventory-context.js +1 -1
- package/dist/src/device-readiness-runtime.js +1 -1
- package/dist/src/device-release.js +1 -1
- package/dist/src/device-selection-resolver.js +1 -1
- package/dist/src/device-shell.js +1 -1
- package/dist/src/device.js +3 -1
- package/dist/src/devicectl.js +1 -1
- package/dist/src/diagnostics.js +1 -1
- package/dist/src/doctor-facade.js +1 -1
- package/dist/src/durable-capture-resource.js +1 -1
- package/dist/src/durable-resource.js +1 -1
- package/dist/src/engine-eval-script.js +1 -1
- package/dist/src/error.js +1 -1
- package/dist/src/exec.js +1 -1
- package/dist/src/expo-dev-client-launch.js +1 -0
- package/dist/src/file.js +3 -1
- package/dist/src/find.js +1 -1
- package/dist/src/finders.js +1 -1
- package/dist/src/generic-settle.js +1 -1
- package/dist/src/generic.js +1 -1
- package/dist/src/gesture-admission.js +1 -1
- package/dist/src/gesture-plan-types.d.ts +2 -5
- package/dist/src/gesture-plan.js +1 -1
- package/dist/src/gesture-runtime.js +1 -1
- package/dist/src/harmonyos.js +1 -1
- package/dist/src/hdc.js +1 -1
- package/dist/src/helper.js +2 -2
- package/dist/src/human-control.js +1 -1
- package/dist/src/ime-rebind.js +1 -1
- package/dist/src/ime-state.js +1 -1
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.js +1 -1
- package/dist/src/input-actions.js +1 -1
- package/dist/src/input-actions2.js +2 -2
- package/dist/src/install-source-network-transport.js +1 -1
- package/dist/src/install-source2.js +1 -1
- package/dist/src/interaction-error.js +1 -0
- package/dist/src/interaction-positionals.js +1 -1
- package/dist/src/interaction.js +1 -1
- package/dist/src/interaction2.js +1 -1
- package/dist/src/interactor-operation-catalog.js +1 -1
- package/dist/src/interactor.js +5 -5
- package/dist/src/interactor2.js +1 -1
- package/dist/src/interactors.js +1 -1
- package/dist/src/internal/bin.js +1 -1
- package/dist/src/internal/daemon.js +5 -1
- package/dist/src/internal/png-worker.js +1 -1
- package/dist/src/inventory.js +2 -2
- package/dist/src/inventory2.js +1 -1
- package/dist/src/inventory6.js +1 -1
- package/dist/src/io.d.ts +2 -2
- package/dist/src/ios-client.js +1 -1
- package/dist/src/ios-settings.js +1 -1
- package/dist/src/ios-snapshot-acquisition.js +1 -1
- package/dist/src/ios-snapshot-adapter.js +1 -1
- package/dist/src/ios-snapshot-engine.js +1 -1
- package/dist/src/ios-snapshot-runtime.js +1 -1
- package/dist/src/keyed-lock.js +1 -1
- package/dist/src/launch-confirmation.js +1 -1
- package/dist/src/lease.js +1 -1
- package/dist/src/limrun-runtime-dependencies.js +1 -1
- package/dist/src/limrun.d.ts +5 -564
- package/dist/src/limrun.js +1 -1
- package/dist/src/linux.js +1 -1
- package/dist/src/load.js +1 -1
- package/dist/src/local-interactor-operation-set.js +1 -1
- package/dist/src/log-stream.js +9 -9
- package/dist/src/mechanics.js +16 -16
- package/dist/src/metro.js +1 -1
- package/dist/src/metro2.js +1 -1
- package/dist/src/mobile-snapshot-semantics.js +1 -1
- package/dist/src/observability.js +1 -1
- package/dist/src/observation.js +1 -2
- package/dist/src/open-target-resolution.js +1 -1
- package/dist/src/output-path.js +1 -1
- package/dist/src/overlay.js +1 -3
- package/dist/src/perf-facade.js +1 -1
- package/dist/src/perf-runtime-operation-builder.js +1 -1
- package/dist/src/perf-runtime.js +1 -1
- package/dist/src/perf-target.js +1 -1
- package/dist/src/physical-device-control.js +1 -1
- package/dist/src/platform-request-scope.js +1 -1
- package/dist/src/platform-runtime-android-adb-host.js +1 -1
- package/dist/src/platform-runtime-app-log-android-transport.js +1 -1
- package/dist/src/platform-runtime-apple-resources.js +1 -0
- package/dist/src/platform-runtime-claim-recovery.js +1 -0
- package/dist/src/platform-runtime-daemon-services.js +1 -0
- package/dist/src/platform-runtime-host.js +1 -1
- package/dist/src/platform-runtime-network-web-transport.js +1 -1
- package/dist/src/platform-runtime-open-target.js +1 -1
- package/dist/src/platform-runtime-operation-host.js +4 -4
- package/dist/src/platform-runtime-runtime-hints.js +2 -2
- package/dist/src/platform-runtime-screen-recording-android-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-apple-runner-transport.js +1 -1
- package/dist/src/platform-runtime-screen-recording-apple-simulator-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-finalizer-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-harmony-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-web-host.js +1 -1
- package/dist/src/platform-runtime-unavailable.js +1 -1
- package/dist/src/platform-runtime.js +1 -1
- package/dist/src/platform-runtime2.js +1 -1
- package/dist/src/plugin.js +1 -0
- package/dist/src/plugins/webdriver.d.ts +111 -0
- package/dist/src/plugins/webdriver.js +1 -0
- package/dist/src/plugins.d.ts +2 -1
- package/dist/src/plugins2.js +1 -1
- package/dist/src/png-crop-bytes.js +1 -1
- package/dist/src/png-resize.js +1 -0
- package/dist/src/png-worker-client.js +1 -1
- package/dist/src/png-worker-contract.js +1 -1
- package/dist/src/process-entry.js +1 -1
- package/dist/src/process-exit.js +1 -1
- package/dist/src/process.js +1 -1
- package/dist/src/provider-credential-fingerprint.js +1 -1
- package/dist/src/provider-device-admission.js +1 -1
- package/dist/src/provider-device-runtime.d.ts +556 -0
- package/dist/src/provider-policy.js +1 -0
- package/dist/src/provider-profile-fields.js +1 -1
- package/dist/src/provider-webdriver.js +1 -2
- package/dist/src/proxy.js +2 -2
- package/dist/src/quality-warnings.js +1 -1
- package/dist/src/react-devtools.js +2 -0
- package/dist/src/react-native-overlay2.js +3 -0
- package/dist/src/react-native.js +1 -1
- package/dist/src/record-runtime.js +1 -1
- package/dist/src/record-trace.js +1 -1
- package/dist/src/recording.js +2 -2
- package/dist/src/register-builtins.js +1 -1
- package/dist/src/remote-bridge.js +1 -0
- package/dist/src/remote-config-core.js +1 -0
- package/dist/src/remote-config.js +1 -1
- package/dist/src/remote-config2.js +1 -1
- package/dist/src/replay-backend-registry.js +1 -0
- package/dist/src/replay-divergence.js +1 -1
- package/dist/src/replay-maestro-backend.js +117 -0
- package/dist/src/replay-script-selection.js +1 -0
- package/dist/src/replay.js +1 -3
- package/dist/src/replay2.js +1 -0
- package/dist/src/reporting.js +3 -3
- package/dist/src/request-cancel.js +1 -1
- package/dist/src/request-providers.js +1 -1
- package/dist/src/request-runtime-binding.js +1 -1
- package/dist/src/result-serialization.js +1 -1
- package/dist/src/retry.js +1 -1
- package/dist/src/retry2.js +1 -0
- package/dist/src/runner-artifact-manifest.js +1 -1
- package/dist/src/runner-cache-retention.js +1 -0
- package/dist/src/runner-cache-trim.js +1 -0
- package/dist/src/runner-client.js +1 -1
- package/dist/src/runner-dev-tools-security.js +1 -1
- package/dist/src/runner-device-readiness.js +1 -1
- package/dist/src/runner-device-set.js +1 -0
- package/dist/src/runner-error-classification.js +3 -3
- package/dist/src/runner-exchange.js +1 -1
- package/dist/src/runner-lease.js +1 -0
- package/dist/src/runner-operations-facade.js +1 -1
- package/dist/src/runner-retention.js +1 -0
- package/dist/src/runner-start-budget.js +1 -1
- package/dist/src/runner-startup-transport.js +1 -0
- package/dist/src/runner-toolchain-probe.js +2 -0
- package/dist/src/runner.js +2 -1
- package/dist/src/runtime-command-surface.js +1 -0
- package/dist/src/runtime-deployment.js +1 -0
- package/dist/src/runtime-factory.js +1 -0
- package/dist/src/runtime-session.js +1 -0
- package/dist/src/runtime-transport-hints.js +1 -1
- package/dist/src/runtime.js +2 -1
- package/dist/src/runtime10.js +2 -2
- package/dist/src/runtime2.js +4 -4
- package/dist/src/runtime3.js +1 -1
- package/dist/src/runtime4.js +5 -5
- package/dist/src/runtime5.js +1 -1
- package/dist/src/runtime6.js +1 -1
- package/dist/src/runtime7.js +1 -1
- package/dist/src/runtime8.js +1 -1
- package/dist/src/runtime9.js +1 -1
- package/dist/src/screen-recording-transport.js +1 -1
- package/dist/src/screenshot-density.js +1 -1
- package/dist/src/screenshot-image.js +1 -1
- package/dist/src/screenshot-runtime.js +1 -1
- package/dist/src/screenshot3.js +5 -5
- package/dist/src/sdk-batch-runner.js +2 -2
- package/dist/src/sdk-batch.js +2 -2
- package/dist/src/sdk-contracts.d.ts +20 -29
- package/dist/src/sdk-contracts.js +2 -2
- package/dist/src/sdk-device.js +1 -1
- package/dist/src/sdk-finders.d.ts +1 -1
- package/dist/src/sdk-finders.js +1 -1
- package/dist/src/sdk-io.d.ts +4 -2
- package/dist/src/sdk-remote-config.d.ts +4 -0
- package/dist/src/sdk-remote-config.js +1 -1
- package/dist/src/sdk-selectors.d.ts +5 -6
- package/dist/src/sdk-selectors.js +1 -1
- package/dist/src/selection.js +0 -0
- package/dist/src/selector-pipeline-policy.js +1 -1
- package/dist/src/selector-runtime.js +1 -1
- package/dist/src/selectors.js +1 -1
- package/dist/src/server.js +2 -2
- package/dist/src/session-allocation.js +1 -1
- package/dist/src/session-replay-runtime-failure-response.js +1 -0
- package/dist/src/session-runtime-admission.js +1 -1
- package/dist/src/session.js +1 -1
- package/dist/src/session2.js +5 -5
- package/dist/src/settings.js +1 -1
- package/dist/src/settings2.js +1 -1
- package/dist/src/simctl-settings.js +1 -1
- package/dist/src/simctl.js +1 -1
- package/dist/src/simulator-boot.js +1 -1
- package/dist/src/simulator-state.js +1 -1
- package/dist/src/simulator.js +1 -1
- package/dist/src/snapshot-capture-annotations.js +1 -1
- package/dist/src/snapshot-chrome.js +1 -0
- package/dist/src/snapshot-desktop-projection.js +1 -1
- package/dist/src/snapshot-evidence.js +1 -0
- package/dist/src/snapshot-node-lookup.js +1 -0
- package/dist/src/snapshot-occlusion.js +1 -0
- package/dist/src/snapshot-quality-verdict.js +1 -0
- package/dist/src/snapshot-runtime-binding.js +1 -1
- package/dist/src/snapshot-runtime.js +1 -1
- package/dist/src/snapshot-state.js +1 -1
- package/dist/src/snapshot.js +1 -1
- package/dist/src/snapshot2.js +1 -1
- package/dist/src/snapshot3.js +1 -1
- package/dist/src/src.js +5 -1
- package/dist/src/src2.js +1 -1
- package/dist/src/src3.js +2 -1
- package/dist/src/store.js +1 -1
- package/dist/src/surface-snapshot2.js +1 -1
- package/dist/src/target-evidence-tree.js +1 -0
- package/dist/src/target-evidence.js +1 -1
- package/dist/src/text-entry-focus.js +1 -1
- package/dist/src/tool-provider2.js +1 -1
- package/dist/src/touch-runtime.js +1 -1
- package/dist/src/touch-runtime2.js +1 -1
- package/dist/src/tree.js +1 -1
- package/dist/src/tv-remote.js +1 -1
- package/dist/src/type-text-runtime.js +1 -1
- package/dist/src/undici.js +8 -8
- package/dist/src/update-check.js +1 -1
- package/dist/src/vars.js +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/video.js +2 -2
- package/dist/src/wait.js +1 -0
- package/dist/src/web.js +1 -1
- package/dist/src/web2.js +1 -1
- package/package.json +22 -19
- package/server.json +2 -2
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.23.apk.sha256 +0 -1
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.23.apk +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.23.apk.sha256 +0 -1
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.23.manifest.json +0 -16
- package/dist/src/adb-transport.js +0 -1
- package/dist/src/alert-runtime.js +0 -1
- package/dist/src/app-deployment-resolution.js +0 -2
- package/dist/src/app-inventory-contract.js +0 -1
- package/dist/src/app-log-session-resource.js +0 -1
- package/dist/src/application-lifecycle-runtime.js +0 -1
- package/dist/src/auth-session.js +0 -1
- package/dist/src/cache.js +0 -1
- package/dist/src/capabilities.js +0 -1
- package/dist/src/capture.js +0 -1
- package/dist/src/catalog.js +0 -1
- package/dist/src/click-button.js +0 -1
- package/dist/src/client-metro-companion.js +0 -1
- package/dist/src/client-options.js +0 -3
- package/dist/src/compatibility-policy.js +0 -1
- package/dist/src/daemon-artifacts.js +0 -1
- package/dist/src/daemon-client-transport.js +0 -1
- package/dist/src/daemon-http.js +0 -1
- package/dist/src/device-claim-rule.js +0 -1
- package/dist/src/device-rotation.js +0 -1
- package/dist/src/device-session.js +0 -3
- package/dist/src/device2.js +0 -1
- package/dist/src/device3.js +0 -3
- package/dist/src/dispatch-resolve.js +0 -4
- package/dist/src/format.js +0 -1
- package/dist/src/gesture-plan-types.js +0 -1
- package/dist/src/host.js +0 -1
- package/dist/src/human-control-contract.js +0 -1
- package/dist/src/interaction-ref-policy.js +0 -1
- package/dist/src/interactor-operation-binding.js +0 -1
- package/dist/src/keyboard-actions.js +0 -1
- package/dist/src/lease-context.js +0 -1
- package/dist/src/lease-registry-scope.js +0 -1
- package/dist/src/lease-scope.js +0 -1
- package/dist/src/managed-device-scope.js +0 -1
- package/dist/src/observe-until.js +0 -1
- package/dist/src/output-common.js +0 -5
- package/dist/src/owner-identity.js +0 -3
- package/dist/src/path-resolution.js +0 -1
- package/dist/src/perf-runtime-plan.js +0 -1
- package/dist/src/platform-runtime-app-log-process.js +0 -1
- package/dist/src/platform-runtime-managed-owner.js +0 -1
- package/dist/src/platform-runtime-screen-recording-process-host.js +0 -1
- package/dist/src/png.js +0 -1
- package/dist/src/prepare-kind.js +0 -1
- package/dist/src/provider-device-runtimes.js +0 -1
- package/dist/src/provider-session-ownership.js +0 -2
- package/dist/src/providers.js +0 -1
- package/dist/src/registry.js +0 -68
- package/dist/src/request-admission.js +0 -1
- package/dist/src/request-cancellation.js +0 -1
- package/dist/src/request-progress-protocol.js +0 -1
- package/dist/src/runner-cache-metadata.js +0 -3
- package/dist/src/runner-disposal.js +0 -1
- package/dist/src/runner-session-types.js +0 -1
- package/dist/src/runtime-admission.js +0 -1
- package/dist/src/screen-recording-admission-ledger.js +0 -1
- package/dist/src/screen-recording-resource-recovery.js +0 -1
- package/dist/src/screenshot-result.js +0 -1
- package/dist/src/script.js +0 -1
- package/dist/src/scroll-command.js +0 -1
- package/dist/src/scroll-gesture.js +0 -1
- package/dist/src/scroll-indicator.js +0 -1
- package/dist/src/session-artifact-paths.js +0 -1
- package/dist/src/session-paths.js +0 -1
- package/dist/src/session-repair-tombstone.js +0 -1
- package/dist/src/session-routing.js +0 -1
- package/dist/src/session-snapshot.js +0 -1
- package/dist/src/snapshot4.js +0 -1
- package/dist/src/src4.js +0 -1
- package/dist/src/src5.js +0 -1
- package/dist/src/src6.js +0 -1
- package/dist/src/src7.js +0 -2
- package/dist/src/src8.js +0 -115
- package/dist/src/string-enum.js +0 -1
- package/dist/src/success-text.js +0 -1
- package/dist/src/timeouts.js +0 -1
- package/dist/src/touch-reference-frame.js +0 -1
- package/dist/src/transport.js +0 -3
- package/dist/src/ttl-memo.js +0 -1
- package/dist/src/verified-file.js +0 -1
- package/dist/src/viewport.js +0 -1
- package/dist/src/window-state.js +0 -1
- /package/dist/src/{doctor-output.js → doctor-lines.js} +0 -0
|
@@ -1 +1,73 @@
|
|
|
1
|
-
import{v as e}from"./sdk-batch.js";import{o as t}from"./registry.js";const n=t(),r=new Map(n.map(e=>[e.name,e]));function i(){return[...n]}function a(){return e().map(e=>{let t=s(e);if(!t)throw Error(`Missing command metadata for MCP-exposed command: ${e}`);return t})}function o(e){return r.has(e)}function s(e){return r.get(e)}export{a as i,o as n,i as r,s as t};
|
|
1
|
+
import{E as e,N as t,O as n,P as r,S as i,_ as a,k as o,m as s,n as c}from"./sdk-contracts.js";import{A as ee,B as te,K as ne,St as re,V as ie,X as ae,Y as oe,Z as se,b as ce,bt as le,c as ue,d as de,f as fe,lt as pe,n as me,p as he,pt as ge,q as _e,r as ve,s as ye,t as be,u as xe,ut as Se,vt as Ce,x as we,xt as Te,y as Ee,yt as De}from"./tv-remote.js";import{A as Oe,c as ke,d as Ae,f as je,h as Me,l as Ne,m as Pe,s as Fe,u as Ie,v as l}from"./sdk-batch-runner.js";import{$ as Le,E as u,M as Re,S as ze,T as Be,Z as Ve,at as He,bt as Ue,c as We,g as Ge,it as Ke,j as qe,k as Je,m as Ye,n as Xe,p as Ze,pt as Qe,rt as $e,t as et,ut as tt,x as nt}from"./back-mode.js";import{a as rt,i as it,n as at,t as ot}from"./sdk-device.js";import{Fn as st,Lr as ct,Mr as lt,Sr as ut,cn as dt,d as ft,dr as pt,gr as mt,h as ht,i as gt,jn as _t,kn as vt,lr as yt,m as bt,mr as xt,ni as St,on as Ct,s as wt,ur as Tt,v as Et}from"./sdk-batch.js";import{n as Dt}from"./recording-export-quality.js";import{t as Ot}from"./recording-scope.js";import{a as kt,i as At,r as jt}from"./vars.js";import{a as Mt}from"./sdk-remote-config.js";import{t as Nt}from"./session.js";import{a as Pt,c as Ft,d as It,f as Lt,g as Rt,h as zt,i as Bt,l as Vt,n as Ht,o as Ut,p as Wt,s as Gt,t as Kt,u as qt}from"./observability.js";import{t as Jt}from"./alert-contract.js";import{S as Yt,a as Xt,d as Zt,i as Qt,o as $t,s as en,t as tn,u as nn}from"./settings.js";import{t as rn}from"./location-coordinates.js";import{t as an}from"./snapshot-quality-backend-capabilities.js";import{t as on}from"./mobile-snapshot-semantics.js";import{t as sn}from"./absence-observation-errors.js";import{n as cn,t as ln}from"./interaction-positionals.js";import{t as un}from"./app-inventory.js";import"./overlay.js";import{F as dn,L as fn}from"./file.js";import pn from"node:fs";import d from"node:path";const mn=[`path`,`start`,`stop`,`doctor`,`mark`,`clear`],hn=new Set(nt().map(e=>e.key));function gn(e){let t=tt(e);return Oe({stateDir:e.stateDir,daemonBaseUrl:e.daemonBaseUrl,daemonTransport:e.daemonTransport,daemonServerMode:e.daemonServerMode,...Qe(t),provider:e.provider,providerSessionId:e.providerSessionId,providerApp:e.providerApp,providerOsVersion:e.providerOsVersion,providerDeviceType:e.providerDeviceType,providerProject:e.providerProject,providerBuild:e.providerBuild,providerSessionName:e.providerSessionName,providerDeviceOrientation:e.providerDeviceOrientation,providerGeoLocation:e.providerGeoLocation,providerTimezone:e.providerTimezone,providerAppiumVersion:e.providerAppiumVersion,providerLanguage:e.providerLanguage,providerLocale:e.providerLocale,providerNetworkProfile:e.providerNetworkProfile,providerCustomNetwork:e.providerCustomNetwork,providerNoResignApp:e.providerNoResignApp,awsProjectArn:e.awsProjectArn,awsDeviceArn:e.awsDeviceArn,awsAppArn:e.awsAppArn,awsRegion:e.awsRegion,awsInteractionMode:e.awsInteractionMode,sessionIsolation:e.sessionIsolation,platform:e.platform,target:e.target,device:e.device,udid:e.udid,serial:e.serial,iosSimulatorDeviceSet:e.iosSimulatorDeviceSet,iosXctestrunFile:e.iosXctestrunFile,iosXctestDerivedDataPath:e.iosXctestDerivedDataPath,iosXctestEnvDir:e.iosXctestEnvDir,androidDeviceAllowlist:e.androidDeviceAllowlist,surface:e.surface,activity:e.activity,launchConsole:e.launchConsole,launchArgs:e.launchArgs,relaunch:e.relaunch,shutdown:e.shutdown,saveScript:e.saveScript,testIme:e.testIme,noRecord:e.noRecord,recordAs:e.recordAs,record:e.record,backMode:e.backMode,metroHost:e.metroHost,metroPort:e.metroPort,bundleUrl:e.bundleUrl,launchUrl:e.launchUrl,...n(e,a),...Ce(e),appsFilter:e.appsFilter,kind:e.kind,out:e.out,count:e.count,fps:e.fps,quality:e.quality,hideTouches:e.hideTouches,recordingScope:e.recordingScope,intervalMs:e.intervalMs,delayMs:e.delayMs,durationMs:e.durationMs,holdMs:e.holdMs,jitterPx:e.jitterPx,readinessTimeoutMs:e.readinessTimeoutMs,pixels:e.pixels,until:e.until,doubleTap:e.doubleTap,verify:e.verify,settle:e.settle,settleQuietMs:e.settleQuietMs,clickButton:e.clickButton,pauseMs:e.pauseMs,pattern:e.pattern,headless:e.headless,restart:e.restart,replayUpdate:e.replayUpdate,replayBackend:e.replayBackend,replayEnv:e.replayEnv,replayShellEnv:e.replayShellEnv,replayScriptSource:e.replayScriptSource,replayScriptSources:e.replayScriptSources,replayFrom:e.replayFrom,replayPlanDigest:e.replayPlanDigest,replayKeepSession:e.replayKeepSession,failFast:e.failFast,timeoutMs:e.timeoutMs,retries:e.retries,recordVideo:e.recordVideo,artifactsDir:e.artifactsDir,shardAll:e.shardAll,shardSplit:e.shardSplit,findFirst:e.findFirst,findLast:e.findLast,networkInclude:e.networkInclude,batchOnError:e.batchOnError,batchMaxSteps:e.batchMaxSteps,batchSteps:e.batchSteps,verbose:e.debug})}function _n(e,t){return{...gn(e),...t}}function vn(e,t){let n=e.inputSchema.properties;if(!n)return{};let r={},i=t;for(let e of Object.keys(n)){if(!hn.has(e))continue;let t=i[e];yn(t)&&(r[e]=t)}return r}function yn(e){return typeof e==`boolean`||typeof e==`number`||typeof e==`string`}function bn(e){return{kind:`operator`,source:e}}function xn(e,t){return`${e} is not accepted as a tool argument. ${Sn(e,t)}`}function Sn(e,t){if(`operatorPath`in t)return t.operatorPath;let n=`for the process serving these tools.`,r=(t.envFlagKeys??[e]).map(Mt).join(` or `);return r===``?`Set ${e} in ~/.agent-device/config.json ${n}`:`Set the ${r} environment variable${t.operatorConfig?` (or ${e} in ~/.agent-device/config.json)`:``} ${n}`}function Cn(e){if(e==null)return{};if(!e||typeof e!=`object`||Array.isArray(e))throw new r(`INVALID_ARGS`,`Expected object arguments.`);return e}function wn(e,t){let n=e[t];if(!n||typeof n!=`object`||Array.isArray(n))throw new r(`INVALID_ARGS`,`Expected ${t} to be an object.`);return n}function Tn(e,t){let n=e[t];if(typeof n!=`string`||n.length===0)throw new r(`INVALID_ARGS`,`Expected ${t} to be a non-empty string.`);return n}function En(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`string`)throw new r(`INVALID_ARGS`,`Expected ${t} to be a string.`);return n}}function f(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`string`||n.length===0)throw new r(`INVALID_ARGS`,`Expected ${t} to be a non-empty string.`);return n}}function Dn(e,t){let n=e[t];if(typeof n!=`number`||!Number.isFinite(n))throw new r(`INVALID_ARGS`,`Expected ${t} to be a finite number.`);return n}function On(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`boolean`)throw new r(`INVALID_ARGS`,`Expected ${t} to be a boolean.`);return n}}function kn(e,t,n){let i=e[t];if(typeof i!=`string`||!n.includes(i))throw new r(`INVALID_ARGS`,`Expected ${t} to be one of: ${n.join(`, `)}.`);return i}function An(e,t,n){let i=e[t];if(i!==void 0){if(typeof i!=`string`||!n.includes(i))throw new r(`INVALID_ARGS`,`Expected ${t} to be one of: ${n.join(`, `)}.`);return i}}function jn(e,t){let n=e[t];if(n!==void 0){if(!n||typeof n!=`object`||Array.isArray(n))throw new r(`INVALID_ARGS`,`Expected ${t} to be an object.`);return n}}function Mn(e,t){let n=e[t];if(n!==void 0){if(!Array.isArray(n)||n.some(e=>typeof e!=`string`))throw new r(`INVALID_ARGS`,`Expected ${t} to be an array of strings.`);return n}}function Nn(e,t,n,i){let a=new Set(t),o=Object.keys(e).filter(e=>!a.has(e));if(o.length>0)throw new r(`INVALID_ARGS`,`${n} has unknown field(s): ${o.join(`, `)}.`,i===void 0?void 0:{hint:i})}function p(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}const Pn=bn({operatorConfig:!0}),Fn={session:{schema:{type:`string`,description:`Agent-device session name.`},read:e=>f(e,`session`),flagKey:`session`,flagIn:[`input`]},platform:{schema:{type:`string`,enum:it,description:`Platform selector used to resolve a device.`},read:e=>An(e,`platform`,it),flagKey:`platform`,flagIn:[`input`,`selection`]},deviceTarget:{schema:{type:`string`,enum:at,description:`Device target form. Maps to the CLI --target flag.`},read:Vn,clientKey:`target`,flagKey:`target`,flagIn:[`input`,`selection`]},target:{schema:{type:`string`,enum:at,description:`Alias for deviceTarget on commands without a UI target field. Interaction commands reserve target for the UI element.`}},device:{schema:{type:`string`,description:`Device name selector (a UDID belongs in udid, a serial in serial).`},read:e=>f(e,`device`),flagKey:`device`,flagIn:[`input`,`selection`]},udid:{schema:{type:`string`,description:`Apple device or simulator UDID; the selector that pins one device when several share a name.`},read:e=>f(e,`udid`),flagKey:`udid`,flagIn:[`input`,`selection`]},serial:{schema:{type:`string`,description:`Android, HarmonyOS, or Vega VVD serial selector.`},read:e=>f(e,`serial`),flagKey:`serial`,flagIn:[`input`,`selection`]},iosSimulatorDeviceSet:{schema:{type:`string`,description:`iOS simulator device-set path used for device resolution.`},read:e=>f(e,`iosSimulatorDeviceSet`),audience:bn({envFlagKeys:[],operatorConfig:!0}),flagKey:`iosSimulatorDeviceSet`,flagIn:[`input`,`selection`]},iosXctestrunFile:{schema:{type:`string`,description:`Externally built iOS XCTest runner .xctestrun artifact path. Build it with the same agent-device version.`},read:e=>f(e,`iosXctestrunFile`),audience:Pn,flagKey:`iosXctestrunFile`,flagIn:[`input`]},iosXctestDerivedDataPath:{schema:{type:`string`,description:`Derived data path for external iOS XCTest runner execution.`},read:e=>f(e,`iosXctestDerivedDataPath`),audience:Pn,flagKey:`iosXctestDerivedDataPath`,flagIn:[`input`]},iosXctestEnvDir:{schema:{type:`string`,description:`Writable directory for iOS XCTest runner env overlays.`},read:e=>f(e,`iosXctestEnvDir`),audience:Pn,flagKey:`iosXctestEnvDir`,flagIn:[`input`]},androidDeviceAllowlist:{schema:{type:`string`,description:`Android serial allowlist used for device resolution.`},read:e=>f(e,`androidDeviceAllowlist`),flagKey:`androidDeviceAllowlist`,flagIn:[`input`,`selection`]},noRecord:{read:e=>On(e,`noRecord`),flagKey:`noRecord`,flagIn:[`input`,`selection`]},readinessTimeoutMs:{read:Hn},daemonBaseUrl:{schema:{type:`string`,description:`Remote daemon base URL.`},read:e=>f(e,`daemonBaseUrl`),audience:Pn},daemonAuthToken:{schema:{type:`string`,description:`Remote daemon auth token.`},read:e=>f(e,`daemonAuthToken`),audience:Pn},tenant:{schema:{type:`string`,description:`Remote tenant identifier.`},read:e=>f(e,`tenant`)},runId:{schema:{type:`string`,description:`Lease run identifier.`},read:e=>f(e,`runId`)},leaseId:{schema:{type:`string`,description:`Existing lease identifier.`},read:e=>f(e,`leaseId`)},cwd:{schema:{type:`string`,description:`Working directory for command execution.`},read:e=>f(e,`cwd`),audience:bn({operatorPath:`Start the process serving these tools in the desired working directory, or pass absolute paths.`})},debug:{schema:{type:`boolean`,description:`Enable debug diagnostics.`},read:e=>On(e,`debug`)}},In=Object.entries(Fn),Ln=Object.fromEntries(In.flatMap(([e,t])=>t.audience?[[e,t.audience]]:[]));function Rn(){return Object.fromEntries(In.flatMap(([e,t])=>t.schema?[[e,t.schema]]:[]))}function zn(e,t={}){let n={};for(let[r,i]of In)i.read&&(n[r]=i.read(e,t));return n}function m(e){let t={};for(let[n,r]of In)r.read&&(t[r.clientKey??n]=e[n]);return p(t)}function Bn(e,t){let n={};for(let[r,i]of In){if(i.flagIn===void 0||!i.flagIn.includes(t))continue;let a=t===`selection`?i.clientKey??r:r;n[a]=e[i.flagKey]}return n}function Vn(e,t){let n=An(e,`deviceTarget`,at);if(t.readTargetAlias===!1||e.target===void 0)return n;let i=An(e,`target`,at);if(n!==void 0&&i!==n)throw new r(`INVALID_ARGS`,`Expected target alias to match deviceTarget when both are set.`);return n??i}function Hn(e,t){if(!(t.readinessBudgetDeclared===!0||!Object.hasOwn(e,`readinessTimeoutMs`)))throw new r(`INVALID_ARGS`,`readinessTimeoutMs applies only to commands that wait for their target: press, click, and longpress.`)}function h(e,t){return n=>g(e,t?t(n):[],n)}function g(e,t,n,r){return{command:e,positionals:t,...r?{input:r}:{},options:Un(n)}}function Un(e){let t=Wn(e.deviceTarget??e.target);if(t===void 0&&e.target===void 0)return e;let{target:n,...r}=e;return t===void 0?r:{...r,target:t}}function Wn(e){return e===`mobile`||e===`tv`||e===`desktop`?e:void 0}function _(e){return p(Bn(e,`input`))}function Gn(e){return p({record:e.record})}function Kn(e){return Bn(e,`selection`)}function qn(e){return p({depth:e.snapshotDepth,scope:e.snapshotScope,raw:e.snapshotRaw})}function Jn(e){return{depth:e.snapshotDepth,scope:e.snapshotScope,raw:e.snapshotRaw}}function Yn(e){return p({settle:e.settle,settleQuietMs:e.settleQuietMs,timeoutMs:e.timeoutMs})}function Xn(e){return p({count:e.count,intervalMs:e.intervalMs,holdMs:e.holdMs,jitterPx:e.jitterPx,doubleTap:e.doubleTap})}function Zn(e){if(`ref`in e&&e.ref!==void 0)return p({kind:`ref`,ref:e.ref,label:e.label});if(`selector`in e&&e.selector!==void 0)return{kind:`selector`,selector:e.selector};let t=e;return{kind:`point`,x:t.x,y:t.y}}function Qn(e){let t=er(e);if(typeof t.ref==`string`)return[t.ref,...nr(t.label)];if(typeof t.selector==`string`)return[t.selector];if(t.kind===`point`||t.x!==void 0||t.y!==void 0)return[String(tr(t.x,`x`)),String(tr(t.y,`y`))];throw new r(`INVALID_ARGS`,`interaction requires @ref, selector, or point target`)}function $n(e){let t=er(e);if(typeof t.ref==`string`)return[t.ref,...nr(t.label)];if(typeof t.selector==`string`)return[t.selector];throw new r(`INVALID_ARGS`,`element command requires @ref or selector target`)}function er(e){if(!e||typeof e!=`object`||Array.isArray(e))throw new r(`INVALID_ARGS`,`Expected target object.`);let t=e,n=t.target;return n&&typeof n==`object`&&!Array.isArray(n)?n:t}function tr(e,t){if(typeof e!=`number`||!Number.isFinite(e))throw new r(`INVALID_ARGS`,`point target requires numeric ${t}.`);return e}function nr(e){return typeof e==`string`&&e.length>0?[e]:[]}function rr(e){let t=Tt(e);if(!t.ok)throw new r(t.code,t.message);return`ref`in t?{ref:t.ref,label:sr(e.slice(1))}:{selector:t.selector}}function ir(e){let t=pt(e);if(!t.ok)throw new r(t.code,t.message);return t.format}function ar(e,t={}){let n=ut(e,t);if(!n)throw new r(`INVALID_ARGS`,yt);return n}function or(e,t){try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t}catch{}throw new r(`INVALID_ARGS`,`${t} must be a JSON object`)}function sr(e){return e.join(` `).trim()||void 0}function v(...e){return new Set(e)}function y(e,t){return e!==void 0&&t.has(e)}function cr(e){return e===void 0||e.trim()===``?!1:Number.isFinite(Number(e))}function lr(e,t){if(e===void 0)return;let n=Number(e);if(Number.isFinite(n))return n;throw new r(`INVALID_ARGS`,`${t} must be a finite number.`)}function ur(e){return e===void 0?void 0:Number(e)}function b(e){return e===void 0?[]:[e]}function x(e){return e===void 0?[]:[String(e)]}function S(e,t){if(e===void 0||e===``)throw new r(`INVALID_ARGS`,t);return e}function C(e,t){if(typeof e!=`string`||e.length===0)throw new r(`INVALID_ARGS`,t);return e}function dr(e){return mr(e.description,e.cliDetail)}function fr(e){return mr(e.description,e.mcpDetail)}function pr(e,t){return{...e,description:t}}function mr(e,t){return t?`${e} ${t}`:e}function hr(e){return e}const gr=[`ref`,`selector`,`point`];function _r(e,t=[]){return{type:`object`,properties:{...Rn(),...e},...t.length>0?{required:t}:{},additionalProperties:!1}}function w(e,t=[],n){return{type:`object`,...n?{description:n}:{},properties:e,...t.length>0?{required:t}:{}}}function vr(e){return{type:`object`,description:e,properties:{x:{type:`number`},y:{type:`number`}},required:[`x`,`y`],additionalProperties:!1}}function T(e,t){return{type:`string`,enum:e,...t?{description:t}:{}}}function E(e){return{type:`string`,const:e}}function D(e){return{type:`string`,...e?{description:e}:{}}}function yr(e){return{type:[`string`,`null`],...e?{description:e}:{}}}function O(e,t={}){return{type:`number`,...e?{description:e}:{},...t.min===void 0?{}:{minimum:t.min},...t.max===void 0?{}:{maximum:t.max}}}function br(e){return{type:`integer`,...e?{description:e}:{}}}function k(e){return{type:`boolean`,...e?{description:e}:{}}}function xr(e){return{type:`array`,items:{type:`string`},...e?{description:e}:{}}}function A(e){return{type:`object`,additionalProperties:!0,...e?{description:e}:{}}}function j(e){return{...e,required:!0}}function M(e,t={}){return R(D(e),t.allowEmpty===!0?En:f)}function Sr(e){return{schema:{type:`null`},required:!1,audience:{kind:`retired`,message:e},read:(t,n)=>{if(Object.hasOwn(t,n))throw new r(`INVALID_ARGS`,e)}}}function Cr(e,t){return{...e,audience:{kind:`operator`,source:t}}}function N(e,t={}){return R(O(e,t),(e,n)=>Me(e,n,t))}function P(e,t={}){return R(Gr(e,t),(e,n)=>Pe(e,n,t))}function F(e){return R(k(e),On)}function wr(e){return Er(Tr(e))}function Tr(e){let[t,...n]=ze(e).filter(e=>e.inputDescription!==void 0);if(!t)throw Error(`Flag ${e} declares no inputDescription; optionField cannot derive a field`);if(n.length>0)throw Error(`Flag ${e} declares inputDescription more than once`);return t}function Er(e){let t=e.inputDescription,n={min:e.min,max:e.max};switch(e.type){case`boolean`:return F(t);case`int`:return P(t,n);case`number`:return N(t,n);case`string`:return M(t);case`enum`:return I(Dr(e),t);case`booleanOrString`:throw Error(`Flag ${e.key} is booleanOrString; declare its field shape explicitly with jsonSchemaField`)}}function Dr(e){let t=e.enumValues;if(!t)throw Error(`Flag ${e.key} is an enum with no enumValues`);return t}function I(e,t){return R(T(e,t),(t,n)=>An(t,n,e))}function Or(e){return R(A(e),jn)}function kr(e){return R(xr(e),Mn)}function L(e){return R(e,(e,t)=>e[t])}function Ar(e,t){return R(e,t)}function jr(){return R(Yr(),(e,t)=>e[t]===void 0?void 0:Rr(e,t))}function Mr(){return R(Xr(),(e,t)=>e[t]===void 0?void 0:zr(e,t))}function Nr(e){return R(vr(e),(e,t)=>e[t]===void 0?void 0:Br(e,t))}function Pr(){return{depth:P(`Snapshot traversal depth.`,{min:0}),scope:M(`Snapshot scope selector used before resolution.`),raw:F(`Use raw snapshot data during selector resolution.`)}}function Fr(){return{count:P(`Number of press/click repetitions.`,{min:1}),intervalMs:P(`Delay between repeated press/click actions.`,{min:0}),holdMs:P(`Hold duration for each action.`,{min:0}),jitterPx:P(`Randomization radius in pixels.`,{min:0}),doubleTap:F(`Request a double-tap action.`)}}function Ir(e){return _r(Kr(e),qr(e))}function Lr(e,t){let n=Cn(e),i=Object.fromEntries(Object.entries(t).flatMap(([e,t])=>{let i=t.read(n,e);if(t.required&&i===void 0)throw new r(`INVALID_ARGS`,`Expected ${e} to be set.`);return i===void 0?[]:[[e,i]]})),a=zn(n,{readTargetAlias:!Object.hasOwn(t,`target`),readinessBudgetDeclared:Object.hasOwn(t,`readinessTimeoutMs`)});return p({...a,...m(a),...i})}function Rr(e,t){let n=wn(e,t),r=kn(n,`kind`,gr);switch(r){case`ref`:return{kind:r,ref:Tn(n,`ref`),label:f(n,`label`)};case`selector`:return{kind:r,selector:Tn(n,`selector`)};case`point`:return{kind:r,x:Dn(n,`x`),y:Dn(n,`y`)}}}function zr(e,t){let n=wn(e,t),r=kn(n,`kind`,[`ref`,`selector`]);return r===`ref`?{kind:r,ref:Tn(n,`ref`),label:f(n,`label`)}:{kind:r,selector:Tn(n,`selector`)}}function Br(e,t){let n=wn(e,t);return{x:Dn(n,`x`),y:Dn(n,`y`)}}function Vr(e){switch(e.kind){case`ref`:return{ref:e.ref,label:e.label};case`selector`:return{selector:e.selector};case`point`:return{x:e.x,y:e.y}}}function Hr(e){switch(e.kind){case`ref`:return{ref:e.ref,label:e.label};case`selector`:return{selector:e.selector}}}function Ur(e){return{count:e.count,intervalMs:e.intervalMs,holdMs:e.holdMs,jitterPx:e.jitterPx,doubleTap:e.doubleTap}}function Wr(e){return{depth:e.depth,scope:e.scope,raw:e.raw}}function R(e,t){return{schema:e,required:!1,read:t}}function Gr(e,t){return{...br(e),...t.min===void 0?{}:{minimum:t.min},...t.max===void 0?{}:{maximum:t.max}}}function Kr(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e.audience?.kind!==`retired`).map(([e,t])=>[e,t.schema]))}function qr(e){return Object.entries(e).flatMap(([e,t])=>t.required?[e]:[])}function Jr(e){return Object.fromEntries(Object.entries(e).flatMap(([e,t])=>t.audience?[[e,t.audience]]:[]))}function Yr(){return{oneOf:[...Zr(),{type:`object`,properties:{kind:{type:`string`,const:`point`},x:{type:`number`},y:{type:`number`}},required:[`kind`,`x`,`y`],additionalProperties:!1}],description:`UI target. This is separate from deviceTarget, which selects the device form.`}}function Xr(){return{oneOf:Zr(),description:`UI element target by snapshot ref or selector expression.`}}function Zr(){return[{type:`object`,properties:{kind:{type:`string`,const:`ref`},ref:{type:`string`,description:`Snapshot element ref such as @e12.`},label:{type:`string`,description:`Optional human label for the ref.`}},required:[`kind`,`ref`],additionalProperties:!1},{type:`object`,properties:{kind:{type:`string`,const:`selector`},selector:{type:`string`,description:`Agent-device selector expression.`}},required:[`kind`,`selector`],additionalProperties:!1}]}function z(e,t,n,r){return hr({name:e,description:t,inputSchema:Ir(n),readInput:r?.readInput??(e=>Lr(e,n)),inputAudience:Jr(n),...r?.parseableOutput?{parseableOutput:!0}:{}})}function B(e){let t=pr(e.text,e.metadata.description),n=t.mcpDetail?{mcpDetail:t.mcpDetail}:{},r={...e.metadata,...n},i={name:r.name,description:r.description,inputSchema:r.inputSchema,...n,invoke:async(t,n)=>await e.run(t,r.readInput(n))};return{name:e.name,metadata:r,definition:i,cliSchema:{...e.cliSchema,text:t},cliReader:e.cliReader,daemonWriter:e.daemonWriter,cliOutputFormatter:e.cliOutputFormatter,text:t}}function Qr(e){return B({name:e.name,text:e.text,metadata:z(e.name,e.description,{}),run:e.run,cliSchema:{},cliReader:(e,t)=>_(t),daemonWriter:h(e.name),cliOutputFormatter:e.cliOutputFormatter})}function V(e){let t={},n={},r={},i={};for(let a of e.commands)$r(t,`CLI schema`,a.name,a.cliSchema),$r(n,`CLI reader`,a.name,a.cliReader),a.daemonWriter&&$r(r,`daemon writer`,a.name,a.daemonWriter),a.cliOutputFormatter&&$r(i,`CLI output formatter`,a.name,a.cliOutputFormatter);return{name:e.name,clientSurface:e.clientSurface,metadata:e.commands.map(e=>e.metadata),definitions:e.commands.map(e=>e.definition),cliSchemas:t,cliReaders:n,daemonWriters:r,cliOutputFormatters:i}}function $r(e,t,n,r){if(Object.hasOwn(e,n))throw Error(`Duplicate command family ${t}: ${n}`);e[n]=r}function H(e){return({result:t})=>e(t)}const U=H(ei);function ei(e){return{data:e,text:te(e)}}function ti(e){return[...typeof e.warning==`string`&&e.warning.trim()!==``?[e.warning]:[],...ie(e)].map(e=>ii(e)).filter(e=>e.length>0)}function ni(e,t){let n=e??``,r=ti(t).filter(e=>!n.includes(e)).map(e=>`Warning: ${e}`);return r.length===0?e??null:[...n===``?[]:[n],...r].join(`
|
|
2
|
+
`)}function ri(e,t,n){let r=t??{};if(n===`text`)return{...e,text:ni(e.text,r)};let i=`${e.text??``}\n${e.stderr??``}`,a=ti(r).filter(e=>!i.includes(e)).map(e=>`Warning: ${e}`);if(a.length===0)return e;let o=e.stderr??``;return{...e,stderr:`${o}${o===``||o.endsWith(`
|
|
3
|
+
`)?``:`
|
|
4
|
+
`}${a.join(`
|
|
5
|
+
`)}\n`}}function ii(e){return e.replaceAll(/\s*\n\s*/g,` `)}function ai(e,t){if(typeof e==`string`&&e.length!==0&&typeof t==`number`)return`@${e.startsWith(`@`)?e.slice(1):e}~s${t}`}function oi(e){let t=[`Batch completed: ${e.executed}/${e.total} steps in ${e.totalDurationMs}ms`];for(let n of e.results)t.push(ci(n));return{data:e,text:t.join(`
|
|
6
|
+
`)}}const si={batch:H(oi)};function ci(e){let t=te(e.data)??e.command;return`${e.step}. OK ${t} (${e.durationMs}ms)`}function li(e=gt){let t=ui(e);return z(`batch`,`Execute multiple commands in one daemon request.`,t,{readInput:e=>fi(e,t)})}function ui(e){return{steps:j(Ar({type:`array`,description:`Structured batch steps. Each step uses a command name and the same input object as that command tool.`,items:di(e)},(t,n)=>pi(t[n],e))),onError:I([`stop`],`Batch failure policy.`),maxSteps:P(`Maximum number of steps accepted for this batch.`,{min:1,max:1e3}),out:M(`Optional output path for command artifacts.`)}}function di(e){return{type:`object`,properties:{command:{type:`string`,enum:e,description:`Command name to run with structured input.`},input:{type:`object`,additionalProperties:!0,commandInputFor:`command`,description:`Structured command input for the nested command. Use the matching MCP tool schema for this object.`},runtime:{type:`object`,additionalProperties:!0,description:`Optional per-step runtime payload.`}},required:[`command`,`input`],additionalProperties:!1}}function fi(e,t){let n=Lr(e,t),i=n.maxSteps??100;if(!Ne(i))throw new r(`INVALID_ARGS`,`Invalid batch maxSteps: ${String(n.maxSteps)}`);return ke(n.steps.length,i),{...n}}function pi(e,t){if(!Array.isArray(e))throw new r(`INVALID_ARGS`,`Expected steps to be an array.`);return e.map((e,n)=>mi(e,n+1,t))}function mi(e,t,n){let r=je(e,t);return Nn(r,[`command`,`input`,`runtime`],`Batch step ${t}`,Fe),{command:hi(r,t,n),input:Ae(r,t),...gi(r,t)}}function hi(e,t,n){if(n===gt)return wt(e.command,t);let i=e.command;if(typeof i!=`string`||!n.includes(i))throw new r(`INVALID_ARGS`,`Expected command to be one of: ${n.join(`, `)}.`);return i}function gi(e,t){let n=Ie(e.runtime,t);return n===void 0?{}:{runtime:n}}function _i(e){return async t=>g(u.batch,[],{...t,batchSteps:await vi(t.steps,e),batchOnError:t.onError,batchMaxSteps:t.maxSteps})}async function vi(e,t){if(!Array.isArray(e)||e.length===0)throw new r(`INVALID_ARGS`,`batch requires a non-empty steps array.`);let n=[];for(let[r,i]of e.entries())n.push(await yi(i,r+1,t));return n}async function yi(e,t,n){let r=je(e,t),i=xi(r,t),a=Ae(r,t);bi(i,a,t);let o=Ie(r.runtime,t),s=await n(i,a,t);return{command:s.command,positionals:s.positionals,...s.input?{input:s.input}:{},flags:_n(s.options,s.metadataFlags),runtime:o??s.options.runtime}}function bi(e,t,n){if(e===u.fill&&t.textStdin===!0)throw new r(`INVALID_ARGS`,`Batch step ${n}: fill textStdin is not supported because batch steps have no stdin of their own. Run that fill on its own with --text-stdin.`,{reason:`fill_text_stdin_in_batch`})}function xi(e,t){return wt(e.command,t)}const Si=li(),Ci={usageOverride:`batch [--steps <json> | --steps-file <path>]`,usageFlags:[],listUsageOverride:`batch --steps <json> | --steps-file <path>`,allowedFlags:[`steps`,`stepsFile`,`batchOnError`,`batchMaxSteps`,`out`]},wi=(e,t)=>({..._(t),steps:t.batchSteps??[],onError:t.batchOnError,maxSteps:t.batchMaxSteps,out:t.out}),Ti=[{command:`snapshot`,input:{interactiveOnly:!0}},{command:`press`,input:{target:{kind:`ref`,ref:`@e12`},settle:!0}},{command:`fill`,input:{target:{kind:`selector`,selector:`id="field-email"`},text:`qa@example.com`}}];function Ei(){return`${[`Each step is {"command":"<name>","input":{...}}, and input is that command's structured input object rather than its terminal spelling: a CLI positional becomes a named field (target, text, direction) and a CLI flag becomes a camelCase key (--settle -> "settle":true, -i -> "interactiveOnly":true). There is no positional step form; args, argv, positionals, and flags are not step fields. agent-device help <command> lists arguments in CLI spelling only. The examples below carry the structured spelling; over MCP, the command tool schema states it in full.`,`Steps run serially in one daemon request against the same session, in order. Mutating UI verbs are included (press, click, fill, longpress, scroll, back), which is where the round-trip saving is; --on-error stop halts at the first failing step.`,`Available through batch: ${[...gt].sort().join(`, `)}.`,`Every other command is excluded: batch and replay never nest, and session, daemon, connection, and host tooling commands own lifecycle a batch request cannot carry. Run those on their own.`].join(` `)}\n\nExamples:\n${[` agent-device batch --steps '${JSON.stringify(Ti)}'`,` agent-device batch --steps-file ./steps.json --json`].join(`
|
|
7
|
+
`)}`}const Di=V({name:`batch`,clientSurface:!1,commands:[B({name:`batch`,text:{summary:`Run multiple commands`,cliDetail:Ei()},metadata:Si,run:(e,t)=>e.batch.run(Oi(t)),cliSchema:Ci,cliReader:wi,cliOutputFormatter:si.batch})]});function Oi(e){return{...m(e),steps:e.steps,onError:e.onError,maxSteps:e.maxSteps,out:e.out}}const ki=`alert`,Ai=B({name:ki,text:{summary:`Inspect, accept, or dismiss a platform alert`},metadata:z(ki,`Inspect, wait for, accept, or dismiss a platform alert. Use get before acting when the alert content matters; accept and dismiss change the active alert state. Each iOS XCTest execution activates once, then only observes. Inspect again after an unconfirmed action; never assume a timeout means nothing happened.`,{action:I(Jt),timeoutMs:P()}),run:(e,t)=>e.command.alert(t),cliSchema:{usageOverride:`alert [get|accept|dismiss|wait] [timeout]`,positionalArgs:[`action?`,`timeout?`]},cliReader:(e,t)=>({..._(t),...Mi(e)}),daemonWriter:h(u.alert,e=>ji(e)),cliOutputFormatter:U});function ji(e){return[e.action??`get`,...x(e.timeoutMs)]}function Mi(e){if(e.length>2)throw new r(`INVALID_ARGS`,`alert accepts at most action and timeout arguments.`);return p({action:Ni(e[0]),timeoutMs:lr(e[1],`alert timeout`)})}function Ni(e){let t=e?.toLowerCase();if(t===void 0||t===`get`||t===`accept`||t===`dismiss`||t===`wait`)return t;throw new r(`INVALID_ARGS`,`alert action must be get, accept, dismiss, or wait.`)}function W(...e){return e}const Pi=W(`keyframes`),Fi=W(`snapshotInteractiveOnly`,`snapshotDepth`,`snapshotScope`,`snapshotRaw`),Ii=W(`snapshotDepth`,`snapshotScope`,`snapshotRaw`),Li=W(`metroProjectRoot`,`kind`,`metroKind`,`metroPublicBaseUrl`,`metroProxyBaseUrl`,`metroBearerToken`,`metroPreparePort`,`metroListenHost`,`metroStatusHost`,`metroStartupTimeoutMs`,`metroProbeTimeoutMs`,`metroRuntimeFile`,`metroNoReuseExisting`,`metroNoInstallDeps`),Ri=W(`metroHost`,`metroPort`,`bundleUrl`),zi=W(`count`,`intervalMs`,`holdMs`,`jitterPx`,`doubleTap`),Bi=W(`settle`,`settleQuietMs`,`timeoutMs`),Vi=W(`replayUpdate`,`replayEnv`),Hi=W(`remoteConfig`,`stateDir`,`daemonBaseUrl`,`daemonAuthToken`,`daemonTransport`,`daemonServerMode`,`tenant`,`sessionIsolation`,`runId`,`leaseId`,`leaseBackend`,`sessionLock`,`platform`,`target`,`device`,`providerApp`,`providerOsVersion`,`providerDeviceType`,`providerProject`,`providerBuild`,`providerSessionName`,`providerDeviceOrientation`,`providerGeoLocation`,`providerTimezone`,`providerAppiumVersion`,`providerLanguage`,`providerLocale`,`providerNetworkProfile`,`providerCustomNetwork`,`providerNoResignApp`,`awsProjectArn`,`awsDeviceArn`,`awsAppArn`,`awsRegion`,`awsInteractionMode`,`udid`,`serial`,`iosSimulatorDeviceSet`,`iosXctestrunFile`,`iosXctestDerivedDataPath`,`iosXctestEnvDir`,`androidDeviceAllowlist`,`session`,`noRecord`),Ui=new Set([`platform`,`device`,`udid`,`serial`,`session`]),Wi=new Set([`json`,`config`,`help`,`version`,`verbose`,`cost`,`responseLevel`]),Gi=`diff`,Ki={diff:w({mode:E(`snapshot`),baselineInitialized:k(),summary:w({additions:O(),removals:O(),unchanged:O()},[`additions`,`removals`,`unchanged`]),lines:{type:`array`,items:w({kind:T([`added`,`removed`,`unchanged`]),text:D(),ref:D()},[`kind`,`text`])},warnings:xr()},[`mode`,`baselineInitialized`,`summary`,`lines`])},qi=B({name:Gi,text:{summary:`Diff snapshot or screenshot`,cliDetail:`Screenshot --threshold is a per-pixel RGB tolerance: 0 requires exact colors and 1 ignores color differences; image dimensions must still match. Both screenshot inputs are decoded from their bytes, so a baseline or current image may be PNG or JPEG, and the diff image is always PNG. JPEG is lossy, so keep --threshold above 0 whenever either input is JPEG. Live iOS simulator screenshot diffs normalize status-bar chrome by default; use screenshot --normalize-status-bar when capturing reusable baselines.`},metadata:z(Gi,`Compare accessibility snapshots or screenshots to identify UI changes. Use snapshot comparisons for semantic tree changes and screenshot comparisons for pixel differences.`,{kind:j(L({type:`string`,const:`snapshot`})),out:M(),interactiveOnly:F(),depth:P(),scope:M(),raw:F()}),run:(e,t)=>e.capture.diff(t),cliSchema:{usageOverride:`diff snapshot | diff screenshot --baseline <path> [current.png] [--out <diff.png>] [--threshold <0-1>] [--overlay-refs]`,usageFlags:[],positionalArgs:[`kind`,`current?`],allowedFlags:[...Fi,`baseline`,`threshold`,`out`,`overlayRefs`]},cliReader:(e,t)=>{if(e[0]!==`snapshot`)throw new r(`INVALID_ARGS`,`Only diff snapshot is available through this parser.`);return{..._(t),kind:`snapshot`,out:t.out,interactiveOnly:t.snapshotInteractiveOnly,depth:t.snapshotDepth,scope:t.snapshotScope,raw:t.snapshotRaw}},daemonWriter:h(u.diff,e=>[C(e.kind,`diff requires kind`)])}),Ji=`screenshot`,Yi=B({name:Ji,text:{summary:`Capture a screenshot`,cliDetail:`Web defaults to the viewport; use --fullscreen, --full, or -f for the entire page. iOS simulators default to 1x logical-point output; use --pixel-density to request a different screenshot density. macOS app sessions default to the app window; use --fullscreen for full desktop, --scale to downscale, --crop-on <selector> to crop the capture to the frame the selector resolves on the same screen (currently iOS simulators and Android emulators), --overlay-refs to annotate current refs, --normalize-status-bar for deterministic iOS simulator chrome, or --no-stabilize for low-latency Android capture loops. On macOS, any --surface other than app (desktop, menubar, frontmost-app) always captures the main display and refuses an explicit --fullscreen. On single-display iOS simulators and Android devices, the result reports displayRotation, the rotation the display rendered the capture in, when the device returns a reading in time; otherwise the field is absent.`},metadata:z(Ji,`Capture a screenshot of the active app or web session. Choose the capture scope, density, size, or annotations through the corresponding input fields when needed.`,{path:M(`Output path.`),cropOn:M(`Selector expression; the capture is cropped to the frame the selector resolves on the same screen.`),overlayRefs:F(),pixelDensity:P(`Output screenshot pixel density in pixels per logical point.`,{min:1}),fullscreen:F(),scale:N(`Screenshot scale factor.`,ge),maxSize:Sr(pe.migration.screenshot),stabilize:F(),normalizeStatusBar:F(),surface:I(Nt)}),run:(e,t)=>e.capture.screenshot(t),cliSchema:{positionalArgs:[`path?`],allowedFlags:Se},cliReader:(e,t)=>({..._(t),path:e[0]??t.out,...le(t)}),daemonWriter:e=>(Te(`screenshot`,e),re(e),g(u.screenshot,b(e.path),{...e,...De(e)}))}),Xi=`settings`,Zi=z(Xi,`Read or change supported operating-system settings, animation scales, appearance, or app permissions on the selected target. Platform support varies by setting and action.`,{setting:j(M()),state:M(),app:M("App the change targets, by bundle id, package name, or app name: the app `clear-app-state` clears, or the app a `permission` change (or an iOS-simulator `location on|off` privacy change) lands on. A name resolves to the installed app as `open` resolves it (an iOS simulator matches display names and accepts only an installed bundle id, Android accepts only an installed package and matches other names against installed package names, and a Limrun iOS session resolves only the `settings` alias); an app that resolves to nothing is refused with `app_not_installed` before anything changes. An app named here needs no session and need not be running (Android `deny|reset` of a held permission does kill a running one); without it those changes use the session app, and a change that is device-wide refuses one with `setting_app_not_consumed` (`location set` on any target, the Android `location on|off` toggle, macOS permissions). The CLI consumes it only when this invocation passes it: an `AGENT_DEVICE_TARGET_APP` or config `targetApp` never retargets a settings mutation."),latitude:N(),longitude:N(),permission:M(),mode:I([...en])}),Qi={usageOverride:Zt,listUsageOverride:`settings [area] [options]`,positionalArgs:[`setting`,`state?`,`target?`,`mode?`],allowedFlags:[`targetApp`],explicitOnlyFlags:[`targetApp`]},$i=(e,t)=>{let n=ra(e,t);return n.setting===`clear-app-state`||t.targetApp===void 0?n:{...n,app:t.targetApp}},ea=e=>{let t=e,n=p({app:ta(t)});return g(u.settings,aa(t),e,Object.keys(n).length===0?void 0:n)};function ta(e){if(e.setting===`permission`||e.setting===`location`)return e.app}const na=B({name:Xi,text:{summary:`Change OS settings and app permissions`,cliDetail:`macOS supports only settings appearance <light|dark|toggle> and settings ${nn}; wifi|airplane|location|animations|text-size remain unsupported on macOS. Mobile permission actions default to the active session app; pass --app <id-or-name> (or the app input) to aim a permission change, or an iOS-simulator location on|off, at an installed app no session has opened; a name resolves to the installed app as open resolves it (a Limrun iOS session resolves only the settings alias), and an app that resolves to nothing refuses with app_not_installed before anything changes; no app needs to be running, and the CLI consumes the app only when this invocation names it, never from AGENT_DEVICE_TARGET_APP or config targetApp. clear-app-state takes its app positionally or with --app, and refuses two different apps. An installed app with no data container (a simulator-runtime system app such as com.apple.Preferences) refuses with app-no-data-container instead of scanning a path simctl never gave. A device-wide change refuses an app with setting_app_not_consumed: location set moves the device's own coordinates on every target, the Android location toggle writes the device's location_mode, and a macOS permission is a host-level TCC grant. On Android, deny|reset of a permission the app currently holds kills a running app; the response reports priorGrantState (granted|not_granted|unknown) and warns for granted and unknown, with open <app> --relaunch to restore it. Permission changes require a resolvable foreground user and fail without mutating if adb cannot report one. Android settings airplane on|off is applied by the connectivity service (Android 11+) and reports the airplaneMode that service holds; older builds fail without changing device state. settings reset-keychain clear is iOS-simulator-only and resets the whole simulator keychain, not just the selected app: simctl exposes no per-app keychain reset, so every app on that simulator loses its keychain-backed credentials (e.g. Firebase auth). clear-app-state does not touch the keychain, so a full fresh-install reset needs both; relaunch the app afterward to observe the signed-out state. settings text-size reads the preferred text size the target holds and settings text-size <category> applies one, on iPhone and iPad simulators (simctl content size) and on Android targets (system font_scale); tvOS and visionOS simulators, physical Apple devices, and the macOS host refuse it. Android has no category ladder of its own, so the read names the nearest rung and reports the exact multiplier as platformValue; an already-running app adopts a changed size at its next configuration change, so relaunch the app under test to observe it.`},metadata:Zi,run:(e,t)=>e.settings.update(t),cliSchema:Qi,cliReader:$i,daemonWriter:ea,cliOutputFormatter:U});function ra(e,t){let n=Kn(t),i=e[0],a=e[1];if(y(i,ca)&&y(a,la))return{...n,setting:i,state:a};if(i===`location`&&a===`set`)return{...n,setting:i,state:a,latitude:rn(e[2],`latitude`),longitude:rn(e[3],`longitude`)};if(i===`appearance`&&y(a,ua))return{...n,setting:i,state:a};if(i===`text-size`)return a===void 0?{...n,setting:i}:{...n,setting:i,state:Yt(a)};if(y(i,da)&&y(a,fa)||i===`fingerprint`&&y(a,pa))return{...n,setting:i,state:a};if(i===`permission`&&y(a,ha))return{...n,setting:i,state:a,permission:oa(e[2]),mode:sa(e[3])};if(i===`clear-app-state`)return{...n,setting:i,state:`clear`,app:ia(e,t)};if(i===`reset-keychain`&&a===`clear`&&e.length===2)return{...n,setting:i,state:a};throw new r(`INVALID_ARGS`,`Invalid settings arguments.`)}function ia(e,t){let n=e[1]===`clear`?e[2]:e[1],i=t.targetApp;if(n!==void 0&&i!==void 0&&n!==i)throw new r(`INVALID_ARGS`,`settings clear-app-state names two apps: ${n} and ${i}. Name one.`);return n??i}function aa(e){return e.setting===`clear-app-state`?[e.setting,...b(e.app)]:e.setting===`text-size`?[e.setting,...b(e.state)]:e.setting===`location`&&e.state===`set`?[e.setting,e.state,String(e.latitude),String(e.longitude)]:e.setting===`permission`?[e.setting,e.state,e.permission,...b(e.mode)]:[e.setting,e.state]}function oa(e){if(y(e,ga))return e;throw new r(`INVALID_ARGS`,`settings permission requires a permission target.`)}function sa(e){if(e===void 0||y(e,ma))return e;throw new r(`INVALID_ARGS`,`settings permission mode must be full or limited.`)}const ca=v(`wifi`,`airplane`,`location`,`animations`),la=v(`on`,`off`),ua=v(...tn),da=v(`faceid`,`touchid`),fa=v(`match`,`nonmatch`,`enroll`,`unenroll`),pa=v(`match`,`nonmatch`),ma=v(...en),ha=v(...$t),ga=v(...Xt,...Qt);function _a(e){if(!Array.isArray(e)||e.length===0)return e;let t=ct(e);return e.map(e=>{let n=va(e,t,e=>e.label),r=va(e,t,e=>e.identifier),i=typeof e.label==`string`&&e.label.length>=24&&e.label===n,a=typeof e.identifier==`string`&&e.identifier.length>=24&&e.identifier===r;if(!i&&!a)return e;let o={...e};return i&&(delete o.label,o.inheritsLabel=!0),a&&(delete o.identifier,o.inheritsIdentifier=!0),o})}function va(e,t,n){let r=typeof e.parentIndex==`number`?t.get(e.parentIndex):void 0;for(;r;){let e=n(r);if(typeof e==`string`&&e.length>0)return e;r=typeof r.parentIndex==`number`?t.get(r.parentIndex):void 0}}function ya(e){return e.width>0&&e.height>0}function ba(e,t){return!e||!t?!1:e.x>=t.x-2&&e.y>=t.y-2&&e.x+e.width<=t.x+t.width+2&&e.y+e.height<=t.y+t.height+2}function xa(e,t){if(!e||!t)return!0;let n=e.y+e.height/2,r=t.y+t.height/2;return Math.abs(n-r)<=Math.max(e.height,t.height,1)}function Sa(e){return typeof e.parentIndex!=`number`}function Ca(e){let t=(e.type??``).toLowerCase(),n=(e.identifier??``).trim().toLowerCase();return t.includes(`edittext`)||t.includes(`textfield`)||n===`composer`}function wa(e){let t=(e.type??``).toLowerCase();return t.includes(`scroll`)||t.includes(`list`)||t.includes(`recyclerview`)}function Ta(e){let t=lt(e);if(!t||t!==e.identifier?.trim()||!Da(t))return t;let n=(e.type??``).toLowerCase();return n.includes(`view`)||n.includes(`layout`)||n.includes(`image`)||n.includes(`list`)||n.includes(`recyclerview`)||n.includes(`collection`)?``:t}function Ea(e){let t=e.trim().replaceAll(/\s+/g,` `).toLowerCase();return!t||/^(true|false|\d+)$/.test(t)?null:t}function Da(e){return/^[\w.]+:id\/[\w.-]+$/i.test(e)}function Oa(e,t,n){let r=e;for(;typeof r.parentIndex==`number`;){let e=t.get(r.parentIndex);if(!e)return null;if(n(e))return e;r=e}return null}function ka(e,t){let n=[],r=[t];for(;r.length>0;){let t=r.pop();for(let i of e)i.parentIndex===t&&(n.push(i),r.push(i.index))}return n}function Aa(e,t,n){let r=[t];for(;r.length>0;){let t=r.pop();if(!n.has(t)){n.add(t);for(let i of e)i.parentIndex!==t||n.has(i.index)||r.push(i.index)}}}const ja=[`button`,`switch`,`checkbox`,`radio`],Ma=[`button`,`image`,`textview`,`view`];function Na(e,t,n){for(let r of e){if(t.has(r.index)||!Ia(r))continue;let i=La(ka(e,r.index),r,t);if(i.label){n.set(r.index,{...r,...n.get(r.index),label:i.label});for(let n of i.removableIndexes)Aa(e,n,t)}}}function Pa(e,t,n){let r=new Map;for(let i of e){if(t.has(i.index)||!Ga(i))continue;let a=Ea(Ta(i));if(!a)continue;let o=r.get(a);if(o&&Ha(o,i,t)){let s=Ua(e,o,i,t,n);r.set(a,s);continue}r.set(a,i)}}function Fa(e,t){for(let n of e){if(t.has(n.index)||!Ba(n))continue;let r=Ea(Ta(n));if(!r)continue;let i=ka(e,n.index).filter(e=>!t.has(e.index)&&Va(n,e,r));for(let n of i.filter(za))Aa(e,n.index,t);let a=i.filter(e=>!za(e)),o=new Set(a.map(e=>Ea(Ta(e))).filter(e=>!!e));if(!(a.length<2||o.size<2))for(let n of a)Aa(e,n.index,t)}}function Ia(e){return e.hittable===!0&&!Ca(e)&&!!(e.rect&&ya(e.rect))&&Ta(e).trim().length===0}function La(e,t,n){let r=[],i=[],a=new Set;for(let o of e){if(n.has(o.index)||!Ra(o,e)||!ba(o.rect,t.rect))continue;let s=Ta(o).trim().replaceAll(/\s+/g,` `),c=Ea(s);i.push(o.index),!(!s||!c||a.has(c))&&(a.add(c),r.push(s))}return{label:r.join(`, `),removableIndexes:i}}function Ra(e,t){if(za(e))return!0;let n=(e.type??``).toLowerCase();return e.hittable!==!0&&!Ca(e)&&n.includes(`view`)&&Ta(e).trim().length>0&&!t.some(t=>t.parentIndex===e.index)}function za(e){if(e.hittable===!0||Ca(e))return!1;let t=(e.type??``).toLowerCase();return t.includes(`text`)||t.includes(`image`)||t.includes(`icon`)}function Ba(e){return e.hittable===!0&&!Ca(e)&&!!(e.rect&&ya(e.rect))&&!!Ea(Ta(e))}function Va(e,t,n){if(!Ga(t)||!ba(t.rect,e.rect))return!1;let r=Ea(Ta(t));return!!(r&&n!==r&&n.includes(r))}function Ha(e,t,n){return!n.has(e.index)&&xa(e.rect,t.rect)&&(Xa(e,t)||Ya(e,t))}function Ua(e,t,n,r,i){let a=Ka(t,n),o=a.index===t.index?n:t,s=(o.type??``).toLowerCase().includes(`image`)?`has image`:null,c=i.get(a.index)??a,ee=i.get(o.index)?.presentationHints??o.presentationHints;return i.set(a.index,{...c,presentationHints:Wa(c.presentationHints,ee,s)}),Aa(e,o.index,r),i.get(a.index)??a}function Wa(e,t,n){return[...new Set([...Array.isArray(e)?e:[],...Array.isArray(t)?t:[],...n?[n]:[]])]}function Ga(e){if(!e.rect||!ya(e.rect)||Sa(e)||Ca(e))return!1;let t=(e.type??``).toLowerCase();return t===`text`||Ja(t,Ma)}function Ka(e,t){let n=qa(e);return qa(t)>n?t:e}function qa(e){let t=(e.type??``).toLowerCase(),n=0;return Ja(t,ja)?n+=100:t.includes(`image`)?n+=30:t.includes(`textview`)||t===`text`?n+=20:t.includes(`view`)&&(n+=10),e.hittable===!0&&(n+=20),e.enabled!==!1&&(n+=5),n}function Ja(e,t){return t.some(t=>e.includes(t))}function Ya(e,t){let n=e.parentIndex===t.index?t:t.parentIndex===e.index?e:null,r=n?.index===e.index?t:n?.index===t.index?e:null;return!n||!r?!1:Ka(n,r).index===n.index}function Xa(e,t){return e.parentIndex===t.parentIndex?Math.abs(e.index-t.index)<=3:e.parentIndex===t.index||t.parentIndex===e.index?!1:Math.abs((e.depth??0)-(t.depth??0))<=1&&Math.abs(e.index-t.index)<=2}function Za(e,t,n){if(n.raw||!Qa(e))return{nodes:t,filteredCount:0};let r=$a(t);return{nodes:r,filteredCount:t.length-r.length}}function Qa(e){let t=e.androidSnapshot;return!t||typeof t!=`object`?!1:t.backend===`android-helper`}function $a(e){if(e.length===0)return e;let t=new Set,n=new Map,r=new Map(e.map(e=>[e.index,e]));return eo(e,t),to(e,r,t,n),Na(e,t,n),Fa(e,t),Pa(e,t,n),e.filter(e=>!t.has(e.index)).map(e=>n.get(e.index)??e)}function eo(e,t){for(let n of e)!n.rect||ya(n.rect)||Sa(n)||Aa(e,n.index,t)}function to(e,t,n,r){for(let i of e){if(n.has(i.index)||i.rect||Sa(i))continue;let a=Oa(i,t,wa);a&&ro(r,a,no(i,e)),Aa(e,i.index,n)}}function no(e,t){let n=t.filter(t=>t.parentIndex===e.parentIndex&&t.rect&&ya(t.rect)).map(e=>e.index);return n.length===0?null:e.index<Math.min(...n)?`above`:e.index>Math.max(...n)?`below`:null}function ro(e,t,n){if(!n)return;let r=e.get(t.index)??t;e.set(t.index,{...r,hiddenContentAbove:r.hiddenContentAbove===!0||n===`above`||void 0,hiddenContentBelow:r.hiddenContentBelow===!0||n===`below`||void 0})}function io(e){if(e.length<20)return!1;let t=new Map;for(let n of e){let e=(n.type??``).toLowerCase(),r=ao(lt(n));if(!r)continue;let i=`${e}|${r}`,a=t.get(i)??[];a.push(n),t.set(i,a)}let n=0;for(let e of t.values())e.length<=1||!co(e)||(n+=e.length);return n>=8}function ao(e){let t=e.trim().replaceAll(/\s+/g,` `).toLowerCase();return!t||oo(t)?null:t}function oo(e){return e.split(` `).some(so)}function so(e){let t=e.indexOf(`@`,1);return t!==-1&&e.lastIndexOf(`.`,e.length-2)>t+1}function co(e){for(let t=0;t<e.length;t+=1)for(let n=t+1;n<e.length;n+=1)if(lo(e[t]?.rect,e[n]?.rect))return!0;return!1}function lo(e,t){if(!e||!t)return!0;let n=.5;return!(e.x+e.width<=t.x+n||t.x+t.width<=e.x+n||e.y+e.height<=t.y+n||t.y+t.height<=e.y+n)}function uo(n,r={}){let i=n.nodes,a=Array.isArray(i)?i:[],o=e(n.backend)?n.backend:void 0,s=t(o),c=Za(n,a,r),ee=ho(n),te=wo(n,a,r,c),ne=te.length>0?`${te.join(`
|
|
8
|
+
`)}\n`:``,re=r.raw?null:fo(n);if(re)return`${ee}${ne}${po(re)}\n`;let ie=r.raw||!s?null:on(c.nodes),ae=!!n.truncated,oe=ie?.nodes??a,se=r.raw||!s?null:xo(n,ie,oe.length,a.length,c.filteredCount),ce=go(a.length,se,ae);return a.length===0?`${ee}${ce}\n${ne}`:r.raw?`${ee}${ce}\n${ne}${_o(a)}\n`:r.flatten?`${ee}${ce}\n${ne}${vo(oe)}${bo(ie)}\n`:`${ee}${ce}\n${ne}${yo(oe)}${bo(ie)}\n`}function fo(e){let t=e.unchanged;if(!t||typeof t!=`object`)return null;let n=t;return typeof n.ageMs!=`number`||typeof n.nodeCount!=`number`?null:{ageMs:n.ageMs,nodeCount:n.nodeCount,interactiveOnly:n.interactiveOnly===!0||void 0,scope:typeof n.scope==`string`?n.scope:void 0}}function po(e){let t=mo(e.ageMs);return e.scope?[`Scoped snapshot unchanged for scope "${e.scope}" since previous read ${t} ago.`,`Previous refs in this scope remain valid. Use find/get/is for a targeted query, or --force-full to re-emit.`].join(`
|
|
9
|
+
`):e.interactiveOnly?[`Interactive snapshot unchanged since previous read ${t} ago.`,`${e.nodeCount} visible nodes are unchanged. Previous @e refs are still valid. Use find/get/is for a targeted query, or --force-full to re-emit.`].join(`
|
|
10
|
+
`):[`Snapshot unchanged since previous read ${t} ago.`,`Refs from the previous snapshot are still valid. Use --force-full to re-emit the tree, or use find/get/is for a targeted query.`].join(`
|
|
11
|
+
`)}function mo(e){if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${(Math.round(e/100)/10).toFixed(1)}s`;let t=e/6e4;if(t<60)return`${(Math.round(t*10)/10).toFixed(1)}m`;let n=t/60;return`${(Math.round(n*10)/10).toFixed(1)}h`}function ho(e){let t=typeof e.appName==`string`?e.appName:void 0,n=typeof e.appBundleId==`string`?e.appBundleId:void 0,r=[];return t&&r.push(`Page: ${t}`),n&&r.push(`App: ${n}`),r.length>0?`${r.join(`
|
|
12
|
+
`)}\n`:``}function go(e,t,n){let r=n?` (truncated)`:``;return t?.partial?t.totalNodeCount>t.visibleNodeCount?`Snapshot: ${t.visibleNodeCount} visible nodes (${t.totalNodeCount} total)${r}`:`Snapshot: ${t.visibleNodeCount} visible nodes${r}`:`Snapshot: ${e} nodes${r}`}function _o(e){return e.map(e=>JSON.stringify(e)).join(`
|
|
13
|
+
`)}function vo(e){return No(e).join(`
|
|
14
|
+
`)}function yo(e){return Ao(Ze(e,{summarizeTextSurfaces:!0})).join(`
|
|
15
|
+
`)}function bo(e){return e&&e.summaryLines.length>0?`\n${e.summaryLines.join(`
|
|
16
|
+
`)}`:``}function xo(e,t,n,r,i=0){let a=So(e);if(i===0&&a)return a;let o=(t?.hiddenCount??0)+i,s=t?t.nodes.some(e=>e.hiddenContentAbove||e.hiddenContentBelow):!1;return o>0?{partial:!0,visibleNodeCount:n,totalNodeCount:Math.max(r,a?.totalNodeCount??r),reasons:Co([...a?.reasons??[],`offscreen-nodes`])}:a||(s?{partial:!0,visibleNodeCount:n,totalNodeCount:n,reasons:[]}:null)}function So(e){let t=e.visibility;if(!t||typeof t!=`object`)return null;let n=t;return typeof n.partial!=`boolean`||typeof n.visibleNodeCount!=`number`||typeof n.totalNodeCount!=`number`||!Array.isArray(n.reasons)?null:{partial:n.partial,visibleNodeCount:n.visibleNodeCount,totalNodeCount:n.totalNodeCount,reasons:n.reasons.filter(e=>typeof e==`string`)}}function Co(e){return[...new Set(e)]}function wo(e,t,n,r={nodes:t,filteredCount:0}){let i=[...ko(e),...To(e)];if(Eo(e)){let e=Oo(t,n);e&&i.push(e)}!n.raw&&r.filteredCount>0&&i.push(`Collapsed ${r.filteredCount} Android helper node${r.filteredCount===1?``:`s`} from the agent-facing text snapshot; use --raw or --json for the full hierarchy.`);let a=r.filteredCount>0?r.nodes:t;return!n.raw&&io(a)&&i.push(`Warning: possible repeated nav subtree detected.`),i}function To(e){let t=e.fallbackScreenshotPath;return typeof t==`string`&&t.length>0?[`Captured a screenshot of this screen automatically as visual truth: ${t}`]:[]}function Eo(e){return!e.snapshotQuality&&!Do(e)}function Do(e){let t=e.snapshotDiagnostics;if(!t||typeof t!=`object`)return!1;let n=t.stats;return!!(n&&typeof n==`object`&&n.platform===`web`)}function Oo(e,t){if(t.scoped===!0||t.depthLimited===!0||e.length>3)return null;let n=e.length===1?`node`:`nodes`;return`Hint: sparse accessibility snapshot returned ${e.length} ${n}; snapshot state is invalid or unavailable for this screen. Use plain screenshot, not screenshot --overlay-refs, as visual truth. If screenshot shows the Home Screen or another app, run open for this app again first. Then navigate away with coordinates if needed and retry snapshot -i on the next screen.`}function ko(e){return ie(e).filter(e=>e.length>0)}function Ao(e){let t=[],n=[],r=new Map(e.map(e=>[e.node.index,e.node])),i=e=>{for(;n.length>0&&(!e||jo(e,n.at(-1),r));)t.push(...Po(n.pop(),`below`))};for(let r of e)i(r),t.push(r.text),t.push(...Po(r,`above`)),r.node.hiddenContentBelow&&n.push(r);return i(),t}function jo(e,t,n){return!Mo(e.node,t.node,n)&&e.depth<=t.depth}function Mo(e,t,n){let r=e;for(;typeof r.parentIndex==`number`;){if(r.parentIndex===t.index)return!0;let e=n.get(r.parentIndex);if(!e)return!1;r=e}return!1}function No(e){return Ze(e,{summarizeTextSurfaces:!0}).flatMap(e=>[Ge(e.node,0,!1,e.type,{summarizeTextSurfaces:!0}),...Po({...e,depth:0})])}function Po(e,t){let n=Fo(e.type);if(!n)return[];let r=[];if(e.node.hiddenContentAbove&&t!==`below`&&r.push(`[content above ${n} hidden]`),e.node.hiddenContentBelow&&t!==`above`&&r.push(`[content below ${n} hidden]`),r.length===0)return[];let i=` `.repeat(e.depth+1);return r.map(e=>`${i}${e}`)}function Fo(e){return e===`scroll-area`||e===`list`||e===`collection`||e===`table`?e:null}async function Io(e){let{serializeSnapshotResult:t}=await import(`./result-serialization.js`).then(e=>e.t),n=t(e.raw||!Array.isArray(e.result.nodes)?e.result:{...e.result,nodes:_a(e.result.nodes)});return{data:n,jsonData:Ro(n),stderr:e.result.snapshotDiagnostics?.warning?`${e.result.snapshotDiagnostics.warning}\n`:void 0,text:uo(n,{raw:e.raw,flatten:e.interactiveOnly,scoped:typeof e.scope==`string`&&e.scope.trim().length>0,depthLimited:typeof e.depth==`number`})}}const Lo={snapshot:async({input:e,result:t})=>await Io({result:t,raw:e.raw,interactiveOnly:e.interactiveOnly,scope:e.scope,depth:e.depth}),wait:U,alert:U};function Ro(e){let{unchanged:t,...n}=e;return n}const zo=`snapshot`,Bo=Object.entries(an).map(([e,t])=>{let n=t.knownGaps.map(e=>`known gap ${e}`);return`${e}: hittable=${t.hittable}, regular-depth=${t.regularDepth}, deep-extension=${t.deepExtension}, depth-ladder=${t.depthLadder}${n.length>0?`, ${n.join(`, `)}`:``}`}).join(`; `),Vo=z(zo,`Capture the accessibility tree or compare it with the previous session baseline. Use the returned refs for subsequent semantic interactions and the diff option to verify UI changes.`,{interactiveOnly:F(),depth:P(),scope:M(),raw:F(),customActions:wr(`snapshotCustomActions`),observeOnly:wr(`snapshotObserveOnly`),forceFull:F(),timeoutMs:P(`Maximum wall-clock time for the snapshot command.`),noRecord:F(`Do not record this action.`),record:F(`Force-record this out-of-band observation into a repair-armed heal (mutually exclusive with noRecord). Authored replay steps are recorded automatically and never need this.`)}),Ho={allowedFlags:[`snapshotDiff`,...Fi,`snapshotCustomActions`,`snapshotObserveOnly`,`snapshotForceFull`,`timeoutMs`,`record`]},Uo=(e,t)=>({..._(t),...Gn(t),...o(t,a),timeoutMs:t.timeoutMs}),Wo=h(u.snapshot),Go=B({name:zo,text:{summary:`Capture or diff the accessibility tree`,cliDetail:`--observe-only is local iOS snapshot-only: an already-ready compatible runner reads the session app without activation or foreground repair, refuses unavailable observation, and reports XCUIApplication state rather than verified foreground ownership (#2696). Regular targetActivation disclosure stays unchanged (#2682, #2694). Repeated equivalent unfiltered Android snapshots return a compact unchanged acknowledgement. Use --force-full to re-emit the tree; --json and --raw retain full output. For iOS raw-coordinate fallback after a no-op ref press, inspect rects with snapshot -i --json, press the rect center, then verify with diff snapshot -i or snapshot --diff. iOS backend capability contract: ${Bo}.`},metadata:Vo,run:(e,t)=>e.capture.snapshot(t),cliSchema:Ho,cliReader:Uo,daemonWriter:Wo,cliOutputFormatter:Lo.snapshot}),Ko=[`duration`,`text`,`ref`,`selector`,`absent`,`stable`],qo=`wait`,Jo={wait:w({waitedMs:O(),kind:E(`selector`),text:D(),selector:D(),captures:O(),nodeCount:O(),hint:D(),warning:D()},[`waitedMs`])},Yo=B({name:qo,text:{summary:`Wait for a duration, text, selector, strict absence, or stable UI`},metadata:z(qo,`Wait for a duration, text, snapshot ref, selector to appear, selector to be strictly absent, or stable UI. Use the strict absence target when zero selector matches are required; stable waits until the UI stays quiet for the requested window.`,{kind:I(Ko),durationMs:P(),text:M(),ref:M(),selector:M(),absent:M(),stable:F(),quietMs:P(),timeoutMs:P(),depth:P(),scope:M(),raw:F()}),run:(e,t)=>e.command.wait(Xo(t)),cliSchema:{usageOverride:`wait <ms>|text <text>|@ref|<selector>|absent <selector> [timeoutMs]|stable [quietMs] [timeoutMs]`,usageFlags:[],positionalArgs:[`durationOrSelector`,`timeoutMs?`],allowsExtraPositionals:!0,allowedFlags:[...Ii]},cliReader:(e,t)=>Zo(e,t),daemonWriter:h(u.wait,e=>es(e)),cliOutputFormatter:U});function Xo(e){An(e,`kind`,Ko);let t={...e};return delete t.kind,t}function Zo(e,t){let n=Ct(e);if(!n)throw new r(`INVALID_ARGS`,`wait requires <ms>, text <text>, @ref, <selector> [timeoutMs], absent <selector> [timeoutMs], or stable [quietMs] [timeoutMs].`);let i={...Kn(t),...Jn(t)};switch(n.kind){case`absent`:return Qo(i,n);case`sleep`:return{...i,durationMs:n.durationMs};case`text`:return $o(i,n);case`ref`:return{...i,ref:n.rawRef,...ts(n.timeoutMs)};case`stable`:return{...i,stable:!0,...ns(n.quietMs),...ts(n.timeoutMs)};case`invalid`:throw new r(`INVALID_ARGS`,n.message);case`selector`:return{...i,selector:n.selectorExpression,...ts(n.timeoutMs)};default:return rs(n)}}function Qo(e,t){let n=We(e);if(n)throw sn(n,`wait`);return{...e,absent:t.selectorExpression,...ts(t.timeoutMs)}}function $o(e,t){if(!t.text)throw new r(`INVALID_ARGS`,`wait requires text.`);return{...e,text:t.text,...ts(t.timeoutMs)}}function es(e){if([e.durationMs===void 0?void 0:`durationMs`,e.text===void 0?void 0:`text`,e.ref===void 0?void 0:`ref`,e.selector===void 0?void 0:`selector`,e.absent===void 0?void 0:`absent`,e.stable===void 0?void 0:`stable`].filter(Boolean).length!==1)throw new r(`INVALID_ARGS`,`wait command requires exactly one of durationMs, text, ref, selector, absent, or stable.`);if(e.durationMs!==void 0)return[String(e.durationMs)];let t=x(e.timeoutMs);if(e.text!==void 0)return[`text`,e.text,...t];if(e.ref!==void 0)return[e.ref,...t];if(e.absent!==void 0){let n=We(e);if(n)throw sn(n,`wait`);if(!dt(e.absent))throw new r(`INVALID_ARGS`,`Invalid wait absent selector: ${e.absent}`);return[`absent`,e.absent,...t]}if(e.stable!==void 0){let n=x(e.quietMs);if(n.length===0&&t.length>0)throw new r(`INVALID_ARGS`,`wait stable requires quietMs before timeoutMs.`);return[`stable`,...n,...t]}let n=e.selector;if(!dt(n))throw new r(`INVALID_ARGS`,`Invalid wait selector: ${n}`);return[n,...t]}function ts(e){return e===null?{}:{timeoutMs:e}}function ns(e){return e===null?{}:{quietMs:e}}function rs(e){throw Error(`Unsupported wait positional target: ${String(e)}`)}const is=V({name:`capture`,commands:[Go,Yi,qi,Yo,Ai,na]});function as(e){let t=[e.outPath,e.message];t.push(...ss(e));for(let n of e.matchedImages)t.push(`Matched: ${n.name} ${n.uuid}${n.arch?` ${n.arch}`:``}`);for(let n of e.warnings??[])t.push(`Warning: ${n}`);return{data:e,text:t.join(`
|
|
17
|
+
`)}}const os={debug:H(as)};function ss(e){let t=e.crash,n=[`Crash: ${t.appName??`unknown app`}${t.crashedThread===void 0?``:` thread ${t.crashedThread}`}`];t.bundleId&&n.push(`Bundle: ${t.bundleId}`),t.exceptionType&&n.push(`Exception: ${t.exceptionType}`),t.terminationReason&&n.push(`Termination: ${t.terminationReason}`);for(let e of t.topFrames)n.push(`Frame ${e.index}: ${e.image} ${e.symbol??e.address}`);for(let e of t.findings)n.push(`Finding: ${e}`);return n}const cs=`debug`,ls=V({name:`debugging`,commands:[B({name:cs,text:{summary:`Symbolicate Apple crash artifacts`},metadata:z(cs,`Symbolicate Apple crash artifacts with matching dSYM UUIDs. This debug namespace is intentionally narrow: use logs for app logs, network for HTTP evidence, perf for performance samples, record/trace for media and traces, and react-devtools for React Native profiles.`,{action:j(I([`symbols`])),artifact:j(M(`Apple crash artifact path (.ips, .crash, or .log).`)),dsym:M(`Path to a matching .dSYM bundle.`),searchPath:M(`Directory to scan for matching .dSYM bundles.`),out:M(`Output path for the symbolicated artifact.`)}),run:(e,t)=>e.debug.symbols(t),cliSchema:{usageOverride:`debug symbols --artifact <crash.ips|crash.log> (--dsym <App.dSYM> | --search-path <dir>) [--out <symbolicated>]`,usageFlags:[],listUsageOverride:`debug`,positionalArgs:[`symbols`],allowedFlags:[`artifact`,`dsym`,`searchPath`,`out`]},cliReader:(e,t)=>({..._(t),action:us(e[0]),artifact:t.artifact,dsym:t.dsym,searchPath:t.searchPath,out:t.out}),cliOutputFormatter:os.debug})]});function us(e){if(e===`symbols`)return e;throw new r(`INVALID_ARGS`,`debug supports only symbols; use logs, network, perf, record, trace, or react-devtools for other diagnostics`)}const ds=()=>F(`Capture cheap post-action evidence (AX digest, node counts, changedFromBefore) instead of a follow-up snapshot.`),fs=()=>({settle:F(`After the action, wait for the UI to go quiet and return the settled diff vs the pre-action tree in the same response. Best-effort; never fails the action.`),settleQuietMs:P(`Settle: quiet window in milliseconds (default 500).`,{min:0}),timeoutMs:P(`Settle: wait deadline in milliseconds (default 10000).`,{min:1})});function ps(e){return{...ht(e)?{verify:ds()}:{},...bt(e)?fs():{}}}function ms(e){let t=[];return ht(e)&&t.push(`verify`),bt(e)&&t.push(...Bi),t}function hs(e,t){return bt(e)?Yn(t):{}}const gs=[`click`,`focus`,`exists`,`list`,`getText`,`getAttrs`,`wait`,`fill`,`type`],_s={click:`Activate a UI target by snapshot ref, selector, or coordinates. Prefer a ref or selector after a snapshot; use coordinates only when semantic targeting is unavailable. This can change app state. Success means the click was dispatched, not that it landed: use settle or verify to confirm the result without a follow-up snapshot, or wait for the expected screen.`,press:`Short-press a UI target by snapshot ref, selector, or coordinates. Use longpress instead when the target requires a context-menu or hold gesture. Success means the press was dispatched, not that it landed: use settle or verify to confirm the result, or wait for the expected screen.`,fill:`Replace text in a UI input selected by snapshot ref, selector, or coordinates. Pass an empty text to clear the field. Inspect unconfirmed evidence and assert the expected value or resulting screen before continuing. Prefer refs or selectors after snapshot; use recordAs to keep sensitive text out of a recorded replay while sending it to the live app.`,longpress:`Hold a UI target by snapshot ref, selector, or coordinates to open a context menu or perform another hold gesture. Set durationMs when the default hold duration is unsuitable.`,hover:`Move the pointer over a UI target by snapshot ref, selector, or coordinates without pressing, to reveal hover-gated UI such as row toolbars or menus. Web only; touch platforms have no hover state. Use settle to observe what the hover revealed without a follow-up snapshot.`,swipe:`Quick coordinate fling with optional repeat pattern.`,focus:`Move input focus to explicit screen coordinates without entering text. Prefer semantic interactions when a snapshot ref or selector is available; use type or fill after focus.`,type:`Append text to the currently focused input. Use fill when the existing field value should be replaced, and focus first when no input is active.`,scroll:`Scroll in a direction, or toward the top/bottom edge of scrollable content. Set until to a selector to reach an off-screen target in one command rather than a scroll-and-check loop. The optional amount is the finger-path fraction of the viewport axis, honored up to 0.8 of it; directional scrolls reduce release momentum, while app scroll physics determine the final content offset. A visible keyboard shortens the swiped band instead of being dismissed; when too little is left, the command refuses with scroll_keyboard_occludes_surface. A directional scroll also reports the movement it observed as movement: moved, at-edge, unchanged, or unobserved when the two reads could not back a claim either way; an unchanged surface inside a container that still hides content in that direction refuses with scroll_no_progress rather than repeating the requested distance. The movement field is absent where a tier verifies per pass (top/bottom, until), where the runtime cannot read a screen, or where a settle observation or a replay already owns that observation.`,get:`Read text or accessibility attributes from a snapshot ref or selector without changing the app. Use format text for visible content or attrs for the element attribute map.`,is:"Check whether a selector satisfies a UI predicate such as visible, hidden, exists, absent, editable, selected, focused, or text. `absent` passes only when one readable, complete, settled, unscoped, full-depth accessibility capture has zero matches. Use wait when the condition may appear asynchronously.",find:`Find by text/label/value/role/id and run action. The role locator matches snapshot kind vocabulary (button, text, text-field, switch, ...); pre-reconciliation leaf spellings (statictext, edittext, textview) stay accepted on the nodes that carried them during a deprecation window.`,gesture:`Perform a structured pan, fling, swipe, pinch, rotate, transform, or drag gesture. Select the gesture kind, then provide only the inputs that apply to that kind.`};function vs(e){if(!ft(e))throw Error(`${e} does not declare targetReadiness: 'budgeted'`);return{readinessTimeoutMs:Cr(P(`Operator-only: how long the command may poll for a target that does not exist yet, in milliseconds. Capped at the promotedTarget row's maxTimeoutMs; omitted takes the one-attempt resolution path.`,{min:1}),{operatorPath:`Pass readinessTimeoutMs directly as CLI/Node.js command input; it is not exposed to model-facing tools.`})}}const ys={target:j(jr()),button:I(Xe,`Pointer button for platforms that support mouse buttons.`),...Pr(),...Fr(),...ps(`click`),...vs(`click`)},bs={target:j(jr()),...Pr(),...Fr(),...ps(`press`),...vs(`press`)},xs={target:j(jr()),text:j(M(`Text to enter into the target. Pass "" to clear it.`,{allowEmpty:!0})),delayMs:P(`Delay between typed characters.`,{min:0}),recordAs:M("When script recording is armed, send text to the live app but publish it as ${VAR}. Use an uppercase replay variable name such as PASSWORD."),textStdin:Cr(F(`Operator-only: text was read from the CLI's stdin, so it is kept out of diagnostics and recorded actions.`),{operatorPath:`Pass --text-stdin on the CLI and pipe the text in; it is not exposed to model-facing tools.`}),...Pr(),...ps(`fill`)},Ss={target:j(jr()),durationMs:P(`Long press duration in milliseconds.`,{min:0}),...Pr(),...ps(`longpress`),...vs(`longpress`)},Cs={target:j(jr()),...Pr(),...ps(`hover`)},ws={from:j(Nr(`Swipe start point.`)),to:j(Nr(`Swipe end point.`)),count:P(`Number of swipe repetitions.`,{min:1,max:200}),pauseMs:P(`Pause between repeated swipes.`,{min:0,max:ae}),pattern:I(oe)},Ts={x:j(N(`X coordinate.`)),y:j(N(`Y coordinate.`))},Es={text:j(M(`Text to type.`)),delayMs:P(`Delay between typed characters.`,{min:0})},Ds={direction:j(I(_e)),amount:N(`Platform scroll amount.`),pixels:P(`Pixel scroll amount.`,{min:0}),until:M(`Repeat scroll passes until this selector is visible on screen, then stop. Not valid with the top/bottom edge directions, which carry their own stop condition.`),durationMs:P(`Scroll duration in milliseconds when the backend supports pacing.`,{min:0,max:ee}),...ps(`scroll`)},Os=()=>({noRecord:F(`Do not record this action.`),record:F(`Force-record this out-of-band observation into a repair-armed heal (mutually exclusive with noRecord). Authored replay steps are recorded automatically and never need this. On find, valid only for a read-only action.`)}),ks={format:j(I([`text`,`attrs`])),target:j(Mr()),...Pr(),...Os()},As={predicate:j(I(St)),selector:j(M()),value:M(),...Pr(),...Os()},js={locator:I(vt),query:j(M()),action:I(gs),value:M(void 0,{allowEmpty:!0}),timeoutMs:P(),first:F(),last:F(),depth:P(),raw:F(),...Os()},Ms={kind:j(I(Ke,`Gesture variant.`)),direction:I(ne,`Fling direction.`),preset:I(se,`Swipe preset.`),origin:Nr(`Gesture origin point.`),delta:Nr(`Movement delta for pan or transform gestures.`),distance:P(`Fling distance.`,{min:0}),scale:N(`Pinch or transform scale.`),degrees:N(`Rotation in degrees.`),durationMs:P(`Pan/transform duration.`,{min:16,max:1e4}),pointerCount:P(`Pan touch pointer count (1 or 2).`,{min:1,max:2}),source:M(`Drag source @ref or selector.`),destination:M(`Drag destination @ref or selector.`),sourceHoldMs:P(`Drag activation hold duration.`,{min:1,max:1e4}),moveMs:P(`Drag movement duration.`,{min:16,max:1e4}),destinationHoldMs:P(`Hold before releasing at the destination.`,{min:0,max:1e4})},Ns=[G(`click`,ys),G(`press`,bs),G(`fill`,xs),G(`longpress`,Ss),G(`hover`,Cs),G(`swipe`,ws),G(`focus`,Ts),G(`type`,Es),G(`scroll`,Ds),G(`get`,ks,{parseableOutput:!0}),G(`is`,As),G(`find`,js,{parseableOutput:!0}),z(`gesture`,_s.gesture,Ms,{readInput:Ps})];function Ps(e){let t=Cn(e);return{...zn(t),...He(t)}}function G(e,t,n){return z(e,_s[e],t,n)}const Fs={gesture:Ls},Is={gesture:e=>{let t=Ps(e);return g(u.gesture,[],e,p(t))}};function Ls(e,t){return{..._(t),...Le(e,t.pointerCount)}}const K={click:(e,t)=>({..._(t),...qn(t),...Xn(t),target:Zn(cn(e)),button:t.clickButton,verify:t.verify}),press:(e,t)=>({..._(t),...qn(t),...Xn(t),target:Zn(cn(e)),verify:t.verify}),longpress:(e,t)=>{let n=zs(e);return{..._(t),...qn(t),target:Zn(n),durationMs:n.durationMs}},hover:(e,t)=>({..._(t),...qn(t),target:Zn(cn(e))}),swipe:(e,t)=>({..._(t),...$e(e,{count:t.count,pauseMs:t.pauseMs,pattern:t.pattern})}),focus:(e,t)=>({..._(t),x:Number(e[0]),y:Number(e[1])}),type:(e,t)=>({..._(t),text:e.join(` `),delayMs:t.delayMs}),fill:(e,t)=>{let n=t.textStdin?Rs(e):ln(e);return{..._(t),...qn(t),target:Zn(n.target),text:n.text,delayMs:t.delayMs,recordAs:t.recordAs,textStdin:t.textStdin,verify:t.verify}},scroll:(e,t)=>({..._(t),direction:Us(e[0]),amount:ur(e[1]),pixels:t.pixels,durationMs:t.durationMs,until:t.until}),get:(e,t)=>({..._(t),...Gn(t),...qn(t),format:ir(e[0]),target:Zn(rr(e.slice(1)))})},q={click:e=>g(u.click,Qn(e),{...e,clickButton:e.button}),press:h(u.press,e=>Qn(e)),longpress:h(u.longPress,e=>Bs(e)),hover:h(u.hover,e=>Qn(e)),swipe:e=>(Ve(e),g(u.swipe,[],e,{from:e.from,to:e.to,count:e.count,pauseMs:e.pauseMs,pattern:e.pattern})),focus:h(u.focus,e=>[String(e.x),String(e.y)]),type:h(u.type,e=>Vs(e)),fill:h(u.fill,e=>Hs(e)),scroll:h(u.scroll,e=>[C(e.direction,`scroll requires direction`),...x(e.amount)]),get:h(u.get,e=>[C(e.format,`get requires format`),...$n(e)])};function Rs(e){let t;try{t=ln(e)}catch(e){throw e instanceof r?new r(`INVALID_ARGS`,`fill --text-stdin could not read the target.`,{reason:`fill_text_stdin_target_invalid`,hint:`Pass only the target: an @ref, a quoted selector, or x y coordinates. The text itself goes to stdin.`}):e}if(t.text!==void 0)throw new r(`INVALID_ARGS`,`fill --text-stdin reads the text from stdin, so it cannot also take a text argument.`,{reason:`fill_text_source_conflict`,hint:`Pass only the target, for example: printf %s "$PASSWORD" | agent-device fill @e3 --text-stdin. Quote a multi-word selector so no part of it is read as text.`});return t}function zs(e){let t=Ws(e);return{...cn(t.target),...t.durationMs===void 0?{}:{durationMs:t.durationMs}}}function Bs(e){return[...Qn(e),...x(e.durationMs)]}function Vs(e){return[e.text]}function Hs(e){return[...Qn(e),e.text]}function Us(e){if(e===`up`||e===`down`||e===`left`||e===`right`||e===`top`||e===`bottom`)return e;throw new r(`INVALID_ARGS`,`Unknown direction: ${String(e)}`,{hint:`scroll takes a direction first, then an optional amount: scroll <up|down|left|right|top|bottom> [amount]. It takes no @ref or selector — scroll the whole viewport, then retry the target with a selector.`})}function Ws(e){if(cr(e[0])&&cr(e[1]))return{target:e.slice(0,2),...e[2]===void 0?{}:{durationMs:Number(e[2])}};let t=e.at(-1);return e.length>1&&cr(t)?{target:e.slice(0,-1),durationMs:Number(t)}:{target:e}}function Gs(e){return({input:t,result:n})=>{let r=e({input:t,result:n});return r instanceof Promise?r.then(Ks):Ks(r)}}function Ks(e){return{data:e.data,text:Js(e.text,e.data)}}function qs(e){let t={...e};for(let[n,r]of Object.entries(e))bt(n)&&(t[n]=Gs(r));return t}function Js(e,t){return`${e??``}${Ys(t.settle)}`}function Ys(e){if(!e||typeof e!=`object`)return``;let t=e,n=[$s(t),...Xs(t),...Qs(t)];return t.hint&&n.push(`hint: ${t.hint}`),`\n${n.join(`
|
|
18
|
+
`)}`}function Xs(e){let t=e.diff,n=(t?.lines??[]).map(t=>`${t.kind===`removed`?`-`:`+`} ${Zs(t,e.refsGeneration)}`);return t?.truncated&&n.push(`… changed lines truncated`),n}function Zs(e,t){let n=e.text??``,r=ai(e.ref,t);if(!r||!e.ref)return n;let i=`@${e.ref}`;return n.startsWith(`${i} `)?`${r}${n.slice(i.length)}`:n}function Qs(e){let t=e.tail??[];if(t.length===0)return[];let n=[`unchanged interactive (${t.length}):`];for(let r of t){let t=r.label?` "${r.label}"`:``,i=ai(r.ref,e.refsGeneration)??`@${r.ref??``}`;n.push(`= ${i} [${r.role??``}]${t}`)}return e.tailTruncated&&n.push(`… more interactive elements not shown, use snapshot -i`),n}function $s(e){let t=e.settled===!0?`settled`:`not settled`,n=e.diff?.summary;return n?`${t} after ${e.waitedMs??0}ms: +${n.additions??0} -${n.removals??0} (~${n.unchanged??0} unchanged)`:`${t} after ${e.waitedMs??0}ms`}function ec(e){let t=e.result;return e.format===`attrs`?{data:t,text:JSON.stringify(t.node??{},null,2)}:{data:t,text:typeof t.text==`string`?t.text:``}}function tc(e){let t=e,n=te(t);if(n)return{data:t,text:n};if(typeof t.text==`string`)return{data:t,text:t.text};if(Array.isArray(t.matches))return{data:t,text:nc(t.matches,t.refsGeneration)};let r=ai(t.ref,t.refsGeneration);return r?{data:t,text:`Found: ${r}`}:typeof t.found==`boolean`?{data:t,text:`Found: ${t.found}`}:t.node?{data:t,text:JSON.stringify(t.node,null,2)}:ei(t)}function nc(e,t){return[`${e.length} match${e.length===1?``:`es`}:`,...e.map(e=>rc(e,t))].join(`
|
|
19
|
+
`)}function rc(e,t){let n=e.ref??``,r=n.startsWith(`@`)?n.slice(1):n,a=ai(n,t)??`@${r}`,o=i(e.node?.type??`Element`),s=e.node?Ye(e.node,o):``;return`= ${a} [${o}]${s?` "${s}"`:``}`}function ic(e){let t=e;return{data:t,text:`Passed: is ${t.predicate??`assertion`}`}}function ac(e){let t=e,n=t.ref??``,r=t.x,i=t.y;return!n||typeof r!=`number`||typeof i!=`number`?ei(t):{data:t,text:`Tapped @${n} (${r}, ${i})`}}const J=qs({click:H(ac),press:H(ac),fill:U,longpress:U,hover:U,scroll:U,get:({input:e,result:t})=>ec({result:t,format:e.format===`attrs`?`attrs`:`text`}),is:H(ic),find:H(tc)}),oc={find:(e,t)=>uc(e,t),is:(e,t)=>dc(e,t)},sc={is:h(u.is,e=>cc(e)),find:e=>g(u.find,lc(e),{...e,findFirst:e.first,findLast:e.last})};function cc(e){return[e.predicate,e.selector,...e.predicate===`text`?[e.value]:[]]}function lc(e){let t=e.locator&&e.locator!==`any`?[e.locator,e.query]:[e.query];switch(e.action){case void 0:case`click`:case`focus`:case`exists`:case`list`:return e.action?[...t,e.action]:t;case`getText`:return[...t,`get`,`text`];case`getAttrs`:return[...t,`get`,`attrs`];case`wait`:return[...t,`wait`,...x(e.timeoutMs)];case`fill`:case`type`:return[...t,e.action,e.value]}}function uc(e,t){let n={...hc(t),...Kn(t),...Gn(t),first:t.findFirst,last:t.findLast},i=mc(e[0]),a=i!==void 0,o=a?e[1]:e[0],s=a?2:1,c=st(e[s]);if(c===void 0)return{...n,locator:i,query:gc(o)};if(c===`get`){let t=e[s+1];if(t===`text`)return{...n,locator:i,query:gc(o),action:`getText`};if(t===`attrs`)return{...n,locator:i,query:gc(o),action:`getAttrs`};throw new r(`INVALID_ARGS`,`find get only supports text or attrs`)}if(c===`wait`)return{...n,locator:i,query:gc(o),action:`wait`,timeoutMs:ur(e[s+1])};if(c===`fill`||c===`type`){let t=e.slice(s+1);if(t.length===0)throw new r(`INVALID_ARGS`,c===`fill`?`find fill requires text (use "" to clear the field)`:`find type requires text`);return{...n,locator:i,query:gc(o),action:c,value:t.join(` `)}}if(c===`click`||c===`focus`||c===`exists`||c===`list`)return{...n,locator:i,query:gc(o),action:c};throw new r(`INVALID_ARGS`,`Unsupported find action: ${e[s]}`,{hint:_t})}function dc(e,t){let n={...Jn(t),...Kn(t),...Gn(t)},i=mt(e),a=xt(i[0]??``);if(!a.ok)throw new r(a.code,a.message,{hint:a.hint});let o=a.predicate;if(o===`absent`){let e=fc(n);if(e)throw pc(e)}let s=ar(i.slice(1),{preferTrailingValue:o===`text`});return o===`text`?{...n,predicate:o,selector:s.selectorExpression,value:s.rest.join(` `)}:{...n,predicate:o,selector:s.selectorExpression}}function fc(e){if(e.scope!==void 0)return`scope`;if(e.depth!==void 0)return`depth`}function pc(e){return new r(`INVALID_ARGS`,e===`scope`?`is absent does not support --scope; it requires an unscoped capture`:`is absent does not support --depth; it requires a full-depth capture`,{command:`is`,predicate:`absent`,rejectedOption:e})}function mc(e){if(e===`text`||e===`label`||e===`value`||e===`role`||e===`id`)return e}function hc(e){return{depth:e.snapshotDepth,raw:e.snapshotRaw}}function gc(e){if(e===void 0||e===``)throw new r(`INVALID_ARGS`,`find requires query`);return e}const _c=w({from:D(`Surface the pre-action baseline described: a host bundle id, or app.`),to:D(`Surface the post-action capture describes: a host bundle id, or app.`),disclosure:D(`Agent-facing sentence explaining the surface transition.`)},[`from`,`to`,`disclosure`],`Present when an in-place system surface (web sign-in or Apple Pay sheet) was presented over the app, or left it.`),vc=w({foregroundApp:D(`Foreground app bundle id or name, when the capture carries it.`),nodeCount:O(`Node count in the post-action interactive-only capture.`),interactiveNodeCount:O(`Subset of nodeCount the platform reports as hittable.`),digest:D(`Order-independent digest of the post-action node multiset.`),changedFromBefore:k(`Whether the post-action digest differs from the pre-action capture digest. false is evidence, not failure. With surfaceChange present, no digest comparison is made: it reports that surface transition.`),surfaceChange:_c},[`nodeCount`,`interactiveNodeCount`,`digest`,`changedFromBefore`]),yc=w({wallClockMs:O(`Total wall-clock time for the request in milliseconds.`),runnerRoundTrips:O(`Number of real runner round-trips made while serving the request.`),nodeCount:O(`Number of nodes in the original node tree when the response carries one.`)},[`wallClockMs`,`runnerRoundTrips`]),bc=w({diagnosticRef:D(`Opaque non-@ diagnostic token. Never a snapshot ref: not issued via refsGeneration and cannot be pinned or reused as an @ref target. UTF-8 truncated to 256 bytes.`),role:D(`UTF-8 truncated to 256 bytes.`),label:D(`UTF-8 truncated to 256 bytes.`)},[`diagnosticRef`]),xc={type:`object`,description:`Pre-action disclosure of how the acting path resolved its target. Absent when resolutionDisclosure is inapplicable for the path.`,oneOf:[w({source:E(`runtime`),phase:E(`pre-action`),kind:E(`unique`)},[`source`,`phase`,`kind`]),w({source:E(`runtime`),phase:E(`pre-action`),kind:E(`disambiguated`),matchCount:O(`Total matches resolveSelectorChain found before disambiguation.`),winnerDiagnostic:bc,tiebreak:T([`visible`,`deepest`,`smallest-area`,`structural-equivalence`],`The comparison that decided the winner.`),alternatives:{type:`array`,description:`At most 5 losing candidates, document order. Present at default/full response levels and omitted in digest. The winner is never included.`,items:bc}},[`source`,`phase`,`kind`,`matchCount`,`winnerDiagnostic`,`tiebreak`]),w({source:E(`ref`),phase:E(`pre-action`),kind:E(`exact`)},[`source`,`phase`,`kind`]),w({source:E(`ref`),phase:E(`pre-action`),kind:E(`label-fallback`)},[`source`,`phase`,`kind`]),w({source:E(`direct-ios`),kind:E(`not-observed`)},[`source`,`kind`])]};function Sc(e={}){let t=e.properties??{},n=e.required??[];return w({targetKind:T([`point`,`ref`,`selector`],`Resolved interaction target kind.`),x:O(`Resolved interaction x coordinate when available.`),y:O(`Resolved interaction y coordinate when available.`),referenceWidth:O(`Reference frame width for visualizing the interaction point.`),referenceHeight:O(`Reference frame height for visualizing the interaction point.`),ref:D(`Snapshot ref without the @ prefix when the target was an @ref.`),selector:D(`Selector expression when the target was a selector.`),selectorChain:xr(),refLabel:D(),targetHittable:k(),hint:D(),warning:D(),message:D(),evidence:vc,resolution:xc,cost:yc,maestroNonHittableCoordinateFallbackAllowed:k(`Whether the direct iOS Maestro coordinate fallback was allowed for this selector.`),maestroNonHittableCoordinateFallbackUsed:k(`Whether the direct iOS Maestro coordinate fallback was actually used.`),maestroFallbackReason:E(`non-hittable-coordinate`),...t},[`targetKind`,...n])}const Cc=Sc({properties:{evidence:vc,button:T([`secondary`,`middle`]),count:O(`Number of press/click repetitions.`),intervalMs:O(`Delay between repeated press/click actions.`),holdMs:O(`Hold duration for each action.`),jitterPx:O(`Randomization radius in pixels.`),doubleTap:k(`Whether the command requested a double-tap action.`)}}),wc={text:D(`Text submitted to the field.`),delayMs:O(`Delay between typed characters in milliseconds.`),evidence:vc},Tc=w({resourceId:yr(`Identifier of the exact field that changed: Android resource id or Apple accessibility identifier.`),className:yr(`Type of the exact field that changed: Android class name or Apple element type.`),packageName:yr(`App that owns the exact field: Android package name or Apple bundle id.`),rect:w({x:O(),y:O(),width:O(),height:O()},[`x`,`y`,`width`,`height`],`Screen-space rectangle of the exact field that changed.`)},[`resourceId`,`className`,`packageName`,`rect`],`Target identity captured before fill and matched after fill.`),Ec={press:Cc,click:Cc,fill:{type:`object`,description:`Fill response. Target-bound unconfirmed evidence reports an observed value different from the requested text. It does not establish that formatting preserved the input; assert the expected value or resulting screen before continuing.`,oneOf:[{...Sc({properties:wc,required:[`text`]}),not:w({},[`verification`])},Sc({properties:{...wc,verification:E(`unconfirmed`),requested:D(`Literal text requested by the fill command.`),before:yr(`Raw target text captured before the fill.`),after:yr(`Raw target text captured after the fill.`),target:Tc},required:[`text`,`verification`,`requested`,`before`,`after`,`target`]})]},longpress:Sc({properties:{durationMs:O(),gesture:E(`longpress`)}}),hover:Sc({properties:{gesture:E(`hover`)}}),find:w({ref:D(`Snapshot ref without the @ prefix when the find action returns one.`),refsGeneration:O(`ADR 0014 ref frame epoch for read-only find actions.`),found:k(`Whether a wait/exists/read-only find satisfied its condition.`),waitedMs:O(`Milliseconds waited for a read-only find condition.`),text:D(`Text value returned by find get_text.`),node:A(`Snapshot node for find get_attrs/get_text.`),matches:{type:`array`,description:`Every match for the read-only find list action (#1625): { ref, node } each.`,items:A(`One listed match with its snapshot ref and node.`)},locator:D(`Locator kind used for the find action.`),query:D(`Query argument used for the find action.`),x:O(`Resolved x coordinate for mutating find actions.`),y:O(`Resolved y coordinate for mutating find actions.`),message:D(`Diagnostic message for mutating find actions.`),cost:yc},[],`Daemon response data for the find command.`)},Y={get:{usageOverride:`get text|attrs <@ref|selector>`,usageFlags:[],positionalArgs:[`subcommand`,`target`],allowsExtraPositionals:!0,allowedFlags:[...Ii,`record`]},find:{usageOverride:`find <locator|text> <action> [value] [--first|--last]`,usageFlags:[],positionalArgs:[`query`,`action`,`value?`],allowsExtraPositionals:!0,allowedFlags:[`snapshotDepth`,`snapshotRaw`,`findFirst`,`findLast`,`record`]},is:{positionalArgs:[`predicate`,`selector`,`value?`],allowsExtraPositionals:!0,allowedFlags:[...Ii,`record`]},click:{usageOverride:`click <x y|@ref|selector>`,usageFlags:[],positionalArgs:[`target`],allowsExtraPositionals:!0,allowedFlags:[...zi,`clickButton`,...ms(`click`),...Ii]},press:{usageOverride:`press <x y|@ref|selector>`,usageFlags:[],positionalArgs:[`targetOrX`,`y?`],allowsExtraPositionals:!0,allowedFlags:[...zi,...ms(`press`),...Ii]},longpress:{usageOverride:`longpress <x y|@ref|selector> [durationMs]`,usageFlags:[],positionalArgs:[`targetOrX`,`yOrDurationMs?`,`durationMs?`],allowsExtraPositionals:!0,allowedFlags:[...ms(`longpress`),...Ii]},hover:{usageOverride:`hover <x y|@ref|selector>`,usageFlags:[],positionalArgs:[`targetOrX`,`y?`],allowsExtraPositionals:!0,allowedFlags:[...ms(`hover`),...Ii]},swipe:{positionalArgs:[`x1`,`y1`,`x2`,`y2`],allowsExtraPositionals:!0,allowedFlags:[`count`,`pauseMs`,`pattern`]},gesture:{usageOverride:`gesture <pan|fling|swipe|pinch|rotate|transform|drag> ...`,usageFlags:[],listUsageOverride:`gesture <pan|fling|swipe|pinch|rotate|transform|drag> ...`,positionalArgs:[`pan|fling|swipe|pinch|rotate|transform|drag`,`args?`],allowsExtraPositionals:!0,allowedFlags:[`pointerCount`]},focus:{positionalArgs:[`x`,`y`]},type:{positionalArgs:[`text`],allowsExtraPositionals:!0,allowedFlags:[`delayMs`]},fill:{usageOverride:`fill <x> <y> <text> | fill <@ref|selector> <text> | fill <x y|@ref|selector> --text-stdin`,usageFlags:[],positionalArgs:[`targetOrX`,`yOrText`,`text?`],allowsExtraPositionals:!0,allowedFlags:[...Ii,`delayMs`,`recordAs`,`textStdin`,...ms(`fill`)]},scroll:{usageOverride:`scroll <direction|top|bottom> [amount]`,usageFlags:[`until`,`pixels`,`durationMs`,`settle`],positionalArgs:[`directionOrEdge`,`amount?`],allowedFlags:[`pixels`,`durationMs`,`until`,...ms(`scroll`)]}},Dc=V({name:`interaction`,clientSurface:!1,commands:[B({name:`click`,text:{summary:`Click or tap a UI target`},metadata:X(`click`),run:(e,t)=>e.interactions.click(Oc(t)),cliSchema:Y.click,cliReader:K.click,daemonWriter:q.click,cliOutputFormatter:J.click}),B({name:`press`,text:{summary:`Short-press a UI target`,cliDetail:`The hold duration is positional on longpress, not press --hold-ms.`},metadata:X(`press`),run:(e,t)=>e.interactions.press(kc(t)),cliSchema:Y.press,cliReader:K.press,daemonWriter:q.press,cliOutputFormatter:J.press}),B({name:`fill`,text:{summary:`Replace text in a UI input`,cliDetail:`Every positional after an @ref is the replacement text, so fill @e57 good morning enters "good morning"; quote the text when the shell must preserve exact whitespace. Clear a field with an empty text argument: fill @e57 "" (the argument must be present — fill @e57 alone is a missing argument, not a clear). When visible label text also matches a non-input element, constrain the target with editable=true, for example fill 'label="Email" editable=true' "qa@example.com". To keep a secret out of argv, omit the text and pipe it in: printf %s "$PASSWORD" | fill @e57 --text-stdin (max 64 KiB, one trailing newline removed).`},metadata:X(`fill`),run:(e,t)=>e.interactions.fill(Ac(t)),cliSchema:Y.fill,cliReader:K.fill,daemonWriter:q.fill,cliOutputFormatter:J.fill}),B({name:`longpress`,text:{summary:`Hold a UI target to open a context menu`,cliDetail:`Duration is positional, for example longpress @e12 800 or longpress 300 500 800.`},metadata:X(`longpress`),run:(e,t)=>e.interactions.longPress(jc(t)),cliSchema:Y.longpress,cliReader:K.longpress,daemonWriter:q.longpress,cliOutputFormatter:J.longpress}),B({name:`hover`,text:{summary:`Hover the pointer over a UI target (web only)`,cliDetail:`The pointer stays where hover left it: read the revealed UI (--settle or snapshot -i) and act on it before another click or hover moves the pointer away.`},metadata:X(`hover`),run:(e,t)=>e.interactions.hover(Mc(t)),cliSchema:Y.hover,cliReader:K.hover,daemonWriter:q.hover,cliOutputFormatter:J.hover}),B({name:`swipe`,text:{summary:`Fling between coordinates`},metadata:X(`swipe`),run:(e,t)=>e.interactions.swipe(t),cliSchema:Y.swipe,cliReader:K.swipe,daemonWriter:q.swipe}),B({name:`focus`,text:{summary:`Focus input at screen coordinates`},metadata:X(`focus`),run:(e,t)=>e.interactions.focus(t),cliSchema:Y.focus,cliReader:K.focus,daemonWriter:q.focus}),B({name:`type`,text:{summary:`Append text to the focused input`},metadata:X(`type`),run:(e,t)=>e.interactions.type(t),cliSchema:Y.type,cliReader:K.type,daemonWriter:q.type}),B({name:`scroll`,text:{summary:`Scroll in a direction or to an edge`},metadata:X(`scroll`),run:(e,t)=>e.interactions.scroll(t),cliSchema:Y.scroll,cliReader:K.scroll,daemonWriter:q.scroll,cliOutputFormatter:J.scroll}),B({name:`get`,text:{summary:`Read element text or attributes`},metadata:X(`get`),run:(e,t)=>e.interactions.get(Pc(t)),cliSchema:Y.get,cliReader:K.get,daemonWriter:q.get,cliOutputFormatter:J.get}),B({name:`is`,text:{summary:`Check a UI predicate on a selector`},metadata:X(`is`),run:(e,t)=>e.interactions.is(t),cliSchema:Y.is,cliReader:oc.is,daemonWriter:sc.is,cliOutputFormatter:J.is}),B({name:`find`,text:{summary:`Find an element and act`},metadata:X(`find`),run:(e,t)=>e.interactions.find(t),cliSchema:Y.find,cliReader:oc.find,daemonWriter:sc.find,cliOutputFormatter:J.find}),B({name:`gesture`,text:{summary:`Run pan, fling, swipe, pinch, rotate, transform, or drag gestures`,cliDetail:`Argument shapes: pan <x> <y> <dx> <dy> [durationMs], fling <up|down|left|right> <x> <y> [distance], swipe <left|right|left-edge|right-edge>, pinch <scale> [x] [y], rotate <degrees> [x] [y], transform <x> <y> <dx> <dy> <scale> <degrees> [durationMs], or drag <source-selector|pinned-ref> <destination-selector|pinned-ref> [sourceHoldMs] [moveMs] [destinationHoldMs]. For command plans, output only command lines. Android transform verification should use all app-observable effects, for example wait text "pan changed yes", wait text "pinch changed yes", and wait text "rotate changed yes", not exact transform values.`},metadata:X(`gesture`),run:async(e,t)=>{switch(t.kind){case`pan`:return await e.interactions.pan(Fc(t));case`fling`:return await e.interactions.fling(Lc(t));case`swipe`:return await e.interactions.swipeGesture(Rc(t));case`pinch`:return await e.interactions.pinch(zc(t));case`rotate`:return await e.interactions.rotateGesture(Bc(t));case`transform`:return await e.interactions.transformGesture(Vc(t));case`drag`:return await e.interactions.drag(Ic(t))}},cliSchema:Y.gesture,cliReader:Fs.gesture,daemonWriter:Is.gesture})]});function X(e){let t=Ns.find(t=>t.name===e);if(!t)throw Error(`Missing interaction command metadata for ${e}`);return t}function Oc(e){return{...kc(e),button:e.button}}function kc(e){return{...m(e),...Vr(e.target),...Wr(e),...Ur(e),verify:e.verify,readinessTimeoutMs:e.readinessTimeoutMs,...Nc(e)}}function Ac(e){return{...m(e),...Vr(e.target),...Wr(e),text:e.text,delayMs:e.delayMs,recordAs:e.recordAs,textStdin:e.textStdin,verify:e.verify,...Nc(e)}}function jc(e){return{...m(e),...Vr(e.target),...Wr(e),durationMs:e.durationMs,readinessTimeoutMs:e.readinessTimeoutMs,...Nc(e)}}function Mc(e){return{...m(e),...Vr(e.target),...Wr(e),...Nc(e)}}function Nc(e){return{settle:e.settle,settleQuietMs:e.settleQuietMs,timeoutMs:e.timeoutMs}}function Pc(e){return{...m(e),...Hr(e.target),...Wr(e),format:e.format,record:e.record}}function Fc(e){return{...m(e),x:e.origin.x,y:e.origin.y,dx:e.delta.x,dy:e.delta.y,pointerCount:e.pointerCount,durationMs:e.durationMs}}function Ic(e){return{...m(e),source:e.source,destination:e.destination,sourceHoldMs:e.sourceHoldMs,moveMs:e.moveMs,destinationHoldMs:e.destinationHoldMs}}function Lc(e){return{...m(e),direction:e.direction,x:e.origin.x,y:e.origin.y,distance:e.distance}}function Rc(e){return{...m(e),preset:e.preset}}function zc(e){return{...m(e),scale:e.scale,x:e.origin?.x,y:e.origin?.y}}function Bc(e){return{...m(e),degrees:e.degrees,x:e.origin?.x,y:e.origin?.y}}function Vc(e){return{...m(e),x:e.origin.x,y:e.origin.y,dx:e.delta.x,dy:e.delta.y,scale:e.scale,degrees:e.degrees,durationMs:e.durationMs}}async function Hc(e){let{serializeDevice:t}=await import(`./result-serialization.js`).then(e=>e.t);return{data:{devices:e.map(t)},text:e.map(nl).join(`
|
|
20
|
+
`)}}async function Uc(e){let{serializeDevice:t}=await import(`./result-serialization.js`).then(e=>e.t);return{data:{device:t(e.device),availableCommands:e.availableCommands},text:[`${nl(e.device)} supports ${e.availableCommands.length} commands:`,e.availableCommands.join(` `)].join(`
|
|
21
|
+
`)}}function Wc(e){return{data:{apps:e.result},stderr:e.appsFilter===`all`?`Showing all apps, including system apps.
|
|
22
|
+
`:`Showing user-installed apps or deferred provider app assets. Use --all to include system apps on a live device.
|
|
23
|
+
`,text:e.result.length>0?e.result.join(`
|
|
24
|
+
`):e.appsFilter===`all`?`No apps found.`:`No user apps or provider app assets found.`}}async function Gc(e){if(`savedScript`in e)return{data:e,text:`Published script: ${e.savedScript}\nSession remains active: ${e.session}\nActions: ${e.actionCount}`};if(`stateDir`in e)return{data:e,text:e.stateDir};let{serializeSessionListEntry:t}=await import(`./result-serialization.js`).then(e=>e.t),n={sessions:e.sessions.map(t)};return{data:n,text:JSON.stringify(n,null,2)}}async function Kc(e){let{serializeOpenResult:t}=await import(`./result-serialization.js`).then(e=>e.t),n=t(e),r=[te(n)].filter(e=>!!e);typeof n.sessionStateDir==`string`&&r.push(`Session state: ${n.sessionStateDir}`);for(let t of e.warnings??[])r.push(`Warning: ${t}`);let i=await qc(e.snapshot);return i&&(n.snapshot=i.jsonData??i.data,i.text&&r.push(i.text)),{data:n,...i?.stderr?{stderr:i.stderr}:{},text:r.join(`
|
|
25
|
+
`)||null}}async function qc(e){return!e||!Array.isArray(e.nodes)?null:await Io({result:e,interactiveOnly:!0})}async function Jc(e){let{serializeCloseResult:t}=await import(`./result-serialization.js`).then(e=>e.t);return ei(t(e))}function Yc(e){if(Xc(e))return{data:e,text:e.artifacts.length>0?e.artifacts.map(il).join(`
|
|
26
|
+
`):e.message??`No daemon artifacts available.`};let t=[e.message??`No cloud artifacts available for ${e.provider}.`],n=al(e);return n&&t.push(`Retry: ${n}`),{data:e,text:e.cloudArtifacts.length>0?e.cloudArtifacts.map(rl).join(`
|
|
27
|
+
`):t.join(`
|
|
28
|
+
`)}}function Xc(e){return`source`in e&&e.source===`daemon`}async function Zc(e){let{serializeDeployResult:t}=await import(`./result-serialization.js`).then(e=>e.t);return ei(t(e))}async function Qc(e){let{serializeInstallFromSourceResult:t}=await import(`./result-serialization.js`).then(e=>e.t);return ei(t(e))}function $c(e){let t=e,n=t.platform??`unknown`;return{data:t,text:`Boot ready: ${t.device??t.id??`unknown`} (${n})`}}function el(e){let t=e,n=t.platform??`unknown`,r=t.device??t.id??`unknown`,i=t.shutdown;return{data:t,text:`${i&&typeof i==`object`&&`success`in i&&i.success===!0?`Shutdown`:`Shutdown failed`}: ${r} (${n})`}}async function tl(e,t){let{formatDoctorCheckDetailLines:n,formatDoctorCheckSummaryLine:r}=await import(`./doctor-lines.js`).then(e=>e.t),i=e,a=[`Doctor: ${typeof i.status==`string`?i.status:`unknown`}`],o=ol(i.checks);if(t?.renderedToStderr){let e=typeof i.summary==`string`?i.summary:void 0;e&&a.push(e)}else if(o.length===0){let e=typeof i.summary==`string`?i.summary:`No blockers found.`;a.push(e)}else for(let e of o)a.push(r(e)),a.push(...n(e));return{data:i,text:a.join(`
|
|
29
|
+
`)}}const Z={boot:H($c),shutdown:H(el),devices:H(Hc),capabilities:H(Uc),doctor:({result:e,progress:t})=>tl(e,t),apps:({input:e,result:t})=>Wc({result:t,appsFilter:e.appsFilter}),session:H(Gc),artifacts:H(Yc),open:H(Kc),close:H(Jc),install:H(Zc),reinstall:H(Zc),"install-from-source":H(Qc),prepare:U,viewport:U};function nl(e){let t=e.kind?` ${e.kind}`:``,n=e.target?` target=${e.target}`:``,r=e.model?` model=${JSON.stringify(e.model)}`:``,i=e.osVersion?` os=${e.osVersion}`:``,a=typeof e.booted==`boolean`?` booted=${e.booted}`:``,o=e.claimedBy?` claimed by session "${e.claimedBy.session}" in ${e.claimedBy.workspace}`:``;return`${e.name} (${e.platform}${t}${n}${r}${i})${a}${o}`}function rl(e){let t=e.url?` ${e.url}`:``,n=e.availability?` ${e.availability}`:``;return`${e.kind}: ${e.name}${n}${t}`}function il(e){let t=e.artifactType?` (${e.artifactType})`:``;return`${e.filename}${t}: ${e.mimeType} ${e.sizeBytes} bytes id=${e.id}`}function al(e){if(e.providerSessionId)return`agent-device artifacts ${e.providerSessionId} --provider ${e.provider} --json`}function ol(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&!Array.isArray(e)):[]}const sl=B({name:`artifacts`,text:{summary:`List daemon or cloud provider session artifacts`},metadata:z(`artifacts`,`List daemon or cloud provider artifacts for an active or completed session.`,{provider:M(`Cloud provider name, for example browserstack, aws-device-farm, or testmu.`),providerSessionId:M(`Cloud provider session id or ARN.`)}),run:(e,t)=>e.sessions.artifacts(t),cliSchema:{usageOverride:`artifacts [provider-session-id]`,usageFlags:[`provider`],positionalArgs:[`provider-session-id?`],allowedFlags:[`provider`,`providerSessionId`]},cliReader:(e,t)=>({..._(t),provider:t.provider,providerSessionId:e[0]??t.providerSessionId}),daemonWriter:h(u.artifacts),cliOutputFormatter:Z.artifacts});function cl(e){let{metroHost:t,metroPort:n,bundleUrl:r,launchUrl:i}=e;if(t!==void 0||n!==void 0||r!==void 0||i!==void 0)return{metroHost:t,metroPort:n,bundleUrl:r,launchUrl:i}}function ll(e){let{metroHost:t,metroPort:n,bundleUrl:r,launchUrl:i,...a}=e,o=cl({metroHost:t,metroPort:n,bundleUrl:r,launchUrl:i});return o?{...a,runtime:o}:a}const ul=z(`apps`,`List the apps installed on the selected device. Include system or OEM apps only when they are needed as automation targets.`,{appsFilter:I([`user-installed`,`all`],`Restrict the listing to user-installed apps, or include system and OEM apps.`)}),dl=z(`open`,`Boot the selected device when needed, then open an app, deep link, or URL in a session. Use the app or URL inputs to choose what becomes the foreground automation target.`,{app:M(`App name, bundle id, package, or URL.`),url:M(`Optional URL passed with an app shell.`),surface:I(Nt,`macOS presentation surface to open: the app itself, the frontmost app, the desktop, or the menu bar.`),activity:M(`Android activity name.`),launchConsole:M(`Launch console mode.`),launchArgs:kr(`Launch arguments forwarded verbatim to the platform launch command.`),relaunch:F(`Force relaunch.`),timeoutMs:P(`Startup budget in milliseconds. Bounds the Simulator boot wait, so a never-booted Simulator can finish its first-boot migration; omit for the default startup behavior.`,{min:1}),waitMs:wr(`waitMs`),foreground:wr(`foreground`),saveScript:L({oneOf:[k(),D()]}),force:F(`Overwrite an existing --save-script target instead of refusing (alias: --overwrite).`),testIme:F(`Activate the headless Android test IME for deterministic Unicode text entry (default on for emulators; opt-in on real devices).`),noRecord:F(`Do not record this action.`),metroHost:M(`Session-scoped Metro/debug host hint applied to the opened app.`),metroPort:P(`Session-scoped Metro/debug port hint applied to the opened app. On an emulator/simulator the host defaults to the loopback alias (Android 10.0.2.2, iOS 127.0.0.1) when --metro-host is omitted; physical devices still require an explicit --metro-host.`,{min:1,max:65535}),bundleUrl:M(`Session-scoped bundle URL hint applied to the opened app.`),launchUrl:M(`Launch URL for the opened app; does not select the server used by metro reload.`)}),fl=z(`close`,`Close the named app, or close the active session app when app is omitted. Use shutdown only when the selected simulator or emulator should also stop.`,{app:M(`Optional app to close.`),shutdown:F(`Shutdown the session/device where supported.`),saveScript:L({oneOf:[k(),D()]}),force:F(`Overwrite an existing --save-script target instead of refusing (alias: --overwrite).`)});function pl(e){return ll(e)}const ml={allowedFlags:[`appsFilter`]},hl={positionalArgs:[`appOrUrl?`,`url?`],allowedFlags:[`activity`,`launchConsole`,`launchArgs`,`testIme`,`saveScript`,`force`,`noRecord`,`relaunch`,`foreground`,`timeoutMs`,`waitMs`,`surface`,...Ri,`launchUrl`]},gl={positionalArgs:[`app?`],allowedFlags:[`saveScript`,`force`,`shutdown`]},_l=(e,t)=>({..._(t),appsFilter:un(t.appsFilter)}),vl=(e,t)=>({..._(t),app:e[0],url:e[1],surface:t.surface,activity:t.activity,launchConsole:t.launchConsole,launchArgs:t.launchArgs,relaunch:t.relaunch,foreground:t.foreground,timeoutMs:t.timeoutMs,waitMs:t.waitMs,saveScript:t.saveScript,force:t.force,testIme:t.testIme,noRecord:t.noRecord,metroHost:t.metroHost,metroPort:t.metroPort,bundleUrl:t.bundleUrl,launchUrl:t.launchUrl}),yl=(e,t)=>({..._(t),app:e[0],shutdown:t.shutdown,saveScript:t.saveScript,force:t.force}),bl=h(u.apps),xl=h(u.open,Dl),Sl=h(u.close,e=>b(e.app)),Cl=B({name:`apps`,text:{summary:`List installed apps or deferred provider app assets`,cliDetail:`Before provider allocation, lists uploaded app assets when the selected provider exposes a catalog. On a live device, defaults to user-installed apps; use --all to include system/OEM apps.`},metadata:ul,run:(e,t)=>e.apps.list(t),cliSchema:ml,cliReader:_l,daemonWriter:bl,cliOutputFormatter:Z.apps}),wl=B({name:`open`,text:{summary:`Open an app, deep link or URL, save replays`,cliDetail:`Use --platform to bind URL/deep-link opens to the target platform. For iOS simulator initial stdout/stderr, put --launch-console <path> on this open command, for example agent-device open "Agent Device Tester" --platform ios --launch-console artifacts/launch-console.log. Expo Go/dev-client shells accept host + URL, for example agent-device open "Expo Go" exp://127.0.0.1:8081 --platform ios. macOS also supports --surface app|frontmost-app|desktop|menubar. --metro-host/--metro-port/--bundle-url choose the app's Metro server and save that address for later metro reload calls in the same session. A fresh open without Metro hints clears an older same-name binding; close also clears it. --launch-url supplies the app's launch URL; it does not select the reload server. On an iOS simulator without --launch-url, open connects a detected Expo development client through its expo-development-client URL. The app must declare a single exp+<slug> scheme that no other installed app owns. If detection is inconclusive, the app opens normally. Bare React Native apps receive their server settings before launch. On an iOS simulator, when --launch-url raises an "Open in <App>?" prompt that keeps open from seeing the app, open accepts it if the URL scheme belongs to the session app (data.launchConfirmation: "accepted"); if the scheme belongs to another installed app, the prompt stays on screen and open fails with details.reason launch_confirmation_foreign_app; if no single installed app owns the scheme, the prompt stays on screen and open returns as usual. The prompt is read whenever open cannot see the app afterwards, including on a slow host where the app's target discovery fails on its own deadline. When an accept leaves the app provably not running, open hands the same URL over once more and reads again; still not running, it fails with details.reason launch_confirmation_unanswered. A recognized prompt still visible after a failed accept also fails with this reason, even if the app is running behind it; answer it with alert accept or alert dismiss. A simulator openurl that CoreSimulator never answers fails within 20s with details.reason ios-simulator-openurl-timeout. Only the English prompt title with Cancel and Open buttons is recognized, so on a Simulator set to another language the prompt stays on screen. A prompt that appears after open has already seen the app is not answered; use alert accept. A device another session is holding refuses at once; add --wait <ms> to block up to that budget for it and only then fail with DEVICE_IN_USE naming the owning session.`,mcpDetail:`metroHost, metroPort, and bundleUrl choose the app's Metro server and save its address for later reloads. launchUrl selects the app's launch URL and does not select the reload server. A fresh open without Metro hints clears an older same-name binding; close also clears it.`},metadata:dl,run:(e,t)=>e.apps.open(pl(t)),cliSchema:hl,cliReader:vl,daemonWriter:xl,cliOutputFormatter:Z.open}),Tl=B({name:`close`,text:{summary:`Close an app or end the session`},metadata:fl,run:(e,t)=>t.app?e.apps.close(t):e.sessions.close(El(t)),cliSchema:gl,cliReader:yl,daemonWriter:Sl,cliOutputFormatter:Z.close});function El(e){let{app:t,...n}=e;return n}function Dl(e){return e.app?e.url?[e.app,e.url]:[e.app]:[]}const Ol={platform:T(rt),target:T(at),device:D(`Human-readable device name.`),id:D(`Stable device id.`),kind:T(ot)},kl=[`platform`,`target`,`device`,`id`,`kind`],Al=w({success:k(),exitCode:O(),stdout:D(),stderr:D(),error:A(`Normalized error detail when shutdown failed.`)},[`success`,`exitCode`,`stdout`,`stderr`]),jl={boot:w({...Ol,booted:{type:`boolean`,const:!0}},[...kl,`booted`]),shutdown:w({...Ol,shutdown:Al},[...kl,`shutdown`])},Ml=z(`devices`,`List available devices and simulators that can be selected for automation. Use platform, device, udid, or serial inputs on later commands to target one result.`,{}),Nl=z(`capabilities`,`List the commands supported by the selected device or active session. Use device-selection inputs when checking support before a session is open.`,{}),Pl=z(`boot`,`Boot or prepare the selected device or simulator so later commands can target it. The device is chosen through the device-selection inputs, not by naming it here.`,{headless:F(`Boot without showing simulator UI when supported.`),timeoutMs:P(`Startup budget in milliseconds. Bounds the boot wait, so a never-booted Simulator can finish its first-boot migration or a cold emulator its boot; omit for the default startup behavior.`,{min:1})}),Fl=z(`shutdown`,`Shutdown a selected simulator or emulator.`,{}),Il={allowedFlags:[`headless`,`timeoutMs`]},Ll={},Rl={},zl={},Bl=(e,t)=>_(t),Vl=(e,t)=>({..._(t),headless:t.headless,timeoutMs:t.timeoutMs}),Hl=h(u.devices),Ul=h(u.capabilities),Wl=h(u.boot),Gl=h(u.shutdown),Kl=[B({name:`devices`,text:{summary:`List available devices and simulators`},metadata:Ml,run:(e,t)=>e.devices.list(t),cliSchema:Ll,cliReader:Bl,daemonWriter:Hl,cliOutputFormatter:Z.devices}),B({name:`capabilities`,text:{summary:`List supported commands for the selected device`,cliDetail:`Select an explicit target with --platform/--device/--udid/--serial.`},metadata:Nl,run:(e,t)=>e.devices.capabilities(t),cliSchema:Rl,cliReader:Bl,daemonWriter:Ul,cliOutputFormatter:Z.capabilities}),B({name:`boot`,text:{summary:`Boot target device/simulator`},metadata:Pl,run:(e,t)=>e.devices.boot(t),cliSchema:Il,cliReader:Vl,daemonWriter:Wl,cliOutputFormatter:Z.boot}),B({name:`shutdown`,text:{summary:`Shutdown target simulator/emulator`},metadata:Fl,run:(e,t)=>e.devices.shutdown(t),cliSchema:zl,cliReader:Bl,daemonWriter:Gl,cliOutputFormatter:Z.shutdown})],ql={doctor:w({status:T([`pass`,`warn`,`fail`,`info`]),summary:D(),kind:T([`auto`,`react-native`,`expo`,`repack`]),platform:D(),target:T(at),targetApp:D(),metro:w({host:D(),port:O()},[`host`,`port`]),checks:{type:`array`,items:w({id:D(),status:T([`pass`,`warn`,`fail`,`info`]),summary:D(),hint:D(),command:D(),evidence:A()},[`id`,`status`,`summary`])}},[`status`,`summary`,`kind`,`checks`])},Jl=B({name:`doctor`,text:{summary:`Diagnose device, app, dev-server, and RN/Expo readiness`,cliDetail:`Metro reachability is inferred from cwd/runtime. On iOS simulators it also warms the XCTest runner build cache in the background when missing. Pass --app to verify a target app on the one matching booted device without opening a session. Use --remote to check remote connection setup without probing local devices. Default output is compact; use --json for full checks and evidence.`,mcpDetail:`On iOS simulators it also warms the XCTest runner build cache in the background when missing, so run it before the first Apple snapshot or interaction of a session.`},metadata:z(`doctor`,`Diagnose device, app, development-server, and React Native or Expo readiness issues. Returns compact evidence for local inventory, sessions, optional app discovery, toolchains, and server reachability.`,{targetApp:M(`Installed app package/bundle id or app name to verify without opening a session.`),remote:F(`Check remote connection setup instead of local device inventory.`)}),run:(e,t)=>e.command.doctor(t),cliSchema:{usageOverride:`doctor [--platform ios|android|harmonyos|vega|macos|linux|web|apple]`,allowedFlags:[`targetApp`,`remote`]},cliReader:(e,t)=>({..._(t),targetApp:t.targetApp,remote:t.remote}),daemonWriter:h(u.doctor),cliOutputFormatter:Z.doctor});function Yl(e,t=`--github-actions-artifact`){let n=e.indexOf(`:`);if(n<=0||n===e.length-1)throw new r(`INVALID_ARGS`,`${t} must use owner/repo:artifact, for example thymikee/RNCLI83:6635342232`);let{owner:i,repo:a}=Ql(e.slice(0,n),t);return Zl(i,a,e.slice(n+1),`${t} artifact`)}function Xl(e,t){if(!e||typeof e!=`object`||Array.isArray(e))throw new r(`INVALID_ARGS`,`${t} installSource must be an object.`);let n=e;if(eu(n.type,`${t} installSource.type`)!==`github-actions-artifact`)throw new r(`INVALID_ARGS`,`${t} installSource.type must be "github-actions-artifact".`);let{owner:i,repo:a}=Ql(eu(n.repo,`${t} installSource.repo`),`${t} installSource.repo`);return Zl(i,a,n.artifact,`${t} installSource.artifact`)}function Zl(e,t,n,r){return typeof n==`number`||nu(n)?{kind:`github-actions-artifact`,owner:e,repo:t,artifactId:tu(n,r)}:{kind:`github-actions-artifact`,owner:e,repo:t,artifactName:eu(n,r)}}function Ql(e,t){let n=e.indexOf(`/`);if(n<=0||n===e.length-1||e.indexOf(`/`,n+1)!==-1)throw new r(`INVALID_ARGS`,`${t} must use owner/repo.`);let i={owner:e.slice(0,n).trim(),repo:e.slice(n+1).trim()};if(!i.owner||!i.repo)throw new r(`INVALID_ARGS`,`${t} must use owner/repo.`);return i}function $l(e){return typeof e==`string`&&e.trim().length>0?e.trim():void 0}function eu(e,t){let n=$l(e);if(!n)throw new r(`INVALID_ARGS`,`${t} must be a non-empty string.`);return n}function tu(e,t){let n=typeof e==`number`?e:typeof e==`string`?Number(e):NaN;if(!Number.isInteger(n))throw new r(`INVALID_ARGS`,`${t} must be an integer.`);return n}function nu(e){return typeof e==`string`&&/^\d+$/.test(e.trim())}const ru=z(`install`,`Install an app binary from a local path. Provide an app identifier with the path when the target needs explicit app selection; use reinstall to replace an already installed app.`,{app:M(`Optional app identifier hint.`),appPath:j(M(`Path to app binary.`))}),iu=z(`reinstall`,`Replace an installed app with a binary from a local path. Use this when preserving the same app identity while installing a new build on the selected device.`,{app:j(M()),appPath:j(M(`Path to app binary.`))}),au=z(`install-from-source`,`Install app builds from URLs, remote source specs, or CI artifacts resolved by a remote daemon.`,{source:j(L(A(`Install source object.`))),retainPaths:F(),retentionMs:P()}),ou={usageOverride:`install <path> | install <app> <path>`,listUsageOverride:`install <path>`,positionalArgs:[`appOrPath`,`path?`]},su={positionalArgs:[`app`,`path`]},cu={usageOverride:`install-from-source <url> | install-from-source --github-actions-artifact <owner/repo:artifact>`,usageFlags:[],listUsageOverride:`install-from-source`,positionalArgs:[`url?`],allowedFlags:[`header`,`githubActionsArtifact`,`installSource`,`retainPaths`,`retentionMs`]},lu=(e,t)=>hu(e,t),uu=(e,t)=>gu(e,t),du=(e,t)=>({..._(t),source:yu(e,t),retainPaths:t.retainPaths,retentionMs:t.retentionMs}),fu=h(u.install,e=>_u(e.app,e.appPath)),pu=h(u.reinstall,e=>vu(e.app,e.appPath)),mu=[B({name:`install`,text:{summary:`Install an app binary from a path`},metadata:ru,run:(e,t)=>e.apps.install(t),cliSchema:ou,cliReader:lu,daemonWriter:fu,cliOutputFormatter:Z.install}),B({name:`reinstall`,text:{summary:`Replace an installed app with a new build`},metadata:iu,run:(e,t)=>e.apps.reinstall(t),cliSchema:su,cliReader:uu,daemonWriter:pu,cliOutputFormatter:Z.reinstall}),B({name:`install-from-source`,text:{summary:`Install app builds from URLs or CI artifacts`},metadata:au,run:(e,t)=>e.apps.installFromSource(t),cliSchema:cu,cliReader:du,daemonWriter:e=>g(Be.installSource,[],{...e,installSource:e.source,retainMaterializedPaths:e.retainPaths,materializedPathRetentionMs:e.retentionMs}),cliOutputFormatter:Z[`install-from-source`]})];function hu(e,t){let[n,r]=e,i=r!==void 0;return{..._(t),...i?{app:S(n,`install requires app`)}:{},appPath:S(i?r:n,`install requires path`)}}function gu(e,t){return{..._(t),app:S(e[0],`reinstall requires app`),appPath:S(e[1],`reinstall requires path`)}}function _u(e,t){let n=C(t,`missing app path`);return typeof e==`string`&&e.length>0?[e,n]:[n]}function vu(e,t){return[C(e,`missing first positional`),C(t,`missing second positional`)]}function yu(e,t){let n=e[0]?.trim();if(e.length>1)throw new r(`INVALID_ARGS`,`install-from-source accepts either one <url> positional or --github-actions-artifact`);let i=t.githubActionsArtifact?Yl(t.githubActionsArtifact):void 0,a=t.installSource;if(+!!n+ +!!i+ +!!a!=1)throw new r(`INVALID_ARGS`,`install-from-source requires exactly one source: <url>, --github-actions-artifact, or config installSource`);if(!n&&t.header&&t.header.length>0)throw new r(`INVALID_ARGS`,`install-from-source --header is only supported for URL sources`);if(i)return i;if(a)return a;if(!bu(n))throw new r(`INVALID_ARGS`,`install-from-source <url> must be an http(s) URL: ${n}`,{hint:`Install a local build with install <app> <path>.`});return{kind:`url`,url:n,headers:xu(t.header)}}function bu(e){let t=URL.parse(e)?.protocol;return t===`http:`||t===`https:`}function xu(e){if(!e||e.length===0)return;let t={};for(let n of e){let e=n.indexOf(`:`);if(e<=0)throw new r(`INVALID_ARGS`,`Invalid --header value "${n}". Expected "name:value".`);let i=n.slice(0,e).trim(),a=n.slice(e+1).trim();if(!i)throw new r(`INVALID_ARGS`,`Invalid --header value "${n}". Header name cannot be empty.`);t[i]=a}return t}const Su=[`ios-runner`],Cu={prepare:w({action:E(`ios-runner`),platform:T(rt),deviceId:D(),deviceName:D(),kind:T(ot),durationMs:O(),runner:w({},[]),cache:T([`exact`,`miss`,`external`]),artifact:T([`valid`,`rebuilt`]),buildMs:O(),connectMs:O(),healthCheckMs:O(),xctestrunPath:D(),recoveryReason:D(),failureReason:D(),timing:w({totalMs:O(),additiveParts:w({buildMs:O(),connectAfterBuildMs:O(),healthCheckMs:O()},[`connectAfterBuildMs`,`healthCheckMs`]),containment:w({connectMs:{type:`array`,items:E(`buildMs`)},healthCheckMs:{type:`array`,items:D()}},[`healthCheckMs`]),note:D()},[`totalMs`,`additiveParts`,`containment`,`note`]),message:D()},[`action`,`platform`,`deviceId`,`deviceName`,`kind`,`durationMs`,`runner`,`connectMs`,`healthCheckMs`,`timing`,`message`])},wu=B({name:`prepare`,text:{summary:`Pre-warm platform helpers before automation`},metadata:z(`prepare`,`Prepare platform helper infrastructure. ios-runner builds/reuses, starts, and health-checks the XCTest runner so later Apple snapshots and interactions do not pay first-use startup cost. In JSON output, top-level buildMs/connectMs/healthCheckMs are diagnostic fields and may overlap; use timing.additiveParts for additive wall-clock phase totals. In CI, run it after boot/install and before replay/test; if replay/test starts a separate daemon, stop the prepare daemon before replay/test so it does not keep the prepared runner lease. It is not a recovery step for "runner already owned by another agent-device daemon"; stop the owning daemon on the Mac with simulator access instead. Runner build/start output is written to the session runner.log; daemon.log is for daemon lifecycle/startup issues.`,{action:j(I(Su)),timeoutMs:P(`Maximum wall-clock time for the prepare command.`)}),run:(e,t)=>e.command.prepare(t),cliSchema:{usageOverride:`prepare ios-runner --platform ios|macos`,listUsageOverride:`prepare`,positionalArgs:[`ios-runner`],allowedFlags:[`timeoutMs`]},cliReader:(e,t)=>({..._(t),action:S(e[0],`prepare requires subcommand`),timeoutMs:t.timeoutMs}),daemonWriter:h(u.prepare,e=>[C(e.action,`prepare requires subcommand`)]),cliOutputFormatter:Z.prepare}),Tu={push:{type:`object`,oneOf:[w({platform:E(`ios`),bundleId:D(),message:D()},[`platform`,`bundleId`,`message`]),w({platform:E(`android`),package:D(),action:D(),extrasCount:O(),message:D()},[`platform`,`package`,`action`,`extrasCount`,`message`])]},"trigger-app-event":w({event:D(),eventUrl:D(),transport:E(`deep-link`),message:D()},[`event`,`eventUrl`,`transport`,`message`])},Eu=z(`push`,`Deliver push notification payloads to an installed app.`,{app:j(M()),payload:j(L({oneOf:[D(),A()]}))}),Du=z(`trigger-app-event`,`Ask the app to handle an app-defined automation or test event, with an optional structured payload. Call this only for event names and payload shapes the app documents.`,{event:j(M(`Name of an app-defined automation or test event the app documents.`)),payload:Lu(`Structured payload passed to the event, in the shape the app documents for it.`)}),Ou={listUsageOverride:`push`,positionalArgs:[`bundleOrPackage`,`payloadOrJson`]},ku={usageOverride:`trigger-app-event <event> [payloadJson]`,listUsageOverride:`trigger-app-event`,positionalArgs:[`event`,`payloadJson?`]},Au=(e,t)=>({..._(t),app:S(e[0],`push requires bundleOrPackage`),payload:S(e[1],`push requires payloadOrJson`)}),ju=(e,t)=>({..._(t),event:S(e[0],`trigger-app-event requires event`),payload:e[1]?or(e[1],`trigger-app-event payload`):void 0}),Mu=h(u.push,e=>Fu(e)),Nu=h(u.triggerAppEvent,e=>Iu(e)),Pu=[B({name:`push`,text:{summary:`Deliver a push notification payload`},metadata:Eu,run:(e,t)=>e.apps.push(t),cliSchema:Ou,cliReader:Au,daemonWriter:Mu}),B({name:`trigger-app-event`,text:{summary:`Invoke an app-defined automation event`},metadata:Du,run:(e,t)=>e.apps.triggerEvent(t),cliSchema:ku,cliReader:ju,daemonWriter:Nu})];function Fu(e){return[e.app,typeof e.payload==`string`?e.payload:JSON.stringify(e.payload)]}function Iu(e){return[e.event,...e.payload?[JSON.stringify(e.payload)]:[]]}function Lu(e){return Or(e)}const Ru=B({name:`session`,text:{summary:`List sessions, show the state dir, or publish a script`},metadata:z(`session`,`List active sessions, print the effective daemon state directory, or publish an armed open-to-destination script without closing its session`,{action:I([`list`,`state-dir`,`save-script`],`list shows active sessions; state-dir prints the daemon state directory; save-script publishes an armed recording without teardown.`),path:M(`Optional .ad output path for save-script.`),force:F(`Atomically replace an existing save-script target.`)}),run:async(e,{action:t,path:n,force:r,...i})=>{let a=t??`list`;return Bu(a,n,r),a===`state-dir`?{stateDir:await e.sessions.stateDir(i)}:a===`save-script`?await e.sessions.saveScript({...i,path:n,force:r}):{sessions:await e.sessions.list(i)}},cliSchema:{usageOverride:`session list | session state-dir | session save-script [path] [--force]`,usageFlags:[],listUsageOverride:`session`,positionalArgs:[`list|state-dir|save-script?`,`path?`],allowedFlags:[`force`]},cliReader:(e,t)=>({..._(t),action:zu(e[0]),path:e[1],force:t.force}),cliOutputFormatter:Z.session});function zu(e){let t=e??`list`;if(t===`list`||t===`state-dir`||t===`save-script`)return t;throw new r(`INVALID_ARGS`,`session only supports list, state-dir, or save-script`)}function Bu(e,t,n){if(e!==`save-script`&&(t!==void 0||n===!0))throw new r(`INVALID_ARGS`,`session ${e} does not accept a path or --force; use session save-script [path] [--force] to publish a recording.`)}const Vu={viewport:w({width:O(),height:O(),message:D()},[`width`,`height`,`message`])},Hu=B({name:`viewport`,text:{summary:`Resize the active web viewport for the current session`},metadata:z(`viewport`,`Resize the active web viewport before taking snapshots or screenshots. Useful for fixed-layout or 100vh apps where changing the viewport reveals different content.`,{width:j(P(`Viewport width in CSS pixels.`,{min:1})),height:j(P(`Viewport height in CSS pixels.`,{min:1}))}),run:(e,t)=>e.command.viewport(t),cliSchema:{positionalArgs:[`width`,`height`]},cliReader:(e,t)=>({..._(t),...Ue(e)}),daemonWriter:h(u.viewport,e=>{let{width:t,height:n}=e;return[String(t),String(n)]}),cliOutputFormatter:Z.viewport}),Uu=V({name:`management`,commands:[...Kl,sl,Jl,wu,Cl,Ru,wl,Tl,Hu,...mu,...Pu]});function Wu(e){return{data:e.result,text:e.action===`reload`?`Reloaded React Native apps via ${e.result.reloadUrl}`:JSON.stringify(e.result,null,2)}}const Gu={metro:({input:e,result:t})=>Wu({result:t,action:e.action})},Ku=[`auto`,`react-native`,`expo`,`repack`];function qu(e){if(e!==void 0){if(Ku.includes(e))return e;throw new r(`INVALID_ARGS`,`metro prepare --kind must be auto, react-native, expo, or repack`)}}const Ju=`metro`,Yu=V({name:`metro`,commands:[B({name:Ju,text:{summary:`Prepare the dev server or reload apps`,cliDetail:`reload with no --metro-host/--metro-port/--bundle-url resolves against the dev server this session last bound via metro prepare or open's metro hint flags (falling back to localhost:8081 only when the session never bound one), so it never silently reloads a different project's server on the default port; pass an explicit flag to override the session hint for one call. After prepare, reload uses the local server address independently of the public or proxy address given to the device; a fresh open preserves it only when its client-config runtime points to the prepared device server, while explicit reload flags override it. For open or an explicit bundle URL, reload removes a .bundle/.jsbundle/.js entry filename and keeps the remaining path as the server mount, and when the server has no HTTP /reload route (Expo) the reload is broadcast over its /message websocket instead of trusting the app-page fallback. The binding is cleared when the session closes, and a fresh open without hint flags also clears any leftover binding from a previous same-name session. --kind expo (detected or forced) requests the virtual-entry bundle URL (.expo/.virtual-metro-entry.bundle) instead of index.bundle, since index.bundle 404s/500s against Expo dev servers in monorepos. Dependency install auto-detects the package manager from the nearest yarn.lock/pnpm-lock.yaml/bun.lock/bun.lockb/package-lock.json walking up from --project-root (bounded at the repo root), so Yarn/pnpm workspace monorepos with the lockfile at the repo root do not wrongly fall back to npm install (which fails on workspace: dependency specifiers); if install still fails, pass --no-install-deps when dependencies are already installed (for example via a monorepo root install).`,mcpDetail:`The binding is cleared when the session closes, and a fresh open without runtime hints also clears any leftover binding from a previous same-name session.`},metadata:z(Ju,`Prepare a React Native development server or ask connected apps to reload, using the development server this session is bound to. Provide explicit runtime inputs only to override that binding for one call.`,{action:j(I([`prepare`,`reload`])),projectRoot:M(),kind:L(D()),publicBaseUrl:M(),proxyBaseUrl:Cr(M(),{operatorPath:`Configure the remote proxy in the remote-config profile or operator config for the process serving these tools.`}),bearerToken:Cr(M(),{envFlagKeys:[`metroBearerToken`,`daemonAuthToken`]}),bridgeScope:L({type:`object`,additionalProperties:!0}),launchUrl:M(),port:P(),listenHost:M(),statusHost:M(),startupTimeoutMs:P(),probeTimeoutMs:P(),reuseExisting:F(),installDependenciesIfNeeded:F(),runtimeFilePath:M(),logPath:M(),metroHost:M(),metroPort:P(),bundleUrl:M(),timeoutMs:P()}),run:async(e,t)=>t.action===`prepare`?await e.metro.prepare(Xu(t)):await e.metro.reload(Qu(t)),cliSchema:{usageOverride:`metro prepare (--public-base-url <url> | --proxy-base-url <url>) [--project-root <path>] [--port <port>] [--kind auto|react-native|expo|repack]
|
|
30
|
+
agent-device metro reload [--metro-host <host>] [--metro-port <port>] [--bundle-url <url>]`,usageFlags:[],listUsageOverride:`metro`,positionalArgs:[`prepare|reload`],allowedFlags:[...Ri,...Li]},cliReader:(e,t)=>{let n=(e[0]??``).toLowerCase();if(n!==`prepare`&&n!==`reload`)throw new r(`INVALID_ARGS`,`metro requires a subcommand: prepare or reload`);if(n===`reload`)return{action:n,metroHost:t.metroHost,metroPort:t.metroPort,bundleUrl:t.bundleUrl,timeoutMs:t.metroProbeTimeoutMs};if(!t.metroPublicBaseUrl&&!t.metroProxyBaseUrl)throw new r(`INVALID_ARGS`,`metro prepare requires --public-base-url <url> or --proxy-base-url <url>.`);return{action:n,projectRoot:t.metroProjectRoot,kind:qu(t.kind??t.metroKind),port:t.metroPreparePort,listenHost:t.metroListenHost,statusHost:t.metroStatusHost,publicBaseUrl:t.metroPublicBaseUrl,proxyBaseUrl:t.metroProxyBaseUrl,bearerToken:t.metroBearerToken,bridgeScope:t.tenant&&t.runId&&t.leaseId?{tenantId:t.tenant,runId:t.runId,leaseId:t.leaseId}:void 0,startupTimeoutMs:t.metroStartupTimeoutMs,probeTimeoutMs:t.metroProbeTimeoutMs,reuseExisting:!t.metroNoReuseExisting&&void 0,installDependenciesIfNeeded:!t.metroNoInstallDeps&&void 0,runtimeFilePath:t.metroRuntimeFile}},cliOutputFormatter:Gu.metro})]});function Xu(e){return{projectRoot:e.projectRoot,kind:e.kind,publicBaseUrl:e.publicBaseUrl,proxyBaseUrl:e.proxyBaseUrl,bearerToken:e.bearerToken,bridgeScope:e.bridgeScope??Zu(e),port:e.port,listenHost:e.listenHost,statusHost:e.statusHost,startupTimeoutMs:e.startupTimeoutMs,probeTimeoutMs:e.probeTimeoutMs,reuseExisting:e.reuseExisting,installDependenciesIfNeeded:e.installDependenciesIfNeeded,runtimeFilePath:e.runtimeFilePath}}function Zu(e){return e.tenant&&e.runId&&e.leaseId?{tenantId:e.tenant,runId:e.runId,leaseId:e.leaseId}:void 0}function Qu(e){return{metroHost:e.metroHost,metroPort:e.metroPort,bundleUrl:e.bundleUrl,timeoutMs:e.timeoutMs}}function $u(e,t){return e.includes(t)}function ed(e,t,n={}){let i=t===void 0?void 0:n.normalize?.(t)??t;if(i!==void 0&&$u(e,i))return i;let a=typeof n.message==`function`?n.message(t):n.message;throw new r(`INVALID_ARGS`,a??`Invalid value: ${t}. Use ${e.join(`|`)}.`)}const td=[`started`,`stopped`,`marked`,`cleared`,`restarted`,`removedRotatedFiles`];function nd(e){return{data:e,text:e.path,stderr:Od([Ed(e,[`active`,`state`,`backend`,`sizeBytes`]),Ed(e,td),e.hint,Dd(e.notes)])}}function rd(e){let t=e.events??[];return{data:e,text:t.length>0?sd(t):`No session events found.`,stderr:Od([Ed(e,[`path`,`cursor`,`nextCursor`,`limit`])])}}function id(e){let t=[],n=e.entries??[];if(e.path&&t.push(e.path),n.length===0)t.push(`No recent HTTP(s) entries found.`);else for(let e of n)t.push(...Cd(e));return{data:e,text:t.join(`
|
|
31
|
+
`),stderr:Od([Ed(e,[`active`,`state`,`backend`,`include`,`scannedLines`,`matchedLines`]),Dd(e.notes)])}}function ad(e){return{data:e,text:[`Audio probe: ${String(e.state??`stopped`)} heard=${String(e.heard===!0)}`,yd(`rmsDbfs`,e.rmsDbfs),yd(`peakDbfs`,e.peakDbfs)].filter(e=>!!e).join(`
|
|
32
|
+
`),stderr:Od([Ed(e,[`active`,`backend`,`source`,`durationMs`,`elapsedMs`,`bucketMs`,`sampleCount`,`sourceCount`,`mediaElementCount`]),Dd(e.notes)])}}const od={logs:H(nd),events:H(rd),network:H(id),audio:H(ad)};function sd(e){let t=e.map(cd),n=Math.min(Math.max(...t.map(e=>e.label.length),5),32);return t.map(e=>ld(e,n)).join(`
|
|
33
|
+
`)}function cd(e){return{timestamp:ud(e.ts),label:dd(e),summary:fd(e)}}function ld(e,t){let n=e.label.padEnd(t),r=e.timestamp?`${e.timestamp} ${n}`:n.trimEnd();return e.summary?`${r} ${e.summary}`:r.trimEnd()}function ud(e){return e?e.replace(`T`,` `):``}function dd(e){let t=e.command??`command`;switch(e.kind){case`request.started`:return`start ${t}`;case`request.finished`:return bd([e.status===`error`?`error`:`ok`,t,vd(Sd(e.details?.durationMs))]);case`action.recorded`:return`action ${t}`;default:return bd([e.kind??`event`,e.command])}}function fd(e){let t=pd(e.summary,e);return`${t}${md(e,t)}`.trim()}function pd(e,t){let n=e?.trim()??``,r=t.command??``;return t.kind===`request.started`&&n===`Started ${r}`||t.kind===`request.finished`&&n===`Finished ${r}`?``:n}function md(e,t){if(e.kind!==`action.recorded`)return``;let n=e.details;if(!n)return``;let r=[hd(n,t),_d(Sd(n.textLength))].filter(e=>!!e);return r.length>0?` (${r.join(`, `)})`:``}function hd(e,t){let n=xd(e.ref)??xd(e.selector)??gd(e);if(!(!n||t.includes(n)))return`target=${n}`}function gd(e){let t=Sd(e.x),n=Sd(e.y);return t===void 0||n===void 0?void 0:`(${t}, ${n})`}function _d(e){return e===void 0?void 0:`text=${e} chars`}function vd(e){return e===void 0?void 0:`${Math.round(e)}ms`}function yd(e,t){if(!Array.isArray(t))return;let n=t.filter(e=>typeof e==`number`&&Number.isFinite(e));return n.length>0?`${e}: [${n.join(`, `)}]`:void 0}function bd(e){return e.filter(e=>!!e).join(` `)}function xd(e){return typeof e==`string`&&e.trim().length>0?e:void 0}function Sd(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function Cd(e){let t=e.method??`HTTP`,n=e.url??`<unknown-url>`,r=e.status===void 0?``:` status=${e.status}`,i=e.timestamp?`${e.timestamp} `:``,a=e.durationMs===void 0?``:` durationMs=${e.durationMs}`,o=[`${i}${t} ${n}${`pathUnavailable`in e&&e.pathUnavailable?` (request path not logged)`:``}${r}${a}`];return e.headers?Td(o,`headers`,e.headers):(wd(o,`request headers`,e.requestHeaders),wd(o,`response headers`,e.responseHeaders)),Td(o,`request`,e.requestBody),Td(o,`response`,e.responseBody),o}function wd(e,t,n){!n||Object.keys(n).length===0||e.push(` ${t}: ${JSON.stringify(n)}`)}function Td(e,t,n){n!==void 0&&e.push(` ${t}: ${n}`)}function Ed(e,t){return t.map(t=>e[t]!==void 0&&e[t]!==null?`${t}=${e[t]}`:``).filter(Boolean).join(` `)||void 0}function Dd(e){let t=e?.filter(e=>e.length>0)??[];return t.length>0?t.join(`
|
|
34
|
+
`):void 0}function Od(e){return e.filter(e=>!!e).join(`
|
|
35
|
+
`)||void 0}const kd=`logs`,Ad=`events`,jd=`network`,Md=`audio`,Nd=[`dump`,`log`],Pd=[`probe`],Fd=[`start`,`status`,`stop`],Id=z(kd,`Session app log info, start/stop streaming, diagnostics, and markers`,{action:I(mn),message:M(),restart:F()}),Ld=z(Ad,`Read the daemon-owned session event timeline as paged JSON-friendly entries`,{limit:P(),cursor:M()}),Rd=z(jd,`Dump recent HTTP(s) traffic parsed from the session app log`,{action:I(Nd),limit:P(),include:I(c)}),zd=z(Md,`Measure browser or host-rendered simulator/emulator audio as compact dBFS buckets. Start a probe before requesting its status or stopping it.`,{action:I(Pd),probeAction:I(Fd),durationMs:P(`Probe duration in milliseconds.`),bucketMs:P(`Audio level bucket size in milliseconds.`)}),Bd=V({name:`observability`,commands:[B({name:kd,text:{summary:`Manage session app logs`},metadata:Id,run:(e,t)=>e.observability.logs(t),cliSchema:{usageOverride:`logs path | logs start | logs stop | logs clear [--restart] | logs doctor | logs mark [message...]`,usageFlags:[],positionalArgs:[`path|start|stop|clear|doctor|mark`,`message?`],allowsExtraPositionals:!0,allowedFlags:[`restart`]},cliReader:(e,t)=>({..._(t),action:Gd(e[0]),message:e.slice(1).join(` `)||void 0,restart:t.restart}),daemonWriter:h(kd,e=>Vd(e)),cliOutputFormatter:od.logs}),B({name:Ad,text:{summary:`Read session event timeline`},metadata:Ld,run:(e,t)=>e.observability.events(t),cliSchema:{usageOverride:`events [limit] [cursor]`,listUsageOverride:`events`,positionalArgs:[`limit?`,`cursor?`]},cliReader:(e,t)=>({..._(t),limit:e[0]?.trim()?ur(e[0]):void 0,cursor:e[1]}),daemonWriter:e=>g(Ad,Hd(e),e),cliOutputFormatter:od.events}),B({name:jd,text:{summary:`Inspect HTTP(S) traffic from session logs`},metadata:Rd,run:(e,t)=>e.observability.network(t),cliSchema:{usageOverride:`network dump [limit] [summary|headers|body|all] [--include summary|headers|body|all] | network log [limit] [summary|headers|body|all] [--include summary|headers|body|all]`,usageFlags:[],listUsageOverride:`network`,positionalArgs:[`dump|log`,`limit?`,`include?`],allowedFlags:[`networkInclude`]},cliReader:(e,t)=>({..._(t),action:Kd(e[0]),limit:ur(e[1]),include:t.networkInclude??qd(e[2])}),daemonWriter:e=>g(jd,Ud(e),{...e,networkInclude:e.include}),cliOutputFormatter:od.network}),B({name:Md,text:{summary:`Probe audio levels`},metadata:zd,run:(e,t)=>e.observability.audio(t),cliSchema:{usageOverride:`audio probe start [durationSeconds] [bucketMs] | audio probe status | audio probe stop`,listUsageOverride:`audio`,positionalArgs:[`probe`,`start|status|stop`,`durationSeconds?`,`bucketMs?`]},cliReader:(e,t)=>({..._(t),action:Jd(e[0]),probeAction:Yd(e[1]),durationMs:Xd(e[2]),bucketMs:ur(e[3])}),daemonWriter:e=>g(Md,Wd(e),e),cliOutputFormatter:od.audio})]});function Vd(e){return[e.action??`path`,...b(e.message)]}function Hd(e){return e.cursor===void 0?x(e.limit):[e.limit===void 0?``:String(e.limit),e.cursor]}function Ud(e){return[...e.action?[e.action]:[],...x(e.limit)]}function Wd(e){return[e.action??`probe`,e.probeAction??`status`,...x(e.durationMs),...x(e.bucketMs)]}function Gd(e){if(e!==void 0)return ed(mn,e,{message:`logs requires path, start, stop, doctor, mark, or clear`})}function Kd(e){if(e!==void 0){if(e===`dump`||e===`log`)return e;throw new r(`INVALID_ARGS`,`network requires dump or log`)}}function qd(e){if(e!==void 0)return ed(c,e,{message:`network include must be summary, headers, body, or all`})}function Jd(e){if(e!==void 0)return ed(Pd,e,{message:`audio requires probe`})}function Yd(e){if(e!==void 0)return ed(Fd,e,{message:`audio probe requires start, status, or stop`})}function Xd(e){let t=ur(e);return t===void 0?void 0:Math.round(t*1e3)}function Zd(e){let t=e;return{data:t,text:$d(t)}}const Qd={perf:H(Zd)};function $d(e){return sf(e)??ef(e)}function ef(e){let t=l(e.artifact)?e.artifact:void 0;return t?of(t):tf(l(e.metrics)?e.metrics:void 0)}function tf(e){return l(e?.fps)?rf(e):nf(e)??`Memory: unavailable - missing memory metric`}function nf(e){let t=l(e?.memory)?e.memory:void 0;if(!t)return;if(t.available===!1)return`Memory: unavailable - ${yf(t)}`;let n=Tf(t);return n?`Performance: ${n}`:`Memory: unavailable - missing memory metric`}function rf(e){let t=l(e?.fps)?e.fps:void 0;if(!t)return vf(`missing frame metric`);if(t.available===!1)return vf(yf(t));let n=bf(t);return n?af(t,n):vf(`missing dropped-frame summary`)}function af(e,t){let n=[`Frame health: ${t}`],r=Cf(e);return r.length>0&&n.push(`Worst windows:`,...r),n.join(`
|
|
36
|
+
`)}function of(e){let t=typeof e.kind==`string`?e.kind:`memory`;if(e.available===!1)return`Memory artifact (${t}): unavailable - ${typeof e.reason==`string`&&e.reason.length>0?e.reason:`not available`}`;let n=typeof e.path==`string`?e.path:void 0,r=Q(e.sizeBytes),i=r===void 0?``:` (${kf(r)})`;return n?`Memory artifact (${t}): ${n}${i}`:`Memory artifact (${t}): captured${i}`}function sf(e){return e.kind===`xctrace`?cf(e):ff(e)}function cf(e){let t=typeof e.perf==`string`?e.perf:void 0,n=uf(e);if(!t||!n||e.kind!==`xctrace`)return;let r=df(n,typeof e.mode==`string`?e.mode:`capture`,t,e.template),i=lf(e);return i.length>0?`${r}\nTop CPU self time:\n${i.join(`
|
|
37
|
+
`)}`:r}function lf(e){let t=l(e.summary)?e.summary:void 0;return Array.isArray(t?.topFunctions)?t.topFunctions.slice(0,5).flatMap(e=>{if(!l(e))return[];let t=gf(e.symbol),n=Q(e.selfSamplePercent);if(!t||n===void 0)return[];let r=gf(e.binary);return[`- ${Ef(n)} ${t}${r?` (${r})`:``}`]}):[]}function uf(e){return typeof e.outPath==`string`?e.outPath:typeof e.reportPath==`string`?e.reportPath:void 0}function df(e,t,n,r){let i=[e,`Perf ${t}: ${n}`];return typeof r==`string`&&i.push(`Template: ${r}`),i.join(`
|
|
38
|
+
`)}function ff(e){let t=pf(e);if(!t)return;let n=`Perf ${t.action}: ${t.kind} ${t.type}${mf(e)}${hf(e)}${_f(e)}`,r=lf(e);return r.length>0?`${n}\nTop CPU self time:\n${r.join(`
|
|
39
|
+
`)}`:n}function pf(e){let t=gf(e.action),n=gf(e.kind),r=gf(e.type);return t&&n&&r?{action:t,kind:n,type:r}:void 0}function mf(e){let t=gf(e.state);return t?` state=${t}`:``}function hf(e){let t=gf(e.outPath);if(!t)return``;let n=Q(e.sizeBytes);return`\n${t}${n===void 0?``:` (${kf(n)})`}`}function gf(e){return typeof e==`string`?e:void 0}function _f(e){let t=l(e.summary)?e.summary:void 0,n=l(t?.frameHealth)?t.frameHealth:void 0;if(!n||n.available!==!0)return``;let r=Q(n.droppedFramePercent),i=Q(n.droppedFrameCount),a=Q(n.totalFrameCount);return r===void 0||i===void 0||a===void 0?``:`\nTrace frame health: dropped ${Ef(r)} (${Math.round(i)}/${Math.round(a)} frames)`}function vf(e){return`Frame health: unavailable - ${e}`}function yf(e){return typeof e.reason==`string`&&e.reason.length>0?e.reason:`not available`}function bf(e){let t=Q(e.droppedFramePercent),n=Q(e.droppedFrameCount);if(t!==void 0&&n!==void 0)return[`dropped ${Ef(t)}`,xf(n,Q(e.totalFrameCount)),Sf(Q(e.sampleWindowMs))].filter(Boolean).join(` `)}function xf(e,t){return t===void 0?`(${Math.round(e)} dropped frames)`:`(${Math.round(e)}/${Math.round(t)} frames)`}function Sf(e){return e===void 0?``:`window ${Df(e)}`}function Cf(e){return Array.isArray(e.worstWindows)?e.worstWindows.flatMap(e=>{if(!l(e))return[];let t=wf(e);return t?[t]:[]}):[]}function wf(e){let t=Q(e.startOffsetMs),n=Q(e.endOffsetMs),r=Q(e.missedDeadlineFrameCount);if(t===void 0||n===void 0||r===void 0)return;let i=Q(e.worstFrameMs),a=i===void 0?``:`, worst ${Df(i)}`;return`- +${Df(t)}-+${Df(n)}: ${Math.round(r)} missed-deadline frames${a}`}function Tf(e){if(e?.available!==!0)return;let t=Q(e.residentMemoryKb)??Q(e.totalPssKb)??Q(e.totalRssKb);return t===void 0?void 0:`memory ${Of(t)}`}function Q(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function Ef(e){return`${Number.isInteger(e)?e:e.toFixed(1)}%`}function Df(e){let t=Math.max(0,Math.round(e));if(t<1e3)return`${t}ms`;let n=Math.round(t/1e3);if(n<60)return`${n}s`;let r=Math.floor(n/60),i=n%60;return i>0?`${r}m ${i}s`:`${r}m`}function Of(e){let t=e/1024;return`${t>=10?Math.round(t):t.toFixed(1)}MB`}function kf(e){if(e<1024)return`${Math.round(e)}B`;let t=e/1024;if(t<1024)return`${t>=10?Math.round(t):t.toFixed(1)}KB`;let n=t/1024;return`${n>=10?Math.round(n):n.toFixed(1)}MB`}const Af=`perf`,jf=V({name:`perf`,commands:[B({name:Af,text:{summary:`Check frames, memory, or native profiles`,cliDetail:`Use perf frames for bounded frame-health evidence and perf memory sample for a compact process-memory reading. On iOS simulators and macOS, process sampling and captures target the resolved app executable and exclude other copies with the same name. Apple xctrace and Android Simpleperf/Perfetto captures keep raw artifacts on disk; report produces bounded agent-readable evidence. For React render internals, use agent-device react-devtools.`,mcpDetail:`For CPU profiles, start and stop write the raw artifact while report writes a compact summary; request the report when the task needs readable native CPU evidence. Profiling output is evidence only: compact state, artifact path, and size.`},metadata:z(Af,`Collect frame health, memory diagnostics, and platform profiling artifacts with compact agent-readable summaries.`,{area:j(I(Ut)),subject:I(qt),action:I(Ht),kind:I(Ft),template:M(`xctrace template name, for example Time Profiler.`),out:M(`Output artifact path.`),tracePath:M(`Existing .trace path to report, defaults to the latest session trace.`)}),run:(e,t)=>e.observability.perf(t),cliSchema:{usageOverride:`perf frames --json
|
|
40
|
+
agent-device perf memory sample --json
|
|
41
|
+
agent-device perf memory snapshot [--kind android-hprof|memgraph] [--out <path>]
|
|
42
|
+
agent-device perf cpu profile start --kind xctrace [--template <name>] --out <profile.trace>
|
|
43
|
+
agent-device perf cpu profile stop --kind xctrace --out <profile.trace>
|
|
44
|
+
agent-device perf cpu profile report --kind xctrace --out <report.json>
|
|
45
|
+
agent-device perf trace start|stop --kind xctrace [--template <name>] --out <path>
|
|
46
|
+
agent-device perf cpu profile start --kind simpleperf --out <cpu.perf.data>
|
|
47
|
+
agent-device perf cpu profile stop --kind simpleperf
|
|
48
|
+
agent-device perf cpu profile report --kind simpleperf --out <cpu-report.json>
|
|
49
|
+
agent-device perf trace start|stop --kind perfetto [--out <path>]
|
|
50
|
+
|
|
51
|
+
Aggregate perf was removed in 0.21. Use one of the explicit forms above.`,usageFlags:[],listUsageOverride:`perf`,positionalArgs:[`area`,`subjectOrAction?`,`action?`],allowedFlags:[`kind`,`perfTemplate`,`out`]},cliReader:(e,t)=>({..._(t),...Pf(e,{kind:Bf(t.kind),template:t.perfTemplate,out:t.out})}),daemonWriter:h(Af,e=>Mf(e)),cliOutputFormatter:Qd.perf})]});function Mf(e){let t=e.area;return t===`cpu`?Nf([...b(t),...b(e.subject),...b(e.action),...b(e.kind)],e):t===`trace`?Nf([...b(t),...b(e.action),...b(e.kind)],e):[...b(t),...b(e.action)]}function Nf(e,t){let n=[...e];return(t.template||t.out||t.tracePath)&&n.push(t.template??``),(t.out||t.tracePath)&&n.push(t.out??``),t.tracePath&&n.push(t.tracePath),n}function Pf(e,t={}){let n=If(e[0]);if(n===`cpu`)return{area:n,subject:Rf(e[1]),action:Lf(e[2]),kind:zf(t.kind),template:t.template,out:t.out};if(n===`trace`)return{area:n,action:Lf(e[1]),kind:zf(t.kind),template:t.template,out:t.out};let r=Lf(e[1]),i=zf(t.kind);return Ff(n,r,i,t.out),{area:n,action:r,kind:i,out:t.out}}function Ff(e,t,n,i){if(e===`frames`){if(n!==void 0)throw new r(`INVALID_ARGS`,`--kind is only supported with perf memory snapshot`);if(i!==void 0)throw new r(`INVALID_ARGS`,`--out is only supported with perf memory snapshot, perf cpu profile, or perf trace`)}if(e===`memory`){if(t!==`snapshot`&&n!==void 0)throw new r(`INVALID_ARGS`,`--kind is only supported with perf memory snapshot`);if(t!==`snapshot`&&i!==void 0)throw new r(`INVALID_ARGS`,`--out is only supported with perf memory snapshot`)}}function If(e){let t=e?.toLowerCase();if(Rt(t))throw new r(`INVALID_ARGS`,Bt);if(Lt(t))return t;throw new r(`INVALID_ARGS`,Pt)}function Lf(e){if(e===void 0)return;let t=e.toLowerCase();if(It(t))return t;throw new r(`INVALID_ARGS`,Kt)}function Rf(e){let t=e?.toLowerCase();if(t!==void 0&&zt(t))return t;throw new r(`INVALID_ARGS`,Vt)}function zf(e){if(e===void 0)return;let t=e.toLowerCase();if(Wt(t))return t;throw new r(`INVALID_ARGS`,Gt)}function Bf(e){return typeof e==`string`?zf(e):void 0}const Vf=`react-native`,Hf=V({name:`react-native`,commands:[B({name:Vf,text:{summary:`Run React Native automation helpers`},metadata:z(Vf,`Run supported React Native automation helpers. Use dismiss-overlay to close a visible development error overlay before continuing normal UI automation.`,{action:j(I([`dismiss-overlay`]))}),run:(e,t)=>e.command.reactNative(t),cliSchema:{usageOverride:`react-native dismiss-overlay`,listUsageOverride:`react-native dismiss-overlay`,positionalArgs:[`dismiss-overlay`]},cliReader:(e,t)=>({..._(t),action:Uf(e[0])}),daemonWriter:h(Vf,e=>[C(e.action,`react-native requires action`)])})]});function Uf(e){if(e===`dismiss-overlay`)return e;throw new r(`INVALID_ARGS`,`react-native supports only: dismiss-overlay`)}function Wf(e){let t=e,n=typeof t.outPath==`string`?t.outPath:``,r=qf(t);if(r.length<=1)return{data:t,text:Kf(t,n)};let i=[`Recording chunks:`];for(let e of r)i.push(` ${e.index}: ${e.path}`);return typeof t.telemetryPath==`string`&&i.push(`Telemetry: ${t.telemetryPath}`),typeof t.warning==`string`&&i.push(`Warning: ${t.warning}`),typeof t.overlayWarning==`string`&&i.push(`Overlay warning: ${t.overlayWarning}`),{data:t,text:i.join(`
|
|
52
|
+
`)}}const Gf={record:H(Wf)};function Kf(e,t){let n=[];return t&&n.push(t),typeof e.sessionStateDir==`string`&&n.push(`Session state: ${e.sessionStateDir}`),typeof e.warning==`string`&&n.push(`Warning: ${e.warning}`),typeof e.overlayWarning==`string`&&n.push(`Overlay warning: ${e.overlayWarning}`),n.join(`
|
|
53
|
+
`)}function qf(e){let t=e.chunks;return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.index!=`number`||typeof t.path!=`string`?[]:[{index:t.index,path:t.path}]}):[]}const Jf=`record`,Yf=`trace`,Xf=[`start`,`stop`],Zf=z(Jf,`Start or stop a screen recording for the active app session or, where supported, the selected device, or build a contact-sheet PNG from a recording already exported. Long Android recordings can return multiple video artifacts; HarmonyOS supports whole-screen recording on physical devices.`,{action:j(I(Xf)),path:M(),fps:P(),maxSize:Sr(pe.migration.record),quality:I(Dt),hideTouches:F(),recordingScope:I(Ot)},{parseableOutput:!0}),Qf=z(Yf,`Start or stop trace-log capture and return the resulting artifact when capture ends. Use the same artifact path for the matching start and stop requests when an explicit path is required.`,{action:j(I(Xf)),path:M()}),$f={start:[`recordingScope`,`fps`,`quality`,`hideTouches`],stop:[],"contact-sheet":[`out`]},ep={usageOverride:`record start [path] [--scope <app|device|system>] [--fps <n>] [--quality <medium|high>] [--hide-touches] | record stop | record contact-sheet <video.mp4> [--out <sheet.png>]`,usageFlags:[],listUsageOverride:`record start [path] | record stop | record contact-sheet <video>`,positionalArgs:[`start|stop|contact-sheet`,`path?`],allowedFlags:[...new Set(Object.values($f).flat())],flagsByAction:$f},tp={usageOverride:`trace start <path> | trace stop <path>`,listUsageOverride:`trace start <path> | trace stop <path>`,positionalArgs:[`start|stop`,`path?`]},np=(e,t)=>({..._(t),action:lp(e[0],Jf),path:e[1],fps:t.fps,quality:t.quality,hideTouches:t.hideTouches,recordingScope:t.recordingScope}),rp=(e,t)=>({..._(t),action:lp(e[0],Yf),path:e[1]}),ip=h(Jf,e=>cp(e)),ap=e=>(Te(`record`,e),ip(e)),op=h(Yf,e=>cp(e)),sp=V({name:`recording`,commands:[B({name:Jf,text:{summary:`Start or stop screen recording`,cliDetail:`The default --scope app requires an active app session from open <app>; use --scope device/system to explicitly request whole-screen recording where the selected backend supports it. Android record start publishes a durable device manifest, recordings longer than the 180s adb screenrecord limit are returned as multiple MP4 chunks while the daemon stays alive, and daemon-restart recovery uses only manifest-owned chunks. Android screenrecord encodes a frame only when the screen changes, so a clip can end at the last frame the recorder encoded instead of at record stop; durationMs is host wall clock from record start until the export finished, and capturedDurationMs reports the video timeline when it can be measured, with a warning naming how much of the window that video covers. An Android manifest left by an unreachable recording is retired on the next start once its recorders are proven gone; one still owned refuses with non-retriable DEVICE_IN_USE and reason native_recovery_evidence_open naming the session to run record stop for, and a recorder that is still writing an artifact refuses with DEVICE_IN_USE and reason native_recording_artifact_claimed, which clears itself once that recorder ends at the 180s limit. HarmonyOS supports whole-screen recording on physical devices only: use --scope device/system; --fps, --quality, and --hide-touches are unsupported. Use --quality to choose medium or high export quality on supported backends. The touch overlay renders at most 30 frames a second, or at --fps when lower; a lower --fps makes record stop faster on a long recording, and an overlay export that runs past its budget returns the raw video with an overlayWarning. An iOS simulator host recording lock returns non-retriable DEVICE_IN_USE with reason apple_simulator_recording_busy. Stop the recording in its owning session; if a dead recorder left the host locked, ask the host operator to restart the CoreSimulator stream service. A record stop that cannot produce its export keeps what a retry reads back — on Android the device-side artifact and the native manifest — leaves the recording manifest of that session open, and returns its own error, so retry record stop in that session; only closing the session disposes them. Every stopped recording also reports what became of its recorder and of the file that recorder writes to: recorder is confirmed, or lost when the session holding it died, and nativePathDisposition is retirable while that file still owes a removal or retired once its removal was verified. Both are optional disclosures, not failures; ADR 0024 declares further states (unconfirmed, pending) for the steps that gain those probes, and no stop reports them yet. record contact-sheet <video.mp4> [--out <sheet.png>] is a local report over a file you already exported: it decodes frames out of that MP4 and writes one PNG holding the cells where the screen visibly changed, each labeled with its elapsed time on the clip timeline. It needs no session and no device, rebuilds any past recording, and works for every backend that exports MP4; a WebM recording is refused with reason contact_sheet_container_unsupported. The sample grid is bounded and spread across the whole clip, so it reports coverage rather than a review: a flash that opens and closes entirely between two sample times is not in the sheet, which is why the result also reports how many times it sampled and how many frames came back. Frame decoding is Apple AVFoundation tooling, so the command runs only on macOS hosts and refuses elsewhere with reason contact_sheet_unsupported_host.`},metadata:Zf,run:(e,t)=>e.recording.record(t),cliSchema:ep,cliReader:np,daemonWriter:ap,cliOutputFormatter:Gf.record}),B({name:Yf,text:{summary:`Start or stop trace capture`,cliDetail:`Pass that path as the same positional argument to start and stop.`},metadata:Qf,run:(e,t)=>e.recording.trace(t),cliSchema:tp,cliReader:rp,daemonWriter:op})]});function cp(e){return[e.action,...b(e.path)]}function lp(e,t){if(e===`start`||e===`stop`)return e;throw new r(`INVALID_ARGS`,`${t} requires start|stop`)}const up=2097152;async function dp(e){let t=fn(e.inputPath,{cwd:e.cwd}),n=pp(t,e.inputPath),r=Re(t,e.replayBackend);return r===`ad`?fp(t,{[t]:n},e.inputPath):fp(t,(await(await import(`./replay-backend-registry.js`).then(e=>e.n)).getReplayBackend(r)).collectSourceFiles({entryPath:t,entrySource:n,env:e.env,readSource:mp}),e.inputPath)}function fp(e,t,n){return hp(t,n),{entry:e,files:t}}function pp(e,t){try{return pn.readFileSync(e,`utf8`)}catch(n){throw new r(`INVALID_ARGS`,`replay script not found on this machine: ${t}`,{path:e,hint:`Replay scripts are read by the client and sent to the daemon, so the path must resolve where you ran the command.`},n instanceof Error?n:void 0)}}function mp(e){try{return pn.readFileSync(e,`utf8`)}catch{return}}function hp(e,t){let n=Object.values(e).reduce((e,t)=>e+Buffer.byteLength(t,`utf8`),0);if(!(n<=2097152))throw new r(`INVALID_ARGS`,`replay script sources for ${t} total ${n} bytes, over the ${up}-byte limit; split the flow or drop unused runFlow includes.`,{limitBytes:up,totalBytes:n})}const gp=/[*?[\]{}]/;function _p(e){let t=e.replayBackend===`maestro`?new Set([`.yaml`,`.yml`,`.ad`]):new Set([`.ad`]),n=[],r=[];for(let i of e.inputs){let a=vp(i,e.cwd,t);if(a.source===`file`){n.push(...a.paths);continue}r.push(a.source===`directory`?Cp(a.paths):xp(a.paths))}return Cp([...n,...r.flat()])}function vp(e,t,n){let i=fn(e,{cwd:t});if(pn.existsSync(i)){let t=pn.statSync(i);return t.isDirectory()?{paths:bp(i,n),source:`directory`}:t.isFile()?(yp(e,i,n),{paths:[i],source:`file`}):{paths:[],source:`file`}}if(!wp(e))throw new r(`INVALID_ARGS`,`test input not found: ${e}`);return{source:`glob`,paths:pn.globSync(dn(e),{cwd:t}).map(e=>d.isAbsolute(e)?e:d.resolve(t,e)).filter(e=>n.has(d.extname(e).toLowerCase())&&Tp(e))}}function yp(e,t,n){if(!n.has(d.extname(t).toLowerCase()))throw Je(t)&&!n.has(`.yaml`)?new r(`INVALID_ARGS`,qe(`test`,e)):new r(`INVALID_ARGS`,`test does not support this file type: ${e}`)}function bp(e,t){let n=[],r=pn.opendirSync(e);try{let i;for(;(i=r.readSync())!==null;){let r=d.join(e,i.name);i.isDirectory()?n.push(...bp(r,t)):i.isFile()&&t.has(d.extname(i.name).toLowerCase())&&n.push(r)}}finally{r.closeSync()}return n}function xp(e){return e.map(e=>d.normalize(e)).sort((e,t)=>{let n=Sp(e)-Sp(t);return n===0?e.localeCompare(t):n})}function Sp(e){return+(d.extname(e).toLowerCase()===`.ad`)}function Cp(e){return[...new Set(e.map(e=>d.normalize(e)))]}function wp(e){return gp.test(e)}function Tp(e){try{return pn.statSync(e).isFile()}catch{return!1}}const Ep=`replay`,Dp=`test`,Op=z(Ep,`Run a recorded automation script, including compatible Maestro YAML flows. A script without a terminal close leaves its session active for subsequent automation.`,{path:j(M()),update:F(),backend:M(),maestro:F(),env:kr(),metroHost:M(`Metro/debug host hint inherited by replay-opened sessions.`),metroPort:P(`Metro/debug port hint inherited by replay-opened sessions.`),bundleUrl:M(`Bundle URL hint inherited by replay-opened sessions.`),resumeFrom:P(),resumePlanDigest:M(),keepSession:F(`Leave the session active by suppressing exactly an authored terminal close in native .ad.`),timeoutMs:P(`Maximum wall-clock duration for the replay request.`),saveScript:L({oneOf:[k(),D()]}),force:F(),testIme:F(`Activate the headless Android test IME for the sessions this replay opens (default on for emulators; opt-in on real devices).`)}),kp=z(Dp,`Run one or more replay scripts as a serial test suite`,{paths:j(kr()),update:F(),backend:M(),maestro:F(),env:kr(),metroHost:M(`Metro/debug host hint inherited by each test session.`),metroPort:P(`Metro/debug port hint inherited by each test session.`),bundleUrl:M(`Bundle URL hint inherited by each test session.`),failFast:F(),timeoutMs:P(),retries:P(),recordVideo:F(),artifactsDir:M(),shardAll:P(),shardSplit:P(),testIme:F(`Activate the headless Android test IME for the sessions each suite attempt opens (default on for emulators; opt-in on real devices).`)}),Ap={replay:w({replayed:O(),healed:O(),session:D(),sessionActive:k(`True iff the session is still active — the script had no terminal close.`),artifactPaths:xr(),snapshotDiagnostics:A(),message:D()},[`replayed`,`healed`,`session`,`sessionActive`,`artifactPaths`,`message`]),test:w({total:O(),executed:O(),passed:O(),failed:O(),skipped:O(),notRun:O(),durationMs:O(),failures:{type:`array`,items:A()},tests:{type:`array`,items:A()},snapshotDiagnostics:A()},[`total`,`executed`,`passed`,`failed`,`skipped`,`notRun`,`durationMs`,`failures`,`tests`])},jp={usageOverride:`replay <path> | replay export <file.ad> [--out <path>]`,usageFlags:[],positionalArgs:[`path`],allowsExtraPositionals:!0,allowedFlags:[`replayMaestro`,...Vi,...Ri,`replayFrom`,`replayPlanDigest`,`replayKeepSession`,`timeoutMs`,`out`,`saveScript`,`force`,`testIme`],flagDescriptionOverrides:{saveScript:`Arm a repair transaction from this replay (ADR 0012): recording starts at step 1, and the healed script commits when the repair-armed session tears down (close, close --save-script, or idle-reap). Independent of the open/close authoring arm-on-open. Optional custom output path.`}},Mp={usageOverride:`test <path-or-glob>...`,usageFlags:[],listUsageOverride:`test <path-or-glob>...`,positionalArgs:[`pathOrGlob`],allowsExtraPositionals:!0,allowedFlags:[`replayMaestro`,...Vi,...Ri,`failFast`,`timeoutMs`,`retries`,`recordVideo`,`artifactsDir`,`reporter`,`reportJunit`,`shardAll`,`shardSplit`,`testIme`]},Np=V({name:`replay`,commands:[B({name:Ep,text:{summary:`Replay a recorded session or Maestro flow`,cliDetail:`For Maestro YAML compatibility flows, use replay <flow.yaml> --maestro and keep the target binding such as --platform ios on the replay command. A script with no terminal close leaves its session (and daemon) running until you close it or it idle-reaps — no different from a session opened interactively. For native .ad scripts, --keep-session suppresses exactly an authored terminal close so you can continue interactively. replay export <file.ad> converts compatible actions to Maestro YAML locally, including app switches with explicit launchApp.appId targets, deep links (including tel: and mailto:) as openLink, and home as pressKey: Home.`},metadata:Op,run:(e,t)=>e.replay.run(ll(t)),cliSchema:jp,cliReader:(e,t)=>({..._(t),path:S(e[0],`replay requires path`),update:t.replayUpdate,backend:t.replayMaestro?`maestro`:void 0,env:t.replayEnv,metroHost:t.metroHost,metroPort:t.metroPort,bundleUrl:t.bundleUrl,resumeFrom:t.replayFrom,resumePlanDigest:t.replayPlanDigest,keepSession:t.replayKeepSession,timeoutMs:t.timeoutMs,saveScript:t.saveScript,force:t.force,testIme:t.testIme}),daemonWriter:async e=>{let t=C(e.path,`replay requires path`),n=Ip(e),r=Rp(process.env);return g(Ep,[t],{...e,replayUpdate:e.update,replayBackend:n,replayEnv:e.env,replayShellEnv:r,replayScriptSource:await dp({inputPath:t,cwd:Fp(e),replayBackend:n,env:Pp(e,r)}),replayFrom:e.resumeFrom,replayPlanDigest:e.resumePlanDigest,replayKeepSession:e.keepSession,saveScript:e.saveScript})},cliOutputFormatter:U}),B({name:Dp,text:{summary:`Run replay test suites`,cliDetail:`Relative globs are expanded on the caller from its working directory, whose name is treated literally. Quote glob inputs to defer expansion to test. Copied diagnostic artifacts receive numbered filenames when needed to preserve other artifacts, replay sources, timing traces, and attempt manifests. JUnit reports (--reporter junit:<path>) replace characters forbidden by XML 1.0 with U+FFFD and preserve legal Unicode and whitespace. JSON and other reporters retain the original suite values. Custom reporter getExitCode hooks must return an integer from 0 to 255 or undefined; the highest valid code wins and cannot lower a failing suite's exit code.`},metadata:kp,run:(e,t)=>e.replay.test(ll(t)),cliSchema:Mp,cliReader:(e,t)=>({..._(t),paths:e,update:t.replayUpdate,backend:t.replayMaestro?`maestro`:void 0,env:t.replayEnv,metroHost:t.metroHost,metroPort:t.metroPort,bundleUrl:t.bundleUrl,failFast:t.failFast,timeoutMs:t.timeoutMs,retries:t.retries,recordVideo:t.recordVideo,artifactsDir:t.artifactsDir,shardAll:t.shardAll,shardSplit:t.shardSplit,testIme:t.testIme}),daemonWriter:async e=>{let t=e.paths??[],n=Ip(e),r=Fp(e),i=Rp(process.env),a=Pp(e,i);return g(Dp,t,{...Lp(e),replayUpdate:e.update,replayBackend:n,replayEnv:e.env,replayShellEnv:i,replayScriptSources:await Promise.all(_p({inputs:t,cwd:r,replayBackend:n}).map(async e=>await dp({inputPath:e,cwd:r,replayBackend:n,env:a})))})}})]});function Pp(e,t){return{...jt(t),...At(kt(e.env))}}function Fp(e){return typeof e.cwd==`string`&&e.cwd.length>0?e.cwd:process.cwd()}function Ip(e){return e.backend??(e.maestro===!0?`maestro`:void 0)}function Lp(e){let t={...e};return delete t.reporter,delete t.reportJunit,t}function Rp(e){let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&n.startsWith(`AD_VAR_`)&&(t[n]=r);return t}function zp(e){return{data:e,text:Hp(e)}}function Bp(e){if(e.platform===`android`&&e.action===`status`){let t=[`Keyboard visible: ${e.visible===!0?`yes`:`no`}`,`Input type: ${e.type??e.inputType??`unknown`}`,`Input owner: ${e.inputOwner??`unknown`}`];return e.inputMethodPackage&&t.push(`Input method: ${e.inputMethodPackage}`),e.focusedPackage&&t.push(`Focused package: ${e.focusedPackage}`),e.focusedResourceId&&t.push(`Focused resource: ${e.focusedResourceId}`),t.push(`Next action: ${Wp(e.visible,e.inputOwner)}`),{data:e,text:t.join(`
|
|
54
|
+
`)}}return ei(e)}function Vp(e){return e.action===`read`?{data:e,text:e.text}:ei(e)}const $=qs({appstate:H(zp),back:U,home:U,orientation:U,fold:U,"app-switcher":U,"action-button":U,keyboard:H(Bp),clipboard:H(Vp),"tv-remote":U});function Hp(e){if(e.platform===`ios`)return Up(e);if(e.platform===`android`){let t=[`Foreground app: ${e.package??`unknown`}`];return e.activity&&t.push(`Activity: ${e.activity}`),t.join(`
|
|
55
|
+
`)}return null}function Up(e){let t=[`Session app: ${e.appName??e.appBundleId??`unknown`}`];return e.appBundleId&&t.push(`Bundle: ${e.appBundleId}`),e.state&&t.push(`State: ${e.state}`),e.source&&t.push(`Source: ${e.source}`),t.join(`
|
|
56
|
+
`)}function Wp(e,t){return t===`ime`?`Focused input appears to be owned by the keyboard/IME; dismiss or change the IME before retrying text entry.`:e===!0?`Keyboard is visible and focused input appears app-owned; fill/type can proceed.`:`Keyboard is hidden; focus an app field before type, or use fill with a concrete target.`}const Gp=`back`,Kp=`orientation`,qp=`fold`,Jp=`keyboard`,Yp=`clipboard`,Xp=`tv-remote`,Zp=[`read`,`write`],Qp=[`status`,`dismiss`,`enter`,`return`],$p={back:w({action:E(`back`),mode:T(et),message:D()},[`action`,`mode`,`message`]),home:w({action:E(`home`),message:D()},[`action`,`message`]),orientation:w({action:E(`orientation`),orientation:T(ue),message:D(),confirmed:k(),warning:D()},[`action`,`orientation`,`message`]),"app-switcher":w({action:E(`app-switcher`),message:D()},[`action`,`message`]),fold:w({action:E(`fold`),pose:T(xe),hingeAngleDegrees:O(`Hinge angle read back after the pose settled: from CoreDevice on iOS, from the emulator hinge sensor on Android.`),screen:w({display:D(`CoreDevice name of the panel the device now lights.`),coordinateSpace:E(fe),widthPt:O(`Panel width in native panel points (pixels divided by point scale), NOT snapshot coordinates; take a fresh snapshot to place a tap.`),heightPt:O(`Panel height in native panel points (pixels divided by point scale), NOT snapshot coordinates; take a fresh snapshot to place a tap.`)},[`display`,`coordinateSpace`,`widthPt`,`heightPt`]),message:D()},[`action`,`pose`,`hingeAngleDegrees`,`message`]),"action-button":w({action:E(`action-button`),message:D()},[`action`,`message`]),"tv-remote":w({action:E(`tv-remote`),button:T(be),durationMs:O(),message:D()},[`action`,`button`,`message`]),clipboard:{type:`object`,oneOf:[w({action:E(`read`),text:D()},[`action`,`text`]),w({action:E(`write`),textLength:O(),message:D()},[`action`,`textLength`,`message`])]},appstate:{type:`object`,oneOf:[w({platform:T([`ios`,`macos`]),appName:D(),appBundleId:D(),source:T([`session`,`runner`],`runner when a live runner read the session app state; session when the record alone answered.`),state:T(s,`The session app XCUIApplication state as a live runner reads it; absent with source session.`),surface:T(Nt),device_udid:D(`iOS only — the session device UDID.`),ios_simulator_device_set:{type:[`string`,`null`],description:`iOS only — the simulator set path, or null when unknown.`}},[`platform`,`appName`,`source`,`surface`]),w({platform:E(`android`),package:D(),activity:D()},[`platform`,`package`,`activity`])]},keyboard:w({platform:T([`android`,`ios`]),action:T([`status`,`dismiss`,`enter`]),visible:k(),wasVisible:k(),dismissed:k(),attempts:O(),inputType:D(),type:T([`text`,`number`,`email`,`phone`,`password`,`datetime`,`unknown`]),inputMethodPackage:D(),focusedPackage:D(),focusedResourceId:D(),inputOwner:T([`app`,`ime`,`unknown`]),message:D()},[`platform`,`action`])},em={hingeEvent:`simulator HID hinge event`,permissions:`Device Hub and host Accessibility permission are not required.`,unsupportedScope:`UNSUPPORTED_OPERATION and reason unsupported-device-scope`},tm=`Fold or unfold a foldable iPhone simulator (iPhone Duo) or a foldable Android emulator into the closed, half-open, or open pose. iOS sends a ${em.hingeEvent}, then reads the hinge angle back from CoreDevice to confirm it, and can follow timestamped angle keyframes; Android sets the emulator console posture, then confirms the device state the guest commits and reports the hinge angle the AVD profile defines for that posture, and dismisses the lock screen a fold to the cover display can raise. On iOS a pose change moves the app to a different panel with a different point size; on Android a fold to or from closed moves the app between the cover and inner displays, and any pose change can reshape the app window, whose size the next snapshot reports. Either way every ref and coordinate from before it is stale: re-snapshot after this command. Taps, long presses, and scrolling target the app window on its current panel in closed, half-open, and open poses. Simulator and emulator only; iOS requires the iOS simulator SDK; ${em.permissions} A simulator scoped to a non-default simulator set is refused with ${em.unsupportedScope}; run fold against a simulator in the default set.`,nm={summary:`Foldable devices: panels, pose, and which screen you are on`,body:`agent-device help foldable
|
|
57
|
+
|
|
58
|
+
A foldable Apple device (iPhone Duo) carries two integrated panels, which Apple calls the outer display and the inner display. Only one is lit at a time, and which one is lit is the device pose.
|
|
59
|
+
|
|
60
|
+
Screens are handled for you:
|
|
61
|
+
Each iOS simulator capture resolves the CoreDevice display table, captures the lit panel explicitly, and normalizes density with that panel's own point scale. Do not add a screen flag to the normal loop; there is none, because the lit panel is always the only capturable one: the dark panel yields an all-black PNG.
|
|
62
|
+
The two panels are different sizes (iPhone Duo: 466x678 points closed on the outer panel, 669x951 open on the inner). A pose change therefore invalidates every ref and coordinate. Re-snapshot after any pose change and never carry coordinates or refs across one.
|
|
63
|
+
Check which panel is lit before trusting a geometry claim: agent-device screenshot reports its point size, and 466x678 versus 669x951 says which panel you captured.
|
|
64
|
+
|
|
65
|
+
Changing the pose:
|
|
66
|
+
agent-device fold closed | half-open | open
|
|
67
|
+
fold sends a private HID hinge event inside the selected simulator and then reads the hinge angle back from CoreDevice until it agrees: closed is 0 degrees, open is 180, and half-open is any angle between them (requested at 130 degrees). An angle in that interval only proves the category, so half-open is reported once two consecutive readings both fall inside it and agree within 0.5 degrees. The response reports the verified pose, the hinge angle, and the panel the device now lights with its native panel point size, marked coordinateSpace "native-panel". That point size is the panel's own geometry, not the next snapshot's viewport, so it cannot place a tap: the active app window can differ (a 669x951 inner panel hosts a 951x669 window). A hinge whose last reading is some other pose fails with COMMAND_FAILED and reason fold-pose-unverified, naming the angle CoreDevice still reports; a hinge seen half-open but never at rest fails with reason fold-pose-unsettled, naming the observed and previous angles. A single-panel simulator fails with UNSUPPORTED_OPERATION. A simulator scoped to a non-default set with --ios-simulator-device-set is refused before any hinge is touched, with ${em.unsupportedScope}: the HID send honors the set, but CoreDevice's display inventory and hinge-angle readback resolve a scoped simulator as not found, so the pose could not be verified. Run fold without --ios-simulator-device-set (in the default set).
|
|
68
|
+
Expect a fold to take 10-16 seconds: each hinge read is a five-second devicectl stream, and half-open waits for the hinge to stop moving. Re-snapshot after every fold; refs and coordinates from before it are stale, and the command's message says so.
|
|
69
|
+
Timed motion: fold --keyframes '[{"atMs":0,"angle":0},{"atMs":5000,"angle":180}]'. Use 2–64 frames starting at 0ms, increasing integer timestamps up to 60000ms, and angles from 0 to 180. The last timestamp sets motion duration, excluding setup and verification. Equal angles hold; cancellation stops motion. See the fold examples in the command and Node API documentation for trajectories.
|
|
70
|
+
|
|
71
|
+
Requirements: an iOS simulator session on a foldable device and an Xcode toolchain with the iOS simulator SDK and foldable HID support (verified on Xcode 27.1). ${em.permissions} The command runs a small helper through simctl spawn for the session UDID; the helper is built once per Fold.m source hash and Xcode toolchain, cached under ~/.agent-device/fold-helper, and rebuilt only when the source or the toolchain changes. Build or dispatch failures are reported without a UI fallback. The app under test reads the resulting pose as UIHinge.status.
|
|
72
|
+
Android emulators: fold sets the posture through the emulator console (adb emu posture 1|2|3), then reads adb shell cmd device_state print-state until the guest commits CLOSED, HALF_OPENED, or OPENED, and reports the hinge sensor's angle, which the AVD profile defines per posture: 0, 90 and 180 degrees on the Pixel folds, 15, 90 and 165 on the generic 7.6in Foldable. Folding to the cover display can raise Android's "Swipe up to continue" lock screen; fold dismisses it so the app stays reachable. An emulator profile without those device states (a phone) fails with UNSUPPORTED_OPERATION and reason single-panel-device, and a physical device is refused. Keyframes are not supported on Android, and the response carries no panel geometry: re-snapshot after every fold.
|
|
73
|
+
If a task asserts behavior for more than one pose, fold to each pose and re-snapshot, and report which poses the run covered.`},rm=z(Gp,`Navigate back in the app or through system navigation. Use in-app for the app navigation stack and system when the platform back behavior is required.`,{mode:I(et),...ps(Gp)}),im=z(Kp,`Set device orientation on iOS and Android`,{orientation:j(I(ue))}),am={pose:I(xe,`Instant preset; mutually exclusive with keyframes.`),keyframes:L({type:`array`,minItems:2,maxItems:64,description:`Piecewise-linear hinge motion. Start at 0ms; strictly increasing timestamps, up to 60000ms. Repeated angles create holds. Mutually exclusive with pose.`,items:{type:`object`,required:[`atMs`,`angle`],additionalProperties:!1,properties:{atMs:{type:`integer`,minimum:0,maximum:he},angle:{type:`number`,minimum:0,maximum:180}}}})},om=z(qp,tm,am,{readInput:e=>{let{pose:t,keyframes:n,...r}=Lr(e,am);return{...r,...ce({pose:t,keyframes:n})}}}),sm={...om,inputSchema:{...om.inputSchema,oneOf:[{required:[`pose`],not:{required:[`keyframes`]}},{required:[`keyframes`],not:{required:[`pose`]}}]}},cm=z(Jp,`Inspect Android keyboard visibility/type or press/dismiss the device keyboard. To hide the keyboard, use keyboard dismiss. It taps the keyboard dismiss/hide key when one is exposed, verifies the keyboard closed, and reports UNSUPPORTED_OPERATION when no dismiss key exists — background taps are never attempted.`,{action:I(Qp)}),lm=z(Yp,`Read the current device clipboard text, or replace its contents with the given text. Android runs both through the clipboard service shell command, and a build that implements none (Android 16 does not) refuses with UNSUPPORTED_OPERATION rather than reporting an empty clipboard.`,{action:j(I(Zp)),text:M()},{parseableOutput:!0}),um=z(Xp,`Press or long-press a TV remote or D-pad button on Android TV, tvOS, or Vega OS. Choose the button and optional hold duration through the input fields. The aliases ok, center, and enter all map to select.`,{button:j(I(be)),durationMs:P(`Press duration in milliseconds. tvOS and Vega OS use the exact hold duration; Android TV maps any positive value to an ADB longpress (${ye(`android`)}).`,{min:0})}),dm={usageOverride:`back [--in-app|--system] [--settle]`,usageFlags:[],allowedFlags:[`backMode`,...ms(Gp)]},fm={usageOverride:`orientation <portrait|portrait-upside-down|landscape-left|landscape-right>`,positionalArgs:[`orientation`]},pm={usageOverride:`fold [${de}]`,positionalArgs:[`pose?`],allowedFlags:Pi},mm={usageOverride:`keyboard [status|get|dismiss|enter|return]`,positionalArgs:[`action?`]},hm={usageOverride:`clipboard read | clipboard write <text>`,listUsageOverride:`clipboard read | clipboard write <text>`,positionalArgs:[`read|write`,`text?`],allowsExtraPositionals:!0},gm={usageOverride:`tv-remote [press|longpress] ${me}`,listUsageOverride:`tv-remote press|longpress <button> [--duration-ms <ms>]`,positionalArgs:[`press|longpress?`,`button`],allowedFlags:[`durationMs`]},_m=(e,t)=>({..._(t),mode:t.backMode}),vm=(e,t)=>({..._(t),orientation:Ee(e[0])}),ym=(e,t)=>({..._(t),...ce({pose:e[0],keyframes:t.keyframes===void 0?void 0:we(t.keyframes)})}),bm=(e,t)=>({..._(t),...Bm(e)}),xm=(e,t)=>({..._(t),...Vm(e)}),Sm=(e,t)=>({..._(t),...Hm(e,t.durationMs)}),Cm=e=>g(Gp,[],{...e,backMode:Rm(e.mode)}),wm=h(Kp,e=>[C(e.orientation,`orientation requires orientation`)]),Tm=e=>{let t=ce(e);return g(qp,t.pose?[t.pose]:[],{...e,keyframes:t.keyframes?JSON.stringify(t.keyframes):void 0})},Em=h(Jp,e=>b(e.action)),Dm=h(Yp,e=>zm(e)),Om=h(Xp,e=>[C(e.button,`tv-remote requires button`)]),km=Qr({name:`appstate`,description:`Show foreground app/activity (Android; iOS answers per command)`,text:{summary:`Show the foreground app and activity`},run:(e,t)=>e.command.appState(t),cliOutputFormatter:$.appstate}),Am=B({name:Gp,text:{summary:`Navigate back in the app or system`},metadata:rm,run:(e,t)=>e.command.back(t),cliSchema:dm,cliReader:_m,daemonWriter:Cm,cliOutputFormatter:$.back}),jm=Qr({name:`home`,description:`Send the selected device to its home screen. This leaves the app session open but moves the foreground away from the app.`,text:{summary:`Go to the device home screen`},run:(e,t)=>e.command.home(t),cliOutputFormatter:$.home}),Mm=B({name:Kp,text:{summary:`Set device orientation`},metadata:im,run:(e,t)=>e.command.orientation(t),cliSchema:fm,cliReader:vm,daemonWriter:wm,cliOutputFormatter:$.orientation}),Nm=B({name:qp,text:{summary:`Fold or unfold a foldable iPhone simulator or Android emulator`,cliDetail:`iPhone Duo simulators and foldable Android emulators. iOS sends a ${em.hingeEvent} and confirms the hinge angle through CoreDevice; Android sets the emulator console posture and confirms the device state. Refs and coordinates do not survive a pose change.`},metadata:sm,run:(e,t)=>e.command.fold(t),cliSchema:pm,cliReader:ym,daemonWriter:Tm,cliOutputFormatter:$.fold}),Pm=Qr({name:`app-switcher`,description:`Open the device app switcher to inspect or change foreground apps. This changes the visible system UI and may move focus away from the current app.`,text:{summary:`Open the device app switcher`},run:(e,t)=>e.command.appSwitcher(t),cliOutputFormatter:$[`app-switcher`]}),Fm=B({name:Jp,text:{summary:`Inspect, press, or dismiss the device keyboard`},metadata:cm,run:(e,t)=>e.command.keyboard(t),cliSchema:mm,cliReader:bm,daemonWriter:Em,cliOutputFormatter:$.keyboard}),Im=B({name:Yp,text:{summary:`Read or write device clipboard text`},metadata:lm,run:(e,t)=>e.command.clipboard(t),cliSchema:hm,cliReader:xm,daemonWriter:Dm,cliOutputFormatter:$.clipboard}),Lm=V({name:`system`,commands:[km,Am,jm,Mm,Nm,Pm,Qr({name:`action-button`,description:`Press the iPhone or iPad Action Button once. The press is dispatched without activating the session app and nothing is re-observed afterwards, so the app keeps the state the press found. What the system does with the press is not observed by this command: Simulators run no Shortcuts or App Intents, so delivery to an assigned Shortcut is verifiable only on a physical iPhone.`,text:{summary:`Press the iPhone or iPad Action Button`,cliDetail:`iPhone and iPad only. The runner asks the device for the button and reports unsupported when that model has none.`},run:(e,t)=>e.command.actionButton(t),cliOutputFormatter:$[`action-button`]}),Fm,Im,B({name:Xp,text:{summary:`Press a TV remote/D-pad button`,cliDetail:`longpress holds for 500ms by default; --duration-ms overrides the preset.`},metadata:um,run:(e,t)=>e.command.tvRemote(t),cliSchema:gm,cliReader:Sm,daemonWriter:Om,cliOutputFormatter:$[`tv-remote`]})]});function Rm(e){return e===`in-app`||e===`system`?e:void 0}function zm(e){return e.action===`read`?[`read`]:[`write`,e.text]}function Bm(e){if(e.length>1)throw new r(`INVALID_ARGS`,`keyboard accepts at most one action argument.`);return p({action:Um(e[0])})}function Vm(e){let t=e[0]?.toLowerCase();if(t!==`read`&&t!==`write`)throw new r(`INVALID_ARGS`,`clipboard requires a subcommand: read or write.`);if(t===`read`){if(e.length!==1)throw new r(`INVALID_ARGS`,`clipboard read does not accept additional arguments.`);return{action:t}}if(e.length<2)throw new r(`INVALID_ARGS`,`clipboard write requires text.`);return{action:t,text:e.slice(1).join(` `)}}function Hm(e,t){let n=e[0]?.toLowerCase(),i=n===`press`||n===`longpress`?e.slice(1):e;if(i.length!==1)throw new r(`INVALID_ARGS`,`tv-remote requires exactly one button: ${be.join(`, `)}.`);let a=t??(n===`longpress`?500:void 0);return p({button:ve(i[0]),durationMs:a})}function Um(e){let t=e?.toLowerCase();if(t===`get`)return`status`;if(t===void 0||t===`status`||t===`dismiss`||t===`enter`||t===`return`)return t;throw new r(`INVALID_ARGS`,`keyboard action must be status, get, dismiss, enter, or return.`)}const Wm=[Dc,Uu,is,Lm,Hf,Np,Bd,jf,ls,sp,Yu,Di];function Gm(){return Wm.flatMap(e=>[...e.metadata])}function Km(){return Wm.flatMap(e=>[...e.definitions])}function qm(){return Zm(`cliSchemas`)}function Jm(){return Zm(`cliReaders`)}function Ym(){return Zm(`daemonWriters`)}function Xm(){return Zm(`cliOutputFormatters`)}function Zm(e){let t={};for(let n of Wm){let r=n[e];if(r)for(let[n,i]of Object.entries(r)){if(Object.hasOwn(t,n))throw Error(`Duplicate ${String(e)} command family entry: ${n}`);t[n]=i}}return t}const Qm=Gm(),$m=new Map(Qm.map(e=>[e.name,e]));function eh(){return[...Qm]}function th(){return Et().map(e=>{let t=rh(e);if(!t)throw Error(`Missing command metadata for MCP-exposed command: ${e}`);return t})}function nh(e){return $m.has(e)}function rh(e){return $m.get(e)}export{Li as A,D as B,hs as C,Hi as D,Ki as E,E as F,bn as G,fr as H,T as I,vn as J,xn as K,A as L,ii as M,ri as N,Ui as O,k as P,O as R,_c as S,ko as T,Ln as U,dr as V,Nn as W,Cu as _,Xm as a,jl as b,Ym as c,$p as d,nm as f,Tu as g,Vu as h,th as i,_i as j,Wi as k,Km as l,qu as m,nh as n,Jm as o,Ap as p,_n as q,eh as r,qm as s,rh as t,Gm as u,Xl as v,Jo as w,Ec as x,ql as y,w as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e={}){return{allowLocalInputPaths:!0,allowLocalOutputPaths:!0,maxImagePixels:2e7,...e}}function t(e={}){return{allowLocalInputPaths:!1,allowLocalOutputPaths:!1,maxImagePixels:2e7,...e}}export{t as n,e as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{P as e}from"./sdk-contracts.js";import{
|
|
1
|
+
import{P as e}from"./sdk-contracts.js";import{A as t,D as n,r,s as i}from"./command-metadata.js";const a={plugins:{text:{summary:`Manage installed provider plugins`,description:`Install, list, update, or remove npm provider plugins in AGENT_DEVICE_HOME (default ~/.agent-device). Changes take effect after restarting the local daemon. Use --json for structured results.`},usageOverride:`plugins list|add <package[@version]>|update <package>|remove <package>`,listUsageOverride:`plugins`,positionalArgs:[`list|add|update|remove`,`package?`],supportedFlags:[]},cdp:{text:{summary:`Inspect CDP targets, JS heap, and leaks`,description:`Run CDP commands for React Native diagnostics, JS heap usage, heap snapshots, and leak analysis`},usageOverride:`cdp [...args]`,listUsageOverride:`cdp`,positionalArgs:[`args?`],allowsExtraPositionals:!0,supportedFlags:n},auth:{text:{summary:`Manage cloud login state`,description:`Manage cloud login state used by remote daemon and cloud device workflows.`},usageOverride:`auth status|login|logout`,listUsageOverride:`auth`,positionalArgs:[`status|login|logout`],supportedFlags:[`remoteConfig`,`stateDir`]},daemon:{text:{summary:`Stop a local daemon and clean up resources`,description:`Stop a local daemon after verifying its PID/start-time identity. Use --clean to remove retained Apple runner processes and leases owned by that daemon.`},usageOverride:`daemon stop [--state-dir <path>]`,listUsageOverride:`daemon stop`,positionalArgs:[`stop`],allowedFlags:[`clean`],supportedFlags:[`stateDir`]},device:{text:{summary:`Inspect and recover enforced local device ownership without a daemon`,description:`Inspect enforced host-local device ownership claims without starting or contacting a daemon; status --stale only inspects proven-stale claims. release --stale settles a provably dead owner through exact-owner resource reconciliation and clears its claim last — live and uncertain owners always fail closed. Automatic reclamation still occurs during open and daemon startup.`},usageOverride:`device status|release [--platform <platform>] [--udid <udid>] [--serial <serial>]`,listUsageOverride:`device status`,positionalArgs:[`status|release`],allowedFlags:[`stale`],supportedFlags:[`platform`,`device`,`udid`,`serial`]},connect:{text:{summary:`Configure remote or provider state`,description:`Configure remote access without allocating a device. Direct providers validate credentials/resources before saving state and print the exact device/app preparation needed before open. AGENT_DEVICE_CLOUD_BASE_URL is the bridge/control-plane API origin; use AGENT_DEVICE_DAEMON_AUTH_TOKEN=adc_live_... for CI/service-token automation.`},usageOverride:`connect [provider] [--remote-config <path>] [--daemon-base-url <url>] [--tenant <id>] [--run-id <id>] [--lease-id <id>] [--lease-backend <backend>] [--force] [--no-login]`,usageFlags:[],listUsageOverride:`connect`,positionalArgs:[`provider?`],allowedFlags:`remoteConfig.daemonBaseUrl.tenant.runId.leaseId.leaseBackend.providerApp.providerOsVersion.providerDeviceType.providerProject.providerBuild.providerSessionName.providerDeviceOrientation.providerGeoLocation.providerTimezone.providerAppiumVersion.providerLanguage.providerLocale.providerNetworkProfile.providerCustomNetwork.providerNoResignApp.awsProjectArn.awsDeviceArn.awsAppArn.awsRegion.awsInteractionMode.force.noLogin`.split(`.`),supportedFlags:[`stateDir`,`daemonAuthToken`,`session`,`platform`,`device`,...t,`launchUrl`]},connection:{text:{summary:`Inspect the saved remote connection`,description:`Inspect active remote connection state`},usageOverride:`connection status`,listUsageOverride:`connection`,positionalArgs:[`status`],supportedFlags:[`remoteConfig`,`stateDir`,`session`]},disconnect:{text:{summary:`Clear remote connection state and release leases`,description:`Disconnect remote daemon state, stop owned Metro companion, and release lease`},listUsageOverride:`disconnect`,allowedFlags:[`shutdown`],supportedFlags:[`remoteConfig`,`stateDir`,`session`]},mcp:{text:{summary:`Start MCP server`,description:`Start the official stdio MCP server. It exposes structured command tools backed by the agent-device client.`}},proxy:{text:{summary:`Expose a local daemon through an HTTP tunnel`,description:`Expose the local daemon HTTP contract through a tunnel-friendly reverse proxy.
|
|
2
2
|
|
|
3
3
|
Run this on the host that has access to simulators/devices, expose the printed local proxy URL through a tunnel, then point another machine at the tunnel URL with connect proxy.
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ Use the /agent-device base path when connecting through cloudflared, ngrok, or a
|
|
|
9
9
|
Examples:
|
|
10
10
|
agent-device proxy --port 4310
|
|
11
11
|
cloudflared tunnel --url http://127.0.0.1:4310
|
|
12
|
-
agent-device connect proxy --daemon-base-url https://example.trycloudflare.com/agent-device --daemon-auth-token <token>`},listUsageOverride:`proxy`,allowedFlags:[`proxyHost`,`proxyPort`,`daemonAuthToken`,`stateDir`]},takeover:{text:{summary:`Pause agent interactions while a person controls a device`,description:`Temporarily hand control of the active remote lease device to a person. The foreground command pauses state-changing agent commands, renews the hold until Ctrl+C, and then releases it. Read-only diagnostics remain available. Uses the active connection and --session, with normal tenant and lease admission. status lists holds on that device; release removes a hold owned by the admitted lease. The host-only /admin/human-control/holds API uses the separate local daemon token. Holds do not survive daemon restart. Local takeover without a remote device lease is not supported.`},usageOverride:`takeover [status | release <hold-id>] [--session <name>]`,listUsageOverride:`takeover [status|release]`,positionalArgs:[`status|release?`,`hold-id?`],supportedFlags:[`stateDir`,`session`,`remoteConfig`,`daemonBaseUrl`,`daemonAuthToken`,`daemonTransport`,`tenant`,`runId`,`leaseId`,`leaseBackend`,`sessionIsolation`]},"react-devtools":{text:{summary:`Inspect components, hooks, and render profiles`,description:`Run pinned agent-react-devtools commands for React Native performance profiling, component trees, props/state/hooks, and render analysis`},usageOverride:`react-devtools [...args]`,listUsageOverride:`react-devtools`,positionalArgs:[`args?`],allowsExtraPositionals:!0,supportedFlags:
|
|
12
|
+
agent-device connect proxy --daemon-base-url https://example.trycloudflare.com/agent-device --daemon-auth-token <token>`},listUsageOverride:`proxy`,allowedFlags:[`proxyHost`,`proxyPort`,`daemonAuthToken`,`stateDir`]},takeover:{text:{summary:`Pause agent interactions while a person controls a device`,description:`Temporarily hand control of the active remote lease device to a person. The foreground command pauses state-changing agent commands, renews the hold until Ctrl+C, and then releases it. Read-only diagnostics remain available. Uses the active connection and --session, with normal tenant and lease admission. status lists holds on that device; release removes a hold owned by the admitted lease. The host-only /admin/human-control/holds API uses the separate local daemon token. Holds do not survive daemon restart. Local takeover without a remote device lease is not supported.`},usageOverride:`takeover [status | release <hold-id>] [--session <name>]`,listUsageOverride:`takeover [status|release]`,positionalArgs:[`status|release?`,`hold-id?`],supportedFlags:[`stateDir`,`session`,`remoteConfig`,`daemonBaseUrl`,`daemonAuthToken`,`daemonTransport`,`tenant`,`runId`,`leaseId`,`leaseBackend`,`sessionIsolation`]},"react-devtools":{text:{summary:`Inspect components, hooks, and render profiles`,description:`Run pinned agent-react-devtools commands for React Native performance profiling, component trees, props/state/hooks, and render analysis`},usageOverride:`react-devtools [...args]`,listUsageOverride:`react-devtools`,positionalArgs:[`args?`],allowsExtraPositionals:!0,supportedFlags:n},web:{text:{summary:`Manage web automation backend`,description:`Install and inspect the managed web automation backend used by --platform web.
|
|
13
13
|
|
|
14
14
|
First-run flow:
|
|
15
15
|
agent-device web setup
|
|
@@ -19,4 +19,4 @@ First-run flow:
|
|
|
19
19
|
|
|
20
20
|
Runtime web commands do not install the backend implicitly. If the managed backend is missing, run agent-device web setup. The backend is resolved only from the managed install in the effective agent-device state dir.
|
|
21
21
|
|
|
22
|
-
Use web setup to install or reuse the pinned backend. Use web doctor after setup to verify browser backend health.`},usageOverride:`web setup | web doctor`,listUsageOverride:`web setup|doctor`,positionalArgs:[`setup|doctor`],supportedFlags:[`stateDir`]}},o=
|
|
22
|
+
Use web setup to install or reuse the pinned backend. Use web doctor after setup to verify browser backend health.`},usageOverride:`web setup | web doctor`,listUsageOverride:`web setup|doctor`,positionalArgs:[`setup|doctor`],supportedFlags:[`stateDir`]}},o=i();function s(e){return Object.hasOwn(a,e)?a[e]:void 0}function c(e){return Object.hasOwn(o,e)?o[e]:void 0}const l=new Map(r().map(e=>[e.name,{supportedFlags:n}]));function u(e){if(e)return p(e)}function d(e){let t=p(e);if(!t)throw Error(`Missing command schema for ${e}`);return t}function f(t,n,r){let i=u(t);if(!t||!i||i.allowsExtraPositionals)return;let a=i.positionalArgs?.length??0;if(n.length<=a)return;let o=r?`${r} ${t}`:t;throw new e(`INVALID_ARGS`,`${o} accepts at most ${a} positional argument(s), received ${n.length}: ${n.join(` `)}`)}function p(e){let t=s(e);if(t)return t;let n=l.get(e),r=c(e);if(!(!n||!r))return{...n,...r}}export{d as n,u as r,f as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime.js";import{l as t}from"./command-metadata.js";var n=e({runCommand:()=>a});const r=t(),i=new Map(r.map(e=>[e.name,e]));async function a(e,t,n){return await o(t).invoke(e,n)}function o(e){return i.get(e)}export{a as n,n as t};
|