@openclaw/codex 2026.7.2-beta.4 → 2026.7.2-beta.7

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 (40) hide show
  1. package/dist/{app-server-policy-BO3jYBkv.js → app-server-policy-BSaO2JIT.js} +1 -1
  2. package/dist/{attempt-notifications-DdmnBMUp.js → attempt-notifications-AP-a-Q5k.js} +1 -1
  3. package/dist/{bounded-turn-CaQL96kg.js → bounded-turn-D2ZAgZVz.js} +54 -24
  4. package/dist/{capabilities-CLICvTxf.js → capabilities-BFDTVYr4.js} +1 -1
  5. package/dist/cli-metadata.js +1 -1
  6. package/dist/{command-formatters-DgADqnHa.js → command-formatters-C336eRVS.js} +2 -2
  7. package/dist/{command-handlers-l_lVPNlB.js → command-handlers-DAHUSry9.js} +1233 -1222
  8. package/dist/{compact-CC5KhBzX.js → compact-D_uvHurS.js} +8 -8
  9. package/dist/{computer-use-Ip1-QGa-.js → computer-use-CYEc8U3w.js} +123 -115
  10. package/dist/{conversation-control-sNPsbTCP.js → conversation-control-xsIeXbo4.js} +6 -6
  11. package/dist/doctor-contract-api.js +24 -86
  12. package/dist/{dynamic-tools-CQI3UwqY.js → dynamic-tools-D2gYkSBO.js} +482 -91
  13. package/dist/effective-mcp-catalog-Bbd98Inw.js +114 -0
  14. package/dist/{event-projector-usage-D6tE7_qD.js → event-projector-usage-Xp4AlR2k.js} +20 -3
  15. package/dist/harness.js +19 -14
  16. package/dist/index.js +292 -328
  17. package/dist/media-understanding-provider.js +6 -1
  18. package/dist/{models-BNeMlHgg.js → models-BBMKU4jA.js} +2 -2
  19. package/dist/{notification-correlation-BGLixv5_.js → notification-correlation-CU6_AnOb.js} +3 -3
  20. package/dist/{plugin-app-cache-key-CvzvmBRz.js → plugin-app-cache-key-DztPafOA.js} +135 -42
  21. package/dist/{rate-limits-D0IJT-a6.js → rate-limits-CU-gVCCS.js} +1 -1
  22. package/dist/{request-BTccUTD3.js → request-qKh331yu.js} +3 -3
  23. package/dist/{run-attempt--858NXDl.js → run-attempt-CY9WlDLc.js} +1060 -402
  24. package/dist/{runtime-artifact-C2ITXdhM.js → runtime-artifact-CmtG_t1L.js} +90 -24
  25. package/dist/{sandbox-guard-D1Wky__S.js → sandbox-guard-NuhpXmPB.js} +4 -0
  26. package/dist/{session-binding-ZSMX1omP.js → session-binding-BXpo9ymA.js} +1006 -891
  27. package/dist/{session-catalog-DsKaezgR.js → session-catalog-DyOgR4WH.js} +289 -56
  28. package/dist/{session-cli-CYJTfRLG.js → session-cli-2PZaFLRh.js} +2 -2
  29. package/dist/{session-upstream-marker-D7XlI9us.js → session-upstream-marker-B6U7tLw5.js} +1 -1
  30. package/dist/{settled-turn-finalizer-DHltNgtF.js → settled-turn-finalizer-CXY2Z9dT.js} +19 -6
  31. package/dist/{shared-client-wmgNFNYp.js → shared-client-DTbvH-XV.js} +1993 -1720
  32. package/dist/{side-question-BfFZCsJ-.js → side-question-_ulBk1AL.js} +12 -10
  33. package/dist/{thread-lifecycle-cqrOlJkq.js → thread-lifecycle-DF53ogiA.js} +980 -346
  34. package/dist/{transcript-mirror-2p7kl6e4.js → transcript-mirror-DzsdNCf5.js} +80 -41
  35. package/dist/{upstream-session-fork-vPjwkT1i.js → upstream-session-fork-Dy4Xvuoj.js} +3 -3
  36. package/dist/{usage-DM_I3mPT.js → usage-CQ6GhD5-.js} +3 -3
  37. package/dist/{web-search-provider.runtime-Bx6HAc_k.js → web-search-provider.runtime-CCFhg2z5.js} +3 -3
  38. package/package.json +6 -8
  39. package/npm-shrinkwrap.json +0 -202
  40. package/dist/{auth-binding-C1czuHPA.js → auth-binding-B4FfbcCg.js} +1 -1
@@ -0,0 +1,114 @@
1
+ import { d as retainSharedCodexAppServerClientByInstanceId } from "./shared-client-DTbvH-XV.js";
2
+ import { d as sessionBindingIdentity } from "./session-binding-BXpo9ymA.js";
3
+ import { assignMcpCatalogSafeServerNames } from "openclaw/plugin-sdk/agent-harness-runtime";
4
+ //#region extensions/codex/src/app-server/effective-mcp-catalog.ts
5
+ const MCP_STATUS_PAGE_SIZE = 100;
6
+ const MCP_STATUS_MAX_PAGES = 100;
7
+ function asRecord(value) {
8
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
9
+ }
10
+ function readString(value) {
11
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
12
+ }
13
+ function catalogTool(params) {
14
+ const raw = asRecord(params.raw);
15
+ const description = readString(raw?.description);
16
+ return {
17
+ serverName: params.serverName,
18
+ safeServerName: params.safeServerName,
19
+ toolName: params.toolName,
20
+ ...readString(raw?.title) ? { title: readString(raw?.title) } : {},
21
+ ...description ? { description } : {},
22
+ inputSchema: asRecord(raw?.inputSchema) ?? { type: "object" },
23
+ fallbackDescription: description ?? params.toolName,
24
+ ...params.deniedBySession ? { deniedBySession: true } : {}
25
+ };
26
+ }
27
+ /** Converts Codex's thread-scoped status response into OpenClaw's MCP catalog shape. */
28
+ function buildCodexEffectiveMcpCatalog(statuses, toolOverrides) {
29
+ const orderedStatuses = [...new Map(statuses.map((status) => [status.name, status])).values()].toSorted((left, right) => left.name.localeCompare(right.name));
30
+ const safeNames = assignMcpCatalogSafeServerNames(orderedStatuses.map((status) => status.name));
31
+ const serverEntries = [];
32
+ const tools = [];
33
+ const sessionDeniedTools = [];
34
+ for (const status of orderedStatuses) {
35
+ const safeServerName = safeNames.get(status.name) ?? status.name;
36
+ const denialMap = toolOverrides?.mcpToolsDeny;
37
+ const deniedNames = new Set(denialMap && Object.hasOwn(denialMap, status.name) ? denialMap[status.name] : []);
38
+ const observedNames = /* @__PURE__ */ new Set();
39
+ for (const [toolName, raw] of Object.entries(status.tools).toSorted(([left], [right]) => left.localeCompare(right))) {
40
+ observedNames.add(toolName);
41
+ const deniedBySession = deniedNames.has(toolName) ? true : void 0;
42
+ const tool = catalogTool({
43
+ serverName: status.name,
44
+ safeServerName,
45
+ toolName,
46
+ raw,
47
+ ...deniedBySession ? { deniedBySession } : {}
48
+ });
49
+ if (deniedBySession) sessionDeniedTools.push(tool);
50
+ else tools.push(tool);
51
+ }
52
+ for (const toolName of [...deniedNames].toSorted()) {
53
+ if (observedNames.has(toolName)) continue;
54
+ sessionDeniedTools.push(catalogTool({
55
+ serverName: status.name,
56
+ safeServerName,
57
+ toolName,
58
+ deniedBySession: true
59
+ }));
60
+ }
61
+ serverEntries.push([status.name, {
62
+ serverName: status.name,
63
+ safeServerName,
64
+ launchSummary: "Codex native MCP connection",
65
+ toolCount: observedNames.size + [...deniedNames].filter((name) => !observedNames.has(name)).length
66
+ }]);
67
+ }
68
+ return {
69
+ version: 1,
70
+ generatedAt: Date.now(),
71
+ servers: Object.fromEntries(serverEntries),
72
+ tools,
73
+ ...sessionDeniedTools.length > 0 ? { sessionDeniedTools } : {}
74
+ };
75
+ }
76
+ async function listCodexMcpServerStatuses(client, threadId) {
77
+ const statuses = [];
78
+ const seenCursors = /* @__PURE__ */ new Set();
79
+ let cursor;
80
+ for (let page = 0; page < MCP_STATUS_MAX_PAGES; page += 1) {
81
+ const response = await client.request("mcpServerStatus/list", {
82
+ threadId,
83
+ detail: "toolsAndAuthOnly",
84
+ limit: MCP_STATUS_PAGE_SIZE,
85
+ ...cursor ? { cursor } : {}
86
+ });
87
+ statuses.push(...response.data);
88
+ cursor = response.nextCursor;
89
+ if (!cursor) return statuses;
90
+ if (seenCursors.has(cursor)) throw new Error("Codex mcpServerStatus/list repeated its pagination cursor");
91
+ seenCursors.add(cursor);
92
+ }
93
+ throw new Error("Codex mcpServerStatus/list exceeded the bounded page limit");
94
+ }
95
+ /** Loads MCP inventory only from the already-bound Codex process and thread. */
96
+ async function loadCodexEffectiveMcpCatalog(params, options) {
97
+ const binding = await options.bindingStore.read(sessionBindingIdentity({
98
+ agentId: params.agentId,
99
+ sessionId: params.sessionId,
100
+ sessionKey: params.sessionKey,
101
+ config: params.config
102
+ }));
103
+ if (!binding?.clientId) return;
104
+ const retained = retainSharedCodexAppServerClientByInstanceId(binding.clientId);
105
+ if (!retained) return;
106
+ try {
107
+ const allowedServerNames = new Set(params.mcpServerNames);
108
+ return buildCodexEffectiveMcpCatalog((await listCodexMcpServerStatuses(retained.client, binding.threadId)).filter((status) => allowedServerNames.has(status.name)), params.toolOverrides);
109
+ } finally {
110
+ retained.release();
111
+ }
112
+ }
113
+ //#endregion
114
+ export { loadCodexEffectiveMcpCatalog };
@@ -1,5 +1,5 @@
1
- import { Q as isJsonObject } from "./shared-client-wmgNFNYp.js";
2
- import { dt as readNonNegativeInteger, pt as readNumber } from "./thread-lifecycle-cqrOlJkq.js";
1
+ import { W as isJsonObject } from "./shared-client-DTbvH-XV.js";
2
+ import { at as readNonNegativeInteger, ct as readString, st as readNumber } from "./thread-lifecycle-DF53ogiA.js";
3
3
  import { normalizeUsage } from "openclaw/plugin-sdk/agent-harness-runtime";
4
4
  //#region extensions/codex/src/app-server/event-projector-usage.ts
5
5
  function readTokenCount(record, key) {
@@ -65,5 +65,22 @@ function normalizeCodexResponseTokenUsage(record) {
65
65
  }
66
66
  };
67
67
  }
68
+ var CodexResponseCompletionProjection = class {
69
+ constructor() {
70
+ this.responseIds = /* @__PURE__ */ new Set();
71
+ }
72
+ get modelIterations() {
73
+ return this.responseIds.size;
74
+ }
75
+ clear() {
76
+ this.usage = void 0;
77
+ }
78
+ record(params) {
79
+ const responseId = readString(params, "responseId");
80
+ if (responseId) this.responseIds.add(responseId);
81
+ const usage = isJsonObject(params.usage) ? params.usage : void 0;
82
+ this.usage = usage ? normalizeCodexResponseTokenUsage(usage) : void 0;
83
+ }
84
+ };
68
85
  //#endregion
69
- export { projectCodexThreadUsageUpdate as n, normalizeCodexResponseTokenUsage as t };
86
+ export { normalizeCodexResponseTokenUsage as n, projectCodexThreadUsageUpdate as r, CodexResponseCompletionProjection as t };
package/dist/harness.js CHANGED
@@ -35,7 +35,7 @@ function createCodexAppServerAgentHarness(options) {
35
35
  ...sessionCatalogControl && sessionRuntime ? { sessionFork: {
36
36
  upstreamKinds: ["codex-app-server"],
37
37
  fork: async (params) => {
38
- const { forkCodexUpstreamSession } = await import("./upstream-session-fork-vPjwkT1i.js");
38
+ const { forkCodexUpstreamSession } = await import("./upstream-session-fork-Dy4Xvuoj.js");
39
39
  return await forkCodexUpstreamSession(params, {
40
40
  bindingStore: options.bindingStore,
41
41
  control: sessionCatalogControl,
@@ -46,17 +46,21 @@ function createCodexAppServerAgentHarness(options) {
46
46
  }
47
47
  } } : {},
48
48
  authBinding: { fingerprint: async (params) => {
49
- const { fingerprintCodexAppServerAuthBinding } = await import("./auth-binding-C1czuHPA.js").then((n) => n.t);
49
+ const { fingerprintCodexAppServerAuthBinding } = await import("./auth-binding-B4FfbcCg.js").then((n) => n.t);
50
50
  return fingerprintCodexAppServerAuthBinding(params);
51
51
  } },
52
52
  runtimeArtifact: { validate: async (binding) => {
53
- const { validateCodexAppServerRuntimeArtifact } = await import("./runtime-artifact-C2ITXdhM.js");
53
+ const { validateCodexAppServerRuntimeArtifact } = await import("./runtime-artifact-CmtG_t1L.js");
54
54
  return validateCodexAppServerRuntimeArtifact(binding);
55
55
  } },
56
56
  fetchUsageSnapshot: async (ctx) => {
57
- const { fetchCodexAppServerUsageSnapshot } = await import("./usage-DM_I3mPT.js");
57
+ const { fetchCodexAppServerUsageSnapshot } = await import("./usage-CQ6GhD5-.js");
58
58
  return await fetchCodexAppServerUsageSnapshot(ctx, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
59
59
  },
60
+ loadMcpToolCatalog: async (params) => {
61
+ const { loadCodexEffectiveMcpCatalog } = await import("./effective-mcp-catalog-Bbd98Inw.js");
62
+ return await loadCodexEffectiveMcpCatalog(params, { bindingStore: options.bindingStore });
63
+ },
60
64
  supports: (ctx) => {
61
65
  const provider = ctx.provider.trim().toLowerCase();
62
66
  if (!providerIds.has(provider)) return {
@@ -95,7 +99,7 @@ function createCodexAppServerAgentHarness(options) {
95
99
  };
96
100
  },
97
101
  runAttempt: async (params) => {
98
- const { runCodexAppServerAttempt } = await import("./run-attempt--858NXDl.js");
102
+ const { runCodexAppServerAttempt } = await import("./run-attempt-CY9WlDLc.js");
99
103
  return runCodexAppServerAttempt(params, {
100
104
  bindingStore: options.bindingStore,
101
105
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
@@ -103,11 +107,11 @@ function createCodexAppServerAgentHarness(options) {
103
107
  });
104
108
  },
105
109
  finalizeSettledTurn: async (params) => {
106
- const { runCodexSettledTurnFinalization } = await import("./settled-turn-finalizer-DHltNgtF.js");
110
+ const { runCodexSettledTurnFinalization } = await import("./settled-turn-finalizer-CXY2Z9dT.js");
107
111
  return runCodexSettledTurnFinalization(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
108
112
  },
109
113
  runSideQuestion: async (params) => {
110
- const { runCodexAppServerSideQuestion } = await import("./side-question-BfFZCsJ-.js");
114
+ const { runCodexAppServerSideQuestion } = await import("./side-question-_ulBk1AL.js");
111
115
  return runCodexAppServerSideQuestion(params, {
112
116
  bindingStore: options.bindingStore,
113
117
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
@@ -115,14 +119,14 @@ function createCodexAppServerAgentHarness(options) {
115
119
  });
116
120
  },
117
121
  compact: async (params) => {
118
- const { maybeCompactCodexAppServerSession } = await import("./compact-CC5KhBzX.js");
122
+ const { maybeCompactCodexAppServerSession } = await import("./compact-D_uvHurS.js");
119
123
  return maybeCompactCodexAppServerSession(params, {
120
124
  bindingStore: options.bindingStore,
121
125
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig
122
126
  });
123
127
  },
124
128
  compactAfterContextEngine: async (params) => {
125
- const { maybeCompactCodexAppServerSession } = await import("./compact-CC5KhBzX.js");
129
+ const { maybeCompactCodexAppServerSession } = await import("./compact-D_uvHurS.js");
126
130
  return maybeCompactCodexAppServerSession(params, {
127
131
  bindingStore: options.bindingStore,
128
132
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
@@ -131,21 +135,22 @@ function createCodexAppServerAgentHarness(options) {
131
135
  },
132
136
  reset: async (params) => {
133
137
  if (params.sessionId) {
134
- const { reclaimCurrentCodexSessionGeneration, sessionBindingIdentity } = await import("./session-binding-ZSMX1omP.js").then((n) => n.u);
138
+ const { reclaimCurrentCodexSessionGeneration, sessionBindingIdentity } = await import("./session-binding-BXpo9ymA.js").then((n) => n.f);
135
139
  const identity = sessionBindingIdentity({
136
140
  agentId: params.agentId,
137
141
  sessionId: params.sessionId,
138
142
  sessionKey: params.sessionKey
139
143
  });
140
- let retired = await options.bindingStore.retireSessionGeneration(identity);
141
- if (retired === "conflict") {
144
+ const resetGeneration = params.reason === "deleted" ? options.bindingStore.retireSessionGeneration.bind(options.bindingStore) : options.bindingStore.resetSessionGeneration.bind(options.bindingStore);
145
+ let reset = await resetGeneration(identity);
146
+ if (reset === "conflict") {
142
147
  if (await reclaimCurrentCodexSessionGeneration({
143
148
  bindingStore: options.bindingStore,
144
149
  identity,
145
150
  config: options.resolveConfig?.()
146
- })) retired = await options.bindingStore.retireSessionGeneration(identity);
151
+ })) reset = await resetGeneration(identity);
147
152
  }
148
- if (retired === "conflict") throw new Error(`Codex binding generation changed before session ${params.sessionId} could reset`);
153
+ if (reset === "conflict") throw new Error(`Codex binding generation changed before session ${params.sessionId} could reset`);
149
154
  }
150
155
  },
151
156
  dispose: disposeSharedCodexAppServerClients