@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
package/dist/index.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import { registerCodexCliMetadata } from "./cli-metadata.js";
|
|
2
|
-
import { A as unwrapNodeInvokePayload, C as readGatewayParams, E as requireOnlyKeys, S as readControlCursor, _ as normalizeLimit, a as CODEX_LOCAL_SESSION_HOST_ID, b as parseTranscriptPage, f as catalogError, g as isInteractiveThreadSource, h as filterCatalogPageByTitle, i as CODEX_CATALOG_TRANSCRIPT_READ_COMMAND, j as CODEX_INTERACTIVE_THREAD_SOURCE_KINDS, l as MAX_TRANSCRIPT_PAGE_BYTES, n as CODEX_APP_SERVER_THREADS_LIST_COMMAND, o as CatalogParamsError, r as CODEX_APP_SERVER_THREAD_TURNS_LIST_COMMAND, s as MAX_CURSOR_LENGTH, t as CODEX_APP_SERVER_THREADS_CAPABILITY, u as NODE_INVOKE_TIMEOUT_MS, v as parseCatalogPage, w as readPageParams, x as readBoundedOptionalString, y as parseJsonParams } from "./.setup/session-catalog-parsing-
|
|
2
|
+
import { A as unwrapNodeInvokePayload, C as readGatewayParams, E as requireOnlyKeys, S as readControlCursor, _ as normalizeLimit, a as CODEX_LOCAL_SESSION_HOST_ID, b as parseTranscriptPage, f as catalogError, g as isInteractiveThreadSource, h as filterCatalogPageByTitle, i as CODEX_CATALOG_TRANSCRIPT_READ_COMMAND, j as CODEX_INTERACTIVE_THREAD_SOURCE_KINDS, l as MAX_TRANSCRIPT_PAGE_BYTES, n as CODEX_APP_SERVER_THREADS_LIST_COMMAND, o as CatalogParamsError, r as CODEX_APP_SERVER_THREAD_TURNS_LIST_COMMAND, s as MAX_CURSOR_LENGTH, t as CODEX_APP_SERVER_THREADS_CAPABILITY, u as NODE_INVOKE_TIMEOUT_MS, v as parseCatalogPage, w as readPageParams, x as readBoundedOptionalString, y as parseJsonParams } from "./.setup/session-catalog-parsing-DkeoVn60.mjs";
|
|
3
3
|
import { i as isJsonObject, n as assertCodexThreadForkParams } from "./.setup/protocol-CANUwXJ3.mjs";
|
|
4
|
-
import { d as readCurrentCodexNativeSubagentSubmissions, f as readCurrentNativePendingAssignments, l as readCurrentCodexAppServerBinding, m as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced, u as readCurrentCodexAppServerBindings } from "./.setup/session-binding-record-
|
|
5
|
-
import { n as defineCodexBuildState } from "./.setup/build-state-
|
|
4
|
+
import { d as readCurrentCodexNativeSubagentSubmissions, f as readCurrentNativePendingAssignments, l as readCurrentCodexAppServerBinding, m as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced, u as readCurrentCodexAppServerBindings } from "./.setup/session-binding-record-DU_0biMD.mjs";
|
|
5
|
+
import { n as defineCodexBuildState } from "./.setup/build-state-CzLMy1S9.mjs";
|
|
6
6
|
import { createCodexAppServerAgentHarness, createCodexAppServerNativeCompaction } from "./harness.js";
|
|
7
7
|
import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
8
8
|
import codexProviderDiscovery from "./provider-discovery.js";
|
|
9
9
|
import { n as createCodexAuthProfileSelection } from "./.setup/auth-profile-selection-hr8ocLtz.mjs";
|
|
10
|
-
import { t as assertCodexAppServerConnectionSecurity } from "./.setup/config-security-
|
|
11
|
-
import { d as readCodexPluginConfig } from "./.setup/config-parsing-
|
|
10
|
+
import { t as assertCodexAppServerConnectionSecurity } from "./.setup/config-security-clxAZYWX.mjs";
|
|
11
|
+
import { d as readCodexPluginConfig } from "./.setup/config-parsing-DsWSCPHO.mjs";
|
|
12
12
|
import { n as resolveCodexAppServerLocalHomeDir, r as resolveCodexAppServerUserHomeDir, t as resolveCodexAppServerHomeDir } from "./.setup/auth-start-options-BPIPeEX8.mjs";
|
|
13
|
-
import { r as createCodexAppServerConfig, t as codexAppServerStartOptionsKey } from "./.setup/config-options-
|
|
14
|
-
import { o as setManagedCodexPluginRoot } from "./.setup/managed-binary-
|
|
15
|
-
import { O as createCodexDesktopGenerationService, T as retireSharedCodexAppServerClientsBeforeDesktopGeneration, m as hasActiveSharedCodexAppServerWork, p as getSharedCodexAppServerClientState, s as resolveCodexAppServerFallbackApiKeyCacheKey } from "./.setup/auth-cache-key-
|
|
13
|
+
import { r as createCodexAppServerConfig, t as codexAppServerStartOptionsKey } from "./.setup/config-options-DDzeNQ8m.mjs";
|
|
14
|
+
import { o as setManagedCodexPluginRoot } from "./.setup/managed-binary-BtIjV7yN.mjs";
|
|
15
|
+
import { O as createCodexDesktopGenerationService, T as retireSharedCodexAppServerClientsBeforeDesktopGeneration, m as hasActiveSharedCodexAppServerWork, p as getSharedCodexAppServerClientState, s as resolveCodexAppServerFallbackApiKeyCacheKey } from "./.setup/auth-cache-key-DyfUvsSa.mjs";
|
|
16
16
|
import { i as CODEX_APP_SERVER_BINDING_NAMESPACE, r as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./.setup/session-binding-meta-Lkm5Lpf4.mjs";
|
|
17
|
-
import {
|
|
17
|
+
import { c as createCodexAppServerProcessReaperService } from "./.setup/transport-stdio-CRWTkKOn.mjs";
|
|
18
18
|
import { n as codexNativeProfileRecoveryService } from "./.setup/auth-profile-health-oHizqgye.mjs";
|
|
19
|
-
import { n as withCodexConversationThreadActivity } from "./.setup/thread-ownership-queue-
|
|
19
|
+
import { n as withCodexConversationThreadActivity } from "./.setup/thread-ownership-queue-CeyYScUC.mjs";
|
|
20
20
|
import { a as canMutateCodexHost, r as CODEX_NATIVE_EXECUTION_AUTH_ERROR } from "./.setup/command-authorization-AikPDtcc.mjs";
|
|
21
|
-
import { o as formatCodexDisplayText } from "./.setup/command-formatters-
|
|
22
|
-
import { a as readCodexConversationBindingDataRecord, i as readCodexConversationBindingData, o as resolveCodexDefaultWorkspaceDir } from "./.setup/conversation-binding-data-
|
|
23
|
-
import { t as buildCodexMigrationProvider } from "./.setup/provider-
|
|
24
|
-
import { r as CodexAppServerRpcError, s as isCodexThreadReadMissingError } from "./.setup/rpc-error-
|
|
25
|
-
import { t as CODEX_CONTROL_METHODS } from "./.setup/capabilities-
|
|
26
|
-
import { n as filterCodexMarketplacePlugins, t as discoverCodexMarketplacePlugins } from "./.setup/plugin-marketplace-discovery-
|
|
27
|
-
import { t as assertCodexArchiveDescendantsUnowned } from "./.setup/thread-archive-guard-
|
|
28
|
-
import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, s as listCodexCliSessionsOnNode } from "./.setup/node-cli-sessions-
|
|
21
|
+
import { o as formatCodexDisplayText } from "./.setup/command-formatters-xW9KpoSZ.mjs";
|
|
22
|
+
import { a as readCodexConversationBindingDataRecord, i as readCodexConversationBindingData, o as resolveCodexDefaultWorkspaceDir } from "./.setup/conversation-binding-data-UgLuTSQT.mjs";
|
|
23
|
+
import { t as buildCodexMigrationProvider } from "./.setup/provider-BJ4xhaGX.mjs";
|
|
24
|
+
import { r as CodexAppServerRpcError, s as isCodexThreadReadMissingError } from "./.setup/rpc-error-C98SHchT.mjs";
|
|
25
|
+
import { t as CODEX_CONTROL_METHODS } from "./.setup/capabilities-DbOzOglY.mjs";
|
|
26
|
+
import { n as filterCodexMarketplacePlugins, t as discoverCodexMarketplacePlugins } from "./.setup/plugin-marketplace-discovery-BblHM3DU.mjs";
|
|
27
|
+
import { t as assertCodexArchiveDescendantsUnowned } from "./.setup/thread-archive-guard-LKdwQKyr.mjs";
|
|
28
|
+
import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, s as listCodexCliSessionsOnNode } from "./.setup/node-cli-sessions-CzKg2nGq.mjs";
|
|
29
29
|
import { n as codexCatalogHomeIdFromCanonicalPath } from "./.setup/session-catalog-home-id-vlih0B_g.mjs";
|
|
30
|
-
import { t as CODEX_CATALOG_MAX_ROWS } from "./.setup/session-catalog-limits-
|
|
31
|
-
import { a as CodexCatalogLoadingError, n as currentCodexCatalogListRequest, o as
|
|
32
|
-
import { i as withTimeout$1 } from "./.setup/timeout-
|
|
33
|
-
import { t as lookupNodeCodexCatalogRecord } from "./.setup/session-catalog-node-lookup-
|
|
34
|
-
import { r as projectCodexUserItemText } from "./.setup/transcript-history-projection-
|
|
30
|
+
import { t as CODEX_CATALOG_MAX_ROWS } from "./.setup/session-catalog-limits-BynIoOYm.mjs";
|
|
31
|
+
import { a as CodexCatalogLoadingError, n as currentCodexCatalogListRequest, o as withCodexCatalogLoadingTimeout, r as withCodexCatalogListRequest, s as CODEX_CATALOG_STATE_NAMESPACE, t as CodexCatalogListRequest } from "./.setup/session-catalog-list-request-D4MYNgDB.mjs";
|
|
32
|
+
import { i as withTimeout$1 } from "./.setup/timeout-D0mEWSGG.mjs";
|
|
33
|
+
import { t as lookupNodeCodexCatalogRecord } from "./.setup/session-catalog-node-lookup-BH_DBGa9.mjs";
|
|
34
|
+
import { r as projectCodexUserItemText } from "./.setup/transcript-history-projection-DfKcoZCB.mjs";
|
|
35
35
|
import { r as codexUpstreamContinueResult } from "./.setup/session-upstream-marker-D15C9NHp.mjs";
|
|
36
|
-
import { t as buildCodexAppServerConnectionFingerprint } from "./.setup/plugin-app-cache-key-
|
|
36
|
+
import { t as buildCodexAppServerConnectionFingerprint } from "./.setup/plugin-app-cache-key-Bg9DbDI6.mjs";
|
|
37
37
|
import { n as readCodexSessionMeta } from "./.setup/session-catalog-provenance-CmsOE5mh.mjs";
|
|
38
|
-
import { t as codexCatalogResidentHomeKey } from "./.setup/session-catalog-events-
|
|
39
|
-
import { a as setCodexCatalogConnectionHomeResolver } from "./.setup/binding-connection-
|
|
38
|
+
import { t as codexCatalogResidentHomeKey } from "./.setup/session-catalog-events-DzFlXNUe.mjs";
|
|
39
|
+
import { a as setCodexCatalogConnectionHomeResolver } from "./.setup/binding-connection-B7HAAZSI.mjs";
|
|
40
40
|
import { n as findCodexAppServerSpawnError } from "./.setup/spawn-error-CL3n6MAa.mjs";
|
|
41
|
-
import { r as requestCodexAppServerJson } from "./.setup/request-
|
|
41
|
+
import { r as requestCodexAppServerJson } from "./.setup/request-Y8dmbqZ3.mjs";
|
|
42
42
|
import { t as createCodexWebSearchProviderBase } from "./.setup/web-search-provider.shared-BrZmlqyR.mjs";
|
|
43
43
|
import { normalizePluginsConfig, resolveEffectiveEnableState, resolveLivePluginConfigObject, resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
44
44
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
@@ -70,7 +70,7 @@ import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
|
70
70
|
//#region extensions/codex/src/account-usage.ts
|
|
71
71
|
function registerCodexAccountUsage(api) {
|
|
72
72
|
api.registerGatewayMethod("codex.accountUsage", async (options) => {
|
|
73
|
-
const { handleCodexAccountUsage } = await import("./.setup/account-usage-runtime-
|
|
73
|
+
const { handleCodexAccountUsage } = await import("./.setup/account-usage-runtime-QBZsvZS8.mjs");
|
|
74
74
|
await handleCodexAccountUsage(options);
|
|
75
75
|
}, { scope: "operator.admin" });
|
|
76
76
|
}
|
|
@@ -82,7 +82,7 @@ function createCodexAppServerConnectionHealthService(options) {
|
|
|
82
82
|
let abortController;
|
|
83
83
|
let monitor;
|
|
84
84
|
const run = async (ctx, signal) => {
|
|
85
|
-
const { resolveCodexAppServerRuntimeOptions } = await import("./.setup/config-runtime-
|
|
85
|
+
const { resolveCodexAppServerRuntimeOptions } = await import("./.setup/config-runtime-DWzK-k0n.mjs").then((n) => n.t);
|
|
86
86
|
let consecutiveFailures = 0;
|
|
87
87
|
while (!signal.aborted) {
|
|
88
88
|
let pluginConfig;
|
|
@@ -98,9 +98,9 @@ function createCodexAppServerConnectionHealthService(options) {
|
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
if (runtime.start.transport !== "websocket") return;
|
|
101
|
-
const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./.setup/shared-client-
|
|
101
|
+
const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./.setup/shared-client-ByIwuAC-.mjs").then((n) => n.v);
|
|
102
102
|
const { sleepWithAbort } = await import("openclaw/plugin-sdk/runtime-env");
|
|
103
|
-
const { isUnsupportedCodexAppServerVersionError } = await import("./.setup/client-
|
|
103
|
+
const { isUnsupportedCodexAppServerVersionError } = await import("./.setup/client-y7nO6X9c.mjs").then((n) => n.n);
|
|
104
104
|
if (signal.aborted) return;
|
|
105
105
|
let leasedClient;
|
|
106
106
|
try {
|
|
@@ -206,11 +206,8 @@ function createCodexManagedThreadStore(state) {
|
|
|
206
206
|
sourceHomeId,
|
|
207
207
|
threadId
|
|
208
208
|
});
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
ids = /* @__PURE__ */ new Set();
|
|
212
|
-
byHome.set(sourceHomeId, ids);
|
|
213
|
-
}
|
|
209
|
+
const ids = byHome.get(sourceHomeId) ?? /* @__PURE__ */ new Set();
|
|
210
|
+
byHome.set(sourceHomeId, ids);
|
|
214
211
|
ids.add(threadId);
|
|
215
212
|
if (memberships.size > 2e4) {
|
|
216
213
|
const oldest = memberships.entries().next().value;
|
|
@@ -270,7 +267,7 @@ function createCodexManagedThreadStore(state) {
|
|
|
270
267
|
/** Keeps lifecycle/auth loading behind mutations while sharing the canonical read codec. */
|
|
271
268
|
function createLazyCodexAppServerBindingStore(state, managedThreadState) {
|
|
272
269
|
let resolved;
|
|
273
|
-
const store = () => resolved ??= import("./.setup/session-binding-
|
|
270
|
+
const store = () => resolved ??= import("./.setup/session-binding-JEHNMPsr.mjs").then((n) => n.a).then(({ createCodexAppServerBindingStore }) => createCodexAppServerBindingStore(state));
|
|
274
271
|
const managedThreads = managedThreadState ? createCodexManagedThreadStore(managedThreadState) : void 0;
|
|
275
272
|
return {
|
|
276
273
|
...managedThreads ? { managedThreads } : {},
|
|
@@ -291,7 +288,6 @@ function createLazyCodexAppServerBindingStore(state, managedThreadState) {
|
|
|
291
288
|
}
|
|
292
289
|
//#endregion
|
|
293
290
|
//#region extensions/codex/src/commands.ts
|
|
294
|
-
/** Creates the reserved `/codex` command definition exposed by the plugin. */
|
|
295
291
|
function createCodexCommand(options) {
|
|
296
292
|
return {
|
|
297
293
|
name: "codex",
|
|
@@ -318,7 +314,7 @@ function createCodexCommand(options) {
|
|
|
318
314
|
...ctx,
|
|
319
315
|
gatewayClientScopes: ctx.gatewayClientScopes?.slice()
|
|
320
316
|
};
|
|
321
|
-
const { handleCodexCommand } = await import("./.setup/command-dispatch-
|
|
317
|
+
const { handleCodexCommand } = await import("./.setup/command-dispatch-uA9lz2Kf.mjs");
|
|
322
318
|
return handleCodexCommand(commandContext, options);
|
|
323
319
|
}
|
|
324
320
|
};
|
|
@@ -346,22 +342,22 @@ async function handleCodexConversationInboundClaim(event, ctx, options) {
|
|
|
346
342
|
reply: { text: CODEX_NATIVE_EXECUTION_AUTH_ERROR }
|
|
347
343
|
};
|
|
348
344
|
const sessionKey = event.sessionKey ?? ctx.sessionKey;
|
|
349
|
-
|
|
350
|
-
return {
|
|
345
|
+
try {
|
|
346
|
+
if (data.kind === "codex-cli-node-session") return {
|
|
351
347
|
handled: true,
|
|
352
|
-
reply:
|
|
353
|
-
const { resolveCodexNativeSandboxBlock } = await import("./.setup/sandbox-guard-
|
|
348
|
+
reply: { text: await getNodeConversationState().queue.enqueue(`${data.nodeId}:${data.sessionId}`, async () => {
|
|
349
|
+
const { resolveCodexNativeSandboxBlock } = await import("./.setup/sandbox-guard-DIImwCy1.mjs").then((n) => n.r);
|
|
354
350
|
const blocked = resolveCodexNativeSandboxBlock({
|
|
355
351
|
config: options.config,
|
|
356
352
|
sessionKey,
|
|
357
353
|
surface: "Codex CLI node conversation binding"
|
|
358
354
|
});
|
|
359
|
-
if (blocked) return
|
|
355
|
+
if (blocked) return blocked;
|
|
360
356
|
const resume = options.resumeCodexCliSessionOnNode;
|
|
361
|
-
if (!resume) return
|
|
357
|
+
if (!resume) return "Codex CLI node binding is unavailable because Gateway node runtime is not attached.";
|
|
362
358
|
const { getSessionBindingService } = await import("openclaw/plugin-sdk/conversation-binding-runtime");
|
|
363
|
-
if (!isCurrentPublicBinding(publicBinding, getSessionBindingService())) return
|
|
364
|
-
return
|
|
359
|
+
if (!isCurrentPublicBinding(publicBinding, getSessionBindingService())) return "This Codex conversation was detached or changed before its message could run.";
|
|
360
|
+
return (await resume({
|
|
365
361
|
nodeId: data.nodeId,
|
|
366
362
|
sessionId: data.sessionId,
|
|
367
363
|
agentId: data.agentId,
|
|
@@ -369,16 +365,9 @@ async function handleCodexConversationInboundClaim(event, ctx, options) {
|
|
|
369
365
|
prompt,
|
|
370
366
|
cwd: data.cwd,
|
|
371
367
|
timeoutMs: options.timeoutMs
|
|
372
|
-
})).text.trim() || "Codex completed without a text reply."
|
|
373
|
-
})
|
|
374
|
-
};
|
|
375
|
-
} catch (error) {
|
|
376
|
-
return {
|
|
377
|
-
handled: true,
|
|
378
|
-
reply: { text: `Codex CLI node turn failed: ${formatCodexDisplayText(formatErrorMessage(error))}` }
|
|
368
|
+
})).text.trim() || "Codex completed without a text reply.";
|
|
369
|
+
}) }
|
|
379
370
|
};
|
|
380
|
-
}
|
|
381
|
-
try {
|
|
382
371
|
const identity = {
|
|
383
372
|
kind: "conversation",
|
|
384
373
|
bindingId: data.bindingId
|
|
@@ -386,19 +375,19 @@ async function handleCodexConversationInboundClaim(event, ctx, options) {
|
|
|
386
375
|
const expected = options.bindingStore.read(identity);
|
|
387
376
|
return {
|
|
388
377
|
handled: true,
|
|
389
|
-
reply:
|
|
390
|
-
const { resolveCodexNativeExecutionBlock } = await import("./.setup/sandbox-guard-
|
|
378
|
+
reply: await withCodexConversationThreadActivity(data.bindingId, async () => {
|
|
379
|
+
const { resolveCodexNativeExecutionBlock } = await import("./.setup/sandbox-guard-DIImwCy1.mjs").then((n) => n.r);
|
|
391
380
|
const nativeExecutionBlock = resolveCodexNativeExecutionBlock({
|
|
392
381
|
config: options.config,
|
|
393
382
|
sessionKey,
|
|
394
383
|
agentId: data.agentId,
|
|
395
384
|
surface: "Codex app-server conversation binding"
|
|
396
385
|
});
|
|
397
|
-
if (nativeExecutionBlock) return {
|
|
386
|
+
if (nativeExecutionBlock) return { text: nativeExecutionBlock };
|
|
398
387
|
const { getSessionBindingService } = await import("openclaw/plugin-sdk/conversation-binding-runtime");
|
|
399
|
-
const { runBoundTurnWithMissingThreadRecovery } = await import("./.setup/conversation-binding-
|
|
388
|
+
const { runBoundTurnWithMissingThreadRecovery } = await import("./.setup/conversation-binding-CTSLDM9S.mjs");
|
|
400
389
|
const current = options.bindingStore.read(identity);
|
|
401
|
-
if (!isCurrentPublicBinding(publicBinding, getSessionBindingService()) || expected && (!current || current.threadId !== expected.threadId || current.conversationStartId !== expected.conversationStartId) || !expected && current && data.start?.id && current.conversationStartId !== data.start.id) return {
|
|
390
|
+
if (!isCurrentPublicBinding(publicBinding, getSessionBindingService()) || expected && (!current || current.threadId !== expected.threadId || current.conversationStartId !== expected.conversationStartId) || !expected && current && data.start?.id && current.conversationStartId !== data.start.id) return { text: "This Codex conversation was detached or changed before its message could run." };
|
|
402
391
|
return await runBoundTurnWithMissingThreadRecovery({
|
|
403
392
|
bindingStore: options.bindingStore,
|
|
404
393
|
data,
|
|
@@ -410,12 +399,12 @@ async function handleCodexConversationInboundClaim(event, ctx, options) {
|
|
|
410
399
|
pluginConfig: options.pluginConfig,
|
|
411
400
|
timeoutMs: options.timeoutMs
|
|
412
401
|
});
|
|
413
|
-
})
|
|
402
|
+
})
|
|
414
403
|
};
|
|
415
404
|
} catch (error) {
|
|
416
405
|
return {
|
|
417
406
|
handled: true,
|
|
418
|
-
reply: { text:
|
|
407
|
+
reply: { text: `${data.kind === "codex-cli-node-session" ? "Codex CLI node" : "Codex app-server"} turn failed: ${formatCodexDisplayText(formatErrorMessage(error))}` }
|
|
419
408
|
};
|
|
420
409
|
}
|
|
421
410
|
}
|
|
@@ -430,7 +419,7 @@ async function handleCodexConversationBindingResolved(event, options) {
|
|
|
430
419
|
const binding = options.bindingStore.read(identity);
|
|
431
420
|
assertCodexBindingMayBeReplaced(binding, "clearing a denied conversation binding");
|
|
432
421
|
if (binding && (!data.start?.id || binding.conversationStartId === data.start.id)) await withCodexConversationThreadActivity(identity.bindingId, async () => {
|
|
433
|
-
const { retireCodexConversationThreadBinding } = await import("./.setup/thread-ownership-
|
|
422
|
+
const { retireCodexConversationThreadBinding } = await import("./.setup/thread-ownership-Be53aiaG.mjs").then((n) => n.o);
|
|
434
423
|
return retireCodexConversationThreadBinding({
|
|
435
424
|
bindingStore: options.bindingStore,
|
|
436
425
|
identity,
|
|
@@ -465,7 +454,7 @@ function createCodexPluginsTool(options) {
|
|
|
465
454
|
const query = typeof params.query === "string" ? params.query : "";
|
|
466
455
|
const marketplace = typeof params.marketplace === "string" ? params.marketplace.trim() : void 0;
|
|
467
456
|
const limit = typeof params.limit === "number" && Number.isInteger(params.limit) ? Math.max(1, Math.min(params.limit, 20)) : 12;
|
|
468
|
-
const { codexBindingConnectionSelection, resolveCodexBindingAppServerConnection } = await import("./.setup/binding-connection-
|
|
457
|
+
const { codexBindingConnectionSelection, resolveCodexBindingAppServerConnection } = await import("./.setup/binding-connection-B7HAAZSI.mjs").then((n) => n.n);
|
|
469
458
|
const pluginConfig = options.getPluginConfig();
|
|
470
459
|
const config = runtimeConfig();
|
|
471
460
|
const identity = options.context.sessionId ? sessionBindingIdentity({
|
|
@@ -482,7 +471,7 @@ function createCodexPluginsTool(options) {
|
|
|
482
471
|
if (runtimeConfig() !== config || !isDeepStrictEqual(options.getPluginConfig(), pluginConfig) || !isDeepStrictEqual(codexBindingConnectionSelection(readBinding()), selection)) throw new Error("Codex plugin discovery ownership changed; retry the request.");
|
|
483
472
|
};
|
|
484
473
|
const workspaceDir = binding?.cwd?.trim() || options.context.workspaceDir?.trim() || resolveCodexDefaultWorkspaceDir(pluginConfig);
|
|
485
|
-
const request = options.request ?? (await import("./.setup/command-rpc-
|
|
474
|
+
const request = options.request ?? (await import("./.setup/command-rpc-C9VxOLuG.mjs").then((n) => n.n)).codexControlRequest;
|
|
486
475
|
const connection = await resolveCodexBindingAppServerConnection({
|
|
487
476
|
binding,
|
|
488
477
|
pluginConfig,
|
|
@@ -535,50 +524,42 @@ function projectAvailablePlugin(plugin) {
|
|
|
535
524
|
/**
|
|
536
525
|
* Owner-only access to native Codex threads stored in the user's Codex home.
|
|
537
526
|
*/
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
maximum: 100
|
|
545
|
-
})),
|
|
546
|
-
search: Type.Optional(Type.String())
|
|
547
|
-
}, { additionalProperties: false });
|
|
548
|
-
const ReadParamsSchema = Type.Object({
|
|
549
|
-
action: Type.Literal("read"),
|
|
550
|
-
thread_id: Type.String(),
|
|
551
|
-
include_turns: Type.Optional(Type.Boolean())
|
|
552
|
-
}, { additionalProperties: false });
|
|
553
|
-
const ForkParamsSchema = Type.Object({
|
|
554
|
-
action: Type.Literal("fork"),
|
|
555
|
-
thread_id: Type.String(),
|
|
556
|
-
attach: Type.Optional(Type.Boolean({
|
|
557
|
-
default: true,
|
|
558
|
-
description: "Attach the fork to this OpenClaw session for its next turn."
|
|
559
|
-
}))
|
|
560
|
-
}, { additionalProperties: false });
|
|
561
|
-
const RenameParamsSchema = Type.Object({
|
|
562
|
-
action: Type.Literal("rename"),
|
|
563
|
-
thread_id: Type.String(),
|
|
564
|
-
name: Type.String()
|
|
565
|
-
}, { additionalProperties: false });
|
|
566
|
-
const ArchiveParamsSchema = Type.Object({
|
|
567
|
-
action: Type.Literal("archive"),
|
|
568
|
-
thread_id: Type.String(),
|
|
569
|
-
confirm: Type.Literal(true, { description: "Required acknowledgement that the thread is closed in other Codex clients." })
|
|
570
|
-
}, { additionalProperties: false });
|
|
571
|
-
const UnarchiveParamsSchema = Type.Object({
|
|
572
|
-
action: Type.Literal("unarchive"),
|
|
573
|
-
thread_id: Type.String()
|
|
574
|
-
}, { additionalProperties: false });
|
|
527
|
+
function threadActionSchema(action, properties) {
|
|
528
|
+
return Type.Object({
|
|
529
|
+
action: Type.Literal(action),
|
|
530
|
+
...properties
|
|
531
|
+
}, { additionalProperties: false });
|
|
532
|
+
}
|
|
575
533
|
const CodexThreadsParamsSchema = Type.Union([
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
534
|
+
threadActionSchema("list", {
|
|
535
|
+
archived: Type.Optional(Type.Boolean()),
|
|
536
|
+
cursor: Type.Optional(Type.String()),
|
|
537
|
+
limit: Type.Optional(Type.Integer({
|
|
538
|
+
minimum: 1,
|
|
539
|
+
maximum: 100
|
|
540
|
+
})),
|
|
541
|
+
search: Type.Optional(Type.String())
|
|
542
|
+
}),
|
|
543
|
+
threadActionSchema("read", {
|
|
544
|
+
thread_id: Type.String(),
|
|
545
|
+
include_turns: Type.Optional(Type.Boolean())
|
|
546
|
+
}),
|
|
547
|
+
threadActionSchema("fork", {
|
|
548
|
+
thread_id: Type.String(),
|
|
549
|
+
attach: Type.Optional(Type.Boolean({
|
|
550
|
+
default: true,
|
|
551
|
+
description: "Attach the fork to this OpenClaw session for its next turn."
|
|
552
|
+
}))
|
|
553
|
+
}),
|
|
554
|
+
threadActionSchema("rename", {
|
|
555
|
+
thread_id: Type.String(),
|
|
556
|
+
name: Type.String()
|
|
557
|
+
}),
|
|
558
|
+
threadActionSchema("archive", {
|
|
559
|
+
thread_id: Type.String(),
|
|
560
|
+
confirm: Type.Literal(true, { description: "Required acknowledgement that the thread is closed in other Codex clients." })
|
|
561
|
+
}),
|
|
562
|
+
threadActionSchema("unarchive", { thread_id: Type.String() })
|
|
582
563
|
]);
|
|
583
564
|
function readThreadId(params) {
|
|
584
565
|
return readStringParam(params, "thread_id", {
|
|
@@ -635,12 +616,6 @@ function createCodexThreadsTool(options) {
|
|
|
635
616
|
};
|
|
636
617
|
};
|
|
637
618
|
const runtimeConfig = () => options.context.getRuntimeConfig?.() ?? options.context.runtimeConfig ?? options.context.config;
|
|
638
|
-
const baseRequestOptions = () => ({
|
|
639
|
-
agentDir: options.context.agentDir,
|
|
640
|
-
config: runtimeConfig(),
|
|
641
|
-
sessionId: options.context.sessionId,
|
|
642
|
-
sessionKey: options.context.sessionKey
|
|
643
|
-
});
|
|
644
619
|
const currentIdentity = (sessionId) => sessionBindingIdentity({
|
|
645
620
|
sessionId,
|
|
646
621
|
sessionKey: options.context.sessionKey,
|
|
@@ -660,14 +635,17 @@ function createCodexThreadsTool(options) {
|
|
|
660
635
|
const threadResult = (response) => jsonResult(mayReadRawTranscripts ? response : redactNativeThreadResponse(response));
|
|
661
636
|
if ((action === "fork" || action === "rename" || action === "archive" || action === "unarchive") && supervision?.enabled === true && supervision.allowWriteControls !== true) throw new Error("Codex native thread mutations are disabled for this codex plugin supervision config.");
|
|
662
637
|
const run = async (archiveAdmission) => {
|
|
663
|
-
const request = options.request ?? (await import("./.setup/command-rpc-
|
|
638
|
+
const request = options.request ?? (await import("./.setup/command-rpc-C9VxOLuG.mjs").then((n) => n.n)).codexControlRequest;
|
|
664
639
|
const { isModelSelectionLocked, ModelSelectionLockedError } = await import("openclaw/plugin-sdk/model-session-runtime");
|
|
665
|
-
const { codexBindingConnectionSelection, resolveCodexBindingAppServerConnection } = await import("./.setup/binding-connection-
|
|
666
|
-
const { resolveCodexSupervisionAppServerRuntimeOptions } = await import("./.setup/config-runtime-
|
|
640
|
+
const { codexBindingConnectionSelection, resolveCodexBindingAppServerConnection } = await import("./.setup/binding-connection-B7HAAZSI.mjs").then((n) => n.n);
|
|
641
|
+
const { resolveCodexSupervisionAppServerRuntimeOptions } = await import("./.setup/config-runtime-DWzK-k0n.mjs").then((n) => n.t);
|
|
667
642
|
const requestOptions = async () => {
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
|
|
643
|
+
const base = {
|
|
644
|
+
agentDir: options.context.agentDir,
|
|
645
|
+
config: runtimeConfig(),
|
|
646
|
+
sessionId: options.context.sessionId,
|
|
647
|
+
sessionKey: options.context.sessionKey
|
|
648
|
+
};
|
|
671
649
|
const session = currentSession();
|
|
672
650
|
const identity = session ? currentIdentity(session.sessionId) : void 0;
|
|
673
651
|
const readBinding = () => identity ? options.bindingStore.read(identity) : void 0;
|
|
@@ -676,12 +654,12 @@ function createCodexThreadsTool(options) {
|
|
|
676
654
|
const assertCurrent = () => {
|
|
677
655
|
options.context.assertInvocationCurrent?.();
|
|
678
656
|
const current = currentSession();
|
|
679
|
-
if (runtimeConfig() !== base.config || !isDeepStrictEqual(options.getPluginConfig(),
|
|
657
|
+
if (runtimeConfig() !== base.config || !isDeepStrictEqual(options.getPluginConfig(), admissionConfig) || current?.sessionId !== session?.sessionId || current?.entry?.sessionId !== session?.entry?.sessionId || isModelSelectionLocked(current?.entry) !== isModelSelectionLocked(session?.entry) || !isDeepStrictEqual(codexBindingConnectionSelection(readBinding()), selection)) throw new Error("Codex native thread ownership changed; retry the request.");
|
|
680
658
|
};
|
|
681
|
-
if (binding?.connectionScope === "supervision" ||
|
|
659
|
+
if (binding?.connectionScope === "supervision" || admissionPlugin.appServer?.homeScope === "user") {
|
|
682
660
|
const connection = await resolveCodexBindingAppServerConnection({
|
|
683
661
|
binding,
|
|
684
|
-
pluginConfig,
|
|
662
|
+
pluginConfig: admissionConfig,
|
|
685
663
|
config: base.config,
|
|
686
664
|
agentDir: base.agentDir,
|
|
687
665
|
assertCurrent
|
|
@@ -693,10 +671,10 @@ function createCodexThreadsTool(options) {
|
|
|
693
671
|
assertCurrent
|
|
694
672
|
};
|
|
695
673
|
}
|
|
696
|
-
if (
|
|
674
|
+
if (supervision?.enabled !== true) throw new Error("Codex native thread access is disabled for this run.");
|
|
697
675
|
return {
|
|
698
676
|
...base,
|
|
699
|
-
startOptions: resolveCodexSupervisionAppServerRuntimeOptions({ pluginConfig }).start,
|
|
677
|
+
startOptions: resolveCodexSupervisionAppServerRuntimeOptions({ pluginConfig: admissionConfig }).start,
|
|
700
678
|
authProfileId: null,
|
|
701
679
|
assertCurrent
|
|
702
680
|
};
|
|
@@ -759,21 +737,19 @@ function createCodexThreadsTool(options) {
|
|
|
759
737
|
if (isModelSelectionLocked(admittedSession.entry)) throw new ModelSelectionLockedError();
|
|
760
738
|
assertCodexBindingMayBeReplaced(archivedBinding, "archiving its bound native thread");
|
|
761
739
|
}
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
740
|
+
const assertArchiveThreadIdle = async (targetThreadId) => {
|
|
741
|
+
assertThreadIdle(await scopedRequest(CODEX_CONTROL_METHODS.readThread, {
|
|
742
|
+
threadId: targetThreadId,
|
|
743
|
+
includeTurns: false
|
|
744
|
+
}), targetThreadId, "archive");
|
|
745
|
+
};
|
|
746
|
+
await assertArchiveThreadIdle(threadId);
|
|
766
747
|
if (await options.bindingStore.hasOtherThreadOwner(threadId, identity)) throw new Error("cannot archive a native Codex thread owned by another OpenClaw session");
|
|
767
748
|
await assertCodexArchiveDescendantsUnowned({
|
|
768
749
|
bindingStore: options.bindingStore,
|
|
769
750
|
threadId,
|
|
770
751
|
listPage: async (listParams) => await scopedRequest(CODEX_CONTROL_METHODS.listThreads, listParams),
|
|
771
|
-
assertDescendantIdle:
|
|
772
|
-
assertThreadIdle(await scopedRequest(CODEX_CONTROL_METHODS.readThread, {
|
|
773
|
-
threadId: descendantThreadId,
|
|
774
|
-
includeTurns: false
|
|
775
|
-
}), descendantThreadId, "archive");
|
|
776
|
-
}
|
|
752
|
+
assertDescendantIdle: assertArchiveThreadIdle
|
|
777
753
|
});
|
|
778
754
|
await scopedRequest(CODEX_CONTROL_METHODS.archiveThread, { threadId });
|
|
779
755
|
if (archivedBinding?.threadId === threadId) await options.bindingStore.mutate(identity, {
|
|
@@ -792,8 +768,8 @@ function createCodexThreadsTool(options) {
|
|
|
792
768
|
const usesSupervisionConnection = binding?.connectionScope === "supervision" || admissionPlugin.appServer?.homeScope !== "user" && supervision?.enabled === true;
|
|
793
769
|
if (attach && usesSupervisionConnection) throw new Error("Supervised Codex forks must stay detached; set attach=false.");
|
|
794
770
|
const forkOptions = await requestOptions();
|
|
795
|
-
const { retainCodexAppServerBindingSubscription, rollbackCodexAppServerBindingSubscription } = await import("./.setup/thread-ownership-
|
|
796
|
-
const { closeCodexStartupClientBestEffort } = await import("./.setup/attempt-client-cleanup-
|
|
771
|
+
const { retainCodexAppServerBindingSubscription, rollbackCodexAppServerBindingSubscription } = await import("./.setup/thread-ownership-Be53aiaG.mjs").then((n) => n.o);
|
|
772
|
+
const { closeCodexStartupClientBestEffort } = await import("./.setup/attempt-client-cleanup-t-kd_1ys.mjs").then((n) => n.a);
|
|
797
773
|
if (attach) {
|
|
798
774
|
assertCodexBindingMayBeReplaced(binding, "attaching a different native fork");
|
|
799
775
|
assertThreadIdle(await request(admissionConfig, CODEX_CONTROL_METHODS.readThread, {
|
|
@@ -881,7 +857,7 @@ const CODEX_NODE_EXEC_SERVER_CAPABILITY = "codex.exec-server";
|
|
|
881
857
|
function parseCodexNodePlacementWorkspace(value) {
|
|
882
858
|
if (!isRecord(value) || Object.keys(value).length !== 5 || typeof value.cwd !== "string" || !value.cwd.trim() || value.cwd.includes("\0") || typeof value.environmentId !== "string" || typeof value.sessionId !== "string" || ![value.environmentId, value.sessionId].every((identifier) => identifier.length > 0 && identifier.length <= 256 && identifier.trim() === identifier && !identifier.includes("\0")) || typeof value.sessionKey !== "string" || !value.sessionKey || value.sessionKey.trim() !== value.sessionKey || value.sessionKey.includes("\0") || typeof value.ownerEpoch !== "number" || !Number.isSafeInteger(value.ownerEpoch) || value.ownerEpoch < 1) throw new Error("Codex node exec-server requires an exact managed placement workspace.");
|
|
883
859
|
return {
|
|
884
|
-
|
|
860
|
+
workspaceDir: value.cwd,
|
|
885
861
|
environmentId: value.environmentId,
|
|
886
862
|
sessionId: value.sessionId,
|
|
887
863
|
ownerEpoch: value.ownerEpoch,
|
|
@@ -909,23 +885,17 @@ function createCodexNodeExecServerCommand() {
|
|
|
909
885
|
throw new Error("Codex node exec-server requires a valid workspace request.");
|
|
910
886
|
}
|
|
911
887
|
if (!isRecord(request) || Object.keys(request).length !== 2 || request.authorization !== "human-approved" && request.authorization !== "session-full") throw new Error("Codex node exec-server requires an authorized managed placement workspace launch.");
|
|
912
|
-
const
|
|
913
|
-
if (!context?.acquireManagedWorkspaceAsync || context.sessionKey !==
|
|
888
|
+
const workspaceRequest = parseCodexNodePlacementWorkspace(request.placement);
|
|
889
|
+
if (!context?.acquireManagedWorkspaceAsync || context.sessionKey !== workspaceRequest.sessionKey || io.signal.aborted) throw new Error("Codex node exec-server requires active managed placement authority.");
|
|
914
890
|
if (!context.prepareExecAuthorization) throw new Error("Codex node execution requires node-local exec policy support; update the node.");
|
|
915
891
|
const runtimeIo = context.signal ? {
|
|
916
892
|
...io,
|
|
917
893
|
signal: AbortSignal.any([io.signal, context.signal])
|
|
918
894
|
} : io;
|
|
919
895
|
const assertExecAuthorized = context.prepareExecAuthorization(request.authorization);
|
|
920
|
-
const { runCodexNodeExecServer } = await import("./.setup/node-exec-server.runtime-
|
|
896
|
+
const { runCodexNodeExecServer } = await import("./.setup/node-exec-server.runtime-BWkULhBM.mjs");
|
|
921
897
|
runtimeIo.signal.throwIfAborted();
|
|
922
|
-
const workspace = await context.acquireManagedWorkspaceAsync(
|
|
923
|
-
workspaceDir: placement.cwd,
|
|
924
|
-
environmentId: placement.environmentId,
|
|
925
|
-
sessionId: placement.sessionId,
|
|
926
|
-
ownerEpoch: placement.ownerEpoch,
|
|
927
|
-
sessionKey: placement.sessionKey
|
|
928
|
-
});
|
|
898
|
+
const workspace = await context.acquireManagedWorkspaceAsync(workspaceRequest);
|
|
929
899
|
try {
|
|
930
900
|
runtimeIo.signal.throwIfAborted();
|
|
931
901
|
} catch (error) {
|
|
@@ -960,9 +930,9 @@ function createCodexNodeExecServerInvokePolicy() {
|
|
|
960
930
|
code: "CODEX_NODE_EXEC_APPROVAL_REQUIRED",
|
|
961
931
|
message: "Codex node execution requires an available approval reviewer."
|
|
962
932
|
};
|
|
963
|
-
let
|
|
933
|
+
let workspace;
|
|
964
934
|
try {
|
|
965
|
-
|
|
935
|
+
workspace = parseCodexNodePlacementWorkspace(context.params);
|
|
966
936
|
} catch {
|
|
967
937
|
return {
|
|
968
938
|
ok: false,
|
|
@@ -970,12 +940,12 @@ function createCodexNodeExecServerInvokePolicy() {
|
|
|
970
940
|
message: "Codex node execution requires an exact managed placement workspace."
|
|
971
941
|
};
|
|
972
942
|
}
|
|
973
|
-
const
|
|
974
|
-
|
|
975
|
-
environmentId:
|
|
976
|
-
sessionId:
|
|
977
|
-
ownerEpoch:
|
|
978
|
-
sessionKey:
|
|
943
|
+
const placement = {
|
|
944
|
+
cwd: workspace.workspaceDir,
|
|
945
|
+
environmentId: workspace.environmentId,
|
|
946
|
+
sessionId: workspace.sessionId,
|
|
947
|
+
ownerEpoch: workspace.ownerEpoch,
|
|
948
|
+
sessionKey: workspace.sessionKey
|
|
979
949
|
};
|
|
980
950
|
const fullLaunch = await context.invokeNodeWithSessionFull?.({
|
|
981
951
|
workspace,
|
|
@@ -1252,13 +1222,10 @@ function startCodexCatalogControlRequestDiagnostics(page) {
|
|
|
1252
1222
|
const kept = page.fields.controlWaitersV1 ??= [];
|
|
1253
1223
|
page.fields.controlWaitersOmitted ??= 0;
|
|
1254
1224
|
const tuple = controlWaiterTuple(controlCallOrdinal, summary);
|
|
1255
|
-
if (!tuple) {
|
|
1225
|
+
if (!tuple || kept.length === 4) {
|
|
1256
1226
|
page.fields.controlWaitersOmitted = Math.min(Number.MAX_SAFE_INTEGER, page.fields.controlWaitersOmitted + 1);
|
|
1257
|
-
return;
|
|
1258
|
-
}
|
|
1259
|
-
if (kept.length === 4) {
|
|
1227
|
+
if (!tuple) return;
|
|
1260
1228
|
kept.splice(2, 1);
|
|
1261
|
-
page.fields.controlWaitersOmitted = Math.min(Number.MAX_SAFE_INTEGER, page.fields.controlWaitersOmitted + 1);
|
|
1262
1229
|
}
|
|
1263
1230
|
kept.push(tuple);
|
|
1264
1231
|
},
|
|
@@ -1682,7 +1649,7 @@ function hostFailure(source, error) {
|
|
|
1682
1649
|
}
|
|
1683
1650
|
async function projectLocalHost(params, agentId, source, page) {
|
|
1684
1651
|
params.signal?.throwIfAborted();
|
|
1685
|
-
const { listAdoptedSessionEntries } = await import("./.setup/session-catalog-adoption-
|
|
1652
|
+
const { listAdoptedSessionEntries } = await import("./.setup/session-catalog-adoption-Ca3OYGYM.mjs");
|
|
1686
1653
|
const { sessionCatalogAdoptedSourceKey } = await import("openclaw/plugin-sdk/session-catalog");
|
|
1687
1654
|
params.signal?.throwIfAborted();
|
|
1688
1655
|
const finishTiming = startCodexCatalogListTiming("adoptionSumMs", "adoptionCalls");
|
|
@@ -1761,7 +1728,6 @@ function createNodePublicationTracker(publications, waitUntil) {
|
|
|
1761
1728
|
var CodexCatalogListDriver = class {
|
|
1762
1729
|
constructor(params) {
|
|
1763
1730
|
this.locals = [];
|
|
1764
|
-
this.nodeActive = false;
|
|
1765
1731
|
this.nodeResults = [];
|
|
1766
1732
|
this.nodeDiscoveryFailed = false;
|
|
1767
1733
|
this.nodePublications = { pending: 0 };
|
|
@@ -1790,7 +1756,7 @@ var CodexCatalogListDriver = class {
|
|
|
1790
1756
|
}).sessionAgentId;
|
|
1791
1757
|
const query = readGatewayParams(params.query);
|
|
1792
1758
|
const requestedHostIds = query.hostIds ? new Set(query.hostIds) : void 0;
|
|
1793
|
-
const localSources = params.localHomes
|
|
1759
|
+
const localSources = params.localHomes.filter((source) => !requestedHostIds || requestedHostIds.has(source?.hostId ?? "gateway:local"));
|
|
1794
1760
|
const diagnostics = currentCodexCatalogListDiagnostics();
|
|
1795
1761
|
if (diagnostics) diagnostics.fields.localHostCount = localSources.length;
|
|
1796
1762
|
const store = params.bindingStore.managedThreads;
|
|
@@ -1831,7 +1797,7 @@ var CodexCatalogListDriver = class {
|
|
|
1831
1797
|
}
|
|
1832
1798
|
}
|
|
1833
1799
|
canPause() {
|
|
1834
|
-
return !this.localFailed && this.nodeHosts !== void 0 && !this.nodeDiscoveryFailed &&
|
|
1800
|
+
return !this.localFailed && this.nodeHosts !== void 0 && !this.nodeDiscoveryFailed && this.nodePublications.pending === 0;
|
|
1835
1801
|
}
|
|
1836
1802
|
async readHost(host) {
|
|
1837
1803
|
const params = this.request();
|
|
@@ -1905,8 +1871,8 @@ var CodexCatalogListDriver = class {
|
|
|
1905
1871
|
}
|
|
1906
1872
|
params.signal?.throwIfAborted();
|
|
1907
1873
|
this.nodeSnapshots.observe(this.nodeGeneration, inventory);
|
|
1908
|
-
const { listNodeAdoptedSessionEntries, nodeAdoptedSourceKey } = await import("./.setup/session-catalog-node-adoption-
|
|
1909
|
-
const { compareNodeLabels, listPairedNode, nodeLabel } = await import("./.setup/session-catalog-node-continue-
|
|
1874
|
+
const { listNodeAdoptedSessionEntries, nodeAdoptedSourceKey } = await import("./.setup/session-catalog-node-adoption-BdP9Zjqo.mjs");
|
|
1875
|
+
const { compareNodeLabels, listPairedNode, nodeLabel } = await import("./.setup/session-catalog-node-continue-CNJibO4_.mjs");
|
|
1910
1876
|
params.signal?.throwIfAborted();
|
|
1911
1877
|
const adopted = listNodeAdoptedSessionEntries({
|
|
1912
1878
|
agentId,
|
|
@@ -1985,13 +1951,11 @@ var CodexCatalogListDriver = class {
|
|
|
1985
1951
|
startNodes() {
|
|
1986
1952
|
if (this.nodeHosts !== void 0 || this.nodesStarted) return;
|
|
1987
1953
|
this.nodesStarted = true;
|
|
1988
|
-
this.nodeActive = true;
|
|
1989
1954
|
this.readNodes().then((hosts) => {
|
|
1990
1955
|
this.nodeHosts = hosts;
|
|
1991
|
-
this.nodeActive = false;
|
|
1992
1956
|
this.checkpoint();
|
|
1993
1957
|
}, (error) => {
|
|
1994
|
-
this.
|
|
1958
|
+
this.nodeHosts = [];
|
|
1995
1959
|
this.failure ??= { error };
|
|
1996
1960
|
this.checkpoint();
|
|
1997
1961
|
});
|
|
@@ -1999,7 +1963,7 @@ var CodexCatalogListDriver = class {
|
|
|
1999
1963
|
checkpoint() {
|
|
2000
1964
|
if (this.active > 0 || !this.step) return;
|
|
2001
1965
|
if (this.failure) {
|
|
2002
|
-
if (
|
|
1966
|
+
if (this.nodeHosts !== void 0) this.step.reject(this.failure.error);
|
|
2003
1967
|
} else if (this.nodeHosts && this.locals.every((host) => host.value !== void 0)) try {
|
|
2004
1968
|
this.complete = true;
|
|
2005
1969
|
this.step.resolve({
|
|
@@ -2066,87 +2030,6 @@ async function runCatalogListInline(operation) {
|
|
|
2066
2030
|
}
|
|
2067
2031
|
}
|
|
2068
2032
|
//#endregion
|
|
2069
|
-
//#region extensions/codex/src/app-server/thread-history-page.ts
|
|
2070
|
-
const TURN_ITEM_CURSOR_PREFIX = "turn-item:";
|
|
2071
|
-
function encodeTurnItemCursor(turnCursor, itemId) {
|
|
2072
|
-
return TURN_ITEM_CURSOR_PREFIX + Buffer.from(JSON.stringify([turnCursor, itemId])).toString("base64url");
|
|
2073
|
-
}
|
|
2074
|
-
function decodeTurnItemCursor(cursor) {
|
|
2075
|
-
if (!cursor?.startsWith(TURN_ITEM_CURSOR_PREFIX)) return { turnCursor: cursor };
|
|
2076
|
-
let value;
|
|
2077
|
-
try {
|
|
2078
|
-
value = JSON.parse(Buffer.from(cursor.slice(10), "base64url").toString());
|
|
2079
|
-
} catch {
|
|
2080
|
-
throw new CatalogParamsError("invalid Codex transcript item cursor");
|
|
2081
|
-
}
|
|
2082
|
-
if (!Array.isArray(value) || value.length !== 2 || typeof value[0] !== "string" || !value[0] || typeof value[1] !== "string" || !value[1]) throw new CatalogParamsError("invalid Codex transcript item cursor");
|
|
2083
|
-
return {
|
|
2084
|
-
turnCursor: value[0],
|
|
2085
|
-
itemId: value[1]
|
|
2086
|
-
};
|
|
2087
|
-
}
|
|
2088
|
-
/** Legacy stores expose only turn cursors; an item identity preserves paging across appends. */
|
|
2089
|
-
async function readLegacyCodexHistoryPage(readTurns, request, projection) {
|
|
2090
|
-
const { turnCursor, itemId } = decodeTurnItemCursor(request.cursor);
|
|
2091
|
-
const page = parseTranscriptPage(await readTurns({
|
|
2092
|
-
threadId: request.threadId,
|
|
2093
|
-
limit: 1,
|
|
2094
|
-
sortDirection: "desc",
|
|
2095
|
-
itemsView: "full",
|
|
2096
|
-
...turnCursor ? { cursor: turnCursor } : {}
|
|
2097
|
-
}));
|
|
2098
|
-
const source = page.data.flatMap(({ items, ...turn }) => items.toReversed().map((item) => ({
|
|
2099
|
-
turnId: turn.id,
|
|
2100
|
-
item,
|
|
2101
|
-
turn
|
|
2102
|
-
})));
|
|
2103
|
-
const anchorIndex = itemId ? source.findIndex(({ item }) => item.id === itemId) : -1;
|
|
2104
|
-
if (itemId && anchorIndex < 0) throw new CatalogParamsError("Codex transcript changed; refresh the session before loading older items");
|
|
2105
|
-
const remaining = source.slice(anchorIndex + 1);
|
|
2106
|
-
const items = projection.project(remaining.slice(0, request.limit), request.limit);
|
|
2107
|
-
const result = () => {
|
|
2108
|
-
const lastSource = remaining[items.length - 1];
|
|
2109
|
-
const partial = lastSource !== void 0 && items.length < remaining.length;
|
|
2110
|
-
const nativeCursor = partial ? page.backwardsCursor : page.nextCursor;
|
|
2111
|
-
const cursor = nativeCursor ? partial ? encodeTurnItemCursor(nativeCursor, lastSource.item.id) : nativeCursor : void 0;
|
|
2112
|
-
if (partial && !cursor) throw new Error("Codex app-server did not provide a transcript continuation anchor");
|
|
2113
|
-
return {
|
|
2114
|
-
items,
|
|
2115
|
-
...cursor ? { nextCursor: cursor } : {}
|
|
2116
|
-
};
|
|
2117
|
-
};
|
|
2118
|
-
let bounded = result();
|
|
2119
|
-
while (!projection.fits(bounded)) {
|
|
2120
|
-
if (items.length <= 1) throw new Error("Codex transcript item exceeds the safe response size");
|
|
2121
|
-
items.pop();
|
|
2122
|
-
bounded = result();
|
|
2123
|
-
}
|
|
2124
|
-
return bounded;
|
|
2125
|
-
}
|
|
2126
|
-
/** Callers authorize the thread; this reader owns native cursor and response-size semantics. */
|
|
2127
|
-
async function readCodexThreadHistoryPage(control, thread, request, projection) {
|
|
2128
|
-
if (thread.historyMode !== "paginated") return readLegacyCodexHistoryPage((params) => control.listTurnPage(params), request, projection);
|
|
2129
|
-
let limit = request.limit;
|
|
2130
|
-
for (;;) {
|
|
2131
|
-
const page = await control.listItemPage({
|
|
2132
|
-
threadId: request.threadId,
|
|
2133
|
-
limit,
|
|
2134
|
-
sortDirection: "desc",
|
|
2135
|
-
...request.cursor ? { cursor: request.cursor } : {}
|
|
2136
|
-
});
|
|
2137
|
-
const nextCursor = readControlCursor(page.nextCursor, "transcript next response");
|
|
2138
|
-
const items = projection.project(page.data, limit);
|
|
2139
|
-
const result = {
|
|
2140
|
-
items,
|
|
2141
|
-
...nextCursor ? { nextCursor } : {}
|
|
2142
|
-
};
|
|
2143
|
-
const fittingCount = items.length - (projection.fits(result) ? 0 : 1);
|
|
2144
|
-
if (fittingCount === page.data.length) return result;
|
|
2145
|
-
if (fittingCount < 1) throw new Error("Codex transcript item exceeds the safe response size");
|
|
2146
|
-
limit = fittingCount;
|
|
2147
|
-
}
|
|
2148
|
-
}
|
|
2149
|
-
//#endregion
|
|
2150
2033
|
//#region extensions/codex/src/session-catalog-transcript-item.ts
|
|
2151
2034
|
const CODEX_MESSAGE_TYPES = /* @__PURE__ */ new Map([
|
|
2152
2035
|
["userMessage", "userMessage"],
|
|
@@ -2180,6 +2063,7 @@ function toGenericTranscriptItem(item) {
|
|
|
2180
2063
|
}
|
|
2181
2064
|
//#endregion
|
|
2182
2065
|
//#region extensions/codex/src/session-catalog-transcript.ts
|
|
2066
|
+
const TURN_ITEM_CURSOR_PREFIX = "turn-item:";
|
|
2183
2067
|
const transcriptPageSchema = z.strictObject({
|
|
2184
2068
|
items: z.array(z.strictObject({
|
|
2185
2069
|
id: z.string(),
|
|
@@ -2209,23 +2093,82 @@ function projectTranscriptPage(entries, limit) {
|
|
|
2209
2093
|
function pageFitsNodeTransport(page) {
|
|
2210
2094
|
return Buffer.byteLength(JSON.stringify({ payloadJSON: JSON.stringify(page) }), "utf8") <= MAX_TRANSCRIPT_PAGE_BYTES;
|
|
2211
2095
|
}
|
|
2212
|
-
|
|
2096
|
+
function encodeTurnItemCursor(turnCursor, itemId) {
|
|
2097
|
+
return TURN_ITEM_CURSOR_PREFIX + Buffer.from(JSON.stringify([turnCursor, itemId])).toString("base64url");
|
|
2098
|
+
}
|
|
2099
|
+
function decodeTurnItemCursor(cursor) {
|
|
2100
|
+
if (!cursor?.startsWith(TURN_ITEM_CURSOR_PREFIX)) return { turnCursor: cursor };
|
|
2101
|
+
let value;
|
|
2102
|
+
try {
|
|
2103
|
+
value = JSON.parse(Buffer.from(cursor.slice(10), "base64url").toString());
|
|
2104
|
+
} catch {
|
|
2105
|
+
throw new CatalogParamsError("invalid Codex transcript item cursor");
|
|
2106
|
+
}
|
|
2107
|
+
if (!Array.isArray(value) || value.length !== 2 || typeof value[0] !== "string" || !value[0] || typeof value[1] !== "string" || !value[1]) throw new CatalogParamsError("invalid Codex transcript item cursor");
|
|
2108
|
+
return {
|
|
2109
|
+
turnCursor: value[0],
|
|
2110
|
+
itemId: value[1]
|
|
2111
|
+
};
|
|
2112
|
+
}
|
|
2113
|
+
/** Legacy stores expose only turn cursors; an item identity preserves paging across appends. */
|
|
2213
2114
|
async function readLegacyCodexTranscriptPage(readTurns, request) {
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2115
|
+
const { turnCursor, itemId } = decodeTurnItemCursor(request.cursor);
|
|
2116
|
+
const page = parseTranscriptPage(await readTurns({
|
|
2117
|
+
threadId: request.threadId,
|
|
2118
|
+
limit: 1,
|
|
2119
|
+
sortDirection: "desc",
|
|
2120
|
+
itemsView: "full",
|
|
2121
|
+
...turnCursor ? { cursor: turnCursor } : {}
|
|
2122
|
+
}));
|
|
2123
|
+
const source = page.data.flatMap(({ items }) => items.toReversed().map((item) => ({ item })));
|
|
2124
|
+
const anchorIndex = itemId ? source.findIndex(({ item }) => item.id === itemId) : -1;
|
|
2125
|
+
if (itemId && anchorIndex < 0) throw new CatalogParamsError("Codex transcript changed; refresh the session before loading older items");
|
|
2126
|
+
const remaining = source.slice(anchorIndex + 1);
|
|
2127
|
+
const items = projectTranscriptPage(remaining.slice(0, request.limit), request.limit);
|
|
2128
|
+
const result = () => {
|
|
2129
|
+
const lastSource = remaining[items.length - 1];
|
|
2130
|
+
const partial = lastSource !== void 0 && items.length < remaining.length;
|
|
2131
|
+
const nativeCursor = partial ? page.backwardsCursor : page.nextCursor;
|
|
2132
|
+
const cursor = nativeCursor ? partial ? encodeTurnItemCursor(nativeCursor, lastSource.item.id) : nativeCursor : void 0;
|
|
2133
|
+
if (partial && !cursor) throw new Error("Codex app-server did not provide a transcript continuation anchor");
|
|
2134
|
+
return {
|
|
2135
|
+
items,
|
|
2136
|
+
...cursor ? { nextCursor: cursor } : {}
|
|
2137
|
+
};
|
|
2138
|
+
};
|
|
2139
|
+
let bounded = result();
|
|
2140
|
+
while (!pageFitsNodeTransport(bounded)) {
|
|
2141
|
+
if (items.length <= 1) throw new Error("Codex transcript item exceeds the safe response size");
|
|
2142
|
+
items.pop();
|
|
2143
|
+
bounded = result();
|
|
2144
|
+
}
|
|
2145
|
+
return bounded;
|
|
2218
2146
|
}
|
|
2219
2147
|
/** Uses the native store's item cursor whenever that store supports item history. */
|
|
2220
2148
|
async function readCodexCatalogTranscriptPage(control, request) {
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2149
|
+
if ((await control.requireEligibleThread(request.threadId)).historyMode !== "paginated") return readLegacyCodexTranscriptPage((params) => control.listTurnPage(params), request);
|
|
2150
|
+
let limit = request.limit;
|
|
2151
|
+
for (;;) {
|
|
2152
|
+
const page = await control.listItemPage({
|
|
2153
|
+
threadId: request.threadId,
|
|
2154
|
+
limit,
|
|
2155
|
+
sortDirection: "desc",
|
|
2156
|
+
...request.cursor ? { cursor: request.cursor } : {}
|
|
2157
|
+
});
|
|
2158
|
+
const nextCursor = readControlCursor(page.nextCursor, "transcript next response");
|
|
2159
|
+
const items = projectTranscriptPage(page.data, limit);
|
|
2160
|
+
const result = {
|
|
2161
|
+
items,
|
|
2162
|
+
...nextCursor ? { nextCursor } : {}
|
|
2163
|
+
};
|
|
2164
|
+
const fittingCount = items.length - (pageFitsNodeTransport(result) ? 0 : 1);
|
|
2165
|
+
if (fittingCount === page.data.length) return result;
|
|
2166
|
+
if (fittingCount < 1) throw new Error("Codex transcript item exceeds the safe response size");
|
|
2167
|
+
limit = fittingCount;
|
|
2168
|
+
}
|
|
2225
2169
|
}
|
|
2226
2170
|
//#endregion
|
|
2227
2171
|
//#region extensions/codex/src/session-catalog-listing.ts
|
|
2228
|
-
/** Builds the node-local read-only Codex app-server catalog command. */
|
|
2229
2172
|
function createCodexSessionCatalogNodeHostCommands(controlFactory, bindingStore) {
|
|
2230
2173
|
const bindRequest = async (paramsJSON) => {
|
|
2231
2174
|
const parsed = parseJsonParams(paramsJSON);
|
|
@@ -2330,7 +2273,6 @@ function readNodeTranscriptParams(value) {
|
|
|
2330
2273
|
...cursor ? { cursor } : {}
|
|
2331
2274
|
};
|
|
2332
2275
|
}
|
|
2333
|
-
/** Reads the persisted transcript for a Gateway-local or paired-node Codex session. */
|
|
2334
2276
|
async function readCodexSessionTranscript(params) {
|
|
2335
2277
|
const cursor = readControlCursor(params.cursor, "transcript request");
|
|
2336
2278
|
const limit = normalizeLimit(params.limit, "limit", 20, 50);
|
|
@@ -2373,7 +2315,7 @@ async function readCodexSessionTranscript(params) {
|
|
|
2373
2315
|
cursor,
|
|
2374
2316
|
limit
|
|
2375
2317
|
});
|
|
2376
|
-
const { nodeLabel } = await import("./.setup/session-catalog-node-continue-
|
|
2318
|
+
const { nodeLabel } = await import("./.setup/session-catalog-node-continue-CNJibO4_.mjs");
|
|
2377
2319
|
return {
|
|
2378
2320
|
hostId: params.hostId,
|
|
2379
2321
|
label: nodeLabel(node),
|
|
@@ -2419,7 +2361,7 @@ function classifyCodexUpstreamTurns(params) {
|
|
|
2419
2361
|
humanTurns += 1;
|
|
2420
2362
|
if (occurredAt === void 0) {
|
|
2421
2363
|
const timestampSeconds = turn.completedAt ?? turn.startedAt;
|
|
2422
|
-
occurredAt = typeof timestampSeconds === "number" && Number.isFinite(timestampSeconds) ? timestampSeconds * 1e3 :
|
|
2364
|
+
occurredAt = typeof timestampSeconds === "number" && Number.isFinite(timestampSeconds) ? timestampSeconds * 1e3 : Date.now();
|
|
2423
2365
|
}
|
|
2424
2366
|
}
|
|
2425
2367
|
}
|
|
@@ -2433,7 +2375,7 @@ function classifyCodexUpstreamTurns(params) {
|
|
|
2433
2375
|
userMessageCount: newestUserMessageCount
|
|
2434
2376
|
},
|
|
2435
2377
|
...humanTurns > 0 ? {
|
|
2436
|
-
occurredAt: occurredAt ??
|
|
2378
|
+
occurredAt: occurredAt ?? Date.now(),
|
|
2437
2379
|
dedupeId: activityId
|
|
2438
2380
|
} : {}
|
|
2439
2381
|
};
|
|
@@ -2443,7 +2385,7 @@ function normalizeUserMessageTexts(item) {
|
|
|
2443
2385
|
const contentTexts = typed.content?.filter((input) => input.type === "text").map((input) => input.text.trim().replace(/\s+/g, " ")).filter(Boolean);
|
|
2444
2386
|
return contentTexts?.length ? contentTexts : [(typed.text ?? "").trim().replace(/\s+/g, " ")];
|
|
2445
2387
|
}
|
|
2446
|
-
async function checkCodexUpstreamActivity(probes, control, resolveThreadId
|
|
2388
|
+
async function checkCodexUpstreamActivity(probes, control, resolveThreadId) {
|
|
2447
2389
|
return await control.withPinnedConnection(async (pinned) => {
|
|
2448
2390
|
const activities = [];
|
|
2449
2391
|
for (const probe of probes) {
|
|
@@ -2537,8 +2479,8 @@ async function requireEligibleCodexThread(params) {
|
|
|
2537
2479
|
remaining();
|
|
2538
2480
|
if (thread.id !== threadId || thread.ephemeral === true || !isInteractiveThreadSource(thread.source)) throw unverified();
|
|
2539
2481
|
if (!root) {
|
|
2540
|
-
const { CODEX_CATALOG_NATIVE_PAGE_LIMIT } = await import("./.setup/session-catalog-native-projection-
|
|
2541
|
-
const { CODEX_CATALOG_MAX_ROWS } = await import("./.setup/session-catalog-limits-
|
|
2482
|
+
const { CODEX_CATALOG_NATIVE_PAGE_LIMIT } = await import("./.setup/session-catalog-native-projection-rCKnZud1.mjs").then((n) => n.a);
|
|
2483
|
+
const { CODEX_CATALOG_MAX_ROWS } = await import("./.setup/session-catalog-limits-BynIoOYm.mjs").then((n) => n.r);
|
|
2542
2484
|
let cursor;
|
|
2543
2485
|
const seenCursors = /* @__PURE__ */ new Set();
|
|
2544
2486
|
for (;;) {
|
|
@@ -2635,7 +2577,7 @@ function createCodexSessionCatalogControlFromRequests(params) {
|
|
|
2635
2577
|
const requests = params.createRequestSnapshot();
|
|
2636
2578
|
const timeoutMs = Math.min(requests.requestTimeoutMs, 5e3);
|
|
2637
2579
|
const deadline = request.constrainDeadline(performance.now() + timeoutMs);
|
|
2638
|
-
return await (await
|
|
2580
|
+
return await (await withCodexCatalogLoadingTimeout(requests.index(), request.remaining(timeoutMs))).list(query, deadline);
|
|
2639
2581
|
});
|
|
2640
2582
|
},
|
|
2641
2583
|
async listDescendantPage(listParams) {
|
|
@@ -2990,7 +2932,7 @@ function createCodexSessionCatalogControl(params) {
|
|
|
2990
2932
|
if (closed || generation !== config || residentEpoch !== epoch) throw new Error("Codex catalog configuration changed");
|
|
2991
2933
|
let index = indexes.get(homeId);
|
|
2992
2934
|
if (!index) {
|
|
2993
|
-
const [{ CodexCatalogIndex }, { canReuseCodexCatalogPreview, projectCodexCatalogDeltaPage, projectCodexCatalogPage }] = await Promise.all([import("./.setup/session-catalog-index-
|
|
2935
|
+
const [{ CodexCatalogIndex }, { canReuseCodexCatalogPreview, projectCodexCatalogDeltaPage, projectCodexCatalogPage }] = await Promise.all([import("./.setup/session-catalog-index-DozvkUPd.mjs"), import("./.setup/session-catalog-projection-DDVmALHj.mjs")]);
|
|
2994
2936
|
source?.assertCurrent();
|
|
2995
2937
|
if (closed || generation !== config || residentEpoch !== epoch) throw new Error("Codex catalog configuration changed");
|
|
2996
2938
|
index = indexes.get(homeId);
|
|
@@ -3115,7 +3057,7 @@ function createCodexSessionCatalogControl(params) {
|
|
|
3115
3057
|
const runtime = source?.appServer ?? resolveRuntimeOptions({ pluginConfig });
|
|
3116
3058
|
const requestOptions = resolveRequestOptions(runtime.start, agentId, source);
|
|
3117
3059
|
return createCodexCatalogRequestSnapshot(runtime.requestTimeoutMs, async (method, requestParams, timeoutMs, assertCurrent, observation) => {
|
|
3118
|
-
const { codexControlRequest } = await import("./.setup/command-rpc-
|
|
3060
|
+
const { codexControlRequest } = await import("./.setup/command-rpc-C9VxOLuG.mjs").then((n) => n.n);
|
|
3119
3061
|
return await codexControlRequest(pluginConfig, method, requestParams, {
|
|
3120
3062
|
...requestOptions,
|
|
3121
3063
|
authProfileId: null,
|
|
@@ -3137,9 +3079,9 @@ function createCodexSessionCatalogControl(params) {
|
|
|
3137
3079
|
const runtime = source?.appServer ?? resolveRuntimeOptions({ pluginConfig });
|
|
3138
3080
|
const { agentDir, config: runtimeConfig, startOptions } = resolveRequestOptions(runtime.start, agentId, source);
|
|
3139
3081
|
let catalogIndex;
|
|
3140
|
-
const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient, retireSharedCodexAppServerClientIfCurrent } = await import("./.setup/shared-client-
|
|
3141
|
-
const { resolveCodexAppServerClientInstanceId } = await import("./.setup/client-
|
|
3142
|
-
const { requestCodexAppServerClientJson } = await import("./.setup/request-
|
|
3082
|
+
const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient, retireSharedCodexAppServerClientIfCurrent } = await import("./.setup/shared-client-ByIwuAC-.mjs").then((n) => n.v);
|
|
3083
|
+
const { resolveCodexAppServerClientInstanceId } = await import("./.setup/client-y7nO6X9c.mjs").then((n) => n.n);
|
|
3084
|
+
const { requestCodexAppServerClientJson } = await import("./.setup/request-Y8dmbqZ3.mjs").then((n) => n.i);
|
|
3143
3085
|
const client = await getLeasedSharedCodexAppServerClient({
|
|
3144
3086
|
agentDir,
|
|
3145
3087
|
config: runtimeConfig,
|
|
@@ -3208,7 +3150,7 @@ function createCodexSessionCatalogControl(params) {
|
|
|
3208
3150
|
await Promise.allSettled(residentRequests);
|
|
3209
3151
|
const clients = getSharedCodexAppServerClientState();
|
|
3210
3152
|
if (clients.liveClients.size > 0 || clients.startup.pending.size > 0) {
|
|
3211
|
-
const { clearSharedCodexAppServerClientAndWait } = await import("./.setup/shared-client-
|
|
3153
|
+
const { clearSharedCodexAppServerClientAndWait } = await import("./.setup/shared-client-ByIwuAC-.mjs").then((n) => n.v);
|
|
3212
3154
|
await clearSharedCodexAppServerClientAndWait();
|
|
3213
3155
|
}
|
|
3214
3156
|
},
|
|
@@ -3453,7 +3395,7 @@ function registerCodexSessionCatalog(params) {
|
|
|
3453
3395
|
if (!config) throw new Error("OpenClaw runtime config is unavailable");
|
|
3454
3396
|
if (request.hostId.startsWith("node:")) {
|
|
3455
3397
|
const agentId = resolveRequestAgentId(request.agentId);
|
|
3456
|
-
const { continueNodeCodexSession } = await import("./.setup/session-catalog-node-continue-
|
|
3398
|
+
const { continueNodeCodexSession } = await import("./.setup/session-catalog-node-continue-CNJibO4_.mjs");
|
|
3457
3399
|
return await continueNodeCodexSession({
|
|
3458
3400
|
agentId,
|
|
3459
3401
|
api: params.api,
|
|
@@ -3468,7 +3410,7 @@ function registerCodexSessionCatalog(params) {
|
|
|
3468
3410
|
const { agentId, source, control } = await bindLocalRequest(request);
|
|
3469
3411
|
source.assertCurrent();
|
|
3470
3412
|
let upstreamBaseline;
|
|
3471
|
-
const { continueLocalCodexSession } = await import("./.setup/session-catalog-adoption-
|
|
3413
|
+
const { continueLocalCodexSession } = await import("./.setup/session-catalog-adoption-Ca3OYGYM.mjs");
|
|
3472
3414
|
const continued = await continueLocalCodexSession({
|
|
3473
3415
|
agentId,
|
|
3474
3416
|
api: params.api,
|
|
@@ -3497,7 +3439,7 @@ function registerCodexSessionCatalog(params) {
|
|
|
3497
3439
|
if (!config) throw new Error("OpenClaw runtime config is unavailable");
|
|
3498
3440
|
const { agentId, source, control } = await bindLocalRequest(request);
|
|
3499
3441
|
source.assertCurrent();
|
|
3500
|
-
const { archiveLocalCodexSession } = await import("./.setup/session-catalog-archive-
|
|
3442
|
+
const { archiveLocalCodexSession } = await import("./.setup/session-catalog-archive-Bv6gV7x9.mjs");
|
|
3501
3443
|
await archiveLocalCodexSession({
|
|
3502
3444
|
agentId,
|
|
3503
3445
|
bindingStore: params.bindingStore,
|
|
@@ -3543,29 +3485,6 @@ function registerCodexSessionCatalog(params) {
|
|
|
3543
3485
|
params.api.registerSessionCatalog(provider);
|
|
3544
3486
|
}
|
|
3545
3487
|
//#endregion
|
|
3546
|
-
//#region extensions/codex/src/supervision-tool-policy.ts
|
|
3547
|
-
var CodexSupervisionPolicyError = class extends Error {};
|
|
3548
|
-
function requireSupervisionEnabled(pluginConfig) {
|
|
3549
|
-
if (readCodexPluginConfig(pluginConfig).supervision?.enabled !== true) throw new CodexSupervisionPolicyError("Codex supervision is disabled in the codex plugin config.");
|
|
3550
|
-
}
|
|
3551
|
-
function requireOwnerAccess(options) {
|
|
3552
|
-
options.assertInvocationCurrent?.();
|
|
3553
|
-
if (!options.senderIsOwner) throw new CodexSupervisionPolicyError("Codex supervision compatibility tools require an owner-authorized sender.");
|
|
3554
|
-
}
|
|
3555
|
-
function resolveToolPolicy(pluginConfig) {
|
|
3556
|
-
const config = readCodexPluginConfig(pluginConfig).supervision;
|
|
3557
|
-
return {
|
|
3558
|
-
allowRawTranscripts: config?.allowRawTranscripts === true,
|
|
3559
|
-
allowWriteControls: config?.allowWriteControls === true
|
|
3560
|
-
};
|
|
3561
|
-
}
|
|
3562
|
-
function requireRawTranscriptAccess(pluginConfig) {
|
|
3563
|
-
if (!resolveToolPolicy(pluginConfig).allowRawTranscripts) throw new CodexSupervisionPolicyError("Codex session reads are disabled for this codex plugin supervision config.");
|
|
3564
|
-
}
|
|
3565
|
-
function requireWriteAccess(pluginConfig) {
|
|
3566
|
-
if (!resolveToolPolicy(pluginConfig).allowWriteControls) throw new CodexSupervisionPolicyError("Codex write controls are disabled for this codex plugin supervision config.");
|
|
3567
|
-
}
|
|
3568
|
-
//#endregion
|
|
3569
3488
|
//#region extensions/codex/src/supervision-tools.ts
|
|
3570
3489
|
/**
|
|
3571
3490
|
* Compatibility tools for the retired Codex Supervisor plugin.
|
|
@@ -3575,6 +3494,7 @@ function requireWriteAccess(pluginConfig) {
|
|
|
3575
3494
|
* continuation belongs to the Codex harness, which installs approval and tool
|
|
3576
3495
|
* handlers before it starts or resumes the harness-owned Codex thread.
|
|
3577
3496
|
*/
|
|
3497
|
+
var CodexSupervisionPolicyError = class extends Error {};
|
|
3578
3498
|
/** Legacy endpoint env retained for the shipped Supervisor tool contract. */
|
|
3579
3499
|
const LEGACY_CODEX_SUPERVISOR_ENDPOINTS_ENV = "OPENCLAW_CODEX_SUPERVISOR_ENDPOINTS";
|
|
3580
3500
|
const CODEX_SUPERVISION_COMPAT_TOOL_NAMES = [
|
|
@@ -3629,6 +3549,7 @@ const PAGE_LIMIT = 100;
|
|
|
3629
3549
|
const MAX_COMPAT_PAGINATION_PAGES = 100;
|
|
3630
3550
|
const MAX_COMPAT_CURSOR_LENGTH = 4096;
|
|
3631
3551
|
const MAX_COMPAT_THREAD_ID_LENGTH = 4096;
|
|
3552
|
+
const ENDPOINT_URL_PREFIX = /^(?:wss?|unix):\/\//;
|
|
3632
3553
|
function asRecordArray(value) {
|
|
3633
3554
|
return Array.isArray(value) ? value.filter(isRecord) : [];
|
|
3634
3555
|
}
|
|
@@ -3670,13 +3591,6 @@ function normalizeEndpointId(value, index) {
|
|
|
3670
3591
|
const trimmed = value.trim();
|
|
3671
3592
|
return trimmed ? trimmed.replace(/[^a-zA-Z0-9_.:-]/g, "-") : `endpoint-${index + 1}`;
|
|
3672
3593
|
}
|
|
3673
|
-
function normalizeConfiguredEndpoint(endpoint, index) {
|
|
3674
|
-
return {
|
|
3675
|
-
id: normalizeEndpointId(endpoint.id ?? endpoint.label ?? "", index),
|
|
3676
|
-
...endpoint.label?.trim() ? { label: endpoint.label.trim() } : {},
|
|
3677
|
-
configured: endpoint
|
|
3678
|
-
};
|
|
3679
|
-
}
|
|
3680
3594
|
function parseEndpointRecord(value) {
|
|
3681
3595
|
if (!isRecord(value)) return;
|
|
3682
3596
|
const transport = typeof value.transport === "string" ? value.transport : void 0;
|
|
@@ -3703,34 +3617,20 @@ function parseEndpointRecord(value) {
|
|
|
3703
3617
|
}
|
|
3704
3618
|
function endpointFromToken(token, index) {
|
|
3705
3619
|
const trimmed = token.trim();
|
|
3706
|
-
if (!trimmed) return;
|
|
3707
|
-
if (trimmed.startsWith("ws://") || trimmed.startsWith("wss://") || trimmed.startsWith("unix://")) return {
|
|
3708
|
-
id: normalizeEndpointId("", index),
|
|
3709
|
-
transport: "websocket",
|
|
3710
|
-
url: trimmed
|
|
3711
|
-
};
|
|
3712
3620
|
if (trimmed === "local" || trimmed === "proxy" || trimmed === "stdio") return {
|
|
3713
3621
|
id: "local",
|
|
3714
3622
|
label: "local Codex app-server",
|
|
3715
3623
|
transport: "stdio-proxy"
|
|
3716
3624
|
};
|
|
3717
|
-
const separatorIndex = trimmed.indexOf("=");
|
|
3718
|
-
const id = separatorIndex >= 0 ? trimmed.slice(0, separatorIndex) :
|
|
3719
|
-
const url = separatorIndex >= 0 ? trimmed.slice(separatorIndex + 1) :
|
|
3720
|
-
if (
|
|
3625
|
+
const separatorIndex = ENDPOINT_URL_PREFIX.test(trimmed) ? -1 : trimmed.indexOf("=");
|
|
3626
|
+
const id = separatorIndex >= 0 ? trimmed.slice(0, separatorIndex) : "";
|
|
3627
|
+
const url = separatorIndex >= 0 ? trimmed.slice(separatorIndex + 1) : trimmed;
|
|
3628
|
+
if (ENDPOINT_URL_PREFIX.test(url)) return {
|
|
3721
3629
|
id: normalizeEndpointId(id, index),
|
|
3722
3630
|
transport: "websocket",
|
|
3723
3631
|
url
|
|
3724
3632
|
};
|
|
3725
3633
|
}
|
|
3726
|
-
function requireUniqueEndpointIds(endpoints) {
|
|
3727
|
-
const seen = /* @__PURE__ */ new Set();
|
|
3728
|
-
for (const endpoint of endpoints) {
|
|
3729
|
-
if (seen.has(endpoint.id)) throw new Error(`duplicate Codex supervisor endpoint id: ${endpoint.id}`);
|
|
3730
|
-
seen.add(endpoint.id);
|
|
3731
|
-
}
|
|
3732
|
-
return endpoints;
|
|
3733
|
-
}
|
|
3734
3634
|
function readLegacyEnvEndpoints(env) {
|
|
3735
3635
|
const raw = env[LEGACY_CODEX_SUPERVISOR_ENDPOINTS_ENV]?.trim();
|
|
3736
3636
|
if (!raw) return;
|
|
@@ -3741,13 +3641,27 @@ function readLegacyEnvEndpoints(env) {
|
|
|
3741
3641
|
}
|
|
3742
3642
|
return raw.split(",").map(endpointFromToken).filter((entry) => Boolean(entry));
|
|
3743
3643
|
}
|
|
3744
|
-
function resolveEndpoints(pluginConfig,
|
|
3644
|
+
function resolveEndpoints(pluginConfig, options) {
|
|
3645
|
+
const env = options.env ?? process.env;
|
|
3646
|
+
const runtimeConfig = options.getRuntimeConfig?.();
|
|
3647
|
+
const { resolveAuthProfileId, resolveRuntimeOptions } = options;
|
|
3745
3648
|
const configured = readCodexPluginConfig(pluginConfig).supervision?.endpoints;
|
|
3746
3649
|
const endpoints = configured?.length ? configured : readLegacyEnvEndpoints(env);
|
|
3747
|
-
|
|
3650
|
+
const normalized = endpoints ? endpoints.map((endpoint, index) => {
|
|
3651
|
+
const entry = { id: normalizeEndpointId(endpoint.id ?? endpoint.label ?? "", index) };
|
|
3652
|
+
if (endpoint.label?.trim()) entry.label = endpoint.label.trim();
|
|
3653
|
+
entry.configured = endpoint;
|
|
3654
|
+
return entry;
|
|
3655
|
+
}) : [{
|
|
3748
3656
|
id: "local",
|
|
3749
3657
|
label: "local Codex app-server"
|
|
3750
|
-
}]
|
|
3658
|
+
}];
|
|
3659
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3660
|
+
for (const endpoint of normalized) {
|
|
3661
|
+
if (seen.has(endpoint.id)) throw new Error(`duplicate Codex supervisor endpoint id: ${endpoint.id}`);
|
|
3662
|
+
seen.add(endpoint.id);
|
|
3663
|
+
}
|
|
3664
|
+
return normalized.map((endpoint) => Object.assign({}, endpoint, { connectionKey: supervisionEndpointConnectionKey({
|
|
3751
3665
|
endpoint,
|
|
3752
3666
|
pluginConfig,
|
|
3753
3667
|
env,
|
|
@@ -4051,16 +3965,20 @@ function sanitizeSessionListResult(result, includeTranscriptDerivedFields) {
|
|
|
4051
3965
|
};
|
|
4052
3966
|
}
|
|
4053
3967
|
function requireLiveToolPolicy(options, policy) {
|
|
4054
|
-
|
|
3968
|
+
options.assertInvocationCurrent?.();
|
|
3969
|
+
if (!options.senderIsOwner) throw new CodexSupervisionPolicyError("Codex supervision compatibility tools require an owner-authorized sender.");
|
|
4055
3970
|
const pluginConfig = options.getPluginConfig();
|
|
4056
|
-
|
|
4057
|
-
if (policy === "raw-transcripts") requireRawTranscriptAccess(pluginConfig);
|
|
4058
|
-
else if (policy === "write-controls") requireWriteAccess(pluginConfig);
|
|
3971
|
+
requireToolPolicy(pluginConfig, policy);
|
|
4059
3972
|
return {
|
|
4060
3973
|
pluginConfig,
|
|
4061
|
-
endpoints: resolveEndpoints(pluginConfig, options
|
|
3974
|
+
endpoints: resolveEndpoints(pluginConfig, options)
|
|
4062
3975
|
};
|
|
4063
3976
|
}
|
|
3977
|
+
function requireToolPolicy(pluginConfig, policy) {
|
|
3978
|
+
const config = readCodexPluginConfig(pluginConfig).supervision;
|
|
3979
|
+
const error = config?.enabled !== true ? "Codex supervision is disabled in the codex plugin config." : policy === "raw-transcripts" && config.allowRawTranscripts !== true ? "Codex session reads are disabled for this codex plugin supervision config." : policy === "write-controls" && config.allowWriteControls !== true ? "Codex write controls are disabled for this codex plugin supervision config." : void 0;
|
|
3980
|
+
if (error) throw new CodexSupervisionPolicyError(error);
|
|
3981
|
+
}
|
|
4064
3982
|
function requireCurrentEndpoint(options, policy, endpoint) {
|
|
4065
3983
|
const { endpoints } = requireLiveToolPolicy(options, policy);
|
|
4066
3984
|
const currentEndpoint = endpoints.find((candidate) => candidate.id === endpoint.id);
|
|
@@ -4075,13 +3993,25 @@ function requireCurrentEndpointSet(options, expected) {
|
|
|
4075
3993
|
function idleContinuationError(threadId) {
|
|
4076
3994
|
return /* @__PURE__ */ new Error(`Codex thread ${threadId} is idle. Continue it from Codex Sessions so OpenClaw can install the Codex harness approval and tool handlers before resume.`);
|
|
4077
3995
|
}
|
|
4078
|
-
/** Builds the five shipped Codex Supervisor compatibility tools. */
|
|
4079
3996
|
function createCodexSupervisionTools(options) {
|
|
4080
3997
|
const request = createPolicyGuardedRequest(options, "enabled");
|
|
4081
3998
|
const rawTranscriptRequest = createPolicyGuardedRequest(options, "raw-transcripts");
|
|
4082
3999
|
const writeRequest = createPolicyGuardedRequest(options, "write-controls");
|
|
4083
4000
|
const current = () => requireLiveToolPolicy(options, "enabled");
|
|
4084
|
-
const
|
|
4001
|
+
const controlActiveTurn = async (rawParams, action) => {
|
|
4002
|
+
const { endpoints, pluginConfig } = current();
|
|
4003
|
+
requireToolPolicy(pluginConfig, "write-controls");
|
|
4004
|
+
const params = isRecord(rawParams) ? rawParams : {};
|
|
4005
|
+
const threadId = readStringParam(params, "thread_id", { required: true });
|
|
4006
|
+
const input = action === "steer" ? [{
|
|
4007
|
+
type: "text",
|
|
4008
|
+
text: readStringParam(params, "text", {
|
|
4009
|
+
required: true,
|
|
4010
|
+
allowEmpty: false
|
|
4011
|
+
}),
|
|
4012
|
+
text_elements: []
|
|
4013
|
+
}] : void 0;
|
|
4014
|
+
if (input && (readModeParam(params) ?? "auto") === "start") throw idleContinuationError(threadId);
|
|
4085
4015
|
const endpoint = await resolveEndpointForThread({
|
|
4086
4016
|
endpoints,
|
|
4087
4017
|
request: writeRequest,
|
|
@@ -4095,16 +4025,37 @@ function createCodexSupervisionTools(options) {
|
|
|
4095
4025
|
includeTurns: true
|
|
4096
4026
|
});
|
|
4097
4027
|
requireCurrentEndpoint(options, "write-controls", endpoint);
|
|
4098
|
-
if (statusType(thread) !== "active") throw
|
|
4099
|
-
|
|
4028
|
+
if (statusType(thread) !== "active") throw action === "steer" ? idleContinuationError(threadId) : /* @__PURE__ */ new Error(`Codex thread ${threadId} has no active turn to interrupt`);
|
|
4029
|
+
const turnId = (action === "interrupt" ? readStringParam(params, "turn_id") : void 0) ?? await resolveInProgressTurnId({
|
|
4030
|
+
request: writeRequest,
|
|
4100
4031
|
endpoint,
|
|
4101
|
-
thread
|
|
4032
|
+
thread,
|
|
4033
|
+
threadId
|
|
4034
|
+
});
|
|
4035
|
+
if (!turnId) throw new Error(action === "steer" ? `Codex thread ${threadId} is active but no in-progress turn is readable` : `Codex thread ${threadId} has no readable in-progress turn`);
|
|
4036
|
+
await writeRequest(endpoint, `turn/${action}`, input ? {
|
|
4037
|
+
threadId,
|
|
4038
|
+
expectedTurnId: turnId,
|
|
4039
|
+
input
|
|
4040
|
+
} : {
|
|
4041
|
+
threadId,
|
|
4042
|
+
turnId
|
|
4043
|
+
});
|
|
4044
|
+
const result = {
|
|
4045
|
+
endpointId: endpoint.id,
|
|
4046
|
+
threadId,
|
|
4047
|
+
...input ? { mode: "steer" } : {},
|
|
4048
|
+
turnId
|
|
4102
4049
|
};
|
|
4050
|
+
return jsonResult({
|
|
4051
|
+
summary: `codex ${input ? "steer" : "interrupted"}: ${turnId}`,
|
|
4052
|
+
result
|
|
4053
|
+
});
|
|
4103
4054
|
};
|
|
4104
4055
|
return [
|
|
4105
4056
|
{
|
|
4106
4057
|
name: "codex_endpoint_probe",
|
|
4107
|
-
label: "Codex Endpoint
|
|
4058
|
+
label: "Codex Endpoint Check",
|
|
4108
4059
|
description: "Check configured Codex app-server endpoints.",
|
|
4109
4060
|
parameters: EmptyParamsSchema,
|
|
4110
4061
|
execute: async () => {
|
|
@@ -4148,7 +4099,7 @@ function createCodexSupervisionTools(options) {
|
|
|
4148
4099
|
const { pluginConfig } = requireCurrentEndpointSet(options, endpoints);
|
|
4149
4100
|
return jsonResult({
|
|
4150
4101
|
summary: `codex sessions: ${result.sessions.length}`,
|
|
4151
|
-
...sanitizeSessionListResult(result,
|
|
4102
|
+
...sanitizeSessionListResult(result, readCodexPluginConfig(pluginConfig).supervision?.allowRawTranscripts === true)
|
|
4152
4103
|
});
|
|
4153
4104
|
}
|
|
4154
4105
|
},
|
|
@@ -4159,7 +4110,7 @@ function createCodexSupervisionTools(options) {
|
|
|
4159
4110
|
parameters: SessionReadParamsSchema,
|
|
4160
4111
|
execute: async (_toolCallId, rawParams) => {
|
|
4161
4112
|
const { endpoints, pluginConfig } = current();
|
|
4162
|
-
|
|
4113
|
+
requireToolPolicy(pluginConfig, "raw-transcripts");
|
|
4163
4114
|
const params = isRecord(rawParams) ? rawParams : {};
|
|
4164
4115
|
const threadId = readStringParam(params, "thread_id", { required: true });
|
|
4165
4116
|
const endpoint = await resolveEndpointForThread({
|
|
@@ -4186,83 +4137,20 @@ function createCodexSupervisionTools(options) {
|
|
|
4186
4137
|
label: "Codex Session Send",
|
|
4187
4138
|
description: "Steer an active Codex turn. Idle sessions must be continued through Codex Sessions.",
|
|
4188
4139
|
parameters: SessionSendParamsSchema,
|
|
4189
|
-
execute:
|
|
4190
|
-
const { endpoints, pluginConfig } = current();
|
|
4191
|
-
requireWriteAccess(pluginConfig);
|
|
4192
|
-
const params = isRecord(rawParams) ? rawParams : {};
|
|
4193
|
-
const threadId = readStringParam(params, "thread_id", { required: true });
|
|
4194
|
-
const text = readStringParam(params, "text", {
|
|
4195
|
-
required: true,
|
|
4196
|
-
allowEmpty: false
|
|
4197
|
-
});
|
|
4198
|
-
if ((readModeParam(params) ?? "auto") === "start") throw idleContinuationError(threadId);
|
|
4199
|
-
const { endpoint, thread } = await readActiveThread(endpoints, params, threadId, () => idleContinuationError(threadId));
|
|
4200
|
-
const turnId = await resolveInProgressTurnId({
|
|
4201
|
-
request: writeRequest,
|
|
4202
|
-
endpoint,
|
|
4203
|
-
thread,
|
|
4204
|
-
threadId
|
|
4205
|
-
});
|
|
4206
|
-
if (!turnId) throw new Error(`Codex thread ${threadId} is active but no in-progress turn is readable`);
|
|
4207
|
-
await writeRequest(endpoint, "turn/steer", {
|
|
4208
|
-
threadId,
|
|
4209
|
-
expectedTurnId: turnId,
|
|
4210
|
-
input: [{
|
|
4211
|
-
type: "text",
|
|
4212
|
-
text,
|
|
4213
|
-
text_elements: []
|
|
4214
|
-
}]
|
|
4215
|
-
});
|
|
4216
|
-
const result = {
|
|
4217
|
-
endpointId: endpoint.id,
|
|
4218
|
-
threadId,
|
|
4219
|
-
mode: "steer",
|
|
4220
|
-
turnId
|
|
4221
|
-
};
|
|
4222
|
-
return jsonResult({
|
|
4223
|
-
summary: `codex steer: ${turnId}`,
|
|
4224
|
-
result
|
|
4225
|
-
});
|
|
4226
|
-
}
|
|
4140
|
+
execute: (_toolCallId, rawParams) => controlActiveTurn(rawParams, "steer")
|
|
4227
4141
|
},
|
|
4228
4142
|
{
|
|
4229
4143
|
name: "codex_session_interrupt",
|
|
4230
4144
|
label: "Codex Session Interrupt",
|
|
4231
4145
|
description: "Interrupt an active Codex turn.",
|
|
4232
4146
|
parameters: SessionInterruptParamsSchema,
|
|
4233
|
-
execute:
|
|
4234
|
-
const { endpoints, pluginConfig } = current();
|
|
4235
|
-
requireWriteAccess(pluginConfig);
|
|
4236
|
-
const params = isRecord(rawParams) ? rawParams : {};
|
|
4237
|
-
const threadId = readStringParam(params, "thread_id", { required: true });
|
|
4238
|
-
const { endpoint, thread } = await readActiveThread(endpoints, params, threadId, () => /* @__PURE__ */ new Error(`Codex thread ${threadId} has no active turn to interrupt`));
|
|
4239
|
-
const turnId = readStringParam(params, "turn_id") ?? await resolveInProgressTurnId({
|
|
4240
|
-
request: writeRequest,
|
|
4241
|
-
endpoint,
|
|
4242
|
-
thread,
|
|
4243
|
-
threadId
|
|
4244
|
-
});
|
|
4245
|
-
if (!turnId) throw new Error(`Codex thread ${threadId} has no readable in-progress turn`);
|
|
4246
|
-
await writeRequest(endpoint, "turn/interrupt", {
|
|
4247
|
-
threadId,
|
|
4248
|
-
turnId
|
|
4249
|
-
});
|
|
4250
|
-
const result = {
|
|
4251
|
-
endpointId: endpoint.id,
|
|
4252
|
-
threadId,
|
|
4253
|
-
turnId
|
|
4254
|
-
};
|
|
4255
|
-
return jsonResult({
|
|
4256
|
-
summary: `codex interrupted: ${turnId}`,
|
|
4257
|
-
result
|
|
4258
|
-
});
|
|
4259
|
-
}
|
|
4147
|
+
execute: (_toolCallId, rawParams) => controlActiveTurn(rawParams, "interrupt")
|
|
4260
4148
|
}
|
|
4261
4149
|
];
|
|
4262
4150
|
}
|
|
4263
4151
|
//#endregion
|
|
4264
4152
|
//#region extensions/codex/src/web-search-provider.ts
|
|
4265
|
-
const loadCodexWebSearchRuntime = createLazyRuntimeModule(() => import("./.setup/web-search-provider.runtime-
|
|
4153
|
+
const loadCodexWebSearchRuntime = createLazyRuntimeModule(() => import("./.setup/web-search-provider.runtime-BsuCMNix.mjs"));
|
|
4266
4154
|
const CodexWebSearchSchema = {
|
|
4267
4155
|
type: "object",
|
|
4268
4156
|
properties: { query: {
|
|
@@ -4276,8 +4164,7 @@ function createCodexWebSearchProvider(options = {}) {
|
|
|
4276
4164
|
return {
|
|
4277
4165
|
...createCodexWebSearchProviderBase(),
|
|
4278
4166
|
createTool: (ctx) => {
|
|
4279
|
-
|
|
4280
|
-
if (nativeConfig && typeof nativeConfig === "object" && !Array.isArray(nativeConfig) && nativeConfig.enabled === false) return null;
|
|
4167
|
+
if (asOptionalRecord(ctx.searchConfig?.openaiCodex)?.enabled === false) return null;
|
|
4281
4168
|
return {
|
|
4282
4169
|
description: "Search the current web through Codex hosted search and return a grounded answer with source URLs.",
|
|
4283
4170
|
parameters: CodexWebSearchSchema,
|
|
@@ -4315,14 +4202,13 @@ var codex_default = definePluginEntry({
|
|
|
4315
4202
|
const liveConfig = resolveConfig();
|
|
4316
4203
|
if (!liveConfig) return api.pluginConfig;
|
|
4317
4204
|
const livePluginConfig = resolveLivePluginConfigObject(() => liveConfig, "codex", api.pluginConfig);
|
|
4318
|
-
|
|
4205
|
+
return resolveEffectiveEnableState({
|
|
4319
4206
|
id: "codex",
|
|
4320
4207
|
origin: "bundled",
|
|
4321
4208
|
config: normalizePluginsConfig(liveConfig.plugins),
|
|
4322
4209
|
rootConfig: liveConfig,
|
|
4323
4210
|
enabledByDefault: livePluginConfig !== void 0
|
|
4324
|
-
}).enabled
|
|
4325
|
-
return livePluginConfig;
|
|
4211
|
+
}).enabled ? livePluginConfig : void 0;
|
|
4326
4212
|
};
|
|
4327
4213
|
const resolveCurrentPluginConfig = () => resolvePluginConfig(resolveCurrentConfig);
|
|
4328
4214
|
const appServerConfig = readCodexPluginConfig(resolveCurrentPluginConfig()).appServer;
|
|
@@ -4529,7 +4415,7 @@ var codex_default = definePluginEntry({
|
|
|
4529
4415
|
if (endedSessionKey && nextSessionKey && nextSessionKey !== endedSessionKey) return;
|
|
4530
4416
|
if (event.nextSessionId?.trim() === event.sessionId.trim()) return;
|
|
4531
4417
|
const config = resolveCurrentConfig();
|
|
4532
|
-
const [{ sessionBindingIdentity }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./.setup/session-binding-
|
|
4418
|
+
const [{ sessionBindingIdentity }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./.setup/session-binding-JEHNMPsr.mjs").then((n) => n.a), import("./.setup/session-retirement-IoS3zr17.mjs")]);
|
|
4533
4419
|
await retireCodexAppServerSessionGeneration({
|
|
4534
4420
|
bindingStore,
|
|
4535
4421
|
identity: sessionBindingIdentity({
|