@openclaw/codex 2026.8.1-beta.2 → 2026.9.1-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.
Files changed (60) hide show
  1. package/dist/api.js +147 -0
  2. package/dist/{attempt-client-cleanup-DMLXUfa8.js → attempt-client-cleanup-bfsmcQ6m.js} +21 -2
  3. package/dist/{binding-connection-I5Bo-AsX.js → binding-connection-BMvPX73o.js} +15 -3
  4. package/dist/{bounded-turn-qgZmzy_4.js → bounded-turn-B7iBUcuP.js} +22 -16
  5. package/dist/{capabilities-CybGI1oz.js → capabilities-BRMh0aIq.js} +1 -1
  6. package/dist/cli-metadata.js +1 -1
  7. package/dist/{command-formatters-B1AEz8ZA.js → command-formatters-DEsIufkt.js} +2 -2
  8. package/dist/{command-handlers-Db8pu_ds.js → command-handlers-D_-1_qRp.js} +65 -37
  9. package/dist/command-rpc-CCeCkf_v.js +90 -0
  10. package/dist/{compact-LspQaGfl.js → compact-BglNFZrQ.js} +35 -29
  11. package/dist/{session-binding-DPxIvMgE.js → config-giW8X0QA.js} +108 -914
  12. package/dist/context-compaction-activity-BOeJf7yo.js +58 -0
  13. package/dist/doctor-contract-api.js +23 -21
  14. package/dist/{dynamic-tools-BVdyWkUD.js → dynamic-tools-Dnlfa--w.js} +1345 -1424
  15. package/dist/{effective-mcp-catalog-DIIhAtOZ.js → effective-mcp-catalog-CTeGrnfO.js} +2 -2
  16. package/dist/elicitation-input-DMkeki8d.js +71 -0
  17. package/dist/{event-projector-assistant-message-BwxV4d6N.js → event-projector-assistant-message-C5-Ds8mA.js} +18 -1
  18. package/dist/{event-projector-usage-e5huIQWu.js → event-projector-usage-Bk1I90Bg.js} +18 -18
  19. package/dist/harness-Csz0F-DK.js +258 -0
  20. package/dist/harness.js +2 -226
  21. package/dist/index.js +262 -181
  22. package/dist/{isolated-completion-C58NbL40.js → isolated-completion-Cv6FqygM.js} +4 -4
  23. package/dist/managed-binary-DFYK4DWq.js +248 -0
  24. package/dist/media-understanding-provider.js +2 -2
  25. package/dist/model-catalog-i9rNBthX.js +48 -0
  26. package/dist/{models-BFlpn1Ex.js → models-TS3HBU-q.js} +4 -3
  27. package/dist/{native-subagent-monitor-DyTGmTUx.js → native-subagent-monitor-4Mfq2HDs.js} +354 -83
  28. package/dist/node-exec-server.runtime-BpWqJO1V.js +192 -0
  29. package/dist/{plugin-app-cache-key-C3H2CVp6.js → plugin-app-cache-key-C1CAdfcP.js} +19 -4
  30. package/dist/plugin-approval-roundtrip-bUm777tR.js +95 -0
  31. package/dist/{plugin-marketplace-discovery-CzrGJdCR.js → plugin-marketplace-discovery-B9DvaAG-.js} +59 -54
  32. package/dist/{plugin-metadata-cache-CNJPj4_b.js → plugin-metadata-cache-CTCT3w5L.js} +164 -134
  33. package/dist/{protocol-validators-B4F7L8Rf.js → protocol-validators-VeJxxJ0U.js} +80 -5
  34. package/dist/{rate-limits-DZXmOL8-.js → rate-limits-C5_D8Gmb.js} +1 -1
  35. package/dist/{request-BRl5_UfX.js → request-DXXGHko0.js} +2 -2
  36. package/dist/{run-attempt-P8BdxC1I.js → run-attempt-DYc0QCBF.js} +1276 -765
  37. package/dist/{runtime-artifact-BVSPdd6g.js → runtime-artifact-BvyT1uyd.js} +4 -7
  38. package/dist/{sandbox-guard-Cmwc9eIk.js → sandbox-guard-kuWTn9C5.js} +25 -19
  39. package/dist/session-binding-Bcynfd-_.js +874 -0
  40. package/dist/{session-catalog-xwNi_SDM.js → session-catalog-DaLKVtpH.js} +1534 -1288
  41. package/dist/session-catalog-home-id-BNwAJ9D7.js +18 -0
  42. package/dist/{session-cli-7hgXZDV7.js → session-cli-DMc4oS2w.js} +20 -7
  43. package/dist/session-permission-policy-BrNH1bjy.js +160 -0
  44. package/dist/{session-retirement-DoMMJFKm.js → session-retirement-CcNC3YSY.js} +3 -3
  45. package/dist/{session-upstream-marker-CrIFX06J.js → session-upstream-marker-BIkusb95.js} +1 -1
  46. package/dist/{settled-turn-finalizer-BRWBO4MO.js → settled-turn-finalizer-Dc3ApjU4.js} +24 -20
  47. package/dist/{shared-client-kIBbGjk4.js → shared-client-DKz23hHY.js} +1632 -372
  48. package/dist/{side-question-9HAL26l9.js → side-question-DjA_jsNe.js} +105 -54
  49. package/dist/{thread-lifecycle-Bu1BTDXr.js → thread-lifecycle-L7oEkTlq.js} +1147 -114
  50. package/dist/{thread-ownership-6kOQHlyC.js → thread-ownership-DZeuKH1j.js} +2 -2
  51. package/dist/{thread-resume-CPrJNQVM.js → thread-resume-BE9qNEW0.js} +3 -3
  52. package/dist/{transcript-mirror-B9gGgnJS.js → transcript-mirror-DsCMWBca.js} +137 -38
  53. package/dist/{transport-stdio-DIImwDVS.js → transport-stdio-DhoGy33Z.js} +2 -2
  54. package/dist/{upstream-prompt-provenance-ClRBije0.js → upstream-prompt-provenance-CFmsKwr9.js} +12 -14
  55. package/dist/{upstream-session-fork-CE-_LdnP.js → upstream-session-fork-DlaHxSLC.js} +12 -6
  56. package/dist/{usage-CHlV0e-o.js → usage-ROIaW3wo.js} +3 -3
  57. package/dist/{web-search-provider.runtime-DRw2Vl42.js → web-search-provider.runtime-ClaNPV7N.js} +3 -3
  58. package/openclaw.plugin.json +49 -2
  59. package/package.json +9 -8
  60. 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-giW8X0QA.js";
2
+ import { a as CODEX_APP_SERVER_VERSION, n as resolveManagedCodexAppServerStartOptions, r as resolveManagedCodexNativeCommand, t as isManagedCodexDesktopCommand } from "./managed-binary-DFYK4DWq.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.150.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 };
@@ -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 { G as CodexAppServerRpcError, _ as retireSharedCodexAppServerClientIfCurrent, tt as unsubscribeCodexAppServerLiveThread, vt as isJsonObject } from "./shared-client-DKz23hHY.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";
@@ -259,6 +259,7 @@ var CodexProjectionDiagnostics = class {
259
259
  //#region extensions/codex/src/app-server/turn-router.ts
260
260
  /** Keyed routing for all turn traffic on one shared Codex app-server client. */
261
261
  const DEFAULT_PREBIND_NOTIFICATION_LIMIT = 256;
262
+ const DEFAULT_GLOBAL_WARNING_LIMIT = 32;
262
263
  const CODEX_APP_SERVER_NATIVE_TURN_WAIT_TIMEOUT_MS = 3e4;
263
264
  const routers = /* @__PURE__ */ new WeakMap();
264
265
  /** Returns the sole router installed on a physical app-server client. */
@@ -272,6 +273,7 @@ function getCodexAppServerTurnRouter(client) {
272
273
  var ClientTurnRouter = class {
273
274
  constructor(client) {
274
275
  this.routes = /* @__PURE__ */ new Map();
276
+ this.globalWarnings = [];
275
277
  this.nativeTurnCompletionWatchers = /* @__PURE__ */ new Map();
276
278
  this.disposed = false;
277
279
  client.addNotificationHandler((notification) => this.routeNotification(notification));
@@ -290,7 +292,11 @@ var ClientTurnRouter = class {
290
292
  ended: createDeferred(),
291
293
  activated: createDeferred(),
292
294
  gate: "open",
293
- pending: [],
295
+ pending: this.globalWarnings.map((notification) => ({
296
+ notification,
297
+ receivedAtMs: Date.now(),
298
+ scope: { threadId }
299
+ })),
294
300
  notificationTail: Promise.resolve(),
295
301
  completedNativeTurnIds: /* @__PURE__ */ new Set(),
296
302
  ignoredTurnNotificationKeys: /* @__PURE__ */ new Set()
@@ -412,6 +418,15 @@ var ClientTurnRouter = class {
412
418
  routeNotification(notification) {
413
419
  if (this.disposed) return;
414
420
  const scope = readScope(notification.params);
421
+ if (!scope.threadId && (notification.method === "configWarning" || notification.method === "warning")) {
422
+ if (this.globalWarnings.length === DEFAULT_GLOBAL_WARNING_LIMIT) this.globalWarnings.shift();
423
+ this.globalWarnings.push(notification);
424
+ for (const route of this.routes.values()) {
425
+ this.bufferNotification(route, notification, { threadId: route.threadId }, Date.now());
426
+ if (route.gate === "bound") this.flushNotifications(route);
427
+ }
428
+ return Promise.all([...this.routes.values()].map((route) => route.notificationTail)).then(() => void 0);
429
+ }
415
430
  const watchers = scope.threadId ? this.nativeTurnCompletionWatchers.get(scope.threadId) : void 0;
416
431
  const route = scope.threadId ? this.routes.get(scope.threadId) : void 0;
417
432
  if (!watchers && !route) return;
@@ -489,6 +504,10 @@ var ClientTurnRouter = class {
489
504
  const handler = route.handlers?.onNotification;
490
505
  if (!handler) return;
491
506
  for (const pending of route.pending.splice(0)) {
507
+ if (route.gate !== "bound" && (pending.notification.method === "configWarning" || pending.notification.method === "warning" && !readScope(pending.notification.params).threadId)) {
508
+ route.pending.push(pending);
509
+ continue;
510
+ }
492
511
  if (route.gate === "bound" && pending.scope.turnId && pending.scope.turnId !== route.turnId) {
493
512
  this.warnDroppedStaleTurnNotification(route, pending.notification, pending.scope);
494
513
  continue;
@@ -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-giW8X0QA.js";
2
+ import { a as resolveCodexCatalogConnectionHome, t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-C1CAdfcP.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-giW8X0QA.js";
2
+ import { K as createCodexElicitationResponse, c as isCodexAppServerStartSelectionChangedError, vt as isJsonObject } from "./shared-client-DKz23hHY.js";
3
+ import { _ as readCodexNotificationTurnId, a as closeCodexStartupClientBestEffort, o as interruptCodexTurnAndWaitBestEffort, t as CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS } from "./attempt-client-cleanup-bfsmcQ6m.js";
4
+ import { b as isTerminalTurnStatus, n as normalizeCodexResponseTokenUsage, x as readCodexNotificationItem, y as isRetryableErrorNotification } from "./event-projector-usage-Bk1I90Bg.js";
5
+ import { a as assertCodexThreadStartResponse, c as readCodexErrorNotification, o as assertCodexTurnStartResponse, u as readCodexTurnCompletedNotification } from "./protocol-validators-VeJxxJ0U.js";
6
+ import { r as readModelListResult } from "./models-TS3HBU-q.js";
7
+ import { A as attestCodexRestrictedToolSurfaceMcpServersDisabled, M as buildCodexRuntimeThreadConfig, N as readCodexInheritedMcpServerNames, bt as mergeCodexThreadConfigs, j as buildCodexRingZeroThreadConfigPatch, k as assertCodexManagedRequirementsDoNotOverrideToolPolicy } from "./thread-lifecycle-L7oEkTlq.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-DKz23hHY.js").then((n) => n.y).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 { G as CodexAppServerRpcError } from "./shared-client-DKz23hHY.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-DMc4oS2w.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 { vt as isJsonObject } from "./shared-client-DKz23hHY.js";
2
+ import { c as summarizeCodexRateLimits, o as summarizeCodexAccountRateLimits, r as hasCodexRateLimitSnapshots } from "./rate-limits-C5_D8Gmb.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 { N as isCodexFastServiceTier, _ as CODEX_PLUGINS_MARKETPLACE_NAME, i as resolveCodexAppServerRuntimeOptions } from "./config-giW8X0QA.js";
2
+ import { J as consumeCodexAppServerLiveThread, ct as resolveCodexAppServerAuthAccountCacheKey, dt as resolveCodexAppServerFallbackApiKeyCacheKey, o as getLeasedSharedCodexAppServerClient, p as releaseLeasedSharedCodexAppServerClient, ut as resolveCodexAppServerAuthProfileIdForAgent, vt as isJsonObject } from "./shared-client-DKz23hHY.js";
3
+ import { c as reclaimCurrentCodexSessionGeneration, d as sessionBindingIdentity, i as createCodexSessionGenerationSupersededError, n as assertCodexBindingMayBeReplaced, r as bindingStoreKey, s as normalizeCodexAppServerBindingModelProvider } from "./session-binding-Bcynfd-_.js";
4
+ import { i as assertCodexThreadResumeResponse } from "./protocol-validators-VeJxxJ0U.js";
5
+ import { t as listAllCodexAppServerModels } from "./models-TS3HBU-q.js";
6
+ import { o as defaultCodexAppInventoryCache, r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-C1CAdfcP.js";
7
+ import { Ct as refreshCodexPluginRuntimeState, Tt as isOpenAiCuratedMarketplaceName } from "./thread-lifecycle-L7oEkTlq.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-BRMh0aIq.js";
10
+ import { s as summarizeCodexAccountUsage } from "./rate-limits-C5_D8Gmb.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-DEsIufkt.js";
12
+ import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-kuWTn9C5.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-DZeuKH1j.js";
14
+ import { _ as hasCodexAdminScope, a as parseCodexPermissionsModeArg, c as setCodexConversationModel, d as stopCodexConversationTurn, g as canMutateCodexHost, h as CODEX_NATIVE_EXECUTION_AUTH_ERROR, i as parseCodexFastModeArg, l as setCodexConversationPermissions, m as CODEX_HOST_INSPECTION_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-B9DvaAG-.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-BMvPX73o.js";
17
+ import { l as formatCodexCliSessions } from "./session-catalog-DaLKVtpH.js";
18
+ import { i as safeCodexControlRequest, n as readCodexStatusProbes, r as requestOptions, t as codexControlRequest } from "./command-rpc-CCeCkf_v.js";
19
+ import { i as readCodexComputerUseStatus, r as installCodexComputerUse, t as defaultCodexPluginMetadataCache } from "./plugin-metadata-cache-CTCT3w5L.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";
@@ -49,8 +51,8 @@ async function readCodexAccountAuthOverview(params) {
49
51
  limits: params.limits,
50
52
  now
51
53
  });
52
- const subscriptionProfileId = order.find((profileId) => isChatGptSubscriptionProfile(store.profiles[profileId]));
53
54
  const activeIsSubscription = activeProfileId !== void 0 && isChatGptSubscriptionProfile(store.profiles[activeProfileId]);
55
+ const subscriptionProfileId = activeIsSubscription ? activeProfileId : order.find((profileId) => isChatGptSubscriptionProfile(store.profiles[profileId]));
54
56
  const activeUsage = activeIsSubscription && params.limits.ok ? summarizeCodexAccountUsage(params.limits.value, now) : void 0;
55
57
  const subscriptionUsage = subscriptionProfileId && (!activeIsSubscription || subscriptionProfileId !== activeProfileId) ? await readSubscriptionUsage({
56
58
  ...params,
@@ -155,13 +157,20 @@ function resolveLiveAccountProfileId(params) {
155
157
  const type = normalizeOptionalString(account.type)?.toLowerCase();
156
158
  if (type === "chatgpt") {
157
159
  const email = normalizeOptionalString(account.email)?.toLowerCase();
158
- const firstSubscription = params.order.find((profileId) => isChatGptSubscriptionProfile(params.store.profiles[profileId]));
159
- if (!email) return firstSubscription;
160
- return params.order.find((profileId) => {
161
- const credential = params.store.profiles[profileId];
162
- if (!credential || !isChatGptSubscriptionProfile(credential)) return false;
163
- return (credential.email?.trim().toLowerCase() ?? extractEmailFromProfileId(profileId))?.toLowerCase() === email;
164
- }) ?? firstSubscription;
160
+ const accountId = normalizeOptionalString(account.accountId ?? account.chatgptAccountId);
161
+ const subscriptionProfiles = params.order.filter((profileId) => isChatGptSubscriptionProfile(params.store.profiles[profileId]));
162
+ if (accountId) {
163
+ const exactWorkspace = subscriptionProfiles.find((profileId) => {
164
+ const credential = params.store.profiles[profileId];
165
+ return credential && "accountId" in credential && credential.accountId === accountId;
166
+ });
167
+ if (exactWorkspace) return exactWorkspace;
168
+ }
169
+ const matchingProfiles = email ? subscriptionProfiles.filter((profileId) => {
170
+ return (params.store.profiles[profileId]?.email?.trim().toLowerCase() ?? extractEmailFromProfileId(profileId))?.toLowerCase() === email;
171
+ }) : subscriptionProfiles;
172
+ const lastGood = params.store.lastGood?.[OPENAI_PROVIDER_ID];
173
+ return (lastGood && matchingProfiles.includes(lastGood) ? lastGood : void 0) ?? matchingProfiles[0] ?? subscriptionProfiles[0];
165
174
  }
166
175
  if (type === "apikey" || type === "api_key") return params.order.find((profileId) => params.store.profiles[profileId]?.type === "api_key");
167
176
  }
@@ -1487,13 +1496,23 @@ async function describeConversationBinding(deps, ctx) {
1487
1496
  const identity = conversationBindingIdentity(data.bindingId);
1488
1497
  const threadBinding = await deps.bindingStore.read(identity);
1489
1498
  const active = deps.readCodexConversationActiveTurn(identity);
1499
+ const sessionKey = ctx.sessionKey?.trim();
1500
+ const { agentId } = resolveCodexConversationControlScope(ctx);
1501
+ const sessionEntry = sessionKey ? getSessionEntry({
1502
+ agentId,
1503
+ storePath: resolveStorePath(ctx.config.session?.store, { agentId }),
1504
+ sessionKey,
1505
+ hydrateSkillPromptRefs: false,
1506
+ readConsistency: "latest"
1507
+ }) : void 0;
1508
+ const permissionMode = !ctx.sessionId || sessionEntry?.sessionId === ctx.sessionId ? sessionEntry?.permissionMode : void 0;
1490
1509
  return [
1491
1510
  "Codex conversation binding:",
1492
1511
  `- Thread: ${formatCodexDisplayText(threadBinding?.threadId ?? "unknown")}`,
1493
1512
  `- Workspace: ${formatCodexDisplayText(data.workspaceDir)}`,
1494
1513
  `- Model: ${formatCodexDisplayText(threadBinding?.model ?? "default")}`,
1495
1514
  `- Fast: ${isCodexFastServiceTier(threadBinding?.serviceTier) ? "on" : "off"}`,
1496
- `- Permissions: ${threadBinding ? formatPermissionsMode(threadBinding) : "default"}`,
1515
+ `- Permissions: ${formatPermissionsMode(permissionMode)}`,
1497
1516
  `- Active run: ${formatCodexDisplayText(active ? active.turnId : "none")}`,
1498
1517
  `- Binding: ${formatCodexDisplayText(data.bindingId)}`
1499
1518
  ].join("\n");
@@ -1820,9 +1839,9 @@ async function setConversationModel(deps, ctx, pluginConfig, args) {
1820
1839
  hydrateSkillPromptRefs: false,
1821
1840
  readConsistency: "latest"
1822
1841
  }) : void 0;
1823
- const selectedModel = currentSession && currentSession.sessionId === ctx.sessionId ? currentSession.modelOverride : void 0;
1842
+ const selectedModel = currentSession && currentSession.sessionId === ctx.sessionId ? currentSession.modelOverride ?? currentSession.model : void 0;
1824
1843
  const binding = await deps.bindingStore.read(target.identity);
1825
- const activeModel = selectedModel ?? binding?.model;
1844
+ const activeModel = target.identity.kind === "conversation" ? binding?.model : selectedModel ?? binding?.model;
1826
1845
  return activeModel ? `Codex model: ${formatCodexDisplayText(activeModel)}` : "Usage: /codex model <model>";
1827
1846
  }
1828
1847
  return await deps.setCodexConversationModel({
@@ -1831,12 +1850,7 @@ async function setConversationModel(deps, ctx, pluginConfig, args) {
1831
1850
  pluginConfig,
1832
1851
  model: normalized,
1833
1852
  agentDir: target.agentDir,
1834
- config: ctx.config,
1835
- ...ctx.sessionId && ctx.sessionKey ? { session: {
1836
- agentId: target.agentId,
1837
- sessionId: ctx.sessionId,
1838
- sessionKey: ctx.sessionKey
1839
- } } : {}
1853
+ config: ctx.config
1840
1854
  });
1841
1855
  }
1842
1856
  async function setConversationFastMode(deps, ctx, args) {
@@ -1855,14 +1869,19 @@ async function setConversationFastMode(deps, ctx, args) {
1855
1869
  async function setConversationPermissions(deps, ctx, args) {
1856
1870
  if (args.length > 1) return "Usage: /codex permissions [default|yolo|status]";
1857
1871
  const target = await resolveControlTarget(ctx);
1858
- if (!target) return "Cannot set Codex permissions because this command did not include a stable binding identity.";
1872
+ if (!target || !ctx.sessionId || !ctx.sessionKey) return "Cannot set Codex permissions because this command did not include a complete session identity.";
1859
1873
  const value = args[0];
1860
1874
  const parsed = parseCodexPermissionsModeArg(value);
1861
1875
  if (value && !parsed && value.trim().toLowerCase() !== "status") return "Usage: /codex permissions [default|yolo|status]";
1876
+ if (parsed === "yolo" && !hasCodexAdminScope(ctx)) return CODEX_FULL_PERMISSIONS_AUTH_ERROR;
1862
1877
  return await deps.setCodexConversationPermissions({
1863
- identity: target.identity,
1864
- bindingStore: deps.bindingStore,
1865
- mode: parsed
1878
+ mode: parsed,
1879
+ config: ctx.config,
1880
+ session: {
1881
+ agentId: target.agentId,
1882
+ sessionId: ctx.sessionId,
1883
+ sessionKey: ctx.sessionKey
1884
+ }
1866
1885
  });
1867
1886
  }
1868
1887
  async function startThreadAction(deps, ctx, pluginConfig, kind, args) {
@@ -2276,6 +2295,14 @@ function formatPluginList(plugins, options = {}) {
2276
2295
  }
2277
2296
  //#endregion
2278
2297
  //#region extensions/codex/src/command-handlers.ts
2298
+ const CODEX_HOST_INSPECTION_SUBCOMMANDS = /* @__PURE__ */ new Set([
2299
+ "account",
2300
+ "mcp",
2301
+ "sessions",
2302
+ "skills",
2303
+ "status",
2304
+ "threads"
2305
+ ]);
2279
2306
  async function handleCodexSubcommand(ctx, options) {
2280
2307
  const deps = resolveCodexCommandDeps(options.deps);
2281
2308
  const args = splitArgs(ctx.args);
@@ -2283,6 +2310,7 @@ async function handleCodexSubcommand(ctx, options) {
2283
2310
  const [subcommand = "status", ...rest] = args;
2284
2311
  const normalized = subcommand.toLowerCase();
2285
2312
  if (normalized === "help") return { text: buildHelp() };
2313
+ if (CODEX_HOST_INSPECTION_SUBCOMMANDS.has(normalized) && !canMutateCodexHost(ctx)) return { text: CODEX_HOST_INSPECTION_AUTH_ERROR };
2286
2314
  if (CODEX_NATIVE_CONTROL_SUBCOMMANDS.has(normalized) && !returnsBeforeNativeCodexExecution(normalized, rest) && !isReadOnlyCodexGoalCommand(normalized, rest) && !canMutateCodexHost(ctx)) return { text: CODEX_NATIVE_EXECUTION_AUTH_ERROR };
2287
2315
  const sandboxBlock = resolveCodexNativeCommandSandboxBlock(ctx, normalized, rest);
2288
2316
  if (sandboxBlock) return { text: sandboxBlock };
@@ -0,0 +1,90 @@
1
+ import { i as resolveCodexAppServerRuntimeOptions, s as resolveCodexSupervisionAppServerRuntimeOptions } from "./config-giW8X0QA.js";
2
+ import { n as listCodexAppServerModels } from "./models-TS3HBU-q.js";
3
+ import { n as describeControlFailure, t as CODEX_CONTROL_METHODS } from "./capabilities-BRMh0aIq.js";
4
+ import { i as withCodexAppServerJsonClient, r as requestCodexAppServerJson } from "./request-DXXGHko0.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 };