very-happy-cli 0.2.158 → 0.2.160

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 (258) hide show
  1. package/dist/{AcpBackend-DIDRig5G.cjs → AcpBackend-Bm2rdke8.cjs} +78 -76
  2. package/dist/{AcpBackend-vDVLHuYJ.mjs → AcpBackend-mzv8Dhba.mjs} +4 -2
  3. package/dist/{AcpSessionManager-C44U99CC.cjs → AcpSessionManager-BAY1Pggx.cjs} +9 -9
  4. package/dist/{AcpSessionManager-CmRjfhn3.mjs → AcpSessionManager-CoMWFVw3.mjs} +1 -1
  5. package/dist/BasePermissionHandler-CFHAxumV.cjs +157 -0
  6. package/dist/BasePermissionHandler-m3WVholL.mjs +155 -0
  7. package/dist/BaseReasoningProcessor-BFa9_rZA.cjs +200 -0
  8. package/dist/BaseReasoningProcessor-CYrKBXGm.mjs +198 -0
  9. package/dist/RemoteModeDisplay-D-HewyXg.mjs +150 -0
  10. package/dist/RemoteModeDisplay-NC1gPHtj.cjs +153 -0
  11. package/dist/agentAttachments-Dbw8iMCZ.cjs +20 -0
  12. package/dist/agentAttachments-M_B5qEF2.mjs +18 -0
  13. package/dist/agentGuidance-B5NATuFa.cjs +28 -0
  14. package/dist/agentGuidance-CQuNlNx8.mjs +20 -0
  15. package/dist/{agentHome-Dw8Jx_CJ.cjs → agentHome-CboCeKWq.cjs} +14 -28
  16. package/dist/{agentHome-CyLmGH5L.mjs → agentHome-Dj1C43aJ.mjs} +8 -22
  17. package/dist/api-CLMUr-SX.mjs +3339 -0
  18. package/dist/api-CgundNNX.cjs +3346 -0
  19. package/dist/{types-DIBF4U0Y.mjs → apiMachine-B9dLW_p5.mjs} +9116 -16015
  20. package/dist/{types-DnrPeN80.cjs → apiMachine-Bn8482VM.cjs} +9104 -16057
  21. package/dist/assistantTools-BTqPnlFl.cjs +380 -0
  22. package/dist/assistantTools-D6tuc6o4.mjs +376 -0
  23. package/dist/attachmentContent-DpiTJZb4.cjs +88 -0
  24. package/dist/attachmentContent-_kxRznNf.mjs +82 -0
  25. package/dist/attachmentLimits-CzVrqgLR.cjs +354 -0
  26. package/dist/attachmentLimits-yba1uHFO.mjs +348 -0
  27. package/dist/auth-BDOVh5h5.cjs +220 -0
  28. package/dist/auth-Cwutmdsa.mjs +225 -0
  29. package/dist/auth-PYHZQNPp.mjs +218 -0
  30. package/dist/auth-ba4WMYrN.cjs +227 -0
  31. package/dist/authRelay-BdYkC1Po.cjs +156 -0
  32. package/dist/authRelay-DSAvg1uv.mjs +143 -0
  33. package/dist/{auto-DZbNcTXx.cjs → auto-BOX_fgmR.cjs} +70 -79
  34. package/dist/{auto-BlMZPwOk.mjs → auto-BXu14yP_.mjs} +27 -36
  35. package/dist/backgroundTaskActivity-8PdPxrvy.mjs +149 -0
  36. package/dist/backgroundTaskActivity-CBvUdj39.cjs +157 -0
  37. package/dist/bootstrap-B5G1TijC.cjs +116 -0
  38. package/dist/bootstrap-hxXPCFMx.mjs +112 -0
  39. package/dist/browser-Y6Bl8L_O.cjs +22 -0
  40. package/dist/browser-jh2P0UVZ.mjs +20 -0
  41. package/dist/claudeCliPath-BqkaH2oR.mjs +8 -0
  42. package/dist/claudeCliPath-U4HHmV4r.cjs +10 -0
  43. package/dist/claudeLocal-BaY4fZKi.mjs +339 -0
  44. package/dist/claudeLocal-CRGG4Pea.cjs +343 -0
  45. package/dist/claudeLocalLauncher-D4T7MTqd.mjs +152 -0
  46. package/dist/claudeLocalLauncher-DyEbVzUN.cjs +154 -0
  47. package/dist/cliUpdate-DsKXPFYp.cjs +120 -0
  48. package/dist/cliUpdate-Y34VGe9Y.mjs +112 -0
  49. package/dist/client-3Ac-O4pw.cjs +104 -0
  50. package/dist/client-BPNbmtvO.cjs +119 -0
  51. package/dist/client-CeGKqqcJ.mjs +100 -0
  52. package/dist/client-ClR0K8zX.mjs +112 -0
  53. package/dist/codex/happyMcpStdioBridge.cjs +33 -14
  54. package/dist/codex/happyMcpStdioBridge.mjs +26 -7
  55. package/dist/codexAppServerClient-I3teiV-N.mjs +1088 -0
  56. package/dist/codexAppServerClient-q2FjnRcK.cjs +1090 -0
  57. package/dist/codexCommand-4zcccIoq.cjs +2088 -0
  58. package/dist/codexCommand-Cc9gcbdX.mjs +2086 -0
  59. package/dist/codexThreadFork-BH9IZPqD.cjs +350 -0
  60. package/dist/codexThreadFork-slzAseLx.mjs +338 -0
  61. package/dist/{config-BtPArqRH.mjs → config-CTx_jb-C.mjs} +7 -40
  62. package/dist/{config-DG84bjwF.cjs → config-Ci9Kpgwa.cjs} +26 -59
  63. package/dist/configuration-BSYpcPwE.cjs +181 -0
  64. package/dist/configuration-RfeNjFmd.mjs +170 -0
  65. package/dist/connect-BpOdzNbE.mjs +682 -0
  66. package/dist/connect-C2CiOUFs.cjs +684 -0
  67. package/dist/constants-BC4St0xd.mjs +11 -0
  68. package/dist/constants-VJ0N6WuG.cjs +17 -0
  69. package/dist/contentLogMetadata-BlWI0egu.mjs +51 -0
  70. package/dist/contentLogMetadata-ZSFk_NjQ.cjs +54 -0
  71. package/dist/context-DsDr6E2t.cjs +69 -0
  72. package/dist/context-H0Bcb9S_.mjs +65 -0
  73. package/dist/controlClient-BGbDcgWS.mjs +260 -0
  74. package/dist/controlClient-Bcwv3D21.cjs +279 -0
  75. package/dist/createSessionMetadata-BJxEnM-o.cjs +58 -0
  76. package/dist/createSessionMetadata-CVVkGjxV.mjs +54 -0
  77. package/dist/defaultPermissionMode-BnxJPVHT.mjs +4 -0
  78. package/dist/defaultPermissionMode-CxmTXUQR.cjs +7 -0
  79. package/dist/detectCLI-CSGMlV51.mjs +58 -0
  80. package/dist/detectCLI-DR9ZaN6B.cjs +61 -0
  81. package/dist/deterministicJson-C5CYTVpm.cjs +507 -0
  82. package/dist/deterministicJson-CzkFJWw1.mjs +502 -0
  83. package/dist/doctor-BPkYWSuq.mjs +75 -0
  84. package/dist/doctor-D2YJ-Yn2.cjs +395 -0
  85. package/dist/doctor-DOvByjbk.mjs +391 -0
  86. package/dist/doctor-u46qYYKX.cjs +79 -0
  87. package/dist/doctorReadiness-BCZGcN0a.cjs +151 -0
  88. package/dist/doctorReadiness-C208SMN9.mjs +142 -0
  89. package/dist/editPaths-BVfS_FFL.mjs +68 -0
  90. package/dist/editPaths-Bqp4OFPw.cjs +73 -0
  91. package/dist/ensureDaemonRunning-BCwNrMyv.cjs +64 -0
  92. package/dist/ensureDaemonRunning-Dqa2pOjY.mjs +61 -0
  93. package/dist/handleResumeCommand-BvXYf5El.mjs +240 -0
  94. package/dist/handleResumeCommand-C2cKchpX.cjs +245 -0
  95. package/dist/ids-B6ZC0HGt.cjs +13 -0
  96. package/dist/ids-DU6sLx4C.mjs +10 -0
  97. package/dist/index-B6UGRQ7h.mjs +102 -0
  98. package/dist/{index-DPCsWlWK.cjs → index-B6pAdvJx.cjs} +131 -91
  99. package/dist/index-Bu5Zi_a9.cjs +182 -0
  100. package/dist/index-D3kI0hDR.cjs +107 -0
  101. package/dist/index-DA7yINuk.cjs +994 -0
  102. package/dist/index-DDeHXrIX.cjs +71 -0
  103. package/dist/index-DKLU_fD0.mjs +158 -0
  104. package/dist/{index-ZChGsuB7.mjs → index-DMZqWwsP.mjs} +79 -39
  105. package/dist/index-DVkMGPyS.mjs +68 -0
  106. package/dist/index-qdS1friN.mjs +949 -0
  107. package/dist/index.cjs +5 -46
  108. package/dist/index.mjs +5 -46
  109. package/dist/{install-DarS_Wco.mjs → install-BO_W7VhL.mjs} +37 -37
  110. package/dist/install-BgoC2e_2.cjs +88 -0
  111. package/dist/install-CFY3tYtJ.mjs +86 -0
  112. package/dist/{install-wKQGgXvN.cjs → install-Cs5qAPrB.cjs} +38 -38
  113. package/dist/{installPiTools-DuZ6jZvX.cjs → installPiTools-BKnXjrVu.cjs} +2 -3
  114. package/dist/{installPiTools-Cj7yU9Fc.mjs → installPiTools-B_CdM5_2.mjs} +1 -2
  115. package/dist/{installTerminalHooks-DcQfee_O.cjs → installTerminalHooks-BQZbvxsZ.cjs} +5 -40
  116. package/dist/{installTerminalHooks-CpNbRFPz.mjs → installTerminalHooks-By7gBMEF.mjs} +3 -38
  117. package/dist/lib.cjs +28 -19
  118. package/dist/lib.d.cts +126 -2
  119. package/dist/lib.d.mts +126 -2
  120. package/dist/lib.mjs +23 -14
  121. package/dist/lidState-BeDfxxEX.cjs +305 -0
  122. package/dist/lidState-CeEt442o.mjs +297 -0
  123. package/dist/limits-C-a7gr04.cjs +43 -0
  124. package/dist/limits-DIo7rEBR.mjs +36 -0
  125. package/dist/localHappyAgentAuth-C-HQyiv6.mjs +82 -0
  126. package/dist/localHappyAgentAuth-D6rFhaoc.cjs +86 -0
  127. package/dist/logger-6HYUEXNk.mjs +271 -0
  128. package/dist/logger-CS0mw3fa.cjs +275 -0
  129. package/dist/loginShellEnv-BkuYtExZ.cjs +182 -0
  130. package/dist/loginShellEnv-Dw8M7tkI.mjs +167 -0
  131. package/dist/machineMetadata-DyDbODYd.cjs +41 -0
  132. package/dist/machineMetadata-oOzBfDfs.mjs +38 -0
  133. package/dist/main-BkxJP6JQ.cjs +941 -0
  134. package/dist/main-BwNIAI1A.mjs +939 -0
  135. package/dist/manager-BQ4flvQZ.mjs +101 -0
  136. package/dist/manager-Cly8xVIR.cjs +105 -0
  137. package/dist/{mcp-BN6bKIGb.mjs → mcp-B1A4I3TK.mjs} +27 -33
  138. package/dist/{mcp-DGdeUUDJ.cjs → mcp-Hszd7qpS.cjs} +42 -48
  139. package/dist/messageBuffer-BWlGgR3A.mjs +71 -0
  140. package/dist/messageBuffer-fJMH6uY8.cjs +73 -0
  141. package/dist/mirrorProtocol-BNLtoWjO.mjs +170 -0
  142. package/dist/mirrorProtocol-BUtmg1ws.cjs +186 -0
  143. package/dist/oneShotPrompts-CL0dip9C.cjs +16 -0
  144. package/dist/oneShotPrompts-DT4p6RNd.mjs +12 -0
  145. package/dist/package-BhaKlnxz.mjs +171 -0
  146. package/dist/package-BwMrPwqH.cjs +173 -0
  147. package/dist/path-B7zW-WwE.cjs +18 -0
  148. package/dist/path-D2wdaNSk.mjs +15 -0
  149. package/dist/peerTools-BTqw97Gb.mjs +272 -0
  150. package/dist/peerTools-BvKtHXj8.cjs +283 -0
  151. package/dist/permissionMode-Cr5JCbB7.mjs +80 -0
  152. package/dist/permissionMode-CrV-XuMs.cjs +87 -0
  153. package/dist/persistence-HGW_ZVs9.mjs +372 -0
  154. package/dist/persistence-yKTH3-5X.cjs +414 -0
  155. package/dist/piExtension.mjs +2 -1
  156. package/dist/piRunnerArgs-BNloJCCg.cjs +66 -0
  157. package/dist/piRunnerArgs-BuX1UFWy.mjs +59 -0
  158. package/dist/{piRuntime-bkw2NAZU.mjs → piRuntime-CSGkwCKQ.mjs} +2 -2
  159. package/dist/{piRuntime-3qtbKujX.cjs → piRuntime-C_H7MJCM.cjs} +4 -4
  160. package/dist/{piTerminal-DilKwM7B.mjs → piTerminal-C8a1OrNQ.mjs} +32 -35
  161. package/dist/{piTerminal-BYxp3LMr.cjs → piTerminal-DNCZ6yTM.cjs} +32 -35
  162. package/dist/previewPath-B0rBdhy1.cjs +83 -0
  163. package/dist/previewPath-CXN4Vag0.mjs +81 -0
  164. package/dist/projectPath-BTBIMB57.mjs +10 -0
  165. package/dist/projectPath-ChLhdOyt.cjs +13 -0
  166. package/dist/registerCommonHandlers-Ccvsz7Ou.mjs +536 -0
  167. package/dist/registerCommonHandlers-DskirN-_.cjs +538 -0
  168. package/dist/registerKillSessionHandler-DZeLXWcB.cjs +361 -0
  169. package/dist/registerKillSessionHandler-GYvHdipX.mjs +358 -0
  170. package/dist/remoteSessionClient-B0LraSB9.cjs +634 -0
  171. package/dist/remoteSessionClient-CYnXRynE.mjs +612 -0
  172. package/dist/resources-BdFBQi8r.mjs +117 -0
  173. package/dist/resources-JDPugcDq.cjs +120 -0
  174. package/dist/run-CJzxoHVh.cjs +5762 -0
  175. package/dist/run-D3ifupU3.mjs +5739 -0
  176. package/dist/runClaude-Ba01qT-u.mjs +848 -0
  177. package/dist/runClaude-Da3RirzE.cjs +850 -0
  178. package/dist/runClaudeDeps-DOt79DjU.mjs +3624 -0
  179. package/dist/runClaudeDeps-DOzEBMls.cjs +3649 -0
  180. package/dist/{runGemini-Cjii069p.mjs → runGemini-BGeTz57m.mjs} +58 -31
  181. package/dist/{runGemini-28O2sqyI.cjs → runGemini-DSr9LIxL.cjs} +202 -175
  182. package/dist/{runOpenClaw-CiMZad-H.cjs → runOpenClaw-B1mTxN35.cjs} +64 -65
  183. package/dist/{runOpenClaw-jaLr7KF1.mjs → runOpenClaw-CogSedIc.mjs} +31 -32
  184. package/dist/sandbox-CG7IyDTU.cjs +187 -0
  185. package/dist/sandbox-DTe6d54R.mjs +180 -0
  186. package/dist/selfCheck-C9mVrQwf.mjs +84 -0
  187. package/dist/selfCheck-Dc-mNSLb.cjs +87 -0
  188. package/dist/{send-D5ejHPXG.cjs → send-B7J_eaG3.cjs} +16 -9
  189. package/dist/{send-C9mOtChi.mjs → send-CBXJKc6O.mjs} +12 -5
  190. package/dist/server-CZTP_iOn.cjs +407 -0
  191. package/dist/server-DcVBv04l.mjs +404 -0
  192. package/dist/sessionLock-Bys1PNSo.cjs +205 -0
  193. package/dist/sessionLock-D-EG2CfG.mjs +197 -0
  194. package/dist/sessionModeFile-DMl3dw3r.mjs +32 -0
  195. package/dist/sessionModeFile-RSm0NQkH.cjs +36 -0
  196. package/dist/sessionOps-Dn8z85h_.cjs +783 -0
  197. package/dist/sessionOps-SuHW8Dfe.mjs +760 -0
  198. package/dist/sessionScanner-BOrGjMXL.cjs +209 -0
  199. package/dist/sessionScanner-CX3onqXh.mjs +206 -0
  200. package/dist/{sessions-W6771g3X.mjs → sessions-BEG_HTSi.mjs} +17 -8
  201. package/dist/{sessions-BNMPQoLE.cjs → sessions-D74aJbhL.cjs} +37 -28
  202. package/dist/setupOfflineReconnection-ByElY60m.cjs +74 -0
  203. package/dist/setupOfflineReconnection-DpvWTt69.mjs +72 -0
  204. package/dist/smallFastModel-BLNgMrwR.mjs +18 -0
  205. package/dist/smallFastModel-D_uxGMo3.cjs +21 -0
  206. package/dist/{spawn-D0QVhzRb.mjs → spawn-B7yro0b2.mjs} +26 -38
  207. package/dist/{spawn-Ddtom1cb.cjs → spawn-DgR0RKRs.cjs} +52 -64
  208. package/dist/spawnAgents-BGQiEF-w.cjs +52 -0
  209. package/dist/spawnAgents-DZzZ9jMI.mjs +45 -0
  210. package/dist/spawnHappyCLI-B2H5s4B_.mjs +64 -0
  211. package/dist/spawnHappyCLI-DBhwZT7O.cjs +66 -0
  212. package/dist/specialCommands-BSqhYg5X.mjs +52 -0
  213. package/dist/specialCommands-DSsTeRej.cjs +54 -0
  214. package/dist/startFileWatcher-B4VsLgjD.cjs +71 -0
  215. package/dist/startFileWatcher-DErVWZE4.mjs +69 -0
  216. package/dist/startupPlan-BLMbfQIH.cjs +12 -0
  217. package/dist/startupPlan-DFMyNgAs.mjs +10 -0
  218. package/dist/streamRelay-BiKw59Cc.cjs +233 -0
  219. package/dist/streamRelay-FPVbHpbM.mjs +231 -0
  220. package/dist/sync-C8gyQFMc.mjs +69 -0
  221. package/dist/sync-DccIKZ5_.cjs +71 -0
  222. package/dist/systemPrompt-BwTPWfMu.cjs +97 -0
  223. package/dist/systemPrompt-DX521JJz.mjs +94 -0
  224. package/dist/{teams-CqSwtw2O.mjs → teams-C32F1hqd.mjs} +9 -40
  225. package/dist/{teams-BZ1tayg_.cjs → teams-Dl8g8kTI.cjs} +14 -45
  226. package/dist/template-BaHAmH2K.cjs +129 -0
  227. package/dist/template-CiOPa2rd.mjs +121 -0
  228. package/dist/{terminalTitleSuggest-DKgX3osW.mjs → terminalTitleSuggest-CeKsX_V6.mjs} +1 -9
  229. package/dist/{terminalTitleSuggest-Dji8I0Jy.cjs → terminalTitleSuggest-DhvRFX3H.cjs} +0 -10
  230. package/dist/terminals-B_bfC9c2.cjs +250 -0
  231. package/dist/terminals-Dlg0x3nY.mjs +235 -0
  232. package/dist/time-D0XyHOid.mjs +38 -0
  233. package/dist/time-DCuTyook.cjs +42 -0
  234. package/dist/titleGenerator-CQ8CoGhg.mjs +166 -0
  235. package/dist/titleGenerator-ChzMJsyg.cjs +172 -0
  236. package/dist/tmuxSocket-B8Yx20sT.mjs +19 -0
  237. package/dist/tmuxSocket-D-Xt6Vn-.cjs +24 -0
  238. package/dist/{todo-BYMg0fR0.cjs → todo-BvUOTa8G.cjs} +15 -12
  239. package/dist/{todo-BbusB1zM.mjs → todo-CZ6cFrrn.mjs} +11 -8
  240. package/dist/tools-BZtHF_qQ.mjs +177 -0
  241. package/dist/tools-Be3AoAwu.cjs +63 -0
  242. package/dist/tools-DQj0AeLk.cjs +180 -0
  243. package/dist/tools-DkluDcG4.mjs +60 -0
  244. package/dist/trimIdent-4gvk9Wk6.cjs +22 -0
  245. package/dist/trimIdent-BAjmv_TG.mjs +20 -0
  246. package/dist/types-CRS-srZK.cjs +66 -0
  247. package/dist/types-CkqAACXx.mjs +64 -0
  248. package/dist/uninstall-BkLzaJ6I.mjs +47 -0
  249. package/dist/uninstall-x-TUtf5H.cjs +49 -0
  250. package/package.json +7 -7
  251. package/dist/agentGuidance-CrR9l62U.mjs +0 -2145
  252. package/dist/agentGuidance-DwOWbX55.cjs +0 -2217
  253. package/dist/index-BG932eCh.cjs +0 -19655
  254. package/dist/index-CVCt3kSt.mjs +0 -19591
  255. package/dist/index-D5ScEErM.cjs +0 -58
  256. package/dist/index-DgO0FHOx.mjs +0 -52
  257. package/dist/limits-D2uN090G.mjs +0 -2528
  258. package/dist/limits-kqFqhfsh.cjs +0 -2652
@@ -0,0 +1,74 @@
1
+ 'use strict';
2
+
3
+ var configuration = require('./configuration-BSYpcPwE.cjs');
4
+ var api = require('./api-CgundNNX.cjs');
5
+
6
+ function createOfflineSessionStub(sessionTag) {
7
+ return {
8
+ sessionId: `offline-${sessionTag}`,
9
+ sendCodexMessage: () => {
10
+ },
11
+ sendAgentMessage: () => {
12
+ },
13
+ sendAgentUsageSnapshot: () => false,
14
+ sendClaudeSessionMessage: () => {
15
+ },
16
+ keepAlive: () => {
17
+ },
18
+ sendSessionEvent: () => {
19
+ },
20
+ sendSessionDeath: () => {
21
+ },
22
+ updateLifecycleState: () => {
23
+ },
24
+ requestControlTransfer: async () => {
25
+ },
26
+ flush: async () => {
27
+ },
28
+ close: async () => {
29
+ },
30
+ updateMetadata: () => {
31
+ },
32
+ updateAgentState: () => {
33
+ },
34
+ onUserMessage: () => {
35
+ },
36
+ onFileEvent: () => {
37
+ },
38
+ trackAttachmentDownload: () => {
39
+ },
40
+ drainAttachmentsForUserMessage: async () => [],
41
+ rpcHandlerManager: {
42
+ registerHandler: () => {
43
+ }
44
+ }
45
+ };
46
+ }
47
+
48
+ function setupOfflineReconnection(opts) {
49
+ const { api: api$1, sessionTag, metadata, state, response, onSessionSwap } = opts;
50
+ let session;
51
+ let reconnectionHandle = null;
52
+ if (!response) {
53
+ session = createOfflineSessionStub(sessionTag);
54
+ reconnectionHandle = api.startOfflineReconnection({
55
+ serverUrl: configuration.configuration.serverUrl,
56
+ onReconnected: async () => {
57
+ const resp = await api$1.getOrCreateSession({ tag: sessionTag, metadata, state });
58
+ if (!resp) throw new Error("Server unavailable");
59
+ const realSession = api$1.sessionSyncClient(resp);
60
+ onSessionSwap(realSession);
61
+ return realSession;
62
+ },
63
+ onNotify: (msg) => {
64
+ console.log(msg);
65
+ }
66
+ });
67
+ return { session, reconnectionHandle, isOffline: true };
68
+ } else {
69
+ session = api$1.sessionSyncClient(response, opts.sessionClientOptions);
70
+ return { session, reconnectionHandle: null, isOffline: false };
71
+ }
72
+ }
73
+
74
+ exports.setupOfflineReconnection = setupOfflineReconnection;
@@ -0,0 +1,72 @@
1
+ import { c as configuration } from './configuration-RfeNjFmd.mjs';
2
+ import { s as startOfflineReconnection } from './api-CLMUr-SX.mjs';
3
+
4
+ function createOfflineSessionStub(sessionTag) {
5
+ return {
6
+ sessionId: `offline-${sessionTag}`,
7
+ sendCodexMessage: () => {
8
+ },
9
+ sendAgentMessage: () => {
10
+ },
11
+ sendAgentUsageSnapshot: () => false,
12
+ sendClaudeSessionMessage: () => {
13
+ },
14
+ keepAlive: () => {
15
+ },
16
+ sendSessionEvent: () => {
17
+ },
18
+ sendSessionDeath: () => {
19
+ },
20
+ updateLifecycleState: () => {
21
+ },
22
+ requestControlTransfer: async () => {
23
+ },
24
+ flush: async () => {
25
+ },
26
+ close: async () => {
27
+ },
28
+ updateMetadata: () => {
29
+ },
30
+ updateAgentState: () => {
31
+ },
32
+ onUserMessage: () => {
33
+ },
34
+ onFileEvent: () => {
35
+ },
36
+ trackAttachmentDownload: () => {
37
+ },
38
+ drainAttachmentsForUserMessage: async () => [],
39
+ rpcHandlerManager: {
40
+ registerHandler: () => {
41
+ }
42
+ }
43
+ };
44
+ }
45
+
46
+ function setupOfflineReconnection(opts) {
47
+ const { api, sessionTag, metadata, state, response, onSessionSwap } = opts;
48
+ let session;
49
+ let reconnectionHandle = null;
50
+ if (!response) {
51
+ session = createOfflineSessionStub(sessionTag);
52
+ reconnectionHandle = startOfflineReconnection({
53
+ serverUrl: configuration.serverUrl,
54
+ onReconnected: async () => {
55
+ const resp = await api.getOrCreateSession({ tag: sessionTag, metadata, state });
56
+ if (!resp) throw new Error("Server unavailable");
57
+ const realSession = api.sessionSyncClient(resp);
58
+ onSessionSwap(realSession);
59
+ return realSession;
60
+ },
61
+ onNotify: (msg) => {
62
+ console.log(msg);
63
+ }
64
+ });
65
+ return { session, reconnectionHandle, isOffline: true };
66
+ } else {
67
+ session = api.sessionSyncClient(response, opts.sessionClientOptions);
68
+ return { session, reconnectionHandle: null, isOffline: false };
69
+ }
70
+ }
71
+
72
+ export { setupOfflineReconnection as s };
@@ -0,0 +1,18 @@
1
+ function ensureLocalProxyBypass(env) {
2
+ const existing = env.NO_PROXY ?? env.no_proxy ?? "";
3
+ const entries = existing.split(",").map((s) => s.trim()).filter(Boolean);
4
+ const toAdd = ["127.0.0.1", "localhost", "::1"].filter((h) => !entries.includes(h));
5
+ if (toAdd.length === 0) return;
6
+ const updated = existing ? `${existing},${toAdd.join(",")}` : toAdd.join(",");
7
+ env.NO_PROXY = updated;
8
+ env.no_proxy = updated;
9
+ }
10
+
11
+ const SMALL_FAST_MODEL = "claude-haiku-4-5-20251001";
12
+ function pinSmallFastModel(env) {
13
+ if (!env.ANTHROPIC_SMALL_FAST_MODEL) {
14
+ env.ANTHROPIC_SMALL_FAST_MODEL = SMALL_FAST_MODEL;
15
+ }
16
+ }
17
+
18
+ export { ensureLocalProxyBypass as e, pinSmallFastModel as p };
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ function ensureLocalProxyBypass(env) {
4
+ const existing = env.NO_PROXY ?? env.no_proxy ?? "";
5
+ const entries = existing.split(",").map((s) => s.trim()).filter(Boolean);
6
+ const toAdd = ["127.0.0.1", "localhost", "::1"].filter((h) => !entries.includes(h));
7
+ if (toAdd.length === 0) return;
8
+ const updated = existing ? `${existing},${toAdd.join(",")}` : toAdd.join(",");
9
+ env.NO_PROXY = updated;
10
+ env.no_proxy = updated;
11
+ }
12
+
13
+ const SMALL_FAST_MODEL = "claude-haiku-4-5-20251001";
14
+ function pinSmallFastModel(env) {
15
+ if (!env.ANTHROPIC_SMALL_FAST_MODEL) {
16
+ env.ANTHROPIC_SMALL_FAST_MODEL = SMALL_FAST_MODEL;
17
+ }
18
+ }
19
+
20
+ exports.ensureLocalProxyBypass = ensureLocalProxyBypass;
21
+ exports.pinSmallFastModel = pinSmallFastModel;
@@ -1,51 +1,39 @@
1
1
  import chalk from 'chalk';
2
2
  import { readFileSync, statSync } from 'node:fs';
3
3
  import { resolve } from 'node:path';
4
- import { d as readPersistedSessions, k as checkIfDaemonRunningAndCleanupStaleState, l as logger, m as spawnDaemonSession, n as stopDaemonSession } from './limits-D2uN090G.mjs';
5
- import { r as resolveSpawnPermissionMode, c as resolveFirstMessageMeta, i as isValidSpawnOrigin, s as sanitizeSpawnPermissionMode, A as ALLOWED_SPAWN_PERMISSION_MODES, S as SPAWN_AGENTS } from './index-CVCt3kSt.mjs';
6
- import { f as forkSession, g as getProjectPath, F as ForkSourceMissingError, C as CodexAppServerClient, c as forkCodexThread } from './types-DIBF4U0Y.mjs';
7
- import { F as readSessionMetadata, x as sessionWebUrl, G as waitForSessionKey, H as sendUserMessage } from './agentGuidance-CrR9l62U.mjs';
8
- import 'zod';
9
- import '@paralleldrive/cuid2';
4
+ import { c as checkIfDaemonRunningAndCleanupStaleState, e as spawnDaemonSession, s as stopDaemonSession } from './controlClient-BGbDcgWS.mjs';
5
+ import { readPersistedSessions } from './persistence-HGW_ZVs9.mjs';
6
+ import { r as resolveSpawnPermissionMode, a as resolveFirstMessageMeta, s as sanitizeSpawnPermissionMode, A as ALLOWED_SPAWN_PERMISSION_MODES, S as SPAWN_AGENTS } from './spawnAgents-DZzZ9jMI.mjs';
7
+ import { g as getProjectPath } from './path-D2wdaNSk.mjs';
8
+ import { f as forkSession, F as ForkSourceMissingError, a as forkCodexThread } from './codexThreadFork-slzAseLx.mjs';
9
+ import { C as CodexAppServerClient } from './codexAppServerClient-I3teiV-N.mjs';
10
+ import { e as readSessionMetadata, s as sessionWebUrl, f as waitForSessionKey, g as sendUserMessage } from './sessionOps-SuHW8Dfe.mjs';
11
+ import { i as isValidSpawnOrigin } from './createSessionMetadata-CVVkGjxV.mjs';
12
+ import { l as logger } from './logger-6HYUEXNk.mjs';
13
+ import './configuration-RfeNjFmd.mjs';
14
+ import 'node:os';
15
+ import './package-BhaKlnxz.mjs';
10
16
  import 'node:fs/promises';
17
+ import 'zod';
18
+ import './authRelay-DSAvg1uv.mjs';
11
19
  import 'node:crypto';
12
20
  import 'tweetnacl';
13
21
  import 'node:util';
14
- import 'node:os';
15
- import 'cross-spawn';
22
+ import './index-qdS1friN.mjs';
23
+ import '@paralleldrive/cuid2';
16
24
  import 'node:readline';
17
- import './terminalTitleSuggest-DKgX3osW.mjs';
18
- import 'path';
19
- import 'url';
20
- import 'fs/promises';
21
- import 'ink';
22
- import 'react';
23
- import '@anthropic-ai/claude-agent-sdk';
24
- import 'axios';
25
- import 'node:events';
26
- import 'socket.io-client';
27
- import 'os';
28
- import 'child_process';
29
25
  import 'node:child_process';
30
- import 'fs';
26
+ import 'cross-spawn';
27
+ import './contentLogMetadata-BlWI0egu.mjs';
28
+ import './manager-BQ4flvQZ.mjs';
31
29
  import '@anthropic-ai/sandbox-runtime';
32
- import 'expo-server-sdk';
33
- import 'crypto';
34
- import 'ps-list';
35
- import 'tmp';
36
- import 'open';
37
- import 'fastify';
38
- import 'fastify-type-provider-zod';
39
- import 'node:module';
40
- import '@modelcontextprotocol/sdk/server/mcp.js';
41
- import 'node:http';
42
- import '@modelcontextprotocol/sdk/server/streamableHttp.js';
43
- import 'http';
44
- import 'util';
45
- import 'inquirer';
46
- import 'node:url';
47
- import 'node:readline/promises';
48
- import 'node-pty';
30
+ import 'axios';
31
+ import './time-D0XyHOid.mjs';
32
+ import 'socket.io-client';
33
+ import './backgroundTaskActivity-8PdPxrvy.mjs';
34
+ import './projectPath-BTBIMB57.mjs';
35
+ import 'path';
36
+ import 'url';
49
37
 
50
38
  function nonEmpty(value) {
51
39
  return typeof value === "string" && value.trim().length > 0;
@@ -2,52 +2,40 @@
2
2
 
3
3
  var chalk = require('chalk');
4
4
  var node_fs = require('node:fs');
5
- var path = require('node:path');
6
- var persistence = require('./limits-kqFqhfsh.cjs');
7
- var index = require('./index-BG932eCh.cjs');
8
- var index$1 = require('./types-DnrPeN80.cjs');
9
- var agentGuidance = require('./agentGuidance-DwOWbX55.cjs');
10
- require('zod');
11
- require('@paralleldrive/cuid2');
5
+ var path$1 = require('node:path');
6
+ var controlClient = require('./controlClient-Bcwv3D21.cjs');
7
+ var persistence = require('./persistence-yKTH3-5X.cjs');
8
+ var spawnAgents = require('./spawnAgents-BGQiEF-w.cjs');
9
+ var path = require('./path-B7zW-WwE.cjs');
10
+ var codexThreadFork = require('./codexThreadFork-BH9IZPqD.cjs');
11
+ var codexAppServerClient = require('./codexAppServerClient-q2FjnRcK.cjs');
12
+ var sessionOps = require('./sessionOps-Dn8z85h_.cjs');
13
+ var createSessionMetadata = require('./createSessionMetadata-BJxEnM-o.cjs');
14
+ var logger = require('./logger-CS0mw3fa.cjs');
15
+ require('./configuration-BSYpcPwE.cjs');
16
+ require('node:os');
17
+ require('./package-BwMrPwqH.cjs');
12
18
  require('node:fs/promises');
19
+ require('zod');
20
+ require('./authRelay-BdYkC1Po.cjs');
13
21
  require('node:crypto');
14
22
  require('tweetnacl');
15
23
  require('node:util');
16
- require('node:os');
17
- require('cross-spawn');
24
+ require('./index-DA7yINuk.cjs');
25
+ require('@paralleldrive/cuid2');
18
26
  require('node:readline');
19
- require('./terminalTitleSuggest-Dji8I0Jy.cjs');
20
- require('path');
21
- require('url');
22
- require('fs/promises');
23
- require('ink');
24
- require('react');
25
- require('@anthropic-ai/claude-agent-sdk');
26
- require('axios');
27
- require('node:events');
28
- require('socket.io-client');
29
- require('os');
30
- require('child_process');
31
27
  require('node:child_process');
32
- require('fs');
28
+ require('cross-spawn');
29
+ require('./contentLogMetadata-ZSFk_NjQ.cjs');
30
+ require('./manager-Cly8xVIR.cjs');
33
31
  require('@anthropic-ai/sandbox-runtime');
34
- require('expo-server-sdk');
35
- require('crypto');
36
- require('ps-list');
37
- require('tmp');
38
- require('open');
39
- require('fastify');
40
- require('fastify-type-provider-zod');
41
- require('node:module');
42
- require('@modelcontextprotocol/sdk/server/mcp.js');
43
- require('node:http');
44
- require('@modelcontextprotocol/sdk/server/streamableHttp.js');
45
- require('http');
46
- require('util');
47
- require('inquirer');
48
- require('node:url');
49
- require('node:readline/promises');
50
- require('node-pty');
32
+ require('axios');
33
+ require('./time-DCuTyook.cjs');
34
+ require('socket.io-client');
35
+ require('./backgroundTaskActivity-CBvUdj39.cjs');
36
+ require('./projectPath-ChLhdOyt.cjs');
37
+ require('path');
38
+ require('url');
51
39
 
52
40
  function nonEmpty(value) {
53
41
  return typeof value === "string" && value.trim().length > 0;
@@ -73,16 +61,16 @@ function resolveForkSource(sessionId, persisted) {
73
61
  async function forkProviderConversation(source) {
74
62
  if (source.agent === "claude") {
75
63
  try {
76
- return { resumeClaudeSessionId: await index$1.forkSession(index$1.getProjectPath(source.directory), source.claudeSessionId) };
64
+ return { resumeClaudeSessionId: await codexThreadFork.forkSession(path.getProjectPath(source.directory), source.claudeSessionId) };
77
65
  } catch (error) {
78
- if (error instanceof index$1.ForkSourceMissingError) throw new Error("Claude session file not found on this machine");
66
+ if (error instanceof codexThreadFork.ForkSourceMissingError) throw new Error("Claude session file not found on this machine");
79
67
  throw error;
80
68
  }
81
69
  }
82
- const client = new index$1.CodexAppServerClient();
70
+ const client = new codexAppServerClient.CodexAppServerClient();
83
71
  await client.connect();
84
72
  try {
85
- const result = await index$1.forkCodexThread(client, { threadId: source.codexThreadId, cwd: source.directory });
73
+ const result = await codexThreadFork.forkCodexThread(client, { threadId: source.codexThreadId, cwd: source.directory });
86
74
  return { resumeCodexThreadId: result.newCodexThreadId };
87
75
  } finally {
88
76
  await client.disconnect();
@@ -115,22 +103,22 @@ function parseSpawnArgs(args) {
115
103
  } else if (arg === "--spawned-by") {
116
104
  const value = args[++i];
117
105
  if (value === void 0) throw new Error("--spawned-by requires a value");
118
- if (!index.isValidSpawnOrigin(value)) {
106
+ if (!createSessionMetadata.isValidSpawnOrigin(value)) {
119
107
  throw new Error("--spawned-by must be 1-24 chars of [a-z0-9] plus - or _, starting with a letter or digit");
120
108
  }
121
109
  options.spawnedBy = value;
122
110
  } else if (arg === "--permission-mode") {
123
111
  const value = args[++i];
124
112
  if (value === void 0) throw new Error("--permission-mode requires a value");
125
- if (index.sanitizeSpawnPermissionMode(value) === null) {
126
- throw new Error(`--permission-mode must be one of: ${index.ALLOWED_SPAWN_PERMISSION_MODES.join(", ")}`);
113
+ if (spawnAgents.sanitizeSpawnPermissionMode(value) === null) {
114
+ throw new Error(`--permission-mode must be one of: ${spawnAgents.ALLOWED_SPAWN_PERMISSION_MODES.join(", ")}`);
127
115
  }
128
116
  options.permissionMode = value;
129
117
  } else if (arg === "--agent") {
130
118
  const value = args[++i];
131
119
  if (value === void 0) throw new Error("--agent requires a value");
132
- if (!index.SPAWN_AGENTS.includes(value)) {
133
- throw new Error(`--agent must be one of: ${index.SPAWN_AGENTS.join(", ")}`);
120
+ if (!spawnAgents.SPAWN_AGENTS.includes(value)) {
121
+ throw new Error(`--agent must be one of: ${spawnAgents.SPAWN_AGENTS.join(", ")}`);
134
122
  }
135
123
  options.agent = value;
136
124
  } else if (arg === "--env") {
@@ -216,9 +204,9 @@ ${chalk.bold("Exit codes:")}
216
204
  `);
217
205
  }
218
206
  async function sendFirstMessage(sessionId, text, metaFor) {
219
- const persisted = await agentGuidance.waitForSessionKey(sessionId, 15e3);
207
+ const persisted = await sessionOps.waitForSessionKey(sessionId, 15e3);
220
208
  const meta = metaFor(persisted.metadata?.capabilities ?? null);
221
- await agentGuidance.sendUserMessage(sessionId, persisted, text, "cli-spawn", meta);
209
+ await sessionOps.sendUserMessage(sessionId, persisted, text, "cli-spawn", meta);
222
210
  return meta;
223
211
  }
224
212
  async function handleSpawnCommand(args) {
@@ -238,14 +226,14 @@ async function handleSpawnCommand(args) {
238
226
  if (options.fork !== void 0) {
239
227
  try {
240
228
  const persisted = persistence.readPersistedSessions()[options.fork];
241
- const current = persisted ? await agentGuidance.readSessionMetadata(options.fork, persisted) : null;
229
+ const current = persisted ? await sessionOps.readSessionMetadata(options.fork, persisted) : null;
242
230
  forkSource = resolveForkSource(options.fork, persisted && current ? { ...persisted, metadata: { ...persisted.metadata, ...current } } : persisted);
243
231
  } catch (error) {
244
232
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : String(error));
245
233
  process.exit(1);
246
234
  }
247
- if (options.dir !== void 0 && path.resolve(options.dir) !== forkSource.directory) {
248
- console.error(chalk.red("Error:"), `--dir ${path.resolve(options.dir)} differs from the forked session's directory ${forkSource.directory}; a fork always continues in its source directory.`);
235
+ if (options.dir !== void 0 && path$1.resolve(options.dir) !== forkSource.directory) {
236
+ console.error(chalk.red("Error:"), `--dir ${path$1.resolve(options.dir)} differs from the forked session's directory ${forkSource.directory}; a fork always continues in its source directory.`);
249
237
  process.exit(1);
250
238
  }
251
239
  if (options.agent !== void 0 && options.agent !== forkSource.agent) {
@@ -257,13 +245,13 @@ async function handleSpawnCommand(args) {
257
245
  console.error(`Run ${chalk.cyan("very-happy spawn --help")} for usage.`);
258
246
  process.exit(1);
259
247
  }
260
- const directory = forkSource ? forkSource.directory : path.resolve(options.dir);
248
+ const directory = forkSource ? forkSource.directory : path$1.resolve(options.dir);
261
249
  const agent = forkSource ? forkSource.agent : options.agent;
262
- const permissionMode = options.permissionMode ?? forkSource?.permissionMode ?? index.resolveSpawnPermissionMode(agent, void 0);
250
+ const permissionMode = options.permissionMode ?? forkSource?.permissionMode ?? spawnAgents.resolveSpawnPermissionMode(agent, void 0);
263
251
  let prompt = options.prompt;
264
252
  if (options.promptFile !== void 0) {
265
253
  try {
266
- prompt = node_fs.readFileSync(path.resolve(options.promptFile), "utf8");
254
+ prompt = node_fs.readFileSync(path$1.resolve(options.promptFile), "utf8");
267
255
  } catch (error) {
268
256
  console.error(chalk.red("Error:"), `Failed to read --prompt-file: ${error instanceof Error ? error.message : String(error)}`);
269
257
  process.exit(1);
@@ -286,7 +274,7 @@ async function handleSpawnCommand(args) {
286
274
  console.error(chalk.red("Error:"), `Directory does not exist: ${directory}`);
287
275
  process.exit(1);
288
276
  }
289
- if (!await persistence.checkIfDaemonRunningAndCleanupStaleState()) {
277
+ if (!await controlClient.checkIfDaemonRunningAndCleanupStaleState()) {
290
278
  console.error(chalk.red("Error:"), "Happy daemon is not running on this machine.");
291
279
  console.error(`Start it with ${chalk.cyan("very-happy daemon start")} and retry.`);
292
280
  process.exit(1);
@@ -300,8 +288,8 @@ async function handleSpawnCommand(args) {
300
288
  process.exit(1);
301
289
  }
302
290
  }
303
- persistence.logger.debug(`[SPAWN CMD] Spawning session in ${directory}${forkSource ? ` (fork of ${forkSource.parentSessionId})` : ""}`);
304
- const result = await persistence.spawnDaemonSession(directory, void 0, {
291
+ logger.logger.debug(`[SPAWN CMD] Spawning session in ${directory}${forkSource ? ` (fork of ${forkSource.parentSessionId})` : ""}`);
292
+ const result = await controlClient.spawnDaemonSession(directory, void 0, {
305
293
  spawnedBy: options.spawnedBy,
306
294
  permissionMode,
307
295
  agent,
@@ -315,9 +303,9 @@ async function handleSpawnCommand(args) {
315
303
  process.exit(1);
316
304
  }
317
305
  const sessionId = result.sessionId;
318
- const url = agentGuidance.sessionWebUrl(sessionId);
306
+ const url = sessionOps.sessionWebUrl(sessionId);
319
307
  if (forkSource && result.resumed !== true) {
320
- await persistence.stopDaemonSession(sessionId).catch(() => false);
308
+ await controlClient.stopDaemonSession(sessionId).catch(() => false);
321
309
  console.error(chalk.red("Error:"), "The running daemon is too old to fork from the CLI (it spawned a fresh session, now stopped). Restart the daemon on this CLI version and retry.");
322
310
  process.exit(1);
323
311
  }
@@ -325,7 +313,7 @@ async function handleSpawnCommand(args) {
325
313
  let sentMeta = null;
326
314
  if (prompt !== void 0) {
327
315
  try {
328
- sentMeta = await sendFirstMessage(sessionId, prompt, (capabilities) => index.resolveFirstMessageMeta({
316
+ sentMeta = await sendFirstMessage(sessionId, prompt, (capabilities) => spawnAgents.resolveFirstMessageMeta({
329
317
  agent,
330
318
  permissionMode,
331
319
  explicitModel: options.model,
@@ -371,8 +359,8 @@ async function handleSpawnCommand(args) {
371
359
  process.exit(0);
372
360
  }
373
361
 
374
- exports.SPAWN_AGENTS = index.SPAWN_AGENTS;
375
- exports.sessionWebUrl = agentGuidance.sessionWebUrl;
362
+ exports.SPAWN_AGENTS = spawnAgents.SPAWN_AGENTS;
363
+ exports.sessionWebUrl = sessionOps.sessionWebUrl;
376
364
  exports.handleSpawnCommand = handleSpawnCommand;
377
365
  exports.parseEnvAssignment = parseEnvAssignment;
378
366
  exports.parseSpawnArgs = parseSpawnArgs;
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-DA7yINuk.cjs');
4
+
5
+ function resolveSpawnPermissionMode(agent, explicit) {
6
+ return explicit ?? index.getAgentCodeDefaults(agent ?? "claude").permissionMode;
7
+ }
8
+ function outboundPermissionMode(agent, mode) {
9
+ const key = index.normalizeAgentKey(agent ?? "claude");
10
+ if ((key === "claude" || key === "pi") && mode === "yolo") return "bypassPermissions";
11
+ return mode;
12
+ }
13
+ function resolveFirstMessageMeta(input) {
14
+ const meta = {
15
+ permissionMode: outboundPermissionMode(input.agent, input.permissionMode)
16
+ };
17
+ if (input.explicitModel !== void 0) {
18
+ meta.model = input.explicitModel === "default" ? null : input.explicitModel;
19
+ }
20
+ if (index.normalizeAgentKey(input.agent ?? "claude") !== "claude") return meta;
21
+ if (meta.model === void 0) {
22
+ const model = index.getAgentCodeDefaults("claude").modelMode;
23
+ const runnable = !index.isClaudeOpus55Model(model) || index.supportsClaudeOpus55({ capabilities: input.capabilities ?? null });
24
+ meta.model = runnable && model !== "default" ? model : null;
25
+ }
26
+ meta.effort = null;
27
+ return meta;
28
+ }
29
+
30
+ const ALLOWED_SPAWN_PERMISSION_MODES = [
31
+ "default",
32
+ "acceptEdits",
33
+ "plan",
34
+ "yolo",
35
+ "bypassPermissions"
36
+ ];
37
+ function sanitizeSpawnPermissionMode(value) {
38
+ if (typeof value !== "string") return null;
39
+ return ALLOWED_SPAWN_PERMISSION_MODES.includes(value) ? value : null;
40
+ }
41
+
42
+ const SPAWN_AGENTS = ["claude", "codex", "gemini", "openclaw", "pi"];
43
+ function isSpawnAgent(value) {
44
+ return typeof value === "string" && SPAWN_AGENTS.includes(value);
45
+ }
46
+
47
+ exports.ALLOWED_SPAWN_PERMISSION_MODES = ALLOWED_SPAWN_PERMISSION_MODES;
48
+ exports.SPAWN_AGENTS = SPAWN_AGENTS;
49
+ exports.isSpawnAgent = isSpawnAgent;
50
+ exports.resolveFirstMessageMeta = resolveFirstMessageMeta;
51
+ exports.resolveSpawnPermissionMode = resolveSpawnPermissionMode;
52
+ exports.sanitizeSpawnPermissionMode = sanitizeSpawnPermissionMode;
@@ -0,0 +1,45 @@
1
+ import { g as getAgentCodeDefaults, n as normalizeAgentKey, h as isClaudeOpus55Model, j as supportsClaudeOpus55 } from './index-qdS1friN.mjs';
2
+
3
+ function resolveSpawnPermissionMode(agent, explicit) {
4
+ return explicit ?? getAgentCodeDefaults(agent ?? "claude").permissionMode;
5
+ }
6
+ function outboundPermissionMode(agent, mode) {
7
+ const key = normalizeAgentKey(agent ?? "claude");
8
+ if ((key === "claude" || key === "pi") && mode === "yolo") return "bypassPermissions";
9
+ return mode;
10
+ }
11
+ function resolveFirstMessageMeta(input) {
12
+ const meta = {
13
+ permissionMode: outboundPermissionMode(input.agent, input.permissionMode)
14
+ };
15
+ if (input.explicitModel !== void 0) {
16
+ meta.model = input.explicitModel === "default" ? null : input.explicitModel;
17
+ }
18
+ if (normalizeAgentKey(input.agent ?? "claude") !== "claude") return meta;
19
+ if (meta.model === void 0) {
20
+ const model = getAgentCodeDefaults("claude").modelMode;
21
+ const runnable = !isClaudeOpus55Model(model) || supportsClaudeOpus55({ capabilities: input.capabilities ?? null });
22
+ meta.model = runnable && model !== "default" ? model : null;
23
+ }
24
+ meta.effort = null;
25
+ return meta;
26
+ }
27
+
28
+ const ALLOWED_SPAWN_PERMISSION_MODES = [
29
+ "default",
30
+ "acceptEdits",
31
+ "plan",
32
+ "yolo",
33
+ "bypassPermissions"
34
+ ];
35
+ function sanitizeSpawnPermissionMode(value) {
36
+ if (typeof value !== "string") return null;
37
+ return ALLOWED_SPAWN_PERMISSION_MODES.includes(value) ? value : null;
38
+ }
39
+
40
+ const SPAWN_AGENTS = ["claude", "codex", "gemini", "openclaw", "pi"];
41
+ function isSpawnAgent(value) {
42
+ return typeof value === "string" && SPAWN_AGENTS.includes(value);
43
+ }
44
+
45
+ export { ALLOWED_SPAWN_PERMISSION_MODES as A, SPAWN_AGENTS as S, resolveFirstMessageMeta as a, isSpawnAgent as i, resolveSpawnPermissionMode as r, sanitizeSpawnPermissionMode as s };
@@ -0,0 +1,64 @@
1
+ import { spawn } from 'cross-spawn';
2
+ import { join } from 'node:path';
3
+ import { p as projectPath } from './projectPath-BTBIMB57.mjs';
4
+ import { l as logger } from './logger-6HYUEXNk.mjs';
5
+ import { existsSync } from 'node:fs';
6
+
7
+ let cachedRuntime = null;
8
+ function getRuntime() {
9
+ if (cachedRuntime) return cachedRuntime;
10
+ if (typeof globalThis.Bun !== "undefined") {
11
+ cachedRuntime = "bun";
12
+ return cachedRuntime;
13
+ }
14
+ if (typeof globalThis.Deno !== "undefined") {
15
+ cachedRuntime = "deno";
16
+ return cachedRuntime;
17
+ }
18
+ if (process?.versions?.bun) {
19
+ cachedRuntime = "bun";
20
+ return cachedRuntime;
21
+ }
22
+ if (process?.versions?.deno) {
23
+ cachedRuntime = "deno";
24
+ return cachedRuntime;
25
+ }
26
+ if (process?.versions?.node) {
27
+ cachedRuntime = "node";
28
+ return cachedRuntime;
29
+ }
30
+ cachedRuntime = "unknown";
31
+ return cachedRuntime;
32
+ }
33
+ const isBun = () => getRuntime() === "bun";
34
+
35
+ function spawnHappyCLI(args, options = {}) {
36
+ const projectRoot = projectPath();
37
+ const entrypoint = join(projectRoot, "dist", "index.mjs");
38
+ let directory;
39
+ if ("cwd" in options) {
40
+ directory = options.cwd;
41
+ } else {
42
+ directory = process.cwd();
43
+ }
44
+ const fullCommand = `happy ${args.join(" ")}`;
45
+ logger.debug(`[SPAWN HAPPY CLI] Spawning: ${fullCommand} in ${directory}`);
46
+ const nodeArgs = [
47
+ "--no-warnings",
48
+ "--no-deprecation",
49
+ entrypoint,
50
+ ...args
51
+ ];
52
+ if (!existsSync(entrypoint)) {
53
+ const errorMessage = `Entrypoint ${entrypoint} does not exist`;
54
+ logger.debug(`[SPAWN HAPPY CLI] ${errorMessage}`);
55
+ throw new Error(errorMessage);
56
+ }
57
+ const runtime = isBun() ? "bun" : "node";
58
+ return spawn(runtime, nodeArgs, {
59
+ windowsHide: true,
60
+ ...options
61
+ });
62
+ }
63
+
64
+ export { spawnHappyCLI as s };