agent-device 0.20.9 → 0.21.0
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 +2 -2
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.20.9.apk → agent-device-android-ime-helper-0.21.0.apk} +0 -0
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.0.apk.sha256 +1 -0
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.20.9.manifest.json → agent-device-android-ime-helper-0.21.0.manifest.json} +4 -4
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.0.apk +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.0.apk.sha256 +1 -0
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.20.9.manifest.json → agent-device-android-snapshot-helper-0.21.0.manifest.json} +6 -6
- package/apple/macos-helper/Sources/AgentDeviceMacOSHelper/AudioProbe.swift +35 -33
- package/apple/macos-helper/Sources/AgentDeviceMacOSHelper/main.swift +6 -1
- package/apple/snapshot-bridge/LICENSE.idb +23 -0
- package/apple/snapshot-bridge/README.md +49 -0
- package/apple/snapshot-bridge/SnapshotBridge.m +280 -0
- package/apple/snapshot-bridge/SnapshotBridgeRuntime.h +33 -0
- package/apple/snapshot-bridge/SnapshotBridgeRuntime.m +382 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m +58 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.pbxproj +19 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAlertVerification.swift +36 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerStringNormalization.swift +8 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.h +12 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.m +100 -6
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTapPointPolicy.swift +2 -2
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +21 -12
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +21 -88
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AlertObservation.swift +124 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +110 -107
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +6 -14
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +85 -114
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +13 -6
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +72 -175
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +10 -11
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+PrivateAXElementTypes.swift +12 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+PrivateAXPresentation.swift +78 -64
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift +17 -9
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +47 -13
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +232 -438
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotBackendCapabilities.swift +98 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +229 -168
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotPresentationInvariant.swift +19 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotTiming.swift +110 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedCommitDeadline.swift +206 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedTextEntry.swift +147 -25
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +21 -18
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +24 -307
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryFocus.swift +206 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryReadiness.swift +158 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextInputCandidatePolicy.swift +19 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextTyping.swift +49 -16
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Transport.swift +2 -11
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TvRemote.swift +4 -19
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +16 -20
- package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/RecordingExportSupport.swift +111 -0
- package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/recording-overlay.swift +42 -81
- package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/recording-trim.swift +35 -82
- package/dist/apple/snapshot-presentation/Package.swift +21 -0
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotGeometry.swift +56 -0
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotModels.swift +259 -0
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentation.swift +153 -0
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentationFailure.swift +27 -0
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentationInvariant.swift +91 -0
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentationProjection.swift +161 -0
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotScopePolicy.swift +53 -0
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotVisibilityFold.swift +242 -0
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotVisibilityFoldProjection.swift +97 -0
- package/dist/src/adapter.js +1 -0
- package/dist/src/adb-executor.js +2 -0
- package/dist/src/adb-failure.js +1 -0
- package/dist/src/adb-host.js +1 -0
- package/dist/src/adb.js +1 -0
- package/dist/src/agent-browser-lifecycle.js +1 -0
- package/dist/src/agent-browser-process-record.js +1 -0
- package/dist/src/agent-browser-provider.js +1 -0
- package/dist/src/agent-browser-tool.js +1 -1
- package/dist/src/agent-device-client.js +2 -2
- package/dist/src/ai-sdk.d.ts +61 -0
- package/dist/src/ai-sdk.js +1 -0
- package/dist/src/alert-contract.js +1 -0
- package/dist/src/alert-runtime.js +1 -0
- package/dist/src/android-adb.d.ts +27 -19
- package/dist/src/android-adb.js +1 -1
- package/dist/src/android-input-ownership.js +1 -0
- package/dist/src/android-system-chrome.js +1 -0
- package/dist/src/android.js +1 -1
- package/dist/src/api.js +11 -0
- package/dist/src/app-catalog.js +1 -0
- package/dist/src/app-deployment-resolution.js +2 -0
- package/dist/src/app-helpers.js +1 -1
- package/dist/src/app-inventory-contract.js +1 -0
- package/dist/src/app-inventory.js +1 -0
- package/dist/src/app-launch.js +2 -0
- package/dist/src/app-lifecycle-facade.js +1 -0
- package/dist/src/app-lifecycle.js +3 -6
- package/dist/src/app-lifecycle2.js +2 -2
- package/dist/src/app-lifecycle3.js +1 -0
- package/dist/src/app-log-files.js +1 -1
- package/dist/src/app-log-reconnect.js +1 -1
- package/dist/src/app-log-runtime.js +1 -4
- package/dist/src/app-log-runtime2.js +4 -0
- package/dist/src/app-parsers.js +4 -0
- package/dist/src/app-resolution-cache.js +1 -0
- package/dist/src/app-resolution-facade.js +1 -0
- package/dist/src/app-resolution.js +2 -2
- package/dist/src/app-state.js +1 -2
- package/dist/src/application-lifecycle-interaction.js +1 -0
- package/dist/src/application-lifecycle-runtime.js +1 -0
- package/dist/src/apps-simctl.js +1 -0
- package/dist/src/archive.js +4 -0
- package/dist/src/artifact-download.js +1 -0
- package/dist/src/artifacts.d.ts +6 -2
- package/dist/src/artifacts.js +1 -1
- package/dist/src/async-lifecycle.js +1 -0
- package/dist/src/audio-probe-result.js +1 -0
- package/dist/src/audio-probe-runtime.js +1 -0
- package/dist/src/audio-probe-support.js +1 -0
- package/dist/src/auth-session.js +1 -1
- package/dist/src/auth.js +1 -1
- package/dist/src/back-mode.js +1 -0
- package/dist/src/{url.js → base-url.js} +1 -1
- package/dist/src/boot-diagnostics.js +2 -2
- package/dist/src/byte-limit-stream.js +1 -1
- package/dist/src/capabilities.js +1 -0
- package/dist/src/capture.js +1 -0
- package/dist/src/catalog.js +1 -0
- package/dist/src/cli-command-aliases.js +1 -0
- package/dist/src/cli-config.js +1 -1
- package/dist/src/cli-help.js +77 -51
- package/dist/src/cli-output.js +1 -1
- package/dist/src/cli-runner.js +1 -1
- package/dist/src/cli.js +5 -7
- package/dist/src/click-button.js +1 -0
- package/dist/src/client-metro-companion.js +1 -0
- package/dist/src/client-metro.js +1 -1
- package/dist/src/client-types.d.ts +1606 -0
- package/dist/src/clipboard.js +1 -0
- package/dist/src/code-signature-cache.js +1 -0
- package/dist/src/code-signature.js +1 -0
- package/dist/src/color.js +1 -0
- package/dist/src/command-metadata.js +1 -1
- package/dist/src/command-schema.js +3 -3
- package/dist/src/command-surface.js +1 -1
- package/dist/src/command-tools.js +2 -0
- package/dist/src/command.js +1 -0
- package/dist/src/{selector-vocabulary.js → compatibility-policy.js} +1 -1
- package/dist/src/config.js +1 -1
- package/dist/src/config2.js +1 -0
- package/dist/src/connection-runtime.js +1 -1
- 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-lifecycle.js +1 -0
- package/dist/src/daemon-process.js +1 -0
- package/dist/src/daemon-registration.js +1 -0
- package/dist/src/daemon-shutdown-report.js +1 -1
- package/dist/src/daemon.js +2 -2
- package/dist/src/debug-symbols-facade.js +5 -0
- package/dist/src/deploy-result-target.js +1 -0
- package/dist/src/device-claim-inspection.js +1 -1
- package/dist/src/device-claim-rule.js +1 -0
- package/dist/src/device-input-state.d.ts +190 -3
- package/dist/src/device-inventory-context.js +1 -0
- package/dist/src/device-isolation.js +1 -0
- package/dist/src/device-release.js +1 -0
- package/dist/src/device-rotation.js +1 -0
- package/dist/src/device-selection-resolver.js +1 -0
- package/dist/src/device-session.js +1 -0
- package/dist/src/device.js +1 -1
- package/dist/src/device2.js +3 -2
- package/dist/src/diagnostics.js +3 -0
- package/dist/src/diagnostics2.js +1 -0
- package/dist/src/dispatch-resolve.js +1 -0
- package/dist/src/doctor-facade.js +1 -0
- package/dist/src/doctor-output.js +1 -0
- package/dist/src/doctor.js +1 -0
- package/dist/src/doctor2.js +1 -0
- package/dist/src/doctor3.js +1 -0
- package/dist/src/durable-resource.js +1 -0
- package/dist/src/entities.js +1 -1
- package/dist/src/error.js +2 -0
- package/dist/src/exec.js +1 -0
- package/dist/src/file.js +1 -0
- package/dist/src/find.js +1 -1
- package/dist/src/finders.js +1 -1
- package/dist/src/format.js +2 -0
- package/dist/src/generic-settle.js +1 -1
- package/dist/src/generic.js +1 -1
- package/dist/src/gesture-admission.js +1 -0
- package/dist/src/gesture-plan-types.js +1 -0
- package/dist/src/gesture-plan.js +1 -0
- package/dist/src/gesture-runtime.js +1 -0
- package/dist/src/harmonyos.js +1 -1
- package/dist/src/hdc.js +1 -1
- package/dist/src/helper.js +2 -2
- package/dist/src/host-file.js +1 -0
- package/dist/src/human-control-contract.js +1 -0
- package/dist/src/human-control.js +1 -0
- package/dist/src/index.d.ts +2 -1578
- package/dist/src/index.js +1 -1
- package/dist/src/input-actions.js +1 -4
- package/dist/src/input-actions2.js +2 -1
- package/dist/src/install-artifact-facade.js +1 -0
- package/dist/src/install-source-network-transport.js +1 -0
- package/dist/src/install-source.d.ts +3 -10
- package/dist/src/install-source2.js +1 -1
- package/dist/src/interaction-positionals.js +1 -0
- package/dist/src/interaction-ref-policy.js +1 -0
- package/dist/src/interaction.js +1 -1
- package/dist/src/interaction2.js +1 -1
- package/dist/src/interactor-operation-catalog.js +1 -0
- package/dist/src/interactor-types.js +1 -0
- package/dist/src/interactor.js +6 -2
- package/dist/src/interactor2.js +1 -1
- package/dist/src/interactors.js +1 -1
- package/dist/src/internal/bin.d.ts +1 -1
- package/dist/src/internal/bin.js +1 -2
- package/dist/src/internal/companion-tunnel.d.ts +1 -1
- package/dist/src/internal/companion-tunnel.js +1 -1
- package/dist/src/internal/daemon.d.ts +1 -1
- package/dist/src/internal/daemon.js +2 -4
- package/dist/src/internal/png-worker.d.ts +4 -4
- package/dist/src/internal/png-worker.js +1 -1
- package/dist/src/internal/run-script-http-child.d.ts +4 -0
- package/dist/src/internal/run-script-http-child.js +1 -0
- package/dist/src/internal/update-check-entry.d.ts +1 -1
- package/dist/src/inventory.js +4 -4
- package/dist/src/inventory2.js +1 -1
- package/dist/src/inventory3.js +1 -1
- package/dist/src/inventory5.js +1 -1
- package/dist/src/inventory6.js +1 -1
- package/dist/src/ios-client.js +16 -0
- package/dist/src/ios-snapshot-acquisition.js +1 -0
- package/dist/src/ios-snapshot-adapter.js +1 -0
- package/dist/src/ios-snapshot-planning.js +1 -0
- package/dist/src/ios-snapshot-runtime.js +1 -0
- package/dist/src/json.js +1 -0
- package/dist/src/keyboard-actions.js +1 -0
- package/dist/src/launch-console.js +1 -0
- package/dist/src/lease-context.js +1 -1
- package/dist/src/lease-scope.js +1 -0
- package/dist/src/lease.js +1 -1
- package/dist/src/limrun-runtime-dependencies.js +1 -1
- package/dist/src/limrun.d.ts +1618 -7
- package/dist/src/limrun.js +1 -1
- package/dist/src/linux.js +1 -1
- package/dist/src/local-interactor-operation-set.js +1 -0
- package/dist/src/location-coordinates.js +1 -1
- package/dist/src/logcat.js +1 -1
- package/dist/src/macos-facade.js +1 -0
- package/dist/src/managed-device-scope.js +1 -0
- package/dist/src/mechanics.js +19 -0
- package/dist/src/metro.d.ts +4 -2
- package/dist/src/metro.js +1 -1
- package/dist/src/metro2.js +1 -1
- package/dist/src/mobile-snapshot-semantics.js +1 -0
- package/dist/src/multitouch-support.js +1 -0
- package/dist/src/numeric.js +1 -0
- package/dist/src/observability.js +1 -1
- package/dist/src/observation.js +2 -0
- package/dist/src/output-path.js +1 -1
- package/dist/src/owner-identity.js +3 -1
- package/dist/src/parameterized-recorded-fill.js +1 -0
- package/dist/src/parser.js +1 -1
- package/dist/src/perf-facade.js +2 -0
- package/dist/src/perf-runtime-operation-builder.js +1 -0
- package/dist/src/perf-runtime-plan.js +1 -0
- package/dist/src/perf-runtime.js +1 -0
- package/dist/src/perf.js +1 -4
- package/dist/src/physical-device-control.js +1 -1
- package/dist/src/physical-device-facade.js +1 -0
- package/dist/src/platform-request-scope.js +1 -0
- package/dist/src/platform-runtime-android-adb-host.js +1 -0
- package/dist/src/platform-runtime-android-mechanics.js +1 -0
- package/dist/src/platform-runtime-app-log-android-transport.js +1 -1
- package/dist/src/platform-runtime-app-log-process.js +1 -1
- package/dist/src/platform-runtime-apple-resources.js +1 -0
- package/dist/src/platform-runtime-host.js +1 -1
- package/dist/src/platform-runtime-managed-owner.js +1 -0
- 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-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-apple-transport.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-process-host.js +1 -0
- package/dist/src/platform-runtime-screen-recording-web-host.js +1 -1
- package/dist/src/platform-runtime-unavailable.js +1 -0
- package/dist/src/platform-runtime.js +1 -1
- package/dist/src/platform-runtime2.js +1 -1
- package/dist/src/plist.js +1 -1
- package/dist/src/png-worker-contract.js +1 -1
- package/dist/src/prepare-kind.js +1 -15
- package/dist/src/process-exit.js +1 -1
- package/dist/src/process.js +1 -0
- package/dist/src/provider-device-runtime.js +1 -0
- package/dist/src/provider-session-ownership.js +2 -0
- package/dist/src/provider-webdriver.js +1 -1
- package/dist/src/provider.js +1 -1
- package/dist/src/providers.js +1 -0
- package/dist/src/proxy.js +2 -2
- package/dist/src/react-native-overlay.js +1 -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/rect-center.js +1 -0
- package/dist/src/register-builtins.js +1 -0
- package/dist/src/registry.js +39 -28
- package/dist/src/remote-config2.js +1 -1
- package/dist/src/replay-divergence.js +2 -0
- package/dist/src/replay.js +2 -2
- package/dist/src/reporting.js +8 -8
- package/dist/src/request-admission.js +1 -0
- package/dist/src/request-cancel.js +1 -0
- package/dist/src/request-cancellation.js +1 -0
- package/dist/src/request-progress-protocol.js +1 -0
- package/dist/src/request-providers.js +1 -0
- package/dist/src/request-runtime-binding.js +1 -0
- package/dist/src/request.js +1 -0
- package/dist/src/result-serialization.js +1 -0
- package/dist/src/retry.js +1 -0
- package/dist/src/rolldown-runtime.js +1 -1
- package/dist/src/runner-cache-metadata.js +2 -0
- package/dist/src/runner-client.js +1 -1
- package/dist/src/runner-disposal.js +1 -1
- package/dist/src/runner-operations-facade.js +1 -0
- package/dist/src/runner-owner-facade.js +1 -0
- package/dist/src/runner-owner-state.js +1 -0
- package/dist/src/runner-presentation.js +1 -0
- package/dist/src/runner-selector-query.js +1 -0
- package/dist/src/runner.js +1 -0
- package/dist/src/{runtime-transport.js → runtime-transport-hints.js} +1 -1
- package/dist/src/runtime.js +3 -3
- package/dist/src/runtime2.js +4 -4
- package/dist/src/runtime3.js +1 -1
- package/dist/src/runtime4.js +4 -3
- 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/scoped-provider.js +1 -1
- package/dist/src/screen-recording-completion.js +1 -0
- package/dist/src/screen-recording-live-handle.js +1 -0
- package/dist/src/screen-recording-options.js +1 -0
- package/dist/src/screen-recording-resource-recovery.js +1 -0
- package/dist/src/screen-recording-runtime.js +1 -0
- package/dist/src/screenshot-density.js +1 -1
- package/dist/src/screenshot-result.js +1 -6
- package/dist/src/screenshot-runtime.js +1 -0
- package/dist/src/screenshot.js +1 -1
- package/dist/src/screenshot2.js +1 -0
- package/dist/src/screenshot3.js +5 -0
- package/dist/src/script.js +1 -0
- package/dist/src/scroll-command.js +1 -0
- package/dist/src/scroll-gesture.js +1 -0
- package/dist/src/scroll-indicator.js +1 -0
- package/dist/src/sdk-batch-runner.d.ts +23 -6
- package/dist/src/sdk-batch-runner.js +2 -3
- package/dist/src/sdk-batch.js +2 -0
- package/dist/src/sdk-contracts.d.ts +222 -99
- 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.js +1 -1
- package/dist/src/sdk-remote-config.d.ts +1 -1
- package/dist/src/sdk-remote-config.js +1 -1
- package/dist/src/sdk-selectors.d.ts +539 -199
- package/dist/src/sdk-selectors.js +1 -1
- package/dist/src/selection.js +1 -0
- package/dist/src/selector-runtime.js +1 -1
- package/dist/src/selectors.js +1 -1
- package/dist/src/semantic-index.js +1 -0
- package/dist/src/server.js +10 -3
- package/dist/src/session-allocation.js +1 -0
- package/dist/src/session-artifact-paths.js +1 -0
- package/dist/src/session-paths.js +1 -0
- package/dist/src/session-repair-tombstone.js +1 -0
- package/dist/src/session-routing.js +1 -0
- package/dist/src/session-runtime-admission.js +1 -0
- package/dist/src/session-snapshot.js +1 -0
- package/dist/src/session-store.js +4 -0
- package/dist/src/session-target-evidence.js +1 -1
- package/dist/src/session2.js +5 -28
- package/dist/src/settings.js +1 -0
- package/dist/src/shared.js +2 -2
- package/dist/src/simctl-facade.js +1 -0
- package/dist/src/simctl.js +1 -1
- package/dist/src/simulator-facade.js +1 -0
- package/dist/src/simulator.js +1 -1
- package/dist/src/snapshot-capture-annotations.js +1 -0
- package/dist/src/snapshot-desktop-projection.js +1 -0
- package/dist/src/snapshot-diagnostics.js +1 -0
- package/dist/src/snapshot-process.js +1 -0
- package/dist/src/snapshot-quality-backend-capabilities.js +1 -0
- package/dist/src/snapshot-quality-verdict.js +1 -0
- package/dist/src/snapshot-runtime-binding.js +1 -0
- package/dist/src/snapshot-runtime.js +1 -1
- package/dist/src/snapshot-scope.js +1 -0
- package/dist/src/snapshot-state.js +1 -0
- package/dist/src/snapshot.js +1 -8
- package/dist/src/snapshot2.js +1 -1
- package/dist/src/snapshot3.js +1 -1
- package/dist/src/snapshot4.js +1 -0
- package/dist/src/src.js +1 -1
- package/dist/src/src2.js +1 -1
- package/dist/src/src3.js +1 -2
- package/dist/src/src4.js +1 -0
- package/dist/src/src5.js +1 -0
- package/dist/src/src6.js +1 -0
- package/dist/src/src7.js +2 -0
- package/dist/src/src8.js +115 -0
- package/dist/src/startup-recovery-fence.js +1 -0
- package/dist/src/status-markers.js +1 -0
- package/dist/src/string-enum.js +1 -1
- package/dist/src/success-text.js +1 -0
- package/dist/src/surface-snapshot.js +1 -0
- package/dist/src/surface-snapshot2.js +1 -0
- package/dist/src/takeover.js +5 -0
- package/dist/src/tool-provider-facade.js +1 -0
- package/dist/src/tool-provider.js +4 -3
- package/dist/src/tool-provider2.js +1 -1
- package/dist/src/tool-provider3.js +1 -0
- package/dist/src/toolchain-probe.js +2 -0
- package/dist/src/touch-runtime.js +1 -0
- package/dist/src/transport.js +3 -0
- package/dist/src/tree.js +1 -0
- package/dist/src/ttl-memo.js +1 -0
- package/dist/src/tv-remote.js +1 -0
- package/dist/src/type-text-runtime.js +1 -0
- package/dist/src/undici.js +99 -0
- package/dist/src/update-check.js +1 -1
- package/dist/src/verified-file.js +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/video.js +2 -2
- package/dist/src/web.js +2 -1
- package/dist/src/web2.js +1 -0
- package/dist/src/webdriver-ios-snapshot.js +1 -0
- package/dist/src/webdriver-source.js +1 -0
- package/linux/atspi-dump.py +54 -9
- package/package.json +73 -38
- package/server.json +9 -3
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.9.apk.sha256 +0 -1
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.9.apk +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.9.apk.sha256 +0 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CoordinateTextEntryTests.swift +0 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+FlatSnapshotFiltering.swift +0 -75
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+LifecycleCacheTests.swift +0 -6
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+RecordingTests.swift +0 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SelectorMatchPolicyTests.swift +0 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotTraversalIdentityTests.swift +0 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryPolicyTests.swift +0 -4
- package/dist/src/appearance.js +0 -1
- package/dist/src/apps.js +0 -5
- package/dist/src/audio-probe.js +0 -1
- package/dist/src/cancel.js +0 -1
- package/dist/src/cli-grammar.js +0 -1
- package/dist/src/command-catalog.js +0 -1
- package/dist/src/debug-symbols.js +0 -5
- package/dist/src/device-input-state.js +0 -2
- package/dist/src/device-ready.js +0 -1
- package/dist/src/dispatch.js +0 -1
- package/dist/src/handler-utils.js +0 -1
- package/dist/src/helper-package-install.js +0 -1
- package/dist/src/host-process.js +0 -3
- package/dist/src/ime-lifecycle.js +0 -2
- package/dist/src/ime-recovery-marker.js +0 -1
- package/dist/src/input-actions3.js +0 -1
- package/dist/src/install-artifact.js +0 -1
- package/dist/src/install-artifact2.js +0 -1
- package/dist/src/interaction-common.js +0 -1
- package/dist/src/interaction-runtime.js +0 -1
- package/dist/src/interaction-snapshot.js +0 -1
- package/dist/src/manifest.js +0 -1
- package/dist/src/method-scope.js +0 -1
- package/dist/src/png-resize.js +0 -1
- package/dist/src/process-lock.js +0 -1
- package/dist/src/runner-lease.js +0 -1
- package/dist/src/runner-sequence.js +0 -1
- package/dist/src/screenshot-geometry.js +0 -1
- package/dist/src/sdk-android-adb.d.ts +0 -245
- package/dist/src/sdk-android-adb.js +0 -4
- package/dist/src/sdk.js +0 -1
- package/dist/src/setting-state.js +0 -1
- package/dist/src/shell-quote.js +0 -1
- package/dist/src/snapshot-session.js +0 -1
- package/dist/src/timing-safe-equal.js +0 -1
- package/dist/src/unsupported-interactor.js +0 -1
- package/dist/src/verdict.js +0 -1
- /package/dist/src/{recording-telemetry.js → telemetry.js} +0 -0
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The private Simulator AX reader is adapted from Meta Platforms, Inc. idb v1.5.2
|
|
3
|
+
* SimulatorFrameworkBridge/AccessibilityService.m and AccessibilityRuntime.m.
|
|
4
|
+
* See LICENSE.idb for the upstream notice and license.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#import "SnapshotBridgeRuntime.h"
|
|
8
|
+
|
|
9
|
+
#import <CoreGraphics/CoreGraphics.h>
|
|
10
|
+
#import <objc/message.h>
|
|
11
|
+
#import <objc/runtime.h>
|
|
12
|
+
|
|
13
|
+
#import <dlfcn.h>
|
|
14
|
+
#import <signal.h>
|
|
15
|
+
#import <unistd.h>
|
|
16
|
+
|
|
17
|
+
NSString *const kProtocolVersionKey = @"protocolVersion";
|
|
18
|
+
NSString *const kSourceVersionKey = @"sourceVersion";
|
|
19
|
+
NSString *const kRequestIdKey = @"requestId";
|
|
20
|
+
NSString *const kSourceVersion = @"agent-device-simulator-ax-v1.5.3";
|
|
21
|
+
const NSUInteger kProtocolVersion = 1;
|
|
22
|
+
const uint32_t kMaximumFrameBytes = 16 * 1024 * 1024;
|
|
23
|
+
const NSUInteger kMaximumDepth = 128;
|
|
24
|
+
const NSUInteger kMaximumNodes = 10000;
|
|
25
|
+
const NSUInteger kMaximumDurationMs = 120000;
|
|
26
|
+
|
|
27
|
+
static NSString *const kAttributeElementType = @"XC_kAXXCAttributeElementType";
|
|
28
|
+
static NSString *const kAttributeElementBaseType = @"XC_kAXXCAttributeElementBaseType";
|
|
29
|
+
static NSString *const kAttributeLabel = @"XC_kAXXCAttributeLabel";
|
|
30
|
+
static NSString *const kAttributeValue = @"XC_kAXXCAttributeValue";
|
|
31
|
+
static NSString *const kAttributeIdentifier = @"XC_kAXXCAttributeIdentifier";
|
|
32
|
+
static NSString *const kAttributeFrame = @"XC_kAXXCAttributeFrame";
|
|
33
|
+
static NSString *const kAttributeAutomationType = @"XC_kAXXCAttributeAutomationType";
|
|
34
|
+
static NSString *const kAttributeChildren = @"XC_kAXXCAttributeChildren";
|
|
35
|
+
static NSString *const kSnapshotAttributes = @"UIAccessibilitySnapshotKeyAttributes";
|
|
36
|
+
static NSString *const kSnapshotChildren = @"UIAccessibilitySnapshotKeyChildren";
|
|
37
|
+
static NSString *const kXctAutomationSupportPath =
|
|
38
|
+
@"/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework/XCTAutomationSupport";
|
|
39
|
+
static NSString *const kAxRuntimePath =
|
|
40
|
+
@"/System/Library/PrivateFrameworks/AXRuntime.framework/AXRuntime";
|
|
41
|
+
static NSString *const kAccessibilityErrorKey = @"accessibility-error";
|
|
42
|
+
|
|
43
|
+
typedef NSDictionary<NSString *, id> *_Nullable (*DefaultSnapshotParametersFn)(void);
|
|
44
|
+
typedef NSArray<NSNumber *> *_Nullable (*AttributeNumbersForNamesFn)(NSArray<NSString *> *names);
|
|
45
|
+
typedef uint32_t (*AXValueGetTypeFn)(const void *value);
|
|
46
|
+
typedef Boolean (*AXValueGetValueFn)(const void *value, uint32_t type, void *out);
|
|
47
|
+
typedef bool (*AutomationEnabledFn)(void);
|
|
48
|
+
|
|
49
|
+
@interface XCTAccessibilityFramework : NSObject
|
|
50
|
+
- (instancetype)initForRemoteAccess;
|
|
51
|
+
- (nullable id)userTestingSnapshotForElement:(id)element
|
|
52
|
+
options:(NSDictionary<NSString *, id> *)options
|
|
53
|
+
error:(NSError **)error;
|
|
54
|
+
@end
|
|
55
|
+
|
|
56
|
+
@interface XCAccessibilityElement : NSObject
|
|
57
|
+
- (nullable void *)AXUIElement;
|
|
58
|
+
@end
|
|
59
|
+
|
|
60
|
+
@protocol XCAccessibilityElementFactory <NSObject>
|
|
61
|
+
+ (nullable XCAccessibilityElement *)elementWithProcessIdentifier:(pid_t)pid;
|
|
62
|
+
@end
|
|
63
|
+
|
|
64
|
+
@protocol AXForegroundElement <NSObject>
|
|
65
|
+
+ (nullable id<AXForegroundElement>)primaryApp;
|
|
66
|
+
- (pid_t)pid;
|
|
67
|
+
@end
|
|
68
|
+
|
|
69
|
+
static NSNumber *finiteNumber(double value)
|
|
70
|
+
{
|
|
71
|
+
return isfinite(value) ? @(value) : nil;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
static NSDictionary *_Nullable rectDictionary(CGRect rect)
|
|
75
|
+
{
|
|
76
|
+
NSNumber *x = finiteNumber(rect.origin.x);
|
|
77
|
+
NSNumber *y = finiteNumber(rect.origin.y);
|
|
78
|
+
NSNumber *width = finiteNumber(rect.size.width);
|
|
79
|
+
NSNumber *height = finiteNumber(rect.size.height);
|
|
80
|
+
if (!x || !y || !width || !height) {
|
|
81
|
+
return nil;
|
|
82
|
+
}
|
|
83
|
+
return @{ @"X" : x, @"Y" : y, @"Width" : width, @"Height" : height };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@interface SnapshotWatchdogState : NSObject
|
|
87
|
+
@property(atomic) BOOL completed;
|
|
88
|
+
@end
|
|
89
|
+
|
|
90
|
+
@implementation SnapshotWatchdogState
|
|
91
|
+
@end
|
|
92
|
+
|
|
93
|
+
static dispatch_source_t startRequestWatchdog(NSUInteger durationMs, SnapshotWatchdogState *state)
|
|
94
|
+
{
|
|
95
|
+
dispatch_source_t watchdog = dispatch_source_create(
|
|
96
|
+
DISPATCH_SOURCE_TYPE_TIMER,
|
|
97
|
+
0,
|
|
98
|
+
0,
|
|
99
|
+
dispatch_get_global_queue(QOS_CLASS_UTILITY, 0));
|
|
100
|
+
dispatch_source_set_timer(
|
|
101
|
+
watchdog,
|
|
102
|
+
dispatch_time(DISPATCH_TIME_NOW, (uint64_t)durationMs * NSEC_PER_MSEC),
|
|
103
|
+
DISPATCH_TIME_FOREVER,
|
|
104
|
+
0);
|
|
105
|
+
dispatch_source_set_event_handler(watchdog, ^{
|
|
106
|
+
if (!state.completed) kill(getpid(), SIGKILL);
|
|
107
|
+
});
|
|
108
|
+
dispatch_resume(watchdog);
|
|
109
|
+
return watchdog;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
static void finishRequestWatchdog(dispatch_source_t watchdog, SnapshotWatchdogState *state)
|
|
113
|
+
{
|
|
114
|
+
state.completed = YES;
|
|
115
|
+
dispatch_source_cancel(watchdog);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@implementation BridgeRuntime {
|
|
119
|
+
XCTAccessibilityFramework *_framework;
|
|
120
|
+
Class<XCAccessibilityElementFactory> _elementClass;
|
|
121
|
+
DefaultSnapshotParametersFn _defaultSnapshotParameters;
|
|
122
|
+
AttributeNumbersForNamesFn _attributeNumbersForNames;
|
|
123
|
+
AXValueGetTypeFn _valueGetType;
|
|
124
|
+
AXValueGetValueFn _valueGetValue;
|
|
125
|
+
AutomationEnabledFn _automationEnabled;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
- (nullable instancetype)initWithError:(NSString *_Nullable *_Nullable)error
|
|
129
|
+
{
|
|
130
|
+
self = [super init];
|
|
131
|
+
if (!self) return nil;
|
|
132
|
+
|
|
133
|
+
dlopen(kAxRuntimePath.UTF8String, RTLD_NOW);
|
|
134
|
+
dlopen(kXctAutomationSupportPath.UTF8String, RTLD_NOW);
|
|
135
|
+
|
|
136
|
+
Class frameworkClass = objc_lookUpClass("XCTAccessibilityFramework");
|
|
137
|
+
_elementClass = (Class<XCAccessibilityElementFactory>)objc_lookUpClass("XCAccessibilityElement");
|
|
138
|
+
if (!frameworkClass || !_elementClass) {
|
|
139
|
+
if (error) *error = @"XCTAutomationSupport accessibility classes are unavailable";
|
|
140
|
+
return nil;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
_framework = [(XCTAccessibilityFramework *)[frameworkClass alloc] initForRemoteAccess];
|
|
144
|
+
if (!_framework || ![_framework respondsToSelector:@selector(userTestingSnapshotForElement:options:error:)]) {
|
|
145
|
+
if (error) *error = @"XCTAccessibilityFramework snapshot API is unavailable";
|
|
146
|
+
return nil;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
_defaultSnapshotParameters = (DefaultSnapshotParametersFn)dlsym(RTLD_DEFAULT, "XCTDefaultSnapshotParameters");
|
|
150
|
+
_attributeNumbersForNames = (AttributeNumbersForNamesFn)dlsym(
|
|
151
|
+
RTLD_DEFAULT, "XCAXAccessibilityAttributesForStringAttributes");
|
|
152
|
+
_valueGetType = (AXValueGetTypeFn)dlsym(RTLD_DEFAULT, "AXValueGetType");
|
|
153
|
+
_valueGetValue = (AXValueGetValueFn)dlsym(RTLD_DEFAULT, "AXValueGetValue");
|
|
154
|
+
_automationEnabled = (AutomationEnabledFn)dlsym(RTLD_DEFAULT, "_AXSAutomationEnabled");
|
|
155
|
+
if (!_defaultSnapshotParameters || !_attributeNumbersForNames || !_valueGetType || !_valueGetValue) {
|
|
156
|
+
if (error) *error = @"AX snapshot conversion functions are unavailable";
|
|
157
|
+
return nil;
|
|
158
|
+
}
|
|
159
|
+
return self;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
- (BOOL)assertAutomationMode:(BOOL)wanted
|
|
163
|
+
{
|
|
164
|
+
Class settingsClass = NSClassFromString(@"AXSettings");
|
|
165
|
+
SEL sharedInstance = NSSelectorFromString(@"sharedInstance");
|
|
166
|
+
SEL setter = NSSelectorFromString(@"setAutomationEnabled:");
|
|
167
|
+
if (settingsClass && [settingsClass respondsToSelector:sharedInstance]) {
|
|
168
|
+
id settings = ((id (*)(id, SEL))objc_msgSend)(settingsClass, sharedInstance);
|
|
169
|
+
if ([settings respondsToSelector:setter]) {
|
|
170
|
+
((void (*)(id, SEL, BOOL))objc_msgSend)(settings, setter, wanted);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return _automationEnabled != NULL && _automationEnabled();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
- (BOOL)isPrimaryForegroundProcess:(pid_t)pid
|
|
177
|
+
{
|
|
178
|
+
Class<AXForegroundElement> elementClass = (Class<AXForegroundElement>)objc_lookUpClass("AXElement");
|
|
179
|
+
if (![elementClass respondsToSelector:@selector(primaryApp)]) return NO;
|
|
180
|
+
id<AXForegroundElement> application = [elementClass primaryApp];
|
|
181
|
+
return [application respondsToSelector:@selector(pid)] && [application pid] == pid;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
- (nullable id)jsonValue:(id)value name:(NSString *)name
|
|
185
|
+
{
|
|
186
|
+
if (!value || value == [NSNull null]) return nil;
|
|
187
|
+
if ([value isKindOfClass:NSString.class] || [value isKindOfClass:NSNumber.class]) return value;
|
|
188
|
+
|
|
189
|
+
const void *raw = (__bridge const void *)value;
|
|
190
|
+
if (_valueGetType(raw) == 3) {
|
|
191
|
+
CGRect rect = CGRectZero;
|
|
192
|
+
if (_valueGetValue(raw, 3, &rect)) return rectDictionary(rect);
|
|
193
|
+
}
|
|
194
|
+
if ([name isEqualToString:kAttributeFrame]) return nil;
|
|
195
|
+
return nil;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
- (nullable NSDictionary *)nodeFromSnapshot:(id)snapshot
|
|
199
|
+
namesByNumber:(NSDictionary<NSNumber *, NSString *> *)namesByNumber
|
|
200
|
+
depth:(NSUInteger)depth
|
|
201
|
+
maxDepth:(NSUInteger)maxDepth
|
|
202
|
+
maxNodes:(NSUInteger)maxNodes
|
|
203
|
+
count:(NSUInteger *)count
|
|
204
|
+
truncated:(BOOL *)truncated
|
|
205
|
+
malformed:(BOOL *)malformed
|
|
206
|
+
{
|
|
207
|
+
if (![snapshot isKindOfClass:NSDictionary.class]) {
|
|
208
|
+
*malformed = YES;
|
|
209
|
+
return nil;
|
|
210
|
+
}
|
|
211
|
+
if (*count >= maxNodes) {
|
|
212
|
+
*truncated = YES;
|
|
213
|
+
return nil;
|
|
214
|
+
}
|
|
215
|
+
(*count)++;
|
|
216
|
+
|
|
217
|
+
NSDictionary *attributes = ((NSDictionary *)snapshot)[kSnapshotAttributes];
|
|
218
|
+
if (![attributes isKindOfClass:NSDictionary.class]) {
|
|
219
|
+
*malformed = YES;
|
|
220
|
+
return nil;
|
|
221
|
+
}
|
|
222
|
+
NSMutableDictionary *node = [NSMutableDictionary dictionary];
|
|
223
|
+
for (NSNumber *number in attributes) {
|
|
224
|
+
NSString *name = namesByNumber[number];
|
|
225
|
+
if (!name || [name isEqualToString:kAttributeChildren]) continue;
|
|
226
|
+
id safe = [self jsonValue:attributes[number] name:name];
|
|
227
|
+
if (safe) node[name] = safe;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
NSArray *children = ((NSDictionary *)snapshot)[kSnapshotChildren];
|
|
231
|
+
if (![children isKindOfClass:NSArray.class]) {
|
|
232
|
+
*malformed = YES;
|
|
233
|
+
return nil;
|
|
234
|
+
}
|
|
235
|
+
NSMutableArray *builtChildren = [NSMutableArray array];
|
|
236
|
+
if (depth >= maxDepth) {
|
|
237
|
+
if (children.count > 0) *truncated = YES;
|
|
238
|
+
} else {
|
|
239
|
+
for (id child in children) {
|
|
240
|
+
NSDictionary *built = [self nodeFromSnapshot:child
|
|
241
|
+
namesByNumber:namesByNumber
|
|
242
|
+
depth:depth + 1
|
|
243
|
+
maxDepth:maxDepth
|
|
244
|
+
maxNodes:maxNodes
|
|
245
|
+
count:count
|
|
246
|
+
truncated:truncated
|
|
247
|
+
malformed:malformed];
|
|
248
|
+
if (built) [builtChildren addObject:built];
|
|
249
|
+
if (*malformed) return nil;
|
|
250
|
+
if (*truncated) break;
|
|
251
|
+
if (*count >= maxNodes) {
|
|
252
|
+
if (builtChildren.count < children.count) *truncated = YES;
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
node[kAttributeChildren] = builtChildren;
|
|
258
|
+
return node;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
- (nullable NSDictionary *)snapshotForProcess:(pid_t)pid
|
|
262
|
+
maxDepth:(NSUInteger)maxDepth
|
|
263
|
+
maxNodes:(NSUInteger)maxNodes
|
|
264
|
+
requestId:(NSString *)requestId
|
|
265
|
+
generation:(NSString *)generation
|
|
266
|
+
maxDurationMs:(NSUInteger)maxDurationMs
|
|
267
|
+
error:(NSDictionary *_Nullable *_Nonnull)error
|
|
268
|
+
{
|
|
269
|
+
SnapshotWatchdogState *watchdogState = [SnapshotWatchdogState new];
|
|
270
|
+
dispatch_source_t watchdog = startRequestWatchdog(maxDurationMs, watchdogState);
|
|
271
|
+
XCAccessibilityElement *root = [_elementClass elementWithProcessIdentifier:pid];
|
|
272
|
+
if (!root) {
|
|
273
|
+
if (error) *error = failureResponse(requestId, @"application_unavailable", @"application-element-missing", @"application element is unavailable");
|
|
274
|
+
finishRequestWatchdog(watchdog, watchdogState);
|
|
275
|
+
return nil;
|
|
276
|
+
}
|
|
277
|
+
void *raw = [root AXUIElement];
|
|
278
|
+
if (!raw) {
|
|
279
|
+
if (error) *error = failureResponse(requestId, @"application_unavailable", @"application-element-missing", @"application element is unavailable");
|
|
280
|
+
finishRequestWatchdog(watchdog, watchdogState);
|
|
281
|
+
return nil;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
NSArray<NSString *> *names = @[
|
|
285
|
+
kAttributeElementType,
|
|
286
|
+
kAttributeElementBaseType,
|
|
287
|
+
kAttributeLabel,
|
|
288
|
+
kAttributeValue,
|
|
289
|
+
kAttributeIdentifier,
|
|
290
|
+
kAttributeFrame,
|
|
291
|
+
kAttributeAutomationType,
|
|
292
|
+
kAttributeChildren,
|
|
293
|
+
];
|
|
294
|
+
NSArray<NSNumber *> *numbers = _attributeNumbersForNames(names);
|
|
295
|
+
if (![numbers isKindOfClass:NSArray.class] || numbers.count != names.count) {
|
|
296
|
+
if (error) *error = failureResponse(requestId, @"reader_unavailable", @"attribute-vocabulary-mismatch", @"AX attribute vocabulary is incompatible");
|
|
297
|
+
finishRequestWatchdog(watchdog, watchdogState);
|
|
298
|
+
return nil;
|
|
299
|
+
}
|
|
300
|
+
NSMutableDictionary<NSNumber *, NSString *> *namesByNumber = [NSMutableDictionary dictionary];
|
|
301
|
+
[numbers enumerateObjectsUsingBlock:^(NSNumber *number, NSUInteger index, BOOL *stop) {
|
|
302
|
+
(void)stop;
|
|
303
|
+
if ([number isKindOfClass:NSNumber.class]) namesByNumber[number] = names[index];
|
|
304
|
+
}];
|
|
305
|
+
NSMutableDictionary *options = [_defaultSnapshotParameters() mutableCopy];
|
|
306
|
+
if (!options) options = [NSMutableDictionary dictionary];
|
|
307
|
+
options[@"attributes"] = numbers;
|
|
308
|
+
options[@"maxDepth"] = @(maxDepth);
|
|
309
|
+
options[@"maxChildren"] = @(maxNodes);
|
|
310
|
+
options[@"maxArrayCount"] = @(maxNodes);
|
|
311
|
+
BOOL automationEnabled = [self assertAutomationMode:YES];
|
|
312
|
+
NSError *runtimeError = nil;
|
|
313
|
+
id snapshot = nil;
|
|
314
|
+
@try {
|
|
315
|
+
if (![self isPrimaryForegroundProcess:pid]) {
|
|
316
|
+
if (error) *error = failureResponse(requestId, @"unsupported", @"foreground-owner-unverified", @"target app is not the primary foreground accessibility owner");
|
|
317
|
+
finishRequestWatchdog(watchdog, watchdogState);
|
|
318
|
+
return nil;
|
|
319
|
+
}
|
|
320
|
+
snapshot = [_framework userTestingSnapshotForElement:(__bridge id)raw options:options error:&runtimeError];
|
|
321
|
+
if (![self isPrimaryForegroundProcess:pid]) {
|
|
322
|
+
if (error) *error = failureResponse(requestId, @"unsupported", @"foreground-owner-changed", @"foreground accessibility ownership changed during acquisition");
|
|
323
|
+
finishRequestWatchdog(watchdog, watchdogState);
|
|
324
|
+
return nil;
|
|
325
|
+
}
|
|
326
|
+
} @catch (NSException *exception) {
|
|
327
|
+
if (error) *error = failureResponse(requestId, @"reader_unavailable", @"private-api-exception", exception.reason ?: @"AX snapshot raised an exception");
|
|
328
|
+
finishRequestWatchdog(watchdog, watchdogState);
|
|
329
|
+
return nil;
|
|
330
|
+
}
|
|
331
|
+
if (!snapshot) {
|
|
332
|
+
NSNumber *axError = runtimeError.userInfo[kAccessibilityErrorKey];
|
|
333
|
+
NSInteger code = [axError respondsToSelector:@selector(integerValue)] ? axError.integerValue : runtimeError.code;
|
|
334
|
+
NSString *kind = code == -25216 ? @"application_not_responding" : @"application_unavailable";
|
|
335
|
+
NSString *message = runtimeError.localizedDescription ?: @"AX snapshot returned no tree";
|
|
336
|
+
if (error) *error = failureResponse(requestId, kind, code == -25216 ? @"application-timeout" : @"application-server-unavailable", message);
|
|
337
|
+
finishRequestWatchdog(watchdog, watchdogState);
|
|
338
|
+
return nil;
|
|
339
|
+
}
|
|
340
|
+
BOOL truncated = NO;
|
|
341
|
+
BOOL malformed = NO;
|
|
342
|
+
NSUInteger count = 0;
|
|
343
|
+
NSDictionary *tree = [self nodeFromSnapshot:snapshot
|
|
344
|
+
namesByNumber:namesByNumber
|
|
345
|
+
depth:0
|
|
346
|
+
maxDepth:maxDepth
|
|
347
|
+
maxNodes:maxNodes
|
|
348
|
+
count:&count
|
|
349
|
+
truncated:&truncated
|
|
350
|
+
malformed:&malformed];
|
|
351
|
+
if (!tree) {
|
|
352
|
+
if (error) *error = failureResponse(requestId, @"malformed_tree", malformed ? @"snapshot-tree-malformed" : @"snapshot-root-invalid", malformed ? @"AX snapshot contained a malformed node" : @"AX snapshot did not contain a materialized root node");
|
|
353
|
+
finishRequestWatchdog(watchdog, watchdogState);
|
|
354
|
+
return nil;
|
|
355
|
+
}
|
|
356
|
+
finishRequestWatchdog(watchdog, watchdogState);
|
|
357
|
+
return @{
|
|
358
|
+
kProtocolVersionKey : @(kProtocolVersion),
|
|
359
|
+
kSourceVersionKey : kSourceVersion,
|
|
360
|
+
kRequestIdKey : requestId ?: @"",
|
|
361
|
+
@"generation" : generation ?: @"",
|
|
362
|
+
@"ok" : @YES,
|
|
363
|
+
@"pid" : @(pid),
|
|
364
|
+
@"tree" : tree,
|
|
365
|
+
@"truncated" : @(truncated),
|
|
366
|
+
@"automationEnabled" : @(automationEnabled),
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
@end
|
|
370
|
+
BridgeRuntime *sharedRuntime(NSString **error)
|
|
371
|
+
{
|
|
372
|
+
static BridgeRuntime *runtime;
|
|
373
|
+
static dispatch_once_t once;
|
|
374
|
+
static NSString *setupError;
|
|
375
|
+
dispatch_once(&once, ^{
|
|
376
|
+
NSString *localError = nil;
|
|
377
|
+
runtime = [[BridgeRuntime alloc] initWithError:&localError];
|
|
378
|
+
setupError = [localError copy];
|
|
379
|
+
});
|
|
380
|
+
if (!runtime && error) *error = setupError ?: @"AX bridge runtime is unavailable";
|
|
381
|
+
return runtime;
|
|
382
|
+
}
|
|
@@ -58,10 +58,62 @@ int main(int argc, const char *argv[]) {
|
|
|
58
58
|
#import <UIKit/UIKit.h>
|
|
59
59
|
|
|
60
60
|
@interface AgentDeviceRunnerViewController : UIViewController
|
|
61
|
+
@property(nonatomic, strong) UILabel *alertActionStatus;
|
|
62
|
+
@property(nonatomic, assign) NSUInteger firstAlertActions;
|
|
63
|
+
@property(nonatomic, assign) NSUInteger replacementAlertActions;
|
|
64
|
+
@property(nonatomic, assign) BOOL alertFixtureStarted;
|
|
61
65
|
@end
|
|
62
66
|
|
|
63
67
|
@implementation AgentDeviceRunnerViewController
|
|
64
68
|
|
|
69
|
+
#if TARGET_OS_IOS
|
|
70
|
+
- (void)updateAlertActionStatus {
|
|
71
|
+
self.alertActionStatus.text = [NSString stringWithFormat:@"First actions: %lu; replacement actions: %lu",
|
|
72
|
+
(unsigned long)self.firstAlertActions,
|
|
73
|
+
(unsigned long)self.replacementAlertActions];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
- (void)presentAlertFixtureReplacement:(BOOL)replacement {
|
|
77
|
+
NSArray<NSString *> *arguments = NSProcessInfo.processInfo.arguments;
|
|
78
|
+
BOOL sameTitle = [arguments containsObject:@"--agent-device-alert-same-title"];
|
|
79
|
+
BOOL sameBody = [arguments containsObject:@"--agent-device-alert-same-body"];
|
|
80
|
+
NSString *title = replacement && !sameTitle ? @"Next confirmation" : @"First confirmation";
|
|
81
|
+
NSString *body = replacement && !sameBody ? @"Second request" : @"First request";
|
|
82
|
+
UIAlertController *alert = [UIAlertController alertControllerWithTitle:title
|
|
83
|
+
message:body
|
|
84
|
+
preferredStyle:UIAlertControllerStyleAlert];
|
|
85
|
+
__weak UIAlertController *weakAlert = alert;
|
|
86
|
+
for (NSString *buttonTitle in @[@"Cancel", @"OK"]) {
|
|
87
|
+
UIAlertActionStyle style = [buttonTitle isEqualToString:@"Cancel"]
|
|
88
|
+
? UIAlertActionStyleCancel : UIAlertActionStyleDefault;
|
|
89
|
+
[alert addAction:[UIAlertAction actionWithTitle:buttonTitle style:style handler:^(UIAlertAction *action) {
|
|
90
|
+
(void)action;
|
|
91
|
+
if (replacement) {
|
|
92
|
+
self.replacementAlertActions += 1;
|
|
93
|
+
} else {
|
|
94
|
+
self.firstAlertActions += 1;
|
|
95
|
+
}
|
|
96
|
+
[self updateAlertActionStatus];
|
|
97
|
+
if (!replacement) {
|
|
98
|
+
[weakAlert dismissViewControllerAnimated:NO completion:^{
|
|
99
|
+
[self presentAlertFixtureReplacement:YES];
|
|
100
|
+
}];
|
|
101
|
+
}
|
|
102
|
+
}]];
|
|
103
|
+
}
|
|
104
|
+
[self presentViewController:alert animated:NO completion:nil];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
- (void)viewDidAppear:(BOOL)animated {
|
|
108
|
+
[super viewDidAppear:animated];
|
|
109
|
+
if (!self.alertFixtureStarted &&
|
|
110
|
+
[NSProcessInfo.processInfo.arguments containsObject:@"--agent-device-alert-replacement-regression"]) {
|
|
111
|
+
self.alertFixtureStarted = YES;
|
|
112
|
+
[self presentAlertFixtureReplacement:NO];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
#endif
|
|
116
|
+
|
|
65
117
|
- (void)agentDeviceTextEntryDidChange:(UITextField *)textField {
|
|
66
118
|
if ([NSProcessInfo.processInfo.arguments containsObject:@"--agent-device-text-entry-disappear-after-input"] &&
|
|
67
119
|
textField.text.length > 0) {
|
|
@@ -88,6 +140,12 @@ int main(int argc, const char *argv[]) {
|
|
|
88
140
|
|
|
89
141
|
// Keep the fixture behind a launch argument so normal runner snapshots remain unchanged.
|
|
90
142
|
#if TARGET_OS_IOS
|
|
143
|
+
if ([NSProcessInfo.processInfo.arguments containsObject:@"--agent-device-alert-replacement-regression"]) {
|
|
144
|
+
self.alertActionStatus = label;
|
|
145
|
+
label.accessibilityIdentifier = @"agent-device-alert-actions";
|
|
146
|
+
[self updateAlertActionStatus];
|
|
147
|
+
}
|
|
148
|
+
|
|
91
149
|
if ([NSProcessInfo.processInfo.arguments containsObject:@"--agent-device-text-entry-regression"]) {
|
|
92
150
|
UITextField *textField = [[UITextField alloc] init];
|
|
93
151
|
textField.accessibilityIdentifier = @"agent-device-hardware-keyboard-input";
|
|
@@ -113,6 +113,7 @@
|
|
|
113
113
|
);
|
|
114
114
|
name = AgentDeviceRunnerUITests;
|
|
115
115
|
packageProductDependencies = (
|
|
116
|
+
A1B2C3D4E5F60718293A4B5D /* AgentDeviceSnapshotPresentation */,
|
|
116
117
|
);
|
|
117
118
|
productName = AgentDeviceRunnerUITests;
|
|
118
119
|
productReference = 20EA2EDD2F2CFC7C001CF0EF /* AgentDeviceRunnerUITests.xctest */;
|
|
@@ -146,6 +147,9 @@
|
|
|
146
147
|
);
|
|
147
148
|
mainGroup = 20EA2EBD2F2CFC7B001CF0EF;
|
|
148
149
|
minimizedProjectReferenceProxies = 1;
|
|
150
|
+
packageReferences = (
|
|
151
|
+
A1B2C3D4E5F60718293A4B5C /* XCLocalSwiftPackageReference "snapshot-presentation" */,
|
|
152
|
+
);
|
|
149
153
|
preferredProjectObjectVersion = 77;
|
|
150
154
|
productRefGroup = 20EA2EC72F2CFC7B001CF0EF /* Products */;
|
|
151
155
|
projectDirPath = "";
|
|
@@ -157,6 +161,21 @@
|
|
|
157
161
|
};
|
|
158
162
|
/* End PBXProject section */
|
|
159
163
|
|
|
164
|
+
/* Begin XCLocalSwiftPackageReference section */
|
|
165
|
+
A1B2C3D4E5F60718293A4B5C /* XCLocalSwiftPackageReference "snapshot-presentation" */ = {
|
|
166
|
+
isa = XCLocalSwiftPackageReference;
|
|
167
|
+
relativePath = ../../snapshot-presentation;
|
|
168
|
+
};
|
|
169
|
+
/* End XCLocalSwiftPackageReference section */
|
|
170
|
+
|
|
171
|
+
/* Begin XCSwiftPackageProductDependency section */
|
|
172
|
+
A1B2C3D4E5F60718293A4B5D /* AgentDeviceSnapshotPresentation */ = {
|
|
173
|
+
isa = XCSwiftPackageProductDependency;
|
|
174
|
+
package = A1B2C3D4E5F60718293A4B5C /* XCLocalSwiftPackageReference "snapshot-presentation" */;
|
|
175
|
+
productName = AgentDeviceSnapshotPresentation;
|
|
176
|
+
};
|
|
177
|
+
/* End XCSwiftPackageProductDependency section */
|
|
178
|
+
|
|
160
179
|
/* Begin PBXResourcesBuildPhase section */
|
|
161
180
|
20EA2EC42F2CFC7B001CF0EF /* Resources */ = {
|
|
162
181
|
isa = PBXResourcesBuildPhase;
|
package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAlertVerification.swift
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
struct RunnerAlertPresentation: Equatable {
|
|
2
|
+
let title: String
|
|
3
|
+
let content: [String]
|
|
4
|
+
let buttons: [String]
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
enum RunnerAlertObservation {
|
|
8
|
+
case visible(RunnerAlertPresentation)
|
|
9
|
+
case absent
|
|
10
|
+
case unavailable
|
|
11
|
+
case deadlineExceeded
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
enum RunnerAlertVerification: Equatable {
|
|
15
|
+
case disappeared
|
|
16
|
+
case presentationChanged
|
|
17
|
+
case stillVisible
|
|
18
|
+
case unconfirmed
|
|
19
|
+
case timedOut
|
|
20
|
+
|
|
21
|
+
static func verify(
|
|
22
|
+
original: RunnerAlertPresentation,
|
|
23
|
+
observation: RunnerAlertObservation
|
|
24
|
+
) -> RunnerAlertVerification {
|
|
25
|
+
switch observation {
|
|
26
|
+
case .visible(let current):
|
|
27
|
+
return original == current ? .stillVisible : .presentationChanged
|
|
28
|
+
case .absent:
|
|
29
|
+
return .disappeared
|
|
30
|
+
case .unavailable:
|
|
31
|
+
return .unconfirmed
|
|
32
|
+
case .deadlineExceeded:
|
|
33
|
+
return .timedOut
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.h
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
NS_ASSUME_NONNULL_BEGIN
|
|
4
4
|
|
|
5
|
+
FOUNDATION_EXPORT NSInteger RunnerContinuousDragFrameCount(double durationMs);
|
|
6
|
+
FOUNDATION_EXPORT NSInteger RunnerControlledScrollFrameCount(double durationMs);
|
|
7
|
+
FOUNDATION_EXPORT double RunnerControlledScrollProgress(double t);
|
|
8
|
+
|
|
5
9
|
@interface RunnerSynthesizedGesture : NSObject
|
|
6
10
|
|
|
7
11
|
+ (NSString * _Nullable)synthesizeSwipeWithApplication:(id)application
|
|
@@ -15,9 +19,16 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
15
19
|
x:(double)x
|
|
16
20
|
y:(double)y
|
|
17
21
|
x2:(double)x2
|
|
18
|
-
|
|
22
|
+
y2:(double)y2
|
|
19
23
|
durationMs:(double)durationMs;
|
|
20
24
|
|
|
25
|
+
+ (NSString * _Nullable)synthesizeControlledScrollWithApplication:(id)application
|
|
26
|
+
x:(double)x
|
|
27
|
+
y:(double)y
|
|
28
|
+
x2:(double)x2
|
|
29
|
+
y2:(double)y2
|
|
30
|
+
durationMs:(double)durationMs;
|
|
31
|
+
|
|
21
32
|
+ (NSString * _Nullable)synthesizeTapWithApplication:(id)application
|
|
22
33
|
x:(double)x
|
|
23
34
|
y:(double)y;
|