@openclaw/codex 2026.5.18-beta.1 → 2026.5.19-alpha.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-6FkrXfaz.js → client-BCJaLwdZ.js} +1 -1
- package/dist/{client-factory-9L6Ie1dC.js → client-factory-By1f68U_.js} +1 -1
- package/dist/{command-formatters-BRW7_Nu7.js → command-formatters-BpPOTePl.js} +2 -1
- package/dist/{command-handlers-DcoFMn4e.js → command-handlers-CFFYwpt4.js} +78 -7
- package/dist/{compact-UKyG6Pw2.js → compact-BPnB6ZWJ.js} +6 -6
- package/dist/{computer-use-UJ3dxrXF.js → computer-use-BD8UmXB-.js} +2 -2
- package/dist/{config-B5pq6hEz.js → config-B5rU0vP3.js} +2 -0
- package/dist/harness.js +8 -8
- package/dist/index.js +54 -10
- package/dist/media-understanding-provider.js +3 -3
- package/dist/{models-C1zn2RN0.js → models-6ViLQ-HQ.js} +1 -1
- package/dist/{node-cli-sessions-C9rlYMPw.js → node-cli-sessions-douLgfcf.js} +5 -5
- package/dist/{plugin-activation-B49xb7pI.js → plugin-activation-Dtcfb3sk.js} +65 -6
- package/dist/provider.js +2 -2
- package/dist/{request-XPjLayGw.js → request-BLCZjckr.js} +3 -3
- package/dist/{run-attempt-DyLQRA61.js → run-attempt-nWX3d1pe.js} +357 -98
- package/dist/{session-binding-DqApZIgD.js → session-binding-D9ejASYj.js} +1 -1
- package/dist/{shared-client-DlvmoLBJ.js → shared-client-DWgKldR5.js} +2 -2
- package/dist/{side-question-CfRPUq5X.js → side-question-CpJYlXni.js} +48 -16
- package/dist/test-api.js +3 -3
- package/dist/{thread-lifecycle-5SBrtWFl.js → thread-lifecycle-D8uxjJA4.js} +126 -51
- package/dist/{vision-tools-BX9YuTEK.js → vision-tools-CDoJ4rDN.js} +61 -7
- package/openclaw.plugin.json +9 -0
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as resolveCodexAppServerRuntimeOptions } from "./config-
|
|
1
|
+
import { c as resolveCodexAppServerRuntimeOptions } from "./config-B5rU0vP3.js";
|
|
2
2
|
import { n as isRpcResponse } from "./protocol-C9UWI98H.js";
|
|
3
3
|
import { createInterface } from "node:readline";
|
|
4
4
|
import { OPENCLAW_VERSION, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region extensions/codex/src/app-server/client-factory.ts
|
|
2
|
-
const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => import("./shared-client-
|
|
2
|
+
const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => import("./shared-client-DWgKldR5.js").then((n) => n.a).then(({ getSharedCodexAppServerClient }) => getSharedCodexAppServerClient({
|
|
3
3
|
startOptions,
|
|
4
4
|
authProfileId,
|
|
5
5
|
agentDir,
|
|
@@ -448,7 +448,8 @@ function buildHelp() {
|
|
|
448
448
|
"- /codex computer-use [status|install]",
|
|
449
449
|
"- /codex account",
|
|
450
450
|
"- /codex mcp",
|
|
451
|
-
"- /codex skills"
|
|
451
|
+
"- /codex skills",
|
|
452
|
+
"- /codex plugins [list|enable|disable]"
|
|
452
453
|
].join("\n");
|
|
453
454
|
}
|
|
454
455
|
function summarizeAccount(value) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { a as isCodexFastServiceTier, c as resolveCodexAppServerRuntimeOptions } from "./config-
|
|
2
|
-
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-
|
|
1
|
+
import { a as isCodexFastServiceTier, c as resolveCodexAppServerRuntimeOptions } from "./config-B5rU0vP3.js";
|
|
2
|
+
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-6ViLQ-HQ.js";
|
|
3
3
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
4
|
-
import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-
|
|
5
|
-
import { a as formatComputerUseStatus, c as formatThreads, i as formatCodexStatus, l as readString$1, n as formatAccount, o as formatList, p as summarizeCodexAccountUsage, r as formatCodexDisplayText, s as formatModels, t as buildHelp } from "./command-formatters-
|
|
6
|
-
import { i as readCodexAppServerBinding, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
7
|
-
import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, l as startCodexConversationThread, m as setCodexConversationFastMode, p as readCodexConversationActiveTurn, r as formatCodexCliSessions, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./node-cli-sessions-
|
|
8
|
-
import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-
|
|
4
|
+
import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-BLCZjckr.js";
|
|
5
|
+
import { a as formatComputerUseStatus, c as formatThreads, i as formatCodexStatus, l as readString$1, n as formatAccount, o as formatList, p as summarizeCodexAccountUsage, r as formatCodexDisplayText, s as formatModels, t as buildHelp } from "./command-formatters-BpPOTePl.js";
|
|
6
|
+
import { i as readCodexAppServerBinding, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-D9ejASYj.js";
|
|
7
|
+
import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, l as startCodexConversationThread, m as setCodexConversationFastMode, p as readCodexConversationActiveTurn, r as formatCodexCliSessions, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./node-cli-sessions-douLgfcf.js";
|
|
8
|
+
import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-BD8UmXB-.js";
|
|
9
9
|
import { n as rememberCodexRateLimits } from "./rate-limit-cache-dvhq-4pi.js";
|
|
10
10
|
import crypto from "node:crypto";
|
|
11
11
|
import { ensureAuthProfileStore, findNormalizedProviderValue, resolveAgentDir, resolveAuthProfileEligibility, resolveAuthProfileOrder, resolveDefaultAgentDir, resolveProfileUnusableUntilForDisplay, resolveSessionAgentIds } from "openclaw/plugin-sdk/agent-runtime";
|
|
@@ -289,6 +289,73 @@ function dedupe(values) {
|
|
|
289
289
|
return result;
|
|
290
290
|
}
|
|
291
291
|
//#endregion
|
|
292
|
+
//#region extensions/codex/src/command-plugins-management.ts
|
|
293
|
+
const POLICY_REFRESH_HINT = "New Codex conversations pick this up automatically. Use /new or /reset to refresh the current one.";
|
|
294
|
+
async function handleCodexPluginsSubcommand(ctx, rest, io) {
|
|
295
|
+
const [verb = "list", ...args] = rest;
|
|
296
|
+
const normalized = verb.toLowerCase();
|
|
297
|
+
if (normalized === "list") {
|
|
298
|
+
if (args.length > 0) return { text: "Usage: /codex plugins list" };
|
|
299
|
+
const current = await io.readConfig();
|
|
300
|
+
return { text: formatPluginList(current.plugins ?? {}, { globalEnabled: current.enabled === true }) };
|
|
301
|
+
}
|
|
302
|
+
const target = args[0];
|
|
303
|
+
if (normalized === "enable" || normalized === "disable") {
|
|
304
|
+
if (!target || args.length > 1) return { text: `Usage: /codex plugins ${normalized} <name>` };
|
|
305
|
+
if (!canMutateCodexPlugins(ctx)) return { text: `Only an owner or operator.admin gateway client can run /codex plugins ${normalized}.` };
|
|
306
|
+
const wantEnabled = normalized === "enable";
|
|
307
|
+
if (!((await io.readConfig()).plugins ?? {})[target]) return { text: `Codex sub-plugin '${formatCodexDisplayText(target)}' is not configured. Run '/codex plugins list' to see configured plugins.` };
|
|
308
|
+
await io.mutate((block) => {
|
|
309
|
+
if (wantEnabled) block.enabled = true;
|
|
310
|
+
block.plugins ??= {};
|
|
311
|
+
block.plugins[target] = {
|
|
312
|
+
...block.plugins[target],
|
|
313
|
+
enabled: wantEnabled
|
|
314
|
+
};
|
|
315
|
+
});
|
|
316
|
+
return { text: `${formatCodexDisplayText(target)}: ${wantEnabled ? "enabled" : "disabled"} in openclaw.json. ${POLICY_REFRESH_HINT}` };
|
|
317
|
+
}
|
|
318
|
+
return { text: `Unknown /codex plugins subcommand: ${formatCodexDisplayText(verb)}\n\n${buildPluginsHelp()}` };
|
|
319
|
+
}
|
|
320
|
+
function canMutateCodexPlugins(ctx) {
|
|
321
|
+
if (ctx.senderIsOwner === true) return true;
|
|
322
|
+
return ctx.gatewayClientScopes?.includes("operator.admin") === true;
|
|
323
|
+
}
|
|
324
|
+
function buildPluginsHelp() {
|
|
325
|
+
return [
|
|
326
|
+
"Codex sub-plugin management (writes only to ~/.openclaw/openclaw.json, never to ~/.codex/config.toml):",
|
|
327
|
+
"- /codex plugins (alias for list)",
|
|
328
|
+
"- /codex plugins list show all configured Codex sub-plugins",
|
|
329
|
+
"- /codex plugins enable <name> enable a configured sub-plugin",
|
|
330
|
+
"- /codex plugins disable <name> disable a configured sub-plugin"
|
|
331
|
+
].join("\n");
|
|
332
|
+
}
|
|
333
|
+
function formatPluginList(plugins, options = {}) {
|
|
334
|
+
const globalEnabled = options.globalEnabled === true;
|
|
335
|
+
const keys = Object.keys(plugins).toSorted();
|
|
336
|
+
if (keys.length === 0) return "No Codex sub-plugins configured under plugins.entries.codex.config.codexPlugins.plugins";
|
|
337
|
+
const rows = keys.map((key) => {
|
|
338
|
+
const entry = plugins[key] ?? {};
|
|
339
|
+
const state = globalEnabled && entry.enabled !== false ? "ON " : "OFF";
|
|
340
|
+
return {
|
|
341
|
+
displayKey: formatCodexDisplayText(key),
|
|
342
|
+
state,
|
|
343
|
+
pluginName: formatCodexDisplayText(entry.pluginName ?? key),
|
|
344
|
+
marketplace: formatCodexDisplayText(entry.marketplaceName ?? "?")
|
|
345
|
+
};
|
|
346
|
+
});
|
|
347
|
+
const keyW = Math.max(...rows.map((r) => r.displayKey.length));
|
|
348
|
+
const pluginW = Math.max(...rows.map((r) => r.pluginName.length));
|
|
349
|
+
return [
|
|
350
|
+
"Codex sub-plugins in Openclaw config (~/.openclaw/openclaw.json):",
|
|
351
|
+
"",
|
|
352
|
+
...rows.map((r) => ` ${r.state} ${r.displayKey.padEnd(keyW)} ${r.pluginName.padEnd(pluginW)} [${r.marketplace}]`),
|
|
353
|
+
"",
|
|
354
|
+
...globalEnabled ? [] : ["Global codexPlugins.enabled is off; configured sub-plugins are inactive.", ""],
|
|
355
|
+
"New Codex conversations pick up policy changes automatically; /new or /reset to refresh the current one."
|
|
356
|
+
].join("\n");
|
|
357
|
+
}
|
|
358
|
+
//#endregion
|
|
292
359
|
//#region extensions/codex/src/command-rpc.ts
|
|
293
360
|
function requestOptions(pluginConfig, limit, config) {
|
|
294
361
|
const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig });
|
|
@@ -398,6 +465,10 @@ async function handleCodexSubcommand(ctx, options) {
|
|
|
398
465
|
const [subcommand = "status", ...rest] = splitArgs(ctx.args);
|
|
399
466
|
const normalized = subcommand.toLowerCase();
|
|
400
467
|
if (normalized === "help") return { text: buildHelp() };
|
|
468
|
+
if (normalized === "plugins") {
|
|
469
|
+
if (!deps.codexPluginsManagementIo) return { text: "Codex sub-plugin management is not wired up (codexPluginsManagementIo dep is undefined). Edit ~/.openclaw/openclaw.json or use `openclaw config patch` until the runtime exposes the IO." };
|
|
470
|
+
return await handleCodexPluginsSubcommand(ctx, rest, deps.codexPluginsManagementIo);
|
|
471
|
+
}
|
|
401
472
|
if (normalized === "status") {
|
|
402
473
|
if (rest.length > 0) return { text: "Usage: /codex status" };
|
|
403
474
|
return { text: formatCodexStatus(await deps.readCodexStatusProbes(options.pluginConfig, ctx.config)) };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as resolveCodexAppServerRuntimeOptions } from "./config-
|
|
1
|
+
import { c as resolveCodexAppServerRuntimeOptions } from "./config-B5rU0vP3.js";
|
|
2
2
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
3
|
-
import { i as readCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
4
|
-
import { t as defaultCodexAppServerClientFactory } from "./client-factory-
|
|
5
|
-
import { embeddedAgentLog, formatErrorMessage, isActiveHarnessContextEngine, resolveContextEngineOwnerPluginId, runHarnessContextEngineMaintenance } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
3
|
+
import { i as readCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-D9ejASYj.js";
|
|
4
|
+
import { t as defaultCodexAppServerClientFactory } from "./client-factory-By1f68U_.js";
|
|
5
|
+
import { compactContextEngineWithSafetyTimeout, embeddedAgentLog, formatErrorMessage, isActiveHarnessContextEngine, resolveCompactionTimeoutMs, resolveContextEngineOwnerPluginId, runHarnessContextEngineMaintenance } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
6
6
|
//#region extensions/codex/src/app-server/compact.ts
|
|
7
7
|
const DEFAULT_CODEX_COMPACTION_WAIT_TIMEOUT_MS = 300 * 1e3;
|
|
8
8
|
const warnedIgnoredCompactionOverrides = /* @__PURE__ */ new Set();
|
|
@@ -43,7 +43,7 @@ async function compactOwningContextEngine(params, contextEngine) {
|
|
|
43
43
|
});
|
|
44
44
|
let result;
|
|
45
45
|
try {
|
|
46
|
-
result = await contextEngine
|
|
46
|
+
result = await compactContextEngineWithSafetyTimeout(contextEngine, {
|
|
47
47
|
sessionId: params.sessionId,
|
|
48
48
|
sessionKey: params.sessionKey,
|
|
49
49
|
sessionFile: params.sessionFile,
|
|
@@ -53,7 +53,7 @@ async function compactOwningContextEngine(params, contextEngine) {
|
|
|
53
53
|
customInstructions: params.customInstructions,
|
|
54
54
|
force: params.trigger === "manual",
|
|
55
55
|
runtimeContext: params.contextEngineRuntimeContext
|
|
56
|
-
});
|
|
56
|
+
}, resolveCompactionTimeoutMs(params.config), params.abortSignal);
|
|
57
57
|
} catch (error) {
|
|
58
58
|
embeddedAgentLog.warn("context-engine-owned Codex app-server compaction failed", {
|
|
59
59
|
sessionId: params.sessionId,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as resolveCodexAppServerRuntimeOptions, l as resolveCodexComputerUseConfig } from "./config-
|
|
2
|
-
import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-
|
|
1
|
+
import { c as resolveCodexAppServerRuntimeOptions, l as resolveCodexComputerUseConfig } from "./config-B5rU0vP3.js";
|
|
2
|
+
import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-BLCZjckr.js";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
//#region extensions/codex/src/app-server/computer-use.ts
|
|
5
5
|
var CodexComputerUseSetupError = class extends Error {
|
|
@@ -69,6 +69,7 @@ const codexPluginConfigSchema = z.object({
|
|
|
69
69
|
authToken: z.string().optional(),
|
|
70
70
|
headers: z.record(z.string(), z.string()).optional(),
|
|
71
71
|
clearEnv: z.array(z.string()).optional(),
|
|
72
|
+
codeModeOnly: z.boolean().optional(),
|
|
72
73
|
requestTimeoutMs: z.number().positive().optional(),
|
|
73
74
|
turnCompletionIdleTimeoutMs: z.number().positive().optional(),
|
|
74
75
|
approvalPolicy: codexAppServerApprovalPolicySchema.optional(),
|
|
@@ -151,6 +152,7 @@ function resolveCodexAppServerRuntimeOptions(params = {}) {
|
|
|
151
152
|
headers,
|
|
152
153
|
...transport === "stdio" && clearEnv.length > 0 ? { clearEnv } : {}
|
|
153
154
|
},
|
|
155
|
+
codeModeOnly: config.codeModeOnly === true,
|
|
154
156
|
requestTimeoutMs: normalizePositiveNumber(config.requestTimeoutMs, 6e4),
|
|
155
157
|
turnCompletionIdleTimeoutMs: normalizePositiveNumber(config.turnCompletionIdleTimeoutMs, 6e4),
|
|
156
158
|
approvalPolicy: resolveApprovalPolicy(config.approvalPolicy) ?? resolveApprovalPolicy(env.OPENCLAW_CODEX_APP_SERVER_APPROVAL_POLICY) ?? defaultPolicy?.approvalPolicy ?? (policyMode === "guardian" ? "on-request" : "never"),
|
package/dist/harness.js
CHANGED
|
@@ -18,31 +18,31 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
18
18
|
};
|
|
19
19
|
},
|
|
20
20
|
runAttempt: async (params) => {
|
|
21
|
-
const { runCodexAppServerAttempt } = await import("./run-attempt-
|
|
21
|
+
const { runCodexAppServerAttempt } = await import("./run-attempt-nWX3d1pe.js");
|
|
22
22
|
return runCodexAppServerAttempt(params, {
|
|
23
|
-
pluginConfig: options?.pluginConfig,
|
|
23
|
+
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
24
24
|
nativeHookRelay: { enabled: true }
|
|
25
25
|
});
|
|
26
26
|
},
|
|
27
27
|
runSideQuestion: async (params) => {
|
|
28
|
-
const { runCodexAppServerSideQuestion } = await import("./side-question-
|
|
28
|
+
const { runCodexAppServerSideQuestion } = await import("./side-question-CpJYlXni.js");
|
|
29
29
|
return runCodexAppServerSideQuestion(params, {
|
|
30
|
-
pluginConfig: options?.pluginConfig,
|
|
30
|
+
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
31
31
|
nativeHookRelay: { enabled: true }
|
|
32
32
|
});
|
|
33
33
|
},
|
|
34
34
|
compact: async (params) => {
|
|
35
|
-
const { maybeCompactCodexAppServerSession } = await import("./compact-
|
|
36
|
-
return maybeCompactCodexAppServerSession(params, { pluginConfig: options?.pluginConfig });
|
|
35
|
+
const { maybeCompactCodexAppServerSession } = await import("./compact-BPnB6ZWJ.js");
|
|
36
|
+
return maybeCompactCodexAppServerSession(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
37
37
|
},
|
|
38
38
|
reset: async (params) => {
|
|
39
39
|
if (params.sessionFile) {
|
|
40
|
-
const { clearCodexAppServerBinding } = await import("./session-binding-
|
|
40
|
+
const { clearCodexAppServerBinding } = await import("./session-binding-D9ejASYj.js").then((n) => n.a);
|
|
41
41
|
await clearCodexAppServerBinding(params.sessionFile);
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
dispose: async () => {
|
|
45
|
-
const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-
|
|
45
|
+
const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-DWgKldR5.js").then((n) => n.a);
|
|
46
46
|
await clearSharedCodexAppServerClientAndWait();
|
|
47
47
|
}
|
|
48
48
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { createCodexAppServerAgentHarness } from "./harness.js";
|
|
2
|
-
import { c as resolveCodexAppServerRuntimeOptions, s as readCodexPluginConfig, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config-
|
|
2
|
+
import { c as resolveCodexAppServerRuntimeOptions, s as readCodexPluginConfig, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config-B5rU0vP3.js";
|
|
3
3
|
import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
4
4
|
import { buildCodexProvider } from "./provider.js";
|
|
5
|
-
import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-
|
|
6
|
-
import { r as formatCodexDisplayText } from "./command-formatters-
|
|
7
|
-
import { c as resolveCodexAppServerAuthAccountCacheKey, d as resolveCodexAppServerEnvApiKeyCacheKey, i as getSharedCodexAppServerClient, n as clearSharedCodexAppServerClientIfCurrentAndWait, u as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-
|
|
8
|
-
import { a as resolveCodexCliSessionForBindingOnNode, c as handleCodexConversationInboundClaim, i as listCodexCliSessionsOnNode, n as createCodexCliSessionNodeInvokePolicies, o as resumeCodexCliSessionOnNode, s as handleCodexConversationBindingResolved, t as createCodexCliSessionNodeHostCommands } from "./node-cli-sessions-
|
|
9
|
-
import { a as defaultCodexAppInventoryCache, n as pluginReadParams, t as ensureCodexPluginActivation } from "./plugin-activation-
|
|
5
|
+
import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-BLCZjckr.js";
|
|
6
|
+
import { r as formatCodexDisplayText } from "./command-formatters-BpPOTePl.js";
|
|
7
|
+
import { c as resolveCodexAppServerAuthAccountCacheKey, d as resolveCodexAppServerEnvApiKeyCacheKey, i as getSharedCodexAppServerClient, n as clearSharedCodexAppServerClientIfCurrentAndWait, u as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-DWgKldR5.js";
|
|
8
|
+
import { a as resolveCodexCliSessionForBindingOnNode, c as handleCodexConversationInboundClaim, i as listCodexCliSessionsOnNode, n as createCodexCliSessionNodeInvokePolicies, o as resumeCodexCliSessionOnNode, s as handleCodexConversationBindingResolved, t as createCodexCliSessionNodeHostCommands } from "./node-cli-sessions-douLgfcf.js";
|
|
9
|
+
import { a as defaultCodexAppInventoryCache, n as pluginReadParams, t as ensureCodexPluginActivation } from "./plugin-activation-Dtcfb3sk.js";
|
|
10
|
+
import { mutateConfigFile } from "openclaw/plugin-sdk/config-mutation";
|
|
10
11
|
import { resolveLivePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
11
12
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
12
13
|
import os from "node:os";
|
|
@@ -23,7 +24,13 @@ function createCodexCommand(options) {
|
|
|
23
24
|
name: "codex",
|
|
24
25
|
description: "Inspect and control the Codex app-server harness",
|
|
25
26
|
ownership: "reserved",
|
|
26
|
-
agentPromptGuidance: [
|
|
27
|
+
agentPromptGuidance: [{
|
|
28
|
+
text: "Native Codex app-server plugin is available (`/codex ...`). For Codex bind/control/thread/resume/steer/stop requests, prefer `/codex bind`, `/codex threads`, `/codex resume`, `/codex steer`, and `/codex stop` over ACP.",
|
|
29
|
+
surfaces: ["pi_main"]
|
|
30
|
+
}, {
|
|
31
|
+
text: "Use ACP for Codex only when the user explicitly asks for ACP/acpx or wants to test the ACP path.",
|
|
32
|
+
surfaces: ["pi_main"]
|
|
33
|
+
}],
|
|
27
34
|
acceptsArgs: true,
|
|
28
35
|
requireAuth: true,
|
|
29
36
|
handler: (ctx) => handleCodexCommand(ctx, options)
|
|
@@ -38,7 +45,7 @@ async function handleCodexCommand(ctx, options = {}) {
|
|
|
38
45
|
}
|
|
39
46
|
}
|
|
40
47
|
async function loadDefaultCodexSubcommandHandler() {
|
|
41
|
-
const { handleCodexSubcommand } = await import("./command-handlers-
|
|
48
|
+
const { handleCodexSubcommand } = await import("./command-handlers-CFFYwpt4.js");
|
|
42
49
|
return handleCodexSubcommand;
|
|
43
50
|
}
|
|
44
51
|
//#endregion
|
|
@@ -1094,7 +1101,7 @@ var codex_default = definePluginEntry({
|
|
|
1094
1101
|
description: "Codex app-server harness and Codex-managed GPT model catalog.",
|
|
1095
1102
|
register(api) {
|
|
1096
1103
|
const resolveCurrentPluginConfig = () => resolveLivePluginConfigObject(api.runtime.config?.current ? () => api.runtime.config.current() : void 0, "codex", api.pluginConfig) ?? api.pluginConfig;
|
|
1097
|
-
api.registerAgentHarness(createCodexAppServerAgentHarness({
|
|
1104
|
+
api.registerAgentHarness(createCodexAppServerAgentHarness({ resolvePluginConfig: resolveCurrentPluginConfig }));
|
|
1098
1105
|
api.registerProvider(buildCodexProvider({ pluginConfig: api.pluginConfig }));
|
|
1099
1106
|
api.registerMediaUnderstandingProvider(buildCodexMediaUnderstandingProvider({ pluginConfig: api.pluginConfig }));
|
|
1100
1107
|
api.registerMigrationProvider(buildCodexMigrationProvider({ runtime: api.runtime }));
|
|
@@ -1110,7 +1117,44 @@ var codex_default = definePluginEntry({
|
|
|
1110
1117
|
resolveCodexCliSessionForBindingOnNode: (params) => resolveCodexCliSessionForBindingOnNode({
|
|
1111
1118
|
runtime: api.runtime,
|
|
1112
1119
|
...params
|
|
1113
|
-
})
|
|
1120
|
+
}),
|
|
1121
|
+
codexPluginsManagementIo: {
|
|
1122
|
+
readConfig: () => {
|
|
1123
|
+
const plugins = (api.runtime.config?.current?.() ?? {}).plugins;
|
|
1124
|
+
if (!plugins || typeof plugins !== "object") return Promise.resolve({});
|
|
1125
|
+
const entries = plugins.entries;
|
|
1126
|
+
if (!entries || typeof entries !== "object") return Promise.resolve({});
|
|
1127
|
+
const codexEntry = entries.codex;
|
|
1128
|
+
if (!codexEntry || typeof codexEntry !== "object") return Promise.resolve({});
|
|
1129
|
+
const config = codexEntry.config;
|
|
1130
|
+
if (!config || typeof config !== "object") return Promise.resolve({});
|
|
1131
|
+
const codexPlugins = config.codexPlugins;
|
|
1132
|
+
if (!codexPlugins || typeof codexPlugins !== "object") return Promise.resolve({});
|
|
1133
|
+
const declared = codexPlugins.plugins;
|
|
1134
|
+
if (!declared || typeof declared !== "object") return Promise.resolve({ enabled: codexPlugins.enabled === true });
|
|
1135
|
+
return Promise.resolve({
|
|
1136
|
+
enabled: codexPlugins.enabled === true,
|
|
1137
|
+
plugins: declared
|
|
1138
|
+
});
|
|
1139
|
+
},
|
|
1140
|
+
mutate: async (update) => {
|
|
1141
|
+
await mutateConfigFile({ mutate: (draft) => {
|
|
1142
|
+
const root = draft;
|
|
1143
|
+
root.plugins = root.plugins ?? {};
|
|
1144
|
+
const pluginsBlock = root.plugins;
|
|
1145
|
+
pluginsBlock.entries = pluginsBlock.entries ?? {};
|
|
1146
|
+
const entries = pluginsBlock.entries;
|
|
1147
|
+
entries.codex = entries.codex ?? {};
|
|
1148
|
+
const codexEntry = entries.codex;
|
|
1149
|
+
codexEntry.config = codexEntry.config ?? {};
|
|
1150
|
+
const config = codexEntry.config;
|
|
1151
|
+
config.codexPlugins = config.codexPlugins ?? {};
|
|
1152
|
+
const codexPlugins = config.codexPlugins;
|
|
1153
|
+
codexPlugins.plugins = codexPlugins.plugins ?? {};
|
|
1154
|
+
update(codexPlugins);
|
|
1155
|
+
} });
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1114
1158
|
}
|
|
1115
1159
|
}));
|
|
1116
1160
|
api.on("inbound_claim", (event, ctx) => handleCodexConversationInboundClaim(event, ctx, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CODEX_PROVIDER_ID, FALLBACK_CODEX_MODELS } from "./provider-catalog.js";
|
|
2
|
-
import { c as resolveCodexAppServerRuntimeOptions } from "./config-
|
|
2
|
+
import { c as resolveCodexAppServerRuntimeOptions } from "./config-B5rU0vP3.js";
|
|
3
3
|
import { i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, o as readCodexErrorNotification, r as assertCodexThreadStartResponse } from "./protocol-validators-BGBspNmF.js";
|
|
4
|
-
import { i as readModelListResult } from "./models-
|
|
4
|
+
import { i as readModelListResult } from "./models-6ViLQ-HQ.js";
|
|
5
5
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
6
6
|
import { validateJsonSchemaValue } from "openclaw/plugin-sdk/json-schema-runtime";
|
|
7
7
|
//#region extensions/codex/media-understanding-provider.ts
|
|
@@ -62,7 +62,7 @@ async function runBoundedCodexVisionTurn(params) {
|
|
|
62
62
|
const appServer = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.options.pluginConfig });
|
|
63
63
|
const timeoutMs = Math.max(100, params.timeoutMs);
|
|
64
64
|
const ownsClient = !params.options.clientFactory;
|
|
65
|
-
const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile) : await import("./shared-client-
|
|
65
|
+
const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile) : await import("./shared-client-DWgKldR5.js").then((n) => n.a).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
|
|
66
66
|
startOptions: appServer.start,
|
|
67
67
|
timeoutMs,
|
|
68
68
|
authProfileId: params.profile
|
|
@@ -39,7 +39,7 @@ async function listAllCodexAppServerModels(options = {}) {
|
|
|
39
39
|
async function withCodexAppServerModelClient(options, run) {
|
|
40
40
|
const timeoutMs = options.timeoutMs ?? 2500;
|
|
41
41
|
const useSharedClient = options.sharedClient !== false;
|
|
42
|
-
const { createIsolatedCodexAppServerClient, getSharedCodexAppServerClient } = await import("./shared-client-
|
|
42
|
+
const { createIsolatedCodexAppServerClient, getSharedCodexAppServerClient } = await import("./shared-client-DWgKldR5.js").then((n) => n.a);
|
|
43
43
|
const client = useSharedClient ? await getSharedCodexAppServerClient({
|
|
44
44
|
startOptions: options.startOptions,
|
|
45
45
|
timeoutMs,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as isCodexFastServiceTier, c as resolveCodexAppServerRuntimeOptions, r as codexSandboxPolicyForTurn } from "./config-
|
|
1
|
+
import { a as isCodexFastServiceTier, c as resolveCodexAppServerRuntimeOptions, r as codexSandboxPolicyForTurn } from "./config-B5rU0vP3.js";
|
|
2
2
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
3
|
-
import { r as CODEX_CONTROL_METHODS } from "./request-
|
|
4
|
-
import { r as formatCodexDisplayText } from "./command-formatters-
|
|
5
|
-
import { i as getSharedCodexAppServerClient, u as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-
|
|
6
|
-
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, r as normalizeCodexAppServerBindingModelProvider, t as clearCodexAppServerBinding } from "./session-binding-
|
|
3
|
+
import { r as CODEX_CONTROL_METHODS } from "./request-BLCZjckr.js";
|
|
4
|
+
import { r as formatCodexDisplayText } from "./command-formatters-BpPOTePl.js";
|
|
5
|
+
import { i as getSharedCodexAppServerClient, u as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-DWgKldR5.js";
|
|
6
|
+
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, r as normalizeCodexAppServerBindingModelProvider, t as clearCodexAppServerBinding } from "./session-binding-D9ejASYj.js";
|
|
7
7
|
import os from "node:os";
|
|
8
8
|
import { formatErrorMessage } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
9
9
|
import { spawn } from "node:child_process";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { t as CODEX_PLUGINS_MARKETPLACE_NAME, u as resolveCodexPluginsPolicy } from "./config-
|
|
1
|
+
import { t as CODEX_PLUGINS_MARKETPLACE_NAME, u as resolveCodexPluginsPolicy } from "./config-B5rU0vP3.js";
|
|
2
|
+
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
2
3
|
import "node:fs/promises";
|
|
3
4
|
import "node:path";
|
|
5
|
+
const MAX_SERIALIZED_ERROR_MESSAGE_LENGTH = 500;
|
|
4
6
|
var CodexAppInventoryCache = class {
|
|
5
7
|
constructor(options = {}) {
|
|
6
8
|
this.entries = /* @__PURE__ */ new Map();
|
|
@@ -14,7 +16,7 @@ var CodexAppInventoryCache = class {
|
|
|
14
16
|
const nowMs = params.nowMs ?? Date.now();
|
|
15
17
|
const entry = this.entries.get(params.key);
|
|
16
18
|
if (!entry) {
|
|
17
|
-
const refreshScheduled = this.scheduleRefresh(params);
|
|
19
|
+
const refreshScheduled = params.suppressRefresh ? false : this.scheduleRefresh(params);
|
|
18
20
|
return {
|
|
19
21
|
state: "missing",
|
|
20
22
|
key: params.key,
|
|
@@ -103,16 +105,31 @@ var CodexAppInventoryCache = class {
|
|
|
103
105
|
return snapshot;
|
|
104
106
|
} catch (error) {
|
|
105
107
|
const diagnostic = {
|
|
106
|
-
message: error instanceof Error ? error.message : String(error),
|
|
108
|
+
message: sanitizeErrorMessage(error instanceof Error ? error.message : String(error)),
|
|
107
109
|
atMs: nowMs
|
|
108
110
|
};
|
|
109
111
|
this.diagnostics.set(params.key, diagnostic);
|
|
110
112
|
const entry = this.entries.get(params.key);
|
|
111
113
|
if (entry) entry.lastError = diagnostic;
|
|
114
|
+
embeddedAgentLog.warn("codex app inventory refresh failed", {
|
|
115
|
+
forceRefetch: params.forceRefetch === true,
|
|
116
|
+
keyFingerprint: fingerprintInventoryCacheKey(params.key),
|
|
117
|
+
error: serializeCodexAppInventoryError(error)
|
|
118
|
+
});
|
|
112
119
|
throw error;
|
|
113
120
|
}
|
|
114
121
|
}
|
|
115
122
|
};
|
|
123
|
+
function serializeCodexAppInventoryError(error) {
|
|
124
|
+
const record = isRecord(error) ? error : void 0;
|
|
125
|
+
const data = record && "data" in record ? redactErrorData(record.data) : void 0;
|
|
126
|
+
return {
|
|
127
|
+
name: error instanceof Error ? error.name : typeof record?.name === "string" ? record.name : void 0,
|
|
128
|
+
message: sanitizeErrorMessage(error instanceof Error ? error.message : String(error)),
|
|
129
|
+
...typeof record?.code === "number" ? { code: record.code } : {},
|
|
130
|
+
...data !== void 0 ? { data } : {}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
116
133
|
const defaultCodexAppInventoryCache = new CodexAppInventoryCache();
|
|
117
134
|
function buildCodexAppInventoryCacheKey(input) {
|
|
118
135
|
return JSON.stringify({
|
|
@@ -142,6 +159,39 @@ function stripEntryState(entry) {
|
|
|
142
159
|
const { invalidated: _invalidated, ...snapshot } = entry;
|
|
143
160
|
return snapshot;
|
|
144
161
|
}
|
|
162
|
+
function fingerprintInventoryCacheKey(key) {
|
|
163
|
+
let hash = 0;
|
|
164
|
+
for (let index = 0; index < key.length; index += 1) hash = hash * 31 + key.charCodeAt(index) >>> 0;
|
|
165
|
+
return hash.toString(16).padStart(8, "0");
|
|
166
|
+
}
|
|
167
|
+
function isRecord(value) {
|
|
168
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
169
|
+
}
|
|
170
|
+
function redactErrorData(value, depth = 0) {
|
|
171
|
+
if (value === void 0) return;
|
|
172
|
+
if (value === null || typeof value === "boolean" || typeof value === "number") return value;
|
|
173
|
+
if (depth > 6) return "[truncated]";
|
|
174
|
+
if (Array.isArray(value)) return value.map((entry) => redactErrorData(entry, depth + 1) ?? null);
|
|
175
|
+
if (isRecord(value)) {
|
|
176
|
+
const redacted = {};
|
|
177
|
+
for (const [key, entry] of Object.entries(value)) redacted[key] = isSensitiveErrorDataKey(key) ? "<redacted>" : redactErrorData(entry, depth + 1) ?? null;
|
|
178
|
+
return redacted;
|
|
179
|
+
}
|
|
180
|
+
if (typeof value === "string" && value.length > 500) return `${value.slice(0, 500)}...`;
|
|
181
|
+
if (typeof value === "string") return value;
|
|
182
|
+
if (typeof value === "bigint") return value.toString();
|
|
183
|
+
if (typeof value === "symbol") return value.description ? `Symbol(${value.description})` : "Symbol()";
|
|
184
|
+
if (typeof value === "function") return value.name ? `[function ${value.name}]` : "[function]";
|
|
185
|
+
return "[unserializable]";
|
|
186
|
+
}
|
|
187
|
+
function sanitizeErrorMessage(message) {
|
|
188
|
+
const htmlStart = message.search(/<html[\s>]/i);
|
|
189
|
+
const redacted = (htmlStart >= 0 ? `${message.slice(0, htmlStart).trimEnd()} [HTML response body omitted]` : message).replace(/([?&][^=\s"'<>]*(?:api[_-]?key|authorization|cookie|credential|password|secret|token|tk)[^=\s"'<>]*=)[^&\s"'<>]+/gi, "$1<redacted>");
|
|
190
|
+
return redacted.length > MAX_SERIALIZED_ERROR_MESSAGE_LENGTH ? `${redacted.slice(0, MAX_SERIALIZED_ERROR_MESSAGE_LENGTH)}...` : redacted;
|
|
191
|
+
}
|
|
192
|
+
function isSensitiveErrorDataKey(key) {
|
|
193
|
+
return /api[_-]?key|authorization|cookie|credential|password|secret|token/i.test(key);
|
|
194
|
+
}
|
|
145
195
|
//#endregion
|
|
146
196
|
//#region extensions/codex/src/app-server/plugin-inventory.ts
|
|
147
197
|
async function readCodexPluginInventory(params) {
|
|
@@ -206,6 +256,7 @@ async function readCodexPluginInventory(params) {
|
|
|
206
256
|
message: `${pluginPolicy.pluginName} is installed in Codex but disabled.`
|
|
207
257
|
});
|
|
208
258
|
const apps = resolveOwnedApps({
|
|
259
|
+
pluginPolicy,
|
|
209
260
|
detail,
|
|
210
261
|
appInventory
|
|
211
262
|
});
|
|
@@ -250,7 +301,8 @@ function readCachedAppInventory(params) {
|
|
|
250
301
|
return params.appCache.read({
|
|
251
302
|
key: params.appCacheKey,
|
|
252
303
|
request,
|
|
253
|
-
nowMs: params.nowMs
|
|
304
|
+
nowMs: params.nowMs,
|
|
305
|
+
suppressRefresh: params.suppressAppInventoryRefresh
|
|
254
306
|
});
|
|
255
307
|
}
|
|
256
308
|
async function readPluginDetail(params, marketplace, pluginPolicy, diagnostics) {
|
|
@@ -273,7 +325,14 @@ function resolveAppOwnership(params) {
|
|
|
273
325
|
function resolveOwnedApps(params) {
|
|
274
326
|
const detailApps = params.detail?.apps ?? [];
|
|
275
327
|
if (detailApps.length === 0) return [];
|
|
276
|
-
if (params.appInventory?.state === "missing")
|
|
328
|
+
if (params.appInventory?.state === "missing") {
|
|
329
|
+
embeddedAgentLog.warn("codex plugin inventory missing app inventory for detail apps", {
|
|
330
|
+
configKey: params.pluginPolicy.configKey,
|
|
331
|
+
pluginName: params.pluginPolicy.pluginName,
|
|
332
|
+
appIds: detailApps.map((app) => app.id).toSorted()
|
|
333
|
+
});
|
|
334
|
+
return [];
|
|
335
|
+
}
|
|
277
336
|
const appInfoById = new Map((params.appInventory?.snapshot?.apps ?? []).map((app) => [app.id, app]));
|
|
278
337
|
return detailApps.map((app) => {
|
|
279
338
|
const info = appInfoById.get(app.id);
|
|
@@ -390,4 +449,4 @@ function activationFailure(identity, reason, diagnostic) {
|
|
|
390
449
|
};
|
|
391
450
|
}
|
|
392
451
|
//#endregion
|
|
393
|
-
export { defaultCodexAppInventoryCache as a, buildCodexAppInventoryCacheKey as i, pluginReadParams as n, readCodexPluginInventory as r, ensureCodexPluginActivation as t };
|
|
452
|
+
export { defaultCodexAppInventoryCache as a, buildCodexAppInventoryCacheKey as i, pluginReadParams as n, serializeCodexAppInventoryError as o, readCodexPluginInventory as r, ensureCodexPluginActivation as t };
|
package/dist/provider.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CODEX_APP_SERVER_AUTH_MARKER, CODEX_BASE_URL, CODEX_PROVIDER_ID, FALLBACK_CODEX_MODELS, buildCodexModelDefinition, buildCodexProviderConfig } from "./provider-catalog.js";
|
|
2
|
-
import { c as resolveCodexAppServerRuntimeOptions, s as readCodexPluginConfig } from "./config-
|
|
2
|
+
import { c as resolveCodexAppServerRuntimeOptions, s as readCodexPluginConfig } from "./config-B5rU0vP3.js";
|
|
3
3
|
import { resolveCodexSystemPromptContribution } from "./prompt-overlay.js";
|
|
4
4
|
import { resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
5
5
|
import { createSubsystemLogger } from "openclaw/plugin-sdk/core";
|
|
@@ -123,7 +123,7 @@ async function listModelsBestEffort(params) {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
async function listCodexAppServerModelsLazy(options) {
|
|
126
|
-
const { listCodexAppServerModels } = await import("./models-
|
|
126
|
+
const { listCodexAppServerModels } = await import("./models-6ViLQ-HQ.js").then((n) => n.r);
|
|
127
127
|
return listCodexAppServerModels(options);
|
|
128
128
|
}
|
|
129
129
|
function normalizeTimeoutMs(value) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as CodexAppServerRpcError } from "./client-
|
|
2
|
-
import { f as resolveCodexAppServerHomeDir, i as getSharedCodexAppServerClient, o as withTimeout, r as createIsolatedCodexAppServerClient } from "./shared-client-
|
|
3
|
-
import { i as buildCodexAppInventoryCacheKey } from "./plugin-activation-
|
|
1
|
+
import { n as CodexAppServerRpcError } from "./client-BCJaLwdZ.js";
|
|
2
|
+
import { f as resolveCodexAppServerHomeDir, i as getSharedCodexAppServerClient, o as withTimeout, r as createIsolatedCodexAppServerClient } from "./shared-client-DWgKldR5.js";
|
|
3
|
+
import { i as buildCodexAppInventoryCacheKey } from "./plugin-activation-Dtcfb3sk.js";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
//#region extensions/codex/src/app-server/capabilities.ts
|
|
6
6
|
const CODEX_CONTROL_METHODS = {
|