@openclaw/codex 2026.9.1-beta.1 → 2026.9.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/api.js +5 -6
- package/dist/{attempt-client-cleanup-bfsmcQ6m.js → attempt-client-cleanup-DYHcRQAa.js} +31 -45
- package/dist/attempt-context-DmQUNWwT.js +634 -0
- package/dist/{auth-binding-B4FfbcCg.js → auth-binding-Ds_QVm-X.js} +18 -3
- package/dist/{binding-connection-BMvPX73o.js → binding-connection-E6uDsPlx.js} +2 -2
- package/dist/{bounded-turn-B7iBUcuP.js → bounded-turn-wzJrwKKe.js} +15 -20
- package/dist/{capabilities-BRMh0aIq.js → capabilities-dIjNVCYH.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{command-formatters-DEsIufkt.js → command-formatters-CLHhEB1Q.js} +5 -4
- package/dist/{command-handlers-D_-1_qRp.js → command-handlers-CTGb2csu.js} +124 -101
- package/dist/{compact-BglNFZrQ.js → compact-_t0HQrUS.js} +38 -29
- package/dist/{config-giW8X0QA.js → config-BhmfC1s6.js} +294 -282
- package/dist/{context-compaction-activity-BOeJf7yo.js → context-compaction-activity-CMla5FPJ.js} +4 -1
- package/dist/{conversation-binding-data-CW2GuupV.js → conversation-binding-data-BiodpIzq.js} +2 -1
- package/dist/doctor-contract-api.js +143 -12
- package/dist/{dynamic-tools-Dnlfa--w.js → dynamic-tools-BU9tmlYm.js} +599 -655
- package/dist/{effective-mcp-catalog-CTeGrnfO.js → effective-mcp-catalog-DzYBW4h1.js} +2 -2
- package/dist/{event-projector-assistant-message-C5-Ds8mA.js → event-projector-assistant-message-DHRFXKbS.js} +4 -4
- package/dist/{event-projector-usage-Bk1I90Bg.js → event-projector-usage-C5mcrGjp.js} +15 -148
- package/dist/{harness-Csz0F-DK.js → harness-DXVZ5II5.js} +42 -52
- package/dist/harness.js +1 -1
- package/dist/index.js +458 -404
- package/dist/{isolated-completion-Cv6FqygM.js → isolated-completion-kg9kv4iH.js} +4 -4
- package/dist/launch-args-RXQwn8zV.js +90 -0
- package/dist/{managed-binary-DFYK4DWq.js → managed-binary-4-Vjz5GH.js} +14 -9
- package/dist/media-understanding-provider.js +1 -1
- package/dist/model-catalog-CUM68Hkl.js +101 -0
- package/dist/{models-TS3HBU-q.js → models-sYnEc0gd.js} +25 -28
- package/dist/{native-subagent-monitor-4Mfq2HDs.js → native-subagent-monitor-CnH147jH.js} +55 -115
- package/dist/{node-exec-server.runtime-BpWqJO1V.js → node-exec-server.runtime-CstNHCmC.js} +9 -6
- package/dist/{plugin-approval-roundtrip-bUm777tR.js → plugin-approval-roundtrip-CNe-Xrjx.js} +30 -3
- package/dist/{plugin-marketplace-discovery-B9DvaAG-.js → plugin-marketplace-discovery-CfFlKqDl.js} +15 -14
- package/dist/{plugin-metadata-cache-CTCT3w5L.js → plugin-metadata-cache-BFrPhb2c.js} +6 -6
- package/dist/provider-capabilities-DW5p4k9w.js +101 -0
- package/dist/{rate-limits-C5_D8Gmb.js → rate-limits-CawQJfUS.js} +3 -2
- package/dist/{sandbox-guard-kuWTn9C5.js → request-DYAI5FQE.js} +195 -2
- package/dist/{run-attempt-DYc0QCBF.js → run-attempt-D1hJO4fX.js} +828 -2100
- package/dist/{runtime-artifact-BvyT1uyd.js → runtime-artifact-C3jVimFn.js} +21 -14
- package/dist/{session-binding-Bcynfd-_.js → session-binding-BHuTCRZQ.js} +198 -127
- package/dist/{session-catalog-DaLKVtpH.js → session-catalog-yyvTWFOw.js} +564 -408
- package/dist/{session-cli-DMc4oS2w.js → session-cli-CmFEXMAM.js} +1 -1
- package/dist/session-history-C5J1AKzG.js +87 -0
- package/dist/session-initialization-BeWzjGiR.js +74 -0
- package/dist/{session-permission-policy-BrNH1bjy.js → session-permission-policy-DeWVTCMj.js} +2 -2
- package/dist/session-retirement-BujDjXVF.js +97 -0
- package/dist/{session-upstream-marker-BIkusb95.js → session-upstream-marker-C351-5Qw.js} +19 -4
- package/dist/settled-turn-context-D3SNWtUn.js +268 -0
- package/dist/settled-turn-finalizer-BVJx4yoc.js +104 -0
- package/dist/{shared-client-DKz23hHY.js → shared-client-DxcfF9KX.js} +3480 -679
- package/dist/{side-question-DjA_jsNe.js → side-question-BTZAII4l.js} +108 -70
- package/dist/{thread-lifecycle-L7oEkTlq.js → thread-lifecycle-DAcEJ_Om.js} +2188 -1915
- package/dist/{thread-ownership-DZeuKH1j.js → thread-ownership-zGokd8i1.js} +25 -14
- package/dist/thread-policy-g4KbJPzp.js +54 -0
- package/dist/{plugin-app-cache-key-C1CAdfcP.js → thread-resume-C7pyVKeW.js} +59 -7
- package/dist/{transcript-mirror-DsCMWBca.js → transcript-mirror-DTUxFWa_.js} +79 -17
- package/dist/transport-stdio-CyPldczm.js +726 -0
- package/dist/{upstream-prompt-provenance-CFmsKwr9.js → upstream-prompt-provenance-LphB8slG.js} +8 -4
- package/dist/upstream-session-fork-CYlBIGVt.js +966 -0
- package/dist/{usage-ROIaW3wo.js → usage-Bj-rrzkR.js} +3 -3
- package/dist/{web-search-provider.runtime-ClaNPV7N.js → web-search-provider.runtime-D2FWSK4w.js} +3 -3
- package/openclaw.plugin.json +1 -30
- package/package.json +6 -6
- package/dist/command-rpc-CCeCkf_v.js +0 -90
- package/dist/incognito-session-ET_ufDH-.js +0 -2
- package/dist/model-catalog-i9rNBthX.js +0 -48
- package/dist/protocol-validators-VeJxxJ0U.js +0 -2421
- package/dist/request-DXXGHko0.js +0 -157
- package/dist/session-catalog-home-id-BNwAJ9D7.js +0 -18
- package/dist/session-retirement-CcNC3YSY.js +0 -36
- package/dist/settled-turn-finalizer-Dc3ApjU4.js +0 -328
- package/dist/thread-resume-BE9qNEW0.js +0 -30
- package/dist/transport-stdio-DhoGy33Z.js +0 -99
- package/dist/upstream-session-fork-DlaHxSLC.js +0 -326
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as sessionBindingIdentity } from "./session-binding-
|
|
1
|
+
import { _ as retainSharedCodexAppServerClientByInstanceId } from "./shared-client-DxcfF9KX.js";
|
|
2
|
+
import { d as sessionBindingIdentity } from "./session-binding-BHuTCRZQ.js";
|
|
3
3
|
import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { assignMcpCatalogSafeServerNames } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
5
5
|
//#region extensions/codex/src/app-server/effective-mcp-catalog.ts
|
|
@@ -86,13 +86,13 @@ function createAssistantAsyncMessage(params, text, itemId, timestamp) {
|
|
|
86
86
|
openclawAsyncDelivery: { itemId }
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function createAssistantReasoningMessage(params, text) {
|
|
90
90
|
const attribution = resolveCodexLocalRuntimeAttribution(params);
|
|
91
91
|
return {
|
|
92
92
|
role: "assistant",
|
|
93
93
|
content: [{
|
|
94
|
-
type: "
|
|
95
|
-
|
|
94
|
+
type: "thinking",
|
|
95
|
+
thinking: text
|
|
96
96
|
}],
|
|
97
97
|
api: attribution.api ?? "openai-chatgpt-responses",
|
|
98
98
|
provider: attribution.provider,
|
|
@@ -103,4 +103,4 @@ function createAssistantMirrorMessage(params, title, text) {
|
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
105
|
//#endregion
|
|
106
|
-
export { createAttributedCodexAssistantMessage as a,
|
|
106
|
+
export { createAttributedCodexAssistantMessage as a, createAssistantReasoningMessage as i, createAssistantCommentaryMessage as n, createAssistantMessage as r, createAssistantAsyncMessage as t };
|
|
@@ -1,28 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $t as isJsonObject } from "./shared-client-DxcfF9KX.js";
|
|
2
2
|
import { asSafeIntegerInRange, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { normalizeUsage } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
4
|
-
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
5
4
|
//#region extensions/codex/src/app-server/attempt-notifications.ts
|
|
6
|
-
/**
|
|
7
|
-
* Predicates and readers for Codex app-server notification envelopes.
|
|
8
|
-
*/
|
|
9
5
|
const CODEX_TURN_ABORT_MARKER_START = "<turn_aborted>";
|
|
10
6
|
const CODEX_TURN_ABORT_MARKER_END = "</turn_aborted>";
|
|
11
|
-
/**
|
|
12
|
-
function describeNotificationActivity(notification) {
|
|
13
|
-
if (!isJsonObject(notification.params)) return { lastNotificationMethod: notification.method };
|
|
14
|
-
if (notification.method !== "rawResponseItem/completed") return { lastNotificationMethod: notification.method };
|
|
15
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
16
|
-
if (!item) return { lastNotificationMethod: notification.method };
|
|
17
|
-
return {
|
|
18
|
-
lastNotificationMethod: notification.method,
|
|
19
|
-
lastNotificationItemId: readStringField(item, "id"),
|
|
20
|
-
lastNotificationItemType: readStringField(item, "type"),
|
|
21
|
-
lastNotificationItemRole: readStringField(item, "role"),
|
|
22
|
-
lastAssistantTextPreview: readRawAssistantTextPreview(item)
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
/** Tracks active app-server item ids from item start/completion notifications. */
|
|
7
|
+
/** Tracks actual native items for explicit terminal-tool batching. */
|
|
26
8
|
function updateActiveTurnItemIds(notification, activeItemIds) {
|
|
27
9
|
if (notification.method !== "item/started" && notification.method !== "item/completed") return;
|
|
28
10
|
const itemId = readNotificationItemId(notification);
|
|
@@ -33,70 +15,6 @@ function updateActiveTurnItemIds(notification, activeItemIds) {
|
|
|
33
15
|
}
|
|
34
16
|
activeItemIds.delete(itemId);
|
|
35
17
|
}
|
|
36
|
-
function updateActiveCompletionBlockerItemIds(notification, activeItemIds) {
|
|
37
|
-
if (notification.method !== "item/started" && notification.method !== "item/completed") return;
|
|
38
|
-
const itemId = readNotificationItemId(notification);
|
|
39
|
-
if (!itemId) return;
|
|
40
|
-
if (notification.method === "item/completed") {
|
|
41
|
-
activeItemIds.delete(itemId);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const item = readCodexNotificationItem(notification.params);
|
|
45
|
-
if (item && isCompletionBlockingItem(item)) activeItemIds.add(itemId);
|
|
46
|
-
}
|
|
47
|
-
function isCompletionBlockingItem(item) {
|
|
48
|
-
switch (item.type) {
|
|
49
|
-
case "collabAgentToolCall":
|
|
50
|
-
case "commandExecution":
|
|
51
|
-
case "dynamicToolCall":
|
|
52
|
-
case "fileChange":
|
|
53
|
-
case "imageGeneration":
|
|
54
|
-
case "imageView":
|
|
55
|
-
case "mcpToolCall":
|
|
56
|
-
case "webSearch": return true;
|
|
57
|
-
default: return false;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function isCompletedAssistantNotification(notification) {
|
|
61
|
-
if (!isJsonObject(notification.params)) return false;
|
|
62
|
-
if (notification.method !== "item/completed") return false;
|
|
63
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
64
|
-
return Boolean(item && readStringField(item, "type") === "agentMessage" && readStringField(item, "phase") !== "commentary" && readStringField(item, "delivery") !== "async");
|
|
65
|
-
}
|
|
66
|
-
/** Returns true for completed app-server reasoning items. */
|
|
67
|
-
function isReasoningItemCompletionNotification(notification) {
|
|
68
|
-
if (!isJsonObject(notification.params) || notification.method !== "item/completed") return false;
|
|
69
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
70
|
-
return item ? readStringField(item, "type") === "reasoning" : false;
|
|
71
|
-
}
|
|
72
|
-
/** Returns true for completed assistant commentary items. */
|
|
73
|
-
function isAssistantCommentaryCompletionNotification(notification) {
|
|
74
|
-
if (!isJsonObject(notification.params) || notification.method !== "item/completed") return false;
|
|
75
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
76
|
-
return Boolean(item && readStringField(item, "type") === "agentMessage" && (readStringField(item, "phase") === "commentary" || readStringField(item, "delivery") === "async"));
|
|
77
|
-
}
|
|
78
|
-
/** Returns true for completed raw response reasoning items. */
|
|
79
|
-
function isRawReasoningCompletionNotification(notification) {
|
|
80
|
-
if (!isJsonObject(notification.params) || notification.method !== "rawResponseItem/completed") return false;
|
|
81
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
82
|
-
return item ? readStringField(item, "type") === "reasoning" : false;
|
|
83
|
-
}
|
|
84
|
-
/** Returns true for streamed app-server reasoning progress. */
|
|
85
|
-
function isReasoningProgressNotification(notification) {
|
|
86
|
-
return notification.method === "item/reasoning/textDelta" || notification.method === "item/reasoning/summaryTextDelta" || notification.method === "item/reasoning/summaryPartAdded";
|
|
87
|
-
}
|
|
88
|
-
/** Returns true when assistant completion can release the short idle watch. */
|
|
89
|
-
function isAssistantCompletionReleaseNotification(notification, turnCrossedToolHandoff) {
|
|
90
|
-
if (isCompletedAssistantNotification(notification)) return true;
|
|
91
|
-
return !turnCrossedToolHandoff && isRawAssistantCompletionNotification(notification);
|
|
92
|
-
}
|
|
93
|
-
/** Returns true when a notification proves assistant output is still active. */
|
|
94
|
-
function shouldDisarmAssistantCompletionIdleWatch(notification) {
|
|
95
|
-
if (!isJsonObject(notification.params)) return false;
|
|
96
|
-
if (notification.method === "item/started") return true;
|
|
97
|
-
if (notification.method === "item/agentMessage/delta") return true;
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
18
|
/** Reads an item id from supported notification envelope shapes. */
|
|
101
19
|
function readNotificationItemId(notification) {
|
|
102
20
|
if (!isJsonObject(notification.params)) return;
|
|
@@ -112,61 +30,18 @@ function isPendingOpenClawDynamicToolCompletionNotification(notification, pendin
|
|
|
112
30
|
const itemType = item ? readStringField(item, "type") : void 0;
|
|
113
31
|
return itemType === void 0 || itemType === "dynamicToolCall";
|
|
114
32
|
}
|
|
115
|
-
/** Returns true for raw response tool-output completion notifications. */
|
|
116
|
-
function isRawToolOutputCompletionNotification(notification) {
|
|
117
|
-
if (notification.method !== "rawResponseItem/completed" || !isJsonObject(notification.params)) return false;
|
|
118
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
119
|
-
switch (item ? readStringField(item, "type") : void 0) {
|
|
120
|
-
case "custom_tool_call_output":
|
|
121
|
-
case "function_call_output": return true;
|
|
122
|
-
default: return false;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
33
|
function isRawFunctionToolOutputCompletionNotification(notification) {
|
|
126
34
|
if (notification.method !== "rawResponseItem/completed" || !isJsonObject(notification.params)) return false;
|
|
127
35
|
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
128
36
|
return item ? readStringField(item, "type") === "function_call_output" : false;
|
|
129
37
|
}
|
|
130
|
-
/**
|
|
131
|
-
function
|
|
132
|
-
if (notification.
|
|
133
|
-
if (!isJsonObject(notification.params)) return false;
|
|
134
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
135
|
-
switch (item ? readStringField(item, "type") : void 0) {
|
|
136
|
-
case "commandExecution":
|
|
137
|
-
case "fileChange":
|
|
138
|
-
case "mcpToolCall":
|
|
139
|
-
case "webSearch": return true;
|
|
140
|
-
default: return false;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
/** Returns true for file-change patch update notifications. */
|
|
144
|
-
function isFileChangePatchUpdatedNotification(notification) {
|
|
145
|
-
return notification.method === "item/fileChange/patchUpdated" && isJsonObject(notification.params);
|
|
146
|
-
}
|
|
147
|
-
/** Returns true for raw assistant message progress with readable text. */
|
|
148
|
-
function isRawAssistantProgressNotification(notification) {
|
|
149
|
-
if (notification.method !== "rawResponseItem/completed" || !isJsonObject(notification.params)) return false;
|
|
150
|
-
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
151
|
-
return Boolean(item && readStringField(item, "type") === "message" && readStringField(item, "role") === "assistant" && readRawAssistantTextPreview(item));
|
|
152
|
-
}
|
|
153
|
-
/** Returns true for raw assistant completion outside commentary phase. */
|
|
154
|
-
function isRawAssistantCompletionNotification(notification) {
|
|
155
|
-
if (!isRawAssistantProgressNotification(notification) || !isJsonObject(notification.params)) return false;
|
|
38
|
+
/** Distinguishes progress-only assistant items from conversation answers. */
|
|
39
|
+
function isAssistantCommentaryCompletionNotification(notification) {
|
|
40
|
+
if (!isJsonObject(notification.params) || notification.method !== "item/completed") return false;
|
|
156
41
|
const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
|
|
157
|
-
return Boolean(item && readStringField(item, "phase")
|
|
158
|
-
}
|
|
159
|
-
function readRawAssistantTextPreview(item) {
|
|
160
|
-
if (readStringField(item, "role") !== "assistant" || !Array.isArray(item.content)) return;
|
|
161
|
-
const text = item.content.flatMap((content) => {
|
|
162
|
-
if (!isJsonObject(content)) return [];
|
|
163
|
-
const contentText = readStringField(content, "text");
|
|
164
|
-
return contentText ? [contentText] : [];
|
|
165
|
-
}).join("\n").trim();
|
|
166
|
-
if (!text) return;
|
|
167
|
-
return text.length > 240 ? `${truncateUtf16Safe(text, 237)}...` : text;
|
|
42
|
+
return Boolean(item && readStringField(item, "type") === "agentMessage" && (readStringField(item, "phase") === "commentary" || readStringField(item, "delivery") === "async"));
|
|
168
43
|
}
|
|
169
|
-
/**
|
|
44
|
+
/** A retryable native error is not a terminal outcome for bounded operations. */
|
|
170
45
|
function isRetryableErrorNotification(value) {
|
|
171
46
|
return isJsonObject(value) && value.willRetry === true;
|
|
172
47
|
}
|
|
@@ -174,10 +49,7 @@ function isRetryableErrorNotification(value) {
|
|
|
174
49
|
function isTerminalTurnStatus(status) {
|
|
175
50
|
return status === "completed" || status === "interrupted" || status === "failed";
|
|
176
51
|
}
|
|
177
|
-
/**
|
|
178
|
-
* Detects Codex's synthetic interrupted-turn marker while ignoring the current
|
|
179
|
-
* user prompt echoed through raw response events.
|
|
180
|
-
*/
|
|
52
|
+
/** Detects Codex's interrupted-turn marker, not user-authored copies of it. */
|
|
181
53
|
function isCodexTurnAbortMarkerNotification(notification, options = {}) {
|
|
182
54
|
if (notification.method !== "rawResponseItem/completed" || !isJsonObject(notification.params)) return false;
|
|
183
55
|
const item = notification.params.item;
|
|
@@ -246,7 +118,7 @@ function readTokenCount(record, key) {
|
|
|
246
118
|
function readCodexThreadTokenUsage(params) {
|
|
247
119
|
const tokenUsage = isJsonObject(params.tokenUsage) ? params.tokenUsage : void 0;
|
|
248
120
|
const last = tokenUsage && isJsonObject(tokenUsage.last) ? tokenUsage.last : void 0;
|
|
249
|
-
return last ?
|
|
121
|
+
return last ? normalizeCodexResponseTokenUsage(last) : void 0;
|
|
250
122
|
}
|
|
251
123
|
function readCodexThreadContextSnapshot(params) {
|
|
252
124
|
const tokenUsage = isJsonObject(params.tokenUsage) ? params.tokenUsage : void 0;
|
|
@@ -256,7 +128,6 @@ function readCodexThreadContextSnapshot(params) {
|
|
|
256
128
|
const inputTokens = last ? readTokenCount(last, "inputTokens") : void 0;
|
|
257
129
|
const cachedInputTokens = last ? readTokenCount(last, "cachedInputTokens") : void 0;
|
|
258
130
|
const cacheWriteInputTokens = last ? readTokenCount(last, "cacheWriteInputTokens") : void 0;
|
|
259
|
-
const outputTokens = last ? readTokenCount(last, "outputTokens") : void 0;
|
|
260
131
|
const reasoningOutputTokens = last ? readTokenCount(last, "reasoningOutputTokens") : void 0;
|
|
261
132
|
return {
|
|
262
133
|
...activeContextTokens !== void 0 ? { activeContextTokens } : {},
|
|
@@ -264,7 +135,6 @@ function readCodexThreadContextSnapshot(params) {
|
|
|
264
135
|
...cacheWriteInputTokens !== void 0 ? { cacheWriteInputTokens } : {},
|
|
265
136
|
...inputTokens !== void 0 ? { inputTokens } : {},
|
|
266
137
|
...modelContextWindow && modelContextWindow > 0 ? { modelContextWindow } : {},
|
|
267
|
-
...outputTokens !== void 0 ? { outputTokens } : {},
|
|
268
138
|
...inputTokens !== void 0 ? { promptTokens: inputTokens } : {},
|
|
269
139
|
...reasoningOutputTokens !== void 0 ? { reasoningOutputTokens } : {}
|
|
270
140
|
};
|
|
@@ -274,13 +144,7 @@ function projectCodexThreadUsageUpdate(params, currentUsage, applyUsage, emitCon
|
|
|
274
144
|
const context = readCodexThreadContextSnapshot(params);
|
|
275
145
|
if (Object.keys(context).length > 0) emitContext(context);
|
|
276
146
|
}
|
|
277
|
-
function normalizeCodexThreadTokenUsage(record) {
|
|
278
|
-
return normalizeCodexTokenUsageBreakdown(record);
|
|
279
|
-
}
|
|
280
147
|
function normalizeCodexResponseTokenUsage(record) {
|
|
281
|
-
return normalizeCodexTokenUsageBreakdown(record);
|
|
282
|
-
}
|
|
283
|
-
function normalizeCodexTokenUsageBreakdown(record) {
|
|
284
148
|
const totalTokens = readTokenCount(record, "totalTokens");
|
|
285
149
|
const inputTokens = readTokenCount(record, "inputTokens");
|
|
286
150
|
const cacheRead = readTokenCount(record, "cachedInputTokens");
|
|
@@ -317,12 +181,15 @@ var CodexResponseCompletionProjection = class {
|
|
|
317
181
|
clear() {
|
|
318
182
|
this.usage = void 0;
|
|
319
183
|
}
|
|
320
|
-
record(params) {
|
|
184
|
+
record(params, reportOutputTokens) {
|
|
321
185
|
const responseId = readStringField(params, "responseId");
|
|
322
|
-
if (responseId
|
|
186
|
+
if (!responseId || this.responseIds.has(responseId)) return;
|
|
187
|
+
this.responseIds.add(responseId);
|
|
323
188
|
const usage = isJsonObject(params.usage) ? params.usage : void 0;
|
|
324
189
|
this.usage = usage ? normalizeCodexResponseTokenUsage(usage) : void 0;
|
|
190
|
+
const outputTokens = this.usage?.output;
|
|
191
|
+
if (outputTokens !== void 0) reportOutputTokens?.(outputTokens);
|
|
325
192
|
}
|
|
326
193
|
};
|
|
327
194
|
//#endregion
|
|
328
|
-
export {
|
|
195
|
+
export { codexExecutionToolName as a, isPendingOpenClawDynamicToolCompletionNotification as c, isTerminalTurnStatus as d, readCodexNotificationItem as f, updateActiveTurnItemIds as h, readCodexThreadContextSnapshot as i, isRawFunctionToolOutputCompletionNotification as l, readRawResponseToolCallId as m, normalizeCodexResponseTokenUsage as n, isAssistantCommentaryCompletionNotification as o, readNotificationItemId as p, projectCodexThreadUsageUpdate as r, isCodexTurnAbortMarkerNotification as s, CodexResponseCompletionProjection as t, isRetryableErrorNotification as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { runHostPreparedIsolatedCompletion } from "openclaw/plugin-sdk/simple-completion-runtime";
|
|
3
3
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
//#region extensions/codex/src/app-server/model-runtime.ts
|
|
5
5
|
const CODEX_APP_SERVER_RUNTIME_MODEL_PARAM = "codexAppServerRuntimeModel";
|
|
@@ -40,30 +40,6 @@ const CODEX_APP_SERVER_CONTEXT_ENGINE_HOST_CAPABILITIES = [
|
|
|
40
40
|
"runtime-llm-complete",
|
|
41
41
|
"thread-bootstrap-projection"
|
|
42
42
|
];
|
|
43
|
-
async function runCodexHostPreparedIsolatedCompletion(params) {
|
|
44
|
-
const timeoutSignal = AbortSignal.timeout(params.timeoutMs);
|
|
45
|
-
const signal = params.abortSignal ? AbortSignal.any([params.abortSignal, timeoutSignal]) : timeoutSignal;
|
|
46
|
-
return { assistant: await completeWithPreparedSimpleCompletionModel({
|
|
47
|
-
model: params.model,
|
|
48
|
-
auth: params.auth,
|
|
49
|
-
cfg: params.config,
|
|
50
|
-
context: {
|
|
51
|
-
systemPrompt: params.systemPrompt,
|
|
52
|
-
messages: [{
|
|
53
|
-
role: "user",
|
|
54
|
-
content: params.prompt,
|
|
55
|
-
timestamp: Date.now()
|
|
56
|
-
}],
|
|
57
|
-
tools: []
|
|
58
|
-
},
|
|
59
|
-
options: {
|
|
60
|
-
maxTokens: params.streamParams?.maxTokens,
|
|
61
|
-
temperature: params.streamParams?.temperature,
|
|
62
|
-
reasoning: params.thinkLevel,
|
|
63
|
-
signal
|
|
64
|
-
}
|
|
65
|
-
}) };
|
|
66
|
-
}
|
|
67
43
|
async function disposeSharedCodexAppServerClients() {
|
|
68
44
|
const dispose = globalThis[SHARED_CODEX_APP_SERVER_CLIENT_DISPOSER];
|
|
69
45
|
await dispose?.();
|
|
@@ -78,6 +54,8 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
78
54
|
const providerIds = new Set([...options?.providerIds ?? DEFAULT_CODEX_HARNESS_PROVIDER_IDS].map((id) => id.trim().toLowerCase()));
|
|
79
55
|
const sessionCatalogControlFactory = options.sessionCatalogControlFactory;
|
|
80
56
|
const sessionRuntime = options.runtime;
|
|
57
|
+
let modelCatalog;
|
|
58
|
+
let disposed = false;
|
|
81
59
|
const resolveAttemptPluginConfig = (config) => resolvePluginConfigObject(config, "codex") ?? options.resolvePluginConfig?.() ?? options.pluginConfig;
|
|
82
60
|
return {
|
|
83
61
|
id: harnessRuntimeId,
|
|
@@ -99,7 +77,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
99
77
|
...sessionCatalogControlFactory && sessionRuntime ? { sessionFork: {
|
|
100
78
|
upstreamKinds: ["codex-app-server"],
|
|
101
79
|
fork: async (params) => {
|
|
102
|
-
const { forkCodexUpstreamSession } = await import("./upstream-session-fork-
|
|
80
|
+
const { forkCodexUpstreamSession } = await import("./upstream-session-fork-CYlBIGVt.js");
|
|
103
81
|
return await forkCodexUpstreamSession(params, {
|
|
104
82
|
bindingStore: options.bindingStore,
|
|
105
83
|
controlFactory: sessionCatalogControlFactory,
|
|
@@ -110,23 +88,26 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
110
88
|
}
|
|
111
89
|
} } : {},
|
|
112
90
|
authBinding: { fingerprint: async (params) => {
|
|
113
|
-
const { fingerprintCodexAppServerAuthBinding } = await import("./auth-binding-
|
|
91
|
+
const { fingerprintCodexAppServerAuthBinding } = await import("./auth-binding-Ds_QVm-X.js").then((n) => n.t);
|
|
114
92
|
return fingerprintCodexAppServerAuthBinding(params);
|
|
115
93
|
} },
|
|
116
94
|
runtimeArtifact: { validate: async (binding) => {
|
|
117
|
-
const { validateCodexAppServerRuntimeArtifact } = await import("./runtime-artifact-
|
|
95
|
+
const { validateCodexAppServerRuntimeArtifact } = await import("./runtime-artifact-C3jVimFn.js");
|
|
118
96
|
return validateCodexAppServerRuntimeArtifact(binding);
|
|
119
97
|
} },
|
|
120
98
|
fetchUsageSnapshot: async (ctx) => {
|
|
121
|
-
const { fetchCodexAppServerUsageSnapshot } = await import("./usage-
|
|
99
|
+
const { fetchCodexAppServerUsageSnapshot } = await import("./usage-Bj-rrzkR.js");
|
|
122
100
|
return await fetchCodexAppServerUsageSnapshot(ctx, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
123
101
|
},
|
|
124
102
|
loadModelCatalog: async (params) => {
|
|
125
|
-
const {
|
|
126
|
-
|
|
103
|
+
const { createCodexAppServerModelCatalog } = await import("./model-catalog-CUM68Hkl.js");
|
|
104
|
+
if (disposed) return [];
|
|
105
|
+
modelCatalog ??= createCodexAppServerModelCatalog(harnessRuntimeId);
|
|
106
|
+
return await modelCatalog.load(params, resolveAttemptPluginConfig(params.config));
|
|
127
107
|
},
|
|
108
|
+
readModelCatalogReadiness: (params) => modelCatalog?.read(params, resolveAttemptPluginConfig(params.config)),
|
|
128
109
|
loadMcpToolCatalog: async (params) => {
|
|
129
|
-
const { loadCodexEffectiveMcpCatalog } = await import("./effective-mcp-catalog-
|
|
110
|
+
const { loadCodexEffectiveMcpCatalog } = await import("./effective-mcp-catalog-DzYBW4h1.js");
|
|
130
111
|
return await loadCodexEffectiveMcpCatalog(params, { bindingStore: options.bindingStore });
|
|
131
112
|
},
|
|
132
113
|
supports: (ctx) => {
|
|
@@ -169,7 +150,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
169
150
|
};
|
|
170
151
|
},
|
|
171
152
|
runAttempt: async (params) => {
|
|
172
|
-
const { runCodexAppServerAttempt } = await import("./run-attempt-
|
|
153
|
+
const { runCodexAppServerAttempt } = await import("./run-attempt-D1hJO4fX.js");
|
|
173
154
|
return runCodexAppServerAttempt(params, {
|
|
174
155
|
bindingStore: options.bindingStore,
|
|
175
156
|
pluginConfig: resolveAttemptPluginConfig(params.config),
|
|
@@ -179,27 +160,27 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
179
160
|
});
|
|
180
161
|
},
|
|
181
162
|
runIsolatedCompletionV2: async (params) => {
|
|
182
|
-
if (params.authorization.owner === "host")
|
|
183
|
-
|
|
184
|
-
return runCodexHostPreparedIsolatedCompletion({
|
|
185
|
-
...commonParams,
|
|
186
|
-
model: authorization.model,
|
|
187
|
-
auth: authorization.auth,
|
|
188
|
-
...authorization.sourceAuthFingerprint ? { sourceAuthFingerprint: authorization.sourceAuthFingerprint } : {}
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
const { runCodexIsolatedCompletion } = await import("./isolated-completion-Cv6FqygM.js");
|
|
163
|
+
if (params.authorization.owner === "host") return runHostPreparedIsolatedCompletion(params);
|
|
164
|
+
const { runCodexIsolatedCompletion } = await import("./isolated-completion-kg9kv4iH.js");
|
|
192
165
|
return runCodexIsolatedCompletion(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
193
166
|
},
|
|
194
167
|
runIsolatedCompletion: async (params) => {
|
|
195
|
-
return
|
|
168
|
+
return runHostPreparedIsolatedCompletion({
|
|
169
|
+
...params,
|
|
170
|
+
authorization: {
|
|
171
|
+
owner: "host",
|
|
172
|
+
model: params.model,
|
|
173
|
+
auth: params.auth,
|
|
174
|
+
sourceAuthFingerprint: params.sourceAuthFingerprint
|
|
175
|
+
}
|
|
176
|
+
});
|
|
196
177
|
},
|
|
197
178
|
finalizeSettledTurn: async (params) => {
|
|
198
|
-
const { runCodexSettledTurnFinalization } = await import("./settled-turn-finalizer-
|
|
179
|
+
const { runCodexSettledTurnFinalization } = await import("./settled-turn-finalizer-BVJx4yoc.js");
|
|
199
180
|
return runCodexSettledTurnFinalization(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
200
181
|
},
|
|
201
182
|
runSideQuestion: async (params) => {
|
|
202
|
-
const { runCodexAppServerSideQuestion } = await import("./side-question-
|
|
183
|
+
const { runCodexAppServerSideQuestion } = await import("./side-question-BTZAII4l.js");
|
|
203
184
|
return runCodexAppServerSideQuestion(params, {
|
|
204
185
|
bindingStore: options.bindingStore,
|
|
205
186
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
@@ -209,15 +190,20 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
209
190
|
});
|
|
210
191
|
},
|
|
211
192
|
compact: async (params) => {
|
|
212
|
-
const { maybeCompactCodexAppServerSession } = await import("./compact-
|
|
193
|
+
const { maybeCompactCodexAppServerSession } = await import("./compact-_t0HQrUS.js");
|
|
213
194
|
return maybeCompactCodexAppServerSession(params, {
|
|
214
195
|
bindingStore: options.bindingStore,
|
|
215
196
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig
|
|
216
197
|
});
|
|
217
198
|
},
|
|
199
|
+
withSessionDeletion: async (params, run) => {
|
|
200
|
+
const { withCodexAppServerSessionDeletion } = await import("./session-retirement-BujDjXVF.js");
|
|
201
|
+
params.assertCurrent();
|
|
202
|
+
return withCodexAppServerSessionDeletion(options.bindingStore, params, run);
|
|
203
|
+
},
|
|
218
204
|
reset: async (params) => {
|
|
219
|
-
if (params.sessionId) {
|
|
220
|
-
const [{ reclaimCurrentCodexSessionGeneration, sessionBindingIdentity }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./session-binding-
|
|
205
|
+
if (params.sessionId && params.reason !== "deleted") {
|
|
206
|
+
const [{ reclaimCurrentCodexSessionGeneration, sessionBindingIdentity }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./session-binding-BHuTCRZQ.js").then((n) => n.f), import("./session-retirement-BujDjXVF.js")]);
|
|
221
207
|
const identity = sessionBindingIdentity({
|
|
222
208
|
agentId: params.agentId,
|
|
223
209
|
sessionId: params.sessionId,
|
|
@@ -226,7 +212,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
226
212
|
const resetGeneration = () => retireCodexAppServerSessionGeneration({
|
|
227
213
|
bindingStore: options.bindingStore,
|
|
228
214
|
identity,
|
|
229
|
-
mode:
|
|
215
|
+
mode: "reset"
|
|
230
216
|
});
|
|
231
217
|
let reset = await resetGeneration();
|
|
232
218
|
if (reset === "conflict") {
|
|
@@ -239,13 +225,17 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
239
225
|
if (reset === "conflict") throw new Error(`Codex binding generation changed before session ${params.sessionId} could reset`);
|
|
240
226
|
}
|
|
241
227
|
},
|
|
242
|
-
dispose:
|
|
228
|
+
dispose: async () => {
|
|
229
|
+
disposed = true;
|
|
230
|
+
modelCatalog?.dispose();
|
|
231
|
+
await disposeSharedCodexAppServerClients();
|
|
232
|
+
}
|
|
243
233
|
};
|
|
244
234
|
}
|
|
245
235
|
/** Creates the private native-compaction bridge registered in host-owned capability state. */
|
|
246
236
|
function createCodexAppServerNativeCompaction(options) {
|
|
247
237
|
return async (params) => {
|
|
248
|
-
const { maybeCompactCodexAppServerSession } = await import("./compact-
|
|
238
|
+
const { maybeCompactCodexAppServerSession } = await import("./compact-_t0HQrUS.js");
|
|
249
239
|
return maybeCompactCodexAppServerSession(params, {
|
|
250
240
|
bindingStore: options.bindingStore,
|
|
251
241
|
pluginConfig: options.resolvePluginConfig?.() ?? options.pluginConfig,
|
package/dist/harness.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createCodexAppServerNativeCompaction, t as createCodexAppServerAgentHarness } from "./harness-
|
|
1
|
+
import { n as createCodexAppServerNativeCompaction, t as createCodexAppServerAgentHarness } from "./harness-DXVZ5II5.js";
|
|
2
2
|
export { createCodexAppServerAgentHarness, createCodexAppServerNativeCompaction };
|