@openclaw/codex 2026.10.1 → 2026.10.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.setup/{account-usage-runtime-B7Vg4rmy.mjs → account-usage-runtime-QBZsvZS8.mjs} +8 -7
- package/dist/.setup/{app-server-policy-Bg4FZw1f.mjs → app-server-policy-D_zv8J7V.mjs} +3 -4
- package/dist/.setup/{apply-BzlIkqSz.mjs → apply-CBMV8LN0.mjs} +40 -51
- package/dist/.setup/{attempt-client-cleanup-HXQxfMc1.mjs → attempt-client-cleanup-t-kd_1ys.mjs} +6 -6
- package/dist/.setup/attempt-terminal-jO5IMj9K.mjs +2 -0
- package/dist/.setup/{attempt-workspace-context-BmCutoyg.mjs → attempt-workspace-context-CcwP3DA3.mjs} +21 -18
- package/dist/.setup/{auth-binding-BoMwpuPN.mjs → auth-binding-BaxlhaNx.mjs} +2 -2
- package/dist/.setup/{auth-cache-key-BCCQHWdc.mjs → auth-cache-key-DyfUvsSa.mjs} +30 -41
- package/dist/.setup/{binding-connection-C-08ez1w.mjs → binding-connection-B7HAAZSI.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-Dn2p-fdy.mjs → binding-connection.runtime-DAXn7iFl.mjs} +6 -5
- package/dist/.setup/{bounded-turn-Cv4uIEzz.mjs → bounded-turn-CyQVQwGe.mjs} +21 -17
- package/dist/.setup/{bounded-turn-isolation-DklXNk3k.mjs → bounded-turn-isolation-BfDAo-qZ.mjs} +4 -4
- package/dist/.setup/{build-state-BwxNfFEB.mjs → build-state-CzLMy1S9.mjs} +1 -1
- package/dist/.setup/{capabilities-kQntafj_.mjs → capabilities-DbOzOglY.mjs} +1 -1
- package/dist/.setup/{client-catalog-response-BNFDYAKh.mjs → client-catalog-response-DsbEAtpd.mjs} +25 -32
- package/dist/.setup/{client-BIRVBXXb.mjs → client-y7nO6X9c.mjs} +198 -247
- package/dist/.setup/{command-dispatch-D3_ypl-R.mjs → command-dispatch-uA9lz2Kf.mjs} +3 -4
- package/dist/.setup/{command-formatters-DV3DHhdr.mjs → command-formatters-xW9KpoSZ.mjs} +16 -26
- package/dist/.setup/{command-handlers-KPit4G0p.mjs → command-handlers-VBaJnpZo.mjs} +270 -360
- package/dist/.setup/{command-rpc-CmQDOxY9.mjs → command-rpc-C9VxOLuG.mjs} +19 -18
- package/dist/.setup/{compact-CLLteFIY.mjs → compact-CD8xJxXS.mjs} +41 -61
- package/dist/.setup/{computer-use-BVxocZZc.mjs → computer-use-CiToXF5C.mjs} +109 -147
- package/dist/.setup/{config-0Gxk3_eq.mjs → config-C1YVVLEA.mjs} +32 -59
- package/dist/.setup/config-contracts.shared-D85SGEuq.mjs +4 -0
- package/dist/.setup/{config-options-HG_Rr3W_.mjs → config-options-DDzeNQ8m.mjs} +52 -90
- package/dist/.setup/{config-parsing-BQq-CHTF.mjs → config-parsing-DsWSCPHO.mjs} +19 -55
- package/dist/.setup/{config-runtime-cUYrqu_a.mjs → config-runtime-DWzK-k0n.mjs} +2 -2
- package/dist/.setup/{config-security-KAPScztc.mjs → config-security-clxAZYWX.mjs} +35 -39
- package/dist/.setup/config-utils-DN_YT7dE.mjs +47 -0
- package/dist/.setup/{context-engine-projection-CsgYSQhW.mjs → context-engine-projection-ps-yn_ci.mjs} +10 -22
- package/dist/.setup/{conversation-binding-DJ_288rC.mjs → conversation-binding-CTSLDM9S.mjs} +85 -119
- package/dist/.setup/{conversation-binding-data-DJ4ix-W5.mjs → conversation-binding-data-UgLuTSQT.mjs} +9 -8
- package/dist/.setup/{conversation-control-CuiZ_pDL.mjs → conversation-control-GXM3unE4.mjs} +7 -10
- package/dist/.setup/{cyber-failover-Bb1J6hS1.mjs → cyber-failover-D4dgNfFf.mjs} +2 -5
- package/dist/.setup/{cyber-failover-notice-XR03ef31.mjs → cyber-failover-notice-ljgGGL0s.mjs} +1 -1
- package/dist/.setup/{doctor-start-options-DPW9JxIE.mjs → doctor-start-options-JjTAl-q_.mjs} +5 -5
- package/dist/.setup/{dynamic-tool-build-DgWZMfAQ.mjs → dynamic-tool-build-D731PCdv.mjs} +57 -69
- package/dist/.setup/{dynamic-tools-Ct6GKAFr.mjs → dynamic-tools-D0pYbxHH.mjs} +689 -710
- package/dist/.setup/{effective-mcp-catalog-DmCSc8TS.mjs → effective-mcp-catalog-1hWFKghy.mjs} +11 -20
- package/dist/.setup/{elicitation-input-r9axtppm.mjs → elicitation-input-DXG_qaXr.mjs} +14 -20
- package/dist/.setup/{ephemeral-turn-_cBMKCFb.mjs → ephemeral-turn-Cphy5Qr_.mjs} +3 -3
- package/dist/.setup/{event-projector-assistant-message-C3Tpt370.mjs → event-projector-assistant-message-CLMKN4x-.mjs} +2 -2
- package/dist/.setup/{event-projector-usage-03R0I2dM.mjs → event-projector-usage-BpKfdoTm.mjs} +20 -33
- package/dist/.setup/{event-projector-values-DTqZHizf.mjs → event-projector-values-CLvG1Hil.mjs} +4 -5
- package/dist/.setup/history-rejection-B4nOXNXF.mjs +13 -0
- package/dist/.setup/{inference-context-D-9gWlTR.mjs → inference-context-DNlGwzwy.mjs} +10 -11
- package/dist/.setup/{inference-dispatch-B5UKEUyC.mjs → inference-dispatch-CO6tTs4q.mjs} +5 -4
- package/dist/.setup/{inference-metadata-CgIf7sOx.mjs → inference-metadata-DCvcG_N_.mjs} +36 -41
- package/dist/.setup/{inference-proxy-DUO5E2QQ.mjs → inference-proxy-BDWV0djM.mjs} +10 -14
- package/dist/.setup/{isolated-completion-CjrQEeke.mjs → isolated-completion-Bhqd2yBq.mjs} +8 -8
- package/dist/.setup/local-runtime-attribution-CZz2DJ4q.mjs +15 -0
- package/dist/.setup/{managed-binary-C1VFoVPf.mjs → managed-binary-BtIjV7yN.mjs} +16 -36
- package/dist/.setup/{mcp-app-session-preparation-D0yRoreX.mjs → mcp-app-session-preparation-DqSvxFqc.mjs} +24 -25
- package/dist/.setup/{mcp-tool-metadata-j10HhfTC.mjs → mcp-tool-metadata-DW41snf3.mjs} +1 -1
- package/dist/.setup/{model-catalog--G4arndd.mjs → model-catalog-B227ST3D.mjs} +6 -6
- package/dist/.setup/{models-BYbLQPnj.mjs → models-DdRyi93L.mjs} +6 -10
- package/dist/.setup/{native-auth-Cjb9y7IZ.mjs → native-auth-esN5MdIv.mjs} +5 -5
- package/dist/.setup/{native-execution-policy-ClzpdG3D.mjs → native-execution-policy-MXEe7PB3.mjs} +11 -28
- package/dist/.setup/native-hook-relay-BUWIOrSr.mjs +561 -0
- package/dist/.setup/{native-mcp-app-5i5eRCwO.mjs → native-mcp-app-CjxJQ4F7.mjs} +6 -6
- package/dist/.setup/native-skill-isolation-UMVoNjZz.mjs +391 -0
- package/dist/.setup/{native-subagent-monitor-B2C8D_N0.mjs → native-subagent-monitor-iHc8oLg5.mjs} +505 -639
- package/dist/.setup/{native-subagent-pending-assignments-BDqhOdJp.mjs → native-subagent-pending-assignments-DmVhedNs.mjs} +11 -23
- package/dist/.setup/{native-task-assignments-C6KVqiN1.mjs → native-task-assignments-DimsQ9Qa.mjs} +73 -27
- package/dist/.setup/{node-cli-sessions-B5oNDkUS.mjs → node-cli-sessions-CzKg2nGq.mjs} +18 -26
- package/dist/.setup/{node-exec-server.runtime-0xSEjKYt.mjs → node-exec-server.runtime-BWkULhBM.mjs} +5 -8
- package/dist/.setup/{plan-B5bDIEuQ.mjs → plan-C_F3aio0.mjs} +40 -50
- package/dist/.setup/{plugin-activation-BcyBv8PG.mjs → plugin-activation-D7WkJMvU.mjs} +4 -5
- package/dist/.setup/{plugin-app-cache-key-BW8rd98k.mjs → plugin-app-cache-key-Bg9DbDI6.mjs} +18 -23
- package/dist/.setup/{plugin-approval-roundtrip-C_SGp5YW.mjs → plugin-approval-roundtrip-BSV-51ig.mjs} +4 -6
- package/dist/.setup/{plugin-inventory-Bf0_piTw.mjs → plugin-inventory-CYgdo14P.mjs} +28 -43
- package/dist/.setup/{plugin-marketplace-discovery-SQPhSuic.mjs → plugin-marketplace-discovery-BblHM3DU.mjs} +7 -10
- package/dist/.setup/{plugin-metadata-cache-DWnB7VMj.mjs → plugin-metadata-cache-Bi8TAPwX.mjs} +5 -10
- package/dist/.setup/project-doc-thread-config-BVcvnps8.mjs +490 -0
- package/dist/.setup/{provider-BoIby-eX.mjs → provider-BJ4xhaGX.mjs} +4 -4
- package/dist/.setup/{provider-capabilities-B4yq6UgQ.mjs → provider-capabilities-CjRaV3bx.mjs} +1 -1
- package/dist/.setup/{rate-limits-CMPy24F5.mjs → rate-limits-CI8pTPqL.mjs} +15 -32
- package/dist/.setup/reasoning-effort-CS9kKWB9.mjs +37 -0
- package/dist/.setup/{request-DD3u22uv.mjs → request-Y8dmbqZ3.mjs} +28 -48
- package/dist/.setup/{rpc-error-hmWM21RB.mjs → rpc-error-C98SHchT.mjs} +3 -6
- package/dist/.setup/{run-attempt-DOVF5OON.mjs → run-attempt-Dx7a4Mfm.mjs} +927 -859
- package/dist/.setup/{run-attempt-lifecycle-BuZgVbDA.mjs → run-attempt-lifecycle-KN4oh-7O.mjs} +13 -4
- package/dist/.setup/{runtime-artifact-CUTOOnKw.mjs → runtime-artifact-C13pR7tD.mjs} +18 -22
- package/dist/.setup/{runtime-artifact-connection-CADz3_BY.mjs → runtime-artifact-connection-jS5DeCok.mjs} +3 -3
- package/dist/.setup/{sandbox-guard-WqE8yPge.mjs → sandbox-guard-DIImwCy1.mjs} +4 -6
- package/dist/.setup/service-tier-normalization-BPgw2Wdt.mjs +9 -0
- package/dist/.setup/{session-binding-Ce7BqiPN.mjs → session-binding-JEHNMPsr.mjs} +13 -40
- package/dist/.setup/{session-binding-record-BZB8RgcF.mjs → session-binding-record-DU_0biMD.mjs} +4 -4
- package/dist/.setup/{session-binding-record-codec-z4ZpDn6E.mjs → session-binding-record-codec-BpH8u_G9.mjs} +16 -39
- package/dist/.setup/{session-binding-sidecars-BrdV95Fg.mjs → session-binding-sidecars-DD-enC8w.mjs} +49 -54
- package/dist/.setup/{session-catalog-adoption-CPIP4S_y.mjs → session-catalog-adoption-Ca3OYGYM.mjs} +23 -27
- package/dist/.setup/{session-catalog-archive-DcgwvSbF.mjs → session-catalog-archive-Bv6gV7x9.mjs} +6 -6
- package/dist/.setup/{session-catalog-events-DRaivXvC.mjs → session-catalog-events-DzFlXNUe.mjs} +6 -5
- package/dist/.setup/{session-catalog-index-qwmgqC4t.mjs → session-catalog-index-DozvkUPd.mjs} +111 -105
- package/dist/.setup/{session-catalog-index-order-nhyO0wdW.mjs → session-catalog-index-order-CTfoefow.mjs} +28 -5
- package/dist/.setup/{session-catalog-limits-DEU36Qlo.mjs → session-catalog-limits-BynIoOYm.mjs} +1 -1
- package/dist/.setup/{session-catalog-list-request-tXephOB4.mjs → session-catalog-list-request-D4MYNgDB.mjs} +11 -8
- package/dist/.setup/{session-catalog-native-projection-z9Q608QW.mjs → session-catalog-native-projection-rCKnZud1.mjs} +5 -61
- package/dist/.setup/{session-catalog-node-adoption-7-WEQTB1.mjs → session-catalog-node-adoption-BdP9Zjqo.mjs} +2 -2
- package/dist/.setup/{session-catalog-node-continue-DLWBwAAO.mjs → session-catalog-node-continue-CNJibO4_.mjs} +27 -49
- package/dist/.setup/{session-catalog-node-lookup-Uufckwcm.mjs → session-catalog-node-lookup-BH_DBGa9.mjs} +3 -3
- package/dist/.setup/{session-catalog-parsing-B-qWJh2x.mjs → session-catalog-parsing-DkeoVn60.mjs} +9 -19
- package/dist/.setup/{session-catalog-projection-Cl0Nc7c6.mjs → session-catalog-projection-DDVmALHj.mjs} +8 -22
- package/dist/.setup/session-catalog-source-CygTGmrb.mjs +58 -0
- package/dist/.setup/{session-cli-kH4vuGod.mjs → session-cli-GwU0izn-.mjs} +20 -41
- package/dist/.setup/{session-history-BogBHKLk.mjs → session-history-BO6i_pfk.mjs} +1 -1
- package/dist/.setup/{session-history-import-NWKPa4ZO.mjs → session-history-import-CaO8s6ta.mjs} +4 -4
- package/dist/.setup/{session-history-read-CNN8zwbD.mjs → session-history-read-BI_2jRED.mjs} +4 -15
- package/dist/.setup/{session-history.worker-Cq_4DYgN.mjs → session-history.worker-DJQfek5p.mjs} +147 -159
- package/dist/.setup/{session-initialization-D6dtFQkE.mjs → session-initialization-Bi_2DKhc.mjs} +3 -5
- package/dist/.setup/{session-permission-policy-BxIUJ0Zd.mjs → session-permission-policy-CD2MAWU8.mjs} +12 -20
- package/dist/.setup/{session-retirement-Bt3b0fpe.mjs → session-retirement-IoS3zr17.mjs} +7 -7
- package/dist/.setup/{settled-turn-context-BZsMjkIO.mjs → settled-turn-context-BPL6D3RO.mjs} +1 -1
- package/dist/.setup/{settled-turn-finalizer-e_24O6HA.mjs → settled-turn-finalizer-X-Fylp-u.mjs} +12 -11
- package/dist/.setup/{shared-client-DeenOD8U.mjs → shared-client-ByIwuAC-.mjs} +172 -229
- package/dist/.setup/{side-question-BZHn_1Jm.mjs → side-question-BDUdozFy.mjs} +116 -137
- package/dist/.setup/{source-0ClinBHI.mjs → source-Bxbqf3S1.mjs} +37 -56
- package/dist/.setup/thread-archive-guard-LKdwQKyr.mjs +56 -0
- package/dist/.setup/{thread-lifecycle-CoqYpbpk.mjs → thread-lifecycle-run-CfP4PnEf.mjs} +348 -484
- package/dist/.setup/thread-model-selection-DcVebr8N.mjs +61 -0
- package/dist/.setup/{thread-ownership-CSDZ6mHd.mjs → thread-ownership-Be53aiaG.mjs} +5 -5
- package/dist/.setup/{thread-ownership-queue-Dp24d7-F.mjs → thread-ownership-queue-CeyYScUC.mjs} +5 -6
- package/dist/.setup/{thread-policy-DCC9lQjC.mjs → thread-policy-CHgY-KNl.mjs} +4 -4
- package/dist/.setup/thread-requests-BgzJwJtS.mjs +745 -0
- package/dist/.setup/{thread-resume--WOKWxZd.mjs → thread-resume-B2EmMcgE.mjs} +5 -5
- package/dist/.setup/{timeout-CXOfNoaX.mjs → timeout-D0mEWSGG.mjs} +6 -12
- package/dist/.setup/{transcript-history-projection-B9a7HwUV.mjs → transcript-history-projection-DfKcoZCB.mjs} +3 -4
- package/dist/.setup/{transcript-mirror-BfLRARNL.mjs → transcript-mirror-Bee2o6jj.mjs} +68 -68
- package/dist/.setup/{transcript-mirror-attestation-YSegaktH.mjs → transcript-mirror-attestation-BzUXnrvv.mjs} +5 -2
- package/dist/.setup/{transport-stdio-a0HDa2Mj.mjs → transport-stdio-CRWTkKOn.mjs} +67 -77
- package/dist/.setup/{transport-websocket-zqJ0Cmtn.mjs → transport-websocket-DIyPfkHo.mjs} +8 -16
- package/dist/.setup/{turn-router-BWhX_SBh.mjs → turn-router-DKDAziUW.mjs} +30 -31
- package/dist/.setup/upstream-prompt-provenance-Ccd9MFRJ.mjs +44 -0
- package/dist/.setup/{upstream-session-fork-BQvofnk7.mjs → upstream-session-fork-Djp_yssT.mjs} +50 -43
- package/dist/.setup/{usage-BEHcVwcZ.mjs → usage-DQA-peQC.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-D1p3nE6n.mjs → usage-limit-error-2t3KBqiX.mjs} +12 -21
- package/dist/.setup/web-search-item-CvokaZOo.mjs +20 -0
- package/dist/.setup/{web-search-provider.runtime-CV9oiB-v.mjs → web-search-provider.runtime-BsuCMNix.mjs} +3 -3
- package/dist/.setup/{workspace-write-sandbox-probe-DmUHLrrl.mjs → workspace-write-sandbox-probe-BDWO2Qkh.mjs} +4 -4
- package/dist/api.js +15 -15
- package/dist/catalog-page.worker.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +5 -6
- package/dist/harness.js +32 -61
- package/dist/index.js +302 -416
- package/dist/media-understanding-provider.js +32 -43
- package/dist/migration-provider-api.js +1 -1
- package/dist/native-session-binding-api.js +1 -1
- package/dist/native-tool-policy.js +23 -1
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +52 -31
- package/dist/session-history.worker.js +1 -1
- package/openclaw.plugin.json +20 -3
- package/package.json +7 -7
- package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +0 -5
- package/dist/.setup/plugin-thread-config-deadline-CsScGgrk.mjs +0 -124
- package/dist/.setup/service-tier-normalization-Cei89SW6.mjs +0 -15
- package/dist/.setup/shell-dynamic-tools-BqGszXcq.mjs +0 -85
- package/dist/.setup/thread-archive-guard-C9frICzX.mjs +0 -60
- package/dist/.setup/thread-requests-Dwg2b4Xl.mjs +0 -2111
- package/dist/.setup/upstream-prompt-provenance-fXkKbPVC.mjs +0 -37
|
@@ -1,140 +1,50 @@
|
|
|
1
1
|
import { i as isJsonObject, r as flattenCodexDynamicToolFunctions } from "./protocol-CANUwXJ3.mjs";
|
|
2
|
-
import { n as matchesPendingSupervisionBranch } from "./session-binding-record-codec-
|
|
3
|
-
import { m as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced } from "./session-binding-record-
|
|
4
|
-
import {
|
|
2
|
+
import { n as matchesPendingSupervisionBranch } from "./session-binding-record-codec-BpH8u_G9.mjs";
|
|
3
|
+
import { m as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced } from "./session-binding-record-DU_0biMD.mjs";
|
|
4
|
+
import { l as fingerprintCodexPolicy } from "./config-security-clxAZYWX.mjs";
|
|
5
|
+
import { f as resolveCodexPluginsPolicy } from "./config-parsing-DsWSCPHO.mjs";
|
|
5
6
|
import { n as resolveCodexAppServerLocalHomeDir, t as resolveCodexAppServerHomeDir } from "./auth-start-options-BPIPeEX8.mjs";
|
|
6
|
-
import { d as readCodexEffectiveConfig,
|
|
7
|
-
import { S as retainSharedCodexAppServerClientByInstanceId, d as getCurrentSharedClientEntry } from "./auth-cache-key-
|
|
8
|
-
import { t as withCodexAppServerThreadMutation } from "./thread-ownership-queue-
|
|
9
|
-
import { o as isCodexAppServerOverloadError, r as CodexAppServerRpcError, s as isCodexThreadReadMissingError } from "./rpc-error-
|
|
7
|
+
import { d as readCodexEffectiveConfig, s as assertCodexModelBackedReviewerEffectiveConfig, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-DDzeNQ8m.mjs";
|
|
8
|
+
import { S as retainSharedCodexAppServerClientByInstanceId, d as getCurrentSharedClientEntry } from "./auth-cache-key-DyfUvsSa.mjs";
|
|
9
|
+
import { t as withCodexAppServerThreadMutation } from "./thread-ownership-queue-CeyYScUC.mjs";
|
|
10
|
+
import { o as isCodexAppServerOverloadError, r as CodexAppServerRpcError, s as isCodexThreadReadMissingError } from "./rpc-error-C98SHchT.mjs";
|
|
10
11
|
import { t as codexCatalogHomeId } from "./session-catalog-home-id-vlih0B_g.mjs";
|
|
11
|
-
import { r as withAbortableTimeout } from "./timeout-
|
|
12
|
-
import { t as projectBoundedCodexThreadHistory } from "./transcript-history-projection-
|
|
13
|
-
import { t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-
|
|
12
|
+
import { r as withAbortableTimeout } from "./timeout-D0mEWSGG.mjs";
|
|
13
|
+
import { t as projectBoundedCodexThreadHistory } from "./transcript-history-projection-DfKcoZCB.mjs";
|
|
14
|
+
import { a as defaultCodexAppInventoryCache, t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-Bg9DbDI6.mjs";
|
|
14
15
|
import { n as readCodexSessionMeta } from "./session-catalog-provenance-CmsOE5mh.mjs";
|
|
15
|
-
import { t as assertCodexSessionRuntimeOwnership } from "./binding-connection-
|
|
16
|
-
import "./
|
|
17
|
-
import
|
|
18
|
-
import { c as resolveCodexContextEngineProjectionMaxChars
|
|
16
|
+
import { t as assertCodexSessionRuntimeOwnership } from "./binding-connection-B7HAAZSI.mjs";
|
|
17
|
+
import { c as resolveRecoverableCodexPluginConfigKeys } from "./plugin-inventory-CYgdo14P.mjs";
|
|
18
|
+
import "./config-C1YVVLEA.mjs";
|
|
19
|
+
import { c as resolveCodexContextEngineProjectionMaxChars } from "./context-engine-projection-ps-yn_ci.mjs";
|
|
19
20
|
import { n as normalizeCodexAppServerBindingModelProvider } from "./auth-profile-CgHQ8Vot.mjs";
|
|
20
|
-
import { A as bindCodexInferenceThread, B as isCodexAppServerClientRuntimeLive, C as CodexThreadBindingConflictError, F as consumeCodexAppServerLiveThread, G as releaseCodexAppServerLiveThread, J as unsubscribeCodexAppServerLiveThread, M as getCodexInferenceThreadQualification, N as prepareCodexInferenceThreadConfig, Q as createCodexEphemeralThreadPolicy, S as CodexAdoptedThreadActiveError, T as CodexThreadStartRequestError, V as isCodexAppServerLiveThreadClaimed, j as getCodexInferenceThread, k as assertCodexInferenceRouteConfig, n as captureCodexAppServerClientLifetime, w as CodexThreadClientReplacementError, z as hasCodexAppServerSiblingThreadWork } from "./shared-client-
|
|
21
|
-
import {
|
|
22
|
-
import { r as hasCodexAppServerSiblingRouteWork } from "./turn-router-
|
|
23
|
-
import { f as unsubscribeCodexThreadBestEffort, l as retireUnsafeCodexTurnClientBestEffort, n as CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS, o as closeCodexStartupClientBestEffort, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import { t as
|
|
29
|
-
import {
|
|
21
|
+
import { A as bindCodexInferenceThread, B as isCodexAppServerClientRuntimeLive, C as CodexThreadBindingConflictError, F as consumeCodexAppServerLiveThread, G as releaseCodexAppServerLiveThread, J as unsubscribeCodexAppServerLiveThread, M as getCodexInferenceThreadQualification, N as prepareCodexInferenceThreadConfig, Q as createCodexEphemeralThreadPolicy, S as CodexAdoptedThreadActiveError, T as CodexThreadStartRequestError, V as isCodexAppServerLiveThreadClaimed, j as getCodexInferenceThread, k as assertCodexInferenceRouteConfig, n as captureCodexAppServerClientLifetime, w as CodexThreadClientReplacementError, z as hasCodexAppServerSiblingThreadWork } from "./shared-client-ByIwuAC-.mjs";
|
|
22
|
+
import { C as resolveCodexThreadRolloutPath, F as getCodexAppServerClientInstanceId, L as resolveCodexAppServerClientInstanceId, S as readSupervisionResponseThreadId, c as isCodexAppServerRequestTimeoutError, g as assertCodexThreadStartResponse, m as assertCodexThreadForkResponse, p as assertCodexThreadAcceptsDirectInput, v as assertExactSupervisionModelSelection } from "./client-y7nO6X9c.mjs";
|
|
23
|
+
import { r as hasCodexAppServerSiblingRouteWork } from "./turn-router-DKDAziUW.mjs";
|
|
24
|
+
import { f as unsubscribeCodexThreadBestEffort, l as retireUnsafeCodexTurnClientBestEffort, n as CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS, o as closeCodexStartupClientBestEffort, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-t-kd_1ys.mjs";
|
|
25
|
+
import { a as buildCodexPluginThreadConfigInputFingerprint, c as buildPluginAppPolicyContext, d as mergeCodexThreadConfigs, i as buildCodexPluginThreadConfig, l as disableUnlistedCodexApps, m as buildCodexAppApprovalOverrides, n as mergeCodexNativeProjectDocThreadConfig, o as buildCodexPluginThreadConfigTimeoutFallback, p as shouldBuildCodexPluginThreadConfig, r as buildCodexPluginAppsConfigPatchFromPolicyContext, u as isCodexPluginThreadBindingStale } from "./project-doc-thread-config-BVcvnps8.mjs";
|
|
26
|
+
import { A as isTransientWebSearchRestriction, C as fingerprintEnvironmentSelection, D as readActiveCodexTurnIdsFromResume, E as legacyFingerprintUserMcpServersConfigPatch, I as isMessageOnlyCodexSourceReply, L as isSystemAgentOnlyCodexDynamicToolAllowlist, M as shouldRotateCodexAppServerBindingForRuntime, N as shouldRotateCodexGpt56MultiAgentBinding, O as shouldStartTransientNoToolThread, S as fingerprintCodexThreadConfig, T as fingerprintUserMcpServersConfigPatch, _ as buildDeveloperInstructions, b as codexDynamicToolsFingerprint, c as codexThreadSandboxOrPermissions, d as readCodexManagedRequirementsFingerprint, f as resolveCodexThreadApprovalsReviewer, g as mergeCodexNativeShellEnvironment, h as resolveCodexWebSearchPlan, i as buildCodexRuntimeThreadConfigForRun, j as shouldRecheckRecoverablePluginBinding, n as buildCodexRingZeroThreadConfigPatch, o as buildThreadResumeParams, p as attestCodexRestrictedToolSurfaceMcpServersDisabled, s as buildThreadStartParams, t as assertCodexManagedRequirementsDoNotOverrideToolPolicy, u as readCodexInheritedMcpServerNames, v as areCodexDynamicToolFingerprintsCompatible, w as fingerprintJsonObject, x as codexLegacyDynamicToolsFingerprint, y as areUserMcpServersFingerprintsCompatible } from "./thread-requests-BgzJwJtS.mjs";
|
|
27
|
+
import { i as resolveCodexSessionBinding, o as hashCodexAppServerBindingFingerprint } from "./session-binding-JEHNMPsr.mjs";
|
|
28
|
+
import { i as resolveCodexAppServerThreadModelSelection, n as resolveCodexAppServerModelProvider } from "./thread-model-selection-DcVebr8N.mjs";
|
|
29
|
+
import { c as withExclusiveCodexAppServerThread, r as retainCodexAppServerBindingSubscription, t as isSameCodexAppServerThreadOwner } from "./thread-ownership-Be53aiaG.mjs";
|
|
30
|
+
import { a as refreshCodexThreadInstructions, i as assertCodexSupervisionThreadLineage, n as CodexThreadPolicyHandoffError, o as refreshCodexThreadPolicy, r as assertAdoptedCodexThreadResumeAllowed, t as CodexIncognitoPolicyChangeError } from "./thread-policy-CHgY-KNl.mjs";
|
|
31
|
+
import { t as resumeCodexAppServerThread } from "./thread-resume-B2EmMcgE.mjs";
|
|
32
|
+
import { r as readCodexMcpToolConnectorId } from "./mcp-tool-metadata-DW41snf3.mjs";
|
|
33
|
+
import { n as disableCodexPluginThreadConfig } from "./dynamic-tool-build-D731PCdv.mjs";
|
|
34
|
+
import { n as CodexManagedHooksOnlyError, r as assertCodexNativeHookRelayAllowed } from "./native-hook-relay-BUWIOrSr.mjs";
|
|
35
|
+
import { t as defaultCodexPluginMetadataCache } from "./plugin-metadata-cache-Bi8TAPwX.mjs";
|
|
36
|
+
import { a as discardUnattestedCodexPluginThread, i as checkCodexThreadAppAvailability, n as resolveCodexNativeSkillIsolation, o as hasCodexNativeToolCatalog, r as attestCodexThreadToolSurface, s as loadCodexNativeToolCatalog, t as applyCodexNativeSkillIsolation } from "./native-skill-isolation-UMVoNjZz.mjs";
|
|
30
37
|
import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
31
38
|
import crypto from "node:crypto";
|
|
32
39
|
import { isDeepStrictEqual } from "node:util";
|
|
33
40
|
import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
34
41
|
import path from "node:path";
|
|
35
42
|
import { isIncognitoSessionKey } from "openclaw/plugin-sdk/session-key-runtime";
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import { AgentHarnessPreflightError,
|
|
39
|
-
import { resolveAgentDir as resolveAgentDir$2 } from "openclaw/plugin-sdk/agent-runtime";
|
|
40
|
-
import { sanitizeInlineImageDataUrl } from "openclaw/plugin-sdk/inline-image-data-url-runtime";
|
|
41
|
-
import { selectSupportedReasoningEffort } from "openclaw/plugin-sdk/agent-harness-attempt-runtime";
|
|
43
|
+
import { createStageTimingTracker, formatStageTimings, racePromiseWithAbortSignal } from "openclaw/plugin-sdk/time-runtime";
|
|
44
|
+
import { resolveAgentDir as resolveAgentDir$1 } from "openclaw/plugin-sdk/agent-runtime";
|
|
45
|
+
import { AgentHarnessPreflightError, embeddedAgentLog, formatErrorMessage, isActiveHarnessContextEngine, isHostScopedAgentToolActive } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
42
46
|
import { buildCodexUserMcpServersThreadConfigPatchForRun } from "openclaw/plugin-sdk/codex-mcp-projection";
|
|
43
47
|
import { isDiagnosticFlagEnabled } from "openclaw/plugin-sdk/diagnostic-flags";
|
|
44
|
-
//#region extensions/codex/src/app-server/reasoning-effort.ts
|
|
45
|
-
const CODEX_REASONING_EFFORTS = [
|
|
46
|
-
"minimal",
|
|
47
|
-
"low",
|
|
48
|
-
"medium",
|
|
49
|
-
"high",
|
|
50
|
-
"xhigh",
|
|
51
|
-
"max"
|
|
52
|
-
];
|
|
53
|
-
const LEGACY_PRO_REASONING_EFFORTS = [
|
|
54
|
-
"medium",
|
|
55
|
-
"high",
|
|
56
|
-
"xhigh"
|
|
57
|
-
];
|
|
58
|
-
const LEGACY_PRO_MODEL_ID_RE = /^gpt-5\.[45]-pro$/u;
|
|
59
|
-
const MODERN_GPT_5_MODEL_ID_RE = /^gpt-5\.(?:[3-9]|[1-9]\d)(?:$|-)/u;
|
|
60
|
-
/** Read reasoning metadata after the Codex app-server route has been selected. */
|
|
61
|
-
function readCodexSupportedReasoningEfforts(compat) {
|
|
62
|
-
return compat && "supportedReasoningEfforts" in compat ? compat.supportedReasoningEfforts : void 0;
|
|
63
|
-
}
|
|
64
|
-
function resolveCodexAppServerReasoningEffort(params) {
|
|
65
|
-
if (params.thinkLevel === "ultra") return "ultra";
|
|
66
|
-
if (params.thinkLevel === "off") return params.supportedReasoningEfforts?.includes("none") ? "none" : null;
|
|
67
|
-
if (params.thinkLevel === "adaptive") return null;
|
|
68
|
-
const modelId = params.modelId.trim().toLowerCase();
|
|
69
|
-
const supportedReasoningEfforts = params.supportedReasoningEfforts ?? (LEGACY_PRO_MODEL_ID_RE.test(modelId) ? LEGACY_PRO_REASONING_EFFORTS : void 0);
|
|
70
|
-
if (supportedReasoningEfforts) return selectSupportedReasoningEffort({
|
|
71
|
-
requested: params.thinkLevel,
|
|
72
|
-
supportedEfforts: supportedReasoningEfforts.map((effort) => effort.trim().toLowerCase()),
|
|
73
|
-
effortOrder: CODEX_REASONING_EFFORTS
|
|
74
|
-
}) ?? null;
|
|
75
|
-
if (params.thinkLevel === "minimal" && MODERN_GPT_5_MODEL_ID_RE.test(modelId)) return "low";
|
|
76
|
-
return params.thinkLevel === "max" ? null : params.thinkLevel;
|
|
77
|
-
}
|
|
78
|
-
//#endregion
|
|
79
|
-
//#region extensions/codex/src/app-server/thread-context-engine.ts
|
|
80
|
-
function buildContextEngineBinding(params, projection) {
|
|
81
|
-
const contextEngine = isActiveHarnessContextEngine(params.contextEngine) ? params.contextEngine : void 0;
|
|
82
|
-
const engineId = contextEngine?.info?.id?.trim();
|
|
83
|
-
if (!contextEngine || !engineId) return;
|
|
84
|
-
return {
|
|
85
|
-
schemaVersion: 1,
|
|
86
|
-
engineId,
|
|
87
|
-
policyFingerprint: JSON.stringify({
|
|
88
|
-
schemaVersion: 1,
|
|
89
|
-
engineId,
|
|
90
|
-
engineVersion: contextEngine.info.version,
|
|
91
|
-
ownsCompaction: contextEngine.info.ownsCompaction === true,
|
|
92
|
-
turnMaintenanceMode: contextEngine.info.turnMaintenanceMode,
|
|
93
|
-
citationsMode: params.config?.memory?.citations,
|
|
94
|
-
contextTokenBudget: params.contextTokenBudget,
|
|
95
|
-
projectionMaxChars: resolveCodexContextEngineProjectionMaxChars({ contextTokenBudget: params.contextTokenBudget })
|
|
96
|
-
}),
|
|
97
|
-
projection: projection ? {
|
|
98
|
-
schemaVersion: 1,
|
|
99
|
-
mode: "thread_bootstrap",
|
|
100
|
-
epoch: projection.epoch,
|
|
101
|
-
fingerprint: projection.fingerprint
|
|
102
|
-
} : void 0
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
function isContextEngineBindingCompatible(previous, next) {
|
|
106
|
-
return previous?.schemaVersion === next.schemaVersion && previous.engineId === next.engineId && previous.policyFingerprint === next.policyFingerprint && areContextEngineProjectionBindingsCompatible(previous.projection, next.projection);
|
|
107
|
-
}
|
|
108
|
-
function areContextEngineProjectionBindingsCompatible(previous, next) {
|
|
109
|
-
if (!next) return previous === void 0;
|
|
110
|
-
return previous?.schemaVersion === next.schemaVersion && previous.mode === next.mode && previous.epoch === next.epoch && previous.fingerprint === next.fingerprint;
|
|
111
|
-
}
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region extensions/codex/src/app-server/native-model-input-tools.ts
|
|
114
|
-
/** Stock native hooks flatten the configured V2 namespace without a delimiter. */
|
|
115
|
-
function resolveCodexNativeModelInputTools(config) {
|
|
116
|
-
const features = isJsonObject(config.features) ? config.features : void 0;
|
|
117
|
-
const multiAgent = isJsonObject(features?.multi_agent_v2) ? features.multi_agent_v2 : void 0;
|
|
118
|
-
const namespace = typeof multiAgent?.tool_namespace === "string" ? multiAgent.tool_namespace.trim() : "collaboration";
|
|
119
|
-
return [
|
|
120
|
-
"spawn_agent",
|
|
121
|
-
"multi_agent_v1send_input",
|
|
122
|
-
"send_message",
|
|
123
|
-
"followup_task",
|
|
124
|
-
...namespace ? [
|
|
125
|
-
`${namespace}spawn_agent`,
|
|
126
|
-
`${namespace}send_message`,
|
|
127
|
-
`${namespace}followup_task`
|
|
128
|
-
] : []
|
|
129
|
-
];
|
|
130
|
-
}
|
|
131
|
-
//#endregion
|
|
132
|
-
//#region extensions/codex/src/app-server/profiler-flag.ts
|
|
133
|
-
const PROFILER_FLAGS = ["profiler", "codex.profiler"];
|
|
134
|
-
function isCodexAppServerProfilerEnabled(config, env = process.env) {
|
|
135
|
-
return PROFILER_FLAGS.some((flag) => isDiagnosticFlagEnabled(flag, config, env));
|
|
136
|
-
}
|
|
137
|
-
//#endregion
|
|
138
48
|
//#region extensions/codex/src/app-server/scheduled-app-tool-policy.ts
|
|
139
49
|
function normalizeAppToolApprovalMode(value) {
|
|
140
50
|
return value === "auto" || value === "prompt" || value === "writes" || value === "approve" ? value : void 0;
|
|
@@ -168,10 +78,8 @@ function appToolHintsAllowed(tool, policy) {
|
|
|
168
78
|
return (policy.allowDestructiveActions || tool?.destructiveHint === false) && (policy.allowOpenWorld !== false || tool?.openWorldHint === false);
|
|
169
79
|
}
|
|
170
80
|
function intersectToolApprovalMode(captured, current) {
|
|
171
|
-
if (captured === current) return captured;
|
|
172
|
-
if (captured === "prompt" || current === "prompt") return "prompt";
|
|
81
|
+
if (captured === current || current === "approve") return captured;
|
|
173
82
|
if (captured === "approve") return current;
|
|
174
|
-
if (current === "approve") return captured;
|
|
175
83
|
return "prompt";
|
|
176
84
|
}
|
|
177
85
|
//#endregion
|
|
@@ -319,9 +227,9 @@ async function readCurrentCodexScheduledAppPolicy(params) {
|
|
|
319
227
|
async function captureScheduledCodexAppAuthority(params) {
|
|
320
228
|
const requestedTimeoutMs = params.timeoutMs ?? CODEX_APP_AUTHORITY_CAPTURE_TIMEOUT_MS;
|
|
321
229
|
const timeoutMs = Math.min(CODEX_APP_AUTHORITY_CAPTURE_TIMEOUT_MS, Math.max(CODEX_APP_AUTHORITY_CAPTURE_MIN_TIMEOUT_MS, Number.isFinite(requestedTimeoutMs) ? Math.floor(requestedTimeoutMs) : CODEX_APP_AUTHORITY_CAPTURE_TIMEOUT_MS));
|
|
322
|
-
const deadlineMs =
|
|
230
|
+
const deadlineMs = performance.now() + timeoutMs;
|
|
323
231
|
const boundedClient = { request: ((method, requestParams) => {
|
|
324
|
-
const remainingTimeoutMs = deadlineMs -
|
|
232
|
+
const remainingTimeoutMs = deadlineMs - performance.now();
|
|
325
233
|
if (remainingTimeoutMs <= 0) throw new CodexScheduledAppAuthorityCaptureTimeoutError();
|
|
326
234
|
return params.client.request(method, requestParams, {
|
|
327
235
|
timeoutMs: remainingTimeoutMs,
|
|
@@ -435,9 +343,8 @@ function intersectCodexPluginThreadConfigWithScheduledAuthority(config, authorit
|
|
|
435
343
|
const appsPatch = asOptionalRecord(configPatch.apps);
|
|
436
344
|
for (const [appId, captured] of capturedById) {
|
|
437
345
|
const appPatch = asOptionalRecord(appsPatch?.[appId]);
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
if (!currentApp) continue;
|
|
346
|
+
const currentApp = Object.hasOwn(apps, appId) ? apps[appId] : void 0;
|
|
347
|
+
if (!appPatch || !currentApp) continue;
|
|
441
348
|
if (currentApp.destructiveApprovalMode === "ask") Object.assign(appPatch, buildCodexAppApprovalOverrides(currentPolicy.config, {
|
|
442
349
|
id: appId,
|
|
443
350
|
approvalOverrideToolConfigKeys: []
|
|
@@ -469,7 +376,6 @@ function intersectCodexPluginThreadConfigWithScheduledAuthority(config, authorit
|
|
|
469
376
|
policyContext
|
|
470
377
|
};
|
|
471
378
|
}
|
|
472
|
-
/** Returns the managed-requirements identity captured for a configured app-server job. */
|
|
473
379
|
function readScheduledCodexAppManagedRequirementsFingerprint(authority) {
|
|
474
380
|
const auth = parseScheduledCodexAppAuthority(authority)?.auth;
|
|
475
381
|
return auth?.kind === "configured-app-server" ? auth.managedRequirementsFingerprint : void 0;
|
|
@@ -501,9 +407,188 @@ function buildScheduledCodexAppAuthorityInputFingerprint(baseFingerprint, author
|
|
|
501
407
|
});
|
|
502
408
|
}
|
|
503
409
|
//#endregion
|
|
410
|
+
//#region extensions/codex/src/app-server/plugin-thread-config-deadline.ts
|
|
411
|
+
/** Enforces one bounded startup budget across Codex plugin config discovery. */
|
|
412
|
+
const CODEX_PLUGIN_THREAD_CONFIG_MAX_TIMEOUT_MS = 6e4;
|
|
413
|
+
const CODEX_PLUGIN_THREAD_CONFIG_TIMEOUT_DIVISOR = 4;
|
|
414
|
+
const CODEX_PLUGIN_THREAD_CONFIG_MIN_TIMEOUT_MS = 100;
|
|
415
|
+
var CodexPluginThreadConfigDeadlineError = class extends Error {
|
|
416
|
+
constructor() {
|
|
417
|
+
super("Codex plugin thread config deadline elapsed");
|
|
418
|
+
this.name = "CodexPluginThreadConfigDeadlineError";
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
/** Resolves the plugin policy state reused throughout app-server startup. */
|
|
422
|
+
function resolveCodexPluginThreadConfigStartupPolicy(params) {
|
|
423
|
+
const pluginThreadConfigRequired = params.hostedAppsSupported === false || Boolean(params.scheduledRuntimeAuthority) || !params.nativeToolSurfaceEnabled || shouldBuildCodexPluginThreadConfig(params.pluginConfig);
|
|
424
|
+
const pluginThreadConfigPluginConfig = params.hostedAppsSupported !== false && (params.nativeToolSurfaceEnabled || params.scheduledRuntimeAuthority) ? params.pluginConfig : disableCodexPluginThreadConfig(params.pluginConfig);
|
|
425
|
+
const resolvedPluginPolicy = pluginThreadConfigRequired ? resolveCodexPluginsPolicy(pluginThreadConfigPluginConfig) : void 0;
|
|
426
|
+
return {
|
|
427
|
+
pluginThreadConfigRequired,
|
|
428
|
+
pluginThreadConfigPluginConfig,
|
|
429
|
+
resolvedPluginPolicy,
|
|
430
|
+
enabledPluginConfigKeys: resolvedPluginPolicy ? resolvedPluginPolicy.pluginPolicies.filter((plugin) => plugin.enabled).map((plugin) => plugin.configKey).toSorted() : void 0
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
/** Builds plugin config without allowing sequential RPC timeouts to consume the turn. */
|
|
434
|
+
async function buildCodexPluginThreadConfigWithinDeadline(params) {
|
|
435
|
+
const { requestTimeoutMs, signal, request, failClosedOnTimeout, transform, ...buildParams } = params;
|
|
436
|
+
signal.throwIfAborted();
|
|
437
|
+
const timeoutMs = resolveCodexPluginThreadConfigTimeoutMs(requestTimeoutMs);
|
|
438
|
+
const deadlineMs = performance.now() + timeoutMs;
|
|
439
|
+
let requestTimedOut = false;
|
|
440
|
+
const boundedRequest = async (method, requestParams) => {
|
|
441
|
+
const remainingTimeoutMs = deadlineMs - performance.now();
|
|
442
|
+
if (requestTimedOut || remainingTimeoutMs <= 0) throw new CodexPluginThreadConfigDeadlineError();
|
|
443
|
+
try {
|
|
444
|
+
return await request(method, requestParams, {
|
|
445
|
+
timeoutMs: remainingTimeoutMs,
|
|
446
|
+
signal
|
|
447
|
+
});
|
|
448
|
+
} catch (error) {
|
|
449
|
+
requestTimedOut ||= isCodexPluginThreadConfigTimeoutError(error);
|
|
450
|
+
throw error;
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
try {
|
|
454
|
+
return await withAbortableTimeout({
|
|
455
|
+
signal,
|
|
456
|
+
timeoutMs,
|
|
457
|
+
promise: (async () => {
|
|
458
|
+
const config = await buildCodexPluginThreadConfig({
|
|
459
|
+
...buildParams,
|
|
460
|
+
request: boundedRequest
|
|
461
|
+
});
|
|
462
|
+
const result = transform ? await transform(config, boundedRequest) : config;
|
|
463
|
+
if (requestTimedOut || performance.now() >= deadlineMs) throw new CodexPluginThreadConfigDeadlineError();
|
|
464
|
+
return result;
|
|
465
|
+
})(),
|
|
466
|
+
timeoutMessage: "Codex plugin thread config deadline elapsed",
|
|
467
|
+
createTimeoutError: () => new CodexPluginThreadConfigDeadlineError()
|
|
468
|
+
});
|
|
469
|
+
} catch (error) {
|
|
470
|
+
if (signal.aborted || !requestTimedOut && !isCodexPluginThreadConfigTimeoutError(error) && performance.now() < deadlineMs) throw error;
|
|
471
|
+
if (failClosedOnTimeout) throw new AgentHarnessPreflightError(`Codex app policy verification exceeded its ${timeoutMs} ms startup budget. No app tools were executed. Retry after Codex app inventory is responsive.`);
|
|
472
|
+
return buildCodexPluginThreadConfigTimeoutFallback({
|
|
473
|
+
pluginConfig: buildParams.pluginConfig,
|
|
474
|
+
appCacheKey: buildParams.appCacheKey,
|
|
475
|
+
message: `Codex plugin discovery exceeded its ${timeoutMs} ms startup budget; plugin apps were disabled for this turn.`
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
/** Captures fingerprint inputs before startup work and binds the provider at admission. */
|
|
480
|
+
function prepareCodexPluginThreadConfigStartupProvider(prepared) {
|
|
481
|
+
const { startupPolicy, appCacheKey } = prepared;
|
|
482
|
+
if (!startupPolicy.pluginThreadConfigRequired) return;
|
|
483
|
+
const { pluginThreadConfigPluginConfig: pluginConfig, resolvedPluginPolicy: policy, enabledPluginConfigKeys } = startupPolicy;
|
|
484
|
+
const inputFingerprint = buildScheduledCodexAppAuthorityInputFingerprint(buildCodexPluginThreadConfigInputFingerprint({
|
|
485
|
+
pluginConfig,
|
|
486
|
+
appCacheKey
|
|
487
|
+
}), prepared.scheduledRuntimeAuthority);
|
|
488
|
+
return (params) => {
|
|
489
|
+
const { client, appCache, metadataCache: configuredMetadataCache, ...buildParams } = params;
|
|
490
|
+
const metadataCache = configuredMetadataCache ?? defaultCodexPluginMetadataCache;
|
|
491
|
+
return {
|
|
492
|
+
enabled: true,
|
|
493
|
+
requiresCurrentPolicyCheck: Boolean(policy?.enabled || params.scheduledRuntimeAuthority),
|
|
494
|
+
inputFingerprint,
|
|
495
|
+
enabledPluginConfigKeys,
|
|
496
|
+
accountAppRecoveryEnabled: policy?.allowAllPlugins,
|
|
497
|
+
recoverablePluginConfigKeys: policy ? resolveRecoverableCodexPluginConfigKeys({
|
|
498
|
+
policy,
|
|
499
|
+
metadataCache,
|
|
500
|
+
appCacheKey,
|
|
501
|
+
configCwd: params.configCwd
|
|
502
|
+
}) : void 0,
|
|
503
|
+
build: async (buildOptions) => {
|
|
504
|
+
const config = await buildCodexPluginThreadConfigWithinDeadline({
|
|
505
|
+
...buildParams,
|
|
506
|
+
pluginConfig,
|
|
507
|
+
appCacheKey,
|
|
508
|
+
threadId: buildOptions?.threadId,
|
|
509
|
+
appCache: appCache ?? defaultCodexAppInventoryCache,
|
|
510
|
+
metadataCache,
|
|
511
|
+
failClosedOnTimeout: Boolean(params.scheduledRuntimeAuthority),
|
|
512
|
+
transform: params.scheduledRuntimeAuthority ? async (builtConfig, request) => intersectCodexPluginThreadConfigWithScheduledAuthority(builtConfig, params.scheduledRuntimeAuthority, await readCurrentCodexScheduledAppPolicy({
|
|
513
|
+
request,
|
|
514
|
+
configCwd: params.configCwd,
|
|
515
|
+
threadId: buildOptions?.threadId
|
|
516
|
+
})) : void 0,
|
|
517
|
+
request: (method, requestParams, options) => client.request(method, requestParams, options)
|
|
518
|
+
});
|
|
519
|
+
return params.scheduledRuntimeAuthority && inputFingerprint ? {
|
|
520
|
+
...config,
|
|
521
|
+
inputFingerprint
|
|
522
|
+
} : config;
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
function resolveCodexPluginThreadConfigTimeoutMs(requestTimeoutMs) {
|
|
528
|
+
return Math.min(CODEX_PLUGIN_THREAD_CONFIG_MAX_TIMEOUT_MS, Math.max(CODEX_PLUGIN_THREAD_CONFIG_MIN_TIMEOUT_MS, Math.floor((Number.isFinite(requestTimeoutMs) && requestTimeoutMs > 0 ? requestTimeoutMs : CODEX_PLUGIN_THREAD_CONFIG_MAX_TIMEOUT_MS * CODEX_PLUGIN_THREAD_CONFIG_TIMEOUT_DIVISOR) / CODEX_PLUGIN_THREAD_CONFIG_TIMEOUT_DIVISOR)));
|
|
529
|
+
}
|
|
530
|
+
function isCodexPluginThreadConfigTimeoutError(error) {
|
|
531
|
+
return error instanceof CodexPluginThreadConfigDeadlineError || error instanceof Error && "code" in error && error.code === "CODEX_APP_SERVER_LOCAL_REQUEST_CANCELLED" && error.message.endsWith(" timed out");
|
|
532
|
+
}
|
|
533
|
+
//#endregion
|
|
534
|
+
//#region extensions/codex/src/app-server/thread-context-engine.ts
|
|
535
|
+
function buildContextEngineBinding(params, projection) {
|
|
536
|
+
const contextEngine = isActiveHarnessContextEngine(params.contextEngine) ? params.contextEngine : void 0;
|
|
537
|
+
const engineId = contextEngine?.info?.id?.trim();
|
|
538
|
+
if (!contextEngine || !engineId) return;
|
|
539
|
+
return {
|
|
540
|
+
schemaVersion: 1,
|
|
541
|
+
engineId,
|
|
542
|
+
policyFingerprint: JSON.stringify({
|
|
543
|
+
schemaVersion: 1,
|
|
544
|
+
engineId,
|
|
545
|
+
engineVersion: contextEngine.info.version,
|
|
546
|
+
ownsCompaction: contextEngine.info.ownsCompaction === true,
|
|
547
|
+
turnMaintenanceMode: contextEngine.info.turnMaintenanceMode,
|
|
548
|
+
citationsMode: params.config?.memory?.citations,
|
|
549
|
+
contextTokenBudget: params.contextTokenBudget,
|
|
550
|
+
projectionMaxChars: resolveCodexContextEngineProjectionMaxChars({ contextTokenBudget: params.contextTokenBudget })
|
|
551
|
+
}),
|
|
552
|
+
projection: projection ? {
|
|
553
|
+
schemaVersion: 1,
|
|
554
|
+
mode: "thread_bootstrap",
|
|
555
|
+
epoch: projection.epoch,
|
|
556
|
+
fingerprint: projection.fingerprint
|
|
557
|
+
} : void 0
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
function isContextEngineBindingCompatible(previous, next) {
|
|
561
|
+
const previousProjection = previous?.projection;
|
|
562
|
+
const nextProjection = next.projection;
|
|
563
|
+
return previous?.schemaVersion === next.schemaVersion && previous.engineId === next.engineId && previous.policyFingerprint === next.policyFingerprint && (!nextProjection ? previousProjection === void 0 : previousProjection?.schemaVersion === nextProjection.schemaVersion && previousProjection.mode === nextProjection.mode && previousProjection.epoch === nextProjection.epoch && previousProjection.fingerprint === nextProjection.fingerprint);
|
|
564
|
+
}
|
|
565
|
+
//#endregion
|
|
566
|
+
//#region extensions/codex/src/app-server/native-model-input-tools.ts
|
|
567
|
+
/** Stock native hooks flatten the configured V2 namespace without a delimiter. */
|
|
568
|
+
function resolveCodexNativeModelInputTools(config) {
|
|
569
|
+
const features = isJsonObject(config.features) ? config.features : void 0;
|
|
570
|
+
const multiAgent = isJsonObject(features?.multi_agent_v2) ? features.multi_agent_v2 : void 0;
|
|
571
|
+
const namespace = typeof multiAgent?.tool_namespace === "string" ? multiAgent.tool_namespace.trim() : "collaboration";
|
|
572
|
+
return [
|
|
573
|
+
"spawn_agent",
|
|
574
|
+
"multi_agent_v1send_input",
|
|
575
|
+
"send_message",
|
|
576
|
+
"followup_task",
|
|
577
|
+
...namespace ? [
|
|
578
|
+
`${namespace}spawn_agent`,
|
|
579
|
+
`${namespace}send_message`,
|
|
580
|
+
`${namespace}followup_task`
|
|
581
|
+
] : []
|
|
582
|
+
];
|
|
583
|
+
}
|
|
584
|
+
//#endregion
|
|
585
|
+
//#region extensions/codex/src/app-server/profiler-flag.ts
|
|
586
|
+
const PROFILER_FLAGS = ["profiler", "codex.profiler"];
|
|
587
|
+
function isCodexAppServerProfilerEnabled(config, env = process.env) {
|
|
588
|
+
return PROFILER_FLAGS.some((flag) => isDiagnosticFlagEnabled(flag, config, env));
|
|
589
|
+
}
|
|
590
|
+
//#endregion
|
|
504
591
|
//#region extensions/codex/src/app-server/thread-lifecycle-timing.ts
|
|
505
|
-
const CODEX_THREAD_LIFECYCLE_TIMING_WARN_TOTAL_MS = 1e3;
|
|
506
|
-
const CODEX_THREAD_LIFECYCLE_TIMING_WARN_STAGE_MS = 500;
|
|
507
592
|
function createCodexThreadLifecycleTimingTracker(options = {}) {
|
|
508
593
|
const log = options.log ?? embeddedAgentLog;
|
|
509
594
|
const timing = createStageTimingTracker(options.now ?? Date.now);
|
|
@@ -518,8 +603,8 @@ function createCodexThreadLifecycleTimingTracker(options = {}) {
|
|
|
518
603
|
if (didLog) return;
|
|
519
604
|
const { totalMs, stages: spans } = timing.snapshot();
|
|
520
605
|
const detailed = options.enabled || log.isEnabled?.("trace");
|
|
521
|
-
const totalThresholdMs =
|
|
522
|
-
const stageThresholdMs =
|
|
606
|
+
const totalThresholdMs = detailed ? 1e3 : 1e4;
|
|
607
|
+
const stageThresholdMs = detailed ? 500 : 5e3;
|
|
523
608
|
const shouldWarn = totalMs >= totalThresholdMs || spans.some((span) => span.durationMs >= stageThresholdMs);
|
|
524
609
|
if (!shouldWarn && !log.isEnabled?.("trace")) return;
|
|
525
610
|
didLog = true;
|
|
@@ -566,6 +651,7 @@ async function prepareCodexThreadRequestContext(params, options) {
|
|
|
566
651
|
agentDir: params.params.agentDir,
|
|
567
652
|
config: params.params.config
|
|
568
653
|
});
|
|
654
|
+
const startModelProvider = startModelSelection.modelProvider;
|
|
569
655
|
const source = params.params.hostCapabilities.retainSourceAuthority?.();
|
|
570
656
|
const modelPolicyEnforced = params.nativeModelAdmission === void 0 || options.preflight.nativeModelInputTools !== void 0;
|
|
571
657
|
let inference;
|
|
@@ -601,7 +687,7 @@ async function prepareCodexThreadRequestContext(params, options) {
|
|
|
601
687
|
...options.preflight,
|
|
602
688
|
bindingIdentity: options.bindingIdentity,
|
|
603
689
|
startModelSelection,
|
|
604
|
-
startModelProvider
|
|
690
|
+
startModelProvider,
|
|
605
691
|
normalizeBindingModelProvider: (authProfileId, modelProvider) => normalizeCodexAppServerBindingModelProvider({
|
|
606
692
|
authProfileId,
|
|
607
693
|
modelProvider,
|
|
@@ -609,6 +695,18 @@ async function prepareCodexThreadRequestContext(params, options) {
|
|
|
609
695
|
agentDir: params.params.agentDir,
|
|
610
696
|
config: params.params.config
|
|
611
697
|
}),
|
|
698
|
+
assertInferenceConfig: (config, modelProvider) => assertCodexInferenceRouteConfig(params.client, params.inferenceRoute, config, modelProvider, params.inferenceProviderRoutes),
|
|
699
|
+
buildResumeParams: (binding, authProfileId, config) => buildThreadResumeParams(params.params, {
|
|
700
|
+
...params,
|
|
701
|
+
threadId: binding.threadId,
|
|
702
|
+
authProfileId,
|
|
703
|
+
model: startModelSelection.model,
|
|
704
|
+
modelProvider: startModelProvider,
|
|
705
|
+
preserveNativeModel: binding.preserveNativeModel === true,
|
|
706
|
+
config,
|
|
707
|
+
hostSystemAgentActive: options.preflight.hostSystemAgentActive,
|
|
708
|
+
restrictedToolSurfaceInheritedMcpServerNames: options.preflight.restrictedToolSurfaceInheritedMcpServerNames
|
|
709
|
+
}),
|
|
612
710
|
throwIfAborted: options.throwIfAborted
|
|
613
711
|
};
|
|
614
712
|
}
|
|
@@ -630,7 +728,7 @@ function resolveCodexThreadAgentDir(params) {
|
|
|
630
728
|
sessionKey: params.params.sessionKey,
|
|
631
729
|
agentId: params.agentId ?? params.params.agentId
|
|
632
730
|
}).sessionAgentId;
|
|
633
|
-
return params.agentDir ?? params.params.agentDir ?? resolveAgentDir$
|
|
731
|
+
return params.agentDir ?? params.params.agentDir ?? resolveAgentDir$1(params.params.config ?? {}, agentId);
|
|
634
732
|
}
|
|
635
733
|
function buildCodexThreadBindingPolicy(params, preflight) {
|
|
636
734
|
return {
|
|
@@ -652,11 +750,14 @@ async function prepareCodexThreadFinalConfigPatch(params, nativeModelInputTools,
|
|
|
652
750
|
binding
|
|
653
751
|
} : { action: "start" },
|
|
654
752
|
...nativeModelInputTools ? { nativeModelInputTools } : {}
|
|
655
|
-
}) ?? {
|
|
656
|
-
configPatch:
|
|
657
|
-
nativeHookRelayGeneration:
|
|
753
|
+
}, params.client) ?? {
|
|
754
|
+
configPatch: void 0,
|
|
755
|
+
nativeHookRelayGeneration: void 0
|
|
658
756
|
};
|
|
659
757
|
}
|
|
758
|
+
function buildCodexThreadRequestConfig(params, context, pluginConfigPatch, finalConfigPatch) {
|
|
759
|
+
return applyCodexNativeSkillIsolation(mergeCodexThreadConfigs(params.config, context.userMcpServersConfigPatch, pluginConfigPatch, finalConfigPatch), context.nativeSkillIsolation);
|
|
760
|
+
}
|
|
660
761
|
async function prepareCodexThreadLifecyclePreflight(params) {
|
|
661
762
|
let effectiveConfig = await assertCodexModelBackedReviewerEffectiveConfig({
|
|
662
763
|
client: params.client,
|
|
@@ -724,7 +825,7 @@ async function prepareCodexThreadLifecyclePreflight(params) {
|
|
|
724
825
|
if (restrictedToolSurface && params.nativeCodeModeEnabled !== false) throw new Error("Codex restricted tool surfaces require native code mode to be disabled");
|
|
725
826
|
if (!effectiveConfig) effectiveConfig = await lifecycleTiming.measure("effective-config-read", () => readCodexEffectiveConfig(params.client, params.cwd, { signal: params.signal }));
|
|
726
827
|
params.config = mergeCodexNativeProjectDocThreadConfig(params.config, effectiveConfig);
|
|
727
|
-
if (params.shellEnvironment) params.config = mergeCodexNativeShellEnvironment(params.config, effectiveConfig.config.shell_environment_policy);
|
|
828
|
+
if (params.shellEnvironment || params.shellGitConfigParameters) params.config = mergeCodexNativeShellEnvironment(params.config, effectiveConfig.config.shell_environment_policy);
|
|
728
829
|
const restrictedToolSurfaceInheritedMcpServerNames = restrictedToolSurface ? await lifecycleTiming.measure("restricted-tool-surface-mcp-policy", () => readCodexInheritedMcpServerNames(params.client, params.cwd, params.signal, effectiveConfig)) : [];
|
|
729
830
|
if (restrictedToolSurface || imageGenerationDenied || params.nativeCodeModeEnabled !== false) await lifecycleTiming.measure("tool-policy-config-requirements-read", () => assertCodexManagedRequirementsDoNotOverrideToolPolicy(params.client, {
|
|
730
831
|
restrictedToolSurface,
|
|
@@ -788,7 +889,7 @@ function recordCodexThreadReady(params, context, threadId, action) {
|
|
|
788
889
|
});
|
|
789
890
|
}
|
|
790
891
|
async function resumeExistingCodexThread(params, context) {
|
|
791
|
-
const { binding: resumeBinding, bindingIdentity,
|
|
892
|
+
const { binding: resumeBinding, bindingIdentity, startModelProvider, dynamicToolsFingerprint, webSearchThreadConfigFingerprint, ringZeroConfigFingerprint, ringZeroClientInstanceId, restrictedToolSurface, lifecycleTiming, normalizeBindingModelProvider, throwIfAborted, stageBindingReplacement } = context;
|
|
792
893
|
let acceptedConfiguration;
|
|
793
894
|
let disposeConfiguration;
|
|
794
895
|
let resumeReservation;
|
|
@@ -810,18 +911,8 @@ async function resumeExistingCodexThread(params, context) {
|
|
|
810
911
|
const authProfileId = resumeBinding.connectionScope === "supervision" ? void 0 : params.params.authProfileId ?? resumeBinding.authProfileId;
|
|
811
912
|
const finalConfigPatch = context.prebuiltFinalConfigPatch ?? await prepareCodexThreadFinalConfigPatch(params, context.nativeModelInputTools, resumeBinding);
|
|
812
913
|
const pluginThreadConfig = context.prebuiltPluginThreadConfig ?? (params.pluginThreadConfig?.enabled ? await lifecycleTiming.measure("plugin-config-build", () => params.pluginThreadConfig?.build()) : void 0);
|
|
813
|
-
const resumeConfig =
|
|
814
|
-
const resumeParams = lifecycleTiming.measureSync("thread-resume-params", () =>
|
|
815
|
-
...params,
|
|
816
|
-
threadId: resumeBinding.threadId,
|
|
817
|
-
authProfileId,
|
|
818
|
-
model: startModelSelection.model,
|
|
819
|
-
modelProvider: startModelProvider,
|
|
820
|
-
preserveNativeModel: resumeBinding.preserveNativeModel === true,
|
|
821
|
-
config: resumeConfig,
|
|
822
|
-
hostSystemAgentActive,
|
|
823
|
-
restrictedToolSurfaceInheritedMcpServerNames
|
|
824
|
-
}));
|
|
914
|
+
const resumeConfig = buildCodexThreadRequestConfig(params, context, pluginThreadConfig?.configPatch, finalConfigPatch.configPatch);
|
|
915
|
+
const resumeParams = lifecycleTiming.measureSync("thread-resume-params", () => context.buildResumeParams(resumeBinding, authProfileId, resumeConfig));
|
|
825
916
|
const requestModelProvider = typeof resumeParams.modelProvider === "string" && resumeParams.modelProvider.trim() ? resumeParams.modelProvider : void 0;
|
|
826
917
|
throwIfAborted();
|
|
827
918
|
resumeReservation = params.reserveResumeThread?.(resumeBinding.threadId);
|
|
@@ -833,7 +924,7 @@ async function resumeExistingCodexThread(params, context) {
|
|
|
833
924
|
withCurrent: params.authority?.withCurrent,
|
|
834
925
|
assertCurrent: () => {
|
|
835
926
|
configuration.assertCurrent();
|
|
836
|
-
|
|
927
|
+
context.assertInferenceConfig(resumeParams.config, requestModelProvider ?? (resumeBinding.preserveNativeModel ? configuration.modelProvider ?? void 0 : void 0));
|
|
837
928
|
}
|
|
838
929
|
}));
|
|
839
930
|
acceptedConfiguration = configuration;
|
|
@@ -903,13 +994,11 @@ async function resumeExistingCodexThread(params, context) {
|
|
|
903
994
|
...resumeBinding,
|
|
904
995
|
threadId: response.thread.id,
|
|
905
996
|
...resumePatch,
|
|
906
|
-
liveThreadConfigFingerprint: fingerprintCodexThreadConfig({
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
requestedModelProvider: resumeBinding.preserveNativeModel === true ? null : resumeParams.modelProvider ?? resumePatch.modelProvider ?? null
|
|
912
|
-
}, authProfileId, dynamicToolsFingerprint),
|
|
997
|
+
liveThreadConfigFingerprint: fingerprintCodexThreadConfig(resumeParams, authProfileId, dynamicToolsFingerprint, {
|
|
998
|
+
model: response.model,
|
|
999
|
+
modelProvider: resumePatch.modelProvider ?? null,
|
|
1000
|
+
preserveNativeModel: resumeBinding.preserveNativeModel
|
|
1001
|
+
}),
|
|
913
1002
|
lifecycle: {
|
|
914
1003
|
action: "resumed",
|
|
915
1004
|
...activeTurnIds.length ? { activeTurnIds } : {}
|
|
@@ -946,10 +1035,10 @@ async function resumeExistingCodexThread(params, context) {
|
|
|
946
1035
|
}
|
|
947
1036
|
async function startFreshCodexThread(params, context) {
|
|
948
1037
|
const clientId = resolveCodexAppServerClientInstanceId(params.client);
|
|
949
|
-
const { bindingIdentity, startModelSelection, startModelProvider,
|
|
1038
|
+
const { bindingIdentity, startModelSelection, startModelProvider, dynamicToolsFingerprint, webSearchThreadConfigFingerprint, ringZeroConfigFingerprint, ringZeroClientInstanceId, contextEngineBinding, hostSystemAgentActive, restrictedToolSurface, restrictedToolSurfaceInheritedMcpServerNames, lifecycleTiming, normalizeBindingModelProvider, throwIfAborted, prebuiltPluginThreadConfig, preserveExistingBinding, rotatedContextEngineBinding, replacementPredecessor } = context;
|
|
950
1039
|
const pluginThreadConfig = params.pluginThreadConfig?.enabled ? prebuiltPluginThreadConfig ?? await lifecycleTiming.measure("plugin-config-build", () => params.pluginThreadConfig?.build()) : void 0;
|
|
951
1040
|
const finalConfigPatch = await prepareCodexThreadFinalConfigPatch(params, context.nativeModelInputTools);
|
|
952
|
-
const config = lifecycleTiming.measureSync("merge-thread-config", () =>
|
|
1041
|
+
const config = lifecycleTiming.measureSync("merge-thread-config", () => buildCodexThreadRequestConfig(params, context, pluginThreadConfig?.configPatch, finalConfigPatch.configPatch));
|
|
953
1042
|
const startParams = lifecycleTiming.measureSync("thread-start-params", () => buildThreadStartParams(params.params, {
|
|
954
1043
|
...params,
|
|
955
1044
|
config,
|
|
@@ -966,7 +1055,7 @@ async function startFreshCodexThread(params, context) {
|
|
|
966
1055
|
};
|
|
967
1056
|
const assertInferenceCurrent = () => {
|
|
968
1057
|
assertCurrent();
|
|
969
|
-
|
|
1058
|
+
context.assertInferenceConfig(startParams.config, requestModelProvider);
|
|
970
1059
|
};
|
|
971
1060
|
const threadStartResponse = await lifecycleTiming.measure("thread-start-request", async () => {
|
|
972
1061
|
try {
|
|
@@ -1076,13 +1165,10 @@ async function startFreshCodexThread(params, context) {
|
|
|
1076
1165
|
...startedBinding,
|
|
1077
1166
|
modelProvider: response.modelProvider ?? requestModelProvider ?? startModelProvider ?? modelProvider,
|
|
1078
1167
|
liveThreadEphemeralPolicy: startParams.ephemeral ? createCodexEphemeralThreadPolicy(params) : void 0,
|
|
1079
|
-
...!preserveExistingBinding ? { liveThreadConfigFingerprint: fingerprintCodexThreadConfig({
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
modelProvider: bindingModelProvider ?? null,
|
|
1084
|
-
requestedModelProvider: startParams.modelProvider ?? bindingModelProvider ?? null
|
|
1085
|
-
}, params.params.authProfileId, dynamicToolsFingerprint) } : {},
|
|
1168
|
+
...!preserveExistingBinding ? { liveThreadConfigFingerprint: fingerprintCodexThreadConfig(startParams, params.params.authProfileId, dynamicToolsFingerprint, {
|
|
1169
|
+
model: response.model,
|
|
1170
|
+
modelProvider: bindingModelProvider ?? null
|
|
1171
|
+
}) } : {},
|
|
1086
1172
|
lifecycle: {
|
|
1087
1173
|
action: "started",
|
|
1088
1174
|
...preserveExistingBinding ? { preserveExistingBinding: true } : {},
|
|
@@ -1094,12 +1180,14 @@ async function startFreshCodexThread(params, context) {
|
|
|
1094
1180
|
//#region extensions/codex/src/app-server/thread-lifecycle-warm.ts
|
|
1095
1181
|
/** Preserves the caller's abort reason across thread ownership transitions. */
|
|
1096
1182
|
function throwIfCodexThreadLifecycleAborted(signal) {
|
|
1097
|
-
if (
|
|
1183
|
+
if (signal?.aborted) throw codexThreadLifecycleAbortError(signal);
|
|
1184
|
+
}
|
|
1185
|
+
function codexThreadLifecycleAbortError(signal) {
|
|
1098
1186
|
const reason = signal.reason;
|
|
1099
|
-
if (reason instanceof Error)
|
|
1187
|
+
if (reason instanceof Error) return reason;
|
|
1100
1188
|
const error = new Error(typeof reason === "string" && reason.length > 0 ? reason : "codex app-server thread lifecycle aborted");
|
|
1101
1189
|
error.name = "AbortError";
|
|
1102
|
-
|
|
1190
|
+
return error;
|
|
1103
1191
|
}
|
|
1104
1192
|
/** Releases consumed subscription ownership or retires an unsafe client. */
|
|
1105
1193
|
async function releaseCodexConsumedLiveThread(options) {
|
|
@@ -1144,12 +1232,13 @@ async function releaseCodexBoundLiveThread(options) {
|
|
|
1144
1232
|
} : void 0
|
|
1145
1233
|
});
|
|
1146
1234
|
} finally {
|
|
1147
|
-
|
|
1235
|
+
const retiredExit = previous?.release(!isCodexAppServerLiveThreadClaimed(client, options.threadId));
|
|
1236
|
+
if (retiredExit) await racePromiseWithAbortSignal(retiredExit, options.signal, codexThreadLifecycleAbortError);
|
|
1148
1237
|
}
|
|
1149
1238
|
}
|
|
1150
1239
|
/** Reuses one safely owned, fully matching subscription on its original client. */
|
|
1151
1240
|
async function tryReuseCodexLiveThread(options) {
|
|
1152
|
-
const { params, binding, bindingIdentity, clientId, dynamicToolsFingerprint, environmentSelectionFingerprint,
|
|
1241
|
+
const { params, binding, bindingIdentity, clientId, dynamicToolsFingerprint, environmentSelectionFingerprint, lifecycleTiming, ringZeroActive, restrictedToolSurface, startModelSelection, throwIfAborted } = options;
|
|
1153
1242
|
const incognito = isIncognitoSessionKey(params.params.sessionKey);
|
|
1154
1243
|
if (incognito && (binding.preserveNativeModel || binding.connectionScope === "supervision")) {
|
|
1155
1244
|
if (binding.clientId === clientId && binding.clientId && ((await options.buildLoadedPluginThreadConfig(binding))?.fingerprint ?? binding.pluginAppsFingerprint) === binding.pluginAppsFingerprint) {
|
|
@@ -1157,7 +1246,7 @@ async function tryReuseCodexLiveThread(options) {
|
|
|
1157
1246
|
action: "resume",
|
|
1158
1247
|
binding,
|
|
1159
1248
|
...options.nativeModelInputTools ? { nativeModelInputTools: options.nativeModelInputTools } : {}
|
|
1160
|
-
});
|
|
1249
|
+
}, params.client);
|
|
1161
1250
|
throwIfAborted();
|
|
1162
1251
|
params.assertCurrent?.();
|
|
1163
1252
|
return {
|
|
@@ -1209,26 +1298,10 @@ async function tryReuseCodexLiveThread(options) {
|
|
|
1209
1298
|
const prebuiltFinalConfigPatch = await prepareCodexThreadFinalConfigPatch(params, options.nativeModelInputTools, binding);
|
|
1210
1299
|
const pluginAppsConfigPatch = pluginThreadConfig?.configPatch ?? (params.pluginThreadConfig?.enabled && binding.pluginAppPolicyContext ? buildCodexPluginAppsConfigPatchFromPolicyContext(binding.pluginAppPolicyContext) : void 0);
|
|
1211
1300
|
const resumeAuthProfileId = binding.connectionScope === "supervision" ? void 0 : params.params.authProfileId ?? binding.authProfileId;
|
|
1212
|
-
const resumeConfig =
|
|
1213
|
-
const resumeParams = lifecycleTiming.measureSync("warm-thread-resume-params", () =>
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
authProfileId: resumeAuthProfileId,
|
|
1217
|
-
model: startModelSelection.model,
|
|
1218
|
-
modelProvider: startModelProvider,
|
|
1219
|
-
preserveNativeModel: binding.preserveNativeModel === true,
|
|
1220
|
-
config: applyCodexNativeSkillIsolation(resumeConfig, nativeSkillIsolation),
|
|
1221
|
-
hostSystemAgentActive,
|
|
1222
|
-
restrictedToolSurfaceInheritedMcpServerNames
|
|
1223
|
-
}));
|
|
1224
|
-
assertCodexInferenceRouteConfig(params.client, params.inferenceRoute, resumeParams.config, resumeParams.modelProvider ?? (binding.preserveNativeModel ? nativeThread?.modelProvider?.trim() || binding.modelProvider : void 0), params.inferenceProviderRoutes);
|
|
1225
|
-
const liveThreadConfigFingerprint = incognito ? retainedThread.configFingerprint : fingerprintCodexThreadConfig({
|
|
1226
|
-
...resumeParams,
|
|
1227
|
-
model: binding.preserveNativeModel ? null : binding.model ?? resumeParams.model ?? null,
|
|
1228
|
-
requestedModel: binding.preserveNativeModel ? null : resumeParams.model ?? null,
|
|
1229
|
-
modelProvider: binding.preserveNativeModel ? null : binding.modelProvider ?? resumeParams.modelProvider ?? null,
|
|
1230
|
-
requestedModelProvider: binding.preserveNativeModel ? null : resumeParams.modelProvider ?? binding.modelProvider ?? null
|
|
1231
|
-
}, resumeAuthProfileId, dynamicToolsFingerprint);
|
|
1301
|
+
const resumeConfig = buildCodexThreadRequestConfig(params, options, pluginAppsConfigPatch, prebuiltFinalConfigPatch.configPatch);
|
|
1302
|
+
const resumeParams = lifecycleTiming.measureSync("warm-thread-resume-params", () => options.buildResumeParams(binding, resumeAuthProfileId, resumeConfig));
|
|
1303
|
+
options.assertInferenceConfig(resumeParams.config, resumeParams.modelProvider ?? (binding.preserveNativeModel ? nativeThread?.modelProvider?.trim() || binding.modelProvider : void 0));
|
|
1304
|
+
const liveThreadConfigFingerprint = incognito ? retainedThread.configFingerprint : fingerprintCodexThreadConfig(resumeParams, resumeAuthProfileId, dynamicToolsFingerprint, binding);
|
|
1232
1305
|
const ephemeralPolicy = retainedThread.ephemeralPolicy;
|
|
1233
1306
|
if (incognito && (!ephemeralPolicy || ephemeralPolicy.developerInstructions !== params.developerInstructions || getCodexInferenceThread(params.client, binding.threadId) !== params.inferenceRoute || [...params.inferenceProviderRoutes?.keys() ?? []].some((provider) => !getCodexInferenceThreadQualification(params.client, binding.threadId)?.hasProvider(provider)))) {
|
|
1234
1307
|
preserveSubscription = true;
|
|
@@ -1434,7 +1507,6 @@ async function preparePendingCodexThreadResume(params, binding, dynamicToolsFing
|
|
|
1434
1507
|
if (thread.id !== binding.threadId || !isCodexThreadNonRunning(thread.status)) throw fail("the native thread is not idle; wait for its current run to finish");
|
|
1435
1508
|
assertCodexThreadAcceptsDirectInput(thread);
|
|
1436
1509
|
const observation = observeCodexThreadConfiguration(params, thread, assertCurrent);
|
|
1437
|
-
const dispose = observation.dispose;
|
|
1438
1510
|
try {
|
|
1439
1511
|
const rolloutPath = thread.path ?? binding.rolloutPath;
|
|
1440
1512
|
const metadata = rolloutPath ? await readCodexSessionMeta(path.join(localHome, "sessions"), rolloutPath, binding.threadId) : void 0;
|
|
@@ -1447,7 +1519,7 @@ async function preparePendingCodexThreadResume(params, binding, dynamicToolsFing
|
|
|
1447
1519
|
assertCurrent
|
|
1448
1520
|
};
|
|
1449
1521
|
} catch (error) {
|
|
1450
|
-
dispose();
|
|
1522
|
+
observation.dispose();
|
|
1451
1523
|
throw error;
|
|
1452
1524
|
}
|
|
1453
1525
|
}
|
|
@@ -1509,16 +1581,11 @@ function withPendingSupervisionCleanup(pending, cleanupThreadIds) {
|
|
|
1509
1581
|
}
|
|
1510
1582
|
async function cleanPendingSupervisionArtifacts(client, pending) {
|
|
1511
1583
|
const remaining = [];
|
|
1512
|
-
for (const threadId of pending.cleanupThreadIds ?? [])
|
|
1513
|
-
return { remaining };
|
|
1514
|
-
}
|
|
1515
|
-
async function archiveSupervisionArtifact(client, threadId) {
|
|
1516
|
-
try {
|
|
1584
|
+
for (const threadId of pending.cleanupThreadIds ?? []) try {
|
|
1517
1585
|
await client.request("thread/archive", { threadId }, { timeoutMs: CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS });
|
|
1518
|
-
return true;
|
|
1519
1586
|
} catch (error) {
|
|
1520
1587
|
const message = formatErrorMessage(error).toLowerCase();
|
|
1521
|
-
if (message.includes("no rollout found for thread id") || message.includes("thread not found") || message.includes("already archived"))
|
|
1588
|
+
if (message.includes("no rollout found for thread id") || message.includes("thread not found") || message.includes("already archived")) continue;
|
|
1522
1589
|
await unsubscribeCodexThreadBestEffort(client, {
|
|
1523
1590
|
threadId,
|
|
1524
1591
|
timeoutMs: CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS
|
|
@@ -1527,8 +1594,9 @@ async function archiveSupervisionArtifact(client, threadId) {
|
|
|
1527
1594
|
threadId,
|
|
1528
1595
|
error
|
|
1529
1596
|
});
|
|
1530
|
-
|
|
1597
|
+
remaining.push(threadId);
|
|
1531
1598
|
}
|
|
1599
|
+
return remaining;
|
|
1532
1600
|
}
|
|
1533
1601
|
//#endregion
|
|
1534
1602
|
//#region extensions/codex/src/app-server/thread-supervision.ts
|
|
@@ -1539,6 +1607,15 @@ async function materializePendingSupervisionBranch(params) {
|
|
|
1539
1607
|
assertCurrent: params.throwIfAborted,
|
|
1540
1608
|
withCurrent: params.authority?.withCurrent
|
|
1541
1609
|
};
|
|
1610
|
+
const requestCreatedThread = (kind, request) => params.lifecycleTiming.measure(kind === "probe" ? "supervision-model-probe-fork" : "supervision-thread-start", async () => {
|
|
1611
|
+
try {
|
|
1612
|
+
return await request();
|
|
1613
|
+
} catch (error) {
|
|
1614
|
+
if (error instanceof CodexAppServerRpcError) throw kind === "probe" ? error : new CodexThreadStartRequestError(error);
|
|
1615
|
+
throw new CodexAppServerUnsafeSubscriptionError(kind === "probe" ? "Codex model test fork may have materialized without a response" : "Canonical Codex branch may have started without a response", { cause: error });
|
|
1616
|
+
}
|
|
1617
|
+
});
|
|
1618
|
+
const attestRestrictedToolSurface = (threadId, config) => params.lifecycleTiming.measure("restricted-tool-surface-mcp-attestation", () => attestCodexRestrictedToolSurfaceMcpServersDisabled(params.client, threadId, config ?? void 0, params.signal));
|
|
1542
1619
|
const connectionFingerprint = buildCodexAppServerConnectionFingerprint(params.appServer, params.attempt.agentDir);
|
|
1543
1620
|
if (!pending.connectionFingerprint || pending.connectionFingerprint !== connectionFingerprint) throw new Error("Codex supervision source connection changed before branch materialization");
|
|
1544
1621
|
pending = await recoverPendingSupervisionArtifacts(params, pending);
|
|
@@ -1550,7 +1627,7 @@ async function materializePendingSupervisionBranch(params) {
|
|
|
1550
1627
|
params.throwIfAborted();
|
|
1551
1628
|
const sourceThread = sourceResponse.thread;
|
|
1552
1629
|
if (sourceThread.id !== pending.sourceThreadId) throw new Error(`Codex supervision source read returned ${sourceThread.id} for ${pending.sourceThreadId}`);
|
|
1553
|
-
|
|
1630
|
+
if (!pending.lastTurnId && (sourceThread.status?.type === "active" || (sourceThread.turns?.length ?? 0) > 0)) throw new Error("Codex source changed after Continue; reopen the source session before sending a message");
|
|
1554
1631
|
const history = projectBoundedCodexThreadHistory({
|
|
1555
1632
|
thread: sourceThread,
|
|
1556
1633
|
throughTurnId: pending.lastTurnId ?? null,
|
|
@@ -1587,35 +1664,27 @@ async function materializePendingSupervisionBranch(params) {
|
|
|
1587
1664
|
};
|
|
1588
1665
|
try {
|
|
1589
1666
|
const probeParams = buildPendingSupervisionProbeForkParams(params, pending);
|
|
1590
|
-
const rawProbeResponse = await params.
|
|
1591
|
-
try {
|
|
1592
|
-
return await params.client.request("thread/fork", probeParams, requestOptions);
|
|
1593
|
-
} catch (error) {
|
|
1594
|
-
if (!(error instanceof CodexAppServerRpcError)) throw new CodexAppServerUnsafeSubscriptionError("Codex model probe fork may have materialized without a response", { cause: error });
|
|
1595
|
-
throw error;
|
|
1596
|
-
}
|
|
1597
|
-
});
|
|
1667
|
+
const rawProbeResponse = await requestCreatedThread("probe", () => params.client.request("thread/fork", probeParams, requestOptions));
|
|
1598
1668
|
const probeThreadId = requireDistinctSupervisionThreadId({
|
|
1599
1669
|
threadId: readSupervisionResponseThreadId(rawProbeResponse),
|
|
1600
1670
|
sourceThreadId: pending.sourceThreadId,
|
|
1601
|
-
role: "model
|
|
1671
|
+
role: "model test"
|
|
1602
1672
|
});
|
|
1603
1673
|
let probeResponse;
|
|
1604
1674
|
try {
|
|
1605
1675
|
params.throwIfAborted();
|
|
1606
1676
|
probeResponse = assertCodexThreadForkResponse(rawProbeResponse);
|
|
1607
|
-
if (params.restrictedToolSurface) await
|
|
1677
|
+
if (params.restrictedToolSurface) await attestRestrictedToolSurface(probeThreadId, probeParams.config);
|
|
1608
1678
|
} finally {
|
|
1609
1679
|
await unsubscribeCodexAppServerLiveThread(params.client, probeThreadId, CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS).catch((cause) => {
|
|
1610
|
-
throw new CodexAppServerUnsafeSubscriptionError(`Codex model
|
|
1680
|
+
throw new CodexAppServerUnsafeSubscriptionError(`Codex model test subscription could not be released: ${probeThreadId}`, { cause });
|
|
1611
1681
|
});
|
|
1612
1682
|
}
|
|
1613
1683
|
params.throwIfAborted();
|
|
1614
1684
|
const nativeModel = requireNonBlankSupervisionValue(probeResponse.model, "native model");
|
|
1615
|
-
const nativeModelProvider =
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
});
|
|
1685
|
+
const nativeModelProvider = requireNonBlankSupervisionValue(probeResponse.modelProvider, "native model provider");
|
|
1686
|
+
const threadProvider = probeResponse.thread.modelProvider?.trim();
|
|
1687
|
+
if (threadProvider && threadProvider !== nativeModelProvider) throw new Error(`Codex supervision model provider mismatch: ${nativeModelProvider} != ${threadProvider}`);
|
|
1619
1688
|
const nativeAttempt = {
|
|
1620
1689
|
...params.attempt,
|
|
1621
1690
|
modelId: nativeModel
|
|
@@ -1630,14 +1699,7 @@ async function materializePendingSupervisionBranch(params) {
|
|
|
1630
1699
|
modelProvider: nativeModelProvider,
|
|
1631
1700
|
operation: "thread/start request"
|
|
1632
1701
|
});
|
|
1633
|
-
const rawStartResponse = await params.
|
|
1634
|
-
try {
|
|
1635
|
-
return await params.client.request("thread/start", startParams, requestOptions);
|
|
1636
|
-
} catch (error) {
|
|
1637
|
-
if (error instanceof CodexAppServerRpcError) throw new CodexThreadStartRequestError(error);
|
|
1638
|
-
throw new CodexAppServerUnsafeSubscriptionError("Canonical Codex branch may have started without a response", { cause: error });
|
|
1639
|
-
}
|
|
1640
|
-
});
|
|
1702
|
+
const rawStartResponse = await requestCreatedThread("canonical", () => params.client.request("thread/start", startParams, requestOptions));
|
|
1641
1703
|
const finalThreadId = requireDistinctSupervisionThreadId({
|
|
1642
1704
|
threadId: readSupervisionResponseThreadId(rawStartResponse),
|
|
1643
1705
|
sourceThreadId: pending.sourceThreadId,
|
|
@@ -1652,7 +1714,7 @@ async function materializePendingSupervisionBranch(params) {
|
|
|
1652
1714
|
modelProvider: nativeModelProvider,
|
|
1653
1715
|
operation: "thread/start response"
|
|
1654
1716
|
});
|
|
1655
|
-
if (params.restrictedToolSurface) await
|
|
1717
|
+
if (params.restrictedToolSurface) await attestRestrictedToolSurface(finalThreadId, startParams.config);
|
|
1656
1718
|
if (params.provisionalAppIds?.length) try {
|
|
1657
1719
|
await params.lifecycleTiming.measure("plugin-app-attestation", () => checkCodexThreadAppAvailability({
|
|
1658
1720
|
client: params.client,
|
|
@@ -1702,14 +1764,7 @@ async function materializePendingSupervisionBranch(params) {
|
|
|
1702
1764
|
provisionalCleanupSafe = false;
|
|
1703
1765
|
throw new CodexAppServerUnsafeSubscriptionError(`Canonical Codex branch binding could not be verified: ${finalThreadId}`, { cause: new AggregateError([error, readError]) });
|
|
1704
1766
|
}
|
|
1705
|
-
if (
|
|
1706
|
-
sourceThreadId: pending.sourceThreadId,
|
|
1707
|
-
connectionFingerprint,
|
|
1708
|
-
threadId: finalThreadId,
|
|
1709
|
-
model: nativeModel,
|
|
1710
|
-
modelProvider: bindingModelProvider,
|
|
1711
|
-
historyCoveredThrough
|
|
1712
|
-
})) committed = true;
|
|
1767
|
+
if (current?.threadId === finalThreadId && current.connectionScope === "supervision" && current.supervisionSourceThreadId === pending.sourceThreadId && current.appServerRuntimeFingerprint === connectionFingerprint && current.pendingSupervisionBranch === void 0 && current.model === nativeModel && current.modelProvider === bindingModelProvider && current.historyCoveredThrough === historyCoveredThrough) committed = true;
|
|
1713
1768
|
else {
|
|
1714
1769
|
if (!matchesPendingSupervisionState(current, pending)) {
|
|
1715
1770
|
provisionalCleanupSafe = false;
|
|
@@ -1744,8 +1799,8 @@ async function materializePendingSupervisionBranch(params) {
|
|
|
1744
1799
|
await params.abandonClient();
|
|
1745
1800
|
throw error;
|
|
1746
1801
|
}
|
|
1747
|
-
const
|
|
1748
|
-
const nextPending = withPendingSupervisionCleanup(pending,
|
|
1802
|
+
const remaining = await cleanPendingSupervisionArtifacts(params.client, pending);
|
|
1803
|
+
const nextPending = withPendingSupervisionCleanup(pending, remaining);
|
|
1749
1804
|
let cleanupStateError;
|
|
1750
1805
|
if (cleanupExpected && !isDeepStrictEqual(cleanupExpected, nextPending)) try {
|
|
1751
1806
|
await params.bindingStore.mutate(params.bindingIdentity, {
|
|
@@ -1756,14 +1811,14 @@ async function materializePendingSupervisionBranch(params) {
|
|
|
1756
1811
|
} catch (stateError) {
|
|
1757
1812
|
cleanupStateError = stateError;
|
|
1758
1813
|
}
|
|
1759
|
-
const unsafeCleanup =
|
|
1814
|
+
const unsafeCleanup = remaining.length > 0 || error instanceof CodexAppServerUnsafeSubscriptionError;
|
|
1760
1815
|
if (unsafeCleanup) await params.abandonClient();
|
|
1761
1816
|
if (cleanupStateError) {
|
|
1762
1817
|
const cause = new AggregateError([error, cleanupStateError], "Codex supervised branch cleanup state could not be recorded", { cause: error });
|
|
1763
1818
|
if (unsafeCleanup) throw new CodexAppServerUnsafeSubscriptionError("Codex supervised branch cleanup state could not be recorded", { cause });
|
|
1764
1819
|
throw cause;
|
|
1765
1820
|
}
|
|
1766
|
-
if (
|
|
1821
|
+
if (remaining.length > 0) throw new CodexAppServerUnsafeSubscriptionError(`Codex supervised branch cleanup remains pending: ${remaining.join(", ")}`, { cause: error });
|
|
1767
1822
|
throw error;
|
|
1768
1823
|
}
|
|
1769
1824
|
}
|
|
@@ -1778,32 +1833,22 @@ function buildPendingSupervisionProbeForkParams(params, pending) {
|
|
|
1778
1833
|
...codexThreadSandboxOrPermissions(params.appServer),
|
|
1779
1834
|
...params.appServer.serviceTier !== void 0 ? { serviceTier: params.appServer.serviceTier } : {},
|
|
1780
1835
|
config: runtimeConfig,
|
|
1781
|
-
developerInstructions: params.developerInstructions ?? buildDeveloperInstructions(params.attempt, {
|
|
1836
|
+
developerInstructions: params.developerInstructions ?? buildDeveloperInstructions(params.attempt, {
|
|
1837
|
+
dynamicTools: params.dynamicTools,
|
|
1838
|
+
nativeCodeModeOnlyEnabled: runtimeConfig["features.code_mode_only"] === true
|
|
1839
|
+
}),
|
|
1782
1840
|
ephemeral: true,
|
|
1783
1841
|
threadSource: "appServer",
|
|
1784
1842
|
excludeTurns: true
|
|
1785
1843
|
};
|
|
1786
1844
|
}
|
|
1787
|
-
function assertPendingSupervisionSnapshotUnchanged(thread, pending) {
|
|
1788
|
-
if (pending.lastTurnId) return;
|
|
1789
|
-
if (thread.status?.type === "active" || (thread.turns?.length ?? 0) > 0) throw new Error("Codex source changed after Continue; reopen the source session before sending a message");
|
|
1790
|
-
}
|
|
1791
1845
|
function requireNonBlankSupervisionValue(value, label) {
|
|
1792
1846
|
if (typeof value !== "string" || !value.trim()) throw new Error(`Codex supervision ${label} is missing`);
|
|
1793
1847
|
return value.trim();
|
|
1794
1848
|
}
|
|
1795
|
-
function requireNativeSupervisionModelProvider(params) {
|
|
1796
|
-
const responseProvider = requireNonBlankSupervisionValue(params.responseModelProvider, "native model provider");
|
|
1797
|
-
const threadProvider = params.responseThreadModelProvider?.trim();
|
|
1798
|
-
if (threadProvider && threadProvider !== responseProvider) throw new Error(`Codex supervision model provider mismatch: ${responseProvider} != ${threadProvider}`);
|
|
1799
|
-
return responseProvider;
|
|
1800
|
-
}
|
|
1801
1849
|
function matchesPendingSupervisionState(binding, expected) {
|
|
1802
1850
|
return binding?.connectionScope === "supervision" && binding.supervisionSourceThreadId === expected.sourceThreadId && matchesPendingSupervisionBranch(binding, expected);
|
|
1803
1851
|
}
|
|
1804
|
-
function matchesMaterializedSupervisionBranch(binding, expected) {
|
|
1805
|
-
return binding?.threadId === expected.threadId && binding.connectionScope === "supervision" && binding.supervisionSourceThreadId === expected.sourceThreadId && binding.appServerRuntimeFingerprint === expected.connectionFingerprint && binding.pendingSupervisionBranch === void 0 && binding.model === expected.model && binding.modelProvider === expected.modelProvider && binding.historyCoveredThrough === expected.historyCoveredThrough;
|
|
1806
|
-
}
|
|
1807
1852
|
function requireDistinctSupervisionThreadId(params) {
|
|
1808
1853
|
let threadId;
|
|
1809
1854
|
try {
|
|
@@ -1816,17 +1861,17 @@ function requireDistinctSupervisionThreadId(params) {
|
|
|
1816
1861
|
}
|
|
1817
1862
|
async function recoverPendingSupervisionArtifacts(params, pending) {
|
|
1818
1863
|
if (!pending.cleanupThreadIds?.length) return pending;
|
|
1819
|
-
const
|
|
1820
|
-
const next = withPendingSupervisionCleanup(pending,
|
|
1821
|
-
const incomplete =
|
|
1822
|
-
if (!incomplete ||
|
|
1864
|
+
const remaining = await cleanPendingSupervisionArtifacts(params.client, pending);
|
|
1865
|
+
const next = withPendingSupervisionCleanup(pending, remaining);
|
|
1866
|
+
const incomplete = remaining.length > 0;
|
|
1867
|
+
if (!incomplete || remaining.length !== pending.cleanupThreadIds.length) {
|
|
1823
1868
|
if (!await params.bindingStore.mutate(params.bindingIdentity, {
|
|
1824
1869
|
kind: "patch-pending-supervision-branch",
|
|
1825
1870
|
expected: pending,
|
|
1826
1871
|
pending: next
|
|
1827
1872
|
})) throw new CodexThreadBindingConflictError(pending.sourceThreadId, incomplete ? "recording supervised Codex cleanup recovery" : "recovering a supervised Codex branch");
|
|
1828
1873
|
}
|
|
1829
|
-
if (incomplete) throw new Error(`Codex supervised branch cleanup must finish before retry: ${
|
|
1874
|
+
if (incomplete) throw new Error(`Codex supervised branch cleanup must finish before retry: ${remaining.join(", ")}`);
|
|
1830
1875
|
return next;
|
|
1831
1876
|
}
|
|
1832
1877
|
//#endregion
|
|
@@ -1860,7 +1905,7 @@ async function startOrResumeThread(input) {
|
|
|
1860
1905
|
}
|
|
1861
1906
|
const preflight = await prepareCodexThreadLifecyclePreflight(params);
|
|
1862
1907
|
const callerConfig = params.config;
|
|
1863
|
-
const { contextEngineBinding, dynamicToolsContainDeferred, dynamicToolsFingerprint, hostSystemAgentActive, legacyDynamicToolsFingerprint, legacyUserMcpServersFingerprint, lifecycleTiming,
|
|
1908
|
+
const { contextEngineBinding, dynamicToolsContainDeferred, dynamicToolsFingerprint, hostSystemAgentActive, legacyDynamicToolsFingerprint, legacyUserMcpServersFingerprint, lifecycleTiming, nativeSkillIsolationFingerprint, networkProxyConfigFingerprint, ringZeroActive, ringZeroClientInstanceId, ringZeroConfigFingerprint, restrictedToolSurface, restrictedToolSurfaceInheritedMcpServerNames, userMcpServersFingerprint, webSearchThreadConfigFingerprint } = preflight;
|
|
1864
1909
|
let replacementPredecessor;
|
|
1865
1910
|
const initialBoundThreadId = binding?.threadId;
|
|
1866
1911
|
const initialBoundClientId = binding?.clientId;
|
|
@@ -1887,7 +1932,8 @@ async function startOrResumeThread(input) {
|
|
|
1887
1932
|
lifecycleTiming,
|
|
1888
1933
|
threadId,
|
|
1889
1934
|
assertCurrent,
|
|
1890
|
-
withCurrent: authority.withCurrent
|
|
1935
|
+
withCurrent: authority.withCurrent,
|
|
1936
|
+
signal: params.signal
|
|
1891
1937
|
});
|
|
1892
1938
|
if (binding?.pendingSupervisionBranch) {
|
|
1893
1939
|
const requestContext = await prepareRequestContext();
|
|
@@ -1895,37 +1941,22 @@ async function startOrResumeThread(input) {
|
|
|
1895
1941
|
const pendingBinding = binding;
|
|
1896
1942
|
const pluginThreadConfig = params.pluginThreadConfig?.enabled ? await lifecycleTiming.measure("plugin-config-build", () => params.pluginThreadConfig?.build()) : void 0;
|
|
1897
1943
|
const finalConfigPatch = await prepareCodexThreadFinalConfigPatch(params, requestContext.nativeModelInputTools);
|
|
1898
|
-
const config = lifecycleTiming.measureSync("merge-thread-config", () =>
|
|
1944
|
+
const config = lifecycleTiming.measureSync("merge-thread-config", () => buildCodexThreadRequestConfig(params, preflight, pluginThreadConfig?.configPatch, finalConfigPatch.configPatch));
|
|
1899
1945
|
return publishCodexThreadInferenceBinding(params, await materializePendingSupervisionBranch({
|
|
1900
|
-
|
|
1946
|
+
...params,
|
|
1901
1947
|
abandonClient: params.abandonClient ?? (() => closeCodexStartupClientBestEffort(params.client)),
|
|
1902
|
-
bindingStore: params.bindingStore,
|
|
1903
1948
|
bindingIdentity,
|
|
1904
1949
|
authority,
|
|
1905
1950
|
binding: pendingBinding,
|
|
1906
1951
|
attempt: params.params,
|
|
1907
|
-
cwd: params.cwd,
|
|
1908
|
-
dynamicTools: params.dynamicTools,
|
|
1909
|
-
appServer: params.appServer,
|
|
1910
|
-
developerInstructions: params.developerInstructions,
|
|
1911
|
-
refreshableInstructions: params.refreshableInstructions,
|
|
1912
1952
|
config,
|
|
1913
|
-
nativeCodeModeEnabled: params.nativeCodeModeEnabled,
|
|
1914
|
-
nativeProviderWebSearchSupport: params.nativeProviderWebSearchSupport,
|
|
1915
|
-
nativeCodeModeOnlyEnabled: params.nativeCodeModeOnlyEnabled,
|
|
1916
|
-
webSearchAllowed: params.webSearchAllowed,
|
|
1917
1953
|
hostSystemAgentActive,
|
|
1918
1954
|
restrictedToolSurface,
|
|
1919
1955
|
restrictedToolSurfaceInheritedMcpServerNames,
|
|
1920
|
-
shellEnvironment: params.shellEnvironment,
|
|
1921
|
-
shellPathPrepend: params.shellPathPrepend,
|
|
1922
|
-
disableLoginShell: params.disableLoginShell,
|
|
1923
|
-
environmentSelection: params.environmentSelection,
|
|
1924
1956
|
provisionalAppIds: pluginThreadConfig?.provisionalAppIds,
|
|
1925
|
-
signal: params.signal,
|
|
1926
1957
|
throwIfAborted: () => {
|
|
1927
1958
|
params.assertCurrent?.();
|
|
1928
|
-
|
|
1959
|
+
requestContext.assertInferenceConfig(config);
|
|
1929
1960
|
},
|
|
1930
1961
|
lifecycleTiming,
|
|
1931
1962
|
normalizeBindingModelProvider: requestContext.normalizeBindingModelProvider,
|
|
@@ -1973,30 +2004,30 @@ async function startOrResumeThread(input) {
|
|
|
1973
2004
|
releaseRetainedThread: (threadId, assertCurrent) => releaseRetainedThread(threadId, initialBoundClientId, assertCurrent),
|
|
1974
2005
|
transientRestriction: transientDelegationRestriction || transientNativeToolRestriction || transientWebSearchRestriction
|
|
1975
2006
|
}));
|
|
1976
|
-
if (binding?.threadId
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
binding:
|
|
1989
|
-
|
|
1990
|
-
if (binding?.threadId && shouldRotateCodexGpt56MultiAgentBinding({
|
|
1991
|
-
bindingModel: binding.model,
|
|
1992
|
-
requestedModel: params.params.modelId
|
|
1993
|
-
})) {
|
|
1994
|
-
embeddedAgentLog.debug("codex app-server GPT-5.6 multi-agent version changed; starting a new thread", {
|
|
1995
|
-
threadId: binding.threadId,
|
|
2007
|
+
if (binding?.threadId) {
|
|
2008
|
+
if (!restrictedToolSurface && binding.nativeToolPolicyRestricted === true) stageBindingReplacement("rotating a host-policy-restricted thread binding");
|
|
2009
|
+
else if (binding.nativeSkillIsolationFingerprint !== nativeSkillIsolationFingerprint) {
|
|
2010
|
+
embeddedAgentLog.debug("codex app-server native skill isolation changed; starting a new thread", { threadId: binding.threadId });
|
|
2011
|
+
stageBindingReplacement("rotating stale native skill isolation");
|
|
2012
|
+
} else if ((binding.ringZeroConfigFingerprint !== ringZeroConfigFingerprint || binding.ringZeroClientInstanceId !== ringZeroClientInstanceId) && (ringZeroActive || binding.ringZeroConfigFingerprint !== void 0)) {
|
|
2013
|
+
embeddedAgentLog.debug("codex app-server ring-zero restriction changed; rotating thread", { threadId: binding.threadId });
|
|
2014
|
+
stageBindingReplacement("rotating a ring-zero thread binding");
|
|
2015
|
+
} else if (shouldRotateCodexAppServerBindingForRuntime({
|
|
2016
|
+
connectionClass: params.appServer.connectionClass,
|
|
2017
|
+
current: binding.connectionScope === "supervision" ? buildCodexAppServerConnectionFingerprint(params.appServer, params.params.agentDir) : params.appServerRuntimeFingerprint,
|
|
2018
|
+
binding: binding.appServerRuntimeFingerprint
|
|
2019
|
+
})) rotateStaleBinding(binding, "runtime identity", { connectionClass: params.appServer.connectionClass });
|
|
2020
|
+
else if (shouldRotateCodexGpt56MultiAgentBinding({
|
|
1996
2021
|
bindingModel: binding.model,
|
|
1997
2022
|
requestedModel: params.params.modelId
|
|
1998
|
-
})
|
|
1999
|
-
|
|
2023
|
+
})) {
|
|
2024
|
+
embeddedAgentLog.debug("codex app-server GPT-5.6 multi-agent version changed; starting a new thread", {
|
|
2025
|
+
threadId: binding.threadId,
|
|
2026
|
+
bindingModel: binding.model,
|
|
2027
|
+
requestedModel: params.params.modelId
|
|
2028
|
+
});
|
|
2029
|
+
stageBindingReplacement("rotating a GPT-5.6 multi-agent thread binding");
|
|
2030
|
+
}
|
|
2000
2031
|
}
|
|
2001
2032
|
selectionBinding = binding;
|
|
2002
2033
|
let preserveExistingBinding = transientDelegationRestriction || !ringZeroActive && params.nativeProviderWebSearchSupport === "unknown" && !binding?.threadId;
|
|
@@ -2074,23 +2105,21 @@ async function startOrResumeThread(input) {
|
|
|
2074
2105
|
rotatedContextEngineBinding = true;
|
|
2075
2106
|
}
|
|
2076
2107
|
}
|
|
2077
|
-
if (binding?.threadId && !areUserMcpServersFingerprintsCompatible({
|
|
2078
|
-
previous: binding.userMcpServersFingerprint,
|
|
2079
|
-
next: userMcpServersFingerprint,
|
|
2080
|
-
nextLegacy: legacyUserMcpServersFingerprint
|
|
2081
|
-
})) rotateStaleBinding(binding, "user MCP config");
|
|
2082
|
-
if (binding?.threadId && (binding.networkProxyConfigFingerprint !== networkProxyConfigFingerprint || binding.networkProxyProfileName !== params.appServer.networkProxy?.profileName)) rotateStaleBinding(binding, "network proxy config");
|
|
2083
2108
|
if (binding?.threadId) {
|
|
2084
|
-
if (
|
|
2109
|
+
if (!areUserMcpServersFingerprintsCompatible({
|
|
2110
|
+
previous: binding.userMcpServersFingerprint,
|
|
2111
|
+
next: userMcpServersFingerprint,
|
|
2112
|
+
nextLegacy: legacyUserMcpServersFingerprint
|
|
2113
|
+
})) rotateStaleBinding(binding, "user MCP config");
|
|
2114
|
+
else if (binding.networkProxyConfigFingerprint !== networkProxyConfigFingerprint || binding.networkProxyProfileName !== params.appServer.networkProxy?.profileName) rotateStaleBinding(binding, "network proxy config");
|
|
2115
|
+
else if (isCodexPluginThreadBindingStale({
|
|
2085
2116
|
codexPluginsEnabled: params.pluginThreadConfig?.enabled ?? false,
|
|
2086
2117
|
bindingFingerprint: binding.pluginAppsFingerprint,
|
|
2087
2118
|
bindingInputFingerprint: binding.pluginAppsInputFingerprint,
|
|
2088
2119
|
currentInputFingerprint: params.pluginThreadConfig?.inputFingerprint,
|
|
2089
2120
|
hasBindingPolicyContext: Boolean(binding.pluginAppPolicyContext)
|
|
2090
2121
|
})) rotateStaleBinding(binding, "plugin app config");
|
|
2091
|
-
|
|
2092
|
-
if (binding?.threadId) {
|
|
2093
|
-
if (binding.dynamicToolsFingerprint && params.dynamicTools.length > 0 && binding.dynamicToolsContainDeferred !== dynamicToolsContainDeferred && (binding.dynamicToolsContainDeferred !== void 0 || !dynamicToolsContainDeferred)) rotateStaleBinding(binding, "dynamic tool loading");
|
|
2122
|
+
else if (binding.dynamicToolsFingerprint && params.dynamicTools.length > 0 && binding.dynamicToolsContainDeferred !== dynamicToolsContainDeferred && (binding.dynamicToolsContainDeferred !== void 0 || !dynamicToolsContainDeferred)) rotateStaleBinding(binding, "dynamic tool loading");
|
|
2094
2123
|
}
|
|
2095
2124
|
if (binding?.threadId) {
|
|
2096
2125
|
if (binding.dynamicToolsFingerprint && !areCodexDynamicToolFingerprintsCompatible({
|
|
@@ -2151,169 +2180,4 @@ async function startOrResumeThread(input) {
|
|
|
2151
2180
|
});
|
|
2152
2181
|
}
|
|
2153
2182
|
//#endregion
|
|
2154
|
-
|
|
2155
|
-
function prependHistoryProvenance(input, historyProvenancePrefix) {
|
|
2156
|
-
if (!historyProvenancePrefix) return input;
|
|
2157
|
-
const firstTextIndex = input.findIndex((item) => item.type === "text");
|
|
2158
|
-
if (firstTextIndex === -1) return [{
|
|
2159
|
-
type: "text",
|
|
2160
|
-
text: historyProvenancePrefix,
|
|
2161
|
-
text_elements: []
|
|
2162
|
-
}, ...input];
|
|
2163
|
-
return input.map((item, index) => index === firstTextIndex && item.type === "text" ? {
|
|
2164
|
-
...item,
|
|
2165
|
-
text: `${historyProvenancePrefix}${item.text}`
|
|
2166
|
-
} : item);
|
|
2167
|
-
}
|
|
2168
|
-
/** Builds ordered Codex user input for both new turns and same-turn steering. */
|
|
2169
|
-
function buildCodexUserInput(text, images, contextImageGroups, historyProvenancePrefix) {
|
|
2170
|
-
if (text !== void 0 && contextImageGroups?.length) {
|
|
2171
|
-
let offset = 0;
|
|
2172
|
-
return prependHistoryProvenance([...contextImageGroups.flatMap((group) => {
|
|
2173
|
-
const parts = buildCodexUserInput(text.slice(offset, group.end), group.images);
|
|
2174
|
-
offset = group.end;
|
|
2175
|
-
return parts;
|
|
2176
|
-
}), ...buildCodexUserInput(text.slice(offset), images)], historyProvenancePrefix);
|
|
2177
|
-
}
|
|
2178
|
-
const imageInputs = (images ?? []).map((image) => {
|
|
2179
|
-
const imageUrl = sanitizeInlineImageDataUrl(`data:${image.mimeType};base64,${image.data}`);
|
|
2180
|
-
return imageUrl ? {
|
|
2181
|
-
type: "image",
|
|
2182
|
-
url: imageUrl
|
|
2183
|
-
} : {
|
|
2184
|
-
type: "text",
|
|
2185
|
-
text: invalidInlineImageText("codex user input"),
|
|
2186
|
-
text_elements: []
|
|
2187
|
-
};
|
|
2188
|
-
});
|
|
2189
|
-
return prependHistoryProvenance([...text === void 0 ? [] : [{
|
|
2190
|
-
type: "text",
|
|
2191
|
-
text,
|
|
2192
|
-
text_elements: []
|
|
2193
|
-
}], ...imageInputs], historyProvenancePrefix);
|
|
2194
|
-
}
|
|
2195
|
-
//#endregion
|
|
2196
|
-
//#region extensions/codex/src/app-server/turn-params.ts
|
|
2197
|
-
const CODEX_CURRENT_SENDER_FIELD_MAX_CHARS = 256;
|
|
2198
|
-
function readCodexCurrentSender(params) {
|
|
2199
|
-
const metadata = asOptionalRecord(asOptionalRecord(params.userTurnTranscriptRecorder?.message)?.["__openclaw"]);
|
|
2200
|
-
const recorded = [
|
|
2201
|
-
normalizeOptionalString(metadata?.["senderId"]),
|
|
2202
|
-
normalizeOptionalString(metadata?.["senderName"]),
|
|
2203
|
-
normalizeOptionalString(metadata?.["senderUsername"])
|
|
2204
|
-
];
|
|
2205
|
-
const [id, name, username] = recorded.some(Boolean) ? recorded : [
|
|
2206
|
-
normalizeOptionalString(params.senderId),
|
|
2207
|
-
normalizeOptionalString(params.senderName),
|
|
2208
|
-
normalizeOptionalString(params.senderUsername)
|
|
2209
|
-
];
|
|
2210
|
-
if (!id && !name && !username) return;
|
|
2211
|
-
const bound = (value) => truncateUtf16Safe(value, CODEX_CURRENT_SENDER_FIELD_MAX_CHARS);
|
|
2212
|
-
return {
|
|
2213
|
-
...id ? { id: bound(id) } : {},
|
|
2214
|
-
...name ? { name: bound(name) } : {},
|
|
2215
|
-
...username ? { username: bound(username) } : {}
|
|
2216
|
-
};
|
|
2217
|
-
}
|
|
2218
|
-
function buildCodexHistoryProvenancePrefix(params) {
|
|
2219
|
-
const sender = readCodexCurrentSender(params);
|
|
2220
|
-
return sender?.id ? neutralizeCodexExplicitMentionSigils(`[OpenClaw conversation info: sender=${JSON.stringify(sender)}]\n`) : void 0;
|
|
2221
|
-
}
|
|
2222
|
-
function buildTurnStartParams(params, options) {
|
|
2223
|
-
const modelSelection = options.preserveNativeTurnSettings ? void 0 : resolveCodexAppServerRequestModelSelection({
|
|
2224
|
-
homeScope: options.appServer.start.homeScope,
|
|
2225
|
-
model: options.model ?? params.modelId,
|
|
2226
|
-
modelProvider: options.modelProvider,
|
|
2227
|
-
authProfileId: params.authProfileId,
|
|
2228
|
-
authProfileStore: params.authProfileStore,
|
|
2229
|
-
agentDir: params.agentDir,
|
|
2230
|
-
config: params.config
|
|
2231
|
-
});
|
|
2232
|
-
const collaborationMode = modelSelection ? buildTurnCollaborationMode(params, { model: modelSelection.model }) : void 0;
|
|
2233
|
-
if (collaborationMode && options.parentLocalEgress) collaborationMode.settings.developer_instructions = null;
|
|
2234
|
-
const useThreadPermissionProfile = options.appServer.networkProxy && !options.sandboxPolicy;
|
|
2235
|
-
const currentSender = params.trigger === "user" ? readCodexCurrentSender(params) : void 0;
|
|
2236
|
-
const additionalContext = {
|
|
2237
|
-
...buildCodexTemporalAdditionalContext(params, { sessionStatusAvailable: options.sessionStatusAvailable === true }),
|
|
2238
|
-
openclaw_active_computer: {
|
|
2239
|
-
kind: "application",
|
|
2240
|
-
value: params.hostCapabilities.activeComputerContext?.() ?? "Current active computer: active_node=unknown (host presence unavailable)"
|
|
2241
|
-
},
|
|
2242
|
-
openclaw_source_delivery: {
|
|
2243
|
-
kind: "application",
|
|
2244
|
-
value: ["Current source-delivery policy for this turn (replaces earlier source-delivery guidance):", buildHarnessVisibleReplyGuidance({
|
|
2245
|
-
sourceReplyDeliveryMode: params.sourceReplyDeliveryMode,
|
|
2246
|
-
messageToolAvailable: options.messageToolAvailable === true,
|
|
2247
|
-
requireExplicitMessageTarget: options.requireExplicitMessageTarget
|
|
2248
|
-
})].join("\n")
|
|
2249
|
-
}
|
|
2250
|
-
};
|
|
2251
|
-
if (currentSender) additionalContext.openclaw_current_sender = {
|
|
2252
|
-
kind: "untrusted",
|
|
2253
|
-
value: JSON.stringify({ sender: currentSender })
|
|
2254
|
-
};
|
|
2255
|
-
if (params.permissionChange?.notice) additionalContext.openclaw_permission_change = {
|
|
2256
|
-
kind: "application",
|
|
2257
|
-
value: params.permissionChange.notice
|
|
2258
|
-
};
|
|
2259
|
-
return {
|
|
2260
|
-
threadId: options.threadId,
|
|
2261
|
-
...params.trigger ? { turnTrigger: params.trigger } : {},
|
|
2262
|
-
input: [...buildCodexUserInput(options.promptText ?? params.prompt, params.images, options.contextImageGroups, options.historyProvenancePrefix ?? (params.trigger === "user" ? buildCodexHistoryProvenancePrefix(params) : void 0)), ...options.explicitSkillInputs ?? []],
|
|
2263
|
-
additionalContext,
|
|
2264
|
-
cwd: options.cwd,
|
|
2265
|
-
...options.appServer.sessionRoot ? { runtimeWorkspaceRoots: [options.appServer.sessionRoot] } : {},
|
|
2266
|
-
approvalPolicy: options.appServer.approvalPolicy,
|
|
2267
|
-
approvalsReviewer: options.appServer.approvalsReviewer,
|
|
2268
|
-
...useThreadPermissionProfile ? {} : { sandboxPolicy: options.sandboxPolicy ?? codexSandboxPolicyForTurn(options.appServer.sandbox, options.appServer.sessionRoot ?? options.cwd, options.appServer.start?.args) },
|
|
2269
|
-
...modelSelection ? {
|
|
2270
|
-
model: modelSelection.model,
|
|
2271
|
-
personality: CODEX_NATIVE_PERSONALITY_NONE
|
|
2272
|
-
} : {},
|
|
2273
|
-
...options.appServer.serviceTier !== void 0 ? { serviceTier: options.appServer.serviceTier } : options.clearInheritedServiceTier ? { serviceTier: null } : {},
|
|
2274
|
-
...collaborationMode ? {
|
|
2275
|
-
effort: collaborationMode.settings.reasoning_effort,
|
|
2276
|
-
collaborationMode
|
|
2277
|
-
} : {},
|
|
2278
|
-
...params.requireWorkspaceOnly === true ? { environments: [] } : options.environmentSelection ? { environments: options.environmentSelection } : {}
|
|
2279
|
-
};
|
|
2280
|
-
}
|
|
2281
|
-
function buildCodexTemporalAdditionalContext(params, options) {
|
|
2282
|
-
return { openclaw_temporal_context: {
|
|
2283
|
-
kind: "application",
|
|
2284
|
-
value: buildTemporalContextText({
|
|
2285
|
-
configuredTimezone: params.config?.agents?.defaults?.userTimezone,
|
|
2286
|
-
sessionStatusAvailable: options.sessionStatusAvailable
|
|
2287
|
-
})
|
|
2288
|
-
} };
|
|
2289
|
-
}
|
|
2290
|
-
function buildTurnCollaborationMode(params, options = {}) {
|
|
2291
|
-
const model = options.model ?? params.modelId;
|
|
2292
|
-
return {
|
|
2293
|
-
mode: "default",
|
|
2294
|
-
settings: {
|
|
2295
|
-
model,
|
|
2296
|
-
reasoning_effort: resolveCodexAppServerReasoningEffort({
|
|
2297
|
-
thinkLevel: params.thinkLevel,
|
|
2298
|
-
modelId: model,
|
|
2299
|
-
supportedReasoningEfforts: readCodexSupportedReasoningEfforts(params.model?.compat)
|
|
2300
|
-
}),
|
|
2301
|
-
developer_instructions: params.trigger === "cron" ? buildCronCollaborationInstructions() : null
|
|
2302
|
-
}
|
|
2303
|
-
};
|
|
2304
|
-
}
|
|
2305
|
-
function buildCodexParentLocalInstructions(params, options = {}) {
|
|
2306
|
-
const contextInstructions = joinPresentSections(options.personaInstructions, options.skillsInstructions, options.memoryInstructions);
|
|
2307
|
-
if (params.trigger === "cron") return joinPresentSections(buildCronCollaborationInstructions(), contextInstructions);
|
|
2308
|
-
return contextInstructions || null;
|
|
2309
|
-
}
|
|
2310
|
-
function buildCronCollaborationInstructions() {
|
|
2311
|
-
return [
|
|
2312
|
-
"This is an OpenClaw cron automation turn. Apply these instructions only to this scheduled job; ordinary chat turns should stay in Codex Default mode.",
|
|
2313
|
-
"Execute the cron payload directly. If it asks you to run an exact command, run that command before doing any investigation, planning, memory review, or workspace bootstrap.",
|
|
2314
|
-
"Use context already provided by the runtime, but do not spend time loading or re-reading workspace bootstrap, memory, or project-doc files before executing the cron payload. Inspect those files only if the payload asks for them or the command fails and they are needed to diagnose it.",
|
|
2315
|
-
"Keep output concise and automation-oriented. Prefer the final command result or a short failure summary over status narration."
|
|
2316
|
-
].join("\n\n");
|
|
2317
|
-
}
|
|
2318
|
-
//#endregion
|
|
2319
|
-
export { buildContextEngineBinding as _, buildTurnStartParams as a, resolveCodexAppServerReasoningEffort as b, assertScheduledCodexAppAuthorityRuntime as c, buildScheduledCodexAppServerConnectionIdentity as d, captureScheduledCodexAppAuthority as f, isCodexAppServerProfilerEnabled as g, resolveScheduledCodexAppCreatorCaptureDecision as h, buildTurnCollaborationMode as i, buildLegacyScheduledCodexAppRecoveryPrompt as l, readCurrentCodexScheduledAppPolicy as m, buildCodexParentLocalInstructions as n, buildCodexUserInput as o, intersectCodexPluginThreadConfigWithScheduledAuthority as p, buildCodexTemporalAdditionalContext as r, startOrResumeThread as s, buildCodexHistoryProvenancePrefix as t, buildScheduledCodexAppAuthorityInputFingerprint as u, isContextEngineBindingCompatible as v, readCodexSupportedReasoningEfforts as y };
|
|
2183
|
+
export { prepareCodexPluginThreadConfigStartupProvider as a, buildLegacyScheduledCodexAppRecoveryPrompt as c, resolveScheduledCodexAppCreatorCaptureDecision as d, isContextEngineBindingCompatible as i, buildScheduledCodexAppServerConnectionIdentity as l, isCodexAppServerProfilerEnabled as n, resolveCodexPluginThreadConfigStartupPolicy as o, buildContextEngineBinding as r, assertScheduledCodexAppAuthorityRuntime as s, startOrResumeThread as t, captureScheduledCodexAppAuthority as u };
|