@openclaw/codex 2026.8.1-beta.2 → 2026.8.1-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/api.js +147 -0
  2. package/dist/app-server-policy-bg5QPSVP.js +25 -0
  3. package/dist/{attempt-client-cleanup-DMLXUfa8.js → attempt-client-cleanup-URjUlCHg.js} +1 -1
  4. package/dist/{binding-connection-I5Bo-AsX.js → binding-connection-DAvZwp96.js} +15 -3
  5. package/dist/{bounded-turn-qgZmzy_4.js → bounded-turn-4BjrZEwW.js} +22 -16
  6. package/dist/{capabilities-CybGI1oz.js → capabilities-CH3K57v4.js} +1 -1
  7. package/dist/cli-metadata.js +1 -1
  8. package/dist/{command-formatters-B1AEz8ZA.js → command-formatters-D0nZ3qtd.js} +2 -2
  9. package/dist/{command-handlers-Db8pu_ds.js → command-handlers-DC86lgT4.js} +39 -22
  10. package/dist/command-rpc-xUIIonsO.js +90 -0
  11. package/dist/{compact-LspQaGfl.js → compact-COqgBRny.js} +35 -29
  12. package/dist/{session-binding-DPxIvMgE.js → config-CpNeo5AE.js} +28 -888
  13. package/dist/context-compaction-activity-BOeJf7yo.js +58 -0
  14. package/dist/doctor-contract-api.js +15 -14
  15. package/dist/{dynamic-tools-BVdyWkUD.js → dynamic-tools-fJZhl4CE.js} +1284 -651
  16. package/dist/{effective-mcp-catalog-DIIhAtOZ.js → effective-mcp-catalog-4YKn51aG.js} +2 -2
  17. package/dist/elicitation-input-DMkeki8d.js +71 -0
  18. package/dist/{event-projector-usage-e5huIQWu.js → event-projector-usage-CLwNEJqW.js} +16 -16
  19. package/dist/harness-DoKQcF8n.js +258 -0
  20. package/dist/harness.js +2 -226
  21. package/dist/index.js +171 -48
  22. package/dist/{isolated-completion-C58NbL40.js → isolated-completion-DPMtlH9r.js} +3 -3
  23. package/dist/managed-binary-By4FZC6i.js +212 -0
  24. package/dist/media-understanding-provider.js +2 -2
  25. package/dist/model-catalog-CmGoqVKB.js +48 -0
  26. package/dist/{models-BFlpn1Ex.js → models-CZw1wClT.js} +2 -2
  27. package/dist/{native-subagent-monitor-DyTGmTUx.js → native-subagent-monitor-GGq3RnOo.js} +185 -71
  28. package/dist/node-exec-server.runtime-Bsu1LdFZ.js +192 -0
  29. package/dist/{plugin-app-cache-key-C3H2CVp6.js → plugin-app-cache-key-DMNQ8Zi8.js} +15 -3
  30. package/dist/plugin-approval-roundtrip-C75Yiiwc.js +95 -0
  31. package/dist/{plugin-marketplace-discovery-CzrGJdCR.js → plugin-marketplace-discovery-CSWDkMrP.js} +40 -26
  32. package/dist/{plugin-metadata-cache-CNJPj4_b.js → plugin-metadata-cache-BXH5NF-4.js} +8 -5
  33. package/dist/{protocol-validators-B4F7L8Rf.js → protocol-validators-VAVyEnDp.js} +55 -2
  34. package/dist/{rate-limits-DZXmOL8-.js → rate-limits-BI1dMHDG.js} +1 -1
  35. package/dist/{request-BRl5_UfX.js → request-DSK0W6YI.js} +2 -2
  36. package/dist/{run-attempt-P8BdxC1I.js → run-attempt-BV3HzuCf.js} +1098 -666
  37. package/dist/{runtime-artifact-BVSPdd6g.js → runtime-artifact-BvyT1uyd.js} +4 -7
  38. package/dist/{sandbox-guard-Cmwc9eIk.js → sandbox-guard-C1qEeZ5C.js} +25 -19
  39. package/dist/session-binding-BTrLf9Qm.js +874 -0
  40. package/dist/{session-catalog-xwNi_SDM.js → session-catalog-ezP_UcRM.js} +1541 -1296
  41. package/dist/session-catalog-home-id-BNwAJ9D7.js +18 -0
  42. package/dist/{session-cli-7hgXZDV7.js → session-cli-B1hKvfkI.js} +20 -7
  43. package/dist/{session-retirement-DoMMJFKm.js → session-retirement-CE4iMiLh.js} +3 -3
  44. package/dist/{session-upstream-marker-CrIFX06J.js → session-upstream-marker-D_2npHlA.js} +1 -1
  45. package/dist/{settled-turn-finalizer-BRWBO4MO.js → settled-turn-finalizer-Dx1onIqg.js} +23 -19
  46. package/dist/{shared-client-kIBbGjk4.js → shared-client-Dw-rzii0.js} +755 -273
  47. package/dist/{side-question-9HAL26l9.js → side-question-DbXkJZzg.js} +52 -30
  48. package/dist/{thread-lifecycle-Bu1BTDXr.js → thread-lifecycle-DKdrnTMX.js} +310 -92
  49. package/dist/{thread-ownership-6kOQHlyC.js → thread-ownership-i2NBwDUL.js} +2 -2
  50. package/dist/{thread-resume-CPrJNQVM.js → thread-resume-CdJk2Ehf.js} +3 -3
  51. package/dist/{transcript-mirror-B9gGgnJS.js → transcript-mirror-BU0_LKAL.js} +46 -28
  52. package/dist/{transport-stdio-DIImwDVS.js → transport-stdio-DhoGy33Z.js} +2 -2
  53. package/dist/{upstream-prompt-provenance-ClRBije0.js → upstream-prompt-provenance-CFmsKwr9.js} +12 -14
  54. package/dist/{upstream-session-fork-CE-_LdnP.js → upstream-session-fork-BDVJCLAD.js} +12 -6
  55. package/dist/{usage-CHlV0e-o.js → usage-9dKJCgcy.js} +3 -3
  56. package/dist/{web-search-provider.runtime-DRw2Vl42.js → web-search-provider.runtime-DCdx4DGu.js} +3 -3
  57. package/openclaw.plugin.json +31 -1
  58. package/package.json +6 -5
  59. package/dist/app-server-policy-zcBDc1JU.js +0 -49
package/dist/api.js ADDED
@@ -0,0 +1,147 @@
1
+ import { a as resolveCodexAppServerStartOptionsForAgent, i as resolveCodexAppServerRuntimeOptions } from "./config-CpNeo5AE.js";
2
+ import { a as CODEX_APP_SERVER_VERSION, n as resolveManagedCodexAppServerStartOptions, r as resolveManagedCodexNativeCommand, t as isManagedCodexDesktopCommand } from "./managed-binary-By4FZC6i.js";
3
+ import path from "node:path";
4
+ import { resolveDefaultModelForAgent } from "openclaw/plugin-sdk/agent-runtime";
5
+ import { listAgentIds as listAgentIds$1, resolveAgentDir as resolveAgentDir$1 } from "openclaw/plugin-sdk/agent-scope-runtime";
6
+ import { execFile } from "node:child_process";
7
+ import { fileURLToPath } from "node:url";
8
+ import { resolveEffectiveAgentRuntime } from "openclaw/plugin-sdk/command-auth-native";
9
+ import { getHealthCheck } from "openclaw/plugin-sdk/health";
10
+ //#region extensions/codex/src/doctor.ts
11
+ const CODEX_MANAGED_APP_SERVER_CHECK_ID = "codex/managed-app-server";
12
+ const CODEX_VERSION_TIMEOUT_MS = 5e3;
13
+ const CODEX_VERSION_MAX_BUFFER_BYTES = 64 * 1024;
14
+ function managedCodexFinding(params) {
15
+ return {
16
+ checkId: CODEX_MANAGED_APP_SERVER_CHECK_ID,
17
+ severity: "error",
18
+ source: "codex",
19
+ message: params.message,
20
+ ...params.path ? { path: params.path } : {},
21
+ ...params.requirement ? { requirement: params.requirement } : {},
22
+ ...params.fixHint ? { fixHint: params.fixHint } : {}
23
+ };
24
+ }
25
+ function readErrorMessage(error) {
26
+ return error instanceof Error ? error.message : String(error);
27
+ }
28
+ function parseCodexVersion(output) {
29
+ return /(?:^|\s)(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)(?:\s|$)/u.exec(output)?.[1];
30
+ }
31
+ function runVersionCommand(command) {
32
+ return new Promise((resolve, reject) => {
33
+ execFile(command, ["--version"], {
34
+ encoding: "utf8",
35
+ maxBuffer: CODEX_VERSION_MAX_BUFFER_BYTES,
36
+ timeout: CODEX_VERSION_TIMEOUT_MS,
37
+ windowsHide: true
38
+ }, (error, stdout, stderr) => {
39
+ if (error) {
40
+ reject(new Error(readErrorMessage(error), { cause: error }));
41
+ return;
42
+ }
43
+ resolve({
44
+ stdout,
45
+ stderr
46
+ });
47
+ });
48
+ });
49
+ }
50
+ function createCodexManagedAppServerHealthCheck(params) {
51
+ const resolveStartOptions = params.deps?.resolveStartOptions ?? resolveManagedCodexAppServerStartOptions;
52
+ const resolveAgentStartOptions = params.deps?.resolveAgentStartOptions ?? resolveCodexAppServerStartOptionsForAgent;
53
+ const isDesktopCommand = params.deps?.isDesktopCommand ?? isManagedCodexDesktopCommand;
54
+ const resolveNativeCommand = params.deps?.resolveNativeCommand ?? resolveManagedCodexNativeCommand;
55
+ const executeVersion = params.deps?.runVersionCommand ?? runVersionCommand;
56
+ return {
57
+ id: CODEX_MANAGED_APP_SERVER_CHECK_ID,
58
+ kind: "plugin",
59
+ description: "Verify the selected managed Codex app-server binary and pinned version.",
60
+ source: "codex",
61
+ defaultEnabled: false,
62
+ async detect(ctx) {
63
+ const pluginConfig = ctx.cfg.plugins?.entries?.codex?.config;
64
+ const start = resolveCodexAppServerRuntimeOptions({
65
+ pluginConfig,
66
+ env: ctx.env ?? process.env
67
+ }).start;
68
+ if (start.transport !== "stdio" || start.commandSource !== "managed") return [];
69
+ const env = ctx.env ?? process.env;
70
+ let resolved;
71
+ for (const agentId of listAgentIds$1(ctx.cfg)) {
72
+ const model = resolveDefaultModelForAgent({
73
+ cfg: ctx.cfg,
74
+ agentId
75
+ });
76
+ if (resolveEffectiveAgentRuntime({
77
+ cfg: ctx.cfg,
78
+ provider: model.provider,
79
+ modelId: model.model,
80
+ agentId
81
+ }) !== "codex") continue;
82
+ const agentStart = resolveAgentStartOptions({
83
+ startOptions: start,
84
+ agentDir: resolveAgentDir$1(ctx.cfg, agentId, env),
85
+ env
86
+ });
87
+ try {
88
+ resolved = await resolveStartOptions(agentStart, { pluginRoot: params.pluginRoot });
89
+ } catch (error) {
90
+ return [managedCodexFinding({
91
+ message: `Managed Codex app-server could not be resolved: ${readErrorMessage(error)}`,
92
+ path: params.pluginRoot,
93
+ requirement: `an executable Codex ${CODEX_APP_SERVER_VERSION} managed artifact`,
94
+ fixHint: "Reinstall the staged OpenClaw package with its @openai/codex platform dependency, then rerun the candidate check."
95
+ })];
96
+ }
97
+ if (!isDesktopCommand(resolved.command)) break;
98
+ resolved = void 0;
99
+ }
100
+ if (!resolved) return [];
101
+ const nativeCommand = resolveNativeCommand(resolved.command);
102
+ if (!nativeCommand) return [managedCodexFinding({
103
+ message: "Managed Codex app-server resolved a launcher without a native artifact.",
104
+ path: resolved.command,
105
+ requirement: `the platform-native Codex ${CODEX_APP_SERVER_VERSION} executable`,
106
+ fixHint: "Reinstall the staged OpenClaw package with the matching @openai/codex platform package, then rerun the candidate check."
107
+ })];
108
+ let output;
109
+ try {
110
+ output = await executeVersion(nativeCommand);
111
+ } catch (error) {
112
+ return [managedCodexFinding({
113
+ message: `Managed Codex app-server version check failed: ${readErrorMessage(error)}`,
114
+ path: nativeCommand,
115
+ requirement: `Codex ${CODEX_APP_SERVER_VERSION} must report its version within ${CODEX_VERSION_TIMEOUT_MS} ms`,
116
+ fixHint: "Repair or reinstall the staged OpenClaw package, then rerun the candidate check before cutover."
117
+ })];
118
+ }
119
+ const detectedVersion = parseCodexVersion(`${output.stdout}\n${output.stderr}`);
120
+ if (detectedVersion !== "0.149.1") return [managedCodexFinding({
121
+ message: detectedVersion ? `Managed Codex app-server version mismatch: expected ${CODEX_APP_SERVER_VERSION}, detected ${detectedVersion}.` : `Managed Codex app-server did not report a parseable version; expected ${CODEX_APP_SERVER_VERSION}.`,
122
+ path: nativeCommand,
123
+ requirement: `the exact OpenClaw-pinned Codex version ${CODEX_APP_SERVER_VERSION}`,
124
+ fixHint: "Reinstall the staged OpenClaw package so its managed @openai/codex dependency matches the pinned version, then rerun the candidate check."
125
+ })];
126
+ return [];
127
+ }
128
+ };
129
+ }
130
+ function registerCodexManagedAppServerDoctorChecks$1(host, deps) {
131
+ if (getHealthCheck("codex/managed-app-server")) return;
132
+ host.registerHealthCheck(createCodexManagedAppServerHealthCheck({
133
+ pluginRoot: host.pluginRoot,
134
+ deps
135
+ }));
136
+ }
137
+ //#endregion
138
+ //#region extensions/codex/api.ts
139
+ const CODEX_PLUGIN_ROOT = path.dirname(fileURLToPath(import.meta.url));
140
+ function registerCodexManagedAppServerDoctorChecks(host) {
141
+ registerCodexManagedAppServerDoctorChecks$1({
142
+ ...host,
143
+ pluginRoot: CODEX_PLUGIN_ROOT
144
+ });
145
+ }
146
+ //#endregion
147
+ export { CODEX_MANAGED_APP_SERVER_CHECK_ID, registerCodexManagedAppServerDoctorChecks };
@@ -0,0 +1,25 @@
1
+ import { b as canUseCodexModelBackedApprovalsReviewerForModel } from "./config-CpNeo5AE.js";
2
+ //#region extensions/codex/src/app-server/app-server-policy.ts
3
+ function resolveCodexAppServerForModelProvider(params) {
4
+ const explicitProvider = normalizeModelBackedReviewerProvider(params.provider);
5
+ if (!isCodexModelBackedApprovalsReviewer(params.appServer.approvalsReviewer) || canUseCodexModelBackedApprovalsReviewerForModel({
6
+ modelProvider: explicitProvider,
7
+ model: params.model,
8
+ config: params.config,
9
+ env: params.env,
10
+ agentDir: params.agentDir,
11
+ codexConfigToml: params.codexConfigToml
12
+ })) return params.appServer;
13
+ return {
14
+ ...params.appServer,
15
+ approvalsReviewer: "user"
16
+ };
17
+ }
18
+ function isCodexModelBackedApprovalsReviewer(value) {
19
+ return value === "auto_review" || value === "guardian_subagent";
20
+ }
21
+ function normalizeModelBackedReviewerProvider(provider) {
22
+ return provider?.trim().toLowerCase() || void 0;
23
+ }
24
+ //#endregion
25
+ export { resolveCodexAppServerForModelProvider as t };
@@ -1,4 +1,4 @@
1
- import { J as unsubscribeCodexAppServerLiveThread, ct as isJsonObject, p as retireSharedCodexAppServerClientIfCurrent, z as CodexAppServerRpcError } from "./shared-client-kIBbGjk4.js";
1
+ import { B as CodexAppServerRpcError, X as unsubscribeCodexAppServerLiveThread, p as retireSharedCodexAppServerClientIfCurrent, ut as isJsonObject } from "./shared-client-Dw-rzii0.js";
2
2
  import { asFiniteNumber, normalizeOptionalString, normalizeOptionalString as normalizeOptionalString$1, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
4
4
  import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
@@ -1,5 +1,5 @@
1
- import { T as readCodexPluginConfig, g as resolveCodexAppServerRuntimeOptions, y as resolveCodexSupervisionAppServerRuntimeOptions } from "./session-binding-DPxIvMgE.js";
2
- import { t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-C3H2CVp6.js";
1
+ import { h as readCodexPluginConfig, i as resolveCodexAppServerRuntimeOptions, s as resolveCodexSupervisionAppServerRuntimeOptions } from "./config-CpNeo5AE.js";
2
+ import { a as resolveCodexCatalogConnectionHome, t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-DMNQ8Zi8.js";
3
3
  //#region extensions/codex/src/app-server/binding-connection.ts
4
4
  /** Requires the native model pair after a supervised pending branch has materialized. */
5
5
  function requireCodexSupervisionModelSelection(binding) {
@@ -16,9 +16,21 @@ function resolveCodexBindingAppServerConnection(params) {
16
16
  const { binding, authProfileId, ...runtimeParams } = params;
17
17
  const usesSupervisionConnection = binding?.connectionScope === "supervision";
18
18
  if (usesSupervisionConnection && readCodexPluginConfig(runtimeParams.pluginConfig).supervision?.enabled !== true) throw new Error("Codex supervision is disabled; refusing to open a native user-home supervised session");
19
- const appServer = (usesSupervisionConnection ? resolveCodexSupervisionAppServerRuntimeOptions : resolveCodexAppServerRuntimeOptions)(runtimeParams);
19
+ let appServer = (usesSupervisionConnection ? resolveCodexSupervisionAppServerRuntimeOptions : resolveCodexAppServerRuntimeOptions)(runtimeParams);
20
20
  if (usesSupervisionConnection) {
21
21
  const persistedFingerprint = binding.pendingSupervisionBranch?.connectionFingerprint ?? binding.appServerRuntimeFingerprint;
22
+ const catalogHome = persistedFingerprint ? resolveCodexCatalogConnectionHome(persistedFingerprint, runtimeParams.agentDir) : void 0;
23
+ if (catalogHome) appServer = {
24
+ ...appServer,
25
+ start: {
26
+ ...appServer.start,
27
+ homeScope: "user",
28
+ env: {
29
+ ...appServer.start.env,
30
+ CODEX_HOME: catalogHome
31
+ }
32
+ }
33
+ };
22
34
  const currentFingerprint = buildCodexAppServerConnectionFingerprint(appServer, runtimeParams.agentDir);
23
35
  if (!persistedFingerprint || persistedFingerprint !== currentFingerprint) throw new Error("Codex supervision connection changed; refusing to operate on its bound native thread");
24
36
  }
@@ -1,10 +1,10 @@
1
- import { g as resolveCodexAppServerRuntimeOptions } from "./session-binding-DPxIvMgE.js";
2
- import { ct as isJsonObject, s as isCodexAppServerStartSelectionChangedError } from "./shared-client-kIBbGjk4.js";
3
- import { _ as readCodexNotificationTurnId, a as closeCodexStartupClientBestEffort, o as interruptCodexTurnAndWaitBestEffort, t as CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS } from "./attempt-client-cleanup-DMLXUfa8.js";
4
- import { b as isTerminalTurnStatus, n as normalizeCodexResponseTokenUsage, x as readCodexNotificationItem, y as isRetryableErrorNotification } from "./event-projector-usage-e5huIQWu.js";
5
- import { a as assertCodexThreadStartResponse, c as readCodexErrorNotification, o as assertCodexTurnStartResponse, u as readCodexTurnCompletedNotification } from "./protocol-validators-B4F7L8Rf.js";
6
- import { r as readModelListResult } from "./models-BFlpn1Ex.js";
7
- import { W as mergeCodexThreadConfigs, c as buildCodexRingZeroThreadConfigPatch, l as buildCodexRuntimeThreadConfig, o as assertCodexRestrictedToolSurfaceHasNoManagedHooks, s as attestCodexRestrictedToolSurfaceMcpServersDisabled, u as readCodexInheritedMcpServerNames } from "./thread-lifecycle-Bu1BTDXr.js";
1
+ import { i as resolveCodexAppServerRuntimeOptions } from "./config-CpNeo5AE.js";
2
+ import { V as createCodexElicitationResponse, s as isCodexAppServerStartSelectionChangedError, ut as isJsonObject } from "./shared-client-Dw-rzii0.js";
3
+ import { _ as readCodexNotificationTurnId, a as closeCodexStartupClientBestEffort, o as interruptCodexTurnAndWaitBestEffort, t as CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS } from "./attempt-client-cleanup-URjUlCHg.js";
4
+ import { b as isTerminalTurnStatus, n as normalizeCodexResponseTokenUsage, x as readCodexNotificationItem, y as isRetryableErrorNotification } from "./event-projector-usage-CLwNEJqW.js";
5
+ import { a as assertCodexThreadStartResponse, c as readCodexErrorNotification, o as assertCodexTurnStartResponse, u as readCodexTurnCompletedNotification } from "./protocol-validators-VAVyEnDp.js";
6
+ import { r as readModelListResult } from "./models-CZw1wClT.js";
7
+ import { Z as mergeCodexThreadConfigs, c as buildCodexRingZeroThreadConfigPatch, l as buildCodexRuntimeThreadConfig, o as assertCodexManagedRequirementsDoNotOverrideToolPolicy, s as attestCodexRestrictedToolSurfaceMcpServersDisabled, u as readCodexInheritedMcpServerNames } from "./thread-lifecycle-DKdrnTMX.js";
8
8
  import { readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
9
9
  import fs from "node:fs/promises";
10
10
  import path from "node:path";
@@ -80,7 +80,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
80
80
  config: params.config,
81
81
  timeoutMs,
82
82
  ...params.signal ? { abandonSignal: params.signal } : {}
83
- }) : await import("./shared-client-kIBbGjk4.js").then((n) => n.m).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
83
+ }) : await import("./shared-client-Dw-rzii0.js").then((n) => n.m).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
84
84
  startOptions,
85
85
  timeoutMs,
86
86
  ...authSelection,
@@ -115,7 +115,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
115
115
  timeout.unref?.();
116
116
  let retrySelection = false;
117
117
  try {
118
- const model = await resolveCodexBoundedTurnModel({
118
+ const modelSelection = await resolveCodexBoundedTurnModel({
119
119
  client,
120
120
  selection: params.model,
121
121
  requiredModalities: params.requiredModalities,
@@ -123,10 +123,10 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
123
123
  signal: abortController.signal
124
124
  });
125
125
  const inheritedMcpServerNames = params.requireNoExternalCapabilities ? await readCodexInheritedMcpServerNames(client, workspace.cwd, abortController.signal) : [];
126
- if (params.requireNoExternalCapabilities) await assertCodexRestrictedToolSurfaceHasNoManagedHooks(client, abortController.signal);
126
+ if (params.requireNoExternalCapabilities) await assertCodexManagedRequirementsDoNotOverrideToolPolicy(client, { restrictedToolSurface: true }, abortController.signal);
127
127
  const threadConfig = buildCodexRuntimeThreadConfig(resolveBoundedThreadConfig(params, workspace, inheritedMcpServerNames), { nativeCodeModeEnabled: false });
128
128
  const thread = assertCodexThreadStartResponse(await client.request("thread/start", {
129
- model,
129
+ model: modelSelection.runtimeModelId,
130
130
  ...params.modelProvider ? { modelProvider: params.modelProvider } : {},
131
131
  cwd: workspace.cwd,
132
132
  approvalPolicy: "on-request",
@@ -161,7 +161,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
161
161
  threadId: thread.thread.id,
162
162
  input: params.input,
163
163
  approvalPolicy: "on-request",
164
- model,
164
+ model: modelSelection.runtimeModelId,
165
165
  effort: "low"
166
166
  }, {
167
167
  timeoutMs,
@@ -174,7 +174,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
174
174
  signal: abortController.signal,
175
175
  timeoutError
176
176
  }),
177
- model
177
+ model: modelSelection.catalogId
178
178
  };
179
179
  } finally {
180
180
  await interruptPromise;
@@ -242,7 +242,7 @@ function createCodexBoundedApprovalHandler(taskLabel) {
242
242
  decision: "decline",
243
243
  reason: `OpenClaw Codex ${taskLabel} does not grant native approvals.`
244
244
  };
245
- if (request.method === "mcpServer/elicitation/request") return { action: "decline" };
245
+ if (request.method === "mcpServer/elicitation/request") return createCodexElicitationResponse("decline", null, { message: `OpenClaw Codex ${taskLabel} does not support interactive input.` });
246
246
  };
247
247
  }
248
248
  async function resolveCodexBoundedTurnModel(params) {
@@ -258,14 +258,20 @@ async function resolveCodexBoundedTurnModel(params) {
258
258
  const supported = listed.filter((entry) => params.requiredModalities.every((modality) => entry.inputModalities.includes(modality)));
259
259
  const selected = supported.find((entry) => entry.isDefault) ?? supported[0];
260
260
  if (!selected) throw new Error(`Codex app-server has no model supporting ${params.requiredModalities.join(" and ")} input.`);
261
- return selected.model;
261
+ return {
262
+ catalogId: selected.id,
263
+ runtimeModelId: selected.model
264
+ };
262
265
  }
263
266
  const model = params.selection.id;
264
267
  const match = listed.find((entry) => entry.model === model || entry.id === model);
265
268
  if (!match) throw new Error(`Codex app-server model not found: ${model}`);
266
269
  if (params.requiredModalities.includes("image") && !match.inputModalities.includes("image")) throw new Error(`Codex app-server model does not support images: ${model}`);
267
270
  if (params.requiredModalities.includes("text") && !match.inputModalities.includes("text")) throw new Error(`Codex app-server model does not support text: ${model}`);
268
- return model;
271
+ return {
272
+ catalogId: match.id,
273
+ runtimeModelId: match.model
274
+ };
269
275
  }
270
276
  function createCodexBoundedTurnCollector(threadId, taskLabel, allowEmptyText) {
271
277
  let turnId;
@@ -1,4 +1,4 @@
1
- import { z as CodexAppServerRpcError } from "./shared-client-kIBbGjk4.js";
1
+ import { B as CodexAppServerRpcError } from "./shared-client-Dw-rzii0.js";
2
2
  //#region extensions/codex/src/app-server/capabilities.ts
3
3
  /**
4
4
  * Capability helpers for optional Codex app-server control-plane methods.
@@ -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-7hgXZDV7.js");
5
+ const { registerCodexSessionCli } = await import("./session-cli-B1hKvfkI.js");
6
6
  registerCodexSessionCli(program);
7
7
  }, { descriptors: [{
8
8
  name: "codex",
@@ -1,5 +1,5 @@
1
- import { ct as isJsonObject } from "./shared-client-kIBbGjk4.js";
2
- import { c as summarizeCodexRateLimits, o as summarizeCodexAccountRateLimits, r as hasCodexRateLimitSnapshots } from "./rate-limits-DZXmOL8-.js";
1
+ import { ut as isJsonObject } from "./shared-client-Dw-rzii0.js";
2
+ import { c as summarizeCodexRateLimits, o as summarizeCodexAccountRateLimits, r as hasCodexRateLimitSnapshots } from "./rate-limits-BI1dMHDG.js";
3
3
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  //#region extensions/codex/src/command-formatters.ts
5
5
  /**
@@ -1,28 +1,30 @@
1
- import { D as CODEX_PLUGINS_MARKETPLACE_NAME, P as isCodexFastServiceTier, c as reclaimCurrentCodexSessionGeneration, d as sessionBindingIdentity, g as resolveCodexAppServerRuntimeOptions, i as createCodexSessionGenerationSupersededError, n as assertCodexBindingMayBeReplaced, r as bindingStoreKey, s as normalizeCodexAppServerBindingModelProvider } from "./session-binding-DPxIvMgE.js";
2
- import { Q as resolveCodexAppServerAuthAccountCacheKey, V as consumeCodexAppServerLiveThread, a as getLeasedSharedCodexAppServerClient, ct as isJsonObject, et as resolveCodexAppServerAuthProfileIdForAgent, l as releaseLeasedSharedCodexAppServerClient, tt as resolveCodexAppServerFallbackApiKeyCacheKey } from "./shared-client-kIBbGjk4.js";
3
- import { i as assertCodexThreadResumeResponse } from "./protocol-validators-B4F7L8Rf.js";
4
- import { t as listAllCodexAppServerModels } from "./models-BFlpn1Ex.js";
5
- import { i as defaultCodexAppInventoryCache, r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-C3H2CVp6.js";
6
- import { Y as isOpenAiCuratedMarketplaceName, q as refreshCodexPluginRuntimeState } from "./thread-lifecycle-Bu1BTDXr.js";
1
+ import { M as isCodexFastServiceTier, _ as CODEX_PLUGINS_MARKETPLACE_NAME, i as resolveCodexAppServerRuntimeOptions } from "./config-CpNeo5AE.js";
2
+ import { U as consumeCodexAppServerLiveThread, a as getLeasedSharedCodexAppServerClient, et as resolveCodexAppServerAuthAccountCacheKey, l as releaseLeasedSharedCodexAppServerClient, nt as resolveCodexAppServerAuthProfileIdForAgent, rt as resolveCodexAppServerFallbackApiKeyCacheKey, ut as isJsonObject } from "./shared-client-Dw-rzii0.js";
3
+ import { c as reclaimCurrentCodexSessionGeneration, d as sessionBindingIdentity, i as createCodexSessionGenerationSupersededError, n as assertCodexBindingMayBeReplaced, r as bindingStoreKey, s as normalizeCodexAppServerBindingModelProvider } from "./session-binding-BTrLf9Qm.js";
4
+ import { i as assertCodexThreadResumeResponse } from "./protocol-validators-VAVyEnDp.js";
5
+ import { t as listAllCodexAppServerModels } from "./models-CZw1wClT.js";
6
+ import { o as defaultCodexAppInventoryCache, r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-DMNQ8Zi8.js";
7
+ import { et as refreshCodexPluginRuntimeState, nt as isOpenAiCuratedMarketplaceName } from "./thread-lifecycle-DKdrnTMX.js";
7
8
  import { t as isIncognitoSessionKey } from "./incognito-session-ET_ufDH-.js";
8
- import { t as CODEX_CONTROL_METHODS } from "./capabilities-CybGI1oz.js";
9
- import { s as summarizeCodexAccountUsage } from "./rate-limits-DZXmOL8-.js";
10
- 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 } from "./command-formatters-B1AEz8ZA.js";
11
- import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-Cmwc9eIk.js";
12
- import { a as rollbackCodexAppServerBindingSubscription, i as retireCodexConversationThreadBinding, n as releaseCodexAppServerBindingSubscription, o as withCodexConversationThreadActivity, r as retainCodexAppServerBindingSubscription, s as withExclusiveCodexAppServerThread, t as isSameCodexAppServerThreadOwner } from "./thread-ownership-6kOQHlyC.js";
13
- import { a as parseCodexPermissionsModeArg, c as setCodexConversationModel, d as stopCodexConversationTurn, i as parseCodexFastModeArg, l as setCodexConversationPermissions, m as canMutateCodexHost, n as parseCodexPluginMarketplaceId, o as readCodexConversationActiveTurn, p as CODEX_NATIVE_EXECUTION_AUTH_ERROR, r as formatPermissionsMode, s as setCodexConversationFastMode, t as discoverCodexMarketplacePlugins, u as steerCodexConversationTurn } from "./plugin-marketplace-discovery-CzrGJdCR.js";
9
+ import { t as CODEX_CONTROL_METHODS } from "./capabilities-CH3K57v4.js";
10
+ import { s as summarizeCodexAccountUsage } from "./rate-limits-BI1dMHDG.js";
11
+ 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 } from "./command-formatters-D0nZ3qtd.js";
12
+ import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-C1qEeZ5C.js";
13
+ import { a as rollbackCodexAppServerBindingSubscription, i as retireCodexConversationThreadBinding, n as releaseCodexAppServerBindingSubscription, o as withCodexConversationThreadActivity, r as retainCodexAppServerBindingSubscription, s as withExclusiveCodexAppServerThread, t as isSameCodexAppServerThreadOwner } from "./thread-ownership-i2NBwDUL.js";
14
+ import { a as parseCodexPermissionsModeArg, c as setCodexConversationModel, d as stopCodexConversationTurn, g as hasCodexAdminScope, h as canMutateCodexHost, i as parseCodexFastModeArg, l as setCodexConversationPermissions, m as CODEX_NATIVE_EXECUTION_AUTH_ERROR, n as parseCodexPluginMarketplaceId, o as readCodexConversationActiveTurn, p as CODEX_FULL_PERMISSIONS_AUTH_ERROR, r as formatPermissionsMode, s as setCodexConversationFastMode, t as discoverCodexMarketplacePlugins, u as steerCodexConversationTurn } from "./plugin-marketplace-discovery-CSWDkMrP.js";
14
15
  import { i as readCodexConversationBindingData, n as createCodexCliNodeConversationBindingData, o as resolveCodexDefaultWorkspaceDir, r as createCodexConversationBindingData } from "./conversation-binding-data-CW2GuupV.js";
15
- import { n as resolveCodexBindingAppServerConnection } from "./binding-connection-I5Bo-AsX.js";
16
- import { c as readCodexStatusProbes, l as requestOptions, p as formatCodexCliSessions, s as codexControlRequest, u as safeCodexControlRequest } from "./session-catalog-xwNi_SDM.js";
17
- import { i as readCodexComputerUseStatus, r as installCodexComputerUse, t as defaultCodexPluginMetadataCache } from "./plugin-metadata-cache-CNJPj4_b.js";
16
+ import { n as resolveCodexBindingAppServerConnection } from "./binding-connection-DAvZwp96.js";
17
+ import { l as formatCodexCliSessions } from "./session-catalog-ezP_UcRM.js";
18
+ import { i as safeCodexControlRequest, n as readCodexStatusProbes, r as requestOptions, t as codexControlRequest } from "./command-rpc-xUIIonsO.js";
19
+ import { i as readCodexComputerUseStatus, r as installCodexComputerUse, t as defaultCodexPluginMetadataCache } from "./plugin-metadata-cache-BXH5NF-4.js";
18
20
  import { normalizeOptionalString, normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
19
21
  import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
20
22
  import crypto from "node:crypto";
21
23
  import { ensureAuthProfileStore, findNormalizedProviderValue, resolveAgentDir, resolveAuthProfileEligibility, resolveAuthProfileOrder, resolveProfileUnusableUntilForDisplay, resolveSessionAgentIds } from "openclaw/plugin-sdk/agent-runtime";
22
- import { parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
23
24
  import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
24
25
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
25
26
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
27
+ import { parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
26
28
  import { MODEL_SELECTION_LOCKED_MESSAGE, isModelSelectionLocked, resolvePersistedSessionRuntimeId } from "openclaw/plugin-sdk/model-session-runtime";
27
29
  //#region extensions/codex/src/command-account.ts
28
30
  const OPENAI_PROVIDER_ID = "openai";
@@ -1487,13 +1489,23 @@ async function describeConversationBinding(deps, ctx) {
1487
1489
  const identity = conversationBindingIdentity(data.bindingId);
1488
1490
  const threadBinding = await deps.bindingStore.read(identity);
1489
1491
  const active = deps.readCodexConversationActiveTurn(identity);
1492
+ const sessionKey = ctx.sessionKey?.trim();
1493
+ const { agentId } = resolveCodexConversationControlScope(ctx);
1494
+ const sessionEntry = sessionKey ? getSessionEntry({
1495
+ agentId,
1496
+ storePath: resolveStorePath(ctx.config.session?.store, { agentId }),
1497
+ sessionKey,
1498
+ hydrateSkillPromptRefs: false,
1499
+ readConsistency: "latest"
1500
+ }) : void 0;
1501
+ const permissionMode = !ctx.sessionId || sessionEntry?.sessionId === ctx.sessionId ? sessionEntry?.permissionMode : void 0;
1490
1502
  return [
1491
1503
  "Codex conversation binding:",
1492
1504
  `- Thread: ${formatCodexDisplayText(threadBinding?.threadId ?? "unknown")}`,
1493
1505
  `- Workspace: ${formatCodexDisplayText(data.workspaceDir)}`,
1494
1506
  `- Model: ${formatCodexDisplayText(threadBinding?.model ?? "default")}`,
1495
1507
  `- Fast: ${isCodexFastServiceTier(threadBinding?.serviceTier) ? "on" : "off"}`,
1496
- `- Permissions: ${threadBinding ? formatPermissionsMode(threadBinding) : "default"}`,
1508
+ `- Permissions: ${formatPermissionsMode(permissionMode)}`,
1497
1509
  `- Active run: ${formatCodexDisplayText(active ? active.turnId : "none")}`,
1498
1510
  `- Binding: ${formatCodexDisplayText(data.bindingId)}`
1499
1511
  ].join("\n");
@@ -1820,7 +1832,7 @@ async function setConversationModel(deps, ctx, pluginConfig, args) {
1820
1832
  hydrateSkillPromptRefs: false,
1821
1833
  readConsistency: "latest"
1822
1834
  }) : void 0;
1823
- const selectedModel = currentSession && currentSession.sessionId === ctx.sessionId ? currentSession.modelOverride : void 0;
1835
+ const selectedModel = currentSession && currentSession.sessionId === ctx.sessionId ? currentSession.modelOverride ?? currentSession.model : void 0;
1824
1836
  const binding = await deps.bindingStore.read(target.identity);
1825
1837
  const activeModel = selectedModel ?? binding?.model;
1826
1838
  return activeModel ? `Codex model: ${formatCodexDisplayText(activeModel)}` : "Usage: /codex model <model>";
@@ -1855,14 +1867,19 @@ async function setConversationFastMode(deps, ctx, args) {
1855
1867
  async function setConversationPermissions(deps, ctx, args) {
1856
1868
  if (args.length > 1) return "Usage: /codex permissions [default|yolo|status]";
1857
1869
  const target = await resolveControlTarget(ctx);
1858
- if (!target) return "Cannot set Codex permissions because this command did not include a stable binding identity.";
1870
+ if (!target || !ctx.sessionId || !ctx.sessionKey) return "Cannot set Codex permissions because this command did not include a complete session identity.";
1859
1871
  const value = args[0];
1860
1872
  const parsed = parseCodexPermissionsModeArg(value);
1861
1873
  if (value && !parsed && value.trim().toLowerCase() !== "status") return "Usage: /codex permissions [default|yolo|status]";
1874
+ if (parsed === "yolo" && !hasCodexAdminScope(ctx)) return CODEX_FULL_PERMISSIONS_AUTH_ERROR;
1862
1875
  return await deps.setCodexConversationPermissions({
1863
- identity: target.identity,
1864
- bindingStore: deps.bindingStore,
1865
- mode: parsed
1876
+ mode: parsed,
1877
+ config: ctx.config,
1878
+ session: {
1879
+ agentId: target.agentId,
1880
+ sessionId: ctx.sessionId,
1881
+ sessionKey: ctx.sessionKey
1882
+ }
1866
1883
  });
1867
1884
  }
1868
1885
  async function startThreadAction(deps, ctx, pluginConfig, kind, args) {
@@ -0,0 +1,90 @@
1
+ import { i as resolveCodexAppServerRuntimeOptions, s as resolveCodexSupervisionAppServerRuntimeOptions } from "./config-CpNeo5AE.js";
2
+ import { n as listCodexAppServerModels } from "./models-CZw1wClT.js";
3
+ import { n as describeControlFailure, t as CODEX_CONTROL_METHODS } from "./capabilities-CH3K57v4.js";
4
+ import { i as withCodexAppServerJsonClient, r as requestCodexAppServerJson } from "./request-DSK0W6YI.js";
5
+ //#region extensions/codex/src/command-rpc.ts
6
+ function requestOptions(pluginConfig, limit, config, agentDir) {
7
+ const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig });
8
+ return {
9
+ limit,
10
+ timeoutMs: runtime.requestTimeoutMs,
11
+ startOptions: runtime.start,
12
+ config,
13
+ agentDir
14
+ };
15
+ }
16
+ async function codexControlRequest(pluginConfig, method, requestParams, options = {}) {
17
+ const runtime = options.startOptions ? resolveCodexSupervisionAppServerRuntimeOptions({ pluginConfig }) : resolveCodexAppServerRuntimeOptions({ pluginConfig });
18
+ const controlRequestOptions = {
19
+ timeoutMs: options.timeoutMs ?? runtime.requestTimeoutMs,
20
+ startOptions: options.startOptions ?? runtime.start,
21
+ config: options.config,
22
+ sessionKey: options.sessionKey,
23
+ sessionId: options.sessionId,
24
+ authProfileId: options.authProfileId,
25
+ agentDir: options.agentDir,
26
+ isolated: options.isolated
27
+ };
28
+ if (options.onResponse) return await withCodexAppServerJsonClient(controlRequestOptions, async (request, client) => {
29
+ const response = await request({
30
+ method,
31
+ requestParams
32
+ });
33
+ await options.onResponse(response, client);
34
+ return response;
35
+ });
36
+ return await requestCodexAppServerJson({
37
+ method,
38
+ requestParams,
39
+ ...controlRequestOptions
40
+ });
41
+ }
42
+ async function safeCodexControlRequest(pluginConfig, method, requestParams, options = {}) {
43
+ return await safeValue(async () => await codexControlRequest(pluginConfig, method, requestParams, options));
44
+ }
45
+ async function safeCodexModelList(pluginConfig, limit, config, agentDir) {
46
+ return await safeValue(async () => await listCodexAppServerModels(requestOptions(pluginConfig, limit, config, agentDir)));
47
+ }
48
+ async function readCodexStatusProbes(pluginConfig, config, agentDir) {
49
+ const [models, account, limits, mcps, skills] = await Promise.all([
50
+ safeCodexModelList(pluginConfig, 20, config, agentDir),
51
+ safeCodexControlRequest(pluginConfig, CODEX_CONTROL_METHODS.account, { refreshToken: false }, {
52
+ config,
53
+ agentDir
54
+ }),
55
+ safeCodexControlRequest(pluginConfig, CODEX_CONTROL_METHODS.rateLimits, void 0, {
56
+ config,
57
+ agentDir
58
+ }),
59
+ safeCodexControlRequest(pluginConfig, CODEX_CONTROL_METHODS.listMcpServers, { limit: 100 }, {
60
+ config,
61
+ agentDir
62
+ }),
63
+ safeCodexControlRequest(pluginConfig, CODEX_CONTROL_METHODS.listSkills, {}, {
64
+ config,
65
+ agentDir
66
+ })
67
+ ]);
68
+ return {
69
+ models,
70
+ account,
71
+ limits,
72
+ mcps,
73
+ skills
74
+ };
75
+ }
76
+ async function safeValue(read) {
77
+ try {
78
+ return {
79
+ ok: true,
80
+ value: await read()
81
+ };
82
+ } catch (error) {
83
+ return {
84
+ ok: false,
85
+ error: describeControlFailure(error)
86
+ };
87
+ }
88
+ }
89
+ //#endregion
90
+ export { safeCodexControlRequest as i, readCodexStatusProbes as n, requestOptions as r, codexControlRequest as t };