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

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/dist/{app-server-policy-BO3jYBkv.js → app-server-policy-BmDgseo_.js} +1 -1
  2. package/dist/attempt-client-cleanup-Ia52yRWc.js +127 -0
  3. package/dist/{attempt-notifications-DdmnBMUp.js → attempt-notifications-CMR2_fmR.js} +1 -1
  4. package/dist/{bounded-turn-CaQL96kg.js → bounded-turn-FEbUXoYT.js} +36 -13
  5. package/dist/{capabilities-CLICvTxf.js → capabilities-BHRSI6Cn.js} +1 -1
  6. package/dist/cli-metadata.js +1 -1
  7. package/dist/{command-formatters-DgADqnHa.js → command-formatters-ico4ZFnk.js} +2 -2
  8. package/dist/{command-handlers-l_lVPNlB.js → command-handlers-CRmnwI2N.js} +1232 -1221
  9. package/dist/{compact-CC5KhBzX.js → compact-dEN49UH6.js} +7 -7
  10. package/dist/{computer-use-Ip1-QGa-.js → computer-use-BjGylO-E.js} +16 -6
  11. package/dist/{conversation-control-sNPsbTCP.js → conversation-control-DE7d9DOj.js} +6 -6
  12. package/dist/doctor-contract-api.js +24 -86
  13. package/dist/{dynamic-tools-CQI3UwqY.js → dynamic-tools-LIt9ojep.js} +50 -46
  14. package/dist/{event-projector-usage-D6tE7_qD.js → event-projector-usage-tvgb1NCX.js} +2 -2
  15. package/dist/harness.js +14 -13
  16. package/dist/index.js +208 -267
  17. package/dist/media-understanding-provider.js +6 -1
  18. package/dist/{models-BNeMlHgg.js → models-BA01NEez.js} +2 -2
  19. package/dist/{notification-correlation-BGLixv5_.js → notification-correlation-Bj_Ak_jI.js} +3 -3
  20. package/dist/{plugin-app-cache-key-CvzvmBRz.js → plugin-app-cache-key-DSXX-rXO.js} +5 -5
  21. package/dist/{transcript-mirror-2p7kl6e4.js → protocol-validators-Dm4eXZmt.js} +2 -550
  22. package/dist/{rate-limits-D0IJT-a6.js → rate-limits-S_PXs0ul.js} +1 -1
  23. package/dist/realtime-voice-api-BPcA1uN9.js +494 -0
  24. package/dist/realtime-voice-api.js +2 -0
  25. package/dist/{request-BTccUTD3.js → request-CXpPennK.js} +1 -1
  26. package/dist/{run-attempt--858NXDl.js → run-attempt-C5GTPJOE.js} +417 -237
  27. package/dist/{session-binding-ZSMX1omP.js → session-binding-DlVQ-Pxs.js} +952 -890
  28. package/dist/{session-catalog-DsKaezgR.js → session-catalog-CP2oCcEb.js} +32 -23
  29. package/dist/{session-cli-CYJTfRLG.js → session-cli-CqZ0Fp2a.js} +2 -2
  30. package/dist/{session-upstream-marker-D7XlI9us.js → session-upstream-marker-QE-m5QFG.js} +1 -1
  31. package/dist/{settled-turn-finalizer-DHltNgtF.js → settled-turn-finalizer-CA_2QXIE.js} +2 -2
  32. package/dist/{shared-client-wmgNFNYp.js → shared-client-BVKE40c-.js} +1863 -1707
  33. package/dist/{side-question-BfFZCsJ-.js → side-question-CO12sHxo.js} +11 -9
  34. package/dist/{thread-lifecycle-cqrOlJkq.js → thread-lifecycle-DRg_FdzC.js} +12 -132
  35. package/dist/transcript-mirror-uKA-A4tB.js +550 -0
  36. package/dist/{upstream-session-fork-vPjwkT1i.js → upstream-session-fork-_Vrz4WJr.js} +3 -3
  37. package/dist/{usage-DM_I3mPT.js → usage-UpVbdX5G.js} +3 -3
  38. package/dist/{web-search-provider.runtime-Bx6HAc_k.js → web-search-provider.runtime-CaQMYDbp.js} +3 -3
  39. package/package.json +4 -5
  40. package/npm-shrinkwrap.json +0 -202
  41. package/dist/{auth-binding-C1czuHPA.js → auth-binding-B4FfbcCg.js} +1 -1
@@ -1,4 +1,4 @@
1
- import { m as canUseCodexModelBackedApprovalsReviewerForModel } from "./session-binding-ZSMX1omP.js";
1
+ import { b as canUseCodexModelBackedApprovalsReviewerForModel } from "./session-binding-DlVQ-Pxs.js";
2
2
  //#region extensions/codex/src/app-server/app-server-policy.ts
3
3
  /**
4
4
  * Policy promotion for Codex app-server runs that can safely use OpenClaw tool
@@ -0,0 +1,127 @@
1
+ import { f as retireSharedCodexAppServerClientIfCurrent, n as clearSharedCodexAppServerClientIfCurrentAndUnclaimed, t as clearSharedCodexAppServerClientIfCurrent } from "./shared-client-BVKE40c-.js";
2
+ import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
3
+ //#region extensions/codex/src/app-server/attempt-client-cleanup.ts
4
+ /**
5
+ * Best-effort cleanup helpers for Codex app-server startup attempts and turns.
6
+ */
7
+ /** Timeout for best-effort app-server turn interruption during cleanup. */
8
+ const CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS = 5e3;
9
+ /** Timeout for best-effort thread unsubscribe during cleanup. */
10
+ const CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS = 5e3;
11
+ /** Raised when a thread subscription may be live on a client OpenClaw no longer controls. */
12
+ var CodexAppServerUnsafeSubscriptionError = class extends Error {
13
+ constructor(message, options) {
14
+ super(message, options);
15
+ this.name = "CodexAppServerUnsafeSubscriptionError";
16
+ }
17
+ };
18
+ function isCodexAppServerUnsafeSubscriptionError(error) {
19
+ return error instanceof CodexAppServerUnsafeSubscriptionError;
20
+ }
21
+ /** Asserts Codex resumed the exact thread this attempt subscribed to. */
22
+ function assertCodexThreadResumeSubscription(requestedThreadId, returnedThreadId) {
23
+ if (returnedThreadId !== requestedThreadId) throw new CodexAppServerUnsafeSubscriptionError(`Codex thread/resume returned ${returnedThreadId} for ${requestedThreadId}`);
24
+ }
25
+ async function closeClientAndWaitIfAvailable(client) {
26
+ const closeable = client;
27
+ if (typeof closeable.closeAndWait === "function") {
28
+ await closeable.closeAndWait();
29
+ return;
30
+ }
31
+ closeable.close?.();
32
+ }
33
+ async function closeCodexStartupClientBestEffort(client) {
34
+ if (!client) return;
35
+ const unclaimedSharedClient = clearSharedCodexAppServerClientIfCurrentAndUnclaimed(client);
36
+ if (unclaimedSharedClient.closed) {
37
+ await closeClientAndWaitIfAvailable(client);
38
+ return;
39
+ }
40
+ if (unclaimedSharedClient.found) {
41
+ if (retireSharedCodexAppServerClientIfCurrent(client)?.closed) await closeClientAndWaitIfAvailable(client);
42
+ return;
43
+ }
44
+ const retiredSharedClient = retireSharedCodexAppServerClientIfCurrent(client);
45
+ if (retiredSharedClient) {
46
+ if (retiredSharedClient.closed) await closeClientAndWaitIfAvailable(client);
47
+ return;
48
+ }
49
+ if (clearSharedCodexAppServerClientIfCurrent(client)) {
50
+ await closeClientAndWaitIfAvailable(client);
51
+ return;
52
+ }
53
+ await closeClientAndWaitIfAvailable(client);
54
+ }
55
+ /** Sends a turn interrupt without blocking abort cleanup on app-server errors. */
56
+ function interruptCodexTurnBestEffort(client, params) {
57
+ interruptCodexTurnAndWaitBestEffort(client, params);
58
+ }
59
+ /** Sends a bounded turn interrupt and waits for Codex to confirm terminal abort handling. */
60
+ async function interruptCodexTurnAndWaitBestEffort(client, params) {
61
+ const requestOptions = params.timeoutMs && Number.isFinite(params.timeoutMs) && params.timeoutMs > 0 ? { timeoutMs: params.timeoutMs } : void 0;
62
+ const requestParams = {
63
+ threadId: params.threadId,
64
+ turnId: params.turnId
65
+ };
66
+ try {
67
+ await (requestOptions ? client.request("turn/interrupt", requestParams, requestOptions) : client.request("turn/interrupt", requestParams));
68
+ } catch (error) {
69
+ embeddedAgentLog.debug("codex app-server turn interrupt failed during abort", { error });
70
+ }
71
+ }
72
+ /** Unsubscribes from a thread while swallowing cleanup-only failures. */
73
+ async function unsubscribeCodexThreadBestEffort(client, params) {
74
+ try {
75
+ await client.request("thread/unsubscribe", { threadId: params.threadId }, { timeoutMs: params.timeoutMs });
76
+ return true;
77
+ } catch (error) {
78
+ embeddedAgentLog.debug("codex app-server thread unsubscribe cleanup failed", {
79
+ threadId: params.threadId,
80
+ error
81
+ });
82
+ return false;
83
+ }
84
+ }
85
+ /**
86
+ * Retires the shared client after a timed-out turn so later runs do not reuse a
87
+ * potentially wedged app-server connection.
88
+ */
89
+ async function retireCodexAppServerClientAfterTimedOutTurn(client, params) {
90
+ const retiredSharedClient = retireSharedCodexAppServerClientIfCurrent(client, { failActiveLeases: params.suspectPhysicalClient });
91
+ const detachedSharedClient = Boolean(retiredSharedClient);
92
+ if (!(params.suspectPhysicalClient && (retiredSharedClient?.closed ?? false))) {
93
+ interruptCodexTurnBestEffort(client, {
94
+ threadId: params.threadId,
95
+ turnId: params.turnId,
96
+ timeoutMs: CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS
97
+ });
98
+ await unsubscribeCodexThreadBestEffort(client, {
99
+ threadId: params.threadId,
100
+ timeoutMs: CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS
101
+ });
102
+ }
103
+ let closedClient = retiredSharedClient?.closed ?? false;
104
+ if (!detachedSharedClient) {
105
+ const close = client.close;
106
+ if (typeof close === "function") try {
107
+ close.call(client);
108
+ closedClient = true;
109
+ } catch (error) {
110
+ embeddedAgentLog.debug("codex app-server client close failed during timeout cleanup", {
111
+ threadId: params.threadId,
112
+ turnId: params.turnId,
113
+ error
114
+ });
115
+ }
116
+ }
117
+ embeddedAgentLog.warn("codex app-server client retired after timed-out turn", {
118
+ threadId: params.threadId,
119
+ turnId: params.turnId,
120
+ reason: params.reason,
121
+ detachedSharedClient,
122
+ closedClient,
123
+ activeSharedClientLeases: retiredSharedClient?.activeLeases ?? 0
124
+ });
125
+ }
126
+ //#endregion
127
+ export { closeCodexStartupClientBestEffort as a, isCodexAppServerUnsafeSubscriptionError as c, assertCodexThreadResumeSubscription as i, retireCodexAppServerClientAfterTimedOutTurn as l, CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS as n, interruptCodexTurnAndWaitBestEffort as o, CodexAppServerUnsafeSubscriptionError as r, interruptCodexTurnBestEffort as s, CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS as t, unsubscribeCodexThreadBestEffort as u };
@@ -1,4 +1,4 @@
1
- import { Q as isJsonObject } from "./shared-client-wmgNFNYp.js";
1
+ import { V as isJsonObject } from "./shared-client-BVKE40c-.js";
2
2
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
3
3
  //#region extensions/codex/src/app-server/attempt-notifications.ts
4
4
  /**
@@ -1,10 +1,11 @@
1
- import { Q as isJsonObject, o as isCodexAppServerStartSelectionChangedError } from "./shared-client-wmgNFNYp.js";
2
- import { _ as readCodexNotificationItem, h as isRetryableErrorNotification } from "./attempt-notifications-DdmnBMUp.js";
3
- import { x as resolveCodexAppServerRuntimeOptions } from "./session-binding-ZSMX1omP.js";
4
- import { Q as mergeCodexThreadConfigs, d as buildCodexRingZeroThreadConfigPatch, f as buildCodexRuntimeThreadConfig, l as assertCodexRingZeroHasNoManagedHooks, p as readCodexInheritedMcpServerNames, u as attestCodexRingZeroThreadHasNoMcpServers } from "./thread-lifecycle-cqrOlJkq.js";
5
- import { t as normalizeCodexResponseTokenUsage } from "./event-projector-usage-D6tE7_qD.js";
6
- import { C as readCodexTurnCompletedNotification, _ as assertCodexThreadStartResponse, b as readCodexErrorNotification, v as assertCodexTurnStartResponse } from "./transcript-mirror-2p7kl6e4.js";
7
- import { r as readModelListResult } from "./models-BNeMlHgg.js";
1
+ import { V as isJsonObject, s as isCodexAppServerStartSelectionChangedError } from "./shared-client-BVKE40c-.js";
2
+ import { p as resolveCodexAppServerRuntimeOptions } from "./session-binding-DlVQ-Pxs.js";
3
+ import { o as interruptCodexTurnAndWaitBestEffort, t as CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS } from "./attempt-client-cleanup-Ia52yRWc.js";
4
+ import { _ as readCodexNotificationItem, h as isRetryableErrorNotification } from "./attempt-notifications-CMR2_fmR.js";
5
+ import { G as mergeCodexThreadConfigs, d as buildCodexRingZeroThreadConfigPatch, f as buildCodexRuntimeThreadConfig, l as assertCodexRingZeroHasNoManagedHooks, p as readCodexInheritedMcpServerNames, u as attestCodexRingZeroThreadHasNoMcpServers } from "./thread-lifecycle-DRg_FdzC.js";
6
+ import { t as normalizeCodexResponseTokenUsage } from "./event-projector-usage-tvgb1NCX.js";
7
+ import { a as assertCodexTurnStartResponse, i as assertCodexThreadStartResponse, s as readCodexErrorNotification, u as readCodexTurnCompletedNotification } from "./protocol-validators-Dm4eXZmt.js";
8
+ import { r as readModelListResult } from "./models-BA01NEez.js";
8
9
  import fs from "node:fs/promises";
9
10
  import path from "node:path";
10
11
  import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
@@ -65,22 +66,39 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
65
66
  authProfileId: params.profile,
66
67
  agentDir,
67
68
  config: params.config,
68
- timeoutMs
69
- }) : await import("./shared-client-wmgNFNYp.js").then((n) => n.f).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
69
+ timeoutMs,
70
+ ...params.signal ? { abandonSignal: params.signal } : {}
71
+ }) : await import("./shared-client-BVKE40c-.js").then((n) => n.p).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
70
72
  startOptions,
71
73
  timeoutMs,
72
74
  authProfileId: params.profile,
73
75
  agentDir,
74
76
  authProfileStore: params.authProfileStore,
75
- config: params.config
77
+ config: params.config,
78
+ ...params.signal ? { abandonSignal: params.signal } : {}
76
79
  }));
77
80
  const abortController = new AbortController();
78
- const abortFromCaller = () => abortController.abort(params.signal?.reason ?? "aborted");
81
+ let activeThreadId;
82
+ let activeTurnId = "";
83
+ let interruptPromise;
84
+ const requestInterrupt = () => {
85
+ if (!activeThreadId || interruptPromise) return;
86
+ interruptPromise = interruptCodexTurnAndWaitBestEffort(client, {
87
+ threadId: activeThreadId,
88
+ turnId: activeTurnId,
89
+ timeoutMs: CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS
90
+ });
91
+ };
92
+ const abortRun = (reason) => {
93
+ abortController.abort(reason);
94
+ requestInterrupt();
95
+ };
96
+ const abortFromCaller = () => abortRun(params.signal?.reason ?? "aborted");
79
97
  if (params.signal?.aborted) abortFromCaller();
80
98
  else params.signal?.addEventListener("abort", abortFromCaller, { once: true });
81
99
  const remainingRunMs = deadline - Date.now();
82
- if (remainingRunMs <= 0) abortController.abort("timeout");
83
- const timeout = setTimeout(() => abortController.abort("timeout"), Math.max(1, remainingRunMs));
100
+ if (remainingRunMs <= 0) abortRun("timeout");
101
+ const timeout = setTimeout(() => abortRun("timeout"), Math.max(1, remainingRunMs));
84
102
  timeout.unref?.();
85
103
  let retrySelection = false;
86
104
  try {
@@ -111,6 +129,8 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
111
129
  timeoutMs,
112
130
  signal: abortController.signal
113
131
  }));
132
+ activeThreadId = thread.thread.id;
133
+ if (abortController.signal.aborted) requestInterrupt();
114
134
  if (params.requireNoExternalCapabilities) await attestCodexRingZeroThreadHasNoMcpServers(client, thread.thread.id, abortController.signal);
115
135
  if (params.historyItems?.length) await client.request("thread/inject_items", {
116
136
  threadId: thread.thread.id,
@@ -134,6 +154,8 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
134
154
  timeoutMs,
135
155
  signal: abortController.signal
136
156
  }));
157
+ activeTurnId = turn.turn.id;
158
+ if (abortController.signal.aborted) requestInterrupt();
137
159
  return {
138
160
  ...await collector.collect(turn.turn, {
139
161
  timeoutMs,
@@ -151,6 +173,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
151
173
  } finally {
152
174
  clearTimeout(timeout);
153
175
  params.signal?.removeEventListener("abort", abortFromCaller);
176
+ await interruptPromise;
154
177
  if (ownsClient) client.close();
155
178
  }
156
179
  if (retrySelection) return await runBoundedCodexAppServerTurnInWorkspace(params, appServer, workspace, selectionAttempt + 1, {
@@ -1,4 +1,4 @@
1
- import { R as CodexAppServerRpcError } from "./shared-client-wmgNFNYp.js";
1
+ import { _ as CodexAppServerRpcError } from "./shared-client-BVKE40c-.js";
2
2
  //#region extensions/codex/src/app-server/capabilities.ts
3
3
  /**
4
4
  * Capability helpers for optional Codex app-server control-plane methods.
@@ -2,7 +2,7 @@ import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
2
2
  //#region extensions/codex/cli-metadata.ts
3
3
  function registerCodexCliMetadata(api) {
4
4
  api.registerCli(async ({ program }) => {
5
- const { registerCodexSessionCli } = await import("./session-cli-CYJTfRLG.js");
5
+ const { registerCodexSessionCli } = await import("./session-cli-CqZ0Fp2a.js");
6
6
  registerCodexSessionCli(program);
7
7
  }, { descriptors: [{
8
8
  name: "codex",
@@ -1,5 +1,5 @@
1
- import { Q as isJsonObject } from "./shared-client-wmgNFNYp.js";
2
- import { c as summarizeCodexRateLimits, o as summarizeCodexAccountRateLimits, r as hasCodexRateLimitSnapshots } from "./rate-limits-D0IJT-a6.js";
1
+ import { V as isJsonObject } from "./shared-client-BVKE40c-.js";
2
+ import { c as summarizeCodexRateLimits, o as summarizeCodexAccountRateLimits, r as hasCodexRateLimitSnapshots } from "./rate-limits-S_PXs0ul.js";
3
3
  //#region extensions/codex/src/command-formatters.ts
4
4
  /** Formats the combined `/codex status` probe result. */
5
5
  function formatCodexStatus(probes) {