rnxsim 0.1.374 → 0.1.376

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 (196) hide show
  1. package/cli/commands/box.ts +5 -5
  2. package/cli/commands/control.ts +18 -4
  3. package/cli/ws-bridge.ts +5 -2
  4. package/dist-cli/bin.js +5 -5
  5. package/dist-cli/chunks/{agent-BKCNNEQV.js → agent-H42FCKFF.js} +2 -2
  6. package/dist-cli/chunks/{agent-wrapper-B3AS3ENV.js → agent-wrapper-BBZKTZS6.js} +2 -2
  7. package/dist-cli/chunks/{app-fonts-GWE22XIG.js → app-fonts-43VXIKF4.js} +2 -2
  8. package/dist-cli/chunks/{assert-ORX5Q6AH.js → assert-IXOLVO5Z.js} +2 -2
  9. package/dist-cli/chunks/{auth-REWJRBFP.js → auth-KFMFB6FU.js} +2 -2
  10. package/dist-cli/chunks/{beta-Q2VQZCLD.js → beta-5AO3SJB7.js} +2 -2
  11. package/dist-cli/chunks/{box-I5QZZJBJ.js → box-ZHM66L6K.js} +46 -46
  12. package/dist-cli/chunks/{camera-5HA2IJDC.js → camera-FNJVFCDQ.js} +2 -2
  13. package/dist-cli/chunks/{chunk-GH7XDCAP.js → chunk-37MCSPTE.js} +1 -1
  14. package/dist-cli/chunks/{chunk-N5GTOZJP.js → chunk-3PEMSUAQ.js} +3 -3
  15. package/dist-cli/chunks/chunk-4TQ5HOK3.js +7 -0
  16. package/dist-cli/chunks/{chunk-5VFQ7HKK.js → chunk-5YZYDEMI.js} +1 -1
  17. package/dist-cli/chunks/{chunk-XL53SSTO.js → chunk-6CV3R3XD.js} +2 -2
  18. package/dist-cli/chunks/{chunk-6PV4QLZ7.js → chunk-7LGK5XU6.js} +2 -2
  19. package/dist-cli/chunks/{chunk-XSXSVO4P.js → chunk-7R2TK2NY.js} +1 -1
  20. package/dist-cli/chunks/{chunk-HCORKEG6.js → chunk-7VZZQQEE.js} +3 -3
  21. package/dist-cli/chunks/{chunk-2QVA4PPE.js → chunk-AFOVILIL.js} +1 -1
  22. package/dist-cli/chunks/{chunk-PZYF2TKR.js → chunk-BEU7CD7E.js} +1 -1
  23. package/dist-cli/chunks/{chunk-ZAUPKGQP.js → chunk-CE4JQJ6Y.js} +2 -2
  24. package/dist-cli/chunks/{chunk-MHVH5IJU.js → chunk-CIE6CZXL.js} +2 -2
  25. package/dist-cli/chunks/{chunk-4S5CIP7Y.js → chunk-CSJ7L7ZL.js} +1 -1
  26. package/dist-cli/chunks/chunk-CWCQP53A.js +27 -0
  27. package/dist-cli/chunks/{chunk-HM5TGIVN.js → chunk-DCS5FK5N.js} +1 -1
  28. package/dist-cli/chunks/{chunk-R7NXLMFI.js → chunk-DEV3E3MV.js} +1 -1
  29. package/dist-cli/chunks/{chunk-PYH2MNFB.js → chunk-DGJMIVZM.js} +2 -2
  30. package/dist-cli/chunks/{chunk-2ZE4WXXF.js → chunk-DGX3MN65.js} +1 -1
  31. package/dist-cli/chunks/{chunk-KOSLTZXQ.js → chunk-DNPQMTW5.js} +2 -2
  32. package/dist-cli/chunks/{chunk-7DLC2M6S.js → chunk-DOVBJBVD.js} +2 -2
  33. package/dist-cli/chunks/{chunk-X2YXPZD4.js → chunk-DPBJ3S3J.js} +1 -1
  34. package/dist-cli/chunks/{chunk-PVGD4KKG.js → chunk-FVZBGPCU.js} +2 -2
  35. package/dist-cli/chunks/{chunk-XSWS6HY6.js → chunk-GDKMOIUT.js} +1 -1
  36. package/dist-cli/chunks/{chunk-SNMLG22Y.js → chunk-GIF2NJCS.js} +2 -2
  37. package/dist-cli/chunks/{chunk-VKOEADVP.js → chunk-GZE57ORL.js} +1 -1
  38. package/dist-cli/chunks/{chunk-KN6LU33B.js → chunk-H3U56DKI.js} +2 -2
  39. package/dist-cli/chunks/{chunk-4FYJOFJZ.js → chunk-HZLOYAPH.js} +2 -2
  40. package/dist-cli/chunks/{chunk-Y3LVGZKE.js → chunk-J2IKAEU2.js} +2 -2
  41. package/dist-cli/chunks/{chunk-6VPR6OTH.js → chunk-JXAXYK7W.js} +2 -2
  42. package/dist-cli/chunks/{chunk-IXYE6F2D.js → chunk-KJE2O2GK.js} +2 -2
  43. package/dist-cli/chunks/{chunk-G2IBWLBT.js → chunk-KMNVDZZI.js} +1 -1
  44. package/dist-cli/chunks/{chunk-7PBNTA3M.js → chunk-LC3QRIRB.js} +2 -2
  45. package/dist-cli/chunks/{chunk-A6JPQM7B.js → chunk-LGFTAQYC.js} +1 -1
  46. package/dist-cli/chunks/{chunk-I2C26UZ3.js → chunk-LQMUA5IY.js} +1 -1
  47. package/dist-cli/chunks/{chunk-IQ5HBVID.js → chunk-MFIQTWC5.js} +2 -2
  48. package/dist-cli/chunks/{chunk-TCB6DSON.js → chunk-MGALNF2F.js} +2 -2
  49. package/dist-cli/chunks/{chunk-DYE6WT2Q.js → chunk-MLBZZHOY.js} +2 -2
  50. package/dist-cli/chunks/{chunk-KVMYAHND.js → chunk-NNRF7GIB.js} +2 -2
  51. package/dist-cli/chunks/{chunk-6JBXWVSP.js → chunk-NORLYTTO.js} +2 -2
  52. package/dist-cli/chunks/{chunk-VSGEEW3N.js → chunk-P6KVGV3H.js} +11 -11
  53. package/dist-cli/chunks/chunk-PAJTUK33.js +4 -0
  54. package/dist-cli/chunks/{chunk-2W6ADNTG.js → chunk-QELIC5XP.js} +1 -1
  55. package/dist-cli/chunks/{chunk-GQVWJWCZ.js → chunk-QRDF33WD.js} +1 -1
  56. package/dist-cli/chunks/{chunk-AEMLIV3G.js → chunk-R76BA7C7.js} +3 -3
  57. package/dist-cli/chunks/{chunk-RXDJ422X.js → chunk-RVEB4CZ2.js} +2 -2
  58. package/dist-cli/chunks/{chunk-CBF7RQ3C.js → chunk-SK4M7NXT.js} +1 -1
  59. package/dist-cli/chunks/{chunk-RAYAIDJI.js → chunk-SKMG5DD7.js} +2 -2
  60. package/dist-cli/chunks/{chunk-VOYUOTN2.js → chunk-TEESPOYR.js} +1 -1
  61. package/dist-cli/chunks/{chunk-UQXSAYWY.js → chunk-TH2UFGVP.js} +1 -1
  62. package/dist-cli/chunks/{chunk-RE2IODEB.js → chunk-TLP3T3VO.js} +1 -1
  63. package/dist-cli/chunks/{chunk-2XDNHF7N.js → chunk-TZUABDIJ.js} +2 -2
  64. package/dist-cli/chunks/{chunk-R3HLZSGB.js → chunk-UB2W6OQM.js} +2 -2
  65. package/dist-cli/chunks/{chunk-UHTIDDI2.js → chunk-UYVXALPB.js} +2 -2
  66. package/dist-cli/chunks/{chunk-2MI2ROT4.js → chunk-VQDYFFIG.js} +2 -2
  67. package/dist-cli/chunks/{chunk-KWUKKULB.js → chunk-VWCNJPCJ.js} +2 -2
  68. package/dist-cli/chunks/{chunk-UAMMP7U7.js → chunk-VZIK4WIS.js} +2 -2
  69. package/dist-cli/chunks/{chunk-VDCYIT2N.js → chunk-W3FNXAQP.js} +1 -1
  70. package/dist-cli/chunks/{chunk-5WXRC4BW.js → chunk-XCDNVNP3.js} +1 -1
  71. package/dist-cli/chunks/{chunk-U52Z6BML.js → chunk-XSVILA4Z.js} +2 -2
  72. package/dist-cli/chunks/{chunk-WR6QFC62.js → chunk-XUTJ7ZWD.js} +2 -2
  73. package/dist-cli/chunks/{chunk-QKYOZQKE.js → chunk-YTXY3MHW.js} +2 -2
  74. package/dist-cli/chunks/{chunk-MU77ZSME.js → chunk-ZF7PVX44.js} +2 -2
  75. package/dist-cli/chunks/{chunk-RU565DEH.js → chunk-ZSSG7OR7.js} +1 -1
  76. package/dist-cli/chunks/{cleanup-4ZAL2PTZ.js → cleanup-MLOK2OZA.js} +2 -2
  77. package/dist-cli/chunks/cli-version-OBNR366V.js +4 -0
  78. package/dist-cli/chunks/{compat-6CEUDCO2.js → compat-SHMFSKU7.js} +2 -2
  79. package/dist-cli/chunks/{config-YHATX3ZX.js → config-TPEAEUJ2.js} +2 -2
  80. package/dist-cli/chunks/{connect-LXWD3ILH.js → connect-3LEXWTE5.js} +2 -2
  81. package/dist-cli/chunks/control-Z3FWA6BO.js +4 -0
  82. package/dist-cli/chunks/daemon-RSVYSC65.js +4 -0
  83. package/dist-cli/chunks/{debug-4RKDQCF4.js → debug-GUVAK2KR.js} +3 -3
  84. package/dist-cli/chunks/{desktop-ISJKVEQA.js → desktop-OOP2PTKP.js} +3 -3
  85. package/dist-cli/chunks/{detox-7P5NDA5M.js → detox-C2ILVBEC.js} +2 -2
  86. package/dist-cli/chunks/{device-JXBP6WUE.js → device-NXIQQJWR.js} +2 -2
  87. package/dist-cli/chunks/{diagnose-7JJWOZ23.js → diagnose-2JBGYE5L.js} +2 -2
  88. package/dist-cli/chunks/{disk-cleanup-MXIQGJWO.js → disk-cleanup-VURWJYQV.js} +2 -2
  89. package/dist-cli/chunks/{do-chain-KTAVIZMC.js → do-chain-DJ4UQC7A.js} +2 -2
  90. package/dist-cli/chunks/drivers-JMA2OIKU.js +4 -0
  91. package/dist-cli/chunks/{env-37X232UA.js → env-KTNPKEZR.js} +2 -2
  92. package/dist-cli/chunks/{film-5F5XDOIR.js → film-DCPS7EID.js} +3 -3
  93. package/dist-cli/chunks/flow-4DZ7B2OA.js +4 -0
  94. package/dist-cli/chunks/help-34CJMQY2.js +4 -0
  95. package/dist-cli/chunks/{hidden-runtime-alias-FAPVCHKI.js → hidden-runtime-alias-HHT2C7WE.js} +2 -2
  96. package/dist-cli/chunks/{home-paths-VW3CI5QK.js → home-paths-KTPGCPMS.js} +2 -2
  97. package/dist-cli/chunks/inspect-JF5WYJRD.js +4 -0
  98. package/dist-cli/chunks/install-desktop-ZIC4CDXI.js +4 -0
  99. package/dist-cli/chunks/{login-LDN6ETBS.js → login-TTJAOI2Q.js} +2 -2
  100. package/dist-cli/chunks/{logout-HOHKC7TH.js → logout-ERAQ6SKW.js} +2 -2
  101. package/dist-cli/chunks/{maestro-PCFZZHCH.js → maestro-W46QCF77.js} +3 -3
  102. package/dist-cli/chunks/{maestro-generate-6MSPC66O.js → maestro-generate-VBLM3MTU.js} +3 -3
  103. package/dist-cli/chunks/{mode-GRYQSTZH.js → mode-ZEDZK7R7.js} +2 -2
  104. package/dist-cli/chunks/{optional-demo-registry-RP2H6SQR.js → optional-demo-registry-ZUTPSVYQ.js} +2 -2
  105. package/dist-cli/chunks/{perf-WPW5FWOL.js → perf-YVT2WXT4.js} +2 -2
  106. package/dist-cli/chunks/{permissions-OXAWZHB2.js → permissions-L7VVDHFP.js} +2 -2
  107. package/dist-cli/chunks/{platform-SKTAMMLT.js → platform-7TJOU2FB.js} +3 -3
  108. package/dist-cli/chunks/privacy-57UOTB5J.js +4 -0
  109. package/dist-cli/chunks/{record-WFA3GUIX.js → record-VXG37P7U.js} +3 -3
  110. package/dist-cli/chunks/{report-issue-LB7QRUIO.js → report-issue-WNNOBZHC.js} +2 -2
  111. package/dist-cli/chunks/reset-H5NBFE5U.js +4 -0
  112. package/dist-cli/chunks/resolve-target-57TK5WLE.js +4 -0
  113. package/dist-cli/chunks/runtime-QU2NIF2K.js +4 -0
  114. package/dist-cli/chunks/{screenshot-command-OX4B5ZPE.js → screenshot-command-AN56TTG7.js} +3 -3
  115. package/dist-cli/chunks/{screenshot-layers-QOSO5ZRE.js → screenshot-layers-3W5R7DB2.js} +2 -2
  116. package/dist-cli/chunks/{screenshots-capture-XSRQO5SQ.js → screenshots-capture-6AWJY7XZ.js} +2 -2
  117. package/dist-cli/chunks/{serve-LNYA35IZ.js → serve-GLYO5Q7J.js} +2 -2
  118. package/dist-cli/chunks/setup-UA2HLD7S.js +4 -0
  119. package/dist-cli/chunks/{sim-client-MBY5YFOJ.js → sim-client-5C2RDQQO.js} +2 -2
  120. package/dist-cli/chunks/{skills-DVTU7NKR.js → skills-EYXWBRNQ.js} +2 -2
  121. package/dist-cli/chunks/{state-4AIXTMAN.js → state-REJ7W6K3.js} +2 -2
  122. package/dist-cli/chunks/{storage-OXHTXIRW.js → storage-CFMDHI3V.js} +2 -2
  123. package/dist-cli/chunks/store-XMCUA45G.js +4 -0
  124. package/dist-cli/chunks/telemetry-FBL3NAKB.js +4 -0
  125. package/dist-cli/chunks/{timeline-HY7NURFG.js → timeline-HMCHN5FO.js} +2 -2
  126. package/dist-cli/chunks/{upgrade-V6222XJR.js → upgrade-2QSPAA3P.js} +2 -2
  127. package/dist-cli/chunks/upload-DUQBKZYV.js +4 -0
  128. package/dist-cli/chunks/{version-32O3RRDO.js → version-IOA6QFGB.js} +2 -2
  129. package/dist-cli/chunks/{web-DA6HESOZ.js → web-NCGUYVCJ.js} +2 -2
  130. package/dist-cli/chunks/welcome-QYGSQCWQ.js +5 -0
  131. package/dist-cli/chunks/{what-happened-UEY6YRTH.js → what-happened-YTOUK4LO.js} +2 -2
  132. package/dist-cli/chunks/{ws-bridge-4WWOVU5V.js → ws-bridge-OF4OZARG.js} +2 -2
  133. package/dist-lib/agent-daemon-client.cjs +1 -1
  134. package/dist-lib/agent-events.cjs +1 -1
  135. package/dist-lib/agent-identity.cjs +1 -1
  136. package/dist-lib/agent-sessions.cjs +1 -1
  137. package/dist-lib/attached-projects.cjs +1 -1
  138. package/dist-lib/auth/shared-session.cjs +1 -1
  139. package/dist-lib/backend-origin.cjs +1 -1
  140. package/dist-lib/beta.cjs +1 -1
  141. package/dist-lib/beta.mjs +1 -1
  142. package/dist-lib/bridge-constants.cjs +1 -1
  143. package/dist-lib/bridge-contract-input.cjs +1 -1
  144. package/dist-lib/bridge-contract-input.mjs +1 -1
  145. package/dist-lib/bridge-contract.cjs +1 -1
  146. package/dist-lib/bridge-contract.mjs +1 -1
  147. package/dist-lib/cli-constants.cjs +1 -1
  148. package/dist-lib/config.cjs +1 -1
  149. package/dist-lib/detox/index.cjs +1 -1
  150. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  151. package/dist-lib/home-paths.cjs +1 -1
  152. package/dist-lib/host/bridge-host.cjs +148 -134
  153. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  154. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  155. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  156. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  157. package/dist-lib/host/websocket-proxy.cjs +1 -1
  158. package/dist-lib/index.cjs +3 -3
  159. package/dist-lib/jump-to-source-babel.cjs +1 -1
  160. package/dist-lib/menu.cjs +1 -1
  161. package/dist-lib/menu.mjs +1 -1
  162. package/dist-lib/metro-production-bundle.cjs +1 -1
  163. package/dist-lib/metro-production-bundle.mjs +1 -1
  164. package/dist-lib/metro.cjs +1 -1
  165. package/dist-lib/profiles.cjs +1 -1
  166. package/dist-lib/public-brand.cjs +1 -1
  167. package/dist-lib/react-native-host-modules.cjs +1 -1
  168. package/dist-lib/react-native-host-modules.mjs +1 -1
  169. package/dist-lib/render-mode.cjs +1 -1
  170. package/dist-lib/scripts/dev-server-scanner.cjs +18 -4
  171. package/dist-lib/sdk.cjs +1 -1
  172. package/dist-lib/sdk.mjs +1 -1
  173. package/dist-lib/skills.cjs +219 -198
  174. package/dist-lib/vite.cjs +1 -1
  175. package/package.json +1 -1
  176. package/scripts/dev-server-scanner.ts +23 -5
  177. package/dist-cli/chunks/chunk-DB2JB52S.js +0 -4
  178. package/dist-cli/chunks/chunk-L6VQSQ5O.js +0 -7
  179. package/dist-cli/chunks/chunk-OO7E4JTZ.js +0 -27
  180. package/dist-cli/chunks/cli-version-OZYTASIM.js +0 -4
  181. package/dist-cli/chunks/control-LBL5A6WE.js +0 -4
  182. package/dist-cli/chunks/daemon-JCFSBU66.js +0 -4
  183. package/dist-cli/chunks/drivers-IQ5GCHPH.js +0 -4
  184. package/dist-cli/chunks/flow-74OQVMSN.js +0 -4
  185. package/dist-cli/chunks/help-OCNTRGIJ.js +0 -4
  186. package/dist-cli/chunks/inspect-Z2NKYQEG.js +0 -4
  187. package/dist-cli/chunks/install-desktop-47P2MA4T.js +0 -4
  188. package/dist-cli/chunks/privacy-XEXZ6AIX.js +0 -4
  189. package/dist-cli/chunks/reset-CYS4XX4I.js +0 -4
  190. package/dist-cli/chunks/resolve-target-YYCTSFNM.js +0 -4
  191. package/dist-cli/chunks/runtime-JFQ6JIA6.js +0 -4
  192. package/dist-cli/chunks/setup-3W2UEM2H.js +0 -4
  193. package/dist-cli/chunks/store-43NVGPZX.js +0 -4
  194. package/dist-cli/chunks/telemetry-ZQRYJXGE.js +0 -4
  195. package/dist-cli/chunks/upload-DUKPPETT.js +0 -4
  196. package/dist-cli/chunks/welcome-X7PCNKS6.js +0 -5
@@ -1,7 +1,7 @@
1
- /*! rnx v0.1.374 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.376 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  import { createRequire as __sootsimCreateRequire } from 'node:module'
3
3
  var require = __sootsimCreateRequire(import.meta.url)
4
- import{a as N}from"./chunk-5WXRC4BW.js";import{o as R}from"./chunk-GQVWJWCZ.js";import{a as I}from"./chunk-5VFQ7HKK.js";import{a as T}from"./chunk-RU565DEH.js";function G(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.type=="string"&&typeof t.ts=="number"}function O(e){let t=e.trim();if(!t)return null;try{let r=JSON.parse(t);return G(r)?r:null}catch{return null}}import{randomBytes as q,createHash as X}from"node:crypto";import f from"node:fs";import h from"node:path";var $=null;function B(){if($)return $;let e=process.env.SOOTSIM_USER_DATA_DIR;return e||R()}function y(){return B()}function U(){return h.join(B(),"attached-projects.json")}function _(){return{version:1,attachedProjects:[],previewAttachments:[],agentSessions:[]}}function S(){let e=U(),t;try{t=f.readFileSync(e,"utf8")}catch(r){if(r.code==="ENOENT")return _();throw r}try{let r=JSON.parse(t);if(!r||typeof r!="object")throw new Error("not an object");return{version:1,attachedProjects:Array.isArray(r.attachedProjects)?r.attachedProjects:[],previewAttachments:Array.isArray(r.previewAttachments)?r.previewAttachments:[],agentSessions:Array.isArray(r.agentSessions)?r.agentSessions:[]}}catch(r){let n=`${e}.corrupt-${Date.now()}`;try{f.renameSync(e,n),console.warn(`[sootsim] attached-projects.json was unparseable; quarantined to ${n}. original error: ${r.message}`)}catch{}return _()}}function K(e){let t=U();f.mkdirSync(h.dirname(t),{recursive:!0});let r=`${t}.tmp-${process.pid}-${Date.now()}`,n=f.openSync(r,"w",384);try{f.writeFileSync(n,JSON.stringify(e,null,2)),f.fsyncSync(n)}finally{f.closeSync(n)}f.renameSync(r,t)}function w(e){let t=S();return e(t),K(t),t}function F(e){return X("sha256").update(h.resolve(e)).digest("hex").slice(0,16)}function Q(){return`s_${q(10).toString("hex")}`}function Se(e){let t=h.resolve(e.cwd),r=F(t),n;return w(o=>{let s=o.attachedProjects.find(a=>a.id===r);if(s){let a={...s,...e,id:r,cwd:t,sourceRoots:e.sourceRoots??s.sourceRoots,knownBundleUrls:e.knownBundleUrls??s.knownBundleUrls,pinnedSourceResolutions:e.pinnedSourceResolutions??s.pinnedSourceResolutions,telemetry:e.telemetry??s.telemetry,updatedAt:Date.now(),createdAt:s.createdAt},g=o.attachedProjects.indexOf(s);o.attachedProjects[g]=a,n=a;return}let c=Date.now(),d={id:r,name:e.name??h.basename(t),cwd:t,repoRoot:e.repoRoot,sourceRoots:e.sourceRoots??[t],framework:e.framework??"unknown",bundleId:e.bundleId,knownBundleUrls:e.knownBundleUrls??[],preferredProvider:e.preferredProvider??"codex",preferredTransport:e.preferredTransport??"tmux",editorOpenCommand:e.editorOpenCommand,moshiWebhookToken:e.moshiWebhookToken,pinnedSourceResolutions:e.pinnedSourceResolutions??{},isolateDiscovery:e.isolateDiscovery,git:e.git,telemetry:e.telemetry??{lastOpened:0,runsCompleted:0},createdAt:c,updatedAt:c};o.attachedProjects.push(d),n=d}),n}function M(e){return S().attachedProjects.find(t=>t.id===e)??null}function we(){return S().attachedProjects}var V=336*60*60*1e3;function ve(e,t={}){w(r=>{let n=r.attachedProjects.find(s=>s.id===e);if(!n)return;let o=t.ts??Date.now();if(n.telemetry.runsCompleted=(n.telemetry.runsCompleted??0)+1,typeof t.usd=="number"&&Number.isFinite(t.usd)&&t.usd>=0){let s=n.telemetry.costHistory??[],c=o-V,d=s.filter(a=>a.ts>=c);d.push({ts:o,usd:t.usd}),n.telemetry.costHistory=d}n.updatedAt=o})}function Ae(e,t=Date.now()){let r=t-6048e5,n=e.telemetry.costHistory??[],o=0;for(let s of n)s.ts>=r&&(o+=s.usd);return o}function xe(e){w(t=>{t.attachedProjects=t.attachedProjects.filter(r=>r.id!==e),t.agentSessions=t.agentSessions.filter(r=>r.projectId!==e),t.previewAttachments=t.previewAttachments.filter(r=>r.projectId!==e)})}function C(e){let t;return w(r=>{if(e.id){let c=r.agentSessions.find(d=>d.id===e.id);if(c){let d={...c,...e,lastSeenAt:Date.now()},a=r.agentSessions.indexOf(c);r.agentSessions[a]=d,t=d;return}}let n=r.attachedProjects.find(c=>c.id===e.projectId);if(!n)throw new Error(`upsertSession: no AttachedProject with id=${e.projectId}`);let o=Date.now(),s={id:e.id??Q(),projectId:e.projectId,provider:e.provider,transport:e.transport??n.preferredTransport,cwd:e.cwd??n.cwd,claudeSessionUuid:e.claudeSessionUuid,tmuxSessionName:e.tmuxSessionName,wrapperPid:e.wrapperPid,status:e.status??"idle",needsAttention:e.needsAttention??!1,lastPrompt:e.lastPrompt,lastSummary:e.lastSummary,lastTurnFiles:e.lastTurnFiles,currentlyEditing:e.currentlyEditing,lastSeenAt:o,createdAt:o};r.agentSessions.push(s),t=s}),t}function k(e){return S().agentSessions.find(t=>t.id===e)??null}function L(e){let t=S().agentSessions;return e?t.filter(r=>r.projectId===e):t}function z(e,t,r=Date.now()){return{...e,...t,id:e.id,projectId:e.projectId,createdAt:e.createdAt,lastSeenAt:r}}function Z(e){e.length!==0&&w(t=>{let r=Date.now(),n=new Map(t.agentSessions.map((o,s)=>[o.id,s]));for(let{id:o,patch:s}of e){let c=n.get(o);c!==void 0&&(t.agentSessions[c]=z(t.agentSessions[c],s,r))}})}function v(e,t){Z([{id:e,patch:t}])}async function Pe(){if(S().attachedProjects.length>0)return;let{loadOptionalDemoApps:t}=await import("./optional-demo-registry-RP2H6SQR.js"),r=await t();r.length!==0&&w(n=>{for(let o of r){if(!f.existsSync(o.dir))continue;let s=h.resolve(o.dir),c=F(s);if(n.attachedProjects.some(a=>a.id===c))continue;let d=Date.now();n.attachedProjects.push({id:c,name:o.label,cwd:s,sourceRoots:[s],framework:o.framework,knownBundleUrls:[`http://localhost:${o.preferredPort}/index.bundle`],preferredProvider:"codex",preferredTransport:"tmux",pinnedSourceResolutions:{},telemetry:{lastOpened:0,runsCompleted:0},createdAt:d,updatedAt:d})}})}import{spawn as ee,spawnSync as te}from"node:child_process";import{randomUUID as re}from"node:crypto";import i,{constants as m}from"node:fs";import u from"node:path";import ne from"node:readline";function b(e){return u.join(y(),"sessions",e)}function J(e){return u.join(b(e),"prompt.in")}function H(e){return u.join(b(e),"events.out")}function se(e){return u.join(y(),"transcripts",`${e}.log`)}function E(e,t){if(!e)return!1;try{process.kill(e,0)}catch{return!1}return!(t&&!i.existsSync(b(t)))}function oe(){if(process.env.SOOTSIM_BIN)return{cmd:process.env.SOOTSIM_BIN,prefixArgs:[]};if(process.versions.electron){let n=process.resourcesPath;if(n){let o=[u.join(n,"bin","sootsim"),u.join(n,"bin",`sootsim-${process.platform}-${process.arch}`)];for(let s of o)if(i.existsSync(s))return{cmd:s,prefixArgs:[]}}}let e=ie();if(e)return e;let t=process.argv[0],r=process.argv[1];if(r&&/\.(ts|tsx|mjs|cjs|js)$/.test(r))return{cmd:t,prefixArgs:[r]};if(!r||r.includes("/.bin/"))throw new Error("rnx CLI not found. set SOOTSIM_BIN to the path of the rnx binary, or build the workspace CLI via `bun run --cwd packages/sootsim build:cli`.");return{cmd:t,prefixArgs:[]}}function ie(){try{let e=ce();if(!e)return null;let t=`sootsim-${process.platform}-${process.arch}`,r=u.join(e,"dist-bin",t);if(i.existsSync(r))return{cmd:r,prefixArgs:[]};let n=u.join(e,"dist-cli","bin.js");if(i.existsSync(n)){try{let o=u.join(e,"cli","commands","agent-wrapper.ts");if(i.existsSync(o)){let s=i.statSync(o).mtimeMs;i.statSync(n).mtimeMs<s&&console.warn("[rnx] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with `bun run --cwd packages/sootsim build:cli`.")}}catch{}return{cmd:process.execPath,prefixArgs:[n]}}return null}catch{return null}}function ce(){try{let r=T.resolve(`${I.packageName}/package.json`);return u.dirname(r)}catch{}let e=ae();if(!e)return null;let t=u.dirname(e);for(let r=0;r<8;r++){let n=u.join(t,"package.json");try{if(i.existsSync(n)&&JSON.parse(i.readFileSync(n,"utf8")).name===I.packageName)return t}catch{}let o=u.dirname(t);if(o===t)break;t=o}return null}function ae(){try{let e=import.meta.url;return!e||!e.startsWith("file://")?null:decodeURIComponent(e.slice(7))}catch{return null}}async function de(e,t,r){let n=u.join(y(),"locks");i.mkdirSync(n,{recursive:!0});try{i.chmodSync(n,448)}catch{}let o=u.join(n,`start-${e}-${t}.lock`),s=Date.now()+4e3,c=null;for(;c===null;)try{c=i.openSync(o,m.O_WRONLY|m.O_CREAT|m.O_EXCL,384)}catch(d){if(d.code!=="EEXIST")throw d;try{let a=Number(i.readFileSync(o,"utf8").trim());if(a&&!ue(a)){i.unlinkSync(o);continue}}catch{}if(Date.now()>s)throw new Error(`another start is in progress for project=${e} provider=${t} (lock: ${o})`);await new Promise(a=>setTimeout(a,50))}try{return i.writeFileSync(c,String(process.pid)),await r()}finally{try{i.closeSync(c)}catch{}try{i.unlinkSync(o)}catch{}}}function ue(e){try{return process.kill(e,0),!0}catch{return!1}}function W(e){let t=u.dirname(e);i.mkdirSync(t,{recursive:!0});try{i.chmodSync(t,448)}catch{}if(i.existsSync(e))try{if(i.statSync(e).isFIFO()){try{i.chmodSync(e,384)}catch{}return}i.unlinkSync(e)}catch{i.unlinkSync(e)}let r=te("mkfifo",["-m","600",e]);if(r.status!==0)throw new Error(`mkfifo(${e}) failed: ${r.stderr?.toString().trim()||"unknown error"}`)}var l=class extends Error{code;constructor(t,r){super(r),this.code=t}};async function $e(e){let t=M(e.projectId);if(!t)throw new l("NO_PROJECT",`no project with id=${e.projectId}`);let r=e.provider||t.preferredProvider||"codex";return de(t.id,r,async()=>{let n=L(t.id).find(p=>p.provider===r&&p.status!=="ended"&&E(p.wrapperPid,p.id));if(n)throw new l("ALREADY_RUNNING",`session already running for project=${t.id} provider=${r} (session ${n.id}, pid ${n.wrapperPid}). end it first with \`rnx agent end <sessionId>\`.`);let o=r==="claude"?re():void 0,s=C({projectId:t.id,provider:r,transport:"pty",cwd:t.cwd,status:"idle",claudeSessionUuid:o}),c=J(s.id),d=H(s.id),a=se(s.id);W(c),W(d);let g=u.dirname(a);i.mkdirSync(g,{recursive:!0});try{i.chmodSync(g,448)}catch{}let{cmd:A,prefixArgs:Y}=oe(),x=[...Y,"agent-wrapper","--session-id",s.id,"--project-id",t.id,"--provider",r,"--cwd",t.cwd,"--prompt-in",c,"--events-out",d,"--transcript",a];e.codexBin&&x.push("--codex-bin",e.codexBin),e.claudeBin&&x.push("--claude-bin",e.claudeBin),e.freshThread&&x.push("--fresh-thread"),o&&x.push("--claude-session-uuid",o);let P=ee(A,x,{detached:!0,stdio:"ignore",env:{...process.env,SOOTSIM_USER_DATA_DIR:y()}});P.unref();let D=e.readyTimeoutMs??6e3,j=await le(d,p=>p.type==="ready"||p.type==="error",D);if(!j||j.type==="error"){if(P.pid)try{process.kill(P.pid,"SIGTERM")}catch{}try{i.rmSync(b(s.id),{recursive:!0,force:!0})}catch{}v(s.id,{status:"ended"});let p=j&&j.type==="error"?j.message:`no ready event within ${D}ms`;throw new l("WRAPPER_FAILED",p)}return v(s.id,{wrapperPid:P.pid,status:"idle"}),{session:k(s.id),wrapperPid:P.pid}})}async function _e(e,t){let r=k(e);if(!r)throw new l("NO_SESSION",`no session with id=${e}`);if(!E(r.wrapperPid,e))throw v(e,{status:"ended"}),new l("NOT_ALIVE",`session wrapper is not alive (pid=${r.wrapperPid}). start a new session.`);let n=J(e);if(!i.existsSync(n))throw new l("NO_FIFO",`prompt FIFO missing: ${n}`);let o=i.openSync(n,m.O_WRONLY);try{let s=N(t);if(!s)throw new l("EMPTY_PROMPT","prompt text is empty");i.writeSync(o,s+`
4
+ import{a as N}from"./chunk-XCDNVNP3.js";import{o as R}from"./chunk-QRDF33WD.js";import{a as I}from"./chunk-5YZYDEMI.js";import{a as T}from"./chunk-ZSSG7OR7.js";function G(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.type=="string"&&typeof t.ts=="number"}function O(e){let t=e.trim();if(!t)return null;try{let r=JSON.parse(t);return G(r)?r:null}catch{return null}}import{randomBytes as q,createHash as X}from"node:crypto";import f from"node:fs";import h from"node:path";var $=null;function B(){if($)return $;let e=process.env.SOOTSIM_USER_DATA_DIR;return e||R()}function y(){return B()}function U(){return h.join(B(),"attached-projects.json")}function _(){return{version:1,attachedProjects:[],previewAttachments:[],agentSessions:[]}}function S(){let e=U(),t;try{t=f.readFileSync(e,"utf8")}catch(r){if(r.code==="ENOENT")return _();throw r}try{let r=JSON.parse(t);if(!r||typeof r!="object")throw new Error("not an object");return{version:1,attachedProjects:Array.isArray(r.attachedProjects)?r.attachedProjects:[],previewAttachments:Array.isArray(r.previewAttachments)?r.previewAttachments:[],agentSessions:Array.isArray(r.agentSessions)?r.agentSessions:[]}}catch(r){let n=`${e}.corrupt-${Date.now()}`;try{f.renameSync(e,n),console.warn(`[sootsim] attached-projects.json was unparseable; quarantined to ${n}. original error: ${r.message}`)}catch{}return _()}}function K(e){let t=U();f.mkdirSync(h.dirname(t),{recursive:!0});let r=`${t}.tmp-${process.pid}-${Date.now()}`,n=f.openSync(r,"w",384);try{f.writeFileSync(n,JSON.stringify(e,null,2)),f.fsyncSync(n)}finally{f.closeSync(n)}f.renameSync(r,t)}function w(e){let t=S();return e(t),K(t),t}function F(e){return X("sha256").update(h.resolve(e)).digest("hex").slice(0,16)}function Q(){return`s_${q(10).toString("hex")}`}function Se(e){let t=h.resolve(e.cwd),r=F(t),n;return w(o=>{let s=o.attachedProjects.find(a=>a.id===r);if(s){let a={...s,...e,id:r,cwd:t,sourceRoots:e.sourceRoots??s.sourceRoots,knownBundleUrls:e.knownBundleUrls??s.knownBundleUrls,pinnedSourceResolutions:e.pinnedSourceResolutions??s.pinnedSourceResolutions,telemetry:e.telemetry??s.telemetry,updatedAt:Date.now(),createdAt:s.createdAt},g=o.attachedProjects.indexOf(s);o.attachedProjects[g]=a,n=a;return}let c=Date.now(),d={id:r,name:e.name??h.basename(t),cwd:t,repoRoot:e.repoRoot,sourceRoots:e.sourceRoots??[t],framework:e.framework??"unknown",bundleId:e.bundleId,knownBundleUrls:e.knownBundleUrls??[],preferredProvider:e.preferredProvider??"codex",preferredTransport:e.preferredTransport??"tmux",editorOpenCommand:e.editorOpenCommand,moshiWebhookToken:e.moshiWebhookToken,pinnedSourceResolutions:e.pinnedSourceResolutions??{},isolateDiscovery:e.isolateDiscovery,git:e.git,telemetry:e.telemetry??{lastOpened:0,runsCompleted:0},createdAt:c,updatedAt:c};o.attachedProjects.push(d),n=d}),n}function M(e){return S().attachedProjects.find(t=>t.id===e)??null}function we(){return S().attachedProjects}var V=336*60*60*1e3;function ve(e,t={}){w(r=>{let n=r.attachedProjects.find(s=>s.id===e);if(!n)return;let o=t.ts??Date.now();if(n.telemetry.runsCompleted=(n.telemetry.runsCompleted??0)+1,typeof t.usd=="number"&&Number.isFinite(t.usd)&&t.usd>=0){let s=n.telemetry.costHistory??[],c=o-V,d=s.filter(a=>a.ts>=c);d.push({ts:o,usd:t.usd}),n.telemetry.costHistory=d}n.updatedAt=o})}function Ae(e,t=Date.now()){let r=t-6048e5,n=e.telemetry.costHistory??[],o=0;for(let s of n)s.ts>=r&&(o+=s.usd);return o}function xe(e){w(t=>{t.attachedProjects=t.attachedProjects.filter(r=>r.id!==e),t.agentSessions=t.agentSessions.filter(r=>r.projectId!==e),t.previewAttachments=t.previewAttachments.filter(r=>r.projectId!==e)})}function C(e){let t;return w(r=>{if(e.id){let c=r.agentSessions.find(d=>d.id===e.id);if(c){let d={...c,...e,lastSeenAt:Date.now()},a=r.agentSessions.indexOf(c);r.agentSessions[a]=d,t=d;return}}let n=r.attachedProjects.find(c=>c.id===e.projectId);if(!n)throw new Error(`upsertSession: no AttachedProject with id=${e.projectId}`);let o=Date.now(),s={id:e.id??Q(),projectId:e.projectId,provider:e.provider,transport:e.transport??n.preferredTransport,cwd:e.cwd??n.cwd,claudeSessionUuid:e.claudeSessionUuid,tmuxSessionName:e.tmuxSessionName,wrapperPid:e.wrapperPid,status:e.status??"idle",needsAttention:e.needsAttention??!1,lastPrompt:e.lastPrompt,lastSummary:e.lastSummary,lastTurnFiles:e.lastTurnFiles,currentlyEditing:e.currentlyEditing,lastSeenAt:o,createdAt:o};r.agentSessions.push(s),t=s}),t}function k(e){return S().agentSessions.find(t=>t.id===e)??null}function L(e){let t=S().agentSessions;return e?t.filter(r=>r.projectId===e):t}function z(e,t,r=Date.now()){return{...e,...t,id:e.id,projectId:e.projectId,createdAt:e.createdAt,lastSeenAt:r}}function Z(e){e.length!==0&&w(t=>{let r=Date.now(),n=new Map(t.agentSessions.map((o,s)=>[o.id,s]));for(let{id:o,patch:s}of e){let c=n.get(o);c!==void 0&&(t.agentSessions[c]=z(t.agentSessions[c],s,r))}})}function v(e,t){Z([{id:e,patch:t}])}async function Pe(){if(S().attachedProjects.length>0)return;let{loadOptionalDemoApps:t}=await import("./optional-demo-registry-ZUTPSVYQ.js"),r=await t();r.length!==0&&w(n=>{for(let o of r){if(!f.existsSync(o.dir))continue;let s=h.resolve(o.dir),c=F(s);if(n.attachedProjects.some(a=>a.id===c))continue;let d=Date.now();n.attachedProjects.push({id:c,name:o.label,cwd:s,sourceRoots:[s],framework:o.framework,knownBundleUrls:[`http://localhost:${o.preferredPort}/index.bundle`],preferredProvider:"codex",preferredTransport:"tmux",pinnedSourceResolutions:{},telemetry:{lastOpened:0,runsCompleted:0},createdAt:d,updatedAt:d})}})}import{spawn as ee,spawnSync as te}from"node:child_process";import{randomUUID as re}from"node:crypto";import i,{constants as m}from"node:fs";import u from"node:path";import ne from"node:readline";function b(e){return u.join(y(),"sessions",e)}function J(e){return u.join(b(e),"prompt.in")}function H(e){return u.join(b(e),"events.out")}function se(e){return u.join(y(),"transcripts",`${e}.log`)}function E(e,t){if(!e)return!1;try{process.kill(e,0)}catch{return!1}return!(t&&!i.existsSync(b(t)))}function oe(){if(process.env.SOOTSIM_BIN)return{cmd:process.env.SOOTSIM_BIN,prefixArgs:[]};if(process.versions.electron){let n=process.resourcesPath;if(n){let o=[u.join(n,"bin","sootsim"),u.join(n,"bin",`sootsim-${process.platform}-${process.arch}`)];for(let s of o)if(i.existsSync(s))return{cmd:s,prefixArgs:[]}}}let e=ie();if(e)return e;let t=process.argv[0],r=process.argv[1];if(r&&/\.(ts|tsx|mjs|cjs|js)$/.test(r))return{cmd:t,prefixArgs:[r]};if(!r||r.includes("/.bin/"))throw new Error("rnx CLI not found. set SOOTSIM_BIN to the path of the rnx binary, or build the workspace CLI via `bun run --cwd packages/sootsim build:cli`.");return{cmd:t,prefixArgs:[]}}function ie(){try{let e=ce();if(!e)return null;let t=`sootsim-${process.platform}-${process.arch}`,r=u.join(e,"dist-bin",t);if(i.existsSync(r))return{cmd:r,prefixArgs:[]};let n=u.join(e,"dist-cli","bin.js");if(i.existsSync(n)){try{let o=u.join(e,"cli","commands","agent-wrapper.ts");if(i.existsSync(o)){let s=i.statSync(o).mtimeMs;i.statSync(n).mtimeMs<s&&console.warn("[rnx] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with `bun run --cwd packages/sootsim build:cli`.")}}catch{}return{cmd:process.execPath,prefixArgs:[n]}}return null}catch{return null}}function ce(){try{let r=T.resolve(`${I.packageName}/package.json`);return u.dirname(r)}catch{}let e=ae();if(!e)return null;let t=u.dirname(e);for(let r=0;r<8;r++){let n=u.join(t,"package.json");try{if(i.existsSync(n)&&JSON.parse(i.readFileSync(n,"utf8")).name===I.packageName)return t}catch{}let o=u.dirname(t);if(o===t)break;t=o}return null}function ae(){try{let e=import.meta.url;return!e||!e.startsWith("file://")?null:decodeURIComponent(e.slice(7))}catch{return null}}async function de(e,t,r){let n=u.join(y(),"locks");i.mkdirSync(n,{recursive:!0});try{i.chmodSync(n,448)}catch{}let o=u.join(n,`start-${e}-${t}.lock`),s=Date.now()+4e3,c=null;for(;c===null;)try{c=i.openSync(o,m.O_WRONLY|m.O_CREAT|m.O_EXCL,384)}catch(d){if(d.code!=="EEXIST")throw d;try{let a=Number(i.readFileSync(o,"utf8").trim());if(a&&!ue(a)){i.unlinkSync(o);continue}}catch{}if(Date.now()>s)throw new Error(`another start is in progress for project=${e} provider=${t} (lock: ${o})`);await new Promise(a=>setTimeout(a,50))}try{return i.writeFileSync(c,String(process.pid)),await r()}finally{try{i.closeSync(c)}catch{}try{i.unlinkSync(o)}catch{}}}function ue(e){try{return process.kill(e,0),!0}catch{return!1}}function W(e){let t=u.dirname(e);i.mkdirSync(t,{recursive:!0});try{i.chmodSync(t,448)}catch{}if(i.existsSync(e))try{if(i.statSync(e).isFIFO()){try{i.chmodSync(e,384)}catch{}return}i.unlinkSync(e)}catch{i.unlinkSync(e)}let r=te("mkfifo",["-m","600",e]);if(r.status!==0)throw new Error(`mkfifo(${e}) failed: ${r.stderr?.toString().trim()||"unknown error"}`)}var l=class extends Error{code;constructor(t,r){super(r),this.code=t}};async function $e(e){let t=M(e.projectId);if(!t)throw new l("NO_PROJECT",`no project with id=${e.projectId}`);let r=e.provider||t.preferredProvider||"codex";return de(t.id,r,async()=>{let n=L(t.id).find(p=>p.provider===r&&p.status!=="ended"&&E(p.wrapperPid,p.id));if(n)throw new l("ALREADY_RUNNING",`session already running for project=${t.id} provider=${r} (session ${n.id}, pid ${n.wrapperPid}). end it first with \`rnx agent end <sessionId>\`.`);let o=r==="claude"?re():void 0,s=C({projectId:t.id,provider:r,transport:"pty",cwd:t.cwd,status:"idle",claudeSessionUuid:o}),c=J(s.id),d=H(s.id),a=se(s.id);W(c),W(d);let g=u.dirname(a);i.mkdirSync(g,{recursive:!0});try{i.chmodSync(g,448)}catch{}let{cmd:A,prefixArgs:Y}=oe(),x=[...Y,"agent-wrapper","--session-id",s.id,"--project-id",t.id,"--provider",r,"--cwd",t.cwd,"--prompt-in",c,"--events-out",d,"--transcript",a];e.codexBin&&x.push("--codex-bin",e.codexBin),e.claudeBin&&x.push("--claude-bin",e.claudeBin),e.freshThread&&x.push("--fresh-thread"),o&&x.push("--claude-session-uuid",o);let P=ee(A,x,{detached:!0,stdio:"ignore",env:{...process.env,SOOTSIM_USER_DATA_DIR:y()}});P.unref();let D=e.readyTimeoutMs??6e3,j=await le(d,p=>p.type==="ready"||p.type==="error",D);if(!j||j.type==="error"){if(P.pid)try{process.kill(P.pid,"SIGTERM")}catch{}try{i.rmSync(b(s.id),{recursive:!0,force:!0})}catch{}v(s.id,{status:"ended"});let p=j&&j.type==="error"?j.message:`no ready event within ${D}ms`;throw new l("WRAPPER_FAILED",p)}return v(s.id,{wrapperPid:P.pid,status:"idle"}),{session:k(s.id),wrapperPid:P.pid}})}async function _e(e,t){let r=k(e);if(!r)throw new l("NO_SESSION",`no session with id=${e}`);if(!E(r.wrapperPid,e))throw v(e,{status:"ended"}),new l("NOT_ALIVE",`session wrapper is not alive (pid=${r.wrapperPid}). start a new session.`);let n=J(e);if(!i.existsSync(n))throw new l("NO_FIFO",`prompt FIFO missing: ${n}`);let o=i.openSync(n,m.O_WRONLY);try{let s=N(t);if(!s)throw new l("EMPTY_PROMPT","prompt text is empty");i.writeSync(o,s+`
5
5
  `)}finally{i.closeSync(o)}v(e,{lastPrompt:t.displayText??t.text,status:"working"})}async function Be(e){let t=k(e);if(!t)throw new l("NO_SESSION",`no session with id=${e}`);if(E(t.wrapperPid,e))try{process.kill(t.wrapperPid,"SIGTERM")}catch{}let r=b(e),n=y();if(r.startsWith(n))try{i.rmSync(r,{recursive:!0,force:!0})}catch{}v(e,{status:"ended",wrapperPid:void 0})}function Ue(e,t){let r=H(e);if(!i.existsSync(r))throw new l("NO_FIFO",`events FIFO missing: ${r}`);let n=i.openSync(r,m.O_RDWR),o=i.createReadStream("",{fd:n,autoClose:!0}),s=ne.createInterface({input:o,crlfDelay:1/0});s.on("line",d=>{let a=O(d);a&&t(a)});let c=!1;return()=>{if(!c){c=!0;try{i.writeSync(n,`
6
6
  `)}catch{}try{s.close()}catch{}try{o.destroy()}catch{}}}}async function le(e,t,r){let n=i.openSync(e,m.O_RDWR|m.O_NONBLOCK),o=Buffer.alloc(8192),s="",c=Date.now()+r;try{for(;Date.now()<c;){let d=0;try{d=i.readSync(n,o,0,o.length,null)}catch(a){if(a.code!=="EAGAIN")throw a;d=0}if(d>0){s+=o.subarray(0,d).toString("utf8");let a;for(;(a=s.indexOf(`
7
7
  `))>=0;){let g=s.slice(0,a);s=s.slice(a+1);let A=O(g);if(A&&t(A))return A}}else await new Promise(a=>setTimeout(a,30))}return null}finally{i.closeSync(n)}}export{O as a,y as b,Se as c,M as d,we as e,ve as f,Ae as g,xe as h,k as i,L as j,z as k,Z as l,Pe as m,b as n,J as o,H as p,se as q,E as r,oe as s,l as t,$e as u,_e as v,Be as w,Ue as x};