very-happy-cli 0.2.173 → 0.2.175
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-DG5AHZXF.mjs → AcpBackend-BZrLVcHb.mjs} +3 -3
- package/dist/{AcpBackend-ByLLiXvl.cjs → AcpBackend-Sb6N_HcB.cjs} +3 -3
- package/dist/{AcpSessionManager-Zf00QnlL.cjs → AcpSessionManager-C2MqOirs.cjs} +1 -1
- package/dist/{AcpSessionManager-B7FIrsys.mjs → AcpSessionManager-y1Iy1mzc.mjs} +1 -1
- package/dist/{BasePermissionHandler-kD4FK-7K.cjs → BasePermissionHandler-BbLYwd13.cjs} +1 -1
- package/dist/{BasePermissionHandler-CgPa--v2.mjs → BasePermissionHandler-DriZLITp.mjs} +1 -1
- package/dist/{BaseReasoningProcessor-Cnmvd83F.mjs → BaseReasoningProcessor-DnykPlPo.mjs} +1 -1
- package/dist/{BaseReasoningProcessor-CeMRo-8g.cjs → BaseReasoningProcessor-_S1PbSvH.cjs} +1 -1
- package/dist/{agentHome-DVLed_WJ.cjs → agentHome-BoYfpemd.cjs} +4 -4
- package/dist/{agentHome-b9H3fCBZ.mjs → agentHome-BtuRubHG.mjs} +4 -4
- package/dist/{api-DDz_YyoH.mjs → api-D08IEaWa.mjs} +10 -10
- package/dist/{api-BBoamFqd.cjs → api-KZmVqSKO.cjs} +10 -10
- package/dist/{apiMachine-DqQ8WeIe.mjs → apiMachine-Cx9Zn-78.mjs} +14 -14
- package/dist/{apiMachine-DRxPV0j2.cjs → apiMachine-Dct2GDAq.cjs} +14 -14
- package/dist/{attachmentContent-CmR86NxQ.cjs → attachmentContent-4L9dO8E3.cjs} +2 -2
- package/dist/{attachmentContent-DNsACM9b.mjs → attachmentContent-PrNJg8gG.mjs} +2 -2
- package/dist/{attachmentLimits-CxG3T18E.mjs → attachmentLimits-BLbji11b.mjs} +1 -1
- package/dist/{attachmentLimits-BEYEEBm8.cjs → attachmentLimits-D6bT2jU1.cjs} +1 -1
- package/dist/{auth-3UXAs__6.cjs → auth-BGmM3Vlm.cjs} +5 -5
- package/dist/{auth-BF8QvXR1.cjs → auth-BI0CsMcy.cjs} +8 -8
- package/dist/{auth-DvB0u-4H.mjs → auth-D1qHU-i_.mjs} +5 -5
- package/dist/{auth-BVqHWH_r.mjs → auth-PY_HGlzz.mjs} +8 -8
- package/dist/{auto-D0Ai-s17.mjs → auto-COMphIfD.mjs} +15 -15
- package/dist/{auto-D3PSMTni.cjs → auto-DM4_FeKb.cjs} +15 -15
- package/dist/{bootstrap-Cg_t3W-0.mjs → bootstrap-CWjpC5-J.mjs} +2 -2
- package/dist/{bootstrap-BsXIVhrG.cjs → bootstrap-DTJ6-vYT.cjs} +2 -2
- package/dist/{browser-Cbyo0qny.cjs → browser-DmgVoopB.cjs} +1 -1
- package/dist/{browser-f6xCPkkN.mjs → browser-xuW4fiHo.mjs} +1 -1
- package/dist/{claudeLocal-DqJUowRE.mjs → claudeLocal-B0P-wVJJ.mjs} +5 -5
- package/dist/{claudeLocal-AByQMi4D.cjs → claudeLocal-CtZVz3ee.cjs} +5 -5
- package/dist/{claudeLocalLauncher-BFxrneBS.mjs → claudeLocalLauncher-D4vmjI3c.mjs} +10 -10
- package/dist/{claudeLocalLauncher-CSnWv8cG.cjs → claudeLocalLauncher-Dnv4CH8r.cjs} +10 -10
- package/dist/{claudeSessionFork-DsmA1Jv6.mjs → claudeSessionFork-CxjOBoBh.mjs} +1 -1
- package/dist/{claudeSessionFork-DEuvbqD3.cjs → claudeSessionFork-DQk5-dzR.cjs} +1 -1
- package/dist/{client-CuadUoga.cjs → client-BHZVyQwi.cjs} +3 -3
- package/dist/{client-W3gPBBN2.cjs → client-BhLhjj_x.cjs} +2 -2
- package/dist/{client-CzNWPOBI.mjs → client-C4ddTzrD.mjs} +2 -2
- package/dist/{client-mnqGeUey.mjs → client-eQjOvC55.mjs} +3 -3
- package/dist/codex/happyMcpStdioBridge.cjs +15 -15
- package/dist/codex/happyMcpStdioBridge.mjs +15 -15
- package/dist/{codexAppServerClient-BCAPEmbn.mjs → codexAppServerClient-CppPl_R6.mjs} +205 -28
- package/dist/{codexAppServerClient-BgNcgkVT.cjs → codexAppServerClient-D-9z-lWP.cjs} +205 -28
- package/dist/{codexCommand-B-xQ7uoD.cjs → codexCommand-AgVJYnFU.cjs} +87 -45
- package/dist/{codexCommand-3ZsmFNCE.mjs → codexCommand-BdrBNbZu.mjs} +87 -45
- package/dist/{config-q8FBDbqS.mjs → config-Cr3VUzbE.mjs} +3 -3
- package/dist/{config-CJTzYT71.cjs → config-D89sE3wK.cjs} +3 -3
- package/dist/{configuration-2Eck1oZf.mjs → configuration-BNGPXg07.mjs} +1 -1
- package/dist/{configuration-C_-2io9T.cjs → configuration-UV4EE5ui.cjs} +1 -1
- package/dist/{connect-ch6-M_fR.cjs → connect-B35YXbdZ.cjs} +13 -13
- package/dist/{connect-CJc2q7Zb.mjs → connect-C0iLkCiY.mjs} +13 -13
- package/dist/{context--xjJuO00.cjs → context-BmH2BKip.cjs} +1 -1
- package/dist/{context-C1tA72Pn.mjs → context-Ptdnlcv6.mjs} +1 -1
- package/dist/{controlClient-DCH7YKU2.cjs → controlClient-CtsQMw--.cjs} +3 -3
- package/dist/{controlClient-Dn0x8DWU.mjs → controlClient-DqtC0pq1.mjs} +3 -3
- package/dist/{createSessionMetadata-BeY_Ct51.cjs → createSessionMetadata-2IuH5nlA.cjs} +2 -2
- package/dist/{createSessionMetadata-IMDmdFLj.mjs → createSessionMetadata-CtNMvfth.mjs} +2 -2
- package/dist/{defaultPermissionMode-CP-RNe7S.cjs → defaultPermissionMode-Bn4HcU8S.cjs} +2 -2
- package/dist/{defaultPermissionMode-C7be9Tg9.mjs → defaultPermissionMode-DYihjV2g.mjs} +2 -2
- package/dist/{deterministicJson-Cun6TLIF.mjs → deterministicJson-DF4xv6MH.mjs} +9 -9
- package/dist/{deterministicJson-3OOoCWI0.cjs → deterministicJson-je21npNx.cjs} +9 -9
- package/dist/{doctor-DE9dpmhV.cjs → doctor-BXKcYVGU.cjs} +7 -7
- package/dist/{doctor-B3krtkx6.mjs → doctor-Ba92L7-b.mjs} +7 -7
- package/dist/{downloadTarget-BBAA6-Wy.mjs → downloadTarget-CUJg8iJV.mjs} +6 -6
- package/dist/{downloadTarget-nKU9KvK-.cjs → downloadTarget-JC7FZl7W.cjs} +6 -6
- package/dist/{ensureDaemonRunning-bshCT05q.mjs → ensureDaemonRunning-JPA9tHNE.mjs} +5 -5
- package/dist/{ensureDaemonRunning-D3F9Wn4o.cjs → ensureDaemonRunning-bIp6-vgi.cjs} +5 -5
- package/dist/{handleResumeCommand-DSYAc7pz.cjs → handleResumeCommand-B6b9kIYf.cjs} +5 -5
- package/dist/{handleResumeCommand-DqQ2rB_w.mjs → handleResumeCommand-B6lE5DtU.mjs} +5 -5
- package/dist/{index-BzM5uj8R.cjs → index-B1ABQRrB.cjs} +4 -4
- package/dist/{index-DzqTd9GX.cjs → index-B2KL0aPc.cjs} +36 -36
- package/dist/{index-C9hI8a10.cjs → index-BZdhwBKa.cjs} +3 -1
- package/dist/{index-C7IYgnoC.mjs → index-CZLwo1FS.mjs} +3 -3
- package/dist/{index-CLTdBqtl.mjs → index-CjE4kBKx.mjs} +37 -37
- package/dist/{index-I6GVU3_G.cjs → index-D759ViMU.cjs} +3 -3
- package/dist/{index-DtDYoGpm.mjs → index-DW1ONaGc.mjs} +4 -4
- package/dist/{index-B0HEEYGh.mjs → index-boE-d8CM.mjs} +3 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{install-BFd6bwk2.mjs → install-CmojqnLK.mjs} +3 -3
- package/dist/{install-D8XM9y0N.cjs → install-KjIsK_EA.cjs} +3 -3
- package/dist/lib.cjs +12 -12
- package/dist/lib.mjs +12 -12
- package/dist/{lidState-hKB4aKcf.cjs → lidState-BmJp2pLt.cjs} +1 -1
- package/dist/{lidState-B1KB4bLv.mjs → lidState-CL1NdKfQ.mjs} +1 -1
- package/dist/{localHappyAgentAuth-B_ItamJZ.cjs → localHappyAgentAuth-9SP7hdiw.cjs} +1 -1
- package/dist/{localHappyAgentAuth-B94JIex_.mjs → localHappyAgentAuth-B7f4Ysn0.mjs} +1 -1
- package/dist/{logger-DYejzaY9.cjs → logger-C7dRaCkE.cjs} +2 -2
- package/dist/{logger-CKCRe63e.mjs → logger-D5EzMy30.mjs} +2 -2
- package/dist/{machineMetadata-C7Slozib.cjs → machineMetadata-DYYuK_0c.cjs} +3 -3
- package/dist/{machineMetadata-CiemL6uU.mjs → machineMetadata-DqplCWue.mjs} +3 -3
- package/dist/{main-BQBSqrW3.mjs → main-CnV62agu.mjs} +44 -44
- package/dist/{main-CJCss2TE.cjs → main-kgCQgknK.cjs} +44 -44
- package/dist/{mcp-cq0hhROT.cjs → mcp-BV0vxHtz.cjs} +14 -14
- package/dist/{mcp-BRtLFMHZ.mjs → mcp-bDPaj-tM.mjs} +14 -14
- package/dist/{mirrorProtocol-pDuMxeQj.cjs → mirrorProtocol-BSHVZ8Nf.cjs} +3 -3
- package/dist/{mirrorProtocol-hPlbcL2P.mjs → mirrorProtocol-ClKhNXYe.mjs} +3 -3
- package/dist/{package-JFU2Ry9r.mjs → package-D0dxZ-W8.mjs} +7 -7
- package/dist/{package-DwxuhtoO.cjs → package-VqWv7EI5.cjs} +7 -7
- package/dist/{peerTools-D-yf7SlL.mjs → peerTools-B_eiNB3P.mjs} +4 -4
- package/dist/{peerTools-DiBZOaPT.cjs → peerTools-BktGmlpd.cjs} +4 -4
- package/dist/{persistence-CG158J29.mjs → persistence-CIIhP0Uw.mjs} +2 -2
- package/dist/{persistence-Bi1BTtHq.cjs → persistence-DweHi8xa.cjs} +2 -2
- package/dist/{piRunnerArgs-DkCs_Ma1.cjs → piRunnerArgs-BNzWTNRV.cjs} +1 -1
- package/dist/{piRunnerArgs-C-8jIqUE.mjs → piRunnerArgs-cQafsadv.mjs} +1 -1
- package/dist/{piRuntime-C4Ei1y-P.mjs → piRuntime-Bel5lOLb.mjs} +1 -1
- package/dist/{piRuntime-CHsld2lz.cjs → piRuntime-VZLSwW-4.cjs} +1 -1
- package/dist/{piTerminal-yp98lIpx.mjs → piTerminal-CS5SDi_H.mjs} +16 -16
- package/dist/{piTerminal-D4Hy_mmZ.cjs → piTerminal-DkR8sPv-.cjs} +16 -16
- package/dist/{rateLimitWindows-C36y0Ldw.mjs → rateLimitWindows-Bo6XVnie.mjs} +1 -1
- package/dist/{rateLimitWindows-Blhk1RyR.cjs → rateLimitWindows-Bp4T21RI.cjs} +1 -1
- package/dist/{registerCommonHandlers-Ct5XkkNU.cjs → registerCommonHandlers-B7QZxkCL.cjs} +2 -2
- package/dist/{registerCommonHandlers-ni8jeOJc.mjs → registerCommonHandlers-CR5jpiSx.mjs} +2 -2
- package/dist/{registerKillSessionHandler-DoR8z8b6.cjs → registerKillSessionHandler-CcX84g-T.cjs} +6 -6
- package/dist/{registerKillSessionHandler-B0LoAR3_.mjs → registerKillSessionHandler-DLiu24CQ.mjs} +6 -6
- package/dist/{remoteSessionClient-B7YBUGMI.cjs → remoteSessionClient-CL3akj0K.cjs} +5 -5
- package/dist/{remoteSessionClient-B5vn4Ghn.mjs → remoteSessionClient-CUjw1COc.mjs} +5 -5
- package/dist/{reportProgressTool-25DIibtH.mjs → reportProgressTool-BLLwMQrN.mjs} +2 -2
- package/dist/{reportProgressTool-BVTrYVsY.cjs → reportProgressTool-DzMi4mvH.cjs} +2 -2
- package/dist/{run-Buxf1ATU.cjs → run-5pmOElaW.cjs} +34 -34
- package/dist/{run-D4qgzSft.mjs → run-DGokR_6q.mjs} +33 -33
- package/dist/{runClaude-CRkWhQ5T.mjs → runClaude-BFlpZQds.mjs} +21 -21
- package/dist/{runClaude-D4B0SSd5.cjs → runClaude-EnYNvkV0.cjs} +21 -21
- package/dist/{runClaudeDeps-BKYHcQkO.cjs → runClaudeDeps-CUDebE9e.cjs} +35 -35
- package/dist/{runClaudeDeps-CbyQIbNw.mjs → runClaudeDeps-D1M1dzlZ.mjs} +40 -40
- package/dist/{runGemini-OgmDK1Lq.cjs → runGemini-Bu69Zu1u.cjs} +32 -32
- package/dist/{runGemini-Dn6yFpnO.mjs → runGemini-Bub8T5cM.mjs} +32 -32
- package/dist/{runOpenClaw-DFD--ZW9.cjs → runOpenClaw-Cob5F3FC.cjs} +18 -18
- package/dist/{runOpenClaw-CDU1UOZ1.mjs → runOpenClaw-DVu73F_i.mjs} +18 -18
- package/dist/{sandbox-DojsNXsy.mjs → sandbox-9EKOFyQF.mjs} +4 -4
- package/dist/{sandbox-ryBV4t4z.cjs → sandbox-GDqMagSF.cjs} +4 -4
- package/dist/selfCheck-CNo4uzGB.mjs +84 -0
- package/dist/{selfCheck-B69om90v.cjs → selfCheck-DiNo34da.cjs} +34 -34
- package/dist/{send-Bi7MDDHN.cjs → send-ThC80164.cjs} +8 -8
- package/dist/{send-DyRupwU5.mjs → send-wgtHphq8.mjs} +8 -8
- package/dist/{server-B4SxszzQ.mjs → server-Bb8v2fOj.mjs} +4 -4
- package/dist/{server-DpJPHOAb.cjs → server-bidHnstE.cjs} +6 -6
- package/dist/{sessionLock-DdoHaNAf.cjs → sessionLock-BWBcBZKh.cjs} +3 -3
- package/dist/{sessionLock-ZtySCwjt.mjs → sessionLock-gb32sVPR.mjs} +3 -3
- package/dist/{sessionModeFile-B-z4OPU6.mjs → sessionModeFile-C-fr1M1h.mjs} +1 -1
- package/dist/{sessionModeFile-Bkzcsv_J.cjs → sessionModeFile-DhuTNcJr.cjs} +1 -1
- package/dist/{sessionOps-BUzvciA5.cjs → sessionOps-9MChM9Op.cjs} +4 -4
- package/dist/{sessionOps-BtqGzSz1.mjs → sessionOps-ByZJbkMq.mjs} +4 -4
- package/dist/{sessionScanner-DOdHh5CA.cjs → sessionScanner-BpegdnXK.cjs} +3 -3
- package/dist/{sessionScanner-60sqJeks.mjs → sessionScanner-CxXPAVyS.mjs} +3 -3
- package/dist/{sessions-OCFh0naE.cjs → sessions-C1X4z_Lm.cjs} +9 -9
- package/dist/{sessions-AM5DxBgS.mjs → sessions-l-UgJGjV.mjs} +9 -9
- package/dist/{setupOfflineReconnection-BcHl9VGI.cjs → setupOfflineReconnection-CS_8Da8R.cjs} +2 -2
- package/dist/{setupOfflineReconnection-VK1e2LME.mjs → setupOfflineReconnection-CgtXlV74.mjs} +2 -2
- package/dist/{spawn-CjtSsVs5.cjs → spawn-D2BlNdZu.cjs} +13 -13
- package/dist/{spawn-CG1ckxEZ.mjs → spawn-FyoHqYWo.mjs} +13 -13
- package/dist/{spawnAgents-HDaE3C0-.mjs → spawnAgents-BhsbJ253.mjs} +1 -1
- package/dist/{spawnAgents-vglexX9N.cjs → spawnAgents-CgMKuOhZ.cjs} +1 -1
- package/dist/{spawnHappyCLI-A9QYQdFL.cjs → spawnHappyCLI-DByQcqEN.cjs} +1 -1
- package/dist/{spawnHappyCLI-XVh-9eez.mjs → spawnHappyCLI-DsC256j_.mjs} +1 -1
- package/dist/{specialCommands-BK2gc9vz.cjs → specialCommands-DGUeZqdm.cjs} +3 -3
- package/dist/{specialCommands-VaHfF5iC.mjs → specialCommands-DUUBqzvd.mjs} +3 -3
- package/dist/{startFileWatcher-CwkqU0fA.cjs → startFileWatcher-BtBaahTn.cjs} +1 -1
- package/dist/{startFileWatcher-Dls9MDuo.mjs → startFileWatcher-CaYRObJu.mjs} +1 -1
- package/dist/{streamRelay-Iogsh51a.mjs → streamRelay-C8zI7OnR.mjs} +1 -1
- package/dist/{streamRelay-Ce9sgcOV.cjs → streamRelay-DqPFsCgx.cjs} +1 -1
- package/dist/{sync-BN5jPiq4.cjs → sync-BK-IBkuB.cjs} +1 -1
- package/dist/{sync-CU7N-dAQ.mjs → sync-D5YqUVjS.mjs} +1 -1
- package/dist/{systemPrompt-bo6KFoMZ.cjs → systemPrompt-DaTKLEb-.cjs} +2 -2
- package/dist/{systemPrompt-W9opO926.mjs → systemPrompt-e-qeag_h.mjs} +2 -2
- package/dist/{teams-hotQxTHy.mjs → teams-ClrppvKu.mjs} +6 -6
- package/dist/{teams--pI0Ri5A.cjs → teams-D9xwa_d3.cjs} +6 -6
- package/dist/{time-BDZ6VD5o.cjs → time-0szhiPo4.cjs} +1 -1
- package/dist/{time-jR_TKQyj.mjs → time-CvrpeD3S.mjs} +1 -1
- package/dist/{titleGenerator-Dp0eIi1b.mjs → titleGenerator-BZ5770wq.mjs} +1 -1
- package/dist/{titleGenerator-CQ6ZqGb2.cjs → titleGenerator-Dz5P7sE1.cjs} +2 -2
- package/dist/{todo-DVCyX6N9.cjs → todo-CkmNJQey.cjs} +6 -6
- package/dist/{todo-CwW7byJY.mjs → todo-o-miKcN2.mjs} +6 -6
- package/dist/{tools-C5HNddiJ.cjs → tools-C77-Ssan.cjs} +1 -1
- package/dist/{tools-BzD8JYIx.mjs → tools-Cp0qJeBq.mjs} +1 -1
- package/dist/{uninstall-G9lEyEVW.cjs → uninstall-DGUPERDX.cjs} +3 -3
- package/dist/{uninstall-HRcEekvo.mjs → uninstall-jNJDCLD_.mjs} +3 -3
- package/package.json +7 -7
- package/dist/selfCheck-jA7PDBkO.mjs +0 -84
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
var node_child_process = require('node:child_process');
|
|
4
4
|
var spawn = require('cross-spawn');
|
|
5
5
|
var node_readline = require('node:readline');
|
|
6
|
-
var logger = require('./logger-
|
|
6
|
+
var logger = require('./logger-C7dRaCkE.cjs');
|
|
7
7
|
var contentLogMetadata = require('./contentLogMetadata-ZSFk_NjQ.cjs');
|
|
8
8
|
var manager = require('./manager-HrEj442o.cjs');
|
|
9
|
-
var _package = require('./package-
|
|
10
|
-
var rateLimitWindows = require('./rateLimitWindows-
|
|
9
|
+
var _package = require('./package-VqWv7EI5.cjs');
|
|
10
|
+
var rateLimitWindows = require('./rateLimitWindows-Bp4T21RI.cjs');
|
|
11
11
|
|
|
12
12
|
function isAppServerAvailable() {
|
|
13
13
|
try {
|
|
@@ -91,7 +91,6 @@ class CodexAppServerClient {
|
|
|
91
91
|
_turnId = null;
|
|
92
92
|
threadDefaults = null;
|
|
93
93
|
// Turn completion tracking for the currently active sendTurnAndWait call.
|
|
94
|
-
// A completion event only resolves once we have seen task_started for this turn.
|
|
95
94
|
pendingTurnCompletion = null;
|
|
96
95
|
// Tracks in-flight interruptTurn() RPCs so sendTurnAndWait can wait for them
|
|
97
96
|
// before starting a new turn (prevents stale turn/interrupt from aborting the next turn).
|
|
@@ -101,7 +100,29 @@ class CodexAppServerClient {
|
|
|
101
100
|
idleRelease = null;
|
|
102
101
|
notificationProtocol = "unknown";
|
|
103
102
|
completedTurnIds = /* @__PURE__ */ new Set();
|
|
103
|
+
/** B-625: turns whose failure has already been forwarded, so a second failed frame is not. */
|
|
104
|
+
failedTurnIds = /* @__PURE__ */ new Set();
|
|
105
|
+
// B-625: the app-server speaks for every thread it hosts — the session's own and the
|
|
106
|
+
// children `spawn_agent` opens — so a lifecycle frame (turn/started, turn/completed,
|
|
107
|
+
// thread/status/changed, error, thread/closed) is the session's only when its `threadId`
|
|
108
|
+
// is ours; a frame naming no thread belongs to the thread it was asked on (Orca's rule,
|
|
109
|
+
// src/main/codex/codex-structured-turn-open-wait.ts). Before this, a child's
|
|
110
|
+
// `turn/completed` ended the parent's turn in the UI and a child's `turn/started`
|
|
111
|
+
// retargeted `turn/interrupt` at the child.
|
|
112
|
+
/** The own thread's last turn-ending `error` (willRetry=false), for a turn end that arrives without a verdict. */
|
|
113
|
+
lastTurnError = null;
|
|
114
|
+
/** Own thread reported idle/systemError while a turn was pending: Codex's `turn/completed`
|
|
115
|
+
* follows within a millisecond; this ends the turn if it does not (see armThreadStopGrace). */
|
|
116
|
+
threadStopGrace = null;
|
|
117
|
+
/** Last few hundred chars of the app-server's stderr: Codex's own last words when it dies. */
|
|
118
|
+
stderrRing = "";
|
|
104
119
|
rawFileChangesByItemId = /* @__PURE__ */ new Map();
|
|
120
|
+
// B-622: inactivity watchdog for the pending turn — re-armed by every
|
|
121
|
+
// notification, never a cap on how long a turn may run (see sendTurnAndWait).
|
|
122
|
+
turnWatchdog = null;
|
|
123
|
+
// Approval / elicitation requests we are still answering: a human may take
|
|
124
|
+
// longer than the watchdog to decide, and that is not Codex going silent.
|
|
125
|
+
inflightServerRequests = 0;
|
|
105
126
|
// Handlers set by the consumer (runCodex.ts)
|
|
106
127
|
eventHandler = null;
|
|
107
128
|
approvalHandler = null;
|
|
@@ -163,8 +184,21 @@ class CodexAppServerClient {
|
|
|
163
184
|
const status = params?.turn?.status ?? params?.status ?? null;
|
|
164
185
|
return typeof status === "string" && status.length > 0 ? status : null;
|
|
165
186
|
}
|
|
187
|
+
extractThreadId(params) {
|
|
188
|
+
const threadId = params?.threadId ?? params?.thread_id ?? params?.thread?.id ?? null;
|
|
189
|
+
return typeof threadId === "string" && threadId.length > 0 ? threadId : null;
|
|
190
|
+
}
|
|
191
|
+
/** B-625: whether a lifecycle frame is about the session's own thread (see the field comment). */
|
|
192
|
+
isOwnThreadFrame(params) {
|
|
193
|
+
const threadId = this.extractThreadId(params);
|
|
194
|
+
return threadId === null || this._threadId === null || threadId === this._threadId;
|
|
195
|
+
}
|
|
196
|
+
/** Codex's last stderr lines, one line, for a message a person reads. */
|
|
197
|
+
stderrTail() {
|
|
198
|
+
return this.stderrRing.replace(/\x1b\[[0-9;]*m/g, "").replace(/\s+/g, " ").trim();
|
|
199
|
+
}
|
|
166
200
|
shouldHandleRawNotification(method) {
|
|
167
|
-
const isRawNotification = method === "thread/started" || method === "turn/started" || method === "turn/completed" || method === "thread/status/changed" || method === "thread/tokenUsage/updated" || method.startsWith("item/");
|
|
201
|
+
const isRawNotification = method === "thread/started" || method === "turn/started" || method === "turn/completed" || method === "thread/status/changed" || method === "thread/closed" || method === "thread/tokenUsage/updated" || method.startsWith("item/");
|
|
168
202
|
if (!isRawNotification) {
|
|
169
203
|
return false;
|
|
170
204
|
}
|
|
@@ -178,14 +212,20 @@ class CodexAppServerClient {
|
|
|
178
212
|
}
|
|
179
213
|
emitRawTurnCompletion(turnId, status, error, source) {
|
|
180
214
|
const aborted = status === "cancelled" || status === "canceled" || status === "aborted" || status === "interrupted";
|
|
215
|
+
const failed = status === "failed" || error !== void 0 && error !== null;
|
|
216
|
+
this.clearThreadStopGrace();
|
|
181
217
|
this.tryResolvePendingTurn(aborted, turnId, source);
|
|
182
218
|
this._turnId = null;
|
|
183
219
|
this.maybeRefreshRateLimits();
|
|
220
|
+
if (this.lastTurnError && (!turnId || !this.lastTurnError.turnId || this.lastTurnError.turnId === turnId)) {
|
|
221
|
+
this.lastTurnError = null;
|
|
222
|
+
}
|
|
184
223
|
if (turnId && this.completedTurnIds.has(turnId)) {
|
|
185
|
-
return;
|
|
224
|
+
if (!failed || this.failedTurnIds.has(turnId)) return;
|
|
186
225
|
}
|
|
187
226
|
if (turnId) {
|
|
188
227
|
this.completedTurnIds.add(turnId);
|
|
228
|
+
if (failed) this.failedTurnIds.add(turnId);
|
|
189
229
|
}
|
|
190
230
|
if (aborted) {
|
|
191
231
|
this.eventHandler?.({
|
|
@@ -208,6 +248,10 @@ class CodexAppServerClient {
|
|
|
208
248
|
return false;
|
|
209
249
|
}
|
|
210
250
|
if (method === "turn/started") {
|
|
251
|
+
if (!this.isOwnThreadFrame(params)) {
|
|
252
|
+
logger.logger.debug(`[CodexAppServer] Child thread ${this.extractThreadId(params)} started a turn`);
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
211
255
|
const turnId = this.extractTurnId(params);
|
|
212
256
|
if (turnId) {
|
|
213
257
|
this._turnId = turnId;
|
|
@@ -220,6 +264,10 @@ class CodexAppServerClient {
|
|
|
220
264
|
return true;
|
|
221
265
|
}
|
|
222
266
|
if (method === "turn/completed") {
|
|
267
|
+
if (!this.isOwnThreadFrame(params)) {
|
|
268
|
+
logger.logger.debug(`[CodexAppServer] Child thread ${this.extractThreadId(params)} ended a turn`);
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
223
271
|
this.emitRawTurnCompletion(
|
|
224
272
|
this.extractTurnId(params),
|
|
225
273
|
this.extractTurnStatus(params),
|
|
@@ -229,9 +277,23 @@ class CodexAppServerClient {
|
|
|
229
277
|
return true;
|
|
230
278
|
}
|
|
231
279
|
if (method === "thread/status/changed") {
|
|
280
|
+
if (!this.isOwnThreadFrame(params)) return true;
|
|
232
281
|
const statusType = params?.status?.type;
|
|
233
|
-
if (statusType === "idle" && this.pendingTurnCompletion) {
|
|
234
|
-
this.
|
|
282
|
+
if ((statusType === "idle" || statusType === "systemError") && this.pendingTurnCompletion?.opened) {
|
|
283
|
+
this.armThreadStopGrace(statusType);
|
|
284
|
+
} else if (statusType === "active") {
|
|
285
|
+
this.clearThreadStopGrace();
|
|
286
|
+
}
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
if (method === "thread/closed") {
|
|
290
|
+
if (this.isOwnThreadFrame(params) && this.pendingTurnCompletion) {
|
|
291
|
+
this.emitRawTurnCompletion(
|
|
292
|
+
this.pendingTurnCompletion.turnId ?? this._turnId,
|
|
293
|
+
"aborted",
|
|
294
|
+
{ message: "Codex closed the thread before the turn ended." },
|
|
295
|
+
method
|
|
296
|
+
);
|
|
235
297
|
}
|
|
236
298
|
return true;
|
|
237
299
|
}
|
|
@@ -318,14 +380,6 @@ class CodexAppServerClient {
|
|
|
318
380
|
phase: item.phase
|
|
319
381
|
});
|
|
320
382
|
}
|
|
321
|
-
if (item.phase === "final_answer" && this.pendingTurnCompletion) {
|
|
322
|
-
this.emitRawTurnCompletion(
|
|
323
|
-
this.extractTurnId(params),
|
|
324
|
-
"completed",
|
|
325
|
-
null,
|
|
326
|
-
`${method}:final_answer`
|
|
327
|
-
);
|
|
328
|
-
}
|
|
329
383
|
return true;
|
|
330
384
|
}
|
|
331
385
|
return method.startsWith("item/");
|
|
@@ -385,17 +439,35 @@ class CodexAppServerClient {
|
|
|
385
439
|
return;
|
|
386
440
|
}
|
|
387
441
|
this.connected = false;
|
|
442
|
+
const tail = this.stderrTail();
|
|
443
|
+
const exited = `Codex process exited (code=${code ?? "null"}${signal ? `, signal=${signal}` : ""})`;
|
|
388
444
|
for (const [id, req] of this.pending) {
|
|
389
445
|
if (req.epoch !== epoch) continue;
|
|
390
|
-
|
|
446
|
+
const error = new Error(`${exited} while waiting for ${req.method}`);
|
|
447
|
+
error.codexStderrTail = tail;
|
|
448
|
+
req.reject(error);
|
|
391
449
|
this.pending.delete(id);
|
|
392
450
|
}
|
|
451
|
+
if (this.pendingTurnCompletion) {
|
|
452
|
+
const turnId = this.pendingTurnCompletion.turnId ?? this._turnId;
|
|
453
|
+
this.eventHandler?.({
|
|
454
|
+
type: "turn_aborted",
|
|
455
|
+
reason: "process-exit",
|
|
456
|
+
...turnId ? { turn_id: turnId } : {},
|
|
457
|
+
error: { message: `${exited}${tail ? `: ${tail}` : ""}` }
|
|
458
|
+
});
|
|
459
|
+
}
|
|
393
460
|
this.resolvePendingTurn(true);
|
|
394
461
|
});
|
|
462
|
+
this.stderrRing = "";
|
|
395
463
|
proc.stderr?.on("data", (chunk) => {
|
|
396
464
|
if (this.process !== proc || this.processEpoch !== epoch) return;
|
|
397
465
|
const text = chunk.toString().trim();
|
|
398
|
-
if (text)
|
|
466
|
+
if (text) {
|
|
467
|
+
logger.logger.debug("[CodexAppServer:stderr]", contentLogMetadata.contentLogMetadata(text));
|
|
468
|
+
this.stderrRing = `${this.stderrRing}
|
|
469
|
+
${text}`.slice(-400);
|
|
470
|
+
}
|
|
399
471
|
});
|
|
400
472
|
this.readline = node_readline.createInterface({ input: proc.stdout });
|
|
401
473
|
this.readline.on("line", (line) => {
|
|
@@ -446,6 +518,9 @@ class CodexAppServerClient {
|
|
|
446
518
|
this._turnId = null;
|
|
447
519
|
this.notificationProtocol = "unknown";
|
|
448
520
|
this.completedTurnIds.clear();
|
|
521
|
+
this.failedTurnIds.clear();
|
|
522
|
+
this.lastTurnError = null;
|
|
523
|
+
this.clearThreadStopGrace();
|
|
449
524
|
if (!opts?.preserveThreadState) {
|
|
450
525
|
this._threadId = null;
|
|
451
526
|
this.threadDefaults = null;
|
|
@@ -663,15 +738,50 @@ class CodexAppServerClient {
|
|
|
663
738
|
}
|
|
664
739
|
resolvePendingTurn(aborted) {
|
|
665
740
|
if (!this.pendingTurnCompletion) return;
|
|
741
|
+
this.clearTurnWatchdog();
|
|
742
|
+
this.clearThreadStopGrace();
|
|
666
743
|
this.pendingTurnCompletion.resolve(aborted);
|
|
667
744
|
this.pendingTurnCompletion = null;
|
|
668
745
|
}
|
|
669
746
|
markPendingTurnStarted(turnId) {
|
|
670
747
|
if (!this.pendingTurnCompletion) return;
|
|
748
|
+
this.pendingTurnCompletion.opened = true;
|
|
671
749
|
if (turnId) {
|
|
672
750
|
this.pendingTurnCompletion.turnId = turnId;
|
|
673
751
|
}
|
|
674
752
|
}
|
|
753
|
+
/** Default wait for Codex's `turn/completed` after its thread reported idle/systemError. */
|
|
754
|
+
static THREAD_STOP_GRACE_MS = 1500;
|
|
755
|
+
/**
|
|
756
|
+
* B-625: the own thread stopped (idle / systemError) while a turn was pending and
|
|
757
|
+
* had opened. Codex's `turn/completed` follows at once in every probed release
|
|
758
|
+
* (0.154.0: 1 ms); this is the net under a release that does not send it, so the
|
|
759
|
+
* session never waits on the silence watchdog for a turn Codex has already left.
|
|
760
|
+
*/
|
|
761
|
+
armThreadStopGrace(statusType) {
|
|
762
|
+
this.clearThreadStopGrace();
|
|
763
|
+
const graceMs = this.pendingTurnCompletion?.threadStopGraceMs ?? CodexAppServerClient.THREAD_STOP_GRACE_MS;
|
|
764
|
+
this.threadStopGrace = setTimeout(() => {
|
|
765
|
+
this.threadStopGrace = null;
|
|
766
|
+
const pending = this.pendingTurnCompletion;
|
|
767
|
+
if (!pending) return;
|
|
768
|
+
const turnId = pending.turnId ?? this._turnId;
|
|
769
|
+
const lastError = this.lastTurnError && (!turnId || !this.lastTurnError.turnId || this.lastTurnError.turnId === turnId) ? this.lastTurnError.error : null;
|
|
770
|
+
logger.logger.warn(`[CodexAppServer] Thread went ${statusType} and no turn/completed followed for turn ${turnId ?? "?"}; ending the turn`);
|
|
771
|
+
const failed = statusType === "systemError" || lastError !== null;
|
|
772
|
+
this.emitRawTurnCompletion(
|
|
773
|
+
turnId,
|
|
774
|
+
failed ? "failed" : "completed",
|
|
775
|
+
lastError ?? (failed ? { message: "Codex reported a system error and ended the turn without a verdict." } : null),
|
|
776
|
+
`thread/status/changed:${statusType}`
|
|
777
|
+
);
|
|
778
|
+
}, graceMs);
|
|
779
|
+
}
|
|
780
|
+
clearThreadStopGrace() {
|
|
781
|
+
if (!this.threadStopGrace) return;
|
|
782
|
+
clearTimeout(this.threadStopGrace);
|
|
783
|
+
this.threadStopGrace = null;
|
|
784
|
+
}
|
|
675
785
|
tryResolvePendingTurn(aborted, turnId, source) {
|
|
676
786
|
const pending = this.pendingTurnCompletion;
|
|
677
787
|
if (!pending) return;
|
|
@@ -773,6 +883,8 @@ class CodexAppServerClient {
|
|
|
773
883
|
}
|
|
774
884
|
/** Default timeout for waiting on turn completion (ms). 10 minutes. */
|
|
775
885
|
static TURN_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
886
|
+
/** How much of the app-server's stderr is kept for its exit message. */
|
|
887
|
+
static STDERR_TAIL_CHARS = 400;
|
|
776
888
|
/**
|
|
777
889
|
* Send a user turn and wait for it to complete (task_complete or turn_aborted).
|
|
778
890
|
* Returns { aborted: true } if the turn was aborted (user cancel, permission reject, etc.).
|
|
@@ -784,30 +896,58 @@ class CodexAppServerClient {
|
|
|
784
896
|
}
|
|
785
897
|
await this.ensureConnected();
|
|
786
898
|
const timeoutMs = opts?.turnTimeoutMs ?? CodexAppServerClient.TURN_TIMEOUT_MS;
|
|
787
|
-
let timer = null;
|
|
788
899
|
const completion = new Promise((resolve) => {
|
|
789
900
|
this.pendingTurnCompletion = {
|
|
790
901
|
resolve,
|
|
791
|
-
turnId: null
|
|
902
|
+
turnId: null,
|
|
903
|
+
opened: false,
|
|
904
|
+
threadStopGraceMs: opts?.threadStopGraceMs ?? CodexAppServerClient.THREAD_STOP_GRACE_MS
|
|
792
905
|
};
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
logger.logger.warn(`[CodexAppServer] Turn timed out after ${timeoutMs}ms \u2014 treating as abort`);
|
|
796
|
-
this.resolvePendingTurn(true);
|
|
797
|
-
}
|
|
798
|
-
}, timeoutMs);
|
|
906
|
+
this.lastTurnError = null;
|
|
907
|
+
this.armTurnWatchdog(timeoutMs);
|
|
799
908
|
});
|
|
800
909
|
try {
|
|
801
910
|
await this.sendTurn(prompt, opts);
|
|
802
911
|
} catch (err) {
|
|
803
|
-
|
|
912
|
+
this.clearTurnWatchdog();
|
|
804
913
|
this.pendingTurnCompletion = null;
|
|
805
914
|
throw err;
|
|
806
915
|
}
|
|
807
916
|
const aborted = await completion;
|
|
808
|
-
|
|
917
|
+
this.clearTurnWatchdog();
|
|
809
918
|
return { aborted };
|
|
810
919
|
}
|
|
920
|
+
armTurnWatchdog(timeoutMs) {
|
|
921
|
+
this.clearTurnWatchdog();
|
|
922
|
+
const timer = setTimeout(() => {
|
|
923
|
+
this.turnWatchdog = null;
|
|
924
|
+
if (!this.pendingTurnCompletion) return;
|
|
925
|
+
if (this.inflightServerRequests > 0) {
|
|
926
|
+
this.armTurnWatchdog(timeoutMs);
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
logger.logger.warn(`[CodexAppServer] No notification from Codex for ${timeoutMs}ms \u2014 giving the turn up as aborted`);
|
|
930
|
+
const turnId = this.pendingTurnCompletion.turnId ?? this._turnId;
|
|
931
|
+
this.eventHandler?.({
|
|
932
|
+
type: "turn_aborted",
|
|
933
|
+
reason: "timeout",
|
|
934
|
+
...turnId ? { turn_id: turnId } : {},
|
|
935
|
+
error: { message: `Codex sent nothing for ${Math.max(1, Math.round(timeoutMs / 6e4))} minutes; this turn was given up. Send the message again, or restart the session if it keeps happening.` }
|
|
936
|
+
});
|
|
937
|
+
this.resolvePendingTurn(true);
|
|
938
|
+
}, timeoutMs);
|
|
939
|
+
this.turnWatchdog = { timer, timeoutMs };
|
|
940
|
+
}
|
|
941
|
+
/** Any sign of life from the app-server while a turn is pending restarts the clock. */
|
|
942
|
+
touchTurnWatchdog() {
|
|
943
|
+
if (!this.turnWatchdog || !this.pendingTurnCompletion) return;
|
|
944
|
+
this.armTurnWatchdog(this.turnWatchdog.timeoutMs);
|
|
945
|
+
}
|
|
946
|
+
clearTurnWatchdog() {
|
|
947
|
+
if (!this.turnWatchdog) return;
|
|
948
|
+
clearTimeout(this.turnWatchdog.timer);
|
|
949
|
+
this.turnWatchdog = null;
|
|
950
|
+
}
|
|
811
951
|
async interruptTurn() {
|
|
812
952
|
if (!this._threadId) return;
|
|
813
953
|
if (!this._turnId) {
|
|
@@ -843,6 +983,8 @@ class CodexAppServerClient {
|
|
|
843
983
|
this._turnId = null;
|
|
844
984
|
this.threadDefaults = null;
|
|
845
985
|
this.completedTurnIds.clear();
|
|
986
|
+
this.failedTurnIds.clear();
|
|
987
|
+
this.lastTurnError = null;
|
|
846
988
|
this.rawFileChangesByItemId.clear();
|
|
847
989
|
}
|
|
848
990
|
// ─── JSON-RPC transport ─────────────────────────────────────
|
|
@@ -1015,6 +1157,15 @@ class CodexAppServerClient {
|
|
|
1015
1157
|
};
|
|
1016
1158
|
}
|
|
1017
1159
|
async handleServerRequest(id, method, params) {
|
|
1160
|
+
this.inflightServerRequests += 1;
|
|
1161
|
+
try {
|
|
1162
|
+
await this.handleServerRequestInner(id, method, params);
|
|
1163
|
+
} finally {
|
|
1164
|
+
this.inflightServerRequests -= 1;
|
|
1165
|
+
this.touchTurnWatchdog();
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
async handleServerRequestInner(id, method, params) {
|
|
1018
1169
|
if (method === "mcpServer/elicitation/request") {
|
|
1019
1170
|
const toolName = this.parseToolNameFromElicitationMessage(params?.message) ?? params?.serverName ?? "McpTool";
|
|
1020
1171
|
const decision = await this.handleApproval({
|
|
@@ -1068,6 +1219,7 @@ class CodexAppServerClient {
|
|
|
1068
1219
|
return "denied";
|
|
1069
1220
|
}
|
|
1070
1221
|
handleNotification(method, params) {
|
|
1222
|
+
this.touchTurnWatchdog();
|
|
1071
1223
|
if (method === "codex/event" || method.startsWith("codex/event/")) {
|
|
1072
1224
|
this.notificationProtocol = "legacy";
|
|
1073
1225
|
const msg = params?.msg;
|
|
@@ -1101,6 +1253,7 @@ class CodexAppServerClient {
|
|
|
1101
1253
|
}
|
|
1102
1254
|
if (method === "thread/started" || method === "turn/started" || method === "turn/completed" || method === "thread/status/changed") {
|
|
1103
1255
|
logger.logger.debug(`[CodexAppServer] Lifecycle notification: ${method}`);
|
|
1256
|
+
if (!this.isOwnThreadFrame(params)) return;
|
|
1104
1257
|
if (method === "turn/started") {
|
|
1105
1258
|
const turnId = this.extractTurnId(params);
|
|
1106
1259
|
if (turnId) {
|
|
@@ -1127,6 +1280,30 @@ class CodexAppServerClient {
|
|
|
1127
1280
|
logger.logger.debug(`[CodexAppServer] mcpServer startup status:`, params);
|
|
1128
1281
|
return;
|
|
1129
1282
|
}
|
|
1283
|
+
if (method === "error") {
|
|
1284
|
+
if (!this.isOwnThreadFrame(params)) return;
|
|
1285
|
+
const error = params?.error ?? {};
|
|
1286
|
+
const turnId = typeof params?.turnId === "string" && params.turnId.length > 0 ? params.turnId : null;
|
|
1287
|
+
if (params?.willRetry === true) {
|
|
1288
|
+
const message = typeof error.message === "string" ? error.message : "";
|
|
1289
|
+
const info = error.codexErrorInfo;
|
|
1290
|
+
const httpStatus = info && typeof info === "object" ? info.responseStreamDisconnected?.httpStatusCode ?? info.httpStatusCode ?? null : null;
|
|
1291
|
+
this.eventHandler?.({
|
|
1292
|
+
type: "turn_retry",
|
|
1293
|
+
message,
|
|
1294
|
+
...typeof httpStatus === "number" ? { http_status: httpStatus } : {},
|
|
1295
|
+
...turnId ? { turn_id: turnId } : {},
|
|
1296
|
+
...typeof error.additionalDetails === "string" ? { details: error.additionalDetails } : {}
|
|
1297
|
+
});
|
|
1298
|
+
return;
|
|
1299
|
+
}
|
|
1300
|
+
this.lastTurnError = { turnId, error };
|
|
1301
|
+
const pending = this.pendingTurnCompletion;
|
|
1302
|
+
if (pending && !pending.opened && (turnId === null || pending.turnId === null || pending.turnId === turnId)) {
|
|
1303
|
+
this.emitRawTurnCompletion(turnId ?? pending.turnId, "failed", error, "error:unopened-turn");
|
|
1304
|
+
}
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
1130
1307
|
logger.logger.debug(`[CodexAppServer] Notification: ${method}`);
|
|
1131
1308
|
}
|
|
1132
1309
|
}
|
|
@@ -1,61 +1,61 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var auth = require('./auth-
|
|
4
|
-
var index = require('./index-
|
|
3
|
+
var auth = require('./auth-BGmM3Vlm.cjs');
|
|
4
|
+
var index = require('./index-BZdhwBKa.cjs');
|
|
5
5
|
var forkBackfill = require('./forkBackfill-8eLDeS73.cjs');
|
|
6
6
|
var node_crypto = require('node:crypto');
|
|
7
7
|
var cuid2 = require('@paralleldrive/cuid2');
|
|
8
8
|
var agentAttachments = require('./agentAttachments-Dbw8iMCZ.cjs');
|
|
9
|
-
var attachmentContent = require('./attachmentContent-
|
|
9
|
+
var attachmentContent = require('./attachmentContent-4L9dO8E3.cjs');
|
|
10
10
|
var ink = require('ink');
|
|
11
|
-
var sessionLock = require('./sessionLock-
|
|
11
|
+
var sessionLock = require('./sessionLock-BWBcBZKh.cjs');
|
|
12
12
|
var React = require('react');
|
|
13
|
-
var api = require('./api-
|
|
14
|
-
var codexAppServerClient = require('./codexAppServerClient-
|
|
15
|
-
var specialCommands = require('./specialCommands-
|
|
16
|
-
var logger = require('./logger-
|
|
17
|
-
var BasePermissionHandler = require('./BasePermissionHandler-
|
|
18
|
-
var BaseReasoningProcessor = require('./BaseReasoningProcessor-
|
|
13
|
+
var api = require('./api-KZmVqSKO.cjs');
|
|
14
|
+
var codexAppServerClient = require('./codexAppServerClient-D-9z-lWP.cjs');
|
|
15
|
+
var specialCommands = require('./specialCommands-DGUeZqdm.cjs');
|
|
16
|
+
var logger = require('./logger-C7dRaCkE.cjs');
|
|
17
|
+
var BasePermissionHandler = require('./BasePermissionHandler-BbLYwd13.cjs');
|
|
18
|
+
var BaseReasoningProcessor = require('./BaseReasoningProcessor-_S1PbSvH.cjs');
|
|
19
19
|
var node_child_process = require('node:child_process');
|
|
20
|
-
var persistence = require('./persistence-
|
|
21
|
-
var machineMetadata = require('./machineMetadata-
|
|
22
|
-
var configuration = require('./configuration-
|
|
23
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-
|
|
20
|
+
var persistence = require('./persistence-DweHi8xa.cjs');
|
|
21
|
+
var machineMetadata = require('./machineMetadata-DYYuK_0c.cjs');
|
|
22
|
+
var configuration = require('./configuration-UV4EE5ui.cjs');
|
|
23
|
+
var registerKillSessionHandler = require('./registerKillSessionHandler-CcX84g-T.cjs');
|
|
24
24
|
var projectPath = require('./projectPath-ChLhdOyt.cjs');
|
|
25
25
|
var path = require('node:path');
|
|
26
|
-
var createSessionMetadata = require('./createSessionMetadata-
|
|
27
|
-
var deterministicJson = require('./deterministicJson-
|
|
26
|
+
var createSessionMetadata = require('./createSessionMetadata-2IuH5nlA.cjs');
|
|
27
|
+
var deterministicJson = require('./deterministicJson-je21npNx.cjs');
|
|
28
28
|
var messageBuffer = require('./messageBuffer-fJMH6uY8.cjs');
|
|
29
|
-
var controlClient = require('./controlClient-
|
|
30
|
-
var defaultPermissionMode = require('./defaultPermissionMode-
|
|
29
|
+
var controlClient = require('./controlClient-CtsQMw--.cjs');
|
|
30
|
+
var defaultPermissionMode = require('./defaultPermissionMode-Bn4HcU8S.cjs');
|
|
31
31
|
var authRelay = require('./authRelay-BdYkC1Po.cjs');
|
|
32
|
-
var setupOfflineReconnection = require('./setupOfflineReconnection-
|
|
32
|
+
var setupOfflineReconnection = require('./setupOfflineReconnection-CS_8Da8R.cjs');
|
|
33
33
|
var trimIdent = require('./trimIdent-4gvk9Wk6.cjs');
|
|
34
34
|
var constants = require('./constants-VJ0N6WuG.cjs');
|
|
35
35
|
var editPaths = require('./editPaths-Bqp4OFPw.cjs');
|
|
36
|
-
var ensureDaemonRunning = require('./ensureDaemonRunning-
|
|
36
|
+
var ensureDaemonRunning = require('./ensureDaemonRunning-bIp6-vgi.cjs');
|
|
37
37
|
require('tweetnacl');
|
|
38
38
|
require('axios');
|
|
39
|
-
require('./time-
|
|
40
|
-
require('./browser-
|
|
39
|
+
require('./time-0szhiPo4.cjs');
|
|
40
|
+
require('./browser-DmgVoopB.cjs');
|
|
41
41
|
require('open');
|
|
42
42
|
require('zod');
|
|
43
43
|
require('node:fs/promises');
|
|
44
|
-
require('./attachmentLimits-
|
|
44
|
+
require('./attachmentLimits-D6bT2jU1.cjs');
|
|
45
45
|
require('node:fs');
|
|
46
|
-
require('./lidState-
|
|
46
|
+
require('./lidState-BmJp2pLt.cjs');
|
|
47
47
|
require('os');
|
|
48
48
|
require('child_process');
|
|
49
49
|
require('node:events');
|
|
50
50
|
require('socket.io-client');
|
|
51
51
|
require('./limits-C-a7gr04.cjs');
|
|
52
|
-
require('./registerCommonHandlers-
|
|
52
|
+
require('./registerCommonHandlers-B7QZxkCL.cjs');
|
|
53
53
|
require('util');
|
|
54
54
|
require('fs/promises');
|
|
55
55
|
require('crypto');
|
|
56
56
|
require('path');
|
|
57
57
|
require('cross-spawn');
|
|
58
|
-
require('./sync-
|
|
58
|
+
require('./sync-BK-IBkuB.cjs');
|
|
59
59
|
require('./backgroundTaskActivity-CBvUdj39.cjs');
|
|
60
60
|
require('./contentLogMetadata-ZSFk_NjQ.cjs');
|
|
61
61
|
require('chalk');
|
|
@@ -63,36 +63,36 @@ require('node:readline');
|
|
|
63
63
|
require('./manager-HrEj442o.cjs');
|
|
64
64
|
require('@anthropic-ai/sandbox-runtime');
|
|
65
65
|
require('node:os');
|
|
66
|
-
require('./package-
|
|
67
|
-
require('./rateLimitWindows-
|
|
66
|
+
require('./package-VqWv7EI5.cjs');
|
|
67
|
+
require('./rateLimitWindows-Bp4T21RI.cjs');
|
|
68
68
|
require('node:util');
|
|
69
69
|
require('./detectCLI-DR9ZaN6B.cjs');
|
|
70
70
|
require('fs');
|
|
71
|
-
require('./localHappyAgentAuth-
|
|
71
|
+
require('./localHappyAgentAuth-9SP7hdiw.cjs');
|
|
72
72
|
require('./types-CRS-srZK.cjs');
|
|
73
73
|
require('url');
|
|
74
|
-
require('./client-
|
|
75
|
-
require('./context
|
|
76
|
-
require('./sessionOps-
|
|
74
|
+
require('./client-BHZVyQwi.cjs');
|
|
75
|
+
require('./context-BmH2BKip.cjs');
|
|
76
|
+
require('./sessionOps-9MChM9Op.cjs');
|
|
77
77
|
require('./resources-JDPugcDq.cjs');
|
|
78
|
-
require('./tools-
|
|
79
|
-
require('./reportProgressTool-
|
|
80
|
-
require('./client-
|
|
78
|
+
require('./tools-C77-Ssan.cjs');
|
|
79
|
+
require('./reportProgressTool-DzMi4mvH.cjs');
|
|
80
|
+
require('./client-BhLhjj_x.cjs');
|
|
81
81
|
require('./precheckCompat-CWOi5c9L.cjs');
|
|
82
82
|
require('./agentGuidance-BtBx2xxE.cjs');
|
|
83
|
-
require('./peerTools-
|
|
83
|
+
require('./peerTools-BktGmlpd.cjs');
|
|
84
84
|
require('./ids-B6ZC0HGt.cjs');
|
|
85
|
-
require('./remoteSessionClient-
|
|
85
|
+
require('./remoteSessionClient-CL3akj0K.cjs');
|
|
86
86
|
require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
87
87
|
require('node:http');
|
|
88
88
|
require('@modelcontextprotocol/sdk/server/streamableHttp.js');
|
|
89
|
-
require('./downloadTarget-
|
|
89
|
+
require('./downloadTarget-JC7FZl7W.cjs');
|
|
90
90
|
require('./terminals-B_bfC9c2.cjs');
|
|
91
91
|
require('./terminalTitleSuggest-DhvRFX3H.cjs');
|
|
92
92
|
require('./tmuxSocket-D-Xt6Vn-.cjs');
|
|
93
|
-
require('./bootstrap-
|
|
93
|
+
require('./bootstrap-DTJ6-vYT.cjs');
|
|
94
94
|
require('./previewPath-B0rBdhy1.cjs');
|
|
95
|
-
require('./spawnHappyCLI-
|
|
95
|
+
require('./spawnHappyCLI-DByQcqEN.cjs');
|
|
96
96
|
require('./doctorReadiness-BCZGcN0a.cjs');
|
|
97
97
|
|
|
98
98
|
function getStartedSubagents(state) {
|
|
@@ -1030,18 +1030,41 @@ function unsupportedEffortReason(catalog, model, effort) {
|
|
|
1030
1030
|
return `Reasoning effort "${effort}" is not supported by ${model ?? "the default model"}. Choose a supported level.`;
|
|
1031
1031
|
}
|
|
1032
1032
|
|
|
1033
|
+
const UNEXPECTED_STATUS = /^unexpected status (\d{3}) ([^:]*?):\s*([\s\S]*?)(?:,\s*url:\s*(\S+))?$/;
|
|
1033
1034
|
function readableCodexErrorText(text) {
|
|
1034
1035
|
const trimmed = text.trim();
|
|
1035
|
-
|
|
1036
|
+
const status = UNEXPECTED_STATUS.exec(trimmed);
|
|
1037
|
+
if (status) {
|
|
1038
|
+
const [, code, reason, rawBody, url] = status;
|
|
1039
|
+
const head = `HTTP ${code} ${reason.trim()} from the model API`;
|
|
1040
|
+
const detail = readableHttpBody(rawBody, `${code} ${reason}`);
|
|
1041
|
+
return `${head}${detail ? `: ${detail}` : ""}${url ? ` (${url})` : ""}`;
|
|
1042
|
+
}
|
|
1043
|
+
return unwrapJsonMessage(trimmed) ?? trimmed;
|
|
1044
|
+
}
|
|
1045
|
+
function unwrapJsonMessage(text) {
|
|
1046
|
+
if (!text.startsWith("{")) return null;
|
|
1036
1047
|
try {
|
|
1037
|
-
const body = JSON.parse(
|
|
1048
|
+
const body = JSON.parse(text);
|
|
1038
1049
|
const inner = typeof body.error === "object" && body.error ? body.error.message : void 0;
|
|
1039
1050
|
const message = typeof inner === "string" && inner.trim() ? inner : typeof body.error === "string" && body.error.trim() ? body.error : typeof body.message === "string" && body.message.trim() ? body.message : null;
|
|
1040
|
-
return message ? message.trim() :
|
|
1051
|
+
return message ? message.trim() : null;
|
|
1041
1052
|
} catch {
|
|
1042
|
-
return
|
|
1053
|
+
return null;
|
|
1043
1054
|
}
|
|
1044
1055
|
}
|
|
1056
|
+
function readableHttpBody(raw, statusLine) {
|
|
1057
|
+
let body = unwrapJsonMessage(raw.trim()) ?? raw.trim();
|
|
1058
|
+
if (/<[a-z!/][^>]*>/i.test(body)) {
|
|
1059
|
+
const title = /<title[^>]*>([\s\S]*?)<\/title>/i.exec(body);
|
|
1060
|
+
body = title ? title[1] : body.replace(/<[^>]+>/g, " ");
|
|
1061
|
+
}
|
|
1062
|
+
body = body.replace(/\s+/g, " ").trim();
|
|
1063
|
+
if (!body) return null;
|
|
1064
|
+
const normalize = (value) => value.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
1065
|
+
if (normalize(body) === normalize(statusLine)) return null;
|
|
1066
|
+
return body.length > 240 ? `${body.slice(0, 240)}\u2026` : body;
|
|
1067
|
+
}
|
|
1045
1068
|
function describeCodexFailure(msg) {
|
|
1046
1069
|
const hasFailure = msg?.status === "failed" || msg?.error !== void 0 && msg?.error !== null;
|
|
1047
1070
|
if (!hasFailure) return null;
|
|
@@ -1052,6 +1075,16 @@ function describeCodexFailure(msg) {
|
|
|
1052
1075
|
}
|
|
1053
1076
|
return "Unknown error";
|
|
1054
1077
|
}
|
|
1078
|
+
function describeCodexRetry(msg) {
|
|
1079
|
+
const message = typeof msg?.message === "string" ? msg.message.trim() : "";
|
|
1080
|
+
const status = typeof msg?.http_status === "number" ? msg.http_status : null;
|
|
1081
|
+
const cause = status ? `HTTP ${status} from the model API` : "a model API error";
|
|
1082
|
+
return message ? `Codex is retrying after ${cause} (${message})` : `Codex is retrying after ${cause}`;
|
|
1083
|
+
}
|
|
1084
|
+
function codexStderrTailOf(error) {
|
|
1085
|
+
const tail = error?.codexStderrTail;
|
|
1086
|
+
return typeof tail === "string" && tail.trim() ? tail.trim() : null;
|
|
1087
|
+
}
|
|
1055
1088
|
const TRANSPORT_LOSS = /^Codex process (exited|disconnected)\b|stdin not writable| timed out after \d+ms/;
|
|
1056
1089
|
function describeThrownTurnError(error) {
|
|
1057
1090
|
const message = error instanceof Error ? error.message : typeof error === "string" ? error : "";
|
|
@@ -1743,6 +1776,10 @@ async function runCodex(opts) {
|
|
|
1743
1776
|
} else {
|
|
1744
1777
|
messageBuffer$1.addMessage("Turn aborted", "status");
|
|
1745
1778
|
}
|
|
1779
|
+
} else if (msg.type === "turn_retry") {
|
|
1780
|
+
const notice = describeCodexRetry(msg);
|
|
1781
|
+
messageBuffer$1.addMessage(notice, "status");
|
|
1782
|
+
session.sendSessionEvent({ type: "message", message: notice });
|
|
1746
1783
|
}
|
|
1747
1784
|
if (msg.type === "task_started") {
|
|
1748
1785
|
if (!thinking) {
|
|
@@ -1957,6 +1994,10 @@ async function runCodex(opts) {
|
|
|
1957
1994
|
if (!message) {
|
|
1958
1995
|
break;
|
|
1959
1996
|
}
|
|
1997
|
+
if (!thinking) {
|
|
1998
|
+
thinking = true;
|
|
1999
|
+
session.keepAlive(thinking, "remote");
|
|
2000
|
+
}
|
|
1960
2001
|
idleRelease.cancel();
|
|
1961
2002
|
turnActive = true;
|
|
1962
2003
|
if (isCodexClearText(message.message)) {
|
|
@@ -2049,8 +2090,9 @@ async function runCodex(opts) {
|
|
|
2049
2090
|
messageBuffer$1.addMessage(`Task failed: ${reason}`, "status");
|
|
2050
2091
|
session.sendSessionEvent({ type: "message", message: `Codex error: ${reason}` });
|
|
2051
2092
|
} else {
|
|
2093
|
+
const tail = codexStderrTailOf(error);
|
|
2052
2094
|
messageBuffer$1.addMessage("Process exited unexpectedly", "status");
|
|
2053
|
-
session.sendSessionEvent({ type: "message", message: "Process exited unexpectedly" });
|
|
2095
|
+
session.sendSessionEvent({ type: "message", message: tail ? `Process exited unexpectedly: ${tail}` : "Process exited unexpectedly" });
|
|
2054
2096
|
}
|
|
2055
2097
|
} finally {
|
|
2056
2098
|
permissionHandler.reset();
|