@makaio/framework 1.0.0-dev-1785409369816 → 1.0.0-dev-1787670071418

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 (549) hide show
  1. package/README.md +2 -0
  2. package/dist/.makaio-build.json +4 -3
  3. package/dist/{account-identity-DFx8pwKL.mjs → account-identity-B3vLwm9O.mjs} +1 -1
  4. package/dist/adapter-Dz1fX5Wa.mjs +1 -0
  5. package/dist/adapter-subsystem/index.d.mts +194 -20
  6. package/dist/adapter-subsystem/index.mjs +1 -1
  7. package/dist/adapters/acp-client/index.d.mts +105 -7
  8. package/dist/adapters/acp-client/index.mjs +2 -2
  9. package/dist/adapters/claude/index.d.mts +5 -5
  10. package/dist/adapters/config/index.d.mts +1 -1
  11. package/dist/adapters/config/index.mjs +1 -1
  12. package/dist/adapters/index.d.mts +405 -824
  13. package/dist/adapters/index.mjs +6 -6
  14. package/dist/adapters/node.d.mts +1 -1
  15. package/dist/adapters/node.mjs +1 -1
  16. package/dist/adapters/stream-session/index.d.mts +28 -7
  17. package/dist/adapters/stream-session/index.mjs +1 -1
  18. package/dist/{ajv-DD3SIL2i.mjs → ajv-krzJXh1X.mjs} +2 -2
  19. package/dist/artifact-Btbuib48.mjs +1 -0
  20. package/dist/attach-error-Cb3GbeKe.mjs +1 -0
  21. package/dist/{auth-DGEdiHF6.mjs → auth-C6tVtaOX.mjs} +1 -1
  22. package/dist/authority-state-bootstrap-CLYus369.mjs +1 -0
  23. package/dist/automation-trigger-ByjNlClm.mjs +1 -0
  24. package/dist/await-trigger-Bkg2BQfg.mjs +1 -0
  25. package/dist/bus/index.d.mts +41 -9
  26. package/dist/bus/index.mjs +1 -1
  27. package/dist/bus-D6NoBhIV.mjs +2 -0
  28. package/dist/bus-UgFdHybD.mjs +1 -0
  29. package/dist/caller-owned-adapter-stub-C1M7FKrv.mjs +1 -0
  30. package/dist/{canonical-model-BAytQ4NV.mjs → canonical-model-DXOvCaVg.mjs} +1 -1
  31. package/dist/capabilities-BUwuA7XX.mjs +1 -0
  32. package/dist/capability-j3NekkIu.mjs +1 -0
  33. package/dist/{client-DbS847wW.mjs → client-BkznbdsO.mjs} +1 -1
  34. package/dist/clients/index.d.mts +2 -2
  35. package/dist/clients/index.mjs +1 -1
  36. package/dist/clients/managed-install.d.mts +1 -1
  37. package/dist/clients/managed-install.mjs +1 -1
  38. package/dist/code-execution/worker-entry.d.mts +21 -0
  39. package/dist/code-execution/worker-entry.mjs +1 -0
  40. package/dist/code-execution-Ckmn8OZu.mjs +1 -0
  41. package/dist/code-execution-CweDSWco.mjs +1 -0
  42. package/dist/code-execution-DqkQjKa1.mjs +1 -0
  43. package/dist/{compression-74fFeBha.mjs → compression-CtgeVLpP.mjs} +1 -1
  44. package/dist/{config-namespace-TVX-hG4I.mjs → config-namespace-CjWvw8ij.mjs} +1 -1
  45. package/dist/{context-resolution-DdyhpH4L.d.mts → context-resolution-841T7jBI.d.mts} +11 -11
  46. package/dist/contracts/adapter/index.d.mts +3 -3
  47. package/dist/contracts/adapter/index.mjs +1 -1
  48. package/dist/contracts/adapter/schemas/session-lineage.d.mts +1 -1
  49. package/dist/contracts/artifact/index.d.mts +3 -3
  50. package/dist/contracts/artifact/index.mjs +1 -1
  51. package/dist/contracts/auth/index.d.mts +2 -2
  52. package/dist/contracts/auth/index.mjs +1 -1
  53. package/dist/contracts/automation-trigger/index.d.mts +4 -0
  54. package/dist/contracts/automation-trigger/index.mjs +1 -0
  55. package/dist/contracts/canonical-model/index.d.mts +1 -1
  56. package/dist/contracts/canonical-model/index.mjs +1 -1
  57. package/dist/contracts/capabilities/index.d.mts +1 -1
  58. package/dist/contracts/capabilities/index.mjs +1 -1
  59. package/dist/contracts/client/index.d.mts +2 -2
  60. package/dist/contracts/client/index.mjs +1 -1
  61. package/dist/contracts/code-execution/index.d.mts +2 -0
  62. package/dist/contracts/code-execution/index.mjs +1 -0
  63. package/dist/contracts/common/index.d.mts +1 -1
  64. package/dist/contracts/config/index.d.mts +1 -1
  65. package/dist/contracts/config/index.mjs +1 -1
  66. package/dist/contracts/extension/index.d.mts +6 -5
  67. package/dist/contracts/extension/index.mjs +1 -1
  68. package/dist/contracts/facet/index.d.mts +1 -1
  69. package/dist/contracts/facet/index.mjs +1 -1
  70. package/dist/contracts/harness/index.d.mts +1 -1
  71. package/dist/contracts/harness/index.mjs +1 -1
  72. package/dist/contracts/host/index.d.mts +1 -1
  73. package/dist/contracts/host/index.mjs +1 -1
  74. package/dist/contracts/index.d.mts +171 -100
  75. package/dist/contracts/index.mjs +1 -1
  76. package/dist/contracts/materialization/index.d.mts +3 -3
  77. package/dist/contracts/materialization/index.mjs +1 -1
  78. package/dist/contracts/model-registry/index.d.mts +1 -1
  79. package/dist/contracts/model-registry/index.mjs +1 -1
  80. package/dist/contracts/native-session-supervisor/index.d.mts +1 -1
  81. package/dist/contracts/native-session-supervisor/index.mjs +1 -1
  82. package/dist/contracts/platform/index.d.mts +1 -1
  83. package/dist/contracts/platform/index.mjs +1 -1
  84. package/dist/contracts/provider/index.d.mts +2 -2
  85. package/dist/contracts/provider/index.mjs +1 -1
  86. package/dist/contracts/reaction/index.d.mts +2 -0
  87. package/dist/contracts/reaction/index.mjs +1 -0
  88. package/dist/contracts/session/index.d.mts +3 -3
  89. package/dist/contracts/session/index.mjs +1 -1
  90. package/dist/contracts/shared/index.d.mts +3 -3
  91. package/dist/contracts/shared/index.mjs +1 -1
  92. package/dist/contracts/skill/index.d.mts +1 -1
  93. package/dist/contracts/skill/index.mjs +1 -1
  94. package/dist/contracts/telemetry/index.d.mts +1 -1
  95. package/dist/contracts/telemetry/index.mjs +1 -1
  96. package/dist/contracts/timeout/index.d.mts +1 -1
  97. package/dist/contracts/timeout/index.mjs +1 -1
  98. package/dist/contracts/toast/index.mjs +1 -1
  99. package/dist/contracts/variant/index.d.mts +1 -1
  100. package/dist/contracts/variant/index.mjs +1 -1
  101. package/dist/contracts/worker-node/index.d.mts +1 -1
  102. package/dist/contracts/worker-node/index.mjs +1 -1
  103. package/dist/contracts/workflow/index.d.mts +3 -3
  104. package/dist/contracts/workflow/index.mjs +1 -1
  105. package/dist/contribution-CUHLVLsT.d.mts +35 -0
  106. package/dist/core/index.d.mts +84 -2
  107. package/dist/core/index.mjs +1 -1
  108. package/dist/{definition-CJfiv8xm.mjs → definition-BH4QLGLI.mjs} +1 -1
  109. package/dist/definition-DyGImhyi.d.mts +375 -0
  110. package/dist/{detached-extension-handle-Ddfquy5_.mjs → detached-extension-handle-D0aI0pJA.mjs} +1 -1
  111. package/dist/drizzle/0031_adapter_session_currency.sql +66 -0
  112. package/dist/drizzle/0032_native_session_ownership.sql +77 -0
  113. package/dist/drizzle/0033_m_msf3hu2s.sql +1 -0
  114. package/dist/drizzle/0034_m_msha1388.sql +41 -0
  115. package/dist/drizzle/0035_m_mshgj6x7.sql +40 -0
  116. package/dist/drizzle/0036_m_msivwbgm.sql +1 -0
  117. package/dist/drizzle/0037_runtime_instance_incarnation_counter.sql +6 -0
  118. package/dist/drizzle/meta/_journal.json +49 -0
  119. package/dist/event-B8ELuk6k.mjs +1 -0
  120. package/dist/{execution-attempt-repository-DWXKY41_.d.mts → execution-attempt-repository-BJ2W6wwx.d.mts} +1 -1
  121. package/dist/{execution-target-Cf645pDj.mjs → execution-target-H0RWV7Py.mjs} +1 -1
  122. package/dist/extension-Bfkr2DBs.mjs +1 -0
  123. package/dist/extension-Cz39YNXy.mjs +1 -0
  124. package/dist/extension-context-QmFuHdq5.d.mts +295 -0
  125. package/dist/{extension-discovery-CQRdbVQ6.d.mts → extension-discovery-Dhu3WplO.d.mts} +11 -1
  126. package/dist/{extension-namespace-Yu41YepM.mjs → extension-namespace-QoTTwKPt.mjs} +1 -1
  127. package/dist/extension-package-provenance-aYrZuS4W.mjs +1 -0
  128. package/dist/{filesystem-service-DlP2HfDg.mjs → filesystem-service-CiUw0YN5.mjs} +1 -1
  129. package/dist/framework-packages-BHgul8Kl.mjs +1 -0
  130. package/dist/git/index.mjs +2 -2
  131. package/dist/{globby-1yCVCk8s.mjs → globby-QBDqstzq.mjs} +1 -1
  132. package/dist/handlers-BsHAFtye.mjs +57 -0
  133. package/dist/{harness-DpwsFsE7.mjs → harness-YQ2ewID9.mjs} +1 -1
  134. package/dist/{hook-responses-Dh1PWXqJ.d.mts → hook-responses-9Ywsqzzq.d.mts} +2 -293
  135. package/dist/identity-OjRlG6dZ.mjs +1 -0
  136. package/dist/{index-CMgLxw14.d.mts → index-8NdPPzUh2.d.mts} +2 -2
  137. package/dist/{index-Ds5_rDEJ.d.mts → index-8y4hT9WL.d.mts} +1 -12
  138. package/dist/{index-BVlXneHH.d.mts → index-B-3I98nw.d.mts} +14 -10
  139. package/dist/index-B0VO0rAl.d.mts +302 -0
  140. package/dist/{index-gUhidukN.d.mts → index-B0yMCJW8.d.mts} +324 -2
  141. package/dist/index-BM56936c.d.mts +165 -0
  142. package/dist/{index-CLvQsL6s2.d.mts → index-BNzUyVwV.d.mts} +2105 -320
  143. package/dist/{index-BaZeoZoS.d.mts → index-BTEJfzjE.d.mts} +1 -1
  144. package/dist/{index-B0Kf_OWi.d.mts → index-BfV8U4XX.d.mts} +1 -1
  145. package/dist/{index-DCZ8BX9S.d.mts → index-BkbnC65b.d.mts} +487 -85
  146. package/dist/{index-GHASUiem.d.mts → index-BmevAPME2.d.mts} +1 -1
  147. package/dist/index-Bqk0pJBQ2.d.mts +138 -0
  148. package/dist/{index-B9UW_vPM.d.mts → index-C146Eq_J.d.mts} +2465 -273
  149. package/dist/{index-BAXkicoQ.d.mts → index-CIEycZrt.d.mts} +1 -1
  150. package/dist/{index-DkiTJM5p.d.mts → index-CMekqu_D.d.mts} +44 -10
  151. package/dist/{index-SsBHjUqA.d.mts → index-CPRQ4dWX.d.mts} +0 -23
  152. package/dist/{index-EjsSBQXy2.d.mts → index-CPi0UpRh.d.mts} +1 -1
  153. package/dist/{index-DSBT83c0.d.mts → index-CYjgoYeX.d.mts} +24 -3
  154. package/dist/{index-DnG-QFpG.d.mts → index-CmwAJ8-5.d.mts} +18 -1
  155. package/dist/index-Cny5RvjO.d.mts +800 -0
  156. package/dist/{index-BNMnIe-j.d.mts → index-D-4jv_66.d.mts} +434 -863
  157. package/dist/{index-brqfk9JQ.d.mts → index-D8D-yibS2.d.mts} +4 -4
  158. package/dist/index-DHnSLGP4.d.mts +268 -0
  159. package/dist/{index-D5Nb7IEP.d.mts → index-DI2lS7VT.d.mts} +79 -41
  160. package/dist/{index-D_ODXsBv.d.mts → index-DJ2KgJDJ2.d.mts} +51 -95
  161. package/dist/{index-cqLS1eFV.d.mts → index-DNI6UF9h.d.mts} +133 -134
  162. package/dist/index-DQ8o3JGi.d.mts +132 -0
  163. package/dist/index-DWBkiiXH.d.mts +18 -0
  164. package/dist/{index-DlsHL9Jg.d.mts → index-DXtQRehh.d.mts} +12 -12
  165. package/dist/{index-4VfqCjl2.d.mts → index-D_4K3Tf_.d.mts} +79 -194
  166. package/dist/index-Dg11JxKZ.d.mts +496 -0
  167. package/dist/json-value-BBZ6uGwc.mjs +1 -0
  168. package/dist/json-value-DPqb-SJ8.d.mts +177 -0
  169. package/dist/kernel/cli/index.d.mts +2 -2
  170. package/dist/kernel/cli/index.mjs +1 -1
  171. package/dist/kernel/cli/register.d.mts +1 -1
  172. package/dist/kernel/cli/register.mjs +1 -1
  173. package/dist/kernel/cli/schemas.mjs +1 -1
  174. package/dist/kernel/extension/index.d.mts +1 -1
  175. package/dist/kernel/extension/index.mjs +1 -1
  176. package/dist/kernel/index.d.mts +9 -9
  177. package/dist/kernel/index.mjs +1 -1
  178. package/dist/kernel/namespace/index.d.mts +2 -2
  179. package/dist/kernel/namespace/index.mjs +1 -1
  180. package/dist/kernel/observability/index.d.mts +1 -1
  181. package/dist/kernel/observability/index.mjs +1 -1
  182. package/dist/kernel/providers/index.d.mts +1 -1
  183. package/dist/kernel/providers/index.mjs +1 -1
  184. package/dist/kernel/window/index.d.mts +1 -1
  185. package/dist/kernel/window/index.mjs +1 -1
  186. package/dist/{lib-DErgth_E.mjs → lib-BpGvHZye.mjs} +2 -2
  187. package/dist/{lib-C7-s68uf.mjs → lib-Cm-uEoC1.mjs} +1 -1
  188. package/dist/{load-extensions-BxsDB87B.d.mts → load-extensions-BQoXaHhR.d.mts} +17 -13
  189. package/dist/load-extensions-DG5LvPyM.mjs +1 -0
  190. package/dist/{materialization-Jd198K3y.mjs → materialization-lVd9_-jr.mjs} +1 -1
  191. package/dist/mcp-http-server/index.mjs +1 -1
  192. package/dist/model-DrzPt3ou.mjs +1 -0
  193. package/dist/{namespace-BqxtpNAn.mjs → namespace-BL7lHlmg.mjs} +1 -1
  194. package/dist/{namespace-CjjFvrIA2.d.mts → namespace-BNp7n_gu.d.mts} +25 -25
  195. package/dist/{namespace-g_mbIZq_.d.mts → namespace-BRuHzhPo.d.mts} +564 -28
  196. package/dist/{namespace-DV-Hr9sZ.d.mts → namespace-C06lJSuj.d.mts} +17 -7
  197. package/dist/{namespace-TseEI3Pu.d.mts → namespace-DOezqDti.d.mts} +18 -10
  198. package/dist/{namespace-CErHuXtb.d.mts → namespace-DknCutQZ.d.mts} +50 -0
  199. package/dist/{namespace-B8uKAzWJ.mjs → namespace-Du0accdE.mjs} +1 -1
  200. package/dist/{namespace-CWUDFGOy.mjs → namespace-NXm_zvL1.mjs} +1 -1
  201. package/dist/{namespace-CupOzbRv.d.mts → namespace-l-HG1rLF.d.mts} +24 -20
  202. package/dist/namespace-sCPb79-7.mjs +1 -0
  203. package/dist/{native-session-supervisor-DRx0MX-d.mjs → native-session-supervisor-LKio8XZn.mjs} +1 -1
  204. package/dist/node/bus-server/index.d.mts +1 -1
  205. package/dist/node/bus-server/index.mjs +1 -1
  206. package/dist/node/bus-server/server-lifecycle.d.mts +1 -1
  207. package/dist/node/bus-server/server-lifecycle.mjs +1 -1
  208. package/dist/npm-package-name-DuTYVICk.mjs +1 -0
  209. package/dist/orchestrator-shared-BGlN-m-V.mjs +1 -0
  210. package/dist/{orchestrator-shared-BHCv-l2O.d.mts → orchestrator-shared-CNHSImNY.d.mts} +10 -10
  211. package/dist/ownership-memory-handler-BpGdR_uG.mjs +1 -0
  212. package/dist/ownership-recovery-guard-DyW5vGBr.mjs +1 -0
  213. package/dist/package-B01gmu75.mjs +7 -0
  214. package/dist/{package-DWMxGfzK.d.mts → package-BNFTUFLB.d.mts} +234 -84
  215. package/dist/package-DttKA9wN.mjs +1 -0
  216. package/dist/package-EGTn-Ng1.mjs +1 -0
  217. package/dist/package-JtjbO-Oi.mjs +1 -0
  218. package/dist/package.json +1 -1
  219. package/dist/{profile-BTAI31Nt.mjs → profile-N5qGUpF0.mjs} +1 -1
  220. package/dist/{provider-context-PZIQWcqQ.mjs → provider-context-CG42JlP9.mjs} +1 -1
  221. package/dist/{provider-context-Dq53Cgzz.mjs → provider-context-zTDSH2x9.mjs} +1 -1
  222. package/dist/reaction-D3TNwPK8.mjs +1 -0
  223. package/dist/{registry-wfF2uTty.mjs → registry-Dk12tAfv.mjs} +2 -2
  224. package/dist/{resolved-DZgqql2Z.mjs → resolved-sq8RXNDf.mjs} +1 -1
  225. package/dist/rules/index.d.mts +1 -1
  226. package/dist/rules/index.mjs +1 -1
  227. package/dist/rules/schemas.d.mts +1 -1
  228. package/dist/rules/schemas.mjs +1 -1
  229. package/dist/runtime-bun/index.mjs +1 -1
  230. package/dist/runtime-node/code-execution/index.d.mts +3 -0
  231. package/dist/runtime-node/code-execution/index.mjs +1 -0
  232. package/dist/runtime-node/extension-discovery.d.mts +2 -2
  233. package/dist/runtime-node/extension-discovery.mjs +1 -1
  234. package/dist/runtime-node/extension-validation.d.mts +1 -1
  235. package/dist/runtime-node/extension-validation.mjs +1 -1
  236. package/dist/runtime-node/index.d.mts +7 -5
  237. package/dist/runtime-node/index.mjs +24 -24
  238. package/dist/runtime-node/makaio-config.d.mts +1 -1
  239. package/dist/runtime-node/makaio-config.mjs +1 -1
  240. package/dist/runtime-node/workflow-worker/index.d.mts +1 -1
  241. package/dist/runtime-node/workflow-worker/index.mjs +1 -1
  242. package/dist/runtime-node/workflow-worker/worker-entry.mjs +1 -1
  243. package/dist/{schema-DKUb4rkr.d.mts → schema-B3Pf7JP7.d.mts} +778 -21
  244. package/dist/{schema-Dd-e89MO.mjs → schema-Dq-7si8u.mjs} +1 -1
  245. package/dist/{schemas-B1NWNASS.d.mts → schemas-BXc9qOpl.d.mts} +2 -0
  246. package/dist/schemas-BfO5jkrL.mjs +1 -0
  247. package/dist/{schemas-CR8hSqTy.d.mts → schemas-C1mxTfd7.d.mts} +60 -4
  248. package/dist/schemas-C3kyQWGf.mjs +1 -0
  249. package/dist/{schemas-DnYiAvfz.d.mts → schemas-D7ScxLrf.d.mts} +24 -20
  250. package/dist/{schemas-BsVYZviy.d.mts → schemas-OWvBn7AH.d.mts} +4 -4
  251. package/dist/{schemas-DaHQzpgm.mjs → schemas-QWDnauKX.mjs} +1 -1
  252. package/dist/schemas-TK29KWx-.mjs +1 -0
  253. package/dist/schemas-_2Syo_01.mjs +1 -0
  254. package/dist/scoped-bus-DoPmCJeM.mjs +1 -0
  255. package/dist/{selection-BNwTKEVT.mjs → selection-DL3ric7K.mjs} +1 -1
  256. package/dist/services/adapter-runtime/index.d.mts +4 -4
  257. package/dist/services/adapter-runtime/index.mjs +1 -1
  258. package/dist/services/adapter-runtime/namespace.d.mts +1 -1
  259. package/dist/services/adapter-runtime/schemas.d.mts +2 -2
  260. package/dist/services/adapter-runtime/schemas.mjs +1 -1
  261. package/dist/services/adapter-subsystem/index.d.mts +4 -4
  262. package/dist/services/adapter-subsystem/index.mjs +1 -1
  263. package/dist/services/adapter-subsystem/namespace.d.mts +2 -2
  264. package/dist/services/adapter-subsystem/namespace.mjs +1 -1
  265. package/dist/services/agent-runtime/index.d.mts +2 -2
  266. package/dist/services/agent-runtime/namespace.d.mts +1 -1
  267. package/dist/services/agent-runtime/schemas.d.mts +1 -1
  268. package/dist/services/automation-trigger/index.d.mts +943 -0
  269. package/dist/services/automation-trigger/index.mjs +1 -0
  270. package/dist/services/capability/index.d.mts +3 -2
  271. package/dist/services/capability/index.mjs +1 -1
  272. package/dist/services/code-execution/index.d.mts +2 -0
  273. package/dist/services/code-execution/index.mjs +1 -0
  274. package/dist/services/codebase/index.d.mts +2 -2
  275. package/dist/services/codebase/namespace.d.mts +1 -1
  276. package/dist/services/codebase/schemas.d.mts +1 -1
  277. package/dist/services/compression/index.d.mts +2 -2
  278. package/dist/services/compression/namespace.d.mts +1 -1
  279. package/dist/services/compression/schemas.d.mts +1 -1
  280. package/dist/services/context-rules/index.d.mts +1 -1
  281. package/dist/services/context-rules/index.mjs +1 -1
  282. package/dist/services/execution-target/index.d.mts +3 -3
  283. package/dist/services/execution-target/index.mjs +1 -1
  284. package/dist/services/execution-target/namespace.d.mts +1 -1
  285. package/dist/services/execution-target/namespace.mjs +1 -1
  286. package/dist/services/execution-target/schemas.d.mts +1 -1
  287. package/dist/services/execution-target/schemas.mjs +1 -1
  288. package/dist/services/filesystem/index.d.mts +1 -1
  289. package/dist/services/filesystem/index.mjs +1 -1
  290. package/dist/services/filesystem/namespace.d.mts +6 -6
  291. package/dist/services/filesystem/schemas.d.mts +3 -3
  292. package/dist/services/git/namespace.d.mts +18 -0
  293. package/dist/services/git/namespace.mjs +1 -1
  294. package/dist/services/git/schemas.d.mts +10 -1
  295. package/dist/services/git/schemas.mjs +1 -1
  296. package/dist/services/harness/index.mjs +1 -1
  297. package/dist/services/index.d.mts +567 -101
  298. package/dist/services/index.mjs +1 -1
  299. package/dist/services/log-import/browser.d.mts +2 -2
  300. package/dist/services/log-import/index.d.mts +3 -3
  301. package/dist/services/log-import/log-import.d.mts +1 -1
  302. package/dist/services/log-import/log-import.mjs +1 -1
  303. package/dist/services/log-import/namespace.mjs +1 -1
  304. package/dist/services/log-import/schemas.mjs +1 -1
  305. package/dist/services/materialization/index.d.mts +1 -1
  306. package/dist/services/materialization/index.mjs +1 -1
  307. package/dist/services/model-registry/index.d.mts +1 -1
  308. package/dist/services/model-registry/index.mjs +1 -1
  309. package/dist/services/preferences/index.d.mts +2 -2
  310. package/dist/services/preferences/schemas.d.mts +1 -1
  311. package/dist/services/preferences/storage-namespace.d.mts +2 -2
  312. package/dist/services/provider-context/index.d.mts +1 -1
  313. package/dist/services/provider-context/index.mjs +1 -1
  314. package/dist/services/provider-runtime/index.mjs +1 -1
  315. package/dist/services/session/handlers/index.d.mts +2 -2
  316. package/dist/services/session/handlers/index.mjs +1 -1
  317. package/dist/services/session/index.d.mts +10 -10
  318. package/dist/services/session/index.mjs +1 -1
  319. package/dist/services/session/messages/namespace.d.mts +1 -1
  320. package/dist/services/session/messages/namespace.mjs +1 -1
  321. package/dist/services/session/orchestrator-testing/index.d.mts +1 -1
  322. package/dist/services/session/orchestrator-testing/index.mjs +1 -1
  323. package/dist/services/session/session-events/namespace.d.mts +1 -1
  324. package/dist/services/session/session-events/namespace.mjs +1 -1
  325. package/dist/services/session/storage/namespace.d.mts +1 -1
  326. package/dist/services/session/storage/schema.d.mts +2 -2
  327. package/dist/services/session/storage/schema.mjs +1 -1
  328. package/dist/services/session/testing/index.d.mts +33 -4
  329. package/dist/services/session/testing/index.mjs +68 -12
  330. package/dist/services/session/testing/orchestrator-shared.d.mts +1 -1
  331. package/dist/services/session/testing/orchestrator-shared.mjs +1 -1
  332. package/dist/services/session/turns/namespace.d.mts +1 -1
  333. package/dist/services/session/turns/namespace.mjs +1 -1
  334. package/dist/services/session-editor/index.d.mts +1 -1
  335. package/dist/services/session-editor/index.mjs +1 -1
  336. package/dist/services/settings/index.d.mts +3 -3
  337. package/dist/services/settings/index.mjs +1 -1
  338. package/dist/services/settings/namespace.mjs +1 -1
  339. package/dist/services/settings/storage/clients-namespace.d.mts +1 -1
  340. package/dist/services/settings/storage/clients-namespace.mjs +1 -1
  341. package/dist/services/settings/storage/index.d.mts +3 -3
  342. package/dist/services/settings/storage/index.mjs +1 -1
  343. package/dist/services/settings/storage/providers-namespace.d.mts +1 -1
  344. package/dist/services/settings/storage/providers-namespace.mjs +1 -1
  345. package/dist/services/subagent/index.d.mts +1 -1
  346. package/dist/services/subagent/index.mjs +1 -1
  347. package/dist/services/subagent-template/index.d.mts +2 -2
  348. package/dist/services/subagent-template/namespace.d.mts +1 -1
  349. package/dist/services/subagent-template/schemas.d.mts +1 -1
  350. package/dist/services/tool-approval/index.d.mts +1 -1
  351. package/dist/services/tool-approval/index.mjs +1 -1
  352. package/dist/services/tools/index.d.mts +1 -1
  353. package/dist/services/tools/index.mjs +1 -1
  354. package/dist/services/tray-menu/index.d.mts +3 -3
  355. package/dist/services/tray-menu/index.mjs +1 -1
  356. package/dist/services/tray-menu/namespace.d.mts +1 -1
  357. package/dist/services/tray-menu/schemas.d.mts +1 -1
  358. package/dist/services/turn/index.d.mts +1 -1
  359. package/dist/services/turn/namespace.d.mts +1 -1
  360. package/dist/services/workflow-transitions/index.d.mts +1 -1
  361. package/dist/services/workflow-transitions/index.mjs +1 -1
  362. package/dist/session-BOpTI79g.mjs +1 -0
  363. package/dist/session-CXOPk3yg.mjs +95 -0
  364. package/dist/shared-B9AWRm9A.mjs +1 -0
  365. package/dist/{skill-BR6rkfLe.mjs → skill-DGNtc_ww.mjs} +1 -1
  366. package/dist/{src-DD0v-nIj.mjs → src-BmSQ3rlz.mjs} +1 -1
  367. package/dist/storage/drizzle/client.d.mts +1 -1
  368. package/dist/storage/drizzle/client.mjs +1 -1
  369. package/dist/storage/drizzle/index.d.mts +81 -2
  370. package/dist/storage/drizzle/index.mjs +1 -1
  371. package/dist/storage/handlers/drizzle/index.d.mts +1 -1
  372. package/dist/storage/handlers/drizzle/index.mjs +1 -1
  373. package/dist/storage/handlers/index.d.mts +1 -1
  374. package/dist/storage/handlers/index.mjs +1 -1
  375. package/dist/tool-approval-service-BFDOFUGC.mjs +1 -0
  376. package/dist/{tools-PdG9fO1M.mjs → tools-DWKWX3eV.mjs} +1 -1
  377. package/dist/{transition-Du3MQzJV.d.mts → transition-D3zUBTPc.d.mts} +11 -38
  378. package/dist/{types-D7_kevBK.d.mts → types-BlB23n4f.d.mts} +1 -1
  379. package/dist/{types-DMLDHFR9.d.mts → types-CtDGkyLx2.d.mts} +1 -1
  380. package/dist/types-Cwza95hS.mjs +1 -0
  381. package/dist/{types-Dzrwa1GY.d.mts → types-DcxBYlPA.d.mts} +5834 -1436
  382. package/dist/types-DnK6Wa_Y.d.mts +260 -0
  383. package/dist/types-OKJCOjme.d.mts +2937 -0
  384. package/dist/ui-hooks/index.d.mts +29 -2
  385. package/dist/ui-hooks/index.mjs +1 -1
  386. package/dist/ui-kernel/index.d.mts +2 -2
  387. package/dist/ui-kernel/pages/schemas.d.mts +1 -1
  388. package/dist/ui-views/index.d.mts +1 -1
  389. package/dist/utils/index.d.mts +98 -1
  390. package/dist/utils/index.mjs +2 -2
  391. package/dist/utils/project-manifest.mjs +1 -1
  392. package/dist/{version-CoCeMxDT.mjs → version-BYeVh1pI.mjs} +1 -1
  393. package/dist/{view-builder-DeFd-k7C.d.mts → view-builder-B0j9p5C0.d.mts} +4 -4
  394. package/dist/{visibility-qhGWmpSJ.mjs → visibility-DtDLRBdr.mjs} +1 -1
  395. package/dist/worker-node-CjuQb9hl.mjs +1 -0
  396. package/dist/{worker-node-DZTuT1DS.mjs → worker-node-Dtf9ilsR.mjs} +1 -1
  397. package/dist/workflow-C4mck_NW.mjs +1 -0
  398. package/dist/workflow-engine/execution-attempt-repository.d.mts +1 -1
  399. package/dist/workflow-engine/index.d.mts +237 -518
  400. package/dist/workflow-engine/index.mjs +1 -1
  401. package/dist/workflow-engine/package.d.mts +1 -1
  402. package/dist/workflow-engine/package.mjs +1 -1
  403. package/dist/workflow-engine/provider-operation.d.mts +1 -1
  404. package/dist/workflow-engine/testing/index.d.mts +2 -2
  405. package/dist/workflow-engine/testing/index.mjs +1 -1
  406. package/dist/workflow-engine/testing/sqlite.d.mts +1 -1
  407. package/dist/workflow-engine/testing/sqlite.mjs +27 -27
  408. package/dist/workflow-engine/workflow-orchestrator.mjs +1 -1
  409. package/dist/workflow-engine/workflow-trigger-binding-consumer.d.mts +46 -0
  410. package/dist/workflow-engine/workflow-trigger-binding-consumer.mjs +1 -0
  411. package/dist/{workflow-transitions-DSc45ixc.mjs → workflow-transitions-c_VQbyV0.mjs} +1 -1
  412. package/dist/workflow-worker-aNbdgqml.mjs +1 -0
  413. package/dist/zod-json-schema-Dixc-B1T.mjs +1 -0
  414. package/package.json +46 -1
  415. package/dist/adapter-D5c5LrPN.mjs +0 -1
  416. package/dist/artifact-DGiXqb11.mjs +0 -1
  417. package/dist/attach-error-C3tngg6J.mjs +0 -1
  418. package/dist/authority-state-bootstrap-GPL_tqaT.mjs +0 -1
  419. package/dist/await-trigger-I3lrepb8.mjs +0 -1
  420. package/dist/bus-B6SAjgOC.mjs +0 -2
  421. package/dist/bus-C2l3K74u.mjs +0 -1
  422. package/dist/capabilities-BQEp34ir.mjs +0 -1
  423. package/dist/capability-service-BqiLlRGA.mjs +0 -1
  424. package/dist/event-CmVjR6Ib.mjs +0 -1
  425. package/dist/extension-DCA4pYrY.mjs +0 -1
  426. package/dist/extension-hjOPs10e.mjs +0 -1
  427. package/dist/framework-packages-C3RWfJDk.mjs +0 -1
  428. package/dist/handlers-CfnLyLfE.mjs +0 -57
  429. package/dist/identity-D6guMtmi.mjs +0 -1
  430. package/dist/index-CRvpVIqA.d.mts +0 -89
  431. package/dist/json-value-Brslhqbm.d.mts +0 -57
  432. package/dist/json-value-DmU8ibo_.mjs +0 -1
  433. package/dist/load-extensions-D0DfjYLC.mjs +0 -1
  434. package/dist/model-BGgVmRnN.mjs +0 -1
  435. package/dist/namespace-DJfUADSV.mjs +0 -1
  436. package/dist/orchestrator-shared-BxmHCPvx.mjs +0 -1
  437. package/dist/package-CNUPPcU1.mjs +0 -7
  438. package/dist/package-Dft_RItb.mjs +0 -1
  439. package/dist/schemas-CRB2O5zo.mjs +0 -1
  440. package/dist/schemas-Cm09dXL4.mjs +0 -1
  441. package/dist/schemas-tDf_WiC8.mjs +0 -1
  442. package/dist/scoped-bus-C9BdNwfM.mjs +0 -1
  443. package/dist/session-BOGCd18q.mjs +0 -1
  444. package/dist/session-BTFiDoGz.mjs +0 -76
  445. package/dist/shared-BQ0CHIVy.mjs +0 -1
  446. package/dist/tool-approval-service-kBA0fRzm.mjs +0 -1
  447. package/dist/types-CJ_QZ1yW.d.mts +0 -1487
  448. package/dist/worker-node-Bl9_vqYi.mjs +0 -1
  449. package/dist/workflow-BfDbgtIQ.mjs +0 -1
  450. package/dist/workflow-worker-BN9XPxQO.mjs +0 -1
  451. package/dist/{adapter-auth-runtime-DO-FVTXg.mjs → adapter-auth-runtime-DHHppU4f.mjs} +0 -0
  452. package/dist/{adapter-binding-DQchUtrK.d.mts → adapter-binding-CATvmGuz.d.mts} +0 -0
  453. package/dist/{attempt-record-codec-CqO1_XnE.mjs → attempt-record-codec-BYfYkj4M.mjs} +0 -0
  454. package/dist/{base-orchestrator-BilsQNW1.d.mts → base-orchestrator-B4YW6z_Q.d.mts} +0 -0
  455. package/dist/{index-DN4NOCqN2.d.mts → capability-service-BW1-teFU.d.mts} +0 -0
  456. package/dist/{client-B--e2qcU.d.mts → client-BG0WX5Vz.d.mts} +0 -0
  457. package/dist/{client-binary-version-verifier-taewmKTY.mjs → client-binary-version-verifier-0lCKZOTg.mjs} +0 -0
  458. package/dist/{client-binary-version-verifier-CgjM_vGF.d.mts → client-binary-version-verifier-lcv83Hq3.d.mts} +0 -0
  459. package/dist/{clients-namespace-DfxjG2ZP.d.mts → clients-namespace-DLAjOTTb.d.mts} +0 -0
  460. package/dist/{config-namespace-BCqvufbD.d.mts → config-namespace-CH7sJZ4f.d.mts} +0 -0
  461. package/dist/{create-static-mount-bbQhTt6W.mjs → create-static-mount-DxuixuLZ.mjs} +0 -0
  462. package/dist/{cross-spawn-B57KZuns.mjs → cross-spawn-CZygZJMH.mjs} +0 -0
  463. package/dist/{cursor-storage-DIFK_9hg.mjs → cursor-storage-bsc9lZKk.mjs} +0 -0
  464. package/dist/{definition-gnKgXU91.d.mts → definition-BrgzUuFk.d.mts} +0 -0
  465. package/dist/{definitions-xrrY0wgz.mjs → definitions-CRpdnHYM.mjs} +0 -0
  466. package/dist/{descriptor-to-package-DvF08krT.mjs → descriptor-to-package-CcjdoWP4.mjs} +0 -0
  467. package/dist/{drizzle-z_0SiGY8.mjs → drizzle-Bzc-OGVI.mjs} +0 -0
  468. package/dist/{esm-CltRnX8_.mjs → esm-i-S5TW72.mjs} +0 -0
  469. package/dist/{facet-BCI00njh.mjs → facet-BnMh7Jyc.mjs} +0 -0
  470. package/dist/{filesystem-service-CQ9yVkSz.d.mts → filesystem-service-ZJ43SbBi.d.mts} +0 -0
  471. package/dist/{handler-Cbv9FqDO.mjs → handler-DF1fVDpf.mjs} +0 -0
  472. package/dist/{host-Caq6ZfSJ.mjs → host-B-_ntOMH.mjs} +0 -0
  473. package/dist/{index-ye0oklfU.d.mts → index-B2Y1Wvbh.d.mts} +0 -0
  474. package/dist/{index-Cv-o5Krs.d.mts → index-B4svZC6L.d.mts} +0 -0
  475. package/dist/{index-DZunhZec.d.mts → index-B5dP8rj6.d.mts} +0 -0
  476. package/dist/{index-jTaAHsul.d.mts → index-BC-6qNeo.d.mts} +0 -0
  477. package/dist/{index-ByKi34v5.d.mts → index-BFWvT0NG.d.mts} +0 -0
  478. package/dist/{index-vA--0lOM.d.mts → index-BMRB9yhF.d.mts} +0 -0
  479. package/dist/{index-BskPjMet.d.mts → index-BuMsrli0.d.mts} +0 -0
  480. package/dist/{index-DR40QWlw.d.mts → index-C4V8Pmi4.d.mts} +0 -0
  481. package/dist/{index-BIdsFcQs2.d.mts → index-CL0Jo1b92.d.mts} +0 -0
  482. package/dist/{index-CjdRdsd0.d.mts → index-CVpaGijY.d.mts} +0 -0
  483. package/dist/{index-vcSj12YQ.d.mts → index-CmbkCxj-.d.mts} +0 -0
  484. package/dist/{index-sS6KUlrx.d.mts → index-CqdMbYmR.d.mts} +0 -0
  485. package/dist/{index-CnMu8BQl.d.mts → index-D037TVsm.d.mts} +0 -0
  486. package/dist/{index-CGZQVTid.d.mts → index-DgspOUa72.d.mts} +0 -0
  487. package/dist/{index-dtsLKOID.d.mts → index-Ek4y8M9J2.d.mts} +0 -0
  488. package/dist/{index-DjgLchuQ.d.mts → index-VzLAV0Yt.d.mts} +0 -0
  489. package/dist/{index-DXN_L5D6.d.mts → index-jxPncqWZ2.d.mts} +0 -0
  490. package/dist/{index-BVRQEpAg.d.mts → index-kzIjbrS02.d.mts} +6 -6
  491. /package/dist/{index-Dm1nUxCF.d.mts → index-l01zsChf.d.mts} +0 -0
  492. /package/dist/{index-CWHfOz6d.d.mts → index-pvX-BIpr2.d.mts} +0 -0
  493. /package/dist/{jsonl-transport-bQl3JwIu.mjs → jsonl-transport-Cyyh5Wje.mjs} +0 -0
  494. /package/dist/{lib-DOBXZmYX.mjs → lib-BqV8hYtk.mjs} +0 -0
  495. /package/dist/{model-registry-xyBKSye-.mjs → model-registry-C9rFu3kV.mjs} +0 -0
  496. /package/dist/{model-registry-CmgcPDH3.mjs → model-registry-Cixxx2jv.mjs} +0 -0
  497. /package/dist/{modes-BheyN7SS.mjs → modes-DwsJ3yVl.mjs} +0 -0
  498. /package/dist/{namespace-BOkKoq34.d.mts → namespace-B0ftHlK3.d.mts} +0 -0
  499. /package/dist/{namespace-YytVKIgI.d.mts → namespace-BGRHcrmp.d.mts} +0 -0
  500. /package/dist/{namespace-jDhZjw-i.d.mts → namespace-BUYDmd0r.d.mts} +0 -0
  501. /package/dist/{namespace-YxU1xf-K.mjs → namespace-BW3Bfu9h.mjs} +0 -0
  502. /package/dist/{namespace-DWCEo-9M.d.mts → namespace-BdAK0lD8.d.mts} +0 -0
  503. /package/dist/{namespace-Cv1RFP7n.d.mts → namespace-CPG6u60N.d.mts} +0 -0
  504. /package/dist/{namespace-GPA7zots.d.mts → namespace-CVFaZv8x.d.mts} +0 -0
  505. /package/dist/{namespace-Blp4c8GK.d.mts → namespace-DBO1OzYB.d.mts} +0 -0
  506. /package/dist/{namespace-C-9si-fV.mjs → namespace-DiwqpB-c.mjs} +0 -0
  507. /package/dist/{namespace-tGRAod3o.d.mts → namespace-DqZweTbX.d.mts} +0 -0
  508. /package/dist/{namespace-HO2J9sO8.mjs → namespace-jVTsuZHX.mjs} +0 -0
  509. /package/dist/{namespace-CWGKCNZm.mjs → namespace-tjoxekmf.mjs} +0 -0
  510. /package/dist/{out-CvjtANXN.mjs → out-8bOYN6EF.mjs} +0 -0
  511. /package/dist/{packages-DtEEP0Vt.mjs → packages-Bp124-gx.mjs} +0 -0
  512. /package/dist/{packages-BZ6pzFIq.d.mts → packages-CxPMEg8D.d.mts} +0 -0
  513. /package/dist/{platform-Bv8llU9c.mjs → platform-CxyYPrkf.mjs} +0 -0
  514. /package/dist/{provider-operation-Cxoe2SUr.d.mts → provider-operation-DbdyFwNm.d.mts} +0 -0
  515. /package/dist/{providers-Co5UszRH.mjs → providers-C-eekMxD.mjs} +0 -0
  516. /package/dist/{providers-namespace-DjFkmvBR.d.mts → providers-namespace-CfZKp-C0.d.mts} +0 -0
  517. /package/dist/{quick-lru-CrOpWwrf.mjs → quick-lru-CCEnf7y6.mjs} +0 -0
  518. /package/dist/{schema-Db-y-09L.mjs → schema-C0opCPww.mjs} +0 -0
  519. /package/dist/{schema-introspection-DgWQCpwx.mjs → schema-introspection-6-r_KEJQ.mjs} +0 -0
  520. /package/dist/{schemas-N6x2z7Lf.d.mts → schemas-B50oWBuj.d.mts} +0 -0
  521. /package/dist/{schemas-BO7uOum6.d.mts → schemas-B6Q-qdmn.d.mts} +0 -0
  522. /package/dist/{schemas-BGExwp3j.mjs → schemas-B8hKbBwI.mjs} +0 -0
  523. /package/dist/{schemas-miYxK_Z1.d.mts → schemas-BGvkTiCx.d.mts} +0 -0
  524. /package/dist/{schemas-CqRm0i9a.mjs → schemas-BivbWRkG.mjs} +0 -0
  525. /package/dist/{schemas-CwbYk_kZ.d.mts → schemas-ChmQldVH.d.mts} +0 -0
  526. /package/dist/{schemas-DrVg4aQQ.d.mts → schemas-Dd13TMgU.d.mts} +0 -0
  527. /package/dist/{schemas-BtZqovRH.d.mts → schemas-Pe892GgN.d.mts} +0 -0
  528. /package/dist/{schemas-CQyRBqD6.d.mts → schemas-bfZNpl0B.d.mts} +0 -0
  529. /package/dist/{schemas-Bfxskx_2.mjs → schemas-scyC2tFF.mjs} +0 -0
  530. /package/dist/{semver-DlM8znk4.mjs → semver-BI7kTNsY.mjs} +0 -0
  531. /package/dist/{server-lifecycle-kmQ5PUDv.mjs → server-lifecycle-B_OZnoe-.mjs} +0 -0
  532. /package/dist/{server-lifecycle-Dsq56aqC.d.mts → server-lifecycle-L8zja8t8.d.mts} +0 -0
  533. /package/dist/{session-lineage-B_JW5LpF.d.mts → session-lineage-bUkd3fqx.d.mts} +0 -0
  534. /package/dist/{shared-schemas-DXwyMCwZ.mjs → shared-schemas-CQ6blrEW.mjs} +0 -0
  535. /package/dist/{src-CCu8TwL6.mjs → src-BacfeiI4.mjs} +0 -0
  536. /package/dist/{storage-namespace-BSrv0vXR.mjs → storage-namespace-BZce8kkW.mjs} +0 -0
  537. /package/dist/{storage-namespace-dfywhXR3.d.mts → storage-namespace-YmE8XCCL.d.mts} +0 -0
  538. /package/dist/{storage-namespace-definition-BvlX0QV_.d.mts → storage-namespace-definition-BsnYAPot.d.mts} +0 -0
  539. /package/dist/{storage-namespace-definition-CkMKt7-I.mjs → storage-namespace-definition-Cca-zwXU.mjs} +0 -0
  540. /package/dist/{supports-color-DUugCQsK.mjs → supports-color-SV_FgSN2.mjs} +0 -0
  541. /package/dist/{telemetry-Pr3oP2rk.mjs → telemetry-BqoC87F-.mjs} +0 -0
  542. /package/dist/{timeout-DWDhddRJ.mjs → timeout-DVlN2Zhy.mjs} +0 -0
  543. /package/dist/{tray-menu-service-BBLa-Rcv.mjs → tray-menu-service-eVVxgPLc.mjs} +0 -0
  544. /package/dist/{types-BrcjaNPZ.d.mts → types-DdpSEmTO.d.mts} +0 -0
  545. /package/dist/{types-b54n1o57.d.mts → types-tyv0B605.d.mts} +0 -0
  546. /package/dist/{ui-config-CyCdlns_.mjs → ui-config-B35GloSX.mjs} +0 -0
  547. /package/dist/{variant-krjlTdJt.mjs → variant-Dwnge3J_.mjs} +0 -0
  548. /package/dist/{window-registry-I-imZHV_.mjs → window-registry-CKiMJjId.mjs} +0 -0
  549. /package/dist/{window-registry-BDnZLPVx.d.mts → window-registry-Pcf35cac.d.mts} +0 -0
@@ -1,10 +1,10 @@
1
- import { $ as NormalizedMessageInput, C as NormalizedCallUsage, D as AdapterAuthLeaseHandle, E as StartAgentOptions, J as IAdapterConfigFactory, K as AdapterProviderDefinition, O as AdapterAuthRuntimePreparer, Q as markCompletedWithFinalResult, S as GetCapabilitiesResponsePayload, T as SendMessageResponsePayload, X as MessageDeliveryMode, Y as AIAgentConnector, Z as MessageHandle, _ as BaseAgentConnectorConfig, a as AgentCredentialChangeResponsePayload, at as AIModel, b as ContextWindowInput, c as AgentIdentity, ct as ISessionToolLedger, d as AgentMcpServersSetRequestPayload, dt as ToolLedgerEntry, et as normalizeMessageInput, f as AgentMcpServersSetResponsePayload, g as AgentStartResult, h as AgentSendMessageOptions, i as AgentCredentialChangeRequestPayload, it as SendMessageOptions, j as ResolvedAdapterRuntimeConfig, k as BoundAdapterRuntimeConfig, l as AgentInterruptRequestPayload, lt as LedgerSessionContext, m as AgentModelChangeResponsePayload, n as AgentConnectorConfigOverrides, nt as MessageState, o as AgentCwdChangeRequestPayload, ot as AIReasoningLevel, p as AgentModelChangeRequestPayload, q as ConfigFactoryInput, r as AgentContext, rt as ProcessingState, s as AgentCwdChangeResponsePayload, st as ReasoningLevelMap, t as AIAgentConfig, tt as MessageResult, u as AgentInterruptResponsePayload, ut as SessionToolLedger, v as ConnectorSendMessageOptions, w as SendMessageRequestPayload, x as ExecutionContext, y as ConnectorStartOptions } from "../types-CJ_QZ1yW.mjs";
2
- import { S as toImportSegment, _ as LogImporter, a as CompactionMetadata, b as ProcessLogFileResult, c as ExternalToolIdentifiers, d as ImportMetadata, f as ImportSegment, g as LogImportTestConfig, h as LogImportSessionContext, l as ExternalToolMeta, m as ImportSegmentTurn, n as LogOrchestratorConfig, o as DiscoveryMetadata, p as ImportSegmentLineage, r as ParseFileResult, s as ExternalToolIdentifier, u as ImportCursorPosition, v as LogImporterConfig, x as StorageMessagePayload, y as NormalizedEvent } from "../base-orchestrator-BilsQNW1.mjs";
1
+ import { $t as SessionToolLedger, A as AgentTeardownArbiter, At as runBestEffortStage, Bt as MessageHandle, C as NormalizedCallUsage, Ct as ObservedExitOptions, D as AdapterProviderDefinition, Dt as reportBestEffortStages, E as StartAgentOptions, Et as exitWasObserved, F as TeardownSubject, Ft as unknownTeardown, Gt as MessageState, Ht as NormalizedMessageInput, I as CreateConnectorRuntimeOptions, It as CONNECTOR_EXIT_OBSERVATION_MS, Jt as AIModel, Kt as ProcessingState, Lt as SWAP_SETTLEMENT_WAIT_MS, M as ConnectorReplacementSettlement, Mt as TeardownReport, N as ConnectorSwapAdmission, Nt as aggregateTeardownReports, O as ConfigFactoryInput, Ot as reportObservedExit, P as ConnectorSwapHandover, Pt as rethrowTeardownFailure, Qt as LedgerSessionContext, R as AdapterAuthRuntimePreparer, Rt as AIAgentConnector, S as GetCapabilitiesResponsePayload, St as SupersededGeneration, T as SendMessageResponsePayload, Tt as describeTeardownFailure, Ut as normalizeMessageInput, Vt as markCompletedWithFinalResult, Wt as MessageResult, Xt as ReasoningLevelMap, Yt as AIReasoningLevel, Zt as ISessionToolLedger, _ as BaseAgentConnectorConfig, _t as BaseConnectorTurn, a as AgentCredentialChangeResponsePayload, at as WireSessionSubjects, b as ContextWindowInput, bt as ConnectorSessionConfig, c as AgentIdentity, ct as QueueableTurn, d as AgentMcpServersSetRequestPayload, dt as rejectQueuedHandles, en as ToolLedgerEntry, f as AgentMcpServersSetResponsePayload, ft as UserMessageQueue, g as AgentStartResult, gt as TurnSubjects, h as AgentSendMessageOptions, ht as ProceduralTurnState, i as AgentCredentialChangeRequestPayload, it as WireSessionConfig, j as ClosableConnectorRuntime, jt as stageFailure, k as IAdapterConfigFactory, kt as reportRepeatTeardown, l as AgentInterruptRequestPayload, lt as SESSION_CLOSED_QUEUE_ERROR, m as AgentModelChangeResponsePayload, mt as ProceduralTurnConfig, n as AgentConnectorConfigOverrides, nt as ProceduralAgentConnector, o as AgentCwdChangeRequestPayload, ot as MergeResult, p as AgentModelChangeRequestPayload, pt as ProceduralConnectorTurn, qt as SendMessageOptions, r as AgentContext, rt as ProceduralConnectorSession, s as AgentCwdChangeResponsePayload, st as ProcessQueueCallbacks, t as AIAgentConfig, u as AgentInterruptResponsePayload, ut as processQueueMessages, v as ConnectorSendMessageOptions, vt as PauseResult, w as SendMessageRequestPayload, wt as capTeardownEvidence, x as ExecutionContext, xt as GenerationRetirementLedger, y as ConnectorStartOptions, yt as BaseConnectorSession, zt as MessageDeliveryMode } from "../types-OKJCOjme.mjs";
2
+ import { S as toImportSegment, _ as LogImporter, a as CompactionMetadata, b as ProcessLogFileResult, c as ExternalToolIdentifiers, d as ImportMetadata, f as ImportSegment, g as LogImportTestConfig, h as LogImportSessionContext, l as ExternalToolMeta, m as ImportSegmentTurn, n as LogOrchestratorConfig, o as DiscoveryMetadata, p as ImportSegmentLineage, r as ParseFileResult, s as ExternalToolIdentifier, u as ImportCursorPosition, v as LogImporterConfig, x as StorageMessagePayload, y as NormalizedEvent } from "../base-orchestrator-B4YW6z_Q.mjs";
3
3
  import { z } from "zod";
4
4
  import * as _$_makaio_core0 from "@makaio/framework/core";
5
5
  import { CreateBusNamespaceOptions, ExtractSubjectPayload, FilterablePayloadIntersection, HandlerForSubjectDefinition, RegistrableBusNamespaceDefinition, RequestContext, SchemaRecord, ScopedSubjectDefinition, SubjectDefinition, SubjectRecordFromSchemaRecord } from "@makaio/framework/core";
6
6
  import { BusNamespace, IMakaioBus, OnOptions, ScopedBus, ScopedBusFor } from "@makaio/framework/bus";
7
- import { AIReasoningLevel as AIReasoningLevel$1, AdapterClientRef, AdapterDefinitionContract, AdapterProviderAuth, AdapterProviderRef, AdapterSubjects, AgentSchemas, AgentStarted, AgentSubjects, AgentToolApproveRequest, AgentToolApproveResponse, BlockData, HarnessDefinition, HarnessSubjects, JsonValue, McpResolvedServer, McpRuntimeSessionContext, McpSessionContext, McpToolState, Message, MessageInput, NativeForkDirective, ProtocolId, ProviderContext, ProviderDefinitionInput, ReasoningLevelMap as ReasoningLevelMap$1, RequestCorrelationContext, ResponseSchemaDescriptor, SendMessageRequest, SendMessageResponse, SessionContext, SessionMessageBlock, StartAgentRequest, StartAgentResponse, StartMode, StepType, SystemPrompt, ToolListItem } from "@makaio/framework/contracts";
7
+ import { AIReasoningLevel as AIReasoningLevel$1, AdapterClientRef, AdapterDefinitionContract, AdapterProviderAuth, AdapterProviderRef, AdapterSubjects, AgentSchemas, AgentStarted, AgentSubjects, AgentToolApproveRequest, AgentToolApproveResponse, BlockData, ConnectorTeardownResult, HarnessDefinition, HarnessSubjects, JsonValue, McpResolvedServer, McpRuntimeSessionContext, McpSessionContext, McpToolState, Message, MessageInput, NativeForkDirective, ProtocolId, ProviderContext, ProviderDefinitionInput, ReasoningLevelMap as ReasoningLevelMap$1, RequestCorrelationContext, ResponseSchemaDescriptor, SendMessageRequest, SendMessageResponse, SessionContext, SessionMessageBlock, StartAgentRequest, StartAgentResponse, StartMode, StepType, SystemPrompt, ToolListItem } from "@makaio/framework/contracts";
8
8
  import * as _$_makaio_storage_core0 from "@makaio/framework/storage";
9
9
  import * as _$_makaio_ai_adapters_core0 from "@makaio/framework/adapters";
10
10
  import * as _$type_fest0 from "type-fest";
@@ -108,7 +108,6 @@ interface AIAdapterInitOptions {
108
108
  defaultModel?: string;
109
109
  /** Provider-specific non-secret config (base URLs, defaults, etc.). Type explicitly in adapter implementations. */
110
110
  providerOptions?: unknown;
111
- adapterId?: string;
112
111
  /**
113
112
  * Platform-provided defaults (cwd, env, etc.).
114
113
  * Lowest priority - overridden by request values.
@@ -130,6 +129,21 @@ interface AIAdapterInitOptions {
130
129
  /** Trusted non-serializable normalized auth preparer injected by the host. */
131
130
  prepareAuthRuntime?: AdapterAuthRuntimePreparer;
132
131
  }
132
+ /**
133
+ * Host-injected options required to construct a live adapter runtime.
134
+ *
135
+ * `AIAdapterInitOptions` deliberately excludes runtime identity: callers may
136
+ * prepare user-facing defaults, but only the host may choose the authority
137
+ * incarnation that owns a live adapter.
138
+ */
139
+ interface AIAdapterRuntimeInitOptions extends AIAdapterInitOptions {
140
+ /** Per-adapter unique identifier assigned by the runtime. */
141
+ adapterId: string;
142
+ /** Stable machine identity hosting this adapter runtime. */
143
+ machineId: string;
144
+ /** Session-ownership authority incarnation hosting this adapter. */
145
+ ownerInstanceId: string;
146
+ }
133
147
  //#endregion
134
148
  //#region adapters/core/src/utils/safeJsonStringify.d.ts
135
149
  /**
@@ -144,6 +158,30 @@ interface AIAdapterInitOptions {
144
158
  */
145
159
  declare function safeJsonStringify(value: unknown): string;
146
160
  //#endregion
161
+ //#region adapters/core/src/utils/withTimeout.d.ts
162
+ /**
163
+ * Bounding helper for awaits that would otherwise have no end.
164
+ * @packageDocumentation
165
+ */
166
+ /**
167
+ * Race a promise against a timeout, clearing the timer when either settles.
168
+ *
169
+ * Exists so an adapter that declares a budget can actually honour it: an
170
+ * unbounded await on a provider handshake is indistinguishable from a hang, and
171
+ * a caller waiting behind it inherits that hang. The timer is always cleared, so
172
+ * bounding a promise never keeps the event loop alive past its settlement.
173
+ *
174
+ * The bound applies to the *wait*, not to the work. A rejected race leaves the
175
+ * underlying operation running; callers that own a resource behind the promise
176
+ * are responsible for releasing it.
177
+ * @param promise - Promise to bound.
178
+ * @param ms - Milliseconds to wait before rejecting.
179
+ * @param message - Error message used when the bound expires.
180
+ * @returns The promise's resolved value.
181
+ * @throws Error with `message` when the bound expires first.
182
+ */
183
+ declare function withTimeout<T>(promise: Promise<T>, ms: number, message: string): Promise<T>;
184
+ //#endregion
147
185
  //#region adapters/core/src/utils/serializeTurnContext.d.ts
148
186
  /**
149
187
  * A single serialized context entry ready for adapter-specific formatting.
@@ -719,657 +757,6 @@ declare function formatMessageHistoryAsTranscript(history: Message[]): string;
719
757
  */
720
758
  declare function serializeBlockToText(block: MessageBlock$1): string;
721
759
  //#endregion
722
- //#region adapters/core/src/connector/base-connector-session.d.ts
723
- /**
724
- * Configuration for a connector session.
725
- * @typeParam TBus - Scoped bus type for adapter namespace
726
- */
727
- interface ConnectorSessionConfig<TBus extends ScopedBus<string> = ScopedBus<string>> {
728
- bus: TBus;
729
- adapterId: string;
730
- adapterName: string;
731
- cwd: string;
732
- model: string;
733
- env: Record<string, string>;
734
- /** Auth-free environment safe for bus-routable tool and MCP contexts. */
735
- contextEnv?: Readonly<Record<string, string>>;
736
- }
737
- /**
738
- * Interface for turn-like objects that support pause/abort operations.
739
- * Allows base session class to work with different turn implementations.
740
- */
741
- interface PausableTurn {
742
- pause(): Promise<unknown>;
743
- }
744
- /**
745
- * Base abstract class for connector session implementations.
746
- *
747
- * Sessions manage SDK query lifecycle across multiple turns:
748
- * - SDK connection management
749
- * - Turn creation and coordination
750
- * - Session ID management
751
- *
752
- * Each adapter implements its own session subclass.
753
- * @typeParam TConfig - Configuration type extending ConnectorSessionConfig
754
- */
755
- declare abstract class BaseConnectorSession<TConfig extends ConnectorSessionConfig = ConnectorSessionConfig> {
756
- protected readonly config: TConfig;
757
- protected readonly bus: TConfig['bus'];
758
- protected sessionId?: string;
759
- protected currentTurn?: PausableTurn;
760
- /**
761
- * True once `close()` or `abort()` has begun; gates queue processing.
762
- *
763
- * ## Shutdown vs queue processing invariant
764
- *
765
- * Once `close()` or `abort()` begins, no new turn may start.
766
- * `processQueue` implementations must refuse to dequeue or start turns
767
- * when `this.closing` is `true`, and drain all remaining queued handles
768
- * with an error outcome so that callers awaiting `waitForCompletion()`
769
- * resolve deterministically instead of hanging.
770
- *
771
- * A dequeued handle that has entered the start-turn path either starts
772
- * its turn before `close()` begins, or is completed with the closing
773
- * error at every await point where `close()` can interleave. This is
774
- * enforced by {@link completeHandleIfClosing}, which rechecks the flag
775
- * after each awaited setup step and completes the handle with the same
776
- * error contract used by {@link rejectQueuedHandles}.
777
- */
778
- protected closing: boolean;
779
- constructor(config: TConfig);
780
- /**
781
- * Recheck the shutdown flag after an awaited setup step in the start path.
782
- *
783
- * When `close()` sets `this.closing` while the subclass start-turn method
784
- * is awaiting an async setup step (schema rotation, query creation, MCP
785
- * registration, env resolution), the dequeued handle is no longer in the
786
- * queue and {@link rejectQueuedHandles} cannot reach it. This helper
787
- * completes the handle with the same error contract so callers see a
788
- * consistent shutdown outcome.
789
- * @param handle - Dequeued message handle currently being set up
790
- * @returns `true` when the session is closing and the handle was completed
791
- */
792
- protected completeHandleIfClosing(handle: MessageHandle): boolean;
793
- /**
794
- * Abort the session and cleanup resources.
795
- * Pauses the current turn if one is active.
796
- */
797
- abort(): Promise<void>;
798
- /**
799
- * Send a message to the provider.
800
- * Not used - subclasses should implement processQueue instead.
801
- * @param _message - Unused message parameter
802
- * @param _options - Unused options parameter
803
- */
804
- sendMessage(_message: unknown, _options?: unknown): Promise<void>;
805
- /**
806
- * Get the adapter session ID.
807
- * @returns The session ID from the provider
808
- */
809
- getAdapterSessionId(): Promise<string>;
810
- }
811
- //#endregion
812
- //#region adapters/core/src/connector/base-connector-turn.d.ts
813
- /**
814
- * Result of pausing a turn.
815
- * @typeParam TState - Turn state type
816
- */
817
- interface PauseResult<TState = string> {
818
- /** The state the turn was in before pausing */
819
- stateBeforePause: TState;
820
- /** Whether the turn had already ended when pause was requested */
821
- turnEnded: boolean;
822
- }
823
- /**
824
- * Base abstract class for connector turn implementations.
825
- *
826
- * Turns manage the state machine for a single user message:
827
- * - State transitions (idle to turn_started to step_started to ...)
828
- * - Pause/resume mechanics
829
- * - Safe boundary detection for immediate messages
830
- * - Message handle delegation (acknowledgment, completion)
831
- *
832
- * Each adapter implements its own turn subclass with adapter-specific
833
- * state handling and SDK integration.
834
- * @typeParam TState - Turn state enum type (string union)
835
- */
836
- declare abstract class BaseConnectorTurn<TState extends string = string> {
837
- protected state: TState;
838
- protected readonly bus: ScopedBus<string>;
839
- protected readonly adapterId: string;
840
- protected readonly adapterName: string;
841
- protected stateChangedCallback?: (oldState: TState, newState: TState) => Promise<void> | void;
842
- /**
843
- * Active message handle for this turn.
844
- * Subclasses must provide this handle for message lifecycle management.
845
- */
846
- protected abstract activeMessageHandle: MessageHandle;
847
- constructor(bus: ScopedBus<string>, adapterId: string, adapterName: string, initialState: TState);
848
- /**
849
- * Pause the turn at next safe boundary.
850
- * @returns Pause result indicating whether turn already ended
851
- */
852
- abstract pause(): Promise<PauseResult<TState>>;
853
- /**
854
- * Resume the paused turn with optional additional message.
855
- * @param message - Optional message to inject when resuming
856
- */
857
- abstract resume(message?: unknown): Promise<void>;
858
- /**
859
- * Check if turn is currently paused.
860
- */
861
- abstract isPaused(): boolean;
862
- /**
863
- * Register callback for state changes.
864
- * @param cb - Callback to invoke on state transitions
865
- */
866
- onStateChanged(cb: (oldState: TState, newState: TState) => Promise<void> | void): void;
867
- /**
868
- * Transition to new state and notify listeners.
869
- * Template method for shared state transition pattern.
870
- *
871
- * NOTE: Subclasses should use their typed namespace subjects for emission.
872
- * This is a template - concrete implementation in adapter-specific Turn classes.
873
- * @param newState - New state to transition to
874
- */
875
- protected transitionTo(newState: TState): Promise<void>;
876
- /**
877
- * Emit state change event - implemented by subclass with typed subjects.
878
- * @param oldState - Previous state
879
- * @param newState - New state
880
- */
881
- protected abstract emitStateChange(oldState: TState, newState: TState): Promise<void>;
882
- /**
883
- * Get current turn state.
884
- * @returns Current turn state
885
- */
886
- getState(): TState;
887
- /**
888
- * Get the message handle for this turn.
889
- * @returns The message handle for this turn
890
- */
891
- getMessageHandle(): MessageHandle;
892
- /**
893
- * Mark message handle as acknowledged.
894
- */
895
- markAcknowledged(): void;
896
- /**
897
- * Mark message handle as completed.
898
- * @param result - The completion result with outcome and optional result/error
899
- */
900
- markCompleted(result: {
901
- outcome: string;
902
- result?: unknown;
903
- error?: unknown;
904
- }): void;
905
- }
906
- //#endregion
907
- //#region adapters/core/src/connector/procedural-connector-turn.d.ts
908
- /**
909
- * Typed subject references for turn lifecycle events.
910
- *
911
- * Each adapter provides its namespace-specific subjects when constructing
912
- * a ProceduralConnectorTurn. The subjects must all accept the same
913
- * TurnStateChangedPayload shape.
914
- * @typeParam TSubject - The subject definition type for the adapter's bus
915
- */
916
- interface TurnSubjects<TSubject = ScopedSubjectDefinition> {
917
- state_changed: TSubject;
918
- turn_started: TSubject;
919
- step_started: TSubject;
920
- step_finished: TSubject;
921
- turn_finished: TSubject;
922
- }
923
- /**
924
- * Standard turn state type for procedural adapters.
925
- *
926
- * Procedural adapters (Gemini, OpenAI, Copilot) use abort+restart
927
- * rather than true pause/resume. Their state machine is:
928
- * idle to turn_started to step_started to step_finished to turn_finished
929
- */
930
- type ProceduralTurnState = 'idle' | 'turn_started' | 'step_started' | 'step_finished' | 'turn_finished';
931
- /**
932
- * Configuration for ProceduralConnectorTurn.
933
- * @typeParam TBus - Scoped bus type for the adapter
934
- * @typeParam TSubject - Subject definition type
935
- */
936
- interface ProceduralTurnConfig<TBus extends ScopedBus<string>, TSubject> {
937
- bus: TBus;
938
- adapterId: string;
939
- adapterName: string;
940
- agentId: string;
941
- messageHandle: MessageHandle;
942
- turnSubjects: TurnSubjects<TSubject>;
943
- }
944
- /**
945
- * Base turn implementation for procedural adapters (Gemini, OpenAI, Copilot).
946
- *
947
- * These adapters share an abort+restart pattern rather than true pause/resume.
948
- * This class extracts the common state machine, lifecycle methods, and
949
- * message handle delegation that was duplicated across all three.
950
- *
951
- * Subclasses only need to add adapter-specific behavior:
952
- * - Gemini: AbortController for SDK cancellation
953
- * - OpenAI: AbortController for SDK cancellation
954
- * - Copilot: SDK event handling (handleSdkEvent)
955
- * @typeParam TState - Turn state type (defaults to ProceduralTurnState)
956
- * @typeParam TBus - Scoped bus type for the adapter
957
- * @typeParam TSubject - Subject definition type for emit calls
958
- */
959
- declare class ProceduralConnectorTurn<TState extends string = ProceduralTurnState, TBus extends ScopedBus<string> = ScopedBus<string>, TSubject extends ScopedSubjectDefinition = ScopedSubjectDefinition> extends BaseConnectorTurn<TState> {
960
- protected activeMessageHandle: MessageHandle;
961
- protected readonly connectorBus: TBus;
962
- protected readonly agentId: string;
963
- protected readonly turnSubjects: TurnSubjects<TSubject>;
964
- protected aborted: boolean;
965
- constructor(config: ProceduralTurnConfig<TBus, TSubject>, initialState: TState);
966
- /**
967
- * Emit state change using adapter-provided turn subjects.
968
- * @param oldState - Previous state before transition
969
- * @param newState - New state after transition
970
- */
971
- protected emitStateChange(oldState: TState, newState: TState): Promise<void>;
972
- /**
973
- * Start the turn.
974
- */
975
- start(): Promise<void>;
976
- /**
977
- * Transition to step_started (called when first content arrives).
978
- * Allows turn_started to step_started AND step_finished to step_started
979
- * (for tool recursion).
980
- */
981
- markStepStarted(): Promise<void>;
982
- /**
983
- * Transition to step_finished (called after content block completes).
984
- */
985
- markStepFinished(): Promise<void>;
986
- /**
987
- * Mark turn as finished.
988
- */
989
- markTurnFinished(): Promise<void>;
990
- /**
991
- * Pause (abort) at next opportunity.
992
- * Procedural adapters don't support true pause - caller creates a new turn
993
- * with merged content instead.
994
- * @returns Pause result indicating turn state
995
- */
996
- pause(): Promise<PauseResult<TState>>;
997
- /**
998
- * Resume is not supported for procedural adapters - caller creates new turn.
999
- * @param _message - Unused
1000
- * @throws Error always
1001
- */
1002
- resume(_message?: unknown): Promise<void>;
1003
- /**
1004
- * Check if turn was aborted.
1005
- * @returns True if turn was aborted
1006
- */
1007
- isPaused(): boolean;
1008
- /**
1009
- * Check if turn is completed.
1010
- * @returns True if turn has finished
1011
- */
1012
- isCompleted(): boolean;
1013
- /**
1014
- * Check if turn can accept immediate message.
1015
- * True if turn is active (not finished, not aborted).
1016
- * @returns True if turn can accept an immediate message
1017
- */
1018
- canAcceptImmediate(): boolean;
1019
- }
1020
- //#endregion
1021
- //#region adapters/core/src/session/user-message-queue.d.ts
1022
- /**
1023
- * Simple FIFO queue for user messages with delivery mode support.
1024
- *
1025
- * This queue is owned by adapter Connectors and passed to Sessions for processing.
1026
- *
1027
- * Delivery modes:
1028
- * - 'enqueue': Add to end of queue (default); internal retries are prioritized
1029
- * ahead of already queued user turns.
1030
- * - 'replace': Supersede all unacknowledged messages, add to queue
1031
- * - 'immediate': Handled by Session (abort/restart), not queue
1032
- *
1033
- * Design:
1034
- * - Connector enqueues messages as they arrive
1035
- * - Session dequeues messages when ready to process
1036
- * - Peek allows Session to inspect next message without removing
1037
- */
1038
- declare class UserMessageQueue {
1039
- private readonly queue;
1040
- /**
1041
- * Add message to queue based on delivery mode.
1042
- * @param handle - Message handle to enqueue
1043
- */
1044
- enqueue(handle: MessageHandle): void;
1045
- /**
1046
- * Enqueue an internal retry before ordinary queued user turns while preserving
1047
- * immediate-mode ordering and FIFO ordering among retries.
1048
- * @param handle - Internal retry handle to enqueue
1049
- */
1050
- private enqueueInternalRetry;
1051
- /**
1052
- * Remove all superseded messages from queue.
1053
- */
1054
- private removeSuperseded;
1055
- /**
1056
- * Remove and return first message from queue.
1057
- * @returns First message or undefined if queue empty
1058
- */
1059
- dequeue(): MessageHandle | undefined;
1060
- /**
1061
- * Look at first message without removing.
1062
- * @returns First message or undefined if queue empty
1063
- */
1064
- peek(): MessageHandle | undefined;
1065
- /**
1066
- * Check if queue is empty.
1067
- * @returns True if queue has no messages
1068
- */
1069
- isEmpty(): boolean;
1070
- /**
1071
- * Get current queue size.
1072
- * @returns Number of messages in queue
1073
- */
1074
- size(): number;
1075
- /**
1076
- * Clear all messages from queue.
1077
- */
1078
- clear(): void;
1079
- /**
1080
- * Find the first immediate message in the queue.
1081
- * @returns First immediate message or undefined
1082
- */
1083
- findImmediate(): MessageHandle | undefined;
1084
- /**
1085
- * Remove a specific immediate message from the queue.
1086
- * @param handle - Handle to remove
1087
- */
1088
- removeImmediate(handle: MessageHandle): void;
1089
- /**
1090
- * Remove and return all enqueued (non-immediate) messages.
1091
- * Used when immediate arrives to merge their content.
1092
- * @returns Array of enqueued message handles in FIFO order
1093
- */
1094
- drainEnqueued(): MessageHandle[];
1095
- }
1096
- //#endregion
1097
- //#region adapters/core/src/session/process-queue.d.ts
1098
- /**
1099
- * Canonical error message used when a queued message cannot be processed
1100
- * because the session has entered the shutdown path.
1101
- *
1102
- * Shared between {@link rejectQueuedHandles} (queue drain) and the per-handle
1103
- * shutdown gate ({@link BaseConnectorSession.completeHandleIfClosing}) so that
1104
- * callers see a consistent error contract regardless of whether the handle was
1105
- * still in the queue or had already been dequeued when `close()` interleaved.
1106
- */
1107
- declare const SESSION_CLOSED_QUEUE_ERROR = "Session closed before queued message could be processed";
1108
- /**
1109
- * Minimal turn interface required by processQueue orchestration.
1110
- *
1111
- * Any turn implementation (Claude, Gemini, OpenAI, Copilot) that exposes
1112
- * these methods can participate in the shared processQueue flow.
1113
- */
1114
- interface QueueableTurn {
1115
- canAcceptImmediate(): boolean;
1116
- isCompleted(): boolean;
1117
- getMessageHandle(): MessageHandle;
1118
- pause(): Promise<PauseResult>;
1119
- }
1120
- /**
1121
- * Result of processing an immediate message merge.
1122
- *
1123
- * Returned by the `extractMergeContent` callback so that adapters
1124
- * can collect adapter-specific content (e.g., Gemini collects non-text parts).
1125
- * The `mergedContent` array is always present; `extra` is an opaque bag
1126
- * for adapter-specific data that flows through to `startNewTurn`.
1127
- */
1128
- interface MergeResult {
1129
- /** Text content collected from superseded/merged messages */
1130
- mergedContent: string[];
1131
- /** Adapter-specific merge data (e.g., non-text parts for Gemini) */
1132
- extra?: unknown;
1133
- }
1134
- /**
1135
- * Callbacks for adapter-specific behavior during queue processing.
1136
- * @typeParam TExtra - Type of adapter-specific extra merge data
1137
- */
1138
- interface ProcessQueueCallbacks<TExtra = unknown> {
1139
- /**
1140
- * Get the current turn, if any.
1141
- * @returns The current turn or undefined
1142
- */
1143
- getCurrentTurn: () => QueueableTurn | undefined;
1144
- /**
1145
- * Extract text content from a message handle for merge.
1146
- * Default: `handle.message.message as string`
1147
- * @param handle - The message handle to extract content from
1148
- * @returns The text content
1149
- */
1150
- extractContent?: (handle: MessageHandle) => string;
1151
- /**
1152
- * Called after merge content is collected from superseded/enqueued messages.
1153
- * Allows adapters to collect additional content (e.g., Gemini's non-text parts).
1154
- *
1155
- * If not provided, only text content is collected using `extractContent`.
1156
- * @param currentHandle - The in-flight message handle being superseded (or undefined)
1157
- * @param enqueuedHandles - The enqueued handles being merged
1158
- * @returns Extra merge data to pass through to startNewTurn
1159
- */
1160
- collectMergeExtra?: (currentHandle: MessageHandle | undefined, enqueuedHandles: MessageHandle[]) => TExtra;
1161
- /**
1162
- * Hook called after merge is collected but before starting the new turn.
1163
- * Used by Claude to create a fresh query instance.
1164
- */
1165
- onBeforeImmediateTurn?: () => Promise<void>;
1166
- /**
1167
- * Start a new turn with the given message and optional merge data.
1168
- *
1169
- * Returns `void` (or `undefined`) when the turn was started normally.
1170
- * Returns `false` explicitly when the turn was **not** started (e.g.,
1171
- * shutdown interleaved during setup and the handle was completed with
1172
- * an error). `processQueueMessages` propagates this so callers see an
1173
- * accurate "no turn started" result and can transition to idle.
1174
- * @param handle - The message handle to process
1175
- * @param mergedContent - Text content from superseded/merged messages
1176
- * @param extra - Adapter-specific extra merge data
1177
- * @returns `false` when the turn was skipped; `void` otherwise
1178
- */
1179
- startNewTurn: (handle: MessageHandle, mergedContent?: string[], extra?: TExtra) => Promise<void | false>;
1180
- }
1181
- /**
1182
- * Shared processQueue orchestration for all session implementations.
1183
- *
1184
- * Handles the complete immediate-mode flow:
1185
- * 1. Detect immediate message while a turn is active
1186
- * 2. Pause the active turn
1187
- * 3. Supersede the in-flight message and drain enqueued messages
1188
- * 4. Collect merged content from all superseded/merged messages
1189
- * 5. Start a new turn with the immediate message and merged context
1190
- *
1191
- * Also handles the normal queue flow:
1192
- * - Late immediate rejection (immediate arrives after turn finishes)
1193
- * - Normal enqueue/replace message processing
1194
- *
1195
- * Returns `true` when a new turn was started, `false` otherwise.
1196
- * Callers can use this to decide whether to transition to idle when
1197
- * the queue drains without starting a new turn (e.g., all-rejection case).
1198
- * @param queue - The user message queue to process
1199
- * @param callbacks - Adapter-specific callbacks
1200
- * @returns True if a new turn was started, false otherwise
1201
- * @typeParam TExtra - Type of adapter-specific extra merge data
1202
- */
1203
- declare function processQueueMessages<TExtra = unknown>(queue: UserMessageQueue, callbacks: ProcessQueueCallbacks<TExtra>): Promise<boolean>;
1204
- /**
1205
- * Drain all remaining handles from the queue and complete each with an error
1206
- * outcome so callers awaiting `waitForCompletion()` resolve deterministically.
1207
- *
1208
- * Used by session implementations during shutdown to prevent queued messages
1209
- * from hanging indefinitely when the session refuses to start new turns.
1210
- * @param queue - User message queue to drain
1211
- * @param message - Error message to attach to each rejected handle
1212
- */
1213
- declare function rejectQueuedHandles(queue: UserMessageQueue, message?: string): void;
1214
- //#endregion
1215
- //#region adapters/core/src/connector/procedural-agent-connector.d.ts
1216
- /**
1217
- * Minimal session interface required by ProceduralAgentConnector.
1218
- *
1219
- * Any session implementation (OpenAI, Copilot, Gemini) that exposes
1220
- * these methods can be used with ProceduralAgentConnector's default
1221
- * wireSessionEvents / processUserMessages / acceptsImmediate.
1222
- */
1223
- interface ProceduralConnectorSession {
1224
- /** Process messages from the queue. */
1225
- processQueue(queue: UserMessageQueue): Promise<void>;
1226
- /** Get the current turn for state inspection. */
1227
- getCurrentTurn(): QueueableTurn | undefined;
1228
- }
1229
- /**
1230
- * Turn subject references for wireSessionEvents.
1231
- *
1232
- * Each adapter provides its namespace-specific subjects. The subjects
1233
- * must accept TurnStateChangedPayload (or compatible shape).
1234
- * @typeParam TNamespace - The bus namespace string for subject typing
1235
- */
1236
- interface WireSessionSubjects<TNamespace extends string = string> {
1237
- turn_started: ScopedSubjectDefinition<TNamespace>;
1238
- step_started: ScopedSubjectDefinition<TNamespace>;
1239
- step_finished: ScopedSubjectDefinition<TNamespace>;
1240
- turn_finished: ScopedSubjectDefinition<TNamespace>;
1241
- }
1242
- /**
1243
- * Configuration for ProceduralAgentConnector's wireSessionEvents behavior.
1244
- *
1245
- * The `onTurnStarted` and `onTurnFinished` hooks allow adapters to inject
1246
- * logic at turn boundaries. By default both are no-ops.
1247
- */
1248
- interface WireSessionConfig {
1249
- /**
1250
- * Called when a new turn starts (turn_started bus event).
1251
- *
1252
- * Executes before the default `updateProcessingState('turn_started')` so
1253
- * the connector state machine is always updated regardless of this hook.
1254
- *
1255
- * Supports async so that turn-start operations with I/O — such as a pending
1256
- * MCP tool refresh via the bus — can complete before the API call is made.
1257
- * In-memory operations (recordInjection, consumeTurnNumber) are not affected
1258
- * by the async signature.
1259
- */
1260
- onTurnStarted?: () => Promise<void> | void;
1261
- /**
1262
- * Custom handler for turn_finished events.
1263
- *
1264
- * When provided, replaces the default turn_finished behavior entirely.
1265
- * The handler receives a callback to process the queue, which it should
1266
- * call when the message is considered complete and the queue should drain.
1267
- * @param drainQueue - Callback that processes the queue or goes idle
1268
- */
1269
- onTurnFinished?: (drainQueue: () => Promise<void>) => Promise<void>;
1270
- }
1271
- /**
1272
- * Abstract base class for procedural (non-event-driven) agent connectors.
1273
- *
1274
- * Procedural adapters (OpenAI, Copilot, Gemini) share common patterns:
1275
- * - wireSessionEvents: subscribe to turn lifecycle events and update processing state
1276
- * - processUserMessages: initialize session, enqueue, transition to active, process queue
1277
- * - complete: poll processing state until idle/paused
1278
- * - start: delegate to sendMessage and return AgentStartResult
1279
- * - acceptsImmediate: delegate to session's current turn
1280
- *
1281
- * Subclasses must implement:
1282
- * - `getSession()` / `ensureSession()` for session access and lazy initialization
1283
- * - `getSessionQueue()` for the adapter's UserMessageQueue instance
1284
- * - `getTurnSubjects()` for namespace-specific turn subjects
1285
- * - `sendMessage()`, `abort()`, `close()`, `interrupt()`, `getAdapterSessionId()`
1286
- *
1287
- * Subclasses may override:
1288
- * - `getWireSessionConfig()` for custom turn_finished behavior (e.g., Copilot multi-turn)
1289
- * @typeParam TBus - Scoped bus type for adapter namespace
1290
- * @typeParam TConfig - Configuration type extending BaseAgentConnectorConfig
1291
- */
1292
- declare abstract class ProceduralAgentConnector<TBus extends ScopedBus<string> = ScopedBus<string>, TConfig extends BaseAgentConnectorConfig<TBus> = BaseAgentConnectorConfig<TBus>> extends AIAgentConnector<TBus, TConfig> {
1293
- /** Whether turn event wiring has been setup. */
1294
- private turnEventsWired;
1295
- /**
1296
- * Get the adapter's session instance (may be undefined if not yet initialized).
1297
- * @returns The session or undefined
1298
- */
1299
- protected abstract getSession(): ProceduralConnectorSession | undefined;
1300
- /**
1301
- * Initialize and return the adapter's session.
1302
- * Must be idempotent (no-op if already initialized).
1303
- * @returns The initialized session
1304
- */
1305
- protected abstract ensureSession(): Promise<ProceduralConnectorSession>;
1306
- /**
1307
- * Get the adapter's UserMessageQueue instance.
1308
- * @returns The message queue
1309
- */
1310
- protected abstract getSessionQueue(): UserMessageQueue;
1311
- /**
1312
- * Get the adapter's namespace-specific turn subjects for wireSessionEvents.
1313
- * @returns Turn subject definitions
1314
- */
1315
- protected abstract getTurnSubjects(): WireSessionSubjects<TBus['namespace']>;
1316
- /**
1317
- * Get optional wire session configuration for custom turn_finished behavior.
1318
- * Override in subclasses that need non-standard turn_finished handling
1319
- * (e.g., Copilot multi-turn message completion).
1320
- * @returns Wire session configuration, or undefined for default behavior
1321
- */
1322
- protected getWireSessionConfig(): WireSessionConfig | undefined;
1323
- /**
1324
- * Wire Session turn events to Connector state updates.
1325
- *
1326
- * Session emits typed events, Connector subscribes and updates processing state.
1327
- * This maintains separation of concerns - Session does not know about Connector state.
1328
- *
1329
- * Default turn_finished behavior: transition through processing_finished to idle,
1330
- * or drain the queue if messages are pending. Override via `getWireSessionConfig()`.
1331
- */
1332
- protected wireSessionEvents(): void;
1333
- /**
1334
- * Process queued user messages by delegating to Session.
1335
- *
1336
- * Shared flow:
1337
- * 1. Initialize session if not yet created
1338
- * 2. Enqueue the message
1339
- * 3. Set adapterSessionId on handle
1340
- * 4. Transition to active if currently idle/paused
1341
- * 5. Process queue via session
1342
- * @param messageHandles - Array of message handles to process
1343
- * @returns Set of message handles that were processed
1344
- */
1345
- protected processUserMessages(messageHandles: MessageHandle[]): Promise<Set<MessageHandle>>;
1346
- /**
1347
- * Initialize the connector's SDK session without sending a message.
1348
- * Must set adapterSessionId before returning.
1349
- * Called by createAgent for idle agent setup.
1350
- * Implementations MUST be idempotent (no-op if already initialized).
1351
- * @param options - Optional start options (e.g., systemPrompt)
1352
- */
1353
- initialize(options?: ConnectorStartOptions): Promise<void>;
1354
- /**
1355
- * Start session with initial message.
1356
- * @param message - The initial message to send
1357
- * @param options - Optional send message options
1358
- * @returns The agent start result with session ID and message handle
1359
- */
1360
- start(message: NormalizedMessageInput, options?: ConnectorSendMessageOptions): Promise<AgentStartResult>;
1361
- /**
1362
- * Complete the agent session by waiting for all messages to finish.
1363
- * @returns Last message result or null if no messages processed
1364
- */
1365
- complete(): Promise<MessageResult | null>;
1366
- /**
1367
- * Returns true if current turn can accept immediate messages.
1368
- * @returns True if turn can accept immediate, false otherwise
1369
- */
1370
- protected acceptsImmediate(): boolean;
1371
- }
1372
- //#endregion
1373
760
  //#region adapters/core/src/utils/tool-approval.d.ts
1374
761
  /**
1375
762
  * Context required to complete a global tool approval request.
@@ -1976,6 +1363,44 @@ declare class AgentEventBridge {
1976
1363
  private emitOwnedStepFinished;
1977
1364
  }
1978
1365
  //#endregion
1366
+ //#region adapters/core/src/adapter/adapter-provider-key-publication.d.ts
1367
+ /**
1368
+ * The one gate a provider session passes before it leaves this adapter.
1369
+ *
1370
+ * **A provider key has one publisher per attempt: the party that claims it.**
1371
+ * For a start or rehydrate the adapter owns, that is the adapter — it announces
1372
+ * the movement and stamps the key on what it emits, and the movement observer
1373
+ * settles the currency. For a **caller-owned** one it is the caller: it reserved
1374
+ * the provider session before dispatching, and it settles the key its connector
1375
+ * confirms, under a generation token it minted and can give back. Until that
1376
+ * caller has been handed the key, nothing here may put it where somebody else
1377
+ * can act on it — an event field a consumer writes onto a session row, a durable
1378
+ * row write, an announcement the observer turns into a second generation.
1379
+ *
1380
+ * The rule was enforced per route before this module: the row write knew it, the
1381
+ * `agent.added` field knew it, enrichment knew it, and each new route had to be
1382
+ * found by a reviewer before it learned it. Two were missed that way. So the
1383
+ * question moves here, and every route asks it the same way — by taking the key
1384
+ * it publishes from {@link publishedProviderKey} rather than from the connector,
1385
+ * the registry or the start result.
1386
+ *
1387
+ * The gate stays closed after the successful dispatch response. It opens only
1388
+ * when the caller returns the adapter-minted acknowledgement token after its
1389
+ * durable ownership settlement. That makes the previously unobservable region
1390
+ * between response and settlement part of this adapter's lifecycle contract.
1391
+ */
1392
+ /**
1393
+ * Whether this attempt may publish the provider session it confirmed.
1394
+ *
1395
+ * Mutable, with exactly one writer — {@link releaseProviderKeyPublication}, in
1396
+ * the successful acknowledgement path. A caller-owned start or rehydrate carries
1397
+ * the same gate from dispatch through durable settlement.
1398
+ */
1399
+ interface ProviderKeyPublication {
1400
+ /** Whether the key is still the caller's to publish first. */
1401
+ deferred: boolean;
1402
+ }
1403
+ //#endregion
1979
1404
  //#region adapters/core/src/factory/create-adapter-namespace.d.ts
1980
1405
  /**
1981
1406
  * Adapter namespace extends BusNamespace with additional metadata for adapters.
@@ -2071,6 +1496,22 @@ interface AgentTurnExecutorConfig {
2071
1496
  * @param mode - Derived start mode for this turn
2072
1497
  */
2073
1498
  setPendingStartMode: (mode: StartMode) => void;
1499
+ /**
1500
+ * Report that this dispatch discards the pending start-time resume target,
1501
+ * moving the provider session before any provider confirmation.
1502
+ *
1503
+ * Mirrors the precondition every adapter session applies in its own
1504
+ * `suppressStartResumeIfRequested`: the caller disabled native resume, a
1505
+ * concrete resume target is still armed, and the provider has not confirmed
1506
+ * a session for the current connector generation. Under those conditions the
1507
+ * adapter drops the target and mints a fresh identity, so the previously
1508
+ * advertised provider session stops being valid resume currency.
1509
+ *
1510
+ * Awaited before the dispatch it describes, so the session row stops
1511
+ * advertising the abandoned provider session before the provider is asked to
1512
+ * start a new one.
1513
+ */
1514
+ onNativeResumeSuppressed?: () => void | Promise<void>;
2074
1515
  /** Completion/lifecycle tracker hook. */
2075
1516
  onMessageHandle: AgentMessageHandleCallback;
2076
1517
  /** Side-effect callback to mark agent status active before dispatch. */
@@ -2097,6 +1538,7 @@ declare class AgentTurnExecutor {
2097
1538
  private readonly shouldUseNativeResume;
2098
1539
  private readonly hasResumeTarget;
2099
1540
  private readonly setPendingStartMode;
1541
+ private readonly onNativeResumeSuppressed?;
2100
1542
  private readonly onMessageHandle;
2101
1543
  private readonly onBeforeDispatch?;
2102
1544
  private readonly runDispatch;
@@ -2137,10 +1579,39 @@ declare class AgentTurnExecutor {
2137
1579
  * Derive the start mode for the given resolved session context, stash it
2138
1580
  * as the pending mode for the next lifecycle start emission, and return
2139
1581
  * the native-resume decision shared by the dispatch that follows.
1582
+ *
1583
+ * Async because a suppressed resume target moves the provider session: the
1584
+ * movement is recorded before this returns, so the dispatch that abandons the
1585
+ * old provider session cannot be preceded by a resume that still targets it.
2140
1586
  * @param sessionContext - Session context after pre-user-message hooks
2141
1587
  * @returns Whether the connector should rely on native resume
2142
1588
  */
2143
1589
  private deriveAndSetPendingStartMode;
1590
+ /**
1591
+ * Whether this dispatch will move the provider session without confirmation.
1592
+ *
1593
+ * The armed target is abandoned unless the connector holds a *provider-committed*
1594
+ * session that carries continuity forward, which is what
1595
+ * `providerCommittedAdapterSessionId` resolves — the same sampling rule payload
1596
+ * enrichment applies, expressed once. It collapses the two reasons a reported
1597
+ * ID does not prove continuity: a fork awaiting `system.init` reports no
1598
+ * authoritative session at all, and a seeded resume the provider has not echoed
1599
+ * yet reports the very target this dispatch discards. Inferring "no movement"
1600
+ * from the raw accessor left the session row advertising an abandoned provider
1601
+ * thread until a later confirmation — or indefinitely, if the process died
1602
+ * first.
1603
+ *
1604
+ * Effectively one-shot per armed target, so this signal is not a retry clock:
1605
+ * the dispatch it precedes consumes the resume target, after which the
1606
+ * connector reports no pending rotation and mints its own identity — both
1607
+ * reasons stop matching. Re-delivering an announcement no consumer accepted is
1608
+ * therefore owned by `ConfirmedAdapterSessionTracker`, which parks the
1609
+ * undelivered movement and re-drives it from payload enrichment; this method
1610
+ * only has to report the movement honestly once.
1611
+ * @param useNativeResume - Native-resume decision for this dispatch
1612
+ * @returns `true` when the armed resume target is about to be discarded
1613
+ */
1614
+ private movesProviderSession;
2144
1615
  /**
2145
1616
  * Execute the turn pipeline for agent.sendMessage.
2146
1617
  * @param payload - agent.sendMessage request payload
@@ -2179,24 +1650,46 @@ declare class AgentTurnExecutor {
2179
1650
  private assertCanonicalMessageId;
2180
1651
  }
2181
1652
  //#endregion
2182
- //#region adapters/core/src/agent/connector-runtime.d.ts
2183
- /** Connector instance paired with its explicit client config lease. */
2184
- interface ConnectorRuntimeHandle<TConnector extends Pick<AIAgentConnector, 'close'>> {
2185
- /** Live connector instance. */
2186
- readonly connector: TConnector;
2187
- /** Lease whose lifetime exactly matches this connector. */
2188
- readonly lease?: AdapterAuthLeaseHandle;
2189
- }
2190
- /** Dependencies for creating one managed connector runtime. */
2191
- interface CreateConnectorRuntimeOptions<TBus extends ScopedBus<string>, TConnector extends AIAgentConnector<TBus>, TConfig extends BaseAgentConnectorConfig<TBus> = BaseAgentConnectorConfig<TBus>> {
2192
- /** Refs-only config emitted by the common adapter factory. */
2193
- readonly config: BoundAdapterRuntimeConfig<TBus, TConfig>;
2194
- /** Adapter connector constructor. */
2195
- readonly connectorFactory: (config: ResolvedAdapterRuntimeConfig<TBus, TConfig>) => TConnector | Promise<TConnector>;
2196
- /** Optional user-message callback attached only after auth preparation. */
2197
- readonly onMessageSent?: (handle: MessageHandle) => void;
2198
- /** Trusted host-local auth preparer; defaults to DirectChannel + client lease. */
2199
- readonly prepareAuthRuntime?: AdapterAuthRuntimePreparer<TBus, TConfig>;
1653
+ //#region adapters/core/src/agent/connector-swap-vetoed-error.d.ts
1654
+ /**
1655
+ * The typed refusal a connector replacement receives at the arbitration door.
1656
+ * @packageDocumentation
1657
+ */
1658
+ /** Why a replacement was refused before it produced any effect. */
1659
+ type ConnectorSwapVetoReason = /** A teardown of this agent was already in flight when the door was reached. */'teardown-in-flight'
1660
+ /**
1661
+ * The agent holds no connector runtime any more.
1662
+ *
1663
+ * Permanent rather than transient: the runtime reference is cleared before the
1664
+ * teardown's close is awaited, and only a start or a published replacement ever
1665
+ * sets it — so "the runtime is gone" is exactly the fact a post-teardown
1666
+ * replacement must not proceed on.
1667
+ */
1668
+ | 'no-runtime';
1669
+ /**
1670
+ * A connector replacement refused by the arbitration door.
1671
+ *
1672
+ * **Typed because the distinction it carries is not derivable from anything
1673
+ * else.** The door refuses before any replacement effect has occurred, so the
1674
+ * one path with a modelled answer for that — a warm rehydrate — may report
1675
+ * `not-dispatched` instead of leaving its caller uncertain. An untyped throw
1676
+ * lands in the generic replacement rollback and becomes "something failed,
1677
+ * possibly after reaching the provider", which is the strictly worse answer the
1678
+ * door exists to avoid.
1679
+ *
1680
+ * A compound failure is **never** this type. When a producer's own rollback also
1681
+ * fails, the veto is known but whether a replacement connector actually closed is
1682
+ * not, so that case stays an aggregate and keeps the uncertain classification.
1683
+ */
1684
+ declare class ConnectorSwapVetoedError extends Error {
1685
+ readonly agentId: string;
1686
+ readonly reason: ConnectorSwapVetoReason;
1687
+ /**
1688
+ * Build the refusal.
1689
+ * @param agentId - Agent whose replacement was refused
1690
+ * @param reason - Which of the door's two preconditions failed
1691
+ */
1692
+ constructor(agentId: string, reason: ConnectorSwapVetoReason);
2200
1693
  }
2201
1694
  //#endregion
2202
1695
  //#region adapters/core/src/agent/agent-lifecycle-emitter.d.ts
@@ -2282,8 +1775,23 @@ interface AgentPayloadEmitterConfig {
2282
1775
  getConnectorAdapterSessionId: () => string | undefined;
2283
1776
  /** Last known adapterSessionId cached across connector swaps. */
2284
1777
  getLastKnownAdapterSessionId: () => string | undefined;
2285
- /** Persist latest adapterSessionId after resolution. */
2286
- setLastKnownAdapterSessionId: (adapterSessionId: string | undefined) => void;
1778
+ /**
1779
+ * Persist latest adapterSessionId after resolution.
1780
+ *
1781
+ * May be asynchronous: the owning agent uses this sink to announce a moved
1782
+ * provider identity, and enrichment awaits it so no event carrying the new ID
1783
+ * is published before the movement is recorded.
1784
+ */
1785
+ setLastKnownAdapterSessionId: (adapterSessionId: string | undefined) => void | Promise<void>;
1786
+ /**
1787
+ * Whether the agent's provider session is this adapter's to publish yet.
1788
+ *
1789
+ * Absent means yes. While it answers `false` the enriched event carries no
1790
+ * provider session at all — a caller-owned start's key is the caller's to
1791
+ * publish, and a consumer that writes it onto a session row would advertise a
1792
+ * key no generation holds yet.
1793
+ */
1794
+ isProviderKeyPublishable?: () => boolean;
2287
1795
  /** Live event metadata defaults resolved from current runtime state. */
2288
1796
  getEventMetadataDefaults: () => AgentPayloadEventMetadata;
2289
1797
  }
@@ -2306,14 +1814,20 @@ declare class AgentPayloadEmitter {
2306
1814
  * non-Claude adapters) the locally-determined ID is authoritative and returned
2307
1815
  * immediately.
2308
1816
  *
2309
- * The `lastKnownAdapterSessionId` bridges connector swaps: when the old
2310
- * connector is gone and the new one is not yet wired, the cached value carries
2311
- * the confirmed ID from the previous connector.
1817
+ * The `lastKnownAdapterSessionId` bridges connector swaps *for stamping only*:
1818
+ * when the old connector is gone and the new one is not yet wired, the cached
1819
+ * value carries the confirmed ID from the previous connector. The recording
1820
+ * sink is deliberately not given that fallback — see the inline note.
1821
+ *
1822
+ * No async *resolution* fallback is used. `connector.getAdapterSessionId()`
1823
+ * may resolve with a provisional placeholder for fork sessions. Enrichment
1824
+ * must never stamp unconfirmed IDs — omitting the field is safe since R8
1825
+ * schemas allow it optional.
2312
1826
  *
2313
- * No async fallback is used. `connector.getAdapterSessionId()` may resolve
2314
- * with a provisional placeholder for fork sessions. Enrichment must never
2315
- * stamp unconfirmed IDs — omitting the field is safe since R8 schemas allow
2316
- * it optional.
1827
+ * The recording sink is awaited even though resolution stays synchronous: it
1828
+ * announces a moved provider identity, and that movement must be recorded
1829
+ * before this event advertises the new ID. Recording an unchanged ID — the
1830
+ * case for all but the first event of a generation — resolves without I/O.
2317
1831
  * @returns Confirmed adapter session ID or `undefined`
2318
1832
  */
2319
1833
  private resolveConfirmedAdapterSessionId;
@@ -2558,7 +2072,16 @@ type StartAgentRequestPayload = ExtractSubjectPayload<typeof AdapterSubjects.sta
2558
2072
  */
2559
2073
  type AgentCreationOptions = Omit<Partial<Pick<StartAgentRequestPayload, 'model' | 'cwd' | 'env' | 'allowedTools' | 'disallowedTools' | 'allowedDirectories' | 'reasoningEffort' | 'adapterConfig' | 'mode' | 'mcpSessionContext' | 'harnessId' | 'clientId' | 'clientProfileName' | 'providerContext' | 'ephemeral'>>, 'providerContext'> & {
2560
2074
  adapterSessionId?: string;
2561
- resumeAdapterSessionId?: string; /** Unresolved provider context (credential refs, not plaintext). */
2075
+ resumeAdapterSessionId?: string;
2076
+ /**
2077
+ * The attempt's provider-key publication gate.
2078
+ *
2079
+ * Carried into the agent because the routes inside it — the identity
2080
+ * enrichment stamps on every emitted event, the movement its tracker
2081
+ * announces — are publication routes like the start's own, and every route
2082
+ * asks one gate. See {@link ProviderKeyPublication}.
2083
+ */
2084
+ providerKeyPublication?: ProviderKeyPublication; /** Unresolved provider context (credential refs, not plaintext). */
2562
2085
  providerContext?: ProviderContext;
2563
2086
  /**
2564
2087
  * Source Makaio session ID when mode is 'fork'.
@@ -2637,6 +2160,10 @@ interface AgentRuntimeCreationResult {
2637
2160
  * @typeParam TBus - Scoped bus type for adapter-specific events
2638
2161
  */
2639
2162
  interface AIAdapterConfig<TBus extends ScopedBus<string> = ScopedBus<string>> {
2163
+ /** Session-ownership authority incarnation hosting this adapter. */
2164
+ ownerInstanceId: string;
2165
+ /** Stable machine identity hosting this adapter runtime. */
2166
+ machineId: string;
2640
2167
  /** Unique adapter name (e.g., 'openai-node', 'claude-code'). */
2641
2168
  name: string;
2642
2169
  /** Adapter capabilities (e.g., ['streaming', 'tools', 'vision']). */
@@ -2662,6 +2189,16 @@ interface AIAdapterConfig<TBus extends ScopedBus<string> = ScopedBus<string>> {
2662
2189
  /** Trusted non-serializable normalized auth preparer injected by the host. */
2663
2190
  prepareAuthRuntime?: AdapterAuthRuntimePreparer<TBus>;
2664
2191
  }
2192
+ /**
2193
+ * Runtime overrides accepted by concrete adapter constructors.
2194
+ *
2195
+ * Adapter implementations supply their own immutable name, capabilities, and
2196
+ * factories. The host must supply the ownership authority for every live
2197
+ * adapter, while all other runtime injections remain optional overrides.
2198
+ */
2199
+ type AIAdapterRuntimeConfig<TBus extends ScopedBus<string> = ScopedBus<string>> = Pick<AIAdapterConfig<TBus>, 'ownerInstanceId' | 'machineId' | 'adapterId' | 'globalBus' | 'scopedBus' | 'logImport' | 'definitionProviders' | 'clientId' | 'prepareAuthRuntime'> & {
2200
+ /** Platform-provided defaults (cwd, env). Injected by the runtime. */platformDefaults?: PlatformDefaults;
2201
+ };
2665
2202
  /**
2666
2203
  * Full constructor config including factory injections.
2667
2204
  *
@@ -2688,113 +2225,37 @@ interface AIAdapterConstructorConfig<TBus extends ScopedBus<string>, TConnector
2688
2225
  definitionProviders?: readonly AdapterProviderDefinition[];
2689
2226
  }
2690
2227
  //#endregion
2691
- //#region adapters/core/src/agent/agent-connector-lifecycle-manager.d.ts
2692
- /** Sanitized lifecycle diagnostic emitted after a replacement became primary. */
2693
- interface ConnectorCleanupDiagnostic {
2694
- /** Stable machine-readable failure category. */
2695
- readonly code: 'previous-connector-cleanup-failed';
2696
- /** Lifecycle stage whose cleanup failed. */
2697
- readonly stage: 'swap-old-runtime';
2698
- /** Agent owning the replacement connector. */
2699
- readonly agentId: string;
2700
- }
2701
- /** Final async guard run after the replacement is ready but before it becomes primary. */
2702
- type ConnectorSwapCommitGuard = () => void | Promise<void>;
2703
- /**
2704
- * Dependencies for connector lifecycle management.
2705
- */
2706
- interface AgentConnectorLifecycleManagerConfig<TBus extends ScopedBus<string>, TConnector extends AIAgentConnector<TBus>> {
2707
- /** Stable agent identifier (used for diagnostics). */
2708
- agentId: string;
2709
- /** Create config input for connector/config factories. */
2710
- buildConfigInput: (overrides?: AgentConnectorConfigOverrides) => ConfigFactoryInput<TBus>;
2711
- /** Adapter config factory from AIAgent config. */
2712
- configFactory: (input: ConfigFactoryInput<TBus>) => Promise<BaseAgentConnectorConfig<TBus> & {
2713
- adapterId: string;
2714
- }>;
2715
- /** Connector factory from AIAgent config. */
2716
- connectorFactory: (config: BaseAgentConnectorConfig<TBus> & {
2717
- adapterId: string;
2718
- }) => Promise<TConnector> | TConnector;
2719
- /** Trusted host-local auth preparer shared by every connector generation. */
2720
- prepareAuthRuntime?: AdapterAuthRuntimePreparer<TBus>;
2721
- /** Build onMessageSent callback for connector creation. */
2722
- createOnMessageSent: () => (handle: MessageHandle) => void;
2723
- /** Wire adapter-specific events on a connector instance. */
2724
- wireEvents: (connector: TConnector) => void | Promise<void>;
2725
- /** Emit idle lifecycle event on processing-state idle transitions. */
2726
- emitIdle: () => Promise<void>;
2727
- /** Get current connector plus its explicit client config lease. */
2728
- getConnectorRuntime: () => ConnectorRuntimeHandle<TConnector>;
2729
- /** Replace active connector and lease together on successful swap. */
2730
- setConnectorRuntime: (runtime: ConnectorRuntimeHandle<TConnector>) => void;
2731
- /** Get runtime system prompt to preserve across swaps. */
2732
- getRuntimeSystemPrompt: () => SystemPrompt | undefined;
2733
- /** Store latest adapter session ID for enrichment after swaps. */
2734
- setLastKnownAdapterSessionId: (adapterSessionId: string | undefined) => void;
2735
- /** Publish a sanitized cleanup diagnostic without exposing connector errors. */
2736
- reportCleanupFailure: (diagnostic: ConnectorCleanupDiagnostic) => void | Promise<void>;
2737
- }
2738
- /**
2739
- * Manages connector lifecycle for AIAgent.
2740
- *
2741
- * Owns per-connector wiring cleanup registration and swap lifecycle choreography.
2742
- */
2743
- declare class AgentConnectorLifecycleManager<TBus extends ScopedBus<string>, TConnector extends AIAgentConnector<TBus>> {
2744
- /** Cleanup functions for connector event wiring (cleared on each connector swap) */
2745
- private connectorWiringCleanups;
2746
- private readonly config;
2747
- constructor(config: AgentConnectorLifecycleManagerConfig<TBus, TConnector>);
2228
+ //#region adapters/core/src/adapter/agent-registry.d.ts
2229
+ /** What one agent teardown observed, plus whether there was an agent at all. */
2230
+ interface AgentDisposalReport extends TeardownReport {
2748
2231
  /**
2749
- * Register a cleanup function for connector wiring.
2750
- * @param cleanup - Cleanup function to register
2751
- */
2752
- addConnectorWiringCleanup(cleanup: () => void): void;
2753
- /**
2754
- * Clear connector wiring cleanups.
2755
- */
2756
- clearConnectorWiring(): void;
2757
- /**
2758
- * Wire base and adapter-specific connector events.
2759
- * @param connector - Connector instance to wire
2760
- */
2761
- wireAllConnectorEvents(connector: TConnector): Promise<void>;
2762
- /**
2763
- * Replace the active connector with a fresh instance.
2232
+ * Whether a live agent was found and its teardown attempted.
2764
2233
  *
2765
- * Uses create-before-close pattern with rollback to preserve availability.
2766
- * @param configOverrides - Optional runtime override fields
2767
- * @param beforeCommit - Final guard after replacement initialization and before publication
2768
- * @returns The replacement's provider-confirmed session ID, when it has one
2769
- */
2770
- swapConnector(configOverrides?: AgentConnectorConfigOverrides, beforeCommit?: ConnectorSwapCommitGuard): Promise<string | undefined>;
2771
- /**
2772
- * Build and materialize the replacement connector runtime.
2773
- * @param currentConnector - Active connector whose runtime values provide defaults
2774
- * @param configOverrides - Optional requested runtime changes
2775
- * @returns Prepared replacement connector and auth lease
2234
+ * True for a teardown this call joined as well as one it started: an agent *was*
2235
+ * found, by whichever caller got there first, and both callers are answered with
2236
+ * the same evidence.
2776
2237
  */
2777
- private createReplacementRuntime;
2778
- /**
2779
- * Wire and initialize a replacement, restoring the current wiring on failure.
2780
- * @param newRuntime - Replacement connector and auth lease
2781
- * @param oldWiringCleanups - Wiring still owned by the active connector
2782
- * @param beforeCommit - Optional final publication guard
2783
- * @returns Provider-confirmed session ID, when the replacement has one
2784
- */
2785
- private initializeReplacement;
2786
- /**
2787
- * Run superseded connector wiring cleanups without failing the committed swap.
2788
- * @param cleanups - Previous connector wiring cleanups
2789
- */
2790
- private runWiringCleanups;
2238
+ readonly found: boolean;
2239
+ }
2240
+ /** Options a teardown entry point accepts from the request that drove it. */
2241
+ interface AgentTeardownOptions {
2242
+ /** Whether this teardown must leave the durable agent row untouched. */
2243
+ readonly responsibility?: 'connector-only' | undefined;
2791
2244
  /**
2792
- * Close the superseded runtime and publish only a sanitized diagnostic on failure.
2793
- * @param currentRuntime - Superseded connector and auth lease
2245
+ * Absolute deadline of the request driving this teardown, when it has one.
2246
+ *
2247
+ * Passed through so a teardown that must wait for a connector replacement ends
2248
+ * its wait inside the deadline of whoever is waiting on it. Absent for
2249
+ * fan-out teardowns with no request behind them, where the policy ceiling stands
2250
+ * alone.
2794
2251
  */
2795
- private closePreviousRuntime;
2252
+ readonly deadline?: number | undefined;
2796
2253
  }
2797
2254
  //#endregion
2255
+ //#region adapters/core/src/agent/agent-connector-lifecycle-manager.d.ts
2256
+ /** Final async guard run after the replacement is ready but before it becomes primary. */
2257
+ type ConnectorSwapCommitGuard = () => void | Promise<void>;
2258
+ //#endregion
2798
2259
  //#region adapters/core/src/agent/ai-agent.d.ts
2799
2260
  /**
2800
2261
  * Abstract base class for AI agents.
@@ -2810,10 +2271,8 @@ declare abstract class AIAgent<TBus extends ScopedBus<string> = ScopedBus<string
2810
2271
  private connectorRuntime;
2811
2272
  protected confirmedModel?: string;
2812
2273
  protected initialModel?: string;
2813
- /** Cached adapterSessionId from the last connector that had a session — survives connector swaps. */
2814
- private lastKnownAdapterSessionId?;
2815
- /** Cleanup functions for bus subscriptions (stable, survive connector swap) */
2816
- private busHandlerCleanups;
2274
+ /** Owns the confirmed provider-session identity cache and the movement seam. */
2275
+ private readonly adapterSessionTracker;
2817
2276
  /** Whether init() has been called */
2818
2277
  private initialized;
2819
2278
  /** Runtime system prompt captured from start/initialize, preserved across connector swaps. */
@@ -2832,6 +2291,10 @@ declare abstract class AIAgent<TBus extends ScopedBus<string> = ScopedBus<string
2832
2291
  private readonly connectorLifecycleManager;
2833
2292
  /** Serialized connector replacement and runtime-config publication owner. */
2834
2293
  private readonly connectorSwapCoordinator;
2294
+ /** Classes of closes performed for this agent that no teardown waiter reported. */
2295
+ private readonly closeReportLedger;
2296
+ /** Callback every connector generation reports a submitted message through. */
2297
+ private readonly onMessageSent;
2835
2298
  /** Payload enrichment and global emission helper. */
2836
2299
  private readonly payloadEmitter;
2837
2300
  /** Stateful lifecycle emitter for start/complete/error/session.closed. */
@@ -2865,11 +2328,9 @@ declare abstract class AIAgent<TBus extends ScopedBus<string> = ScopedBus<string
2865
2328
  /**
2866
2329
  * Create the connector lifecycle collaborator bound to this agent instance.
2867
2330
  * @param emitGlobal - Enriched global event emitter
2868
- * @param setLastKnownAdapterSessionId - Sink for the latest confirmed provider session
2869
2331
  * @returns Connector lifecycle manager for this agent
2870
2332
  */
2871
2333
  private createConnectorLifecycleManager;
2872
- private getEventMetadataDefaults;
2873
2334
  /** @returns Unique agent identifier */
2874
2335
  get agentId(): string;
2875
2336
  /** @returns Adapter instance identifier */
@@ -3043,9 +2504,12 @@ declare abstract class AIAgent<TBus extends ScopedBus<string> = ScopedBus<string
3043
2504
  * as baseline for non-overridden fields.
3044
2505
  * @param configOverrides - Optional config overrides (e.g., new cwd, model)
3045
2506
  * @param beforeCommit - Optional guard executed before replacing the active connector
2507
+ * @param settledByCaller - Whether the caller writes the replacement's durable
2508
+ * currency itself, in which case the swap records the confirmed session
2509
+ * without announcing it as a movement
3046
2510
  * @throws Error if connector is currently processing a turn
3047
2511
  */
3048
- swapConnector(configOverrides?: AgentConnectorConfigOverrides, beforeCommit?: ConnectorSwapCommitGuard): Promise<void>;
2512
+ swapConnector(configOverrides?: AgentConnectorConfigOverrides, beforeCommit?: ConnectorSwapCommitGuard, settledByCaller?: boolean): Promise<void>;
3049
2513
  /**
3050
2514
  * Build config factory input from agent config with optional overrides.
3051
2515
  *
@@ -3055,13 +2519,6 @@ declare abstract class AIAgent<TBus extends ScopedBus<string> = ScopedBus<string
3055
2519
  * @returns ConfigFactoryInput ready for config factory
3056
2520
  */
3057
2521
  private buildConfigInput;
3058
- /**
3059
- * Create the onMessageSent callback for connector factories.
3060
- *
3061
- * Returns a callback that emits user_message.sent events to the global bus.
3062
- * @returns Callback function for connector config
3063
- */
3064
- private createOnMessageSent;
3065
2522
  /**
3066
2523
  * Wire adapter-specific connector events.
3067
2524
  * Called automatically during init() and connector swap.
@@ -3085,11 +2542,53 @@ declare abstract class AIAgent<TBus extends ScopedBus<string> = ScopedBus<string
3085
2542
  *
3086
2543
  * Emits session.closed event (once per session) unless explicitly suppressed,
3087
2544
  * then unsubscribes from all bus handlers and aborts the connector if available.
2545
+ * Reports the class the connector runtime observed, or `released` when there was
2546
+ * no runtime — provably nothing is speaking in that case.
2547
+ *
2548
+ * **A bus-handler cleanup failure does not downgrade the class**, because a local
2549
+ * listener that refuses to unsubscribe cannot keep a provider conversation alive.
2550
+ * A failed lease release *does* downgrade, because the lease is a resource this
2551
+ * runtime held; that asymmetry is the whole distinction.
2552
+ *
2553
+ * **The report is for the agent, not only for the runtime it is holding now.** A
2554
+ * connector replacement closes runtimes on this agent's behalf, and when no
2555
+ * teardown was waiting to receive what those closes observed, the classes are
2556
+ * booked on the agent — so they are aggregated here rather than lost, and a
2557
+ * runtime that was superseded unobserved cannot be answered for as if it had
2558
+ * never existed.
3088
2559
  * @param options - Cleanup options; ephemeral agents suppress session-close lifecycle events because they never join a session.
2560
+ * @returns What this agent observed about the end of its resources
3089
2561
  */
3090
2562
  close(options?: {
3091
2563
  emitSessionClosed?: boolean;
3092
- }): Promise<void>;
2564
+ }): Promise<TeardownReport>;
2565
+ /**
2566
+ * Give this agent's identity up, closing nothing.
2567
+ *
2568
+ * **For the teardown that abandons its wait on a connector replacement.** From
2569
+ * the instant that wait expires this agent is no longer the instance answering
2570
+ * for its ID — the registry entry is dropped in the same arm, so a successor may
2571
+ * claim the ID immediately — while the runtimes stay with the replacement until
2572
+ * it settles, which can be a whole wait later. Waiting for that settlement to
2573
+ * unsubscribe leaves both agents answering for one identity in between.
2574
+ *
2575
+ * It closes nothing, reports nothing and emits nothing: the expiry arm's
2576
+ * `unknown` is the honest statement about the runtimes, and this changes none of
2577
+ * it. Safe to call twice — the cleanups are taken off their list, not merely run.
2578
+ */
2579
+ releaseIdentityWiring(): void;
2580
+ /**
2581
+ * Take this agent's connector runtime away from it.
2582
+ *
2583
+ * Clearing the reference **before** the close is awaited is what makes "the
2584
+ * runtime is gone" permanent: only a start or a published replacement ever sets
2585
+ * it, so a replacement arriving after a teardown began finds the absence and is
2586
+ * refused instead of building onto a dying agent. The abandoned-waiter path in
2587
+ * the replacement coordinator needs the same guarantee, which is why this is one
2588
+ * method and not two copies of a two-line sequence.
2589
+ * @returns The runtime this agent held, or `undefined` when it held none
2590
+ */
2591
+ private detachConnectorRuntime;
3093
2592
  /**
3094
2593
  * Ensure the connector is initialized, throwing if not.
3095
2594
  * @returns The initialized connector instance
@@ -3151,6 +2650,49 @@ declare abstract class AIAgent<TBus extends ScopedBus<string> = ScopedBus<string
3151
2650
  * @throws Error if connector is not initialized
3152
2651
  */
3153
2652
  getAdapterSessionId(): Promise<string>;
2653
+ /**
2654
+ * Announce the provider session this generation resolved to, through the
2655
+ * agent's own movement tracker.
2656
+ *
2657
+ * For producers outside the turn pipeline — cold rehydration resolves an
2658
+ * identity before the agent has emitted anything, so payload enrichment has
2659
+ * not run yet. Routing through the tracker rather than emitting on the seam
2660
+ * directly is what keeps an undelivered announcement retryable: the tracker's
2661
+ * acknowledged-announcement marker is the retry anchor, and the agent's next
2662
+ * emitted event re-drives the announcement. It also makes the announcement
2663
+ * idempotent against that first enrichment call instead of duplicating it.
2664
+ * **Who writes the durable currency is a parameter, not a second method.**
2665
+ * A start or rehydrate whose caller owns the agent row settles the confirmed
2666
+ * key itself, under a generation token that caller minted and can give back;
2667
+ * announcing the same movement would make the observer a second settle
2668
+ * producer for one identity, and its generation would be held under a token
2669
+ * nobody in that caller's failure paths can name. One entry point keeps that
2670
+ * choice explicit at every call site rather than letting a future producer
2671
+ * pick the announcing variant by not knowing there is another — see
2672
+ * {@link ConfirmedAdapterSessionTracker.recordCallerSettled}.
2673
+ * @param adapterSessionId - Provider session ID this generation is current on
2674
+ * @param settledByCaller - Whether the caller writes this movement's currency itself
2675
+ * @returns Promise resolving once the announcement attempt completed
2676
+ */
2677
+ recordConfirmedAdapterSession(adapterSessionId: string, settledByCaller?: boolean): Promise<void>;
2678
+ /**
2679
+ * Record the durable settlement acknowledged for a caller-owned generation.
2680
+ * @param adapterSessionId - Provider session settled, or undefined when none was confirmed
2681
+ */
2682
+ acknowledgeCallerSettledAdapterSession(adapterSessionId: string | undefined): void;
2683
+ /**
2684
+ * Provider session this agent is currently the live writer of.
2685
+ *
2686
+ * The occupancy authority for the adapter's registry. Synchronous on purpose:
2687
+ * the claim check serializing two concurrent resume attaches reads it inside a
2688
+ * critical section, which {@link getAdapterSessionId} — awaiting the connector —
2689
+ * cannot serve. Current before any movement is announced, because the tracker
2690
+ * caches a confirmed identity before announcing it; that ordering is what lets a
2691
+ * concurrent attach see this agent occupying the session the same announcement
2692
+ * publishes as resume currency.
2693
+ * @returns Last provider-confirmed session ID, or `undefined` before the first confirmation
2694
+ */
2695
+ get currentAdapterSessionId(): string | undefined;
3154
2696
  /**
3155
2697
  * Complete the agent session by waiting for all messages to finish.
3156
2698
  *
@@ -3217,6 +2759,10 @@ interface AIAdapterContext<Scope extends ScopedBus<string>> {
3217
2759
  declare abstract class AIAdapter<TBus extends ScopedBus<string> = ScopedBus<string>, TConnector extends AIAgentConnector<TBus> = AIAgentConnector<TBus>, TAgent extends AIAgent<TBus, TConnector> = AIAgent<TBus, TConnector>> {
3218
2760
  /** Unique identifier for this adapter instance. */
3219
2761
  readonly adapterId: string;
2762
+ /** Session-ownership authority incarnation hosting this adapter. */
2763
+ readonly ownerInstanceId: string;
2764
+ /** Stable machine identity hosting this adapter runtime. */
2765
+ readonly machineId: string;
3220
2766
  /** Adapter name (e.g., 'openai-node', 'claude-code'). */
3221
2767
  readonly name: string;
3222
2768
  /** Adapter capabilities for runtime feature detection. */
@@ -3229,14 +2775,18 @@ declare abstract class AIAdapter<TBus extends ScopedBus<string> = ScopedBus<stri
3229
2775
  protected readonly globalBus: IMakaioBus;
3230
2776
  /** Scoped bus for adapter-specific communication. Created in init(). */
3231
2777
  protected adapterBus: TBus;
2778
+ /**
2779
+ * The one place a teardown and a connector replacement meet on this instance.
2780
+ * One adapter instance is exactly its scope; see {@link AgentTeardownArbiter}.
2781
+ */
2782
+ private readonly teardownArbiter;
3232
2783
  /** Registry of active agents with session info and usage totals. */
3233
2784
  private readonly registry;
3234
2785
  /** Cleanup functions for bus subscriptions. */
3235
2786
  private cleanupFns;
3236
2787
  /** Manages agent rehydration with single-flight deduplication. */
3237
2788
  private readonly rehydrationManager;
3238
- /** Tracks whether the adapter has been initialized. */
3239
- private initialized;
2789
+ private readonly lifecycle;
3240
2790
  /** Client identifier for the application this adapter belongs to (e.g., 'claude-code', 'codex'). */
3241
2791
  protected readonly clientId?: string;
3242
2792
  /** Platform-provided defaults (cwd, env) injected by runtime. Lowest priority. */
@@ -3281,8 +2831,12 @@ declare abstract class AIAdapter<TBus extends ScopedBus<string> = ScopedBus<stri
3281
2831
  * @param ctx - Event context with usage payload
3282
2832
  */
3283
2833
  private handleUsage;
3284
- /** Initialize adapter (idempotent). Creates scoped bus, sets up handlers, emits adapter.initialized. */
2834
+ /**
2835
+ * Initialize or join the current adapter generation's initialization.
2836
+ * @returns Promise settled when the adapter is publicly initialized
2837
+ */
3285
2838
  init(): Promise<void>;
2839
+ private initializeGeneration;
3286
2840
  /** Hook for subclass initialization. Override to perform async setup (connections, auth, etc.). */
3287
2841
  protected onInit(): Promise<void>;
3288
2842
  /**
@@ -3297,18 +2851,15 @@ declare abstract class AIAdapter<TBus extends ScopedBus<string> = ScopedBus<stri
3297
2851
  */
3298
2852
  protected createAgent(agentId: string, sessionId: string, request: AgentCreationOptions): Promise<TAgent>;
3299
2853
  /**
3300
- * Asynchronous cleanup for awaitable shutdown.
3301
- * Runs cleanup functions, aborts agents, allows subclass cleanup via onClose hook.
2854
+ * Run or join awaitable adapter shutdown.
3302
2855
  * @returns Promise that resolves when cleanup is complete
3303
2856
  */
3304
- closeAsync(): Promise<void>;
3305
- /**
3306
- * Cleanup resources and unsubscribe from bus.
3307
- * Runs cleanup functions, aborts agents, allows subclass cleanup via onClose hook.
3308
- */
2857
+ closeAsync(): Promise<ConnectorTeardownResult>;
2858
+ private runClose;
2859
+ /** Start cleanup without awaiting its completion. */
3309
2860
  close(): void;
3310
2861
  /** Hook for subclass cleanup. Override to perform async teardown (close connections, etc.). */
3311
- protected onClose(): Promise<void>;
2862
+ protected onClose(): Promise<ConnectorTeardownResult | void>;
3312
2863
  /**
3313
2864
  * Get a live agent and its registry-owned session metadata.
3314
2865
  * @param agentId - Agent identifier
@@ -3316,13 +2867,16 @@ declare abstract class AIAdapter<TBus extends ScopedBus<string> = ScopedBus<stri
3316
2867
  */
3317
2868
  getAgent(agentId: string): ActiveAgentHandle<TAgent> | undefined;
3318
2869
  /**
3319
- * Dispose resources for an agent.
2870
+ * Dispose resources for an agent and report what the teardown observed.
3320
2871
  *
3321
- * Aborts the agent and removes it from the tracking map.
2872
+ * `found` answers the question the boolean return always answered — was there an
2873
+ * agent here — and the class answers the one it could not: whether anything of
2874
+ * ours provably stopped speaking to the provider.
3322
2875
  * @param agentId - Agent identifier
3323
- * @returns true if agent was found and disposed, false otherwise
2876
+ * @param options - The driving request's deadline, when there is one
2877
+ * @returns Whether an agent was found, and what its teardown observed
3324
2878
  */
3325
- disposeAgent(agentId: string): boolean;
2879
+ disposeAgent(agentId: string, options?: AgentTeardownOptions): Promise<AgentDisposalReport>;
3326
2880
  /**
3327
2881
  * Get all active agents managed by this adapter.
3328
2882
  * @returns Active agent handles
@@ -3353,37 +2907,37 @@ declare abstract class AIAdapter<TBus extends ScopedBus<string> = ScopedBus<stri
3353
2907
  * name: 'openai-node',
3354
2908
  * displayName: 'OpenAI',
3355
2909
  * description: 'OpenAI chat completions with streaming and tool calling',
3356
- * createAdapter: (options) => createOpenAINodeAdapter({ adapterId: options?.adapterId }),
2910
+ * createAdapter: (options) => createOpenAINodeAdapter(options),
3357
2911
  * };
3358
2912
  * ```
3359
2913
  */
3360
- interface AIAdapterDefinition<TBus extends ScopedBus<string> = ScopedBus<string>, TConnector extends AIAgentConnector<TBus> = AIAgentConnector<TBus>, TAgent extends AIAgent<TBus, TConnector> = AIAgent<TBus, TConnector>> extends AdapterDefinitionContract<AIAdapter<TBus, TConnector, TAgent>, AIAdapterInitOptions> {
2914
+ interface AIAdapterDefinition<TBus extends ScopedBus<string> = ScopedBus<string>, TConnector extends AIAgentConnector<TBus> = AIAgentConnector<TBus>, TAgent extends AIAgent<TBus, TConnector> = AIAgent<TBus, TConnector>> extends AdapterDefinitionContract<AIAdapter<TBus, TConnector, TAgent>, AIAdapterRuntimeInitOptions> {
3361
2915
  /**
3362
2916
  * Client packages this adapter can delegate to.
3363
2917
  *
3364
2918
  * Each reference names a client extension by stable ID and declares the
3365
2919
  * compatible client package version range. Runtime initialization still
3366
- * receives a selected `clientId` through {@link AIAdapterInitOptions}; this
2920
+ * receives a selected `clientId` through {@link AIAdapterRuntimeInitOptions}; this
3367
2921
  * definition field is the adapter-to-client capability declaration.
3368
2922
  */
3369
2923
  readonly clients?: readonly AdapterClientRef[];
3370
2924
  /**
3371
2925
  * Adapter definitions declare client compatibility through {@link clients}.
3372
2926
  *
3373
- * `AIAdapterInitOptions.clientId` remains the runtime-selected client
2927
+ * `AIAdapterRuntimeInitOptions.clientId` remains the runtime-selected client
3374
2928
  * override passed to adapter factories for existing client-backed adapters.
3375
2929
  */
3376
2930
  readonly clientId?: never;
3377
2931
  /**
3378
2932
  * Factory that creates and initializes the adapter instance.
3379
2933
  *
3380
- * Inherits the typed {@link AIAdapterInitOptions} parameter from the base
2934
+ * Inherits the typed {@link AIAdapterRuntimeInitOptions} parameter from the base
3381
2935
  * contract's `TOptions` generic, carrying platform defaults, log import
3382
2936
  * config, and provider definitions injected at runtime.
3383
- * @param options - Optional initialization options injected by the runtime.
2937
+ * @param options - Runtime identity and initialization options injected by the host.
3384
2938
  * @returns The initialized adapter instance.
3385
2939
  */
3386
- readonly createAdapter: (options?: AIAdapterInitOptions) => Promise<AIAdapter<TBus, TConnector, TAgent>>;
2940
+ readonly createAdapter: (options: AIAdapterRuntimeInitOptions) => Promise<AIAdapter<TBus, TConnector, TAgent>>;
3387
2941
  }
3388
2942
  //#endregion
3389
2943
  //#region adapters/core/src/types/messaging.d.ts
@@ -3515,6 +3069,24 @@ interface TestModelRef {
3515
3069
  /** Default reasoning effort for tests that exercise reasoning. */
3516
3070
  reasoningEffort?: AIReasoningLevel$1;
3517
3071
  }
3072
+ /**
3073
+ * Which of an adapter's declared authentication methods a conformance config
3074
+ * should select.
3075
+ *
3076
+ * `config-default` is the live-harness order: a config picks whatever it would
3077
+ * pick for a real conformance run, including an `inferred` method that inherits
3078
+ * a developer's native client login.
3079
+ *
3080
+ * `declared-credentials` forbids that inheritance. It asks the config for a
3081
+ * method whose credentials come from declared sources, so that a caller which
3082
+ * supplies those sources can construct the connector identically on every
3083
+ * machine. Cases in the default test run need this: an `inferred` method is only
3084
+ * materializable where somebody has logged the vendor client in, and a gate that
3085
+ * is green only on a logged-in developer machine is not a gate. Configs whose
3086
+ * adapters declare nothing but credential-backed methods already satisfy it and
3087
+ * may ignore it.
3088
+ */
3089
+ type ConformanceAuthSelection = 'config-default' | 'declared-credentials';
3518
3090
  /**
3519
3091
  * Provider definitions supplied by the conformance harness.
3520
3092
  *
@@ -3524,6 +3096,11 @@ interface TestModelRef {
3524
3096
  interface CreateConformanceTestConfigOptions {
3525
3097
  /** Full provider definitions available to conformance tests. */
3526
3098
  providerDefinitions?: readonly ProviderDefinitionInput[];
3099
+ /**
3100
+ * Auth-method selection policy for this config. Defaults to
3101
+ * `config-default` when the harness expresses no requirement.
3102
+ */
3103
+ authSelection?: ConformanceAuthSelection;
3527
3104
  }
3528
3105
  /**
3529
3106
  * Options for creating test agent instances.
@@ -3809,12 +3386,12 @@ interface ConformanceTestConfig<TBus extends ScopedBus<string> = ScopedBus<strin
3809
3386
  * @example
3810
3387
  * ```typescript
3811
3388
  * createAdapter: (options) => createClaudeAdapter({
3812
- * adapterId: options?.adapterId ?? `test-${crypto.randomUUID()}`,
3813
- * ...options
3389
+ * ...options,
3390
+ * adapterId: options.adapterId,
3814
3391
  * })
3815
3392
  * ```
3816
3393
  */
3817
- createAdapter?: (options?: AIAdapterInitOptions) => Promise<AIAdapter<TBus, TConnector, TAgent>>;
3394
+ createAdapter?: (options: AIAdapterRuntimeInitOptions) => Promise<AIAdapter<TBus, TConnector, TAgent>>;
3818
3395
  /**
3819
3396
  * Adapter type name for orchestration tests (e.g., 'claude-code').
3820
3397
  * Required when createAdapter is provided.
@@ -3862,6 +3439,10 @@ declare class ConformanceConnectorRuntimeRegistry<TBus extends ScopedBus<string>
3862
3439
  create<TConfig extends BaseAgentConnectorConfig<TBus>>(options: CreateConnectorRuntimeOptions<TBus, TConnector, TConfig>): Promise<TConnector>;
3863
3440
  /**
3864
3441
  * Close every connector still owned by this configuration.
3442
+ *
3443
+ * The managed close reports instead of rejecting, so the failures are read out
3444
+ * of the reports; a suite teardown that swallowed them would hide exactly the
3445
+ * lease leak this registry exists to catch.
3865
3446
  * @throws The single close failure, or an AggregateError containing all failures
3866
3447
  */
3867
3448
  closeAll(): Promise<void>;
@@ -4583,4 +4164,4 @@ declare const ToolCompletedEventSchema: z.ZodObject<{
4583
4164
  type ToolStartedEvent = z.infer<typeof ToolStartedEventSchema>;
4584
4165
  type ToolCompletedEvent = z.infer<typeof ToolCompletedEventSchema>;
4585
4166
  //#endregion
4586
- export { AIAdapter, type AIAdapterCapabilities, type AIAdapterCapability, type AIAdapterCapabilityRegistry, type AIAdapterConfig, type AIAdapterConstructorConfig, type AIAdapterContext, type AIAdapterDefinition, type AIAdapterInitOptions, type AIAdapterPromptFailureResult, type AIAdapterPromptOptions, type AIAdapterPromptResult, type AIAdapterPromptSuccessResult, AIAgent, type AIAgentConfig, AIAgentConnector, type AIModel, type AIReasoningLevel, type ActiveAgentHandle, type AdapterNamespace, type AdapterProviderDefinition, type AgentBusHandlerRegistrarConfig, type AgentCompleteEvent, AgentCompleteEventSchema, AgentConnectorLifecycleManager, type AgentConnectorLifecycleManagerConfig, type AgentContext, AgentEventBridge, type AgentEventBridgeConfig, type AgentIdentity, AgentLifecycleEmitter, type AgentLifecycleEmitterConfig, AgentPayloadEmitter, type AgentPayloadEmitterConfig, type AgentRuntimeCreationResult, AgentRuntimeMutationManager, type AgentRuntimeMutationManagerConfig, type AgentSendMessageOptions, type AgentStartResult, type AgentStartedEvent, AgentStartedEventSchema, AgentTurnExecutor, type AgentTurnExecutorConfig, type AgentUsageTotals, type BaseAgentConnectorConfig, BaseConnectorSession, BaseConnectorTurn, BaseLogImporter, type CompactionMetadata, type ConfigFactoryInput, ConformanceConnectorRuntimeRegistry, type ConformanceEnvReader, type ConformanceTestConfig, type ConnectorSendMessageOptions, type ConnectorSessionConfig, type ConnectorStartOptions, type CreateConformanceTestConfigOptions, type CreateTestAgentOptions, type DiscoveryMetadata, type DiscriminatedHandler, type DiscriminatedHandlersConfig, type DiscriminatedHandlersMap, type ErrorEvent, ErrorEventSchema, type ExecutionContext, type ExternalToolIdentifier, type ExternalToolIdentifiers, type ExternalToolMeta, FactoryUsageCorrelationHeaders, type FromGlobalToolApprovalFn, type GeneratedCapabilityProperties, type HarnessRequester, type IAdapterConfigFactory, type ISessionToolLedger, type ImportCursorPosition, ImportCursorPositionSchema, ImportCursorStorageNamespace, ImportCursorStorageSubjects, type ImportMetadata, type ImportSegment, type ImportSegmentLineage, type ImportSegmentTurn, type LedgerSessionContext, type LogImportConfig, type LogImportOrchestrator, type LogImportRegistration, type LogImportSessionContext, type LogImportTestConfig, type LogImporter, type LogImporterConfig, type LogImporterConstructor, type LogOrchestratorConfig, type LogOrchestratorConstructor, MAKAIO_CONFORMANCE_PRIMARY_MODEL_ENV, MAKAIO_CONFORMANCE_PROVIDER_DEFINITIONS_ENV, MAKAIO_CONFORMANCE_PROVIDER_ENV, MAKAIO_CONFORMANCE_SECONDARY_MODEL_ENV, type McpIntegrationStrategy, type McpSessionResources, type McpToolChange, type MergeResult, type MergeScopedToolApprovalOptions, type MessageDeliveryMode, MessageHandle, MessageLifecycleTracker, type MessageResult, type MessageState, type NormalizedCallUsage, type NormalizedEvent, type NormalizedMessageInput, type ParseFileResult, type PauseResult, type PlatformDefaults, ProceduralAgentConnector, type ProceduralConnectorSession, ProceduralConnectorTurn, type ProceduralTurnConfig, type ProceduralTurnState, type ProcessLogFileResult, type ProcessQueueCallbacks, type ProcessingState, type ProviderRequestCorrelation, type QueueableTurn, type ReasoningLevelMap, type ResolveConformanceDefinitionProvidersOptions, type ResolveConformanceTestPresetOptions, type ResolveHints, type ResolvedConformanceTestPreset, SESSION_CLOSED_QUEUE_ERROR, type ScopedBusFor, type ScopedToolApprovalRequest, type ScopedToolApprovalResponse, ScopedToolApprovalSchema, type SendMessageOptions, type SendMessageRequest, type SendMessageResponse, type SerializedContextBlock, SessionLifecycle, SessionToolLedger, type ShouldUseNativeResumeFn, type StartAgentOptions, type StartAgentRequest, type StartAgentResponse, type StorageMessagePayload, type SyncDiscriminatedHandler, type SyncDiscriminatedHandlersConfig, type SyncDiscriminatedHandlersMap, type SyncTypedEmitFn, type TestModelRef, type ToGlobalToolApprovalFn, type ToolApprovalContext, ToolCallTracker, type ToolCompletedEvent, ToolCompletedEventSchema, type ToolLedgerEntry, type ToolStartedEvent, ToolStartedEventSchema, type TurnEvent, type TurnState, type TurnSubjects, TurnTracker, type TurnTrackerOptions, type TurnTrackerSerializedState, TurnTrackerSerializedStateSchema, type TypedEmitFn, UserMessageQueue, type ValidCapability, type WireSessionConfig, type WireSessionSubjects, bindProviderRequestCorrelation, buildFactoryUsageCorrelationHeaders, cleanEnvForAdapter, createAdapterNamespace, createNoAuthTestProviderContext, createTestProviderContext, createToolApprovalHandler, defineDiscriminatedHandlers, defineDiscriminatedHandlersSync, extractMcpCallTarget, formatContextBlockAsText, formatContextBlocksAsText, formatMessageHistoryAsTranscript, isMcpCallTool, isTextLikeMimeType, markCompletedWithFinalResult, mergeScopedToolApproval, normalizeEnvValue, normalizeMessageInput, normalizeMimeType, parseAIAdapterCapabilities, processDiscriminatedItems, processDiscriminatedItemsSync, processQueueMessages, registerAgentBusHandlers, registerMemoryImportCursorStorage, rejectQueuedHandles, resolveConformanceDefinitionProviders, resolveConformanceTestPreset, resolveDisabledNativeTools, resolveRequiredSessionId, resolveTestConfig, safeJsonStringify, serializeBlockToText, serializeTurnContext, toImportSegment };
4167
+ export { AIAdapter, type AIAdapterCapabilities, type AIAdapterCapability, type AIAdapterCapabilityRegistry, type AIAdapterConfig, type AIAdapterConstructorConfig, type AIAdapterContext, type AIAdapterDefinition, type AIAdapterInitOptions, type AIAdapterPromptFailureResult, type AIAdapterPromptOptions, type AIAdapterPromptResult, type AIAdapterPromptSuccessResult, type AIAdapterRuntimeConfig, type AIAdapterRuntimeInitOptions, AIAgent, type AIAgentConfig, AIAgentConnector, type AIModel, type AIReasoningLevel, type ActiveAgentHandle, type AdapterNamespace, type AdapterProviderDefinition, type AgentBusHandlerRegistrarConfig, type AgentCompleteEvent, AgentCompleteEventSchema, type AgentContext, type AgentDisposalReport, AgentEventBridge, type AgentEventBridgeConfig, type AgentIdentity, AgentLifecycleEmitter, type AgentLifecycleEmitterConfig, AgentPayloadEmitter, type AgentPayloadEmitterConfig, type AgentRuntimeCreationResult, AgentRuntimeMutationManager, type AgentRuntimeMutationManagerConfig, type AgentSendMessageOptions, type AgentStartResult, type AgentStartedEvent, AgentStartedEventSchema, AgentTeardownArbiter, type AgentTeardownOptions, AgentTurnExecutor, type AgentTurnExecutorConfig, type AgentUsageTotals, type BaseAgentConnectorConfig, BaseConnectorSession, BaseConnectorTurn, BaseLogImporter, CONNECTOR_EXIT_OBSERVATION_MS, type ClosableConnectorRuntime, type CompactionMetadata, type ConfigFactoryInput, type ConformanceAuthSelection, ConformanceConnectorRuntimeRegistry, type ConformanceEnvReader, type ConformanceTestConfig, type ConnectorReplacementSettlement, type ConnectorSendMessageOptions, type ConnectorSessionConfig, type ConnectorStartOptions, type ConnectorSwapAdmission, type ConnectorSwapHandover, type ConnectorSwapVetoReason, ConnectorSwapVetoedError, type CreateConformanceTestConfigOptions, type CreateTestAgentOptions, type DiscoveryMetadata, type DiscriminatedHandler, type DiscriminatedHandlersConfig, type DiscriminatedHandlersMap, type ErrorEvent, ErrorEventSchema, type ExecutionContext, type ExternalToolIdentifier, type ExternalToolIdentifiers, type ExternalToolMeta, FactoryUsageCorrelationHeaders, type FromGlobalToolApprovalFn, type GeneratedCapabilityProperties, GenerationRetirementLedger, type HarnessRequester, type IAdapterConfigFactory, type ISessionToolLedger, type ImportCursorPosition, ImportCursorPositionSchema, ImportCursorStorageNamespace, ImportCursorStorageSubjects, type ImportMetadata, type ImportSegment, type ImportSegmentLineage, type ImportSegmentTurn, type LedgerSessionContext, type LogImportConfig, type LogImportOrchestrator, type LogImportRegistration, type LogImportSessionContext, type LogImportTestConfig, type LogImporter, type LogImporterConfig, type LogImporterConstructor, type LogOrchestratorConfig, type LogOrchestratorConstructor, MAKAIO_CONFORMANCE_PRIMARY_MODEL_ENV, MAKAIO_CONFORMANCE_PROVIDER_DEFINITIONS_ENV, MAKAIO_CONFORMANCE_PROVIDER_ENV, MAKAIO_CONFORMANCE_SECONDARY_MODEL_ENV, type McpIntegrationStrategy, type McpSessionResources, type McpToolChange, type MergeResult, type MergeScopedToolApprovalOptions, type MessageDeliveryMode, MessageHandle, MessageLifecycleTracker, type MessageResult, type MessageState, type NormalizedCallUsage, type NormalizedEvent, type NormalizedMessageInput, type ObservedExitOptions, type ParseFileResult, type PauseResult, type PlatformDefaults, ProceduralAgentConnector, type ProceduralConnectorSession, ProceduralConnectorTurn, type ProceduralTurnConfig, type ProceduralTurnState, type ProcessLogFileResult, type ProcessQueueCallbacks, type ProcessingState, type ProviderRequestCorrelation, type QueueableTurn, type ReasoningLevelMap, type ResolveConformanceDefinitionProvidersOptions, type ResolveConformanceTestPresetOptions, type ResolveHints, type ResolvedConformanceTestPreset, SESSION_CLOSED_QUEUE_ERROR, SWAP_SETTLEMENT_WAIT_MS, type ScopedBusFor, type ScopedToolApprovalRequest, type ScopedToolApprovalResponse, ScopedToolApprovalSchema, type SendMessageOptions, type SendMessageRequest, type SendMessageResponse, type SerializedContextBlock, SessionLifecycle, SessionToolLedger, type ShouldUseNativeResumeFn, type StartAgentOptions, type StartAgentRequest, type StartAgentResponse, type StorageMessagePayload, type SupersededGeneration, type SyncDiscriminatedHandler, type SyncDiscriminatedHandlersConfig, type SyncDiscriminatedHandlersMap, type SyncTypedEmitFn, type TeardownReport, type TeardownSubject, type TestModelRef, type ToGlobalToolApprovalFn, type ToolApprovalContext, ToolCallTracker, type ToolCompletedEvent, ToolCompletedEventSchema, type ToolLedgerEntry, type ToolStartedEvent, ToolStartedEventSchema, type TurnEvent, type TurnState, type TurnSubjects, TurnTracker, type TurnTrackerOptions, type TurnTrackerSerializedState, TurnTrackerSerializedStateSchema, type TypedEmitFn, UserMessageQueue, type ValidCapability, type WireSessionConfig, type WireSessionSubjects, aggregateTeardownReports, bindProviderRequestCorrelation, buildFactoryUsageCorrelationHeaders, capTeardownEvidence, cleanEnvForAdapter, createAdapterNamespace, createNoAuthTestProviderContext, createTestProviderContext, createToolApprovalHandler, defineDiscriminatedHandlers, defineDiscriminatedHandlersSync, describeTeardownFailure, exitWasObserved, extractMcpCallTarget, formatContextBlockAsText, formatContextBlocksAsText, formatMessageHistoryAsTranscript, isMcpCallTool, isTextLikeMimeType, markCompletedWithFinalResult, mergeScopedToolApproval, normalizeEnvValue, normalizeMessageInput, normalizeMimeType, parseAIAdapterCapabilities, processDiscriminatedItems, processDiscriminatedItemsSync, processQueueMessages, registerAgentBusHandlers, registerMemoryImportCursorStorage, rejectQueuedHandles, reportBestEffortStages, reportObservedExit, reportRepeatTeardown, resolveConformanceDefinitionProviders, resolveConformanceTestPreset, resolveDisabledNativeTools, resolveRequiredSessionId, resolveTestConfig, rethrowTeardownFailure, runBestEffortStage, safeJsonStringify, serializeBlockToText, serializeTurnContext, stageFailure, toImportSegment, unknownTeardown, withTimeout };