@openclaw/codex 2026.9.1 → 2026.9.3

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.
Files changed (109) hide show
  1. package/README.md +2 -0
  2. package/dist/api.js +18 -23
  3. package/dist/apply-B6el6hdO.js +357 -0
  4. package/dist/{attempt-client-cleanup-DYHcRQAa.js → attempt-client-cleanup-D6cR54TV.js} +113 -49
  5. package/dist/{attempt-context-DmQUNWwT.js → attempt-context-AO4DSjE0.js} +11 -9
  6. package/dist/{event-projector-usage-C5mcrGjp.js → attempt-notifications--H8zXR5-.js} +3 -89
  7. package/dist/auth-cache-key-Kq6oerr6.js +498 -0
  8. package/dist/auth-profile-CwzO4_RG.js +43 -0
  9. package/dist/auth-profile-selection-DFu9e167.js +45 -0
  10. package/dist/{binding-connection-E6uDsPlx.js → binding-connection-QqgcPCgk.js} +18 -3
  11. package/dist/{bounded-turn-wzJrwKKe.js → bounded-turn-lRpmZHFv.js} +54 -150
  12. package/dist/build-state-6RL6qohz.js +19 -0
  13. package/dist/{capabilities-dIjNVCYH.js → capabilities-BeqLPbtM.js} +2 -1
  14. package/dist/cli-metadata.js +1 -1
  15. package/dist/client-BEKu4yDx.js +3983 -0
  16. package/dist/command-dispatch-CisT9Jqq.js +21 -0
  17. package/dist/{command-formatters-CLHhEB1Q.js → command-formatters-DeTfrapr.js} +2 -2
  18. package/dist/{command-handlers-CTGb2csu.js → command-handlers-BfIsJEuA.js} +158 -76
  19. package/dist/command-rpc-BMqRQOFX.js +226 -0
  20. package/dist/{compact-_t0HQrUS.js → compact-CGJZ2rlb.js} +89 -49
  21. package/dist/config-JDfTI4VI.js +106 -0
  22. package/dist/{config-BhmfC1s6.js → config-options-jnIFvwxD.js} +208 -654
  23. package/dist/config-runtime-BWf6JLWG.js +11 -0
  24. package/dist/config-utils-C57JiJrU.js +69 -0
  25. package/dist/conversation-binding-CxOlHiix.js +889 -0
  26. package/dist/{plugin-marketplace-discovery-CfFlKqDl.js → conversation-control-CUCrSIQI.js} +36 -155
  27. package/dist/doctor-contract-api.js +8 -9
  28. package/dist/{dynamic-tools-BU9tmlYm.js → dynamic-tools-D-JBoaLt.js} +734 -698
  29. package/dist/{effective-mcp-catalog-DzYBW4h1.js → effective-mcp-catalog-J_5Ep5Um.js} +4 -3
  30. package/dist/{elicitation-input-DMkeki8d.js → elicitation-input-DPoK8F7w.js} +8 -22
  31. package/dist/ephemeral-turn-DSwzP8YY.js +101 -0
  32. package/dist/{event-projector-assistant-message-DHRFXKbS.js → event-projector-assistant-message-BmBM4qBV.js} +23 -27
  33. package/dist/event-projector-usage-CIyrYYid.js +102 -0
  34. package/dist/{harness-DXVZ5II5.js → harness-FR6eQgyO.js} +47 -17
  35. package/dist/harness.js +1 -1
  36. package/dist/history-rejection-B4nOXNXF.js +13 -0
  37. package/dist/{image-payload-sanitizer-CnfoUPCE.js → image-payload-sanitizer-tupAr-2o.js} +29 -15
  38. package/dist/incognito-session-uhrBF6wJ.js +15 -0
  39. package/dist/index.js +413 -2893
  40. package/dist/{isolated-completion-kg9kv4iH.js → isolated-completion-DHBefrzg.js} +12 -21
  41. package/dist/{managed-binary-4-Vjz5GH.js → managed-binary-DrjjRRUD.js} +17 -84
  42. package/dist/managed-thread-store-D1t5jh3G.js +66 -0
  43. package/dist/media-understanding-provider.js +4 -1
  44. package/dist/{model-catalog-CUM68Hkl.js → model-catalog-B_6M04Wo.js} +6 -5
  45. package/dist/{models-sYnEc0gd.js → models-P9k2qAof.js} +4 -4
  46. package/dist/native-execution-policy-umd0tgh4.js +128 -0
  47. package/dist/{native-subagent-monitor-CnH147jH.js → native-subagent-monitor-BbCUKRwC.js} +76 -48
  48. package/dist/node-cli-sessions-rj0ysJwM.js +527 -0
  49. package/dist/{node-exec-server.runtime-CstNHCmC.js → node-exec-server.runtime-BY_ctYnT.js} +54 -23
  50. package/dist/plan-BMJdMOEF.js +711 -0
  51. package/dist/plugin-activation-BQK-f5sV.js +133 -0
  52. package/dist/{thread-resume-C7pyVKeW.js → plugin-app-cache-key-CdSQzWyX.js} +5 -53
  53. package/dist/{plugin-approval-roundtrip-CNe-Xrjx.js → plugin-approval-roundtrip-DeW95wB5.js} +1 -1
  54. package/dist/plugin-inventory-CoRCzWW4.js +325 -0
  55. package/dist/plugin-marketplace-discovery-3akBizzF.js +134 -0
  56. package/dist/{plugin-metadata-cache-BFrPhb2c.js → plugin-metadata-cache-DgNfRAGA.js} +13 -9
  57. package/dist/protocol-CAAcVIKF.js +275 -0
  58. package/dist/{provider-capabilities-DW5p4k9w.js → provider-capabilities-W4tfK5Y5.js} +2 -2
  59. package/dist/{rate-limits-CawQJfUS.js → rate-limits-Bqnx1N4z.js} +1 -1
  60. package/dist/request-CGvGOpeR.js +198 -0
  61. package/dist/{run-attempt-D1hJO4fX.js → run-attempt-DwKds3DN.js} +1498 -1028
  62. package/dist/{runtime-artifact-C3jVimFn.js → runtime-artifact-T-NwqeSH.js} +28 -28
  63. package/dist/sandbox-guard-BcT66fWy.js +165 -0
  64. package/dist/{session-binding-BHuTCRZQ.js → session-binding-CKSepwIC.js} +118 -324
  65. package/dist/session-binding-record-CaZjYwNS.js +256 -0
  66. package/dist/session-catalog-HaDcp7Sv.js +1533 -0
  67. package/dist/session-catalog-adoption-BKLtSrwi.js +251 -0
  68. package/dist/session-catalog-archive-D0i2pGj2.js +56 -0
  69. package/dist/session-catalog-home-id-D7-aLiNt.js +190 -0
  70. package/dist/session-catalog-node-adoption-BUuDYY8R.js +182 -0
  71. package/dist/session-catalog-node-continue-CBtc4wkI.js +238 -0
  72. package/dist/session-catalog-parsing-CdD3JhdM.js +280 -0
  73. package/dist/session-catalog-provenance-DkJHo735.js +124 -0
  74. package/dist/{session-cli-CmFEXMAM.js → session-cli-CbgaHh0f.js} +3 -2
  75. package/dist/session-history-Cz-tOOYj.js +96 -0
  76. package/dist/{session-upstream-marker-C351-5Qw.js → session-history-import-DFN7sWRU.js} +5 -49
  77. package/dist/session-history-read-cxPUxyVV.js +50 -0
  78. package/dist/session-history-worker-runtime.js +60 -0
  79. package/dist/{settled-turn-context-D3SNWtUn.js → session-history.worker-CNEvGaU5.js} +75 -69
  80. package/dist/session-history.worker.js +2 -0
  81. package/dist/{session-initialization-BeWzjGiR.js → session-initialization-Jo86C60I.js} +2 -1
  82. package/dist/{session-permission-policy-DeWVTCMj.js → session-permission-policy-B22InTp_.js} +4 -7
  83. package/dist/{session-retirement-BujDjXVF.js → session-retirement-BSNG_mhf.js} +8 -7
  84. package/dist/session-upstream-marker-D15C9NHp.js +46 -0
  85. package/dist/settled-turn-context-Du6gdUDd.js +45 -0
  86. package/dist/{settled-turn-finalizer-BVJx4yoc.js → settled-turn-finalizer-BuLUrZl2.js} +54 -42
  87. package/dist/shared-client-CVhez2Uo.js +2911 -0
  88. package/dist/{side-question-BTZAII4l.js → side-question-DLbr2vUU.js} +135 -191
  89. package/dist/source-Da-h6f7e.js +518 -0
  90. package/dist/thread-archive-guard-D1bP04Tf.js +53 -0
  91. package/dist/{thread-lifecycle-DAcEJ_Om.js → thread-lifecycle-D1pzRwHB.js} +467 -977
  92. package/dist/{thread-ownership-zGokd8i1.js → thread-ownership-D6oASVRu.js} +15 -17
  93. package/dist/{thread-policy-g4KbJPzp.js → thread-policy-D8kI7yAO.js} +2 -2
  94. package/dist/thread-resume-T5cveyxA.js +52 -0
  95. package/dist/timeout-BVw8aaM1.js +33 -0
  96. package/dist/transcript-mirror-attestation-DibE0krH.js +89 -0
  97. package/dist/{transcript-mirror-DTUxFWa_.js → transcript-mirror-t5TOccct.js} +111 -379
  98. package/dist/{transport-stdio-CyPldczm.js → transport-stdio-BGjHoYLr.js} +80 -48
  99. package/dist/{upstream-session-fork-CYlBIGVt.js → upstream-session-fork-De-sLJ2r.js} +94 -166
  100. package/dist/{usage-Bj-rrzkR.js → usage-CPPTmBvZ.js} +4 -3
  101. package/dist/version-omm6IPI3.js +12 -0
  102. package/dist/{web-search-provider.runtime-D2FWSK4w.js → web-search-provider.runtime-CSVgQL0w.js} +3 -3
  103. package/openclaw.plugin.json +22 -1
  104. package/package.json +6 -6
  105. package/dist/request-DYAI5FQE.js +0 -475
  106. package/dist/session-catalog-yyvTWFOw.js +0 -3120
  107. package/dist/session-history-C5J1AKzG.js +0 -87
  108. package/dist/shared-client-DxcfF9KX.js +0 -7494
  109. package/dist/{auth-binding-Ds_QVm-X.js → auth-binding-Co2Vfcf_.js} +1 -1
@@ -0,0 +1,21 @@
1
+ import { a as formatCodexDisplayText } from "./command-formatters-DeTfrapr.js";
2
+ import { n as describeControlFailure } from "./capabilities-BeqLPbtM.js";
3
+ //#region extensions/codex/src/command-dispatch.ts
4
+ /** Dispatches a `/codex` command to the lazily loaded handler. */
5
+ async function handleCodexCommand(ctx, options) {
6
+ const { loadSubcommandHandler, resolvePluginConfig, ...subcommandOptions } = options;
7
+ try {
8
+ return await (loadSubcommandHandler ? await loadSubcommandHandler() : await loadDefaultCodexSubcommandHandler())(ctx, {
9
+ ...subcommandOptions,
10
+ pluginConfig: resolvePluginConfig?.() ?? subcommandOptions.pluginConfig
11
+ });
12
+ } catch (error) {
13
+ return { text: `Codex command failed: ${formatCodexDisplayText(describeControlFailure(error))}` };
14
+ }
15
+ }
16
+ async function loadDefaultCodexSubcommandHandler() {
17
+ const { handleCodexSubcommand } = await import("./command-handlers-BfIsJEuA.js");
18
+ return handleCodexSubcommand;
19
+ }
20
+ //#endregion
21
+ export { handleCodexCommand };
@@ -1,5 +1,5 @@
1
- import { $t as isJsonObject } from "./shared-client-DxcfF9KX.js";
2
- import { c as summarizeCodexRateLimits, o as summarizeCodexAccountRateLimits, r as hasCodexRateLimitSnapshots } from "./rate-limits-CawQJfUS.js";
1
+ import { o as isJsonObject } from "./protocol-CAAcVIKF.js";
2
+ import { c as summarizeCodexRateLimits, o as summarizeCodexAccountRateLimits, r as hasCodexRateLimitSnapshots } from "./rate-limits-Bqnx1N4z.js";
3
3
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  //#region extensions/codex/src/command-formatters.ts
5
5
  /**
@@ -1,32 +1,43 @@
1
- import { $ as assertCodexThreadResumeResponse, $t as isJsonObject, Bt as resolveCodexAppServerAuthProfileIdForAgent, Ht as resolveCodexAppServerFallbackApiKeyCacheKey, Rt as resolveCodexAppServerAuthAccountCacheKey, St as consumeCodexAppServerLiveThread, X as assertCodexThreadAcceptsDirectInput, c as getLeasedSharedCodexAppServerClient, h as releaseLeasedSharedCodexAppServerClient, wt as hasCodexAppServerLiveThread } from "./shared-client-DxcfF9KX.js";
2
- import { A as isCodexFastServiceTier, M as CODEX_PLUGINS_MARKETPLACE_NAME, i as resolveCodexAppServerRuntimeOptions } from "./config-BhmfC1s6.js";
3
- import { c as reclaimCurrentCodexSessionGeneration, d as sessionBindingIdentity, i as createCodexSessionGenerationSupersededError, n as assertCodexBindingMayBeReplaced, r as bindingStoreKey, s as normalizeCodexAppServerBindingModelProvider } from "./session-binding-BHuTCRZQ.js";
4
- import { a as closeCodexStartupClientBestEffort } from "./attempt-client-cleanup-DYHcRQAa.js";
5
- import { t as listAllCodexAppServerModels } from "./models-sYnEc0gd.js";
6
- import { i as buildCodexPluginAppCacheKey, s as defaultCodexAppInventoryCache } from "./thread-resume-C7pyVKeW.js";
7
- import { At as refreshCodexPluginRuntimeState, Mt as isOpenAiCuratedMarketplaceName } from "./thread-lifecycle-DAcEJ_Om.js";
8
- import { a as rollbackCodexAppServerBindingSubscription, c as withExclusiveCodexAppServerThread, i as retireCodexConversationThreadBinding, l as isIncognitoSessionKey, n as releaseCodexAppServerBindingSubscription, r as retainCodexAppServerBindingSubscription, s as withCodexConversationThreadActivity, t as isSameCodexAppServerThreadOwner } from "./thread-ownership-zGokd8i1.js";
9
- import { c as resolveCodexNativeSandboxBlock, s as resolveCodexNativeExecutionBlock } from "./request-DYAI5FQE.js";
10
- import { r as assertCodexSupervisionThreadLineage } from "./thread-policy-g4KbJPzp.js";
11
- import { t as CODEX_CONTROL_METHODS } from "./capabilities-dIjNVCYH.js";
12
- import { s as summarizeCodexAccountUsage } from "./rate-limits-CawQJfUS.js";
13
- import { a as formatCodexDisplayText, c as formatComputerUseStatus, d as formatSkills, f as formatThreads, i as formatAccount, l as formatList, n as buildHelp, o as formatCodexStatus, r as escapeCodexChatText, s as formatCodexTextForDisplay, t as CODEX_RESUME_SAFE_THREAD_ID_PATTERN, u as formatModels } from "./command-formatters-CLHhEB1Q.js";
14
- import { _ as hasCodexAdminScope, a as parseCodexPermissionsModeArg, c as setCodexConversationModel, d as stopCodexConversationTurn, g as canMutateCodexHost, h as CODEX_NATIVE_EXECUTION_AUTH_ERROR, i as parseCodexFastModeArg, l as setCodexConversationPermissions, m as CODEX_HOST_INSPECTION_AUTH_ERROR, n as parseCodexPluginMarketplaceId, o as readCodexConversationActiveTurn, p as CODEX_FULL_PERMISSIONS_AUTH_ERROR, r as formatPermissionsMode, s as setCodexConversationFastMode, t as discoverCodexMarketplacePlugins, u as steerCodexConversationTurn } from "./plugin-marketplace-discovery-CfFlKqDl.js";
1
+ import { m as CODEX_PLUGINS_MARKETPLACE_NAME, n as isCodexFastServiceTier } from "./config-utils-C57JiJrU.js";
2
+ import { l as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced, r as bindingStoreKey } from "./session-binding-record-CaZjYwNS.js";
3
+ import { o as isJsonObject } from "./protocol-CAAcVIKF.js";
4
+ import { _ as assertCodexThreadAcceptsDirectInput, y as assertCodexThreadResumeResponse } from "./client-BEKu4yDx.js";
5
+ import { s as resolveCodexAppServerFallbackApiKeyCacheKey } from "./auth-cache-key-Kq6oerr6.js";
6
+ import { r as withCodexConversationThreadActivity, t as isIncognitoSessionKey } from "./incognito-session-uhrBF6wJ.js";
7
+ import { a as CODEX_NATIVE_EXECUTION_AUTH_ERROR, i as CODEX_HOST_INSPECTION_AUTH_ERROR, n as parseCodexPluginMarketplaceId, o as canMutateCodexHost, r as CODEX_FULL_PERMISSIONS_AUTH_ERROR, s as hasCodexAdminScope, t as discoverCodexMarketplacePlugins } from "./plugin-marketplace-discovery-3akBizzF.js";
8
+ import { s as summarizeCodexAccountUsage } from "./rate-limits-Bqnx1N4z.js";
9
+ import { a as formatCodexDisplayText, c as formatComputerUseStatus, d as formatSkills, f as formatThreads, i as formatAccount, l as formatList, n as buildHelp, o as formatCodexStatus, r as escapeCodexChatText, s as formatCodexTextForDisplay, t as CODEX_RESUME_SAFE_THREAD_ID_PATTERN, u as formatModels } from "./command-formatters-DeTfrapr.js";
15
10
  import { i as readCodexConversationBindingData, n as createCodexCliNodeConversationBindingData, o as resolveCodexDefaultWorkspaceDir, r as createCodexConversationBindingData } from "./conversation-binding-data-BiodpIzq.js";
16
- import { n as resolveCodexBindingAppServerConnection } from "./binding-connection-E6uDsPlx.js";
17
- import { c as readCodexStatusProbes, l as requestOptions, p as formatCodexCliSessions, s as codexControlRequest, u as safeCodexControlRequest } from "./session-catalog-yyvTWFOw.js";
18
- import { i as readCodexComputerUseStatus, r as installCodexComputerUse, t as defaultCodexPluginMetadataCache } from "./plugin-metadata-cache-BFrPhb2c.js";
11
+ import { t as CODEX_CONTROL_METHODS } from "./capabilities-BeqLPbtM.js";
12
+ import { i as formatCodexCliSessions } from "./node-cli-sessions-rj0ysJwM.js";
13
+ import { r as buildCodexPluginAppCacheKey, s as defaultCodexAppInventoryCache } from "./plugin-app-cache-key-CdSQzWyX.js";
14
+ import "./config-JDfTI4VI.js";
15
+ import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-BWf6JLWG.js";
16
+ import { i as resolveCodexBindingAppServerConnection } from "./binding-connection-QqgcPCgk.js";
17
+ import { i as resolveCodexAppServerAuthProfileIdForAgent, n as normalizeCodexAppServerBindingModelProvider } from "./auth-profile-CwzO4_RG.js";
18
+ import { L as hasCodexAppServerLiveThread, P as consumeCodexAppServerLiveThread, X as resolveCodexAppServerAuthAccountCacheKey, c as getLeasedSharedCodexAppServerClient, h as releaseLeasedSharedCodexAppServerClient } from "./shared-client-CVhez2Uo.js";
19
+ import { a as closeCodexStartupClientBestEffort } from "./attempt-client-cleanup-D6cR54TV.js";
20
+ import { t as listAllCodexAppServerModels } from "./models-P9k2qAof.js";
21
+ import { r as isOpenAiCuratedMarketplaceName } from "./plugin-inventory-CoRCzWW4.js";
22
+ import { n as refreshCodexPluginRuntimeState } from "./plugin-activation-BQK-f5sV.js";
23
+ import { n as createCodexSessionGenerationSupersededError, o as resolveCodexSessionBinding } from "./session-binding-CKSepwIC.js";
24
+ import { r as assertCodexSupervisionThreadLineage } from "./thread-policy-D8kI7yAO.js";
25
+ import { a as rollbackCodexAppServerBindingSubscription, i as retireCodexConversationThreadBinding, n as releaseCodexAppServerBindingSubscription, r as retainCodexAppServerBindingSubscription, s as withExclusiveCodexAppServerThread, t as isSameCodexAppServerThreadOwner } from "./thread-ownership-D6oASVRu.js";
26
+ import { n as resolveCodexNativeSandboxBlock, t as resolveCodexNativeExecutionBlock } from "./sandbox-guard-BcT66fWy.js";
27
+ import { i as readCodexComputerUseStatus, r as installCodexComputerUse, t as defaultCodexPluginMetadataCache } from "./plugin-metadata-cache-DgNfRAGA.js";
28
+ import { a as safeCodexControlRequest, i as requestOptions, r as readCodexStatusProbes, t as codexControlRequest } from "./command-rpc-BMqRQOFX.js";
29
+ 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-CUCrSIQI.js";
19
30
  import { normalizeOptionalString, normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
20
- import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
21
31
  import crypto from "node:crypto";
22
- import { isDeepStrictEqual } from "node:util";
23
- import { ensureAuthProfileStore, resolveAgentDir, resolveAuthProfileEligibility, resolveProfileUnusableUntilForDisplay } from "openclaw/plugin-sdk/agent-runtime";
24
- import { findNormalizedProviderValue, resolveAuthProfileOrder } from "openclaw/plugin-sdk/provider-auth";
25
32
  import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
26
- import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
27
- import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
33
+ import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
28
34
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
35
+ import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
36
+ import { isDeepStrictEqual } from "node:util";
37
+ import { ensureAuthProfileStore, resolveAgentDir as resolveAgentDir$1, resolveAuthProfileEligibility, resolveProfileUnusableUntilForDisplay } from "openclaw/plugin-sdk/agent-runtime";
29
38
  import { parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
39
+ import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
40
+ import { findNormalizedProviderValue, resolveAuthProfileOrder } from "openclaw/plugin-sdk/provider-auth";
30
41
  import { MODEL_SELECTION_LOCKED_MESSAGE, isModelSelectionLocked, resolvePersistedSessionRuntimeId } from "openclaw/plugin-sdk/model-session-runtime";
31
42
  //#region extensions/codex/src/command-account.ts
32
43
  const OPENAI_PROVIDER_ID = "openai";
@@ -1065,11 +1076,56 @@ async function resolveControlTarget(ctx) {
1065
1076
  agentDir: scope.agentDir
1066
1077
  } : void 0;
1067
1078
  }
1068
- async function resolveCommandAppServerScope(deps, ctx, pluginConfig) {
1079
+ async function resolvePreparedCodexCommandAuthority(deps, ctx) {
1069
1080
  const target = await resolveControlTarget(ctx);
1070
1081
  const fallback = resolveCodexConversationControlScope(ctx);
1082
+ const sessionId = ctx.sessionId;
1083
+ const sessionKey = ctx.sessionKey;
1084
+ const sessionAgentId = ctx.sessionTarget?.agentId ?? fallback.agentId;
1085
+ const storePath = ctx.sessionTarget?.storePath ?? (sessionKey ? resolveStorePath(ctx.config.session?.store, { agentId: sessionAgentId }) : void 0);
1086
+ const sessionIdentity = sessionId ? sessionBindingIdentity({
1087
+ sessionId,
1088
+ sessionKey,
1089
+ agentId: sessionAgentId,
1090
+ config: ctx.config
1091
+ }) : void 0;
1092
+ const currentSession = sessionIdentity ? await resolveCodexSessionBinding({
1093
+ reclaimStale: true,
1094
+ bindingStore: deps.bindingStore,
1095
+ identity: sessionIdentity,
1096
+ config: ctx.config,
1097
+ storePath
1098
+ }) : void 0;
1099
+ const assertHostCurrent = currentSession?.assertCurrent ?? (() => {});
1100
+ const binding = (target && (!sessionIdentity || !isDeepStrictEqual(target.identity, sessionIdentity)) ? await resolveCodexSessionBinding({
1101
+ bindingStore: deps.bindingStore,
1102
+ identity: target.identity,
1103
+ config: ctx.config,
1104
+ storePath,
1105
+ assertCurrent: assertHostCurrent
1106
+ }) : currentSession)?.binding;
1107
+ const assertCurrent = () => {
1108
+ assertHostCurrent();
1109
+ if (target && !isDeepStrictEqual(deps.bindingStore.read(target.identity), binding)) throw new Error("Codex command binding changed before dispatch");
1110
+ assertHostCurrent();
1111
+ };
1112
+ assertCurrent();
1113
+ return {
1114
+ target,
1115
+ binding,
1116
+ currentSessionBinding: currentSession?.binding,
1117
+ sessionId,
1118
+ sessionKey,
1119
+ storePath,
1120
+ assertHostCurrent,
1121
+ assertCurrent
1122
+ };
1123
+ }
1124
+ async function resolveCommandAppServerScope(deps, ctx, pluginConfig) {
1125
+ const authority = await resolvePreparedCodexCommandAuthority(deps, ctx);
1126
+ const { target, binding } = authority;
1127
+ const fallback = resolveCodexConversationControlScope(ctx);
1071
1128
  const agentDir = target?.agentDir ?? fallback.agentDir;
1072
- const binding = target ? await deps.bindingStore.read(target.identity) : void 0;
1073
1129
  const authProfileId = binding?.connectionScope === "supervision" ? void 0 : resolveCodexAppServerAuthProfileIdForAgent({
1074
1130
  authProfileId: binding?.authProfileId ?? target?.requestedAuthProfileId,
1075
1131
  agentDir,
@@ -1085,8 +1141,10 @@ async function resolveCommandAppServerScope(deps, ctx, pluginConfig) {
1085
1141
  agentDir,
1086
1142
  ...connection.clientAuthProfileId !== void 0 ? { authProfileId: connection.clientAuthProfileId } : {},
1087
1143
  ...connection.usesSupervisionConnection ? { startOptions: connection.appServer.start } : {},
1088
- ...ctx.sessionKey ? { sessionKey: ctx.sessionKey } : {},
1089
- ...ctx.sessionId ? { sessionId: ctx.sessionId } : {}
1144
+ ...authority.sessionKey ? { sessionKey: authority.sessionKey } : {},
1145
+ ...authority.sessionId ? { sessionId: authority.sessionId } : {},
1146
+ ...authority.storePath ? { storePath: authority.storePath } : {},
1147
+ assertCurrent: authority.assertCurrent
1090
1148
  };
1091
1149
  }
1092
1150
  function conversationBindingIdentity(bindingId) {
@@ -1103,7 +1161,7 @@ function resolveCodexConversationControlScope(ctx) {
1103
1161
  });
1104
1162
  return {
1105
1163
  agentId: sessionAgentId,
1106
- agentDir: resolveAgentDir(ctx.config, sessionAgentId)
1164
+ agentDir: resolveAgentDir$1(ctx.config, sessionAgentId)
1107
1165
  };
1108
1166
  }
1109
1167
  //#endregion
@@ -1200,7 +1258,7 @@ async function confirmCodexDiagnosticsFeedback(deps, ctx, pluginConfig, token) {
1200
1258
  if (scopeMismatch) return scopeMismatch.confirmMessage;
1201
1259
  deletePendingCodexDiagnosticsConfirmation(token);
1202
1260
  if (!pending.privateRouted && !await hasAnyCodexDiagnosticsIdentity(ctx)) return "Cannot send Codex diagnostics because this command did not include a stable session identity.";
1203
- const currentTargets = pending.privateRouted ? await resolvePendingCodexDiagnosticsTargets(deps, pending.targets, ctx.config) : await resolveCodexDiagnosticsTargets(deps, ctx);
1261
+ const currentTargets = pending.privateRouted ? resolvePendingCodexDiagnosticsTargets(deps, pending.targets, ctx.config) : await resolveCodexDiagnosticsTargets(deps, ctx);
1204
1262
  if (!codexDiagnosticsTargetsMatch(pending.targets, currentTargets)) return "The Codex diagnostics sessions changed before confirmation. Run /diagnostics again for the current threads.";
1205
1263
  return await sendCodexDiagnosticsFeedbackForTargets(deps, ctx, pluginConfig, pending.note ?? "", currentTargets, { cooldownScope: pending.scopeKey });
1206
1264
  }
@@ -1307,7 +1365,7 @@ async function resolveCodexDiagnosticsTargets(deps, ctx) {
1307
1365
  });
1308
1366
  candidates.push({
1309
1367
  identity,
1310
- agentDir: resolveAgentDir(ctx.config, identity.agentId),
1368
+ agentDir: resolveAgentDir$1(ctx.config, identity.agentId),
1311
1369
  sessionKey: session.sessionKey,
1312
1370
  sessionId: session.sessionId,
1313
1371
  channel: session.channel,
@@ -1324,17 +1382,17 @@ async function resolveCodexDiagnosticsTargets(deps, ctx) {
1324
1382
  const key = bindingStoreKey(candidate.identity);
1325
1383
  if (seenBindingKeys.has(key)) continue;
1326
1384
  seenBindingKeys.add(key);
1327
- const binding = await deps.bindingStore.read(candidate.identity);
1385
+ const binding = deps.bindingStore.read(candidate.identity);
1328
1386
  if (!binding?.threadId || seenThreadIds.has(binding.threadId)) continue;
1329
1387
  seenThreadIds.add(binding.threadId);
1330
1388
  targets.push(resolveCodexDiagnosticsTarget(candidate, binding, ctx.config));
1331
1389
  }
1332
1390
  return targets;
1333
1391
  }
1334
- async function resolvePendingCodexDiagnosticsTargets(deps, targets, config) {
1392
+ function resolvePendingCodexDiagnosticsTargets(deps, targets, config) {
1335
1393
  const resolved = [];
1336
1394
  for (const target of targets) {
1337
- const binding = await deps.bindingStore.read(target.identity);
1395
+ const binding = deps.bindingStore.read(target.identity);
1338
1396
  if (!binding?.threadId) continue;
1339
1397
  resolved.push(resolveCodexDiagnosticsTarget(target, binding, config));
1340
1398
  }
@@ -1376,7 +1434,7 @@ function isCurrentSessionModelSelectionLocked(ctx) {
1376
1434
  const sessionKey = ctx.sessionKey?.trim();
1377
1435
  if (!sessionKey) return false;
1378
1436
  const { agentId } = resolveCodexConversationControlScope(ctx);
1379
- const storePath = resolveStorePath(ctx.config.session?.store, { agentId });
1437
+ const storePath = ctx.sessionTarget?.storePath ?? resolveStorePath(ctx.config.session?.store, { agentId });
1380
1438
  return isModelSelectionLocked(getSessionEntry({
1381
1439
  storePath,
1382
1440
  sessionKey,
@@ -1400,7 +1458,7 @@ async function bindConversation(deps, ctx, pluginConfig, args) {
1400
1458
  config: ctx.config
1401
1459
  }) : void 0;
1402
1460
  const currentOwner = currentConversationData?.kind === "codex-app-server-session" ? conversationBindingIdentity(currentConversationData.bindingId) : sessionOwner;
1403
- const existingBinding = currentOwner ? await deps.bindingStore.read(currentOwner) : void 0;
1461
+ const existingBinding = currentOwner ? deps.bindingStore.read(currentOwner) : void 0;
1404
1462
  assertCodexBindingMayBeReplaced(existingBinding, "binding this conversation to another thread");
1405
1463
  const sessionSource = sessionOwner && existingBinding ? {
1406
1464
  agentId: sessionOwner.agentId,
@@ -1442,7 +1500,7 @@ async function detachConversation(deps, ctx) {
1442
1500
  let expectedThreadId;
1443
1501
  let expectedStartId;
1444
1502
  if (data?.kind === "codex-app-server-session") {
1445
- const binding = await deps.bindingStore.read(identity);
1503
+ const binding = deps.bindingStore.read(identity);
1446
1504
  assertCodexBindingMayBeReplaced(binding, "detaching its conversation binding");
1447
1505
  if (deps.readCodexConversationActiveTurn(identity)) return "This Codex conversation has an active run; use /codex stop before detaching it.";
1448
1506
  expectedThreadId = binding?.threadId;
@@ -1480,13 +1538,13 @@ async function describeConversationBinding(deps, ctx) {
1480
1538
  "- Active run: not tracked"
1481
1539
  ].join("\n");
1482
1540
  const identity = conversationBindingIdentity(data.bindingId);
1483
- const threadBinding = await deps.bindingStore.read(identity);
1541
+ const threadBinding = deps.bindingStore.read(identity);
1484
1542
  const active = deps.readCodexConversationActiveTurn(identity);
1485
1543
  const sessionKey = ctx.sessionKey?.trim();
1486
1544
  const { agentId } = resolveCodexConversationControlScope(ctx);
1487
1545
  const sessionEntry = sessionKey ? getSessionEntry({
1488
1546
  agentId,
1489
- storePath: resolveStorePath(ctx.config.session?.store, { agentId }),
1547
+ storePath: ctx.sessionTarget?.storePath ?? resolveStorePath(ctx.config.session?.store, { agentId }),
1490
1548
  sessionKey,
1491
1549
  hydrateSkillPromptRefs: false,
1492
1550
  readConsistency: "latest"
@@ -1538,17 +1596,22 @@ async function resumeThread(deps, ctx, pluginConfig, args) {
1538
1596
  agentId: scope.agentId,
1539
1597
  config: ctx.config
1540
1598
  });
1599
+ const { assertCurrent: assertHostGeneration } = await resolveCodexSessionBinding({
1600
+ reclaimStale: true,
1601
+ bindingStore: deps.bindingStore,
1602
+ identity,
1603
+ config: ctx.config,
1604
+ storePath: ctx.sessionTarget?.storePath
1605
+ });
1541
1606
  return await withExclusiveCodexAppServerThread({
1542
1607
  bindingStore: deps.bindingStore,
1543
1608
  identity,
1544
1609
  threadId: normalizedThreadId,
1545
1610
  run: async () => await deps.bindingStore.withLease(identity, async () => {
1546
- if (!await reclaimCurrentCodexSessionGeneration({
1547
- bindingStore: deps.bindingStore,
1548
- identity,
1549
- config: ctx.config
1550
- })) throw createCodexSessionGenerationSupersededError(identity.sessionId);
1551
- const currentBinding = await deps.bindingStore.read(identity);
1611
+ const generation = await deps.bindingStore.prepareSessionGenerationReclaim(identity);
1612
+ assertHostGeneration();
1613
+ if (generation.kind !== "resolved" || !generation.result) throw createCodexSessionGenerationSupersededError(identity.sessionId);
1614
+ const currentBinding = deps.bindingStore.read(identity);
1552
1615
  assertCodexBindingMayBeReplaced(currentBinding, "attaching a different resumed thread");
1553
1616
  let pendingResumeConfiguration = false;
1554
1617
  const commitResumedThread = async (value, client, { authProfileId, assertCurrent }) => {
@@ -1568,7 +1631,7 @@ async function resumeThread(deps, ctx, pluginConfig, args) {
1568
1631
  let sameOwner = false;
1569
1632
  let knownOwnership;
1570
1633
  try {
1571
- const bindingBeforeCommit = await deps.bindingStore.read(identity);
1634
+ const bindingBeforeCommit = deps.bindingStore.read(identity);
1572
1635
  assertCodexBindingMayBeReplaced(bindingBeforeCommit, "committing a different resumed thread");
1573
1636
  sameOwner = isSameCodexAppServerThreadOwner(bindingBeforeCommit, {
1574
1637
  threadId: effectiveThreadId,
@@ -1583,7 +1646,7 @@ async function resumeThread(deps, ctx, pluginConfig, args) {
1583
1646
  retained = await retainCodexAppServerBindingSubscription(client, effectiveThreadId, knownOwnership);
1584
1647
  assertCurrent();
1585
1648
  if (!retained) throw new Error("Codex resumed thread lost its native subscription owner.");
1586
- if (bindingBeforeCommit && !sameOwner) await releaseCodexAppServerBindingSubscription(bindingBeforeCommit);
1649
+ if (bindingBeforeCommit && !sameOwner) await releaseCodexAppServerBindingSubscription(bindingBeforeCommit, { assertCurrent });
1587
1650
  assertCurrent();
1588
1651
  if (!await deps.bindingStore.mutate(identity, {
1589
1652
  kind: "set",
@@ -1617,6 +1680,8 @@ async function resumeThread(deps, ctx, pluginConfig, args) {
1617
1680
  authProfileId: currentBinding?.authProfileId,
1618
1681
  sessionKey: ctx.sessionKey,
1619
1682
  sessionId: ctx.sessionId,
1683
+ storePath: ctx.sessionTarget?.storePath,
1684
+ assertCurrent: assertHostGeneration,
1620
1685
  beforeRequest: async (request) => {
1621
1686
  const { thread } = await request({
1622
1687
  method: "thread/read",
@@ -1638,7 +1703,7 @@ async function bindCodexCliNodeSession(deps, ctx, parsed) {
1638
1703
  if (isCurrentSessionModelSelectionLocked(ctx)) return MODEL_SELECTION_LOCKED_MESSAGE;
1639
1704
  if (ctx.sessionId) {
1640
1705
  const scope = resolveCodexConversationControlScope(ctx);
1641
- const binding = await deps.bindingStore.read(sessionBindingIdentity({
1706
+ const binding = deps.bindingStore.read(sessionBindingIdentity({
1642
1707
  sessionId: ctx.sessionId,
1643
1708
  sessionKey: ctx.sessionKey,
1644
1709
  agentId: scope.agentId,
@@ -1759,9 +1824,9 @@ async function handleComputerUseCommand(deps, ctx, pluginConfig, args) {
1759
1824
  async function handleNativeGoal(deps, ctx, pluginConfig, args) {
1760
1825
  const action = (args[0] ?? "status").toLowerCase();
1761
1826
  const objective = args.slice(1).join(" ").trim();
1762
- const target = await resolveControlTarget(ctx);
1827
+ const authority = await resolvePreparedCodexCommandAuthority(deps, ctx);
1828
+ const { target, binding } = authority;
1763
1829
  if (!target) return "Cannot manage the Codex goal because this command has no stable binding identity.";
1764
- const binding = await deps.bindingStore.read(target.identity);
1765
1830
  if (!binding?.threadId) return "No Codex thread is attached to this OpenClaw session yet.";
1766
1831
  const connection = resolveCodexBindingAppServerConnection({
1767
1832
  binding,
@@ -1772,6 +1837,10 @@ async function handleNativeGoal(deps, ctx, pluginConfig, args) {
1772
1837
  agentDir: target.agentDir,
1773
1838
  authProfileId: connection.clientAuthProfileId,
1774
1839
  config: ctx.config,
1840
+ sessionId: authority.sessionId,
1841
+ sessionKey: authority.sessionKey,
1842
+ storePath: authority.storePath,
1843
+ assertCurrent: authority.assertCurrent,
1775
1844
  ...connection.usesSupervisionConnection ? { startOptions: connection.appServer.start } : {}
1776
1845
  };
1777
1846
  if (action === "status" || action === "get") {
@@ -1810,26 +1879,30 @@ function formatNativeGoal(response) {
1810
1879
  ].join("\n");
1811
1880
  }
1812
1881
  async function stopConversationTurn(deps, ctx, pluginConfig) {
1813
- const target = await resolveControlTarget(ctx);
1882
+ const authority = await resolvePreparedCodexCommandAuthority(deps, ctx);
1883
+ const { target, binding } = authority;
1814
1884
  if (!target) return "Cannot stop Codex because this command did not include a stable binding identity.";
1815
1885
  return (await deps.stopCodexConversationTurn({
1816
1886
  identity: target.identity,
1817
- bindingStore: deps.bindingStore,
1887
+ binding,
1818
1888
  pluginConfig,
1819
1889
  agentDir: target.agentDir,
1820
- config: ctx.config
1890
+ config: ctx.config,
1891
+ assertCurrent: authority.assertCurrent
1821
1892
  })).message;
1822
1893
  }
1823
1894
  async function steerConversationTurn(deps, ctx, pluginConfig, message) {
1824
- const target = await resolveControlTarget(ctx);
1895
+ const authority = await resolvePreparedCodexCommandAuthority(deps, ctx);
1896
+ const { target, binding } = authority;
1825
1897
  if (!target) return "Cannot steer Codex because this command did not include a stable binding identity.";
1826
1898
  return (await deps.steerCodexConversationTurn({
1827
1899
  identity: target.identity,
1828
- bindingStore: deps.bindingStore,
1900
+ binding,
1829
1901
  message,
1830
1902
  pluginConfig,
1831
1903
  agentDir: target.agentDir,
1832
- config: ctx.config
1904
+ config: ctx.config,
1905
+ assertCurrent: authority.assertCurrent
1833
1906
  })).message;
1834
1907
  }
1835
1908
  async function setConversationModel(deps, ctx, pluginConfig, args) {
@@ -1837,17 +1910,18 @@ async function setConversationModel(deps, ctx, pluginConfig, args) {
1837
1910
  const [model = ""] = args;
1838
1911
  const normalized = model.trim();
1839
1912
  if (normalized && isCurrentSessionModelSelectionLocked(ctx)) return MODEL_SELECTION_LOCKED_MESSAGE;
1840
- const target = await resolveControlTarget(ctx);
1913
+ const authority = await resolvePreparedCodexCommandAuthority(deps, ctx);
1914
+ const { target, binding } = authority;
1841
1915
  if (!target) return "Cannot set Codex model because this command did not include a stable binding identity.";
1842
1916
  if (!normalized) {
1843
- const currentSession = ctx.sessionId && ctx.sessionKey ? getSessionEntry({
1844
- storePath: resolveStorePath(ctx.config.session?.store, { agentId: target.agentId }),
1845
- sessionKey: ctx.sessionKey,
1917
+ const currentSession = authority.sessionId && authority.sessionKey && authority.storePath ? getSessionEntry({
1918
+ storePath: authority.storePath,
1919
+ sessionKey: authority.sessionKey,
1846
1920
  hydrateSkillPromptRefs: false,
1847
1921
  readConsistency: "latest"
1848
1922
  }) : void 0;
1849
- const selectedModel = currentSession && currentSession.sessionId === ctx.sessionId ? currentSession.modelOverride ?? currentSession.model : void 0;
1850
- const binding = await deps.bindingStore.read(target.identity);
1923
+ const selectedModel = currentSession && currentSession.sessionId === authority.sessionId ? currentSession.modelOverride ?? currentSession.model : void 0;
1924
+ authority.assertCurrent();
1851
1925
  const activeModel = target.identity.kind === "conversation" ? binding?.model : selectedModel ?? binding?.model;
1852
1926
  return activeModel ? `Codex model: ${formatCodexDisplayText(activeModel)}` : "Usage: /codex model <model>";
1853
1927
  }
@@ -1857,12 +1931,16 @@ async function setConversationModel(deps, ctx, pluginConfig, args) {
1857
1931
  pluginConfig,
1858
1932
  model: normalized,
1859
1933
  agentDir: target.agentDir,
1860
- config: ctx.config
1934
+ config: ctx.config,
1935
+ binding,
1936
+ storePath: authority.storePath,
1937
+ assertCurrent: authority.assertCurrent
1861
1938
  });
1862
1939
  }
1863
1940
  async function setConversationFastMode(deps, ctx, args) {
1864
1941
  if (args.length > 1) return "Usage: /codex fast [on|off|status]";
1865
- const target = await resolveControlTarget(ctx);
1942
+ const authority = await resolvePreparedCodexCommandAuthority(deps, ctx);
1943
+ const { target, binding } = authority;
1866
1944
  if (!target) return "Cannot set Codex fast mode because this command did not include a stable binding identity.";
1867
1945
  const value = args[0];
1868
1946
  const parsed = parseCodexFastModeArg(value);
@@ -1870,12 +1948,15 @@ async function setConversationFastMode(deps, ctx, args) {
1870
1948
  return await deps.setCodexConversationFastMode({
1871
1949
  identity: target.identity,
1872
1950
  bindingStore: deps.bindingStore,
1873
- enabled: parsed
1951
+ binding,
1952
+ enabled: parsed,
1953
+ assertCurrent: authority.assertCurrent
1874
1954
  });
1875
1955
  }
1876
1956
  async function setConversationPermissions(deps, ctx, args) {
1877
1957
  if (args.length > 1) return "Usage: /codex permissions [default|yolo|status]";
1878
- const target = await resolveControlTarget(ctx);
1958
+ const authority = await resolvePreparedCodexCommandAuthority(deps, ctx);
1959
+ const { target } = authority;
1879
1960
  if (!target || !ctx.sessionId || !ctx.sessionKey) return "Cannot set Codex permissions because this command did not include a complete session identity.";
1880
1961
  const value = args[0];
1881
1962
  const parsed = parseCodexPermissionsModeArg(value);
@@ -1884,6 +1965,8 @@ async function setConversationPermissions(deps, ctx, args) {
1884
1965
  return await deps.setCodexConversationPermissions({
1885
1966
  mode: parsed,
1886
1967
  config: ctx.config,
1968
+ storePath: authority.storePath,
1969
+ assertCurrent: authority.assertHostCurrent,
1887
1970
  session: {
1888
1971
  agentId: target.agentId,
1889
1972
  sessionId: ctx.sessionId,
@@ -1893,31 +1976,26 @@ async function setConversationPermissions(deps, ctx, args) {
1893
1976
  }
1894
1977
  async function startThreadAction(deps, ctx, pluginConfig, kind, args) {
1895
1978
  if (args.length > 0) return `Usage: /codex ${kind}`;
1896
- const target = await resolveControlTarget(ctx);
1979
+ const authority = await resolvePreparedCodexCommandAuthority(deps, ctx);
1980
+ const { target, binding } = authority;
1897
1981
  if (!target) return `Cannot start Codex ${kind === "compact" ? "compaction" : "review"} because this command did not include a stable binding identity.`;
1898
- const binding = await deps.bindingStore.read(target.identity);
1899
1982
  if (!binding?.threadId) return `No Codex thread is attached to this OpenClaw session yet.`;
1900
1983
  if (kind === "compact") {
1901
1984
  const sessionTarget = ctx.sessionTarget;
1902
1985
  if (!ctx.sessionId || !ctx.sessionKey || !sessionTarget || sessionTarget.sessionId !== ctx.sessionId || sessionTarget.sessionKey !== ctx.sessionKey) return "Codex compaction is unavailable because this command is not bound to a complete session identity.";
1903
1986
  const currentSession = getSessionEntry({
1904
- storePath: sessionTarget.storePath,
1987
+ storePath: authority.storePath ?? sessionTarget.storePath,
1905
1988
  sessionKey: ctx.sessionKey,
1906
1989
  hydrateSkillPromptRefs: false,
1907
1990
  readConsistency: "latest"
1908
1991
  });
1909
1992
  if (currentSession?.sessionId !== ctx.sessionId || resolvePersistedSessionRuntimeId(currentSession) !== "codex") return "Codex compaction is unavailable because the current OpenClaw session is not using the Codex runtime.";
1910
1993
  if (target.identity.kind === "conversation") {
1911
- const sessionBinding = ctx.sessionId ? await deps.bindingStore.read(sessionBindingIdentity({
1912
- sessionId: ctx.sessionId,
1913
- sessionKey: ctx.sessionKey,
1914
- agentId: sessionTarget.agentId,
1915
- config: ctx.config
1916
- })) : void 0;
1917
- if (!isSameCodexAppServerThreadOwner(binding, sessionBinding)) return "Codex compaction is unavailable because the conversation-bound thread differs from the current session binding. Resume that thread into the session first.";
1994
+ if (!isSameCodexAppServerThreadOwner(binding, authority.currentSessionBinding)) return "Codex compaction is unavailable because the conversation-bound thread differs from the current session binding. Resume that thread into the session first.";
1918
1995
  }
1919
1996
  const compactCurrent = ctx.runtimeContext?.compactCurrent;
1920
1997
  if (!compactCurrent) return "Codex compaction is unavailable because this command is not bound to a session.";
1998
+ authority.assertCurrent();
1921
1999
  const result = await compactCurrent();
1922
2000
  return result.compacted ? `Compacted Codex session (${result.tokensAfter ?? "unknown"} tokens after).` : `Codex compaction did not complete: ${formatCodexDisplayText(result.reason ?? "no reason returned")}.`;
1923
2001
  }
@@ -1933,6 +2011,10 @@ async function startThreadAction(deps, ctx, pluginConfig, kind, args) {
1933
2011
  agentDir: target.agentDir,
1934
2012
  authProfileId: connection.clientAuthProfileId,
1935
2013
  config: ctx.config,
2014
+ sessionId: authority.sessionId,
2015
+ sessionKey: authority.sessionKey,
2016
+ storePath: authority.storePath,
2017
+ assertCurrent: authority.assertCurrent,
1936
2018
  ...connection.usesSupervisionConnection ? {
1937
2019
  startOptions: connection.appServer.start,
1938
2020
  beforeRequest: supervisedCommandGuard(deps, target.identity, binding)
@@ -1947,7 +2029,7 @@ function supervisedCommandGuard(deps, identity, binding) {
1947
2029
  includeTurns: false
1948
2030
  });
1949
2031
  scope.assertCurrent();
1950
- if (!isDeepStrictEqual(await deps.bindingStore.read(identity), binding)) throw new Error("Codex command binding changed before model execution");
2032
+ if (!isDeepStrictEqual(deps.bindingStore.read(identity), binding)) throw new Error("Codex command binding changed before model execution");
1951
2033
  scope.assertCurrent();
1952
2034
  assertCodexSupervisionThreadLineage(binding, thread);
1953
2035
  };