@openclaw/codex 2026.9.5 → 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/dist/.setup/{account-usage-runtime-C2MOIvfq.mjs → account-usage-runtime-Eem_WGqY.mjs} +5 -5
- package/dist/.setup/{apply-CJ0ZfmBG.mjs → apply-DDOi8uNx.mjs} +22 -28
- package/dist/.setup/{attempt-client-cleanup-BpYKdTA0.mjs → attempt-client-cleanup-CEv1cKwF.mjs} +58 -43
- package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +331 -0
- package/dist/.setup/{auth-cache-key-QirmgiCo.mjs → auth-cache-key-B2mpaI9D.mjs} +9 -81
- 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-Bm38niE8.mjs → binding-connection-ThoatDcb.mjs} +1 -1
- package/dist/.setup/{binding-connection.runtime-CnRMC0ta.mjs → binding-connection.runtime-yoHrABt-.mjs} +4 -4
- package/dist/.setup/{bounded-turn-BtlZcivC.mjs → bounded-turn-B2HScEgT.mjs} +138 -32
- package/dist/.setup/{build-state-Xx9ybZqa.mjs → build-state-C7EnDVgr.mjs} +1 -1
- package/dist/.setup/{capabilities-_vXcZGSx.mjs → capabilities-CDXOOFdZ.mjs} +1 -1
- package/dist/.setup/{client-vXs2929Q.mjs → client-Cs08OXVQ.mjs} +583 -559
- package/dist/.setup/client-catalog-response-BMgt_4q4.mjs +285 -0
- package/dist/.setup/{command-dispatch-naHIZwwF.mjs → command-dispatch-B4JuOsOk.mjs} +8 -4
- package/dist/.setup/{command-formatters-CGEkdawF.mjs → command-formatters-Bmqvr9tO.mjs} +8 -4
- package/dist/.setup/{command-handlers-BtAJEW1X.mjs → command-handlers-DW7Lx9oH.mjs} +106 -172
- package/dist/.setup/{command-rpc-DHFpn4le.mjs → command-rpc-DixIj3HW.mjs} +36 -21
- package/dist/.setup/{compact-C3i3qlzj.mjs → compact-Du5UvtxA.mjs} +14 -21
- package/dist/.setup/{config-CedDWjM-.mjs → config-BoTP_mrL.mjs} +3 -3
- package/dist/.setup/{config-options-BsanJ8QG.mjs → config-options-BvaRs51b.mjs} +46 -30
- package/dist/.setup/{config-runtime-CeAhl_h4.mjs → config-runtime-C8Rw1m1m.mjs} +1 -1
- package/dist/.setup/{config-security-BRQ2mgW9.mjs → config-security-BEReZ6go.mjs} +35 -120
- package/dist/.setup/{conversation-binding-DhzrpTM6.mjs → conversation-binding-DP-gMrBP.mjs} +21 -32
- package/dist/.setup/{conversation-control-DN53ns41.mjs → conversation-control-uK9Jomlc.mjs} +28 -67
- package/dist/.setup/{dynamic-tools-D16lOp67.mjs → dynamic-tools-BDXl-8Cw.mjs} +848 -578
- package/dist/.setup/{effective-mcp-catalog-K6kLCN8X.mjs → effective-mcp-catalog-CvnvnGIe.mjs} +3 -3
- package/dist/.setup/{ephemeral-turn-R1gA8Sn6.mjs → ephemeral-turn-poidXgek.mjs} +9 -6
- package/dist/.setup/{event-projector-assistant-message-DNUR1s0A.mjs → event-projector-assistant-message-BsruvNrH.mjs} +2 -4
- package/dist/.setup/{event-projector-items-DyTQ_XqL.mjs → event-projector-items-C6L_5ZiT.mjs} +42 -8
- package/dist/.setup/{event-projector-usage-C7Ntzs-f.mjs → event-projector-usage-CnBS8Wa3.mjs} +1 -1
- package/dist/.setup/{harness-rxaaoN-o.mjs → harness-a_MsE4-_.mjs} +23 -17
- package/dist/.setup/{inference-context-fulhZuz8.mjs → inference-context-D96l9-ew.mjs} +1 -1
- package/dist/.setup/inference-proxy-b-aJMSxm.mjs +601 -0
- package/dist/.setup/{isolated-completion-B6srt48J.mjs → isolated-completion-BIZFhTNG.mjs} +17 -10
- package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
- package/dist/.setup/{managed-binary-DP6Rib3P.mjs → managed-binary-BnshlFag.mjs} +13 -2
- package/dist/.setup/{model-catalog-DkvUuBey.mjs → model-catalog-CfXJf9Ay.mjs} +9 -10
- package/dist/.setup/{models-BDFgm_G-.mjs → models-KnqBv0hE.mjs} +3 -3
- package/dist/.setup/{native-auth-BLZGqFjw.mjs → native-auth-rWbGbMn3.mjs} +4 -4
- package/dist/.setup/{native-subagent-history-YXaL6dMd.mjs → native-subagent-history-0nYYgo0k.mjs} +26 -13
- package/dist/.setup/{native-subagent-monitor-B1hxzIOy.mjs → native-subagent-monitor-D3filLY2.mjs} +145 -317
- package/dist/.setup/{native-subagent-task-ids-DsuOonKv.mjs → native-subagent-task-ids-wb8CKZGN.mjs} +69 -39
- package/dist/.setup/{node-cli-sessions-Cl8b2ZF3.mjs → node-cli-sessions-r3avj02l.mjs} +86 -68
- package/dist/.setup/node-exec-server.runtime-BDwWXVpK.mjs +247 -0
- package/dist/.setup/{plan-xD7WKYTM.mjs → plan-CN3VwfNU.mjs} +74 -76
- package/dist/.setup/{plugin-activation-r8nq5Jzp.mjs → plugin-activation-DT3MNtqj.mjs} +7 -16
- package/dist/.setup/{plugin-app-cache-key-BOxKP7db.mjs → plugin-app-cache-key-B2CsSdnV.mjs} +4 -20
- package/dist/.setup/{plugin-approval-roundtrip-CjfzafAZ.mjs → plugin-approval-roundtrip-C0MZzCuP.mjs} +1 -1
- package/dist/.setup/{plugin-inventory-DUle8DLz.mjs → plugin-inventory-BoRei8Z4.mjs} +16 -7
- package/dist/.setup/{plugin-marketplace-discovery-P-Vndfqq.mjs → plugin-marketplace-discovery-CDOi8IFs.mjs} +4 -1
- package/dist/.setup/{plugin-metadata-cache-DsS5buNa.mjs → plugin-metadata-cache-Ctmo83k_.mjs} +224 -154
- package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
- package/dist/.setup/{provider-fFh_-VR3.mjs → provider-BOsxQHOM.mjs} +9 -5
- package/dist/.setup/{provider-capabilities-B8J4Dy-O.mjs → provider-capabilities-BfE88FZ5.mjs} +31 -3
- package/dist/.setup/{rate-limits-DOEGYRNs.mjs → rate-limits-CMU3DUD0.mjs} +116 -137
- package/dist/.setup/{request-BioXJLYa.mjs → request-D2L0zMrq.mjs} +23 -15
- package/dist/.setup/{run-attempt-rlA07pUv.mjs → run-attempt-BHu11r7h.mjs} +1197 -617
- package/dist/.setup/{runtime-artifact-Dy38Z5iU.mjs → runtime-artifact-CLZ8udh-.mjs} +29 -45
- package/dist/.setup/{sandbox-guard-BBP-RbTf.mjs → sandbox-guard-C2sRMOEY.mjs} +1 -1
- package/dist/.setup/{session-binding-_0W_fHRr.mjs → session-binding-Cm0apEbd.mjs} +3 -32
- package/dist/.setup/{session-binding-record-TH3xA0zj.mjs → session-binding-record-BGoz8wOK.mjs} +22 -3
- package/dist/.setup/{session-binding-sidecars-CKYEcfNn.mjs → session-binding-sidecars-BlB5EvIS.mjs} +48 -45
- package/dist/.setup/{session-catalog-fUdWDx-U.mjs → session-catalog-Pno1xGcl.mjs} +482 -182
- package/dist/.setup/{session-catalog-adoption-CR_whkEW.mjs → session-catalog-adoption-BI6UTDZT.mjs} +57 -25
- package/dist/.setup/{session-catalog-archive-CwZaPacf.mjs → session-catalog-archive-lHBqzhaO.mjs} +6 -6
- package/dist/.setup/{session-catalog-events-jMcYfQyd.mjs → session-catalog-events-Bj6j94E_.mjs} +122 -25
- package/dist/.setup/{session-catalog-index-B141u15s.mjs → session-catalog-index-B9_VQIUz.mjs} +178 -78
- package/dist/.setup/{session-catalog-index-order-Cc5BzlQr.mjs → session-catalog-index-order-hcdz07yN.mjs} +2 -2
- package/dist/.setup/{session-catalog-index-state-BAuDztHN.mjs → session-catalog-index-state-Dgh8ORJm.mjs} +5 -2
- package/dist/.setup/{session-catalog-native-projection-ChV3cCtm.mjs → session-catalog-native-projection-DowriLid.mjs} +30 -13
- package/dist/.setup/{session-catalog-node-adoption-BVRsYOSh.mjs → session-catalog-node-adoption-ITddWx_X.mjs} +24 -12
- package/dist/.setup/{session-catalog-node-continue-Dowv8osw.mjs → session-catalog-node-continue-6g6qi4A9.mjs} +22 -13
- package/dist/.setup/{session-catalog-projection-C1Bj9Jl-.mjs → session-catalog-projection-zK_PUsiE.mjs} +13 -5
- package/dist/.setup/{session-cli-DIj-IE-E.mjs → session-cli-irrD-uo7.mjs} +4 -4
- package/dist/.setup/{session-history-C--SrLI8.mjs → session-history-BrqhSCf9.mjs} +17 -22
- package/dist/.setup/{session-history-import-JHXT5Xfi.mjs → session-history-import-D-3wAgOP.mjs} +4 -4
- package/dist/.setup/{session-history.worker-CpNj7H_P.mjs → session-history.worker-CaCh0xF_.mjs} +5 -18
- package/dist/.setup/{session-initialization-DH1z6fXn.mjs → session-initialization-rcgbZiid.mjs} +2 -2
- package/dist/.setup/{session-permission-policy-DhurXY0l.mjs → session-permission-policy-BI1QK_98.mjs} +2 -2
- package/dist/.setup/{session-retirement-CU87AOg9.mjs → session-retirement-BH-S6qkJ.mjs} +25 -6
- package/dist/.setup/{settled-turn-finalizer-CiY2bLFK.mjs → settled-turn-finalizer-DiAi6Kx6.mjs} +8 -8
- package/dist/.setup/{shared-client-BpTtuLQ5.mjs → shared-client-DA4VR4Eb.mjs} +59 -89
- package/dist/.setup/{side-question-DSCZyoBD.mjs → side-question-BJ1wSDcB.mjs} +147 -211
- package/dist/.setup/{source-Bjp4UQij.mjs → source-CUzJq5WN.mjs} +9 -9
- package/dist/.setup/spawn-error-CL3n6MAa.mjs +57 -0
- package/dist/.setup/{thread-archive-guard-jmecf6OJ.mjs → thread-archive-guard-C9frICzX.mjs} +10 -3
- package/dist/.setup/{thread-history-page-BTx-4xsg.mjs → thread-history-page-DoVpnHim.mjs} +1 -1
- package/dist/.setup/{thread-lifecycle-Cik28qWn.mjs → thread-lifecycle-B3mfz1TG.mjs} +172 -2271
- package/dist/.setup/{thread-ownership-skomxnIt.mjs → thread-ownership-DcTtAcXj.mjs} +4 -2
- package/dist/.setup/{thread-policy-Cjs4B8xf.mjs → thread-policy-DGuQsuFC.mjs} +19 -3
- package/dist/.setup/thread-requests-BLvGkP2R.mjs +2205 -0
- package/dist/.setup/{thread-resume-BkNpj9Pz.mjs → thread-resume-DIBXwOpE.mjs} +6 -6
- package/dist/.setup/{timeout-DZF05XrR.mjs → timeout-C910MdAB.mjs} +19 -2
- package/dist/.setup/{transcript-history-projection-DHNBDhCU.mjs → transcript-history-projection-ZZpkFkJ_.mjs} +94 -64
- package/dist/.setup/{transcript-mirror-D4qp_leP.mjs → transcript-mirror-BtHDBp1G.mjs} +218 -198
- package/dist/.setup/{transport-stdio-Cmx94Oiy.mjs → transport-stdio-h2VHOskC.mjs} +135 -55
- package/dist/.setup/{upstream-session-fork-D3UKxgVD.mjs → upstream-session-fork-BUr4OUbC.mjs} +44 -36
- package/dist/.setup/{usage-BOgBEKso.mjs → usage-BML0r-ua.mjs} +5 -4
- package/dist/.setup/{usage-limit-error-C0ow7DOc.mjs → usage-limit-error-DUMbefVY.mjs} +4 -4
- package/dist/.setup/{web-search-provider.runtime-CTGuJt6i.mjs → 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 +2 -2
- package/dist/harness.js +1 -1
- package/dist/index.js +221 -170
- package/dist/media-understanding-provider.js +2 -2
- package/dist/migration-provider-api.js +1 -1
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +15 -32
- package/dist/session-history.worker.js +1 -1
- package/package.json +9 -6
- package/dist/.setup/attempt-context-VXVwTCfS.mjs +0 -636
- package/dist/.setup/inference-proxy-CC15HuSi.mjs +0 -311
- package/dist/.setup/launch-args-DnMak49W.mjs +0 -111
- package/dist/.setup/node-exec-server.runtime-BaViBKNz.mjs +0 -226
- package/dist/.setup/version-CoqzXPgK.mjs +0 -12
- package/dist/.setup/{native-execution-policy-YBMHSzC4.mjs → native-execution-policy-umd0tgh4.mjs} +1 -1
|
@@ -1,102 +1,91 @@
|
|
|
1
1
|
import { n as isCodexFastServiceTier } from "./config-utils-DujwEnhg.mjs";
|
|
2
|
-
import { c as CODEX_PLUGINS_MARKETPLACE_NAME, i as pluginReadParams, r as isOpenAiCuratedMarketplaceName, t as findCodexMarketplacePluginSummary } from "./plugin-inventory-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { c as resolveCodexAppServerPreparedApiKeyCacheKey, s as resolveCodexAppServerFallbackApiKeyCacheKey } from "./auth-cache-key-QirmgiCo.mjs";
|
|
2
|
+
import { c as CODEX_PLUGINS_MARKETPLACE_NAME, i as pluginReadParams, r as isOpenAiCuratedMarketplaceName, t as findCodexMarketplacePluginSummary } from "./plugin-inventory-BoRei8Z4.mjs";
|
|
3
|
+
import { m as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced, r as bindingStoreKey } from "./session-binding-record-BGoz8wOK.mjs";
|
|
4
|
+
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
5
|
+
import { c as resolveCodexAppServerPreparedApiKeyCacheKey, s as resolveCodexAppServerFallbackApiKeyCacheKey } from "./auth-cache-key-B2mpaI9D.mjs";
|
|
7
6
|
import { r as withCodexConversationThreadActivity, t as isIncognitoSessionKey } from "./incognito-session-uhrBF6wJ.mjs";
|
|
8
|
-
import { a as CODEX_HOST_INSPECTION_AUTH_ERROR, c as
|
|
9
|
-
import { s as summarizeCodexAccountUsage } from "./rate-limits-
|
|
10
|
-
import { a as formatCodexAccountLine, c as formatCodexTextForDisplay, d as formatModels, f as formatSkills, i as formatAccount, l as formatComputerUseStatus, n as buildHelp, o as formatCodexDisplayText, p as formatThreads, r as escapeCodexChatText, s as formatCodexStatus, t as CODEX_RESUME_SAFE_THREAD_ID_PATTERN, u as formatList } from "./command-formatters-
|
|
7
|
+
import { a as CODEX_HOST_INSPECTION_AUTH_ERROR, c as canMutateCodexHost, i as CODEX_FULL_PERMISSIONS_AUTH_ERROR, l as hasCodexAdminScope, n as filterCodexMarketplacePlugins, o as CODEX_NATIVE_EXECUTION_AUTH_ERROR, r as parseCodexPluginMarketplaceId, s as assertCodexHostOwnerCurrent, t as discoverCodexMarketplacePlugins } from "./plugin-marketplace-discovery-CDOi8IFs.mjs";
|
|
8
|
+
import { s as summarizeCodexAccountUsage } from "./rate-limits-CMU3DUD0.mjs";
|
|
9
|
+
import { a as formatCodexAccountLine, c as formatCodexTextForDisplay, d as formatModels, f as formatSkills, i as formatAccount, l as formatComputerUseStatus, n as buildHelp, o as formatCodexDisplayText, p as formatThreads, r as escapeCodexChatText, s as formatCodexStatus, t as CODEX_RESUME_SAFE_THREAD_ID_PATTERN, u as formatList } from "./command-formatters-Bmqvr9tO.mjs";
|
|
11
10
|
import { i as readCodexConversationBindingData, n as createCodexCliNodeConversationBindingData, o as resolveCodexDefaultWorkspaceDir, r as createCodexConversationBindingData } from "./conversation-binding-data-CrcyZk6O.mjs";
|
|
12
|
-
import {
|
|
13
|
-
import { t as CODEX_CONTROL_METHODS } from "./capabilities-
|
|
14
|
-
import {
|
|
15
|
-
import { a as defaultCodexAppInventoryCache, r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-
|
|
16
|
-
import { i as resolveCodexBindingAppServerConnection } from "./binding-connection-
|
|
17
|
-
import { o as withCodexAppServerJsonClient } from "./request-
|
|
18
|
-
import "./config-
|
|
19
|
-
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-
|
|
11
|
+
import { o as CodexAppServerRpcError } from "./timeout-C910MdAB.mjs";
|
|
12
|
+
import { t as CODEX_CONTROL_METHODS } from "./capabilities-CDXOOFdZ.mjs";
|
|
13
|
+
import { o as formatCodexCliSessions } from "./node-cli-sessions-r3avj02l.mjs";
|
|
14
|
+
import { a as defaultCodexAppInventoryCache, r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-B2CsSdnV.mjs";
|
|
15
|
+
import { i as resolveCodexBindingAppServerConnection } from "./binding-connection-ThoatDcb.mjs";
|
|
16
|
+
import { o as withCodexAppServerJsonClient } from "./request-D2L0zMrq.mjs";
|
|
17
|
+
import "./config-BoTP_mrL.mjs";
|
|
18
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-C8Rw1m1m.mjs";
|
|
20
19
|
import { a as resolveCodexAppServerAuthProfileStore, i as resolveCodexAppServerAuthProfileIdForAgent, n as normalizeCodexAppServerBindingModelProvider } from "./auth-profile-WqZtZfXN.mjs";
|
|
20
|
+
import { I as hasCodexAppServerLiveThread, N as consumeCodexAppServerLiveThread, X as resolveCodexAppServerAuthAccountCacheKey, c as getLeasedSharedCodexAppServerClient, h as releaseLeasedSharedCodexAppServerClient } from "./shared-client-DA4VR4Eb.mjs";
|
|
21
|
+
import { b as assertCodexThreadResumeResponse, s as isCodexAppServerIndeterminateRequestCancellationError, u as isCodexAppServerPrewriteRequestCancellationError, v as assertCodexThreadAcceptsDirectInput } from "./client-Cs08OXVQ.mjs";
|
|
22
|
+
import { o as closeCodexStartupClientBestEffort } from "./attempt-client-cleanup-CEv1cKwF.mjs";
|
|
21
23
|
import { n as fingerprintCodexAppServerAuthBinding } from "./auth-binding-DhLWa_7K.mjs";
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import { n as
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import { i as
|
|
31
|
-
import { a as requestOptions, i as readCodexStatusProbes, o as safeCodexControlRequest, r as prepareCodexControlSessionAuth, t as codexControlRequest } from "./command-rpc-DHFpn4le.mjs";
|
|
32
|
-
import { a as setCodexConversationFastMode, c as steerCodexConversationTurn, i as readCodexConversationActiveTurn, l as stopCodexConversationTurn, n as parseCodexFastModeArg, o as setCodexConversationModel, r as parseCodexPermissionsModeArg, s as setCodexConversationPermissions, t as formatPermissionsMode } from "./conversation-control-DN53ns41.mjs";
|
|
24
|
+
import { t as listAllCodexAppServerModels } from "./models-KnqBv0hE.mjs";
|
|
25
|
+
import { n as refreshCodexAppRuntimeState, r as refreshCodexPluginRuntimeState } from "./plugin-activation-DT3MNtqj.mjs";
|
|
26
|
+
import { n as createCodexSessionGenerationSupersededError, o as resolveCodexSessionBinding } from "./session-binding-Cm0apEbd.mjs";
|
|
27
|
+
import { i as assertCodexSupervisionThreadLineage } from "./thread-policy-DGuQsuFC.mjs";
|
|
28
|
+
import { a as rollbackCodexAppServerBindingSubscription, i as retireCodexConversationThreadBinding, n as releaseCodexAppServerBindingSubscription, r as retainCodexAppServerBindingSubscription, s as withExclusiveCodexAppServerThread, t as isSameCodexAppServerThreadOwner } from "./thread-ownership-DcTtAcXj.mjs";
|
|
29
|
+
import { n as resolveCodexNativeSandboxBlock, t as resolveCodexNativeExecutionBlock } from "./sandbox-guard-C2sRMOEY.mjs";
|
|
30
|
+
import { i as readCodexComputerUseStatus, r as installCodexComputerUse, t as defaultCodexPluginMetadataCache } from "./plugin-metadata-cache-Ctmo83k_.mjs";
|
|
31
|
+
import { a as requestOptions, i as readCodexStatusProbes, o as safeCodexControlRequest, r as prepareCodexControlSessionAuth, t as codexControlRequest } from "./command-rpc-DixIj3HW.mjs";
|
|
32
|
+
import { a as setCodexConversationFastMode, c as steerCodexConversationTurn, i as readCodexConversationActiveTurn, l as stopCodexConversationTurn, n as parseCodexFastModeArg, o as setCodexConversationModel, r as parseCodexPermissionsModeArg, s as setCodexConversationPermissions, t as formatPermissionsMode } from "./conversation-control-uK9Jomlc.mjs";
|
|
33
33
|
import { normalizeOptionalString, normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
34
34
|
import crypto from "node:crypto";
|
|
35
35
|
import { isDeepStrictEqual } from "node:util";
|
|
36
36
|
import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
37
37
|
import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
38
38
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
39
|
+
import { parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
|
|
39
40
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
40
41
|
import { ensureAuthProfileStore, resolveAgentDir as resolveAgentDir$1, resolveAgentWorkspaceDir, resolveAuthProfileEligibility, resolveProfileUnusableUntilForDisplay } from "openclaw/plugin-sdk/agent-runtime";
|
|
41
42
|
import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
42
43
|
import { findNormalizedProviderValue, resolveAuthProfileOrder } from "openclaw/plugin-sdk/provider-auth";
|
|
43
|
-
import { parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
|
|
44
44
|
import { renderMessagePresentationFallbackText } from "openclaw/plugin-sdk/interactive-runtime";
|
|
45
45
|
import { MODEL_SELECTION_LOCKED_MESSAGE, isModelSelectionLocked, resolvePersistedSessionRuntimeId } from "openclaw/plugin-sdk/model-session-runtime";
|
|
46
46
|
//#region extensions/codex/src/command-account.ts
|
|
47
47
|
const OPENAI_PROVIDER_ID = "openai";
|
|
48
|
-
const OPENAI_CODEX_PROVIDER_ID = OPENAI_PROVIDER_ID;
|
|
49
48
|
async function readCodexAccountAuthOverview(params) {
|
|
49
|
+
if (!params.account.ok && !params.limits.ok) return;
|
|
50
50
|
const config = params.ctx.config;
|
|
51
51
|
const agentDir = params.agentDir;
|
|
52
52
|
const store = ensureAuthProfileStore(agentDir, {
|
|
53
53
|
allowKeychainPrompt: false,
|
|
54
54
|
config
|
|
55
55
|
});
|
|
56
|
-
const
|
|
56
|
+
const order = resolveDisplayAuthOrder({
|
|
57
57
|
config,
|
|
58
58
|
store
|
|
59
59
|
});
|
|
60
|
+
const activeProfileId = params.authProfileId ?? void 0;
|
|
61
|
+
if (activeProfileId && !order.includes(activeProfileId)) order.unshift(activeProfileId);
|
|
60
62
|
if (order.length === 0) return;
|
|
61
63
|
const now = Date.now();
|
|
62
|
-
const activeProfileId = resolveActiveProfileId({
|
|
63
|
-
store,
|
|
64
|
-
order,
|
|
65
|
-
explicitOrder,
|
|
66
|
-
config,
|
|
67
|
-
account: params.account,
|
|
68
|
-
limits: params.limits,
|
|
69
|
-
now
|
|
70
|
-
});
|
|
71
64
|
const activeIsSubscription = activeProfileId !== void 0 && isChatGptSubscriptionProfile(store.profiles[activeProfileId]);
|
|
72
|
-
const subscriptionProfileId = activeIsSubscription ? activeProfileId : order.find((profileId) => isChatGptSubscriptionProfile(store.profiles[profileId]));
|
|
65
|
+
const subscriptionProfileId = activeIsSubscription ? activeProfileId : activeProfileId ? order.find((profileId) => isChatGptSubscriptionProfile(store.profiles[profileId])) : void 0;
|
|
73
66
|
const activeUsage = activeIsSubscription && params.limits.ok ? summarizeCodexAccountUsage(params.limits.value, now) : void 0;
|
|
74
|
-
const subscriptionUsage = subscriptionProfileId &&
|
|
67
|
+
const subscriptionUsage = subscriptionProfileId && !activeIsSubscription ? await readSubscriptionUsage({
|
|
75
68
|
...params,
|
|
76
69
|
agentDir,
|
|
77
70
|
config,
|
|
78
71
|
subscriptionProfileId,
|
|
79
72
|
now
|
|
80
73
|
}) : activeUsage;
|
|
81
|
-
|
|
82
|
-
const rows = order.map((profileId, index) => buildProfileRow({
|
|
74
|
+
const rows = order.map((profileId) => buildProfileRow({
|
|
83
75
|
store,
|
|
84
76
|
config,
|
|
85
77
|
profileId,
|
|
86
78
|
activeProfileId,
|
|
87
|
-
activeIndex: activeProfileId ? order.indexOf(activeProfileId) : -1,
|
|
88
|
-
index,
|
|
89
79
|
now,
|
|
90
80
|
usage: profileId === subscriptionProfileId ? subscriptionUsage : void 0
|
|
91
81
|
}));
|
|
92
82
|
const activeRow = rows.find((row) => row.active);
|
|
93
83
|
if (!activeRow) return {
|
|
94
|
-
currentLine: "OpenAI credentials: no working credential",
|
|
95
84
|
orderTitle: "Auth order",
|
|
96
85
|
rows
|
|
97
86
|
};
|
|
98
87
|
const activeIsApiKey = store.profiles[activeRow.profileId]?.type === "api_key";
|
|
99
|
-
const subscriptionLabel = subscriptionProfileId ? formatProfileLabel(subscriptionProfileId, store.profiles[subscriptionProfileId]) :
|
|
88
|
+
const subscriptionLabel = subscriptionProfileId ? formatProfileLabel(subscriptionProfileId, store.profiles[subscriptionProfileId]) : void 0;
|
|
100
89
|
const subscriptionUsageLine = formatSubscriptionUsageLine(subscriptionUsage);
|
|
101
90
|
return {
|
|
102
91
|
...activeIsApiKey ? { currentLine: buildApiKeyActiveLine(activeRow, subscriptionUsage) } : {},
|
|
@@ -107,92 +96,13 @@ async function readCodexAccountAuthOverview(params) {
|
|
|
107
96
|
};
|
|
108
97
|
}
|
|
109
98
|
function resolveDisplayAuthOrder(params) {
|
|
110
|
-
const
|
|
111
|
-
if (
|
|
112
|
-
order: normalizeUniqueStringEntries(codexOrder),
|
|
113
|
-
explicit: true
|
|
114
|
-
};
|
|
115
|
-
return {
|
|
116
|
-
order: resolveAuthProfileOrder({
|
|
117
|
-
cfg: params.config,
|
|
118
|
-
store: params.store,
|
|
119
|
-
provider: OPENAI_CODEX_PROVIDER_ID
|
|
120
|
-
}),
|
|
121
|
-
explicit: hasExplicitOpenAiAuthOrder(params)
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
function hasExplicitOpenAiAuthOrder(params) {
|
|
125
|
-
const sources = [params.store.order, params.config?.auth?.order];
|
|
126
|
-
for (const source of sources) {
|
|
127
|
-
const codex = resolveOrder(source, OPENAI_CODEX_PROVIDER_ID);
|
|
128
|
-
if (codex && codex.length > 0) return true;
|
|
129
|
-
const openai = resolveOrder(source, OPENAI_PROVIDER_ID);
|
|
130
|
-
if (openai && openai.length > 0) return true;
|
|
131
|
-
}
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
function resolveOrder(order, provider) {
|
|
135
|
-
return findNormalizedProviderValue(order, provider);
|
|
136
|
-
}
|
|
137
|
-
function resolveActiveProfileId(params) {
|
|
138
|
-
const liveProfileId = resolveLiveAccountProfileId({
|
|
139
|
-
account: params.account,
|
|
140
|
-
store: params.store,
|
|
141
|
-
order: params.order
|
|
142
|
-
});
|
|
143
|
-
if (liveProfileId) return liveProfileId;
|
|
144
|
-
if (params.explicitOrder) return params.order.find((profileId) => isActiveProfileCandidate(params, profileId) && resolveAuthProfileEligibility({
|
|
145
|
-
cfg: params.config,
|
|
146
|
-
store: params.store,
|
|
147
|
-
provider: OPENAI_CODEX_PROVIDER_ID,
|
|
148
|
-
profileId,
|
|
149
|
-
now: params.now
|
|
150
|
-
}).eligible);
|
|
151
|
-
const lastGood = [params.store.lastGood?.[OPENAI_PROVIDER_ID], params.store.lastGood?.[OPENAI_CODEX_PROVIDER_ID]].find((profileId) => typeof profileId === "string" && params.order.includes(profileId) && isActiveProfileCandidate(params, profileId));
|
|
152
|
-
if (lastGood) return lastGood;
|
|
153
|
-
const mostRecent = params.order.map((profileId) => ({
|
|
154
|
-
profileId,
|
|
155
|
-
lastUsed: params.store.usageStats?.[profileId]?.lastUsed ?? 0
|
|
156
|
-
})).filter((entry) => entry.lastUsed > 0 && isActiveProfileCandidate(params, entry.profileId)).toSorted((left, right) => right.lastUsed - left.lastUsed)[0]?.profileId;
|
|
157
|
-
if (mostRecent) return mostRecent;
|
|
158
|
-
if (shouldInferApiKeyActiveFromRateLimitProbe(params.limits)) {
|
|
159
|
-
const apiKeyProfile = params.order.find((profileId) => params.store.profiles[profileId]?.type === "api_key");
|
|
160
|
-
if (apiKeyProfile) return apiKeyProfile;
|
|
161
|
-
}
|
|
99
|
+
const explicitOrder = findNormalizedProviderValue(params.store.order, OPENAI_PROVIDER_ID) ?? findNormalizedProviderValue(params.config?.auth?.order, OPENAI_PROVIDER_ID);
|
|
100
|
+
if (explicitOrder && explicitOrder.length > 0) return normalizeUniqueStringEntries(explicitOrder);
|
|
162
101
|
return resolveAuthProfileOrder({
|
|
163
102
|
cfg: params.config,
|
|
164
103
|
store: params.store,
|
|
165
|
-
provider:
|
|
166
|
-
})
|
|
167
|
-
}
|
|
168
|
-
function isActiveProfileCandidate(params, profileId) {
|
|
169
|
-
return !isActiveUntil(resolveProfileUnusableUntilForDisplay(params.store, profileId) ?? void 0, params.now);
|
|
170
|
-
}
|
|
171
|
-
function resolveLiveAccountProfileId(params) {
|
|
172
|
-
if (!params.account.ok || !isJsonObject(params.account.value)) return;
|
|
173
|
-
const account = isJsonObject(params.account.value.account) ? params.account.value.account : params.account.value;
|
|
174
|
-
const type = normalizeOptionalString(account.type)?.toLowerCase();
|
|
175
|
-
if (type === "chatgpt") {
|
|
176
|
-
const email = normalizeOptionalString(account.email)?.toLowerCase();
|
|
177
|
-
const accountId = normalizeOptionalString(account.accountId ?? account.chatgptAccountId);
|
|
178
|
-
const subscriptionProfiles = params.order.filter((profileId) => isChatGptSubscriptionProfile(params.store.profiles[profileId]));
|
|
179
|
-
if (accountId) {
|
|
180
|
-
const exactWorkspace = subscriptionProfiles.find((profileId) => {
|
|
181
|
-
const credential = params.store.profiles[profileId];
|
|
182
|
-
return credential && "accountId" in credential && credential.accountId === accountId;
|
|
183
|
-
});
|
|
184
|
-
if (exactWorkspace) return exactWorkspace;
|
|
185
|
-
}
|
|
186
|
-
const matchingProfiles = email ? subscriptionProfiles.filter((profileId) => {
|
|
187
|
-
return (params.store.profiles[profileId]?.email?.trim().toLowerCase() ?? extractEmailFromProfileId(profileId))?.toLowerCase() === email;
|
|
188
|
-
}) : subscriptionProfiles;
|
|
189
|
-
const lastGood = params.store.lastGood?.[OPENAI_PROVIDER_ID];
|
|
190
|
-
return (lastGood && matchingProfiles.includes(lastGood) ? lastGood : void 0) ?? matchingProfiles[0] ?? subscriptionProfiles[0];
|
|
191
|
-
}
|
|
192
|
-
if (type === "apikey" || type === "api_key") return params.order.find((profileId) => params.store.profiles[profileId]?.type === "api_key");
|
|
193
|
-
}
|
|
194
|
-
function shouldInferApiKeyActiveFromRateLimitProbe(limits) {
|
|
195
|
-
return !limits.ok && limits.error.toLowerCase().includes("chatgpt authentication required");
|
|
104
|
+
provider: OPENAI_PROVIDER_ID
|
|
105
|
+
});
|
|
196
106
|
}
|
|
197
107
|
async function readSubscriptionUsage(params) {
|
|
198
108
|
const limits = await params.safeCodexControlRequest(params.pluginConfig, CODEX_CONTROL_METHODS.rateLimits, void 0, {
|
|
@@ -209,13 +119,12 @@ function buildProfileRow(params) {
|
|
|
209
119
|
const label = formatProfileLabel(params.profileId, credential);
|
|
210
120
|
const kind = formatProfileKind(credential);
|
|
211
121
|
const active = params.profileId === params.activeProfileId;
|
|
212
|
-
const status = active ? "active now" : params.usage?.blocked ?
|
|
122
|
+
const status = active ? "active now" : params.usage?.blocked ? "rate-limited" : describeInactiveProfileStatus({
|
|
213
123
|
store: params.store,
|
|
214
124
|
config: params.config,
|
|
215
125
|
profileId: params.profileId,
|
|
216
126
|
credential,
|
|
217
|
-
now: params.now
|
|
218
|
-
afterActive: params.activeIndex >= 0 && params.index > params.activeIndex
|
|
127
|
+
now: params.now
|
|
219
128
|
});
|
|
220
129
|
return {
|
|
221
130
|
profileId: params.profileId,
|
|
@@ -223,13 +132,9 @@ function buildProfileRow(params) {
|
|
|
223
132
|
kind,
|
|
224
133
|
status,
|
|
225
134
|
active,
|
|
226
|
-
...credential?.type === "api_key" && active ? { billingNote: "billed per token" } : {}
|
|
227
|
-
...params.usage?.usageLine ? { usage: params.usage.usageLine } : {}
|
|
135
|
+
...credential?.type === "api_key" && active ? { billingNote: "billed per token" } : {}
|
|
228
136
|
};
|
|
229
137
|
}
|
|
230
|
-
function formatUsageBlockedStatus(usage) {
|
|
231
|
-
return usage.blocked ? "rate-limited" : "available if needed";
|
|
232
|
-
}
|
|
233
138
|
function describeInactiveProfileStatus(params) {
|
|
234
139
|
const stats = params.store.usageStats?.[params.profileId];
|
|
235
140
|
const blockedUntil = stats?.blockedUntil;
|
|
@@ -238,7 +143,7 @@ function describeInactiveProfileStatus(params) {
|
|
|
238
143
|
const eligibility = resolveAuthProfileEligibility({
|
|
239
144
|
cfg: params.config,
|
|
240
145
|
store: params.store,
|
|
241
|
-
provider:
|
|
146
|
+
provider: OPENAI_PROVIDER_ID,
|
|
242
147
|
profileId: params.profileId,
|
|
243
148
|
now: params.now
|
|
244
149
|
});
|
|
@@ -1573,7 +1478,15 @@ async function resolvePreparedCodexCommandAuthority(deps, ctx) {
|
|
|
1573
1478
|
sessionKey,
|
|
1574
1479
|
storePath,
|
|
1575
1480
|
assertHostCurrent,
|
|
1576
|
-
assertCurrent
|
|
1481
|
+
assertCurrent,
|
|
1482
|
+
assertMutationCurrent: () => {
|
|
1483
|
+
assertCodexHostOwnerCurrent(ctx);
|
|
1484
|
+
assertCurrent();
|
|
1485
|
+
},
|
|
1486
|
+
assertHostMutationCurrent: () => {
|
|
1487
|
+
assertCodexHostOwnerCurrent(ctx);
|
|
1488
|
+
assertHostCurrent();
|
|
1489
|
+
}
|
|
1577
1490
|
};
|
|
1578
1491
|
}
|
|
1579
1492
|
async function resolveCommandAppServerContext(deps, ctx, pluginConfig) {
|
|
@@ -1631,7 +1544,8 @@ function resolveCodexConversationControlScope(ctx) {
|
|
|
1631
1544
|
}
|
|
1632
1545
|
//#endregion
|
|
1633
1546
|
//#region extensions/codex/src/command-diagnostics.ts
|
|
1634
|
-
async function handleCodexDiagnosticsFeedback(deps,
|
|
1547
|
+
async function handleCodexDiagnosticsFeedback(deps, context, pluginConfig, args, commandPrefix) {
|
|
1548
|
+
const ctx = { ...context };
|
|
1635
1549
|
if (ctx.senderIsOwner !== true) return { text: "Only an owner can send Codex diagnostics." };
|
|
1636
1550
|
const parsed = parseDiagnosticsArgs(args);
|
|
1637
1551
|
if (parsed.action === "usage") return { text: formatDiagnosticsUsage(commandPrefix) };
|
|
@@ -1758,6 +1672,7 @@ async function sendCodexDiagnosticsFeedbackForTargets(deps, ctx, pluginConfig, n
|
|
|
1758
1672
|
const failed = [];
|
|
1759
1673
|
for (const target of targets) {
|
|
1760
1674
|
const assertCurrent = () => {
|
|
1675
|
+
ctx.assertOwnerCurrent?.();
|
|
1761
1676
|
const current = resolvePendingCodexDiagnosticsTargets(deps, [target], ctx.config);
|
|
1762
1677
|
if (!codexDiagnosticsTargetsMatch([target], current)) throw new Error("The Codex diagnostics session changed before upload; request it again.");
|
|
1763
1678
|
};
|
|
@@ -1955,6 +1870,7 @@ async function bindConversation(deps, ctx, pluginConfig, args) {
|
|
|
1955
1870
|
}
|
|
1956
1871
|
});
|
|
1957
1872
|
const threadLabel = parsed.threadId ?? "a new thread";
|
|
1873
|
+
assertCodexHostOwnerCurrent(ctx);
|
|
1958
1874
|
const request = await ctx.requestConversationBinding({
|
|
1959
1875
|
summary: `Codex app-server thread ${formatCodexDisplayText(threadLabel)} in ${formatCodexDisplayText(workspaceDir)}`,
|
|
1960
1876
|
detachHint: "/codex detach",
|
|
@@ -1988,6 +1904,7 @@ async function detachConversation(deps, ctx) {
|
|
|
1988
1904
|
bindingStore: deps.bindingStore,
|
|
1989
1905
|
identity,
|
|
1990
1906
|
expectedThreadId,
|
|
1907
|
+
assertCurrent: () => assertCodexHostOwnerCurrent(ctx),
|
|
1991
1908
|
...expectedStartId ? { expectedStartId } : {},
|
|
1992
1909
|
...isIncognitoSessionKey(sourceSessionKey) ? { allowUntracked: true } : {},
|
|
1993
1910
|
afterClear: async () => {
|
|
@@ -1996,6 +1913,7 @@ async function detachConversation(deps, ctx) {
|
|
|
1996
1913
|
})) return "This Codex conversation binding changed while detaching; try again.";
|
|
1997
1914
|
return detachedPublicConversation;
|
|
1998
1915
|
});
|
|
1916
|
+
assertCodexHostOwnerCurrent(ctx);
|
|
1999
1917
|
return await detachPublicConversation();
|
|
2000
1918
|
}
|
|
2001
1919
|
async function describeConversationBinding(deps, ctx) {
|
|
@@ -2155,6 +2073,7 @@ async function resumeThread(deps, ctx, pluginConfig, args) {
|
|
|
2155
2073
|
sessionId: ctx.sessionId,
|
|
2156
2074
|
storePath: ctx.sessionTarget?.storePath,
|
|
2157
2075
|
assertCurrent: assertHostGeneration,
|
|
2076
|
+
assertOwnerCurrent: () => assertCodexHostOwnerCurrent(ctx),
|
|
2158
2077
|
beforeRequest: async (request) => {
|
|
2159
2078
|
const { thread } = await request({
|
|
2160
2079
|
method: "thread/read",
|
|
@@ -2199,6 +2118,7 @@ async function bindCodexCliNodeSession(deps, ctx, parsed) {
|
|
|
2199
2118
|
cwd: resolved.session?.cwd
|
|
2200
2119
|
});
|
|
2201
2120
|
const summary = `Codex CLI session ${formatCodexDisplayText(parsed.threadId)} on ${formatCodexDisplayText(nodeId)}`;
|
|
2121
|
+
assertCodexHostOwnerCurrent(ctx);
|
|
2202
2122
|
const request = await ctx.requestConversationBinding({
|
|
2203
2123
|
summary,
|
|
2204
2124
|
detachHint: "/codex detach",
|
|
@@ -2291,7 +2211,10 @@ async function handleComputerUseCommand(deps, ctx, pluginConfig, args) {
|
|
|
2291
2211
|
forceEnable: parsed.action === "install" || parsed.hasOverrides,
|
|
2292
2212
|
...Object.keys(parsed.overrides).length > 0 ? { overrides: parsed.overrides } : {}
|
|
2293
2213
|
};
|
|
2294
|
-
if (parsed.action === "install") return formatComputerUseStatus(await deps.installCodexComputerUse(
|
|
2214
|
+
if (parsed.action === "install") return formatComputerUseStatus(await deps.installCodexComputerUse({
|
|
2215
|
+
...params,
|
|
2216
|
+
assertCurrent: () => assertCodexHostOwnerCurrent(ctx)
|
|
2217
|
+
}));
|
|
2295
2218
|
return formatComputerUseStatus(await deps.readCodexComputerUseStatus(params));
|
|
2296
2219
|
}
|
|
2297
2220
|
async function handleNativeGoal(deps, ctx, pluginConfig, args) {
|
|
@@ -2325,7 +2248,10 @@ async function handleNativeGoal(deps, ctx, pluginConfig, args) {
|
|
|
2325
2248
|
}
|
|
2326
2249
|
if (action === "clear") {
|
|
2327
2250
|
if (args.length > 1) return "Usage: /codex goal clear";
|
|
2328
|
-
const response = await deps.codexControlRequest(pluginConfig, CODEX_CONTROL_METHODS.clearThreadGoal, { threadId: binding.threadId },
|
|
2251
|
+
const response = await deps.codexControlRequest(pluginConfig, CODEX_CONTROL_METHODS.clearThreadGoal, { threadId: binding.threadId }, {
|
|
2252
|
+
...goalRequestOptions,
|
|
2253
|
+
assertOwnerCurrent: () => assertCodexHostOwnerCurrent(ctx)
|
|
2254
|
+
});
|
|
2329
2255
|
return isJsonObject(response) && response.cleared === true ? "Cleared the Codex goal." : "No Codex goal was active.";
|
|
2330
2256
|
}
|
|
2331
2257
|
const requestedStatus = action === "pause" ? "paused" : action === "resume" ? "active" : action === "block" ? "blocked" : action === "complete" ? "complete" : void 0;
|
|
@@ -2338,6 +2264,7 @@ async function handleNativeGoal(deps, ctx, pluginConfig, args) {
|
|
|
2338
2264
|
...requestedStatus ? { status: requestedStatus } : {}
|
|
2339
2265
|
}, {
|
|
2340
2266
|
...goalRequestOptions,
|
|
2267
|
+
assertOwnerCurrent: () => assertCodexHostOwnerCurrent(ctx),
|
|
2341
2268
|
...(isObjectiveUpdate || requestedStatus === "active") && connection.usesSupervisionConnection ? { beforeRequest: supervisedCommandGuard(deps, target.identity, binding) } : {}
|
|
2342
2269
|
})));
|
|
2343
2270
|
}
|
|
@@ -2354,20 +2281,17 @@ function formatNativeGoal(response) {
|
|
|
2354
2281
|
`- Tokens: ${tokensUsed}${tokenBudget === void 0 ? "" : ` / ${tokenBudget}`}`
|
|
2355
2282
|
].join("\n");
|
|
2356
2283
|
}
|
|
2357
|
-
async function stopConversationTurn(deps, ctx
|
|
2284
|
+
async function stopConversationTurn(deps, ctx) {
|
|
2358
2285
|
const authority = await resolvePreparedCodexCommandAuthority(deps, ctx);
|
|
2359
2286
|
const { target, binding } = authority;
|
|
2360
2287
|
if (!target) return "Cannot stop Codex because this command did not include a stable binding identity.";
|
|
2361
2288
|
return (await deps.stopCodexConversationTurn({
|
|
2362
2289
|
identity: target.identity,
|
|
2363
2290
|
binding,
|
|
2364
|
-
|
|
2365
|
-
agentDir: target.agentDir,
|
|
2366
|
-
config: ctx.config,
|
|
2367
|
-
assertCurrent: authority.assertCurrent
|
|
2291
|
+
assertCurrent: authority.assertMutationCurrent
|
|
2368
2292
|
})).message;
|
|
2369
2293
|
}
|
|
2370
|
-
async function steerConversationTurn(deps, ctx,
|
|
2294
|
+
async function steerConversationTurn(deps, ctx, message) {
|
|
2371
2295
|
const authority = await resolvePreparedCodexCommandAuthority(deps, ctx);
|
|
2372
2296
|
const { target, binding } = authority;
|
|
2373
2297
|
if (!target) return "Cannot steer Codex because this command did not include a stable binding identity.";
|
|
@@ -2375,10 +2299,7 @@ async function steerConversationTurn(deps, ctx, pluginConfig, message) {
|
|
|
2375
2299
|
identity: target.identity,
|
|
2376
2300
|
binding,
|
|
2377
2301
|
message,
|
|
2378
|
-
|
|
2379
|
-
agentDir: target.agentDir,
|
|
2380
|
-
config: ctx.config,
|
|
2381
|
-
assertCurrent: authority.assertCurrent
|
|
2302
|
+
assertCurrent: authority.assertMutationCurrent
|
|
2382
2303
|
})).message;
|
|
2383
2304
|
}
|
|
2384
2305
|
async function setConversationModel(deps, ctx, pluginConfig, args) {
|
|
@@ -2410,7 +2331,8 @@ async function setConversationModel(deps, ctx, pluginConfig, args) {
|
|
|
2410
2331
|
config: ctx.config,
|
|
2411
2332
|
binding,
|
|
2412
2333
|
storePath: authority.storePath,
|
|
2413
|
-
assertCurrent: authority.assertCurrent
|
|
2334
|
+
assertCurrent: authority.assertCurrent,
|
|
2335
|
+
assertCommitAllowed: authority.assertMutationCurrent
|
|
2414
2336
|
});
|
|
2415
2337
|
}
|
|
2416
2338
|
async function setConversationFastMode(deps, ctx, args) {
|
|
@@ -2426,7 +2348,7 @@ async function setConversationFastMode(deps, ctx, args) {
|
|
|
2426
2348
|
bindingStore: deps.bindingStore,
|
|
2427
2349
|
binding,
|
|
2428
2350
|
enabled: parsed,
|
|
2429
|
-
assertCurrent: authority.assertCurrent
|
|
2351
|
+
assertCurrent: parsed === void 0 ? authority.assertCurrent : authority.assertMutationCurrent
|
|
2430
2352
|
});
|
|
2431
2353
|
}
|
|
2432
2354
|
async function setConversationPermissions(deps, ctx, args) {
|
|
@@ -2442,7 +2364,7 @@ async function setConversationPermissions(deps, ctx, args) {
|
|
|
2442
2364
|
mode: parsed,
|
|
2443
2365
|
config: ctx.config,
|
|
2444
2366
|
storePath: authority.storePath,
|
|
2445
|
-
assertCurrent: authority.assertHostCurrent,
|
|
2367
|
+
assertCurrent: parsed ? authority.assertHostMutationCurrent : authority.assertHostCurrent,
|
|
2446
2368
|
session: {
|
|
2447
2369
|
agentId: target.agentId,
|
|
2448
2370
|
sessionId: ctx.sessionId,
|
|
@@ -2471,7 +2393,7 @@ async function startThreadAction(deps, ctx, pluginConfig, kind, args) {
|
|
|
2471
2393
|
}
|
|
2472
2394
|
const compactCurrent = ctx.runtimeContext?.compactCurrent;
|
|
2473
2395
|
if (!compactCurrent) return "Codex compaction is unavailable because this command is not bound to a session.";
|
|
2474
|
-
authority.
|
|
2396
|
+
authority.assertMutationCurrent();
|
|
2475
2397
|
const result = await compactCurrent();
|
|
2476
2398
|
return result.compacted ? `Compacted Codex session (${result.tokensAfter ?? "unknown"} tokens after).` : `Codex compaction did not complete: ${formatCodexDisplayText(result.reason ?? "no reason returned")}.`;
|
|
2477
2399
|
}
|
|
@@ -2494,6 +2416,7 @@ async function startThreadAction(deps, ctx, pluginConfig, kind, args) {
|
|
|
2494
2416
|
sessionKey: authority.sessionKey,
|
|
2495
2417
|
storePath: authority.storePath,
|
|
2496
2418
|
assertCurrent: authority.assertCurrent,
|
|
2419
|
+
assertOwnerCurrent: () => assertCodexHostOwnerCurrent(ctx),
|
|
2497
2420
|
...connection.usesSupervisionConnection ? {
|
|
2498
2421
|
startOptions: connection.appServer.start,
|
|
2499
2422
|
beforeRequest: supervisedCommandGuard(deps, target.identity, binding)
|
|
@@ -2569,7 +2492,11 @@ function formatCodexAvailablePlugins(plugins, warnings, query, page) {
|
|
|
2569
2492
|
//#region extensions/codex/src/command-plugins-management.ts
|
|
2570
2493
|
const POLICY_REFRESH_HINT = "Takes effect on your next message.";
|
|
2571
2494
|
const AVAILABLE_USAGE = "Usage: /codex plugins available [query] [--page <positive integer>]. Search text must be at most 100 characters; use -- before literal query text that contains options.";
|
|
2572
|
-
async function handleCodexPluginsSubcommand(
|
|
2495
|
+
async function handleCodexPluginsSubcommand(input, rest, io, runtime) {
|
|
2496
|
+
const ctx = {
|
|
2497
|
+
...input,
|
|
2498
|
+
gatewayClientScopes: input.gatewayClientScopes?.slice()
|
|
2499
|
+
};
|
|
2573
2500
|
const [verb = "list", ...args] = rest;
|
|
2574
2501
|
const normalized = verb.toLowerCase();
|
|
2575
2502
|
if (normalized === "menu") {
|
|
@@ -2635,7 +2562,7 @@ async function handleCodexPluginsSubcommand(ctx, rest, io, runtime) {
|
|
|
2635
2562
|
if (args.length !== 1 || !args[0]) return { text: "Usage: /codex plugins install <plugin>@<marketplace>" };
|
|
2636
2563
|
if (!canMutateCodexHost(ctx)) return { text: "Only an owner or operator.admin gateway client can run /codex plugins install." };
|
|
2637
2564
|
if (!runtime) return { text: "Codex plugin installation is unavailable for this command." };
|
|
2638
|
-
return await installCodexPlugin(args[0], io, runtime);
|
|
2565
|
+
return await installCodexPlugin(args[0], io, runtime, ctx);
|
|
2639
2566
|
}
|
|
2640
2567
|
const target = args[0];
|
|
2641
2568
|
if (normalized === "enable" || normalized === "disable") {
|
|
@@ -2653,6 +2580,7 @@ async function handleCodexPluginsSubcommand(ctx, rest, io, runtime) {
|
|
|
2653
2580
|
if (configured.status === "ambiguous" || configured.status === "mismatched") return { text: describeConfiguredPluginIdentityConflict(target, configured.status) };
|
|
2654
2581
|
if (configured.status === "missing") return { text: `Codex sub-plugin '${formatCodexDisplayText(target)}' is not configured. Run '/codex plugins list' to see configured plugins.` };
|
|
2655
2582
|
const configKey = configured.configKey;
|
|
2583
|
+
assertCodexHostOwnerCurrent(ctx);
|
|
2656
2584
|
await io.mutate((block) => {
|
|
2657
2585
|
if (wantEnabled) block.enabled = true;
|
|
2658
2586
|
block.plugins ??= {};
|
|
@@ -2660,7 +2588,7 @@ async function handleCodexPluginsSubcommand(ctx, rest, io, runtime) {
|
|
|
2660
2588
|
...block.plugins[configKey],
|
|
2661
2589
|
enabled: wantEnabled
|
|
2662
2590
|
};
|
|
2663
|
-
});
|
|
2591
|
+
}, () => assertCodexHostOwnerCurrent(ctx));
|
|
2664
2592
|
return { text: `${formatCodexDisplayText(configKey)}: ${wantEnabled ? "enabled" : "disabled"} in openclaw.json. ${POLICY_REFRESH_HINT}` };
|
|
2665
2593
|
}
|
|
2666
2594
|
return { text: `Unknown /codex plugins subcommand: ${formatCodexDisplayText(verb)}\n\n${buildPluginsHelp()}` };
|
|
@@ -2766,7 +2694,7 @@ function buildPluginsHelp() {
|
|
|
2766
2694
|
"Only an owner or operator.admin can discover, inspect, refresh hosted apps, install, enable, or disable plugins."
|
|
2767
2695
|
].join("\n");
|
|
2768
2696
|
}
|
|
2769
|
-
async function installCodexPlugin(requestedId, io, runtime) {
|
|
2697
|
+
async function installCodexPlugin(requestedId, io, runtime, ctx) {
|
|
2770
2698
|
const requested = parseCodexPluginMarketplaceId(requestedId);
|
|
2771
2699
|
if (!requested) return { text: "Invalid plugin identifier. Use /codex plugins install <plugin>@<marketplace>. Both names allow ASCII letters, digits, underscores, and hyphens. Plugin names may also contain dots between nonempty segments." };
|
|
2772
2700
|
let plugin;
|
|
@@ -2808,6 +2736,7 @@ async function installCodexPlugin(requestedId, io, runtime) {
|
|
|
2808
2736
|
} : void 0;
|
|
2809
2737
|
if (!requestParams) return { text: `${formatCodexDisplayText(requestedId)} cannot be installed because its marketplace did not provide a trusted local path or remote plugin identifier.` };
|
|
2810
2738
|
try {
|
|
2739
|
+
assertCodexHostOwnerCurrent(ctx);
|
|
2811
2740
|
result = await runtime.install(requestParams);
|
|
2812
2741
|
} catch (error) {
|
|
2813
2742
|
return { text: `Could not install ${formatCodexDisplayText(requestedId)}: ${formatCodexDisplayText(errorMessage(error))}` };
|
|
@@ -2815,6 +2744,7 @@ async function installCodexPlugin(requestedId, io, runtime) {
|
|
|
2815
2744
|
}
|
|
2816
2745
|
const selectedPlugin = plugin;
|
|
2817
2746
|
try {
|
|
2747
|
+
assertCodexHostOwnerCurrent(ctx);
|
|
2818
2748
|
await io.mutate((block) => {
|
|
2819
2749
|
block.plugins ??= {};
|
|
2820
2750
|
const configured = resolveInstalledPluginKey(block.plugins, selectedPlugin);
|
|
@@ -2831,7 +2761,7 @@ async function installCodexPlugin(requestedId, io, runtime) {
|
|
|
2831
2761
|
pluginName: existing?.pluginName ?? (curated ? selectedPlugin.pluginName : persistedPluginName(selectedPlugin))
|
|
2832
2762
|
};
|
|
2833
2763
|
block.plugins[configKey] = updated;
|
|
2834
|
-
});
|
|
2764
|
+
}, () => assertCodexHostOwnerCurrent(ctx));
|
|
2835
2765
|
} catch (error) {
|
|
2836
2766
|
return { text: `${formatCodexDisplayText(requestedId)} was installed in Codex but could not be authorized in OpenClaw and will not be exposed: ${formatCodexDisplayText(errorMessage(error))}` };
|
|
2837
2767
|
}
|
|
@@ -2935,7 +2865,11 @@ function formatPluginList(plugins, options = {}) {
|
|
|
2935
2865
|
//#region extensions/codex/src/command-plugins-runtime.ts
|
|
2936
2866
|
const SCOPE_CHANGED_MESSAGE = "Codex account, conversation, or plugin policy changed. Run the command again.";
|
|
2937
2867
|
async function withCodexPluginCommandContext(params, run) {
|
|
2938
|
-
const { deps,
|
|
2868
|
+
const { deps, pluginConfig } = params;
|
|
2869
|
+
const ctx = {
|
|
2870
|
+
...params.ctx,
|
|
2871
|
+
gatewayClientScopes: params.ctx.gatewayClientScopes?.slice()
|
|
2872
|
+
};
|
|
2939
2873
|
const current = await deps.codexPluginsManagementIo?.readConfig() ?? {};
|
|
2940
2874
|
const initialPolicy = JSON.stringify(current);
|
|
2941
2875
|
const { scope, target, binding } = await resolveCommandAppServerContext(deps, ctx, pluginConfig);
|
|
@@ -3016,7 +2950,10 @@ async function withCodexPluginCommandContext(params, run) {
|
|
|
3016
2950
|
const response = await request({
|
|
3017
2951
|
method,
|
|
3018
2952
|
requestParams,
|
|
3019
|
-
assertCurrent
|
|
2953
|
+
assertCurrent: () => {
|
|
2954
|
+
assertCurrent();
|
|
2955
|
+
assertCodexHostOwnerCurrent(ctx);
|
|
2956
|
+
}
|
|
3020
2957
|
});
|
|
3021
2958
|
await validateCurrent();
|
|
3022
2959
|
return response;
|
|
@@ -3099,7 +3036,8 @@ async function handleCodexSubcommand(ctx, options) {
|
|
|
3099
3036
|
const scope = await getAppServerScope();
|
|
3100
3037
|
return await deps.codexControlRequest(options.pluginConfig, CODEX_CONTROL_METHODS.installPlugin, requestParams, {
|
|
3101
3038
|
...scope,
|
|
3102
|
-
config: ctx.config
|
|
3039
|
+
config: ctx.config,
|
|
3040
|
+
assertOwnerCurrent: () => assertCodexHostOwnerCurrent(ctx)
|
|
3103
3041
|
});
|
|
3104
3042
|
},
|
|
3105
3043
|
refresh: async (workspaceDir) => {
|
|
@@ -3132,7 +3070,6 @@ async function handleCodexSubcommand(ctx, options) {
|
|
|
3132
3070
|
appServerVersion: client.getServerVersion(),
|
|
3133
3071
|
runtimeIdentity: client.getRuntimeIdentity()
|
|
3134
3072
|
});
|
|
3135
|
-
defaultCodexPluginMetadataCache.invalidate(appCacheKey);
|
|
3136
3073
|
return await refreshCodexPluginRuntimeState({
|
|
3137
3074
|
configCwd: workspaceDir,
|
|
3138
3075
|
appCache: defaultCodexAppInventoryCache,
|
|
@@ -3177,9 +3114,9 @@ async function handleCodexSubcommand(ctx, options) {
|
|
|
3177
3114
|
}
|
|
3178
3115
|
if (normalized === "stop") {
|
|
3179
3116
|
if (rest.length > 0) return { text: "Usage: /codex stop" };
|
|
3180
|
-
return { text: await stopConversationTurn(deps, ctx
|
|
3117
|
+
return { text: await stopConversationTurn(deps, ctx) };
|
|
3181
3118
|
}
|
|
3182
|
-
if (normalized === "steer") return { text: await steerConversationTurn(deps, ctx,
|
|
3119
|
+
if (normalized === "steer") return { text: await steerConversationTurn(deps, ctx, rest.join(" ")) };
|
|
3183
3120
|
if (normalized === "model") return { text: await setConversationModel(deps, ctx, options.pluginConfig, rest) };
|
|
3184
3121
|
if (normalized === "fast") {
|
|
3185
3122
|
if (isMenuVerb(rest)) return buildCodexFastMenuReply();
|
|
@@ -3223,6 +3160,7 @@ async function handleCodexSubcommand(ctx, options) {
|
|
|
3223
3160
|
return { text: formatAccount(account, limits, await readCodexAccountAuthOverview({
|
|
3224
3161
|
ctx,
|
|
3225
3162
|
agentDir: scope.agentDir,
|
|
3163
|
+
authProfileId: scope.authProfileId,
|
|
3226
3164
|
pluginConfig: options.pluginConfig,
|
|
3227
3165
|
safeCodexControlRequest: deps.safeCodexControlRequest,
|
|
3228
3166
|
account,
|
|
@@ -3234,11 +3172,7 @@ async function handleCodexSubcommand(ctx, options) {
|
|
|
3234
3172
|
function resolvePluginRuntimeRefreshMethod(method) {
|
|
3235
3173
|
const recognized = [
|
|
3236
3174
|
CODEX_CONTROL_METHODS.listPlugins,
|
|
3237
|
-
CODEX_CONTROL_METHODS.listSkills,
|
|
3238
|
-
CODEX_CONTROL_METHODS.listHooks,
|
|
3239
|
-
CODEX_CONTROL_METHODS.reloadMcpServers,
|
|
3240
3175
|
CODEX_CONTROL_METHODS.installedApps,
|
|
3241
|
-
CODEX_CONTROL_METHODS.listApps,
|
|
3242
3176
|
CODEX_CONTROL_METHODS.readApps
|
|
3243
3177
|
].find((candidate) => candidate === method);
|
|
3244
3178
|
if (!recognized) throw new Error(`Unexpected Codex plugin refresh method: ${method}`);
|