@openclaw/codex 2026.9.2 → 2026.9.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.
- package/README.md +2 -0
- package/dist/api.js +14 -19
- package/dist/apply-B6el6hdO.js +357 -0
- package/dist/{attempt-client-cleanup-Bp1ZOnk2.js → attempt-client-cleanup-D6cR54TV.js} +39 -19
- package/dist/{attempt-context-CSazkWns.js → attempt-context-AO4DSjE0.js} +8 -6
- package/dist/{event-projector-usage-ZqEVbAEY.js → attempt-notifications--H8zXR5-.js} +3 -106
- package/dist/auth-cache-key-Kq6oerr6.js +498 -0
- package/dist/auth-profile-CwzO4_RG.js +43 -0
- package/dist/auth-profile-selection-DFu9e167.js +45 -0
- package/dist/binding-connection-QqgcPCgk.js +60 -0
- package/dist/{bounded-turn-DxGJRYbY.js → bounded-turn-lRpmZHFv.js} +25 -122
- package/dist/build-state-6RL6qohz.js +19 -0
- package/dist/{capabilities-B1mgvpP8.js → capabilities-BeqLPbtM.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/client-BEKu4yDx.js +3983 -0
- package/dist/command-dispatch-CisT9Jqq.js +21 -0
- package/dist/{command-formatters-DSbGMXA0.js → command-formatters-DeTfrapr.js} +2 -2
- package/dist/{command-handlers-DOJvGv6-.js → command-handlers-BfIsJEuA.js} +31 -21
- package/dist/command-rpc-BMqRQOFX.js +226 -0
- package/dist/{compact-Y_xBqrHN.js → compact-CGJZ2rlb.js} +19 -14
- package/dist/config-JDfTI4VI.js +106 -0
- package/dist/{config-CyapYSji.js → config-options-jnIFvwxD.js} +204 -592
- package/dist/config-runtime-BWf6JLWG.js +11 -0
- package/dist/conversation-binding-CxOlHiix.js +889 -0
- package/dist/{plugin-marketplace-discovery-B7gHXJ3d.js → conversation-control-CUCrSIQI.js} +10 -142
- package/dist/doctor-contract-api.js +5 -5
- package/dist/{dynamic-tools-BwpvTxaX.js → dynamic-tools-D-JBoaLt.js} +66 -70
- package/dist/{effective-mcp-catalog-CY9Jn4bA.js → effective-mcp-catalog-J_5Ep5Um.js} +3 -3
- package/dist/{elicitation-input-DMkeki8d.js → elicitation-input-DPoK8F7w.js} +8 -22
- package/dist/ephemeral-turn-DSwzP8YY.js +101 -0
- package/dist/{event-projector-assistant-message-B9kp6iGC.js → event-projector-assistant-message-BmBM4qBV.js} +12 -25
- package/dist/event-projector-usage-CIyrYYid.js +102 -0
- package/dist/{harness-Czh2Sdoc.js → harness-FR6eQgyO.js} +31 -24
- package/dist/harness.js +1 -1
- package/dist/history-rejection-B4nOXNXF.js +13 -0
- package/dist/incognito-session-uhrBF6wJ.js +15 -0
- package/dist/index.js +411 -2875
- package/dist/{isolated-completion-CRh-51AK.js → isolated-completion-DHBefrzg.js} +7 -4
- package/dist/launch-args-RXQwn8zV.js +90 -0
- package/dist/{managed-binary-DcpnJF9x.js → managed-binary-DrjjRRUD.js} +4 -103
- package/dist/managed-thread-store-D1t5jh3G.js +66 -0
- package/dist/media-understanding-provider.js +4 -1
- package/dist/{model-catalog-DT5vo6qo.js → model-catalog-B_6M04Wo.js} +6 -5
- package/dist/{models-CcrgSMQR.js → models-P9k2qAof.js} +3 -3
- package/dist/native-execution-policy-umd0tgh4.js +128 -0
- package/dist/{native-subagent-monitor-B3bvQGcg.js → native-subagent-monitor-BbCUKRwC.js} +69 -42
- package/dist/node-cli-sessions-rj0ysJwM.js +527 -0
- package/dist/{node-exec-server.runtime-nfbUOtUB.js → node-exec-server.runtime-BY_ctYnT.js} +53 -22
- package/dist/plan-BMJdMOEF.js +711 -0
- package/dist/plugin-activation-BQK-f5sV.js +133 -0
- package/dist/{thread-resume-BLgqkUc1.js → plugin-app-cache-key-CdSQzWyX.js} +4 -52
- package/dist/{plugin-approval-roundtrip-aQVdyL5g.js → plugin-approval-roundtrip-DeW95wB5.js} +1 -1
- package/dist/plugin-inventory-CoRCzWW4.js +325 -0
- package/dist/plugin-marketplace-discovery-3akBizzF.js +134 -0
- package/dist/{plugin-metadata-cache-BwCLTY_U.js → plugin-metadata-cache-DgNfRAGA.js} +13 -9
- package/dist/protocol-CAAcVIKF.js +275 -0
- package/dist/{provider-capabilities-BpG9Ltc5.js → provider-capabilities-W4tfK5Y5.js} +2 -2
- package/dist/{rate-limits-Fx_l4eNa.js → rate-limits-Bqnx1N4z.js} +1 -1
- package/dist/request-CGvGOpeR.js +198 -0
- package/dist/{run-attempt-BzthFQSM.js → run-attempt-DwKds3DN.js} +589 -373
- package/dist/{runtime-artifact-Bh_gf6-t.js → runtime-artifact-T-NwqeSH.js} +27 -27
- package/dist/sandbox-guard-BcT66fWy.js +165 -0
- package/dist/{session-binding-4Ki04sW-.js → session-binding-CKSepwIC.js} +29 -47
- package/dist/{session-binding-record-CyaXZvTe.js → session-binding-record-CaZjYwNS.js} +11 -25
- package/dist/session-catalog-HaDcp7Sv.js +1533 -0
- package/dist/session-catalog-adoption-BKLtSrwi.js +251 -0
- package/dist/session-catalog-archive-D0i2pGj2.js +56 -0
- package/dist/session-catalog-home-id-D7-aLiNt.js +190 -0
- package/dist/session-catalog-node-adoption-BUuDYY8R.js +182 -0
- package/dist/session-catalog-node-continue-CBtc4wkI.js +238 -0
- package/dist/session-catalog-parsing-CdD3JhdM.js +280 -0
- package/dist/session-catalog-provenance-DkJHo735.js +124 -0
- package/dist/{session-cli-BjLhpmS1.js → session-cli-CbgaHh0f.js} +3 -2
- package/dist/{session-history-DWmMqiqW.js → session-history-Cz-tOOYj.js} +6 -3
- package/dist/{session-upstream-marker-DReTpGz6.js → session-history-import-DFN7sWRU.js} +5 -50
- package/dist/{session-history-read-LHldwvyh.js → session-history-read-cxPUxyVV.js} +21 -7
- package/dist/session-history-worker-runtime.js +18 -6
- package/dist/{session-history.worker-zZVcx0ME.js → session-history.worker-CNEvGaU5.js} +58 -51
- package/dist/session-history.worker.js +1 -1
- package/dist/{session-initialization-BCFVnLL4.js → session-initialization-Jo86C60I.js} +2 -2
- package/dist/{session-permission-policy-BaueHmSj.js → session-permission-policy-B22InTp_.js} +4 -7
- package/dist/{session-retirement-DNdmYdFc.js → session-retirement-BSNG_mhf.js} +6 -5
- package/dist/session-upstream-marker-D15C9NHp.js +46 -0
- package/dist/{settled-turn-context-BOM3Y1pl.js → settled-turn-context-Du6gdUDd.js} +9 -9
- package/dist/{settled-turn-finalizer-BI-b1sry.js → settled-turn-finalizer-BuLUrZl2.js} +7 -6
- package/dist/shared-client-CVhez2Uo.js +2911 -0
- package/dist/{side-question-B6DWAw1A.js → side-question-DLbr2vUU.js} +64 -169
- package/dist/source-Da-h6f7e.js +518 -0
- package/dist/thread-archive-guard-D1bP04Tf.js +53 -0
- package/dist/{thread-lifecycle-DPK30jad.js → thread-lifecycle-D1pzRwHB.js} +112 -616
- package/dist/{thread-ownership-CbucAmmp.js → thread-ownership-D6oASVRu.js} +13 -15
- package/dist/thread-policy-D8kI7yAO.js +54 -0
- package/dist/thread-resume-T5cveyxA.js +52 -0
- package/dist/timeout-BVw8aaM1.js +33 -0
- package/dist/{transcript-mirror-attestation-Byl34PC-.js → transcript-mirror-attestation-DibE0krH.js} +17 -4
- package/dist/{transcript-mirror-_njEB84z.js → transcript-mirror-t5TOccct.js} +50 -260
- package/dist/{transport-stdio-CzTngV0j.js → transport-stdio-BGjHoYLr.js} +73 -43
- package/dist/{upstream-session-fork-1fwbNKzQ.js → upstream-session-fork-De-sLJ2r.js} +26 -18
- package/dist/{usage-i9fv5-4m.js → usage-CPPTmBvZ.js} +4 -3
- package/dist/version-omm6IPI3.js +12 -0
- package/dist/{web-search-provider.runtime-DKQn67A7.js → web-search-provider.runtime-CSVgQL0w.js} +3 -3
- package/openclaw.plugin.json +22 -1
- package/package.json +4 -4
- package/dist/request-C8H22rPi.js +0 -475
- package/dist/session-catalog-B47uwekb.js +0 -3272
- package/dist/shared-client-CKhX2kFt.js +0 -7505
- package/dist/thread-policy-CTalhWFy.js +0 -105
- package/dist/{auth-binding-Ds_QVm-X.js → auth-binding-Co2Vfcf_.js} +1 -1
package/README.md
CHANGED
|
@@ -34,4 +34,6 @@ For a supervised branch, Codex App Server selects the snapshot fork's model and
|
|
|
34
34
|
|
|
35
35
|
The visible-history mirror keeps at most 200 user or assistant messages, 512 KiB total, and 64 KiB per message. Image inputs become `[Image attachment]`; image data and local paths are not copied.
|
|
36
36
|
|
|
37
|
+
When settled-turn recovery rejects history, the `codex settled-turn finalization context capture failed` warning includes a stable `reason`, such as `item_limit`, `byte_limit`, `field_limit`, `unsupported_user_image`, or `snapshot_invalidated`. Unknown failures use `history_read_failed`. The warning excludes transcript content and exception text. Rejected history remains unavailable for finalization, and completed actions are never replayed.
|
|
38
|
+
|
|
37
39
|
See the [Codex harness](https://docs.openclaw.ai/plugins/codex-harness) and [Codex supervision](https://docs.openclaw.ai/plugins/codex-supervision) guides.
|
package/dist/api.js
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import { a as resolveCodexAppServerStartOptionsForAgent
|
|
2
|
-
import { n as resolveManagedCodexAppServerStartOptions,
|
|
1
|
+
import { a as resolveCodexAppServerStartOptionsForAgent } from "./config-options-jnIFvwxD.js";
|
|
2
|
+
import { n as resolveManagedCodexAppServerStartOptions, r as resolveManagedCodexNativeCommand, t as isManagedCodexDesktopCommand } from "./managed-binary-DrjjRRUD.js";
|
|
3
|
+
import { t as CODEX_APP_SERVER_VERSION } from "./version-omm6IPI3.js";
|
|
4
|
+
import "./config-JDfTI4VI.js";
|
|
5
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-BWf6JLWG.js";
|
|
3
6
|
import { listAgentIds, resolveAgentDir } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
4
7
|
import path from "node:path";
|
|
5
|
-
import { resolveDefaultModelForAgent } from "openclaw/plugin-sdk/agent-runtime";
|
|
6
8
|
import { execFile } from "node:child_process";
|
|
7
9
|
import { fileURLToPath } from "node:url";
|
|
10
|
+
import { promisify } from "node:util";
|
|
11
|
+
import { resolveDefaultModelForAgent } from "openclaw/plugin-sdk/agent-runtime";
|
|
8
12
|
import { resolveEffectiveAgentRuntime } from "openclaw/plugin-sdk/command-auth-native";
|
|
9
13
|
//#region extensions/codex/src/doctor.ts
|
|
10
14
|
const CODEX_MANAGED_APP_SERVER_CHECK_ID = "codex/managed-app-server";
|
|
11
15
|
const CODEX_VERSION_TIMEOUT_MS = 5e3;
|
|
12
16
|
const CODEX_VERSION_MAX_BUFFER_BYTES = 65536;
|
|
17
|
+
const execFileAsync = promisify(execFile);
|
|
13
18
|
function managedCodexFinding(params) {
|
|
14
19
|
return {
|
|
15
20
|
checkId: CODEX_MANAGED_APP_SERVER_CHECK_ID,
|
|
@@ -28,22 +33,12 @@ function parseCodexVersion(output) {
|
|
|
28
33
|
return /(?:^|\s)(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)(?:\s|$)/u.exec(output)?.[1];
|
|
29
34
|
}
|
|
30
35
|
function runVersionCommand(command) {
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, (error, stdout, stderr) => {
|
|
38
|
-
if (error) {
|
|
39
|
-
reject(new Error(readErrorMessage(error), { cause: error }));
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
resolve({
|
|
43
|
-
stdout,
|
|
44
|
-
stderr
|
|
45
|
-
});
|
|
46
|
-
});
|
|
36
|
+
return execFileAsync(command, ["--version"], {
|
|
37
|
+
encoding: "utf8",
|
|
38
|
+
maxBuffer: CODEX_VERSION_MAX_BUFFER_BYTES,
|
|
39
|
+
timeout: CODEX_VERSION_TIMEOUT_MS,
|
|
40
|
+
killSignal: "SIGKILL",
|
|
41
|
+
windowsHide: true
|
|
47
42
|
});
|
|
48
43
|
}
|
|
49
44
|
function createCodexManagedAppServerHealthCheck(params) {
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { m as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config-utils-C57JiJrU.js";
|
|
2
|
+
import { x as readCodexPluginConfig } from "./protocol-CAAcVIKF.js";
|
|
3
|
+
import { s as resolveCodexAppServerFallbackApiKeyCacheKey } from "./auth-cache-key-Kq6oerr6.js";
|
|
4
|
+
import { r as buildCodexPluginAppCacheKey, s as defaultCodexAppInventoryCache } from "./plugin-app-cache-key-CdSQzWyX.js";
|
|
5
|
+
import { i as requestCodexAppServerJson } from "./request-CGvGOpeR.js";
|
|
6
|
+
import "./config-JDfTI4VI.js";
|
|
7
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-BWf6JLWG.js";
|
|
8
|
+
import { i as resolveCodexAppServerAuthProfileIdForAgent } from "./auth-profile-CwzO4_RG.js";
|
|
9
|
+
import { X as resolveCodexAppServerAuthAccountCacheKey, c as getLeasedSharedCodexAppServerClient, h as releaseLeasedSharedCodexAppServerClient, o as clearSharedCodexAppServerClientIfCurrentAndWait } from "./shared-client-CVhez2Uo.js";
|
|
10
|
+
import { t as ensureCodexPluginActivation } from "./plugin-activation-BQK-f5sV.js";
|
|
11
|
+
import { CODEX_PLUGIN_CONFIG_PATH, buildCodexMigrationPlan, buildCodexPluginsConfigValue, hasCodexPluginConfigConflict, n as applyCodexAuthItems, readCodexPluginMigrationConfigEntry, t as resolveCodexMigrationTargets } from "./plan-BMJdMOEF.js";
|
|
12
|
+
import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
13
|
+
import { parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
14
|
+
import path from "node:path";
|
|
15
|
+
import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
16
|
+
import { sleep } from "openclaw/plugin-sdk/runtime-env";
|
|
17
|
+
import { MIGRATION_REASON_TARGET_EXISTS, applyMigrationManualItem, markMigrationItemConflict, markMigrationItemError, markMigrationItemSkipped, resolveMigrationConfigRuntime, summarizeMigrationItems, writeMigrationConfigPath } from "openclaw/plugin-sdk/migration";
|
|
18
|
+
import { archiveMigrationItem, copyMemoryMigrationFileItem, copyMigrationFileItem, withCachedMigrationConfigRuntime, writeMigrationReport } from "openclaw/plugin-sdk/migration-runtime";
|
|
19
|
+
//#region extensions/codex/src/migration/apply-report.ts
|
|
20
|
+
function codexPluginActivationReportState(result) {
|
|
21
|
+
switch (result.reason) {
|
|
22
|
+
case "already_active":
|
|
23
|
+
case "installed": return {
|
|
24
|
+
installed: true,
|
|
25
|
+
enabled: true
|
|
26
|
+
};
|
|
27
|
+
case "auth_required": return {
|
|
28
|
+
installed: true,
|
|
29
|
+
enabled: false
|
|
30
|
+
};
|
|
31
|
+
case "disabled":
|
|
32
|
+
case "install_failed":
|
|
33
|
+
case "marketplace_missing":
|
|
34
|
+
case "plugin_missing": return {
|
|
35
|
+
installed: false,
|
|
36
|
+
enabled: false
|
|
37
|
+
};
|
|
38
|
+
case "refresh_failed": return {
|
|
39
|
+
installed: true,
|
|
40
|
+
enabled: false
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return result.reason;
|
|
44
|
+
}
|
|
45
|
+
function sanitizeAppsNeedingAuth(apps) {
|
|
46
|
+
return apps.map((app) => ({
|
|
47
|
+
id: app.id,
|
|
48
|
+
name: app.name,
|
|
49
|
+
needsAuth: true
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region extensions/codex/src/migration/apply.ts
|
|
54
|
+
const CODEX_PLUGIN_AUTH_REQUIRED_REASON = "auth_required";
|
|
55
|
+
const CODEX_PLUGIN_NOT_SELECTED_REASON = "not selected for migration";
|
|
56
|
+
const CODEX_CONFIG_PATCH_MODE_RETURN = "return";
|
|
57
|
+
const CODEX_PLUGIN_LOAD_WARNING = "Some Codex plugins could not be migrated. Run `openclaw migrate codex` after onboarding.";
|
|
58
|
+
const TARGET_CODEX_MARKETPLACE_DISCOVERY_POLL_MS = 250;
|
|
59
|
+
const TARGET_CODEX_MARKETPLACE_DISCOVERY_TIMEOUT_MS = 3e4;
|
|
60
|
+
const TARGET_CODEX_MARKETPLACE_DISCOVERY_TIMEOUT_ENV = "OPENCLAW_CODEX_MIGRATION_PLUGIN_LIST_TIMEOUT_MS";
|
|
61
|
+
var CodexPluginConfigConflictError = class extends Error {
|
|
62
|
+
constructor(reason) {
|
|
63
|
+
super(reason);
|
|
64
|
+
this.reason = reason;
|
|
65
|
+
this.name = "CodexPluginConfigConflictError";
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
function shouldReturnCodexPluginConfigPatch(ctx) {
|
|
69
|
+
return ctx.providerOptions?.configPatchMode === CODEX_CONFIG_PATCH_MODE_RETURN;
|
|
70
|
+
}
|
|
71
|
+
function prepareTargetCodexAppServer(ctx) {
|
|
72
|
+
const appServer = resolveTargetCodexAppServer(ctx);
|
|
73
|
+
const targets = resolveCodexMigrationTargets(ctx);
|
|
74
|
+
let warmedClient;
|
|
75
|
+
const ready = getLeasedSharedCodexAppServerClient({
|
|
76
|
+
startOptions: appServer.start,
|
|
77
|
+
timeoutMs: 6e4,
|
|
78
|
+
agentDir: targets.agentDir,
|
|
79
|
+
config: ctx.config
|
|
80
|
+
}).then((client) => {
|
|
81
|
+
warmedClient = client;
|
|
82
|
+
}, () => void 0);
|
|
83
|
+
return { async dispose() {
|
|
84
|
+
await ready;
|
|
85
|
+
if (warmedClient) releaseLeasedSharedCodexAppServerClient(warmedClient);
|
|
86
|
+
await clearSharedCodexAppServerClientIfCurrentAndWait(warmedClient, {
|
|
87
|
+
exitTimeoutMs: 2e3,
|
|
88
|
+
forceKillDelayMs: 250
|
|
89
|
+
});
|
|
90
|
+
} };
|
|
91
|
+
}
|
|
92
|
+
async function applyCodexMigrationPlan(params) {
|
|
93
|
+
const plan = params.plan ?? await buildCodexMigrationPlan(params.ctx);
|
|
94
|
+
const reportDir = params.ctx.reportDir ?? path.join(params.ctx.stateDir, "migration", "codex");
|
|
95
|
+
const items = [];
|
|
96
|
+
const targets = resolveCodexMigrationTargets(params.ctx);
|
|
97
|
+
const codexHome = typeof plan.metadata?.codexHome === "string" && plan.metadata.codexHome.trim() ? plan.metadata.codexHome : plan.source;
|
|
98
|
+
const authSource = {
|
|
99
|
+
codexHome,
|
|
100
|
+
authPath: path.join(codexHome, "auth.json"),
|
|
101
|
+
modelsCachePath: path.join(codexHome, "models_cache.json")
|
|
102
|
+
};
|
|
103
|
+
const runtime = withCachedMigrationConfigRuntime(params.ctx.runtime ?? params.runtime, params.ctx.config);
|
|
104
|
+
const applyCtx = {
|
|
105
|
+
...params.ctx,
|
|
106
|
+
runtime
|
|
107
|
+
};
|
|
108
|
+
for (const item of plan.items) {
|
|
109
|
+
if (item.status !== "planned") {
|
|
110
|
+
items.push(item);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (item.id === "config:codex-plugins") items.push(await applyCodexPluginConfigItem(applyCtx, item, items));
|
|
114
|
+
else if (item.kind === "auth") items.push(...await applyCodexAuthItems({
|
|
115
|
+
ctx: applyCtx,
|
|
116
|
+
item,
|
|
117
|
+
source: authSource,
|
|
118
|
+
targets
|
|
119
|
+
}));
|
|
120
|
+
else if (item.kind === "plugin" && item.action === "install") items.push(await applyCodexPluginInstallItem(applyCtx, item));
|
|
121
|
+
else if (item.kind === "manual") items.push(applyMigrationManualItem(item));
|
|
122
|
+
else if (item.action === "archive") items.push(await archiveMigrationItem(item, reportDir));
|
|
123
|
+
else if (item.kind === "memory") items.push(await copyMemoryMigrationFileItem(item, reportDir, {
|
|
124
|
+
workspaceDir: targets.workspaceDir,
|
|
125
|
+
overwrite: params.ctx.overwrite
|
|
126
|
+
}));
|
|
127
|
+
else items.push(await copyMigrationFileItem(item, reportDir, { overwrite: params.ctx.overwrite }));
|
|
128
|
+
}
|
|
129
|
+
const result = {
|
|
130
|
+
...plan,
|
|
131
|
+
items,
|
|
132
|
+
summary: summarizeMigrationItems(items),
|
|
133
|
+
backupPath: params.ctx.backupPath,
|
|
134
|
+
reportDir
|
|
135
|
+
};
|
|
136
|
+
if (items.some(isCodexPluginLoadWarningItem)) {
|
|
137
|
+
result.warnings = uniqueStrings([...result.warnings ?? [], CODEX_PLUGIN_LOAD_WARNING]);
|
|
138
|
+
result.nextSteps = uniqueStrings([CODEX_PLUGIN_LOAD_WARNING, ...result.nextSteps ?? []]);
|
|
139
|
+
}
|
|
140
|
+
await writeMigrationReport(result, { title: "Codex Migration Report" });
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
async function applyCodexPluginInstallItem(ctx, item) {
|
|
144
|
+
const policy = readCodexPluginPolicy(item);
|
|
145
|
+
if (!policy) return {
|
|
146
|
+
...markMigrationItemError(item, "invalid Codex plugin migration item"),
|
|
147
|
+
details: {
|
|
148
|
+
...item.details,
|
|
149
|
+
code: "invalid_plugin_item"
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
try {
|
|
153
|
+
const appCacheKey = await buildTargetCodexPluginAppCacheKey(ctx);
|
|
154
|
+
const appServer = resolveTargetCodexAppServer(ctx);
|
|
155
|
+
const result = await ensureCodexPluginActivation({
|
|
156
|
+
identity: policy,
|
|
157
|
+
installEvenIfActive: true,
|
|
158
|
+
request: async (method, requestParams) => await requestTargetCodexAppServerJson({
|
|
159
|
+
method,
|
|
160
|
+
requestParams,
|
|
161
|
+
timeoutMs: 6e4,
|
|
162
|
+
startOptions: appServer.start,
|
|
163
|
+
agentDir: resolveCodexMigrationTargets(ctx).agentDir,
|
|
164
|
+
config: ctx.config,
|
|
165
|
+
isolated: false
|
|
166
|
+
}),
|
|
167
|
+
appCache: defaultCodexAppInventoryCache,
|
|
168
|
+
appCacheKey
|
|
169
|
+
});
|
|
170
|
+
const baseDetails = {
|
|
171
|
+
...item.details,
|
|
172
|
+
code: result.reason,
|
|
173
|
+
activationReason: result.reason,
|
|
174
|
+
...codexPluginActivationReportState(result),
|
|
175
|
+
installAttempted: result.installAttempted,
|
|
176
|
+
diagnostics: result.diagnostics.map((diagnostic) => diagnostic.message)
|
|
177
|
+
};
|
|
178
|
+
if (result.ok) return {
|
|
179
|
+
...item,
|
|
180
|
+
status: "migrated",
|
|
181
|
+
...result.reason === "already_active" ? { reason: "already active" } : {},
|
|
182
|
+
details: baseDetails
|
|
183
|
+
};
|
|
184
|
+
if (result.reason === CODEX_PLUGIN_AUTH_REQUIRED_REASON) return {
|
|
185
|
+
...item,
|
|
186
|
+
status: "skipped",
|
|
187
|
+
reason: CODEX_PLUGIN_AUTH_REQUIRED_REASON,
|
|
188
|
+
details: {
|
|
189
|
+
...baseDetails,
|
|
190
|
+
appsNeedingAuth: sanitizeAppsNeedingAuth(result.installResponse?.appsNeedingAuth ?? [])
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
if (result.reason === "plugin_missing" || result.reason === "marketplace_missing") return {
|
|
194
|
+
...item,
|
|
195
|
+
status: "warning",
|
|
196
|
+
reason: result.reason,
|
|
197
|
+
message: `Codex plugin "${policy.pluginName}" could not be migrated automatically`,
|
|
198
|
+
details: {
|
|
199
|
+
...baseDetails,
|
|
200
|
+
warningReason: CODEX_PLUGIN_LOAD_WARNING
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
return {
|
|
204
|
+
...item,
|
|
205
|
+
status: "error",
|
|
206
|
+
reason: result.reason,
|
|
207
|
+
details: baseDetails
|
|
208
|
+
};
|
|
209
|
+
} catch (error) {
|
|
210
|
+
if (isCodexPluginInventoryLoadError(error)) return {
|
|
211
|
+
...item,
|
|
212
|
+
status: "warning",
|
|
213
|
+
reason: "plugin_inventory_unavailable",
|
|
214
|
+
message: `Codex plugin "${policy.pluginName}" could not be migrated automatically`,
|
|
215
|
+
details: {
|
|
216
|
+
...item.details,
|
|
217
|
+
code: "plugin_inventory_unavailable",
|
|
218
|
+
warningReason: CODEX_PLUGIN_LOAD_WARNING,
|
|
219
|
+
diagnostic: coerceErrorMessage(error)
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
return {
|
|
223
|
+
...item,
|
|
224
|
+
status: "error",
|
|
225
|
+
reason: coerceErrorMessage(error),
|
|
226
|
+
details: {
|
|
227
|
+
...item.details,
|
|
228
|
+
code: "plugin_install_failed"
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function isCodexPluginInventoryLoadError(error) {
|
|
234
|
+
return coerceErrorMessage(error).includes("codex app-server plugin/list timed out");
|
|
235
|
+
}
|
|
236
|
+
function resolveTargetCodexAppServer(ctx) {
|
|
237
|
+
return resolveCodexAppServerRuntimeOptions({ pluginConfig: readCodexPluginConfig(ctx.config) });
|
|
238
|
+
}
|
|
239
|
+
async function requestTargetCodexAppServerJson(params) {
|
|
240
|
+
if (params.method !== "plugin/list") return await requestCodexAppServerJson(params);
|
|
241
|
+
const deadline = Date.now() + params.timeoutMs;
|
|
242
|
+
const discoveryTimeoutMs = targetCodexMarketplaceDiscoveryTimeoutMs();
|
|
243
|
+
const discoveryDeadline = Math.min(deadline, Date.now() + discoveryTimeoutMs);
|
|
244
|
+
let lastResponse;
|
|
245
|
+
let attempt = 0;
|
|
246
|
+
do {
|
|
247
|
+
attempt += 1;
|
|
248
|
+
const remainingMs = Math.max(1, discoveryDeadline - Date.now());
|
|
249
|
+
lastResponse = await requestCodexAppServerJson({
|
|
250
|
+
...params,
|
|
251
|
+
timeoutMs: remainingMs
|
|
252
|
+
});
|
|
253
|
+
if (hasOpenAiCuratedMarketplace(lastResponse)) return lastResponse;
|
|
254
|
+
if (Date.now() >= discoveryDeadline) return lastResponse;
|
|
255
|
+
const waitMs = Math.min(TARGET_CODEX_MARKETPLACE_DISCOVERY_POLL_MS, discoveryDeadline - Date.now());
|
|
256
|
+
await sleep(waitMs);
|
|
257
|
+
} while (Date.now() < discoveryDeadline);
|
|
258
|
+
return lastResponse;
|
|
259
|
+
}
|
|
260
|
+
function hasOpenAiCuratedMarketplace(response) {
|
|
261
|
+
if (!response || typeof response !== "object" || !("marketplaces" in response)) return false;
|
|
262
|
+
const marketplaces = response.marketplaces;
|
|
263
|
+
return Array.isArray(marketplaces) && marketplaces.some((marketplace) => marketplace && typeof marketplace === "object" && marketplace.name === "openai-curated");
|
|
264
|
+
}
|
|
265
|
+
function targetCodexMarketplaceDiscoveryTimeoutMs(env = process.env) {
|
|
266
|
+
const configured = parseStrictNonNegativeInteger(env[TARGET_CODEX_MARKETPLACE_DISCOVERY_TIMEOUT_ENV]);
|
|
267
|
+
if (configured !== void 0) return configured;
|
|
268
|
+
return TARGET_CODEX_MARKETPLACE_DISCOVERY_TIMEOUT_MS;
|
|
269
|
+
}
|
|
270
|
+
function isCodexPluginLoadWarningItem(item) {
|
|
271
|
+
return item.kind === "plugin" && item.action === "install" && item.status === "warning" && item.details?.warningReason === CODEX_PLUGIN_LOAD_WARNING;
|
|
272
|
+
}
|
|
273
|
+
async function buildTargetCodexPluginAppCacheKey(ctx) {
|
|
274
|
+
const targets = resolveCodexMigrationTargets(ctx);
|
|
275
|
+
const appServer = resolveTargetCodexAppServer(ctx);
|
|
276
|
+
const authProfileId = resolveCodexAppServerAuthProfileIdForAgent({
|
|
277
|
+
agentDir: targets.agentDir,
|
|
278
|
+
config: ctx.config
|
|
279
|
+
});
|
|
280
|
+
const accountId = await resolveCodexAppServerAuthAccountCacheKey({
|
|
281
|
+
authProfileId,
|
|
282
|
+
agentDir: targets.agentDir,
|
|
283
|
+
config: ctx.config
|
|
284
|
+
});
|
|
285
|
+
const envApiKeyFingerprint = authProfileId ? void 0 : resolveCodexAppServerFallbackApiKeyCacheKey({ startOptions: appServer.start });
|
|
286
|
+
return buildCodexPluginAppCacheKey({
|
|
287
|
+
appServer,
|
|
288
|
+
agentDir: targets.agentDir,
|
|
289
|
+
authProfileId,
|
|
290
|
+
accountId,
|
|
291
|
+
envApiKeyFingerprint
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
async function applyCodexPluginConfigItem(ctx, item, appliedItems) {
|
|
295
|
+
if (appliedItems.filter((candidate) => candidate.kind === "plugin" && candidate.action === "install" && readCodexPluginPolicy(candidate) !== void 0 && !isCodexPluginConfigTerminal(candidate)).length > 0) return {
|
|
296
|
+
...item,
|
|
297
|
+
status: "warning",
|
|
298
|
+
reason: "selected Codex plugin activation is incomplete"
|
|
299
|
+
};
|
|
300
|
+
const entries = appliedItems.map(readAppliedPluginConfigEntry).filter((entry) => entry !== void 0);
|
|
301
|
+
if (entries.length === 0) return {
|
|
302
|
+
...markMigrationItemSkipped(item, "no selected Codex plugins"),
|
|
303
|
+
deferredCompletion: true
|
|
304
|
+
};
|
|
305
|
+
const returnPatch = shouldReturnCodexPluginConfigPatch(ctx);
|
|
306
|
+
const configApi = resolveMigrationConfigRuntime(ctx);
|
|
307
|
+
const currentConfig = returnPatch ? ctx.config : configApi?.current?.();
|
|
308
|
+
if (!currentConfig) return markMigrationItemError(item, "config runtime unavailable");
|
|
309
|
+
const value = buildCodexPluginsConfigValue(entries, currentConfig);
|
|
310
|
+
if (!ctx.overwrite && hasCodexPluginConfigConflict(currentConfig, value)) return markMigrationItemConflict(item, MIGRATION_REASON_TARGET_EXISTS);
|
|
311
|
+
const migratedItem = {
|
|
312
|
+
...item,
|
|
313
|
+
status: "migrated",
|
|
314
|
+
details: {
|
|
315
|
+
...item.details,
|
|
316
|
+
path: [...CODEX_PLUGIN_CONFIG_PATH],
|
|
317
|
+
value
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
if (returnPatch) return migratedItem;
|
|
321
|
+
if (!configApi?.mutateConfigFile) return markMigrationItemError(item, "config runtime unavailable");
|
|
322
|
+
try {
|
|
323
|
+
await configApi.mutateConfigFile({
|
|
324
|
+
base: "runtime",
|
|
325
|
+
afterWrite: { mode: "auto" },
|
|
326
|
+
mutate(draft) {
|
|
327
|
+
if (!ctx.overwrite && hasCodexPluginConfigConflict(draft, value)) throw new CodexPluginConfigConflictError(MIGRATION_REASON_TARGET_EXISTS);
|
|
328
|
+
writeMigrationConfigPath(draft, CODEX_PLUGIN_CONFIG_PATH, value);
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
return migratedItem;
|
|
332
|
+
} catch (error) {
|
|
333
|
+
if (error instanceof CodexPluginConfigConflictError) return markMigrationItemConflict(item, error.reason);
|
|
334
|
+
return markMigrationItemError(item, coerceErrorMessage(error));
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
function isCodexPluginConfigTerminal(item) {
|
|
338
|
+
return item.status === "migrated" || item.status === "skipped" && (item.deferredCompletion === true || item.reason === CODEX_PLUGIN_NOT_SELECTED_REASON || item.reason === CODEX_PLUGIN_AUTH_REQUIRED_REASON);
|
|
339
|
+
}
|
|
340
|
+
function readAppliedPluginConfigEntry(item) {
|
|
341
|
+
if (item.status === "migrated" || item.deferredCompletion === true) return readCodexPluginMigrationConfigEntry(item, true);
|
|
342
|
+
if (item.status === "skipped" && item.reason === CODEX_PLUGIN_AUTH_REQUIRED_REASON) return readCodexPluginMigrationConfigEntry(item, false);
|
|
343
|
+
}
|
|
344
|
+
function readCodexPluginPolicy(item) {
|
|
345
|
+
const entry = readCodexPluginMigrationConfigEntry(item, true);
|
|
346
|
+
if (!entry) return;
|
|
347
|
+
return {
|
|
348
|
+
configKey: entry.configKey,
|
|
349
|
+
marketplaceName: CODEX_PLUGINS_MARKETPLACE_NAME,
|
|
350
|
+
pluginName: entry.pluginName,
|
|
351
|
+
enabled: true,
|
|
352
|
+
allowDestructiveActions: true,
|
|
353
|
+
destructiveApprovalMode: "allow"
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
//#endregion
|
|
357
|
+
export { applyCodexMigrationPlan, prepareTargetCodexAppServer };
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { o as isJsonObject } from "./protocol-CAAcVIKF.js";
|
|
2
|
+
import "./client-BEKu4yDx.js";
|
|
3
|
+
import { m as retireSharedCodexAppServerClientIfCurrent } from "./auth-cache-key-Kq6oerr6.js";
|
|
4
|
+
import { r as CodexAppServerRpcError } from "./session-catalog-provenance-DkJHo735.js";
|
|
5
|
+
import { G as unsubscribeCodexAppServerLiveThread } from "./shared-client-CVhez2Uo.js";
|
|
3
6
|
import { asFiniteNumber, normalizeOptionalString, normalizeOptionalString as normalizeOptionalString$1, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
7
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
5
8
|
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
9
|
+
import { AsyncResource } from "node:async_hooks";
|
|
6
10
|
import { redactSensitiveText } from "openclaw/plugin-sdk/logging-core";
|
|
7
11
|
import { sanitizeTerminalText } from "openclaw/plugin-sdk/text-chunking";
|
|
8
12
|
//#region extensions/codex/src/app-server/event-projector-values.ts
|
|
@@ -14,6 +18,10 @@ function readCodexProviderRefusal(message, codexErrorInfo) {
|
|
|
14
18
|
category: "cyber",
|
|
15
19
|
message
|
|
16
20
|
};
|
|
21
|
+
if (codexErrorInfo === "misalignmentPolicyViolation") return {
|
|
22
|
+
category: "misalignment",
|
|
23
|
+
message
|
|
24
|
+
};
|
|
17
25
|
return message.startsWith(BIO_POLICY_SAFETY_ACCESS_BLOCK_PREFIX) ? {
|
|
18
26
|
category: "bio",
|
|
19
27
|
message
|
|
@@ -293,7 +301,6 @@ var ClientTurnRouter = class {
|
|
|
293
301
|
this.routes = /* @__PURE__ */ new Map();
|
|
294
302
|
this.globalWarnings = [];
|
|
295
303
|
this.nativeTurnCompletionWatchers = /* @__PURE__ */ new Map();
|
|
296
|
-
this.disposed = false;
|
|
297
304
|
client.addNotificationHandler((notification) => this.routeNotification(notification));
|
|
298
305
|
client.addRequestHandler((request, signal) => this.routeRequest(request, signal));
|
|
299
306
|
client.addCloseHandler((closedClient) => {
|
|
@@ -334,9 +341,12 @@ var ClientTurnRouter = class {
|
|
|
334
341
|
get observedNativeTurnId() {
|
|
335
342
|
return route.observedNativeTurn?.id;
|
|
336
343
|
},
|
|
344
|
+
get completed() {
|
|
345
|
+
return Boolean(route.turnId && route.completedNativeTurnIds.has(route.turnId));
|
|
346
|
+
},
|
|
337
347
|
activate: (handlers) => this.activate(route, handlers),
|
|
338
348
|
armTurn: () => this.armTurn(route),
|
|
339
|
-
bindTurn: (turnId) => this.bindTurn(route, turnId),
|
|
349
|
+
bindTurn: (turnId, bindingOptions) => this.bindTurn(route, turnId, bindingOptions),
|
|
340
350
|
cancelTurn: () => this.cancelTurn(route),
|
|
341
351
|
drain: () => this.drainNotifications(route),
|
|
342
352
|
release: () => this.release(route)
|
|
@@ -393,9 +403,9 @@ var ClientTurnRouter = class {
|
|
|
393
403
|
};
|
|
394
404
|
}
|
|
395
405
|
dispose(cause) {
|
|
396
|
-
if (this.
|
|
397
|
-
this.disposed = true;
|
|
406
|
+
if (this.closeError) return;
|
|
398
407
|
const closeError = cause ? new Error("codex app-server turn router closed", { cause }) : /* @__PURE__ */ new Error("codex app-server turn router closed");
|
|
408
|
+
this.closeError = closeError;
|
|
399
409
|
for (const route of this.routes.values()) this.release(route, closeError);
|
|
400
410
|
for (const watchers of this.nativeTurnCompletionWatchers.values()) for (const watcher of watchers) watcher.finish(false);
|
|
401
411
|
}
|
|
@@ -409,7 +419,11 @@ var ClientTurnRouter = class {
|
|
|
409
419
|
if (route.handlers) throw new Error(`codex app-server thread route already activated: ${route.threadId}`);
|
|
410
420
|
this.assertRoute(route);
|
|
411
421
|
if (!handlers.onNotification && !handlers.onRequest) throw new Error("codex app-server thread route requires a notification or request handler");
|
|
412
|
-
route.handlers =
|
|
422
|
+
route.handlers = {
|
|
423
|
+
onRequest: handlers.onRequest && AsyncResource.bind(handlers.onRequest),
|
|
424
|
+
onNotification: handlers.onNotification && AsyncResource.bind(handlers.onNotification),
|
|
425
|
+
onNotificationReceived: handlers.onNotificationReceived && AsyncResource.bind(handlers.onNotificationReceived, void 0, handlers)
|
|
426
|
+
};
|
|
413
427
|
if (!handlers.onNotification) route.pending.length = 0;
|
|
414
428
|
else if (route.gate !== "armed") this.flushNotifications(route);
|
|
415
429
|
route.activated.resolve();
|
|
@@ -432,20 +446,22 @@ var ClientTurnRouter = class {
|
|
|
432
446
|
await this.waitForNotifications(route);
|
|
433
447
|
this.assertRoute(route);
|
|
434
448
|
}
|
|
435
|
-
async bindTurn(route, turnIdInput) {
|
|
436
|
-
|
|
449
|
+
async bindTurn(route, turnIdInput, options) {
|
|
450
|
+
const turnId = requireId(turnIdInput, "turn id");
|
|
451
|
+
if (options?.completed && route.gate === "armed" && (!route.released || route.released === this.closeError)) route.completedNativeTurnIds.add(turnId);
|
|
452
|
+
this.assertRoute(route, route.gate === "armed" ? turnId : void 0);
|
|
437
453
|
if (!route.handlers) throw new Error("codex app-server thread route must be activated before binding a turn");
|
|
438
454
|
if (route.gate !== "armed") throw new Error(`codex app-server thread route cannot bind from ${route.gate}`);
|
|
439
|
-
const turnId = requireId(turnIdInput, "turn id");
|
|
440
455
|
route.gate = "bound";
|
|
441
456
|
route.turnId = turnId;
|
|
442
457
|
this.flushNotifications(route);
|
|
443
458
|
route.binding?.resolve();
|
|
444
459
|
await this.waitForNotifications(route);
|
|
445
|
-
this.assertRoute(route);
|
|
460
|
+
this.assertRoute(route, turnId);
|
|
461
|
+
await route.notificationTail;
|
|
446
462
|
}
|
|
447
463
|
routeNotification(notification) {
|
|
448
|
-
if (this.
|
|
464
|
+
if (this.closeError) return;
|
|
449
465
|
const scope = readScope(notification.params);
|
|
450
466
|
if (!scope.threadId && (notification.method === "configWarning" || notification.method === "warning")) {
|
|
451
467
|
if (this.globalWarnings.length === DEFAULT_GLOBAL_WARNING_LIMIT) this.globalWarnings.shift();
|
|
@@ -504,7 +520,7 @@ var ClientTurnRouter = class {
|
|
|
504
520
|
return route.notificationTail;
|
|
505
521
|
}
|
|
506
522
|
async routeRequest(request, signal = new AbortController().signal) {
|
|
507
|
-
if (this.
|
|
523
|
+
if (this.closeError || signal.aborted) return;
|
|
508
524
|
const scope = readScope(request.params);
|
|
509
525
|
if (!scope.threadId) return;
|
|
510
526
|
const route = this.routes.get(scope.threadId);
|
|
@@ -579,7 +595,7 @@ var ClientTurnRouter = class {
|
|
|
579
595
|
this.release(route, error);
|
|
580
596
|
}
|
|
581
597
|
enqueueNotification(route, handler, notification, scope) {
|
|
582
|
-
if (route.released) return;
|
|
598
|
+
if (route.released && !this.canDrainClosedTurn(route, route.turnId)) return;
|
|
583
599
|
route.notificationTail = route.notificationTail.then(() => handler(notification, scope)).catch((error) => {
|
|
584
600
|
if (!route.released) embeddedAgentLog.warn("codex app-server keyed notification handler failed", {
|
|
585
601
|
method: notification.method,
|
|
@@ -598,7 +614,7 @@ var ClientTurnRouter = class {
|
|
|
598
614
|
release(route, error = /* @__PURE__ */ new Error("codex app-server thread route is released")) {
|
|
599
615
|
if (route.released) return;
|
|
600
616
|
route.released = error;
|
|
601
|
-
route.pending.length = 0;
|
|
617
|
+
if (error !== this.closeError) route.pending.length = 0;
|
|
602
618
|
route.ended.resolve();
|
|
603
619
|
route.activated.resolve();
|
|
604
620
|
route.binding?.resolve();
|
|
@@ -607,10 +623,13 @@ var ClientTurnRouter = class {
|
|
|
607
623
|
if (this.routes.get(route.threadId) === route) this.routes.delete(route.threadId);
|
|
608
624
|
}
|
|
609
625
|
assertActive() {
|
|
610
|
-
if (this.
|
|
626
|
+
if (this.closeError) throw new Error("codex app-server turn router is closed");
|
|
627
|
+
}
|
|
628
|
+
canDrainClosedTurn(route, turnId) {
|
|
629
|
+
return Boolean(this.closeError && route.released === this.closeError && turnId && route.completedNativeTurnIds.has(turnId));
|
|
611
630
|
}
|
|
612
|
-
assertRoute(route) {
|
|
613
|
-
if (route.released) throw route.released;
|
|
631
|
+
assertRoute(route, completedTurnId) {
|
|
632
|
+
if (route.released && !this.canDrainClosedTurn(route, completedTurnId)) throw route.released;
|
|
614
633
|
}
|
|
615
634
|
};
|
|
616
635
|
async function waitForPromiseOrAbort(promise, signal) {
|
|
@@ -745,7 +764,7 @@ async function interruptCodexTurnAndWaitBestEffort(client, params) {
|
|
|
745
764
|
}
|
|
746
765
|
}
|
|
747
766
|
/** Stops native terminals on the cancelled thread without retiring peer threads. */
|
|
748
|
-
async function terminateCodexBackgroundTerminals(client, threadId) {
|
|
767
|
+
async function terminateCodexBackgroundTerminals(client, threadId, oneShotCliRun = false) {
|
|
749
768
|
const options = {
|
|
750
769
|
timeoutMs: CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS,
|
|
751
770
|
signal: AbortSignal.timeout(CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS)
|
|
@@ -761,6 +780,7 @@ async function terminateCodexBackgroundTerminals(client, threadId) {
|
|
|
761
780
|
threadId,
|
|
762
781
|
limit: 1
|
|
763
782
|
}, options)).data.length > 0) throw new Error("native background terminals remain running");
|
|
783
|
+
if (oneShotCliRun) throw new Error("native terminal termination did not confirm process cleanup");
|
|
764
784
|
}
|
|
765
785
|
} catch (cause) {
|
|
766
786
|
throw new Error("Codex background-terminal cleanup failed; inspect the thread's running terminals before starting more work.", { cause });
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { a as flattenCodexDynamicToolFunctions, o as isJsonObject } from "./protocol-CAAcVIKF.js";
|
|
2
|
+
import { t as readCodexMirroredSessionHistoryMessages } from "./session-history-Cz-tOOYj.js";
|
|
3
|
+
import { Z as areCodexDynamicToolFingerprintsCompatible, at as isMessageOnlyCodexSourceReply, dt as isContextEngineBindingCompatible } from "./thread-lifecycle-D1pzRwHB.js";
|
|
4
4
|
import { readNonBlankString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import path from "node:path";
|
|
7
|
-
import { buildBootstrapContextForFiles, buildWatchedSessionsHarnessContext, embeddedAgentLog, resolveBootstrapFilesForRun } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
8
7
|
import { resolveAgentWorkspaceDir } from "openclaw/plugin-sdk/agent-runtime";
|
|
8
|
+
import { buildBootstrapContextForFiles, buildWatchedSessionsHarnessContext, embeddedAgentLog, resolveBootstrapFilesForRun } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
9
9
|
import { resolveBootstrapFilesForPreparation } from "openclaw/plugin-sdk/codex-mcp-projection";
|
|
10
10
|
import { prepareMemorySystemPromptAddition } from "openclaw/plugin-sdk/core";
|
|
11
11
|
import { MESSAGE_TOOL_DELIVERY_HINTS } from "openclaw/plugin-sdk/message-tool-delivery-hints";
|
|
@@ -214,6 +214,7 @@ function buildCodexSystemPromptReport(params) {
|
|
|
214
214
|
injectedWorkspaceFiles: buildCodexBootstrapInjectionStats({
|
|
215
215
|
bootstrapFiles: params.workspaceBootstrapContext.bootstrapFiles,
|
|
216
216
|
injectedFiles: params.workspaceBootstrapContext.promptContextFiles ?? [],
|
|
217
|
+
omitReferenceFiles: params.omitWorkspaceReferences,
|
|
217
218
|
developerInstructionFiles: [...params.workspaceBootstrapContext.threadDeveloperInstructionFiles ?? [], ...params.workspaceBootstrapContext.turnScopedDeveloperInstructionFiles ?? []],
|
|
218
219
|
memoryToolRoutedBootstrapFiles: params.workspaceBootstrapContext.memoryToolRoutedBootstrapFiles ?? [],
|
|
219
220
|
memoryToolRouted: params.workspaceBootstrapContext.memoryToolRouted === true
|
|
@@ -304,8 +305,9 @@ function buildCodexBootstrapInjectionStats(params) {
|
|
|
304
305
|
injectedChars: null,
|
|
305
306
|
truncated: null
|
|
306
307
|
};
|
|
307
|
-
const
|
|
308
|
-
const
|
|
308
|
+
const omitted = memoryToolRoutedFile || params.omitReferenceFiles && readCodexIndexedContextFileContent(injectedIndex, pathValue, fileName) !== void 0;
|
|
309
|
+
const injectedChars = omitted ? 0 : injected?.length ?? 0;
|
|
310
|
+
const truncated = omitted ? false : !file.missing && injectedChars < rawChars;
|
|
309
311
|
return {
|
|
310
312
|
name: displayName,
|
|
311
313
|
path: pathValue,
|