@openclaw/codex 2026.5.16-beta.3 → 2026.5.16-beta.5

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.
@@ -1,9 +1,9 @@
1
- import { a as isCodexFastServiceTier, c as resolveCodexAppServerRuntimeOptions, r as codexSandboxPolicyForTurn } from "./config-3ATInASk.js";
1
+ import { a as isCodexFastServiceTier, c as resolveCodexAppServerRuntimeOptions, r as codexSandboxPolicyForTurn } from "./config-B5pq6hEz.js";
2
2
  import { t as isJsonObject } from "./protocol-C9UWI98H.js";
3
- import { r as CODEX_CONTROL_METHODS } from "./request-Czoa60Nt.js";
3
+ import { r as CODEX_CONTROL_METHODS } from "./request-XPjLayGw.js";
4
4
  import { r as formatCodexDisplayText } from "./command-formatters-BRW7_Nu7.js";
5
- import { i as getSharedCodexAppServerClient, u as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-CnbrvEfV.js";
6
- import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, r as normalizeCodexAppServerBindingModelProvider, t as clearCodexAppServerBinding } from "./session-binding-DbdVqMzW.js";
5
+ import { i as getSharedCodexAppServerClient, u as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-DlvmoLBJ.js";
6
+ import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, r as normalizeCodexAppServerBindingModelProvider, t as clearCodexAppServerBinding } from "./session-binding-DqApZIgD.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";
@@ -16,11 +16,13 @@ import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
16
16
  //#region extensions/codex/src/conversation-binding-data.ts
17
17
  const BINDING_DATA_VERSION = 1;
18
18
  function createCodexConversationBindingData(params) {
19
+ const agentDir = params.agentDir?.trim();
19
20
  return {
20
21
  kind: "codex-app-server-session",
21
22
  version: BINDING_DATA_VERSION,
22
23
  sessionFile: params.sessionFile,
23
- workspaceDir: params.workspaceDir
24
+ workspaceDir: params.workspaceDir,
25
+ ...agentDir ? { agentDir } : {}
24
26
  };
25
27
  }
26
28
  function createCodexCliNodeConversationBindingData(params) {
@@ -55,7 +57,8 @@ function readCodexConversationBindingDataRecord(data) {
55
57
  kind: "codex-app-server-session",
56
58
  version: BINDING_DATA_VERSION,
57
59
  sessionFile: data.sessionFile,
58
- workspaceDir: typeof data.workspaceDir === "string" && data.workspaceDir.trim() ? data.workspaceDir : process.cwd()
60
+ workspaceDir: typeof data.workspaceDir === "string" && data.workspaceDir.trim() ? data.workspaceDir : process.cwd(),
61
+ agentDir: typeof data.agentDir === "string" && data.agentDir.trim() ? data.agentDir : void 0
59
62
  };
60
63
  }
61
64
  function resolveCodexDefaultWorkspaceDir(pluginConfig) {
@@ -93,11 +96,13 @@ async function stopCodexConversationTurn(params) {
93
96
  message: "No active Codex run to stop."
94
97
  };
95
98
  const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.pluginConfig });
96
- const binding = await readCodexAppServerBinding(params.sessionFile);
99
+ const lookup = buildBindingLookup(params);
100
+ const binding = await readCodexAppServerBinding(params.sessionFile, lookup);
97
101
  await (await getSharedCodexAppServerClient({
98
102
  startOptions: runtime.start,
99
103
  timeoutMs: runtime.requestTimeoutMs,
100
- authProfileId: binding?.authProfileId
104
+ authProfileId: binding?.authProfileId,
105
+ ...lookup
101
106
  })).request("turn/interrupt", {
102
107
  threadId: active.threadId,
103
108
  turnId: active.turnId
@@ -119,11 +124,13 @@ async function steerCodexConversationTurn(params) {
119
124
  message: "No active Codex run to steer."
120
125
  };
121
126
  const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.pluginConfig });
122
- const binding = await readCodexAppServerBinding(params.sessionFile);
127
+ const lookup = buildBindingLookup(params);
128
+ const binding = await readCodexAppServerBinding(params.sessionFile, lookup);
123
129
  await (await getSharedCodexAppServerClient({
124
130
  startOptions: runtime.start,
125
131
  timeoutMs: runtime.requestTimeoutMs,
126
- authProfileId: binding?.authProfileId
132
+ authProfileId: binding?.authProfileId,
133
+ ...lookup
127
134
  })).request("turn/steer", {
128
135
  threadId: active.threadId,
129
136
  expectedTurnId: active.turnId,
@@ -141,12 +148,14 @@ async function steerCodexConversationTurn(params) {
141
148
  async function setCodexConversationModel(params) {
142
149
  const model = params.model.trim();
143
150
  if (!model) return "Usage: /codex model <model>";
144
- const binding = await requireThreadBinding(params.sessionFile);
151
+ const lookup = buildBindingLookup(params);
152
+ const binding = await requireThreadBinding(params.sessionFile, lookup);
145
153
  const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.pluginConfig });
146
154
  const response = await resumeThreadWithOverrides({
147
155
  pluginConfig: params.pluginConfig,
148
156
  threadId: binding.threadId,
149
157
  authProfileId: binding.authProfileId,
158
+ ...lookup,
150
159
  model
151
160
  });
152
161
  await writeCodexAppServerBinding(params.sessionFile, {
@@ -157,28 +166,30 @@ async function setCodexConversationModel(params) {
157
166
  approvalPolicy: binding.approvalPolicy,
158
167
  sandbox: binding.sandbox,
159
168
  serviceTier: binding.serviceTier ?? runtime.serviceTier
160
- });
169
+ }, lookup);
161
170
  return `Codex model set to ${formatCodexDisplayText(response.model ?? model)}.`;
162
171
  }
163
172
  async function setCodexConversationFastMode(params) {
164
- const binding = await requireThreadBinding(params.sessionFile);
173
+ const lookup = buildBindingLookup(params);
174
+ const binding = await requireThreadBinding(params.sessionFile, lookup);
165
175
  if (params.enabled == null) return `Codex fast mode: ${isCodexFastServiceTier(binding.serviceTier) ? "on" : "off"}.`;
166
176
  const serviceTier = params.enabled ? "priority" : "flex";
167
177
  await writeCodexAppServerBinding(params.sessionFile, {
168
178
  ...binding,
169
179
  serviceTier
170
- });
180
+ }, lookup);
171
181
  return `Codex fast mode ${params.enabled ? "enabled" : "disabled"}.`;
172
182
  }
173
183
  async function setCodexConversationPermissions(params) {
174
- const binding = await requireThreadBinding(params.sessionFile);
184
+ const lookup = buildBindingLookup(params);
185
+ const binding = await requireThreadBinding(params.sessionFile, lookup);
175
186
  if (!params.mode) return `Codex permissions: ${formatPermissionsMode(binding)}.`;
176
187
  const policy = permissionsForMode(params.mode);
177
188
  await writeCodexAppServerBinding(params.sessionFile, {
178
189
  ...binding,
179
190
  approvalPolicy: policy.approvalPolicy,
180
191
  sandbox: policy.sandbox
181
- });
192
+ }, lookup);
182
193
  return `Codex permissions set to ${params.mode === "yolo" ? "full access" : "default"}.`;
183
194
  }
184
195
  function parseCodexFastModeArg(arg) {
@@ -196,8 +207,8 @@ function parseCodexPermissionsModeArg(arg) {
196
207
  function formatPermissionsMode(binding) {
197
208
  return binding.approvalPolicy === "never" && binding.sandbox === "danger-full-access" ? "full access" : "default";
198
209
  }
199
- async function requireThreadBinding(sessionFile) {
200
- const binding = await readCodexAppServerBinding(sessionFile);
210
+ async function requireThreadBinding(sessionFile, lookup = {}) {
211
+ const binding = await readCodexAppServerBinding(sessionFile, lookup);
201
212
  if (!binding?.threadId) throw new Error("No Codex thread is attached to this OpenClaw session yet.");
202
213
  return binding;
203
214
  }
@@ -206,7 +217,8 @@ async function resumeThreadWithOverrides(params) {
206
217
  return await (await getSharedCodexAppServerClient({
207
218
  startOptions: runtime.start,
208
219
  timeoutMs: runtime.requestTimeoutMs,
209
- authProfileId: params.authProfileId
220
+ authProfileId: params.authProfileId,
221
+ ...buildBindingLookup(params)
210
222
  })).request(CODEX_CONTROL_METHODS.resumeThread, {
211
223
  threadId: params.threadId,
212
224
  ...params.model ? { model: params.model } : {},
@@ -217,6 +229,13 @@ async function resumeThreadWithOverrides(params) {
217
229
  persistExtendedHistory: true
218
230
  }, { timeoutMs: runtime.requestTimeoutMs });
219
231
  }
232
+ function buildBindingLookup(params) {
233
+ const agentDir = params.agentDir?.trim();
234
+ return {
235
+ ...agentDir ? { agentDir } : {},
236
+ ...params.config ? { config: params.config } : {}
237
+ };
238
+ }
220
239
  function permissionsForMode(mode) {
221
240
  return mode === "yolo" ? {
222
241
  approvalPolicy: "never",
@@ -438,16 +457,22 @@ function getGlobalState() {
438
457
  }
439
458
  async function startCodexConversationThread(params) {
440
459
  const workspaceDir = params.workspaceDir?.trim() || resolveCodexDefaultWorkspaceDir(params.pluginConfig);
441
- const existingBinding = await readCodexAppServerBinding(params.sessionFile, { config: params.config });
460
+ const agentDir = params.agentDir?.trim();
461
+ const agentLookup = buildAgentLookup({
462
+ agentDir,
463
+ config: params.config
464
+ });
465
+ const existingBinding = await readCodexAppServerBinding(params.sessionFile, { ...agentLookup });
442
466
  const authProfileId = resolveCodexAppServerAuthProfileIdForAgent({
443
467
  authProfileId: params.authProfileId ?? existingBinding?.authProfileId,
444
- config: params.config
468
+ ...agentLookup
445
469
  });
446
470
  if (params.threadId?.trim()) await attachExistingThread({
447
471
  pluginConfig: params.pluginConfig,
448
472
  sessionFile: params.sessionFile,
449
473
  threadId: params.threadId.trim(),
450
474
  workspaceDir,
475
+ ...agentDir ? { agentDir } : {},
451
476
  model: params.model,
452
477
  modelProvider: params.modelProvider,
453
478
  authProfileId,
@@ -460,6 +485,7 @@ async function startCodexConversationThread(params) {
460
485
  pluginConfig: params.pluginConfig,
461
486
  sessionFile: params.sessionFile,
462
487
  workspaceDir,
488
+ ...agentDir ? { agentDir } : {},
463
489
  model: params.model,
464
490
  modelProvider: params.modelProvider,
465
491
  authProfileId,
@@ -470,7 +496,8 @@ async function startCodexConversationThread(params) {
470
496
  });
471
497
  return createCodexConversationBindingData({
472
498
  sessionFile: params.sessionFile,
473
- workspaceDir
499
+ workspaceDir,
500
+ ...agentDir ? { agentDir } : {}
474
501
  });
475
502
  }
476
503
  async function handleCodexConversationInboundClaim(event, ctx, options = {}) {
@@ -531,15 +558,20 @@ async function handleCodexConversationBindingResolved(event) {
531
558
  }
532
559
  async function attachExistingThread(params) {
533
560
  const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.pluginConfig });
561
+ const agentLookup = buildAgentLookup({
562
+ agentDir: params.agentDir,
563
+ config: params.config
564
+ });
534
565
  const modelProvider = resolveThreadRequestModelProvider({
535
566
  authProfileId: params.authProfileId,
536
567
  modelProvider: params.modelProvider,
537
- config: params.config
568
+ ...agentLookup
538
569
  });
539
570
  const response = await (await getSharedCodexAppServerClient({
540
571
  startOptions: runtime.start,
541
572
  timeoutMs: runtime.requestTimeoutMs,
542
- authProfileId: params.authProfileId
573
+ authProfileId: params.authProfileId,
574
+ ...agentLookup
543
575
  })).request(CODEX_CONTROL_METHODS.resumeThread, {
544
576
  threadId: params.threadId,
545
577
  ...params.model ? { model: params.model } : {},
@@ -558,26 +590,31 @@ async function attachExistingThread(params) {
558
590
  authProfileId: params.authProfileId,
559
591
  model: response.model ?? params.model,
560
592
  modelProvider: normalizeCodexAppServerBindingModelProvider({
561
- config: params.config,
562
593
  authProfileId: params.authProfileId,
563
- modelProvider: response.modelProvider ?? params.modelProvider
594
+ modelProvider: response.modelProvider ?? params.modelProvider,
595
+ ...agentLookup
564
596
  }),
565
597
  approvalPolicy: params.approvalPolicy ?? runtimeApprovalPolicy,
566
598
  sandbox: params.sandbox ?? runtime.sandbox,
567
599
  serviceTier: params.serviceTier ?? runtime.serviceTier
568
- }, { config: params.config });
600
+ }, { ...agentLookup });
569
601
  }
570
602
  async function createThread(params) {
571
603
  const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.pluginConfig });
604
+ const agentLookup = buildAgentLookup({
605
+ agentDir: params.agentDir,
606
+ config: params.config
607
+ });
572
608
  const modelProvider = resolveThreadRequestModelProvider({
573
609
  authProfileId: params.authProfileId,
574
610
  modelProvider: params.modelProvider,
575
- config: params.config
611
+ ...agentLookup
576
612
  });
577
613
  const response = await (await getSharedCodexAppServerClient({
578
614
  startOptions: runtime.start,
579
615
  timeoutMs: runtime.requestTimeoutMs,
580
- authProfileId: params.authProfileId
616
+ authProfileId: params.authProfileId,
617
+ ...agentLookup
581
618
  })).request("thread/start", {
582
619
  cwd: params.workspaceDir,
583
620
  ...params.model ? { model: params.model } : {},
@@ -597,24 +634,26 @@ async function createThread(params) {
597
634
  authProfileId: params.authProfileId,
598
635
  model: response.model ?? params.model,
599
636
  modelProvider: normalizeCodexAppServerBindingModelProvider({
600
- config: params.config,
601
637
  authProfileId: params.authProfileId,
602
- modelProvider: response.modelProvider ?? params.modelProvider
638
+ modelProvider: response.modelProvider ?? params.modelProvider,
639
+ ...agentLookup
603
640
  }),
604
641
  approvalPolicy: params.approvalPolicy ?? runtimeApprovalPolicy,
605
642
  sandbox: params.sandbox ?? runtime.sandbox,
606
643
  serviceTier: params.serviceTier ?? runtime.serviceTier
607
- }, { config: params.config });
644
+ }, { ...agentLookup });
608
645
  }
609
646
  async function runBoundTurn(params) {
610
647
  const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.pluginConfig });
611
- const binding = await readCodexAppServerBinding(params.data.sessionFile);
648
+ const agentLookup = buildAgentLookup({ agentDir: params.data.agentDir });
649
+ const binding = await readCodexAppServerBinding(params.data.sessionFile, agentLookup);
612
650
  const threadId = binding?.threadId;
613
651
  if (!threadId) throw new Error("bound Codex conversation has no thread binding");
614
652
  const client = await getSharedCodexAppServerClient({
615
653
  startOptions: runtime.start,
616
654
  timeoutMs: runtime.requestTimeoutMs,
617
- authProfileId: binding.authProfileId
655
+ authProfileId: binding.authProfileId,
656
+ ...agentLookup
618
657
  });
619
658
  const collector = createCodexConversationTurnCollector(threadId);
620
659
  const notificationCleanup = client.addNotificationHandler((notification) => collector.handleNotification(notification));
@@ -670,11 +709,13 @@ async function runBoundTurnWithMissingThreadRecovery(params) {
670
709
  return await runBoundTurn(params);
671
710
  } catch (error) {
672
711
  if (!isCodexThreadNotFoundError(error)) throw error;
673
- const binding = await readCodexAppServerBinding(params.data.sessionFile);
712
+ const agentLookup = buildAgentLookup({ agentDir: params.data.agentDir });
713
+ const binding = await readCodexAppServerBinding(params.data.sessionFile, agentLookup);
674
714
  await startCodexConversationThread({
675
715
  pluginConfig: params.pluginConfig,
676
716
  sessionFile: params.data.sessionFile,
677
717
  workspaceDir: binding?.cwd || params.data.workspaceDir,
718
+ ...agentLookup,
678
719
  model: binding?.model,
679
720
  modelProvider: binding?.modelProvider,
680
721
  authProfileId: binding?.authProfileId,
@@ -704,6 +745,13 @@ function resolveThreadRequestModelProvider(params) {
704
745
  if (isCodexAppServerNativeAuthProfile(params) && (modelProvider.toLowerCase() === "openai" || modelProvider.toLowerCase() === "openai-codex")) return;
705
746
  return modelProvider.toLowerCase() === "openai-codex" ? "openai" : modelProvider;
706
747
  }
748
+ function buildAgentLookup(params) {
749
+ const agentDir = params.agentDir?.trim();
750
+ return {
751
+ ...agentDir ? { agentDir } : {},
752
+ ...params.config ? { config: params.config } : {}
753
+ };
754
+ }
707
755
  //#endregion
708
756
  //#region extensions/codex/src/node-cli-sessions.ts
709
757
  const CODEX_CLI_SESSIONS_LIST_COMMAND = "codex.cli.sessions.list";
@@ -1,4 +1,4 @@
1
- import { t as CODEX_PLUGINS_MARKETPLACE_NAME, u as resolveCodexPluginsPolicy } from "./config-3ATInASk.js";
1
+ import { t as CODEX_PLUGINS_MARKETPLACE_NAME, u as resolveCodexPluginsPolicy } from "./config-B5pq6hEz.js";
2
2
  import "node:fs/promises";
3
3
  import "node:path";
4
4
  var CodexAppInventoryCache = class {
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-3ATInASk.js";
2
+ import { c as resolveCodexAppServerRuntimeOptions, s as readCodexPluginConfig } from "./config-B5pq6hEz.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-BZLMz9WS.js").then((n) => n.r);
126
+ const { listCodexAppServerModels } = await import("./models-C1zn2RN0.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-CA7amCZ8.js";
2
- import { f as resolveCodexAppServerHomeDir, i as getSharedCodexAppServerClient, o as withTimeout, r as createIsolatedCodexAppServerClient } from "./shared-client-CnbrvEfV.js";
3
- import { i as buildCodexAppInventoryCacheKey } from "./plugin-activation-BDU4e-NA.js";
1
+ import { n as CodexAppServerRpcError } from "./client-6FkrXfaz.js";
2
+ import { f as resolveCodexAppServerHomeDir, i as getSharedCodexAppServerClient, o as withTimeout, r as createIsolatedCodexAppServerClient } from "./shared-client-DlvmoLBJ.js";
3
+ import { i as buildCodexAppInventoryCacheKey } from "./plugin-activation-B49xb7pI.js";
4
4
  import { createHash } from "node:crypto";
5
5
  //#region extensions/codex/src/app-server/capabilities.ts
6
6
  const CODEX_CONTROL_METHODS = {