agent-device 0.21.11 → 0.21.13
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.11.apk → agent-device-android-ime-helper-0.21.13.apk} +0 -0
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.13.apk.sha256 +1 -0
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.11.manifest.json → agent-device-android-ime-helper-0.21.13.manifest.json} +4 -4
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.11.apk → agent-device-android-snapshot-helper-0.21.13.apk} +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.13.apk.sha256 +1 -0
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.11.manifest.json → agent-device-android-snapshot-helper-0.21.13.manifest.json} +6 -6
- package/apple/fold-helper/Fold.m +97 -0
- package/apple/macos-helper/Package.swift +3 -6
- package/apple/macos-helper/Sources/AgentDeviceMacOSHelper/main.swift +3 -8
- 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 +99 -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 +22 -568
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +21 -9
- 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 +18 -2236
- 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 +165 -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 +147 -95
- 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 +287 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +1 -200
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SequenceExecution.swift +0 -185
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +75 -285
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotAcquisition.swift +23 -10
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotBackendCapabilities.swift +0 -78
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +83 -578
- 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 +27 -97
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedInteraction.swift +1 -11
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedTextEntry.swift +11 -87
- 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 +142 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +22 -6
- package/dist/apple/runner/AgentDeviceRunner/RecordingScripts/recording-overlay.swift +140 -20
- package/dist/src/absence-observation-errors.js +1 -1
- package/dist/src/adapter.js +1 -1
- package/dist/src/agent-device-client.js +1 -1
- package/dist/src/alert-runtime.js +1 -1
- package/dist/src/android-adb.d.ts +1 -1
- package/dist/src/app-launch.js +2 -2
- package/dist/src/app-log-runtime2.js +3 -3
- package/dist/src/app-resolution.js +2 -2
- package/dist/src/back-mode.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 +10 -7
- package/dist/src/cli-runner.js +1 -1
- package/dist/src/cli.js +1 -1
- package/dist/src/client-types.d.ts +5 -8
- 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.js +1 -1
- package/dist/src/daemon-client-lifecycle.js +1 -1
- package/dist/src/daemon-resolution.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-rotation.js +1 -1
- package/dist/src/device-session.js +1 -1
- package/dist/src/devicectl.js +1 -1
- package/dist/src/display-inventory.js +1 -1
- package/dist/src/doctor-facade.js +1 -1
- package/dist/src/find.js +1 -1
- package/dist/src/gesture-plan-types.d.ts +38 -0
- package/dist/src/harmonyos.js +1 -1
- package/dist/src/helper.js +2 -2
- package/dist/src/host.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-ref-policy.js +1 -1
- package/dist/src/interaction2.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/internal/bin.js +1 -1
- package/dist/src/internal/daemon.js +2 -2
- package/dist/src/inventory2.js +1 -1
- package/dist/src/ios-snapshot-acquisition.js +1 -1
- package/dist/src/ios-snapshot-runtime.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/macos-facade.js +1 -1
- package/dist/src/managed-device-scope.js +1 -1
- package/dist/src/mechanics.js +4 -4
- package/dist/src/mobile-snapshot-semantics.js +1 -1
- package/dist/src/perf-facade.js +1 -2
- package/dist/src/perf-runtime-plan.js +1 -1
- package/dist/src/perf-target.js +2 -0
- 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-operation-host.js +1 -1
- package/dist/src/platform-runtime-screen-recording-finalizer-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/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/registry.js +35 -35
- package/dist/src/request-admission.js +1 -1
- package/dist/src/request-runtime-binding.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.js +3 -3
- package/dist/src/runtime10.js +1 -1
- package/dist/src/runtime2.js +2 -2
- 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 -1
- package/dist/src/screen-recording-resource-recovery.js +1 -1
- package/dist/src/screen-recording-transport.js +1 -1
- package/dist/src/screenshot-runtime.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/sdk-batch.js +2 -2
- package/dist/src/sdk-contracts.d.ts +9 -0
- package/dist/src/sdk-device.js +1 -1
- package/dist/src/sdk-selectors.d.ts +23 -715
- 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-observation.js +1 -1
- package/dist/src/session-snapshot.js +1 -1
- package/dist/src/session2.js +2 -2
- package/dist/src/simctl-facade.js +1 -1
- package/dist/src/simctl.js +1 -1
- package/dist/src/simulator-facade.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/snapshot4.js +1 -1
- package/dist/src/src7.js +1 -1
- package/dist/src/text-entry-focus.js +1 -1
- package/dist/src/tool-provider.js +1 -1
- package/dist/src/touch-runtime.js +1 -1
- package/dist/src/tree.js +1 -1
- package/dist/src/update-check.js +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/web2.js +1 -1
- package/package.json +4 -2
- package/server.json +2 -2
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.11.apk.sha256 +0 -1
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.11.apk.sha256 +0 -1
- package/apple/macos-helper/Sources/AgentDeviceMacOSDeviceHub/DeviceHubPose.swift +0 -47
- package/apple/macos-helper/Sources/AgentDeviceMacOSDeviceHub/DeviceHubWindowInventory.swift +0 -65
- package/apple/macos-helper/Sources/AgentDeviceMacOSHelper/DeviceHubPose.swift +0 -225
- package/apple/macos-helper/Sources/AgentDeviceMacOSHelper/DeviceHubSidebar.swift +0 -57
- package/apple/macos-helper/Sources/AgentDeviceMacOSHelper/DeviceHubWindowDiscovery.swift +0 -108
- package/apple/macos-helper/Tests/AgentDeviceMacOSDeviceHubTests/DeviceHubPoseTests.swift +0 -30
- package/apple/macos-helper/Tests/AgentDeviceMacOSDeviceHubTests/DeviceHubWindowInventoryTests.swift +0 -65
- 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/inventory2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as e}from"./sdk-contracts.js";import{
|
|
1
|
+
import{D as e}from"./sdk-contracts.js";import{E as t}from"./sdk-device.js";import{o 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){return n([`list`,`devices`,`-j`],{simulatorSetPath:e})}function P(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 F(n,r,i){let a=r.iosSimulatorSetPath?.trim()||void 0,o=await n.appleTools.run({tool:`simctl`,args:N(a),...r.booted===!0?{timeoutMs:3e3}:{}},i.signal),s;try{s=P(JSON.parse(o.stdout),a)}catch(t){throw new e(`COMMAND_FAILED`,`Failed to parse simctl devices JSON`,void 0,t)}for(let e of s)e.booted===!0&&await n.observations.deviceBooted(e);return t(s)}function I(e){return Object.freeze({discover:async(t,n)=>await L(e,t,n)})}async function L(n,r,i){if(R(r))return[V(n)];if(n.hostOs!==`darwin`)throw B(n.hostOs);if(!await n.appleTools.isXcrunAvailable(i.signal))throw new e(`TOOL_MISSING`,`xcrun not found in PATH`);let a=F(n,r,i);if(r.kind===`simulator`)return await a;if(r.iosSimulatorSetPath||r.udid){let e=await a,o=[...e,V(n)];if(r.iosSimulatorSetPath||e.some(e=>e.id===r.udid))return t(o);let s=await k(n,i);return t(H(o,s))}let[o,s]=await Promise.all([a,k(n,i)]),c=[...o,V(n)];return t(H(c,s))}function R(e){return e.platform===`macos`||e.platform===`apple`&&e.target===`desktop`}const z={darwin:`macOS`,linux:`Linux`,win32:`Windows`,other:`a non-macOS host`};function B(t){return new e(`UNSUPPORTED_PLATFORM`,`Apple tools are only available on macOS`,{supportedOn:`macOS`,hostOs:t,retriable:!1,hint:`This host runs ${z[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 V(e){return{platform:`apple`,id:`host-macos-local`,name:e.hostName,kind:`device`,target:`desktop`,appleOs:`macos`,booted:!0}}function H(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{I as createAppleInventorySource};
|
|
@@ -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{D 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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime.js";import{D as t}from"./sdk-contracts.js";import{c as n,n as r}from"./exec.js";import"./command.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime.js";import{D 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};
|
package/dist/src/limrun.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { S as DeviceTarget, b as DeviceInfo, f as LeaseBackend, w as PlatformSelector, x as DeviceKind } from "./sdk-contracts.js";
|
|
2
|
-
import {
|
|
3
|
-
import { d as
|
|
4
|
-
import { n as CloudArtifactProvider } from "./cloud-artifacts.js";
|
|
1
|
+
import { D as Point, E as IosTargetActivation, F as SnapshotProvenance, M as SnapshotKeyboardBandFact, O as RawSnapshotNode, P as SnapshotOptions$1, S as DeviceTarget, b as DeviceInfo, f as LeaseBackend, k as Rect, w as PlatformSelector, x as DeviceKind } from "./sdk-contracts.js";
|
|
2
|
+
import { s as AppsFilter, t as GesturePlan } from "./gesture-plan-types.js";
|
|
3
|
+
import { T as BackendSnapshotResult, d as ReadSettingResult, f as ReadableSetting, g as CloudArtifactProvider, i as DeviceRotation, k as SessionSurface, n as ScrollExecutionOptions, p as SettingOptions, r as TvRemoteButton, v as BackMode, y as ScrollDirection } from "./scroll-command.js";
|
|
5
4
|
import { d as AndroidAdbProvider, n as AndroidKeyboardState, s as AndroidInputOwner, t as AndroidKeyboardDismissResult } from "./device-input-state.js";
|
|
6
5
|
//#region packages/contracts/src/device-inventory.d.ts
|
|
7
6
|
type DeviceInventoryRequest = {
|
|
@@ -64,6 +63,438 @@ type ProviderAppCatalogQuery = Readonly<{
|
|
|
64
63
|
}>;
|
|
65
64
|
type ProviderAppCatalogHandler = (query: ProviderAppCatalogQuery, signal?: AbortSignal) => Promise<readonly string[]>;
|
|
66
65
|
//#endregion
|
|
66
|
+
//#region packages/contracts/src/ios-system-surface.d.ts
|
|
67
|
+
/**
|
|
68
|
+
* iOS out-of-process system surfaces that agent-device observes and drives IN PLACE, never by
|
|
69
|
+
* activation: launching or activating the host cancels what it presents (issue #2438), so the
|
|
70
|
+
* runner addresses the host process while it is foreground and the `open` path refuses it. The set
|
|
71
|
+
* is deliberately closed and tiny; add a host only with live evidence that it presents out of
|
|
72
|
+
* process and dies on activation. Rationale per host lives in the canonical fixture
|
|
73
|
+
* `contracts/fixtures/ios-system-surface-hosts.json` (see also docs/adr/0004); this module and the
|
|
74
|
+
* Swift `SystemSurfaceHostRegistry` both mirror it, each guarded by a parity test.
|
|
75
|
+
*/
|
|
76
|
+
/** Why a system surface is served in place; carried at snapshot-response level as provenance. */
|
|
77
|
+
type IosSystemSurfaceKind = 'web-auth' | 'payment';
|
|
78
|
+
/**
|
|
79
|
+
* Whole-snapshot provenance: the capture describes a system surface presented over the session app,
|
|
80
|
+
* not the app itself. Carried at response level (it applies to the entire snapshot) and folded into
|
|
81
|
+
* iOS snapshot lineage so `--verify`/`--settle` never compare an app baseline against a sheet
|
|
82
|
+
* capture. Mirrors the Android system-chrome/system-surface provenance model.
|
|
83
|
+
*/
|
|
84
|
+
type IosSystemSurfaceProvenance = Readonly<{
|
|
85
|
+
bundleId: string;
|
|
86
|
+
kind: IosSystemSurfaceKind;
|
|
87
|
+
}>;
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region packages/contracts/src/runner-lease-context.d.ts
|
|
90
|
+
type RunnerLogicalLeaseContext = {
|
|
91
|
+
leaseId?: string;
|
|
92
|
+
clientId?: string;
|
|
93
|
+
tenantId?: string;
|
|
94
|
+
runId?: string;
|
|
95
|
+
leaseProvider?: string;
|
|
96
|
+
deviceKey?: string;
|
|
97
|
+
};
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region packages/contracts/src/ios-snapshot.d.ts
|
|
100
|
+
type IosSnapshotProducer = 'apple-runner' | 'simulator-ax-bridge' | 'appium-source' | 'limrun-ios-tree';
|
|
101
|
+
type IosAcquisitionProducer = Exclude<IosSnapshotProducer, 'apple-runner'>;
|
|
102
|
+
type IosAcquisitionIntent = 'full' | 'surface-observation';
|
|
103
|
+
type IosSnapshotProjection = 'regular' | 'raw';
|
|
104
|
+
type IosSnapshotGeneration = string;
|
|
105
|
+
type IosSnapshotLineage = Readonly<{
|
|
106
|
+
targetId?: string;
|
|
107
|
+
generation?: IosSnapshotGeneration;
|
|
108
|
+
}>;
|
|
109
|
+
type IosSnapshotPresentationKey = Readonly<{
|
|
110
|
+
projection: IosSnapshotProjection;
|
|
111
|
+
interactiveOnly: boolean;
|
|
112
|
+
depth: number | null;
|
|
113
|
+
scope: string | null;
|
|
114
|
+
customActions: boolean;
|
|
115
|
+
}>;
|
|
116
|
+
type CaptureHint = Readonly<{
|
|
117
|
+
projection: IosSnapshotProjection;
|
|
118
|
+
rawTraversalDepth: number | null;
|
|
119
|
+
regularPresentedDepth: number | null;
|
|
120
|
+
interactiveOnly: boolean;
|
|
121
|
+
customActions: boolean;
|
|
122
|
+
acquisitionIntent: IosAcquisitionIntent;
|
|
123
|
+
}>;
|
|
124
|
+
type IosSnapshotFact = 'acquisition-depth' | 'scope' | 'interactive-query' | 'viewport' | 'hittability' | 'generation' | 'truncation';
|
|
125
|
+
type IosViewportEvidence = Readonly<{
|
|
126
|
+
kind: 'reported';
|
|
127
|
+
rect: Rect;
|
|
128
|
+
}> | Readonly<{
|
|
129
|
+
kind: 'derived';
|
|
130
|
+
rect: Rect;
|
|
131
|
+
}> | Readonly<{
|
|
132
|
+
kind: 'missing';
|
|
133
|
+
reason: 'not-provided' | 'not-supported' | 'invalid';
|
|
134
|
+
}>;
|
|
135
|
+
type IosProviderPrunedField = 'nodes' | 'depth' | 'scope' | 'interactive-only';
|
|
136
|
+
type IosAcquisitionResidue = Readonly<{
|
|
137
|
+
kind: 'provider-pruned';
|
|
138
|
+
fields: readonly IosProviderPrunedField[];
|
|
139
|
+
}> | Readonly<{
|
|
140
|
+
kind: 'missing-viewport';
|
|
141
|
+
reason: 'not-provided' | 'not-supported' | 'invalid';
|
|
142
|
+
}> | Readonly<{
|
|
143
|
+
kind: 'truncated';
|
|
144
|
+
}> | Readonly<{
|
|
145
|
+
kind: 'stale-generation';
|
|
146
|
+
expected?: IosSnapshotGeneration;
|
|
147
|
+
observed?: IosSnapshotGeneration;
|
|
148
|
+
}> | Readonly<{
|
|
149
|
+
kind: 'unknown-generation';
|
|
150
|
+
captureId: string;
|
|
151
|
+
}> | Readonly<{
|
|
152
|
+
kind: 'unavailable-fact';
|
|
153
|
+
fact: IosSnapshotFact;
|
|
154
|
+
}> | Readonly<{
|
|
155
|
+
kind: 'fallback-source';
|
|
156
|
+
producer: IosSnapshotProducer;
|
|
157
|
+
}>;
|
|
158
|
+
type IosSnapshotAcquisitionForIntent<Intent extends IosAcquisitionIntent> = Readonly<{
|
|
159
|
+
producer: IosAcquisitionProducer;
|
|
160
|
+
intent: Intent;
|
|
161
|
+
hint: CaptureHint & Readonly<{
|
|
162
|
+
acquisitionIntent: Intent;
|
|
163
|
+
}>;
|
|
164
|
+
nodes: readonly RawSnapshotNode[];
|
|
165
|
+
truncated?: boolean;
|
|
166
|
+
viewport: IosViewportEvidence;
|
|
167
|
+
lineage: IosSnapshotLineage;
|
|
168
|
+
residue: readonly IosAcquisitionResidue[];
|
|
169
|
+
}>;
|
|
170
|
+
type IosSnapshotAcquisition = IosSnapshotAcquisitionForIntent<'full'> | IosSnapshotAcquisitionForIntent<'surface-observation'>;
|
|
171
|
+
type IosSnapshotAcquisitionFacts = Omit<IosSnapshotAcquisition, 'hint'>;
|
|
172
|
+
type IosSnapshotComparisonIdentity = Readonly<{
|
|
173
|
+
producer: IosSnapshotProducer;
|
|
174
|
+
intent: IosAcquisitionIntent;
|
|
175
|
+
lineage: IosSnapshotLineage;
|
|
176
|
+
presentationKey: IosSnapshotPresentationKey;
|
|
177
|
+
residue: readonly IosAcquisitionResidue[];
|
|
178
|
+
}>;
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region packages/contracts/src/interactor-types.d.ts
|
|
181
|
+
type RunnerContext = {
|
|
182
|
+
requestId?: string;
|
|
183
|
+
signal?: AbortSignal;
|
|
184
|
+
appBundleId?: string;
|
|
185
|
+
verbose?: boolean;
|
|
186
|
+
logPath?: string;
|
|
187
|
+
traceLogPath?: string;
|
|
188
|
+
iosXctestrunFile?: string;
|
|
189
|
+
iosXctestDerivedDataPath?: string;
|
|
190
|
+
iosXctestEnvDir?: string;
|
|
191
|
+
runnerLeaseContext?: RunnerLogicalLeaseContext;
|
|
192
|
+
};
|
|
193
|
+
type ScreenshotOptions = {
|
|
194
|
+
appBundleId?: string;
|
|
195
|
+
pixelDensity?: number;
|
|
196
|
+
fullscreen?: boolean;
|
|
197
|
+
normalizeStatusBar?: boolean;
|
|
198
|
+
stabilize?: boolean;
|
|
199
|
+
surface?: SessionSurface;
|
|
200
|
+
skipIosSimulatorBootCheck?: boolean;
|
|
201
|
+
captureBackend?: 'runner';
|
|
202
|
+
};
|
|
203
|
+
type ElementSelectorKey = 'id' | 'label' | 'text' | 'value';
|
|
204
|
+
type ElementSelectorTapOptions = {
|
|
205
|
+
key: ElementSelectorKey;
|
|
206
|
+
value: string;
|
|
207
|
+
allowNonHittableCoordinateFallback?: boolean;
|
|
208
|
+
expectedPoint?: Point;
|
|
209
|
+
};
|
|
210
|
+
type PressPointOptions = Readonly<{
|
|
211
|
+
button: 'primary' | 'secondary' | 'middle';
|
|
212
|
+
count: number;
|
|
213
|
+
intervalMs: number;
|
|
214
|
+
holdMs: number;
|
|
215
|
+
jitterPx: number;
|
|
216
|
+
doubleTap: boolean;
|
|
217
|
+
surface?: SessionSurface;
|
|
218
|
+
}>;
|
|
219
|
+
/**
|
|
220
|
+
* The channel the XCTest runner actually entered text through — the Swift
|
|
221
|
+
* `TextEntryResult.textEntryRoute` (RunnerTests+TextTyping.swift,
|
|
222
|
+
* RunnerTests+SynthesizedTextEntry.swift). Closed set, because the runner is
|
|
223
|
+
* its only producer and the boundary that narrows it
|
|
224
|
+
* (readTypeTextBackendResult, packages/platform-apple/src/interactions.ts) drops a
|
|
225
|
+
* route it cannot name — so a Swift-side addition would silently vanish. The
|
|
226
|
+
* route-parity test in packages/platform-apple/src/core/__tests__/interactions.test.ts
|
|
227
|
+
* reads the Swift sources and fails instead.
|
|
228
|
+
*/
|
|
229
|
+
declare const TEXT_ENTRY_ROUTES: readonly ['xctest-element', 'synthesized-first-responder', 'synthesized-first-responder-replacement', 'xctest-application-fallback'];
|
|
230
|
+
type TextEntryRoute = (typeof TEXT_ENTRY_ROUTES)[number];
|
|
231
|
+
/**
|
|
232
|
+
* What `Interactor.type` reports back about the entry it performed. Only the
|
|
233
|
+
* Apple runner populates it; every other platform types blind and returns void.
|
|
234
|
+
*/
|
|
235
|
+
type TypeTextBackendResult = {
|
|
236
|
+
textEntryRoute?: TextEntryRoute;
|
|
237
|
+
};
|
|
238
|
+
type SnapshotOptions = SnapshotOptions$1 & {
|
|
239
|
+
appBundleId?: string;
|
|
240
|
+
signal?: AbortSignal;
|
|
241
|
+
includeRects?: boolean;
|
|
242
|
+
includeHiddenContentHints?: boolean;
|
|
243
|
+
surface?: SessionSurface;
|
|
244
|
+
/** Internal capture purpose; action outcomes always require the full tree. */
|
|
245
|
+
acquisitionIntent?: 'full' | 'surface-observation';
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* Android's live IME status read. Optional on {@link Interactor}: parity with the retired leaf,
|
|
249
|
+
* which refused `status`/`get` on every other family (no other platform's runner exposes one).
|
|
250
|
+
* A single-member discriminated union rather than a bare object so the daemon can derive its wire
|
|
251
|
+
* `platform` label from `kind` the same way it does for dismiss and enter — an owner can only ever
|
|
252
|
+
* produce its own result shape.
|
|
253
|
+
*/
|
|
254
|
+
type KeyboardStatusResult = Readonly<{
|
|
255
|
+
kind: 'ime-probe';
|
|
256
|
+
visible: boolean;
|
|
257
|
+
inputType?: string;
|
|
258
|
+
type?: string;
|
|
259
|
+
inputMethodPackage?: string;
|
|
260
|
+
focusedPackage?: string;
|
|
261
|
+
focusedResourceId?: string;
|
|
262
|
+
inputOwner?: string;
|
|
263
|
+
}>;
|
|
264
|
+
/**
|
|
265
|
+
* Owner-shaped dismiss evidence, discriminated by which owner produced it: Android's IME probe
|
|
266
|
+
* fields, or iOS's `mechanism` disclosure (#1598), or HarmonyOS's bare acknowledgment (its HDC
|
|
267
|
+
* key press reports nothing beyond success). The daemon derives the wire `platform` label from
|
|
268
|
+
* `kind` rather than re-deriving it from the device, so an owner can only ever produce its own
|
|
269
|
+
* result shape — an android-probe result under an `ios` label is unrepresentable.
|
|
270
|
+
*/
|
|
271
|
+
type KeyboardDismissResult = Readonly<{
|
|
272
|
+
kind: 'ime-probe';
|
|
273
|
+
attempts?: number;
|
|
274
|
+
wasVisible?: boolean;
|
|
275
|
+
dismissed?: boolean;
|
|
276
|
+
visible?: boolean;
|
|
277
|
+
inputType?: string;
|
|
278
|
+
type?: string;
|
|
279
|
+
inputMethodPackage?: string;
|
|
280
|
+
focusedPackage?: string;
|
|
281
|
+
focusedResourceId?: string;
|
|
282
|
+
inputOwner?: string;
|
|
283
|
+
}> | Readonly<{
|
|
284
|
+
kind: 'mechanism';
|
|
285
|
+
wasVisible?: boolean;
|
|
286
|
+
dismissed?: boolean;
|
|
287
|
+
visible?: boolean;
|
|
288
|
+
mechanism?: string;
|
|
289
|
+
}> | Readonly<{
|
|
290
|
+
kind: 'acknowledged';
|
|
291
|
+
}>;
|
|
292
|
+
/**
|
|
293
|
+
* Only the Apple runner echoes visibility around the return-key press; Android and HarmonyOS
|
|
294
|
+
* acknowledge with no fields beyond success. Kind is owner-specific, not just content-shaped —
|
|
295
|
+
* Android's and HarmonyOS's acknowledgments are structurally identical, so only the discriminant
|
|
296
|
+
* itself tells the daemon which owner actually pressed enter.
|
|
297
|
+
*/
|
|
298
|
+
type KeyboardEnterResult = Readonly<{
|
|
299
|
+
kind: 'visibility-echo';
|
|
300
|
+
visible?: boolean;
|
|
301
|
+
wasVisible?: boolean;
|
|
302
|
+
}> | Readonly<{
|
|
303
|
+
kind: 'android-acknowledged';
|
|
304
|
+
}> | Readonly<{
|
|
305
|
+
kind: 'harmonyos-acknowledged';
|
|
306
|
+
}>;
|
|
307
|
+
/**
|
|
308
|
+
* Every acquisition carries its provenance pair atomically: the channel alone cannot say who
|
|
309
|
+
* acquired the tree or which guarantees it carries, and `SnapshotProvenance`
|
|
310
|
+
* (`@agent-device/kernel/snapshot`) makes a cross-channel `backend`/`producer` combination
|
|
311
|
+
* fail to compile.
|
|
312
|
+
*/
|
|
313
|
+
type SnapshotResult = Omit<BackendSnapshotResult, 'backend' | 'nodes'> & {
|
|
314
|
+
nodes?: RawSnapshotNode[];
|
|
315
|
+
comparisonIdentity?: IosSnapshotComparisonIdentity;
|
|
316
|
+
/**
|
|
317
|
+
* Set when the capture describes an in-place iOS system surface (a web sign-in sheet) presented
|
|
318
|
+
* over the session app rather than the app itself (#2438).
|
|
319
|
+
*/
|
|
320
|
+
systemSurface?: IosSystemSurfaceProvenance;
|
|
321
|
+
/**
|
|
322
|
+
* The keyboard band the producer measured while capturing, when it can measure one (#2660). A
|
|
323
|
+
* producer that publishes nothing measured nothing, so the tap-path guard keeps deriving the band
|
|
324
|
+
* from `nodes`; see {@link SnapshotKeyboardBandFact}.
|
|
325
|
+
*/
|
|
326
|
+
keyboard?: SnapshotKeyboardBandFact;
|
|
327
|
+
/**
|
|
328
|
+
* Set when this capture's own command had to bring the session app back to the foreground, i.e.
|
|
329
|
+
* something else held it and an earlier observation described that instead (#2682).
|
|
330
|
+
*/
|
|
331
|
+
targetActivation?: IosTargetActivation;
|
|
332
|
+
} & SnapshotProvenance;
|
|
333
|
+
type SnapshotRuntimeAcquiredResult = Readonly<{
|
|
334
|
+
stage: 'acquired';
|
|
335
|
+
acquisition: IosSnapshotAcquisitionFacts & Readonly<{
|
|
336
|
+
producer: IosAcquisitionProducer;
|
|
337
|
+
}>;
|
|
338
|
+
}>;
|
|
339
|
+
type SnapshotRuntimeResult = SnapshotResult | SnapshotRuntimeAcquiredResult;
|
|
340
|
+
type Interactor = {
|
|
341
|
+
open(app: string, options?: {
|
|
342
|
+
activity?: string;
|
|
343
|
+
appBundleId?: string;
|
|
344
|
+
launchConsole?: string;
|
|
345
|
+
launchArgs?: string[];
|
|
346
|
+
terminateRunningApp?: boolean;
|
|
347
|
+
url?: string;
|
|
348
|
+
}): Promise<void>;
|
|
349
|
+
openDevice(): Promise<void>;
|
|
350
|
+
close(app: string): Promise<void>;
|
|
351
|
+
tap(x: number, y: number): Promise<Record<string, unknown> | void>;
|
|
352
|
+
/** Complete point-press semantics for owners with fused series, alternate buttons, or surfaces. */
|
|
353
|
+
pressPoint?(point: Point, options: PressPointOptions): Promise<Record<string, unknown> | void>;
|
|
354
|
+
/** Alternate mouse buttons for owners that otherwise use the shared point-press series. */
|
|
355
|
+
alternateClick?(point: Point, button: 'secondary' | 'middle'): Promise<Record<string, unknown> | void>;
|
|
356
|
+
/** Owner-native ref routes; currently the managed web runtime is their only local owner. */
|
|
357
|
+
tapRef?(ref: string): Promise<Record<string, unknown> | void>;
|
|
358
|
+
tapElementSelector?(selector: ElementSelectorTapOptions): Promise<Record<string, unknown> | void>;
|
|
359
|
+
/**
|
|
360
|
+
* Fused double-click for owners that have one. The shared `--count` series cannot stand in for it —
|
|
361
|
+
* it spaces and jitters independent presses rather than firing one pair the target reads as a
|
|
362
|
+
* double — so an owner with no such mechanic leaves this undefined and `press --double` reports the
|
|
363
|
+
* gap instead of resolving a denial.
|
|
364
|
+
*/
|
|
365
|
+
doubleTap?(x: number, y: number): Promise<Record<string, unknown> | void>;
|
|
366
|
+
longPress(x: number, y: number, durationMs?: number): Promise<Record<string, unknown> | void>;
|
|
367
|
+
/**
|
|
368
|
+
* Move the pointer to a point without pressing. Only pointer-driven
|
|
369
|
+
* platforms (web today) implement it; touch platforms have no hover state
|
|
370
|
+
* and leave it undefined, which the `hover` command reports as unsupported.
|
|
371
|
+
*/
|
|
372
|
+
hover?(x: number, y: number): Promise<Record<string, unknown> | void>;
|
|
373
|
+
hoverRef?(ref: string): Promise<Record<string, unknown> | void>;
|
|
374
|
+
focus(x: number, y: number): Promise<Record<string, unknown> | void>;
|
|
375
|
+
type(text: string, delayMs?: number): Promise<TypeTextBackendResult | void>;
|
|
376
|
+
/**
|
|
377
|
+
* Replace the target's text with `text`. The empty string is the clear request (#2063), not a
|
|
378
|
+
* no-op: an implementation must empty the field or fail — never report success over an
|
|
379
|
+
* untouched value. A backend with no clear mechanism refuses the empty text up front (see the
|
|
380
|
+
* webdriver interactor).
|
|
381
|
+
*/
|
|
382
|
+
fill(x: number, y: number, text: string, delayMs?: number, options?: {
|
|
383
|
+
allowNonHittableCoordinateFallback?: boolean;
|
|
384
|
+
}): Promise<Record<string, unknown> | void>;
|
|
385
|
+
fillRef?(ref: string, text: string, delayMs?: number): Promise<Record<string, unknown> | void>;
|
|
386
|
+
scroll(direction: ScrollDirection, options?: ScrollExecutionOptions): Promise<Record<string, unknown> | void>;
|
|
387
|
+
screenshot(outPath: string, options?: ScreenshotOptions): Promise<void>;
|
|
388
|
+
setViewport?(width: number, height: number): Promise<Record<string, unknown> | void>;
|
|
389
|
+
snapshot(options?: SnapshotOptions): Promise<SnapshotRuntimeResult>;
|
|
390
|
+
/**
|
|
391
|
+
* Native reading of the live text at a point, when the backend has one. Answers the text the
|
|
392
|
+
* owner can see right now, which can exceed what an already-captured node carries (an editable
|
|
393
|
+
* field whose value is longer than its label). Optional: a backend without it leaves the
|
|
394
|
+
* captured tree as the complete answer.
|
|
395
|
+
*/
|
|
396
|
+
readTextAtPoint?(point: Point, options?: {
|
|
397
|
+
appBundleId?: string;
|
|
398
|
+
surface?: SessionSurface;
|
|
399
|
+
signal?: AbortSignal;
|
|
400
|
+
}): Promise<string | undefined>;
|
|
401
|
+
/**
|
|
402
|
+
* Native text-presence reading, when the backend has one that does not require a tree capture.
|
|
403
|
+
* A `true` answer is authoritative; anything else means "not proven here" and the caller
|
|
404
|
+
* consults the canonical tree (see `FindTextResult`).
|
|
405
|
+
*/
|
|
406
|
+
findText?(text: string, options?: {
|
|
407
|
+
appBundleId?: string;
|
|
408
|
+
signal?: AbortSignal;
|
|
409
|
+
}): Promise<{
|
|
410
|
+
found: boolean;
|
|
411
|
+
}>;
|
|
412
|
+
gestureViewport?(): Promise<Rect>;
|
|
413
|
+
back(mode?: BackMode): Promise<void>;
|
|
414
|
+
/**
|
|
415
|
+
* Optional (parity with `actionButton`): opens the springboard, a control not every owner
|
|
416
|
+
* carries. An owner without it leaves it undefined; its fact refuses the press before binding,
|
|
417
|
+
* and the system-button binder fails closed rather than resolving an absent member as a
|
|
418
|
+
* successful no-op.
|
|
419
|
+
*/
|
|
420
|
+
home?(): Promise<void>;
|
|
421
|
+
setOrientation(orientation: DeviceRotation): Promise<{
|
|
422
|
+
orientation?: DeviceRotation;
|
|
423
|
+
} | void>;
|
|
424
|
+
performGesture?(plan: GesturePlan): Promise<Record<string, unknown> | void>;
|
|
425
|
+
/**
|
|
426
|
+
* Optional (parity with `home`): opens the recents surface, a control not every owner carries.
|
|
427
|
+
* An owner without it leaves it undefined; its fact refuses the press before binding, and the
|
|
428
|
+
* system-button binder fails closed rather than resolving an absent member as a successful
|
|
429
|
+
* no-op.
|
|
430
|
+
*/
|
|
431
|
+
appSwitcher?(): Promise<void>;
|
|
432
|
+
/**
|
|
433
|
+
* Optional (parity with `home`): presses one TV remote key, a control only TV-capable owners
|
|
434
|
+
* carry. An owner without it leaves it undefined; its fact refuses the press before binding,
|
|
435
|
+
* and the TV remote binder fails closed rather than resolving an absent member as a silent
|
|
436
|
+
* no-op.
|
|
437
|
+
*/
|
|
438
|
+
tvRemote?(button: TvRemoteButton, durationMs?: number): Promise<void>;
|
|
439
|
+
/**
|
|
440
|
+
* Optional (parity with `keyboardDismiss`): presses the iPhone/iPad Action Button, hardware only
|
|
441
|
+
* the Apple owner carries. An owner without the button leaves it undefined; its fact refuses the
|
|
442
|
+
* press before binding, and the system-button binder fails closed rather than resolving an
|
|
443
|
+
* absent member as a successful no-op.
|
|
444
|
+
*/
|
|
445
|
+
actionButton?(): Promise<void>;
|
|
446
|
+
/** Optional: only Android implements a live status read (see {@link KeyboardStatusResult}). */
|
|
447
|
+
keyboardStatus?(): Promise<KeyboardStatusResult>;
|
|
448
|
+
/** Optional: platforms with no keyboard-dismiss concept leave it undefined. */
|
|
449
|
+
keyboardDismiss?(): Promise<KeyboardDismissResult>;
|
|
450
|
+
/** Optional: platforms with no keyboard-return concept leave it undefined. */
|
|
451
|
+
keyboardEnter?(): Promise<KeyboardEnterResult>;
|
|
452
|
+
/**
|
|
453
|
+
* Optional (parity with `readSetting`): the owner's pasteboard read. An owner with no clipboard
|
|
454
|
+
* surface leaves both halves undefined; its fact refuses the half before binding, and the
|
|
455
|
+
* clipboard binder fails closed rather than resolving an absent member as an empty answer.
|
|
456
|
+
*/
|
|
457
|
+
readClipboard?(): Promise<string>;
|
|
458
|
+
/**
|
|
459
|
+
* Optional (parity with `readClipboard`): the owner's pasteboard write, with the same
|
|
460
|
+
* fact-then-guard contract as the read.
|
|
461
|
+
*/
|
|
462
|
+
writeClipboard?(text: string): Promise<void>;
|
|
463
|
+
setSetting(setting: string, state: string, appId?: string, options?: SettingOptions): Promise<Record<string, unknown> | void>;
|
|
464
|
+
/**
|
|
465
|
+
* Optional: reads back the value a device holds for one readable setting. The name is narrowed to
|
|
466
|
+
* `READABLE_SETTINGS`, which is not every setting the write switch serves, and an owner's dispatch
|
|
467
|
+
* is exhaustive over it — a setting joins the list only with an owner that answers it. An owner with
|
|
468
|
+
* no read path leaves the member undefined; its fact refuses the read before binding, so an absent
|
|
469
|
+
* method can never resolve into an empty answer.
|
|
470
|
+
*/
|
|
471
|
+
readSetting?(setting: ReadableSetting): Promise<ReadSettingResult>;
|
|
472
|
+
/**
|
|
473
|
+
* The four alert legs. Each owner runs its own observation and, where it needs one, its own
|
|
474
|
+
* poll: an alert is a transient device surface, and how long to look for it — and how to press
|
|
475
|
+
* its buttons — is family mechanics, not something a caller can supply. `timeoutMs` is the
|
|
476
|
+
* whole window the caller allows; the owner spends it however its backend requires.
|
|
477
|
+
*
|
|
478
|
+
* Optional: an owner with no alert surface leaves all four undefined. Its facts refuse every leg
|
|
479
|
+
* before binding, so the absent members are never resolved, and a fact that admitted a leg the
|
|
480
|
+
* interactor cannot serve fails closed instead of answering empty.
|
|
481
|
+
*/
|
|
482
|
+
readAlert?(options?: AlertInteractorOptions): Promise<Record<string, unknown>>;
|
|
483
|
+
awaitAlert?(options?: AlertInteractorOptions): Promise<Record<string, unknown>>;
|
|
484
|
+
acceptAlert?(options?: AlertInteractorOptions): Promise<Record<string, unknown>>;
|
|
485
|
+
dismissAlert?(options?: AlertInteractorOptions): Promise<Record<string, unknown>>;
|
|
486
|
+
};
|
|
487
|
+
/**
|
|
488
|
+
* The session-derived target one alert leg acts on. `appBundleId` is separate from the runner
|
|
489
|
+
* context's because the macOS helper reads a frontmost-app surface with no bundle at all, and
|
|
490
|
+
* the two must not collapse into one field that means both.
|
|
491
|
+
*/
|
|
492
|
+
type AlertInteractorOptions = {
|
|
493
|
+
timeoutMs?: number;
|
|
494
|
+
appBundleId?: string;
|
|
495
|
+
surface?: SessionSurface;
|
|
496
|
+
};
|
|
497
|
+
//#endregion
|
|
67
498
|
//#region packages/contracts/src/provider-device-runtime.d.ts
|
|
68
499
|
type ProviderDeviceInstallResult = {
|
|
69
500
|
bundleId?: string;
|
package/dist/src/linux.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as e}from"./sdk-contracts.js";import{c as t}from"./diagnostics.js";import"./diagnostics2.js";import{a as n}from"./gesture-plan.js";import{S as r,_ as i,a,b as o,d as s,f as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y,v as b,x}from"./src5.js";function S(){
|
|
1
|
+
import{D as e}from"./sdk-contracts.js";import{c as t}from"./diagnostics.js";import"./diagnostics2.js";import{a as n}from"./gesture-plan.js";import{S as r,_ as i,a,b as o,d as s,f as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y,v as b,x}from"./src5.js";function S(){return{open:e=>s(e),openDevice:()=>Promise.resolve(),close:e=>g(e),tap:(e,t)=>c(e,t),alternateClick:async(e,t)=>t===`secondary`?await l(e.x,e.y):await y(e.x,e.y),doubleTap:(e,t)=>u(e,t),longPress:(e,t,n)=>d(e,t,n),focus:(e,t)=>m(e,t),type:(e,t)=>x(e,t),fill:(e,t,n,r)=>a(e,t,n,r),scroll:(e,t)=>b(e,t),performGesture:async t=>{if(t.topology===`two`)throw new e(`UNSUPPORTED_OPERATION`,`Multi-touch gestures are not supported on Linux`);let{start:r,end:i}=n(t);await o(r.x,r.y,i.x,i.y,t.durationMs)},screenshot:(e,t)=>i(e,t),readTextAtPoint:async(e,t)=>await f(e.x,e.y,t?.surface),snapshot:async e=>await t(`snapshot_capture`,async()=>await p(e,e?.signal),{backend:`linux-atspi`}),back:()=>v(),home:()=>_(),setOrientation:()=>{throw new e(`UNSUPPORTED_OPERATION`,`orientation not supported on Linux`)},appSwitcher:()=>{throw new e(`UNSUPPORTED_OPERATION`,`appSwitcher not yet supported on Linux`)},tvRemote:()=>{throw new e(`UNSUPPORTED_OPERATION`,`tv-remote not supported on Linux`)},readClipboard:()=>h(),writeClipboard:e=>r(e),setSetting:()=>{throw new e(`UNSUPPORTED_OPERATION`,`setSetting not supported on Linux`)}}}export{S as createLinuxInteractor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{tn as e}from"./sdk-batch.js";import{
|
|
1
|
+
import{tn as e}from"./sdk-batch.js";import{E as t,K as n,L as r,O as i,P as a,j as o}from"./alert-runtime.js";import{t as s}from"./touch-runtime.js";import{t as c}from"./interactor-operation-catalog.js";function l(l){let{facts:u,pause:d}=l,f={device:l.device,signal:l.signal,resolveInteractor:l.resolveInteractor};return{...u.captureScreenshot.available?n(f):{},...u.focusPoint.available?r(f):{},...a({...f,facts:u}),...u.scrollDirection.available?o(f):{},...u.typeText.available?i(f):{},...u.readTextAtPoint.available?t(f):{},...e(u.tapPoint,()=>s({...f,facts:u,pause:d})),...c({...f,facts:u})}}export{l as t};
|
package/dist/src/macos-facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{i as e,r as t,s as n}from"./helper.js";import{t as r}from"./surface-snapshot.js";export{r as captureMacOsSurfaceSnapshot,t as resolveFrontmostMacOsApp,e as runMacOsAlertAction,n as startMacOsAudioProbeProcess};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as e}from"./sdk-contracts.js";import{
|
|
1
|
+
import{D as e}from"./sdk-contracts.js";import{A as t,D as n}from"./sdk-device.js";import{t as r}from"./scoped-provider.js";const i=r(void 0);function a(){return i.resolve()}async function o(e,t){return await i.run(e,t)}function s(r,i){if(!t(n(r.device),n(i))||r.device.simulatorSetPath!==i.simulatorSetPath)throw new e(`COMMAND_FAILED`,`Managed automation cannot select another device.`,{reason:`managed-device-transport-mismatch`})}function c(){let e=a();if(e)return async t=>{s(e,t)}}async function l(e){let t=c();return t?(await t(e),!0):!1}export{o as a,c as i,a as n,l as r,s as t};
|