agent-device 0.21.23 → 0.21.24
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/README.md +6 -6
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.23.apk → agent-device-android-ime-helper-0.21.24.apk} +0 -0
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.24.apk.sha256 +1 -0
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.23.manifest.json → agent-device-android-ime-helper-0.21.24.manifest.json} +4 -4
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.23.apk → agent-device-android-snapshot-helper-0.21.24.apk} +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.24.apk.sha256 +1 -0
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.23.manifest.json → agent-device-android-snapshot-helper-0.21.24.manifest.json} +6 -6
- package/apple/macos-helper/Sources/AgentDeviceMacOSHelper/SnapshotTraversal.swift +12 -6
- package/apple/macos-helper/Tests/AgentDeviceMacOSHelperTests/RectResponseTests.swift +21 -0
- package/apple/snapshot-bridge/README.md +9 -7
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandDispatch.swift +56 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +14 -5
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +8 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +12 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCaptureTarget.swift +1 -1
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotExecution.swift +29 -5
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +34 -10
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryFocus.swift +19 -5
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextTyping.swift +3 -3
- package/dist/src/adapter.js +1 -1
- package/dist/src/adb.js +1 -1
- package/dist/src/agent-browser-lifecycle.js +1 -1
- package/dist/src/agent-browser-process-record.js +1 -1
- package/dist/src/agent-browser-provider.js +1 -1
- package/dist/src/agent-device-client.js +2 -2
- package/dist/src/alert-runtime.js +1 -1
- package/dist/src/alert.js +1 -1
- package/dist/src/android-adb.d.ts +3 -2
- package/dist/src/android-input-ownership.js +1 -1
- package/dist/src/app-backend.js +1 -1
- package/dist/src/app-inventory.d.ts +4 -0
- package/dist/src/app-launch.js +1 -1
- package/dist/src/app-lifecycle.js +1 -1
- package/dist/src/app-log-runtime2.js +3 -3
- package/dist/src/app-resolution.js +2 -2
- package/dist/src/app-state-runtime.d.ts +15 -0
- package/dist/src/apple-runner-platform.js +1 -1
- package/dist/src/application-lifecycle-interaction.js +1 -1
- package/dist/src/aws-device-farm-connection.js +1 -0
- package/dist/src/back-mode.js +1 -1
- package/dist/src/backend-snapshot-options.js +1 -1
- package/dist/src/browserstack-connection.js +1 -0
- package/dist/src/browserstack-device-features.js +1 -0
- package/dist/src/browserstack.js +1 -0
- package/dist/src/cache.js +1 -1
- package/dist/src/cli-config.js +1 -1
- package/dist/src/cli-help.js +35 -19
- package/dist/src/cli-runner.js +1 -1
- package/dist/src/cli.js +3 -4
- package/dist/src/client-companion-tunnel.js +1 -0
- package/dist/src/client-metro-companion.js +1 -1
- package/dist/src/client-metro.js +1 -1
- package/dist/src/client-types.d.ts +7 -5
- package/dist/src/cloud-artifacts.d.ts +3 -2
- package/dist/src/command-metadata.js +1 -1
- package/dist/src/command-schema.js +1 -1
- package/dist/src/command-tools.js +2 -2
- package/dist/src/connection-runtime.js +1 -1
- package/dist/src/connection-verification.js +1 -0
- package/dist/src/connection.js +5 -5
- package/dist/src/contracts.d.ts +1 -1
- package/dist/src/daemon-client-lease-beat.js +1 -1
- package/dist/src/daemon-client-lifecycle.js +1 -1
- package/dist/src/daemon-client-transport.js +1 -1
- package/dist/src/daemon-http.js +1 -1
- package/dist/src/daemon-policy-file.js +1 -1
- package/dist/src/daemon-registration-owner.js +1 -1
- package/dist/src/device-claim-inspection.js +1 -1
- package/dist/src/device-input-state.d.ts +2 -15
- package/dist/src/device-readiness-runtime.js +1 -1
- package/dist/src/device-selection-resolver.js +1 -1
- package/dist/src/device.js +1 -1
- package/dist/src/device2.js +1 -1
- package/dist/src/device3.js +1 -1
- package/dist/src/dispatch-resolve.js +3 -3
- package/dist/src/doctor-facade.js +1 -1
- package/dist/src/durable-capture-resource.js +1 -1
- package/dist/src/durable-resource.js +1 -1
- package/dist/src/exec.js +1 -1
- package/dist/src/file.js +1 -1
- package/dist/src/find.js +1 -1
- package/dist/src/finders.js +1 -1
- package/dist/src/format.js +2 -1
- package/dist/src/gesture-admission.js +1 -1
- package/dist/src/gesture-plan-types.d.ts +2 -5
- package/dist/src/gesture-runtime.js +1 -1
- package/dist/src/human-control.js +1 -1
- package/dist/src/ime-rebind.js +1 -1
- package/dist/src/ime-settings-record.js +1 -0
- package/dist/src/ime-state.js +1 -1
- package/dist/src/index.d.ts +3 -3
- package/dist/src/input-actions.js +1 -1
- package/dist/src/input-actions2.js +1 -1
- package/dist/src/install-source2.js +1 -1
- package/dist/src/interaction-positionals.js +1 -1
- package/dist/src/interaction-ref-policy.js +1 -1
- package/dist/src/interaction.js +1 -1
- package/dist/src/interaction2.js +1 -1
- package/dist/src/interactor.js +5 -5
- package/dist/src/interactors.js +1 -1
- package/dist/src/internal/bin.js +1 -1
- package/dist/src/internal/daemon.js +1 -1
- package/dist/src/inventory2.js +1 -1
- package/dist/src/ios-snapshot-acquisition.js +1 -1
- package/dist/src/ios-snapshot-engine.js +1 -1
- package/dist/src/ios-snapshot-runtime.js +1 -1
- package/dist/src/launch-confirmation.js +1 -1
- package/dist/src/lease-scope.js +1 -1
- package/dist/src/lease.js +1 -1
- package/dist/src/limrun.d.ts +4 -555
- package/dist/src/load.js +1 -1
- package/dist/src/local-interactor-operation-set.js +1 -1
- package/dist/src/managed-device-scope.js +1 -1
- package/dist/src/manifest.js +1 -0
- package/dist/src/mechanics.js +16 -16
- package/dist/src/mobile-snapshot-semantics.js +1 -1
- package/dist/src/observation.js +1 -2
- package/dist/src/overlay.js +3 -3
- package/dist/src/owner-identity.js +3 -3
- package/dist/src/perf-facade.js +1 -1
- package/dist/src/perf-runtime-plan.js +1 -1
- package/dist/src/perf-target.js +1 -1
- package/dist/src/physical-device-control.js +1 -1
- package/dist/src/platform-request-scope.js +1 -1
- package/dist/src/platform-runtime-open-target.js +1 -1
- package/dist/src/platform-runtime-operation-host.js +4 -4
- package/dist/src/platform-runtime-runtime-hints.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/plugin.js +1 -0
- package/dist/src/plugins/webdriver.d.ts +111 -0
- package/dist/src/plugins/webdriver.js +1 -0
- package/dist/src/plugins.d.ts +2 -1
- package/dist/src/plugins2.js +1 -1
- package/dist/src/process-exit.js +1 -1
- package/dist/src/process.js +1 -1
- package/dist/src/provider-credential-fingerprint.js +1 -1
- package/dist/src/provider-device-admission.js +1 -1
- package/dist/src/provider-device-runtime.d.ts +556 -0
- package/dist/src/provider-policy.js +1 -0
- package/dist/src/provider-profile-fields.js +1 -1
- package/dist/src/provider-webdriver.js +1 -2
- package/dist/src/providers.js +1 -1
- package/dist/src/react-devtools.js +2 -0
- package/dist/src/react-native.js +1 -1
- package/dist/src/record-runtime.js +1 -1
- package/dist/src/record-trace.js +1 -1
- package/dist/src/recording.js +1 -1
- package/dist/src/registry.js +24 -24
- package/dist/src/remote-bridge.js +1 -0
- package/dist/src/remote-config-core.js +1 -0
- package/dist/src/remote-config.js +1 -1
- package/dist/src/remote-config2.js +1 -1
- package/dist/src/remote-connection-state.js +1 -0
- package/dist/src/replay.js +2 -2
- package/dist/src/request-admission.js +1 -1
- package/dist/src/request-runtime-binding.js +1 -1
- package/dist/src/result-serialization.js +1 -1
- package/dist/src/retry.js +1 -1
- package/dist/src/retry2.js +1 -0
- package/dist/src/runner-artifact-manifest.js +1 -1
- package/dist/src/runner-cache-metadata.js +2 -3
- package/dist/src/runner-cache-retention.js +1 -0
- package/dist/src/runner-cache-trim.js +1 -0
- 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-device-set.js +1 -0
- package/dist/src/runner-disposal.js +1 -1
- package/dist/src/runner-error-classification.js +1 -1
- package/dist/src/runner-exchange.js +1 -1
- package/dist/src/runner-lease.js +1 -0
- package/dist/src/runner-operations-facade.js +1 -1
- package/dist/src/runner-session-types.js +1 -1
- package/dist/src/runner-start-budget.js +1 -1
- package/dist/src/runner-toolchain-probe.js +2 -0
- package/dist/src/runner.js +1 -1
- package/dist/src/runtime-deployment.js +1 -0
- package/dist/src/runtime.js +1 -1
- package/dist/src/runtime10.js +1 -2
- package/dist/src/runtime11.js +2 -0
- package/dist/src/runtime2.js +2 -5
- package/dist/src/runtime3.js +5 -1
- package/dist/src/runtime4.js +1 -5
- package/dist/src/runtime5.js +5 -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-transport.js +1 -1
- package/dist/src/screenshot-density.js +1 -1
- package/dist/src/screenshot3.js +2 -2
- package/dist/src/script.js +1 -1
- package/dist/src/scroll-gesture.js +1 -1
- package/dist/src/sdk-batch.js +2 -2
- package/dist/src/sdk-contracts.d.ts +20 -29
- package/dist/src/sdk-contracts.js +2 -2
- package/dist/src/sdk-device.js +1 -1
- package/dist/src/sdk-finders.d.ts +1 -1
- package/dist/src/sdk-finders.js +1 -1
- package/dist/src/sdk-remote-config.d.ts +4 -0
- package/dist/src/sdk-remote-config.js +1 -1
- package/dist/src/sdk-selectors.d.ts +1 -1
- package/dist/src/sdk-selectors.js +1 -1
- package/dist/src/selection.js +0 -0
- package/dist/src/selector-pipeline-policy.js +1 -1
- package/dist/src/selector-runtime.js +1 -1
- package/dist/src/selectors.js +1 -1
- package/dist/src/server.js +2 -2
- package/dist/src/session-snapshot.js +1 -1
- package/dist/src/session2.js +5 -5
- package/dist/src/simctl.js +1 -1
- package/dist/src/simulator-boot.js +1 -1
- package/dist/src/simulator-state.js +1 -1
- package/dist/src/simulator.js +1 -1
- package/dist/src/snapshot-capture-annotations.js +1 -1
- package/dist/src/snapshot-desktop-projection.js +1 -1
- package/dist/src/snapshot-private-evidence.js +1 -0
- 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/src2.js +1 -1
- package/dist/src/src3.js +1 -1
- package/dist/src/src4.js +1 -1
- package/dist/src/src5.js +1 -1
- package/dist/src/src6.js +1 -1
- package/dist/src/src7.js +1 -1
- package/dist/src/src8.js +20 -20
- package/dist/src/store.js +1 -1
- package/dist/src/target-evidence.js +1 -1
- package/dist/src/text-entry-focus.js +1 -1
- package/dist/src/tool-provider2.js +1 -1
- package/dist/src/touch-runtime2.js +1 -1
- package/dist/src/tree.js +1 -1
- package/dist/src/type-text-runtime.js +1 -1
- package/dist/src/video.js +1 -1
- package/package.json +15 -10
- package/server.json +2 -2
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.23.apk.sha256 +0 -1
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.23.apk.sha256 +0 -1
- package/dist/src/capabilities.js +0 -1
- package/dist/src/compatibility-policy.js +0 -1
- package/dist/src/daemon-artifacts.js +0 -1
- package/dist/src/device-claim-rule.js +0 -1
- package/dist/src/human-control-contract.js +0 -1
- package/dist/src/prepare-kind.js +0 -1
- package/dist/src/provider-device-runtimes.js +0 -1
- package/dist/src/screen-recording-admission-ledger.js +0 -1
- package/dist/src/screenshot-runtime.js +0 -1
- package/dist/src/session-routing.js +0 -1
- package/dist/src/session-runtime-admission.js +0 -1
- package/dist/src/timeouts.js +0 -1
- package/dist/src/touch-reference-frame.js +0 -1
- package/dist/src/vars.js +0 -2
- package/dist/src/viewport.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as e,b as t,s as n}from"./sdk-contracts.js";import{f as r,l as i,r as a,u as o}from"./capture.js";import{O as s,p as c,w as l}from"./sdk-device.js";import{$r as u,Ir as d,It as f,Lr as p,S as m,Yr as h,b as g,ei as _,f as ee,hn as te,jr as v,l as ne,ni as re,zr as y}from"./sdk-batch.js";import{T as ie,d as ae}from"./runtime.js";import{t as oe}from"./overlay.js";import{t as se}from"./session-paths.js";import{t as b}from"./snapshot-state.js";import{c as ce,f as le,m as x,o as ue,u as S}from"./session-snapshot.js";import{t as C}from"./selector-pipeline-policy.js";import{i as w,o as T,r as de}from"./png-worker-client.js";import{t as fe}from"./png-size.js";import{r as pe,t as me}from"./screenshot-density.js";import{a as E,o as D,s as O,t as he}from"./screenshot-overlay-draw.js";import{a as ge,i as _e,n as ve,t as ye}from"./session-runtime-admission.js";import{promises as k}from"node:fs";import A from"node:os";import j from"node:path";const M=ne(ee),N=Ie(M);function P(e){return I(e)?.route??`generic`}function F(e){return I(e)?.sessionKind}function be(e){return I(e)?.leaseAdmissionExempt===!0}function xe(e){return I(e)?.appLease===`allowed`}function Se(e){return I(e)?.selectorValidationExempt!==!0}function Ce(e){return I(e)?.sessionExecutionLockExempt!==!0}function we(e){return I(e)?.replayScopedAction===!0}function Te(e){return I(e)?.allowInvalidRecording!==!0}function Ee(e){return I(e)?.saveScriptFlagOwner===!0}function De(){return M.filter(e=>e.saveScriptFlagOwner===!0).map(e=>e.command).sort()}function Oe(e){return I(e)?.lockPolicySelectorOverride===!0}function ke(e){return I(e)?.androidBlockingDialogGuard===!0}function Ae(e){if(e.command===`human_control`||e.command===`lease_heartbeat`)return!1;let t=m(e);return t===void 0?F(e.command)!==`observability`&&g(e.command)!==`observe`:t!==`observes-app`}function je(e){return I(e.command)?.preferExplicitDeviceOverExistingSession===!0}function Me(e){let t=I(e.command)?.allowSessionlessDefaultDevice;return typeof t==`function`&&t(e)}function Ne(e){return I(e.command)?.sessionlessLeaseAdmissionExemption?.(e)}function Pe(e){let t=I(e.command)?.refFrameEffect;return typeof t==`function`?t(e):t}function Fe(e,t){return t.hasExistingSession?je(e)&&t.hasExplicitDeviceIdentity?`explicit-device`:`existing-session`:Le(e)?`skip`:t.hasDeviceSelectionInput?`explicit-device`:Me(e)?`sessionless-default-device`:`skip`}function I(e){return N.descriptorsByCommand.get(e)}function Ie(e){let t=new Map;for(let n of e){if(t.has(n.command))throw Error(`Duplicate daemon command descriptor: ${n.command}`);t.set(n.command,n)}return{descriptorsByCommand:t}}function Le(e){let t=I(e.command);if(t?.route===`lease`)return!0;let n=t?.skipSessionlessProviderDevice;return typeof n==`function`&&n(e)}const L=a.pendingPixelIdentityEvidence,Re=[{target:`ios-simulator`,status:`accepted`},{target:`android-emulator`,status:`accepted`},{target:`android-device`,status:`rejected`,rejectionReason:L},{target:`macos-app-window`,status:`rejected`,rejectionReason:L},{target:`ios-physical`,status:`rejected`,rejectionReason:L},{target:`macos-helper`,status:`rejected`,rejectionReason:L},{target:`web`,status:`rejected`,rejectionReason:L},{target:`linux`,status:`rejected`,rejectionReason:L},{target:`tvos`,status:`rejected`,rejectionReason:L},{target:`harmonyos`,status:`rejected`,rejectionReason:L},{target:`vega`,status:`rejected`,rejectionReason:L}];function ze(e,t){switch(e.platform){case`apple`:return Be(e,t);case`android`:return e.kind===`device`?`android-device`:`android-emulator`;case`harmonyos`:return`harmonyos`;case`vega`:return`vega`;case`linux`:return`linux`;case`web`:return`web`}}function Be(e,t){let n=s(e);switch(n){case`ios`:case`ipados`:return e.kind===`device`?`ios-physical`:`ios-simulator`;case`tvos`:return`tvos`;case`macos`:return Ve(t);case`watchos`:case`visionos`:throw R(n)}}function Ve(e){return(e??`app`)===`app`?`macos-app-window`:`macos-helper`}function R(t,n){return new e(`UNSUPPORTED_OPERATION`,`screenshot --crop-on is not accepted on ${t} targets`,{reason:a.targetNotAccepted,...n?{rejectionReason:n}:{}})}function He(t){if(t.overlayRefs||t.fullscreen)throw new e(`INVALID_ARGS`,`--crop-on cannot be combined with --overlay-refs or --fullscreen: both move the captured frame away from the snapshot viewport the crop is measured against`,{reason:a.frameMismatch});try{te(t.cropOn)}catch{throw new e(`INVALID_ARGS`,`screenshot --crop-on requires a valid selector expression`,{reason:a.selectorInvalid})}let n=ze(t.device,t.surface),r=Re.find(e=>e.target===n);if(!r||r.status===`rejected`)throw R(n,r?.status===`rejected`?r.rejectionReason:void 0)}async function Ue(t,n){if(!We(n))throw new e(`INVALID_ARGS`,`Screenshot crop box must be positive integer pixel offsets`);let r=await de(await k.readFile(t),n,`screenshot`);r!==null&&await k.writeFile(t,r)}function We(e){return Number.isInteger(e.x)&&e.x>=0&&Number.isInteger(e.y)&&e.y>=0&&Number.isInteger(e.width)&&e.width>0&&Number.isInteger(e.height)&&e.height>0}function Ge(t){switch(t){case`android`:return`device-pixels`;case`xctest`:case`macos-helper`:return`viewport-points`;default:throw new e(`UNSUPPORTED_OPERATION`,`screenshot --crop-on does not accept snapshot backend "${t??`unknown`}"`,{reason:a.targetNotAccepted})}}function z(e,t,n,r,i){if(e===`device-pixels`||t===null)return Ye(n);let a=r/t.width,o=i/t.height;return{x:Math.round((n.x-t.x)*a),y:Math.round((n.y-t.y)*o),width:Math.round(n.width*a),height:Math.round(n.height*o)}}function Ke(e,t,n){let r=Math.max(e.x,0),i=Math.max(e.y,0),a=Math.min(e.x+e.width,t),o=Math.min(e.y+e.height,n);return a<=r||o<=i?null:{x:r,y:i,width:a-r,height:o-i}}function B(e){let t=null;for(let n of e)!v(n)||!h(n.rect)||(!t||u(n.rect)>u(t))&&(t=n.rect);return t||qe(e.filter(e=>h(e.rect)&&!Je(e)))}function qe(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)h(a.rect)&&(t=Math.min(t,a.rect.x),n=Math.min(n,a.rect.y),r=Math.max(r,a.rect.x+a.rect.width),i=Math.max(i,a.rect.y+a.rect.height));return!Number.isFinite(t)||!Number.isFinite(n)||r<=t||i<=n?null:{x:t,y:n,width:r-t,height:i-n}}function Je(e){return p(e.type??``)===`image`&&!d(e.label)}function Ye(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}const Xe=`${a.partialIntersection}: the selector frame extends past the captured image; the crop was clipped to the image frame`;function V(e){return e?.partialIntersection?[Xe]:[]}async function Ze(t){let{device:n,session:r,surface:i,cropOn:o,screenshotPath:s,logPath:c,dispatchContext:l}=t,u={snapshotInteractiveOnly:!1},d=await S({device:n,session:r,flags:u,logPath:c,snapshotScope:void 0,captureData:async()=>await t.captureSnapshot({options:{appBundleId:l.appBundleId,interactiveOnly:!1,includeRects:!0,surface:i},execution:x(l)})}),f=b(d,u);if(f.snapshotQuality?.state===`sparse`)throw new e(`COMMAND_FAILED`,`the snapshot taken for --crop-on was sparse and cannot be read as the screen`,{reason:a.captureUnreadable});let p=await Qe(f.nodes,o,f.truncated,n),m=await fe(s),h=z(Ge(f.backend),B(f.nodes),p.rect,m.width,m.height),g=Ke(h,m.width,m.height);if(g===null)throw new e(`COMMAND_FAILED`,`the frame resolved by --crop-on occupies no pixel of the capture`,{reason:a.emptyIntersection});let _=g.x!==h.x||g.y!==h.y||g.width<h.width||g.height<h.height;return await Ue(s,g),{partialIntersection:_}}async function Qe(t,n,r,i){let o=await ae(C.cropTarget,t,n,{platform:l(i)});if(o.kind===`ambiguous`)throw new e(`COMMAND_FAILED`,`--crop-on matched ${o.matchedNodes.length} nodes and must resolve to one`,{reason:a.targetAmbiguous,candidates:o.matchedNodes.map(e=>e.label??e.ref),matches:o.matchedNodes.length});if(o.kind===`none`)throw r?new e(`COMMAND_FAILED`,`the snapshot taken for --crop-on was truncated, so a missing match is not proven`,{reason:a.captureIncomplete}):new e(`COMMAND_FAILED`,`--crop-on matched no node: ${n}`,{reason:a.targetNotFound,hint:`find ${n} list`});return o.node}const $e=[`scroll`,`list`,`recyclerview`,`edittext`,`textfield`];function et(e,t,n){if(e.backend!==`android`||!n.hittable||!D(n.rect)||v(n))return!1;let r=p(n.type??``);return!($e.some(e=>r.includes(e))||t&&O(n.rect)>O(t)*.25)}function tt(e,t,n,r){return!e.rect||e.hittable!==!0||n(e)||r(e)?null:nt(e,t,r)}function nt(e,t,n){let r=e.rect,i=rt(e,t,n);if(!i)return null;let a=i.y-r.y,o=r.y+r.height-(i.y+i.height);if(a<0||o<0||Math.abs(o-a)<16)return null;let s=Math.min(a,o),c=Math.round(i.y-s),l=Math.round(i.height+s*2);return l<=0||l>=r.height?null:{x:r.x,y:c,width:r.width,height:l}}function rt(e,t,n){let r=e.rect,i=new Map(t.map(e=>[e.index,e])),a=t.filter(t=>t.ref!==e.ref&&at(t,e,i)&&it(t,n)&&D(t.rect)&&_(r,t.rect)).map(e=>e.rect);return a.length<2?null:re(a)}function it(e,t){let n=p(e.type??``);return n.includes(`text`)||n.includes(`image`)&&t(e)}function at(e,t,n){let r=e;for(;r.parentIndex!==void 0;){let e=n.get(r.parentIndex);if(!e)return!1;if(e.ref===t.ref)return!0;r=e}return!1}const ot=[`button`,`link`,`menu`,`tab`,`textfield`,`searchfield`,`securetextfield`,`checkbox`,`radio`,`switch`,`cell`];async function H(e){let t=await k.readFile(e.screenshotPath),n=await w(t,`screenshot`),r=st(e.snapshot,n.width,n.height,{maxRefs:e.maxRefs});for(let e of r)he(n,e);return await k.writeFile(e.screenshotPath,await T(n)),r}function st(e,n,r,i={}){let a=B(e.nodes),o=new Map;for(let t of e.nodes){if(!ut(e,a,t))continue;let i=dt(e.nodes,t);if(!i?.rect||!D(i.rect))continue;let s=ft(t,i,e.nodes),c=pt(t,i,s),l=U(e,a,lt(e,i,e.nodes),n,r);if(!D(l))continue;let u=o.get(i.ref);(!u||c>u.score)&&o.set(i.ref,{ref:i.ref,label:s,rect:i.rect,overlayRect:l,score:c})}return ct(e,a,o,n,r),mt([...o.values()]).sort(wt).slice(0,i.maxRefs??24).sort(Y).map(e=>({ref:e.ref,label:e.label,rect:e.rect,overlayRect:e.overlayRect,center:t(e.overlayRect)}))}function ct(e,t,n,r,i){let a=oe(e.nodes).primaryAction;if(!a?.ref||!a.rect||!D(a.rect))return;let o=U(e,t,a.rect,r,i);if(!D(o))return;let s={ref:a.ref,label:a.label,rect:a.rect,overlayRect:o,score:100},c=n.get(a.ref);n.set(a.ref,c?{...c,score:Math.max(c.score,s.score)}:s)}function lt(e,t,n){return e.backend===`android`?tt(t,n,W,e=>!!J(e))??t.rect:t.rect}function ut(e,t,n){let r=[n.label,n.value].some(K)||q(n.identifier);return et(e,t,n)?!0:W(n)?r:r&&ht(n)}function dt(e,t){return[G(t)?t:null,y(e,t,G),t.hittable?t:null,y(e,t,e=>e.hittable===!0)].find(gt)??null}function ft(e,t,n){let r=J(e);return e.ref!==t.ref&&r?r:_t(t,n)||J(t)}function pt(e,t,n){let r=0;return e.ref===t.ref&&(r+=4),t.hittable&&(r+=3),W(t)&&(r+=3),W(e)&&(r+=2),n&&(r+=2),q(t.identifier)&&(r+=1),d(t.value)&&(r+=1),r}function mt(e){let t=[];for(let n of e.sort((e,t)=>O(e.overlayRect)-O(t.overlayRect))){let e=t.findIndex(e=>e.label!==void 0&&e.label===n.label&&(_(e.overlayRect,n.overlayRect)||_(n.overlayRect,e.overlayRect)));if(e===-1){t.push(n);continue}O(n.overlayRect)<O(t[e].overlayRect)&&(t[e]=n)}return t}function U(e,t,n,r,i){return Ct(z(e.backend===`android`?`device-pixels`:`viewport-points`,t,n,r,i),r,i)}function W(e){let t=[e.type,e.role,e.subrole].map(e=>p(e??``)).join(` `);return ot.some(e=>t.includes(e))}function G(e){return W(e)&&!v(e)}function ht(e){let t=p(e.type??``);return t.includes(`statictext`)||t.includes(`image`)||t.includes(`text`)||t.includes(`other`)}function gt(e){return!!(e?.rect&&D(e.rect)&&!v(e))}function K(e){return d(e)?!bt(e):!1}function q(e){return typeof e!=`string`||!K(e)?!1:!xt(e)}function J(e){let t=[e.label,e.value].find(K);if(t)return t.trim();if(q(e.identifier))return e.identifier.trim()}function _t(e,t){let n=null;for(let r of t){if(r.ref===e.ref||!vt(r,e,t))continue;let i=J(r);if(!i)continue;let a=yt(r);(!n||a>n.score)&&(n={label:i,score:a})}return n?.label}function vt(e,t,n){let r=e;for(;r.parentIndex!==void 0;){let e=n[r.parentIndex];if(!e)return!1;if(e.ref===t.ref)return!0;r=e}return!1}function yt(e){let t=0;return p(e.type??``).includes(`text`)&&(t+=2),K(e.label)&&(t+=2),K(e.value)&&(t+=1),t}function bt(e){let t=e?.trim().toLowerCase();return t===`toolbar`||t===`window`||t===`application`||t?.startsWith(`vertical scroll bar`)===!0}function xt(e){return/^[a-z0-9_.]+:id\/[a-z0-9_.-]+$/i.test(e.trim())}function St(e,t){return Number.parseInt(e.replace(/^\D+/,``),10)-Number.parseInt(t.replace(/^\D+/,``),10)}function Ct(e,t,n){let r=E(e.x,0,Math.max(0,t-1)),i=E(e.y,0,Math.max(0,n-1)),a=Math.max(1,t-r),o=Math.max(1,n-i);return{x:r,y:i,width:E(e.width,1,a),height:E(e.height,1,o)}}function Y(e,t){let n=e.overlayRect.y-t.overlayRect.y;if(n!==0)return n;let r=e.overlayRect.x-t.overlayRect.x;return r===0?St(e.ref,t.ref):r}function wt(e,t){return t.score===e.score?Y(e,t):t.score-e.score}async function X(e){let t=f({overlayRefs:e.overlayRefs,cropOn:e.cropOn!==void 0}),n=await ye({device:e.device,plan:t,inspectFacts:e.inspectFacts});return n.admitted?{ok:!0,runtime:await Tt(e.bindDevice,n)}:{ok:!1,response:Dt(t.kind,n.operation,n.fact)}}async function Tt(e,t){let n=ve(e),{device:r,plan:i}=ge(t);switch(i.kind){case`capture`:{let e=await n(r,i.use);return Object.freeze({captureScreenshot:Z(e)})}case`capture-with-overlay-refs`:case`capture-with-crop-on`:{let e=await n(r,i.use);return Object.freeze({captureScreenshot:Z(e),captureSnapshot:Et(e)})}}}function Z(e){return async t=>await e.operations.captureScreenshot(t)}function Et(e){return async t=>await e.operations.captureSnapshot(t)}function Dt(e,t,r){return t===`captureScreenshot`?_e(`screenshot`,r):e===`capture-with-crop-on`?n(`UNSUPPORTED_OPERATION`,`--crop-on crops the capture to a selector frame using a snapshot taken on the same screen, which this target cannot capture.`,{reason:r.available?void 0:r.reason},{hint:(r.available?void 0:r.hint)??`Re-run screenshot without --crop-on.`}):n(`UNSUPPORTED_OPERATION`,`--overlay-refs annotates a capture with the refs of a snapshot taken on the same screen, which this target cannot capture.`,{reason:r.available?void 0:r.reason},{hint:(r.available?void 0:r.hint)??`Re-run screenshot without --overlay-refs.`})}async function Ot(t){let{req:n,session:r}=t,a=i(`screenshot`,n.flags);if(a)throw new e(`INVALID_ARGS`,a);me(r.device,n.flags?.screenshotPixelDensity);let o=Nt(n),s=typeof n.flags?.screenshotCropOn==`string`&&n.flags.screenshotCropOn.length>0?n.flags.screenshotCropOn:void 0;s!==void 0&&He({device:r.device,surface:r.surface,cropOn:s,overlayRefs:n.flags?.overlayRefs===!0,fullscreen:n.flags?.screenshotFullscreen===!0});let c=await X({device:r.device,overlayRefs:n.flags?.overlayRefs===!0,cropOn:s,inspectFacts:t.inspectFacts,bindDevice:t.bindDevice});if(!c.ok)return c;let l=c.runtime,u={warnings:[]};return{ok:!0,recorded:o.recorded,execute:async e=>await kt({session:e.session,sessionName:e.sessionName,logPath:e.logPath,dispatchContext:e.dispatchContext,flags:e.request.flags,outPath:o.outPath,runtime:l,cropOn:s,cropRun:u})}}async function Q(e){let{session:t,sessionName:n,outPath:i,dispatchContext:a}=e;return await le({backend:Pt(e),artifacts:Ft(),sessions:ce(n,t),policy:ie()}).capture.screenshot({session:n,requestId:a.requestId,appBundleId:t.appBundleId,...r(a),surface:t.surface,...i?{out:{kind:`path`,path:i}}:{}})}function $(e){return x(e)}async function kt(e){let{session:t,runtime:n,flags:r}=e,i=At({cropOn:e.cropOn,captureSnapshot:n.captureSnapshot,cropRun:e.cropRun,logPath:e.logPath}),a=await Q({session:t,sessionName:e.sessionName,outPath:e.outPath,dispatchContext:e.dispatchContext,captureScreenshot:n.captureScreenshot,...i?{crop:i}:{}}),o=[...a.warnings??[],...i?.run?.warnings??[]];return{...a,...o.length>0?{warnings:o}:{},...await jt({session:t,cropOn:e.cropOn,captureSnapshot:n.captureSnapshot,screenshotPath:a.path,logPath:e.logPath,dispatchContext:e.dispatchContext}),...await pe({device:t.device,path:a.path,requestedPixelDensity:r?.screenshotPixelDensity,scale:r?.screenshotScale})}}function At(e){let{cropOn:t,captureSnapshot:n,cropRun:r}=e;if(t!==void 0&&n!==void 0&&r!==void 0)return{cropOn:t,captureSnapshot:n,run:r,logPath:e.logPath}}async function jt(e){let{session:t,cropOn:n,captureSnapshot:r}=e;return n!==void 0||r===void 0?{}:{overlayRefs:await Mt({session:t,logPath:e.logPath,screenshotPath:e.screenshotPath,dispatchContext:e.dispatchContext,captureSnapshot:r})}}async function Mt(e){let{session:t,dispatchContext:n}=e,r={snapshotInteractiveOnly:!0},i=await S({device:t.device,session:t,flags:r,logPath:e.logPath,snapshotScope:void 0,captureData:async()=>await e.captureSnapshot({options:{appBundleId:t.appBundleId,interactiveOnly:!0,surface:t.surface},execution:$(n)})}),a=b(i,r);return ue(t,a),await H({screenshotPath:e.screenshotPath,snapshot:a})}function Nt(e){let t=e.positionals??[],n=e.flags??{},r=t=>t===void 0?void 0:se(t,e.meta?.cwd),i=r(t[0]),a=r(n.out);return{outPath:i??a,recorded:{positionals:i?[i,...t.slice(1)]:t,flags:a?{...n,out:a}:n}}}function Pt(e){let{session:t,dispatchContext:n,captureScreenshot:i,crop:a}=e;return{platform:l(t.device),captureScreenshot:async(e,s,l)=>{let u=r({...n,...o(l)}),d=await i({outPath:s,options:{appBundleId:n.appBundleId,pixelDensity:u.pixelDensity,fullscreen:u.fullscreen,normalizeStatusBar:u.normalizeStatusBar,stabilize:u.stabilize,surface:l?.surface,skipIosSimulatorBootCheck:n.skipIosSimulatorBootCheck??(c(t.device)&&t.device.kind===`simulator`),captureBackend:n.screenshotCaptureBackend},execution:$(n)});if(a){let e=await Ze({device:t.device,session:t,surface:t.surface,cropOn:a.cropOn,screenshotPath:s,logPath:a.logPath,dispatchContext:n,captureSnapshot:a.captureSnapshot});a.run.warnings.push(...V(e))}return d.displayRotation?{displayRotation:d.displayRotation}:void 0}}}function Ft(){return{resolveInput:async()=>{throw new e(`UNSUPPORTED_OPERATION`,`screenshot does not resolve input artifacts`)},reserveOutput:async e=>{let t,n;return e?.kind===`path`?n=e.path:(t=await k.mkdtemp(j.join(A.tmpdir(),`agent-device-screenshot-`)),n=j.join(t,`screenshot.png`)),await k.mkdir(j.dirname(n),{recursive:!0}),{path:n,visibility:`client-visible`,publish:async()=>void 0,...t?{cleanup:async()=>{await k.rm(t,{recursive:!0,force:!0})}}:{}}},createTempFile:async e=>{let t=await k.mkdtemp(j.join(A.tmpdir(),`${e.prefix}-`));return{path:j.join(t,`file${e.ext}`),visibility:`internal`,cleanup:async()=>{await k.rm(t,{recursive:!0,force:!0})}}}}}export{Ne as _,H as a,Ce as b,P as c,Ae as d,be as f,Pe as g,Fe as h,X as i,F as l,Ee as m,Ot as n,Oe as o,De as p,$ as r,we as s,Q as t,xe as u,Te as v,Se as x,ke as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as e,s as t}from"./sdk-contracts.js";import{S as n,b as r,i,p as a,v as o,w as s}from"./sdk-device.js";import"./dispatch-resolve.js";import{s as c}from"./device-shell.js";import{t as l}from"./device-isolation.js";import u from"node:crypto";import d from"node:fs";import f from"node:path";function p(e){return`${e.device.platform} device "${e.device.name.trim()}" (${e.device.id})`}function m(e,t,n={}){return e.session.screenRecording?_(e.address,t):y(e,t,n)}function h(e,n,r={}){return t(`DEVICE_IN_USE`,`Device is already in use by session "${e.address}".`,{session:e.address,deviceId:n.id,deviceName:n.name,...r.waitedMs===void 0?{}:{waitedMs:r.waitedMs},hint:m(e,`device-in-use`,r)})}function g(e,n,r={}){return t(`DEVICE_IN_USE`,`Device is already in use by workspace session "${e.address}".`,{reason:`WORKSPACE_SESSION_SCOPE_CONFLICT`,session:e.address,deviceId:n.id,deviceName:n.name,...r.waitedMs===void 0?{}:{waitedMs:r.waitedMs},hint:v(e.address,r)})}function _(e,t){let n=c(e),r=`agent-device close --session ${n}`;return`Recording session "${e}" owns this device. Run ${`agent-device record stop --session ${n}`}; if the session still appears in agent-device session list, run ${r}. ${t===`selector-conflict`?`To keep using this device, rerun the command with --session ${n} and remove conflicting device selectors.`:`To keep using this device, reuse --session ${n} for commands that should attach to the recording session.`} Run agent-device session list to inspect active sessions.`}function v(e,t){let n=c(e);return`${b(t)}Session "${e}" belongs to another workspace. Run agent-device close --session ${n} to release this device from that workspace, agent-device devices to choose another device. ${x(t)}Run agent-device session list to inspect active sessions.`}function y(e,t,n){let r=e.address,i=c(r),a=`agent-device close --session ${i}`;return t===`selector-conflict`?`Run agent-device session list to inspect active sessions. To reuse this device, rerun the command with --session ${i} and remove conflicting device selectors. To switch devices, first run ${a}, then open the desired device with a different --session name.`+S(e,n):`${b(n)}Run agent-device session list to inspect active sessions. To reuse this device, rerun the command with --session ${i}. To open a new session on this device, first run ${a}. `+`${x(n)}`.trimEnd()}function b(e){return e.waitedMs===void 0?``:`Waited ${Math.round(e.waitedMs)}ms for this device and it stayed busy. `}function x(e){return e.offersDeviceWait&&e.waitedMs===void 0?`To wait for the device to free up, run the same open with --wait <ms>. `:``}function S(e,t){return t.offersPlatformSession===!0&&e.session.sessionScope?.kind===`cwd`?` Or name the other platform with --platform to open its own session for this workspace.`:``}function C(t,n){let{address:r,session:i}=t,a=w(i,n);if(a.length!==0)throw new e(`INVALID_ARGS`,`Session "${r}" is already bound to ${p(i)}, but this request selected ${a.map(T).join(`, `)}.`,{session:r,conflicts:a.map(T),hint:m(t,`selector-conflict`,{offersPlatformSession:a.some(e=>e.key===`platform`)})})}function w(e,t){if(!t)return[];let i=[],s=e.device,c=t.platform;if(c&&!n(s,c)&&i.push({key:`platform`,value:t.platform}),t.target&&t.target!==(s.target??`mobile`)&&i.push({key:`target`,value:t.target}),t.udid&&(!a(s)||t.udid!==s.id)&&i.push({key:`udid`,value:t.udid}),t.serial&&(!o(s.platform)||t.serial!==s.id)&&i.push({key:`serial`,value:t.serial}),t.device&&!r(s,t.device)&&i.push({key:`device`,value:t.device}),t.iosSimulatorDeviceSet){let e=t.iosSimulatorDeviceSet.trim(),n=s.simulatorSetPath?.trim();(!a(s)||s.kind!==`simulator`||e!==n)&&i.push({key:`iosSimulatorDeviceSet`,value:t.iosSimulatorDeviceSet})}if(t.androidDeviceAllowlist){let e=l(t.androidDeviceAllowlist);(s.platform!==`android`||!e.has(s.id))&&i.push({key:`androidDeviceAllowlist`,value:t.androidDeviceAllowlist})}return i}function T(e){return`${E(e.key)}=${e.value}`}function E(e){switch(e){case`iosSimulatorDeviceSet`:return`--ios-simulator-device-set`;case`androidDeviceAllowlist`:return`--android-device-allowlist`;default:return`--${e}`}}const D=`default`,O=new Set(i);function k(e,t,n={}){let r=e.session||D;if(F(e))return r;let i=M(e);return i.kind===`cwd`?L(e,t,i.id,n):r}function A(e){return e.session||D}function j(e){let t=M(e);return t.kind===`cwd`?t:void 0}function M(t){if(t.meta?.sessionIsolation===`tenant`||t.flags?.sessionIsolation===`tenant`){let n=t.meta?.tenantId;if(!n)throw new e(`INTERNAL_ERROR`,`Tenant-scoped request reached session routing without an admitted tenant id`);return{kind:`tenant`,id:n}}if(F(t)||(t.session||D)!==D)return{kind:`named-local`};let n=Y(t.meta?.cwd);return n?{kind:`cwd`,id:J(n)}:{kind:`global-default`}}function N(e,t){let n=e.sessionScope;return n?t.kind===`tenant`?n.kind===`tenant`&&n.id===t.id:n.kind===`tenant`?!1:t.kind!==`cwd`||n.kind===`named-local`||n.kind===`cwd`&&n.id===t.id:!1}function P(e,t){let n=j(e);return!n||t.sessionScope?.kind!==`cwd`?!1:t.sessionScope.id!==n.id}function F(e){if(e.meta?.sessionExplicit===!0)return!0;let t=e.flags?.session;return typeof t==`string`&&t.trim().length>0}function I(e,t){return`cwd:${e}:${t}`}function L(e,t,n,r){let i=U(t,n),a=W(e);return a?R(e,t,n,a,i,r):H(n,i,r)}function R(e,t,n,r,i,a){let o=I(n,r);if(t.get(o))return o;let s=V(e.flags,r),c=i.map(e=>({ref:e,conflicts:w(e.session,s)})),l=c.filter(e=>e.conflicts.length===0),[u]=l;return u&&l.length===1?u.ref.address:l.length>1?(K(a,l.map(e=>e.ref)),o):z(c)?.address??o}function z(e){return e.find(e=>!B(e.conflicts))?.ref}function B(e){return e.some(e=>e.key===`platform`)}function V(e,t){return{...e,platform:t}}function H(e,t,n){let[r]=t;return r&&t.length===1?r.address:(K(n,t),I(e,D))}function U(e,t){let n=new Set,r=[];for(let i of e.listRefs()){let e=i.session.sessionScope;e?.kind===`cwd`&&e.id===t&&(n.has(i.session)||(n.add(i.session),r.push(i)))}return r}function W(e){return G(e.flags?.platform)??G(e.meta?.lockPlatform)}function G(e){if(typeof e!=`string`)return;let t=e.trim().toLowerCase();return O.has(t)?t:void 0}function K(e,t){if(t.length>1&&e.attachesToSession===!0)throw q(t)}function q(t){let n=t.map(e=>e.address),r=t.map(e=>s(e.session.device)),i=r.map(e=>`--platform ${e}`).join(` or `);return new e(`AMBIGUOUS_MATCH`,`This workspace has ${t.length} implicit sessions (${n.join(`, `)}); select one explicitly.`,{sessions:n,platforms:r,hint:`Run agent-device session list to inspect them. Add ${i} to run in that platform's session, or pass --session <address> copied from that list.`})}function J(e){return u.createHash(`sha256`).update(e).digest(`hex`).slice(0,16)}function Y(e){if(!e||e.trim().length===0)return;let t=X(e);return Z(t)??t}function X(e){let t=f.resolve(e);try{return d.realpathSync.native(t)}catch{return t}}function Z(e){let t=e;for(;;){if(d.existsSync(f.join(t,`.git`)))return t;let e=f.dirname(t);if(e===t)return;t=e}}export{M as a,T as c,g as d,m as f,A as i,w as l,P as n,N as o,p,k as r,C as s,F as t,h as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as e}from"./sdk-contracts.js";import{i as t}from"./runtime-admission.js";function n(e,n){return n.available?void 0:t(e,n)}function r(t){if(t)return t;throw new e(`COMMAND_FAILED`,`Device runtime facts inspection is unavailable.`)}const i=new WeakMap;let a;(class e{static{a=(t,n)=>{let r=new e;return i.set(r,{device:Object.freeze({...t}),plan:n}),Object.freeze(r),r}}#e;constructor(){this.#e=void 0}get admitted(){return this.#e,!0}});function o(t){let n=i.get(t);if(n===void 0)throw new e(`COMMAND_FAILED`,`Runtime plan admission is not one minted by admitRuntimePlan; refusing to bind.`);return n}async function s(e){let t=await r(e.inspectFacts)(e.device);for(let n of e.plan.use.required){let e=t.operations[n];if(!e.available)return{admitted:!1,operation:n,fact:e}}return a(e.device,e.plan)}function c(t){if(t)return t;throw new e(`COMMAND_FAILED`,`Device runtime binding is unavailable.`)}export{o as a,n as i,c as n,r,s as t};
|
package/dist/src/timeouts.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e){return new Promise(t=>setTimeout(t,e))}export{e as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as e}from"./scroll-gesture.js";const t=new WeakMap;function n(e){if(!e)return;let n=t.get(e);if(n)return n;let r=i(e.nodes??[]);if(r)return t.set(e,r),r}function r(e){return n({nodes:e,createdAt:0})}const i=e;export{r as n,n as t};
|
package/dist/src/vars.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{P as e}from"./sdk-contracts.js";import{t}from"./script.js";function n(e){return e.startsWith(`AD_`)}function r(t){return new e(`INVALID_ARGS`,`The AD_* namespace is reserved for built-in variables. Rename ${t} to avoid the AD_ prefix.`)}function i(e){let t={};if(e.builtins)for(let[n,r]of Object.entries(e.builtins))t[n]=r;let i=[e.fileEnv,e.shellEnv,e.cliEnv];for(let e of i)if(e)for(let[i,a]of Object.entries(e)){if(n(i))throw r(i);t[i]=a}return{values:t,expandedBuiltinNames:new Set}}function a(e){let r={};for(let[i,a]of Object.entries(e)){if(typeof a!=`string`||!i.startsWith(`AD_VAR_`))continue;let e=i.slice(7);e.length!==0&&t.test(e)&&(n(e)||(r[e]=a))}return r}function o(i){let a={};for(let o of i){let i=o.indexOf(`=`);if(i<=0)throw new e(`INVALID_ARGS`,`Invalid -e entry "${o}": expected KEY=VALUE.`);let s=o.slice(0,i);if(!t.test(s))throw new e(`INVALID_ARGS`,`Invalid -e key "${s}": keys must be uppercase letters, digits, and underscores (e.g. APP_ID).`);if(n(s))throw r(s);a[s]=o.slice(i+1)}return a}function s(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function c(e){if(e&&typeof e==`object`&&!Array.isArray(e)){let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}return process.env}function l(e){return e>=`A`&&e<=`Z`||e>=`a`&&e<=`z`||e===`_`}function u(e){return l(e)||e>=`0`&&e<=`9`||e===`.`}function d(e){return e===`
|
|
2
|
-
`||e===`\r`||e===`\u2028`||e===`\u2029`}function f(e,t){let n=t+2;if(n>=e.length||!l(e[n]))return null;for(n+=1;n<e.length&&u(e[n]);)n+=1;let r=e.slice(t+2,n);if(e[n]===`}`)return{key:r,fallback:void 0,end:n+1};if(e[n]!==`:`||e[n+1]!==`-`)return null;n+=2;let i=``;for(;n<e.length;){let t=e[n];if(t===`}`)return{key:r,fallback:i,end:n+1};if(t===`\\`){let t=e[n+1];if(t===void 0)return{abortEnd:e.length};if(d(t))return{abortEnd:n+2};i+=t,n+=2;continue}i+=t,n+=1}return{abortEnd:e.length}}function p(t,r,i){let a=``,o=0;for(;o<t.length;){let s=t[o];if(s===`\\`&&t.startsWith("${",o+1)){a+="${",o+=3;continue}if(s===`$`&&t[o+1]===`{`){let s=f(t,o);if(s!==null&&`abortEnd`in s){a+=t.slice(o,s.abortEnd),o=s.abortEnd;continue}if(s!==null){let{key:t,fallback:c}=s;if(Object.prototype.hasOwnProperty.call(r.values,t))n(t)&&(r.expandedBuiltinNames??=new Set).add(t),a+=String(r.values[t]);else if(c!==void 0)a+=c;else throw new e(`INVALID_ARGS`,`Unresolved variable \${${t}} at ${i.file}:${i.line}.`);o=s.end;continue}}a+=s,o+=1}return a}function m(e,t,n){return{...e,positionals:(e.positionals??[]).map(e=>p(e,t,n)),flags:h(e.flags,t,n)??{},runtime:h(e.runtime,t,n)}}function h(e,t,n){return e&&g(e,t,n)}function g(e,t,n){return typeof e==`string`?p(e,t,n):Array.isArray(e)?e.map(e=>g(e,t,n)):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,r])=>[e,g(r,t,n)])):e}function _(e){return Object.entries(e.values).filter(([t,r])=>r.length>0&&(!n(t)||e.expandedBuiltinNames?.has(t))).map(([e,t])=>({name:e,value:t})).sort((e,t)=>t.value.length-e.value.length)}export{s as a,o as i,_ as n,c as o,a as r,m as s,i as t};
|
package/dist/src/viewport.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as e}from"./sdk-contracts.js";function t(t,n){let r=t===void 0?NaN:Number(t);if(!Number.isInteger(r)||r<1)throw new e(`INVALID_ARGS`,`viewport ${n} must be a positive integer`);return r}function n(n){if(n.length!==2)throw new e(`INVALID_ARGS`,`viewport requires exactly two arguments: <width> <height>`);return{width:t(n[0],`width`),height:t(n[1],`height`)}}export{n as t};
|