@openclaw/codex 2026.8.1-beta.2 → 2026.8.1-beta.3

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 (59) hide show
  1. package/dist/api.js +147 -0
  2. package/dist/app-server-policy-bg5QPSVP.js +25 -0
  3. package/dist/{attempt-client-cleanup-DMLXUfa8.js → attempt-client-cleanup-URjUlCHg.js} +1 -1
  4. package/dist/{binding-connection-I5Bo-AsX.js → binding-connection-DAvZwp96.js} +15 -3
  5. package/dist/{bounded-turn-qgZmzy_4.js → bounded-turn-4BjrZEwW.js} +22 -16
  6. package/dist/{capabilities-CybGI1oz.js → capabilities-CH3K57v4.js} +1 -1
  7. package/dist/cli-metadata.js +1 -1
  8. package/dist/{command-formatters-B1AEz8ZA.js → command-formatters-D0nZ3qtd.js} +2 -2
  9. package/dist/{command-handlers-Db8pu_ds.js → command-handlers-DC86lgT4.js} +39 -22
  10. package/dist/command-rpc-xUIIonsO.js +90 -0
  11. package/dist/{compact-LspQaGfl.js → compact-COqgBRny.js} +35 -29
  12. package/dist/{session-binding-DPxIvMgE.js → config-CpNeo5AE.js} +28 -888
  13. package/dist/context-compaction-activity-BOeJf7yo.js +58 -0
  14. package/dist/doctor-contract-api.js +15 -14
  15. package/dist/{dynamic-tools-BVdyWkUD.js → dynamic-tools-fJZhl4CE.js} +1284 -651
  16. package/dist/{effective-mcp-catalog-DIIhAtOZ.js → effective-mcp-catalog-4YKn51aG.js} +2 -2
  17. package/dist/elicitation-input-DMkeki8d.js +71 -0
  18. package/dist/{event-projector-usage-e5huIQWu.js → event-projector-usage-CLwNEJqW.js} +16 -16
  19. package/dist/harness-DoKQcF8n.js +258 -0
  20. package/dist/harness.js +2 -226
  21. package/dist/index.js +171 -48
  22. package/dist/{isolated-completion-C58NbL40.js → isolated-completion-DPMtlH9r.js} +3 -3
  23. package/dist/managed-binary-By4FZC6i.js +212 -0
  24. package/dist/media-understanding-provider.js +2 -2
  25. package/dist/model-catalog-CmGoqVKB.js +48 -0
  26. package/dist/{models-BFlpn1Ex.js → models-CZw1wClT.js} +2 -2
  27. package/dist/{native-subagent-monitor-DyTGmTUx.js → native-subagent-monitor-GGq3RnOo.js} +185 -71
  28. package/dist/node-exec-server.runtime-Bsu1LdFZ.js +192 -0
  29. package/dist/{plugin-app-cache-key-C3H2CVp6.js → plugin-app-cache-key-DMNQ8Zi8.js} +15 -3
  30. package/dist/plugin-approval-roundtrip-C75Yiiwc.js +95 -0
  31. package/dist/{plugin-marketplace-discovery-CzrGJdCR.js → plugin-marketplace-discovery-CSWDkMrP.js} +40 -26
  32. package/dist/{plugin-metadata-cache-CNJPj4_b.js → plugin-metadata-cache-BXH5NF-4.js} +8 -5
  33. package/dist/{protocol-validators-B4F7L8Rf.js → protocol-validators-VAVyEnDp.js} +55 -2
  34. package/dist/{rate-limits-DZXmOL8-.js → rate-limits-BI1dMHDG.js} +1 -1
  35. package/dist/{request-BRl5_UfX.js → request-DSK0W6YI.js} +2 -2
  36. package/dist/{run-attempt-P8BdxC1I.js → run-attempt-BV3HzuCf.js} +1098 -666
  37. package/dist/{runtime-artifact-BVSPdd6g.js → runtime-artifact-BvyT1uyd.js} +4 -7
  38. package/dist/{sandbox-guard-Cmwc9eIk.js → sandbox-guard-C1qEeZ5C.js} +25 -19
  39. package/dist/session-binding-BTrLf9Qm.js +874 -0
  40. package/dist/{session-catalog-xwNi_SDM.js → session-catalog-ezP_UcRM.js} +1541 -1296
  41. package/dist/session-catalog-home-id-BNwAJ9D7.js +18 -0
  42. package/dist/{session-cli-7hgXZDV7.js → session-cli-B1hKvfkI.js} +20 -7
  43. package/dist/{session-retirement-DoMMJFKm.js → session-retirement-CE4iMiLh.js} +3 -3
  44. package/dist/{session-upstream-marker-CrIFX06J.js → session-upstream-marker-D_2npHlA.js} +1 -1
  45. package/dist/{settled-turn-finalizer-BRWBO4MO.js → settled-turn-finalizer-Dx1onIqg.js} +23 -19
  46. package/dist/{shared-client-kIBbGjk4.js → shared-client-Dw-rzii0.js} +755 -273
  47. package/dist/{side-question-9HAL26l9.js → side-question-DbXkJZzg.js} +52 -30
  48. package/dist/{thread-lifecycle-Bu1BTDXr.js → thread-lifecycle-DKdrnTMX.js} +310 -92
  49. package/dist/{thread-ownership-6kOQHlyC.js → thread-ownership-i2NBwDUL.js} +2 -2
  50. package/dist/{thread-resume-CPrJNQVM.js → thread-resume-CdJk2Ehf.js} +3 -3
  51. package/dist/{transcript-mirror-B9gGgnJS.js → transcript-mirror-BU0_LKAL.js} +46 -28
  52. package/dist/{transport-stdio-DIImwDVS.js → transport-stdio-DhoGy33Z.js} +2 -2
  53. package/dist/{upstream-prompt-provenance-ClRBije0.js → upstream-prompt-provenance-CFmsKwr9.js} +12 -14
  54. package/dist/{upstream-session-fork-CE-_LdnP.js → upstream-session-fork-BDVJCLAD.js} +12 -6
  55. package/dist/{usage-CHlV0e-o.js → usage-9dKJCgcy.js} +3 -3
  56. package/dist/{web-search-provider.runtime-DRw2Vl42.js → web-search-provider.runtime-DCdx4DGu.js} +3 -3
  57. package/openclaw.plugin.json +31 -1
  58. package/package.json +6 -5
  59. package/dist/app-server-policy-zcBDc1JU.js +0 -49
@@ -1,24 +1,30 @@
1
- import { D as CODEX_PLUGINS_MARKETPLACE_NAME, E as resolveCodexPluginsPolicy, O as CODEX_PLUGINS_WORKSPACE_MARKETPLACE_NAME, a as hashCodexAppServerBindingFingerprint, c as reclaimCurrentCodexSessionGeneration, d as sessionBindingIdentity, i as createCodexSessionGenerationSupersededError, m as codexSandboxPolicyForTurn, n as assertCodexBindingMayBeReplaced, o as isCodexAppServerNativeAuthProfile, s as normalizeCodexAppServerBindingModelProvider } from "./session-binding-DPxIvMgE.js";
2
- import { M as isCodexAppServerConnectionClosedError, R as resolveCodexAppServerClientInstanceId, V as consumeCodexAppServerLiveThread, ct as isJsonObject, d as retainSharedCodexAppServerClientByInstanceId, k as getCodexAppServerClientInstanceId, s as isCodexAppServerStartSelectionChangedError, st as flattenCodexDynamicToolFunctions, z as CodexAppServerRpcError } from "./shared-client-kIBbGjk4.js";
3
- import { a as closeCodexStartupClientBestEffort, c as isCodexAppServerUnsafeSubscriptionError, d as unsubscribeCodexThreadBestEffort, n as CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-DMLXUfa8.js";
4
- import { a as assertCodexThreadStartResponse, r as assertCodexThreadForkResponse } from "./protocol-validators-B4F7L8Rf.js";
5
- import { a as serializeCodexAppInventoryError, i as defaultCodexAppInventoryCache, t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-C3H2CVp6.js";
1
+ import { _ as CODEX_PLUGINS_MARKETPLACE_NAME, g as resolveCodexPluginsPolicy, n as codexSandboxPolicyForTurn, v as CODEX_PLUGINS_WORKSPACE_MARKETPLACE_NAME } from "./config-CpNeo5AE.js";
2
+ import { B as CodexAppServerRpcError, M as isCodexAppServerConnectionClosedError, R as resolveCodexAppServerClientInstanceId, U as consumeCodexAppServerLiveThread, d as retainSharedCodexAppServerClientByInstanceId, k as getCodexAppServerClientInstanceId, lt as flattenCodexDynamicToolFunctions, pt as resolveCodexAppServerLocalHomeDir, s as isCodexAppServerStartSelectionChangedError, ut as isJsonObject } from "./shared-client-Dw-rzii0.js";
3
+ import { a as hashCodexAppServerBindingFingerprint, c as reclaimCurrentCodexSessionGeneration, d as sessionBindingIdentity, i as createCodexSessionGenerationSupersededError, n as assertCodexBindingMayBeReplaced, o as isCodexAppServerNativeAuthProfile, s as normalizeCodexAppServerBindingModelProvider } from "./session-binding-BTrLf9Qm.js";
4
+ import { a as closeCodexStartupClientBestEffort, c as isCodexAppServerUnsafeSubscriptionError, d as unsubscribeCodexThreadBestEffort, n as CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-URjUlCHg.js";
5
+ import { a as assertCodexThreadStartResponse, r as assertCodexThreadForkResponse } from "./protocol-validators-VAVyEnDp.js";
6
+ import { o as defaultCodexAppInventoryCache, s as serializeCodexAppInventoryError, t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-DMNQ8Zi8.js";
6
7
  import { t as isIncognitoSessionKey } from "./incognito-session-ET_ufDH-.js";
7
- import { t as resumeCodexAppServerThread } from "./thread-resume-CPrJNQVM.js";
8
- import { u as projectBoundedCodexThreadHistory } from "./transcript-mirror-B9gGgnJS.js";
8
+ import { n as codexCatalogHomeId } from "./session-catalog-home-id-BNwAJ9D7.js";
9
+ import { t as resumeCodexAppServerThread } from "./thread-resume-CdJk2Ehf.js";
10
+ import { u as projectBoundedCodexThreadHistory } from "./transcript-mirror-BU0_LKAL.js";
9
11
  import { r as sanitizeInlineImageDataUrl, t as invalidInlineImageText } from "./image-payload-sanitizer-CnfoUPCE.js";
10
12
  import { asOptionalRecord, isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
11
13
  import fs from "node:fs/promises";
12
14
  import path from "node:path";
13
- import { SKILL_WORKSHOP_TOOL_NAME, TRANSCRIPT_CREDENTIAL_SAFETY_PROMPT, buildSkillWorkshopPromptSection, embeddedAgentLog, formatErrorMessage, isActiveHarnessContextEngine, isHostScopedAgentToolActive } from "openclaw/plugin-sdk/agent-harness-runtime";
15
+ import { SKILL_WORKSHOP_TOOL_NAME, TRANSCRIPT_CREDENTIAL_SAFETY_PROMPT, buildDelegationGuidanceSection, buildHarnessVisibleReplyGuidance, buildSkillWorkshopPromptSection, embeddedAgentLog, formatErrorMessage, isActiveHarnessContextEngine, isHostScopedAgentToolActive, resolveMainSessionDelegationMode } from "openclaw/plugin-sdk/agent-harness-runtime";
14
16
  import * as crypto$1 from "node:crypto";
15
- import crypto from "node:crypto";
17
+ import crypto, { createHash } from "node:crypto";
16
18
  import os from "node:os";
19
+ import { resolveAgentDir as resolveAgentDir$1, resolveSessionAgentIds as resolveSessionAgentIds$1 } from "openclaw/plugin-sdk/agent-runtime";
20
+ import { z } from "zod";
17
21
  import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
18
22
  import { sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
19
23
  import { redactSensitiveFieldValue, redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
24
+ import { isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
20
25
  import { resolveRequiredHomeDir, resolveStateDir } from "openclaw/plugin-sdk/state-paths";
21
26
  import { listRegisteredPluginAgentPromptGuidance } from "openclaw/plugin-sdk/plugin-runtime";
27
+ import { buildHostnameAllowlistPolicyFromSuffixAllowlist } from "openclaw/plugin-sdk/ssrf-policy";
22
28
  import { buildCodexUserMcpServersThreadConfigPatchForRuntime } from "openclaw/plugin-sdk/codex-mcp-projection";
23
29
  import { isDiagnosticFlagEnabled } from "openclaw/plugin-sdk/diagnostic-runtime";
24
30
  import { GPT5_HEARTBEAT_PROMPT_OVERLAY } from "openclaw/plugin-sdk/provider-model-shared";
@@ -1063,6 +1069,32 @@ function resolveCodexContextEngineProjectionMaxChars(params) {
1063
1069
  function resolveCodexContextEngineProjectionReserveTokens() {
1064
1070
  return DEFAULT_CODEX_PROJECTION_RESERVE_TOKENS;
1065
1071
  }
1072
+ const CONTINUITY_PROJECTION_RESERVE_RATIO = .5;
1073
+ const CONTINUITY_EMPIRICAL_CHARS_PER_TOKEN = 3;
1074
+ const CONTINUITY_MIN_CHARS_PER_TOKEN = .5;
1075
+ const CONTINUITY_MAX_CHARS_PER_TOKEN = CONTINUITY_EMPIRICAL_CHARS_PER_TOKEN;
1076
+ const CONTINUITY_CALIBRATION_MIN_PROMPT_CHARS = 5e4;
1077
+ /** Builds a calibration sample from a completed turn, or undefined if unusable. */
1078
+ function buildCodexContinuityCalibration(params) {
1079
+ if (!Number.isFinite(params.promptChars) || !Number.isFinite(params.inputTokens) || params.promptChars < CONTINUITY_CALIBRATION_MIN_PROMPT_CHARS || params.inputTokens <= 0) return;
1080
+ return {
1081
+ promptChars: Math.floor(params.promptChars),
1082
+ inputTokens: Math.floor(params.inputTokens)
1083
+ };
1084
+ }
1085
+ function resolveContinuityCharsPerToken(calibration) {
1086
+ if (!calibration || !Number.isFinite(calibration.promptChars) || !Number.isFinite(calibration.inputTokens) || calibration.promptChars < CONTINUITY_CALIBRATION_MIN_PROMPT_CHARS || calibration.inputTokens <= 0) return CONTINUITY_EMPIRICAL_CHARS_PER_TOKEN;
1087
+ return Math.min(CONTINUITY_MAX_CHARS_PER_TOKEN, Math.max(CONTINUITY_MIN_CHARS_PER_TOKEN, calibration.promptChars / calibration.inputTokens));
1088
+ }
1089
+ /** Resolves rendered context size for no-engine continuity projections. */
1090
+ function resolveCodexContinuityProjectionMaxChars(params) {
1091
+ const contextTokenBudget = typeof params.contextTokenBudget === "number" && Number.isFinite(params.contextTokenBudget) ? Math.floor(params.contextTokenBudget) : void 0;
1092
+ if (!contextTokenBudget || contextTokenBudget <= 0) return DEFAULT_RENDERED_CONTEXT_CHARS;
1093
+ return normalizeRenderedContextMaxChars(resolveProjectionPromptBudgetTokens({
1094
+ contextTokenBudget,
1095
+ reserveTokens: Math.max(DEFAULT_CODEX_PROJECTION_RESERVE_TOKENS, Math.floor(contextTokenBudget * CONTINUITY_PROJECTION_RESERVE_RATIO))
1096
+ }) * resolveContinuityCharsPerToken(params.calibration));
1097
+ }
1066
1098
  /** Fits projected context prompts under Codex app-server turn/start text limits. */
1067
1099
  function fitCodexProjectedContextForTurnStart(params) {
1068
1100
  const maxChars = typeof params.maxChars === "number" && Number.isFinite(params.maxChars) ? Math.max(0, Math.floor(params.maxChars)) : CODEX_TURN_START_TEXT_INPUT_MAX_CHARS;
@@ -1328,7 +1360,6 @@ const CODEX_APP_SERVER_OWNED_REPLACEABLE_TOOL_EXCLUDES = /* @__PURE__ */ new Set
1328
1360
  "write",
1329
1361
  "edit",
1330
1362
  "apply_patch",
1331
- "update_plan",
1332
1363
  ...CODEX_NATIVE_GOAL_TOOL_EXCLUDES
1333
1364
  ]);
1334
1365
  const CODEX_APP_SERVER_OWNED_SHELL_TOOL_EXCLUDES = /* @__PURE__ */ new Set(["exec", "process"]);
@@ -1561,10 +1592,6 @@ const nativeSkillIsolationByClient = /* @__PURE__ */ new WeakMap();
1561
1592
  function isMissingPathError(error) {
1562
1593
  return error.code === "ENOENT";
1563
1594
  }
1564
- function isPathWithin(root, candidate) {
1565
- const relative = path.relative(path.resolve(root), path.resolve(candidate));
1566
- return relative === "" || !path.isAbsolute(relative) && !relative.startsWith(`..${path.sep}`) && relative !== "..";
1567
- }
1568
1595
  async function canonicalizeExistingPath(candidate) {
1569
1596
  try {
1570
1597
  return await fs.realpath(candidate);
@@ -1590,12 +1617,12 @@ async function collectPersonalSkillRealPaths(homes, codexHome) {
1590
1617
  const realDefaultCodexHome = await canonicalizeExistingPath(defaultCodexHome);
1591
1618
  roots.push({
1592
1619
  dir: path.join(defaultCodexHome, "skills"),
1593
- onlyEscapedStateTargets: isPathWithin(realStateDir, realDefaultCodexHome)
1620
+ onlyEscapedStateTargets: isPathInside(realStateDir, realDefaultCodexHome)
1594
1621
  });
1595
1622
  }
1596
1623
  const configuredCodexHome = codexHome?.trim() || process.env.CODEX_HOME?.trim();
1597
1624
  if (configuredCodexHome) {
1598
- const stateOwned = isPathWithin(realStateDir, await canonicalizeExistingPath(configuredCodexHome));
1625
+ const stateOwned = isPathInside(realStateDir, await canonicalizeExistingPath(configuredCodexHome));
1599
1626
  roots.push({
1600
1627
  dir: path.join(configuredCodexHome, "skills"),
1601
1628
  onlyEscapedStateTargets: stateOwned
@@ -1613,7 +1640,7 @@ async function collectPersonalSkillRealPaths(homes, codexHome) {
1613
1640
  const recordSkillFile = async (filePath, onlyEscapedStateTargets) => {
1614
1641
  try {
1615
1642
  const skillRealPath = await fs.realpath(filePath);
1616
- if (!onlyEscapedStateTargets || !isPathWithin(realStateDir, skillRealPath)) skillPaths.add(skillRealPath);
1643
+ if (!onlyEscapedStateTargets || !isPathInside(realStateDir, skillRealPath)) skillPaths.add(skillRealPath);
1617
1644
  } catch (error) {
1618
1645
  if (!isMissingPathError(error)) complete = false;
1619
1646
  }
@@ -1756,7 +1783,7 @@ function applyCodexNativeSkillIsolation(config, isolation) {
1756
1783
  //#region extensions/codex/src/app-server/thread-lifecycle-errors.ts
1757
1784
  var CodexThreadStartRequestError = class extends Error {
1758
1785
  constructor(cause) {
1759
- super(formatErrorMessage(cause), { cause });
1786
+ super(`thread/start: ${formatErrorMessage(cause)}`, { cause });
1760
1787
  this.name = "CodexThreadStartRequestError";
1761
1788
  }
1762
1789
  };
@@ -1780,6 +1807,64 @@ var CodexAdoptedThreadActiveError = class extends Error {
1780
1807
  }
1781
1808
  };
1782
1809
  //#endregion
1810
+ //#region extensions/codex/src/app-server/managed-thread-store.ts
1811
+ const CODEX_MANAGED_THREAD_NAMESPACE = "app-server-managed-threads";
1812
+ const CODEX_MANAGED_THREAD_MAX_ENTRIES = 2e4;
1813
+ const managedThreadSchema = z.object({
1814
+ version: z.literal(1),
1815
+ kind: z.literal("managed-thread"),
1816
+ sourceHomeId: z.string().min(1),
1817
+ threadId: z.string().min(1),
1818
+ rolloutPath: z.string().min(1).optional()
1819
+ });
1820
+ async function markStartedCodexManagedThread(store, params) {
1821
+ if (!store) return;
1822
+ try {
1823
+ await store.mark({
1824
+ sourceHomeId: params.sourceHomeId,
1825
+ threadId: params.threadId,
1826
+ ...params.rolloutPath ? { rolloutPath: params.rolloutPath } : {}
1827
+ });
1828
+ } catch (error) {
1829
+ embeddedAgentLog.warn("failed to record Codex managed thread ownership", { error });
1830
+ }
1831
+ }
1832
+ function managedThreadStoreKey(sourceHomeId, threadId) {
1833
+ return `sha256:${createHash("sha256").update("openclaw:codex-managed-thread:v1\0").update(sourceHomeId).update("\0").update(threadId).digest("hex")}`;
1834
+ }
1835
+ /** Durable ownership index for Codex threads created by OpenClaw. */
1836
+ function createCodexManagedThreadStore(state) {
1837
+ return {
1838
+ async mark(params) {
1839
+ try {
1840
+ const value = managedThreadSchema.parse({
1841
+ version: 1,
1842
+ kind: "managed-thread",
1843
+ sourceHomeId: params.sourceHomeId.trim(),
1844
+ threadId: params.threadId.trim(),
1845
+ ...params.rolloutPath?.trim() ? { rolloutPath: params.rolloutPath.trim() } : {}
1846
+ });
1847
+ state.registerIfAbsent(managedThreadStoreKey(value.sourceHomeId, value.threadId), value);
1848
+ return true;
1849
+ } catch (error) {
1850
+ embeddedAgentLog.warn("failed to record Codex managed thread ownership", { error });
1851
+ return false;
1852
+ }
1853
+ },
1854
+ async snapshot() {
1855
+ const byHome = /* @__PURE__ */ new Map();
1856
+ for (const entry of state.entries()) {
1857
+ const parsed = managedThreadSchema.safeParse(entry.value);
1858
+ if (!parsed.success) continue;
1859
+ const ids = byHome.get(parsed.data.sourceHomeId) ?? /* @__PURE__ */ new Set();
1860
+ ids.add(parsed.data.threadId);
1861
+ byHome.set(parsed.data.sourceHomeId, ids);
1862
+ }
1863
+ return byHome;
1864
+ }
1865
+ };
1866
+ }
1867
+ //#endregion
1783
1868
  //#region extensions/codex/src/app-server/plugin-thread-attestation.ts
1784
1869
  /**
1785
1870
  * Confirms admitted plugin and account apps against their actual Codex thread before
@@ -1835,6 +1920,50 @@ async function discardUnattestedCodexPluginThread(params) {
1835
1920
  }
1836
1921
  }
1837
1922
  //#endregion
1923
+ //#region extensions/codex/src/app-server/thread-lifecycle-result.ts
1924
+ /** Materializes the public lifecycle result after a fresh thread is durably committed. */
1925
+ function buildStartedCodexThreadBinding(input) {
1926
+ const { context, params, response, startParams } = input;
1927
+ return {
1928
+ threadId: response.thread.id,
1929
+ ...input.clientId ? { clientId: input.clientId } : {},
1930
+ cwd: params.cwd,
1931
+ ...input.rolloutPath ? { rolloutPath: input.rolloutPath } : {},
1932
+ authProfileId: params.params.authProfileId,
1933
+ agentWorkspaceDeveloperInstructions: params.agentWorkspaceDeveloperInstructions,
1934
+ model: response.model ?? startParams.model ?? params.params.modelId,
1935
+ modelProvider: response.modelProvider ?? input.startModelProvider ?? input.modelProvider,
1936
+ dynamicToolsFingerprint: context.dynamicToolsFingerprint,
1937
+ dynamicToolsContainDeferred: context.dynamicToolsContainDeferred,
1938
+ nativeSkillIsolationFingerprint: context.nativeSkillIsolationFingerprint,
1939
+ userMcpServersFingerprint: context.userMcpServersFingerprint,
1940
+ mcpServersFingerprint: input.nextMcpServersFingerprint,
1941
+ configuredMcpOwnershipVersion: params.configuredMcpOwnershipVersion,
1942
+ ringZeroConfigFingerprint: context.ringZeroConfigFingerprint,
1943
+ ringZeroClientInstanceId: context.ringZeroClientInstanceId,
1944
+ networkProxyProfileName: params.appServer.networkProxy?.profileName,
1945
+ networkProxyConfigFingerprint: context.networkProxyConfigFingerprint,
1946
+ nativeHookRelayGeneration: input.finalConfigPatch.nativeHookRelayGeneration,
1947
+ appServerRuntimeFingerprint: params.appServerRuntimeFingerprint,
1948
+ pluginAppsFingerprint: input.pluginThreadConfig?.fingerprint,
1949
+ pluginAppsInputFingerprint: input.pluginThreadConfig?.inputFingerprint,
1950
+ pluginAppPolicyContext: input.pluginThreadConfig?.policyContext,
1951
+ contextEngine: context.contextEngineBinding,
1952
+ environmentSelectionFingerprint: context.environmentSelectionFingerprint,
1953
+ ...!context.preserveExistingBinding ? { liveThreadConfigFingerprint: fingerprintCodexThreadConfig({
1954
+ ...startParams,
1955
+ model: response.model ?? startParams.model ?? null,
1956
+ requestedModel: startParams.model ?? null,
1957
+ modelProvider: input.bindingModelProvider ?? null,
1958
+ requestedModelProvider: startParams.modelProvider ?? input.bindingModelProvider ?? null
1959
+ }, params.params.authProfileId, context.dynamicToolsFingerprint) } : {},
1960
+ lifecycle: {
1961
+ action: "started",
1962
+ ...context.rotatedContextEngineBinding ? { rotatedContextEngineBinding: true } : {}
1963
+ }
1964
+ };
1965
+ }
1966
+ //#endregion
1838
1967
  //#region extensions/codex/src/app-server/reasoning-effort.ts
1839
1968
  const CODEX_REASONING_EFFORTS = [
1840
1969
  "minimal",
@@ -1963,12 +2092,21 @@ function resolveReasoningEffort(thinkLevel, modelId, supportedReasoningEfforts)
1963
2092
  });
1964
2093
  }
1965
2094
  //#endregion
2095
+ //#region extensions/codex/src/app-server/project-doc-thread-config.ts
2096
+ const CODEX_NATIVE_PROJECT_DOC_MAX_BYTES = 128 * 1024;
2097
+ function buildCodexProjectDocThreadConfig(config) {
2098
+ const defaults = { project_doc_max_bytes: CODEX_NATIVE_PROJECT_DOC_MAX_BYTES };
2099
+ return mergeCodexThreadConfigs(defaults, config) ?? defaults;
2100
+ }
2101
+ //#endregion
1966
2102
  //#region extensions/codex/src/app-server/thread-prompt.ts
1967
2103
  function buildDeveloperInstructions(params, options = {}) {
1968
2104
  const deferredToolNames = /* @__PURE__ */ new Set();
1969
2105
  let hasSkillWorkshop = false;
1970
2106
  let hasSessionsSpawn = false;
1971
2107
  let hasSessionsYield = false;
2108
+ let hasSubagentsList = false;
2109
+ let hasSessionsSend = false;
1972
2110
  let hasSeenDirectNamespace = false;
1973
2111
  let messageToolAvailable = options.dynamicTools ? false : params.disableMessageTool !== true;
1974
2112
  for (const spec of options.dynamicTools ?? []) {
@@ -1980,6 +2118,8 @@ function buildDeveloperInstructions(params, options = {}) {
1980
2118
  hasSkillWorkshop ||= name === SKILL_WORKSHOP_TOOL_NAME;
1981
2119
  hasSessionsSpawn ||= name === "sessions_spawn";
1982
2120
  hasSessionsYield ||= isDirectNamespace && name === "sessions_yield";
2121
+ hasSubagentsList ||= name === "subagents";
2122
+ hasSessionsSend ||= name === "sessions_send";
1983
2123
  messageToolAvailable ||= name === "message";
1984
2124
  }
1985
2125
  }
@@ -1987,25 +2127,71 @@ function buildDeveloperInstructions(params, options = {}) {
1987
2127
  surface: "codex_app_server",
1988
2128
  includeLegacyGlobalGuidance: false
1989
2129
  }).join("\n");
1990
- const nativeDelegationAvailable = params.disableTools !== true && params.delegationCapability !== "report_only" && !isMessageOnlyCodexSourceReply(params) && !isSystemAgentOnlyCodexDynamicToolAllowlist(params.toolsAllow) && !shouldDisableCodexToolSearchForModel(params.modelId);
2130
+ const delegationGuidanceAvailable = params.disableTools !== true && params.delegationCapability !== "report_only" && !isMessageOnlyCodexSourceReply(params);
2131
+ const nativeDelegationAvailable = delegationGuidanceAvailable && !isSystemAgentOnlyCodexDynamicToolAllowlist(params.toolsAllow) && !shouldDisableCodexToolSearchForModel(params.modelId);
1991
2132
  const deferredToolDiscoveryGuidance = deferredToolNames.size > 0 || nativeDelegationAvailable ? "Deferred tools may be absent from the direct tool list. Use `tool_search` when directly callable. On code-mode-only models, use `exec` instead: filter `ALL_TOOLS` by name and description, then call the matching entry through `tools`." : void 0;
1992
2133
  return [
1993
2134
  "You are a personal agent running inside OpenClaw. OpenClaw has dynamic tools for OpenClaw-owned messaging, cron, sessions, media, gateway, and nodes.",
1994
2135
  deferredToolNames.size > 0 ? `Deferred searchable OpenClaw dynamic tools available: ${[...deferredToolNames].toSorted((left, right) => left.localeCompare(right)).join(", ")}.` : void 0,
1995
2136
  deferredToolDiscoveryGuidance,
1996
2137
  hasSkillWorkshop ? buildSkillWorkshopPromptSection().join("\n") : void 0,
1997
- nativeDelegationAvailable ? `Use Codex native \`spawn_agent\` for Codex subagents. \`spawn_agent\` and the other native collaboration tools may be deferred.${hasSessionsSpawn ? " Use OpenClaw `sessions_spawn` only for OpenClaw or ACP delegation, never as a substitute for `spawn_agent`." : ""}` : void 0,
2138
+ nativeDelegationAvailable ? `Use Codex native \`spawn_agent\` for Codex subagents. \`spawn_agent\` and the other native collaboration tools may be deferred.${hasSessionsSpawn ? " Use OpenClaw `sessions_spawn` only for OpenClaw or ACP delegation, never as a substitute for `spawn_agent` on internal legwork." : ""}` : void 0,
1998
2139
  hasSessionsYield && nativeDelegationAvailable ? "When a native child's result belongs in a later turn, end the current turn with `openclaw_direct.sessions_yield`; the completion arrives as the next model-visible input. Use native `wait_agent` only for an intentional same-turn wait when the immediate next step is blocked on the child. Never loop-poll for native child completion." : void 0,
1999
- buildVisibleReplyInstruction(params, messageToolAvailable),
2140
+ delegationGuidanceAvailable ? buildDelegationGuidanceSection({
2141
+ mode: resolveMainSessionDelegationMode({
2142
+ config: params.config,
2143
+ agentId: params.agentId,
2144
+ sessionKey: params.sessionKey
2145
+ }),
2146
+ isMinimal: params.promptMode === "minimal" || params.promptMode === "none",
2147
+ hiddenDelegationTool: nativeDelegationAvailable ? "native `spawn_agent`" : hasSessionsSpawn ? "`sessions_spawn`" : "",
2148
+ hasVisibleSessionSpawn: hasSessionsSpawn,
2149
+ hasSessionsYield,
2150
+ hasSubagentsList,
2151
+ hasSessionsSend
2152
+ }).join("\n") : void 0,
2153
+ buildHarnessVisibleReplyGuidance({
2154
+ sourceReplyDeliveryMode: params.sourceReplyDeliveryMode,
2155
+ messageToolAvailable
2156
+ }),
2000
2157
  TRANSCRIPT_CREDENTIAL_SAFETY_PROMPT,
2001
2158
  nativeCommandGuidance,
2002
2159
  params.extraSystemPrompt
2003
2160
  ].filter((section) => typeof section === "string" && section.trim()).join("\n\n");
2004
2161
  }
2005
- function buildVisibleReplyInstruction(params, messageToolAvailable) {
2006
- if (params.sourceReplyDeliveryMode === "message_tool_only" && messageToolAvailable) return "Visible source replies are not automatically delivered for this run. Use `message(action=send)` for user-visible source-channel output. For progress, set `final=false`. Set `final=true`, or omit it, for the completed reply to the current source conversation; OpenClaw stops after confirming delivery. Do not repeat visible message content in your final answer.";
2007
- if (messageToolAvailable) return "For the current source conversation, reply normally in your final assistant message; OpenClaw will deliver it through the active source conversation. Use `message` for supported non-text actions in the current conversation, such as reacting to its current message. Reserve other `message` actions for explicit out-of-band sends or media/file delivery. Reactions are not delivered automatically.";
2008
- return "For the current source conversation, reply normally in your final assistant message; OpenClaw will deliver it through the active source conversation.";
2162
+ //#endregion
2163
+ //#region extensions/codex/src/app-server/thread-shell-environment.ts
2164
+ /** Applies host-selected values and any required login-shell restriction last. */
2165
+ function applyCodexManagedShellEnvironment(config, environment, disableLoginShell = false) {
2166
+ if (!environment || Object.keys(environment).length === 0) return disableLoginShell ? {
2167
+ ...config,
2168
+ allow_login_shell: false
2169
+ } : config;
2170
+ const current = isJsonObject(config.shell_environment_policy) ? config.shell_environment_policy : {};
2171
+ const currentSet = isJsonObject(current.set) ? current.set : {};
2172
+ const names = Object.keys(environment).toSorted();
2173
+ const includeOnly = Array.isArray(current.include_only) ? current.include_only.filter((entry) => typeof entry === "string") : [];
2174
+ const filters = isJsonObject(current.filters) ? current.filters : void 0;
2175
+ const hasIncludeFilter = filters && Object.values(filters).includes("include");
2176
+ const managedConfig = {
2177
+ ...config,
2178
+ shell_environment_policy: {
2179
+ ...current,
2180
+ experimental_use_profile: false,
2181
+ set: {
2182
+ ...currentSet,
2183
+ ...environment
2184
+ },
2185
+ ...filters ? hasIncludeFilter ? { filters: {
2186
+ ...filters,
2187
+ ...Object.fromEntries(names.map((name) => [name, "include"]))
2188
+ } } : {} : includeOnly.length > 0 ? { include_only: [.../* @__PURE__ */ new Set([...includeOnly, ...names])] } : {}
2189
+ }
2190
+ };
2191
+ return disableLoginShell ? {
2192
+ ...managedConfig,
2193
+ allow_login_shell: false
2194
+ } : managedConfig;
2009
2195
  }
2010
2196
  //#endregion
2011
2197
  //#region extensions/codex/src/app-server/web-search.ts
@@ -2068,7 +2254,8 @@ function resolveCodexWebSearchPlan(params) {
2068
2254
  return {
2069
2255
  kind: "native-hosted",
2070
2256
  suppressManagedWebSearch: true,
2071
- threadConfig: buildCodexNativeWebSearchThreadConfig(params.config)
2257
+ threadConfig: buildCodexNativeWebSearchThreadConfig(params.config),
2258
+ webFetchHostnameAllowlist: buildHostnameAllowlistPolicyFromSuffixAllowlist(nativeConfig?.allowedDomains)?.hostnameAllowlist
2072
2259
  };
2073
2260
  }
2074
2261
  const CODEX_CODE_MODE_THREAD_CONFIG = {
@@ -2077,11 +2264,12 @@ const CODEX_CODE_MODE_THREAD_CONFIG = {
2077
2264
  "features.apply_patch_streaming_events": true
2078
2265
  };
2079
2266
  const CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG = { "features.goals": false };
2267
+ const CODEX_NATIVE_UPDATE_PLAN_DISABLED_THREAD_CONFIG = { "tools.update_plan.enabled": false };
2080
2268
  const CODEX_CODE_MODE_DISABLED_THREAD_CONFIG = {
2081
2269
  "features.code_mode": false,
2082
2270
  "features.code_mode_only": false
2083
2271
  };
2084
- const CODEX_LIGHTWEIGHT_CONTEXT_THREAD_CONFIG = { project_doc_max_bytes: 0 };
2272
+ const CODEX_NO_PROJECT_DOCS_CONFIG = { project_doc_max_bytes: 0 };
2085
2273
  const CODEX_TOOL_SEARCH_UNSUPPORTED_THREAD_CONFIG = { "features.multi_agent": false };
2086
2274
  const CODEX_DELEGATION_DISABLED_THREAD_CONFIG = {
2087
2275
  "agents.enabled": false,
@@ -2127,7 +2315,6 @@ const CODEX_RING_ZERO_THREAD_CONFIG = {
2127
2315
  "skills.bundled.enabled": false,
2128
2316
  "skills.include_instructions": false,
2129
2317
  "tools.experimental_request_user_input.enabled": false,
2130
- "tools.update_plan.enabled": false,
2131
2318
  hooks: {
2132
2319
  PreToolUse: [],
2133
2320
  PermissionRequest: [],
@@ -2140,7 +2327,6 @@ const CODEX_RING_ZERO_THREAD_CONFIG = {
2140
2327
  SubagentStop: [],
2141
2328
  Stop: []
2142
2329
  },
2143
- project_doc_max_bytes: 0,
2144
2330
  notify: [],
2145
2331
  web_search: "disabled"
2146
2332
  };
@@ -2153,6 +2339,7 @@ const CODEX_RING_ZERO_RESTRICTED_FEATURE_ALIASES = /* @__PURE__ */ new Map([
2153
2339
  ["codex_hooks", "hooks"]
2154
2340
  ]);
2155
2341
  const CODEX_RING_ZERO_OVERRIDABLE_LAYER_TYPES = /* @__PURE__ */ new Set([
2342
+ "packagedDefaults",
2156
2343
  "mdm",
2157
2344
  "system",
2158
2345
  "enterpriseManaged",
@@ -2181,6 +2368,7 @@ function buildThreadStartParams(params, options) {
2181
2368
  model: modelSelection.model,
2182
2369
  ...modelSelection.modelProvider ? { modelProvider: modelSelection.modelProvider } : {},
2183
2370
  cwd: options.cwd,
2371
+ ...options.appServer.sessionRoot ? { runtimeWorkspaceRoots: [options.appServer.sessionRoot] } : {},
2184
2372
  approvalPolicy: options.appServer.approvalPolicy,
2185
2373
  approvalsReviewer: resolveCodexThreadApprovalsReviewer(options.appServer, options.config),
2186
2374
  ...codexThreadSandboxOrPermissions(options.appServer),
@@ -2196,7 +2384,9 @@ function buildThreadStartParams(params, options) {
2196
2384
  webSearchAllowed: options.webSearchAllowed,
2197
2385
  appServer: options.appServer,
2198
2386
  hostSystemAgentActive: options.hostSystemAgentActive,
2199
- restrictedToolSurfaceInheritedMcpServerNames: options.restrictedToolSurfaceInheritedMcpServerNames
2387
+ restrictedToolSurfaceInheritedMcpServerNames: options.restrictedToolSurfaceInheritedMcpServerNames,
2388
+ shellEnvironment: options.shellEnvironment,
2389
+ disableLoginShell: options.disableLoginShell
2200
2390
  }),
2201
2391
  ...resolveCodexThreadEnvironmentSelection(options),
2202
2392
  developerInstructions: options.developerInstructions ?? buildDeveloperInstructions(params, { dynamicTools: options.dynamicTools }),
@@ -2222,6 +2412,8 @@ function buildThreadResumeParams(params, options) {
2222
2412
  });
2223
2413
  return {
2224
2414
  threadId: options.threadId,
2415
+ ...options.cwd ? { cwd: options.cwd } : {},
2416
+ ...options.appServer.sessionRoot ? { runtimeWorkspaceRoots: [options.appServer.sessionRoot] } : {},
2225
2417
  excludeTurns: true,
2226
2418
  initialTurnsPage: {
2227
2419
  limit: 1,
@@ -2245,29 +2437,38 @@ function buildThreadResumeParams(params, options) {
2245
2437
  webSearchAllowed: options.webSearchAllowed,
2246
2438
  appServer: options.appServer,
2247
2439
  hostSystemAgentActive: options.hostSystemAgentActive,
2248
- restrictedToolSurfaceInheritedMcpServerNames: options.restrictedToolSurfaceInheritedMcpServerNames
2440
+ restrictedToolSurfaceInheritedMcpServerNames: options.restrictedToolSurfaceInheritedMcpServerNames,
2441
+ shellEnvironment: options.shellEnvironment,
2442
+ disableLoginShell: options.disableLoginShell
2249
2443
  }),
2250
2444
  developerInstructions: options.developerInstructions ?? buildDeveloperInstructions(params, { dynamicTools: options.dynamicTools })
2251
2445
  };
2252
2446
  }
2253
2447
  function buildCodexRuntimeThreadConfig(config, options = {}) {
2448
+ const configured = buildCodexProjectDocThreadConfig(config);
2254
2449
  const codeModeConfig = {
2255
2450
  ...CODEX_CODE_MODE_THREAD_CONFIG,
2256
2451
  "features.code_mode_only": options.nativeCodeModeOnlyEnabled === true
2257
2452
  };
2258
2453
  if (options.nativeCodeModeEnabled === false) {
2259
- const disabledConfig = mergeCodexThreadConfigs(config, CODEX_CODE_MODE_DISABLED_THREAD_CONFIG, CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG) ?? { ...CODEX_CODE_MODE_DISABLED_THREAD_CONFIG };
2454
+ const disabledConfig = mergeCodexThreadConfigs(configured, CODEX_CODE_MODE_DISABLED_THREAD_CONFIG, CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG, CODEX_NATIVE_UPDATE_PLAN_DISABLED_THREAD_CONFIG) ?? {
2455
+ ...CODEX_CODE_MODE_DISABLED_THREAD_CONFIG,
2456
+ ...CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG,
2457
+ ...CODEX_NATIVE_UPDATE_PLAN_DISABLED_THREAD_CONFIG
2458
+ };
2260
2459
  delete disabledConfig["features.apply_patch_streaming_events"];
2261
2460
  return disabledConfig;
2262
2461
  }
2263
- if (options.nativeCodeModeOnlyEnabled === true) return ensureDirectOnlyToolNamespaces(mergeCodexThreadConfigs(codeModeConfig, config, CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG, { "features.code_mode_only": true }) ?? {
2462
+ if (options.nativeCodeModeOnlyEnabled === true) return ensureDirectOnlyToolNamespaces(mergeCodexThreadConfigs(codeModeConfig, configured, CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG, CODEX_NATIVE_UPDATE_PLAN_DISABLED_THREAD_CONFIG, { "features.code_mode_only": true }) ?? {
2264
2463
  ...codeModeConfig,
2265
2464
  ...CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG,
2465
+ ...CODEX_NATIVE_UPDATE_PLAN_DISABLED_THREAD_CONFIG,
2266
2466
  "features.code_mode_only": true
2267
2467
  }, options.directOnlyToolNamespaces);
2268
- return ensureDirectOnlyToolNamespaces(mergeCodexThreadConfigs(codeModeConfig, config, CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG) ?? {
2468
+ return ensureDirectOnlyToolNamespaces(mergeCodexThreadConfigs(codeModeConfig, configured, CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG, CODEX_NATIVE_UPDATE_PLAN_DISABLED_THREAD_CONFIG) ?? {
2269
2469
  ...codeModeConfig,
2270
- ...CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG
2470
+ ...CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG,
2471
+ ...CODEX_NATIVE_UPDATE_PLAN_DISABLED_THREAD_CONFIG
2271
2472
  }, options.directOnlyToolNamespaces);
2272
2473
  }
2273
2474
  function ensureDirectOnlyToolNamespaces(config, requiredNamespaces) {
@@ -2286,6 +2487,7 @@ function buildCodexRuntimeThreadConfigForRun(params, config, options = {}) {
2286
2487
  const ringZeroActive = (options.hostSystemAgentActive ?? isHostScopedAgentToolActive("openclaw")) && isSystemAgentOnlyCodexDynamicToolAllowlist(params.toolsAllow);
2287
2488
  const messageOnlySourceReply = isMessageOnlyCodexSourceReply(params);
2288
2489
  const restrictedToolSurface = ringZeroActive || messageOnlySourceReply || params.pluginHarnessToolPolicyRestricted === true;
2490
+ const restrictedTurnDisablesProjectDocs = ringZeroActive || messageOnlySourceReply || params.pluginHarnessToolPolicyRestricted && params.disableTools;
2289
2491
  const configMcpServers = config?.mcp_servers;
2290
2492
  if (restrictedToolSurface && configMcpServers !== void 0 && !isJsonObject(configMcpServers)) throw new Error("Codex restricted tool surface received invalid thread mcp_servers config");
2291
2493
  const restrictedToolSurfaceMcpServerNames = [...options.restrictedToolSurfaceInheritedMcpServerNames ?? [], ...isJsonObject(configMcpServers) ? Object.keys(configMcpServers) : []];
@@ -2301,18 +2503,19 @@ function buildCodexRuntimeThreadConfigForRun(params, config, options = {}) {
2301
2503
  webSearchAllowed: options.webSearchAllowed
2302
2504
  }).threadConfig;
2303
2505
  const baseConfig = buildCodexRuntimeThreadConfig(mergeCodexThreadConfigs(restrictedRunConfig, webSearchConfig), options);
2304
- const runtimeConfig = mergeCodexThreadConfigs(baseConfig, options.appServer?.networkProxy?.configPatch, shouldDisableCodexToolSearchForModel(params.modelId) ? CODEX_TOOL_SEARCH_UNSUPPORTED_THREAD_CONFIG : void 0, params.delegationCapability === "report_only" ? CODEX_DELEGATION_DISABLED_THREAD_CONFIG : void 0, messageOnlySourceReply || params.pluginHarnessToolPolicyRestricted === true ? buildCodexRestrictedToolThreadConfigPatch(restrictedToolSurfaceMcpServerNames) : buildCodexRingZeroThreadConfigPatch(params, options.hostSystemAgentActive, restrictedToolSurfaceMcpServerNames)) ?? baseConfig;
2305
- if (params.bootstrapContextMode !== "lightweight") return runtimeConfig;
2306
- return mergeCodexThreadConfigs(runtimeConfig, CODEX_LIGHTWEIGHT_CONTEXT_THREAD_CONFIG) ?? {
2307
- ...runtimeConfig,
2308
- ...CODEX_LIGHTWEIGHT_CONTEXT_THREAD_CONFIG
2309
- };
2506
+ return applyCodexManagedShellEnvironment({
2507
+ ...mergeCodexThreadConfigs(baseConfig, options.appServer?.networkProxy?.configPatch, params.pluginHarnessToolPolicySafeDeniedTools?.includes("image_generate") ? { "features.image_generation": false } : void 0, shouldDisableCodexToolSearchForModel(params.modelId) ? CODEX_TOOL_SEARCH_UNSUPPORTED_THREAD_CONFIG : void 0, params.delegationCapability === "report_only" ? CODEX_DELEGATION_DISABLED_THREAD_CONFIG : void 0, messageOnlySourceReply || params.pluginHarnessToolPolicyRestricted === true ? buildRestrictedToolConfigPatch(restrictedToolSurfaceMcpServerNames) : buildCodexRingZeroThreadConfigPatch(params, options.hostSystemAgentActive, restrictedToolSurfaceMcpServerNames), restrictedTurnDisablesProjectDocs ? CODEX_NO_PROJECT_DOCS_CONFIG : void 0, params.authoredContextTokenCap === void 0 ? void 0 : { model_context_window: params.authoredContextTokenCap }) ?? baseConfig,
2508
+ ...params.bootstrapContextMode === "lightweight" ? CODEX_NO_PROJECT_DOCS_CONFIG : {}
2509
+ }, options.shellEnvironment, options.disableLoginShell);
2310
2510
  }
2311
2511
  function buildCodexRingZeroThreadConfigPatch(params, hostSystemAgentActive = isHostScopedAgentToolActive("openclaw"), inheritedMcpServerNames = []) {
2312
2512
  if (!hostSystemAgentActive || !isSystemAgentOnlyCodexDynamicToolAllowlist(params.toolsAllow)) return;
2313
- return buildCodexRestrictedToolThreadConfigPatch(inheritedMcpServerNames);
2513
+ return {
2514
+ ...buildRestrictedToolConfigPatch(inheritedMcpServerNames),
2515
+ ...CODEX_NO_PROJECT_DOCS_CONFIG
2516
+ };
2314
2517
  }
2315
- function buildCodexRestrictedToolThreadConfigPatch(inheritedMcpServerNames) {
2518
+ function buildRestrictedToolConfigPatch(inheritedMcpServerNames) {
2316
2519
  const mcpServers = Object.fromEntries([...new Set(inheritedMcpServerNames)].toSorted().map((name) => [name, { enabled: false }]));
2317
2520
  return {
2318
2521
  ...CODEX_RING_ZERO_THREAD_CONFIG,
@@ -2336,12 +2539,12 @@ async function readCodexInheritedMcpServerNames(client, cwd, signal) {
2336
2539
  if (!isJsonObject(configuredServers)) throw new Error("Codex config/read returned invalid mcp_servers");
2337
2540
  return Object.keys(configuredServers).toSorted();
2338
2541
  }
2339
- async function assertCodexRestrictedToolSurfaceHasNoManagedHooks(client, signal) {
2542
+ async function assertCodexManagedRequirementsDoNotOverrideToolPolicy(client, options, signal) {
2340
2543
  const response = await client.request("configRequirements/read", void 0, { signal });
2341
2544
  if (!isJsonObject(response) || !Object.hasOwn(response, "requirements")) throw new Error("Codex configRequirements/read returned an invalid response");
2342
2545
  if (response.requirements === null) return;
2343
2546
  if (!isJsonObject(response.requirements)) throw new Error("Codex configRequirements/read returned invalid requirements");
2344
- for (const key of [
2547
+ if (options.restrictedToolSurface) for (const key of [
2345
2548
  "hooks",
2346
2549
  "managedHooks",
2347
2550
  "managed_hooks"
@@ -2351,6 +2554,7 @@ async function assertCodexRestrictedToolSurfaceHasNoManagedHooks(client, signal)
2351
2554
  if (!isJsonObject(hooks)) throw new Error("Codex configRequirements/read returned invalid managed hooks");
2352
2555
  if (hasNonEmptyJsonValue(hooks)) throw new Error("Codex restricted tool surface cannot override managed hooks");
2353
2556
  }
2557
+ const additionalDeniedFeatures = new Set(options.additionalDeniedFeatures);
2354
2558
  for (const key of ["featureRequirements", "feature_requirements"]) {
2355
2559
  const requirements = response.requirements[key];
2356
2560
  if (requirements === void 0 || requirements === null) continue;
@@ -2358,7 +2562,8 @@ async function assertCodexRestrictedToolSurfaceHasNoManagedHooks(client, signal)
2358
2562
  for (const [feature, enabled] of Object.entries(requirements)) {
2359
2563
  if (typeof enabled !== "boolean") throw new Error("Codex configRequirements/read returned invalid feature requirements");
2360
2564
  const canonicalFeature = CODEX_RING_ZERO_RESTRICTED_FEATURE_ALIASES.get(feature) ?? feature;
2361
- if (enabled && CODEX_RING_ZERO_RESTRICTED_FEATURES.has(canonicalFeature)) throw new Error(`Codex restricted tool surface cannot override required feature ${feature}`);
2565
+ const deniedByToolPolicy = options.restrictedToolSurface && CODEX_RING_ZERO_RESTRICTED_FEATURES.has(canonicalFeature) || additionalDeniedFeatures.has(canonicalFeature);
2566
+ if (enabled && deniedByToolPolicy) throw new Error(`Codex tool policy cannot override required feature ${feature}`);
2362
2567
  }
2363
2568
  }
2364
2569
  }
@@ -2408,6 +2613,15 @@ function resolveCodexThreadEnvironmentSelection(options) {
2408
2613
  }
2409
2614
  //#endregion
2410
2615
  //#region extensions/codex/src/app-server/thread-lifecycle-io.ts
2616
+ function resolveManagedThreadSourceHomeId(params) {
2617
+ const agentId = resolveSessionAgentIds$1({
2618
+ config: params.params.config,
2619
+ sessionKey: params.params.sessionKey,
2620
+ agentId: params.agentId ?? params.params.agentId
2621
+ }).sessionAgentId;
2622
+ const agentDir = params.agentDir ?? params.params.agentDir ?? resolveAgentDir$1(params.params.config ?? {}, agentId);
2623
+ return codexCatalogHomeId(resolveCodexAppServerLocalHomeDir(params.appServer.start, agentDir));
2624
+ }
2411
2625
  function resolveCodexThreadRolloutPath(thread) {
2412
2626
  const rolloutPath = thread.path?.trim();
2413
2627
  if (!rolloutPath || !path.isAbsolute(rolloutPath) || path.extname(rolloutPath) !== ".jsonl" || !path.basename(rolloutPath).includes(thread.id)) return;
@@ -2429,6 +2643,7 @@ async function resumeExistingCodexThread(params, context) {
2429
2643
  const resumeConfig = applyCodexNativeSkillIsolation(mergeCodexThreadConfigs(params.config, userMcpServersConfigPatch, pluginAppsConfigPatch, finalConfigPatch.configPatch), nativeSkillIsolation);
2430
2644
  const resumeParams = lifecycleTiming.measureSync("thread-resume-params", () => buildThreadResumeParams(params.params, {
2431
2645
  threadId: resumeBinding.threadId,
2646
+ cwd: params.cwd,
2432
2647
  authProfileId,
2433
2648
  model: startModelSelection.model,
2434
2649
  modelProvider: startModelProvider,
@@ -2442,7 +2657,9 @@ async function resumeExistingCodexThread(params, context) {
2442
2657
  nativeCodeModeOnlyEnabled: params.nativeCodeModeOnlyEnabled,
2443
2658
  webSearchAllowed: params.webSearchAllowed,
2444
2659
  hostSystemAgentActive,
2445
- restrictedToolSurfaceInheritedMcpServerNames
2660
+ restrictedToolSurfaceInheritedMcpServerNames,
2661
+ shellEnvironment: params.shellEnvironment,
2662
+ disableLoginShell: params.disableLoginShell
2446
2663
  }));
2447
2664
  const requestModelProvider = typeof resumeParams.modelProvider === "string" && resumeParams.modelProvider.trim() ? resumeParams.modelProvider : void 0;
2448
2665
  throwIfAborted();
@@ -2579,7 +2796,9 @@ async function startFreshCodexThread(params, context) {
2579
2796
  model: startModelSelection.model,
2580
2797
  modelProvider: startModelProvider,
2581
2798
  hostSystemAgentActive,
2582
- restrictedToolSurfaceInheritedMcpServerNames
2799
+ restrictedToolSurfaceInheritedMcpServerNames,
2800
+ shellEnvironment: params.shellEnvironment,
2801
+ disableLoginShell: params.disableLoginShell
2583
2802
  }));
2584
2803
  const requestModelProvider = typeof startParams.modelProvider === "string" && startParams.modelProvider.trim() ? startParams.modelProvider : void 0;
2585
2804
  const response = assertCodexThreadStartResponse(await lifecycleTiming.measure("thread-start-request", async () => {
@@ -2647,6 +2866,7 @@ async function startFreshCodexThread(params, context) {
2647
2866
  cwd: params.cwd,
2648
2867
  ...rolloutPath ? { rolloutPath } : {},
2649
2868
  authProfileId: params.params.authProfileId,
2869
+ agentWorkspaceDeveloperInstructions: params.agentWorkspaceDeveloperInstructions,
2650
2870
  model: response.model ?? startParams.model ?? params.params.modelId,
2651
2871
  modelProvider: bindingModelProvider,
2652
2872
  dynamicToolsFingerprint,
@@ -2679,6 +2899,12 @@ async function startFreshCodexThread(params, context) {
2679
2899
  throw new CodexAppServerUnsafeSubscriptionError("Codex successor cleanup failed after a binding replacement conflict", cause === void 0 ? void 0 : { cause });
2680
2900
  }
2681
2901
  };
2902
+ const managedSourceHomeId = resolveManagedThreadSourceHomeId(params);
2903
+ await lifecycleTiming.measure("thread-start-mark-managed", () => markStartedCodexManagedThread(params.bindingStore.managedThreads, {
2904
+ sourceHomeId: managedSourceHomeId,
2905
+ threadId: response.thread.id,
2906
+ ...rolloutPath ? { rolloutPath } : {}
2907
+ }));
2682
2908
  let committed;
2683
2909
  try {
2684
2910
  committed = await lifecycleTiming.measure("thread-start-write-binding", () => params.bindingStore.mutate(bindingIdentity, replacementPredecessor ? {
@@ -2716,43 +2942,20 @@ async function startFreshCodexThread(params, context) {
2716
2942
  threadId: response.thread.id,
2717
2943
  action: rotatedContextEngineBinding ? "rotated" : "started"
2718
2944
  });
2719
- return {
2720
- threadId: response.thread.id,
2721
- ...clientId ? { clientId } : {},
2722
- cwd: params.cwd,
2723
- ...rolloutPath ? { rolloutPath } : {},
2724
- authProfileId: params.params.authProfileId,
2725
- model: response.model ?? startParams.model ?? params.params.modelId,
2726
- modelProvider: response.modelProvider ?? requestModelProvider ?? startModelProvider ?? modelProvider,
2727
- dynamicToolsFingerprint,
2728
- dynamicToolsContainDeferred,
2729
- nativeSkillIsolationFingerprint,
2730
- userMcpServersFingerprint,
2731
- mcpServersFingerprint: nextMcpServersFingerprint,
2732
- configuredMcpOwnershipVersion: params.configuredMcpOwnershipVersion,
2733
- ringZeroConfigFingerprint,
2734
- ringZeroClientInstanceId,
2735
- networkProxyProfileName: params.appServer.networkProxy?.profileName,
2736
- networkProxyConfigFingerprint,
2737
- nativeHookRelayGeneration: finalConfigPatch.nativeHookRelayGeneration,
2738
- appServerRuntimeFingerprint: params.appServerRuntimeFingerprint,
2739
- pluginAppsFingerprint: pluginThreadConfig?.fingerprint,
2740
- pluginAppsInputFingerprint: pluginThreadConfig?.inputFingerprint,
2741
- pluginAppPolicyContext: pluginThreadConfig?.policyContext,
2742
- contextEngine: contextEngineBinding,
2743
- environmentSelectionFingerprint,
2744
- ...!preserveExistingBinding ? { liveThreadConfigFingerprint: fingerprintCodexThreadConfig({
2745
- ...startParams,
2746
- model: response.model ?? startParams.model ?? null,
2747
- requestedModel: startParams.model ?? null,
2748
- modelProvider: bindingModelProvider ?? null,
2749
- requestedModelProvider: startParams.modelProvider ?? bindingModelProvider ?? null
2750
- }, params.params.authProfileId, dynamicToolsFingerprint) } : {},
2751
- lifecycle: {
2752
- action: "started",
2753
- ...rotatedContextEngineBinding ? { rotatedContextEngineBinding } : {}
2754
- }
2755
- };
2945
+ return buildStartedCodexThreadBinding({
2946
+ bindingModelProvider,
2947
+ clientId,
2948
+ context,
2949
+ finalConfigPatch,
2950
+ nextMcpServersFingerprint,
2951
+ params,
2952
+ pluginThreadConfig,
2953
+ response,
2954
+ rolloutPath,
2955
+ startModelProvider: requestModelProvider ?? startModelProvider,
2956
+ startParams,
2957
+ modelProvider
2958
+ });
2756
2959
  }
2757
2960
  //#endregion
2758
2961
  //#region extensions/codex/src/app-server/profiler-flag.ts
@@ -2898,9 +3101,13 @@ async function prepareCodexThreadLifecyclePreflight(params) {
2898
3101
  const ringZeroActive = hostSystemAgentActive && isSystemAgentOnlyCodexDynamicToolAllowlist(params.params.toolsAllow);
2899
3102
  const messageOnlySourceReply = isMessageOnlyCodexSourceReply(params.params);
2900
3103
  const restrictedToolSurface = ringZeroActive || messageOnlySourceReply || params.params.pluginHarnessToolPolicyRestricted === true;
3104
+ const imageGenerationDenied = params.params.pluginHarnessToolPolicySafeDeniedTools?.includes("image_generate") === true;
2901
3105
  if (restrictedToolSurface && params.nativeCodeModeEnabled !== false) throw new Error("Codex restricted tool surfaces require native code mode to be disabled");
2902
3106
  const restrictedToolSurfaceInheritedMcpServerNames = restrictedToolSurface ? await lifecycleTiming.measure("restricted-tool-surface-mcp-config-read", () => readCodexInheritedMcpServerNames(params.client, params.cwd, params.signal)) : [];
2903
- if (restrictedToolSurface) await lifecycleTiming.measure("restricted-tool-surface-config-requirements-read", () => assertCodexRestrictedToolSurfaceHasNoManagedHooks(params.client, params.signal));
3107
+ if (restrictedToolSurface || imageGenerationDenied) await lifecycleTiming.measure("tool-policy-config-requirements-read", () => assertCodexManagedRequirementsDoNotOverrideToolPolicy(params.client, {
3108
+ restrictedToolSurface,
3109
+ additionalDeniedFeatures: imageGenerationDenied ? ["image_generation"] : void 0
3110
+ }, params.signal));
2904
3111
  const ringZeroConfigFingerprint = ringZeroActive ? fingerprintJsonObject({
2905
3112
  version: 1,
2906
3113
  baseInstructions: "",
@@ -2968,6 +3175,7 @@ async function tryReuseCodexLiveThread(options) {
2968
3175
  const resumeConfig = mergeCodexThreadConfigs(params.config, userMcpServersConfigPatch, pluginAppsConfigPatch, prebuiltFinalConfigPatch.configPatch);
2969
3176
  const resumeParams = lifecycleTiming.measureSync("warm-thread-resume-params", () => buildThreadResumeParams(params.params, {
2970
3177
  threadId: binding.threadId,
3178
+ cwd: params.cwd,
2971
3179
  authProfileId: resumeAuthProfileId,
2972
3180
  model: startModelSelection.model,
2973
3181
  modelProvider: startModelProvider,
@@ -2981,7 +3189,9 @@ async function tryReuseCodexLiveThread(options) {
2981
3189
  nativeCodeModeOnlyEnabled: params.nativeCodeModeOnlyEnabled,
2982
3190
  webSearchAllowed: params.webSearchAllowed,
2983
3191
  hostSystemAgentActive,
2984
- restrictedToolSurfaceInheritedMcpServerNames
3192
+ restrictedToolSurfaceInheritedMcpServerNames,
3193
+ shellEnvironment: params.shellEnvironment,
3194
+ disableLoginShell: params.disableLoginShell
2985
3195
  }));
2986
3196
  const liveThreadConfigFingerprint = fingerprintCodexThreadConfig({
2987
3197
  ...resumeParams,
@@ -3102,7 +3312,9 @@ async function materializePendingSupervisionBranch(params) {
3102
3312
  model: nativeModel,
3103
3313
  modelProvider: nativeModelProvider,
3104
3314
  hostSystemAgentActive: params.hostSystemAgentActive,
3105
- restrictedToolSurfaceInheritedMcpServerNames: params.restrictedToolSurfaceInheritedMcpServerNames
3315
+ restrictedToolSurfaceInheritedMcpServerNames: params.restrictedToolSurfaceInheritedMcpServerNames,
3316
+ shellEnvironment: params.shellEnvironment,
3317
+ disableLoginShell: params.disableLoginShell
3106
3318
  });
3107
3319
  assertExactSupervisionModelSelection(startParams, {
3108
3320
  model: nativeModel,
@@ -3258,7 +3470,9 @@ function buildPendingSupervisionProbeForkParams(params, pending) {
3258
3470
  webSearchAllowed: params.webSearchAllowed,
3259
3471
  appServer: params.appServer,
3260
3472
  hostSystemAgentActive: params.hostSystemAgentActive,
3261
- restrictedToolSurfaceInheritedMcpServerNames: params.restrictedToolSurfaceInheritedMcpServerNames
3473
+ restrictedToolSurfaceInheritedMcpServerNames: params.restrictedToolSurfaceInheritedMcpServerNames,
3474
+ shellEnvironment: params.shellEnvironment,
3475
+ disableLoginShell: params.disableLoginShell
3262
3476
  });
3263
3477
  return {
3264
3478
  threadId: pending.sourceThreadId,
@@ -3465,6 +3679,8 @@ async function startOrResumeThread(params) {
3465
3679
  hostSystemAgentActive,
3466
3680
  restrictedToolSurface,
3467
3681
  restrictedToolSurfaceInheritedMcpServerNames,
3682
+ shellEnvironment: params.shellEnvironment,
3683
+ disableLoginShell: params.disableLoginShell,
3468
3684
  environmentSelection: params.environmentSelection,
3469
3685
  provisionalAppIds: pluginThreadConfig?.provisionalAppIds,
3470
3686
  signal: params.signal,
@@ -3475,6 +3691,7 @@ async function startOrResumeThread(params) {
3475
3691
  cwd: params.cwd,
3476
3692
  ...clientId ? { clientId } : {},
3477
3693
  authProfileId: void 0,
3694
+ agentWorkspaceDeveloperInstructions: params.agentWorkspaceDeveloperInstructions,
3478
3695
  preserveNativeModel: true,
3479
3696
  dynamicToolsFingerprint,
3480
3697
  dynamicToolsContainDeferred,
@@ -3541,7 +3758,7 @@ async function startOrResumeThread(params) {
3541
3758
  }
3542
3759
  const startModelSelection = resolveCodexAppServerThreadModelSelection({
3543
3760
  provider: params.params.provider,
3544
- model: params.params.modelId,
3761
+ model: params.runtimeModelId ?? params.params.modelId,
3545
3762
  binding,
3546
3763
  authProfileId: params.params.authProfileId,
3547
3764
  authProfileStore: params.params.authProfileStore,
@@ -3855,9 +4072,10 @@ function buildTurnStartParams(params, options) {
3855
4072
  input: [...buildCodexUserInput(options.promptText ?? params.prompt, params.images), ...options.explicitSkillInputs ?? []],
3856
4073
  ...additionalContext ? { additionalContext } : {},
3857
4074
  cwd: options.cwd,
4075
+ ...options.appServer.sessionRoot ? { runtimeWorkspaceRoots: [options.appServer.sessionRoot] } : {},
3858
4076
  approvalPolicy: options.appServer.approvalPolicy,
3859
4077
  approvalsReviewer: options.appServer.approvalsReviewer,
3860
- ...useThreadPermissionProfile ? {} : { sandboxPolicy: options.sandboxPolicy ?? codexSandboxPolicyForTurn(options.appServer.sandbox, options.cwd, options.appServer.start?.args) },
4078
+ ...useThreadPermissionProfile ? {} : { sandboxPolicy: options.sandboxPolicy ?? codexSandboxPolicyForTurn(options.appServer.sandbox, options.appServer.sessionRoot ?? options.cwd, options.appServer.start?.args) },
3861
4079
  ...modelSelection ? {
3862
4080
  model: modelSelection.model,
3863
4081
  personality: CODEX_NATIVE_PERSONALITY_NONE
@@ -3925,4 +4143,4 @@ function joinPresentSections(...sections) {
3925
4143
  return sections.filter((section) => Boolean(section?.trim())).join("\n\n");
3926
4144
  }
3927
4145
  //#endregion
3928
- export { resolveCodexDynamicToolsLoadingForRuntime as A, buildCodexPluginThreadConfigInputFingerprint as B, codexLegacyDynamicToolsFingerprint as C, isSystemAgentOnlyCodexDynamicToolAllowlist as D, isForcedPrivateQaCodexRuntime as E, projectContextEngineAssemblyForCodex as F, shouldBuildCodexPluginThreadConfig as G, buildDisabledAppsConfigPatch as H, resolveCodexContextEngineProjectionMaxChars as I, isOpenAiCuratedMarketplace as J, ensureCodexPluginActivation as K, resolveCodexContextEngineProjectionReserveTokens as L, isContextEngineBindingCompatible as M, fitCodexProjectedContextForTurnStart as N, normalizeCodexDynamicToolName as O, neutralizeCodexExplicitMentionSigils as P, buildCodexPluginAppsConfigPatchFromPolicyContext as R, codexDynamicToolsFingerprint as S, filterCodexDynamicToolsForDisabledNativeSurface as T, buildPluginAppPolicyContext as U, buildCodexPluginThreadConfigTimeoutFallback as V, mergeCodexThreadConfigs as W, pluginReadParams as X, isOpenAiCuratedMarketplaceName as Y, resolveRecoverableCodexPluginConfigKeys as Z, resolveCodexAppServerThreadModelSelection as _, isCodexAppServerProfilerEnabled as a, readCodexSupportedReasoningEfforts as b, buildCodexRingZeroThreadConfigPatch as c, buildCodexNativeWebSearchThreadConfig as d, resolveCodexWebSearchPlan as f, resolveCodexAppServerRequestModelSelection as g, resolveCodexAppServerModelProvider as h, startOrResumeThread as i, buildContextEngineBinding as j, resolveCodexDynamicToolsLoading as k, buildCodexRuntimeThreadConfig as l, CODEX_NATIVE_PERSONALITY_NONE as m, buildTurnStartParams as n, assertCodexRestrictedToolSurfaceHasNoManagedHooks as o, buildDeveloperInstructions as p, refreshCodexPluginRuntimeState as q, buildCodexUserInput as r, attestCodexRestrictedToolSurfaceMcpServersDisabled as s, buildTurnCollaborationMode as t, readCodexInheritedMcpServerNames as u, resolveCodexBindingModelProviderFallback as v, filterCodexDynamicTools as w, areCodexDynamicToolFingerprintsCompatible as x, resolveReasoningEffort as y, buildCodexPluginThreadConfig as z };
4146
+ export { ensureCodexPluginActivation as $, isForcedPrivateQaCodexRuntime as A, neutralizeCodexExplicitMentionSigils as B, CODEX_MANAGED_THREAD_NAMESPACE as C, codexLegacyDynamicToolsFingerprint as D, codexDynamicToolsFingerprint as E, resolveCodexDynamicToolsLoadingForRuntime as F, buildCodexPluginAppsConfigPatchFromPolicyContext as G, resolveCodexContextEngineProjectionMaxChars as H, buildContextEngineBinding as I, buildCodexPluginThreadConfigTimeoutFallback as J, buildCodexPluginThreadConfig as K, isContextEngineBindingCompatible as L, isSystemAgentOnlyCodexDynamicToolAllowlist as M, normalizeCodexDynamicToolName as N, filterCodexDynamicTools as O, resolveCodexDynamicToolsLoading as P, shouldBuildCodexPluginThreadConfig as Q, buildCodexContinuityCalibration as R, CODEX_MANAGED_THREAD_MAX_ENTRIES as S, areCodexDynamicToolFingerprintsCompatible as T, resolveCodexContextEngineProjectionReserveTokens as U, projectContextEngineAssemblyForCodex as V, resolveCodexContinuityProjectionMaxChars as W, buildPluginAppPolicyContext as X, buildDisabledAppsConfigPatch as Y, mergeCodexThreadConfigs as Z, resolveCodexAppServerRequestModelSelection as _, isCodexAppServerProfilerEnabled as a, resolveReasoningEffort as b, buildCodexRingZeroThreadConfigPatch as c, buildCodexNativeWebSearchThreadConfig as d, refreshCodexPluginRuntimeState as et, resolveCodexWebSearchPlan as f, resolveCodexAppServerModelProvider as g, CODEX_NATIVE_PERSONALITY_NONE as h, startOrResumeThread as i, resolveRecoverableCodexPluginConfigKeys as it, isMessageOnlyCodexSourceReply as j, filterCodexDynamicToolsForDisabledNativeSurface as k, buildCodexRuntimeThreadConfig as l, buildCodexProjectDocThreadConfig as m, buildTurnStartParams as n, isOpenAiCuratedMarketplaceName as nt, assertCodexManagedRequirementsDoNotOverrideToolPolicy as o, buildDeveloperInstructions as p, buildCodexPluginThreadConfigInputFingerprint as q, buildCodexUserInput as r, pluginReadParams as rt, attestCodexRestrictedToolSurfaceMcpServersDisabled as s, buildTurnCollaborationMode as t, isOpenAiCuratedMarketplace as tt, readCodexInheritedMcpServerNames as u, resolveCodexAppServerThreadModelSelection as v, createCodexManagedThreadStore as w, readCodexSupportedReasoningEfforts as x, resolveCodexBindingModelProviderFallback as y, fitCodexProjectedContextForTurnStart as z };