@openclaw/codex 2026.9.4 → 2026.9.6
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/assets/activity.svg +30 -0
- package/assets/icon.png +0 -0
- package/dist/.setup/account-usage-runtime-Eem_WGqY.mjs +75 -0
- package/dist/{apply-CvT8tW5i.js → .setup/apply-DDOi8uNx.mjs} +24 -30
- package/dist/.setup/async-questions-DdhOCwGi.mjs +27 -0
- package/dist/{attempt-client-cleanup-DKHzbwt5.js → .setup/attempt-client-cleanup-CEv1cKwF.mjs} +79 -49
- package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +5 -0
- package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +331 -0
- package/dist/{auth-binding-CWlKVccJ.js → .setup/auth-binding-DhLWa_7K.mjs} +1 -1
- package/dist/{auth-cache-key-7orQae_j.js → .setup/auth-cache-key-B2mpaI9D.mjs} +9 -81
- package/dist/{auth-profile-CwzO4_RG.js → .setup/auth-profile-WqZtZfXN.mjs} +1 -1
- package/dist/.setup/auth-profile-health-oHizqgye.mjs +53 -0
- package/dist/.setup/auth-profile-recovery-BREezV0L.mjs +14 -0
- package/dist/.setup/binding-connection-ThoatDcb.mjs +50 -0
- package/dist/.setup/binding-connection.runtime-yoHrABt-.mjs +48 -0
- package/dist/{bounded-turn-C_Hneydj.js → .setup/bounded-turn-B2HScEgT.mjs} +143 -32
- package/dist/{build-state-BCmg9-5p.js → .setup/build-state-C7EnDVgr.mjs} +1 -1
- package/dist/{capabilities-8vx68WLH.js → .setup/capabilities-CDXOOFdZ.mjs} +1 -1
- package/dist/{client-B57KWPQx.js → .setup/client-Cs08OXVQ.mjs} +705 -512
- package/dist/.setup/client-catalog-response-BMgt_4q4.mjs +285 -0
- package/dist/{command-dispatch-BpduNGVf.js → .setup/command-dispatch-B4JuOsOk.mjs} +8 -4
- package/dist/{command-formatters-lxlkNZgU.js → .setup/command-formatters-Bmqvr9tO.mjs} +8 -4
- package/dist/{command-handlers-tiL9iWj7.js → .setup/command-handlers-DW7Lx9oH.mjs} +137 -186
- package/dist/{command-rpc-CR5EOEZX.js → .setup/command-rpc-DixIj3HW.mjs} +47 -23
- package/dist/{compact-B_H3AOd7.js → .setup/compact-Du5UvtxA.mjs} +29 -51
- package/dist/{config-oIORaQ5T.js → .setup/config-BoTP_mrL.mjs} +5 -4
- package/dist/{config-options-CXMq1T-C.js → .setup/config-options-BvaRs51b.mjs} +50 -446
- package/dist/{protocol-5bh1G-H7.js → .setup/config-parsing-CcB9iPoq.mjs} +9 -51
- package/dist/{config-runtime-D0zGNIHu.js → .setup/config-runtime-C8Rw1m1m.mjs} +2 -2
- package/dist/.setup/config-security-BEReZ6go.mjs +380 -0
- package/dist/{conversation-binding-DsB4-O7U.js → .setup/conversation-binding-DP-gMrBP.mjs} +29 -38
- package/dist/{conversation-binding-data-BiodpIzq.js → .setup/conversation-binding-data-CrcyZk6O.mjs} +1 -1
- package/dist/{conversation-control-CtUu1b3m.js → .setup/conversation-control-uK9Jomlc.mjs} +32 -67
- package/dist/.setup/cyber-failover-DYwbmf1o.mjs +123 -0
- package/dist/.setup/cyber-failover-notice-e9G3J9-e.mjs +17 -0
- package/dist/{dynamic-tools-CmN5RAip.js → .setup/dynamic-tools-BDXl-8Cw.mjs} +936 -620
- package/dist/{effective-mcp-catalog-Bd73bqA8.js → .setup/effective-mcp-catalog-CvnvnGIe.mjs} +3 -3
- package/dist/{ephemeral-turn-D78_VmzO.js → .setup/ephemeral-turn-poidXgek.mjs} +9 -7
- package/dist/{event-projector-assistant-message-BmBM4qBV.js → .setup/event-projector-assistant-message-BsruvNrH.mjs} +8 -7
- package/dist/{event-projector-items-5VhsECCO.js → .setup/event-projector-items-C6L_5ZiT.mjs} +42 -8
- package/dist/{attempt-notifications-C9XufG6l.js → .setup/event-projector-usage-CnBS8Wa3.mjs} +102 -9
- package/dist/{harness-C7rRa7bm.js → .setup/harness-a_MsE4-_.mjs} +81 -21
- package/dist/{inference-context-Dr_mzvk4.js → .setup/inference-context-D96l9-ew.mjs} +1 -1
- package/dist/.setup/inference-proxy-b-aJMSxm.mjs +601 -0
- package/dist/{isolated-completion-DWVb5U2J.js → .setup/isolated-completion-BIZFhTNG.mjs} +18 -11
- package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
- package/dist/{managed-binary-D22rNEcR.js → .setup/managed-binary-BnshlFag.mjs} +14 -3
- package/dist/{managed-thread-store-D1t5jh3G.js → .setup/managed-thread-store-BMqgThVL.mjs} +48 -14
- package/dist/{model-catalog-Dq2n8f_p.js → .setup/model-catalog-CfXJf9Ay.mjs} +36 -12
- package/dist/{models-PCKOim-h.js → .setup/models-KnqBv0hE.mjs} +3 -3
- package/dist/.setup/native-auth-rWbGbMn3.mjs +57 -0
- package/dist/{native-subagent-history-DjtPloaU.js → .setup/native-subagent-history-0nYYgo0k.mjs} +43 -35
- package/dist/.setup/native-subagent-monitor-D3filLY2.mjs +4859 -0
- package/dist/{native-subagent-task-ids-BzTdT0Uw.js → .setup/native-subagent-task-ids-wb8CKZGN.mjs} +98 -44
- package/dist/{node-cli-sessions-DKaOmVUh.js → .setup/node-cli-sessions-r3avj02l.mjs} +86 -68
- package/dist/.setup/node-exec-server.runtime-BDwWXVpK.mjs +247 -0
- package/dist/{plan-7uG-Fp36.js → .setup/plan-CN3VwfNU.mjs} +133 -119
- package/dist/{plugin-activation-BYQculil.js → .setup/plugin-activation-DT3MNtqj.mjs} +7 -16
- package/dist/{plugin-app-cache-key-d0eKxy7b.js → .setup/plugin-app-cache-key-B2CsSdnV.mjs} +32 -44
- package/dist/{plugin-approval-roundtrip-Bz3FT8W5.js → .setup/plugin-approval-roundtrip-C0MZzCuP.mjs} +1 -1
- package/dist/{plugin-inventory-oL4Na1ZG.js → .setup/plugin-inventory-BoRei8Z4.mjs} +21 -11
- package/dist/{plugin-marketplace-discovery-P-Vndfqq.js → .setup/plugin-marketplace-discovery-CDOi8IFs.mjs} +4 -1
- package/dist/{plugin-metadata-cache-ClPJpRio.js → .setup/plugin-metadata-cache-Ctmo83k_.mjs} +226 -141
- package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
- package/dist/{provider-MQ8PVkuE.js → .setup/provider-BOsxQHOM.mjs} +9 -5
- package/dist/{provider-capabilities-BvCUL69A.js → .setup/provider-capabilities-BfE88FZ5.mjs} +31 -3
- package/dist/{rate-limits-CBMmWBr9.js → .setup/rate-limits-CMU3DUD0.mjs} +174 -151
- package/dist/{request-B7hEkBGq.js → .setup/request-D2L0zMrq.mjs} +130 -42
- package/dist/{run-attempt-CvsAAGa0.js → .setup/run-attempt-BHu11r7h.mjs} +1628 -966
- package/dist/.setup/run-attempt-lifecycle-B7JbY4-F.mjs +71 -0
- package/dist/{runtime-artifact-BJ0rXBZ_.js → .setup/runtime-artifact-CLZ8udh-.mjs} +29 -45
- package/dist/{sandbox-guard-BxgyoM8M.js → .setup/sandbox-guard-C2sRMOEY.mjs} +3 -3
- package/dist/{session-binding-CI8UuilT.js → .setup/session-binding-Cm0apEbd.mjs} +36 -83
- package/dist/{session-binding-record-Bcvslnhf.js → .setup/session-binding-record-BGoz8wOK.mjs} +202 -5
- package/dist/.setup/session-binding-sidecars-BlB5EvIS.mjs +546 -0
- package/dist/.setup/session-catalog-Pno1xGcl.mjs +2764 -0
- package/dist/{session-catalog-adoption-tcZi1IfX.js → .setup/session-catalog-adoption-BI6UTDZT.mjs} +58 -26
- package/dist/{session-catalog-archive-CwKg8Xz2.js → .setup/session-catalog-archive-lHBqzhaO.mjs} +6 -6
- package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +347 -0
- package/dist/.setup/session-catalog-index-B9_VQIUz.mjs +1170 -0
- package/dist/.setup/session-catalog-index-order-hcdz07yN.mjs +48 -0
- package/dist/.setup/session-catalog-index-state-Dgh8ORJm.mjs +183 -0
- package/dist/{thread-history-page-D0JIp48V.js → .setup/session-catalog-native-projection-DowriLid.mjs} +223 -95
- package/dist/{session-catalog-node-adoption-B1tgDW-m.js → .setup/session-catalog-node-adoption-ITddWx_X.mjs} +25 -13
- package/dist/{session-catalog-node-continue-Ci-DXyJP.js → .setup/session-catalog-node-continue-6g6qi4A9.mjs} +24 -15
- package/dist/.setup/session-catalog-projection-zK_PUsiE.mjs +422 -0
- package/dist/{session-cli-DNN_jhGc.js → .setup/session-cli-irrD-uo7.mjs} +3 -3
- package/dist/{session-history-Cz-tOOYj.js → .setup/session-history-BrqhSCf9.mjs} +19 -19
- package/dist/{session-history-import-DwyijFI6.js → .setup/session-history-import-D-3wAgOP.mjs} +4 -4
- package/dist/{session-history-read-cxPUxyVV.js → .setup/session-history-read-B3ZfSUbF.mjs} +2 -2
- package/dist/{session-history.worker-BeK1YOyT.js → .setup/session-history.worker-CaCh0xF_.mjs} +10 -24
- package/dist/{session-initialization-Ct0_Hzmg.js → .setup/session-initialization-rcgbZiid.mjs} +2 -2
- package/dist/{session-permission-policy-BBmXA8Eg.js → .setup/session-permission-policy-BI1QK_98.mjs} +2 -2
- package/dist/{session-retirement-B2YfbAAT.js → .setup/session-retirement-BH-S6qkJ.mjs} +26 -7
- package/dist/{settled-turn-context-Du6gdUDd.js → .setup/settled-turn-context-fmwouT5I.mjs} +2 -2
- package/dist/{settled-turn-finalizer-Dn91stmc.js → .setup/settled-turn-finalizer-DiAi6Kx6.mjs} +12 -12
- package/dist/{shared-client-CscigXXL.js → .setup/shared-client-DA4VR4Eb.mjs} +332 -221
- package/dist/{side-question-BGMJQf4U.js → .setup/side-question-BJ1wSDcB.mjs} +183 -230
- package/dist/{source-CElXU0Oy.js → .setup/source-CUzJq5WN.mjs} +11 -10
- package/dist/.setup/spawn-error-CL3n6MAa.mjs +57 -0
- package/dist/{thread-archive-guard-DfpBr-Sz.js → .setup/thread-archive-guard-C9frICzX.mjs} +10 -3
- package/dist/.setup/thread-history-page-DoVpnHim.mjs +83 -0
- package/dist/{thread-lifecycle-DXl1-I6b.js → .setup/thread-lifecycle-B3mfz1TG.mjs} +347 -2318
- package/dist/{thread-ownership-BsDRTsyp.js → .setup/thread-ownership-DcTtAcXj.mjs} +6 -4
- package/dist/{thread-policy-BuEQfE0g.js → .setup/thread-policy-DGuQsuFC.mjs} +19 -3
- package/dist/.setup/thread-requests-BLvGkP2R.mjs +2205 -0
- package/dist/{thread-resume-DsDOZpFg.js → .setup/thread-resume-DIBXwOpE.mjs} +8 -5
- package/dist/.setup/timeout-C910MdAB.mjs +80 -0
- package/dist/{transcript-history-projection-v17wXgdK.js → .setup/transcript-history-projection-ZZpkFkJ_.mjs} +96 -61
- package/dist/{transcript-mirror-C5CKgNy6.js → .setup/transcript-mirror-BtHDBp1G.mjs} +224 -195
- package/dist/{transcript-mirror-attestation-DibE0krH.js → .setup/transcript-mirror-attestation-CzM-94NC.mjs} +4 -1
- package/dist/{transport-stdio-BGjHoYLr.js → .setup/transport-stdio-h2VHOskC.mjs} +274 -89
- package/dist/{upstream-session-fork-BZerMte_.js → .setup/upstream-session-fork-BUr4OUbC.mjs} +51 -42
- package/dist/{usage-tCk-mg_x.js → .setup/usage-BML0r-ua.mjs} +5 -4
- package/dist/.setup/usage-limit-error-DUMbefVY.mjs +166 -0
- package/dist/{web-search-provider.runtime-B7bGbGWq.js → .setup/web-search-provider.runtime-CDKlN-Rv.mjs} +4 -3
- package/dist/api.js +23 -12
- package/dist/catalog-page-worker-entrypoint.js +12 -0
- package/dist/catalog-page.worker.js +9 -0
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +8 -528
- package/dist/harness.js +1 -1
- package/dist/index.js +306 -215
- package/dist/media-understanding-provider.js +3 -3
- package/dist/migration-provider-api.js +1 -1
- package/dist/native-tool-policy.js +12 -0
- package/dist/provider-discovery.js +18 -0
- package/dist/session-history-worker-runtime.js +36 -35
- package/dist/session-history.worker.js +2 -2
- package/dist/web-search-contract-api.js +1 -1
- package/openclaw.plugin.json +354 -69
- package/package.json +14 -8
- package/dist/attempt-context-D44yeDII.js +0 -636
- package/dist/binding-connection-D3udKbIE.js +0 -60
- package/dist/event-projector-usage-BfXmpOec.js +0 -102
- package/dist/inference-proxy-HGXKUIre.js +0 -311
- package/dist/launch-args-RXQwn8zV.js +0 -90
- package/dist/native-subagent-history-owner-Pcp7JuVF.js +0 -34
- package/dist/native-subagent-monitor-fQ7eIXEf.js +0 -2978
- package/dist/node-exec-server.runtime-Cl2vapEi.js +0 -226
- package/dist/rpc-error-ttN_QjEm.js +0 -30
- package/dist/session-catalog-ct-AH01I.js +0 -1477
- package/dist/session-catalog-home-id-CwhLdC03.js +0 -18
- package/dist/session-catalog-provenance-D-dIfRAH.js +0 -96
- package/dist/timeout-BVw8aaM1.js +0 -33
- package/dist/version-omm6IPI3.js +0 -12
- /package/dist/{auth-profile-selection-DFu9e167.js → .setup/auth-profile-selection-DFu9e167.mjs} +0 -0
- /package/dist/{config-utils-DujwEnhg.js → .setup/config-utils-DujwEnhg.mjs} +0 -0
- /package/dist/{context-compaction-activity-CMla5FPJ.js → .setup/context-compaction-activity-CMla5FPJ.mjs} +0 -0
- /package/dist/{elicitation-input-DPoK8F7w.js → .setup/elicitation-input-DPoK8F7w.mjs} +0 -0
- /package/dist/{history-rejection-B4nOXNXF.js → .setup/history-rejection-B4nOXNXF.mjs} +0 -0
- /package/dist/{image-payload-sanitizer-tupAr-2o.js → .setup/image-payload-sanitizer-tupAr-2o.mjs} +0 -0
- /package/dist/{incognito-session-uhrBF6wJ.js → .setup/incognito-session-uhrBF6wJ.mjs} +0 -0
- /package/dist/{local-runtime-attribution-B_2mnqhb.js → .setup/local-runtime-attribution-B_2mnqhb.mjs} +0 -0
- /package/dist/{native-execution-policy-umd0tgh4.js → .setup/native-execution-policy-umd0tgh4.mjs} +0 -0
- /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
- /package/dist/{session-binding-meta-B7aEMU7g.js → .setup/session-binding-meta-B7aEMU7g.mjs} +0 -0
- /package/dist/{session-upstream-marker-D15C9NHp.js → .setup/session-upstream-marker-D15C9NHp.mjs} +0 -0
- /package/dist/{upstream-prompt-provenance-LphB8slG.js → .setup/upstream-prompt-provenance-LphB8slG.mjs} +0 -0
- /package/dist/{web-search-provider.shared-BrZmlqyR.js → .setup/web-search-provider.shared-BrZmlqyR.mjs} +0 -0
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as CodexAppServerScopedRequestRejectedError } from "./request-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { r as publishCodexCatalogResume } from "./session-catalog-events-Bj6j94E_.mjs";
|
|
2
|
+
import { o as CodexAppServerRpcError } from "./timeout-C910MdAB.mjs";
|
|
3
|
+
import { t as CodexAppServerScopedRequestRejectedError } from "./request-D2L0zMrq.mjs";
|
|
4
|
+
import { F as forgetCodexWorkspaceReferences, rt as isCodexAppServerStartupError, u as isCodexAppServerStartSelectionChangedError } from "./shared-client-DA4VR4Eb.mjs";
|
|
5
|
+
import { b as assertCodexThreadResumeResponse, l as isCodexAppServerOverloadError, u as isCodexAppServerPrewriteRequestCancellationError } from "./client-Cs08OXVQ.mjs";
|
|
6
|
+
import { i as assertCodexThreadResumeSubscription, p as unsubscribeCodexThreadBestEffort, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-CEv1cKwF.mjs";
|
|
7
|
+
import { sanitizeTerminalText } from "openclaw/plugin-sdk/text-chunking";
|
|
6
8
|
//#region extensions/codex/src/app-server/thread-resume.ts
|
|
7
9
|
/** Owns Codex thread/resume subscription safety. */
|
|
8
10
|
/** Resumes one thread, releasing or isolating every possible native subscription. */
|
|
@@ -46,6 +48,7 @@ async function resumeCodexAppServerThread(params) {
|
|
|
46
48
|
if (error instanceof CodexAppServerUnsafeSubscriptionError) throw error;
|
|
47
49
|
throw new CodexAppServerUnsafeSubscriptionError(error instanceof Error ? error.message : `Codex thread/resume outcome is indeterminate for ${threadId}`, { cause: error });
|
|
48
50
|
}
|
|
51
|
+
await publishCodexCatalogResume(params.client, response, sanitizeTerminalText);
|
|
49
52
|
return response;
|
|
50
53
|
}
|
|
51
54
|
//#endregion
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
2
|
+
import { withTimeout } from "openclaw/plugin-sdk/time-runtime";
|
|
3
|
+
//#region extensions/codex/src/app-server/rpc-error.ts
|
|
4
|
+
const CODEX_APP_SERVER_OVERLOADED_ERROR_CODE = -32001;
|
|
5
|
+
/** RPC error wrapper that preserves app-server error code and data. */
|
|
6
|
+
var CodexAppServerRpcError = class extends Error {
|
|
7
|
+
constructor(error, method) {
|
|
8
|
+
super(formatCodexAppServerRpcErrorMessage(error, method));
|
|
9
|
+
this.name = "CodexAppServerRpcError";
|
|
10
|
+
this.code = error.code;
|
|
11
|
+
this.data = error.data;
|
|
12
|
+
this.method = method;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
function isCodexThreadReadMissingError(error, threadId) {
|
|
16
|
+
return error instanceof CodexAppServerRpcError && error.method === "thread/read" && error.code === -32600 && error.message === `thread not loaded: ${threadId}`;
|
|
17
|
+
}
|
|
18
|
+
function formatCodexAppServerRpcErrorMessage(error, method) {
|
|
19
|
+
const message = error.message || `${method} failed`;
|
|
20
|
+
const detail = readCodexAppServerRpcReloginDetail(error.data);
|
|
21
|
+
return detail && !message.includes(detail) ? `${message}: ${detail}` : message;
|
|
22
|
+
}
|
|
23
|
+
function readCodexAppServerRpcReloginDetail(data) {
|
|
24
|
+
const record = isJsonObject(data) ? data : void 0;
|
|
25
|
+
const nested = isJsonObject(record?.error) ? record.error : record;
|
|
26
|
+
if (!nested) return;
|
|
27
|
+
const isRelogin = nested.action === "relogin" || nested.reason === "cloudRequirements" && nested.errorCode === "Auth";
|
|
28
|
+
const detail = typeof nested.detail === "string" ? nested.detail.trim() : "";
|
|
29
|
+
return isRelogin && detail ? detail : void 0;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region extensions/codex/src/app-server/timeout.ts
|
|
33
|
+
/**
|
|
34
|
+
* Thin Codex app-server timeout adapter around OpenClaw's shared timeout helper.
|
|
35
|
+
*/
|
|
36
|
+
function resolveAbortError(signal) {
|
|
37
|
+
return signal.reason instanceof Error ? signal.reason : new Error("Codex app-server operation aborted", { cause: signal.reason });
|
|
38
|
+
}
|
|
39
|
+
/** Awaits a promise with a Codex-specific timeout error message. */
|
|
40
|
+
async function withTimeout$1(promise, timeoutMs, timeoutMessage, createError) {
|
|
41
|
+
return await withTimeout(promise, timeoutMs, {
|
|
42
|
+
message: timeoutMessage,
|
|
43
|
+
...createError ? { createError } : {}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/** Bounds an operation by both its owner lifecycle and one total wall-clock budget. */
|
|
47
|
+
async function withAbortableTimeout(params) {
|
|
48
|
+
const signal = params.signal;
|
|
49
|
+
if (signal?.aborted) throw resolveAbortError(signal);
|
|
50
|
+
let removeAbortListener;
|
|
51
|
+
const operation = signal ? Promise.race([params.promise, new Promise((_, reject) => {
|
|
52
|
+
const onAbort = () => reject(resolveAbortError(signal));
|
|
53
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
54
|
+
removeAbortListener = () => signal.removeEventListener("abort", onAbort);
|
|
55
|
+
})]) : params.promise;
|
|
56
|
+
try {
|
|
57
|
+
return await withTimeout$1(operation, params.timeoutMs, params.timeoutMessage, params.createTimeoutError);
|
|
58
|
+
} finally {
|
|
59
|
+
removeAbortListener?.();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async function waitForPromiseOrAbort(promise, signal) {
|
|
63
|
+
if (signal.aborted) return false;
|
|
64
|
+
let removeAbort;
|
|
65
|
+
try {
|
|
66
|
+
return await Promise.race([promise.then(() => true), new Promise((resolve) => {
|
|
67
|
+
const onAbort = () => resolve(false);
|
|
68
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
69
|
+
removeAbort = () => signal.removeEventListener("abort", onAbort);
|
|
70
|
+
if (signal.aborted) onAbort();
|
|
71
|
+
})]);
|
|
72
|
+
} finally {
|
|
73
|
+
removeAbort?.();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function abortReason(signal) {
|
|
77
|
+
return signal.reason instanceof Error ? signal.reason : new Error(String(signal.reason ?? "codex app-server thread route aborted"));
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
export { CODEX_APP_SERVER_OVERLOADED_ERROR_CODE as a, withTimeout$1 as i, waitForPromiseOrAbort as n, CodexAppServerRpcError as o, withAbortableTimeout as r, isCodexThreadReadMissingError as s, abortReason as t };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
1
|
+
import { t as readCodexAsyncQuestions } from "./async-questions-DdhOCwGi.mjs";
|
|
2
|
+
import { b as readCodexProviderRefusal, c as itemName, g as codexProviderRefusalDetails, l as itemStatus, t as auditNativeToolName } from "./event-projector-items-C6L_5ZiT.mjs";
|
|
3
|
+
import { t as attachCodexMirrorIdentity } from "./upstream-prompt-provenance-LphB8slG.mjs";
|
|
3
4
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
5
|
import { truncateUtf8Prefix } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
5
6
|
import { Buffer } from "node:buffer";
|
|
@@ -25,6 +26,22 @@ const CODEX_HISTORY_ZERO_USAGE = {
|
|
|
25
26
|
total: 0
|
|
26
27
|
}
|
|
27
28
|
};
|
|
29
|
+
function projectCodexHistoryMessage(message, text) {
|
|
30
|
+
const phase = message.role === "assistant" && "phase" in message && (message.phase === "commentary" || message.phase === "final_answer") ? message.phase : void 0;
|
|
31
|
+
return {
|
|
32
|
+
message,
|
|
33
|
+
responseItem: {
|
|
34
|
+
type: "message",
|
|
35
|
+
role: message.role,
|
|
36
|
+
content: [{
|
|
37
|
+
type: message.role === "assistant" ? "output_text" : "input_text",
|
|
38
|
+
text
|
|
39
|
+
}],
|
|
40
|
+
...phase ? { phase } : {}
|
|
41
|
+
},
|
|
42
|
+
messageBytes: Buffer.byteLength(text, "utf8") + (message.role === "assistant" ? Buffer.byteLength(message.errorMessage ?? "", "utf8") + (message.diagnostics ? Buffer.byteLength(JSON.stringify(message.diagnostics), "utf8") : 0) : 0)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
28
45
|
function normalizeImportedHistoryText(value) {
|
|
29
46
|
if (typeof value !== "string") return;
|
|
30
47
|
const text = value.trim();
|
|
@@ -70,51 +87,79 @@ function projectCodexThreadHistory(params) {
|
|
|
70
87
|
const projected = [];
|
|
71
88
|
const threadTimestamp = typeof params.thread.createdAt === "number" && Number.isFinite(params.thread.createdAt) ? params.thread.createdAt * 1e3 : params.importedAt;
|
|
72
89
|
let itemOffset = 0;
|
|
73
|
-
for (const turn of params.turns)
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
...turn.status === "failed" && turn.error?.message ? { errorMessage: turn.error.message } : {},
|
|
97
|
-
...phase ? { phase } : {},
|
|
98
|
-
...asyncDelivery && itemId ? { openclawAsyncDelivery: { itemId } } : {},
|
|
99
|
-
timestamp
|
|
100
|
-
}, identity) : attachCodexMirrorIdentity({
|
|
101
|
-
role,
|
|
102
|
-
content: text,
|
|
103
|
-
timestamp
|
|
104
|
-
}, identity);
|
|
105
|
-
projected.push({
|
|
106
|
-
message,
|
|
107
|
-
responseItem: {
|
|
108
|
-
type: "message",
|
|
90
|
+
for (const turn of params.turns) {
|
|
91
|
+
const refusal = turn.status === "failed" ? readCodexProviderRefusal(turn.error?.message, turn.error?.codexErrorInfo, {
|
|
92
|
+
misalignment: turn.error?.misalignment,
|
|
93
|
+
nativeThreadId: params.thread.id,
|
|
94
|
+
nativeTurnId: turn.id
|
|
95
|
+
}) : void 0;
|
|
96
|
+
let hasAssistantMessage = false;
|
|
97
|
+
for (const value of turn.items) {
|
|
98
|
+
const item = value;
|
|
99
|
+
const itemId = normalizeOptionalString(item.id);
|
|
100
|
+
const identity = `${turn.id}:${itemId ?? itemOffset}`;
|
|
101
|
+
const timestampSeconds = item.type === "agentMessage" ? turn.completedAt ?? turn.startedAt : turn.startedAt ?? turn.completedAt;
|
|
102
|
+
const timestamp = typeof timestampSeconds === "number" && Number.isFinite(timestampSeconds) ? timestampSeconds * 1e3 + itemOffset : threadTimestamp + itemOffset;
|
|
103
|
+
const text = item.type === "userMessage" ? projectCodexUserItemText(item) : item.type === "agentMessage" ? normalizeImportedHistoryText(item.text) : void 0;
|
|
104
|
+
const role = item.type === "userMessage" ? "user" : item.type === "agentMessage" ? "assistant" : void 0;
|
|
105
|
+
itemOffset += 1;
|
|
106
|
+
if (!text || !role) continue;
|
|
107
|
+
const phase = item.phase === "commentary" || item.phase === "final_answer" ? item.phase : void 0;
|
|
108
|
+
const asyncDelivery = item.delivery === "async";
|
|
109
|
+
const terminalAssistant = role === "assistant" && phase !== "commentary" && !asyncDelivery;
|
|
110
|
+
hasAssistantMessage ||= terminalAssistant;
|
|
111
|
+
const questions = asyncDelivery ? readCodexAsyncQuestions(item.questions) : void 0;
|
|
112
|
+
const message = role === "assistant" ? attachCodexMirrorIdentity({
|
|
109
113
|
role,
|
|
110
114
|
content: [{
|
|
111
|
-
type:
|
|
115
|
+
type: "text",
|
|
112
116
|
text
|
|
113
117
|
}],
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
api: CODEX_HISTORY_ASSISTANT_API,
|
|
119
|
+
provider: normalizeOptionalString(params.modelProvider) ?? normalizeOptionalString(params.thread.modelProvider) ?? CODEX_HISTORY_ASSISTANT_PROVIDER,
|
|
120
|
+
model: CODEX_HISTORY_ASSISTANT_MODEL,
|
|
121
|
+
usage: CODEX_HISTORY_ZERO_USAGE,
|
|
122
|
+
stopReason: turn.status === "interrupted" ? "aborted" : turn.status === "failed" ? "error" : "stop",
|
|
123
|
+
...turn.status === "failed" && turn.error?.message ? { errorMessage: turn.error.message } : {},
|
|
124
|
+
...refusal && terminalAssistant ? { diagnostics: [{
|
|
125
|
+
type: "provider_refusal",
|
|
126
|
+
timestamp,
|
|
127
|
+
details: codexProviderRefusalDetails(refusal)
|
|
128
|
+
}] } : {},
|
|
129
|
+
...phase ? { phase } : {},
|
|
130
|
+
...asyncDelivery && itemId ? { openclawAsyncDelivery: {
|
|
131
|
+
itemId,
|
|
132
|
+
...questions ? { questions } : {}
|
|
133
|
+
} } : {},
|
|
134
|
+
timestamp
|
|
135
|
+
}, identity) : attachCodexMirrorIdentity({
|
|
136
|
+
role,
|
|
137
|
+
content: text,
|
|
138
|
+
timestamp
|
|
139
|
+
}, identity);
|
|
140
|
+
projected.push(projectCodexHistoryMessage(message, text));
|
|
141
|
+
}
|
|
142
|
+
if (params.includeErrorOnlyTurns && !hasAssistantMessage && turn.status === "failed" && turn.error?.message) {
|
|
143
|
+
const timestamp = (turn.completedAt ?? turn.startedAt ?? threadTimestamp / 1e3) * 1e3;
|
|
144
|
+
const text = normalizeImportedHistoryText(turn.error.message) ?? "Codex turn failed.";
|
|
145
|
+
const message = attachCodexMirrorIdentity({
|
|
146
|
+
role: "assistant",
|
|
147
|
+
content: [],
|
|
148
|
+
api: CODEX_HISTORY_ASSISTANT_API,
|
|
149
|
+
provider: normalizeOptionalString(params.modelProvider) ?? normalizeOptionalString(params.thread.modelProvider) ?? CODEX_HISTORY_ASSISTANT_PROVIDER,
|
|
150
|
+
model: CODEX_HISTORY_ASSISTANT_MODEL,
|
|
151
|
+
usage: CODEX_HISTORY_ZERO_USAGE,
|
|
152
|
+
stopReason: "error",
|
|
153
|
+
errorMessage: text,
|
|
154
|
+
...refusal ? { diagnostics: [{
|
|
155
|
+
type: "provider_refusal",
|
|
156
|
+
timestamp,
|
|
157
|
+
details: codexProviderRefusalDetails(refusal)
|
|
158
|
+
}] } : {},
|
|
159
|
+
timestamp
|
|
160
|
+
}, `${turn.id}:assistant`);
|
|
161
|
+
projected.push(projectCodexHistoryMessage(message, ""));
|
|
162
|
+
}
|
|
118
163
|
}
|
|
119
164
|
return projected;
|
|
120
165
|
}
|
|
@@ -124,9 +169,9 @@ function selectBoundedCodexHistoryTail(projected) {
|
|
|
124
169
|
for (let index = projected.length - 1; index >= 0; index -= 1) {
|
|
125
170
|
const candidate = projected[index];
|
|
126
171
|
if (!candidate) continue;
|
|
127
|
-
if (selected.length >= CODEX_HISTORY_IMPORT_MAX_MESSAGES || selectedBytes + candidate.
|
|
172
|
+
if (selected.length >= CODEX_HISTORY_IMPORT_MAX_MESSAGES || selectedBytes + candidate.messageBytes > CODEX_HISTORY_IMPORT_MAX_BYTES) break;
|
|
128
173
|
selected.push(candidate);
|
|
129
|
-
selectedBytes += candidate.
|
|
174
|
+
selectedBytes += candidate.messageBytes;
|
|
130
175
|
}
|
|
131
176
|
return selected.toReversed();
|
|
132
177
|
}
|
|
@@ -136,6 +181,7 @@ function projectBoundedCodexThreadHistory(params) {
|
|
|
136
181
|
thread: params.thread,
|
|
137
182
|
turns: selectTurnsThroughBoundary(params.thread, params.throughTurnId),
|
|
138
183
|
importedAt: params.importedAt,
|
|
184
|
+
includeErrorOnlyTurns: true,
|
|
139
185
|
...params.modelProvider ? { modelProvider: params.modelProvider } : {}
|
|
140
186
|
});
|
|
141
187
|
const selected = selectBoundedCodexHistoryTail(projected);
|
|
@@ -149,24 +195,13 @@ function projectBoundedCodexThreadHistory(params) {
|
|
|
149
195
|
/** Projects only visible local user/assistant messages through the same bounded history policy. */
|
|
150
196
|
function projectBoundedCodexVisibleSessionHistory(entries) {
|
|
151
197
|
const projected = [];
|
|
152
|
-
for (const
|
|
153
|
-
if (
|
|
154
|
-
if (
|
|
155
|
-
const content =
|
|
198
|
+
for (const { message } of entries) {
|
|
199
|
+
if (message.role !== "user" && message.role !== "assistant" || !("content" in message)) continue;
|
|
200
|
+
if (message.role === "assistant" && (message.stopReason === "aborted" || message.stopReason === "error" || "openclawAsyncDelivery" in message)) continue;
|
|
201
|
+
const content = message.content;
|
|
156
202
|
const text = normalizeImportedHistoryText(typeof content === "string" ? content : Array.isArray(content) ? content.flatMap((part) => part && typeof part === "object" && "text" in part && typeof part.text === "string" ? [part.text] : []).join("\n") : void 0);
|
|
157
203
|
if (!text) continue;
|
|
158
|
-
projected.push(
|
|
159
|
-
message: entry.message,
|
|
160
|
-
responseItem: {
|
|
161
|
-
type: "message",
|
|
162
|
-
role: entry.role,
|
|
163
|
-
content: [{
|
|
164
|
-
type: entry.role === "assistant" ? "output_text" : "input_text",
|
|
165
|
-
text
|
|
166
|
-
}]
|
|
167
|
-
},
|
|
168
|
-
textBytes: Buffer.byteLength(text, "utf8")
|
|
169
|
-
});
|
|
204
|
+
projected.push(projectCodexHistoryMessage(message, text));
|
|
170
205
|
}
|
|
171
206
|
return selectBoundedCodexHistoryTail(projected).map(({ responseItem }) => responseItem);
|
|
172
207
|
}
|