@openclaw/codex 2026.7.2-beta.3 → 2026.7.2-beta.4
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/{app-server-policy-DUMF2Xyr.js → app-server-policy-BO3jYBkv.js} +1 -1
- package/dist/{attempt-notifications-Ecjyzufe.js → attempt-notifications-DdmnBMUp.js} +1 -1
- package/dist/{media-understanding-provider-IPNNQre6.js → bounded-turn-CaQL96kg.js} +43 -183
- package/dist/capabilities-CLICvTxf.js +36 -0
- package/dist/cli-metadata.js +1 -1
- package/dist/{command-formatters-NCTL7A2q.js → command-formatters-DgADqnHa.js} +3 -37
- package/dist/{command-handlers-DtFbZiba.js → command-handlers-l_lVPNlB.js} +12 -11
- package/dist/{compact-Kgy26gIM.js → compact-CC5KhBzX.js} +5 -4
- package/dist/{computer-use-C7x4ZaqR.js → computer-use-Ip1-QGa-.js} +4 -4
- package/dist/{conversation-control-B0s3aIjT.js → conversation-control-sNPsbTCP.js} +6 -5
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{dynamic-tools-D_vSVmv9.js → dynamic-tools-CQI3UwqY.js} +105 -2670
- package/dist/event-projector-assistant-message-DTgnPPVF.js +101 -0
- package/dist/event-projector-usage-D6tE7_qD.js +69 -0
- package/dist/harness.js +25 -6
- package/dist/incognito-session-ET_ufDH-.js +2 -0
- package/dist/index.js +60 -26
- package/dist/media-understanding-provider.js +168 -1
- package/dist/{models-DD5zBdX5.js → models-BNeMlHgg.js} +2 -2
- package/dist/{notification-correlation-C8DVQ_Bq.js → notification-correlation-BGLixv5_.js} +3 -3
- package/dist/{plugin-app-cache-key-DJbhLYSK.js → plugin-app-cache-key-CvzvmBRz.js} +2 -2
- package/dist/{rate-limits-CqhWQ2R9.js → rate-limits-D0IJT-a6.js} +1 -1
- package/dist/{request-9yf9pZjf.js → request-BTccUTD3.js} +1 -1
- package/dist/{run-attempt-BIoO8ISr.js → run-attempt--858NXDl.js} +2653 -109
- package/dist/{session-binding-Bmt20HfB.js → session-binding-ZSMX1omP.js} +7 -2
- package/dist/{session-catalog-CA7R-hX2.js → session-catalog-DsKaezgR.js} +82 -80
- package/dist/{session-cli-Bxk3-Wqz.js → session-cli-CYJTfRLG.js} +1 -1
- package/dist/session-upstream-marker-D7XlI9us.js +82 -0
- package/dist/settled-turn-finalizer-DHltNgtF.js +303 -0
- package/dist/{shared-client-CSXLtCLE.js → shared-client-wmgNFNYp.js} +33 -13
- package/dist/{side-question-DtzquMOb.js → side-question-BfFZCsJ-.js} +21 -15
- package/dist/{thread-lifecycle-CQ_9mAa1.js → thread-lifecycle-cqrOlJkq.js} +120 -26
- package/dist/{transcript-mirror-D9rTxx2P.js → transcript-mirror-2p7kl6e4.js} +433 -145
- package/dist/upstream-session-fork-vPjwkT1i.js +320 -0
- package/dist/{usage-CuPpFgTc.js → usage-DM_I3mPT.js} +3 -3
- package/dist/{web-search-provider.runtime-_x5XTeqh.js → web-search-provider.runtime-Bx6HAc_k.js} +3 -3
- package/npm-shrinkwrap.json +38 -38
- package/package.json +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { m as canUseCodexModelBackedApprovalsReviewerForModel } from "./session-binding-ZSMX1omP.js";
|
|
2
2
|
//#region extensions/codex/src/app-server/app-server-policy.ts
|
|
3
3
|
/**
|
|
4
4
|
* Policy promotion for Codex app-server runs that can safely use OpenClaw tool
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Q as isJsonObject } from "./shared-client-wmgNFNYp.js";
|
|
2
2
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
3
3
|
//#region extensions/codex/src/app-server/attempt-notifications.ts
|
|
4
4
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as readCodexNotificationItem } from "./attempt-notifications-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { Q as isJsonObject, o as isCodexAppServerStartSelectionChangedError } from "./shared-client-wmgNFNYp.js";
|
|
2
|
+
import { _ as readCodexNotificationItem, h as isRetryableErrorNotification } from "./attempt-notifications-DdmnBMUp.js";
|
|
3
|
+
import { x as resolveCodexAppServerRuntimeOptions } from "./session-binding-ZSMX1omP.js";
|
|
4
|
+
import { Q as mergeCodexThreadConfigs, d as buildCodexRingZeroThreadConfigPatch, f as buildCodexRuntimeThreadConfig, l as assertCodexRingZeroHasNoManagedHooks, p as readCodexInheritedMcpServerNames, u as attestCodexRingZeroThreadHasNoMcpServers } from "./thread-lifecycle-cqrOlJkq.js";
|
|
5
|
+
import { t as normalizeCodexResponseTokenUsage } from "./event-projector-usage-D6tE7_qD.js";
|
|
6
|
+
import { C as readCodexTurnCompletedNotification, _ as assertCodexThreadStartResponse, b as readCodexErrorNotification, v as assertCodexTurnStartResponse } from "./transcript-mirror-2p7kl6e4.js";
|
|
7
|
+
import { r as readModelListResult } from "./models-BNeMlHgg.js";
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
@@ -15,7 +15,7 @@ const CODEX_PRIVATE_STDIO_ARGS = [
|
|
|
15
15
|
"--listen",
|
|
16
16
|
"stdio://"
|
|
17
17
|
];
|
|
18
|
-
const
|
|
18
|
+
const CODEX_APP_SERVER_ARGS_ENV_KEY = "OPENCLAW_CODEX_APP_SERVER_ARGS";
|
|
19
19
|
const CODEX_BOUNDED_THREAD_CONFIG = {
|
|
20
20
|
"features.multi_agent": false,
|
|
21
21
|
"features.apps": false,
|
|
@@ -28,6 +28,10 @@ const CODEX_PRIVATE_BOUNDED_THREAD_CONFIG = {
|
|
|
28
28
|
"features.hooks": false,
|
|
29
29
|
notify: []
|
|
30
30
|
};
|
|
31
|
+
const CODEX_SETTLED_FINALIZER_THREAD_CONFIG = {
|
|
32
|
+
"skills.include_instructions": false,
|
|
33
|
+
include_environment_context: false
|
|
34
|
+
};
|
|
31
35
|
async function runBoundedCodexAppServerTurn(params) {
|
|
32
36
|
const appServer = resolveCodexAppServerRuntimeOptions({
|
|
33
37
|
pluginConfig: params.options.pluginConfig,
|
|
@@ -62,7 +66,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
62
66
|
agentDir,
|
|
63
67
|
config: params.config,
|
|
64
68
|
timeoutMs
|
|
65
|
-
}) : await import("./shared-client-
|
|
69
|
+
}) : await import("./shared-client-wmgNFNYp.js").then((n) => n.f).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
|
|
66
70
|
startOptions,
|
|
67
71
|
timeoutMs,
|
|
68
72
|
authProfileId: params.profile,
|
|
@@ -87,6 +91,8 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
87
91
|
timeoutMs,
|
|
88
92
|
signal: abortController.signal
|
|
89
93
|
});
|
|
94
|
+
const inheritedMcpServerNames = params.requireNoExternalCapabilities ? await readCodexInheritedMcpServerNames(client, workspace.cwd, abortController.signal) : [];
|
|
95
|
+
if (params.requireNoExternalCapabilities) await assertCodexRingZeroHasNoManagedHooks(client, abortController.signal);
|
|
90
96
|
const thread = assertCodexThreadStartResponse(await client.request("thread/start", {
|
|
91
97
|
model,
|
|
92
98
|
modelProvider: "openai",
|
|
@@ -94,8 +100,9 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
94
100
|
approvalPolicy: "on-request",
|
|
95
101
|
sandbox: "read-only",
|
|
96
102
|
serviceName: "OpenClaw",
|
|
103
|
+
...params.requireNoExternalCapabilities ? { baseInstructions: "" } : {},
|
|
97
104
|
developerInstructions: params.developerInstructions,
|
|
98
|
-
config: buildCodexRuntimeThreadConfig(resolveBoundedThreadConfig(params, workspace), { nativeCodeModeEnabled: false }),
|
|
105
|
+
config: buildCodexRuntimeThreadConfig(resolveBoundedThreadConfig(params, workspace, inheritedMcpServerNames), { nativeCodeModeEnabled: false }),
|
|
99
106
|
environments: [],
|
|
100
107
|
dynamicTools: [],
|
|
101
108
|
experimentalRawEvents: true,
|
|
@@ -104,6 +111,14 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
104
111
|
timeoutMs,
|
|
105
112
|
signal: abortController.signal
|
|
106
113
|
}));
|
|
114
|
+
if (params.requireNoExternalCapabilities) await attestCodexRingZeroThreadHasNoMcpServers(client, thread.thread.id, abortController.signal);
|
|
115
|
+
if (params.historyItems?.length) await client.request("thread/inject_items", {
|
|
116
|
+
threadId: thread.thread.id,
|
|
117
|
+
items: params.historyItems
|
|
118
|
+
}, {
|
|
119
|
+
timeoutMs,
|
|
120
|
+
signal: abortController.signal
|
|
121
|
+
});
|
|
107
122
|
const collector = createCodexBoundedTurnCollector(thread.thread.id, params.taskLabel);
|
|
108
123
|
const cleanup = client.addNotificationHandler(collector.handleNotification);
|
|
109
124
|
const requestCleanup = client.addRequestHandler(createCodexBoundedApprovalHandler(params.taskLabel));
|
|
@@ -144,15 +159,17 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
144
159
|
});
|
|
145
160
|
throw new Error("Codex bounded turn selection retry exited unexpectedly");
|
|
146
161
|
}
|
|
147
|
-
function resolveBoundedThreadConfig(params, workspace) {
|
|
162
|
+
function resolveBoundedThreadConfig(params, workspace, inheritedMcpServerNames) {
|
|
148
163
|
const boundedConfig = mergeCodexThreadConfigs(CODEX_BOUNDED_THREAD_CONFIG, params.threadConfig) ?? CODEX_BOUNDED_THREAD_CONFIG;
|
|
149
|
-
|
|
164
|
+
const privateConfig = workspace.codexHome ? mergeCodexThreadConfigs(boundedConfig, CODEX_PRIVATE_BOUNDED_THREAD_CONFIG) ?? boundedConfig : boundedConfig;
|
|
165
|
+
if (!params.requireNoExternalCapabilities) return privateConfig;
|
|
166
|
+
return mergeCodexThreadConfigs(privateConfig, CODEX_SETTLED_FINALIZER_THREAD_CONFIG, buildCodexRingZeroThreadConfigPatch({ toolsAllow: ["openclaw"] }, true, inheritedMcpServerNames)) ?? privateConfig;
|
|
150
167
|
}
|
|
151
168
|
function buildPrivateCodexAppServerStartOptions(start, codexHome) {
|
|
152
|
-
const privateEnv = Object.fromEntries(Object.entries(start.env ?? {}).filter(([name]) => name.trim().toUpperCase() !==
|
|
169
|
+
const privateEnv = Object.fromEntries(Object.entries(start.env ?? {}).filter(([name]) => name.trim().toUpperCase() !== CODEX_APP_SERVER_ARGS_ENV_KEY));
|
|
153
170
|
const clearEnv = (start.clearEnv ?? []).filter((name) => {
|
|
154
171
|
const normalized = name.trim().toUpperCase();
|
|
155
|
-
return normalized !== "CODEX_HOME" && normalized !==
|
|
172
|
+
return normalized !== "CODEX_HOME" && normalized !== CODEX_APP_SERVER_ARGS_ENV_KEY;
|
|
156
173
|
});
|
|
157
174
|
return {
|
|
158
175
|
...start,
|
|
@@ -161,7 +178,7 @@ function buildPrivateCodexAppServerStartOptions(start, codexHome) {
|
|
|
161
178
|
...privateEnv,
|
|
162
179
|
CODEX_HOME: codexHome
|
|
163
180
|
},
|
|
164
|
-
clearEnv: [...clearEnv,
|
|
181
|
+
clearEnv: [...clearEnv, CODEX_APP_SERVER_ARGS_ENV_KEY]
|
|
165
182
|
};
|
|
166
183
|
}
|
|
167
184
|
function createCodexBoundedApprovalHandler(taskLabel) {
|
|
@@ -207,6 +224,7 @@ function createCodexBoundedTurnCollector(threadId, taskLabel) {
|
|
|
207
224
|
let turnId;
|
|
208
225
|
let completedTurn;
|
|
209
226
|
let promptError;
|
|
227
|
+
let responseUsage;
|
|
210
228
|
const pending = [];
|
|
211
229
|
const completedItems = /* @__PURE__ */ new Map();
|
|
212
230
|
const assistantTextByItem = /* @__PURE__ */ new Map();
|
|
@@ -242,12 +260,18 @@ function createCodexBoundedTurnCollector(threadId, taskLabel) {
|
|
|
242
260
|
rememberAssistantText(itemId, `${assistantTextByItem.get(itemId) ?? ""}${delta}`);
|
|
243
261
|
return;
|
|
244
262
|
}
|
|
263
|
+
if (notification.method === "rawResponse/completed") {
|
|
264
|
+
const usage = isJsonObject(params.usage) ? params.usage : void 0;
|
|
265
|
+
responseUsage = usage ? normalizeCodexResponseTokenUsage(usage) : void 0;
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
245
268
|
if (notification.method === "turn/completed") {
|
|
246
269
|
completedTurn = readCodexTurnCompletedNotification(notification.params)?.turn ?? completedTurn;
|
|
247
270
|
resolveCompletion?.();
|
|
248
271
|
return;
|
|
249
272
|
}
|
|
250
273
|
if (notification.method === "error") {
|
|
274
|
+
if (isRetryableErrorNotification(notification.params)) return;
|
|
251
275
|
promptError = readCodexErrorNotification(notification.params)?.error.message ?? `codex app-server ${taskLabel} turn failed`;
|
|
252
276
|
resolveCompletion?.();
|
|
253
277
|
}
|
|
@@ -266,6 +290,7 @@ function createCodexBoundedTurnCollector(threadId, taskLabel) {
|
|
|
266
290
|
});
|
|
267
291
|
if (promptError) throw new Error(promptError);
|
|
268
292
|
if (completedTurn?.status === "failed") throw new Error(completedTurn.error?.message ?? `codex app-server ${taskLabel} turn failed`);
|
|
293
|
+
if (completedTurn?.status !== "completed") throw new Error(`codex app-server ${taskLabel} turn ended with status ${completedTurn?.status ?? "unknown"}`);
|
|
269
294
|
const items = collectCompletedItems(completedTurn?.items, completedItems);
|
|
270
295
|
const itemText = collectAssistantTextFromItems(items);
|
|
271
296
|
const deltaText = assistantItemOrder.map((itemId) => assistantTextByItem.get(itemId)?.trim()).filter((text) => Boolean(text)).join("\n\n").trim();
|
|
@@ -273,7 +298,8 @@ function createCodexBoundedTurnCollector(threadId, taskLabel) {
|
|
|
273
298
|
if (!text) throw new Error(`Codex app-server ${taskLabel} turn returned no text.`);
|
|
274
299
|
return {
|
|
275
300
|
text,
|
|
276
|
-
items
|
|
301
|
+
items,
|
|
302
|
+
...responseUsage ? { usage: responseUsage } : {}
|
|
277
303
|
};
|
|
278
304
|
}
|
|
279
305
|
};
|
|
@@ -316,170 +342,4 @@ function isTerminalTurn(turn) {
|
|
|
316
342
|
return turn.status === "completed" || turn.status === "interrupted" || turn.status === "failed";
|
|
317
343
|
}
|
|
318
344
|
//#endregion
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Codex-backed media understanding provider for bounded image description and
|
|
322
|
-
* structured extraction turns.
|
|
323
|
-
*/
|
|
324
|
-
const CODEX_MEDIA_PROVIDER_ID = "codex";
|
|
325
|
-
const DEFAULT_CODEX_IMAGE_MODEL = "gpt-5.6-sol";
|
|
326
|
-
const DEFAULT_CODEX_IMAGE_PROMPT = "Describe the image.";
|
|
327
|
-
/**
|
|
328
|
-
* Builds the media-understanding provider that delegates image tasks to an
|
|
329
|
-
* isolated Codex app-server session.
|
|
330
|
-
*/
|
|
331
|
-
function buildCodexMediaUnderstandingProvider(options = {}) {
|
|
332
|
-
return {
|
|
333
|
-
id: CODEX_MEDIA_PROVIDER_ID,
|
|
334
|
-
capabilities: ["image"],
|
|
335
|
-
defaultModels: { image: DEFAULT_CODEX_IMAGE_MODEL },
|
|
336
|
-
describeImage: async (req) => describeCodexImages({
|
|
337
|
-
images: [{
|
|
338
|
-
buffer: req.buffer,
|
|
339
|
-
fileName: req.fileName,
|
|
340
|
-
mime: req.mime
|
|
341
|
-
}],
|
|
342
|
-
provider: req.provider,
|
|
343
|
-
model: req.model,
|
|
344
|
-
prompt: req.prompt,
|
|
345
|
-
maxTokens: req.maxTokens,
|
|
346
|
-
timeoutMs: req.timeoutMs,
|
|
347
|
-
profile: req.profile,
|
|
348
|
-
preferredProfile: req.preferredProfile,
|
|
349
|
-
authStore: req.authStore,
|
|
350
|
-
agentDir: req.agentDir,
|
|
351
|
-
cfg: req.cfg
|
|
352
|
-
}, options),
|
|
353
|
-
describeImages: async (req) => describeCodexImages(req, options),
|
|
354
|
-
extractStructured: async (req) => extractCodexStructured(req, options)
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
async function describeCodexImages(req, options) {
|
|
358
|
-
const model = req.model.trim();
|
|
359
|
-
if (!model) throw new Error("Codex image understanding requires model id.");
|
|
360
|
-
const { text } = await runBoundedCodexAppServerTurn({
|
|
361
|
-
config: req.cfg,
|
|
362
|
-
model: {
|
|
363
|
-
mode: "required",
|
|
364
|
-
id: model
|
|
365
|
-
},
|
|
366
|
-
profile: req.profile,
|
|
367
|
-
timeoutMs: req.timeoutMs,
|
|
368
|
-
agentDir: req.agentDir,
|
|
369
|
-
authProfileStore: req.authStore,
|
|
370
|
-
options,
|
|
371
|
-
taskLabel: "image understanding",
|
|
372
|
-
developerInstructions: "You are OpenClaw's bounded image-understanding worker. Describe only the provided image content. Do not call tools, edit files, or ask follow-up questions.",
|
|
373
|
-
input: [{
|
|
374
|
-
type: "text",
|
|
375
|
-
text: buildCodexImagePrompt(req),
|
|
376
|
-
text_elements: []
|
|
377
|
-
}, ...req.images.map((image) => ({
|
|
378
|
-
type: "image",
|
|
379
|
-
url: `data:${image.mime ?? "image/png"};base64,${image.buffer.toString("base64")}`
|
|
380
|
-
}))],
|
|
381
|
-
requiredModalities: ["text", "image"],
|
|
382
|
-
isolation: "configured-transport"
|
|
383
|
-
});
|
|
384
|
-
return {
|
|
385
|
-
text,
|
|
386
|
-
model
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
async function extractCodexStructured(req, options) {
|
|
390
|
-
const model = req.model.trim();
|
|
391
|
-
if (!model) throw new Error("Codex structured extraction requires model id.");
|
|
392
|
-
if (!req.instructions.trim()) throw new Error("Codex structured extraction requires instructions.");
|
|
393
|
-
if (req.input.length === 0) throw new Error("Codex structured extraction requires at least one input.");
|
|
394
|
-
if (!req.input.some((entry) => entry.type === "image")) throw new Error("Codex structured extraction requires at least one image input.");
|
|
395
|
-
const { text } = await runBoundedCodexAppServerTurn({
|
|
396
|
-
config: req.cfg,
|
|
397
|
-
model: {
|
|
398
|
-
mode: "required",
|
|
399
|
-
id: model
|
|
400
|
-
},
|
|
401
|
-
profile: req.profile,
|
|
402
|
-
timeoutMs: req.timeoutMs,
|
|
403
|
-
agentDir: req.agentDir,
|
|
404
|
-
authProfileStore: req.authStore,
|
|
405
|
-
options,
|
|
406
|
-
taskLabel: "structured extraction",
|
|
407
|
-
developerInstructions: "You are OpenClaw's bounded structured-extraction worker. Return only the requested extraction. Do not call tools, edit files, ask follow-up questions, or include secrets.",
|
|
408
|
-
input: buildCodexStructuredInput(req),
|
|
409
|
-
requiredModalities: requiredStructuredModalities(),
|
|
410
|
-
isolation: "configured-transport"
|
|
411
|
-
});
|
|
412
|
-
return normalizeStructuredExtractionResult({
|
|
413
|
-
text,
|
|
414
|
-
model,
|
|
415
|
-
provider: req.provider,
|
|
416
|
-
req
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
function buildCodexImagePrompt(req) {
|
|
420
|
-
const prompt = req.prompt?.trim() || DEFAULT_CODEX_IMAGE_PROMPT;
|
|
421
|
-
if (req.images.length <= 1) return prompt;
|
|
422
|
-
return `${prompt}\n\nAnalyze all ${req.images.length} images together.`;
|
|
423
|
-
}
|
|
424
|
-
function requiredStructuredModalities() {
|
|
425
|
-
return ["text", "image"];
|
|
426
|
-
}
|
|
427
|
-
function buildCodexStructuredInput(req) {
|
|
428
|
-
return [{
|
|
429
|
-
type: "text",
|
|
430
|
-
text: buildStructuredExtractionPrompt(req),
|
|
431
|
-
text_elements: []
|
|
432
|
-
}, ...req.input.map((entry) => {
|
|
433
|
-
if (entry.type === "text") return {
|
|
434
|
-
type: "text",
|
|
435
|
-
text: entry.text,
|
|
436
|
-
text_elements: []
|
|
437
|
-
};
|
|
438
|
-
return {
|
|
439
|
-
type: "image",
|
|
440
|
-
url: `data:${entry.mime ?? "image/png"};base64,${entry.buffer.toString("base64")}`
|
|
441
|
-
};
|
|
442
|
-
})];
|
|
443
|
-
}
|
|
444
|
-
function buildStructuredExtractionPrompt(req) {
|
|
445
|
-
return [
|
|
446
|
-
req.instructions.trim(),
|
|
447
|
-
req.schemaName ? `Schema name: ${req.schemaName}` : void 0,
|
|
448
|
-
req.jsonSchema ? `JSON schema:\n${JSON.stringify(req.jsonSchema)}` : void 0,
|
|
449
|
-
req.jsonMode === false ? "Return the extraction as concise text." : "Return valid JSON only. Do not wrap the JSON in Markdown fences."
|
|
450
|
-
].filter((part) => Boolean(part)).join("\n\n");
|
|
451
|
-
}
|
|
452
|
-
function isJsonSchemaObject(value) {
|
|
453
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
454
|
-
}
|
|
455
|
-
function normalizeStructuredExtractionResult(params) {
|
|
456
|
-
const result = {
|
|
457
|
-
text: params.text,
|
|
458
|
-
model: params.model,
|
|
459
|
-
provider: params.provider,
|
|
460
|
-
contentType: params.req.jsonMode === false ? "text" : "json"
|
|
461
|
-
};
|
|
462
|
-
if (params.req.jsonMode !== false) {
|
|
463
|
-
try {
|
|
464
|
-
result.parsed = JSON.parse(params.text);
|
|
465
|
-
} catch {
|
|
466
|
-
throw new Error("Codex structured extraction returned invalid JSON.");
|
|
467
|
-
}
|
|
468
|
-
if (isJsonSchemaObject(params.req.jsonSchema)) {
|
|
469
|
-
const validation = validateJsonSchemaValue({
|
|
470
|
-
schema: params.req.jsonSchema,
|
|
471
|
-
cacheKey: "codex.media-understanding.extractStructured",
|
|
472
|
-
value: result.parsed,
|
|
473
|
-
cache: false
|
|
474
|
-
});
|
|
475
|
-
if (!validation.ok) {
|
|
476
|
-
const message = validation.errors.map((error) => error.text).join("; ") || "invalid";
|
|
477
|
-
throw new Error(`Codex structured extraction JSON did not match schema: ${message}`);
|
|
478
|
-
}
|
|
479
|
-
result.parsed = validation.value;
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
return result;
|
|
483
|
-
}
|
|
484
|
-
//#endregion
|
|
485
|
-
export { runBoundedCodexAppServerTurn as n, buildCodexMediaUnderstandingProvider as t };
|
|
345
|
+
export { runBoundedCodexAppServerTurn as t };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { R as CodexAppServerRpcError } from "./shared-client-wmgNFNYp.js";
|
|
2
|
+
//#region extensions/codex/src/app-server/capabilities.ts
|
|
3
|
+
/**
|
|
4
|
+
* Capability helpers for optional Codex app-server control-plane methods.
|
|
5
|
+
*/
|
|
6
|
+
/** Known app-server methods used by OpenClaw control surfaces. */
|
|
7
|
+
const CODEX_CONTROL_METHODS = {
|
|
8
|
+
account: "account/read",
|
|
9
|
+
compact: "thread/compact/start",
|
|
10
|
+
feedback: "feedback/upload",
|
|
11
|
+
forkThread: "thread/fork",
|
|
12
|
+
listMcpServers: "mcpServerStatus/list",
|
|
13
|
+
listSkills: "skills/list",
|
|
14
|
+
listThreads: "thread/list",
|
|
15
|
+
listThreadTurns: "thread/turns/list",
|
|
16
|
+
readThread: "thread/read",
|
|
17
|
+
rateLimits: "account/rateLimits/read",
|
|
18
|
+
archiveThread: "thread/archive",
|
|
19
|
+
renameThread: "thread/name/set",
|
|
20
|
+
resumeThread: "thread/resume",
|
|
21
|
+
review: "review/start",
|
|
22
|
+
unarchiveThread: "thread/unarchive",
|
|
23
|
+
getThreadGoal: "thread/goal/get",
|
|
24
|
+
setThreadGoal: "thread/goal/set",
|
|
25
|
+
clearThreadGoal: "thread/goal/clear"
|
|
26
|
+
};
|
|
27
|
+
/** Formats unsupported control calls differently from ordinary RPC failures. */
|
|
28
|
+
function describeControlFailure(error) {
|
|
29
|
+
if (isUnsupportedControlError(error)) return "unsupported by this Codex app-server";
|
|
30
|
+
return error instanceof Error ? error.message : String(error);
|
|
31
|
+
}
|
|
32
|
+
function isUnsupportedControlError(error) {
|
|
33
|
+
return error instanceof CodexAppServerRpcError && error.code === -32601;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { describeControlFailure as n, CODEX_CONTROL_METHODS as t };
|
package/dist/cli-metadata.js
CHANGED
|
@@ -2,7 +2,7 @@ import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
|
2
2
|
//#region extensions/codex/cli-metadata.ts
|
|
3
3
|
function registerCodexCliMetadata(api) {
|
|
4
4
|
api.registerCli(async ({ program }) => {
|
|
5
|
-
const { registerCodexSessionCli } = await import("./session-cli-
|
|
5
|
+
const { registerCodexSessionCli } = await import("./session-cli-CYJTfRLG.js");
|
|
6
6
|
registerCodexSessionCli(program);
|
|
7
7
|
}, { descriptors: [{
|
|
8
8
|
name: "codex",
|
|
@@ -1,39 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as summarizeCodexRateLimits, o as summarizeCodexAccountRateLimits, r as hasCodexRateLimitSnapshots } from "./rate-limits-
|
|
3
|
-
//#region extensions/codex/src/app-server/capabilities.ts
|
|
4
|
-
/**
|
|
5
|
-
* Capability helpers for optional Codex app-server control-plane methods.
|
|
6
|
-
*/
|
|
7
|
-
/** Known app-server methods used by OpenClaw control surfaces. */
|
|
8
|
-
const CODEX_CONTROL_METHODS = {
|
|
9
|
-
account: "account/read",
|
|
10
|
-
compact: "thread/compact/start",
|
|
11
|
-
feedback: "feedback/upload",
|
|
12
|
-
forkThread: "thread/fork",
|
|
13
|
-
listMcpServers: "mcpServerStatus/list",
|
|
14
|
-
listSkills: "skills/list",
|
|
15
|
-
listThreads: "thread/list",
|
|
16
|
-
listThreadTurns: "thread/turns/list",
|
|
17
|
-
readThread: "thread/read",
|
|
18
|
-
rateLimits: "account/rateLimits/read",
|
|
19
|
-
archiveThread: "thread/archive",
|
|
20
|
-
renameThread: "thread/name/set",
|
|
21
|
-
resumeThread: "thread/resume",
|
|
22
|
-
review: "review/start",
|
|
23
|
-
unarchiveThread: "thread/unarchive",
|
|
24
|
-
getThreadGoal: "thread/goal/get",
|
|
25
|
-
setThreadGoal: "thread/goal/set",
|
|
26
|
-
clearThreadGoal: "thread/goal/clear"
|
|
27
|
-
};
|
|
28
|
-
/** Formats unsupported control calls differently from ordinary RPC failures. */
|
|
29
|
-
function describeControlFailure(error) {
|
|
30
|
-
if (isUnsupportedControlError(error)) return "unsupported by this Codex app-server";
|
|
31
|
-
return error instanceof Error ? error.message : String(error);
|
|
32
|
-
}
|
|
33
|
-
function isUnsupportedControlError(error) {
|
|
34
|
-
return error instanceof CodexAppServerRpcError && error.code === -32601;
|
|
35
|
-
}
|
|
36
|
-
//#endregion
|
|
1
|
+
import { Q as isJsonObject } from "./shared-client-wmgNFNYp.js";
|
|
2
|
+
import { c as summarizeCodexRateLimits, o as summarizeCodexAccountRateLimits, r as hasCodexRateLimitSnapshots } from "./rate-limits-D0IJT-a6.js";
|
|
37
3
|
//#region extensions/codex/src/command-formatters.ts
|
|
38
4
|
/** Formats the combined `/codex status` probe result. */
|
|
39
5
|
function formatCodexStatus(probes) {
|
|
@@ -312,4 +278,4 @@ function readString(record, key) {
|
|
|
312
278
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
313
279
|
}
|
|
314
280
|
//#endregion
|
|
315
|
-
export { formatComputerUseStatus as a, formatSkills as c,
|
|
281
|
+
export { formatComputerUseStatus as a, formatSkills as c, formatCodexStatus as i, formatThreads as l, formatAccount as n, formatList as o, formatCodexDisplayText as r, formatModels as s, buildHelp as t, readString as u };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as listAllCodexAppServerModels } from "./models-
|
|
5
|
-
import {
|
|
6
|
-
import { s as summarizeCodexAccountUsage } from "./rate-limits-
|
|
1
|
+
import { Q as isJsonObject, S as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-wmgNFNYp.js";
|
|
2
|
+
import { c as reclaimCurrentCodexSessionGeneration, i as createCodexSessionGenerationSupersededError, l as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced, r as bindingStoreKey, s as normalizeCodexAppServerBindingModelProvider, v as isCodexFastServiceTier } from "./session-binding-ZSMX1omP.js";
|
|
3
|
+
import { g as assertCodexThreadResumeResponse } from "./transcript-mirror-2p7kl6e4.js";
|
|
4
|
+
import { t as listAllCodexAppServerModels } from "./models-BNeMlHgg.js";
|
|
5
|
+
import { t as CODEX_CONTROL_METHODS } from "./capabilities-CLICvTxf.js";
|
|
6
|
+
import { s as summarizeCodexAccountUsage } from "./rate-limits-D0IJT-a6.js";
|
|
7
|
+
import { a as formatComputerUseStatus, c as formatSkills, i as formatCodexStatus, l as formatThreads, n as formatAccount, o as formatList, r as formatCodexDisplayText, s as formatModels, t as buildHelp, u as readString$1 } from "./command-formatters-DgADqnHa.js";
|
|
7
8
|
import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-D1Wky__S.js";
|
|
8
|
-
import { a as setCodexConversationFastMode, c as steerCodexConversationTurn, d as CODEX_NATIVE_EXECUTION_AUTH_ERROR, f as canMutateCodexHost, i as readCodexConversationActiveTurn, l as stopCodexConversationTurn, n as parseCodexFastModeArg, o as setCodexConversationModel, r as parseCodexPermissionsModeArg, s as setCodexConversationPermissions, t as formatPermissionsMode } from "./conversation-control-
|
|
9
|
+
import { a as setCodexConversationFastMode, c as steerCodexConversationTurn, d as CODEX_NATIVE_EXECUTION_AUTH_ERROR, f as canMutateCodexHost, i as readCodexConversationActiveTurn, l as stopCodexConversationTurn, n as parseCodexFastModeArg, o as setCodexConversationModel, r as parseCodexPermissionsModeArg, s as setCodexConversationPermissions, t as formatPermissionsMode } from "./conversation-control-sNPsbTCP.js";
|
|
9
10
|
import { i as readCodexConversationBindingData, n as createCodexCliNodeConversationBindingData, o as resolveCodexDefaultWorkspaceDir, r as createCodexConversationBindingData } from "./conversation-binding-data-BHRpYbX3.js";
|
|
10
|
-
import { a as resolveCodexBindingAppServerConnection } from "./notification-correlation-
|
|
11
|
-
import { c as requestOptions, l as safeCodexControlRequest, o as codexControlRequest, p as formatCodexCliSessions, s as readCodexStatusProbes } from "./session-catalog-
|
|
12
|
-
import { i as readCodexComputerUseStatus, n as installCodexComputerUse } from "./computer-use-
|
|
11
|
+
import { a as resolveCodexBindingAppServerConnection } from "./notification-correlation-BGLixv5_.js";
|
|
12
|
+
import { c as requestOptions, l as safeCodexControlRequest, o as codexControlRequest, p as formatCodexCliSessions, s as readCodexStatusProbes } from "./session-catalog-DsKaezgR.js";
|
|
13
|
+
import { i as readCodexComputerUseStatus, n as installCodexComputerUse } from "./computer-use-Ip1-QGa-.js";
|
|
13
14
|
import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
14
15
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
15
16
|
import crypto from "node:crypto";
|
|
@@ -1017,7 +1018,7 @@ async function resumeThread(deps, ctx, pluginConfig, args) {
|
|
|
1017
1018
|
bindingStore: deps.bindingStore,
|
|
1018
1019
|
identity,
|
|
1019
1020
|
config: ctx.config
|
|
1020
|
-
})) throw
|
|
1021
|
+
})) throw createCodexSessionGenerationSupersededError(identity.sessionId);
|
|
1021
1022
|
const currentBinding = await deps.bindingStore.read(identity);
|
|
1022
1023
|
assertCodexBindingMayBeReplaced(currentBinding, "attaching a different resumed thread");
|
|
1023
1024
|
const authProfileId = resolveCodexAppServerAuthProfileIdForAgent({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as readCodexNotificationItem } from "./attempt-notifications-
|
|
3
|
-
import {
|
|
1
|
+
import { Q as isJsonObject, R as CodexAppServerRpcError, a as getLeasedSharedCodexAppServerClient, c as releaseLeasedSharedCodexAppServerClient } from "./shared-client-wmgNFNYp.js";
|
|
2
|
+
import { _ as readCodexNotificationItem } from "./attempt-notifications-DdmnBMUp.js";
|
|
3
|
+
import { l as sessionBindingIdentity, t as CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS } from "./session-binding-ZSMX1omP.js";
|
|
4
4
|
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-D1Wky__S.js";
|
|
5
|
-
import { a as resolveCodexBindingAppServerConnection, n as readCodexNotificationThreadId, r as readCodexNotificationTurnId } from "./notification-correlation-
|
|
5
|
+
import { a as resolveCodexBindingAppServerConnection, n as readCodexNotificationThreadId, r as readCodexNotificationTurnId } from "./notification-correlation-BGLixv5_.js";
|
|
6
6
|
import { resolveAgentDir, resolveDefaultAgentId } from "openclaw/plugin-sdk/agent-runtime";
|
|
7
7
|
import { embeddedAgentLog, resolveCompactionTimeoutMs } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
8
8
|
//#region extensions/codex/src/app-server/compact.ts
|
|
@@ -261,6 +261,7 @@ function readIgnoredCompactionOverridePaths(params) {
|
|
|
261
261
|
const inheritedProvider = !localProvider && typeof entry.inheritedRecord?.provider === "string" ? entry.inheritedRecord.provider.trim() : "";
|
|
262
262
|
const providerPath = localProvider ? `${entry.path}.compaction.provider` : inheritedProvider && entry.inheritedPath ? `${entry.inheritedPath}.compaction.provider` : void 0;
|
|
263
263
|
if (typeof entry.record.model === "string" && entry.record.model.trim()) ignored.add(`${entry.path}.compaction.model`);
|
|
264
|
+
if (typeof entry.record.thinkingLevel === "string" && entry.record.thinkingLevel.trim()) ignored.add(`${entry.path}.compaction.thinkingLevel`);
|
|
264
265
|
if (providerPath) ignored.add(providerPath);
|
|
265
266
|
}
|
|
266
267
|
return [...ignored];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { E as resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath, H as isCodexAppServerConnectionClosedError, U as isCodexAppServerIndeterminateRequestCancellationError, W as isCodexAppServerIndeterminateTransportError, a as getLeasedSharedCodexAppServerClient, c as releaseLeasedSharedCodexAppServerClient, h as acquireCodexNativeConfigFence, l as resolveCodexNativeConfigFenceKey } from "./shared-client-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { r as requestCodexAppServerJson } from "./request-
|
|
1
|
+
import { E as resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath, H as isCodexAppServerConnectionClosedError, U as isCodexAppServerIndeterminateRequestCancellationError, W as isCodexAppServerIndeterminateTransportError, a as getLeasedSharedCodexAppServerClient, c as releaseLeasedSharedCodexAppServerClient, h as acquireCodexNativeConfigFence, l as resolveCodexNativeConfigFenceKey } from "./shared-client-wmgNFNYp.js";
|
|
2
|
+
import { w as resolveCodexComputerUseConfig, x as resolveCodexAppServerRuntimeOptions } from "./session-binding-ZSMX1omP.js";
|
|
3
|
+
import { n as describeControlFailure } from "./capabilities-CLICvTxf.js";
|
|
4
|
+
import { r as requestCodexAppServerJson } from "./request-BTccUTD3.js";
|
|
5
5
|
import { existsSync } from "node:fs";
|
|
6
6
|
import { runExec } from "openclaw/plugin-sdk/process-runtime";
|
|
7
7
|
//#region extensions/codex/src/app-server/computer-use.ts
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { a as getLeasedSharedCodexAppServerClient, c as releaseLeasedSharedCodexAppServerClient, p as withLeasedCodexAppServerClientStartSelectionRetry, s as releaseCodexAppServerClientLease } from "./shared-client-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { a as getLeasedSharedCodexAppServerClient, c as releaseLeasedSharedCodexAppServerClient, p as withLeasedCodexAppServerClientStartSelectionRetry, s as releaseCodexAppServerClientLease } from "./shared-client-wmgNFNYp.js";
|
|
2
|
+
import { T as resolveCodexModelBackedReviewerPolicyContext, o as isCodexAppServerNativeAuthProfile, r as bindingStoreKey, s as normalizeCodexAppServerBindingModelProvider, v as isCodexFastServiceTier, x as resolveCodexAppServerRuntimeOptions } from "./session-binding-ZSMX1omP.js";
|
|
3
|
+
import { x as resolveCodexBindingModelProviderFallback, y as resolveCodexAppServerRequestModelSelection } from "./thread-lifecycle-cqrOlJkq.js";
|
|
4
|
+
import { t as CODEX_CONTROL_METHODS } from "./capabilities-CLICvTxf.js";
|
|
5
|
+
import { r as formatCodexDisplayText } from "./command-formatters-DgADqnHa.js";
|
|
6
|
+
import { a as resolveCodexBindingAppServerConnection } from "./notification-correlation-BGLixv5_.js";
|
|
6
7
|
import { ModelSelectionLockedError } from "openclaw/plugin-sdk/model-session-runtime";
|
|
7
8
|
//#region extensions/codex/src/command-authorization.ts
|
|
8
9
|
const CODEX_NATIVE_EXECUTION_AUTH_ERROR = "Only an owner or operator.admin can control Codex native execution.";
|
|
@@ -302,7 +302,7 @@ async function migrateSource(source, candidates, params, store) {
|
|
|
302
302
|
return await withFileLock(source.sidecarPath, LEGACY_BINDING_LOCK_OPTIONS, async () => {
|
|
303
303
|
const [contents, stat] = await Promise.all([fs.readFile(source.sidecarPath, "utf8"), fs.stat(source.sidecarPath)]);
|
|
304
304
|
const raw = JSON.parse(contents);
|
|
305
|
-
const [{ bindingStoreKey, createStoredCodexAppServerBinding, normalizeStoredCodexAppServerBindingFingerprints, readStoredCodexAppServerBinding }, { legacyCodexConversationBindingId }] = await Promise.all([import("./session-binding-
|
|
305
|
+
const [{ bindingStoreKey, createStoredCodexAppServerBinding, normalizeStoredCodexAppServerBindingFingerprints, readStoredCodexAppServerBinding }, { legacyCodexConversationBindingId }] = await Promise.all([import("./session-binding-ZSMX1omP.js").then((n) => n.u), import("./conversation-binding-data-BHRpYbX3.js").then((n) => n.t)]);
|
|
306
306
|
const agentId = owner?.agentId ?? (source.agentIds.size === 1 ? [...source.agentIds][0] : void 0);
|
|
307
307
|
const baseStored = createStoredCodexAppServerBinding(raw, {
|
|
308
308
|
now: stat.mtime.toISOString(),
|