@openclaw/codex 2026.9.33 → 2026.9.35

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 (101) hide show
  1. package/dist/.setup/{account-usage-runtime-dYM1lh1V.mjs → account-usage-runtime-BaJamBiM.mjs} +3 -3
  2. package/dist/.setup/{apply-C82xe8Bk.mjs → apply-CxwOGLd_.mjs} +8 -8
  3. package/dist/.setup/{attempt-client-cleanup-D1aznv7C.mjs → attempt-client-cleanup-BVtNsTOE.mjs} +4 -4
  4. package/dist/.setup/{attempt-workspace-context-DKAbD-vI.mjs → attempt-workspace-context-XRsWP165.mjs} +1 -1
  5. package/dist/.setup/{auth-binding-BLWz7stm.mjs → auth-binding-Bnaj0_iV.mjs} +1 -1
  6. package/dist/.setup/{auth-cache-key-CWpIEtTm.mjs → auth-cache-key-CskfconU.mjs} +3 -3
  7. package/dist/.setup/{binding-connection-DTtN1KrX.mjs → binding-connection-DRPlnIgg.mjs} +2 -2
  8. package/dist/.setup/{binding-connection.runtime-6TpgD1M6.mjs → binding-connection.runtime-DC3oUqo-.mjs} +1 -1
  9. package/dist/.setup/{bounded-turn-Ca4urQ25.mjs → bounded-turn-DBwLoFDR.mjs} +11 -11
  10. package/dist/.setup/{bounded-turn-isolation-B8K_ylqk.mjs → bounded-turn-isolation-Ce-oOk-D.mjs} +2 -2
  11. package/dist/.setup/{build-state-E-CRUdgh.mjs → build-state-B3lvV1Op.mjs} +1 -1
  12. package/dist/.setup/{client-6GbdZFc0.mjs → client-DcTISXe3.mjs} +7 -7
  13. package/dist/.setup/{client-catalog-response-HvvnCxvX.mjs → client-catalog-response-BcbsrQXY.mjs} +1 -1
  14. package/dist/.setup/{command-dispatch-_PPJobF7.mjs → command-dispatch-MOoD3rsD.mjs} +1 -1
  15. package/dist/.setup/{command-handlers-Do_MOc5V.mjs → command-handlers-Cevt_YwM.mjs} +23 -23
  16. package/dist/.setup/{command-rpc-Bc_OIgK0.mjs → command-rpc-kf7Uq4L-.mjs} +11 -11
  17. package/dist/.setup/{compact-BVSQoyh-.mjs → compact-BNKuKa7o.mjs} +13 -13
  18. package/dist/.setup/{config-DKhXquav.mjs → config-DqmrqI23.mjs} +2 -2
  19. package/dist/.setup/{config-runtime-C0NbLms1.mjs → config-runtime-DDhvIeUC.mjs} +1 -1
  20. package/dist/.setup/{conversation-binding-CvjxRWI-.mjs → conversation-binding-CKYGEvcX.mjs} +15 -15
  21. package/dist/.setup/{conversation-binding-data-C746z5Pn.mjs → conversation-binding-data-DlsG-dQu.mjs} +1 -1
  22. package/dist/.setup/{conversation-control-DoxkQ9nq.mjs → conversation-control-CoWUL35l.mjs} +5 -5
  23. package/dist/.setup/{dynamic-tools-CGMXNyuw.mjs → dynamic-tools-Dr0ye5P3.mjs} +7 -7
  24. package/dist/.setup/{effective-mcp-catalog-C1zwj-bq.mjs → effective-mcp-catalog-BFJCwjSI.mjs} +4 -4
  25. package/dist/.setup/{ephemeral-turn-Cyu_xJDs.mjs → ephemeral-turn-Dj3iTfSP.mjs} +2 -2
  26. package/dist/.setup/{event-projector-assistant-message-CAI4foF8.mjs → event-projector-assistant-message-DXDX94zH.mjs} +1 -1
  27. package/dist/.setup/incognito-session-C5ve_-63.mjs +1 -0
  28. package/dist/.setup/{isolated-completion-DPr7Nsl7.mjs → isolated-completion-GB52W-qA.mjs} +6 -6
  29. package/dist/.setup/{managed-binary-B6hQ1UKR.mjs → managed-binary-Ckgvm_4V.mjs} +1 -1
  30. package/dist/.setup/{model-catalog-gcv3irT9.mjs → model-catalog-DxSrOSY0.mjs} +7 -7
  31. package/dist/.setup/{models-Bs4aEhpG.mjs → models-BwkZaXXj.mjs} +3 -3
  32. package/dist/.setup/{native-auth-BN-BD2AV.mjs → native-auth-BNGz77PF.mjs} +3 -3
  33. package/dist/.setup/{native-subagent-monitor-DbNIloTJ.mjs → native-subagent-monitor-g-ZDkvCr.mjs} +118 -27
  34. package/dist/.setup/{native-subagent-pending-assignments-DwkCzLvD.mjs → native-subagent-pending-assignments-XHNn4k5q.mjs} +51 -14
  35. package/dist/.setup/{native-task-assignments-DMQ0g3hu.mjs → native-task-assignments-Dna952zv.mjs} +2 -2
  36. package/dist/.setup/{node-cli-sessions-HC4W6FLI.mjs → node-cli-sessions-BwhIYgCZ.mjs} +2 -2
  37. package/dist/.setup/{node-exec-server.runtime-BS7jsvK-.mjs → node-exec-server.runtime-9IZtsOmo.mjs} +2 -2
  38. package/dist/.setup/{plan-NTSBQtKx.mjs → plan-Cwp_21m-.mjs} +5 -5
  39. package/dist/.setup/{plugin-activation-cNHRfaxU.mjs → plugin-activation-BaDnJKJd.mjs} +2 -2
  40. package/dist/.setup/{plugin-inventory-Cky2XJUw.mjs → plugin-inventory-B4uqIw4J.mjs} +1 -1
  41. package/dist/.setup/{plugin-metadata-cache-Z06WuND0.mjs → plugin-metadata-cache-C-LRxilF.mjs} +7 -7
  42. package/dist/.setup/{provider-BnX84knz.mjs → provider-DUotqBZ6.mjs} +4 -4
  43. package/dist/.setup/{provider-capabilities-CYK-rMwC.mjs → provider-capabilities-DBs9l8oL.mjs} +2 -2
  44. package/dist/.setup/{request-DQh7X3fU.mjs → request-CWERwKIL.mjs} +5 -5
  45. package/dist/.setup/{run-attempt-Bp6qFrIQ.mjs → run-attempt-ypT0LYSD.mjs} +77 -42
  46. package/dist/.setup/{runtime-artifact-D7lCXdhV.mjs → runtime-artifact-Riq878B2.mjs} +3 -3
  47. package/dist/.setup/{runtime-artifact-connection-D68qQn1m.mjs → runtime-artifact-connection-Bjv8P6Sx.mjs} +2 -2
  48. package/dist/.setup/{sandbox-guard-DjCz2eOw.mjs → sandbox-guard-OIYEmTRF.mjs} +1 -1
  49. package/dist/.setup/{session-binding-DGCYAfvD.mjs → session-binding-Fn7Ekzuv.mjs} +19 -4
  50. package/dist/.setup/{session-binding-record-Oe9L-CNY.mjs → session-binding-record-CUKpUKVm.mjs} +1 -1
  51. package/dist/.setup/{session-binding-sidecars-jo6H8dFr.mjs → session-binding-sidecars-BuEALwJY.mjs} +1 -1
  52. package/dist/.setup/{session-catalog-DFZmNlhW.mjs → session-catalog-DMagZcW-.mjs} +22 -22
  53. package/dist/.setup/{session-catalog-adoption-BU_pHWG7.mjs → session-catalog-adoption-58bqOngU.mjs} +5 -5
  54. package/dist/.setup/{session-catalog-archive-spHfihri.mjs → session-catalog-archive-BM9gCB82.mjs} +5 -5
  55. package/dist/.setup/{session-catalog-events-DVLgp99B.mjs → session-catalog-events-r59AxcQ4.mjs} +3 -3
  56. package/dist/.setup/{session-catalog-index-v3Yjgaih.mjs → session-catalog-index-CY1lNpxF.mjs} +8 -8
  57. package/dist/.setup/{session-catalog-index-order-BcQpHks3.mjs → session-catalog-index-order-DQhmgM3b.mjs} +1 -1
  58. package/dist/.setup/{session-catalog-index-state-TeO7EyO-.mjs → session-catalog-index-state-DhLoAnfy.mjs} +3 -3
  59. package/dist/.setup/{session-catalog-limits-DDxOsQeC.mjs → session-catalog-limits-bz5ZvjtY.mjs} +1 -1
  60. package/dist/.setup/{session-catalog-list-request-CvtxrYSe.mjs → session-catalog-list-request-A1wN4sKw.mjs} +2 -2
  61. package/dist/.setup/{session-catalog-native-projection-LshItrMe.mjs → session-catalog-native-projection-CXTe4qQr.mjs} +4 -4
  62. package/dist/.setup/{session-catalog-node-adoption-DgXvSGu0.mjs → session-catalog-node-adoption-BdS7zDuY.mjs} +2 -2
  63. package/dist/.setup/{session-catalog-node-continue-DjKXHBbi.mjs → session-catalog-node-continue-XFJG3JGh.mjs} +5 -5
  64. package/dist/.setup/{session-catalog-node-lookup-CtAXI5W5.mjs → session-catalog-node-lookup-D9AP5D5o.mjs} +2 -2
  65. package/dist/.setup/{session-catalog-parsing-CPGaPYr-.mjs → session-catalog-parsing-CnEH565l.mjs} +1 -1
  66. package/dist/.setup/{session-catalog-projection-CCBFozaQ.mjs → session-catalog-projection-DcDKizZd.mjs} +4 -4
  67. package/dist/.setup/{session-cli-KhdG-_Aj.mjs → session-cli-C3GejWcm.mjs} +2 -2
  68. package/dist/.setup/{session-history-import-WhX-X33a.mjs → session-history-import-tquj9DCz.mjs} +4 -4
  69. package/dist/.setup/{session-initialization-6aveB9qb.mjs → session-initialization-DefAI1_5.mjs} +2 -2
  70. package/dist/.setup/{session-permission-policy-Ci_fVX6y.mjs → session-permission-policy-7lM447LW.mjs} +1 -1
  71. package/dist/.setup/{session-retirement-ERjp2r4a.mjs → session-retirement-CQCMiDul.mjs} +7 -7
  72. package/dist/.setup/{settled-turn-finalizer-DbS1Mwoq.mjs → settled-turn-finalizer-w92T5Rbb.mjs} +7 -7
  73. package/dist/.setup/{shared-client-zsK3DTPh.mjs → shared-client-ZXKMsK6f.mjs} +96 -46
  74. package/dist/.setup/{shared-client-lifecycle-4LdC3gM4.mjs → shared-client-lifecycle-BH_y_i8l.mjs} +24 -2
  75. package/dist/.setup/{side-question-DW4W4HY7.mjs → side-question-BBZJibHK.mjs} +15 -15
  76. package/dist/.setup/{source-DzsIjGO7.mjs → source-Iusn97ly.mjs} +4 -4
  77. package/dist/.setup/{thread-lifecycle-D03WesNn.mjs → thread-lifecycle-CzzYMvTL.mjs} +31 -15
  78. package/dist/.setup/{thread-ownership-B0xUCXOU.mjs → thread-ownership-BT_SeSUp.mjs} +4 -4
  79. package/dist/.setup/{thread-policy-g1TKKqWj.mjs → thread-policy-MM5YD22L.mjs} +3 -3
  80. package/dist/.setup/{thread-requests-15uBuGjw.mjs → thread-requests-y_MnVuWC.mjs} +9 -9
  81. package/dist/.setup/{thread-resume-BZfwM8Jh.mjs → thread-resume-B9clyqXE.mjs} +5 -5
  82. package/dist/.setup/{transcript-mirror-kxmCYsuF.mjs → transcript-mirror-BRNhyb1o.mjs} +1 -1
  83. package/dist/.setup/{transport-stdio-CbutOIEh.mjs → transport-stdio-DU8dIOCj.mjs} +1 -1
  84. package/dist/.setup/{transport-websocket-BTBE-LD9.mjs → transport-websocket-zu3jRPnu.mjs} +1 -1
  85. package/dist/.setup/{upstream-session-fork--vHya1T-.mjs → upstream-session-fork-2ipYynVl.mjs} +14 -14
  86. package/dist/.setup/{usage-CdWiiqqY.mjs → usage-BgB8DOas.mjs} +3 -3
  87. package/dist/.setup/{usage-limit-error-BEyQJjD_.mjs → usage-limit-error-B1FCZdeH.mjs} +1 -1
  88. package/dist/.setup/{web-search-provider.runtime--55TuUQG.mjs → web-search-provider.runtime-BWbZnYAL.mjs} +2 -2
  89. package/dist/.source-module-urls/78bb81623f5bb4c04c8cbd3fb1e9f10b4529f4811dc3cd99cedf5880f01c9b28.json +1 -0
  90. package/dist/api.js +3 -3
  91. package/dist/catalog-page.worker.js +1 -1
  92. package/dist/cli-metadata.js +1 -1
  93. package/dist/doctor-contract-api.js +5 -5
  94. package/dist/harness.js +19 -19
  95. package/dist/index.js +53 -43
  96. package/dist/media-understanding-provider.js +2 -2
  97. package/dist/migration-provider-api.js +1 -2
  98. package/dist/provider-discovery.js +1 -1
  99. package/dist/session-history.worker.js +1 -2
  100. package/package.json +5 -5
  101. package/dist/.setup/incognito-session-DWYapfwf.mjs +0 -2
@@ -1,8 +1,8 @@
1
- import { D as selectCodexCatalogPreviewInput, c as MAX_CWD_LENGTH, d as boundedCatalogString, k as truncateCodexCatalogPreview } from "./session-catalog-parsing-CPGaPYr-.mjs";
1
+ import { D as selectCodexCatalogPreviewInput, c as MAX_CWD_LENGTH, d as boundedCatalogString, k as truncateCodexCatalogPreview } from "./session-catalog-parsing-CnEH565l.mjs";
2
2
  import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
3
- import { n as defineCodexBuildState } from "./build-state-E-CRUdgh.mjs";
4
- import { n as detachCodexCatalogString } from "./session-catalog-limits-DDxOsQeC.mjs";
5
- import { t as __exportAll } from "./session-binding-sidecars-jo6H8dFr.mjs";
3
+ import { n as defineCodexBuildState } from "./build-state-B3lvV1Op.mjs";
4
+ import { n as detachCodexCatalogString } from "./session-catalog-limits-bz5ZvjtY.mjs";
5
+ import { t as __exportAll } from "./session-binding-sidecars-BuEALwJY.mjs";
6
6
  //#region extensions/codex/src/session-catalog-source.ts
7
7
  function hasLiveCodexCatalogSource(sources) {
8
8
  for (const source of sources) if (!source.closed) return true;
@@ -1,4 +1,4 @@
1
- import { o as CatalogParamsError } from "./session-catalog-parsing-CPGaPYr-.mjs";
1
+ import { o as CatalogParamsError } from "./session-catalog-parsing-CnEH565l.mjs";
2
2
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
4
4
  import { parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
@@ -146,7 +146,7 @@ async function createOrReuseNodeAdoptedSession(params) {
146
146
  },
147
147
  afterCreate: async (entry) => {
148
148
  const storePath = resolveStorePath(params.config.session?.store, { agentId: entry.agentId });
149
- const { importCodexThreadHistoryToTranscript } = await import("./transcript-mirror-kxmCYsuF.mjs").then((n) => n.a);
149
+ const { importCodexThreadHistoryToTranscript } = await import("./transcript-mirror-BRNhyb1o.mjs").then((n) => n.a);
150
150
  await importCodexThreadHistoryToTranscript({
151
151
  thread: params.history.thread,
152
152
  throughTurnId: params.history.throughTurnId,
@@ -1,10 +1,10 @@
1
- import { A as unwrapNodeInvokePayload, b as parseTranscriptPage, d as boundedCatalogString, f as catalogError, g as isInteractiveThreadSource, h as filterCatalogPageByTitle, n as CODEX_APP_SERVER_THREADS_LIST_COMMAND, o as CatalogParamsError, r as CODEX_APP_SERVER_THREAD_TURNS_LIST_COMMAND, u as NODE_INVOKE_TIMEOUT_MS, v as parseCatalogPage } from "./session-catalog-parsing-CPGaPYr-.mjs";
2
- import { n as createCodexCliNodeConversationBindingData } from "./conversation-binding-data-C746z5Pn.mjs";
3
- import { r as CODEX_CLI_SESSION_SOURCE_UPGRADE_MESSAGE, t as CODEX_CLI_SESSION_RESUME_COMMAND } from "./node-cli-sessions-HC4W6FLI.mjs";
1
+ import { A as unwrapNodeInvokePayload, b as parseTranscriptPage, d as boundedCatalogString, f as catalogError, g as isInteractiveThreadSource, h as filterCatalogPageByTitle, n as CODEX_APP_SERVER_THREADS_LIST_COMMAND, o as CatalogParamsError, r as CODEX_APP_SERVER_THREAD_TURNS_LIST_COMMAND, u as NODE_INVOKE_TIMEOUT_MS, v as parseCatalogPage } from "./session-catalog-parsing-CnEH565l.mjs";
2
+ import { n as createCodexCliNodeConversationBindingData } from "./conversation-binding-data-DlsG-dQu.mjs";
3
+ import { r as CODEX_CLI_SESSION_SOURCE_UPGRADE_MESSAGE, t as CODEX_CLI_SESSION_RESUME_COMMAND } from "./node-cli-sessions-BwhIYgCZ.mjs";
4
4
  import { i as withTimeout } from "./timeout-CXOfNoaX.mjs";
5
- import { t as lookupNodeCodexCatalogRecord } from "./session-catalog-node-lookup-CtAXI5W5.mjs";
5
+ import { t as lookupNodeCodexCatalogRecord } from "./session-catalog-node-lookup-D9AP5D5o.mjs";
6
6
  import { t as codexLastTerminalTurnId } from "./session-upstream-marker-D15C9NHp.mjs";
7
- import { catalogSessionActions, createOrReuseNodeAdoptedSession, finalizeNodeAdoptedSession, findNodeAdoptedSessionEntry, nodeAdoptedSourceKey, nodeSessionMarker } from "./session-catalog-node-adoption-DgXvSGu0.mjs";
7
+ import { catalogSessionActions, createOrReuseNodeAdoptedSession, finalizeNodeAdoptedSession, findNodeAdoptedSessionEntry, nodeAdoptedSourceKey, nodeSessionMarker } from "./session-catalog-node-adoption-BdS7zDuY.mjs";
8
8
  import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
9
9
  import { createSessionCatalogAdoptionCoordinator, publishSessionCatalogHost, sessionCatalogAdoptedSourceKey } from "openclaw/plugin-sdk/session-catalog";
10
10
  //#region extensions/codex/src/session-catalog-node-continue.ts
@@ -1,5 +1,5 @@
1
- import { A as unwrapNodeInvokePayload, n as CODEX_APP_SERVER_THREADS_LIST_COMMAND, o as CatalogParamsError, u as NODE_INVOKE_TIMEOUT_MS, v as parseCatalogPage } from "./session-catalog-parsing-CPGaPYr-.mjs";
2
- import "./session-catalog-limits-DDxOsQeC.mjs";
1
+ import { A as unwrapNodeInvokePayload, n as CODEX_APP_SERVER_THREADS_LIST_COMMAND, o as CatalogParamsError, u as NODE_INVOKE_TIMEOUT_MS, v as parseCatalogPage } from "./session-catalog-parsing-CnEH565l.mjs";
2
+ import "./session-catalog-limits-bz5ZvjtY.mjs";
3
3
  import { i as withTimeout } from "./timeout-CXOfNoaX.mjs";
4
4
  //#region extensions/codex/src/session-catalog-node-lookup.ts
5
5
  async function lookupNodeCodexCatalogRecord(params) {
@@ -1,5 +1,5 @@
1
1
  import "./protocol-CANUwXJ3.mjs";
2
- import { n as detachCodexCatalogString } from "./session-catalog-limits-DDxOsQeC.mjs";
2
+ import { n as detachCodexCatalogString } from "./session-catalog-limits-bz5ZvjtY.mjs";
3
3
  import { asFiniteNumber, isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
5
5
  //#region extensions/codex/src/app-server/protocol-session-source.ts
@@ -1,8 +1,8 @@
1
- import { D as selectCodexCatalogPreviewInput, O as toCatalogSession, S as readControlCursor, d as boundedCatalogString, k as truncateCodexCatalogPreview } from "./session-catalog-parsing-CPGaPYr-.mjs";
2
- import { n as detachCodexCatalogString } from "./session-catalog-limits-DDxOsQeC.mjs";
3
- import { n as codexCatalogRowRecency } from "./session-catalog-index-order-BcQpHks3.mjs";
1
+ import { D as selectCodexCatalogPreviewInput, O as toCatalogSession, S as readControlCursor, d as boundedCatalogString, k as truncateCodexCatalogPreview } from "./session-catalog-parsing-CnEH565l.mjs";
2
+ import { n as detachCodexCatalogString } from "./session-catalog-limits-bz5ZvjtY.mjs";
3
+ import { n as codexCatalogRowRecency } from "./session-catalog-index-order-DQhmgM3b.mjs";
4
4
  import { t as isOpenClawManagedCodexThread } from "./session-catalog-provenance-DoAvktcj.mjs";
5
- import { c as copyCodexCatalogSource, l as getCodexCatalogSource, p as setCodexCatalogSource, r as projectCodexCatalogNativeThread } from "./session-catalog-native-projection-LshItrMe.mjs";
5
+ import { c as copyCodexCatalogSource, l as getCodexCatalogSource, p as setCodexCatalogSource, r as projectCodexCatalogNativeThread } from "./session-catalog-native-projection-CXTe4qQr.mjs";
6
6
  import { asFiniteNumber, isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
7
7
  import path from "node:path";
8
8
  import fs from "node:fs/promises";
@@ -1,5 +1,5 @@
1
- import "./session-catalog-parsing-CPGaPYr-.mjs";
2
- import "./session-catalog-DFZmNlhW.mjs";
1
+ import "./session-catalog-parsing-CnEH565l.mjs";
2
+ import "./session-catalog-DMagZcW-.mjs";
3
3
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
5
5
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
@@ -1,7 +1,7 @@
1
- import { v as sessionBindingIdentity } from "./session-binding-record-Oe9L-CNY.mjs";
2
- import "./session-binding-DGCYAfvD.mjs";
3
- import { r as importCodexThreadHistoryToTranscript } from "./transcript-mirror-kxmCYsuF.mjs";
4
- import { n as prepareCodexSessionInitialization } from "./session-initialization-6aveB9qb.mjs";
1
+ import { v as sessionBindingIdentity } from "./session-binding-record-CUKpUKVm.mjs";
2
+ import "./session-binding-Fn7Ekzuv.mjs";
3
+ import { r as importCodexThreadHistoryToTranscript } from "./transcript-mirror-BRNhyb1o.mjs";
4
+ import { n as prepareCodexSessionInitialization } from "./session-initialization-DefAI1_5.mjs";
5
5
  import { resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
6
6
  //#region extensions/codex/src/app-server/session-history-import.ts
7
7
  /** Creates a session whose transcript is derived from one verified Codex thread snapshot. */
@@ -1,5 +1,5 @@
1
- import { b as validateBindingForWrite } from "./session-binding-record-Oe9L-CNY.mjs";
2
- import "./session-binding-DGCYAfvD.mjs";
1
+ import { b as validateBindingForWrite } from "./session-binding-record-CUKpUKVm.mjs";
2
+ import "./session-binding-Fn7Ekzuv.mjs";
3
3
  import { createNativeSessionInitializationOwner } from "openclaw/plugin-sdk/agent-harness-session-runtime";
4
4
  //#region extensions/codex/src/app-server/session-initialization.ts
5
5
  const codexInitializations = createNativeSessionInitializationOwner({
@@ -1,5 +1,5 @@
1
1
  import { E as selectGuardianSandbox, _ as selectUserApprovalsReviewer, d as parseAllowedApprovalPoliciesFromCodexRequirements, f as parseAllowedApprovalsReviewersFromCodexRequirements, g as selectGuardianApprovalsReviewer, h as selectGuardianApprovalPolicy, i as resolveCodexAppServerNetworkProxy, p as parseAllowedSandboxModesFromCodexRequirements } from "./config-security-CE-FcGw9.mjs";
2
- import { n as canUseCodexModelBackedApprovalsReviewerForModel } from "./config-DKhXquav.mjs";
2
+ import { n as canUseCodexModelBackedApprovalsReviewerForModel } from "./config-DqmrqI23.mjs";
3
3
  import { hostname } from "node:os";
4
4
  import { isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
5
5
  //#region extensions/codex/src/app-server/app-server-policy.ts
@@ -1,11 +1,11 @@
1
- import { l as retainSharedCodexAppServerClientByInstanceId } from "./shared-client-lifecycle-4LdC3gM4.mjs";
1
+ import { u as retainSharedCodexAppServerClientByInstanceId } from "./shared-client-lifecycle-BH_y_i8l.mjs";
2
2
  import { t as withCodexAppServerThreadMutation } from "./thread-ownership-queue-Dp24d7-F.mjs";
3
- import { t as isIncognitoSessionKey } from "./incognito-session-DWYapfwf.mjs";
4
- import { K as releaseCodexAppServerLiveThread, R as hasCodexAppServerLiveThread, V as isCodexAppServerLiveThreadClaimed } from "./shared-client-zsK3DTPh.mjs";
5
- import { n as CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS, o as closeCodexStartupClientBestEffort, p as unsubscribeCodexThreadBestEffort, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-D1aznv7C.mjs";
6
- import { t as codexNativeSubagentMonitorRuntime } from "./native-subagent-monitor-DbNIloTJ.mjs";
7
- import { t as isSameCodexAppServerThreadOwner } from "./thread-ownership-B0xUCXOU.mjs";
8
- import { t as getCodexSessionInitializationRollback } from "./session-initialization-6aveB9qb.mjs";
3
+ import { t as isIncognitoSessionKey } from "./incognito-session-C5ve_-63.mjs";
4
+ import { K as releaseCodexAppServerLiveThread, R as hasCodexAppServerLiveThread, V as isCodexAppServerLiveThreadClaimed } from "./shared-client-ZXKMsK6f.mjs";
5
+ import { n as CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS, o as closeCodexStartupClientBestEffort, p as unsubscribeCodexThreadBestEffort, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-BVtNsTOE.mjs";
6
+ import { t as codexNativeSubagentMonitorRuntime } from "./native-subagent-monitor-g-ZDkvCr.mjs";
7
+ import { t as isSameCodexAppServerThreadOwner } from "./thread-ownership-BT_SeSUp.mjs";
8
+ import { t as getCodexSessionInitializationRollback } from "./session-initialization-DefAI1_5.mjs";
9
9
  //#region extensions/codex/src/app-server/session-retirement.ts
10
10
  async function releaseSessionSubscription(client, binding, sessionKey, assertCurrent) {
11
11
  assertCurrent?.();
@@ -1,12 +1,12 @@
1
1
  import { r as readMirrorIdentity, t as attachCodexMirrorIdentity } from "./upstream-prompt-provenance-fXkKbPVC.mjs";
2
2
  import { a as fingerprintCodexMirrorSourceMessage, c as readCodexMirrorSourceFingerprint } from "./transcript-mirror-attestation-YSegaktH.mjs";
3
- import { nt as resolveCodexAppServerPreparedAuthHandoff } from "./shared-client-zsK3DTPh.mjs";
4
- import { _ as assertCodexPassiveTurnItems } from "./client-6GbdZFc0.mjs";
5
- import { o as resolveCodexLocalRuntimeAttribution } from "./native-subagent-monitor-DbNIloTJ.mjs";
6
- import { t as codexTranscriptMirrorRuntime } from "./transcript-mirror-kxmCYsuF.mjs";
7
- import { runBoundedCodexAppServerTurn } from "./bounded-turn-Ca4urQ25.mjs";
8
- import { t as resolveCodexBoundedTurnIsolation } from "./bounded-turn-isolation-B8K_ylqk.mjs";
9
- import { a as createAttributedCodexAssistantMessage } from "./event-projector-assistant-message-CAI4foF8.mjs";
3
+ import { rt as resolveCodexAppServerPreparedAuthHandoff } from "./shared-client-ZXKMsK6f.mjs";
4
+ import { _ as assertCodexPassiveTurnItems } from "./client-DcTISXe3.mjs";
5
+ import { o as resolveCodexLocalRuntimeAttribution } from "./native-subagent-monitor-g-ZDkvCr.mjs";
6
+ import { t as codexTranscriptMirrorRuntime } from "./transcript-mirror-BRNhyb1o.mjs";
7
+ import { runBoundedCodexAppServerTurn } from "./bounded-turn-DBwLoFDR.mjs";
8
+ import { t as resolveCodexBoundedTurnIsolation } from "./bounded-turn-isolation-Ce-oOk-D.mjs";
9
+ import { a as createAttributedCodexAssistantMessage } from "./event-projector-assistant-message-DXDX94zH.mjs";
10
10
  import { t as CodexSettledTurnContext } from "./settled-turn-context-D4yj4rxf.mjs";
11
11
  import { isSilentReplyText } from "openclaw/plugin-sdk/reply-runtime";
12
12
  //#region extensions/codex/src/app-server/settled-turn-finalizer.ts
@@ -1,23 +1,23 @@
1
1
  import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
2
- import { n as defineCodexBuildState, t as codexBuildSymbol } from "./build-state-E-CRUdgh.mjs";
2
+ import { n as defineCodexBuildState, t as codexBuildSymbol } from "./build-state-B3lvV1Op.mjs";
3
3
  import { t as CODEX_APP_SERVER_AUTH_PROVIDER } from "./auth-profile-selection-DFu9e167.mjs";
4
4
  import { n as isCodexAppServerProxyLaunch } from "./launch-args-DbFCehO7.mjs";
5
5
  import { a as withEphemeralCodexAuthStore, i as withClearedEnvironmentVariables, n as resolveCodexAppServerLocalHomeDir, r as resolveCodexAppServerUserHomeDir, t as resolveCodexAppServerHomeDir } from "./auth-start-options-BPIPeEX8.mjs";
6
6
  import { a as resolveCodexAppServerStartOptionsForAgent, d as readCodexEffectiveConfig, o as resolveCodexComputerUseConfig, t as codexAppServerStartOptionsKey, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-CzyWLTJt.mjs";
7
- import { d as resolveMacOSDesktopCodexBundledMarketplaceCandidates, f as resolveMacOSDesktopCodexComputerUseServiceAppCandidates, i as resolveManagedCodexNativeCommand, l as resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath, r as resolveManagedCodexAppServerStartOptions, t as isManagedCodexDesktopCommand, u as resolveMacOSDesktopCodexAppPathCandidates } from "./managed-binary-B6hQ1UKR.mjs";
8
- import { a as readCodexCliAuthFileApiKey, c as resolveCodexAppServerPreparedApiKeyCacheKey, d as waitForCodexDesktopGeneration, f as readCodexDesktopArtifactTreeFingerprint, i as fingerprintTokenAuthProfileCacheKey, n as CODEX_AUTH_JSON_FILENAME, o as readFirstNonEmptyEnv, r as fingerprintApiKeyAuthProfileCacheKey, s as resolveCodexAppServerFallbackApiKeyCacheKey, t as CODEX_APP_SERVER_API_KEY_ENV_VARS, u as isCodexDesktopGenerationCurrent } from "./auth-cache-key-CWpIEtTm.mjs";
9
- import { a as notifyDesktopGenerationDrainChecks, c as retainSharedClientEntry, d as retireSharedCodexAppServerClientIfCurrent, m as waitForUnclaimedSharedClientStartup, n as getCurrentSharedClientEntry, o as ownCodexStartup, r as getSharedCodexAppServerClientState, s as releaseSharedClientEntry, t as createCodexAppServerStartupLifetime, u as retirePendingSharedClientEntryIfUnclaimed } from "./shared-client-lifecycle-4LdC3gM4.mjs";
10
- import { n as resolveCodexAppServerSpawnEnv } from "./transport-stdio-CbutOIEh.mjs";
7
+ import { d as resolveMacOSDesktopCodexBundledMarketplaceCandidates, f as resolveMacOSDesktopCodexComputerUseServiceAppCandidates, i as resolveManagedCodexNativeCommand, l as resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath, r as resolveManagedCodexAppServerStartOptions, t as isManagedCodexDesktopCommand, u as resolveMacOSDesktopCodexAppPathCandidates } from "./managed-binary-Ckgvm_4V.mjs";
8
+ import { a as readCodexCliAuthFileApiKey, c as resolveCodexAppServerPreparedApiKeyCacheKey, d as waitForCodexDesktopGeneration, f as readCodexDesktopArtifactTreeFingerprint, i as fingerprintTokenAuthProfileCacheKey, n as CODEX_AUTH_JSON_FILENAME, o as readFirstNonEmptyEnv, r as fingerprintApiKeyAuthProfileCacheKey, s as resolveCodexAppServerFallbackApiKeyCacheKey, t as CODEX_APP_SERVER_API_KEY_ENV_VARS, u as isCodexDesktopGenerationCurrent } from "./auth-cache-key-CskfconU.mjs";
9
+ import { a as notifyDesktopGenerationDrainChecks, c as releaseSharedClientEntry, d as retirePendingSharedClientEntryIfUnclaimed, f as retireSharedCodexAppServerClientIfCurrent, h as waitForUnclaimedSharedClientStartup, l as retainSharedClientEntry, n as getCurrentSharedClientEntry, o as ownCodexStartup, r as getSharedCodexAppServerClientState, s as refreshSharedClientIdleRetirement, t as createCodexAppServerStartupLifetime } from "./shared-client-lifecycle-BH_y_i8l.mjs";
10
+ import { n as resolveCodexAppServerSpawnEnv } from "./transport-stdio-DU8dIOCj.mjs";
11
11
  import { n as CodexAppServerAuthProfileUnavailableError, r as formatCodexAuthProfileUnavailableMessage } from "./auth-profile-recovery-BREezV0L.mjs";
12
12
  import { i as withTimeout } from "./timeout-CXOfNoaX.mjs";
13
13
  import { n as readCodexSessionMeta } from "./session-catalog-provenance-DoAvktcj.mjs";
14
- import { n as observeCodexCatalogClient } from "./session-catalog-events-DVLgp99B.mjs";
15
- import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-C0NbLms1.mjs";
14
+ import { n as observeCodexCatalogClient } from "./session-catalog-events-r59AxcQ4.mjs";
15
+ import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-DDhvIeUC.mjs";
16
16
  import { a as resolveCodexAppServerAuthProfileStore, i as resolveCodexAppServerAuthProfileIdForAgent, r as resolveCodexAppServerAuthProfileId, t as isCodexAppServerNativeAuthProfile } from "./auth-profile-B0okYl2D.mjs";
17
17
  import { i as isCodexResponsesOAuthCredential, n as createCodexResponsesOAuth, o as resolveCodexResponsesOAuthProfileFingerprint, r as isCodexResponsesOAuth, t as CODEX_RESPONSES_OAUTH_PROVIDER } from "./responses-oauth-twnuTaAa.mjs";
18
- import { f as isUnsupportedCodexAppServerVersionError, t as CodexAppServerClient } from "./client-6GbdZFc0.mjs";
19
- import { n as isCodexWebSocketOpenFailure } from "./transport-websocket-BTBE-LD9.mjs";
20
- import { t as __exportAll } from "./session-binding-sidecars-jo6H8dFr.mjs";
18
+ import { f as isUnsupportedCodexAppServerVersionError, t as CodexAppServerClient } from "./client-DcTISXe3.mjs";
19
+ import { n as isCodexWebSocketOpenFailure } from "./transport-websocket-zu3jRPnu.mjs";
20
+ import { t as __exportAll } from "./session-binding-sidecars-BuEALwJY.mjs";
21
21
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
22
22
  import { createHash, randomUUID } from "node:crypto";
23
23
  import { isDeepStrictEqual } from "node:util";
@@ -1631,6 +1631,36 @@ function resolveExplicitChatgptAccountId(credential) {
1631
1631
  }
1632
1632
  }
1633
1633
  //#endregion
1634
+ //#region extensions/codex/src/app-server/client-thread-closure.ts
1635
+ const MAX_CLOSED_THREAD_RECEIPTS = 256;
1636
+ const closureState = defineCodexBuildState("openclaw.codexAppServerClosedThreads", () => ({
1637
+ closedThreadsByClient: /* @__PURE__ */ new WeakMap(),
1638
+ observedClients: /* @__PURE__ */ new WeakSet()
1639
+ }))();
1640
+ function recordCodexAppServerThreadClosed(client, threadId) {
1641
+ const receipts = closureState.closedThreadsByClient.get(client) ?? /* @__PURE__ */ new Set();
1642
+ receipts.delete(threadId);
1643
+ receipts.add(threadId);
1644
+ while (receipts.size > MAX_CLOSED_THREAD_RECEIPTS) receipts.delete(receipts.values().next().value);
1645
+ closureState.closedThreadsByClient.set(client, receipts);
1646
+ }
1647
+ function ensureCodexAppServerThreadClosureTracking(client) {
1648
+ if (closureState.observedClients.has(client)) return;
1649
+ closureState.observedClients.add(client);
1650
+ client.addNotificationHandler((notification) => {
1651
+ const params = notification.params;
1652
+ const threadId = typeof params === "object" && params !== null && "threadId" in params ? params.threadId : void 0;
1653
+ if (notification.method === "thread/closed" && typeof threadId === "string") recordCodexAppServerThreadClosed(client, threadId);
1654
+ });
1655
+ client.addCloseHandler(() => closureState.closedThreadsByClient.delete(client));
1656
+ }
1657
+ function clearCodexAppServerThreadClosed(client, threadId) {
1658
+ closureState.closedThreadsByClient.get(client)?.delete(threadId);
1659
+ }
1660
+ function wasCodexAppServerThreadClosed(client, threadId) {
1661
+ return closureState.closedThreadsByClient.get(client)?.has(threadId) === true;
1662
+ }
1663
+ //#endregion
1634
1664
  //#region extensions/codex/src/app-server/client-thread-owner.ts
1635
1665
  function createThreadOwnerToken(threadId, onInvalidated) {
1636
1666
  const owner = {
@@ -1705,6 +1735,24 @@ function createCodexEphemeralThreadPolicy({ developerInstructions, skillsInstruc
1705
1735
  };
1706
1736
  }
1707
1737
  //#endregion
1738
+ //#region extensions/codex/src/app-server/client-workspace-references.ts
1739
+ /** Record accepted input without clearing a compaction observed during turn/start. */
1740
+ function prepareCodexWorkspaceReference(runtime, threadId, reference) {
1741
+ const digest = createHash("sha256").update(reference ?? "").digest("hex");
1742
+ const previous = runtime?.workspaceReferences.get(threadId) ?? { needsReintroduction: true };
1743
+ if (runtime && !runtime.closed) runtime.workspaceReferences.set(threadId, previous);
1744
+ return {
1745
+ include: previous.needsReintroduction || previous.digest !== digest,
1746
+ accepted: () => {
1747
+ if (!runtime || runtime.closed || runtime.workspaceReferences.get(threadId) !== previous) return;
1748
+ runtime.workspaceReferences.set(threadId, {
1749
+ digest,
1750
+ needsReintroduction: false
1751
+ });
1752
+ }
1753
+ };
1754
+ }
1755
+ //#endregion
1708
1756
  //#region extensions/codex/src/app-server/rate-limit-cache.ts
1709
1757
  const DEFAULT_CODEX_RATE_LIMIT_CACHE_MAX_AGE_MS = 6e5;
1710
1758
  const SPARSE_ACCOUNT_METADATA_KEYS = [
@@ -1829,20 +1877,7 @@ function forgetCodexWorkspaceReferences(client, threadId) {
1829
1877
  }
1830
1878
  /** Record accepted input without clearing a compaction observed during turn/start. */
1831
1879
  function prepareCodexWorkspaceReferences(client, threadId, reference) {
1832
- const runtime = configuredClients.get(client);
1833
- const digest = createHash("sha256").update(reference ?? "").digest("hex");
1834
- const previous = runtime?.workspaceReferences.get(threadId) ?? { needsReintroduction: true };
1835
- if (runtime && !runtime.closed) runtime.workspaceReferences.set(threadId, previous);
1836
- return {
1837
- include: previous.needsReintroduction || previous.digest !== digest,
1838
- accepted: () => {
1839
- if (!runtime || runtime.closed || runtime.workspaceReferences.get(threadId) !== previous) return;
1840
- runtime.workspaceReferences.set(threadId, {
1841
- digest,
1842
- needsReintroduction: false
1843
- });
1844
- }
1845
- };
1880
+ return prepareCodexWorkspaceReference(configuredClients.get(client), threadId, reference);
1846
1881
  }
1847
1882
  /** Immutable declarations are data owned by this physical client, never retained executors. */
1848
1883
  async function readCodexClientSessionMeta(client, sessionsRoot, boundRolloutPath, threadId) {
@@ -1871,7 +1906,7 @@ async function readCodexClientSessionMeta(client, sessionsRoot, boundRolloutPath
1871
1906
  return structuredClone(metadata);
1872
1907
  }
1873
1908
  /** Installs one auth-refresh handler and one rate-limit observer per physical client. */
1874
- function ensureCodexAppServerClientRuntime(client, context) {
1909
+ function ensureCodexAppServerClientRuntime(client, context, onThreadOwnershipChange) {
1875
1910
  const existing = configuredClients.get(client);
1876
1911
  if (existing) {
1877
1912
  if (existing.closed) return;
@@ -1883,6 +1918,7 @@ function ensureCodexAppServerClientRuntime(client, context) {
1883
1918
  }
1884
1919
  const runtime = {
1885
1920
  context,
1921
+ onThreadOwnershipChange,
1886
1922
  closed: false,
1887
1923
  retainedThreads: /* @__PURE__ */ new Map(),
1888
1924
  claimedThreads: /* @__PURE__ */ new Map(),
@@ -1892,6 +1928,7 @@ function ensureCodexAppServerClientRuntime(client, context) {
1892
1928
  workspaceReferences: /* @__PURE__ */ new Map()
1893
1929
  };
1894
1930
  configuredClients.set(client, runtime);
1931
+ ensureCodexAppServerThreadClosureTracking(client);
1895
1932
  client.addCloseHandler(() => {
1896
1933
  runtime.closed = true;
1897
1934
  if (runtime.evictionTimer) {
@@ -1953,17 +1990,16 @@ function ensureCodexAppServerClientRuntime(client, context) {
1953
1990
  invalidateThreadOwnership(runtime, threadId);
1954
1991
  runtime.sessionMetadata.delete(threadId);
1955
1992
  runtime.workspaceReferences.delete(threadId);
1956
- scheduleRetainedThreadEviction(client, runtime);
1993
+ updateThreadOwnership(client, runtime);
1957
1994
  }
1958
1995
  }
1959
1996
  });
1960
1997
  }
1961
- function scheduleRetainedThreadEviction(client, runtime) {
1962
- if (runtime.evictionTimer) {
1963
- clearTimeout(runtime.evictionTimer);
1964
- runtime.evictionTimer = void 0;
1965
- }
1998
+ function updateThreadOwnership(client, runtime) {
1999
+ clearTimeout(runtime.evictionTimer);
2000
+ runtime.evictionTimer = void 0;
1966
2001
  if (runtime.closed) return;
2002
+ runtime.onThreadOwnershipChange?.();
1967
2003
  let expiresAt = Number.POSITIVE_INFINITY;
1968
2004
  for (const [threadId, thread] of runtime.retainedThreads) if (!runtime.protectedThreads.has(threadId)) expiresAt = Math.min(expiresAt, thread.expiresAt);
1969
2005
  if (!Number.isFinite(expiresAt)) return;
@@ -1990,7 +2026,6 @@ async function releaseRetainedThread(client, runtime, threadId, assertCurrent) {
1990
2026
  olderThreadIds.add(candidateThreadId);
1991
2027
  }
1992
2028
  runtime.retainedThreads.delete(threadId);
1993
- scheduleRetainedThreadEviction(client, runtime);
1994
2029
  const transition = {
1995
2030
  retainedOwnerToken: retained.ownerToken,
1996
2031
  completion: Promise.resolve().then(() => {
@@ -1999,6 +2034,7 @@ async function releaseRetainedThread(client, runtime, threadId, assertCurrent) {
1999
2034
  })
2000
2035
  };
2001
2036
  runtime.releasingThreads.set(threadId, transition);
2037
+ updateThreadOwnership(client, runtime);
2002
2038
  try {
2003
2039
  await transition.completion;
2004
2040
  runtime.workspaceReferences.delete(threadId);
@@ -2015,13 +2051,13 @@ async function releaseRetainedThread(client, runtime, threadId, assertCurrent) {
2015
2051
  throw error;
2016
2052
  } finally {
2017
2053
  if (runtime.releasingThreads.get(threadId) === transition) runtime.releasingThreads.delete(threadId);
2018
- scheduleRetainedThreadEviction(client, runtime);
2054
+ updateThreadOwnership(client, runtime);
2019
2055
  }
2020
2056
  }
2021
2057
  async function evictExpiredRetainedThreads(client, runtime) {
2022
2058
  const now = Date.now();
2023
2059
  for (const [threadId, thread] of runtime.retainedThreads) if (thread.expiresAt <= now && !runtime.protectedThreads.has(threadId)) await releaseRetainedThread(client, runtime, threadId);
2024
- scheduleRetainedThreadEviction(client, runtime);
2060
+ updateThreadOwnership(client, runtime);
2025
2061
  }
2026
2062
  async function evictExcessIdleThreads(client, runtime) {
2027
2063
  const idleThreads = () => [...runtime.retainedThreads].filter(([threadId, thread]) => thread.ephemeralPolicy === void 0 && !runtime.protectedThreads.has(threadId));
@@ -2044,6 +2080,7 @@ async function retainCodexAppServerLiveThread(client, threadId, releaseThread, c
2044
2080
  return false;
2045
2081
  }
2046
2082
  const previousOwner = runtime.retainedThreads.get(threadId)?.ownerToken;
2083
+ clearCodexAppServerThreadClosed(client, threadId);
2047
2084
  runtime.retainedThreads.delete(threadId);
2048
2085
  const retained = {
2049
2086
  ownerToken,
@@ -2061,7 +2098,7 @@ async function retainCodexAppServerLiveThread(client, threadId, releaseThread, c
2061
2098
  await evictExcessIdleThreads(client, runtime);
2062
2099
  } catch (error) {
2063
2100
  if (runtime.retainedThreads.get(threadId) === retained) runtime.retainedThreads.delete(threadId);
2064
- scheduleRetainedThreadEviction(client, runtime);
2101
+ updateThreadOwnership(client, runtime);
2065
2102
  embeddedAgentLog$1.warn("codex retained thread capacity eviction failed", {
2066
2103
  threadId,
2067
2104
  reason: formatErrorMessage$1(error)
@@ -2070,7 +2107,7 @@ async function retainCodexAppServerLiveThread(client, threadId, releaseThread, c
2070
2107
  }
2071
2108
  if (runtime.closed) return false;
2072
2109
  if (claimed !== void 0 && runtime.claimedThreads.get(threadId) === claimed) runtime.claimedThreads.delete(threadId);
2073
- scheduleRetainedThreadEviction(client, runtime);
2110
+ updateThreadOwnership(client, runtime);
2074
2111
  return true;
2075
2112
  }
2076
2113
  /** Transfer one idle subscription to its next turn or compaction without touching sibling threads. */
@@ -2109,7 +2146,7 @@ function claimCodexAppServerThreadOwnership(client, runtime, threadId, retained,
2109
2146
  runtime.claimedThreads.set(threadId, claimed);
2110
2147
  previousClaim?.invalidate();
2111
2148
  retained.ownerToken?.invalidate();
2112
- scheduleRetainedThreadEviction(client, runtime);
2149
+ updateThreadOwnership(client, runtime);
2113
2150
  const assertCurrent = () => {
2114
2151
  if (claimed.invalidated || runtime.closed || runtime.claimedThreads.get(threadId) !== claimed) throw new Error(`Codex thread subscription ownership changed: ${threadId}`);
2115
2152
  };
@@ -2150,6 +2187,7 @@ function claimCodexAppServerThreadOwnership(client, runtime, threadId, retained,
2150
2187
  }
2151
2188
  } finally {
2152
2189
  if (runtime.releasingThreads.get(threadId) === transition) runtime.releasingThreads.delete(threadId);
2190
+ updateThreadOwnership(client, runtime);
2153
2191
  }
2154
2192
  };
2155
2193
  physicalThreadReleases.set(release, retained.release);
@@ -2163,7 +2201,7 @@ function claimCodexAppServerThreadOwnership(client, runtime, threadId, retained,
2163
2201
  forget: () => {
2164
2202
  if (forgetThreadOwnership(runtime, threadId, claimed)) {
2165
2203
  runtime.workspaceReferences.delete(threadId);
2166
- scheduleRetainedThreadEviction(client, runtime);
2204
+ updateThreadOwnership(client, runtime);
2167
2205
  }
2168
2206
  }
2169
2207
  };
@@ -2173,6 +2211,11 @@ function revertCodexAppServerLiveThreadSkillsCatalog(client, threadId) {
2173
2211
  const runtime = configuredClients.get(client);
2174
2212
  if (runtime && !runtime.closed) revertRetainedThreadSkillsCatalog(runtime, threadId);
2175
2213
  }
2214
+ /** Native subscriptions, including ephemeral history and releases, pin their physical client. */
2215
+ function hasCodexAppServerThreadOwnership(client) {
2216
+ const runtime = configuredClients.get(client);
2217
+ return Boolean(runtime && !runtime.closed && (runtime.retainedThreads.size > 0 || runtime.claimedThreads.size > 0 || runtime.releasingThreads.size > 0 || runtime.protectedThreads.size > 0));
2218
+ }
2176
2219
  /** Distinguish active claimed ownership from an already-evicted idle subscription. */
2177
2220
  function hasCodexAppServerLiveThread(client, threadId) {
2178
2221
  return hasThreadOwnership(configuredClients.get(client), threadId);
@@ -2216,20 +2259,24 @@ async function unsubscribeCodexAppServerLiveThread(client, threadId, timeoutMs,
2216
2259
  physicalRelease
2217
2260
  };
2218
2261
  runtime.releasingThreads.set(threadId, transition);
2262
+ updateThreadOwnership(client, runtime);
2219
2263
  }
2220
2264
  try {
2221
2265
  await physicalRelease;
2222
2266
  if (retained !== void 0 && runtime?.retainedThreads.get(threadId) === retained) {
2223
2267
  runtime.retainedThreads.delete(threadId);
2224
2268
  retained.ownerToken?.invalidate();
2225
- scheduleRetainedThreadEviction(client, runtime);
2269
+ updateThreadOwnership(client, runtime);
2226
2270
  }
2227
2271
  if (claimed !== void 0 && runtime?.claimedThreads.get(threadId) === claimed) {
2228
2272
  runtime.claimedThreads.delete(threadId);
2229
2273
  claimed.invalidate();
2230
2274
  }
2231
2275
  } finally {
2232
- if (ownsTransition && runtime.releasingThreads.get(threadId) === transition) runtime.releasingThreads.delete(threadId);
2276
+ if (ownsTransition && runtime.releasingThreads.get(threadId) === transition) {
2277
+ runtime.releasingThreads.delete(threadId);
2278
+ updateThreadOwnership(client, runtime);
2279
+ }
2233
2280
  }
2234
2281
  }
2235
2282
  /** Reset/end owns the exact thread; failed generation retirement must never release its successor. */
@@ -2242,7 +2289,7 @@ function protectCodexAppServerLiveThread(client, threadId) {
2242
2289
  const runtime = configuredClients.get(client);
2243
2290
  if (!runtime || runtime.closed) return () => void 0;
2244
2291
  runtime.protectedThreads.set(threadId, (runtime.protectedThreads.get(threadId) ?? 0) + 1);
2245
- scheduleRetainedThreadEviction(client, runtime);
2292
+ updateThreadOwnership(client, runtime);
2246
2293
  let protectedThread = true;
2247
2294
  return () => {
2248
2295
  if (!protectedThread) return;
@@ -2258,7 +2305,7 @@ function protectCodexAppServerLiveThread(client, threadId) {
2258
2305
  runtime.retainedThreads.set(threadId, retained);
2259
2306
  }
2260
2307
  } else runtime.protectedThreads.set(threadId, count - 1);
2261
- scheduleRetainedThreadEviction(client, runtime);
2308
+ updateThreadOwnership(client, runtime);
2262
2309
  evictExcessIdleThreads(client, runtime).catch((error) => {
2263
2310
  embeddedAgentLog$1.warn("codex retained thread unpin eviction failed", {
2264
2311
  threadId,
@@ -2521,7 +2568,7 @@ async function prepareCodexInferenceRoute(params) {
2521
2568
  }
2522
2569
  pending = Promise.all([
2523
2570
  import("./inference-proxy-DhcXOgUE.mjs"),
2524
- import("./native-subagent-monitor-DbNIloTJ.mjs").then((n) => n.n),
2571
+ import("./native-subagent-monitor-g-ZDkvCr.mjs").then((n) => n.n),
2525
2572
  import("./inference-dispatch-CMZtjQyz.mjs")
2526
2573
  ]).then(([{ createCodexInferenceProxy }, native, { createCodexInferenceModelBinding }]) => {
2527
2574
  assertClient();
@@ -3208,7 +3255,10 @@ function createSharedCodexAppServerClientStartup(params) {
3208
3255
  }).then((client) => {
3209
3256
  const state = getSharedCodexAppServerClientState();
3210
3257
  params.entry.client = client;
3258
+ params.entry.hasOwnedThreads = () => hasCodexAppServerThreadOwnership(client);
3211
3259
  client.addCloseHandler((closedClient) => {
3260
+ clearTimeout(params.entry.idleTimer);
3261
+ params.entry.idleTimer = void 0;
3212
3262
  const entry = getCurrentSharedClientEntry(closedClient);
3213
3263
  if (entry) state.clients.delete(entry.key);
3214
3264
  });
@@ -3312,7 +3362,7 @@ async function startInitializedCodexAppServerClientOnce(params) {
3312
3362
  } finally {
3313
3363
  artifactDrain?.cancel();
3314
3364
  }
3315
- const runtimeArtifactModule = params.runtimeArtifactMode ? await import("./runtime-artifact-D7lCXdhV.mjs") : void 0;
3365
+ const runtimeArtifactModule = params.runtimeArtifactMode ? await import("./runtime-artifact-Riq878B2.mjs") : void 0;
3316
3366
  const runtimeArtifactBeforeStart = runtimeArtifactModule ? await runtimeArtifactModule.captureCodexAppServerRuntimeArtifactBeforeStart({
3317
3367
  startOptions,
3318
3368
  spawnIdentity: resolveCodexAppServerSpawnIdentity(startOptions),
@@ -3383,7 +3433,7 @@ async function startInitializedCodexAppServerClientOnce(params) {
3383
3433
  ...params.authProfileStore ? { authProfileStore: params.authProfileStore } : {},
3384
3434
  config: params.config,
3385
3435
  onAuthRefreshFailure: () => retireSharedCodexAppServerClientIfCurrent(client)
3386
- });
3436
+ }, () => refreshSharedClientIdleRetirement(client));
3387
3437
  assertStartupCurrent();
3388
3438
  const authHandoff = await waitForStartup(() => applyCodexAppServerAuthProfile({
3389
3439
  client,
@@ -3588,4 +3638,4 @@ function closeSharedClientEntryIfUnclaimed(entry) {
3588
3638
  return Boolean(entry.client);
3589
3639
  }
3590
3640
  //#endregion
3591
- export { createCodexEphemeralThreadPolicy as $, bindCodexInferenceThread as A, isCodexAppServerClientRuntimeLive as B, CodexThreadBindingConflictError as C, nativeHookRelayUnregisterQueue as D, isCodexContextRestartSelectionChangedError as E, consumeCodexAppServerLiveThread as F, readCodexClientSessionMeta as G, isCodexAppServerLiveThreadProtected as H, ensureCodexAppServerClientRuntime as I, revertCodexAppServerLiveThreadSkillsCatalog as J, releaseCodexAppServerLiveThread as K, forgetCodexWorkspaceReferences as L, getCodexInferenceThreadQualification as M, prepareCodexInferenceThreadConfig as N, acquireCodexNativeConfigFence as O, claimCodexAppServerLiveThread as P, rememberCodexRateLimitsRead as Q, hasCodexAppServerLiveThread as R, CodexAdoptedThreadActiveError as S, CodexThreadStartRequestError as T, prepareCodexWorkspaceReferences as U, isCodexAppServerLiveThreadClaimed as V, protectCodexAppServerLiveThread as W, readCodexRateLimitsRevision as X, unsubscribeCodexAppServerLiveThread as Y, readRecentCodexRateLimits as Z, retainSharedCodexAppServerClientIfCurrent as _, clearSharedCodexAppServerClientIfCurrentAndUnclaimed as a, hasLegacyCodexComputerUseMcpPolicy as at, withLeasedCodexAppServerClientStartSelectionRetry as b, getLeasedSharedCodexAppServerClient as c, ensureCodexComputerUseSharedPluginCache as ct, readCodexAppServerClientDesktopGeneration as d, TURN_FINALIZE_DRAIN_ABORT_GRACE_MS as dt, reconcileCodexComputerUseStartArtifacts as et, readCodexAppServerClientDesktopGenerationFingerprint as f, TURN_TERMINAL_SETTLEMENT_TIMEOUT_MS as ft, resolveCodexNativeConfigFenceKey as g, withCodexStartupTimeout as gt, releaseLeasedSharedCodexAppServerClient as h, resolveCodexStartupTimeoutMs as ht, clearSharedCodexAppServerClientIfCurrent as i, resolveClientManagedBundledMarketplacePath as it, getCodexInferenceThread as j, assertCodexInferenceRouteConfig as k, getSharedCodexAppServerClient as l, assertNotSymlink as lt, releaseCodexAppServerClientLease as m, resolveCodexGatewayTimeoutWithGraceMs as mt, captureCodexAppServerClientLifetime as n, resolveCodexAppServerPreparedAuthHandoff as nt, clearSharedCodexAppServerClientIfCurrentAndWait as o, isLegacyCodexComputerUsePluginDisabled as ot, readCodexAppServerClientProcessIdentity as p, isCodexAppServerStartupError as pt, retainCodexAppServerLiveThread as q, captureSharedCodexAppServerCatalogLifetime as r, resolveBundledComputerUseMarketplacePath as rt, createIsolatedCodexAppServerClient as s, resolveManagedCodexComputerUseConfig as st, assertCodexAppServerClientStartSelectionCurrent as t, resolveCodexAppServerAuthAccountCacheKey as tt, isCodexAppServerStartSelectionChangedError as u, CodexAppServerStartupError as ut, shared_client_exports as v, CodexThreadClientReplacementError as w, CODEX_APP_SERVER_CONTEXT_RESTART_SELECTION_CHANGED as x, waitForCodexAppServerClientDesktopGenerationDrain as y, hasCodexAppServerSiblingThreadWork as z };
3641
+ export { createCodexEphemeralThreadPolicy as $, bindCodexInferenceThread as A, isCodexAppServerClientRuntimeLive as B, CodexThreadBindingConflictError as C, nativeHookRelayUnregisterQueue as D, isCodexContextRestartSelectionChangedError as E, consumeCodexAppServerLiveThread as F, readCodexClientSessionMeta as G, isCodexAppServerLiveThreadProtected as H, ensureCodexAppServerClientRuntime as I, revertCodexAppServerLiveThreadSkillsCatalog as J, releaseCodexAppServerLiveThread as K, forgetCodexWorkspaceReferences as L, getCodexInferenceThreadQualification as M, prepareCodexInferenceThreadConfig as N, acquireCodexNativeConfigFence as O, claimCodexAppServerLiveThread as P, rememberCodexRateLimitsRead as Q, hasCodexAppServerLiveThread as R, CodexAdoptedThreadActiveError as S, CodexThreadStartRequestError as T, prepareCodexWorkspaceReferences as U, isCodexAppServerLiveThreadClaimed as V, protectCodexAppServerLiveThread as W, readCodexRateLimitsRevision as X, unsubscribeCodexAppServerLiveThread as Y, readRecentCodexRateLimits as Z, retainSharedCodexAppServerClientIfCurrent as _, withCodexStartupTimeout as _t, clearSharedCodexAppServerClientIfCurrentAndUnclaimed as a, resolveClientManagedBundledMarketplacePath as at, withLeasedCodexAppServerClientStartSelectionRetry as b, getLeasedSharedCodexAppServerClient as c, resolveManagedCodexComputerUseConfig as ct, readCodexAppServerClientDesktopGeneration as d, CodexAppServerStartupError as dt, wasCodexAppServerThreadClosed as et, readCodexAppServerClientDesktopGenerationFingerprint as f, TURN_FINALIZE_DRAIN_ABORT_GRACE_MS as ft, resolveCodexNativeConfigFenceKey as g, resolveCodexStartupTimeoutMs as gt, releaseLeasedSharedCodexAppServerClient as h, resolveCodexGatewayTimeoutWithGraceMs as ht, clearSharedCodexAppServerClientIfCurrent as i, resolveBundledComputerUseMarketplacePath as it, getCodexInferenceThread as j, assertCodexInferenceRouteConfig as k, getSharedCodexAppServerClient as l, ensureCodexComputerUseSharedPluginCache as lt, releaseCodexAppServerClientLease as m, isCodexAppServerStartupError as mt, captureCodexAppServerClientLifetime as n, resolveCodexAppServerAuthAccountCacheKey as nt, clearSharedCodexAppServerClientIfCurrentAndWait as o, hasLegacyCodexComputerUseMcpPolicy as ot, readCodexAppServerClientProcessIdentity as p, TURN_TERMINAL_SETTLEMENT_TIMEOUT_MS as pt, retainCodexAppServerLiveThread as q, captureSharedCodexAppServerCatalogLifetime as r, resolveCodexAppServerPreparedAuthHandoff as rt, createIsolatedCodexAppServerClient as s, isLegacyCodexComputerUsePluginDisabled as st, assertCodexAppServerClientStartSelectionCurrent as t, reconcileCodexComputerUseStartArtifacts as tt, isCodexAppServerStartSelectionChangedError as u, assertNotSymlink as ut, shared_client_exports as v, CodexThreadClientReplacementError as w, CODEX_APP_SERVER_CONTEXT_RESTART_SELECTION_CHANGED as x, waitForCodexAppServerClientDesktopGenerationDrain as y, hasCodexAppServerSiblingThreadWork as z };
@@ -1,4 +1,4 @@
1
- import { n as defineCodexBuildState } from "./build-state-E-CRUdgh.mjs";
1
+ import { n as defineCodexBuildState } from "./build-state-B3lvV1Op.mjs";
2
2
  //#region extensions/codex/src/app-server/shared-client-lifecycle.ts
3
3
  /** Client ownership and synchronous retirement, independent of startup/auth execution. */
4
4
  const createCodexAppServerStartupLifetime = () => ({
@@ -50,6 +50,7 @@ function retireSharedCodexAppServerClientIfCurrent(client, opts) {
50
50
  const currentEntry = getCurrentSharedClientEntry(client);
51
51
  const entry = currentEntry ?? state.entriesByClient.get(client);
52
52
  if (!entry || entry.client !== client && !entry.closeError) return;
53
+ cancelSharedClientIdleRetirement(entry);
53
54
  if (currentEntry) {
54
55
  state.clients.delete(entry.key);
55
56
  entry.closeWhenIdle = true;
@@ -84,6 +85,7 @@ function closeRetiredSharedClientEntry(entry) {
84
85
  const client = entry.client;
85
86
  if (!client) return false;
86
87
  entry.client = void 0;
88
+ cancelSharedClientIdleRetirement(entry);
87
89
  client.close();
88
90
  return true;
89
91
  }
@@ -135,8 +137,27 @@ async function retainSharedCodexAppServerClientByInstanceId(clientId) {
135
137
  function notifyDesktopGenerationDrainChecks(state) {
136
138
  for (const check of state.desktopGenerationDrainChecks) check();
137
139
  }
140
+ const CODEX_APP_SERVER_CLIENT_IDLE_GRACE_MS = 3e4;
141
+ function cancelSharedClientIdleRetirement(entry) {
142
+ clearTimeout(entry.idleTimer);
143
+ entry.idleTimer = void 0;
144
+ }
145
+ function refreshSharedClientIdleRetirement(client) {
146
+ const entry = getCurrentSharedClientEntry(client);
147
+ if (entry) scheduleSharedClientIdleRetirement(entry);
148
+ }
149
+ function scheduleSharedClientIdleRetirement(entry) {
150
+ cancelSharedClientIdleRetirement(entry);
151
+ if (entry.activeLeases > 0 || entry.pendingAcquires > 0 || !entry.client || entry.hasOwnedThreads?.() || getCurrentSharedClientEntry(entry.client) !== entry) return;
152
+ entry.idleTimer = setTimeout(() => {
153
+ entry.idleTimer = void 0;
154
+ if (entry.activeLeases === 0 && entry.pendingAcquires === 0 && !entry.hasOwnedThreads?.()) retireSharedCodexAppServerClientIfCurrent(entry.client);
155
+ }, CODEX_APP_SERVER_CLIENT_IDLE_GRACE_MS);
156
+ entry.idleTimer.unref?.();
157
+ }
138
158
  function retainSharedClientEntry(entry, counter = "activeLeases") {
139
159
  let released = false;
160
+ cancelSharedClientIdleRetirement(entry);
140
161
  entry[counter] += 1;
141
162
  return () => {
142
163
  if (released) return;
@@ -147,7 +168,8 @@ function retainSharedClientEntry(entry, counter = "activeLeases") {
147
168
  function releaseSharedClientEntry(entry, counter) {
148
169
  entry[counter] -= 1;
149
170
  closeRetiredSharedClientEntryIfIdle(entry);
171
+ scheduleSharedClientIdleRetirement(entry);
150
172
  notifyDesktopGenerationDrainChecks(getSharedCodexAppServerClientState());
151
173
  }
152
174
  //#endregion
153
- export { notifyDesktopGenerationDrainChecks as a, retainSharedClientEntry as c, retireSharedCodexAppServerClientIfCurrent as d, retireSharedCodexAppServerClientsBeforeDesktopGeneration as f, hasActiveSharedCodexAppServerWork as i, retainSharedCodexAppServerClientByInstanceId as l, waitForUnclaimedSharedClientStartup as m, getCurrentSharedClientEntry as n, ownCodexStartup as o, waitForCodexAppServerClientExit as p, getSharedCodexAppServerClientState as r, releaseSharedClientEntry as s, createCodexAppServerStartupLifetime as t, retirePendingSharedClientEntryIfUnclaimed as u };
175
+ export { notifyDesktopGenerationDrainChecks as a, releaseSharedClientEntry as c, retirePendingSharedClientEntryIfUnclaimed as d, retireSharedCodexAppServerClientIfCurrent as f, waitForUnclaimedSharedClientStartup as h, hasActiveSharedCodexAppServerWork as i, retainSharedClientEntry as l, waitForCodexAppServerClientExit as m, getCurrentSharedClientEntry as n, ownCodexStartup as o, retireSharedCodexAppServerClientsBeforeDesktopGeneration as p, getSharedCodexAppServerClientState as r, refreshSharedClientIdleRetirement as s, createCodexAppServerStartupLifetime as t, retainSharedCodexAppServerClientByInstanceId as u };