@openclaw/codex 2026.9.4 → 2026.9.6
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/assets/activity.svg +30 -0
- package/assets/icon.png +0 -0
- package/dist/.setup/account-usage-runtime-Eem_WGqY.mjs +75 -0
- package/dist/{apply-CvT8tW5i.js → .setup/apply-DDOi8uNx.mjs} +24 -30
- package/dist/.setup/async-questions-DdhOCwGi.mjs +27 -0
- package/dist/{attempt-client-cleanup-DKHzbwt5.js → .setup/attempt-client-cleanup-CEv1cKwF.mjs} +79 -49
- package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +5 -0
- package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +331 -0
- package/dist/{auth-binding-CWlKVccJ.js → .setup/auth-binding-DhLWa_7K.mjs} +1 -1
- package/dist/{auth-cache-key-7orQae_j.js → .setup/auth-cache-key-B2mpaI9D.mjs} +9 -81
- package/dist/{auth-profile-CwzO4_RG.js → .setup/auth-profile-WqZtZfXN.mjs} +1 -1
- package/dist/.setup/auth-profile-health-oHizqgye.mjs +53 -0
- package/dist/.setup/auth-profile-recovery-BREezV0L.mjs +14 -0
- package/dist/.setup/binding-connection-ThoatDcb.mjs +50 -0
- package/dist/.setup/binding-connection.runtime-yoHrABt-.mjs +48 -0
- package/dist/{bounded-turn-C_Hneydj.js → .setup/bounded-turn-B2HScEgT.mjs} +143 -32
- package/dist/{build-state-BCmg9-5p.js → .setup/build-state-C7EnDVgr.mjs} +1 -1
- package/dist/{capabilities-8vx68WLH.js → .setup/capabilities-CDXOOFdZ.mjs} +1 -1
- package/dist/{client-B57KWPQx.js → .setup/client-Cs08OXVQ.mjs} +705 -512
- package/dist/.setup/client-catalog-response-BMgt_4q4.mjs +285 -0
- package/dist/{command-dispatch-BpduNGVf.js → .setup/command-dispatch-B4JuOsOk.mjs} +8 -4
- package/dist/{command-formatters-lxlkNZgU.js → .setup/command-formatters-Bmqvr9tO.mjs} +8 -4
- package/dist/{command-handlers-tiL9iWj7.js → .setup/command-handlers-DW7Lx9oH.mjs} +137 -186
- package/dist/{command-rpc-CR5EOEZX.js → .setup/command-rpc-DixIj3HW.mjs} +47 -23
- package/dist/{compact-B_H3AOd7.js → .setup/compact-Du5UvtxA.mjs} +29 -51
- package/dist/{config-oIORaQ5T.js → .setup/config-BoTP_mrL.mjs} +5 -4
- package/dist/{config-options-CXMq1T-C.js → .setup/config-options-BvaRs51b.mjs} +50 -446
- package/dist/{protocol-5bh1G-H7.js → .setup/config-parsing-CcB9iPoq.mjs} +9 -51
- package/dist/{config-runtime-D0zGNIHu.js → .setup/config-runtime-C8Rw1m1m.mjs} +2 -2
- package/dist/.setup/config-security-BEReZ6go.mjs +380 -0
- package/dist/{conversation-binding-DsB4-O7U.js → .setup/conversation-binding-DP-gMrBP.mjs} +29 -38
- package/dist/{conversation-binding-data-BiodpIzq.js → .setup/conversation-binding-data-CrcyZk6O.mjs} +1 -1
- package/dist/{conversation-control-CtUu1b3m.js → .setup/conversation-control-uK9Jomlc.mjs} +32 -67
- package/dist/.setup/cyber-failover-DYwbmf1o.mjs +123 -0
- package/dist/.setup/cyber-failover-notice-e9G3J9-e.mjs +17 -0
- package/dist/{dynamic-tools-CmN5RAip.js → .setup/dynamic-tools-BDXl-8Cw.mjs} +936 -620
- package/dist/{effective-mcp-catalog-Bd73bqA8.js → .setup/effective-mcp-catalog-CvnvnGIe.mjs} +3 -3
- package/dist/{ephemeral-turn-D78_VmzO.js → .setup/ephemeral-turn-poidXgek.mjs} +9 -7
- package/dist/{event-projector-assistant-message-BmBM4qBV.js → .setup/event-projector-assistant-message-BsruvNrH.mjs} +8 -7
- package/dist/{event-projector-items-5VhsECCO.js → .setup/event-projector-items-C6L_5ZiT.mjs} +42 -8
- package/dist/{attempt-notifications-C9XufG6l.js → .setup/event-projector-usage-CnBS8Wa3.mjs} +102 -9
- package/dist/{harness-C7rRa7bm.js → .setup/harness-a_MsE4-_.mjs} +81 -21
- package/dist/{inference-context-Dr_mzvk4.js → .setup/inference-context-D96l9-ew.mjs} +1 -1
- package/dist/.setup/inference-proxy-b-aJMSxm.mjs +601 -0
- package/dist/{isolated-completion-DWVb5U2J.js → .setup/isolated-completion-BIZFhTNG.mjs} +18 -11
- package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
- package/dist/{managed-binary-D22rNEcR.js → .setup/managed-binary-BnshlFag.mjs} +14 -3
- package/dist/{managed-thread-store-D1t5jh3G.js → .setup/managed-thread-store-BMqgThVL.mjs} +48 -14
- package/dist/{model-catalog-Dq2n8f_p.js → .setup/model-catalog-CfXJf9Ay.mjs} +36 -12
- package/dist/{models-PCKOim-h.js → .setup/models-KnqBv0hE.mjs} +3 -3
- package/dist/.setup/native-auth-rWbGbMn3.mjs +57 -0
- package/dist/{native-subagent-history-DjtPloaU.js → .setup/native-subagent-history-0nYYgo0k.mjs} +43 -35
- package/dist/.setup/native-subagent-monitor-D3filLY2.mjs +4859 -0
- package/dist/{native-subagent-task-ids-BzTdT0Uw.js → .setup/native-subagent-task-ids-wb8CKZGN.mjs} +98 -44
- package/dist/{node-cli-sessions-DKaOmVUh.js → .setup/node-cli-sessions-r3avj02l.mjs} +86 -68
- package/dist/.setup/node-exec-server.runtime-BDwWXVpK.mjs +247 -0
- package/dist/{plan-7uG-Fp36.js → .setup/plan-CN3VwfNU.mjs} +133 -119
- package/dist/{plugin-activation-BYQculil.js → .setup/plugin-activation-DT3MNtqj.mjs} +7 -16
- package/dist/{plugin-app-cache-key-d0eKxy7b.js → .setup/plugin-app-cache-key-B2CsSdnV.mjs} +32 -44
- package/dist/{plugin-approval-roundtrip-Bz3FT8W5.js → .setup/plugin-approval-roundtrip-C0MZzCuP.mjs} +1 -1
- package/dist/{plugin-inventory-oL4Na1ZG.js → .setup/plugin-inventory-BoRei8Z4.mjs} +21 -11
- package/dist/{plugin-marketplace-discovery-P-Vndfqq.js → .setup/plugin-marketplace-discovery-CDOi8IFs.mjs} +4 -1
- package/dist/{plugin-metadata-cache-ClPJpRio.js → .setup/plugin-metadata-cache-Ctmo83k_.mjs} +226 -141
- package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
- package/dist/{provider-MQ8PVkuE.js → .setup/provider-BOsxQHOM.mjs} +9 -5
- package/dist/{provider-capabilities-BvCUL69A.js → .setup/provider-capabilities-BfE88FZ5.mjs} +31 -3
- package/dist/{rate-limits-CBMmWBr9.js → .setup/rate-limits-CMU3DUD0.mjs} +174 -151
- package/dist/{request-B7hEkBGq.js → .setup/request-D2L0zMrq.mjs} +130 -42
- package/dist/{run-attempt-CvsAAGa0.js → .setup/run-attempt-BHu11r7h.mjs} +1628 -966
- package/dist/.setup/run-attempt-lifecycle-B7JbY4-F.mjs +71 -0
- package/dist/{runtime-artifact-BJ0rXBZ_.js → .setup/runtime-artifact-CLZ8udh-.mjs} +29 -45
- package/dist/{sandbox-guard-BxgyoM8M.js → .setup/sandbox-guard-C2sRMOEY.mjs} +3 -3
- package/dist/{session-binding-CI8UuilT.js → .setup/session-binding-Cm0apEbd.mjs} +36 -83
- package/dist/{session-binding-record-Bcvslnhf.js → .setup/session-binding-record-BGoz8wOK.mjs} +202 -5
- package/dist/.setup/session-binding-sidecars-BlB5EvIS.mjs +546 -0
- package/dist/.setup/session-catalog-Pno1xGcl.mjs +2764 -0
- package/dist/{session-catalog-adoption-tcZi1IfX.js → .setup/session-catalog-adoption-BI6UTDZT.mjs} +58 -26
- package/dist/{session-catalog-archive-CwKg8Xz2.js → .setup/session-catalog-archive-lHBqzhaO.mjs} +6 -6
- package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +347 -0
- package/dist/.setup/session-catalog-index-B9_VQIUz.mjs +1170 -0
- package/dist/.setup/session-catalog-index-order-hcdz07yN.mjs +48 -0
- package/dist/.setup/session-catalog-index-state-Dgh8ORJm.mjs +183 -0
- package/dist/{thread-history-page-D0JIp48V.js → .setup/session-catalog-native-projection-DowriLid.mjs} +223 -95
- package/dist/{session-catalog-node-adoption-B1tgDW-m.js → .setup/session-catalog-node-adoption-ITddWx_X.mjs} +25 -13
- package/dist/{session-catalog-node-continue-Ci-DXyJP.js → .setup/session-catalog-node-continue-6g6qi4A9.mjs} +24 -15
- package/dist/.setup/session-catalog-projection-zK_PUsiE.mjs +422 -0
- package/dist/{session-cli-DNN_jhGc.js → .setup/session-cli-irrD-uo7.mjs} +3 -3
- package/dist/{session-history-Cz-tOOYj.js → .setup/session-history-BrqhSCf9.mjs} +19 -19
- package/dist/{session-history-import-DwyijFI6.js → .setup/session-history-import-D-3wAgOP.mjs} +4 -4
- package/dist/{session-history-read-cxPUxyVV.js → .setup/session-history-read-B3ZfSUbF.mjs} +2 -2
- package/dist/{session-history.worker-BeK1YOyT.js → .setup/session-history.worker-CaCh0xF_.mjs} +10 -24
- package/dist/{session-initialization-Ct0_Hzmg.js → .setup/session-initialization-rcgbZiid.mjs} +2 -2
- package/dist/{session-permission-policy-BBmXA8Eg.js → .setup/session-permission-policy-BI1QK_98.mjs} +2 -2
- package/dist/{session-retirement-B2YfbAAT.js → .setup/session-retirement-BH-S6qkJ.mjs} +26 -7
- package/dist/{settled-turn-context-Du6gdUDd.js → .setup/settled-turn-context-fmwouT5I.mjs} +2 -2
- package/dist/{settled-turn-finalizer-Dn91stmc.js → .setup/settled-turn-finalizer-DiAi6Kx6.mjs} +12 -12
- package/dist/{shared-client-CscigXXL.js → .setup/shared-client-DA4VR4Eb.mjs} +332 -221
- package/dist/{side-question-BGMJQf4U.js → .setup/side-question-BJ1wSDcB.mjs} +183 -230
- package/dist/{source-CElXU0Oy.js → .setup/source-CUzJq5WN.mjs} +11 -10
- package/dist/.setup/spawn-error-CL3n6MAa.mjs +57 -0
- package/dist/{thread-archive-guard-DfpBr-Sz.js → .setup/thread-archive-guard-C9frICzX.mjs} +10 -3
- package/dist/.setup/thread-history-page-DoVpnHim.mjs +83 -0
- package/dist/{thread-lifecycle-DXl1-I6b.js → .setup/thread-lifecycle-B3mfz1TG.mjs} +347 -2318
- package/dist/{thread-ownership-BsDRTsyp.js → .setup/thread-ownership-DcTtAcXj.mjs} +6 -4
- package/dist/{thread-policy-BuEQfE0g.js → .setup/thread-policy-DGuQsuFC.mjs} +19 -3
- package/dist/.setup/thread-requests-BLvGkP2R.mjs +2205 -0
- package/dist/{thread-resume-DsDOZpFg.js → .setup/thread-resume-DIBXwOpE.mjs} +8 -5
- package/dist/.setup/timeout-C910MdAB.mjs +80 -0
- package/dist/{transcript-history-projection-v17wXgdK.js → .setup/transcript-history-projection-ZZpkFkJ_.mjs} +96 -61
- package/dist/{transcript-mirror-C5CKgNy6.js → .setup/transcript-mirror-BtHDBp1G.mjs} +224 -195
- package/dist/{transcript-mirror-attestation-DibE0krH.js → .setup/transcript-mirror-attestation-CzM-94NC.mjs} +4 -1
- package/dist/{transport-stdio-BGjHoYLr.js → .setup/transport-stdio-h2VHOskC.mjs} +274 -89
- package/dist/{upstream-session-fork-BZerMte_.js → .setup/upstream-session-fork-BUr4OUbC.mjs} +51 -42
- package/dist/{usage-tCk-mg_x.js → .setup/usage-BML0r-ua.mjs} +5 -4
- package/dist/.setup/usage-limit-error-DUMbefVY.mjs +166 -0
- package/dist/{web-search-provider.runtime-B7bGbGWq.js → .setup/web-search-provider.runtime-CDKlN-Rv.mjs} +4 -3
- package/dist/api.js +23 -12
- package/dist/catalog-page-worker-entrypoint.js +12 -0
- package/dist/catalog-page.worker.js +9 -0
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +8 -528
- package/dist/harness.js +1 -1
- package/dist/index.js +306 -215
- package/dist/media-understanding-provider.js +3 -3
- package/dist/migration-provider-api.js +1 -1
- package/dist/native-tool-policy.js +12 -0
- package/dist/provider-discovery.js +18 -0
- package/dist/session-history-worker-runtime.js +36 -35
- package/dist/session-history.worker.js +2 -2
- package/dist/web-search-contract-api.js +1 -1
- package/openclaw.plugin.json +354 -69
- package/package.json +14 -8
- package/dist/attempt-context-D44yeDII.js +0 -636
- package/dist/binding-connection-D3udKbIE.js +0 -60
- package/dist/event-projector-usage-BfXmpOec.js +0 -102
- package/dist/inference-proxy-HGXKUIre.js +0 -311
- package/dist/launch-args-RXQwn8zV.js +0 -90
- package/dist/native-subagent-history-owner-Pcp7JuVF.js +0 -34
- package/dist/native-subagent-monitor-fQ7eIXEf.js +0 -2978
- package/dist/node-exec-server.runtime-Cl2vapEi.js +0 -226
- package/dist/rpc-error-ttN_QjEm.js +0 -30
- package/dist/session-catalog-ct-AH01I.js +0 -1477
- package/dist/session-catalog-home-id-CwhLdC03.js +0 -18
- package/dist/session-catalog-provenance-D-dIfRAH.js +0 -96
- package/dist/timeout-BVw8aaM1.js +0 -33
- package/dist/version-omm6IPI3.js +0 -12
- /package/dist/{auth-profile-selection-DFu9e167.js → .setup/auth-profile-selection-DFu9e167.mjs} +0 -0
- /package/dist/{config-utils-DujwEnhg.js → .setup/config-utils-DujwEnhg.mjs} +0 -0
- /package/dist/{context-compaction-activity-CMla5FPJ.js → .setup/context-compaction-activity-CMla5FPJ.mjs} +0 -0
- /package/dist/{elicitation-input-DPoK8F7w.js → .setup/elicitation-input-DPoK8F7w.mjs} +0 -0
- /package/dist/{history-rejection-B4nOXNXF.js → .setup/history-rejection-B4nOXNXF.mjs} +0 -0
- /package/dist/{image-payload-sanitizer-tupAr-2o.js → .setup/image-payload-sanitizer-tupAr-2o.mjs} +0 -0
- /package/dist/{incognito-session-uhrBF6wJ.js → .setup/incognito-session-uhrBF6wJ.mjs} +0 -0
- /package/dist/{local-runtime-attribution-B_2mnqhb.js → .setup/local-runtime-attribution-B_2mnqhb.mjs} +0 -0
- /package/dist/{native-execution-policy-umd0tgh4.js → .setup/native-execution-policy-umd0tgh4.mjs} +0 -0
- /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
- /package/dist/{session-binding-meta-B7aEMU7g.js → .setup/session-binding-meta-B7aEMU7g.mjs} +0 -0
- /package/dist/{session-upstream-marker-D15C9NHp.js → .setup/session-upstream-marker-D15C9NHp.mjs} +0 -0
- /package/dist/{upstream-prompt-provenance-LphB8slG.js → .setup/upstream-prompt-provenance-LphB8slG.mjs} +0 -0
- /package/dist/{web-search-provider.shared-BrZmlqyR.js → .setup/web-search-provider.shared-BrZmlqyR.mjs} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,38 +1,54 @@
|
|
|
1
1
|
import { registerCodexCliMetadata } from "./cli-metadata.js";
|
|
2
|
-
import { n as createCodexAppServerNativeCompaction, t as createCodexAppServerAgentHarness } from "
|
|
3
|
-
import { l as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced,
|
|
4
|
-
import { n as defineCodexBuildState } from "
|
|
2
|
+
import { n as createCodexAppServerNativeCompaction, t as createCodexAppServerAgentHarness } from "./.setup/harness-a_MsE4-_.mjs";
|
|
3
|
+
import { d as readCurrentCodexNativeSubagentSubmissions, l as readCurrentCodexAppServerBinding, m as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced, u as readCurrentCodexAppServerBindings } from "./.setup/session-binding-record-BGoz8wOK.mjs";
|
|
4
|
+
import { n as defineCodexBuildState } from "./.setup/build-state-C7EnDVgr.mjs";
|
|
5
5
|
import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { o as
|
|
14
|
-
import {
|
|
15
|
-
import { n as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { t as
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { i as
|
|
24
|
-
import { t as
|
|
6
|
+
import codexProviderDiscovery from "./provider-discovery.js";
|
|
7
|
+
import { n as createCodexAuthProfileSelection } from "./.setup/auth-profile-selection-DFu9e167.mjs";
|
|
8
|
+
import { t as assertCodexAppServerConnectionSecurity } from "./.setup/config-security-BEReZ6go.mjs";
|
|
9
|
+
import { d as readCodexPluginConfig } from "./.setup/config-parsing-CcB9iPoq.mjs";
|
|
10
|
+
import { K as CODEX_INTERACTIVE_THREAD_SOURCE_KINDS, U as CODEX_CATALOG_MAX_ROWS } from "./.setup/session-catalog-native-projection-DowriLid.mjs";
|
|
11
|
+
import { i as isJsonObject } from "./.setup/protocol-CANUwXJ3.mjs";
|
|
12
|
+
import { r as createCodexAppServerConfig, t as codexAppServerStartOptionsKey } from "./.setup/config-options-BvaRs51b.mjs";
|
|
13
|
+
import { o as setManagedCodexPluginRoot } from "./.setup/managed-binary-BnshlFag.mjs";
|
|
14
|
+
import { l as createCodexDesktopGenerationService, s as resolveCodexAppServerFallbackApiKeyCacheKey } from "./.setup/auth-cache-key-B2mpaI9D.mjs";
|
|
15
|
+
import { n as CODEX_MANAGED_THREAD_NAMESPACE, r as createCodexManagedThreadStore, t as CODEX_MANAGED_THREAD_MAX_ENTRIES } from "./.setup/managed-thread-store-BMqgThVL.mjs";
|
|
16
|
+
import { n as CODEX_APP_SERVER_BINDING_NAMESPACE, t as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./.setup/session-binding-meta-B7aEMU7g.mjs";
|
|
17
|
+
import { g as retireSharedCodexAppServerClientsBeforeDesktopGeneration } from "./.setup/session-catalog-events-Bj6j94E_.mjs";
|
|
18
|
+
import { s as createCodexAppServerProcessReaperService } from "./.setup/transport-stdio-h2VHOskC.mjs";
|
|
19
|
+
import { n as codexNativeProfileRecoveryService } from "./.setup/auth-profile-health-oHizqgye.mjs";
|
|
20
|
+
import { r as withCodexConversationThreadActivity, t as isIncognitoSessionKey } from "./.setup/incognito-session-uhrBF6wJ.mjs";
|
|
21
|
+
import { c as canMutateCodexHost, n as filterCodexMarketplacePlugins, o as CODEX_NATIVE_EXECUTION_AUTH_ERROR, t as discoverCodexMarketplacePlugins } from "./.setup/plugin-marketplace-discovery-CDOi8IFs.mjs";
|
|
22
|
+
import { o as formatCodexDisplayText } from "./.setup/command-formatters-Bmqvr9tO.mjs";
|
|
23
|
+
import { a as readCodexConversationBindingDataRecord, i as readCodexConversationBindingData, o as resolveCodexDefaultWorkspaceDir } from "./.setup/conversation-binding-data-CrcyZk6O.mjs";
|
|
24
|
+
import { t as buildCodexMigrationProvider } from "./.setup/provider-BOsxQHOM.mjs";
|
|
25
|
+
import { t as CODEX_CONTROL_METHODS } from "./.setup/capabilities-CDXOOFdZ.mjs";
|
|
26
|
+
import { t as assertCodexArchiveDescendantsUnowned } from "./.setup/thread-archive-guard-C9frICzX.mjs";
|
|
27
|
+
import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, s as listCodexCliSessionsOnNode } from "./.setup/node-cli-sessions-r3avj02l.mjs";
|
|
28
|
+
import { t as CODEX_CATALOG_STATE_NAMESPACE } from "./.setup/session-catalog-index-state-Dgh8ORJm.mjs";
|
|
29
|
+
import { i as createCodexSessionCatalogNodeHostCommands, n as createCodexSessionCatalogNodeInvokePolicies, r as createCodexSessionCatalogControl, t as codexSessionCatalogRuntime } from "./.setup/session-catalog-Pno1xGcl.mjs";
|
|
30
|
+
import { i as requestCodexAppServerJson } from "./.setup/request-D2L0zMrq.mjs";
|
|
31
|
+
import { t as createCodexWebSearchProviderBase } from "./.setup/web-search-provider.shared-BrZmlqyR.mjs";
|
|
25
32
|
import { normalizePluginsConfig, resolveEffectiveEnableState, resolveLivePluginConfigObject, resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
26
33
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
27
34
|
import { asBoolean, asOptionalRecord, asSafeIntegerInRange, isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
35
|
+
import { isDeepStrictEqual } from "node:util";
|
|
28
36
|
import { resolveDefaultAgentDir } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
29
37
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
30
|
-
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
31
38
|
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
39
|
+
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
32
40
|
import { jsonResult } from "openclaw/plugin-sdk/tool-results";
|
|
33
41
|
import { Type } from "typebox";
|
|
34
42
|
import { readStringParam } from "openclaw/plugin-sdk/param-readers";
|
|
35
43
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
44
|
+
//#region extensions/codex/src/account-usage.ts
|
|
45
|
+
function registerCodexAccountUsage(api) {
|
|
46
|
+
api.registerGatewayMethod("codex.accountUsage", async (options) => {
|
|
47
|
+
const { handleCodexAccountUsage } = await import("./.setup/account-usage-runtime-Eem_WGqY.mjs");
|
|
48
|
+
await handleCodexAccountUsage(options);
|
|
49
|
+
}, { scope: "operator.admin" });
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
36
52
|
//#region extensions/codex/src/app-server/connection-health.ts
|
|
37
53
|
const INITIAL_RECONNECT_DELAY_MS = 1e3;
|
|
38
54
|
const MAX_RECONNECT_DELAY_MS = 3e4;
|
|
@@ -40,7 +56,7 @@ function createCodexAppServerConnectionHealthService(options) {
|
|
|
40
56
|
let abortController;
|
|
41
57
|
let monitor;
|
|
42
58
|
const run = async (ctx, signal) => {
|
|
43
|
-
const { resolveCodexAppServerRuntimeOptions } = await import("
|
|
59
|
+
const { resolveCodexAppServerRuntimeOptions } = await import("./.setup/config-runtime-C8Rw1m1m.mjs").then((n) => n.t);
|
|
44
60
|
let consecutiveFailures = 0;
|
|
45
61
|
while (!signal.aborted) {
|
|
46
62
|
let pluginConfig;
|
|
@@ -56,8 +72,8 @@ function createCodexAppServerConnectionHealthService(options) {
|
|
|
56
72
|
return;
|
|
57
73
|
}
|
|
58
74
|
if (runtime.start.transport !== "websocket") return;
|
|
59
|
-
const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("
|
|
60
|
-
const { isUnsupportedCodexAppServerVersionError } = await import("
|
|
75
|
+
const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./.setup/shared-client-DA4VR4Eb.mjs").then((n) => n.y);
|
|
76
|
+
const { isUnsupportedCodexAppServerVersionError } = await import("./.setup/client-Cs08OXVQ.mjs").then((n) => n.n);
|
|
61
77
|
if (signal.aborted) return;
|
|
62
78
|
let leasedClient;
|
|
63
79
|
try {
|
|
@@ -158,11 +174,15 @@ function waitForReconnect(delayMs, signal) {
|
|
|
158
174
|
/** Keeps lifecycle/auth loading behind mutations while sharing the canonical read codec. */
|
|
159
175
|
function createLazyCodexAppServerBindingStore(state, managedThreadState) {
|
|
160
176
|
let resolved;
|
|
161
|
-
const store = () => resolved ??= import("
|
|
177
|
+
const store = () => resolved ??= import("./.setup/session-binding-Cm0apEbd.mjs").then((n) => n.s).then(({ createCodexAppServerBindingStore }) => createCodexAppServerBindingStore(state));
|
|
162
178
|
const managedThreads = managedThreadState ? createCodexManagedThreadStore(managedThreadState) : void 0;
|
|
163
179
|
return {
|
|
164
180
|
...managedThreads ? { managedThreads } : {},
|
|
165
181
|
read: (identity) => readCurrentCodexAppServerBinding(state, identity),
|
|
182
|
+
get readMany() {
|
|
183
|
+
return state.lookupMany ? (identities) => readCurrentCodexAppServerBindings(state, identities) : void 0;
|
|
184
|
+
},
|
|
185
|
+
readNativeSubagentSubmissions: (identity, owner) => readCurrentCodexNativeSubagentSubmissions(state, identity, owner),
|
|
166
186
|
hasOtherThreadOwner: async (threadId, currentIdentity) => (await store()).hasOtherThreadOwner(threadId, currentIdentity),
|
|
167
187
|
mutate: async (identity, mutation, assertCurrent) => (await store()).mutate(identity, mutation, assertCurrent),
|
|
168
188
|
prepareSessionGenerationReclaim: async (identity) => (await store()).prepareSessionGenerationReclaim(identity),
|
|
@@ -199,14 +219,26 @@ function createCodexCommand(options) {
|
|
|
199
219
|
acceptsArgs: true,
|
|
200
220
|
requireAuth: true,
|
|
201
221
|
handler: async (ctx) => {
|
|
202
|
-
const
|
|
203
|
-
|
|
222
|
+
const commandContext = {
|
|
223
|
+
...ctx,
|
|
224
|
+
gatewayClientScopes: ctx.gatewayClientScopes?.slice()
|
|
225
|
+
};
|
|
226
|
+
const { handleCodexCommand } = await import("./.setup/command-dispatch-B4JuOsOk.mjs");
|
|
227
|
+
return handleCodexCommand(commandContext, options);
|
|
204
228
|
}
|
|
205
229
|
};
|
|
206
230
|
}
|
|
207
231
|
//#endregion
|
|
208
232
|
//#region extensions/codex/src/conversation-binding-hooks.ts
|
|
209
233
|
const getNodeConversationState = defineCodexBuildState("openclaw.codex.conversationBinding", () => ({ queue: new KeyedAsyncQueue() }));
|
|
234
|
+
function isCurrentPublicBinding(binding, service) {
|
|
235
|
+
return service.resolveByConversation({
|
|
236
|
+
channel: binding.channel,
|
|
237
|
+
accountId: binding.accountId,
|
|
238
|
+
conversationId: binding.conversationId,
|
|
239
|
+
...binding.parentConversationId ? { parentConversationId: binding.parentConversationId } : {}
|
|
240
|
+
})?.bindingId === binding.bindingId;
|
|
241
|
+
}
|
|
210
242
|
async function handleCodexConversationInboundClaim(event, ctx, options) {
|
|
211
243
|
const publicBinding = ctx.pluginBinding;
|
|
212
244
|
const data = readCodexConversationBindingData(publicBinding);
|
|
@@ -223,7 +255,7 @@ async function handleCodexConversationInboundClaim(event, ctx, options) {
|
|
|
223
255
|
return {
|
|
224
256
|
handled: true,
|
|
225
257
|
reply: (await getNodeConversationState().queue.enqueue(`${data.nodeId}:${data.sessionId}`, async () => {
|
|
226
|
-
const { resolveCodexNativeSandboxBlock } = await import("
|
|
258
|
+
const { resolveCodexNativeSandboxBlock } = await import("./.setup/sandbox-guard-C2sRMOEY.mjs").then((n) => n.r);
|
|
227
259
|
const blocked = resolveCodexNativeSandboxBlock({
|
|
228
260
|
config: options.config,
|
|
229
261
|
sessionKey,
|
|
@@ -232,9 +264,13 @@ async function handleCodexConversationInboundClaim(event, ctx, options) {
|
|
|
232
264
|
if (blocked) return { reply: { text: blocked } };
|
|
233
265
|
const resume = options.resumeCodexCliSessionOnNode;
|
|
234
266
|
if (!resume) return { reply: { text: "Codex CLI node binding is unavailable because Gateway node runtime is not attached." } };
|
|
267
|
+
const { getSessionBindingService } = await import("openclaw/plugin-sdk/conversation-binding-runtime");
|
|
268
|
+
if (!isCurrentPublicBinding(publicBinding, getSessionBindingService())) return { reply: { text: "This Codex conversation was detached or changed before its message could run." } };
|
|
235
269
|
return { reply: { text: (await resume({
|
|
236
270
|
nodeId: data.nodeId,
|
|
237
271
|
sessionId: data.sessionId,
|
|
272
|
+
agentId: data.agentId,
|
|
273
|
+
sessionKey,
|
|
238
274
|
prompt,
|
|
239
275
|
cwd: data.cwd,
|
|
240
276
|
timeoutMs: options.timeoutMs
|
|
@@ -256,7 +292,7 @@ async function handleCodexConversationInboundClaim(event, ctx, options) {
|
|
|
256
292
|
return {
|
|
257
293
|
handled: true,
|
|
258
294
|
reply: (await withCodexConversationThreadActivity(data.bindingId, async () => {
|
|
259
|
-
const { resolveCodexNativeExecutionBlock } = await import("
|
|
295
|
+
const { resolveCodexNativeExecutionBlock } = await import("./.setup/sandbox-guard-C2sRMOEY.mjs").then((n) => n.r);
|
|
260
296
|
const nativeExecutionBlock = resolveCodexNativeExecutionBlock({
|
|
261
297
|
config: options.config,
|
|
262
298
|
sessionKey,
|
|
@@ -265,15 +301,9 @@ async function handleCodexConversationInboundClaim(event, ctx, options) {
|
|
|
265
301
|
});
|
|
266
302
|
if (nativeExecutionBlock) return { reply: { text: nativeExecutionBlock } };
|
|
267
303
|
const { getSessionBindingService } = await import("openclaw/plugin-sdk/conversation-binding-runtime");
|
|
268
|
-
const { runBoundTurnWithMissingThreadRecovery } = await import("
|
|
269
|
-
const currentPublicBinding = getSessionBindingService().resolveByConversation({
|
|
270
|
-
channel: publicBinding.channel,
|
|
271
|
-
accountId: publicBinding.accountId,
|
|
272
|
-
conversationId: publicBinding.conversationId,
|
|
273
|
-
...publicBinding.parentConversationId ? { parentConversationId: publicBinding.parentConversationId } : {}
|
|
274
|
-
});
|
|
304
|
+
const { runBoundTurnWithMissingThreadRecovery } = await import("./.setup/conversation-binding-DP-gMrBP.mjs");
|
|
275
305
|
const current = options.bindingStore.read(identity);
|
|
276
|
-
if (
|
|
306
|
+
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 { reply: { text: "This Codex conversation was detached or changed before its message could run." } };
|
|
277
307
|
return await runBoundTurnWithMissingThreadRecovery({
|
|
278
308
|
bindingStore: options.bindingStore,
|
|
279
309
|
data,
|
|
@@ -305,7 +335,7 @@ async function handleCodexConversationBindingResolved(event, options) {
|
|
|
305
335
|
const binding = options.bindingStore.read(identity);
|
|
306
336
|
assertCodexBindingMayBeReplaced(binding, "clearing a denied conversation binding");
|
|
307
337
|
if (binding && (!data.start?.id || binding.conversationStartId === data.start.id)) await withCodexConversationThreadActivity(identity.bindingId, async () => {
|
|
308
|
-
const { retireCodexConversationThreadBinding } = await import("
|
|
338
|
+
const { retireCodexConversationThreadBinding } = await import("./.setup/thread-ownership-DcTtAcXj.mjs").then((n) => n.o);
|
|
309
339
|
return retireCodexConversationThreadBinding({
|
|
310
340
|
bindingStore: options.bindingStore,
|
|
311
341
|
identity,
|
|
@@ -317,6 +347,7 @@ async function handleCodexConversationBindingResolved(event, options) {
|
|
|
317
347
|
}
|
|
318
348
|
//#endregion
|
|
319
349
|
//#region extensions/codex/src/native-plugin-tool.ts
|
|
350
|
+
/** Owner-scoped, read-only discovery of plugins already known to Codex. */
|
|
320
351
|
const CodexPluginsParamsSchema = Type.Object({
|
|
321
352
|
query: Type.Optional(Type.String({ maxLength: 100 })),
|
|
322
353
|
marketplace: Type.Optional(Type.String({ pattern: "^[A-Za-z0-9_-]+$" })),
|
|
@@ -339,25 +370,37 @@ function createCodexPluginsTool(options) {
|
|
|
339
370
|
const query = typeof params.query === "string" ? params.query : "";
|
|
340
371
|
const marketplace = typeof params.marketplace === "string" ? params.marketplace.trim() : void 0;
|
|
341
372
|
const limit = typeof params.limit === "number" && Number.isInteger(params.limit) ? Math.max(1, Math.min(params.limit, 20)) : 12;
|
|
373
|
+
const { codexBindingConnectionSelection, resolveCodexBindingAppServerConnection } = await import("./.setup/binding-connection-ThoatDcb.mjs").then((n) => n.n);
|
|
342
374
|
const pluginConfig = options.getPluginConfig();
|
|
343
|
-
const
|
|
375
|
+
const config = runtimeConfig();
|
|
376
|
+
const identity = options.context.sessionId ? sessionBindingIdentity({
|
|
344
377
|
sessionId: options.context.sessionId,
|
|
345
378
|
sessionKey: options.context.sessionKey,
|
|
346
379
|
agentId: options.context.agentId,
|
|
347
|
-
config
|
|
348
|
-
})
|
|
380
|
+
config
|
|
381
|
+
}) : void 0;
|
|
382
|
+
const readBinding = () => identity ? options.bindingStore.read(identity) : void 0;
|
|
383
|
+
const binding = readBinding();
|
|
384
|
+
const selection = codexBindingConnectionSelection(binding);
|
|
385
|
+
const assertCurrent = () => {
|
|
386
|
+
options.context.assertInvocationCurrent?.();
|
|
387
|
+
if (runtimeConfig() !== config || !isDeepStrictEqual(options.getPluginConfig(), pluginConfig) || !isDeepStrictEqual(codexBindingConnectionSelection(readBinding()), selection)) throw new Error("Codex plugin discovery ownership changed; retry the request.");
|
|
388
|
+
};
|
|
349
389
|
const workspaceDir = binding?.cwd?.trim() || options.context.workspaceDir?.trim() || resolveCodexDefaultWorkspaceDir(pluginConfig);
|
|
350
|
-
const request = options.request ?? (await import("
|
|
351
|
-
const
|
|
352
|
-
const connection = resolveCodexBindingAppServerConnection({
|
|
390
|
+
const request = options.request ?? (await import("./.setup/command-rpc-DixIj3HW.mjs").then((n) => n.n)).codexControlRequest;
|
|
391
|
+
const connection = await resolveCodexBindingAppServerConnection({
|
|
353
392
|
binding,
|
|
354
|
-
pluginConfig
|
|
393
|
+
pluginConfig,
|
|
394
|
+
config,
|
|
395
|
+
agentDir: options.context.agentDir,
|
|
396
|
+
assertCurrent
|
|
355
397
|
});
|
|
356
398
|
const discovered = await discoverCodexMarketplacePlugins({
|
|
357
399
|
workspaceDir,
|
|
358
400
|
request: async (requestParams) => await request(pluginConfig, CODEX_CONTROL_METHODS.listPlugins, requestParams, {
|
|
359
401
|
agentDir: options.context.agentDir,
|
|
360
|
-
config
|
|
402
|
+
config,
|
|
403
|
+
assertCurrent,
|
|
361
404
|
sessionId: options.context.sessionId,
|
|
362
405
|
sessionKey: options.context.sessionKey,
|
|
363
406
|
startOptions: connection.appServer.start,
|
|
@@ -395,6 +438,9 @@ function projectAvailablePlugin(plugin) {
|
|
|
395
438
|
}
|
|
396
439
|
//#endregion
|
|
397
440
|
//#region extensions/codex/src/native-thread-tool.ts
|
|
441
|
+
/**
|
|
442
|
+
* Owner-only access to native Codex threads stored in the user's Codex home.
|
|
443
|
+
*/
|
|
398
444
|
const ListParamsSchema = Type.Object({
|
|
399
445
|
action: Type.Literal("list"),
|
|
400
446
|
archived: Type.Optional(Type.Boolean()),
|
|
@@ -529,41 +575,44 @@ function createCodexThreadsTool(options) {
|
|
|
529
575
|
const mayReadRawTranscripts = supervision?.enabled !== true || supervision.allowRawTranscripts === true;
|
|
530
576
|
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.");
|
|
531
577
|
const run = async (archiveAdmission) => {
|
|
532
|
-
const request = options.request ?? (await import("
|
|
578
|
+
const request = options.request ?? (await import("./.setup/command-rpc-DixIj3HW.mjs").then((n) => n.n)).codexControlRequest;
|
|
533
579
|
const { isModelSelectionLocked, ModelSelectionLockedError } = await import("openclaw/plugin-sdk/model-session-runtime");
|
|
534
|
-
const { resolveCodexBindingAppServerConnection } = await import("
|
|
535
|
-
const { resolveCodexSupervisionAppServerRuntimeOptions } = await import("
|
|
536
|
-
const requestOptions = (pluginConfig) => {
|
|
580
|
+
const { codexBindingConnectionSelection, resolveCodexBindingAppServerConnection } = await import("./.setup/binding-connection-ThoatDcb.mjs").then((n) => n.n);
|
|
581
|
+
const { resolveCodexSupervisionAppServerRuntimeOptions } = await import("./.setup/config-runtime-C8Rw1m1m.mjs").then((n) => n.t);
|
|
582
|
+
const requestOptions = async (pluginConfig) => {
|
|
537
583
|
const plugin = readCodexPluginConfig(pluginConfig);
|
|
584
|
+
const base = baseRequestOptions();
|
|
538
585
|
const session = currentSession();
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
}
|
|
551
|
-
if (plugin.appServer?.homeScope === "user") {
|
|
552
|
-
const connection = resolveCodexBindingAppServerConnection({
|
|
586
|
+
const identity = session ? currentIdentity(session.sessionId) : void 0;
|
|
587
|
+
const readBinding = () => identity ? options.bindingStore.read(identity) : void 0;
|
|
588
|
+
const binding = readBinding();
|
|
589
|
+
const selection = codexBindingConnectionSelection(binding);
|
|
590
|
+
const assertCurrent = () => {
|
|
591
|
+
options.context.assertInvocationCurrent?.();
|
|
592
|
+
const current = currentSession();
|
|
593
|
+
if (runtimeConfig() !== base.config || !isDeepStrictEqual(options.getPluginConfig(), pluginConfig) || 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.");
|
|
594
|
+
};
|
|
595
|
+
if (binding?.connectionScope === "supervision" || plugin.appServer?.homeScope === "user") {
|
|
596
|
+
const connection = await resolveCodexBindingAppServerConnection({
|
|
553
597
|
binding,
|
|
554
|
-
pluginConfig
|
|
598
|
+
pluginConfig,
|
|
599
|
+
config: base.config,
|
|
600
|
+
agentDir: base.agentDir,
|
|
601
|
+
assertCurrent
|
|
555
602
|
});
|
|
556
603
|
return {
|
|
557
|
-
...
|
|
604
|
+
...base,
|
|
558
605
|
startOptions: connection.appServer.start,
|
|
559
|
-
authProfileId: null
|
|
606
|
+
authProfileId: connection.usesSupervisionConnection ? connection.clientAuthProfileId : null,
|
|
607
|
+
assertCurrent
|
|
560
608
|
};
|
|
561
609
|
}
|
|
562
610
|
if (plugin.supervision?.enabled !== true) throw new Error("Codex native thread access is disabled for this run.");
|
|
563
611
|
return {
|
|
564
|
-
...
|
|
612
|
+
...base,
|
|
565
613
|
startOptions: resolveCodexSupervisionAppServerRuntimeOptions({ pluginConfig }).start,
|
|
566
|
-
authProfileId: null
|
|
614
|
+
authProfileId: null,
|
|
615
|
+
assertCurrent
|
|
567
616
|
};
|
|
568
617
|
};
|
|
569
618
|
if (action === "list") {
|
|
@@ -582,7 +631,7 @@ function createCodexThreadsTool(options) {
|
|
|
582
631
|
sourceKinds: [...CODEX_INTERACTIVE_THREAD_SOURCE_KINDS],
|
|
583
632
|
...cursor ? { cursor } : {},
|
|
584
633
|
...searchTerm ? { searchTerm } : {}
|
|
585
|
-
}, requestOptions(admissionConfig));
|
|
634
|
+
}, await requestOptions(admissionConfig));
|
|
586
635
|
return jsonResult(mayReadRawTranscripts ? response : redactNativeThreadResponse(response));
|
|
587
636
|
}
|
|
588
637
|
const threadId = archiveAdmission?.threadId ?? readThreadId(params);
|
|
@@ -592,7 +641,7 @@ function createCodexThreadsTool(options) {
|
|
|
592
641
|
const response = await request(admissionConfig, CODEX_CONTROL_METHODS.readThread, {
|
|
593
642
|
threadId,
|
|
594
643
|
includeTurns
|
|
595
|
-
}, requestOptions(admissionConfig));
|
|
644
|
+
}, await requestOptions(admissionConfig));
|
|
596
645
|
return jsonResult(mayReadRawTranscripts ? response : redactNativeThreadResponse(response));
|
|
597
646
|
}
|
|
598
647
|
if (action === "rename") {
|
|
@@ -603,7 +652,7 @@ function createCodexThreadsTool(options) {
|
|
|
603
652
|
await request(admissionConfig, CODEX_CONTROL_METHODS.renameThread, {
|
|
604
653
|
threadId,
|
|
605
654
|
name
|
|
606
|
-
}, requestOptions(admissionConfig));
|
|
655
|
+
}, await requestOptions(admissionConfig));
|
|
607
656
|
return jsonResult({
|
|
608
657
|
action,
|
|
609
658
|
threadId,
|
|
@@ -611,7 +660,7 @@ function createCodexThreadsTool(options) {
|
|
|
611
660
|
});
|
|
612
661
|
}
|
|
613
662
|
if (action === "unarchive") {
|
|
614
|
-
const response = await request(admissionConfig, CODEX_CONTROL_METHODS.unarchiveThread, { threadId }, requestOptions(admissionConfig));
|
|
663
|
+
const response = await request(admissionConfig, CODEX_CONTROL_METHODS.unarchiveThread, { threadId }, await requestOptions(admissionConfig));
|
|
615
664
|
return jsonResult(mayReadRawTranscripts ? response : redactNativeThreadResponse(response));
|
|
616
665
|
}
|
|
617
666
|
const session = archiveAdmission?.session ?? currentSession();
|
|
@@ -626,24 +675,24 @@ function createCodexThreadsTool(options) {
|
|
|
626
675
|
assertThreadMayBeArchived(await request(admissionConfig, CODEX_CONTROL_METHODS.readThread, {
|
|
627
676
|
threadId,
|
|
628
677
|
includeTurns: false
|
|
629
|
-
}, requestOptions(admissionConfig)), threadId);
|
|
678
|
+
}, await requestOptions(admissionConfig)), threadId);
|
|
630
679
|
if (await options.bindingStore.hasOtherThreadOwner(threadId, identity)) throw new Error("cannot archive a native Codex thread owned by another OpenClaw session");
|
|
631
680
|
await assertCodexArchiveDescendantsUnowned({
|
|
632
681
|
bindingStore: options.bindingStore,
|
|
633
682
|
threadId,
|
|
634
|
-
listPage: async (listParams) => await request(admissionConfig, CODEX_CONTROL_METHODS.listThreads, listParams, requestOptions(admissionConfig)),
|
|
683
|
+
listPage: async (listParams) => await request(admissionConfig, CODEX_CONTROL_METHODS.listThreads, listParams, await requestOptions(admissionConfig)),
|
|
635
684
|
assertDescendantIdle: async (descendantThreadId) => {
|
|
636
685
|
assertThreadMayBeArchived(await request(admissionConfig, CODEX_CONTROL_METHODS.readThread, {
|
|
637
686
|
threadId: descendantThreadId,
|
|
638
687
|
includeTurns: false
|
|
639
|
-
}, requestOptions(admissionConfig)), descendantThreadId);
|
|
688
|
+
}, await requestOptions(admissionConfig)), descendantThreadId);
|
|
640
689
|
}
|
|
641
690
|
});
|
|
642
|
-
await request(admissionConfig, CODEX_CONTROL_METHODS.archiveThread, { threadId }, requestOptions(admissionConfig));
|
|
691
|
+
await request(admissionConfig, CODEX_CONTROL_METHODS.archiveThread, { threadId }, await requestOptions(admissionConfig));
|
|
643
692
|
if (archivedBinding?.threadId === threadId) await options.bindingStore.mutate(identity, {
|
|
644
693
|
kind: "clear",
|
|
645
694
|
threadId
|
|
646
|
-
});
|
|
695
|
+
}, options.context.assertInvocationCurrent);
|
|
647
696
|
return jsonResult({
|
|
648
697
|
action,
|
|
649
698
|
threadId
|
|
@@ -655,33 +704,65 @@ function createCodexThreadsTool(options) {
|
|
|
655
704
|
if (attach && isModelSelectionLocked(session?.entry)) throw new ModelSelectionLockedError();
|
|
656
705
|
const usesSupervisionConnection = binding?.connectionScope === "supervision" || admissionPlugin.appServer?.homeScope !== "user" && supervision?.enabled === true;
|
|
657
706
|
if (attach && usesSupervisionConnection) throw new Error("Supervised Codex forks must stay detached; set attach=false.");
|
|
707
|
+
const forkOptions = await requestOptions(admissionConfig);
|
|
708
|
+
const { retainCodexAppServerBindingSubscription, rollbackCodexAppServerBindingSubscription } = await import("./.setup/thread-ownership-DcTtAcXj.mjs").then((n) => n.o);
|
|
709
|
+
const { closeCodexStartupClientBestEffort } = await import("./.setup/attempt-client-cleanup-CEv1cKwF.mjs").then((n) => n.a);
|
|
658
710
|
if (attach) {
|
|
659
711
|
assertCodexBindingMayBeReplaced(binding, "attaching a different native fork");
|
|
660
712
|
assertThreadMayBeForked(await request(admissionConfig, CODEX_CONTROL_METHODS.readThread, {
|
|
661
713
|
threadId,
|
|
662
714
|
includeTurns: false
|
|
663
|
-
},
|
|
715
|
+
}, forkOptions), threadId);
|
|
664
716
|
}
|
|
665
717
|
const response = await request(admissionConfig, CODEX_CONTROL_METHODS.forkThread, {
|
|
666
718
|
threadId,
|
|
667
719
|
threadSource: "user",
|
|
668
720
|
excludeTurns: true
|
|
669
|
-
},
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
kind: "set",
|
|
676
|
-
binding: {
|
|
677
|
-
threadId: forkThreadId,
|
|
678
|
-
cwd: typeof response.thread.cwd === "string" ? response.thread.cwd : options.context.workspaceDir ?? "",
|
|
679
|
-
model: typeof response.model === "string" ? response.model : void 0,
|
|
680
|
-
modelProvider: typeof response.modelProvider === "string" ? response.modelProvider : void 0,
|
|
681
|
-
historyCoveredThrough: (/* @__PURE__ */ new Date()).toISOString()
|
|
721
|
+
}, {
|
|
722
|
+
...forkOptions,
|
|
723
|
+
onResponse: async (value, client, { assertCurrent }) => {
|
|
724
|
+
if (!isJsonObject(value) || !isJsonObject(value.thread)) {
|
|
725
|
+
await closeCodexStartupClientBestEffort(client);
|
|
726
|
+
throw new Error("Codex app-server returned an invalid thread/fork response");
|
|
682
727
|
}
|
|
683
|
-
|
|
684
|
-
|
|
728
|
+
const forkThread = value.thread;
|
|
729
|
+
const forkThreadId = typeof forkThread.id === "string" && forkThread.id.trim() ? forkThread.id : void 0;
|
|
730
|
+
if (!forkThreadId) {
|
|
731
|
+
await closeCodexStartupClientBestEffort(client);
|
|
732
|
+
throw new Error("Codex app-server thread/fork response did not include a thread id");
|
|
733
|
+
}
|
|
734
|
+
let retained = false;
|
|
735
|
+
let attached = false;
|
|
736
|
+
try {
|
|
737
|
+
assertCurrent();
|
|
738
|
+
if (attach && session) {
|
|
739
|
+
const identity = currentIdentity(session.sessionId);
|
|
740
|
+
await options.bindingStore.withLease(identity, async () => {
|
|
741
|
+
assertCurrent();
|
|
742
|
+
if (currentSession()?.entry?.sessionId !== session.sessionId) throw new Error("Codex native thread ownership changed; retry the request.");
|
|
743
|
+
assertCodexBindingMayBeReplaced(currentBinding(session), "attaching a different native fork");
|
|
744
|
+
retained = await retainCodexAppServerBindingSubscription(client, forkThreadId);
|
|
745
|
+
if (!retained) throw new Error("Codex fork lost its native subscription owner.");
|
|
746
|
+
const nextBinding = {
|
|
747
|
+
threadId: forkThreadId,
|
|
748
|
+
clientId: client.getInstanceId(),
|
|
749
|
+
cwd: typeof forkThread.cwd === "string" ? forkThread.cwd : options.context.workspaceDir ?? "",
|
|
750
|
+
model: typeof value.model === "string" ? value.model : void 0,
|
|
751
|
+
modelProvider: typeof value.modelProvider === "string" ? value.modelProvider : void 0,
|
|
752
|
+
historyCoveredThrough: (/* @__PURE__ */ new Date()).toISOString()
|
|
753
|
+
};
|
|
754
|
+
attached = await options.bindingStore.mutate(identity, {
|
|
755
|
+
kind: "set",
|
|
756
|
+
binding: nextBinding
|
|
757
|
+
}, assertCurrent);
|
|
758
|
+
if (!attached) throw new Error("Codex session binding changed before the fork could be attached");
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
} finally {
|
|
762
|
+
if (!attached) await rollbackCodexAppServerBindingSubscription(client, forkThreadId, retained);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
});
|
|
685
766
|
const result = {
|
|
686
767
|
action,
|
|
687
768
|
sourceThreadId: threadId,
|
|
@@ -728,6 +809,7 @@ function createCodexNodeExecServerCommand() {
|
|
|
728
809
|
cap: CODEX_NODE_EXEC_SERVER_CAPABILITY,
|
|
729
810
|
dangerous: true,
|
|
730
811
|
duplex: true,
|
|
812
|
+
hasActiveWork: () => activeProcesses.size > 0,
|
|
731
813
|
onDisconnect: async () => {
|
|
732
814
|
await Promise.all([...activeProcesses].map(async (terminate) => await terminate()));
|
|
733
815
|
},
|
|
@@ -742,36 +824,21 @@ function createCodexNodeExecServerCommand() {
|
|
|
742
824
|
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.");
|
|
743
825
|
const placement = parseCodexNodePlacementWorkspace(request.placement);
|
|
744
826
|
if (!context?.acquireManagedWorkspace || context.sessionKey !== placement.sessionKey || io.signal.aborted) throw new Error("Codex node exec-server requires active managed placement authority.");
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
827
|
+
if (!context.prepareExecAuthorization) throw new Error("Codex node execution requires node-local exec policy support; update the node.");
|
|
828
|
+
const assertExecAuthorized = context.prepareExecAuthorization(request.authorization);
|
|
829
|
+
const { runCodexNodeExecServer } = await import("./.setup/node-exec-server.runtime-BDwWXVpK.mjs");
|
|
830
|
+
return await runCodexNodeExecServer({
|
|
831
|
+
workspace: context.acquireManagedWorkspace({
|
|
832
|
+
workspaceDir: placement.cwd,
|
|
833
|
+
environmentId: placement.environmentId,
|
|
834
|
+
sessionId: placement.sessionId,
|
|
835
|
+
ownerEpoch: placement.ownerEpoch,
|
|
836
|
+
sessionKey: placement.sessionKey
|
|
837
|
+
}),
|
|
838
|
+
io,
|
|
839
|
+
activeProcesses,
|
|
840
|
+
assertExecAuthorized
|
|
751
841
|
});
|
|
752
|
-
const frames = io.frames;
|
|
753
|
-
let unsubscribe;
|
|
754
|
-
try {
|
|
755
|
-
if (!context.prepareExecAuthorization) throw new Error("Codex node execution requires node-local exec policy support; update the node.");
|
|
756
|
-
const assertExecAuthorized = context.prepareExecAuthorization(request.authorization);
|
|
757
|
-
const { runCodexNodeExecServer } = await import("./node-exec-server.runtime-Cl2vapEi.js");
|
|
758
|
-
return await runCodexNodeExecServer({
|
|
759
|
-
workspaceDir: workspace.workspaceDir,
|
|
760
|
-
homeDir: workspace.homeDir,
|
|
761
|
-
io,
|
|
762
|
-
activeProcesses,
|
|
763
|
-
assertExecAuthorized,
|
|
764
|
-
onFrameReceiver: (receiver) => {
|
|
765
|
-
unsubscribe = frames.onMessage(receiver);
|
|
766
|
-
}
|
|
767
|
-
});
|
|
768
|
-
} finally {
|
|
769
|
-
try {
|
|
770
|
-
unsubscribe?.();
|
|
771
|
-
} finally {
|
|
772
|
-
workspace.release();
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
842
|
}
|
|
776
843
|
};
|
|
777
844
|
}
|
|
@@ -854,6 +921,29 @@ function createCodexNodeExecServerInvokePolicy() {
|
|
|
854
921
|
};
|
|
855
922
|
}
|
|
856
923
|
//#endregion
|
|
924
|
+
//#region extensions/codex/src/supervision-tool-policy.ts
|
|
925
|
+
var CodexSupervisionPolicyError = class extends Error {};
|
|
926
|
+
function requireSupervisionEnabled(pluginConfig) {
|
|
927
|
+
if (readCodexPluginConfig(pluginConfig).supervision?.enabled !== true) throw new CodexSupervisionPolicyError("Codex supervision is disabled in the codex plugin config.");
|
|
928
|
+
}
|
|
929
|
+
function requireOwnerAccess(options) {
|
|
930
|
+
options.assertInvocationCurrent?.();
|
|
931
|
+
if (!options.senderIsOwner) throw new CodexSupervisionPolicyError("Codex supervision compatibility tools require an owner-authorized sender.");
|
|
932
|
+
}
|
|
933
|
+
function resolveToolPolicy(pluginConfig) {
|
|
934
|
+
const config = readCodexPluginConfig(pluginConfig).supervision;
|
|
935
|
+
return {
|
|
936
|
+
allowRawTranscripts: config?.allowRawTranscripts === true,
|
|
937
|
+
allowWriteControls: config?.allowWriteControls === true
|
|
938
|
+
};
|
|
939
|
+
}
|
|
940
|
+
function requireRawTranscriptAccess(pluginConfig) {
|
|
941
|
+
if (!resolveToolPolicy(pluginConfig).allowRawTranscripts) throw new CodexSupervisionPolicyError("Codex session reads are disabled for this codex plugin supervision config.");
|
|
942
|
+
}
|
|
943
|
+
function requireWriteAccess(pluginConfig) {
|
|
944
|
+
if (!resolveToolPolicy(pluginConfig).allowWriteControls) throw new CodexSupervisionPolicyError("Codex write controls are disabled for this codex plugin supervision config.");
|
|
945
|
+
}
|
|
946
|
+
//#endregion
|
|
857
947
|
//#region extensions/codex/src/supervision-tools.ts
|
|
858
948
|
/**
|
|
859
949
|
* Compatibility tools for the retired Codex Supervisor plugin.
|
|
@@ -865,10 +955,6 @@ function createCodexNodeExecServerInvokePolicy() {
|
|
|
865
955
|
*/
|
|
866
956
|
/** Legacy endpoint env retained for the shipped Supervisor tool contract. */
|
|
867
957
|
const LEGACY_CODEX_SUPERVISOR_ENDPOINTS_ENV = "OPENCLAW_CODEX_SUPERVISOR_ENDPOINTS";
|
|
868
|
-
/** Legacy standalone-MCP transcript gate. Agent tools use canonical config. */
|
|
869
|
-
const LEGACY_CODEX_SUPERVISOR_RAW_TRANSCRIPTS_ENV = "OPENCLAW_CODEX_SUPERVISOR_ALLOW_RAW_TRANSCRIPTS";
|
|
870
|
-
/** Legacy standalone-MCP write gate. Agent tools use canonical config. */
|
|
871
|
-
const LEGACY_CODEX_SUPERVISOR_WRITE_CONTROLS_ENV = "OPENCLAW_CODEX_SUPERVISOR_ALLOW_WRITE_CONTROLS";
|
|
872
958
|
const CODEX_SUPERVISION_COMPAT_TOOL_NAMES = [
|
|
873
959
|
"codex_endpoint_probe",
|
|
874
960
|
"codex_sessions_list",
|
|
@@ -921,7 +1007,6 @@ const PAGE_LIMIT = 100;
|
|
|
921
1007
|
const MAX_COMPAT_PAGINATION_PAGES = 100;
|
|
922
1008
|
const MAX_COMPAT_CURSOR_LENGTH = 4096;
|
|
923
1009
|
const MAX_COMPAT_THREAD_ID_LENGTH = 4096;
|
|
924
|
-
var CodexSupervisionPolicyError = class extends Error {};
|
|
925
1010
|
function asRecordArray(value) {
|
|
926
1011
|
return Array.isArray(value) ? value.filter(isRecord) : [];
|
|
927
1012
|
}
|
|
@@ -1117,8 +1202,10 @@ function supervisionEndpointConnectionKey(params) {
|
|
|
1117
1202
|
})
|
|
1118
1203
|
});
|
|
1119
1204
|
}
|
|
1120
|
-
function
|
|
1205
|
+
function createPolicyGuardedRequest(options, policy) {
|
|
1121
1206
|
return async (endpoint, method, requestParams) => {
|
|
1207
|
+
const currentEndpoint = requireCurrentEndpoint(options, policy, endpoint);
|
|
1208
|
+
if (options.request) return await options.request(currentEndpoint, method, requestParams);
|
|
1122
1209
|
const pluginConfig = options.getPluginConfig();
|
|
1123
1210
|
const env = options.env ?? process.env;
|
|
1124
1211
|
const runtime = options.resolveRuntimeOptions({
|
|
@@ -1127,7 +1214,7 @@ function createCanonicalEndpointRequest(options) {
|
|
|
1127
1214
|
});
|
|
1128
1215
|
const config = options.getRuntimeConfig?.();
|
|
1129
1216
|
const startOptions = resolveEndpointStartOptions({
|
|
1130
|
-
endpoint,
|
|
1217
|
+
endpoint: currentEndpoint,
|
|
1131
1218
|
pluginConfig,
|
|
1132
1219
|
env,
|
|
1133
1220
|
resolveRuntimeOptions: options.resolveRuntimeOptions
|
|
@@ -1137,6 +1224,9 @@ function createCanonicalEndpointRequest(options) {
|
|
|
1137
1224
|
requestParams,
|
|
1138
1225
|
timeoutMs: runtime.requestTimeoutMs,
|
|
1139
1226
|
startOptions,
|
|
1227
|
+
assertCurrent: () => {
|
|
1228
|
+
requireCurrentEndpoint(options, policy, currentEndpoint);
|
|
1229
|
+
},
|
|
1140
1230
|
...endpoint.configured || startOptions.homeScope === "user" ? { authProfileId: null } : {},
|
|
1141
1231
|
...config ? { config } : {}
|
|
1142
1232
|
});
|
|
@@ -1392,32 +1482,12 @@ function sanitizeSessionListResult(result, includeTranscriptDerivedFields) {
|
|
|
1392
1482
|
}))
|
|
1393
1483
|
};
|
|
1394
1484
|
}
|
|
1395
|
-
function requireSupervisionEnabled(pluginConfig) {
|
|
1396
|
-
if (readCodexPluginConfig(pluginConfig).supervision?.enabled !== true) throw new CodexSupervisionPolicyError("Codex supervision is disabled in the codex plugin config.");
|
|
1397
|
-
}
|
|
1398
|
-
function requireOwnerAccess(options) {
|
|
1399
|
-
if (!options.senderIsOwner) throw new CodexSupervisionPolicyError("Codex supervision compatibility tools require an owner-authorized sender.");
|
|
1400
|
-
}
|
|
1401
|
-
function resolveToolPolicy(options, pluginConfig) {
|
|
1402
|
-
const config = readCodexPluginConfig(pluginConfig).supervision;
|
|
1403
|
-
const env = options.env ?? process.env;
|
|
1404
|
-
return {
|
|
1405
|
-
allowRawTranscripts: config?.allowRawTranscripts === true || options.useLegacyMcpPolicyEnv === true && env[LEGACY_CODEX_SUPERVISOR_RAW_TRANSCRIPTS_ENV] === "1",
|
|
1406
|
-
allowWriteControls: config?.allowWriteControls === true || options.useLegacyMcpPolicyEnv === true && env[LEGACY_CODEX_SUPERVISOR_WRITE_CONTROLS_ENV] === "1"
|
|
1407
|
-
};
|
|
1408
|
-
}
|
|
1409
|
-
function requireRawTranscriptAccess(options, pluginConfig) {
|
|
1410
|
-
if (!resolveToolPolicy(options, pluginConfig).allowRawTranscripts) throw new CodexSupervisionPolicyError("Codex session reads are disabled for this codex plugin supervision config.");
|
|
1411
|
-
}
|
|
1412
|
-
function requireWriteAccess(options, pluginConfig) {
|
|
1413
|
-
if (!resolveToolPolicy(options, pluginConfig).allowWriteControls) throw new CodexSupervisionPolicyError("Codex write controls are disabled for this codex plugin supervision config.");
|
|
1414
|
-
}
|
|
1415
1485
|
function requireLiveToolPolicy(options, policy) {
|
|
1416
1486
|
requireOwnerAccess(options);
|
|
1417
1487
|
const pluginConfig = options.getPluginConfig();
|
|
1418
1488
|
requireSupervisionEnabled(pluginConfig);
|
|
1419
|
-
if (policy === "raw-transcripts") requireRawTranscriptAccess(
|
|
1420
|
-
else if (policy === "write-controls") requireWriteAccess(
|
|
1489
|
+
if (policy === "raw-transcripts") requireRawTranscriptAccess(pluginConfig);
|
|
1490
|
+
else if (policy === "write-controls") requireWriteAccess(pluginConfig);
|
|
1421
1491
|
return {
|
|
1422
1492
|
pluginConfig,
|
|
1423
1493
|
endpoints: resolveEndpoints(pluginConfig, options.env ?? process.env, options.getRuntimeConfig?.(), options.resolveAuthProfileId, options.resolveRuntimeOptions)
|
|
@@ -1434,20 +1504,14 @@ function requireCurrentEndpointSet(options, expected) {
|
|
|
1434
1504
|
if (!(current.endpoints.length === expected.length && expected.every((endpoint) => current.endpoints.some((candidate) => candidate.id === endpoint.id && candidate.connectionKey === endpoint.connectionKey)))) throw new CodexSupervisionPolicyError("Codex supervision endpoint configuration changed during the request.");
|
|
1435
1505
|
return { pluginConfig: current.pluginConfig };
|
|
1436
1506
|
}
|
|
1437
|
-
function createPolicyGuardedRequest(options, request, policy) {
|
|
1438
|
-
return async (endpoint, method, params) => {
|
|
1439
|
-
return await request(requireCurrentEndpoint(options, policy, endpoint), method, params);
|
|
1440
|
-
};
|
|
1441
|
-
}
|
|
1442
1507
|
function idleContinuationError(threadId) {
|
|
1443
1508
|
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.`);
|
|
1444
1509
|
}
|
|
1445
1510
|
/** Builds the five shipped Codex Supervisor compatibility tools. */
|
|
1446
1511
|
function createCodexSupervisionTools(options) {
|
|
1447
|
-
const
|
|
1448
|
-
const
|
|
1449
|
-
const
|
|
1450
|
-
const writeRequest = createPolicyGuardedRequest(options, baseRequest, "write-controls");
|
|
1512
|
+
const request = createPolicyGuardedRequest(options, "enabled");
|
|
1513
|
+
const rawTranscriptRequest = createPolicyGuardedRequest(options, "raw-transcripts");
|
|
1514
|
+
const writeRequest = createPolicyGuardedRequest(options, "write-controls");
|
|
1451
1515
|
const current = () => {
|
|
1452
1516
|
return requireLiveToolPolicy(options, "enabled");
|
|
1453
1517
|
};
|
|
@@ -1498,7 +1562,7 @@ function createCodexSupervisionTools(options) {
|
|
|
1498
1562
|
const { pluginConfig } = requireCurrentEndpointSet(options, endpoints);
|
|
1499
1563
|
return jsonResult({
|
|
1500
1564
|
summary: `codex sessions: ${result.sessions.length}`,
|
|
1501
|
-
...sanitizeSessionListResult(result, resolveToolPolicy(
|
|
1565
|
+
...sanitizeSessionListResult(result, resolveToolPolicy(pluginConfig).allowRawTranscripts)
|
|
1502
1566
|
});
|
|
1503
1567
|
}
|
|
1504
1568
|
},
|
|
@@ -1509,7 +1573,7 @@ function createCodexSupervisionTools(options) {
|
|
|
1509
1573
|
parameters: SessionReadParamsSchema,
|
|
1510
1574
|
execute: async (_toolCallId, rawParams) => {
|
|
1511
1575
|
const { endpoints, pluginConfig } = current();
|
|
1512
|
-
requireRawTranscriptAccess(
|
|
1576
|
+
requireRawTranscriptAccess(pluginConfig);
|
|
1513
1577
|
const params = isRecord(rawParams) ? rawParams : {};
|
|
1514
1578
|
const threadId = readStringParam(params, "thread_id", { required: true });
|
|
1515
1579
|
const endpoint = await resolveEndpointForThread({
|
|
@@ -1538,7 +1602,7 @@ function createCodexSupervisionTools(options) {
|
|
|
1538
1602
|
parameters: SessionSendParamsSchema,
|
|
1539
1603
|
execute: async (_toolCallId, rawParams) => {
|
|
1540
1604
|
const { endpoints, pluginConfig } = current();
|
|
1541
|
-
requireWriteAccess(
|
|
1605
|
+
requireWriteAccess(pluginConfig);
|
|
1542
1606
|
const params = isRecord(rawParams) ? rawParams : {};
|
|
1543
1607
|
const threadId = readStringParam(params, "thread_id", { required: true });
|
|
1544
1608
|
const text = readStringParam(params, "text", {
|
|
@@ -1595,7 +1659,7 @@ function createCodexSupervisionTools(options) {
|
|
|
1595
1659
|
parameters: SessionInterruptParamsSchema,
|
|
1596
1660
|
execute: async (_toolCallId, rawParams) => {
|
|
1597
1661
|
const { endpoints, pluginConfig } = current();
|
|
1598
|
-
requireWriteAccess(
|
|
1662
|
+
requireWriteAccess(pluginConfig);
|
|
1599
1663
|
const params = isRecord(rawParams) ? rawParams : {};
|
|
1600
1664
|
const threadId = readStringParam(params, "thread_id", { required: true });
|
|
1601
1665
|
const endpoint = await resolveEndpointForThread({
|
|
@@ -1638,7 +1702,7 @@ function createCodexSupervisionTools(options) {
|
|
|
1638
1702
|
}
|
|
1639
1703
|
//#endregion
|
|
1640
1704
|
//#region extensions/codex/src/web-search-provider.ts
|
|
1641
|
-
const loadCodexWebSearchRuntime = createLazyRuntimeModule(() => import("
|
|
1705
|
+
const loadCodexWebSearchRuntime = createLazyRuntimeModule(() => import("./.setup/web-search-provider.runtime-CDKlN-Rv.mjs"));
|
|
1642
1706
|
const CodexWebSearchSchema = {
|
|
1643
1707
|
type: "object",
|
|
1644
1708
|
properties: { query: {
|
|
@@ -1682,7 +1746,10 @@ var codex_default = definePluginEntry({
|
|
|
1682
1746
|
description: "Codex app-server harness and native session supervision.",
|
|
1683
1747
|
reload: { noopPrefixes: ["plugins.entries.codex.config.codexPlugins"] },
|
|
1684
1748
|
register(api) {
|
|
1749
|
+
registerCodexAccountUsage(api);
|
|
1750
|
+
api.registerService(codexNativeProfileRecoveryService);
|
|
1685
1751
|
setManagedCodexPluginRoot(api.rootDir);
|
|
1752
|
+
api.registerProvider(codexProviderDiscovery);
|
|
1686
1753
|
const resolveCurrentConfig = () => api.runtime.config?.current ? api.runtime.config.current() : void 0;
|
|
1687
1754
|
const resolvePluginConfig = (resolveConfig) => {
|
|
1688
1755
|
const liveConfig = resolveConfig();
|
|
@@ -1716,13 +1783,17 @@ var codex_default = definePluginEntry({
|
|
|
1716
1783
|
deleteIf: (key, predicate) => openBindingStateStore().deleteIf(key, predicate),
|
|
1717
1784
|
entries: () => openBindingStateStore().entries(),
|
|
1718
1785
|
lookup: (key) => openBindingStateStore().lookup(key),
|
|
1786
|
+
get lookupMany() {
|
|
1787
|
+
const store = openBindingStateStore();
|
|
1788
|
+
return store.lookupMany?.bind(store);
|
|
1789
|
+
},
|
|
1719
1790
|
registerIfAbsent: (key, value, options) => openBindingStateStore().registerIfAbsent(key, value, options),
|
|
1720
1791
|
get update() {
|
|
1721
1792
|
const store = openBindingStateStore();
|
|
1722
1793
|
return store.update?.bind(store);
|
|
1723
1794
|
}
|
|
1724
1795
|
};
|
|
1725
|
-
const openManagedThreadStateStore = () => managedThreadStateStore ??= api.runtime.state.
|
|
1796
|
+
const openManagedThreadStateStore = () => managedThreadStateStore ??= api.runtime.state.openKeyedStore({
|
|
1726
1797
|
namespace: CODEX_MANAGED_THREAD_NAMESPACE,
|
|
1727
1798
|
maxEntries: CODEX_MANAGED_THREAD_MAX_ENTRIES,
|
|
1728
1799
|
overflowPolicy: "evict-oldest"
|
|
@@ -1739,9 +1810,20 @@ var codex_default = definePluginEntry({
|
|
|
1739
1810
|
managedThreads: bindingStore.managedThreads,
|
|
1740
1811
|
config: api.config,
|
|
1741
1812
|
getPluginConfig: resolveCurrentPluginConfig,
|
|
1742
|
-
getRuntimeConfig: resolveCurrentConfig
|
|
1813
|
+
getRuntimeConfig: resolveCurrentConfig,
|
|
1814
|
+
openResidentState: (homeId) => api.runtime.state.openKeyedStore({
|
|
1815
|
+
namespace: `${CODEX_CATALOG_STATE_NAMESPACE}.${homeId.replaceAll(":", "-")}`,
|
|
1816
|
+
maxEntries: CODEX_CATALOG_MAX_ROWS + 1,
|
|
1817
|
+
overflowPolicy: "reject-new"
|
|
1818
|
+
})
|
|
1743
1819
|
});
|
|
1744
|
-
|
|
1820
|
+
const sessionCatalogEnabled = readCodexPluginConfig(resolveCurrentPluginConfig()).sessionCatalog?.enabled !== false;
|
|
1821
|
+
api.registerService({
|
|
1822
|
+
id: "codex-session-catalog",
|
|
1823
|
+
start: () => sessionCatalogEnabled ? sessionCatalogControlFactory.start() : void 0,
|
|
1824
|
+
stop: () => sessionCatalogControlFactory.stop()
|
|
1825
|
+
});
|
|
1826
|
+
if (sessionCatalogEnabled) {
|
|
1745
1827
|
codexSessionCatalogRuntime.register({
|
|
1746
1828
|
api,
|
|
1747
1829
|
resolveRuntimeOptions: resolveCodexSupervisionAppServerRuntimeOptions,
|
|
@@ -1750,25 +1832,25 @@ var codex_default = definePluginEntry({
|
|
|
1750
1832
|
getPluginConfig: resolveCurrentPluginConfig,
|
|
1751
1833
|
getRuntimeConfig: resolveCurrentConfig
|
|
1752
1834
|
});
|
|
1753
|
-
for (const command of createCodexSessionCatalogNodeHostCommands(sessionCatalogControlFactory,
|
|
1754
|
-
getPluginConfig: resolveCurrentPluginConfig,
|
|
1755
|
-
getRuntimeConfig: () => resolveCurrentConfig() ?? api.config,
|
|
1756
|
-
resolveRuntimeOptions: resolveCodexSupervisionAppServerRuntimeOptions
|
|
1757
|
-
}, bindingStore)) api.registerNodeHostCommand(command);
|
|
1835
|
+
for (const command of createCodexSessionCatalogNodeHostCommands(sessionCatalogControlFactory, bindingStore)) api.registerNodeHostCommand(command);
|
|
1758
1836
|
}
|
|
1759
1837
|
for (const policy of createCodexSessionCatalogNodeInvokePolicies()) api.registerNodeInvokePolicy(policy);
|
|
1760
1838
|
if (readCodexPluginConfig(resolveCurrentPluginConfig()).supervision?.enabled === true) {
|
|
1761
1839
|
const { resolveCodexAppServerAuthProfileIdForAgent } = createCodexAuthProfileSelection(api.runtime.modelAuth);
|
|
1762
|
-
api.registerTool(
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1840
|
+
api.registerTool({
|
|
1841
|
+
contextVersion: 2,
|
|
1842
|
+
create: (context) => {
|
|
1843
|
+
if (context.senderIsOwner !== true) return [];
|
|
1844
|
+
const resolveToolRuntimeConfig = () => context.getRuntimeConfig?.() ?? context.runtimeConfig ?? context.config ?? resolveCurrentConfig();
|
|
1845
|
+
return createCodexSupervisionTools({
|
|
1846
|
+
getPluginConfig: () => resolvePluginConfig(resolveToolRuntimeConfig),
|
|
1847
|
+
getRuntimeConfig: resolveToolRuntimeConfig,
|
|
1848
|
+
resolveAuthProfileId: resolveCodexAppServerAuthProfileIdForAgent,
|
|
1849
|
+
resolveRuntimeOptions: resolveCodexSupervisionAppServerRuntimeOptions,
|
|
1850
|
+
senderIsOwner: context.senderIsOwner,
|
|
1851
|
+
assertInvocationCurrent: context.assertInvocationCurrent
|
|
1852
|
+
});
|
|
1853
|
+
}
|
|
1772
1854
|
}, { names: [...CODEX_SUPERVISION_COMPAT_TOOL_NAMES] });
|
|
1773
1855
|
}
|
|
1774
1856
|
const agentHarnessOptions = {
|
|
@@ -1782,12 +1864,15 @@ var codex_default = definePluginEntry({
|
|
|
1782
1864
|
api.registerMediaUnderstandingProvider(buildCodexMediaUnderstandingProvider({ pluginConfig: api.pluginConfig }));
|
|
1783
1865
|
api.registerWebSearchProvider(createCodexWebSearchProvider({ resolvePluginConfig: resolveCurrentPluginConfig }));
|
|
1784
1866
|
api.registerMigrationProvider(buildCodexMigrationProvider({ runtime: api.runtime }));
|
|
1785
|
-
api.registerTool(
|
|
1786
|
-
|
|
1787
|
-
context
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1867
|
+
api.registerTool({
|
|
1868
|
+
contextVersion: 2,
|
|
1869
|
+
create: (context) => createCodexThreadsTool({
|
|
1870
|
+
bindingStore,
|
|
1871
|
+
context,
|
|
1872
|
+
runtime: api.runtime,
|
|
1873
|
+
getPluginConfig: resolveCurrentPluginConfig
|
|
1874
|
+
})
|
|
1875
|
+
}, { name: "codex_threads" });
|
|
1791
1876
|
api.registerToolMetadata({
|
|
1792
1877
|
toolName: "codex_threads",
|
|
1793
1878
|
displayName: "Codex Threads",
|
|
@@ -1795,11 +1880,14 @@ var codex_default = definePluginEntry({
|
|
|
1795
1880
|
risk: "high",
|
|
1796
1881
|
tags: ["codex", "sessions"]
|
|
1797
1882
|
});
|
|
1798
|
-
api.registerTool(
|
|
1799
|
-
|
|
1800
|
-
context
|
|
1801
|
-
|
|
1802
|
-
|
|
1883
|
+
api.registerTool({
|
|
1884
|
+
contextVersion: 2,
|
|
1885
|
+
create: (context) => createCodexPluginsTool({
|
|
1886
|
+
bindingStore,
|
|
1887
|
+
context,
|
|
1888
|
+
getPluginConfig: resolveCurrentPluginConfig
|
|
1889
|
+
})
|
|
1890
|
+
}, { name: "codex_plugins" });
|
|
1803
1891
|
api.registerToolMetadata({
|
|
1804
1892
|
toolName: "codex_plugins",
|
|
1805
1893
|
displayName: "Codex Plugins",
|
|
@@ -1811,7 +1899,7 @@ var codex_default = definePluginEntry({
|
|
|
1811
1899
|
"discovery"
|
|
1812
1900
|
]
|
|
1813
1901
|
});
|
|
1814
|
-
for (const command of createCodexCliSessionNodeHostCommands()) api.registerNodeHostCommand(command);
|
|
1902
|
+
for (const command of createCodexCliSessionNodeHostCommands((agentId) => sessionCatalogControlFactory.forNode(agentId))) api.registerNodeHostCommand(command);
|
|
1815
1903
|
for (const policy of createCodexCliSessionNodeInvokePolicies()) api.registerNodeInvokePolicy(policy);
|
|
1816
1904
|
api.registerNodeHostCommand(createCodexNodeExecServerCommand());
|
|
1817
1905
|
api.registerNodeInvokePolicy(createCodexNodeExecServerInvokePolicy());
|
|
@@ -1847,23 +1935,26 @@ var codex_default = definePluginEntry({
|
|
|
1847
1935
|
plugins: declared
|
|
1848
1936
|
});
|
|
1849
1937
|
},
|
|
1850
|
-
mutate: async (update) => {
|
|
1938
|
+
mutate: async (update, assertCurrent) => {
|
|
1851
1939
|
const { mutateConfigFile } = await import("openclaw/plugin-sdk/config-mutation");
|
|
1852
|
-
await mutateConfigFile({
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1940
|
+
await mutateConfigFile({
|
|
1941
|
+
writeOptions: { assertCurrent },
|
|
1942
|
+
mutate: (draft) => {
|
|
1943
|
+
const root = draft;
|
|
1944
|
+
root.plugins = root.plugins ?? {};
|
|
1945
|
+
const pluginsBlock = root.plugins;
|
|
1946
|
+
pluginsBlock.entries = pluginsBlock.entries ?? {};
|
|
1947
|
+
const entries = pluginsBlock.entries;
|
|
1948
|
+
entries.codex = entries.codex ?? {};
|
|
1949
|
+
const codexEntry = entries.codex;
|
|
1950
|
+
codexEntry.config = codexEntry.config ?? {};
|
|
1951
|
+
const config = codexEntry.config;
|
|
1952
|
+
config.codexPlugins = config.codexPlugins ?? {};
|
|
1953
|
+
const codexPlugins = config.codexPlugins;
|
|
1954
|
+
codexPlugins.plugins = codexPlugins.plugins ?? {};
|
|
1955
|
+
update(codexPlugins);
|
|
1956
|
+
}
|
|
1957
|
+
});
|
|
1867
1958
|
}
|
|
1868
1959
|
}
|
|
1869
1960
|
}
|
|
@@ -1886,7 +1977,7 @@ var codex_default = definePluginEntry({
|
|
|
1886
1977
|
if (endedSessionKey && nextSessionKey && nextSessionKey !== endedSessionKey) return;
|
|
1887
1978
|
if (event.nextSessionId?.trim() === event.sessionId.trim()) return;
|
|
1888
1979
|
const config = resolveCurrentConfig();
|
|
1889
|
-
const [{ sessionBindingIdentity }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("
|
|
1980
|
+
const [{ sessionBindingIdentity }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./.setup/session-binding-Cm0apEbd.mjs").then((n) => n.s), import("./.setup/session-retirement-BH-S6qkJ.mjs")]);
|
|
1890
1981
|
await retireCodexAppServerSessionGeneration({
|
|
1891
1982
|
bindingStore,
|
|
1892
1983
|
identity: sessionBindingIdentity({
|