agent-device 0.21.6 → 0.21.8
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.6.apk → agent-device-android-ime-helper-0.21.8.apk} +0 -0
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.8.apk.sha256 +1 -0
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.6.manifest.json → agent-device-android-ime-helper-0.21.8.manifest.json} +4 -4
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.6.apk → agent-device-android-snapshot-helper-0.21.8.apk} +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.8.apk.sha256 +1 -0
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.6.manifest.json → agent-device-android-snapshot-helper-0.21.8.manifest.json} +6 -6
- package/apple/macos-helper/Package.swift +16 -1
- package/apple/macos-helper/Sources/AgentDeviceMacOSDeviceHub/DeviceHubPose.swift +47 -0
- package/apple/macos-helper/Sources/AgentDeviceMacOSHelper/DeviceHubPose.swift +320 -0
- package/apple/macos-helper/Sources/AgentDeviceMacOSHelper/main.swift +66 -13
- package/apple/macos-helper/Sources/AgentDeviceMacOSInput/MouseClickDelivery.swift +116 -0
- package/apple/macos-helper/Sources/AgentDeviceMacOSInput/MouseClickSchedule.swift +61 -0
- package/apple/macos-helper/Tests/AgentDeviceMacOSDeviceHubTests/DeviceHubPoseTests.swift +30 -0
- package/apple/macos-helper/Tests/AgentDeviceMacOSInputTests/MouseClickScheduleTests.swift +58 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.h +4 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.m +20 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerScrollViewportPolicy.swift +1 -2
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +25 -12
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +56 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +1 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +36 -108
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Keyboard.swift +241 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +29 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +46 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+PrivateAXPresentation.swift +85 -26
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +134 -117
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotBackendCapabilities.swift +1 -3
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +25 -4
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +1 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +3 -0
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotCoordinateSpace.swift +197 -0
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotModels.swift +30 -4
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentation.swift +0 -81
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentationInvariant.swift +1 -9
- package/dist/src/absence-observation-errors.js +1 -1
- package/dist/src/adapter.js +1 -1
- package/dist/src/adb-executor.js +2 -2
- package/dist/src/adb-failure.js +1 -1
- package/dist/src/adb-transport.js +1 -1
- package/dist/src/adb.js +1 -1
- package/dist/src/agent-browser-lifecycle.js +1 -1
- package/dist/src/agent-browser-process-record.js +1 -1
- package/dist/src/agent-browser-provider.js +1 -1
- package/dist/src/agent-browser-tool.js +1 -1
- package/dist/src/agent-device-client.js +2 -2
- package/dist/src/ai-sdk.js +1 -1
- package/dist/src/alert-runtime.js +1 -1
- package/dist/src/android-adb.d.ts +29 -2
- package/dist/src/android-adb.js +1 -1
- package/dist/src/android-input-ownership.js +1 -1
- package/dist/src/android.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.js +1 -1
- package/dist/src/app-launch.js +2 -2
- package/dist/src/app-lifecycle.js +2 -2
- package/dist/src/app-lifecycle2.js +2 -2
- package/dist/src/app-log-files.js +1 -1
- package/dist/src/app-log-runtime2.js +3 -3
- package/dist/src/app-resolution.js +2 -2
- package/dist/src/app-state.js +1 -1
- package/dist/src/apple-runner-platform.js +1 -1
- package/dist/src/application-lifecycle-interaction.js +1 -1
- package/dist/src/archive.js +1 -1
- package/dist/src/artifact-download.js +1 -1
- package/dist/src/auth-session.js +1 -1
- package/dist/src/auth.js +1 -1
- package/dist/src/back-mode.js +1 -1
- package/dist/src/backend-snapshot-options.js +1 -1
- package/dist/src/boot-diagnostics.js +1 -1
- package/dist/src/capture-disclosure.js +1 -0
- package/dist/src/capture.js +1 -1
- package/dist/src/cli-config.js +1 -1
- package/dist/src/cli-help.js +18 -2
- package/dist/src/cli-output.js +1 -1
- package/dist/src/cli.js +4 -4
- package/dist/src/click-button.js +1 -1
- package/dist/src/client-metro.js +1 -1
- package/dist/src/client-types.d.ts +65 -3
- package/dist/src/clipboard-shell-response.js +1 -0
- package/dist/src/command-schema.js +1 -1
- package/dist/src/command-tools.js +4 -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 +1 -1
- 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.js +1 -1
- package/dist/src/debug-symbols-facade.js +1 -1
- package/dist/src/device-boot.js +1 -1
- package/dist/src/device-claim-inspection.js +1 -1
- package/dist/src/device-claim-rule.js +2 -1
- package/dist/src/device-input-state.d.ts +5 -5
- package/dist/src/device-inventory-context.js +1 -1
- package/dist/src/device-rotation.js +1 -1
- package/dist/src/device-selection-resolver.js +1 -1
- package/dist/src/device-session.js +1 -1
- package/dist/src/device-shell.js +1 -0
- package/dist/src/device.js +1 -1
- package/dist/src/device2.js +1 -1
- package/dist/src/devicectl.js +1 -0
- package/dist/src/diagnostics.js +1 -1
- package/dist/src/dispatch-resolve.js +1 -1
- package/dist/src/display-inventory.js +1 -0
- package/dist/src/doctor-facade.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 -1
- package/dist/src/error.js +1 -1
- package/dist/src/exec.js +1 -1
- package/dist/src/file.js +1 -1
- package/dist/src/find.js +1 -1
- package/dist/src/finders.js +1 -1
- package/dist/src/format.js +2 -1
- package/dist/src/generic.js +1 -1
- package/dist/src/gesture-admission.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/host.js +1 -0
- 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 +1 -1
- package/dist/src/install-artifact-facade.js +1 -1
- package/dist/src/install-source-network-transport.js +1 -1
- package/dist/src/install-source2.js +1 -1
- package/dist/src/interaction-positionals.js +1 -1
- package/dist/src/interaction-ref-policy.js +1 -1
- package/dist/src/interaction.js +1 -1
- package/dist/src/interaction2.js +1 -1
- package/dist/src/interactor-operation-binding.js +1 -0
- package/dist/src/interactor-operation-catalog.js +1 -1
- package/dist/src/interactor.js +4 -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 +9 -1
- 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 +4 -4
- package/dist/src/inventory2.js +1 -1
- package/dist/src/inventory3.js +2 -2
- package/dist/src/inventory5.js +1 -1
- package/dist/src/ios-snapshot-acquisition.js +1 -1
- package/dist/src/ios-snapshot-runtime.js +1 -1
- package/dist/src/ios-target-activation.js +1 -0
- package/dist/src/lease-context.js +1 -1
- package/dist/src/lease-scope.js +1 -1
- package/dist/src/lease.js +1 -1
- package/dist/src/limrun-download-file.js +1 -0
- package/dist/src/limrun-runtime-dependencies.js +1 -1
- package/dist/src/limrun.d.ts +10 -4
- package/dist/src/linux.js +1 -1
- package/dist/src/local-interactor-operation-set.js +1 -1
- package/dist/src/location-coordinates.js +1 -1
- package/dist/src/macos-facade.js +1 -1
- package/dist/src/managed-device-scope.js +1 -1
- package/dist/src/mechanics.js +17 -16
- package/dist/src/mobile-snapshot-semantics.js +1 -1
- package/dist/src/multitouch-support.js +1 -1
- package/dist/src/observation.js +2 -2
- package/dist/src/output-common.js +5 -2
- package/dist/src/parameterized-recorded-fill.js +1 -1
- package/dist/src/perf-facade.js +2 -2
- 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-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 +4 -4
- package/dist/src/platform-runtime-runtime-hints.js +2 -2
- package/dist/src/platform-runtime-screen-recording-android-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-apple-runner-transport.js +1 -1
- package/dist/src/platform-runtime-screen-recording-apple-simulator-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-apple-transport.js +1 -1
- package/dist/src/platform-runtime-screen-recording-finalizer-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-harmony-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-process-host.js +1 -1
- package/dist/src/platform-runtime-unavailable.js +1 -1
- package/dist/src/platform-runtime.js +1 -1
- package/dist/src/platform-runtime2.js +1 -1
- package/dist/src/png-crop-bytes.js +1 -1
- package/dist/src/png-worker-client.js +1 -0
- package/dist/src/png.js +1 -1
- package/dist/src/prepare-kind.js +1 -1
- package/dist/src/provider-session-ownership.js +1 -1
- package/dist/src/provider-webdriver.js +1 -1
- package/dist/src/proxy.js +1 -1
- package/dist/src/quality-warnings.js +1 -1
- package/dist/src/react-native.js +1 -1
- package/dist/src/record-runtime.js +1 -1
- package/dist/src/record-trace.js +1 -1
- package/dist/src/rect-center.js +1 -1
- package/dist/src/register-builtins.js +1 -1
- package/dist/src/registry.js +35 -35
- package/dist/src/remote-config2.js +1 -1
- package/dist/src/replay-divergence.js +1 -1
- package/dist/src/replay.js +1 -1
- package/dist/src/reporting.js +1 -1
- package/dist/src/request-admission.js +1 -1
- package/dist/src/request-cancel.js +1 -1
- package/dist/src/request-runtime-binding.js +1 -1
- package/dist/src/result-serialization.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-contract.js +3 -0
- package/dist/src/runner-dev-tools-security.js +1 -0
- package/dist/src/runner-device-readiness.js +1 -0
- 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 -1
- package/dist/src/runtime2.js +4 -4
- package/dist/src/runtime3.js +1 -1
- package/dist/src/runtime4.js +5 -5
- package/dist/src/runtime5.js +1 -1
- package/dist/src/runtime6.js +1 -1
- package/dist/src/runtime7.js +1 -1
- package/dist/src/runtime8.js +1 -1
- package/dist/src/runtime9.js +1 -1
- package/dist/src/screen-recording-admission-ledger.js +1 -0
- package/dist/src/screen-recording-completion.js +1 -1
- package/dist/src/screen-recording-options.js +1 -1
- package/dist/src/screen-recording-resource-recovery.js +1 -1
- package/dist/src/screen-recording-transport.js +1 -0
- package/dist/src/screenshot-density.js +1 -1
- package/dist/src/screenshot-image.js +1 -0
- package/dist/src/screenshot-runtime.js +1 -1
- package/dist/src/screenshot.js +1 -1
- package/dist/src/screenshot3.js +1 -1
- package/dist/src/script.js +1 -1
- package/dist/src/scroll-command.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 +76 -1
- 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.js +1 -1
- package/dist/src/sdk-selectors.d.ts +29 -3
- 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 +1 -1
- package/dist/src/session-allocation.js +1 -1
- package/dist/src/session-observation.js +1 -1
- package/dist/src/session-routing.js +1 -1
- package/dist/src/session-runtime-admission.js +1 -1
- package/dist/src/session-snapshot.js +1 -1
- package/dist/src/session-store.js +3 -3
- package/dist/src/session2.js +4 -5
- package/dist/src/settings.js +1 -1
- package/dist/src/simctl-facade.js +1 -1
- package/dist/src/simctl.js +1 -1
- package/dist/src/simulator-boot.js +1 -1
- package/dist/src/simulator-facade.js +1 -1
- package/dist/src/simulator.js +1 -1
- package/dist/src/snapshot-capture-annotations.js +1 -1
- package/dist/src/snapshot-diagnostics.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/snapshot.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/src4.js +1 -1
- package/dist/src/src7.js +1 -1
- package/dist/src/src8.js +2 -2
- package/dist/src/stop-sequence.js +1 -1
- package/dist/src/string-enum.js +1 -1
- package/dist/src/takeover.js +1 -1
- package/dist/src/text-entry-focus.js +1 -1
- package/dist/src/tool-provider.js +1 -1
- package/dist/src/tool-provider2.js +1 -1
- package/dist/src/touch-runtime.js +1 -1
- package/dist/src/transport.js +1 -1
- package/dist/src/tree.js +1 -1
- package/dist/src/tv-remote.js +1 -1
- package/dist/src/type-text-runtime.js +1 -1
- package/dist/src/verified-file.js +1 -1
- package/dist/src/video.js +1 -1
- package/dist/src/viewport.js +1 -1
- package/dist/src/web.js +1 -1
- package/dist/src/web2.js +1 -1
- package/dist/src/webdriver-source.js +1 -1
- package/dist/src/window-state.js +1 -1
- package/package.json +4 -1
- package/server.json +2 -2
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.6.apk.sha256 +0 -1
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.6.apk.sha256 +0 -1
- package/dist/src/session-target-evidence.js +0 -1
- package/dist/src/vars.js +0 -2
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{D as r,k 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 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};
|
|
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 R(e,t,n){return(0,P.isSeq)(e)||I(`Maestro ${t} expects a list.`,e,n),e.items}function et(e,t,n){return R(e,t,n).map((e,r)=>K(e,`${t}[${r}]`,n))}function z(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 B(e,t){return e.some(e=>e.key===t)}function V(e,t){return e.find(e=>e.key===t)?.value}function H(e,t,n){return B(e,t)?n(V(e,t)):void 0}function U(e,t,n){return o({optional:H(e,`optional`,e=>J(e,`${t}.optional`,n))})}function W(e){return e===null||(0,P.isScalar)(e)&&e.value===null}function G(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 K(e,t,n){let r=G(e,t,n);return typeof r!=`string`&&I(`Maestro ${t} expects a string.`,e,n),r}function q(e,t,n){let r=G(e,t,n);if(r!==null)return typeof r!=`string`&&I(`Maestro ${t} expects a string.`,e,n),r}function J(e,t,n){let r=G(e,t,n);if(r!==null)return typeof r!=`boolean`&&I(`Maestro ${t} expects a boolean.`,e,n),r}const tt=/^\$\{[A-Za-z_][A-Za-z0-9_.]*\}$/,nt=new Set([`allow`,`deny`,`unset`,`always`,`inuse`,`never`,`limited`]),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(tt.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 Y(e,t,n,r=at[t]??{}){let i=G(e,t,n);if(i!==null)return ct(i,t,e,n,r)}function lt(e,t,n){let r=at[t]??{},i=G(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=G(e,t,n);return r===null&&I(`Maestro ${t} requires a condition.`,e,n),typeof r==`string`&&r.includes("${")&&!tt.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=G(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 X(e,t,n){return H(e,`label`,e=>q(e,`${t}.label`,n))}const Z=[`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)=>vt(e,`id`,t,n,r),text:(e,t,n,r)=>vt(e,`text`,t,n,r),enabled:(e,t,n,r)=>yt(e,`enabled`,t,n,r),selected:(e,t,n,r)=>yt(e,`selected`,t,n,r),index:(e,t,n,r)=>{e.index=Y(t.value,`${n}.index`,r,{integer:!0,nonNegative:!0})},childOf:(e,t,n,r)=>{e.childOf=Q(t.value,`${n}.childOf`,r)},below:(e,t,n,r)=>{e.below=Q(t.value,`${n}.below`,r)},above:(e,t,n,r)=>{e.above=Q(t.value,`${n}.above`,r)},leftOf:(e,t,n,r)=>{e.leftOf=Q(t.value,`${n}.leftOf`,r)},rightOf:(e,t,n,r)=>{e.rightOf=Q(t.value,`${n}.rightOf`,r)},containsChild:(e,t,n,r)=>{e.containsChild=Q(t.value,`${n}.containsChild`,r)},containsDescendants:(e,t,n,r)=>{e.containsDescendants=R(t.value,`${n}.containsDescendants`,r).map(e=>Q(e,`${n}.containsDescendants`,r))},optional:(e,t,n,r)=>yt(e,`optional`,t,n,r)};function Q(e,t,n,r=Z){if((0,P.isScalar)(e))return{text:K(e,t,n)};let i=L(e,t,n);return z(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:xt(Q(e,r.name,n,r.selectorKeys))};let a=L(e,r.name,n),o=B(a,`point`);if(z(a,r.name,o?r.pointAllowedKeys:r.selectorAllowedKeys,n),o){let e=r.pointConflictingSelectorKeys??r.selectorKeys;return a.some(t=>bt(t.key,e))&&I(`Maestro ${r.name}.point cannot be combined with a selector.`,t,n),{source:i,entries:a,target:r.parsePoint(V(a,`point`),`${r.name}.point`,n)}}return{source:i,entries:a,target:xt(mt(a.filter(e=>bt(e.key,r.selectorKeys)),r.name,n))}}function gt(e,t,n){let r=K(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 _t(e,t,n){let r=gt(e,t,n);return r.space!==`absolute`&&I(`Maestro ${t} only supports absolute coordinates.`,e,n),r}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,n,r,i){let a=J(n.value,`${r}.${t}`,i);a!==void 0&&(e[t]=a)}function bt(e,t){return t.includes(e)}function xt(e){return{space:`target`,selector:e}}function St(e,t,n){let r=ht(e,t,n,{name:`tapOn`,selectorKeys:Z,pointConflictingSelectorKeys:Z,pointAllowedKeys:[`point`,`retryTapIfNoChange`,`repeat`,`delay`,`optional`,`label`],selectorAllowedKeys:[...Z,`retryTapIfNoChange`,`repeat`,`delay`,`optional`,`label`],parsePoint:gt});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,...kt(r.entries,n)};let i=kt(r.entries,n);return o({kind:`tapOn`,source:r.source,target:r.target,...i})}function Ct(e,t,n){let r=ht(e,t,n,{name:`doubleTapOn`,selectorKeys:Z,pointAllowedKeys:[`point`,`delay`,`optional`,`label`],selectorAllowedKeys:[...Z,`delay`,`optional`,`label`],parsePoint:_t}),i=U(r.entries,`doubleTapOn`,n),a=B(r.entries,`delay`)?Y(V(r.entries,`delay`),`doubleTapOn.delay`,n):void 0,s=X(r.entries,`doubleTapOn`,n);return o({kind:`doubleTapOn`,source:r.source,target:r.target,...i,delay:a,label:s})}function wt(e,t,n){let r=ht(e,t,n,{name:`longPressOn`,selectorKeys:Z,pointAllowedKeys:[`point`,`optional`,`label`],selectorAllowedKeys:[...Z,`optional`,`label`],parsePoint:_t});return o({kind:`longPressOn`,source:r.source,target:r.target,...U(r.entries,`longPressOn`,n),label:X(r.entries,`longPressOn`,n)})}function Tt(e,t,n){let r=F(t,n),i=L(e,`swipe`,n);z(i,`swipe`,[`start`,`end`,`direction`,`duration`,`from`,`label`,`optional`],n);let a=U(i,`swipe`,n),o=X(i,`swipe`,n),s=B(i,`duration`)?Y(V(i,`duration`),`swipe.duration`,n):void 0;if(B(i,`start`)||B(i,`end`))return{...Et(i,r,s,t,n),...a,label:o};let c=B(i,`direction`)?At(V(i,`direction`),`swipe.direction`,n):void 0;return B(i,`from`)?{...Dt(i,r,c,s,t,n),...a,label:o}:{...Ot(r,c,s,t,n),...a,label:o}}function Et(e,t,n,r,i){B(e,`direction`)&&I(`Maestro swipe cannot combine direction with start/end coordinates.`,r,i),(!B(e,`start`)||!B(e,`end`))&&I(`Maestro swipe requires both start and end coordinates.`,r,i);let a=gt(V(e,`start`),`swipe.start`,i),s=gt(V(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 Dt(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:Q(V(e,`from`),`swipe.from`,a),direction:n,duration:r})}}function Ot(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 kt(e,t){let n=H(e,`retryTapIfNoChange`,e=>J(e,`tapOn.retryTapIfNoChange`,t)),r=H(e,`repeat`,e=>lt(e,`tapOn.repeat`,t)),i=H(e,`delay`,e=>Y(e,`tapOn.delay`,t)),a=U(e,`tapOn`,t).optional;return o({retryTapIfNoChange:n,repeat:r,delay:i,optional:a,label:X(e,`tapOn`,t)})}function At(e,t,n){let r=K(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 jt(e,t,n,r){let i=F(n,r);if((0,P.isScalar)(t))return{kind:e,source:i,target:Q(t,e,r)};let a=L(t,e,r);z(a,e,[...Z,`optional`,`label`],r);let s=U(a,e,r),c=X(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 Mt=[...Z,`optional`];function Nt(e,t,n,r){if(!B(e,t))return;let{optional:i,...a}=Q(V(e,t),n,r,Mt);return{selector:a,optional:i}}function Pt(e,t,n){let r=Nt(e,`visible`,`extendedWaitUntil.visible`,n),i=Nt(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 Ft(e,t,n){let r=F(t,n);if((0,P.isScalar)(e))return{kind:`runScript`,source:r,file:K(e,`runScript`,n)};let i=L(e,`runScript`,n);return z(i,`runScript`,[`file`,`env`],n),B(i,`file`)||I(`Maestro runScript requires a file.`,t,n),o({kind:`runScript`,source:r,file:K(V(i,`file`),`runScript.file`,n),env:B(i,`env`)?dt(V(i,`env`),`runScript.env`,n):void 0})}function It(e,t,n,r){let i=F(t,n);if((0,P.isScalar)(e))return{kind:`runFlow`,source:i,include:{kind:`file`,path:K(e,`runFlow`,n)}};let a=L(e,`runFlow`,n);z(a,`runFlow`,[`file`,`commands`,`env`,`when`,`label`],n);let s=B(a,`file`);return s===B(a,`commands`)&&I(`Maestro runFlow requires exactly one of file or commands.`,t,n),o({kind:`runFlow`,source:i,include:s?{kind:`file`,path:K(V(a,`file`),`runFlow.file`,n)}:{kind:`commands`,commands:r(V(a,`commands`),`runFlow.commands`,n)},env:B(a,`env`)?dt(V(a,`env`),`runFlow.env`,n):void 0,when:B(a,`when`)?zt(V(a,`when`),n):void 0,label:X(a,`runFlow`,n)})}function Lt(e,t,n,r){let i=F(t,n),a=L(e,`repeat`,n);return z(a,`repeat`,[`times`,`commands`,`while`],n),B(a,`while`)&&I(`Maestro repeat.while is not supported; use repeat.times.`,V(a,`while`),n),B(a,`times`)||I(`Maestro repeat requires times.`,t,n),B(a,`commands`)||I(`Maestro repeat requires commands.`,t,n),{kind:`repeat`,source:i,times:lt(V(a,`times`),`repeat.times`,n),commands:r(V(a,`commands`),`repeat.commands`,n)}}function Rt(e,t,n,r){let i=F(t,n),a=L(e,`retry`,n);z(a,`retry`,[`maxRetries`,`commands`],n),B(a,`commands`)||I(`Maestro retry requires commands.`,t,n);let s=B(a,`maxRetries`)?lt(V(a,`maxRetries`),`retry.maxRetries`,n):void 0;return o({kind:`retry`,source:i,commands:r(V(a,`commands`),`retry.commands`,n),maxRetries:s})}function zt(e,t){let n=L(e,`runFlow.when`,t);return z(n,`runFlow.when`,[`platform`,`visible`,`notVisible`,`true`],t),n.length===0&&I(`Maestro runFlow.when cannot be empty.`,e,t),o({platform:H(n,`platform`,e=>Vt(e,t)),visible:H(n,`visible`,e=>Q(e,`runFlow.when.visible`,t)),notVisible:H(n,`notVisible`,e=>Q(e,`runFlow.when.notVisible`,t)),true:H(n,`true`,e=>Bt(e,t))})}function Bt(e,t){let n=G(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 Vt(e,t){let n=K(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 R(e,t,n).map(e=>Ht(e,n))}function Ht(e,t){if((0,P.isScalar)(e))return typeof e.value!=`string`&&I(`Maestro command names must be strings.`,e,t),Ut(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 Gt(r.key,r.value,e,t)}function Ut(e,t,n){return Gt(e,null,t,n)}const Wt={launchApp:Kt,tapOn:St,doubleTapOn:Ct,longPressOn:wt,inputText:qt,eraseText:Jt,openLink:Yt,assertVisible:(e,t,n)=>jt(`assertVisible`,e,t,n),assertNotVisible:(e,t,n)=>jt(`assertNotVisible`,e,t,n),assertTrue:Xt,extendedWaitUntil:Zt,takeScreenshot:Qt,scroll:$t,scrollUntilVisible:en,swipe:Tt,hideKeyboard:tn,pressKey:nn,back:rn,waitForAnimationToEnd:an,stopApp:on,setPermissions:sn,clearState:un,runScript:Ft,evalScript:dn,runFlow:(e,t,n)=>It(e,t,n,$),repeat:(e,t,n)=>Lt(e,t,n,$),retry:(e,t,n)=>Rt(e,t,n,$)};Object.keys(Wt);function Gt(e,t,n,r){let i=Wt[e];return i||I(`Maestro command "${e}" is not supported.`,n,r),i(t,n,r)}function Kt(e,t,n){let r=F(t,n);if(W(e))return{kind:`launchApp`,source:r};if((0,P.isScalar)(e))return{kind:`launchApp`,source:r,appId:K(e,`launchApp`,n)};let i=L(e,`launchApp`,n);return z(i,`launchApp`,[`appId`,`stopApp`,`clearState`,`permissions`,`arguments`,`launchArguments`],n),o({kind:`launchApp`,source:r,appId:H(i,`appId`,e=>q(e,`launchApp.appId`,n)),stopApp:H(i,`stopApp`,e=>J(e,`launchApp.stopApp`,n)),clearState:H(i,`clearState`,e=>J(e,`launchApp.clearState`,n)),permissions:H(i,`permissions`,e=>cn(e,n,`launchApp`)),arguments:H(i,`arguments`,e=>fn(e,`launchApp.arguments`,n)),launchArguments:H(i,`launchArguments`,e=>fn(e,`launchApp.launchArguments`,n))})}function qt(e,t,n){let r=F(t,n);if((0,P.isScalar)(e))return{kind:`inputText`,source:r,text:K(e,`inputText`,n)};let i=L(e,`inputText`,n);return z(i,`inputText`,[`text`,`label`],n),B(i,`text`)||I(`Maestro inputText requires text.`,t,n),o({kind:`inputText`,source:r,text:K(V(i,`text`),`inputText.text`,n),label:X(i,`inputText`,n)})}function Jt(e,t,n){let r=F(t,n);if(W(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 z(i,`eraseText`,[`charactersToErase`],n),o({kind:`eraseText`,source:r,charactersToErase:B(i,`charactersToErase`)?Y(V(i,`charactersToErase`),`eraseText.charactersToErase`,n):void 0})}function Yt(e,t,n){let r=F(t,n);if((0,P.isScalar)(e))return{kind:`openLink`,source:r,link:K(e,`openLink`,n)};let i=L(e,`openLink`,n);return z(i,`openLink`,[`link`],n),{kind:`openLink`,source:r,link:K(V(i,`link`),`openLink.link`,n)}}function Xt(e,t,n){let r=F(t,n);if(W(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);z(i,`assertTrue`,[`condition`,`optional`,`label`],n),B(i,`condition`)||I(`Maestro assertTrue requires condition.`,t,n);let a=ut(V(i,`condition`),`assertTrue.condition`,n),s=U(i,`assertTrue`,n),c=X(i,`assertTrue`,n);return o({kind:`assertTrue`,source:r,condition:a,...s,label:c})}function Zt(e,t,n){let r=L(e,`extendedWaitUntil`,n);z(r,`extendedWaitUntil`,[`visible`,`notVisible`,`timeout`,`optional`,`label`],n);let i=U(r,`extendedWaitUntil`,n),a=X(r,`extendedWaitUntil`,n),s=Pt(r,t,n),c=B(r,`timeout`)?Y(V(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 Qt(e,t,n){return{kind:`takeScreenshot`,source:F(t,n),path:K(e,`takeScreenshot`,n)}}function $t(e,t,n){return W(e)||I(`Maestro scroll does not accept options yet.`,t,n),{kind:`scroll`,source:F(t,n)}}function en(e,t,n){let r=F(t,n);if((0,P.isScalar)(e))return{kind:`scrollUntilVisible`,source:r,element:Q(e,`scrollUntilVisible.element`,n)};let i=L(e,`scrollUntilVisible`,n);z(i,`scrollUntilVisible`,[`element`,`direction`,`timeout`,`optional`,`label`],n);let a=U(i,`scrollUntilVisible`,n),s=X(i,`scrollUntilVisible`,n),c=Nt(i,`element`,`scrollUntilVisible.element`,n);c||I(`Maestro scrollUntilVisible requires element.`,t,n);let l=B(i,`direction`)?At(V(i,`direction`),`scrollUntilVisible.direction`,n):void 0,u=B(i,`timeout`)?Y(V(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 tn(e,t,n){return W(e)||I(`Maestro hideKeyboard does not accept options.`,t,n),{kind:`hideKeyboard`,source:F(t,n)}}function nn(e,t,n){let r=K(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 rn(e,t,n){return W(e)||I(`Maestro back does not accept options.`,t,n),{kind:`back`,source:F(t,n)}}function an(e,t,n){let r=F(t,n);if(W(e))return{kind:`waitForAnimationToEnd`,source:r};if((0,P.isScalar)(e))return o({kind:`waitForAnimationToEnd`,source:r,timeout:Y(e,`waitForAnimationToEnd`,n)});let i=L(e,`waitForAnimationToEnd`,n);return z(i,`waitForAnimationToEnd`,[`timeout`],n),o({kind:`waitForAnimationToEnd`,source:r,timeout:B(i,`timeout`)?Y(V(i,`timeout`),`waitForAnimationToEnd.timeout`,n):void 0})}function on(e,t,n){let r=F(t,n);return W(e)?{kind:`stopApp`,source:r}:{kind:`stopApp`,source:r,appId:K(e,`stopApp`,n)}}function sn(e,t,n){let r=F(t,n),i=L(e,`setPermissions`,n);z(i,`setPermissions`,[`appId`,`permissions`,`optional`,`label`],n),B(i,`permissions`)||I(`Maestro setPermissions requires permissions.`,t,n);let a=H(i,`appId`,e=>q(e,`setPermissions.appId`,n)),s=cn(V(i,`permissions`),n),c=U(i,`setPermissions`,n),l=X(i,`setPermissions`,n);return o({kind:`setPermissions`,source:r,appId:a,permissions:s,...c,label:l})}function cn(e,t,n=`setPermissions`){let r=L(e,`${n}.permissions`,t);r.length===0&&I(`Maestro ${n}.permissions requires at least one permission.`,e,t);let i={};for(let e of r)i[e.key]=ln(e,t,n);return i}function ln(e,t,n=`setPermissions`){let r=`${n}.permissions.${e.key}`,i=G(e.value,r,t);typeof i!=`string`&&I(`Maestro ${r} expects a string.`,e.value,t);let a=i.toLowerCase();if(nt.has(a))return a;if(tt.test(i))return i;i.includes("${")&&I(`Maestro ${r} only supports allow|deny|unset (plus always|inuse|never|limited for location/photos) or a bare \${VAR} lookup; JavaScript expressions are not supported.`,e.value,t),I(`Maestro ${r} expects allow|deny|unset (plus always|inuse|never|limited for location/photos) or a bare \${VAR} lookup.`,e.value,t)}function un(e,t,n){let r=F(t,n);return W(e)?{kind:`clearState`,source:r}:{kind:`clearState`,source:r,appId:K(e,`clearState`,n)}}function dn(e,t,n){return{kind:`evalScript`,source:F(t,n),script:K(e,`evalScript`,n)}}function fn(e,t,n){if((0,P.isSeq)(e))return{kind:`list`,values:R(e,t,n).map((e,r)=>{let i=G(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=G(e,t,n);return r===null&&I(`${t} expects a scalar, list, or map.`,e,n),{kind:`scalar`,value:r}}function pn(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?mn(c,i):{};return{kind:`program`,source:F(c??l,i),config:u,commands:$(l,`commands`,i)}}function mn(e,t){let n=L(e,`flow config`,t);return z(n,`flow config`,[`name`,`appId`,`tags`,`env`,`onFlowStart`,`onFlowComplete`],t),o({name:H(n,`name`,e=>q(e,`name`,t)),appId:H(n,`appId`,e=>q(e,`appId`,t)),tags:H(n,`tags`,e=>et(e,`tags`,t)),env:H(n,`env`,e=>dt(e,`env`,t)),onFlowStart:H(n,`onFlowStart`,e=>$(e,`onFlowStart`,t)),onFlowComplete:H(n,`onFlowComplete`,e=>$(e,`onFlowComplete`,t))})}function hn(e,t){let n=new Map;return async(r,a,o)=>{if(o?.aborted)throw i();let s=gn(r,a,e),c=n.get(s);if(c)return c;let l=pn(t(s),{sourcePath:s});return n.set(s,l),l}}function gn(e,t,n){let r=t?a.dirname(t):n;return a.resolve(r,e)}function _n(e){let t={[e.entryPath]:e.entrySource},n=vn(e.entrySource,e.entryPath);return n&&yn({program:n,sourcePath:e.entryPath,context:l({},{...e.env}),files:t,readSource:e.readSource}),t}function vn(e,t){try{return pn(e,{sourcePath:t})}catch{return}}function yn(e){let t=e.context.enter(e.program.config.env??{});try{bn([...e.program.config.onFlowStart??[],...e.program.commands,...e.program.config.onFlowComplete??[]],e)}finally{t()}}function bn(e,t){for(let n of e){if(n.kind===`repeat`||n.kind===`retry`){bn(n.commands,t);continue}if(n.kind!==`runFlow`)continue;let e=t.context.enter(n.env??{});try{if(n.include.kind===`commands`){bn(n.include.commands,t);continue}xn(n.include.path,t)}finally{e()}}}function xn(e,t){let n=t.context.resolveDeferred(e);if(n.includes("${"))return;let r=gn(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=vn(i,r);a&&yn({...t,program:a,sourcePath:r})}var Sn=t({MAESTRO_COMPATIBILITY_ADR_URL:()=>MAESTRO_COMPATIBILITY_ADR_URL,MAESTRO_COMPATIBILITY_ISSUE_URL:()=>MAESTRO_COMPATIBILITY_ISSUE_URL,collectMaestroFlowSources:()=>_n});export{at as a,l as c,o as d,ft as i,c as l,hn as n,ot as o,pn as r,Ze as s,Sn as t,s as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{d as e,u as t}from"./sdk-device.js";import{i as n,n as r}from"./recording-stop-observation.js";import{t as i}from"./screen-recording-completion.js";import a from"node:path";async function o(e,t){try{return await e()}catch{if(t?.aborted)throw t.reason;return!1}}function s(e){return e.exitCode===0}function c(n){return process.platform===`darwin`&&(e(n)||t(n)&&n.kind===`simulator`||n.platform===`android`&&n.kind===`emulator`)}function l(e){return e.exportPath===void 0?e.observation===void 0||e.observation.recorder===`unconfirmed`:!1}function u(e){return f(e,`native`)}function d(e){return f(e,`collected`)}function f(e,t){let n=a.extname(e);return`${n===``?e:e.slice(0,-n.length)}.${t}${n}`}const p=`stopObservation`,m=`stoppedAtMs`,h=`stopRecorderWarning`,g=`collectedPath`,_=`exportPath`,v=`stopFinalization`,y=Symbol(`unreadable`),b={telemetryPath:D(),warning:D(),overlayWarning:D(),nativePathDisposition:{encode:e=>e,read:e=>e===void 0?void 0:n(e)?e:y},chunks:{encode:e=>e.map(O),read:e=>e===void 0?void 0:k(e)??y},capturedDurationMs:{encode:e=>e,read:e=>e===void 0?void 0:j(e)?e:y}};function x(e){return{...e.observation===void 0?{}:{[p]:C(e.observation)},...e.stoppedAtMs===void 0?{}:{[m]:e.stoppedAtMs},...e.recorderWarning===void 0?{}:{[h]:e.recorderWarning},...e.collectedPath===void 0?{}:{[g]:e.collectedPath},...e.exportPath===void 0?{}:{[_]:e.exportPath},...e.finalization===void 0?{}:{[v]:w(e.finalization)}}}function S(e){let t=e?.[p],n=e?.[m],i=M(e?.[h]),a=M(e?.[g]),o=M(e?.[_]),s=T(e?.[v]);return{...r(t)?{observation:t}:{},...j(n)?{stoppedAtMs:n}:{},...i===void 0?{}:{recorderWarning:i},...a===void 0?{}:{collectedPath:a},...o===void 0?{}:{exportPath:o},...s===void 0?{}:{finalization:s}}}function C(e){return e.recorder===`confirmed`?{recorder:e.recorder}:{recorder:e.recorder,why:e.why}}function w(e){let t={};for(let n of E()){let r=e[n];r!==void 0&&(t[n]=b[n].encode(r))}return t}function T(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e,n={};for(let e of E()){let r=b[e].read(t[e]);if(r===y)return;r!==void 0&&(n[e]=r)}return Object.keys(n).length===0?void 0:n}function E(){return Object.keys(b)}function D(){return{encode:e=>e,read:M}}function O(e){return{index:e.index,path:e.path,...e.clientOutPath===void 0?{}:{clientOutPath:e.clientOutPath}}}function k(e){if(!Array.isArray(e))return;let t=e.map(A);return t.every(e=>e!==void 0)?t:void 0}function A(e){if(typeof e!=`object`||!e)return;let{index:t,path:n,clientOutPath:r}=e,i=M(n),a=M(r);if(!(!Number.isInteger(t)||t<1||i===void 0)&&(r===void 0||a!==void 0))return{index:t,path:i,...a===void 0?{}:{clientOutPath:a}}}function j(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0}function M(e){return typeof e==`string`&&e.length>0?e:void 0}async function N(e){let{steps:t,snapshot:n,progress:r,now:a=Date.now}=e,o=S(r?.learned),s=o.observation,c=o.recorderWarning,u=o.stoppedAtMs;if(l(o)){u=a();let e=await t.stop();s=e.observation,c=e.warning,r?.record(x({observation:s,stoppedAtMs:u,recorderWarning:e.warning}))}if(s===void 0)throw Error(`record stop reached collection without an observation of its recorder and a committed export`);let f=o.collectedPath??d(n.outPath);o.collectedPath===void 0&&(await t.collect(f),r?.record(x({collectedPath:f})));let p=o.finalization??await t.finalize({collectedPath:f,exportPath:n.outPath,stoppedAtMs:u??a()});r?.record(x({exportPath:n.outPath,finalization:p})),await t.discard(f);let{nativePathDisposition:m,warning:h,...g}=p,_=[h,c].filter(e=>e!==void 0&&e.length>0);return i(n,{...g,..._.length===0?{}:{warning:_.join(` `)}},{stopObservation:s,...m===void 0?{}:{nativePathDisposition:m}})}export{o as a,s as i,u as n,c as r,N as t};
|
package/dist/src/string-enum.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{D 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{D 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(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{D as e}from"./sdk-contracts.js";import{Br as t,Vr as n,Wr as r}from"./sdk-batch.js";import{n as i,r as a}from"./snapshot.js";function o(t,n,r,i){return new e(`COMMAND_FAILED`,`fill tapped (${t}, ${n}) but ${r}`,{reason:`text_entry_focus_not_observed`,x:t,y:n,...i,hint:`The tap most likely missed the field. Re-check the target with snapshot -i and fill the element it reports, rather than retrying the same coordinates.`})}function s(e){let t=[];for(let r of p(e)){let e=a(r);n(e)&&t.push({node:r,identity:m(r),rect:e})}return t}function c(e){let t=new Map;for(let n of e)t.set(n.identity,(t.get(n.identity)??0)+1);return t}function l(e){let t=s(e),n=c(t),i=null,a=1/0;for(let e of t){if(!e.node.traits?.includes(`IsEditing`))continue;let t=r(e.rect);t>=a||(i=n.get(e.identity)===1?{identity:e.identity,rect:e.rect}:{rect:e.rect},a=t)}return i}function u(e,n,r){let i=s(e),a=c(i),o=new Set;for(let e of i)a.get(e.identity)===1&&t(e.rect,n,r)&&o.add(e.identity);return o}async function d(e){let t=Date.now()+(e.timeoutMs??3e3),n=0,r=!1;for(;;){let i=await e.readFocus();if(n+=1,i&&(r=!0,f(i,e.targetsAtPoint,e.x,e.y)))return`focused-element`;if(Date.now()>=t)break;await e.sleep(150)}throw o(e.x,e.y,`nothing there took text-entry focus, so the text was not sent`,{samples:n,editingElementObserved:r})}function f(e,n,r,i){return t(e.rect,r,i)?!0:e.identity!==void 0&&n.has(e.identity)}function p(e){let t=[],n=e=>{t.push(e);for(let t of i(e))n(t)};for(let t of Array.isArray(e)?e:[e])n(t);return t}function m(e){return[e.pid??``,e.type??e.elementType??``,e.AXUniqueId??e.identifier??``,e.AXLabel??e.label??``].join(`\0`)}export{d as awaitLimrunTextEntryFocus,l as readLimrunTextEntryFocus,u as readLimrunUnambiguousTapTargets};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{D as e}from"./sdk-contracts.js";import{a as t,c as n,h as r,t as i}from"./exec.js";import"./command.js";import{t as a}from"./scoped-provider.js";import{f as o,u as s}from"./host-file.js";import c from"node:path";function l(e,t){return t===`user-installed`?e.filter(e=>!e.bundleId.startsWith(`com.apple.`)):e}function u(n,r){return{openBundle:async(e,t)=>{await n(`open`,d(e,t))},openTarget:async e=>{await n(`open`,[e])},readClipboard:async()=>t(await n(`pbpaste`,[],{allowFailure:!0}),`Failed to read macOS clipboard`).stdout.replaceAll(`\r
|
|
2
2
|
`,`
|
|
3
3
|
`).replace(/\n$/,``),writeClipboard:async e=>{t(await n(`pbcopy`,[],{allowFailure:!0,stdin:e}),`Failed to write macOS clipboard`)},readDarkMode:async()=>{let r=t(await n(`osascript`,[`-e`,`tell application "System Events" to tell appearance preferences to get dark mode`],{allowFailure:!0}),`Failed to read macOS appearance`),i=r.stdout.trim().toLowerCase();if(i===`true`)return!0;if(i===`false`)return!1;throw new e(`COMMAND_FAILED`,`Unable to determine current macOS appearance from osascript output: ${r.stdout.trim()}`)},setDarkMode:async e=>{t(await n(`osascript`,[`-e`,`tell application "System Events" to tell appearance preferences to set dark mode to ${e?`true`:`false`}`],{allowFailure:!0}),`Failed to set macOS appearance`)},listApps:async e=>await f(n,r,e)}}function d(e,t){let n=[`-b`,e];return t&&n.push(t),n}async function f(e,t,n){let r=[`/Applications`,`/System/Applications`,c.join(o(),`Applications`)],i=new Set;for(let t of r){if(!(await s(t).catch(()=>null))?.isDirectory())continue;let n=await e(`find`,[t,`-maxdepth`,`4`,`-type`,`d`,`-name`,`*.app`],{allowFailure:!0});if(n.exitCode===0)for(let e of n.stdout.split(`
|
|
4
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{D as t}from"./sdk-contracts.js";import{r as n}from"./diagnostics.js";import{c as r}from"./owner-identity.js";import{c as i,h as a}from"./exec.js";import{t as o}from"./timeouts.js";import"./diagnostics2.js";import"./command.js";import"./retry.js";import"./process.js";import{t as s}from"./scoped-provider.js";var c=e({createLocalLinuxToolProvider:()=>d,resolveLinuxToolProvider:()=>f,runLinuxToolCommand:()=>m,withLinuxToolProvider:()=>p});const l={runCommand:i,whichCommand:a,desktop:h(i,a),clipboard:g(i,a),screenshot:_(i,a)},u=s(l,d);function d(e={}){let t={...l,...e};return{...t,desktop:e.desktop??h(t.runCommand,t.whichCommand),clipboard:e.clipboard??g(t.runCommand,t.whichCommand),screenshot:e.screenshot??_(t.runCommand,t.whichCommand)}}function f(e){return u.resolve(e)}async function p(e,t){return await u.run(e,t)}async function m(e,t,n){return await f().runCommand(e,t,n)}function h(e,t){return{async openTarget(r){if(r.includes(`://`)||r.startsWith(`/`)){await e(`xdg-open`,[r]);return}if(await t(r)){e(r,[],{allowFailure:!0}).catch(e=>{n({level:`warn`,phase:`linux_app_launch`,data:{app:r,error:String(e)}})}),await o(500);return}await e(`xdg-open`,[r],{allowFailure:!0})},async closeApp(n){if(await t(`wmctrl`)){await e(`wmctrl`,[`-c`,n],{allowFailure:!0});return}await e(`pkill`,[`-x`,n],{allowFailure:!0})}}}function g(e,t){return{async readText(){let n=await w(t,y),r=x[n];return(await e(r.cmd,r.args,r.options)).stdout},async writeText(n){let r=await w(t,y),i=S[r](n);await e(i.cmd,i.args,i.options)}}}function _(e,t){return{async capture(n){let r=await w(t,b),i=C[r](n);await e(i.cmd,i.args,i.options)}}}const v=5e3,y={wayland:[{tool:`wl-clipboard`,command:`wl-paste`}],x11:[{tool:`xclip`,command:`xclip`},{tool:`xsel`,command:`xsel`}],waylandError:`wl-paste (wl-clipboard) is required for clipboard access on Wayland. Install via your package manager.`,x11Error:`xclip or xsel is required for clipboard access on X11. Install via your package manager.`},b={wayland:[{tool:`grim`,command:`grim`},{tool:`gnome-screenshot`,command:`gnome-screenshot`}],x11:[{tool:`scrot`,command:`scrot`},{tool:`import`,command:`import`},{tool:`gnome-screenshot`,command:`gnome-screenshot`}],waylandError:`grim or gnome-screenshot is required for screenshots on Wayland. Install via your package manager.`,x11Error:`scrot, import (ImageMagick), or gnome-screenshot is required for screenshots on X11. Install via your package manager.`},x={"wl-clipboard":{cmd:`wl-paste`,args:[`--no-newline`],options:{allowFailure:!0,timeoutMs:v}},xclip:{cmd:`xclip`,args:[`-selection`,`clipboard`,`-o`],options:{allowFailure:!0,timeoutMs:v}},xsel:{cmd:`xsel`,args:[`--clipboard`,`--output`],options:{allowFailure:!0,timeoutMs:v}}},S={"wl-clipboard":e=>({cmd:`wl-copy`,args:[`--`,e],options:{allowFailure:!1,timeoutMs:v}}),xclip:e=>({cmd:`xclip`,args:[`-selection`,`clipboard`],options:{allowFailure:!1,timeoutMs:v,stdin:e}}),xsel:e=>({cmd:`xsel`,args:[`--clipboard`,`--input`],options:{allowFailure:!1,timeoutMs:v,stdin:e}})},C={grim:e=>({cmd:`grim`,args:[e]}),scrot:e=>({cmd:`scrot`,args:[e]}),import:e=>({cmd:`import`,args:[`-window`,`root`,e]}),"gnome-screenshot":e=>({cmd:`gnome-screenshot`,args:[`-f`,e]})};async function w(e,n){let r=T()?`wayland`:`x11`;for(let t of n[r])if(await e(t.command))return t.tool;throw new t(`TOOL_MISSING`,r===`wayland`?n.waylandError:n.x11Error)}function T(){let e=r();return!!e.WAYLAND_DISPLAY||e.XDG_SESSION_TYPE===`wayland`}export{m as n,c as r,f as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{D as e}from"./sdk-contracts.js";import{n as t,r as n}from"./interactor-operation-binding.js";function r(e){let t=t=>t??e.unsupported;return Object.freeze({tapPoint:e.tap,tapRef:t(e.tapRef),longPressPoint:e.longPress,hoverPoint:i(t(e.hover)),hoverRef:i(t(e.hoverRef)),fillPoint:e.fill,fillRef:t(e.fillRef),tapElementSelector:t(e.tapElementSelector)})}function i(e){return e.available?e:Object.freeze({...e,hint:e.hint??`hover raises pointer hover state and is available on web targets only. On touch platforms use longpress for hold gestures.`})}function a(e,t){return{...e.execution,appBundleId:e.appBundleId,signal:t}}function o(t,n,r,i){let o=async e=>(t.throwIfAborted(),await n(a(e,t))),l=async e=>{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{r as i,f as n,u as r,d as t};
|
package/dist/src/transport.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{D 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{Pr 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,_(v(e,t),n))}function g(e,t,n){let r=v(e,t);e.set(t.index,_(r,n(r)))}function _(e,t){let n={...e,...t};for(let[e,r]of Object.entries(t))r===void 0&&delete n[e];return n}function v(e,t){return e.get(t.index)??t}function y(t){let n;for(let r of t){let t=e(r.type??``);(t===`application`||t===`window`)&&x(r.rect,n)&&(n=r.rect)}return n}function b(e,t,n=.8){let r=S(e),i=S(t);return r>0&&i>0&&r/i>=n}function x(e,t){return!!(e&&(!t||S(e)>S(t)))}function S(e){return e?e.width*e.height:0}function C(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=w(e.parentIndex,t,r,i)),{...e,index:n,parentIndex:a}})}function w(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,y as i,b as l,C 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{D 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{D as e}from"./sdk-contracts.js";import{Wt as t}from"./sdk-batch.js";import{g as n,m as r}from"./session-snapshot.js";import{x as i}from"./runtime.js";import{r as a}from"./success-text.js";function o(e){let t=e?.trim().split(/\s+/,1)[0];if(!t||!t.startsWith(`@`)||t.length<3)return null;let n=t.slice(1);return/^[A-Za-z_-]*\d[\w-]*$/i.test(n)||/^(?:ref|node|element|el)[\w-]*$/i.test(n)?t:null}async function s(e){let r=await n({command:`type`,device:e.device,use:t,inspectFacts:e.inspectFacts,bindDevice:e.bindDevice});if(r.type===`response`)return{ok:!1,response:r.response};let i=r.runtime;return{ok:!0,typeText:async(e,t)=>await c(i,e,t)}}async function c(t,n,r){let s=o(n[0]);if(s)throw new e(`INVALID_ARGS`,`type does not accept a target ref like "${s}"`,{hint:`Use fill ${s} "text" to target that field, or press ${s} then type "text" to append.`});let c=n.join(` `);if(!c)throw new e(`INVALID_ARGS`,`type requires text`);let u=i(r.delayMs??0,`delay-ms`,0,1e4),d=(await t.operations.typeText(l(c,u,r)))?.textEntryRoute;return{...d===void 0?{}:{textEntryRoute:d},text:c,delayMs:u,...a(`Typed ${Array.from(c).length} chars`)}}function l(e,t,n){return{text:e,delayMs:t,...n.appBundleId===void 0?{}:{options:{appBundleId:n.appBundleId}},execution:r(n)}}export{s as n,c as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{D 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/video.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{D as e}from"./sdk-contracts.js";import{ir as t}from"./sdk-batch.js";import{x as n}from"./owner-identity.js";import{c as r}from"./exec.js";import{t as i}from"./timeouts.js";import{n as a,t as o}from"./file.js";import"./command.js";import"./retry.js";import"./process.js";import s from"node:path";import c from"node:fs";import{createHash as l}from"node:crypto";import u from"node:os";function d(e=process.env){let t=m(),n=s.join(t,`home`),r=s.join(t,`module-cache`);return c.mkdirSync(n,{recursive:!0}),c.mkdirSync(r,{recursive:!0}),{...e,HOME:n,CLANG_MODULE_CACHE_PATH:r}}async function f(e){let t=[e.sourcePath,...e.extraSourcePaths??[]],n=t.map(e=>({sourcePath:e,stat:c.statSync(e),source:c.readFileSync(e)})),r=v(e.cacheName??s.basename(e.sourcePath,s.extname(e.sourcePath))),i=y([`2`,process.platform,process.arch,...n.flatMap(({sourcePath:e,stat:t,source:n})=>[s.resolve(e),t.size,n])]),a=s.join(m(),`bin`,`${r}-${i}`);return await h({sourcePaths:t,executablePath:a,timeoutMs:e.timeoutMs}),a}async function p(e){let t=v(e.cacheName),n=y([`2`,process.platform,process.arch,e.source]),r=s.join(m(),`sources`,`${t}-${n}.swift`),i=s.join(m(),`bin`,`${t}-${n}`);return await h({sourcePaths:[r],executablePath:i,sourceText:e.source,timeoutMs:e.timeoutMs}),i}function m(){let e=process.env.AGENT_DEVICE_SWIFT_CACHE_DIR?.trim();return e?s.resolve(e):s.join(u.tmpdir(),`agent-device-swift-cache`)}async function h(e){if(_(e.executablePath))return;let t=s.dirname(e.executablePath);c.mkdirSync(t,{recursive:!0});let n=e.timeoutMs??12e4;await a({acquire:()=>g(`${e.executablePath}.lock`,n),task:async()=>{if(_(e.executablePath))return;let i=c.mkdtempSync(s.join(t,`.${s.basename(e.executablePath)}.${process.pid}.`)),a=s.join(i,s.basename(e.executablePath));try{let[t]=e.sourcePaths;e.sourceText!==void 0&&t&&!c.existsSync(t)&&(c.mkdirSync(s.dirname(t),{recursive:!0}),c.writeFileSync(t,e.sourceText)),await r(`xcrun`,[`swiftc`,...e.sourcePaths,`-o`,a],{timeoutMs:n,env:d()}),c.renameSync(a,e.executablePath)}finally{c.rmSync(i,{recursive:!0,force:!0})}}})}async function g(t,r){try{return await o({lockDirPath:t,owner:{pid:process.pid,startTime:n(process.pid),acquiredAtMs:Date.now()},timeoutMs:r,pollMs:25,ownerGraceMs:r,description:`Swift cache lock: ${t} (${r}ms)`})}catch(n){throw n instanceof e&&n.message.startsWith(`Timed out waiting for Swift cache lock:`)?new e(`COMMAND_FAILED`,n.message,{...n.details,lockDir:t,timeoutMs:r,hint:`Another agent-device process may still be compiling this Swift helper. Retry shortly; if no agent-device process is active, remove "${t}" and retry.`}):n}}function _(e){try{return c.accessSync(e,c.constants.X_OK),c.statSync(e).isFile()}catch{return!1}}function v(e){return t(e.replaceAll(/[^A-Za-z0-9._-]/g,`-`))||`swift-helper`}function y(e){let t=l(`sha256`);for(let n of e)t.update(Buffer.isBuffer(n)?n:String(n)),t.update(`\0`);return t.digest(`hex`).slice(0,16)}const b={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 x(e){let t=S(e);if(!t)return!1;let{bytes:n,fileSize:r}=t,i=N(n,0,n.length,r);if(!i||i.id!==b.ebml||!i.complete||i.unknownSize||!C(n,i))return!1;let a=N(n,i.nextOffset,n.length,r);return!a||a.id!==b.segment||!L(a,r)?!1:w(n,a,r)}function S(e){try{let t=c.openSync(e,`r`);try{let e=c.fstatSync(t).size;if(e<=0)return;let n=Buffer.alloc(Math.min(e,1048576));return c.readSync(t,n,0,n.length,0)===n.length?{bytes:n,fileSize:e}:void 0}finally{c.closeSync(t)}}catch{return}}function C(e,t){let n=M(e,t)?.find(e=>e.id===b.documentType);return n!==void 0&&e.toString(`ascii`,n.dataStart,n.dataEnd)===`webm`}function w(e,t,n){let r=new Set,i=new Set;for(let a=t.dataStart;a<t.dataEnd;){let o=N(e,a,t.dataEnd,n);if(!o||!L(o,n))return!1;if(o.id===b.tracks&&T(e,o,r),o.id===b.cluster&&D(e,o,n,i),R(r,i))return!0;if(!o.complete||o.unknownSize)return!1;a=o.nextOffset}return!1}function T(e,t,n){let r=M(e,t);if(r){for(let t of r)if(t.id===b.trackEntry){let r=E(e,t);r!==void 0&&n.add(r)}}}function E(e,t){let n=M(e,t),r=j(e,n,b.trackNumber),i=j(e,n,b.trackType),a=n?.find(e=>e.id===b.codecId),o=a?e.toString(`ascii`,a.dataStart,a.dataEnd):void 0;return i===1&&o?.startsWith(`V_`)?r:void 0}function D(e,t,n,r){for(let i=t.dataStart;i<t.dataEnd;){let a=N(e,i,t.dataEnd,n);if(!a||!L(a,n)||(a.id===b.simpleBlock&&k(e,a,r),a.id===b.blockGroup&&O(e,a,r),!a.complete||a.unknownSize))return;i=a.nextOffset}}function O(e,t,n){let r=M(e,t)?.find(e=>e.id===b.block);r&&k(e,r,n)}function k(e,t,n){if(!t.complete||t.unknownSize)return;let r=F(e,t.dataStart);!r||r.unknown||t.dataEnd-t.dataStart<r.length+4||n.add(r.value)}function A(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 j(e,t,n){let r=t?.find(e=>e.id===n);return r?A(e,r):void 0}function M(e,t){if(!t.complete||t.unknownSize)return;let n=[];for(let r=t.dataStart;r<t.dataEnd;){let i=N(e,r,t.dataEnd,e.length);if(!i||!i.complete||i.unknownSize)return;n.push(i),r=i.nextOffset}return n}function N(e,t,n,r){let i=P(e,t);if(!i)return;let a=F(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 P(e,t){let n=I(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 F(e,t){let n=I(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 I(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 L(e,t){return e.unknownSize||e.nextOffset<=t}function R(e,t){for(let n of e)if(t.has(n))return!0;return!1}let z;async function B(e,t={}){let n=t.pollMs??150,r=t.attempts??12,a,o=0;for(let t=0;t<r;t+=1){let t=0;try{t=c.statSync(e).size}catch{t=0}if(t>0&&t===a){if(o+=1,o>=2)return}else o=0;a=t,await i(n)}}async function V(e){let t=await q(e);if(!t)return!1;if(t===`webm`)return!0;try{let t=await H(),n=await r(t,[e],{allowFailure:!0,timeoutMs:1e4,env:d()});return n.exitCode===0||G(n.stderr,n.stdout)}catch(e){if(U(e))return!0;throw e}}async function H(){z??=p({source:`import Foundation
|
|
2
2
|
import AVFoundation
|
|
3
3
|
|
|
4
4
|
let url = URL(fileURLWithPath: CommandLine.arguments[1])
|
package/dist/src/viewport.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{D 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{D 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{D 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{r as e}from"./rolldown-runtime.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime.js";import{D as t}from"./sdk-contracts.js";import{t as n}from"./bounds.js";import{t as r}from"./parser.js";var i=e({parseWebDriverSourceFacts:()=>p});function a(e){try{return r(e)}catch(e){throw new t(`COMMAND_FAILED`,`Failed to parse WebDriver page source XML: ${e instanceof Error?e.message:String(e)}`,void 0,e)}}function o(e){let t=n(e.bounds??null);if(t)return t;let r=d(e.x),i=d(e.y),a=d(e.width),o=d(e.height);if(r!==void 0&&i!==void 0&&a!==void 0&&o!==void 0)return{x:r,y:i,width:a,height:o}}function s(e,t){for(let n of t){let t=c(e[n]);if(t!==void 0)return t}}function c(e){return e||void 0}function l(e,t){return e===void 0?t:e===`true`||e===`1`?!0:e===`false`||e===`0`?!1:t===void 0&&void 0}function u(e){return!!(e&&e.width>0&&e.height>0)}function d(e){if(e===void 0||e===``)return;let t=Number(e);return Number.isFinite(t)?t:void 0}function f(e,t){return c(t.class)??c(e.replace(/^XCUIElementType/,``).toLowerCase())}function p(e,t=`ios`){let n=a(e),r=[],i=[];for(let e of n)m(r,e,void 0,0,i,t);return{nodes:r,roots:i}}function m(e,t,n,r,i,a){let o=h(t,a)?n:g(e,t,n,r,i,a),s=o===n?r:r+1;for(let n of t.children)m(e,n,o,s,i,a)}function h(e,t){if(Object.keys(e.attributes).length===0)return!0;let n=e.name.toLowerCase();return t===`ios`&&(n===`hierarchy`||n===`appiumaut`)}function g(e,t,n,r,i,a){let s=e.length,c=o(t.attributes);return e.push(_(s,t.name,t.attributes,n,r,c,a)),n===void 0&&i.push({type:t.name,...c?{rect:c}:{},rectStatus:x(t.attributes,c)}),s}function _(e,t,n,r,i,a,o){return{index:e,type:t,role:f(t,n),label:s(n,[`content-desc`,`label`,`text`,`name`]),value:c(n.value),identifier:s(n,[`resource-id`,`id`,`accessibility-id`,`name`]),rect:a,...v(n,a,o),depth:i,parentIndex:r}}function v(e,t,n){let r=n===`android`||void 0,i=l(e.enabled,r),a=l(e.displayed??e.visible,r);return n===`android`?{enabled:i,selected:l(e.selected,!1),focused:l(e.focused,!1),visibleToUser:a,hittable:a===!0&&i===!0&&u(t)}:{...y(`enabled`,i),...y(`selected`,l(e.selected)),...y(`focused`,l(e.focused)),...y(`visibleToUser`,a),...b(e.hittable)}}function y(e,t){return t===void 0?{}:{[e]:t}}function b(e){let t=l(e);return t===void 0?{}:{hittable:t}}function x(e,t){let n=e.bounds!==void 0,r=[`x`,`y`,`width`,`height`].every(t=>e[t]!==void 0);return!n&&!r?`not-provided`:u(t)?`reported`:`invalid`}export{i as n,p as t};
|
package/dist/src/window-state.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{o as e}from"./adb.js";import{n as t,o as n,t as r}from"./app-parsers.js";const i=[[`dumpsys`,`window`,`windows`],[`dumpsys`,`window`]],a={foreground:{tiers:[i,[[`dumpsys`,`activity`,`activities`],[`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.8",
|
|
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",
|
|
@@ -107,6 +107,8 @@
|
|
|
107
107
|
"package:android-ime-helper:npm": "rm -rf android/ime-helper/dist && AGENT_DEVICE_ANDROID_HELPER=ime sh ./scripts/package-android-helper.sh $(node -p \"require('./package.json').version\") android/ime-helper/dist",
|
|
108
108
|
"build:macos-helper": "node --experimental-strip-types scripts/swift-toolchain-tmpdir.ts swift build -c release --package-path apple/macos-helper",
|
|
109
109
|
"build:macos-helper:clean": "node --experimental-strip-types scripts/swift-toolchain-tmpdir.ts swift package --package-path apple/macos-helper clean && pnpm build:macos-helper",
|
|
110
|
+
"test:macos-helper": "node --experimental-strip-types scripts/swift-toolchain-tmpdir.ts swift test --package-path apple/macos-helper",
|
|
111
|
+
"check:macos-helper": "pnpm build:macos-helper && pnpm test:macos-helper",
|
|
110
112
|
"prepare:publish-assets": "node scripts/prepare-publish-assets.mjs",
|
|
111
113
|
"build:package": "pnpm build && pnpm build:xcuitest:ios && pnpm build:xcuitest:macos && pnpm build:xcuitest:tvos && pnpm build:xcuitest:visionos && pnpm build:macos-helper:clean && pnpm prepare:publish-assets",
|
|
112
114
|
"package:npm": "pnpm build:package && pnpm check:package",
|
|
@@ -318,6 +320,7 @@
|
|
|
318
320
|
"fallow": "^2.104.0",
|
|
319
321
|
"fast-check": "^4.9.0",
|
|
320
322
|
"ipaddr.js": "^2.5.0",
|
|
323
|
+
"jpeg-js": "^0.4.4",
|
|
321
324
|
"oxc-parser": "^0.146.0",
|
|
322
325
|
"oxfmt": "^0.64.0",
|
|
323
326
|
"oxlint": "^1.79.0",
|
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.8",
|
|
11
11
|
"packages": [
|
|
12
12
|
{
|
|
13
13
|
"registryType": "npm",
|
|
14
14
|
"identifier": "agent-device",
|
|
15
|
-
"version": "0.21.
|
|
15
|
+
"version": "0.21.8",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|
|
18
18
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
c705e3732af1307e0bf9f9ec058c898839ff695ffa9f3b9fcffe08ba63458487 agent-device-android-ime-helper-0.21.6.apk
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a4c52106edd24230c2d7a89e955bd43be8115d39b5d0994f674cb4e93fe049e6 agent-device-android-snapshot-helper-0.21.6.apk
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e}from"./sdk-contracts.js";import{Gn as t,Hn as n,Ln as r,Qn as i,Un as a,er as o,qn as s}from"./sdk-batch.js";import{E as c,F as l,N as u,P as d}from"./runtime.js";import{i as f}from"./rect-center.js";import{o as p}from"./tree.js";function m(e){return e.matchedRefs.length===0?{path:2,outcome:`unverifiable`,reason:`selector-miss`}:e.identitySetRefs.length===0?{path:3,outcome:`unverifiable`,reason:`identity-set-empty`}:e.identitySetRefs.length===1?e.identitySetRefs[0]===e.winnerRef?{path:4,outcome:`verified`}:{path:5,outcome:`unverifiable`,reason:`unique-but-wrong`}:e.siblingMatchRefs.length===1?e.siblingMatchRefs[0]===e.winnerRef?{path:6,outcome:`verified`}:{path:6,outcome:`unverifiable`,reason:`signal-isolated-wrong`}:e.regionMemberRefs!==void 0&&e.regionMemberRefs.length>0&&e.viewportCandidateRef!==void 0?e.viewportCandidateRef===e.winnerRef?{path:6,outcome:`verified`}:{path:6,outcome:`unverifiable`,reason:`signal-isolated-wrong`}:{path:6,outcome:`unverifiable`,reason:`no-signal-isolation`}}function h(t,n={}){let r=n.plural===!0?`do`:`does`;return{resolveInput:async()=>{throw new e(`UNSUPPORTED_OPERATION`,`${t} ${r} not resolve input artifacts`)},reserveOutput:async()=>{throw new e(`UNSUPPORTED_OPERATION`,`${t} ${r} not reserve output artifacts`)},createTempFile:async()=>{throw new e(`UNSUPPORTED_OPERATION`,`${t} ${r} not create temporary files`)}}}function g(e,t={}){return{artifacts:h(e,t),policy:c()}}function _(e,t={}){let n=t.mode??`action`,{node:i,preActionNodes:a}=e;if(typeof i.index!=`number`)return;let o=d(a),s=r(x(i),a);if(n===`landmark`&&s.id===void 0&&s.label===void 0)return;let c=u(i,o,8),l=c.chain,f=S(a,i),p=C(i,o),m=T(i),h=+(l.length>0),g=e=>{let t=l.slice(0,e),n=E({nodes:a,byIndex:o,node:i,identity:s,ancestry:t,sibling:f,scrollRegion:p});return{candidate:{...s,ancestry:t,sibling:f,viewportOrder:n.viewportOrder,...p?{scrollRegion:p}:{},...m?{rect:m}:{},verification:`verified`},domain:n}};for(let e=l.length;e>=h;--e){let{candidate:t,domain:r}=g(e);if(y(t))return t.verification=v({node:i,domain:r,mode:n,brokenWalk:c.broken}),t;if(e===h)return b(t)}}function v(e){return e.brokenWalk?`unverifiable`:e.mode===`landmark`?`verified`:O({node:e.node,domain:e.domain})}function y(e){return o(i({...e,verification:`unverifiable`}))<=s}function b(e){return e.verification=`unverifiable`,o(i(e))>4096&&delete e.rect,e}const x=a;function S(e,n){return t(e,n)}function C(e,t){let n=p(e,t);if(!n)return;let r=x(n);return{role:r.role,...r.id===void 0?r.label===void 0?{}:{label:r.label}:{id:r.id}}}function w(e,t){return!e&&!t?!0:!e||!t?!1:n(e,t)}function T(e){let t=e.rect;if(t)return{x:t.x,y:t.y,width:t.width,height:t.height}}function E(e){let{nodes:t,byIndex:n,node:r,identity:i,ancestry:a,sibling:o,scrollRegion:s}=e,c=l(t,n,i,a),u=c.filter(e=>S(t,e)===o),d=c.length>0?c.filter(e=>w(C(e,n),s)):void 0,f=d?D(d):[];return{identitySet:c,siblingMatches:u,regionMembers:d,orderedRegion:f,viewportOrder:Math.max(f.findIndex(e=>e.index===r.index),0)}}function D(e){return e.map((e,t)=>({node:e,documentOrder:t,center:f(e.rect)})).sort((e,t)=>!e.center&&!t.center?e.documentOrder-t.documentOrder:e.center?t.center?e.center.y===t.center.y?e.center.x===t.center.x?e.documentOrder-t.documentOrder:e.center.x-t.center.x:e.center.y-t.center.y:-1:1).map(e=>e.node)}function O(e){let{node:t,domain:n}=e,r=t.ref,i=n.identitySet.map(e=>e.ref);return m({winnerRef:r,matchedRefs:i,identitySetRefs:i,siblingMatchRefs:n.siblingMatches.map(e=>e.ref),regionMemberRefs:n.regionMembers?.map(e=>e.ref),viewportCandidateRef:n.orderedRegion[n.viewportOrder]?.ref}).outcome}export{D as a,m as c,_ as i,C as n,w as o,S as r,g as s,x as t};
|
package/dist/src/vars.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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};
|