@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,24 +1,24 @@
|
|
|
1
1
|
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
2
|
-
import { n as defineCodexBuildState, t as codexBuildSymbol } from "./build-state-
|
|
2
|
+
import { n as defineCodexBuildState, t as codexBuildSymbol } from "./build-state-CzLMy1S9.mjs";
|
|
3
3
|
import { t as CODEX_APP_SERVER_AUTH_PROVIDER } from "./auth-profile-selection-hr8ocLtz.mjs";
|
|
4
4
|
import { n as isCodexAppServerProxyLaunch } from "./launch-args-DbFCehO7.mjs";
|
|
5
5
|
import { a as withEphemeralCodexAuthStore, i as withClearedEnvironmentVariables, n as resolveCodexAppServerLocalHomeDir, r as resolveCodexAppServerUserHomeDir, t as resolveCodexAppServerHomeDir } from "./auth-start-options-BPIPeEX8.mjs";
|
|
6
|
-
import { a as resolveCodexAppServerStartOptionsForAgent, d as readCodexEffectiveConfig, o as resolveCodexComputerUseConfig, t as codexAppServerStartOptionsKey, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-
|
|
7
|
-
import { d as resolveMacOSDesktopCodexBundledMarketplaceCandidates, f as resolveMacOSDesktopCodexComputerUseServiceAppCandidates, i as resolveManagedCodexNativeCommand, l as resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath, r as resolveManagedCodexAppServerStartOptions, t as isManagedCodexDesktopCommand, u as resolveMacOSDesktopCodexAppPathCandidates } from "./managed-binary-
|
|
8
|
-
import { A as waitForCodexDesktopGeneration, C as retirePendingSharedClientEntryIfUnclaimed, D as waitForUnclaimedSharedClientStartup, _ as observeSharedClientAcquire, a as readCodexCliAuthFileApiKey, b as releaseSharedClientEntry, c as resolveCodexAppServerPreparedApiKeyCacheKey, d as getCurrentSharedClientEntry, f as getOrCreateSharedClientEntry, g as observeAcquire, h as notifyDesktopGenerationDrainChecks, i as fingerprintTokenAuthProfileCacheKey, j as readCodexDesktopArtifactTreeFingerprint, k as isCodexDesktopGenerationCurrent, l as closeSharedClientEntryIfUnclaimed, n as CODEX_AUTH_JSON_FILENAME, o as readFirstNonEmptyEnv, p as getSharedCodexAppServerClientState, r as fingerprintApiKeyAuthProfileCacheKey, s as resolveCodexAppServerFallbackApiKeyCacheKey, t as CODEX_APP_SERVER_API_KEY_ENV_VARS, u as createCodexAppServerStartupLifetime, v as ownCodexStartup, w as retireSharedCodexAppServerClientIfCurrent, x as retainSharedClientEntry, y as recordSharedClientAcquireBoundary } from "./auth-cache-key-
|
|
9
|
-
import { n as resolveCodexAppServerSpawnEnv } from "./transport-stdio-
|
|
6
|
+
import { a as resolveCodexAppServerStartOptionsForAgent, d as readCodexEffectiveConfig, o as resolveCodexComputerUseConfig, t as codexAppServerStartOptionsKey, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-DDzeNQ8m.mjs";
|
|
7
|
+
import { d as resolveMacOSDesktopCodexBundledMarketplaceCandidates, f as resolveMacOSDesktopCodexComputerUseServiceAppCandidates, i as resolveManagedCodexNativeCommand, l as resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath, r as resolveManagedCodexAppServerStartOptions, t as isManagedCodexDesktopCommand, u as resolveMacOSDesktopCodexAppPathCandidates } from "./managed-binary-BtIjV7yN.mjs";
|
|
8
|
+
import { A as waitForCodexDesktopGeneration, C as retirePendingSharedClientEntryIfUnclaimed, D as waitForUnclaimedSharedClientStartup, _ as observeSharedClientAcquire, a as readCodexCliAuthFileApiKey, b as releaseSharedClientEntry, c as resolveCodexAppServerPreparedApiKeyCacheKey, d as getCurrentSharedClientEntry, f as getOrCreateSharedClientEntry, g as observeAcquire, h as notifyDesktopGenerationDrainChecks, i as fingerprintTokenAuthProfileCacheKey, j as readCodexDesktopArtifactTreeFingerprint, k as isCodexDesktopGenerationCurrent, l as closeSharedClientEntryIfUnclaimed, n as CODEX_AUTH_JSON_FILENAME, o as readFirstNonEmptyEnv, p as getSharedCodexAppServerClientState, r as fingerprintApiKeyAuthProfileCacheKey, s as resolveCodexAppServerFallbackApiKeyCacheKey, t as CODEX_APP_SERVER_API_KEY_ENV_VARS, u as createCodexAppServerStartupLifetime, v as ownCodexStartup, w as retireSharedCodexAppServerClientIfCurrent, x as retainSharedClientEntry, y as recordSharedClientAcquireBoundary } from "./auth-cache-key-DyfUvsSa.mjs";
|
|
9
|
+
import { n as resolveCodexAppServerSpawnEnv } from "./transport-stdio-CRWTkKOn.mjs";
|
|
10
10
|
import { n as CodexAppServerAuthProfileUnavailableError, r as formatCodexAuthProfileUnavailableMessage } from "./auth-profile-recovery-BREezV0L.mjs";
|
|
11
|
-
import { a as codexPrewriteRejectionCause } from "./rpc-error-
|
|
12
|
-
import { i as withTimeout } from "./timeout-
|
|
11
|
+
import { a as codexPrewriteRejectionCause } from "./rpc-error-C98SHchT.mjs";
|
|
12
|
+
import { i as withTimeout } from "./timeout-D0mEWSGG.mjs";
|
|
13
13
|
import { n as readCodexSessionMeta } from "./session-catalog-provenance-CmsOE5mh.mjs";
|
|
14
|
-
import { n as observeCodexCatalogClient } from "./session-catalog-events-
|
|
15
|
-
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-
|
|
14
|
+
import { n as observeCodexCatalogClient } from "./session-catalog-events-DzFlXNUe.mjs";
|
|
15
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-DWzK-k0n.mjs";
|
|
16
16
|
import { a as resolveCodexAppServerAuthProfileStore, i as resolveCodexAppServerAuthProfileIdForAgent, r as resolveCodexAppServerAuthProfileId, t as isCodexAppServerNativeAuthProfile } from "./auth-profile-CgHQ8Vot.mjs";
|
|
17
17
|
import { i as isCodexResponsesOAuthCredential, n as createCodexResponsesOAuth, o as resolveCodexResponsesOAuthProfileFingerprint, r as isCodexResponsesOAuth, t as CODEX_RESPONSES_OAUTH_PROVIDER } from "./responses-oauth-twnuTaAa.mjs";
|
|
18
|
-
import {
|
|
19
|
-
import { n as isCodexWebSocketOpenFailure } from "./transport-websocket-
|
|
20
|
-
import { t as __exportAll } from "./session-binding-sidecars-
|
|
21
|
-
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
18
|
+
import { N as isUnsupportedCodexAppServerVersionError, t as CodexAppServerClient } from "./client-y7nO6X9c.mjs";
|
|
19
|
+
import { n as isCodexWebSocketOpenFailure } from "./transport-websocket-DIyPfkHo.mjs";
|
|
20
|
+
import { t as __exportAll } from "./session-binding-sidecars-DD-enC8w.mjs";
|
|
21
|
+
import { asOptionalRecord, isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
22
22
|
import { createHash, randomUUID } from "node:crypto";
|
|
23
23
|
import { isDeepStrictEqual } from "node:util";
|
|
24
24
|
import { AgentHarnessPreflightError, resolveDefaultAgentDir } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
@@ -30,8 +30,8 @@ import path from "node:path";
|
|
|
30
30
|
import fs$1 from "node:fs/promises";
|
|
31
31
|
import { extractErrorCode } from "openclaw/plugin-sdk/error-runtime";
|
|
32
32
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
33
|
-
import { AgentHarnessPreflightError as AgentHarnessPreflightError$1, embeddedAgentLog as embeddedAgentLog$1, formatErrorMessage as formatErrorMessage$1 } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
34
33
|
import { ensureAuthProfileStore, findPersistedAuthProfileCredential, refreshOAuthCredentialForRuntime, resolveApiKeyForProfile, resolvePersistedAuthProfileOwnerAgentDir } from "openclaw/plugin-sdk/agent-runtime";
|
|
34
|
+
import { AgentHarnessPreflightError as AgentHarnessPreflightError$1, embeddedAgentLog as embeddedAgentLog$1, formatErrorMessage as formatErrorMessage$1 } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
35
35
|
import { hasUsableOAuthCredential, resolveOpenAICodexAuthIdentity } from "openclaw/plugin-sdk/provider-auth";
|
|
36
36
|
import { assertDirectoryIdentitySync, readDirectoryIdentity } from "@openclaw/fs-safe/advanced";
|
|
37
37
|
import { assertNoSymlinkParents, pathScope } from "openclaw/plugin-sdk/security-runtime";
|
|
@@ -39,6 +39,7 @@ import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
|
39
39
|
import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
40
40
|
//#region extensions/codex/src/app-server/attempt-timeouts.ts
|
|
41
41
|
const CODEX_APP_SERVER_STARTUP_TIMEOUT_FLOOR_MS = 100;
|
|
42
|
+
const CODEX_APP_SERVER_STARTUP_REQUEST_TIMEOUT_MULTIPLE = 10;
|
|
42
43
|
const TURN_TERMINAL_SETTLEMENT_TIMEOUT_MS = 12e4;
|
|
43
44
|
const TURN_FINALIZE_DRAIN_ABORT_GRACE_MS = 5e3;
|
|
44
45
|
var CodexAppServerStartupError = class extends Error {
|
|
@@ -62,10 +63,8 @@ async function withCodexStartupTimeout(params) {
|
|
|
62
63
|
try {
|
|
63
64
|
return await Promise.race([params.operation(), new Promise((_, reject) => {
|
|
64
65
|
const rejectOnce = (error) => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
timeout = void 0;
|
|
68
|
-
}
|
|
66
|
+
clearTimeout(timeout);
|
|
67
|
+
timeout = void 0;
|
|
69
68
|
reject(error);
|
|
70
69
|
};
|
|
71
70
|
timeout = setTimeout(() => {
|
|
@@ -86,14 +85,19 @@ async function withCodexStartupTimeout(params) {
|
|
|
86
85
|
}
|
|
87
86
|
throw error;
|
|
88
87
|
} finally {
|
|
89
|
-
|
|
88
|
+
clearTimeout(timeout);
|
|
90
89
|
abortCleanup?.();
|
|
91
90
|
}
|
|
92
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Bounds app-server startup by the turn budget and, when known, by a multiple of
|
|
94
|
+
* the per-request timeout, so a turn with a long budget cannot hang silently in startup.
|
|
95
|
+
*/
|
|
93
96
|
function resolveCodexStartupTimeoutMs(params) {
|
|
94
97
|
const timeoutFloorMs = resolveTimerTimeoutMs(params.timeoutFloorMs, CODEX_APP_SERVER_STARTUP_TIMEOUT_FLOOR_MS);
|
|
95
|
-
const
|
|
96
|
-
|
|
98
|
+
const turnTimeoutMs = resolveTimerTimeoutMs(params.timeoutMs, timeoutFloorMs);
|
|
99
|
+
const requestBudgetMs = params.requestTimeoutMs === void 0 ? turnTimeoutMs : resolveTimerTimeoutMs(params.requestTimeoutMs * CODEX_APP_SERVER_STARTUP_REQUEST_TIMEOUT_MULTIPLE, turnTimeoutMs);
|
|
100
|
+
return Math.max(timeoutFloorMs, Math.min(turnTimeoutMs, requestBudgetMs));
|
|
97
101
|
}
|
|
98
102
|
function resolveCodexGatewayTimeoutWithGraceMs(timeoutMs, graceMs = 1e4) {
|
|
99
103
|
const timeout = resolveTimerTimeoutMs(timeoutMs, 1);
|
|
@@ -110,13 +114,7 @@ async function assertOwnedServicePath(params) {
|
|
|
110
114
|
allowMissing: true
|
|
111
115
|
});
|
|
112
116
|
assertPathAtOrInside(params.ownershipRoot, params.targetParent, "Computer Use service parent");
|
|
113
|
-
await
|
|
114
|
-
rootDir: params.ownershipRoot,
|
|
115
|
-
targetPath: params.targetParent,
|
|
116
|
-
allowMissing: true,
|
|
117
|
-
requireDirectories: true,
|
|
118
|
-
messagePrefix: "Computer Use service path"
|
|
119
|
-
});
|
|
117
|
+
await assertServicePathParents(params.ownershipRoot, params.targetParent, true);
|
|
120
118
|
await assertNotSymlink(params.targetPath, "Computer Use service target");
|
|
121
119
|
}
|
|
122
120
|
async function ensureOwnedCodexHome(codexHomeInput, ownershipRootInput = path.dirname(path.resolve(codexHomeInput))) {
|
|
@@ -141,13 +139,7 @@ async function ensureOwnedCodexHome(codexHomeInput, ownershipRootInput = path.di
|
|
|
141
139
|
async function prepareOwnedServiceParent(params) {
|
|
142
140
|
await ensureOwnedCodexHome(params.codexHome, params.ownershipRoot);
|
|
143
141
|
await ensureRealDirectoryTree(params.ownershipRoot, params.targetParent, "Computer Use service parent");
|
|
144
|
-
await
|
|
145
|
-
rootDir: params.ownershipRoot,
|
|
146
|
-
targetPath: params.targetParent,
|
|
147
|
-
allowMissing: false,
|
|
148
|
-
requireDirectories: true,
|
|
149
|
-
messagePrefix: "Computer Use service path"
|
|
150
|
-
});
|
|
142
|
+
await assertServicePathParents(params.ownershipRoot, params.targetParent, false);
|
|
151
143
|
const [rootIdentity, parentIdentity] = await Promise.all([readRealDirectoryIdentity(params.ownershipRoot, "Computer Use ownership root"), readRealDirectoryIdentity(params.targetParent, "Computer Use service parent")]);
|
|
152
144
|
assertPathAtOrInside(rootIdentity.realPath, parentIdentity.realPath, "canonical Computer Use service parent");
|
|
153
145
|
return parentIdentity;
|
|
@@ -155,10 +147,13 @@ async function prepareOwnedServiceParent(params) {
|
|
|
155
147
|
async function assertOwnedCodexHomePath(params) {
|
|
156
148
|
await readRealDirectoryIdentity(params.ownershipRoot, "Computer Use ownership root");
|
|
157
149
|
assertPathAtOrInside(params.ownershipRoot, params.codexHome, "isolated Codex home");
|
|
158
|
-
await
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
150
|
+
await assertServicePathParents(params.ownershipRoot, params.codexHome, params.allowMissing);
|
|
151
|
+
}
|
|
152
|
+
function assertServicePathParents(rootDir, targetPath, allowMissing) {
|
|
153
|
+
return assertNoSymlinkParents({
|
|
154
|
+
rootDir,
|
|
155
|
+
targetPath,
|
|
156
|
+
allowMissing,
|
|
162
157
|
requireDirectories: true,
|
|
163
158
|
messagePrefix: "Computer Use service path"
|
|
164
159
|
});
|
|
@@ -176,9 +171,6 @@ async function readRealDirectoryIdentity(directoryPath, label) {
|
|
|
176
171
|
throw new Error(`${label} must remain a real directory: ${logicalPath}`, { cause });
|
|
177
172
|
}
|
|
178
173
|
}
|
|
179
|
-
async function assertOwnedServiceParentStable(parent) {
|
|
180
|
-
await assertDirectoryIdentityStable(parent, "Computer Use service parent");
|
|
181
|
-
}
|
|
182
174
|
async function assertDirectoryIdentityStable(expected, label) {
|
|
183
175
|
if (!await directoryIdentityIsStable(expected)) throw new Error(`${label} changed during refresh; refusing to mutate the replacement path.`);
|
|
184
176
|
}
|
|
@@ -395,15 +387,18 @@ async function resolveManagedCodexComputerUseConfig(config, marketplacePath) {
|
|
|
395
387
|
}
|
|
396
388
|
/** A native plugin disable veto must survive an automatic identity replacement. */
|
|
397
389
|
function isLegacyCodexComputerUsePluginDisabled(config) {
|
|
398
|
-
|
|
399
|
-
return isRecord(plugin) && plugin.enabled === false;
|
|
390
|
+
return readLegacyComputerUsePlugin(config)?.enabled === false;
|
|
400
391
|
}
|
|
401
392
|
/** Renaming a server must not discard an operator's legacy server or tool restrictions. */
|
|
402
393
|
function hasLegacyCodexComputerUseMcpPolicy(config) {
|
|
403
394
|
if (!isRecord(config)) return false;
|
|
404
395
|
if (isRecord(config.mcp_servers) && Object.hasOwn(config.mcp_servers, "computer-use")) return true;
|
|
405
|
-
const
|
|
406
|
-
return isRecord(
|
|
396
|
+
const servers = readLegacyComputerUsePlugin(config)?.mcp_servers;
|
|
397
|
+
return isRecord(servers) && Object.keys(servers).length > 0;
|
|
398
|
+
}
|
|
399
|
+
function readLegacyComputerUsePlugin(config) {
|
|
400
|
+
const plugins = asOptionalRecord(asOptionalRecord(config)?.plugins);
|
|
401
|
+
return asOptionalRecord(plugins?.["computer-use@openai-bundled"]);
|
|
407
402
|
}
|
|
408
403
|
async function readObject(file) {
|
|
409
404
|
try {
|
|
@@ -622,6 +617,7 @@ const CLIENT_BUNDLE_ID = "com.openai.sky.CUAService.cli";
|
|
|
622
617
|
const OPENAI_TEAM_ID = "2DC432GLL2";
|
|
623
618
|
const CLIENT_APP_RELATIVE_PATH = path.join("Contents", "SharedSupport", "SkyComputerUseClient.app");
|
|
624
619
|
const CLIENT_RELATIVE_PATH = path.join(CLIENT_APP_RELATIVE_PATH, "Contents", "MacOS", "SkyComputerUseClient");
|
|
620
|
+
const SERVICE_PARENT_LABEL = "Computer Use service parent";
|
|
625
621
|
const COPY_TIMEOUT_MS = 12e4;
|
|
626
622
|
const INSPECT_TIMEOUT_MS = 3e4;
|
|
627
623
|
const activeInstalls = /* @__PURE__ */ new Map();
|
|
@@ -701,31 +697,31 @@ async function ensureCodexComputerUseServiceAppOnce(params) {
|
|
|
701
697
|
await assertNotSymlink(operationTargetPath, "Computer Use service target");
|
|
702
698
|
const initialTarget = await readServiceAppSnapshot(operationTargetPath, inspectServiceApp);
|
|
703
699
|
if (initialTarget.identity && identitiesMatch(initialTarget.identity, sourceIdentity)) return alreadyCurrent;
|
|
704
|
-
await
|
|
700
|
+
await assertDirectoryIdentityStable(ownedParent, SERVICE_PARENT_LABEL);
|
|
705
701
|
const stagingRoot = await fs$1.mkdtemp(path.join(ownedParent.realPath, ".service-app.staging-"));
|
|
706
702
|
const stagingRootIdentity = await readRealDirectoryIdentity(stagingRoot, "Computer Use service staging directory");
|
|
707
703
|
const stagedPath = path.join(stagingRoot, SERVICE_APP_NAME);
|
|
708
704
|
const backupPath = path.join(ownedParent.realPath, `.service-app.backup-${process.pid}-${Date.now()}`);
|
|
709
705
|
let backupCreated = false;
|
|
710
706
|
const restoreBackup = async () => {
|
|
711
|
-
await
|
|
707
|
+
await assertDirectoryIdentityStable(ownedParent, SERVICE_PARENT_LABEL);
|
|
712
708
|
await fs$1.rename(backupPath, operationTargetPath);
|
|
713
|
-
await
|
|
709
|
+
await assertDirectoryIdentityStable(ownedParent, SERVICE_PARENT_LABEL);
|
|
714
710
|
backupCreated = false;
|
|
715
711
|
};
|
|
716
712
|
const removeBackup = async () => {
|
|
717
|
-
await
|
|
713
|
+
await assertDirectoryIdentityStable(ownedParent, SERVICE_PARENT_LABEL);
|
|
718
714
|
await assertNotSymlink(backupPath, "Computer Use service backup");
|
|
719
715
|
await fs$1.rm(backupPath, {
|
|
720
716
|
recursive: true,
|
|
721
717
|
force: true
|
|
722
718
|
});
|
|
723
|
-
await
|
|
719
|
+
await assertDirectoryIdentityStable(ownedParent, SERVICE_PARENT_LABEL);
|
|
724
720
|
backupCreated = false;
|
|
725
721
|
};
|
|
726
722
|
try {
|
|
727
723
|
await (params.copyServiceApp ?? copyServiceAppWithDitto)(sourcePath, stagedPath);
|
|
728
|
-
await
|
|
724
|
+
await assertDirectoryIdentityStable(ownedParent, SERVICE_PARENT_LABEL);
|
|
729
725
|
await assertDirectoryIdentityStable(stagingRootIdentity, "Computer Use service staging directory");
|
|
730
726
|
await assertNotSymlink(stagedPath, "Copied Computer Use service app");
|
|
731
727
|
const stagedIdentity = await inspectServiceApp(stagedPath);
|
|
@@ -733,15 +729,15 @@ async function ensureCodexComputerUseServiceAppOnce(params) {
|
|
|
733
729
|
const stagedSnapshot = await readServiceAppSnapshot(stagedPath, inspectServiceApp);
|
|
734
730
|
const currentSourceIdentity = await inspectServiceApp(sourcePath);
|
|
735
731
|
await waitForCodexDesktopGeneration();
|
|
736
|
-
await
|
|
732
|
+
await assertDirectoryIdentityStable(ownedParent, SERVICE_PARENT_LABEL);
|
|
737
733
|
await assertDirectoryIdentityStable(stagingRootIdentity, "Computer Use service staging directory");
|
|
738
734
|
if (!currentSourceIdentity || !identitiesMatch(currentSourceIdentity, sourceIdentity)) throw new Error("Selected Computer Use service source changed during refresh.");
|
|
739
735
|
await assertNotSymlink(operationTargetPath, "Computer Use service target");
|
|
740
736
|
if (await pathExists$1(operationTargetPath)) {
|
|
741
|
-
await
|
|
737
|
+
await assertDirectoryIdentityStable(ownedParent, SERVICE_PARENT_LABEL);
|
|
742
738
|
params.assertCurrent?.();
|
|
743
739
|
await fs$1.rename(operationTargetPath, backupPath);
|
|
744
|
-
await
|
|
740
|
+
await assertDirectoryIdentityStable(ownedParent, SERVICE_PARENT_LABEL);
|
|
745
741
|
backupCreated = true;
|
|
746
742
|
const movedTarget = await readServiceAppSnapshot(backupPath, inspectServiceApp);
|
|
747
743
|
if (movedTarget.identity && identitiesMatch(movedTarget.identity, sourceIdentity)) {
|
|
@@ -754,12 +750,12 @@ async function ensureCodexComputerUseServiceAppOnce(params) {
|
|
|
754
750
|
}
|
|
755
751
|
}
|
|
756
752
|
try {
|
|
757
|
-
await
|
|
753
|
+
await assertDirectoryIdentityStable(ownedParent, SERVICE_PARENT_LABEL);
|
|
758
754
|
params.assertCurrent?.();
|
|
759
755
|
await fs$1.rename(stagedPath, operationTargetPath);
|
|
760
|
-
await
|
|
756
|
+
await assertDirectoryIdentityStable(ownedParent, SERVICE_PARENT_LABEL);
|
|
761
757
|
} catch (error) {
|
|
762
|
-
await
|
|
758
|
+
await assertDirectoryIdentityStable(ownedParent, SERVICE_PARENT_LABEL);
|
|
763
759
|
await assertNotSymlink(operationTargetPath, "Computer Use service target");
|
|
764
760
|
const winnerIdentity = await inspectServiceApp(operationTargetPath);
|
|
765
761
|
if (!winnerIdentity || !identitiesMatch(winnerIdentity, sourceIdentity)) {
|
|
@@ -773,15 +769,15 @@ async function ensureCodexComputerUseServiceAppOnce(params) {
|
|
|
773
769
|
const installedSnapshot = await readServiceAppSnapshot(operationTargetPath, inspectServiceApp);
|
|
774
770
|
if (!installedSnapshot.identity || !identitiesMatch(installedSnapshot.identity, sourceIdentity)) {
|
|
775
771
|
if (filesystemSnapshotsMatch(installedSnapshot, stagedSnapshot)) {
|
|
776
|
-
await
|
|
772
|
+
await assertDirectoryIdentityStable(ownedParent, SERVICE_PARENT_LABEL);
|
|
777
773
|
await fs$1.rm(operationTargetPath, {
|
|
778
774
|
recursive: true,
|
|
779
775
|
force: true
|
|
780
776
|
});
|
|
781
|
-
await
|
|
777
|
+
await assertDirectoryIdentityStable(ownedParent, SERVICE_PARENT_LABEL);
|
|
782
778
|
if (backupCreated) {
|
|
783
779
|
await fs$1.rename(backupPath, operationTargetPath);
|
|
784
|
-
await
|
|
780
|
+
await assertDirectoryIdentityStable(ownedParent, SERVICE_PARENT_LABEL);
|
|
785
781
|
backupCreated = false;
|
|
786
782
|
}
|
|
787
783
|
}
|
|
@@ -789,16 +785,14 @@ async function ensureCodexComputerUseServiceAppOnce(params) {
|
|
|
789
785
|
}
|
|
790
786
|
if (backupCreated) await removeBackup();
|
|
791
787
|
return {
|
|
788
|
+
...alreadyCurrent,
|
|
792
789
|
status: initialTarget.exists ? "refreshed" : "installed",
|
|
793
790
|
changed: true,
|
|
794
|
-
targetPath: params.targetPath,
|
|
795
|
-
sourcePath,
|
|
796
|
-
sourceBuild: sourceIdentity.build,
|
|
797
791
|
...initialTarget.identity ? { previousBuild: initialTarget.identity.build } : {}
|
|
798
792
|
};
|
|
799
793
|
} catch (error) {
|
|
800
794
|
if (backupCreated && await directoryIdentityIsStable(ownedParent) && !await pathExists$1(operationTargetPath)) {
|
|
801
|
-
await
|
|
795
|
+
await assertDirectoryIdentityStable(ownedParent, SERVICE_PARENT_LABEL);
|
|
802
796
|
await fs$1.rename(backupPath, operationTargetPath);
|
|
803
797
|
backupCreated = false;
|
|
804
798
|
}
|
|
@@ -836,7 +830,7 @@ async function readServiceAppFilesystemKey(appPath) {
|
|
|
836
830
|
path.join(appPath, "Contents", "Info.plist"),
|
|
837
831
|
path.join(appPath, CLIENT_RELATIVE_PATH)
|
|
838
832
|
];
|
|
839
|
-
return (await Promise.all(paths.map(
|
|
833
|
+
return (await Promise.all(paths.map((entryPath) => fs$1.stat(entryPath).then((stat) => `${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeMs}`, () => "missing")))).join("|");
|
|
840
834
|
}
|
|
841
835
|
function snapshotsMatch(left, right) {
|
|
842
836
|
if (left.exists !== right.exists) return false;
|
|
@@ -846,7 +840,7 @@ function snapshotsMatch(left, right) {
|
|
|
846
840
|
return left.filesystemKey !== void 0 && left.filesystemKey === right.filesystemKey;
|
|
847
841
|
}
|
|
848
842
|
function filesystemSnapshotsMatch(left, right) {
|
|
849
|
-
return Boolean(left.exists && right.exists && left.filesystemKey &&
|
|
843
|
+
return Boolean(left.exists && right.exists && left.filesystemKey && left.filesystemKey === right.filesystemKey);
|
|
850
844
|
}
|
|
851
845
|
function identitiesMatch(left, right) {
|
|
852
846
|
return left.bundleId === right.bundleId && left.version === right.version && left.build === right.build && left.cdHash === right.cdHash && left.teamId === right.teamId && left.clientBundleId === right.clientBundleId && left.clientCdHash === right.clientCdHash && left.clientTeamId === right.clientTeamId;
|
|
@@ -950,12 +944,8 @@ async function copyServiceAppWithDitto(sourcePath, targetPath) {
|
|
|
950
944
|
const OPENAI_CODEX_DEFAULT_PROFILE_ID = "openai:default";
|
|
951
945
|
const CODEX_HOME_ENV_VAR = "CODEX_HOME";
|
|
952
946
|
const HOME_ENV_VAR = "HOME";
|
|
953
|
-
const CODEX_APP_SERVER_PREPARED_AUTH_ENV_VARS = [
|
|
954
|
-
|
|
955
|
-
"OPENAI_API_KEY",
|
|
956
|
-
"CODEX_ACCESS_TOKEN"
|
|
957
|
-
];
|
|
958
|
-
const CODEX_APP_SERVER_HOME_ENV_VARS = [CODEX_HOME_ENV_VAR, HOME_ENV_VAR];
|
|
947
|
+
const CODEX_APP_SERVER_PREPARED_AUTH_ENV_VARS = [...CODEX_APP_SERVER_API_KEY_ENV_VARS, "CODEX_ACCESS_TOKEN"];
|
|
948
|
+
const CODEX_APP_SERVER_HOME_ENV_VARS = /* @__PURE__ */ new Set([CODEX_HOME_ENV_VAR, HOME_ENV_VAR]);
|
|
959
949
|
const MAX_COMPUTER_USE_ARTIFACT_OWNERS = 128;
|
|
960
950
|
const activeComputerUseArtifactReconciliations = /* @__PURE__ */ new Map();
|
|
961
951
|
const scopedOAuthRefreshQueues = /* @__PURE__ */ new WeakMap();
|
|
@@ -1139,9 +1129,10 @@ async function withCodexHomeEnvironment(startOptions, agentDir) {
|
|
|
1139
1129
|
...nativeHome ? { [HOME_ENV_VAR]: nativeHome } : {}
|
|
1140
1130
|
}
|
|
1141
1131
|
};
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1132
|
+
if (startOptions.clearEnv) {
|
|
1133
|
+
const filtered = startOptions.clearEnv.filter((envVar) => !CODEX_APP_SERVER_HOME_ENV_VARS.has(envVar.trim().toUpperCase()));
|
|
1134
|
+
nextStartOptions.clearEnv = filtered.length === startOptions.clearEnv.length ? startOptions.clearEnv : filtered;
|
|
1135
|
+
} else delete nextStartOptions.clearEnv;
|
|
1145
1136
|
return nextStartOptions;
|
|
1146
1137
|
}
|
|
1147
1138
|
/** Reconciles Computer Use artifacts for the exact managed command about to start. */
|
|
@@ -1150,16 +1141,12 @@ async function reconcileCodexComputerUseStartArtifacts(params) {
|
|
|
1150
1141
|
const codexHome = resolveCodexAppServerLocalHomeDir(params.startOptions, params.agentDir);
|
|
1151
1142
|
const key = path.resolve(codexHome);
|
|
1152
1143
|
let owner = activeComputerUseArtifactReconciliations.get(key);
|
|
1153
|
-
if (!owner) {
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
} else {
|
|
1160
|
-
activeComputerUseArtifactReconciliations.delete(key);
|
|
1161
|
-
activeComputerUseArtifactReconciliations.set(key, owner);
|
|
1162
|
-
}
|
|
1144
|
+
if (!owner) owner = {
|
|
1145
|
+
active: 0,
|
|
1146
|
+
tail: Promise.resolve()
|
|
1147
|
+
};
|
|
1148
|
+
else activeComputerUseArtifactReconciliations.delete(key);
|
|
1149
|
+
activeComputerUseArtifactReconciliations.set(key, owner);
|
|
1163
1150
|
owner.active += 1;
|
|
1164
1151
|
const epoch = params.desktopGeneration?.epoch;
|
|
1165
1152
|
if (epoch !== void 0 && (owner.latestEpoch === void 0 || epoch > owner.latestEpoch)) owner.latestEpoch = epoch;
|
|
@@ -1167,7 +1154,7 @@ async function reconcileCodexComputerUseStartArtifacts(params) {
|
|
|
1167
1154
|
params.assertCurrent?.();
|
|
1168
1155
|
if (epoch !== void 0 && owner.latestEpoch !== epoch) throw new Error("Codex Computer Use artifact reconciliation was superseded.");
|
|
1169
1156
|
};
|
|
1170
|
-
const operation = owner.tail.
|
|
1157
|
+
const operation = owner.tail.then(async () => {
|
|
1171
1158
|
assertCurrent();
|
|
1172
1159
|
const appliedCacheBinding = await reconcileCodexComputerUseStartArtifactsOnce({
|
|
1173
1160
|
...params,
|
|
@@ -1178,7 +1165,7 @@ async function reconcileCodexComputerUseStartArtifacts(params) {
|
|
|
1178
1165
|
assertCurrent();
|
|
1179
1166
|
owner.appliedCacheBinding = appliedCacheBinding;
|
|
1180
1167
|
});
|
|
1181
|
-
const settled = operation.
|
|
1168
|
+
const settled = operation.catch(() => void 0);
|
|
1182
1169
|
owner.tail = settled;
|
|
1183
1170
|
try {
|
|
1184
1171
|
await operation;
|
|
@@ -1277,12 +1264,6 @@ var CodexComputerUseCandidateArtifactsUnavailableError = class extends Error {
|
|
|
1277
1264
|
this.name = "CodexComputerUseCandidateArtifactsUnavailableError";
|
|
1278
1265
|
}
|
|
1279
1266
|
};
|
|
1280
|
-
function withoutClearedCodexHomeEnv(clearEnv) {
|
|
1281
|
-
if (!clearEnv) return;
|
|
1282
|
-
const reserved = new Set(CODEX_APP_SERVER_HOME_ENV_VARS);
|
|
1283
|
-
const filtered = clearEnv.filter((envVar) => !reserved.has(envVar.trim().toUpperCase()));
|
|
1284
|
-
return filtered.length === clearEnv.length ? clearEnv : filtered;
|
|
1285
|
-
}
|
|
1286
1267
|
async function applyCodexAppServerAuthProfile(params) {
|
|
1287
1268
|
params.assertCurrent?.();
|
|
1288
1269
|
if (!params.preparedAuth && params.authProfileId === null) {
|
|
@@ -1350,7 +1331,7 @@ function createCodexAppServerAuthError(message) {
|
|
|
1350
1331
|
async function refreshCodexAppServerAuthTokens(params) {
|
|
1351
1332
|
const previousAccountId = params.previousAccountId?.trim();
|
|
1352
1333
|
const handoffAccountId = params.authHandoff?.chatgptAccountId.trim();
|
|
1353
|
-
if (previousAccountId && handoffAccountId && previousAccountId !== handoffAccountId) throw
|
|
1334
|
+
if (previousAccountId && handoffAccountId && previousAccountId !== handoffAccountId) throw codexWorkspaceChangedError("before");
|
|
1354
1335
|
if (previousAccountId) {
|
|
1355
1336
|
const store = resolveCodexAppServerAuthProfileStore(params);
|
|
1356
1337
|
const profileId = resolveCodexAppServerAuthProfileId({
|
|
@@ -1359,14 +1340,14 @@ async function refreshCodexAppServerAuthTokens(params) {
|
|
|
1359
1340
|
});
|
|
1360
1341
|
const credential = profileId ? store.profiles[profileId] : void 0;
|
|
1361
1342
|
const selectedAccountId = credential ? resolveExplicitChatgptAccountId(credential) ?? (credential.type === "oauth" ? resolveOpenAICodexAuthIdentity({ access: credential.access }).accountId : void 0) : void 0;
|
|
1362
|
-
if (selectedAccountId && selectedAccountId !== previousAccountId) throw
|
|
1343
|
+
if (selectedAccountId && selectedAccountId !== previousAccountId) throw codexWorkspaceChangedError("before");
|
|
1363
1344
|
}
|
|
1364
1345
|
const loginParams = await resolveCodexAppServerAuthProfileLoginParamsInternal({
|
|
1365
1346
|
...params,
|
|
1366
1347
|
forceOAuthRefresh: true
|
|
1367
1348
|
});
|
|
1368
1349
|
if (!loginParams || loginParams.type !== "chatgptAuthTokens") throw new Error("Codex app-server ChatGPT token refresh requires an OAuth auth profile. Sign in with `openclaw models auth login --provider openai`, select that profile, then retry.");
|
|
1369
|
-
if (previousAccountId && loginParams.chatgptAccountId !== previousAccountId || params.authHandoff && loginParams.chatgptAccountId !== params.authHandoff.chatgptAccountId) throw
|
|
1350
|
+
if (previousAccountId && loginParams.chatgptAccountId !== previousAccountId || params.authHandoff && loginParams.chatgptAccountId !== params.authHandoff.chatgptAccountId) throw codexWorkspaceChangedError("during");
|
|
1370
1351
|
return {
|
|
1371
1352
|
accessToken: loginParams.accessToken,
|
|
1372
1353
|
chatgptAccountId: loginParams.chatgptAccountId,
|
|
@@ -1383,32 +1364,14 @@ async function resolveCodexAppServerAuthProfileLoginParamsInternal(params) {
|
|
|
1383
1364
|
const credential = store.profiles[profileId];
|
|
1384
1365
|
if (!credential) throw new CodexAppServerAuthProfileUnavailableError(formatCodexAuthProfileUnavailableMessage(profileId));
|
|
1385
1366
|
if (!isCodexAppServerAuthProvider(credential.provider)) throw new CodexAppServerAuthProfileUnavailableError(`Codex app-server auth profile "${profileId}" must use the canonical OpenAI auth provider; run "openclaw doctor --fix" to migrate legacy provider IDs.`);
|
|
1386
|
-
const
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
forceOAuthRefresh: params.forceOAuthRefresh === true,
|
|
1391
|
-
authHandoff: params.authHandoff,
|
|
1392
|
-
previousAccountId: params.previousAccountId,
|
|
1393
|
-
config: params.config
|
|
1394
|
-
});
|
|
1395
|
-
if (!loginParams) throw new CodexAppServerAuthProfileUnavailableError(`Codex app-server auth profile "${profileId}" does not contain usable credentials. Repair or replace the selected OpenAI credential, then retry.`);
|
|
1396
|
-
return loginParams;
|
|
1397
|
-
}
|
|
1398
|
-
async function resolveCodexAppServerFallbackApiKeyLoginParams(params) {
|
|
1399
|
-
const apiKey = readFirstNonEmptyEnv(params.env, CODEX_APP_SERVER_API_KEY_ENV_VARS) ?? await readCodexCliAuthFileApiKey(params.codexCliAuthEnv);
|
|
1400
|
-
if (!apiKey) return;
|
|
1401
|
-
if ((await params.client.request("account/read", { refreshToken: false }, { assertCurrent: params.assertCurrent })).account) return;
|
|
1402
|
-
return {
|
|
1403
|
-
type: "apiKey",
|
|
1404
|
-
apiKey
|
|
1405
|
-
};
|
|
1406
|
-
}
|
|
1407
|
-
async function resolveLoginParamsForCredential(profileId, credential, params) {
|
|
1367
|
+
const preferStoreCredential = Boolean(params.authProfileStore?.profiles[profileId]);
|
|
1368
|
+
let loginCredential = credential;
|
|
1369
|
+
let value;
|
|
1370
|
+
let useApiKey = false;
|
|
1408
1371
|
if (credential.type === "api_key" || credential.type === "token") {
|
|
1409
|
-
|
|
1372
|
+
value = (await resolveApiKeyForProfile({
|
|
1410
1373
|
cfg: params.config,
|
|
1411
|
-
store:
|
|
1374
|
+
store: preferStoreCredential ? store : ensureAuthProfileStore(params.agentDir, {
|
|
1412
1375
|
allowKeychainPrompt: false,
|
|
1413
1376
|
profileId,
|
|
1414
1377
|
config: params.config
|
|
@@ -1416,23 +1379,30 @@ async function resolveLoginParamsForCredential(profileId, credential, params) {
|
|
|
1416
1379
|
profileId,
|
|
1417
1380
|
agentDir: params.agentDir
|
|
1418
1381
|
}))?.apiKey?.trim();
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1382
|
+
useApiKey = credential.type === "api_key";
|
|
1383
|
+
} else {
|
|
1384
|
+
loginCredential = await resolveOAuthCredentialForCodexAppServer(profileId, credential, {
|
|
1385
|
+
...params,
|
|
1386
|
+
store,
|
|
1387
|
+
preferStoreCredential,
|
|
1388
|
+
forceRefresh: params.forceOAuthRefresh === true
|
|
1389
|
+
});
|
|
1390
|
+
value = loginCredential.access?.trim();
|
|
1424
1391
|
}
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
return
|
|
1392
|
+
if (!value) throw new CodexAppServerAuthProfileUnavailableError(`Codex app-server auth profile "${profileId}" does not contain usable credentials. Repair or replace the selected OpenAI credential, then retry.`);
|
|
1393
|
+
return useApiKey ? {
|
|
1394
|
+
type: "apiKey",
|
|
1395
|
+
apiKey: value
|
|
1396
|
+
} : buildChatgptAuthTokensParams(profileId, loginCredential, value);
|
|
1397
|
+
}
|
|
1398
|
+
async function resolveCodexAppServerFallbackApiKeyLoginParams(params) {
|
|
1399
|
+
const apiKey = readFirstNonEmptyEnv(params.env, CODEX_APP_SERVER_API_KEY_ENV_VARS) ?? await readCodexCliAuthFileApiKey(params.codexCliAuthEnv);
|
|
1400
|
+
if (!apiKey) return;
|
|
1401
|
+
if ((await params.client.request("account/read", { refreshToken: false }, { assertCurrent: params.assertCurrent })).account) return;
|
|
1402
|
+
return {
|
|
1403
|
+
type: "apiKey",
|
|
1404
|
+
apiKey
|
|
1405
|
+
};
|
|
1436
1406
|
}
|
|
1437
1407
|
async function resolveOAuthCredentialForCodexAppServer(profileId, credential, params) {
|
|
1438
1408
|
const ownerAgentDir = resolvePersistedAuthProfileOwnerAgentDir({
|
|
@@ -1443,13 +1413,9 @@ async function resolveOAuthCredentialForCodexAppServer(profileId, credential, pa
|
|
|
1443
1413
|
agentDir: ownerAgentDir,
|
|
1444
1414
|
profileId
|
|
1445
1415
|
});
|
|
1446
|
-
const
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
persistedCredential,
|
|
1450
|
-
suppliedCredential: credential
|
|
1451
|
-
});
|
|
1452
|
-
if (params.preferStoreCredential && params.store.runtimePersistedProfileIds?.includes(profileId) && (persistedCredential?.type !== "oauth" || !isCodexAppServerAuthProvider(persistedCredential.provider))) throw new CodexAppServerAuthProfileUnavailableError(`Codex app-server auth profile "${profileId}" is no longer an OpenAI OAuth credential in its persisted OpenClaw store. Run "openclaw doctor" to inspect credential ownership, or select an existing OpenAI profile.`);
|
|
1416
|
+
const persistedProfile = params.store.runtimePersistedProfileIds?.includes(profileId);
|
|
1417
|
+
const useScopedCredential = params.preferStoreCredential && (!persistedProfile || persistedCredential?.type === "oauth" && isCodexAppServerAuthProvider(persistedCredential.provider) && !isDeepStrictEqual(persistedCredential, credential) && !hasMatchingOAuthIdentity(persistedCredential, credential));
|
|
1418
|
+
if (params.preferStoreCredential && persistedProfile && (persistedCredential?.type !== "oauth" || !isCodexAppServerAuthProvider(persistedCredential.provider))) throw new CodexAppServerAuthProfileUnavailableError(`Codex app-server auth profile "${profileId}" is no longer an OpenAI OAuth credential in its persisted OpenClaw store. Run "openclaw doctor" to inspect credential ownership, or select an existing OpenAI profile.`);
|
|
1453
1419
|
const store = useScopedCredential ? params.store : resolveCodexAppServerAuthProfileStore({
|
|
1454
1420
|
agentDir: ownerAgentDir,
|
|
1455
1421
|
authProfileId: profileId,
|
|
@@ -1466,7 +1432,7 @@ async function resolveOAuthCredentialForCodexAppServer(profileId, credential, pa
|
|
|
1466
1432
|
});
|
|
1467
1433
|
const selectedAccountId = currentCredential ? resolveOpenAICodexAuthIdentity(currentCredential).accountId?.trim() : void 0;
|
|
1468
1434
|
const callbackAccountId = params.authHandoff?.chatgptAccountId.trim() ?? params.previousAccountId?.trim() ?? void 0;
|
|
1469
|
-
if (callbackAccountId && selectedAccountId && callbackAccountId !== selectedAccountId) throw
|
|
1435
|
+
if (callbackAccountId && selectedAccountId && callbackAccountId !== selectedAccountId) throw codexWorkspaceChangedError("before");
|
|
1470
1436
|
const expectedAccountId = callbackAccountId ?? selectedAccountId;
|
|
1471
1437
|
if (useScopedCredential && overlaidOAuthCredential) return await resolveScopedOAuthCredential({
|
|
1472
1438
|
store,
|
|
@@ -1477,7 +1443,6 @@ async function resolveOAuthCredentialForCodexAppServer(profileId, credential, pa
|
|
|
1477
1443
|
config: params.config
|
|
1478
1444
|
});
|
|
1479
1445
|
if (params.forceRefresh && !persistedOAuthCredential && overlaidOAuthCredential) {
|
|
1480
|
-
if (reuseCompletedRotation) return overlaidOAuthCredential;
|
|
1481
1446
|
const refreshedRuntimeCredential = await refreshOAuthCredentialForRuntime({
|
|
1482
1447
|
credential: overlaidOAuthCredential,
|
|
1483
1448
|
cfg: params.config
|
|
@@ -1512,12 +1477,6 @@ function shouldReuseCompletedCodexOAuthRotation(params) {
|
|
|
1512
1477
|
const previousAccountId = params.previousAccountId?.trim();
|
|
1513
1478
|
return accountId === handoff.chatgptAccountId && (!previousAccountId || previousAccountId === handoff.chatgptAccountId);
|
|
1514
1479
|
}
|
|
1515
|
-
function shouldUseScopedOAuthCredential(params) {
|
|
1516
|
-
if (!params.store.runtimePersistedProfileIds?.includes(params.profileId)) return true;
|
|
1517
|
-
const persisted = params.persistedCredential;
|
|
1518
|
-
if (persisted?.type !== "oauth" || !isCodexAppServerAuthProvider(persisted.provider)) return false;
|
|
1519
|
-
return !isDeepStrictEqual(persisted, params.suppliedCredential) && !hasMatchingOAuthIdentity(persisted, params.suppliedCredential);
|
|
1520
|
-
}
|
|
1521
1480
|
function hasMatchingOAuthIdentity(persisted, supplied) {
|
|
1522
1481
|
const persistedAccountId = resolveOpenAICodexAuthIdentity(persisted).accountId?.trim();
|
|
1523
1482
|
const suppliedAccountId = resolveOpenAICodexAuthIdentity(supplied).accountId?.trim();
|
|
@@ -1557,9 +1516,12 @@ async function resolveScopedOAuthCredential(params) {
|
|
|
1557
1516
|
if (storeRefreshes.get(params.profileId) === refresh) storeRefreshes.delete(params.profileId);
|
|
1558
1517
|
}
|
|
1559
1518
|
}
|
|
1519
|
+
function codexWorkspaceChangedError(phase) {
|
|
1520
|
+
return /* @__PURE__ */ new Error(`ChatGPT workspace changed ${phase} Codex token refresh. Retry to start a client for the selected workspace.`);
|
|
1521
|
+
}
|
|
1560
1522
|
function assertCodexOAuthRefreshWorkspace(profileId, credential, expectedAccountId) {
|
|
1561
1523
|
if (!expectedAccountId) return;
|
|
1562
|
-
if (buildChatgptAuthTokensParams(profileId, credential, credential.access.trim()).chatgptAccountId !== expectedAccountId) throw
|
|
1524
|
+
if (buildChatgptAuthTokensParams(profileId, credential, credential.access.trim()).chatgptAccountId !== expectedAccountId) throw codexWorkspaceChangedError("during");
|
|
1563
1525
|
}
|
|
1564
1526
|
function isCodexAppServerAuthProvider(provider) {
|
|
1565
1527
|
return provider.trim().toLowerCase() === CODEX_APP_SERVER_AUTH_PROVIDER;
|
|
@@ -1595,10 +1557,7 @@ function resolveStableChatgptAccountId(credential) {
|
|
|
1595
1557
|
return resolveExplicitChatgptAccountId(credential) ?? (credential.email?.trim() || void 0);
|
|
1596
1558
|
}
|
|
1597
1559
|
function resolveExplicitChatgptAccountId(credential) {
|
|
1598
|
-
|
|
1599
|
-
const accountId = credential.accountId.trim();
|
|
1600
|
-
if (accountId) return accountId;
|
|
1601
|
-
}
|
|
1560
|
+
return "accountId" in credential && typeof credential.accountId === "string" ? credential.accountId.trim() || void 0 : void 0;
|
|
1602
1561
|
}
|
|
1603
1562
|
//#endregion
|
|
1604
1563
|
//#region extensions/codex/src/app-server/client-thread-owner.ts
|
|
@@ -1787,12 +1746,19 @@ function readRecentCodexRateLimits(client, options) {
|
|
|
1787
1746
|
}
|
|
1788
1747
|
function mergeRateLimitUpdate(current, update) {
|
|
1789
1748
|
const currentEnvelope = isJsonObject(current) ? current : void 0;
|
|
1790
|
-
const currentPrimary = currentEnvelope
|
|
1791
|
-
const currentByLimitId = currentEnvelope
|
|
1749
|
+
const currentPrimary = readObjectField(currentEnvelope, "rateLimits");
|
|
1750
|
+
const currentByLimitId = readObjectField(currentEnvelope, "rateLimitsByLimitId");
|
|
1792
1751
|
const limitId = readLimitId(update);
|
|
1793
1752
|
const currentPrimaryLimitId = currentPrimary ? readLimitId(currentPrimary) : void 0;
|
|
1794
|
-
const currentForLimit = (currentByLimitId
|
|
1795
|
-
const merged =
|
|
1753
|
+
const currentForLimit = readObjectField(currentByLimitId, limitId) ?? (currentPrimaryLimitId === limitId ? currentPrimary : void 0);
|
|
1754
|
+
const merged = {
|
|
1755
|
+
...update,
|
|
1756
|
+
limitId
|
|
1757
|
+
};
|
|
1758
|
+
for (const key of SPARSE_ACCOUNT_METADATA_KEYS) {
|
|
1759
|
+
const previous = currentForLimit?.[key] ?? currentPrimary?.[key];
|
|
1760
|
+
if (merged[key] == null && previous != null) merged[key] = previous;
|
|
1761
|
+
}
|
|
1796
1762
|
const nextPrimary = !currentPrimary || currentPrimaryLimitId === limitId ? merged : currentPrimary;
|
|
1797
1763
|
let nextByLimitId;
|
|
1798
1764
|
if (currentByLimitId) nextByLimitId = {
|
|
@@ -1819,24 +1785,20 @@ function readRateLimitIds(value) {
|
|
|
1819
1785
|
}
|
|
1820
1786
|
return [...ids];
|
|
1821
1787
|
}
|
|
1822
|
-
function mergeSparseSnapshot(current, accountFallback, update, limitId) {
|
|
1823
|
-
const merged = {
|
|
1824
|
-
...update,
|
|
1825
|
-
limitId
|
|
1826
|
-
};
|
|
1827
|
-
for (const key of SPARSE_ACCOUNT_METADATA_KEYS) {
|
|
1828
|
-
const previous = current?.[key] ?? accountFallback?.[key];
|
|
1829
|
-
if (merged[key] == null && previous != null) merged[key] = previous;
|
|
1830
|
-
}
|
|
1831
|
-
return merged;
|
|
1832
|
-
}
|
|
1833
1788
|
function readLimitId(snapshot) {
|
|
1834
1789
|
const value = snapshot.limitId;
|
|
1835
1790
|
return typeof value === "string" && value.trim() ? value.trim() : "codex";
|
|
1836
1791
|
}
|
|
1792
|
+
function readObjectField(value, key) {
|
|
1793
|
+
return value && isJsonObject(value[key]) ? value[key] : void 0;
|
|
1794
|
+
}
|
|
1837
1795
|
//#endregion
|
|
1838
1796
|
//#region extensions/codex/src/app-server/client-runtime.ts
|
|
1839
|
-
|
|
1797
|
+
function defaultThreadRelease(client) {
|
|
1798
|
+
return async (threadId, assertCurrent, withCurrent) => {
|
|
1799
|
+
await unsubscribeCodexAppServerLiveThread(client, threadId, 5e3, assertCurrent, withCurrent);
|
|
1800
|
+
};
|
|
1801
|
+
}
|
|
1840
1802
|
/** Match Codex's native grace window without retaining inactive conversations indefinitely. */
|
|
1841
1803
|
const CODEX_APP_SERVER_LIVE_THREAD_IDLE_TIMEOUT_MS = 18e5;
|
|
1842
1804
|
/** Native-child parents are active ownership, so only otherwise-idle threads count against this cap. */
|
|
@@ -1893,10 +1855,8 @@ function ensureCodexAppServerClientRuntime(client, context) {
|
|
|
1893
1855
|
configuredClients.set(client, runtime);
|
|
1894
1856
|
client.addCloseHandler(() => {
|
|
1895
1857
|
runtime.closed = true;
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
runtime.evictionTimer = void 0;
|
|
1899
|
-
}
|
|
1858
|
+
clearTimeout(runtime.evictionTimer);
|
|
1859
|
+
runtime.evictionTimer = void 0;
|
|
1900
1860
|
for (const threadId of /* @__PURE__ */ new Set([
|
|
1901
1861
|
...runtime.retainedThreads.keys(),
|
|
1902
1862
|
...runtime.claimedThreads.keys(),
|
|
@@ -1957,10 +1917,8 @@ function ensureCodexAppServerClientRuntime(client, context) {
|
|
|
1957
1917
|
});
|
|
1958
1918
|
}
|
|
1959
1919
|
function scheduleRetainedThreadEviction(client, runtime) {
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
runtime.evictionTimer = void 0;
|
|
1963
|
-
}
|
|
1920
|
+
clearTimeout(runtime.evictionTimer);
|
|
1921
|
+
runtime.evictionTimer = void 0;
|
|
1964
1922
|
if (runtime.closed) return;
|
|
1965
1923
|
let expiresAt = Number.POSITIVE_INFINITY;
|
|
1966
1924
|
for (const [threadId, thread] of runtime.retainedThreads) if (!runtime.protectedThreads.has(threadId)) expiresAt = Math.min(expiresAt, thread.expiresAt);
|
|
@@ -2049,9 +2007,7 @@ async function retainCodexAppServerLiveThread(client, threadId, releaseThread, c
|
|
|
2049
2007
|
ephemeralPolicy,
|
|
2050
2008
|
serviceTier,
|
|
2051
2009
|
expiresAt: ephemeralPolicy === void 0 ? Date.now() + CODEX_APP_SERVER_LIVE_THREAD_IDLE_TIMEOUT_MS : Number.POSITIVE_INFINITY,
|
|
2052
|
-
release: (releaseThread ? physicalThreadReleases.get(releaseThread) ?? releaseThread : void 0) ?? (
|
|
2053
|
-
await unsubscribeCodexAppServerLiveThread(client, releasedThreadId, 5e3, assertCurrent, withCurrent);
|
|
2054
|
-
})
|
|
2010
|
+
release: (releaseThread ? physicalThreadReleases.get(releaseThread) ?? releaseThread : void 0) ?? defaultThreadRelease(client)
|
|
2055
2011
|
};
|
|
2056
2012
|
runtime.retainedThreads.set(threadId, retained);
|
|
2057
2013
|
if (previousOwner !== ownerToken) previousOwner?.invalidate();
|
|
@@ -2095,9 +2051,7 @@ async function claimCodexAppServerLiveThread(client, threadId, onInvalidated) {
|
|
|
2095
2051
|
}
|
|
2096
2052
|
return claimCodexAppServerThreadOwnership(client, runtime, threadId, runtime.retainedThreads.get(threadId) ?? {
|
|
2097
2053
|
expiresAt: Date.now() + CODEX_APP_SERVER_LIVE_THREAD_IDLE_TIMEOUT_MS,
|
|
2098
|
-
release:
|
|
2099
|
-
await unsubscribeCodexAppServerLiveThread(client, releasedThreadId, 5e3, assertCurrent, withCurrent);
|
|
2100
|
-
}
|
|
2054
|
+
release: defaultThreadRelease(client)
|
|
2101
2055
|
}, onInvalidated);
|
|
2102
2056
|
}
|
|
2103
2057
|
function claimCodexAppServerThreadOwnership(client, runtime, threadId, retained, onInvalidated) {
|
|
@@ -2312,15 +2266,13 @@ function supportsInferenceEnvironment(native) {
|
|
|
2312
2266
|
const lower = upper.toLowerCase();
|
|
2313
2267
|
if (native[upper] !== process.env[upper] || native[lower] !== process.env[lower] || native[upper] !== void 0 && native[lower] !== void 0 && native[upper] !== native[lower]) return false;
|
|
2314
2268
|
}
|
|
2315
|
-
const value = (name) =>
|
|
2316
|
-
const http = value(
|
|
2317
|
-
const https = value("HTTPS_PROXY");
|
|
2318
|
-
const all = value("ALL_PROXY");
|
|
2269
|
+
const value = (name) => native[name] ?? native[name.toLowerCase()];
|
|
2270
|
+
const [http, https, all] = names.slice(0, 3).map((name) => value(name)?.trim() || void 0);
|
|
2319
2271
|
if (!http && !https && !all) return true;
|
|
2320
2272
|
const noProxy = native.NO_PROXY ?? native.no_proxy ?? "";
|
|
2321
2273
|
if (noProxy === "*") return true;
|
|
2322
2274
|
if (native.REQUEST_METHOD !== void 0 || names.slice(0, 3).some((name) => {
|
|
2323
|
-
const raw =
|
|
2275
|
+
const raw = value(name);
|
|
2324
2276
|
return raw !== void 0 && raw !== raw.trim();
|
|
2325
2277
|
})) return false;
|
|
2326
2278
|
if ((https ?? all) !== (https ?? http ?? all)) return false;
|
|
@@ -2360,8 +2312,7 @@ function projectProviderRoutes(config, providers) {
|
|
|
2360
2312
|
return projected;
|
|
2361
2313
|
}
|
|
2362
2314
|
function readProviderBaseUrl(config, provider) {
|
|
2363
|
-
|
|
2364
|
-
return readProviderField(config, provider, "base_url");
|
|
2315
|
+
return provider === "openai" ? config?.openai_base_url : readProviderField(config, provider, "base_url");
|
|
2365
2316
|
}
|
|
2366
2317
|
function readProviderField(config, provider, field) {
|
|
2367
2318
|
const selected = (isJsonObject(config?.model_providers) ? config.model_providers : void 0)?.[provider];
|
|
@@ -2449,6 +2400,7 @@ async function prepareCodexInferenceRoute(params) {
|
|
|
2449
2400
|
...params.authority ? { withCurrent: params.authority.withCurrent } : {}
|
|
2450
2401
|
});
|
|
2451
2402
|
assertCurrent();
|
|
2403
|
+
const feature = (name) => params.config?.[`features.${name}`] ?? (isJsonObject(params.config?.features) ? params.config.features[name] : void 0) ?? (isJsonObject(snapshot.config.features) ? snapshot.config.features[name] : void 0);
|
|
2452
2404
|
const unsupported = () => {
|
|
2453
2405
|
if (owner.oauth) throw new Error("ChatGPT subscription sharing requires the managed public Responses inference route.");
|
|
2454
2406
|
};
|
|
@@ -2467,7 +2419,7 @@ async function prepareCodexInferenceRoute(params) {
|
|
|
2467
2419
|
"ollama",
|
|
2468
2420
|
"lmstudio"
|
|
2469
2421
|
].includes(provider) || hasProviderAws(params.config, provider) || hasProviderAws(snapshot.config, provider) || wireApi != null && wireApi !== "responses")) return unsupported();
|
|
2470
|
-
if ((
|
|
2422
|
+
if (feature("respect_system_proxy") === true) return unsupported();
|
|
2471
2423
|
const configured = customProvider ? providerField("base_url") : params.config?.openai_base_url ?? snapshot.config.openai_base_url;
|
|
2472
2424
|
if (configured != null && typeof configured !== "string") throw new Error("Codex inference upstream configuration is invalid");
|
|
2473
2425
|
if (typeof configured === "string" && (!configured.trim() || configured.includes("?") || configured.includes("#"))) return unsupported();
|
|
@@ -2506,7 +2458,7 @@ async function prepareCodexInferenceRoute(params) {
|
|
|
2506
2458
|
"windows.net/openai"
|
|
2507
2459
|
].some((marker) => nativeBaseUrl.includes(marker));
|
|
2508
2460
|
const preserveCodexBackendRoutes = nativeProviderName === "OpenAI" && (configured == null || configured.replace(/\/+$/, "").endsWith("/backend-api/codex"));
|
|
2509
|
-
const memoryFeature =
|
|
2461
|
+
const memoryFeature = feature("memories");
|
|
2510
2462
|
const modelPolicyEnforced = params.modelPolicyEnforced !== false;
|
|
2511
2463
|
const key = JSON.stringify([
|
|
2512
2464
|
provider,
|
|
@@ -2528,9 +2480,9 @@ async function prepareCodexInferenceRoute(params) {
|
|
|
2528
2480
|
throw new Error("Codex inference route limit reached; start a fresh managed native connection before retrying.");
|
|
2529
2481
|
}
|
|
2530
2482
|
pending = Promise.all([
|
|
2531
|
-
import("./inference-proxy-
|
|
2532
|
-
import("./native-subagent-monitor-
|
|
2533
|
-
import("./inference-dispatch-
|
|
2483
|
+
import("./inference-proxy-BDWV0djM.mjs"),
|
|
2484
|
+
import("./native-subagent-monitor-iHc8oLg5.mjs").then((n) => n.n),
|
|
2485
|
+
import("./inference-dispatch-CO6tTs4q.mjs")
|
|
2534
2486
|
]).then(([{ createCodexInferenceProxy }, native, { createCodexInferenceModelBinding }]) => {
|
|
2535
2487
|
assertClient();
|
|
2536
2488
|
return createCodexInferenceProxy({
|
|
@@ -2754,22 +2706,17 @@ async function waitForPreviousFence(previous, options) {
|
|
|
2754
2706
|
}
|
|
2755
2707
|
await new Promise((resolve, reject) => {
|
|
2756
2708
|
let timeout;
|
|
2757
|
-
const
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
timeout = void 0;
|
|
2761
|
-
}
|
|
2709
|
+
const settle = (error) => {
|
|
2710
|
+
clearTimeout(timeout);
|
|
2711
|
+
timeout = void 0;
|
|
2762
2712
|
options.signal?.removeEventListener("abort", onAbort);
|
|
2713
|
+
return error ? reject(error) : resolve();
|
|
2763
2714
|
};
|
|
2764
|
-
const
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
};
|
|
2768
|
-
const onAbort = () => settle(() => reject(new Error(options.abortMessage ?? "Codex native config fence aborted")));
|
|
2769
|
-
previous.then(() => settle(resolve));
|
|
2770
|
-
if (options.signal) options.signal.addEventListener("abort", onAbort, { once: true });
|
|
2715
|
+
const onAbort = () => settle(new Error(options.abortMessage ?? "Codex native config fence aborted"));
|
|
2716
|
+
previous.then(() => settle());
|
|
2717
|
+
options.signal?.addEventListener("abort", onAbort, { once: true });
|
|
2771
2718
|
if (options.timeoutMs !== void 0) {
|
|
2772
|
-
timeout = setTimeout(() => settle(
|
|
2719
|
+
timeout = setTimeout(() => settle(new Error(options.timeoutMessage ?? "Codex native config fence timed out")), Math.max(1, options.timeoutMs));
|
|
2773
2720
|
timeout.unref?.();
|
|
2774
2721
|
}
|
|
2775
2722
|
});
|
|
@@ -2802,7 +2749,7 @@ const nativeHookRelayUnregisterQueue = {
|
|
|
2802
2749
|
clearTimeout(entry.timeout);
|
|
2803
2750
|
entry.unregister();
|
|
2804
2751
|
}
|
|
2805
|
-
|
|
2752
|
+
await nativeHookRelayUnregisterQueue.clear();
|
|
2806
2753
|
},
|
|
2807
2754
|
async clear() {
|
|
2808
2755
|
for (const entry of pending) clearTimeout(entry.timeout);
|
|
@@ -3179,7 +3126,7 @@ async function acquireSharedCodexAppServerClient(options, leased = false) {
|
|
|
3179
3126
|
entry,
|
|
3180
3127
|
authProfileId: usesNativeAuth || preparedAuth?.kind === "api-key" ? null : authProfileId,
|
|
3181
3128
|
runtimeArtifactMode,
|
|
3182
|
-
|
|
3129
|
+
expectedRuntimeArtifact: options?.expectedRuntimeArtifact,
|
|
3183
3130
|
abandonSignal: entry.startupAbort.signal,
|
|
3184
3131
|
config: options?.config
|
|
3185
3132
|
}));
|
|
@@ -3274,7 +3221,7 @@ async function createIsolatedCodexAppServerClient(options) {
|
|
|
3274
3221
|
lifetime,
|
|
3275
3222
|
authProfileId: usesNativeAuth || context.preparedAuth?.kind === "api-key" ? null : context.authProfileId,
|
|
3276
3223
|
runtimeArtifactMode: options?.runtimeArtifactMode ?? (options?.expectedRuntimeArtifact ? "capture" : void 0),
|
|
3277
|
-
|
|
3224
|
+
expectedRuntimeArtifact: options?.expectedRuntimeArtifact,
|
|
3278
3225
|
config: options?.config,
|
|
3279
3226
|
timeoutMs: resolveRemainingAcquireTimeout(timeoutMs, startedAt),
|
|
3280
3227
|
abandonSignal,
|
|
@@ -3305,9 +3252,9 @@ async function startInitializedCodexAppServerClientOnce(params) {
|
|
|
3305
3252
|
const acquireStartedAt = performance.now();
|
|
3306
3253
|
const timeoutMs = params.timeoutMs ?? 0;
|
|
3307
3254
|
const abandonSignal = params.abandonSignal ? AbortSignal.any([params.lifetime.controller.signal, params.abandonSignal]) : params.lifetime.controller.signal;
|
|
3308
|
-
const waitForStartup = (operation,
|
|
3255
|
+
const waitForStartup = (operation, timeoutErrorFactory) => {
|
|
3309
3256
|
if (abandonSignal.aborted) throw new CodexAppServerStartupError("aborted", "codex app-server initialize aborted");
|
|
3310
|
-
return withCodexAppServerAcquireDeadline(resolveRemainingAcquireTimeout(timeoutMs, acquireStartedAt), ownCodexStartup(params.lifetime, operation()), abandonSignal,
|
|
3257
|
+
return withCodexAppServerAcquireDeadline(resolveRemainingAcquireTimeout(timeoutMs, acquireStartedAt), ownCodexStartup(params.lifetime, operation()), abandonSignal, CODEX_APP_SERVER_INITIALIZE_TIMEOUT_MESSAGE, timeoutErrorFactory);
|
|
3311
3258
|
};
|
|
3312
3259
|
const startOptionsCandidates = resolveManagedFallbackStartOptions(params.startOptions);
|
|
3313
3260
|
for (const [index, startOptions] of startOptionsCandidates.entries()) {
|
|
@@ -3349,7 +3296,7 @@ async function startInitializedCodexAppServerClientOnce(params) {
|
|
|
3349
3296
|
} finally {
|
|
3350
3297
|
artifactDrain?.cancel();
|
|
3351
3298
|
}
|
|
3352
|
-
const runtimeArtifactModule = params.runtimeArtifactMode ? await import("./runtime-artifact-
|
|
3299
|
+
const runtimeArtifactModule = params.runtimeArtifactMode ? await import("./runtime-artifact-C13pR7tD.mjs") : void 0;
|
|
3353
3300
|
const runtimeArtifactBeforeStart = runtimeArtifactModule ? await runtimeArtifactModule.captureCodexAppServerRuntimeArtifactBeforeStart({
|
|
3354
3301
|
startOptions,
|
|
3355
3302
|
spawnIdentity: resolveCodexAppServerSpawnIdentity(startOptions),
|
|
@@ -3396,7 +3343,7 @@ async function startInitializedCodexAppServerClientOnce(params) {
|
|
|
3396
3343
|
params.onStartedClient?.(client);
|
|
3397
3344
|
observeAcquire(params, { boundary: "initialize" });
|
|
3398
3345
|
try {
|
|
3399
|
-
await waitForStartup(() => client.initialize(),
|
|
3346
|
+
await waitForStartup(() => client.initialize(), () => buildCodexAppServerInitializeTimeoutError(client));
|
|
3400
3347
|
} catch (error) {
|
|
3401
3348
|
if (startOptions.commandSource === "resolved-managed" && index < startOptionsCandidates.length - 1 && isUnsupportedCodexAppServerVersionError(error)) continue;
|
|
3402
3349
|
throw error;
|
|
@@ -3497,12 +3444,12 @@ function resolveManagedFallbackStartOptions(startOptions) {
|
|
|
3497
3444
|
}
|
|
3498
3445
|
return candidates;
|
|
3499
3446
|
}
|
|
3447
|
+
function detachCurrentSharedClient(client) {
|
|
3448
|
+
const entry = client && getCurrentSharedClientEntry(client);
|
|
3449
|
+
return Boolean(entry && getSharedCodexAppServerClientState().clients.delete(entry.key));
|
|
3450
|
+
}
|
|
3500
3451
|
function clearSharedCodexAppServerClientIfCurrent(client) {
|
|
3501
|
-
if (!client) return false;
|
|
3502
|
-
const state = getSharedCodexAppServerClientState();
|
|
3503
|
-
const entry = getCurrentSharedClientEntry(client);
|
|
3504
|
-
if (!entry) return false;
|
|
3505
|
-
state.clients.delete(entry.key);
|
|
3452
|
+
if (!detachCurrentSharedClient(client)) return false;
|
|
3506
3453
|
client.close();
|
|
3507
3454
|
return true;
|
|
3508
3455
|
}
|
|
@@ -3573,11 +3520,7 @@ function hasLiveOlderDesktopGenerationClient(params) {
|
|
|
3573
3520
|
return false;
|
|
3574
3521
|
}
|
|
3575
3522
|
async function clearSharedCodexAppServerClientIfCurrentAndWait(client, options) {
|
|
3576
|
-
if (!client) return false;
|
|
3577
|
-
const state = getSharedCodexAppServerClientState();
|
|
3578
|
-
const entry = getCurrentSharedClientEntry(client);
|
|
3579
|
-
if (!entry) return false;
|
|
3580
|
-
state.clients.delete(entry.key);
|
|
3523
|
+
if (!detachCurrentSharedClient(client)) return false;
|
|
3581
3524
|
await client.closeAndWait(options);
|
|
3582
3525
|
return true;
|
|
3583
3526
|
}
|