@kaeawc/auto-mobile 0.0.90 → 0.0.92
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 +7 -0
- package/README.md.backup +7 -0
- package/dist/build-info.json +12 -11
- package/dist/schemas/README.md +16 -0
- package/dist/schemas/prototype-icon-names.json +302 -0
- package/dist/schemas/prototype-platform-permissions.json +75 -0
- package/dist/schemas/test-plan.schema.json +2 -2
- package/dist/src/chunk-09442h7v.js +4 -0
- package/dist/src/chunk-0dfnyfkh.js +5 -0
- package/dist/src/chunk-0e4gm1kj.js +5 -0
- package/dist/src/chunk-0eb8576f.js +4 -0
- package/dist/src/chunk-0rjm4nx7.js +5 -0
- package/dist/src/chunk-0w1spptt.js +6 -0
- package/dist/src/chunk-1zmh2eak.js +4 -0
- package/dist/src/chunk-28k63ha3.js +5 -0
- package/dist/src/chunk-2d4wmp8b.js +4 -0
- package/dist/src/chunk-2e6s75qv.js +78 -0
- package/dist/src/chunk-2v7tw1nj.js +5 -0
- package/dist/src/chunk-32jpxz2y.js +323 -0
- package/dist/src/chunk-34zxqcmq.js +5 -0
- package/dist/src/chunk-3jmvqygr.js +238 -0
- package/dist/src/chunk-3swvfhqt.js +5 -0
- package/dist/src/chunk-44bt78m9.js +5 -0
- package/dist/src/chunk-488vt2bp.js +4 -0
- package/dist/src/chunk-4fgdhcwx.js +5 -0
- package/dist/src/chunk-4jp2se4w.js +4 -0
- package/dist/src/chunk-4pfftt07.js +5 -0
- package/dist/src/chunk-4vhr9e4t.js +4 -0
- package/dist/src/chunk-4xd6zs3y.js +15 -0
- package/dist/src/chunk-51567pg8.js +4 -0
- package/dist/src/chunk-5agqsfev.js +4 -0
- package/dist/src/chunk-5d706gmr.js +4 -0
- package/dist/src/chunk-5kd4rqk7.js +5 -0
- package/dist/src/chunk-5s645vr4.js +4 -0
- package/dist/src/chunk-61t538bm.js +4 -0
- package/dist/src/chunk-6d3mmqxt.js +54 -0
- package/dist/src/chunk-6hyt398x.js +5 -0
- package/dist/src/chunk-6mnr8kpm.js +4 -0
- package/dist/src/chunk-6pg7bqck.js +4 -0
- package/dist/src/chunk-79q5xsdc.js +42 -0
- package/dist/src/chunk-7bdgand3.js +4 -0
- package/dist/src/chunk-84cp9dw5.js +4 -0
- package/dist/src/chunk-86f2h5ww.js +5 -0
- package/dist/src/chunk-8cghfzb2.js +19 -0
- package/dist/src/chunk-8en08r7q.js +5 -0
- package/dist/src/chunk-950qcq1e.js +10 -0
- package/dist/src/chunk-9rkfyt6q.js +5 -0
- package/dist/src/chunk-9tf2p9y9.js +5 -0
- package/dist/src/chunk-9y5bcy28.js +6 -0
- package/dist/src/chunk-a2sc4jm0.js +5 -0
- package/dist/src/chunk-a4k9rt7z.js +5 -0
- package/dist/src/chunk-aa5ng3d1.js +4 -0
- package/dist/src/chunk-ajsrz473.js +5 -0
- package/dist/src/chunk-b3h0a6ca.js +4 -0
- package/dist/src/chunk-b4cxdzwy.js +20 -0
- package/dist/src/chunk-b6a737qt.js +4 -0
- package/dist/src/chunk-bn64x5z5.js +5 -0
- package/dist/src/chunk-bvh649za.js +12 -0
- package/dist/src/chunk-c9nk1r78.js +5 -0
- package/dist/src/chunk-c9tyfg4j.js +26 -0
- package/dist/src/chunk-cfsdfqnm.js +4 -0
- package/dist/src/chunk-cxyf04jc.js +7 -0
- package/dist/src/chunk-d57432wq.js +4 -0
- package/dist/src/chunk-da08tx5v.js +4 -0
- package/dist/src/chunk-eka89q3k.js +4 -0
- package/dist/src/chunk-f2tc08m2.js +4 -0
- package/dist/src/chunk-f8tnk179.js +5 -0
- package/dist/src/chunk-f9s1kkhx.js +5 -0
- package/dist/src/chunk-fbp8a4rx.js +4 -0
- package/dist/src/chunk-fd2z0sze.js +4 -0
- package/dist/src/chunk-fk927f4q.js +54 -0
- package/dist/src/chunk-fxmr3a0f.js +4 -0
- package/dist/src/chunk-gaqwhd44.js +4 -0
- package/dist/src/chunk-ggtd5x5a.js +5 -0
- package/dist/src/chunk-gndcfrm7.js +4 -0
- package/dist/src/chunk-h3n4adc6.js +310 -0
- package/dist/src/chunk-h5pjbb83.js +4 -0
- package/dist/src/chunk-hgnnh302.js +4 -0
- package/dist/src/chunk-hmke8nhx.js +5 -0
- package/dist/src/chunk-j2bx12hn.js +4 -0
- package/dist/src/chunk-j70y1a2g.js +4 -0
- package/dist/src/chunk-jdqvcq0a.js +5 -0
- package/dist/src/chunk-jhnbfj19.js +55 -0
- package/dist/src/chunk-js1jpyxp.js +6 -0
- package/dist/src/chunk-kbjq0qvb.js +4 -0
- package/dist/src/chunk-kfwx57xd.js +4 -0
- package/dist/src/chunk-km0dy5vc.js +71 -0
- package/dist/src/chunk-kzwctna2.js +4 -0
- package/dist/src/chunk-m9ehyehy.js +4 -0
- package/dist/src/chunk-mct91p1f.js +4 -0
- package/dist/src/chunk-mf9spd4g.js +5 -0
- package/dist/src/chunk-mgrcansb.js +4 -0
- package/dist/src/chunk-mqc1d0eb.js +6 -0
- package/dist/src/chunk-n1zmpk0z.js +4 -0
- package/dist/src/chunk-ncyjf63g.js +4 -0
- package/dist/src/chunk-nr64d21q.js +973 -0
- package/dist/src/chunk-nwm2pq5v.js +168 -0
- package/dist/src/chunk-pm06b05d.js +9 -0
- package/dist/src/chunk-q50s00ry.js +4 -0
- package/dist/src/chunk-qv2918jt.js +4 -0
- package/dist/src/chunk-qwye1958.js +14 -0
- package/dist/src/chunk-r0f1q783.js +5 -0
- package/dist/src/chunk-r14wwk37.js +18 -0
- package/dist/src/chunk-r20pe1nv.js +5 -0
- package/dist/src/chunk-r8z9pfve.js +5 -0
- package/dist/src/chunk-rdpgkjf6.js +4 -0
- package/dist/src/chunk-rkr0dks9.js +5 -0
- package/dist/src/chunk-rn84t3sf.js +11 -0
- package/dist/src/chunk-s123kn7n.js +4 -0
- package/dist/src/chunk-s1zq65ny.js +4 -0
- package/dist/src/chunk-s73qn3fx.js +4 -0
- package/dist/src/chunk-sjn0nj4p.js +5 -0
- package/dist/src/chunk-sns0c35v.js +7 -0
- package/dist/src/chunk-stfzjr9y.js +8 -0
- package/dist/src/chunk-sz1a7p43.js +4 -0
- package/dist/src/chunk-t4dr5c8v.js +8 -0
- package/dist/src/chunk-tc8k9c1j.js +4 -0
- package/dist/src/chunk-teznhase.js +4 -0
- package/dist/src/chunk-ty9xgmz4.js +4 -0
- package/dist/src/chunk-tyazf3sk.js +145 -0
- package/dist/src/chunk-v6npjrjm.js +5 -0
- package/dist/src/chunk-v90es00d.js +4 -0
- package/dist/src/chunk-vbvtzkwz.js +5 -0
- package/dist/src/chunk-vefd8qee.js +8 -0
- package/dist/src/chunk-vs9r72ta.js +17 -0
- package/dist/src/chunk-w2mwa0jk.js +4 -0
- package/dist/src/chunk-w7zsh13a.js +9 -0
- package/dist/src/chunk-w88k0bgr.js +4 -0
- package/dist/src/chunk-wry6skrm.js +4 -0
- package/dist/src/chunk-wzdt0enk.js +4 -0
- package/dist/src/chunk-xhhv854c.js +4 -0
- package/dist/src/chunk-y58270hd.js +4 -0
- package/dist/src/chunk-yk0hmbex.js +4 -0
- package/dist/src/chunk-ympy4fdz.js +28 -0
- package/dist/src/chunk-yw436axy.js +4 -0
- package/dist/src/chunk-z04jrpjy.js +5 -0
- package/dist/src/chunk-z2xznczw.js +4 -0
- package/dist/src/chunk-z4xnrgps.js +4 -0
- package/dist/src/chunk-z7csyszv.js +4 -0
- package/dist/src/chunk-z8t0v07j.js +11 -0
- package/dist/src/chunk-z916af47.js +228 -0
- package/dist/src/chunk-zcr8he8q.js +5 -0
- package/dist/src/chunk-zd9vmkzn.js +9 -0
- package/dist/src/chunk-zg67wjkh.js +5 -0
- package/dist/src/chunk-zj939v0h.js +5 -0
- package/dist/src/chunk-zkdjwtc1.js +4 -0
- package/dist/src/chunk-zkv5kzt6.js +4 -0
- package/dist/src/daemon/processEntry.js +4 -0
- package/dist/src/index.js +4 -2797
- package/dist/src/runtime/bunRuntimeGuard.js +4 -0
- package/dist/src/utils/workers/iosBundleExtractWorker.js +2 -3
- package/node_modules/strtok3/lib/BufferSizeError.js +1 -1
- package/node_modules/strtok3/lib/TokenWriter.js +151 -0
- package/node_modules/strtok3/lib/core.js +1 -0
- package/node_modules/strtok3/package.json +2 -2
- package/node_modules/token-types/LICENSE.txt +9 -9
- package/node_modules/token-types/{lib → dist/lib}/index.js +21 -3
- package/node_modules/token-types/package.json +81 -81
- package/package.json +10 -10
- package/schemas/README.md +16 -0
- package/schemas/prototype-icon-names.json +302 -0
- package/schemas/prototype-platform-permissions.json +75 -0
- package/schemas/test-plan.schema.json +2 -2
- package/node_modules/@borewit/text-codec/README.md +0 -87
- package/node_modules/@jimp/diff/node_modules/pixelmatch/README.md +0 -110
- package/node_modules/@jimp/diff/node_modules/pixelmatch/node_modules/pngjs/README.md +0 -433
- package/node_modules/@jimp/file-ops/dist/browser/index.js +0 -8
- package/node_modules/@jimp/js-png/README.md +0 -35
- package/node_modules/@jimp/js-png/src/__image_snapshots__/index-node-test-ts-png-should-use-png-options-1-snap.png +0 -0
- package/node_modules/@jimp/js-png/src/output.png +0 -0
- package/node_modules/@jimp/js-png/vitest.config.browser.mjs +0 -3
- package/node_modules/@jimp/plugin-resize/README.md +0 -12
- package/node_modules/@jimp/plugin-resize/vitest.config.browser.mjs +0 -3
- package/node_modules/@tokenizer/inflate/README.md +0 -114
- package/node_modules/@tokenizer/token/README.md +0 -19
- package/node_modules/await-to-js/README.md +0 -82
- package/node_modules/debug/README.md +0 -481
- package/node_modules/exif-parser/README.md +0 -83
- package/node_modules/file-type/readme.md +0 -667
- package/node_modules/ieee754/README.md +0 -51
- package/node_modules/mime/README.md +0 -178
- package/node_modules/ms/readme.md +0 -59
- package/node_modules/parse-bmfont-xml/README.md +0 -74
- package/node_modules/parse-bmfont-xml/lib/browser.js +0 -85
- package/node_modules/parse-bmfont-xml/node_modules/xml2js/README.md +0 -507
- package/node_modules/pngjs/README.md +0 -287
- package/node_modules/sax/README.md +0 -228
- package/node_modules/strtok3/README.md +0 -736
- package/node_modules/tinycolor2/README.md +0 -492
- package/node_modules/tinycolor2/cjs/test.js +0 -2191
- package/node_modules/tinycolor2/cjs/test_template.js +0 -26
- package/node_modules/tinycolor2/deno_asserts@0.168.0.mjs +0 -807
- package/node_modules/tinycolor2/esm/test.js +0 -2189
- package/node_modules/tinycolor2/esm/test_template.js +0 -24
- package/node_modules/tinycolor2/tinycolor.js +0 -1191
- package/node_modules/token-types/README.md +0 -120
- package/node_modules/uint8array-extras/readme.md +0 -318
- package/node_modules/xml-parse-from-string/README.md +0 -35
- package/node_modules/xmlbuilder/README.md +0 -86
- package/node_modules/zod/README.md +0 -208
- package/node_modules/zod/v4/locales/ar.d.cts +0 -4
- package/node_modules/zod/v4/locales/ar.d.ts +0 -4
- package/node_modules/zod/v4/locales/az.d.cts +0 -4
- package/node_modules/zod/v4/locales/az.d.ts +0 -4
- package/node_modules/zod/v4/locales/be.d.cts +0 -4
- package/node_modules/zod/v4/locales/be.d.ts +0 -4
- package/node_modules/zod/v4/locales/ca.d.cts +0 -4
- package/node_modules/zod/v4/locales/ca.d.ts +0 -4
- package/node_modules/zod/v4/locales/cs.d.cts +0 -4
- package/node_modules/zod/v4/locales/cs.d.ts +0 -4
- package/node_modules/zod/v4/locales/de.d.cts +0 -4
- package/node_modules/zod/v4/locales/de.d.ts +0 -4
- package/node_modules/zod/v4/locales/en.d.cts +0 -5
- package/node_modules/zod/v4/locales/en.d.ts +0 -5
- package/node_modules/zod/v4/locales/eo.d.cts +0 -5
- package/node_modules/zod/v4/locales/eo.d.ts +0 -5
- package/node_modules/zod/v4/locales/es.d.cts +0 -4
- package/node_modules/zod/v4/locales/es.d.ts +0 -4
- package/node_modules/zod/v4/locales/fa.d.cts +0 -4
- package/node_modules/zod/v4/locales/fa.d.ts +0 -4
- package/node_modules/zod/v4/locales/fi.d.cts +0 -4
- package/node_modules/zod/v4/locales/fi.d.ts +0 -4
- package/node_modules/zod/v4/locales/fr-CA.d.cts +0 -4
- package/node_modules/zod/v4/locales/fr-CA.d.ts +0 -4
- package/node_modules/zod/v4/locales/fr.d.cts +0 -4
- package/node_modules/zod/v4/locales/fr.d.ts +0 -4
- package/node_modules/zod/v4/locales/he.d.cts +0 -4
- package/node_modules/zod/v4/locales/he.d.ts +0 -4
- package/node_modules/zod/v4/locales/hu.d.cts +0 -4
- package/node_modules/zod/v4/locales/hu.d.ts +0 -4
- package/node_modules/zod/v4/locales/id.d.cts +0 -4
- package/node_modules/zod/v4/locales/id.d.ts +0 -4
- package/node_modules/zod/v4/locales/index.d.cts +0 -39
- package/node_modules/zod/v4/locales/index.d.ts +0 -39
- package/node_modules/zod/v4/locales/it.d.cts +0 -4
- package/node_modules/zod/v4/locales/it.d.ts +0 -4
- package/node_modules/zod/v4/locales/ja.d.cts +0 -4
- package/node_modules/zod/v4/locales/ja.d.ts +0 -4
- package/node_modules/zod/v4/locales/kh.d.cts +0 -4
- package/node_modules/zod/v4/locales/kh.d.ts +0 -4
- package/node_modules/zod/v4/locales/ko.d.cts +0 -4
- package/node_modules/zod/v4/locales/ko.d.ts +0 -4
- package/node_modules/zod/v4/locales/mk.d.cts +0 -4
- package/node_modules/zod/v4/locales/mk.d.ts +0 -4
- package/node_modules/zod/v4/locales/ms.d.cts +0 -4
- package/node_modules/zod/v4/locales/ms.d.ts +0 -4
- package/node_modules/zod/v4/locales/nl.d.cts +0 -4
- package/node_modules/zod/v4/locales/nl.d.ts +0 -4
- package/node_modules/zod/v4/locales/no.d.cts +0 -4
- package/node_modules/zod/v4/locales/no.d.ts +0 -4
- package/node_modules/zod/v4/locales/ota.d.cts +0 -4
- package/node_modules/zod/v4/locales/ota.d.ts +0 -4
- package/node_modules/zod/v4/locales/pl.d.cts +0 -4
- package/node_modules/zod/v4/locales/pl.d.ts +0 -4
- package/node_modules/zod/v4/locales/ps.d.cts +0 -4
- package/node_modules/zod/v4/locales/ps.d.ts +0 -4
- package/node_modules/zod/v4/locales/pt.d.cts +0 -4
- package/node_modules/zod/v4/locales/pt.d.ts +0 -4
- package/node_modules/zod/v4/locales/ru.d.cts +0 -4
- package/node_modules/zod/v4/locales/ru.d.ts +0 -4
- package/node_modules/zod/v4/locales/sl.d.cts +0 -4
- package/node_modules/zod/v4/locales/sl.d.ts +0 -4
- package/node_modules/zod/v4/locales/sv.d.cts +0 -4
- package/node_modules/zod/v4/locales/sv.d.ts +0 -4
- package/node_modules/zod/v4/locales/ta.d.cts +0 -4
- package/node_modules/zod/v4/locales/ta.d.ts +0 -4
- package/node_modules/zod/v4/locales/th.d.cts +0 -4
- package/node_modules/zod/v4/locales/th.d.ts +0 -4
- package/node_modules/zod/v4/locales/tr.d.cts +0 -5
- package/node_modules/zod/v4/locales/tr.d.ts +0 -5
- package/node_modules/zod/v4/locales/ua.d.cts +0 -4
- package/node_modules/zod/v4/locales/ua.d.ts +0 -4
- package/node_modules/zod/v4/locales/ur.d.cts +0 -4
- package/node_modules/zod/v4/locales/ur.d.ts +0 -4
- package/node_modules/zod/v4/locales/vi.d.cts +0 -4
- package/node_modules/zod/v4/locales/vi.d.ts +0 -4
- package/node_modules/zod/v4/locales/zh-CN.d.cts +0 -4
- package/node_modules/zod/v4/locales/zh-CN.d.ts +0 -4
- package/node_modules/zod/v4/locales/zh-TW.d.cts +0 -4
- package/node_modules/zod/v4/locales/zh-TW.d.ts +0 -4
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ge,pe,Y,o,R,st,eg,Gt,G,WL,er,GL,Ot,rd,jo,_,k}from"./chunk-h3n4adc6.js";import{i,Bt,Se,Ft,l,e}from"./chunk-z8t0v07j.js";import{De,Ht,wt}from"./chunk-4fgdhcwx.js";import{r,u,yt}from"./chunk-9rkfyt6q.js";function Y0(s,t,n){return["android.","androidx."].some((a)=>s?.startsWith(a))&&typeof t==="string"&&t!==""&&n===t}function w(s){return s?.tokens??[]}function A(s){return s.tokens===void 0?s.value??"":s.trailingText}function F(...s){return s.some((t)=>w(t).length>0)}function g(s){let t=w(s);return t.length===0?"no tokens":`tokens ${JSON.stringify(t)}`}function V(s,t){let n=Array.from(t),a=0;for(let d of s)if(d===n[a])a++;return a===n.length}function P(s,t,n){if(!F(t,n))return;if(w(n).length>w(t).length)return{success:!0};let a=A(t),d=A(n);if(a===void 0||d===void 0)return{success:!0,warning:"iOS typed text result was not verified: the recipient field's value does not follow its tokens."};if(a===d)return{success:!1,error:`iOS nothing was typed: no new recipient token was committed and the text after the tokens is unchanged (${g(n)}).`};return V(d,s)?{success:!0}:{success:!0,warning:`iOS typed text changed in the recipient field; text after the tokens: ${JSON.stringify(d)} (${g(n)}).`}}function D(s,t,n){if(!F(t,n))return;let a=w(t);if(w(n).length>a.length)return`a new recipient token was committed (${g(n)}).`;let c=t===void 0?"":A(t),f=A(n);if(c===void 0||f===void 0)return`the recipient field's value does not follow its tokens, so the typed text is unknown (${g(n)}).`;if(c===f)return`no new recipient token was committed and the text after the tokens is unchanged (${g(n)}).`;return V(f,s)?`the text after the recipient tokens now contains the typed characters (${g(n)}).`:`the text after the recipient tokens changed to ${JSON.stringify(f)} (partial or altered input; ${g(n)}).`}class C extends G{extractNodeProperties(s){let t=Se(s),n=t.class??t.className;if(t.password===!0||t.password==="true"||typeof n==="string"&&n.includes("SecureTextField"))return{focused:t.focused,class:n,password:!0,editable:t.editable,actions:t.actions,"resource-id":t["resource-id"],bounds:t.bounds};return super.extractNodeProperties(s)}}var I=512,M=`iOS typed text result was not verified: the focused field value fills the ${I}-character read window, so a change past it cannot be seen.`;function B(s,t,n,a){let d=t.length+s.length-n.length;if(d<0||!a&&d!==0)return!1;for(let c=n.indexOf(s);c!==-1;c=n.indexOf(s,c+1)){if(n.slice(0,c)!==t.slice(0,c))return!1;if(n.slice(c+s.length)===t.slice(c+d))return!0}return!1}function Z(s,t,n,a){if(n.length===I)return{success:!0,warning:M};if(t===n)return{success:!1,error:"iOS nothing was typed: the focused field value is unchanged."};return B(s,t,n,a)?{success:!0}:{success:!1,error:"iOS typed text chunk was not fully appended to the focused field."}}function O(s,t={secure:!1},n={secure:!1},a=!1){if(t.secure||n.secure)return{success:!0,warning:"iOS typed text check skipped for a secure field."};return((typeof a==="boolean"?a:a.verifyAppend)?Q(s,t,n,typeof a!=="boolean"&&a.firstChunk===!0):void 0)??ee(s,t,n)}function Q(s,t,n,a){if(t.identity!==void 0&&n.identity!==void 0&&t.identity!==n.identity)return{success:!0,warning:"iOS typed text result was not verified: focus moved to another field."};let d=t.nativeEditableValues??{},c=n.nativeEditableValues??{};if(Object.keys(d).some((f)=>Object.hasOwn(c,f)&&d[f]!==c[f]&&B(s,d[f],c[f],a)))return{success:!0};if(t.value!==void 0&&n.value!==void 0&&!F(t,n))return Z(s,t.value,n.value,a);return}function ee(s,t,n){if(H(t.nativeEditableValues,n.nativeEditableValues)==="changed")return{success:!0};let d=P(s,t,n);if(d!==void 0)return d;if(t.value===void 0||n.value===void 0)return{success:!0,warning:"iOS typed text result was not verified: the focused field could not be read."};if(n.value.length>=I)return{success:!0,warning:M};if(t.value===n.value)return{success:!1,error:"iOS nothing was typed: the focused field value is unchanged."};return K(n.value,s)?{success:!0}:{success:!0,warning:`iOS typed text changed in the focused field; observed value: ${JSON.stringify(n.value)}.`}}function te(s,t,n){if(n===void 0)return"the focused field could not be read, so what was committed is unknown.";if(t?.secure||n.secure)return"the focused field is secure; its content was not inspected.";let a=D(s,t,n);if(a!==void 0)return a;if(H(t?.nativeEditableValues,n.nativeEditableValues)==="changed")return"another editable on screen changed (a recipient or token entry may hold the text), so the focused field's value does not show what was committed.";return ne(s,t?.value,n.value)}function ne(s,t,n){if(n!==void 0&&n.length>=I)return`the focused field's value fills the ${I}-character read window, so what was committed is unknown.`;if(t===void 0||n===void 0)return"the focused field's value could not be read, so what was committed is unknown.";if(t===n)return"the focused field's value is unchanged from before typing; entries held as separate tokens would not show in it.";return K(n,s)?"the focused field now contains the typed characters.":`the focused field's value changed to ${JSON.stringify(n)} (partial or altered input).`}function H(s={},t={}){let n=Object.keys(s).filter((a)=>Object.hasOwn(t,a));if(n.some((a)=>s[a]!==t[a]))return"changed";return n.length>0?"unchanged":"unavailable"}function K(s,t){let n=Array.from(t),a=0;for(let d of s)if(d===n[a])a++;return a===n.length}function re(s,t){let n=jo(),a=n===void 0?void 0:n-s.now();return t===void 0?a:Math.min(t,a??t)}async function fh(s,t={},n){let a=await c4(s,t,n);return a.kind==="read"?a.field:void 0}async function c4(s,t={},n){let{observer:a,timer:d,signal:c,display:f}=s,h=pe(c),m=re(d,n);if(h?.aborted||m!==void 0&&m<=0)return{kind:"unavailable"};let p=new AbortController,x=Ge(h,p.signal);try{let b=await l(()=>a.execute({freshness:"fresh",skipScreenshot:!0,skipAccessibilityAudit:!0,signal:x,timeoutMs:m,...f===void 0?{}:{display:f}}),{timer:d,timeoutMs:m,signal:x,label:"iOS typed text verification",onTimeout:()=>p.abort()}),y=b.viewHierarchy;if(b.freshness?.isFresh===!1||!y||y.hierarchy.error)return{kind:"unavailable"};return{kind:"read",field:Vd(y,new C,{...t,includeIosNativeEditableValues:!0}),hasFocusedTextInput:oc(y,new C),keyboardVisible:GL(b.viewHierarchy,b.screenSize)}}catch{return e.warn("[iOS typed text] Focused field read unavailable; result cannot be verified"),{kind:"unavailable"}}}var ie=1000,oe=250;async function J0(s,t,n,a=!1){let{timer:d,signal:c}=n,f=typeof a==="boolean"?a:a.verifyAppend;if(t?.secure&&!f)return{...O(s,t,void 0),after:t};let h=await fh(n,{includeIdentity:f}),m=O(s,t,h,a),p=d.now()+ie;while(!m.success&&F(t,h)&&d.now()<p)c?.throwIfAborted(),await d.sleep(oe),h=await fh(n,{includeIdentity:f},Math.max(0,p-d.now())),m=O(s,t,h,a);return{...m,after:h}}var se=2000;async function X0(s,t,n,a){if(!WL(s))return s;let d=n?.secure?n:await fh(a,{},se);return`${s} Observed afterwards: ${te(t,n,d)}`}var ae=3,de=Bt([100,200]);function ue(s,t){return Object.entries(s?.nativeEditableValues??{}).some(([n,a])=>a!==""&&t?.nativeEditableValues?.[n]==="")}function ce(s){return s?.keyboardNativeEditableValue===""}function L(s,t,n=1,a){if(ue(a,s)||ce(s))return{success:!0};if(s?.secure)return{success:!0,warning:"iOS clear check skipped for a secure field."};if(s?.value===void 0){if(t!==void 0)return{success:!1,partialApplication:!0,error:`iOS clear could not be verified after ${n} attempt(s); the focused field last held ${JSON.stringify(t)} and could not be read again.`};return{success:!0,warning:"iOS clear was not verified: the focused field could not be read."}}if(s.value===t)return le(s.value,n,a?.value);return s.value===""?{success:!0}:s.value}function le(s,t,n){if(s!==""&&s===n)return{success:!1,error:`iOS clear removed nothing after ${t} attempt(s): the runner acknowledged each clear, but the focused field still holds its pre-clear value; remaining value: ${JSON.stringify(s)}.`};return{success:!0,warning:`The field still holds ${JSON.stringify(s)} after the clear was acknowledged and retried; it may be a mask or permanent prefix at its cleared content, or the app may have refused the clear.`}}function W(s){if(s===void 0)return"unreadable";let t=Object.entries(s.nativeEditableValues??{}).map(([n,a])=>`${n}:${a.length}`);return`focusedLength=${s.value?.length??"none"} native={${t.join(",")}} keyboardEditableLength=${s.keyboardNativeEditableValue?.length??"none"}`}async function fe(s,t,n){n?.throwIfAborted();let a=de.delayForAttempt(t),d=jo();if(d!==void 0&&d-s.now()<=a)return!1;await l(()=>s.sleep(a),{timer:s,signal:n,label:"iOS clear retry"}),n?.throwIfAborted();let c=jo();return c===void 0||c>s.now()}async function Aq({clear:s,observer:t,timer:n,signal:a,display:d}){let c=pe(a),f=async(v=!1)=>{c?.throwIfAborted();let T=await fh({observer:t,timer:n,signal:c,display:d},{iosPlaceholderAsBlank:!0});if(c?.throwIfAborted(),v&&!T?.secure&&T?.value===void 0)e.warn("[iOS clear] Pre-clear field read unavailable; using post-clear verification only");return T},h=await f(!0),m=await s();if(!m.success)return m;if(c?.throwIfAborted(),h?.secure)return{success:!0,warning:"iOS clear check skipped for a secure field."};let p=await f(),x=L(p,void 0,1,h),b=1;while(typeof x==="string"&&b<ae){if(!await fe(n,b,c))break;let v=await s();if(b++,!v.success)return{...v,partialApplication:!0};p=await f(),x=L(p,x,b,h)}let y=typeof x==="string"?{success:!1,partialApplication:!0,error:`iOS clear left text in the focused field after ${b} attempt(s); remaining value: ${JSON.stringify(x)}.`}:x;if(!y.success)e.warn(`[iOS clear] Verification failed; before ${W(h)}; after ${W(p)}`);return y}class N{editables=[];keyboardTop;recordKeyboard(s){if(s)this.keyboardTop=Math.min(this.keyboardTop??s.top,s.top)}recordEditable(s,t){if(t)this.editables.push({value:s,bounds:t})}soleValueAboveKeyboard(){let s=this.keyboardTop;if(s===void 0)return;let t=this.editables.filter((n)=>n.bounds.bottom<=s);return t.length===1?t[0].value:void 0}}function he(s,t){return s!==null&&t!==null&&s.left>=t.left&&s.right<=t.right&&s.top>=t.top&&s.bottom<=t.bottom}function me(s,t,n){let a=n.extractNodeProperties(s),d=er(a),c=d.textSources.text;if(!(d.className==="UIButton"||a.role==="button")||!st(a.clickable)||d.nativeId!==void 0||c===void 0||c===""||!he(Gt(Ft(s)),t))return;return c}function ye(s,t){let n=s;for(let a of t){if(!n.startsWith(a))return;n=n.slice(a.length),n=n.startsWith(" ")?n.slice(1):n}return n}function U(s,t,n){let a=Gt(Ft(s)),d=(s.node??[]).flatMap((f)=>me(f,a,n)??[]);if(d.length===0)return;let c=t===void 0?void 0:ye(t,d);return c===void 0?{tokens:d}:{tokens:d,trailingText:c}}var Z0=1000,q=50;function E(s,t){let n=t.extractWindowRootGroups(s,"topmost-first"),a=t.extractRootNodes(s),d=new Set,c=(f)=>f.filter((h)=>{if(d.has(h))return!1;return d.add(h),!0});return[...n,a].map(c).filter((f)=>f.length>0)}function xe(s,t){let n=er(s),a=n.textSources.value??n.textSources.text,d=["android.","androidx."].some((f)=>n.className?.startsWith(f));if(!t&&Y0(n.className,s["hint-text"],a))return 0;let c=typeof a==="string"?a.length:n.capturedTextLength;if(c===void 0&&d&&S(s)&&!st(s.password))return 0;return c}function Kl(s,t=new G,n=!1){for(let a of E(s,t)){let d;for(let c of a)t.traverseNode(c,(f)=>{let h=t.extractNodeProperties(f),m=xe(h,n);if((h.focused==="true"||h.focused===!0)&&m!==void 0)d=Math.max(d??0,m)});if(d!==void 0)return d}return}function oc(s,t=new G){for(let n of E(s,t))for(let a of n){let d=!1;if(t.traverseNode(a,(c)=>{if(d)return;let f=t.extractNodeProperties(c);if(S(f))d=!0}),d)return!0}return!1}function Q0(s,t=new G){for(let n of E(s,t)){let a;for(let d of n)t.traverseNode(d,(c)=>{let f=t.extractNodeProperties(c);if(a!==void 0||!S(f))return;a=j(f,!0)});if(a!==void 0)return a}return}function j(s,t=!1){let n=er(s);if(!t&&n.nativeId===void 0&&n.bounds===void 0)return;return JSON.stringify([n.nativeId??null,n.className??null,n.bounds?.left??null,n.bounds?.top??null])}function Vd(s,t=new G,n={}){for(let a of E(s,t)){let d,c=n.includeIosNativeEditableValues?{}:void 0,f=n.includeIosNativeEditableValues?new N:void 0;for(let h of a){let m,p;if(t.traverseNode(h,(x,b)=>{if(p!==void 0&&b<=p)p=void 0;let y=t.extractNodeProperties(x),v=y.class??y.className;if(p===void 0&&v==="WKWebView")p=b;if(p===void 0)be(y,c),ge(x,y,f);if(!S(y))return;let T=we(x,y,n,t);if(T===void 0)return;d??=T,m??=p===void 0?T:void 0}),m!==void 0)return m}if(c&&Object.keys(c).length>0)return Te(d,c,f);if(d!==void 0)return d}return}function be(s,t){if(!t||st(s.focused)||!z(s))return;let n=er(s),a=s["view-id"]??n.nativeId;if(typeof a==="string"&&a!==""){let d=typeof s.value==="string"?s.value:"";t[a]=d===s["hint-text"]?"":d}}function Te(s,t,n){let a=n?.soleValueAboveKeyboard();return{...s??{secure:!1},nativeEditableValues:t,...a===void 0?{}:{keyboardNativeEditableValue:a}}}function ge(s,t,n){if(!n)return;if((t.class??t.className)==="UIKeyboard"){n.recordKeyboard(Gt(Ft(s)));return}if(z(t)){let d=typeof t.value==="string"?t.value:"";n.recordEditable(d===t["hint-text"]?"":d,Gt(Ft(s)))}}function X(s){let t=s.class??s.className;return st(s.password)||typeof t==="string"&&t.includes("SecureTextField")}function z(s){let t=s.class??s.className;if(X(s))return!1;return s.role==="textfield"||Array.isArray(s.actions)&&s.actions.includes("set_text")||typeof t==="string"&&/UITextField|UISearchBar|UITextView/.test(t)}function ve(s,t){let n=er(s),a=X(s),d=n.textSources.value??n.textSources.text??(n.capturedTextLength===0?"":void 0);if(a)return{value:d,secure:a};let c=t.iosEmptyAsBlank?J(n.textSources):t.iosPlaceholderAsBlank?n.textSources.value===void 0?void 0:J(n.textSources):d;return c!==void 0||t.includeIosNativeEditableValues?{value:c,secure:a}:void 0}function we(s,t,n,a){let d=ve(t,n),c=d&&n.includeIdentity?{...d,identity:j({...t,bounds:Ft(s)})}:d;if(c===void 0||c.secure)return c;let f=U(s,c.value,a);return f===void 0?c:{...c,...f}}function J(s){let t=s.value;return t===void 0||t===s["hint-text"]?"":t}function S(s){if(s.focused!=="true"&&s.focused!==!0)return!1;let t=s.class??s.className,n=typeof t==="string"&&(t.includes("SecureTextField")||eg.some((f)=>t.includes(f))),a=s.actions,d=Array.isArray(a)&&a.includes("set_text"),c=s.editable==="true"||s.editable===!0;return n||d||c}async function Tq(s,t,{signal:n,onDelete:a,supportsKeyCombination:d}={}){if(n?.throwIfAborted(),await s.executeCommand(d?"shell input keycombination KEYCODE_CTRL_LEFT KEYCODE_A":"shell input keyevent KEYCODE_MOVE_END"),n?.throwIfAborted(),d){await s.executeCommand("shell input keyevent KEYCODE_DEL"),a?.(),n?.throwIfAborted();return}for(let c=0;c<t;c+=q){n?.throwIfAborted();let f=Math.min(q,t-c),h=Array(f).fill("KEYCODE_DEL").join(" ");await s.executeCommand(`shell input keyevent ${h}`),a?.(),n?.throwIfAborted()}}async function kq(s,t,n=new G){o(t);try{let a=await s();o(t);let d=a.viewHierarchy;if(a.freshness?.isFresh===!1||!d||d.hierarchy.error||!oc(d,n))return{success:!1,error:"Cannot verify key-event clear: no fresh focused editable field available"};let c=Kl(d,n);if(c===void 0)return{success:!1,error:"Cannot verify key-event clear: focused field text length is unreadable"};return c===0?{success:!0}:{success:!1,error:`Field was not fully cleared: ${c} UTF-16 units remain`}}catch(a){return o(t),e.warn("[ClearText] Key-event clear verification unavailable",a),{success:!1,error:`Cannot verify key-event clear: ${r(a)}`}}}class poe extends De{parser;androidKeyCombinationSupported;constructor(s,t=null,n=new G,a=i){super(s,{adb:t,timer:a});this.parser=n}async execute(s,t){t?.throwIfAborted();let n=Y();return n.serial("clearText"),this.observedInteraction(async(a)=>{try{switch(this.device.platform){case"android":return await n.track("androidClearText",()=>this.executeAndroidClearText(a,t));case"ios":return await n.track("iOSClearText",()=>this.executeiOSClearText(a,t));default:throw n.end(),yt(this.device.platform,"clear text")}}catch(d){n.end(),t?.throwIfAborted();let c=u(d,"Failed to clear text");return e.warn(`[ClearText] ${c.message}`),{success:!1,error:c.message}}},{...Ht.textEdit,tolerancePercent:0,timeoutMs:wt.immediate,progress:s,signal:t,perf:n})}get testHooks(){return{executeAndroidClearText:this.executeAndroidClearText.bind(this),executeiOSClearText:this.executeiOSClearText.bind(this)}}async executeAndroidClearText(s,t){let n=s.viewHierarchy,a=s;if(n&&!n.hierarchy.error&&!oc(n,this.parser)){let f=await this.refreshFocusedTextInputObservation(n,t).catch((h)=>{t?.throwIfAborted(),e.warn("[ClearText] Focus refresh unavailable; trying live clearing",h);return});if(f?.viewHierarchy&&!oc(f.viewHierarchy,this.parser))return{success:!1,error:"No focused editable node found"};a=f??{...s,viewHierarchy:void 0}}let d=k.getInstance(this.device,this.adbFactory);t?.throwIfAborted();let c=await d.requestClearText();if(t?.throwIfAborted(),c.success)return e.info(`[ClearText] Cleared text via accessibility service: ${c.totalTimeMs}ms`),{success:!0};return e.warn(`[ClearText] Accessibility service clear failed: ${c.error}, falling back to ADB`),this.executeAdbClearText(a,t)}async refreshFocusedTextInputObservation(s,t){let n;if(typeof s.updatedAt==="number")n=s.updatedAt+1;else{t?.throwIfAborted();let c=await this.adb.getDeviceTimestampMsWithSource();if(t?.throwIfAborted(),c.source==="host")return;n=c.source==="device-seconds"?c.timestampMs+Z0:c.timestampMs}t?.throwIfAborted();let a=await this.observeScreen.execute({freshness:"fresh",minTimestamp:n,signal:t,skipScreenshot:!0});t?.throwIfAborted();let d=a.viewHierarchy;return a.freshness?.isFresh!==!1&&d&&!d.hierarchy.error?a:void 0}async executeAdbClearText(s,t){let n=s.viewHierarchy,d=(n&&!n.hierarchy.error?Kl(n,this.parser):void 0)??200;if(d===0)return{success:!0};return await this.clearWithDeletes(d,t),kq(()=>this.observeScreen.execute({freshness:"fresh",minTimestamp:0,signal:t,skipScreenshot:!0}),t,this.parser)}async executeiOSClearText(s,t){let n=Date.now();e.debug("[ClearText] iOS begin");try{let a=_.getInstance(this.device);t?.throwIfAborted();let c=await Aq({clear:()=>{let f=jo();return a.requestClearText(void 0,5000,void 0,{abortSignal:t,...f===void 0?{}:{deadlineMs:f}})},observer:this.observeScreen,timer:this.timer,signal:t});if(c.retryable!==!1)t?.throwIfAborted();if(c.success)return e.info(`[ClearText] Cleared text via CtrlProxy iOS totalMs=${Date.now()-n}`),{success:!0,..."warning"in c&&c.warning?{warnings:[c.warning]}:{}};return e.warn(`[ClearText] CtrlProxy iOS clear failed: ${c.error} totalMs=${Date.now()-n}`),{success:!1,error:c.error,...c.retryable===!1?{retryable:!1}:{}}}catch(a){return t?.throwIfAborted(),e.warn(`[ClearText] CtrlProxy iOS exception: ${r(a)} totalMs=${Date.now()-n}`,a),{success:!1,error:String(a)}}}findAnyTextInputLength(s){let t=0;for(let n of E(s,this.parser))for(let a of n)this.parser.traverseNode(a,(d)=>{let c=this.parser.extractNodeProperties(d),f=er(c).textSources.text;if(c.class&&eg.some((h)=>c.class.includes(h))&&f&&typeof f==="string")t=Math.max(t,f.length)});return t}async clearWithDeletes(s,t){this.androidKeyCombinationSupported??=Ot(this.adb,1000,this.timer).then((a)=>a!==null&&a>=rd).catch((a)=>{throw this.androidKeyCombinationSupported=void 0,u(a,"Failed to read Android key-combination capability")});let n=await R(this.androidKeyCombinationSupported,t);await Tq(this.adb,s,{signal:t,supportsKeyCombination:n})}}
|
|
3
|
+
export{Y0,fh,c4,J0,X0,Aq,Z0,Kl,oc,Q0,Vd,Tq,kq,poe};
|
|
4
|
+
|
|
5
|
+
//# debugId=9C0E29CBB734F64964756E2164756E21
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Je,dt,v,o,R,st,eg,Ms,G,KL,we,Qc,tr,TD,_z,_,k,Vi}from"./chunk-h3n4adc6.js";import{i,l,e}from"./chunk-z8t0v07j.js";import{WF,rs,Zs,xh,dC}from"./chunk-sns0c35v.js";import{r,t}from"./chunk-9rkfyt6q.js";var x=3000,g=4,C=30000,M=20,N=60000,K=14,H=500,D=75,F=500,I=32;async function VF(n,s,a,{apiLevel:d,textLength:c,...u}){let m=a.slice(6);if(d===null||d>=31)return B(n,s,`echo $$; exec ${d===null?"":"cmd "}${m}`,{textLength:c,...u});let y,h="",b=!1,T=(w)=>{if(b)return;h+=w.slice(0,I+1);let S=h.indexOf(`
|
|
3
|
+
`);if(S<0&&h.length<=I)return;if(b=!0,S<0||S>I)return;let f=h.slice(0,S).trim(),E=/^\d+$/.test(f)?Number(f):NaN;if(Number.isSafeInteger(E)&&E>0)y=E};try{let w=`echo $$; exec ${m}`;return await n.execute(["shell",w],{...u,noRetry:!0,waitForProcessSettlementAfterAbort:!0,onStdout:T})}catch(w){if(y===void 0)e.warn("[ADB input text] Guest PID unavailable; using host process settlement only");else{e.warn(`[ADB input text] Dispatch failed; settling guest PID ${y}`);let S=Math.min(C,x+g*c);await q(n,s,y,{terminate:!0,settlementMs:S})}throw w}}async function B(n,s,a,{textLength:d,signal:c,timeoutMs:u,...m}){c?.throwIfAborted();let p=L(d),y=new AbortController,h=!1,b=Je(()=>n.execute(["shell",a],{...m,noRetry:!0,timeoutMs:(u??0)+p,signal:y.signal,onStdout:(f)=>{h||=f.length>0}})),T=s.now(),w=!1,S=!1;b.then(()=>{w=!0},()=>{w=!0,S=!0});try{let f=await l(b,{timer:s,timeoutMs:u,signal:c,label:"Android input text",timeoutError:()=>new dt(`Android input text timed out after ${u}ms`)}),E=K*d-(s.now()-T);if(E>0)await V(s,E,c);return f}catch(f){let E=S;if(!w){if(!h)y.abort(f);await U(s,b,p),y.abort(f)}if(h&&!E)await s.sleep(K*d+H);throw f}}function V(n,s,a){return new Promise((d,c)=>{if(a?.aborted){c(a.reason);return}let u=()=>{n.clearTimeout(m),c(a?.reason)},m=n.setTimeout(()=>{a?.removeEventListener("abort",u),d()},s);a?.addEventListener("abort",u,{once:!0})})}function L(n){return Math.min(N,x+M*n)}async function U(n,s,a){e.warn(`[ADB input text] Cancelled; holding for the host client up to ${a}ms`);try{await l(s.then(()=>{return},()=>{return}),{timer:n,timeoutMs:a,label:"Android input text host settlement"})}catch(d){e.warn(`[ADB input text] Host client settlement deadline expired after ${a}ms`,d)}}function W(n,s){let a=["input text ","/system/bin/input text ","sh /system/bin/input text ","/system/bin/sh /system/bin/input text ","cmd input text ","/system/bin/cmd input text ","app_process /system/bin com.android.commands.input.Input text ","/system/bin/app_process /system/bin com.android.commands.input.Input text "].map((d)=>`"${d}"*`).join("|");return["shell",`if [ -r /proc/${n}/cmdline ]; then if cmdline=$(tr '\\0' ' ' < /proc/${n}/cmdline 2>/dev/null); then case "$cmdline" in ${a}) ${s?`kill ${n} 2>/dev/null; `:""}echo alive;; esac; else echo alive; fi; fi`]}async function q(n,s,a,{terminate:d,settlementMs:c}){let u=s.now()+c,m=new AbortController,p=!1,y=async()=>{while(!p&&s.now()<u){try{let b=await n.execute(W(a,d),{signal:m.signal,timeoutMs:Math.min(F,u-s.now()),noRetry:!0});if(d=!1,b.stdout.trim()!=="alive")return}catch(b){if(p)e.debug(`[ADB input text] Probe for guest PID ${a} ended after settlement deadline`,b);else e.warn(`[ADB input text] Could not verify guest PID ${a}`,b)}let h=u-s.now();if(p||h<=0)return;await s.sleep(Math.min(D,h))}};try{await l(y,{timer:s,timeoutMs:c,label:"Android input text guest settlement",onTimeout:()=>{p=!0,m.abort()}})}catch(h){e.warn(`[ADB input text] Guest PID ${a} settlement deadline expired after ${c}ms`,h)}}function tv(n,s){return`IME action '${n}' failed after the text was entered: ${s}. Do not retype the text.`}async function P(n,s,a,d){if(Zs(n)&&!await d())return"Runner does not support stable node selectors";if(!WF(s))return"Unable to verify the node selector in an incomplete hierarchy";let c=new we().project(s).filter((m)=>KL(m.properties,n)),u=new Set(c.map((m)=>m.source)).size;if(u!==1)return u>1?`Node selector matches ${u} elements`:"Node selector matches no element in the current hierarchy";return Y(c[0],a)?void 0:"Node selector does not resolve to the focused text input"}function Y(n,s){let a=String(n.properties.class??n.properties.className??"");return st(n.properties.focused)&&eg.some((d)=>a.includes(d))&&n.bounds!==void 0&&s.bounds!==void 0&&Ms(n.bounds,s.bounds,0)}function A(n,s){return`Keyboard open outcome is indeterminate: the ${n} was dispatched but no result was confirmed (${s??"request cancelled"}). The keyboard may have opened. Do not retry automatically; observe before retrying.`}class ev extends t{constructor(n,s){super(A(n,s));this.name="KeyboardOpenIndeterminateError"}}class O{viewHierarchy;cache;constructor(n,s){this.viewHierarchy=n,this.cache=s}async getViewHierarchy(n,s){if(s?.forceFresh)this.cache.invalidateCache();return this.viewHierarchy.getViewHierarchy(void 0,{skipWaitForFresh:!1,minTimestamp:0,signal:n,timeoutMs:s?.timeoutMs})}}function X(n,s,a){return n==="ios"?s():a()}function Q(n,s){return n?.length===s.length&&n.every((a,d)=>a.left===s[d].left&&a.top===s[d].top&&a.right===s[d].right&&a.bottom===s[d].bottom)}class bo{static INPUT_METHOD_WINDOW_TYPE=2;static STATE_CONFIRMATION_TIMEOUT_MS=2000;static IOS_KEYBOARD_VISIBILITY_TIMEOUT_MS=2000;static IOS_KEYBOARD_SETTLE_TIMEOUT_MS=1500;static IOS_KEYBOARD_SETTLE_INTERVAL_MS=250;static STATE_CONFIRMATION_POLL_INTERVAL_MS=100;static CLOSE_FOLLOW_UP_DETECT_TIMEOUT_MS=2000;device;adb;hierarchyProvider;parser;geometry;finder;timer;adbFactory;openClient;constructor(n,s={}){let{adbFactory:a=v,hierarchyProvider:d,timer:c=i,parser:u=new G,geometry:m=new tr,finder:p=new dC,openClient:y}=s;if(this.device=n,this.adbFactory=a,this.openClient=y,this.adb=a.create(n),this.parser=u,this.geometry=m,this.finder=p,this.timer=c,d)this.hierarchyProvider=d;else this.hierarchyProvider=new O(new Vi(n,a),X(n.platform,()=>_.getInstance(n),()=>k.getInstance(n,a)))}async execute(n,s){let{signal:a}=xh(s);if(o(a),this.device.platform==="ios")return this.executeIOS(n,a);switch(n){case"detect":return this.detect(a);case"open":return this.open(a);case"close":return this.close(a);default:return{success:!1,open:!1,message:`Unsupported keyboard action: ${n}`,error:`Unsupported keyboard action: ${n}`}}}async executeIOS(n,s){let a=_.getInstance(this.device);o(s);let d=await R(a.requestKeyboard(n,void 0,void 0,s),s);if(o(s),!d.success)return this.iosFailure(n,d,a,s);if(n!=="close"&&d.open===!0&&j(await this.settledIOSKeyboardVisibility(s))){let c=n==="detect"?"Keyboard is closed (no visible on-screen software keyboard)":"Keyboard did not open: no visible on-screen software keyboard. It may be minimized off screen because the simulator uses a hardware keyboard and cannot be shown on request.";return{success:n==="detect",open:!1,message:c,...n==="open"?{error:c}:{}}}return this.iosKeyboardResult(n,d)}iosKeyboardResult(n,s){let a=n==="detect"||n==="open"&&s.open||n==="close"&&!s.open,d=this.keyboardMessage(n,s.open,s.method);return{success:a,open:s.open,message:d,...n==="close"&&s.method?{method:s.method}:{},...a?{}:{error:d}}}async settledIOSKeyboardVisibility(n){let s=await this.isIOSKeyboardOnScreen(n,bo.IOS_KEYBOARD_VISIBILITY_TIMEOUT_MS);if(s!==!1)return s===!0?"visible":"unknown";let a=!1,d=this.timer.now()+bo.IOS_KEYBOARD_SETTLE_TIMEOUT_MS;while(this.timer.now()<d){await R(this.timer.sleep(Math.min(bo.IOS_KEYBOARD_SETTLE_INTERVAL_MS,d-this.timer.now())),n),o(n);let c=await this.isIOSKeyboardOnScreen(n,bo.IOS_KEYBOARD_VISIBILITY_TIMEOUT_MS);if(c===!0)return"visible";a||=c===!1}return a?"hidden":"hidden_unconfirmed"}async isIOSKeyboardOnScreen(n,s){try{let a=await l(()=>this.hierarchyProvider.getViewHierarchy(n,{timeoutMs:s,forceFresh:!0}),{timer:this.timer,timeoutMs:s,signal:n,label:"iOS keyboard visibility hierarchy"});if(o(n),a?.fresh===!1){e.warn("iOS keyboard visibility hierarchy is stale; using runner state");return}let d=a?.screenWidth,c=a?.screenHeight;if(!a||a.hierarchy?.error||![d,c].every((p)=>typeof p==="number"&&Number.isFinite(p)&&p>0))return;let u=new Qc(this.parser).collect(a,"ios"),m=u&&TD(u);return!!m&&_z(m,{width:d,height:c})!==void 0}catch(a){o(n),e.warn("iOS keyboard visibility hierarchy read failed; using runner state",a);return}}async iosFailure(n,s,a,d){if(n==="close"&&/^Keyboard timed out after \d+ms$/.test(s.error??"")&&await this.confirmIOSCloseAfterTimeout(a,d))return{success:!0,open:!1,message:"Keyboard closed after the close request timed out; dismissal method unknown (Return may have submitted the field)"};let c=n==="close"?await this.settledIOSKeyboardVisibility(d):void 0;if(c==="hidden")return e.warn(`iOS keyboard close failed but no software keyboard is visible: ${s.error}`),{success:!0,open:!1,message:"Keyboard is closed (no visible on-screen software keyboard)"};if(c==="hidden_unconfirmed")return this.iosCloseStateUnknown(s);let u=s.error??`Failed to ${n} iOS keyboard`;return{success:!1,open:s.open,message:u,error:u}}iosCloseStateUnknown(n){let s=n.error??"Failed to close iOS keyboard";e.warn(`iOS keyboard close failed and no settle re-read confirmed the keyboard gone: ${s}`);let a=`Keyboard state unknown after close: ${s}. One hierarchy read showed no keyboard, but every re-read timed out or failed, so the keyboard may still be on screen. Run keyboard detect to check.`;return{success:!1,open:n.open,message:a,error:a,reason:"keyboard_state_unknown"}}async confirmIOSCloseAfterTimeout(n,s){try{o(s);let a=await R(l(n.requestKeyboard("detect",bo.CLOSE_FOLLOW_UP_DETECT_TIMEOUT_MS,void 0,s),{timer:this.timer,timeoutMs:bo.CLOSE_FOLLOW_UP_DETECT_TIMEOUT_MS,label:"Keyboard close follow-up detect"}),s);return a.success&&!a.open}catch(a){return o(s),e.warn(`Keyboard close timeout follow-up detect failed: ${String(a)}`,a),!1}}keyboardMessage(n,s,a){if(n==="detect")return s?"Keyboard is open":"Keyboard is closed";if(n==="open")return s?"Keyboard opened":"Keyboard did not open";if(!s&&a==="returnKey")return"Keyboard closed with Return; the field may have submitted or committed autocorrect";return s?"Keyboard did not close":"Keyboard closed"}async detect(n){let{state:s}=await this.getHierarchyWithState(n);if(s.error)return{success:!1,open:s.open,bounds:s.bounds,message:s.error,error:s.error};return{success:!0,open:s.open,bounds:s.bounds,message:s.open?"Keyboard is open":"Keyboard is closed"}}async open(n){let{hierarchy:s,state:a}=await this.getHierarchyWithState(n);if(a.error)return{success:!1,open:a.open,bounds:a.bounds,message:a.error,error:a.error};if(a.open)return{success:!0,open:!0,bounds:a.bounds,message:"Keyboard already open"};let d=s?this.findFocusedTextInput(s):null;if(!d)return{success:!1,open:!1,message:"No focused text input to open keyboard",error:"No focused text input to open keyboard"};let c=await this.showWithoutTouch(d,s,n);if(c.kind==="unconfirmed"){let y=A("node click",c.error);return{success:!1,open:!1,message:y,error:y}}if(c.kind==="sent")return this.openResult(await this.waitForKeyboardState(!0,n),"Keyboard opened");let u=await this.readCaret(n);await this.tapOnElement(d,n);let m=await this.waitForKeyboardState(!0,n),p=m.open?await this.caretMovedNote(u,n):"";return this.openResult(m,"Keyboard opened",p)}openResult(n,s,a=""){let d=n.open&&!n.error,c=d?`${s}${a}`:n.error??"Failed to open keyboard";return{success:d,open:n.open,bounds:n.bounds,message:c,...n.error?{error:n.error}:{}}}getOpenClient(){return this.openClient??=k.getInstance(this.device,this.adbFactory),this.openClient}async showWithoutTouch(n,s,a){let d=rs(n);if(!d)return this.dispatchNodeClick(this.getOpenClient(),void 0,a);let c;try{c=this.getOpenClient();let u=await P(d,s,n,()=>R(c.supportsNodeActionSelectors(void 0,a),a));if(u)return e.warn(`Keyboard open: node click unavailable (${u})`),{kind:"unavailable"}}catch(u){return o(a),e.warn(`Keyboard open: node click errored: ${r(u)}`,u),{kind:"unavailable"}}return this.dispatchNodeClick(c,d,a)}async dispatchNodeClick(n,s,a){o(a);let d;try{d=s?await n.requestNodeAction("click",s,{signal:a}):await n.requestClickFocusedInput(void 0,void 0,a)}catch(m){return o(a),e.warn(`Keyboard open: node click errored: ${r(m)}`,m),{kind:"unavailable"}}let u=!(!s&&d.error==="Unknown command type: request_click_focused_input")&&d.dispatched===!0&&d.acknowledged!==!0;if(a?.aborted&&u)throw new ev("node click",d.error);if(o(a),d.success)return{kind:"sent"};return e.warn(`Keyboard open: node click failed (${d.error??"unknown error"})`),u?{kind:"unconfirmed",error:d.error}:{kind:"unavailable"}}async readCaret(n){try{let s=await R(this.getOpenClient().requestInsertTextState(),n);return o(n),s.success?s.state:void 0}catch(s){o(n),e.warn(`Keyboard open: caret read failed: ${r(s)}`,s);return}}async caretMovedNote(n,s){if(!n)return"";let a=await this.readCaret(s);if(!a||a.selectionStart===n.selectionStart&&a.selectionEnd===n.selectionEnd)return"";let d=(c)=>`${c.selectionStart}-${c.selectionEnd}`;return` (the tap used to show it moved the caret from ${d(n)} to ${d(a)})`}async close(n){let{state:s}=await this.getHierarchyWithState(n,{timeoutMs:bo.STATE_CONFIRMATION_TIMEOUT_MS,forceFresh:!0});if(s.error)return{success:!1,open:s.open,bounds:s.bounds,message:s.error,error:s.error};if(!s.open)return{success:!0,open:!1,message:"Keyboard already closed"};o(n),await R(this.adb.executeCommand("shell input keyevent KEYCODE_BACK",{signal:n}),n);let a=await this.waitForKeyboardState(!1,n),d=!a.open&&!a.error,c=d?"Keyboard closed":a.error??"Failed to close keyboard";return{success:d,open:a.open,bounds:a.bounds,message:c,...a.error?{error:a.error}:{}}}async waitForKeyboardState(n,s){let a=this.timer.now()+bo.STATE_CONFIRMATION_TIMEOUT_MS,d=await this.readKeyboardStateBefore(a,s),c;while(!this.isStateSettled(d,c,n)){c=d;let u=a-this.timer.now();if(o(s),u<=0)break;if(await R(this.timer.sleep(Math.min(bo.STATE_CONFIRMATION_POLL_INTERVAL_MS,u)),s),o(s),this.timer.now()>=a)break;d=await this.readKeyboardStateBefore(a,s)}return d}isStateSettled(n,s,a){if(n.error||n.open!==a)return!1;if(!a||!n.bounds?.length)return!0;return s?.open===!0&&Q(s.bounds,n.bounds)}async readKeyboardStateBefore(n,s){let{state:a}=await this.getHierarchyWithState(s,{timeoutMs:Math.max(0,n-this.timer.now()),forceFresh:!0});return a}async getHierarchyWithState(n,s){o(n);let a=await R(this.hierarchyProvider.getViewHierarchy(n,s),n);return o(n),{hierarchy:a,state:this.resolveKeyboardState(a)}}resolveKeyboardState(n){if(!n)return{open:!1,error:"No view hierarchy available"};let s=n.windows??[],a=s.length>0,d=s.some((m)=>m.type===bo.INPUT_METHOD_WINDOW_TYPE),c=this.findKeyboardWindowBounds(n);if(c)return{open:!0,bounds:[c],source:"window",windowInfoAvailable:a,imeWindowPresent:!0};if((d||!a)&&this.detectKeyboardInHierarchy(n))return{open:!0,source:"heuristic",windowInfoAvailable:a,imeWindowPresent:d};let u=n.hierarchy?.error;if(u)return{open:!1,error:u};return{open:!1}}findKeyboardWindowBounds(n){let s=n.windows??[];for(let a of s){if(a.type!==bo.INPUT_METHOD_WINDOW_TYPE)continue;if(a.bounds&&this.isValidBounds(a.bounds))return a.bounds}return null}isValidBounds(n){return n.right>n.left&&n.bottom>n.top}detectKeyboardInHierarchy(n){let s=this.parser.extractRootNodes(n),a=["delete","enter","keyboard","emoji","shift"];for(let d of s){let c=!1;if(this.parser.traverseNode(d,(u)=>{if(c)return;let m=this.parser.extractNodeProperties(u),p=this.getStringProp(m,"resource-id","resourceId"),y=this.getStringProp(m,"content-desc","contentDesc"),h=p?.toLowerCase(),b=y?.toLowerCase();if(h&&(h.includes("keyboard")||h.includes("inputmethod"))){c=!0;return}if(b&&a.some((T)=>b.includes(T)))c=!0}),c)return!0}return!1}getStringProp(n,s,a){let d=n[s];if(typeof d==="string")return d;let c=n[a];if(typeof c==="string")return c;return}findFocusedTextInput(n){let s=this.finder.findFocusedTextInput(n);if(!s||!s.bounds)return null;return s}async tapOnElement(n,s){let a=this.geometry.getElementCenter(n),d=Math.round(a.x),c=Math.round(a.y);o(s);try{await this.adb.executeCommand(`shell input tap ${d} ${c}`,{signal:s,waitForProcessSettlementAfterAbort:!0})}catch(u){if(s?.aborted)throw new ev("tap",r(u));throw u}}}function j(n){return n==="hidden"||n==="hidden_unconfirmed"}
|
|
4
|
+
export{ev,bo,VF,tv};
|
|
5
|
+
|
|
6
|
+
//# debugId=F30FEBB51D00609E64756E2164756E21
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{jf,sA,mS,jN,KN,Kf}from"./chunk-44bt78m9.js";import"./chunk-jhnbfj19.js";import"./chunk-sjn0nj4p.js";import"./chunk-bn64x5z5.js";import"./chunk-0e4gm1kj.js";import"./chunk-4fgdhcwx.js";import"./chunk-6d3mmqxt.js";import"./chunk-sns0c35v.js";import"./chunk-h3n4adc6.js";import"./chunk-32jpxz2y.js";import"./chunk-79q5xsdc.js";import"./chunk-ggtd5x5a.js";import"./chunk-z8t0v07j.js";import"./chunk-mf9spd4g.js";export{sA as DEFAULT_MCP_REQUEST_TIMEOUT_MS,jf as MAX_CALLER_MCP_REQUEST_TIMEOUT_MS,Kf as ProgressExtendableDeadline,mS as clampCallerMcpRequestTimeoutMs,jN as resolveMcpRequestTimeoutMs,KN as resolveMcpRequestTimeoutMsOnce};
|
|
3
|
+
|
|
4
|
+
//# debugId=4B99B172463A051564756E2164756E21
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{i,dr,l,e}from"./chunk-z8t0v07j.js";import{w,Dt,YV,U,vn,xL,bn,xa}from"./chunk-h3n4adc6.js";import{Fp,Py,cZ,QP,eA,Ay}from"./chunk-nwm2pq5v.js";import{R$,P2}from"./chunk-4pfftt07.js";import{Ed}from"./chunk-rn84t3sf.js";import{Ul,j}from"./chunk-8cghfzb2.js";import{ho,sQ}from"./chunk-0e4gm1kj.js";var f=new Set(["light","dark","auto"]),v="Automatic appearance sync is disabled by AUTOMOBILE_APPEARANCE_SYNC.",m="No device was targeted: the configuration is stored, but no device was changed. Name a session or start a device first.",d={getPooledDevices:()=>{let n=w.devicePool();if(!n)return[];return n.getAllDevices().filter((t)=>dr(t.platform)).map((t)=>({deviceId:t.id,name:t.name,platform:t.platform}))},getSessionDevice:(n)=>{let t=n?.trim();if(!t)return;let o=w.sessionManager();if(!o)return ho(t)?.device;let a=o.getDeviceForSession(t),r=a?w.devicePool()?.getDevice(a):void 0;return r&&dr(r.platform)?{deviceId:r.id,name:r.name,platform:r.platform}:void 0},getSessionForDevice:(n,t)=>{let o=w.sessionManager();if(o)return o.getSessionForDevice(n);let a=t?.trim(),r=a?ho(a):void 0;return r?.device.deviceId===n?r.sessionUuid:null},getSessionManager:()=>w.sessionManager()};function woe(n){return{...d,getSessionlessDevices:()=>[...n(),...sQ()]}}var S={getConfig:Py,updateConfig:cZ,resolveMode:QP,applyToDevice:eA,triggerSync:P2,isSyncEnabled:Ay};class g extends xa{authenticator;deviceSource;dependencies;constructor(n=Dt(YV),t=i,o=bn("appearance",{allowObserverSessions:!0}),{deviceSource:a=d,dependencies:r=S}={}){super(n,t,"Appearance");this.authenticator=o;this.deviceSource=a,this.dependencies=r}bypassesRequestChain(n){return(n.command??n.method)==="get_appearance_config"}async handleRequest(n){let t=n.command??n.method;switch(t){case"get_appearance_config":{let o=await this.dependencies.getConfig(this.configKey(n.sessionUuid));return{id:n.id,type:"appearance_response",success:!0,result:{config:o}}}case"set_appearance_sync":return this.handleSetAppearanceSync(n);case"set_appearance":return this.handleSetAppearance(n);default:throw Error(`Unsupported appearance command: ${t}`)}}async handleSetAppearanceSync(n){this.authenticator.authorize({sessionUuid:n.sessionUuid});let t=n.params?.enabled??n.enabled;if(typeof t!=="boolean")throw Error("set_appearance_sync requires enabled boolean");return this.asControlCall("set_appearance_sync",n.sessionUuid,async(o)=>{let a=await this.dependencies.updateConfig({syncWithHost:t},this.configKey(n.sessionUuid)),r=await this.applyToTargets(a,o);return await this.dependencies.triggerSync(),{id:n.id,type:"appearance_response",success:!0,result:{config:a,appliedMode:r??void 0,...this.warningFor(t,o)}}})}async handleSetAppearance(n){this.authenticator.authorize({sessionUuid:n.sessionUuid});let t=n.params?.mode??n.mode;if(!t||!f.has(String(t).toLowerCase()))throw Error("set_appearance requires mode: light | dark | auto");let o=String(t).toLowerCase();return this.asControlCall("set_appearance",n.sessionUuid,async(a)=>{let r=await this.dependencies.updateConfig({defaultMode:o,syncWithHost:o==="auto"},this.configKey(n.sessionUuid)),s=await this.applyToTargets(r,a,o);return await this.dependencies.triggerSync(),{id:n.id,type:"appearance_response",success:!0,result:{config:r,appliedMode:s??void 0,...this.warningFor(o==="auto",a)}}})}async asControlCall(n,t,o){let a=[];try{for(let r of this.getTargets(t)){let s={device:r};a.push(s),await this.admitOnHolderSession(n,s)}return await o(a)}finally{for(let{execution:r}of a)if(r)j.endExecution(r.id)}}async admitOnHolderSession(n,t){let o=t.device.deviceId,a=this.deviceSource.getSessionManager?.();if(!a||this.authenticator.isAuthenticationEnforced?.()===!1)return;let r=this.deviceSource.getSessionForDevice(o);if(!r)return;let s=j.startExecution(n,void 0,r);t.execution=s,j.bindDeviceExecution(s.id,o);let c=s.abortController.signal;if(await xL({deviceId:o,holderSessionUuid:r,sessionManager:a,execution:Ul(s),signal:c}),c.aborted)throw Fp(s.cancelReason)??c.reason;j.markSessionAdmitted(s.id)}createErrorResponse(n,t){return{id:n??"unknown",type:"appearance_response",success:!1,error:t}}warningFor(n,t){let o=[this.automaticSyncWarning(n),t.length===0&&this.authenticator.isAuthenticationEnforced?.()===!1?{warning:m}:{}].flatMap((a)=>("warning"in a)?[a.warning]:[]);return o.length>0?{warning:o.join(" ")}:{}}automaticSyncWarning(n){return n&&!(this.dependencies.isSyncEnabled??Ay)()?{warning:v}:{}}async applyToTargets(n,t,o){let a=o&&o!=="auto"?o:await this.dependencies.resolveMode(n);if(t.length===0)return null;for(let r of t){let{device:s}=r;try{await l(()=>this.applyToTarget(r,a),{timer:this.timer,timeoutMs:this.dependencies.applyDeadlineMs??R$,label:`Appearance apply for ${s.deviceId}`})}catch(c){let p=Fp(r.execution?.cancelReason);if(p)throw p;e.warn(`[Appearance] Failed to apply appearance to ${s.deviceId}: ${c}`)}}return a}async applyToTarget(n,t){let o=async()=>{await Ed(n.device,["nightMode"]),await this.dependencies.applyToDevice(n.device,t)},a=n.execution?.abortController.signal;await(a?U(a,o):o())}configKey(n){if(this.authenticator.isAuthenticationEnforced?.()===!1)return;return this.authenticator.resolveSessionIdentity?.(n)??(n?.trim()||void 0)}sessionlessDevices(n){return!n&&this.authenticator.isAuthenticationEnforced?.()===!1?this.deviceSource.getSessionlessDevices?.()??[]:[]}getTargets(n){let t=n?.trim()||void 0,o=new Map;for(let c of this.deviceSource.getPooledDevices())o.set(c.deviceId,c);let a=this.deviceSource.getSessionDevice(t);if(a)o.set(a.deviceId,a);for(let c of this.sessionlessDevices(t))o.set(c.deviceId,c);if(this.authenticator.isAuthenticationEnforced?.()===!1)return[...o.values()];let r=this.configKey(t),s=[...o.values()].filter((c)=>{let p=this.deviceSource.getSessionForDevice(c.deviceId,t);if(!r||!p)return!1;return(this.authenticator.resolveSessionIdentity?.(p)??p)===r});if(s.length===0)e.info(`[Appearance] Session ${r??"unknown"} owns no device; config stored`);return s}}var u=new vn;function h2(){return u.instance?.getSocketPath()??Dt(YV)}async function g2(n=d){await u.start(()=>new g(void 0,void 0,void 0,{deviceSource:n}))}async function y2(){await u.stop()}
|
|
3
|
+
export{woe,h2,g2,y2};
|
|
4
|
+
|
|
5
|
+
//# debugId=EA3D1743E7D1633764756E2164756E21
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Oo,sS,bt,Ff,Lf}from"./chunk-nwm2pq5v.js";import{i,si,e}from"./chunk-z8t0v07j.js";import{g}from"./chunk-mf9spd4g.js";import{cL,dw,yW,Kc,ru,Xu,kw,Zu,jh,Os,M,yi}from"./chunk-h3n4adc6.js";import{JN}from"./chunk-a2sc4jm0.js";import{WE,Fr}from"./chunk-qwye1958.js";import{L,Nt,_i,vi}from"./chunk-32jpxz2y.js";import"./chunk-ggtd5x5a.js";import"./chunk-79q5xsdc.js";import"./chunk-6d3mmqxt.js";import"./chunk-4fgdhcwx.js";import{Tb,cP,sM,s1,N,Qg,ey,ty,VE}from"./chunk-3jmvqygr.js";import"./chunk-hmke8nhx.js";import"./chunk-z04jrpjy.js";import{fe}from"./chunk-8cghfzb2.js";import"./chunk-tyazf3sk.js";import{t7}from"./chunk-44bt78m9.js";import"./chunk-jhnbfj19.js";import"./chunk-0e4gm1kj.js";import"./chunk-mqc1d0eb.js";import"./chunk-vefd8qee.js";import"./chunk-4xd6zs3y.js";import"./chunk-pm06b05d.js";import"./chunk-rn84t3sf.js";import"./chunk-vs9r72ta.js";import"./chunk-0rjm4nx7.js";import{hb,NO}from"./chunk-z916af47.js";import"./chunk-kbjq0qvb.js";import"./chunk-0w1spptt.js";import"./chunk-6hyt398x.js";import"./chunk-w7zsh13a.js";import"./chunk-ympy4fdz.js";import"./chunk-f9s1kkhx.js";import"./chunk-r20pe1nv.js";import"./chunk-cxyf04jc.js";import"./chunk-jdqvcq0a.js";import"./chunk-t4dr5c8v.js";import"./chunk-9y5bcy28.js";import"./chunk-zd9vmkzn.js";import"./chunk-c9nk1r78.js";import"./chunk-a4k9rt7z.js";import"./chunk-sjn0nj4p.js";import"./chunk-bn64x5z5.js";import"./chunk-sns0c35v.js";import"./chunk-zg67wjkh.js";import{r,t}from"./chunk-9rkfyt6q.js";function x(n,o,s={}){let a=cP(n);if(a&&/Unknown tool\b/i.test(o))return a;let l=o.replace(/[.]+$/,""),c=!s.gated&&/Unknown tool\b/i.test(o)?" Try: auto-mobile --daemon restart":"";return`Error calling daemon: ${l}.${c}`}function T(){hb(),NO({daemonMode:!0,includeDoctor:!0,includeToolSelection:!1})}function E(n){try{return{parsed:!0,value:JSON.parse(n)}}catch(o){return e.debug(`[cli] value is not JSON, treating as a raw token: ${n} (${o})`),{parsed:!1,value:n}}}function _(n,o){let s=()=>E(n).value;if(o?.nullable&&n==="null")return null;switch(o?.type){case"string":case"enum":return ie(n);case"number":case"bigint":return se(n);case"boolean":if(n==="true")return!0;if(n==="false")return!1;return s();default:return s()}}function ie(n){let{parsed:o,value:s}=E(n);return o&&typeof s==="string"?s:n}function se(n){let{parsed:o,value:s}=E(n);return o&&typeof s==="number"&&Number.isFinite(s)?s:n}var k=new Set(["optional","nullable","default","readonly","catch","branded","lazy"]);function A(n){let o=n?._def?.typeName??n?._def?.type??"unknown";return String(o).replace(/^Zod/,"").toLowerCase()}function U(n){let o=n?._def;return o?.innerType??o?.type??o?.schema??null}function ae(n){let o=n?._def?.options;if(!Array.isArray(o))return!1;let s=o.map((d)=>R(d).type),a=s.some((d)=>d==="number"||d==="bigint"),c=o.filter((d,u)=>s[u]==="string").every((d)=>{let u=d;for(let f=0;f<10&&u;f++){let m=A(u);if(m==="literal")return typeof(u._def?.value??u._def?.values?.[0])==="string";if(!k.has(m))return!1;u=U(u)}return!1});if(a&&c)return!1;return s.includes("string")&&s.every((d)=>["string","number","boolean","bigint"].includes(d))}function R(n){let o=n,s=!1;for(let a=0;a<10&&o;a++){let l=A(o);if(l==="nullable")s=!0;if(l==="literal")return{type:typeof(o._def?.value??o._def?.values?.[0]),nullable:s};if(l==="union"&&ae(o))return{type:"string",nullable:s};if(!k.has(l))return{type:l,nullable:s};o=U(o)}return{type:"unknown",nullable:s}}function C(n){let o=n?._def;if(!o)return[];if(o.shape)return[o.shape];let s=o.options??o.out?._def?.options;if(Array.isArray(s))return s.flatMap((a)=>C(a));return o.out?C(o.out):[]}function F(n){T();let o=N.getRegisteredTool(n);if(!o)return null;let s=C(o.schema);if(s.length===0)return null;let a=new Map;for(let l of s)for(let[c,d]of Object.entries(l)){let u=R(d),f=a.get(c)??{types:new Set,nullable:!1};f.types.add(u.type),f.nullable=f.nullable||u.nullable,a.set(c,f)}return Object.fromEntries([...a.entries()].filter(([,l])=>l.types.size===1).map(([l,c])=>[l,{type:[...c.types][0],nullable:c.nullable}]))}import le from"fs";var ce=65536,ue="CliToolResult";function B(n,o){let s=o.maxBytes??ce,a;try{a=JSON.stringify(n,null,2)}catch(c){return v(o.tool,0,`result is not JSON-serializable: ${r(c)}`)}if(a===void 0)return v(o.tool,0,"tool returned a value with no JSON representation");let l=Buffer.byteLength(a,"utf8");if(l<=s)return a;if(!o.artifactWriter)return v(o.tool,l,"no tool-output directory is available to spill the payload to");try{let c=o.artifactWriter.writeJsonArtifact({tool:o.tool,payload:ue,data:n,serialized:a});return JSON.stringify({truncated:!1,bytes:l,artifact:{...c.artifact,resourceUri:void 0},note:`Tool output was ${l} bytes, over the ${s}-byte CLI inline limit. The complete JSON result is in artifact.path.`},null,2)}catch(c){return e.debug(`[cli] failed to spill oversized tool output: ${r(c)}`),v(o.tool,l,r(c))}}function v(n,o,s){return JSON.stringify({truncated:!0,tool:n,bytes:o,reason:s,recovery:"Re-run with AUTOMOBILE_TOOL_OUTPUTS_DIR set to a writable directory, or narrow the request (for example observe with a scope) so the result fits inline."},null,2)}var H={write:(n)=>W(1,n)},j={write:(n)=>W(2,n)},de={writeSync:(n,o,s,a)=>le.writeSync(n,o,s,a),sleepSync:(n)=>{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,n)}},pe=1000;function me(n,o,s){let a=o+1;if(s.sleepSync(1),a>=pe)throw Error(`Zero-progress write to fd ${n} after ${a} attempts; refusing to spin`);return a}function W(n,o,s=de){let a=Buffer.from(o,"utf8"),l=0,c=0;while(l<a.length)try{let d=s.writeSync(n,a,l,a.length-l);if(d===0){c=me(n,c,s);continue}c=0,l+=d}catch(d){let u=d.code;if(u==="EAGAIN"){s.sleepSync(1);continue}if(u==="EPIPE"){e.debug(`[cli] output stream closed before the write completed (fd ${n})`);return}throw d}}function ge(n){if(!n||typeof n!=="object")return;let o=n,s=o.failure;if(s&&typeof s==="object")return s.code;let a=o.error;return o.code??(a&&typeof a==="object"?a.code:void 0)}function y(n){return n&&typeof n==="object"?n:void 0}function ye(n){return y(y(n)?.error)?.reason}function P(n){if(n<60000){let s=Math.round(n/1000*10)/10;return`${s} ${s===1?"second":"seconds"}`}let o=Math.round(n/60000*10)/10;return`${o} ${o===1?"minute":"minutes"}`}function he(n){let o=y(y(n)?.error)?.idleTimeoutMs;return typeof o==="number"&&Number.isFinite(o)&&o>0?o:void 0}var Se=`(reads do not count), so its session UUID cannot be used again. Acquire a new session with getAndroid, getApple or startDevice. To keep a session across longer gaps, set ${g.CLI_SESSION_IDLE_TIMEOUT_MS.name} (milliseconds, at most ${P(dw)}) in the environment of every --cli call.`;function be(n){let o=he(n);return`Hint: this --cli session went longer than ${o===void 0?`its idle timeout (${P(cL)} by default)`:`its idle timeout of ${P(o)} (${o} ms)`} without a control call ${Se}`}function we(n){let o=y(n)?.candidates;if(!Array.isArray(o))return[];return o.flatMap((s)=>{let a=y(s);if(typeof a?.deviceId!=="string")return[];return[typeof a.platform==="string"?`${a.deviceId} (${a.platform})`:a.deviceId]})}function Te(n){let o=we(n);return`Hint: more than one device matches this call. Re-run with --deviceId <id> to pick one, or with --session-uuid <uuid> to use a device your session holds.${o.length>0?` Candidates: ${o.join(", ")}.`:""}`}var ve=new Map([[Kc,"Hint: the device's previous session is still finishing its cleanup. Re-run the command after the retryAfterMs in the error has passed; nothing else needs to change."],[Xu,"Hint: the device is being shut down. Re-run the command after the retryAfterMs in the error has passed, once the shutdown has finished."],[Zu,"Hint: this session is being released because its device is being shut down, so its session UUID cannot be used again. Retrying with the same --session-uuid will not succeed; acquire the device again under a new session instead."],[jh,"Hint: the device's session is moving to another device. Re-run the command after the retryAfterMs in the error has passed, once the rebind has settled."],[kw,"Hint: the session no longer holds this device; it was rebound or released. Check who holds the device now with --daemon active-sessions before re-running the command."],[ru,"Hint: another AutoMobile daemon on this host is using the device. Re-run after it releases the device, or pass another deviceId."]]);function J(n,o){let s=ge(n);if(s===Oo&&ye(n)==="cli-idle-timeout")return be(n);if(s===sS)return Te(n);let a=typeof s==="string"?ve.get(s):void 0;if(a!==void 0)return a;if(s!==yW)return;if(Fr(o))return`Hint: another session holds the device, and ${o} cannot join it: acquisition tools mint their own session and the CLI ignores --session-uuid for them. If that session is yours, skip re-acquiring and pass --session-uuid <uuid> to your follow-up calls; to see who holds the device, run --daemon active-sessions (releasing a session that is not yours can break another agent's work); otherwise wait for the holder to release it.`;return`Hint: a device a session holds takes calls only from that session. Re-run with --session-uuid <uuid>, the sessionUuid that getAndroid, getApple or startDevice returned when the device was acquired, or wait for the holder to release it.${t7(o,"force")?" To stop it anyway, pass --force true.":""}`}import p from"fs";import q from"path";var Oe="tool-selection-profile",Ce=3000,Ee=50,_e=L.next(),Pe;function O(n){return q.join(si("cli",n),Oe)}function Ie(n){return`${O(n)}.lock`}async function I(n,o=process.env){let s=De(o,Pe??{});if(!await s.acquire())return!1;try{await n()}finally{s.release()}return!0}function De(n,o){let s=o.timer??i,a=Math.max(1,o.pollIntervalMs??Ee),l=o.timeoutMs??Ce,c=Ie(n),d=o.pid??process.pid,u=o.ownerToken??_e,f=s.now()+l;return{acquire:async()=>{try{for(;;){if(_i(c,{pid:d,isProcessRunning:o.isProcessRunning,ownerGeneration:o.ownerGeneration??Nt,reclaimOwnPid:!0,ownerToken:u}))return!0;if(s.now()>=f)return!1;await s.sleep(Math.min(a,f-s.now()))}}catch(m){return e.debug(`Unable to acquire CLI tool-selection profile lock: ${r(m)}`),!1}},release:()=>{vi(c,d,u)}}}function h(n=process.env){try{let o=p.readFileSync(O(n),"utf8").trim();if(o.length===0)return;if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(o)){e.debug("Ignoring persisted CLI tool-selection profile because the file content is not a valid UUID");return}return o}catch(o){e.debug(`Unable to load the persisted CLI tool-selection profile: ${r(o)}`);return}}function V(n=process.env){let o=O(n),s=q.dirname(o);try{if(p.accessSync(s,p.constants.W_OK),p.existsSync(o)){if(!p.statSync(o).isFile())throw Error("profile path is not a regular file");p.accessSync(o,p.constants.W_OK)}}catch(a){throw new t(`CLI tool-selection profile store is not writable: ${o}. Fix its permissions or set AUTOMOBILE_DATA_DIR/AUTO_MOBILE_DATA_DIR to a writable directory so the CLI can persist a stable tool-selection profile across invocations.`,{cause:a})}}function G(n,o=process.env){let s=n.trim();if(s.length===0)return;let a;try{let l=O(o);if(a=`${l}.${process.pid}.${L.next()}.tmp`,p.writeFileSync(a,s,{encoding:"utf8",mode:384}),process.platform!=="win32")p.chmodSync(a,384);if(p.renameSync(a,l),a=void 0,process.platform!=="win32")p.chmodSync(l,384)}catch(l){if(e.debug(`Unable to persist the CLI tool-selection profile: ${r(l)}`),a)try{p.unlinkSync(a)}catch(c){e.debug(`Unable to remove incomplete CLI tool-selection profile: ${r(c)}`)}}}function xe(n){let o=n/60000;return`${o} ${o===1?"minute":"minutes"}`}function Z(n){if(typeof n==="string"&&n.trim()==="")throw new t("--session-uuid requires a non-empty value")}function ke(n){let o=yi(n[0]);if(o.flag!=="--session-uuid")return{sessionUuid:void 0,toolNameIndex:0};let s=o.inlineValue!==void 0,a=s?o.inlineValue:n[1],l=s?1:2;if(n.length<=l)throw new t("--session-uuid requires a value and a tool name");return Z(a),{sessionUuid:a,toolNameIndex:l}}function Ae(n){return K(n,F)}function z(n,o){return n&&Object.hasOwn(n,o)?n[o]:void 0}function K(n,o){if(n.length===0)throw new t("No tool name provided. Usage: --cli [--session-uuid <uuid>] <tool-name> [--param value ...]");let{sessionUuid:s,toolNameIndex:a}=ke(n),l=n[a],c=new Map,d=o(l);for(let u=a+1;u<n.length;u++){let f=n[u];if(!f.startsWith("--"))throw new t(`Invalid parameter format: ${f}. Parameters must start with --`);let{flag:m,inlineValue:D}=yi(f),b=m.slice(2).replace(/-([a-z])/g,(Qe,re)=>re.toUpperCase());if(D!==void 0){c.set(b,_(D,z(d,b)));continue}let w=n[u+1],oe=w!==void 0&&/^---(?:\s|$)/.test(w);if(w===void 0||w.startsWith("--")&&!oe)c.set(b,!0);else u++,c.set(b,_(w,z(d,b)))}return Z(c.get("sessionUuid")),{toolName:l,sessionUuid:s,params:Object.fromEntries(c)}}var Le=(n)=>new VE(n);async function $e(n,o){if(o===bt)return;if(N.getTool(o)?.hidden)return;let s=h();if(!s){await Me(n,o);return}await Ue(n,o,s)}async function Ue(n,o,s){let a;try{n.setToolSelectionProfileUuid?.(s),a=await n.callTool(bt,{toolName:o,enabled:!0,sessionUuid:s})}catch(f){e.debug(`CLI pre-enable of ${o} did not apply: ${r(f)}`);return}let l=Ff(a);if(!(a?.isError===!0||l===void 0||l!==s))return;if(n.setToolSelectionProfileUuid?.(void 0),e.debug(`CLI tool-selection profile ${s} is stale; re-minting a profile`),await I(async()=>{let f=h();if(f&&f!==s){if(await X(n,o,f))return;n.setToolSelectionProfileUuid?.(void 0)}await Q(n,o)}))return;let u=h();e.debug(`CLI pre-enable of ${o} skipped after a contended profile-lock timeout; ${u?"a profile is now persisted for the next invocation":"the next invocation will retry"}, and the tool call will surface any gate error.`)}async function Me(n,o){if(!await I(async()=>{let a=h();if(a){if(await X(n,o,a))return;n.setToolSelectionProfileUuid?.(void 0)}await Q(n,o)})){let a=h();e.debug(`CLI pre-enable of ${o} skipped after a contended profile-lock timeout; ${a?"a profile is now persisted for the next invocation":"the next invocation will retry"}, and the tool call will surface any gate error.`)}}async function X(n,o,s){try{n.setToolSelectionProfileUuid?.(s);let a=await n.callTool(bt,{toolName:o,enabled:!0,sessionUuid:s}),l=Ff(a);return a?.isError!==!0&&l!==void 0&&l===s}catch(a){return e.debug(`CLI pre-enable of ${o} did not apply: ${r(a)}`),!0}}async function Q(n,o){V();try{let s=await n.callTool(bt,{toolName:o,enabled:!0}),a=Ff(s);G(a??"")}catch(s){e.debug(`CLI pre-enable of ${o} did not apply: ${r(s)}`)}}async function Ne(n,o,s){let a=Le({daemonOptions:s,oneShotCli:!0,lifecycleNamespaceEnv:process.env});try{await $e(a,n);let l=await a.callTool(n,o);if(l===null)throw new t(`Daemon returned null result. This may indicate a daemon connectivity issue. Try: bunx ${Os()} --daemon restart`);return l}catch(l){if(l instanceof Qg||l instanceof ey||l instanceof ty)throw new t(`Daemon preflight failed; no device operation started. ${l.message}`);if(l instanceof fe)throw new t(`Daemon became unavailable during tool execution: ${l.message}. Try: auto-mobile --daemon restart`);if(l instanceof t)throw l;let c=r(l);throw new t(x(n,c,{gated:JN(l)}))}finally{if(n!=="listDevices")await a.adoptCliSessionLiveness();await a.close()}}function Re(){return`Usage: auto-mobile --cli doctor [options]
|
|
3
|
+
|
|
4
|
+
Status: status-only and read-only diagnostics.
|
|
5
|
+
|
|
6
|
+
Options:
|
|
7
|
+
--android Filter to Android checks
|
|
8
|
+
--ios Filter to iOS checks
|
|
9
|
+
--json Machine-readable JSON output
|
|
10
|
+
--help Print this help
|
|
11
|
+
|
|
12
|
+
The universal --session-uuid option is accepted and ignored.`}function ee(n){if(Object.hasOwn(n,"repair")||Object.hasOwn(n,"timeoutMs"))return"doctor is status-only; --repair and --timeout-ms were removed. Use --daemon restart to recover the daemon; --daemon diagnose only gathers further diagnostics.";let o=["android","ios","json","help","sessionUuid"],s=Object.keys(n).filter((a)=>!o.includes(a)).map((a)=>`--${a.replace(/[A-Z]/g,(l)=>`-${l.toLowerCase()}`)}`);if(s.length>0)return`Unknown doctor flags: ${s.join(", ")}. Supported flags: --android, --ios, --json, --help (the universal --session-uuid option is accepted and ignored).`;return}function Fe(n){let o=ee(n);if(o!==void 0)throw new t(o)}function rn(n){let o;try{o=K(n,()=>null)}catch(s){return e.debug(`CLI bootstrap routing kept the normal path: ${r(s)}`),!1}if(o.toolName!=="doctor")return!1;return ee(o.params)!==void 0||Boolean(o.params.help)}async function Be(n,o={}){if(Fe(n),n.help){(o.writeOutput??console.log)(Re());return}let s=await import("./chunk-z2xznczw.js"),a=await(o.runDoctor??s.runDoctor)({android:n.android,ios:n.ios});if(n.json===!0)ne(a,"doctor");else(o.writeOutput??console.log)((o.formatConsoleOutput??s.formatConsoleOutput)(a,process.stdout.isTTY??!0));if(a.summary.failed>0)(o.exit??process.exit)(1);return}function te(n){let o=n;if(n&&typeof n==="object"&&"content"in n&&Array.isArray(n.content)){if(n.content.length>0&&n.content[0].type==="text")try{o=JSON.parse(n.content[0].text)}catch(s){e.debug(`CLI tool result is not JSON: ${r(s)}`),o=n}}return o}function He(n){return n?.isError===!0||te(n)?.success===!1}var je={stdout:H,stderr:j};function We(){try{return new sM({outputDirectory:M.getToolOutputsDir()??Lf(),retention:s1})}catch(n){e.debug(`[cli] no tool-output artifact writer available: ${r(n)}`);return}}function ne(n,o){je.stdout.write(B(n,{tool:o,artifactWriter:We()})+`
|
|
13
|
+
`)}function Je(n){if(!n||typeof n!=="object")return n;let{message:o,nextAction:s}=n;if(typeof o!=="string")return n;return typeof s==="string"?`${o}
|
|
14
|
+
Next: ${s}`:o}function qe(n,o){ne(n,o);let s=te(n);if(He(n)){if(s&&typeof s==="object"&&s.error)console.error(Je(s.error));else if(n?.isError===!0&&Array.isArray(n.content)&&n.content[0]?.type==="text")console.error(n.content[0].text);Ve(s,o);let a=J(s,o);if(a)console.error(a);process.exit(1)}}function Ve(n,o){if(o==="executePlan"&&n&&typeof n==="object"&&typeof n.executedSteps==="number"&&typeof n.totalSteps==="number"){if(console.error(`Executed ${n.executedSteps} of ${n.totalSteps} steps`),n.failedStep)console.error(`Failed at step ${n.failedStep.stepIndex+1}: ${n.failedStep.tool}`),console.error(`Step error: ${n.failedStep.error}`)}}async function sn(n,o,s=console){try{if(n.length===0){T(),Y(s);return}if(n[0]==="help"||n[0]==="--help"||n[0]==="-h"){if(T(),n.length>1)Ge(n[1],s);else Y(s);return}let{toolName:a,sessionUuid:l,params:c}=Ae(n);if(l)if(Fr(a))e.debug(`Ignoring session UUID for acquisition tool ${a}: it mints its own`);else c.sessionUuid=l,e.debug(`Using session UUID: ${l}`);if(a==="doctor")return await Be(c);e.debug(`Executing tool via daemon: ${a}`);let d=await Ne(a,c,o);qe(d,a)}catch(a){if(a instanceof t)e.error(`CLI Error: ${a.message}`),console.error(`Error: ${a.message}`);else e.error(`Unexpected CLI Error: ${a}`),console.error(`Unexpected error: ${a}`);process.exit(1)}}function Y(n){let o=N.getAllTools(),s=Os();n.log(`
|
|
15
|
+
AutoMobile CLI - Android Device Automation
|
|
16
|
+
|
|
17
|
+
Usage:
|
|
18
|
+
bunx ${s} --cli [--session-uuid <uuid>] <tool-name> [--param value ...]
|
|
19
|
+
bunx ${s} --cli help [tool-name]
|
|
20
|
+
bunx ${s} --ios-templates build --runtime <identifier> --device-type <identifier>
|
|
21
|
+
bunx ${s} --ios-templates clean (--all | --stale | --runtime <identifier> [--device-type <identifier>]) [--force]
|
|
22
|
+
|
|
23
|
+
Examples:
|
|
24
|
+
bunx ${s} --cli listDeviceImages
|
|
25
|
+
bunx ${s} --cli observe
|
|
26
|
+
bunx ${s} --cli tapOn --selector '{"text":"Submit"}'
|
|
27
|
+
bunx ${s} --cli getAndroid --avd-name "pixel_7_api_34"
|
|
28
|
+
bunx ${s} --cli getApple --udid "SIMULATOR-UDID"
|
|
29
|
+
bunx ${s} --cli --session-uuid abc-123-uuid observe
|
|
30
|
+
bunx ${s} --cli --session-uuid $SESSION_UUID tapOn --selector '{"text":"Submit"}'
|
|
31
|
+
|
|
32
|
+
Options:
|
|
33
|
+
help [tool-name] Show help for a specific tool
|
|
34
|
+
--session-uuid <uuid> Associate tool execution with a session (optional).
|
|
35
|
+
The CLI omits it for acquisition tools
|
|
36
|
+
(${WE.join(", ")}), which mint
|
|
37
|
+
their own session. For other tools, an undeclared
|
|
38
|
+
sessionUuid is removed before strict validation.
|
|
39
|
+
|
|
40
|
+
Parameters:
|
|
41
|
+
Parameters are passed as --key value pairs
|
|
42
|
+
Values are converted using the tool's declared parameter type
|
|
43
|
+
Strings: --text 12345 stays the string "12345"
|
|
44
|
+
Boolean values: --flag true or --flag false
|
|
45
|
+
Numbers: --count 5
|
|
46
|
+
Objects: --options '{"key": "value"}'
|
|
47
|
+
Unknown tools or parameters fall back to JSON-if-possible, otherwise string
|
|
48
|
+
|
|
49
|
+
Session-based Execution:
|
|
50
|
+
When using --session-uuid, the tool will be executed on the device assigned to that session.
|
|
51
|
+
This allows multiple tool calls to target the same device in parallel.
|
|
52
|
+
A session acquired or used from the CLI is held on a wall-clock idle timeout
|
|
53
|
+
(${xe(cL)} by default; override with
|
|
54
|
+
AUTOMOBILE_CLI_SESSION_IDLE_TIMEOUT_MS) rather than the
|
|
55
|
+
heartbeat contract a long-running MCP connection keeps, so it survives the gap
|
|
56
|
+
between one-shot invocations. Every control call refreshes it; reads do not.
|
|
57
|
+
|
|
58
|
+
Device ownership:
|
|
59
|
+
A device a session holds takes control calls only from that session. A control
|
|
60
|
+
call without --session-uuid (or with another session's) on a held device is
|
|
61
|
+
refused with code device_owned_by_other_session. Pass the sessionUuid that
|
|
62
|
+
getAndroid, getApple or startDevice returned, or wait for the holder to release
|
|
63
|
+
the device. Reads need no session and are allowed on any device: observe, hitTest,
|
|
64
|
+
identifyInteractions, listApps, getDeviceState, a read-only sqlQuery, and the read
|
|
65
|
+
forms of keyboard, clipboard, displayConfig, accessibility and prototype. A read
|
|
66
|
+
never counts as use. killDevice and deleteDevice also accept --force true to stop
|
|
67
|
+
a held device.
|
|
68
|
+
`);let a=new Map,l=["setActiveDevice","listDevices","listDeviceImages","getAndroid","getApple","killDevice","checkRunningDevices"],c=["changeLocalization"];o.forEach((d)=>{let u="General";if(c.includes(d.name))u="System Configuration";else if(l.includes(d.name))u="Device Management";else if(d.name.includes("App")||d.name.includes("app"))u="App Management";else if(d.name.startsWith("assert"))u="Assertions";else if(d.name.includes("observe"))u="Observation";else if(d.name.includes("Plan")||d.name.includes("plan"))u="Plan Management";else u="Interactions";if(!a.has(u))a.set(u,[]);a.get(u).push(d)}),n.log(`
|
|
69
|
+
Available Tools:`),n.log("================"),a.forEach((d,u)=>{n.log(`
|
|
70
|
+
${u}:`),d.forEach((f)=>{n.log(` ${f.name.padEnd(25)} - ${f.description}`)})}),n.log(`
|
|
71
|
+
Total: ${o.length} tools available`),n.log(`
|
|
72
|
+
Use 'bunx ${s} --cli help <tool-name>' for detailed information about a specific tool.`)}function Ge(n,o){let s=Os(),a=N.getTool(n);if(!a){o.error(`Unknown tool: ${n}`),o.log(`
|
|
73
|
+
Use 'bunx ${s} --cli help' to see available tools.`);return}if(o.log(`
|
|
74
|
+
Tool: ${a.name}`),o.log("=".repeat(a.name.length+6)),o.log(`Description: ${a.description}`),a.supportsProgress)o.log("Supports: Progress notifications");o.log(`
|
|
75
|
+
Parameters:`),o.log(` Pass objects and arrays as JSON, e.g. --selector '{"text":"Submit"}'.`);try{let l=ze(a.schema);if(l)Object.entries(l).forEach(([c,d])=>{let u=Ye(d);if(o.log(` --${c} ${u.isOptional?"(optional)":"(required)"}`),o.log(` Type: ${u.typeName}`),u.description)o.log(` Description: ${u.description}`)});else o.log(" No parameters required")}catch(l){e.debug(`CLI parameter schema help unavailable: ${r(l)}`),o.log(" Could not parse parameter schema")}o.log(`
|
|
76
|
+
Example usage:`),o.log(` bunx ${s} --cli ${n} [parameters...]`)}function ze(n){let o=n?._def;if(!o)return;if(o.shape)return o.shape;if(o.type==="pipe"&&o.out?._def?.shape)return o.out._def.shape;return}function Ye(n){let o=Ze(n),s=o?n?._def?.innerType??n:n,a=s?._def?.typeName??s?._def?.type??"unknown",l=String(a).replace(/^Zod/,"").toLowerCase(),c=["union","intersection","object","record","array","enum","literal","nullable"].includes(l)?S(Tb(s,{io:"input"})):l;return{isOptional:o,typeName:c,description:Ke(n,s)}}function Ze(n){return typeof n?.isOptional==="function"?n.isOptional():n?._def?.typeName==="ZodOptional"}function Ke(n,o){return n?.description??o?.description??o?._def?.description}function S(n){if(n.not&&Object.keys(n.not).length===0)return"never";if(n.allOf)return n.allOf.map((s)=>"("+S(s)+")").join(" & ");let o=n.anyOf??n.oneOf;if(o)return o.map((s)=>S(s)).join(" | ");if("const"in n)return JSON.stringify(n.const);if(n.enum)return n.enum.map((s)=>JSON.stringify(s)).join(" | ");if(n.type==="object")return Xe(n);if(n.type==="array")return"("+S(n.items??{})+")[] (JSON)";return n.type??"any"}function Xe(n){let o=Object.entries(n.properties??{}).map(([s,a])=>JSON.stringify(s)+(n.required?.includes(s)?"":"?")+": "+S(a));if(n.additionalProperties){let s=n.additionalProperties===!0?"any":S(n.additionalProperties);o.push("[key: string]: "+s)}return"JSON { "+o.join(", ")+" }"}export{rn as cliCommandSkipsServerBootstrap,sn as runCliCommand};
|
|
77
|
+
|
|
78
|
+
//# debugId=55AD7D69952A9F9864756E2164756E21
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var d=Object.create;var{getPrototypeOf:a,defineProperty:s,getOwnPropertyNames:T}=Object;var l=Object.prototype.hasOwnProperty;function f(n){return this[n]}var y,m,Lt=(n,r,e)=>{var o=n!=null&&typeof n==="object";if(o){var u=r?y??=new WeakMap:m??=new WeakMap,c=u.get(n);if(c)return c}e=n!=null?d(a(n)):{};let t=r||!n||!n.__esModule||!l.call(n,"default")?s(e,"default",{value:n,enumerable:!0}):e;if(n&&typeof n==="object"||typeof n==="function"){for(let i of T(n))if(!l.call(t,i))s(t,i,{get:f.bind(n,i),enumerable:!0})}if(o)u.set(n,t);return t};var O=(n,r)=>()=>(r||n((r={exports:{}}).exports,r),r.exports);var x=(n)=>n;function g(n,r){this[n]=x.bind(null,r)}var de=(n,r)=>{for(var e in r)s(n,e,{get:r[e],enumerable:!0,configurable:!0,set:g.bind(r,e)})};var vt=import.meta.require;function UY(n){let r=n.findIndex((o)=>o==="--cli"||o==="--daemon"),e=r>=0?n.slice(0,r):n;return e.includes("--version")||e.includes("-v")}function aoe(n,r){return UY(n)?r:void 0}function Pl(n,r){try{return n()}catch(e){return r(e)}}async function coe(n,r){try{return await n()}catch(e){return r(e)}}
|
|
3
|
+
export{Lt,O,de,vt,UY,aoe,Pl,coe};
|
|
4
|
+
|
|
5
|
+
//# debugId=428AE3BC4E8FE3BA64756E2164756E21
|