@openclaw/codex 2026.7.2-beta.5 → 2026.8.1-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 (59) hide show
  1. package/README.md +2 -0
  2. package/dist/{app-server-policy-BmDgseo_.js → app-server-policy-zcBDc1JU.js} +1 -1
  3. package/dist/attempt-client-cleanup-DMLXUfa8.js +735 -0
  4. package/dist/binding-connection-I5Bo-AsX.js +33 -0
  5. package/dist/{bounded-turn-FEbUXoYT.js → bounded-turn-qgZmzy_4.js} +71 -63
  6. package/dist/{capabilities-BHRSI6Cn.js → capabilities-CybGI1oz.js} +8 -2
  7. package/dist/cli-metadata.js +1 -1
  8. package/dist/{command-formatters-ico4ZFnk.js → command-formatters-B1AEz8ZA.js} +18 -18
  9. package/dist/{command-handlers-CRmnwI2N.js → command-handlers-Db8pu_ds.js} +484 -95
  10. package/dist/{compact-dEN49UH6.js → compact-LspQaGfl.js} +213 -199
  11. package/dist/{conversation-binding-data-BHRpYbX3.js → conversation-binding-data-CW2GuupV.js} +6 -10
  12. package/dist/doctor-contract-api.js +40 -43
  13. package/dist/{dynamic-tools-LIt9ojep.js → dynamic-tools-BVdyWkUD.js} +2984 -1221
  14. package/dist/effective-mcp-catalog-DIIhAtOZ.js +119 -0
  15. package/dist/{event-projector-assistant-message-DTgnPPVF.js → event-projector-assistant-message-BwxV4d6N.js} +11 -23
  16. package/dist/{attempt-notifications-CMR2_fmR.js → event-projector-usage-e5huIQWu.js} +113 -29
  17. package/dist/harness.js +83 -13
  18. package/dist/image-payload-sanitizer-CnfoUPCE.js +65 -0
  19. package/dist/index.js +703 -329
  20. package/dist/isolated-completion-C58NbL40.js +75 -0
  21. package/dist/local-runtime-attribution-B_2mnqhb.js +19 -0
  22. package/dist/media-understanding-provider.js +5 -5
  23. package/dist/{models-BA01NEez.js → models-BFlpn1Ex.js} +12 -17
  24. package/dist/native-subagent-monitor-DyTGmTUx.js +3111 -0
  25. package/dist/{plugin-app-cache-key-DSXX-rXO.js → plugin-app-cache-key-C3H2CVp6.js} +135 -42
  26. package/dist/plugin-marketplace-discovery-CzrGJdCR.js +385 -0
  27. package/dist/{computer-use-BjGylO-E.js → plugin-metadata-cache-CNJPj4_b.js} +211 -113
  28. package/dist/protocol-validators-B4F7L8Rf.js +2346 -0
  29. package/dist/{rate-limits-S_PXs0ul.js → rate-limits-DZXmOL8-.js} +17 -35
  30. package/dist/{request-CXpPennK.js → request-BRl5_UfX.js} +4 -4
  31. package/dist/{run-attempt-C5GTPJOE.js → run-attempt-P8BdxC1I.js} +1996 -5728
  32. package/dist/{runtime-artifact-C2ITXdhM.js → runtime-artifact-BVSPdd6g.js} +91 -40
  33. package/dist/{sandbox-guard-D1Wky__S.js → sandbox-guard-Cmwc9eIk.js} +10 -13
  34. package/dist/{session-binding-DlVQ-Pxs.js → session-binding-DPxIvMgE.js} +305 -271
  35. package/dist/{session-catalog-CP2oCcEb.js → session-catalog-xwNi_SDM.js} +418 -144
  36. package/dist/{session-cli-CqZ0Fp2a.js → session-cli-7hgXZDV7.js} +1 -1
  37. package/dist/session-retirement-DoMMJFKm.js +36 -0
  38. package/dist/{session-upstream-marker-QE-m5QFG.js → session-upstream-marker-CrIFX06J.js} +1 -1
  39. package/dist/{settled-turn-finalizer-CA_2QXIE.js → settled-turn-finalizer-BRWBO4MO.js} +36 -15
  40. package/dist/{shared-client-BVKE40c-.js → shared-client-kIBbGjk4.js} +721 -240
  41. package/dist/{side-question-CO12sHxo.js → side-question-9HAL26l9.js} +102 -53
  42. package/dist/{thread-lifecycle-DRg_FdzC.js → thread-lifecycle-Bu1BTDXr.js} +1355 -660
  43. package/dist/thread-ownership-6kOQHlyC.js +92 -0
  44. package/dist/thread-resume-CPrJNQVM.js +30 -0
  45. package/dist/{transcript-mirror-uKA-A4tB.js → transcript-mirror-B9gGgnJS.js} +202 -182
  46. package/dist/{transport-stdio-DXgGZ7Ib.js → transport-stdio-DIImwDVS.js} +11 -0
  47. package/dist/upstream-prompt-provenance-ClRBije0.js +41 -0
  48. package/dist/{upstream-session-fork-_Vrz4WJr.js → upstream-session-fork-CE-_LdnP.js} +5 -5
  49. package/dist/{usage-UpVbdX5G.js → usage-CHlV0e-o.js} +3 -3
  50. package/dist/{web-search-provider.runtime-CaQMYDbp.js → web-search-provider.runtime-DRw2Vl42.js} +8 -9
  51. package/openclaw.plugin.json +18 -3
  52. package/package.json +6 -7
  53. package/dist/attempt-client-cleanup-Ia52yRWc.js +0 -127
  54. package/dist/conversation-control-DE7d9DOj.js +0 -287
  55. package/dist/event-projector-usage-tvgb1NCX.js +0 -69
  56. package/dist/notification-correlation-Bj_Ak_jI.js +0 -67
  57. package/dist/protocol-validators-Dm4eXZmt.js +0 -6337
  58. package/dist/realtime-voice-api-BPcA1uN9.js +0 -494
  59. package/dist/realtime-voice-api.js +0 -2
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
+ import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
2
3
  import { createHash, randomUUID } from "node:crypto";
3
- import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import process from "node:process";
5
5
  //#region extensions/codex/src/conversation-binding-data.ts
6
6
  var conversation_binding_data_exports = /* @__PURE__ */ __exportAll({
@@ -77,10 +77,10 @@ function readCodexConversationBindingDataRecord(data) {
77
77
  };
78
78
  }
79
79
  function readConversationSource(value) {
80
- const agentId = readString(value, "agentId");
81
- const sessionId = readString(value, "sessionId");
82
- const threadId = readString(value, "threadId");
83
- const sessionKey = readString(value, "sessionKey");
80
+ const agentId = normalizeOptionalString(value?.agentId);
81
+ const sessionId = normalizeOptionalString(value?.sessionId);
82
+ const threadId = normalizeOptionalString(value?.threadId);
83
+ const sessionKey = normalizeOptionalString(value?.sessionKey);
84
84
  if (!agentId || !sessionId || !threadId) return;
85
85
  return {
86
86
  agentId,
@@ -94,11 +94,7 @@ function legacyCodexConversationBindingId(sessionFile) {
94
94
  return `legacy-${createHash("sha256").update(sessionFile).digest("base64url")}`;
95
95
  }
96
96
  function resolveCodexDefaultWorkspaceDir(pluginConfig) {
97
- return readString(asOptionalRecord(asOptionalRecord(pluginConfig)?.appServer), "defaultWorkspaceDir") ?? process.cwd();
98
- }
99
- function readString(record, key) {
100
- const value = record?.[key];
101
- return typeof value === "string" && value.trim() ? value.trim() : void 0;
97
+ return normalizeOptionalString(asOptionalRecord(asOptionalRecord(pluginConfig)?.appServer)?.defaultWorkspaceDir) ?? process.cwd();
102
98
  }
103
99
  function readConversationStart(value) {
104
100
  const read = (key) => {
@@ -1,13 +1,12 @@
1
1
  import { n as CODEX_APP_SERVER_BINDING_NAMESPACE, t as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./session-binding-meta-B7aEMU7g.js";
2
+ import { asNullableRecord, isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
2
3
  import fs from "node:fs/promises";
3
4
  import path from "node:path";
4
- import { listAgentIds, resolveAgentDir, resolveSessionAgentIds } from "openclaw/plugin-sdk/agent-runtime";
5
5
  import { isDeepStrictEqual } from "node:util";
6
- import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
7
- import { patchSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
8
6
  import { canonicalPathFromExistingAncestor, isPathInside, pathExists } from "openclaw/plugin-sdk/security-runtime";
7
+ import { listAgentIds, resolveAgentDir, resolveSessionAgentIds } from "openclaw/plugin-sdk/agent-scope-runtime";
9
8
  import { withFileLock } from "openclaw/plugin-sdk/file-lock";
10
- import { archiveLegacyStateSource, legacyStateFileExists } from "openclaw/plugin-sdk/runtime-doctor";
9
+ import { archiveLegacyStateSource, legacyStateFileExists } from "openclaw/plugin-sdk/runtime-doctor-migrations";
11
10
  //#region extensions/codex/src/migration/session-binding-sidecars.ts
12
11
  const LEGACY_BINDING_SUFFIX = ".codex-app-server.json";
13
12
  const CODEX_AGENT_HARNESS_ID = "codex";
@@ -22,6 +21,7 @@ const LEGACY_BINDING_LOCK_OPTIONS = {
22
21
  stale: 12e4
23
22
  };
24
23
  async function collectSessionSurfaces(params) {
24
+ const { resolveStorePath } = await import("openclaw/plugin-sdk/session-store-runtime");
25
25
  const surfaces = /* @__PURE__ */ new Map();
26
26
  const stateRoot = await canonicalPathFromExistingAncestor(params.stateDir);
27
27
  const add = async (root, storePath, agentId, scan) => {
@@ -34,7 +34,7 @@ async function collectSessionSurfaces(params) {
34
34
  };
35
35
  surface.scan ||= scan;
36
36
  surface.storePaths.add(path.resolve(storePath));
37
- surface.agentIds.add(agentId);
37
+ if (agentId) surface.agentIds.add(agentId);
38
38
  surfaces.set(canonicalRoot, surface);
39
39
  };
40
40
  const agentIds = new Set(listAgentIds(params.config));
@@ -58,8 +58,11 @@ async function collectSessionSurfaces(params) {
58
58
  await add(root, storePath, agentId, isPathInside(stateRoot, await canonicalPathFromExistingAncestor(root)));
59
59
  }
60
60
  const legacyRoot = path.join(params.stateDir, "sessions");
61
- const defaultAgentId = resolveSessionAgentIds({ config: params.config }).defaultAgentId;
62
- await add(legacyRoot, path.join(legacyRoot, "sessions.json"), defaultAgentId, true);
61
+ const legacyOwner = tryResolveLegacyBindingOwnerAgentId({
62
+ sessionKey: "",
63
+ config: params.config
64
+ });
65
+ await add(legacyRoot, path.join(legacyRoot, "sessions.json"), legacyOwner, true);
63
66
  return [...surfaces.values()].toSorted((a, b) => a.root.localeCompare(b.root));
64
67
  }
65
68
  async function collectLegacyBindingSources(params, options = {}) {
@@ -164,6 +167,7 @@ async function* walkSidecars(root) {
164
167
  }
165
168
  }
166
169
  async function collectBindingOwners(sources, surfaces, params) {
170
+ const { resolveStorePath } = await import("openclaw/plugin-sdk/session-store-runtime");
167
171
  const sourcePaths = new Set(await Promise.all(sources.map((source) => canonicalPathFromExistingAncestor(source.transcriptPath))));
168
172
  const owners = /* @__PURE__ */ new Map();
169
173
  const storePaths = new Set(surfaces.flatMap((surface) => [...surface.storePaths]));
@@ -184,11 +188,15 @@ async function collectBindingOwners(sources, surfaces, params) {
184
188
  const sessionsDir = path.dirname(storePath);
185
189
  for (const { sessionKey, entry } of index.entries) {
186
190
  const sessionId = entry.sessionId;
187
- const agentId = resolveLegacyBindingOwnerAgentId({
191
+ const agentId = tryResolveLegacyBindingOwnerAgentId({
188
192
  sessionKey,
189
193
  config: params.config,
190
194
  storeAgentIds: storeAgentIds.get(storePath)
191
195
  });
196
+ if (!agentId) {
197
+ failures.push(`session index ${storePath} has an ambiguous owner for ${sessionKey}`);
198
+ continue;
199
+ }
192
200
  let legacyTranscriptPath;
193
201
  let canonicalLegacyTranscriptPath;
194
202
  try {
@@ -246,6 +254,14 @@ function resolveLegacyBindingOwnerAgentId(params) {
246
254
  ...storeAgentId ? { agentId: storeAgentId } : {}
247
255
  }).sessionAgentId;
248
256
  }
257
+ function tryResolveLegacyBindingOwnerAgentId(params) {
258
+ try {
259
+ return resolveLegacyBindingOwnerAgentId(params);
260
+ } catch (error) {
261
+ if (error.code === "AGENT_SELECTION_REQUIRED") return;
262
+ throw error;
263
+ }
264
+ }
249
265
  function copyBindingForSession(stored, sessionId) {
250
266
  return stored.state === "active" ? {
251
267
  version: 1,
@@ -276,7 +292,7 @@ async function migrateSource(source, candidates, params, store) {
276
292
  return await withFileLock(source.sidecarPath, LEGACY_BINDING_LOCK_OPTIONS, async () => {
277
293
  const [contents, stat] = await Promise.all([fs.readFile(source.sidecarPath, "utf8"), fs.stat(source.sidecarPath)]);
278
294
  const raw = JSON.parse(contents);
279
- const [{ bindingStoreKey, createStoredCodexAppServerBinding, normalizeStoredCodexAppServerBindingFingerprints, readStoredCodexAppServerBinding }, { legacyCodexConversationBindingId }] = await Promise.all([import("./session-binding-DlVQ-Pxs.js").then((n) => n.u), import("./conversation-binding-data-BHRpYbX3.js").then((n) => n.t)]);
295
+ const [{ bindingStoreKey, createStoredCodexAppServerBinding, normalizeStoredCodexAppServerBindingFingerprints, readStoredCodexAppServerBinding }, { legacyCodexConversationBindingId }] = await Promise.all([import("./session-binding-DPxIvMgE.js").then((n) => n.f), import("./conversation-binding-data-CW2GuupV.js").then((n) => n.t)]);
280
296
  const agentId = owner?.agentId ?? (source.agentIds.size === 1 ? [...source.agentIds][0] : void 0);
281
297
  const baseStored = createStoredCodexAppServerBinding(raw, {
282
298
  now: stat.mtime.toISOString(),
@@ -398,6 +414,7 @@ async function migrateSource(source, candidates, params, store) {
398
414
  }
399
415
  }
400
416
  async function recordSessionOwner(owner, env) {
417
+ const { patchSessionEntry } = await import("openclaw/plugin-sdk/session-store-runtime");
401
418
  const currentIndex = await readLegacySessionIndex(owner.storePath);
402
419
  if ("failure" in currentIndex) return "its legacy session owner could not be revalidated";
403
420
  const currentOwner = currentIndex.entries.find(({ sessionKey }) => sessionKey === owner.sessionKey);
@@ -509,21 +526,18 @@ const stateMigrations = [{
509
526
  }];
510
527
  //#endregion
511
528
  //#region extensions/codex/doctor-contract-api.ts
512
- function asRecord(value) {
513
- return value && typeof value === "object" && !Array.isArray(value) ? value : null;
514
- }
515
529
  function hasRetiredDynamicToolsProfile(value) {
516
- return Object.hasOwn(asRecord(value) ?? {}, "codexDynamicToolsProfile");
530
+ return Object.hasOwn(asNullableRecord(value) ?? {}, "codexDynamicToolsProfile");
517
531
  }
518
532
  function hasLegacyPluginDestructivePolicy(value) {
519
- const codexPlugins = asRecord(value);
533
+ const codexPlugins = asNullableRecord(value);
520
534
  if (!codexPlugins) return false;
521
535
  if (codexPlugins.allow_destructive_actions === "on-request") return true;
522
- const plugins = asRecord(codexPlugins.plugins);
523
- return Object.values(plugins ?? {}).some((plugin) => asRecord(plugin)?.allow_destructive_actions === "on-request");
536
+ const plugins = asNullableRecord(codexPlugins.plugins);
537
+ return Object.values(plugins ?? {}).some((plugin) => asNullableRecord(plugin)?.allow_destructive_actions === "on-request");
524
538
  }
525
539
  function hasRetiredOnFailureApprovalPolicy(value) {
526
- return asRecord(value)?.approvalPolicy === "on-failure";
540
+ return asNullableRecord(value)?.approvalPolicy === "on-failure";
527
541
  }
528
542
  /** Legacy Codex config keys that doctor should report or repair. */
529
543
  const legacyConfigRules = [
@@ -564,9 +578,9 @@ const legacyConfigRules = [
564
578
  * Removes retired Codex plugin config keys while preserving unrelated config.
565
579
  */
566
580
  function normalizeCompatibilityConfig({ cfg }) {
567
- const rawPluginConfig = asRecord(asRecord(cfg.plugins?.entries?.codex)?.config);
568
- const rawCodexPlugins = asRecord(rawPluginConfig?.codexPlugins);
569
- const rawAppServer = asRecord(rawPluginConfig?.appServer);
581
+ const rawPluginConfig = asNullableRecord(asNullableRecord(cfg.plugins?.entries?.codex)?.config);
582
+ const rawCodexPlugins = asNullableRecord(rawPluginConfig?.codexPlugins);
583
+ const rawAppServer = asNullableRecord(rawPluginConfig?.appServer);
570
584
  const shouldRemoveDynamicToolsProfile = rawPluginConfig !== null && hasRetiredDynamicToolsProfile(rawPluginConfig);
571
585
  const shouldRewriteDestructivePolicy = hasLegacyPluginDestructivePolicy(rawCodexPlugins);
572
586
  const shouldRewriteApprovalPolicy = hasRetiredOnFailureApprovalPolicy(rawAppServer);
@@ -575,7 +589,7 @@ function normalizeCompatibilityConfig({ cfg }) {
575
589
  changes: []
576
590
  };
577
591
  const nextConfig = structuredClone(cfg);
578
- const nextPluginConfig = asRecord(asRecord(asRecord(asRecord(nextConfig.plugins)?.entries)?.codex)?.config);
592
+ const nextPluginConfig = asNullableRecord(asNullableRecord(asNullableRecord(asNullableRecord(nextConfig.plugins)?.entries)?.codex)?.config);
579
593
  if (!nextPluginConfig) return {
580
594
  config: cfg,
581
595
  changes: []
@@ -586,17 +600,17 @@ function normalizeCompatibilityConfig({ cfg }) {
586
600
  changes.push("Removed retired plugins.entries.codex.config.codexDynamicToolsProfile; Codex app-server always keeps Codex-native workspace tools native.");
587
601
  }
588
602
  if (shouldRewriteDestructivePolicy) {
589
- const nextCodexPlugins = asRecord(nextPluginConfig.codexPlugins);
603
+ const nextCodexPlugins = asNullableRecord(nextPluginConfig.codexPlugins);
590
604
  if (nextCodexPlugins?.allow_destructive_actions === "on-request") nextCodexPlugins.allow_destructive_actions = "auto";
591
- const nextPluginPolicies = asRecord(nextCodexPlugins?.plugins);
605
+ const nextPluginPolicies = asNullableRecord(nextCodexPlugins?.plugins);
592
606
  for (const plugin of Object.values(nextPluginPolicies ?? {})) {
593
- const nextPlugin = asRecord(plugin);
607
+ const nextPlugin = asNullableRecord(plugin);
594
608
  if (nextPlugin?.allow_destructive_actions === "on-request") nextPlugin.allow_destructive_actions = "auto";
595
609
  }
596
610
  changes.push("Renamed plugins.entries.codex.config.codexPlugins allow_destructive_actions=\"on-request\" values to \"auto\".");
597
611
  }
598
612
  if (shouldRewriteApprovalPolicy) {
599
- const nextAppServer = asRecord(nextPluginConfig.appServer);
613
+ const nextAppServer = asNullableRecord(nextPluginConfig.appServer);
600
614
  if (nextAppServer?.approvalPolicy === "on-failure") nextAppServer.approvalPolicy = "on-request";
601
615
  changes.push("Renamed plugins.entries.codex.config.appServer.approvalPolicy=\"on-failure\" to \"on-request\".");
602
616
  }
@@ -605,22 +619,5 @@ function normalizeCompatibilityConfig({ cfg }) {
605
619
  changes
606
620
  };
607
621
  }
608
- /** Session/auth ownership metadata used by doctor route-state checks. */
609
- const sessionRouteStateOwners = [{
610
- id: "codex",
611
- label: "Codex",
612
- providerIds: [
613
- "codex",
614
- "codex-cli",
615
- "openai-codex"
616
- ],
617
- runtimeIds: ["codex", "codex-cli"],
618
- cliSessionKeys: ["codex-cli"],
619
- authProfilePrefixes: [
620
- "codex:",
621
- "codex-cli:",
622
- "openai-codex:"
623
- ]
624
- }];
625
622
  //#endregion
626
- export { legacyConfigRules, normalizeCompatibilityConfig, sessionRouteStateOwners, stateMigrations };
623
+ export { legacyConfigRules, normalizeCompatibilityConfig, stateMigrations };