@openclaw/codex 2026.8.1-beta.2 → 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 +146 -0
  2. package/dist/{attempt-client-cleanup-DMLXUfa8.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-I5Bo-AsX.js → binding-connection-CCQFs8lf.js} +15 -3
  5. package/dist/{bounded-turn-qgZmzy_4.js → bounded-turn-rq5tiSXk.js} +27 -26
  6. package/dist/{capabilities-CybGI1oz.js → capabilities-CGm_94eL.js} +1 -1
  7. package/dist/cli-metadata.js +1 -1
  8. package/dist/{command-formatters-B1AEz8ZA.js → command-formatters-C54Yg3eA.js} +2 -2
  9. package/dist/{command-handlers-Db8pu_ds.js → command-handlers-BvOAHTrA.js} +111 -67
  10. package/dist/{compact-LspQaGfl.js → compact-Hd7SAc0N.js} +35 -30
  11. package/dist/{session-binding-DPxIvMgE.js → config-Cxw3Cl3k.js} +361 -1161
  12. package/dist/context-compaction-activity-BOeJf7yo.js +58 -0
  13. package/dist/doctor-contract-api.js +128 -26
  14. package/dist/{dynamic-tools-BVdyWkUD.js → dynamic-tools-BFoUcRdx.js} +1341 -1464
  15. package/dist/{effective-mcp-catalog-DIIhAtOZ.js → effective-mcp-catalog-BTJHnDSx.js} +2 -2
  16. package/dist/elicitation-input-DMkeki8d.js +71 -0
  17. package/dist/{event-projector-assistant-message-BwxV4d6N.js → event-projector-assistant-message-C5-Ds8mA.js} +18 -1
  18. package/dist/{event-projector-usage-e5huIQWu.js → event-projector-usage-D3PHFFXh.js} +18 -18
  19. package/dist/harness-DVfUQBlQ.js +248 -0
  20. package/dist/harness.js +2 -226
  21. package/dist/index.js +405 -299
  22. package/dist/{isolated-completion-C58NbL40.js → isolated-completion-Cbbx_5Ed.js} +4 -4
  23. package/dist/launch-args-sXOAg0SX.js +84 -0
  24. package/dist/managed-binary-ZkGodW19.js +248 -0
  25. package/dist/media-understanding-provider.js +2 -2
  26. package/dist/model-catalog-o6Cgjoss.js +101 -0
  27. package/dist/{models-BFlpn1Ex.js → models-DgFWSuxA.js} +25 -28
  28. package/dist/{native-subagent-monitor-DyTGmTUx.js → native-subagent-monitor-CwFyoylz.js} +385 -94
  29. package/dist/node-exec-server.runtime-DXrqpw1c.js +195 -0
  30. package/dist/plugin-approval-roundtrip-D80UZiJ_.js +95 -0
  31. package/dist/{plugin-marketplace-discovery-CzrGJdCR.js → plugin-marketplace-discovery-mdmScYOj.js} +60 -55
  32. package/dist/{plugin-metadata-cache-CNJPj4_b.js → plugin-metadata-cache-CulOABwu.js} +164 -134
  33. package/dist/{protocol-validators-B4F7L8Rf.js → protocol-validators-Bg5rpNxk.js} +203 -7
  34. package/dist/{rate-limits-DZXmOL8-.js → rate-limits-hFtzt2Up.js} +1 -1
  35. package/dist/{sandbox-guard-Cmwc9eIk.js → request-CCm4LaED.js} +207 -20
  36. package/dist/{run-attempt-P8BdxC1I.js → run-attempt-BwNQDH2u.js} +1506 -836
  37. package/dist/{runtime-artifact-BVSPdd6g.js → runtime-artifact-DeBvleJw.js} +4 -7
  38. package/dist/session-binding-q2WSTVmC.js +947 -0
  39. package/dist/{session-catalog-xwNi_SDM.js → session-catalog-C2Tae4rI.js} +1698 -1346
  40. package/dist/session-catalog-home-id-DAKUrm3C.js +112 -0
  41. package/dist/{session-cli-7hgXZDV7.js → session-cli-BuDjm5Ou.js} +20 -7
  42. package/dist/session-permission-policy-gLm40Vtq.js +160 -0
  43. package/dist/session-retirement-CdkI0bvb.js +90 -0
  44. package/dist/{session-upstream-marker-CrIFX06J.js → session-upstream-marker-Bcy33kam.js} +2 -3
  45. package/dist/{settled-turn-finalizer-BRWBO4MO.js → settled-turn-finalizer-B8JJcxCi.js} +27 -22
  46. package/dist/{shared-client-kIBbGjk4.js → shared-client-kNkljY-R.js} +2023 -607
  47. package/dist/{side-question-9HAL26l9.js → side-question-GwD73tX6.js} +109 -57
  48. package/dist/{thread-lifecycle-Bu1BTDXr.js → thread-lifecycle-Ss-uwnC4.js} +1208 -497
  49. package/dist/{thread-ownership-6kOQHlyC.js → thread-ownership-CeYBqg_4.js} +18 -8
  50. package/dist/{plugin-app-cache-key-C3H2CVp6.js → thread-resume-DF54hagX.js} +64 -6
  51. package/dist/{transcript-mirror-B9gGgnJS.js → transcript-mirror-CkEQIna-.js} +158 -41
  52. package/dist/transport-stdio-C7-s9TLG.js +708 -0
  53. package/dist/{upstream-prompt-provenance-ClRBije0.js → upstream-prompt-provenance-CFmsKwr9.js} +12 -14
  54. package/dist/{upstream-session-fork-CE-_LdnP.js → upstream-session-fork-BACGlOFa.js} +86 -88
  55. package/dist/{usage-CHlV0e-o.js → usage-C2l8Mils.js} +3 -3
  56. package/dist/{web-search-provider.runtime-DRw2Vl42.js → web-search-provider.runtime-B2XgRdFv.js} +3 -3
  57. package/openclaw.plugin.json +50 -2
  58. package/package.json +9 -8
  59. package/dist/app-server-policy-zcBDc1JU.js +0 -49
  60. package/dist/incognito-session-ET_ufDH-.js +0 -2
  61. package/dist/request-BRl5_UfX.js +0 -157
  62. package/dist/session-retirement-DoMMJFKm.js +0 -36
  63. package/dist/thread-resume-CPrJNQVM.js +0 -30
  64. package/dist/transport-stdio-DIImwDVS.js +0 -99
@@ -1,157 +0,0 @@
1
- import { _ as withTimeout, a as getLeasedSharedCodexAppServerClient, i as createIsolatedCodexAppServerClient, l as releaseLeasedSharedCodexAppServerClient, p as retireSharedCodexAppServerClientIfCurrent, s as isCodexAppServerStartSelectionChangedError } from "./shared-client-kIBbGjk4.js";
2
- import { t as resolveCodexAppServerDirectSandboxBypassBlock } from "./sandbox-guard-Cmwc9eIk.js";
3
- //#region extensions/codex/src/app-server/request.ts
4
- /** Sends one guarded request over a client lease owned by the caller. */
5
- async function requestCodexAppServerClientJson(params) {
6
- const sandboxBlock = resolveCodexAppServerDirectSandboxBypassBlock({
7
- method: params.method,
8
- requestParams: params.requestParams,
9
- config: params.config,
10
- sessionKey: params.sessionKey,
11
- sessionId: params.sessionId
12
- });
13
- if (sandboxBlock) throw new Error(sandboxBlock);
14
- const timeoutMs = params.timeoutMs ?? 6e4;
15
- return await withTimeout(params.client.request(params.method, params.requestParams, { timeoutMs }), timeoutMs, `codex app-server ${params.method} timed out`);
16
- }
17
- async function requestCodexAppServerJson(params) {
18
- const sandboxBlock = resolveCodexAppServerDirectSandboxBypassBlock({
19
- method: params.method,
20
- requestParams: params.requestParams,
21
- config: params.config,
22
- sessionKey: params.sessionKey,
23
- sessionId: params.sessionId
24
- });
25
- if (sandboxBlock) throw new Error(sandboxBlock);
26
- return await withCodexAppServerJsonClient({
27
- ...params,
28
- timeoutMessage: `codex app-server ${params.method} timed out`
29
- }, async (request) => await request({
30
- method: params.method,
31
- requestParams: params.requestParams
32
- }));
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
- }
86
- /**
87
- * Runs several guarded requests over one acquired client (shared lease or
88
- * isolated child) so related reads see the same app-server session. The whole
89
- * callback re-runs once when the client's start selection changed underneath it.
90
- */
91
- async function withCodexAppServerJsonClient(params, run) {
92
- const timeoutMs = params.timeoutMs ?? 6e4;
93
- const timeoutMessage = params.timeoutMessage ?? "codex app-server request timed out";
94
- const timeoutController = new AbortController();
95
- const deadline = Number.isFinite(timeoutMs) && timeoutMs > 0 ? Date.now() + timeoutMs : void 0;
96
- const isPastDeadline = () => deadline !== void 0 && Date.now() >= deadline;
97
- const throwIfAbandoned = () => {
98
- if (timeoutController.signal.aborted || isPastDeadline()) throw new Error(timeoutMessage);
99
- };
100
- const remainingTimeoutMs = () => {
101
- throwIfAbandoned();
102
- return deadline === void 0 ? timeoutMs : Math.max(1, deadline - Date.now());
103
- };
104
- try {
105
- return await withTimeout((async () => {
106
- for (let attempt = 0; attempt < 2; attempt += 1) {
107
- throwIfAbandoned();
108
- const client = await (params.isolated ? createIsolatedCodexAppServerClient : getLeasedSharedCodexAppServerClient)({
109
- startOptions: params.startOptions,
110
- pluginConfig: params.pluginConfig,
111
- timeoutMs: remainingTimeoutMs(),
112
- authProfileId: params.authProfileId,
113
- agentDir: params.agentDir,
114
- config: params.config,
115
- abandonSignal: timeoutController.signal
116
- });
117
- try {
118
- throwIfAbandoned();
119
- const scopedRequest = async (request) => {
120
- const sandboxBlock = resolveCodexAppServerDirectSandboxBypassBlock({
121
- method: request.method,
122
- requestParams: request.requestParams,
123
- config: params.config,
124
- sessionKey: params.sessionKey,
125
- sessionId: params.sessionId
126
- });
127
- if (sandboxBlock) throw new Error(sandboxBlock);
128
- throwIfAbandoned();
129
- return await client.request(request.method, request.requestParams, {
130
- timeoutMs: remainingTimeoutMs(),
131
- signal: timeoutController.signal
132
- });
133
- };
134
- return await run(scopedRequest, client);
135
- } catch (error) {
136
- if (!isCodexAppServerStartSelectionChangedError(error) || attempt > 0) throw error;
137
- if (!params.isolated) retireSharedCodexAppServerClientIfCurrent(client);
138
- throwIfAbandoned();
139
- } finally {
140
- if (params.isolated) await client.closeAndWait({
141
- exitTimeoutMs: params.isolatedShutdown?.exitTimeoutMs ?? 2e3,
142
- forceKillDelayMs: params.isolatedShutdown?.forceKillDelayMs ?? 250
143
- });
144
- else releaseLeasedSharedCodexAppServerClient(client);
145
- }
146
- }
147
- throw new Error("Codex app-server selection retry loop exited unexpectedly");
148
- })(), timeoutMs, timeoutMessage);
149
- } catch (error) {
150
- if (isPastDeadline()) throw new Error(timeoutMessage, { cause: error });
151
- throw error;
152
- } finally {
153
- timeoutController.abort();
154
- }
155
- }
156
- //#endregion
157
- export { withCodexAppServerJsonClient as i, requestCodexAppServerClientJson as n, requestCodexAppServerJson as r, readCodexAppServerUsage as t };
@@ -1,36 +0,0 @@
1
- import { K as releaseCodexAppServerLiveThread, d as retainSharedCodexAppServerClientByInstanceId } from "./shared-client-kIBbGjk4.js";
2
- import { a as closeCodexStartupClientBestEffort, d as unsubscribeCodexThreadBestEffort, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-DMLXUfa8.js";
3
- import { t as isIncognitoSessionKey } from "./incognito-session-ET_ufDH-.js";
4
- import { t as codexNativeSubagentMonitorRuntime } from "./native-subagent-monitor-DyTGmTUx.js";
5
- //#region extensions/codex/src/app-server/session-retirement.ts
6
- /** Retire binding and native subscription under the same generation/physical-client ownership fence. */
7
- async function retireCodexAppServerSessionGeneration(params) {
8
- const retireGeneration = () => params.mode === "reset" ? params.bindingStore.resetSessionGeneration(params.identity) : params.bindingStore.retireSessionGeneration(params.identity);
9
- const expectedBinding = await params.bindingStore.read(params.identity);
10
- if (!expectedBinding) return await retireGeneration();
11
- return await params.bindingStore.withLease(params.identity, async () => {
12
- const binding = await params.bindingStore.read(params.identity);
13
- if (binding?.threadId !== expectedBinding.threadId) return "conflict";
14
- const result = await retireGeneration();
15
- if (result !== "applied" || !binding?.clientId) return result;
16
- const clientLease = retainSharedCodexAppServerClientByInstanceId(binding.clientId);
17
- if (!clientLease) return result;
18
- try {
19
- codexNativeSubagentMonitorRuntime.retireParent(clientLease.client, binding.threadId);
20
- if (!await releaseCodexAppServerLiveThread(clientLease.client, binding.threadId) && isIncognitoSessionKey(params.identity.sessionKey)) {
21
- if (!await unsubscribeCodexThreadBestEffort(clientLease.client, {
22
- threadId: binding.threadId,
23
- timeoutMs: 5e3
24
- })) {
25
- await closeCodexStartupClientBestEffort(clientLease.client);
26
- throw new CodexAppServerUnsafeSubscriptionError(`Codex retired session subscription could not be released: ${binding.threadId}`);
27
- }
28
- }
29
- } finally {
30
- clientLease.release();
31
- }
32
- return result;
33
- });
34
- }
35
- //#endregion
36
- export { retireCodexAppServerSessionGeneration };
@@ -1,30 +0,0 @@
1
- import { F as isCodexAppServerPrewriteRequestCancellationError, s as isCodexAppServerStartSelectionChangedError, z as CodexAppServerRpcError } from "./shared-client-kIBbGjk4.js";
2
- import { i as assertCodexThreadResumeSubscription, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-DMLXUfa8.js";
3
- import { i as assertCodexThreadResumeResponse } from "./protocol-validators-B4F7L8Rf.js";
4
- //#region extensions/codex/src/app-server/thread-resume.ts
5
- /** Owns Codex thread/resume subscription safety. */
6
- /** Resumes one thread and retires the physical client when acceptance is indeterminate. */
7
- async function resumeCodexAppServerThread(params) {
8
- const threadId = params.request.threadId;
9
- let response;
10
- try {
11
- response = assertCodexThreadResumeResponse(await params.client.request("thread/resume", params.request, {
12
- ...params.timeoutMs !== void 0 ? { timeoutMs: params.timeoutMs } : {},
13
- ...params.signal ? { signal: params.signal } : {}
14
- }));
15
- assertCodexThreadResumeSubscription(threadId, response.thread.id);
16
- } catch (error) {
17
- if (isCodexAppServerStartSelectionChangedError(error) || isCodexAppServerPrewriteRequestCancellationError(error)) throw error;
18
- if (error instanceof CodexAppServerRpcError) throw error;
19
- try {
20
- await params.abandonClient();
21
- } catch (abandonError) {
22
- throw new CodexAppServerUnsafeSubscriptionError(`Codex thread/resume client could not be retired for ${threadId}`, { cause: abandonError });
23
- }
24
- if (error instanceof CodexAppServerUnsafeSubscriptionError) throw error;
25
- throw new CodexAppServerUnsafeSubscriptionError(error instanceof Error ? error.message : `Codex thread/resume outcome is indeterminate for ${threadId}`, { cause: error });
26
- }
27
- return response;
28
- }
29
- //#endregion
30
- export { resumeCodexAppServerThread as t };
@@ -1,99 +0,0 @@
1
- import { materializeWindowsSpawnProgram, resolveWindowsSpawnProgram } from "openclaw/plugin-sdk/windows-spawn";
2
- import { spawn } from "node:child_process";
3
- //#region extensions/codex/src/app-server/transport-stdio.ts
4
- /**
5
- * Creates and configures stdio-backed Codex app-server transports, including
6
- * Windows spawn normalization and environment filtering.
7
- */
8
- const UNSAFE_ENVIRONMENT_KEYS = /* @__PURE__ */ new Set([
9
- "__proto__",
10
- "constructor",
11
- "prototype"
12
- ]);
13
- const RUNTIME_INJECTION_ENVIRONMENT_KEYS = /* @__PURE__ */ new Set([
14
- "NODE_PATH",
15
- "LD_AUDIT",
16
- "LD_LIBRARY_PATH",
17
- "LD_PRELOAD"
18
- ]);
19
- const QA_PARENT_PID_ENV = "OPENCLAW_QA_PARENT_PID";
20
- const DEFAULT_SPAWN_RUNTIME = {
21
- platform: process.platform,
22
- env: process.env,
23
- execPath: process.execPath
24
- };
25
- /** Resolves the concrete command/argv/shell settings used to spawn Codex app-server. */
26
- function resolveCodexAppServerSpawnInvocation(options, runtime = DEFAULT_SPAWN_RUNTIME) {
27
- if (options.commandSource === "managed") throw new Error("Managed Codex app-server start options must be resolved before spawn.");
28
- const resolved = materializeWindowsSpawnProgram(resolveWindowsSpawnProgram({
29
- command: options.command,
30
- platform: runtime.platform,
31
- env: runtime.env,
32
- execPath: runtime.execPath,
33
- packageName: "@openai/codex"
34
- }), options.args);
35
- return {
36
- command: resolved.command,
37
- args: resolved.argv,
38
- shell: resolved.shell,
39
- windowsHide: resolved.windowsHide
40
- };
41
- }
42
- /** Merges app-server environment overrides while honoring clearEnv and unsafe key filtering. */
43
- function resolveCodexAppServerSpawnEnv(options, baseEnv = process.env, platform = process.platform) {
44
- const env = Object.create(null);
45
- copySafeEnvironmentEntries(env, baseEnv);
46
- copySafeEnvironmentEntries(env, options.env ?? {});
47
- const keysToClear = normalizedEnvironmentKeys(options.clearEnv ?? []);
48
- if (platform === "win32") {
49
- const lowerCaseKeysToClear = new Set(keysToClear.map((key) => key.toLowerCase()));
50
- for (const candidate of Object.keys(env)) if (lowerCaseKeysToClear.has(candidate.toLowerCase())) delete env[candidate];
51
- } else for (const key of keysToClear) delete env[key];
52
- for (const key of Object.keys(env)) if (isCodexRuntimeInjectionEnvironmentKey(key)) delete env[key];
53
- return env;
54
- }
55
- function isCodexRuntimeInjectionEnvironmentKey(rawKey) {
56
- const key = rawKey.toUpperCase();
57
- return RUNTIME_INJECTION_ENVIRONMENT_KEYS.has(key) || key.startsWith("DYLD_");
58
- }
59
- /** Keeps QA-owned app-server processes inside the gateway process-group cleanup boundary. */
60
- function resolveCodexAppServerDetachedMode(env, platform = process.platform) {
61
- return platform !== "win32" && !env[QA_PARENT_PID_ENV]?.trim();
62
- }
63
- function normalizedEnvironmentKeys(rawKeys) {
64
- const keys = [];
65
- for (const rawKey of rawKeys) {
66
- const key = rawKey.trim();
67
- if (key.length > 0) keys.push(key);
68
- }
69
- return keys;
70
- }
71
- function copySafeEnvironmentEntries(target, source) {
72
- for (const [key, value] of Object.entries(source)) {
73
- if (UNSAFE_ENVIRONMENT_KEYS.has(key)) continue;
74
- target[key] = value;
75
- }
76
- }
77
- /** Spawns the Codex app-server process and returns the shared transport interface. */
78
- function createStdioTransport(options) {
79
- const env = resolveCodexAppServerSpawnEnv(options);
80
- const invocation = resolveCodexAppServerSpawnInvocation(options, {
81
- platform: process.platform,
82
- env,
83
- execPath: process.execPath
84
- });
85
- return spawn(invocation.command, invocation.args, {
86
- ...options.cwd !== void 0 ? { cwd: options.cwd } : {},
87
- env,
88
- detached: resolveCodexAppServerDetachedMode(env),
89
- shell: invocation.shell,
90
- stdio: [
91
- "pipe",
92
- "pipe",
93
- "pipe"
94
- ],
95
- windowsHide: invocation.windowsHide
96
- });
97
- }
98
- //#endregion
99
- export { resolveCodexAppServerSpawnEnv as n, createStdioTransport as t };