@openclaw/codex 2026.7.2-beta.2 → 2026.7.2-beta.4
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.
- package/dist/{app-server-policy-Scc-Wevo.js → app-server-policy-BO3jYBkv.js} +1 -1
- package/dist/{attempt-notifications-BFmNhqFl.js → attempt-notifications-DdmnBMUp.js} +1 -1
- package/dist/{media-understanding-provider-D31dOJwb.js → bounded-turn-CaQL96kg.js} +43 -183
- package/dist/capabilities-CLICvTxf.js +36 -0
- package/dist/cli-metadata.js +1 -1
- package/dist/{command-formatters-Dq9InZUK.js → command-formatters-DgADqnHa.js} +4 -34
- package/dist/{command-handlers-IgqmL_kv.js → command-handlers-l_lVPNlB.js} +72 -13
- package/dist/{compact-DCTmg3id.js → compact-CC5KhBzX.js} +5 -4
- package/dist/{computer-use-CPcU8TjG.js → computer-use-Ip1-QGa-.js} +4 -4
- package/dist/{conversation-control-CGkBlfc5.js → conversation-control-sNPsbTCP.js} +6 -5
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{dynamic-tools-C_1tEs34.js → dynamic-tools-CQI3UwqY.js} +117 -2543
- package/dist/event-projector-assistant-message-DTgnPPVF.js +101 -0
- package/dist/event-projector-usage-D6tE7_qD.js +69 -0
- package/dist/harness.js +27 -7
- package/dist/incognito-session-ET_ufDH-.js +2 -0
- package/dist/index.js +60 -26
- package/dist/media-understanding-provider.js +168 -1
- package/dist/{models-uh26C8QU.js → models-BNeMlHgg.js} +2 -2
- package/dist/{notification-correlation-KmfV4EkP.js → notification-correlation-BGLixv5_.js} +3 -3
- package/dist/{plugin-app-cache-key-Ceb-lm2c.js → plugin-app-cache-key-CvzvmBRz.js} +2 -2
- package/dist/{rate-limits-DyXaYAxU.js → rate-limits-D0IJT-a6.js} +3 -1
- package/dist/{request-B_oQsCXy.js → request-BTccUTD3.js} +1 -1
- package/dist/{run-attempt-MLzoMe_m.js → run-attempt--858NXDl.js} +2798 -172
- package/dist/{session-binding-h1mmCGnl.js → session-binding-ZSMX1omP.js} +9 -2
- package/dist/{session-catalog-CEvoXWHA.js → session-catalog-DsKaezgR.js} +119 -96
- package/dist/{session-cli-XsEuWb_C.js → session-cli-CYJTfRLG.js} +2 -2
- package/dist/session-upstream-marker-D7XlI9us.js +82 -0
- package/dist/settled-turn-finalizer-DHltNgtF.js +303 -0
- package/dist/{shared-client-JiAnW6pc.js → shared-client-wmgNFNYp.js} +82 -13
- package/dist/{side-question-DqDvIwSU.js → side-question-BfFZCsJ-.js} +21 -15
- package/dist/{thread-lifecycle-CN_pPtPh.js → thread-lifecycle-cqrOlJkq.js} +157 -32
- package/dist/{transcript-mirror-D9rTxx2P.js → transcript-mirror-2p7kl6e4.js} +433 -145
- package/dist/upstream-session-fork-vPjwkT1i.js +320 -0
- package/dist/{usage-D5Rohxoc.js → usage-DM_I3mPT.js} +3 -3
- package/dist/{web-search-provider.runtime-CKVBn3fP.js → web-search-provider.runtime-Bx6HAc_k.js} +3 -3
- package/npm-shrinkwrap.json +38 -38
- package/openclaw.plugin.json +11 -1
- package/package.json +7 -7
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { G as isCodexAppServerPrewriteRequestCancellationError, H as isCodexAppServerConnectionClosedError,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as serializeCodexAppInventoryError, i as defaultCodexAppInventoryCache, t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-
|
|
1
|
+
import { G as isCodexAppServerPrewriteRequestCancellationError, H as isCodexAppServerConnectionClosedError, Q as isJsonObject, R as CodexAppServerRpcError, Z as flattenCodexDynamicToolFunctions, d as retireSharedCodexAppServerClientIfCurrent, n as clearSharedCodexAppServerClientIfCurrentAndUnclaimed, o as isCodexAppServerStartSelectionChangedError, q as resolveCodexAppServerClientInstanceId, t as clearSharedCodexAppServerClientIfCurrent, z as getCodexAppServerClientInstanceId } from "./shared-client-wmgNFNYp.js";
|
|
2
|
+
import { E as resolveCodexPluginsPolicy, a as hashCodexAppServerBindingFingerprint, c as reclaimCurrentCodexSessionGeneration, d as CODEX_PLUGINS_MARKETPLACE_NAME, f as CODEX_PLUGINS_WORKSPACE_MARKETPLACE_NAME, g as codexSandboxPolicyForTurn, i as createCodexSessionGenerationSupersededError, l as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced, o as isCodexAppServerNativeAuthProfile, s as normalizeCodexAppServerBindingModelProvider } from "./session-binding-ZSMX1omP.js";
|
|
3
|
+
import { _ as assertCodexThreadStartResponse, a as projectBoundedCodexThreadHistory, g as assertCodexThreadResumeResponse, h as assertCodexThreadForkResponse } from "./transcript-mirror-2p7kl6e4.js";
|
|
4
|
+
import { a as serializeCodexAppInventoryError, i as defaultCodexAppInventoryCache, t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-CvzvmBRz.js";
|
|
5
|
+
import { t as isIncognitoSessionKey } from "./incognito-session-ET_ufDH-.js";
|
|
5
6
|
import { sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
6
7
|
import * as crypto$1 from "node:crypto";
|
|
7
8
|
import crypto from "node:crypto";
|
|
@@ -13,6 +14,82 @@ import { isDiagnosticFlagEnabled } from "openclaw/plugin-sdk/diagnostic-runtime"
|
|
|
13
14
|
import { listRegisteredPluginAgentPromptGuidance } from "openclaw/plugin-sdk/plugin-runtime";
|
|
14
15
|
import { GPT5_HEARTBEAT_PROMPT_OVERLAY } from "openclaw/plugin-sdk/provider-model-shared";
|
|
15
16
|
import { INLINE_IMAGE_DATA_URL_PREFIX, sanitizeInlineImageDataUrl } from "openclaw/plugin-sdk/inline-image-data-url-runtime";
|
|
17
|
+
//#region extensions/codex/src/app-server/event-projector-values.ts
|
|
18
|
+
function readString(record, key) {
|
|
19
|
+
const value = record[key];
|
|
20
|
+
return typeof value === "string" ? value : void 0;
|
|
21
|
+
}
|
|
22
|
+
function normalizeNonEmptyString(value) {
|
|
23
|
+
if (typeof value !== "string") return;
|
|
24
|
+
return value.trim() || void 0;
|
|
25
|
+
}
|
|
26
|
+
function readNonEmptyString(record, key) {
|
|
27
|
+
return normalizeNonEmptyString(record[key]);
|
|
28
|
+
}
|
|
29
|
+
function readNonEmptyStringArray(record, key) {
|
|
30
|
+
const value = record[key];
|
|
31
|
+
if (!Array.isArray(value)) return [];
|
|
32
|
+
const entries = [];
|
|
33
|
+
for (const entry of value) {
|
|
34
|
+
const normalized = normalizeNonEmptyString(entry);
|
|
35
|
+
if (normalized) entries.push(normalized);
|
|
36
|
+
}
|
|
37
|
+
return entries;
|
|
38
|
+
}
|
|
39
|
+
function readNullableString(record, key) {
|
|
40
|
+
const value = record[key];
|
|
41
|
+
if (value === null) return null;
|
|
42
|
+
return typeof value === "string" ? value : void 0;
|
|
43
|
+
}
|
|
44
|
+
function readNumber(record, key) {
|
|
45
|
+
const value = record[key];
|
|
46
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
47
|
+
}
|
|
48
|
+
function readNonNegativeInteger(record, key) {
|
|
49
|
+
const value = readNumber(record, key);
|
|
50
|
+
return value !== void 0 && Number.isInteger(value) && value >= 0 ? value : void 0;
|
|
51
|
+
}
|
|
52
|
+
function readCodexErrorNotificationMessage(record) {
|
|
53
|
+
const error = record.error;
|
|
54
|
+
return isJsonObject(error) ? readString(error, "message") : void 0;
|
|
55
|
+
}
|
|
56
|
+
function readHookOutputEntries(value) {
|
|
57
|
+
if (!Array.isArray(value)) return [];
|
|
58
|
+
return value.flatMap((entry) => {
|
|
59
|
+
if (!isJsonObject(entry)) return [];
|
|
60
|
+
const text = readString(entry, "text");
|
|
61
|
+
if (!text) return [];
|
|
62
|
+
const kind = readString(entry, "kind");
|
|
63
|
+
return [{
|
|
64
|
+
...kind ? { kind } : {},
|
|
65
|
+
text
|
|
66
|
+
}];
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function splitPlanText(text) {
|
|
70
|
+
return text.split(/\r?\n/).map((line) => line.trim().replace(/^[-*]\s+/, "")).filter((line) => line.length > 0);
|
|
71
|
+
}
|
|
72
|
+
function extractRawAssistantText(item) {
|
|
73
|
+
return (Array.isArray(item.content) ? item.content : []).flatMap((entry) => {
|
|
74
|
+
if (!isJsonObject(entry)) return [];
|
|
75
|
+
const type = readString(entry, "type");
|
|
76
|
+
if (type !== "output_text" && type !== "text") return [];
|
|
77
|
+
const value = readString(entry, "text");
|
|
78
|
+
return value ? [value] : [];
|
|
79
|
+
}).join("").trim() || void 0;
|
|
80
|
+
}
|
|
81
|
+
function readItemString(item, key) {
|
|
82
|
+
const value = item[key];
|
|
83
|
+
return typeof value === "string" ? value : void 0;
|
|
84
|
+
}
|
|
85
|
+
function readItem(value) {
|
|
86
|
+
if (!isJsonObject(value)) return;
|
|
87
|
+
const type = typeof value.type === "string" ? value.type : void 0;
|
|
88
|
+
const id = typeof value.id === "string" ? value.id : void 0;
|
|
89
|
+
if (!type || !id) return;
|
|
90
|
+
return value;
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
16
93
|
//#region extensions/codex/src/app-server/plugin-inventory.ts
|
|
17
94
|
/**
|
|
18
95
|
* Reads Codex plugin marketplace state and app inventory to decide which
|
|
@@ -864,13 +941,9 @@ function resolveCodexContextEngineProjectionMaxChars(params) {
|
|
|
864
941
|
reserveTokens: params.reserveTokens
|
|
865
942
|
}) * APPROX_RENDERED_CHARS_PER_TOKEN);
|
|
866
943
|
}
|
|
867
|
-
/**
|
|
868
|
-
function resolveCodexContextEngineProjectionReserveTokens(
|
|
869
|
-
|
|
870
|
-
const configuredReserveTokens = toNonNegativeInt(asRecord(compaction)?.reserveTokens);
|
|
871
|
-
const configuredReserveTokensFloor = toNonNegativeInt(asRecord(compaction)?.reserveTokensFloor);
|
|
872
|
-
if (configuredReserveTokens !== void 0) return Math.max(configuredReserveTokens, configuredReserveTokensFloor ?? DEFAULT_CODEX_PROJECTION_RESERVE_TOKENS);
|
|
873
|
-
if (configuredReserveTokensFloor !== void 0) return configuredReserveTokensFloor;
|
|
944
|
+
/** Returns the fixed reserve used for Codex context-engine projections. */
|
|
945
|
+
function resolveCodexContextEngineProjectionReserveTokens() {
|
|
946
|
+
return DEFAULT_CODEX_PROJECTION_RESERVE_TOKENS;
|
|
874
947
|
}
|
|
875
948
|
/** Fits projected context prompts under Codex app-server turn/start text limits. */
|
|
876
949
|
function fitCodexProjectedContextForTurnStart(params) {
|
|
@@ -918,13 +991,6 @@ function resolveProjectionPromptBudgetTokens(params) {
|
|
|
918
991
|
const effectiveReserveTokens = Math.min(requestedReserveTokens, Math.max(0, params.contextTokenBudget - minPromptBudget));
|
|
919
992
|
return Math.max(1, params.contextTokenBudget - effectiveReserveTokens);
|
|
920
993
|
}
|
|
921
|
-
function asRecord(value) {
|
|
922
|
-
return value && typeof value === "object" ? value : void 0;
|
|
923
|
-
}
|
|
924
|
-
function toNonNegativeInt(value) {
|
|
925
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) return;
|
|
926
|
-
return Math.floor(value);
|
|
927
|
-
}
|
|
928
994
|
function dropDuplicateTrailingPrompt(messages, prompt) {
|
|
929
995
|
if (!prompt) return messages;
|
|
930
996
|
const trailing = messages.at(-1);
|
|
@@ -1086,7 +1152,7 @@ function buildContextEngineBinding(params, projection) {
|
|
|
1086
1152
|
contextTokenBudget: params.contextTokenBudget,
|
|
1087
1153
|
projectionMaxChars: resolveCodexContextEngineProjectionMaxChars({
|
|
1088
1154
|
contextTokenBudget: params.contextTokenBudget,
|
|
1089
|
-
reserveTokens: resolveCodexContextEngineProjectionReserveTokens(
|
|
1155
|
+
reserveTokens: resolveCodexContextEngineProjectionReserveTokens()
|
|
1090
1156
|
})
|
|
1091
1157
|
}),
|
|
1092
1158
|
projection: projection ? buildContextEngineProjectionBinding(projection) : void 0
|
|
@@ -1189,6 +1255,10 @@ function stabilizeJsonValue(value) {
|
|
|
1189
1255
|
function readActiveCodexTurnIds(thread) {
|
|
1190
1256
|
return (thread.turns ?? []).filter((turn) => turn.status === "inProgress").map((turn) => typeof turn.id === "string" ? turn.id : "").filter((turnId) => turnId.trim().length > 0);
|
|
1191
1257
|
}
|
|
1258
|
+
function readActiveCodexTurnIdsFromResume(response) {
|
|
1259
|
+
const pagedTurns = response.initialTurnsPage?.data;
|
|
1260
|
+
return readActiveCodexTurnIds(Array.isArray(pagedTurns) ? { turns: pagedTurns } : response.thread);
|
|
1261
|
+
}
|
|
1192
1262
|
const LEGACY_EMPTY_DYNAMIC_TOOLS_FINGERPRINT = legacyFingerprintDynamicTools([]);
|
|
1193
1263
|
const EMPTY_DYNAMIC_TOOLS_FINGERPRINT = hashCodexAppServerBindingFingerprint(LEGACY_EMPTY_DYNAMIC_TOOLS_FINGERPRINT);
|
|
1194
1264
|
function areDynamicToolFingerprintsCompatible(previous, next, nextLegacy) {
|
|
@@ -1345,6 +1415,11 @@ const CODEX_APP_SERVER_OWNED_DYNAMIC_TOOL_EXCLUDES = [
|
|
|
1345
1415
|
"tool_search",
|
|
1346
1416
|
"tool_search_code"
|
|
1347
1417
|
];
|
|
1418
|
+
const CODEX_NATIVE_GOAL_TOOL_EXCLUDES = [
|
|
1419
|
+
"get_goal",
|
|
1420
|
+
"create_goal",
|
|
1421
|
+
"update_goal"
|
|
1422
|
+
];
|
|
1348
1423
|
const CODEX_APP_SERVER_OWNED_SHELL_TOOL_EXCLUDES = /* @__PURE__ */ new Set(["exec", "process"]);
|
|
1349
1424
|
const DYNAMIC_TOOL_NAME_ALIASES = {
|
|
1350
1425
|
bash: "exec",
|
|
@@ -1400,6 +1475,7 @@ function filterCodexDynamicToolsWithOpenClawShell(tools, config, env = process.e
|
|
|
1400
1475
|
}
|
|
1401
1476
|
function filterCodexDynamicToolsWithOptions(tools, config, env, options) {
|
|
1402
1477
|
const excludes = /* @__PURE__ */ new Set();
|
|
1478
|
+
for (const name of CODEX_NATIVE_GOAL_TOOL_EXCLUDES) excludes.add(name);
|
|
1403
1479
|
if (!isForcedPrivateQaCodexRuntime(env)) for (const name of CODEX_APP_SERVER_OWNED_DYNAMIC_TOOL_EXCLUDES) {
|
|
1404
1480
|
if (options.preserveOpenClawShell && CODEX_APP_SERVER_OWNED_SHELL_TOOL_EXCLUDES.has(name)) continue;
|
|
1405
1481
|
excludes.add(name);
|
|
@@ -1746,12 +1822,17 @@ const CODEX_CODE_MODE_THREAD_CONFIG = {
|
|
|
1746
1822
|
"features.code_mode_only": false,
|
|
1747
1823
|
"features.apply_patch_streaming_events": true
|
|
1748
1824
|
};
|
|
1825
|
+
const CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG = { "features.goals": false };
|
|
1749
1826
|
const CODEX_CODE_MODE_DISABLED_THREAD_CONFIG = {
|
|
1750
1827
|
"features.code_mode": false,
|
|
1751
1828
|
"features.code_mode_only": false
|
|
1752
1829
|
};
|
|
1753
1830
|
const CODEX_LIGHTWEIGHT_CONTEXT_THREAD_CONFIG = { project_doc_max_bytes: 0 };
|
|
1754
1831
|
const CODEX_TOOL_SEARCH_UNSUPPORTED_THREAD_CONFIG = { "features.multi_agent": false };
|
|
1832
|
+
const CODEX_DELEGATION_DISABLED_THREAD_CONFIG = {
|
|
1833
|
+
"features.multi_agent": false,
|
|
1834
|
+
"features.multi_agent_v2": false
|
|
1835
|
+
};
|
|
1755
1836
|
const CODEX_RING_ZERO_THREAD_CONFIG = {
|
|
1756
1837
|
"features.apps": false,
|
|
1757
1838
|
"features.current_time_reminder": false,
|
|
@@ -1851,7 +1932,8 @@ function buildThreadStartParams(params, options) {
|
|
|
1851
1932
|
...resolveCodexThreadEnvironmentSelection(options),
|
|
1852
1933
|
developerInstructions: options.developerInstructions ?? buildDeveloperInstructions(params, { dynamicTools: options.dynamicTools }),
|
|
1853
1934
|
dynamicTools: [...options.dynamicTools],
|
|
1854
|
-
experimentalRawEvents: true
|
|
1935
|
+
experimentalRawEvents: true,
|
|
1936
|
+
...isIncognitoSessionKey(params.sessionKey) ? { ephemeral: true } : {}
|
|
1855
1937
|
};
|
|
1856
1938
|
}
|
|
1857
1939
|
function buildThreadResumeParams(params, options) {
|
|
@@ -1871,6 +1953,12 @@ function buildThreadResumeParams(params, options) {
|
|
|
1871
1953
|
});
|
|
1872
1954
|
return {
|
|
1873
1955
|
threadId: options.threadId,
|
|
1956
|
+
excludeTurns: true,
|
|
1957
|
+
initialTurnsPage: {
|
|
1958
|
+
limit: 1,
|
|
1959
|
+
sortDirection: "desc",
|
|
1960
|
+
itemsView: "notLoaded"
|
|
1961
|
+
},
|
|
1874
1962
|
...modelSelection ? {
|
|
1875
1963
|
model: modelSelection.model,
|
|
1876
1964
|
...modelSelection.modelProvider ? { modelProvider: modelSelection.modelProvider } : {}
|
|
@@ -1899,15 +1987,19 @@ function buildCodexRuntimeThreadConfig(config, options = {}) {
|
|
|
1899
1987
|
"features.code_mode_only": options.nativeCodeModeOnlyEnabled === true
|
|
1900
1988
|
};
|
|
1901
1989
|
if (options.nativeCodeModeEnabled === false) {
|
|
1902
|
-
const disabledConfig = mergeCodexThreadConfigs(config, CODEX_CODE_MODE_DISABLED_THREAD_CONFIG) ?? { ...CODEX_CODE_MODE_DISABLED_THREAD_CONFIG };
|
|
1990
|
+
const disabledConfig = mergeCodexThreadConfigs(config, CODEX_CODE_MODE_DISABLED_THREAD_CONFIG, CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG) ?? { ...CODEX_CODE_MODE_DISABLED_THREAD_CONFIG };
|
|
1903
1991
|
delete disabledConfig["features.apply_patch_streaming_events"];
|
|
1904
1992
|
return disabledConfig;
|
|
1905
1993
|
}
|
|
1906
|
-
if (options.nativeCodeModeOnlyEnabled === true) return ensureDirectOnlyToolNamespaces(mergeCodexThreadConfigs(codeModeConfig, config, { "features.code_mode_only": true }) ?? {
|
|
1994
|
+
if (options.nativeCodeModeOnlyEnabled === true) return ensureDirectOnlyToolNamespaces(mergeCodexThreadConfigs(codeModeConfig, config, CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG, { "features.code_mode_only": true }) ?? {
|
|
1907
1995
|
...codeModeConfig,
|
|
1996
|
+
...CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG,
|
|
1908
1997
|
"features.code_mode_only": true
|
|
1909
1998
|
}, options.directOnlyToolNamespaces);
|
|
1910
|
-
return ensureDirectOnlyToolNamespaces(mergeCodexThreadConfigs(codeModeConfig, config) ?? {
|
|
1999
|
+
return ensureDirectOnlyToolNamespaces(mergeCodexThreadConfigs(codeModeConfig, config, CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG) ?? {
|
|
2000
|
+
...codeModeConfig,
|
|
2001
|
+
...CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG
|
|
2002
|
+
}, options.directOnlyToolNamespaces);
|
|
1911
2003
|
}
|
|
1912
2004
|
function ensureDirectOnlyToolNamespaces(config, requiredNamespaces) {
|
|
1913
2005
|
if (!requiredNamespaces?.length) return config;
|
|
@@ -1934,7 +2026,7 @@ function buildCodexRuntimeThreadConfigForRun(params, config, options = {}) {
|
|
|
1934
2026
|
webSearchAllowed: options.webSearchAllowed
|
|
1935
2027
|
}).threadConfig;
|
|
1936
2028
|
const baseConfig = buildCodexRuntimeThreadConfig(mergeCodexThreadConfigs(config, webSearchConfig), options);
|
|
1937
|
-
const runtimeConfig = mergeCodexThreadConfigs(baseConfig, options.appServer?.networkProxy?.configPatch, shouldDisableCodexToolSearchForModel(params.modelId) ? CODEX_TOOL_SEARCH_UNSUPPORTED_THREAD_CONFIG : void 0, buildCodexRingZeroThreadConfigPatch(params, options.hostSystemAgentActive, ringZeroMcpServerNames)) ?? baseConfig;
|
|
2029
|
+
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, buildCodexRingZeroThreadConfigPatch(params, options.hostSystemAgentActive, ringZeroMcpServerNames)) ?? baseConfig;
|
|
1938
2030
|
if (params.bootstrapContextMode !== "lightweight") return runtimeConfig;
|
|
1939
2031
|
return mergeCodexThreadConfigs(runtimeConfig, CODEX_LIGHTWEIGHT_CONTEXT_THREAD_CONFIG) ?? {
|
|
1940
2032
|
...runtimeConfig,
|
|
@@ -2153,7 +2245,7 @@ async function resumeExistingCodexThread(params, context) {
|
|
|
2153
2245
|
threadId: response.thread.id,
|
|
2154
2246
|
action: "resumed"
|
|
2155
2247
|
});
|
|
2156
|
-
const activeTurnIds =
|
|
2248
|
+
const activeTurnIds = readActiveCodexTurnIdsFromResume(response);
|
|
2157
2249
|
return {
|
|
2158
2250
|
...resumeBinding,
|
|
2159
2251
|
threadId: response.thread.id,
|
|
@@ -2183,6 +2275,7 @@ async function resumeExistingCodexThread(params, context) {
|
|
|
2183
2275
|
}
|
|
2184
2276
|
}
|
|
2185
2277
|
async function startFreshCodexThread(params, context) {
|
|
2278
|
+
const clientId = resolveCodexAppServerClientInstanceId(params.client);
|
|
2186
2279
|
const { bindingIdentity, startModelSelection, startModelProvider, userMcpServersConfigPatch, dynamicToolsFingerprint, dynamicToolsContainDeferred, webSearchThreadConfigFingerprint, userMcpServersFingerprint, ringZeroConfigFingerprint, ringZeroClientInstanceId, networkProxyConfigFingerprint, contextEngineBinding, environmentSelectionFingerprint, hostSystemAgentActive, ringZeroActive, ringZeroInheritedMcpServerNames, lifecycleTiming, normalizeBindingModelProvider, throwIfAborted, prebuiltPluginThreadConfig, preserveExistingBinding, rotatedContextEngineBinding } = context;
|
|
2187
2280
|
const pluginThreadConfig = params.pluginThreadConfig?.enabled ? prebuiltPluginThreadConfig ?? await lifecycleTiming.measure("plugin-config-build", () => params.pluginThreadConfig?.build()) : void 0;
|
|
2188
2281
|
const finalConfigPatch = params.buildFinalConfigPatch?.({ action: "start" }) ?? {
|
|
@@ -2236,6 +2329,7 @@ async function startFreshCodexThread(params, context) {
|
|
|
2236
2329
|
if: { kind: "absent" },
|
|
2237
2330
|
binding: {
|
|
2238
2331
|
threadId: response.thread.id,
|
|
2332
|
+
...clientId ? { clientId } : {},
|
|
2239
2333
|
cwd: params.cwd,
|
|
2240
2334
|
authProfileId: params.params.authProfileId,
|
|
2241
2335
|
model: response.model ?? startParams.model ?? params.params.modelId,
|
|
@@ -2278,6 +2372,7 @@ async function startFreshCodexThread(params, context) {
|
|
|
2278
2372
|
});
|
|
2279
2373
|
return {
|
|
2280
2374
|
threadId: response.thread.id,
|
|
2375
|
+
...clientId ? { clientId } : {},
|
|
2281
2376
|
cwd: params.cwd,
|
|
2282
2377
|
authProfileId: params.params.authProfileId,
|
|
2283
2378
|
model: response.model ?? startParams.model ?? params.params.modelId,
|
|
@@ -2600,7 +2695,7 @@ function buildPendingSupervisionProbeForkParams(params, pending) {
|
|
|
2600
2695
|
...params.appServer.serviceTier !== void 0 ? { serviceTier: params.appServer.serviceTier } : {},
|
|
2601
2696
|
config: runtimeConfig,
|
|
2602
2697
|
developerInstructions: params.developerInstructions ?? buildDeveloperInstructions(params.attempt, { dynamicTools: params.dynamicTools }),
|
|
2603
|
-
ephemeral:
|
|
2698
|
+
ephemeral: isIncognitoSessionKey(params.attempt.sessionKey),
|
|
2604
2699
|
threadSource: "appServer",
|
|
2605
2700
|
excludeTurns: true
|
|
2606
2701
|
};
|
|
@@ -2716,6 +2811,8 @@ async function archiveSupervisionArtifact(client, threadId) {
|
|
|
2716
2811
|
//#endregion
|
|
2717
2812
|
//#region extensions/codex/src/app-server/thread-lifecycle-run.ts
|
|
2718
2813
|
async function startOrResumeThread(params) {
|
|
2814
|
+
const incognito = isIncognitoSessionKey(params.params.sessionKey);
|
|
2815
|
+
const clientId = resolveCodexAppServerClientInstanceId(params.client);
|
|
2719
2816
|
const bindingIdentity = sessionBindingIdentity({
|
|
2720
2817
|
sessionId: params.params.sessionId,
|
|
2721
2818
|
sessionKey: params.params.sessionKey,
|
|
@@ -2783,7 +2880,7 @@ async function startOrResumeThread(params) {
|
|
|
2783
2880
|
bindingStore: params.bindingStore,
|
|
2784
2881
|
identity: bindingIdentity,
|
|
2785
2882
|
config: params.params.config
|
|
2786
|
-
}))) throw
|
|
2883
|
+
}))) throw createCodexSessionGenerationSupersededError(bindingIdentity.sessionId);
|
|
2787
2884
|
}
|
|
2788
2885
|
if (binding?.pendingSupervisionBranch) {
|
|
2789
2886
|
const pendingBinding = binding;
|
|
@@ -2816,6 +2913,7 @@ async function startOrResumeThread(params) {
|
|
|
2816
2913
|
normalizeBindingModelProvider,
|
|
2817
2914
|
bindingPatch: {
|
|
2818
2915
|
cwd: params.cwd,
|
|
2916
|
+
...clientId ? { clientId } : {},
|
|
2819
2917
|
authProfileId: void 0,
|
|
2820
2918
|
preserveNativeModel: true,
|
|
2821
2919
|
dynamicToolsFingerprint,
|
|
@@ -2884,7 +2982,8 @@ async function startOrResumeThread(params) {
|
|
|
2884
2982
|
config: params.params.config
|
|
2885
2983
|
});
|
|
2886
2984
|
const startModelProvider = startModelSelection.modelProvider;
|
|
2887
|
-
|
|
2985
|
+
const transientDelegationRestriction = params.params.delegationCapability === "report_only";
|
|
2986
|
+
let preserveExistingBinding = transientDelegationRestriction || !ringZeroActive && params.nativeProviderWebSearchSupport === "unknown" && !binding?.threadId;
|
|
2888
2987
|
let rotatedContextEngineBinding = false;
|
|
2889
2988
|
let prebuiltPluginThreadConfig;
|
|
2890
2989
|
const webSearchBindingChanged = binding?.threadId && binding.webSearchThreadConfigFingerprint !== webSearchThreadConfigFingerprint;
|
|
@@ -2922,6 +3021,11 @@ async function startOrResumeThread(params) {
|
|
|
2922
3021
|
preserveExistingBinding = true;
|
|
2923
3022
|
binding = void 0;
|
|
2924
3023
|
}
|
|
3024
|
+
if (binding?.threadId && transientDelegationRestriction) {
|
|
3025
|
+
assertCodexBindingMayBeReplaced(binding, "starting a delegation-restricted turn");
|
|
3026
|
+
embeddedAgentLog.debug("codex app-server delegation restricted for turn; starting transient thread", { threadId: binding.threadId });
|
|
3027
|
+
binding = void 0;
|
|
3028
|
+
}
|
|
2925
3029
|
if (binding?.threadId && (binding.contextEngine || contextEngineBinding)) {
|
|
2926
3030
|
if (!contextEngineBinding || !isContextEngineBindingCompatible(binding.contextEngine, contextEngineBinding)) {
|
|
2927
3031
|
embeddedAgentLog.debug("codex app-server context-engine binding changed; starting a new thread", {
|
|
@@ -3003,6 +3107,28 @@ async function startOrResumeThread(params) {
|
|
|
3003
3107
|
embeddedAgentLog.debug("codex app-server dynamic tool catalog changed; starting a new thread", { threadId: binding.threadId });
|
|
3004
3108
|
await clearCurrentBinding("rotating a stale thread binding");
|
|
3005
3109
|
}
|
|
3110
|
+
} else if (incognito) {
|
|
3111
|
+
if (binding.clientId && binding.clientId === clientId) {
|
|
3112
|
+
params.buildFinalConfigPatch?.({
|
|
3113
|
+
action: "resume",
|
|
3114
|
+
binding
|
|
3115
|
+
});
|
|
3116
|
+
throwIfAborted();
|
|
3117
|
+
lifecycleTiming.mark("thread-ready");
|
|
3118
|
+
lifecycleTiming.logSummary({
|
|
3119
|
+
runId: params.params.runId,
|
|
3120
|
+
sessionId: params.params.sessionId,
|
|
3121
|
+
sessionKey: params.params.sessionKey,
|
|
3122
|
+
threadId: binding.threadId,
|
|
3123
|
+
action: "resumed"
|
|
3124
|
+
});
|
|
3125
|
+
return {
|
|
3126
|
+
...binding,
|
|
3127
|
+
lifecycle: { action: "resumed" }
|
|
3128
|
+
};
|
|
3129
|
+
}
|
|
3130
|
+
await clearCurrentBinding("rotating an unavailable ephemeral thread binding");
|
|
3131
|
+
binding = void 0;
|
|
3006
3132
|
} else {
|
|
3007
3133
|
const resumed = await resumeExistingCodexThread(params, {
|
|
3008
3134
|
binding,
|
|
@@ -3168,8 +3294,7 @@ function buildTurnStartParams(params, options) {
|
|
|
3168
3294
|
model: modelSelection.model,
|
|
3169
3295
|
turnScopedDeveloperInstructions: options.turnScopedDeveloperInstructions,
|
|
3170
3296
|
skillsCollaborationInstructions: options.skillsCollaborationInstructions,
|
|
3171
|
-
memoryCollaborationInstructions: options.memoryCollaborationInstructions
|
|
3172
|
-
heartbeatCollaborationInstructions: options.heartbeatCollaborationInstructions
|
|
3297
|
+
memoryCollaborationInstructions: options.memoryCollaborationInstructions
|
|
3173
3298
|
}) } : {}
|
|
3174
3299
|
};
|
|
3175
3300
|
}
|
|
@@ -3187,7 +3312,7 @@ function buildTurnCollaborationMode(params, options = {}) {
|
|
|
3187
3312
|
function buildTurnScopedCollaborationInstructions(params, options = {}) {
|
|
3188
3313
|
const contextInstructions = joinPresentSections(options.turnScopedDeveloperInstructions, options.memoryCollaborationInstructions, options.skillsCollaborationInstructions);
|
|
3189
3314
|
if (params.trigger === "cron") return joinPresentSections(buildCronCollaborationInstructions(), contextInstructions);
|
|
3190
|
-
if (params.trigger === "heartbeat" && params.bootstrapContextRunKind !== "commitment-only") return joinPresentSections(buildHeartbeatCollaborationInstructions(), contextInstructions
|
|
3315
|
+
if (params.trigger === "heartbeat" && params.bootstrapContextRunKind !== "commitment-only") return joinPresentSections(buildHeartbeatCollaborationInstructions(), contextInstructions);
|
|
3191
3316
|
if (contextInstructions?.trim()) return joinPresentSections(buildDefaultCollaborationInstructions(), contextInstructions);
|
|
3192
3317
|
return null;
|
|
3193
3318
|
}
|
|
@@ -3225,4 +3350,4 @@ function joinPresentSections(...sections) {
|
|
|
3225
3350
|
return sections.filter((section) => Boolean(section?.trim())).join("\n\n");
|
|
3226
3351
|
}
|
|
3227
3352
|
//#endregion
|
|
3228
|
-
export {
|
|
3353
|
+
export { shouldBuildCodexPluginThreadConfig as $, resolveCodexDynamicToolsLoading as A, codexDynamicToolsFingerprint as B, readCodexSupportedReasoningEfforts as C, isForcedPrivateQaCodexRuntime as D, filterCodexDynamicToolsWithOpenClawShell as E, closeCodexStartupClientBestEffort as F, projectContextEngineAssemblyForCodex as G, buildContextEngineBinding as H, interruptCodexTurnBestEffort as I, buildCodexPluginAppsConfigPatchFromPolicyContext as J, resolveCodexContextEngineProjectionMaxChars as K, retireCodexAppServerClientAfterTimedOutTurn as L, CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS as M, CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS as N, isSystemAgentOnlyCodexDynamicToolAllowlist as O, CodexAppServerUnsafeSubscriptionError as P, mergeCodexThreadConfigs as Q, unsubscribeCodexThreadBestEffort as R, resolveReasoningEffort as S, filterCodexDynamicTools as T, isContextEngineBindingCompatible as U, codexLegacyDynamicToolsFingerprint as V, fitCodexProjectedContextForTurnStart as W, buildCodexPluginThreadConfigInputFingerprint as X, buildCodexPluginThreadConfig as Y, buildCodexPluginThreadConfigTimeoutFallback as Z, CODEX_NATIVE_PERSONALITY_NONE as _, sanitizeCodexHistoryImagePayloads as a, readCodexErrorNotificationMessage as at, resolveCodexAppServerThreadModelSelection as b, resumeCodexAppServerThread as c, readItemString as ct, buildCodexRingZeroThreadConfigPatch as d, readNonNegativeInteger as dt, ensureCodexPluginActivation as et, buildCodexRuntimeThreadConfig as f, readNullableString as ft, buildDeveloperInstructions as g, resolveCodexWebSearchPlan as h, splitPlanText as ht, invalidInlineImageText as i, normalizeNonEmptyString as it, resolveCodexDynamicToolsLoadingForRuntime as j, normalizeCodexDynamicToolName as k, assertCodexRingZeroHasNoManagedHooks as l, readNonEmptyString as lt, buildCodexNativeWebSearchThreadConfig as m, readString as mt, buildTurnStartParams as n, resolveRecoverableCodexPluginConfigKeys as nt, sanitizeInlineImageDataUrl$1 as o, readHookOutputEntries as ot, readCodexInheritedMcpServerNames as p, readNumber as pt, resolveCodexContextEngineProjectionReserveTokens as q, buildCodexUserInput as r, extractRawAssistantText as rt, startOrResumeThread as s, readItem as st, buildTurnCollaborationMode as t, pluginReadParams as tt, attestCodexRingZeroThreadHasNoMcpServers as u, readNonEmptyStringArray as ut, resolveCodexAppServerModelProvider as v, isCodexAppServerProfilerEnabled as w, resolveCodexBindingModelProviderFallback as x, resolveCodexAppServerRequestModelSelection as y, areCodexDynamicToolFingerprintsCompatible as z };
|