@openclaw/codex 2026.9.5 → 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-C2MOIvfq.mjs → account-usage-runtime-DFhbh1zz.mjs} +6 -6
- package/dist/.setup/{apply-CJ0ZfmBG.mjs → apply-D3GcSoSa.mjs} +35 -55
- package/dist/.setup/{attempt-client-cleanup-BpYKdTA0.mjs → attempt-client-cleanup-DOP-cW5j.mjs} +179 -73
- 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-QirmgiCo.mjs → auth-cache-key-Dbvq-QgB.mjs} +41 -111
- package/dist/.setup/{auth-profile-WqZtZfXN.mjs → auth-profile-B0okYl2D.mjs} +1 -2
- package/dist/.setup/auth-profile-health-oHizqgye.mjs +53 -0
- package/dist/.setup/auth-profile-recovery-BREezV0L.mjs +14 -0
- package/dist/.setup/auth-start-options-BPIPeEX8.mjs +44 -0
- package/dist/.setup/{binding-connection-Bm38niE8.mjs → binding-connection-DTtN1KrX.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-CnRMC0ta.mjs → binding-connection.runtime-6TpgD1M6.mjs} +5 -5
- package/dist/.setup/{bounded-turn-BtlZcivC.mjs → bounded-turn-CbjoN2OW.mjs} +140 -37
- package/dist/.setup/bounded-turn-isolation-B8K_ylqk.mjs +14 -0
- package/dist/.setup/{build-state-Xx9ybZqa.mjs → build-state-Da1_z0kd.mjs} +1 -1
- package/dist/.setup/{capabilities-_vXcZGSx.mjs → capabilities-B3WEZl4e.mjs} +2 -10
- package/dist/.setup/{client-vXs2929Q.mjs → client-N0JpgSzF.mjs} +635 -872
- package/dist/.setup/client-catalog-response-5HHLdcde.mjs +285 -0
- package/dist/.setup/{command-dispatch-naHIZwwF.mjs → command-dispatch-BeAoaovI.mjs} +9 -8
- package/dist/.setup/{command-formatters-CGEkdawF.mjs → command-formatters-R3ckE3Co.mjs} +36 -64
- package/dist/.setup/{command-handlers-BtAJEW1X.mjs → command-handlers-ylTMS00z.mjs} +301 -488
- package/dist/.setup/{command-rpc-DHFpn4le.mjs → command-rpc-CGJGUQ6Y.mjs} +40 -28
- package/dist/.setup/compact-C2WamavS.mjs +776 -0
- package/dist/.setup/{config-CedDWjM-.mjs → config-DKhXquav.mjs} +26 -28
- package/dist/.setup/{config-options-BsanJ8QG.mjs → config-options-CzyWLTJt.mjs} +68 -65
- package/dist/.setup/{config-parsing-CcB9iPoq.mjs → config-parsing-b088LyhT.mjs} +57 -60
- package/dist/.setup/{config-runtime-CeAhl_h4.mjs → config-runtime-C0NbLms1.mjs} +2 -2
- package/dist/.setup/{config-security-BRQ2mgW9.mjs → config-security-CE-FcGw9.mjs} +51 -215
- 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-DhzrpTM6.mjs → conversation-binding-3Min8qvP.mjs} +71 -105
- package/dist/.setup/{conversation-binding-data-CrcyZk6O.mjs → conversation-binding-data-C746z5Pn.mjs} +8 -12
- package/dist/.setup/{conversation-control-DN53ns41.mjs → conversation-control-CEP8X5JC.mjs} +30 -69
- 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-D16lOp67.mjs → dynamic-tools-DzlsLUuS.mjs} +3136 -3167
- package/dist/.setup/{effective-mcp-catalog-K6kLCN8X.mjs → effective-mcp-catalog-CxUtC-xG.mjs} +8 -17
- package/dist/.setup/{ephemeral-turn-R1gA8Sn6.mjs → ephemeral-turn-CDsPJOa2.mjs} +9 -6
- package/dist/.setup/event-projector-assistant-message-CigreO4K.mjs +69 -0
- package/dist/.setup/{event-projector-usage-C7Ntzs-f.mjs → event-projector-usage-03R0I2dM.mjs} +4 -26
- package/dist/.setup/event-projector-values-DJSz8BTk.mjs +106 -0
- package/dist/.setup/incognito-session-DWYapfwf.mjs +2 -0
- package/dist/.setup/{inference-context-fulhZuz8.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-DhcXOgUE.mjs +561 -0
- package/dist/.setup/{isolated-completion-B6srt48J.mjs → isolated-completion-Dm3PzxJk.mjs} +15 -11
- package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
- package/dist/.setup/{managed-binary-DP6Rib3P.mjs → managed-binary-kiWRhNRE.mjs} +16 -9
- package/dist/.setup/{model-catalog-DkvUuBey.mjs → model-catalog-PAuZgJC6.mjs} +14 -14
- package/dist/.setup/model-runtime-BdqzOMkU.mjs +11 -0
- package/dist/.setup/{models-BDFgm_G-.mjs → models-DHXZtVVk.mjs} +9 -18
- package/dist/.setup/{native-auth-BLZGqFjw.mjs → native-auth-CuG53tu4.mjs} +5 -5
- package/dist/.setup/{native-execution-policy-YBMHSzC4.mjs → native-execution-policy-BxZJy5mP.mjs} +6 -31
- package/dist/.setup/{native-subagent-monitor-B1hxzIOy.mjs → native-subagent-monitor-Dpsmf2wz.mjs} +4422 -3808
- 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-Cl8b2ZF3.mjs → node-cli-sessions-HC4W6FLI.mjs} +99 -111
- package/dist/.setup/node-exec-server.runtime-BgBfWQqo.mjs +244 -0
- package/dist/.setup/{plan-xD7WKYTM.mjs → plan-Y-QIvrKB.mjs} +118 -163
- package/dist/.setup/{plugin-activation-r8nq5Jzp.mjs → plugin-activation-cNHRfaxU.mjs} +10 -47
- package/dist/.setup/{plugin-app-cache-key-BOxKP7db.mjs → plugin-app-cache-key-BL9B5H0L.mjs} +9 -42
- package/dist/.setup/{plugin-inventory-DUle8DLz.mjs → plugin-inventory-Cky2XJUw.mjs} +32 -23
- package/dist/.setup/{plugin-marketplace-discovery-P-Vndfqq.mjs → plugin-marketplace-discovery-D_dV9FXa.mjs} +22 -25
- package/dist/.setup/{plugin-metadata-cache-DsS5buNa.mjs → plugin-metadata-cache-DsjsL1dr.mjs} +328 -318
- package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
- package/dist/.setup/provider-DH8NSzGt.mjs +51 -0
- package/dist/.setup/{provider-capabilities-B8J4Dy-O.mjs → provider-capabilities-CAxoF-X1.mjs} +35 -12
- package/dist/.setup/{rate-limits-DOEGYRNs.mjs → rate-limits-B7-X2TgG.mjs} +123 -166
- package/dist/.setup/{request-BioXJLYa.mjs → request-BHZ1nz8d.mjs} +25 -16
- package/dist/.setup/responses-oauth-twnuTaAa.mjs +93 -0
- package/dist/.setup/rpc-error-BlD2vuzn.mjs +31 -0
- package/dist/.setup/{run-attempt-rlA07pUv.mjs → run-attempt-D8RZUOzY.mjs} +2046 -1454
- package/dist/.setup/{run-attempt-lifecycle-B7JbY4-F.mjs → run-attempt-lifecycle-C-6O3Exn.mjs} +10 -24
- package/dist/.setup/{runtime-artifact-Dy38Z5iU.mjs → runtime-artifact-DDQ-HGXf.mjs} +43 -47
- 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-TH3xA0zj.mjs → session-binding-record-Oe9L-CNY.mjs} +73 -132
- package/dist/.setup/{session-binding-sidecars-CKYEcfNn.mjs → session-binding-sidecars-jo6H8dFr.mjs} +242 -60
- package/dist/.setup/{session-catalog-fUdWDx-U.mjs → session-catalog-4sCdv5qx.mjs} +598 -452
- package/dist/.setup/{session-catalog-adoption-CR_whkEW.mjs → session-catalog-adoption-BU_pHWG7.mjs} +59 -26
- package/dist/.setup/{session-catalog-archive-CwZaPacf.mjs → session-catalog-archive-spHfihri.mjs} +7 -7
- 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-B141u15s.mjs → session-catalog-index-CZvDzC6z.mjs} +286 -182
- package/dist/.setup/{session-catalog-index-order-Cc5BzlQr.mjs → session-catalog-index-order-BcQpHks3.mjs} +2 -2
- package/dist/.setup/{session-catalog-index-state-BAuDztHN.mjs → session-catalog-index-state-TeO7EyO-.mjs} +6 -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-BVRsYOSh.mjs → session-catalog-node-adoption-DgXvSGu0.mjs} +30 -35
- package/dist/.setup/{session-catalog-node-continue-Dowv8osw.mjs → session-catalog-node-continue-DjKXHBbi.mjs} +25 -18
- package/dist/.setup/session-catalog-node-lookup-CtAXI5W5.mjs +56 -0
- package/dist/.setup/{session-catalog-native-projection-ChV3cCtm.mjs → session-catalog-parsing-CPGaPYr-.mjs} +14 -180
- package/dist/.setup/{session-catalog-projection-C1Bj9Jl-.mjs → session-catalog-projection-Cr5qP5Dj.mjs} +15 -5
- package/dist/.setup/session-catalog-provenance-DoAvktcj.mjs +95 -0
- package/dist/.setup/{session-cli-DIj-IE-E.mjs → session-cli-Cn_nCqfq.mjs} +11 -24
- package/dist/.setup/{session-history-C--SrLI8.mjs → session-history-D83lJWHG.mjs} +16 -23
- package/dist/.setup/{session-history-import-JHXT5Xfi.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-CpNj7H_P.mjs → session-history.worker-MnPKncqP.mjs} +14 -23
- package/dist/.setup/session-initialization-6aveB9qb.mjs +22 -0
- package/dist/.setup/{session-permission-policy-DhurXY0l.mjs → session-permission-policy-Ci_fVX6y.mjs} +4 -8
- package/dist/.setup/{session-retirement-CU87AOg9.mjs → session-retirement-qMTxkNx2.mjs} +31 -12
- package/dist/.setup/{settled-turn-context-fmwouT5I.mjs → settled-turn-context-D4yj4rxf.mjs} +1 -1
- package/dist/.setup/{settled-turn-finalizer-CiY2bLFK.mjs → settled-turn-finalizer-BsvEabkw.mjs} +17 -13
- package/dist/.setup/{shared-client-BpTtuLQ5.mjs → shared-client-DqyTMYug.mjs} +826 -485
- package/dist/.setup/shared-client-lifecycle-DJIgqgMw.mjs +153 -0
- package/dist/.setup/{side-question-DSCZyoBD.mjs → side-question-C4kCmQy1.mjs} +206 -334
- package/dist/.setup/{source-Bjp4UQij.mjs → source-CS_7GFJZ.mjs} +82 -139
- package/dist/.setup/spawn-error-CL3n6MAa.mjs +57 -0
- package/dist/.setup/{thread-archive-guard-jmecf6OJ.mjs → thread-archive-guard-C9frICzX.mjs} +10 -3
- package/dist/.setup/thread-lifecycle-DPflntEJ.mjs +2362 -0
- package/dist/.setup/{incognito-session-uhrBF6wJ.mjs → thread-ownership-queue-Dp24d7-F.mjs} +1 -2
- package/dist/.setup/{thread-ownership-skomxnIt.mjs → thread-ownership-roNP0l1c.mjs} +47 -10
- package/dist/.setup/thread-policy-DTd-DtkX.mjs +109 -0
- package/dist/.setup/thread-requests-B_bRnMGN.mjs +2102 -0
- package/dist/.setup/{thread-resume-BkNpj9Pz.mjs → thread-resume-CdDaoc7T.mjs} +6 -6
- package/dist/.setup/timeout-CXOfNoaX.mjs +46 -0
- package/dist/.setup/transcript-history-projection-DRSifI-1.mjs +201 -0
- package/dist/.setup/{transcript-mirror-attestation-CzM-94NC.mjs → transcript-mirror-attestation-YSegaktH.mjs} +3 -4
- package/dist/.setup/{transcript-mirror-D4qp_leP.mjs → transcript-mirror-kxmCYsuF.mjs} +224 -206
- package/dist/.setup/{transport-stdio-Cmx94Oiy.mjs → transport-stdio-Bdegpn2V.mjs} +138 -75
- 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-D3UKxgVD.mjs → upstream-session-fork-CBeVjBpT.mjs} +48 -40
- package/dist/.setup/{usage-BOgBEKso.mjs → usage-BMzNxeR_.mjs} +5 -4
- package/dist/.setup/{usage-limit-error-C0ow7DOc.mjs → usage-limit-error-QXerDo3i.mjs} +5 -20
- package/dist/.setup/{web-search-provider.runtime-CTGuJt6i.mjs → web-search-provider.runtime-P77OUeoo.mjs} +10 -20
- package/dist/api.js +25 -16
- 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 +50 -8
- package/dist/harness.js +344 -1
- package/dist/index.js +345 -346
- 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 +16 -33
- package/dist/session-history.worker.js +1 -1
- package/openclaw.plugin.json +14 -2
- package/package.json +11 -7
- package/dist/.setup/attempt-context-VXVwTCfS.mjs +0 -636
- package/dist/.setup/compact-C3i3qlzj.mjs +0 -687
- package/dist/.setup/event-projector-assistant-message-DNUR1s0A.mjs +0 -105
- package/dist/.setup/event-projector-items-DyTQ_XqL.mjs +0 -200
- package/dist/.setup/harness-rxaaoN-o.mjs +0 -349
- package/dist/.setup/history-rejection-B4nOXNXF.mjs +0 -13
- package/dist/.setup/image-payload-sanitizer-tupAr-2o.mjs +0 -79
- package/dist/.setup/inference-proxy-CC15HuSi.mjs +0 -311
- package/dist/.setup/launch-args-DnMak49W.mjs +0 -111
- package/dist/.setup/local-runtime-attribution-B_2mnqhb.mjs +0 -19
- package/dist/.setup/native-subagent-history-YXaL6dMd.mjs +0 -135
- package/dist/.setup/native-subagent-task-ids-DsuOonKv.mjs +0 -411
- package/dist/.setup/node-exec-server.runtime-BaViBKNz.mjs +0 -226
- package/dist/.setup/plugin-approval-roundtrip-CjfzafAZ.mjs +0 -122
- package/dist/.setup/provider-fFh_-VR3.mjs +0 -50
- package/dist/.setup/rolldown-runtime-8H4AJuhK.mjs +0 -14
- package/dist/.setup/sandbox-guard-BBP-RbTf.mjs +0 -166
- package/dist/.setup/session-binding-_0W_fHRr.mjs +0 -721
- package/dist/.setup/session-catalog-events-jMcYfQyd.mjs +0 -250
- package/dist/.setup/session-history-read-B3ZfSUbF.mjs +0 -50
- package/dist/.setup/session-initialization-DH1z6fXn.mjs +0 -75
- package/dist/.setup/thread-history-page-BTx-4xsg.mjs +0 -83
- package/dist/.setup/thread-lifecycle-Cik28qWn.mjs +0 -4904
- package/dist/.setup/thread-policy-Cjs4B8xf.mjs +0 -54
- package/dist/.setup/timeout-DZF05XrR.mjs +0 -63
- package/dist/.setup/transcript-history-projection-DHNBDhCU.mjs +0 -243
- package/dist/.setup/version-CoqzXPgK.mjs +0 -12
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 };
|