very-happy-cli 0.2.164 → 0.2.166

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 (190) hide show
  1. package/README.md +1 -1
  2. package/dist/{AcpBackend-CHDqSii9.cjs → AcpBackend-20VHOXwb.cjs} +3 -3
  3. package/dist/{AcpBackend-B8l1ZePt.mjs → AcpBackend-tRWk7yi7.mjs} +3 -3
  4. package/dist/{AcpSessionManager-BQnDJvct.mjs → AcpSessionManager-B7FIrsys.mjs} +1 -1
  5. package/dist/{AcpSessionManager-9yN2iH4b.cjs → AcpSessionManager-Zf00QnlL.cjs} +1 -1
  6. package/dist/{BasePermissionHandler-DgtAtJTV.mjs → BasePermissionHandler-CDCLIrZJ.mjs} +1 -1
  7. package/dist/{BasePermissionHandler-DGQYvBPg.cjs → BasePermissionHandler-COKc4pmt.cjs} +1 -1
  8. package/dist/{BaseReasoningProcessor-Dfacnfhj.mjs → BaseReasoningProcessor-BDVKvooR.mjs} +1 -1
  9. package/dist/{BaseReasoningProcessor-BqalZhQO.cjs → BaseReasoningProcessor-DAGQdkNp.cjs} +1 -1
  10. package/dist/{agentGuidance-CQuNlNx8.mjs → agentGuidance-BDYt2Qy2.mjs} +4 -2
  11. package/dist/{agentGuidance-B5NATuFa.cjs → agentGuidance-BtBx2xxE.cjs} +4 -1
  12. package/dist/{agentHome-DM0urHEI.mjs → agentHome-2IbIjKCa.mjs} +4 -4
  13. package/dist/{agentHome-DtsPKfTS.cjs → agentHome-KVWj6nCl.cjs} +4 -4
  14. package/dist/{api-Yoh_zKdR.mjs → api-Cmz3XS4P.mjs} +14 -12
  15. package/dist/{api-EKlS0r1w.cjs → api-DnNL5fLw.cjs} +14 -12
  16. package/dist/{apiMachine-s3HiV-SL.mjs → apiMachine-B6ySCFe0.mjs} +2137 -65
  17. package/dist/{apiMachine-q71suojS.cjs → apiMachine-DeoQ8QbZ.cjs} +2134 -62
  18. package/dist/{attachmentContent-BLyyo1al.mjs → attachmentContent-CTXapi-_.mjs} +2 -2
  19. package/dist/{attachmentContent-Bakb0XV3.cjs → attachmentContent-DPWxHgX4.cjs} +2 -2
  20. package/dist/{attachmentLimits-eJZ4ZBjF.cjs → attachmentLimits-BfgKV5iE.cjs} +28 -2
  21. package/dist/{attachmentLimits-B8nzhw-i.mjs → attachmentLimits-C1PCCM79.mjs} +28 -2
  22. package/dist/{auth-BTfv8yW0.mjs → auth-BMaBjRAj.mjs} +8 -8
  23. package/dist/{auth-Hpg4Yxfa.cjs → auth-D4-eQz85.cjs} +8 -8
  24. package/dist/{auth-Cn3dQInF.cjs → auth-ietHtvwu.cjs} +5 -5
  25. package/dist/{auth-Cxhx5evk.mjs → auth-pzWIFdOD.mjs} +5 -5
  26. package/dist/{auto-BAAEVGZa.mjs → auto-DL75Dx3I.mjs} +83 -21
  27. package/dist/{auto-CK8irHum.cjs → auto-DOWTQDPa.cjs} +84 -20
  28. package/dist/{bootstrap-D9SUykG_.cjs → bootstrap-BpXIc2wn.cjs} +2 -2
  29. package/dist/{bootstrap-CTNjn_aj.mjs → bootstrap-XE8A7Ut2.mjs} +2 -2
  30. package/dist/{browser-C8ztaIkm.cjs → browser-CcG8GLRV.cjs} +1 -1
  31. package/dist/{browser-DydXWySF.mjs → browser-DDFi1T8C.mjs} +1 -1
  32. package/dist/{claudeLocal-CsLFMvFU.cjs → claudeLocal-DXBXwIOG.cjs} +6 -6
  33. package/dist/{claudeLocal-CdJJovWq.mjs → claudeLocal-DmM5Oyhv.mjs} +6 -6
  34. package/dist/{claudeLocalLauncher-DRc-tET5.cjs → claudeLocalLauncher-C41Y6Kp4.cjs} +14 -11
  35. package/dist/{claudeLocalLauncher-CKazNnl0.mjs → claudeLocalLauncher-Cs4eUC3P.mjs} +14 -11
  36. package/dist/{claudeSessionFork-BfPW9D2S.mjs → claudeSessionFork-BdLnc2Hv.mjs} +1 -1
  37. package/dist/{claudeSessionFork-BWdhyy9B.cjs → claudeSessionFork-Cs0I3eGI.cjs} +1 -1
  38. package/dist/{client-Do5CHQnZ.mjs → client-CbK33y_s.mjs} +3 -3
  39. package/dist/{client-BZtKFCJr.cjs → client-DJ0kX_8M.cjs} +2 -2
  40. package/dist/{client-DkoV3VWl.mjs → client-GjTnsq6F.mjs} +2 -2
  41. package/dist/{client-C1GAIJ04.cjs → client-JISJx2f-.cjs} +3 -3
  42. package/dist/codex/happyMcpStdioBridge.cjs +23 -18
  43. package/dist/codex/happyMcpStdioBridge.mjs +22 -17
  44. package/dist/{codexAppServerClient-JddkV_aP.cjs → codexAppServerClient-BTjn2ZCZ.cjs} +46 -2
  45. package/dist/{codexAppServerClient-CfF33X-8.mjs → codexAppServerClient-CldXEojt.mjs} +47 -3
  46. package/dist/{codexCommand-Bdj3XZbi.cjs → codexCommand-BpD0N1F7.cjs} +71 -51
  47. package/dist/{codexCommand-btJso8yC.mjs → codexCommand-DjMU-Ijf.mjs} +71 -51
  48. package/dist/{config-nziuMb7g.mjs → config-DjSJKatx.mjs} +3 -3
  49. package/dist/{config-DpCNivmg.cjs → config-DuLL0Ppe.cjs} +3 -3
  50. package/dist/{configuration-PXAE4-FP.cjs → configuration-B0cb3xA3.cjs} +1 -1
  51. package/dist/{configuration-CiBUH72C.mjs → configuration-D2v3puap.mjs} +1 -1
  52. package/dist/{connect-D7ehaW2C.cjs → connect-B7JWEzyg.cjs} +13 -13
  53. package/dist/{connect-XHdi6Vtc.mjs → connect-CnNNyM9I.mjs} +13 -13
  54. package/dist/{context-DhvXl1oC.cjs → context-BFUpYT39.cjs} +1 -1
  55. package/dist/{context-BpEYcuLv.mjs → context-DjfqLWzE.mjs} +1 -1
  56. package/dist/{controlClient-DzmCQrY_.mjs → controlClient-BMUJfUeF.mjs} +13 -6
  57. package/dist/{controlClient-DI-Er-Ww.cjs → controlClient-CmnHGcyl.cjs} +13 -5
  58. package/dist/{createSessionMetadata-B47GrTX6.mjs → createSessionMetadata-DU0bCg2m.mjs} +2 -2
  59. package/dist/{createSessionMetadata-D04x6OMW.cjs → createSessionMetadata-DbfRBhRu.cjs} +2 -2
  60. package/dist/{deterministicJson-CKqT3awl.mjs → deterministicJson-D-WPUrZb.mjs} +36 -52
  61. package/dist/{deterministicJson-BM8e8QwP.cjs → deterministicJson-Dp3TVyap.cjs} +41 -59
  62. package/dist/{doctor-CSgzbG5L.mjs → doctor-BlXXyQ1L.mjs} +6 -6
  63. package/dist/{doctor-Cl6cqvok.cjs → doctor-CkJmdPbi.cjs} +6 -6
  64. package/dist/{assistantTools-D3cZvgUX.cjs → downloadTarget-CiQqRIc-.cjs} +44 -6
  65. package/dist/{assistantTools-BWfAV349.mjs → downloadTarget-DjSwMHun.mjs} +45 -8
  66. package/dist/{ensureDaemonRunning-fPVSsjIm.mjs → ensureDaemonRunning-CAQag1zE.mjs} +5 -5
  67. package/dist/{ensureDaemonRunning-CJ4-U32n.cjs → ensureDaemonRunning-C_aIOhgG.cjs} +5 -5
  68. package/dist/{handleResumeCommand-bX-aNF_z.cjs → handleResumeCommand-6KzBGDnl.cjs} +5 -5
  69. package/dist/{handleResumeCommand-B84dt2aH.mjs → handleResumeCommand-Ci7wacT-.mjs} +5 -5
  70. package/dist/{index-vVWpCoTr.mjs → index-B0HEEYGh.mjs} +22 -5
  71. package/dist/{index-DqlyNgt4.cjs → index-C9hI8a10.cjs} +26 -4
  72. package/dist/{index-B2UvSWo_.cjs → index-CaFCAlX8.cjs} +3 -3
  73. package/dist/{index-CP2fh7JX.cjs → index-DBmNwMX9.cjs} +39 -38
  74. package/dist/{index-DaTxsAC3.cjs → index-DEKIgZUo.cjs} +4 -4
  75. package/dist/{index-OEGj3BxE.mjs → index-DQplgo0W.mjs} +4 -4
  76. package/dist/{index-CbF87SeZ.mjs → index-HQsigW_J.mjs} +3 -3
  77. package/dist/{index-CRJtZCK-.mjs → index-WGCT6SSV.mjs} +40 -39
  78. package/dist/index.cjs +2 -2
  79. package/dist/index.mjs +2 -2
  80. package/dist/{install-BO_W7VhL.mjs → install-BdvKiOQw.mjs} +2 -0
  81. package/dist/{install-__Mni4NU.cjs → install-CejEiRGW.cjs} +3 -3
  82. package/dist/{install-Cs5qAPrB.cjs → install-Cf6AFSWC.cjs} +2 -0
  83. package/dist/{install-CurvoW2u.mjs → install-oJUvsFu9.mjs} +3 -3
  84. package/dist/lib.cjs +12 -12
  85. package/dist/lib.d.cts +55 -2
  86. package/dist/lib.d.mts +55 -2
  87. package/dist/lib.mjs +12 -12
  88. package/dist/{lidState-BbR6y9rq.mjs → lidState-BfximpjX.mjs} +1 -1
  89. package/dist/{lidState-De2HP6nu.cjs → lidState-D8BmnJV1.cjs} +1 -1
  90. package/dist/{localHappyAgentAuth-C7rDePjF.mjs → localHappyAgentAuth-Ct1aXwqd.mjs} +1 -1
  91. package/dist/{localHappyAgentAuth-CboZb3_a.cjs → localHappyAgentAuth-d7B6S_o7.cjs} +1 -1
  92. package/dist/{logger-8dtZPn3n.mjs → logger-BpQcwNnt.mjs} +2 -2
  93. package/dist/{logger-B1k7eZnq.cjs → logger-JTcJU-uL.cjs} +2 -2
  94. package/dist/{machineMetadata-C4OfKn6I.cjs → machineMetadata-BBg_Njw3.cjs} +3 -3
  95. package/dist/{machineMetadata-Bhp_w3-_.mjs → machineMetadata-CBdxABeI.mjs} +3 -3
  96. package/dist/{main-BQTaUrz0.mjs → main-B5b1gA3K.mjs} +44 -44
  97. package/dist/{main-eAiLspBM.cjs → main-C16fOGgn.cjs} +44 -44
  98. package/dist/{mcp-fapbM7Q4.cjs → mcp-BnNiBBax.cjs} +24 -19
  99. package/dist/{mcp-DXCdbQHM.mjs → mcp-DGNWgVdv.mjs} +23 -18
  100. package/dist/{mirrorProtocol-BUtmg1ws.cjs → mirrorProtocol-BEGk2--0.cjs} +80 -0
  101. package/dist/{mirrorProtocol-BNLtoWjO.mjs → mirrorProtocol-h5WHpdhh.mjs} +79 -1
  102. package/dist/{package-tVYgFJoK.mjs → package-BqwrPxL0.mjs} +7 -7
  103. package/dist/{package-CC_txQ31.cjs → package-C1XvUQFy.cjs} +7 -7
  104. package/dist/{peerTools-C1cduHh1.mjs → peerTools-CeCe-3lk.mjs} +4 -4
  105. package/dist/{peerTools-CqIcCEIg.cjs → peerTools-DPvbcs8V.cjs} +4 -4
  106. package/dist/{persistence-d3ZyER6o.cjs → persistence-2Xp_o6x6.cjs} +3 -3
  107. package/dist/{persistence-C_xFQLsD.mjs → persistence-B9LmhAE2.mjs} +3 -3
  108. package/dist/{piRunnerArgs-aq0zJX1Q.mjs → piRunnerArgs-7FaTyNOq.mjs} +1 -1
  109. package/dist/{piRunnerArgs-DSxolPlV.cjs → piRunnerArgs-DI29dDNo.cjs} +1 -1
  110. package/dist/{piRuntime-BnNl5Lmb.mjs → piRuntime-0qEK5AqE.mjs} +1 -1
  111. package/dist/{piRuntime-Dne1LPu-.cjs → piRuntime-R8XVChxK.cjs} +1 -1
  112. package/dist/{piTerminal-fjado4cR.cjs → piTerminal-Ccj0KNPr.cjs} +17 -17
  113. package/dist/{piTerminal-CKWxWtW-.mjs → piTerminal-zcQKc8Sp.mjs} +17 -17
  114. package/dist/precheckCompat-CWOi5c9L.cjs +29 -0
  115. package/dist/precheckCompat-DeEbilbr.mjs +26 -0
  116. package/dist/rateLimitWindows-C2Jk3Ih7.cjs +258 -0
  117. package/dist/rateLimitWindows-Dhfhbtqu.mjs +248 -0
  118. package/dist/{registerCommonHandlers-Dausbdsb.cjs → registerCommonHandlers-Aha_KfM3.cjs} +2 -2
  119. package/dist/{registerCommonHandlers-bSskMveZ.mjs → registerCommonHandlers-DdfGsFbM.mjs} +2 -2
  120. package/dist/{registerKillSessionHandler-CgKyzwqw.cjs → registerKillSessionHandler-CjitOpUA.cjs} +6 -6
  121. package/dist/{registerKillSessionHandler-Ben5lAsN.mjs → registerKillSessionHandler-DboQlGcH.mjs} +6 -6
  122. package/dist/{remoteSessionClient-DnCIuZpQ.mjs → remoteSessionClient-B2DtWuNP.mjs} +5 -5
  123. package/dist/{remoteSessionClient-BkJt8SHa.cjs → remoteSessionClient-BwI8rpQw.cjs} +5 -5
  124. package/dist/{tools-BTBgpiRc.cjs → reportProgressTool-B-Rcy0s3.cjs} +73 -9
  125. package/dist/{tools-gUjkPpCw.mjs → reportProgressTool-DnAD8wOa.mjs} +67 -10
  126. package/dist/{run-B8dxbDsg.cjs → run-Bh66Xs40.cjs} +289 -133
  127. package/dist/{run-BEYMVE4J.mjs → run-DPEwJpQR.mjs} +287 -131
  128. package/dist/{runClaude-Cy_HzLyO.cjs → runClaude-C-lJdAKD.cjs} +25 -20
  129. package/dist/{runClaude-Dd_P1c0f.mjs → runClaude-DLr_nBzw.mjs} +25 -20
  130. package/dist/{runClaudeDeps-JG7EUH7B.mjs → runClaudeDeps-C7JV7nXG.mjs} +47 -37
  131. package/dist/{runClaudeDeps-dxv910DR.cjs → runClaudeDeps-vWWLod7J.cjs} +44 -35
  132. package/dist/{runGemini-DY1IDW_f.cjs → runGemini-o-CUSayc.cjs} +42 -35
  133. package/dist/{runGemini-CpaBuvoW.mjs → runGemini-tH6sLw-G.mjs} +42 -35
  134. package/dist/{runOpenClaw-C7vrDQbq.mjs → runOpenClaw-C5DZvVhn.mjs} +18 -18
  135. package/dist/{runOpenClaw-C0VARcYj.cjs → runOpenClaw-D24f35l0.cjs} +18 -18
  136. package/dist/{sandbox-DRUJZuaM.mjs → sandbox-BaL1aslA.mjs} +4 -4
  137. package/dist/{sandbox-Bx9-M9rN.cjs → sandbox-TJZJ6ngw.cjs} +4 -4
  138. package/dist/selfCheck-DPi4lqme.mjs +84 -0
  139. package/dist/{selfCheck-Ba1sECTO.cjs → selfCheck-Dugi0Nk_.cjs} +34 -34
  140. package/dist/{send-Dqdpx-w5.cjs → send-CkWOSYmU.cjs} +8 -8
  141. package/dist/{send-BrzkbMy2.mjs → send-DDcJ3ayi.mjs} +8 -8
  142. package/dist/{server-CfB8EWCg.cjs → server-7qFQ8J2u.cjs} +6 -6
  143. package/dist/{server-CPMPoEAA.mjs → server-CUjRvQSd.mjs} +4 -4
  144. package/dist/{sessionLock-BsP3Y_nG.cjs → sessionLock-DfhNICyS.cjs} +2 -2
  145. package/dist/{sessionLock-DukLVzAQ.mjs → sessionLock-DqVyHFAQ.mjs} +2 -2
  146. package/dist/{sessionModeFile-JWWF6Nn7.cjs → sessionModeFile-CIznKD7O.cjs} +1 -1
  147. package/dist/{sessionModeFile-CSvi4H_t.mjs → sessionModeFile-M4OpiyrF.mjs} +1 -1
  148. package/dist/{sessionOps-BlMg1uAa.mjs → sessionOps-BnaEaOKs.mjs} +4 -4
  149. package/dist/{sessionOps-HuoMXcIZ.cjs → sessionOps-DOyy4gkY.cjs} +4 -4
  150. package/dist/{sessionScanner-Ct-JoNHP.mjs → sessionScanner-CcuOn9uU.mjs} +75 -19
  151. package/dist/{sessionScanner-BWU6KvZw.cjs → sessionScanner-Cu1yKlj4.cjs} +75 -19
  152. package/dist/{sessions-AjflCj5y.cjs → sessions-BQgk5Kw8.cjs} +9 -9
  153. package/dist/{sessions-3Hw1xXMV.mjs → sessions-C9O91rL1.mjs} +9 -9
  154. package/dist/{setupOfflineReconnection-B_9xp36H.mjs → setupOfflineReconnection-Byy8aeKT.mjs} +2 -2
  155. package/dist/{setupOfflineReconnection-Cxh9Sz9M.cjs → setupOfflineReconnection-DFmQ8s6I.cjs} +2 -2
  156. package/dist/{spawn-CN8PH11G.cjs → spawn-BS7LPmSm.cjs} +13 -12
  157. package/dist/{spawn-BXEVKCQK.mjs → spawn-EZ2yrtWd.mjs} +13 -12
  158. package/dist/{spawnAgents-Czi2VDzj.mjs → spawnAgents-HDaE3C0-.mjs} +1 -1
  159. package/dist/{spawnAgents-McixdtV1.cjs → spawnAgents-vglexX9N.cjs} +1 -1
  160. package/dist/{spawnHappyCLI-BFN0h2fK.mjs → spawnHappyCLI-BAa49m0q.mjs} +1 -1
  161. package/dist/{spawnHappyCLI-Cj-9-d_7.cjs → spawnHappyCLI-DyaldIe5.cjs} +1 -1
  162. package/dist/specialCommands-CCWtwIGZ.mjs +93 -0
  163. package/dist/specialCommands-DouFaJ_0.cjs +96 -0
  164. package/dist/{startFileWatcher-BfMu444W.cjs → startFileWatcher-DQbbypJv.cjs} +1 -1
  165. package/dist/{startFileWatcher-Csql7gdv.mjs → startFileWatcher-Dfs4whzr.mjs} +1 -1
  166. package/dist/{streamRelay-C0AffuX6.cjs → streamRelay-Ce9sgcOV.cjs} +1 -1
  167. package/dist/{streamRelay-BzMEEvJU.mjs → streamRelay-Iogsh51a.mjs} +1 -1
  168. package/dist/{sync-SCvDzRy6.mjs → sync-BLpH13Kb.mjs} +1 -1
  169. package/dist/{sync--uxtLWbo.cjs → sync-x_lI_3j_.cjs} +1 -1
  170. package/dist/{systemPrompt-C1tRiZ-u.cjs → systemPrompt-4erwILTB.cjs} +3 -3
  171. package/dist/{systemPrompt-D0KMySrK.mjs → systemPrompt-BanyDihy.mjs} +3 -3
  172. package/dist/{teams-By-hcvMF.mjs → teams-D6BOT3lR.mjs} +7 -7
  173. package/dist/{teams-CYDIFXEC.cjs → teams-DzetlGWC.cjs} +7 -7
  174. package/dist/{time-CRvAaC5H.mjs → time-CfDKj6Bx.mjs} +1 -1
  175. package/dist/{time-C7BplxuS.cjs → time-T0YmeOhS.cjs} +1 -1
  176. package/dist/{titleGenerator-CUG-n2r3.mjs → titleGenerator-ChImQ4q-.mjs} +1 -1
  177. package/dist/{titleGenerator-Kw3sTnNQ.cjs → titleGenerator-CoMxqKfP.cjs} +2 -2
  178. package/dist/{todo-B7a7J5Ng.cjs → todo-CZZebKZg.cjs} +6 -6
  179. package/dist/{todo-yuIsUvU8.mjs → todo-SVtYxGON.mjs} +6 -6
  180. package/dist/{tools-RvMKw7yx.mjs → tools-3X2z3YDe.mjs} +1 -1
  181. package/dist/{tools-D7UeLMZ7.cjs → tools-IJ0TAcJs.cjs} +1 -1
  182. package/dist/transcriptCursor-B7T_gkQ0.mjs +102 -0
  183. package/dist/transcriptCursor-DcXGLeSc.cjs +106 -0
  184. package/dist/{uninstall-D5D16-KM.cjs → uninstall-CqqCWj7w.cjs} +3 -3
  185. package/dist/{uninstall-Dx9FmLXs.mjs → uninstall-CypD-kr1.mjs} +3 -3
  186. package/package.json +7 -7
  187. package/scripts/terminal_status_forwarder.cjs +89 -0
  188. package/dist/selfCheck-DdT8r263.mjs +0 -84
  189. package/dist/specialCommands-BSqhYg5X.mjs +0 -52
  190. package/dist/specialCommands-DSsTeRej.cjs +0 -54
@@ -1,27 +1,27 @@
1
1
  import chalk from 'chalk';
2
2
  import { readFileSync, statSync } from 'node:fs';
3
3
  import { resolve } from 'node:path';
4
- import { c as checkIfDaemonRunningAndCleanupStaleState, e as spawnDaemonSession, s as stopDaemonSession } from './controlClient-DzmCQrY_.mjs';
5
- import { readPersistedSessions } from './persistence-C_xFQLsD.mjs';
6
- import { r as resolveSpawnPermissionMode, a as resolveFirstMessageMeta, s as sanitizeSpawnPermissionMode, A as ALLOWED_SPAWN_PERMISSION_MODES, S as SPAWN_AGENTS } from './spawnAgents-Czi2VDzj.mjs';
4
+ import { c as checkIfDaemonRunningAndCleanupStaleState, e as spawnDaemonSession, s as stopDaemonSession } from './controlClient-BMUJfUeF.mjs';
5
+ import { readPersistedSessions } from './persistence-B9LmhAE2.mjs';
6
+ import { r as resolveSpawnPermissionMode, a as resolveFirstMessageMeta, s as sanitizeSpawnPermissionMode, A as ALLOWED_SPAWN_PERMISSION_MODES, S as SPAWN_AGENTS } from './spawnAgents-HDaE3C0-.mjs';
7
7
  import { g as getProjectPath } from './path-D2wdaNSk.mjs';
8
- import { f as forkSession, F as ForkSourceMissingError } from './claudeSessionFork-BfPW9D2S.mjs';
9
- import { C as CodexAppServerClient } from './codexAppServerClient-CfF33X-8.mjs';
8
+ import { f as forkSession, F as ForkSourceMissingError } from './claudeSessionFork-BdLnc2Hv.mjs';
9
+ import { C as CodexAppServerClient } from './codexAppServerClient-CldXEojt.mjs';
10
10
  import { f as forkCodexThread } from './codexThreadFork-R76RU5H0.mjs';
11
- import { e as sendUserMessage, f as readSessionMetadata, g as waitForSessionKey, s as sessionWebUrl } from './sessionOps-BlMg1uAa.mjs';
12
- import { i as isValidSpawnOrigin } from './createSessionMetadata-B47GrTX6.mjs';
13
- import { l as logger } from './logger-8dtZPn3n.mjs';
11
+ import { e as sendUserMessage, f as readSessionMetadata, g as waitForSessionKey, s as sessionWebUrl } from './sessionOps-BnaEaOKs.mjs';
12
+ import { i as isValidSpawnOrigin } from './createSessionMetadata-DU0bCg2m.mjs';
13
+ import { l as logger } from './logger-BpQcwNnt.mjs';
14
14
  import { w as waitForForkBackfill } from './forkBackfill-DYIjlN1Z.mjs';
15
- import './configuration-CiBUH72C.mjs';
15
+ import './configuration-D2v3puap.mjs';
16
16
  import 'node:os';
17
- import './package-tVYgFJoK.mjs';
17
+ import './package-BqwrPxL0.mjs';
18
18
  import 'node:fs/promises';
19
19
  import 'zod';
20
20
  import './authRelay-DSAvg1uv.mjs';
21
21
  import 'node:crypto';
22
22
  import 'tweetnacl';
23
23
  import 'node:util';
24
- import './index-vVWpCoTr.mjs';
24
+ import './index-B0HEEYGh.mjs';
25
25
  import '@paralleldrive/cuid2';
26
26
  import 'node:readline';
27
27
  import 'node:child_process';
@@ -29,8 +29,9 @@ import 'cross-spawn';
29
29
  import './contentLogMetadata-BlWI0egu.mjs';
30
30
  import './manager-BQ4flvQZ.mjs';
31
31
  import '@anthropic-ai/sandbox-runtime';
32
+ import './rateLimitWindows-Dhfhbtqu.mjs';
32
33
  import 'axios';
33
- import './time-CRvAaC5H.mjs';
34
+ import './time-CfDKj6Bx.mjs';
34
35
  import 'socket.io-client';
35
36
  import './backgroundTaskActivity-8PdPxrvy.mjs';
36
37
  import './projectPath-BTBIMB57.mjs';
@@ -1,4 +1,4 @@
1
- import { g as getAgentCodeDefaults, n as normalizeAgentKey, h as isClaudeOpus55Model, j as supportsClaudeOpus55 } from './index-vVWpCoTr.mjs';
1
+ import { g as getAgentCodeDefaults, n as normalizeAgentKey, e as isClaudeOpus55Model, f as supportsClaudeOpus55 } from './index-B0HEEYGh.mjs';
2
2
 
3
3
  function resolveSpawnPermissionMode(agent, explicit) {
4
4
  return explicit ?? getAgentCodeDefaults(agent ?? "claude").permissionMode;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DqlyNgt4.cjs');
3
+ var index = require('./index-C9hI8a10.cjs');
4
4
 
5
5
  function resolveSpawnPermissionMode(agent, explicit) {
6
6
  return explicit ?? index.getAgentCodeDefaults(agent ?? "claude").permissionMode;
@@ -1,7 +1,7 @@
1
1
  import { spawn } from 'cross-spawn';
2
2
  import { join } from 'node:path';
3
3
  import { p as projectPath } from './projectPath-BTBIMB57.mjs';
4
- import { l as logger } from './logger-8dtZPn3n.mjs';
4
+ import { l as logger } from './logger-BpQcwNnt.mjs';
5
5
  import { existsSync } from 'node:fs';
6
6
 
7
7
  let cachedRuntime = null;
@@ -3,7 +3,7 @@
3
3
  var spawn = require('cross-spawn');
4
4
  var path = require('node:path');
5
5
  var projectPath = require('./projectPath-ChLhdOyt.cjs');
6
- var logger = require('./logger-B1k7eZnq.cjs');
6
+ var logger = require('./logger-JTcJU-uL.cjs');
7
7
  var node_fs = require('node:fs');
8
8
 
9
9
  let cachedRuntime = null;
@@ -0,0 +1,93 @@
1
+ import { l as logger } from './logger-BpQcwNnt.mjs';
2
+ import { r as reportRateLimitsToDaemon } from './controlClient-BMUJfUeF.mjs';
3
+ import { f as fromCodexRateLimits, a as fromClaudeRateLimitInfo, r as rateLimitReportSignature, R as RATE_LIMIT_OBSERVED_REFRESH_MS } from './rateLimitWindows-Dhfhbtqu.mjs';
4
+
5
+ function createRateLimitReporter(send, now = Date.now) {
6
+ const last = /* @__PURE__ */ new Map();
7
+ const forward = (report) => {
8
+ if (!report) return;
9
+ const signature = rateLimitReportSignature(report);
10
+ const prior = last.get(report.provider);
11
+ if (prior && prior.signature === signature && report.observedAt - prior.at < RATE_LIMIT_OBSERVED_REFRESH_MS) return;
12
+ last.set(report.provider, { signature, at: report.observedAt });
13
+ try {
14
+ send(report);
15
+ } catch (error) {
16
+ logger.debug("[rate-limits] forward failed:", error);
17
+ }
18
+ };
19
+ return {
20
+ observeClaude(rateLimitInfo) {
21
+ try {
22
+ forward(fromClaudeRateLimitInfo(rateLimitInfo, now()));
23
+ } catch (error) {
24
+ logger.debug("[rate-limits] claude frame ignored:", error);
25
+ }
26
+ },
27
+ observeCodex(snapshot) {
28
+ try {
29
+ forward(fromCodexRateLimits(snapshot, now()));
30
+ } catch (error) {
31
+ logger.debug("[rate-limits] codex snapshot ignored:", error);
32
+ }
33
+ }
34
+ };
35
+ }
36
+ let processReporter = null;
37
+ function wrapperRateLimitReporter() {
38
+ processReporter ??= createRateLimitReporter(reportRateLimitsToDaemon);
39
+ return processReporter;
40
+ }
41
+
42
+ function parseCompact(message) {
43
+ const trimmed = message.trim();
44
+ if (trimmed === "/compact") {
45
+ return {
46
+ isCompact: true,
47
+ originalMessage: trimmed
48
+ };
49
+ }
50
+ if (trimmed.startsWith("/compact ")) {
51
+ return {
52
+ isCompact: true,
53
+ originalMessage: trimmed
54
+ };
55
+ }
56
+ return {
57
+ isCompact: false,
58
+ originalMessage: message
59
+ };
60
+ }
61
+ function parseClear(message) {
62
+ const trimmed = message.trim();
63
+ return {
64
+ isClear: trimmed === "/clear"
65
+ };
66
+ }
67
+ function parseSpecialCommand(message) {
68
+ const compactResult = parseCompact(message);
69
+ if (compactResult.isCompact) {
70
+ return {
71
+ type: "compact",
72
+ originalMessage: compactResult.originalMessage
73
+ };
74
+ }
75
+ const clearResult = parseClear(message);
76
+ if (clearResult.isClear) {
77
+ return {
78
+ type: "clear"
79
+ };
80
+ }
81
+ const trimmed = message.trim().toLowerCase();
82
+ if (trimmed === "/mcp") {
83
+ return { type: "mcp" };
84
+ }
85
+ if (trimmed === "/skills") {
86
+ return { type: "skills" };
87
+ }
88
+ return {
89
+ type: null
90
+ };
91
+ }
92
+
93
+ export { parseSpecialCommand as p, wrapperRateLimitReporter as w };
@@ -0,0 +1,96 @@
1
+ 'use strict';
2
+
3
+ var logger = require('./logger-JTcJU-uL.cjs');
4
+ var controlClient = require('./controlClient-CmnHGcyl.cjs');
5
+ var rateLimitWindows = require('./rateLimitWindows-C2Jk3Ih7.cjs');
6
+
7
+ function createRateLimitReporter(send, now = Date.now) {
8
+ const last = /* @__PURE__ */ new Map();
9
+ const forward = (report) => {
10
+ if (!report) return;
11
+ const signature = rateLimitWindows.rateLimitReportSignature(report);
12
+ const prior = last.get(report.provider);
13
+ if (prior && prior.signature === signature && report.observedAt - prior.at < rateLimitWindows.RATE_LIMIT_OBSERVED_REFRESH_MS) return;
14
+ last.set(report.provider, { signature, at: report.observedAt });
15
+ try {
16
+ send(report);
17
+ } catch (error) {
18
+ logger.logger.debug("[rate-limits] forward failed:", error);
19
+ }
20
+ };
21
+ return {
22
+ observeClaude(rateLimitInfo) {
23
+ try {
24
+ forward(rateLimitWindows.fromClaudeRateLimitInfo(rateLimitInfo, now()));
25
+ } catch (error) {
26
+ logger.logger.debug("[rate-limits] claude frame ignored:", error);
27
+ }
28
+ },
29
+ observeCodex(snapshot) {
30
+ try {
31
+ forward(rateLimitWindows.fromCodexRateLimits(snapshot, now()));
32
+ } catch (error) {
33
+ logger.logger.debug("[rate-limits] codex snapshot ignored:", error);
34
+ }
35
+ }
36
+ };
37
+ }
38
+ let processReporter = null;
39
+ function wrapperRateLimitReporter() {
40
+ processReporter ??= createRateLimitReporter(controlClient.reportRateLimitsToDaemon);
41
+ return processReporter;
42
+ }
43
+
44
+ function parseCompact(message) {
45
+ const trimmed = message.trim();
46
+ if (trimmed === "/compact") {
47
+ return {
48
+ isCompact: true,
49
+ originalMessage: trimmed
50
+ };
51
+ }
52
+ if (trimmed.startsWith("/compact ")) {
53
+ return {
54
+ isCompact: true,
55
+ originalMessage: trimmed
56
+ };
57
+ }
58
+ return {
59
+ isCompact: false,
60
+ originalMessage: message
61
+ };
62
+ }
63
+ function parseClear(message) {
64
+ const trimmed = message.trim();
65
+ return {
66
+ isClear: trimmed === "/clear"
67
+ };
68
+ }
69
+ function parseSpecialCommand(message) {
70
+ const compactResult = parseCompact(message);
71
+ if (compactResult.isCompact) {
72
+ return {
73
+ type: "compact",
74
+ originalMessage: compactResult.originalMessage
75
+ };
76
+ }
77
+ const clearResult = parseClear(message);
78
+ if (clearResult.isClear) {
79
+ return {
80
+ type: "clear"
81
+ };
82
+ }
83
+ const trimmed = message.trim().toLowerCase();
84
+ if (trimmed === "/mcp") {
85
+ return { type: "mcp" };
86
+ }
87
+ if (trimmed === "/skills") {
88
+ return { type: "skills" };
89
+ }
90
+ return {
91
+ type: null
92
+ };
93
+ }
94
+
95
+ exports.parseSpecialCommand = parseSpecialCommand;
96
+ exports.wrapperRateLimitReporter = wrapperRateLimitReporter;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var logger = require('./logger-B1k7eZnq.cjs');
3
+ var logger = require('./logger-JTcJU-uL.cjs');
4
4
  var fs = require('fs/promises');
5
5
 
6
6
  function startFileWatcher(file, onFileChange, options = {}) {
@@ -1,4 +1,4 @@
1
- import { l as logger } from './logger-8dtZPn3n.mjs';
1
+ import { l as logger } from './logger-BpQcwNnt.mjs';
2
2
  import { watch } from 'fs/promises';
3
3
 
4
4
  function startFileWatcher(file, onFileChange, options = {}) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DqlyNgt4.cjs');
3
+ var index = require('./index-C9hI8a10.cjs');
4
4
 
5
5
  const STREAM_FLUSH_MS = 80;
6
6
  const PROGRESS_FLUSH_MS = 250;
@@ -1,4 +1,4 @@
1
- import { S as STREAM_DELTA_MAX_CHARS } from './index-vVWpCoTr.mjs';
1
+ import { S as STREAM_DELTA_MAX_CHARS } from './index-B0HEEYGh.mjs';
2
2
 
3
3
  const STREAM_FLUSH_MS = 80;
4
4
  const PROGRESS_FLUSH_MS = 250;
@@ -1,4 +1,4 @@
1
- import { b as backoff } from './time-CRvAaC5H.mjs';
1
+ import { b as backoff } from './time-CfDKj6Bx.mjs';
2
2
 
3
3
  class InvalidateSync {
4
4
  _invalidated = false;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var time = require('./time-C7BplxuS.cjs');
3
+ var time = require('./time-T0YmeOhS.cjs');
4
4
 
5
5
  class InvalidateSync {
6
6
  _invalidated = false;
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var logger = require('./logger-B1k7eZnq.cjs');
3
+ var logger = require('./logger-JTcJU-uL.cjs');
4
4
  var node_fs = require('node:fs');
5
5
  var path$1 = require('node:path');
6
6
  var path = require('./path-B7zW-WwE.cjs');
7
- var index = require('./index-DqlyNgt4.cjs');
7
+ var index = require('./index-C9hI8a10.cjs');
8
8
  var trimIdent = require('./trimIdent-4gvk9Wk6.cjs');
9
9
  var os = require('node:os');
10
- var agentGuidance = require('./agentGuidance-B5NATuFa.cjs');
10
+ var agentGuidance = require('./agentGuidance-BtBx2xxE.cjs');
11
11
 
12
12
  function claudeCheckSession(sessionId, path$2) {
13
13
  const projectDir = path.getProjectPath(path$2);
@@ -1,11 +1,11 @@
1
- import { l as logger } from './logger-8dtZPn3n.mjs';
1
+ import { l as logger } from './logger-BpQcwNnt.mjs';
2
2
  import { existsSync, readFileSync } from 'node:fs';
3
3
  import { join } from 'node:path';
4
4
  import { g as getProjectPath } from './path-D2wdaNSk.mjs';
5
- import { l as BUILTIN_TODO_DISCOVERY } from './index-vVWpCoTr.mjs';
5
+ import { o as BUILTIN_TODO_DISCOVERY } from './index-B0HEEYGh.mjs';
6
6
  import { t as trimIdent } from './trimIdent-BAjmv_TG.mjs';
7
7
  import { homedir } from 'node:os';
8
- import { A as AGENT_GUIDANCE } from './agentGuidance-CQuNlNx8.mjs';
8
+ import { A as AGENT_GUIDANCE } from './agentGuidance-BDYt2Qy2.mjs';
9
9
 
10
10
  function claudeCheckSession(sessionId, path) {
11
11
  const projectDir = getProjectPath(path);
@@ -2,17 +2,17 @@ import { homedir } from 'node:os';
2
2
  import { readFile } from 'node:fs/promises';
3
3
  import { z } from 'zod';
4
4
  import { randomUUID } from 'node:crypto';
5
- import { t as teamRequest, c as createTeamsClient } from './client-Do5CHQnZ.mjs';
6
- import { readCredentialsForConfiguredRelay } from './persistence-C_xFQLsD.mjs';
7
- import { a as installTeamSkill, i as installAutomationSkill } from './install-BO_W7VhL.mjs';
8
- import './configuration-CiBUH72C.mjs';
5
+ import { t as teamRequest, c as createTeamsClient } from './client-CbK33y_s.mjs';
6
+ import { readCredentialsForConfiguredRelay } from './persistence-B9LmhAE2.mjs';
7
+ import { a as installTeamSkill, i as installAutomationSkill } from './install-BdvKiOQw.mjs';
8
+ import './configuration-D2v3puap.mjs';
9
9
  import 'node:fs';
10
10
  import 'node:path';
11
- import './package-tVYgFJoK.mjs';
12
- import './context-BpEYcuLv.mjs';
11
+ import './package-BqwrPxL0.mjs';
12
+ import './context-DjfqLWzE.mjs';
13
13
  import './authRelay-DSAvg1uv.mjs';
14
14
  import 'tweetnacl';
15
- import './logger-8dtZPn3n.mjs';
15
+ import './logger-BpQcwNnt.mjs';
16
16
  import 'chalk';
17
17
  import 'node:util';
18
18
  import './resources-BdFBQi8r.mjs';
@@ -4,17 +4,17 @@ var os = require('node:os');
4
4
  var promises = require('node:fs/promises');
5
5
  var z = require('zod');
6
6
  var node_crypto = require('node:crypto');
7
- var client = require('./client-C1GAIJ04.cjs');
8
- var persistence = require('./persistence-d3ZyER6o.cjs');
9
- var install = require('./install-Cs5qAPrB.cjs');
10
- require('./configuration-PXAE4-FP.cjs');
7
+ var client = require('./client-JISJx2f-.cjs');
8
+ var persistence = require('./persistence-2Xp_o6x6.cjs');
9
+ var install = require('./install-Cf6AFSWC.cjs');
10
+ require('./configuration-B0cb3xA3.cjs');
11
11
  require('node:fs');
12
12
  require('node:path');
13
- require('./package-CC_txQ31.cjs');
14
- require('./context-DhvXl1oC.cjs');
13
+ require('./package-C1XvUQFy.cjs');
14
+ require('./context-BFUpYT39.cjs');
15
15
  require('./authRelay-BdYkC1Po.cjs');
16
16
  require('tweetnacl');
17
- require('./logger-B1k7eZnq.cjs');
17
+ require('./logger-JTcJU-uL.cjs');
18
18
  require('chalk');
19
19
  require('node:util');
20
20
  require('./resources-JDPugcDq.cjs');
@@ -1,4 +1,4 @@
1
- import { l as logger } from './logger-8dtZPn3n.mjs';
1
+ import { l as logger } from './logger-BpQcwNnt.mjs';
2
2
 
3
3
  async function delay(ms) {
4
4
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var logger = require('./logger-B1k7eZnq.cjs');
3
+ var logger = require('./logger-JTcJU-uL.cjs');
4
4
 
5
5
  async function delay(ms) {
6
6
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -3,7 +3,7 @@ import { createRequire } from 'node:module';
3
3
  import { T as TITLE_PROMPT_PREFIX } from './oneShotPrompts-DT4p6RNd.mjs';
4
4
  import { randomUUID } from 'node:crypto';
5
5
  import { resolve, join } from 'node:path';
6
- import { l as logger } from './logger-8dtZPn3n.mjs';
6
+ import { l as logger } from './logger-BpQcwNnt.mjs';
7
7
  import { p as projectPath } from './projectPath-BTBIMB57.mjs';
8
8
 
9
9
  const MAX_PROMPT_SAMPLE_CHARS = 500;
@@ -5,7 +5,7 @@ var module$1 = require('node:module');
5
5
  var oneShotPrompts = require('./oneShotPrompts-CL0dip9C.cjs');
6
6
  var node_crypto = require('node:crypto');
7
7
  var path = require('node:path');
8
- var logger = require('./logger-B1k7eZnq.cjs');
8
+ var logger = require('./logger-JTcJU-uL.cjs');
9
9
  var projectPath = require('./projectPath-ChLhdOyt.cjs');
10
10
 
11
11
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
@@ -14,7 +14,7 @@ const MAX_TITLE_CHARS = 60;
14
14
  const GENERATION_TIMEOUT_MS = 3e4;
15
15
  function resolveClaudeBinary() {
16
16
  try {
17
- const require$1 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('titleGenerator-Kw3sTnNQ.cjs', document.baseURI).href)));
17
+ const require$1 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('titleGenerator-CoMxqKfP.cjs', document.baseURI).href)));
18
18
  const utilsPath = path.resolve(path.join(projectPath.projectPath(), "scripts", "claude_version_utils.cjs"));
19
19
  const { getClaudeCliPath } = require$1(utilsPath);
20
20
  const path$1 = getClaudeCliPath();
@@ -1,20 +1,20 @@
1
1
  'use strict';
2
2
 
3
- var configuration = require('./configuration-PXAE4-FP.cjs');
4
- var index = require('./index-DqlyNgt4.cjs');
5
- var persistence = require('./persistence-d3ZyER6o.cjs');
6
- var context = require('./context-DhvXl1oC.cjs');
3
+ var configuration = require('./configuration-B0cb3xA3.cjs');
4
+ var index = require('./index-C9hI8a10.cjs');
5
+ var persistence = require('./persistence-2Xp_o6x6.cjs');
6
+ var context = require('./context-BFUpYT39.cjs');
7
7
  require('node:fs');
8
8
  require('node:os');
9
9
  require('node:path');
10
- require('./package-CC_txQ31.cjs');
10
+ require('./package-C1XvUQFy.cjs');
11
11
  require('node:fs/promises');
12
12
  require('zod');
13
13
  require('@paralleldrive/cuid2');
14
14
  require('./authRelay-BdYkC1Po.cjs');
15
15
  require('node:crypto');
16
16
  require('tweetnacl');
17
- require('./logger-B1k7eZnq.cjs');
17
+ require('./logger-JTcJU-uL.cjs');
18
18
  require('chalk');
19
19
  require('node:util');
20
20
 
@@ -1,18 +1,18 @@
1
- import { c as configuration } from './configuration-CiBUH72C.mjs';
2
- import { f as createBuiltinTodoClient, B as BUILTIN_TODO_SKILL } from './index-vVWpCoTr.mjs';
3
- import { readCredentialsForConfiguredRelay } from './persistence-C_xFQLsD.mjs';
4
- import { r as readTeamScope, t as teamScopePath } from './context-BpEYcuLv.mjs';
1
+ import { c as configuration } from './configuration-D2v3puap.mjs';
2
+ import { d as createBuiltinTodoClient, B as BUILTIN_TODO_SKILL } from './index-B0HEEYGh.mjs';
3
+ import { readCredentialsForConfiguredRelay } from './persistence-B9LmhAE2.mjs';
4
+ import { r as readTeamScope, t as teamScopePath } from './context-DjfqLWzE.mjs';
5
5
  import 'node:fs';
6
6
  import 'node:os';
7
7
  import 'node:path';
8
- import './package-tVYgFJoK.mjs';
8
+ import './package-BqwrPxL0.mjs';
9
9
  import 'node:fs/promises';
10
10
  import 'zod';
11
11
  import '@paralleldrive/cuid2';
12
12
  import './authRelay-DSAvg1uv.mjs';
13
13
  import 'node:crypto';
14
14
  import 'tweetnacl';
15
- import './logger-8dtZPn3n.mjs';
15
+ import './logger-BpQcwNnt.mjs';
16
16
  import 'chalk';
17
17
  import 'node:util';
18
18
 
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { c as createTeamsClient } from './client-Do5CHQnZ.mjs';
2
+ import { c as createTeamsClient } from './client-CbK33y_s.mjs';
3
3
 
4
4
  const TEAM_TOOL_NAMES = ["team_create", "team_join", "team_inspect", "team_delegate", "team_message", "team_submit", "team_accept", "team_return", "team_cancel", "team_handoff", "team_schedule_create", "team_schedule_pause", "team_schedule_resume", "team_schedule_cancel"];
5
5
  const id = z.string().min(1).max(128);
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var z = require('zod');
4
- var client = require('./client-C1GAIJ04.cjs');
4
+ var client = require('./client-JISJx2f-.cjs');
5
5
 
6
6
  const TEAM_TOOL_NAMES = ["team_create", "team_join", "team_inspect", "team_delegate", "team_message", "team_submit", "team_accept", "team_return", "team_cancel", "team_handoff", "team_schedule_create", "team_schedule_pause", "team_schedule_resume", "team_schedule_cancel"];
7
7
  const id = z.z.string().min(1).max(128);
@@ -0,0 +1,102 @@
1
+ import { open } from 'node:fs/promises';
2
+ import { isAbsolute, basename } from 'node:path';
3
+
4
+ const TRANSCRIPT_BOUNDARY_BYTES = 64;
5
+ function planTranscriptRead(cursor, stat) {
6
+ if (!cursor) return { start: 0, reset: null, verifyAt: null };
7
+ if (cursor.dev !== stat.dev || cursor.ino !== stat.ino) return { start: 0, reset: "replaced", verifyAt: null };
8
+ if (stat.size < cursor.offset) return { start: 0, reset: "truncated", verifyAt: null };
9
+ if (cursor.boundary.length === 0) return { start: cursor.offset, reset: null, verifyAt: null };
10
+ return { start: cursor.offset, reset: null, verifyAt: cursor.offset - cursor.boundary.length };
11
+ }
12
+ function advanceTranscriptCursor(previous, stat, start, bytes) {
13
+ const lastNewline = bytes.lastIndexOf(10);
14
+ const consumed = lastNewline === -1 ? 0 : lastNewline + 1;
15
+ const lines = consumed === 0 ? [] : bytes.subarray(0, consumed).toString("utf-8").split("\n").filter((line) => line.trim().length > 0);
16
+ const carried = previous && start === previous.offset ? previous.boundary : Buffer.alloc(0);
17
+ const tail = Buffer.concat([carried, bytes.subarray(0, consumed)]);
18
+ return {
19
+ lines,
20
+ cursor: {
21
+ offset: start + consumed,
22
+ dev: stat.dev,
23
+ ino: stat.ino,
24
+ boundary: Buffer.from(tail.subarray(Math.max(0, tail.length - TRANSCRIPT_BOUNDARY_BYTES)))
25
+ }
26
+ };
27
+ }
28
+ async function readTranscriptIncrement(path, cursor, opts = {}) {
29
+ let handle;
30
+ try {
31
+ handle = await open(path, "r");
32
+ } catch {
33
+ return null;
34
+ }
35
+ try {
36
+ const st = await handle.stat();
37
+ const stat = { dev: st.dev, ino: st.ino, size: st.size };
38
+ let { start, reset, verifyAt } = planTranscriptRead(cursor, stat);
39
+ if (verifyAt !== null && cursor) {
40
+ const probe = Buffer.alloc(cursor.boundary.length);
41
+ const { bytesRead: bytesRead2 } = await handle.read(probe, 0, probe.length, verifyAt);
42
+ if (bytesRead2 !== probe.length || !probe.equals(cursor.boundary)) {
43
+ start = 0;
44
+ reset = "rewritten";
45
+ }
46
+ }
47
+ const base = reset ? null : cursor;
48
+ const end = opts.limit === void 0 ? stat.size : Math.min(stat.size, Math.max(0, opts.limit));
49
+ const length = Math.max(0, end - start);
50
+ if (length === 0) {
51
+ return { lines: [], cursor: base ? { ...base, dev: stat.dev, ino: stat.ino } : advanceTranscriptCursor(null, stat, 0, Buffer.alloc(0)).cursor, reset };
52
+ }
53
+ const buffer = Buffer.alloc(length);
54
+ const { bytesRead } = await handle.read(buffer, 0, length, start);
55
+ const { lines, cursor: next } = advanceTranscriptCursor(base, stat, start, buffer.subarray(0, bytesRead));
56
+ return { lines, cursor: next, reset };
57
+ } finally {
58
+ await handle.close().catch(() => void 0);
59
+ }
60
+ }
61
+ function isValidTranscriptHint(sessionId, path) {
62
+ return typeof path === "string" && path.length > 0 && path.length <= 4096 && isAbsolute(path) && basename(path) === `${sessionId}.jsonl`;
63
+ }
64
+ class TranscriptPathHints {
65
+ constructor(max = 64) {
66
+ this.max = max;
67
+ }
68
+ paths = /* @__PURE__ */ new Map();
69
+ listeners = /* @__PURE__ */ new Set();
70
+ /** Called synchronously whenever a session's hinted path is set/changed. */
71
+ subscribe(listener) {
72
+ this.listeners.add(listener);
73
+ return () => {
74
+ this.listeners.delete(listener);
75
+ };
76
+ }
77
+ note(sessionId, path) {
78
+ if (!isValidTranscriptHint(sessionId, path)) return false;
79
+ const changed = this.paths.get(sessionId) !== path;
80
+ this.paths.delete(sessionId);
81
+ this.paths.set(sessionId, path);
82
+ if (changed) {
83
+ for (const listener of this.listeners) {
84
+ try {
85
+ listener(sessionId, path);
86
+ } catch {
87
+ }
88
+ }
89
+ }
90
+ while (this.paths.size > this.max) {
91
+ const oldest = this.paths.keys().next().value;
92
+ if (oldest === void 0) break;
93
+ this.paths.delete(oldest);
94
+ }
95
+ return true;
96
+ }
97
+ get(sessionId) {
98
+ return this.paths.get(sessionId);
99
+ }
100
+ }
101
+
102
+ export { TranscriptPathHints as T, isValidTranscriptHint as i, readTranscriptIncrement as r };