@openclaw/codex 2026.9.6 → 2026.9.7
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/README.md +2 -0
- package/assets/icon.png +0 -0
- package/dist/.setup/{account-usage-runtime-Eem_WGqY.mjs → account-usage-runtime-DFhbh1zz.mjs} +5 -5
- package/dist/.setup/{apply-DDOi8uNx.mjs → apply-D3GcSoSa.mjs} +22 -36
- package/dist/.setup/{attempt-client-cleanup-CEv1cKwF.mjs → attempt-client-cleanup-DOP-cW5j.mjs} +128 -37
- package/dist/.setup/attempt-workspace-context-C5HigshI.mjs +164 -0
- package/dist/.setup/{auth-binding-DhLWa_7K.mjs → auth-binding-BLWz7stm.mjs} +14 -1
- package/dist/.setup/{auth-cache-key-B2mpaI9D.mjs → auth-cache-key-Dbvq-QgB.mjs} +36 -34
- package/dist/.setup/{auth-profile-WqZtZfXN.mjs → auth-profile-B0okYl2D.mjs} +1 -2
- package/dist/.setup/auth-start-options-BPIPeEX8.mjs +44 -0
- package/dist/.setup/{binding-connection-ThoatDcb.mjs → binding-connection-DTtN1KrX.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-yoHrABt-.mjs → binding-connection.runtime-6TpgD1M6.mjs} +4 -4
- package/dist/.setup/{bounded-turn-B2HScEgT.mjs → bounded-turn-CbjoN2OW.mjs} +15 -18
- package/dist/.setup/bounded-turn-isolation-B8K_ylqk.mjs +14 -0
- package/dist/.setup/{build-state-C7EnDVgr.mjs → build-state-Da1_z0kd.mjs} +1 -1
- package/dist/.setup/{capabilities-CDXOOFdZ.mjs → capabilities-B3WEZl4e.mjs} +2 -10
- package/dist/.setup/{client-Cs08OXVQ.mjs → client-N0JpgSzF.mjs} +138 -399
- package/dist/.setup/{client-catalog-response-BMgt_4q4.mjs → client-catalog-response-5HHLdcde.mjs} +1 -1
- package/dist/.setup/{command-dispatch-B4JuOsOk.mjs → command-dispatch-BeAoaovI.mjs} +5 -8
- package/dist/.setup/{command-formatters-Bmqvr9tO.mjs → command-formatters-R3ckE3Co.mjs} +29 -61
- package/dist/.setup/{command-handlers-DW7Lx9oH.mjs → command-handlers-ylTMS00z.mjs} +222 -343
- package/dist/.setup/{command-rpc-DixIj3HW.mjs → command-rpc-CGJGUQ6Y.mjs} +15 -18
- package/dist/.setup/compact-C2WamavS.mjs +776 -0
- package/dist/.setup/{config-BoTP_mrL.mjs → config-DKhXquav.mjs} +26 -28
- package/dist/.setup/{config-options-BvaRs51b.mjs → config-options-CzyWLTJt.mjs} +24 -37
- package/dist/.setup/{config-parsing-CcB9iPoq.mjs → config-parsing-b088LyhT.mjs} +57 -60
- package/dist/.setup/{config-runtime-C8Rw1m1m.mjs → config-runtime-C0NbLms1.mjs} +2 -2
- package/dist/.setup/{config-security-BEReZ6go.mjs → config-security-CE-FcGw9.mjs} +32 -111
- package/dist/.setup/{config-utils-DujwEnhg.mjs → config-utils-D0CXecki.mjs} +3 -13
- package/dist/.setup/context-engine-projection-PezSESth.mjs +387 -0
- package/dist/.setup/{conversation-binding-DP-gMrBP.mjs → conversation-binding-3Min8qvP.mjs} +67 -90
- package/dist/.setup/{conversation-binding-data-CrcyZk6O.mjs → conversation-binding-data-C746z5Pn.mjs} +8 -12
- package/dist/.setup/{conversation-control-uK9Jomlc.mjs → conversation-control-CEP8X5JC.mjs} +8 -8
- package/dist/.setup/{cyber-failover-DYwbmf1o.mjs → cyber-failover-XV0nNRZu.mjs} +1 -1
- package/dist/.setup/{cyber-failover-notice-e9G3J9-e.mjs → cyber-failover-notice-RNpGpTyP.mjs} +1 -1
- package/dist/.setup/{dynamic-tools-BDXl-8Cw.mjs → dynamic-tools-DzlsLUuS.mjs} +2305 -2606
- package/dist/.setup/{effective-mcp-catalog-CvnvnGIe.mjs → effective-mcp-catalog-CxUtC-xG.mjs} +8 -17
- package/dist/.setup/{ephemeral-turn-poidXgek.mjs → ephemeral-turn-CDsPJOa2.mjs} +3 -3
- package/dist/.setup/event-projector-assistant-message-CigreO4K.mjs +69 -0
- package/dist/.setup/{event-projector-usage-CnBS8Wa3.mjs → event-projector-usage-03R0I2dM.mjs} +3 -25
- package/dist/.setup/event-projector-values-DJSz8BTk.mjs +106 -0
- package/dist/.setup/incognito-session-DWYapfwf.mjs +2 -0
- package/dist/.setup/{inference-context-D96l9-ew.mjs → inference-context-D-9gWlTR.mjs} +16 -18
- package/dist/.setup/inference-dispatch-CMZtjQyz.mjs +359 -0
- package/dist/.setup/inference-metadata-CgIf7sOx.mjs +81 -0
- package/dist/.setup/{inference-proxy-b-aJMSxm.mjs → inference-proxy-DhcXOgUE.mjs} +174 -214
- package/dist/.setup/{isolated-completion-BIZFhTNG.mjs → isolated-completion-Dm3PzxJk.mjs} +9 -12
- package/dist/.setup/{managed-binary-BnshlFag.mjs → managed-binary-kiWRhNRE.mjs} +8 -12
- package/dist/.setup/{model-catalog-CfXJf9Ay.mjs → model-catalog-PAuZgJC6.mjs} +11 -10
- package/dist/.setup/model-runtime-BdqzOMkU.mjs +11 -0
- package/dist/.setup/{models-KnqBv0hE.mjs → models-DHXZtVVk.mjs} +9 -18
- package/dist/.setup/{native-auth-rWbGbMn3.mjs → native-auth-CuG53tu4.mjs} +4 -4
- package/dist/.setup/{native-execution-policy-umd0tgh4.mjs → native-execution-policy-BxZJy5mP.mjs} +5 -30
- package/dist/.setup/{native-subagent-monitor-D3filLY2.mjs → native-subagent-monitor-Dpsmf2wz.mjs} +4395 -3609
- package/dist/.setup/native-subagent-pending-assignments-DwkCzLvD.mjs +203 -0
- package/dist/.setup/native-task-assignments-DMQ0g3hu.mjs +194 -0
- package/dist/.setup/{node-cli-sessions-r3avj02l.mjs → node-cli-sessions-HC4W6FLI.mjs} +19 -49
- package/dist/.setup/{node-exec-server.runtime-BDwWXVpK.mjs → node-exec-server.runtime-BgBfWQqo.mjs} +3 -6
- package/dist/.setup/{plan-CN3VwfNU.mjs → plan-Y-QIvrKB.mjs} +49 -92
- package/dist/.setup/{plugin-activation-DT3MNtqj.mjs → plugin-activation-cNHRfaxU.mjs} +8 -36
- package/dist/.setup/{plugin-app-cache-key-B2CsSdnV.mjs → plugin-app-cache-key-BL9B5H0L.mjs} +6 -23
- package/dist/.setup/{plugin-inventory-BoRei8Z4.mjs → plugin-inventory-Cky2XJUw.mjs} +21 -21
- package/dist/.setup/{plugin-marketplace-discovery-CDOi8IFs.mjs → plugin-marketplace-discovery-D_dV9FXa.mjs} +18 -24
- package/dist/.setup/{plugin-metadata-cache-Ctmo83k_.mjs → plugin-metadata-cache-DsjsL1dr.mjs} +115 -175
- package/dist/.setup/{provider-BOsxQHOM.mjs → provider-DH8NSzGt.mjs} +11 -14
- package/dist/.setup/{provider-capabilities-BfE88FZ5.mjs → provider-capabilities-CAxoF-X1.mjs} +13 -18
- package/dist/.setup/{rate-limits-CMU3DUD0.mjs → rate-limits-B7-X2TgG.mjs} +9 -31
- package/dist/.setup/{request-D2L0zMrq.mjs → request-BHZ1nz8d.mjs} +7 -6
- package/dist/.setup/responses-oauth-twnuTaAa.mjs +93 -0
- package/dist/.setup/rpc-error-BlD2vuzn.mjs +31 -0
- package/dist/.setup/{run-attempt-BHu11r7h.mjs → run-attempt-D8RZUOzY.mjs} +1035 -1023
- package/dist/.setup/{run-attempt-lifecycle-B7JbY4-F.mjs → run-attempt-lifecycle-C-6O3Exn.mjs} +10 -24
- package/dist/.setup/{runtime-artifact-CLZ8udh-.mjs → runtime-artifact-DDQ-HGXf.mjs} +16 -4
- package/dist/.setup/runtime-artifact-connection-D68qQn1m.mjs +78 -0
- package/dist/.setup/sandbox-guard-DjCz2eOw.mjs +126 -0
- package/dist/.setup/scope-DOC1Xjc8.mjs +6 -0
- package/dist/.setup/session-binding-DGCYAfvD.mjs +443 -0
- package/dist/.setup/{session-binding-record-BGoz8wOK.mjs → session-binding-record-Oe9L-CNY.mjs} +52 -130
- package/dist/.setup/{session-binding-sidecars-BlB5EvIS.mjs → session-binding-sidecars-jo6H8dFr.mjs} +196 -17
- package/dist/.setup/{session-catalog-Pno1xGcl.mjs → session-catalog-4sCdv5qx.mjs} +170 -324
- package/dist/.setup/{session-catalog-adoption-BI6UTDZT.mjs → session-catalog-adoption-BU_pHWG7.mjs} +7 -6
- package/dist/.setup/{session-catalog-archive-lHBqzhaO.mjs → session-catalog-archive-spHfihri.mjs} +6 -6
- package/dist/.setup/session-catalog-events-DePDzzjc.mjs +139 -0
- package/dist/.setup/session-catalog-home-id-vlih0B_g.mjs +22 -0
- package/dist/.setup/{session-catalog-index-B9_VQIUz.mjs → session-catalog-index-CZvDzC6z.mjs} +126 -122
- package/dist/.setup/{session-catalog-index-order-hcdz07yN.mjs → session-catalog-index-order-BcQpHks3.mjs} +1 -1
- package/dist/.setup/{session-catalog-index-state-Dgh8ORJm.mjs → session-catalog-index-state-TeO7EyO-.mjs} +3 -2
- package/dist/.setup/session-catalog-limits-DDxOsQeC.mjs +14 -0
- package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +170 -0
- package/dist/.setup/session-catalog-native-projection-DjhwGL6x.mjs +178 -0
- package/dist/.setup/{session-catalog-node-adoption-ITddWx_X.mjs → session-catalog-node-adoption-DgXvSGu0.mjs} +10 -27
- package/dist/.setup/{session-catalog-node-continue-6g6qi4A9.mjs → session-catalog-node-continue-DjKXHBbi.mjs} +8 -10
- package/dist/.setup/session-catalog-node-lookup-CtAXI5W5.mjs +56 -0
- package/dist/.setup/{session-catalog-native-projection-DowriLid.mjs → session-catalog-parsing-CPGaPYr-.mjs} +11 -194
- package/dist/.setup/{session-catalog-projection-zK_PUsiE.mjs → session-catalog-projection-Cr5qP5Dj.mjs} +6 -4
- package/dist/.setup/session-catalog-provenance-DoAvktcj.mjs +95 -0
- package/dist/.setup/{session-cli-irrD-uo7.mjs → session-cli-Cn_nCqfq.mjs} +9 -22
- package/dist/.setup/{session-history-BrqhSCf9.mjs → session-history-D83lJWHG.mjs} +4 -6
- package/dist/.setup/{session-history-import-D-3wAgOP.mjs → session-history-import-WhX-X33a.mjs} +7 -10
- package/dist/.setup/session-history-read-Ov3StuL4.mjs +133 -0
- package/dist/.setup/{session-history.worker-CaCh0xF_.mjs → session-history.worker-MnPKncqP.mjs} +9 -5
- package/dist/.setup/session-initialization-6aveB9qb.mjs +22 -0
- package/dist/.setup/{session-permission-policy-BI1QK_98.mjs → session-permission-policy-Ci_fVX6y.mjs} +4 -8
- package/dist/.setup/{session-retirement-BH-S6qkJ.mjs → session-retirement-qMTxkNx2.mjs} +17 -17
- package/dist/.setup/{settled-turn-context-fmwouT5I.mjs → settled-turn-context-D4yj4rxf.mjs} +1 -1
- package/dist/.setup/{settled-turn-finalizer-DiAi6Kx6.mjs → settled-turn-finalizer-BsvEabkw.mjs} +14 -10
- package/dist/.setup/{shared-client-DA4VR4Eb.mjs → shared-client-DqyTMYug.mjs} +783 -412
- package/dist/.setup/shared-client-lifecycle-DJIgqgMw.mjs +153 -0
- package/dist/.setup/{side-question-BJ1wSDcB.mjs → side-question-C4kCmQy1.mjs} +79 -143
- package/dist/.setup/{source-CUzJq5WN.mjs → source-CS_7GFJZ.mjs} +80 -137
- package/dist/.setup/{thread-lifecycle-B3mfz1TG.mjs → thread-lifecycle-DPflntEJ.mjs} +294 -737
- package/dist/.setup/{incognito-session-uhrBF6wJ.mjs → thread-ownership-queue-Dp24d7-F.mjs} +1 -2
- package/dist/.setup/{thread-ownership-DcTtAcXj.mjs → thread-ownership-roNP0l1c.mjs} +45 -10
- package/dist/.setup/{thread-policy-DGuQsuFC.mjs → thread-policy-DTd-DtkX.mjs} +46 -7
- package/dist/.setup/{thread-requests-BLvGkP2R.mjs → thread-requests-B_bRnMGN.mjs} +199 -302
- package/dist/.setup/{thread-resume-DIBXwOpE.mjs → thread-resume-CdDaoc7T.mjs} +6 -6
- package/dist/.setup/{timeout-C910MdAB.mjs → timeout-CXOfNoaX.mjs} +1 -35
- package/dist/.setup/{transcript-history-projection-ZZpkFkJ_.mjs → transcript-history-projection-DRSifI-1.mjs} +17 -89
- package/dist/.setup/{transcript-mirror-attestation-CzM-94NC.mjs → transcript-mirror-attestation-YSegaktH.mjs} +3 -4
- package/dist/.setup/{transcript-mirror-BtHDBp1G.mjs → transcript-mirror-kxmCYsuF.mjs} +7 -9
- package/dist/.setup/{transport-stdio-h2VHOskC.mjs → transport-stdio-Bdegpn2V.mjs} +5 -22
- package/dist/.setup/transport-websocket-BTBE-LD9.mjs +211 -0
- package/dist/.setup/{upstream-prompt-provenance-LphB8slG.mjs → upstream-prompt-provenance-fXkKbPVC.mjs} +3 -9
- package/dist/.setup/{upstream-session-fork-BUr4OUbC.mjs → upstream-session-fork-CBeVjBpT.mjs} +23 -23
- package/dist/.setup/{usage-BML0r-ua.mjs → usage-BMzNxeR_.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-DUMbefVY.mjs → usage-limit-error-QXerDo3i.mjs} +4 -19
- package/dist/.setup/{web-search-provider.runtime-CDKlN-Rv.mjs → web-search-provider.runtime-P77OUeoo.mjs} +8 -19
- package/dist/api.js +9 -11
- package/dist/catalog-page.worker.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +50 -8
- package/dist/harness.js +344 -1
- package/dist/index.js +193 -245
- package/dist/media-understanding-provider.js +9 -22
- package/dist/migration-provider-api.js +1 -1
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +3 -3
- package/dist/session-history.worker.js +1 -1
- package/openclaw.plugin.json +14 -2
- package/package.json +7 -6
- package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +0 -331
- package/dist/.setup/compact-Du5UvtxA.mjs +0 -680
- package/dist/.setup/event-projector-assistant-message-BsruvNrH.mjs +0 -103
- package/dist/.setup/event-projector-items-C6L_5ZiT.mjs +0 -234
- package/dist/.setup/harness-a_MsE4-_.mjs +0 -355
- package/dist/.setup/history-rejection-B4nOXNXF.mjs +0 -13
- package/dist/.setup/image-payload-sanitizer-tupAr-2o.mjs +0 -79
- package/dist/.setup/local-runtime-attribution-B_2mnqhb.mjs +0 -19
- package/dist/.setup/native-subagent-history-0nYYgo0k.mjs +0 -148
- package/dist/.setup/native-subagent-task-ids-wb8CKZGN.mjs +0 -441
- package/dist/.setup/plugin-approval-roundtrip-C0MZzCuP.mjs +0 -122
- package/dist/.setup/rolldown-runtime-8H4AJuhK.mjs +0 -14
- package/dist/.setup/sandbox-guard-C2sRMOEY.mjs +0 -166
- package/dist/.setup/session-binding-Cm0apEbd.mjs +0 -692
- package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +0 -347
- package/dist/.setup/session-history-read-B3ZfSUbF.mjs +0 -50
- package/dist/.setup/session-initialization-rcgbZiid.mjs +0 -75
- package/dist/.setup/thread-history-page-DoVpnHim.mjs +0 -83
package/dist/.setup/{effective-mcp-catalog-CvnvnGIe.mjs → effective-mcp-catalog-CxUtC-xG.mjs}
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "./
|
|
1
|
+
import { v as sessionBindingIdentity } from "./session-binding-record-Oe9L-CNY.mjs";
|
|
2
|
+
import { l as retainSharedCodexAppServerClientByInstanceId } from "./shared-client-lifecycle-DJIgqgMw.mjs";
|
|
3
|
+
import "./shared-client-DqyTMYug.mjs";
|
|
4
|
+
import "./session-binding-DGCYAfvD.mjs";
|
|
4
5
|
import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
6
|
import { assignMcpCatalogSafeServerNames } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
6
7
|
//#region extensions/codex/src/app-server/effective-mcp-catalog.ts
|
|
@@ -21,7 +22,6 @@ function catalogTool(params) {
|
|
|
21
22
|
...params.deniedBySession ? { deniedBySession: true } : {}
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
|
-
/** Converts Codex's thread-scoped status response into OpenClaw's MCP catalog shape. */
|
|
25
25
|
function buildCodexEffectiveMcpCatalog(statuses, toolOverrides) {
|
|
26
26
|
const orderedStatuses = [...new Map(statuses.map((status) => [status.name, status])).values()].toSorted((left, right) => left.name.localeCompare(right.name));
|
|
27
27
|
const safeNames = assignMcpCatalogSafeServerNames(orderedStatuses.map((status) => status.name));
|
|
@@ -89,11 +89,6 @@ async function listCodexMcpServerStatuses(client, threadId) {
|
|
|
89
89
|
}
|
|
90
90
|
throw new Error("Codex mcpServerStatus/list exceeded the bounded page limit");
|
|
91
91
|
}
|
|
92
|
-
/** Loads the requested MCP inventory from the exact client/thread already selected for a run. */
|
|
93
|
-
async function loadCodexEffectiveMcpCatalogFromThread(params) {
|
|
94
|
-
const allowedServerNames = new Set(params.mcpServerNames);
|
|
95
|
-
return buildCodexEffectiveMcpCatalog((await listCodexMcpServerStatuses(params.client, params.threadId)).filter((status) => allowedServerNames.has(status.name)), params.toolOverrides);
|
|
96
|
-
}
|
|
97
92
|
/** Loads MCP inventory from the bound Codex client while retaining its lease through all pages. */
|
|
98
93
|
async function loadCodexEffectiveMcpCatalog(params, options) {
|
|
99
94
|
const binding = options.bindingStore.read(sessionBindingIdentity({
|
|
@@ -103,17 +98,13 @@ async function loadCodexEffectiveMcpCatalog(params, options) {
|
|
|
103
98
|
config: params.config
|
|
104
99
|
}));
|
|
105
100
|
if (!binding?.clientId) return;
|
|
106
|
-
const retained = retainSharedCodexAppServerClientByInstanceId(binding.clientId);
|
|
101
|
+
const retained = await retainSharedCodexAppServerClientByInstanceId(binding.clientId);
|
|
107
102
|
if (!retained) return;
|
|
108
103
|
try {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
threadId: binding.threadId,
|
|
112
|
-
mcpServerNames: params.mcpServerNames,
|
|
113
|
-
toolOverrides: params.toolOverrides
|
|
114
|
-
});
|
|
104
|
+
const allowedServerNames = new Set(params.mcpServerNames);
|
|
105
|
+
return buildCodexEffectiveMcpCatalog((await listCodexMcpServerStatuses(retained.client, binding.threadId)).filter((status) => allowedServerNames.has(status.name)), params.toolOverrides);
|
|
115
106
|
} finally {
|
|
116
|
-
retained.release();
|
|
107
|
+
await retained.release();
|
|
117
108
|
}
|
|
118
109
|
}
|
|
119
110
|
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { h as getCodexAppServerTurnRouter } from "./attempt-client-cleanup-
|
|
4
|
-
import {
|
|
2
|
+
import { E as readCodexTurnCompletedNotification } from "./client-N0JpgSzF.mjs";
|
|
3
|
+
import { h as getCodexAppServerTurnRouter } from "./attempt-client-cleanup-DOP-cW5j.mjs";
|
|
4
|
+
import { o as isTerminalTurnStatus, s as readCodexNotificationItem, t as CodexUsageProjection } from "./event-projector-usage-03R0I2dM.mjs";
|
|
5
5
|
import { readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { toStringifiedError } from "openclaw/plugin-sdk/error-runtime";
|
|
7
7
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { t as codexProviderRefusalDiagnostics } from "./event-projector-values-DJSz8BTk.mjs";
|
|
2
|
+
import { o as resolveCodexLocalRuntimeAttribution } from "./native-subagent-monitor-Dpsmf2wz.mjs";
|
|
3
|
+
import { createAgentHarnessAssistantMessage } from "openclaw/plugin-sdk/agent-harness-attempt-runtime";
|
|
4
|
+
//#region extensions/codex/src/app-server/event-projector-assistant-message.ts
|
|
5
|
+
function createAssistantMessage(params, text, options) {
|
|
6
|
+
return createAttributedCodexAssistantMessage({
|
|
7
|
+
...resolveCodexLocalRuntimeAttribution(params),
|
|
8
|
+
modelId: params.modelId
|
|
9
|
+
}, text, options);
|
|
10
|
+
}
|
|
11
|
+
/** Creates a Codex assistant row when a bounded call already owns attribution. */
|
|
12
|
+
function createAttributedCodexAssistantMessage(attribution, text, options) {
|
|
13
|
+
const refusal = options.providerRefusal;
|
|
14
|
+
return createAgentHarnessAssistantMessage({
|
|
15
|
+
...attribution,
|
|
16
|
+
api: attribution.api ?? "openai-chatgpt-responses"
|
|
17
|
+
}, text, {
|
|
18
|
+
tokenUsage: options.tokenUsage,
|
|
19
|
+
aborted: options.aborted,
|
|
20
|
+
promptError: options.promptError,
|
|
21
|
+
errorMessage: refusal?.message,
|
|
22
|
+
...refusal ? codexProviderRefusalDiagnostics(refusal, Date.now()) : {}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function createAssistantCommentaryMessage(params, text, itemId, timestamp) {
|
|
26
|
+
return {
|
|
27
|
+
...createNonterminalAssistantMessage(params, [{
|
|
28
|
+
type: "text",
|
|
29
|
+
text
|
|
30
|
+
}], timestamp),
|
|
31
|
+
openclawStreamFallback: {
|
|
32
|
+
replacementText: text,
|
|
33
|
+
source: "segment",
|
|
34
|
+
itemId
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function createAssistantAsyncMessage(params, text, itemId, timestamp, questions) {
|
|
39
|
+
return {
|
|
40
|
+
...createNonterminalAssistantMessage(params, [{
|
|
41
|
+
type: "text",
|
|
42
|
+
text
|
|
43
|
+
}], timestamp),
|
|
44
|
+
openclawAsyncDelivery: {
|
|
45
|
+
itemId,
|
|
46
|
+
...questions ? { questions } : {}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function createAssistantReasoningMessage(params, text) {
|
|
51
|
+
return createNonterminalAssistantMessage(params, [{
|
|
52
|
+
type: "thinking",
|
|
53
|
+
thinking: text
|
|
54
|
+
}]);
|
|
55
|
+
}
|
|
56
|
+
function createNonterminalAssistantMessage(params, content, timestamp) {
|
|
57
|
+
const attribution = resolveCodexLocalRuntimeAttribution(params);
|
|
58
|
+
return createAgentHarnessAssistantMessage({
|
|
59
|
+
...attribution,
|
|
60
|
+
api: attribution.api ?? "openai-chatgpt-responses",
|
|
61
|
+
modelId: params.modelId
|
|
62
|
+
}, "", {
|
|
63
|
+
content,
|
|
64
|
+
aborted: false,
|
|
65
|
+
timestamp
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { createAttributedCodexAssistantMessage as a, createAssistantReasoningMessage as i, createAssistantCommentaryMessage as n, createAssistantMessage as r, createAssistantAsyncMessage as t };
|
package/dist/.setup/{event-projector-usage-CnBS8Wa3.mjs → event-projector-usage-03R0I2dM.mjs}
RENAMED
|
@@ -15,13 +15,11 @@ function updateActiveTurnItemIds(notification, activeItemIds) {
|
|
|
15
15
|
}
|
|
16
16
|
activeItemIds.delete(itemId);
|
|
17
17
|
}
|
|
18
|
-
/** Reads an item id from supported notification envelope shapes. */
|
|
19
18
|
function readNotificationItemId(notification) {
|
|
20
19
|
if (!isJsonObject(notification.params)) return;
|
|
21
20
|
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
22
21
|
return (item ? readStringField(item, "id") : void 0) ?? readStringField(notification.params, "itemId") ?? readStringField(notification.params, "id");
|
|
23
22
|
}
|
|
24
|
-
/** Detects completion for an OpenClaw dynamic tool result still awaited by Codex. */
|
|
25
23
|
function isPendingOpenClawDynamicToolCompletionNotification(notification, pendingOpenClawDynamicToolCompletionIds) {
|
|
26
24
|
if (notification.method !== "item/completed" || !isJsonObject(notification.params)) return false;
|
|
27
25
|
const itemId = readNotificationItemId(notification);
|
|
@@ -35,7 +33,6 @@ function isRawFunctionToolOutputCompletionNotification(notification) {
|
|
|
35
33
|
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
36
34
|
return item ? readStringField(item, "type") === "function_call_output" : false;
|
|
37
35
|
}
|
|
38
|
-
/** Returns true for terminal app-server thread status strings. */
|
|
39
36
|
function isTerminalTurnStatus(status) {
|
|
40
37
|
return status === "completed" || status === "interrupted" || status === "failed";
|
|
41
38
|
}
|
|
@@ -46,13 +43,9 @@ function isCodexTurnAbortMarkerNotification(notification, options = {}) {
|
|
|
46
43
|
const role = isJsonObject(item) ? readStringField(item, "role") : void 0;
|
|
47
44
|
if (!isJsonObject(item) || readStringField(item, "type") !== "message" || role !== "user" && role !== "developer") return false;
|
|
48
45
|
const text = extractRawResponseItemText(item).trim();
|
|
49
|
-
const currentPromptTexts = [options.currentPromptText, ...options.currentPromptTexts ?? []].filter(
|
|
46
|
+
const currentPromptTexts = [options.currentPromptText, ...options.currentPromptTexts ?? []].filter((prompt) => typeof prompt === "string" && prompt.length > 0).map((prompt) => prompt.trim());
|
|
50
47
|
if (role === "user" && currentPromptTexts.includes(text)) return false;
|
|
51
|
-
return
|
|
52
|
-
}
|
|
53
|
-
function readCodexTurnAbortMarkerBody(text) {
|
|
54
|
-
if (!text.startsWith(CODEX_TURN_ABORT_MARKER_START) || !text.endsWith(CODEX_TURN_ABORT_MARKER_END)) return;
|
|
55
|
-
return text.slice(14, -15).trim();
|
|
48
|
+
return text.startsWith(CODEX_TURN_ABORT_MARKER_START) && text.endsWith(CODEX_TURN_ABORT_MARKER_END);
|
|
56
49
|
}
|
|
57
50
|
function extractRawResponseItemText(item) {
|
|
58
51
|
const content = item.content;
|
|
@@ -65,7 +58,6 @@ function extractRawResponseItemText(item) {
|
|
|
65
58
|
return text ? [text] : [];
|
|
66
59
|
}).join("");
|
|
67
60
|
}
|
|
68
|
-
/** Reads a typed Codex item from notification params when id/type are present. */
|
|
69
61
|
function readCodexNotificationItem(params) {
|
|
70
62
|
if (!isJsonObject(params) || !isJsonObject(params.item)) return;
|
|
71
63
|
const item = params.item;
|
|
@@ -86,20 +78,6 @@ function readRawResponseToolCallId(notification) {
|
|
|
86
78
|
default: return;
|
|
87
79
|
}
|
|
88
80
|
}
|
|
89
|
-
/** Maps Codex item types to the tool name shown in execution progress. */
|
|
90
|
-
function codexExecutionToolName(item) {
|
|
91
|
-
if (item.type === "dynamicToolCall" && typeof item.tool === "string") return item.tool;
|
|
92
|
-
if (item.type === "mcpToolCall" && typeof item.tool === "string") {
|
|
93
|
-
const server = typeof item.server === "string" && item.server ? item.server : void 0;
|
|
94
|
-
return server ? `${server}.${item.tool}` : item.tool;
|
|
95
|
-
}
|
|
96
|
-
if (item.type === "commandExecution") return "bash";
|
|
97
|
-
if (item.type === "fileChange") return "apply_patch";
|
|
98
|
-
if (item.type === "webSearch") return "web_search";
|
|
99
|
-
}
|
|
100
|
-
function isNonEmptyString(value) {
|
|
101
|
-
return typeof value === "string" && value.length > 0;
|
|
102
|
-
}
|
|
103
81
|
//#endregion
|
|
104
82
|
//#region extensions/codex/src/app-server/event-projector-usage.ts
|
|
105
83
|
function readTokenCount(record, key) {
|
|
@@ -199,4 +177,4 @@ var CodexUsageProjection = class {
|
|
|
199
177
|
}
|
|
200
178
|
};
|
|
201
179
|
//#endregion
|
|
202
|
-
export {
|
|
180
|
+
export { isRawFunctionToolOutputCompletionNotification as a, readNotificationItemId as c, isPendingOpenClawDynamicToolCompletionNotification as i, readRawResponseToolCallId as l, readCodexThreadContextSnapshot as n, isTerminalTurnStatus as o, isCodexTurnAbortMarkerNotification as r, readCodexNotificationItem as s, CodexUsageProjection as t, updateActiveTurnItemIds as u };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
2
|
+
import { asFiniteNumber, normalizeOptionalString as normalizeOptionalString$1, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
+
import { Buffer } from "node:buffer";
|
|
4
|
+
//#region extensions/codex/src/app-server/event-projector-values.ts
|
|
5
|
+
const BIO_POLICY_SAFETY_ACCESS_BLOCK_PREFIX = "This content was flagged for possible biological risk.";
|
|
6
|
+
/** Decode app-server v2 findings with the Codex UI's UTF-8 limits; never truncate a steer. */
|
|
7
|
+
function readCodexMisalignmentReview(value) {
|
|
8
|
+
if (!isJsonObject(value)) return;
|
|
9
|
+
const explanation = value.detailedExplanation;
|
|
10
|
+
if (typeof explanation !== "string" || !explanation.trim() || Buffer.byteLength(explanation, "utf8") > 65536) return;
|
|
11
|
+
const message = isJsonObject(value.steer) ? value.steer.message : void 0;
|
|
12
|
+
return {
|
|
13
|
+
explanation,
|
|
14
|
+
...typeof message === "string" && message.trim() && Buffer.byteLength(message, "utf8") <= 1024 ? { continuation: { message } } : {},
|
|
15
|
+
...typeof value.errorType === "string" && value.errorType.trim() ? { errorType: value.errorType } : {}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/** Project only Codex's explicit refusal contracts; other policy errors retain their own paths. */
|
|
19
|
+
function readCodexProviderRefusal(message, codexErrorInfo, options) {
|
|
20
|
+
if (!message) return;
|
|
21
|
+
if (codexErrorInfo === "cyberPolicy") return {
|
|
22
|
+
category: "cyber",
|
|
23
|
+
message
|
|
24
|
+
};
|
|
25
|
+
if (codexErrorInfo === "misalignmentPolicyViolation") {
|
|
26
|
+
const review = readCodexMisalignmentReview(options?.misalignment);
|
|
27
|
+
return {
|
|
28
|
+
category: "misalignment",
|
|
29
|
+
message,
|
|
30
|
+
...review ? { review } : {},
|
|
31
|
+
...options?.nativeThreadId ? { nativeThreadId: options.nativeThreadId } : {},
|
|
32
|
+
...options?.nativeTurnId ? { nativeTurnId: options.nativeTurnId } : {}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return message.startsWith(BIO_POLICY_SAFETY_ACCESS_BLOCK_PREFIX) ? {
|
|
36
|
+
category: "bio",
|
|
37
|
+
message
|
|
38
|
+
} : void 0;
|
|
39
|
+
}
|
|
40
|
+
function codexProviderRefusalDetails(refusal) {
|
|
41
|
+
return {
|
|
42
|
+
provider: "openai",
|
|
43
|
+
category: refusal.category,
|
|
44
|
+
...refusal.review ? { review: refusal.review } : {},
|
|
45
|
+
...refusal.nativeThreadId ? { nativeThreadId: refusal.nativeThreadId } : {},
|
|
46
|
+
...refusal.nativeTurnId ? { nativeTurnId: refusal.nativeTurnId } : {}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function codexProviderRefusalDiagnostics(refusal, timestamp) {
|
|
50
|
+
return refusal ? { diagnostics: [{
|
|
51
|
+
type: "provider_refusal",
|
|
52
|
+
timestamp,
|
|
53
|
+
details: codexProviderRefusalDetails(refusal)
|
|
54
|
+
}] } : {};
|
|
55
|
+
}
|
|
56
|
+
function readNonEmptyString(record, key) {
|
|
57
|
+
return normalizeOptionalString$1(record[key]);
|
|
58
|
+
}
|
|
59
|
+
function readNullableString(record, key) {
|
|
60
|
+
const value = record[key];
|
|
61
|
+
if (value === null) return null;
|
|
62
|
+
return typeof value === "string" ? value : void 0;
|
|
63
|
+
}
|
|
64
|
+
function readNonNegativeInteger(record, key) {
|
|
65
|
+
const value = asFiniteNumber(record[key]);
|
|
66
|
+
return value !== void 0 && Number.isInteger(value) && value >= 0 ? value : void 0;
|
|
67
|
+
}
|
|
68
|
+
function readCodexErrorNotificationMessage(record) {
|
|
69
|
+
const error = record.error;
|
|
70
|
+
return isJsonObject(error) ? readStringField(error, "message") : void 0;
|
|
71
|
+
}
|
|
72
|
+
function readHookOutputEntries(value) {
|
|
73
|
+
if (!Array.isArray(value)) return [];
|
|
74
|
+
return value.flatMap((entry) => {
|
|
75
|
+
if (!isJsonObject(entry)) return [];
|
|
76
|
+
const text = readStringField(entry, "text");
|
|
77
|
+
if (!text) return [];
|
|
78
|
+
const kind = readStringField(entry, "kind");
|
|
79
|
+
return [{
|
|
80
|
+
...kind ? { kind } : {},
|
|
81
|
+
text
|
|
82
|
+
}];
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function splitPlanText(text) {
|
|
86
|
+
return text.split(/\r?\n/).map((line) => line.trim().replace(/^[-*]\s+/, "")).filter((line) => line.length > 0);
|
|
87
|
+
}
|
|
88
|
+
function extractRawAssistantText(item) {
|
|
89
|
+
const parts = (Array.isArray(item.content) ? item.content : []).flatMap((entry) => {
|
|
90
|
+
if (!isJsonObject(entry)) return [];
|
|
91
|
+
const type = readStringField(entry, "type");
|
|
92
|
+
if (type !== "output_text" && type !== "text") return [];
|
|
93
|
+
const value = readStringField(entry, "text");
|
|
94
|
+
return value === void 0 ? [] : [value];
|
|
95
|
+
});
|
|
96
|
+
return parts.length > 0 ? parts.join("").trim() : void 0;
|
|
97
|
+
}
|
|
98
|
+
function readItem(value) {
|
|
99
|
+
if (!isJsonObject(value)) return;
|
|
100
|
+
const type = typeof value.type === "string" ? value.type : void 0;
|
|
101
|
+
const id = typeof value.id === "string" ? value.id : void 0;
|
|
102
|
+
if (!type || !id) return;
|
|
103
|
+
return value;
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
export { readCodexProviderRefusal as a, readNonEmptyString as c, splitPlanText as d, readCodexErrorNotificationMessage as i, readNonNegativeInteger as l, extractRawAssistantText as n, readHookOutputEntries as o, normalizeOptionalString$1 as r, readItem as s, codexProviderRefusalDiagnostics as t, readNullableString as u };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as readCodexInferenceMetadata } from "./inference-metadata-CgIf7sOx.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
//#region extensions/codex/src/app-server/inference-context.ts
|
|
4
4
|
const MAX_CONTEXT_BYTES = 262144;
|
|
5
5
|
const MAX_ACTIVE_ROOTS = 64;
|
|
6
|
-
const CODEX_INFERENCE_GENERATION_KEY = "openclaw_inference_generation";
|
|
7
6
|
/** One physical inference transport owns these confidential, nonpersistent snapshots. */
|
|
8
7
|
function createCodexInferenceContext(assertClientCurrent) {
|
|
9
8
|
const roots = /* @__PURE__ */ new Map();
|
|
@@ -47,32 +46,31 @@ function createCodexInferenceContext(assertClientCurrent) {
|
|
|
47
46
|
};
|
|
48
47
|
},
|
|
49
48
|
/** Caller must authenticate its private transport before parsing any model request. */
|
|
50
|
-
prepare(body) {
|
|
49
|
+
prepare(body, preparedMetadata, requireAdmission = false) {
|
|
51
50
|
assertOpen();
|
|
52
|
-
const metadata =
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (!isJsonObject(value)) throw new Error("Codex inference request has invalid native metadata");
|
|
57
|
-
const threadId = value.thread_id;
|
|
58
|
-
if (metadata?.thread_id != null && threadId != null && metadata.thread_id !== threadId) throw new Error("Codex inference thread metadata disagrees");
|
|
59
|
-
const child = Boolean(value.parent_thread_id || value.subagent_kind || metadata?.["x-openai-subagent"] || metadata?.["x-codex-parent-thread-id"]);
|
|
60
|
-
const kind = value.request_kind;
|
|
61
|
-
if (child || kind === "compaction" || kind === "memory") return {
|
|
51
|
+
const metadata = preparedMetadata ?? readCodexInferenceMetadata(body);
|
|
52
|
+
const child = Boolean(metadata.parentThreadId || metadata.subagentKind || metadata.subagent);
|
|
53
|
+
const kind = metadata.requestKind;
|
|
54
|
+
if (!requireAdmission && (child || kind === "compaction" || kind === "memory")) return {
|
|
62
55
|
body,
|
|
63
56
|
assertCurrent: assertOpen,
|
|
64
57
|
signal: void 0
|
|
65
58
|
};
|
|
66
|
-
if (kind !== "turn" && kind !== "prewarm") throw new Error("Codex inference request has an unsupported native purpose");
|
|
67
|
-
const registration =
|
|
68
|
-
const generation =
|
|
69
|
-
if (kind === "prewarm" && body.generate === false && generation == null) return {
|
|
59
|
+
if (child || kind !== "turn" && kind !== "prewarm" && !(requireAdmission && kind === "compaction")) throw new Error("Codex inference request has an unsupported native purpose");
|
|
60
|
+
const registration = metadata.threadId ? roots.get(metadata.threadId) : void 0;
|
|
61
|
+
const generation = metadata.generation;
|
|
62
|
+
if (!requireAdmission && kind === "prewarm" && body.generate === false && generation == null) return {
|
|
70
63
|
body,
|
|
71
64
|
assertCurrent: assertOpen,
|
|
72
65
|
signal: void 0
|
|
73
66
|
};
|
|
74
67
|
if (!registration || generation !== registration.generation) throw new Error("Codex inference has no current admitted parent generation");
|
|
75
68
|
registration.assertCurrent();
|
|
69
|
+
if (kind === "compaction") return {
|
|
70
|
+
body,
|
|
71
|
+
assertCurrent: registration.assertCurrent,
|
|
72
|
+
signal: registration.controller.signal
|
|
73
|
+
};
|
|
76
74
|
const instructions = body.instructions;
|
|
77
75
|
if (instructions !== void 0 && typeof instructions !== "string") throw new Error("Codex inference request has invalid top-level instructions");
|
|
78
76
|
return {
|
|
@@ -91,4 +89,4 @@ function createCodexInferenceContext(assertClientCurrent) {
|
|
|
91
89
|
};
|
|
92
90
|
}
|
|
93
91
|
//#endregion
|
|
94
|
-
export { createCodexInferenceContext as
|
|
92
|
+
export { createCodexInferenceContext as t };
|