@openclaw/codex 2026.10.1 → 2026.10.5-beta.1
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/.setup/{account-usage-runtime-B7Vg4rmy.mjs → account-usage-runtime-QBZsvZS8.mjs} +8 -7
- package/dist/.setup/{app-server-policy-Bg4FZw1f.mjs → app-server-policy-D_zv8J7V.mjs} +3 -4
- package/dist/.setup/{apply-BzlIkqSz.mjs → apply-CBMV8LN0.mjs} +40 -51
- package/dist/.setup/{attempt-client-cleanup-HXQxfMc1.mjs → attempt-client-cleanup-t-kd_1ys.mjs} +6 -6
- package/dist/.setup/attempt-terminal-jO5IMj9K.mjs +2 -0
- package/dist/.setup/{attempt-workspace-context-BmCutoyg.mjs → attempt-workspace-context-CcwP3DA3.mjs} +21 -18
- package/dist/.setup/{auth-binding-BoMwpuPN.mjs → auth-binding-BaxlhaNx.mjs} +2 -2
- package/dist/.setup/{auth-cache-key-BCCQHWdc.mjs → auth-cache-key-DyfUvsSa.mjs} +30 -41
- package/dist/.setup/{binding-connection-C-08ez1w.mjs → binding-connection-B7HAAZSI.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-Dn2p-fdy.mjs → binding-connection.runtime-DAXn7iFl.mjs} +6 -5
- package/dist/.setup/{bounded-turn-Cv4uIEzz.mjs → bounded-turn-CyQVQwGe.mjs} +21 -17
- package/dist/.setup/{bounded-turn-isolation-DklXNk3k.mjs → bounded-turn-isolation-BfDAo-qZ.mjs} +4 -4
- package/dist/.setup/{build-state-BwxNfFEB.mjs → build-state-CzLMy1S9.mjs} +1 -1
- package/dist/.setup/{capabilities-kQntafj_.mjs → capabilities-DbOzOglY.mjs} +1 -1
- package/dist/.setup/{client-catalog-response-BNFDYAKh.mjs → client-catalog-response-DsbEAtpd.mjs} +25 -32
- package/dist/.setup/{client-BIRVBXXb.mjs → client-y7nO6X9c.mjs} +198 -247
- package/dist/.setup/{command-dispatch-D3_ypl-R.mjs → command-dispatch-uA9lz2Kf.mjs} +3 -4
- package/dist/.setup/{command-formatters-DV3DHhdr.mjs → command-formatters-xW9KpoSZ.mjs} +16 -26
- package/dist/.setup/{command-handlers-KPit4G0p.mjs → command-handlers-VBaJnpZo.mjs} +270 -360
- package/dist/.setup/{command-rpc-CmQDOxY9.mjs → command-rpc-C9VxOLuG.mjs} +19 -18
- package/dist/.setup/{compact-CLLteFIY.mjs → compact-CD8xJxXS.mjs} +41 -61
- package/dist/.setup/{computer-use-BVxocZZc.mjs → computer-use-CiToXF5C.mjs} +109 -147
- package/dist/.setup/{config-0Gxk3_eq.mjs → config-C1YVVLEA.mjs} +32 -59
- package/dist/.setup/config-contracts.shared-D85SGEuq.mjs +4 -0
- package/dist/.setup/{config-options-HG_Rr3W_.mjs → config-options-DDzeNQ8m.mjs} +52 -90
- package/dist/.setup/{config-parsing-BQq-CHTF.mjs → config-parsing-DsWSCPHO.mjs} +19 -55
- package/dist/.setup/{config-runtime-cUYrqu_a.mjs → config-runtime-DWzK-k0n.mjs} +2 -2
- package/dist/.setup/{config-security-KAPScztc.mjs → config-security-clxAZYWX.mjs} +35 -39
- package/dist/.setup/config-utils-DN_YT7dE.mjs +47 -0
- package/dist/.setup/{context-engine-projection-CsgYSQhW.mjs → context-engine-projection-ps-yn_ci.mjs} +10 -22
- package/dist/.setup/{conversation-binding-DJ_288rC.mjs → conversation-binding-CTSLDM9S.mjs} +85 -119
- package/dist/.setup/{conversation-binding-data-DJ4ix-W5.mjs → conversation-binding-data-UgLuTSQT.mjs} +9 -8
- package/dist/.setup/{conversation-control-CuiZ_pDL.mjs → conversation-control-GXM3unE4.mjs} +7 -10
- package/dist/.setup/{cyber-failover-Bb1J6hS1.mjs → cyber-failover-D4dgNfFf.mjs} +2 -5
- package/dist/.setup/{cyber-failover-notice-XR03ef31.mjs → cyber-failover-notice-ljgGGL0s.mjs} +1 -1
- package/dist/.setup/{doctor-start-options-DPW9JxIE.mjs → doctor-start-options-JjTAl-q_.mjs} +5 -5
- package/dist/.setup/{dynamic-tool-build-DgWZMfAQ.mjs → dynamic-tool-build-D731PCdv.mjs} +57 -69
- package/dist/.setup/{dynamic-tools-Ct6GKAFr.mjs → dynamic-tools-D0pYbxHH.mjs} +689 -710
- package/dist/.setup/{effective-mcp-catalog-DmCSc8TS.mjs → effective-mcp-catalog-1hWFKghy.mjs} +11 -20
- package/dist/.setup/{elicitation-input-r9axtppm.mjs → elicitation-input-DXG_qaXr.mjs} +14 -20
- package/dist/.setup/{ephemeral-turn-_cBMKCFb.mjs → ephemeral-turn-Cphy5Qr_.mjs} +3 -3
- package/dist/.setup/{event-projector-assistant-message-C3Tpt370.mjs → event-projector-assistant-message-CLMKN4x-.mjs} +2 -2
- package/dist/.setup/{event-projector-usage-03R0I2dM.mjs → event-projector-usage-BpKfdoTm.mjs} +20 -33
- package/dist/.setup/{event-projector-values-DTqZHizf.mjs → event-projector-values-CLvG1Hil.mjs} +4 -5
- package/dist/.setup/history-rejection-B4nOXNXF.mjs +13 -0
- package/dist/.setup/{inference-context-D-9gWlTR.mjs → inference-context-DNlGwzwy.mjs} +10 -11
- package/dist/.setup/{inference-dispatch-B5UKEUyC.mjs → inference-dispatch-CO6tTs4q.mjs} +5 -4
- package/dist/.setup/{inference-metadata-CgIf7sOx.mjs → inference-metadata-DCvcG_N_.mjs} +36 -41
- package/dist/.setup/{inference-proxy-DUO5E2QQ.mjs → inference-proxy-BDWV0djM.mjs} +10 -14
- package/dist/.setup/{isolated-completion-CjrQEeke.mjs → isolated-completion-Bhqd2yBq.mjs} +8 -8
- package/dist/.setup/local-runtime-attribution-CZz2DJ4q.mjs +15 -0
- package/dist/.setup/{managed-binary-C1VFoVPf.mjs → managed-binary-BtIjV7yN.mjs} +16 -36
- package/dist/.setup/{mcp-app-session-preparation-D0yRoreX.mjs → mcp-app-session-preparation-DqSvxFqc.mjs} +24 -25
- package/dist/.setup/{mcp-tool-metadata-j10HhfTC.mjs → mcp-tool-metadata-DW41snf3.mjs} +1 -1
- package/dist/.setup/{model-catalog--G4arndd.mjs → model-catalog-B227ST3D.mjs} +6 -6
- package/dist/.setup/{models-BYbLQPnj.mjs → models-DdRyi93L.mjs} +6 -10
- package/dist/.setup/{native-auth-Cjb9y7IZ.mjs → native-auth-esN5MdIv.mjs} +5 -5
- package/dist/.setup/{native-execution-policy-ClzpdG3D.mjs → native-execution-policy-MXEe7PB3.mjs} +11 -28
- package/dist/.setup/native-hook-relay-BUWIOrSr.mjs +561 -0
- package/dist/.setup/{native-mcp-app-5i5eRCwO.mjs → native-mcp-app-CjxJQ4F7.mjs} +6 -6
- package/dist/.setup/native-skill-isolation-UMVoNjZz.mjs +391 -0
- package/dist/.setup/{native-subagent-monitor-B2C8D_N0.mjs → native-subagent-monitor-iHc8oLg5.mjs} +505 -639
- package/dist/.setup/{native-subagent-pending-assignments-BDqhOdJp.mjs → native-subagent-pending-assignments-DmVhedNs.mjs} +11 -23
- package/dist/.setup/{native-task-assignments-C6KVqiN1.mjs → native-task-assignments-DimsQ9Qa.mjs} +73 -27
- package/dist/.setup/{node-cli-sessions-B5oNDkUS.mjs → node-cli-sessions-CzKg2nGq.mjs} +18 -26
- package/dist/.setup/{node-exec-server.runtime-0xSEjKYt.mjs → node-exec-server.runtime-BWkULhBM.mjs} +5 -8
- package/dist/.setup/{plan-B5bDIEuQ.mjs → plan-C_F3aio0.mjs} +40 -50
- package/dist/.setup/{plugin-activation-BcyBv8PG.mjs → plugin-activation-D7WkJMvU.mjs} +4 -5
- package/dist/.setup/{plugin-app-cache-key-BW8rd98k.mjs → plugin-app-cache-key-Bg9DbDI6.mjs} +18 -23
- package/dist/.setup/{plugin-approval-roundtrip-C_SGp5YW.mjs → plugin-approval-roundtrip-BSV-51ig.mjs} +4 -6
- package/dist/.setup/{plugin-inventory-Bf0_piTw.mjs → plugin-inventory-CYgdo14P.mjs} +28 -43
- package/dist/.setup/{plugin-marketplace-discovery-SQPhSuic.mjs → plugin-marketplace-discovery-BblHM3DU.mjs} +7 -10
- package/dist/.setup/{plugin-metadata-cache-DWnB7VMj.mjs → plugin-metadata-cache-Bi8TAPwX.mjs} +5 -10
- package/dist/.setup/project-doc-thread-config-BVcvnps8.mjs +490 -0
- package/dist/.setup/{provider-BoIby-eX.mjs → provider-BJ4xhaGX.mjs} +4 -4
- package/dist/.setup/{provider-capabilities-B4yq6UgQ.mjs → provider-capabilities-CjRaV3bx.mjs} +1 -1
- package/dist/.setup/{rate-limits-CMPy24F5.mjs → rate-limits-CI8pTPqL.mjs} +15 -32
- package/dist/.setup/reasoning-effort-CS9kKWB9.mjs +37 -0
- package/dist/.setup/{request-DD3u22uv.mjs → request-Y8dmbqZ3.mjs} +28 -48
- package/dist/.setup/{rpc-error-hmWM21RB.mjs → rpc-error-C98SHchT.mjs} +3 -6
- package/dist/.setup/{run-attempt-DOVF5OON.mjs → run-attempt-Dx7a4Mfm.mjs} +927 -859
- package/dist/.setup/{run-attempt-lifecycle-BuZgVbDA.mjs → run-attempt-lifecycle-KN4oh-7O.mjs} +13 -4
- package/dist/.setup/{runtime-artifact-CUTOOnKw.mjs → runtime-artifact-C13pR7tD.mjs} +18 -22
- package/dist/.setup/{runtime-artifact-connection-CADz3_BY.mjs → runtime-artifact-connection-jS5DeCok.mjs} +3 -3
- package/dist/.setup/{sandbox-guard-WqE8yPge.mjs → sandbox-guard-DIImwCy1.mjs} +4 -6
- package/dist/.setup/service-tier-normalization-BPgw2Wdt.mjs +9 -0
- package/dist/.setup/{session-binding-Ce7BqiPN.mjs → session-binding-JEHNMPsr.mjs} +13 -40
- package/dist/.setup/{session-binding-record-BZB8RgcF.mjs → session-binding-record-DU_0biMD.mjs} +4 -4
- package/dist/.setup/{session-binding-record-codec-z4ZpDn6E.mjs → session-binding-record-codec-BpH8u_G9.mjs} +16 -39
- package/dist/.setup/{session-binding-sidecars-BrdV95Fg.mjs → session-binding-sidecars-DD-enC8w.mjs} +49 -54
- package/dist/.setup/{session-catalog-adoption-CPIP4S_y.mjs → session-catalog-adoption-Ca3OYGYM.mjs} +23 -27
- package/dist/.setup/{session-catalog-archive-DcgwvSbF.mjs → session-catalog-archive-Bv6gV7x9.mjs} +6 -6
- package/dist/.setup/{session-catalog-events-DRaivXvC.mjs → session-catalog-events-DzFlXNUe.mjs} +6 -5
- package/dist/.setup/{session-catalog-index-qwmgqC4t.mjs → session-catalog-index-DozvkUPd.mjs} +111 -105
- package/dist/.setup/{session-catalog-index-order-nhyO0wdW.mjs → session-catalog-index-order-CTfoefow.mjs} +28 -5
- package/dist/.setup/{session-catalog-limits-DEU36Qlo.mjs → session-catalog-limits-BynIoOYm.mjs} +1 -1
- package/dist/.setup/{session-catalog-list-request-tXephOB4.mjs → session-catalog-list-request-D4MYNgDB.mjs} +11 -8
- package/dist/.setup/{session-catalog-native-projection-z9Q608QW.mjs → session-catalog-native-projection-rCKnZud1.mjs} +5 -61
- package/dist/.setup/{session-catalog-node-adoption-7-WEQTB1.mjs → session-catalog-node-adoption-BdP9Zjqo.mjs} +2 -2
- package/dist/.setup/{session-catalog-node-continue-DLWBwAAO.mjs → session-catalog-node-continue-CNJibO4_.mjs} +27 -49
- package/dist/.setup/{session-catalog-node-lookup-Uufckwcm.mjs → session-catalog-node-lookup-BH_DBGa9.mjs} +3 -3
- package/dist/.setup/{session-catalog-parsing-B-qWJh2x.mjs → session-catalog-parsing-DkeoVn60.mjs} +9 -19
- package/dist/.setup/{session-catalog-projection-Cl0Nc7c6.mjs → session-catalog-projection-DDVmALHj.mjs} +8 -22
- package/dist/.setup/session-catalog-source-CygTGmrb.mjs +58 -0
- package/dist/.setup/{session-cli-kH4vuGod.mjs → session-cli-GwU0izn-.mjs} +20 -41
- package/dist/.setup/{session-history-BogBHKLk.mjs → session-history-BO6i_pfk.mjs} +1 -1
- package/dist/.setup/{session-history-import-NWKPa4ZO.mjs → session-history-import-CaO8s6ta.mjs} +4 -4
- package/dist/.setup/{session-history-read-CNN8zwbD.mjs → session-history-read-BI_2jRED.mjs} +4 -15
- package/dist/.setup/{session-history.worker-Cq_4DYgN.mjs → session-history.worker-DJQfek5p.mjs} +147 -159
- package/dist/.setup/{session-initialization-D6dtFQkE.mjs → session-initialization-Bi_2DKhc.mjs} +3 -5
- package/dist/.setup/{session-permission-policy-BxIUJ0Zd.mjs → session-permission-policy-CD2MAWU8.mjs} +12 -20
- package/dist/.setup/{session-retirement-Bt3b0fpe.mjs → session-retirement-IoS3zr17.mjs} +7 -7
- package/dist/.setup/{settled-turn-context-BZsMjkIO.mjs → settled-turn-context-BPL6D3RO.mjs} +1 -1
- package/dist/.setup/{settled-turn-finalizer-e_24O6HA.mjs → settled-turn-finalizer-X-Fylp-u.mjs} +12 -11
- package/dist/.setup/{shared-client-DeenOD8U.mjs → shared-client-ByIwuAC-.mjs} +172 -229
- package/dist/.setup/{side-question-BZHn_1Jm.mjs → side-question-BDUdozFy.mjs} +116 -137
- package/dist/.setup/{source-0ClinBHI.mjs → source-Bxbqf3S1.mjs} +37 -56
- package/dist/.setup/thread-archive-guard-LKdwQKyr.mjs +56 -0
- package/dist/.setup/{thread-lifecycle-CoqYpbpk.mjs → thread-lifecycle-run-CfP4PnEf.mjs} +348 -484
- package/dist/.setup/thread-model-selection-DcVebr8N.mjs +61 -0
- package/dist/.setup/{thread-ownership-CSDZ6mHd.mjs → thread-ownership-Be53aiaG.mjs} +5 -5
- package/dist/.setup/{thread-ownership-queue-Dp24d7-F.mjs → thread-ownership-queue-CeyYScUC.mjs} +5 -6
- package/dist/.setup/{thread-policy-DCC9lQjC.mjs → thread-policy-CHgY-KNl.mjs} +4 -4
- package/dist/.setup/thread-requests-BgzJwJtS.mjs +745 -0
- package/dist/.setup/{thread-resume--WOKWxZd.mjs → thread-resume-B2EmMcgE.mjs} +5 -5
- package/dist/.setup/{timeout-CXOfNoaX.mjs → timeout-D0mEWSGG.mjs} +6 -12
- package/dist/.setup/{transcript-history-projection-B9a7HwUV.mjs → transcript-history-projection-DfKcoZCB.mjs} +3 -4
- package/dist/.setup/{transcript-mirror-BfLRARNL.mjs → transcript-mirror-Bee2o6jj.mjs} +68 -68
- package/dist/.setup/{transcript-mirror-attestation-YSegaktH.mjs → transcript-mirror-attestation-BzUXnrvv.mjs} +5 -2
- package/dist/.setup/{transport-stdio-a0HDa2Mj.mjs → transport-stdio-CRWTkKOn.mjs} +67 -77
- package/dist/.setup/{transport-websocket-zqJ0Cmtn.mjs → transport-websocket-DIyPfkHo.mjs} +8 -16
- package/dist/.setup/{turn-router-BWhX_SBh.mjs → turn-router-DKDAziUW.mjs} +30 -31
- package/dist/.setup/upstream-prompt-provenance-Ccd9MFRJ.mjs +44 -0
- package/dist/.setup/{upstream-session-fork-BQvofnk7.mjs → upstream-session-fork-Djp_yssT.mjs} +50 -43
- package/dist/.setup/{usage-BEHcVwcZ.mjs → usage-DQA-peQC.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-D1p3nE6n.mjs → usage-limit-error-2t3KBqiX.mjs} +12 -21
- package/dist/.setup/web-search-item-CvokaZOo.mjs +20 -0
- package/dist/.setup/{web-search-provider.runtime-CV9oiB-v.mjs → web-search-provider.runtime-BsuCMNix.mjs} +3 -3
- package/dist/.setup/{workspace-write-sandbox-probe-DmUHLrrl.mjs → workspace-write-sandbox-probe-BDWO2Qkh.mjs} +4 -4
- package/dist/api.js +15 -15
- package/dist/catalog-page.worker.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +5 -6
- package/dist/harness.js +32 -61
- package/dist/index.js +302 -416
- package/dist/media-understanding-provider.js +32 -43
- package/dist/migration-provider-api.js +1 -1
- package/dist/native-session-binding-api.js +1 -1
- package/dist/native-tool-policy.js +23 -1
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +52 -31
- package/dist/session-history.worker.js +1 -1
- package/openclaw.plugin.json +20 -3
- package/package.json +7 -7
- package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +0 -5
- package/dist/.setup/plugin-thread-config-deadline-CsScGgrk.mjs +0 -124
- package/dist/.setup/service-tier-normalization-Cei89SW6.mjs +0 -15
- package/dist/.setup/shell-dynamic-tools-BqGszXcq.mjs +0 -85
- package/dist/.setup/thread-archive-guard-C9frICzX.mjs +0 -60
- package/dist/.setup/thread-requests-Dwg2b4Xl.mjs +0 -2111
- package/dist/.setup/upstream-prompt-provenance-fXkKbPVC.mjs +0 -37
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { t as appendCodexGitConfigParameters } from "./config-utils-DN_YT7dE.mjs";
|
|
1
2
|
import { r as normalizeCodexAppServerArgs } from "./launch-args-DbFCehO7.mjs";
|
|
2
|
-
import { i as resolveManagedCodexNativeCommand } from "./managed-binary-
|
|
3
|
+
import { i as resolveManagedCodexNativeCommand } from "./managed-binary-BtIjV7yN.mjs";
|
|
3
4
|
import { i as recordCodexAppServerSpawnFailure, r as getCodexAppServerSpawnFailure } from "./spawn-error-CL3n6MAa.mjs";
|
|
4
5
|
import { createHash, randomUUID } from "node:crypto";
|
|
5
6
|
import { stripVTControlCharacters } from "node:util";
|
|
@@ -62,36 +63,34 @@ var ProcessInspectionError = class extends Error {
|
|
|
62
63
|
this.name = "ProcessInspectionError";
|
|
63
64
|
}
|
|
64
65
|
};
|
|
66
|
+
function remainingInspectionTime(deadline) {
|
|
67
|
+
const remainingMs = deadline - Date.now();
|
|
68
|
+
if (remainingMs <= 0) throw new ProcessInspectionError("deadline");
|
|
69
|
+
return remainingMs;
|
|
70
|
+
}
|
|
65
71
|
function inspectionFailure(error) {
|
|
66
72
|
if (error instanceof ProcessInspectionError) return error;
|
|
67
73
|
const code = error && typeof error === "object" && "code" in error ? error.code : void 0;
|
|
68
74
|
return new ProcessInspectionError(code === "ABORT_ERR" ? "deadline" : code === "EACCES" || code === "EPERM" || code === "ERR_ACCESS_DENIED" ? "permission" : "unavailable");
|
|
69
75
|
}
|
|
76
|
+
function isMissingProcess(error) {
|
|
77
|
+
return error !== null && typeof error === "object" && "code" in error && (error.code === "ENOENT" || error.code === "ESRCH");
|
|
78
|
+
}
|
|
70
79
|
async function readCodexAppServerProcessSnapshot(deadline = Date.now() + MAX_PROCESS_CONTAINMENT_MS$1, pids) {
|
|
71
80
|
const selected = pids === void 0 ? void 0 : [.../* @__PURE__ */ new Set([process.pid, ...pids])];
|
|
72
|
-
const rows =
|
|
73
|
-
"-o",
|
|
74
|
-
PROCESS_COLUMNS,
|
|
75
|
-
"-p",
|
|
76
|
-
selected.join(",")
|
|
77
|
-
] : ["-axo", PROCESS_COLUMNS], deadline, selected !== void 0);
|
|
81
|
+
const rows = await readProcesses(selected, deadline, selected !== void 0);
|
|
78
82
|
if (selected && !rows.some((row) => row.pid === process.pid)) throw new ProcessInspectionError("unavailable");
|
|
79
83
|
return rows;
|
|
80
84
|
}
|
|
81
85
|
async function readCodexAppServerProcess(pid, deadline) {
|
|
82
|
-
return (
|
|
83
|
-
"-o",
|
|
84
|
-
PROCESS_COLUMNS,
|
|
85
|
-
"-p",
|
|
86
|
-
String(pid)
|
|
87
|
-
], deadline)).find((row) => row.pid === pid);
|
|
86
|
+
return (await readProcesses([pid], deadline)).find((row) => row.pid === pid);
|
|
88
87
|
}
|
|
89
88
|
async function readCodexAppServerProcessCommand(observed, deadline) {
|
|
90
89
|
let output;
|
|
91
90
|
if (process.platform === "linux") {
|
|
92
91
|
let pending = false;
|
|
93
92
|
do {
|
|
94
|
-
|
|
93
|
+
remainingInspectionTime(deadline);
|
|
95
94
|
const command = await readProcessOutput({
|
|
96
95
|
kind: "procfs-command",
|
|
97
96
|
pid: observed.pid
|
|
@@ -113,19 +112,24 @@ async function readCodexAppServerProcessCommand(observed, deadline) {
|
|
|
113
112
|
String(observed.pid)
|
|
114
113
|
]
|
|
115
114
|
}, deadline)).split("\n")[0]?.trim() ?? "";
|
|
116
|
-
|
|
115
|
+
remainingInspectionTime(deadline);
|
|
117
116
|
if (!output) throw new ProcessInspectionError("unavailable");
|
|
118
117
|
return output;
|
|
119
118
|
}
|
|
120
|
-
|
|
121
|
-
return
|
|
119
|
+
function readProcesses(pids, deadline, selected = false) {
|
|
120
|
+
if (process.platform === "linux") return readLinuxProcesses(pids, deadline);
|
|
121
|
+
return readProcessOutput({
|
|
122
122
|
kind: "ps",
|
|
123
|
-
args
|
|
124
|
-
|
|
123
|
+
args: pids ? [
|
|
124
|
+
"-o",
|
|
125
|
+
PROCESS_COLUMNS,
|
|
126
|
+
"-p",
|
|
127
|
+
pids.join(",")
|
|
128
|
+
] : ["-axo", PROCESS_COLUMNS]
|
|
129
|
+
}, deadline).then((output) => parseProcesses(output, selected));
|
|
125
130
|
}
|
|
126
131
|
async function readProcessOutput(command, deadline) {
|
|
127
|
-
const remainingMs = deadline
|
|
128
|
-
if (remainingMs <= 0) throw new ProcessInspectionError("deadline");
|
|
132
|
+
const remainingMs = remainingInspectionTime(deadline);
|
|
129
133
|
return await new Promise((resolve, reject) => {
|
|
130
134
|
let settled = false;
|
|
131
135
|
const settle = (output) => {
|
|
@@ -198,8 +202,7 @@ function parseProcesses(output, selected) {
|
|
|
198
202
|
}
|
|
199
203
|
async function readLinuxProcesses(selected, deadline) {
|
|
200
204
|
if (selected !== void 0) return readSelectedLinuxProcesses(selected, deadline);
|
|
201
|
-
const remainingMs = deadline
|
|
202
|
-
if (remainingMs <= 0) throw new ProcessInspectionError("deadline");
|
|
205
|
+
const remainingMs = remainingInspectionTime(deadline);
|
|
203
206
|
const options = {
|
|
204
207
|
encoding: "utf8",
|
|
205
208
|
signal: AbortSignal.timeout(remainingMs)
|
|
@@ -211,9 +214,9 @@ async function readLinuxProcesses(selected, deadline) {
|
|
|
211
214
|
let bytes = 0;
|
|
212
215
|
for (const entry of pids) {
|
|
213
216
|
if (!/^\d+$/.test(entry)) continue;
|
|
214
|
-
|
|
217
|
+
remainingInspectionTime(deadline);
|
|
215
218
|
const stat = await readFile(`/proc/${entry}/stat`, options).catch((error) => {
|
|
216
|
-
if (
|
|
219
|
+
if (isMissingProcess(error)) return;
|
|
217
220
|
throw error;
|
|
218
221
|
});
|
|
219
222
|
if (stat === void 0) continue;
|
|
@@ -222,7 +225,7 @@ async function readLinuxProcesses(selected, deadline) {
|
|
|
222
225
|
const row = parseLinuxProcess(stat, entry, bootId, false);
|
|
223
226
|
if (row) rows.push(row);
|
|
224
227
|
}
|
|
225
|
-
|
|
228
|
+
remainingInspectionTime(deadline);
|
|
226
229
|
return rows;
|
|
227
230
|
} catch (error) {
|
|
228
231
|
throw inspectionFailure(error);
|
|
@@ -254,20 +257,20 @@ function parseLinuxProcess(stat, entry, bootId, selected) {
|
|
|
254
257
|
}
|
|
255
258
|
/** Known procfs identities must not queue behind unrelated libuv filesystem work. */
|
|
256
259
|
function readSelectedProcFile(file, deadline, maxBytes = PROCESS_INSPECTION_MAX_BYTES) {
|
|
257
|
-
|
|
260
|
+
remainingInspectionTime(deadline);
|
|
258
261
|
const fd = openSync(file, constants.O_RDONLY | constants.O_NONBLOCK);
|
|
259
262
|
const chunks = [];
|
|
260
263
|
const buffer = Buffer.alloc(Math.min(4096, maxBytes + 1));
|
|
261
264
|
let bytes = 0;
|
|
262
265
|
try {
|
|
263
266
|
for (;;) {
|
|
264
|
-
|
|
267
|
+
remainingInspectionTime(deadline);
|
|
265
268
|
const count = readSync(fd, buffer, {
|
|
266
269
|
offset: 0,
|
|
267
270
|
length: Math.min(buffer.length, maxBytes - bytes + 1),
|
|
268
271
|
position: null
|
|
269
272
|
});
|
|
270
|
-
|
|
273
|
+
remainingInspectionTime(deadline);
|
|
271
274
|
if (count === 0) return Buffer.concat(chunks, bytes);
|
|
272
275
|
bytes += count;
|
|
273
276
|
if (bytes > maxBytes) throw new ProcessInspectionError("unavailable");
|
|
@@ -288,14 +291,14 @@ function readSelectedLinuxProcesses(selected, deadline) {
|
|
|
288
291
|
try {
|
|
289
292
|
stat = readSelectedProcFile(`/proc/${entry}/stat`, deadline, PROCESS_INSPECTION_MAX_BYTES - bytes);
|
|
290
293
|
} catch (error) {
|
|
291
|
-
if (
|
|
294
|
+
if (isMissingProcess(error)) continue;
|
|
292
295
|
throw error;
|
|
293
296
|
}
|
|
294
297
|
bytes += stat.length;
|
|
295
298
|
const row = parseLinuxProcess(stat.toString("utf8"), entry, bootId, true);
|
|
296
299
|
if (row) rows.push(row);
|
|
297
300
|
}
|
|
298
|
-
|
|
301
|
+
remainingInspectionTime(deadline);
|
|
299
302
|
return rows;
|
|
300
303
|
} catch (error) {
|
|
301
304
|
throw inspectionFailure(error);
|
|
@@ -337,12 +340,12 @@ async function terminateCodexAppServerOrphan(expected) {
|
|
|
337
340
|
}
|
|
338
341
|
return false;
|
|
339
342
|
} finally {
|
|
340
|
-
if (contained && !gone) await
|
|
343
|
+
if (contained && !gone) await signalSameProcess(contained.root, "SIGCONT", Date.now() + MAX_PROCESS_CONTAINMENT_MS, "root");
|
|
341
344
|
}
|
|
342
345
|
}
|
|
343
346
|
async function terminateCodexAppServerDescendants(child, expected, deadline = Date.now() + MAX_PROCESS_CONTAINMENT_MS) {
|
|
344
347
|
const rootPid = child.pid;
|
|
345
|
-
if (
|
|
348
|
+
if (child.exitCode != null || child.signalCode != null) return "exited";
|
|
346
349
|
if (process.platform === "win32" || !rootPid || !child.kill) return;
|
|
347
350
|
const snapshot = await readCodexAppServerProcessSnapshot(deadline).catch(() => void 0);
|
|
348
351
|
if (!snapshot || Date.now() >= deadline) return;
|
|
@@ -352,7 +355,7 @@ async function terminateCodexAppServerDescendants(child, expected, deadline = Da
|
|
|
352
355
|
const initialDescendants = collectDescendants(snapshot, [rootPid]);
|
|
353
356
|
if (initialDescendants.length > MAX_CONTAINED_PROCESSES) return;
|
|
354
357
|
const stoppedDescendants = /* @__PURE__ */ new Map();
|
|
355
|
-
if (!await
|
|
358
|
+
if (!await signalSameProcess(root, "SIGSTOP", deadline, "root")) return;
|
|
356
359
|
let resumeRootOnUnwind = true;
|
|
357
360
|
try {
|
|
358
361
|
const descendants = await quiesceDescendants(root, initialDescendants, stoppedDescendants, deadline);
|
|
@@ -393,7 +396,7 @@ async function terminateCodexAppServerDescendants(child, expected, deadline = Da
|
|
|
393
396
|
if (expected) {
|
|
394
397
|
const releaseDeadline = Date.now() + MAX_PROCESS_CONTAINMENT_MS;
|
|
395
398
|
for (const descendant of stoppedDescendants.values()) await signalSameProcess(descendant, "SIGCONT", releaseDeadline);
|
|
396
|
-
await
|
|
399
|
+
await signalSameProcess(root, "SIGCONT", releaseDeadline, "root");
|
|
397
400
|
} else {
|
|
398
401
|
for (const descendant of stoppedDescendants.values()) signalProcess(descendant.pid, "SIGCONT");
|
|
399
402
|
resumeTransportRoot(child, root, true);
|
|
@@ -411,11 +414,10 @@ async function quiesceDescendants(root, initialDescendants, stopped, deadline) {
|
|
|
411
414
|
const currentRoot = snapshot.find((row) => row.pid === root.pid);
|
|
412
415
|
if (!currentRoot || !isSameLiveRoot(currentRoot, root)) return;
|
|
413
416
|
if (!isSameLiveRoot(currentRoot, root, true)) {
|
|
414
|
-
if (!await
|
|
417
|
+
if (!await signalSameProcess(root, "SIGSTOP", deadline, "root") || Date.now() >= deadline) return;
|
|
415
418
|
continue;
|
|
416
419
|
}
|
|
417
420
|
const snapshotByPid = new Map(snapshot.map((process) => [process.pid, process]));
|
|
418
|
-
const liveProven = [];
|
|
419
421
|
for (const proven of provenByPid.values()) {
|
|
420
422
|
const current = snapshotByPid.get(proven.pid);
|
|
421
423
|
if (!current) {
|
|
@@ -427,19 +429,16 @@ async function quiesceDescendants(root, initialDescendants, stopped, deadline) {
|
|
|
427
429
|
provenByPid.set(current.pid, current);
|
|
428
430
|
const key = identityKey(current);
|
|
429
431
|
if (stopped.has(key)) stopped.set(key, current);
|
|
430
|
-
liveProven.push(current);
|
|
431
432
|
}
|
|
432
|
-
const descendants = collectDescendants(snapshot, [root.pid, ...
|
|
433
|
+
const descendants = collectDescendants(snapshot, [root.pid, ...provenByPid.keys()]);
|
|
433
434
|
for (const descendant of descendants) {
|
|
434
435
|
const proven = provenByPid.get(descendant.pid);
|
|
435
436
|
if (proven && !hasSameIdentity(proven, descendant)) return;
|
|
436
437
|
provenByPid.set(descendant.pid, descendant);
|
|
437
438
|
}
|
|
438
439
|
if (provenByPid.size > MAX_CONTAINED_PROCESSES) return;
|
|
439
|
-
const quiescenceTargets = new Map(liveProven.map((process) => [process.pid, process]));
|
|
440
|
-
for (const descendant of descendants) quiescenceTargets.set(descendant.pid, descendant);
|
|
441
440
|
let allStopped = true;
|
|
442
|
-
for (const descendant of
|
|
441
|
+
for (const descendant of provenByPid.values()) {
|
|
443
442
|
if (Date.now() >= deadline) return;
|
|
444
443
|
if (isStoppedState(descendant.state)) continue;
|
|
445
444
|
const stopQueued = await signalSameProcess(descendant, "SIGSTOP", deadline);
|
|
@@ -491,10 +490,6 @@ function isSameLiveProcess(current, expected) {
|
|
|
491
490
|
function isSameLiveRoot(current, expected, requireStopped = false) {
|
|
492
491
|
return current.ppid === expected.ppid && (!requireStopped || isQuiescedState(current.state)) && isSameLiveProcess(current, expected);
|
|
493
492
|
}
|
|
494
|
-
async function signalSameRoot(root, signal, deadline) {
|
|
495
|
-
const current = await readCodexAppServerProcess(root.pid, deadline).catch(() => void 0);
|
|
496
|
-
return Boolean(current && isSameLiveRoot(current, root) && signalProcess(current.pid, signal));
|
|
497
|
-
}
|
|
498
493
|
function resumeTransportRoot(child, root, allowSynchronousPidFallback) {
|
|
499
494
|
try {
|
|
500
495
|
if (child.kill) {
|
|
@@ -506,9 +501,9 @@ function resumeTransportRoot(child, root, allowSynchronousPidFallback) {
|
|
|
506
501
|
}
|
|
507
502
|
if (allowSynchronousPidFallback) signalProcess(root.pid, "SIGCONT");
|
|
508
503
|
}
|
|
509
|
-
async function signalSameProcess(expected, signal, deadline) {
|
|
504
|
+
async function signalSameProcess(expected, signal, deadline, identity = "descendant") {
|
|
510
505
|
const current = await readCodexAppServerProcess(expected.pid, deadline).catch(() => void 0);
|
|
511
|
-
return Boolean(current && isSameLiveProcess(current, expected) && signalProcess(current.pid, signal));
|
|
506
|
+
return Boolean(current && (identity === "root" ? isSameLiveRoot : isSameLiveProcess)(current, expected) && signalProcess(current.pid, signal));
|
|
512
507
|
}
|
|
513
508
|
function hasSameIdentity(left, right) {
|
|
514
509
|
return identityKey(left) === identityKey(right);
|
|
@@ -516,9 +511,6 @@ function hasSameIdentity(left, right) {
|
|
|
516
511
|
function identityKey(row) {
|
|
517
512
|
return `${row.pid}\0${row.startedAt}`;
|
|
518
513
|
}
|
|
519
|
-
function hasExited(child) {
|
|
520
|
-
return child.exitCode != null || child.signalCode != null;
|
|
521
|
-
}
|
|
522
514
|
function signalProcess(pid, signal) {
|
|
523
515
|
try {
|
|
524
516
|
process.kill(pid, signal);
|
|
@@ -620,12 +612,10 @@ function createCodexAppServerProcessReaperService() {
|
|
|
620
612
|
}
|
|
621
613
|
/** Reap previous owners before spawn; commit this child's identity before initialization. */
|
|
622
614
|
async function prepareCodexAppServerProcessRegistration() {
|
|
623
|
-
|
|
624
|
-
await once(child, "spawn");
|
|
625
|
-
};
|
|
626
|
-
const store = await reapRegisteredCodexAppServerOrphans();
|
|
615
|
+
const store = process.platform === "win32" ? void 0 : await reapRegisteredCodexAppServerOrphans();
|
|
627
616
|
return async (child) => {
|
|
628
617
|
await once(child, "spawn");
|
|
618
|
+
if (!store) return;
|
|
629
619
|
if (!child.pid) throw new ProcessInspectionError("unavailable");
|
|
630
620
|
const deadline = Date.now() + PROCESS_REGISTRATION_INSPECTION_MS;
|
|
631
621
|
const snapshot = await readCodexAppServerProcessSnapshot(deadline, [child.pid]);
|
|
@@ -707,10 +697,6 @@ function observeManagedCodexLauncherFailure(child, nativeCommand) {
|
|
|
707
697
|
}
|
|
708
698
|
//#endregion
|
|
709
699
|
//#region extensions/codex/src/app-server/transport.ts
|
|
710
|
-
/**
|
|
711
|
-
* Shared transport lifecycle helpers for stdio and WebSocket Codex app-server
|
|
712
|
-
* connections.
|
|
713
|
-
*/
|
|
714
700
|
const CODEX_APP_SERVER_TRANSPORT_CLOSES = /* @__PURE__ */ new WeakMap();
|
|
715
701
|
/** True only after bounded settlement proves an exit that cleanup did not cause. */
|
|
716
702
|
function hasCodexAppServerNaturalExit(child) {
|
|
@@ -868,25 +854,29 @@ function resolveCodexAppServerSpawnInvocation(options, env) {
|
|
|
868
854
|
/** Merges app-server environment overrides while honoring clearEnv and unsafe key filtering. */
|
|
869
855
|
function resolveCodexAppServerSpawnEnv(options, baseEnv = process.env, platform = process.platform) {
|
|
870
856
|
const env = Object.create(null);
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
const keysToClear = (options.clearEnv ?? []).map((key) => key.trim()).filter(Boolean);
|
|
874
|
-
|
|
875
|
-
const
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
857
|
+
for (const source of [baseEnv, options.env ?? {}]) for (const [key, value] of Object.entries(source)) if (!UNSAFE_ENVIRONMENT_KEYS.has(key)) env[key] = value;
|
|
858
|
+
const normalizeKey = (key) => platform === "win32" ? key.toLowerCase() : key;
|
|
859
|
+
const keysToClear = new Set((options.clearEnv ?? []).map((key) => normalizeKey(key.trim())).filter(Boolean));
|
|
860
|
+
for (const key of Object.keys(env)) {
|
|
861
|
+
const upperKey = key.toUpperCase();
|
|
862
|
+
const runtimeInjection = RUNTIME_INJECTION_ENVIRONMENT_KEYS.has(upperKey) || upperKey.startsWith("DYLD_");
|
|
863
|
+
if (keysToClear.has(normalizeKey(key)) || runtimeInjection) delete env[key];
|
|
864
|
+
}
|
|
879
865
|
return env;
|
|
880
866
|
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
867
|
+
/** Keep inherited Git settings in the private process environment, outside thread config. */
|
|
868
|
+
function withCodexAppServerGitConfig(options, parameters) {
|
|
869
|
+
const env = resolveCodexAppServerSpawnEnv(options);
|
|
870
|
+
const key = process.platform === "win32" ? Object.keys(env).toSorted().find((name) => name.toUpperCase() === "GIT_CONFIG_PARAMETERS") : "GIT_CONFIG_PARAMETERS";
|
|
871
|
+
const inherited = key === void 0 ? void 0 : env[key];
|
|
872
|
+
return {
|
|
873
|
+
...options,
|
|
874
|
+
env: {
|
|
875
|
+
...options.env,
|
|
876
|
+
GIT_CONFIG_PARAMETERS: appendCodexGitConfigParameters(inherited, parameters)
|
|
877
|
+
},
|
|
878
|
+
...options.clearEnv ? { clearEnv: options.clearEnv.filter((name) => (process.platform === "win32" ? name.trim().toUpperCase() : name.trim()) !== "GIT_CONFIG_PARAMETERS") } : {}
|
|
879
|
+
};
|
|
890
880
|
}
|
|
891
881
|
/** Spawns the Codex app-server process and returns the shared transport interface. */
|
|
892
882
|
async function createStdioTransport(options, baseEnv = process.env, assertCurrent, onSpawn) {
|
|
@@ -942,4 +932,4 @@ async function createStdioTransport(options, baseEnv = process.env, assertCurren
|
|
|
942
932
|
}
|
|
943
933
|
}
|
|
944
934
|
//#endregion
|
|
945
|
-
export {
|
|
935
|
+
export { closeCodexAppServerTransport as a, createCodexAppServerProcessReaperService as c, withCodexAppServerGitConfig as i, getCodexAppServerRegisteredTransportIdentity as l, resolveCodexAppServerSpawnEnv as n, closeCodexAppServerTransportAndWait as o, resolveCodexAppServerSpawnInvocation as r, hasCodexAppServerNaturalExit as s, createStdioTransport as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as resolveCodexAppServerUserHomeDir } from "./auth-start-options-BPIPeEX8.mjs";
|
|
2
|
-
import "./config-
|
|
2
|
+
import "./config-C1YVVLEA.mjs";
|
|
3
3
|
import { t as codexWebSocketDataToBuffer } from "./websocket-data-XlRvt8Ys.mjs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { EventEmitter } from "node:events";
|
|
@@ -58,14 +58,10 @@ function createWebSocketTransport(options) {
|
|
|
58
58
|
let consecutiveMissedPongs = 0;
|
|
59
59
|
let heartbeatSequence = 0;
|
|
60
60
|
const clearConnectionHealthTimers = () => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (pongTimeout) {
|
|
66
|
-
clearTimeout(pongTimeout);
|
|
67
|
-
pongTimeout = void 0;
|
|
68
|
-
}
|
|
61
|
+
clearTimeout(pingTimeout);
|
|
62
|
+
pingTimeout = void 0;
|
|
63
|
+
clearTimeout(pongTimeout);
|
|
64
|
+
pongTimeout = void 0;
|
|
69
65
|
expectedPong = void 0;
|
|
70
66
|
};
|
|
71
67
|
const sendHeartbeatPing = () => {
|
|
@@ -97,10 +93,8 @@ function createWebSocketTransport(options) {
|
|
|
97
93
|
};
|
|
98
94
|
const recordConnectionActivity = () => {
|
|
99
95
|
consecutiveMissedPongs = 0;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
pongTimeout = void 0;
|
|
103
|
-
}
|
|
96
|
+
clearTimeout(pongTimeout);
|
|
97
|
+
pongTimeout = void 0;
|
|
104
98
|
expectedPong = void 0;
|
|
105
99
|
scheduleHeartbeatPing();
|
|
106
100
|
};
|
|
@@ -155,8 +149,7 @@ function createWebSocketTransport(options) {
|
|
|
155
149
|
callback();
|
|
156
150
|
},
|
|
157
151
|
final(callback) {
|
|
158
|
-
pendingLine
|
|
159
|
-
if (pendingLine) sendFrame(pendingLine);
|
|
152
|
+
sendFrame(pendingLine + stdinDecoder.end());
|
|
160
153
|
pendingLine = "";
|
|
161
154
|
callback();
|
|
162
155
|
}
|
|
@@ -192,7 +185,6 @@ function createWebSocketTransport(options) {
|
|
|
192
185
|
function connectCodexAppServerUnixSocket(socketPath) {
|
|
193
186
|
return net.createConnection(socketPath);
|
|
194
187
|
}
|
|
195
|
-
/** Resolves the canonical or explicitly configured Codex control socket. */
|
|
196
188
|
function resolveCodexAppServerUnixSocketPath(options) {
|
|
197
189
|
if (options.transport !== "unix") {
|
|
198
190
|
if (options.url?.startsWith("unix://")) throw new Error("codex app-server unix URL requires unix transport");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
2
|
-
import { n as waitForPromiseOrAbort, t as abortReason } from "./timeout-
|
|
3
|
-
import { x as readCodexTurnCompletedNotification } from "./client-
|
|
2
|
+
import { n as waitForPromiseOrAbort, t as abortReason } from "./timeout-D0mEWSGG.mjs";
|
|
3
|
+
import { x as readCodexTurnCompletedNotification } from "./client-y7nO6X9c.mjs";
|
|
4
4
|
import { normalizeOptionalString, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { AsyncResource } from "node:async_hooks";
|
|
6
6
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
@@ -18,7 +18,7 @@ const itemStatuses = /* @__PURE__ */ new Map([
|
|
|
18
18
|
["in_progress", "running"],
|
|
19
19
|
["running", "running"]
|
|
20
20
|
]);
|
|
21
|
-
const
|
|
21
|
+
const itemMetadata = /* @__PURE__ */ new Map([
|
|
22
22
|
["dynamicToolCall", {
|
|
23
23
|
kind: "tool",
|
|
24
24
|
title: "Tool"
|
|
@@ -53,17 +53,27 @@ const itemPresentations = /* @__PURE__ */ new Map([
|
|
|
53
53
|
["reasoning", {
|
|
54
54
|
kind: "analysis",
|
|
55
55
|
title: "Reasoning"
|
|
56
|
-
}]
|
|
56
|
+
}],
|
|
57
|
+
["collabAgentToolCall", { clearsTerminal: true }],
|
|
58
|
+
["imageGeneration", {
|
|
59
|
+
auditName: "image_generation",
|
|
60
|
+
clearsTerminal: true
|
|
61
|
+
}],
|
|
62
|
+
["imageView", {
|
|
63
|
+
auditName: "image_view",
|
|
64
|
+
clearsTerminal: true
|
|
65
|
+
}],
|
|
66
|
+
["sleep", { auditName: "sleep" }]
|
|
57
67
|
]);
|
|
58
68
|
function matchesCodexSnapshotTurn(item, turnId) {
|
|
59
69
|
const itemTurnId = readStringField(item, "turnId");
|
|
60
70
|
return itemTurnId === void 0 || itemTurnId === turnId;
|
|
61
71
|
}
|
|
62
72
|
function itemKind(item) {
|
|
63
|
-
return
|
|
73
|
+
return itemMetadata.get(item.type)?.kind;
|
|
64
74
|
}
|
|
65
75
|
function itemTitle(item) {
|
|
66
|
-
return
|
|
76
|
+
return itemMetadata.get(item.type)?.title ?? item.type;
|
|
67
77
|
}
|
|
68
78
|
function itemStatus(item) {
|
|
69
79
|
return itemStatuses.get(readStringField(item, "status") ?? "") ?? "completed";
|
|
@@ -89,44 +99,36 @@ function itemName(item) {
|
|
|
89
99
|
const server = typeof item.server === "string" ? item.server : void 0;
|
|
90
100
|
return server ? `${server}.${item.tool}` : item.tool;
|
|
91
101
|
}
|
|
92
|
-
return
|
|
102
|
+
return itemMetadata.get(item.type)?.toolName;
|
|
93
103
|
}
|
|
94
104
|
function auditNativeToolName(item) {
|
|
95
105
|
if (item.type === "dynamicToolCall") return;
|
|
96
106
|
const progressName = itemName(item);
|
|
97
107
|
if (progressName) return progressName;
|
|
98
108
|
if (item.type === "collabAgentToolCall") return typeof item.tool === "string" && item.tool.trim() ? `collab.${item.tool.trim()}` : "collab_agent";
|
|
99
|
-
|
|
100
|
-
if (item.type === "imageView") return "image_view";
|
|
101
|
-
if (item.type === "sleep") return "sleep";
|
|
109
|
+
return itemMetadata.get(item.type)?.auditName;
|
|
102
110
|
}
|
|
103
111
|
function isSideEffectingNativeToolItem(item) {
|
|
104
112
|
return itemStatus(item) !== "blocked" && (isMutatingNativeToolItem(item) || item.type === "mcpToolCall");
|
|
105
113
|
}
|
|
106
114
|
function isProjectedNativeToolItem(item) {
|
|
107
|
-
return
|
|
115
|
+
return itemMetadata.get(item.type)?.projectedTool === true;
|
|
108
116
|
}
|
|
109
117
|
function isMutatingNativeToolItem(item) {
|
|
110
118
|
if (item.type === "commandExecution") return true;
|
|
111
119
|
return item.type === "fileChange" || item.type === "collabAgentToolCall" || item.type === "imageGeneration";
|
|
112
120
|
}
|
|
113
121
|
function shouldClearTerminalPresentationForNativeItem(item) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
case "imageView":
|
|
120
|
-
case "mcpToolCall":
|
|
121
|
-
case "webSearch": return true;
|
|
122
|
-
default: return false;
|
|
123
|
-
}
|
|
122
|
+
const metadata = itemMetadata.get(item.type);
|
|
123
|
+
return metadata?.projectedTool === true || metadata?.clearsTerminal === true;
|
|
124
|
+
}
|
|
125
|
+
function shouldAdvancePersistableAssistantBarrier(item) {
|
|
126
|
+
return shouldClearTerminalPresentationForNativeItem(item) || item.type === "dynamicToolCall" || item.type === "sleep";
|
|
124
127
|
}
|
|
125
128
|
//#endregion
|
|
126
129
|
//#region extensions/codex/src/app-server/notification-correlation.ts
|
|
127
130
|
function isCodexNotificationForTurn(value, threadId, turnId) {
|
|
128
|
-
|
|
129
|
-
return readCodexNotificationThreadId(value) === threadId && readCodexNotificationTurnId(value) === turnId;
|
|
131
|
+
return isJsonObject(value) && readCodexNotificationThreadId(value) === threadId && readCodexNotificationTurnId(value) === turnId;
|
|
130
132
|
}
|
|
131
133
|
/**
|
|
132
134
|
* Reads a thread id from canonical top-level or nested thread payloads.
|
|
@@ -136,7 +138,7 @@ function isCodexNotificationForTurn(value, threadId, turnId) {
|
|
|
136
138
|
*/
|
|
137
139
|
function readCodexNotificationThreadId(record) {
|
|
138
140
|
const thread = isJsonObject(record.thread) ? record.thread : void 0;
|
|
139
|
-
return normalizeOptionalString(record.threadId) ?? (thread
|
|
141
|
+
return normalizeOptionalString(record.threadId) ?? (thread && normalizeOptionalString(thread.id));
|
|
140
142
|
}
|
|
141
143
|
function readCodexNotificationTurnId(record) {
|
|
142
144
|
return (isJsonObject(record.turn) ? normalizeOptionalString(record.turn.id) : void 0) ?? normalizeOptionalString(record.turnId);
|
|
@@ -512,17 +514,14 @@ var ClientTurnRouter = class {
|
|
|
512
514
|
if (!route) return;
|
|
513
515
|
const requestSignal = AbortSignal.any([signal, route.controller.signal]);
|
|
514
516
|
if (!route.handlers && !await waitForPromiseOrAbort(route.activated.promise, requestSignal)) return;
|
|
515
|
-
|
|
516
|
-
const handler = route.handlers.onRequest;
|
|
517
|
+
const handler = !requestSignal.aborted && route.handlers?.onRequest;
|
|
517
518
|
if (!handler) return;
|
|
518
519
|
while (route.gate === "armed") {
|
|
519
520
|
const binding = route.binding?.promise;
|
|
520
|
-
if (!binding || !await waitForPromiseOrAbort(binding, requestSignal)) return;
|
|
521
|
-
if (requestSignal.aborted) return;
|
|
521
|
+
if (!binding || !await waitForPromiseOrAbort(binding, requestSignal) || requestSignal.aborted) return;
|
|
522
522
|
}
|
|
523
523
|
if (route.gate === "bound" && scope.turnId && scope.turnId !== route.turnId) return;
|
|
524
|
-
if (!await waitForPromiseOrAbort(this.waitForNotifications(route), requestSignal)) return;
|
|
525
|
-
if (requestSignal.aborted) return;
|
|
524
|
+
if (!await waitForPromiseOrAbort(this.waitForNotifications(route), requestSignal) || requestSignal.aborted) return;
|
|
526
525
|
try {
|
|
527
526
|
const result = await handler(request, {
|
|
528
527
|
threadId: scope.threadId,
|
|
@@ -631,4 +630,4 @@ function requireId(value, label) {
|
|
|
631
630
|
return normalized;
|
|
632
631
|
}
|
|
633
632
|
//#endregion
|
|
634
|
-
export {
|
|
633
|
+
export { unknownItemStatus as C, shouldClearTerminalPresentationForNativeItem as S, itemName as _, isCodexNotificationForTurn as a, matchesCodexSnapshotTurn as b, readCodexNotificationTurnId as c, auditNativeToolUnfinishedStatus as d, isMutatingNativeToolItem as f, itemKind as g, isSideEffectingNativeToolItem as h, CodexProjectionDiagnostics as i, auditNativeToolName as l, isProjectedNativeToolItem as m, getCodexAppServerTurnRouter as n, readCodexNotificationScope as o, isNonSuccessItemStatus as p, hasCodexAppServerSiblingRouteWork as r, readCodexNotificationThreadId as s, CODEX_APP_SERVER_NATIVE_TURN_WAIT_TIMEOUT_MS as t, auditNativeToolTerminalStatus as u, itemStatus as v, shouldAdvancePersistableAssistantBarrier as x, itemTitle as y };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { asOptionalRecord, readNonEmptyStringPreservingWhitespace } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
+
//#region extensions/codex/src/app-server/upstream-prompt-provenance.ts
|
|
3
|
+
const UPSTREAM_USER_TEXT_META_KEY = "upstreamUserText";
|
|
4
|
+
const MIRROR_IDENTITY_META_KEY = "mirrorIdentity";
|
|
5
|
+
const CODEX_META_KEY = "__openclaw";
|
|
6
|
+
function readCodexMeta(message) {
|
|
7
|
+
return message && CODEX_META_KEY in message ? asOptionalRecord(message[CODEX_META_KEY]) : void 0;
|
|
8
|
+
}
|
|
9
|
+
const ASSISTANT_ITEM_IDS = Symbol("codexAssistantItemIds");
|
|
10
|
+
/** Follow snapshot copies without adding provider identities to durable messages. */
|
|
11
|
+
function attachCodexAssistantItemIds(message, itemIds) {
|
|
12
|
+
return {
|
|
13
|
+
...message,
|
|
14
|
+
[ASSISTANT_ITEM_IDS]: itemIds
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function takeCodexAssistantItemIds(message) {
|
|
18
|
+
const itemIds = message[ASSISTANT_ITEM_IDS];
|
|
19
|
+
delete message[ASSISTANT_ITEM_IDS];
|
|
20
|
+
return itemIds;
|
|
21
|
+
}
|
|
22
|
+
function attachCodexMeta(message, key, value) {
|
|
23
|
+
return {
|
|
24
|
+
...message,
|
|
25
|
+
__openclaw: {
|
|
26
|
+
...readCodexMeta(message),
|
|
27
|
+
[key]: value
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function attachCodexMirrorIdentity(message, identity) {
|
|
32
|
+
return attachCodexMeta(message, MIRROR_IDENTITY_META_KEY, identity);
|
|
33
|
+
}
|
|
34
|
+
function readMirrorIdentity(message) {
|
|
35
|
+
return readNonEmptyStringPreservingWhitespace(readCodexMeta(message)?.[MIRROR_IDENTITY_META_KEY]);
|
|
36
|
+
}
|
|
37
|
+
function attachUpstreamUserText(message, text) {
|
|
38
|
+
return attachCodexMeta(message, UPSTREAM_USER_TEXT_META_KEY, text);
|
|
39
|
+
}
|
|
40
|
+
function readUpstreamUserText(message) {
|
|
41
|
+
return readNonEmptyStringPreservingWhitespace(readCodexMeta(message)?.[UPSTREAM_USER_TEXT_META_KEY]);
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { readUpstreamUserText as a, readMirrorIdentity as i, attachCodexMirrorIdentity as n, takeCodexAssistantItemIds as o, attachUpstreamUserText as r, attachCodexAssistantItemIds as t };
|