rnxsim 0.1.325 → 0.1.326

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 (156) hide show
  1. package/dist-cli/bin.js +5 -5
  2. package/dist-cli/chunks/{agent-TMH2DZBX.js → agent-4PHRP37B.js} +2 -2
  3. package/dist-cli/chunks/{agent-wrapper-DHYD7JSR.js → agent-wrapper-S2D2GUAD.js} +2 -2
  4. package/dist-cli/chunks/{app-fonts-CYGPWHT3.js → app-fonts-7GEKSEHF.js} +2 -2
  5. package/dist-cli/chunks/{assert-6WJOAM2E.js → assert-U3PY7PUH.js} +2 -2
  6. package/dist-cli/chunks/{auth-GSI4U3WK.js → auth-34T4HCAG.js} +2 -2
  7. package/dist-cli/chunks/{beta-GD25ZQDA.js → beta-HAYOTIMH.js} +2 -2
  8. package/dist-cli/chunks/{camera-3R6OYJBF.js → camera-P4J5WZF2.js} +2 -2
  9. package/dist-cli/chunks/{chunk-WSZCWDGI.js → chunk-26ABOBGD.js} +2 -2
  10. package/dist-cli/chunks/{chunk-CFA6T55G.js → chunk-2CBLNDTC.js} +2 -2
  11. package/dist-cli/chunks/{chunk-PJZBU4FH.js → chunk-3FRQPMOS.js} +1 -1
  12. package/dist-cli/chunks/{chunk-VDETSGNK.js → chunk-4BKTDQK2.js} +1 -1
  13. package/dist-cli/chunks/{chunk-62HOA5OO.js → chunk-4HC5OKQB.js} +2 -2
  14. package/dist-cli/chunks/{chunk-YW2U74CS.js → chunk-4SQ43X2X.js} +2 -2
  15. package/dist-cli/chunks/{chunk-AY5HFWKG.js → chunk-55RDFBKY.js} +2 -2
  16. package/dist-cli/chunks/{chunk-QZ2B2HCO.js → chunk-5H7A6RIE.js} +2 -2
  17. package/dist-cli/chunks/{chunk-JDXDW5W3.js → chunk-5JYXSOC4.js} +2 -2
  18. package/dist-cli/chunks/{chunk-EXN3NOQ2.js → chunk-5PB3R26W.js} +2 -2
  19. package/dist-cli/chunks/{chunk-G353DB2V.js → chunk-5TXD2X4Q.js} +2 -2
  20. package/dist-cli/chunks/{chunk-BQFR4C2K.js → chunk-6A7CP45G.js} +1 -1
  21. package/dist-cli/chunks/{chunk-OAHRCC62.js → chunk-6BVTXDS6.js} +2 -2
  22. package/dist-cli/chunks/{chunk-6P2B72OT.js → chunk-6G3ERFFR.js} +2 -2
  23. package/dist-cli/chunks/{chunk-2GAGQ2UB.js → chunk-6G3WPBNC.js} +2 -2
  24. package/dist-cli/chunks/{chunk-HJWTSTX7.js → chunk-6IFFKH6R.js} +2 -2
  25. package/dist-cli/chunks/{chunk-GTLBG4PE.js → chunk-7CFLG626.js} +1 -1
  26. package/dist-cli/chunks/{chunk-EQFEZCSN.js → chunk-7UED5PQT.js} +1 -1
  27. package/dist-cli/chunks/{chunk-EFPZOYXX.js → chunk-7W67HLLB.js} +1 -1
  28. package/dist-cli/chunks/{chunk-ZT5WOBEO.js → chunk-7ZZKDNJE.js} +1 -1
  29. package/dist-cli/chunks/{chunk-XWKE62LW.js → chunk-B2R6KT4G.js} +3 -3
  30. package/dist-cli/chunks/{chunk-QNANZJSL.js → chunk-BIH6VWG6.js} +2 -2
  31. package/dist-cli/chunks/{chunk-TEKS6P6F.js → chunk-BLDGZPCR.js} +2 -2
  32. package/dist-cli/chunks/{chunk-ZB3D3GX5.js → chunk-DNNE42BT.js} +2 -2
  33. package/dist-cli/chunks/{chunk-XPTAFG6W.js → chunk-ETJSXUO6.js} +2 -2
  34. package/dist-cli/chunks/{chunk-YHIZQWMB.js → chunk-EZOUS53Z.js} +1 -1
  35. package/dist-cli/chunks/{chunk-NTQBZSS7.js → chunk-F4S5GXSJ.js} +2 -2
  36. package/dist-cli/chunks/{chunk-TGPTOJUR.js → chunk-FMCF6HMH.js} +2 -2
  37. package/dist-cli/chunks/{chunk-Z54EFCPS.js → chunk-FXBDC2VI.js} +2 -2
  38. package/dist-cli/chunks/{chunk-X3ETCNG2.js → chunk-GWNVC2ZR.js} +3 -3
  39. package/dist-cli/chunks/{chunk-CDI6ELFG.js → chunk-HEMHQ2I7.js} +3 -3
  40. package/dist-cli/chunks/{chunk-IE3SJOCA.js → chunk-HLU27X6P.js} +2 -2
  41. package/dist-cli/chunks/{chunk-EKGUCRKC.js → chunk-HP66ZD4J.js} +1 -1
  42. package/dist-cli/chunks/{chunk-DWBOZDTG.js → chunk-IQ4JOABM.js} +1 -1
  43. package/dist-cli/chunks/{chunk-AY4TMF75.js → chunk-IS6YQO54.js} +1 -1
  44. package/dist-cli/chunks/{chunk-YONV2MPP.js → chunk-KFMB6OK5.js} +1 -1
  45. package/dist-cli/chunks/{chunk-6NCGK2VK.js → chunk-MLEN5EKF.js} +2 -2
  46. package/dist-cli/chunks/{chunk-TTTQ2MFU.js → chunk-NBMKRR5H.js} +3 -3
  47. package/dist-cli/chunks/{chunk-7J6G6D6A.js → chunk-NEJ7ENO6.js} +1 -1
  48. package/dist-cli/chunks/{chunk-BFZFAQ3S.js → chunk-NLJJF3FJ.js} +2 -2
  49. package/dist-cli/chunks/{chunk-PVOKRP64.js → chunk-PTUIVDF5.js} +2 -2
  50. package/dist-cli/chunks/{chunk-VTNN77RJ.js → chunk-PZP565JV.js} +1 -1
  51. package/dist-cli/chunks/{chunk-JF2UUMQU.js → chunk-QDPGU6WM.js} +2 -2
  52. package/dist-cli/chunks/{chunk-74FWVNWU.js → chunk-RLI4LL3P.js} +1 -1
  53. package/dist-cli/chunks/{chunk-55VWFPJS.js → chunk-SHLS4PE7.js} +1 -1
  54. package/dist-cli/chunks/{chunk-CCLEPZU4.js → chunk-TXLYGRBK.js} +2 -2
  55. package/dist-cli/chunks/{chunk-U3NRZHAJ.js → chunk-UBFB3NYU.js} +1 -1
  56. package/dist-cli/chunks/{chunk-LTA77SGG.js → chunk-UUWKMPOT.js} +1 -1
  57. package/dist-cli/chunks/{chunk-V5U5PFVS.js → chunk-VIHUN53U.js} +1 -1
  58. package/dist-cli/chunks/{chunk-UR3VLO7X.js → chunk-XEBH43TQ.js} +2 -2
  59. package/dist-cli/chunks/{chunk-ZNPU3XYD.js → chunk-XHEV4YF6.js} +2 -2
  60. package/dist-cli/chunks/{chunk-C6XSW62X.js → chunk-XNSYMM6L.js} +1 -1
  61. package/dist-cli/chunks/{chunk-AIA2UH73.js → chunk-YOHS4IXW.js} +2 -2
  62. package/dist-cli/chunks/{cleanup-VN6J2DBT.js → cleanup-Z4MZUI6D.js} +2 -2
  63. package/dist-cli/chunks/cli-version-P5QDMESE.js +4 -0
  64. package/dist-cli/chunks/{compat-PKDVEMFV.js → compat-YUWVFJ6J.js} +2 -2
  65. package/dist-cli/chunks/{config-RU4PTKP4.js → config-ETYR6G73.js} +2 -2
  66. package/dist-cli/chunks/{control-FOLQZQNJ.js → control-JIPFSSMB.js} +2 -2
  67. package/dist-cli/chunks/daemon-2EYOLY4M.js +4 -0
  68. package/dist-cli/chunks/{debug-JKRFAQJL.js → debug-JKACTYNR.js} +3 -3
  69. package/dist-cli/chunks/{desktop-GRLFNNNX.js → desktop-AZWRWD55.js} +3 -3
  70. package/dist-cli/chunks/{detox-K7PAT6Z7.js → detox-2F2VAIWD.js} +2 -2
  71. package/dist-cli/chunks/{device-REFNH3YU.js → device-WFBNXNJ2.js} +2 -2
  72. package/dist-cli/chunks/{diagnose-W7MJBJXJ.js → diagnose-IG4MHJNE.js} +2 -2
  73. package/dist-cli/chunks/{disk-cleanup-YJM5XTBW.js → disk-cleanup-X7BYYPRT.js} +2 -2
  74. package/dist-cli/chunks/drivers-NG3D33LX.js +4 -0
  75. package/dist-cli/chunks/{film-JMWIBKDE.js → film-SDWNWFCG.js} +3 -3
  76. package/dist-cli/chunks/flow-DA6KUSPA.js +4 -0
  77. package/dist-cli/chunks/help-QV64JYZE.js +4 -0
  78. package/dist-cli/chunks/{hidden-runtime-alias-QSOE7U4T.js → hidden-runtime-alias-VXKARHXI.js} +2 -2
  79. package/dist-cli/chunks/{home-paths-IJVBK6MW.js → home-paths-XE7C2YGD.js} +2 -2
  80. package/dist-cli/chunks/inspect-FI6KZQCK.js +4 -0
  81. package/dist-cli/chunks/install-desktop-WQ6PEGM6.js +4 -0
  82. package/dist-cli/chunks/{login-UU73MMAU.js → login-CZ7FHIRE.js} +4 -4
  83. package/dist-cli/chunks/{logout-B4JDHAM7.js → logout-FUMOFVK2.js} +2 -2
  84. package/dist-cli/chunks/{maestro-4RIQYOGE.js → maestro-IGYNLNEG.js} +3 -3
  85. package/dist-cli/chunks/{maestro-generate-VA6XVKXP.js → maestro-generate-CQ5YANKP.js} +3 -3
  86. package/dist-cli/chunks/{mode-WGM5VV2I.js → mode-VBLOAH5K.js} +2 -2
  87. package/dist-cli/chunks/{optional-demo-registry-NJSBYO7T.js → optional-demo-registry-RZBAVHFK.js} +2 -2
  88. package/dist-cli/chunks/{perf-A5OTMM62.js → perf-3BC76BZX.js} +2 -2
  89. package/dist-cli/chunks/{permissions-U37DAXQQ.js → permissions-I3BJUY2E.js} +2 -2
  90. package/dist-cli/chunks/{record-BW22UPOQ.js → record-ZSQSRQKQ.js} +3 -3
  91. package/dist-cli/chunks/{report-issue-VUQOUGZ5.js → report-issue-N4DCOVZR.js} +2 -2
  92. package/dist-cli/chunks/reset-PXMIBKJW.js +4 -0
  93. package/dist-cli/chunks/runtime-H54EDSQN.js +4 -0
  94. package/dist-cli/chunks/{screenshot-command-MIZ5CVDB.js → screenshot-command-HKAAXG65.js} +3 -3
  95. package/dist-cli/chunks/{screenshot-layers-YYSHFTBV.js → screenshot-layers-NIUVN2PT.js} +2 -2
  96. package/dist-cli/chunks/{screenshots-capture-GK5VKKNL.js → screenshots-capture-LUQI7EWK.js} +2 -2
  97. package/dist-cli/chunks/{serve-WL4E4AOZ.js → serve-Q64J7HX4.js} +2 -2
  98. package/dist-cli/chunks/{setup-H5J5OKJQ.js → setup-WEH2M5DE.js} +2 -2
  99. package/dist-cli/chunks/{skills-LKHQFIIM.js → skills-75HMRCWU.js} +2 -2
  100. package/dist-cli/chunks/{state-7JOTQMBX.js → state-RZ4S4SXN.js} +2 -2
  101. package/dist-cli/chunks/{storage-SWTCPFII.js → storage-PVRB6N6M.js} +2 -2
  102. package/dist-cli/chunks/store-HYWEZDEB.js +4 -0
  103. package/dist-cli/chunks/telemetry-NAMEVMUP.js +4 -0
  104. package/dist-cli/chunks/{timeline-45ULCLET.js → timeline-S43ZPRDO.js} +2 -2
  105. package/dist-cli/chunks/{upgrade-SEI7BMTG.js → upgrade-EXL5PZML.js} +2 -2
  106. package/dist-cli/chunks/upload-CBG3UQOK.js +4 -0
  107. package/dist-cli/chunks/{version-CVOOUJMQ.js → version-2JEYU2WC.js} +2 -2
  108. package/dist-cli/chunks/{web-HRY6ROH6.js → web-TAHHIYWK.js} +2 -2
  109. package/dist-cli/chunks/{what-happened-WBQC73BF.js → what-happened-IZGMVZ4P.js} +2 -2
  110. package/dist-lib/agent-daemon-client.cjs +1 -1
  111. package/dist-lib/agent-events.cjs +1 -1
  112. package/dist-lib/agent-identity.cjs +1 -1
  113. package/dist-lib/agent-sessions.cjs +1 -1
  114. package/dist-lib/attached-projects.cjs +1 -1
  115. package/dist-lib/auth/shared-session.cjs +1 -1
  116. package/dist-lib/backend-origin.cjs +1 -1
  117. package/dist-lib/beta.cjs +1 -1
  118. package/dist-lib/beta.mjs +1 -1
  119. package/dist-lib/bridge-constants.cjs +1 -1
  120. package/dist-lib/bridge-contract.cjs +1 -1
  121. package/dist-lib/cli-constants.cjs +1 -1
  122. package/dist-lib/config.cjs +1 -1
  123. package/dist-lib/detox/index.cjs +1 -1
  124. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  125. package/dist-lib/home-paths.cjs +1 -1
  126. package/dist-lib/host/bridge-host.cjs +1 -1
  127. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  128. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  129. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  130. package/dist-lib/host/websocket-proxy.cjs +1 -1
  131. package/dist-lib/index.cjs +1 -1
  132. package/dist-lib/jump-to-source-babel.cjs +1 -1
  133. package/dist-lib/menu.cjs +1 -1
  134. package/dist-lib/menu.mjs +1 -1
  135. package/dist-lib/metro.cjs +1 -1
  136. package/dist-lib/profiles.cjs +1 -1
  137. package/dist-lib/public-brand.cjs +1 -1
  138. package/dist-lib/render-mode.cjs +1 -1
  139. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  140. package/dist-lib/sdk.cjs +1 -1
  141. package/dist-lib/sdk.mjs +1 -1
  142. package/dist-lib/skills.cjs +1 -1
  143. package/dist-lib/vite.cjs +1 -1
  144. package/package.json +1 -1
  145. package/dist-cli/chunks/cli-version-N7WTU7LJ.js +0 -4
  146. package/dist-cli/chunks/daemon-LITA27EB.js +0 -4
  147. package/dist-cli/chunks/drivers-XR7N4UIU.js +0 -4
  148. package/dist-cli/chunks/flow-FT2L3KC6.js +0 -4
  149. package/dist-cli/chunks/help-SJN5KQ3P.js +0 -4
  150. package/dist-cli/chunks/inspect-6I357HQ6.js +0 -4
  151. package/dist-cli/chunks/install-desktop-O34OQH35.js +0 -4
  152. package/dist-cli/chunks/reset-46YP3GM6.js +0 -4
  153. package/dist-cli/chunks/runtime-HI4CHSTT.js +0 -4
  154. package/dist-cli/chunks/store-PS3ZQVVC.js +0 -4
  155. package/dist-cli/chunks/telemetry-XYYPXZFU.js +0 -4
  156. package/dist-cli/chunks/upload-Q33M4MMJ.js +0 -4
@@ -1,7 +1,7 @@
1
- /*! rnx v0.1.325 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.326 | (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-ZT5WOBEO.js";import{o as R}from"./chunk-VTNN77RJ.js";import{a as I}from"./chunk-7J6G6D6A.js";import{a as T}from"./chunk-U3NRZHAJ.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-NJSBYO7T.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("rnxsim CLI not found. set SOOTSIM_BIN to the path of the rnxsim 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 \`rnxsim 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-7ZZKDNJE.js";import{o as R}from"./chunk-PZP565JV.js";import{a as I}from"./chunk-NEJ7ENO6.js";import{a as T}from"./chunk-UBFB3NYU.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-RZBAVHFK.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("rnxsim CLI not found. set SOOTSIM_BIN to the path of the rnxsim 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 \`rnxsim 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};