agent-device 0.17.6 → 0.17.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/android-multitouch-helper/dist/{agent-device-android-multitouch-helper-0.17.6.apk → agent-device-android-multitouch-helper-0.17.8.apk} +0 -0
- package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.17.8.apk.sha256 +1 -0
- package/android-multitouch-helper/dist/{agent-device-android-multitouch-helper-0.17.6.manifest.json → agent-device-android-multitouch-helper-0.17.8.manifest.json} +4 -4
- package/android-snapshot-helper/dist/{agent-device-android-snapshot-helper-0.17.6.apk → agent-device-android-snapshot-helper-0.17.8.apk} +0 -0
- package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.17.8.apk.sha256 +1 -0
- package/android-snapshot-helper/dist/{agent-device-android-snapshot-helper-0.17.6.manifest.json → agent-device-android-snapshot-helper-0.17.8.manifest.json} +6 -6
- package/dist/src/2133.js +1 -1
- package/dist/src/2577.js +1 -0
- package/dist/src/2948.js +1 -1
- package/dist/src/4291.js +1 -2
- package/dist/src/4428.js +3 -3
- package/dist/src/4723.js +1 -1
- package/dist/src/5910.js +2 -0
- package/dist/src/6311.js +18 -18
- package/dist/src/7244.js +1 -1
- package/dist/src/8184.js +1 -1
- package/dist/src/8358.js +4 -0
- package/dist/src/9581.js +22 -1
- package/dist/src/9722.js +36 -36
- package/dist/src/9873.js +1 -1
- package/dist/src/9919.js +5 -5
- package/dist/src/android-adb.d.ts +1 -1
- package/dist/src/batch.d.ts +1 -1
- package/dist/src/cli-help.js +140 -30
- package/dist/src/cli-output.js +4 -4
- package/dist/src/cli.js +28 -17
- package/dist/src/contracts.d.ts +1 -1
- package/dist/src/index.d.ts +7 -4
- package/dist/src/interaction.js +1 -1
- package/dist/src/internal/bin.js +1 -1
- package/dist/src/provider.js +1 -0
- package/dist/src/record-trace-recording.js +3 -3
- package/dist/src/remote-config.d.ts +1 -1
- package/dist/src/selector-runtime.js +1 -1
- package/dist/src/selectors.d.ts +2 -2
- package/dist/src/session.js +8 -8
- package/dist/src/snapshot.js +1 -1
- package/dist/src/web.js +1 -0
- package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +6 -6
- package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +1 -1
- package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift +9 -5
- package/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +0 -2
- package/ios-runner/AgentDeviceRunner/RecordingScripts/recording-overlay.swift +44 -8
- package/ios-runner/AgentDeviceRunner/RecordingScripts/recording-resize.swift +59 -16
- package/ios-runner/RUNNER_PROTOCOL.md +1 -1
- package/package.json +5 -2
- package/server.json +2 -2
- package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.17.6.apk.sha256 +0 -1
- package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.17.6.apk.sha256 +0 -1
- package/dist/src/2892.js +0 -4
- package/dist/src/5299.js +0 -1
package/dist/src/6311.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import e from"node:path";import{styleText as t}from"node:util";import{buildMobileSnapshotPresentation as n,displayNodeLabel as r}from"./9873.js";import{normalizeError as i,AppError as o}from"./733.js";import{
|
|
2
|
-
`)}function
|
|
1
|
+
import e from"node:path";import{styleText as t}from"node:util";import{buildMobileSnapshotPresentation as n,displayNodeLabel as r}from"./9873.js";import{normalizeError as i,AppError as o}from"./733.js";import{isSnapshotBackend as l,usesMobileSnapshotPresentation as s}from"./4291.js";import{buildSnapshotDisplayLines as a,formatSnapshotLine as u}from"./7244.js";function d(e){return e.width>0&&e.height>0}function f(e,t){return!!e&&!!t&&e.x>=t.x-2&&e.y>=t.y-2&&e.x+e.width<=t.x+t.width+2&&e.y+e.height<=t.y+t.height+2}function c(e){return"number"!=typeof e.parentIndex}function h(e){let t=(e.type??"").toLowerCase(),n=(e.identifier??"").trim().toLowerCase();return t.includes("edittext")||t.includes("textfield")||"composer"===n}function p(e){let t=(e.type??"").toLowerCase();return t.includes("scroll")||t.includes("list")||t.includes("recyclerview")}function g(e){var t;let n=r(e);if(!n||n!==e.identifier?.trim()||(t=n,!/^[\w.]+:id\/[\w.-]+$/i.test(t)))return n;let i=(e.type??"").toLowerCase();return i.includes("view")||i.includes("layout")||i.includes("image")||i.includes("list")||i.includes("recyclerview")||i.includes("collection")?"":n}function $(e){let t=e.trim().replace(/\s+/g," ").toLowerCase();return!t||/^(true|false|\d+)$/.test(t)?null:t}function x(e,t){let n=[],r=[t];for(;r.length>0;){let t=r.pop();for(let i of e)i.parentIndex===t&&(n.push(i),r.push(i.index))}return n}function m(e,t,n){let r=[t];for(;r.length>0;){let t=r.pop();if(!n.has(t))for(let i of(n.add(t),e))i.parentIndex!==t||n.has(i.index)||r.push(i.index)}}let y=["button","switch","checkbox","radio"],v=["button","image","textview","view"];function b(e){if(!0===e.hittable||h(e))return!1;let t=(e.type??"").toLowerCase();return t.includes("text")||t.includes("image")||t.includes("icon")}function C(e){if(!e.rect||!d(e.rect)||c(e)||h(e))return!1;let t=(e.type??"").toLowerCase();return"text"===t||M(t,v)}function w(e,t){let n=S(e);return S(t)>n?t:e}function S(e){let t=(e.type??"").toLowerCase(),n=0;return M(t,y)?n+=100:t.includes("image")?n+=30:t.includes("textview")||"text"===t?n+=20:t.includes("view")&&(n+=10),!0===e.hittable&&(n+=20),!1!==e.enabled&&(n+=5),n}function M(e,t){return t.some(t=>e.includes(t))}function N(e){process.stdout.write(`${JSON.stringify(e,null,2)}
|
|
2
|
+
`)}function I(e,t={}){let n=e instanceof o?i(e):e;process.stderr.write(`Error (${n.code}): ${n.message}
|
|
3
3
|
`),n.hint&&process.stderr.write(`Hint: ${n.hint}
|
|
4
4
|
`),n.diagnosticId&&process.stderr.write(`Diagnostic ID: ${n.diagnosticId}
|
|
5
5
|
`),n.logPath&&process.stderr.write(`Diagnostics Log: ${n.logPath}
|
|
6
6
|
`),t.showDetails&&n.details&&process.stderr.write(`${JSON.stringify(n.details,null,2)}
|
|
7
|
-
`)}function
|
|
8
|
-
`:""),T=function(e,t,n,i={nodes:t,filteredCount:0}){let
|
|
9
|
-
`:"",
|
|
7
|
+
`)}function A(e,t={}){var i,o,y,v;let S,M,N,I,O,_=e.nodes,k=Array.isArray(_)?_:[],L=s(l(e.backend)?e.backend:void 0),j=function(e,t,n){let r;if(n.raw||!((r=e.androidSnapshot)&&"object"==typeof r&&"android-helper"===r.backend))return{nodes:t,filteredCount:0};let i=function(e){var t,n;if(0===e.length)return e;let r=new Set,i=new Map,o=new Map(e.map(e=>[e.index,e]));(function(e,t){for(let n of e)!n.rect||d(n.rect)||c(n)||m(e,n.index,t)})(e,r),function(e,t,n,r){for(let i of e){if(n.has(i.index)||i.rect||c(i))continue;let o=function(e,t,n){let r=e;for(;"number"==typeof r.parentIndex;){let e=t.get(r.parentIndex);if(!e)break;if(n(e))return e;r=e}return null}(i,t,p);o&&function(e,t,n){if(!n)return;let r=e.get(t.index)??t;e.set(t.index,{...r,hiddenContentAbove:!0===r.hiddenContentAbove||"above"===n||void 0,hiddenContentBelow:!0===r.hiddenContentBelow||"below"===n||void 0})}(r,o,function(e,t){let n=t.filter(t=>t.parentIndex===e.parentIndex&&t.rect&&d(t.rect)).map(e=>e.index);return 0===n.length?null:e.index<Math.min(...n)?"above":e.index>Math.max(...n)?"below":null}(i,e)),m(e,i.index,n)}}(e,o,r,i);for(let n of e){if(r.has(n.index)||!(!0===(t=n).hittable&&!h(t)&&t.rect&&d(t.rect)&&0===g(t).trim().length))continue;let o=function(e,t,n){let r=[],i=[],o=new Set;for(let l of e){if(n.has(l.index)||!b(l)||!f(l.rect,t.rect))continue;let e=g(l).trim().replace(/\s+/g," "),s=$(e);i.push(l.index),!e||!s||o.has(s)||(o.add(s),r.push(e))}return{label:r.join(", "),removableIndexes:i}}(x(e,n.index),n,r);if(o.label)for(let t of(i.set(n.index,{...n,...i.get(n.index),label:o.label}),o.removableIndexes))m(e,t,r)}for(let t of e){if(r.has(t.index)||!(!0===(n=t).hittable&&!h(n)&&n.rect&&d(n.rect)&&$(g(n))))continue;let i=$(g(t));if(!i)continue;let o=x(e,t.index).filter(e=>!r.has(e.index)&&function(e,t,n){if(!C(t)||!f(t.rect,e.rect))return!1;let r=$(g(t));return!!(r&&n!==r&&n.includes(r))}(t,e,i));for(let t of o.filter(b))m(e,t.index,r);let l=o.filter(e=>!b(e)),s=new Set(l.map(e=>$(g(e))).filter(e=>!!e));if(!(l.length<2)&&!(s.size<2))for(let t of l)m(e,t.index,r)}let l=new Map;for(let t of e){if(r.has(t.index)||!C(t))continue;let n=$(g(t));if(!n)continue;let o=l.get(n);if(o&&function(e,t,n){var r,i,o,l;return!n.has(e.index)&&(r=e.rect,i=t.rect,!r||!i||Math.abs(r.y+r.height/2-(i.y+i.height/2))<=Math.max(r.height,i.height,1))&&(o=e,l=t,(o.parentIndex===l.parentIndex?3>=Math.abs(o.index-l.index):o.parentIndex!==l.index&&l.parentIndex!==o.index&&1>=Math.abs((o.depth??0)-(l.depth??0))&&2>=Math.abs(o.index-l.index))||function(e,t){let n=e.parentIndex===t.index?t:t.parentIndex===e.index?e:null,r=n?.index===e.index?t:n?.index===t.index?e:null;return!!n&&!!r&&w(n,r).index===n.index}(e,t))}(o,t,r)){let s=function(e,t,n,r,i){var o,l,s;let a=w(t,n),u=a.index===t.index?n:t,d=(u.type??"").toLowerCase().includes("image")?"has image":null,f=i.get(a.index)??a,c=i.get(u.index)?.presentationHints??u.presentationHints;return i.set(a.index,{...f,presentationHints:(o=f.presentationHints,l=c,s=d,[...new Set([...Array.isArray(o)?o:[],...Array.isArray(l)?l:[],...s?[s]:[]])])}),m(e,u.index,r),i.get(a.index)??a}(e,o,t,r,i);l.set(n,s);continue}l.set(n,t)}return e.filter(e=>!r.has(e.index)).map(e=>i.get(e.index)??e)}(t);return{nodes:i,filteredCount:t.length-i.length}}(e,k,t),H=(S="string"==typeof(i=e).appName?i.appName:void 0,M="string"==typeof i.appBundleId?i.appBundleId:void 0,N=[],S&&N.push(`Page: ${S}`),M&&N.push(`App: ${M}`),N.length>0?`${N.join("\n")}
|
|
8
|
+
`:""),T=function(e,t,n,i={nodes:t,filteredCount:0}){var o;let l=K(e);if(!(o=e).snapshotQuality&&!function(e){let t=e.snapshotDiagnostics;if(!t||"object"!=typeof t)return!1;let n=t.stats;return!!(n&&"object"==typeof n&&"web"===n.platform)}(o)){let e=function(e,t){if(!0===t.scoped||!0===t.depthLimited||e.length>3)return null;let n=1===e.length?"node":"nodes";return`Hint: sparse accessibility snapshot returned ${e.length} ${n}; snapshot state is invalid or unavailable for this screen. Use plain screenshot, not screenshot --overlay-refs, as visual truth. If screenshot shows the Home Screen or another app, run open for this app again first. Then navigate away with coordinates if needed and retry snapshot -i on the next screen.`}(t,n);e&&l.push(e)}!n.raw&&i.filteredCount>0&&l.push(`Collapsed ${i.filteredCount} Android helper node${1===i.filteredCount?"":"s"} from the agent-facing text snapshot; use --raw or --json for the full hierarchy.`);let s=i.filteredCount>0?i.nodes:t;return!n.raw&&function(e){if(e.length<20)return!1;let t=new Map;for(let n of e){let e=(n.type??"").toLowerCase(),i=function(e){var t;let n=e.trim().replace(/\s+/g," ").toLowerCase();return!n||(t=n,/\S+@\S+\.\S+/.test(t))?null:n}(r(n));if(!i)continue;let o=`${e}|${i}`,l=t.get(o)??[];l.push(n),t.set(o,l)}let n=0;for(let e of t.values())!(e.length<=1)&&function(e){for(let r=0;r<e.length;r+=1)for(let i=r+1;i<e.length;i+=1){var t,n;if(t=e[r]?.rect,n=e[i]?.rect,!t||!n||!(t.x+t.width<=n.x+.5||n.x+n.width<=t.x+.5||t.y+t.height<=n.y+.5||n.y+n.height<=t.y+.5))return!0}return!1}(e)&&(n+=e.length);return n>=8}(s)&&l.push("Warning: possible repeated nav subtree detected."),l}(e,k,t,j),B=T.length>0?`${T.join("\n")}
|
|
9
|
+
`:"",D=t.raw?null:(I=e.unchanged)&&"object"==typeof I?"number"!=typeof I.ageMs||"number"!=typeof I.nodeCount?null:{ageMs:I.ageMs,nodeCount:I.nodeCount,interactiveOnly:!0===I.interactiveOnly||void 0,scope:"string"==typeof I.scope?I.scope:void 0}:null;if(D){let e;return`${H}${B}${e=function(e){if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${(Math.round(e/100)/10).toFixed(1)}s`;let t=e/6e4;return t<60?`${(Math.round(10*t)/10).toFixed(1)}m`:`${(Math.round(t/60*10)/10).toFixed(1)}h`}((o=D).ageMs),o.scope?`Scoped snapshot unchanged for scope "${o.scope}" since previous read ${e} ago.
|
|
10
10
|
Previous refs in this scope remain valid. Use find/get/is for a targeted query, or --force-full to re-emit.`:o.interactiveOnly?`Interactive snapshot unchanged since previous read ${e} ago.
|
|
11
11
|
${o.nodeCount} visible nodes are unchanged. Previous @e refs are still valid. Use find/get/is for a targeted query, or --force-full to re-emit.`:`Snapshot unchanged since previous read ${e} ago.
|
|
12
12
|
Refs from the previous snapshot are still valid. Use --force-full to re-emit the tree, or use find/get/is for a targeted query.`}
|
|
13
|
-
`}let
|
|
14
|
-
${
|
|
15
|
-
${
|
|
16
|
-
`:t.flatten?`${
|
|
17
|
-
${
|
|
18
|
-
`:`${
|
|
19
|
-
${
|
|
20
|
-
`}function
|
|
21
|
-
${e.summaryLines.join("\n")}`:""}function
|
|
13
|
+
`}let R=t.raw||!L?null:n(j.nodes),z=!!e.truncated,U=R?.nodes??k,E=t.raw||!L?null:function(e,t,n,r,i=0){let o,l=(o=e.visibility)&&"object"==typeof o&&"boolean"==typeof o.partial&&"number"==typeof o.visibleNodeCount&&"number"==typeof o.totalNodeCount&&Array.isArray(o.reasons)?{partial:o.partial,visibleNodeCount:o.visibleNodeCount,totalNodeCount:o.totalNodeCount,reasons:o.reasons.filter(e=>"string"==typeof e)}:null;if(0===i&&l)return l;let s=(t?.hiddenCount??0)+i,a=!!t&&t.nodes.some(e=>e.hiddenContentAbove||e.hiddenContentBelow);return s>0?{partial:!0,visibleNodeCount:n,totalNodeCount:Math.max(r,l?.totalNodeCount??r),reasons:[...new Set([...l?.reasons??[],"offscreen-nodes"])]}:l||(a?{partial:!0,visibleNodeCount:n,totalNodeCount:n,reasons:[]}:null)}(e,R,U.length,k.length,j.filteredCount),F=(y=k.length,v=E,O=z?" (truncated)":"",v?.partial?v.totalNodeCount>v.visibleNodeCount?`Snapshot: ${v.visibleNodeCount} visible nodes (${v.totalNodeCount} total)${O}`:`Snapshot: ${v.visibleNodeCount} visible nodes${O}`:`Snapshot: ${y} nodes${O}`);return 0===k.length?`${H}${F}
|
|
14
|
+
${B}`:t.raw?`${H}${F}
|
|
15
|
+
${B}${k.map(e=>JSON.stringify(e)).join("\n")}
|
|
16
|
+
`:t.flatten?`${H}${F}
|
|
17
|
+
${B}${a(U,{summarizeTextSurfaces:!0}).flatMap(e=>[u(e.node,0,!1,e.type,{summarizeTextSurfaces:!0}),...J({...e,depth:0})]).join("\n")}${P(R)}
|
|
18
|
+
`:`${H}${F}
|
|
19
|
+
${B}${(function(e){let t=[],n=[],r=new Map(e.map(e=>[e.node.index,e.node])),i=e=>{for(var i,o,l;n.length>0&&(!e||(i=e,o=n[n.length-1],l=r,!function(e,t,n){let r=e;for(;"number"==typeof r.parentIndex;){if(r.parentIndex===t.index)return!0;let e=n.get(r.parentIndex);if(!e)break;r=e}return!1}(i.node,o.node,l)&&i.depth<=o.depth));)t.push(...J(n.pop(),"below"))};for(let r of e)i(r),t.push(r.text),t.push(...J(r,"above")),r.node.hiddenContentBelow&&n.push(r);return i(),t})(a(U,{summarizeTextSurfaces:!0})).join("\n")}${P(R)}
|
|
20
|
+
`}function P(e){return e&&e.summaryLines.length>0?`
|
|
21
|
+
${e.summaryLines.join("\n")}`:""}function O(e){let t=!0===e.baselineInitialized,n=e.summary??{},r=B(n.additions),i=B(n.removals),o=B(n.unchanged),l=D(),s=K(e),a=s.length>0?`${s.join("\n")}
|
|
22
22
|
`:"";if(t)return`${a}Baseline initialized (${o} lines).
|
|
23
|
-
`;let u=(function(e){if(0===e.length)return e;let t=e.map((e,t)=>({index:t,kind:e.kind})).filter(e=>"added"===e.kind||"removed"===e.kind).map(e=>e.index);if(0===t.length)return e;let n=Array(e.length).fill(!1);for(let r of t){let t=Math.max(0,r-1),i=Math.min(e.length-1,r+1);for(let e=t;e<=i;e+=1)n[e]=!0}return e.filter((e,t)=>n[t])})(Array.isArray(e.lines)?e.lines:[]).map(e=>{let t="string"==typeof e.text?e.text:"";if("added"===e.kind){let e=t.startsWith(" ")?`+${t}`:`+ ${t}`;return l?
|
|
23
|
+
`;let u=(function(e){if(0===e.length)return e;let t=e.map((e,t)=>({index:t,kind:e.kind})).filter(e=>"added"===e.kind||"removed"===e.kind).map(e=>e.index);if(0===t.length)return e;let n=Array(e.length).fill(!1);for(let r of t){let t=Math.max(0,r-1),i=Math.min(e.length-1,r+1);for(let e=t;e<=i;e+=1)n[e]=!0}return e.filter((e,t)=>n[t])})(Array.isArray(e.lines)?e.lines:[]).map(e=>{let t="string"==typeof e.text?e.text:"";if("added"===e.kind){let e=t.startsWith(" ")?`+${t}`:`+ ${t}`;return l?R(e,"green"):e}if("removed"===e.kind){let e=t.startsWith(" ")?`-${t}`:`- ${t}`;return l?R(e,"red"):e}return l?R(t,"dim"):t}),d=u.length>0?`${u.join("\n")}
|
|
24
24
|
`:"";if(!l)return`${a}${d}${r} additions, ${i} removals, ${o} unchanged
|
|
25
|
-
`;let f=`${
|
|
26
|
-
`}function
|
|
27
|
-
`}function
|
|
25
|
+
`;let f=`${R(String(r),"green")} additions, ${R(String(i),"red")} removals, ${R(String(o),"dim")} unchanged`;return`${a}${d}${f}
|
|
26
|
+
`}function _(e){var t,n,r,i;let o,l,s,a,u=D(),d=!0===e.match,f=e.dimensionMismatch,c=[];return c.push(...function(e,t){if(!0===e.match){let e=t?R("✓","green"):"✓";return[`${e} Screenshots match.`]}let n=e.dimensionMismatch,r=t?R("✗","red"):"✗";if(n){let e=n.expected,t=n.actual;return[`${r} Screenshots have different dimensions: expected ${e?.width}x${e?.height}, got ${t?.width}x${t?.height}`]}let i=B(e.differentPixels),o=B(e.mismatchPercentage),l=0===o&&i>0?"<0.01":String(o),s=`${l}% pixels differ`;return[`${r} ${t?R(s,"red"):s}`]}(e,u)),c.push(...function(e,t,n){if(t)return[];let r=[];if(e.diffPath){let t=T(e.diffPath),i=n?R("Diff image:","dim"):"Diff image:",o=n?R(t,"green"):t;r.push(` ${i} ${o}`)}if(e.currentOverlayPath){let t=T(e.currentOverlayPath),i=n?R("Current overlay:","dim"):"Current overlay:",o=n?R(t,"green"):t,l=B(e.currentOverlayRefCount),s=l>0?` (${l} refs)`:"";r.push(` ${i} ${o}${s}`)}return r}(e,d,u)),d||f||(c.push(...(t=e,n=u,o=B(t.differentPixels),l=B(t.totalPixels),s=n?R(String(o),"red"):String(o),[` ${s} different / ${l} total pixels`])),c.push(...(r=e,i=u,0===(a=function(e){let t=[];for(let n of(e.ocr?.movementClusters??[]).slice(0,2))t.push(`text movement cluster: ${function(e){let t=e.slice(0,4).map(e=>JSON.stringify(e)),n=e.length>t.length?` +${e.length-t.length} more`:"";return`${t.join(", ")}${n}`}(n.texts)} dx=${H(n.xRange)}px dy=${H(n.yRange)}px`);let n=(e.nonTextDeltas??[]).filter(e=>["icon","toggle","chevron"].includes(e.likelyKind)).slice(0,3);n.length>0&&t.push(`non-text controls: ${n.map(j).join("; ")}`);let r=(e.nonTextDeltas??[]).filter(e=>"separator"===e.likelyKind).slice(0,2);return r.length>0&&t.push(`non-text boundaries: ${r.map(j).join("; ")}`),t.slice(0,6)}(r)).length?[]:[` ${z("Hints:",i)}`,...a.map(e=>` - ${e}`)])),c.push(...function(e,t){let n=Array.isArray(e.regions)?e.regions:[];if(0===n.length)return[];let r=[` ${z("Changed regions:",t)}`];for(let e of n.slice(0,5))r.push(...function(e){let t=0===e.shareOfDiffPercentage&&e.differentPixels>0?"<0.01":String(e.shareOfDiffPercentage),n=e.rect,r=[` ${e.index}. ${e.location} x=${n.x} y=${n.y} ${n.width}x${n.height}, ${t}% of diff, change=${e.dominantChange}`],i=function(e){let t=[e.size?`size=${e.size}`:null,e.shape?`shape=${e.shape}`:null,"number"==typeof e.densityPercentage?`density=${e.densityPercentage}%`:null,e.averageBaselineColorHex&&e.averageCurrentColorHex?`avgColor=${e.averageBaselineColorHex}->${e.averageCurrentColorHex}`:null,"number"==typeof e.baselineLuminance&&"number"==typeof e.currentLuminance?`luminance=${e.baselineLuminance}->${e.currentLuminance}`:null].filter(e=>null!==e);return t.length>0?t.join(" "):null}(e);i&&r.push(` ${i}`);let o=e.currentOverlayMatches?.[0];if(o){let e=o.label?` "${o.label}"`:"";r.push(` overlaps @${o.ref}${e}, ${o.regionCoveragePercentage}% of region`)}return r}(e));return r}(e,u)),c.push(...function(e,t){let n=e.ocr?.matches??[];if(0===n.length)return[];let r=n.slice(0,8),i=[` ${z(`OCR text deltas (${e.ocr?.provider}; baselineBlocks=${e.ocr?.baselineBlocks} currentBlocks=${e.ocr?.currentBlocks}; showing ${r.length}/${n.length}; px):`,t)}`,` ${z("item | text | movePx | sizeDeltaPx | bboxBaseline | bboxCurrent | confidence | issueHint",t)}`];for(let[e,t]of r.entries()){let n=t.delta;i.push(` ${e+1} | ${JSON.stringify(t.text)} | ${L(n.x)},${L(n.y)} | ${L(n.width)},${L(n.height)} | ${k(t.baselineRect)} | ${k(t.currentRect)} | ${t.confidence} | ${t.possibleTextMetricMismatch?"ocr-bbox-size-change":"-"}`)}return i}(e,u)),c.push(...function(e,t){let n=e.nonTextDeltas??[];if(0===n.length)return[];let r=n.slice(0,8),i=[` ${z(`Non-text visual deltas (showing ${r.length}/${n.length}; px):`,t)}`,` ${z("item | region | slot | kind | bboxCurrent | nearestText",t)}`];for(let e of r)i.push(` ${e.index} | ${e.regionIndex?`r${e.regionIndex}`:"-"} | ${e.slot} | ${e.likelyKind} | ${k(e.rect)} | ${e.nearestText?JSON.stringify(e.nearestText):"-"}`);return i}(e,u))),`${c.join("\n")}
|
|
27
|
+
`}function k(e){return`x=${e.x},y=${e.y},w=${e.width},h=${e.height}`}function L(e){return e>0?`+${e}`:String(e)}function j(e){let t=e.nearestText?` near ${JSON.stringify(e.nearestText)}`:"",n=e.regionIndex?` r${e.regionIndex}`:"";return`${e.likelyKind}${t}${n}`}function H(e){return e.min===e.max?L(e.min):`${L(e.min)}..${L(e.max)}`}function T(t){let n=process.cwd(),r=e.relative(n,t);return""!==r&&(r.startsWith("..")||e.isAbsolute(r))?t:""===r?".":`.${e.sep}${r}`}function B(e){return"number"==typeof e&&Number.isFinite(e)?e:0}function D(e=process.stdout){let t=process.env.FORCE_COLOR;return"string"==typeof t?"0"!==t:"string"!=typeof process.env.NO_COLOR&&!!e.isTTY}function R(e,n,r){return t(n,e,r)}function z(e,t){return t?R(e,"dim"):e}function K(e){let t=e.warnings;return Array.isArray(t)?t.filter(e=>"string"==typeof e&&e.length>0):[]}function J(e,t){var n;let r="scroll-area"===(n=e.type)||"list"===n||"collection"===n||"table"===n?n:null;if(!r)return[];let i=[];if(e.node.hiddenContentAbove&&"below"!==t&&i.push(`[content above ${r} hidden]`),e.node.hiddenContentBelow&&"above"!==t&&i.push(`[content below ${r} hidden]`),0===i.length)return[];let o=" ".repeat(e.depth+1);return i.map(e=>`${o}${e}`)}export{R as colorize,_ as formatScreenshotDiffText,O as formatSnapshotDiffText,A as formatSnapshotText,I as printHumanError,N as printJson,D as supportsColor};
|
package/dist/src/7244.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"node:fs";import t from"node:path";import{fileURLToPath as r}from"node:url";import{buildTextPreview as i,trimText as l,describeTextSurface as o}from"./9836.js";import{isSystemScrollIndicatorLabel as n}from"./9873.js";function a(){try{let r=c();return JSON.parse(e.readFileSync(t.join(r,"package.json"),"utf8")).version??"0.0.0"}catch{return"0.0.0"}}function c(){let i=t.dirname(r(import.meta.url)),l=i;for(let r=0;r<6;r+=1){let r=t.join(l,"package.json");if(e.existsSync(r))return l;l=t.dirname(l)}return i}let u={application:"application",navigationbar:"navigation-bar",tabbar:"tab-bar",button:"button",imagebutton:"button",link:"link",cell:"cell",statictext:"text",checkedtextview:"text",textfield:"text-field",edittext:"text-field",textarea:"text-view",switch:"switch",slider:"slider",image:"image",imageview:"image",webview:"webview",framelayout:"group",linearlayout:"group",relativelayout:"group",constraintlayout:"group",viewgroup:"group",view:"group",listview:"list",recyclerview:"list",collectionview:"collection",searchfield:"search",segmentedcontrol:"segmented-control",group:"group",window:"window",checkbox:"checkbox",radio:"radio",menuitem:"menu-item",toolbar:"toolbar",scrollarea:"scroll-area",scrollview:"scroll-area",nestedscrollview:"scroll-area",table:"table"};function s(e,t={}){let r=[],i=[];for(let l of e){let e=l.depth??0,o=l.label?.trim()||l.value?.trim()||l.identifier?.trim()||"",n=f(l.type??"Element");if("group"===n&&!o)continue;for(;r.length>0&&e<=r[r.length-1];)r.pop();let a=r.length;r.push(e),i.push({node:l,depth:a,type:n,text:d(l,a,!1,n,t)})}return i}function d(e,t,r,n,a={}){var c,u,s,
|
|
1
|
+
import e from"node:fs";import t from"node:path";import{fileURLToPath as r}from"node:url";import{buildTextPreview as i,trimText as l,describeTextSurface as o}from"./9836.js";import{isSystemScrollIndicatorLabel as n}from"./9873.js";function a(){try{let r=c();return JSON.parse(e.readFileSync(t.join(r,"package.json"),"utf8")).version??"0.0.0"}catch{return"0.0.0"}}function c(){let i=t.dirname(r(import.meta.url)),l=i;for(let r=0;r<6;r+=1){let r=t.join(l,"package.json");if(e.existsSync(r))return l;l=t.dirname(l)}return i}let u={application:"application",navigationbar:"navigation-bar",tabbar:"tab-bar",button:"button",imagebutton:"button",link:"link",cell:"cell",statictext:"text",checkedtextview:"text",textbox:"text-field",textfield:"text-field",edittext:"text-field",textarea:"text-view",switch:"switch",slider:"slider",image:"image",imageview:"image",webview:"webview",framelayout:"group",linearlayout:"group",relativelayout:"group",constraintlayout:"group",viewgroup:"group",view:"group",listview:"list",recyclerview:"list",collectionview:"collection",searchfield:"search",segmentedcontrol:"segmented-control",group:"group",window:"window",checkbox:"checkbox",radio:"radio",menuitem:"menu-item",toolbar:"toolbar",scrollarea:"scroll-area",scrollview:"scroll-area",nestedscrollview:"scroll-area",table:"table"};function s(e,t={}){let r=[],i=[];for(let l of e){let e=l.depth??0,o=l.label?.trim()||l.value?.trim()||l.identifier?.trim()||"",n=f(l.type??"Element");if("group"===n&&!o)continue;for(;r.length>0&&e<=r[r.length-1];)r.pop();let a=r.length;r.push(e),i.push({node:l,depth:a,type:n,text:d(l,a,!1,n,t)})}return i}function d(e,t,r,n,a={}){var c,u,s,x,b,g,v,y;let $,S=n??f(e.type??"Element"),_=o(e,S),k=(c=e,u=S,s=a,x=_,s.summarizeTextSurfaces&&x.shouldSummarize&&function(e,t,r){let i=l(e.label);if(i&&i!==r)return i;let o=l(e.identifier);if(o&&!w(o)&&o!==r)return o;switch(t){case"text":case"text-view":return"Text view";case"text-field":return"Text field";case"search":return"Search field";default:return""}}(c,u,x.text)||p(c,u)),C=" ".repeat(t),j=e.ref?`@${e.ref}`:"",E=(b=e,g=S,v=a,y=_,$=[],!1===b.enabled&&$.push("disabled"),$.push(...b.presentationHints??[]),v.summarizeTextSurfaces&&(!0===b.selected&&$.push("selected"),!0===b.focused&&$.push("focused"),m(g)&&$.push("editable"),function(e,t){if("scroll-area"===t)return!0;let r=(e.type??"").toLowerCase(),i=`${e.role??""} ${e.subrole??""}`.toLowerCase();return r.includes("scroll")||i.includes("scroll")}(b,g)&&$.push("scrollable"),y.shouldSummarize&&($.push(`preview:"${i(y.text).replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`),$.push("truncated"))),h($)).map(e=>` [${e}]`).join(""),L=k?` "${k}"`:"";return r?`${C}${j} [${S}]${E}`.trimEnd():`${C}${j} [${S}]${L}${E}`.trimEnd()}function p(e,t){var r,i;let l=e.label?.trim();if(l&&(r=t,i=l,("scroll-area"===r||"list"===r||"collection"===r||"table"===r)&&n(i)))return"";let o=e.value?.trim();if(m(t)){if(o)return o;if(l)return l}else if(l)return l;if(o)return o;let a=e.identifier?.trim();return!a||w(a)&&("group"===t||"image"===t||"list"===t||"collection"===t)?"":a}function f(e){var t;let r=e.replace(/XCUIElementType/gi,"").toLowerCase(),i=e.includes(".")&&(e.startsWith("android.")||e.startsWith("androidx.")||e.startsWith("com."));return(r.includes(".")&&(r=r.replace(/^android\.widget\./,"").replace(/^android\.view\./,"").replace(/^android\.webkit\./,"").replace(/^androidx\./,"").replace(/^com\.google\.android\./,"").replace(/^com\.android\./,""),i&&r.includes(".")&&(r=r.slice(r.lastIndexOf(".")+1))),"textview"===r)?i?"text":"text-view":(t=r,(Object.prototype.hasOwnProperty.call(u,t)?u[t]:void 0)||r||"element")}function m(e){return"text-field"===e||"text-view"===e||"search"===e}function w(e){return/^[\w.]+:id\/[\w.-]+$/i.test(e)}function h(e){return[...new Set(e)]}export{s as buildSnapshotDisplayLines,p as displayLabel,c as findProjectRoot,f as formatRole,d as formatSnapshotLine,a as readVersion};
|
package/dist/src/8184.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{setSessionSnapshot as e,captureSnapshot as r,isNavigationSensitiveAction as t,markPendingInteractionOutcome as n,markPostGestureStabilization as o,getSnapshotReferenceFrame as i,recordTouchVisualizationEvent as a,markAndroidSnapshotFreshness as c,stripInternalInteractionFlags as s}from"./9722.js";import{isSparseSnapshotQualityVerdict as d,successText as f}from"./9873.js";import{getAndroidScreenSize as u}from"./input-actions.js";import{emitDiagnostic as l}from"./432.js";async function h(t,n,o,i,a){let c={...n??{},snapshotInteractiveOnly:a.interactiveOnly},s=i(c,t.appBundleId,t.trace?.outPath),{snapshot:f}=await r({device:t.device,session:t,flags:c,outPath:c.out,logPath:s.logPath??"",androidFreshnessMode:a.androidFreshnessMode});return d(f.snapshotQuality)||(e(t,f),o.set(t.name,t)),f}function p(e){var r,t,n;let o,i,a,{data:
|
|
1
|
+
import{setSessionSnapshot as e,captureSnapshot as r,isNavigationSensitiveAction as t,markPendingInteractionOutcome as n,markPostGestureStabilization as o,getSnapshotReferenceFrame as i,recordTouchVisualizationEvent as a,markAndroidSnapshotFreshness as c,stripInternalInteractionFlags as s}from"./9722.js";import{isSparseSnapshotQualityVerdict as d,successText as f}from"./9873.js";import{getAndroidScreenSize as u}from"./input-actions.js";import{emitDiagnostic as l}from"./432.js";async function h(t,n,o,i,a){let c={...n??{},snapshotInteractiveOnly:a.interactiveOnly},s=i(c,t.appBundleId,t.trace?.outPath),{snapshot:f}=await r({device:t.device,session:t,flags:c,outPath:c.out,logPath:s.logPath??"",includeRects:a.includeRects,androidFreshnessMode:a.androidFreshnessMode});return d(f.snapshotQuality)||(e(t,f),o.set(t.name,t)),f}function p(e){var r,t,n;let o,i,a,c,{data:s,fallbackX:d,fallbackY:u,referenceFrame:l,extra:h}=e,p=(r=h,t=d,n=u,o="string"==typeof r?.ref?r.ref:void 0,i="string"==typeof r?.button?r.button:void 0,a="string"==typeof r?.gesture?r.gesture:void 0,c=void 0===t||void 0===n?"":` (${t}, ${n})`,("string"==typeof r?.text?`Filled ${Array.from(r.text).length} chars`:o?"longpress"===a?`Long pressed @${o}${c}`:i&&"primary"!==i?`Clicked ${i} @${o}${c}`:`Tapped @${o}${c}`:void 0)??("string"==typeof s?.message?s.message:void 0));return{...void 0===d||void 0===u?{}:{x:d,y:u},...l??{},...h??{},...s??{},...f(p)}}function g(e){let{session:r,sessionStore:i,command:d,positionals:f,retryPositionals:u,flags:l,result:h,responseData:p,actionStartedAt:g,actionFinishedAt:_,androidFreshnessBaseline:m}=e,v=s(l);return i.recordAction(r,{command:d,positionals:f,flags:v??{},result:h}),n({session:r,command:d,positionals:u??f,flags:l,preSnapshot:r.snapshot}),t(d)&&c(r,d,m??r.snapshot),o(r,d,u??f,l),a(r,d,f,h,v??{},g,_),{ok:!0,data:p}}async function _(e){let{session:r,flags:t,sessionStore:n,contextFromFlags:o,captureSnapshotForSession:a}=e;if(!r.recording)return;if(r.recording.touchReferenceFrame)return r.recording.touchReferenceFrame;if("android"===r.device.platform){let e=await u(r.device),t={referenceWidth:e.width,referenceHeight:e.height};return r.recording&&(r.recording.touchReferenceFrame=t),t}let c=i(r.snapshot);if(c)return r.recording&&(r.recording.touchReferenceFrame=c),c;if(!r.recording)return;let s=i(await a(r,t,n,o,{interactiveOnly:!0}));return s&&r.recording&&(r.recording.touchReferenceFrame=s),s}async function m(e){try{return await _(e)}catch(r){l({level:"warn",phase:"touch_reference_frame_resolve_failed",data:{platform:e.session.device.platform,error:r instanceof Error?r.message:String(r)}});return}}function v(e){return i({nodes:e,createdAt:0})}export{p as buildTouchVisualizationResult,g as finalizeTouchInteraction,h as interaction_snapshot_captureSnapshotForSession,v as readSnapshotNodesReferenceFrame,m as resolveDirectTouchReferenceFrameSafely};
|
package/dist/src/8358.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import e from"node:crypto";import t from"node:fs";import n from"node:path";import{resolveUserPath as r,expandUserHomePath as o}from"./9612.js";import{readVersion as s,findProjectRoot as i}from"./7244.js";function a(s,u={}){var l,c;let p,f=(l=s,c=u,(p=(l??"").trim())?r(p,{env:c.env}):function(r={}){var s;let a,u,l,c=n.join(o("~",{env:r.env}),".agent-device"),p=r.projectRoot??i();return(s=p,t.existsSync(n.join(s,"package.json"))&&t.existsSync(n.join(s,"src","daemon.ts")))?n.join(c,"dev",(a=function(e){try{return t.realpathSync.native(e)}catch{return n.resolve(e)}}(p),u=n.basename(a).replaceAll(/[^a-zA-Z0-9._-]+/g,"-"),l=e.createHash("sha1").update(a).digest("hex").slice(0,12),`${u||"agent-device"}-${l}`)):c}(c));return{baseDir:f,infoPath:n.join(f,"daemon.json"),lockPath:n.join(f,"daemon.lock"),logPath:n.join(f,"daemon.log"),sessionsDir:n.join(f,"sessions")}}function u(e){let t=(e??"").trim().toLowerCase();return"http"===t?"http":"dual"===t?"dual":"socket"}function l(e){let t=(e??"").trim().toLowerCase();return"auto"===t?"auto":"socket"===t?"socket":"http"===t?"http":"auto"}function c(e){return"tenant"===(e??"").trim().toLowerCase()?"tenant":"none"}function p(e){if(!e)return;let t=e.trim();if(t&&/^[a-zA-Z0-9._-]{1,128}$/.test(t))return t}let f=/(?:^|[^\w$.])(?:import|export)\s+(?:type\s+)?(?:[^'"`]*?\s+from\s+)?['"]([^'"]+)['"]/gm,m=/import\(\s*['"]([^'"]+)['"]\s*\)/gm,d=[".ts",".tsx",".js",".jsx",".mjs",".cjs"];function h(){let e=process.argv[1];return e?g(e):"unknown"}function g(r,o=i()){try{let s=n.resolve(o),i=[n.resolve(r)],a=new Set,u=[];for(;i.length>0;){let e=i.pop();if(!e||a.has(e))continue;a.add(e);let r=t.statSync(e);if(!r.isFile())continue;let o=n.relative(s,e)||e;u.push(`${o}:${r.size}:${Math.trunc(r.mtimeMs)}`);let l=t.readFileSync(e,"utf8");for(let t of function(e){let t=new Set;return M(e,f,t),M(e,m,t),[...t]}(l)){let r=function(e,t){let r=n.resolve(n.dirname(e),t),o=v(r);if(o)return o;for(let e of d){let t=v(`${r}${e}`);if(t)return t}for(let e of d){let t=v(n.join(r,`index${e}`));if(t)return t}return null}(e,t);r&&i.push(r)}}let l=u.sort().join("|"),c=e.createHash("sha1").update(l).digest("hex");return`graph:${u.length}:${c}`}catch{return"unknown"}}function M(e,t,n){t.lastIndex=0;let r=null;for(;null!==(r=t.exec(e));){let e=r[1]?.trim();e?.startsWith(".")&&n.add(e)}}function v(e){try{return t.statSync(e).isFile()?e:null}catch{return null}}let y=/^[A-Za-z0-9_@%+=:,./-]+$/;function S(e){return`'${e.replaceAll("'","'\\''")}'`}function j(e){return y.test(e)?e:S(e)}function x(e,t){let n=[],r=e+t.toString(),o=r.indexOf("\n");for(;-1!==o;){let e=r.slice(0,o).trim();r=r.slice(o+1),e&&n.push(e),o=r.indexOf("\n")}return{lines:n,buffer:r}}function $(e){return e.meta?.requestProgress==="replay-test"}function b(e){return!!e&&"object"==typeof e&&"progress"===e.type&&!!e.event}function w(e){return!!e&&"object"==typeof e&&"response"===e.type&&!!e.response}function D(e){return`${JSON.stringify({type:"progress",event:e})}
|
|
2
|
+
`}function k(e){return`${JSON.stringify({type:"response",response:e})}
|
|
3
|
+
`}function P(e){return`${JSON.stringify({type:"response",response:e})}
|
|
4
|
+
`}function _(e,t={}){return{ok:!0,service:e,version:s(),rpcProtocolVersion:1,...void 0!==t.upstream?{upstream:t.upstream}:{}}}function A(e,t){e&&(e.snapshotDiagnostics??={samples:[]}).samples.push({...t,durationMs:Math.max(0,Math.round(t.durationMs))})}function z(e){let t=e?.snapshotDiagnostics?.samples;if(t&&0!==t.length)return C(t)}function C(e){if(0===e.length)return;let t=R(e);return{stats:t,...t.p95Ms>=1500?{warning:N(t)}:{}}}function O(e){let t=e.flatMap(e=>(function(e){if(!e||e.count<=0)return[];let t=e.platform;return 1===e.count?[{durationMs:e.maxMs,platform:t}]:2===e.count?[{durationMs:e.p50Ms,platform:t},{durationMs:e.maxMs,platform:t}]:[...Array.from({length:e.count-3},()=>({durationMs:e.p50Ms,platform:t})),{durationMs:e.p50Ms,platform:t},{durationMs:e.p95Ms,platform:t},{durationMs:e.maxMs,platform:t}]})(e?.stats));if(0===t.length)return;let n=R(t);return{stats:n,...n.p95Ms>=1500?{warning:N(n)}:{}}}function E(e){if(!e||"object"!=typeof e||Array.isArray(e))return;let t=function(e){let t=H(e);if(!t)return;let n=function(e){let t={count:e.count,p50Ms:e.p50Ms,p95Ms:e.p95Ms,maxMs:e.maxMs,slowThresholdMs:e.slowThresholdMs};if(!Object.values(t).some(e=>"number"!=typeof e))return t}(t);if(n){var r;let e,o,s,i;return{...n,...(o="string"==typeof(r=t).platform?r.platform:void 0,i=(s=H(r.backends))&&(e=Object.entries(s).filter(e=>"number"==typeof e[1])).length>0?Object.fromEntries(e):void 0,{...o?{platform:o}:{},...i?{backends:i}:{}})}}}(e.stats);if(!t)return;let n="string"==typeof e.warning?e.warning:void 0;return{stats:t,...n?{warning:n}:{}}}function R(e){let t,n=e.map(e=>e.durationMs).sort((e,t)=>e-t);return{count:n.length,p50Ms:T(n,50),p95Ms:T(n,95),maxMs:n[n.length-1]??0,slowThresholdMs:1500,...1===new Set(t=e.map(e=>e.platform).filter(e=>!!e)).size?{platform:t[0]}:{},...function(e){let t={};for(let n of e)n.backend&&(t[n.backend]=(t[n.backend]??0)+1);return Object.keys(t).length>0?{backends:t}:{}}(e)}}function T(e,t){if(0===e.length)return 0;let n=Math.max(0,Math.ceil(t/100*e.length)-1);return e[Math.min(n,e.length-1)]??0}function N(e){let t=e.platform?`${e.platform} `:"";return`Warning: ${t}snapshots are slow in this run: p95 ${e.p95Ms}ms over ${e.count} captures. Possible causes: device load, app or dev server stuck, helper fallback, or stale daemon.`}function H(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:void 0}export{_ as buildDaemonHealthPayload,g as computeDaemonCodeSignature,x as consumeTextLines,b as isDaemonProgressEnvelope,w as isDaemonResponseEnvelope,O as mergeSnapshotDiagnostics,p as normalizeTenantId,E as readSnapshotDiagnosticsSummary,A as recordSnapshotTiming,h as resolveDaemonCodeSignature,a as resolveDaemonPaths,u as resolveDaemonServerMode,l as resolveDaemonTransportPreference,c as resolveSessionIsolationMode,D as serializeDaemonProgressEnvelope,k as serializeDaemonResponseEnvelope,P as serializeDaemonRpcResponseEnvelope,S as shellQuote,j as shellQuoteIfNeeded,$ as shouldStreamRequestProgress,z as summarizeSnapshotDiagnostics,C as summarizeSnapshotTimingSamples};
|
package/dist/src/9581.js
CHANGED
|
@@ -1 +1,22 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{COMMON_COMMAND_SUPPORTED_FLAG_KEYS as e,managementCliSchemas as t,perfCliSchemas as o,captureCliSchemas as a,observabilityCliSchemas as n,replayCliSchemas as r,interactionCliSchemas as s,recordingCliSchemas as i,METRO_PREPARE_FLAGS as d,batchCliSchemas as c,systemCliSchemas as l,reactNativeCliSchemas as p}from"./9873.js";import{listCommandMetadata as u,debuggingCliSchemas as m,metroCliSchemas as h}from"./2948.js";let g={auth:{usageOverride:"auth status|login|logout",listUsageOverride:"auth",helpDescription:"Manage cloud login state used by remote daemon and cloud device workflows.",summary:"Manage cloud login state used by remote daemon and cloud device workflows",positionalArgs:["status|login|logout"],supportedFlags:["remoteConfig","stateDir"]},connect:{usageOverride:"connect [--remote-config <path>] [--daemon-base-url <url>] [--tenant <id>] [--run-id <id>] [--lease-id <id>] [--lease-backend <backend>] [--force] [--no-login]",helpDescription:"Connect to a remote daemon, authenticate when needed, and save remote session state. AGENT_DEVICE_CLOUD_BASE_URL is the bridge/control-plane API origin; use AGENT_DEVICE_DAEMON_AUTH_TOKEN=adc_live_... for CI/service-token automation.",listUsageOverride:"connect",summary:"Attach CLI commands to a saved remote daemon/cloud lease; inspect for remote runs, tenants, or service-token CI",allowedFlags:["remoteConfig","daemonBaseUrl","tenant","runId","leaseId","leaseBackend","force","noLogin"],supportedFlags:["stateDir","daemonAuthToken","session","platform",...d,"launchUrl"]},connection:{usageOverride:"connection status",listUsageOverride:"connection",helpDescription:"Inspect active remote connection state",summary:"Inspect the active saved remote connection before assuming commands are local",positionalArgs:["status"],supportedFlags:["remoteConfig","stateDir","session"]},disconnect:{helpDescription:"Disconnect remote daemon state, stop owned Metro companion, and release lease",listUsageOverride:"disconnect",summary:"Clear remote connection state, stop owned Metro companions, and release remote leases",allowedFlags:["shutdown"],supportedFlags:["remoteConfig","stateDir","session"]},mcp:{helpDescription:"Start the official stdio MCP server. It exposes structured command tools backed by the agent-device client.",summary:"Start MCP server"},proxy:{usageOverride:"proxy [--host <host>] [--port <port>] [--daemon-auth-token <token>] [--state-dir <path>]",listUsageOverride:"proxy",helpDescription:`Expose the local daemon HTTP contract through a tunnel-friendly reverse proxy.
|
|
2
|
+
|
|
3
|
+
Run this on the host that has access to simulators/devices, then point another machine at the printed daemon base URL with --daemon-base-url or AGENT_DEVICE_DAEMON_BASE_URL.
|
|
4
|
+
|
|
5
|
+
The proxy starts or reuses a local HTTP daemon, accepts /health, /rpc, /upload, and /artifacts/*, and also accepts the same routes under /agent-device/*. Health is unauthenticated for reachability probes. Other routes require the generated bearer token printed at startup, or the explicit --daemon-auth-token value when provided. The proxy rewrites authorized client requests to the upstream daemon token instead of exposing the local daemon token.
|
|
6
|
+
|
|
7
|
+
Use the /agent-device base path when connecting through cloudflared, ngrok, or another shared origin. Treat the bearer token as a secret; anyone with it can control the proxied daemon. This direct proxy flow does not use agent-device auth.
|
|
8
|
+
|
|
9
|
+
Examples:
|
|
10
|
+
agent-device proxy --port 4310
|
|
11
|
+
cloudflared tunnel --url http://127.0.0.1:4310
|
|
12
|
+
agent-device devices --daemon-base-url https://example.trycloudflare.com/agent-device --daemon-auth-token <token>`,summary:"Expose a local daemon through cloudflared, ngrok, or another HTTP tunnel",allowedFlags:["proxyHost","proxyPort","daemonAuthToken","stateDir"]},"react-devtools":{usageOverride:"react-devtools [...args]",listUsageOverride:"react-devtools",helpDescription:"Run pinned agent-react-devtools commands for React Native performance profiling, component trees, props/state/hooks, and render analysis",summary:"Inspect React Native components, props, hooks, errors, slow renders, and rerender profiles",positionalArgs:["args?"],allowsExtraPositionals:!0,supportedFlags:e},web:{usageOverride:"web setup | web doctor",listUsageOverride:"web setup|doctor",helpDescription:`Install and inspect the managed web automation backend used by --platform web.
|
|
13
|
+
|
|
14
|
+
First-run flow:
|
|
15
|
+
agent-device web setup
|
|
16
|
+
agent-device open "https://example.com" --platform web
|
|
17
|
+
agent-device snapshot -i --platform web
|
|
18
|
+
agent-device close --platform web
|
|
19
|
+
|
|
20
|
+
Runtime web commands do not install the backend implicitly. If the managed backend is missing, run agent-device web setup. The backend is resolved only from the managed install in the effective agent-device state dir.
|
|
21
|
+
|
|
22
|
+
Use web setup to install or reuse the pinned backend. Use web doctor after setup to verify browser backend health.`,summary:"Manage web automation backend",positionalArgs:["setup|doctor"],supportedFlags:["stateDir"]}},f={...t,...a,...l,...s,...n,...o,...m,...h,...r,...c,...i,...p},v=new Map(u().map(t=>[t.name,{helpDescription:t.description,supportedFlags:e}]));function b(e){if(e)return y(e)}function w(e){let t=y(e);if(!t)throw Error(`Missing command schema for ${e}`);return t}function y(e){let t=Object.hasOwn(g,e)?g[e]:void 0;if(t)return t;let o=v.get(e),a=Object.hasOwn(f,e)?f[e]:void 0;if(o)return a?{...o,...a}:o}function k(e,t){let o=b(e);if(!o?.defaults)return!1;let a=!1;for(let[e,n]of Object.entries(o.defaults))void 0===t[e]&&(t[e]=n,a=!0);return a}export{k as applyCommandDefaults,w as getCliCommandSchema,b as getCommandSchema};
|