very-happy-cli 0.2.179 → 0.2.181

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 (214) hide show
  1. package/dist/{AcpBackend-DFipFF7-.cjs → AcpBackend-CgHb_ya5.cjs} +3 -3
  2. package/dist/{AcpBackend-CHp3y7cb.mjs → AcpBackend-DZGCSuXF.mjs} +3 -3
  3. package/dist/{AcpSessionManager-0zpvRJXc.cjs → AcpSessionManager-CacC2EVn.cjs} +1 -1
  4. package/dist/{AcpSessionManager-d2-rKWWa.mjs → AcpSessionManager-DwuPzWBh.mjs} +1 -1
  5. package/dist/{BasePermissionHandler-CH3zuEkA.cjs → BasePermissionHandler-DCP8ZEB4.cjs} +1 -1
  6. package/dist/{BasePermissionHandler-DdZBYIR4.mjs → BasePermissionHandler-Uo-GUjbb.mjs} +1 -1
  7. package/dist/{acpSessionResume-DTGmAPLt.mjs → acpSessionResume-9OLTD6kT.mjs} +1 -1
  8. package/dist/{acpSessionResume-oiCBnAVA.cjs → acpSessionResume-BaVMD80f.cjs} +1 -1
  9. package/dist/{agentHome-CghLvL_1.mjs → agentHome-B1BsKeqD.mjs} +4 -4
  10. package/dist/{agentHome-BWcz8mz0.cjs → agentHome-BtUmGcPX.cjs} +4 -4
  11. package/dist/{api-Cmjfr8Z7.cjs → api-COHFAkb_.cjs} +20 -12
  12. package/dist/{api-CzwFpJQc.mjs → api-Dr3wXL_7.mjs} +21 -13
  13. package/dist/{apiMachine-DJkTEiqy.mjs → apiMachine-CHEzPQdS.mjs} +73 -32
  14. package/dist/{apiMachine-G6OogT08.cjs → apiMachine-D8H7CXaz.cjs} +75 -34
  15. package/dist/{attachmentContent-B2os4HbA.mjs → attachmentContent-1YwtKgWl.mjs} +2 -2
  16. package/dist/{attachmentContent-Bo0UAsSu.cjs → attachmentContent-mIhbtRKl.cjs} +2 -2
  17. package/dist/{auth-DMX0xPNK.mjs → auth-CbZkcMAb.mjs} +8 -8
  18. package/dist/{auth-D6bBUwZa.cjs → auth-CgQP7d0q.cjs} +5 -5
  19. package/dist/{auth-BS6PaOOG.mjs → auth-DZsthtSk.mjs} +5 -5
  20. package/dist/{auth-HEhRaNgL.cjs → auth-Fg8fLadK.cjs} +8 -8
  21. package/dist/{auto-C6I55iOh.cjs → auto-BB7kqSh5.cjs} +19 -19
  22. package/dist/{auto-Cl1SEDcD.mjs → auto-_T-Ud-z5.mjs} +19 -19
  23. package/dist/{backgroundTaskActivity-BVwJBl02.mjs → backgroundTaskActivity-8PdPxrvy.mjs} +1 -1
  24. package/dist/{bootstrap-iuyufnp3.mjs → bootstrap-B6EkZh4u.mjs} +2 -2
  25. package/dist/{bootstrap-exVucYav.cjs → bootstrap-CYtOtbi7.cjs} +2 -2
  26. package/dist/{browser-CSYum7xH.mjs → browser-C2qhUHSE.mjs} +1 -1
  27. package/dist/{browser-BohJK12g.cjs → browser-DjNNQQk2.cjs} +1 -1
  28. package/dist/{claudeCliPath-U4HHmV4r.cjs → claudeCliPath-GaP3UUz1.cjs} +1 -1
  29. package/dist/{claudeLocal-Dq_R3Ax_.mjs → claudeLocal-BAFjWhZ8.mjs} +6 -6
  30. package/dist/{claudeLocal-re4yjSTx.cjs → claudeLocal-O_w7-fBh.cjs} +8 -8
  31. package/dist/{claudeLocalLauncher-CN67lN7-.mjs → claudeLocalLauncher-CWn30LZR.mjs} +11 -11
  32. package/dist/{claudeLocalLauncher-B4hJHpCA.cjs → claudeLocalLauncher-Df3zg1q0.cjs} +13 -13
  33. package/dist/{claudeSessionFork-BihfD0Ik.mjs → claudeSessionFork-2ZkSTOGn.mjs} +1 -1
  34. package/dist/{claudeSessionFork-DiSMYerV.cjs → claudeSessionFork-pwcKqB-e.cjs} +1 -1
  35. package/dist/{client-BhoEBnuN.mjs → client-BKyU66lg.mjs} +2 -2
  36. package/dist/{client-BKcK1Bi-.cjs → client-CUO3ItoB.cjs} +34 -8
  37. package/dist/{client-wo9nbxuf.mjs → client-CXOnzuOy.mjs} +2 -2
  38. package/dist/{client-ZjOsn6nZ.cjs → client-DWs6k041.cjs} +2 -2
  39. package/dist/{client-CuVdN6PP.cjs → client-D_U2VjO3.cjs} +2 -2
  40. package/dist/{client-DuTDwWSQ.mjs → client-DsQcxVUV.mjs} +34 -9
  41. package/dist/codex/happyMcpStdioBridge.cjs +17 -17
  42. package/dist/codex/happyMcpStdioBridge.mjs +18 -18
  43. package/dist/{codexAppServerClient-Dt5zxrun.cjs → codexAppServerClient-BRX3JZ_5.cjs} +3 -3
  44. package/dist/{codexAppServerClient-BK3zra_1.mjs → codexAppServerClient-C3JO3pwM.mjs} +3 -3
  45. package/dist/{codexCommand-B6pY7CMh.mjs → codexCommand-BZIAAqKS.mjs} +59 -51
  46. package/dist/{codexCommand-CAZ1SLjg.cjs → codexCommand-dKOc5iQl.cjs} +85 -77
  47. package/dist/{codexTermination-DmGbHxcD.cjs → codexTermination-BVR9HeVI.cjs} +7 -2
  48. package/dist/{codexTermination-Cd1Eon_4.mjs → codexTermination-ztFkwHrG.mjs} +7 -2
  49. package/dist/{config-2oMG_fEI.mjs → config-NbHjx8ge.mjs} +3 -3
  50. package/dist/{config-B0uK6K7n.cjs → config-cftYxLC7.cjs} +26 -26
  51. package/dist/{configuration-WMi4idBB.mjs → configuration-BPrfb17M.mjs} +1 -1
  52. package/dist/{configuration-CMHZnp6G.cjs → configuration-C8JgseHy.cjs} +1 -1
  53. package/dist/{connect-uaglGrde.cjs → connect-Br8VMrK1.cjs} +27 -27
  54. package/dist/{connect-BLVHhHzA.mjs → connect-CLD1ai0k.mjs} +14 -14
  55. package/dist/{context-DXzU5bFM.cjs → context-D1lgQTJC.cjs} +1 -1
  56. package/dist/{context-DploEcoN.mjs → context-_YGq8xdH.mjs} +1 -1
  57. package/dist/{controlClient-BWUJrj3t.mjs → controlClient-CkNpT5zS.mjs} +4 -4
  58. package/dist/{controlClient-C-5qCt8W.cjs → controlClient-D68Zj7Q-.cjs} +3 -3
  59. package/dist/{createSessionMetadata-3uXrJgOW.mjs → createSessionMetadata-3WAj3_xl.mjs} +2 -2
  60. package/dist/{createSessionMetadata-BkIzHALd.cjs → createSessionMetadata-DNIbKLHg.cjs} +3 -3
  61. package/dist/{defaultPermissionMode-pS3vmiSg.cjs → defaultPermissionMode-BmvjP32v.cjs} +2 -2
  62. package/dist/{defaultPermissionMode-BzxLh20a.mjs → defaultPermissionMode-DXMznl8v.mjs} +2 -2
  63. package/dist/{detectCLI-DR9ZaN6B.cjs → detectCLI-BuYR_Qxe.cjs} +4 -4
  64. package/dist/{deterministicJson-B8z2GPi9.cjs → deterministicJson-BS7D7URE.cjs} +89 -24
  65. package/dist/{deterministicJson-D_whDMFd.mjs → deterministicJson-BcBIKKf1.mjs} +87 -24
  66. package/dist/{doctor-Br1Kcy2J.cjs → doctor-Be7zC0AF.cjs} +10 -9
  67. package/dist/{doctor-CmtSsR2-.mjs → doctor-CoOaPq6w.mjs} +8 -8
  68. package/dist/{doctorReadiness-BCZGcN0a.cjs → doctorReadiness-Dl6yRQCy.cjs} +1 -1
  69. package/dist/{downloadTarget-BoNwTIH_.mjs → downloadTarget-CeaAXdJj.mjs} +6 -6
  70. package/dist/{downloadTarget-BQJK_6oH.cjs → downloadTarget-LyOiucn_.cjs} +6 -6
  71. package/dist/{ensureDaemonRunning-Czo9IHJQ.mjs → ensureDaemonRunning--98j7-17.mjs} +5 -5
  72. package/dist/{ensureDaemonRunning-BRUmsq6J.cjs → ensureDaemonRunning-B8z37VKD.cjs} +6 -6
  73. package/dist/fileStore-5qpetZS0.mjs +146 -0
  74. package/dist/fileStore-7qhnbs6N.cjs +152 -0
  75. package/dist/{handleResumeCommand-tKD_Hpxc.cjs → handleResumeCommand-BFZlrFVH.cjs} +7 -7
  76. package/dist/{handleResumeCommand-C8thKjqf.mjs → handleResumeCommand-gO8I4keP.mjs} +6 -6
  77. package/dist/{index-DMqDMT1Q.cjs → index-B5PXbZjW.cjs} +80 -62
  78. package/dist/{index-D09T1m8Y.cjs → index-BRMq9gOe.cjs} +3 -3
  79. package/dist/{index-B0UjHlAe.cjs → index-BkluinoS.cjs} +4 -4
  80. package/dist/{index-CdQI0C9p.mjs → index-CO0n9ue6.mjs} +4 -4
  81. package/dist/{index-DPOa4NhL.mjs → index-CeRXrGnH.mjs} +41 -6
  82. package/dist/{index-C6O2vVjm.cjs → index-Df2eHm3O.cjs} +42 -6
  83. package/dist/{index-BTxHphpV.mjs → index-DneHoQXf.mjs} +80 -62
  84. package/dist/{index-BiyC7cZ3.mjs → index-WUj3954m.mjs} +4 -4
  85. package/dist/{index-D3bidoG8.mjs → index-hQ8LP1C2.mjs} +3 -3
  86. package/dist/{index-CUuc6iCn.cjs → index-jF2t3ACW.cjs} +4 -4
  87. package/dist/index.cjs +2 -2
  88. package/dist/index.mjs +2 -2
  89. package/dist/{install-BX3lv3NO.mjs → install-D0inLCv-.mjs} +1 -1
  90. package/dist/{install-BXvf2E3o.cjs → install-D2NCbeJ-.cjs} +1 -1
  91. package/dist/{install-hnve_9vq.mjs → install-DkYFiVK4.mjs} +3 -3
  92. package/dist/{install-CYRZxS87.cjs → install-FqkSUjPC.cjs} +7 -7
  93. package/dist/{installPiTools-BKnXjrVu.cjs → installPiTools-CL_axh_6.cjs} +1 -1
  94. package/dist/{installTerminalHooks-BQZbvxsZ.cjs → installTerminalHooks-BETLKAtd.cjs} +3 -3
  95. package/dist/lib.cjs +13 -13
  96. package/dist/lib.d.cts +216 -2
  97. package/dist/lib.d.mts +216 -2
  98. package/dist/lib.mjs +13 -13
  99. package/dist/{lidState-Bb8fgXg3.mjs → lidState-DghbfRbr.mjs} +1 -1
  100. package/dist/{lidState-Dv2wwFTj.cjs → lidState-x8cJ8J_9.cjs} +1 -1
  101. package/dist/{localHappyAgentAuth-DjYvkXvV.cjs → localHappyAgentAuth-DZ2kb9uq.cjs} +1 -1
  102. package/dist/{localHappyAgentAuth-NEU7fax7.mjs → localHappyAgentAuth-IKmeRpuQ.mjs} +1 -1
  103. package/dist/{logger-C1GWx3gi.cjs → logger-DgBwUSgS.cjs} +2 -2
  104. package/dist/{logger-BtVhHnD8.mjs → logger-LFr8iPgl.mjs} +2 -2
  105. package/dist/machineMetadata-BglCsfvf.mjs +75 -0
  106. package/dist/machineMetadata-DB03ez4K.cjs +87 -0
  107. package/dist/{main-CWhSsbtU.cjs → main-YQ-Vkakw.cjs} +99 -132
  108. package/dist/{main-B2LWV8DI.mjs → main-_1LSzlLv.mjs} +93 -126
  109. package/dist/{mcp-CARUsXHV.cjs → mcp-BIY80jSc.cjs} +15 -15
  110. package/dist/{mcp-ext92q3Y.mjs → mcp-Csj-mT5Y.mjs} +15 -15
  111. package/dist/{mirrorProtocol-DEy2g1CB.cjs → mirrorProtocol-BphKIAK9.cjs} +15 -6
  112. package/dist/{mirrorProtocol-BwYibqry.mjs → mirrorProtocol-CAxOMBkb.mjs} +15 -6
  113. package/dist/{package-BPPebGQF.mjs → package-DYGwlmXl.mjs} +9 -8
  114. package/dist/{package-SgqTYsjn.cjs → package-NoD8QOOM.cjs} +9 -8
  115. package/dist/{panels-BZ0_Tt7B.mjs → panels-B8zRm7_d.mjs} +5 -5
  116. package/dist/{panels-D1c7q2dD.cjs → panels-DYEc1NyQ.cjs} +5 -5
  117. package/dist/{peerTools-CWKzcQ7u.mjs → peerTools-CK3JYu1k.mjs} +5 -5
  118. package/dist/{peerTools-DRQETXaz.cjs → peerTools-CP-x-Peu.cjs} +5 -5
  119. package/dist/{persistence-BegE7NPa.cjs → persistence-BY-D00wT.cjs} +2 -2
  120. package/dist/{persistence-Cr-wutZ4.mjs → persistence-D2Djrf7t.mjs} +2 -2
  121. package/dist/pi-CqyoZMjI.mjs +380 -0
  122. package/dist/pi-DlsrPCTa.cjs +400 -0
  123. package/dist/{piRunnerArgs-DwvM_yWA.mjs → piRunnerArgs-IZLoL7TG.mjs} +1 -1
  124. package/dist/{piRunnerArgs-Cs-378Vz.cjs → piRunnerArgs-gxLYIZH4.cjs} +1 -1
  125. package/dist/{piRuntime-Bue5mnlc.mjs → piRuntime-D7Y4oHVL.mjs} +2 -2
  126. package/dist/{piRuntime-BG-1td_n.cjs → piRuntime-o5L8uX-W.cjs} +2 -2
  127. package/dist/{piTerminal-G4z-xVyy.cjs → piTerminal-C_-JDkLN.cjs} +18 -18
  128. package/dist/{piTerminal-B5x9X5yV.mjs → piTerminal-Kphx8Uhw.mjs} +18 -18
  129. package/dist/projectPath-C3ioB4Bu.cjs +13 -0
  130. package/dist/{prompt-lgF9IE82.cjs → prompt-Bof2aQkI.cjs} +7 -2
  131. package/dist/{prompt-BOouDaTM.mjs → prompt-QHuFx9j6.mjs} +7 -2
  132. package/dist/{pushNotifications-DaLQUyi0.cjs → pushNotifications-BXoOSq_G.cjs} +14 -4
  133. package/dist/{pushNotifications-BdFjDjQe.mjs → pushNotifications-DXGIhE-A.mjs} +14 -4
  134. package/dist/{query-DYP_W1wp.mjs → query-CcA6DVZK.mjs} +1 -1
  135. package/dist/{query-Ctfg-5gy.cjs → query-CdCxzuaB.cjs} +1 -1
  136. package/dist/{rateLimitWindows-Dj_8voBK.cjs → rateLimitWindows-OpAmdOtC.cjs} +1 -1
  137. package/dist/{rateLimitWindows-CuEqk_0g.mjs → rateLimitWindows-ZtHZHe-l.mjs} +1 -1
  138. package/dist/{registerCommonHandlers-Cj084Sg7.cjs → registerCommonHandlers-CRjBoJLK.cjs} +30 -30
  139. package/dist/{registerCommonHandlers-BAlP7SGc.mjs → registerCommonHandlers-DF6bdDtd.mjs} +2 -2
  140. package/dist/{registerKillSessionHandler-qMju0ZfF.cjs → registerKillSessionHandler-7fOm6ooh.cjs} +6 -6
  141. package/dist/{registerKillSessionHandler-PD0jWtQo.mjs → registerKillSessionHandler-DDCKL3wf.mjs} +6 -6
  142. package/dist/{remoteSessionClient-Bn2qu5C5.mjs → remoteSessionClient-B2POSKFT.mjs} +5 -5
  143. package/dist/{remoteSessionClient-B7i7MkYV.cjs → remoteSessionClient-CFCn42bs.cjs} +5 -5
  144. package/dist/{reportProgressTool-gHItlSzz.mjs → reportProgressTool-tPxEvh6x.mjs} +4 -4
  145. package/dist/{reportProgressTool-CM1JFAHg.cjs → reportProgressTool-th4trcET.cjs} +4 -4
  146. package/dist/{resources-CvIlkzpP.cjs → resources-BPyN59Iv.cjs} +23 -2
  147. package/dist/{resources-y9jfyO-_.mjs → resources-CH1iP6Cv.mjs} +22 -3
  148. package/dist/{run-CNXwIe0A.cjs → run-C_FumCQk.cjs} +2767 -183
  149. package/dist/{run-BM4TxiyN.mjs → run-cKQBbVi4.mjs} +2762 -178
  150. package/dist/{runClaude-C_3I8hvR.mjs → runClaude-CYnM6krL.mjs} +34 -28
  151. package/dist/{runClaude-CWhj2V4Q.cjs → runClaude-z_2YC_aa.cjs} +35 -29
  152. package/dist/{runClaudeDeps-B81cOKnH.cjs → runClaudeDeps-CLubzWnA.cjs} +59 -122
  153. package/dist/{runClaudeDeps-QGrOeDe2.mjs → runClaudeDeps-duS06Pb4.mjs} +52 -114
  154. package/dist/{runGemini-BEdWEZLR.mjs → runGemini-C_Pc2EhH.mjs} +39 -37
  155. package/dist/{runGemini-CgRLYbt5.cjs → runGemini-vEoXV6qT.cjs} +67 -65
  156. package/dist/{runOpenClaw-C1NVmzOL.cjs → runOpenClaw-CXJCtMgB.cjs} +20 -20
  157. package/dist/{runOpenClaw-DdQZAYj1.mjs → runOpenClaw-Cxun1qLC.mjs} +19 -19
  158. package/dist/{sandbox-nocIjliq.cjs → sandbox-CO46H2tK.cjs} +4 -4
  159. package/dist/{sandbox-DjQUdCMG.mjs → sandbox-CsvPnTmz.mjs} +4 -4
  160. package/dist/{selfCheck-DCt4Uzbq.cjs → selfCheck-DIr7Gc0i.cjs} +39 -39
  161. package/dist/selfCheck-NamtBHVB.mjs +85 -0
  162. package/dist/{send-Ct7X4pPU.mjs → send-DMoFg6F1.mjs} +9 -9
  163. package/dist/{send-Dydf_hwZ.cjs → send-X2mfVEyr.cjs} +8 -8
  164. package/dist/{server-CosABFbd.cjs → server-BwTEdbkr.cjs} +6 -6
  165. package/dist/{server-DTQGZMxh.mjs → server-CkqQ0sRH.mjs} +4 -4
  166. package/dist/sessionExitLifecycle-CzkLIgNZ.mjs +142 -0
  167. package/dist/sessionExitLifecycle-DFltxXU8.cjs +148 -0
  168. package/dist/{sessionLock-DokGab2R.cjs → sessionLock-CdIRJlHH.cjs} +25 -5
  169. package/dist/{sessionLock-WYIyaVO4.mjs → sessionLock-JIfwCqMk.mjs} +24 -5
  170. package/dist/{sessionOps-S-qPBLFf.cjs → sessionOps-DVA-00nR.cjs} +4 -4
  171. package/dist/{sessionOps-BIGgRube.mjs → sessionOps-DqlftXxe.mjs} +5 -5
  172. package/dist/{sessionScanner-o5hnMi5e.mjs → sessionScanner-BI0Vo1xT.mjs} +3 -3
  173. package/dist/{sessionScanner-CIMM2hvZ.cjs → sessionScanner-BMwgGAhY.cjs} +3 -3
  174. package/dist/{sessions-BJHEZpi2.mjs → sessions-D6IimX7b.mjs} +11 -11
  175. package/dist/{sessions-JchI1w3z.cjs → sessions-DjgEcHaT.cjs} +10 -10
  176. package/dist/{setupOfflineReconnection-CNiAt5ZP.cjs → setupOfflineReconnection-CjuCiKY3.cjs} +2 -2
  177. package/dist/{setupOfflineReconnection-DMiBO2y9.mjs → setupOfflineReconnection-DgJK_4m1.mjs} +2 -2
  178. package/dist/{spawn-DgvUNYEo.mjs → spawn-Dvzy-tzc.mjs} +15 -15
  179. package/dist/{spawn-6PD7nnoC.cjs → spawn-rhF28shY.cjs} +15 -15
  180. package/dist/{spawnAgents-P006Hqio.mjs → spawnAgents-CCnlq-FI.mjs} +1 -1
  181. package/dist/{spawnAgents-DsXgegHM.cjs → spawnAgents-iwuqrgR9.cjs} +1 -1
  182. package/dist/{spawnHappyCLI-Dywezwk6.cjs → spawnHappyCLI-DnKmIsEt.cjs} +2 -2
  183. package/dist/{spawnHappyCLI-CCOrEtf9.mjs → spawnHappyCLI-Dq3LLXLb.mjs} +1 -1
  184. package/dist/{specialCommands-DPcd9edP.mjs → specialCommands-CcyZ1hGA.mjs} +3 -3
  185. package/dist/{specialCommands-QxPpkGKf.cjs → specialCommands-Zwr2C6A2.cjs} +3 -3
  186. package/dist/{startFileWatcher-DghDOCO4.mjs → startFileWatcher-4thXDK9d.mjs} +1 -1
  187. package/dist/{startFileWatcher-RECH5qY8.cjs → startFileWatcher-K6hJSyiR.cjs} +1 -1
  188. package/dist/startupSessionCreate-BfByJ16A.mjs +24 -0
  189. package/dist/startupSessionCreate-CKEbq0tL.cjs +26 -0
  190. package/dist/{streamRelay-DlUWKUpo.cjs → streamRelay-Gy8Xfnon.cjs} +1 -1
  191. package/dist/{streamRelay-DMV_TXfS.mjs → streamRelay-LcDvyEjK.mjs} +1 -1
  192. package/dist/{sync-D23jbqVa.cjs → sync-1hQ5KHpL.cjs} +1 -1
  193. package/dist/{sync-CSe0Rf45.mjs → sync-DO-2PU45.mjs} +1 -1
  194. package/dist/{systemPrompt-CFNKnh65.mjs → systemPrompt-BctLfMZs.mjs} +3 -3
  195. package/dist/{systemPrompt-BOy4kU4P.cjs → systemPrompt-Dj7pgkMK.cjs} +3 -3
  196. package/dist/{teams-DyY669f0.mjs → teams-Bu8YeOoF.mjs} +8 -8
  197. package/dist/{teams-Ov2BDT-A.cjs → teams-uQxUlyyz.cjs} +8 -8
  198. package/dist/{time-65DcU6Jx.mjs → time-BcoJaG8E.mjs} +1 -1
  199. package/dist/{time-CrwIMHta.cjs → time-nqa9shu8.cjs} +1 -1
  200. package/dist/{titleGenerator-CS_rh2_J.cjs → titleGenerator-D09XyYYG.cjs} +3 -3
  201. package/dist/{titleGenerator-CiAMxf7s.mjs → titleGenerator-D5r06bhf.mjs} +1 -1
  202. package/dist/{todo-KY-okGii.cjs → todo-CCOnL7pT.cjs} +6 -6
  203. package/dist/{todo-BDONw0sK.mjs → todo-D1q8146q.mjs} +6 -6
  204. package/dist/{tools-D8-PnZEG.mjs → tools-D2E--n1x.mjs} +3 -3
  205. package/dist/{tools-_w52DZG6.cjs → tools-DiCXnAC5.cjs} +3 -3
  206. package/dist/{uninstall-8vnLN-IE.cjs → uninstall-BrNwwwSD.cjs} +6 -6
  207. package/dist/{uninstall-_fjGRP9b.mjs → uninstall-CtwXi1Rt.mjs} +3 -3
  208. package/package.json +9 -8
  209. package/dist/machineMetadata-CLHS9sv_.cjs +0 -42
  210. package/dist/machineMetadata-D-g--oU_.mjs +0 -39
  211. package/dist/messageBuffer-BWlGgR3A.mjs +0 -71
  212. package/dist/messageBuffer-fJMH6uY8.cjs +0 -73
  213. package/dist/projectPath-ChLhdOyt.cjs +0 -13
  214. package/dist/selfCheck-CjCF4C3v.mjs +0 -85
@@ -1,28 +1,29 @@
1
- import { l as logger } from './logger-BtVhHnD8.mjs';
2
- import { p as prependToMessage, b as buildDigestLine, a as buildFirstTurnPrefix } from './prompt-BOouDaTM.mjs';
3
- import { P as ProjectsUnsupportedError } from './client-BhoEBnuN.mjs';
4
- import { c as createSelfReportState, A as AUTOMATION_TOOL_NAMES, P as PROJECT_TOOL_NAMES, r as registerAutomationTools, a as registerProjectTools, d as createProjectToolExecutor, b as registerReportProgressTool, n as normalizeAttention, e as normalizePhase, f as normalizeProgress, s as shouldAcceptSelfReport } from './reportProgressTool-gHItlSzz.mjs';
5
- import { C as ContextUsageSchema } from './index-DPOa4NhL.mjs';
1
+ import { l as logger } from './logger-LFr8iPgl.mjs';
2
+ import { p as prependToMessage, b as buildDigestLine, a as buildFirstTurnPrefix } from './prompt-QHuFx9j6.mjs';
3
+ import { P as ProjectsUnsupportedError } from './client-BKyU66lg.mjs';
4
+ import { c as createSelfReportState, A as AUTOMATION_TOOL_NAMES, P as PROJECT_TOOL_NAMES, r as registerAutomationTools, a as registerProjectTools, d as createProjectToolExecutor, b as registerReportProgressTool, n as normalizeAttention, e as normalizePhase, f as normalizeProgress, s as shouldAcceptSelfReport } from './reportProgressTool-tPxEvh6x.mjs';
5
+ import { readFileSync, constants } from 'node:fs';
6
+ import { homedir } from 'node:os';
7
+ import { join, dirname } from 'node:path';
8
+ import { z } from 'zod';
9
+ import { p as piAgentDir } from './pi-CqyoZMjI.mjs';
6
10
  import { unlink, mkdir, open, rename } from 'node:fs/promises';
7
11
  import { randomUUID } from 'node:crypto';
8
- import { constants } from 'node:fs';
9
- import { dirname } from 'node:path';
10
- import { z } from 'zod';
11
- import { T as TeamConnectionPreflightError, c as createTeamsClient } from './client-DuTDwWSQ.mjs';
12
- import { t as teamScopePath } from './context-DploEcoN.mjs';
13
- import { g as waitForSessionKey, e as sendUserMessage } from './sessionOps-BIGgRube.mjs';
14
- import { T as TEAM_SKILL } from './resources-y9jfyO-_.mjs';
15
- import { T as TEAM_TOOL_NAMES, r as registerTeamsTools } from './tools-D8-PnZEG.mjs';
16
- import { S as SESSION_PEER_TOOL_NAMES, r as registerSessionPeerTools, a as createSessionPeerToolExecutor } from './peerTools-CWKzcQ7u.mjs';
12
+ import { T as TeamConnectionPreflightError, S as SessionInOtherTeamError, c as createTeamsClient } from './client-DsQcxVUV.mjs';
13
+ import { t as teamScopePath } from './context-_YGq8xdH.mjs';
14
+ import { g as waitForSessionKey, e as sendUserMessage } from './sessionOps-DqlftXxe.mjs';
15
+ import { T as TEAM_SKILL, a as TEAM_LEAD_PLAYBOOK } from './resources-CH1iP6Cv.mjs';
16
+ import { T as TEAM_TOOL_NAMES, r as registerTeamsTools } from './tools-D2E--n1x.mjs';
17
+ import { S as SESSION_PEER_TOOL_NAMES, r as registerSessionPeerTools, a as createSessionPeerToolExecutor } from './peerTools-CK3JYu1k.mjs';
17
18
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
18
19
  import { createServer } from 'node:http';
19
20
  import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
20
21
  import { C as CLIPBOARD_TOOL_NAME, a as CLIPBOARD_TOOL_TITLE, b as CLIPBOARD_TOOL_DESCRIPTION, c as CLIPBOARD_MAX_BYTES } from './limits-DIo7rEBR.mjs';
21
- import { A as ASSISTANT_TOOL_NAMES, a as registerAssistantTools, c as checkDownloadTarget } from './downloadTarget-BoNwTIH_.mjs';
22
+ import { A as ASSISTANT_TOOL_NAMES, a as registerAssistantTools, c as checkDownloadTarget } from './downloadTarget-CeaAXdJj.mjs';
22
23
  import { P as PREVIEW_TOOL_NAME, R as REPORT_PROGRESS_TOOL_NAME, a as PREVIEW_TOOL_TITLE, b as PREVIEW_TOOL_DESCRIPTION, c as PREVIEW_DOWNLOAD_PARAM_DESCRIPTION } from './agentGuidance-BDYt2Qy2.mjs';
23
24
  import { n as normalizeWebPanels, w as webPanelPath } from './webPanels-B2_C2-3g.mjs';
24
- import { r as readSettings } from './persistence-Cr-wutZ4.mjs';
25
- import { g as getSessionNotificationBody } from './pushNotifications-BdFjDjQe.mjs';
25
+ import { r as readSettings } from './persistence-D2Djrf7t.mjs';
26
+ import { g as getSessionNotificationBody } from './pushNotifications-DXGIhE-A.mjs';
26
27
  import { c as checkPreviewPath } from './previewPath-CXN4Vag0.mjs';
27
28
  import { createHash } from 'crypto';
28
29
 
@@ -119,11 +120,67 @@ function createProjectInjector(deps) {
119
120
  };
120
121
  }
121
122
 
123
+ const PiContextReportSchema = z.object({
124
+ source: z.literal("pi"),
125
+ tokens: z.number().finite().nonnegative().nullable(),
126
+ contextWindow: z.number().finite().positive(),
127
+ model: z.string().max(200).nullable().optional(),
128
+ provider: z.string().max(200).nullable().optional(),
129
+ /** The pi event that produced the report (`session_compact`, `turn_end`, …). */
130
+ event: z.string().max(64).nullable().optional(),
131
+ /** Other registry entries with the same model id. */
132
+ peers: z.array(z.object({ provider: z.string().max(200), contextWindow: z.number().finite().positive() })).max(8).optional()
133
+ });
134
+ const obj = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : null;
135
+ const positive = (v) => typeof v === "number" && Number.isFinite(v) && v > 0;
136
+ function piWindowConfigured(modelsJson, provider, model) {
137
+ if (!modelsJson || !provider || !model) return true;
138
+ const config = obj(obj(modelsJson.providers)?.[provider]);
139
+ if (!config) return true;
140
+ if (positive(obj(obj(config.modelOverrides)?.[model])?.contextWindow)) return true;
141
+ const models = Array.isArray(config.models) ? config.models : [];
142
+ const entry = models.map(obj).find((m) => m?.id === model);
143
+ if (!entry) return true;
144
+ return positive(entry.contextWindow);
145
+ }
146
+ function resolvePiContextUsage(report, modelsJson, previous, now) {
147
+ let windowSource = "configured";
148
+ let contextWindow = report.contextWindow;
149
+ if (!piWindowConfigured(modelsJson, report.provider, report.model)) {
150
+ const known = new Set((report.peers ?? []).filter((p) => p.provider !== report.provider && piWindowConfigured(modelsJson, p.provider, report.model)).map((p) => p.contextWindow));
151
+ if (known.size === 1) {
152
+ windowSource = "inferred";
153
+ contextWindow = [...known][0];
154
+ } else {
155
+ windowSource = "unknown";
156
+ }
157
+ }
158
+ const compactedAt = report.event === "session_compact" ? now : report.tokens === null ? previous?.compactedAt ?? null : null;
159
+ return {
160
+ source: "pi",
161
+ tokens: report.tokens,
162
+ contextWindow,
163
+ updatedAt: now,
164
+ windowSource,
165
+ model: report.model ?? null,
166
+ compactedAt
167
+ };
168
+ }
169
+ function readPiModelsJson(env = process.env, home = homedir()) {
170
+ try {
171
+ return obj(JSON.parse(readFileSync(join(piAgentDir({ home, env }), "models.json"), "utf8")));
172
+ } catch {
173
+ return null;
174
+ }
175
+ }
176
+
122
177
  const TEAMS_ADOPT_CAPABILITY = "teams-adopt-v1";
123
178
  const TeamAdoptSchema = z.object({
124
179
  requestId: z.string().min(1).max(128),
125
180
  name: z.string().trim().min(1).max(128),
126
- teamId: z.string().min(1).max(128).optional()
181
+ teamId: z.string().min(1).max(128).optional(),
182
+ /** B-730: the owner confirmed moving this session out of the team it already belongs to. */
183
+ transfer: z.literal(true).optional()
127
184
  }).strict();
128
185
  async function retainIntent(path, input) {
129
186
  await mkdir(dirname(path), { recursive: true, mode: 448 });
@@ -206,7 +263,9 @@ function createTeamAdoption(sessionId) {
206
263
  const connected = await client.initialize(input, { resumeAdoption: true, expectedTeamId: intent.resolvedTeamId, onTeamResolved: (teamId) => retainTeam(path, input, teamId, intent?.guidanceDelivered) });
207
264
  const instructions = `${TEAM_SKILL}
208
265
 
209
- This session is now connected as the team lead. Call team_inspect to read the authoritative state before continuing the user's goal. Do not call team_create or team_join again.`;
266
+ This session is now connected as the team lead. Call team_inspect to read the authoritative state before continuing the user's goal. Do not call team_create or team_join again.
267
+
268
+ ${TEAM_LEAD_PLAYBOOK}`;
210
269
  if (!intent.guidanceDelivered) {
211
270
  const key = await waitForSessionKey(sessionId, 1e4);
212
271
  await sendUserMessage(sessionId, key, instructions, "teams", { localId: `teams-adopt-${input.requestId}`, sentFrom: "team" });
@@ -219,7 +278,12 @@ This session is now connected as the team lead. Call team_inspect to read the au
219
278
  });
220
279
  operation.safeToChange = true;
221
280
  }
222
- operation.result = { error: error instanceof Error ? error.message : "Team connection failed; retry the same request", ...operation.safeToChange ? { safeToChange: true } : {} };
281
+ operation.result = {
282
+ error: error instanceof Error ? error.message : "Team connection failed; retry the same request",
283
+ ...operation.safeToChange ? { safeToChange: true } : {},
284
+ // B-730: the Web asks the owner to confirm a transfer, then sends a new request with `transfer`.
285
+ ...error instanceof SessionInOtherTeamError ? { code: error.code, teamId: error.teamId, teamName: error.teamName } : {}
286
+ };
223
287
  }
224
288
  })();
225
289
  return { status: "pending", requestId: input.requestId };
@@ -534,13 +598,12 @@ async function startHappyServer(client, options) {
534
598
  let body = "";
535
599
  for await (const chunk of req) {
536
600
  body += chunk.toString();
537
- if (Buffer.byteLength(body) > 2048) {
601
+ if (Buffer.byteLength(body) > 4096) {
538
602
  res.writeHead(413).end();
539
603
  return;
540
604
  }
541
605
  }
542
- const usage = ContextUsageSchema.parse({ ...JSON.parse(body), updatedAt: Date.now() });
543
- options.onContextUsage(usage);
606
+ options.onContextUsage(PiContextReportSchema.parse(JSON.parse(body)));
544
607
  res.writeHead(204).end();
545
608
  } catch {
546
609
  if (!res.headersSent) res.writeHead(400).end();
@@ -688,4 +751,4 @@ function hashObject(obj, options, encoding = "hex") {
688
751
  return createHash("sha256").update(jsonString).digest(encoding);
689
752
  }
690
753
 
691
- export { createProjectInjector as c, hashObject as h, startHappyServer as s };
754
+ export { resolvePiContextUsage as a, createProjectInjector as c, hashObject as h, readPiModelsJson as r, startHappyServer as s };
@@ -1,19 +1,19 @@
1
1
  'use strict';
2
2
 
3
3
  var chalk = require('chalk');
4
- var configuration = require('./configuration-CMHZnp6G.cjs');
5
- var persistence = require('./persistence-BegE7NPa.cjs');
6
- var controlClient = require('./controlClient-C-5qCt8W.cjs');
4
+ var configuration = require('./configuration-C8JgseHy.cjs');
5
+ var persistence = require('./persistence-BY-D00wT.cjs');
6
+ var controlClient = require('./controlClient-D68Zj7Q-.cjs');
7
7
  var doctor$1 = require('./doctor-u46qYYKX.cjs');
8
8
  var node_fs = require('node:fs');
9
9
  var path = require('node:path');
10
- var projectPath = require('./projectPath-ChLhdOyt.cjs');
11
- var _package = require('./package-SgqTYsjn.cjs');
12
- var doctorReadiness = require('./doctorReadiness-BCZGcN0a.cjs');
10
+ var projectPath = require('./projectPath-C3ioB4Bu.cjs');
11
+ var _package = require('./package-NoD8QOOM.cjs');
12
+ var doctorReadiness = require('./doctorReadiness-Dl6yRQCy.cjs');
13
13
  var authRelay = require('./authRelay-Dy1qU9td.cjs');
14
14
  var cliUpdate = require('./cliUpdate-DsKXPFYp.cjs');
15
15
  var node_child_process = require('node:child_process');
16
- var piRunnerArgs = require('./piRunnerArgs-Cs-378Vz.cjs');
16
+ var piRunnerArgs = require('./piRunnerArgs-gxLYIZH4.cjs');
17
17
 
18
18
  function shareSafeProcessLine(process2) {
19
19
  return `PID ${process2.pid}: command arguments hidden for privacy`;
@@ -313,8 +313,8 @@ ${typeLabels[type] || type}:`));
313
313
  }
314
314
  console.log(chalk.gray(" An external claude command is only needed for native terminal/mirror use."));
315
315
  try {
316
- const { resolveAgentHomesForCli } = await Promise.resolve().then(function () { return require('./agentHome-BWcz8mz0.cjs'); });
317
- const { describeAgentHome } = await Promise.resolve().then(function () { return require('./index-B0UjHlAe.cjs'); });
316
+ const { resolveAgentHomesForCli } = await Promise.resolve().then(function () { return require('./agentHome-BtUmGcPX.cjs'); });
317
+ const { describeAgentHome } = await Promise.resolve().then(function () { return require('./index-BkluinoS.cjs'); });
318
318
  const homes = await resolveAgentHomesForCli();
319
319
  console.log(chalk.green(`\u2713 Claude config dir: ${describeAgentHome(homes.claudeConfigDir)}`));
320
320
  console.log(chalk.green(`\u2713 Codex home: ${describeAgentHome(homes.codexHome)}`));
@@ -391,6 +391,7 @@ var doctor = /*#__PURE__*/Object.freeze({
391
391
  runDoctorDaemon: runDoctorDaemon
392
392
  });
393
393
 
394
+ exports.NPM_SAFE_ARG = NPM_SAFE_ARG;
394
395
  exports.doctor = doctor;
395
396
  exports.getEnvironmentInfo = getEnvironmentInfo;
396
397
  exports.globalPrefixForPackage = globalPrefixForPackage;
@@ -1,17 +1,17 @@
1
1
  import chalk from 'chalk';
2
- import { c as configuration } from './configuration-WMi4idBB.mjs';
3
- import { r as readSettings, g as readCredentials, d as readDaemonState } from './persistence-Cr-wutZ4.mjs';
4
- import { a as checkIfDaemonRunningAndCleanupStaleState } from './controlClient-BWUJrj3t.mjs';
2
+ import { c as configuration } from './configuration-BPrfb17M.mjs';
3
+ import { r as readSettings, g as readCredentials, d as readDaemonState } from './persistence-D2Djrf7t.mjs';
4
+ import { a as checkIfDaemonRunningAndCleanupStaleState } from './controlClient-CkNpT5zS.mjs';
5
5
  import { findAllHappyProcesses } from './doctor-BPkYWSuq.mjs';
6
6
  import { statSync, realpathSync, existsSync, readdirSync } from 'node:fs';
7
7
  import { isAbsolute, resolve, dirname, basename, delimiter, join } from 'node:path';
8
8
  import { p as projectPath } from './projectPath-BTBIMB57.mjs';
9
- import { p as packageJson } from './package-BPPebGQF.mjs';
9
+ import { p as packageJson } from './package-DYGwlmXl.mjs';
10
10
  import { s as shareableSettingsSummary, c as collectRuntimeReadiness, S as SUPPORTED_NODE_LABEL, r as resolveClaudeCredentialReadiness, a as toolProbeLabel, b as daemonReadiness, d as daemonEndpointsMatch } from './doctorReadiness-C208SMN9.mjs';
11
11
  import { c as credentialRelayProblem } from './authRelay-DhQhkBvX.mjs';
12
12
  import { d as deriveLocalCliUpdateSummary } from './cliUpdate-Y34VGe9Y.mjs';
13
13
  import { spawnSync } from 'node:child_process';
14
- import { c as piInstallCommand } from './piRunnerArgs-DwvM_yWA.mjs';
14
+ import { c as piInstallCommand } from './piRunnerArgs-IZLoL7TG.mjs';
15
15
 
16
16
  function shareSafeProcessLine(process2) {
17
17
  return `PID ${process2.pid}: command arguments hidden for privacy`;
@@ -311,8 +311,8 @@ ${typeLabels[type] || type}:`));
311
311
  }
312
312
  console.log(chalk.gray(" An external claude command is only needed for native terminal/mirror use."));
313
313
  try {
314
- const { resolveAgentHomesForCli } = await import('./agentHome-CghLvL_1.mjs');
315
- const { describeAgentHome } = await import('./index-CdQI0C9p.mjs');
314
+ const { resolveAgentHomesForCli } = await import('./agentHome-B1BsKeqD.mjs');
315
+ const { describeAgentHome } = await import('./index-CO0n9ue6.mjs');
316
316
  const homes = await resolveAgentHomesForCli();
317
317
  console.log(chalk.green(`\u2713 Claude config dir: ${describeAgentHome(homes.claudeConfigDir)}`));
318
318
  console.log(chalk.green(`\u2713 Codex home: ${describeAgentHome(homes.codexHome)}`));
@@ -389,4 +389,4 @@ var doctor = /*#__PURE__*/Object.freeze({
389
389
  runDoctorDaemon: runDoctorDaemon
390
390
  });
391
391
 
392
- export { getEnvironmentInfo as a, doctor as d, globalPrefixForPackage as g };
392
+ export { NPM_SAFE_ARG as N, globalPrefixForPackage as a, doctor as d, getEnvironmentInfo as g };
@@ -4,7 +4,7 @@ var node_child_process = require('node:child_process');
4
4
  var node_fs = require('node:fs');
5
5
  var os = require('node:os');
6
6
  var path = require('node:path');
7
- var detectCLI = require('./detectCLI-DR9ZaN6B.cjs');
7
+ var detectCLI = require('./detectCLI-BuYR_Qxe.cjs');
8
8
 
9
9
  const SUPPORTED_NODE_LABEL = "20.19+ within 20.x, 22.13+ within 22.x, or 24+";
10
10
  const MIN_TMUX_ENV_MAJOR = 3;
@@ -1,14 +1,14 @@
1
1
  import { readFile, writeFile, appendFile, stat } from 'node:fs/promises';
2
2
  import os from 'node:os';
3
3
  import { z } from 'zod';
4
- import { l as logger } from './logger-BtVhHnD8.mjs';
5
- import { c as readPersistedSessions } from './persistence-Cr-wutZ4.mjs';
6
- import { f as spawnDaemonSession } from './controlClient-BWUJrj3t.mjs';
7
- import { a as listSessions, r as readSessionTranscript, s as sessionWebUrl, g as waitForSessionKey, e as sendUserMessage, b as stopSession, d as archiveSession } from './sessionOps-BIGgRube.mjs';
8
- import { r as readRemoteTranscript, s as sendRemoteMessage, d as deliverToSession, R as RemoteSessionOpsError } from './remoteSessionClient-Bn2qu5C5.mjs';
4
+ import { l as logger } from './logger-LFr8iPgl.mjs';
5
+ import { c as readPersistedSessions } from './persistence-D2Djrf7t.mjs';
6
+ import { e as spawnDaemonSession } from './controlClient-CkNpT5zS.mjs';
7
+ import { a as listSessions, r as readSessionTranscript, s as sessionWebUrl, g as waitForSessionKey, e as sendUserMessage, b as stopSession, d as archiveSession } from './sessionOps-DqlftXxe.mjs';
8
+ import { r as readRemoteTranscript, s as sendRemoteMessage, d as deliverToSession, R as RemoteSessionOpsError } from './remoteSessionClient-B2POSKFT.mjs';
9
9
  import { i as isValidSessionId, a as isValidTerminalId } from './ids-DU6sLx4C.mjs';
10
10
  import { l as listVhTerminals, r as readVhTerminal, s as sendToVhTerminal } from './terminals-Dlg0x3nY.mjs';
11
- import { bootstrapAssistantHome, assistantPersonalMemoryPath } from './bootstrap-iuyufnp3.mjs';
11
+ import { bootstrapAssistantHome, assistantPersonalMemoryPath } from './bootstrap-B6EkZh4u.mjs';
12
12
  import { join, isAbsolute, normalize } from 'node:path';
13
13
 
14
14
  const PERSONAL_MEMORY_SOFT_LIMIT_CHARS = 2e3;
@@ -3,14 +3,14 @@
3
3
  var promises = require('node:fs/promises');
4
4
  var os = require('node:os');
5
5
  var z = require('zod');
6
- var logger = require('./logger-C1GWx3gi.cjs');
7
- var persistence = require('./persistence-BegE7NPa.cjs');
8
- var controlClient = require('./controlClient-C-5qCt8W.cjs');
9
- var sessionOps = require('./sessionOps-S-qPBLFf.cjs');
10
- var remoteSessionClient = require('./remoteSessionClient-B7i7MkYV.cjs');
6
+ var logger = require('./logger-DgBwUSgS.cjs');
7
+ var persistence = require('./persistence-BY-D00wT.cjs');
8
+ var controlClient = require('./controlClient-D68Zj7Q-.cjs');
9
+ var sessionOps = require('./sessionOps-DVA-00nR.cjs');
10
+ var remoteSessionClient = require('./remoteSessionClient-CFCn42bs.cjs');
11
11
  var ids = require('./ids-B6ZC0HGt.cjs');
12
12
  var terminals = require('./terminals-B_bfC9c2.cjs');
13
- var bootstrap = require('./bootstrap-exVucYav.cjs');
13
+ var bootstrap = require('./bootstrap-CYtOtbi7.cjs');
14
14
  var path = require('node:path');
15
15
 
16
16
  const PERSONAL_MEMORY_SOFT_LIMIT_CHARS = 2e3;
@@ -1,8 +1,8 @@
1
- import { l as logger } from './logger-BtVhHnD8.mjs';
2
- import { i as isDaemonRunningCurrentlyInstalledHappyVersion, a as checkIfDaemonRunningAndCleanupStaleState, b as stopDaemon } from './controlClient-BWUJrj3t.mjs';
3
- import { s as spawnHappyCLI } from './spawnHappyCLI-CCOrEtf9.mjs';
4
- import { d as readDaemonState } from './persistence-Cr-wutZ4.mjs';
5
- import { c as configuration } from './configuration-WMi4idBB.mjs';
1
+ import { l as logger } from './logger-LFr8iPgl.mjs';
2
+ import { i as isDaemonRunningCurrentlyInstalledHappyVersion, a as checkIfDaemonRunningAndCleanupStaleState, s as stopDaemon } from './controlClient-CkNpT5zS.mjs';
3
+ import { s as spawnHappyCLI } from './spawnHappyCLI-Dq3LLXLb.mjs';
4
+ import { d as readDaemonState } from './persistence-D2Djrf7t.mjs';
5
+ import { c as configuration } from './configuration-BPrfb17M.mjs';
6
6
  import { d as daemonEndpointsMatch } from './doctorReadiness-C208SMN9.mjs';
7
7
 
8
8
  function extractNoSandboxFlag(args) {
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var logger = require('./logger-C1GWx3gi.cjs');
4
- var controlClient = require('./controlClient-C-5qCt8W.cjs');
5
- var spawnHappyCLI = require('./spawnHappyCLI-Dywezwk6.cjs');
6
- var persistence = require('./persistence-BegE7NPa.cjs');
7
- var configuration = require('./configuration-CMHZnp6G.cjs');
8
- var doctorReadiness = require('./doctorReadiness-BCZGcN0a.cjs');
3
+ var logger = require('./logger-DgBwUSgS.cjs');
4
+ var controlClient = require('./controlClient-D68Zj7Q-.cjs');
5
+ var spawnHappyCLI = require('./spawnHappyCLI-DnKmIsEt.cjs');
6
+ var persistence = require('./persistence-BY-D00wT.cjs');
7
+ var configuration = require('./configuration-C8JgseHy.cjs');
8
+ var doctorReadiness = require('./doctorReadiness-Dl6yRQCy.cjs');
9
9
 
10
10
  function extractNoSandboxFlag(args) {
11
11
  let noSandbox = false;
@@ -0,0 +1,146 @@
1
+ import { randomBytes, createHash } from 'node:crypto';
2
+ import { promises, constants } from 'node:fs';
3
+ import { join, dirname, basename } from 'node:path';
4
+
5
+ const MAX_CONFIG_BYTES = 1024 * 1024;
6
+ const MAX_BACKUPS_PER_HARNESS = 20;
7
+ class ModelConfigError extends Error {
8
+ constructor(code, message) {
9
+ super(message);
10
+ this.code = code;
11
+ this.name = "ModelConfigError";
12
+ }
13
+ }
14
+ function sha256(text) {
15
+ return createHash("sha256").update(text).digest("hex");
16
+ }
17
+ async function readConfigFile(path) {
18
+ let stat;
19
+ try {
20
+ stat = await promises.stat(path);
21
+ } catch (error) {
22
+ if (error.code === "ENOENT") {
23
+ return { path, exists: false, content: "", hash: sha256(""), mode: null };
24
+ }
25
+ throw new ModelConfigError("read-failed", `Cannot read ${path}: ${error.message}`);
26
+ }
27
+ if (!stat.isFile()) throw new ModelConfigError("not-a-file", `${path} is not a regular file`);
28
+ if (stat.size > MAX_CONFIG_BYTES) throw new ModelConfigError("file-too-large", `${path} is larger than ${MAX_CONFIG_BYTES} bytes`);
29
+ const content = await promises.readFile(path, "utf8");
30
+ return { path, exists: true, content, hash: sha256(content), mode: stat.mode & 511 };
31
+ }
32
+ async function resolveWriteTarget(path) {
33
+ try {
34
+ return await promises.realpath(path);
35
+ } catch (error) {
36
+ if (error.code === "ENOENT") {
37
+ try {
38
+ const link = await promises.readlink(path);
39
+ return link.startsWith("/") ? link : join(dirname(path), link);
40
+ } catch {
41
+ return path;
42
+ }
43
+ }
44
+ throw error;
45
+ }
46
+ }
47
+ async function atomicWriteFile(path, content, mode) {
48
+ const target = await resolveWriteTarget(path);
49
+ const dir = dirname(target);
50
+ await promises.mkdir(dir, { recursive: true, mode: 448 });
51
+ const tmp = join(dir, `.${basename(target)}.vh-tmp-${process.pid}-${randomBytes(4).toString("hex")}`);
52
+ const handle = await promises.open(tmp, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL, mode ?? 384);
53
+ try {
54
+ await handle.writeFile(content, "utf8");
55
+ await handle.sync();
56
+ } catch (error) {
57
+ await handle.close().catch(() => {
58
+ });
59
+ await promises.unlink(tmp).catch(() => {
60
+ });
61
+ throw error;
62
+ }
63
+ await handle.close();
64
+ try {
65
+ if (mode !== null) await promises.chmod(tmp, mode);
66
+ await promises.rename(tmp, target);
67
+ } catch (error) {
68
+ await promises.unlink(tmp).catch(() => {
69
+ });
70
+ throw error;
71
+ }
72
+ try {
73
+ const dirHandle = await promises.open(dir, "r");
74
+ await dirHandle.sync().catch(() => {
75
+ });
76
+ await dirHandle.close();
77
+ } catch {
78
+ }
79
+ }
80
+ const BACKUP_ID = /^\d{13}-[0-9a-f]{8}$/;
81
+ const HARNESS_DIR = /^[a-z][a-z0-9-]{0,31}$/;
82
+ class BackupStore {
83
+ constructor(root) {
84
+ this.root = root;
85
+ }
86
+ harnessDir(harness) {
87
+ if (!HARNESS_DIR.test(harness)) throw new ModelConfigError("invalid-harness", "Invalid harness");
88
+ return join(this.root, harness);
89
+ }
90
+ async create(harness, reason, files, now = Date.now()) {
91
+ const id = `${now}-${randomBytes(4).toString("hex")}`;
92
+ const dir = join(this.harnessDir(harness), id);
93
+ await promises.mkdir(dir, { recursive: true, mode: 448 });
94
+ const manifest = { id, createdAt: now, reason, files: files.map((f, i) => ({ path: f.path, blob: f.content === null ? null : `f${i}`, mode: f.mode })) };
95
+ for (const [i, file] of files.entries()) {
96
+ if (file.content !== null) await promises.writeFile(join(dir, `f${i}`), file.content, { encoding: "utf8", mode: 384 });
97
+ }
98
+ await promises.writeFile(join(dir, "manifest.json"), JSON.stringify(manifest, null, 2), { encoding: "utf8", mode: 384 });
99
+ await this.prune(harness);
100
+ return { id, createdAt: now, reason, files: files.map((f) => f.path) };
101
+ }
102
+ async list(harness) {
103
+ let names;
104
+ try {
105
+ names = await promises.readdir(this.harnessDir(harness));
106
+ } catch {
107
+ return [];
108
+ }
109
+ const entries = [];
110
+ for (const name of names.filter((n) => BACKUP_ID.test(n))) {
111
+ try {
112
+ const manifest = JSON.parse(await promises.readFile(join(this.harnessDir(harness), name, "manifest.json"), "utf8"));
113
+ entries.push({ id: name, createdAt: Number(manifest.createdAt) || 0, reason: String(manifest.reason ?? ""), files: (manifest.files ?? []).map((f) => f.path) });
114
+ } catch {
115
+ }
116
+ }
117
+ return entries.sort((a, b) => b.createdAt - a.createdAt);
118
+ }
119
+ async read(harness, id) {
120
+ if (!BACKUP_ID.test(id)) throw new ModelConfigError("invalid-backup", "Invalid backup id");
121
+ const dir = join(this.harnessDir(harness), id);
122
+ let manifest;
123
+ try {
124
+ manifest = JSON.parse(await promises.readFile(join(dir, "manifest.json"), "utf8"));
125
+ } catch {
126
+ throw new ModelConfigError("backup-not-found", "Backup not found");
127
+ }
128
+ const out = [];
129
+ for (const file of manifest.files) {
130
+ out.push({
131
+ path: file.path,
132
+ content: file.blob === null ? null : await promises.readFile(join(dir, file.blob), "utf8"),
133
+ mode: typeof file.mode === "number" ? file.mode : null
134
+ });
135
+ }
136
+ return out;
137
+ }
138
+ async prune(harness) {
139
+ const entries = await this.list(harness);
140
+ for (const stale of entries.slice(MAX_BACKUPS_PER_HARNESS)) {
141
+ await promises.rm(join(this.harnessDir(harness), stale.id), { recursive: true, force: true });
142
+ }
143
+ }
144
+ }
145
+
146
+ export { BackupStore as B, ModelConfigError as M, atomicWriteFile as a, readConfigFile as r, sha256 as s };
@@ -0,0 +1,152 @@
1
+ 'use strict';
2
+
3
+ var node_crypto = require('node:crypto');
4
+ var node_fs = require('node:fs');
5
+ var path = require('node:path');
6
+
7
+ const MAX_CONFIG_BYTES = 1024 * 1024;
8
+ const MAX_BACKUPS_PER_HARNESS = 20;
9
+ class ModelConfigError extends Error {
10
+ constructor(code, message) {
11
+ super(message);
12
+ this.code = code;
13
+ this.name = "ModelConfigError";
14
+ }
15
+ }
16
+ function sha256(text) {
17
+ return node_crypto.createHash("sha256").update(text).digest("hex");
18
+ }
19
+ async function readConfigFile(path) {
20
+ let stat;
21
+ try {
22
+ stat = await node_fs.promises.stat(path);
23
+ } catch (error) {
24
+ if (error.code === "ENOENT") {
25
+ return { path, exists: false, content: "", hash: sha256(""), mode: null };
26
+ }
27
+ throw new ModelConfigError("read-failed", `Cannot read ${path}: ${error.message}`);
28
+ }
29
+ if (!stat.isFile()) throw new ModelConfigError("not-a-file", `${path} is not a regular file`);
30
+ if (stat.size > MAX_CONFIG_BYTES) throw new ModelConfigError("file-too-large", `${path} is larger than ${MAX_CONFIG_BYTES} bytes`);
31
+ const content = await node_fs.promises.readFile(path, "utf8");
32
+ return { path, exists: true, content, hash: sha256(content), mode: stat.mode & 511 };
33
+ }
34
+ async function resolveWriteTarget(path$1) {
35
+ try {
36
+ return await node_fs.promises.realpath(path$1);
37
+ } catch (error) {
38
+ if (error.code === "ENOENT") {
39
+ try {
40
+ const link = await node_fs.promises.readlink(path$1);
41
+ return link.startsWith("/") ? link : path.join(path.dirname(path$1), link);
42
+ } catch {
43
+ return path$1;
44
+ }
45
+ }
46
+ throw error;
47
+ }
48
+ }
49
+ async function atomicWriteFile(path$1, content, mode) {
50
+ const target = await resolveWriteTarget(path$1);
51
+ const dir = path.dirname(target);
52
+ await node_fs.promises.mkdir(dir, { recursive: true, mode: 448 });
53
+ const tmp = path.join(dir, `.${path.basename(target)}.vh-tmp-${process.pid}-${node_crypto.randomBytes(4).toString("hex")}`);
54
+ const handle = await node_fs.promises.open(tmp, node_fs.constants.O_WRONLY | node_fs.constants.O_CREAT | node_fs.constants.O_EXCL, mode ?? 384);
55
+ try {
56
+ await handle.writeFile(content, "utf8");
57
+ await handle.sync();
58
+ } catch (error) {
59
+ await handle.close().catch(() => {
60
+ });
61
+ await node_fs.promises.unlink(tmp).catch(() => {
62
+ });
63
+ throw error;
64
+ }
65
+ await handle.close();
66
+ try {
67
+ if (mode !== null) await node_fs.promises.chmod(tmp, mode);
68
+ await node_fs.promises.rename(tmp, target);
69
+ } catch (error) {
70
+ await node_fs.promises.unlink(tmp).catch(() => {
71
+ });
72
+ throw error;
73
+ }
74
+ try {
75
+ const dirHandle = await node_fs.promises.open(dir, "r");
76
+ await dirHandle.sync().catch(() => {
77
+ });
78
+ await dirHandle.close();
79
+ } catch {
80
+ }
81
+ }
82
+ const BACKUP_ID = /^\d{13}-[0-9a-f]{8}$/;
83
+ const HARNESS_DIR = /^[a-z][a-z0-9-]{0,31}$/;
84
+ class BackupStore {
85
+ constructor(root) {
86
+ this.root = root;
87
+ }
88
+ harnessDir(harness) {
89
+ if (!HARNESS_DIR.test(harness)) throw new ModelConfigError("invalid-harness", "Invalid harness");
90
+ return path.join(this.root, harness);
91
+ }
92
+ async create(harness, reason, files, now = Date.now()) {
93
+ const id = `${now}-${node_crypto.randomBytes(4).toString("hex")}`;
94
+ const dir = path.join(this.harnessDir(harness), id);
95
+ await node_fs.promises.mkdir(dir, { recursive: true, mode: 448 });
96
+ const manifest = { id, createdAt: now, reason, files: files.map((f, i) => ({ path: f.path, blob: f.content === null ? null : `f${i}`, mode: f.mode })) };
97
+ for (const [i, file] of files.entries()) {
98
+ if (file.content !== null) await node_fs.promises.writeFile(path.join(dir, `f${i}`), file.content, { encoding: "utf8", mode: 384 });
99
+ }
100
+ await node_fs.promises.writeFile(path.join(dir, "manifest.json"), JSON.stringify(manifest, null, 2), { encoding: "utf8", mode: 384 });
101
+ await this.prune(harness);
102
+ return { id, createdAt: now, reason, files: files.map((f) => f.path) };
103
+ }
104
+ async list(harness) {
105
+ let names;
106
+ try {
107
+ names = await node_fs.promises.readdir(this.harnessDir(harness));
108
+ } catch {
109
+ return [];
110
+ }
111
+ const entries = [];
112
+ for (const name of names.filter((n) => BACKUP_ID.test(n))) {
113
+ try {
114
+ const manifest = JSON.parse(await node_fs.promises.readFile(path.join(this.harnessDir(harness), name, "manifest.json"), "utf8"));
115
+ entries.push({ id: name, createdAt: Number(manifest.createdAt) || 0, reason: String(manifest.reason ?? ""), files: (manifest.files ?? []).map((f) => f.path) });
116
+ } catch {
117
+ }
118
+ }
119
+ return entries.sort((a, b) => b.createdAt - a.createdAt);
120
+ }
121
+ async read(harness, id) {
122
+ if (!BACKUP_ID.test(id)) throw new ModelConfigError("invalid-backup", "Invalid backup id");
123
+ const dir = path.join(this.harnessDir(harness), id);
124
+ let manifest;
125
+ try {
126
+ manifest = JSON.parse(await node_fs.promises.readFile(path.join(dir, "manifest.json"), "utf8"));
127
+ } catch {
128
+ throw new ModelConfigError("backup-not-found", "Backup not found");
129
+ }
130
+ const out = [];
131
+ for (const file of manifest.files) {
132
+ out.push({
133
+ path: file.path,
134
+ content: file.blob === null ? null : await node_fs.promises.readFile(path.join(dir, file.blob), "utf8"),
135
+ mode: typeof file.mode === "number" ? file.mode : null
136
+ });
137
+ }
138
+ return out;
139
+ }
140
+ async prune(harness) {
141
+ const entries = await this.list(harness);
142
+ for (const stale of entries.slice(MAX_BACKUPS_PER_HARNESS)) {
143
+ await node_fs.promises.rm(path.join(this.harnessDir(harness), stale.id), { recursive: true, force: true });
144
+ }
145
+ }
146
+ }
147
+
148
+ exports.BackupStore = BackupStore;
149
+ exports.ModelConfigError = ModelConfigError;
150
+ exports.atomicWriteFile = atomicWriteFile;
151
+ exports.readConfigFile = readConfigFile;
152
+ exports.sha256 = sha256;