agent-device 0.20.1 → 0.20.3
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 +0 -2
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.20.1.apk → agent-device-android-ime-helper-0.20.3.apk} +0 -0
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.3.apk.sha256 +1 -0
- package/android/ime-helper/dist/{agent-device-android-ime-helper-0.20.1.manifest.json → agent-device-android-ime-helper-0.20.3.manifest.json} +4 -4
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.20.1.apk → agent-device-android-snapshot-helper-0.20.3.apk} +0 -0
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.3.apk.sha256 +1 -0
- package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.20.1.manifest.json → agent-device-android-snapshot-helper-0.20.3.manifest.json} +6 -6
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +2 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +1 -35
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +0 -208
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Keyboard.swift +184 -0
- package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Orientation.swift +92 -0
- package/dist/src/agent-device-client.js +2 -2
- package/dist/src/android-adb.d.ts +3 -26
- package/dist/src/android-adb.js +1 -1
- package/dist/src/android.js +1 -1
- package/dist/src/app-helpers.js +1 -0
- package/dist/src/app-lifecycle.js +5 -5
- package/dist/src/app-log-request-scope.js +1 -1
- package/dist/src/app-resolution.js +1 -1
- package/dist/src/apps.js +5 -5
- package/dist/src/cli-config.js +1 -1
- package/dist/src/cli-help.js +6 -6
- package/dist/src/cli-runner.js +1 -1
- package/dist/src/cli.js +14 -14
- package/dist/src/click-button.d.ts +5 -0
- package/dist/src/client-metro.js +1 -0
- package/dist/src/command-schema.js +3 -3
- package/dist/src/context.js +1 -1
- package/dist/src/contracts.d.ts +1 -1
- package/dist/src/device-input-state.d.ts +26 -0
- package/dist/src/device-input-state.js +1 -1
- package/dist/src/device.js +9 -0
- package/dist/src/devices2.js +1 -1
- package/dist/src/find.js +1 -1
- package/dist/src/generic.js +1 -1
- package/dist/src/gesture-plan-types.js +1 -0
- package/dist/src/gesture-plan.js +1 -0
- package/dist/src/index.d.ts +1174 -1413
- package/dist/src/input-actions.js +4 -4
- package/dist/src/install-artifact.js +5 -1
- package/dist/src/install-artifact2.js +1 -0
- package/dist/src/interaction-snapshot.js +1 -1
- package/dist/src/interaction.d.ts +3 -6
- package/dist/src/interaction.js +1 -1
- package/dist/src/interactor.js +2 -2
- package/dist/src/interactor2.js +1 -1
- package/dist/src/internal/bin.js +1 -1
- package/dist/src/internal/daemon.js +14 -22
- package/dist/src/lease-context.js +1 -1
- package/dist/src/lease.js +1 -1
- package/dist/src/limrun.d.ts +437 -0
- package/dist/src/limrun.js +1 -0
- package/dist/src/linux.js +1 -1
- package/dist/src/logcat.js +1 -5
- package/dist/src/metro.d.ts +71 -2
- package/dist/src/metro.js +1 -1
- package/dist/src/metro2.js +1 -1
- package/dist/src/notifications.js +1 -1
- package/dist/src/physical-device-control.js +1 -0
- package/dist/src/plist.js +1 -0
- package/dist/src/react-native.js +1 -1
- package/dist/src/recording-export-quality.js +12 -13
- package/dist/src/register-builtins.js +1 -1
- package/dist/src/registry.js +18 -18
- package/dist/src/remote-config.d.ts +5 -2
- package/dist/src/remote-config.js +1 -1
- package/dist/src/remote-config2.js +1 -0
- package/dist/src/reporting.js +8 -8
- package/dist/src/runner-client.js +1 -1
- package/dist/src/runner-disposal.js +1 -2
- package/dist/src/runner-lease.js +1 -1
- package/dist/src/runtime-transport.js +1 -1
- package/dist/src/runtime.js +3 -3
- package/dist/src/runtime2.js +1 -1
- package/dist/src/sdk-android-adb.d.ts +4 -2
- package/dist/src/sdk-batch-runner.d.ts +13 -3
- package/dist/src/sdk-batch-runner.js +1 -1
- package/dist/src/sdk-contracts.d.ts +28 -2
- package/dist/src/sdk-contracts.js +2 -2
- package/dist/src/sdk-finders.d.ts +1 -1
- package/dist/src/sdk-remote-config.d.ts +119 -4
- package/dist/src/selector-runtime.js +1 -1
- package/dist/src/selector-vocabulary.js +1 -1
- package/dist/src/selectors.d.ts +1 -1
- package/dist/src/server.js +2 -2
- package/dist/src/session-target-evidence.js +1 -1
- package/dist/src/session.js +8 -8
- package/dist/src/simulator.js +1 -1
- package/dist/src/snapshot-diagnostics.js +4 -4
- package/dist/src/snapshot2.js +1 -1
- package/dist/src/tool-provider.js +3 -3
- package/dist/src/tool-provider2.js +1 -1
- package/dist/src/tool-provider3.js +1 -1
- package/dist/src/tv-remote.d.ts +213 -0
- package/dist/src/xml.js +2 -0
- package/package.json +49 -30
- package/server.json +2 -2
- package/smithery.yaml +1 -1
- package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.1.apk.sha256 +0 -1
- package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.1.apk.sha256 +0 -1
- package/dist/src/android-system-chrome.js +0 -1
- package/dist/src/client-metro-companion.js +0 -1
- package/dist/src/metro-types.d.ts +0 -52
- package/dist/src/project-runtime.js +0 -1
- package/dist/src/scoped-provider.js +0 -1
- package/dist/src/simctl.js +0 -1
- package/dist/src/snapshot-quality.js +0 -1
package/dist/src/server.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{S as e,_ as t,n,o as r}from"./sdk-contracts.js";import{N as i,f as a}from"./sdk-batch-runner.js";import{Gn as o,mt as s,vn as c}from"./recording-export-quality.js";import{n as l}from"./version.js";import{r as u,t as d}from"./sdk-device.js";import{b as f,s as p,x as m,y as h}from"./registry.js";import{i as ee,n as te,t as ne}from"./command-metadata.js";import{i as re,n as ie,r as ae,t as oe}from"./cli-config.js";const g=[`simulator`,`emulator`,`device`];function _(e){return{type:`number`,...e?{description:e}:{}}}function v(e,t){return{type:`string`,enum:e,...t?{description:t}:{}}}function y(e){return{type:`string`,const:e}}function b(e,t=[],n){return{type:`object`,...n?{description:n}:{},properties:e,...t.length>0?{required:t}:{}}}const x={type:`array`,items:{type:`string`}},S=b({wallClockMs:_(`Total wall-clock time for the request in milliseconds.`),runnerRoundTrips:_(`Number of real runner round-trips made while serving the request.`),nodeCount:_(`Number of nodes in the original node tree when the response carries one.`)},[`wallClockMs`,`runnerRoundTrips`]),se=b({field:m(),artifactType:m(),path:m(),localPath:m(),fileName:m()},[`field`]);function C(e={}){let t=e.properties??{},n=e.required??[];return b({targetKind:v([`point`,`ref`,`selector`],`Resolved interaction target kind.`),x:_(`Resolved interaction x coordinate when available.`),y:_(`Resolved interaction y coordinate when available.`),referenceWidth:_(`Reference frame width for visualizing the interaction point.`),referenceHeight:_(`Reference frame height for visualizing the interaction point.`),ref:m(`Snapshot ref without the @ prefix when the target was an @ref.`),selector:m(`Selector expression when the target was a selector.`),selectorChain:x,refLabel:m(),targetHittable:h(),hint:m(),warning:m(),message:m(),evidence:T,resolution:ce,cost:S,maestroNonHittableCoordinateFallbackAllowed:h(`Whether the direct iOS Maestro coordinate fallback was allowed for this selector.`),maestroNonHittableCoordinateFallbackUsed:h(`Whether the direct iOS Maestro coordinate fallback was actually used.`),maestroFallbackReason:y(`non-hittable-coordinate`),...t},[`targetKind`,...n])}const w=b({diagnosticRef:m(`Opaque non-@ diagnostic token. Never a snapshot ref: not issued via refsGeneration and cannot be pinned or reused as an @ref target. UTF-8 truncated to 256 bytes.`),role:m(`UTF-8 truncated to 256 bytes.`),label:m(`UTF-8 truncated to 256 bytes.`)},[`diagnosticRef`]),ce={type:`object`,description:`Pre-action disclosure of how the acting path resolved its target. Absent when resolutionDisclosure is inapplicable for the path.`,oneOf:[b({source:y(`runtime`),phase:y(`pre-action`),kind:y(`unique`)},[`source`,`phase`,`kind`]),b({source:y(`runtime`),phase:y(`pre-action`),kind:y(`disambiguated`),matchCount:_(`Total matches resolveSelectorChain found before disambiguation.`),winnerDiagnostic:w,tiebreak:v([`visible`,`deepest`,`smallest-area`],`The comparison that decided the winner.`),alternatives:{type:`array`,description:`At most 5 losing candidates, document order. Present at default/full response levels and omitted in digest. The winner is never included.`,items:w}},[`source`,`phase`,`kind`,`matchCount`,`winnerDiagnostic`,`tiebreak`]),b({source:y(`ref`),phase:y(`pre-action`),kind:y(`exact`)},[`source`,`phase`,`kind`]),b({source:y(`ref`),phase:y(`pre-action`),kind:y(`label-fallback`)},[`source`,`phase`,`kind`]),b({source:y(`direct-ios`),kind:y(`not-observed`)},[`source`,`kind`])]},T=b({foregroundApp:m(`Foreground app bundle id or name, when the capture carries it.`),nodeCount:_(`Node count in the post-action interactive-only capture.`),interactiveNodeCount:_(`Subset of nodeCount the platform reports as hittable.`),digest:m(`Order-independent digest of the post-action node multiset.`),changedFromBefore:h(`Whether the post-action digest differs from the pre-action capture digest. false is evidence, not failure.`)},[`nodeCount`,`interactiveNodeCount`,`digest`,`changedFromBefore`]),E=b({settled:h(`Whether the UI held the quiet window before the deadline. false is advisory, not failure.`),waitedMs:_(),captures:_(),quietMs:_(),timeoutMs:_(),refsGeneration:_(`Snapshot generation of the stored settled tree; refs on added diff lines were minted from it.`),refs:{type:`array`,items:b({ref:m(`Plain ref body (e12) minted from the stored settled tree.`)},[`ref`])},diff:b({summary:b({additions:_(),removals:_(),unchanged:_()},[`additions`,`removals`,`unchanged`]),lines:{type:`array`,items:b({kind:v([`added`,`removed`]),text:m(),ref:m(`Plain ref body (e12) for added lines.`)},[`kind`,`text`])},truncated:h(`Lines were capped to the response bound.`)},[`summary`,`lines`],`Settled diff vs the pre-action tree (changed lines only).`),tail:{type:`array`,description:`Unchanged interactive refs tail: still-present, actionable elements from the settled tree, attached only when diff carries zero added-line refs (a modal-dismiss/toast-only diff).`,items:b({ref:m(`Plain ref body (e12) minted from the stored settled tree.`),role:m(),label:m()},[`ref`,`role`])},tailTruncated:h(`Present (true) when tail candidates exceeded the response cap.`),hint:m()},[`settled`,`waitedMs`,`captures`,`quietMs`,`timeoutMs`]),D={platform:v(u),target:v(d),device:m(`Human-readable device name.`),id:m(`Stable device id.`),kind:v(g)},O=[`platform`,`target`,`device`,`id`,`kind`],le=b({success:h(),exitCode:_(),stdout:m(),stderr:m(),error:f(`Normalized error detail when shutdown failed.`)},[`success`,`exitCode`,`stdout`,`stderr`]),k=C({properties:{evidence:T,settle:E,button:v([`secondary`,`middle`]),count:_(`Number of press/click repetitions.`),intervalMs:_(`Delay between repeated press/click actions.`),holdMs:_(`Hold duration for each action.`),jitterPx:_(`Randomization radius in pixels.`),doubleTap:h(`Whether the command requested a double-tap action.`)}}),ue={press:k,click:k,fill:C({properties:{text:m(`Text submitted to the field.`),delayMs:_(`Delay between typed characters in milliseconds.`),evidence:T,settle:E},required:[`text`]}),longpress:C({properties:{durationMs:_(),settle:E,gesture:y(`longpress`)}}),find:b({ref:m(`Snapshot ref without the @ prefix when the find action returns one.`),refsGeneration:_(`ADR 0014 ref frame epoch for read-only find actions.`),found:h(`Whether a wait/exists/read-only find satisfied its condition.`),waitedMs:_(`Milliseconds waited for a read-only find condition.`),text:m(`Text value returned by find get_text.`),node:f(`Snapshot node for find get_attrs/get_text.`),locator:m(`Locator kind used for the find action.`),query:m(`Query argument used for the find action.`),x:_(`Resolved x coordinate for mutating find actions.`),y:_(`Resolved y coordinate for mutating find actions.`),message:m(`Diagnostic message for mutating find actions.`),settle:E,cost:S},[],`Daemon response data for the find command.`),boot:b({...D,booted:{type:`boolean`,const:!0}},[...O,`booted`]),shutdown:b({...D,shutdown:le},[...O,`shutdown`]),viewport:b({width:_(),height:_(),message:m()},[`width`,`height`,`message`]),...p,wait:b({waitedMs:_(),kind:y(`selector`),text:m(),selector:m(),captures:_(),nodeCount:_(),hint:m(),warning:m()},[`waitedMs`]),prepare:b({action:y(`ios-runner`),platform:v(u),deviceId:m(),deviceName:m(),kind:v(g),durationMs:_(),runner:b({},[]),cache:v([`exact`,`restore-key`,`miss`,`external`]),artifact:v([`valid`,`rebuilt`]),buildMs:_(),connectMs:_(),healthCheckMs:_(),xctestrunPath:m(),recoveryReason:m(),failureReason:m(),timing:b({totalMs:_(),additiveParts:b({buildMs:_(),connectAfterBuildMs:_(),healthCheckMs:_()},[`connectAfterBuildMs`,`healthCheckMs`]),containment:b({connectMs:{type:`array`,items:y(`buildMs`)},healthCheckMs:{type:`array`,items:m()}},[`healthCheckMs`]),note:m()},[`totalMs`,`additiveParts`,`containment`,`note`]),message:m()},[`action`,`platform`,`deviceId`,`deviceName`,`kind`,`durationMs`,`runner`,`connectMs`,`healthCheckMs`,`timing`,`message`]),push:{type:`object`,oneOf:[b({platform:y(`ios`),bundleId:m(),message:m()},[`platform`,`bundleId`,`message`]),b({platform:y(`android`),package:m(),action:m(),extrasCount:_(),message:m()},[`platform`,`package`,`action`,`extrasCount`,`message`])]},"trigger-app-event":b({event:m(),eventUrl:m(),transport:y(`deep-link`),message:m()},[`event`,`eventUrl`,`transport`,`message`]),clipboard:{type:`object`,oneOf:[b({action:y(`read`),text:m()},[`action`,`text`]),b({action:y(`write`),textLength:_(),message:m()},[`action`,`textLength`,`message`])]},appstate:{type:`object`,oneOf:[b({platform:v([`ios`,`macos`]),appName:m(),appBundleId:m(),source:y(`session`),surface:v(o),device_udid:m(`iOS only — the session device UDID.`),ios_simulator_device_set:{type:[`string`,`null`],description:`iOS only — the simulator set path, or null when unknown.`}},[`platform`,`appName`,`source`,`surface`]),b({platform:y(`android`),package:m(),activity:m()},[`platform`,`package`,`activity`])]},keyboard:b({platform:v([`android`,`ios`]),action:v([`status`,`dismiss`,`enter`]),visible:h(),wasVisible:h(),dismissed:h(),attempts:_(),inputType:m(),type:v([`text`,`number`,`email`,`phone`,`password`,`datetime`,`unknown`]),inputMethodPackage:m(),focusedPackage:m(),focusedResourceId:m(),inputOwner:v([`app`,`ime`,`unknown`]),message:m()},[`platform`,`action`]),doctor:b({status:v([`pass`,`warn`,`fail`,`info`]),summary:m(),kind:v([`auto`,`react-native`,`expo`,`repack`]),platform:m(),target:v(d),targetApp:m(),metro:b({host:m(),port:_()},[`host`,`port`]),checks:{type:`array`,items:b({id:m(),status:v([`pass`,`warn`,`fail`,`info`]),summary:m(),hint:m(),command:m(),evidence:f()},[`id`,`status`,`summary`])}},[`status`,`summary`,`kind`,`checks`]),diff:b({mode:y(`snapshot`),baselineInitialized:h(),summary:b({additions:_(),removals:_(),unchanged:_()},[`additions`,`removals`,`unchanged`]),lines:{type:`array`,items:b({kind:v([`added`,`removed`]),text:m(),ref:m()},[`kind`,`text`])},warnings:x},[`mode`,`baselineInitialized`,`summary`,`lines`]),replay:b({replayed:_(),healed:_(),session:m(),sessionActive:h(`True iff the session is still active — the script had no terminal close.`),artifactPaths:x,snapshotDiagnostics:f(),message:m()},[`replayed`,`healed`,`session`,`sessionActive`,`artifactPaths`,`message`]),test:b({total:_(),executed:_(),passed:_(),failed:_(),skipped:_(),notRun:_(),durationMs:_(),failures:{type:`array`,items:f()},tests:{type:`array`,items:f()},snapshotDiagnostics:f()},[`total`,`executed`,`passed`,`failed`,`skipped`,`notRun`,`durationMs`,`failures`,`tests`]),record:{type:`object`,oneOf:[b({recording:y(`started`),outPath:m(),sessionStateDir:m(),recordingBackend:m(),recordingScope:m(),recordOnlySession:h(),activeSessionApp:f(),showTouches:h()},[`recording`,`outPath`,`sessionStateDir`,`showTouches`]),b({recording:y(`stopped`),outPath:m(),telemetryPath:m(),artifacts:{type:`array`,items:se},recordingBackend:m(),recordingScope:m(),recordOnlySession:h(),activeSessionApp:f(),durationMs:_(),showTouches:h(),warning:m(),overlayWarning:m(),chunks:{type:`array`,items:f()}},[`recording`,`outPath`,`artifacts`,`durationMs`,`showTouches`])]},trace:{type:`object`,oneOf:[b({trace:y(`started`),outPath:m()},[`trace`,`outPath`]),b({trace:y(`stopped`),outPath:m()},[`trace`,`outPath`])]}},de={devices:{type:`object`,properties:{devices:{type:`array`,items:{type:`object`,properties:{platform:{type:`string`,enum:u},target:{type:`string`,enum:d},kind:{type:`string`,enum:g},id:{type:`string`},name:{type:`string`}},required:[`platform`,`target`,`kind`,`id`,`name`]}}},required:[`devices`]},apps:{type:`object`,properties:{apps:{type:`array`,items:{type:`string`}}},required:[`apps`]}},A={...ue,...de};function j(t){return e(t)}function M(e){let t=[`Error (${e.code}): ${e.message}`];e.hint&&t.push(`Hint: ${e.hint}`),e.supportedOn&&t.push(`Supported on: ${e.supportedOn}`);let n=c(e.details);return n&&t.push(n),t.join(`
|
|
2
|
-
`)}function N(e,t,n){let r=oe({command:e,cwd:process.cwd(),cliFlags:t}),i={};for(let[t,a]of Object.entries(r))Object.hasOwn(n,t)&&ae(t,e)&&(i[t]=a);return re(i,t)}const P={devices:e=>({devices:e.map(
|
|
1
|
+
import{S as e,_ as t,n,o as r}from"./sdk-contracts.js";import{N as i,f as a}from"./sdk-batch-runner.js";import{at as o,fn as s,in as c}from"./recording-export-quality.js";import{n as l}from"./version.js";import{r as u,t as d}from"./sdk-device.js";import{b as f,s as p,x as m,y as h}from"./registry.js";import{i as ee,n as te,t as ne}from"./command-metadata.js";import{i as re,n as ie,r as ae,t as oe}from"./cli-config.js";const g=[`simulator`,`emulator`,`device`];function _(e){return{type:`number`,...e?{description:e}:{}}}function v(e,t){return{type:`string`,enum:e,...t?{description:t}:{}}}function y(e){return{type:`string`,const:e}}function b(e,t=[],n){return{type:`object`,...n?{description:n}:{},properties:e,...t.length>0?{required:t}:{}}}const x={type:`array`,items:{type:`string`}},S=b({wallClockMs:_(`Total wall-clock time for the request in milliseconds.`),runnerRoundTrips:_(`Number of real runner round-trips made while serving the request.`),nodeCount:_(`Number of nodes in the original node tree when the response carries one.`)},[`wallClockMs`,`runnerRoundTrips`]),se=b({field:m(),artifactType:m(),path:m(),localPath:m(),fileName:m()},[`field`]);function C(e={}){let t=e.properties??{},n=e.required??[];return b({targetKind:v([`point`,`ref`,`selector`],`Resolved interaction target kind.`),x:_(`Resolved interaction x coordinate when available.`),y:_(`Resolved interaction y coordinate when available.`),referenceWidth:_(`Reference frame width for visualizing the interaction point.`),referenceHeight:_(`Reference frame height for visualizing the interaction point.`),ref:m(`Snapshot ref without the @ prefix when the target was an @ref.`),selector:m(`Selector expression when the target was a selector.`),selectorChain:x,refLabel:m(),targetHittable:h(),hint:m(),warning:m(),message:m(),evidence:T,resolution:ce,cost:S,maestroNonHittableCoordinateFallbackAllowed:h(`Whether the direct iOS Maestro coordinate fallback was allowed for this selector.`),maestroNonHittableCoordinateFallbackUsed:h(`Whether the direct iOS Maestro coordinate fallback was actually used.`),maestroFallbackReason:y(`non-hittable-coordinate`),...t},[`targetKind`,...n])}const w=b({diagnosticRef:m(`Opaque non-@ diagnostic token. Never a snapshot ref: not issued via refsGeneration and cannot be pinned or reused as an @ref target. UTF-8 truncated to 256 bytes.`),role:m(`UTF-8 truncated to 256 bytes.`),label:m(`UTF-8 truncated to 256 bytes.`)},[`diagnosticRef`]),ce={type:`object`,description:`Pre-action disclosure of how the acting path resolved its target. Absent when resolutionDisclosure is inapplicable for the path.`,oneOf:[b({source:y(`runtime`),phase:y(`pre-action`),kind:y(`unique`)},[`source`,`phase`,`kind`]),b({source:y(`runtime`),phase:y(`pre-action`),kind:y(`disambiguated`),matchCount:_(`Total matches resolveSelectorChain found before disambiguation.`),winnerDiagnostic:w,tiebreak:v([`visible`,`deepest`,`smallest-area`],`The comparison that decided the winner.`),alternatives:{type:`array`,description:`At most 5 losing candidates, document order. Present at default/full response levels and omitted in digest. The winner is never included.`,items:w}},[`source`,`phase`,`kind`,`matchCount`,`winnerDiagnostic`,`tiebreak`]),b({source:y(`ref`),phase:y(`pre-action`),kind:y(`exact`)},[`source`,`phase`,`kind`]),b({source:y(`ref`),phase:y(`pre-action`),kind:y(`label-fallback`)},[`source`,`phase`,`kind`]),b({source:y(`direct-ios`),kind:y(`not-observed`)},[`source`,`kind`])]},T=b({foregroundApp:m(`Foreground app bundle id or name, when the capture carries it.`),nodeCount:_(`Node count in the post-action interactive-only capture.`),interactiveNodeCount:_(`Subset of nodeCount the platform reports as hittable.`),digest:m(`Order-independent digest of the post-action node multiset.`),changedFromBefore:h(`Whether the post-action digest differs from the pre-action capture digest. false is evidence, not failure.`)},[`nodeCount`,`interactiveNodeCount`,`digest`,`changedFromBefore`]),E=b({settled:h(`Whether the UI held the quiet window before the deadline. false is advisory, not failure.`),waitedMs:_(),captures:_(),quietMs:_(),timeoutMs:_(),refsGeneration:_(`Snapshot generation of the stored settled tree; refs on added diff lines were minted from it.`),refs:{type:`array`,items:b({ref:m(`Plain ref body (e12) minted from the stored settled tree.`)},[`ref`])},diff:b({summary:b({additions:_(),removals:_(),unchanged:_()},[`additions`,`removals`,`unchanged`]),lines:{type:`array`,items:b({kind:v([`added`,`removed`]),text:m(),ref:m(`Plain ref body (e12) for added lines.`)},[`kind`,`text`])},truncated:h(`Lines were capped to the response bound.`)},[`summary`,`lines`],`Settled diff vs the pre-action tree (changed lines only).`),tail:{type:`array`,description:`Unchanged interactive refs tail: still-present, actionable elements from the settled tree, attached only when diff carries zero added-line refs (a modal-dismiss/toast-only diff).`,items:b({ref:m(`Plain ref body (e12) minted from the stored settled tree.`),role:m(),label:m()},[`ref`,`role`])},tailTruncated:h(`Present (true) when tail candidates exceeded the response cap.`),hint:m()},[`settled`,`waitedMs`,`captures`,`quietMs`,`timeoutMs`]),D={platform:v(u),target:v(d),device:m(`Human-readable device name.`),id:m(`Stable device id.`),kind:v(g)},O=[`platform`,`target`,`device`,`id`,`kind`],le=b({success:h(),exitCode:_(),stdout:m(),stderr:m(),error:f(`Normalized error detail when shutdown failed.`)},[`success`,`exitCode`,`stdout`,`stderr`]),k=C({properties:{evidence:T,settle:E,button:v([`secondary`,`middle`]),count:_(`Number of press/click repetitions.`),intervalMs:_(`Delay between repeated press/click actions.`),holdMs:_(`Hold duration for each action.`),jitterPx:_(`Randomization radius in pixels.`),doubleTap:h(`Whether the command requested a double-tap action.`)}}),ue={press:k,click:k,fill:C({properties:{text:m(`Text submitted to the field.`),delayMs:_(`Delay between typed characters in milliseconds.`),evidence:T,settle:E},required:[`text`]}),longpress:C({properties:{durationMs:_(),settle:E,gesture:y(`longpress`)}}),find:b({ref:m(`Snapshot ref without the @ prefix when the find action returns one.`),refsGeneration:_(`ADR 0014 ref frame epoch for read-only find actions.`),found:h(`Whether a wait/exists/read-only find satisfied its condition.`),waitedMs:_(`Milliseconds waited for a read-only find condition.`),text:m(`Text value returned by find get_text.`),node:f(`Snapshot node for find get_attrs/get_text.`),locator:m(`Locator kind used for the find action.`),query:m(`Query argument used for the find action.`),x:_(`Resolved x coordinate for mutating find actions.`),y:_(`Resolved y coordinate for mutating find actions.`),message:m(`Diagnostic message for mutating find actions.`),settle:E,cost:S},[],`Daemon response data for the find command.`),boot:b({...D,booted:{type:`boolean`,const:!0}},[...O,`booted`]),shutdown:b({...D,shutdown:le},[...O,`shutdown`]),viewport:b({width:_(),height:_(),message:m()},[`width`,`height`,`message`]),...p,wait:b({waitedMs:_(),kind:y(`selector`),text:m(),selector:m(),captures:_(),nodeCount:_(),hint:m(),warning:m()},[`waitedMs`]),prepare:b({action:y(`ios-runner`),platform:v(u),deviceId:m(),deviceName:m(),kind:v(g),durationMs:_(),runner:b({},[]),cache:v([`exact`,`restore-key`,`miss`,`external`]),artifact:v([`valid`,`rebuilt`]),buildMs:_(),connectMs:_(),healthCheckMs:_(),xctestrunPath:m(),recoveryReason:m(),failureReason:m(),timing:b({totalMs:_(),additiveParts:b({buildMs:_(),connectAfterBuildMs:_(),healthCheckMs:_()},[`connectAfterBuildMs`,`healthCheckMs`]),containment:b({connectMs:{type:`array`,items:y(`buildMs`)},healthCheckMs:{type:`array`,items:m()}},[`healthCheckMs`]),note:m()},[`totalMs`,`additiveParts`,`containment`,`note`]),message:m()},[`action`,`platform`,`deviceId`,`deviceName`,`kind`,`durationMs`,`runner`,`connectMs`,`healthCheckMs`,`timing`,`message`]),push:{type:`object`,oneOf:[b({platform:y(`ios`),bundleId:m(),message:m()},[`platform`,`bundleId`,`message`]),b({platform:y(`android`),package:m(),action:m(),extrasCount:_(),message:m()},[`platform`,`package`,`action`,`extrasCount`,`message`])]},"trigger-app-event":b({event:m(),eventUrl:m(),transport:y(`deep-link`),message:m()},[`event`,`eventUrl`,`transport`,`message`]),clipboard:{type:`object`,oneOf:[b({action:y(`read`),text:m()},[`action`,`text`]),b({action:y(`write`),textLength:_(),message:m()},[`action`,`textLength`,`message`])]},appstate:{type:`object`,oneOf:[b({platform:v([`ios`,`macos`]),appName:m(),appBundleId:m(),source:y(`session`),surface:v(s),device_udid:m(`iOS only — the session device UDID.`),ios_simulator_device_set:{type:[`string`,`null`],description:`iOS only — the simulator set path, or null when unknown.`}},[`platform`,`appName`,`source`,`surface`]),b({platform:y(`android`),package:m(),activity:m()},[`platform`,`package`,`activity`])]},keyboard:b({platform:v([`android`,`ios`]),action:v([`status`,`dismiss`,`enter`]),visible:h(),wasVisible:h(),dismissed:h(),attempts:_(),inputType:m(),type:v([`text`,`number`,`email`,`phone`,`password`,`datetime`,`unknown`]),inputMethodPackage:m(),focusedPackage:m(),focusedResourceId:m(),inputOwner:v([`app`,`ime`,`unknown`]),message:m()},[`platform`,`action`]),doctor:b({status:v([`pass`,`warn`,`fail`,`info`]),summary:m(),kind:v([`auto`,`react-native`,`expo`,`repack`]),platform:m(),target:v(d),targetApp:m(),metro:b({host:m(),port:_()},[`host`,`port`]),checks:{type:`array`,items:b({id:m(),status:v([`pass`,`warn`,`fail`,`info`]),summary:m(),hint:m(),command:m(),evidence:f()},[`id`,`status`,`summary`])}},[`status`,`summary`,`kind`,`checks`]),diff:b({mode:y(`snapshot`),baselineInitialized:h(),summary:b({additions:_(),removals:_(),unchanged:_()},[`additions`,`removals`,`unchanged`]),lines:{type:`array`,items:b({kind:v([`added`,`removed`]),text:m(),ref:m()},[`kind`,`text`])},warnings:x},[`mode`,`baselineInitialized`,`summary`,`lines`]),replay:b({replayed:_(),healed:_(),session:m(),sessionActive:h(`True iff the session is still active — the script had no terminal close.`),artifactPaths:x,snapshotDiagnostics:f(),message:m()},[`replayed`,`healed`,`session`,`sessionActive`,`artifactPaths`,`message`]),test:b({total:_(),executed:_(),passed:_(),failed:_(),skipped:_(),notRun:_(),durationMs:_(),failures:{type:`array`,items:f()},tests:{type:`array`,items:f()},snapshotDiagnostics:f()},[`total`,`executed`,`passed`,`failed`,`skipped`,`notRun`,`durationMs`,`failures`,`tests`]),record:{type:`object`,oneOf:[b({recording:y(`started`),outPath:m(),sessionStateDir:m(),recordingBackend:m(),recordingScope:m(),recordOnlySession:h(),activeSessionApp:f(),showTouches:h()},[`recording`,`outPath`,`sessionStateDir`,`showTouches`]),b({recording:y(`stopped`),outPath:m(),telemetryPath:m(),artifacts:{type:`array`,items:se},recordingBackend:m(),recordingScope:m(),recordOnlySession:h(),activeSessionApp:f(),durationMs:_(),showTouches:h(),warning:m(),overlayWarning:m(),chunks:{type:`array`,items:f()}},[`recording`,`outPath`,`artifacts`,`durationMs`,`showTouches`])]},trace:{type:`object`,oneOf:[b({trace:y(`started`),outPath:m()},[`trace`,`outPath`]),b({trace:y(`stopped`),outPath:m()},[`trace`,`outPath`])]}},de={devices:{type:`object`,properties:{devices:{type:`array`,items:{type:`object`,properties:{platform:{type:`string`,enum:u},target:{type:`string`,enum:d},kind:{type:`string`,enum:g},id:{type:`string`},name:{type:`string`}},required:[`platform`,`target`,`kind`,`id`,`name`]}}},required:[`devices`]},apps:{type:`object`,properties:{apps:{type:`array`,items:{type:`string`}}},required:[`apps`]}},A={...ue,...de};function j(t){return e(t)}function M(e){let t=[`Error (${e.code}): ${e.message}`];e.hint&&t.push(`Hint: ${e.hint}`),e.supportedOn&&t.push(`Supported on: ${e.supportedOn}`);let n=c(e.details);return n&&t.push(n),t.join(`
|
|
2
|
+
`)}function N(e,t,n){let r=oe({command:e,cwd:process.cwd(),cliFlags:t}),i={};for(let[t,a]of Object.entries(r))Object.hasOwn(n,t)&&ae(t,e)&&(i[t]=a);return re(i,t)}const P={devices:e=>({devices:e.map(o)}),apps:e=>({apps:e})};function F(e,t){let n=P[e];return n?n(t):t}function I(){let e=new Map;return{pinInput:(t,n,r)=>ve(t,n,B(e,r,n.session)),mergeCommandResult:(t,n,r,i)=>H(e,t,n,r,i),mergeDivergenceScreen:(t,n,r)=>ge(e,V(n,r),t)}}const L=new Set([`snapshot`,`find`]),R=new Set([`press`,`click`,`fill`,`longpress`]),z=new Set([`press`,`click`,`fill`,`longpress`,`get`]);function B(e,t,n){return e.get(V(t,n))}function V(e,t){let n=typeof t==`string`&&t.length>0?t:`default`;return`${e??``}\u0000${n}`}function H(e,t,n,r,i){let a=V(r,i);if(R.has(t)){me(e,a,n);return}L.has(t)&&(t===`find`?pe(e,a,n):fe(e,a,n))}function fe(e,t,n){let r=n.refsGeneration;if(typeof r!=`number`){e.delete(t);return}let i=[];for(let{ref:e}of n.refs??[])i.push(e);for(let e of n.nodes??[])i.push(e.ref);U(e,t,i,r)}function pe(e,t,n){let r=n.refsGeneration,i=n.ref;typeof r!=`number`||typeof i!=`string`||!i.startsWith(`@`)||U(e,t,[i.slice(1)],r)}function me(e,t,n){let{settle:r}=n;r?.refsGeneration!==void 0&&U(e,t,[...r.diff?.lines??[],...r.refs??[],...r.tail??[]].map(e=>e.ref).filter(e=>typeof e==`string`),r.refsGeneration)}function U(e,t,n,r){if(n.length===0)return;let i=e.get(t)??new Map;e.set(t,i),he(i,n,r)}function he(e,t,n){for(let r of t)e.delete(r),e.set(r,n);for(;e.size>1e3;)e.delete(e.keys().next().value)}function ge(e,t,n){let r=a(a(n?.divergence)?.screen);if(r?.state!==`available`)return;let i=r.refsGeneration;if(typeof i!=`number`)return;let o=[];_e(r.refs,o),U(e,t,o,i)}function _e(e,t){if(Array.isArray(e))for(let n of e){let e=a(n)?.ref;typeof e==`string`&&e.length>0&&t.push(e)}}function ve(e,t,n){return n===void 0||n.size===0?t:e===`wait`?ye(t,n)??t:z.has(e)?be(t,n)??t:t}function ye(e,t){if(typeof e.ref!=`string`)return;let n=W(e.ref,t);return n===e.ref?void 0:{...e,ref:n}}function be(e,t){let n=a(e.target);if(n?.kind!==`ref`||typeof n.ref!=`string`)return;let r=W(n.ref,t);return r===n.ref?void 0:{...e,target:{...n,ref:r}}}function W(e,t){if(!e.startsWith(`@`)||e.includes(`~`))return e;let n=t.get(e.slice(1));return n===void 0?e:`${e}~s${n}`}function xe(){return ee().map(e=>{let t=e.name in A?A[e.name]:void 0;return{name:e.name,description:e.description,inputSchema:G(e.name,e.inputSchema),...t?{outputSchema:t}:{}}})}function Se(e={}){let n=I();return{execute:async(r,i)=>{if(!te(r))throw new t(`INVALID_ARGS`,`Unknown command tool: ${r}`);let a=G(r,ne(r).inputSchema).properties,o=N(r,i,a),s=De(o),c=je(o),l=n.pinInput(r,c,s.client.stateDir),u=await Te(e,s.client);try{let t=await(e.runCommand??Ee)(u,r,l);return n.mergeCommandResult(r,t,s.client.stateDir,c.session),{isError:!1,structuredContent:F(r,t),content:[{type:`text`,text:Me({name:r,input:c,result:t,outputFormat:s.outputFormat,responseLevel:s.client.responseLevel})}]}}catch(e){return Ce(e,n,s.client.stateDir,c.session)}}}}function Ce(e,t,n,r){let i=j(e);return t.mergeDivergenceScreen(i.details,n,r),{isError:!0,structuredContent:i,content:[{type:`text`,text:M(i)}]}}const we=Se();async function Te(e,t){if(e.createClient)return await e.createClient(t);let{createAgentDeviceClient:n}=await import(`./agent-device-client.js`).then(e=>e.t);return n(t)}async function Ee(e,t,n){return await(await import(`./command-surface.js`).then(e=>e.t)).runCommand(e,t,n)}function De(e){return{client:Oe(e),outputFormat:Ae(e.mcpOutputFormat)}}function Oe(e){let n=e.stateDir,r=e.includeCost,i=e.responseLevel,a={};if(n!==void 0){if(typeof n!=`string`||n.length===0)throw new t(`INVALID_ARGS`,`Expected stateDir to be a non-empty string.`);a.stateDir=n}if(r!==void 0){if(typeof r!=`boolean`)throw new t(`INVALID_ARGS`,`Expected includeCost to be a boolean.`);r&&(a.cost=!0)}let o=ke(i);return o!==void 0&&(a.responseLevel=o),a}function ke(e){if(e===void 0)return;let r=n.find(t=>t===e);if(r===void 0)throw new t(`INVALID_ARGS`,`Expected responseLevel to be one of 'digest', 'default', or 'full'.`);return r}function Ae(e){if(e===void 0)return`optimized`;if(e!==`optimized`&&e!==`json`)throw new t(`INVALID_ARGS`,`Expected mcpOutputFormat to be "optimized" or "json".`);return e}function je(e){let{stateDir:t,mcpOutputFormat:n,includeCost:r,responseLevel:i,...a}=e;return a}function G(e,t){let n=i(e);return{...t,properties:{...t.properties,...n&&!t.properties?.noRecord?{noRecord:{type:`boolean`,description:`Do not record this action.`}}:{},stateDir:{type:`string`,description:`Agent-device state directory.`},mcpOutputFormat:{type:`string`,enum:[`optimized`,`json`],description:`MCP text content format. Defaults to optimized agent-friendly text; use json for JSON text. Structured content is always returned separately.`},includeCost:{type:`boolean`,description:`Include per-command agent-cost (cost.wallClockMs, …) in structuredContent. Defaults to off; the default response shape is unchanged.`},responseLevel:{type:`string`,enum:[`digest`,`default`,`full`],description:`Response verbosity: token-cheap digest / default (today) / full. Defaults to default; the default response shape is unchanged.`}}}}function Me(e){if(e.outputFormat===`json`||e.responseLevel!==void 0&&e.responseLevel!=="default")return K(e.result);let t=ie({name:e.name,input:e.input,result:e.result});return typeof t?.text==`string`?t.text:K(t?.data??e.result)}function K(e){return typeof e==`string`?e:JSON.stringify(e,null,2)}async function Ne(e){if(e.jsonrpc!==`2.0`||typeof e.method!=`string`)return q(e.id??null,-32600,`Invalid JSON-RPC request.`);if(e.id===void 0)return null;try{return Re(e.id,await Pe(e.method,e.params))}catch(t){return t instanceof X?q(e.id,-32601,t.message):q(e.id,-32602,t instanceof Error?t.message:String(t))}}async function Pe(e,t){switch(e){case`initialize`:return{protocolVersion:Ie(t),capabilities:{tools:{}},serverInfo:{name:`agent-device`,version:l()}};case`ping`:return{};case`tools/list`:return{tools:xe()};case`tools/call`:return await Fe(t);default:throw new X(`Unsupported MCP method: ${e}`)}}async function Fe(e){let t=J(e),n=ze(t,`name`);try{return await we.execute(n,Y(t.arguments))}catch(e){return Le(M(j(e)),!0)}}function Ie(e){return`2025-11-25`}function Le(e,t=!1){return{isError:t,content:[{type:`text`,text:e}]}}function Re(e,t){return{jsonrpc:`2.0`,id:e,result:t}}function q(e,t,n){return{jsonrpc:`2.0`,id:e,error:{code:t,message:n}}}function J(e){if(!e||typeof e!=`object`||Array.isArray(e))throw new t(`INVALID_ARGS`,`Expected object parameters.`);return e}function Y(e){return e===void 0?{}:J(e)}function ze(e,n){let r=e[n];if(typeof r!=`string`||r.length===0)throw new t(`INVALID_ARGS`,`Expected ${n} to be a non-empty string.`);return r}var X=class extends Error{};async function Be(){let e=Ve(),t=new Ke(t=>{e.push(t)});process.stdin.setEncoding(`utf8`),process.stdin.on(`data`,e=>{try{t.push(e)}catch(e){$({jsonrpc:`2.0`,id:null,error:{code:-32700,message:e instanceof Error?e.message:String(e)}})}}),await new Promise(e=>{process.stdin.on(`end`,e),process.stdin.on(`close`,e),process.stdin.resume()}),await e.idle()}function Ve(e={}){let t=e.handlePayload??He,n=e.write??$,r=Promise.resolve();return{push:e=>{let i=Ge(e);r=r.then(async()=>{let r=await t(e);r&&n(r)}).catch(e=>{n({jsonrpc:`2.0`,id:i,error:{code:-32603,message:e instanceof Error?e.message:String(e)}})})},idle:async()=>{await r}}}function He(e){return Array.isArray(e)?Ue(e):Z(e)}async function Ue(e){let t=[];for(let n of e)t.push(...qe(await Z(n)));return t.length>0?t:null}async function Z(e){let t;try{t=r.parse(e)}catch{return We(Q(e))}return Ne(t)}function We(e){return{jsonrpc:`2.0`,id:e,error:{code:-32600,message:`Invalid JSON-RPC request.`}}}function Ge(e){return Array.isArray(e)?e.length===1?Q(e[0]):null:Q(e)}function Q(e){if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.id;if(typeof t==`string`||typeof t==`number`||t===null)return t}return null}var Ke=class{buffer=``;sink;constructor(e){this.sink=e}push(e){for(this.buffer+=e;;){let e=this.tryReadLineMessage();if(e!==void 0){this.emit(e);continue}break}}tryReadLineMessage(){let e=this.buffer.indexOf(`
|
|
3
3
|
`);if(e===-1)return;let t=this.buffer.slice(0,e).trim();return this.buffer=this.buffer.slice(e+1),t.length>0?t:void 0}emit(e){this.sink(JSON.parse(e))}};function qe(e){return e?[e]:[]}function $(e){process.stdout.write(`${JSON.stringify(e)}\n`)}export{Be as runAgentDeviceMcpServer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,dt as t,gt as n,l as r,pt as i,s as a,vt as o,yt as s}from"./sdk-selectors.js";import{a as c,i as l,o as u,u as d}from"./android-input-method-overlays.js";import{
|
|
1
|
+
import{a as e,dt as t,gt as n,l as r,pt as i,s as a,vt as o,yt as s}from"./sdk-selectors.js";import{a as c,i as l,o as u,u as d}from"./android-input-method-overlays.js";import{Ut as f}from"./internal/daemon.js";function p(e,t={}){let n=t.mode??`action`,{node:r,preActionNodes:i}=e;if(typeof r.index!=`number`)return;let a=c(i),o=S(_(r),i);if(n===`landmark`&&o.id===void 0&&o.label===void 0)return;let s=l(r,a,8),u=s.chain,d=v(i,r),f=y(r,a),p=x(r),b=+(u.length>0),w=e=>{let t=u.slice(0,e),n=C({nodes:i,byIndex:a,node:r,identity:o,ancestry:t,sibling:d,scrollRegion:f});return{candidate:{...o,ancestry:t,sibling:d,viewportOrder:n.viewportOrder,...f?{scrollRegion:f}:{},...p?{rect:p}:{},verification:`verified`},domain:n}};for(let e=u.length;e>=b;--e){let{candidate:t,domain:i}=w(e);if(h(t))return t.verification=m({node:r,domain:i,mode:n,brokenWalk:s.broken}),t;if(e===b)return g(t)}}function m(e){return e.brokenWalk?`unverifiable`:e.mode===`landmark`?`verified`:T({node:e.node,domain:e.domain})}function h(e){return s(o({...e,verification:`unverifiable`}))<=t}function g(e){return e.verification=`unverifiable`,s(o(e))>4096&&delete e.rect,e}const _=a;function v(e,t){return r(e,t)}function y(e,t){let n=f(e,t);if(!n)return;let r=_(n);return{role:r.role,...r.id===void 0?r.label===void 0?{}:{label:r.label}:{id:r.id}}}function b(e,t){return!e&&!t?!0:!e||!t?!1:n(e,t)}function x(e){let t=e.rect;if(t)return{x:t.x,y:t.y,width:t.width,height:t.height}}function S(t,n){return e(t,n)}function C(e){let{nodes:t,byIndex:n,node:r,identity:i,ancestry:a,sibling:o,scrollRegion:s}=e,c=u(t,n,i,a),l=c.filter(e=>v(t,e)===o),d=c.length>0?c.filter(e=>b(y(e,n),s)):void 0,f=d?w(d):[];return{identitySet:c,siblingMatches:l,regionMembers:d,orderedRegion:f,viewportOrder:Math.max(f.findIndex(e=>e.index===r.index),0)}}function w(e){return e.map((e,t)=>({node:e,documentOrder:t,center:d(e.rect)})).sort((e,t)=>!e.center&&!t.center?e.documentOrder-t.documentOrder:e.center?t.center?e.center.y===t.center.y?e.center.x===t.center.x?e.documentOrder-t.documentOrder:e.center.x-t.center.x:e.center.y-t.center.y:-1:1).map(e=>e.node)}function T(e){let{node:t,domain:n}=e,r=t.ref,a=n.identitySet.map(e=>e.ref);return i({winnerRef:r,matchedRefs:a,identitySetRefs:a,siblingMatchRefs:n.siblingMatches.map(e=>e.ref),regionMemberRefs:n.regionMembers?.map(e=>e.ref),viewportCandidateRef:n.orderedRegion[n.viewportOrder]?.ref}).outcome}export{w as a,p as i,y as n,b as o,v as r,_ as t};
|