@openclaw/codex 2026.9.6 → 2026.9.7
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/assets/icon.png +0 -0
- package/dist/.setup/{account-usage-runtime-Eem_WGqY.mjs → account-usage-runtime-DFhbh1zz.mjs} +5 -5
- package/dist/.setup/{apply-DDOi8uNx.mjs → apply-D3GcSoSa.mjs} +22 -36
- package/dist/.setup/{attempt-client-cleanup-CEv1cKwF.mjs → attempt-client-cleanup-DOP-cW5j.mjs} +128 -37
- package/dist/.setup/attempt-workspace-context-C5HigshI.mjs +164 -0
- package/dist/.setup/{auth-binding-DhLWa_7K.mjs → auth-binding-BLWz7stm.mjs} +14 -1
- package/dist/.setup/{auth-cache-key-B2mpaI9D.mjs → auth-cache-key-Dbvq-QgB.mjs} +36 -34
- package/dist/.setup/{auth-profile-WqZtZfXN.mjs → auth-profile-B0okYl2D.mjs} +1 -2
- package/dist/.setup/auth-start-options-BPIPeEX8.mjs +44 -0
- package/dist/.setup/{binding-connection-ThoatDcb.mjs → binding-connection-DTtN1KrX.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-yoHrABt-.mjs → binding-connection.runtime-6TpgD1M6.mjs} +4 -4
- package/dist/.setup/{bounded-turn-B2HScEgT.mjs → bounded-turn-CbjoN2OW.mjs} +15 -18
- package/dist/.setup/bounded-turn-isolation-B8K_ylqk.mjs +14 -0
- package/dist/.setup/{build-state-C7EnDVgr.mjs → build-state-Da1_z0kd.mjs} +1 -1
- package/dist/.setup/{capabilities-CDXOOFdZ.mjs → capabilities-B3WEZl4e.mjs} +2 -10
- package/dist/.setup/{client-Cs08OXVQ.mjs → client-N0JpgSzF.mjs} +138 -399
- package/dist/.setup/{client-catalog-response-BMgt_4q4.mjs → client-catalog-response-5HHLdcde.mjs} +1 -1
- package/dist/.setup/{command-dispatch-B4JuOsOk.mjs → command-dispatch-BeAoaovI.mjs} +5 -8
- package/dist/.setup/{command-formatters-Bmqvr9tO.mjs → command-formatters-R3ckE3Co.mjs} +29 -61
- package/dist/.setup/{command-handlers-DW7Lx9oH.mjs → command-handlers-ylTMS00z.mjs} +222 -343
- package/dist/.setup/{command-rpc-DixIj3HW.mjs → command-rpc-CGJGUQ6Y.mjs} +15 -18
- package/dist/.setup/compact-C2WamavS.mjs +776 -0
- package/dist/.setup/{config-BoTP_mrL.mjs → config-DKhXquav.mjs} +26 -28
- package/dist/.setup/{config-options-BvaRs51b.mjs → config-options-CzyWLTJt.mjs} +24 -37
- package/dist/.setup/{config-parsing-CcB9iPoq.mjs → config-parsing-b088LyhT.mjs} +57 -60
- package/dist/.setup/{config-runtime-C8Rw1m1m.mjs → config-runtime-C0NbLms1.mjs} +2 -2
- package/dist/.setup/{config-security-BEReZ6go.mjs → config-security-CE-FcGw9.mjs} +32 -111
- package/dist/.setup/{config-utils-DujwEnhg.mjs → config-utils-D0CXecki.mjs} +3 -13
- package/dist/.setup/context-engine-projection-PezSESth.mjs +387 -0
- package/dist/.setup/{conversation-binding-DP-gMrBP.mjs → conversation-binding-3Min8qvP.mjs} +67 -90
- package/dist/.setup/{conversation-binding-data-CrcyZk6O.mjs → conversation-binding-data-C746z5Pn.mjs} +8 -12
- package/dist/.setup/{conversation-control-uK9Jomlc.mjs → conversation-control-CEP8X5JC.mjs} +8 -8
- package/dist/.setup/{cyber-failover-DYwbmf1o.mjs → cyber-failover-XV0nNRZu.mjs} +1 -1
- package/dist/.setup/{cyber-failover-notice-e9G3J9-e.mjs → cyber-failover-notice-RNpGpTyP.mjs} +1 -1
- package/dist/.setup/{dynamic-tools-BDXl-8Cw.mjs → dynamic-tools-DzlsLUuS.mjs} +2305 -2606
- package/dist/.setup/{effective-mcp-catalog-CvnvnGIe.mjs → effective-mcp-catalog-CxUtC-xG.mjs} +8 -17
- package/dist/.setup/{ephemeral-turn-poidXgek.mjs → ephemeral-turn-CDsPJOa2.mjs} +3 -3
- package/dist/.setup/event-projector-assistant-message-CigreO4K.mjs +69 -0
- package/dist/.setup/{event-projector-usage-CnBS8Wa3.mjs → event-projector-usage-03R0I2dM.mjs} +3 -25
- package/dist/.setup/event-projector-values-DJSz8BTk.mjs +106 -0
- package/dist/.setup/incognito-session-DWYapfwf.mjs +2 -0
- package/dist/.setup/{inference-context-D96l9-ew.mjs → inference-context-D-9gWlTR.mjs} +16 -18
- package/dist/.setup/inference-dispatch-CMZtjQyz.mjs +359 -0
- package/dist/.setup/inference-metadata-CgIf7sOx.mjs +81 -0
- package/dist/.setup/{inference-proxy-b-aJMSxm.mjs → inference-proxy-DhcXOgUE.mjs} +174 -214
- package/dist/.setup/{isolated-completion-BIZFhTNG.mjs → isolated-completion-Dm3PzxJk.mjs} +9 -12
- package/dist/.setup/{managed-binary-BnshlFag.mjs → managed-binary-kiWRhNRE.mjs} +8 -12
- package/dist/.setup/{model-catalog-CfXJf9Ay.mjs → model-catalog-PAuZgJC6.mjs} +11 -10
- package/dist/.setup/model-runtime-BdqzOMkU.mjs +11 -0
- package/dist/.setup/{models-KnqBv0hE.mjs → models-DHXZtVVk.mjs} +9 -18
- package/dist/.setup/{native-auth-rWbGbMn3.mjs → native-auth-CuG53tu4.mjs} +4 -4
- package/dist/.setup/{native-execution-policy-umd0tgh4.mjs → native-execution-policy-BxZJy5mP.mjs} +5 -30
- package/dist/.setup/{native-subagent-monitor-D3filLY2.mjs → native-subagent-monitor-Dpsmf2wz.mjs} +4395 -3609
- package/dist/.setup/native-subagent-pending-assignments-DwkCzLvD.mjs +203 -0
- package/dist/.setup/native-task-assignments-DMQ0g3hu.mjs +194 -0
- package/dist/.setup/{node-cli-sessions-r3avj02l.mjs → node-cli-sessions-HC4W6FLI.mjs} +19 -49
- package/dist/.setup/{node-exec-server.runtime-BDwWXVpK.mjs → node-exec-server.runtime-BgBfWQqo.mjs} +3 -6
- package/dist/.setup/{plan-CN3VwfNU.mjs → plan-Y-QIvrKB.mjs} +49 -92
- package/dist/.setup/{plugin-activation-DT3MNtqj.mjs → plugin-activation-cNHRfaxU.mjs} +8 -36
- package/dist/.setup/{plugin-app-cache-key-B2CsSdnV.mjs → plugin-app-cache-key-BL9B5H0L.mjs} +6 -23
- package/dist/.setup/{plugin-inventory-BoRei8Z4.mjs → plugin-inventory-Cky2XJUw.mjs} +21 -21
- package/dist/.setup/{plugin-marketplace-discovery-CDOi8IFs.mjs → plugin-marketplace-discovery-D_dV9FXa.mjs} +18 -24
- package/dist/.setup/{plugin-metadata-cache-Ctmo83k_.mjs → plugin-metadata-cache-DsjsL1dr.mjs} +115 -175
- package/dist/.setup/{provider-BOsxQHOM.mjs → provider-DH8NSzGt.mjs} +11 -14
- package/dist/.setup/{provider-capabilities-BfE88FZ5.mjs → provider-capabilities-CAxoF-X1.mjs} +13 -18
- package/dist/.setup/{rate-limits-CMU3DUD0.mjs → rate-limits-B7-X2TgG.mjs} +9 -31
- package/dist/.setup/{request-D2L0zMrq.mjs → request-BHZ1nz8d.mjs} +7 -6
- package/dist/.setup/responses-oauth-twnuTaAa.mjs +93 -0
- package/dist/.setup/rpc-error-BlD2vuzn.mjs +31 -0
- package/dist/.setup/{run-attempt-BHu11r7h.mjs → run-attempt-D8RZUOzY.mjs} +1035 -1023
- package/dist/.setup/{run-attempt-lifecycle-B7JbY4-F.mjs → run-attempt-lifecycle-C-6O3Exn.mjs} +10 -24
- package/dist/.setup/{runtime-artifact-CLZ8udh-.mjs → runtime-artifact-DDQ-HGXf.mjs} +16 -4
- package/dist/.setup/runtime-artifact-connection-D68qQn1m.mjs +78 -0
- package/dist/.setup/sandbox-guard-DjCz2eOw.mjs +126 -0
- package/dist/.setup/scope-DOC1Xjc8.mjs +6 -0
- package/dist/.setup/session-binding-DGCYAfvD.mjs +443 -0
- package/dist/.setup/{session-binding-record-BGoz8wOK.mjs → session-binding-record-Oe9L-CNY.mjs} +52 -130
- package/dist/.setup/{session-binding-sidecars-BlB5EvIS.mjs → session-binding-sidecars-jo6H8dFr.mjs} +196 -17
- package/dist/.setup/{session-catalog-Pno1xGcl.mjs → session-catalog-4sCdv5qx.mjs} +170 -324
- package/dist/.setup/{session-catalog-adoption-BI6UTDZT.mjs → session-catalog-adoption-BU_pHWG7.mjs} +7 -6
- package/dist/.setup/{session-catalog-archive-lHBqzhaO.mjs → session-catalog-archive-spHfihri.mjs} +6 -6
- package/dist/.setup/session-catalog-events-DePDzzjc.mjs +139 -0
- package/dist/.setup/session-catalog-home-id-vlih0B_g.mjs +22 -0
- package/dist/.setup/{session-catalog-index-B9_VQIUz.mjs → session-catalog-index-CZvDzC6z.mjs} +126 -122
- package/dist/.setup/{session-catalog-index-order-hcdz07yN.mjs → session-catalog-index-order-BcQpHks3.mjs} +1 -1
- package/dist/.setup/{session-catalog-index-state-Dgh8ORJm.mjs → session-catalog-index-state-TeO7EyO-.mjs} +3 -2
- package/dist/.setup/session-catalog-limits-DDxOsQeC.mjs +14 -0
- package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +170 -0
- package/dist/.setup/session-catalog-native-projection-DjhwGL6x.mjs +178 -0
- package/dist/.setup/{session-catalog-node-adoption-ITddWx_X.mjs → session-catalog-node-adoption-DgXvSGu0.mjs} +10 -27
- package/dist/.setup/{session-catalog-node-continue-6g6qi4A9.mjs → session-catalog-node-continue-DjKXHBbi.mjs} +8 -10
- package/dist/.setup/session-catalog-node-lookup-CtAXI5W5.mjs +56 -0
- package/dist/.setup/{session-catalog-native-projection-DowriLid.mjs → session-catalog-parsing-CPGaPYr-.mjs} +11 -194
- package/dist/.setup/{session-catalog-projection-zK_PUsiE.mjs → session-catalog-projection-Cr5qP5Dj.mjs} +6 -4
- package/dist/.setup/session-catalog-provenance-DoAvktcj.mjs +95 -0
- package/dist/.setup/{session-cli-irrD-uo7.mjs → session-cli-Cn_nCqfq.mjs} +9 -22
- package/dist/.setup/{session-history-BrqhSCf9.mjs → session-history-D83lJWHG.mjs} +4 -6
- package/dist/.setup/{session-history-import-D-3wAgOP.mjs → session-history-import-WhX-X33a.mjs} +7 -10
- package/dist/.setup/session-history-read-Ov3StuL4.mjs +133 -0
- package/dist/.setup/{session-history.worker-CaCh0xF_.mjs → session-history.worker-MnPKncqP.mjs} +9 -5
- package/dist/.setup/session-initialization-6aveB9qb.mjs +22 -0
- package/dist/.setup/{session-permission-policy-BI1QK_98.mjs → session-permission-policy-Ci_fVX6y.mjs} +4 -8
- package/dist/.setup/{session-retirement-BH-S6qkJ.mjs → session-retirement-qMTxkNx2.mjs} +17 -17
- package/dist/.setup/{settled-turn-context-fmwouT5I.mjs → settled-turn-context-D4yj4rxf.mjs} +1 -1
- package/dist/.setup/{settled-turn-finalizer-DiAi6Kx6.mjs → settled-turn-finalizer-BsvEabkw.mjs} +14 -10
- package/dist/.setup/{shared-client-DA4VR4Eb.mjs → shared-client-DqyTMYug.mjs} +783 -412
- package/dist/.setup/shared-client-lifecycle-DJIgqgMw.mjs +153 -0
- package/dist/.setup/{side-question-BJ1wSDcB.mjs → side-question-C4kCmQy1.mjs} +79 -143
- package/dist/.setup/{source-CUzJq5WN.mjs → source-CS_7GFJZ.mjs} +80 -137
- package/dist/.setup/{thread-lifecycle-B3mfz1TG.mjs → thread-lifecycle-DPflntEJ.mjs} +294 -737
- package/dist/.setup/{incognito-session-uhrBF6wJ.mjs → thread-ownership-queue-Dp24d7-F.mjs} +1 -2
- package/dist/.setup/{thread-ownership-DcTtAcXj.mjs → thread-ownership-roNP0l1c.mjs} +45 -10
- package/dist/.setup/{thread-policy-DGuQsuFC.mjs → thread-policy-DTd-DtkX.mjs} +46 -7
- package/dist/.setup/{thread-requests-BLvGkP2R.mjs → thread-requests-B_bRnMGN.mjs} +199 -302
- package/dist/.setup/{thread-resume-DIBXwOpE.mjs → thread-resume-CdDaoc7T.mjs} +6 -6
- package/dist/.setup/{timeout-C910MdAB.mjs → timeout-CXOfNoaX.mjs} +1 -35
- package/dist/.setup/{transcript-history-projection-ZZpkFkJ_.mjs → transcript-history-projection-DRSifI-1.mjs} +17 -89
- package/dist/.setup/{transcript-mirror-attestation-CzM-94NC.mjs → transcript-mirror-attestation-YSegaktH.mjs} +3 -4
- package/dist/.setup/{transcript-mirror-BtHDBp1G.mjs → transcript-mirror-kxmCYsuF.mjs} +7 -9
- package/dist/.setup/{transport-stdio-h2VHOskC.mjs → transport-stdio-Bdegpn2V.mjs} +5 -22
- package/dist/.setup/transport-websocket-BTBE-LD9.mjs +211 -0
- package/dist/.setup/{upstream-prompt-provenance-LphB8slG.mjs → upstream-prompt-provenance-fXkKbPVC.mjs} +3 -9
- package/dist/.setup/{upstream-session-fork-BUr4OUbC.mjs → upstream-session-fork-CBeVjBpT.mjs} +23 -23
- package/dist/.setup/{usage-BML0r-ua.mjs → usage-BMzNxeR_.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-DUMbefVY.mjs → usage-limit-error-QXerDo3i.mjs} +4 -19
- package/dist/.setup/{web-search-provider.runtime-CDKlN-Rv.mjs → web-search-provider.runtime-P77OUeoo.mjs} +8 -19
- package/dist/api.js +9 -11
- package/dist/catalog-page.worker.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +50 -8
- package/dist/harness.js +344 -1
- package/dist/index.js +193 -245
- package/dist/media-understanding-provider.js +9 -22
- package/dist/migration-provider-api.js +1 -1
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +3 -3
- package/dist/session-history.worker.js +1 -1
- package/openclaw.plugin.json +14 -2
- package/package.json +7 -6
- package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +0 -331
- package/dist/.setup/compact-Du5UvtxA.mjs +0 -680
- package/dist/.setup/event-projector-assistant-message-BsruvNrH.mjs +0 -103
- package/dist/.setup/event-projector-items-C6L_5ZiT.mjs +0 -234
- package/dist/.setup/harness-a_MsE4-_.mjs +0 -355
- package/dist/.setup/history-rejection-B4nOXNXF.mjs +0 -13
- package/dist/.setup/image-payload-sanitizer-tupAr-2o.mjs +0 -79
- package/dist/.setup/local-runtime-attribution-B_2mnqhb.mjs +0 -19
- package/dist/.setup/native-subagent-history-0nYYgo0k.mjs +0 -148
- package/dist/.setup/native-subagent-task-ids-wb8CKZGN.mjs +0 -441
- package/dist/.setup/plugin-approval-roundtrip-C0MZzCuP.mjs +0 -122
- package/dist/.setup/rolldown-runtime-8H4AJuhK.mjs +0 -14
- package/dist/.setup/sandbox-guard-C2sRMOEY.mjs +0 -166
- package/dist/.setup/session-binding-Cm0apEbd.mjs +0 -692
- package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +0 -347
- package/dist/.setup/session-history-read-B3ZfSUbF.mjs +0 -50
- package/dist/.setup/session-initialization-rcgbZiid.mjs +0 -75
- package/dist/.setup/thread-history-page-DoVpnHim.mjs +0 -83
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as buildCodexAppServerUsageSnapshot } from "./rate-limits-
|
|
2
|
-
import { n as readCodexAppServerUsage } from "./request-
|
|
3
|
-
import "./config-
|
|
4
|
-
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-
|
|
1
|
+
import { t as buildCodexAppServerUsageSnapshot } from "./rate-limits-B7-X2TgG.mjs";
|
|
2
|
+
import { n as readCodexAppServerUsage } from "./request-BHZ1nz8d.mjs";
|
|
3
|
+
import "./config-DKhXquav.mjs";
|
|
4
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-C0NbLms1.mjs";
|
|
5
5
|
import { CODEX_APP_SERVER_AUTH_MARKER } from "openclaw/plugin-sdk/agent-runtime";
|
|
6
6
|
//#region extensions/codex/src/app-server/usage.ts
|
|
7
7
|
/** Handles the synthetic usage credential for a Codex-backed OpenAI route. */
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
2
|
-
import { a as shouldRefreshCodexRateLimitsForUsageLimitMessage, i as resolveCodexUsageLimitResetAtMs, n as formatCodexUsageLimitErrorMessage } from "./rate-limits-
|
|
3
|
-
import { t as CODEX_CONTROL_METHODS } from "./capabilities-
|
|
4
|
-
import {
|
|
2
|
+
import { a as shouldRefreshCodexRateLimitsForUsageLimitMessage, i as resolveCodexUsageLimitResetAtMs, n as formatCodexUsageLimitErrorMessage } from "./rate-limits-B7-X2TgG.mjs";
|
|
3
|
+
import { t as CODEX_CONTROL_METHODS } from "./capabilities-B3WEZl4e.mjs";
|
|
4
|
+
import { X as readRecentCodexRateLimits, Y as readCodexRateLimitsRevision, Z as rememberCodexRateLimitsRead } from "./shared-client-DqyTMYug.mjs";
|
|
5
5
|
import { readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { markAuthProfileBlockedUntil } from "openclaw/plugin-sdk/agent-runtime";
|
|
7
7
|
import { embeddedAgentLog, formatErrorMessage } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
8
8
|
//#region extensions/codex/src/app-server/usage-limit-error.ts
|
|
9
|
-
/**
|
|
10
|
-
* Enriches Codex usage-limit failures with current rate-limit information and
|
|
11
|
-
* marks blocked auth profiles when Codex exposes a reset time.
|
|
12
|
-
*/
|
|
13
9
|
const CODEX_USAGE_LIMIT_RATE_LIMIT_REFRESH_TIMEOUT_MS = 5e3;
|
|
14
10
|
var CodexUsageLimitPromptError = class extends Error {
|
|
15
11
|
constructor(..._args) {
|
|
@@ -39,7 +35,6 @@ function resolveCodexPromptError(source) {
|
|
|
39
35
|
...info === "serverOverloaded" ? { code: "OVERLOADED" } : {}
|
|
40
36
|
});
|
|
41
37
|
}
|
|
42
|
-
/** Marks a Codex auth profile blocked until the reset time advertised by rate limits. */
|
|
43
38
|
async function markCodexAuthProfileBlockedFromRateLimits(params) {
|
|
44
39
|
const authProfileId = params.authProfileId?.trim();
|
|
45
40
|
if (!authProfileId || !params.params.authProfileStore) return;
|
|
@@ -62,7 +57,6 @@ async function markCodexAuthProfileBlockedFromRateLimits(params) {
|
|
|
62
57
|
});
|
|
63
58
|
}
|
|
64
59
|
}
|
|
65
|
-
/** Formats a turn-start usage-limit error, refreshing rate limits when needed. */
|
|
66
60
|
async function formatCodexTurnStartUsageLimitError(params) {
|
|
67
61
|
return refreshCodexUsageLimitError({
|
|
68
62
|
client: params.client,
|
|
@@ -71,7 +65,6 @@ async function formatCodexTurnStartUsageLimitError(params) {
|
|
|
71
65
|
signal: params.signal
|
|
72
66
|
});
|
|
73
67
|
}
|
|
74
|
-
/** Refreshes a generic prompt usage-limit message into a reset-aware message. */
|
|
75
68
|
async function refreshCodexUsageLimitPromptError(params) {
|
|
76
69
|
if (!shouldRefreshCodexRateLimitsForUsageLimitMessage(params.message)) return;
|
|
77
70
|
return refreshCodexUsageLimitError({
|
|
@@ -87,15 +80,7 @@ async function refreshCodexUsageLimitPromptError(params) {
|
|
|
87
80
|
}
|
|
88
81
|
async function refreshCodexUsageLimitError(params) {
|
|
89
82
|
const initialMessage = formatCodexUsageLimitErrorMessage(params.source);
|
|
90
|
-
|
|
91
|
-
message: initialMessage,
|
|
92
|
-
...params.source.rateLimitsTrustedForProfile ? { rateLimitsForProfile: params.source.rateLimits } : {}
|
|
93
|
-
} : void 0;
|
|
94
|
-
const rateLimits = await readCodexRateLimitsFromAppServerForUsageLimitError({
|
|
95
|
-
client: params.client,
|
|
96
|
-
timeoutMs: params.timeoutMs,
|
|
97
|
-
signal: params.signal
|
|
98
|
-
});
|
|
83
|
+
const rateLimits = shouldRefreshCodexRateLimitsForUsageLimitMessage(initialMessage) ? await readCodexRateLimitsFromAppServerForUsageLimitError(params) : void 0;
|
|
99
84
|
if (!rateLimits) return initialMessage ? {
|
|
100
85
|
message: initialMessage,
|
|
101
86
|
...params.source.rateLimitsTrustedForProfile ? { rateLimitsForProfile: params.source.rateLimits } : {}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
2
|
-
import { f as buildCodexNativeWebSearchThreadConfig } from "./thread-requests-
|
|
3
|
-
import { runBoundedCodexAppServerTurn } from "./bounded-turn-
|
|
4
|
-
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
+
import { f as buildCodexNativeWebSearchThreadConfig } from "./thread-requests-B_bRnMGN.mjs";
|
|
3
|
+
import { runBoundedCodexAppServerTurn } from "./bounded-turn-CbjoN2OW.mjs";
|
|
4
|
+
import { normalizeOptionalString, normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { readStringParam, resolveSearchTimeoutSeconds, wrapWebContent } from "openclaw/plugin-sdk/provider-web-search";
|
|
6
6
|
//#region extensions/codex/src/web-search-provider.runtime.ts
|
|
7
7
|
async function executeCodexWebSearchProviderTool(ctx, args, executionContext, options) {
|
|
@@ -46,11 +46,11 @@ async function executeCodexWebSearchProviderTool(ctx, args, executionContext, op
|
|
|
46
46
|
}
|
|
47
47
|
function summarizeCodexWebSearchItem(item) {
|
|
48
48
|
const action = isJsonObject(item.action) ? item.action : void 0;
|
|
49
|
-
const actionType =
|
|
50
|
-
const queries = actionType === "search" ?
|
|
51
|
-
const query = normalizeOptionalString(item.query) ?? (actionType === "search" ?
|
|
52
|
-
const url =
|
|
53
|
-
const pattern =
|
|
49
|
+
const actionType = normalizeOptionalString(action?.type);
|
|
50
|
+
const queries = actionType === "search" ? normalizeTrimmedStringList(action?.queries) : [];
|
|
51
|
+
const query = normalizeOptionalString(item.query) ?? (actionType === "search" ? normalizeOptionalString(action?.query) : void 0) ?? queries[0];
|
|
52
|
+
const url = normalizeOptionalString(action?.url);
|
|
53
|
+
const pattern = normalizeOptionalString(action?.pattern);
|
|
54
54
|
return {
|
|
55
55
|
...query ? { query } : {},
|
|
56
56
|
...queries.length > 0 ? { queries } : {},
|
|
@@ -59,16 +59,5 @@ function summarizeCodexWebSearchItem(item) {
|
|
|
59
59
|
...pattern ? { pattern } : {}
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
function readNonEmptyString(record, key) {
|
|
63
|
-
return record ? normalizeOptionalString(record[key]) : void 0;
|
|
64
|
-
}
|
|
65
|
-
function readNonEmptyStringArray(record, key) {
|
|
66
|
-
const value = record?.[key];
|
|
67
|
-
if (!Array.isArray(value)) return [];
|
|
68
|
-
return value.flatMap((entry) => {
|
|
69
|
-
const normalized = normalizeOptionalString(entry);
|
|
70
|
-
return normalized ? [normalized] : [];
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
62
|
//#endregion
|
|
74
63
|
export { executeCodexWebSearchProviderTool };
|
package/dist/api.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { d as readCodexPluginConfig } from "./.setup/config-parsing-
|
|
2
|
-
import { a as resolveCodexAppServerStartOptionsForAgent } from "./.setup/config-options-
|
|
3
|
-
import { i as resolveManagedCodexNativeCommand, r as resolveManagedCodexAppServerStartOptions, s as CODEX_APP_SERVER_VERSION, t as isManagedCodexDesktopCommand } from "./.setup/managed-binary-
|
|
1
|
+
import { d as readCodexPluginConfig } from "./.setup/config-parsing-b088LyhT.mjs";
|
|
2
|
+
import { a as resolveCodexAppServerStartOptionsForAgent } from "./.setup/config-options-CzyWLTJt.mjs";
|
|
3
|
+
import { i as resolveManagedCodexNativeCommand, r as resolveManagedCodexAppServerStartOptions, s as CODEX_APP_SERVER_VERSION, t as isManagedCodexDesktopCommand } from "./.setup/managed-binary-kiWRhNRE.mjs";
|
|
4
4
|
import { t as codexNativeProfileRecoveryHealthCheck } from "./.setup/auth-profile-health-oHizqgye.mjs";
|
|
5
5
|
import { n as findCodexAppServerSpawnError, t as describeCodexSpawnError } from "./.setup/spawn-error-CL3n6MAa.mjs";
|
|
6
|
-
import "./.setup/config-
|
|
7
|
-
import { n as resolveCodexAppServerRuntimeOptions } from "./.setup/config-runtime-
|
|
6
|
+
import "./.setup/config-DKhXquav.mjs";
|
|
7
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./.setup/config-runtime-C0NbLms1.mjs";
|
|
8
8
|
import { listAgentIds, resolveAgentDir } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
9
9
|
import { runUtf8CommandWithTimeout } from "openclaw/plugin-sdk/process-runtime";
|
|
10
10
|
import path from "node:path";
|
|
11
|
+
import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
11
12
|
import { fileURLToPath } from "node:url";
|
|
12
13
|
import { resolveDefaultModelForAgent } from "openclaw/plugin-sdk/agent-runtime";
|
|
13
14
|
import { resolveEffectiveAgentRuntime } from "openclaw/plugin-sdk/command-auth-native";
|
|
@@ -26,9 +27,6 @@ function managedCodexFinding(params) {
|
|
|
26
27
|
...params.fixHint ? { fixHint: params.fixHint } : {}
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
|
-
function readErrorMessage(error) {
|
|
30
|
-
return error instanceof Error ? error.message : String(error);
|
|
31
|
-
}
|
|
32
30
|
function parseCodexVersion(output) {
|
|
33
31
|
return /(?:^|\s)(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)(?:\s|$)/u.exec(output)?.[1];
|
|
34
32
|
}
|
|
@@ -97,7 +95,7 @@ function createCodexManagedAppServerHealthCheck(params) {
|
|
|
97
95
|
resolved = await resolveStartOptions(candidate, { pluginRoot: params.pluginRoot });
|
|
98
96
|
} catch (error) {
|
|
99
97
|
return [managedCodexFinding({
|
|
100
|
-
message: `Managed Codex app-server could not be resolved: ${
|
|
98
|
+
message: `Managed Codex app-server could not be resolved: ${coerceErrorMessage(error)}`,
|
|
101
99
|
path: params.pluginRoot,
|
|
102
100
|
requirement: `an executable Codex ${CODEX_APP_SERVER_VERSION} managed artifact`,
|
|
103
101
|
fixHint: "Reinstall the staged OpenClaw package with its @openai/codex platform dependency, then rerun the candidate check."
|
|
@@ -120,7 +118,7 @@ function createCodexManagedAppServerHealthCheck(params) {
|
|
|
120
118
|
} catch (error) {
|
|
121
119
|
const spawnFailure = findCodexAppServerSpawnError(describeCodexSpawnError(error, nativeCommand));
|
|
122
120
|
return [managedCodexFinding({
|
|
123
|
-
message: spawnFailure?.message ?? `Managed Codex app-server version check failed: ${
|
|
121
|
+
message: spawnFailure?.message ?? `Managed Codex app-server version check failed: ${coerceErrorMessage(error)}`,
|
|
124
122
|
severity: spawnFailure && resolved.managedCommandOrder === "package-only" ? "warning" : versionFailureSeverity,
|
|
125
123
|
path: nativeCommand,
|
|
126
124
|
requirement: `Codex ${CODEX_APP_SERVER_VERSION} must report its version within ${CODEX_VERSION_TIMEOUT_MS} ms`,
|
|
@@ -128,7 +126,7 @@ function createCodexManagedAppServerHealthCheck(params) {
|
|
|
128
126
|
})];
|
|
129
127
|
}
|
|
130
128
|
const detectedVersion = parseCodexVersion(`${output.stdout}\n${output.stderr}`);
|
|
131
|
-
if (detectedVersion !== "0.
|
|
129
|
+
if (detectedVersion !== "0.158.0") return [managedCodexFinding({
|
|
132
130
|
severity: versionFailureSeverity,
|
|
133
131
|
message: detectedVersion ? `Managed Codex app-server version mismatch: expected ${CODEX_APP_SERVER_VERSION}, detected ${detectedVersion}.` : `Managed Codex app-server did not report a parseable version; expected ${CODEX_APP_SERVER_VERSION}.`,
|
|
134
132
|
path: nativeCommand,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createCodexCatalogDecoder } from "./.setup/client-catalog-response-
|
|
1
|
+
import { t as createCodexCatalogDecoder } from "./.setup/client-catalog-response-5HHLdcde.mjs";
|
|
2
2
|
import { serveWorkerTasks } from "openclaw/plugin-sdk/worker-task-server";
|
|
3
3
|
//#region extensions/codex/catalog-page.worker.ts
|
|
4
4
|
const decode = createCodexCatalogDecoder();
|
package/dist/cli-metadata.js
CHANGED
|
@@ -2,7 +2,7 @@ import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
|
2
2
|
//#region extensions/codex/cli-metadata.ts
|
|
3
3
|
function registerCodexCliMetadata(api) {
|
|
4
4
|
api.registerCli(async ({ program }) => {
|
|
5
|
-
const { registerCodexSessionCli } = await import("./.setup/session-cli-
|
|
5
|
+
const { registerCodexSessionCli } = await import("./.setup/session-cli-Cn_nCqfq.mjs");
|
|
6
6
|
registerCodexSessionCli(program);
|
|
7
7
|
}, { descriptors: [{
|
|
8
8
|
name: "codex",
|
|
@@ -114,6 +114,11 @@ function hasRetiredApprovalPolicy(value) {
|
|
|
114
114
|
const approvalPolicy = asNullableRecord(value)?.approvalPolicy;
|
|
115
115
|
return approvalPolicy === "on-failure" || approvalPolicy === "untrusted";
|
|
116
116
|
}
|
|
117
|
+
function hasBlankNetworkProxyOptionalFields(value) {
|
|
118
|
+
const appServer = asNullableRecord(value);
|
|
119
|
+
const networkProxy = asNullableRecord(appServer?.networkProxy);
|
|
120
|
+
return networkProxy?.enabled === true && [networkProxy.profileName, appServer?.remoteWorkspaceRoot].some((field) => typeof field === "string" && !field.trim());
|
|
121
|
+
}
|
|
117
122
|
const RETIRED_TURN_IDLE_TIMEOUT_KEYS = [
|
|
118
123
|
"turnCompletionIdleTimeoutMs",
|
|
119
124
|
"turnAssistantCompletionIdleTimeoutMs",
|
|
@@ -167,10 +172,21 @@ const legacyConfigRules = [
|
|
|
167
172
|
],
|
|
168
173
|
message: "Codex app-server turn idle timeouts are retired; native Codex owns provider liveness and turn completion. The existing agents.defaults.timeoutSeconds run limit remains unchanged. Run \"openclaw doctor --fix\" to remove the old settings.",
|
|
169
174
|
match: hasRetiredTurnIdleTimeout
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
path: [
|
|
178
|
+
"plugins",
|
|
179
|
+
"entries",
|
|
180
|
+
"codex",
|
|
181
|
+
"config",
|
|
182
|
+
"appServer"
|
|
183
|
+
],
|
|
184
|
+
message: "Blank plugins.entries.codex.config.appServer.networkProxy.profileName or appServer.remoteWorkspaceRoot must be removed to use the defaults with network restrictions. Run \"openclaw doctor --fix\".",
|
|
185
|
+
match: hasBlankNetworkProxyOptionalFields
|
|
170
186
|
}
|
|
171
187
|
];
|
|
172
188
|
/**
|
|
173
|
-
*
|
|
189
|
+
* Repairs legacy Codex plugin config while preserving unrelated config.
|
|
174
190
|
*/
|
|
175
191
|
function normalizeCompatibilityConfig({ cfg }) {
|
|
176
192
|
const rawEntry = asNullableRecord(cfg.plugins?.entries?.codex);
|
|
@@ -181,7 +197,8 @@ function normalizeCompatibilityConfig({ cfg }) {
|
|
|
181
197
|
const shouldRewriteDestructivePolicy = hasLegacyPluginDestructivePolicy(rawCodexPlugins);
|
|
182
198
|
const shouldRewriteApprovalPolicy = hasRetiredApprovalPolicy(rawAppServer);
|
|
183
199
|
const shouldRemoveTurnIdleTimeouts = hasRetiredTurnIdleTimeout(rawAppServer);
|
|
184
|
-
|
|
200
|
+
const shouldRemoveBlankNetworkProxyFields = hasBlankNetworkProxyOptionalFields(rawAppServer);
|
|
201
|
+
if (!rawPluginConfig || !shouldRemoveDynamicToolsProfile && !shouldRewriteDestructivePolicy && !shouldRewriteApprovalPolicy && !shouldRemoveTurnIdleTimeouts && !shouldRemoveBlankNetworkProxyFields) return {
|
|
185
202
|
config: cfg,
|
|
186
203
|
changes: []
|
|
187
204
|
};
|
|
@@ -216,6 +233,21 @@ function normalizeCompatibilityConfig({ cfg }) {
|
|
|
216
233
|
changes.push(`Removed retired plugins.entries.codex.config.appServer.${key}; native Codex owns provider liveness and turn completion. agents.defaults.timeoutSeconds was not changed.`);
|
|
217
234
|
}
|
|
218
235
|
}
|
|
236
|
+
if (nextAppServer && shouldRemoveBlankNetworkProxyFields) {
|
|
237
|
+
const nextNetworkProxy = asNullableRecord(nextAppServer.networkProxy);
|
|
238
|
+
for (const [target, key, configPath] of [[
|
|
239
|
+
nextNetworkProxy,
|
|
240
|
+
"profileName",
|
|
241
|
+
"networkProxy.profileName"
|
|
242
|
+
], [
|
|
243
|
+
nextAppServer,
|
|
244
|
+
"remoteWorkspaceRoot",
|
|
245
|
+
"remoteWorkspaceRoot"
|
|
246
|
+
]]) if (target && typeof target[key] === "string" && !target[key].trim()) {
|
|
247
|
+
delete target[key];
|
|
248
|
+
changes.push(`Removed blank plugins.entries.codex.config.appServer.${configPath}; the default now applies.`);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
219
251
|
if (shouldRewriteApprovalPolicy) {
|
|
220
252
|
if (nextAppServer?.approvalPolicy === "on-failure" || nextAppServer?.approvalPolicy === "untrusted") nextAppServer.approvalPolicy = "on-request";
|
|
221
253
|
changes.push("Renamed retired plugins.entries.codex.config.appServer.approvalPolicy to \"on-request\".");
|
|
@@ -225,11 +257,21 @@ function normalizeCompatibilityConfig({ cfg }) {
|
|
|
225
257
|
changes
|
|
226
258
|
};
|
|
227
259
|
}
|
|
228
|
-
const stateMigrations = [
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
260
|
+
const stateMigrations = [
|
|
261
|
+
{
|
|
262
|
+
id: "codex-app-server-sidecars-to-plugin-state",
|
|
263
|
+
label: "Codex app-server thread bindings",
|
|
264
|
+
detectLegacyState: async (params) => (await import("./.setup/session-binding-sidecars-jo6H8dFr.mjs")).detectLegacySessionBindingSidecars(params),
|
|
265
|
+
migrateLegacyState: async (params) => (await import("./.setup/session-binding-sidecars-jo6H8dFr.mjs")).migrateLegacySessionBindingSidecars(params)
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
id: "codex-native-task-assignments",
|
|
269
|
+
label: "Codex native pending assignments",
|
|
270
|
+
collectBackupResources: async (params) => (await import("./.setup/native-task-assignments-DMQ0g3hu.mjs")).codexNativeTaskAssignmentMigration.collectBackupResources(params),
|
|
271
|
+
detectLegacyState: async (params) => (await import("./.setup/native-task-assignments-DMQ0g3hu.mjs")).codexNativeTaskAssignmentMigration.detectLegacyState(params),
|
|
272
|
+
migrateLegacyState: async (params) => (await import("./.setup/native-task-assignments-DMQ0g3hu.mjs")).codexNativeTaskAssignmentMigration.migrateLegacyState(params)
|
|
273
|
+
},
|
|
274
|
+
codexOrphanedSessionBindingMigration
|
|
275
|
+
];
|
|
234
276
|
//#endregion
|
|
235
277
|
export { legacyConfigRules, normalizeCompatibilityConfig, stateMigrations };
|
package/dist/harness.js
CHANGED
|
@@ -1,2 +1,345 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CODEX_NATIVE_TOOL_REQUIREMENTS } from "./native-tool-policy.js";
|
|
2
|
+
import { n as readCodexRuntimeModelId } from "./.setup/model-runtime-BdqzOMkU.mjs";
|
|
3
|
+
import { v as sessionBindingIdentity } from "./.setup/session-binding-record-Oe9L-CNY.mjs";
|
|
4
|
+
import { t as codexBuildSymbol } from "./.setup/build-state-Da1_z0kd.mjs";
|
|
5
|
+
import { resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
6
|
+
//#region extensions/codex/harness.ts
|
|
7
|
+
const DEFAULT_CODEX_HARNESS_PROVIDER_IDS = /* @__PURE__ */ new Set(["codex", "openai"]);
|
|
8
|
+
/** Keep the shipped callback loadable on older hosts without inventing source authority. */
|
|
9
|
+
function requireCodexCompactionCapabilities(params) {
|
|
10
|
+
const capabilities = params.hostCapabilities;
|
|
11
|
+
if (capabilities?.kind !== "agent-harness-host-capability" || capabilities.version !== 1 || typeof capabilities.assertActive !== "function" || typeof capabilities.retainSourceAuthority !== "function") throw new Error("This host did not provide compaction source authority. Update OpenClaw before compacting this session.");
|
|
12
|
+
capabilities.assertActive();
|
|
13
|
+
return {
|
|
14
|
+
...params,
|
|
15
|
+
hostCapabilities: capabilities
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const SHARED_CODEX_APP_SERVER_CLIENT_DISPOSER = codexBuildSymbol("openclaw.codexAppServerClientDisposer");
|
|
19
|
+
const CODEX_TOOL_POLICY_SAFE_DENY_NAMES = [
|
|
20
|
+
"web_fetch",
|
|
21
|
+
"x_search",
|
|
22
|
+
"memory_search",
|
|
23
|
+
"memory_get",
|
|
24
|
+
"dashboard",
|
|
25
|
+
"canvas",
|
|
26
|
+
"show_widget",
|
|
27
|
+
"message",
|
|
28
|
+
"heartbeat_respond",
|
|
29
|
+
"automations",
|
|
30
|
+
"gateway",
|
|
31
|
+
"skill_workshop",
|
|
32
|
+
"image_generate",
|
|
33
|
+
"music_generate",
|
|
34
|
+
"video_generate",
|
|
35
|
+
"tts"
|
|
36
|
+
];
|
|
37
|
+
const CODEX_APP_SERVER_CONTEXT_ENGINE_HOST_CAPABILITIES = [
|
|
38
|
+
"bootstrap",
|
|
39
|
+
"assemble-before-prompt",
|
|
40
|
+
"after-turn",
|
|
41
|
+
"maintain",
|
|
42
|
+
"compact",
|
|
43
|
+
"runtime-llm-complete",
|
|
44
|
+
"thread-bootstrap-projection"
|
|
45
|
+
];
|
|
46
|
+
async function disposeSharedCodexAppServerClients() {
|
|
47
|
+
const dispose = globalThis[SHARED_CODEX_APP_SERVER_CLIENT_DISPOSER];
|
|
48
|
+
await dispose?.();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Creates the Codex app-server harness used for attempts, side questions,
|
|
52
|
+
* compaction, reset, and disposal.
|
|
53
|
+
*/
|
|
54
|
+
function createCodexAppServerAgentHarness(options) {
|
|
55
|
+
const harnessRuntimeId = options?.id ?? "codex";
|
|
56
|
+
const normalizedHarnessRuntimeId = harnessRuntimeId.trim().toLowerCase();
|
|
57
|
+
const providerIds = new Set([...options?.providerIds ?? DEFAULT_CODEX_HARNESS_PROVIDER_IDS].map((id) => id.trim().toLowerCase()));
|
|
58
|
+
const sessionCatalogControlFactory = options.sessionCatalogControlFactory;
|
|
59
|
+
const sessionRuntime = options.runtime;
|
|
60
|
+
let modelCatalog;
|
|
61
|
+
let disposed = false;
|
|
62
|
+
const resolveAttemptPluginConfig = (config) => resolvePluginConfigObject(config, "codex") ?? options.resolvePluginConfig?.() ?? options.pluginConfig;
|
|
63
|
+
return {
|
|
64
|
+
id: harnessRuntimeId,
|
|
65
|
+
label: options?.label ?? "Codex agent harness",
|
|
66
|
+
autoSelection: { providerIds: [...providerIds] },
|
|
67
|
+
cloudPlacement: {
|
|
68
|
+
mode: "remote-exec",
|
|
69
|
+
devicePlacement: {
|
|
70
|
+
requiredNodeCommands: ["codex.exec-server.stdio.v1"],
|
|
71
|
+
consumesWorkerSlot: false
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
delegatedExecutionPluginIds: ["voice-call"],
|
|
75
|
+
contextEngineHostCapabilities: CODEX_APP_SERVER_CONTEXT_ENGINE_HOST_CAPABILITIES,
|
|
76
|
+
conversationToolPolicySupport: "exact",
|
|
77
|
+
nativeModelPolicySupport: "exact",
|
|
78
|
+
conversationToolPolicySafeDenyTools: CODEX_TOOL_POLICY_SAFE_DENY_NAMES,
|
|
79
|
+
conversationToolPolicyNativeTools: CODEX_NATIVE_TOOL_REQUIREMENTS,
|
|
80
|
+
deliveryDefaults: { visibleReplies: "message_tool" },
|
|
81
|
+
authBootstrap: "harness",
|
|
82
|
+
resolveSessionRuntimeOwnership: (params) => {
|
|
83
|
+
const assertCurrent = () => {
|
|
84
|
+
params.assertCurrent();
|
|
85
|
+
if (disposed) throw new Error("Codex agent harness is disposed");
|
|
86
|
+
};
|
|
87
|
+
assertCurrent();
|
|
88
|
+
const identity = sessionBindingIdentity(params);
|
|
89
|
+
let binding = options.bindingStore.read(identity);
|
|
90
|
+
if (!binding) {
|
|
91
|
+
const previousSessionId = params.readPreviousSessionId?.();
|
|
92
|
+
binding = previousSessionId ? options.bindingStore.read({
|
|
93
|
+
...identity,
|
|
94
|
+
sessionId: previousSessionId
|
|
95
|
+
}) : void 0;
|
|
96
|
+
}
|
|
97
|
+
assertCurrent();
|
|
98
|
+
return binding?.preserveNativeModel === true ? {
|
|
99
|
+
model: "native",
|
|
100
|
+
auth: binding.connectionScope === "supervision" ? "native" : "host",
|
|
101
|
+
...binding.model?.trim() && binding.modelProvider ? { modelRef: {
|
|
102
|
+
provider: binding.modelProvider,
|
|
103
|
+
model: binding.model
|
|
104
|
+
} } : {}
|
|
105
|
+
} : void 0;
|
|
106
|
+
},
|
|
107
|
+
...sessionCatalogControlFactory && sessionRuntime ? { sessionForkV2: {
|
|
108
|
+
executionEnvironment: "host-only",
|
|
109
|
+
upstreamKinds: ["codex-app-server"],
|
|
110
|
+
fork: async (params) => {
|
|
111
|
+
const { forkCodexUpstreamSession } = await import("./.setup/upstream-session-fork-CBeVjBpT.mjs");
|
|
112
|
+
return await forkCodexUpstreamSession(params, {
|
|
113
|
+
bindingStore: options.bindingStore,
|
|
114
|
+
controlFactory: sessionCatalogControlFactory,
|
|
115
|
+
harnessRuntimeId,
|
|
116
|
+
resolveConfig: options.resolveConfig,
|
|
117
|
+
runtime: sessionRuntime
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
} } : {},
|
|
121
|
+
authBinding: { fingerprint: async (params) => {
|
|
122
|
+
const { fingerprintCodexAppServerAuthBinding } = await import("./.setup/auth-binding-BLWz7stm.mjs").then((n) => n.t);
|
|
123
|
+
return fingerprintCodexAppServerAuthBinding(params);
|
|
124
|
+
} },
|
|
125
|
+
runtimeArtifact: { validate: async (binding) => {
|
|
126
|
+
const { validateCodexAppServerRuntimeArtifact } = await import("./.setup/runtime-artifact-DDQ-HGXf.mjs");
|
|
127
|
+
const { isCodexConfiguredConnectionArtifact } = await import("./.setup/runtime-artifact-connection-D68qQn1m.mjs");
|
|
128
|
+
if (!isCodexConfiguredConnectionArtifact(binding.id)) return validateCodexAppServerRuntimeArtifact(binding);
|
|
129
|
+
const { resolveCodexAppServerRuntimeOptions } = await import("./.setup/config-DKhXquav.mjs").then((n) => n.t);
|
|
130
|
+
return validateCodexAppServerRuntimeArtifact(binding, void 0, resolveCodexAppServerRuntimeOptions({ pluginConfig: resolveAttemptPluginConfig(options.resolveConfig?.()) }).start);
|
|
131
|
+
} },
|
|
132
|
+
fetchUsageSnapshot: async (ctx) => {
|
|
133
|
+
const { fetchCodexAppServerUsageSnapshot } = await import("./.setup/usage-BMzNxeR_.mjs");
|
|
134
|
+
return await fetchCodexAppServerUsageSnapshot(ctx, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
135
|
+
},
|
|
136
|
+
loadModelCatalog: async (params) => {
|
|
137
|
+
const { createCodexAppServerModelCatalog } = await import("./.setup/model-catalog-PAuZgJC6.mjs");
|
|
138
|
+
if (disposed) return { entries: [] };
|
|
139
|
+
modelCatalog ??= createCodexAppServerModelCatalog(harnessRuntimeId);
|
|
140
|
+
return { entries: await modelCatalog.load(params, resolveAttemptPluginConfig(params.config)) };
|
|
141
|
+
},
|
|
142
|
+
readModelCatalogReadiness: (params) => modelCatalog?.read(params, resolveAttemptPluginConfig(params.config)),
|
|
143
|
+
loadMcpToolCatalog: async (params) => {
|
|
144
|
+
const { loadCodexEffectiveMcpCatalog } = await import("./.setup/effective-mcp-catalog-CxUtC-xG.mjs");
|
|
145
|
+
return await loadCodexEffectiveMcpCatalog(params, { bindingStore: options.bindingStore });
|
|
146
|
+
},
|
|
147
|
+
supports: (ctx) => {
|
|
148
|
+
const provider = ctx.provider.trim().toLowerCase();
|
|
149
|
+
if (!providerIds.has(provider)) return {
|
|
150
|
+
supported: false,
|
|
151
|
+
reason: `provider is not one of: ${[...providerIds].toSorted().join(", ")}`
|
|
152
|
+
};
|
|
153
|
+
if (ctx.modelProvider?.requestTransportOverrides === "present") return {
|
|
154
|
+
supported: false,
|
|
155
|
+
reason: "Codex cannot reproduce authored request transport overrides",
|
|
156
|
+
fallbackRuntime: "openclaw"
|
|
157
|
+
};
|
|
158
|
+
const preparedAuth = ctx.modelProvider?.preparedAuth;
|
|
159
|
+
const runtimePolicy = ctx.modelProvider?.runtimePolicy;
|
|
160
|
+
const nativeAccountOwnsUnobservedModel = provider === "openai" && ctx.requestedRuntime === "codex" && Boolean(ctx.modelId?.trim()) && (preparedAuth === void 0 || preparedAuth.source === "harness") && preparedAuth?.mode === void 0 && preparedAuth?.requirement === void 0 && ctx.modelProvider?.api === void 0 && ctx.modelProvider?.baseUrl === void 0 && ctx.modelProvider?.azureApiVersion === void 0 && ctx.modelProvider?.request === void 0;
|
|
161
|
+
if (runtimePolicy) {
|
|
162
|
+
if (!runtimePolicy.compatibleIds.some((id) => id.trim().toLowerCase() === normalizedHarnessRuntimeId)) return {
|
|
163
|
+
supported: false,
|
|
164
|
+
reason: "Codex cannot reproduce the prepared provider route"
|
|
165
|
+
};
|
|
166
|
+
} else if (ctx.modelProvider && provider !== "codex" && !nativeAccountOwnsUnobservedModel) return {
|
|
167
|
+
supported: false,
|
|
168
|
+
reason: "provider route compatibility with Codex is not declared"
|
|
169
|
+
};
|
|
170
|
+
if (preparedAuth?.requirement === "subscription") {
|
|
171
|
+
if (!(preparedAuth.source === "profile" && (preparedAuth.mode === "oauth" || preparedAuth.mode === "token"))) return {
|
|
172
|
+
supported: false,
|
|
173
|
+
reason: "Codex subscription auth requires a prepared OAuth or token profile"
|
|
174
|
+
};
|
|
175
|
+
} else if (preparedAuth?.requirement === "api-key") {
|
|
176
|
+
if (!(preparedAuth.source !== "none" && preparedAuth.source !== "harness" && (preparedAuth.mode === "api-key" || preparedAuth.mode === "api_key"))) return {
|
|
177
|
+
supported: false,
|
|
178
|
+
reason: "Codex Platform auth requires a prepared API key"
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
supported: true,
|
|
183
|
+
priority: 100
|
|
184
|
+
};
|
|
185
|
+
},
|
|
186
|
+
runAttempt: async (params) => {
|
|
187
|
+
const { runCodexAppServerAttempt } = await import("./.setup/run-attempt-D8RZUOzY.mjs");
|
|
188
|
+
const { planCodexCyberEscalation, readCodexCyberAttemptVerdict, recordCodexCyberTargetUnavailable, reserveCodexCyberProbe, resolveCodexCyberFailoverConfig } = await import("./.setup/cyber-failover-XV0nNRZu.mjs");
|
|
189
|
+
const { emitCodexCyberNotice } = await import("./.setup/cyber-failover-notice-RNpGpTyP.mjs");
|
|
190
|
+
const pluginConfig = resolveAttemptPluginConfig(params.config);
|
|
191
|
+
const attemptModel = readCodexRuntimeModelId(params.model, params.modelId);
|
|
192
|
+
const runAttemptOnModel = (model, isRetry = false) => runCodexAppServerAttempt(isRetry ? {
|
|
193
|
+
...params,
|
|
194
|
+
suppressNextUserMessagePersistence: true
|
|
195
|
+
} : params, {
|
|
196
|
+
bindingStore: options.bindingStore,
|
|
197
|
+
pluginConfig,
|
|
198
|
+
runtime: sessionRuntime,
|
|
199
|
+
runtimeModelId: model,
|
|
200
|
+
nativeHookRelay: { enabled: true }
|
|
201
|
+
});
|
|
202
|
+
const cyberFailover = resolveCodexCyberFailoverConfig(pluginConfig);
|
|
203
|
+
const workspace = {
|
|
204
|
+
agentId: params.agentId,
|
|
205
|
+
authProfileId: params.authProfileId
|
|
206
|
+
};
|
|
207
|
+
const result = await runAttemptOnModel(attemptModel);
|
|
208
|
+
const refusal = readCodexCyberAttemptVerdict(result);
|
|
209
|
+
if (!refusal.cyberRefused) return result;
|
|
210
|
+
const plan = planCodexCyberEscalation({
|
|
211
|
+
config: cyberFailover,
|
|
212
|
+
currentModel: attemptModel,
|
|
213
|
+
replaySafe: refusal.replaySafe,
|
|
214
|
+
workspace
|
|
215
|
+
});
|
|
216
|
+
if (plan.kind !== "escalate") {
|
|
217
|
+
if (plan.reason === "target_unavailable") await emitCodexCyberNotice(params, {
|
|
218
|
+
state: "unavailable",
|
|
219
|
+
model: attemptModel,
|
|
220
|
+
fallbackModel: cyberFailover.model
|
|
221
|
+
});
|
|
222
|
+
return result;
|
|
223
|
+
}
|
|
224
|
+
const releaseProbe = reserveCodexCyberProbe({
|
|
225
|
+
model: plan.model,
|
|
226
|
+
workspace
|
|
227
|
+
});
|
|
228
|
+
let escalated;
|
|
229
|
+
try {
|
|
230
|
+
escalated = await runAttemptOnModel(plan.model, true);
|
|
231
|
+
} finally {
|
|
232
|
+
releaseProbe();
|
|
233
|
+
}
|
|
234
|
+
const outcome = readCodexCyberAttemptVerdict(escalated);
|
|
235
|
+
if (outcome.unavailable) recordCodexCyberTargetUnavailable({
|
|
236
|
+
model: plan.model,
|
|
237
|
+
workspace,
|
|
238
|
+
cooloffMs: cyberFailover.cooloffMs
|
|
239
|
+
});
|
|
240
|
+
if (outcome.answered || outcome.unavailable) await emitCodexCyberNotice(params, {
|
|
241
|
+
state: outcome.answered ? "escalated" : "unavailable",
|
|
242
|
+
model: attemptModel,
|
|
243
|
+
fallbackModel: plan.model
|
|
244
|
+
});
|
|
245
|
+
if (outcome.unavailable && outcome.replaySafe && escalated.terminal.kind === "failed" && escalated.toolMetas.length === 0) return result;
|
|
246
|
+
return escalated;
|
|
247
|
+
},
|
|
248
|
+
runIsolatedCompletionV2: async (params) => {
|
|
249
|
+
if (params.authorization.owner === "host") {
|
|
250
|
+
const { runHostPreparedIsolatedCompletion } = await import("openclaw/plugin-sdk/simple-completion-runtime");
|
|
251
|
+
return runHostPreparedIsolatedCompletion(params);
|
|
252
|
+
}
|
|
253
|
+
const { runCodexIsolatedCompletion } = await import("./.setup/isolated-completion-Dm3PzxJk.mjs");
|
|
254
|
+
return runCodexIsolatedCompletion(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
255
|
+
},
|
|
256
|
+
runIsolatedCompletion: async (params) => {
|
|
257
|
+
const { runHostPreparedIsolatedCompletion } = await import("openclaw/plugin-sdk/simple-completion-runtime");
|
|
258
|
+
return runHostPreparedIsolatedCompletion({
|
|
259
|
+
...params,
|
|
260
|
+
authorization: {
|
|
261
|
+
owner: "host",
|
|
262
|
+
model: params.model,
|
|
263
|
+
auth: params.auth,
|
|
264
|
+
sourceAuthFingerprint: params.sourceAuthFingerprint
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
},
|
|
268
|
+
finalizeSettledTurn: async (params) => {
|
|
269
|
+
const { runCodexSettledTurnFinalization } = await import("./.setup/settled-turn-finalizer-BsvEabkw.mjs");
|
|
270
|
+
return runCodexSettledTurnFinalization(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
271
|
+
},
|
|
272
|
+
runSideQuestion: async (params) => {
|
|
273
|
+
const { runCodexAppServerSideQuestion } = await import("./.setup/side-question-C4kCmQy1.mjs");
|
|
274
|
+
return runCodexAppServerSideQuestion(params, {
|
|
275
|
+
bindingStore: options.bindingStore,
|
|
276
|
+
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
277
|
+
runtime: sessionRuntime,
|
|
278
|
+
runtimeModelId: readCodexRuntimeModelId(params.runtimeModel, params.model),
|
|
279
|
+
nativeHookRelay: { enabled: true }
|
|
280
|
+
});
|
|
281
|
+
},
|
|
282
|
+
compact: async (params) => {
|
|
283
|
+
const admittedParams = requireCodexCompactionCapabilities(params);
|
|
284
|
+
const { maybeCompactCodexAppServerSession } = await import("./.setup/compact-C2WamavS.mjs");
|
|
285
|
+
return maybeCompactCodexAppServerSession(admittedParams, {
|
|
286
|
+
bindingStore: options.bindingStore,
|
|
287
|
+
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig
|
|
288
|
+
});
|
|
289
|
+
},
|
|
290
|
+
withSessionDeletion: async (params, run) => {
|
|
291
|
+
const { withCodexAppServerSessionDeletion } = await import("./.setup/session-retirement-qMTxkNx2.mjs");
|
|
292
|
+
params.assertCurrent();
|
|
293
|
+
return withCodexAppServerSessionDeletion(options.bindingStore, params, run);
|
|
294
|
+
},
|
|
295
|
+
withSessionContextReset: async (params, run) => {
|
|
296
|
+
const { withCodexAppServerSessionContextReset } = await import("./.setup/session-retirement-qMTxkNx2.mjs");
|
|
297
|
+
params.assertCurrent();
|
|
298
|
+
return withCodexAppServerSessionContextReset(options.bindingStore, params, run);
|
|
299
|
+
},
|
|
300
|
+
reset: async (params) => {
|
|
301
|
+
if (params.sessionId && params.reason !== "deleted") {
|
|
302
|
+
const [{ reclaimCurrentCodexSessionGeneration }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./.setup/session-binding-DGCYAfvD.mjs").then((n) => n.s), import("./.setup/session-retirement-qMTxkNx2.mjs")]);
|
|
303
|
+
const identity = sessionBindingIdentity({
|
|
304
|
+
agentId: params.agentId,
|
|
305
|
+
sessionId: params.sessionId,
|
|
306
|
+
sessionKey: params.sessionKey
|
|
307
|
+
});
|
|
308
|
+
const resetGeneration = () => retireCodexAppServerSessionGeneration({
|
|
309
|
+
bindingStore: options.bindingStore,
|
|
310
|
+
identity,
|
|
311
|
+
mode: "reset"
|
|
312
|
+
});
|
|
313
|
+
let reset = await resetGeneration();
|
|
314
|
+
if (reset === "conflict") {
|
|
315
|
+
if (await reclaimCurrentCodexSessionGeneration({
|
|
316
|
+
bindingStore: options.bindingStore,
|
|
317
|
+
identity,
|
|
318
|
+
config: options.resolveConfig?.()
|
|
319
|
+
})) reset = await resetGeneration();
|
|
320
|
+
}
|
|
321
|
+
if (reset === "conflict") throw new Error(`Codex binding generation changed before session ${params.sessionId} could reset`);
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
dispose: async () => {
|
|
325
|
+
disposed = true;
|
|
326
|
+
modelCatalog?.dispose();
|
|
327
|
+
await disposeSharedCodexAppServerClients();
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
/** Creates the private native-compaction bridge registered in host-owned capability state. */
|
|
332
|
+
function createCodexAppServerNativeCompaction(options) {
|
|
333
|
+
return async (params) => {
|
|
334
|
+
const admittedParams = requireCodexCompactionCapabilities(params);
|
|
335
|
+
const { maybeCompactCodexAppServerSession } = await import("./.setup/compact-C2WamavS.mjs");
|
|
336
|
+
return maybeCompactCodexAppServerSession(admittedParams, {
|
|
337
|
+
bindingStore: options.bindingStore,
|
|
338
|
+
pluginConfig: options.resolvePluginConfig?.() ?? options.pluginConfig,
|
|
339
|
+
allowNonManualNativeRequest: true,
|
|
340
|
+
nativeCompactionRequest: admittedParams.nativeCompactionRequest
|
|
341
|
+
});
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
//#endregion
|
|
2
345
|
export { createCodexAppServerAgentHarness, createCodexAppServerNativeCompaction };
|