agent-device 0.21.0 → 0.21.2
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.0.apk → agent-device-android-ime-helper-0.21.2.apk} +0 -0
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.2.apk.sha256 +1 -0
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.0.manifest.json → agent-device-android-ime-helper-0.21.2.manifest.json} +4 -4
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.2.apk +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.2.apk.sha256 +1 -0
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.0.manifest.json → agent-device-android-snapshot-helper-0.21.2.manifest.json} +6 -6
- package/apple/snapshot-bridge/README.md +58 -1
- package/apple/snapshot-bridge/SnapshotBridge.m +6 -0
- package/apple/snapshot-bridge/SnapshotBridgeCapture.h +25 -0
- package/apple/snapshot-bridge/SnapshotBridgeCapture.m +138 -0
- package/apple/snapshot-bridge/SnapshotBridgeRuntime.h +1 -0
- package/apple/snapshot-bridge/SnapshotBridgeRuntime.m +32 -3
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.h +12 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.m +20 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerScrollViewportPolicy.swift +413 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSelectorMatchPolicy.swift +15 -15
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSystemSurfaceHostPolicy.swift +72 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTapPointPolicy.swift +63 -14
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +668 -82
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +48 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+BlockingSystemModalResolution.swift +39 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +1078 -211
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +290 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Environment.swift +1 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Exceptions.swift +10 -10
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +250 -74
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Keyboard.swift +101 -42
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +13 -13
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +55 -43
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +71 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+PrivateAXPresentation.swift +144 -7
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift +13 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +216 -17
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SequenceExecution.swift +206 -22
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +289 -42
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotBackendCapabilities.swift +92 -22
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +617 -122
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotTiming.swift +79 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedCommitDeadline.swift +71 -71
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedGesturePolicy.swift +92 -6
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedTextEntry.swift +67 -67
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +4 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +17 -17
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryFocus.swift +30 -30
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryReadiness.swift +31 -31
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextInputCandidatePolicy.swift +28 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextInputProbe.swift +101 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextTyping.swift +19 -19
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Transport.swift +55 -17
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TvRemote.swift +26 -5
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +126 -75
- package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/RecordingExportSupport.swift +8 -12
- package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/recording-overlay.swift +9 -9
- package/dist/src/absence-observation-errors.js +1 -0
- 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/agent-browser-lifecycle.js +1 -1
- package/dist/src/agent-browser-process-record.js +1 -1
- package/dist/src/agent-browser-provider.js +1 -1
- package/dist/src/agent-browser-tool.js +1 -1
- package/dist/src/agent-device-client.js +2 -2
- package/dist/src/ai-sdk.d.ts +1 -1
- package/dist/src/ai-sdk.js +1 -1
- package/dist/src/alert-runtime.js +1 -1
- package/dist/src/android-input-ownership.js +1 -1
- package/dist/src/app-catalog.js +1 -1
- package/dist/src/app-deployment-resolution.js +1 -1
- package/dist/src/app-helpers.js +1 -1
- package/dist/src/app-inventory-contract.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 +3 -3
- 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 +1 -1
- package/dist/src/apple-runner-platform.js +1 -0
- 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/browser-launch.js +1 -0
- package/dist/src/capture.js +1 -1
- package/dist/src/catalog.js +1 -1
- package/dist/src/cli-config.js +1 -1
- package/dist/src/cli-help.js +30 -26
- package/dist/src/cli.js +4 -4
- package/dist/src/click-button.js +1 -1
- package/dist/src/client-metro-companion.js +1 -1
- package/dist/src/client-metro.js +1 -1
- package/dist/src/client-types.d.ts +28 -13
- package/dist/src/code-signature-cache.js +1 -1
- package/dist/src/code-signature.js +1 -1
- package/dist/src/command-metadata.js +1 -1
- package/dist/src/command-schema.js +3 -3
- package/dist/src/command-tools.js +2 -2
- package/dist/src/command.js +1 -1
- package/dist/src/config.js +1 -1
- package/dist/src/connection-runtime.js +1 -1
- package/dist/src/connection.js +3 -3
- package/dist/src/contracts.d.ts +1 -1
- package/dist/src/contracts.js +1 -1
- package/dist/src/daemon-client-lifecycle.js +1 -1
- package/dist/src/daemon-process.js +1 -1
- package/dist/src/daemon-shutdown-report.js +1 -1
- package/dist/src/daemon.js +1 -1
- package/dist/src/debug-symbols-facade.js +1 -1
- package/dist/src/device-boot.js +1 -0
- package/dist/src/device-claim-inspection.js +1 -1
- package/dist/src/device-claim-rule.js +1 -1
- 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/device2.js +1 -1
- package/dist/src/diagnostics.js +1 -1
- package/dist/src/dispatch-resolve.js +1 -1
- package/dist/src/doctor2.js +1 -1
- package/dist/src/durable-resource.js +1 -1
- package/dist/src/engine-eval-script.js +1 -0
- 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/finders.js +1 -1
- package/dist/src/format.js +1 -2
- package/dist/src/generic-settle.js +1 -1
- package/dist/src/gesture-plan.js +1 -1
- package/dist/src/gesture-runtime.js +1 -1
- package/dist/src/harmonyos.js +1 -1
- package/dist/src/hdc.js +1 -1
- package/dist/src/helper.js +2 -2
- package/dist/src/human-control-contract.js +1 -1
- package/dist/src/human-control.js +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/input-actions.js +1 -1
- package/dist/src/input-actions2.js +2 -2
- package/dist/src/install-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/interaction.js +1 -1
- package/dist/src/interaction2.js +1 -1
- package/dist/src/interactor.js +5 -5
- package/dist/src/interactor2.js +1 -1
- package/dist/src/interactors.js +1 -1
- package/dist/src/internal/bin.js +1 -1
- package/dist/src/internal/daemon.js +2 -2
- package/dist/src/internal/png-worker.d.ts +3 -0
- 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 +2 -2
- 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-planning.js +1 -1
- package/dist/src/ios-snapshot-runtime.js +1 -1
- package/dist/src/ios-system-surface.js +1 -0
- package/dist/src/lease-scope.js +1 -1
- package/dist/src/lease.js +1 -1
- package/dist/src/limrun-runtime-dependencies.js +1 -1
- package/dist/src/limrun.d.ts +1 -1
- 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 +16 -16
- package/dist/src/mobile-snapshot-semantics.js +1 -1
- package/dist/src/mp4-atoms.js +1 -0
- package/dist/src/multitouch-support.js +1 -1
- package/dist/src/observation.js +1 -1
- package/dist/src/open-target-resolution.js +1 -0
- package/dist/src/owner-identity.js +3 -3
- package/dist/src/parameterized-recorded-fill.js +1 -1
- package/dist/src/perf-facade.js +2 -2
- package/dist/src/perf-process-identity.js +1 -0
- package/dist/src/perf-runtime-operation-builder.js +1 -1
- package/dist/src/perf-runtime-plan.js +1 -1
- package/dist/src/perf.js +1 -1
- package/dist/src/physical-device-control.js +1 -1
- package/dist/src/platform-request-scope.js +1 -1
- package/dist/src/platform-runtime-android-adb-host.js +1 -1
- package/dist/src/platform-runtime-app-log-process.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 +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-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 -0
- package/dist/src/png-worker-contract.js +1 -1
- package/dist/src/png.js +1 -0
- package/dist/src/prepare-kind.js +1 -1
- package/dist/src/process.js +1 -1
- package/dist/src/provider-device-runtime.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 -0
- package/dist/src/react-native.js +1 -1
- package/dist/src/record-runtime.js +1 -1
- package/dist/src/rect-center.js +1 -1
- package/dist/src/register-builtins.js +1 -1
- package/dist/src/registry.js +36 -36
- package/dist/src/remote-config2.js +1 -1
- package/dist/src/replay-divergence.js +1 -1
- package/dist/src/replay.js +2 -2
- package/dist/src/reporting.js +9 -8
- package/dist/src/request-admission.js +1 -1
- package/dist/src/request-cancel.js +1 -1
- package/dist/src/request-cancellation.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 +2 -2
- package/dist/src/runner-client.js +1 -1
- package/dist/src/runner-disposal.js +1 -1
- 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 +1 -0
- package/dist/src/runtime2.js +4 -4
- package/dist/src/runtime3.js +1 -1
- package/dist/src/runtime4.js +5 -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-live-handle.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/screenshot-density.js +1 -1
- package/dist/src/screenshot-runtime.js +1 -1
- package/dist/src/screenshot.js +1 -1
- package/dist/src/screenshot3.js +3 -3
- package/dist/src/script.js +1 -1
- 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 +69 -26
- 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 +80 -16
- package/dist/src/sdk-selectors.js +1 -1
- package/dist/src/selection.js +0 -0
- package/dist/src/selector-runtime.js +1 -1
- package/dist/src/selectors.js +1 -1
- package/dist/src/semantic-index.js +1 -1
- package/dist/src/server.js +3 -3
- package/dist/src/session-allocation.js +1 -1
- package/dist/src/session-observation.js +1 -0
- 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 +3 -3
- package/dist/src/session-target-evidence.js +1 -1
- package/dist/src/session2.js +5 -5
- package/dist/src/settings.js +1 -1
- package/dist/src/simulator-boot.js +3 -0
- package/dist/src/simulator.js +1 -1
- package/dist/src/snapshot-quality-backend-capabilities.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 +2 -2
- 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/telemetry.js +1 -1
- package/dist/src/tool-provider.js +2 -2
- package/dist/src/tool-provider2.js +1 -1
- package/dist/src/tool-provider3.js +1 -1
- package/dist/src/toolchain-probe.js +1 -1
- package/dist/src/touch-reference-frame.js +1 -0
- 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/vars.js +2 -0
- 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/viewport.js +1 -0
- package/dist/src/web.js +1 -1
- package/dist/src/web2.js +1 -1
- package/dist/src/webdriver-ios-snapshot.js +1 -1
- package/dist/src/webdriver-source.js +1 -1
- package/dist/src/window-state.js +1 -0
- package/package.json +4 -2
- package/server.json +2 -2
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.0.apk.sha256 +0 -1
- 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 +0 -1
- package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/recording-trim.swift +0 -93
- package/dist/src/platform-runtime-apple-resources.js +0 -1
- package/dist/src/runner-selector-query.js +0 -1
- package/dist/src/snapshot-quality-verdict.js +0 -1
package/dist/src/src8.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,r as t,t as n}from"./rolldown-runtime.js";import{
|
|
1
|
+
import{i as e,r as t,t as n}from"./rolldown-runtime.js";import{C as r,T as i}from"./sdk-contracts.js";import a from"node:path";function o(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}function s(e){return e.trim().toLowerCase().replaceAll(/\s+/g,` `)}function c(e){return[e.label,e.value,e.identifier].find(e=>typeof e==`string`&&e.length>0)?.trim()??``}function l(e={},t={}){let n={...t},i=u(e),a=[],o,s=0,c;return{get values(){return l()},get generation(){return s},get observation(){return c?.generation===s?c:void 0},enter(e={}){let t=f(e);return a.push(t),o=void 0,()=>{if(a.pop()!==t)throw new r(`COMMAND_FAILED`,`Maestro environment scopes were left out of order.`);o=void 0}},merge(e){i={...i,...e},o=void 0},replaceOutput(e){let t={};for(let[e,n]of Object.entries(i))e===`output`||e.startsWith(`output.`)||(t[e]=n);Object.assign(t,e),i=t,o=void 0},recordObservation(e){if(e.generation!==s)throw new r(`COMMAND_FAILED`,`Maestro observation generation ${e.generation} does not match ${s}.`);c=e},invalidateObservation(){s+=1,c=void 0},resolve(e){return d(e,l())},resolveDeferred(e){return d(e,l(),new Set,!1)}};function l(){return o||(o={...a.reduce((e,t)=>({...e,...t}),{...i}),...n},o)}function f(e){let t=u(e),r={};for(let[e,i]of Object.entries(t))r[e]=d(i,{...l(),...t,...r,...n},new Set,!1);return r}}function u(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,String(t)]))}function d(e,t,n=new Set,i=!0){let a=e.replaceAll(/\$\{([A-Za-z_][A-Za-z0-9_.]*)\}/g,(e,a)=>{if(!Object.hasOwn(t,a)){if(!i)return e;throw new r(`INVALID_ARGS`,`Maestro variable "${a}" is not defined.`)}if(n.has(a)){if(!i)return e;throw new r(`INVALID_ARGS`,`Maestro variable "${a}" has a cyclic reference.`)}return d(t[a],t,new Set([...n,a]),i)});return i&&f(a),a}function f(e){for(let t of e.matchAll(/\$\{[^{}]*\}/g))if(!p(t[0]))throw new r(`INVALID_ARGS`,`Maestro interpolation "${t[0]}" is unresolved or unsupported.`)}function p(e){return/^\$\{\s*maestro\.platform\s*(?:==|!=)\s*(['"]).*\1(?:\s*(?:&&|\|\|).*)?\s*\}$/.test(e)}var m=n((e=>{let t=Symbol.for(`yaml.alias`),n=Symbol.for(`yaml.document`),r=Symbol.for(`yaml.map`),i=Symbol.for(`yaml.pair`),a=Symbol.for(`yaml.scalar`),o=Symbol.for(`yaml.seq`),s=Symbol.for(`yaml.node.type`),c=e=>!!e&&typeof e==`object`&&e[s]===t,l=e=>!!e&&typeof e==`object`&&e[s]===n,u=e=>!!e&&typeof e==`object`&&e[s]===r,d=e=>!!e&&typeof e==`object`&&e[s]===i,f=e=>!!e&&typeof e==`object`&&e[s]===a,p=e=>!!e&&typeof e==`object`&&e[s]===o;function m(e){if(e&&typeof e==`object`)switch(e[s]){case r:case o:return!0}return!1}function h(e){if(e&&typeof e==`object`)switch(e[s]){case t:case r:case a:case o:return!0}return!1}e.ALIAS=t,e.DOC=n,e.MAP=r,e.NODE_TYPE=s,e.PAIR=i,e.SCALAR=a,e.SEQ=o,e.hasAnchor=e=>(f(e)||m(e))&&!!e.anchor,e.isAlias=c,e.isCollection=m,e.isDocument=l,e.isMap=u,e.isNode=h,e.isPair=d,e.isScalar=f,e.isSeq=p})),h=n((e=>{var t=m();let n=Symbol(`break visit`),r=Symbol(`skip children`),i=Symbol(`remove node`);function a(e,n){let r=l(n);t.isDocument(e)?o(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):o(null,e,r,Object.freeze([]))}a.BREAK=n,a.SKIP=r,a.REMOVE=i;function o(e,r,a,s){let c=u(e,r,a,s);if(t.isNode(c)||t.isPair(c))return d(e,s,c),o(e,c,a,s);if(typeof c!=`symbol`){if(t.isCollection(r)){s=Object.freeze(s.concat(r));for(let e=0;e<r.items.length;++e){let t=o(e,r.items[e],a,s);if(typeof t==`number`)e=t-1;else if(t===n)return n;else t===i&&(r.items.splice(e,1),--e)}}else if(t.isPair(r)){s=Object.freeze(s.concat(r));let e=o(`key`,r.key,a,s);if(e===n)return n;e===i&&(r.key=null);let t=o(`value`,r.value,a,s);if(t===n)return n;t===i&&(r.value=null)}}return c}async function s(e,n){let r=l(n);t.isDocument(e)?await c(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):await c(null,e,r,Object.freeze([]))}s.BREAK=n,s.SKIP=r,s.REMOVE=i;async function c(e,r,a,o){let s=await u(e,r,a,o);if(t.isNode(s)||t.isPair(s))return d(e,o,s),c(e,s,a,o);if(typeof s!=`symbol`){if(t.isCollection(r)){o=Object.freeze(o.concat(r));for(let e=0;e<r.items.length;++e){let t=await c(e,r.items[e],a,o);if(typeof t==`number`)e=t-1;else if(t===n)return n;else t===i&&(r.items.splice(e,1),--e)}}else if(t.isPair(r)){o=Object.freeze(o.concat(r));let e=await c(`key`,r.key,a,o);if(e===n)return n;e===i&&(r.key=null);let t=await c(`value`,r.value,a,o);if(t===n)return n;t===i&&(r.value=null)}}return s}function l(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function u(e,n,r,i){if(typeof r==`function`)return r(e,n,i);if(t.isMap(n))return r.Map?.(e,n,i);if(t.isSeq(n))return r.Seq?.(e,n,i);if(t.isPair(n))return r.Pair?.(e,n,i);if(t.isScalar(n))return r.Scalar?.(e,n,i);if(t.isAlias(n))return r.Alias?.(e,n,i)}function d(e,n,r){let i=n[n.length-1];if(t.isCollection(i))i.items[e]=r;else if(t.isPair(i))e===`key`?i.key=r:i.value=r;else if(t.isDocument(i))i.contents=r;else{let e=t.isAlias(i)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}e.visit=a,e.visitAsync=s})),g=n((e=>{var t=m(),n=h();let r={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},i=e=>e.replace(/[!,[\]{}]/g,e=>r[e]);var a=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+i(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],i=Object.entries(this.tags),a;if(e&&i.length>0&&t.isNode(e.contents)){let r={};n.visit(e.contents,(e,n)=>{t.isNode(n)&&n.tag&&(r[n.tag]=!0)}),a=Object.keys(r)}else a=[];for(let[t,n]of i)(t!==`!!`||n!==`tag:yaml.org,2002:`)&&(!e||a.some(e=>e.startsWith(n)))&&r.push(`%TAG ${t} ${n}`);return r.join(`
|
|
2
2
|
`)}};a.defaultYaml={explicit:!1,version:`1.2`},a.defaultTags={"!!":`tag:yaml.org,2002:`},e.Directives=a})),_=n((e=>{var t=m(),n=h();function r(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function i(e){let t=new Set;return n.visit(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function a(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function o(e,n){let r=[],o=new Map,s=null;return{onAnchor:t=>{r.push(t),s??=i(e);let o=a(n,s);return s.add(o),o},setAnchors:()=>{for(let e of r){let n=o.get(e);if(typeof n==`object`&&n.anchor&&(t.isScalar(n.node)||t.isCollection(n.node)))n.node.anchor=n.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:o}}e.anchorIsValid=r,e.anchorNames=i,e.createNodeAnchors=o,e.findNewAnchor=a})),v=n((e=>{function t(e,n,r,i){if(i&&typeof i==`object`){if(Array.isArray(i))for(let n=0,r=i.length;n<r;++n){let r=i[n],a=t(e,i,String(n),r);a===void 0?delete i[n]:a!==r&&(i[n]=a)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let r=i.get(n),a=t(e,i,n,r);a===void 0?i.delete(n):a!==r&&i.set(n,a)}else if(i instanceof Set)for(let n of Array.from(i)){let r=t(e,i,n,n);r===void 0?i.delete(n):r!==n&&(i.delete(n),i.add(r))}else for(let[n,r]of Object.entries(i)){let a=t(e,i,n,r);a===void 0?delete i[n]:a!==r&&(i[n]=a)}}return e.call(n,r,i)}e.applyReviver=t})),y=n((e=>{var t=m();function n(e,r,i){if(Array.isArray(e))return e.map((e,t)=>n(e,String(t),i));if(e&&typeof e.toJSON==`function`){if(!i||!t.hasAnchor(e))return e.toJSON(r,i);let n={aliasCount:0,count:1,res:void 0};i.anchors.set(e,n),i.onCreate=e=>{n.res=e,delete i.onCreate};let a=e.toJSON(r,i);return i.onCreate&&i.onCreate(a),a}return typeof e==`bigint`&&!i?.keep?Number(e):e}e.toJS=n})),b=n((e=>{var t=v(),n=m(),r=y();e.NodeBase=class{constructor(e){Object.defineProperty(this,n.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:a,onAnchor:o,reviver:s}={}){if(!n.isDocument(e))throw TypeError(`A document argument is required`);let c={anchors:new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof a==`number`?a:100},l=r.toJS(this,``,c);if(typeof o==`function`)for(let{count:e,res:t}of c.anchors.values())o(t,e);return typeof s==`function`?t.applyReviver(s,{"":l},``,l):l}}})),x=n((e=>{var t=_(),n=h(),r=m(),i=b(),a=y(),o=class extends i.NodeBase{constructor(e){super(r.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let i;t?.aliasResolveCache?i=t.aliasResolveCache:(i=[],n.visit(e,{Node:(e,t)=>{(r.isAlias(t)||r.hasAnchor(t))&&i.push(t)}}),t&&(t.aliasResolveCache=i));let a;for(let e of i){if(e===this)break;e.anchor===this.source&&(a=e)}return a}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,o=this.resolve(r,t);if(!o){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let c=n.get(o);if(c||=(a.toJS(o,null,t),n.get(o)),c?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(c.count+=1,c.aliasCount===0&&(c.aliasCount=s(r,o,n)),c.count*c.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return c.res}toString(e,n,r){let i=`*${this.source}`;if(e){if(t.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${i} `}return i}};function s(e,t,n){if(r.isAlias(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(r.isCollection(t)){let r=0;for(let i of t.items){let t=s(e,i,n);t>r&&(r=t)}return r}if(r.isPair(t)){let r=s(e,t.key,n),i=s(e,t.value,n);return Math.max(r,i)}return 1}e.Alias=o})),S=n((e=>{var t=m(),n=b(),r=y();let i=e=>!e||typeof e!=`function`&&typeof e!=`object`;var a=class extends n.NodeBase{constructor(e){super(t.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:r.toJS(this.value,e,t)}toString(){return String(this.value)}};a.BLOCK_FOLDED=`BLOCK_FOLDED`,a.BLOCK_LITERAL=`BLOCK_LITERAL`,a.PLAIN=`PLAIN`,a.QUOTE_DOUBLE=`QUOTE_DOUBLE`,a.QUOTE_SINGLE=`QUOTE_SINGLE`,e.Scalar=a,e.isScalarValue=i})),C=n((e=>{var t=x(),n=m(),r=S();function i(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function a(e,a,o){if(n.isDocument(e)&&(e=e.contents),n.isNode(e))return e;if(n.isPair(e)){let t=o.schema[n.MAP].createNode?.(o.schema,null,o);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:s,onAnchor:c,onTagObj:l,schema:u,sourceObjects:d}=o,f;if(s&&e&&typeof e==`object`){if(f=d.get(e),f)return f.anchor??(f.anchor=c(e)),new t.Alias(f.anchor);f={anchor:null,node:null},d.set(e,f)}a?.startsWith(`!!`)&&(a=`tag:yaml.org,2002:`+a.slice(2));let p=i(e,a,u.tags);if(!p){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new r.Scalar(e);return f&&(f.node=t),t}p=e instanceof Map?u[n.MAP]:Symbol.iterator in Object(e)?u[n.SEQ]:u[n.MAP]}l&&(l(p),delete o.onTagObj);let m=p?.createNode?p.createNode(o.schema,e,o):typeof p?.nodeClass?.from==`function`?p.nodeClass.from(o.schema,e,o):new r.Scalar(e);return a?m.tag=a:p.default||(m.tag=p.tag),f&&(f.node=m),m}e.createNode=a})),w=n((e=>{var t=C(),n=m(),r=b();function i(e,n,r){let i=r;for(let e=n.length-1;e>=0;--e){let t=n[e];if(typeof t==`number`&&Number.isInteger(t)&&t>=0){let e=[];e[t]=i,i=e}else i=new Map([[t,i]])}return t.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}let a=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;e.Collection=class extends r.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>n.isNode(t)||n.isPair(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(a(e))this.add(t);else{let[r,...a]=e,o=this.get(r,!0);if(n.isCollection(o))o.addIn(a,t);else if(o===void 0&&this.schema)this.set(r,i(this.schema,a,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${a}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let i=this.get(t,!0);if(n.isCollection(i))return i.deleteIn(r);throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...i]=e,a=this.get(r,!0);return i.length===0?!t&&n.isScalar(a)?a.value:a:n.isCollection(a)?a.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!n.isPair(t))return!1;let r=t.value;return r==null||e&&n.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let i=this.get(t,!0);return n.isCollection(i)?i.hasIn(r):!1}setIn(e,t){let[r,...a]=e;if(a.length===0)this.set(r,t);else{let e=this.get(r,!0);if(n.isCollection(e))e.setIn(a,t);else if(e===void 0&&this.schema)this.set(r,i(this.schema,a,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${a}`)}}},e.collectionFromPath=i,e.isEmptyPath=a})),T=n((e=>{let t=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function n(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}e.indentComment=n,e.lineComment=(e,t,r)=>e.endsWith(`
|
|
3
3
|
`)?n(r,t):r.includes(`
|
|
4
4
|
`)?`
|
|
@@ -112,4 +112,4 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
112
112
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
113
113
|
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){u(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey){if(!t.sep){if(a(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=l(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(a(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(s(t.key)&&!a(t.sep,`newline`)){let e=l(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):a(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!a(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){u(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||a(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=l(c(t));d(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
|
|
114
114
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
115
|
-
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=l(c(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=l(c(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),Xe=n((e=>{var t=He(),n=Ee(),r=De(),i=re(),a=m(),o=Je(),s=Ye();function c(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function l(e,n={}){let{lineCounter:i,prettyErrors:a}=c(n),o=new s.Parser(i?.addNewLine),l=new t.Composer(n),u=Array.from(l.compose(o.parse(e)));if(a&&i)for(let t of u)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return u.length>0?u:Object.assign([],{empty:!0},l.streamInfo())}function u(e,n={}){let{lineCounter:i,prettyErrors:a}=c(n),o=new s.Parser(i?.addNewLine),l=new t.Composer(n),u=null;for(let t of l.compose(o.parse(e),!0,e.length))if(!u)u=t;else if(u.options.logLevel!==`silent`){u.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(u.errors.forEach(r.prettifyError(e,i)),u.warnings.forEach(r.prettifyError(e,i))),u}function d(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=u(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function f(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=d,e.parseAllDocuments=l,e.parseDocument=u,e.stringify=f})),Ze=n((e=>{var t=He(),n=Ee(),r=we(),i=De(),a=x(),o=m(),s=D(),c=S(),l=O(),u=A();Ke();var d=qe(),f=Je(),p=Ye(),g=Xe(),_=h();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=g.parse,e.parseAllDocuments=g.parseAllDocuments,e.parseDocument=g.parseDocument,e.stringify=g.stringify,e.visit=_.visit,e.visitAsync=_.visitAsync})),P=Ze();function F(e,t){return Qe(e?.range?.[0],t)}function Qe(e,t){let n=t.lineCounter.linePos(e!==void 0&&e>=0?e:0).line;return t.sourcePath===void 0?{line:n}:{path:t.sourcePath,line:n}}function $e(e){return`${e.path===void 0?``:`${e.path}:`}line ${e.line}`}function I(e,t,n){throw new i(`INVALID_ARGS`,`${e} (${$e(F(t,n))})`)}function L(e,t,n){(0,P.isMap)(e)||I(`Maestro ${t} expects a map.`,e,n);let r=[];for(let i of e.items){let e=i.key;(0,P.isScalar)(e)||I(`Maestro ${t} map keys must be strings.`,void 0,n);let a=e.value;typeof a!=`string`&&typeof a!=`number`&&typeof a!=`boolean`&&I(`Maestro ${t} map keys must be strings.`,e,n),i.value!==null&&!(0,P.isNode)(i.value)&&I(`Maestro ${t} values must be YAML nodes.`,e,n),r.push({key:String(a),keyNode:e,value:i.value})}return r}function et(e,t,n){return(0,P.isSeq)(e)||I(`Maestro ${t} expects a list.`,e,n),e.items}function tt(e,t,n){return et(e,t,n).map((e,r)=>G(e,`${t}[${r}]`,n))}function R(e,t,n,r){let i=new Set(n),a=new Set;for(let n of e)a.has(n.key)&&I(`Maestro ${t} contains duplicate field "${n.key}".`,n.keyNode,r),a.add(n.key),i.has(n.key)||I(`Maestro ${t} field "${n.key}" is not supported.`,n.keyNode,r)}function z(e,t){return e.some(e=>e.key===t)}function B(e,t){return e.find(e=>e.key===t)?.value}function V(e,t,n){return z(e,t)?n(B(e,t)):void 0}function H(e,t,n){return o({optional:V(e,`optional`,e=>q(e,`${t}.optional`,n))})}function U(e){return e===null||(0,P.isScalar)(e)&&e.value===null}function W(e,t,n){if(e==null)return null;(0,P.isScalar)(e)||I(`Maestro ${t} expects a scalar value.`,e,n);let r=e.value;if(r===null||typeof r==`string`||typeof r==`number`||typeof r==`boolean`)return r;I(`Maestro ${t} contains an unsupported scalar value.`,e,n)}function G(e,t,n){let r=W(e,t,n);return typeof r!=`string`&&I(`Maestro ${t} expects a string.`,e,n),r}function K(e,t,n){let r=W(e,t,n);if(r!==null)return typeof r!=`string`&&I(`Maestro ${t} expects a string.`,e,n),r}function q(e,t,n){let r=W(e,t,n);if(r!==null)return typeof r!=`boolean`&&I(`Maestro ${t} expects a boolean.`,e,n),r}const nt=/^\$\{[A-Za-z_][A-Za-z0-9_.]*\}$/,rt=/^-?\d+(\.\d+)?$/,it=/^-?\d+$/,at={"tapOn.index":{integer:!0,nonNegative:!0},"tapOn.repeat":{integer:!0,positive:!0},"tapOn.delay":{integer:!0,nonNegative:!0},"doubleTapOn.delay":{integer:!0,nonNegative:!0},eraseText:{integer:!0,positive:!0},"eraseText.charactersToErase":{integer:!0,positive:!0},"extendedWaitUntil.timeout":{nonNegative:!0},"scrollUntilVisible.timeout":{nonNegative:!0},waitForAnimationToEnd:{nonNegative:!0},"waitForAnimationToEnd.timeout":{nonNegative:!0},"swipe.duration":{nonNegative:!0},"repeat.times":{integer:!0,nonNegative:!0},"retry.maxRetries":{integer:!0,nonNegative:!0}};function ot(e){return e.positive&&e.integer?`a positive integer`:e.positive?`a positive number`:e.nonNegative&&e.integer?`a non-negative integer`:e.nonNegative?`a non-negative finite number`:e.integer?`an integer`:`a finite number`}function st(e,t,n,r,i){let a=`Maestro ${t} expects ${ot(i)} or a variable expression.`;Number.isFinite(e)||I(a,n,r),Math.abs(e)>2**53-1&&I(a,n,r),i.integer&&!Number.isSafeInteger(e)&&I(a,n,r),i.nonNegative&&e<0&&I(a,n,r),i.positive&&e<=0&&I(a,n,r)}function ct(e,t,n,r,i){if(typeof e==`number`)return st(e,t,n,r,i),e;if(typeof e==`string`){if(nt.test(e))return e;if((i.integer?it:rt).test(e)){let a=Number(e);return st(a,t,n,r,i),a}}I(`Maestro ${t} expects ${ot(i)} or a variable expression.`,n,r)}function J(e,t,n,r=at[t]??{}){let i=W(e,t,n);if(i!==null)return ct(i,t,e,n,r)}function lt(e,t,n){let r=at[t]??{},i=W(e,t,n);return i===null&&I(`Maestro ${t} expects ${ot(r)} or a variable expression.`,e,n),ct(i,t,e,n,r)}function ut(e,t,n){let r=W(e,t,n);return r===null&&I(`Maestro ${t} requires a condition.`,e,n),typeof r==`string`&&r.includes("${")&&!nt.test(r)&&I(`Maestro ${t} only supports a literal value or a bare \${VAR} lookup; JavaScript expressions are not supported — compute it in a runScript and reference \${output.x}.`,e,n),r}function dt(e,t,n){let r=L(e,t,n),i={};for(let e of r){let r=W(e.value,`${t}.${e.key}`,n);r===null&&I(`Maestro ${t}.${e.key} expects a string, number, or boolean.`,e.value,n),i[e.key]=r}return i}function Y(e,t,n){return V(e,`label`,e=>K(e,`${t}.label`,n))}const X=[`id`,`text`,`enabled`,`selected`,`index`,`childOf`,`below`,`above`,`leftOf`,`rightOf`,`containsChild`,`containsDescendants`],ft={textKeys:[`id`,`text`],booleanKeys:[`enabled`,`selected`],textAliases:{label:`text`}},pt={id:(e,t,n,r)=>_t(e,`id`,t,n,r),text:(e,t,n,r)=>_t(e,`text`,t,n,r),enabled:(e,t,n,r)=>vt(e,`enabled`,t,n,r),selected:(e,t,n,r)=>vt(e,`selected`,t,n,r),index:(e,t,n,r)=>{e.index=J(t.value,`${n}.index`,r,{integer:!0,nonNegative:!0})},childOf:(e,t,n,r)=>{e.childOf=Z(t.value,`${n}.childOf`,r)},below:(e,t,n,r)=>{e.below=Z(t.value,`${n}.below`,r)},above:(e,t,n,r)=>{e.above=Z(t.value,`${n}.above`,r)},leftOf:(e,t,n,r)=>{e.leftOf=Z(t.value,`${n}.leftOf`,r)},rightOf:(e,t,n,r)=>{e.rightOf=Z(t.value,`${n}.rightOf`,r)},containsChild:(e,t,n,r)=>{e.containsChild=Z(t.value,`${n}.containsChild`,r)},containsDescendants:(e,t,n,r)=>{e.containsDescendants=et(t.value,`${n}.containsDescendants`,r).map(e=>Z(e,`${n}.containsDescendants`,r))},optional:(e,t,n,r)=>vt(e,`optional`,t,n,r)};function Z(e,t,n,r=X){if((0,P.isScalar)(e))return{text:G(e,t,n)};let i=L(e,t,n);return R(i,t,r,n),mt(i,t,n)}function mt(e,t,n){e.length===0&&I(`Maestro ${t} selector is empty.`,void 0,n);let r={};for(let i of e){let e=pt[i.key];e||I(`Maestro ${t} selector field "${i.key}" is not supported.`,i.keyNode,n),e(r,i,t,n)}return Object.keys(r).filter(e=>e!==`optional`).length===0&&I(`Maestro ${t} selector must contain a selector value.`,e[0]?.keyNode,n),r}function ht(e,t,n,r){let i=F(t,n);if((0,P.isScalar)(e))return{source:i,entries:[],target:bt(Z(e,r.name,n,r.selectorKeys))};let a=L(e,r.name,n),o=z(a,`point`);if(R(a,r.name,o?r.pointAllowedKeys:r.selectorAllowedKeys,n),o){let e=r.pointConflictingSelectorKeys??r.selectorKeys;return a.some(t=>yt(t.key,e))&&I(`Maestro ${r.name}.point cannot be combined with a selector.`,t,n),{source:i,entries:a,target:r.parsePoint(B(a,`point`),`${r.name}.point`,n)}}return{source:i,entries:a,target:bt(mt(a.filter(e=>yt(e.key,r.selectorKeys)),r.name,n))}}function Q(e,t,n){let r=G(e,t,n),i=/^\s*(\d+)\s*,\s*(\d+)\s*$/.exec(r);if(i)return{space:`absolute`,x:Number(i[1]),y:Number(i[2])};let a=/^\s*(\d+)%\s*,\s*(\d+)%\s*$/.exec(r);if(a){let r=Number(a[1]),i=Number(a[2]);return(r>100||i>100)&&I(`Maestro ${t} percentage coordinates must be between 0% and 100%.`,e,n),{space:`percent`,x:r,y:i}}/^\s*\d+(?:\.\d+)?%\s*,\s*\d+(?:\.\d+)?%\s*$/.test(r)&&I(`Maestro ${t} percentage coordinates must be whole numbers.`,e,n),I(`Maestro ${t} expects absolute or percentage coordinates.`,e,n)}function gt(e,t,n){let r=Q(e,t,n);return r.space!==`absolute`&&I(`Maestro ${t} only supports absolute coordinates.`,e,n),r}function _t(e,t,n,r,i){let a=K(n.value,`${r}.${t}`,i);a!==void 0&&(e[t]=a)}function vt(e,t,n,r,i){let a=q(n.value,`${r}.${t}`,i);a!==void 0&&(e[t]=a)}function yt(e,t){return t.includes(e)}function bt(e){return{space:`target`,selector:e}}function xt(e,t,n){let r=ht(e,t,n,{name:`tapOn`,selectorKeys:X,pointConflictingSelectorKeys:X,pointAllowedKeys:[`point`,`retryTapIfNoChange`,`repeat`,`delay`,`optional`,`label`],selectorAllowedKeys:[...X,`retryTapIfNoChange`,`repeat`,`delay`,`optional`,`label`],parsePoint:Q});if(r.entries.length===0)return{kind:`tapOn`,source:r.source,target:r.target};if(r.target.space!==`target`)return{kind:`tapOn`,source:r.source,target:r.target,...Ot(r.entries,n)};let i=Ot(r.entries,n);return o({kind:`tapOn`,source:r.source,target:r.target,...i})}function St(e,t,n){let r=ht(e,t,n,{name:`doubleTapOn`,selectorKeys:X,pointAllowedKeys:[`point`,`delay`,`optional`,`label`],selectorAllowedKeys:[...X,`delay`,`optional`,`label`],parsePoint:gt}),i=H(r.entries,`doubleTapOn`,n),a=z(r.entries,`delay`)?J(B(r.entries,`delay`),`doubleTapOn.delay`,n):void 0,s=Y(r.entries,`doubleTapOn`,n);return o({kind:`doubleTapOn`,source:r.source,target:r.target,...i,delay:a,label:s})}function Ct(e,t,n){let r=ht(e,t,n,{name:`longPressOn`,selectorKeys:X,pointAllowedKeys:[`point`,`optional`,`label`],selectorAllowedKeys:[...X,`optional`,`label`],parsePoint:gt});return o({kind:`longPressOn`,source:r.source,target:r.target,...H(r.entries,`longPressOn`,n),label:Y(r.entries,`longPressOn`,n)})}function wt(e,t,n){let r=F(t,n),i=L(e,`swipe`,n);R(i,`swipe`,[`start`,`end`,`direction`,`duration`,`from`,`label`,`optional`],n);let a=H(i,`swipe`,n),o=Y(i,`swipe`,n),s=z(i,`duration`)?J(B(i,`duration`),`swipe.duration`,n):void 0;if(z(i,`start`)||z(i,`end`))return{...Tt(i,r,s,t,n),...a,label:o};let c=z(i,`direction`)?kt(B(i,`direction`),`swipe.direction`,n):void 0;return z(i,`from`)?{...Et(i,r,c,s,t,n),...a,label:o}:{...Dt(r,c,s,t,n),...a,label:o}}function Tt(e,t,n,r,i){z(e,`direction`)&&I(`Maestro swipe cannot combine direction with start/end coordinates.`,r,i),(!z(e,`start`)||!z(e,`end`))&&I(`Maestro swipe requires both start and end coordinates.`,r,i);let a=Q(B(e,`start`),`swipe.start`,i),s=Q(B(e,`end`),`swipe.end`,i);return a.space!==s.space&&I(`Maestro swipe start/end must use the same coordinate space.`,r,i),{kind:`swipe`,source:t,gesture:o({kind:`coordinates`,start:a,end:s,duration:n})}}function Et(e,t,n,r,i,a){return n===void 0&&I(`Maestro target swipe requires direction.`,i,a),{kind:`swipe`,source:t,gesture:o({kind:`target`,from:Z(B(e,`from`),`swipe.from`,a),direction:n,duration:r})}}function Dt(e,t,n,r,i){return t===void 0&&I(`Maestro swipe requires direction, target, or start/end coordinates.`,r,i),{kind:`swipe`,source:e,gesture:o({kind:`screen`,direction:t,duration:n})}}function Ot(e,t){let n=V(e,`retryTapIfNoChange`,e=>q(e,`tapOn.retryTapIfNoChange`,t)),r=V(e,`repeat`,e=>lt(e,`tapOn.repeat`,t)),i=V(e,`delay`,e=>J(e,`tapOn.delay`,t)),a=H(e,`tapOn`,t).optional;return o({retryTapIfNoChange:n,repeat:r,delay:i,optional:a,label:Y(e,`tapOn`,t)})}function kt(e,t,n){let r=G(e,t,n).toLowerCase();if(r===`up`||r===`down`||r===`left`||r===`right`)return r;I(`Maestro ${t} must be UP, DOWN, LEFT, or RIGHT.`,e,n)}function At(e,t,n,r){let i=F(n,r);if((0,P.isScalar)(t))return{kind:e,source:i,target:Z(t,e,r)};let a=L(t,e,r);R(a,e,[...X,`optional`,`label`],r);let s=H(a,e,r),c=Y(a,e,r);return o({kind:e,source:i,target:mt(a.filter(e=>e.key!==`optional`&&e.key!==`label`),e,r),...s,label:c})}const jt=[...X,`optional`];function Mt(e,t,n,r){if(!z(e,t))return;let{optional:i,...a}=Z(B(e,t),n,r,jt);return{selector:a,optional:i}}function Nt(e,t,n){let r=Mt(e,`visible`,`extendedWaitUntil.visible`,n),i=Mt(e,`notVisible`,`extendedWaitUntil.notVisible`,n);return r&&i&&I(`Maestro extendedWaitUntil cannot specify both visible and notVisible.`,t,n),!r&&!i&&I(`Maestro extendedWaitUntil requires visible or notVisible.`,t,n),r?{key:`visible`,selector:r.selector,optional:r.optional}:{key:`notVisible`,selector:i.selector,optional:i.optional}}function Pt(e,t,n){let r=F(t,n);if((0,P.isScalar)(e))return{kind:`runScript`,source:r,file:G(e,`runScript`,n)};let i=L(e,`runScript`,n);return R(i,`runScript`,[`file`,`env`],n),z(i,`file`)||I(`Maestro runScript requires a file.`,t,n),o({kind:`runScript`,source:r,file:G(B(i,`file`),`runScript.file`,n),env:z(i,`env`)?dt(B(i,`env`),`runScript.env`,n):void 0})}function Ft(e,t,n,r){let i=F(t,n);if((0,P.isScalar)(e))return{kind:`runFlow`,source:i,include:{kind:`file`,path:G(e,`runFlow`,n)}};let a=L(e,`runFlow`,n);R(a,`runFlow`,[`file`,`commands`,`env`,`when`,`label`],n);let s=z(a,`file`);return s===z(a,`commands`)&&I(`Maestro runFlow requires exactly one of file or commands.`,t,n),o({kind:`runFlow`,source:i,include:s?{kind:`file`,path:G(B(a,`file`),`runFlow.file`,n)}:{kind:`commands`,commands:r(B(a,`commands`),`runFlow.commands`,n)},env:z(a,`env`)?dt(B(a,`env`),`runFlow.env`,n):void 0,when:z(a,`when`)?Rt(B(a,`when`),n):void 0,label:Y(a,`runFlow`,n)})}function It(e,t,n,r){let i=F(t,n),a=L(e,`repeat`,n);return R(a,`repeat`,[`times`,`commands`,`while`],n),z(a,`while`)&&I(`Maestro repeat.while is not supported; use repeat.times.`,B(a,`while`),n),z(a,`times`)||I(`Maestro repeat requires times.`,t,n),z(a,`commands`)||I(`Maestro repeat requires commands.`,t,n),{kind:`repeat`,source:i,times:lt(B(a,`times`),`repeat.times`,n),commands:r(B(a,`commands`),`repeat.commands`,n)}}function Lt(e,t,n,r){let i=F(t,n),a=L(e,`retry`,n);R(a,`retry`,[`maxRetries`,`commands`],n),z(a,`commands`)||I(`Maestro retry requires commands.`,t,n);let s=z(a,`maxRetries`)?lt(B(a,`maxRetries`),`retry.maxRetries`,n):void 0;return o({kind:`retry`,source:i,commands:r(B(a,`commands`),`retry.commands`,n),maxRetries:s})}function Rt(e,t){let n=L(e,`runFlow.when`,t);return R(n,`runFlow.when`,[`platform`,`visible`,`notVisible`,`true`],t),n.length===0&&I(`Maestro runFlow.when cannot be empty.`,e,t),o({platform:V(n,`platform`,e=>Bt(e,t)),visible:V(n,`visible`,e=>Z(e,`runFlow.when.visible`,t)),notVisible:V(n,`notVisible`,e=>Z(e,`runFlow.when.notVisible`,t)),true:V(n,`true`,e=>zt(e,t))})}function zt(e,t){let n=W(e,`runFlow.when.true`,t);if(typeof n==`boolean`||typeof n==`string`)return n;I(`Maestro runFlow.when.true expects a boolean or expression string.`,e,t)}function Bt(e,t){let n=G(e,`runFlow.when.platform`,t).toLowerCase();if(n===`android`||n===`ios`||n===`web`)return n;I(`Maestro runFlow.when.platform expects Android, iOS, or Web.`,e,t)}function $(e,t,n){return et(e,t,n).map(e=>Vt(e,n))}function Vt(e,t){if((0,P.isScalar)(e))return typeof e.value!=`string`&&I(`Maestro command names must be strings.`,e,t),Ht(e.value,e,t);(0,P.isMap)(e)||I(`Maestro commands must be a scalar or one-key map.`,e,t);let n=L(e,`command`,t);n.length!==1&&I(`Maestro command maps must contain exactly one command.`,e,t);let r=n[0];return Wt(r.key,r.value,e,t)}function Ht(e,t,n){return Wt(e,null,t,n)}const Ut={launchApp:Gt,tapOn:xt,doubleTapOn:St,longPressOn:Ct,inputText:Kt,eraseText:qt,openLink:Jt,assertVisible:(e,t,n)=>At(`assertVisible`,e,t,n),assertNotVisible:(e,t,n)=>At(`assertNotVisible`,e,t,n),assertTrue:Yt,extendedWaitUntil:Xt,takeScreenshot:Zt,scroll:Qt,scrollUntilVisible:$t,swipe:wt,hideKeyboard:en,pressKey:tn,back:nn,waitForAnimationToEnd:rn,stopApp:an,clearState:on,runScript:Pt,runFlow:(e,t,n)=>Ft(e,t,n,$),repeat:(e,t,n)=>It(e,t,n,$),retry:(e,t,n)=>Lt(e,t,n,$)};Object.keys(Ut);function Wt(e,t,n,r){let i=Ut[e];return i||I(`Maestro command "${e}" is not supported.`,n,r),i(t,n,r)}function Gt(e,t,n){let r=F(t,n);if(U(e))return{kind:`launchApp`,source:r};if((0,P.isScalar)(e))return{kind:`launchApp`,source:r,appId:G(e,`launchApp`,n)};let i=L(e,`launchApp`,n);return R(i,`launchApp`,[`appId`,`stopApp`,`clearState`,`arguments`,`launchArguments`],n),o({kind:`launchApp`,source:r,appId:V(i,`appId`,e=>K(e,`launchApp.appId`,n)),stopApp:V(i,`stopApp`,e=>q(e,`launchApp.stopApp`,n)),clearState:V(i,`clearState`,e=>q(e,`launchApp.clearState`,n)),arguments:V(i,`arguments`,e=>sn(e,`launchApp.arguments`,n)),launchArguments:V(i,`launchArguments`,e=>sn(e,`launchApp.launchArguments`,n))})}function Kt(e,t,n){let r=F(t,n);if((0,P.isScalar)(e))return{kind:`inputText`,source:r,text:G(e,`inputText`,n)};let i=L(e,`inputText`,n);return R(i,`inputText`,[`text`,`label`],n),z(i,`text`)||I(`Maestro inputText requires text.`,t,n),o({kind:`inputText`,source:r,text:G(B(i,`text`),`inputText.text`,n),label:Y(i,`inputText`,n)})}function qt(e,t,n){let r=F(t,n);if(U(e))return{kind:`eraseText`,source:r};if((0,P.isScalar)(e))return{kind:`eraseText`,source:r,charactersToErase:lt(e,`eraseText`,n)};let i=L(e,`eraseText`,n);return R(i,`eraseText`,[`charactersToErase`],n),o({kind:`eraseText`,source:r,charactersToErase:z(i,`charactersToErase`)?J(B(i,`charactersToErase`),`eraseText.charactersToErase`,n):void 0})}function Jt(e,t,n){let r=F(t,n);if((0,P.isScalar)(e))return{kind:`openLink`,source:r,link:G(e,`openLink`,n)};let i=L(e,`openLink`,n);return R(i,`openLink`,[`link`],n),{kind:`openLink`,source:r,link:G(B(i,`link`),`openLink.link`,n)}}function Yt(e,t,n){let r=F(t,n);if(U(e)&&I(`Maestro assertTrue requires condition.`,t,n),(0,P.isScalar)(e))return{kind:`assertTrue`,source:r,condition:ut(e,`assertTrue`,n)};let i=L(e,`assertTrue`,n);R(i,`assertTrue`,[`condition`,`optional`,`label`],n),z(i,`condition`)||I(`Maestro assertTrue requires condition.`,t,n);let a=ut(B(i,`condition`),`assertTrue.condition`,n),s=H(i,`assertTrue`,n),c=Y(i,`assertTrue`,n);return o({kind:`assertTrue`,source:r,condition:a,...s,label:c})}function Xt(e,t,n){let r=L(e,`extendedWaitUntil`,n);R(r,`extendedWaitUntil`,[`visible`,`notVisible`,`timeout`,`optional`,`label`],n);let i=H(r,`extendedWaitUntil`,n),a=Y(r,`extendedWaitUntil`,n),s=Nt(r,t,n),c=z(r,`timeout`)?J(B(r,`timeout`),`extendedWaitUntil.timeout`,n):void 0,l=i.optional===!0||s.optional===!0||void 0,u={kind:`extendedWaitUntil`,source:F(t,n),timeout:c,optional:l,label:a};return u[s.key]=s.selector,o(u)}function Zt(e,t,n){return{kind:`takeScreenshot`,source:F(t,n),path:G(e,`takeScreenshot`,n)}}function Qt(e,t,n){return U(e)||I(`Maestro scroll does not accept options yet.`,t,n),{kind:`scroll`,source:F(t,n)}}function $t(e,t,n){let r=F(t,n);if((0,P.isScalar)(e))return{kind:`scrollUntilVisible`,source:r,element:Z(e,`scrollUntilVisible.element`,n)};let i=L(e,`scrollUntilVisible`,n);R(i,`scrollUntilVisible`,[`element`,`direction`,`timeout`,`optional`,`label`],n);let a=H(i,`scrollUntilVisible`,n),s=Y(i,`scrollUntilVisible`,n),c=Mt(i,`element`,`scrollUntilVisible.element`,n);c||I(`Maestro scrollUntilVisible requires element.`,t,n);let l=z(i,`direction`)?kt(B(i,`direction`),`scrollUntilVisible.direction`,n):void 0,u=z(i,`timeout`)?J(B(i,`timeout`),`scrollUntilVisible.timeout`,n):void 0,d=a.optional===!0||c.optional===!0||void 0;return o({kind:`scrollUntilVisible`,source:r,element:c.selector,direction:l,timeout:u,optional:d,label:s})}function en(e,t,n){return U(e)||I(`Maestro hideKeyboard does not accept options.`,t,n),{kind:`hideKeyboard`,source:F(t,n)}}function tn(e,t,n){let r=G(e,`pressKey`,n).toLowerCase();return r!==`back`&&r!==`enter`&&r!==`return`&&r!==`home`&&I(`Maestro pressKey "${r}" is not supported.`,e,n),{kind:`pressKey`,source:F(t,n),key:r}}function nn(e,t,n){return U(e)||I(`Maestro back does not accept options.`,t,n),{kind:`back`,source:F(t,n)}}function rn(e,t,n){let r=F(t,n);if(U(e))return{kind:`waitForAnimationToEnd`,source:r};if((0,P.isScalar)(e))return o({kind:`waitForAnimationToEnd`,source:r,timeout:J(e,`waitForAnimationToEnd`,n)});let i=L(e,`waitForAnimationToEnd`,n);return R(i,`waitForAnimationToEnd`,[`timeout`],n),o({kind:`waitForAnimationToEnd`,source:r,timeout:z(i,`timeout`)?J(B(i,`timeout`),`waitForAnimationToEnd.timeout`,n):void 0})}function an(e,t,n){let r=F(t,n);return U(e)?{kind:`stopApp`,source:r}:{kind:`stopApp`,source:r,appId:G(e,`stopApp`,n)}}function on(e,t,n){let r=F(t,n);return U(e)?{kind:`clearState`,source:r}:{kind:`clearState`,source:r,appId:G(e,`clearState`,n)}}function sn(e,t,n){if((0,P.isSeq)(e))return{kind:`list`,values:et(e,t,n).map((e,r)=>{let i=W(e,`${t}[${r}]`,n);return i===null&&I(`${t}[${r}] expects a scalar value.`,e,n),i})};if((0,P.isMap)(e))return{kind:`map`,values:dt(e,t,n)};let r=W(e,t,n);return r===null&&I(`${t} expects a scalar, list, or map.`,e,n),{kind:`scalar`,value:r}}function cn(e,t={}){let n=new P.LineCounter,r=o({lineCounter:n,sourcePath:t.sourcePath}),a=(0,P.parseAllDocuments)(e,{lineCounter:n});for(let e of a)if(e.errors.length>0){let t=e.errors[0],n=t?.message??`Invalid Maestro YAML flow.`,a=Qe(t?.pos[0],r);throw new i(`INVALID_ARGS`,`Invalid Maestro YAML flow: ${n} (${$e(a)})`)}let s=a.map(e=>e.contents).filter(e=>e!==null);s.length===0&&I(`Maestro flow is empty.`,void 0,r);let c,l;s.length===1&&(0,P.isSeq)(s[0])?l=s[0]:s.length===2&&(0,P.isMap)(s[0])&&(0,P.isSeq)(s[1])?(c=s[0],l=s[1]):I(`Maestro flow must contain a command list, optionally preceded by one config document.`,s[0],r);let u=c?ln(c,r):{};return{kind:`program`,source:F(c??l,r),config:u,commands:$(l,`commands`,r)}}function ln(e,t){let n=L(e,`flow config`,t);return R(n,`flow config`,[`name`,`appId`,`tags`,`env`,`onFlowStart`,`onFlowComplete`],t),o({name:V(n,`name`,e=>K(e,`name`,t)),appId:V(n,`appId`,e=>K(e,`appId`,t)),tags:V(n,`tags`,e=>tt(e,`tags`,t)),env:V(n,`env`,e=>dt(e,`env`,t)),onFlowStart:V(n,`onFlowStart`,e=>$(e,`onFlowStart`,t)),onFlowComplete:V(n,`onFlowComplete`,e=>$(e,`onFlowComplete`,t))})}function un(e,t){let n=new Map;return async(i,a,o)=>{if(o?.aborted)throw r();let s=dn(i,a,e),c=n.get(s);if(c)return c;let l=cn(t(s),{sourcePath:s});return n.set(s,l),l}}function dn(e,t,n){let r=t?a.dirname(t):n;return a.resolve(r,e)}function fn(e){let t={[e.entryPath]:e.entrySource},n=pn(e.entrySource,e.entryPath);return n&&mn({program:n,sourcePath:e.entryPath,context:l({},{...e.env}),files:t,readSource:e.readSource}),t}function pn(e,t){try{return cn(e,{sourcePath:t})}catch{return}}function mn(e){let t=e.context.enter(e.program.config.env??{});try{hn([...e.program.config.onFlowStart??[],...e.program.commands,...e.program.config.onFlowComplete??[]],e)}finally{t()}}function hn(e,t){for(let n of e){if(n.kind===`repeat`||n.kind===`retry`){hn(n.commands,t);continue}if(n.kind!==`runFlow`)continue;let e=t.context.enter(n.env??{});try{if(n.include.kind===`commands`){hn(n.include.commands,t);continue}gn(n.include.path,t)}finally{e()}}}function gn(e,t){let n=t.context.resolveDeferred(e);if(n.includes("${"))return;let r=dn(n,t.sourcePath,t.sourcePath);if(t.files[r]!==void 0)return;let i=t.readSource(r);if(i===void 0)return;t.files[r]=i;let a=pn(i,r);a&&mn({...t,program:a,sourcePath:r})}var _n=t({MAESTRO_COMPATIBILITY_ADR_URL:()=>MAESTRO_COMPATIBILITY_ADR_URL,MAESTRO_COMPATIBILITY_ISSUE_URL:()=>MAESTRO_COMPATIBILITY_ISSUE_URL,collectMaestroFlowSources:()=>fn});export{at as a,l as c,o as d,ft as i,c as l,un as n,ot as o,cn as r,Ze as s,_n as t,s as u};
|
|
115
|
+
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=l(c(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=l(c(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),Xe=n((e=>{var t=He(),n=Ee(),r=De(),i=re(),a=m(),o=Je(),s=Ye();function c(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function l(e,n={}){let{lineCounter:i,prettyErrors:a}=c(n),o=new s.Parser(i?.addNewLine),l=new t.Composer(n),u=Array.from(l.compose(o.parse(e)));if(a&&i)for(let t of u)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return u.length>0?u:Object.assign([],{empty:!0},l.streamInfo())}function u(e,n={}){let{lineCounter:i,prettyErrors:a}=c(n),o=new s.Parser(i?.addNewLine),l=new t.Composer(n),u=null;for(let t of l.compose(o.parse(e),!0,e.length))if(!u)u=t;else if(u.options.logLevel!==`silent`){u.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(u.errors.forEach(r.prettifyError(e,i)),u.warnings.forEach(r.prettifyError(e,i))),u}function d(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=u(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function f(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=d,e.parseAllDocuments=l,e.parseDocument=u,e.stringify=f})),Ze=n((e=>{var t=He(),n=Ee(),r=we(),i=De(),a=x(),o=m(),s=D(),c=S(),l=O(),u=A();Ke();var d=qe(),f=Je(),p=Ye(),g=Xe(),_=h();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=g.parse,e.parseAllDocuments=g.parseAllDocuments,e.parseDocument=g.parseDocument,e.stringify=g.stringify,e.visit=_.visit,e.visitAsync=_.visitAsync})),P=Ze();function F(e,t){return Qe(e?.range?.[0],t)}function Qe(e,t){let n=t.lineCounter.linePos(e!==void 0&&e>=0?e:0).line;return t.sourcePath===void 0?{line:n}:{path:t.sourcePath,line:n}}function $e(e){return`${e.path===void 0?``:`${e.path}:`}line ${e.line}`}function I(e,t,n){throw new r(`INVALID_ARGS`,`${e} (${$e(F(t,n))})`)}function L(e,t,n){(0,P.isMap)(e)||I(`Maestro ${t} expects a map.`,e,n);let r=[];for(let i of e.items){let e=i.key;(0,P.isScalar)(e)||I(`Maestro ${t} map keys must be strings.`,void 0,n);let a=e.value;typeof a!=`string`&&typeof a!=`number`&&typeof a!=`boolean`&&I(`Maestro ${t} map keys must be strings.`,e,n),i.value!==null&&!(0,P.isNode)(i.value)&&I(`Maestro ${t} values must be YAML nodes.`,e,n),r.push({key:String(a),keyNode:e,value:i.value})}return r}function et(e,t,n){return(0,P.isSeq)(e)||I(`Maestro ${t} expects a list.`,e,n),e.items}function tt(e,t,n){return et(e,t,n).map((e,r)=>G(e,`${t}[${r}]`,n))}function R(e,t,n,r){let i=new Set(n),a=new Set;for(let n of e)a.has(n.key)&&I(`Maestro ${t} contains duplicate field "${n.key}".`,n.keyNode,r),a.add(n.key),i.has(n.key)||I(`Maestro ${t} field "${n.key}" is not supported.`,n.keyNode,r)}function z(e,t){return e.some(e=>e.key===t)}function B(e,t){return e.find(e=>e.key===t)?.value}function V(e,t,n){return z(e,t)?n(B(e,t)):void 0}function H(e,t,n){return o({optional:V(e,`optional`,e=>q(e,`${t}.optional`,n))})}function U(e){return e===null||(0,P.isScalar)(e)&&e.value===null}function W(e,t,n){if(e==null)return null;(0,P.isScalar)(e)||I(`Maestro ${t} expects a scalar value.`,e,n);let r=e.value;if(r===null||typeof r==`string`||typeof r==`number`||typeof r==`boolean`)return r;I(`Maestro ${t} contains an unsupported scalar value.`,e,n)}function G(e,t,n){let r=W(e,t,n);return typeof r!=`string`&&I(`Maestro ${t} expects a string.`,e,n),r}function K(e,t,n){let r=W(e,t,n);if(r!==null)return typeof r!=`string`&&I(`Maestro ${t} expects a string.`,e,n),r}function q(e,t,n){let r=W(e,t,n);if(r!==null)return typeof r!=`boolean`&&I(`Maestro ${t} expects a boolean.`,e,n),r}const nt=/^\$\{[A-Za-z_][A-Za-z0-9_.]*\}$/,rt=/^-?\d+(\.\d+)?$/,it=/^-?\d+$/,at={"tapOn.index":{integer:!0,nonNegative:!0},"tapOn.repeat":{integer:!0,positive:!0},"tapOn.delay":{integer:!0,nonNegative:!0},"doubleTapOn.delay":{integer:!0,nonNegative:!0},eraseText:{integer:!0,positive:!0},"eraseText.charactersToErase":{integer:!0,positive:!0},"extendedWaitUntil.timeout":{nonNegative:!0},"scrollUntilVisible.timeout":{nonNegative:!0},waitForAnimationToEnd:{nonNegative:!0},"waitForAnimationToEnd.timeout":{nonNegative:!0},"swipe.duration":{nonNegative:!0},"repeat.times":{integer:!0,nonNegative:!0},"retry.maxRetries":{integer:!0,nonNegative:!0}};function ot(e){return e.positive&&e.integer?`a positive integer`:e.positive?`a positive number`:e.nonNegative&&e.integer?`a non-negative integer`:e.nonNegative?`a non-negative finite number`:e.integer?`an integer`:`a finite number`}function st(e,t,n,r,i){let a=`Maestro ${t} expects ${ot(i)} or a variable expression.`;Number.isFinite(e)||I(a,n,r),Math.abs(e)>2**53-1&&I(a,n,r),i.integer&&!Number.isSafeInteger(e)&&I(a,n,r),i.nonNegative&&e<0&&I(a,n,r),i.positive&&e<=0&&I(a,n,r)}function ct(e,t,n,r,i){if(typeof e==`number`)return st(e,t,n,r,i),e;if(typeof e==`string`){if(nt.test(e))return e;if((i.integer?it:rt).test(e)){let a=Number(e);return st(a,t,n,r,i),a}}I(`Maestro ${t} expects ${ot(i)} or a variable expression.`,n,r)}function J(e,t,n,r=at[t]??{}){let i=W(e,t,n);if(i!==null)return ct(i,t,e,n,r)}function lt(e,t,n){let r=at[t]??{},i=W(e,t,n);return i===null&&I(`Maestro ${t} expects ${ot(r)} or a variable expression.`,e,n),ct(i,t,e,n,r)}function ut(e,t,n){let r=W(e,t,n);return r===null&&I(`Maestro ${t} requires a condition.`,e,n),typeof r==`string`&&r.includes("${")&&!nt.test(r)&&I(`Maestro ${t} only supports a literal value or a bare \${VAR} lookup; JavaScript expressions are not supported — compute it in a runScript and reference \${output.x}.`,e,n),r}function dt(e,t,n){let r=L(e,t,n),i={};for(let e of r){let r=W(e.value,`${t}.${e.key}`,n);r===null&&I(`Maestro ${t}.${e.key} expects a string, number, or boolean.`,e.value,n),i[e.key]=r}return i}function Y(e,t,n){return V(e,`label`,e=>K(e,`${t}.label`,n))}const X=[`id`,`text`,`enabled`,`selected`,`index`,`childOf`,`below`,`above`,`leftOf`,`rightOf`,`containsChild`,`containsDescendants`],ft={textKeys:[`id`,`text`],booleanKeys:[`enabled`,`selected`],textAliases:{label:`text`}},pt={id:(e,t,n,r)=>_t(e,`id`,t,n,r),text:(e,t,n,r)=>_t(e,`text`,t,n,r),enabled:(e,t,n,r)=>vt(e,`enabled`,t,n,r),selected:(e,t,n,r)=>vt(e,`selected`,t,n,r),index:(e,t,n,r)=>{e.index=J(t.value,`${n}.index`,r,{integer:!0,nonNegative:!0})},childOf:(e,t,n,r)=>{e.childOf=Z(t.value,`${n}.childOf`,r)},below:(e,t,n,r)=>{e.below=Z(t.value,`${n}.below`,r)},above:(e,t,n,r)=>{e.above=Z(t.value,`${n}.above`,r)},leftOf:(e,t,n,r)=>{e.leftOf=Z(t.value,`${n}.leftOf`,r)},rightOf:(e,t,n,r)=>{e.rightOf=Z(t.value,`${n}.rightOf`,r)},containsChild:(e,t,n,r)=>{e.containsChild=Z(t.value,`${n}.containsChild`,r)},containsDescendants:(e,t,n,r)=>{e.containsDescendants=et(t.value,`${n}.containsDescendants`,r).map(e=>Z(e,`${n}.containsDescendants`,r))},optional:(e,t,n,r)=>vt(e,`optional`,t,n,r)};function Z(e,t,n,r=X){if((0,P.isScalar)(e))return{text:G(e,t,n)};let i=L(e,t,n);return R(i,t,r,n),mt(i,t,n)}function mt(e,t,n){e.length===0&&I(`Maestro ${t} selector is empty.`,void 0,n);let r={};for(let i of e){let e=pt[i.key];e||I(`Maestro ${t} selector field "${i.key}" is not supported.`,i.keyNode,n),e(r,i,t,n)}return Object.keys(r).filter(e=>e!==`optional`).length===0&&I(`Maestro ${t} selector must contain a selector value.`,e[0]?.keyNode,n),r}function ht(e,t,n,r){let i=F(t,n);if((0,P.isScalar)(e))return{source:i,entries:[],target:bt(Z(e,r.name,n,r.selectorKeys))};let a=L(e,r.name,n),o=z(a,`point`);if(R(a,r.name,o?r.pointAllowedKeys:r.selectorAllowedKeys,n),o){let e=r.pointConflictingSelectorKeys??r.selectorKeys;return a.some(t=>yt(t.key,e))&&I(`Maestro ${r.name}.point cannot be combined with a selector.`,t,n),{source:i,entries:a,target:r.parsePoint(B(a,`point`),`${r.name}.point`,n)}}return{source:i,entries:a,target:bt(mt(a.filter(e=>yt(e.key,r.selectorKeys)),r.name,n))}}function Q(e,t,n){let r=G(e,t,n),i=/^\s*(\d+)\s*,\s*(\d+)\s*$/.exec(r);if(i)return{space:`absolute`,x:Number(i[1]),y:Number(i[2])};let a=/^\s*(\d+)%\s*,\s*(\d+)%\s*$/.exec(r);if(a){let r=Number(a[1]),i=Number(a[2]);return(r>100||i>100)&&I(`Maestro ${t} percentage coordinates must be between 0% and 100%.`,e,n),{space:`percent`,x:r,y:i}}/^\s*\d+(?:\.\d+)?%\s*,\s*\d+(?:\.\d+)?%\s*$/.test(r)&&I(`Maestro ${t} percentage coordinates must be whole numbers.`,e,n),I(`Maestro ${t} expects absolute or percentage coordinates.`,e,n)}function gt(e,t,n){let r=Q(e,t,n);return r.space!==`absolute`&&I(`Maestro ${t} only supports absolute coordinates.`,e,n),r}function _t(e,t,n,r,i){let a=K(n.value,`${r}.${t}`,i);a!==void 0&&(e[t]=a)}function vt(e,t,n,r,i){let a=q(n.value,`${r}.${t}`,i);a!==void 0&&(e[t]=a)}function yt(e,t){return t.includes(e)}function bt(e){return{space:`target`,selector:e}}function xt(e,t,n){let r=ht(e,t,n,{name:`tapOn`,selectorKeys:X,pointConflictingSelectorKeys:X,pointAllowedKeys:[`point`,`retryTapIfNoChange`,`repeat`,`delay`,`optional`,`label`],selectorAllowedKeys:[...X,`retryTapIfNoChange`,`repeat`,`delay`,`optional`,`label`],parsePoint:Q});if(r.entries.length===0)return{kind:`tapOn`,source:r.source,target:r.target};if(r.target.space!==`target`)return{kind:`tapOn`,source:r.source,target:r.target,...Ot(r.entries,n)};let i=Ot(r.entries,n);return o({kind:`tapOn`,source:r.source,target:r.target,...i})}function St(e,t,n){let r=ht(e,t,n,{name:`doubleTapOn`,selectorKeys:X,pointAllowedKeys:[`point`,`delay`,`optional`,`label`],selectorAllowedKeys:[...X,`delay`,`optional`,`label`],parsePoint:gt}),i=H(r.entries,`doubleTapOn`,n),a=z(r.entries,`delay`)?J(B(r.entries,`delay`),`doubleTapOn.delay`,n):void 0,s=Y(r.entries,`doubleTapOn`,n);return o({kind:`doubleTapOn`,source:r.source,target:r.target,...i,delay:a,label:s})}function Ct(e,t,n){let r=ht(e,t,n,{name:`longPressOn`,selectorKeys:X,pointAllowedKeys:[`point`,`optional`,`label`],selectorAllowedKeys:[...X,`optional`,`label`],parsePoint:gt});return o({kind:`longPressOn`,source:r.source,target:r.target,...H(r.entries,`longPressOn`,n),label:Y(r.entries,`longPressOn`,n)})}function wt(e,t,n){let r=F(t,n),i=L(e,`swipe`,n);R(i,`swipe`,[`start`,`end`,`direction`,`duration`,`from`,`label`,`optional`],n);let a=H(i,`swipe`,n),o=Y(i,`swipe`,n),s=z(i,`duration`)?J(B(i,`duration`),`swipe.duration`,n):void 0;if(z(i,`start`)||z(i,`end`))return{...Tt(i,r,s,t,n),...a,label:o};let c=z(i,`direction`)?kt(B(i,`direction`),`swipe.direction`,n):void 0;return z(i,`from`)?{...Et(i,r,c,s,t,n),...a,label:o}:{...Dt(r,c,s,t,n),...a,label:o}}function Tt(e,t,n,r,i){z(e,`direction`)&&I(`Maestro swipe cannot combine direction with start/end coordinates.`,r,i),(!z(e,`start`)||!z(e,`end`))&&I(`Maestro swipe requires both start and end coordinates.`,r,i);let a=Q(B(e,`start`),`swipe.start`,i),s=Q(B(e,`end`),`swipe.end`,i);return a.space!==s.space&&I(`Maestro swipe start/end must use the same coordinate space.`,r,i),{kind:`swipe`,source:t,gesture:o({kind:`coordinates`,start:a,end:s,duration:n})}}function Et(e,t,n,r,i,a){return n===void 0&&I(`Maestro target swipe requires direction.`,i,a),{kind:`swipe`,source:t,gesture:o({kind:`target`,from:Z(B(e,`from`),`swipe.from`,a),direction:n,duration:r})}}function Dt(e,t,n,r,i){return t===void 0&&I(`Maestro swipe requires direction, target, or start/end coordinates.`,r,i),{kind:`swipe`,source:e,gesture:o({kind:`screen`,direction:t,duration:n})}}function Ot(e,t){let n=V(e,`retryTapIfNoChange`,e=>q(e,`tapOn.retryTapIfNoChange`,t)),r=V(e,`repeat`,e=>lt(e,`tapOn.repeat`,t)),i=V(e,`delay`,e=>J(e,`tapOn.delay`,t)),a=H(e,`tapOn`,t).optional;return o({retryTapIfNoChange:n,repeat:r,delay:i,optional:a,label:Y(e,`tapOn`,t)})}function kt(e,t,n){let r=G(e,t,n).toLowerCase();if(r===`up`||r===`down`||r===`left`||r===`right`)return r;I(`Maestro ${t} must be UP, DOWN, LEFT, or RIGHT.`,e,n)}function At(e,t,n,r){let i=F(n,r);if((0,P.isScalar)(t))return{kind:e,source:i,target:Z(t,e,r)};let a=L(t,e,r);R(a,e,[...X,`optional`,`label`],r);let s=H(a,e,r),c=Y(a,e,r);return o({kind:e,source:i,target:mt(a.filter(e=>e.key!==`optional`&&e.key!==`label`),e,r),...s,label:c})}const jt=[...X,`optional`];function Mt(e,t,n,r){if(!z(e,t))return;let{optional:i,...a}=Z(B(e,t),n,r,jt);return{selector:a,optional:i}}function Nt(e,t,n){let r=Mt(e,`visible`,`extendedWaitUntil.visible`,n),i=Mt(e,`notVisible`,`extendedWaitUntil.notVisible`,n);return r&&i&&I(`Maestro extendedWaitUntil cannot specify both visible and notVisible.`,t,n),!r&&!i&&I(`Maestro extendedWaitUntil requires visible or notVisible.`,t,n),r?{key:`visible`,selector:r.selector,optional:r.optional}:{key:`notVisible`,selector:i.selector,optional:i.optional}}function Pt(e,t,n){let r=F(t,n);if((0,P.isScalar)(e))return{kind:`runScript`,source:r,file:G(e,`runScript`,n)};let i=L(e,`runScript`,n);return R(i,`runScript`,[`file`,`env`],n),z(i,`file`)||I(`Maestro runScript requires a file.`,t,n),o({kind:`runScript`,source:r,file:G(B(i,`file`),`runScript.file`,n),env:z(i,`env`)?dt(B(i,`env`),`runScript.env`,n):void 0})}function Ft(e,t,n,r){let i=F(t,n);if((0,P.isScalar)(e))return{kind:`runFlow`,source:i,include:{kind:`file`,path:G(e,`runFlow`,n)}};let a=L(e,`runFlow`,n);R(a,`runFlow`,[`file`,`commands`,`env`,`when`,`label`],n);let s=z(a,`file`);return s===z(a,`commands`)&&I(`Maestro runFlow requires exactly one of file or commands.`,t,n),o({kind:`runFlow`,source:i,include:s?{kind:`file`,path:G(B(a,`file`),`runFlow.file`,n)}:{kind:`commands`,commands:r(B(a,`commands`),`runFlow.commands`,n)},env:z(a,`env`)?dt(B(a,`env`),`runFlow.env`,n):void 0,when:z(a,`when`)?Rt(B(a,`when`),n):void 0,label:Y(a,`runFlow`,n)})}function It(e,t,n,r){let i=F(t,n),a=L(e,`repeat`,n);return R(a,`repeat`,[`times`,`commands`,`while`],n),z(a,`while`)&&I(`Maestro repeat.while is not supported; use repeat.times.`,B(a,`while`),n),z(a,`times`)||I(`Maestro repeat requires times.`,t,n),z(a,`commands`)||I(`Maestro repeat requires commands.`,t,n),{kind:`repeat`,source:i,times:lt(B(a,`times`),`repeat.times`,n),commands:r(B(a,`commands`),`repeat.commands`,n)}}function Lt(e,t,n,r){let i=F(t,n),a=L(e,`retry`,n);R(a,`retry`,[`maxRetries`,`commands`],n),z(a,`commands`)||I(`Maestro retry requires commands.`,t,n);let s=z(a,`maxRetries`)?lt(B(a,`maxRetries`),`retry.maxRetries`,n):void 0;return o({kind:`retry`,source:i,commands:r(B(a,`commands`),`retry.commands`,n),maxRetries:s})}function Rt(e,t){let n=L(e,`runFlow.when`,t);return R(n,`runFlow.when`,[`platform`,`visible`,`notVisible`,`true`],t),n.length===0&&I(`Maestro runFlow.when cannot be empty.`,e,t),o({platform:V(n,`platform`,e=>Bt(e,t)),visible:V(n,`visible`,e=>Z(e,`runFlow.when.visible`,t)),notVisible:V(n,`notVisible`,e=>Z(e,`runFlow.when.notVisible`,t)),true:V(n,`true`,e=>zt(e,t))})}function zt(e,t){let n=W(e,`runFlow.when.true`,t);if(typeof n==`boolean`||typeof n==`string`)return n;I(`Maestro runFlow.when.true expects a boolean or expression string.`,e,t)}function Bt(e,t){let n=G(e,`runFlow.when.platform`,t).toLowerCase();if(n===`android`||n===`ios`||n===`web`)return n;I(`Maestro runFlow.when.platform expects Android, iOS, or Web.`,e,t)}function $(e,t,n){return et(e,t,n).map(e=>Vt(e,n))}function Vt(e,t){if((0,P.isScalar)(e))return typeof e.value!=`string`&&I(`Maestro command names must be strings.`,e,t),Ht(e.value,e,t);(0,P.isMap)(e)||I(`Maestro commands must be a scalar or one-key map.`,e,t);let n=L(e,`command`,t);n.length!==1&&I(`Maestro command maps must contain exactly one command.`,e,t);let r=n[0];return Wt(r.key,r.value,e,t)}function Ht(e,t,n){return Wt(e,null,t,n)}const Ut={launchApp:Gt,tapOn:xt,doubleTapOn:St,longPressOn:Ct,inputText:Kt,eraseText:qt,openLink:Jt,assertVisible:(e,t,n)=>At(`assertVisible`,e,t,n),assertNotVisible:(e,t,n)=>At(`assertNotVisible`,e,t,n),assertTrue:Yt,extendedWaitUntil:Xt,takeScreenshot:Zt,scroll:Qt,scrollUntilVisible:$t,swipe:wt,hideKeyboard:en,pressKey:tn,back:nn,waitForAnimationToEnd:rn,stopApp:an,clearState:on,runScript:Pt,evalScript:sn,runFlow:(e,t,n)=>Ft(e,t,n,$),repeat:(e,t,n)=>It(e,t,n,$),retry:(e,t,n)=>Lt(e,t,n,$)};Object.keys(Ut);function Wt(e,t,n,r){let i=Ut[e];return i||I(`Maestro command "${e}" is not supported.`,n,r),i(t,n,r)}function Gt(e,t,n){let r=F(t,n);if(U(e))return{kind:`launchApp`,source:r};if((0,P.isScalar)(e))return{kind:`launchApp`,source:r,appId:G(e,`launchApp`,n)};let i=L(e,`launchApp`,n);return R(i,`launchApp`,[`appId`,`stopApp`,`clearState`,`arguments`,`launchArguments`],n),o({kind:`launchApp`,source:r,appId:V(i,`appId`,e=>K(e,`launchApp.appId`,n)),stopApp:V(i,`stopApp`,e=>q(e,`launchApp.stopApp`,n)),clearState:V(i,`clearState`,e=>q(e,`launchApp.clearState`,n)),arguments:V(i,`arguments`,e=>cn(e,`launchApp.arguments`,n)),launchArguments:V(i,`launchArguments`,e=>cn(e,`launchApp.launchArguments`,n))})}function Kt(e,t,n){let r=F(t,n);if((0,P.isScalar)(e))return{kind:`inputText`,source:r,text:G(e,`inputText`,n)};let i=L(e,`inputText`,n);return R(i,`inputText`,[`text`,`label`],n),z(i,`text`)||I(`Maestro inputText requires text.`,t,n),o({kind:`inputText`,source:r,text:G(B(i,`text`),`inputText.text`,n),label:Y(i,`inputText`,n)})}function qt(e,t,n){let r=F(t,n);if(U(e))return{kind:`eraseText`,source:r};if((0,P.isScalar)(e))return{kind:`eraseText`,source:r,charactersToErase:lt(e,`eraseText`,n)};let i=L(e,`eraseText`,n);return R(i,`eraseText`,[`charactersToErase`],n),o({kind:`eraseText`,source:r,charactersToErase:z(i,`charactersToErase`)?J(B(i,`charactersToErase`),`eraseText.charactersToErase`,n):void 0})}function Jt(e,t,n){let r=F(t,n);if((0,P.isScalar)(e))return{kind:`openLink`,source:r,link:G(e,`openLink`,n)};let i=L(e,`openLink`,n);return R(i,`openLink`,[`link`],n),{kind:`openLink`,source:r,link:G(B(i,`link`),`openLink.link`,n)}}function Yt(e,t,n){let r=F(t,n);if(U(e)&&I(`Maestro assertTrue requires condition.`,t,n),(0,P.isScalar)(e))return{kind:`assertTrue`,source:r,condition:ut(e,`assertTrue`,n)};let i=L(e,`assertTrue`,n);R(i,`assertTrue`,[`condition`,`optional`,`label`],n),z(i,`condition`)||I(`Maestro assertTrue requires condition.`,t,n);let a=ut(B(i,`condition`),`assertTrue.condition`,n),s=H(i,`assertTrue`,n),c=Y(i,`assertTrue`,n);return o({kind:`assertTrue`,source:r,condition:a,...s,label:c})}function Xt(e,t,n){let r=L(e,`extendedWaitUntil`,n);R(r,`extendedWaitUntil`,[`visible`,`notVisible`,`timeout`,`optional`,`label`],n);let i=H(r,`extendedWaitUntil`,n),a=Y(r,`extendedWaitUntil`,n),s=Nt(r,t,n),c=z(r,`timeout`)?J(B(r,`timeout`),`extendedWaitUntil.timeout`,n):void 0,l=i.optional===!0||s.optional===!0||void 0,u={kind:`extendedWaitUntil`,source:F(t,n),timeout:c,optional:l,label:a};return u[s.key]=s.selector,o(u)}function Zt(e,t,n){return{kind:`takeScreenshot`,source:F(t,n),path:G(e,`takeScreenshot`,n)}}function Qt(e,t,n){return U(e)||I(`Maestro scroll does not accept options yet.`,t,n),{kind:`scroll`,source:F(t,n)}}function $t(e,t,n){let r=F(t,n);if((0,P.isScalar)(e))return{kind:`scrollUntilVisible`,source:r,element:Z(e,`scrollUntilVisible.element`,n)};let i=L(e,`scrollUntilVisible`,n);R(i,`scrollUntilVisible`,[`element`,`direction`,`timeout`,`optional`,`label`],n);let a=H(i,`scrollUntilVisible`,n),s=Y(i,`scrollUntilVisible`,n),c=Mt(i,`element`,`scrollUntilVisible.element`,n);c||I(`Maestro scrollUntilVisible requires element.`,t,n);let l=z(i,`direction`)?kt(B(i,`direction`),`scrollUntilVisible.direction`,n):void 0,u=z(i,`timeout`)?J(B(i,`timeout`),`scrollUntilVisible.timeout`,n):void 0,d=a.optional===!0||c.optional===!0||void 0;return o({kind:`scrollUntilVisible`,source:r,element:c.selector,direction:l,timeout:u,optional:d,label:s})}function en(e,t,n){return U(e)||I(`Maestro hideKeyboard does not accept options.`,t,n),{kind:`hideKeyboard`,source:F(t,n)}}function tn(e,t,n){let r=G(e,`pressKey`,n).toLowerCase();return r!==`back`&&r!==`enter`&&r!==`return`&&r!==`home`&&I(`Maestro pressKey "${r}" is not supported.`,e,n),{kind:`pressKey`,source:F(t,n),key:r}}function nn(e,t,n){return U(e)||I(`Maestro back does not accept options.`,t,n),{kind:`back`,source:F(t,n)}}function rn(e,t,n){let r=F(t,n);if(U(e))return{kind:`waitForAnimationToEnd`,source:r};if((0,P.isScalar)(e))return o({kind:`waitForAnimationToEnd`,source:r,timeout:J(e,`waitForAnimationToEnd`,n)});let i=L(e,`waitForAnimationToEnd`,n);return R(i,`waitForAnimationToEnd`,[`timeout`],n),o({kind:`waitForAnimationToEnd`,source:r,timeout:z(i,`timeout`)?J(B(i,`timeout`),`waitForAnimationToEnd.timeout`,n):void 0})}function an(e,t,n){let r=F(t,n);return U(e)?{kind:`stopApp`,source:r}:{kind:`stopApp`,source:r,appId:G(e,`stopApp`,n)}}function on(e,t,n){let r=F(t,n);return U(e)?{kind:`clearState`,source:r}:{kind:`clearState`,source:r,appId:G(e,`clearState`,n)}}function sn(e,t,n){return{kind:`evalScript`,source:F(t,n),script:G(e,`evalScript`,n)}}function cn(e,t,n){if((0,P.isSeq)(e))return{kind:`list`,values:et(e,t,n).map((e,r)=>{let i=W(e,`${t}[${r}]`,n);return i===null&&I(`${t}[${r}] expects a scalar value.`,e,n),i})};if((0,P.isMap)(e))return{kind:`map`,values:dt(e,t,n)};let r=W(e,t,n);return r===null&&I(`${t} expects a scalar, list, or map.`,e,n),{kind:`scalar`,value:r}}function ln(e,t={}){let n=new P.LineCounter,i=o({lineCounter:n,sourcePath:t.sourcePath}),a=(0,P.parseAllDocuments)(e,{lineCounter:n});for(let e of a)if(e.errors.length>0){let t=e.errors[0],n=t?.message??`Invalid Maestro YAML flow.`,a=Qe(t?.pos[0],i);throw new r(`INVALID_ARGS`,`Invalid Maestro YAML flow: ${n} (${$e(a)})`)}let s=a.map(e=>e.contents).filter(e=>e!==null);s.length===0&&I(`Maestro flow is empty.`,void 0,i);let c,l;s.length===1&&(0,P.isSeq)(s[0])?l=s[0]:s.length===2&&(0,P.isMap)(s[0])&&(0,P.isSeq)(s[1])?(c=s[0],l=s[1]):I(`Maestro flow must contain a command list, optionally preceded by one config document.`,s[0],i);let u=c?un(c,i):{};return{kind:`program`,source:F(c??l,i),config:u,commands:$(l,`commands`,i)}}function un(e,t){let n=L(e,`flow config`,t);return R(n,`flow config`,[`name`,`appId`,`tags`,`env`,`onFlowStart`,`onFlowComplete`],t),o({name:V(n,`name`,e=>K(e,`name`,t)),appId:V(n,`appId`,e=>K(e,`appId`,t)),tags:V(n,`tags`,e=>tt(e,`tags`,t)),env:V(n,`env`,e=>dt(e,`env`,t)),onFlowStart:V(n,`onFlowStart`,e=>$(e,`onFlowStart`,t)),onFlowComplete:V(n,`onFlowComplete`,e=>$(e,`onFlowComplete`,t))})}function dn(e,t){let n=new Map;return async(r,a,o)=>{if(o?.aborted)throw i();let s=fn(r,a,e),c=n.get(s);if(c)return c;let l=ln(t(s),{sourcePath:s});return n.set(s,l),l}}function fn(e,t,n){let r=t?a.dirname(t):n;return a.resolve(r,e)}function pn(e){let t={[e.entryPath]:e.entrySource},n=mn(e.entrySource,e.entryPath);return n&&hn({program:n,sourcePath:e.entryPath,context:l({},{...e.env}),files:t,readSource:e.readSource}),t}function mn(e,t){try{return ln(e,{sourcePath:t})}catch{return}}function hn(e){let t=e.context.enter(e.program.config.env??{});try{gn([...e.program.config.onFlowStart??[],...e.program.commands,...e.program.config.onFlowComplete??[]],e)}finally{t()}}function gn(e,t){for(let n of e){if(n.kind===`repeat`||n.kind===`retry`){gn(n.commands,t);continue}if(n.kind!==`runFlow`)continue;let e=t.context.enter(n.env??{});try{if(n.include.kind===`commands`){gn(n.include.commands,t);continue}_n(n.include.path,t)}finally{e()}}}function _n(e,t){let n=t.context.resolveDeferred(e);if(n.includes("${"))return;let r=fn(n,t.sourcePath,t.sourcePath);if(t.files[r]!==void 0)return;let i=t.readSource(r);if(i===void 0)return;t.files[r]=i;let a=mn(i,r);a&&hn({...t,program:a,sourcePath:r})}var vn=t({MAESTRO_COMPATIBILITY_ADR_URL:()=>MAESTRO_COMPATIBILITY_ADR_URL,MAESTRO_COMPATIBILITY_ISSUE_URL:()=>MAESTRO_COMPATIBILITY_ISSUE_URL,collectMaestroFlowSources:()=>pn});export{at as a,l as c,o as d,ft as i,c as l,dn as n,ot as o,ln as r,Ze as s,vn as t,s as u};
|
package/dist/src/string-enum.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{C as e}from"./sdk-contracts.js";function t(t,n={message:e=>`Invalid value: ${e}`}){let r=new Set(t),i=n.normalize??(e=>e);return{is:e=>typeof e==`string`&&r.has(e),parse:t=>{let a=i(t??``);if(r.has(a))return a;throw new e(`INVALID_ARGS`,n.message(t??``))}}}export{t};
|
package/dist/src/takeover.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{C as e}from"./sdk-contracts.js";import{t}from"./shared.js";import{randomUUID as n}from"node:crypto";const r=async({positionals:t,flags:n,client:r})=>{let s=t[0]?.toLowerCase();if(s===`status`){if(t.length!==1)throw new e(`INVALID_ARGS`,`takeover status does not accept additional arguments.`);return await a(n,r),!0}if(s===`release`){if(t.length!==2||!t[1])throw new e(`INVALID_ARGS`,`takeover release requires a hold id.`);return await o(n,r,t[1]),!0}if(t.length>0)throw new e(`INVALID_ARGS`,`takeover accepts only: status or release <hold-id>.`);return await i(n,r),!0};async function i(e,r){let i=`takeover-${n()}`,a={reason:`Human is interacting with the simulator or device.`,ttlMs:15e3},o=r.leases.humanControl,c=await o.put(i,a);await t(e,{hold:c,state:`active`},()=>s(c));let l,u,d=!1,f,p=new Promise(e=>{f=e}),m=()=>f?.();process.once(`SIGINT`,m),process.once(`SIGTERM`,m);let h=setInterval(()=>{u||=o.put(i,a).then(()=>void 0).catch(e=>{l=e,f?.()}).finally(()=>{u=void 0})},5e3);try{await p}finally{clearInterval(h),process.off(`SIGINT`,m),process.off(`SIGTERM`,m),await u,d=await o.remove(i).catch(()=>!1)}if(l)throw l;e.json||process.stdout.write(d?`Human control released. Agent interactions are enabled.
|
|
2
2
|
`:`Release could not be confirmed. The safety TTL will re-enable agent interactions automatically.
|
|
3
3
|
`)}async function a(e,n){let r=await n.leases.humanControl.list();await t(e,{holds:r},()=>c(r))}async function o(e,n,r){let i=await n.leases.humanControl.remove(r);await t(e,{holdId:r,released:i},()=>i?`Released human-control hold ${r}.`:`No active hold found for ${r}.`)}function s(e){return[`Human control active for ${e.scope.deviceKey}.`,`Agent interactions are paused. Press Ctrl+C to return control.`,`Hold: ${e.id}`].join(`
|
|
4
4
|
`)}function c(e){return e.length===0?`No active human-control holds.`:[`Active human-control holds:`,...e.map(e=>{let t=e.scope.deviceKey;return` ${e.id}: ${t}`})].join(`
|
package/dist/src/telemetry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"node:path";import t from"node:fs";function n(t){let n=e.parse(t);return e.join(n.dir,`${n.name}.gesture-telemetry.json`)}function r(e
|
|
1
|
+
import e from"node:path";import t from"node:fs";function n(t){let n=e.parse(t);return e.join(n.dir,`${n.name}.gesture-telemetry.json`)}function r(e){return[...e].sort((e,t)=>e.tMs-t.tMs)}function i(e){let i=n(e.videoPath),a={version:1,generatedAt:new Date().toISOString(),events:r(e.events)};return t.writeFileSync(i,JSON.stringify(a,null,2)),i}function a(e){let{recording:t}=e,n=i({videoPath:t.outPath,events:t.gestureEvents});return t.telemetryPath=n,n}export{a as n,n as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{C as e}from"./sdk-contracts.js";import{a as t,c as n,m 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 h={runCommand:
|
|
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 h={runCommand:n,simctl:{run:async(e,t)=>await n(`xcrun`,[`simctl`,...e],t)},devicectl:{run:async(e,t)=>await n(`xcrun`,[`devicectl`,...e],t)},plist:{readJson:async(e,t)=>await D(n,e,t)},macosHost:u(n,async e=>await D(n,e)),whichCommand:r},g=a(h,w);function _(e={}){let t={...h,...e},n=e.plist??{readJson:async(e,n)=>await D(t.runCommand,e,n)};return{...t,simctl:e.simctl??{run:async(e,n)=>await t.runCommand(`xcrun`,[`simctl`,...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 v(e){return g.resolve(e)}async function y(e,t){return await g.run(e,t)}function b(){return g.hasScope()}async function x(e,t,n){return await v().runCommand(e,t,n)}async function S(e,t){let n=v(),[r,...i]=e;return r===`simctl`?await(n.simctl?.run(i,t)??n.runCommand(`xcrun`,e,t)):r===`devicectl`?await(n.devicectl?.run(i,t)??n.runCommand(`xcrun`,e,t)):await x(`xcrun`,e,t)}async function C(e,t){return await v().plist?.readJson(e,t)??null}function w(e){return _({...e,runCommand:T(e.runCommand),...e.simctl?{simctl:{run:E(e.simctl.run)}}:{},...e.devicectl?{devicectl:{run:E(e.devicectl.run)}}:{},...e.macosHelper?{macosHelper:{run:E(e.macosHelper.run)}}:{}})}function T(e){return async(t,n,r)=>i(await e(t,n,r))}function E(e){return async(t,n)=>i(await e(t,n))}async function D(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{x as a,l as c,v as i,b as n,S as o,C as r,y as s,_ as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime.js";import{C 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,m 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{r as e}from"./rolldown-runtime.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime.js";import{c as t,i as n,m as r}from"./exec.js";import"./command.js";import{t as i}from"./scoped-provider.js";import{f as a}from"./host-file.js";import o from"node:path";var s=e({createLocalVegaToolProvider:()=>d,resolveVegaToolProvider:()=>f,withVegaToolProvider:()=>p});const c={run:async(e,n)=>await t(await h()??`vega`,e,n),isAvailable:async()=>!!await h()},l=d(),u=i(l);function d(e=c){return{isAvailable:async()=>await e.isAvailable(),version:async t=>await e.run([`--version`],t),listDevices:async t=>await e.run([`device`,`list`],t),checkConnected:async(t,n)=>await e.run([`device`,`is-connected`,`--device`,t],n),launchApp:async(t,n,r)=>await e.run([`device`,`launch-app`,`--device`,t,`--appName`,n],r),terminateApp:async(t,n,r)=>await e.run([`device`,`terminate-app`,`--device`,t,`--appName`,n],r),pressRemote:async(t,n,r,i)=>await e.run([`device`,`run-cmd`,`--device`,t,`--command`,[`inputd-cli`,`button_press`,n,...r===void 0?[]:[`--holdDuration`,String(r)]].join(` `)],i)}}function f(e){return u.resolve(e)}async function p(e,t){return await u.run(e,t)}let m;async function h(){if(m)return m;if(await r(`vega`))return m=`vega`,m;let e=o.join(a(),`vega`,`bin`,`vega`);return await n(e)&&(m=e),m}export{s as n,f as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c as e}from"./exec.js";import"./command.js";const t=3e3;async function n(n,i){try{let a=await e(n,i,{allowFailure:!0,timeoutMs:t});return a.exitCode===0?r(a.stdout):void 0}catch{return}}function r(e){return e.split(`
|
|
2
2
|
`).map(e=>e.trim()).find(Boolean)}export{n,r,t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as e}from"./scroll-gesture.js";const t=new WeakMap;function n(e){if(!e)return;let n=t.get(e);if(n)return n;let r=i(e.nodes??[]);if(r)return t.set(e,r),r}function r(e){return n({nodes:e,createdAt:0})}const i=e;export{r as n,n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{C as e}from"./sdk-contracts.js";function t(e){return async t=>await e.resolveInteractor(e.device,t)}function n(t){return async n=>{let r=t.resolveInteractor(n);if(r)return r;throw new e(`UNSUPPORTED_OPERATION`,`Provider-owned ${t.operation} operation has no bound provider interactor.`,{reason:`provider-runtime-interactor-missing`,deviceId:t.device.id})}}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=>{let t=await o(e);return e.options.button!==`primary`&&t.alternateClick?await t.alternateClick(e.point,e.options.button):t.pressPoint?await t.pressPoint(e.point,e.options):await c(t,e.point,e.options,i)},u=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)},d=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:u}:{},...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:d}:{},...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.`)}async function c(t,n,r,i){if(r.button!==`primary`)throw new e(`UNSUPPORTED_OPERATION`,`Bound runtime does not implement ${r.button} click.`);let a;for(let e=0;e<r.count;e+=1){let[o,s]=u(e,r.jitterPx),c=r.doubleTap?await t.doubleTap(n.x+o,n.y+s):r.holdMs>0?await t.longPress(n.x+o,n.y+s,r.holdMs):await t.tap(n.x+o,n.y+s);a??=c,e<r.count-1&&r.intervalMs>0&&await i(r.intervalMs)}return a}const l=[[0,0],[1,0],[0,1],[-1,0],[0,-1],[1,1],[-1,1],[1,-1],[-1,-1]];function u(e,t){if(t<=0)return[0,0];let[n,r]=l[e%l.length];return[n*t,r*t]}function d(e){return o(e.signal,t(e),e.facts,e.pause)}function f(e){return o(e.signal,n({...e,operation:`touch`}),e.facts,e.pause)}export{t as a,r as i,f as n,n as o,u as r,d as t};
|
package/dist/src/transport.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{C 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{
|
|
1
|
+
import{Mr 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}const n=new WeakMap;function r(e,t){if(!e[t])return[];let n=o(e)[t]??t+1;return e.slice(t+1,n)}function i(e,t,n){let r=o(e)[t]??t+1;for(let i=t+1;i<r;i+=1){let t=e[i];if(t&&n(t))return t}}function a(e,t,n){let r=o(e)[t]??t+1;for(let i=t+1;i<r;i+=1){let t=e[i];t&&n(t)}}function o(e){let t=n.get(e);if(t)return t;let r=Array(e.length),i=[];for(let[t,n]of e.entries()){let e=n?.depth??0;for(;i.length>0&&e<=i.at(-1).depth;){let e=i.pop();r[e.position]=t}i.push({depth:e,position:t})}for(let t of i)r[t.position]=e.length;return n.set(e,r),r}function s(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 c(e,t,n){for(let r of s(e,t))if(n(r))return r;return null}function l(e,t,n={}){return(n.includeSelf===!0&&p(e.type)?e:null)??c(e,t,e=>p(e.type))}function u(t,n){let r=e(t.type??``),i=t.label?.trim();return!!(f(t)||r===`other`&&!i&&!t.value||(r===`other`||r===`statictext`)&&i&&n.includes(i)||r===`image`)}function d(t){let n=e(t.type??``);return n===`button`||n===`link`||n===`switch`||n===`searchfield`||n===`textfield`}function f(t){return e(t.type??``)===`button`&&t.label?.trim()===`chevron`&&t.enabled===!1}function p(t){let n=e(t??``);return n===`collectionview`||n===`table`||n===`scrollview`||n===`scrollarea`}function m(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 h(e,t,n){e.set(t.index,{..._(e,t),...n})}function g(e,t,n){let r=_(e,t);e.set(t.index,{...r,...n(r)})}function _(e,t){return{...t,...e.get(t.index)}}function v(t){let n;for(let r of t){let t=e(r.type??``);(t===`application`||t===`window`)&&b(r.rect,n)&&(n=r.rect)}return n}function y(e,t,n=.8){let r=x(e),i=x(t);return r>0&&i>0&&r/i>=n}function b(e,t){return!!(e&&(!t||x(e)>x(t)))}function x(e){return e?e.width*e.height:0}function S(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=C(e.parentIndex,t,r,i)),{...e,index:n,parentIndex:a}})}function C(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{c as a,f as c,p as d,d as f,g,u as h,v as i,y as l,S as m,r as n,l as o,h as p,i as r,a as s,t,m as u};
|
package/dist/src/tv-remote.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{C 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{C as e}from"./sdk-contracts.js";import{Ht as t}from"./sdk-batch.js";import{k as n}from"./runtime.js";import{n as r}from"./success-text.js";import{g as i,m as a}from"./session-snapshot.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 n=await i({command:`type`,device:e.device,use:t,inspectFacts:e.inspectFacts,bindDevice:e.bindDevice});if(n.type===`response`)return{ok:!1,response:n.response};let r=n.runtime;return{ok:!0,typeText:async(e,t)=>await c(r,e,t)}}async function c(t,i,a){let s=o(i[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=i.join(` `);if(!c)throw new e(`INVALID_ARGS`,`type requires text`);let u=n(a.delayMs??0,`delay-ms`,0,1e4),d=(await t.operations.typeText(l(c,u,a)))?.textEntryRoute;return{...d===void 0?{}:{textEntryRoute:d},text:c,delayMs:u,...r(`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:a(n)}}export{s as n,c as t};
|
package/dist/src/update-check.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{u as e}from"./exec.js";import"./command.js";import t from"node:path";import n from"node:fs";import{fileURLToPath as r}from"node:url";const i=`agent-device`,a=`--agent-device-run-update-check`;function o(e){if(!c(e))return;let n=Date.now(),r=t.join(e.stateDir,`update-check.json`),a=d(r);l(a,e.currentVersion)&&(process.stderr.write(`Update available: ${i} ${e.currentVersion} -> ${a.latestVersion}. Run \`npm install -g ${i}@latest\` to upgrade the CLI.\n`),f(r,{...a,prompted:!0})),u(a,n)&&m(r,e.currentVersion)}async function s(e){let t=Date.now(),n=d(e.cachePath);try{let r=await h()??void 0;if(!r||_(r,e.currentVersion)<=0){f(e.cachePath,{checkedAt:new Date(t).toISOString()});return}f(e.cachePath,{checkedAt:new Date(t).toISOString(),latestVersion:r,prompted:n.latestVersion===r&&n.prompted===!0})}catch{f(e.cachePath,{...n,checkedAt:new Date(t).toISOString()})}}function c(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 l(e,t){return!e.latestVersion||_(e.latestVersion,t)<=0?!1:e.prompted!==!0}function u(e,t){let n=g(e.checkedAt);return n===void 0||t-n>=12096e5}function d(e){try{let t=JSON.parse(n.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 f(e,r){try{n.mkdirSync(t.dirname(e),{recursive:!0}),n.writeFileSync(e,`${JSON.stringify(r,null,2)}\n`,`utf8`)}catch{}}function p(){let e=r(import.meta.url),i=t.extname(e)||`.js`,a=[t.join(t.dirname(e),`update-check-entry${i}`),t.join(t.dirname(e),`internal`,`update-check-entry${i}`)].find(e=>n.existsSync(e));if(!a)throw Error(`Update check entrypoint not found. Rebuild the package to include the update-check worker entry.`);return a}function m(t,n){let r=p(),i=r.endsWith(`.ts`)?[`--experimental-strip-types`]:[];e(process.execPath,[...i,r,a,t,n])}async function h(){let e=await fetch(`https://registry.npmjs.org/${i}/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 g(e){if(!e)return;let t=Date.parse(e);return Number.isNaN(t)?void 0:t}function _(e,t){return e.localeCompare(t,void 0,{numeric:!0})}function v(e){if(e[0]!==a)return null;let t=e[1]?.trim(),n=e[2]?.trim();return!t||!n?null:{cachePath:t,currentVersion:n}}export{v as n,s as r,o as t};
|
package/dist/src/vars.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{C as e}from"./sdk-contracts.js";import{t}from"./script.js";function n(e){return e.startsWith(`AD_`)}function r(t){return new e(`INVALID_ARGS`,`The AD_* namespace is reserved for built-in variables. Rename ${t} to avoid the AD_ prefix.`)}function i(e){let t={};if(e.builtins)for(let[n,r]of Object.entries(e.builtins))t[n]=r;let i=[e.fileEnv,e.shellEnv,e.cliEnv];for(let e of i)if(e)for(let[i,a]of Object.entries(e)){if(n(i))throw r(i);t[i]=a}return{values:t,expandedBuiltinNames:new Set}}function a(e){let r={};for(let[i,a]of Object.entries(e)){if(typeof a!=`string`||!i.startsWith(`AD_VAR_`))continue;let e=i.slice(7);e.length!==0&&t.test(e)&&(n(e)||(r[e]=a))}return r}function o(i){let a={};for(let o of i){let i=o.indexOf(`=`);if(i<=0)throw new e(`INVALID_ARGS`,`Invalid -e entry "${o}": expected KEY=VALUE.`);let s=o.slice(0,i);if(!t.test(s))throw new e(`INVALID_ARGS`,`Invalid -e key "${s}": keys must be uppercase letters, digits, and underscores (e.g. APP_ID).`);if(n(s))throw r(s);a[s]=o.slice(i+1)}return a}function s(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function c(e){if(e&&typeof e==`object`&&!Array.isArray(e)){let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}return process.env}function l(e){return e>=`A`&&e<=`Z`||e>=`a`&&e<=`z`||e===`_`}function u(e){return l(e)||e>=`0`&&e<=`9`||e===`.`}function d(e){return e===`
|
|
2
|
+
`||e===`\r`||e===`\u2028`||e===`\u2029`}function f(e,t){let n=t+2;if(n>=e.length||!l(e[n]))return null;for(n+=1;n<e.length&&u(e[n]);)n+=1;let r=e.slice(t+2,n);if(e[n]===`}`)return{key:r,fallback:void 0,end:n+1};if(e[n]!==`:`||e[n+1]!==`-`)return null;n+=2;let i=``;for(;n<e.length;){let t=e[n];if(t===`}`)return{key:r,fallback:i,end:n+1};if(t===`\\`){let t=e[n+1];if(t===void 0)return{abortEnd:e.length};if(d(t))return{abortEnd:n+2};i+=t,n+=2;continue}i+=t,n+=1}return{abortEnd:e.length}}function p(t,r,i){let a=``,o=0;for(;o<t.length;){let s=t[o];if(s===`\\`&&t.startsWith("${",o+1)){a+="${",o+=3;continue}if(s===`$`&&t[o+1]===`{`){let s=f(t,o);if(s!==null&&`abortEnd`in s){a+=t.slice(o,s.abortEnd),o=s.abortEnd;continue}if(s!==null){let{key:t,fallback:c}=s;if(Object.prototype.hasOwnProperty.call(r.values,t))n(t)&&(r.expandedBuiltinNames??=new Set).add(t),a+=String(r.values[t]);else if(c!==void 0)a+=c;else throw new e(`INVALID_ARGS`,`Unresolved variable \${${t}} at ${i.file}:${i.line}.`);o=s.end;continue}}a+=s,o+=1}return a}function m(e,t,n){return{...e,positionals:(e.positionals??[]).map(e=>p(e,t,n)),flags:h(e.flags,t,n)??{},runtime:h(e.runtime,t,n)}}function h(e,t,n){return e&&g(e,t,n)}function g(e,t,n){return typeof e==`string`?p(e,t,n):Array.isArray(e)?e.map(e=>g(e,t,n)):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,r])=>[e,g(r,t,n)])):e}function _(e){return Object.entries(e.values).filter(([t,r])=>r.length>0&&(!n(t)||e.expandedBuiltinNames?.has(t))).map(([e,t])=>({name:e,value:t})).sort((e,t)=>t.value.length-e.value.length)}export{s as a,o as i,_ as n,c as o,a as r,m as s,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{C 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=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}var f=e({DAEMON_SOURCE_ENTRY:()=>o,findProjectRoot:()=>d,isSourceCheckoutProjectRoot:()=>s,readVersion:()=>u});export{s as a,o as i,d as n,u as r,f as t};
|
package/dist/src/video.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{C as e}from"./sdk-contracts.js";import{nr 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{t as a}from"./file.js";import"./command.js";import"./retry.js";import"./process.js";import o from"node:path";import s from"node:fs";import{createHash as c}from"node:crypto";import l from"node:os";function u(e=process.env){let t=p(),n=o.join(t,`home`),r=o.join(t,`module-cache`);return s.mkdirSync(n,{recursive:!0}),s.mkdirSync(r,{recursive:!0}),{...e,HOME:n,CLANG_MODULE_CACHE_PATH:r}}async function d(e){let t=[e.sourcePath,...e.extraSourcePaths??[]],n=t.map(e=>({sourcePath:e,stat:s.statSync(e),source:s.readFileSync(e)})),r=_(e.cacheName??o.basename(e.sourcePath,o.extname(e.sourcePath))),i=v([`2`,process.platform,process.arch,...n.flatMap(({sourcePath:e,stat:t,source:n})=>[o.resolve(e),t.size,n])]),a=o.join(p(),`bin`,`${r}-${i}`);return await m({sourcePaths:t,executablePath:a,timeoutMs:e.timeoutMs}),a}async function f(e){let t=_(e.cacheName),n=v([`2`,process.platform,process.arch,e.source]),r=o.join(p(),`sources`,`${t}-${n}.swift`),i=o.join(p(),`bin`,`${t}-${n}`);return await m({sourcePaths:[r],executablePath:i,sourceText:e.source,timeoutMs:e.timeoutMs}),i}function p(){let e=process.env.AGENT_DEVICE_SWIFT_CACHE_DIR?.trim();return e?o.resolve(e):o.join(l.tmpdir(),`agent-device-swift-cache`)}async function m(e){if(g(e.executablePath))return;let t=o.dirname(e.executablePath);s.mkdirSync(t,{recursive:!0});let n=await h(`${e.executablePath}.lock`,e.executablePath,e.timeoutMs??12e4);if(!n)return;let i=s.mkdtempSync(o.join(t,`.${o.basename(e.executablePath)}.${process.pid}.`)),a=o.join(i,o.basename(e.executablePath));try{if(g(e.executablePath))return;let[t]=e.sourcePaths;e.sourceText!==void 0&&t&&!s.existsSync(t)&&(s.mkdirSync(o.dirname(t),{recursive:!0}),s.writeFileSync(t,e.sourceText)),await r(`xcrun`,[`swiftc`,...e.sourcePaths,`-o`,a],{timeoutMs:e.timeoutMs??12e4,env:u()}),s.renameSync(a,e.executablePath)}finally{s.rmSync(i,{recursive:!0,force:!0}),await n()}}async function h(t,r,i){if(g(r))return null;try{return await a({lockDirPath:t,owner:{pid:process.pid,startTime:n(process.pid),acquiredAtMs:Date.now()},timeoutMs:i,pollMs:25,ownerGraceMs:i,description:`Swift cache lock: ${t} (${i}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:i,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 g(e){try{return s.accessSync(e,s.constants.X_OK),s.statSync(e).isFile()}catch{return!1}}function _(e){return t(e.replaceAll(/[^A-Za-z0-9._-]/g,`-`))||`swift-helper`}function v(e){let t=c(`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 y={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 b(e){let t=x(e);if(!t)return!1;let{bytes:n,fileSize:r}=t,i=M(n,0,n.length,r);if(!i||i.id!==y.ebml||!i.complete||i.unknownSize||!S(n,i))return!1;let a=M(n,i.nextOffset,n.length,r);return!a||a.id!==y.segment||!I(a,r)?!1:C(n,a,r)}function x(e){try{let t=s.openSync(e,`r`);try{let e=s.fstatSync(t).size;if(e<=0)return;let n=Buffer.alloc(Math.min(e,1048576));return s.readSync(t,n,0,n.length,0)===n.length?{bytes:n,fileSize:e}:void 0}finally{s.closeSync(t)}}catch{return}}function S(e,t){let n=j(e,t)?.find(e=>e.id===y.documentType);return n!==void 0&&e.toString(`ascii`,n.dataStart,n.dataEnd)===`webm`}function C(e,t,n){let r=new Set,i=new Set;for(let a=t.dataStart;a<t.dataEnd;){let o=M(e,a,t.dataEnd,n);if(!o||!I(o,n))return!1;if(o.id===y.tracks&&w(e,o,r),o.id===y.cluster&&E(e,o,n,i),L(r,i))return!0;if(!o.complete||o.unknownSize)return!1;a=o.nextOffset}return!1}function w(e,t,n){let r=j(e,t);if(r){for(let t of r)if(t.id===y.trackEntry){let r=T(e,t);r!==void 0&&n.add(r)}}}function T(e,t){let n=j(e,t),r=A(e,n,y.trackNumber),i=A(e,n,y.trackType),a=n?.find(e=>e.id===y.codecId),o=a?e.toString(`ascii`,a.dataStart,a.dataEnd):void 0;return i===1&&o?.startsWith(`V_`)?r:void 0}function E(e,t,n,r){for(let i=t.dataStart;i<t.dataEnd;){let a=M(e,i,t.dataEnd,n);if(!a||!I(a,n)||(a.id===y.simpleBlock&&O(e,a,r),a.id===y.blockGroup&&D(e,a,r),!a.complete||a.unknownSize))return;i=a.nextOffset}}function D(e,t,n){let r=j(e,t)?.find(e=>e.id===y.block);r&&O(e,r,n)}function O(e,t,n){if(!t.complete||t.unknownSize)return;let r=P(e,t.dataStart);!r||r.unknown||t.dataEnd-t.dataStart<r.length+4||n.add(r.value)}function k(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 A(e,t,n){let r=t?.find(e=>e.id===n);return r?k(e,r):void 0}function j(e,t){if(!t.complete||t.unknownSize)return;let n=[];for(let r=t.dataStart;r<t.dataEnd;){let i=M(e,r,t.dataEnd,e.length);if(!i||!i.complete||i.unknownSize)return;n.push(i),r=i.nextOffset}return n}function M(e,t,n,r){let i=N(e,t);if(!i)return;let a=P(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 N(e,t){let n=F(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 P(e,t){let n=F(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 F(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 I(e,t){return e.unknownSize||e.nextOffset<=t}function L(e,t){for(let n of e)if(t.has(n))return!0;return!1}let R;async function z(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=s.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 B(e){let t=await G(e);if(!t)return!1;if(t===`webm`)return!0;try{let t=await V(),n=await r(t,[e],{allowFailure:!0,timeoutMs:1e4,env:u()});return n.exitCode===0||W(n.stderr,n.stdout)}catch(e){if(H(e))return!0;throw e}}async function V(){R??=f({source:`import Foundation
|
|
2
2
|
import AVFoundation
|
|
3
3
|
|
|
4
4
|
let url = URL(fileURLWithPath: CommandLine.arguments[1])
|
|
@@ -20,4 +20,4 @@ Task {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
semaphore.wait()
|
|
23
|
-
exit(exitCode)`,cacheName:`video-validator`,timeoutMs:3e4});try{return await R}catch(e){throw R=void 0,e}}function H(t){return t instanceof e?t.code===`TOOL_MISSING`||W(String(t.details?.stderr??``),String(t.details?.stdout??``)):!1}async function U(e,t={}){let n=t.pollMs??150,r=t.attempts??12;for(let t=0;t<r;t+=1){if(await B(e))return;await i(n)}}function W(e,t){let n=`${e}\n${t}`;return/\b(no such module ['"]AVFoundation['"]|unable to find utility ["']swiftc?["']|xcrun: error: unable to find utility ["']swiftc?["'])\b/i.test(n)}function G(e){try{let t=s.statSync(e);if(!t.isFile()||t.size<=0)return}catch{return}
|
|
23
|
+
exit(exitCode)`,cacheName:`video-validator`,timeoutMs:3e4});try{return await R}catch(e){throw R=void 0,e}}function H(t){return t instanceof e?t.code===`TOOL_MISSING`||W(String(t.details?.stderr??``),String(t.details?.stdout??``)):!1}async function U(e,t={}){let n=t.pollMs??150,r=t.attempts??12;for(let t=0;t<r;t+=1){if(await B(e))return;await i(n)}}function W(e,t){let n=`${e}\n${t}`;return/\b(no such module ['"]AVFoundation['"]|unable to find utility ["']swiftc?["']|xcrun: error: unable to find utility ["']swiftc?["'])\b/i.test(n)}async function G(e){try{let t=s.statSync(e);if(!t.isFile()||t.size<=0)return}catch{return}return e.toLowerCase().endsWith(`.webm`)?b(e)?`webm`:void 0:await K(e)?`mp4`:void 0}async function K(e){let{findMp4Atom:t}=await import(`./mp4-atoms.js`).then(e=>e.n);return t(e,[`ftyp`])!==void 0&&t(e,[`moov`])!==void 0}export{d as a,u as i,U as n,z as r,B as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C 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{C 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{C 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`),doubleTap:()=>n(`doubleTap`),longPress:()=>n(`longPress`),focus:()=>n(`focus`),type:()=>n(`type`),fill:()=>n(`fill`),scroll:()=>n(`scroll`),screenshot:()=>n(`screenshot`),snapshot:()=>n(`snapshot`),back:()=>n(`back`),home:()=>n(`home`),setOrientation:()=>n(`setOrientation`),appSwitcher:()=>n(`appSwitcher`),tvRemote:()=>n(`tvRemote`),readClipboard:()=>n(`readClipboard`),writeClipboard:()=>n(`writeClipboard`),setSetting:()=>n(`setSetting`),readAlert:()=>n(`readAlert`),awaitAlert:()=>n(`awaitAlert`),acceptAlert:()=>n(`acceptAlert`),dismissAlert:()=>n(`dismissAlert`)}}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{t as e}from"./webdriver-source.js";import{r as t,t as n}from"./ios-snapshot-acquisition.js";
|
|
1
|
+
import{t as e}from"./webdriver-source.js";import{r as t,t as n}from"./ios-snapshot-acquisition.js";function r(r,i){let a=e(r),o=t(a.roots)??{kind:`missing`,reason:`not-provided`};return n({producer:`appium-source`,nodes:a.nodes,viewport:o,lineage:i?{targetId:i}:{}})}export{r as acquireWebDriverIosSnapshot};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime.js";import{C 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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./adb.js";import{n as t,o as n,t as r}from"./app-parsers.js";const i=[[`shell`,`dumpsys`,`window`,`windows`],[`shell`,`dumpsys`,`window`]],a={foreground:{tiers:[i,[[`shell`,`dumpsys`,`activity`,`activities`],[`shell`,`dumpsys`,`activity`]]],section:g(t)},blockingDialog:{tiers:[i],section:g([r])}},o=RegExp(`(?:${t.map(_).join(`|`)})(.*)$`,`gm`),s=new Map;function c(t){let n=new Map;return r=>{let i=r.join(` `),a=n.get(i)??e(t,[...r],{allowFailure:!0}).then(e=>{let n=e.stdout??``;return f(t,i,n),n});return n.set(i,a),a}}async function l(e,t=c(e)){for(let n of p(e,`foreground`)){let e=v(await t(n));if(e)return e}return{}}async function u(e,t=c(e)){for(let r of p(e,`blockingDialog`)){let{focusObserved:e,focus:i}=n(await t(r));if(i)return{status:`dialog`,focus:i};if(e)return{status:`clear`}}return{status:`unknown`}}function d(){s.clear()}function f(e,t,n){if(n.length===0)return;let r=s.get(e.id)??new Map;for(let[e,i]of Object.entries(a)){let a=h(e,t);r.get(a)!==!0&&r.set(a,i.section.test(n))}s.set(e.id,r)}function p(e,t){let n=s.get(e.id);return a[t].tiers.flatMap(e=>m(e,t,n))}function m(e,t,n){if(!n)return e;let r=e=>n.get(h(t,e.join(` `)))===!1,i=e.filter(e=>!r(e));return i.length===e.length||i.length===0?e:[...i,...e.filter(r)]}function h(e,t){return`${e} ${t}`}function g(e){return new RegExp(e.map(_).join(`|`))}function _(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}function v(e){for(let t of e.matchAll(o)){let e=t[1]?.match(/\b([A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z0-9_]+)+)\/([A-Za-z0-9_.$]+)/);if(e?.[1]&&e[2])return{package:e[1],activity:e[2]}}return null}export{d as i,l as n,u as r,c 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.2",
|
|
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",
|
|
@@ -124,6 +124,7 @@
|
|
|
124
124
|
"bench:ios-snapshot": "node --experimental-strip-types scripts/ios-snapshot-benchmark/run.ts",
|
|
125
125
|
"bench:ios-snapshot:deep-button": "node --experimental-strip-types scripts/ios-snapshot-benchmark/deep-button.ts",
|
|
126
126
|
"bench:ios-snapshot:evidence": "node --experimental-strip-types scripts/ios-snapshot-benchmark/evidence.ts",
|
|
127
|
+
"bench:png-crop": "node --experimental-strip-types scripts/png-crop-benchmark/run.ts",
|
|
127
128
|
"bench:ios-ax-bridge:targeted": "node --experimental-strip-types scripts/ios-ax-bridge-spike/targeted-run.ts",
|
|
128
129
|
"mutation:run": "node --experimental-strip-types scripts/mutation/run.ts",
|
|
129
130
|
"mutation:check": "node --experimental-strip-types scripts/mutation/run.ts --no-run",
|
|
@@ -156,6 +157,7 @@
|
|
|
156
157
|
"check:daemon-wire-compat": "node --experimental-strip-types scripts/wire-compat/run.ts",
|
|
157
158
|
"check:daemon-wire-compat:test": "node --experimental-strip-types scripts/node-test-tmpdir.ts --experimental-strip-types --test scripts/wire-compat/model.test.ts",
|
|
158
159
|
"check:xctest-selection": "node --experimental-strip-types scripts/check-xctest-selection.ts",
|
|
160
|
+
"check:packaged-runner-swift": "node --experimental-strip-types scripts/check-packaged-runner-swift.ts",
|
|
159
161
|
"check:tmpdir-leaks": "node --experimental-strip-types scripts/check-tmpdir-leaks.ts",
|
|
160
162
|
"check:tmpdir-leaks:test": "node --experimental-strip-types scripts/node-test-tmpdir.ts --experimental-strip-types --test scripts/check-tmpdir-leaks-model.test.ts scripts/vitest-tmpdir-global-setup.test.ts scripts/node-test-tmpdir.test.ts scripts/swift-toolchain-tmpdir.test.ts",
|
|
161
163
|
"check:freerange": "fr",
|
|
@@ -163,7 +165,7 @@
|
|
|
163
165
|
"sync:mcp-metadata": "node scripts/sync-mcp-metadata.mjs",
|
|
164
166
|
"check:mcp-metadata": "node scripts/sync-mcp-metadata.mjs --check",
|
|
165
167
|
"version": "pnpm sync:mcp-metadata && git add server.json",
|
|
166
|
-
"check:tooling": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm check:layering && pnpm depgraph:test && pnpm check:gate-manifest:test && pnpm check:gate-manifest && pnpm check:production-exports && pnpm check:tmpdir-leaks:test && pnpm check:xctest-selection && pnpm check:mcp-metadata && pnpm build && pnpm check:bundle-owner-files && pnpm check:package",
|
|
168
|
+
"check:tooling": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm check:layering && pnpm depgraph:test && pnpm check:gate-manifest:test && pnpm check:gate-manifest && pnpm check:production-exports && pnpm check:tmpdir-leaks:test && pnpm check:xctest-selection && pnpm check:packaged-runner-swift && pnpm check:mcp-metadata && pnpm build && pnpm check:bundle-owner-files && pnpm check:package",
|
|
167
169
|
"check:unit": "pnpm test:unit && pnpm check:tmpdir-leaks && pnpm test:smoke",
|
|
168
170
|
"check": "pnpm check:tooling && pnpm check:fallow && pnpm check:unit",
|
|
169
171
|
"prepack": "pnpm check:mcp-metadata && pnpm package:npm",
|
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.2",
|
|
11
11
|
"packages": [
|
|
12
12
|
{
|
|
13
13
|
"registryType": "npm",
|
|
14
14
|
"identifier": "agent-device",
|
|
15
|
-
"version": "0.21.
|
|
15
|
+
"version": "0.21.2",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|
|
18
18
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2f486edc5788d34f3ba8afd551f33e59a4823a6f358d2a3e883e93b3f2a0d7e8 agent-device-android-ime-helper-0.21.0.apk
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
536b4096b0bfd7e224a6ebbeeff1daaca0a8df4dc56abd3e410541ad1733048f agent-device-android-snapshot-helper-0.21.0.apk
|