agent-device 0.21.12 → 0.21.14
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/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.12.apk → agent-device-android-ime-helper-0.21.14.apk} +0 -0
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.14.apk.sha256 +1 -0
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.12.manifest.json → agent-device-android-ime-helper-0.21.14.manifest.json} +4 -4
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.14.apk +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.14.apk.sha256 +1 -0
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.12.manifest.json → agent-device-android-snapshot-helper-0.21.14.manifest.json} +6 -6
- package/apple/macos-helper/Package.swift +4 -0
- package/apple/macos-helper/Sources/AgentDeviceMacOSHelper/main.swift +3 -6
- package/apple/macos-helper/Tests/AgentDeviceMacOSHelperTests/ScreenshotResponseTests.swift +15 -0
- package/apple/snapshot-bridge/SnapshotBridgeRuntime.m +47 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m +122 -42
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner/Info.plist +23 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.pbxproj +17 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAppScreenCapture.swift +21 -13
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerScrollViewportPolicy.swift +1 -162
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.h +0 -9
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.m +0 -56
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSystemSurfaceHostPolicy.swift +0 -48
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTapPointPolicy.swift +0 -50
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +33 -586
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +40 -24
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AlertObservation.swift +2 -3
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+BlockingSystemModalResolution.swift +0 -36
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandDispatch.swift +630 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +34 -2256
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +1 -338
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Environment.swift +0 -12
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+GestureExecution.swift +160 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +0 -24
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Keyboard.swift +0 -142
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +90 -39
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+MainThreadWork.swift +78 -106
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +23 -2
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +162 -113
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+PrivateAXPresentation.swift +0 -209
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift +86 -10
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollDragExecution.swift +271 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +1 -200
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SequenceExecution.swift +20 -227
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +78 -295
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotAcquisition.swift +40 -27
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotBackendCapabilities.swift +0 -78
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +85 -581
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCaptureTarget.swift +106 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotExecution.swift +142 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotTiming.swift +49 -78
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedCommitDeadline.swift +0 -44
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedGesturePolicy.swift +73 -114
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedInteraction.swift +1 -12
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedTextEntry.swift +11 -94
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +2 -10
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +1 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryFocus.swift +0 -35
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextInputCandidatePolicy.swift +0 -31
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextTyping.swift +2 -18
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Transport.swift +34 -52
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TvRemote.swift +0 -22
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TypeExecution.swift +135 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +22 -6
- package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/recording-overlay.swift +140 -20
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotCoordinateSpace.swift +16 -19
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotGeometry.swift +21 -9
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotModels.swift +59 -10
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentationInvariant.swift +12 -10
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotVisibilityFold.swift +13 -8
- package/dist/src/absence-observation-errors.js +1 -1
- package/dist/src/adapter.js +1 -1
- package/dist/src/adb-executor.js +1 -1
- package/dist/src/adb-failure.js +1 -1
- package/dist/src/adb-transport.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/ai-sdk.js +1 -1
- package/dist/src/alert-runtime.js +1 -1
- package/dist/src/android-adb.d.ts +1 -1
- package/dist/src/app-catalog.js +1 -1
- package/dist/src/app-deployment-resolution.js +1 -1
- package/dist/src/app-inventory.js +1 -1
- package/dist/src/app-launch.js +2 -2
- package/dist/src/app-lifecycle.js +1 -1
- package/dist/src/app-lifecycle2.js +1 -1
- package/dist/src/app-log-files.js +1 -1
- package/dist/src/app-log-runtime2.js +3 -3
- package/dist/src/app-resolution.js +2 -2
- package/dist/src/apple-runner-platform.js +1 -1
- package/dist/src/application-lifecycle-interaction.js +1 -1
- package/dist/src/archive.js +1 -1
- package/dist/src/artifact-download.js +1 -1
- package/dist/src/auth-session.js +1 -1
- package/dist/src/auth.js +1 -1
- 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/capture-disclosure.js +1 -1
- package/dist/src/capture.js +1 -1
- package/dist/src/cli-config.js +1 -1
- package/dist/src/cli-help.js +8 -7
- package/dist/src/cli-runner.js +1 -1
- package/dist/src/cli.js +4 -4
- package/dist/src/click-button.js +1 -1
- package/dist/src/client-metro.js +1 -1
- package/dist/src/client-types.d.ts +4 -5
- package/dist/src/clipboard-shell-response.js +1 -1
- package/dist/src/code-signature.js +1 -1
- package/dist/src/command-schema.js +3 -3
- package/dist/src/command-tools.js +3 -3
- package/dist/src/connection-runtime.js +1 -1
- package/dist/src/connection.js +1 -1
- package/dist/src/contracts.js +1 -1
- package/dist/src/daemon-client-lifecycle.js +1 -1
- package/dist/src/daemon-resolution.js +1 -1
- package/dist/src/daemon.js +1 -1
- package/dist/src/debug-symbols-facade.js +1 -1
- package/dist/src/device-claim-rule.js +2 -2
- package/dist/src/device-input-state.d.ts +1 -1
- package/dist/src/device-inventory-context.js +1 -1
- package/dist/src/device-rotation.js +1 -1
- package/dist/src/device-selection-resolver.js +1 -1
- package/dist/src/device-session.js +1 -1
- package/dist/src/device-shell.js +1 -1
- package/dist/src/device2.js +1 -1
- package/dist/src/devicectl.js +1 -1
- package/dist/src/diagnostics.js +1 -1
- package/dist/src/dispatch-resolve.js +1 -1
- package/dist/src/display-inventory.js +1 -1
- package/dist/src/doctor-facade.js +1 -1
- package/dist/src/doctor2.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/file.js +1 -1
- package/dist/src/find.js +1 -1
- package/dist/src/format.js +1 -1
- package/dist/src/gesture-plan-types.d.ts +38 -0
- 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/helper.js +2 -2
- package/dist/src/host.js +1 -1
- package/dist/src/human-control-contract.js +1 -1
- package/dist/src/human-control.js +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/input-actions.js +1 -1
- package/dist/src/input-actions2.js +1 -1
- package/dist/src/install-artifact-facade.js +1 -1
- package/dist/src/install-source-network-transport.js +1 -1
- package/dist/src/install-source2.js +1 -1
- package/dist/src/interaction-positionals.js +1 -1
- package/dist/src/interaction-ref-policy.js +1 -1
- package/dist/src/interaction2.js +1 -1
- package/dist/src/interactor-operation-binding.js +1 -1
- package/dist/src/interactor-operation-catalog.js +1 -1
- package/dist/src/interactor.js +4 -4
- 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 +2 -2
- package/dist/src/internal/png-worker.js +1 -1
- package/dist/src/internal/run-script-http-child.js +1 -1
- package/dist/src/inventory.js +1 -1
- package/dist/src/inventory2.js +1 -1
- package/dist/src/inventory3.js +1 -1
- package/dist/src/inventory5.js +1 -1
- package/dist/src/ios-snapshot-acquisition.js +1 -1
- package/dist/src/ios-snapshot-runtime.js +1 -1
- package/dist/src/lease.js +1 -1
- package/dist/src/limrun-download-file.js +1 -1
- package/dist/src/limrun-runtime-dependencies.js +1 -1
- package/dist/src/limrun.d.ts +435 -4
- package/dist/src/linux.js +1 -1
- package/dist/src/local-interactor-operation-set.js +1 -1
- package/dist/src/location-coordinates.js +1 -1
- package/dist/src/managed-device-scope.js +1 -1
- package/dist/src/mechanics.js +5 -5
- package/dist/src/mobile-snapshot-semantics.js +1 -1
- package/dist/src/multitouch-support.js +1 -1
- package/dist/src/native-build-cache.js +1 -0
- package/dist/src/observation.js +1 -1
- package/dist/src/parameterized-recorded-fill.js +1 -1
- package/dist/src/perf-facade.js +1 -2
- package/dist/src/perf-runtime-operation-builder.js +1 -1
- package/dist/src/perf-runtime-plan.js +1 -1
- package/dist/src/perf-target.js +2 -0
- package/dist/src/perf.js +1 -1
- package/dist/src/physical-device-apps.js +1 -0
- package/dist/src/physical-device-control.js +1 -1
- package/dist/src/platform-request-scope.js +1 -1
- package/dist/src/platform-runtime-host.js +1 -1
- package/dist/src/platform-runtime-managed-owner.js +1 -1
- package/dist/src/platform-runtime-open-target.js +1 -1
- package/dist/src/platform-runtime-operation-host.js +2 -2
- package/dist/src/platform-runtime-runtime-hints.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-process-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/png-crop-bytes.js +1 -1
- package/dist/src/png-size.js +1 -1
- package/dist/src/png-worker-client.js +1 -1
- package/dist/src/png.js +1 -1
- package/dist/src/prepare-kind.js +1 -1
- package/dist/src/provider-session-ownership.js +1 -1
- package/dist/src/provider-webdriver.js +1 -1
- package/dist/src/proxy.js +1 -1
- package/dist/src/quality-warnings.js +1 -1
- package/dist/src/react-native.js +1 -1
- package/dist/src/record-runtime.js +1 -1
- package/dist/src/recording.js +1 -1
- package/dist/src/register-builtins.js +1 -1
- package/dist/src/registry.js +35 -35
- package/dist/src/remote-config2.js +1 -1
- package/dist/src/replay-divergence.js +1 -1
- package/dist/src/replay.js +1 -1
- package/dist/src/reporting.js +1 -1
- package/dist/src/request-admission.js +1 -1
- package/dist/src/request-cancel.js +1 -1
- package/dist/src/request-runtime-binding.js +1 -1
- package/dist/src/retry.js +1 -1
- package/dist/src/runner-cache-metadata.js +1 -1
- 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-disposal.js +1 -1
- package/dist/src/runner-error-classification.js +3 -0
- package/dist/src/runner-operations-facade.js +1 -1
- package/dist/src/runner-presentation.js +1 -1
- package/dist/src/runner.js +1 -1
- package/dist/src/runtime-transport-hints.js +1 -1
- package/dist/src/runtime.js +3 -3
- package/dist/src/runtime10.js +2 -2
- package/dist/src/runtime2.js +2 -2
- package/dist/src/runtime3.js +1 -1
- package/dist/src/runtime4.js +4 -4
- 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-admission-ledger.js +1 -1
- package/dist/src/screen-recording-completion.js +1 -1
- package/dist/src/screen-recording-options.js +1 -1
- package/dist/src/screen-recording-resource-recovery.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/screenshot.js +1 -1
- package/dist/src/screenshot3.js +1 -1
- package/dist/src/script.js +1 -1
- package/dist/src/scroll-command.d.ts +377 -0
- package/dist/src/scroll-command.js +1 -1
- package/dist/src/scroll-gesture.js +1 -1
- package/dist/src/sdk-batch-runner.js +2 -2
- package/dist/src/sdk-batch.js +2 -2
- package/dist/src/sdk-contracts.d.ts +28 -0
- package/dist/src/sdk-contracts.js +1 -1
- package/dist/src/sdk-device.js +1 -1
- package/dist/src/sdk-io.js +1 -1
- package/dist/src/sdk-remote-config.js +1 -1
- package/dist/src/sdk-selectors.d.ts +23 -726
- package/dist/src/selection.js +0 -0
- package/dist/src/selector-runtime.js +1 -1
- package/dist/src/semantic-index.js +1 -1
- package/dist/src/server.js +1 -1
- package/dist/src/session-allocation.js +1 -1
- package/dist/src/session-observation.js +1 -1
- package/dist/src/session-routing.js +1 -1
- package/dist/src/session-runtime-admission.js +1 -1
- package/dist/src/session-snapshot.js +1 -1
- package/dist/src/session-store.js +2 -2
- package/dist/src/session2.js +3 -3
- package/dist/src/settings.js +1 -1
- package/dist/src/simctl-facade.js +1 -1
- package/dist/src/simctl.js +1 -1
- package/dist/src/simulator-state.js +1 -1
- package/dist/src/simulator.js +1 -1
- 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/snapshot2.js +1 -1
- package/dist/src/snapshot3.js +1 -1
- package/dist/src/snapshot4.js +1 -1
- package/dist/src/src.js +1 -1
- package/dist/src/src7.js +1 -1
- package/dist/src/src8.js +2 -2
- package/dist/src/string-enum.js +1 -1
- package/dist/src/takeover.js +1 -1
- package/dist/src/text-entry-focus.js +1 -1
- package/dist/src/tool-provider-facade.js +1 -1
- package/dist/src/tool-provider.js +2 -2
- package/dist/src/tool-provider2.js +1 -1
- package/dist/src/touch-runtime.js +1 -1
- package/dist/src/transport.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/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 +1 -1
- package/dist/src/viewport.js +1 -1
- package/dist/src/web.js +1 -1
- package/dist/src/web2.js +1 -1
- package/dist/src/webdriver-source.js +1 -1
- package/package.json +3 -2
- package/server.json +2 -2
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.12.apk.sha256 +0 -1
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.12.apk +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.12.apk.sha256 +0 -1
- package/dist/src/app-inventory.d.ts +0 -4
- package/dist/src/apps-simctl.js +0 -1
- package/dist/src/cloud-artifacts.d.ts +0 -61
- package/dist/src/runner-contract.js +0 -3
- package/dist/src/snapshot-process.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O as e}from"./sdk-contracts.js";import{a as t,c as n,h as r,t as i}from"./exec.js";import"./command.js";import{t as a}from"./scoped-provider.js";import{f as o,u as s}from"./host-file.js";import c from"node:path";function l(e,t){return t===`user-installed`?e.filter(e=>!e.bundleId.startsWith(`com.apple.`)):e}function u(n,r){return{openBundle:async(e,t)=>{await n(`open`,d(e,t))},openTarget:async e=>{await n(`open`,[e])},readClipboard:async()=>t(await n(`pbpaste`,[],{allowFailure:!0}),`Failed to read macOS clipboard`).stdout.replaceAll(`\r
|
|
2
2
|
`,`
|
|
3
3
|
`).replace(/\n$/,``),writeClipboard:async e=>{t(await n(`pbcopy`,[],{allowFailure:!0,stdin:e}),`Failed to write macOS clipboard`)},readDarkMode:async()=>{let r=t(await n(`osascript`,[`-e`,`tell application "System Events" to tell appearance preferences to get dark mode`],{allowFailure:!0}),`Failed to read macOS appearance`),i=r.stdout.trim().toLowerCase();if(i===`true`)return!0;if(i===`false`)return!1;throw new e(`COMMAND_FAILED`,`Unable to determine current macOS appearance from osascript output: ${r.stdout.trim()}`)},setDarkMode:async e=>{t(await n(`osascript`,[`-e`,`tell application "System Events" to tell appearance preferences to set dark mode to ${e?`true`:`false`}`],{allowFailure:!0}),`Failed to set macOS appearance`)},listApps:async e=>await f(n,r,e)}}function d(e,t){let n=[`-b`,e];return t&&n.push(t),n}async function f(e,t,n){let r=[`/Applications`,`/System/Applications`,c.join(o(),`Applications`)],i=new Set;for(let t of r){if(!(await s(t).catch(()=>null))?.isDirectory())continue;let n=await e(`find`,[t,`-maxdepth`,`4`,`-type`,`d`,`-name`,`*.app`],{allowFailure:!0});if(n.exitCode===0)for(let e of n.stdout.split(`
|
|
4
|
-
`)){let t=e.trim();t&&i.add(t)}}return l((await Promise.all(Array.from(i).map(async e=>{let n=await p(e,t).catch(()=>({})),r=n.bundleId;return r?{bundleId:r,name:n.appName??c.basename(e,`.app`)}:null}))).filter(e=>e!==null).sort((e,t)=>e.name.localeCompare(t.name)),n)}async function p(e,t){for(let n of[c.join(e,`Contents`,`Info.plist`),c.join(e,`Info.plist`)]){let e=await t(n),r=m(e,`CFBundleIdentifier`),i=m(e,`CFBundleDisplayName`),a=m(e,`CFBundleName`);if(r||i||a)return{bundleId:r,appName:i??a}}return{}}function m(e,t){let n=e?.[t];return typeof n==`string`&&n.trim()?n.trim():void 0}const
|
|
4
|
+
`)){let t=e.trim();t&&i.add(t)}}return l((await Promise.all(Array.from(i).map(async e=>{let n=await p(e,t).catch(()=>({})),r=n.bundleId;return r?{bundleId:r,name:n.appName??c.basename(e,`.app`)}:null}))).filter(e=>e!==null).sort((e,t)=>e.name.localeCompare(t.name)),n)}async function p(e,t){for(let n of[c.join(e,`Contents`,`Info.plist`),c.join(e,`Info.plist`)]){let e=await t(n),r=m(e,`CFBundleIdentifier`),i=m(e,`CFBundleDisplayName`),a=m(e,`CFBundleName`);if(r||i||a)return{bundleId:r,appName:i??a}}return{}}function m(e,t){let n=e?.[t];return typeof n==`string`&&n.trim()?n.trim():void 0}function h(e){return Object.freeze([`simctl`,...e])}async function g(e,t,n){return await e(`xcrun`,[...h(t)],n)}function _(e){return Object.freeze(e.slice(1))}const v={runCommand:n,simctl:{run:async(e,t)=>await g(n,e,t)},devicectl:{run:async(e,t)=>await n(`xcrun`,[`devicectl`,...e],t)},plist:{readJson:async(e,t)=>await A(n,e,t)},macosHost:u(n,async e=>await A(n,e)),whichCommand:r},y=a(v,D);function b(e={}){let t={...v,...e},n=e.plist??{readJson:async(e,n)=>await A(t.runCommand,e,n)};return{...t,simctl:e.simctl??{run:async(e,n)=>await g(t.runCommand,e,n)},devicectl:e.devicectl??{run:async(e,n)=>await t.runCommand(`xcrun`,[`devicectl`,...e],n)},plist:n,macosHost:e.macosHost??u(t.runCommand,async e=>await n.readJson(e))}}function x(e){return y.resolve(e)}async function S(e,t){return await y.run(e,t)}function C(){return y.hasScope()}async function w(e,t,n){return await x().runCommand(e,t,n)}async function T(e,t){let n=x();if(e[0]===`simctl`)return await n.simctl.run(_(e),t);let[r,...i]=e;return r===`devicectl`?await n.devicectl.run(i,t):await w(`xcrun`,[...e],t)}async function E(e,t){return await x().plist?.readJson(e,t)??null}function D(e){return b({...e,runCommand:O(e.runCommand),simctl:{run:k(e.simctl.run)},devicectl:{run:k(e.devicectl.run)},...e.macosHelper?{macosHelper:{run:k(e.macosHelper.run)}}:{}})}function O(e){return async(t,n,r)=>i(await e(t,n,r))}function k(e){return async(t,n)=>i(await e(t,n))}async function A(e,t,n){try{let r=await e(`plutil`,[`-convert`,`json`,`-o`,`-`,t],{allowFailure:!0,signal:n});return r.exitCode!==0||!r.stdout.trim()?null:JSON.parse(r.stdout)}catch{return n?.throwIfAborted(),null}}export{w as a,S as c,x as i,l,C as n,T as o,E as r,h as s,b as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime.js";import{O as t}from"./sdk-contracts.js";import{r as n}from"./diagnostics.js";import{c as r}from"./owner-identity.js";import{c as i,h as a}from"./exec.js";import{t as o}from"./timeouts.js";import"./diagnostics2.js";import"./command.js";import"./retry.js";import"./process.js";import{t as s}from"./scoped-provider.js";var c=e({createLocalLinuxToolProvider:()=>d,resolveLinuxToolProvider:()=>f,runLinuxToolCommand:()=>m,withLinuxToolProvider:()=>p});const l={runCommand:i,whichCommand:a,desktop:h(i,a),clipboard:g(i,a),screenshot:_(i,a)},u=s(l,d);function d(e={}){let t={...l,...e};return{...t,desktop:e.desktop??h(t.runCommand,t.whichCommand),clipboard:e.clipboard??g(t.runCommand,t.whichCommand),screenshot:e.screenshot??_(t.runCommand,t.whichCommand)}}function f(e){return u.resolve(e)}async function p(e,t){return await u.run(e,t)}async function m(e,t,n){return await f().runCommand(e,t,n)}function h(e,t){return{async openTarget(r){if(r.includes(`://`)||r.startsWith(`/`)){await e(`xdg-open`,[r]);return}if(await t(r)){e(r,[],{allowFailure:!0}).catch(e=>{n({level:`warn`,phase:`linux_app_launch`,data:{app:r,error:String(e)}})}),await o(500);return}await e(`xdg-open`,[r],{allowFailure:!0})},async closeApp(n){if(await t(`wmctrl`)){await e(`wmctrl`,[`-c`,n],{allowFailure:!0});return}await e(`pkill`,[`-x`,n],{allowFailure:!0})}}}function g(e,t){return{async readText(){let n=await w(t,y),r=x[n];return(await e(r.cmd,r.args,r.options)).stdout},async writeText(n){let r=await w(t,y),i=S[r](n);await e(i.cmd,i.args,i.options)}}}function _(e,t){return{async capture(n){let r=await w(t,b),i=C[r](n);await e(i.cmd,i.args,i.options)}}}const v=5e3,y={wayland:[{tool:`wl-clipboard`,command:`wl-paste`}],x11:[{tool:`xclip`,command:`xclip`},{tool:`xsel`,command:`xsel`}],waylandError:`wl-paste (wl-clipboard) is required for clipboard access on Wayland. Install via your package manager.`,x11Error:`xclip or xsel is required for clipboard access on X11. Install via your package manager.`},b={wayland:[{tool:`grim`,command:`grim`},{tool:`gnome-screenshot`,command:`gnome-screenshot`}],x11:[{tool:`scrot`,command:`scrot`},{tool:`import`,command:`import`},{tool:`gnome-screenshot`,command:`gnome-screenshot`}],waylandError:`grim or gnome-screenshot is required for screenshots on Wayland. Install via your package manager.`,x11Error:`scrot, import (ImageMagick), or gnome-screenshot is required for screenshots on X11. Install via your package manager.`},x={"wl-clipboard":{cmd:`wl-paste`,args:[`--no-newline`],options:{allowFailure:!0,timeoutMs:v}},xclip:{cmd:`xclip`,args:[`-selection`,`clipboard`,`-o`],options:{allowFailure:!0,timeoutMs:v}},xsel:{cmd:`xsel`,args:[`--clipboard`,`--output`],options:{allowFailure:!0,timeoutMs:v}}},S={"wl-clipboard":e=>({cmd:`wl-copy`,args:[`--`,e],options:{allowFailure:!1,timeoutMs:v}}),xclip:e=>({cmd:`xclip`,args:[`-selection`,`clipboard`],options:{allowFailure:!1,timeoutMs:v,stdin:e}}),xsel:e=>({cmd:`xsel`,args:[`--clipboard`,`--input`],options:{allowFailure:!1,timeoutMs:v,stdin:e}})},C={grim:e=>({cmd:`grim`,args:[e]}),scrot:e=>({cmd:`scrot`,args:[e]}),import:e=>({cmd:`import`,args:[`-window`,`root`,e]}),"gnome-screenshot":e=>({cmd:`gnome-screenshot`,args:[`-f`,e]})};async function w(e,n){let r=T()?`wayland`:`x11`;for(let t of n[r])if(await e(t.command))return t.tool;throw new t(`TOOL_MISSING`,r===`wayland`?n.waylandError:n.x11Error)}function T(){let e=r();return!!e.WAYLAND_DISPLAY||e.XDG_SESSION_TYPE===`wayland`}export{m as n,c as r,f as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O as e}from"./sdk-contracts.js";import{n as t,r as n}from"./interactor-operation-binding.js";function r(e){let t=t=>t??e.unsupported;return Object.freeze({tapPoint:e.tap,tapRef:t(e.tapRef),longPressPoint:e.longPress,hoverPoint:i(t(e.hover)),hoverRef:i(t(e.hoverRef)),fillPoint:e.fill,fillRef:t(e.fillRef),tapElementSelector:t(e.tapElementSelector)})}function i(e){return e.available?e:Object.freeze({...e,hint:e.hint??`hover raises pointer hover state and is available on web targets only. On touch platforms use longpress for hold gestures.`})}function a(e,t){return{...e.execution,appBundleId:e.appBundleId,signal:t}}function o(t,n,r,i){let o=async e=>(t.throwIfAborted(),await n(a(e,t))),l=async e=>{t.throwIfAborted(),c(e.options,r.longPressPoint);let n=await o(e);return e.options.button!==`primary`&&n.alternateClick?await n.alternateClick(e.point,e.options.button):n.pressPoint?await n.pressPoint(e.point,e.options):await u(n,e.point,e.options,i)},d=async t=>{let n=await o(t);if(!n.hover)throw new e(`UNSUPPORTED_OPERATION`,`Bound runtime advertised hover without an interactor.`);return await n.hover(t.point.x,t.point.y)},f=async e=>await(await o(e)).fill(e.point.x,e.point.y,e.text,e.delayMs,{allowNonHittableCoordinateFallback:e.allowNonHittableCoordinateFallback});return Object.freeze({...r.tapPoint.available?{tapPoint:l}:{},...r.tapRef.available?{tapRef:async e=>{let t=await o(e);return t.tapRef?await t.tapRef(e.ref):s(`tapRef`)}}:{},...r.longPressPoint.available?{longPressPoint:async e=>await(await o(e)).longPress(e.point.x,e.point.y,e.durationMs)}:{},...r.hoverPoint.available?{hoverPoint:d}:{},...r.hoverRef.available?{hoverRef:async e=>{let t=await o(e);return t.hoverRef?await t.hoverRef(e.ref):s(`hoverRef`)}}:{},...r.fillPoint.available?{fillPoint:f}:{},...r.fillRef.available?{fillRef:async e=>{let t=await o(e);return t.fillRef?await t.fillRef(e.ref,e.text,e.delayMs):s(`fillRef`)}}:{},...r.tapElementSelector.available?{tapElementSelector:async e=>{let t=await o(e);return t.tapElementSelector?await t.tapElementSelector(e.selector):s(`tapElementSelector`)}}:{}})}function s(t){throw new e(`UNSUPPORTED_OPERATION`,`Bound runtime advertised ${t} without an interactor.`)}function c(t,n){if(!(t.holdMs<=0||n.available))throw new e(`UNSUPPORTED_OPERATION`,`press-and-hold is not supported by this runtime.`,{reason:n.reason,...n.hint===void 0?{}:{hint:n.hint}})}function l(t){if(t.doubleTap)return t.doubleTap;throw new e(`UNSUPPORTED_OPERATION`,`double-tap is not supported by this runtime.`,{reason:`owner-capability-missing`,hint:`This runtime drives single presses; use --count to repeat them.`})}async function u(t,n,r,i){if(r.button!==`primary`)throw new e(`UNSUPPORTED_OPERATION`,`Bound runtime does not implement ${r.button} click.`);let a=r.doubleTap?l(t):void 0,o;for(let e=0;e<r.count;e+=1){let[s,c]=f(e,r.jitterPx),l=a?await a.call(t,n.x+s,n.y+c):r.holdMs>0?await t.longPress(n.x+s,n.y+c,r.holdMs):await t.tap(n.x+s,n.y+c);o??=l,e<r.count-1&&r.intervalMs>0&&await i(r.intervalMs)}return o}const d=[[0,0],[1,0],[0,1],[-1,0],[0,-1],[1,1],[-1,1],[1,-1],[-1,-1]];function f(e,t){if(t<=0)return[0,0];let[n,r]=d[e%d.length];return[n*t,r*t]}function p(e){return o(e.signal,t(e),e.facts,e.pause)}function m(e){return o(e.signal,n({...e,operation:`touch`}),e.facts,e.pause)}export{r as i,m as n,f as r,p as t};
|
package/dist/src/transport.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O as e}from"./sdk-contracts.js";import t from"node:crypto";const n=`/agent-device`,r=`x-agent-device-tenant`,i=`x-agent-device-network-access`,a=`public-only`;function o(e){return s(e,n)}function s(e,t){let n=e.endsWith(`/`)?e:`${e}/`;return new URL(t.replace(/^\/+/,``),n).toString()}function c(e){let t=e?.trim();return t?{authorization:`Bearer ${t}`,"x-agent-device-token":t}:{}}function l(e){let t=e?.trim();return t?{[r]:t}:{}}function u(e,t,n={}){return{ok:!0,service:e,version:t,rpcProtocolVersion:2,...n.upstream===void 0?{}:{upstream:n.upstream}}}function d(e,t){let n=[],r=e+t.toString(),i=r.indexOf(`
|
|
2
2
|
`);for(;i!==-1;){let e=r.slice(0,i).trim();r=r.slice(i+1),e&&n.push(e),i=r.indexOf(`
|
|
3
3
|
`)}return{lines:n,buffer:r}}async function f(e){return e===`https:`?(await import(`node:https`)).default:(await import(`node:http`)).default}function p(e){return new Promise((t,n)=>{let r=``;e.setEncoding(`utf8`),e.on(`data`,e=>{r+=e}),e.on(`end`,()=>t(r)),e.on(`error`,n)})}async function m(t,n,r){let i=[],a=0;for await(let o of t){let t=Buffer.isBuffer(o)?o:Buffer.from(o);if(a+=t.length,a>n)throw new e(`INVALID_ARGS`,r);i.push(t)}return Buffer.concat(i)}function h(e,n){let r=t.createHash(`sha256`).update(e).digest(),i=t.createHash(`sha256`).update(n).digest();return t.timingSafeEqual(r,i)}export{h as a,a as c,c as d,o as f,p as i,r as l,s as m,f as n,n as o,l as p,m as r,i as s,d as t,u};
|
package/dist/src/tree.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ir as e}from"./sdk-batch.js";function t(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}
|
|
1
|
+
import{Ir as e}from"./sdk-batch.js";function t(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 n(e,t){let n=[],r=new Set([e.index]),i=[...t.get(e.index)??[]];for(;i.length>0;){let e=i.pop();if(!e||r.has(e.index))continue;r.add(e.index),n.push(e);let a=t.get(e.index);a&&i.push(...a)}return n}const r=new WeakMap;function i(e,t){if(!e[t])return[];let n=s(e)[t]??t+1;return e.slice(t+1,n)}function a(e,t,n){let r=s(e)[t]??t+1;for(let i=t+1;i<r;i+=1){let t=e[i];if(t&&n(t))return t}}function o(e,t,n){let r=s(e)[t]??t+1;for(let i=t+1;i<r;i+=1){let t=e[i];t&&n(t)}}function s(e){let t=r.get(e);if(t)return t;let n=Array(e.length),i=[];for(let[t,r]of e.entries()){let e=r?.depth??0;for(;i.length>0&&e<=i.at(-1).depth;){let e=i.pop();n[e.position]=t}i.push({depth:e,position:t})}for(let t of i)n[t.position]=e.length;return r.set(e,n),n}function c(e,t){let n=[],r=typeof e.parentIndex==`number`?t.get(e.parentIndex):void 0,i=new Set;for(;r&&!i.has(r.index);)i.add(r.index),n.push(r),r=typeof r.parentIndex==`number`?t.get(r.parentIndex):void 0;return n}function l(e,t,n){for(let r of c(e,t))if(n(r))return r;return null}function u(e,t,n={}){return(n.includeSelf===!0&&m(e.type)?e:null)??l(e,t,e=>m(e.type))}function d(t,n){let r=e(t.type??``),i=t.label?.trim();return!!(p(t)||r===`other`&&!i&&!t.value||(r===`other`||r===`statictext`)&&i&&n.includes(i)||r===`image`)}function f(t){let n=e(t.type??``);return n===`button`||n===`link`||n===`switch`||n===`searchfield`||n===`textfield`}function p(t){return e(t.type??``)===`button`&&t.label?.trim()===`chevron`&&t.enabled===!1}function m(t){let n=e(t??``);return n===`collectionview`||n===`table`||n===`scrollview`||n===`scrollarea`}function h(t,n){let r=t.label?.trim();if(!r||r!==n)return!1;let i=e(t.type??``);return i===`other`||i===`statictext`||i===`link`}function g(e,t,n){e.set(t.index,v(y(e,t),n))}function _(e,t,n){let r=y(e,t);e.set(t.index,v(r,n(r)))}function v(e,t){let n={...e,...t};for(let[e,r]of Object.entries(t))r===void 0&&delete n[e];return n}function y(e,t){return e.get(t.index)??t}function b(t){let n;for(let r of t){let t=e(r.type??``);(t===`application`||t===`window`)&&S(r.rect,n)&&(n=r.rect)}return n}function x(e,t,n=.8){let r=C(e),i=C(t);return r>0&&i>0&&r/i>=n}function S(e,t){return!!(e&&(!t||C(e)>C(t)))}function C(e){return e?e.width*e.height:0}function w(e,t,n){let r=new Map(n.map(e=>[e.index,e])),i=new Map;for(let[t,n]of e.entries())i.set(n.index,t);return e.map((e,n)=>{let a=typeof e.parentIndex==`number`?i.get(e.parentIndex):void 0;return a===void 0&&typeof e.parentIndex==`number`&&(a=T(e.parentIndex,t,r,i)),{...e,index:n,parentIndex:a}})}function T(e,t,n,r){let i=e,a=new Set;for(;typeof i==`number`&&!a.has(i);){if(a.add(i),!t.has(i))return r.get(i);i=n.get(i)?.parentIndex}}export{_,b as a,o as c,h as d,m as f,d as g,w as h,a as i,p as l,g as m,i as n,l as o,f as p,n as r,u as s,t,x as u};
|
package/dist/src/tv-remote.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O as e}from"./sdk-contracts.js";const t={android:`longpress`,apple:`exact`,vega:`exact`},n={up:{aliases:[],androidKeyevent:`KEYCODE_DPAD_UP`,appleRemoteButton:`up`,vegaKey:`KEY_UP`},down:{aliases:[],androidKeyevent:`KEYCODE_DPAD_DOWN`,appleRemoteButton:`down`,vegaKey:`KEY_DOWN`},left:{aliases:[],androidKeyevent:`KEYCODE_DPAD_LEFT`,appleRemoteButton:`left`,vegaKey:`KEY_LEFT`},right:{aliases:[],androidKeyevent:`KEYCODE_DPAD_RIGHT`,appleRemoteButton:`right`,vegaKey:`KEY_RIGHT`},select:{aliases:[`ok`,`center`,`enter`],androidKeyevent:`KEYCODE_DPAD_CENTER`,appleRemoteButton:`select`,vegaKey:`KEY_ENTER`},menu:{aliases:[],androidKeyevent:`KEYCODE_MENU`,appleRemoteButton:`menu`,vegaKey:`KEY_MENU`},home:{aliases:[],androidKeyevent:`KEYCODE_HOME`,appleRemoteButton:`home`,vegaKey:`KEY_HOMEPAGE`},back:{aliases:[],androidKeyevent:`KEYCODE_BACK`,appleRemoteButton:`menu`,vegaKey:`KEY_BACK`}},r=Object.keys(n),i=`<${r.join(`|`)}>`;function a(t){let n=t?.toLowerCase();if(o(n))return n;let i=n?d.get(n):void 0;if(i)return i;throw new e(`INVALID_ARGS`,`tv-remote button must be one of: ${r.join(`, `)}.`)}function o(e){return typeof e==`string`&&r.includes(e)}function s(e){return n[e].appleRemoteButton}function c(e){return n[e].androidKeyevent}function l(e){return n[e].vegaKey}function u(e){return t[e]}const d=new Map(r.flatMap(e=>n[e].aliases.map(t=>[t,e])));export{s as a,c as i,i as n,l as o,a as r,u as s,r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O as e}from"./sdk-contracts.js";import{Kt as t}from"./sdk-batch.js";import{g as n,m as r}from"./session-snapshot.js";import{x as i}from"./runtime.js";import{r as a}from"./success-text.js";function o(e){let t=e?.trim().split(/\s+/,1)[0];if(!t||!t.startsWith(`@`)||t.length<3)return null;let n=t.slice(1);return/^[A-Za-z_-]*\d[\w-]*$/i.test(n)||/^(?:ref|node|element|el)[\w-]*$/i.test(n)?t:null}async function s(e){let r=await n({command:`type`,device:e.device,use:t,inspectFacts:e.inspectFacts,bindDevice:e.bindDevice});if(r.type===`response`)return{ok:!1,response:r.response};let i=r.runtime;return{ok:!0,typeText:async(e,t)=>await c(i,e,t)}}async function c(t,n,r){let s=o(n[0]);if(s)throw new e(`INVALID_ARGS`,`type does not accept a target ref like "${s}"`,{hint:`Use fill ${s} "text" to target that field, or press ${s} then type "text" to append.`});let c=n.join(` `);if(!c)throw new e(`INVALID_ARGS`,`type requires text`);let u=i(r.delayMs??0,`delay-ms`,0,1e4),d=(await t.operations.typeText(l(c,u,r)))?.textEntryRoute;return{...d===void 0?{}:{textEntryRoute:d},text:c,delayMs:u,...a(`Typed ${Array.from(c).length} chars`)}}function l(e,t,n){return{text:e,delayMs:t,...n.appBundleId===void 0?{}:{options:{appBundleId:n.appBundleId}},execution:r(n)}}export{s as n,c as t};
|
package/dist/src/update-check.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e}from"./exec.js";import"./command.js";import t from"node:path";import
|
|
1
|
+
import{u as e}from"./exec.js";import"./command.js";import{n as t}from"./version.js";import n from"node:path";import r from"node:fs";import{fileURLToPath as i}from"node:url";const a=`agent-device`,o=`--agent-device-run-update-check`;function s(e){if(!l(e))return;let t=Date.now(),r=n.join(e.stateDir,`update-check.json`),i=f(r);u(i,e.currentVersion)&&(process.stderr.write(`Update available: ${a} ${e.currentVersion} -> ${i.latestVersion}. Run \`npm install -g ${a}@latest\` to upgrade the CLI.\n`),p(r,{...i,prompted:!0})),d(i,t)&&h(r,e.currentVersion)}async function c(e){let n=Date.now(),r=f(e.cachePath);try{let i=await g()??void 0;if(!i||t(i,e.currentVersion)<=0){p(e.cachePath,{checkedAt:new Date(n).toISOString()});return}p(e.cachePath,{checkedAt:new Date(n).toISOString(),latestVersion:i,prompted:r.latestVersion===i&&r.prompted===!0})}catch{p(e.cachePath,{...r,checkedAt:new Date(n).toISOString()})}}function l(e){return!e.command||e.command===`help`||e.command===`test`||e.flags.help||e.flags.version||e.flags.json||process.env.CI?.trim()||process.env.NODE_ENV===`test`||process.env.AGENT_DEVICE_NO_UPDATE_NOTIFIER?.trim()?!1:!!process.stderr.isTTY}function u(e,n){return!e.latestVersion||t(e.latestVersion,n)<=0?!1:e.prompted!==!0}function d(e,t){let n=_(e.checkedAt);return n===void 0||t-n>=12096e5}function f(e){try{let t=JSON.parse(r.readFileSync(e,`utf8`));return{checkedAt:typeof t.checkedAt==`string`?t.checkedAt:void 0,latestVersion:typeof t.latestVersion==`string`?t.latestVersion:void 0,prompted:t.prompted===!0}}catch{return{}}}function p(e,t){try{r.mkdirSync(n.dirname(e),{recursive:!0}),r.writeFileSync(e,`${JSON.stringify(t,null,2)}\n`,`utf8`)}catch{}}function m(){let e=i(import.meta.url),t=n.extname(e)||`.js`,a=[n.join(n.dirname(e),`update-check-entry${t}`),n.join(n.dirname(e),`internal`,`update-check-entry${t}`)].find(e=>r.existsSync(e));if(!a)throw Error(`Update check entrypoint not found. Rebuild the package to include the update-check worker entry.`);return a}function h(t,n){let r=m(),i=r.endsWith(`.ts`)?[`--experimental-strip-types`]:[];e(process.execPath,[...i,r,o,t,n])}async function g(){let e=await fetch(`https://registry.npmjs.org/${a}/latest`,{signal:AbortSignal.timeout(3500),headers:{accept:`application/json`}});if(!e.ok)return;let t=await e.json();return typeof t.version==`string`&&t.version.trim().length>0?t.version.trim():void 0}function _(e){if(!e)return;let t=Date.parse(e);return Number.isNaN(t)?void 0:t}function v(e){if(e[0]!==o)return null;let t=e[1]?.trim(),n=e[2]?.trim();return!t||!n?null:{cachePath:t,currentVersion:n}}export{v as n,c as r,s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O as e}from"./sdk-contracts.js";import t from"node:fs";const n=`agent-device only reads and writes regular files at this path. Remove the symbolic link or special file there and retry.`,r=`Another process replaced the file at this path while it was being opened. Stop the concurrent writer, then retry.`;function i(e){return s(e,t.constants.O_RDONLY,!1)}function a(e){return s(e,t.constants.O_WRONLY|t.constants.O_APPEND,!0)}function o(e){let n=s(e,t.constants.O_RDWR,!0);try{return t.ftruncateSync(n,0),n}catch(e){throw t.closeSync(n),e}}function s(t,n,i){for(let e=0;e<2;e+=1){let e=c(t,n,i);if(e.status!==`retry`)return e.status===`missing`?void 0:e.descriptor}throw new e(`COMMAND_FAILED`,`Final file could not be opened without an identity race: ${t}`,{hint:r})}function c(e,n,r){let i=p(e);if(!i&&!r)return{status:`missing`};let a=l(e,n,i===void 0,r);if(typeof a!=`number`)return a;try{return d(e,a,i),{status:`opened`,descriptor:a}}catch(e){throw t.closeSync(a),e}}function l(e,n,r,i){try{return t.openSync(e,n|g()|(r?t.constants.O_CREAT|t.constants.O_EXCL:0),384)}catch(e){let t=e.code,n=u(t,r,i);if(n)return n;throw e}}function u(e,t,n){if(e===`EEXIST`)return t?{status:`retry`}:void 0;if(e===`ENOENT`&&!t)return{status:n?`retry`:`missing`}}function d(e,n,r){let i=t.fstatSync(n),a=p(e);if(!i.isFile()||!a||!h(i,a)||r&&!h(r,i))throw f(e)}function f(t){return new e(`COMMAND_FAILED`,`Final file identity changed while it was opened: ${t}`,{hint:r})}function p(t){let r=m(t);if(r&&!r.isFile())throw new e(`COMMAND_FAILED`,`Final path must be a regular file: ${t}`,{hint:n});return r}function m(e){try{return t.lstatSync(e)}catch(e){if(e.code===`ENOENT`)return;throw e}}function h(e,t){return e.dev===t.dev&&e.ino===t.ino}function g(){let e=t.constants.O_NOFOLLOW;return Number.isInteger(e)&&e>0?e:0}export{o as a,i,m as n,a as r,n as t};
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime.js";import{t}from"./ttl-memo.js";import n from"node:path";import r from"node:fs";import{fileURLToPath as i}from"node:url";function a(e){let t=e,i=null;for(let e=0;e<8;e+=1){let e=n.join(t,`package.json`);if(r.existsSync(e)){i??=t;try{if(JSON.parse(r.readFileSync(e,`utf8`)).name===`agent-device`)return t}catch{}}t=n.dirname(t)}return i??e}const o=`src/daemon.ts`;function s(e){return r.existsSync(n.join(e,`package.json`))&&r.existsSync(n.join(e,`src/daemon.ts`))}const c=t(),l=t();function u(e=d()){let t=c.get(e);if(t!==void 0)return t;let i;try{i=JSON.parse(r.readFileSync(n.join(e,`package.json`),`utf8`))}catch{return`0.0.0`}let a=typeof i.version==`string`?i.version:`0.0.0`;return c.set(e,a),a}function d(){let e=l.get(`self`);if(e!==void 0)return e;let t=a(n.dirname(i(import.meta.url)));return l.set(`self`,t),t}
|
|
1
|
+
import{r as e}from"./rolldown-runtime.js";import{t}from"./ttl-memo.js";import n from"node:path";import r from"node:fs";import{fileURLToPath as i}from"node:url";function a(e){let t=e,i=null;for(let e=0;e<8;e+=1){let e=n.join(t,`package.json`);if(r.existsSync(e)){i??=t;try{if(JSON.parse(r.readFileSync(e,`utf8`)).name===`agent-device`)return t}catch{}}t=n.dirname(t)}return i??e}const o=`src/daemon.ts`;function s(e){return r.existsSync(n.join(e,`package.json`))&&r.existsSync(n.join(e,`src/daemon.ts`))}const c=t(),l=t();function u(e=d()){let t=c.get(e);if(t!==void 0)return t;let i;try{i=JSON.parse(r.readFileSync(n.join(e,`package.json`),`utf8`))}catch{return`0.0.0`}let a=typeof i.version==`string`?i.version:`0.0.0`;return c.set(e,a),a}function d(){let e=l.get(`self`);if(e!==void 0)return e;let t=a(n.dirname(i(import.meta.url)));return l.set(`self`,t),t}function f(e,t){return p(e,t)>0}function p(e,t){let n=h(e),r=h(t);return g(n.release,r.release)||_(n.prerelease,r.prerelease)}const m=/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;function h(e){let t=m.exec(e.trim());return t?{release:[Number(t[1]),Number(t[2]),Number(t[3])],prerelease:t[4]?.split(`.`)??[]}:{release:[0,0,0],prerelease:[]}}function g(e,t){for(let n=0;n<3;n+=1)if(e[n]!==t[n])return e[n]>t[n]?1:-1;return 0}function _(e,t){if(e.length===0)return t.length===0?0:1;if(t.length===0)return-1;let n=Math.max(e.length,t.length);for(let r=0;r<n;r+=1){let n=e[r],i=t[r];if(n===void 0)return-1;if(i===void 0)return 1;let a=v(n,i);if(a!==0)return a}return 0}function v(e,t){if(e===t)return 0;let n=/^\d+$/.test(e),r=/^\d+$/.test(t);return n&&r?Number(e)>Number(t)?1:-1:n===r?e>t?1:-1:n?-1:1}var y=e({DAEMON_SOURCE_ENTRY:()=>o,compareVersions:()=>p,findProjectRoot:()=>d,isNewerVersion:()=>f,isSourceCheckoutProjectRoot:()=>s,readVersion:()=>u});export{u as a,f as i,p as n,o,d as r,s,y as t};
|
package/dist/src/video.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O as e}from"./sdk-contracts.js";import{or as t}from"./sdk-batch.js";import{x as n}from"./owner-identity.js";import{c as r}from"./exec.js";import{t as i}from"./timeouts.js";import{n as a,t as o}from"./file.js";import"./command.js";import"./retry.js";import"./process.js";import s from"node:path";import c from"node:fs";import{createHash as l}from"node:crypto";import u from"node:os";import{fileURLToPath as d}from"node:url";const f=`apple/runner/AgentDeviceRunner/RecordingScripts`;function p(e,t,n,r){let i=`${f}/${e}`,a=`dist/${i}`;return[s.resolve(t,e),s.resolve(n,i),s.resolve(t,`../${i}`),s.resolve(t,`../../${i}`),s.resolve(t,`../../../${i}`),s.resolve(n,a),s.resolve(r,i)]}function m(t,n,r=s.dirname(d(import.meta.url)),i=process.cwd()){let a=p(t,r,n,i);for(let e of a)if(c.existsSync(e))return e;throw new e(`COMMAND_FAILED`,`Missing recording helper script: ${t}`,{hint:`Ensure ${f} is present in this checkout or bundled under dist/${f} in the package.`,scriptName:t,searchedPaths:a})}function h(e=process.env){let t=v(),n=s.join(t,`home`),r=s.join(t,`module-cache`);return c.mkdirSync(n,{recursive:!0}),c.mkdirSync(r,{recursive:!0}),{...e,HOME:n,CLANG_MODULE_CACHE_PATH:r}}async function g(e){let t=[e.sourcePath,...e.extraSourcePaths??[]],n=t.map(e=>({sourcePath:e,stat:c.statSync(e),source:c.readFileSync(e)})),r=S(e.cacheName??s.basename(e.sourcePath,s.extname(e.sourcePath))),i=C([`2`,process.platform,process.arch,...n.flatMap(({sourcePath:e,stat:t,source:n})=>[s.resolve(e),t.size,n])]),a=s.join(v(),`bin`,`${r}-${i}`);return await y({sourcePaths:t,executablePath:a,timeoutMs:e.timeoutMs}),a}async function _(e){let t=S(e.cacheName),n=C([`2`,process.platform,process.arch,e.source]),r=s.join(v(),`sources`,`${t}-${n}.swift`),i=s.join(v(),`bin`,`${t}-${n}`);return await y({sourcePaths:[r],executablePath:i,sourceText:e.source,timeoutMs:e.timeoutMs}),i}function v(){let e=process.env.AGENT_DEVICE_SWIFT_CACHE_DIR?.trim();return e?s.resolve(e):s.join(u.tmpdir(),`agent-device-swift-cache`)}async function y(e){if(x(e.executablePath))return;let t=s.dirname(e.executablePath);c.mkdirSync(t,{recursive:!0});let n=e.timeoutMs??12e4;await a({acquire:()=>b(`${e.executablePath}.lock`,n),task:async()=>{if(x(e.executablePath))return;let i=c.mkdtempSync(s.join(t,`.${s.basename(e.executablePath)}.${process.pid}.`)),a=s.join(i,s.basename(e.executablePath));try{let[t]=e.sourcePaths;e.sourceText!==void 0&&t&&!c.existsSync(t)&&(c.mkdirSync(s.dirname(t),{recursive:!0}),c.writeFileSync(t,e.sourceText)),await r(`xcrun`,[`swiftc`,...e.sourcePaths,`-o`,a],{timeoutMs:n,env:h()}),c.renameSync(a,e.executablePath)}finally{c.rmSync(i,{recursive:!0,force:!0})}}})}async function b(t,r){try{return await o({lockDirPath:t,owner:{pid:process.pid,startTime:n(process.pid),acquiredAtMs:Date.now()},timeoutMs:r,pollMs:25,ownerGraceMs:r,description:`Swift cache lock: ${t} (${r}ms)`})}catch(n){throw n instanceof e&&n.message.startsWith(`Timed out waiting for Swift cache lock:`)?new e(`COMMAND_FAILED`,n.message,{...n.details,lockDir:t,timeoutMs:r,hint:`Another agent-device process may still be compiling this Swift helper. Retry shortly; if no agent-device process is active, remove "${t}" and retry.`}):n}}function x(e){try{return c.accessSync(e,c.constants.X_OK),c.statSync(e).isFile()}catch{return!1}}function S(e){return t(e.replaceAll(/[^A-Za-z0-9._-]/g,`-`))||`swift-helper`}function C(e){let t=l(`sha256`);for(let n of e)t.update(Buffer.isBuffer(n)?n:String(n)),t.update(`\0`);return t.digest(`hex`).slice(0,16)}const w={block:161,blockGroup:160,cluster:524531317,codecId:134,documentType:17026,ebml:440786851,segment:408125543,simpleBlock:163,trackEntry:174,trackNumber:215,tracks:374648427,trackType:131};function T(e){let t=E(e);if(!t)return!1;let{bytes:n,fileSize:r}=t,i=L(n,0,n.length,r);if(!i||i.id!==w.ebml||!i.complete||i.unknownSize||!D(n,i))return!1;let a=L(n,i.nextOffset,n.length,r);return!a||a.id!==w.segment||!V(a,r)?!1:O(n,a,r)}function E(e){try{let t=c.openSync(e,`r`);try{let e=c.fstatSync(t).size;if(e<=0)return;let n=Buffer.alloc(Math.min(e,1048576));return c.readSync(t,n,0,n.length,0)===n.length?{bytes:n,fileSize:e}:void 0}finally{c.closeSync(t)}}catch{return}}function D(e,t){let n=I(e,t)?.find(e=>e.id===w.documentType);return n!==void 0&&e.toString(`ascii`,n.dataStart,n.dataEnd)===`webm`}function O(e,t,n){let r=new Set,i=new Set;for(let a=t.dataStart;a<t.dataEnd;){let o=L(e,a,t.dataEnd,n);if(!o||!V(o,n))return!1;if(o.id===w.tracks&&k(e,o,r),o.id===w.cluster&&j(e,o,n,i),H(r,i))return!0;if(!o.complete||o.unknownSize)return!1;a=o.nextOffset}return!1}function k(e,t,n){let r=I(e,t);if(r){for(let t of r)if(t.id===w.trackEntry){let r=A(e,t);r!==void 0&&n.add(r)}}}function A(e,t){let n=I(e,t),r=F(e,n,w.trackNumber),i=F(e,n,w.trackType),a=n?.find(e=>e.id===w.codecId),o=a?e.toString(`ascii`,a.dataStart,a.dataEnd):void 0;return i===1&&o?.startsWith(`V_`)?r:void 0}function j(e,t,n,r){for(let i=t.dataStart;i<t.dataEnd;){let a=L(e,i,t.dataEnd,n);if(!a||!V(a,n)||(a.id===w.simpleBlock&&N(e,a,r),a.id===w.blockGroup&&M(e,a,r),!a.complete||a.unknownSize))return;i=a.nextOffset}}function M(e,t,n){let r=I(e,t)?.find(e=>e.id===w.block);r&&N(e,r,n)}function N(e,t,n){if(!t.complete||t.unknownSize)return;let r=z(e,t.dataStart);!r||r.unknown||t.dataEnd-t.dataStart<r.length+4||n.add(r.value)}function P(e,t){let n=t.dataEnd-t.dataStart;if(n<1||n>6)return;let r=0;for(let n=t.dataStart;n<t.dataEnd;n+=1)r=r*256+e[n];return Number.isSafeInteger(r)?r:void 0}function F(e,t,n){let r=t?.find(e=>e.id===n);return r?P(e,r):void 0}function I(e,t){if(!t.complete||t.unknownSize)return;let n=[];for(let r=t.dataStart;r<t.dataEnd;){let i=L(e,r,t.dataEnd,e.length);if(!i||!i.complete||i.unknownSize)return;n.push(i),r=i.nextOffset}return n}function L(e,t,n,r){let i=R(e,t);if(!i)return;let a=z(e,t+i.length);if(!a)return;let o=t+i.length+a.length;if(o>n)return;let s=a.unknown?r:o+a.value;if(!(!Number.isSafeInteger(s)||s<o))return{id:i.value,dataStart:o,dataEnd:Math.min(s,n),nextOffset:s,complete:s<=n,unknownSize:a.unknown}}function R(e,t){let n=B(e,t,4);if(!n)return;let r=0;for(let i=0;i<n;i+=1)r=r*256+e[t+i];return{length:n,value:r}}function z(e,t){let n=B(e,t,8);if(!n)return;let r=e[t],i=128>>n-1;if((r&i-1)==i-1&&e.subarray(t+1,t+n).every(e=>e===255))return{length:n,value:0,unknown:!0};let a=r&i-1;for(let r=1;r<n;r+=1)a=a*256+e[t+r];return Number.isSafeInteger(a)?{length:n,value:a,unknown:!1}:void 0}function B(e,t,n){let r=e[t];if(r===void 0||r===0)return;let i=128,a=1;for(;(r&i)===0;)i>>=1,a+=1;return a<=n&&t+a<=e.length?a:void 0}function V(e,t){return e.unknownSize||e.nextOffset<=t}function H(e,t){for(let n of e)if(t.has(n))return!0;return!1}let U;async function W(e,t={}){let n=t.pollMs??150,r=t.attempts??12,a,o=0;for(let t=0;t<r;t+=1){let t=0;try{t=c.statSync(e).size}catch{t=0}if(t>0&&t===a){if(o+=1,o>=2)return}else o=0;a=t,await i(n)}}async function G(e){let t=await Z(e);if(!t)return!1;if(t===`webm`)return!0;try{let t=await K(),n=await r(t,[e],{allowFailure:!0,timeoutMs:1e4,env:h()});return n.exitCode===0||Y(n.stderr,n.stdout)}catch(e){if(q(e))return!0;throw e}}async function K(){U??=_({source:`import Foundation
|
|
2
2
|
import AVFoundation
|
|
3
3
|
|
|
4
4
|
let url = URL(fileURLWithPath: CommandLine.arguments[1])
|
package/dist/src/viewport.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O as e}from"./sdk-contracts.js";function t(t,n){let r=t===void 0?NaN:Number(t);if(!Number.isInteger(r)||r<1)throw new e(`INVALID_ARGS`,`viewport ${n} must be a positive integer`);return r}function n(n){if(n.length!==2)throw new e(`INVALID_ARGS`,`viewport requires exactly two arguments: <width> <height>`);return{width:t(n[0],`width`),height:t(n[1],`height`)}}export{n as t};
|
package/dist/src/web.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O as e}from"./sdk-contracts.js";import{printJson as t}from"./json.js";function n(){return Object.freeze({setup:async e=>{let{setupManagedAgentBrowser:t}=await import(`./src6.js`).then(e=>e.i);return await t(e)},doctor:async e=>{let{doctorManagedAgentBrowser:t}=await import(`./src6.js`).then(e=>e.i);return await t(e)}})}const r=n();async function i(t,n){switch(t[0]){case`setup`:{a(n.flags.json);let e=await r.setup({stateDir:n.stateDir});return o(n.flags.json,e),0}case`doctor`:{let e=await r.doctor({stateDir:n.stateDir});return s(n.flags.json,e.exitCode===0?`Web backend is healthy.`:`Web backend doctor reported issues.`,e),e.exitCode}default:throw new e(`INVALID_ARGS`,`web requires setup or doctor`)}}function a(e){e||process.stdout.write(`Setting up managed agent-browser backend (downloads if needed)...
|
|
2
2
|
`)}function o(e,n){if(e){t({success:!0,data:{status:c(n)}});return}process.stdout.write(`Managed web backend installed.\nagent-browser available at: ${n.binaryPath}\n`)}function s(e,n,r){if(e){t({success:!0,data:l(r)});return}process.stdout.write(`${n}\n`)}function c(e){let{socketDir:t,...n}=e;return n}function l(e){let t=e.status;return u(t)?{...e,status:c(t)}:e}function u(e){return typeof e==`object`&&!!e&&`socketDir`in e&&`installDir`in e&&`binaryPath`in e}export{i as runWebCommand};
|
package/dist/src/web2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O as e}from"./sdk-contracts.js";import{r as t}from"./interaction-positionals.js";import{c as n}from"./diagnostics.js";import"./diagnostics2.js";import{n as r}from"./src6.js";function i(t){let n=async n=>{throw new e(`UNSUPPORTED_OPERATION`,`${n} is not supported on ${t}`)};return{open:()=>n(`open`),openDevice:()=>n(`openDevice`),close:()=>n(`close`),tap:()=>n(`tap`),longPress:()=>n(`longPress`),focus:()=>n(`focus`),type:()=>n(`type`),fill:()=>n(`fill`),scroll:()=>n(`scroll`),screenshot:()=>n(`screenshot`),snapshot:()=>n(`snapshot`),back:()=>n(`back`),setOrientation:()=>n(`setOrientation`),setSetting:()=>n(`setSetting`)}}async function a(a){let o=a??await r(),s=o.clickRef,c=o.hover,l=o.hoverRef,u=o.fillRef;return{...i(`web`),open:(e,t)=>o.open(t?.url??e,{url:t?.url}),openDevice:()=>o.open(`about:blank`),close:e=>o.close(e),tap:(e,t)=>o.click(e,t),...s?{tapRef:async e=>(await s(e),{ref:t(e)})}:{},...c?{hover:async(e,t)=>await c(e,t)}:{},...l?{hoverRef:async e=>(await l(e),{ref:t(e)})}:{},focus:(e,t)=>o.click(e,t),type:(e,t)=>o.typeText(e,{delayMs:t}),fill:(e,t,n,r)=>o.fill(e,t,n,{delayMs:r}),...u?{fillRef:async(e,n,r)=>(await u(e,n,{delayMs:r}),{ref:t(e),text:n,delayMs:r??0})}:{},scroll:(e,t)=>o.scroll(e,t),screenshot:(e,t)=>o.screenshot(e,t),setViewport:(e,t)=>o.setViewport(e,t),snapshot:async e=>{let t=await n(`snapshot_capture`,async()=>await o.snapshot(e),{backend:`web`});return{nodes:t.nodes,truncated:t.truncated??!1,backend:`web`,producer:`agent-browser`}},setOrientation:async()=>{throw new e(`UNSUPPORTED_OPERATION`,`orientation is not supported on web`)}}}export{a as createWebInteractor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime.js";import{O as t}from"./sdk-contracts.js";import{t as n}from"./bounds.js";import{t as r}from"./parser.js";var i=e({parseWebDriverSourceFacts:()=>p});function a(e){try{return r(e)}catch(e){throw new t(`COMMAND_FAILED`,`Failed to parse WebDriver page source XML: ${e instanceof Error?e.message:String(e)}`,void 0,e)}}function o(e){let t=n(e.bounds??null);if(t)return t;let r=d(e.x),i=d(e.y),a=d(e.width),o=d(e.height);if(r!==void 0&&i!==void 0&&a!==void 0&&o!==void 0)return{x:r,y:i,width:a,height:o}}function s(e,t){for(let n of t){let t=c(e[n]);if(t!==void 0)return t}}function c(e){return e||void 0}function l(e,t){return e===void 0?t:e===`true`||e===`1`?!0:e===`false`||e===`0`?!1:t===void 0&&void 0}function u(e){return!!(e&&e.width>0&&e.height>0)}function d(e){if(e===void 0||e===``)return;let t=Number(e);return Number.isFinite(t)?t:void 0}function f(e,t){return c(t.class)??c(e.replace(/^XCUIElementType/,``).toLowerCase())}function p(e,t=`ios`){let n=a(e),r=[],i=[];for(let e of n)m(r,e,void 0,0,i,t);return{nodes:r,roots:i}}function m(e,t,n,r,i,a){let o=h(t,a)?n:g(e,t,n,r,i,a),s=o===n?r:r+1;for(let n of t.children)m(e,n,o,s,i,a)}function h(e,t){if(Object.keys(e.attributes).length===0)return!0;let n=e.name.toLowerCase();return t===`ios`&&(n===`hierarchy`||n===`appiumaut`)}function g(e,t,n,r,i,a){let s=e.length,c=o(t.attributes);return e.push(_(s,t.name,t.attributes,n,r,c,a)),n===void 0&&i.push({type:t.name,...c?{rect:c}:{},rectStatus:x(t.attributes,c)}),s}function _(e,t,n,r,i,a,o){return{index:e,type:t,role:f(t,n),label:s(n,[`content-desc`,`label`,`text`,`name`]),value:c(n.value),identifier:s(n,[`resource-id`,`id`,`accessibility-id`,`name`]),rect:a,...v(n,a,o),depth:i,parentIndex:r}}function v(e,t,n){let r=n===`android`||void 0,i=l(e.enabled,r),a=l(e.displayed??e.visible,r);return n===`android`?{enabled:i,selected:l(e.selected,!1),focused:l(e.focused,!1),visibleToUser:a,hittable:a===!0&&i===!0&&u(t)}:{...y(`enabled`,i),...y(`selected`,l(e.selected)),...y(`focused`,l(e.focused)),...y(`visibleToUser`,a),...b(e.hittable)}}function y(e,t){return t===void 0?{}:{[e]:t}}function b(e){let t=l(e);return t===void 0?{}:{hittable:t}}function x(e,t){let n=e.bounds!==void 0,r=[`x`,`y`,`width`,`height`].every(t=>e[t]!==void 0);return!n&&!r?`not-provided`:u(t)?`reported`:`invalid`}export{i as n,p as t};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-device",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.14",
|
|
4
4
|
"description": "Mobile app automation and verification for AI coding agents. CLI, MCP server, and typed Node.js API for iOS, Android, HarmonyOS, TV, web, macOS, and Linux.",
|
|
5
5
|
"mcpName": "io.github.callstack/agent-device",
|
|
6
6
|
"license": "MIT",
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
"check:unit": "pnpm test:unit && pnpm check:tmpdir-leaks && pnpm test:smoke",
|
|
172
172
|
"check": "pnpm check:tooling && pnpm check:fallow && pnpm check:unit",
|
|
173
173
|
"prepack": "pnpm check:mcp-metadata && pnpm package:npm",
|
|
174
|
-
"typecheck": "tsc -b packages/xml packages/kernel packages/contracts packages/device-selection packages/host-kit packages/capture-kit packages/managed-allocation packages/provision-kit packages/platform-apple packages/platform-android packages/platform-harmonyos packages/platform-vega packages/platform-linux packages/platform-web packages/ad-script packages/selectors packages/command-registry packages/session-journal packages/ad-replay packages/maestro packages/replay-test packages/provider-webdriver packages/provider-limrun && tsc -p tsconfig.json && tsc -p examples/sdk/tsconfig.json",
|
|
174
|
+
"typecheck": "tsc -b packages/xml packages/kernel packages/contracts packages/device-selection packages/host-kit packages/capture-kit packages/managed-allocation packages/provision-kit packages/platform-apple packages/platform-android packages/platform-harmonyos packages/platform-vega packages/platform-linux packages/platform-web packages/ad-script packages/selectors packages/command-registry packages/session-journal packages/ad-replay packages/maestro packages/replay-port packages/replay-test packages/provider-webdriver packages/provider-limrun && tsc -p tsconfig.json && tsc -p examples/sdk/tsconfig.json",
|
|
175
175
|
"test-app:install": "pnpm install --dir examples/test-app",
|
|
176
176
|
"test-app:start": "pnpm --dir examples/test-app start",
|
|
177
177
|
"test-app:ios": "pnpm --dir examples/test-app ios",
|
|
@@ -298,6 +298,7 @@
|
|
|
298
298
|
"@agent-device/provider-limrun": "workspace:*",
|
|
299
299
|
"@agent-device/provider-webdriver": "workspace:*",
|
|
300
300
|
"@agent-device/provision-kit": "workspace:*",
|
|
301
|
+
"@agent-device/replay-port": "workspace:*",
|
|
301
302
|
"@agent-device/replay-test": "workspace:*",
|
|
302
303
|
"@agent-device/selectors": "workspace:*",
|
|
303
304
|
"@agent-device/session-journal": "workspace:*",
|
package/server.json
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
"url": "https://github.com/callstack/agent-device",
|
|
8
8
|
"source": "github"
|
|
9
9
|
},
|
|
10
|
-
"version": "0.21.
|
|
10
|
+
"version": "0.21.14",
|
|
11
11
|
"packages": [
|
|
12
12
|
{
|
|
13
13
|
"registryType": "npm",
|
|
14
14
|
"identifier": "agent-device",
|
|
15
|
-
"version": "0.21.
|
|
15
|
+
"version": "0.21.14",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|
|
18
18
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0f522f7a3185a5c818e97c17fda1743fdb7b0ba44799fd8d5de014e6be20c6ca agent-device-android-ime-helper-0.21.12.apk
|
|
Binary file
|
package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.12.apk.sha256
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
fa2c18d04e207a5b5dc6b7ad0704548b5420c4ab8659d7b250b10af31fb821d0 agent-device-android-snapshot-helper-0.21.12.apk
|
package/dist/src/apps-simctl.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./tool-provider.js";import{t}from"./simctl.js";function n(e,n){return t(e,n)}function r(t,r,i){return e(n(t,r),i)}function i(e){return e.includes(`not installed`)||e.includes(`not found`)||e.includes(`no such file`)}export{r as n,n as r,i as t};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { n as DaemonArtifactType } from "./sdk-contracts.js";
|
|
2
|
-
//#region packages/contracts/src/cloud-artifacts.d.ts
|
|
3
|
-
declare const CLOUD_ARTIFACT_KINDS: readonly ['video', 'appium-log', 'device-log', 'automation-log', 'provider-session', 'raw'];
|
|
4
|
-
type CloudArtifactKind = (typeof CLOUD_ARTIFACT_KINDS)[number];
|
|
5
|
-
type CloudArtifactAvailability = 'ready' | 'pending' | 'unavailable' | 'expired';
|
|
6
|
-
type CloudArtifact = {
|
|
7
|
-
provider: string;
|
|
8
|
-
kind: CloudArtifactKind;
|
|
9
|
-
name: string;
|
|
10
|
-
url?: string;
|
|
11
|
-
providerSessionId?: string;
|
|
12
|
-
providerArtifactId?: string;
|
|
13
|
-
contentType?: string;
|
|
14
|
-
extension?: string;
|
|
15
|
-
availability?: CloudArtifactAvailability;
|
|
16
|
-
metadata?: Record<string, unknown>;
|
|
17
|
-
};
|
|
18
|
-
type CloudArtifactsStatus = 'ready' | 'pending' | 'unavailable';
|
|
19
|
-
type CloudArtifactsResult = {
|
|
20
|
-
provider: string;
|
|
21
|
-
status: CloudArtifactsStatus;
|
|
22
|
-
cloudArtifacts: CloudArtifact[];
|
|
23
|
-
providerSessionId?: string;
|
|
24
|
-
message?: string;
|
|
25
|
-
};
|
|
26
|
-
type DaemonArtifactInventoryEntry = {
|
|
27
|
-
id: string;
|
|
28
|
-
artifactType?: DaemonArtifactType;
|
|
29
|
-
filename: string;
|
|
30
|
-
mimeType: string;
|
|
31
|
-
sizeBytes: number;
|
|
32
|
-
createdAt: string;
|
|
33
|
-
expiresAt: string;
|
|
34
|
-
};
|
|
35
|
-
type DaemonArtifactsResult = {
|
|
36
|
-
source: 'daemon';
|
|
37
|
-
status: 'ready';
|
|
38
|
-
artifacts: DaemonArtifactInventoryEntry[];
|
|
39
|
-
message?: string;
|
|
40
|
-
};
|
|
41
|
-
type AgentArtifactsResult = CloudArtifactsResult | DaemonArtifactsResult;
|
|
42
|
-
type CloudArtifactsQuery = {
|
|
43
|
-
provider?: string;
|
|
44
|
-
leaseId?: string;
|
|
45
|
-
providerSessionId?: string;
|
|
46
|
-
};
|
|
47
|
-
type CloudProviderSessionResult = {
|
|
48
|
-
provider?: string;
|
|
49
|
-
providerSessionId?: string;
|
|
50
|
-
cloudArtifacts?: CloudArtifactsResult;
|
|
51
|
-
} & Record<string, unknown>;
|
|
52
|
-
/**
|
|
53
|
-
* Return undefined only when this provider implementation does not handle the query.
|
|
54
|
-
* Return a CloudArtifactsResult with status "unavailable" when the provider handled the
|
|
55
|
-
* query but artifact retrieval failed, and "pending" when artifacts are not finalized yet.
|
|
56
|
-
*/
|
|
57
|
-
type CloudArtifactProvider = {
|
|
58
|
-
listCloudArtifacts?: (query: CloudArtifactsQuery) => Promise<CloudArtifactsResult | undefined>;
|
|
59
|
-
};
|
|
60
|
-
//#endregion
|
|
61
|
-
export { CloudArtifactProvider as n, CloudProviderSessionResult as r, AgentArtifactsResult as t };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{D as e,P as t,U as n,k as r}from"./sdk-contracts.js";import{i}from"./alert-contract.js";import{f as a,i as o,m as s,o as c,y as l}from"./host.js";import u from"node:crypto";const d=`RUNNER_BUSY`,f=`MAIN_THREAD_TIMEOUT`,p="If runner build products look stale or corrupted, run `pnpm clean:xcuitest` in a local checkout, or remove ~/.agent-device/apple-runner/derived, then retry.";function m(e){let t=a(e.requestId);return e.signal?!t||t===e.signal?e.signal:AbortSignal.any([t,e.signal]):t}const h=e=>e.retriable===!0,g=e=>typeof e.devToolsSecurityStatus==`string`,_=e=>e.usbmuxDeviceAttached===!1,v=e=>e.runnerReadinessPreflightFailed===!0&&!t(e),y=`build_failed_unclassified`,b={reason:`signing_provisioning_profile_missing`,hint:`Install/select a valid iOS provisioning profile, or set AGENT_DEVICE_IOS_PROVISIONING_PROFILE.`},x=[{reason:`usbmux_device_unattached`,match:{code:`DEVICE_NOT_FOUND`,details:_},verdicts:{connectRetry:!1}},{reason:`flagged_retriable`,match:{code:`COMMAND_FAILED`,details:h},verdicts:{retryable:!0,connectRetry:!0}},{reason:`xcodebuild_exited_early`,match:{code:`COMMAND_FAILED`,messageIncludesAll:[`xcodebuild exited early`]},verdicts:{retryable:!1,connectRetry:!1,artifactSuspect:!1}},{reason:`device_busy_connecting`,match:{code:`COMMAND_FAILED`,messageIncludesAll:[`device is busy`,`connecting`]},verdicts:{retryable:!1,connectRetry:!1}},{reason:`runner_readiness_preflight_failed`,match:{code:`COMMAND_FAILED`,details:v},verdicts:{restartAfterReadinessPreflight:!0}},{reason:`runner_connect_refused`,match:{code:`COMMAND_FAILED`,messageIncludesAll:[`runner did not accept connection`]},verdicts:{retryable:!0,connectRetry:!0,restartBeforeSend:!0,artifactSuspect:!0}},{reason:`runner_endpoint_probe_exhausted`,match:{code:`COMMAND_FAILED`,messageIncludesAll:[`runner endpoint probe failed`]},verdicts:{artifactSuspect:!0}},{reason:`fetch_failed`,match:{code:`COMMAND_FAILED`,messageIncludesAll:[`fetch failed`]},verdicts:{retryable:!0,connectRetry:!0}},{reason:`econnrefused`,match:{code:`COMMAND_FAILED`,messageIncludesAll:[`econnrefused`]},verdicts:{retryable:!0,connectRetry:!0}},{reason:`socket_hang_up`,match:{code:`COMMAND_FAILED`,messageIncludesAll:[`socket hang up`]},verdicts:{retryable:!0,connectRetry:!0}},{reason:`ax_snapshot_failure`,match:{code:`IOS_AX_SNAPSHOT_FAILED`},verdicts:{sessionFatalReason:`ax_snapshot_failure`}},{reason:`xctest_recorded_failure`,match:{code:`XCTEST_RECORDED_FAILURE`},verdicts:{sessionFatalReason:`xctest_recorded_failure`}},{reason:`runner_main_thread_wedged`,match:{code:`RUNNER_WEDGED`},verdicts:{sessionFatalReason:`runner_main_thread_wedged`}},{reason:`bundle_identifier_registration_failed`,match:{toolTextIncludesAll:[`failed registering bundle identifier`]},verdicts:{},buildFailure:{reason:`bundle_identifier_already_registered`,hint:`Set AGENT_DEVICE_IOS_BUNDLE_ID to a unique reverse-DNS value (for example, com.yourname.agentdevice.runner), then retry.`}},{reason:`bundle_identifier_unavailable`,match:{toolTextLineIncludesAll:[`app identifier`,`not available`]},verdicts:{},buildFailure:{reason:`bundle_identifier_already_registered`,hint:`Set AGENT_DEVICE_IOS_BUNDLE_ID to a unique reverse-DNS value (for example, com.yourname.agentdevice.runner), then retry.`}},{reason:`signing_requires_development_team`,match:{toolTextIncludesAll:[`requires a development team`]},verdicts:{},buildFailure:{reason:`signing_no_development_team`,hint:`Configure signing in Xcode or set AGENT_DEVICE_IOS_TEAM_ID for physical-device runs.`}},{reason:`conflicting_provisioning_settings_unproven`,match:{toolTextIncludesAll:[`conflicting provisioning settings`]},verdicts:{},buildFailure:{reason:y,hint:p}},{reason:`signing_no_profiles_for_bundle_id`,match:{toolTextIncludesAll:[`no profiles for`]},verdicts:{},buildFailure:b},{reason:`signing_provisioning_profile_xcode_error`,match:{toolTextLineIncludesAll:[`provisioning profile`,`ideprovisioningerrordomain`]},verdicts:{},buildFailure:b},{reason:`signing_provisioning_profile_does_not_cover`,match:{toolTextLineIncludesAll:[`provisioning profile`,`doesn't include`]},verdicts:{},buildFailure:b},{reason:`signing_provisioning_profile_expired`,match:{toolTextLineIncludesAll:[`provisioning profile`,`has expired`]},verdicts:{},buildFailure:b},{reason:`signing_unspecified`,match:{toolTextIncludesAll:[`code signing`]},verdicts:{},buildFailure:{reason:`signing_unspecified`,hint:`Enable Automatic Signing in Xcode or provide AGENT_DEVICE_IOS_TEAM_ID and optional AGENT_DEVICE_IOS_SIGNING_IDENTITY.`}},{reason:`devtools_security_refused`,match:{code:`COMMAND_FAILED`,details:g},verdicts:{},buildFailure:{reason:`devtools_security_developer_mode_disabled`,hint:"Run `sudo DevToolsSecurity -enable`, then retry the iOS runner. UI test runners start suspended until Xcode/testmanagerd can attach."}}];function S(e,t){return t.code!==void 0&&e.code!==t.code||!C(e,t.details)||!E(e,t.toolTextIncludesAll)||!D(e,t.toolTextLineIncludesAll)?!1:w(e,t.messageIncludesAll)}function C(e,t){return t===void 0||t(e.details??{})}function w(e,t){if(!t)return!0;let n=`${e.message??``}`.toLowerCase();return t.every(e=>n.includes(e))}function T(e){let t=e.details??{};return[e.message,t.stdout,t.stderr].filter(e=>typeof e==`string`).join(`
|
|
2
|
-
`).toLowerCase()}function E(e,t){if(!t)return!0;let n=T(e);return t.every(e=>n.includes(e))}function D(e,t){return!t||T(e).split(`
|
|
3
|
-
`).some(e=>t.every(t=>e.includes(t)))}function O(t,n){if(t instanceof e){for(let e of x)if(e.verdicts[n]!==void 0&&S(t,e.match))return e.verdicts[n]}}function k(t){return!(t instanceof e)||t.code!==`COMMAND_FAILED`?!1:O(t,`retryable`)??!1}function A(t){if(!(t instanceof e))return!1;let n=t.details?.runnerErrorCode;return n===d||n===f}function j(t){return!(t instanceof e)||t.code!==`DEVICE_NOT_FOUND`?!1:_(t.details??{})}function M(e){return O(e,`connectRetry`)??!0}function N(e){return O(e,`restartAfterReadinessPreflight`)??!1}function P(e){return O(e,`artifactSuspect`)??!1}function F(e){return O(e,`sessionFatalReason`)}function I(e){return(O(e,`restartBeforeSend`)??!1)&&M(e)}const L=`SCROLL_KEYBOARD_OCCLUDES_SURFACE`,R=new Set([d,f,i,L,...new Set([`APP_SCREEN_WINDOW_UNRESOLVED`,`APP_SCREEN_UNRESOLVED`,`APP_SCREEN_CAPTURE_UNRENDERABLE`])]);function z(e){let t=e!==void 0&&R.has(e);return Object.freeze({code:t?`COMMAND_FAILED`:n(e),details:Object.freeze({runnerErrorCode:e,...e===d?{retriable:!0}:{}})})}function B(t){let n;try{n=JSON.parse(t)}catch{throw new e(`COMMAND_FAILED`,`Invalid runner response`,{text:t})}return n&&typeof n==`object`?n:{}}function V(e){return e.ok===!0}function H(e){return!e.data||typeof e.data!=`object`||Array.isArray(e.data)?{}:e.data}function U(t,n){let r=W(t.error?.code),i=typeof t.error?.message==`string`?t.error.message:void 0,a=typeof t.error?.hint==`string`?t.error.hint:void 0,o=z(r);return new e(o.code,i??`Runner error`,{runner:t,...o.details,xcodebuild:{exitCode:1,stdout:``,stderr:``},hint:a,logPath:n})}function W(e){return typeof e==`string`&&e.trim().length>0?e.trim():void 0}function G(e,t,n,r){let i=`${e}\n${t}\n${n}`.toLowerCase();if(i.includes(`device is busy`)&&i.includes(`connecting`))return`Target iOS device is still connecting. Keep it unlocked, wait for device trust/connection to settle, then retry.`;let a=r??`IOS_RUNNER_CONNECT_TIMEOUT`;return a===`IOS_RUNNER_DEVICE_NOT_PROVISIONED`?o(a):`${o(a)} ${p}`}function K(t){let{port:n,endpoints:r,logPath:i,lastError:a,deviceStates:s}=t,l=`Runner did not accept connection`;return Y(new e(`COMMAND_FAILED`,l,{port:n,endpoints:r,logPath:i,lastError:a?String(a):void 0,reason:c({error:a,message:l,context:{platform:`ios`,phase:`connect`}}),hint:o(`IOS_RUNNER_CONNECT_TIMEOUT`)}),s)}async function q(t){let{session:n,port:r,logPath:i}=t,a=await n.testPromise,o=`Runner did not accept connection (xcodebuild exited early)`,s=n.readLogTail?.(65536)??``,l=c({message:o,stdout:s,stderr:s,context:{platform:`ios`,phase:`connect`}});return Y(new e(`COMMAND_FAILED`,o,{port:r,logPath:n.runnerLogPath??i,xcodebuild:{exitCode:a.exitCode,stderr:s},reason:l,hint:G(o,s,s,l)}),n.startupDeviceStates)}function J(t){if(t instanceof e)for(let e of x){let n=e.buildFailure;if(n&&S(t,e.match))return{reason:n.reason,hint:n.hint,matched:!0}}return{reason:y,hint:p,matched:!1}}function Y(t,n){if(!n||!(t instanceof e))return t;let r=X(t)===void 0&&n.developerDiskImage===`unavailable`&&!Q(t)&&!Z(t);return new e(t.code,t.message,{...t.details??{},...r?{reason:`device_developer_disk_image_unavailable`,hint:n.developerDiskImageHint}:{},developerDiskImage:n.developerDiskImage},t.cause)}function X(e){let t=e.details?.reason;if(typeof t==`string`&&t!==`build_failed_unclassified`)return t}function Z(e){let t=e.details?.startupHostDeadlineHit;return typeof t==`boolean`?t:s(e)}function Q(e){let t=e.details?.startupRuleMatched;return typeof t==`boolean`?t:J(e).matched}function $(e){return e.command===`status`||e.commandId?.trim()?e:{...e,commandId:ee()}}function ee(){return`runner-${u.randomUUID()}`}function te(e){if(l(e))throw r()}export{P as _,U as a,M as b,B as c,A as d,V as f,m as g,F as h,q as i,Y as l,H as m,te as n,z as o,j as p,K as r,J as s,L as t,k as u,N as v,$ as x,I as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./tool-provider.js";function t(e){let{waitMs:t,signal:n,stop:r,cancelled:i}=e;return new Promise((e,a)=>{let o=()=>l(()=>a(i())),s=()=>l(e),c=setTimeout(()=>l(e),t);function l(e){clearTimeout(c),n?.removeEventListener(`abort`,o),r?.removeEventListener(`abort`,s),e()}n?.addEventListener(`abort`,o,{once:!0}),r?.addEventListener(`abort`,s,{once:!0}),n?.aborted?o():r?.aborted&&s()})}function n(e){let t=e.now??Date.now,n=e.waitGrant??`every-caller`,r=new Map,i=(n,i)=>{let a={status:`pending`,value:void 0,error:void 0,settledAtMs:t(),waitSpent:!1,controller:new AbortController,settled:void 0},o=()=>{};a.settled=new Promise(e=>{o=e}),r.set(n,a);let s=(i,s)=>{a.status=i,i===`ready`?a.value=s:a.error=s,a.settledAtMs=t(),(i===`ready`||e.retryAfterMs===void 0)&&r.get(n)===a&&r.delete(n),o()};try{i(a.controller.signal).then(e=>s(`ready`,e),e=>s(`failed`,e))}catch(e){s(`failed`,e)}return a},a=(n,a)=>{let o=r.get(n);if(!o)return i(n,a);if(o.status!==`failed`)return o;let s=t()-o.settledAtMs;return e.retryAfterMs===void 0||s>=e.retryAfterMs?i(n,a):o};return{value:async(t,r)=>{let i=a(t,r.start);if(i.status===`pending`&&(n===`every-caller`||!i.waitSpent)){i.waitSpent=!0;let t=new AbortController,n=r.wait(e.waitMs,t.signal);n.catch(()=>{});try{await Promise.race([i.settled,n])}finally{t.abort()}}if(i.status===`ready`)return i.value;throw i.status===`failed`?i.error:r.pending()},close:()=>{let e=[...r.values()];r.clear();for(let t of e)t.controller.abort()}}}async function r(t,n){let r=await e(`ps`,[`-p`,String(t),`-o`,`lstart=`],{allowFailure:!0,signal:n.signal,timeoutMs:n.timeoutMs});return r.exitCode===0&&r.stdout.trim()||null}export{n,t as r,r as t};
|