@openclaw/codex 2026.7.2-beta.1 → 2026.7.2-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.
Files changed (41) hide show
  1. package/README.md +1 -1
  2. package/dist/{app-server-policy-DVcxdse_.js → app-server-policy-Scc-Wevo.js} +1 -1
  3. package/dist/{attempt-notifications-DEv9h7iC.js → attempt-notifications-BFmNhqFl.js} +3 -6
  4. package/dist/cli-metadata.js +1 -1
  5. package/dist/{command-formatters-D6ZlGNmb.js → command-formatters-Dq9InZUK.js} +34 -3
  6. package/dist/{command-handlers-Cpl9fUWv.js → command-handlers-IgqmL_kv.js} +10 -13
  7. package/dist/{compact-FnJmiPNA.js → compact-DCTmg3id.js} +4 -5
  8. package/dist/{computer-use-DVzr8OP1.js → computer-use-CPcU8TjG.js} +4 -4
  9. package/dist/{conversation-control-DtQ-E7mr.js → conversation-control-CGkBlfc5.js} +5 -7
  10. package/dist/doctor-contract-api.js +1 -1
  11. package/dist/{dynamic-tools-BMLoaTeG.js → dynamic-tools-C_1tEs34.js} +608 -330
  12. package/dist/harness.js +9 -5
  13. package/dist/index.js +52 -31
  14. package/dist/{media-understanding-provider-D580L0P8.js → media-understanding-provider-D31dOJwb.js} +11 -12
  15. package/dist/media-understanding-provider.js +1 -1
  16. package/dist/{models-DuKzZA6G.js → models-uh26C8QU.js} +5 -9
  17. package/dist/{notification-correlation-DfaCm0mx.js → notification-correlation-KmfV4EkP.js} +3 -3
  18. package/dist/{plugin-app-cache-key-BKNjHMEs.js → plugin-app-cache-key-Ceb-lm2c.js} +2 -2
  19. package/dist/{rate-limits-Dhp04Rqo.js → rate-limits-DyXaYAxU.js} +7 -6
  20. package/dist/{request-DborTWgw.js → request-B_oQsCXy.js} +54 -8
  21. package/dist/{run-attempt-VPVJoYDP.js → run-attempt-MLzoMe_m.js} +499 -295
  22. package/dist/{config-c48K5HP9.js → session-binding-h1mmCGnl.js} +786 -3
  23. package/dist/{session-catalog-7H112Tr_.js → session-catalog-CEvoXWHA.js} +45 -29
  24. package/dist/{session-cli-B28RhCyp.js → session-cli-XsEuWb_C.js} +1 -1
  25. package/dist/{shared-client-D4mFI9al.js → shared-client-JiAnW6pc.js} +255 -81
  26. package/dist/{side-question-CgJBz52s.js → side-question-DqDvIwSU.js} +15 -13
  27. package/dist/{thread-lifecycle-BgLXzjvV.js → thread-lifecycle-CN_pPtPh.js} +1787 -1579
  28. package/dist/{protocol-validators-dZQ-UTOa.js → transcript-mirror-D9rTxx2P.js} +485 -2
  29. package/dist/usage-D5Rohxoc.js +25 -0
  30. package/dist/{web-search-provider.runtime-Bs-eTn5U.js → web-search-provider.runtime-CKVBn3fP.js} +3 -3
  31. package/npm-shrinkwrap.json +30 -30
  32. package/openclaw.plugin.json +10 -5
  33. package/package.json +6 -6
  34. package/dist/capabilities-42Dfn2TV.js +0 -33
  35. package/dist/prompt-overlay.js +0 -15
  36. package/dist/protocol-BMifTfdW.js +0 -15
  37. package/dist/provider-catalog.js +0 -118
  38. package/dist/provider-discovery.js +0 -34
  39. package/dist/provider.js +0 -307
  40. package/dist/session-binding-BMfX1OX-.js +0 -786
  41. package/dist/transcript-mirror-DhLwFIL4.js +0 -485
package/dist/harness.js CHANGED
@@ -37,6 +37,10 @@ function createCodexAppServerAgentHarness(options) {
37
37
  const { validateCodexAppServerRuntimeArtifact } = await import("./runtime-artifact-C2ITXdhM.js");
38
38
  return validateCodexAppServerRuntimeArtifact(binding);
39
39
  } },
40
+ fetchUsageSnapshot: async (ctx) => {
41
+ const { fetchCodexAppServerUsageSnapshot } = await import("./usage-D5Rohxoc.js");
42
+ return await fetchCodexAppServerUsageSnapshot(ctx, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
43
+ },
40
44
  supports: (ctx) => {
41
45
  const provider = ctx.provider.trim().toLowerCase();
42
46
  if (!providerIds.has(provider)) return {
@@ -75,7 +79,7 @@ function createCodexAppServerAgentHarness(options) {
75
79
  };
76
80
  },
77
81
  runAttempt: async (params) => {
78
- const { runCodexAppServerAttempt } = await import("./run-attempt-VPVJoYDP.js");
82
+ const { runCodexAppServerAttempt } = await import("./run-attempt-MLzoMe_m.js");
79
83
  return runCodexAppServerAttempt(params, {
80
84
  bindingStore: options.bindingStore,
81
85
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
@@ -83,7 +87,7 @@ function createCodexAppServerAgentHarness(options) {
83
87
  });
84
88
  },
85
89
  runSideQuestion: async (params) => {
86
- const { runCodexAppServerSideQuestion } = await import("./side-question-CgJBz52s.js");
90
+ const { runCodexAppServerSideQuestion } = await import("./side-question-DqDvIwSU.js");
87
91
  return runCodexAppServerSideQuestion(params, {
88
92
  bindingStore: options.bindingStore,
89
93
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
@@ -91,14 +95,14 @@ function createCodexAppServerAgentHarness(options) {
91
95
  });
92
96
  },
93
97
  compact: async (params) => {
94
- const { maybeCompactCodexAppServerSession } = await import("./compact-FnJmiPNA.js");
98
+ const { maybeCompactCodexAppServerSession } = await import("./compact-DCTmg3id.js");
95
99
  return maybeCompactCodexAppServerSession(params, {
96
100
  bindingStore: options.bindingStore,
97
101
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig
98
102
  });
99
103
  },
100
104
  compactAfterContextEngine: async (params) => {
101
- const { maybeCompactCodexAppServerSession } = await import("./compact-FnJmiPNA.js");
105
+ const { maybeCompactCodexAppServerSession } = await import("./compact-DCTmg3id.js");
102
106
  return maybeCompactCodexAppServerSession(params, {
103
107
  bindingStore: options.bindingStore,
104
108
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
@@ -107,7 +111,7 @@ function createCodexAppServerAgentHarness(options) {
107
111
  },
108
112
  reset: async (params) => {
109
113
  if (params.sessionId) {
110
- const { reclaimCurrentCodexSessionGeneration, sessionBindingIdentity } = await import("./session-binding-BMfX1OX-.js").then((n) => n.l);
114
+ const { reclaimCurrentCodexSessionGeneration, sessionBindingIdentity } = await import("./session-binding-h1mmCGnl.js").then((n) => n.l);
111
115
  const identity = sessionBindingIdentity({
112
116
  agentId: params.agentId,
113
117
  sessionId: params.sessionId,
package/dist/index.js CHANGED
@@ -1,24 +1,20 @@
1
1
  import { registerCodexCliMetadata } from "./cli-metadata.js";
2
2
  import { createCodexAppServerAgentHarness } from "./harness.js";
3
- import { i as isJsonObject, t as CODEX_INTERACTIVE_THREAD_SOURCE_KINDS } from "./protocol-BMifTfdW.js";
4
- import { a as codexAppServerStartOptionsKey, d as readCodexPluginConfig, f as resolveCodexAppServerRuntimeOptions, i as canUseCodexModelBackedApprovalsReviewerForModel, o as codexSandboxPolicyForTurn, r as assertCodexAppServerConnectionSecurity, t as CODEX_PLUGINS_MARKETPLACE_NAME, v as resolveCodexSupervisionAppServerRuntimeOptions, y as resolveOpenClawExecPolicyForCodexAppServer } from "./config-c48K5HP9.js";
5
- import { r as assertCodexThreadStartResponse } from "./protocol-validators-dZQ-UTOa.js";
6
- import { i as defaultCodexAppInventoryCache, r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-BKNjHMEs.js";
7
- import { C as resolveCodexAppServerFallbackApiKeyCacheKey, S as resolveCodexAppServerAuthProfileIdForAgent, a as getLeasedSharedCodexAppServerClient, b as resolveCodexAppServerAuthAccountCacheKey, c as releaseLeasedSharedCodexAppServerClient, p as withLeasedCodexAppServerClientStartSelectionRetry, r as clearSharedCodexAppServerClientIfCurrentAndWait, s as releaseCodexAppServerClientLease } from "./shared-client-D4mFI9al.js";
8
- import { K as ensureCodexPluginActivation, f as resolveCodexAppServerRequestModelSelection, q as pluginReadParams, t as CODEX_NATIVE_PERSONALITY_NONE, y as resumeCodexAppServerThread } from "./thread-lifecycle-BgLXzjvV.js";
3
+ import { C as resolveCodexAppServerFallbackApiKeyCacheKey, J as CODEX_INTERACTIVE_THREAD_SOURCE_KINDS, S as resolveCodexAppServerAuthProfileIdForAgent, Z as isJsonObject, a as getLeasedSharedCodexAppServerClient, b as resolveCodexAppServerAuthAccountCacheKey, c as releaseLeasedSharedCodexAppServerClient, p as withLeasedCodexAppServerClientStartSelectionRetry, r as clearSharedCodexAppServerClientIfCurrentAndWait, s as releaseCodexAppServerClientLease } from "./shared-client-JiAnW6pc.js";
4
+ import { D as resolveOpenClawExecPolicyForCodexAppServer, E as resolveCodexSupervisionAppServerRuntimeOptions, a as isCodexAppServerNativeAuthProfile, b as resolveCodexAppServerRuntimeOptions, c as sessionBindingIdentity, f as assertCodexAppServerConnectionSecurity, h as codexSandboxPolicyForTurn, m as codexAppServerStartOptionsKey, n as assertCodexBindingMayBeReplaced, o as normalizeCodexAppServerBindingModelProvider, p as canUseCodexModelBackedApprovalsReviewerForModel, u as CODEX_PLUGINS_MARKETPLACE_NAME, y as readCodexPluginConfig } from "./session-binding-h1mmCGnl.js";
5
+ import { d as assertCodexThreadStartResponse } from "./transcript-mirror-D9rTxx2P.js";
6
+ import { i as defaultCodexAppInventoryCache, r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-Ceb-lm2c.js";
7
+ import { X as ensureCodexPluginActivation, Z as pluginReadParams, c as resumeCodexAppServerThread, h as resolveCodexAppServerRequestModelSelection, p as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-CN_pPtPh.js";
9
8
  import { n as CODEX_APP_SERVER_BINDING_NAMESPACE, t as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./session-binding-meta-B7aEMU7g.js";
10
- import { a as isCodexAppServerNativeAuthProfile, c as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced, o as normalizeCodexAppServerBindingModelProvider } from "./session-binding-BMfX1OX-.js";
11
- import { buildCodexProvider } from "./provider.js";
12
- import { t as buildCodexMediaUnderstandingProvider } from "./media-understanding-provider-D580L0P8.js";
13
- import { n as describeControlFailure, t as CODEX_CONTROL_METHODS } from "./capabilities-42Dfn2TV.js";
14
- import { r as formatCodexDisplayText } from "./command-formatters-D6ZlGNmb.js";
15
- import { t as resolveCodexAppServerForModelProvider } from "./app-server-policy-DVcxdse_.js";
9
+ import { t as buildCodexMediaUnderstandingProvider } from "./media-understanding-provider-D31dOJwb.js";
10
+ import { d as CODEX_CONTROL_METHODS, f as describeControlFailure, r as formatCodexDisplayText } from "./command-formatters-Dq9InZUK.js";
11
+ import { t as resolveCodexAppServerForModelProvider } from "./app-server-policy-Scc-Wevo.js";
16
12
  import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-D1Wky__S.js";
17
- import { d as CODEX_NATIVE_EXECUTION_AUTH_ERROR, f as canMutateCodexHost, u as trackCodexConversationActiveTurn } from "./conversation-control-DtQ-E7mr.js";
13
+ import { d as CODEX_NATIVE_EXECUTION_AUTH_ERROR, f as canMutateCodexHost, u as trackCodexConversationActiveTurn } from "./conversation-control-CGkBlfc5.js";
18
14
  import { a as readCodexConversationBindingDataRecord, i as readCodexConversationBindingData, o as resolveCodexDefaultWorkspaceDir, r as createCodexConversationBindingData } from "./conversation-binding-data-BHRpYbX3.js";
19
- import { a as resolveCodexBindingAppServerConnection, n as readCodexNotificationThreadId, r as readCodexNotificationTurnId } from "./notification-correlation-DfaCm0mx.js";
20
- import { d as createCodexCliSessionNodeHostCommands, f as createCodexCliSessionNodeInvokePolicies, g as resumeCodexCliSessionOnNode, h as resolveCodexCliSessionForBindingOnNode, i as createCodexSessionCatalogNodeInvokePolicies, m as listCodexCliSessionsOnNode, n as createCodexSessionCatalogControl, o as codexControlRequest, r as createCodexSessionCatalogNodeHostCommands, t as codexSessionCatalogRuntime, u as assertCodexArchiveDescendantsUnowned } from "./session-catalog-7H112Tr_.js";
21
- import { n as requestCodexAppServerJson } from "./request-DborTWgw.js";
15
+ import { a as resolveCodexBindingAppServerConnection, n as readCodexNotificationThreadId, r as readCodexNotificationTurnId } from "./notification-correlation-KmfV4EkP.js";
16
+ import { d as createCodexCliSessionNodeHostCommands, f as createCodexCliSessionNodeInvokePolicies, g as resumeCodexCliSessionOnNode, h as resolveCodexCliSessionForBindingOnNode, i as createCodexSessionCatalogNodeInvokePolicies, m as listCodexCliSessionsOnNode, n as createCodexSessionCatalogControl, o as codexControlRequest, r as createCodexSessionCatalogNodeHostCommands, t as codexSessionCatalogRuntime, u as assertCodexArchiveDescendantsUnowned } from "./session-catalog-CEvoXWHA.js";
17
+ import { r as requestCodexAppServerJson } from "./request-B_oQsCXy.js";
22
18
  import { t as createCodexWebSearchProviderBase } from "./web-search-provider.shared-BrZmlqyR.js";
23
19
  import { mutateConfigFile } from "openclaw/plugin-sdk/config-mutation";
24
20
  import { normalizePluginsConfig, resolveEffectiveEnableState, resolveLivePluginConfigObject, resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
@@ -36,20 +32,20 @@ import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-s
36
32
  import { fileURLToPath } from "node:url";
37
33
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
38
34
  import { canonicalPathFromExistingAncestor, isPathInside, pathExists } from "openclaw/plugin-sdk/security-runtime";
39
- import { jsonResult, readStringParam } from "openclaw/plugin-sdk/core";
40
35
  import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
41
36
  import { ModelSelectionLockedError, isModelSelectionLocked } from "openclaw/plugin-sdk/model-session-runtime";
42
37
  import { MIGRATION_REASON_TARGET_EXISTS, applyMigrationManualItem, createMigrationItem, createMigrationManualItem, hasMigrationConfigPatchConflict, markMigrationItemConflict, markMigrationItemError, markMigrationItemSkipped, readMigrationConfigPath, summarizeMigrationItems, writeMigrationConfigPath } from "openclaw/plugin-sdk/migration";
43
38
  import { archiveMigrationItem, copyMemoryMigrationFileItem, copyMigrationFileItem, withCachedMigrationConfigRuntime, writeMigrationReport } from "openclaw/plugin-sdk/migration-runtime";
44
39
  import { sleep } from "openclaw/plugin-sdk/runtime-env";
45
40
  import { readJsonFileWithFallback } from "openclaw/plugin-sdk/json-store";
41
+ import { jsonResult, readStringParam } from "openclaw/plugin-sdk/core";
46
42
  import { Type } from "typebox";
47
43
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
48
44
  //#region extensions/codex/src/app-server/session-binding-store.ts
49
45
  /** Defers schema compilation and auth loading until the first binding operation. */
50
46
  function createLazyCodexAppServerBindingStore(state) {
51
47
  let resolved;
52
- const store = () => resolved ??= import("./session-binding-BMfX1OX-.js").then((n) => n.l).then(({ createCodexAppServerBindingStore }) => createCodexAppServerBindingStore(state));
48
+ const store = () => resolved ??= import("./session-binding-h1mmCGnl.js").then((n) => n.l).then(({ createCodexAppServerBindingStore }) => createCodexAppServerBindingStore(state));
53
49
  return {
54
50
  read: async (identity) => (await store()).read(identity),
55
51
  hasOtherThreadOwner: async (threadId, currentIdentity) => (await store()).hasOtherThreadOwner(threadId, currentIdentity),
@@ -76,7 +72,7 @@ async function handleCodexCommand(ctx, options) {
76
72
  }
77
73
  }
78
74
  async function loadDefaultCodexSubcommandHandler() {
79
- const { handleCodexSubcommand } = await import("./command-handlers-Cpl9fUWv.js");
75
+ const { handleCodexSubcommand } = await import("./command-handlers-IgqmL_kv.js");
80
76
  return handleCodexSubcommand;
81
77
  }
82
78
  //#endregion
@@ -1463,6 +1459,16 @@ async function buildCodexAuthConfigPatchItems(params) {
1463
1459
  }
1464
1460
  //#endregion
1465
1461
  //#region extensions/codex/src/migration/memory-plan.ts
1462
+ const MIGRATION_REASON_TARGET_NOT_REGULAR = "target is not a regular file";
1463
+ async function lstatIfExists(filePath) {
1464
+ try {
1465
+ return await fs.lstat(filePath);
1466
+ } catch (error) {
1467
+ const code = error && typeof error === "object" && "code" in error ? String(error.code) : void 0;
1468
+ if (code === "ENOENT" || code === "ENOTDIR") return;
1469
+ throw error;
1470
+ }
1471
+ }
1466
1472
  async function assertSafeMemoryDestination(params) {
1467
1473
  const [canonicalSource, canonicalWorkspace, canonicalTarget] = await Promise.all([
1468
1474
  fs.realpath(path.dirname(params.source)),
@@ -1476,20 +1482,23 @@ async function buildCodexMemoryItems(params) {
1476
1482
  const items = [];
1477
1483
  for (const memory of params.memoryFiles) {
1478
1484
  const target = path.join(params.workspaceDir, "memory", "imports", "codex", path.basename(memory.path));
1479
- await assertSafeMemoryDestination({
1485
+ const targetStat = await lstatIfExists(target);
1486
+ const targetExists = targetStat !== void 0;
1487
+ const targetNotRegular = targetExists && !targetStat.isFile();
1488
+ if (!targetNotRegular) await assertSafeMemoryDestination({
1480
1489
  source: memory.path,
1481
1490
  workspaceDir: params.workspaceDir,
1482
1491
  target
1483
1492
  });
1484
- const targetExists = await exists(target);
1493
+ const targetConflict = targetNotRegular || targetExists && !params.overwrite;
1485
1494
  items.push(createMigrationItem({
1486
1495
  id: memory.id,
1487
1496
  kind: "memory",
1488
1497
  action: "copy",
1489
1498
  source: memory.path,
1490
1499
  target,
1491
- status: targetExists && !params.overwrite ? "conflict" : "planned",
1492
- reason: targetExists && !params.overwrite ? MIGRATION_REASON_TARGET_EXISTS : void 0,
1500
+ status: targetConflict ? "conflict" : "planned",
1501
+ reason: targetNotRegular ? MIGRATION_REASON_TARGET_NOT_REGULAR : targetConflict ? MIGRATION_REASON_TARGET_EXISTS : void 0,
1493
1502
  message: "Copy consolidated Codex memory into the OpenClaw memory index.",
1494
1503
  details: {
1495
1504
  sourceType: "codex-memory",
@@ -1637,7 +1646,8 @@ async function discoverCodexMemorySources(codexHome) {
1637
1646
  //#endregion
1638
1647
  //#region extensions/codex/src/migration/source.ts
1639
1648
  function defaultCodexHome() {
1640
- return resolveHomePath(process.env.CODEX_HOME?.trim() || "~/.codex");
1649
+ const configuredHome = process.env.CODEX_HOME;
1650
+ return resolveHomePath(configuredHome !== void 0 && configuredHome.length > 0 ? configuredHome : "~/.codex");
1641
1651
  }
1642
1652
  function personalAgentsSkillsDir() {
1643
1653
  return path.join(resolveUserHomeDir(), ".agents", "skills");
@@ -3716,7 +3726,7 @@ function createCodexSupervisionTools(options) {
3716
3726
  }
3717
3727
  //#endregion
3718
3728
  //#region extensions/codex/src/web-search-provider.ts
3719
- const loadCodexWebSearchRuntime = createLazyRuntimeModule(() => import("./web-search-provider.runtime-Bs-eTn5U.js"));
3729
+ const loadCodexWebSearchRuntime = createLazyRuntimeModule(() => import("./web-search-provider.runtime-CKVBn3fP.js"));
3720
3730
  const CodexWebSearchSchema = {
3721
3731
  type: "object",
3722
3732
  properties: { query: {
@@ -3758,7 +3768,7 @@ const ENDED_SESSION_REASONS = /* @__PURE__ */ new Set([
3758
3768
  var codex_default = definePluginEntry({
3759
3769
  id: "codex",
3760
3770
  name: "Codex",
3761
- description: "Codex app-server harness, Codex-managed GPT catalog, and native session supervision.",
3771
+ description: "Codex app-server harness and native session supervision.",
3762
3772
  register(api) {
3763
3773
  const resolveCurrentConfig = () => api.runtime.config?.current ? api.runtime.config.current() : void 0;
3764
3774
  const resolvePluginConfig = (resolveConfig) => {
@@ -3775,11 +3785,20 @@ var codex_default = definePluginEntry({
3775
3785
  return livePluginConfig;
3776
3786
  };
3777
3787
  const resolveCurrentPluginConfig = () => resolvePluginConfig(resolveCurrentConfig);
3778
- const bindingStore = createLazyCodexAppServerBindingStore(api.runtime.state.openSyncKeyedStore({
3788
+ let bindingStateStore;
3789
+ const openBindingStateStore = () => bindingStateStore ??= api.runtime.state.openSyncKeyedStore({
3779
3790
  namespace: CODEX_APP_SERVER_BINDING_NAMESPACE,
3780
3791
  maxEntries: CODEX_APP_SERVER_BINDING_MAX_ENTRIES,
3781
3792
  overflowPolicy: "reject-new"
3782
- }));
3793
+ });
3794
+ const bindingStore = createLazyCodexAppServerBindingStore({
3795
+ entries: () => openBindingStateStore().entries(),
3796
+ lookup: (key) => openBindingStateStore().lookup(key),
3797
+ get update() {
3798
+ const store = openBindingStateStore();
3799
+ return store.update?.bind(store);
3800
+ }
3801
+ });
3783
3802
  registerCodexCliMetadata(api);
3784
3803
  const sessionCatalogControl = createCodexSessionCatalogControl({
3785
3804
  getPluginConfig: resolveCurrentPluginConfig,
@@ -3809,7 +3828,6 @@ var codex_default = definePluginEntry({
3809
3828
  resolveConfig: resolveCurrentConfig,
3810
3829
  resolvePluginConfig: resolveCurrentPluginConfig
3811
3830
  }));
3812
- api.registerProvider(buildCodexProvider({ pluginConfig: api.pluginConfig }));
3813
3831
  api.registerMediaUnderstandingProvider(buildCodexMediaUnderstandingProvider({ pluginConfig: api.pluginConfig }));
3814
3832
  api.registerWebSearchProvider(createCodexWebSearchProvider({ resolvePluginConfig: resolveCurrentPluginConfig }));
3815
3833
  api.registerMigrationProvider(buildCodexMigrationProvider({ runtime: api.runtime }));
@@ -3896,7 +3914,7 @@ var codex_default = definePluginEntry({
3896
3914
  if (!previousSessionId || !sessionId || previousSessionId === sessionId) return;
3897
3915
  const config = resolveCurrentConfig();
3898
3916
  const sessionKey = ctx.sessionKey?.trim();
3899
- const { sessionBindingIdentity } = await import("./session-binding-BMfX1OX-.js").then((n) => n.l);
3917
+ const { sessionBindingIdentity } = await import("./session-binding-h1mmCGnl.js").then((n) => n.l);
3900
3918
  const identity = sessionBindingIdentity({
3901
3919
  sessionId,
3902
3920
  ...sessionKey ? { sessionKey } : {},
@@ -3909,8 +3927,11 @@ var codex_default = definePluginEntry({
3909
3927
  api.on("session_end", async (event, ctx) => {
3910
3928
  if (!event.reason || !ENDED_SESSION_REASONS.has(event.reason)) return;
3911
3929
  const sessionKey = event.sessionKey ?? ctx.sessionKey;
3930
+ const endedSessionKey = sessionKey?.trim();
3931
+ const nextSessionKey = event.nextSessionKey?.trim();
3932
+ if (endedSessionKey && nextSessionKey && nextSessionKey !== endedSessionKey) return;
3912
3933
  const config = resolveCurrentConfig();
3913
- const { sessionBindingIdentity } = await import("./session-binding-BMfX1OX-.js").then((n) => n.l);
3934
+ const { sessionBindingIdentity } = await import("./session-binding-h1mmCGnl.js").then((n) => n.l);
3914
3935
  await bindingStore.retireSessionGeneration(sessionBindingIdentity({
3915
3936
  sessionId: event.sessionId,
3916
3937
  ...sessionKey ? { sessionKey } : {},
@@ -1,11 +1,9 @@
1
- import { CODEX_PROVIDER_ID, FALLBACK_CODEX_MODELS } from "./provider-catalog.js";
2
- import { i as isJsonObject } from "./protocol-BMifTfdW.js";
3
- import { _ as readCodexNotificationItem } from "./attempt-notifications-DEv9h7iC.js";
4
- import { f as resolveCodexAppServerRuntimeOptions } from "./config-c48K5HP9.js";
5
- import { i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, o as readCodexErrorNotification, r as assertCodexThreadStartResponse } from "./protocol-validators-dZQ-UTOa.js";
6
- import { i as readModelListResult } from "./models-DuKzZA6G.js";
7
- import { o as isCodexAppServerStartSelectionChangedError } from "./shared-client-D4mFI9al.js";
8
- import { W as mergeCodexThreadConfigs, r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-BgLXzjvV.js";
1
+ import { Z as isJsonObject, o as isCodexAppServerStartSelectionChangedError } from "./shared-client-JiAnW6pc.js";
2
+ import { _ as readCodexNotificationItem } from "./attempt-notifications-BFmNhqFl.js";
3
+ import { b as resolveCodexAppServerRuntimeOptions } from "./session-binding-h1mmCGnl.js";
4
+ import { _ as readCodexTurnCompletedNotification, d as assertCodexThreadStartResponse, f as assertCodexTurnStartResponse, m as readCodexErrorNotification } from "./transcript-mirror-D9rTxx2P.js";
5
+ import { r as readModelListResult } from "./models-uh26C8QU.js";
6
+ import { J as mergeCodexThreadConfigs, l as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-CN_pPtPh.js";
9
7
  import { validateJsonSchemaValue } from "openclaw/plugin-sdk/json-schema-runtime";
10
8
  import fs from "node:fs/promises";
11
9
  import path from "node:path";
@@ -64,7 +62,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
64
62
  agentDir,
65
63
  config: params.config,
66
64
  timeoutMs
67
- }) : await import("./shared-client-D4mFI9al.js").then((n) => n.f).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
65
+ }) : await import("./shared-client-JiAnW6pc.js").then((n) => n.f).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
68
66
  startOptions,
69
67
  timeoutMs,
70
68
  authProfileId: params.profile,
@@ -323,7 +321,8 @@ function isTerminalTurn(turn) {
323
321
  * Codex-backed media understanding provider for bounded image description and
324
322
  * structured extraction turns.
325
323
  */
326
- const DEFAULT_CODEX_IMAGE_MODEL = FALLBACK_CODEX_MODELS.find((model) => model.inputModalities.includes("image"))?.id ?? FALLBACK_CODEX_MODELS[0]?.id;
324
+ const CODEX_MEDIA_PROVIDER_ID = "codex";
325
+ const DEFAULT_CODEX_IMAGE_MODEL = "gpt-5.6-sol";
327
326
  const DEFAULT_CODEX_IMAGE_PROMPT = "Describe the image.";
328
327
  /**
329
328
  * Builds the media-understanding provider that delegates image tasks to an
@@ -331,9 +330,9 @@ const DEFAULT_CODEX_IMAGE_PROMPT = "Describe the image.";
331
330
  */
332
331
  function buildCodexMediaUnderstandingProvider(options = {}) {
333
332
  return {
334
- id: CODEX_PROVIDER_ID,
333
+ id: CODEX_MEDIA_PROVIDER_ID,
335
334
  capabilities: ["image"],
336
- ...DEFAULT_CODEX_IMAGE_MODEL ? { defaultModels: { image: DEFAULT_CODEX_IMAGE_MODEL } } : {},
335
+ defaultModels: { image: DEFAULT_CODEX_IMAGE_MODEL },
337
336
  describeImage: async (req) => describeCodexImages({
338
337
  images: [{
339
338
  buffer: req.buffer,
@@ -1,2 +1,2 @@
1
- import { t as buildCodexMediaUnderstandingProvider } from "./media-understanding-provider-D580L0P8.js";
1
+ import { t as buildCodexMediaUnderstandingProvider } from "./media-understanding-provider-D31dOJwb.js";
2
2
  export { buildCodexMediaUnderstandingProvider };
@@ -1,16 +1,10 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { s as readCodexModelListResponse } from "./protocol-validators-dZQ-UTOa.js";
1
+ import { h as readCodexModelListResponse } from "./transcript-mirror-D9rTxx2P.js";
3
2
  import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
4
3
  //#region extensions/codex/src/app-server/models.ts
5
4
  /**
6
5
  * Lists and normalizes models exposed by the Codex app-server `model/list`
7
6
  * endpoint, including pagination and shared-client lease handling.
8
7
  */
9
- var models_exports = /* @__PURE__ */ __exportAll({
10
- listAllCodexAppServerModels: () => listAllCodexAppServerModels,
11
- listCodexAppServerModels: () => listCodexAppServerModels,
12
- readModelListResult: () => readModelListResult
13
- });
14
8
  /** Lists one Codex app-server model page using the configured auth/client options. */
15
9
  async function listCodexAppServerModels(options = {}) {
16
10
  return await withCodexAppServerModelClient(options, async ({ client, timeoutMs }) => requestModelListPage(client, {
@@ -46,17 +40,19 @@ async function listAllCodexAppServerModels(options = {}) {
46
40
  async function withCodexAppServerModelClient(options, run) {
47
41
  const timeoutMs = options.timeoutMs ?? 2500;
48
42
  const useSharedClient = options.sharedClient !== false;
49
- const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-D4mFI9al.js").then((n) => n.f);
43
+ const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-JiAnW6pc.js").then((n) => n.f);
50
44
  const client = useSharedClient ? await getLeasedSharedCodexAppServerClient({
51
45
  startOptions: options.startOptions,
52
46
  timeoutMs,
53
47
  authProfileId: options.authProfileId,
48
+ authRequirement: options.authRequirement,
54
49
  agentDir: options.agentDir,
55
50
  config: options.config
56
51
  }) : await createIsolatedCodexAppServerClient({
57
52
  startOptions: options.startOptions,
58
53
  timeoutMs,
59
54
  authProfileId: options.authProfileId,
55
+ authRequirement: options.authRequirement,
60
56
  agentDir: options.agentDir,
61
57
  config: options.config
62
58
  });
@@ -115,4 +111,4 @@ function normalizeMaxPages(value) {
115
111
  return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.floor(value) : 20;
116
112
  }
117
113
  //#endregion
118
- export { readModelListResult as i, listCodexAppServerModels as n, models_exports as r, listAllCodexAppServerModels as t };
114
+ export { listCodexAppServerModels as n, readModelListResult as r, listAllCodexAppServerModels as t };
@@ -1,6 +1,6 @@
1
- import { i as isJsonObject } from "./protocol-BMifTfdW.js";
2
- import { d as readCodexPluginConfig, f as resolveCodexAppServerRuntimeOptions, v as resolveCodexSupervisionAppServerRuntimeOptions } from "./config-c48K5HP9.js";
3
- import { t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-BKNjHMEs.js";
1
+ import { Z as isJsonObject } from "./shared-client-JiAnW6pc.js";
2
+ import { E as resolveCodexSupervisionAppServerRuntimeOptions, b as resolveCodexAppServerRuntimeOptions, y as readCodexPluginConfig } from "./session-binding-h1mmCGnl.js";
3
+ import { t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-Ceb-lm2c.js";
4
4
  //#region extensions/codex/src/app-server/binding-connection.ts
5
5
  /** Requires the native model pair after a supervised pending branch has materialized. */
6
6
  function requireCodexSupervisionModelSelection(binding) {
@@ -1,5 +1,5 @@
1
- import { m as resolveCodexAppServerUserHomeDir } from "./config-c48K5HP9.js";
2
- import { D as resolveCodexAppServerHomeDir } from "./shared-client-D4mFI9al.js";
1
+ import { D as resolveCodexAppServerHomeDir } from "./shared-client-JiAnW6pc.js";
2
+ import { S as resolveCodexAppServerUserHomeDir } from "./session-binding-h1mmCGnl.js";
3
3
  import { createRequire } from "node:module";
4
4
  import { isFutureDateTimestampMs, resolveDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
5
5
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
@@ -1,4 +1,4 @@
1
- import { i as isJsonObject } from "./protocol-BMifTfdW.js";
1
+ import { Z as isJsonObject } from "./shared-client-JiAnW6pc.js";
2
2
  import { MAX_DATE_TIMESTAMP_MS, resolveExpiresAtMsFromEpochSeconds } from "openclaw/plugin-sdk/number-runtime";
3
3
  import { asFiniteNumber, parseStrictFiniteNumber } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
@@ -17,14 +17,15 @@ const ONE_DAY_MS = 24 * ONE_HOUR_MS;
17
17
  const DAY_WINDOW_MINUTES = 1440;
18
18
  const WEEKLY_WINDOW_MINUTES = 7 * DAY_WINDOW_MINUTES;
19
19
  const WEEKLY_RESET_GAP_MS = 3 * ONE_DAY_MS;
20
+ const CODEX_USAGE_LIMIT_MESSAGE_PREFIX = "You've reached your Codex subscription usage limit.";
20
21
  /** Enriches Codex usage-limit failures with reset timing and recovery guidance. */
21
22
  function formatCodexUsageLimitErrorMessage(params) {
22
23
  const message = normalizeText(params.message);
23
- if (!isCodexUsageLimitError(params.codexErrorInfo, message)) return;
24
+ if (!isCodexUsageLimitError(params.codexErrorInfo)) return;
24
25
  const nowMs = params.nowMs ?? Date.now();
25
26
  const usageSummary = summarizeCodexAccountUsage(params.rateLimits, nowMs);
26
27
  const nextReset = selectBlockingRateLimitReset(params.rateLimits, nowMs) ?? (usageSummary?.blocked ? void 0 : selectNextRateLimitReset(params.rateLimits, nowMs));
27
- const parts = ["You've reached your Codex subscription usage limit."];
28
+ const parts = [CODEX_USAGE_LIMIT_MESSAGE_PREFIX];
28
29
  let recoveryAction = "Wait until Codex becomes available";
29
30
  if (nextReset) {
30
31
  parts.push(`Next reset ${formatResetTime(nextReset.resetsAtMs, nowMs)}.`);
@@ -45,7 +46,7 @@ function formatCodexUsageLimitErrorMessage(params) {
45
46
  /** Detects usage-limit messages that need a fresh rate-limit query before display. */
46
47
  function shouldRefreshCodexRateLimitsForUsageLimitMessage(message) {
47
48
  const text = normalizeText(message);
48
- return Boolean(text?.includes("You've reached your Codex subscription usage limit.") && !text.includes("Next reset "));
49
+ return Boolean(text?.startsWith(CODEX_USAGE_LIMIT_MESSAGE_PREFIX) && !text.includes("Next reset "));
49
50
  }
50
51
  /** Formats compact summaries for raw Codex rate-limit snapshot payloads. */
51
52
  function summarizeCodexRateLimits(value, nowMs = Date.now()) {
@@ -106,12 +107,12 @@ function buildCodexAppServerUsageSnapshot(value) {
106
107
  ...snapshot ? { plan: resolveCodexProviderUsagePlan(snapshot) } : {}
107
108
  };
108
109
  }
109
- function isCodexUsageLimitError(codexErrorInfo, message) {
110
+ function isCodexUsageLimitError(codexErrorInfo) {
110
111
  if (codexErrorInfo === "usageLimitExceeded") return true;
111
112
  if (typeof codexErrorInfo === "string") {
112
113
  if (codexErrorInfo.replace(/[_\s-]/gu, "").toLowerCase() === "usagelimitexceeded") return true;
113
114
  }
114
- return Boolean(message?.toLowerCase().includes("usage limit"));
115
+ return false;
115
116
  }
116
117
  function selectNextRateLimitReset(value, nowMs) {
117
118
  const futureWindows = collectCodexRateLimitSnapshots(value).flatMap((snapshot) => LIMIT_WINDOW_KEYS.flatMap((key) => readRateLimitWindow(snapshot, key) ?? [])).filter((window) => window.resetsAtMs > nowMs);
@@ -1,12 +1,6 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { a as getLeasedSharedCodexAppServerClient, c as releaseLeasedSharedCodexAppServerClient, d as retireSharedCodexAppServerClientIfCurrent, i as createIsolatedCodexAppServerClient, m as withTimeout, o as isCodexAppServerStartSelectionChangedError } from "./shared-client-D4mFI9al.js";
1
+ import { a as getLeasedSharedCodexAppServerClient, c as releaseLeasedSharedCodexAppServerClient, d as retireSharedCodexAppServerClientIfCurrent, i as createIsolatedCodexAppServerClient, m as withTimeout, o as isCodexAppServerStartSelectionChangedError } from "./shared-client-JiAnW6pc.js";
3
2
  import { t as resolveCodexAppServerDirectSandboxBypassBlock } from "./sandbox-guard-D1Wky__S.js";
4
3
  //#region extensions/codex/src/app-server/request.ts
5
- var request_exports = /* @__PURE__ */ __exportAll({
6
- requestCodexAppServerClientJson: () => requestCodexAppServerClientJson,
7
- requestCodexAppServerJson: () => requestCodexAppServerJson,
8
- withCodexAppServerJsonClient: () => withCodexAppServerJsonClient
9
- });
10
4
  /** Sends one guarded request over a client lease owned by the caller. */
11
5
  async function requestCodexAppServerClientJson(params) {
12
6
  const sandboxBlock = resolveCodexAppServerDirectSandboxBypassBlock({
@@ -37,6 +31,58 @@ async function requestCodexAppServerJson(params) {
37
31
  requestParams: params.requestParams
38
32
  }));
39
33
  }
34
+ const CODEX_USAGE_ISOLATED_SHUTDOWN = {
35
+ forceKillDelayMs: 200,
36
+ exitTimeoutMs: 300
37
+ };
38
+ const CODEX_ACCOUNT_READ_MAX_TIMEOUT_MS = 4e3;
39
+ const CODEX_USAGE_DEADLINE_RESERVE_MS = CODEX_USAGE_ISOLATED_SHUTDOWN.forceKillDelayMs + CODEX_USAGE_ISOLATED_SHUTDOWN.exitTimeoutMs + 250;
40
+ /** Reads rate limits and best-effort account identity from one isolated app-server session. */
41
+ async function readCodexAppServerUsage(options) {
42
+ const deadline = Date.now() + options.timeoutMs;
43
+ return await withCodexAppServerJsonClient({
44
+ timeoutMs: options.timeoutMs,
45
+ timeoutMessage: "codex app-server usage read timed out",
46
+ agentDir: options.agentDir,
47
+ ...options.authProfileId ? { authProfileId: options.authProfileId } : {},
48
+ config: options.config,
49
+ startOptions: options.startOptions,
50
+ isolated: true,
51
+ isolatedShutdown: CODEX_USAGE_ISOLATED_SHUTDOWN
52
+ }, async (request) => {
53
+ const rateLimits = await request({ method: "account/rateLimits/read" });
54
+ const accountEmail = await readCodexAccountEmailBestEffort(request, deadline);
55
+ return {
56
+ rateLimits,
57
+ ...accountEmail ? { accountEmail } : {}
58
+ };
59
+ });
60
+ }
61
+ function extractCodexAccountEmail(value) {
62
+ if (!value || typeof value !== "object") return;
63
+ const record = value;
64
+ const account = record.account && typeof record.account === "object" ? record.account : record;
65
+ const email = account.email ?? account.accountEmail;
66
+ return typeof email === "string" && email.trim() ? email.trim() : void 0;
67
+ }
68
+ async function readCodexAccountEmailBestEffort(request, deadline) {
69
+ const boundMs = Math.min(CODEX_ACCOUNT_READ_MAX_TIMEOUT_MS, deadline - Date.now() - CODEX_USAGE_DEADLINE_RESERVE_MS);
70
+ if (boundMs <= 0) return;
71
+ const read = request({
72
+ method: "account/read",
73
+ requestParams: {}
74
+ }).then((account) => extractCodexAccountEmail(account), () => void 0);
75
+ let timer;
76
+ const timeout = new Promise((resolve) => {
77
+ timer = setTimeout(() => resolve(void 0), boundMs);
78
+ timer.unref?.();
79
+ });
80
+ try {
81
+ return await Promise.race([read, timeout]);
82
+ } finally {
83
+ if (timer) clearTimeout(timer);
84
+ }
85
+ }
40
86
  /**
41
87
  * Runs several guarded requests over one acquired client (shared lease or
42
88
  * isolated child) so related reads see the same app-server session. The whole
@@ -108,4 +154,4 @@ async function withCodexAppServerJsonClient(params, run) {
108
154
  }
109
155
  }
110
156
  //#endregion
111
- export { requestCodexAppServerJson as n, request_exports as r, requestCodexAppServerClientJson as t };
157
+ export { requestCodexAppServerClientJson as n, requestCodexAppServerJson as r, readCodexAppServerUsage as t };