agent-device 0.21.12 → 0.21.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.12.apk → agent-device-android-ime-helper-0.21.14.apk} +0 -0
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.14.apk.sha256 +1 -0
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.12.manifest.json → agent-device-android-ime-helper-0.21.14.manifest.json} +4 -4
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.14.apk +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.14.apk.sha256 +1 -0
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.12.manifest.json → agent-device-android-snapshot-helper-0.21.14.manifest.json} +6 -6
- package/apple/macos-helper/Package.swift +4 -0
- package/apple/macos-helper/Sources/AgentDeviceMacOSHelper/main.swift +3 -6
- package/apple/macos-helper/Tests/AgentDeviceMacOSHelperTests/ScreenshotResponseTests.swift +15 -0
- package/apple/snapshot-bridge/SnapshotBridgeRuntime.m +47 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m +122 -42
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner/Info.plist +23 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.pbxproj +17 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAppScreenCapture.swift +21 -13
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerScrollViewportPolicy.swift +1 -162
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.h +0 -9
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.m +0 -56
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSystemSurfaceHostPolicy.swift +0 -48
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTapPointPolicy.swift +0 -50
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +33 -586
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +40 -24
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AlertObservation.swift +2 -3
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+BlockingSystemModalResolution.swift +0 -36
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandDispatch.swift +630 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +34 -2256
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +1 -338
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Environment.swift +0 -12
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+GestureExecution.swift +160 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +0 -24
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Keyboard.swift +0 -142
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +90 -39
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+MainThreadWork.swift +78 -106
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +23 -2
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +162 -113
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+PrivateAXPresentation.swift +0 -209
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift +86 -10
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollDragExecution.swift +271 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +1 -200
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SequenceExecution.swift +20 -227
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +78 -295
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotAcquisition.swift +40 -27
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotBackendCapabilities.swift +0 -78
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +85 -581
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCaptureTarget.swift +106 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotExecution.swift +142 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotTiming.swift +49 -78
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedCommitDeadline.swift +0 -44
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedGesturePolicy.swift +73 -114
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedInteraction.swift +1 -12
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedTextEntry.swift +11 -94
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +2 -10
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +1 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryFocus.swift +0 -35
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextInputCandidatePolicy.swift +0 -31
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextTyping.swift +2 -18
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Transport.swift +34 -52
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TvRemote.swift +0 -22
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TypeExecution.swift +135 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +22 -6
- package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/recording-overlay.swift +140 -20
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotCoordinateSpace.swift +16 -19
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotGeometry.swift +21 -9
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotModels.swift +59 -10
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentationInvariant.swift +12 -10
- package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotVisibilityFold.swift +13 -8
- package/dist/src/absence-observation-errors.js +1 -1
- package/dist/src/adapter.js +1 -1
- package/dist/src/adb-executor.js +1 -1
- package/dist/src/adb-failure.js +1 -1
- package/dist/src/adb-transport.js +1 -1
- package/dist/src/agent-browser-provider.js +1 -1
- package/dist/src/agent-browser-tool.js +1 -1
- package/dist/src/agent-device-client.js +2 -2
- package/dist/src/ai-sdk.js +1 -1
- package/dist/src/alert-runtime.js +1 -1
- package/dist/src/android-adb.d.ts +1 -1
- package/dist/src/app-catalog.js +1 -1
- package/dist/src/app-deployment-resolution.js +1 -1
- package/dist/src/app-inventory.js +1 -1
- package/dist/src/app-launch.js +2 -2
- package/dist/src/app-lifecycle.js +1 -1
- package/dist/src/app-lifecycle2.js +1 -1
- package/dist/src/app-log-files.js +1 -1
- package/dist/src/app-log-runtime2.js +3 -3
- package/dist/src/app-resolution.js +2 -2
- package/dist/src/apple-runner-platform.js +1 -1
- package/dist/src/application-lifecycle-interaction.js +1 -1
- package/dist/src/archive.js +1 -1
- package/dist/src/artifact-download.js +1 -1
- package/dist/src/auth-session.js +1 -1
- package/dist/src/auth.js +1 -1
- package/dist/src/back-mode.js +1 -1
- package/dist/src/backend-snapshot-options.js +1 -1
- package/dist/src/boot-diagnostics.js +1 -1
- package/dist/src/capture-disclosure.js +1 -1
- package/dist/src/capture.js +1 -1
- package/dist/src/cli-config.js +1 -1
- package/dist/src/cli-help.js +8 -7
- package/dist/src/cli-runner.js +1 -1
- package/dist/src/cli.js +4 -4
- package/dist/src/click-button.js +1 -1
- package/dist/src/client-metro.js +1 -1
- package/dist/src/client-types.d.ts +4 -5
- package/dist/src/clipboard-shell-response.js +1 -1
- package/dist/src/code-signature.js +1 -1
- package/dist/src/command-schema.js +3 -3
- package/dist/src/command-tools.js +3 -3
- package/dist/src/connection-runtime.js +1 -1
- package/dist/src/connection.js +1 -1
- package/dist/src/contracts.js +1 -1
- package/dist/src/daemon-client-lifecycle.js +1 -1
- package/dist/src/daemon-resolution.js +1 -1
- package/dist/src/daemon.js +1 -1
- package/dist/src/debug-symbols-facade.js +1 -1
- package/dist/src/device-claim-rule.js +2 -2
- package/dist/src/device-input-state.d.ts +1 -1
- package/dist/src/device-inventory-context.js +1 -1
- package/dist/src/device-rotation.js +1 -1
- package/dist/src/device-selection-resolver.js +1 -1
- package/dist/src/device-session.js +1 -1
- package/dist/src/device-shell.js +1 -1
- package/dist/src/device2.js +1 -1
- package/dist/src/devicectl.js +1 -1
- package/dist/src/diagnostics.js +1 -1
- package/dist/src/dispatch-resolve.js +1 -1
- package/dist/src/display-inventory.js +1 -1
- package/dist/src/doctor-facade.js +1 -1
- package/dist/src/doctor2.js +1 -1
- package/dist/src/engine-eval-script.js +1 -1
- package/dist/src/error.js +1 -1
- package/dist/src/exec.js +1 -1
- package/dist/src/file.js +1 -1
- package/dist/src/find.js +1 -1
- package/dist/src/format.js +1 -1
- package/dist/src/gesture-plan-types.d.ts +38 -0
- package/dist/src/gesture-plan.js +1 -1
- package/dist/src/gesture-runtime.js +1 -1
- package/dist/src/harmonyos.js +1 -1
- package/dist/src/helper.js +2 -2
- package/dist/src/host.js +1 -1
- package/dist/src/human-control-contract.js +1 -1
- package/dist/src/human-control.js +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/input-actions.js +1 -1
- package/dist/src/input-actions2.js +1 -1
- package/dist/src/install-artifact-facade.js +1 -1
- package/dist/src/install-source-network-transport.js +1 -1
- package/dist/src/install-source2.js +1 -1
- package/dist/src/interaction-positionals.js +1 -1
- package/dist/src/interaction-ref-policy.js +1 -1
- package/dist/src/interaction2.js +1 -1
- package/dist/src/interactor-operation-binding.js +1 -1
- package/dist/src/interactor-operation-catalog.js +1 -1
- package/dist/src/interactor.js +4 -4
- package/dist/src/interactor2.js +1 -1
- package/dist/src/interactors.js +1 -1
- package/dist/src/internal/bin.js +1 -1
- package/dist/src/internal/daemon.js +2 -2
- package/dist/src/internal/png-worker.js +1 -1
- package/dist/src/internal/run-script-http-child.js +1 -1
- package/dist/src/inventory.js +1 -1
- package/dist/src/inventory2.js +1 -1
- package/dist/src/inventory3.js +1 -1
- package/dist/src/inventory5.js +1 -1
- package/dist/src/ios-snapshot-acquisition.js +1 -1
- package/dist/src/ios-snapshot-runtime.js +1 -1
- package/dist/src/lease.js +1 -1
- package/dist/src/limrun-download-file.js +1 -1
- package/dist/src/limrun-runtime-dependencies.js +1 -1
- package/dist/src/limrun.d.ts +435 -4
- package/dist/src/linux.js +1 -1
- package/dist/src/local-interactor-operation-set.js +1 -1
- package/dist/src/location-coordinates.js +1 -1
- package/dist/src/managed-device-scope.js +1 -1
- package/dist/src/mechanics.js +5 -5
- package/dist/src/mobile-snapshot-semantics.js +1 -1
- package/dist/src/multitouch-support.js +1 -1
- package/dist/src/native-build-cache.js +1 -0
- package/dist/src/observation.js +1 -1
- package/dist/src/parameterized-recorded-fill.js +1 -1
- package/dist/src/perf-facade.js +1 -2
- package/dist/src/perf-runtime-operation-builder.js +1 -1
- package/dist/src/perf-runtime-plan.js +1 -1
- package/dist/src/perf-target.js +2 -0
- package/dist/src/perf.js +1 -1
- package/dist/src/physical-device-apps.js +1 -0
- package/dist/src/physical-device-control.js +1 -1
- package/dist/src/platform-request-scope.js +1 -1
- package/dist/src/platform-runtime-host.js +1 -1
- package/dist/src/platform-runtime-managed-owner.js +1 -1
- package/dist/src/platform-runtime-open-target.js +1 -1
- package/dist/src/platform-runtime-operation-host.js +2 -2
- package/dist/src/platform-runtime-runtime-hints.js +1 -1
- package/dist/src/platform-runtime-screen-recording-apple-simulator-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-finalizer-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-process-host.js +1 -1
- package/dist/src/platform-runtime-unavailable.js +1 -1
- package/dist/src/platform-runtime.js +1 -1
- package/dist/src/platform-runtime2.js +1 -1
- package/dist/src/png-crop-bytes.js +1 -1
- package/dist/src/png-size.js +1 -1
- package/dist/src/png-worker-client.js +1 -1
- package/dist/src/png.js +1 -1
- package/dist/src/prepare-kind.js +1 -1
- package/dist/src/provider-session-ownership.js +1 -1
- package/dist/src/provider-webdriver.js +1 -1
- package/dist/src/proxy.js +1 -1
- package/dist/src/quality-warnings.js +1 -1
- package/dist/src/react-native.js +1 -1
- package/dist/src/record-runtime.js +1 -1
- package/dist/src/recording.js +1 -1
- package/dist/src/register-builtins.js +1 -1
- package/dist/src/registry.js +35 -35
- package/dist/src/remote-config2.js +1 -1
- package/dist/src/replay-divergence.js +1 -1
- package/dist/src/replay.js +1 -1
- package/dist/src/reporting.js +1 -1
- package/dist/src/request-admission.js +1 -1
- package/dist/src/request-cancel.js +1 -1
- package/dist/src/request-runtime-binding.js +1 -1
- package/dist/src/retry.js +1 -1
- package/dist/src/runner-cache-metadata.js +1 -1
- package/dist/src/runner-client.js +1 -1
- package/dist/src/runner-dev-tools-security.js +1 -1
- package/dist/src/runner-device-readiness.js +1 -1
- package/dist/src/runner-disposal.js +1 -1
- package/dist/src/runner-error-classification.js +3 -0
- package/dist/src/runner-operations-facade.js +1 -1
- package/dist/src/runner-presentation.js +1 -1
- package/dist/src/runner.js +1 -1
- package/dist/src/runtime-transport-hints.js +1 -1
- package/dist/src/runtime.js +3 -3
- package/dist/src/runtime10.js +2 -2
- package/dist/src/runtime2.js +2 -2
- package/dist/src/runtime3.js +1 -1
- package/dist/src/runtime4.js +4 -4
- package/dist/src/runtime5.js +1 -1
- package/dist/src/runtime6.js +1 -1
- package/dist/src/runtime7.js +1 -1
- package/dist/src/runtime8.js +1 -1
- package/dist/src/runtime9.js +1 -1
- package/dist/src/screen-recording-admission-ledger.js +1 -1
- package/dist/src/screen-recording-completion.js +1 -1
- package/dist/src/screen-recording-options.js +1 -1
- package/dist/src/screen-recording-resource-recovery.js +1 -1
- package/dist/src/screen-recording-transport.js +1 -1
- package/dist/src/screenshot-density.js +1 -1
- package/dist/src/screenshot-image.js +1 -1
- package/dist/src/screenshot-runtime.js +1 -1
- package/dist/src/screenshot.js +1 -1
- package/dist/src/screenshot3.js +1 -1
- package/dist/src/script.js +1 -1
- package/dist/src/scroll-command.d.ts +377 -0
- package/dist/src/scroll-command.js +1 -1
- package/dist/src/scroll-gesture.js +1 -1
- package/dist/src/sdk-batch-runner.js +2 -2
- package/dist/src/sdk-batch.js +2 -2
- package/dist/src/sdk-contracts.d.ts +28 -0
- package/dist/src/sdk-contracts.js +1 -1
- package/dist/src/sdk-device.js +1 -1
- package/dist/src/sdk-io.js +1 -1
- package/dist/src/sdk-remote-config.js +1 -1
- package/dist/src/sdk-selectors.d.ts +23 -726
- package/dist/src/selection.js +0 -0
- package/dist/src/selector-runtime.js +1 -1
- package/dist/src/semantic-index.js +1 -1
- package/dist/src/server.js +1 -1
- package/dist/src/session-allocation.js +1 -1
- package/dist/src/session-observation.js +1 -1
- package/dist/src/session-routing.js +1 -1
- package/dist/src/session-runtime-admission.js +1 -1
- package/dist/src/session-snapshot.js +1 -1
- package/dist/src/session-store.js +2 -2
- package/dist/src/session2.js +3 -3
- package/dist/src/settings.js +1 -1
- package/dist/src/simctl-facade.js +1 -1
- package/dist/src/simctl.js +1 -1
- package/dist/src/simulator-state.js +1 -1
- package/dist/src/simulator.js +1 -1
- package/dist/src/snapshot-runtime-binding.js +1 -1
- package/dist/src/snapshot-runtime.js +1 -1
- package/dist/src/snapshot-state.js +1 -1
- package/dist/src/snapshot2.js +1 -1
- package/dist/src/snapshot3.js +1 -1
- package/dist/src/snapshot4.js +1 -1
- package/dist/src/src.js +1 -1
- package/dist/src/src7.js +1 -1
- package/dist/src/src8.js +2 -2
- package/dist/src/string-enum.js +1 -1
- package/dist/src/takeover.js +1 -1
- package/dist/src/text-entry-focus.js +1 -1
- package/dist/src/tool-provider-facade.js +1 -1
- package/dist/src/tool-provider.js +2 -2
- package/dist/src/tool-provider2.js +1 -1
- package/dist/src/touch-runtime.js +1 -1
- package/dist/src/transport.js +1 -1
- package/dist/src/tree.js +1 -1
- package/dist/src/tv-remote.js +1 -1
- package/dist/src/type-text-runtime.js +1 -1
- package/dist/src/update-check.js +1 -1
- package/dist/src/verified-file.js +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/video.js +1 -1
- package/dist/src/viewport.js +1 -1
- package/dist/src/web.js +1 -1
- package/dist/src/web2.js +1 -1
- package/dist/src/webdriver-source.js +1 -1
- package/package.json +3 -2
- package/server.json +2 -2
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.12.apk.sha256 +0 -1
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.12.apk +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.12.apk.sha256 +0 -1
- package/dist/src/app-inventory.d.ts +0 -4
- package/dist/src/apps-simctl.js +0 -1
- package/dist/src/cloud-artifacts.d.ts +0 -61
- package/dist/src/runner-contract.js +0 -3
- package/dist/src/snapshot-process.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O as e}from"../sdk-contracts.js";import{n as t,r as n}from"../install-source-network-transport.js";import{t as r}from"../undici.js";import{readFileSync as i}from"node:fs";import a from"node:net";import{pathToFileURL as o}from"node:url";var s=r();async function c(e){return e.publicNetworkOnly?await u(e):await l(e)}async function l(e){if(typeof fetch!=`function`)throw Error(`global fetch is required for Maestro runScript http helpers`);return await y(await fetch(e.url,d(e)))}async function u(t){let n=v(t.url),r=AbortSignal.timeout(3e4),i=new f(n.protocol===`https:`,r);try{return await y(await(0,s.fetch)(n,{...d(t),dispatcher:i,signal:r}),8388608)}catch(t){throw t instanceof TypeError&&t.cause instanceof e?t.cause:t}finally{await i.dispose()}}function d(e){return{method:e.method,headers:e.headers,...e.body===void 0?{}:{body:e.body}}}var f=class extends s.Dispatcher{#e=new Set;#t;#n;constructor(e,t){super(),this.#t=e,this.#n=t}dispatch(e,t){return this.dispatchApproved(e,t).catch(e=>{t.onError?.(e instanceof Error?e:Error(String(e)))}),!0}async dispose(){await Promise.all([...this.#e].map(async e=>await e.close()))}async dispatchApproved(r,i){let a=_(r);if(this.#t&&a.protocol!==`https:`)throw new e(`COMMAND_FAILED`,`Maestro runScript HTTP redirect downgraded HTTPS`);a.protocol===`https:`&&(this.#t=!0);let o=await n(a,this.#n),s=t(a),c=s?m(s,a):p(o.address,o.family);this.#e.add(c),c.dispatch(s?h(r,a,o.address,o.family):r,i)}};function p(e,t){return new s.Agent({connect:{lookup:(n,r,i)=>{if(r.all){i(null,[{address:e,family:t}]);return}i(null,e,t)}}})}function m(e,t){let n=g(t.hostname);return new s.ProxyAgent({uri:e,proxyTunnel:!0,requestTls:t.protocol===`https:`&&a.isIP(n)===0?{servername:n}:void 0})}function h(e,t,n,r){let i=new URL(t);i.hostname=r===6?`[${g(n)}]`:n;let a=Array.isArray(e.headers)?[...e.headers,`host`,t.host]:{...e.headers,host:t.host};return{...e,origin:i.origin,headers:a}}function g(e){return e.startsWith(`[`)&&e.endsWith(`]`)?e.slice(1,-1):e}function _(t){if(!t.origin)throw new e(`INVALID_ARGS`,`Invalid Maestro runScript HTTP URL`);return new URL(t.path,t.origin)}function v(t){try{return new URL(t)}catch{throw new e(`INVALID_ARGS`,`Invalid Maestro runScript HTTP URL`)}}async function y(e,t){return{status:e.status,body:await b(e,t),headers:Object.fromEntries(e.headers.entries())}}async function b(t,n){if(n===void 0)return await t.text();let r=[],i=0,a=t.body?.getReader();if(!a)return``;for(;;){let{done:o,value:s}=await a.read();if(o)break;if(i+=s.byteLength,i>n)throw await a.cancel(),new e(`COMMAND_FAILED`,`Maestro runScript HTTP response exceeded ${n} bytes`,{limitBytes:n,status:t.status});r.push(s)}return Buffer.concat(r,i).toString(`utf8`)}async function x(){let e=await c(JSON.parse(i(0,`utf8`)));process.stdout.write(JSON.stringify(e))}process.argv[1]&&o(process.argv[1]).href===import.meta.url&&x().catch(e=>{console.error(e instanceof Error?e.stack??e.message:String(e)),process.exitCode=1});export{x as runScriptHttpChild};
|
package/dist/src/inventory.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O as e,k as t}from"./sdk-contracts.js";import{n}from"./device-shell.js";import{a as r,r as i}from"./adb-failure.js";import a from"node:path";function o(e){return e.startsWith(`emulator-`)}function s(e){return e.toLowerCase().replaceAll(`_`,` `).replaceAll(/\s+/g,` `).trim()}function c(e){let t=[];for(let n of e.split(`
|
|
2
2
|
`)){let e=n.trim().split(/\s+/),r=e[0];!r||r===`List`||e[1]!==`device`||t.push({serial:r,rawModel:(e.find(e=>e.startsWith(`model:`))??``).replace(`model:`,``)})}return t}function l(e){return e.split(`
|
|
3
3
|
`).map(e=>e.trim()).filter(e=>e.length>0)}function u(e){let t=e.split(`
|
|
4
4
|
`).map(e=>e.trim()).filter(e=>e.length>0);return t.at(-1)===`OK`&&t.pop(),t.join(`
|
package/dist/src/inventory2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O as e}from"./sdk-contracts.js";import{E as t}from"./sdk-device.js";import{c as n}from"./simctl.js";const r=/^(iphone|ipad|ipod|appletv|realitydevice)/i,i=/ipad/i,a=/\b(apple vision|vision pro|xros|visionos|realitydevice)\b/i,o=/\b(iphone|ipad|ipod)\b/i,s=/^appletv/i,c=[`apple tv`,`appletv`,`tvos`];function l(e){return(e??``).trim().toLowerCase()}function u(e){return e.includes(`tvos`)}function d(e){return e.includes(`xros`)||e.includes(`visionos`)}function f(e){return u(l(e))?`tv`:`mobile`}function p(e){let t=l(e);return t.includes(`ios`)||t.includes(`tvos`)||t.includes(`xros`)||t.includes(`visionos`)}function m(e){let t=l(e);return c.some(e=>t.includes(e))}function h(e){return o.test(e.trim())}function g(e){return m(e)?`tv`:h(e)||a.test(e)?`mobile`:null}function _(e,t){return e===`tv`?`tvos`:t.some(e=>a.test(e))?`visionos`:t.some(e=>i.test(e))?`ipados`:`ios`}function v(e){return r.test(e.trim())}function y(e){return s.test(e.trim())}function b(e){return[e.name??``,e.deviceProperties?.name??``,e.deviceProperties?.deviceType??``]}function x(e){return e.hardwareProperties?.productType??e.deviceProperties?.productType??``}function S(e){return u(l(e.hardwareProperties?.platform))||y(x(e))||b(e).some(m)?`tv`:`mobile`}function C(e){let t=l(e.hardwareProperties?.platform);return t.includes(`ios`)||u(t)||d(t)||v(x(e))?!0:b(e).some(m)}function w(e){if(!C(e))return null;let t=e.hardwareProperties?.udid??e.identifier??``,n=e.name??e.deviceProperties?.name??t;if(!t)return null;let r=S(e);return{platform:`apple`,id:t,name:n,kind:`device`,target:r,appleOs:_(r,[x(e),...b(e)]),iosPhysicalDeviceBackend:`coredevice`,booted:!0}}const T=/^==\s*(.+?)\s*==$/,E=/^(?<name>.+?)\s+(?:\[(?<idBracket>[^[\]]+)\]|\((?<osVersion>[^)]+)\)\s+\((?<idParen>[^)]+)\))\s*$/;function D(e){let t=[],n=null;for(let r of e.split(/\r?\n/)){let e=r.trim();if(!e)continue;let i=T.exec(e);if(i){n=i[1]?.trim()??null;continue}if(n!==`Devices`)continue;let a=O(e);a&&t.push(a)}return t}function O(e){let t=E.exec(e)?.groups;if(!t)return;let n=t.name?.trim(),r=t.idBracket?.trim()||t.idParen?.trim();if(!n||!r)return;let i=g(n);if(!i)return;let a=t.osVersion?.trim();return{platform:`apple`,id:r,name:n,kind:`device`,target:i,appleOs:_(i,a?[n,a]:[n]),iosPhysicalDeviceBackend:`xctest`,booted:!0}}async function k(e,t){let[n,r]=await Promise.all([A(e,t),j(e,t)]);return M(n,r)}async function A(e,t){let n;try{return n=await e.files.createTemporaryTextFile({prefix:`agent-device-devicectl-`,suffix:`.json`}),(await e.appleTools.run({tool:`devicectl`,args:[`list`,`devices`,`--json-output`,n.path],allowFailure:!0,timeoutMs:8e3},t.signal)).exitCode===0?(JSON.parse(await n.readText()).result?.devices??[]).flatMap(e=>{let t=w(e);return t?[t]:[]}):[]}catch{return t.signal.throwIfAborted(),[]}finally{try{await n?.[Symbol.asyncDispose]()}catch{}}}async function j(e,t){try{let n=await e.appleTools.run({tool:`xctrace`,args:[`list`,`devices`],allowFailure:!0},t.signal);return n.exitCode===0?D(n.stdout):[]}catch{return t.signal.throwIfAborted(),[]}}function M(e,t){let n=new Set(e.map(e=>e.id)),r=[...e];for(let e of t)n.has(e.id)||(n.add(e.id),r.push(e));return r}function N(e,t){let n=[];for(let[r,i]of Object.entries(e.devices))if(p(r))for(let e of i){if(!e.isAvailable)continue;let i=f(r);n.push({platform:`apple`,id:e.udid,name:e.name,kind:`simulator`,target:i,appleOs:_(i,[r,e.deviceTypeIdentifier??``,e.name]),booted:e.state===`Booted`,...t?{simulatorSetPath:t}:{}})}return n}async function P(r,i,a){let o=i.iosSimulatorSetPath?.trim()||void 0,s=await r.appleTools.run({tool:`simctl`,args:n(o),...i.booted===!0?{timeoutMs:3e3}:{}},a.signal),c;try{c=N(JSON.parse(s.stdout),o)}catch(t){throw new e(`COMMAND_FAILED`,`Failed to parse simctl devices JSON`,void 0,t)}for(let e of c)e.booted===!0&&await r.observations.deviceBooted(e);return t(c)}function F(e){return Object.freeze({discover:async(t,n)=>await I(e,t,n)})}async function I(n,r,i){if(L(r))return[B(n)];if(n.hostOs!==`darwin`)throw z(n.hostOs);if(!await n.appleTools.isXcrunAvailable(i.signal))throw new e(`TOOL_MISSING`,`xcrun not found in PATH`);let a=P(n,r,i);if(r.kind===`simulator`)return await a;if(r.iosSimulatorSetPath||r.udid){let e=await a,o=[...e,B(n)];if(r.iosSimulatorSetPath||e.some(e=>e.id===r.udid))return t(o);let s=await k(n,i);return t(V(o,s))}let[o,s]=await Promise.all([a,k(n,i)]),c=[...o,B(n)];return t(V(c,s))}function L(e){return e.platform===`macos`||e.platform===`apple`&&e.target===`desktop`}const R={darwin:`macOS`,linux:`Linux`,win32:`Windows`,other:`a non-macOS host`};function z(t){return new e(`UNSUPPORTED_PLATFORM`,`Apple tools are only available on macOS`,{supportedOn:`macOS`,hostOs:t,retriable:!1,hint:`This host runs ${R[t]}, so it cannot boot iOS Simulators or run macOS sessions. Drive Android here instead with the same command shape: agent-device devices --platform android to list targets, then agent-device open <app.apk> --platform android. To use an iOS Simulator from this machine, run agent-device on a macOS host and pass --daemon-base-url <that daemon URL>.`})}function B(e){return{platform:`apple`,id:`host-macos-local`,name:e.hostName,kind:`device`,target:`desktop`,appleOs:`macos`,booted:!0}}function V(e,t){let n=new Set(e.map(e=>e.id));return[...e,...t.filter(e=>!n.has(e.id)&&(n.add(e.id),!0))]}export{F as createAppleInventorySource};
|
package/dist/src/inventory3.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O as e}from"./sdk-contracts.js";import{n as t}from"./device-shell.js";import n from"node:path";function r(e,t={}){return{discover:async(n,r)=>await a(e,t,n,r)}}function i(e){return e.split(`
|
|
2
2
|
`).map(e=>e.trim()).filter(e=>e.length>0&&e!==`[Empty]`)}async function a(t,n,r,a){await t.toolchains.prepare(`harmonyos`);let u=await s(t,o(n));if(!u)throw new e(`TOOL_MISSING`,`hdc not found in PATH`,{hint:`Install HarmonyOS Command Line Tools, then add its sdk/default/openharmony/toolchains directory to PATH.`});let d=await l(t,u,[`list`,`targets`],a);if(d.exitCode!==0)throw new e(`COMMAND_FAILED`,`hdc list targets failed`,{stderr:d.stderr,hint:`Confirm the HarmonyOS emulator or device is running, then run hdc list targets.`});let f=i(d.stdout).filter(e=>!r.serial||r.serial===e);return await Promise.all(f.map(async e=>await c(t,u,e,a)))}function o(e){return[e.hdcSdkPath,e.devecoSdkHome&&n.join(e.devecoSdkHome,`default`,`openharmony`,`toolchains`),e.commandLineToolsHome&&n.join(e.commandLineToolsHome,`sdk`,`default`,`openharmony`,`toolchains`)].filter(e=>e!==void 0)}async function s(e,t){for(let r of t){let t=n.join(r,`hdc`);if(await e.files.isExecutable(t))return t}return await e.commands.which(`hdc`)}async function c(e,n,r,i){let[a,o]=await Promise.all([l(e,n,t(`hdc`,`shell`,[`param`,`get`,`const.product.name`],[`-t`,r]),i),l(e,n,t(`hdc`,`shell`,[`param`,`get`,`const.build.characteristics`],[`-t`,r]),i)]),s=a.exitCode===0?a.stdout.trim():``,c=s.toLowerCase()===`emulator`;return{platform:`harmonyos`,id:r,name:s||r,kind:c?`emulator`:`device`,target:o.stdout.toLowerCase().includes(`tv`)?`tv`:`mobile`,booted:!0}}async function l(e,t,n,r){return await e.commands.run({executable:t,args:n,allowFailure:!0,timeoutMs:1e4},r.signal)}export{r as createHarmonyInventory};
|
package/dist/src/inventory5.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O as e}from"./sdk-contracts.js";import t from"node:path";const n=`VirtualDevice`;function r(e){return{discover:async(t,n)=>await a(e,n)}}function i(e){return l(e).some(c)?[{platform:`vega`,id:n,name:`Vega Virtual Device (${n})`,kind:`emulator`,target:`tv`,booted:!0}]:[]}async function a(t,n){let r=await o(t);if(!r)throw new e(`TOOL_MISSING`,`Vega CLI not found in PATH`,{hint:`Install Vega Developer Tools, source ~/vega/env, and retry devices.`});let a=await t.commands.run({executable:r,args:[`device`,`list`],allowFailure:!0,timeoutMs:1e4},n.signal);s(a);let c=i(a.stdout),u=l(a.stdout);if(c.length===0&&u.length>0)throw new e(`DEVICE_NOT_FOUND`,`Vega CLI found devices, but no supported Vega Virtual Device is running.`,{listedSerials:u,hint:`Start the Vega Virtual Device, then retry with --platform vega --target tv.`});return c}async function o(e){let n=await e.commands.which(`vega`);if(n)return n;let r=t.join(e.homeDirectory,`vega`,`bin`,`vega`);return await e.files.isExecutable(r)?r:void 0}function s(t){if(t.exitCode!==0)throw new e(`COMMAND_FAILED`,`Failed to list Vega devices`,{stdout:t.stdout,stderr:t.stderr,exitCode:t.exitCode,processExitError:!0})}function c(e){return e.toLowerCase()===`virtualdevice`}function l(e){let t=new Set;for(let n of e.split(/\r?\n/)){let e=/^\s*([^\s:]+)\s*:\s*\S/.exec(n)?.[1]?.trim();e&&t.add(e)}return[...t]}export{r as createVegaInventory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ir as e,
|
|
1
|
+
import{Ir as e,Wr as t}from"./sdk-batch.js";const n={"appium-source":{producer:`appium-source`,acquisitionDepth:{rawTraversal:{kind:`incomplete`},regularPresented:{kind:`incomplete`}},hittabilityEvidence:`unavailable`},"limrun-ios-tree":{producer:`limrun-ios-tree`,acquisitionDepth:{rawTraversal:{kind:`incomplete`},regularPresented:{kind:`incomplete`}},hittabilityEvidence:`unavailable`}},r={"apple-runner":`available`,"simulator-ax-bridge":`available`,"appium-source":`unavailable`,"limrun-ios-tree":`unavailable`};function i(e){return r[e]}function a(e,t){let n=[];return e.hittabilityEvidence===`unavailable`&&n.push({kind:`unavailable-fact`,fact:`hittability`}),(e.acquisitionDepth.rawTraversal.kind===`incomplete`||e.acquisitionDepth.regularPresented.kind===`incomplete`)&&n.push({kind:`unavailable-fact`,fact:`acquisition-depth`}),i(e.producer)===`unavailable`&&n.push({kind:`unavailable-fact`,fact:`truncation`}),t.kind===`missing`&&n.push({kind:`missing-viewport`,reason:t.reason}),Object.freeze(n)}function o(e){let t=n[e.producer];return{stage:`acquired`,acquisition:{producer:e.producer,intent:`full`,nodes:e.nodes,viewport:e.viewport,lineage:e.lineage,residue:a(t,e.viewport)}}}function s(e,n={}){let r=e.filter(c),i=[...r.length>0||n.fallbackToLargestRoot!==!0?r:e].sort(l)[0];if(i)return t(i.rect)?{kind:`reported`,rect:i.rect}:{kind:`missing`,reason:i.rectStatus===`invalid`||i.rectStatus===void 0&&i.rect!==void 0?`invalid`:`not-provided`}}function c(t){let n=e(t.type??``);return n===`application`||n===`window`}function l(e,t){return u(t.rectStatus)-u(e.rectStatus)||d(t.rect)-d(e.rect)}function u(e){return e===`reported`?2:+(e===`invalid`)}function d(e){return e&&t(e)?e.width*e.height:0}export{i as n,s as r,o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as e,m as t}from"./sdk-contracts.js";import{Hr as n,Ir as r,Ur as i}from"./sdk-batch.js";import{i as a,n as o,r as s,t as c}from"./ios-snapshot-planning.js";import{t as l}from"./semantic-index.js";import{a as u,i as d,n as f,o as p,r as m,t as h}from"./runner-presentation.js";const g=new Set([`collectionview`,`scrollview`,`table`]),_=new Set([`application`,`window`]);function v(e,t,r){return!!(e&&i(t)&&n(r,t.x+t.width/2,t.y+t.height/2))}function y(){return{projectedOut:!1}}function b(e,t,n,a,o,s){let c=s===`cursor-projected`?t.ancestorClip:void 0,l=x(e.rect,n,c),u=i(T(e.rect)),d=i(l),f=r(e.type??``),p=ee(s,t.projectedOut,u,d,f,o),m=C(e,S(s,t.projectedOut,u,d)&&!te(e,u,s),a,s),h=ae(f,m,d,o),g=re(s,t.projectedOut,u,d,e);return{isIncluded:m,descendants:ne(s,p,c,l,h),effectiveRect:l,...g?{hiddenContentFrame:g}:{},establishesScrollAnchor:h}}function x(e,t,n){let r=T(e);if(!r)return;let i=O(r,t);return n&&(i=O(i,n)),i}function ee(e,t,n,r,i,a){return e===`plain-viewport`?!r:t||n&&!r&&ie(i,a)}function S(e,t,n,r){return e===`plain-viewport`?r:!t&&(!n||r)}function te(e,t,n){return n!==`cursor-projected`||e.parentIndex===void 0||w(e)||!t?!1:E(e.rect)<=1||D(e.rect)<=1}function ne(e,t,n,r,i){return{projectedOut:t,...e===`cursor-projected`&&i?{ancestorClip:r}:{ancestorClip:n}}}function re(e,t,n,r,i){if(!(e!==`cursor-projected`||t||!n||r))return T(i.rect)}function ie(e,t){return t&&(e===`cell`||g.has(e))}function ae(e,t,n,r){return t&&n&&r&&g.has(e)}function C(e,t,n,i){if(e.parentIndex===void 0)return!0;let a=r(e.type??``);return i===`plain-viewport`&&n&&!t&&a!==`application`?!1:_.has(a)||t}function w(e){return[e.label,e.identifier,e.value].some(e=>typeof e==`string`&&e.trim().length>0)}function T(e){if(e&&[e.x,e.y,e.width,e.height].every(Number.isFinite)&&!(e.width<0||e.height<0))return{...e,width:Math.max(0,e.width),height:Math.max(0,e.height)}}function E(e){return T(e)?.width??0}function D(e){return T(e)?.height??0}function O(e,t){let n=Math.max(e.x,t.x),r=Math.max(e.y,t.y),i=Math.min(e.x+e.width,t.x+t.width),a=Math.min(e.y+e.height,t.y+t.height);return i<=n||a<=r?{x:e.x,y:e.y,width:0,height:0}:{x:i>n?n:e.x,y:a>r?r:e.y,width:i-n,height:a-r}}function k(e,t,n,r,i={}){d(e);let a=A(e),o=new Map,s=[],c=new Map,l=0;for(let u of e){let e=j(u,o,()=>{l+=1}),d=e?.traversal??y(),f=r===`cursor-projected`?e?.anchor:void 0,p=b(u,d,t,n,a.has(u.index),r);M(p,f,c);let m=N(u,p,e,s,t,i),h=F(p,f,m.keptIndex);o.set(u.index,{traversal:p.descendants,anchor:h,keptIndex:m.keptIndex,keptDepth:m.keptDepth})}let u=L(c,s);return{nodes:u,stats:{presentedNodeCount:u.length,sourceNodeCount:e.length,parentClipLookups:l}}}function A(e){let t=new Set;for(let n of e)n.parentIndex!==void 0&&t.add(n.parentIndex);return t}function j(e,t,n){if(e.parentIndex!==void 0)return n(),t.get(e.parentIndex)}function M(e,t,n){e.hiddenContentFrame&&t&&I(e.hiddenContentFrame,t,n)}function N(e,t,n,r,i,a){let o=n?.keptIndex,s=n?.keptDepth??-1;if(!t.isIncluded)return{keptIndex:o,keptDepth:s};let c=r.length;s+=1;let{hittable:l,...u}=e;return r.push({raw:{...u,index:c,depth:s,parentIndex:o,...P(l,e.parentIndex!==void 0,t.effectiveRect,e.enabled!==!1,i,a)},sourceIndex:e.index,...t.effectiveRect?{effectiveRect:t.effectiveRect}:{}}),o=c,{keptIndex:o,keptDepth:s}}function P(e,t,n,r,i,a){return a.hittabilityAvailable===!1?e===!1||!r?{hittable:!1}:{}:{hittable:t&&e===!0&&v(r,n,i)}}function F(e,t,n){return e.establishesScrollAnchor&&n!==void 0&&e.effectiveRect?{index:n,rect:e.effectiveRect}:t}function I(e,t,n){let r=n.get(t.index)??{above:!1,below:!1};e.y+e.height<=t.rect.y?r.above=!0:e.y>=t.rect.y+t.rect.height&&(r.below=!0),n.set(t.index,r)}function L(e,t){return t.map(t=>{let n=e.get(t.raw.index);if(!n)return t;let r=t.raw;return{...t,raw:{...r,hiddenContentAbove:r.hiddenContentAbove===!0||n.above?!0:void 0,hiddenContentBelow:r.hiddenContentBelow===!0||n.below?!0:void 0}}})}const R=new Set([`button`,`cell`,`checkbox`,`collectionview`,`link`,`menuitem`,`picker`,`searchfield`,`securetextfield`,`segmentedcontrol`,`slider`,`scrollview`,`stepper`,`switch`,`tabbar`,`table`,`textfield`,`textview`,`webview`]);function z(e){let t=X(e.nodes),n=H(e,t);return e.projection===`raw`?U(n,e.depth,t):W(n,e.depth)}function B(e){let t=X(e.nodes);return e.projection===`raw`?U(e.nodes,e.depth,t):W(e.nodes,e.depth)}function V(e){return e.parentIndex===void 0||R.has(r(e.type??``))||le(e)}function H(e,t){let n=e.scope?.trim().toLowerCase();if(!n)return[...e.nodes];for(let r=0;r<e.nodes.length;r+=1){let i=e.nodes[r];if(!i||!se(i.raw,n))continue;let a=ce(e.nodes,r,t);if(!(e.projection===`raw`||a.some(t=>V(e.nodes[t].raw))))continue;let o=a.map(t=>e.nodes[t]);return oe(e.projection===`raw`&&e.depth!==null?o.filter(n=>Y(n,t)-Y(i,t)<=e.depth):o,Y(i,t),t)}return[]}function U(e,t,n){let r=t===null?[...e]:e.filter(e=>Y(e,n)<=t);return{nodes:r.map(e=>({...e.raw,rect:e.raw.rect})),sourceIndexes:r.map(e=>e.sourceIndex)}}function W(e,t){let n=[],r=[],i=new Map;for(let a of e){let e=G(a,i),o=K(a,e,t,n.length);if(!o){J(a,e,i);continue}n.push(o),r.push(a.sourceIndex),i.set(a.raw.index,o)}return{nodes:n,sourceIndexes:r}}function G(e,t){return e.raw.parentIndex===void 0?void 0:t.get(e.raw.parentIndex)}function K(e,t,n,r){if(!V(e.raw))return;let i=t?(t.depth??0)+1:0;if(n!==null&&i>n)return;let a=q(e);return{...e.raw,index:r,depth:i,parentIndex:t?.index,...e.effectiveRect?{rect:e.effectiveRect}:{rect:void 0},...a===void 0?{}:{hittable:a}}}function q(e){if(e.raw.hittable!==void 0)return!!(e.raw.hittable===!0&&e.effectiveRect&&e.effectiveRect.width>0&&e.effectiveRect.height>0)}function J(e,t,n){t&&n.set(e.raw.index,t)}function oe(e,t,n){let r=new Map(e.map((e,t)=>[e.raw.index,t]));return e.map((e,i)=>({...e,raw:{...e.raw,index:i,depth:Math.max(0,Y(e,n)-t),parentIndex:e.raw.parentIndex===void 0?void 0:r.get(e.raw.parentIndex)}}))}function se(e,t){return[e.label,e.identifier,e.value].some(e=>typeof e==`string`&&e.toLowerCase().includes(t))}function ce(e,t,n){let r=Y(e[t],n),i=[];for(let a=t;a<e.length&&!(a>t&&Y(e[a],n)<=r);a+=1)i.push(a);return i}function Y(e,t){return Math.max(0,e.raw.depth??t?.get(e.raw.index)??0)}function X(e){let t=new Map;for(let n of e){let e=(n.raw.parentIndex===void 0?-1:t.get(n.raw.parentIndex)??-1)+1;t.set(n.raw.index,n.raw.depth===void 0?e:Math.max(0,n.raw.depth))}return t}function le(e){return[e.label,e.identifier,e.value].some(e=>typeof e==`string`&&e.trim().length>0)}function ue(e,n,r={}){let i=de(e,n,r),a=e.stage===`presented`?e.validation.presentationKey:o(n),s=e.stage===`acquired`?e.acquisition.truncated:e.presentation.payload.truncated;return{payload:{nodes:t(i.nodes),...s===void 0?{}:{truncated:s}},presentationKey:a,comparisonIdentity:c(e,n),residue:e.stage===`acquired`?[...e.acquisition.residue]:[...e.validation.residue]}}function de(e,t,n={}){let r=n.foldPolicy??`cursor-projected`;return e.stage===`acquired`?fe(e.acquisition,t,r):h(e,t,r)}function fe(e,t,n){if(me(e,a(t)),t.projection===`raw`){d(e.nodes);let r=e.nodes.map(e=>({raw:e,sourceIndex:e.index})),i=z({nodes:r,projection:`raw`,scope:t.scope,depth:t.depth,foldPolicy:n}),a=t.scope===null?void 0:B({nodes:r,projection:`raw`,depth:null,foldPolicy:n}).nodes;return{nodes:i.nodes,...a?{qualityNodes:a}:{},presentedIndexesBySourceIndex:Q(e.nodes,i.nodes,i.sourceIndexes,Z(i.nodes)),stats:{presentedNodeCount:i.nodes.length,sourceNodeCount:e.nodes.length,parentClipLookups:0}}}let r=f(e),i=!pe(e.residue),o=k(e.nodes,r,t.interactiveOnly,n,{hittabilityAvailable:i}),s=z({nodes:o.nodes,projection:`regular`,scope:t.scope,depth:t.depth,foldPolicy:n}),c=t.interactiveOnly?l(s.nodes):{nodes:s.nodes,presentedIndexesBySourceIndex:Z(s.nodes)},u=m(c.nodes,`regular`,r,n,i),p=t.scope===null?void 0:B({nodes:o.nodes,projection:`regular`,depth:null,foldPolicy:n}).nodes;return{nodes:c.nodes,...p?{qualityNodes:p}:{},presentedIndexesBySourceIndex:Q(e.nodes,s.nodes,s.sourceIndexes,c.presentedIndexesBySourceIndex),stats:{presentedNodeCount:c.nodes.length,sourceNodeCount:e.nodes.length,parentClipLookups:o.stats.parentClipLookups+u.parentClipLookups}}}function pe(e){return e.some(e=>e.kind===`unavailable-fact`&&e.fact===`hittability`)}function me(e,t){let n=e.hint;if(n.projection!==t.projection||n.rawTraversalDepth!==t.rawTraversalDepth||n.regularPresentedDepth!==t.regularPresentedDepth||n.interactiveOnly!==t.interactiveOnly||n.customActions!==t.customActions||n.acquisitionIntent!==t.acquisitionIntent)throw new u(`projection-mismatch`,`acquired iOS snapshot does not match the requested capture hint`,{projection:n.projection})}function Z(e){return new Map(e.map(e=>[e.index,[e.index]]))}function Q(e,t,n,r){let i=new Map(t.map((e,t)=>[e.index,n[t]])),a=new Map(e.map(e=>[e.index,[]]));for(let[e,t]of r){let n=i.get(e);n!==void 0&&a.set(n,t)}return a}const he={"acquisition-depth":`iOS snapshot acquisition does not report hierarchy completeness; provider-side depth or child limits may omit nodes.`,hittability:`iOS snapshot acquisition does not provide hittability evidence; regular snapshots omit unverified hittability while raw snapshots preserve supplied facts.`,truncation:`iOS snapshot acquisition does not expose truncation metadata; tree completeness is not independently verified.`};function ge(e,t){let n=s({raw:t?.raw,interactiveOnly:t?.interactiveOnly,depth:t?.depth,scope:t?.scope,customActions:t?.customActions,acquisitionIntent:e.acquisition.intent}),r=$(e,n);try{let t=ue(r,n);return{backend:`xctest`,producer:e.acquisition.producer,nodes:[...t.payload.nodes],comparisonIdentity:t.comparisonIdentity,...e.acquisition.truncated===void 0?{}:{truncated:e.acquisition.truncated},..._e(e.acquisition.residue)}}catch(e){ve(e)}}function $(e,t){let n=a(t);return e.acquisition.intent===`full`?{stage:`acquired`,acquisition:{...e.acquisition,intent:`full`,hint:{...n,acquisitionIntent:`full`}}}:{stage:`acquired`,acquisition:{...e.acquisition,intent:`surface-observation`,hint:{...n,acquisitionIntent:`surface-observation`}}}}function _e(e){let t=new Set(e.flatMap(e=>{if(e.kind===`missing-viewport`)return[`iOS snapshot acquisition did not provide a valid viewport (${e.reason}); retry with --raw to inspect the acquired tree, while regular presentation requires viewport evidence.`];if(e.kind!==`unavailable-fact`)return[];let t=he[e.fact];return t?[t]:[]}));return t.size===0?{}:{warnings:[...t]}}function ve(t){if(!(t instanceof u))throw t;let n=p(t),r=t.reason===`missing-viewport`||t.reason===`invalid-viewport`?`Use snapshot --raw to inspect the acquired iOS tree; regular presentation requires valid viewport evidence.`:void 0;throw new e(`COMMAND_FAILED`,t.message,{...n,...r?{hint:r}:{}},t)}export{ge as presentIosSnapshotAcquisition};
|
|
1
|
+
import{O as e,m as t}from"./sdk-contracts.js";import{Ir as n,Jr as r,Ur as i,Wr as a}from"./sdk-batch.js";import{i as o,n as s,r as c,t as l}from"./ios-snapshot-planning.js";import{r as u,t as d}from"./tree.js";import{t as f}from"./semantic-index.js";import{a as p,i as m,n as h,o as g,r as _,t as v}from"./runner-presentation.js";const y=new Set([`collectionview`,`scrollview`,`table`]),b=new Set([`application`,`window`]);function x(){return{projectedOut:!1}}function S(e,t,r,i,o,s){let c=s===`cursor-projected`?t.ancestorClip:void 0,l=C(e.rect,r,c),u=a(w(e.rect)),d=a(l),f=n(e.type??``),p=ee(s,t.projectedOut,u,d,f,o),m=se(e,te(s,t.projectedOut,u,d)&&!ne(e,u,s),i,s),h=oe(f,m,d,o),g=ie(s,t.projectedOut,u,d,e);return{isIncluded:m,descendants:re(s,p,c,l,h),effectiveRect:l,...g?{hiddenContentFrame:g}:{},establishesScrollAnchor:h}}function C(e,t,n){let r=w(e);if(!r)return;let i=D(r,t);return n&&(i=D(i,n)),i}function ee(e,t,n,r,i,a){return e===`plain-viewport`?!r:t||n&&!r&&ae(i,a)}function te(e,t,n,r){return e===`plain-viewport`?r:!t&&(!n||r)}function ne(e,t,n){return n!==`cursor-projected`||e.parentIndex===void 0||ce(e)||!t?!1:T(e.rect)<=1||E(e.rect)<=1}function re(e,t,n,r,i){return{projectedOut:t,...e===`cursor-projected`&&i?{ancestorClip:r}:{ancestorClip:n}}}function ie(e,t,n,r,i){if(!(e!==`cursor-projected`||t||!n||r))return w(i.rect)}function ae(e,t){return t&&(e===`cell`||y.has(e))}function oe(e,t,n,r){return t&&n&&r&&y.has(e)}function se(e,t,r,i){if(e.parentIndex===void 0)return!0;let a=n(e.type??``);return i===`plain-viewport`&&r&&!t&&a!==`application`?!1:b.has(a)||t}function ce(e){return[e.label,e.identifier,e.value].some(e=>typeof e==`string`&&e.trim().length>0)}function w(e){if(e&&[e.x,e.y,e.width,e.height].every(Number.isFinite)&&!(e.width<0||e.height<0))return{...e,width:Math.max(0,e.width),height:Math.max(0,e.height)}}function T(e){return w(e)?.width??0}function E(e){return w(e)?.height??0}function D(e,t){let n=Math.max(e.x,t.x),r=Math.max(e.y,t.y),i=Math.min(e.x+e.width,t.x+t.width),a=Math.min(e.y+e.height,t.y+t.height);return i<=n||a<=r?{x:e.x,y:e.y,width:0,height:0}:{x:i>n?n:e.x,y:a>r?r:e.y,width:i-n,height:a-r}}function O(e){let t=d(e),n=new Set;for(let e of t.values()){let r=k(e,t);if(r){for(let i of e.slice(0,-1))if(A(r,i)){n.add(i.index);for(let e of u(i,t))n.add(e.index)}}}return n}function k(e,t){let n=e.at(-1);if(!n||!j(n))return;let r=(t.get(n.index)??[]).find(M);if(!(r?.userInteractionEnabled!==!0||!a(r.rect)))return{container:n,dimmingRect:r.rect}}function A(e,t){return j(t)&&a(t.rect)&&r(e.dimmingRect,t.rect)}function j(e){return N(e,`uitransitionview`)}function M(e){return N(e,`uidimmingview`)}function N(e,t){return n(e.role??``)===t}function P(e,t,n,r,i={}){m(e);let a=O(e),o=e.filter(e=>!a.has(e.index)),s=F(o),c=new Map,l=[],u=new Map,d=0;for(let e of o){let a=I(e,c,()=>{d+=1}),o=a?.traversal??x(),f=r===`cursor-projected`?a?.anchor:void 0,p=S(e,o,t,n,s.has(e.index),r);L(p,f,u);let m=R(e,p,a,l,t,i),h=B(p,f,m.keptIndex);c.set(e.index,{traversal:p.descendants,anchor:h,keptIndex:m.keptIndex,keptDepth:m.keptDepth})}let f=H(u,l);return{nodes:f,stats:{presentedNodeCount:f.length,sourceNodeCount:e.length,parentClipLookups:d,modalContainedNodeCount:a.size}}}function F(e){let t=new Set;for(let n of e)n.parentIndex!==void 0&&t.add(n.parentIndex);return t}function I(e,t,n){if(e.parentIndex!==void 0)return n(),t.get(e.parentIndex)}function L(e,t,n){e.hiddenContentFrame&&t&&V(e.hiddenContentFrame,t,n)}function R(e,t,n,r,i,a){let o=n?.keptIndex,s=n?.keptDepth??-1;if(!t.isIncluded)return{keptIndex:o,keptDepth:s};let c=r.length;s+=1;let{hittable:l,...u}=e;return r.push({raw:{...u,index:c,depth:s,parentIndex:o,...z(l,e.parentIndex!==void 0,t.effectiveRect,e.enabled!==!1,i,a)},sourceIndex:e.index,...t.effectiveRect?{effectiveRect:t.effectiveRect}:{}}),o=c,{keptIndex:o,keptDepth:s}}function z(e,t,n,r,a,o){return o.hittabilityAvailable===!1?e===!1||!r?{hittable:!1}:{}:{hittable:t&&e===!0&&i(r,n,a)}}function B(e,t,n){return e.establishesScrollAnchor&&n!==void 0&&e.effectiveRect?{index:n,rect:e.effectiveRect}:t}function V(e,t,n){let r=n.get(t.index)??{above:!1,below:!1};e.y+e.height<=t.rect.y?r.above=!0:e.y>=t.rect.y+t.rect.height&&(r.below=!0),n.set(t.index,r)}function H(e,t){return t.map(t=>{let n=e.get(t.raw.index);if(!n)return t;let r=t.raw;return{...t,raw:{...r,hiddenContentAbove:r.hiddenContentAbove===!0||n.above?!0:void 0,hiddenContentBelow:r.hiddenContentBelow===!0||n.below?!0:void 0}}})}const U=new Set([`button`,`cell`,`checkbox`,`collectionview`,`link`,`menuitem`,`picker`,`searchfield`,`securetextfield`,`segmentedcontrol`,`slider`,`scrollview`,`stepper`,`switch`,`tabbar`,`table`,`textfield`,`textview`,`webview`]);function W(e){let t=X(e.nodes),n=le(e,t);return e.projection===`raw`?q(n,e.depth,t):J(n,e.depth)}function G(e){let t=X(e.nodes);return e.projection===`raw`?q(e.nodes,e.depth,t):J(e.nodes,e.depth)}function K(e){return e.parentIndex===void 0||U.has(n(e.type??``))||_e(e)}function le(e,t){let n=e.scope?.trim().toLowerCase();if(!n)return[...e.nodes];for(let r=0;r<e.nodes.length;r+=1){let i=e.nodes[r];if(!i||!he(i.raw,n))continue;let a=ge(e.nodes,r,t);if(!(e.projection===`raw`||a.some(t=>K(e.nodes[t].raw))))continue;let o=a.map(t=>e.nodes[t]);return me(e.projection===`raw`&&e.depth!==null?o.filter(n=>Y(n,t)-Y(i,t)<=e.depth):o,Y(i,t),t)}return[]}function q(e,t,n){let r=t===null?[...e]:e.filter(e=>Y(e,n)<=t);return{nodes:r.map(e=>({...e.raw,rect:e.raw.rect})),sourceIndexes:r.map(e=>e.sourceIndex)}}function J(e,t){let n=[],r=[],i=new Map;for(let a of e){let e=ue(a,i),o=de(a,e,t,n.length);if(!o){pe(a,e,i);continue}n.push(o),r.push(a.sourceIndex),i.set(a.raw.index,o)}return{nodes:n,sourceIndexes:r}}function ue(e,t){return e.raw.parentIndex===void 0?void 0:t.get(e.raw.parentIndex)}function de(e,t,n,r){if(!K(e.raw))return;let i=t?(t.depth??0)+1:0;if(n!==null&&i>n)return;let a=fe(e);return{...e.raw,index:r,depth:i,parentIndex:t?.index,...e.effectiveRect?{rect:e.effectiveRect}:{rect:void 0},...a===void 0?{}:{hittable:a}}}function fe(e){if(e.raw.hittable!==void 0)return!!(e.raw.hittable===!0&&e.effectiveRect&&e.effectiveRect.width>0&&e.effectiveRect.height>0)}function pe(e,t,n){t&&n.set(e.raw.index,t)}function me(e,t,n){let r=new Map(e.map((e,t)=>[e.raw.index,t]));return e.map((e,i)=>({...e,raw:{...e.raw,index:i,depth:Math.max(0,Y(e,n)-t),parentIndex:e.raw.parentIndex===void 0?void 0:r.get(e.raw.parentIndex)}}))}function he(e,t){return[e.label,e.identifier,e.value].some(e=>typeof e==`string`&&e.toLowerCase().includes(t))}function ge(e,t,n){let r=Y(e[t],n),i=[];for(let a=t;a<e.length&&!(a>t&&Y(e[a],n)<=r);a+=1)i.push(a);return i}function Y(e,t){return Math.max(0,e.raw.depth??t?.get(e.raw.index)??0)}function X(e){let t=new Map;for(let n of e){let e=(n.raw.parentIndex===void 0?-1:t.get(n.raw.parentIndex)??-1)+1;t.set(n.raw.index,n.raw.depth===void 0?e:Math.max(0,n.raw.depth))}return t}function _e(e){return[e.label,e.identifier,e.value].some(e=>typeof e==`string`&&e.trim().length>0)}function ve(e,n,r={}){let i=ye(e,n,r),a=e.stage===`presented`?e.validation.presentationKey:s(n),o=e.stage===`acquired`?e.acquisition.truncated:e.presentation.payload.truncated;return{payload:{nodes:t(i.nodes),...o===void 0?{}:{truncated:o}},presentationKey:a,comparisonIdentity:l(e,n),residue:e.stage===`acquired`?[...e.acquisition.residue]:[...e.validation.residue]}}function ye(e,t,n={}){let r=n.foldPolicy??`cursor-projected`;return e.stage===`acquired`?be(e.acquisition,t,r):v(e,t,r)}function be(e,t,n){if(Se(e,o(t)),t.projection===`raw`){m(e.nodes);let r=e.nodes.map(e=>({raw:e,sourceIndex:e.index})),i=W({nodes:r,projection:`raw`,scope:t.scope,depth:t.depth,foldPolicy:n}),a=t.scope===null?void 0:G({nodes:r,projection:`raw`,depth:null,foldPolicy:n}).nodes;return{nodes:i.nodes,...a?{qualityNodes:a}:{},presentedIndexesBySourceIndex:Q(e.nodes,i.nodes,i.sourceIndexes,Z(i.nodes)),stats:{presentedNodeCount:i.nodes.length,sourceNodeCount:e.nodes.length,parentClipLookups:0,modalContainedNodeCount:0}}}let r=h(e),i=!xe(e.residue),a=P(e.nodes,r,t.interactiveOnly,n,{hittabilityAvailable:i}),s=W({nodes:a.nodes,projection:`regular`,scope:t.scope,depth:t.depth,foldPolicy:n}),c=t.interactiveOnly?f(s.nodes):{nodes:s.nodes,presentedIndexesBySourceIndex:Z(s.nodes)},l=_(c.nodes,`regular`,r,n,i),u=t.scope===null?void 0:G({nodes:a.nodes,projection:`regular`,depth:null,foldPolicy:n}).nodes;return{nodes:c.nodes,...u?{qualityNodes:u}:{},presentedIndexesBySourceIndex:Q(e.nodes,s.nodes,s.sourceIndexes,c.presentedIndexesBySourceIndex),stats:{presentedNodeCount:c.nodes.length,sourceNodeCount:e.nodes.length,parentClipLookups:a.stats.parentClipLookups+l.parentClipLookups,modalContainedNodeCount:a.stats.modalContainedNodeCount}}}function xe(e){return e.some(e=>e.kind===`unavailable-fact`&&e.fact===`hittability`)}function Se(e,t){let n=e.hint;if(n.projection!==t.projection||n.rawTraversalDepth!==t.rawTraversalDepth||n.regularPresentedDepth!==t.regularPresentedDepth||n.interactiveOnly!==t.interactiveOnly||n.customActions!==t.customActions||n.acquisitionIntent!==t.acquisitionIntent)throw new p(`projection-mismatch`,`acquired iOS snapshot does not match the requested capture hint`,{projection:n.projection})}function Z(e){return new Map(e.map(e=>[e.index,[e.index]]))}function Q(e,t,n,r){let i=new Map(t.map((e,t)=>[e.index,n[t]])),a=new Map(e.map(e=>[e.index,[]]));for(let[e,t]of r){let n=i.get(e);n!==void 0&&a.set(n,t)}return a}const Ce={"acquisition-depth":`iOS snapshot acquisition does not report hierarchy completeness; provider-side depth or child limits may omit nodes.`,hittability:`iOS snapshot acquisition does not provide hittability evidence; regular snapshots omit unverified hittability while raw snapshots preserve supplied facts.`,truncation:`iOS snapshot acquisition does not expose truncation metadata; tree completeness is not independently verified.`};function $(e,t){let n=c({raw:t?.raw,interactiveOnly:t?.interactiveOnly,depth:t?.depth,scope:t?.scope,customActions:t?.customActions,acquisitionIntent:e.acquisition.intent}),r=we(e,n);try{let t=ve(r,n);return{backend:`xctest`,producer:e.acquisition.producer,nodes:[...t.payload.nodes],comparisonIdentity:t.comparisonIdentity,...e.acquisition.truncated===void 0?{}:{truncated:e.acquisition.truncated},...Te(e.acquisition.residue)}}catch(e){Ee(e)}}function we(e,t){let n=o(t);return e.acquisition.intent===`full`?{stage:`acquired`,acquisition:{...e.acquisition,intent:`full`,hint:{...n,acquisitionIntent:`full`}}}:{stage:`acquired`,acquisition:{...e.acquisition,intent:`surface-observation`,hint:{...n,acquisitionIntent:`surface-observation`}}}}function Te(e){let t=new Set(e.flatMap(e=>{if(e.kind===`missing-viewport`)return[`iOS snapshot acquisition did not provide a valid viewport (${e.reason}); retry with --raw to inspect the acquired tree, while regular presentation requires viewport evidence.`];if(e.kind!==`unavailable-fact`)return[];let t=Ce[e.fact];return t?[t]:[]}));return t.size===0?{}:{warnings:[...t]}}function Ee(t){if(!(t instanceof p))throw t;let n=g(t),r=t.reason===`missing-viewport`||t.reason===`invalid-viewport`?`Use snapshot --raw to inspect the acquired iOS tree; regular presentation requires valid viewport evidence.`:void 0;throw new e(`COMMAND_FAILED`,t.message,{...n,...r?{hint:r}:{}},t)}export{$ as presentIosSnapshotAcquisition};
|
package/dist/src/lease.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{A as e,M as t,O as n}from"./sdk-contracts.js";import{d as r,l as i,o as a,r as o}from"./lease-scope.js";import{rn as s}from"./sdk-batch.js";import{n as c}from"./catalog.js";import{i as l,r as u}from"./request-cancel.js";import"./request.js";import{a as d,n as f}from"./provider-session-ownership.js";import{n as p,r as m}from"./lease-context.js";async function h(e){let{req:t,sessionName:n,sessionStore:o,leaseRegistry:d,providerRuntimeIds:f,providerRuntimeRequiredIds:h,leaseLifecycleProvider:y,cloudArtifactProvider:b}=e,w=p(t);switch(t.command){case c.artifacts:return{ok:!0,data:await C(t,m(t,o.get(n)),d,b)};case`lease_allocate`:{S(w.leaseProvider,f,h);let e=d.allocateLease(a(w));return await d.runDeviceMutation(e,async()=>{let n;try{n=await y?.allocate?.(e,{...x(t),signal:u(t.meta?.requestId),deadline:Date.now()+s}),k(d,e,n)}catch(t){throw d.releaseLease(g(e)),t}if(l(t.meta?.requestId))throw await v(e,y,d);return{ok:!0,data:{lease:e,...n?{provider:n}:{}}}})}case`lease_heartbeat`:{let e=d.heartbeatLease(i(w)),n=await y?.heartbeat?.(e,x(t));return{ok:!0,data:{lease:e,...n?{provider:n}:{}}}}case`lease_release`:{let e=r(w),n=d.getLease(e),i=await d.runDeviceMutation(n,async()=>await _(d,y,n,e,x(t)));return{ok:!0,data:{released:i.registryReleased,...i.provider?{provider:i.provider}:{}}}}default:return null}}function g(e){return r({leaseId:e.leaseId,tenantId:e.tenantId,runId:e.runId,leaseBackend:e.backend,leaseProvider:e.leaseProvider,deviceKey:e.deviceKey,clientId:e.clientId})}async function _(e,t,n,r,i){let a=n?await t?.release?.(n,i):void 0;return n&&k(e,n,a),{registryReleased:e.releaseLease(r).released,provider:a}}async function v(e,n,r){let i=g(e),a,o;try{a=await _(r,n,e,i)}catch(e){o=t(e),a={registryReleased:r.releaseLease(i).released}}return y(e,a,o)}function y(t,n,r){let i=n.provider?.providerSessionId,a=Array.isArray(n.provider?.warnings)?n.provider.warnings:[],o=n.registryReleased&&r===void 0&&a.length===0;return e({leaseId:t.leaseId,leaseProvider:t.leaseProvider,released:o,registryReleased:n.registryReleased,providerSessionId:i,...a.length>0?{warnings:a}:{},...r===void 0?{}:{releaseError:r},hint:b(o,t.leaseId,i)})}function b(e,t,n){return e?`The lease request was canceled while the provider was still allocating; the session it produced was released.`:`The lease request was canceled while the provider was still allocating, and the session it produced could NOT be confirmed released — it may still be running and billing. Stop provider session ${String(n??`(unknown)`)} for lease ${t} by hand.`}function x(e){return{flags:e.flags,...typeof e.flags?.providerApp==`string`?{initialApp:e.flags.providerApp}:{},cwd:typeof e.meta?.cwd==`string`?e.meta.cwd:void 0,...e.internal?.publicNetworkOnly?{publicNetworkOnly:!0}:{}}}function S(e,t,r){if(!(!e||t===void 0||r===void 0||!r.includes(e)||t.includes(e)))throw new n(`UNSUPPORTED_OPERATION`,`Provider "${e}" is not available in this daemon runtime.`,{provider:e,hint:`Restart the daemon with ${e} configured, then retry lease allocation.`})}async function C(e,t,n,r){let i=O(e.flags,`providerSessionId`);return w(t,i)?await T(t.tenantId):await E(t,i,n,r)}function w(e,t){return o(e)||!e.leaseProvider&&!t}async function T(e){let t=await d(e);return{source:`daemon`,status:`ready`,artifacts:t,...t.length===0?{message:`No daemon artifacts available.`}:{}}}async function E(e,t,r,i){if(!e.leaseProvider)throw new n(`INVALID_ARGS`,`artifacts requires --provider for provider session lookup or an active cloud connection.`);if(!e.leaseId&&!t)throw new n(`INVALID_ARGS`,`artifacts requires an active cloud lease or --provider-session <id>.`);let a=D(r,e,t),o=await i?.listCloudArtifacts?.({provider:e.leaseProvider,leaseId:a?.leaseId??e.leaseId,providerSessionId:t});if(!o)throw new n(`UNSUPPORTED_OPERATION`,`Cloud artifacts are not available for provider "${e.leaseProvider}".`);return o}function D(e,t,r){if(!r)return;let i=e.resolveProviderSession({provider:t.leaseProvider,providerSessionId:r,tenantId:t.tenantId});if(i)return i;throw new n(`UNAUTHORIZED`,`Provider session is not owned by the request tenant`,{reason:`PROVIDER_SESSION_NOT_OWNED`})}function O(e,t){let n=e?.[t];return typeof n==`string`&&n.trim().length>0?n.trim():void 0}function k(e,t,n){let r=f(n);r&&e.recordProviderSession(t,r)}export{h as handleLeaseCommands};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O as e}from"./sdk-contracts.js";import t from"node:path";import n from"node:fs";import{Readable as r}from"node:stream";import{pipeline as i}from"node:stream/promises";async function a(a){let s=AbortSignal.timeout(a.timeoutMs);try{await n.promises.mkdir(t.dirname(a.destinationPath),{recursive:!0});let c=await fetch(a.url,{method:`GET`,headers:a.headers,signal:s});if(!c.ok)throw await o(c,a);if(!c.body)throw new e(`COMMAND_FAILED`,`Limrun download returned no body`,{url:a.url});await i(r.fromWeb(c.body),n.createWriteStream(a.destinationPath),{signal:s})}catch(e){throw await n.promises.rm(a.destinationPath,{force:!0}).catch(()=>{}),c(e,a,s)}}async function o(t,n){return new e(`COMMAND_FAILED`,`Limrun download failed with HTTP ${t.status}`,{url:n.url,statusCode:t.status,body:await s(t)})}async function s(e){if(!e.body)return``;let t=e.body.getReader(),n=[],r=0;try{for(;r<500;){let{done:e,value:i}=await t.read();if(e)break;let a=500-r;n.push(i.subarray(0,a)),r+=i.byteLength}}finally{t.cancel().catch(()=>{})}return Buffer.concat(n).toString(`utf8`)}function c(t,n,r){return r.aborted?new e(`COMMAND_FAILED`,`Limrun download timed out`,{url:n.url,timeoutMs:n.timeoutMs}):t instanceof e?t:new e(`COMMAND_FAILED`,`Limrun download failed`,{url:n.url,reason:t instanceof Error?t.message:String(t)})}export{a as downloadLimrunFile};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime.js";import{O as t}from"./sdk-contracts.js";import{c as n,n as r}from"./exec.js";import"./command.js";import{a as i}from"./version.js";import{_ as a}from"./adb-executor.js";import{i as o,o as s,r as c}from"./adb-transport.js";import"./mechanics.js";import"./platform-runtime-android-adb-host.js";import{n as l}from"./android.js";var u=e({createLimrunRuntimeDependencies:()=>d});function d(){return{clientVersion:i(),android:{createInteractor:(e,t)=>l(e,t),createPortReverse:async e=>{let{createAndroidPortReverseManager:t}=await import(`./mechanics.js`).then(e=>e.r);return t(e)},inferAppName:async e=>{let{inferAndroidAppName:t}=await import(`./mechanics.js`).then(e=>e.r);return t(e)},listApps:async(e,t)=>{let{listAndroidAppsWithAdb:n}=await import(`./mechanics.js`).then(e=>e.r);return(await n(e,{filter:t,target:`mobile`})).map(e=>({id:e.package,name:e.name}))},getForegroundApp:async(e,t,n)=>{let{getAndroidAppStateWithAdb:r}=await import(`./platform-runtime.js`).then(e=>e.a),i=await r(async(e,r)=>await t(e,{...r,signal:n}),n);return i.package?{appId:i.package,activity:i.activity}:void 0},getKeyboardState:async e=>{let{getAndroidKeyboardStatusWithAdb:t}=await import(`./mechanics.js`).then(e=>e.r);return await t(e)},dismissKeyboard:async e=>{let{dismissAndroidKeyboardWithAdb:t}=await import(`./mechanics.js`).then(e=>e.r);return await t(e)},readLogs:async(e,t)=>{let{captureAndroidLogcatWithAdb:n}=await import(`./mechanics.js`).then(e=>e.r);return await n(e,{lines:t,timeoutMs:5e3})},forceStopApp:async(e,t,n)=>{let{runAdbShell:r}=await import(`./mechanics.js`).then(e=>e.r);await r(async(t,r)=>await e(t,{...r,signal:n}),[`am`,`force-stop`,t],{allowFailure:!0})},deviceAdbInvocation:(e,t)=>o(s(e),t),hostAdbInvocation:e=>o(c(),e),adbError:async(e,t,n)=>{let{androidAdbResultError:r,serializeAndroidAdbInvocation:i}=await import(`./mechanics.js`).then(e=>e.r);return r(e,t,n?{command:`adb ${i(n).join(` `)}`}:void 0)}},host:{runAdb:async(e,t)=>await a(e,t),downloadFile:async e=>{let{downloadLimrunFile:t}=await import(`./limrun-download-file.js`);await t(e)},archiveDirectory:async({sourceDirectory:e,entryName:i,archivePath:a})=>{let o=[`-qr`,a,i],s=await n(`zip`,o,{cwd:e,timeoutMs:12e4});if(s.exitCode!==0)throw new t(`COMMAND_FAILED`,`Failed to package iOS .app for Limrun install`,{command:[`zip`,...o].join(` `),...r(s)})}},ios:{resolveAppAlias:async e=>{let{resolveIosAppAlias:t}=await import(`./app-resolution-facade.js`);return t(e)},readBundleAppName:async e=>{let{readIosBundleInfo:t}=await import(`./install-artifact-facade.js`);return(await t(e)).appName}}}}export{u as n,d as t};
|