@kaeawc/auto-mobile 0.0.92 → 0.0.94

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.
Files changed (257) hide show
  1. package/dist/build-info.json +12 -12
  2. package/dist/schemas/test-plan.schema.json +370 -52
  3. package/dist/src/ble-peripheral.py +153 -0
  4. package/dist/src/{chunk-r14wwk37.js → chunk-026y62r9.js} +12 -12
  5. package/dist/src/chunk-0jyfg947.js +4 -0
  6. package/dist/src/{chunk-950qcq1e.js → chunk-0zfpp1wh.js} +4 -4
  7. package/dist/src/chunk-13qxf7ym.js +7 -0
  8. package/dist/src/chunk-1scenrk7.js +4 -0
  9. package/dist/src/chunk-1vb5ph1k.js +4 -0
  10. package/dist/src/chunk-20g565q7.js +5 -0
  11. package/dist/src/chunk-21h6dhdm.js +5 -0
  12. package/dist/src/{chunk-2e6s75qv.js → chunk-25mfpthk.js} +8 -8
  13. package/dist/src/{chunk-9rkfyt6q.js → chunk-2b39zyxc.js} +3 -3
  14. package/dist/src/chunk-2gzd6wbd.js +4 -0
  15. package/dist/src/{chunk-eka89q3k.js → chunk-3dntffy9.js} +1 -1
  16. package/dist/src/chunk-3gfczcsn.js +4 -0
  17. package/dist/src/chunk-3h5jz1vb.js +9 -0
  18. package/dist/src/chunk-41zcy6b3.js +5 -0
  19. package/dist/src/chunk-47n9m2de.js +4 -0
  20. package/dist/src/chunk-4vxeq0vd.js +58 -0
  21. package/dist/src/chunk-59dx6qaf.js +4 -0
  22. package/dist/src/chunk-5sdf9y92.js +4 -0
  23. package/dist/src/chunk-5wk1t46v.js +5 -0
  24. package/dist/src/chunk-661c50hh.js +17 -0
  25. package/dist/src/chunk-68n6bjjd.js +21 -0
  26. package/dist/src/{chunk-zg67wjkh.js → chunk-69pmjdf2.js} +3 -3
  27. package/dist/src/chunk-6hrj3jt6.js +145 -0
  28. package/dist/src/{chunk-b4cxdzwy.js → chunk-6myr26wx.js} +8 -8
  29. package/dist/src/chunk-6n96k09n.js +4 -0
  30. package/dist/src/chunk-6vwrbkre.js +4 -0
  31. package/dist/src/chunk-6wk0yrab.js +4 -0
  32. package/dist/src/chunk-6yhm9een.js +4 -0
  33. package/dist/src/chunk-7k7gjg2t.js +7 -0
  34. package/dist/src/chunk-7n5fz68h.js +4 -0
  35. package/dist/src/chunk-8cvnpnbp.js +4 -0
  36. package/dist/src/chunk-8kzv7rk7.js +4 -0
  37. package/dist/src/chunk-8nj68t1v.js +167 -0
  38. package/dist/src/{chunk-r20pe1nv.js → chunk-96r3bpg7.js} +3 -3
  39. package/dist/src/chunk-97x887te.js +4 -0
  40. package/dist/src/{chunk-sz1a7p43.js → chunk-99a6tbvd.js} +1 -1
  41. package/dist/src/chunk-9p5d2994.js +5 -0
  42. package/dist/src/{chunk-w7zsh13a.js → chunk-9q265er0.js} +4 -4
  43. package/dist/src/chunk-9xgnrv5w.js +5 -0
  44. package/dist/src/chunk-9xgsmshb.js +5 -0
  45. package/dist/src/chunk-a02d1wgv.js +4 -0
  46. package/dist/src/{chunk-km0dy5vc.js → chunk-a9ps00a1.js} +10 -10
  47. package/dist/src/chunk-aewdveet.js +5 -0
  48. package/dist/src/chunk-b3tdtq7r.js +9 -0
  49. package/dist/src/chunk-bn7jx7a2.js +4 -0
  50. package/dist/src/chunk-bnyw27ja.js +4 -0
  51. package/dist/src/{chunk-s1zq65ny.js → chunk-bpwsg76p.js} +2 -2
  52. package/dist/src/chunk-bvranw3g.js +4 -0
  53. package/dist/src/chunk-c25a84zb.js +4 -0
  54. package/dist/src/chunk-c27yv1dx.js +5 -0
  55. package/dist/src/chunk-c3ewxm4x.js +5 -0
  56. package/dist/src/chunk-cb1ga9rd.js +7 -0
  57. package/dist/src/chunk-cn7fwy7k.js +4 -0
  58. package/dist/src/chunk-cnvy4a64.js +4 -0
  59. package/dist/src/chunk-cqhw4yr6.js +5 -0
  60. package/dist/src/{chunk-v90es00d.js → chunk-ctmfshjc.js} +2 -2
  61. package/dist/src/chunk-ctwmhz13.js +4 -0
  62. package/dist/src/{chunk-qv2918jt.js → chunk-d3jx9bz5.js} +2 -2
  63. package/dist/src/{chunk-wry6skrm.js → chunk-d6rb08ga.js} +1 -1
  64. package/dist/src/chunk-ddqhj4eg.js +5 -0
  65. package/dist/src/{chunk-d57432wq.js → chunk-ddrhs1c3.js} +2 -2
  66. package/dist/src/chunk-dnjnh9p6.js +4 -0
  67. package/dist/src/{chunk-ajsrz473.js → chunk-dw5rwgya.js} +3 -3
  68. package/dist/src/chunk-e0870khr.js +5 -0
  69. package/dist/src/chunk-ea3k10kj.js +4 -0
  70. package/dist/src/chunk-emv82m1w.js +7 -0
  71. package/dist/src/chunk-f3m6pdnx.js +4 -0
  72. package/dist/src/chunk-f84z32cb.js +4 -0
  73. package/dist/src/chunk-fpczgf0z.js +4 -0
  74. package/dist/src/chunk-g2js4c2v.js +971 -0
  75. package/dist/src/chunk-g3af2qbk.js +5 -0
  76. package/dist/src/chunk-gadtna7s.js +11 -0
  77. package/dist/src/{chunk-c9nk1r78.js → chunk-gcyx407v.js} +3 -3
  78. package/dist/src/{chunk-jdqvcq0a.js → chunk-gfpntwc1.js} +3 -3
  79. package/dist/src/chunk-gmnm5e3e.js +4 -0
  80. package/dist/src/chunk-gp6vb5gf.js +4 -0
  81. package/dist/src/chunk-gppgy7pa.js +4 -0
  82. package/dist/src/chunk-hegfz0ae.js +5 -0
  83. package/dist/src/chunk-hpzxdp1k.js +17 -0
  84. package/dist/src/{chunk-2v7tw1nj.js → chunk-j69g8b50.js} +3 -3
  85. package/dist/src/chunk-jvstjnqm.js +19 -0
  86. package/dist/src/chunk-jzqrv78s.js +4 -0
  87. package/dist/src/chunk-k2948b8d.js +4 -0
  88. package/dist/src/chunk-k4ftd40d.js +4 -0
  89. package/dist/src/chunk-kd9vfaxh.js +5 -0
  90. package/dist/src/{chunk-34zxqcmq.js → chunk-kdczmgwk.js} +3 -3
  91. package/dist/src/chunk-ke3wn14v.js +4 -0
  92. package/dist/src/chunk-kh5n7m6w.js +4 -0
  93. package/dist/src/{chunk-0dfnyfkh.js → chunk-khejfph4.js} +3 -3
  94. package/dist/src/chunk-kny2xemh.js +4 -0
  95. package/dist/src/chunk-knyzw9md.js +4 -0
  96. package/dist/src/chunk-mbzpt2hp.js +4 -0
  97. package/dist/src/chunk-mm8rcxad.js +4 -0
  98. package/dist/src/chunk-nc4516tx.js +4 -0
  99. package/dist/src/{chunk-stfzjr9y.js → chunk-ntfrqrqn.js} +5 -5
  100. package/dist/src/chunk-nz5h2j52.js +4 -0
  101. package/dist/src/chunk-p22s97qy.js +4 -0
  102. package/dist/src/chunk-p9kt1sgr.js +6 -0
  103. package/dist/src/{chunk-9y5bcy28.js → chunk-pf282r5g.js} +4 -4
  104. package/dist/src/chunk-pnd4mrxy.js +4 -0
  105. package/dist/src/chunk-pqqteyj6.js +4 -0
  106. package/dist/src/chunk-qj1tbnv2.js +8 -0
  107. package/dist/src/chunk-qnh9egwr.js +4 -0
  108. package/dist/src/chunk-qy3khhf8.js +8 -0
  109. package/dist/src/chunk-r0vp315h.js +11 -0
  110. package/dist/src/chunk-r4j43b9s.js +237 -0
  111. package/dist/src/{chunk-4pfftt07.js → chunk-r54cxxze.js} +3 -3
  112. package/dist/src/chunk-r6pvhj33.js +325 -0
  113. package/dist/src/chunk-rb7aa5gr.js +54 -0
  114. package/dist/src/chunk-rdj50kb4.js +4 -0
  115. package/dist/src/chunk-rnd4vcas.js +4 -0
  116. package/dist/src/chunk-s3y3zfcx.js +14 -0
  117. package/dist/src/chunk-s4g43k75.js +5 -0
  118. package/dist/src/chunk-sfqe223f.js +311 -0
  119. package/dist/src/chunk-sqdrxjw5.js +7 -0
  120. package/dist/src/{chunk-0w1spptt.js → chunk-t54k47em.js} +4 -4
  121. package/dist/src/chunk-tek4pnvv.js +26 -0
  122. package/dist/src/chunk-tn74y7af.js +4 -0
  123. package/dist/src/chunk-tvq0nzam.js +5 -0
  124. package/dist/src/chunk-tx4f0h9c.js +6 -0
  125. package/dist/src/chunk-vdqag3fj.js +5 -0
  126. package/dist/src/chunk-vz5zzs57.js +4 -0
  127. package/dist/src/chunk-w4s2vfpj.js +4 -0
  128. package/dist/src/chunk-w5yypt53.js +42 -0
  129. package/dist/src/{chunk-r0f1q783.js → chunk-w68v64vh.js} +3 -3
  130. package/dist/src/chunk-whwj0pdk.js +5 -0
  131. package/dist/src/chunk-wnmqt1dc.js +4 -0
  132. package/dist/src/{chunk-8en08r7q.js → chunk-wpe46vsa.js} +3 -3
  133. package/dist/src/chunk-wxdjeb4k.js +27 -0
  134. package/dist/src/chunk-xcqzwf9j.js +247 -0
  135. package/dist/src/chunk-xezekwwn.js +5 -0
  136. package/dist/src/chunk-xf19m15s.js +4 -0
  137. package/dist/src/chunk-xghbxha4.js +4 -0
  138. package/dist/src/{chunk-jhnbfj19.js → chunk-xn9m3xc2.js} +5 -5
  139. package/dist/src/{chunk-a4k9rt7z.js → chunk-yqfz4vts.js} +3 -3
  140. package/dist/src/chunk-z8tvs8nk.js +5 -0
  141. package/dist/src/chunk-zm2rehqb.js +5 -0
  142. package/dist/src/chunk-zs6dqm35.js +4 -0
  143. package/dist/src/daemon/processEntry.js +2 -2
  144. package/dist/src/index.js +4 -4
  145. package/dist/src/runtime/bunRuntimeGuard.js +2 -2
  146. package/dist/src/utils/workers/iosBundleExtractWorker.js +2 -2
  147. package/ios/CameraPosterInjection/Injection/CameraPosterInjection.m +466 -0
  148. package/package.json +4 -3
  149. package/schemas/test-plan.schema.json +370 -52
  150. package/dist/src/chunk-09442h7v.js +0 -4
  151. package/dist/src/chunk-0e4gm1kj.js +0 -5
  152. package/dist/src/chunk-0eb8576f.js +0 -4
  153. package/dist/src/chunk-0rjm4nx7.js +0 -5
  154. package/dist/src/chunk-1zmh2eak.js +0 -4
  155. package/dist/src/chunk-28k63ha3.js +0 -5
  156. package/dist/src/chunk-2d4wmp8b.js +0 -4
  157. package/dist/src/chunk-32jpxz2y.js +0 -323
  158. package/dist/src/chunk-3jmvqygr.js +0 -238
  159. package/dist/src/chunk-3swvfhqt.js +0 -5
  160. package/dist/src/chunk-44bt78m9.js +0 -5
  161. package/dist/src/chunk-488vt2bp.js +0 -4
  162. package/dist/src/chunk-4fgdhcwx.js +0 -5
  163. package/dist/src/chunk-4jp2se4w.js +0 -4
  164. package/dist/src/chunk-4vhr9e4t.js +0 -4
  165. package/dist/src/chunk-4xd6zs3y.js +0 -15
  166. package/dist/src/chunk-51567pg8.js +0 -4
  167. package/dist/src/chunk-5agqsfev.js +0 -4
  168. package/dist/src/chunk-5d706gmr.js +0 -4
  169. package/dist/src/chunk-5kd4rqk7.js +0 -5
  170. package/dist/src/chunk-61t538bm.js +0 -4
  171. package/dist/src/chunk-6d3mmqxt.js +0 -54
  172. package/dist/src/chunk-6hyt398x.js +0 -5
  173. package/dist/src/chunk-6mnr8kpm.js +0 -4
  174. package/dist/src/chunk-79q5xsdc.js +0 -42
  175. package/dist/src/chunk-7bdgand3.js +0 -4
  176. package/dist/src/chunk-84cp9dw5.js +0 -4
  177. package/dist/src/chunk-86f2h5ww.js +0 -5
  178. package/dist/src/chunk-8cghfzb2.js +0 -19
  179. package/dist/src/chunk-9tf2p9y9.js +0 -5
  180. package/dist/src/chunk-a2sc4jm0.js +0 -5
  181. package/dist/src/chunk-aa5ng3d1.js +0 -4
  182. package/dist/src/chunk-b3h0a6ca.js +0 -4
  183. package/dist/src/chunk-b6a737qt.js +0 -4
  184. package/dist/src/chunk-bn64x5z5.js +0 -5
  185. package/dist/src/chunk-bvh649za.js +0 -12
  186. package/dist/src/chunk-c9tyfg4j.js +0 -26
  187. package/dist/src/chunk-cfsdfqnm.js +0 -4
  188. package/dist/src/chunk-cxyf04jc.js +0 -7
  189. package/dist/src/chunk-da08tx5v.js +0 -4
  190. package/dist/src/chunk-f2tc08m2.js +0 -4
  191. package/dist/src/chunk-f8tnk179.js +0 -5
  192. package/dist/src/chunk-f9s1kkhx.js +0 -5
  193. package/dist/src/chunk-fbp8a4rx.js +0 -4
  194. package/dist/src/chunk-fd2z0sze.js +0 -4
  195. package/dist/src/chunk-fk927f4q.js +0 -54
  196. package/dist/src/chunk-fxmr3a0f.js +0 -4
  197. package/dist/src/chunk-gaqwhd44.js +0 -4
  198. package/dist/src/chunk-ggtd5x5a.js +0 -5
  199. package/dist/src/chunk-gndcfrm7.js +0 -4
  200. package/dist/src/chunk-h3n4adc6.js +0 -310
  201. package/dist/src/chunk-h5pjbb83.js +0 -4
  202. package/dist/src/chunk-hgnnh302.js +0 -4
  203. package/dist/src/chunk-hmke8nhx.js +0 -5
  204. package/dist/src/chunk-j2bx12hn.js +0 -4
  205. package/dist/src/chunk-j70y1a2g.js +0 -4
  206. package/dist/src/chunk-js1jpyxp.js +0 -6
  207. package/dist/src/chunk-kbjq0qvb.js +0 -4
  208. package/dist/src/chunk-kfwx57xd.js +0 -4
  209. package/dist/src/chunk-kzwctna2.js +0 -4
  210. package/dist/src/chunk-m9ehyehy.js +0 -4
  211. package/dist/src/chunk-mct91p1f.js +0 -4
  212. package/dist/src/chunk-mf9spd4g.js +0 -5
  213. package/dist/src/chunk-mgrcansb.js +0 -4
  214. package/dist/src/chunk-mqc1d0eb.js +0 -6
  215. package/dist/src/chunk-n1zmpk0z.js +0 -4
  216. package/dist/src/chunk-ncyjf63g.js +0 -4
  217. package/dist/src/chunk-nr64d21q.js +0 -973
  218. package/dist/src/chunk-nwm2pq5v.js +0 -168
  219. package/dist/src/chunk-pm06b05d.js +0 -9
  220. package/dist/src/chunk-q50s00ry.js +0 -4
  221. package/dist/src/chunk-qwye1958.js +0 -14
  222. package/dist/src/chunk-r8z9pfve.js +0 -5
  223. package/dist/src/chunk-rdpgkjf6.js +0 -4
  224. package/dist/src/chunk-rkr0dks9.js +0 -5
  225. package/dist/src/chunk-rn84t3sf.js +0 -11
  226. package/dist/src/chunk-s123kn7n.js +0 -4
  227. package/dist/src/chunk-s73qn3fx.js +0 -4
  228. package/dist/src/chunk-sjn0nj4p.js +0 -5
  229. package/dist/src/chunk-sns0c35v.js +0 -7
  230. package/dist/src/chunk-t4dr5c8v.js +0 -8
  231. package/dist/src/chunk-tc8k9c1j.js +0 -4
  232. package/dist/src/chunk-teznhase.js +0 -4
  233. package/dist/src/chunk-ty9xgmz4.js +0 -4
  234. package/dist/src/chunk-tyazf3sk.js +0 -145
  235. package/dist/src/chunk-v6npjrjm.js +0 -5
  236. package/dist/src/chunk-vbvtzkwz.js +0 -5
  237. package/dist/src/chunk-vefd8qee.js +0 -8
  238. package/dist/src/chunk-vs9r72ta.js +0 -17
  239. package/dist/src/chunk-w2mwa0jk.js +0 -4
  240. package/dist/src/chunk-w88k0bgr.js +0 -4
  241. package/dist/src/chunk-wzdt0enk.js +0 -4
  242. package/dist/src/chunk-xhhv854c.js +0 -4
  243. package/dist/src/chunk-y58270hd.js +0 -4
  244. package/dist/src/chunk-yk0hmbex.js +0 -4
  245. package/dist/src/chunk-ympy4fdz.js +0 -28
  246. package/dist/src/chunk-yw436axy.js +0 -4
  247. package/dist/src/chunk-z04jrpjy.js +0 -5
  248. package/dist/src/chunk-z2xznczw.js +0 -4
  249. package/dist/src/chunk-z4xnrgps.js +0 -4
  250. package/dist/src/chunk-z7csyszv.js +0 -4
  251. package/dist/src/chunk-z8t0v07j.js +0 -11
  252. package/dist/src/chunk-z916af47.js +0 -228
  253. package/dist/src/chunk-zcr8he8q.js +0 -5
  254. package/dist/src/chunk-zd9vmkzn.js +0 -9
  255. package/dist/src/chunk-zj939v0h.js +0 -5
  256. package/dist/src/chunk-zkdjwtc1.js +0 -4
  257. package/dist/src/chunk-zkv5kzt6.js +0 -4
@@ -0,0 +1,11 @@
1
+ // @bun
2
+ import{h,Y,I,pt}from"./chunk-5wk1t46v.js";import{t,u}from"./chunk-2b39zyxc.js";import{Kl,oce}from"./chunk-j69g8b50.js";var ke;function Kae(r){ke=r}function Le(){return ke?.()}import{setTimeout as it}from"timers/promises";class UP{timer;offsetMs;leadHighWaterMs=0;wallReportOffsetMs;constructor(r){this.timer=r}now(){let r=this.timer.now(),n=this.timer.monotonicNow?.();if(n===void 0)return r;let o=r-n;if(this.offsetMs===void 0)this.offsetMs=o,this.leadHighWaterMs=o;else if(o>this.leadHighWaterMs){if(this.timer.monotonicIncludesHostSleep!==!0)this.offsetMs+=o-this.leadHighWaterMs;this.leadHighWaterMs=o}else if(o<this.leadHighWaterMs-1000)this.leadHighWaterMs=o;return Math.round(n+this.offsetMs)}toWall(r){let n=this.timer.now()-this.now();if(this.wallReportOffsetMs===void 0||Math.abs(n-this.wallReportOffsetMs)>50)this.wallReportOffsetMs=n;return r+this.wallReportOffsetMs}}var Ur=2147483647;function at(r){return r!=="darwin"&&r!=="linux"}var Oe="1.4";function L8(r){if(r===void 0)return;if(r.split(".").slice(0,2).join(".")===Oe)return;return`Bun ${r} is not the release line (${Oe}.x) whose monotonic clock semantics were verified; whether performance.now() runs through host sleep may have changed, so host sleep and daemon stalls may be judged wrongly (#10962)`}class $f{monotonicIncludesHostSleep;constructor(r=process.platform){this.monotonicIncludesHostSleep=at(r)}async sleep(r){return it(r)}setTimeout(r,n){return global.setTimeout(r,n)}clearTimeout(r){global.clearTimeout(r)}setInterval(r,n){return global.setInterval(r,n)}clearInterval(r){global.clearInterval(r)}now(){return Date.now()}monotonicNow(){return performance.now()}}var i=new $f;var j=5000;function K(r,n=i,o=j){if(r.closed)return Promise.resolve();return new Promise((s,a)=>{let c=!1,d,b=n.setTimeout(()=>{f(()=>{r.destroy?.(),a(u(d??Error("Log stream close stalled"),`Log stream did not emit 'close' within ${o}ms \u2014 the file descriptor may still be held`))})},o),f=(p)=>{if(c)return;c=!0,r.off("error",v),r.off("close",S),n.clearTimeout(b),p()},v=(p)=>{d=p,queueMicrotask(()=>{if(!c)r.destroy?.(p)})},S=()=>f(()=>d?a(d):s());r.once("error",v),r.once("close",S),r.end()})}var{setTimeout:lt,clearTimeout:ct}=globalThis,dt=Date.now,_e={setTimeout:(r,n)=>lt(r,n),clearTimeout:(r)=>ct(r),now:()=>dt()};var rc={DEBUG:0,INFO:1,WARN:2,ERROR:3,NONE:4};function pe(r){if(r===void 0)return null;let n=r.trim().toLowerCase();if(n.length===0)return null;switch(n){case"debug":return rc.DEBUG;case"info":return rc.INFO;case"warn":case"warning":return rc.WARN;case"error":return rc.ERROR;case"none":case"silent":return rc.NONE;default:return null}}function me(r,n){return r.includes("--daemon-mode")?"daemon":`stdio-${n}`}var Me=new Set(["PASSWORD","TOKEN","SECRET","KEY","CREDENTIAL","AUTH","API_KEY","PRIVATE_KEY","ACCESS_TOKEN","REFRESH_TOKEN","CLIENT_SECRET","DATABASE_URL","DB_PASSWORD","GITHUB_TOKEN","NPM_TOKEN","AWS_SECRET_ACCESS_KEY"]),Ce=(r)=>{if(typeof r!=="object"||r===null)return String(r);let n=[];try{return JSON.stringify(r,function(o,s){if(typeof s==="object"&&s!==null){while(n.length>0&&n[n.length-1].holder!==this)n.pop();if(n.some((c)=>c.original===s))return"[circular]";let a={};for(let[c,d]of Object.entries(s))if(!Me.has(c.toUpperCase()))a[c]=d;return n.push({holder:a,original:s}),a}if(typeof s==="number"&&!Number.isFinite(s))return String(s);return s})}catch(o){return"[unserializable]"}},B=(r)=>r.replace(/[\r\n\t]/g," "),ge=(r,n,o,{message:s,args:a})=>{let c=new Date().toISOString(),d=B(s),b=a.length>0?` ${a.map((S)=>B(typeof S==="object"?Ce(S):String(S))).join(" ")}`:"",f=`${d}${b}`,v=f.length>1000?`${f.substring(0,1000)}... (truncated)`:f;if(r==="json")return JSON.stringify({timestamp:c,level:o.toLowerCase(),component:n,event:"log",message:v});return`${c} [${o}] ${v}`};var yn={hostLoad:void 0,gitMetadataClient:void 0,hostPortAvailabilityChecker:void 0,emulatorGrpcPortRegistry:void 0,deviceReadinessProxyDriverProvider:null,telemetryNoOpDefault:!1,auxSocketDir:void 0,bootAdmissionGatesDisabled:!1,processGenerationCaptureDisabled:void 0,logSinksDisabled:void 0};import oe from"fs";import Qe from"path";import{promises as H,readdirSync as Ne}from"fs";var Uf=H.readFile,Gae=H.writeFile,Hf=H.stat,NK=H.unlink;function iM(r,n){if(r===n)return 0;return r<n?-1:1}async function er(r){return(await H.readdir(r)).sort(iM)}async function Tr(r){return(await H.readdir(r,{withFileTypes:!0})).sort((n,o)=>iM(n.name,o.name))}function $i(r){return Ne(r).sort(iM)}function DU(r){return Ne(r,{withFileTypes:!0}).sort((n,o)=>iM(n.name,o.name))}import be from"fs";import k from"os";import y from"path";import{existsSync as mt}from"fs";import{homedir as gt}from"os";import fe from"path";var tS=h.DAEMON_LAUNCH_CWD.name,FK="CORESIMULATOR_DEVICE_SET_PATH";function oM(r="/"){return Kl(()=>process.cwd(),()=>r)}function OU(r=gt()){if(r.length>0&&mt(r))return r;return"/"}function Ld(r=oM(),n=process.env){let o=n[tS]?.trim();return o&&fe.isAbsolute(o)?o:r}function Se(r,n=process.env){if(fe.isAbsolute(r))return r;return fe.resolve(Ld(void 0,n),r)}function Yae(r=process.env){let n=r[FK]?.trim();if(n)r[FK]=Se(n,r)}var Fe=448;function tm(r=process.env,n=k.homedir(),o=Ld(void 0,r)){let s=pt(h.DATA_DIR,r);if(s&&s.length>0)return y.resolve(o,s);if(n&&n.length>0)return y.resolve(o,n,".auto-mobile");return y.join(k.tmpdir(),"auto-mobile")}function LK(r=process.env,n=k.homedir(),o=Ld(void 0,r)){let s=pt(h.LOG_DIR,r);if(s&&s.length>0)return y.resolve(o,s);return y.join(tm(r,n,o),vn.LOGS)}function Jae(r=process.env){if(I(Y.NODE_ENV,r)!=="test")return;if([I(h.LOG_DIR,r),I(h.DATA_DIR,r)].some((o)=>o!==void 0&&o.trim().length>0))return;throw new t(`Unit test is about to write to the real AutoMobile logs directory (${LK(r)}). Unit tests must never touch the user's ~/.auto-mobile: point AUTOMOBILE_DATA_DIR (or AUTOMOBILE_LOG_DIR) at a temp directory the test removes.`)}function Je(r){return y.join(tm(),r)}function HP(r,n=k.userInfo().homedir,o=process.env){let s=pt(h.COORDINATION_DIR,o);if(s&&s.length>0){if(!y.isAbsolute(s))throw Error("AUTOMOBILE_COORDINATION_DIR must be an absolute path so all agents share one coordination directory.");return y.join(s,r)}if(n.length===0)throw Error("Unable to resolve a shared AutoMobile directory without a home directory. Set AUTOMOBILE_COORDINATION_DIR to a writable shared directory.");return y.join(y.resolve(n),".auto-mobile",r)}function BK(r,n=k.userInfo().homedir){if(n.length===0)throw Error("Unable to resolve a host-global AutoMobile directory without an OS account home directory.");return y.join(y.resolve(n),".auto-mobile",r)}function Xu(r,n,o=process.env,s=k.userInfo().homedir){let a=pt(h.ADB_SERVER_COORDINATION_DIR,o);if(a&&a.length>0){if(!y.isAbsolute(a))throw Error("AUTOMOBILE_ADB_SERVER_COORDINATION_DIR must be an absolute path so every daemon on one ADB server shares it.");return y.join(a,r,n)}if(s.length===0)throw Error("Unable to resolve the ADB-server coordination directory without an OS account home directory. Set AUTOMOBILE_ADB_SERVER_COORDINATION_DIR to a writable shared directory.");return y.join(y.resolve(s),".auto-mobile","adb-servers",r,n)}function nc(r){if(be.mkdirSync(r,{recursive:!0,mode:Fe}),be.lstatSync(r).isSymbolicLink())throw Error(`Refusing to use symbolic-link directory: ${r}`);if(process.platform!=="win32")be.chmodSync(r,Fe);return r}function hi(r,n=process.env){return nc(y.join(tm(n),r))}function Xae(r){return nc(HP(r))}function $K(r=process.env,n=k.homedir()){try{return nc(LK(r,n))}catch(o){if(o instanceof Error&&o.message.includes("symbolic-link directory"))throw u(o,"Refusing to use symbolic-link directory for AutoMobile logs");throw u(o,"Unable to initialize the AutoMobile log directory. Set AUTOMOBILE_LOG_DIR to a writable directory.")}}var vn={LOGS:"logs",TOOL_LOGS:"tool_logs",SCREENSHOTS:"screenshots",SNAPSHOTS:"snapshots",VIDEO_ARCHIVE:"video-archive",PERFORMANCE_TRACES:"performance-traces",NAVIGATION_SCREENSHOTS:"navigation-screenshots",VIEW_HIERARCHY:"view_hierarchy",OBSERVE_RESULTS:"observe_results",TOOL_OUTPUTS:"tool_outputs",WINDOW:"window",CACHE:"cache",STATE:"state"};import J from"path";var gi=(r)=>{let n=U(r);return{delayForAttempt(o){return q(o),n}}},zt=(r)=>{if(r.length===0)throw Error("sequenceBackoff requires at least one delay");let n=r.map(U);return{delayForAttempt(o){return q(o),n[Math.min(o-1,n.length-1)]}}},Q=(r)=>{let n=U(r.initialDelayMs),o=r.multiplier??2,s=r.maxDelayMs===void 0?Number.POSITIVE_INFINITY:U(r.maxDelayMs);if(!Number.isFinite(o)||o<1)throw Error(`exponentialBackoff multiplier must be >= 1, got ${o}`);return{delayForAttempt(a){return q(a),U(Math.min(n*o**(a-1),s))}}},Lo=(r)=>{if(typeof r==="number")return gi(r);if(ft(r))return zt(r);if(typeof r==="function")return{delayForAttempt(n){return q(n),U(r(n))}};return r},ft=(r)=>Array.isArray(r),qP=(r,n)=>Lo(r).delayForAttempt(n),q=(r)=>{if(!Number.isInteger(r)||r<1)throw Error(`Backoff attempt must be a positive integer, got ${r}`)},U=(r)=>{if(!Number.isFinite(r))throw Error(`Backoff delay must be finite, got ${r}`);return Math.max(0,Math.floor(r))};var bt=new Set(["EBUSY","EPERM"]),ye=4,yt=zt([10,25,50]);async function ht(r,n){try{return await r.unlink(n),"removed"}catch(o){let s=o?.code;if(s==="ENOENT")return"removed";if(s!==void 0&&bt.has(s))return"transient";return r.logger?.debug(`log pruning could not remove ${n}: ${o}`,o),"failed"}}async function he(r,n){for(let o=1;o<=ye;o++){let s=await ht(r,n);if(s==="removed")return!0;if(s==="failed")return!1;if(o===ye)return r.logger?.debug(`log pruning gave up on ${n} after ${ye} transient unlink failures`),!1;await r.sleep(yt.delayForAttempt(o))}return!1}function vt(r){try{return process.kill(r,0),!0}catch(n){return n?.code!=="ESRCH"}}function Be(r,n){if(r===`${n}.log`)return!0;if(!r.startsWith(`${n}-`))return!1;let o=r.slice(n.length+1);return!/^launch-\d+\.log$/.test(o)}function St(r){let n=/^(?:stdio|server|daemon-launch)-(\d+)(?:-.*)?\.log$/.exec(r);return n?Number(n[1]):void 0}function He(r){return/^daemon-launch-\d+(?:-.*)?\.log$/.test(r)}function xt(r){return{unlink:r.unlink??NK,sleep:r.sleep??((n)=>i.sleep(n)),logger:r.logger}}async function Rt(r,n){await he(r,`${n}.owner`)}async function At(r,n,o,{now:s,abandonedMaxAgeMs:a}){await oce(async()=>{let c=await Hf(n);if(s-c.mtimeMs<=a)return;if(await he(r,n)&&He(o))await Rt(r,n)},()=>{return})}async function Ue(r){let n=r.now??Date.now(),o=r.isProcessAlive??vt,s=r.isDaemonRunning??(()=>!1),a=xt(r),c,d=()=>{if(c!==void 0)return c;let{daemonPidFiles:p,readDaemonOwner:x}=r;if(p&&x){try{let{pidFiles:R,uncertain:D}=p();c={owners:R.flatMap((A)=>{let g=x(A);return g===void 0?[]:[g]}),uncertain:D}}catch(R){r.logger?.debug(`daemon pidfile enumeration for log pruning failed: ${R}`,R),c={owners:[],uncertain:!0}}return c}return c={owners:[],uncertain:s()},c},b=(p)=>{let{owners:x,uncertain:R}=d(),D=J.resolve(r.dir,p),A=x.filter((g)=>typeof g.launchLogPath==="string"&&J.resolve(g.launchLogPath)===D);try{let g=r.readDaemonLaunchLogOwnerTombstone?.(D);if(g!==void 0&&!R)A.push(g)}catch(g){return r.logger?.debug(`launch-log ownership tombstone read failed: ${g}`,g),"unknown"}if(A.length>0)return A.some((g)=>Number.isInteger(g.pid)&&g.pid>0&&o(g.pid))?"alive":"dead";if(R)return"unknown";return x.some((g)=>g.launchLogPath===void 0)?"unknown":"dead"},f;try{f=await er(r.dir)}catch(p){r.logger?.debug(`log pruning skipped because the log directory could not be read: ${p}`,p);return}let v=f.filter((p)=>p.endsWith(".log")),S=v.filter((p)=>Be(p,r.ownPrefix)).sort();if(S.length>r.maxOwnFiles)for(let p of S.slice(0,S.length-r.maxOwnFiles))await he(a,J.join(r.dir,p));for(let p of v){if(!Pt(p,r.ownPrefix,o,b))continue;await At(a,J.join(r.dir,p),p,{now:n,abandonedMaxAgeMs:r.abandonedMaxAgeMs})}}function Pt(r,n,o,s){if(Be(r,n))return!1;let a=St(r);if(a===void 0)return!1;if(o(a))return!1;if(He(r)){if(s(r)!=="dead")return!1}return!0}import wt from"fs";var Ve={create(r,n){return wt.createWriteStream(r,n)}};function We(r){let n=r?.trim().toLowerCase();return n==="text"||n==="json"?n:null}function Ge(r){let n=r?.trim().toLowerCase();return n==="file"||n==="stderr"||n==="both"?n:null}function DE(r=process.env){return We(I(h.LOG_FORMAT,r))??"text"}function qf(r=process.env){return Ge(I(h.LOG_SINK,r))??"file"}function Tt(r,n){if(n===void 0)return r;try{return`${r}: ${n instanceof Error?n.stack??n.message:String(n)}`}catch(o){return r}}function eo(r,n){let o=Tt(r,n);if(DE()==="json"){process.stderr.write(`${JSON.stringify({timestamp:new Date().toISOString(),level:"error",component:"process",event:"log.emergency",message:o})}
3
+ `);return}process.stderr.write(`${o}
4
+ `)}class VP extends t{}function zl(r){if((r&32)!==0)return"managed";if((r&16384)!==0||(r&1)!==0)return"primary";if((r&1024)!==0)return"secondary";return"unknown"}var UK=["RUNNING_MODERATE","RUNNING_LOW","RUNNING_CRITICAL","UI_HIDDEN","BACKGROUND","MODERATE","COMPLETE"];var HK={wallpaperRendering:"Home and Lock Screen wallpaper rendering; excludes widgets and Live Activities.",widgets:"Widget refresh, including app widgets; excludes wallpaper and Live Activities.",liveActivities:"Live Activities and Dynamic Island updates; excludes wallpaper and widgets.",healthServices:"HealthKit data and Health app background work. Health integrations become unavailable.",homeServices:"HomeKit accessories and automations. Home integrations become unavailable.",fitnessServices:"Apple Fitness, coaching, activity awards, and activity sharing.",familyServices:"Family Sharing, family approvals, and parental controls. Changes restriction behavior.",screenTime:"Screen Time limits and usage tracking. Changes restriction behavior.",newsServices:"Apple News background content.",weatherServices:"Apple Weather background forecasts.",tipsServices:"Apple Tips background content.",gameServices:"Game Center and saved-game synchronization; excludes controller input.",mapsSync:"Maps favorites, history, background updates, and suggested destinations; excludes MapKit rendering and location services.",advertising:"Promoted Apple content; excludes advertising privacy preferences and app integrity services.",diagnosticReporting:"Diagnostic collectors, feedback, location analytics, and call-quality reporting; reduces diagnostic evidence, not call transport.",siriAndAppIntents:"iOS Simulator Siri requests, Shortcuts actions, and App Intents; excludes speech services and proactive suggestions.",speechServices:"iOS Simulator speech recognition, dictation, and Siri speech synthesis; excludes Siri requests and App Intents orchestration.",mediaTranscoding:"iOS Simulator Photos image and video conversion; media imports and photo-picker conversions may fail.",photoAnalysis:"Background Photos analysis; may reduce photo search and recognition. Preserves library access, cloud transfers, and shared media-analysis infrastructure.",assistantSuggestions:"Siri inference, knowledge, and proactive suggestions; preserves speech, system voices, and shared language/model infrastructure.",appleIntelligence:"Apple Intelligence orchestration and generative experiences; system writing tools and intelligence integrations may become unavailable. Preserves shared model and speech services.",searchIndexing:"Spotlight and Settings search, including app-provided system indexes; excludes an app's own search service.",appStoreServices:"App Store installation/update services; excludes push and StoreKit payment services.",appleMediaSync:"Apple Music and subscribed/purchased media background services; excludes generic audio/video playback and StoreKit payments.",mailServices:"Apple Mail background services. Mail-based sign-in email workflows may be unavailable.",calendarServices:"Local Calendar database access; excludes server-side calendar integrations in apps.",reminderServices:"Apple Reminders database and background work; excludes reminders maintained by other apps.",personalDataSync:"Exchange, CalDAV, and CardDAV synchronization; preserves local Contacts database access.",safariSync:"Safari bookmark/history synchronization; preserves associated domains, shared credentials, browsing protections, and WebKit.",icloudSettingsSync:"iCloud system-settings synchronization and storage-plan recommendations; preserves accounts, credentials, CloudKit data, Drive, and Photos transfers.",messagingMaintenance:"Apple Messages history cleanup, attachment transfer, and FaceTime message storage; preserves identity, message database XPC helpers, and system calling services.",watchConnectivity:"Paired Watch and companion-device communication.",carPlay:"CarPlay vehicle connectivity.",tvRemote:"Apple TV discovery and remote control.",findMy:"Find My device-location services; excludes general location APIs.",continuity:"Nearby-device Continuity discovery; cross-device workflows may stop working. Preserves system share sheets.",walletServices:"Wallet, Apple Pay, digital identity, and merchant services. Payment sheets, including dependent StoreKit workflows, may fail.",businessServices:"Apple business messaging services; excludes ordinary app messaging.",backgroundSync:"General OS background app scheduling. Control is unsupported to preserve application behavior.",animations:"Android system animation scales: disabled sets all three to zero; enabled sets them to one. Excludes app-owned animation.",screensavers:"Android dream/screensaver activation; excludes wallpaper and widgets.",backup:"Android Backup Manager scheduling for the current user; disables backup and restore test behavior.",mailApp:"Android optional mail apps, including Gmail. Removes mail intent handlers; preserves other apps' messaging.",calendarApp:"Android Calendar app availability; preserves CalendarProvider.",contactsApp:"Android Contacts app availability; preserves ContactsProvider.",mapsApp:"Android Google Maps app; external navigation intents become unavailable.",videoApp:"Android YouTube app; native video links become unavailable.",musicApp:"Android YouTube Music app; preserves shared audio playback.",photosApp:"Android Google Photos app; changes cloud photo sources and choosers. Preserves MediaProvider and DocumentsUI.",assistantApp:"Android Google Search/Assistant app, including voice and home-search integrations.",digitalWellbeing:"Android Digital Wellbeing usage tracking, focus, and app limits.",printing:"Android print spooler and print recommendations; printing becomes unavailable.",accessibilityApps:"Optional Android accessibility apps. Active accessibility services are protected.",textToSpeech:"Android Google speech synthesis; speech-dependent functionality becomes unavailable.",storeApp:"Android Play Store app; installation, updates, billing and licensing may fail.",healthConnect:"Android Health Connect controller and backup app; health integrations become unavailable.",adServices:"Android AdServices API package; advertising/privacy APIs may fail. Does not remove mainline/APEX infrastructure.",onDevicePersonalization:"Android on-device personalization service package; dependent APIs may fail.",wallpaperApps:"Android wallpaper picker and optional live-wallpaper apps; changes wallpaper selection. Does not disable the shared wallpaper framework or widgets.",dialerApp:"Optional Android dialer apps. Default role holders remain protected.",messagesApp:"Optional Android SMS/Messages apps. Default role holders remain protected; excludes other apps' messaging.",googleServicesFramework:"Android Google Services Framework; aggressive control that can break Google account and push integrations.",googlePlayServices:"Android Google Play services; aggressive control that breaks dependent push, authentication, location and other integrations. Keep enabled for workflows that depend on those services.",icloudSync:"Broad iCloud/account synchronization. Control is unsupported; use the narrower icloudSettingsSync setting."};var OE="value-redacted";function ut(r){return r===!0||r==="true"}function Bd(r){return r===!1||r==="false"}var Zae=["first","random","unique"];var Bo=Symbol("displayInventoryOutcome");var rS=[["closed","cover"],["opened","inner"],["rear_display","inner"]];function $d(r){return r.role!=="overlay"&&r.role!=="virtual"}function rm(r){return r?.panels?.length?r.panels:[{key:"0",role:"unknown",sizePx:{width:0,height:0}}]}function WP(r,n,o,s){let{hasPostures:a,pinned:c}=s,d=o.map(({key:p,role:x})=>x?`${p} (${x})`:p).join(", "),b=rS.find(([,p])=>p===n)?.[0],f=a&&n!=="cluster"?`; to make this panel available, change the device posture with ${b?`setPosture {posture: "${b}"}`:"setPosture using a supported posture"}`:"";return`Display "${r}" (${n}) ${n==="cluster"?"is not currently connected":"is not connected in the current posture"}. Connected panels: ${d}. Target a connected panel, omit display, or use display: "active"${f}.${c?" Clear the pin with setActiveDevice {display: null} (include deviceId and sessionUuid), or select another display explicitly.":""}`}function MU(r){if(typeof r!=="object"||r===null)return;let n=r;if(typeof n.width!=="number"||typeof n.height!=="number"||!Number.isInteger(n.width)||n.width<=0||!Number.isInteger(n.height)||n.height<=0)return;return{width:n.width,height:n.height}}function qK(r,n){if(!n)return;let o=r?.filter((s)=>s.sizePx.width===n.width&&s.sizePx.height===n.height);return o?.length===1?o[0].key:void 0}var ze=["tv","watch","automotive","xr-headset","xr-glasses"],X={tv:{systemImageTags:["android-tv","google-tv","google-tv-ps16k"],profileIdPattern:/^tv_/i,defaultProfileId:"tv_1080p"},watch:{systemImageTags:["android-wear-signed","android-wear","android-wear-cn"],profileIdPattern:/^wear(?:os)?_/i,defaultProfileId:"wearos_small_round"},automotive:{systemImageTags:["android-automotive-playstore","android-automotive"],profileIdPattern:/^automotive_/i,defaultProfileId:"automotive_1024p_landscape"},"xr-headset":{systemImageTags:["google-xr","android-xr-v3-playstore","android-xr-preview-playstore"],profileIdPattern:/^xr_headset/i,defaultProfileId:"xr_headset_device"},"xr-glasses":{systemImageTags:["ai-glasses"],profileIdPattern:/^(?:xr_glasses|ai_glasses)_/i,defaultProfileId:"ai_glasses_device"}},$e=ze.map((r)=>({formFactor:r,...X[r]}));function Qae(r){return ze.includes(r)}function Ud(r){return X[r].systemImageTags}function jl(r,n){if(r==="watch"&&n===!1)return"wearos_square";return X[r].defaultProfileId}function ece(r){let n=r?.trim()??"";if(!X.watch.profileIdPattern.test(n))return;if(/round/i.test(n))return!0;return/square|rect/i.test(n)?!1:void 0}function It(r){let n=r.systemImageTag?.trim().toLowerCase(),o=r.profileId?.trim(),s=$e.find((a)=>n?a.systemImageTags.includes(n):!1);if(s)return s.formFactor;return $e.find((a)=>o?a.profileIdPattern.test(o):!1)?.formFactor}function Vf(r){let n=/pixel[_ ]tablet|nexus (?:9|10)/i.test(r.profileId??"")?"tablet":void 0;return nS({...r,hint:n,deviceType:r.profileId})}function ve(r){return typeof r==="number"&&Number.isFinite(r)&&r>0}function nS(r){let n=It({systemImageTag:r.systemImageTag,profileId:r.deviceType});if(n)return n;let o=`${r.deviceType??""} ${r.hint??""}`;if(/fold|flip/i.test(o))return"foldable";let s=r.hint?.trim().toLowerCase();if(s!==void 0&&Dt.has(s))return s;return Et(r)}var Dt=new Set(["phone","tablet","tv","watch","automotive","xr-headset","xr-glasses"]);function Et(r){let{width:n,height:o,density:s}=r;if(!ve(n)||!ve(o)||!ve(s))return"unknown";return Math.hypot(n,o)/s>=7?"tablet":"phone"}var Ui={watchos:"watchOS",tvos:"tvOS",visionos:"visionOS"},Hd={android:"Android",ios:"iOS",...Ui};function dr(r){return r==="android"||r==="ios"}function nm(r,n){return n===void 0?dr(r):r===n}function re(r,n){if(dr(r))return r;throw kt(n,r)}function B8(r,n){return r==="either"?r:re(r,n)}function kt(r,n){return new t(`${r} is not supported on ${Ui[n]} yet. Target an Android or iOS device instead.`)}var sM=1,aM=1798000,cM=1,dM=1000;function ME(r){return r!==void 0&&(r.toolType==="eraser"||r.pressure!==void 0&&r.pressure!==1||r.tilt!==void 0||r.orientation!==void 0||(r.buttons?.length??0)>0)}function tce(r){return(r??[]).reduce((n,o)=>n|(o==="primary"?32:64),0)}function $8(r){return r==="window_read_skipped"||r==="window_list_skipped"}function lM(r){return r.ctrlProxyIncomplete===!0&&!$8(r.ctrlProxyIncompleteReason)}function we(r){return r.$??r}function Ea(r){let n=r.node;if(Array.isArray(n))return n;return n&&typeof n==="object"?[n]:[]}function qt(r){return r.bounds??we(r).bounds}function je(r){return r!==null&&typeof r==="object"&&!Array.isArray(r)}function rce(r){return je(r)&&"hierarchy"in r&&je(r.hierarchy)}function Zu(r){if(!r)return null;let{nativeScale:n,pixelWidth:o,pixelHeight:s}=r;if(typeof n!=="number"||!Number.isFinite(n)||n<=0||typeof o!=="number"||!Number.isFinite(o)||o<=0||typeof s!=="number"||!Number.isFinite(s)||s<=0)return null;return{nativeScale:n,pixelWidth:o,pixelHeight:s}}function NU(r){return Zu(r)??{}}var U8="immediate";var Lt="device_service_disabled";class uM extends t{code=Lt;retryable=!1;tool;resource;labels;disabledLabels;unavailable;howToEnable;deviceId;constructor(r){let n=`Call setDeviceResources with {resources:{${r.resource}:"enabled"}} (enable this default-disabled tool with setToolEnabled or --enable-tool setDeviceResources), or provision/start the simulator without {resources:{${r.resource}:"disabled"}}.`;super(`${r.tool} requires resource ${r.resource} (${r.labels.join(", ")}); disabled labels: ${r.disabledLabels.join(", ")}. Unavailable: ${r.unavailable}. ${n}`);this.name="DeviceServiceDisabledError",this.tool=r.tool,this.resource=r.resource,this.labels=[...r.labels],this.disabledLabels=[...r.disabledLabels],this.unavailable=r.unavailable,this.howToEnable=n,this.deviceId=r.deviceId}toPayload(){return{code:this.code,tool:this.tool,resource:this.resource,labels:this.labels,disabledLabels:this.disabledLabels,unavailable:this.unavailable,howToEnable:this.howToEnable,retryable:this.retryable,deviceId:this.deviceId}}}var Ot="unsafe_device_resource_combination";class Qu extends t{code=Ot;retryable=!1;hazards;howToProceed;constructor(r){super(`Unsafe iOS device resource combination: ${r.map((o)=>`${o.id} (${o.resources.join(", ")}): ${o.reason}`).join("; ")}. Drop or re-enable at least one of the listed resources in each unsafe combination before retrying.`);this.name="UnsafeDeviceResourceCombinationError",this.hazards=r.map((o)=>({...o,resources:[...o.resources],appliesTo:[...o.appliesTo]})),this.howToProceed="Drop or re-enable at least one of the listed resources in each unsafe combination before retrying."}toPayload(){return{code:this.code,retryable:this.retryable,hazards:this.hazards,howToProceed:this.howToProceed}}}function _t(r){return typeof r==="object"&&r!==null&&"unref"in r&&typeof r.unref==="function"}function Mt(r){let{timer:n,timeoutMs:o,deadline:s,unref:a,label:c,timeoutError:d,onTimeout:b}=r;if(s===void 0&&o===void 0)return;let f=o??0,v=()=>{};return{promise:new Promise((p,x)=>{let R=(g)=>{x(d?.()??new t(g)),b?.()},D=(g)=>{if(a&&_t(g))g.unref()};if(s){v=s.whenExpired(n,()=>R(`${c} timed out`),D);return}let A=n.setTimeout(()=>R(`${c} timed out after ${f}ms`),f);D(A),v=()=>n.clearTimeout(A)}),cancel:()=>v()}}function Ke(r,n,o){let s=r.reason;if(o&&(s===void 0||s instanceof DOMException&&s.name==="AbortError"))return new t(`${n} cancelled`);return s===void 0?new DOMException("The operation was aborted.","AbortError"):s}function Ct(r){return Array.isArray(r)}function Ye(r){return Ct(r)?r:[r]}function Nt(r){return typeof r==="function"?[r()]:Ye(r)}function qe(r){for(let n of r)n.then(void 0,()=>{})}async function l(r,{timer:n,timeoutMs:o,deadline:s,unref:a=!1,signal:c,label:d,relabelDefaultAbort:b=!1,timeoutError:f,onTimeout:v}){if(typeof r!=="function")qe(Ye(r));if(c?.aborted)throw Ke(c,d,b);let S,p=c?new Promise((R,D)=>{let A=()=>D(Ke(c,d,b));if(c.addEventListener("abort",A,{once:!0}),S=()=>c.removeEventListener("abort",A),c.aborted)A()}):void 0,x=Mt({timer:n,timeoutMs:o,deadline:s,unref:a,label:d,timeoutError:f,onTimeout:v});try{let R=Nt(r);return qe(R),await Promise.race([...R,...p?[p]:[],...x?[x.promise]:[]])}finally{x?.cancel(),S?.()}}import{readFileSync as Ft}from"fs";function xe(r,n,o){try{r?.(n,o)}catch(s){}}var Bt=50;function Ht(r,n){let o=`${r} (`,s=n.lastIndexOf(")");if(!n.startsWith(o)||s<o.length)return;let a=n.slice(s+1);if(!/^\s/.test(a))return;let c=a.trim().split(/\s+/),[d,...b]=c;if(c.length<Bt||d?.length!==1||b.some((f)=>!/^-?\d+$/.test(f)))return;return d}function Ut(r){return r?.code==="ESRCH"}function st(r,n={}){if(!Number.isInteger(r)||r<=0)return!1;let o=n.signalProcess??((c)=>{process.kill(c,0)});try{o(r)}catch(c){return xe(n.debugLog,`src/daemon/daemonFiles.ts liveness check failed: ${c}`,c),!Ut(c)}if((n.platform??process.platform)!=="linux")return!0;let s;try{s=(n.readProcStat??((d)=>Ft(`/proc/${d}/stat`,"utf-8")))(r)}catch(c){return xe(n.debugLog,`src/daemon/daemonFiles.ts procfs liveness check failed: ${c}`,c),!0}let a=Ht(r,s);if(a===void 0)return xe(n.debugLog,`src/daemon/daemonFiles.ts could not parse /proc/${r}/stat`,s),!0;return a!=="Z"&&a!=="X"}class Z{policy;pending=new Set;timeout;episode;observing=!0;constructor(r){this.policy=r}get stalled(){return this.episode!==void 0}divert(){if(this.episode)this.episode.diverted++}track(r){return new Promise((n,o)=>{let s={issuedAt:this.policy.timer.now(),settle:n,fail:o};this.pending.add(s),this.armOldest();try{r((a)=>this.complete(s,a))}catch(a){this.complete(s,a)}})}suspend(){this.observing=!1,this.clearTimeout()}retire(r){this.suspend();for(let n of this.pending)if(r)n.fail(r);else n.settle(!1);this.pending.clear(),this.episode=void 0}complete(r,n){if(!this.pending.delete(r))return;if(n){if(this.episode)this.episode.failed++;r.fail(n)}else r.settle(!0);if(!this.observing)return;if(this.episode&&!n&&!this.oldestExpired())this.resume();if(this.pending.size===0&&!this.episode)this.clearTimeout();this.armOldest()}oldest(){return this.pending.values().next().value}oldestExpired(){let r=this.oldest();return r!==void 0&&this.policy.timer.now()-r.issuedAt>=this.policy.timeoutMs}resume(){let r=this.episode;if(this.episode=void 0,this.clearTimeout(),r)this.policy.resumed(this.policy.timer.now()-r.detectedAt,r.diverted)}armOldest(){let r=this.oldest();if(!this.observing||this.timeout!==void 0||this.episode||!r)return;this.arm(Math.max(0,this.policy.timeoutMs-(this.policy.timer.now()-r.issuedAt)))}arm(r){if(this.timeout=this.policy.timer.setTimeout(()=>{this.timeout=void 0,this.onDeadline()},r),typeof this.timeout==="object"&&typeof this.timeout.unref==="function")this.timeout.unref()}onDeadline(){if(this.episode){let r=this.policy.timer.now()-this.episode.detectedAt,n=this.pending.size+this.episode.failed;this.retire(),this.policy.abandoned?.(r,n);return}if(!this.oldestExpired()){this.armOldest();return}this.episode={detectedAt:this.policy.timer.now(),diverted:0,failed:0},this.policy.stalled(this.pending.size);for(let r of this.pending)r.settle(!1);if(this.policy.abandonMs!==void 0)this.arm(this.policy.abandonMs)}clearTimeout(){if(this.timeout!==void 0)this.policy.timer.clearTimeout(this.timeout);this.timeout=void 0}}function H8(){return N==="json"}var V=pe(I(h.LOG_LEVEL))??rc.INFO,N=DE(),_=qf(),Re=!1,z=Promise.resolve(),W=(r)=>{z=z.then(()=>r)},M=_==="stderr"?void 0:$K(),F=me(process.argv,process.pid),T=M?Qe.join(M,`${F}.log`):void 0,Vt=(r,n)=>{r.on("error",(o)=>{try{eo(`Log stream error on ${n}`,o)}catch(s){}if(m===r)m=void 0;w.get(r)?.retire(o),C(r),queueMicrotask(()=>r.destroy?.())})},L=new Map,C=(r,n=i)=>{if(r.closed)return;let o=L.get(r);if(o)o.timer.clearTimeout(o.timeoutHandle),r.off("close",o.onClose);let s=o&&n===i?o.timer:n,a=()=>{let d=L.get(r);if(d?.onClose===a)d.timer.clearTimeout(d.timeoutHandle),r.off("close",a),L.delete(r)},c=s.setTimeout(a,j);L.set(r,{timer:s,timeoutHandle:c,onClose:a}),r.once("close",a)},ue=(r)=>{for(let[n,o]of L)if(n.closed)o.onClose();if(L.size>0)return;try{let n=Ve.create(r,{flags:"a"});return Vt(n,r),n}catch(n){eo(`Failed to open log stream ${r}`,n);return}},m=T?ue(T):void 0;function Te(){if(!M||!T)return;return{dir:M,path:T}}var Xe=20000,ie=5000,Wt=30000,Ie=_e,w=new WeakMap,se=0,P;var Gt=10485760,$t=10,jt=86400000,ae;function q8(r){if(ae=r,te&&!te.registeredSweepStarted)et(te)}function de(){if(!ae)throw Error("Log retention namespace source is not registered");return ae}var Kt=()=>{try{let r=de(),{pidFiles:n,uncertain:o}=r.listDaemonPidFilesSync();if(o)return!0;return n.some((s)=>{let a=r.readPidFileDataSync(s);return a?st(a.pid):!1})}catch(r){return e.debug(`daemon liveness probe for log pruning failed: ${r}`,r),!0}},Jt=()=>{try{return de().listDaemonPidFilesSync()}catch(r){return e.debug(`daemon pidfile enumeration for log pruning failed: ${r}`,r),{pidFiles:[],uncertain:!0}}},Yt=(r)=>de().readDaemonOwnerForRetentionSync(r),Xt=(r)=>de().readDaemonLaunchLogOwnerTombstoneSync(r),Qt={daemonPidFiles:Jt,readDaemonOwner:Yt,readDaemonLaunchLogOwnerTombstone:Xt,isDaemonRunning:Kt},Ze=()=>{if(!M)return Promise.resolve();return Ue({dir:M,ownPrefix:F,maxOwnFiles:$t,abandonedMaxAgeMs:jt,...Qt})};function et(r){if(r.timeout!==void 0)return;r.timeout=r.timer.setTimeout(()=>{r.timeout=void 0,r.pending=r.pending.then(async()=>{if(r!==te||r.registeredSweepStarted)return;let n=ae!==void 0;if(r.fallbackStarted&&!n)return;r.fallbackStarted=!0,r.registeredSweepStarted=n;try{await r.prune()}catch(o){e.warn("Startup log pruning failed",o)}})},0)}function Zt(r,n){let o={timer:r,prune:n,pending:Promise.resolve(),fallbackStarted:!1,registeredSweepStarted:!1};return et(o),o}var te=M?Zt(i,Ze):void 0,tr=async(r)=>{w.get(r)?.suspend();try{return await K(r),!0}catch(n){let o=r.closed===!0;if(!o)C(r);return await E("Failed to close log stream before rotation",n),o}},rr=async(r)=>{let n=m;if(m=void 0,n){if(!await tr(n)){ne=Number.POSITIVE_INFINITY;return}}let o=new Date().toISOString().replace(/:/g,"-"),s=Qe.join(r.dir,`${F}-${o}.log`);if(oe.existsSync(r.path))await oe.promises.rename(r.path,s);m=ue(r.path),await Ze()},O,nr=async(r)=>{if(!oe.existsSync(r.path))return;if((await Hf(r.path)).size>=Gt)await rr(r)},or=(r)=>{if(!O)O=nr(r).finally(()=>{O=void 0});return O},De=async(r,n)=>{if(L.size===0&&(m?.destroyed||!m?.writable))m=ue(r.path);await E("Log rotation failed",n)},ne=Number.POSITIVE_INFINITY,ir=32768,sr=async(r)=>{if(ne+=r,ne<ir)return!0;ne=0;let n=Te();if(!n||!m)return!0;try{return await nt(or(n))}catch(o){return await De(n,o),!0}};var le=(r)=>new Promise((n,o)=>{process.stderr.write(`${r}
5
+ `,(s)=>{if(s)o(s);else n()})}),E=async(r,n)=>{if(_==="file")return;let o=`${r}: ${B(String(n))}`,s=N==="json"?JSON.stringify({timestamp:new Date().toISOString(),level:"error",component:F,event:"log.write_failed",message:o}):o;try{await le(s)}catch(a){}},tt=(r)=>{try{oe.writeSync(process.stderr.fd,`${r}
6
+ `)}catch(n){}},Ee=(r,n,o)=>{Pe=r.now(),tt(N==="json"?JSON.stringify({timestamp:new Date(r.now()).toISOString(),level:"error",component:F,event:n,message:B(o)}):B(o))},rt=(r,n)=>{W(ot(ge(N,F,"WARN",{message:`Log sink ${T} resumed after ${r}ms; ${n} line(s) were diverted while it was stalled`,args:[]})).catch((o)=>E("Failed to write log sink recovery",o)))},ar=(r,n,o,s)=>{if(Ee(n,"log.sink_abandoned",`Log sink ${T} abandoned after ${o}ms stalled; ${s} line(s) dropped`),m===r)m=void 0;C(r,n);try{r.destroy?.()}catch(a){}},lr=(r)=>{let n=w.get(r);if(!n){let o=Ie;if(n=new Z({timer:o,timeoutMs:ie,abandonMs:Wt,stalled:(s)=>Ee(o,"log.sink_stalled",`Logging to ${T} stalled: no write completed within ${ie}ms; ${s} line(s) pending`),resumed:rt,abandoned:(s,a)=>ar(r,o,s,a)}),se>0)n.suspend();w.set(r,n)}return n},nt=(r)=>{if(P?.operation===r)return P.completion;let n=Ie,o=new Z({timer:n,timeoutMs:ie,stalled:()=>Ee(n,"log.sink_stalled",`Logging to ${T} stalled: log rotation did not finish within ${ie}ms`),resumed:rt});if(se>0)o.suspend();let s=o.track((a)=>{let c=(d)=>{if(a(d),P?.guard===o)P=void 0};r.then(()=>c(),async(d)=>{let b=o.stalled;c(d);let f=Te();if(b&&f)await De(f,d)}).catch((d)=>E("Failed to recover log rotation",d))});return P={operation:r,guard:o,completion:s},s},Ae=(r=!1)=>{if(r)P?.guard.retire();else P?.guard.suspend();P=void 0},G=(r)=>{if(P?.guard.divert(),m)w.get(m)?.divert();if(_==="file")tt(r)},ce=()=>P?.guard.stalled===!0||m!==void 0&&w.get(m)?.stalled===!0,Pe,V8=(r)=>ce()||Pe!==void 0&&Ie.now()-Pe<=r,cr=async()=>{while(O)try{if(!await nt(O))return!1}catch(r){let n=Te();if(n)await De(n,r)}return!0},ur=async(r)=>{if(!T)return!1;if(ce())return G(r),!1;if(O&&!await cr())return G(r),!1;if(!m)m=ue(T);if(m&&!await sr(Buffer.byteLength(r)+1))return G(r),!1;if(ce())return G(r),!1;return!0},ot=async(r)=>{if(!await ur(r))return;if(ce()){G(r);return}let n=m;if(!n){if(_==="file")await le(r);return}try{await lr(n).track((o)=>{n.write(r+`
7
+ `,o)})}catch(o){if(_==="file"){await le(r);return}throw o}},pr=async(r)=>{if(_==="stderr"||_==="both")await le(r)},mr=(r)=>{if(Re&&N==="text")try{process.stdout.write(`${r}
8
+ `)}catch(n){}},ee=async(r,n,o)=>{if(yn.logSinksDisabled?.())return;try{let s=Le(),a=s?`trace=${s.traceId} ${n}`:n,c=ge(N,F,r,{message:a,args:o}).replace(/[\r\n\t]/g," ");mr(c),await Promise.all([ot(c),pr(c)])}catch(s){await E("Failed to write log",s)}},gr=async(r=i)=>{if(Ae(),m){let n=m;w.get(n)?.suspend(),m=void 0,C(n,r);try{await K(n,r)}finally{C(n,r)}}},e={setLogLevel(r){V=r},getLogLevel(){return V},enableStdoutLogging(){Re=N==="text"},disableStdoutLogging(){Re=!1},debug(r,...n){if(V<=rc.DEBUG)W(ee("DEBUG",r,n).catch((o)=>E("Failed to write debug log",o)))},info(r,...n){if(V<=rc.INFO)W(ee("INFO",r,n).catch((o)=>E("Failed to write info log",o)))},warn(r,...n){if(V<=rc.WARN)W(ee("WARN",r,n).catch((o)=>E("Failed to write warn log",o)))},error(r,...n){if(V<=rc.ERROR)W(ee("ERROR",r,n).catch((o)=>E("Failed to write error log",o)))},async flush(){await z},close(){Ae();let r=m;if(m=void 0,r)w.get(r)?.suspend(),C(r),r.end()},async closeAfterFlush(r=i){if(se++,P?.guard.suspend(),m)w.get(m)?.suspend();let n,o=new AbortController;try{n=r.setTimeout(()=>{Ae(!0);let s=m;if(s)w.get(s)?.retire(),m=void 0,C(s,r),s.destroy?.();z=Promise.resolve(),o.abort(u(Error("Pending log writes stalled"),`Log writes did not flush within ${Xe}ms`))},Xe),await l(z,{timer:r,signal:o.signal,label:"Log writes"})}finally{if(se--,n!==void 0)r.clearTimeout(n)}await gr(r)}};
9
+ export{yn,Kae,UP,Ur,L8,$f,i,rc,Uf,Gae,Hf,NK,iM,er,Tr,$i,DU,tS,FK,oM,OU,Ld,Se,Yae,tm,LK,Jae,Je,HP,BK,Xu,nc,hi,Xae,$K,vn,gi,zt,Q,Lo,qP,DE,qf,eo,VP,zl,UK,HK,OE,ut,Bd,Zae,Bo,rS,$d,rm,WP,MU,qK,Qae,Ud,jl,ece,Vf,nS,Ui,Hd,dr,nm,re,B8,sM,aM,cM,dM,ME,tce,$8,lM,we,Ea,qt,rce,Zu,NU,U8,uM,Qu,l,st,H8,q8,V8,e};
10
+
11
+ //# debugId=A83413083C254EB464756E2164756E21