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
package/dist/src/settings.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as
|
|
1
|
+
import{B as e,F as t,P as n}from"./sdk-contracts.js";const r=[`grant`,`deny`,`reset`],i=[`full`,`limited`],a=[`all`,`camera`,`microphone`,`photos`,`contacts`,`contacts-limited`,`notifications`,`calendar`,`location`,`location-always`,`media-library`,`motion`,`reminders`,`siri`],o=[`accessibility`,`screen-recording`,`input-monitoring`],s=[`extra-small`,`small`,`medium`,`large`,`extra-large`,`extra-extra-large`,`extra-extra-extra-large`,`accessibility-medium`,`accessibility-large`,`accessibility-extra-large`,`accessibility-extra-extra-large`,`accessibility-extra-extra-extra-large`],c=[`light`,`dark`,`toggle`],l=[`on`,`true`,`1`],u=[`off`,`false`,`0`];function d(e,t){return Object.freeze({setting:`text-size`,category:e,platformValue:t})}function f(e){return`Text size is ${e.category}`}function p(e,t,n){return e===`clear-app-state`?`Cleared user data for ${n}`:e===`text-size`?`Text size set to ${t}`:`Updated setting: ${e}`}function m(e,t,n){let r=t.trim().toLowerCase();return r===`clear-app-state`?e===`macos-host`?`unknown`:`app-scoped`:r===`permission`?e===`macos-host`?`device-level`:`app-scoped`:r===`location`?h(e,n):`unknown`}function h(e,t){let n=t?.trim().toLowerCase();return n===`set`?`device-level`:G(n)===void 0?`unknown`:e===`apple`?`app-scoped`:e===`mobile`?`device-level`:`unknown`}function g(e,t,n){let r=t===void 0?e:`${e} ${t}`;return{code:`INVALID_ARGS`,message:`settings ${r} applies to the target itself, not to an app: ${n} names nothing it can grant or revoke.`,details:{reason:`setting_app_not_consumed`,dispatched:`no`,setting:r,app:n},hint:`Drop the --app option and run \`settings ${r}\`, or aim the app at an app-scoped setting such as \`settings permission grant location --app ${n}\`.`}}const _=`setting_app_not_package`;async function v(r,i){try{return await i(r)}catch(i){throw i instanceof n?(i.code===`APP_NOT_INSTALLED`&&(i.details={...i.details,...t(),app:r,hint:`Run apps --all for the exact bundle id or package name, or install the app, then retry with that id in --app.`}),e(i,`no`)):i}}const y=`<wifi|airplane|location> <on|off>`,b=`location set <lat> <lon>`,x=`animations <on|off>`,S=`appearance <${c.join(`|`)}>`,C=`faceid <match|nonmatch|enroll|unenroll>`,w=`touchid <match|nonmatch|enroll|unenroll>`,T=`fingerprint <match|nonmatch>`,E=`clear-app-state [app-id]`,D=`reset-keychain clear`,O=`text-size [${s.join(`|`)}]`,k=`permission <${r.join(`|`)}> <${a.join(`|`)}> [${i.join(`|`)}]`,A=`permission <grant|reset> <${o.join(`|`)}>`,j=`macOS supports only settings ${S} and settings ${A}. wifi|airplane|location|animations|text-size remain unsupported on macOS.`,M=[`settings ${y}`,`settings ${b}`,`settings ${x}`,`settings ${S}`,`settings ${O}`,`settings ${C}`,`settings ${w}`,`settings ${T}`,`settings ${E}`,`settings ${D}`,`settings ${k}`,`settings ${A}`].join(` | `),N=`settings requires ${y}, ${b}, ${x}, ${S}, ${O}, ${C}, ${w}, ${T}, ${E}, ${D}, ${k}, or ${A}`;function P(e){let t=e.trim().toLowerCase();return t===`appearance`||t===`permission`}function F(e){return`Unsupported macOS setting: ${e}. ${j}`}function I(e){let t=R(e);if(t!==void 0)return t;throw new n(`INVALID_ARGS`,L(e))}function L(e){return`Invalid text size: ${e??``}. Use ${s.join(`|`)}.`}function R(e){return V(s,e)}const z=Object.freeze({message:`Reading or setting a text size is supported on iOS and iPadOS simulators.`,hint:"Run `xcrun simctl ui <device> content_size` on a booted iPhone or iPad simulator.",reason:`setting-unsupported-on-leaf`}),B=Object.freeze({message:`Face ID and Touch ID simulation is supported on iOS and iPadOS simulators.`,hint:"Select a booted iPhone or iPad simulator, then run `settings faceid <state>` or `settings touchid <state>`.",reason:`setting-unsupported-on-leaf`});function V(e,t){let n=t?.trim().toLowerCase();return n===void 0?void 0:e.find(e=>e===n)}function H(e){let t=V(r,e);if(t!==void 0)return t;throw new n(`INVALID_ARGS`,`Invalid permission action: ${e}. Use ${r.join(`|`)}.`)}function U(e){let t=V(a,e);if(t!==void 0)return t;throw new n(`INVALID_ARGS`,`permission setting requires a target: ${a.join(`|`)}`)}function W(e){let t=V(c,e);if(t!==void 0)return t;throw new n(`INVALID_ARGS`,`Invalid appearance state: ${e}. Use ${c.join(`|`)}.`)}function G(e){if(e===void 0)return;let t=e.toLowerCase();if(l.includes(t))return!0;if(u.includes(t))return!1}function K(e){let t=G(e);if(t!==void 0)return t;throw new n(`INVALID_ARGS`,`Invalid setting state: ${e}`)}export{R as C,d as D,m as E,I as S,g as T,P as _,a,U as b,_ as c,M as d,s as f,L as g,F as h,o as i,N as l,p as m,B as n,r as o,f as p,z as r,i as s,c as t,A as u,W as v,v as w,K as x,H as y};
|
package/dist/src/settings2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{P as e,et as t}from"./sdk-contracts.js";import{runHarmonyShell as n}from"./hdc.js";async function r(r,i,a,o){if(i!==`clear-app-state`)throw new e(`UNSUPPORTED_OPERATION`,`HarmonyOS setting "${i}" is not supported`,{hint:`HarmonyOS currently supports settings clear-app-state for an app bundle only.`});if(a!==`clear`)throw new e(`INVALID_ARGS`,`settings clear-app-state only supports clear.`);if(!o)throw new e(`INVALID_ARGS`,`settings clear-app-state requires an app id or an active app session.`,t());return await n(r,[`aa`,`force-stop`,o],{timeoutMs:15e3}),await n(r,[`bm`,`clean`,`-n`,o,`-d`,`-c`],{timeoutMs:15e3}),{bundleId:o,forceStopped:!0,clearedData:!0,clearedCache:!0}}export{r as setHarmonySetting};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{P as e,et as t}from"./sdk-contracts.js";import{b as n,v as r,x as i,y as a}from"./settings.js";import{n as o}from"./location-coordinates.js";async function s(e){switch(e.setting){case`appearance`:return await c(e);case`permission`:return await l(e);case`location`:return await u(e)}}async function c({runSimctl:t,udid:n,state:i}){let a=r(i),o;if(a===`toggle`){let r=await t([`ui`,n,`appearance`]),i=m(r.stdout,r.stderr);if(!i)throw new e(`COMMAND_FAILED`,`Unable to determine current iOS appearance for toggle`,{stdout:r.stdout,stderr:r.stderr});o=i===`dark`?`light`:`dark`}else o=a;await t([`ui`,n,`appearance`,o])}async function l(e){let{runSimctl:t,udid:n,deviceId:r,state:i,options:o}=e,s=a(i),c=s===`deny`?`revoke`:s,l=p(o?.permissionTarget,o?.permissionMode),u=await d(e);try{await t([`privacy`,n,c,l,u])}catch(e){throw h(e)?g(c,l,u,r,e):e}}async function u(e){let{runSimctl:t,udid:n,state:r,options:a}=e;if(r.toLowerCase()===`set`){let{latitude:e,longitude:r}=o(a);return await t([`location`,n,`set`,`${e},${r}`]),{latitude:e,longitude:r}}await t([`privacy`,n,i(r)?`grant`:`revoke`,`location`,await d(e)])}async function d({setting:n,appBundleId:r,resolveApp:i}){if(r)return await i(r);throw new e(`INVALID_ARGS`,`${n} setting requires an active app in session`,t())}const f={all:`all`,camera:`camera`,microphone:`microphone`,contacts:`contacts`,"contacts-limited":`contacts-limited`,notifications:`notifications`,calendar:`calendar`,location:`location`,"location-always":`location-always`,"media-library":`media-library`,motion:`motion`,reminders:`reminders`,siri:`siri`};function p(t,r){let i=n(t);if(i===`photos`){let t=r?.trim().toLowerCase();if(!t||t===`full`)return`photos`;if(t===`limited`)return`photos-add`;throw new e(`INVALID_ARGS`,`Invalid photos mode: ${r}. Use full|limited.`)}if(r?.trim())throw new e(`INVALID_ARGS`,`Permission mode is only supported for photos. Received: ${r}.`);return f[i]}function m(e,t){let n=/\b(light|dark|unsupported|unknown)\b/i.exec(`${e}\n${t}`);if(!n)return null;let r=n[1]?.toLowerCase();return r===`dark`?`dark`:r===`light`?`light`:null}function h(t){if(!(t instanceof e)||t.code!==`COMMAND_FAILED`)return!1;let n=String(t.details?.stderr??``).toLowerCase();return/failed to (set|grant|revoke|reset) access/.test(n)&&n.includes(`operation not permitted`)}function g(t,n,r,i,a){return t===`reset`?new e(`UNSUPPORTED_OPERATION`,`iOS simulator does not support resetting ${n} permission via simctl privacy on this runtime.`,{deviceId:i,appBundleId:r,hint:`Use reinstall to force a fresh prompt, or reset simulator content and settings.`},a):new e(`UNSUPPORTED_OPERATION`,`iOS simulator does not support setting ${n} permission via simctl privacy on this runtime.`,{deviceId:i,appBundleId:r,hint:"Privacy support varies by Xcode runtime: run `xcrun simctl privacy help` for its documented services, or use the `all` target, which applies the action to every service this runtime can change."},a)}export{s as t};
|
package/dist/src/simctl.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{h as e}from"./sdk-device.js";import"./command.js";import{r as t}from"./device-isolation.js";import{o as n,s as r}from"./tool-provider.js";function i(n){let r=e(n)&&n.kind===`simulator`?t(n.simulatorSetPath):void 0;return Object.freeze({udid:n.id,simulatorSetPath:r})}function a(e,n){let r=t(e),i=r?[`--set`,r,...n]:[...n];return Object.freeze(i)}function o(){return a(void 0,[`help`])}function s(e){return a(e,[`list`,`-j`])}function c(e,t){return a(i(e).simulatorSetPath,t)}function l(e,t){return r(a(e.simulatorSetPath,t))}function u(e,t){return l(i(e),t)}function d(e,t,r){return n(u(e,t),r)}function f(e){return JSON.parse(e).devices??{}}function p(e,t){try{for(let n of Object.values(f(e))){let e=n.find(e=>e.udid===t);if(e)return e.state??null}return null}catch{return null}}function m(e){let t=e.trim();if(!(!t||t===`(null)`))return t}export{f as a,o as c,p as i,s as l,u as n,d as o,m as r,c as s,l as t,i as u};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{h as e}from"./sdk-device.js";import{l as t}from"./exec.js";import"./command.js";const n=`launchd_sim`,r={LC_ALL:`C`},i=/^(\d+)\s+([A-Za-z]{3} [A-Za-z]{3} +\d{1,2} \d{2}:\d{2}:\d{2} \d{4})\s+(.+)$/,a=/^[A-Za-z]{3} ([A-Za-z]{3}) +(\d{1,2}) (\d{2}):(\d{2}):(\d{2}) (\d{4})$/,o=new Map([[`Jan`,0],[`Feb`,1],[`Mar`,2],[`Apr`,3],[`May`,4],[`Jun`,5],[`Jul`,6],[`Aug`,7],[`Sep`,8],[`Oct`,9],[`Nov`,10],[`Dec`,11]]);async function s(t){if(!e(t)||t.kind!==`simulator`)return{observed:!1,reason:`unsupported-device`};let n=await c();if(n.length===0)return{observed:!1,reason:`unobserved`};let r=d(await l(n),t.id);return r===void 0?{observed:!1,reason:`unobserved`}:{observed:!0,bootedAtMs:r}}async function c(){let e=await u(`/usr/bin/pgrep`,[`-x`,n]);return e===void 0?[]:e.split(`
|
|
2
2
|
`).map(e=>Number.parseInt(e.trim(),10)).filter(e=>Number.isInteger(e)&&e>0)}async function l(e){return await u(`/bin/ps`,[`-p`,e.join(`,`),`-o`,`pid=,lstart=,command=`],r)??``}async function u(e,n,r){try{let i=await t(e,[...n],{allowFailure:!0,timeoutMs:2e3,...r?{env:r}:{}});return i.exitCode===0?i.stdout:void 0}catch{return}}function d(e,t){let n=Date.now(),r;for(let i of e.split(`
|
|
3
3
|
`)){let e=f(i,t);e===void 0||e>n||(r===void 0||e>r)&&(r=e)}return r}function f(e,t){let[,n,r]=i.exec(e)?.slice(1)??[];if(n!==void 0&&r!==void 0&&p(r,t))return m(n)}function p(e,t){let[r,...i]=e.trim().split(/\s+/);return r!==void 0&&r.split(`/`).pop()===n&&i.some(e=>e.includes(t))}function m(e){let[,t,n,r,i,s,c]=a.exec(e.trim())??[],l=t===void 0?void 0:o.get(t);if(l===void 0)return;let u=new Date(Number(c),l,Number(n),Number(r),Number(i),Number(s)).getTime();return Number.isFinite(u)?u:void 0}export{s as observeSimulatorBootTimeMs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{i as e,s as t}from"./simctl.js";async function n(n,r,i,a){let o=await n.run({tool:`simctl`,args:t(r,[`list`,`devices`,`-j`]),allowFailure:!0,timeoutMs:a},i);return o.exitCode===0?e(o.stdout,r.id):null}export{n as t};
|
package/dist/src/simulator.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as e}from"./sdk-contracts.js";import{o as t,r as n}from"./exec.js";import
|
|
1
|
+
import{P as e}from"./sdk-contracts.js";import{o as t,r as n}from"./exec.js";import{r,t as i}from"./retry.js";import"./command.js";import{o as a}from"./version.js";import"./retry2.js";import{n as o,t as s}from"./boot-diagnostics.js";import{l as c,r as l,u}from"./config.js";import{a as d,o as f}from"./tool-provider.js";import{i as p,n as m}from"./simctl.js";const h=a({ttlMs:5e3});function g(e){return`${e.id}|${e.simulatorSetPath??``}`}function _(e){return h.get(g(e))===!0}function v(e){h.set(g(e),!0)}function y(t,n){if(t.kind!==`simulator`)throw new e(`UNSUPPORTED_OPERATION`,`${n} is only supported on iOS simulators`)}async function b(e={}){await d(`open`,[`-a`,`Simulator`],{allowFailure:!0,signal:e.signal,timeoutMs:u})}async function x(a,c={}){if(a.kind!==`simulator`)return;if(c.signal?.throwIfAborted(),(_(a)?`Booted`:await S(a,c.signal))===`Booted`){v(a);return}let u=i.fromTimeoutMs(l),d,p;try{await r(async({deadline:r})=>{if(r?.isExpired())throw new e(`COMMAND_FAILED`,`iOS simulator boot deadline exceeded`,{timeoutMs:l});let i=Math.max(1e3,r?.remainingMs()??18e4);d=await f(m(a,[`boot`,a.id]),{allowFailure:!0,signal:c.signal,timeoutMs:i});let o=`${d.stdout}\n${d.stderr}`.toLowerCase(),s=o.includes(`already booted`)||o.includes(`current state: booted`);if(d.exitCode!==0&&!s)throw new e(`COMMAND_FAILED`,`simctl boot failed`,n(d));p=await f(m(a,[`bootstatus`,a.id,`-b`]),{allowFailure:!0,signal:c.signal,timeoutMs:i}),t(p,`simctl bootstatus failed`);let u=await S(a,c.signal);if(u!==`Booted`)throw new e(`COMMAND_FAILED`,`Simulator is still booting`,{state:u})},{maxAttempts:3,baseDelayMs:500,maxDelayMs:2e3,jitter:.2,shouldRetry:e=>{let t=o({error:e,stdout:p?.stdout??d?.stdout,stderr:p?.stderr??d?.stderr,context:{platform:`ios`,phase:`boot`}});return t!==`IOS_BOOT_TIMEOUT`&&t!==`CI_RESOURCE_STARVATION_SUSPECTED`}},{deadline:u,phase:`boot`,signal:c.signal,classifyReason:e=>o({error:e,stdout:p?.stdout??d?.stdout,stderr:p?.stderr??d?.stderr,context:{platform:`ios`,phase:`boot`}})})}catch(t){let n=o({error:t,stdout:p?.stdout??d?.stdout,stderr:p?.stderr??d?.stderr,context:{platform:`ios`,phase:`boot`}});throw new e(`COMMAND_FAILED`,`iOS simulator failed to boot`,{platform:`ios`,deviceId:a.id,timeoutMs:l,elapsedMs:u.elapsedMs(),reason:n,hint:s(n),boot:d,bootstatus:p})}v(a),await b({signal:c.signal})}async function S(e,t){let n=m(e,[`list`,`devices`,`-j`]),r=await f(n,{allowFailure:!0,signal:t,timeoutMs:c});return r.exitCode===0?p(r.stdout,e.id):null}export{_ as i,v as n,y as r,x as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={healthy:!0,recovered:!0,sparse:!0},t={tree:!0,queries:!0,"private-ax":!0,"android-helper":!0};function n(e){let t=
|
|
1
|
+
const e={healthy:!0,recovered:!0,sparse:!0},t={tree:!0,queries:!0,"private-ax":!0,"android-helper":!0};function n(e){let t=s(e.quality);return{...e.analysis?{analysis:e.analysis}:{},...e.androidSnapshot?{androidSnapshot:e.androidSnapshot}:{},...e.freshness?{freshness:e.freshness}:{},...t?{quality:t}:{},...e.warnings?{warnings:e.warnings}:{},...e.targetActivation?{targetActivation:e.targetActivation}:{},...e.observation?{observation:e.observation}:{}}}function r(e){return{...e.androidSnapshot?{androidSnapshot:e.androidSnapshot}:{},...e.quality?{snapshotQuality:e.quality}:{},...e.warnings&&e.warnings.length>0?{warnings:e.warnings}:{},...e.targetActivation?{targetActivation:e.targetActivation}:{},...e.observation?{observation:e.observation}:{}}}function i(e){let t=l(e.androidSnapshot),n=Array.isArray(e.warnings)?e.warnings.filter(e=>typeof e==`string`):void 0,i=s(e.snapshotQuality),c=o(e.targetActivation),u=a(e.observation);return r({...t?{androidSnapshot:t}:{},...i?{quality:i}:{},...n?{warnings:n}:{},...c?{targetActivation:c}:{},...u?{observation:u}:{}})}function a(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e;return t.mode===`observe-only`&&t.activationPerformed===!1&&t.appState===`runningForeground`&&t.appStateSource===`xcuiapplication-state`?{mode:`observe-only`,activationPerformed:!1,appState:t.appState,appStateSource:t.appStateSource}:void 0}function o(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e;return typeof t.reason==`string`&&typeof t.priorState==`string`?t:void 0}function s(n){if(!n||typeof n!=`object`)return;let r=n;if(!(!c(e,r.state)||!c(t,r.backend)))return r}function c(e,t){return typeof t==`string`&&Object.hasOwn(e,t)}function l(e){return typeof e==`object`&&e?e:void 0}export{n as i,i as n,a as r,r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./android-input-ownership.js";import{Ir as t}from"./sdk-batch.js";import{n,r}from"./android-system-chrome.js";const i=[`status`,`get`,`dismiss`,`enter`,`return`];function a(e){return i.includes(e)}const o=new Set([`textfield`,`securetextfield`,`textview`,`textarea`,`searchfield`,`edittext`]),s={strippedIndexes:new Set,refs:new Set};function c(e){let n=new Set(e.filter(e=>t(e.type??``)===`keyboard`).map(e=>e.index));if(n.size===0)return s;let r=new Map(e.map(e=>[e.index,e])),i=p(e,r,n),a=new Set(i),o=x(e,r,i);for(let t of p(e,r,o))a.add(t);for(let t of l(e,r,o,n,i))a.delete(t);let c=new Set(e.filter(e=>e.ref&&a.has(e.index)).map(e=>e.ref));return{strippedIndexes:new Set([...a].filter(e=>!n.has(e))),refs:c}}function l(e,t,n,r,i){let a=new Set;if(n.size===0)return a;let o=d(t,n,r);if(o.size===0)return a;let s=f(t,r);for(let n of e)!i.has(n.index)&&!s.has(n.index)&&n.rect&&u(n,t,o)&&a.add(n.index);return a}function u(e,t,n){if(!e.rect)return!1;let r=S(e,t);if(r===void 0)return!1;let i=n.get(r);return i!==void 0&&e.rect.y+e.rect.height/2<i}function d(e,t,n){let r=new Map;for(let i of n){let n=e.get(i);if(!n?.rect)continue;let a=S(n,e);if(a===void 0||!t.has(a))continue;let o=r.get(a);(o===void 0||n.rect.y<o)&&r.set(a,n.rect.y)}return r}function f(e,t){let n=new Set;for(let r of t){let t=e.get(r),i=t&&typeof t.parentIndex==`number`?e.get(t.parentIndex):void 0;for(;i;)n.add(i.index),i=typeof i.parentIndex==`number`?e.get(i.parentIndex):void 0}return n}function p(e,t,n){let r=new Set(n);if(n.size===0)return r;for(let i of e)C(i,t,n)&&r.add(i.index);return r}function m(e,t){if(e.bundleId!==`com.android.systemui`)return!1;if(n(e))return!0;let i=new Set,a=e;for(;a?.bundleId===`com.android.systemui`&&!i.has(a.index);){if(r(a.identifier))return!0;i.add(a.index),a=a.parentIndex===void 0?void 0:t.get(a.parentIndex)}return!1}function h(t,n){let r=new Map(t.map(e=>[e.index,e])),i=new Set(t.filter(e).map(e=>e.index)),a=new Set([...i].filter(e=>{let t=r.get(e)?.parentIndex,n=t===void 0?void 0:r.get(t);return!n||!i.has(n.index)})),o=n===`com.android.systemui`?new Set:g(t,r,i),c=new Set([...i].filter(e=>!a.has(e)));for(let e of o)c.add(e);let l=new Set(t.filter(e=>e.ref&&(i.has(e.index)||o.has(e.index))).map(e=>e.ref));return c.size===0&&l.size===0?s:{strippedIndexes:c,refs:l}}function g(e,t,n){return new Set(e.filter(e=>!n.has(e.index)&&m(e,t)).map(e=>e.index))}function _(e,t){let n=c(e),r=h(e,t);return n.strippedIndexes.size===0&&n.refs.size===0?r:r.strippedIndexes.size===0&&r.refs.size===0?n:{strippedIndexes:new Set([...n.strippedIndexes,...r.strippedIndexes]),refs:new Set([...n.refs,...r.refs])}}function v(e,t){let{strippedIndexes:n}=_(e,t);return n.size===0?e:e.filter(e=>!n.has(e.index))}function y(e,t){return _(e,t).refs}function b(e){return c(e).refs}function x(e,n,r){let i=new Set;for(let e of r){let r=n.get(e);if(!r||t(r.type??``)!==`keyboard`)continue;let a=S(r,n);a!==void 0&&i.add(a)}for(let a of i){let s=new Set([a]);e.some(e=>o.has(t(e.type??``))&&!r.has(e.index)&&C(e,n,s))&&i.delete(a)}return i}function S(e,n){let r=typeof e.parentIndex==`number`?n.get(e.parentIndex):void 0;for(;r;){if(t(r.type??``)===`window`)return r.index;r=typeof r.parentIndex==`number`?n.get(r.parentIndex):void 0}}function C(e,t,n){let r=typeof e.parentIndex==`number`?t.get(e.parentIndex):void 0;for(;r;){if(n.has(r.index))return!0;r=typeof r.parentIndex==`number`?t.get(r.parentIndex):void 0}return!1}export{a as i,y as n,v as r,b as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Br as e,Hr as t,Ur as n}from"./sdk-batch.js";const r=[`button`,`menu`,`textfield`,`searchfield`,`checkbox`,`radio`,`switch`];function i(e,t){let n=e.nodes??[];return t.scope&&(n=a(n,t.scope,e=>!t.interactiveOnly||n.slice(e.start,e.end).some(c))),t.interactiveOnly&&(n=o(n)),typeof t.depth==`number`&&(n=s(n,t.depth)),{...e,nodes:n}}function a(r,i,a){let o=t(i);if(!o)return n(r);let s=e(r,o,a);if(!s)return[];let c=r.slice(s.start,s.end);return n(c,c[0]?.depth??0)}function o(e){if(e.length===0)return e;let t=new Map(e.map(e=>[e.index,e])),r=new Set;for(let n of e){if(!c(n))continue;let e=n;for(;e&&!r.has(e.index);)r.add(e.index),e=typeof e.parentIndex==`number`?t.get(e.parentIndex):void 0}return r.size===0?e:n(e.filter(e=>r.has(e.index)))}function s(e,t){return n(e.filter(e=>(e.depth??0)<=t))}function c(e){if([e.focused,e.hittable,e.rect].some(Boolean))return!0;let t=`${e.type??``} ${e.role??``} ${e.subrole??``}`.toLowerCase();return r.some(e=>t.includes(e))}export{i as n,a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createHash as e}from"node:crypto";const t=new WeakMap;function n(e,n){i(e)&&t.set(e,n)}function r(e){return i(e)?t.get(e):void 0}function i(e){return typeof e==`object`&&!!e||typeof e==`function`}function a(t){let n=Buffer.alloc(16);for(let e of t)s(n,o(e));return{digest:`ax1:${e(`sha256`).update(n).update(`\0`).update(String(t.length)).digest(`hex`).slice(0,16)}`,nodeCount:t.length}}function o(t){return e(`sha256`).update(t.type??``).update(`\0`).update(t.label??``).update(`\0`).update(t.identifier??``).digest().subarray(0,16)}function s(e,t){for(let n=0;n<e.length;n+=1)e[n]=(e[n]??0)^(t[n]??0)}function c(e){let{digest:t,nodeCount:n}=a(e),r=e.reduce((e,t)=>t.hittable===!1?e:e+1,0),i=l(e);return{digest:t,nodeCount:n,interactiveNodeCount:r,...i?{foregroundApp:i}:{}}}function l(e){for(let t of e)if(t.bundleId)return t.bundleId;for(let t of e)if(t.appName)return t.appName}export{n,r,c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Mr as e,Pr as t,Vr as n}from"./sdk-batch.js";function r(e,t){return e.find(e=>n(e,t))??null}function i(n,r){let i=e(n);return i&&t(i)?i:a(n,r)}function a(n,r){if(!n.rect)return;let i=n.rect.y+n.rect.height/2,a=null;for(let n of r){if(!n.rect)continue;let r=e(n);if(!r||!t(r))continue;let o=n.rect.y+n.rect.height/2,s=Math.abs(o-i);(!a||s<a.distance)&&(a={label:r,distance:s})}return a?.label}export{r as n,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as e}from"./sdk-contracts.js";import{$r as t,Ar as n,Ir as r,Kr as i,Wr as a}from"./sdk-batch.js";import{n as o,t as s}from"./rect-center.js";const c=[`tabbar`,`toolbar`,`navigationbar`,`bottomnavigation`,`bottomnavigationview`,`sheet`,`dialog`,`alert`,`popover`,`menu`],l=[`tabbar`,`toolbar`,`navigationbar`],u=[`toolbar`],d=[`scrollbar`,`scrollindicator`],f=[`button`,`link`,`menuitem`,`tabitem`,`textfield`,`searchfield`,`edittext`,`checkbox`,`radio`,`switch`,`cell`];function p(e){let t=new Map,n=new Map;for(let r of e){if(t.set(r.index,r),typeof r.parentIndex!=`number`)continue;let e=n.get(r.parentIndex);e?e.push(r):n.set(r.parentIndex,[r])}return{byIndex:t,childrenByParent:n}}function m(e,t={}){if(e.length<2)return e;let n=p(e),r={nodes:e,byIndex:n.byIndex,neighbourhood:n,overlayPositions:e.flatMap((e,r)=>w(e,n,t)?[r]:[]),coverCache:new Map},i=[];for(let[n,a]of e.entries())C(a)&&v(r,n,a,t)&&i.push(n);return g(e,i)}function h(e,t){let n=[];for(let[r,i]of e.entries())C(i)&&t(i)&&n.push(r);return g(e,n)}function g(e,t){if(t.length===0)return e;let n=[...e];for(let r of t){let t=e[r];n[r]={...t,hittable:!1,interactionBlocked:`covered`,presentationHints:z(t.presentationHints)}}return n}function _(e){return e.interactionBlocked!==void 0}function v(t,n,r,i){let a=t.coverCache.get(n);if(a!==void 0)return a;t.coverCache.set(n,null);let o=R(r.rect);if(!o)return b(t,n,null);let s=e(o),c=i.isAdditionalOverlayNode?.(r)===!0;for(let e of t.overlayPositions){if(!y(t,e,n,c,i))continue;let a=t.nodes[e];if(x(t,e,r,o,s,i))return b(t,n,a)}return b(t,n,null)}function y(e,t,n,r,i){let a=e.nodes[t];return a?t>n?!0:t===n||r?!1:i.isAdditionalOverlayNode?.(a)===!0:!1}function b(e,t,n){return e.coverCache.set(t,n),n}function x(e,t,n,r,a,o){if(!e.nodes[t])return!1;let s=S(e,t,n,r,o);return!!(s&&i(s,a.x,a.y))}function S(e,t,n,r,i){let a=e.nodes[t];if(!a||!w(a,e.neighbourhood,i)||I(n,a,e.byIndex))return null;let o=R(a.rect);return!o||s(r,o)||v(e,t,a,i)?null:o}function C(e){return R(e.rect)?e.hittable===!0||N(e)?!0:!!(e.label?.trim()||e.value?.trim()||e.identifier?.trim()):!1}function w(e,t,r){return!R(e.rect)||n(e)||k(e,t.byIndex)||T(e,t)||E(e,t)?!1:P(e,c)||A(e,t.byIndex,r)}function T(e,t){if(!P(e,l)||typeof e.parentIndex!=`number`)return!1;let n=R(e.rect);return n?(t.childrenByParent.get(e.parentIndex)??[]).some(t=>t.index!==e.index&&s(n,t.rect)):!1}function E(e,t){if(!P(e,u)||typeof e.parentIndex!=`number`)return!1;let n=R(e.rect);if(!n)return!1;let r=t.childrenByParent.get(e.parentIndex),i=r.findIndex(t=>t.index===e.index),a=D(r,i),o=!1;for(let[e,t]of r.entries())if(!(e===i||!O(n,t))){if(e<a||e>i)return!1;o=!0}return o}function D(e,t){for(let n=t-1;n>=0;n--)if(P(e[n],u))return n+1;return 0}function O(e,n){let r=P(n,l)||a(n)&&!P(n,d),i=R(n.rect);return!!(r&&i&&t(e,i))}function k(e,t){if(!P(e,l))return!1;let r=R(e.rect);if(!r)return!1;let i=typeof e.parentIndex==`number`?t.get(e.parentIndex):void 0,a=new Set;for(;i&&!a.has(i.index);){if(n(i)){let e=R(i.rect);return!!(e&&s(r,e))}a.add(i.index),i=typeof i.parentIndex==`number`?t.get(i.parentIndex):void 0}return!1}function A(e,t,n){return n.isAdditionalOverlayNode?.(e)===!0&&!j(e,t,n)}function j(e,t,n){let r=typeof e.parentIndex==`number`?t.get(e.parentIndex):void 0,i=new Set;for(;r&&!i.has(r.index);){if(M(r,n))return!0;i.add(r.index),r=typeof r.parentIndex==`number`?t.get(r.parentIndex):void 0}return!1}function M(e,t){return t.isAdditionalOverlayNode?.(e)===!0&&R(e.rect)!==null&&!n(e)}function N(e){return P(e,f)}function P(e,t){let n=F(e);return t.some(e=>n.includes(e))}function F(e){return[e.type,e.role,e.subrole].map(e=>r(e??``)).join(` `)}function I(e,t,n){return L(e,t,n)||L(t,e,n)}function L(e,t,n){let r=typeof t.parentIndex==`number`?n.get(t.parentIndex):void 0,i=new Set;for(;r&&!i.has(r.index);){if(r.index===e.index)return!0;i.add(r.index),r=typeof r.parentIndex==`number`?n.get(r.parentIndex):void 0}return!1}function R(e){let t=o(e);return t&&t.width>0&&t.height>0?t:null}function z(e){return Array.from(new Set([...e??[],`covered`]))}export{h as n,_ as r,m as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./snapshot-quality-backend-capabilities.js";const t={healthy:!0,recovered:!0,sparse:!0},n={"ax-rejected":!0,"sparse-tree":!0,budget:!0,"no-nodes":!0,"capture-failed":!0,"presentation-failed":!0,deferred:!0,"requested-backend":!0};function r(e,t){return typeof t==`string`&&Object.hasOwn(e,t)}function i(i){if(!i||typeof i!=`object`)return;let s=i;if(!r(t,s.state)||!r(e,s.backend))return;let c=a(s.timing);return{state:s.state,backend:s.backend,reason:typeof s.reason==`string`?s.reason:void 0,reasonCode:r(n,s.reasonCode)?s.reasonCode:void 0,customActions:o(s.customActions),effectiveDepth:typeof s.effectiveDepth==`number`?s.effectiveDepth:void 0,collapsedLeafIndexes:Array.isArray(s.collapsedLeafIndexes)?s.collapsedLeafIndexes.filter(e=>typeof e==`number`):void 0,...c?{timing:c}:{}}}function a(e){if(!e||typeof e!=`object`)return;let t=e;if(typeof t.acquisitionMs==`number`&&typeof t.presentationMs==`number`)return{acquisitionMs:t.acquisitionMs,presentationMs:t.presentationMs}}function o(e){if(!e||typeof e!=`object`)return;let t=e;if(typeof t.read==`number`&&typeof t.candidates==`number`)return{read:t.read,candidates:t.candidates,truncated:typeof t.truncated==`number`?t.truncated:0,blocked:t.blocked===!0}}function s(e){return e?.state===`sparse`}function c(e){return e?.backend===`private-ax`?`private-ax`:void 0}export{c as n,i as r,s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as
|
|
1
|
+
import{P as e,s as t}from"./sdk-contracts.js";import{h as n,p as r}from"./sdk-device.js";import{Bt as i}from"./sdk-batch.js";import{c as a}from"./device-shell.js";import{d as o}from"./replay-script-selection.js";import{n as s}from"./provider-device-admission.js";import{n as c}from"./request-runtime-binding.js";import{i as l}from"./internal/daemon.js";import{a as u}from"./runtime-session.js";import{a as d,i as f,n as p,t as m}from"./session-runtime-admission.js";async function h(e,t,n,r){let i=r??e.lookup(t),a=i?e.requireCurrent(i):void 0;return{ref:i,session:a,device:a?.device??await o(n??{})}}async function g(e,t,n,r){if(!e&&!r)throw Error(`Platform resource cleanup was not injected`);try{return await n()}finally{!e&&!s(t)&&await r.cleanupSessionlessExecutionHost(t)}}function _(e){let{sessionName:t,sessionScope:n,device:r,snapshot:i,appBundleId:a}=e;return{name:t,sessionScope:n,device:r,createdAt:Date.now(),appBundleId:a,snapshot:i,...i?.comparisonSafe===!0?{lastComparisonSafeSnapshot:i}:{},actions:[]}}async function v(e,t){if(!n(e)||e.kind!==`simulator`)return;let r=await t.appleSessionObservation.resolveSoleForegroundApp({simulatorSetPath:e.simulatorSetPath});if(!r)return;let i=y(r.device,r.app.bundleId),a=`One booted device found ("${r.device.name}", udid ${r.device.id}) with ${r.app.bundleId} running. Run: ${i}`;return a.length<=350?a:void 0}function y(e,t){let n=e.simulatorSetPath?` --ios-simulator-device-set ${a(e.simulatorSetPath)}`:``;return`agent-device open ${t} --platform ios --udid ${e.id}${n}`}function b(e){let{readTextAtPoint:t}=e.operations,n=t?{operations:{readTextAtPoint:t}}:void 0;return Object.freeze(n?{readTextAtPoint:async e=>await n.operations.readTextAtPoint(e)}:{})}function x(e){let{findText:t}=e.operations;return Object.freeze(t?{findText:async e=>{e.signal?.throwIfAborted();try{let n=await t(e);return e.signal?.throwIfAborted(),n}catch{return e.signal?.throwIfAborted(),{found:!1}}}}:{})}function S(e){let{focusPoint:t,typeText:n}=e.operations;return Object.freeze({...t?{focusPoint:t}:{},...n?{typeText:n}:{}})}async function C(e){let{command:t,device:n,session:r,plan:i}=e,a=await m({device:n,plan:i,inspectFacts:e.inspectFacts});if(!a.admitted)return{ok:!1,response:await j({operation:a.operation,fact:a.fact,session:r,device:n,command:t,platformServices:e.platformServices})};let o=await T(e.bindDevice,a,e.readiness,e.platformServices);return Object.freeze({ok:!0,capture:async e=>await o.captureSnapshot(e),...o.readTextAtPoint?{readTextAtPoint:o.readTextAtPoint}:{},...o.findText?{findText:o.findText}:{},...o.focusPoint?{focusPoint:o.focusPoint}:{},...o.typeText?{typeText:o.typeText}:{}})}async function w(t,n){let{req:a,sessionName:o,sessionStore:s}=t,{ref:c,session:d,device:f}=await h(s,o,a.flags,t.sessionRef);if(a.flags?.snapshotObserveOnly===!0&&(n!==`snapshot`||!r(f)||!d?.appBundleId))throw new e(`UNSUPPORTED_OPERATION`,`observe-only snapshot requires an iOS or iPadOS app session.`);let p=u(a.flags?.snapshotScope,d);if(!p.ok)return{ok:!1,response:p};let m=await C({command:n,device:f,session:d,plan:i({customActions:a.flags?.snapshotCustomActions===!0,hasActiveApp:d?.appBundleId!==void 0}),inspectFacts:t.inspectFacts,platformServices:t.platformServices,bindDevice:t.bindDevice,readiness:!d});if(!m.ok)return m;let g=l({flags:a.flags,logPath:t.logPath,meta:a.meta,session:d,snapshotScope:p.scope});return Object.freeze({ok:!0,ref:c,session:d,device:f,snapshotScope:p.scope,captureSnapshot:async()=>await m.capture(g)})}async function T(e,t,n,r){let i=p(e),a=async(e,t)=>{let a=await i(e,t);return n&&await c(a,r),a},{device:o,plan:s}=d(t);switch(s.kind){case`active-app`:return O(await a(o,s.use));case`selector-active-app`:return await E(a,o,s);case`custom-actions-active-app`:return k(await a(o,s.use));case`without-active-app`:return A(await a(o,s.use));case`selector-without-active-app`:return await D(a,o,s);case`custom-actions-without-active-app`:return k(await a(o,s.use))}}async function E(e,t,n){switch(n.intent){case`capture-only`:return O(await e(t,n.use));case`element-text`:{let r=await e(t,n.use);return{...O(r),...b(r)}}case`wait-observation`:{let r=await e(t,n.use);return{...O(r),...x(r)}}case`find-focus`:{let r=await e(t,n.use);return{...O(r),...S(r)}}case`find-type`:{let r=await e(t,n.use);return{...O(r),...S(r)}}}}async function D(e,t,n){switch(n.intent){case`capture-only`:return A(await e(t,n.use));case`element-text`:{let r=await e(t,n.use);return{...A(r),...b(r)}}case`wait-observation`:{let r=await e(t,n.use);return{...A(r),...x(r)}}case`find-focus`:{let r=await e(t,n.use);return{...A(r),...S(r)}}case`find-type`:{let r=await e(t,n.use);return{...A(r),...S(r)}}}}function O(e){return Object.freeze({captureSnapshot:async t=>await e.operations.captureSnapshot(t)})}function k(e){return Object.freeze({captureSnapshot:async t=>await e.operations.captureSnapshotWithCustomActions(t)})}function A(e){return Object.freeze({captureSnapshot:async t=>await e.operations.captureSnapshotWithoutActiveApp(t)})}async function j(e){if(e.operation===`captureSnapshot`||e.operation===`focusPoint`||e.operation===`typeText`)return f(e.command,e.fact);if(e.operation===`captureSnapshotWithCustomActions`)return M(e);let n=await v(e.device,e.platformServices);return t(`SESSION_NOT_FOUND`,`iOS ${e.command} requires an active app session on the target device. Run open first (for example: open --session ${e.session?.name??`sim`} --platform ios --device "<name>" <app>).`,{reason:`ios_app_session_required`,...n?{hint:n}:{}})}function M(e){let n=e.command===`diff`?`--actions requires an iOS simulator: custom actions are read through the private accessibility snapshot backend, which ${e.device.platform}/${e.device.kind} targets do not have.`:`--actions requires an iOS simulator: custom actions are unavailable on this ${e.device.platform}/${e.device.kind} target.`;return t(`UNSUPPORTED_OPERATION`,n,{reason:e.fact.available?void 0:e.fact.reason},{hint:e.command===`diff`||e.fact.available||!e.fact.hint?`Re-run without --actions, or target an iOS simulator.`:e.fact.hint})}export{g as a,h as i,w as n,_ as r,C as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{P as e,Y as t,_ as n,k as r}from"./sdk-contracts.js";import{V as i}from"./tv-remote.js";import{i as a}from"./snapshot-capture-annotations.js";import{i as o}from"./snapshot-diagnostics.js";import{l as s}from"./android-input-ownership.js";import{r as c}from"./diagnostics.js";import"./diagnostics2.js";import{E as l}from"./sdk-device.js";import{n as u}from"./android-snapshot-quality.js";import{i as d}from"./android-system-chrome.js";import{r as f}from"./request-cancel.js";import"./request.js";import{$ as p,Dt as m,H as h,I as g}from"./internal/daemon.js";import{t as _}from"./quality-warnings.js";import{t as v}from"./snapshot-quality-verdict.js";import{d as y,r as b,t as x}from"./runtime-session.js";import{i as S,r as C}from"./capture-disclosure.js";import{a as w,i as T,n as E,t as D}from"./screenshot-runtime.js";import{a as O,n as k,r as A}from"./snapshot-runtime-binding.js";import{promises as j}from"node:fs";import M from"node:os";import N from"node:path";function P(e){return{captureFailed:!0,error:e}}function F(e){return{path:e,overlayRefsRequested:!0,overlayRefsAnnotated:!1,overlayRefSource:`unavailable`}}function I(e,t){let n={path:e,overlayRefsRequested:!0,overlayRefSource:`session-snapshot`};return L(t)?{...n,overlayRefsAnnotated:!0,overlayRefs:t}:{...n,overlayRefsAnnotated:!1,overlayRefs:[]}}function L(e){return e.length>0}function R(e,t){return{path:e,overlayRefsRequested:!0,overlayRefsAnnotated:!1,overlayRefSource:`session-snapshot`,overlayAnnotationError:t}}function z(e){return`captureFailed`in e?{overlayRefCount:void 0,overlayRefsAnnotated:void 0}:{overlayRefCount:`overlayRefs`in e?e.overlayRefs.length:0,overlayRefsAnnotated:e.overlayRefsAnnotated}}function ee(e){return u(e)===`accessibility-timeout`}async function B(e){if(e.command!==`snapshot`||e.device.platform!==`android`)return;let n=t(e.error);if(ee(n))return{ok:!1,error:{...n,details:{...n.details??{},androidSnapshotTimeoutScreenshot:await V(e)}}}}async function V(n){try{let t=await T({device:n.device,overlayRefs:!1,inspectFacts:n.inspectFacts,platformServices:n.platformServices,bindDevice:n.bindDevice});if(!t.ok)throw new e(`UNSUPPORTED_OPERATION`,`The target does not support screenshot capture, so no timeout evidence was taken.`);let r=await j.mkdtemp(N.join(M.tmpdir(),`agent-device-android-snapshot-timeout-`)),i=N.join(r,`snapshot-timeout-overlay-refs.png`);await t.runtime.captureScreenshot({outPath:i,options:{appBundleId:n.session?.appBundleId,stabilize:!1,surface:n.session?.surface},execution:E(h(n.logPath,{screenshotNoStabilize:!0},n.session?.appBundleId,n.session?.trace?.outPath))}),await j.access(i);let a=await H(i,n.session);return c({level:`warn`,phase:`android_snapshot_timeout_screenshot_captured`,data:{path:i,...z(a)}}),a}catch(e){let n=t(e);return c({level:`warn`,phase:`android_snapshot_timeout_screenshot_failed`,data:{error:n.message}}),P(n.message)}}async function H(e,n){if(!n?.snapshot)return F(e);try{return I(e,await w({screenshotPath:e,snapshot:n.snapshot}))}catch(n){let r=t(n);return c({level:`warn`,phase:`android_snapshot_timeout_screenshot_overlay_failed`,data:{path:e,error:r.message}}),R(e,r.message)}}function U(e){let{verdict:t,appBundleId:n,latch:r}=e;return!t||t.backend===`android-helper`?{latch:r}:t.state===`healthy`?{latch:void 0}:t.state!==`recovered`||t.reasonCode===`requested-backend`?{latch:r}:t.reasonCode===`deferred`?r!==void 0&&r.appBundleId===n?{latch:r}:{warning:_(t.backend),latch:{appBundleId:n}}:{latch:{appBundleId:n}}}function W(e){let{session:t,data:n,verdict:r,internalObservation:a}=e;if(a||!t)return n;let o=U({verdict:r,appBundleId:t.appBundleId,latch:t.recoveredSnapshotWarningLatch});return t.recoveredSnapshotWarningLatch=o.latch,o.warning?{...n,warnings:[o.warning,...i(n)]}:n}async function G(e){let t=await k(e,e.command);if(!t.ok)return t.response;let{ref:n,session:r,device:i,snapshotScope:a}=t;return await O(r,i,async()=>{let{req:o,logPath:c,sessionStore:l}=e,u=n?.address??e.sessionName,d={},{runtime:f,sessions:p}=await K({createCommandSurface:e.createCommandSurface,req:o,sessionName:u,logPath:c,sessionStore:l,ref:n,session:r,device:i,snapshotScope:a,capturedQuality:d,captureSnapshotData:t.captureSnapshot}),m=()=>{let e=p.getRef();return e?l.requireCurrent(e):void 0},h;try{h=await e.execute({runtime:f,sessionName:u,req:o,snapshotScope:a,getSession:m})}catch(t){let n=await B({error:t,command:e.command,logPath:c,session:r,device:i,inspectFacts:e.inspectFacts,platformServices:e.platformServices,bindDevice:e.bindDevice});if(!n)throw t;return n}let g=m();Q({req:o,sessionName:u,sessionStore:l,ref:p.getRef(),result:h.record});let _=W({session:g,data:h.data,verdict:d.value,internalObservation:o.internal?.observationOnly===!0});return{ok:!0,data:s(h.data,_)}},e.platformResourceCleanup)}async function K(e){let{req:t,sessionName:n,logPath:r,sessionStore:i,session:a,device:o,snapshotScope:s}=e,c=x({sessionName:n,sessionStore:i,ref:e.ref,recordOptions:{includeSnapshot:!0},setRecord:(e,r,a)=>{let s=$(e),c=J(r,s,q(t)),l=c?r.snapshot:s.snapshot,u=a?i.update(a,{}):A({sessionName:n,sessionScope:g(t),device:o,snapshot:l,appBundleId:e.appBundleId});return u.appName=e.appName??r?.appName,y(u,{snapshot:l,scopeSource:X({current:r,keepCurrentSnapshot:c,refScopedSnapshot:q(t)}),keptCurrentSnapshot:c,previousGeneration:r?.snapshotGeneration}),Y(u,c,t.command===`snapshot`&&t.internal?.observationOnly!==!0),a??i.publish(n,u)}});return{runtime:await e.createCommandSurface({backend:Z({req:t,logPath:r,session:a,device:o,snapshotScope:s,capturedQuality:e.capturedQuality,captureSnapshotData:e.captureSnapshotData}),...S(`snapshot`),signal:f(t.meta?.requestId),sessions:c}),sessions:c}}function q(e){return e.flags?.snapshotScope?.trim().startsWith(`@`)===!0}function J(e,t,n){return n&&t.snapshot?.nodes.length===0&&e?.snapshot!==void 0}function Y(e,t,n){!t&&n&&p(e)}function X(e){let{current:t,keepCurrentSnapshot:n,refScopedSnapshot:r}=e;if(r)return n?t?.snapshotScopeSource:t?.snapshotScopeSource??t?.snapshot}function Z(e){let{req:t,logPath:n,session:r,device:i,snapshotScope:s}=e;return{platform:l(i),captureSnapshot:async c=>{let l=await b({device:i,session:r,flags:t.flags,logPath:n,snapshotScope:s,signal:c.signal,captureData:e.captureSnapshotData}),u=a(l);e.capturedQuality.value=u.quality;let d=o(r);return{snapshot:l.snapshot,...u,...d?{snapshotDiagnostics:d}:{},appName:r?.appBundleId?r.appName??r.appBundleId:void 0,appBundleId:r?.appBundleId}}}}function Q(e){e.ref&&e.sessionStore.recordAction(e.ref,{command:e.req.command,positionals:e.req.positionals??[],flags:e.req.flags??{},result:te(e.result),interactiveObservation:m(e.req)})}function $(t){if(!t.snapshot)throw new e(`UNKNOWN`,`snapshot runtime did not produce session state`);return t}function te(e){return e.kind===`snapshot`?{nodes:e.nodes,truncated:e.truncated}:{mode:e.mode,baselineInitialized:e.baselineInitialized,summary:e.summary}}async function ne(e){let t=e.session;if(!t||!v(e.verdict)||e.req.internal?.observationOnly===!0)return;let n=await re({...e,session:t});if(n===void 0)return;let{path:r,displayRotation:i}=n;return{path:r,artifact:{field:`fallbackScreenshotPath`,artifactType:`screenshot`,path:r,fileName:`snapshot-fallback.png`,...i?{displayRotation:i}:{}}}}async function re(e){let{req:t,session:n}=e;try{let r=await T({device:n.device,overlayRefs:!1,inspectFacts:e.inspectFacts,platformServices:e.platformServices,bindDevice:e.bindDevice});return r.ok?await D({createCommandSurface:e.createCommandSurface,session:n,sessionName:e.sessionName,captureScreenshot:r.runtime.captureScreenshot,dispatchContext:h(e.logPath,t.flags,n.appBundleId,n.trace?.outPath,t.meta?.requestId,t.meta)}):void 0}catch{return}}async function ie(e){let t={},i=await G({...e,command:`snapshot`,execute:async({runtime:i,sessionName:a,req:o,snapshotScope:c,getSession:l})=>{let u=await i.capture.snapshot({session:a,...r(o.flags,n),scope:c});u.targetActivation&&(t.targetActivation??=u.targetActivation);let f=ae(o,l()),p=d(u.nodes),m=s(u,p===u.nodes?u:{...u,nodes:p}),h=l(),g=await ne({createCommandSurface:e.createCommandSurface,req:o,session:h,sessionName:a,logPath:e.logPath,verdict:u.snapshotQuality,inspectFacts:e.inspectFacts,platformServices:e.platformServices,bindDevice:e.bindDevice}),_=s(m,g?{...m,fallbackScreenshotPath:g.path,artifacts:[g.artifact]}:m);return{data:f===void 0?_:s(_,{..._,refsGeneration:f}),record:{kind:`snapshot`,nodes:u.nodes.length,truncated:u.truncated}}}});return C(i,t)}function ae(e,t){return e.internal?.observationOnly===!0?void 0:t?.snapshotGeneration}export{G as n,ie as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime.js";import{A as t,j as n,v as r,y as i}from"./sdk-contracts.js";import"./
|
|
1
|
+
import{r as e}from"./rolldown-runtime.js";import{A as t,j as n,v as r,y as i}from"./sdk-contracts.js";import"./tv-remote.js";import{i as a}from"./snapshot-capture-annotations.js";import{d as o,n as s}from"./android-input-ownership.js";import{Gr as c,Ir as l,Jr as u,Mr as d,Pr as f}from"./sdk-batch.js";import{n as p,t as m}from"./snapshot-occlusion.js";import{t as h}from"./snapshot-desktop-projection.js";import{a as g}from"./ios-snapshot-planning.js";function _(e,t,n){if(n?.(e.length+t.length)===!1)return;let r=v(t);if(r.length===0)return 0;let i=1/0,a=-1/0;for(let e of r)i=Math.min(i,e.x),a=Math.max(a,e.endX);let o=v(e).filter(e=>e.x<a&&e.endX>i);if(o.length===0)return 0;let s=[...r.flatMap(e=>[e.x,e.endX]),...o.flatMap(e=>[Math.max(e.x,i),Math.min(e.endX,a)])];if(n?.(r.length+o.length+s.length)===!1)return;r.sort(y),o.sort(y);let c=[...new Set(s)].sort((e,t)=>e-t),l=[],u=[],d=0,f=0,p=0,m=0;for(let e=0;e<c.length-1;e+=1){let t=c[e],i=c[e+1];for(l=l.filter(e=>e.endX>t),u=u.filter(e=>e.endX>t);d<r.length&&r[d].x<=t;)l.push(r[d]),d+=1;for(;f<o.length&&o[f].x<=t;)u.push(o[f]),f+=1;if(n?.(1+l.length+u.length)===!1)return;let a=b(l),s=b(u),h=i-t;p+=h*x(a),m+=h*S(a,s)}return p<=0?0:m/p}function v(e){return e.filter(u).map(e=>({...e,endX:e.x+e.width}))}function y(e,t){return e.x-t.x||e.endX-t.endX}function b(e){let t=e.map(e=>({start:e.y,end:e.y+e.height})).sort((e,t)=>e.start-t.start||e.end-t.end),n=[];for(let e of t){let t=n.at(-1);!t||e.start>t.end?n.push({...e}):t.end=Math.max(t.end,e.end)}return n}function x(e){return e.reduce((e,t)=>e+t.end-t.start,0)}function S(e,t){let n=0,r=0,i=0;for(;r<e.length&&i<t.length;){let a=e[r],o=t[i];n+=Math.max(0,Math.min(a.end,o.end)-Math.max(a.start,o.start)),a.end<=o.end?r+=1:i+=1}return n}function C(e,t=new Map){if(t.size===0)return new Set;let n=D(e),r=O(e,n),i={remaining:Math.max(1024,e.length*128),exhausted:!1},a=w(n,{footprints:r,siblingOrders:t,budget:i});return i.exhausted?new Set:L(a,n)}function w(e,t){let n=new Set;for(let r of e.values())for(let e of r)if(T(e,r,t)&&n.add(e.index),t.budget.exhausted)return n;return n}function T(e,t,n){let r=n.siblingOrders.get(e.index),i=n.footprints.get(e.index);if(!r||!i)return!1;for(let e of t){if(!F(n.budget))return!1;if(E(r,i,e,n))return!0}return!1}function E(e,t,n,r){let i=r.siblingOrders.get(n.index),a=r.footprints.get(n.index);if(!i||!a?.hasAction||i.group!==e.group||i.order<=e.order)return!1;let o=P(a,`paint`,r.budget),s=P(t,`show`,r.budget);if(r.budget.exhausted)return!1;let c=_(o,s,e=>I(r.budget,e));return c!==void 0&&c>=.9}function D(e){let t=new Map;for(let n of e){if(typeof n.parentIndex!=`number`)continue;let e=t.get(n.parentIndex)??[];e.push(n),t.set(n.parentIndex,e)}return t}function O(e,t){let n=new Map;for(let r=e.length-1;r>=0;--r){let i=e[r],a=t.get(i.index)??[],o=a.flatMap(e=>n.get(e.index)??[]);n.set(i.index,k(i,a.length,o))}return n}function k(e,t,n){let r=j(e,t),i=r??M(e);return{...i?{showRect:i}:{},showChildren:r?[]:n,...r?{paintRect:r}:{},paintChildren:r?[]:n,hasAction:e.hittable===!0||n.some(A)}}function A(e){return e.hasAction}function j(e,t){if(u(e.rect))return e.hittable===!0||c(e.type)||t===0&&N(e)?e.rect:void 0}function M(e){return u(e.rect)&&N(e)?e.rect:void 0}function N(e){return!!(e.label?.trim()||e.value?.trim()||e.identifier?.trim())}function P(e,t,n){let r=[],i=[e];for(;i.length>0;){if(!F(n))return r;let e=i.pop(),a=t===`paint`?e.paintRect:e.showRect;a&&r.push(a),i.push(...t===`paint`?e.paintChildren:e.showChildren)}return r}function F(e){return I(e,1)}function I(e,t){return t>e.remaining?(e.exhausted=!0,!1):(e.remaining-=t,!0)}function L(e,t){let n=new Set,r=[...e];for(;r.length>0;){let e=r.pop();if(!n.has(e)){n.add(e);for(let n of t.get(e)??[])r.push(n.index)}}return n}function R(e){let t=new Map;for(let[n,r]of e.entries())t.set(r.index,n);let n=[],r=[];for(let[i,a]of e.entries()){let e=Math.max(0,a.depth??0);for(;r.length>0&&e<=r.at(-1).depth;)r.pop();let o=i,s=typeof a.parentIndex==`number`?t.get(a.parentIndex):void 0,c=typeof s==`number`&&s<o?s:r.at(-1)?.index;n.push({...a,index:o,depth:e,parentIndex:c}),r.push({depth:e,index:o})}return n}function z(e){let t=[],n=[];for(let r of e){let e=r.depth??0;for(;t.length>0&&e<=t.at(-1);)t.pop();let i=l(r.type??``),a=f(d(r));if((i===`group`||i===`ioscontentgroup`)&&!a){t.push(e);continue}let o=Math.max(0,e-t.length);n.push({...r,depth:o})}return n}var B=e({buildSnapshotState:()=>V});function V(e,o){let s=e?.nodes??[],c=o?.snapshotRaw,l=H(e,s,c===!0),u=R(c?l:z(l)),d=o?.snapshotScope&&G(e?.backend)?h(u,o.snapshotScope):u,f=a(e).quality;return{nodes:r(c?d:m(d,U(e?.backend))),truncated:e?.truncated,createdAt:Date.now(),...n(e),...f?{snapshotQuality:f}:{},...e.comparisonIdentity?{comparisonKey:g(e.comparisonIdentity)}:{},...e.systemSurface?{iosSystemSurfaceBundleId:e.systemSurface.bundleId}:{},...e.targetActivation?{targetActivation:e.targetActivation}:{},...e.keyboard?{keyboard:e.keyboard}:{},...e.viewport?{viewport:e.viewport}:{},presentationKey:i(t(o)),comparisonSafe:K(e?.backend,o)}}function H(e,t,n){return e.backend===`android`&&!n?W(e,t):t}function U(e){return e===`android`?{isAdditionalOverlayNode:s}:{}}function W(e,t){let n=o(e),r=C(n?.nodes??t,n?.androidSiblingOrderByNodeIndex);return p(t,e=>{let t=n?.sourceIndexByNodeIndex.get(e.index)??e.index;return r.has(t)})}function G(e){return e===void 0||e===`linux-atspi`||e===`harmonyos-arkui`||e===`web`}function K(e,t){return e===`android`&&t?.snapshotInteractiveOnly!==!0&&typeof t?.snapshotDepth!=`number`&&!t?.snapshotScope}export{B as n,V as t};
|
package/dist/src/snapshot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{P as e}from"./sdk-contracts.js";import{o as t}from"./version.js";import{m as n,x as r,y as i}from"./host-file.js";import{runHarmonyHdc as a,runHarmonyShell as o}from"./hdc.js";import{randomUUID as s}from"node:crypto";import c from"node:path";const l=t({ttlMs:2e3,scheduleExpiry:!0});async function u(e,t={}){let l=`/data/local/tmp/agent-device-layout-${s()}.json`,u=await n(`agent-device-harmony-layout-`),d=c.join(u,`layout.json`);try{return await o(e,[`uitest`,`dumpLayout`,`-p`,l],{timeoutMs:3e4}),await a(e,[`file`,`recv`,l,d],{timeoutMs:15e3}),m(p(await i(d)),t)}finally{await o(e,[`rm`,`-f`,l],{allowFailure:!0}).catch(()=>{}),await r(u)}}async function d(t){let n=t.id,r=l.get(n);if(r)return r;let i=(await u(t)).nodes.find(e=>e.type===`Application`&&e.rect)?.rect;if(!i||i.width<=0||i.height<=0)throw new e(`COMMAND_FAILED`,`HarmonyOS snapshot did not expose an application viewport`);return l.set(n,i),i}function f(e){l.delete(e.id)}function p(t){try{let e=JSON.parse(t);if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`layout root is not an object`);return e}catch(t){throw new e(`COMMAND_FAILED`,`HarmonyOS uitest returned an invalid layout JSON document`,{cause:t instanceof Error?t.message:String(t)})}}function m(e,t){let{nodes:n,truncated:r,analysis:i}=h(e,{maxNodes:5e3,maxDepth:t.depth??1/0,interactiveOnly:t.interactiveOnly===!0});return{nodes:n,...r?{truncated:!0}:{},analysis:i}}function h(e,t){let n=[],r=0,i=0,a=!1,o=(e,s,c)=>{r+=1,i=Math.max(i,s);let l=c;if(n.length>=t.maxNodes)a=!0;else{let r=g(e.attributes??{},n.length,s,c);l=!t.interactiveOnly||r.hittable===!0?n.push(r)-1:c}if(s<t.maxDepth)for(let t of e.children??[])o(t,s+1,l)};return o(e,0),{nodes:n,truncated:a,analysis:{rawNodeCount:r,maxDepth:i}}}function g(e,t,n,r){let i=_(e,`text`)??_(e,`originalText`),a=_(e,`description`),o=_(e,`id`)??_(e,`key`),s=v(_(e,`bounds`));return{index:t,type:_(e,`type`)===`root`?`Application`:_(e,`type`),...a?{label:a}:{},...i?{value:i}:{},...o?{identifier:o}:{},...s?{rect:s}:{},enabled:_(e,`enabled`)!==`false`,focused:_(e,`focused`)===`true`,visibleToUser:_(e,`visible`)!==`false`,hittable:_(e,`clickable`)===`true`,depth:n,...r===void 0?{}:{parentIndex:r}}}function _(e,t){let n=e[t];return typeof n==`string`?n:void 0}function v(e){if(!e)return;let t=/^\[(-?\d+),(-?\d+)\]\[(-?\d+),(-?\d+)\]$/.exec(e);if(!t)return;let[,n,r,i,a]=t,o=Number(n),s=Number(r),c=Number(i)-o,l=Number(a)-s;return c>=0&&l>=0?{x:o,y:s,width:c,height:l}:void 0}export{f as invalidateHarmonyGestureViewport,d as readHarmonyGestureViewport,u as snapshotHarmony};
|
package/dist/src/snapshot2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as e}from"./sdk-contracts.js";import{t}from"./
|
|
1
|
+
import{P as e}from"./sdk-contracts.js";import{r as t}from"./diagnostics.js";import"./diagnostics2.js";import{_ as n}from"./file.js";import"./process.js";import{c as r}from"./host-file.js";import{n as i,t as a}from"./tool-provider2.js";import o from"node:path";import{fileURLToPath as s}from"node:url";const c={"push button":`Button`,"toggle button":`Button`,"push button menu":`Button`,label:`StaticText`,static:`StaticText`,caption:`StaticText`,text:`TextField`,entry:`TextField`,"password text":`TextField`,"spin button":`TextField`,terminal:`TextArea`,"document text":`TextArea`,paragraph:`TextArea`,frame:`Window`,window:`Window`,dialog:`Dialog`,alert:`Alert`,"file chooser":`Dialog`,"color chooser":`Dialog`,"font chooser":`Dialog`,panel:`Group`,filler:`Group`,section:`Group`,form:`Group`,grouping:`Group`,"layered pane":`Group`,"glass pane":`Group`,"root pane":`Group`,"option pane":`Group`,"internal frame":`Group`,"desktop frame":`Group`,"block quote":`Group`,article:`Group`,comment:`Group`,landmark:`Group`,log:`Group`,marquee:`Group`,math:`Group`,notification:`Group`,"content deletion":`Group`,"content insertion":`Group`,mark:`Group`,suggestion:`Group`,"scroll pane":`ScrollArea`,"scroll bar":`ScrollBar`,"menu bar":`MenuBar`,menu:`Menu`,"popup menu":`Menu`,"menu item":`MenuItem`,"check menu item":`MenuItem`,"radio menu item":`MenuItem`,"tearoff menu item":`MenuItem`,"check box":`CheckBox`,"radio button":`RadioButton`,switch:`Switch`,"combo box":`ComboBox`,"page tab":`Tab`,"page tab list":`TabList`,table:`Table`,"tree table":`Table`,"table cell":`Cell`,"table row":`Row`,"table column header":`Cell`,"table row header":`Cell`,"column header":`Cell`,"row header":`Cell`,list:`List`,"list item":`ListItem`,"list box":`List`,tree:`Tree`,"tree item":`TreeItem`,"description list":`List`,"description term":`ListItem`,"description value":`ListItem`,"tool bar":`Toolbar`,"status bar":`StatusBar`,"info bar":`StatusBar`,slider:`Slider`,"progress bar":`ProgressBar`,"level bar":`ProgressBar`,image:`Image`,icon:`Image`,animation:`Image`,canvas:`Image`,"drawing area":`Image`,video:`Video`,audio:`Audio`,link:`Link`,hyperlink:`Link`,separator:`Separator`,application:`Application`,"tool tip":`Tooltip`,timer:`Timer`,heading:`Heading`,footnote:`Footnote`,"title bar":`TitleBar`,"date editor":`DateEditor`,rating:`Slider`};function l(e){let t=e.toLowerCase().trim();return c[t]||t.split(/[\s_-]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}const u=`atspi-dump.py`;let d=null;function f(){if(d)return d;let t=o.dirname(s(import.meta.url));for(let e=0;e<6;e++){let e=o.join(t,`linux`,u);if(r(e))return d=e,e;t=o.dirname(t)}throw new e(`TOOL_MISSING`,`Cannot find ${u}. Ensure the agent-device package is installed correctly.`)}async function p(t,r={}){let o=a().accessibility;if(o)return await o.captureTree(t,r);if(n()!==`linux`)throw new e(`UNSUPPORTED_PLATFORM`,`AT-SPI2 bridge is only available on Linux`);if(!await a().whichCommand(`python3`))throw new e(`TOOL_MISSING`,`python3 is required for AT-SPI2 accessibility snapshots on Linux.`);let s=r.maxNodes??1500,c=r.maxDepth??12,u=r.maxApps??24,d=[f(),`--surface`,t,`--max-nodes`,String(s),`--max-depth`,String(c),`--max-apps`,String(u)],p=await i(`python3`,d,{allowFailure:!0,timeoutMs:3e4,signal:r.signal});if(p.exitCode!==0){let t=p.stderr.trim();throw t.includes(`No module named`)||t.includes(`gi.require_version`)?new e(`TOOL_MISSING`,`AT-SPI2 Python bindings not found. Install python3-gi and gir1.2-atspi-2.0.`,{cause:t}):new e(`COMMAND_FAILED`,`AT-SPI2 snapshot failed (exit ${p.exitCode}): ${t||p.stdout}`)}let m;try{m=JSON.parse(p.stdout)}catch{throw new e(`COMMAND_FAILED`,`AT-SPI2 snapshot returned invalid JSON: ${p.stdout.slice(0,200)}`)}if(m.error)throw new e(`COMMAND_FAILED`,`AT-SPI2: ${m.error}`);return{nodes:(m.nodes??[]).map(e=>({index:e.index,type:l(e.role),role:e.role,label:e.label??void 0,value:e.value??void 0,rect:e.rect??void 0,enabled:e.enabled??void 0,selected:e.selected??void 0,hittable:e.hittable??void 0,depth:e.depth,parentIndex:e.parentIndex??void 0,pid:e.pid??void 0,appName:e.appName??void 0,windowTitle:e.windowTitle??void 0})),truncated:m.truncated,surface:t}}function m(e){return e===`desktop`?`desktop`:e===`frontmost-app`||e===`app`?`frontmost-app`:(e===`menubar`&&t({level:`warn`,phase:`linux_snapshot`,data:{message:`menubar surface is not supported on Linux, falling back to desktop`}}),`desktop`)}async function h(e,t){let n=await p(m(e),{signal:t});return{nodes:n.nodes,truncated:n.truncated}}async function g(e,t,n){let{nodes:r}=await h(n),i=r.filter(n=>{let r=n.rect;return r?e>=r.x&&t>=r.y&&e<=r.x+r.width&&t<=r.y+r.height:!1}).sort((e,t)=>{let n=e.depth??0,r=t.depth??0;return n===r?_(e.rect)-_(t.rect):r-n});for(let e of i){let t=v(e);if(t.trim())return t}return``}function _(e){return(e?.width??0)*(e?.height??0)}function v(e){for(let t of[e.value,e.label,e.identifier])if(typeof t==`string`&&t.length>0)return t;return``}export{g as readLinuxTextAtPoint,h as snapshotLinux};
|
package/dist/src/snapshot3.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as e}from"./sdk-contracts.js";import{r as t}from"./diagnostics.js";import"./diagnostics2.js";import{f as n}from"./owner-identity.js";import"./process.js";import{c as r}from"./host-file.js";import{n as i,t as a}from"./tool-provider2.js";import o from"node:path";import{fileURLToPath as s}from"node:url";const c={"push button":`Button`,"toggle button":`Button`,"push button menu":`Button`,label:`StaticText`,static:`StaticText`,caption:`StaticText`,text:`TextField`,entry:`TextField`,"password text":`TextField`,"spin button":`TextField`,terminal:`TextArea`,"document text":`TextArea`,paragraph:`TextArea`,frame:`Window`,window:`Window`,dialog:`Dialog`,alert:`Alert`,"file chooser":`Dialog`,"color chooser":`Dialog`,"font chooser":`Dialog`,panel:`Group`,filler:`Group`,section:`Group`,form:`Group`,grouping:`Group`,"layered pane":`Group`,"glass pane":`Group`,"root pane":`Group`,"option pane":`Group`,"internal frame":`Group`,"desktop frame":`Group`,"block quote":`Group`,article:`Group`,comment:`Group`,landmark:`Group`,log:`Group`,marquee:`Group`,math:`Group`,notification:`Group`,"content deletion":`Group`,"content insertion":`Group`,mark:`Group`,suggestion:`Group`,"scroll pane":`ScrollArea`,"scroll bar":`ScrollBar`,"menu bar":`MenuBar`,menu:`Menu`,"popup menu":`Menu`,"menu item":`MenuItem`,"check menu item":`MenuItem`,"radio menu item":`MenuItem`,"tearoff menu item":`MenuItem`,"check box":`CheckBox`,"radio button":`RadioButton`,switch:`Switch`,"combo box":`ComboBox`,"page tab":`Tab`,"page tab list":`TabList`,table:`Table`,"tree table":`Table`,"table cell":`Cell`,"table row":`Row`,"table column header":`Cell`,"table row header":`Cell`,"column header":`Cell`,"row header":`Cell`,list:`List`,"list item":`ListItem`,"list box":`List`,tree:`Tree`,"tree item":`TreeItem`,"description list":`List`,"description term":`ListItem`,"description value":`ListItem`,"tool bar":`Toolbar`,"status bar":`StatusBar`,"info bar":`StatusBar`,slider:`Slider`,"progress bar":`ProgressBar`,"level bar":`ProgressBar`,image:`Image`,icon:`Image`,animation:`Image`,canvas:`Image`,"drawing area":`Image`,video:`Video`,audio:`Audio`,link:`Link`,hyperlink:`Link`,separator:`Separator`,application:`Application`,"tool tip":`Tooltip`,timer:`Timer`,heading:`Heading`,footnote:`Footnote`,"title bar":`TitleBar`,"date editor":`DateEditor`,rating:`Slider`};function l(e){let t=e.toLowerCase().trim();return c[t]||t.split(/[\s_-]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}const u=`atspi-dump.py`;let d=null;function f(){if(d)return d;let t=o.dirname(s(import.meta.url));for(let e=0;e<6;e++){let e=o.join(t,`linux`,u);if(r(e))return d=e,e;t=o.dirname(t)}throw new e(`TOOL_MISSING`,`Cannot find ${u}. Ensure the agent-device package is installed correctly.`)}async function p(t,r={}){let o=a().accessibility;if(o)return await o.captureTree(t,r);if(n()!==`linux`)throw new e(`UNSUPPORTED_PLATFORM`,`AT-SPI2 bridge is only available on Linux`);if(!await a().whichCommand(`python3`))throw new e(`TOOL_MISSING`,`python3 is required for AT-SPI2 accessibility snapshots on Linux.`);let s=r.maxNodes??1500,c=r.maxDepth??12,u=r.maxApps??24,d=[f(),`--surface`,t,`--max-nodes`,String(s),`--max-depth`,String(c),`--max-apps`,String(u)],p=await i(`python3`,d,{allowFailure:!0,timeoutMs:3e4,signal:r.signal});if(p.exitCode!==0){let t=p.stderr.trim();throw t.includes(`No module named`)||t.includes(`gi.require_version`)?new e(`TOOL_MISSING`,`AT-SPI2 Python bindings not found. Install python3-gi and gir1.2-atspi-2.0.`,{cause:t}):new e(`COMMAND_FAILED`,`AT-SPI2 snapshot failed (exit ${p.exitCode}): ${t||p.stdout}`)}let m;try{m=JSON.parse(p.stdout)}catch{throw new e(`COMMAND_FAILED`,`AT-SPI2 snapshot returned invalid JSON: ${p.stdout.slice(0,200)}`)}if(m.error)throw new e(`COMMAND_FAILED`,`AT-SPI2: ${m.error}`);return{nodes:(m.nodes??[]).map(e=>({index:e.index,type:l(e.role),role:e.role,label:e.label??void 0,value:e.value??void 0,rect:e.rect??void 0,enabled:e.enabled??void 0,selected:e.selected??void 0,hittable:e.hittable??void 0,depth:e.depth,parentIndex:e.parentIndex??void 0,pid:e.pid??void 0,appName:e.appName??void 0,windowTitle:e.windowTitle??void 0})),truncated:m.truncated,surface:t}}function m(e){return e===`desktop`?`desktop`:e===`frontmost-app`||e===`app`?`frontmost-app`:(e===`menubar`&&t({level:`warn`,phase:`linux_snapshot`,data:{message:`menubar surface is not supported on Linux, falling back to desktop`}}),`desktop`)}async function h(e,t){let n=await p(m(e),{signal:t});return{nodes:n.nodes,truncated:n.truncated}}async function g(e,t,n){let{nodes:r}=await h(n),i=r.filter(n=>{let r=n.rect;return r?e>=r.x&&t>=r.y&&e<=r.x+r.width&&t<=r.y+r.height:!1}).sort((e,t)=>{let n=e.depth??0,r=t.depth??0;return n===r?_(e.rect)-_(t.rect):r-n});for(let e of i){let t=v(e);if(t.trim())return t}return``}function _(e){return(e?.width??0)*(e?.height??0)}function v(e){for(let t of[e.value,e.label,e.identifier])if(typeof t==`string`&&t.length>0)return t;return``}export{g as readLinuxTextAtPoint,h as snapshotLinux};
|
|
1
|
+
import{P as e,et as t,s as n}from"./sdk-contracts.js";import{H as r,U as i}from"./tv-remote.js";import{c as a}from"./back-mode.js";import{r as o}from"./diagnostics.js";import"./diagnostics2.js";import{A as s,f as c,g as l,m as u}from"./sdk-device.js";import{Ht as d,Ir as f,Ut as p,et as m,nt as h,on as g,pr as _,rt as v,sn as y,tt as b,zt as ee}from"./sdk-batch.js";import"./alert-contract.js";import{C as x,E as S,T as te,_ as ne,g as re,h as ie,l as ae,m as oe,p as C,r as w}from"./settings.js";import{t as T}from"./location-coordinates.js";import{t as se}from"./absence-observation-errors.js";import{H as E,Ot as D,a as O,bt as ce,i as le,s as k,tt as A}from"./internal/daemon.js";import{t as j}from"./wait.js";import{r as M,u as N}from"./runtime-session.js";import{n as P,t as F}from"./capture-disclosure.js";import{n as I,t as L}from"./snapshot-runtime.js";import{a as R,i as z}from"./snapshot-runtime-binding.js";import{a as B,c as V,f as H,g as U,h as W,m as ue,o as de,p as fe,s as pe,t as me}from"./selector-runtime.js";async function he(e){let{device:t,action:n,inspectFacts:r,bindDevice:i,platformServices:a}=e,o={command:`alert`,device:t,inspectFacts:r,bindDevice:i,platformServices:a,readiness:!e.session};if(n===`wait`){let e=await k({...o,use:v});if(e.type===`response`)return{ok:!1,response:e.response};let t=e.runtime;return{ok:!0,execute:e=>_e(t,e)}}if(n===`accept`){let e=await k({...o,use:m});if(e.type===`response`)return{ok:!1,response:e.response};let t=e.runtime;return{ok:!0,execute:e=>ve(t,e)}}if(n===`dismiss`){let e=await k({...o,use:b});if(e.type===`response`)return{ok:!1,response:e.response};let t=e.runtime;return{ok:!0,execute:e=>ye(t,e)}}let s=await k({...o,use:h});if(s.type===`response`)return{ok:!1,response:s.response};let c=s.runtime;return{ok:!0,execute:e=>ge(c,e)}}async function ge(e,t){return await e.operations.readAlert(t)}async function _e(e,t){return await e.operations.awaitAlert(t)}async function ve(e,t){return await e.operations.acceptAlert(t)}async function ye(e,t){return await e.operations.dismissAlert(t)}async function be(e){let{req:t,logPath:n,sessionStore:r,ref:i,device:a,inspectFacts:o,bindDevice:s,platformServices:c}=e,l=i?r.requireCurrent(i):void 0,u=await he({device:a,action:Se(t.positionals?.[0]),session:l,inspectFacts:o,bindDevice:s,platformServices:c});if(!u.ok)return u.response;l=i?r.requireCurrent(i):void 0,l&&ce(t)===`may-invalidate`&&A(l);let d=E(n,t.flags,l?.appBundleId,l?.trace?.outPath),f=await u.execute({timeoutMs:y(t.positionals?.[1])??1e4,...xe(l),execution:O(d)});return D(r,i,t,t.command,f),{ok:!0,data:f}}function xe(e){return{...e?.appBundleId===void 0?{}:{appBundleId:e.appBundleId},...e?.surface===void 0?{}:{surface:e.surface}}}function Se(e){return e===`accept`||e===`dismiss`||e===`wait`?e:`get`}function Ce(e){let t=e.positionals?.[0]?.toLowerCase(),r=e.positionals?.[1]?.toLowerCase(),i=e.positionals?.[2]?.toLowerCase();if(t===`clear-app-state`)return{ok:!0,parsed:{leg:`write`,args:{setting:t,state:`clear`,appBundleId:r===`clear`?e.positionals?.[2]:e.positionals?.[1]}}};let a=ee(e.positionals);if(a.kind===`read`)return{ok:!0,parsed:{leg:`read`,setting:a.setting}};if(!t||!r||t===`permission`&&!i||t===`location`&&r===`set`&&(!e.positionals?.[2]||!e.positionals?.[3])||t===`reset-keychain`&&e.positionals?.[2]!==void 0)return n(`INVALID_ARGS`,ae);let o=r;if(t===`text-size`){let e=x(r);if(e===void 0)return n(`INVALID_ARGS`,re(r));o=e}return{ok:!0,parsed:{leg:`write`,args:{setting:t,state:o,permissionTarget:i,permissionMode:e.positionals?.[3],latitude:e.positionals?.[2],longitude:e.positionals?.[3]}}}}function we(e){if(e.setting===`permission`)return{permissionTarget:e.permissionTarget,permissionMode:e.permissionMode};if(e.setting===`location`&&e.state===`set`)return{latitude:T(e.latitude,`latitude`),longitude:T(e.longitude,`longitude`)}}function Te(e,t,n){let{setting:r,state:i}=e;return r===`clear-app-state`?{setting:`clear-app-state`,state:`clear`,appBundleId:t,platform:n}:r===`location`&&i===`set`?{setting:r,state:i,latitude:e.latitude,longitude:e.longitude,platform:n}:r===`permission`?{setting:r,state:i,permissionTarget:e.permissionTarget,permissionMode:e.permissionMode,platform:n}:{setting:r,state:i,appBundleId:t,platform:n}}function Ee(e){return typeof e.message==`string`&&e.message.length>0?e.message:void 0}async function De(e,t,n){let{setting:a,state:o}=t,s=await e.operations.setSetting(t);return s&&typeof s==`object`?i({setting:a,state:o,...s},Ee(s)??n):{setting:a,state:o,...r(n)}}async function Oe(e){return e.parsed.leg===`read`?await ke(e,e.parsed.setting):await Ae(e,e.parsed.args)}async function ke(e,t){let{req:n,logPath:i,sessionStore:a,ref:s,device:c,inspectFacts:l,bindDevice:u,platformServices:f}=e,p=s?a.requireCurrent(s):void 0,m=G(c,t);if(m!==void 0)return m;let h=await k({command:`settings ${t}`,device:c,use:d,inspectFacts:l,bindDevice:u,platformServices:f,readiness:!p});if(h.type===`response`)return h.response;p=s?a.requireCurrent(s):void 0,o({level:`debug`,phase:`settings_read`,data:{setting:t,platform:c.platform}});let g=E(i,n.flags,p?.appBundleId,p?.trace?.outPath),_=await h.runtime.operations.readSetting({setting:t,execution:O(g)}),v={..._,...r(C(_))};return D(a,s,n,n.command,v),{ok:!0,data:v}}async function Ae(e,t){let{req:n,logPath:r,sessionStore:i,ref:a,device:s,inspectFacts:c,bindDevice:l,platformServices:u}=e,d=a?i.requireCurrent(a):void 0,{setting:f,state:m}=t,h=G(s,f);if(h!==void 0)return h;let g=je(s,n,f,m);if(g!==void 0)return g;let _=await k({command:`settings`,device:s,use:p,inspectFacts:c,bindDevice:l,platformServices:u,readiness:!d});if(_.type===`response`)return _.response;d=a?i.requireCurrent(a):void 0;let v=Me(n,t,d,s),y=Ne(t,v);if(y!==void 0)return y;d&&A(d),o({level:`debug`,phase:`settings_apply`,data:Te(t,v,s.platform)});let b=await De(_.runtime,Pe(t,v,E(r,n.flags,v,d?.trace?.outPath)),oe(f,m,v));return D(i,a,n,n.command,b),{ok:!0,data:b}}function G(e,t){if(l(e)&&!ne(t))return n(`INVALID_ARGS`,ie(t));if(t===`text-size`&&c(e.platform)&&!u(e))return n(`UNSUPPORTED_OPERATION`,w.message,{deviceKind:e.kind,appleOs:s(e),reason:w.reason},{hint:w.hint})}function K(e){let t=e.input?.app;if(typeof t!=`string`)return;let n=t.trim();return n.length>0?n:void 0}function q(e){return l(e)?`macos-host`:c(e.platform)?`apple`:`mobile`}function je(e,t,r,i){let a=K(t);if(a===void 0||S(q(e),r,i)!==`device-level`)return;let o=te(r,i,a);return n(o.code,o.message,o.details,{hint:o.hint})}function Me(e,t,n,r){let i=S(q(r),t.setting,t.state)===`app-scoped`?K(e):void 0;return t.appBundleId??i??e.internal?.settingsAppBundleId??n?.appBundleId}function Ne(e,r){if(e.setting===`clear-app-state`&&!r)return n(`INVALID_ARGS`,`settings clear-app-state requires an app id when no app is bound to the session`,t())}function Pe(e,t,n){let r=we(e);return{setting:e.setting,state:e.state,...t===void 0?{}:{appBundleId:t},...r===void 0?{}:{options:r},execution:O(n)}}async function Fe(e){return await I({...e,command:`diff`,execute:async({runtime:e,sessionName:t,req:n,snapshotScope:r})=>{let i=await e.capture.diffSnapshot({session:t,interactiveOnly:n.flags?.snapshotInteractiveOnly,depth:n.flags?.snapshotDepth,scope:r,raw:n.flags?.snapshotRaw});return{data:i,record:{kind:`diff`,mode:`snapshot`,baselineInitialized:i.baselineInitialized,summary:i.summary}}}})}function Ie(e){return e!==`sleep`}const Le=[`application`,`window`,`tabbar`,`scrollbar`,`image`],Re=new Set([`tab bar`]);async function ze(e,t){if(t.ok||!Be(t.error.details?.reason)||t.error.details?.captureStalled===!0||t.error.details?.captureTruncated===!0)return t;let r=await Ve(e).catch(()=>null);return r?n(t.error.code,`${t.error.message}. Current surface: ${r.summary}.`,{...t.error.details??{},currentSurface:r.details}):t}function Be(e){return e===j.targetAbsent||e===j.stableTimeout}async function Ve(e){let t={...e.req.flags,snapshotInteractiveOnly:!0},n=await M({device:e.device,session:e.session,flags:t,logPath:e.logPath??``,captureData:async()=>await e.capture(le({flags:t,logPath:e.logPath??``,meta:e.req.meta,session:e.session,snapshotScope:void 0}))});F(e.captureProof,n.snapshot);let r=[...n.snapshot.nodes].sort(He),i=J(r,6,{includeIdentifiers:!0});if(i.length===0)return null;let a=J(r.filter(e=>!Z(e)),4,{includeIdentifiers:!1}),o=J(r.filter(We),4,{includeIdentifiers:!0});return{summary:(a.length>0?a:i.slice(0,4)).join(`, `),details:{labels:i,...o.length>0?{buttons:o}:{}}}}function J(e,t,n){let r=new Set,i=[];for(let a of e){let e=X(a,n);if(!(!e||r.has(e))&&(r.add(e),i.push(e),i.length>=t))break}return i}function He(e,t){return Y(e)-Y(t)||Ue(e,t)}function Y(e){let t=!!X(e,{includeIdentifiers:!1});return(Z(e)?2:0)+ +!t}function Ue(e,t){return e.rect&&t.rect?e.rect.y-t.rect.y||e.rect.x-t.rect.x:e.rect?-1:t.rect?1:(e.depth??0)-(t.depth??0)||e.index-t.index}function X(e,t){let n=(t.includeIdentifiers?[e.label,e.value,e.identifier]:[e.label,e.value]).map(e=>typeof e==`string`?e.trim():``).find(e=>e.length>0);return n?n.replaceAll(/\s+/g,` `).slice(0,80):``}function Z(e){let t=f(`${e.type??``} ${e.role??``} ${e.subrole??``}`),n=`${e.label??``} ${e.value??``}`.trim().toLowerCase();return Le.some(e=>t.includes(e))||Re.has(n)||n.endsWith(`.fill`)}function We(e){let t=`${e.type??``} ${e.role??``} ${e.subrole??``}`;return f(t).includes(`button`)}async function Ge(e){let{req:t,sessionName:n,sessionStore:r}=e,i=Q(t);if(`ok`in i)return i;let a=i,{ref:o,session:s,device:c}=await z(r,n,t.flags),l=await Ke(e,a,s,c);if(l&&`ok`in l)return l;let u=l,d=t.internal?.replayLandmarkGuard,f=qe(a,s);if(`ok`in f)return f;let{waitParsed:p,staleRefsWarning:m}=f;return e.consumedSnapshot??={},e.captureProof??={},a.kind===`sleep`?await $({...e,ref:o},p,s,c,u,m,d):P({response:await R(s,c,()=>$({...e,ref:o},p,s,c,u,m,d),e.platformResourceCleanup),consumedTree:me(e),captureProof:e.captureProof})}function Q(e){let t=g(e.positionals??[]);if(!t)return n(`INVALID_ARGS`,`wait requires a duration or text`);if(t.kind===`invalid`)return n(`INVALID_ARGS`,t.message);if(t.kind!==`absent`)return t;let r=a({depth:e.flags?.snapshotDepth,scope:e.flags?.snapshotScope});if(!r)return t;let i=se(r,`wait`);return n(i.code,i.message,i.details)}async function Ke(e,t,n,r){if(!Ie(t.kind))return;let i=await H({command:`wait`,device:r,session:n,inspectFacts:e.inspectFacts,platformServices:e.platformServices,bindDevice:e.bindDevice});return i.ok?i.operations:i.response}function qe(e,t){if(e.kind!==`ref`)return{waitParsed:e};let n=U(e.rawRef);return n.ok?{waitParsed:{...e,rawRef:n.ref},staleRefsWarning:N({session:t,ref:n.ref,mintedGeneration:n.generation})}:n.response}async function $(e,t,n,r,i,a,o){let{req:s,sessionName:c,sessionStore:l}=e,u=await V({...e,ref:e.ref,session:n,device:r,bound:i}),d=await pe(async()=>{let r=await u.selectors.wait({session:c,requestId:s.meta?.requestId,target:Je(t,n,o)}),i=de(r);fe(l,e.ref,s,ue(r),i,`landmark`);let d=W(r);return a?{...d,warning:a}:d}),f=i?await ze({req:s,logPath:e.logPath,session:n,device:r,capture:i.capture,captureProof:e.captureProof},d):d;return await B(e,f,`wait`)}function Je(e,t,n){switch(e.kind){case`sleep`:return{kind:`sleep`,durationMs:e.durationMs};case`selector`:return{kind:`selector`,selector:e.selectorExpression,timeoutMs:e.timeoutMs,...n?{recordedLandmark:n}:{}};case`absent`:return{kind:`absent`,selector:e.selectorExpression,timeoutMs:e.timeoutMs};case`ref`:return Xe(e,t);case`stable`:return{kind:`stable`,quietMs:e.quietMs,timeoutMs:e.timeoutMs};case`text`:return Ze(e);default:return Ye(e)}}function Ye(e){throw Error(`Unsupported wait positional target: ${String(e)}`)}function Xe(t,n){if(!n?.snapshot)throw new e(`INVALID_ARGS`,`Ref wait requires an existing snapshot in session.`);return{kind:`ref`,ref:t.rawRef,timeoutMs:t.timeoutMs}}function Ze(t){let n=_(t.text);if(!n.ok)throw new e(n.code,n.message);return{kind:`text`,text:n.text,timeoutMs:t.timeoutMs}}const Qe={snapshot:async({req:e,createCommandSurface:t,sessionName:n,logPath:r,sessionStore:i,inspectFacts:a,bindDevice:o,platformServices:s,platformResourceCleanup:c})=>await L({createCommandSurface:t,req:e,sessionName:n,logPath:r,sessionStore:i,inspectFacts:a,bindDevice:o,platformServices:s,platformResourceCleanup:c}),diff:async({req:e,createCommandSurface:t,sessionName:r,logPath:i,sessionStore:a,inspectFacts:o,bindDevice:s,platformServices:c,platformResourceCleanup:l})=>e.positionals?.[0]===`snapshot`?await Fe({createCommandSurface:t,req:e,sessionName:r,logPath:i,sessionStore:a,inspectFacts:o,bindDevice:s,platformServices:c,platformResourceCleanup:l}):n(`INVALID_ARGS`,`diff currently supports only: diff snapshot`),wait:async({req:e,createCommandSurface:t,sessionName:n,logPath:r,sessionStore:i,inspectFacts:a,bindDevice:o,platformServices:s,platformResourceCleanup:c})=>await Ge({createCommandSurface:t,req:e,sessionName:n,logPath:r,sessionStore:i,inspectFacts:a,bindDevice:o,platformServices:s,platformResourceCleanup:c}),alert:async({req:e,sessionName:t,logPath:n,sessionStore:r,inspectFacts:i,bindDevice:a,platformServices:o,platformResourceCleanup:s})=>{let{ref:c,session:l,device:u}=await z(r,t,e.flags);return await R(l,u,async()=>await be({req:e,logPath:n,sessionStore:r,ref:c,device:u,inspectFacts:i,bindDevice:a,platformServices:o}),s)},settings:async({req:e,sessionName:t,logPath:n,sessionStore:r,inspectFacts:i,bindDevice:a,platformServices:o,platformResourceCleanup:s})=>{let c=Ce(e);if(!c.ok)return c;let{ref:l,session:u,device:d}=await z(r,t,e.flags);return await R(u,d,async()=>await Oe({req:e,logPath:n,sessionStore:r,ref:l,device:d,parsed:c.parsed,inspectFacts:i,bindDevice:a,platformServices:o}),s)}};async function $e(e){let t=e.req.command,n=Qe[t];return n?await n(e):null}export{$e as handleSnapshotCommands};
|