@openclaw/codex 2026.5.14-beta.1 → 2026.5.14-beta.2

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.
@@ -0,0 +1,9 @@
1
+ //#region extensions/codex/src/app-server/client-factory.ts
2
+ const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => import("./shared-client-BwUqd3lh.js").then((n) => n.a).then(({ getSharedCodexAppServerClient }) => getSharedCodexAppServerClient({
3
+ startOptions,
4
+ authProfileId,
5
+ agentDir,
6
+ config
7
+ }));
8
+ //#endregion
9
+ export { defaultCodexAppServerClientFactory as t };
@@ -26,9 +26,13 @@ function shouldRefreshCodexRateLimitsForUsageLimitMessage(message) {
26
26
  return Boolean(text?.includes("You've reached your Codex subscription usage limit.") && !text.includes("Next reset "));
27
27
  }
28
28
  function summarizeCodexRateLimits(value, nowMs = Date.now()) {
29
- const snapshots = collectCodexRateLimitSnapshots(value);
29
+ const snapshots = collectCodexRateLimitSnapshots(value).filter(snapshotHasDisplayableData);
30
30
  if (snapshots.length === 0) return;
31
- return snapshots.slice(0, 4).map((snapshot) => summarizeRateLimitSnapshot(snapshot, nowMs)).join("; ");
31
+ const summaries = snapshots.slice(0, 4).map((snapshot) => summarizeRateLimitSnapshot(snapshot, nowMs)).filter((summary) => summary !== void 0);
32
+ return summaries.length > 0 ? summaries.join("; ") : void 0;
33
+ }
34
+ function hasCodexRateLimitSnapshots(value) {
35
+ return collectCodexRateLimitSnapshots(value).length > 0;
32
36
  }
33
37
  function summarizeCodexAccountRateLimits(value, nowMs = Date.now()) {
34
38
  const summary = summarizeCodexAccountUsage(value, nowMs);
@@ -40,7 +44,7 @@ function resolveCodexUsageLimitResetAtMs(value, nowMs = Date.now()) {
40
44
  return selectBlockingRateLimitReset(value, nowMs)?.resetsAtMs;
41
45
  }
42
46
  function summarizeCodexAccountUsage(value, nowMs = Date.now()) {
43
- const snapshots = collectCodexRateLimitSnapshots(value);
47
+ const snapshots = collectCodexRateLimitSnapshots(value).filter(snapshotHasDisplayableData);
44
48
  if (snapshots.length === 0) return;
45
49
  const usageSnapshot = snapshots.find(isCodexLimitSnapshot) ?? snapshots[0];
46
50
  const blockedSnapshots = snapshots.filter(snapshotHasLimitBlock);
@@ -86,7 +90,8 @@ function summarizeRateLimitSnapshot(snapshot, nowMs) {
86
90
  });
87
91
  const reachedType = readString$1(snapshot, "rateLimitReachedType") ?? readString$1(snapshot, "rate_limit_reached_type");
88
92
  const suffix = reachedType ? ` (${formatReachedType(reachedType)})` : "";
89
- return `${label}: ${windows.join(" · ") || "available"}${suffix}`;
93
+ if (windows.length > 0) return `${label}: ${windows.join(" · ")}${suffix}`;
94
+ if (reachedType) return `${label}: ${formatReachedType(reachedType)}`;
90
95
  }
91
96
  function collectCodexRateLimitSnapshots(value) {
92
97
  const snapshots = [];
@@ -143,6 +148,10 @@ function readRateLimitWindow(snapshot, key) {
143
148
  ...readOptionalNumberField(window, "windowDurationMins", "window_duration_mins", "windowMinutes", "window_minutes")
144
149
  };
145
150
  }
151
+ function snapshotHasDisplayableData(snapshot) {
152
+ if (readString$1(snapshot, "rateLimitReachedType") ?? readString$1(snapshot, "rate_limit_reached_type")) return true;
153
+ return readWindowEntries(snapshot).some((entry) => entry.window.usedPercent !== void 0 || entry.window.resetsAtMs > 0);
154
+ }
146
155
  function readOptionalNumberField(record, ...keys) {
147
156
  const value = keys.map((key) => readNumber(record, key)).find((entry) => entry !== void 0);
148
157
  if (value === void 0) return {};
@@ -454,11 +463,13 @@ function summarizeArrayLike(value) {
454
463
  return `${entries.length}`;
455
464
  }
456
465
  function formatCodexRateLimitSummary(value) {
457
- return formatCodexDisplayText(summarizeCodexRateLimits(value) ?? summarizeRateLimits(value));
466
+ const summary = summarizeCodexRateLimits(value);
467
+ if (summary) return formatCodexDisplayText(summary);
468
+ return formatCodexDisplayText(hasCodexRateLimitSnapshots(value) ? "none returned" : summarizeRateLimits(value));
458
469
  }
459
470
  function formatCodexRateLimitDetails(value) {
460
471
  const lines = summarizeCodexAccountRateLimits(value);
461
- if (!lines) return formatCodexDisplayText(summarizeRateLimits(value));
472
+ if (!lines) return formatCodexDisplayText(hasCodexRateLimitSnapshots(value) ? "none returned" : summarizeRateLimits(value));
462
473
  return lines.map(formatCodexDisplayText).join("\n");
463
474
  }
464
475
  function summarizeRateLimits(value) {
@@ -1,12 +1,12 @@
1
1
  import { i as isCodexFastServiceTier, s as resolveCodexAppServerRuntimeOptions } from "./config-0rd3LnKg.js";
2
2
  import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-GCYf5s8J.js";
3
3
  import { t as isJsonObject } from "./protocol-C9UWI98H.js";
4
- import { n as CODEX_CONTROL_METHODS, r as describeControlFailure, t as requestCodexAppServerJson } from "./request-BxAP1uyw.js";
5
- import { a as formatComputerUseStatus, c as formatThreads, i as formatCodexStatus, l as readString$1, n as formatAccount, o as formatList, p as summarizeCodexAccountUsage, r as formatCodexDisplayText, s as formatModels, t as buildHelp } from "./command-formatters-CJH9-hFT.js";
4
+ import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-CKYiRqsN.js";
5
+ import { a as formatComputerUseStatus, c as formatThreads, i as formatCodexStatus, l as readString$1, n as formatAccount, o as formatList, p as summarizeCodexAccountUsage, r as formatCodexDisplayText, s as formatModels, t as buildHelp } from "./command-formatters-DRJaVHhN.js";
6
6
  import { i as readCodexAppServerBinding, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-CMTXuyoz.js";
7
- import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, l as startCodexConversationThread, m as setCodexConversationFastMode, p as readCodexConversationActiveTurn, r as formatCodexCliSessions, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./node-cli-sessions-CV5Kmdwt.js";
8
- import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-DFdLwPQa.js";
9
- import { n as rememberCodexRateLimits } from "./rate-limit-cache-BFi-50LG.js";
7
+ import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, l as startCodexConversationThread, m as setCodexConversationFastMode, p as readCodexConversationActiveTurn, r as formatCodexCliSessions, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./node-cli-sessions-CiexDHeV.js";
8
+ import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-DsJxRRtm.js";
9
+ import { n as rememberCodexRateLimits } from "./rate-limit-cache-dvhq-4pi.js";
10
10
  import crypto from "node:crypto";
11
11
  import { ensureAuthProfileStore, findNormalizedProviderValue, resolveAuthProfileEligibility, resolveAuthProfileOrder, resolveDefaultAgentDir, resolveProfileUnusableUntilForDisplay } from "openclaw/plugin-sdk/agent-runtime";
12
12
  //#region extensions/codex/src/command-account.ts
@@ -1,11 +1,10 @@
1
1
  import { s as resolveCodexAppServerRuntimeOptions } from "./config-0rd3LnKg.js";
2
2
  import { t as isJsonObject } from "./protocol-C9UWI98H.js";
3
3
  import { i as readCodexAppServerBinding } from "./session-binding-CMTXuyoz.js";
4
- import { n as defaultCodexAppServerClientFactory, t as createCodexAppServerClientFactoryTestHooks } from "./client-factory-BB5hgnWH.js";
4
+ import { t as defaultCodexAppServerClientFactory } from "./client-factory-Be6RD28K.js";
5
5
  import { embeddedAgentLog, formatErrorMessage, isActiveHarnessContextEngine, runHarnessContextEngineMaintenance } from "openclaw/plugin-sdk/agent-harness-runtime";
6
6
  //#region extensions/codex/src/app-server/compact.ts
7
7
  const DEFAULT_CODEX_COMPACTION_WAIT_TIMEOUT_MS = 300 * 1e3;
8
- let clientFactory = defaultCodexAppServerClientFactory;
9
8
  async function maybeCompactCodexAppServerSession(params, options = {}) {
10
9
  const activeContextEngine = isActiveHarnessContextEngine(params.contextEngine) ? params.contextEngine : void 0;
11
10
  if (activeContextEngine?.info.ownsCompaction) {
@@ -77,7 +76,7 @@ async function compactCodexNativeThread(params, options = {}) {
77
76
  compacted: false,
78
77
  reason: "auth profile mismatch for session binding"
79
78
  };
80
- const client = await clientFactory(appServer.start, requestedAuthProfileId ?? binding.authProfileId, params.agentDir, params.config);
79
+ const client = await (options.clientFactory ?? defaultCodexAppServerClientFactory)(appServer.start, requestedAuthProfileId ?? binding.authProfileId, params.agentDir, params.config);
81
80
  const waiter = createCodexNativeCompactionWaiter(client, binding.threadId);
82
81
  let completion;
83
82
  try {
@@ -253,8 +252,5 @@ function formatCompactionError(error) {
253
252
  if (error instanceof Error) return error.message;
254
253
  return String(error);
255
254
  }
256
- createCodexAppServerClientFactoryTestHooks((factory) => {
257
- clientFactory = factory;
258
- });
259
255
  //#endregion
260
256
  export { maybeCompactCodexAppServerSession };
@@ -1,5 +1,5 @@
1
1
  import { c as resolveCodexComputerUseConfig, s as resolveCodexAppServerRuntimeOptions } from "./config-0rd3LnKg.js";
2
- import { r as describeControlFailure, t as requestCodexAppServerJson } from "./request-BxAP1uyw.js";
2
+ import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-CKYiRqsN.js";
3
3
  import { existsSync } from "node:fs";
4
4
  //#region extensions/codex/src/app-server/computer-use.ts
5
5
  var CodexComputerUseSetupError = class extends Error {
package/dist/harness.js CHANGED
@@ -18,15 +18,15 @@ function createCodexAppServerAgentHarness(options) {
18
18
  };
19
19
  },
20
20
  runAttempt: async (params) => {
21
- const { runCodexAppServerAttempt } = await import("./run-attempt-CN9AS7qv.js");
21
+ const { runCodexAppServerAttempt } = await import("./run-attempt-DG9NQab2.js");
22
22
  return runCodexAppServerAttempt(params, { pluginConfig: options?.pluginConfig });
23
23
  },
24
24
  runSideQuestion: async (params) => {
25
- const { runCodexAppServerSideQuestion } = await import("./side-question-BsBqLpar.js");
25
+ const { runCodexAppServerSideQuestion } = await import("./side-question-CVWPOkY-.js");
26
26
  return runCodexAppServerSideQuestion(params, { pluginConfig: options?.pluginConfig });
27
27
  },
28
28
  compact: async (params) => {
29
- const { maybeCompactCodexAppServerSession } = await import("./compact-Ck9ckRkJ.js");
29
+ const { maybeCompactCodexAppServerSession } = await import("./compact-DWa8cylR.js");
30
30
  return maybeCompactCodexAppServerSession(params, { pluginConfig: options?.pluginConfig });
31
31
  },
32
32
  reset: async (params) => {
package/dist/index.js CHANGED
@@ -2,12 +2,11 @@ import { createCodexAppServerAgentHarness } from "./harness.js";
2
2
  import { o as readCodexPluginConfig, s as resolveCodexAppServerRuntimeOptions, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config-0rd3LnKg.js";
3
3
  import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
4
4
  import { buildCodexProvider } from "./provider.js";
5
- import { r as describeControlFailure, t as requestCodexAppServerJson } from "./request-BxAP1uyw.js";
6
- import { r as formatCodexDisplayText } from "./command-formatters-CJH9-hFT.js";
5
+ import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-CKYiRqsN.js";
6
+ import { r as formatCodexDisplayText } from "./command-formatters-DRJaVHhN.js";
7
7
  import { c as resolveCodexAppServerAuthAccountCacheKey, d as resolveCodexAppServerEnvApiKeyCacheKey, i as getSharedCodexAppServerClient, t as clearSharedCodexAppServerClientAndWait, u as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-BwUqd3lh.js";
8
- import { a as resolveCodexCliSessionForBindingOnNode, c as handleCodexConversationInboundClaim, i as listCodexCliSessionsOnNode, n as createCodexCliSessionNodeInvokePolicies, o as resumeCodexCliSessionOnNode, s as handleCodexConversationBindingResolved, t as createCodexCliSessionNodeHostCommands } from "./node-cli-sessions-CV5Kmdwt.js";
9
- import { a as defaultCodexAppInventoryCache, n as pluginReadParams, t as ensureCodexPluginActivation } from "./plugin-activation-PXGqUjwY.js";
10
- import { t as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-DBlqE0gO.js";
8
+ import { a as resolveCodexCliSessionForBindingOnNode, c as handleCodexConversationInboundClaim, i as listCodexCliSessionsOnNode, n as createCodexCliSessionNodeInvokePolicies, o as resumeCodexCliSessionOnNode, s as handleCodexConversationBindingResolved, t as createCodexCliSessionNodeHostCommands } from "./node-cli-sessions-CiexDHeV.js";
9
+ import { a as defaultCodexAppInventoryCache, n as pluginReadParams, t as ensureCodexPluginActivation } from "./plugin-activation-aQOmRQwA.js";
11
10
  import { resolveLivePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
12
11
  import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
13
12
  import os from "node:os";
@@ -39,7 +38,7 @@ async function handleCodexCommand(ctx, options = {}) {
39
38
  }
40
39
  }
41
40
  async function loadDefaultCodexSubcommandHandler() {
42
- const { handleCodexSubcommand } = await import("./command-handlers-DIXo49aO.js");
41
+ const { handleCodexSubcommand } = await import("./command-handlers-CXxykxjq.js");
43
42
  return handleCodexSubcommand;
44
43
  }
45
44
  //#endregion
@@ -725,11 +724,8 @@ async function buildCodexMigrationPlan(ctx) {
725
724
  }));
726
725
  const warnings = [
727
726
  ...items.some((item) => item.status === "conflict") ? ["Conflicts were found. Re-run with --overwrite to replace conflicting migration targets after item-level backups."] : [],
728
- ...source.plugins.some((plugin) => plugin.migratable) ? ["Codex source-installed openai-curated plugins are planned for native activation; cached plugin bundles remain manual-review only."] : [],
729
- ...source.plugins.some((plugin) => plugin.migratable && plugin.apps && plugin.apps.length > 0) && !shouldVerifyPluginApps(ctx) ? ["Codex app-backed plugins were planned without source app accessibility verification. Re-run with --verify-plugin-apps to force a fresh source app/list check before planning native plugin activation."] : [],
730
727
  ...source.pluginDiscoveryError ? [`Codex app-server plugin inventory discovery failed: ${source.pluginDiscoveryError}. Cached plugin bundles, if any, are advisory only.`] : [],
731
- ...source.plugins.some((plugin) => plugin.migrationBlock?.code === "codex_subscription_required") ? [codexPluginMigrationSubscriptionWarning()] : [],
732
- ...source.archivePaths.length > 0 ? ["Codex config and hook files are archive-only. They are preserved in the migration report, not loaded into OpenClaw automatically."] : []
728
+ ...source.plugins.some((plugin) => plugin.migrationBlock?.code === "codex_subscription_required") ? [codexPluginMigrationSubscriptionWarning()] : []
733
729
  ];
734
730
  return {
735
731
  providerId: "codex",
@@ -1,7 +1,7 @@
1
1
  import { i as isCodexFastServiceTier, r as codexSandboxPolicyForTurn, s as resolveCodexAppServerRuntimeOptions } from "./config-0rd3LnKg.js";
2
2
  import { t as isJsonObject } from "./protocol-C9UWI98H.js";
3
- import { n as CODEX_CONTROL_METHODS } from "./request-BxAP1uyw.js";
4
- import { r as formatCodexDisplayText } from "./command-formatters-CJH9-hFT.js";
3
+ import { r as CODEX_CONTROL_METHODS } from "./request-CKYiRqsN.js";
4
+ import { r as formatCodexDisplayText } from "./command-formatters-DRJaVHhN.js";
5
5
  import { i as getSharedCodexAppServerClient, u as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-BwUqd3lh.js";
6
6
  import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, r as normalizeCodexAppServerBindingModelProvider, t as clearCodexAppServerBinding } from "./session-binding-CMTXuyoz.js";
7
7
  import os from "node:os";
@@ -313,8 +313,12 @@ function marketplaceRef(marketplace) {
313
313
  //#region extensions/codex/src/app-server/plugin-activation.ts
314
314
  async function ensureCodexPluginActivation(params) {
315
315
  if (params.identity.marketplaceName !== "openai-curated") return activationFailure(params.identity, "marketplace_missing", { message: "Only " + CODEX_PLUGINS_MARKETPLACE_NAME + " plugins can be activated." });
316
- const resolved = findOpenAiCuratedPluginSummary(await params.request("plugin/list", { cwds: [] }), params.identity.pluginName);
317
- if (!resolved) return activationFailure(params.identity, "plugin_missing", { message: `${params.identity.pluginName} was not found in ${CODEX_PLUGINS_MARKETPLACE_NAME}.` });
316
+ const listed = await params.request("plugin/list", { cwds: [] });
317
+ const resolved = findOpenAiCuratedPluginSummary(listed, params.identity.pluginName);
318
+ if (!resolved) {
319
+ if (!listed.marketplaces.some((marketplace) => marketplace.name === "openai-curated")) return activationFailure(params.identity, "marketplace_missing", { message: `Codex marketplace ${CODEX_PLUGINS_MARKETPLACE_NAME} was not found.` });
320
+ return activationFailure(params.identity, "plugin_missing", { message: `${params.identity.pluginName} was not found in ${CODEX_PLUGINS_MARKETPLACE_NAME}.` });
321
+ }
318
322
  if (resolved.summary.installed && resolved.summary.enabled && !params.installEvenIfActive) return {
319
323
  identity: params.identity,
320
324
  ok: true,
@@ -1,6 +1,27 @@
1
- import { f as resolveCodexAppServerHomeDir } from "./shared-client-BwUqd3lh.js";
2
- import { i as buildCodexAppInventoryCacheKey } from "./plugin-activation-PXGqUjwY.js";
1
+ import { n as CodexAppServerRpcError } from "./client-CoctX13d.js";
2
+ import { f as resolveCodexAppServerHomeDir, i as getSharedCodexAppServerClient, o as withTimeout, r as createIsolatedCodexAppServerClient } from "./shared-client-BwUqd3lh.js";
3
+ import { i as buildCodexAppInventoryCacheKey } from "./plugin-activation-aQOmRQwA.js";
3
4
  import { createHash } from "node:crypto";
5
+ //#region extensions/codex/src/app-server/capabilities.ts
6
+ const CODEX_CONTROL_METHODS = {
7
+ account: "account/read",
8
+ compact: "thread/compact/start",
9
+ feedback: "feedback/upload",
10
+ listMcpServers: "mcpServerStatus/list",
11
+ listSkills: "skills/list",
12
+ listThreads: "thread/list",
13
+ rateLimits: "account/rateLimits/read",
14
+ resumeThread: "thread/resume",
15
+ review: "review/start"
16
+ };
17
+ function describeControlFailure(error) {
18
+ if (isUnsupportedControlError(error)) return "unsupported by this Codex app-server";
19
+ return error instanceof Error ? error.message : String(error);
20
+ }
21
+ function isUnsupportedControlError(error) {
22
+ return error instanceof CodexAppServerRpcError && error.code === -32601;
23
+ }
24
+ //#endregion
4
25
  //#region extensions/codex/src/app-server/plugin-app-cache-key.ts
5
26
  function buildCodexPluginAppCacheKey(params) {
6
27
  return buildCodexAppInventoryCacheKey({
@@ -43,4 +64,26 @@ function fingerprintCodexPluginAppCacheCredentials(startOptions) {
43
64
  return `sha256:${hash.digest("hex")}`;
44
65
  }
45
66
  //#endregion
46
- export { buildCodexPluginAppCacheKey as t };
67
+ //#region extensions/codex/src/app-server/request.ts
68
+ async function requestCodexAppServerJson(params) {
69
+ const timeoutMs = params.timeoutMs ?? 6e4;
70
+ return await withTimeout((async () => {
71
+ const client = await (params.isolated ? createIsolatedCodexAppServerClient : getSharedCodexAppServerClient)({
72
+ startOptions: params.startOptions,
73
+ timeoutMs,
74
+ authProfileId: params.authProfileId,
75
+ agentDir: params.agentDir,
76
+ config: params.config
77
+ });
78
+ try {
79
+ return await client.request(params.method, params.requestParams, { timeoutMs });
80
+ } finally {
81
+ if (params.isolated) await client.closeAndWait({
82
+ exitTimeoutMs: 2e3,
83
+ forceKillDelayMs: 250
84
+ });
85
+ }
86
+ })(), timeoutMs, `codex app-server ${params.method} timed out`);
87
+ }
88
+ //#endregion
89
+ export { describeControlFailure as i, buildCodexPluginAppCacheKey as n, CODEX_CONTROL_METHODS as r, requestCodexAppServerJson as t };
@@ -2,17 +2,16 @@ import { l as resolveCodexPluginsPolicy, o as readCodexPluginConfig, s as resolv
2
2
  import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse } from "./protocol-validators-CSY0BFBo.js";
3
3
  import { t as isJsonObject } from "./protocol-C9UWI98H.js";
4
4
  import { i as isCodexAppServerConnectionClosedError, r as isCodexAppServerApprovalRequest } from "./client-CoctX13d.js";
5
- import { n as CODEX_CONTROL_METHODS } from "./request-BxAP1uyw.js";
6
- import { d as resolveCodexUsageLimitResetAtMs, f as shouldRefreshCodexRateLimitsForUsageLimitMessage, r as formatCodexDisplayText, u as formatCodexUsageLimitErrorMessage } from "./command-formatters-CJH9-hFT.js";
5
+ import { n as buildCodexPluginAppCacheKey, r as CODEX_CONTROL_METHODS } from "./request-CKYiRqsN.js";
6
+ import { d as resolveCodexUsageLimitResetAtMs, f as shouldRefreshCodexRateLimitsForUsageLimitMessage, r as formatCodexDisplayText, u as formatCodexUsageLimitErrorMessage } from "./command-formatters-DRJaVHhN.js";
7
7
  import { c as resolveCodexAppServerAuthAccountCacheKey, d as resolveCodexAppServerEnvApiKeyCacheKey, l as resolveCodexAppServerAuthProfileId, n as clearSharedCodexAppServerClientIfCurrent, s as refreshCodexAppServerAuthTokens, u as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-BwUqd3lh.js";
8
8
  import { i as readCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-CMTXuyoz.js";
9
- import { a as defaultCodexAppInventoryCache } from "./plugin-activation-PXGqUjwY.js";
10
- import { t as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-DBlqE0gO.js";
11
- import { _ as resolveCodexContextEngineProjectionReserveTokens, b as normalizeCodexDynamicToolName, d as buildCodexPluginThreadConfig, f as buildCodexPluginThreadConfigInputFingerprint, g as resolveCodexContextEngineProjectionMaxChars, h as projectContextEngineAssemblyForCodex, m as shouldBuildCodexPluginThreadConfig, o as buildTurnStartParams, p as mergeCodexThreadConfigs, r as buildDeveloperInstructions, s as codexDynamicToolsFingerprint, t as areCodexDynamicToolFingerprintsCompatible, u as startOrResumeThread, v as createCodexDynamicToolBridge, y as filterCodexDynamicTools } from "./thread-lifecycle-B_oezv_0.js";
12
- import { n as defaultCodexAppServerClientFactory } from "./client-factory-BB5hgnWH.js";
13
- import { n as handleCodexAppServerElicitationRequest, r as handleCodexAppServerApprovalRequest, t as filterToolsForVisionInputs } from "./vision-tools-cbM0WkCZ.js";
14
- import { t as ensureCodexComputerUse } from "./computer-use-DFdLwPQa.js";
15
- import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-BFi-50LG.js";
9
+ import { a as defaultCodexAppInventoryCache } from "./plugin-activation-aQOmRQwA.js";
10
+ import { _ as resolveCodexContextEngineProjectionReserveTokens, b as normalizeCodexDynamicToolName, d as buildCodexPluginThreadConfig, f as buildCodexPluginThreadConfigInputFingerprint, g as resolveCodexContextEngineProjectionMaxChars, h as projectContextEngineAssemblyForCodex, m as shouldBuildCodexPluginThreadConfig, o as buildTurnStartParams, p as mergeCodexThreadConfigs, r as buildDeveloperInstructions, s as codexDynamicToolsFingerprint, t as areCodexDynamicToolFingerprintsCompatible, u as startOrResumeThread, v as createCodexDynamicToolBridge, y as filterCodexDynamicTools } from "./thread-lifecycle-DrbViNpf.js";
11
+ import { t as defaultCodexAppServerClientFactory } from "./client-factory-Be6RD28K.js";
12
+ import { n as handleCodexAppServerElicitationRequest, r as handleCodexAppServerApprovalRequest, t as filterToolsForVisionInputs } from "./vision-tools-CzTdigBu.js";
13
+ import { t as ensureCodexComputerUse } from "./computer-use-DsJxRRtm.js";
14
+ import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-dvhq-4pi.js";
16
15
  import { createHash } from "node:crypto";
17
16
  import nodeFs from "node:fs";
18
17
  import { TOOL_PROGRESS_OUTPUT_MAX_CHARS, acquireSessionWriteLock, appendSessionTranscriptMessage, assembleHarnessContextEngine, bootstrapHarnessContextEngine, buildEmbeddedAttemptToolRunContext, buildHarnessContextEngineRuntimeContext, buildHarnessContextEngineRuntimeContextFromUsage, classifyAgentHarnessTerminalOutcome, clearActiveEmbeddedRun, embeddedAgentLog, emitAgentEvent, emitSessionTranscriptUpdate, finalizeHarnessContextEngineTurn, formatErrorMessage, formatToolAggregate, formatToolProgressOutput, inferToolMetaFromArgs, isActiveHarnessContextEngine, isSubagentSessionKey, loadCodexBundleMcpThreadConfig, normalizeAgentRuntimeTools, normalizeUsage, registerNativeHookRelay, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptSpawnWorkspaceDir, resolveBootstrapContextForRun, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, resolveSessionWriteLockAcquireTimeoutMs, resolveUserPath, runAgentCleanupStep, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessAgentEndHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, runHarnessContextEngineMaintenance, setActiveEmbeddedRun, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
@@ -20,7 +19,6 @@ import fs from "node:fs/promises";
20
19
  import path from "node:path";
21
20
  import { markAuthProfileBlockedUntil, resolveAgentDir as resolveAgentDir$1 } from "openclaw/plugin-sdk/agent-runtime";
22
21
  import { appendRegularFile, pathExists } from "openclaw/plugin-sdk/security-runtime";
23
- import { AsyncLocalStorage } from "node:async_hooks";
24
22
  import { emitTrustedDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
25
23
  import { createRunningTaskRun, finalizeTaskRunByRunId, recordTaskRunProgressByRunId } from "openclaw/plugin-sdk/codex-native-task-runtime";
26
24
  import { buildSessionContext, migrateSessionEntries, parseSessionEntries } from "@earendil-works/pi-coding-agent";
@@ -2132,12 +2130,7 @@ const CODEX_BOOTSTRAP_CONTEXT_ORDER = new Map([
2132
2130
  ["memory.md", 60],
2133
2131
  ["heartbeat.md", 70]
2134
2132
  ]);
2135
- const testClientFactoryStorage = new AsyncLocalStorage();
2136
- const clientFactory = defaultCodexAppServerClientFactory;
2137
2133
  let openClawCodingToolsFactoryForTests;
2138
- function resolveCodexAppServerClientFactory() {
2139
- return testClientFactoryStorage.getStore() ?? clientFactory;
2140
- }
2141
2134
  function emitCodexAppServerEvent(params, event) {
2142
2135
  try {
2143
2136
  emitAgentEvent({
@@ -2293,7 +2286,7 @@ function restrictCodexAppServerSandboxForOpenClawSandbox(appServer, sandbox) {
2293
2286
  }
2294
2287
  async function runCodexAppServerAttempt(params, options = {}) {
2295
2288
  const attemptStartedAt = Date.now();
2296
- const attemptClientFactory = resolveCodexAppServerClientFactory();
2289
+ const attemptClientFactory = options.clientFactory ?? defaultCodexAppServerClientFactory;
2297
2290
  const pluginConfig = readCodexPluginConfig(options.pluginConfig);
2298
2291
  const configuredAppServer = resolveCodexAppServerRuntimeOptions({ pluginConfig });
2299
2292
  const resolvedWorkspace = resolveUserPath(params.workspaceDir);
@@ -2384,6 +2377,11 @@ async function runCodexAppServerAttempt(params, options = {}) {
2384
2377
  });
2385
2378
  const hadSessionFile = await pathExists(params.sessionFile);
2386
2379
  let historyMessages = await readMirroredSessionHistoryMessages(params.sessionFile) ?? [];
2380
+ const hookContextWindowFields = {
2381
+ ...params.contextWindowInfo?.tokens ? { contextTokenBudget: params.contextWindowInfo.tokens } : params.contextTokenBudget ? { contextTokenBudget: params.contextTokenBudget } : {},
2382
+ ...params.contextWindowInfo?.source ? { contextWindowSource: params.contextWindowInfo.source } : {},
2383
+ ...params.contextWindowInfo?.referenceTokens ? { contextWindowReferenceTokens: params.contextWindowInfo.referenceTokens } : {}
2384
+ };
2387
2385
  const hookContext = {
2388
2386
  runId: params.runId,
2389
2387
  agentId: sessionAgentId,
@@ -2392,7 +2390,8 @@ async function runCodexAppServerAttempt(params, options = {}) {
2392
2390
  workspaceDir: params.workspaceDir,
2393
2391
  messageProvider: params.messageProvider ?? void 0,
2394
2392
  trigger: params.trigger,
2395
- channelId: params.messageChannel ?? params.messageProvider ?? void 0
2393
+ channelId: params.messageChannel ?? params.messageProvider ?? void 0,
2394
+ ...hookContextWindowFields
2396
2395
  };
2397
2396
  if (activeContextEngine) {
2398
2397
  await bootstrapHarnessContextEngine({
@@ -3174,6 +3173,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
3174
3173
  sessionId: params.sessionId,
3175
3174
  provider: params.provider,
3176
3175
  model: params.modelId,
3176
+ ...hookContextWindowFields,
3177
3177
  resolvedRef: params.runtimePlan?.observability.resolvedRef ?? `${params.provider}/${params.modelId}`,
3178
3178
  ...params.runtimePlan?.observability.harnessId ? { harnessId: params.runtimePlan.observability.harnessId } : {},
3179
3179
  assistantTexts: []
@@ -3373,6 +3373,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
3373
3373
  sessionId: params.sessionId,
3374
3374
  provider: params.provider,
3375
3375
  model: params.modelId,
3376
+ ...hookContextWindowFields,
3376
3377
  resolvedRef: params.runtimePlan?.observability.resolvedRef ?? `${params.provider}/${params.modelId}`,
3377
3378
  ...params.runtimePlan?.observability.harnessId ? { harnessId: params.runtimePlan.observability.harnessId } : {},
3378
3379
  assistantTexts: result.assistantTexts,
@@ -3723,7 +3724,7 @@ async function buildDynamicTools(input) {
3723
3724
  }), input.pluginConfig), {
3724
3725
  modelHasVision,
3725
3726
  hasInboundImages: (params.images?.length ?? 0) > 0
3726
- }), params.toolsAllow);
3727
+ }), includeForcedMessageToolAllow(params.toolsAllow, params));
3727
3728
  return normalizeAgentRuntimeTools({
3728
3729
  runtimePlan: params.runtimePlan,
3729
3730
  tools: filteredTools,
@@ -3736,6 +3737,12 @@ async function buildDynamicTools(input) {
3736
3737
  model: params.model
3737
3738
  });
3738
3739
  }
3740
+ function includeForcedMessageToolAllow(toolsAllow, params) {
3741
+ if (!shouldForceMessageTool(params)) return toolsAllow;
3742
+ if (toolsAllow === void 0) return toolsAllow;
3743
+ if (toolsAllow.length === 0) return ["message"];
3744
+ return new Set(toolsAllow.map((name) => normalizeCodexDynamicToolName(name))).has("message") ? toolsAllow : [...toolsAllow, "message"];
3745
+ }
3739
3746
  function filterCodexDynamicToolsForAllowlist(tools, toolsAllow) {
3740
3747
  if (!toolsAllow || toolsAllow.length === 0) return tools;
3741
3748
  const allowSet = new Set(toolsAllow.map((name) => normalizeCodexDynamicToolName(name)).filter(Boolean));
@@ -2,12 +2,12 @@ import { o as readCodexPluginConfig, s as resolveCodexAppServerRuntimeOptions }
2
2
  import { a as readCodexDynamicToolCallParams, i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, t as assertCodexThreadForkResponse } from "./protocol-validators-CSY0BFBo.js";
3
3
  import { t as isJsonObject } from "./protocol-C9UWI98H.js";
4
4
  import { r as isCodexAppServerApprovalRequest } from "./client-CoctX13d.js";
5
- import { u as formatCodexUsageLimitErrorMessage } from "./command-formatters-CJH9-hFT.js";
5
+ import { u as formatCodexUsageLimitErrorMessage } from "./command-formatters-DRJaVHhN.js";
6
6
  import { i as getSharedCodexAppServerClient, s as refreshCodexAppServerAuthTokens } from "./shared-client-BwUqd3lh.js";
7
7
  import { i as readCodexAppServerBinding } from "./session-binding-CMTXuyoz.js";
8
- import { c as resolveCodexAppServerModelProvider, l as resolveReasoningEffort, n as buildCodexRuntimeThreadConfig, v as createCodexDynamicToolBridge, y as filterCodexDynamicTools } from "./thread-lifecycle-B_oezv_0.js";
9
- import { n as handleCodexAppServerElicitationRequest, r as handleCodexAppServerApprovalRequest, t as filterToolsForVisionInputs } from "./vision-tools-cbM0WkCZ.js";
10
- import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-BFi-50LG.js";
8
+ import { c as resolveCodexAppServerModelProvider, l as resolveReasoningEffort, n as buildCodexRuntimeThreadConfig, v as createCodexDynamicToolBridge, y as filterCodexDynamicTools } from "./thread-lifecycle-DrbViNpf.js";
9
+ import { n as handleCodexAppServerElicitationRequest, r as handleCodexAppServerApprovalRequest, t as filterToolsForVisionInputs } from "./vision-tools-CzTdigBu.js";
10
+ import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-dvhq-4pi.js";
11
11
  import { embeddedAgentLog, formatErrorMessage, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
12
12
  //#region extensions/codex/src/app-server/side-question.ts
13
13
  const CODEX_SIDE_DYNAMIC_TOOL_TIMEOUT_MS = 3e4;
package/dist/test-api.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { s as resolveCodexAppServerRuntimeOptions } from "./config-0rd3LnKg.js";
2
- import { a as buildThreadStartParams, i as buildThreadResumeParams, o as buildTurnStartParams, r as buildDeveloperInstructions, v as createCodexDynamicToolBridge, y as filterCodexDynamicTools } from "./thread-lifecycle-B_oezv_0.js";
2
+ import { a as buildThreadStartParams, i as buildThreadResumeParams, o as buildTurnStartParams, r as buildDeveloperInstructions, v as createCodexDynamicToolBridge, y as filterCodexDynamicTools } from "./thread-lifecycle-DrbViNpf.js";
3
3
  //#region extensions/codex/test-api.ts
4
4
  function resolveCodexPromptSnapshotAppServerOptions(pluginConfig) {
5
5
  return resolveCodexAppServerRuntimeOptions({
@@ -5,7 +5,7 @@ import { CODEX_GPT5_HEARTBEAT_PROMPT_OVERLAY, renderCodexPromptOverlay } from ".
5
5
  import { isModernCodexModel } from "./provider.js";
6
6
  import { i as isCodexAppServerConnectionClosedError } from "./client-CoctX13d.js";
7
7
  import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-CMTXuyoz.js";
8
- import { a as defaultCodexAppInventoryCache, r as readCodexPluginInventory, t as ensureCodexPluginActivation } from "./plugin-activation-PXGqUjwY.js";
8
+ import { a as defaultCodexAppInventoryCache, r as readCodexPluginInventory, t as ensureCodexPluginActivation } from "./plugin-activation-aQOmRQwA.js";
9
9
  import crypto from "node:crypto";
10
10
  import { HEARTBEAT_RESPONSE_TOOL_NAME, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, embeddedAgentLog, extractToolResultMediaArtifact, filterToolResultMediaUrls, isActiveHarnessContextEngine, isMessagingTool, isMessagingToolSendAction, isToolWrappedWithBeforeToolCallHook, normalizeHeartbeatToolResponse, runAgentHarnessAfterToolCallHook, wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
11
11
  import { buildCodexUserMcpServersThreadConfigPatch } from "openclaw/plugin-sdk/codex-mcp-projection";
@@ -297,14 +297,33 @@ function readFirstString(record, keys) {
297
297
  }
298
298
  function collectMediaUrls(record) {
299
299
  const urls = [];
300
+ const pushMediaUrl = (value) => {
301
+ if (typeof value === "string" && value.trim()) urls.push(value.trim());
302
+ };
303
+ const pushAttachment = (value) => {
304
+ if (!value || typeof value !== "object" || Array.isArray(value)) return;
305
+ const attachment = value;
306
+ for (const key of [
307
+ "media",
308
+ "mediaUrl",
309
+ "path",
310
+ "filePath",
311
+ "fileUrl",
312
+ "url"
313
+ ]) pushMediaUrl(attachment[key]);
314
+ };
300
315
  for (const key of [
316
+ "media",
301
317
  "mediaUrl",
302
318
  "media_url",
319
+ "path",
320
+ "filePath",
321
+ "fileUrl",
303
322
  "imageUrl",
304
323
  "image_url"
305
324
  ]) {
306
325
  const value = record[key];
307
- if (typeof value === "string" && value.trim()) urls.push(value.trim());
326
+ pushMediaUrl(value);
308
327
  }
309
328
  for (const key of [
310
329
  "mediaUrls",
@@ -314,8 +333,10 @@ function collectMediaUrls(record) {
314
333
  ]) {
315
334
  const value = record[key];
316
335
  if (!Array.isArray(value)) continue;
317
- for (const entry of value) if (typeof entry === "string" && entry.trim()) urls.push(entry.trim());
336
+ for (const entry of value) pushMediaUrl(entry);
318
337
  }
338
+ const attachments = record.attachments;
339
+ if (Array.isArray(attachments)) for (const attachment of attachments) pushAttachment(attachment);
319
340
  return urls;
320
341
  }
321
342
  function isCronAddAction(args) {
@@ -680,6 +701,7 @@ const CODEX_CODE_MODE_THREAD_CONFIG = {
680
701
  "features.code_mode": true,
681
702
  "features.code_mode_only": true
682
703
  };
704
+ const CODEX_LIGHTWEIGHT_CONTEXT_THREAD_CONFIG = { project_doc_max_bytes: 0 };
683
705
  async function startOrResumeThread(params) {
684
706
  const dynamicToolsFingerprint = fingerprintDynamicTools(params.dynamicTools);
685
707
  const contextEngineBinding = buildContextEngineBinding(params.params);
@@ -939,7 +961,7 @@ function buildThreadStartParams(params, options) {
939
961
  sandbox: options.appServer.sandbox,
940
962
  ...options.appServer.serviceTier ? { serviceTier: options.appServer.serviceTier } : {},
941
963
  serviceName: "OpenClaw",
942
- config: buildCodexRuntimeThreadConfig(options.config),
964
+ config: buildCodexRuntimeThreadConfigForRun(params, options.config),
943
965
  developerInstructions: options.developerInstructions ?? buildDeveloperInstructions(params),
944
966
  dynamicTools: options.dynamicTools,
945
967
  experimentalRawEvents: true,
@@ -962,7 +984,7 @@ function buildThreadResumeParams(params, options) {
962
984
  approvalsReviewer: options.appServer.approvalsReviewer,
963
985
  sandbox: options.appServer.sandbox,
964
986
  ...options.appServer.serviceTier ? { serviceTier: options.appServer.serviceTier } : {},
965
- config: buildCodexRuntimeThreadConfig(options.config),
987
+ config: buildCodexRuntimeThreadConfigForRun(params, options.config),
966
988
  developerInstructions: options.developerInstructions ?? buildDeveloperInstructions(params),
967
989
  persistExtendedHistory: true
968
990
  };
@@ -970,6 +992,14 @@ function buildThreadResumeParams(params, options) {
970
992
  function buildCodexRuntimeThreadConfig(config) {
971
993
  return mergeCodexThreadConfigs(config, CODEX_CODE_MODE_THREAD_CONFIG) ?? { ...CODEX_CODE_MODE_THREAD_CONFIG };
972
994
  }
995
+ function buildCodexRuntimeThreadConfigForRun(params, config) {
996
+ const runtimeConfig = buildCodexRuntimeThreadConfig(config);
997
+ if (params.bootstrapContextMode !== "lightweight") return runtimeConfig;
998
+ return mergeCodexThreadConfigs(runtimeConfig, CODEX_LIGHTWEIGHT_CONTEXT_THREAD_CONFIG) ?? {
999
+ ...runtimeConfig,
1000
+ ...CODEX_LIGHTWEIGHT_CONTEXT_THREAD_CONFIG
1001
+ };
1002
+ }
973
1003
  function buildTurnStartParams(params, options) {
974
1004
  return {
975
1005
  threadId: options.threadId,
@@ -1,5 +1,5 @@
1
1
  import { t as isJsonObject } from "./protocol-C9UWI98H.js";
2
- import { r as formatCodexDisplayText } from "./command-formatters-CJH9-hFT.js";
2
+ import { r as formatCodexDisplayText } from "./command-formatters-DRJaVHhN.js";
3
3
  import { callGatewayTool, embeddedAgentLog, formatApprovalDisplayPath } from "openclaw/plugin-sdk/agent-harness-runtime";
4
4
  //#region extensions/codex/src/app-server/plugin-approval-roundtrip.ts
5
5
  const DEFAULT_CODEX_APPROVAL_TIMEOUT_MS = 12e4;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/codex",
3
- "version": "2026.5.14-beta.1",
3
+ "version": "2026.5.14-beta.2",
4
4
  "description": "OpenClaw Codex harness and model provider plugin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,7 +11,7 @@
11
11
  "@earendil-works/pi-coding-agent": "0.74.0",
12
12
  "@openai/codex": "0.130.0",
13
13
  "ajv": "8.20.0",
14
- "ws": "8.20.0",
14
+ "ws": "8.20.1",
15
15
  "zod": "4.4.3"
16
16
  },
17
17
  "devDependencies": {
@@ -27,10 +27,10 @@
27
27
  "minHostVersion": ">=2026.5.1-beta.1"
28
28
  },
29
29
  "compat": {
30
- "pluginApi": ">=2026.5.14-beta.1"
30
+ "pluginApi": ">=2026.5.14-beta.2"
31
31
  },
32
32
  "build": {
33
- "openclawVersion": "2026.5.14-beta.1"
33
+ "openclawVersion": "2026.5.14-beta.2"
34
34
  },
35
35
  "release": {
36
36
  "publishToClawHub": true,
@@ -45,7 +45,7 @@
45
45
  "openclaw.plugin.json"
46
46
  ],
47
47
  "peerDependencies": {
48
- "openclaw": ">=2026.5.14-beta.1"
48
+ "openclaw": ">=2026.5.14-beta.2"
49
49
  },
50
50
  "peerDependenciesMeta": {
51
51
  "openclaw": {
@@ -1,19 +0,0 @@
1
- //#region extensions/codex/src/app-server/client-factory.ts
2
- const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => import("./shared-client-BwUqd3lh.js").then((n) => n.a).then(({ getSharedCodexAppServerClient }) => getSharedCodexAppServerClient({
3
- startOptions,
4
- authProfileId,
5
- agentDir,
6
- config
7
- }));
8
- function createCodexAppServerClientFactoryTestHooks(setFactory) {
9
- return {
10
- setCodexAppServerClientFactoryForTests(factory) {
11
- setFactory(factory);
12
- },
13
- resetCodexAppServerClientFactoryForTests() {
14
- setFactory(defaultCodexAppServerClientFactory);
15
- }
16
- };
17
- }
18
- //#endregion
19
- export { defaultCodexAppServerClientFactory as n, createCodexAppServerClientFactoryTestHooks as t };
@@ -1,45 +0,0 @@
1
- import { n as CodexAppServerRpcError } from "./client-CoctX13d.js";
2
- import { i as getSharedCodexAppServerClient, o as withTimeout, r as createIsolatedCodexAppServerClient } from "./shared-client-BwUqd3lh.js";
3
- //#region extensions/codex/src/app-server/capabilities.ts
4
- const CODEX_CONTROL_METHODS = {
5
- account: "account/read",
6
- compact: "thread/compact/start",
7
- feedback: "feedback/upload",
8
- listMcpServers: "mcpServerStatus/list",
9
- listSkills: "skills/list",
10
- listThreads: "thread/list",
11
- rateLimits: "account/rateLimits/read",
12
- resumeThread: "thread/resume",
13
- review: "review/start"
14
- };
15
- function describeControlFailure(error) {
16
- if (isUnsupportedControlError(error)) return "unsupported by this Codex app-server";
17
- return error instanceof Error ? error.message : String(error);
18
- }
19
- function isUnsupportedControlError(error) {
20
- return error instanceof CodexAppServerRpcError && error.code === -32601;
21
- }
22
- //#endregion
23
- //#region extensions/codex/src/app-server/request.ts
24
- async function requestCodexAppServerJson(params) {
25
- const timeoutMs = params.timeoutMs ?? 6e4;
26
- return await withTimeout((async () => {
27
- const client = await (params.isolated ? createIsolatedCodexAppServerClient : getSharedCodexAppServerClient)({
28
- startOptions: params.startOptions,
29
- timeoutMs,
30
- authProfileId: params.authProfileId,
31
- agentDir: params.agentDir,
32
- config: params.config
33
- });
34
- try {
35
- return await client.request(params.method, params.requestParams, { timeoutMs });
36
- } finally {
37
- if (params.isolated) await client.closeAndWait({
38
- exitTimeoutMs: 2e3,
39
- forceKillDelayMs: 250
40
- });
41
- }
42
- })(), timeoutMs, `codex app-server ${params.method} timed out`);
43
- }
44
- //#endregion
45
- export { CODEX_CONTROL_METHODS as n, describeControlFailure as r, requestCodexAppServerJson as t };