@openclaw/codex 2026.6.2-beta.1 → 2026.6.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{client-factory-BS9nYX8K.js → client-factory-Bt49r45B.js} +2 -1
- package/dist/{client-BFxKzFnH.js → client-kMCtlApt.js} +42 -0
- package/dist/{command-handlers-BaBMyAFy.js → command-handlers-DMn2M7W7.js} +9 -9
- package/dist/{compact-CVPc2Rag.js → compact-CwnPeYnM.js} +11 -4
- package/dist/{computer-use-Dhz6SrFx.js → computer-use-ClweWaMz.js} +11 -1
- package/dist/{conversation-binding-CMaXGYAc.js → conversation-binding-CzpvaBs1.js} +7 -7
- package/dist/doctor-contract-api.js +5 -0
- package/dist/harness.js +9 -5
- package/dist/index.js +8 -6
- package/dist/media-understanding-provider.js +13 -5
- package/dist/{models-D8i1zWEu.js → models-DXorTaja.js} +9 -2
- package/dist/{native-hook-relay-CBp3nIGk.js → native-hook-relay-DZ3Oon0b.js} +61 -3
- package/dist/{notification-correlation-Bg-AlEEy.js → notification-correlation-o8quHmTK.js} +30 -1
- package/dist/prompt-overlay.js +7 -0
- package/dist/{protocol-validators-DIt7cXIp.js → protocol-validators-CIpP8IJ2.js} +13 -0
- package/dist/provider-catalog.js +8 -0
- package/dist/provider-discovery.js +1 -0
- package/dist/provider.js +16 -1
- package/dist/{rate-limit-cache-N66I-Rd7.js → rate-limit-cache-C7qmZ0Jh.js} +2 -0
- package/dist/{request-nYrsFNU2.js → request-D64BfplD.js} +16 -4
- package/dist/{run-attempt-Wo9uasL_.js → run-attempt-B_6VkFQN.js} +306 -13
- package/dist/{sandbox-guard-DMCJlzmz.js → sandbox-guard-C-Yv9uwY.js} +5 -0
- package/dist/{session-binding-D8DxeEbf.js → session-binding-BgTv_YGm.js} +11 -0
- package/dist/{shared-client-B31-oqN-.js → shared-client-xytpSKD0.js} +31 -2
- package/dist/{side-question-DbYSPUnj.js → side-question-BEpALo9c.js} +9 -9
- package/dist/{thread-lifecycle-BOYYMjx6.js → thread-lifecycle-BJsazZ8j.js} +50 -6
- package/npm-shrinkwrap.json +2 -2
- package/package.json +4 -4
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
//#region extensions/codex/src/app-server/client-factory.ts
|
|
2
2
|
let sharedClientModulePromise = null;
|
|
3
3
|
const loadSharedClientModule = async () => {
|
|
4
|
-
sharedClientModulePromise ??= import("./shared-client-
|
|
4
|
+
sharedClientModulePromise ??= import("./shared-client-xytpSKD0.js").then((n) => n.c);
|
|
5
5
|
return await sharedClientModulePromise;
|
|
6
6
|
};
|
|
7
|
+
/** Returns a leased shared client so startup can release ownership explicitly. */
|
|
7
8
|
const defaultLeasedCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config, options) => loadSharedClientModule().then(({ getLeasedSharedCodexAppServerClient }) => getLeasedSharedCodexAppServerClient({
|
|
8
9
|
startOptions,
|
|
9
10
|
authProfileId,
|
|
@@ -15,6 +15,10 @@ function isRpcResponse(message) {
|
|
|
15
15
|
}
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region extensions/codex/src/app-server/transport-stdio.ts
|
|
18
|
+
/**
|
|
19
|
+
* Creates and configures stdio-backed Codex app-server transports, including
|
|
20
|
+
* Windows spawn normalization and environment filtering.
|
|
21
|
+
*/
|
|
18
22
|
const UNSAFE_ENVIRONMENT_KEYS = new Set([
|
|
19
23
|
"__proto__",
|
|
20
24
|
"constructor",
|
|
@@ -25,6 +29,7 @@ const DEFAULT_SPAWN_RUNTIME = {
|
|
|
25
29
|
env: process.env,
|
|
26
30
|
execPath: process.execPath
|
|
27
31
|
};
|
|
32
|
+
/** Resolves the concrete command/argv/shell settings used to spawn Codex app-server. */
|
|
28
33
|
function resolveCodexAppServerSpawnInvocation(options, runtime = DEFAULT_SPAWN_RUNTIME) {
|
|
29
34
|
if (options.commandSource === "managed") throw new Error("Managed Codex app-server start options must be resolved before spawn.");
|
|
30
35
|
const resolved = materializeWindowsSpawnProgram(resolveWindowsSpawnProgram({
|
|
@@ -41,6 +46,7 @@ function resolveCodexAppServerSpawnInvocation(options, runtime = DEFAULT_SPAWN_R
|
|
|
41
46
|
windowsHide: resolved.windowsHide
|
|
42
47
|
};
|
|
43
48
|
}
|
|
49
|
+
/** Merges app-server environment overrides while honoring clearEnv and unsafe key filtering. */
|
|
44
50
|
function resolveCodexAppServerSpawnEnv(options, baseEnv = process.env, platform = process.platform) {
|
|
45
51
|
const env = Object.create(null);
|
|
46
52
|
copySafeEnvironmentEntries(env, baseEnv);
|
|
@@ -66,6 +72,7 @@ function copySafeEnvironmentEntries(target, source) {
|
|
|
66
72
|
target[key] = value;
|
|
67
73
|
}
|
|
68
74
|
}
|
|
75
|
+
/** Spawns the Codex app-server process and returns the shared transport interface. */
|
|
69
76
|
function createStdioTransport(options) {
|
|
70
77
|
const env = resolveCodexAppServerSpawnEnv(options);
|
|
71
78
|
const invocation = resolveCodexAppServerSpawnInvocation(options, {
|
|
@@ -87,6 +94,11 @@ function createStdioTransport(options) {
|
|
|
87
94
|
}
|
|
88
95
|
//#endregion
|
|
89
96
|
//#region extensions/codex/src/app-server/transport-websocket.ts
|
|
97
|
+
/**
|
|
98
|
+
* Adapts a remote Codex app-server WebSocket endpoint to the shared stdio-like
|
|
99
|
+
* transport interface.
|
|
100
|
+
*/
|
|
101
|
+
/** Opens a WebSocket app-server transport and maps newline-delimited frames to stdout/stdin. */
|
|
90
102
|
function createWebSocketTransport(options) {
|
|
91
103
|
if (!options.url) throw new Error("codex app-server websocket transport requires plugins.entries.codex.config.appServer.url");
|
|
92
104
|
const events = new EventEmitter();
|
|
@@ -152,6 +164,7 @@ function websocketFrameToText(data) {
|
|
|
152
164
|
}
|
|
153
165
|
//#endregion
|
|
154
166
|
//#region extensions/codex/src/app-server/transport.ts
|
|
167
|
+
/** Starts graceful transport shutdown and schedules a force kill fallback. */
|
|
155
168
|
function closeCodexAppServerTransport(child, options = {}) {
|
|
156
169
|
child.stdin.end?.();
|
|
157
170
|
child.stdin.destroy?.();
|
|
@@ -171,6 +184,7 @@ function closeCodexAppServerTransport(child, options = {}) {
|
|
|
171
184
|
child.stderr.unref?.();
|
|
172
185
|
child.stdin.unref?.();
|
|
173
186
|
}
|
|
187
|
+
/** Closes a transport and waits briefly for an exit event. */
|
|
174
188
|
async function closeCodexAppServerTransportAndWait(child, options = {}) {
|
|
175
189
|
if (!hasCodexAppServerTransportExited(child)) closeCodexAppServerTransport(child, options);
|
|
176
190
|
return await waitForCodexAppServerTransportExit(child, options.exitTimeoutMs ?? 2e3);
|
|
@@ -206,17 +220,28 @@ function signalCodexAppServerTransport(child, signal) {
|
|
|
206
220
|
}
|
|
207
221
|
//#endregion
|
|
208
222
|
//#region extensions/codex/src/app-server/version.ts
|
|
223
|
+
/**
|
|
224
|
+
* Version and package pins for the managed Codex app-server runtime.
|
|
225
|
+
*/
|
|
226
|
+
/** Minimum Codex app-server version supported by the OpenClaw Codex bridge. */
|
|
209
227
|
const MIN_CODEX_APP_SERVER_VERSION = "0.125.0";
|
|
228
|
+
/** Minimum Codex app-server version that supports sandbox exec-server environments. */
|
|
210
229
|
const MIN_CODEX_SANDBOX_EXEC_SERVER_APP_SERVER_VERSION = "0.132.0";
|
|
230
|
+
/** npm package name for the managed Codex app-server binary. */
|
|
211
231
|
const MANAGED_CODEX_APP_SERVER_PACKAGE = "@openai/codex";
|
|
212
232
|
//#endregion
|
|
213
233
|
//#region extensions/codex/src/app-server/client.ts
|
|
234
|
+
/**
|
|
235
|
+
* JSON-RPC client for Codex app-server transports, including request/response
|
|
236
|
+
* routing, notification fanout, server request handlers, and version checks.
|
|
237
|
+
*/
|
|
214
238
|
const CODEX_APP_SERVER_PARSE_LOG_MAX = 500;
|
|
215
239
|
const CODEX_APP_SERVER_PARSE_BUFFER_MAX = 1e6;
|
|
216
240
|
const CODEX_APP_SERVER_PARSE_BUFFER_MAX_LINES = 1e3;
|
|
217
241
|
const CODEX_DYNAMIC_TOOL_SERVER_REQUEST_TIMEOUT_MS = 6e5;
|
|
218
242
|
const CODEX_APP_SERVER_STDERR_TAIL_MAX = 2e3;
|
|
219
243
|
const UNPAIRED_SURROGATE_RE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g;
|
|
244
|
+
/** RPC error wrapper that preserves app-server error code and data. */
|
|
220
245
|
var CodexAppServerRpcError = class extends Error {
|
|
221
246
|
constructor(error, method) {
|
|
222
247
|
super(formatCodexAppServerRpcErrorMessage(error, method));
|
|
@@ -241,10 +266,12 @@ function readCodexAppServerRpcReloginDetail(data) {
|
|
|
241
266
|
function isJsonObject(value) {
|
|
242
267
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
243
268
|
}
|
|
269
|
+
/** Returns true for errors that mean the app-server transport is closed. */
|
|
244
270
|
function isCodexAppServerConnectionClosedError(error) {
|
|
245
271
|
if (!(error instanceof Error)) return false;
|
|
246
272
|
return error.message === "codex app-server client is closed" || error.message.startsWith("codex app-server exited:");
|
|
247
273
|
}
|
|
274
|
+
/** Stateful app-server JSON-RPC client over stdio or websocket transport. */
|
|
248
275
|
var CodexAppServerClient = class CodexAppServerClient {
|
|
249
276
|
constructor(child) {
|
|
250
277
|
this.pending = /* @__PURE__ */ new Map();
|
|
@@ -270,6 +297,7 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
270
297
|
});
|
|
271
298
|
child.stdin.on?.("error", (error) => this.closeWithError(error instanceof Error ? error : new Error(String(error))));
|
|
272
299
|
}
|
|
300
|
+
/** Starts a new app-server client using resolved runtime start options. */
|
|
273
301
|
static start(options) {
|
|
274
302
|
const defaults = resolveCodexAppServerRuntimeOptions().start;
|
|
275
303
|
const startOptions = {
|
|
@@ -281,9 +309,11 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
281
309
|
if (startOptions.transport === "websocket") return new CodexAppServerClient(createWebSocketTransport(startOptions));
|
|
282
310
|
return new CodexAppServerClient(createStdioTransport(startOptions));
|
|
283
311
|
}
|
|
312
|
+
/** Builds a client around a fake transport for tests. */
|
|
284
313
|
static fromTransportForTests(child) {
|
|
285
314
|
return new CodexAppServerClient(child);
|
|
286
315
|
}
|
|
316
|
+
/** Performs the app-server initialize handshake and validates protocol version. */
|
|
287
317
|
async initialize() {
|
|
288
318
|
if (this.initialized) return;
|
|
289
319
|
const response = await this.request("initialize", {
|
|
@@ -298,6 +328,7 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
298
328
|
this.notify("initialized");
|
|
299
329
|
this.initialized = true;
|
|
300
330
|
}
|
|
331
|
+
/** Returns the version detected during initialize. */
|
|
301
332
|
getServerVersion() {
|
|
302
333
|
return this.serverVersion;
|
|
303
334
|
}
|
|
@@ -361,34 +392,42 @@ var CodexAppServerClient = class CodexAppServerClient {
|
|
|
361
392
|
}
|
|
362
393
|
});
|
|
363
394
|
}
|
|
395
|
+
/** Sends a fire-and-forget JSON-RPC notification to the app-server. */
|
|
364
396
|
notify(method, params) {
|
|
365
397
|
this.writeMessage({
|
|
366
398
|
method,
|
|
367
399
|
params
|
|
368
400
|
});
|
|
369
401
|
}
|
|
402
|
+
/** Registers a handler for app-server requests sent back to OpenClaw. */
|
|
370
403
|
addRequestHandler(handler) {
|
|
371
404
|
this.requestHandlers.add(handler);
|
|
372
405
|
return () => this.requestHandlers.delete(handler);
|
|
373
406
|
}
|
|
407
|
+
/** Registers a notification handler and returns its disposer. */
|
|
374
408
|
addNotificationHandler(handler) {
|
|
375
409
|
this.notificationHandlers.add(handler);
|
|
376
410
|
return () => this.notificationHandlers.delete(handler);
|
|
377
411
|
}
|
|
412
|
+
/** Installs a lease-count provider used to route unscoped notifications. */
|
|
378
413
|
setActiveSharedLeaseCountProviderForUnscopedNotifications(provider) {
|
|
379
414
|
this.activeSharedLeaseCountProvider = provider;
|
|
380
415
|
}
|
|
416
|
+
/** Reads the active shared-client lease count when available. */
|
|
381
417
|
getActiveSharedLeaseCountForUnscopedNotifications() {
|
|
382
418
|
return this.activeSharedLeaseCountProvider?.();
|
|
383
419
|
}
|
|
420
|
+
/** Registers a close handler and returns its disposer. */
|
|
384
421
|
addCloseHandler(handler) {
|
|
385
422
|
this.closeHandlers.add(handler);
|
|
386
423
|
return () => this.closeHandlers.delete(handler);
|
|
387
424
|
}
|
|
425
|
+
/** Closes the transport without waiting for process/socket shutdown. */
|
|
388
426
|
close() {
|
|
389
427
|
if (!this.markClosed(/* @__PURE__ */ new Error("codex app-server client is closed"))) return;
|
|
390
428
|
closeCodexAppServerTransport(this.child);
|
|
391
429
|
}
|
|
430
|
+
/** Closes the transport and waits for shutdown according to transport policy. */
|
|
392
431
|
async closeAndWait(options) {
|
|
393
432
|
this.markClosed(/* @__PURE__ */ new Error("codex app-server client is closed"));
|
|
394
433
|
await closeCodexAppServerTransportAndWait(this.child, options);
|
|
@@ -600,9 +639,11 @@ function assertSupportedCodexAppServerVersion(response) {
|
|
|
600
639
|
if (compareCodexAppServerVersions(detectedVersion, "0.125.0") < 0) throw new Error(`Codex app-server ${MIN_CODEX_APP_SERVER_VERSION} or newer is required, but detected ${detectedVersion}. Update the configured Codex app-server binary, or remove custom command overrides to use the managed binary.`);
|
|
601
640
|
return detectedVersion;
|
|
602
641
|
}
|
|
642
|
+
/** Extracts the Codex version from the app-server initialize user-agent field. */
|
|
603
643
|
function readCodexVersionFromUserAgent(userAgent) {
|
|
604
644
|
return (userAgent?.match(/^[^/]+\/(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)(?:[\s(]|$)/))?.[1];
|
|
605
645
|
}
|
|
646
|
+
/** Compares stable Codex app-server versions for protocol floor checks. */
|
|
606
647
|
function compareCodexAppServerVersions(left, right) {
|
|
607
648
|
const leftVersion = parseVersionForComparison(left);
|
|
608
649
|
const rightVersion = parseVersionForComparison(right);
|
|
@@ -660,6 +701,7 @@ const CODEX_APP_SERVER_APPROVAL_REQUEST_METHODS = new Set([
|
|
|
660
701
|
"item/fileChange/requestApproval",
|
|
661
702
|
"item/permissions/requestApproval"
|
|
662
703
|
]);
|
|
704
|
+
/** Returns true for app-server approval request methods OpenClaw can answer. */
|
|
663
705
|
function isCodexAppServerApprovalRequest(method) {
|
|
664
706
|
return CODEX_APP_SERVER_APPROVAL_REQUEST_METHODS.has(method);
|
|
665
707
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { a as isCodexFastServiceTier, l as resolveCodexAppServerRuntimeOptions } from "./config-BT6SLiE6.js";
|
|
2
|
-
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-
|
|
3
|
-
import { l as isJsonObject } from "./client-
|
|
4
|
-
import { a as readCodexAppServerBinding, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
5
|
-
import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-
|
|
6
|
-
import { a as buildHelp, c as formatCodexStatus, d as formatModels, f as formatSkills, l as formatComputerUseStatus, m as readString$1, o as formatAccount, p as formatThreads, s as formatCodexDisplayText, u as formatList, v as summarizeCodexAccountUsage } from "./notification-correlation-
|
|
7
|
-
import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-
|
|
8
|
-
import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, m as setCodexConversationFastMode, o as formatCodexCliSessions, p as readCodexConversationActiveTurn, r as startCodexConversationThread, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./conversation-binding-
|
|
9
|
-
import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-
|
|
10
|
-
import { n as rememberCodexRateLimits } from "./rate-limit-cache-
|
|
2
|
+
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-DXorTaja.js";
|
|
3
|
+
import { l as isJsonObject } from "./client-kMCtlApt.js";
|
|
4
|
+
import { a as readCodexAppServerBinding, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-BgTv_YGm.js";
|
|
5
|
+
import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-D64BfplD.js";
|
|
6
|
+
import { a as buildHelp, c as formatCodexStatus, d as formatModels, f as formatSkills, l as formatComputerUseStatus, m as readString$1, o as formatAccount, p as formatThreads, s as formatCodexDisplayText, u as formatList, v as summarizeCodexAccountUsage } from "./notification-correlation-o8quHmTK.js";
|
|
7
|
+
import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-C-Yv9uwY.js";
|
|
8
|
+
import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, m as setCodexConversationFastMode, o as formatCodexCliSessions, p as readCodexConversationActiveTurn, r as startCodexConversationThread, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./conversation-binding-CzpvaBs1.js";
|
|
9
|
+
import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-ClweWaMz.js";
|
|
10
|
+
import { n as rememberCodexRateLimits } from "./rate-limit-cache-C7qmZ0Jh.js";
|
|
11
11
|
import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
12
12
|
import crypto from "node:crypto";
|
|
13
13
|
import { normalizeOptionalString, normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { l as resolveCodexAppServerRuntimeOptions } from "./config-BT6SLiE6.js";
|
|
2
|
-
import { a as readCodexAppServerBinding } from "./session-binding-
|
|
3
|
-
import { o as releaseLeasedSharedCodexAppServerClient } from "./shared-client-
|
|
4
|
-
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-
|
|
5
|
-
import { t as defaultLeasedCodexAppServerClientFactory } from "./client-factory-
|
|
2
|
+
import { a as readCodexAppServerBinding } from "./session-binding-BgTv_YGm.js";
|
|
3
|
+
import { o as releaseLeasedSharedCodexAppServerClient } from "./shared-client-xytpSKD0.js";
|
|
4
|
+
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-C-Yv9uwY.js";
|
|
5
|
+
import { t as defaultLeasedCodexAppServerClientFactory } from "./client-factory-Bt49r45B.js";
|
|
6
6
|
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
7
7
|
//#region extensions/codex/src/app-server/compact.ts
|
|
8
|
+
/**
|
|
9
|
+
* Native Codex app-server compaction bridge for bound OpenClaw sessions.
|
|
10
|
+
*/
|
|
8
11
|
const warnedIgnoredCompactionOverrides = /* @__PURE__ */ new Set();
|
|
12
|
+
/**
|
|
13
|
+
* Starts native Codex compaction for a manually requested bound session, or
|
|
14
|
+
* reports why Codex-owned automatic compaction should handle the trigger.
|
|
15
|
+
*/
|
|
9
16
|
async function maybeCompactCodexAppServerSession(params, options = {}) {
|
|
10
17
|
warnIfIgnoringOpenClawCompactionOverrides(params);
|
|
11
18
|
return compactCodexNativeThread(params, options);
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { l as resolveCodexAppServerRuntimeOptions, u as resolveCodexComputerUseConfig } from "./config-BT6SLiE6.js";
|
|
2
|
-
import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-
|
|
2
|
+
import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-D64BfplD.js";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
//#region extensions/codex/src/app-server/computer-use.ts
|
|
5
|
+
/**
|
|
6
|
+
* Computer Use plugin/MCP readiness checks and optional install flow for Codex
|
|
7
|
+
* app-server sessions.
|
|
8
|
+
*/
|
|
5
9
|
var CodexComputerUseSetupError = class extends Error {
|
|
6
10
|
constructor(status) {
|
|
7
11
|
super(status.message);
|
|
@@ -16,6 +20,7 @@ const COMPUTER_USE_MARKETPLACE_NAME_PRIORITY = [
|
|
|
16
20
|
"local"
|
|
17
21
|
];
|
|
18
22
|
const DEFAULT_CODEX_BUNDLED_MARKETPLACE_PATH = "/Applications/Codex.app/Contents/Resources/plugins/openai-bundled";
|
|
23
|
+
/** Reads Computer Use readiness without installing or mutating app-server state. */
|
|
19
24
|
async function readCodexComputerUseStatus(params = {}) {
|
|
20
25
|
const config = resolveComputerUseConfig(params);
|
|
21
26
|
if (!config.enabled) return disabledStatus(config);
|
|
@@ -29,6 +34,10 @@ async function readCodexComputerUseStatus(params = {}) {
|
|
|
29
34
|
return unavailableStatus(config, "check_failed", `Computer Use check failed: ${describeControlFailure(error)}`);
|
|
30
35
|
}
|
|
31
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Ensures Computer Use is ready when enabled, optionally installing when config
|
|
39
|
+
* allows safe auto-install.
|
|
40
|
+
*/
|
|
32
41
|
async function ensureCodexComputerUse(params = {}) {
|
|
33
42
|
const config = resolveComputerUseConfig(params);
|
|
34
43
|
if (!config.enabled) return disabledStatus(config);
|
|
@@ -52,6 +61,7 @@ async function ensureCodexComputerUse(params = {}) {
|
|
|
52
61
|
if (!status.ready) throw new CodexComputerUseSetupError(status);
|
|
53
62
|
return status;
|
|
54
63
|
}
|
|
64
|
+
/** Forces Computer Use plugin installation and returns the ready status. */
|
|
55
65
|
async function installCodexComputerUse(params = {}) {
|
|
56
66
|
const config = resolveComputerUseConfig({
|
|
57
67
|
...params,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { a as isCodexFastServiceTier, f as resolveOpenClawExecPolicyForCodexAppServer, l as resolveCodexAppServerRuntimeOptions, r as codexSandboxPolicyForTurn } from "./config-BT6SLiE6.js";
|
|
2
|
-
import { l as isJsonObject } from "./client-
|
|
3
|
-
import { t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-
|
|
4
|
-
import { a as readCodexAppServerBinding, i as normalizeCodexAppServerBindingModelProvider, r as isCodexAppServerNativeAuthProfile, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
5
|
-
import { r as CODEX_CONTROL_METHODS } from "./request-
|
|
6
|
-
import { i as readCodexNotificationTurnId, r as readCodexNotificationThreadId, s as formatCodexDisplayText } from "./notification-correlation-
|
|
7
|
-
import { a as getLeasedSharedCodexAppServerClient, o as releaseLeasedSharedCodexAppServerClient, p as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-
|
|
8
|
-
import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-
|
|
2
|
+
import { l as isJsonObject } from "./client-kMCtlApt.js";
|
|
3
|
+
import { t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-BJsazZ8j.js";
|
|
4
|
+
import { a as readCodexAppServerBinding, i as normalizeCodexAppServerBindingModelProvider, r as isCodexAppServerNativeAuthProfile, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-BgTv_YGm.js";
|
|
5
|
+
import { r as CODEX_CONTROL_METHODS } from "./request-D64BfplD.js";
|
|
6
|
+
import { i as readCodexNotificationTurnId, r as readCodexNotificationThreadId, s as formatCodexDisplayText } from "./notification-correlation-o8quHmTK.js";
|
|
7
|
+
import { a as getLeasedSharedCodexAppServerClient, o as releaseLeasedSharedCodexAppServerClient, p as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-xytpSKD0.js";
|
|
8
|
+
import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-C-Yv9uwY.js";
|
|
9
9
|
import { resolveTimerTimeoutMs, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
10
10
|
import os from "node:os";
|
|
11
11
|
import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
|
|
@@ -5,6 +5,7 @@ function asRecord(value) {
|
|
|
5
5
|
function hasRetiredDynamicToolsProfile(value) {
|
|
6
6
|
return Object.hasOwn(asRecord(value) ?? {}, "codexDynamicToolsProfile");
|
|
7
7
|
}
|
|
8
|
+
/** Legacy Codex config keys that doctor should report or repair. */
|
|
8
9
|
const legacyConfigRules = [{
|
|
9
10
|
path: [
|
|
10
11
|
"plugins",
|
|
@@ -15,6 +16,9 @@ const legacyConfigRules = [{
|
|
|
15
16
|
message: "plugins.entries.codex.config.codexDynamicToolsProfile is retired; Codex app-server always keeps Codex-native workspace tools native. Run \"openclaw doctor --fix\".",
|
|
16
17
|
match: hasRetiredDynamicToolsProfile
|
|
17
18
|
}];
|
|
19
|
+
/**
|
|
20
|
+
* Removes retired Codex plugin config keys while preserving unrelated config.
|
|
21
|
+
*/
|
|
18
22
|
function normalizeCompatibilityConfig({ cfg }) {
|
|
19
23
|
const rawPluginConfig = asRecord(asRecord(cfg.plugins?.entries?.codex)?.config);
|
|
20
24
|
if (!rawPluginConfig || !hasRetiredDynamicToolsProfile(rawPluginConfig)) return {
|
|
@@ -33,6 +37,7 @@ function normalizeCompatibilityConfig({ cfg }) {
|
|
|
33
37
|
changes: ["Removed retired plugins.entries.codex.config.codexDynamicToolsProfile; Codex app-server always keeps Codex-native workspace tools native."]
|
|
34
38
|
};
|
|
35
39
|
}
|
|
40
|
+
/** Session/auth ownership metadata used by doctor route-state checks. */
|
|
36
41
|
const sessionRouteStateOwners = [{
|
|
37
42
|
id: "codex",
|
|
38
43
|
label: "Codex",
|
package/dist/harness.js
CHANGED
|
@@ -9,6 +9,10 @@ const CODEX_APP_SERVER_CONTEXT_ENGINE_HOST_CAPABILITIES = [
|
|
|
9
9
|
"runtime-llm-complete",
|
|
10
10
|
"thread-bootstrap-projection"
|
|
11
11
|
];
|
|
12
|
+
/**
|
|
13
|
+
* Creates the Codex app-server harness used for attempts, side questions,
|
|
14
|
+
* compaction, reset, and disposal.
|
|
15
|
+
*/
|
|
12
16
|
function createCodexAppServerAgentHarness(options) {
|
|
13
17
|
const providerIds = new Set([...options?.providerIds ?? DEFAULT_CODEX_HARNESS_PROVIDER_IDS].map((id) => id.trim().toLowerCase()));
|
|
14
18
|
return {
|
|
@@ -28,31 +32,31 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
28
32
|
};
|
|
29
33
|
},
|
|
30
34
|
runAttempt: async (params) => {
|
|
31
|
-
const { runCodexAppServerAttempt } = await import("./run-attempt-
|
|
35
|
+
const { runCodexAppServerAttempt } = await import("./run-attempt-B_6VkFQN.js");
|
|
32
36
|
return runCodexAppServerAttempt(params, {
|
|
33
37
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
34
38
|
nativeHookRelay: { enabled: true }
|
|
35
39
|
});
|
|
36
40
|
},
|
|
37
41
|
runSideQuestion: async (params) => {
|
|
38
|
-
const { runCodexAppServerSideQuestion } = await import("./side-question-
|
|
42
|
+
const { runCodexAppServerSideQuestion } = await import("./side-question-BEpALo9c.js");
|
|
39
43
|
return runCodexAppServerSideQuestion(params, {
|
|
40
44
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
41
45
|
nativeHookRelay: { enabled: true }
|
|
42
46
|
});
|
|
43
47
|
},
|
|
44
48
|
compact: async (params) => {
|
|
45
|
-
const { maybeCompactCodexAppServerSession } = await import("./compact-
|
|
49
|
+
const { maybeCompactCodexAppServerSession } = await import("./compact-CwnPeYnM.js");
|
|
46
50
|
return maybeCompactCodexAppServerSession(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
47
51
|
},
|
|
48
52
|
reset: async (params) => {
|
|
49
53
|
if (params.sessionFile) {
|
|
50
|
-
const { clearCodexAppServerBinding } = await import("./session-binding-
|
|
54
|
+
const { clearCodexAppServerBinding } = await import("./session-binding-BgTv_YGm.js").then((n) => n.o);
|
|
51
55
|
await clearCodexAppServerBinding(params.sessionFile);
|
|
52
56
|
}
|
|
53
57
|
},
|
|
54
58
|
dispose: async () => {
|
|
55
|
-
const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-
|
|
59
|
+
const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-xytpSKD0.js").then((n) => n.c);
|
|
56
60
|
await clearSharedCodexAppServerClientAndWait();
|
|
57
61
|
}
|
|
58
62
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createCodexAppServerAgentHarness } from "./harness.js";
|
|
2
2
|
import { c as readCodexPluginConfig, l as resolveCodexAppServerRuntimeOptions, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config-BT6SLiE6.js";
|
|
3
3
|
import { buildCodexProvider } from "./provider.js";
|
|
4
|
-
import { v as ensureCodexPluginActivation, x as defaultCodexAppInventoryCache, y as pluginReadParams } from "./thread-lifecycle-
|
|
4
|
+
import { v as ensureCodexPluginActivation, x as defaultCodexAppInventoryCache, y as pluginReadParams } from "./thread-lifecycle-BJsazZ8j.js";
|
|
5
5
|
import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
6
|
-
import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-
|
|
7
|
-
import { s as formatCodexDisplayText } from "./notification-correlation-
|
|
8
|
-
import { a as getLeasedSharedCodexAppServerClient, d as resolveCodexAppServerAuthAccountCacheKey, m as resolveCodexAppServerFallbackApiKeyCacheKey, o as releaseLeasedSharedCodexAppServerClient, p as resolveCodexAppServerAuthProfileIdForAgent, r as clearSharedCodexAppServerClientIfCurrentAndWait } from "./shared-client-
|
|
9
|
-
import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, n as handleCodexConversationInboundClaim, s as listCodexCliSessionsOnNode, t as handleCodexConversationBindingResolved } from "./conversation-binding-
|
|
6
|
+
import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-D64BfplD.js";
|
|
7
|
+
import { s as formatCodexDisplayText } from "./notification-correlation-o8quHmTK.js";
|
|
8
|
+
import { a as getLeasedSharedCodexAppServerClient, d as resolveCodexAppServerAuthAccountCacheKey, m as resolveCodexAppServerFallbackApiKeyCacheKey, o as releaseLeasedSharedCodexAppServerClient, p as resolveCodexAppServerAuthProfileIdForAgent, r as clearSharedCodexAppServerClientIfCurrentAndWait } from "./shared-client-xytpSKD0.js";
|
|
9
|
+
import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, n as handleCodexConversationInboundClaim, s as listCodexCliSessionsOnNode, t as handleCodexConversationBindingResolved } from "./conversation-binding-CzpvaBs1.js";
|
|
10
10
|
import { mutateConfigFile } from "openclaw/plugin-sdk/config-mutation";
|
|
11
11
|
import { resolveLivePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
12
12
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
@@ -22,6 +22,7 @@ import { archiveMigrationItem, copyMigrationFileItem, withCachedMigrationConfigR
|
|
|
22
22
|
import { applyAuthProfileConfig, buildApiKeyCredential, buildOauthProviderAuthResult, buildOpenAICodexCredentialExtra, readCodexCliCredentialsCached, resolveOpenAICodexAuthIdentity, resolveOpenAICodexImportProfileName, updateAuthProfileStoreWithLock } from "openclaw/plugin-sdk/provider-auth";
|
|
23
23
|
import { readJsonFileWithFallback } from "openclaw/plugin-sdk/json-store";
|
|
24
24
|
//#region extensions/codex/src/commands.ts
|
|
25
|
+
/** Creates the reserved `/codex` command definition exposed by the plugin. */
|
|
25
26
|
function createCodexCommand(options) {
|
|
26
27
|
return {
|
|
27
28
|
name: "codex",
|
|
@@ -39,6 +40,7 @@ function createCodexCommand(options) {
|
|
|
39
40
|
handler: (ctx) => handleCodexCommand(ctx, options)
|
|
40
41
|
};
|
|
41
42
|
}
|
|
43
|
+
/** Dispatches a `/codex` command to the subcommand handler and formats failures for chat. */
|
|
42
44
|
async function handleCodexCommand(ctx, options = {}) {
|
|
43
45
|
const { loadSubcommandHandler, ...subcommandOptions } = options;
|
|
44
46
|
try {
|
|
@@ -48,7 +50,7 @@ async function handleCodexCommand(ctx, options = {}) {
|
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
async function loadDefaultCodexSubcommandHandler() {
|
|
51
|
-
const { handleCodexSubcommand } = await import("./command-handlers-
|
|
53
|
+
const { handleCodexSubcommand } = await import("./command-handlers-DMn2M7W7.js");
|
|
52
54
|
return handleCodexSubcommand;
|
|
53
55
|
}
|
|
54
56
|
//#endregion
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { CODEX_PROVIDER_ID, FALLBACK_CODEX_MODELS } from "./provider-catalog.js";
|
|
2
2
|
import { l as resolveCodexAppServerRuntimeOptions } from "./config-BT6SLiE6.js";
|
|
3
|
-
import { i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, o as readCodexErrorNotification, r as assertCodexThreadStartResponse } from "./protocol-validators-
|
|
4
|
-
import { i as readModelListResult } from "./models-
|
|
5
|
-
import { l as isJsonObject } from "./client-
|
|
6
|
-
import { r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-
|
|
3
|
+
import { i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, o as readCodexErrorNotification, r as assertCodexThreadStartResponse } from "./protocol-validators-CIpP8IJ2.js";
|
|
4
|
+
import { i as readModelListResult } from "./models-DXorTaja.js";
|
|
5
|
+
import { l as isJsonObject } from "./client-kMCtlApt.js";
|
|
6
|
+
import { r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-BJsazZ8j.js";
|
|
7
7
|
import { validateJsonSchemaValue } from "openclaw/plugin-sdk/json-schema-runtime";
|
|
8
8
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
9
9
|
//#region extensions/codex/media-understanding-provider.ts
|
|
10
|
+
/**
|
|
11
|
+
* Codex-backed media understanding provider for bounded image description and
|
|
12
|
+
* structured extraction turns.
|
|
13
|
+
*/
|
|
10
14
|
const DEFAULT_CODEX_IMAGE_MODEL = FALLBACK_CODEX_MODELS.find((model) => model.inputModalities.includes("image"))?.id ?? FALLBACK_CODEX_MODELS[0]?.id;
|
|
11
15
|
const DEFAULT_CODEX_IMAGE_PROMPT = "Describe the image.";
|
|
16
|
+
/**
|
|
17
|
+
* Builds the media-understanding provider that delegates image tasks to an
|
|
18
|
+
* isolated Codex app-server session.
|
|
19
|
+
*/
|
|
12
20
|
function buildCodexMediaUnderstandingProvider(options = {}) {
|
|
13
21
|
return {
|
|
14
22
|
id: CODEX_PROVIDER_ID,
|
|
@@ -64,7 +72,7 @@ async function runBoundedCodexVisionTurn(params) {
|
|
|
64
72
|
const appServer = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.options.pluginConfig });
|
|
65
73
|
const timeoutMs = resolveTimerTimeoutMs(params.timeoutMs, 100, 100);
|
|
66
74
|
const ownsClient = !params.options.clientFactory;
|
|
67
|
-
const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile) : await import("./shared-client-
|
|
75
|
+
const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile) : await import("./shared-client-xytpSKD0.js").then((n) => n.c).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
|
|
68
76
|
startOptions: appServer.start,
|
|
69
77
|
timeoutMs,
|
|
70
78
|
authProfileId: params.profile
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { s as readCodexModelListResponse } from "./protocol-validators-
|
|
2
|
+
import { s as readCodexModelListResponse } from "./protocol-validators-CIpP8IJ2.js";
|
|
3
3
|
import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
//#region extensions/codex/src/app-server/models.ts
|
|
5
|
+
/**
|
|
6
|
+
* Lists and normalizes models exposed by the Codex app-server `model/list`
|
|
7
|
+
* endpoint, including pagination and shared-client lease handling.
|
|
8
|
+
*/
|
|
5
9
|
var models_exports = /* @__PURE__ */ __exportAll({
|
|
6
10
|
listAllCodexAppServerModels: () => listAllCodexAppServerModels,
|
|
7
11
|
listCodexAppServerModels: () => listCodexAppServerModels,
|
|
8
12
|
readModelListResult: () => readModelListResult
|
|
9
13
|
});
|
|
14
|
+
/** Lists one Codex app-server model page using the configured auth/client options. */
|
|
10
15
|
async function listCodexAppServerModels(options = {}) {
|
|
11
16
|
return await withCodexAppServerModelClient(options, async ({ client, timeoutMs }) => requestModelListPage(client, {
|
|
12
17
|
...options,
|
|
13
18
|
timeoutMs
|
|
14
19
|
}));
|
|
15
20
|
}
|
|
21
|
+
/** Walks Codex app-server model pages until exhaustion or the max-page guard. */
|
|
16
22
|
async function listAllCodexAppServerModels(options = {}) {
|
|
17
23
|
const maxPages = normalizeMaxPages(options.maxPages);
|
|
18
24
|
return await withCodexAppServerModelClient(options, async ({ client, timeoutMs }) => {
|
|
@@ -40,7 +46,7 @@ async function listAllCodexAppServerModels(options = {}) {
|
|
|
40
46
|
async function withCodexAppServerModelClient(options, run) {
|
|
41
47
|
const timeoutMs = options.timeoutMs ?? 2500;
|
|
42
48
|
const useSharedClient = options.sharedClient !== false;
|
|
43
|
-
const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-
|
|
49
|
+
const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-xytpSKD0.js").then((n) => n.c);
|
|
44
50
|
const client = useSharedClient ? await getLeasedSharedCodexAppServerClient({
|
|
45
51
|
startOptions: options.startOptions,
|
|
46
52
|
timeoutMs,
|
|
@@ -71,6 +77,7 @@ async function requestModelListPage(client, options) {
|
|
|
71
77
|
includeHidden: options.includeHidden ?? null
|
|
72
78
|
}, { timeoutMs: options.timeoutMs }));
|
|
73
79
|
}
|
|
80
|
+
/** Parses a raw Codex app-server model/list response into OpenClaw's normalized shape. */
|
|
74
81
|
function readModelListResult(value) {
|
|
75
82
|
const response = readCodexModelListResponse(value);
|
|
76
83
|
if (!response) return { models: [] };
|