@openclaw/codex 2026.7.2-beta.5 → 2026.7.33

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.
Files changed (66) hide show
  1. package/README.md +3 -27
  2. package/dist/{command-formatters-ico4ZFnk.js → .setup/app-server-policy-C_qTMEMy.mjs} +51 -9
  3. package/dist/{attempt-notifications-CMR2_fmR.js → .setup/attempt-notifications-F8krwWL4.mjs} +6 -3
  4. package/dist/{command-handlers-CRmnwI2N.js → .setup/command-handlers-DSRFfor4.mjs} +1156 -1319
  5. package/dist/.setup/command-rpc-BvYsfQ7G.mjs +786 -0
  6. package/dist/{compact-dEN49UH6.js → .setup/compact-BNgh7I4t.mjs} +10 -40
  7. package/dist/.setup/computer-use-C3QkmSO3.mjs +377 -0
  8. package/dist/.setup/config-CYEDnLJ2.mjs +1138 -0
  9. package/dist/{conversation-binding-data-BHRpYbX3.js → .setup/conversation-binding-data-CrRxtDBu.mjs} +1 -1
  10. package/dist/{bounded-turn-FEbUXoYT.js → .setup/media-understanding-provider-EbJCyDqe.mjs} +193 -92
  11. package/dist/{models-BA01NEez.js → .setup/models-C_aZk03A.mjs} +11 -6
  12. package/dist/.setup/notification-correlation-iYs4WieS.mjs +35 -0
  13. package/dist/.setup/plugin-app-cache-key-DR8jV9oS.mjs +99 -0
  14. package/dist/.setup/protocol-2POPqAY4.mjs +13 -0
  15. package/dist/{protocol-validators-Dm4eXZmt.js → .setup/protocol-validators-dZQ-UTOa.mjs} +111 -334
  16. package/dist/{rate-limits-S_PXs0ul.js → .setup/provider-DGxDs6g8.mjs} +269 -13
  17. package/dist/{dynamic-tools-LIt9ojep.js → .setup/provider-capabilities-DS2N_zc1.mjs} +5465 -3399
  18. package/dist/.setup/request-DFR0JyoV.mjs +36 -0
  19. package/dist/.setup/run-attempt-C7xEKFVB.mjs +8180 -0
  20. package/dist/{sandbox-guard-D1Wky__S.js → .setup/sandbox-guard-DA2TQfZW.mjs} +1 -10
  21. package/dist/.setup/session-binding-DuihlMJc.mjs +628 -0
  22. package/dist/.setup/shared-client-B2KmLPRw.mjs +1854 -0
  23. package/dist/{side-question-CO12sHxo.js → .setup/side-question-Cv6JXWCS.mjs} +84 -159
  24. package/dist/{thread-lifecycle-DRg_FdzC.js → .setup/thread-lifecycle-u6CZdOOH.mjs} +1159 -1799
  25. package/dist/{web-search-provider.runtime-CaQMYDbp.js → .setup/web-search-provider.runtime-Ce2zOHxW.mjs} +3 -3
  26. package/dist/doctor-contract-api.js +122 -88
  27. package/dist/harness.js +20 -85
  28. package/dist/index.js +381 -1537
  29. package/dist/media-understanding-provider.js +1 -173
  30. package/dist/prompt-overlay.js +15 -0
  31. package/dist/provider-catalog.js +79 -0
  32. package/dist/provider-discovery.js +34 -0
  33. package/dist/provider.js +2 -0
  34. package/dist/web-search-contract-api.js +1 -1
  35. package/openclaw.plugin.json +178 -221
  36. package/package.json +8 -10
  37. package/dist/app-server-policy-BmDgseo_.js +0 -49
  38. package/dist/attempt-client-cleanup-Ia52yRWc.js +0 -127
  39. package/dist/auth-binding-B4FfbcCg.js +0 -62
  40. package/dist/capabilities-BHRSI6Cn.js +0 -36
  41. package/dist/cli-metadata.js +0 -20
  42. package/dist/computer-use-BjGylO-E.js +0 -695
  43. package/dist/conversation-control-DE7d9DOj.js +0 -287
  44. package/dist/event-projector-assistant-message-DTgnPPVF.js +0 -101
  45. package/dist/event-projector-usage-tvgb1NCX.js +0 -69
  46. package/dist/incognito-session-ET_ufDH-.js +0 -2
  47. package/dist/notification-correlation-Bj_Ak_jI.js +0 -67
  48. package/dist/plugin-app-cache-key-DSXX-rXO.js +0 -315
  49. package/dist/realtime-voice-api-BPcA1uN9.js +0 -494
  50. package/dist/realtime-voice-api.js +0 -2
  51. package/dist/request-CXpPennK.js +0 -157
  52. package/dist/run-attempt-C5GTPJOE.js +0 -11935
  53. package/dist/runtime-artifact-C2ITXdhM.js +0 -488
  54. package/dist/session-binding-DlVQ-Pxs.js +0 -2161
  55. package/dist/session-catalog-CP2oCcEb.js +0 -2444
  56. package/dist/session-cli-CqZ0Fp2a.js +0 -175
  57. package/dist/session-upstream-marker-QE-m5QFG.js +0 -82
  58. package/dist/settled-turn-finalizer-CA_2QXIE.js +0 -303
  59. package/dist/shared-client-BVKE40c-.js +0 -2952
  60. package/dist/transcript-mirror-uKA-A4tB.js +0 -550
  61. package/dist/transport-stdio-DXgGZ7Ib.js +0 -88
  62. package/dist/upstream-session-fork-_Vrz4WJr.js +0 -320
  63. package/dist/usage-UpVbdX5G.js +0 -25
  64. /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
  65. /package/dist/{session-binding-meta-B7aEMU7g.js → .setup/session-binding-meta-B7aEMU7g.mjs} +0 -0
  66. /package/dist/{web-search-provider.shared-BrZmlqyR.js → .setup/web-search-provider.shared-BrZmlqyR.mjs} +0 -0
@@ -1,320 +0,0 @@
1
- import { l as sessionBindingIdentity } from "./session-binding-DlVQ-Pxs.js";
2
- import { n as assertCodexThreadForkResponse } from "./protocol-validators-Dm4eXZmt.js";
3
- import { t as isIncognitoSessionKey } from "./incognito-session-ET_ufDH-.js";
4
- import { i as createImportedCodexSession, n as codexUpstreamBaseline, t as codexLastTerminalTurnId } from "./session-upstream-marker-QE-m5QFG.js";
5
- import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
6
- import { readVisibleSessionTranscriptMessageEntries } from "openclaw/plugin-sdk/session-transcript-runtime";
7
- import { deleteSessionUpstreamLink, upsertSessionUpstreamLink } from "openclaw/plugin-sdk/session-catalog";
8
- //#region extensions/codex/src/app-server/upstream-fork-boundary.ts
9
- const TURN_PAGE_LIMIT = 100;
10
- function failure(code, message) {
11
- return {
12
- ok: false,
13
- code,
14
- message
15
- };
16
- }
17
- function asInputs(item) {
18
- return Array.isArray(item.content) ? item.content : [];
19
- }
20
- function userMessageDisplay(item) {
21
- let text = "";
22
- let hasTextElement = false;
23
- let hasImage = false;
24
- let hasUnverifiableInput = false;
25
- for (const input of asInputs(item)) if (input.type === "text") {
26
- if (typeof input.text === "string") text += input.text;
27
- hasTextElement ||= Array.isArray(input.textElements) && input.textElements.length > 0;
28
- } else {
29
- hasUnverifiableInput = true;
30
- hasImage ||= input.type === "image" || input.type === "localImage";
31
- }
32
- return {
33
- text,
34
- visible: Boolean(text.trim()) || hasTextElement || hasImage,
35
- hasUnverifiableInput
36
- };
37
- }
38
- function isHiddenNestedReviewTurn(previous, turn) {
39
- if (previous?.status !== "completed" || turn.status !== "interrupted" || turn.completedAt != null || !previous.items.some((item) => item.type === "enteredReviewMode") || !previous.items.some((item) => item.type === "exitedReviewMode")) return false;
40
- const userMessages = turn.items.filter((item) => item.type === "userMessage");
41
- const [firstUserMessage, secondUserMessage] = userMessages;
42
- if (!firstUserMessage || !secondUserMessage || userMessages.length !== 2) return false;
43
- return JSON.stringify(asInputs(firstUserMessage)) === JSON.stringify(asInputs(secondUserMessage));
44
- }
45
- function localMessageText(content) {
46
- if (typeof content === "string") return content;
47
- if (!Array.isArray(content)) return;
48
- const texts = [];
49
- for (const block of content) {
50
- if (!block || typeof block !== "object" || Array.isArray(block)) return;
51
- const typed = block;
52
- if (typed.type !== "text" || typeof typed.text !== "string") return;
53
- texts.push(typed.text);
54
- }
55
- return texts.join("");
56
- }
57
- function resolveCodexUpstreamForkBoundaryFromTurns(params) {
58
- let visibleUserMessagesSeen = 0;
59
- let reviewMode = false;
60
- for (const [turnIndex, turn] of params.turns.entries()) {
61
- const hiddenNestedReviewTurn = isHiddenNestedReviewTurn(params.turns[turnIndex - 1], turn);
62
- let userMessagesInTurn = 0;
63
- for (const item of turn.items) {
64
- if (item.type === "enteredReviewMode") {
65
- reviewMode = true;
66
- continue;
67
- }
68
- if (item.type === "exitedReviewMode") {
69
- reviewMode = false;
70
- continue;
71
- }
72
- if (item.type !== "userMessage") continue;
73
- const isSteer = userMessagesInTurn > 0;
74
- userMessagesInTurn += 1;
75
- if (reviewMode || hiddenNestedReviewTurn) continue;
76
- const display = userMessageDisplay(item);
77
- if (display.hasUnverifiableInput) return failure("drift-mismatch", "A message before the fork point contains images or attachments that cannot be verified across OpenClaw and Codex. Fork from a text-only span instead.");
78
- if (!display.visible) continue;
79
- const ordinal = visibleUserMessagesSeen;
80
- if (ordinal > params.userMessageOrdinal) break;
81
- const localText = params.localPrefixTexts[ordinal];
82
- if (localText === void 0) return failure("drift-mismatch", "A message before the fork point contains images or attachments that cannot be verified across OpenClaw and Codex. Fork from a text-only span instead.");
83
- if (display.text !== localText) return failure("drift-mismatch", "The local conversation no longer matches the Codex thread. Refresh the session and try again.");
84
- if (ordinal !== params.userMessageOrdinal) {
85
- visibleUserMessagesSeen += 1;
86
- continue;
87
- }
88
- if (isSteer) return failure("steer-message", "This message steered an existing Codex turn and cannot be forked independently. Fork from the turn's first message instead.");
89
- if (turn.status === "inProgress") return failure("in-progress-turn", "This Codex turn is still in progress. Wait for it to finish, then try forking again.");
90
- const retained = turnIndex > 0 ? params.turns[turnIndex - 1] : void 0;
91
- return {
92
- ok: true,
93
- boundary: {
94
- beforeTurnId: turn.id,
95
- targetTurnId: turn.id,
96
- retainedMarker: retained ? {
97
- turnId: retained.id,
98
- userMessageCount: retained.items.filter((retainedItem) => retainedItem.type === "userMessage").length
99
- } : {
100
- turnId: null,
101
- userMessageCount: 0
102
- }
103
- }
104
- };
105
- }
106
- }
107
- return failure("drift-mismatch", "The message could not be matched to the Codex thread. Refresh the session and try again.");
108
- }
109
- async function listCodexUpstreamTurns(control, threadId) {
110
- const turns = [];
111
- const seenCursors = /* @__PURE__ */ new Set();
112
- let cursor;
113
- for (;;) {
114
- const page = await control.listTurnPage({
115
- threadId,
116
- limit: TURN_PAGE_LIMIT,
117
- sortDirection: "asc",
118
- itemsView: "full",
119
- ...cursor ? { cursor } : {}
120
- });
121
- turns.push(...page.data);
122
- const nextCursor = page.nextCursor?.trim() || void 0;
123
- if (!nextCursor) return turns;
124
- if (seenCursors.has(nextCursor)) throw new Error("Codex returned a repeated thread/turns/list cursor");
125
- seenCursors.add(nextCursor);
126
- cursor = nextCursor;
127
- }
128
- }
129
- async function resolveCodexUpstreamForkBoundary(params) {
130
- try {
131
- if ((await params.control.readThread(params.threadId, false)).historyMode === "paginated") return failure("upstream-unavailable", "This Codex thread uses paginated history, which cannot be forked from OpenClaw yet.");
132
- const visibleUserEntries = (await readVisibleSessionTranscriptMessageEntries({
133
- agentId: params.agentId,
134
- sessionId: params.sessionId,
135
- sessionKey: params.sessionKey,
136
- storePath: params.storePath
137
- })).filter((entry) => entry.role === "user");
138
- const userMessageOrdinal = visibleUserEntries.findIndex((entry) => entry.entryId === params.entryId);
139
- if (userMessageOrdinal < 0) return failure("drift-mismatch", "The local message could not be mapped to the Codex thread. Refresh the session and try again.");
140
- const localPrefixTexts = visibleUserEntries.slice(0, userMessageOrdinal + 1).map((entry) => localMessageText("content" in entry.message ? entry.message.content : void 0));
141
- const resolved = resolveCodexUpstreamForkBoundaryFromTurns({
142
- turns: await listCodexUpstreamTurns(params.control, params.threadId),
143
- userMessageOrdinal,
144
- localPrefixTexts
145
- });
146
- return resolved.ok ? {
147
- ...resolved,
148
- editorText: localPrefixTexts[userMessageOrdinal]
149
- } : resolved;
150
- } catch {
151
- return failure("upstream-unavailable", "The Codex thread could not be read. Check that Codex is available, then try again.");
152
- }
153
- }
154
- function precheckCodexUpstreamForkBoundary(params) {
155
- const target = params.turns.find((turn) => turn.id === params.boundary.targetTurnId);
156
- if (!target) return failure("upstream-unavailable", "The Codex thread changed before it could be forked. Refresh the session and try again.");
157
- if (target.status === "inProgress") return failure("in-progress-turn", "This Codex turn is still in progress. Wait for it to finish, then try forking again.");
158
- return {
159
- ok: true,
160
- boundary: params.boundary
161
- };
162
- }
163
- //#endregion
164
- //#region extensions/codex/src/app-server/upstream-session-fork.ts
165
- function readConnectionFingerprint(ref) {
166
- if (!isRecord(ref)) return;
167
- return typeof ref.connectionFingerprint === "string" && ref.connectionFingerprint.trim() ? ref.connectionFingerprint : void 0;
168
- }
169
- function normalizeTurnId(value) {
170
- return typeof value === "string" && value.trim() ? value.trim() : void 0;
171
- }
172
- async function forkCodexUpstreamSession(params, options) {
173
- try {
174
- return await options.control.withPinnedConnection(async (control) => {
175
- const incognito = isIncognitoSessionKey(params.targetKey);
176
- const clientId = control.clientId?.trim();
177
- if (incognito && !clientId) throw new Error("Incognito Codex forks require the live pinned app-server client");
178
- let linked = false;
179
- let bindingIdentity;
180
- const compensateFork = async (forkedThreadId) => {
181
- if (bindingIdentity) await options.bindingStore.mutate(bindingIdentity, {
182
- kind: "clear",
183
- threadId: forkedThreadId
184
- }).catch(() => void 0);
185
- if (linked) deleteSessionUpstreamLink(params.targetKey, params.source.agentId);
186
- await control.archiveThread(forkedThreadId).catch(() => void 0);
187
- };
188
- const sourceFingerprint = readConnectionFingerprint(params.upstream.ref);
189
- if (params.upstream.kind !== "codex-app-server" || !sourceFingerprint || sourceFingerprint !== control.connectionFingerprint) return {
190
- status: "failed",
191
- code: "upstream-unavailable",
192
- message: "This Codex thread is not available on the current connection. Reconnect to its host and try again."
193
- };
194
- const resolved = await resolveCodexUpstreamForkBoundary({
195
- ...params.source,
196
- threadId: params.upstream.threadId,
197
- control
198
- });
199
- if (!resolved.ok) return {
200
- status: "failed",
201
- code: resolved.code,
202
- message: resolved.message
203
- };
204
- const liveTurns = await listCodexUpstreamTurns(control, params.upstream.threadId);
205
- const precheck = precheckCodexUpstreamForkBoundary({
206
- boundary: resolved.boundary,
207
- turns: liveTurns
208
- });
209
- if (!precheck.ok) return {
210
- status: "failed",
211
- code: precheck.code,
212
- message: precheck.message
213
- };
214
- const rawResponse = await control.forkThread({
215
- threadId: params.upstream.threadId,
216
- beforeTurnId: resolved.boundary.beforeTurnId,
217
- ...incognito ? { ephemeral: true } : {},
218
- excludeTurns: !incognito
219
- });
220
- let response;
221
- try {
222
- response = assertCodexThreadForkResponse(rawResponse);
223
- } catch (error) {
224
- const orphanThreadId = isRecord(rawResponse.thread) && typeof rawResponse.thread.id === "string" ? rawResponse.thread.id.trim() : "";
225
- if (orphanThreadId && orphanThreadId !== params.upstream.threadId) await control.archiveThread(orphanThreadId).catch(() => void 0);
226
- throw error;
227
- }
228
- const threadId = response.thread.id.trim();
229
- if (!threadId) throw new Error("Codex thread/fork response did not include a thread id");
230
- if (threadId === params.upstream.threadId) throw new Error("Codex thread/fork response reused the source thread id");
231
- const forkedThreadId = threadId;
232
- try {
233
- const connectionFingerprint = control.connectionFingerprint;
234
- if (!connectionFingerprint) throw new Error("Codex fork connection did not include a fingerprint");
235
- const forkedTurns = incognito ? response.thread.turns ?? [] : await listCodexUpstreamTurns(control, threadId);
236
- const expectedLastTurnId = resolved.boundary.retainedMarker.turnId;
237
- if ((forkedTurns.at(-1)?.id ?? null) !== expectedLastTurnId) {
238
- await compensateFork(forkedThreadId);
239
- return {
240
- status: "failed",
241
- code: "upstream-unavailable",
242
- message: "This Codex version does not support message-level forks. Update Codex, reconnect, and try again."
243
- };
244
- }
245
- const forkedThread = {
246
- ...response.thread,
247
- turns: forkedTurns
248
- };
249
- const throughTurnId = codexLastTerminalTurnId(forkedThread, normalizeTurnId) ?? null;
250
- const marker = codexUpstreamBaseline(forkedThread, normalizeTurnId);
251
- const config = options.resolveConfig?.() ?? {};
252
- return {
253
- status: "created",
254
- key: (await createImportedCodexSession({
255
- runtime: options.runtime,
256
- config,
257
- key: params.targetKey,
258
- agentId: params.source.agentId,
259
- thread: forkedThread,
260
- throughTurnId,
261
- initialEntry: {
262
- agentHarnessId: options.harnessRuntimeId,
263
- modelSelectionLocked: true
264
- },
265
- afterImport: async (entry) => {
266
- bindingIdentity = sessionBindingIdentity({
267
- agentId: entry.agentId,
268
- sessionId: entry.sessionId,
269
- sessionKey: entry.key,
270
- config
271
- });
272
- linked = upsertSessionUpstreamLink({
273
- sessionKey: entry.key,
274
- agentId: entry.agentId,
275
- catalogId: params.upstream.catalogId,
276
- hostId: params.upstream.hostId,
277
- threadId,
278
- upstreamKind: params.upstream.kind,
279
- upstreamRef: {
280
- connectionFingerprint,
281
- threadId
282
- },
283
- marker
284
- });
285
- if (!linked) throw new Error("Codex fork link could not be persisted");
286
- if (!await options.bindingStore.mutate(bindingIdentity, {
287
- kind: "set",
288
- binding: {
289
- threadId,
290
- ...incognito && clientId ? { clientId } : {},
291
- cwd: forkedThread.cwd ?? "",
292
- model: response.model,
293
- modelProvider: response.modelProvider ?? void 0,
294
- historyCoveredThrough: (/* @__PURE__ */ new Date()).toISOString()
295
- }
296
- })) throw new Error("Codex session binding changed before the fork could be attached");
297
- return { pluginExtensions: entry.entry.pluginExtensions };
298
- }
299
- })).key,
300
- ...resolved.editorText !== void 0 ? { editorText: resolved.editorText } : {}
301
- };
302
- } catch {
303
- await compensateFork(forkedThreadId);
304
- return {
305
- status: "failed",
306
- code: "upstream-unavailable",
307
- message: "The Codex fork could not be verified or imported into a new session. Refresh sessions and try again."
308
- };
309
- }
310
- });
311
- } catch {
312
- return {
313
- status: "failed",
314
- code: "upstream-unavailable",
315
- message: "The Codex thread could not be forked. Check that Codex is available, then try again."
316
- };
317
- }
318
- }
319
- //#endregion
320
- export { forkCodexUpstreamSession };
@@ -1,25 +0,0 @@
1
- import { p as resolveCodexAppServerRuntimeOptions } from "./session-binding-DlVQ-Pxs.js";
2
- import { t as buildCodexAppServerUsageSnapshot } from "./rate-limits-S_PXs0ul.js";
3
- import { t as readCodexAppServerUsage } from "./request-CXpPennK.js";
4
- import { CODEX_APP_SERVER_AUTH_MARKER } from "openclaw/plugin-sdk/agent-runtime";
5
- //#region extensions/codex/src/app-server/usage.ts
6
- /** Handles the synthetic usage credential for a Codex-backed OpenAI route. */
7
- async function fetchCodexAppServerUsageSnapshot(ctx, options = {}) {
8
- if (ctx.token !== CODEX_APP_SERVER_AUTH_MARKER) return null;
9
- const appServer = resolveCodexAppServerRuntimeOptions({ pluginConfig: options.pluginConfig });
10
- const usage = await (options.readUsage ?? readCodexAppServerUsage)({
11
- timeoutMs: ctx.timeoutMs,
12
- agentDir: ctx.agentDir,
13
- ...ctx.authProfileId ? { authProfileId: ctx.authProfileId } : {},
14
- config: ctx.config,
15
- startOptions: appServer.start
16
- });
17
- const snapshot = buildCodexAppServerUsageSnapshot(usage.rateLimits);
18
- const accountEmail = ctx.email ?? usage.accountEmail;
19
- return accountEmail && !snapshot.error ? {
20
- ...snapshot,
21
- accountEmail
22
- } : snapshot;
23
- }
24
- //#endregion
25
- export { fetchCodexAppServerUsageSnapshot };