very-happy-cli 0.2.159 → 0.2.161
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.
- package/dist/{AcpBackend-VsfkZiVF.mjs → AcpBackend-6U6pQgx1.mjs} +4 -2
- package/dist/{AcpBackend-DUYFlyfN.cjs → AcpBackend-Ba98QDif.cjs} +78 -76
- package/dist/{AcpSessionManager-Bdv8LWXh.cjs → AcpSessionManager-BAY1Pggx.cjs} +9 -9
- package/dist/{AcpSessionManager-rYtVb0kN.mjs → AcpSessionManager-CoMWFVw3.mjs} +1 -1
- package/dist/BasePermissionHandler-2R0uH2CI.cjs +157 -0
- package/dist/BasePermissionHandler-BvvhBTja.mjs +155 -0
- package/dist/BaseReasoningProcessor-DyhO1uoU.mjs +198 -0
- package/dist/BaseReasoningProcessor-fsVNmCEF.cjs +200 -0
- package/dist/RemoteModeDisplay-D-HewyXg.mjs +150 -0
- package/dist/RemoteModeDisplay-NC1gPHtj.cjs +153 -0
- package/dist/agentAttachments-Dbw8iMCZ.cjs +20 -0
- package/dist/agentAttachments-M_B5qEF2.mjs +18 -0
- package/dist/agentGuidance-B5NATuFa.cjs +28 -0
- package/dist/agentGuidance-CQuNlNx8.mjs +20 -0
- package/dist/{agentHome-CvsJyeQB.mjs → agentHome-Ck1i1TQB.mjs} +8 -22
- package/dist/{agentHome-CHh4lmjM.cjs → agentHome-DvNnGphb.cjs} +14 -28
- package/dist/api-B2vLMS-z.cjs +3346 -0
- package/dist/api-SffjRQ1b.mjs +3339 -0
- package/dist/{types-Dh-s4Lqs.mjs → apiMachine-BpW9t8MO.mjs} +9116 -16205
- package/dist/{types-BbvK1Tr_.cjs → apiMachine-gFA54X7y.cjs} +9104 -16247
- package/dist/assistantTools-BfA0R3_m.cjs +380 -0
- package/dist/assistantTools-CgiTbnWb.mjs +376 -0
- package/dist/attachmentContent-CSGxr71v.mjs +82 -0
- package/dist/attachmentContent-DMMZzevR.cjs +88 -0
- package/dist/attachmentLimits-CzVrqgLR.cjs +354 -0
- package/dist/attachmentLimits-yba1uHFO.mjs +348 -0
- package/dist/auth-Bt4ceBBy.cjs +227 -0
- package/dist/auth-CYHjQ8oQ.mjs +225 -0
- package/dist/auth-DdyVZSo6.mjs +218 -0
- package/dist/auth-x4CEoysH.cjs +220 -0
- package/dist/authRelay-BdYkC1Po.cjs +156 -0
- package/dist/authRelay-DSAvg1uv.mjs +143 -0
- package/dist/{auto-DKmEls8Z.cjs → auto-BDXDUnjB.cjs} +70 -79
- package/dist/{auto-nb8GhRRy.mjs → auto-CXLlRi3a.mjs} +27 -36
- package/dist/backgroundTaskActivity-8PdPxrvy.mjs +149 -0
- package/dist/backgroundTaskActivity-CBvUdj39.cjs +157 -0
- package/dist/bootstrap-BNQq05jR.mjs +112 -0
- package/dist/bootstrap-CkgIq8N3.cjs +116 -0
- package/dist/browser-9pyhQr1R.mjs +20 -0
- package/dist/browser-BDOlKWYe.cjs +22 -0
- package/dist/claudeCliPath-BqkaH2oR.mjs +8 -0
- package/dist/claudeCliPath-U4HHmV4r.cjs +10 -0
- package/dist/claudeLocal-BDuGFnjJ.cjs +343 -0
- package/dist/claudeLocal-CQa8qnwq.mjs +339 -0
- package/dist/claudeLocalLauncher-Bd5I2-j6.cjs +154 -0
- package/dist/claudeLocalLauncher-CDqQI9ak.mjs +152 -0
- package/dist/cliUpdate-DsKXPFYp.cjs +120 -0
- package/dist/cliUpdate-Y34VGe9Y.mjs +112 -0
- package/dist/client-Brn-UwVk.mjs +100 -0
- package/dist/client-CXb1VJui.mjs +112 -0
- package/dist/client-C_axwRry.cjs +104 -0
- package/dist/client-DOBWJL3u.cjs +119 -0
- package/dist/codex/happyMcpStdioBridge.cjs +33 -14
- package/dist/codex/happyMcpStdioBridge.mjs +26 -7
- package/dist/codexAppServerClient-ZzhUTWPo.cjs +1090 -0
- package/dist/codexAppServerClient-oeQKD6Qf.mjs +1088 -0
- package/dist/codexCommand-C7H0NpBe.cjs +2088 -0
- package/dist/codexCommand-CJ82bl3l.mjs +2086 -0
- package/dist/codexThreadFork-BCaEMBiM.mjs +338 -0
- package/dist/codexThreadFork-BZqF-9bX.cjs +350 -0
- package/dist/{config-ClLtM6F3.mjs → config-BglnktIo.mjs} +7 -40
- package/dist/{config-DLx-vW3I.cjs → config-CYpL1Ahd.cjs} +26 -59
- package/dist/configuration-DoWFJUPm.mjs +170 -0
- package/dist/configuration-v9f8LM9T.cjs +181 -0
- package/dist/connect-hgcNjyAB.mjs +682 -0
- package/dist/connect-yEvjdRvx.cjs +684 -0
- package/dist/constants-BC4St0xd.mjs +11 -0
- package/dist/constants-VJ0N6WuG.cjs +17 -0
- package/dist/contentLogMetadata-BlWI0egu.mjs +51 -0
- package/dist/contentLogMetadata-ZSFk_NjQ.cjs +54 -0
- package/dist/context-B45vMtSZ.cjs +69 -0
- package/dist/context-C9GHPLEm.mjs +65 -0
- package/dist/controlClient-DjoKTtgK.mjs +260 -0
- package/dist/controlClient-fEHE85bH.cjs +279 -0
- package/dist/createSessionMetadata-BRLB9CNO.cjs +58 -0
- package/dist/createSessionMetadata-mIeehclp.mjs +54 -0
- package/dist/defaultPermissionMode-BnxJPVHT.mjs +4 -0
- package/dist/defaultPermissionMode-CxmTXUQR.cjs +7 -0
- package/dist/detectCLI-CSGMlV51.mjs +58 -0
- package/dist/detectCLI-DR9ZaN6B.cjs +61 -0
- package/dist/deterministicJson-DKDP_mM-.cjs +507 -0
- package/dist/deterministicJson-p835AdAU.mjs +502 -0
- package/dist/doctor-BPkYWSuq.mjs +75 -0
- package/dist/doctor-BeUuQXFs.mjs +391 -0
- package/dist/doctor-hVNnSZJn.cjs +395 -0
- package/dist/doctor-u46qYYKX.cjs +79 -0
- package/dist/doctorReadiness-BCZGcN0a.cjs +151 -0
- package/dist/doctorReadiness-C208SMN9.mjs +142 -0
- package/dist/editPaths-BVfS_FFL.mjs +68 -0
- package/dist/editPaths-Bqp4OFPw.cjs +73 -0
- package/dist/ensureDaemonRunning-CO7d1gOC.mjs +61 -0
- package/dist/ensureDaemonRunning-Dg9aZfjs.cjs +64 -0
- package/dist/handleResumeCommand-BiTPK0qd.mjs +240 -0
- package/dist/handleResumeCommand-DnVmy7a3.cjs +245 -0
- package/dist/ids-B6ZC0HGt.cjs +13 -0
- package/dist/ids-DU6sLx4C.mjs +10 -0
- package/dist/index-B6UGRQ7h.mjs +102 -0
- package/dist/{index-2mCaeKyf.mjs → index-CAFwetLk.mjs} +68 -38
- package/dist/index-Cqx-Raq6.mjs +68 -0
- package/dist/index-D3kI0hDR.cjs +107 -0
- package/dist/index-DA7yINuk.cjs +994 -0
- package/dist/{index-BEOMECtE.cjs → index-LIn6nCcq.cjs} +121 -91
- package/dist/index-Pf2cV9cn.cjs +182 -0
- package/dist/index-SPGPenK5.mjs +158 -0
- package/dist/index-gNTWtSKN.cjs +71 -0
- package/dist/index-qdS1friN.mjs +949 -0
- package/dist/index.cjs +5 -46
- package/dist/index.mjs +5 -46
- package/dist/{install-BPhJppvd.mjs → install-BO_W7VhL.mjs} +37 -37
- package/dist/install-Bu85vlHD.cjs +88 -0
- package/dist/install-ClUUl3yp.mjs +86 -0
- package/dist/{install-BOHrUaFM.cjs → install-Cs5qAPrB.cjs} +38 -38
- package/dist/{installPiTools-DuZ6jZvX.cjs → installPiTools-BKnXjrVu.cjs} +2 -3
- package/dist/{installPiTools-Cj7yU9Fc.mjs → installPiTools-B_CdM5_2.mjs} +1 -2
- package/dist/{installTerminalHooks-Cou3WUf3.cjs → installTerminalHooks-BQZbvxsZ.cjs} +5 -40
- package/dist/{installTerminalHooks-WeznjkuC.mjs → installTerminalHooks-By7gBMEF.mjs} +3 -38
- package/dist/lib.cjs +28 -19
- package/dist/lib.d.cts +12 -2
- package/dist/lib.d.mts +12 -2
- package/dist/lib.mjs +23 -14
- package/dist/lidState-C2dI0FAN.mjs +297 -0
- package/dist/lidState-KHHu1015.cjs +305 -0
- package/dist/limits-C-a7gr04.cjs +43 -0
- package/dist/limits-DIo7rEBR.mjs +36 -0
- package/dist/localHappyAgentAuth-BXiHPXdC.cjs +86 -0
- package/dist/localHappyAgentAuth-DCsetiyG.mjs +82 -0
- package/dist/logger-Bc8-u1w0.cjs +275 -0
- package/dist/logger-fXoNzNuB.mjs +271 -0
- package/dist/loginShellEnv-BkuYtExZ.cjs +182 -0
- package/dist/loginShellEnv-Dw8M7tkI.mjs +167 -0
- package/dist/machineMetadata-BHjehxJY.mjs +38 -0
- package/dist/machineMetadata-BibDMFVx.cjs +41 -0
- package/dist/main-BktM4A1K.mjs +939 -0
- package/dist/main-CLaX-t-b.cjs +941 -0
- package/dist/manager-BQ4flvQZ.mjs +101 -0
- package/dist/manager-Cly8xVIR.cjs +105 -0
- package/dist/{mcp-Dy3f_K0h.mjs → mcp-CeUd9KDr.mjs} +27 -33
- package/dist/{mcp-CPYbtsYG.cjs → mcp-GBfE70nk.cjs} +42 -48
- package/dist/messageBuffer-BWlGgR3A.mjs +71 -0
- package/dist/messageBuffer-fJMH6uY8.cjs +73 -0
- package/dist/mirrorProtocol-BNLtoWjO.mjs +170 -0
- package/dist/mirrorProtocol-BUtmg1ws.cjs +186 -0
- package/dist/oneShotPrompts-CL0dip9C.cjs +16 -0
- package/dist/oneShotPrompts-DT4p6RNd.mjs +12 -0
- package/dist/package-Cl5BEP5x.cjs +173 -0
- package/dist/package-uOg9SCKi.mjs +171 -0
- package/dist/path-B7zW-WwE.cjs +18 -0
- package/dist/path-D2wdaNSk.mjs +15 -0
- package/dist/peerTools-CIeiy9wn.cjs +283 -0
- package/dist/peerTools-Dz3_7Bkk.mjs +272 -0
- package/dist/permissionMode-CH4FoZfU.mjs +80 -0
- package/dist/permissionMode-CrV-XuMs.cjs +87 -0
- package/dist/persistence-CBNMzSa8.cjs +414 -0
- package/dist/persistence-oET5n61f.mjs +372 -0
- package/dist/piExtension.mjs +2 -1
- package/dist/piRunnerArgs-Bf7RUF__.cjs +66 -0
- package/dist/piRunnerArgs-Dk1ncwHF.mjs +59 -0
- package/dist/{piRuntime-NtF0YqjH.cjs → piRuntime-B_6TE9Eb.cjs} +4 -4
- package/dist/{piRuntime-kLZNpAAl.mjs → piRuntime-BwRdhK_N.mjs} +2 -2
- package/dist/{piTerminal-B0fEOV_2.mjs → piTerminal-Bap3R8Re.mjs} +32 -35
- package/dist/{piTerminal-9J0GAKzb.cjs → piTerminal-CagmEoez.cjs} +32 -35
- package/dist/previewPath-B0rBdhy1.cjs +83 -0
- package/dist/previewPath-CXN4Vag0.mjs +81 -0
- package/dist/projectPath-BTBIMB57.mjs +10 -0
- package/dist/projectPath-ChLhdOyt.cjs +13 -0
- package/dist/registerCommonHandlers-BjSV2Skz.cjs +538 -0
- package/dist/registerCommonHandlers-CrgvJsOy.mjs +536 -0
- package/dist/registerKillSessionHandler-6TC2S3lf.cjs +366 -0
- package/dist/registerKillSessionHandler-Cbc8Rgtd.mjs +363 -0
- package/dist/remoteSessionClient-BNx78NLb.cjs +634 -0
- package/dist/remoteSessionClient-CO7qOjR0.mjs +612 -0
- package/dist/resources-BdFBQi8r.mjs +117 -0
- package/dist/resources-JDPugcDq.cjs +120 -0
- package/dist/run-2l5vSt2h.mjs +5743 -0
- package/dist/run-D5xAEWSB.cjs +5766 -0
- package/dist/runClaude-BX6ixjtW.cjs +894 -0
- package/dist/runClaude-BgN6xo05.mjs +892 -0
- package/dist/runClaudeDeps-Bp20MScE.cjs +4168 -0
- package/dist/runClaudeDeps-COBBhD9o.mjs +4129 -0
- package/dist/{runGemini-F-mqx3_K.cjs → runGemini-CSMPkt0p.cjs} +202 -175
- package/dist/{runGemini-DV6Ouadt.mjs → runGemini-Cc2jq-uh.mjs} +58 -31
- package/dist/{runOpenClaw-D7MlPS5n.mjs → runOpenClaw-CIlCwdW2.mjs} +31 -32
- package/dist/{runOpenClaw-Qqo9j63M.cjs → runOpenClaw-YBwua4Rf.cjs} +64 -65
- package/dist/sandbox-C4gXLP1p.cjs +187 -0
- package/dist/sandbox-CNkwOtHI.mjs +180 -0
- package/dist/selfCheck-CU8xSDsl.cjs +87 -0
- package/dist/selfCheck-hJ6PCh7v.mjs +84 -0
- package/dist/{send-CLhYXNgy.mjs → send-CGHcKZ-w.mjs} +12 -5
- package/dist/{send-4qJTCAYW.cjs → send-DY9Nr-x4.cjs} +16 -9
- package/dist/server-II51Mimf.cjs +407 -0
- package/dist/server-m2b5pamZ.mjs +404 -0
- package/dist/sessionLock-7ePAYDOg.cjs +205 -0
- package/dist/sessionLock-Cw6FmbMv.mjs +197 -0
- package/dist/sessionModeFile-BVCV5f7E.cjs +36 -0
- package/dist/sessionModeFile-CDmDyRkD.mjs +32 -0
- package/dist/sessionOps-C_f1wKOr.mjs +760 -0
- package/dist/sessionOps-DJdExmBy.cjs +783 -0
- package/dist/sessionScanner-CaAHLyNV.mjs +206 -0
- package/dist/sessionScanner-D1goKdd3.cjs +209 -0
- package/dist/{sessions-Bh1pyddi.cjs → sessions-DGs6ALNo.cjs} +37 -28
- package/dist/{sessions-CzIH2rGp.mjs → sessions-DnvmWUel.mjs} +17 -8
- package/dist/setupOfflineReconnection-CVViqZft.mjs +72 -0
- package/dist/setupOfflineReconnection-R7XuR_sj.cjs +74 -0
- package/dist/smallFastModel-BLNgMrwR.mjs +18 -0
- package/dist/smallFastModel-D_uxGMo3.cjs +21 -0
- package/dist/{spawn-CmFOSVdW.cjs → spawn-CXTH7qg1.cjs} +61 -65
- package/dist/{spawn-CPIWlPOM.mjs → spawn-DNYSvFtC.mjs} +35 -40
- package/dist/spawnAgents-BGQiEF-w.cjs +52 -0
- package/dist/spawnAgents-DZzZ9jMI.mjs +45 -0
- package/dist/spawnHappyCLI-BhYj84rv.cjs +66 -0
- package/dist/spawnHappyCLI-cqWQbwsb.mjs +64 -0
- package/dist/specialCommands-BSqhYg5X.mjs +52 -0
- package/dist/specialCommands-DSsTeRej.cjs +54 -0
- package/dist/startFileWatcher-CKKx-8ZO.cjs +71 -0
- package/dist/startFileWatcher-CdegMbJj.mjs +69 -0
- package/dist/startupPlan-BLMbfQIH.cjs +12 -0
- package/dist/startupPlan-DFMyNgAs.mjs +10 -0
- package/dist/streamRelay-BiKw59Cc.cjs +233 -0
- package/dist/streamRelay-FPVbHpbM.mjs +231 -0
- package/dist/sync-CVk4QERO.cjs +71 -0
- package/dist/sync-CxD-w_40.mjs +69 -0
- package/dist/systemPrompt-BygJcmbi.cjs +97 -0
- package/dist/systemPrompt-DmtypUc7.mjs +94 -0
- package/dist/{teams-CEahj4cm.mjs → teams-BOC6nIPL.mjs} +9 -40
- package/dist/{teams-CB1R9-Z9.cjs → teams-BsvpOBfn.cjs} +14 -45
- package/dist/template-BaHAmH2K.cjs +129 -0
- package/dist/template-CiOPa2rd.mjs +121 -0
- package/dist/{terminalTitleSuggest-DKgX3osW.mjs → terminalTitleSuggest-CeKsX_V6.mjs} +1 -9
- package/dist/{terminalTitleSuggest-Dji8I0Jy.cjs → terminalTitleSuggest-DhvRFX3H.cjs} +0 -10
- package/dist/terminals-B_bfC9c2.cjs +250 -0
- package/dist/terminals-Dlg0x3nY.mjs +235 -0
- package/dist/time-BZNdNiIV.mjs +38 -0
- package/dist/time-CNRE4ChD.cjs +42 -0
- package/dist/titleGenerator-CFRhU-xq.cjs +172 -0
- package/dist/titleGenerator-ox6ptCsp.mjs +166 -0
- package/dist/tmuxSocket-B8Yx20sT.mjs +19 -0
- package/dist/tmuxSocket-D-Xt6Vn-.cjs +24 -0
- package/dist/{todo-DqyRI4wP.cjs → todo-B-KB7oAB.cjs} +15 -12
- package/dist/{todo-Cknp5D4U.mjs → todo-C5KBVbUw.mjs} +11 -8
- package/dist/tools-BZabNIid.mjs +177 -0
- package/dist/tools-BmQQUATY.mjs +60 -0
- package/dist/tools-CsSovyNp.cjs +180 -0
- package/dist/tools-lMDra4Pv.cjs +63 -0
- package/dist/trimIdent-4gvk9Wk6.cjs +22 -0
- package/dist/trimIdent-BAjmv_TG.mjs +20 -0
- package/dist/types-CRS-srZK.cjs +66 -0
- package/dist/types-CkqAACXx.mjs +64 -0
- package/dist/uninstall-B1WLtC1d.mjs +47 -0
- package/dist/uninstall-fvA5aWpU.cjs +49 -0
- package/package.json +7 -7
- package/scripts/session_hook_forwarder.cjs +9 -2
- package/dist/agentGuidance-BRDN1NoZ.cjs +0 -2217
- package/dist/agentGuidance-KgvYuF3R.mjs +0 -2145
- package/dist/index-BF6WfgV5.mjs +0 -19624
- package/dist/index-C-JazrMB.mjs +0 -52
- package/dist/index-blDSadUR.cjs +0 -58
- package/dist/index-rH3DrQ5B.cjs +0 -19688
- package/dist/limits-BH5CV5vR.cjs +0 -2683
- package/dist/limits-CjRj8IX5.mjs +0 -2558
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { c as configuration } from './configuration-DoWFJUPm.mjs';
|
|
2
|
+
import { s as startOfflineReconnection } from './api-SffjRQ1b.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,74 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var configuration = require('./configuration-v9f8LM9T.cjs');
|
|
4
|
+
var api = require('./api-B2vLMS-z.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,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;
|
|
@@ -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
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
require('
|
|
11
|
-
require('
|
|
5
|
+
var path$1 = require('node:path');
|
|
6
|
+
var controlClient = require('./controlClient-fEHE85bH.cjs');
|
|
7
|
+
var persistence = require('./persistence-CBNMzSa8.cjs');
|
|
8
|
+
var spawnAgents = require('./spawnAgents-BGQiEF-w.cjs');
|
|
9
|
+
var path = require('./path-B7zW-WwE.cjs');
|
|
10
|
+
var codexThreadFork = require('./codexThreadFork-BZqF-9bX.cjs');
|
|
11
|
+
var codexAppServerClient = require('./codexAppServerClient-ZzhUTWPo.cjs');
|
|
12
|
+
var sessionOps = require('./sessionOps-DJdExmBy.cjs');
|
|
13
|
+
var createSessionMetadata = require('./createSessionMetadata-BRLB9CNO.cjs');
|
|
14
|
+
var logger = require('./logger-Bc8-u1w0.cjs');
|
|
15
|
+
require('./configuration-v9f8LM9T.cjs');
|
|
16
|
+
require('node:os');
|
|
17
|
+
require('./package-Cl5BEP5x.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('
|
|
17
|
-
require('
|
|
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('
|
|
28
|
+
require('cross-spawn');
|
|
29
|
+
require('./contentLogMetadata-ZSFk_NjQ.cjs');
|
|
30
|
+
require('./manager-Cly8xVIR.cjs');
|
|
33
31
|
require('@anthropic-ai/sandbox-runtime');
|
|
34
|
-
require('
|
|
35
|
-
require('
|
|
36
|
-
require('
|
|
37
|
-
require('
|
|
38
|
-
require('
|
|
39
|
-
require('
|
|
40
|
-
require('
|
|
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-CNRE4ChD.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,22 +61,25 @@ function resolveForkSource(sessionId, persisted) {
|
|
|
73
61
|
async function forkProviderConversation(source) {
|
|
74
62
|
if (source.agent === "claude") {
|
|
75
63
|
try {
|
|
76
|
-
return { resumeClaudeSessionId: await
|
|
64
|
+
return { resumeClaudeSessionId: await codexThreadFork.forkSession(path.getProjectPath(source.directory), source.claudeSessionId) };
|
|
77
65
|
} catch (error) {
|
|
78
|
-
if (error instanceof
|
|
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
|
|
70
|
+
const client = new codexAppServerClient.CodexAppServerClient();
|
|
83
71
|
await client.connect();
|
|
84
72
|
try {
|
|
85
|
-
const result = await
|
|
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();
|
|
89
77
|
}
|
|
90
78
|
}
|
|
91
79
|
|
|
80
|
+
function spawnEnvironmentVariables(env, hasPrompt) {
|
|
81
|
+
return hasPrompt ? { ...env, HAPPY_FIRST_MESSAGE_FROM_CLI: "1" } : env;
|
|
82
|
+
}
|
|
92
83
|
function parseEnvAssignment(raw) {
|
|
93
84
|
const eq = raw.indexOf("=");
|
|
94
85
|
if (eq <= 0) throw new Error(`--env expects KEY=VALUE, got: ${raw}`);
|
|
@@ -115,22 +106,22 @@ function parseSpawnArgs(args) {
|
|
|
115
106
|
} else if (arg === "--spawned-by") {
|
|
116
107
|
const value = args[++i];
|
|
117
108
|
if (value === void 0) throw new Error("--spawned-by requires a value");
|
|
118
|
-
if (!
|
|
109
|
+
if (!createSessionMetadata.isValidSpawnOrigin(value)) {
|
|
119
110
|
throw new Error("--spawned-by must be 1-24 chars of [a-z0-9] plus - or _, starting with a letter or digit");
|
|
120
111
|
}
|
|
121
112
|
options.spawnedBy = value;
|
|
122
113
|
} else if (arg === "--permission-mode") {
|
|
123
114
|
const value = args[++i];
|
|
124
115
|
if (value === void 0) throw new Error("--permission-mode requires a value");
|
|
125
|
-
if (
|
|
126
|
-
throw new Error(`--permission-mode must be one of: ${
|
|
116
|
+
if (spawnAgents.sanitizeSpawnPermissionMode(value) === null) {
|
|
117
|
+
throw new Error(`--permission-mode must be one of: ${spawnAgents.ALLOWED_SPAWN_PERMISSION_MODES.join(", ")}`);
|
|
127
118
|
}
|
|
128
119
|
options.permissionMode = value;
|
|
129
120
|
} else if (arg === "--agent") {
|
|
130
121
|
const value = args[++i];
|
|
131
122
|
if (value === void 0) throw new Error("--agent requires a value");
|
|
132
|
-
if (!
|
|
133
|
-
throw new Error(`--agent must be one of: ${
|
|
123
|
+
if (!spawnAgents.SPAWN_AGENTS.includes(value)) {
|
|
124
|
+
throw new Error(`--agent must be one of: ${spawnAgents.SPAWN_AGENTS.join(", ")}`);
|
|
134
125
|
}
|
|
135
126
|
options.agent = value;
|
|
136
127
|
} else if (arg === "--env") {
|
|
@@ -216,9 +207,9 @@ ${chalk.bold("Exit codes:")}
|
|
|
216
207
|
`);
|
|
217
208
|
}
|
|
218
209
|
async function sendFirstMessage(sessionId, text, metaFor) {
|
|
219
|
-
const persisted = await
|
|
210
|
+
const persisted = await sessionOps.waitForSessionKey(sessionId, 15e3);
|
|
220
211
|
const meta = metaFor(persisted.metadata?.capabilities ?? null);
|
|
221
|
-
await
|
|
212
|
+
await sessionOps.sendUserMessage(sessionId, persisted, text, "cli-spawn", meta);
|
|
222
213
|
return meta;
|
|
223
214
|
}
|
|
224
215
|
async function handleSpawnCommand(args) {
|
|
@@ -238,14 +229,14 @@ async function handleSpawnCommand(args) {
|
|
|
238
229
|
if (options.fork !== void 0) {
|
|
239
230
|
try {
|
|
240
231
|
const persisted = persistence.readPersistedSessions()[options.fork];
|
|
241
|
-
const current = persisted ? await
|
|
232
|
+
const current = persisted ? await sessionOps.readSessionMetadata(options.fork, persisted) : null;
|
|
242
233
|
forkSource = resolveForkSource(options.fork, persisted && current ? { ...persisted, metadata: { ...persisted.metadata, ...current } } : persisted);
|
|
243
234
|
} catch (error) {
|
|
244
235
|
console.error(chalk.red("Error:"), error instanceof Error ? error.message : String(error));
|
|
245
236
|
process.exit(1);
|
|
246
237
|
}
|
|
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.`);
|
|
238
|
+
if (options.dir !== void 0 && path$1.resolve(options.dir) !== forkSource.directory) {
|
|
239
|
+
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
240
|
process.exit(1);
|
|
250
241
|
}
|
|
251
242
|
if (options.agent !== void 0 && options.agent !== forkSource.agent) {
|
|
@@ -257,13 +248,13 @@ async function handleSpawnCommand(args) {
|
|
|
257
248
|
console.error(`Run ${chalk.cyan("very-happy spawn --help")} for usage.`);
|
|
258
249
|
process.exit(1);
|
|
259
250
|
}
|
|
260
|
-
const directory = forkSource ? forkSource.directory : path.resolve(options.dir);
|
|
251
|
+
const directory = forkSource ? forkSource.directory : path$1.resolve(options.dir);
|
|
261
252
|
const agent = forkSource ? forkSource.agent : options.agent;
|
|
262
|
-
const permissionMode = options.permissionMode ?? forkSource?.permissionMode ??
|
|
253
|
+
const permissionMode = options.permissionMode ?? forkSource?.permissionMode ?? spawnAgents.resolveSpawnPermissionMode(agent, void 0);
|
|
263
254
|
let prompt = options.prompt;
|
|
264
255
|
if (options.promptFile !== void 0) {
|
|
265
256
|
try {
|
|
266
|
-
prompt = node_fs.readFileSync(path.resolve(options.promptFile), "utf8");
|
|
257
|
+
prompt = node_fs.readFileSync(path$1.resolve(options.promptFile), "utf8");
|
|
267
258
|
} catch (error) {
|
|
268
259
|
console.error(chalk.red("Error:"), `Failed to read --prompt-file: ${error instanceof Error ? error.message : String(error)}`);
|
|
269
260
|
process.exit(1);
|
|
@@ -286,7 +277,7 @@ async function handleSpawnCommand(args) {
|
|
|
286
277
|
console.error(chalk.red("Error:"), `Directory does not exist: ${directory}`);
|
|
287
278
|
process.exit(1);
|
|
288
279
|
}
|
|
289
|
-
if (!await
|
|
280
|
+
if (!await controlClient.checkIfDaemonRunningAndCleanupStaleState()) {
|
|
290
281
|
console.error(chalk.red("Error:"), "Happy daemon is not running on this machine.");
|
|
291
282
|
console.error(`Start it with ${chalk.cyan("very-happy daemon start")} and retry.`);
|
|
292
283
|
process.exit(1);
|
|
@@ -300,12 +291,16 @@ async function handleSpawnCommand(args) {
|
|
|
300
291
|
process.exit(1);
|
|
301
292
|
}
|
|
302
293
|
}
|
|
303
|
-
|
|
304
|
-
const result = await
|
|
294
|
+
logger.logger.debug(`[SPAWN CMD] Spawning session in ${directory}${forkSource ? ` (fork of ${forkSource.parentSessionId})` : ""}`);
|
|
295
|
+
const result = await controlClient.spawnDaemonSession(directory, void 0, {
|
|
305
296
|
spawnedBy: options.spawnedBy,
|
|
306
297
|
permissionMode,
|
|
307
298
|
agent,
|
|
308
|
-
|
|
299
|
+
// B-515: the first message is this CLI's --prompt, not a web message —
|
|
300
|
+
// tell the wrapper not to prewarm a Claude process for a web prediction
|
|
301
|
+
// (read and removed from its env at startup; an old daemon passes it
|
|
302
|
+
// through, an old wrapper ignores it).
|
|
303
|
+
environmentVariables: spawnEnvironmentVariables(options.env, prompt !== void 0),
|
|
309
304
|
...resumeIds,
|
|
310
305
|
...forkSource ? { parentSessionId: forkSource.parentSessionId } : {}
|
|
311
306
|
});
|
|
@@ -315,9 +310,9 @@ async function handleSpawnCommand(args) {
|
|
|
315
310
|
process.exit(1);
|
|
316
311
|
}
|
|
317
312
|
const sessionId = result.sessionId;
|
|
318
|
-
const url =
|
|
313
|
+
const url = sessionOps.sessionWebUrl(sessionId);
|
|
319
314
|
if (forkSource && result.resumed !== true) {
|
|
320
|
-
await
|
|
315
|
+
await controlClient.stopDaemonSession(sessionId).catch(() => false);
|
|
321
316
|
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
317
|
process.exit(1);
|
|
323
318
|
}
|
|
@@ -325,7 +320,7 @@ async function handleSpawnCommand(args) {
|
|
|
325
320
|
let sentMeta = null;
|
|
326
321
|
if (prompt !== void 0) {
|
|
327
322
|
try {
|
|
328
|
-
sentMeta = await sendFirstMessage(sessionId, prompt, (capabilities) =>
|
|
323
|
+
sentMeta = await sendFirstMessage(sessionId, prompt, (capabilities) => spawnAgents.resolveFirstMessageMeta({
|
|
329
324
|
agent,
|
|
330
325
|
permissionMode,
|
|
331
326
|
explicitModel: options.model,
|
|
@@ -371,8 +366,9 @@ async function handleSpawnCommand(args) {
|
|
|
371
366
|
process.exit(0);
|
|
372
367
|
}
|
|
373
368
|
|
|
374
|
-
exports.SPAWN_AGENTS =
|
|
375
|
-
exports.sessionWebUrl =
|
|
369
|
+
exports.SPAWN_AGENTS = spawnAgents.SPAWN_AGENTS;
|
|
370
|
+
exports.sessionWebUrl = sessionOps.sessionWebUrl;
|
|
376
371
|
exports.handleSpawnCommand = handleSpawnCommand;
|
|
377
372
|
exports.parseEnvAssignment = parseEnvAssignment;
|
|
378
373
|
exports.parseSpawnArgs = parseSpawnArgs;
|
|
374
|
+
exports.spawnEnvironmentVariables = spawnEnvironmentVariables;
|
|
@@ -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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import '
|
|
9
|
-
import '
|
|
4
|
+
import { c as checkIfDaemonRunningAndCleanupStaleState, e as spawnDaemonSession, s as stopDaemonSession } from './controlClient-DjoKTtgK.mjs';
|
|
5
|
+
import { readPersistedSessions } from './persistence-oET5n61f.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-BCaEMBiM.mjs';
|
|
9
|
+
import { C as CodexAppServerClient } from './codexAppServerClient-oeQKD6Qf.mjs';
|
|
10
|
+
import { e as readSessionMetadata, s as sessionWebUrl, f as waitForSessionKey, g as sendUserMessage } from './sessionOps-C_f1wKOr.mjs';
|
|
11
|
+
import { i as isValidSpawnOrigin } from './createSessionMetadata-mIeehclp.mjs';
|
|
12
|
+
import { l as logger } from './logger-fXoNzNuB.mjs';
|
|
13
|
+
import './configuration-DoWFJUPm.mjs';
|
|
14
|
+
import 'node:os';
|
|
15
|
+
import './package-uOg9SCKi.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 '
|
|
15
|
-
import '
|
|
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 '
|
|
26
|
+
import 'cross-spawn';
|
|
27
|
+
import './contentLogMetadata-BlWI0egu.mjs';
|
|
28
|
+
import './manager-BQ4flvQZ.mjs';
|
|
31
29
|
import '@anthropic-ai/sandbox-runtime';
|
|
32
|
-
import '
|
|
33
|
-
import '
|
|
34
|
-
import '
|
|
35
|
-
import '
|
|
36
|
-
import '
|
|
37
|
-
import '
|
|
38
|
-
import '
|
|
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-BZNdNiIV.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;
|
|
@@ -87,6 +75,9 @@ async function forkProviderConversation(source) {
|
|
|
87
75
|
}
|
|
88
76
|
}
|
|
89
77
|
|
|
78
|
+
function spawnEnvironmentVariables(env, hasPrompt) {
|
|
79
|
+
return hasPrompt ? { ...env, HAPPY_FIRST_MESSAGE_FROM_CLI: "1" } : env;
|
|
80
|
+
}
|
|
90
81
|
function parseEnvAssignment(raw) {
|
|
91
82
|
const eq = raw.indexOf("=");
|
|
92
83
|
if (eq <= 0) throw new Error(`--env expects KEY=VALUE, got: ${raw}`);
|
|
@@ -303,7 +294,11 @@ async function handleSpawnCommand(args) {
|
|
|
303
294
|
spawnedBy: options.spawnedBy,
|
|
304
295
|
permissionMode,
|
|
305
296
|
agent,
|
|
306
|
-
|
|
297
|
+
// B-515: the first message is this CLI's --prompt, not a web message —
|
|
298
|
+
// tell the wrapper not to prewarm a Claude process for a web prediction
|
|
299
|
+
// (read and removed from its env at startup; an old daemon passes it
|
|
300
|
+
// through, an old wrapper ignores it).
|
|
301
|
+
environmentVariables: spawnEnvironmentVariables(options.env, prompt !== void 0),
|
|
307
302
|
...resumeIds,
|
|
308
303
|
...forkSource ? { parentSessionId: forkSource.parentSessionId } : {}
|
|
309
304
|
});
|
|
@@ -369,4 +364,4 @@ async function handleSpawnCommand(args) {
|
|
|
369
364
|
process.exit(0);
|
|
370
365
|
}
|
|
371
366
|
|
|
372
|
-
export { SPAWN_AGENTS, handleSpawnCommand, parseEnvAssignment, parseSpawnArgs, sessionWebUrl };
|
|
367
|
+
export { SPAWN_AGENTS, handleSpawnCommand, parseEnvAssignment, parseSpawnArgs, sessionWebUrl, spawnEnvironmentVariables };
|
|
@@ -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 };
|