very-happy-cli 0.2.175 → 0.2.177
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-Sb6N_HcB.cjs → AcpBackend-B-ny68XM.cjs} +188 -37
- package/dist/{AcpBackend-BZrLVcHb.mjs → AcpBackend-B0K0WrtW.mjs} +187 -38
- package/dist/{AcpSessionManager-C2MqOirs.cjs → AcpSessionManager-CjdJLofq.cjs} +1 -1
- package/dist/{AcpSessionManager-y1Iy1mzc.mjs → AcpSessionManager-DykjzBM4.mjs} +1 -1
- package/dist/{BasePermissionHandler-BbLYwd13.cjs → BasePermissionHandler-DR6nxuEn.cjs} +1 -1
- package/dist/{BasePermissionHandler-DriZLITp.mjs → BasePermissionHandler-hdY7kTqX.mjs} +1 -1
- package/dist/{agentHome-BoYfpemd.cjs → agentHome-BdTXEUPe.cjs} +4 -4
- package/dist/{agentHome-BtuRubHG.mjs → agentHome-GRN2VfHv.mjs} +4 -4
- package/dist/{api-KZmVqSKO.cjs → api-BWX10o97.cjs} +17 -10
- package/dist/{api-D08IEaWa.mjs → api-CKBViqI3.mjs} +18 -11
- package/dist/{apiMachine-Dct2GDAq.cjs → apiMachine-BYYFGgFs.cjs} +15 -14
- package/dist/{apiMachine-Cx9Zn-78.mjs → apiMachine-DttO4UFj.mjs} +15 -14
- package/dist/{attachmentContent-PrNJg8gG.mjs → attachmentContent-cPVF463_.mjs} +2 -2
- package/dist/{attachmentContent-4L9dO8E3.cjs → attachmentContent-kJKXpkMX.cjs} +2 -2
- package/dist/{attachmentLimits-BLbji11b.mjs → attachmentLimits-Di1Z93lN.mjs} +1 -1
- package/dist/{attachmentLimits-D6bT2jU1.cjs → attachmentLimits-DtFqqiwR.cjs} +1 -1
- package/dist/{auth-D1qHU-i_.mjs → auth-BmESeKuM.mjs} +5 -5
- package/dist/{auth-PY_HGlzz.mjs → auth-CKdXb9zp.mjs} +8 -8
- package/dist/{auth-BGmM3Vlm.cjs → auth-CTECt2Oz.cjs} +5 -5
- package/dist/{auth-BI0CsMcy.cjs → auth-DNxVmVbn.cjs} +8 -8
- package/dist/{auto-COMphIfD.mjs → auto-Ch3203qd.mjs} +17 -16
- package/dist/{auto-DM4_FeKb.cjs → auto-D1ypjjfx.cjs} +16 -15
- package/dist/{backgroundTaskActivity-8PdPxrvy.mjs → backgroundTaskActivity-BVwJBl02.mjs} +1 -1
- package/dist/{bootstrap-DTJ6-vYT.cjs → bootstrap-6OI698q9.cjs} +2 -2
- package/dist/{bootstrap-CWjpC5-J.mjs → bootstrap-C0s2bPFQ.mjs} +2 -2
- package/dist/{browser-xuW4fiHo.mjs → browser-BlLWZUMx.mjs} +1 -1
- package/dist/{browser-DmgVoopB.cjs → browser-DG6Uof5O.cjs} +1 -1
- package/dist/{claudeLocal-B0P-wVJJ.mjs → claudeLocal-CcWcKnoo.mjs} +5 -5
- package/dist/{claudeLocal-CtZVz3ee.cjs → claudeLocal-CemsIArT.cjs} +5 -5
- package/dist/{claudeLocalLauncher-D4vmjI3c.mjs → claudeLocalLauncher-7p6y88nj.mjs} +15 -18
- package/dist/{claudeLocalLauncher-Dnv4CH8r.cjs → claudeLocalLauncher-A4VuevIi.cjs} +15 -18
- package/dist/{claudeSessionFork-CxjOBoBh.mjs → claudeSessionFork-BtROOjqf.mjs} +1 -1
- package/dist/{claudeSessionFork-DQk5-dzR.cjs → claudeSessionFork-CbDfm8Fz.cjs} +1 -1
- package/dist/{client-eQjOvC55.mjs → client-BPMWutfs.mjs} +3 -3
- package/dist/{client-BhLhjj_x.cjs → client-COmgDDy0.cjs} +2 -2
- package/dist/{client-C4ddTzrD.mjs → client-DG5ndWLw.mjs} +2 -2
- package/dist/{client-BHZVyQwi.cjs → client-DyvBTYee.cjs} +3 -3
- package/dist/codex/happyMcpStdioBridge.cjs +15 -15
- package/dist/codex/happyMcpStdioBridge.mjs +16 -16
- package/dist/{codexAppServerClient-CppPl_R6.mjs → codexAppServerClient-D-Z8qSfI.mjs} +233 -24
- package/dist/{codexAppServerClient-D-9z-lWP.cjs → codexAppServerClient-R24WZZfg.cjs} +233 -24
- package/dist/{codexCommand-AgVJYnFU.cjs → codexCommand-6hW19gsq.cjs} +159 -84
- package/dist/{codexCommand-BdrBNbZu.mjs → codexCommand-CVTkZJ1o.mjs} +158 -83
- package/dist/{BaseReasoningProcessor-_S1PbSvH.cjs → codexTermination-BBU7e92y.cjs} +25 -1
- package/dist/{BaseReasoningProcessor-DnykPlPo.mjs → codexTermination-CCIfwzcx.mjs} +25 -2
- package/dist/{config-Cr3VUzbE.mjs → config-CvsNChKX.mjs} +3 -3
- package/dist/{config-D89sE3wK.cjs → config-DhdrvOLV.cjs} +3 -3
- package/dist/{configuration-BNGPXg07.mjs → configuration-D55F0t16.mjs} +1 -1
- package/dist/{configuration-UV4EE5ui.cjs → configuration-DZPy0T9Z.cjs} +1 -1
- package/dist/{connect-C0iLkCiY.mjs → connect-CwCXMRmD.mjs} +14 -14
- package/dist/{connect-B35YXbdZ.cjs → connect-Wz-XZYXW.cjs} +13 -13
- package/dist/{context-BmH2BKip.cjs → context-BKbrZ55r.cjs} +1 -1
- package/dist/{context-Ptdnlcv6.mjs → context-CCRpVXFo.mjs} +1 -1
- package/dist/{controlClient-DqtC0pq1.mjs → controlClient-C4xB5J6O.mjs} +4 -4
- package/dist/{controlClient-CtsQMw--.cjs → controlClient-SX8gSza2.cjs} +3 -3
- package/dist/{createSessionMetadata-2IuH5nlA.cjs → createSessionMetadata-BCFmYlBo.cjs} +2 -2
- package/dist/{createSessionMetadata-CtNMvfth.mjs → createSessionMetadata-Bi-m0Y_O.mjs} +2 -2
- package/dist/{defaultPermissionMode-Bn4HcU8S.cjs → defaultPermissionMode-DMBEnXll.cjs} +2 -2
- package/dist/{defaultPermissionMode-DYihjV2g.mjs → defaultPermissionMode-wBcbBezm.mjs} +2 -2
- package/dist/{deterministicJson-DF4xv6MH.mjs → deterministicJson-BkQETt8_.mjs} +9 -9
- package/dist/{deterministicJson-je21npNx.cjs → deterministicJson-ChGfQEF6.cjs} +9 -9
- package/dist/{doctor-Ba92L7-b.mjs → doctor-B9c2C9dF.mjs} +8 -8
- package/dist/{doctor-BXKcYVGU.cjs → doctor-BsN3JZJn.cjs} +7 -7
- package/dist/{downloadTarget-CUJg8iJV.mjs → downloadTarget-ByXzbDK4.mjs} +6 -6
- package/dist/{downloadTarget-JC7FZl7W.cjs → downloadTarget-Dj3WoVJa.cjs} +6 -6
- package/dist/{ensureDaemonRunning-JPA9tHNE.mjs → ensureDaemonRunning--HYzs5Ce.mjs} +5 -5
- package/dist/{ensureDaemonRunning-bIp6-vgi.cjs → ensureDaemonRunning-7Wb8M7Lv.cjs} +5 -5
- package/dist/{handleResumeCommand-B6lE5DtU.mjs → handleResumeCommand-DHddBkNJ.mjs} +5 -5
- package/dist/{handleResumeCommand-B6b9kIYf.cjs → handleResumeCommand-OmuUGYjQ.cjs} +5 -5
- package/dist/{index-B2KL0aPc.cjs → index-BRJzH4sc.cjs} +141 -87
- package/dist/{index-CjE4kBKx.mjs → index-BzJNDsJq.mjs} +143 -89
- package/dist/{index-B6UGRQ7h.mjs → index-CEjJnq05.mjs} +3 -0
- package/dist/{index-CZLwo1FS.mjs → index-CEm0MYiS.mjs} +3 -3
- package/dist/{index-B1ABQRrB.cjs → index-CrR4JISa.cjs} +4 -4
- package/dist/{index-D759ViMU.cjs → index-D9NoYc5I.cjs} +3 -3
- package/dist/{index-D3kI0hDR.cjs → index-DFPT4HOO.cjs} +3 -0
- package/dist/{index-boE-d8CM.mjs → index-DMy3OCBe.mjs} +8 -1
- package/dist/{index-BZdhwBKa.cjs → index-De8L5lFK.cjs} +8 -0
- package/dist/{index-DW1ONaGc.mjs → index-Dhl6_bw7.mjs} +4 -4
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{install-KjIsK_EA.cjs → install-1qn-D9FS.cjs} +3 -3
- package/dist/{install-CmojqnLK.mjs → install-BDIUtPXi.mjs} +3 -3
- package/dist/lib.cjs +12 -12
- package/dist/lib.d.cts +7 -1
- package/dist/lib.d.mts +7 -1
- package/dist/lib.mjs +13 -13
- package/dist/{lidState-CL1NdKfQ.mjs → lidState-BqVsw7H1.mjs} +1 -1
- package/dist/{lidState-BmJp2pLt.cjs → lidState-DxbK0qfu.cjs} +1 -1
- package/dist/{localHappyAgentAuth-B7f4Ysn0.mjs → localHappyAgentAuth-Ce8kO2yc.mjs} +1 -1
- package/dist/{localHappyAgentAuth-9SP7hdiw.cjs → localHappyAgentAuth-D5tANdRD.cjs} +1 -1
- package/dist/{logger-D5EzMy30.mjs → logger-13cBr_ew.mjs} +2 -2
- package/dist/{logger-C7dRaCkE.cjs → logger-LvwVeATU.cjs} +2 -2
- package/dist/{machineMetadata-DYYuK_0c.cjs → machineMetadata-29h7vgf4.cjs} +3 -3
- package/dist/{machineMetadata-DqplCWue.mjs → machineMetadata-dMida2qq.mjs} +3 -3
- package/dist/{main-kgCQgknK.cjs → main-DpM5jaFH.cjs} +44 -44
- package/dist/{main-CnV62agu.mjs → main-x4nAhdH5.mjs} +44 -44
- package/dist/{mcp-bDPaj-tM.mjs → mcp-DMiFGYMT.mjs} +15 -15
- package/dist/{mcp-BV0vxHtz.cjs → mcp-DQv3caXs.cjs} +14 -14
- package/dist/{mirrorProtocol-BSHVZ8Nf.cjs → mirrorProtocol-BfrERW7Z.cjs} +3 -3
- package/dist/{mirrorProtocol-ClKhNXYe.mjs → mirrorProtocol-Bz8tEabR.mjs} +3 -3
- package/dist/{package-VqWv7EI5.cjs → package-Ch9WGDV_.cjs} +7 -7
- package/dist/{package-D0dxZ-W8.mjs → package-CjlsAaRe.mjs} +7 -7
- package/dist/{peerTools-B_eiNB3P.mjs → peerTools-CxmrKnfV.mjs} +4 -4
- package/dist/{peerTools-BktGmlpd.cjs → peerTools-DtGKWli5.cjs} +4 -4
- package/dist/{persistence-CIIhP0Uw.mjs → persistence-C_tYtOqK.mjs} +2 -2
- package/dist/{persistence-DweHi8xa.cjs → persistence-DXbKOHxl.cjs} +2 -2
- package/dist/{piRunnerArgs-BNzWTNRV.cjs → piRunnerArgs-BVRZe2AR.cjs} +1 -1
- package/dist/{piRunnerArgs-cQafsadv.mjs → piRunnerArgs-BpHc-JZl.mjs} +1 -1
- package/dist/{piRuntime-VZLSwW-4.cjs → piRuntime-D7eio8Ix.cjs} +1 -1
- package/dist/{piRuntime-Bel5lOLb.mjs → piRuntime-DOdGF395.mjs} +1 -1
- package/dist/{piTerminal-CS5SDi_H.mjs → piTerminal-dpxz4Q8D.mjs} +17 -17
- package/dist/{piTerminal-DkR8sPv-.cjs → piTerminal-y_PRo2NY.cjs} +16 -16
- package/dist/processTree-CMHWlVse.cjs +66 -0
- package/dist/processTree-CP5IvQ2Z.mjs +61 -0
- package/dist/{rateLimitWindows-Bp4T21RI.cjs → rateLimitWindows-DFnMU2Vt.cjs} +1 -1
- package/dist/{rateLimitWindows-Bo6XVnie.mjs → rateLimitWindows-DYHDGuzQ.mjs} +1 -1
- package/dist/{registerCommonHandlers-B7QZxkCL.cjs → registerCommonHandlers-60VuTkdg.cjs} +2 -2
- package/dist/{registerCommonHandlers-CR5jpiSx.mjs → registerCommonHandlers-D8OMpBbQ.mjs} +2 -2
- package/dist/{registerKillSessionHandler-DLiu24CQ.mjs → registerKillSessionHandler-Drhf7-Vz.mjs} +6 -6
- package/dist/{registerKillSessionHandler-CcX84g-T.cjs → registerKillSessionHandler-pqChBKwO.cjs} +6 -6
- package/dist/{remoteSessionClient-CL3akj0K.cjs → remoteSessionClient-B7NvjHD3.cjs} +5 -5
- package/dist/{remoteSessionClient-CUjw1COc.mjs → remoteSessionClient-D01Hso2-.mjs} +5 -5
- package/dist/{reportProgressTool-BLLwMQrN.mjs → reportProgressTool-B203EZCR.mjs} +2 -2
- package/dist/{reportProgressTool-DzMi4mvH.cjs → reportProgressTool-Du_zAK4h.cjs} +2 -2
- package/dist/{run-DGokR_6q.mjs → run-DX4Zs3Ug.mjs} +34 -34
- package/dist/{run-5pmOElaW.cjs → run-DZ5jU53c.cjs} +34 -34
- package/dist/{runClaude-BFlpZQds.mjs → runClaude-CgPHXP0L.mjs} +27 -23
- package/dist/{runClaude-EnYNvkV0.cjs → runClaude-ClRhHpwR.cjs} +26 -22
- package/dist/{runClaudeDeps-CUDebE9e.cjs → runClaudeDeps-D2v_WDSL.cjs} +387 -89
- package/dist/{runClaudeDeps-D1M1dzlZ.mjs → runClaudeDeps-Dz2iydq4.mjs} +393 -95
- package/dist/{runGemini-Bu69Zu1u.cjs → runGemini-BtZqGFkp.cjs} +208 -193
- package/dist/{runGemini-Bub8T5cM.mjs → runGemini-DBXxpoY8.mjs} +208 -193
- package/dist/{runOpenClaw-DVu73F_i.mjs → runOpenClaw-BOHpzCEU.mjs} +19 -19
- package/dist/{runOpenClaw-Cob5F3FC.cjs → runOpenClaw-D8q8G57u.cjs} +18 -18
- package/dist/{sandbox-9EKOFyQF.mjs → sandbox-C452Vrsc.mjs} +4 -4
- package/dist/{sandbox-GDqMagSF.cjs → sandbox-Cu9mMzjx.cjs} +4 -4
- package/dist/selfCheck-BAvqBwBR.mjs +84 -0
- package/dist/{selfCheck-DiNo34da.cjs → selfCheck-gKa3uVr1.cjs} +35 -35
- package/dist/{send-ThC80164.cjs → send-2Vb5eppI.cjs} +8 -8
- package/dist/{send-wgtHphq8.mjs → send-B8HARi7x.mjs} +9 -9
- package/dist/{server-Bb8v2fOj.mjs → server-BBWCIZyS.mjs} +4 -4
- package/dist/{server-bidHnstE.cjs → server-Db9Wuam3.cjs} +6 -6
- package/dist/{sessionLock-BWBcBZKh.cjs → sessionLock-6qL_N6Rn.cjs} +3 -3
- package/dist/{sessionLock-gb32sVPR.mjs → sessionLock-ZfvFVdUi.mjs} +3 -3
- package/dist/{sessionModeFile-C-fr1M1h.mjs → sessionModeFile-CWVq8AT9.mjs} +1 -1
- package/dist/{sessionModeFile-DhuTNcJr.cjs → sessionModeFile-CsLtn_PL.cjs} +1 -1
- package/dist/{sessionOps-ByZJbkMq.mjs → sessionOps-CdgbEJgf.mjs} +5 -5
- package/dist/{sessionOps-9MChM9Op.cjs → sessionOps-Dmt7WUUs.cjs} +4 -4
- package/dist/{sessionScanner-CxXPAVyS.mjs → sessionScanner-CNVaSNOn.mjs} +34 -4
- package/dist/{sessionScanner-BpegdnXK.cjs → sessionScanner-CQL_WSaC.cjs} +34 -3
- package/dist/{sessions-C1X4z_Lm.cjs → sessions-BJblG_Hx.cjs} +9 -9
- package/dist/{sessions-l-UgJGjV.mjs → sessions-DTomHfFg.mjs} +10 -10
- package/dist/{setupOfflineReconnection-CgtXlV74.mjs → setupOfflineReconnection-C5trsV-j.mjs} +2 -2
- package/dist/{setupOfflineReconnection-CS_8Da8R.cjs → setupOfflineReconnection-DVA0VpQL.cjs} +2 -2
- package/dist/{spawn-FyoHqYWo.mjs → spawn-CQJFgoOq.mjs} +15 -14
- package/dist/{spawn-D2BlNdZu.cjs → spawn-DRyNAqD8.cjs} +14 -13
- package/dist/{spawnAgents-BhsbJ253.mjs → spawnAgents-BjtmjBvP.mjs} +1 -1
- package/dist/{spawnAgents-CgMKuOhZ.cjs → spawnAgents-CCjJifAW.cjs} +1 -1
- package/dist/{spawnHappyCLI-DsC256j_.mjs → spawnHappyCLI-B_0RWxD4.mjs} +1 -1
- package/dist/{spawnHappyCLI-DByQcqEN.cjs → spawnHappyCLI-ChniczJ5.cjs} +1 -1
- package/dist/{specialCommands-DGUeZqdm.cjs → specialCommands-DbntVs0d.cjs} +3 -3
- package/dist/{specialCommands-DUUBqzvd.mjs → specialCommands-DkdFJi4N.mjs} +3 -3
- package/dist/{startFileWatcher-BtBaahTn.cjs → startFileWatcher-C292fhra.cjs} +1 -1
- package/dist/{startFileWatcher-CaYRObJu.mjs → startFileWatcher-UQyTSRAP.mjs} +1 -1
- package/dist/{streamRelay-DqPFsCgx.cjs → streamRelay-Cx01enfe.cjs} +1 -1
- package/dist/{streamRelay-C8zI7OnR.mjs → streamRelay-_qCd873P.mjs} +1 -1
- package/dist/{sync-D5YqUVjS.mjs → sync-C3p7-KLn.mjs} +1 -1
- package/dist/{sync-BK-IBkuB.cjs → sync-C7sxoUYG.cjs} +1 -1
- package/dist/{systemPrompt-e-qeag_h.mjs → systemPrompt-CdHOlyVW.mjs} +2 -2
- package/dist/{systemPrompt-DaTKLEb-.cjs → systemPrompt-DtibzbRU.cjs} +2 -2
- package/dist/{teams-D9xwa_d3.cjs → teams-D7O7TpVU.cjs} +6 -6
- package/dist/{teams-ClrppvKu.mjs → teams-ujXr3AFn.mjs} +6 -6
- package/dist/{time-0szhiPo4.cjs → time-Dg5tVB8S.cjs} +1 -1
- package/dist/{time-CvrpeD3S.mjs → time-yEL6wHUF.mjs} +1 -1
- package/dist/{titleGenerator-Dz5P7sE1.cjs → titleGenerator-BMEaDTwU.cjs} +2 -2
- package/dist/{titleGenerator-BZ5770wq.mjs → titleGenerator-Dr-BtjzO.mjs} +1 -1
- package/dist/{todo-CkmNJQey.cjs → todo-CUcFamGs.cjs} +6 -6
- package/dist/{todo-o-miKcN2.mjs → todo-CvJe4M2C.mjs} +6 -6
- package/dist/{tools-Cp0qJeBq.mjs → tools-BrM3bZW5.mjs} +1 -1
- package/dist/{tools-C77-Ssan.cjs → tools-DDKTB5aQ.cjs} +1 -1
- package/dist/{uninstall-DGUPERDX.cjs → uninstall-7oLuhYIu.cjs} +3 -3
- package/dist/{uninstall-jNJDCLD_.mjs → uninstall-CEcMMQGz.mjs} +3 -3
- package/package.json +7 -7
- package/dist/selfCheck-CNo4uzGB.mjs +0 -84
|
@@ -3,12 +3,52 @@
|
|
|
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-LvwVeATU.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-Ch9WGDV_.cjs');
|
|
10
|
+
var rateLimitWindows = require('./rateLimitWindows-DFnMU2Vt.cjs');
|
|
11
|
+
var processTree = require('./processTree-CMHWlVse.cjs');
|
|
11
12
|
|
|
13
|
+
const CODEX_HELPER_LABEL_MAX_CHARS = 80;
|
|
14
|
+
function codexHelperLabel(prompt) {
|
|
15
|
+
if (typeof prompt !== "string") return null;
|
|
16
|
+
const collapsed = prompt.replace(/\s+/g, " ").trim();
|
|
17
|
+
if (collapsed.length === 0) return null;
|
|
18
|
+
if (collapsed.length <= CODEX_HELPER_LABEL_MAX_CHARS) return collapsed;
|
|
19
|
+
const keep = CODEX_HELPER_LABEL_MAX_CHARS - 1;
|
|
20
|
+
const last = collapsed.charCodeAt(keep - 1);
|
|
21
|
+
const end = last >= 55296 && last <= 56319 ? keep - 1 : keep;
|
|
22
|
+
return `${collapsed.slice(0, end)}\u2026`;
|
|
23
|
+
}
|
|
24
|
+
function codexAgentPathSegments(agentPath) {
|
|
25
|
+
if (typeof agentPath !== "string") return [];
|
|
26
|
+
return agentPath.split("/").map((segment) => segment.trim()).filter((segment) => segment.length > 0);
|
|
27
|
+
}
|
|
28
|
+
function isRootAgentPath(segments) {
|
|
29
|
+
return segments.length === 1 && segments[0] === "root";
|
|
30
|
+
}
|
|
31
|
+
function codexChildAnnouncements(item) {
|
|
32
|
+
if (item.type === "subAgentActivity") {
|
|
33
|
+
const threadId = item.agentThreadId;
|
|
34
|
+
if (typeof threadId !== "string" || threadId.length === 0) return [];
|
|
35
|
+
const segments = codexAgentPathSegments(item.agentPath);
|
|
36
|
+
if (isRootAgentPath(segments)) return [];
|
|
37
|
+
const leaf = segments.at(-1);
|
|
38
|
+
return [{ threadId, label: leaf && leaf.length > 0 ? leaf : null }];
|
|
39
|
+
}
|
|
40
|
+
if (item.type === "collabAgentToolCall") {
|
|
41
|
+
const receivers = Array.isArray(item.receiverThreadIds) ? item.receiverThreadIds.filter((id) => typeof id === "string" && id.length > 0) : [];
|
|
42
|
+
const label = item.tool === "spawnAgent" ? codexHelperLabel(item.prompt) : null;
|
|
43
|
+
return [...new Set(receivers)].map((threadId) => ({ threadId, label }));
|
|
44
|
+
}
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function jsonRpcErrorCodeOf(error) {
|
|
49
|
+
const code = error?.jsonRpcCode;
|
|
50
|
+
return typeof code === "number" ? code : null;
|
|
51
|
+
}
|
|
12
52
|
function isAppServerAvailable() {
|
|
13
53
|
try {
|
|
14
54
|
const version = node_child_process.execSync("codex --version", { encoding: "utf8", windowsHide: true }).trim();
|
|
@@ -123,6 +163,18 @@ class CodexAppServerClient {
|
|
|
123
163
|
// Approval / elicitation requests we are still answering: a human may take
|
|
124
164
|
// longer than the watchdog to decide, and that is not Codex going silent.
|
|
125
165
|
inflightServerRequests = 0;
|
|
166
|
+
// B-628: `turn/steer` — a message sent into the running turn (approach from Orca,
|
|
167
|
+
// src/main/codex/codex-structured-turn-start.ts). This app-server has no such
|
|
168
|
+
// method (-32601) until it is respawned; a refusal is per call (the turn it named
|
|
169
|
+
// ended or changed meanwhile, a review/compact turn).
|
|
170
|
+
steerUnsupported = false;
|
|
171
|
+
/** Steered inputs Codex has not echoed back as a `userMessage` item yet: clientId → turnId. */
|
|
172
|
+
steeredAwaitingEcho = /* @__PURE__ */ new Map();
|
|
173
|
+
/** Waiters for the pending turn to open (steerTurn); released when it opens or ends. */
|
|
174
|
+
turnOpenWaiters = [];
|
|
175
|
+
/** B-628: the names Codex gave the child threads it spawned (see codexChildThreads.ts). */
|
|
176
|
+
childThreadLabels = /* @__PURE__ */ new Map();
|
|
177
|
+
static MAX_CHILD_LABELS = 128;
|
|
126
178
|
// Handlers set by the consumer (runCodex.ts)
|
|
127
179
|
eventHandler = null;
|
|
128
180
|
approvalHandler = null;
|
|
@@ -193,6 +245,58 @@ class CodexAppServerClient {
|
|
|
193
245
|
const threadId = this.extractThreadId(params);
|
|
194
246
|
return threadId === null || this._threadId === null || threadId === this._threadId;
|
|
195
247
|
}
|
|
248
|
+
/** B-628: the child thread a frame belongs to, or null for the session's own. */
|
|
249
|
+
childThreadIdOf(params) {
|
|
250
|
+
return this.isOwnThreadFrame(params) ? null : this.extractThreadId(params);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* B-628: what a child thread's item carries so the mapper files it under the child's
|
|
254
|
+
* card (`subagent` → the session protocol's sub-agent envelope, as a Claude Task's
|
|
255
|
+
* children are) instead of in the main conversation as the session's own work.
|
|
256
|
+
*/
|
|
257
|
+
childItemFields(params) {
|
|
258
|
+
const child = this.childThreadIdOf(params);
|
|
259
|
+
if (!child) return {};
|
|
260
|
+
const label = this.childThreadLabels.get(child);
|
|
261
|
+
return { subagent: child, ...label ? { subagent_label: label } : {} };
|
|
262
|
+
}
|
|
263
|
+
rememberChildLabels(item) {
|
|
264
|
+
for (const { threadId, label } of codexChildAnnouncements(item)) {
|
|
265
|
+
if (!label || this.childThreadLabels.has(threadId)) continue;
|
|
266
|
+
if (this.childThreadLabels.size >= CodexAppServerClient.MAX_CHILD_LABELS) {
|
|
267
|
+
const oldest = this.childThreadLabels.keys().next().value;
|
|
268
|
+
if (oldest !== void 0) this.childThreadLabels.delete(oldest);
|
|
269
|
+
}
|
|
270
|
+
this.childThreadLabels.set(threadId, label);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* B-628: steered inputs the ended turn never echoed. `report` = the turn did not complete
|
|
275
|
+
* (interrupted, failed, app-server gone, given up): Codex never read them, tell the runner.
|
|
276
|
+
* A turn that *completed* drains its pending input before it ends (core/src/session/turn.rs),
|
|
277
|
+
* so an unechoed input there is a codex that accepted the steer but echoes no `clientId` —
|
|
278
|
+
* forgotten silently, because a false「not delivered」on a message the model did read would
|
|
279
|
+
* be worse than today's silence.
|
|
280
|
+
*/
|
|
281
|
+
dropUnechoedSteers(turnId, report) {
|
|
282
|
+
const dropped = [];
|
|
283
|
+
for (const [clientId, steeredTurn] of this.steeredAwaitingEcho) {
|
|
284
|
+
if (turnId === null || steeredTurn === turnId) {
|
|
285
|
+
dropped.push(clientId);
|
|
286
|
+
this.steeredAwaitingEcho.delete(clientId);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
if (dropped.length === 0) return;
|
|
290
|
+
if (!report) {
|
|
291
|
+
logger.logger.debug(`[CodexAppServer] ${dropped.length} steered message(s) completed without an echo; not reported`);
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
this.eventHandler?.({
|
|
295
|
+
type: "steer_dropped",
|
|
296
|
+
client_ids: dropped,
|
|
297
|
+
...turnId ? { turn_id: turnId } : {}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
196
300
|
/** Codex's last stderr lines, one line, for a message a person reads. */
|
|
197
301
|
stderrTail() {
|
|
198
302
|
return this.stderrRing.replace(/\x1b\[[0-9;]*m/g, "").replace(/\s+/g, " ").trim();
|
|
@@ -227,6 +331,7 @@ class CodexAppServerClient {
|
|
|
227
331
|
this.completedTurnIds.add(turnId);
|
|
228
332
|
if (failed) this.failedTurnIds.add(turnId);
|
|
229
333
|
}
|
|
334
|
+
this.dropUnechoedSteers(turnId, aborted || failed);
|
|
230
335
|
if (aborted) {
|
|
231
336
|
this.eventHandler?.({
|
|
232
337
|
type: "turn_aborted",
|
|
@@ -266,6 +371,11 @@ class CodexAppServerClient {
|
|
|
266
371
|
if (method === "turn/completed") {
|
|
267
372
|
if (!this.isOwnThreadFrame(params)) {
|
|
268
373
|
logger.logger.debug(`[CodexAppServer] Child thread ${this.extractThreadId(params)} ended a turn`);
|
|
374
|
+
this.eventHandler?.({
|
|
375
|
+
type: "subagent_turn_end",
|
|
376
|
+
...this.childItemFields(params),
|
|
377
|
+
status: this.extractTurnStatus(params)
|
|
378
|
+
});
|
|
269
379
|
return true;
|
|
270
380
|
}
|
|
271
381
|
this.emitRawTurnCompletion(
|
|
@@ -298,6 +408,7 @@ class CodexAppServerClient {
|
|
|
298
408
|
return true;
|
|
299
409
|
}
|
|
300
410
|
if (method === "thread/tokenUsage/updated") {
|
|
411
|
+
if (!this.isOwnThreadFrame(params)) return true;
|
|
301
412
|
const tokenUsage = params?.tokenUsage;
|
|
302
413
|
if (tokenUsage && typeof tokenUsage === "object") {
|
|
303
414
|
this.eventHandler?.({
|
|
@@ -311,8 +422,15 @@ class CodexAppServerClient {
|
|
|
311
422
|
if (!item || typeof item !== "object") {
|
|
312
423
|
return method.startsWith("item/");
|
|
313
424
|
}
|
|
425
|
+
const child = this.childItemFields(params);
|
|
314
426
|
if ((method === "item/started" || method === "item/completed") && (item.type === "collabAgentToolCall" || item.type === "subAgentActivity")) {
|
|
315
|
-
this.
|
|
427
|
+
this.rememberChildLabels(item);
|
|
428
|
+
this.eventHandler?.({ type: "collab_agent_item", item, ...child });
|
|
429
|
+
return true;
|
|
430
|
+
}
|
|
431
|
+
if (method === "item/completed" && item.type === "userMessage") {
|
|
432
|
+
const clientId = typeof item.clientId === "string" ? item.clientId : null;
|
|
433
|
+
if (clientId && !child.subagent) this.steeredAwaitingEcho.delete(clientId);
|
|
316
434
|
return true;
|
|
317
435
|
}
|
|
318
436
|
if (method === "item/started" && item.type === "commandExecution") {
|
|
@@ -323,7 +441,8 @@ class CodexAppServerClient {
|
|
|
323
441
|
callId,
|
|
324
442
|
command: item.command,
|
|
325
443
|
cwd: item.cwd,
|
|
326
|
-
description: item.command
|
|
444
|
+
description: item.command,
|
|
445
|
+
...child
|
|
327
446
|
});
|
|
328
447
|
return true;
|
|
329
448
|
}
|
|
@@ -338,7 +457,8 @@ class CodexAppServerClient {
|
|
|
338
457
|
duration_ms: item.durationMs ?? null,
|
|
339
458
|
status: item.status,
|
|
340
459
|
cwd: item.cwd,
|
|
341
|
-
command: item.command
|
|
460
|
+
command: item.command,
|
|
461
|
+
...child
|
|
342
462
|
});
|
|
343
463
|
return true;
|
|
344
464
|
}
|
|
@@ -353,7 +473,8 @@ class CodexAppServerClient {
|
|
|
353
473
|
type: "patch_apply_begin",
|
|
354
474
|
call_id: callId,
|
|
355
475
|
callId,
|
|
356
|
-
changes: changes ?? {}
|
|
476
|
+
changes: changes ?? {},
|
|
477
|
+
...child
|
|
357
478
|
});
|
|
358
479
|
return true;
|
|
359
480
|
}
|
|
@@ -362,7 +483,8 @@ class CodexAppServerClient {
|
|
|
362
483
|
type: "patch_apply_end",
|
|
363
484
|
call_id: callId,
|
|
364
485
|
callId,
|
|
365
|
-
status: item.status
|
|
486
|
+
status: item.status,
|
|
487
|
+
...child
|
|
366
488
|
});
|
|
367
489
|
if (callId && (item.status === "completed" || item.status === "failed" || item.status === "declined")) {
|
|
368
490
|
this.rawFileChangesByItemId.delete(callId);
|
|
@@ -377,7 +499,8 @@ class CodexAppServerClient {
|
|
|
377
499
|
type: "agent_message",
|
|
378
500
|
message: text,
|
|
379
501
|
item_id: item.id,
|
|
380
|
-
phase: item.phase
|
|
502
|
+
phase: item.phase,
|
|
503
|
+
...child
|
|
381
504
|
});
|
|
382
505
|
}
|
|
383
506
|
return true;
|
|
@@ -450,6 +573,7 @@ class CodexAppServerClient {
|
|
|
450
573
|
}
|
|
451
574
|
if (this.pendingTurnCompletion) {
|
|
452
575
|
const turnId = this.pendingTurnCompletion.turnId ?? this._turnId;
|
|
576
|
+
this.dropUnechoedSteers(null, true);
|
|
453
577
|
this.eventHandler?.({
|
|
454
578
|
type: "turn_aborted",
|
|
455
579
|
reason: "process-exit",
|
|
@@ -460,6 +584,9 @@ class CodexAppServerClient {
|
|
|
460
584
|
this.resolvePendingTurn(true);
|
|
461
585
|
});
|
|
462
586
|
this.stderrRing = "";
|
|
587
|
+
this.steerUnsupported = false;
|
|
588
|
+
this.steeredAwaitingEcho.clear();
|
|
589
|
+
this.childThreadLabels.clear();
|
|
463
590
|
proc.stderr?.on("data", (chunk) => {
|
|
464
591
|
if (this.process !== proc || this.processEpoch !== epoch) return;
|
|
465
592
|
const text = chunk.toString().trim();
|
|
@@ -498,20 +625,12 @@ ${text}`.slice(-400);
|
|
|
498
625
|
logger.logger.debug(`[CodexAppServer] Disconnecting; pid=${pid ?? "none"}`);
|
|
499
626
|
this.readline?.close();
|
|
500
627
|
this.readline = null;
|
|
501
|
-
|
|
502
|
-
proc
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
const killTimer = setTimeout(() => {
|
|
508
|
-
try {
|
|
509
|
-
process.kill(pid, 0);
|
|
510
|
-
process.kill(pid, "SIGKILL");
|
|
511
|
-
} catch {
|
|
512
|
-
}
|
|
513
|
-
}, 2e3);
|
|
514
|
-
killTimer.unref();
|
|
628
|
+
if (proc) {
|
|
629
|
+
processTree.stopProcessGracefully(proc);
|
|
630
|
+
if (pid) {
|
|
631
|
+
const killTimer = setTimeout(() => processTree.killProcessTree(proc), CodexAppServerClient.FORCE_KILL_AFTER_MS);
|
|
632
|
+
killTimer.unref();
|
|
633
|
+
}
|
|
515
634
|
}
|
|
516
635
|
this.process = null;
|
|
517
636
|
this.connected = false;
|
|
@@ -530,6 +649,7 @@ ${text}`.slice(-400);
|
|
|
530
649
|
req.reject(new Error(`Codex process disconnected while waiting for ${req.method}`));
|
|
531
650
|
this.pending.delete(id);
|
|
532
651
|
}
|
|
652
|
+
this.dropUnechoedSteers(null, true);
|
|
533
653
|
this.resolvePendingTurn(true);
|
|
534
654
|
if (this.sandboxCleanup) {
|
|
535
655
|
try {
|
|
@@ -733,6 +853,8 @@ ${text}`.slice(-400);
|
|
|
733
853
|
// ─── Turn management ────────────────────────────────────────
|
|
734
854
|
/** Default grace period after interrupt before forcing a restart (ms). */
|
|
735
855
|
static ABORT_GRACE_MS = 3e3;
|
|
856
|
+
/** How long the graceful stop gets before the process tree is killed (disconnectInternal). */
|
|
857
|
+
static FORCE_KILL_AFTER_MS = 2e3;
|
|
736
858
|
hasPendingTurnCompletion() {
|
|
737
859
|
return this.pendingTurnCompletion !== null;
|
|
738
860
|
}
|
|
@@ -742,6 +864,7 @@ ${text}`.slice(-400);
|
|
|
742
864
|
this.clearThreadStopGrace();
|
|
743
865
|
this.pendingTurnCompletion.resolve(aborted);
|
|
744
866
|
this.pendingTurnCompletion = null;
|
|
867
|
+
this.releaseTurnOpenWaiters();
|
|
745
868
|
}
|
|
746
869
|
markPendingTurnStarted(turnId) {
|
|
747
870
|
if (!this.pendingTurnCompletion) return;
|
|
@@ -749,6 +872,86 @@ ${text}`.slice(-400);
|
|
|
749
872
|
if (turnId) {
|
|
750
873
|
this.pendingTurnCompletion.turnId = turnId;
|
|
751
874
|
}
|
|
875
|
+
this.releaseTurnOpenWaiters();
|
|
876
|
+
}
|
|
877
|
+
// ─── B-628: steering the running turn ───────────────────────
|
|
878
|
+
/** How long a steer waits for the pending turn to open before the message is queued instead. */
|
|
879
|
+
static STEER_OPEN_WAIT_MS = 5e3;
|
|
880
|
+
/** A turn Codex has reported running, under an id `turn/steer` can name. */
|
|
881
|
+
turnIsOpen() {
|
|
882
|
+
return this.pendingTurnCompletion?.opened === true && this._turnId !== null;
|
|
883
|
+
}
|
|
884
|
+
releaseTurnOpenWaiters() {
|
|
885
|
+
const waiters = this.turnOpenWaiters;
|
|
886
|
+
this.turnOpenWaiters = [];
|
|
887
|
+
for (const release of waiters) release();
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Waits for the pending turn to open — `turn/start` is in flight, or the runner is still
|
|
891
|
+
* bringing a released app-server back before sending it (B-461) — as Orca's send does
|
|
892
|
+
* (codex-structured-turn-open-wait.ts, 5 s). Resolves early when the turn ends instead.
|
|
893
|
+
*/
|
|
894
|
+
async waitForTurnOpen(timeoutMs) {
|
|
895
|
+
if (this.turnIsOpen()) return true;
|
|
896
|
+
if (timeoutMs <= 0) return false;
|
|
897
|
+
await new Promise((resolve) => {
|
|
898
|
+
const release = () => {
|
|
899
|
+
clearTimeout(timer);
|
|
900
|
+
resolve();
|
|
901
|
+
};
|
|
902
|
+
const timer = setTimeout(release, timeoutMs);
|
|
903
|
+
timer.unref();
|
|
904
|
+
this.turnOpenWaiters.push(release);
|
|
905
|
+
});
|
|
906
|
+
return this.turnIsOpen();
|
|
907
|
+
}
|
|
908
|
+
/**
|
|
909
|
+
* B-628: send a message into the turn running right now (`turn/steer`, codex ≥ 0.148 /
|
|
910
|
+
* app-server-protocol v2 `TurnSteerParams`). Codex appends it to that turn's pending input
|
|
911
|
+
* and the model reads it before its next call; the turn keeps its own model, approval
|
|
912
|
+
* policy and sandbox — the runner applies any change on the next `turn/start`. Codex
|
|
913
|
+
* refuses before taking any input (expectedTurnId is a precondition), so a non-`steered`
|
|
914
|
+
* outcome always means "queue it for the next turn as before": `no-turn` (nothing running,
|
|
915
|
+
* or it ended while we waited), `unsupported` (this app-server has no `turn/steer`,
|
|
916
|
+
* remembered until it is respawned), `refused` (Codex declined this one), `failed`
|
|
917
|
+
* (transport — the turn itself is reported through its own events).
|
|
918
|
+
*/
|
|
919
|
+
async steerTurn(input, opts) {
|
|
920
|
+
if (this.steerUnsupported) return "unsupported";
|
|
921
|
+
if (this.pendingInterrupt) return "no-turn";
|
|
922
|
+
const opened = await this.waitForTurnOpen(opts?.waitForTurnMs ?? CodexAppServerClient.STEER_OPEN_WAIT_MS);
|
|
923
|
+
const threadId = this._threadId;
|
|
924
|
+
const turnId = this._turnId;
|
|
925
|
+
if (!opened || !threadId || !turnId || !this.connected || this.pendingInterrupt) return "no-turn";
|
|
926
|
+
const params = {
|
|
927
|
+
threadId,
|
|
928
|
+
expectedTurnId: turnId,
|
|
929
|
+
...input.clientId ? { clientUserMessageId: input.clientId } : {},
|
|
930
|
+
input: [
|
|
931
|
+
{ type: "text", text: input.text },
|
|
932
|
+
...(input.images ?? []).map((path) => ({ type: "localImage", path }))
|
|
933
|
+
]
|
|
934
|
+
};
|
|
935
|
+
try {
|
|
936
|
+
const result = await this.request("turn/steer", params);
|
|
937
|
+
const steeredTurnId = typeof result?.turnId === "string" && result.turnId.length > 0 ? result.turnId : turnId;
|
|
938
|
+
if (input.clientId) this.steeredAwaitingEcho.set(input.clientId, steeredTurnId);
|
|
939
|
+
logger.logger.debug(`[CodexAppServer] Steered a message into turn ${steeredTurnId}`);
|
|
940
|
+
return "steered";
|
|
941
|
+
} catch (error) {
|
|
942
|
+
const code = jsonRpcErrorCodeOf(error);
|
|
943
|
+
if (code === -32601) {
|
|
944
|
+
this.steerUnsupported = true;
|
|
945
|
+
logger.logger.debug("[CodexAppServer] turn/steer is not supported by this codex; queuing instead");
|
|
946
|
+
return "unsupported";
|
|
947
|
+
}
|
|
948
|
+
if (code !== null) {
|
|
949
|
+
logger.logger.debug("[CodexAppServer] turn/steer refused:", contentLogMetadata.errorLogMetadata(error));
|
|
950
|
+
return "refused";
|
|
951
|
+
}
|
|
952
|
+
logger.logger.debug("[CodexAppServer] turn/steer failed:", contentLogMetadata.errorLogMetadata(error));
|
|
953
|
+
return "failed";
|
|
954
|
+
}
|
|
752
955
|
}
|
|
753
956
|
/** Default wait for Codex's `turn/completed` after its thread reported idle/systemError. */
|
|
754
957
|
static THREAD_STOP_GRACE_MS = 1500;
|
|
@@ -911,6 +1114,7 @@ ${text}`.slice(-400);
|
|
|
911
1114
|
} catch (err) {
|
|
912
1115
|
this.clearTurnWatchdog();
|
|
913
1116
|
this.pendingTurnCompletion = null;
|
|
1117
|
+
this.releaseTurnOpenWaiters();
|
|
914
1118
|
throw err;
|
|
915
1119
|
}
|
|
916
1120
|
const aborted = await completion;
|
|
@@ -928,6 +1132,7 @@ ${text}`.slice(-400);
|
|
|
928
1132
|
}
|
|
929
1133
|
logger.logger.warn(`[CodexAppServer] No notification from Codex for ${timeoutMs}ms \u2014 giving the turn up as aborted`);
|
|
930
1134
|
const turnId = this.pendingTurnCompletion.turnId ?? this._turnId;
|
|
1135
|
+
this.dropUnechoedSteers(turnId, true);
|
|
931
1136
|
this.eventHandler?.({
|
|
932
1137
|
type: "turn_aborted",
|
|
933
1138
|
reason: "timeout",
|
|
@@ -978,6 +1183,7 @@ ${text}`.slice(-400);
|
|
|
978
1183
|
logger.logger.debug(
|
|
979
1184
|
`[CodexAppServer] Clearing thread state: thread=${this._threadId ?? "none"} turn=${this._turnId ?? "none"}`
|
|
980
1185
|
);
|
|
1186
|
+
this.dropUnechoedSteers(null, true);
|
|
981
1187
|
this.resolvePendingTurn(true);
|
|
982
1188
|
this._threadId = null;
|
|
983
1189
|
this._turnId = null;
|
|
@@ -986,6 +1192,7 @@ ${text}`.slice(-400);
|
|
|
986
1192
|
this.failedTurnIds.clear();
|
|
987
1193
|
this.lastTurnError = null;
|
|
988
1194
|
this.rawFileChangesByItemId.clear();
|
|
1195
|
+
this.childThreadLabels.clear();
|
|
989
1196
|
}
|
|
990
1197
|
// ─── JSON-RPC transport ─────────────────────────────────────
|
|
991
1198
|
/** Default timeout for RPC requests (ms). */
|
|
@@ -1066,7 +1273,9 @@ ${text}`.slice(-400);
|
|
|
1066
1273
|
}
|
|
1067
1274
|
this.pending.delete(msg.id);
|
|
1068
1275
|
if (msg.error) {
|
|
1069
|
-
|
|
1276
|
+
const error = new Error(`${pending.method}: ${msg.error.message} (code=${msg.error.code})`);
|
|
1277
|
+
if (typeof msg.error.code === "number") error.jsonRpcCode = msg.error.code;
|
|
1278
|
+
pending.reject(error);
|
|
1070
1279
|
} else {
|
|
1071
1280
|
pending.resolve(msg.result);
|
|
1072
1281
|
}
|