@openclaw/codex 2026.8.1-beta.3 → 2026.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/api.js +4 -5
  2. package/dist/{attempt-client-cleanup-URjUlCHg.js → attempt-client-cleanup-CVPvp9dL.js} +47 -5
  3. package/dist/{auth-binding-B4FfbcCg.js → auth-binding-Ds_QVm-X.js} +18 -3
  4. package/dist/{binding-connection-DAvZwp96.js → binding-connection-CCQFs8lf.js} +2 -2
  5. package/dist/{bounded-turn-4BjrZEwW.js → bounded-turn-rq5tiSXk.js} +13 -18
  6. package/dist/{capabilities-CH3K57v4.js → capabilities-CGm_94eL.js} +1 -1
  7. package/dist/cli-metadata.js +1 -1
  8. package/dist/{command-formatters-D0nZ3qtd.js → command-formatters-C54Yg3eA.js} +2 -2
  9. package/dist/{command-handlers-DC86lgT4.js → command-handlers-BvOAHTrA.js} +89 -62
  10. package/dist/{compact-COqgBRny.js → compact-Hd7SAc0N.js} +8 -9
  11. package/dist/{config-CpNeo5AE.js → config-Cxw3Cl3k.js} +346 -286
  12. package/dist/doctor-contract-api.js +115 -14
  13. package/dist/{dynamic-tools-fJZhl4CE.js → dynamic-tools-BFoUcRdx.js} +147 -903
  14. package/dist/{effective-mcp-catalog-4YKn51aG.js → effective-mcp-catalog-BTJHnDSx.js} +2 -2
  15. package/dist/{event-projector-assistant-message-BwxV4d6N.js → event-projector-assistant-message-C5-Ds8mA.js} +18 -1
  16. package/dist/{event-projector-usage-CLwNEJqW.js → event-projector-usage-D3PHFFXh.js} +3 -3
  17. package/dist/{harness-DoKQcF8n.js → harness-DVfUQBlQ.js} +42 -52
  18. package/dist/harness.js +1 -1
  19. package/dist/index.js +278 -295
  20. package/dist/{isolated-completion-DPMtlH9r.js → isolated-completion-Cbbx_5Ed.js} +4 -4
  21. package/dist/launch-args-sXOAg0SX.js +84 -0
  22. package/dist/{managed-binary-By4FZC6i.js → managed-binary-ZkGodW19.js} +43 -7
  23. package/dist/media-understanding-provider.js +1 -1
  24. package/dist/model-catalog-o6Cgjoss.js +101 -0
  25. package/dist/{models-CZw1wClT.js → models-DgFWSuxA.js} +25 -28
  26. package/dist/{native-subagent-monitor-GGq3RnOo.js → native-subagent-monitor-CwFyoylz.js} +207 -30
  27. package/dist/{node-exec-server.runtime-Bsu1LdFZ.js → node-exec-server.runtime-DXrqpw1c.js} +8 -5
  28. package/dist/{plugin-approval-roundtrip-C75Yiiwc.js → plugin-approval-roundtrip-D80UZiJ_.js} +1 -1
  29. package/dist/{plugin-marketplace-discovery-CSWDkMrP.js → plugin-marketplace-discovery-mdmScYOj.js} +30 -39
  30. package/dist/{plugin-metadata-cache-BXH5NF-4.js → plugin-metadata-cache-CulOABwu.js} +162 -135
  31. package/dist/{protocol-validators-VAVyEnDp.js → protocol-validators-Bg5rpNxk.js} +148 -5
  32. package/dist/{rate-limits-BI1dMHDG.js → rate-limits-hFtzt2Up.js} +1 -1
  33. package/dist/{sandbox-guard-C1qEeZ5C.js → request-CCm4LaED.js} +183 -2
  34. package/dist/{run-attempt-BV3HzuCf.js → run-attempt-BwNQDH2u.js} +599 -361
  35. package/dist/{runtime-artifact-BvyT1uyd.js → runtime-artifact-DeBvleJw.js} +1 -1
  36. package/dist/{session-binding-BTrLf9Qm.js → session-binding-q2WSTVmC.js} +195 -122
  37. package/dist/{session-catalog-ezP_UcRM.js → session-catalog-C2Tae4rI.js} +229 -122
  38. package/dist/session-catalog-home-id-DAKUrm3C.js +112 -0
  39. package/dist/{session-cli-B1hKvfkI.js → session-cli-BuDjm5Ou.js} +1 -1
  40. package/dist/session-permission-policy-gLm40Vtq.js +160 -0
  41. package/dist/session-retirement-CdkI0bvb.js +90 -0
  42. package/dist/{session-upstream-marker-D_2npHlA.js → session-upstream-marker-Bcy33kam.js} +2 -3
  43. package/dist/{settled-turn-finalizer-Dx1onIqg.js → settled-turn-finalizer-B8JJcxCi.js} +7 -6
  44. package/dist/{shared-client-Dw-rzii0.js → shared-client-kNkljY-R.js} +1720 -786
  45. package/dist/{side-question-DbXkJZzg.js → side-question-GwD73tX6.js} +69 -39
  46. package/dist/{thread-lifecycle-DKdrnTMX.js → thread-lifecycle-Ss-uwnC4.js} +852 -359
  47. package/dist/{thread-ownership-i2NBwDUL.js → thread-ownership-CeYBqg_4.js} +18 -8
  48. package/dist/{plugin-app-cache-key-DMNQ8Zi8.js → thread-resume-DF54hagX.js} +52 -6
  49. package/dist/{transcript-mirror-BU0_LKAL.js → transcript-mirror-CkEQIna-.js} +112 -13
  50. package/dist/transport-stdio-C7-s9TLG.js +708 -0
  51. package/dist/{upstream-session-fork-BDVJCLAD.js → upstream-session-fork-BACGlOFa.js} +78 -86
  52. package/dist/{usage-9dKJCgcy.js → usage-C2l8Mils.js} +3 -3
  53. package/dist/{web-search-provider.runtime-DCdx4DGu.js → web-search-provider.runtime-B2XgRdFv.js} +3 -3
  54. package/openclaw.plugin.json +19 -1
  55. package/package.json +8 -8
  56. package/dist/app-server-policy-bg5QPSVP.js +0 -25
  57. package/dist/command-rpc-xUIIonsO.js +0 -90
  58. package/dist/incognito-session-ET_ufDH-.js +0 -2
  59. package/dist/model-catalog-CmGoqVKB.js +0 -48
  60. package/dist/request-DSK0W6YI.js +0 -157
  61. package/dist/session-catalog-home-id-BNwAJ9D7.js +0 -18
  62. package/dist/session-retirement-CE4iMiLh.js +0 -36
  63. package/dist/thread-resume-CdJk2Ehf.js +0 -30
  64. package/dist/transport-stdio-DhoGy33Z.js +0 -99
@@ -1,14 +1,113 @@
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
+ import { asNullableRecord, asOptionalRecord, isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import fs from "node:fs/promises";
4
4
  import path from "node:path";
5
+ import { createHash } from "node:crypto";
5
6
  import { isDeepStrictEqual } from "node:util";
6
- import { listAgentIds, resolveAgentDir, resolveSessionAgentIds } from "openclaw/plugin-sdk/agent-scope-runtime";
7
7
  import { pathExists } from "openclaw/plugin-sdk/security-runtime";
8
+ import { listAgentIds, resolveAgentDir, resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
8
9
  import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
9
10
  import { canonicalPathFromExistingAncestor, isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
11
+ import { setImmediate } from "node:timers/promises";
10
12
  import { withFileLock } from "openclaw/plugin-sdk/file-lock";
11
13
  import { archiveLegacyStateSource, legacyStateFileExists } from "openclaw/plugin-sdk/runtime-doctor-migrations";
14
+ //#region extensions/codex/src/migration/session-binding-orphans.ts
15
+ const PAGE_SIZE = 512;
16
+ const KEY_PREFIXES = ["session-key:", "session:"];
17
+ function readBindingCandidate(row, prefix) {
18
+ const identity = /^([a-z0-9][a-z0-9_-]{0,63}):(.+)$/u.exec(row.key.slice(prefix.length));
19
+ if (!identity) return;
20
+ const agentId = identity[1];
21
+ const keyIdentity = identity[2];
22
+ const stored = asOptionalRecord(row.value);
23
+ const sessionId = typeof stored?.sessionId === "string" ? stored.sessionId.trim() : "";
24
+ const stable = prefix === "session-key:";
25
+ if (!stored || stored.version !== 1 || !sessionId || (stable ? !/^[A-Za-z0-9_-]{43}$/u.test(keyIdentity) : sessionId !== keyIdentity)) return;
26
+ if (stored.state === "cleared") {
27
+ if (stored.binding !== void 0 || stored.retired !== void 0 && stored.retired !== true) return;
28
+ } else if (stored.state === "active") {
29
+ const binding = asOptionalRecord(stored.binding);
30
+ if (!binding || typeof binding.threadId !== "string" || !binding.threadId.trim() || typeof binding.cwd !== "string" || binding.connectionScope !== void 0 || binding.supervisionSourceThreadId !== void 0 || binding.pendingSupervisionBranch !== void 0 || stored.retired !== void 0) return;
31
+ } else return;
32
+ if (stored.lease !== void 0) {
33
+ const lease = asOptionalRecord(stored.lease);
34
+ if (!lease || typeof lease.token !== "string" || !lease.token.trim() || typeof lease.expiresAt !== "number" || !Number.isFinite(lease.expiresAt) || lease.expiresAt > Date.now()) return;
35
+ }
36
+ return {
37
+ row,
38
+ agentId,
39
+ sessionId,
40
+ stable
41
+ };
42
+ }
43
+ async function* iterateOrphanBindingPages({ context }) {
44
+ const readPage = context.readPluginStateEntriesInKeyRange;
45
+ const readEvidence = context.readSessionIdentityEvidenceBatch;
46
+ if (!readPage || !readEvidence) return;
47
+ for (const prefix of KEY_PREFIXES) {
48
+ let after;
49
+ while (true) {
50
+ const rows = readPage(CODEX_APP_SERVER_BINDING_NAMESPACE, {
51
+ prefix,
52
+ ...after ? { after } : {},
53
+ limit: PAGE_SIZE
54
+ });
55
+ if (rows.length === 0) break;
56
+ after = rows.at(-1)?.key;
57
+ const candidates = rows.flatMap((row) => {
58
+ const candidate = readBindingCandidate(row, prefix);
59
+ return candidate ? [candidate] : [];
60
+ });
61
+ if (candidates.length > 0) {
62
+ const identities = new Map(candidates.map(({ agentId, sessionId }) => [`${agentId}\0${sessionId}`, {
63
+ agentId,
64
+ sessionId
65
+ }]));
66
+ const evidence = new Map((await readEvidence([...identities.values()])).map((owner) => [`${owner.agentId}\0${owner.sessionId}`, owner]));
67
+ const stale = candidates.filter(({ row, agentId, sessionId, stable }) => {
68
+ const owner = evidence.get(`${agentId}\0${sessionId}`);
69
+ if (!owner || owner.state === "unknown") return false;
70
+ if (owner.state !== "current") return true;
71
+ if (!stable) return false;
72
+ const digest = createHash("sha256").update(owner.sessionKey).digest("base64url");
73
+ return row.key !== `session-key:${agentId}:${digest}`;
74
+ }).map(({ row }) => row);
75
+ if (stale.length > 0) yield stale;
76
+ }
77
+ if (rows.length < PAGE_SIZE) break;
78
+ await setImmediate();
79
+ }
80
+ }
81
+ }
82
+ const codexOrphanedSessionBindingMigration = {
83
+ id: "codex-app-server-orphaned-session-bindings",
84
+ label: "Codex app-server orphaned session bindings",
85
+ doctorOnly: true,
86
+ phase: "after-session-repair",
87
+ async detectLegacyState(params) {
88
+ for await (const _ of iterateOrphanBindingPages(params)) return { preview: ["- Codex app-server bindings: remove orphaned session ownership"] };
89
+ return null;
90
+ },
91
+ async migrateLegacyState(params) {
92
+ const remove = params.context.deletePluginStateEntriesIfUnchanged;
93
+ if (!remove) return {
94
+ changes: [],
95
+ warnings: ["Codex session binding repair requires locked SQLite maintenance ownership"]
96
+ };
97
+ let deleted = 0;
98
+ let changed = 0;
99
+ for await (const rows of iterateOrphanBindingPages(params)) {
100
+ const result = remove(CODEX_APP_SERVER_BINDING_NAMESPACE, rows);
101
+ deleted += result.deleted;
102
+ changed += result.changed;
103
+ }
104
+ return {
105
+ changes: deleted > 0 ? [`Removed ${deleted} orphaned Codex app-server session binding(s)`] : [],
106
+ warnings: changed > 0 ? [`Preserved ${changed} Codex app-server session binding(s) changed during repair`] : []
107
+ };
108
+ }
109
+ };
110
+ //#endregion
12
111
  //#region extensions/codex/src/migration/session-binding-sidecars.ts
13
112
  const LEGACY_BINDING_SUFFIX = ".codex-app-server.json";
14
113
  const CODEX_AGENT_HARNESS_ID = "codex";
@@ -43,7 +142,7 @@ async function collectSessionSurfaces(params) {
43
142
  const agentsDir = path.join(params.stateDir, "agents");
44
143
  for (const entry of await readDirectoryEntries(agentsDir)) {
45
144
  if (!entry.isDirectory() || entry.isSymbolicLink()) continue;
46
- const agentId = resolveSessionAgentIds({
145
+ const agentId = resolveSessionAgentIdsStrict({
47
146
  agentId: entry.name,
48
147
  config: params.config
49
148
  }).sessionAgentId;
@@ -245,7 +344,7 @@ async function resolveLegacySessionFileLocator(sessionsDir, entry, sessionId) {
245
344
  return candidate;
246
345
  }
247
346
  function tryResolveLegacyBindingOwnerAgentId(params) {
248
- if (params.sessionKey.trim().toLowerCase().startsWith("agent:")) return resolveSessionAgentIds({
347
+ if (params.sessionKey.trim().toLowerCase().startsWith("agent:")) return resolveSessionAgentIdsStrict({
249
348
  sessionKey: params.sessionKey,
250
349
  config: params.config
251
350
  }).sessionAgentId;
@@ -254,7 +353,7 @@ function tryResolveLegacyBindingOwnerAgentId(params) {
254
353
  const systemAgentId = !storeAgentId && configuredAgentId ? normalizeAgentId(configuredAgentId) : void 0;
255
354
  const fallbackAgentIds = systemAgentId && listAgentIds(params.config).includes(systemAgentId) ? [void 0, systemAgentId] : [void 0];
256
355
  for (const fallbackAgentId of fallbackAgentIds) try {
257
- return resolveSessionAgentIds({
356
+ return resolveSessionAgentIdsStrict({
258
357
  sessionKey: params.sessionKey,
259
358
  config: params.config,
260
359
  ...storeAgentId ? { agentId: storeAgentId } : fallbackAgentId ? { fallbackAgentId } : {}
@@ -293,7 +392,7 @@ async function migrateSource(source, candidates, params, store) {
293
392
  return await withFileLock(source.sidecarPath, LEGACY_BINDING_LOCK_OPTIONS, async () => {
294
393
  const [contents, stat] = await Promise.all([fs.readFile(source.sidecarPath, "utf8"), fs.stat(source.sidecarPath)]);
295
394
  const raw = JSON.parse(contents);
296
- const [{ bindingStoreKey, createStoredCodexAppServerBinding, normalizeStoredCodexAppServerBindingFingerprints, readStoredCodexAppServerBinding }, { legacyCodexConversationBindingId }] = await Promise.all([import("./session-binding-BTrLf9Qm.js").then((n) => n.f), import("./conversation-binding-data-CW2GuupV.js").then((n) => n.t)]);
395
+ const [{ bindingStoreKey, createStoredCodexAppServerBinding, normalizeStoredCodexAppServerBindingFingerprints, readStoredCodexAppServerBinding }, { legacyCodexConversationBindingId }] = await Promise.all([import("./session-binding-q2WSTVmC.js").then((n) => n.f), import("./conversation-binding-data-CW2GuupV.js").then((n) => n.t)]);
297
396
  const agentId = owner?.agentId ?? (source.agentIds.size === 1 ? [...source.agentIds][0] : void 0);
298
397
  const baseStored = createStoredCodexAppServerBinding(raw, {
299
398
  now: stat.mtime.toISOString(),
@@ -478,7 +577,7 @@ function isSafeLegacySessionId(value) {
478
577
  const trimmed = value.trim();
479
578
  return trimmed.length > 0 && trimmed.length <= 255 && /^[A-Za-z0-9][A-Za-z0-9._:@-]*$/.test(trimmed);
480
579
  }
481
- const stateMigrations = [{
580
+ const stateMigrations$1 = [{
482
581
  id: "codex-app-server-sidecars-to-plugin-state",
483
582
  label: "Codex app-server thread bindings",
484
583
  async detectLegacyState(params) {
@@ -537,8 +636,9 @@ function hasLegacyPluginDestructivePolicy(value) {
537
636
  const plugins = asNullableRecord(codexPlugins.plugins);
538
637
  return Object.values(plugins ?? {}).some((plugin) => asNullableRecord(plugin)?.allow_destructive_actions === "on-request");
539
638
  }
540
- function hasRetiredOnFailureApprovalPolicy(value) {
541
- return asNullableRecord(value)?.approvalPolicy === "on-failure";
639
+ function hasRetiredApprovalPolicy(value) {
640
+ const approvalPolicy = asNullableRecord(value)?.approvalPolicy;
641
+ return approvalPolicy === "on-failure" || approvalPolicy === "untrusted";
542
642
  }
543
643
  /** Legacy Codex config keys that doctor should report or repair. */
544
644
  const legacyConfigRules = [
@@ -571,8 +671,8 @@ const legacyConfigRules = [
571
671
  "config",
572
672
  "appServer"
573
673
  ],
574
- message: "plugins.entries.codex.config.appServer.approvalPolicy=\"on-failure\" was retired by Codex 0.143; use \"on-request\". Run \"openclaw doctor --fix\".",
575
- match: hasRetiredOnFailureApprovalPolicy
674
+ message: "plugins.entries.codex.config.appServer.approvalPolicy values \"on-failure\" and \"untrusted\" are retired; use \"on-request\". Run \"openclaw doctor --fix\".",
675
+ match: hasRetiredApprovalPolicy
576
676
  }
577
677
  ];
578
678
  /**
@@ -584,7 +684,7 @@ function normalizeCompatibilityConfig({ cfg }) {
584
684
  const rawAppServer = asNullableRecord(rawPluginConfig?.appServer);
585
685
  const shouldRemoveDynamicToolsProfile = rawPluginConfig !== null && hasRetiredDynamicToolsProfile(rawPluginConfig);
586
686
  const shouldRewriteDestructivePolicy = hasLegacyPluginDestructivePolicy(rawCodexPlugins);
587
- const shouldRewriteApprovalPolicy = hasRetiredOnFailureApprovalPolicy(rawAppServer);
687
+ const shouldRewriteApprovalPolicy = hasRetiredApprovalPolicy(rawAppServer);
588
688
  if (!rawPluginConfig || !shouldRemoveDynamicToolsProfile && !shouldRewriteDestructivePolicy && !shouldRewriteApprovalPolicy) return {
589
689
  config: cfg,
590
690
  changes: []
@@ -612,13 +712,14 @@ function normalizeCompatibilityConfig({ cfg }) {
612
712
  }
613
713
  if (shouldRewriteApprovalPolicy) {
614
714
  const nextAppServer = asNullableRecord(nextPluginConfig.appServer);
615
- if (nextAppServer?.approvalPolicy === "on-failure") nextAppServer.approvalPolicy = "on-request";
616
- changes.push("Renamed plugins.entries.codex.config.appServer.approvalPolicy=\"on-failure\" to \"on-request\".");
715
+ if (nextAppServer?.approvalPolicy === "on-failure" || nextAppServer?.approvalPolicy === "untrusted") nextAppServer.approvalPolicy = "on-request";
716
+ changes.push("Renamed retired plugins.entries.codex.config.appServer.approvalPolicy to \"on-request\".");
617
717
  }
618
718
  return {
619
719
  config: nextConfig,
620
720
  changes
621
721
  };
622
722
  }
723
+ const stateMigrations = [...stateMigrations$1, codexOrphanedSessionBindingMigration];
623
724
  //#endregion
624
725
  export { legacyConfigRules, normalizeCompatibilityConfig, stateMigrations };