@openclaw/codex 2026.8.2 → 2026.9.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 (61) hide show
  1. package/dist/api.js +3 -3
  2. package/dist/{attempt-client-cleanup-CpVfwctT.js → attempt-client-cleanup-DYHcRQAa.js} +6 -43
  3. package/dist/attempt-context-DmQUNWwT.js +634 -0
  4. package/dist/{binding-connection-CF7BmrDk.js → binding-connection-E6uDsPlx.js} +2 -2
  5. package/dist/{bounded-turn-DRC3hcjm.js → bounded-turn-wzJrwKKe.js} +8 -9
  6. package/dist/{capabilities-D6m_TdVy.js → capabilities-dIjNVCYH.js} +1 -1
  7. package/dist/cli-metadata.js +1 -1
  8. package/dist/{command-formatters--UToCokS.js → command-formatters-CLHhEB1Q.js} +3 -3
  9. package/dist/{command-handlers-CLFx2Ypa.js → command-handlers-CTGb2csu.js} +54 -55
  10. package/dist/{compact-5xqW1oCh.js → compact-_t0HQrUS.js} +33 -25
  11. package/dist/{config-CcYL77O6.js → config-BhmfC1s6.js} +12 -8
  12. package/dist/{context-compaction-activity-BOeJf7yo.js → context-compaction-activity-CMla5FPJ.js} +4 -1
  13. package/dist/doctor-contract-api.js +31 -4
  14. package/dist/{dynamic-tools-BmeXjwNZ.js → dynamic-tools-BU9tmlYm.js} +448 -457
  15. package/dist/{effective-mcp-catalog-XXQKgK1U.js → effective-mcp-catalog-DzYBW4h1.js} +2 -2
  16. package/dist/{event-projector-assistant-message-C5-Ds8mA.js → event-projector-assistant-message-DHRFXKbS.js} +4 -4
  17. package/dist/{event-projector-usage-B2r5vhWH.js → event-projector-usage-C5mcrGjp.js} +9 -137
  18. package/dist/{harness-BgeB7LnD.js → harness-DXVZ5II5.js} +13 -13
  19. package/dist/harness.js +1 -1
  20. package/dist/index.js +323 -313
  21. package/dist/{isolated-completion-CxTus3vZ.js → isolated-completion-kg9kv4iH.js} +4 -4
  22. package/dist/{launch-args-sXOAg0SX.js → launch-args-RXQwn8zV.js} +7 -1
  23. package/dist/{managed-binary-ZkGodW19.js → managed-binary-4-Vjz5GH.js} +14 -9
  24. package/dist/media-understanding-provider.js +1 -1
  25. package/dist/{model-catalog-DULBcniB.js → model-catalog-CUM68Hkl.js} +11 -11
  26. package/dist/{models-DaWfETQk.js → models-sYnEc0gd.js} +3 -3
  27. package/dist/{native-subagent-monitor-vXYUZH37.js → native-subagent-monitor-CnH147jH.js} +3 -3
  28. package/dist/{node-exec-server.runtime-DirKVZ5h.js → node-exec-server.runtime-CstNHCmC.js} +2 -2
  29. package/dist/{plugin-approval-roundtrip-CCWQGlAI.js → plugin-approval-roundtrip-CNe-Xrjx.js} +29 -3
  30. package/dist/{plugin-marketplace-discovery-BXjIFEiw.js → plugin-marketplace-discovery-CfFlKqDl.js} +6 -6
  31. package/dist/{plugin-metadata-cache-DQQm4gWT.js → plugin-metadata-cache-BFrPhb2c.js} +5 -5
  32. package/dist/provider-capabilities-DW5p4k9w.js +101 -0
  33. package/dist/{rate-limits-BqHEHXQJ.js → rate-limits-CawQJfUS.js} +1 -1
  34. package/dist/{request-BWxweEdK.js → request-DYAI5FQE.js} +18 -6
  35. package/dist/{run-attempt-BVLE4Gbi.js → run-attempt-D1hJO4fX.js} +483 -1865
  36. package/dist/{runtime-artifact-D9pYp4zL.js → runtime-artifact-C3jVimFn.js} +19 -12
  37. package/dist/{session-binding-D0zinCP1.js → session-binding-BHuTCRZQ.js} +8 -10
  38. package/dist/{session-catalog-eMhVm0Ql.js → session-catalog-yyvTWFOw.js} +138 -116
  39. package/dist/{session-cli-B2lyjJA0.js → session-cli-CmFEXMAM.js} +1 -1
  40. package/dist/session-initialization-BeWzjGiR.js +74 -0
  41. package/dist/{session-permission-policy-ScnAyG90.js → session-permission-policy-DeWVTCMj.js} +2 -2
  42. package/dist/{session-retirement-CtUtUTr9.js → session-retirement-BujDjXVF.js} +16 -9
  43. package/dist/{session-upstream-marker-gqrYIRHk.js → session-upstream-marker-C351-5Qw.js} +18 -2
  44. package/dist/{settled-turn-context-Bk3IUwod.js → settled-turn-context-D3SNWtUn.js} +6 -28
  45. package/dist/{settled-turn-finalizer-BXLN9PfJ.js → settled-turn-finalizer-BVJx4yoc.js} +5 -5
  46. package/dist/{shared-client-B1tT5U6r.js → shared-client-DxcfF9KX.js} +2748 -101
  47. package/dist/{side-question-CZ-mCw-t.js → side-question-BTZAII4l.js} +97 -63
  48. package/dist/{thread-lifecycle-CGGKP720.js → thread-lifecycle-DAcEJ_Om.js} +2039 -1487
  49. package/dist/{thread-ownership-RkaoZCmQ.js → thread-ownership-zGokd8i1.js} +10 -9
  50. package/dist/thread-policy-g4KbJPzp.js +54 -0
  51. package/dist/{thread-resume-BFt1-ZDa.js → thread-resume-C7pyVKeW.js} +15 -7
  52. package/dist/{transcript-mirror-1ep4XjzF.js → transcript-mirror-DTUxFWa_.js} +47 -10
  53. package/dist/{transport-stdio-NT_Dpd9V.js → transport-stdio-CyPldczm.js} +3 -1
  54. package/dist/upstream-session-fork-CYlBIGVt.js +966 -0
  55. package/dist/{usage-DUhd58gI.js → usage-Bj-rrzkR.js} +3 -3
  56. package/dist/{web-search-provider.runtime-BEmlE7ov.js → web-search-provider.runtime-D2FWSK4w.js} +3 -3
  57. package/openclaw.plugin.json +0 -30
  58. package/package.json +5 -5
  59. package/dist/protocol-validators-Bg5rpNxk.js +0 -2542
  60. package/dist/session-catalog-home-id-Dt2GiG5o.js +0 -112
  61. package/dist/upstream-session-fork-Dc8BFExw.js +0 -312
@@ -1,21 +1,24 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { F as resolveCodexAppServerLocalHomeDir, I as resolveCodexAppServerUserHomeDir, L as withEphemeralCodexAuthStore, P as resolveCodexAppServerHomeDir, a as resolveCodexAppServerStartOptionsForAgent, i as resolveCodexAppServerRuntimeOptions, o as resolveCodexComputerUseConfig, t as codexAppServerStartOptionsKey } from "./config-CcYL77O6.js";
3
- import { a as CODEX_APP_SERVER_VERSION, c as resolveMacOSDesktopCodexAppPathCandidates, l as resolveMacOSDesktopCodexBundledMarketplaceCandidates, n as resolveManagedCodexAppServerStartOptions, o as MIN_SUPPORTED_CODEX_APP_SERVER_VERSION, r as resolveManagedCodexNativeCommand, s as resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath, t as isManagedCodexDesktopCommand, u as resolveMacOSDesktopCodexComputerUseServiceAppCandidates } from "./managed-binary-ZkGodW19.js";
4
- import { o as isCodexAppServerNativeAuthProfile } from "./session-binding-D0zinCP1.js";
5
- import { a as hasCodexAppServerNaturalExit, i as closeCodexAppServerTransportAndWait, n as resolveCodexAppServerSpawnEnv, r as closeCodexAppServerTransport, t as createStdioTransport } from "./transport-stdio-NT_Dpd9V.js";
6
- import { l as readCodexDynamicToolCallParams } from "./protocol-validators-Bg5rpNxk.js";
2
+ import { t as isCodexAppServerProxyLaunch } from "./launch-args-RXQwn8zV.js";
3
+ import { F as resolveCodexAppServerHomeDir, I as resolveCodexAppServerLocalHomeDir, L as resolveCodexAppServerUserHomeDir, R as withEphemeralCodexAuthStore, a as resolveCodexAppServerStartOptionsForAgent, i as resolveCodexAppServerRuntimeOptions, o as resolveCodexComputerUseConfig, t as codexAppServerStartOptionsKey } from "./config-BhmfC1s6.js";
4
+ import { c as resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath, d as resolveMacOSDesktopCodexComputerUseServiceAppCandidates, l as resolveMacOSDesktopCodexAppPathCandidates, n as resolveManagedCodexAppServerStartOptions, o as CODEX_APP_SERVER_VERSION, r as resolveManagedCodexNativeCommand, s as MIN_SUPPORTED_CODEX_APP_SERVER_VERSION, t as isManagedCodexDesktopCommand, u as resolveMacOSDesktopCodexBundledMarketplaceCandidates } from "./managed-binary-4-Vjz5GH.js";
5
+ import { o as isCodexAppServerNativeAuthProfile } from "./session-binding-BHuTCRZQ.js";
6
+ import { a as hasCodexAppServerNaturalExit, i as closeCodexAppServerTransportAndWait, n as resolveCodexAppServerSpawnEnv, r as closeCodexAppServerTransport, t as createStdioTransport } from "./transport-stdio-CyPldczm.js";
7
7
  import { isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
11
11
  import { addTimerTimeoutGraceMs, parseStrictNonNegativeInteger, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
12
12
  import { AgentHarnessPreflightError, OPENCLAW_VERSION, embeddedAgentLog, formatErrorMessage, formatToolExecutionErrorMessage, normalizeQuestionTimeoutSeconds, resolveToolExecutionErrorKind } from "openclaw/plugin-sdk/agent-harness-runtime";
13
+ import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
14
+ import { createZstdDecompress } from "node:zlib";
15
+ import { root } from "openclaw/plugin-sdk/file-access-runtime";
13
16
  import { createHash, randomUUID } from "node:crypto";
14
- import fsSync, { constants, existsSync, watch } from "node:fs";
17
+ import fsSync, { constants as constants$1, existsSync, watch } from "node:fs";
15
18
  import os from "node:os";
16
19
  import { isDeepStrictEqual } from "node:util";
17
- import { ensureAuthProfileStore, findPersistedAuthProfileCredential, loadAuthProfileStoreForSecretsRuntime, refreshOAuthCredentialForRuntime, resolveApiKeyForProfile, resolveAuthProfileOrder, resolveDefaultAgentDir, resolvePersistedAuthProfileOwnerAgentDir, resolveProviderIdForAuth } from "openclaw/plugin-sdk/agent-runtime";
18
- import { hasUsableOAuthCredential, resolveOpenAICodexAuthIdentity } from "openclaw/plugin-sdk/provider-auth";
20
+ import { ensureAuthProfileStore, findPersistedAuthProfileCredential, loadAuthProfileStoreForSecretsRuntime, refreshOAuthCredentialForRuntime, resolveApiKeyForProfile, resolveDefaultAgentDir, resolvePersistedAuthProfileOwnerAgentDir, resolveProviderIdForAuth } from "openclaw/plugin-sdk/agent-runtime";
21
+ import { hasUsableOAuthCredential, resolveAuthProfileOrder, resolveOpenAICodexAuthIdentity } from "openclaw/plugin-sdk/provider-auth";
19
22
  import { readSecretFile } from "openclaw/plugin-sdk/secret-file";
20
23
  import { assertNoSymlinkParents, withTimeout } from "openclaw/plugin-sdk/security-runtime";
21
24
  import { runExec } from "openclaw/plugin-sdk/process-runtime";
@@ -25,10 +28,117 @@ import { coerceErrorMessage, toStringifiedError } from "openclaw/plugin-sdk/erro
25
28
  import { sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
26
29
  import { parse } from "semver";
27
30
  import { hasPendingInternalDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
31
+ import { Compile } from "typebox/compile";
28
32
  import net from "node:net";
29
33
  import { PassThrough, Writable } from "node:stream";
30
34
  import { StringDecoder } from "node:string_decoder";
31
35
  import WebSocket from "ws";
36
+ //#region extensions/codex/src/app-server/protocol.ts
37
+ /** Namespace Codex keeps directly model-visible without exposing it to Code Mode guests. */
38
+ const CODEX_OPENCLAW_DIRECT_DYNAMIC_TOOL_NAMESPACE = "openclaw_direct";
39
+ function flattenCodexDynamicToolFunctions(tools) {
40
+ return (tools ?? []).flatMap((tool) => tool.type === "namespace" ? tool.tools : [tool]);
41
+ }
42
+ const CODEX_INTERACTIVE_THREAD_SOURCE_KINDS = ["cli", "vscode"];
43
+ const CODEX_INTERACTIVE_CUSTOM_THREAD_SOURCES = ["atlas", "chatgpt"];
44
+ function isJsonObject(value) {
45
+ return isRecord(value);
46
+ }
47
+ function isRpcResponse(message) {
48
+ return "id" in message && !("method" in message);
49
+ }
50
+ //#endregion
51
+ //#region extensions/codex/src/session-catalog-provenance.ts
52
+ const MAX_SESSION_META_BYTES = 1048576;
53
+ const SESSION_META_READ_CHUNK_BYTES = 65536;
54
+ const MAX_PROVENANCE_CACHE_ENTRIES = 2e4;
55
+ const provenanceByPath = /* @__PURE__ */ new Map();
56
+ function cacheProvenance(key, value) {
57
+ provenanceByPath.delete(key);
58
+ provenanceByPath.set(key, value);
59
+ while (provenanceByPath.size > MAX_PROVENANCE_CACHE_ENTRIES) {
60
+ const oldest = provenanceByPath.keys().next().value;
61
+ if (oldest === void 0) break;
62
+ provenanceByPath.delete(oldest);
63
+ }
64
+ }
65
+ /** Undefined means the metadata line is not durable enough to cache yet. */
66
+ async function readCodexSessionMeta(sessionsRoot, rolloutPath, threadId) {
67
+ let safeRoot;
68
+ try {
69
+ safeRoot = await root(sessionsRoot, {
70
+ hardlinks: "reject",
71
+ maxBytes: Number.MAX_SAFE_INTEGER,
72
+ symlinks: "reject"
73
+ });
74
+ } catch {
75
+ return;
76
+ }
77
+ const candidates = rolloutPath.endsWith(".zst") ? [rolloutPath, rolloutPath.slice(0, -4)] : [rolloutPath, `${rolloutPath}.zst`];
78
+ for (const candidate of candidates) {
79
+ let opened;
80
+ try {
81
+ opened = await safeRoot.open(path.relative(sessionsRoot, candidate));
82
+ } catch {
83
+ continue;
84
+ }
85
+ const input = opened.handle.createReadStream({
86
+ autoClose: false,
87
+ highWaterMark: SESSION_META_READ_CHUNK_BYTES
88
+ });
89
+ const reader = candidate.endsWith(".zst") ? input.pipe(createZstdDecompress()) : input;
90
+ try {
91
+ const chunks = [];
92
+ let bytesReadTotal = 0;
93
+ let line;
94
+ for await (const value of reader) {
95
+ const chunk = Buffer.isBuffer(value) ? value : Buffer.from(value);
96
+ const remaining = MAX_SESSION_META_BYTES - bytesReadTotal;
97
+ if (remaining <= 0) break;
98
+ const bounded = chunk.subarray(0, remaining);
99
+ bytesReadTotal += bounded.length;
100
+ const newline = bounded.indexOf(10);
101
+ chunks.push(newline >= 0 ? bounded.subarray(0, newline) : bounded);
102
+ if (newline >= 0) {
103
+ line = Buffer.concat(chunks).toString("utf8");
104
+ break;
105
+ }
106
+ }
107
+ if (!line) continue;
108
+ let parsed;
109
+ try {
110
+ parsed = JSON.parse(line);
111
+ } catch {
112
+ continue;
113
+ }
114
+ if (!isJsonObject(parsed) || parsed.type !== "session_meta" || !isJsonObject(parsed.payload)) return null;
115
+ const payload = parsed.payload;
116
+ return payload.id === threadId ? payload : null;
117
+ } catch {
118
+ continue;
119
+ } finally {
120
+ reader.destroy();
121
+ input.destroy();
122
+ await opened.handle.close().catch(() => void 0);
123
+ }
124
+ }
125
+ }
126
+ /**
127
+ * Codex 0.147 reports OpenClaw app-server rollouts as `vscode`, so the rollout's
128
+ * immutable session metadata is the authoritative historical provenance.
129
+ */
130
+ async function isOpenClawManagedCodexThread(thread, localSessionsRoot) {
131
+ const rolloutPath = typeof thread.path === "string" ? thread.path.trim() : "";
132
+ if (!localSessionsRoot || !rolloutPath) return false;
133
+ const cacheKey = `${localSessionsRoot}\0${rolloutPath}`;
134
+ const cached = provenanceByPath.get(cacheKey);
135
+ if (cached !== void 0) return cached;
136
+ const metadata = await readCodexSessionMeta(localSessionsRoot, rolloutPath, thread.id);
137
+ const managed = metadata === void 0 ? void 0 : metadata?.originator === "openclaw";
138
+ if (managed !== void 0) cacheProvenance(cacheKey, managed);
139
+ return managed ?? false;
140
+ }
141
+ //#endregion
32
142
  //#region extensions/codex/src/app-server/computer-use-service-path.ts
33
143
  /** Filesystem ownership guards for isolated Computer Use service provisioning. */
34
144
  async function assertOwnedServicePath(params) {
@@ -687,7 +797,7 @@ function identitiesMatch(left, right) {
687
797
  }
688
798
  async function hasExecutableClient(appPath) {
689
799
  try {
690
- await fs.access(path.join(appPath, CLIENT_RELATIVE_PATH), constants.X_OK);
800
+ await fs.access(path.join(appPath, CLIENT_RELATIVE_PATH), constants$1.X_OK);
691
801
  return true;
692
802
  } catch {
693
803
  return false;
@@ -788,21 +898,6 @@ async function copyServiceAppWithDitto(sourcePath, targetPath) {
788
898
  });
789
899
  }
790
900
  //#endregion
791
- //#region extensions/codex/src/app-server/protocol.ts
792
- /** Namespace Codex keeps directly model-visible without exposing it to Code Mode guests. */
793
- const CODEX_OPENCLAW_DIRECT_DYNAMIC_TOOL_NAMESPACE = "openclaw_direct";
794
- function flattenCodexDynamicToolFunctions(tools) {
795
- return (tools ?? []).flatMap((tool) => tool.type === "namespace" ? tool.tools : [tool]);
796
- }
797
- const CODEX_INTERACTIVE_THREAD_SOURCE_KINDS = ["cli", "vscode"];
798
- const CODEX_INTERACTIVE_CUSTOM_THREAD_SOURCES = ["atlas", "chatgpt"];
799
- function isJsonObject(value) {
800
- return isRecord(value);
801
- }
802
- function isRpcResponse(message) {
803
- return "id" in message && !("method" in message);
804
- }
805
- //#endregion
806
901
  //#region extensions/codex/src/app-server/auth-bridge.ts
807
902
  const CODEX_APP_SERVER_AUTH_PROVIDER = "openai";
808
903
  const CODEX_APP_SERVER_EXTERNAL_CLI_PROVIDER_IDS = [CODEX_APP_SERVER_AUTH_PROVIDER];
@@ -1713,6 +1808,32 @@ function isCodexAppServerClientRuntimeLive(client) {
1713
1808
  const runtime = configuredClients.get(client);
1714
1809
  return runtime !== void 0 && !runtime.closed;
1715
1810
  }
1811
+ /** Immutable declarations are data owned by this physical client, never retained executors. */
1812
+ async function readCodexClientSessionMeta(client, sessionsRoot, boundRolloutPath, threadId) {
1813
+ let rolloutPath = boundRolloutPath;
1814
+ const runtime = configuredClients.get(client);
1815
+ if (!runtime || runtime.closed) throw new Error("Codex native metadata requires a live selected client");
1816
+ const cached = runtime.sessionMetadata.get(threadId);
1817
+ if (cached && cached.sessionsRoot === sessionsRoot && (!rolloutPath || cached.rolloutPath === rolloutPath)) return structuredClone(cached.metadata);
1818
+ if (!rolloutPath) {
1819
+ const { thread } = await client.request("thread/read", {
1820
+ threadId,
1821
+ includeTurns: false
1822
+ });
1823
+ if (thread.id !== threadId || !thread.path) throw new Error("Codex native metadata has no verified thread path");
1824
+ rolloutPath = thread.path;
1825
+ }
1826
+ const metadata = await readCodexSessionMeta(sessionsRoot, rolloutPath, threadId);
1827
+ if (runtime.closed || !metadata) throw new Error("Codex native metadata is unavailable on the selected client");
1828
+ runtime.sessionMetadata.delete(threadId);
1829
+ runtime.sessionMetadata.set(threadId, {
1830
+ sessionsRoot,
1831
+ rolloutPath,
1832
+ metadata
1833
+ });
1834
+ pruneMapToMaxSize(runtime.sessionMetadata, CODEX_APP_SERVER_LIVE_THREAD_MAX_IDLE);
1835
+ return structuredClone(metadata);
1836
+ }
1716
1837
  /** Installs one auth-refresh handler and one rate-limit observer per physical client. */
1717
1838
  function ensureCodexAppServerClientRuntime(client, context) {
1718
1839
  const existing = configuredClients.get(client);
@@ -1730,7 +1851,8 @@ function ensureCodexAppServerClientRuntime(client, context) {
1730
1851
  retainedThreads: /* @__PURE__ */ new Map(),
1731
1852
  claimedThreads: /* @__PURE__ */ new Map(),
1732
1853
  releasingThreads: /* @__PURE__ */ new Map(),
1733
- protectedThreads: /* @__PURE__ */ new Map()
1854
+ protectedThreads: /* @__PURE__ */ new Map(),
1855
+ sessionMetadata: /* @__PURE__ */ new Map()
1734
1856
  };
1735
1857
  configuredClients.set(client, runtime);
1736
1858
  client.addCloseHandler(() => {
@@ -1742,6 +1864,7 @@ function ensureCodexAppServerClientRuntime(client, context) {
1742
1864
  runtime.retainedThreads.clear();
1743
1865
  runtime.claimedThreads.clear();
1744
1866
  runtime.protectedThreads.clear();
1867
+ runtime.sessionMetadata.clear();
1745
1868
  });
1746
1869
  client.addRequestHandler(async (request) => {
1747
1870
  if (request.method !== "account/chatgptAuthTokens/refresh") return;
@@ -1774,6 +1897,7 @@ function ensureCodexAppServerClientRuntime(client, context) {
1774
1897
  if (releasing) releasing.invalidated = true;
1775
1898
  runtime.retainedThreads.delete(threadId);
1776
1899
  runtime.claimedThreads.delete(threadId);
1900
+ runtime.sessionMetadata.delete(threadId);
1777
1901
  scheduleRetainedThreadEviction(client, runtime);
1778
1902
  }
1779
1903
  }
@@ -1822,7 +1946,7 @@ async function releaseRetainedThread(client, runtime, threadId, assertCurrent) {
1822
1946
  return true;
1823
1947
  } catch (error) {
1824
1948
  if (!runtime.closed && !transition.invalidated && runtime.releasingThreads.get(threadId) === transition && !runtime.retainedThreads.has(threadId) && !runtime.claimedThreads.has(threadId)) {
1825
- retained.expiresAt = Date.now() + CODEX_APP_SERVER_LIVE_THREAD_IDLE_TIMEOUT_MS;
1949
+ if (retained.ephemeralPolicy === void 0) retained.expiresAt = Date.now() + CODEX_APP_SERVER_LIVE_THREAD_IDLE_TIMEOUT_MS;
1826
1950
  const newerThreads = [...runtime.retainedThreads.entries()].filter(([candidateThreadId]) => !olderThreadIds.has(candidateThreadId));
1827
1951
  for (const [candidateThreadId] of newerThreads) runtime.retainedThreads.delete(candidateThreadId);
1828
1952
  runtime.retainedThreads.set(threadId, retained);
@@ -1840,14 +1964,15 @@ async function evictExpiredRetainedThreads(client, runtime) {
1840
1964
  scheduleRetainedThreadEviction(client, runtime);
1841
1965
  }
1842
1966
  async function evictExcessIdleThreads(client, runtime) {
1843
- let idleThreadIds = [...runtime.retainedThreads.keys()].filter((threadId) => !runtime.protectedThreads.has(threadId));
1967
+ const idleThreads = () => [...runtime.retainedThreads].filter(([threadId, thread]) => thread.ephemeralPolicy === void 0 && !runtime.protectedThreads.has(threadId));
1968
+ let idleThreadIds = idleThreads();
1844
1969
  while (idleThreadIds.length > CODEX_APP_SERVER_LIVE_THREAD_MAX_IDLE) {
1845
- await releaseRetainedThread(client, runtime, idleThreadIds[0]);
1846
- idleThreadIds = [...runtime.retainedThreads.keys()].filter((threadId) => !runtime.protectedThreads.has(threadId));
1970
+ await releaseRetainedThread(client, runtime, idleThreadIds[0][0]);
1971
+ idleThreadIds = idleThreads();
1847
1972
  }
1848
1973
  }
1849
1974
  /** Retain separately owned Codex subscriptions; completing B must never cold-restart A. */
1850
- async function retainCodexAppServerLiveThread(client, threadId, releaseThread, configFingerprint, serviceTier) {
1975
+ async function retainCodexAppServerLiveThread(client, threadId, releaseThread, configFingerprint, serviceTier, ephemeralPolicy) {
1851
1976
  const runtime = configuredClients.get(client);
1852
1977
  if (!runtime || runtime.closed) return false;
1853
1978
  const claimed = runtime.claimedThreads.get(threadId);
@@ -1860,8 +1985,9 @@ async function retainCodexAppServerLiveThread(client, threadId, releaseThread, c
1860
1985
  runtime.retainedThreads.delete(threadId);
1861
1986
  const retained = {
1862
1987
  configFingerprint,
1988
+ ephemeralPolicy,
1863
1989
  serviceTier,
1864
- expiresAt: Date.now() + CODEX_APP_SERVER_LIVE_THREAD_IDLE_TIMEOUT_MS,
1990
+ expiresAt: ephemeralPolicy === void 0 ? Date.now() + CODEX_APP_SERVER_LIVE_THREAD_IDLE_TIMEOUT_MS : Number.POSITIVE_INFINITY,
1865
1991
  release: (releaseThread ? physicalThreadReleases.get(releaseThread) ?? releaseThread : void 0) ?? (async (releasedThreadId, assertCurrent) => {
1866
1992
  await unsubscribeCodexAppServerLiveThread(client, releasedThreadId, 5e3, assertCurrent);
1867
1993
  })
@@ -1917,17 +2043,26 @@ function claimCodexAppServerThreadOwnership(client, runtime, threadId, retained)
1917
2043
  const claimed = Symbol(threadId);
1918
2044
  runtime.claimedThreads.set(threadId, claimed);
1919
2045
  scheduleRetainedThreadEviction(client, runtime);
1920
- const release = async (releasedThreadId, assertCurrent) => {
1921
- if (releasedThreadId !== threadId || runtime.claimedThreads.get(threadId) !== claimed) return;
2046
+ const assertCurrent = () => {
2047
+ if (runtime.closed || runtime.claimedThreads.get(threadId) !== claimed) throw new Error(`Codex thread subscription ownership changed: ${threadId}`);
2048
+ };
2049
+ const release = async (releasedThreadId, assertReleaseCurrent) => {
2050
+ if (releasedThreadId !== threadId || runtime.claimedThreads.get(threadId) !== claimed) {
2051
+ assertReleaseCurrent?.();
2052
+ return;
2053
+ }
1922
2054
  const pendingRelease = runtime.releasingThreads.get(threadId);
1923
2055
  if (pendingRelease) {
1924
2056
  await pendingRelease.completion;
1925
2057
  return;
1926
2058
  }
1927
2059
  const transition = { completion: Promise.resolve().then(async () => {
1928
- if (runtime.closed || runtime.claimedThreads.get(threadId) !== claimed) return;
1929
- assertCurrent?.();
1930
- await (assertCurrent ? retained.release(releasedThreadId, assertCurrent) : retained.release(releasedThreadId));
2060
+ if (runtime.closed || runtime.claimedThreads.get(threadId) !== claimed) {
2061
+ assertReleaseCurrent?.();
2062
+ return;
2063
+ }
2064
+ assertReleaseCurrent?.();
2065
+ await (assertReleaseCurrent ? retained.release(releasedThreadId, assertReleaseCurrent) : retained.release(releasedThreadId));
1931
2066
  }) };
1932
2067
  runtime.releasingThreads.set(threadId, transition);
1933
2068
  try {
@@ -1940,7 +2075,9 @@ function claimCodexAppServerThreadOwnership(client, runtime, threadId, retained)
1940
2075
  physicalThreadReleases.set(release, retained.release);
1941
2076
  claimedThreadReleaseTokens.set(release, claimed);
1942
2077
  return {
2078
+ assertCurrent,
1943
2079
  configFingerprint: retained.configFingerprint,
2080
+ ephemeralPolicy: retained.ephemeralPolicy,
1944
2081
  serviceTier: retained.serviceTier,
1945
2082
  release
1946
2083
  };
@@ -1966,12 +2103,16 @@ async function unsubscribeCodexAppServerLiveThread(client, threadId, timeoutMs,
1966
2103
  return;
1967
2104
  }
1968
2105
  const physicalRelease = Promise.resolve().then(async () => {
1969
- if (claimed !== void 0 && runtime?.claimedThreads.get(threadId) !== claimed || retained !== void 0 && runtime?.retainedThreads.get(threadId) !== retained) return;
2106
+ if (claimed !== void 0 && runtime?.claimedThreads.get(threadId) !== claimed || retained !== void 0 && runtime?.retainedThreads.get(threadId) !== retained) {
2107
+ assertCurrent?.();
2108
+ return;
2109
+ }
1970
2110
  assertCurrent?.();
1971
2111
  await client.request("thread/unsubscribe", { threadId }, {
1972
2112
  timeoutMs,
1973
2113
  assertCurrent
1974
2114
  });
2115
+ assertCurrent?.();
1975
2116
  });
1976
2117
  const ownsTransition = runtime !== void 0 && transition === void 0;
1977
2118
  if (transition) transition.physicalRelease = physicalRelease;
@@ -2014,7 +2155,7 @@ function protectCodexAppServerLiveThread(client, threadId) {
2014
2155
  runtime.protectedThreads.delete(threadId);
2015
2156
  const retained = runtime.retainedThreads.get(threadId);
2016
2157
  if (retained) {
2017
- retained.expiresAt = Date.now() + CODEX_APP_SERVER_LIVE_THREAD_IDLE_TIMEOUT_MS;
2158
+ if (retained.ephemeralPolicy === void 0) retained.expiresAt = Date.now() + CODEX_APP_SERVER_LIVE_THREAD_IDLE_TIMEOUT_MS;
2018
2159
  runtime.retainedThreads.delete(threadId);
2019
2160
  runtime.retainedThreads.set(threadId, retained);
2020
2161
  }
@@ -2485,6 +2626,2545 @@ function createCodexElicitationResponse(action, content = null, meta = null) {
2485
2626
  };
2486
2627
  }
2487
2628
  //#endregion
2629
+ //#region extensions/codex/src/app-server/protocol-generated/json/DynamicToolCallParams.json
2630
+ var DynamicToolCallParams_default = {
2631
+ $schema: "http://json-schema.org/draft-07/schema#",
2632
+ properties: {
2633
+ "arguments": true,
2634
+ "callId": { "type": "string" },
2635
+ "namespace": { "type": ["string", "null"] },
2636
+ "threadId": { "type": "string" },
2637
+ "tool": { "type": "string" },
2638
+ "turnId": { "type": "string" }
2639
+ },
2640
+ required: [
2641
+ "arguments",
2642
+ "callId",
2643
+ "threadId",
2644
+ "tool",
2645
+ "turnId"
2646
+ ],
2647
+ title: "DynamicToolCallParams",
2648
+ type: "object"
2649
+ };
2650
+ //#endregion
2651
+ //#region extensions/codex/src/app-server/protocol-generated/json/v2/CodexAppServerProtocolDefinitions.json
2652
+ var definitions = {
2653
+ "AbsolutePathBuf": {
2654
+ "description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.",
2655
+ "type": "string"
2656
+ },
2657
+ "Account": { "oneOf": [
2658
+ {
2659
+ "properties": { "type": {
2660
+ "enum": ["apiKey"],
2661
+ "title": "ApiKeyAccountType",
2662
+ "type": "string"
2663
+ } },
2664
+ "required": ["type"],
2665
+ "title": "ApiKeyAccount",
2666
+ "type": "object"
2667
+ },
2668
+ {
2669
+ "properties": {
2670
+ "email": { "type": ["string", "null"] },
2671
+ "planType": { "$ref": "#/definitions/PlanType" },
2672
+ "type": {
2673
+ "enum": ["chatgpt"],
2674
+ "title": "ChatgptAccountType",
2675
+ "type": "string"
2676
+ }
2677
+ },
2678
+ "required": [
2679
+ "email",
2680
+ "planType",
2681
+ "type"
2682
+ ],
2683
+ "title": "ChatgptAccount",
2684
+ "type": "object"
2685
+ },
2686
+ {
2687
+ "properties": {
2688
+ "type": {
2689
+ "enum": ["amazonBedrock"],
2690
+ "title": "AmazonBedrockAccountType",
2691
+ "type": "string"
2692
+ },
2693
+ "usesCodexManagedCredentials": {
2694
+ "default": false,
2695
+ "type": "boolean"
2696
+ }
2697
+ },
2698
+ "required": ["type"],
2699
+ "title": "AmazonBedrockAccount",
2700
+ "type": "object"
2701
+ }
2702
+ ] },
2703
+ "ActivePermissionProfile": {
2704
+ "properties": {
2705
+ "extends": {
2706
+ "default": null,
2707
+ "description": "Parent profile identifier from the selected permissions profile's `extends` setting, when present.",
2708
+ "type": ["string", "null"]
2709
+ },
2710
+ "id": {
2711
+ "description": "Identifier from `default_permissions` or the implicit built-in default, such as `:workspace` or a user-defined `[permissions.<id>]` profile.",
2712
+ "type": "string"
2713
+ }
2714
+ },
2715
+ "required": ["id"],
2716
+ "type": "object"
2717
+ },
2718
+ "AgentMessageDelivery": {
2719
+ "enum": ["async"],
2720
+ "type": "string"
2721
+ },
2722
+ "AgentPath": { "type": "string" },
2723
+ "ApprovalsReviewer": {
2724
+ "description": "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.",
2725
+ "enum": [
2726
+ "user",
2727
+ "auto_review",
2728
+ "guardian_subagent"
2729
+ ],
2730
+ "type": "string"
2731
+ },
2732
+ "AskForApproval": { "oneOf": [{
2733
+ "additionalProperties": false,
2734
+ "properties": { "granular": {
2735
+ "properties": {
2736
+ "mcp_elicitations": { "type": "boolean" },
2737
+ "request_permissions": {
2738
+ "default": false,
2739
+ "type": "boolean"
2740
+ },
2741
+ "rules": { "type": "boolean" },
2742
+ "sandbox_approval": { "type": "boolean" },
2743
+ "skill_approval": {
2744
+ "default": false,
2745
+ "type": "boolean"
2746
+ }
2747
+ },
2748
+ "required": [
2749
+ "mcp_elicitations",
2750
+ "rules",
2751
+ "sandbox_approval"
2752
+ ],
2753
+ "type": "object"
2754
+ } },
2755
+ "required": ["granular"],
2756
+ "title": "GranularAskForApproval",
2757
+ "type": "object"
2758
+ }, {
2759
+ "enum": [
2760
+ "untrusted",
2761
+ "on-request",
2762
+ "never"
2763
+ ],
2764
+ "type": "string"
2765
+ }] },
2766
+ "ByteRange": {
2767
+ "properties": {
2768
+ "end": {
2769
+ "format": "uint",
2770
+ "minimum": 0,
2771
+ "type": "integer"
2772
+ },
2773
+ "start": {
2774
+ "format": "uint",
2775
+ "minimum": 0,
2776
+ "type": "integer"
2777
+ }
2778
+ },
2779
+ "required": ["end", "start"],
2780
+ "type": "object"
2781
+ },
2782
+ "CodexErrorInfo": {
2783
+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",
2784
+ "oneOf": [
2785
+ {
2786
+ "additionalProperties": false,
2787
+ "properties": { "httpConnectionFailed": {
2788
+ "properties": { "httpStatusCode": {
2789
+ "format": "uint16",
2790
+ "minimum": 0,
2791
+ "type": ["integer", "null"]
2792
+ } },
2793
+ "type": "object"
2794
+ } },
2795
+ "required": ["httpConnectionFailed"],
2796
+ "title": "HttpConnectionFailedCodexErrorInfo",
2797
+ "type": "object"
2798
+ },
2799
+ {
2800
+ "additionalProperties": false,
2801
+ "description": "Failed to connect to the response SSE stream.",
2802
+ "properties": { "responseStreamConnectionFailed": {
2803
+ "properties": { "httpStatusCode": {
2804
+ "format": "uint16",
2805
+ "minimum": 0,
2806
+ "type": ["integer", "null"]
2807
+ } },
2808
+ "type": "object"
2809
+ } },
2810
+ "required": ["responseStreamConnectionFailed"],
2811
+ "title": "ResponseStreamConnectionFailedCodexErrorInfo",
2812
+ "type": "object"
2813
+ },
2814
+ {
2815
+ "additionalProperties": false,
2816
+ "description": "The response SSE stream disconnected in the middle of a turn before completion.",
2817
+ "properties": { "responseStreamDisconnected": {
2818
+ "properties": { "httpStatusCode": {
2819
+ "format": "uint16",
2820
+ "minimum": 0,
2821
+ "type": ["integer", "null"]
2822
+ } },
2823
+ "type": "object"
2824
+ } },
2825
+ "required": ["responseStreamDisconnected"],
2826
+ "title": "ResponseStreamDisconnectedCodexErrorInfo",
2827
+ "type": "object"
2828
+ },
2829
+ {
2830
+ "additionalProperties": false,
2831
+ "description": "Reached the retry limit for responses.",
2832
+ "properties": { "responseTooManyFailedAttempts": {
2833
+ "properties": { "httpStatusCode": {
2834
+ "format": "uint16",
2835
+ "minimum": 0,
2836
+ "type": ["integer", "null"]
2837
+ } },
2838
+ "type": "object"
2839
+ } },
2840
+ "required": ["responseTooManyFailedAttempts"],
2841
+ "title": "ResponseTooManyFailedAttemptsCodexErrorInfo",
2842
+ "type": "object"
2843
+ },
2844
+ {
2845
+ "additionalProperties": false,
2846
+ "description": "Returned when `turn/start` or `turn/steer` is submitted while the current active turn cannot accept same-turn steering, for example `/review` or manual `/compact`.",
2847
+ "properties": { "activeTurnNotSteerable": {
2848
+ "properties": { "turnKind": { "$ref": "#/definitions/NonSteerableTurnKind" } },
2849
+ "required": ["turnKind"],
2850
+ "type": "object"
2851
+ } },
2852
+ "required": ["activeTurnNotSteerable"],
2853
+ "title": "ActiveTurnNotSteerableCodexErrorInfo",
2854
+ "type": "object"
2855
+ },
2856
+ {
2857
+ "enum": [
2858
+ "contextWindowExceeded",
2859
+ "sessionBudgetExceeded",
2860
+ "usageLimitExceeded",
2861
+ "rateLimitExceeded",
2862
+ "serverOverloaded",
2863
+ "cyberPolicy",
2864
+ "misalignmentPolicyViolation",
2865
+ "internalServerError",
2866
+ "unauthorized",
2867
+ "badRequest",
2868
+ "threadRollbackFailed",
2869
+ "sandboxError",
2870
+ "other"
2871
+ ],
2872
+ "type": "string"
2873
+ }
2874
+ ]
2875
+ },
2876
+ "CollabAgentState": {
2877
+ "properties": {
2878
+ "message": { "type": ["string", "null"] },
2879
+ "status": { "$ref": "#/definitions/CollabAgentStatus" }
2880
+ },
2881
+ "required": ["status"],
2882
+ "type": "object"
2883
+ },
2884
+ "CollabAgentStatus": {
2885
+ "enum": [
2886
+ "pendingInit",
2887
+ "running",
2888
+ "interrupted",
2889
+ "completed",
2890
+ "errored",
2891
+ "shutdown",
2892
+ "notFound"
2893
+ ],
2894
+ "type": "string"
2895
+ },
2896
+ "CollabAgentTool": {
2897
+ "enum": [
2898
+ "spawnAgent",
2899
+ "sendInput",
2900
+ "resumeAgent",
2901
+ "wait",
2902
+ "closeAgent",
2903
+ "sendMessage",
2904
+ "followupTask",
2905
+ "interruptAgent",
2906
+ "listAgents"
2907
+ ],
2908
+ "type": "string"
2909
+ },
2910
+ "CollabAgentToolCallStatus": {
2911
+ "enum": [
2912
+ "inProgress",
2913
+ "completed",
2914
+ "failed",
2915
+ "interrupted"
2916
+ ],
2917
+ "type": "string"
2918
+ },
2919
+ "CommandAction": { "oneOf": [
2920
+ {
2921
+ "properties": {
2922
+ "command": { "type": "string" },
2923
+ "name": { "type": "string" },
2924
+ "path": { "$ref": "#/definitions/LegacyAppPathString" },
2925
+ "type": {
2926
+ "enum": ["read"],
2927
+ "title": "ReadCommandActionType",
2928
+ "type": "string"
2929
+ }
2930
+ },
2931
+ "required": [
2932
+ "command",
2933
+ "name",
2934
+ "path",
2935
+ "type"
2936
+ ],
2937
+ "title": "ReadCommandAction",
2938
+ "type": "object"
2939
+ },
2940
+ {
2941
+ "properties": {
2942
+ "command": { "type": "string" },
2943
+ "path": { "type": ["string", "null"] },
2944
+ "type": {
2945
+ "enum": ["listFiles"],
2946
+ "title": "ListFilesCommandActionType",
2947
+ "type": "string"
2948
+ }
2949
+ },
2950
+ "required": ["command", "type"],
2951
+ "title": "ListFilesCommandAction",
2952
+ "type": "object"
2953
+ },
2954
+ {
2955
+ "properties": {
2956
+ "command": { "type": "string" },
2957
+ "path": { "type": ["string", "null"] },
2958
+ "query": { "type": ["string", "null"] },
2959
+ "type": {
2960
+ "enum": ["search"],
2961
+ "title": "SearchCommandActionType",
2962
+ "type": "string"
2963
+ }
2964
+ },
2965
+ "required": ["command", "type"],
2966
+ "title": "SearchCommandAction",
2967
+ "type": "object"
2968
+ },
2969
+ {
2970
+ "properties": {
2971
+ "command": { "type": "string" },
2972
+ "type": {
2973
+ "enum": ["unknown"],
2974
+ "title": "UnknownCommandActionType",
2975
+ "type": "string"
2976
+ }
2977
+ },
2978
+ "required": ["command", "type"],
2979
+ "title": "UnknownCommandAction",
2980
+ "type": "object"
2981
+ }
2982
+ ] },
2983
+ "CommandExecutionSource": {
2984
+ "enum": [
2985
+ "agent",
2986
+ "userShell",
2987
+ "unifiedExecStartup",
2988
+ "unifiedExecInteraction"
2989
+ ],
2990
+ "type": "string"
2991
+ },
2992
+ "CommandExecutionStatus": {
2993
+ "enum": [
2994
+ "inProgress",
2995
+ "completed",
2996
+ "failed",
2997
+ "declined"
2998
+ ],
2999
+ "type": "string"
3000
+ },
3001
+ "DynamicToolCallOutputContentItem": { "oneOf": [
3002
+ {
3003
+ "properties": {
3004
+ "text": { "type": "string" },
3005
+ "type": {
3006
+ "enum": ["inputText"],
3007
+ "title": "InputTextDynamicToolCallOutputContentItemType",
3008
+ "type": "string"
3009
+ }
3010
+ },
3011
+ "required": ["text", "type"],
3012
+ "title": "InputTextDynamicToolCallOutputContentItem",
3013
+ "type": "object"
3014
+ },
3015
+ {
3016
+ "properties": {
3017
+ "imageUrl": { "type": "string" },
3018
+ "type": {
3019
+ "enum": ["inputImage"],
3020
+ "title": "InputImageDynamicToolCallOutputContentItemType",
3021
+ "type": "string"
3022
+ }
3023
+ },
3024
+ "required": ["imageUrl", "type"],
3025
+ "title": "InputImageDynamicToolCallOutputContentItem",
3026
+ "type": "object"
3027
+ },
3028
+ {
3029
+ "properties": {
3030
+ "audioUrl": { "type": "string" },
3031
+ "type": {
3032
+ "enum": ["inputAudio"],
3033
+ "title": "InputAudioDynamicToolCallOutputContentItemType",
3034
+ "type": "string"
3035
+ }
3036
+ },
3037
+ "required": ["audioUrl", "type"],
3038
+ "title": "InputAudioDynamicToolCallOutputContentItem",
3039
+ "type": "object"
3040
+ }
3041
+ ] },
3042
+ "DynamicToolCallStatus": {
3043
+ "enum": [
3044
+ "inProgress",
3045
+ "completed",
3046
+ "failed"
3047
+ ],
3048
+ "type": "string"
3049
+ },
3050
+ "FileUpdateChange": {
3051
+ "properties": {
3052
+ "diff": { "type": "string" },
3053
+ "kind": { "$ref": "#/definitions/PatchChangeKind" },
3054
+ "path": { "type": "string" }
3055
+ },
3056
+ "required": [
3057
+ "diff",
3058
+ "kind",
3059
+ "path"
3060
+ ],
3061
+ "type": "object"
3062
+ },
3063
+ "FunctionCallOutputBody": { "anyOf": [{
3064
+ "items": { "$ref": "#/definitions/FunctionCallOutputContentItem" },
3065
+ "type": "array"
3066
+ }, { "type": "string" }] },
3067
+ "FunctionCallOutputContentItem": {
3068
+ "description": "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.",
3069
+ "oneOf": [
3070
+ {
3071
+ "properties": {
3072
+ "text": { "type": "string" },
3073
+ "type": {
3074
+ "enum": ["input_text"],
3075
+ "title": "InputTextFunctionCallOutputContentItemType",
3076
+ "type": "string"
3077
+ }
3078
+ },
3079
+ "required": ["text", "type"],
3080
+ "title": "InputTextFunctionCallOutputContentItem",
3081
+ "type": "object"
3082
+ },
3083
+ {
3084
+ "properties": {
3085
+ "detail": { "anyOf": [{ "$ref": "#/definitions/ImageDetail" }, { "type": "null" }] },
3086
+ "image_url": { "type": "string" },
3087
+ "type": {
3088
+ "enum": ["input_image"],
3089
+ "title": "InputImageFunctionCallOutputContentItemType",
3090
+ "type": "string"
3091
+ }
3092
+ },
3093
+ "required": ["image_url", "type"],
3094
+ "title": "InputImageFunctionCallOutputContentItem",
3095
+ "type": "object"
3096
+ },
3097
+ {
3098
+ "properties": {
3099
+ "audio_url": { "type": "string" },
3100
+ "type": {
3101
+ "enum": ["input_audio"],
3102
+ "title": "InputAudioFunctionCallOutputContentItemType",
3103
+ "type": "string"
3104
+ }
3105
+ },
3106
+ "required": ["audio_url", "type"],
3107
+ "title": "InputAudioFunctionCallOutputContentItem",
3108
+ "type": "object"
3109
+ },
3110
+ {
3111
+ "properties": {
3112
+ "encrypted_content": { "type": "string" },
3113
+ "type": {
3114
+ "enum": ["encrypted_content"],
3115
+ "title": "EncryptedContentFunctionCallOutputContentItemType",
3116
+ "type": "string"
3117
+ }
3118
+ },
3119
+ "required": ["encrypted_content", "type"],
3120
+ "title": "EncryptedContentFunctionCallOutputContentItem",
3121
+ "type": "object"
3122
+ }
3123
+ ]
3124
+ },
3125
+ "GitInfo": {
3126
+ "properties": {
3127
+ "branch": { "type": ["string", "null"] },
3128
+ "originUrl": { "type": ["string", "null"] },
3129
+ "sha": { "type": ["string", "null"] }
3130
+ },
3131
+ "type": "object"
3132
+ },
3133
+ "HookPromptFragment": {
3134
+ "properties": {
3135
+ "hookRunId": { "type": "string" },
3136
+ "text": { "type": "string" }
3137
+ },
3138
+ "required": ["hookRunId", "text"],
3139
+ "type": "object"
3140
+ },
3141
+ "ImageDetail": {
3142
+ "enum": [
3143
+ "auto",
3144
+ "low",
3145
+ "high",
3146
+ "original"
3147
+ ],
3148
+ "type": "string"
3149
+ },
3150
+ "ImageGenerationFailure": { "oneOf": [{
3151
+ "properties": {
3152
+ "limitId": { "type": "string" },
3153
+ "resetsAt": {
3154
+ "format": "int64",
3155
+ "type": ["integer", "null"]
3156
+ },
3157
+ "type": {
3158
+ "enum": ["usageLimitExceeded"],
3159
+ "title": "UsageLimitExceededImageGenerationFailureType",
3160
+ "type": "string"
3161
+ }
3162
+ },
3163
+ "required": ["limitId", "type"],
3164
+ "title": "UsageLimitExceededImageGenerationFailure",
3165
+ "type": "object"
3166
+ }] },
3167
+ "InputModality": {
3168
+ "description": "Canonical user-input modality tags advertised by a model.",
3169
+ "oneOf": [
3170
+ {
3171
+ "description": "Plain text turns and tool payloads.",
3172
+ "enum": ["text"],
3173
+ "type": "string"
3174
+ },
3175
+ {
3176
+ "description": "Image attachments included in user turns.",
3177
+ "enum": ["image"],
3178
+ "type": "string"
3179
+ },
3180
+ {
3181
+ "description": "Audio attachments included in user turns.",
3182
+ "enum": ["audio"],
3183
+ "type": "string"
3184
+ }
3185
+ ]
3186
+ },
3187
+ "LegacyAppPathString": { "type": "string" },
3188
+ "McpToolCallAppContext": {
3189
+ "properties": {
3190
+ "actionName": { "type": ["string", "null"] },
3191
+ "appName": { "type": ["string", "null"] },
3192
+ "connectorId": { "type": "string" },
3193
+ "linkId": { "type": ["string", "null"] },
3194
+ "resourceUri": { "type": ["string", "null"] }
3195
+ },
3196
+ "required": ["connectorId"],
3197
+ "type": "object"
3198
+ },
3199
+ "McpToolCallError": {
3200
+ "properties": { "message": { "type": "string" } },
3201
+ "required": ["message"],
3202
+ "type": "object"
3203
+ },
3204
+ "McpToolCallResult": {
3205
+ "properties": {
3206
+ "_meta": true,
3207
+ "content": {
3208
+ "items": true,
3209
+ "type": "array"
3210
+ },
3211
+ "structuredContent": true
3212
+ },
3213
+ "required": ["content"],
3214
+ "type": "object"
3215
+ },
3216
+ "McpToolCallStatus": {
3217
+ "enum": [
3218
+ "inProgress",
3219
+ "completed",
3220
+ "failed"
3221
+ ],
3222
+ "type": "string"
3223
+ },
3224
+ "MemoryCitation": {
3225
+ "properties": {
3226
+ "entries": {
3227
+ "items": { "$ref": "#/definitions/MemoryCitationEntry" },
3228
+ "type": "array"
3229
+ },
3230
+ "threadIds": {
3231
+ "items": { "type": "string" },
3232
+ "type": "array"
3233
+ }
3234
+ },
3235
+ "required": ["entries", "threadIds"],
3236
+ "type": "object"
3237
+ },
3238
+ "MemoryCitationEntry": {
3239
+ "properties": {
3240
+ "lineEnd": {
3241
+ "format": "uint32",
3242
+ "minimum": 0,
3243
+ "type": "integer"
3244
+ },
3245
+ "lineStart": {
3246
+ "format": "uint32",
3247
+ "minimum": 0,
3248
+ "type": "integer"
3249
+ },
3250
+ "note": { "type": "string" },
3251
+ "path": { "type": "string" }
3252
+ },
3253
+ "required": [
3254
+ "lineEnd",
3255
+ "lineStart",
3256
+ "note",
3257
+ "path"
3258
+ ],
3259
+ "type": "object"
3260
+ },
3261
+ "MessagePhase": {
3262
+ "description": "Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as \"phase unknown\" and keep compatibility behavior for legacy models.",
3263
+ "oneOf": [{
3264
+ "description": "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",
3265
+ "enum": ["commentary"],
3266
+ "type": "string"
3267
+ }, {
3268
+ "description": "The assistant's terminal answer text for the current turn.",
3269
+ "enum": ["final_answer"],
3270
+ "type": "string"
3271
+ }]
3272
+ },
3273
+ "MisalignmentErrorDetails": {
3274
+ "properties": {
3275
+ "detailedExplanation": {
3276
+ "description": "A substantive localized explanation is required before offering continuation.",
3277
+ "type": ["string", "null"]
3278
+ },
3279
+ "errorType": {
3280
+ "description": "Open-ended classification; clients must accept categories added by Responses.",
3281
+ "type": ["string", "null"]
3282
+ },
3283
+ "steer": {
3284
+ "anyOf": [{ "$ref": "#/definitions/MisalignmentSteer" }, { "type": "null" }],
3285
+ "description": "Instruction to submit as the next turn's user input if continuation is confirmed."
3286
+ }
3287
+ },
3288
+ "type": "object"
3289
+ },
3290
+ "MisalignmentSteer": {
3291
+ "properties": { "message": { "type": "string" } },
3292
+ "required": ["message"],
3293
+ "type": "object"
3294
+ },
3295
+ "Model": {
3296
+ "properties": {
3297
+ "additionalSpeedTiers": {
3298
+ "default": [],
3299
+ "description": "Deprecated: use `serviceTiers` instead.",
3300
+ "items": { "type": "string" },
3301
+ "type": "array"
3302
+ },
3303
+ "availabilityNux": { "anyOf": [{ "$ref": "#/definitions/ModelAvailabilityNux" }, { "type": "null" }] },
3304
+ "defaultReasoningEffort": { "$ref": "#/definitions/ReasoningEffort" },
3305
+ "defaultServiceTier": {
3306
+ "default": null,
3307
+ "description": "Catalog default service tier id for this model, when one is configured.",
3308
+ "type": ["string", "null"]
3309
+ },
3310
+ "description": { "type": "string" },
3311
+ "displayName": { "type": "string" },
3312
+ "hidden": { "type": "boolean" },
3313
+ "id": { "type": "string" },
3314
+ "inputModalities": {
3315
+ "default": ["text", "image"],
3316
+ "items": { "$ref": "#/definitions/InputModality" },
3317
+ "type": "array"
3318
+ },
3319
+ "isDefault": { "type": "boolean" },
3320
+ "model": { "type": "string" },
3321
+ "modelSpecialty": {
3322
+ "default": null,
3323
+ "type": ["string", "null"]
3324
+ },
3325
+ "multiAgentVersion": {
3326
+ "anyOf": [{ "$ref": "#/definitions/MultiAgentVersion" }, { "type": "null" }],
3327
+ "description": "Multi-agent runtime declared by this model, when available."
3328
+ },
3329
+ "serviceTiers": {
3330
+ "default": [],
3331
+ "items": { "$ref": "#/definitions/ModelServiceTier" },
3332
+ "type": "array"
3333
+ },
3334
+ "supportedReasoningEfforts": {
3335
+ "items": { "$ref": "#/definitions/ReasoningEffortOption" },
3336
+ "type": "array"
3337
+ },
3338
+ "supportsPersonality": {
3339
+ "default": false,
3340
+ "type": "boolean"
3341
+ },
3342
+ "upgrade": { "type": ["string", "null"] },
3343
+ "upgradeInfo": { "anyOf": [{ "$ref": "#/definitions/ModelUpgradeInfo" }, { "type": "null" }] }
3344
+ },
3345
+ "required": [
3346
+ "defaultReasoningEffort",
3347
+ "description",
3348
+ "displayName",
3349
+ "hidden",
3350
+ "id",
3351
+ "isDefault",
3352
+ "model",
3353
+ "supportedReasoningEfforts"
3354
+ ],
3355
+ "type": "object"
3356
+ },
3357
+ "ModelAvailabilityNux": {
3358
+ "properties": { "message": { "type": "string" } },
3359
+ "required": ["message"],
3360
+ "type": "object"
3361
+ },
3362
+ "ModelServiceTier": {
3363
+ "properties": {
3364
+ "description": { "type": "string" },
3365
+ "id": { "type": "string" },
3366
+ "name": { "type": "string" }
3367
+ },
3368
+ "required": [
3369
+ "description",
3370
+ "id",
3371
+ "name"
3372
+ ],
3373
+ "type": "object"
3374
+ },
3375
+ "ModelUpgradeInfo": {
3376
+ "properties": {
3377
+ "migrationMarkdown": { "type": ["string", "null"] },
3378
+ "model": { "type": "string" },
3379
+ "modelLink": { "type": ["string", "null"] },
3380
+ "retirementAt": {
3381
+ "description": "Informational Unix timestamp for this upgrade's scheduled retirement, if known.",
3382
+ "format": "int64",
3383
+ "type": ["integer", "null"]
3384
+ },
3385
+ "upgradeCopy": { "type": ["string", "null"] }
3386
+ },
3387
+ "required": ["model"],
3388
+ "type": "object"
3389
+ },
3390
+ "MultiAgentMode": {
3391
+ "description": "Controls the effective multi-agent delegation instructions for a turn. `custom` means the configured mode hint defines the policy instead of a built-in policy.",
3392
+ "oneOf": [{
3393
+ "additionalProperties": false,
3394
+ "properties": { "custom": { "type": "string" } },
3395
+ "required": ["custom"],
3396
+ "title": "CustomMultiAgentMode",
3397
+ "type": "object"
3398
+ }, {
3399
+ "enum": ["explicitRequestOnly", "proactive"],
3400
+ "type": "string"
3401
+ }]
3402
+ },
3403
+ "MultiAgentVersion": {
3404
+ "description": "Multi-agent runtime supported by a model.",
3405
+ "enum": [
3406
+ "disabled",
3407
+ "v1",
3408
+ "v2"
3409
+ ],
3410
+ "type": "string"
3411
+ },
3412
+ "NetworkAccess": {
3413
+ "enum": ["restricted", "enabled"],
3414
+ "type": "string"
3415
+ },
3416
+ "NonSteerableTurnKind": {
3417
+ "enum": ["review", "compact"],
3418
+ "type": "string"
3419
+ },
3420
+ "PatchApplyStatus": {
3421
+ "enum": [
3422
+ "inProgress",
3423
+ "completed",
3424
+ "failed",
3425
+ "declined"
3426
+ ],
3427
+ "type": "string"
3428
+ },
3429
+ "PatchChangeKind": { "oneOf": [
3430
+ {
3431
+ "properties": { "type": {
3432
+ "enum": ["add"],
3433
+ "title": "AddPatchChangeKindType",
3434
+ "type": "string"
3435
+ } },
3436
+ "required": ["type"],
3437
+ "title": "AddPatchChangeKind",
3438
+ "type": "object"
3439
+ },
3440
+ {
3441
+ "properties": { "type": {
3442
+ "enum": ["delete"],
3443
+ "title": "DeletePatchChangeKindType",
3444
+ "type": "string"
3445
+ } },
3446
+ "required": ["type"],
3447
+ "title": "DeletePatchChangeKind",
3448
+ "type": "object"
3449
+ },
3450
+ {
3451
+ "properties": {
3452
+ "move_path": { "type": ["string", "null"] },
3453
+ "type": {
3454
+ "enum": ["update"],
3455
+ "title": "UpdatePatchChangeKindType",
3456
+ "type": "string"
3457
+ }
3458
+ },
3459
+ "required": ["type"],
3460
+ "title": "UpdatePatchChangeKind",
3461
+ "type": "object"
3462
+ }
3463
+ ] },
3464
+ "PlanType": {
3465
+ "enum": [
3466
+ "free",
3467
+ "go",
3468
+ "plus",
3469
+ "pro",
3470
+ "prolite",
3471
+ "team",
3472
+ "self_serve_business_prolite",
3473
+ "self_serve_business_usage_based",
3474
+ "business",
3475
+ "ent26",
3476
+ "enterprise_cbp_automation",
3477
+ "enterprise_cbp_usage_based",
3478
+ "enterprise",
3479
+ "edu",
3480
+ "edu_plus",
3481
+ "edu_pro",
3482
+ "unknown"
3483
+ ],
3484
+ "type": "string"
3485
+ },
3486
+ "ReasoningEffort": {
3487
+ "description": "A non-empty reasoning effort value advertised by the model.",
3488
+ "minLength": 1,
3489
+ "type": "string"
3490
+ },
3491
+ "ReasoningEffortOption": {
3492
+ "properties": {
3493
+ "description": { "type": "string" },
3494
+ "reasoningEffort": { "$ref": "#/definitions/ReasoningEffort" }
3495
+ },
3496
+ "required": ["description", "reasoningEffort"],
3497
+ "type": "object"
3498
+ },
3499
+ "SandboxPolicy": { "oneOf": [
3500
+ {
3501
+ "properties": { "type": {
3502
+ "enum": ["dangerFullAccess"],
3503
+ "title": "DangerFullAccessSandboxPolicyType",
3504
+ "type": "string"
3505
+ } },
3506
+ "required": ["type"],
3507
+ "title": "DangerFullAccessSandboxPolicy",
3508
+ "type": "object"
3509
+ },
3510
+ {
3511
+ "properties": {
3512
+ "networkAccess": {
3513
+ "default": false,
3514
+ "type": "boolean"
3515
+ },
3516
+ "type": {
3517
+ "enum": ["readOnly"],
3518
+ "title": "ReadOnlySandboxPolicyType",
3519
+ "type": "string"
3520
+ }
3521
+ },
3522
+ "required": ["type"],
3523
+ "title": "ReadOnlySandboxPolicy",
3524
+ "type": "object"
3525
+ },
3526
+ {
3527
+ "properties": {
3528
+ "networkAccess": {
3529
+ "allOf": [{ "$ref": "#/definitions/NetworkAccess" }],
3530
+ "default": "restricted"
3531
+ },
3532
+ "type": {
3533
+ "enum": ["externalSandbox"],
3534
+ "title": "ExternalSandboxSandboxPolicyType",
3535
+ "type": "string"
3536
+ }
3537
+ },
3538
+ "required": ["type"],
3539
+ "title": "ExternalSandboxSandboxPolicy",
3540
+ "type": "object"
3541
+ },
3542
+ {
3543
+ "properties": {
3544
+ "excludeSlashTmp": {
3545
+ "default": false,
3546
+ "type": "boolean"
3547
+ },
3548
+ "excludeTmpdirEnvVar": {
3549
+ "default": false,
3550
+ "type": "boolean"
3551
+ },
3552
+ "networkAccess": {
3553
+ "default": false,
3554
+ "type": "boolean"
3555
+ },
3556
+ "type": {
3557
+ "enum": ["workspaceWrite"],
3558
+ "title": "WorkspaceWriteSandboxPolicyType",
3559
+ "type": "string"
3560
+ },
3561
+ "writableRoots": {
3562
+ "default": [],
3563
+ "items": { "$ref": "#/definitions/AbsolutePathBuf" },
3564
+ "type": "array"
3565
+ }
3566
+ },
3567
+ "required": ["type"],
3568
+ "title": "WorkspaceWriteSandboxPolicy",
3569
+ "type": "object"
3570
+ }
3571
+ ] },
3572
+ "SessionSource": { "oneOf": [
3573
+ {
3574
+ "additionalProperties": false,
3575
+ "properties": { "custom": { "type": "string" } },
3576
+ "required": ["custom"],
3577
+ "title": "CustomSessionSource",
3578
+ "type": "object"
3579
+ },
3580
+ {
3581
+ "additionalProperties": false,
3582
+ "properties": { "subAgent": { "$ref": "#/definitions/SubAgentSource" } },
3583
+ "required": ["subAgent"],
3584
+ "title": "SubAgentSessionSource",
3585
+ "type": "object"
3586
+ },
3587
+ {
3588
+ "enum": [
3589
+ "cli",
3590
+ "vscode",
3591
+ "exec",
3592
+ "appServer",
3593
+ "unknown"
3594
+ ],
3595
+ "type": "string"
3596
+ }
3597
+ ] },
3598
+ "SubAgentActivityKind": {
3599
+ "enum": [
3600
+ "started",
3601
+ "interacted",
3602
+ "interrupted",
3603
+ "completed"
3604
+ ],
3605
+ "type": "string"
3606
+ },
3607
+ "SubAgentSource": { "oneOf": [
3608
+ {
3609
+ "additionalProperties": false,
3610
+ "properties": { "thread_spawn": {
3611
+ "properties": {
3612
+ "agent_nickname": {
3613
+ "default": null,
3614
+ "type": ["string", "null"]
3615
+ },
3616
+ "agent_path": {
3617
+ "anyOf": [{ "$ref": "#/definitions/AgentPath" }, { "type": "null" }],
3618
+ "default": null
3619
+ },
3620
+ "agent_role": {
3621
+ "default": null,
3622
+ "type": ["string", "null"]
3623
+ },
3624
+ "depth": {
3625
+ "format": "int32",
3626
+ "type": "integer"
3627
+ },
3628
+ "parent_thread_id": { "$ref": "#/definitions/ThreadId" }
3629
+ },
3630
+ "required": ["depth", "parent_thread_id"],
3631
+ "type": "object"
3632
+ } },
3633
+ "required": ["thread_spawn"],
3634
+ "title": "ThreadSpawnSubAgentSource",
3635
+ "type": "object"
3636
+ },
3637
+ {
3638
+ "additionalProperties": false,
3639
+ "properties": { "other": { "type": "string" } },
3640
+ "required": ["other"],
3641
+ "title": "OtherSubAgentSource",
3642
+ "type": "object"
3643
+ },
3644
+ {
3645
+ "enum": [
3646
+ "review",
3647
+ "compact",
3648
+ "memory_consolidation"
3649
+ ],
3650
+ "type": "string"
3651
+ }
3652
+ ] },
3653
+ "TextElement": {
3654
+ "properties": {
3655
+ "byteRange": {
3656
+ "allOf": [{ "$ref": "#/definitions/ByteRange" }],
3657
+ "description": "Byte range in the parent `text` buffer that this element occupies."
3658
+ },
3659
+ "placeholder": {
3660
+ "description": "Optional human-readable placeholder for the element, displayed in the UI.",
3661
+ "type": ["string", "null"]
3662
+ }
3663
+ },
3664
+ "required": ["byteRange"],
3665
+ "type": "object"
3666
+ },
3667
+ "Thread": {
3668
+ "properties": {
3669
+ "agentNickname": {
3670
+ "description": "Optional random unique nickname assigned to an AgentControl-spawned sub-agent.",
3671
+ "type": ["string", "null"]
3672
+ },
3673
+ "agentRole": {
3674
+ "description": "Optional role (agent_role) assigned to an AgentControl-spawned sub-agent.",
3675
+ "type": ["string", "null"]
3676
+ },
3677
+ "canAcceptDirectInput": {
3678
+ "description": "Whether the app server accepts direct turn input for this loaded thread. `None` means the capability is unavailable, such as for an unloaded stored thread.",
3679
+ "type": ["boolean", "null"]
3680
+ },
3681
+ "cliVersion": {
3682
+ "description": "Version of the CLI that created the thread.",
3683
+ "type": "string"
3684
+ },
3685
+ "createdAt": {
3686
+ "description": "Unix timestamp (in seconds) when the thread was created.",
3687
+ "format": "int64",
3688
+ "type": "integer"
3689
+ },
3690
+ "cwd": {
3691
+ "allOf": [{ "$ref": "#/definitions/AbsolutePathBuf" }],
3692
+ "description": "Working directory captured for the thread."
3693
+ },
3694
+ "ephemeral": {
3695
+ "description": "Whether the thread is ephemeral and should not be materialized on disk.",
3696
+ "type": "boolean"
3697
+ },
3698
+ "extra": {
3699
+ "anyOf": [{ "$ref": "#/definitions/ThreadExtra" }, { "type": "null" }],
3700
+ "description": "Optional implementation-specific thread data."
3701
+ },
3702
+ "forkedFromId": {
3703
+ "description": "Source thread id when this thread was created by forking another thread.",
3704
+ "type": ["string", "null"]
3705
+ },
3706
+ "gitInfo": {
3707
+ "anyOf": [{ "$ref": "#/definitions/GitInfo" }, { "type": "null" }],
3708
+ "description": "Optional Git metadata captured when the thread was created."
3709
+ },
3710
+ "historyMode": {
3711
+ "allOf": [{ "$ref": "#/definitions/ThreadHistoryMode" }],
3712
+ "default": "legacy",
3713
+ "description": "Persisted thread history contract selected when this thread was created."
3714
+ },
3715
+ "id": {
3716
+ "description": "Identifier for this thread. Codex-generated thread IDs are UUIDv7.",
3717
+ "type": "string"
3718
+ },
3719
+ "modelProvider": {
3720
+ "description": "Model provider used for this thread (for example, 'openai').",
3721
+ "type": "string"
3722
+ },
3723
+ "name": {
3724
+ "description": "Optional user-facing thread title.",
3725
+ "type": ["string", "null"]
3726
+ },
3727
+ "parentThreadId": {
3728
+ "description": "The ID of the parent thread. This will only be set if this thread is a subagent.",
3729
+ "type": ["string", "null"]
3730
+ },
3731
+ "path": {
3732
+ "description": "[UNSTABLE] Path to the thread on disk.",
3733
+ "type": ["string", "null"]
3734
+ },
3735
+ "preview": {
3736
+ "description": "Usually the first user message in the thread, if available.",
3737
+ "type": "string"
3738
+ },
3739
+ "projectId": {
3740
+ "description": "Canonical project assignment owned by app-server, if any.",
3741
+ "type": ["string", "null"]
3742
+ },
3743
+ "recencyAt": {
3744
+ "description": "Unix timestamp (in seconds) used for thread recency ordering.",
3745
+ "format": "int64",
3746
+ "type": ["integer", "null"]
3747
+ },
3748
+ "section": {
3749
+ "anyOf": [{ "$ref": "#/definitions/ThreadSection" }, { "type": "null" }],
3750
+ "default": null,
3751
+ "description": "The independently persisted section selected for this thread, if any."
3752
+ },
3753
+ "sectionEnteredAt": {
3754
+ "default": null,
3755
+ "description": "Unix timestamp in seconds when the thread entered its current section.",
3756
+ "format": "int64",
3757
+ "type": ["integer", "null"]
3758
+ },
3759
+ "sessionId": {
3760
+ "description": "Session id shared by threads that belong to the same session tree.",
3761
+ "type": "string"
3762
+ },
3763
+ "source": {
3764
+ "allOf": [{ "$ref": "#/definitions/SessionSource" }],
3765
+ "description": "Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.)."
3766
+ },
3767
+ "status": {
3768
+ "allOf": [{ "$ref": "#/definitions/ThreadStatus" }],
3769
+ "description": "Current runtime status for the thread."
3770
+ },
3771
+ "threadSource": {
3772
+ "anyOf": [{ "$ref": "#/definitions/ThreadSource" }, { "type": "null" }],
3773
+ "description": "Optional analytics source classification for this thread."
3774
+ },
3775
+ "turns": {
3776
+ "description": "Only populated on `thread/resume`, `thread/rollback`, `thread/fork`, and `thread/read` (when `includeTurns` is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.",
3777
+ "items": { "$ref": "#/definitions/Turn" },
3778
+ "type": "array"
3779
+ },
3780
+ "updatedAt": {
3781
+ "description": "Unix timestamp (in seconds) when the thread was last updated.",
3782
+ "format": "int64",
3783
+ "type": "integer"
3784
+ }
3785
+ },
3786
+ "required": [
3787
+ "cliVersion",
3788
+ "createdAt",
3789
+ "cwd",
3790
+ "ephemeral",
3791
+ "id",
3792
+ "modelProvider",
3793
+ "preview",
3794
+ "projectId",
3795
+ "sessionId",
3796
+ "source",
3797
+ "status",
3798
+ "turns",
3799
+ "updatedAt"
3800
+ ],
3801
+ "type": "object"
3802
+ },
3803
+ "ThreadActiveFlag": {
3804
+ "enum": ["waitingOnApproval", "waitingOnUserInput"],
3805
+ "type": "string"
3806
+ },
3807
+ "ThreadExtra": {
3808
+ "description": "Extra app-server data for a thread.",
3809
+ "type": "object"
3810
+ },
3811
+ "ThreadHistoryMode": {
3812
+ "enum": ["legacy", "paginated"],
3813
+ "type": "string"
3814
+ },
3815
+ "ThreadId": { "type": "string" },
3816
+ "ThreadItem": { "oneOf": [
3817
+ {
3818
+ "properties": {
3819
+ "clientId": { "type": ["string", "null"] },
3820
+ "content": {
3821
+ "items": { "$ref": "#/definitions/UserInput" },
3822
+ "type": "array"
3823
+ },
3824
+ "id": { "type": "string" },
3825
+ "type": {
3826
+ "enum": ["userMessage"],
3827
+ "title": "UserMessageThreadItemType",
3828
+ "type": "string"
3829
+ }
3830
+ },
3831
+ "required": [
3832
+ "content",
3833
+ "id",
3834
+ "type"
3835
+ ],
3836
+ "title": "UserMessageThreadItem",
3837
+ "type": "object"
3838
+ },
3839
+ {
3840
+ "properties": {
3841
+ "fragments": {
3842
+ "items": { "$ref": "#/definitions/HookPromptFragment" },
3843
+ "type": "array"
3844
+ },
3845
+ "id": { "type": "string" },
3846
+ "type": {
3847
+ "enum": ["hookPrompt"],
3848
+ "title": "HookPromptThreadItemType",
3849
+ "type": "string"
3850
+ }
3851
+ },
3852
+ "required": [
3853
+ "fragments",
3854
+ "id",
3855
+ "type"
3856
+ ],
3857
+ "title": "HookPromptThreadItem",
3858
+ "type": "object"
3859
+ },
3860
+ {
3861
+ "properties": {
3862
+ "delivery": {
3863
+ "anyOf": [{ "$ref": "#/definitions/AgentMessageDelivery" }, { "type": "null" }],
3864
+ "default": null
3865
+ },
3866
+ "id": { "type": "string" },
3867
+ "memoryCitation": {
3868
+ "anyOf": [{ "$ref": "#/definitions/MemoryCitation" }, { "type": "null" }],
3869
+ "default": null
3870
+ },
3871
+ "phase": {
3872
+ "anyOf": [{ "$ref": "#/definitions/MessagePhase" }, { "type": "null" }],
3873
+ "default": null
3874
+ },
3875
+ "text": { "type": "string" },
3876
+ "type": {
3877
+ "enum": ["agentMessage"],
3878
+ "title": "AgentMessageThreadItemType",
3879
+ "type": "string"
3880
+ }
3881
+ },
3882
+ "required": [
3883
+ "id",
3884
+ "text",
3885
+ "type"
3886
+ ],
3887
+ "title": "AgentMessageThreadItem",
3888
+ "type": "object"
3889
+ },
3890
+ {
3891
+ "properties": {
3892
+ "id": { "type": "string" },
3893
+ "name": { "type": "string" },
3894
+ "namespace": { "type": ["string", "null"] },
3895
+ "output": { "$ref": "#/definitions/FunctionCallOutputBody" },
3896
+ "type": {
3897
+ "enum": ["functionCallOutput"],
3898
+ "title": "FunctionCallOutputThreadItemType",
3899
+ "type": "string"
3900
+ }
3901
+ },
3902
+ "required": [
3903
+ "id",
3904
+ "name",
3905
+ "output",
3906
+ "type"
3907
+ ],
3908
+ "title": "FunctionCallOutputThreadItem",
3909
+ "type": "object"
3910
+ },
3911
+ {
3912
+ "description": "EXPERIMENTAL - proposed plan item content. The completed plan item is authoritative and may not match the concatenation of `PlanDelta` text.",
3913
+ "properties": {
3914
+ "id": { "type": "string" },
3915
+ "text": { "type": "string" },
3916
+ "type": {
3917
+ "enum": ["plan"],
3918
+ "title": "PlanThreadItemType",
3919
+ "type": "string"
3920
+ }
3921
+ },
3922
+ "required": [
3923
+ "id",
3924
+ "text",
3925
+ "type"
3926
+ ],
3927
+ "title": "PlanThreadItem",
3928
+ "type": "object"
3929
+ },
3930
+ {
3931
+ "properties": {
3932
+ "content": {
3933
+ "default": [],
3934
+ "items": { "type": "string" },
3935
+ "type": "array"
3936
+ },
3937
+ "id": { "type": "string" },
3938
+ "summary": {
3939
+ "default": [],
3940
+ "items": { "type": "string" },
3941
+ "type": "array"
3942
+ },
3943
+ "type": {
3944
+ "enum": ["reasoning"],
3945
+ "title": "ReasoningThreadItemType",
3946
+ "type": "string"
3947
+ }
3948
+ },
3949
+ "required": ["id", "type"],
3950
+ "title": "ReasoningThreadItem",
3951
+ "type": "object"
3952
+ },
3953
+ {
3954
+ "properties": {
3955
+ "aggregatedOutput": {
3956
+ "description": "The command's output, aggregated from stdout and stderr.",
3957
+ "type": ["string", "null"]
3958
+ },
3959
+ "command": {
3960
+ "description": "The command to be executed.",
3961
+ "type": "string"
3962
+ },
3963
+ "commandActions": {
3964
+ "description": "A best-effort parsing of the command to understand the action(s) it will perform. This returns a list of CommandAction objects because a single shell command may be composed of many commands piped together.",
3965
+ "items": { "$ref": "#/definitions/CommandAction" },
3966
+ "type": "array"
3967
+ },
3968
+ "cwd": {
3969
+ "allOf": [{ "$ref": "#/definitions/LegacyAppPathString" }],
3970
+ "description": "The command's working directory."
3971
+ },
3972
+ "durationMs": {
3973
+ "description": "The duration of the command execution in milliseconds.",
3974
+ "format": "int64",
3975
+ "type": ["integer", "null"]
3976
+ },
3977
+ "exitCode": {
3978
+ "description": "The command's exit code.",
3979
+ "format": "int32",
3980
+ "type": ["integer", "null"]
3981
+ },
3982
+ "id": { "type": "string" },
3983
+ "pluginId": {
3984
+ "default": null,
3985
+ "description": "Trusted first-party plugin id when this command resolves to one plugin script.",
3986
+ "type": ["string", "null"]
3987
+ },
3988
+ "processId": {
3989
+ "description": "Identifier for the underlying PTY process (when available).",
3990
+ "type": ["string", "null"]
3991
+ },
3992
+ "scriptPath": {
3993
+ "default": null,
3994
+ "description": "Safe plugin-relative path when this command resolves to one plugin script.",
3995
+ "type": ["string", "null"]
3996
+ },
3997
+ "source": {
3998
+ "allOf": [{ "$ref": "#/definitions/CommandExecutionSource" }],
3999
+ "default": "agent"
4000
+ },
4001
+ "status": { "$ref": "#/definitions/CommandExecutionStatus" },
4002
+ "type": {
4003
+ "enum": ["commandExecution"],
4004
+ "title": "CommandExecutionThreadItemType",
4005
+ "type": "string"
4006
+ }
4007
+ },
4008
+ "required": [
4009
+ "command",
4010
+ "commandActions",
4011
+ "cwd",
4012
+ "id",
4013
+ "status",
4014
+ "type"
4015
+ ],
4016
+ "title": "CommandExecutionThreadItem",
4017
+ "type": "object"
4018
+ },
4019
+ {
4020
+ "properties": {
4021
+ "changes": {
4022
+ "items": { "$ref": "#/definitions/FileUpdateChange" },
4023
+ "type": "array"
4024
+ },
4025
+ "id": { "type": "string" },
4026
+ "status": { "$ref": "#/definitions/PatchApplyStatus" },
4027
+ "type": {
4028
+ "enum": ["fileChange"],
4029
+ "title": "FileChangeThreadItemType",
4030
+ "type": "string"
4031
+ }
4032
+ },
4033
+ "required": [
4034
+ "changes",
4035
+ "id",
4036
+ "status",
4037
+ "type"
4038
+ ],
4039
+ "title": "FileChangeThreadItem",
4040
+ "type": "object"
4041
+ },
4042
+ {
4043
+ "properties": {
4044
+ "appContext": { "anyOf": [{ "$ref": "#/definitions/McpToolCallAppContext" }, { "type": "null" }] },
4045
+ "arguments": true,
4046
+ "durationMs": {
4047
+ "description": "The duration of the MCP tool call in milliseconds.",
4048
+ "format": "int64",
4049
+ "type": ["integer", "null"]
4050
+ },
4051
+ "error": { "anyOf": [{ "$ref": "#/definitions/McpToolCallError" }, { "type": "null" }] },
4052
+ "id": { "type": "string" },
4053
+ "mcpAppResourceUri": {
4054
+ "description": "Deprecated: use `appContext.resourceUri` instead.",
4055
+ "type": ["string", "null"]
4056
+ },
4057
+ "pluginId": { "type": ["string", "null"] },
4058
+ "readOnlyHint": { "type": ["boolean", "null"] },
4059
+ "result": { "anyOf": [{ "$ref": "#/definitions/McpToolCallResult" }, { "type": "null" }] },
4060
+ "server": { "type": "string" },
4061
+ "status": { "$ref": "#/definitions/McpToolCallStatus" },
4062
+ "tool": { "type": "string" },
4063
+ "type": {
4064
+ "enum": ["mcpToolCall"],
4065
+ "title": "McpToolCallThreadItemType",
4066
+ "type": "string"
4067
+ }
4068
+ },
4069
+ "required": [
4070
+ "arguments",
4071
+ "id",
4072
+ "server",
4073
+ "status",
4074
+ "tool",
4075
+ "type"
4076
+ ],
4077
+ "title": "McpToolCallThreadItem",
4078
+ "type": "object"
4079
+ },
4080
+ {
4081
+ "properties": {
4082
+ "arguments": true,
4083
+ "contentItems": {
4084
+ "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" },
4085
+ "type": ["array", "null"]
4086
+ },
4087
+ "durationMs": {
4088
+ "description": "The duration of the dynamic tool call in milliseconds.",
4089
+ "format": "int64",
4090
+ "type": ["integer", "null"]
4091
+ },
4092
+ "id": { "type": "string" },
4093
+ "namespace": { "type": ["string", "null"] },
4094
+ "status": { "$ref": "#/definitions/DynamicToolCallStatus" },
4095
+ "success": { "type": ["boolean", "null"] },
4096
+ "tool": { "type": "string" },
4097
+ "type": {
4098
+ "enum": ["dynamicToolCall"],
4099
+ "title": "DynamicToolCallThreadItemType",
4100
+ "type": "string"
4101
+ }
4102
+ },
4103
+ "required": [
4104
+ "arguments",
4105
+ "id",
4106
+ "status",
4107
+ "tool",
4108
+ "type"
4109
+ ],
4110
+ "title": "DynamicToolCallThreadItem",
4111
+ "type": "object"
4112
+ },
4113
+ {
4114
+ "properties": {
4115
+ "agentsStates": {
4116
+ "additionalProperties": { "$ref": "#/definitions/CollabAgentState" },
4117
+ "description": "Last known status of the target agents, when available.",
4118
+ "type": "object"
4119
+ },
4120
+ "id": {
4121
+ "description": "Unique identifier for this collab tool call.",
4122
+ "type": "string"
4123
+ },
4124
+ "model": {
4125
+ "description": "Model requested for the spawned agent, when applicable.",
4126
+ "type": ["string", "null"]
4127
+ },
4128
+ "prompt": {
4129
+ "description": "Prompt text sent as part of the collab tool call, when available.",
4130
+ "type": ["string", "null"]
4131
+ },
4132
+ "reasoningEffort": {
4133
+ "anyOf": [{ "$ref": "#/definitions/ReasoningEffort" }, { "type": "null" }],
4134
+ "description": "Reasoning effort requested for the spawned agent, when applicable."
4135
+ },
4136
+ "receiverThreadIds": {
4137
+ "description": "Thread ID of the receiving agent, when applicable. In case of spawn operation, this corresponds to the newly spawned agent.",
4138
+ "items": { "type": "string" },
4139
+ "type": "array"
4140
+ },
4141
+ "senderThreadId": {
4142
+ "description": "Thread ID of the agent issuing the collab request.",
4143
+ "type": "string"
4144
+ },
4145
+ "status": {
4146
+ "allOf": [{ "$ref": "#/definitions/CollabAgentToolCallStatus" }],
4147
+ "description": "Current status of the collab tool call."
4148
+ },
4149
+ "tool": {
4150
+ "allOf": [{ "$ref": "#/definitions/CollabAgentTool" }],
4151
+ "description": "Name of the collab tool that was invoked."
4152
+ },
4153
+ "type": {
4154
+ "enum": ["collabAgentToolCall"],
4155
+ "title": "CollabAgentToolCallThreadItemType",
4156
+ "type": "string"
4157
+ }
4158
+ },
4159
+ "required": [
4160
+ "agentsStates",
4161
+ "id",
4162
+ "receiverThreadIds",
4163
+ "senderThreadId",
4164
+ "status",
4165
+ "tool",
4166
+ "type"
4167
+ ],
4168
+ "title": "CollabAgentToolCallThreadItem",
4169
+ "type": "object"
4170
+ },
4171
+ {
4172
+ "properties": {
4173
+ "agentPath": { "type": "string" },
4174
+ "agentThreadId": { "type": "string" },
4175
+ "id": { "type": "string" },
4176
+ "kind": { "$ref": "#/definitions/SubAgentActivityKind" },
4177
+ "type": {
4178
+ "enum": ["subAgentActivity"],
4179
+ "title": "SubAgentActivityThreadItemType",
4180
+ "type": "string"
4181
+ }
4182
+ },
4183
+ "required": [
4184
+ "agentPath",
4185
+ "agentThreadId",
4186
+ "id",
4187
+ "kind",
4188
+ "type"
4189
+ ],
4190
+ "title": "SubAgentActivityThreadItem",
4191
+ "type": "object"
4192
+ },
4193
+ {
4194
+ "properties": {
4195
+ "action": { "anyOf": [{ "$ref": "#/definitions/WebSearchAction" }, { "type": "null" }] },
4196
+ "id": { "type": "string" },
4197
+ "query": { "type": "string" },
4198
+ "results": {
4199
+ "default": null,
4200
+ "description": "Structured search results returned out-of-band by standalone web search.\n\nThese stay as opaque JSON at the extension/app-server boundary so new result fields and result types can pass through without a Codex release.",
4201
+ "items": true,
4202
+ "type": ["array", "null"]
4203
+ },
4204
+ "type": {
4205
+ "enum": ["webSearch"],
4206
+ "title": "WebSearchThreadItemType",
4207
+ "type": "string"
4208
+ }
4209
+ },
4210
+ "required": [
4211
+ "id",
4212
+ "query",
4213
+ "type"
4214
+ ],
4215
+ "title": "WebSearchThreadItem",
4216
+ "type": "object"
4217
+ },
4218
+ {
4219
+ "properties": {
4220
+ "id": { "type": "string" },
4221
+ "path": { "$ref": "#/definitions/LegacyAppPathString" },
4222
+ "type": {
4223
+ "enum": ["imageView"],
4224
+ "title": "ImageViewThreadItemType",
4225
+ "type": "string"
4226
+ }
4227
+ },
4228
+ "required": [
4229
+ "id",
4230
+ "path",
4231
+ "type"
4232
+ ],
4233
+ "title": "ImageViewThreadItem",
4234
+ "type": "object"
4235
+ },
4236
+ {
4237
+ "description": "Display item emitted by the interruptible `clock.sleep` tool.",
4238
+ "properties": {
4239
+ "durationMs": {
4240
+ "format": "uint64",
4241
+ "minimum": 0,
4242
+ "type": "integer"
4243
+ },
4244
+ "id": { "type": "string" },
4245
+ "type": {
4246
+ "enum": ["sleep"],
4247
+ "title": "SleepThreadItemType",
4248
+ "type": "string"
4249
+ }
4250
+ },
4251
+ "required": [
4252
+ "durationMs",
4253
+ "id",
4254
+ "type"
4255
+ ],
4256
+ "title": "SleepThreadItem",
4257
+ "type": "object"
4258
+ },
4259
+ {
4260
+ "properties": {
4261
+ "failure": {
4262
+ "anyOf": [{ "$ref": "#/definitions/ImageGenerationFailure" }, { "type": "null" }],
4263
+ "default": null
4264
+ },
4265
+ "id": { "type": "string" },
4266
+ "result": { "type": "string" },
4267
+ "revisedPrompt": { "type": ["string", "null"] },
4268
+ "savedPath": { "anyOf": [{ "$ref": "#/definitions/AbsolutePathBuf" }, { "type": "null" }] },
4269
+ "status": { "type": "string" },
4270
+ "transparentBackground": {
4271
+ "default": null,
4272
+ "type": ["boolean", "null"]
4273
+ },
4274
+ "type": {
4275
+ "enum": ["imageGeneration"],
4276
+ "title": "ImageGenerationThreadItemType",
4277
+ "type": "string"
4278
+ }
4279
+ },
4280
+ "required": [
4281
+ "id",
4282
+ "result",
4283
+ "status",
4284
+ "type"
4285
+ ],
4286
+ "title": "ImageGenerationThreadItem",
4287
+ "type": "object"
4288
+ },
4289
+ {
4290
+ "properties": {
4291
+ "id": { "type": "string" },
4292
+ "review": { "type": "string" },
4293
+ "type": {
4294
+ "enum": ["enteredReviewMode"],
4295
+ "title": "EnteredReviewModeThreadItemType",
4296
+ "type": "string"
4297
+ }
4298
+ },
4299
+ "required": [
4300
+ "id",
4301
+ "review",
4302
+ "type"
4303
+ ],
4304
+ "title": "EnteredReviewModeThreadItem",
4305
+ "type": "object"
4306
+ },
4307
+ {
4308
+ "properties": {
4309
+ "id": { "type": "string" },
4310
+ "review": { "type": "string" },
4311
+ "type": {
4312
+ "enum": ["exitedReviewMode"],
4313
+ "title": "ExitedReviewModeThreadItemType",
4314
+ "type": "string"
4315
+ }
4316
+ },
4317
+ "required": [
4318
+ "id",
4319
+ "review",
4320
+ "type"
4321
+ ],
4322
+ "title": "ExitedReviewModeThreadItem",
4323
+ "type": "object"
4324
+ },
4325
+ {
4326
+ "properties": {
4327
+ "id": { "type": "string" },
4328
+ "type": {
4329
+ "enum": ["contextCompaction"],
4330
+ "title": "ContextCompactionThreadItemType",
4331
+ "type": "string"
4332
+ }
4333
+ },
4334
+ "required": ["id", "type"],
4335
+ "title": "ContextCompactionThreadItem",
4336
+ "type": "object"
4337
+ }
4338
+ ] },
4339
+ "ThreadSection": {
4340
+ "description": "An independently persisted, user-visible thread section.",
4341
+ "properties": {
4342
+ "appearance": {
4343
+ "anyOf": [{ "$ref": "#/definitions/ThreadSectionAppearance" }, { "type": "null" }],
4344
+ "default": null,
4345
+ "description": "Optional appearance synchronized across clients."
4346
+ },
4347
+ "id": {
4348
+ "description": "Opaque UUIDv7 identity that remains stable when the section is renamed.",
4349
+ "type": "string"
4350
+ },
4351
+ "name": {
4352
+ "description": "The current user-visible section name.",
4353
+ "type": "string"
4354
+ }
4355
+ },
4356
+ "required": ["id", "name"],
4357
+ "type": "object"
4358
+ },
4359
+ "ThreadSectionAppearance": {
4360
+ "description": "Extensible visual presentation for a custom thread section.",
4361
+ "properties": {
4362
+ "color": { "type": ["string", "null"] },
4363
+ "icon": { "type": ["string", "null"] }
4364
+ },
4365
+ "type": "object"
4366
+ },
4367
+ "ThreadSource": { "type": "string" },
4368
+ "ThreadStatus": { "oneOf": [
4369
+ {
4370
+ "properties": { "type": {
4371
+ "enum": ["notLoaded"],
4372
+ "title": "NotLoadedThreadStatusType",
4373
+ "type": "string"
4374
+ } },
4375
+ "required": ["type"],
4376
+ "title": "NotLoadedThreadStatus",
4377
+ "type": "object"
4378
+ },
4379
+ {
4380
+ "properties": { "type": {
4381
+ "enum": ["idle"],
4382
+ "title": "IdleThreadStatusType",
4383
+ "type": "string"
4384
+ } },
4385
+ "required": ["type"],
4386
+ "title": "IdleThreadStatus",
4387
+ "type": "object"
4388
+ },
4389
+ {
4390
+ "properties": { "type": {
4391
+ "enum": ["systemError"],
4392
+ "title": "SystemErrorThreadStatusType",
4393
+ "type": "string"
4394
+ } },
4395
+ "required": ["type"],
4396
+ "title": "SystemErrorThreadStatus",
4397
+ "type": "object"
4398
+ },
4399
+ {
4400
+ "properties": {
4401
+ "activeFlags": {
4402
+ "items": { "$ref": "#/definitions/ThreadActiveFlag" },
4403
+ "type": "array"
4404
+ },
4405
+ "type": {
4406
+ "enum": ["active"],
4407
+ "title": "ActiveThreadStatusType",
4408
+ "type": "string"
4409
+ }
4410
+ },
4411
+ "required": ["activeFlags", "type"],
4412
+ "title": "ActiveThreadStatus",
4413
+ "type": "object"
4414
+ }
4415
+ ] },
4416
+ "Turn": {
4417
+ "properties": {
4418
+ "completedAt": {
4419
+ "description": "Unix timestamp (in seconds) when the turn completed.",
4420
+ "format": "int64",
4421
+ "type": ["integer", "null"]
4422
+ },
4423
+ "durationMs": {
4424
+ "description": "Duration between turn start and completion in milliseconds, if known.",
4425
+ "format": "int64",
4426
+ "type": ["integer", "null"]
4427
+ },
4428
+ "error": {
4429
+ "anyOf": [{ "$ref": "#/definitions/TurnError" }, { "type": "null" }],
4430
+ "description": "Only populated when the Turn's status is failed."
4431
+ },
4432
+ "id": {
4433
+ "description": "Identifier for this turn. Codex-generated turn IDs are UUIDv7.",
4434
+ "type": "string"
4435
+ },
4436
+ "items": {
4437
+ "description": "Thread items currently included in this turn payload.",
4438
+ "items": { "$ref": "#/definitions/ThreadItem" },
4439
+ "type": "array"
4440
+ },
4441
+ "itemsView": {
4442
+ "allOf": [{ "$ref": "#/definitions/TurnItemsView" }],
4443
+ "default": "full",
4444
+ "description": "Describes how much of `items` has been loaded for this turn."
4445
+ },
4446
+ "startedAt": {
4447
+ "description": "Unix timestamp (in seconds) when the turn started.",
4448
+ "format": "int64",
4449
+ "type": ["integer", "null"]
4450
+ },
4451
+ "status": { "$ref": "#/definitions/TurnStatus" }
4452
+ },
4453
+ "required": [
4454
+ "id",
4455
+ "items",
4456
+ "status"
4457
+ ],
4458
+ "type": "object"
4459
+ },
4460
+ "TurnError": {
4461
+ "properties": {
4462
+ "additionalDetails": {
4463
+ "default": null,
4464
+ "type": ["string", "null"]
4465
+ },
4466
+ "codexErrorInfo": { "anyOf": [{ "$ref": "#/definitions/CodexErrorInfo" }, { "type": "null" }] },
4467
+ "message": { "type": "string" },
4468
+ "misalignment": {
4469
+ "anyOf": [{ "$ref": "#/definitions/MisalignmentErrorDetails" }, { "type": "null" }],
4470
+ "default": null,
4471
+ "description": "Optional public explanation and continuation instruction for a misalignment block."
4472
+ }
4473
+ },
4474
+ "required": ["message"],
4475
+ "type": "object"
4476
+ },
4477
+ "TurnItemsView": { "oneOf": [
4478
+ {
4479
+ "description": "`items` was not loaded for this turn. The field is intentionally empty.",
4480
+ "enum": ["notLoaded"],
4481
+ "type": "string"
4482
+ },
4483
+ {
4484
+ "description": "`items` contains only a display summary for this turn.",
4485
+ "enum": ["summary"],
4486
+ "type": "string"
4487
+ },
4488
+ {
4489
+ "description": "`items` contains every ThreadItem available from persisted app-server history for this turn.",
4490
+ "enum": ["full"],
4491
+ "type": "string"
4492
+ }
4493
+ ] },
4494
+ "TurnStatus": {
4495
+ "enum": [
4496
+ "completed",
4497
+ "interrupted",
4498
+ "failed",
4499
+ "inProgress"
4500
+ ],
4501
+ "type": "string"
4502
+ },
4503
+ "TurnsPage": {
4504
+ "properties": {
4505
+ "backwardsCursor": { "type": ["string", "null"] },
4506
+ "data": {
4507
+ "items": { "$ref": "#/definitions/Turn" },
4508
+ "type": "array"
4509
+ },
4510
+ "nextCursor": { "type": ["string", "null"] }
4511
+ },
4512
+ "required": ["data"],
4513
+ "type": "object"
4514
+ },
4515
+ "UserInput": { "oneOf": [
4516
+ {
4517
+ "properties": {
4518
+ "text": { "type": "string" },
4519
+ "text_elements": {
4520
+ "default": [],
4521
+ "description": "UI-defined spans within `text` used to render or persist special elements.",
4522
+ "items": { "$ref": "#/definitions/TextElement" },
4523
+ "type": "array"
4524
+ },
4525
+ "type": {
4526
+ "enum": ["text"],
4527
+ "title": "TextUserInputType",
4528
+ "type": "string"
4529
+ }
4530
+ },
4531
+ "required": ["text", "type"],
4532
+ "title": "TextUserInput",
4533
+ "type": "object"
4534
+ },
4535
+ {
4536
+ "properties": {
4537
+ "detail": {
4538
+ "anyOf": [{ "$ref": "#/definitions/ImageDetail" }, { "type": "null" }],
4539
+ "default": null
4540
+ },
4541
+ "type": {
4542
+ "enum": ["image"],
4543
+ "title": "ImageUserInputType",
4544
+ "type": "string"
4545
+ },
4546
+ "url": { "type": "string" }
4547
+ },
4548
+ "required": ["type", "url"],
4549
+ "title": "ImageUserInput",
4550
+ "type": "object"
4551
+ },
4552
+ {
4553
+ "properties": {
4554
+ "detail": {
4555
+ "anyOf": [{ "$ref": "#/definitions/ImageDetail" }, { "type": "null" }],
4556
+ "default": null
4557
+ },
4558
+ "path": { "type": "string" },
4559
+ "type": {
4560
+ "enum": ["localImage"],
4561
+ "title": "LocalImageUserInputType",
4562
+ "type": "string"
4563
+ }
4564
+ },
4565
+ "required": ["path", "type"],
4566
+ "title": "LocalImageUserInput",
4567
+ "type": "object"
4568
+ },
4569
+ {
4570
+ "properties": {
4571
+ "type": {
4572
+ "enum": ["audio"],
4573
+ "title": "AudioUserInputType",
4574
+ "type": "string"
4575
+ },
4576
+ "url": { "type": "string" }
4577
+ },
4578
+ "required": ["type", "url"],
4579
+ "title": "AudioUserInput",
4580
+ "type": "object"
4581
+ },
4582
+ {
4583
+ "properties": {
4584
+ "path": { "type": "string" },
4585
+ "type": {
4586
+ "enum": ["localAudio"],
4587
+ "title": "LocalAudioUserInputType",
4588
+ "type": "string"
4589
+ }
4590
+ },
4591
+ "required": ["path", "type"],
4592
+ "title": "LocalAudioUserInput",
4593
+ "type": "object"
4594
+ },
4595
+ {
4596
+ "properties": {
4597
+ "name": { "type": "string" },
4598
+ "path": { "type": "string" },
4599
+ "type": {
4600
+ "enum": ["skill"],
4601
+ "title": "SkillUserInputType",
4602
+ "type": "string"
4603
+ }
4604
+ },
4605
+ "required": [
4606
+ "name",
4607
+ "path",
4608
+ "type"
4609
+ ],
4610
+ "title": "SkillUserInput",
4611
+ "type": "object"
4612
+ },
4613
+ {
4614
+ "properties": {
4615
+ "name": { "type": "string" },
4616
+ "path": { "type": "string" },
4617
+ "type": {
4618
+ "enum": ["mention"],
4619
+ "title": "MentionUserInputType",
4620
+ "type": "string"
4621
+ }
4622
+ },
4623
+ "required": [
4624
+ "name",
4625
+ "path",
4626
+ "type"
4627
+ ],
4628
+ "title": "MentionUserInput",
4629
+ "type": "object"
4630
+ }
4631
+ ] },
4632
+ "WebSearchAction": { "oneOf": [
4633
+ {
4634
+ "properties": {
4635
+ "queries": {
4636
+ "items": { "type": "string" },
4637
+ "type": ["array", "null"]
4638
+ },
4639
+ "query": { "type": ["string", "null"] },
4640
+ "type": {
4641
+ "enum": ["search"],
4642
+ "title": "SearchWebSearchActionType",
4643
+ "type": "string"
4644
+ }
4645
+ },
4646
+ "required": ["type"],
4647
+ "title": "SearchWebSearchAction",
4648
+ "type": "object"
4649
+ },
4650
+ {
4651
+ "properties": {
4652
+ "type": {
4653
+ "enum": ["openPage"],
4654
+ "title": "OpenPageWebSearchActionType",
4655
+ "type": "string"
4656
+ },
4657
+ "url": { "type": ["string", "null"] }
4658
+ },
4659
+ "required": ["type"],
4660
+ "title": "OpenPageWebSearchAction",
4661
+ "type": "object"
4662
+ },
4663
+ {
4664
+ "properties": {
4665
+ "pattern": { "type": ["string", "null"] },
4666
+ "type": {
4667
+ "enum": ["findInPage"],
4668
+ "title": "FindInPageWebSearchActionType",
4669
+ "type": "string"
4670
+ },
4671
+ "url": { "type": ["string", "null"] }
4672
+ },
4673
+ "required": ["type"],
4674
+ "title": "FindInPageWebSearchAction",
4675
+ "type": "object"
4676
+ },
4677
+ {
4678
+ "properties": { "type": {
4679
+ "enum": ["other"],
4680
+ "title": "OtherWebSearchActionType",
4681
+ "type": "string"
4682
+ } },
4683
+ "required": ["type"],
4684
+ "title": "OtherWebSearchAction",
4685
+ "type": "object"
4686
+ }
4687
+ ] }
4688
+ };
4689
+ //#endregion
4690
+ //#region extensions/codex/src/app-server/protocol-generated/json/v2/ErrorNotification.json
4691
+ var ErrorNotification_default = {
4692
+ $schema: "http://json-schema.org/draft-07/schema#",
4693
+ properties: {
4694
+ "error": { "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/TurnError" },
4695
+ "threadId": { "type": "string" },
4696
+ "turnId": { "type": "string" },
4697
+ "willRetry": { "type": "boolean" }
4698
+ },
4699
+ required: [
4700
+ "error",
4701
+ "threadId",
4702
+ "turnId",
4703
+ "willRetry"
4704
+ ],
4705
+ title: "ErrorNotification",
4706
+ type: "object"
4707
+ };
4708
+ //#endregion
4709
+ //#region extensions/codex/src/app-server/protocol-generated/json/v2/ModelListResponse.json
4710
+ var ModelListResponse_default = {
4711
+ $schema: "http://json-schema.org/draft-07/schema#",
4712
+ properties: {
4713
+ "data": {
4714
+ "items": { "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/Model" },
4715
+ "type": "array"
4716
+ },
4717
+ "nextCursor": {
4718
+ "description": "Opaque cursor to pass to the next call to continue after the last item. If None, there are no more items to return.",
4719
+ "type": ["string", "null"]
4720
+ }
4721
+ },
4722
+ required: ["data"],
4723
+ title: "ModelListResponse",
4724
+ type: "object"
4725
+ };
4726
+ //#endregion
4727
+ //#region extensions/codex/src/app-server/protocol-generated/json/v2/ThreadResumeResponse.json
4728
+ var ThreadResumeResponse_default = {
4729
+ $schema: "http://json-schema.org/draft-07/schema#",
4730
+ properties: {
4731
+ "activePermissionProfile": {
4732
+ "anyOf": [{ "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/ActivePermissionProfile" }, { "type": "null" }],
4733
+ "default": null,
4734
+ "description": "Named or implicit built-in profile that produced the active permissions, when known."
4735
+ },
4736
+ "approvalPolicy": { "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/AskForApproval" },
4737
+ "approvalsReviewer": {
4738
+ "allOf": [{ "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/ApprovalsReviewer" }],
4739
+ "description": "Reviewer currently used for approval requests on this thread."
4740
+ },
4741
+ "cwd": { "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/AbsolutePathBuf" },
4742
+ "initialTurnsPage": {
4743
+ "anyOf": [{ "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/TurnsPage" }, { "type": "null" }],
4744
+ "default": null,
4745
+ "description": "`thread/turns/list` page returned when requested by `initialTurnsPage`."
4746
+ },
4747
+ "instructionSources": {
4748
+ "default": [],
4749
+ "description": "Environment-native paths to instruction source files currently loaded for this thread.",
4750
+ "items": { "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/LegacyAppPathString" },
4751
+ "type": "array"
4752
+ },
4753
+ "itemsBackwardsCursor": {
4754
+ "default": null,
4755
+ "description": "Opaque cursor for hydrating paginated items backwards.\n\nPass this as `cursor` to `thread/items/list` with `sortDirection: \"desc\"`. The first page includes the item identified by the cursor.",
4756
+ "type": ["string", "null"]
4757
+ },
4758
+ "model": { "type": "string" },
4759
+ "modelProvider": { "type": "string" },
4760
+ "multiAgentMode": {
4761
+ "allOf": [{ "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/MultiAgentMode" }],
4762
+ "default": "explicitRequestOnly",
4763
+ "description": "@deprecated Always `explicitRequestOnly`. Use `reasoningEffort` for Ultra behavior."
4764
+ },
4765
+ "reasoningEffort": { "anyOf": [{ "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/ReasoningEffort" }, { "type": "null" }] },
4766
+ "runtimeWorkspaceRoots": {
4767
+ "default": [],
4768
+ "description": "Thread-scoped runtime workspace roots used to materialize `:workspace_roots`.",
4769
+ "items": { "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/AbsolutePathBuf" },
4770
+ "type": "array"
4771
+ },
4772
+ "sandbox": {
4773
+ "allOf": [{ "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/SandboxPolicy" }],
4774
+ "description": "Legacy sandbox policy retained for compatibility. Experimental clients should prefer `activePermissionProfile` for profile provenance."
4775
+ },
4776
+ "serviceTier": { "type": ["string", "null"] },
4777
+ "thread": { "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/Thread" },
4778
+ "turnsBackwardsCursor": {
4779
+ "default": null,
4780
+ "description": "Opaque cursor for hydrating paginated turns backwards.\n\nPass this as `cursor` to `thread/turns/list` with `sortDirection: \"desc\"`. The first page includes the turn identified by the cursor.",
4781
+ "type": ["string", "null"]
4782
+ }
4783
+ },
4784
+ required: [
4785
+ "approvalPolicy",
4786
+ "approvalsReviewer",
4787
+ "cwd",
4788
+ "model",
4789
+ "modelProvider",
4790
+ "sandbox",
4791
+ "thread"
4792
+ ],
4793
+ title: "ThreadResumeResponse",
4794
+ type: "object"
4795
+ };
4796
+ //#endregion
4797
+ //#region extensions/codex/src/app-server/protocol-generated/json/v2/ThreadStartResponse.json
4798
+ var ThreadStartResponse_default = {
4799
+ $schema: "http://json-schema.org/draft-07/schema#",
4800
+ properties: {
4801
+ "activePermissionProfile": {
4802
+ "anyOf": [{ "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/ActivePermissionProfile" }, { "type": "null" }],
4803
+ "default": null,
4804
+ "description": "Named or implicit built-in profile that produced the active permissions, when known."
4805
+ },
4806
+ "approvalPolicy": { "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/AskForApproval" },
4807
+ "approvalsReviewer": {
4808
+ "allOf": [{ "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/ApprovalsReviewer" }],
4809
+ "description": "Reviewer currently used for approval requests on this thread."
4810
+ },
4811
+ "cwd": { "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/AbsolutePathBuf" },
4812
+ "instructionSources": {
4813
+ "default": [],
4814
+ "description": "Environment-native paths to instruction source files currently loaded for this thread.",
4815
+ "items": { "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/LegacyAppPathString" },
4816
+ "type": "array"
4817
+ },
4818
+ "model": { "type": "string" },
4819
+ "modelProvider": { "type": "string" },
4820
+ "multiAgentMode": {
4821
+ "allOf": [{ "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/MultiAgentMode" }],
4822
+ "default": "explicitRequestOnly",
4823
+ "description": "@deprecated Always `explicitRequestOnly`. Use `reasoningEffort` for Ultra behavior."
4824
+ },
4825
+ "reasoningEffort": { "anyOf": [{ "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/ReasoningEffort" }, { "type": "null" }] },
4826
+ "runtimeWorkspaceRoots": {
4827
+ "default": [],
4828
+ "description": "Thread-scoped runtime workspace roots used to materialize `:workspace_roots`.",
4829
+ "items": { "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/AbsolutePathBuf" },
4830
+ "type": "array"
4831
+ },
4832
+ "sandbox": {
4833
+ "allOf": [{ "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/SandboxPolicy" }],
4834
+ "description": "Legacy sandbox policy retained for compatibility. Experimental clients should prefer `activePermissionProfile` for profile provenance."
4835
+ },
4836
+ "serviceTier": { "type": ["string", "null"] },
4837
+ "thread": { "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/Thread" }
4838
+ },
4839
+ required: [
4840
+ "approvalPolicy",
4841
+ "approvalsReviewer",
4842
+ "cwd",
4843
+ "model",
4844
+ "modelProvider",
4845
+ "sandbox",
4846
+ "thread"
4847
+ ],
4848
+ title: "ThreadStartResponse",
4849
+ type: "object"
4850
+ };
4851
+ //#endregion
4852
+ //#region extensions/codex/src/app-server/protocol-generated/json/v2/TurnCompletedNotification.json
4853
+ var TurnCompletedNotification_default = {
4854
+ $schema: "http://json-schema.org/draft-07/schema#",
4855
+ properties: {
4856
+ "threadId": { "type": "string" },
4857
+ "turn": { "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/Turn" }
4858
+ },
4859
+ required: ["threadId", "turn"],
4860
+ title: "TurnCompletedNotification",
4861
+ type: "object"
4862
+ };
4863
+ //#endregion
4864
+ //#region extensions/codex/src/app-server/protocol-generated/json/v2/TurnStartResponse.json
4865
+ var TurnStartResponse_default = {
4866
+ $schema: "http://json-schema.org/draft-07/schema#",
4867
+ properties: { "turn": { "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/Turn" } },
4868
+ required: ["turn"],
4869
+ title: "TurnStartResponse",
4870
+ type: "object"
4871
+ };
4872
+ //#endregion
4873
+ //#region extensions/codex/src/app-server/protocol-validators.ts
4874
+ /**
4875
+ * Runtime validators for Codex app-server protocol payloads, including schema
4876
+ * normalization for generated JSON Schema before TypeBox compilation.
4877
+ */
4878
+ const externalDefinitionRefPrefix = "./CodexAppServerProtocolDefinitions.json#/definitions/";
4879
+ const rootExternalDefinitionRefPrefix = "./v2/CodexAppServerProtocolDefinitions.json#/definitions/";
4880
+ const localDefinitionRefPrefix = "#/definitions/";
4881
+ function materializeCodexSchema(schema, externalRefPrefix = externalDefinitionRefPrefix) {
4882
+ const sharedDefinitions = definitions;
4883
+ if (!isRecord(schema) || !isRecord(sharedDefinitions)) return schema;
4884
+ const reachable = collectDefinitionRefs(schema, externalRefPrefix);
4885
+ const pending = [...reachable];
4886
+ while (pending.length > 0) {
4887
+ const name = pending.pop();
4888
+ if (name === void 0) continue;
4889
+ const definition = sharedDefinitions[name];
4890
+ if (definition === void 0) throw new Error(`Missing generated Codex schema definition: ${name}`);
4891
+ for (const dependency of collectDefinitionRefs(definition, localDefinitionRefPrefix)) if (!reachable.has(dependency)) {
4892
+ reachable.add(dependency);
4893
+ pending.push(dependency);
4894
+ }
4895
+ }
4896
+ if (reachable.size === 0) return schema;
4897
+ const definitions$1 = Object.fromEntries(Object.entries(sharedDefinitions).filter(([name]) => reachable.has(name)));
4898
+ return rewriteDefinitionRefs({
4899
+ ...schema,
4900
+ definitions: definitions$1
4901
+ }, externalRefPrefix);
4902
+ }
4903
+ function collectDefinitionRefs(value, prefix, names = /* @__PURE__ */ new Set()) {
4904
+ if (Array.isArray(value)) for (const entry of value) collectDefinitionRefs(entry, prefix, names);
4905
+ else if (isRecord(value)) {
4906
+ if (typeof value.$ref === "string" && value.$ref.startsWith(prefix)) {
4907
+ const name = value.$ref.slice(prefix.length).split("/", 1)[0];
4908
+ if (name) names.add(name.replaceAll("~1", "/").replaceAll("~0", "~"));
4909
+ }
4910
+ for (const entry of Object.values(value)) collectDefinitionRefs(entry, prefix, names);
4911
+ }
4912
+ return names;
4913
+ }
4914
+ function rewriteDefinitionRefs(value, externalRefPrefix) {
4915
+ if (Array.isArray(value)) return value.map((entry) => rewriteDefinitionRefs(entry, externalRefPrefix));
4916
+ if (!isRecord(value)) return value;
4917
+ return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, key === "$ref" && typeof entry === "string" && entry.startsWith(externalRefPrefix) ? `${localDefinitionRefPrefix}${entry.slice(externalRefPrefix.length)}` : rewriteDefinitionRefs(entry, externalRefPrefix)]));
4918
+ }
4919
+ const dynamicToolCallParamsSchema = materializeCodexSchema(DynamicToolCallParams_default, rootExternalDefinitionRefPrefix);
4920
+ const errorNotificationSchema = materializeCodexSchema(ErrorNotification_default);
4921
+ const modelListResponseSchema = materializeCodexSchema(ModelListResponse_default);
4922
+ const threadResumeResponseSchema = materializeCodexSchema(ThreadResumeResponse_default);
4923
+ const threadStartResponseSchema = materializeCodexSchema(ThreadStartResponse_default);
4924
+ const turnCompletedNotificationSchema = materializeCodexSchema(TurnCompletedNotification_default);
4925
+ const turnStartResponseSchema = materializeCodexSchema(TurnStartResponse_default);
4926
+ function compileCodexSchema(schema) {
4927
+ const validator = Compile(normalizeJsonSchemaNode(schema));
4928
+ return {
4929
+ check: (value) => validator.Check(value),
4930
+ errors: (value) => [...validator.Errors(value)]
4931
+ };
4932
+ }
4933
+ const schemaMapKeywords = /* @__PURE__ */ new Set([
4934
+ "$defs",
4935
+ "definitions",
4936
+ "dependentSchemas",
4937
+ "patternProperties",
4938
+ "properties"
4939
+ ]);
4940
+ const schemaValueKeywords = /* @__PURE__ */ new Set([
4941
+ "additionalItems",
4942
+ "additionalProperties",
4943
+ "contains",
4944
+ "else",
4945
+ "if",
4946
+ "items",
4947
+ "not",
4948
+ "propertyNames",
4949
+ "then",
4950
+ "unevaluatedItems",
4951
+ "unevaluatedProperties"
4952
+ ]);
4953
+ const schemaArrayKeywords = /* @__PURE__ */ new Set([
4954
+ "allOf",
4955
+ "anyOf",
4956
+ "oneOf",
4957
+ "prefixItems"
4958
+ ]);
4959
+ function schemaTypeIncludes(schema, type) {
4960
+ return schema.type === type || Array.isArray(schema.type) && schema.type.includes(type);
4961
+ }
4962
+ function normalizeSchemaMap(value) {
4963
+ if (!isRecord(value)) return value;
4964
+ return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, normalizeJsonSchemaNode(entry)]));
4965
+ }
4966
+ function expandJsonSchemaTypeArray(schema) {
4967
+ const { type, ...rest } = schema;
4968
+ if (!Array.isArray(type)) return schema;
4969
+ return { anyOf: type.map((entry) => Object.assign({}, rest, { type: entry })) };
4970
+ }
4971
+ function normalizeJsonSchemaNode(schema) {
4972
+ if (Array.isArray(schema)) return schema.map((entry) => normalizeJsonSchemaNode(entry));
4973
+ if (!isRecord(schema)) return schema;
4974
+ const normalizedSchema = expandJsonSchemaTypeArray(schema);
4975
+ return Object.fromEntries(Object.entries(normalizedSchema).map(([key, value]) => {
4976
+ if (schemaMapKeywords.has(key)) return [key, normalizeSchemaMap(value)];
4977
+ if (schemaValueKeywords.has(key) || schemaArrayKeywords.has(key)) return [key, normalizeJsonSchemaNode(value)];
4978
+ return [key, value];
4979
+ }));
4980
+ }
4981
+ function readDefault(schema) {
4982
+ if (!isRecord(schema) || !Object.hasOwn(schema, "default")) return;
4983
+ return structuredClone(schema.default);
4984
+ }
4985
+ function decodePointerSegment(segment) {
4986
+ return segment.replace(/~1/g, "/").replace(/~0/g, "~");
4987
+ }
4988
+ function resolveLocalRef(root, ref) {
4989
+ if (ref === "#") return root;
4990
+ if (!ref.startsWith("#/")) return;
4991
+ let current = root;
4992
+ for (const segment of ref.slice(2).split("/").map(decodePointerSegment)) {
4993
+ if (!isRecord(current)) return;
4994
+ current = current[segment];
4995
+ }
4996
+ return current;
4997
+ }
4998
+ function applySchemaDefaults(schema, value, root = schema, resolvingRefs = /* @__PURE__ */ new Set()) {
4999
+ if (value === void 0) {
5000
+ const defaultValue = readDefault(schema);
5001
+ if (defaultValue !== void 0) return defaultValue;
5002
+ }
5003
+ if (!isRecord(schema)) return value;
5004
+ let nextValue = value;
5005
+ if (typeof schema.$ref === "string" && !resolvingRefs.has(schema.$ref)) {
5006
+ const target = resolveLocalRef(root, schema.$ref);
5007
+ if (target !== void 0) {
5008
+ resolvingRefs.add(schema.$ref);
5009
+ nextValue = applySchemaDefaults(target, nextValue, root, resolvingRefs);
5010
+ resolvingRefs.delete(schema.$ref);
5011
+ }
5012
+ }
5013
+ for (const key of ["allOf"]) {
5014
+ const branches = schema[key];
5015
+ if (Array.isArray(branches)) for (const branch of branches) nextValue = applySchemaDefaults(branch, nextValue, root, resolvingRefs);
5016
+ }
5017
+ if (schemaTypeIncludes(schema, "object") && isRecord(nextValue) && isRecord(schema.properties)) {
5018
+ for (const [key, propertySchema] of Object.entries(schema.properties)) {
5019
+ const currentValue = nextValue[key];
5020
+ const defaultedValue = applySchemaDefaults(propertySchema, currentValue, root, resolvingRefs);
5021
+ if (defaultedValue !== void 0 && defaultedValue !== currentValue) nextValue[key] = defaultedValue;
5022
+ }
5023
+ if (isRecord(schema.additionalProperties)) for (const key of Object.keys(nextValue)) {
5024
+ if (Object.hasOwn(schema.properties, key)) continue;
5025
+ nextValue[key] = applySchemaDefaults(schema.additionalProperties, nextValue[key], root, resolvingRefs);
5026
+ }
5027
+ }
5028
+ if (schemaTypeIncludes(schema, "array") && Array.isArray(nextValue) && isRecord(schema.items)) return nextValue.map((entry) => applySchemaDefaults(schema.items, entry, root, resolvingRefs));
5029
+ return nextValue;
5030
+ }
5031
+ function normalizeWithDefaults(schema, value) {
5032
+ if (value === void 0 || value === null) return value;
5033
+ return applySchemaDefaults(schema, structuredClone(value));
5034
+ }
5035
+ const validateDynamicToolCallParams = compileCodexSchema(dynamicToolCallParamsSchema);
5036
+ const validateErrorNotification = compileCodexSchema(errorNotificationSchema);
5037
+ const validateModelListResponse = compileCodexSchema(modelListResponseSchema);
5038
+ const validateThreadResumeResponse = compileCodexSchema(threadResumeResponseSchema);
5039
+ const validateThreadStartResponse = compileCodexSchema(threadStartResponseSchema);
5040
+ const validateTurnCompletedNotification = compileCodexSchema(turnCompletedNotificationSchema);
5041
+ const validateTurnStartResponse = compileCodexSchema(turnStartResponseSchema);
5042
+ /** Asserts and normalizes a Codex thread/start response. */
5043
+ function assertCodexThreadStartResponse(value) {
5044
+ const normalized = normalizeWithDefaults(threadStartResponseSchema, value);
5045
+ return assertCodexShape(validateThreadStartResponse, normalized, "thread/start response");
5046
+ }
5047
+ /** Asserts and normalizes a Codex thread/fork response. */
5048
+ function assertCodexThreadForkResponse(value) {
5049
+ const normalized = normalizeWithDefaults(threadStartResponseSchema, value);
5050
+ return assertCodexShape(validateThreadStartResponse, normalized, "thread/fork response");
5051
+ }
5052
+ /** Asserts the experimental beforeTurnId request field before it crosses the app-server boundary. */
5053
+ function assertCodexThreadForkParams(value) {
5054
+ if (!isRecord(value) || typeof value.threadId !== "string" || !value.threadId.trim() || value.beforeTurnId !== void 0 && value.beforeTurnId !== null && typeof value.beforeTurnId !== "string") throw new Error("Invalid Codex app-server thread/fork params");
5055
+ return value;
5056
+ }
5057
+ /** Asserts and normalizes a Codex thread/resume response. */
5058
+ function assertCodexThreadResumeResponse(value) {
5059
+ const normalized = normalizeWithDefaults(threadResumeResponseSchema, value);
5060
+ return assertCodexShape(validateThreadResumeResponse, normalized, "thread/resume response");
5061
+ }
5062
+ var CodexThreadDirectInputError = class extends Error {
5063
+ constructor(threadId) {
5064
+ super(`Codex thread ${threadId} is controlled by its parent and cannot accept direct input. Continue its parent thread, or use /new for a separate OpenClaw session.`);
5065
+ this.name = "CodexThreadDirectInputError";
5066
+ }
5067
+ };
5068
+ /** Native V2 children allow observation, but only their parent may supply turn input. */
5069
+ function assertCodexThreadAcceptsDirectInput(thread) {
5070
+ if (thread.canAcceptDirectInput === false) throw new CodexThreadDirectInputError(thread.id);
5071
+ }
5072
+ /** Asserts and normalizes a Codex turn/start response. */
5073
+ function assertCodexTurnStartResponse(value) {
5074
+ const normalized = normalizeWithDefaults(turnStartResponseSchema, normalizeTurnStartResponse(value));
5075
+ return assertCodexShape(validateTurnStartResponse, normalized, "turn/start response");
5076
+ }
5077
+ /** Reads Codex dynamic-tool call params, returning undefined for invalid payloads. */
5078
+ function readCodexDynamicToolCallParams(value) {
5079
+ return readCodexShape(validateDynamicToolCallParams, normalizeWithDefaults(dynamicToolCallParamsSchema, value));
5080
+ }
5081
+ /** Reads a Codex error notification payload if it matches the protocol schema. */
5082
+ function readCodexErrorNotification(value) {
5083
+ return readCodexShape(validateErrorNotification, normalizeWithDefaults(errorNotificationSchema, value));
5084
+ }
5085
+ /** Asserts and normalizes a Codex model/list response. */
5086
+ function assertCodexModelListResponse(value) {
5087
+ return assertCodexShape(validateModelListResponse, normalizeWithDefaults(modelListResponseSchema, value), "model/list response");
5088
+ }
5089
+ /** Reads and normalizes a Codex turn object. */
5090
+ function readCodexTurn(value) {
5091
+ return readCodexShape(validateTurnStartResponse, normalizeWithDefaults(turnStartResponseSchema, { turn: normalizeTurn(value) }))?.turn;
5092
+ }
5093
+ /** Reads a Codex turn/completed notification payload if it matches the protocol schema. */
5094
+ function readCodexTurnCompletedNotification(value) {
5095
+ return readCodexShape(validateTurnCompletedNotification, normalizeWithDefaults(turnCompletedNotificationSchema, normalizeTurnCompletedNotification(value)));
5096
+ }
5097
+ function assertCodexShape(validate, value, label) {
5098
+ if (validate.check(value)) return value;
5099
+ throw new Error(`Invalid Codex app-server ${label}: ${formatValidationErrors(validate, value)}`);
5100
+ }
5101
+ function readCodexShape(validate, value) {
5102
+ return validate.check(value) ? value : void 0;
5103
+ }
5104
+ function normalizeTurn(value) {
5105
+ if (!value || typeof value !== "object" || Array.isArray(value)) return value;
5106
+ return {
5107
+ error: null,
5108
+ startedAt: null,
5109
+ completedAt: null,
5110
+ durationMs: null,
5111
+ ...value,
5112
+ items: Array.isArray(value.items) ? value.items.map(normalizeThreadItem) : []
5113
+ };
5114
+ }
5115
+ function normalizeThreadItem(value) {
5116
+ if (!value || typeof value !== "object" || Array.isArray(value)) return value;
5117
+ switch (value.type) {
5118
+ case "agentMessage": return {
5119
+ phase: null,
5120
+ delivery: null,
5121
+ memoryCitation: null,
5122
+ ...value
5123
+ };
5124
+ case "plan": return {
5125
+ text: "",
5126
+ ...value
5127
+ };
5128
+ case "reasoning": return {
5129
+ summary: [],
5130
+ content: [],
5131
+ ...value
5132
+ };
5133
+ case "dynamicToolCall": return {
5134
+ namespace: null,
5135
+ arguments: null,
5136
+ status: "completed",
5137
+ contentItems: null,
5138
+ success: null,
5139
+ durationMs: null,
5140
+ ...value
5141
+ };
5142
+ default: return value;
5143
+ }
5144
+ }
5145
+ function normalizeTurnStartResponse(value) {
5146
+ if (!value || typeof value !== "object" || Array.isArray(value) || !("turn" in value)) return value;
5147
+ return {
5148
+ ...value,
5149
+ turn: normalizeTurn(value.turn)
5150
+ };
5151
+ }
5152
+ function normalizeTurnCompletedNotification(value) {
5153
+ if (!value || typeof value !== "object" || Array.isArray(value) || !("turn" in value)) return value;
5154
+ return {
5155
+ ...value,
5156
+ turn: normalizeTurn(value.turn)
5157
+ };
5158
+ }
5159
+ function formatValidationErrors(validate, value) {
5160
+ const errors = validate.errors(value);
5161
+ if (!errors || errors.length === 0) return "schema validation failed";
5162
+ return errors.map((error) => {
5163
+ const message = error.message?.trim() || "schema validation failed";
5164
+ return error.instancePath ? `${error.instancePath} ${message}` : message;
5165
+ }).join("; ");
5166
+ }
5167
+ //#endregion
2488
5168
  //#region extensions/codex/src/app-server/rpc-error.ts
2489
5169
  /** RPC error wrapper that preserves app-server error code and data. */
2490
5170
  var CodexAppServerRpcError = class extends Error {
@@ -3338,7 +6018,7 @@ function assertSupportedCodexAppServerVersion(response) {
3338
6018
  if (!detectedVersion) throw new CodexAppServerVersionError(detectedVersion);
3339
6019
  const detected = parse(detectedVersion);
3340
6020
  if (!detected || detected.compare("0.149.0") < 0) throw new CodexAppServerVersionError(detectedVersion);
3341
- if (detected.compare("0.151.0") > 0) embeddedAgentLog.warn("codex app-server is newer than OpenClaw's managed runtime; continuing with normal startup validation", {
6021
+ if (detected.compare("0.152.1") > 0) embeddedAgentLog.warn("codex app-server is newer than OpenClaw's managed runtime; continuing with normal startup validation", {
3342
6022
  detectedVersion,
3343
6023
  validatedVersion: CODEX_APP_SERVER_VERSION
3344
6024
  });
@@ -3415,16 +6095,7 @@ function formatExitValue(value) {
3415
6095
  */
3416
6096
  /** Minimum startup timeout accepted by the Codex app-server harness. */
3417
6097
  const CODEX_APP_SERVER_STARTUP_TIMEOUT_FLOOR_MS = 100;
3418
- /** Default idle timeout while waiting for app-server turn completion. */
3419
- const CODEX_TURN_COMPLETION_IDLE_TIMEOUT_MS = 6e4;
3420
- /** Short guard after apparent assistant completion. */
3421
- const CODEX_TURN_ASSISTANT_COMPLETION_IDLE_TIMEOUT_MS = 1e4;
3422
- const CODEX_POST_TOOL_RAW_ASSISTANT_COMPLETION_IDLE_TIMEOUT_MS = 3e5;
3423
- /** Guard after reasoning/commentary progress when no tool handoff occurred. */
3424
- const CODEX_POST_REASONING_REPLY_IDLE_TIMEOUT_MS = 3e5;
3425
- /** Long terminal idle watch for app-server turns that never send completion. */
3426
- const CODEX_TURN_TERMINAL_IDLE_TIMEOUT_MS = 18e5;
3427
- const TURN_TERMINAL_SETTLEMENT_IDLE_TIMEOUT_MS = 12e4;
6098
+ const TURN_TERMINAL_SETTLEMENT_TIMEOUT_MS = 12e4;
3428
6099
  const TURN_FINALIZE_DRAIN_ABORT_GRACE_MS = 5e3;
3429
6100
  var CodexAppServerStartupError = class extends Error {
3430
6101
  constructor(reason, message = reason === "timed_out" ? "codex app-server startup timed out" : "codex app-server startup aborted") {
@@ -3485,23 +6156,6 @@ function resolveCodexStartupTimeoutMs(params) {
3485
6156
  const timeoutMs = resolvePositiveIntegerTimeoutMs(params.timeoutMs, timeoutFloorMs);
3486
6157
  return Math.max(timeoutFloorMs, timeoutMs);
3487
6158
  }
3488
- /** Resolves the completion-idle timeout for an active turn. */
3489
- function resolveCodexTurnCompletionIdleTimeoutMs(value) {
3490
- return resolvePositiveIntegerTimeoutMs(value, CODEX_TURN_COMPLETION_IDLE_TIMEOUT_MS);
3491
- }
3492
- /** Resolves the short assistant-completion release timeout. */
3493
- function resolveCodexTurnAssistantCompletionIdleTimeoutMs(value) {
3494
- return resolvePositiveIntegerTimeoutMs(value, CODEX_TURN_ASSISTANT_COMPLETION_IDLE_TIMEOUT_MS);
3495
- }
3496
- /** Resolves the conservative post-tool raw assistant guard timeout. */
3497
- function resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs(value, fallbackMs) {
3498
- return resolvePositiveIntegerTimeoutMs(value, Math.max(resolvePositiveIntegerTimeoutMs(void 0, fallbackMs), CODEX_POST_TOOL_RAW_ASSISTANT_COMPLETION_IDLE_TIMEOUT_MS));
3499
- }
3500
- /** Resolves the long terminal turn idle timeout. */
3501
- function resolveCodexTurnTerminalIdleTimeoutMs(value, runTimeoutOverrideMs) {
3502
- const explicitRunBudgetMs = resolvePositiveIntegerTimeoutMs(runTimeoutOverrideMs, CODEX_TURN_TERMINAL_IDLE_TIMEOUT_MS);
3503
- return resolvePositiveIntegerTimeoutMs(value, Math.max(CODEX_TURN_TERMINAL_IDLE_TIMEOUT_MS, explicitRunBudgetMs));
3504
- }
3505
6159
  /** Adds gateway grace time to a caller timeout without overflowing invalid values. */
3506
6160
  function resolveCodexGatewayTimeoutWithGraceMs(timeoutMs, graceMs = 1e4) {
3507
6161
  const timeout = resolvePositiveIntegerTimeoutMs(timeoutMs, 1);
@@ -3591,8 +6245,8 @@ async function statFingerprint(filePath) {
3591
6245
  }
3592
6246
  }
3593
6247
  async function readFileFingerprint(filePath, expected, followsSymlink) {
3594
- const noFollow = followsSymlink ? 0 : constants.O_NOFOLLOW ?? 0;
3595
- const handle = await fs.open(filePath, constants.O_RDONLY | noFollow);
6248
+ const noFollow = followsSymlink ? 0 : constants$1.O_NOFOLLOW ?? 0;
6249
+ const handle = await fs.open(filePath, constants$1.O_RDONLY | noFollow);
3596
6250
  try {
3597
6251
  const before = await handle.stat({ bigint: true });
3598
6252
  if (!sameStat(before, expected)) throw new Error(`Codex desktop artifact changed while fingerprinting: ${filePath}`);
@@ -3902,15 +6556,9 @@ var CodexThreadBindingConflictError = class extends Error {
3902
6556
  this.name = "CodexThreadBindingConflictError";
3903
6557
  }
3904
6558
  };
3905
- var CodexRestrictedToolSurfaceAttestationError = class extends Error {
3906
- constructor(cause) {
3907
- super("Codex restricted-tool-surface MCP attestation failed", { cause });
3908
- this.name = "CodexRestrictedToolSurfaceAttestationError";
3909
- }
3910
- };
3911
- var CodexAdoptedThreadActiveError = class extends Error {
3912
- constructor() {
3913
- super("Codex session became active in another runner; wait for it to finish before continuing");
6559
+ var CodexAdoptedThreadActiveError = class extends AgentHarnessPreflightError {
6560
+ constructor(message = "Codex session became active in another runner; wait for it to finish before continuing") {
6561
+ super(message);
3914
6562
  this.name = "CodexAdoptedThreadActiveError";
3915
6563
  }
3916
6564
  };
@@ -3922,7 +6570,7 @@ var CodexAdoptedThreadActiveError = class extends Error {
3922
6570
  */
3923
6571
  var shared_client_exports = /* @__PURE__ */ __exportAll({
3924
6572
  assertCodexAppServerClientStartSelectionCurrent: () => assertCodexAppServerClientStartSelectionCurrent,
3925
- captureExclusiveSharedCodexAppServerClient: () => captureExclusiveSharedCodexAppServerClient,
6573
+ captureCodexAppServerClientLifetime: () => captureCodexAppServerClientLifetime,
3926
6574
  captureSharedCodexAppServerCatalogLifetime: () => captureSharedCodexAppServerCatalogLifetime,
3927
6575
  clearSharedCodexAppServerClientAndWait: () => clearSharedCodexAppServerClientAndWait,
3928
6576
  clearSharedCodexAppServerClientIfCurrent: () => clearSharedCodexAppServerClientIfCurrent,
@@ -4446,11 +7094,10 @@ async function startInitializedCodexAppServerClient(params) {
4446
7094
  } finally {
4447
7095
  artifactDrain?.cancel();
4448
7096
  }
4449
- const runtimeArtifactModule = params.runtimeArtifactMode ? await import("./runtime-artifact-D9pYp4zL.js") : void 0;
4450
- const nativeCommandBeforeStart = startOptions.commandSource === "resolved-managed" ? resolveManagedCodexNativeCommand(startOptions.command) : void 0;
7097
+ const runtimeArtifactModule = params.runtimeArtifactMode ? await import("./runtime-artifact-C3jVimFn.js") : void 0;
4451
7098
  const runtimeArtifactBeforeStart = runtimeArtifactModule ? await runtimeArtifactModule.captureCodexAppServerRuntimeArtifactBeforeStart({
4452
7099
  startOptions,
4453
- spawnIdentity: resolveCodexAppServerSpawnIdentity(startOptions, nativeCommandBeforeStart),
7100
+ spawnIdentity: resolveCodexAppServerSpawnIdentity(startOptions),
4454
7101
  signal: params.runtimeArtifactSignal
4455
7102
  }) : void 0;
4456
7103
  if (runtimeArtifactModule && runtimeArtifactBeforeStart && params.expectedRuntimeArtifact && !runtimeArtifactModule.validateCodexAppServerRuntimeArtifactCapture(params.expectedRuntimeArtifact, runtimeArtifactBeforeStart)) {
@@ -4497,11 +7144,10 @@ async function startInitializedCodexAppServerClient(params) {
4497
7144
  let runtimeArtifact;
4498
7145
  try {
4499
7146
  if (runtimeArtifactModule && runtimeArtifactBeforeStart) {
4500
- const nativeCommand = startOptions.commandSource === "resolved-managed" ? resolveManagedCodexNativeCommand(startOptions.command) : void 0;
4501
7147
  runtimeArtifact = await runtimeArtifactModule.finalizeCodexAppServerRuntimeArtifact({
4502
7148
  before: runtimeArtifactBeforeStart,
4503
7149
  startOptions,
4504
- spawnIdentity: resolveCodexAppServerSpawnIdentity(startOptions, nativeCommand),
7150
+ spawnIdentity: resolveCodexAppServerSpawnIdentity(startOptions),
4505
7151
  runtimeIdentity: client.getRuntimeIdentity(),
4506
7152
  signal: params.runtimeArtifactSignal
4507
7153
  });
@@ -4586,12 +7232,17 @@ function clearSharedCodexAppServerClientIfCurrent(client) {
4586
7232
  }
4587
7233
  /** Captures a revocable observation of the exact shared client and native account/config. */
4588
7234
  function captureSharedCodexAppServerCatalogLifetime(client) {
7235
+ const isCurrent = captureSharedClientRegistration(client);
7236
+ const revision = client.getModelCatalogRevision();
7237
+ return () => isCurrent() && client.getModelCatalogRevision() === revision;
7238
+ }
7239
+ /** Registration ends on retirement even when sibling leases keep the process alive. */
7240
+ function captureSharedClientRegistration(client) {
4589
7241
  const state = getSharedCodexAppServerClientState();
4590
7242
  const entry = state.entriesByClient.get(client);
4591
7243
  const key = [...state.clients].find(([, candidate]) => candidate === entry)?.[0];
4592
7244
  const generation = readCodexAppServerClientDesktopGeneration(client);
4593
- const revision = client.getModelCatalogRevision();
4594
- return () => key !== void 0 && state.clients.get(key) === entry && entry?.client === client && !entry.closeWhenIdle && !entry.closeError && !client.getCloseError() && client.getModelCatalogRevision() === revision && (!generation || isCodexDesktopGenerationCurrent(generation));
7245
+ return () => key !== void 0 && state.clients.get(key) === entry && entry?.client === client && !entry.closeWhenIdle && !entry.closeError && !client.getCloseError() && (!generation || isCodexDesktopGenerationCurrent(generation));
4595
7246
  }
4596
7247
  /** Retains the matching shared client and returns a release callback. */
4597
7248
  function retainSharedCodexAppServerClientIfCurrent(client) {
@@ -4612,19 +7263,18 @@ function retainSharedCodexAppServerClientByInstanceId(clientId) {
4612
7263
  };
4613
7264
  }
4614
7265
  }
4615
- /** Captures sole physical-client ownership across awaited configuration adoption. */
4616
- function captureExclusiveSharedCodexAppServerClient(client) {
7266
+ /** Captures physical ownership, independently of unrelated thread and reader leases. */
7267
+ function captureCodexAppServerClientLifetime(client, requiredOwnership) {
4617
7268
  const state = getSharedCodexAppServerClientState();
4618
- for (const [key, entry] of state.clients) {
4619
- if (entry.client !== client) continue;
4620
- const generation = entry.leaseGeneration;
4621
- const assertExclusive = () => {
4622
- if (state.clients.get(key) !== entry || entry.client !== client || entry.closeWhenIdle || entry.closeError || entry.activeLeases !== 1 || entry.pendingAcquires !== 0 || entry.leaseGeneration !== generation) throw new CodexAdoptedThreadActiveError();
4623
- };
4624
- assertExclusive();
4625
- return assertExclusive;
4626
- }
4627
- throw new CodexAdoptedThreadActiveError();
7269
+ const start = getCodexAppServerClientStartMetadata().get(client)?.startOptions;
7270
+ if (requiredOwnership === "native-process" && (start?.transport !== "stdio" || isCodexAppServerProxyLaunch(start.args))) throw new AgentHarnessPreflightError("Codex ordinary configuration refresh requires an OpenClaw-managed local stdio process, not an external socket or app-server proxy. No turn was sent; reconnect through managed local stdio before continuing.");
7271
+ const isCurrent = requiredOwnership === "native-process" && state.isolatedClients.has(client) ? () => state.isolatedClients.has(client) && !client.getCloseError() : captureSharedClientRegistration(client);
7272
+ const assertCurrent = () => {
7273
+ if (!isCurrent()) throw new CodexAdoptedThreadActiveError("Codex app-server connection changed during thread preparation; reconnect before continuing");
7274
+ assertCodexAppServerClientStartSelectionCurrent({ client });
7275
+ };
7276
+ assertCurrent();
7277
+ return assertCurrent;
4628
7278
  }
4629
7279
  /**
4630
7280
  * Retires a matching shared client. Default is graceful: detach from the map
@@ -4750,7 +7400,6 @@ function getOrCreateSharedClientEntry(state, key) {
4750
7400
  entry = {
4751
7401
  activeLeases: 0,
4752
7402
  pendingAcquires: 0,
4753
- leaseGeneration: 0,
4754
7403
  closeWhenIdle: false,
4755
7404
  onStartedClientCallbacks: /* @__PURE__ */ new Set()
4756
7405
  };
@@ -4786,7 +7435,6 @@ function clearSharedCodexAppServerClientIfCurrentAndUnclaimed(client) {
4786
7435
  }
4787
7436
  function retainPendingSharedClientAcquire(entry) {
4788
7437
  let released = false;
4789
- entry.leaseGeneration += 1;
4790
7438
  entry.pendingAcquires += 1;
4791
7439
  return () => {
4792
7440
  if (released) return;
@@ -4798,7 +7446,6 @@ function retainPendingSharedClientAcquire(entry) {
4798
7446
  }
4799
7447
  function retainSharedClientEntry(entry) {
4800
7448
  let released = false;
4801
- entry.leaseGeneration += 1;
4802
7449
  entry.activeLeases += 1;
4803
7450
  return () => {
4804
7451
  if (released) return;
@@ -4844,4 +7491,4 @@ function collectSharedClients(state) {
4844
7491
  return [...state.liveClients];
4845
7492
  }
4846
7493
  //#endregion
4847
- export { CodexAppServerRpcError as $, CODEX_POST_REASONING_REPLY_IDLE_TIMEOUT_MS as A, reconcileCodexComputerUseStartArtifacts as At, resolveCodexTurnTerminalIdleTimeoutMs as B, CODEX_OPENCLAW_DIRECT_DYNAMIC_TOOL_NAMESPACE as Bt, withLeasedCodexAppServerClientStartSelectionRetry as C, retainCodexAppServerLiveThread as Ct, CodexThreadStartRequestError as D, readCodexRateLimitsRevision as Dt, CodexThreadBindingConflictError as E, withTimeout$1 as Et, resolveCodexGatewayTimeoutWithGraceMs as F, resolveCodexAppServerFallbackApiKeyCacheKey as Ft, isCodexAppServerConnectionClosedError as G, getCodexAppServerClientInstanceId as H, isJsonObject as Ht, resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs as I, resolveCodexAppServerPreparedApiKeyCacheKey as It, isCodexAppServerOverloadError as J, isCodexAppServerIndeterminateRequestCancellationError as K, resolveCodexStartupTimeoutMs as L, resolveCodexAppServerPreparedAuthHandoff as Lt, TURN_FINALIZE_DRAIN_ABORT_GRACE_MS as M, resolveCodexAppServerAuthProfileId as Mt, TURN_TERMINAL_SETTLEMENT_IDLE_TIMEOUT_MS as N, resolveCodexAppServerAuthProfileIdForAgent as Nt, acquireCodexNativeConfigFence as O, readRecentCodexRateLimits as Ot, isCodexAppServerStartupError as P, resolveCodexAppServerAuthProfileStore as Pt, resolveCodexAppServerClientInstanceId as Q, resolveCodexTurnAssistantCompletionIdleTimeoutMs as R, CODEX_INTERACTIVE_CUSTOM_THREAD_SOURCES as Rt, waitForCodexAppServerClientDesktopGenerationDrain as S, releaseCodexAppServerLiveThread as St, CodexRestrictedToolSurfaceAttestationError as T, withAbortableTimeout as Tt, isCodexAppServerApprovalRequest as U, resolveCodexManagedBundledMarketplacePath as Ut, withCodexStartupTimeout as V, flattenCodexDynamicToolFunctions as Vt, isCodexAppServerBrokenPipeError as W, assertNotSymlink as Wt, isCodexAppServerRequestTimeoutError as X, isCodexAppServerPrewriteRequestCancellationError as Y, isUnsupportedCodexAppServerVersionError as Z, retainSharedCodexAppServerClientByInstanceId as _, ensureCodexAppServerClientRuntime as _t, clearSharedCodexAppServerClientIfCurrentAndUnclaimed as a, resolveDynamicToolCallTimeoutMs as at, retireSharedCodexAppServerClientsBeforeDesktopGeneration as b, isCodexAppServerLiveThreadClaimed as bt, getLeasedSharedCodexAppServerClient as c, shouldReleaseTurnAfterTerminalDynamicTool as ct, readCodexAppServerClientDesktopGeneration as d, resolveCodexToolAbortTerminalReason as dt, createCodexElicitationResponse as et, readCodexAppServerClientDesktopGenerationFingerprint as f, createFailedDynamicToolResponse as ft, resolveCodexNativeConfigFenceKey as g, consumeCodexAppServerLiveThread as gt, releaseLeasedSharedCodexAppServerClient as h, claimCodexAppServerLiveThread as ht, clearSharedCodexAppServerClientIfCurrent as i, isMatchingDynamicToolTerminalDiagnostic as it, CodexAppServerStartupError as j, resolveCodexAppServerAuthAccountCacheKey as jt, createCodexDesktopGenerationService as k, rememberCodexRateLimitsRead as kt, getSharedCodexAppServerClient as l, toCodexDynamicToolProgressResponse as lt, releaseCodexAppServerClientLease as m, withDynamicToolTranscriptDetails as mt, captureExclusiveSharedCodexAppServerClient as n, hasPendingDynamicToolTerminalDiagnostic as nt, clearSharedCodexAppServerClientIfCurrentAndWait as o, resolveTerminalDynamicToolBatchAction as ot, readCodexAppServerClientProcessIdentity as p, withDynamicToolExecutionState as pt, isCodexAppServerIndeterminateTransportError as q, captureSharedCodexAppServerCatalogLifetime as r, isDynamicToolTerminalDiagnosticEvent as rt, createIsolatedCodexAppServerClient as s, shouldBlockTerminalReleaseForNonTerminalDynamicToolResult as st, assertCodexAppServerClientStartSelectionCurrent as t, handleDynamicToolCallWithTimeout as tt, isCodexAppServerStartSelectionChangedError as u, toCodexDynamicToolProtocolResponse as ut, retainSharedCodexAppServerClientIfCurrent as v, hasCodexAppServerLiveThread as vt, CodexAdoptedThreadActiveError as w, unsubscribeCodexAppServerLiveThread as wt, shared_client_exports as x, protectCodexAppServerLiveThread as xt, retireSharedCodexAppServerClientIfCurrent as y, isCodexAppServerClientRuntimeLive as yt, resolveCodexTurnCompletionIdleTimeoutMs as z, CODEX_INTERACTIVE_THREAD_SOURCE_KINDS as zt };
7494
+ export { assertCodexThreadResumeResponse as $, isJsonObject as $t, TURN_FINALIZE_DRAIN_ABORT_GRACE_MS as A, retainCodexAppServerLiveThread as At, isCodexAppServerIndeterminateRequestCancellationError as B, resolveCodexAppServerAuthProfileIdForAgent as Bt, withLeasedCodexAppServerClientStartSelectionRetry as C, ensureCodexAppServerClientRuntime as Ct, acquireCodexNativeConfigFence as D, protectCodexAppServerLiveThread as Dt, CodexThreadStartRequestError as E, isCodexAppServerLiveThreadClaimed as Et, withCodexStartupTimeout as F, readRecentCodexRateLimits as Ft, isUnsupportedCodexAppServerVersionError as G, resolveCodexManagedBundledMarketplacePath as Gt, isCodexAppServerOverloadError as H, resolveCodexAppServerFallbackApiKeyCacheKey as Ht, getCodexAppServerClientInstanceId as I, rememberCodexRateLimitsRead as It, CodexThreadDirectInputError as J, readCodexSessionMeta as Jt, resolveCodexAppServerClientInstanceId as K, assertNotSymlink as Kt, isCodexAppServerApprovalRequest as L, reconcileCodexComputerUseStartArtifacts as Lt, isCodexAppServerStartupError as M, withAbortableTimeout as Mt, resolveCodexGatewayTimeoutWithGraceMs as N, withTimeout$1 as Nt, createCodexDesktopGenerationService as O, readCodexClientSessionMeta as Ot, resolveCodexStartupTimeoutMs as P, readCodexRateLimitsRevision as Pt, assertCodexThreadForkResponse as Q, flattenCodexDynamicToolFunctions as Qt, isCodexAppServerBrokenPipeError as R, resolveCodexAppServerAuthAccountCacheKey as Rt, waitForCodexAppServerClientDesktopGenerationDrain as S, consumeCodexAppServerLiveThread as St, CodexThreadBindingConflictError as T, isCodexAppServerClientRuntimeLive as Tt, isCodexAppServerPrewriteRequestCancellationError as U, resolveCodexAppServerPreparedApiKeyCacheKey as Ut, isCodexAppServerIndeterminateTransportError as V, resolveCodexAppServerAuthProfileStore as Vt, isCodexAppServerRequestTimeoutError as W, resolveCodexAppServerPreparedAuthHandoff as Wt, assertCodexThreadAcceptsDirectInput as X, CODEX_INTERACTIVE_THREAD_SOURCE_KINDS as Xt, assertCodexModelListResponse as Y, CODEX_INTERACTIVE_CUSTOM_THREAD_SOURCES as Yt, assertCodexThreadForkParams as Z, CODEX_OPENCLAW_DIRECT_DYNAMIC_TOOL_NAMESPACE as Zt, retainSharedCodexAppServerClientByInstanceId as _, resolveCodexToolAbortTerminalReason as _t, clearSharedCodexAppServerClientIfCurrentAndUnclaimed as a, readCodexTurnCompletedNotification as at, retireSharedCodexAppServerClientsBeforeDesktopGeneration as b, withDynamicToolTranscriptDetails as bt, getLeasedSharedCodexAppServerClient as c, hasPendingDynamicToolTerminalDiagnostic as ct, readCodexAppServerClientDesktopGeneration as d, resolveDynamicToolCallTimeoutMs as dt, assertCodexThreadStartResponse as et, readCodexAppServerClientDesktopGenerationFingerprint as f, resolveTerminalDynamicToolBatchAction as ft, resolveCodexNativeConfigFenceKey as g, toCodexDynamicToolProtocolResponse as gt, releaseLeasedSharedCodexAppServerClient as h, toCodexDynamicToolProgressResponse as ht, clearSharedCodexAppServerClientIfCurrent as i, readCodexTurn as it, TURN_TERMINAL_SETTLEMENT_TIMEOUT_MS as j, unsubscribeCodexAppServerLiveThread as jt, CodexAppServerStartupError as k, releaseCodexAppServerLiveThread as kt, getSharedCodexAppServerClient as l, isDynamicToolTerminalDiagnosticEvent as lt, releaseCodexAppServerClientLease as m, shouldReleaseTurnAfterTerminalDynamicTool as mt, captureCodexAppServerClientLifetime as n, readCodexDynamicToolCallParams as nt, clearSharedCodexAppServerClientIfCurrentAndWait as o, createCodexElicitationResponse as ot, readCodexAppServerClientProcessIdentity as p, shouldBlockTerminalReleaseForNonTerminalDynamicToolResult as pt, CodexAppServerRpcError as q, isOpenClawManagedCodexThread as qt, captureSharedCodexAppServerCatalogLifetime as r, readCodexErrorNotification as rt, createIsolatedCodexAppServerClient as s, handleDynamicToolCallWithTimeout as st, assertCodexAppServerClientStartSelectionCurrent as t, assertCodexTurnStartResponse as tt, isCodexAppServerStartSelectionChangedError as u, isMatchingDynamicToolTerminalDiagnostic as ut, retainSharedCodexAppServerClientIfCurrent as v, createFailedDynamicToolResponse as vt, CodexAdoptedThreadActiveError as w, hasCodexAppServerLiveThread as wt, shared_client_exports as x, claimCodexAppServerLiveThread as xt, retireSharedCodexAppServerClientIfCurrent as y, withDynamicToolExecutionState as yt, isCodexAppServerConnectionClosedError as z, resolveCodexAppServerAuthProfileId as zt };