@makaio/framework 1.0.0-dev-1781022866275 → 1.0.0-dev-1781023871421

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 (456) hide show
  1. package/dist/.makaio-build.json +5 -0
  2. package/dist/account-identity-DT5NOtFi.mjs +1 -0
  3. package/dist/adapter-C1eI-fGV.mjs +1 -0
  4. package/dist/adapters/acp-client/index.d.mts +6208 -0
  5. package/dist/adapters/acp-client/index.mjs +3 -0
  6. package/dist/adapters/config/index.d.mts +429 -0
  7. package/dist/adapters/config/index.mjs +1 -0
  8. package/dist/adapters/index.d.mts +4202 -0
  9. package/dist/adapters/index.mjs +18 -0
  10. package/dist/adapters/node.d.mts +263 -0
  11. package/dist/adapters/node.mjs +4 -0
  12. package/dist/adapters/stream-session/index.d.mts +1414 -0
  13. package/dist/adapters/stream-session/index.mjs +1 -0
  14. package/dist/adapters/stream-session/testing/index.d.mts +29 -0
  15. package/dist/adapters/stream-session/testing/index.mjs +1 -0
  16. package/dist/artifact-B3npq1cy.mjs +1 -0
  17. package/dist/base-orchestrator-wyumsn3b.d.mts +772 -0
  18. package/dist/bus/index.d.mts +3994 -0
  19. package/dist/bus/index.mjs +1 -0
  20. package/dist/bus-Caz3Jpbc.mjs +1 -0
  21. package/dist/bus-Hb-LGzgb.mjs +2 -0
  22. package/dist/capability-service-CJbmhfv9.mjs +1 -0
  23. package/dist/chunk-DTipWd-i.mjs +1 -0
  24. package/dist/chunk-cpUYaJdV.mjs +1 -0
  25. package/dist/cleanEnvForAdapter-KkYzQa1f.mjs +1 -0
  26. package/dist/client-bx74gm4R.mjs +1 -0
  27. package/dist/clients/index.d.mts +2639 -0
  28. package/dist/clients/index.mjs +2 -0
  29. package/dist/clients-namespace-GmSJpBUV.d.mts +332 -0
  30. package/dist/config-namespace-CPY9YsR8.d.mts +638 -0
  31. package/dist/config-namespace-ncYg2ct_.mjs +1 -0
  32. package/dist/contracts/adapter/index.d.mts +3 -0
  33. package/dist/contracts/adapter/index.mjs +1 -0
  34. package/dist/contracts/adapter/schemas/session-lineage.d.mts +2 -0
  35. package/dist/contracts/adapter/schemas/session-lineage.mjs +1 -0
  36. package/dist/contracts/artifact/index.d.mts +2 -0
  37. package/dist/contracts/artifact/index.mjs +1 -0
  38. package/dist/contracts/client/index.d.mts +3 -0
  39. package/dist/contracts/client/index.mjs +1 -0
  40. package/dist/contracts/common/index.d.mts +2 -0
  41. package/dist/contracts/common/index.mjs +1 -0
  42. package/dist/contracts/config/index.d.mts +455 -0
  43. package/dist/contracts/config/index.mjs +1 -0
  44. package/dist/contracts/extension/index.d.mts +4 -0
  45. package/dist/contracts/extension/index.mjs +1 -0
  46. package/dist/contracts/facet/index.d.mts +2 -0
  47. package/dist/contracts/facet/index.mjs +1 -0
  48. package/dist/contracts/harness/index.d.mts +2 -0
  49. package/dist/contracts/harness/index.mjs +1 -0
  50. package/dist/contracts/host/index.d.mts +2 -0
  51. package/dist/contracts/host/index.mjs +1 -0
  52. package/dist/contracts/index.d.mts +23046 -0
  53. package/dist/contracts/index.mjs +1 -0
  54. package/dist/contracts/materialization/index.d.mts +4 -0
  55. package/dist/contracts/materialization/index.mjs +1 -0
  56. package/dist/contracts/model-registry/index.d.mts +2 -0
  57. package/dist/contracts/model-registry/index.mjs +1 -0
  58. package/dist/contracts/native-session-supervisor/index.d.mts +2 -0
  59. package/dist/contracts/native-session-supervisor/index.mjs +1 -0
  60. package/dist/contracts/platform/index.d.mts +2 -0
  61. package/dist/contracts/platform/index.mjs +1 -0
  62. package/dist/contracts/provider/index.d.mts +3 -0
  63. package/dist/contracts/provider/index.mjs +1 -0
  64. package/dist/contracts/session/index.d.mts +3 -0
  65. package/dist/contracts/session/index.mjs +1 -0
  66. package/dist/contracts/shared/index.d.mts +2 -0
  67. package/dist/contracts/shared/index.mjs +1 -0
  68. package/dist/contracts/skill/index.d.mts +2 -0
  69. package/dist/contracts/skill/index.mjs +1 -0
  70. package/dist/contracts/telemetry/index.d.mts +2 -0
  71. package/dist/contracts/telemetry/index.mjs +1 -0
  72. package/dist/contracts/timeout/index.d.mts +2 -0
  73. package/dist/contracts/timeout/index.mjs +1 -0
  74. package/dist/contracts/toast/index.d.mts +198 -0
  75. package/dist/contracts/toast/index.mjs +1 -0
  76. package/dist/contracts/variant/index.d.mts +2 -0
  77. package/dist/contracts/variant/index.mjs +1 -0
  78. package/dist/core/index.d.mts +1263 -0
  79. package/dist/core/index.mjs +1 -0
  80. package/dist/credential-ref-YWQQENEo.mjs +1 -0
  81. package/dist/cursor-storage-CtVJ3JzB.mjs +1 -0
  82. package/dist/definition-BLCdXGzh.d.mts +383 -0
  83. package/dist/definition-CrgHIpTK.d.mts +60 -0
  84. package/dist/definition-DZMXOnjX.mjs +1 -0
  85. package/dist/definition-pkJ6szUl.d.mts +158 -0
  86. package/dist/drizzle-Eq8W1EbD.mjs +1 -0
  87. package/dist/event-Ca2yUf5i.mjs +1 -0
  88. package/dist/execution-target-CRPTfZlc.mjs +1 -0
  89. package/dist/extension-C-4BHMRI.mjs +1 -0
  90. package/dist/extension-CpIUgBKI.mjs +1 -0
  91. package/dist/extension-namespace-cMh_mMiL.mjs +1 -0
  92. package/dist/facet-BuwhrThl.mjs +1 -0
  93. package/dist/filesystem-service-B8rhBRgB.mjs +1 -0
  94. package/dist/filesystem-service-p_iJVHd4.d.mts +66 -0
  95. package/dist/git/index.d.mts +210 -0
  96. package/dist/git/index.mjs +18 -0
  97. package/dist/globby-rtWVaFHv.mjs +41 -0
  98. package/dist/handlers-CkTsQLra.mjs +41 -0
  99. package/dist/harness-BRCMcvQN.mjs +1 -0
  100. package/dist/hooks/index.d.mts +423 -0
  101. package/dist/hooks/index.mjs +1 -0
  102. package/dist/host-Br9VuOyr.mjs +1 -0
  103. package/dist/identity-Cz2IeEtm.mjs +1 -0
  104. package/dist/index-472sOmsW.d.mts +218 -0
  105. package/dist/index-8SZkg7s6.d.mts +353 -0
  106. package/dist/index-B3PK4FIn.d.mts +5116 -0
  107. package/dist/index-B80L4YqA.d.mts +180 -0
  108. package/dist/index-BFg9BUpx.d.mts +355 -0
  109. package/dist/index-BGfWS6GE.d.mts +483 -0
  110. package/dist/index-BVgfS-AJ.d.mts +109 -0
  111. package/dist/index-B_zQC98V.d.mts +995 -0
  112. package/dist/index-Bh_Ne7LF.d.mts +1008 -0
  113. package/dist/index-Bvb2mMH6.d.mts +1730 -0
  114. package/dist/index-CCGVh9BF2.d.mts +749 -0
  115. package/dist/index-CGmcS0Ma.d.mts +412 -0
  116. package/dist/index-CHQ1SqT0.d.mts +117 -0
  117. package/dist/index-CLpjm52M.d.mts +183 -0
  118. package/dist/index-Caig6TeF.d.mts +6746 -0
  119. package/dist/index-CelJCBjk.d.mts +2992 -0
  120. package/dist/index-ChunCFu4.d.mts +11 -0
  121. package/dist/index-Cm0dUkWL.d.mts +4651 -0
  122. package/dist/index-CokQYGVP.d.mts +184 -0
  123. package/dist/index-Cs0kZXIz2.d.mts +37 -0
  124. package/dist/index-D5d5HeWI2.d.mts +259 -0
  125. package/dist/index-D90OmGmV.d.mts +389 -0
  126. package/dist/index-D9MwJ2Q8.d.mts +67 -0
  127. package/dist/index-DANINzMu.d.mts +40 -0
  128. package/dist/index-DBw-89vC2.d.mts +3640 -0
  129. package/dist/index-DGBu6bHi2.d.mts +438 -0
  130. package/dist/index-DKC62dY5.d.mts +146 -0
  131. package/dist/index-DKia0MX1.d.mts +43 -0
  132. package/dist/index-DMKnON5s.d.mts +28 -0
  133. package/dist/index-DUaw0Dw8.d.mts +14747 -0
  134. package/dist/index-De3kPhlN.d.mts +72 -0
  135. package/dist/index-L4GjJDKb.d.mts +822 -0
  136. package/dist/index-U-A8eyGT.d.mts +1490 -0
  137. package/dist/index-eemAKwsB.d.mts +362 -0
  138. package/dist/index-mNec7V-9.d.mts +1075 -0
  139. package/dist/index-soFznFCy2.d.mts +89 -0
  140. package/dist/index-vtXJuwrz.d.mts +40 -0
  141. package/dist/index-x_lVDp_J.d.mts +134 -0
  142. package/dist/json-value-CmhSGMLv.mjs +1 -0
  143. package/dist/kernel/cli/index.d.mts +143 -0
  144. package/dist/kernel/cli/index.mjs +1 -0
  145. package/dist/kernel/cli/schemas.d.mts +64 -0
  146. package/dist/kernel/cli/schemas.mjs +1 -0
  147. package/dist/kernel/extension/index.d.mts +2 -0
  148. package/dist/kernel/extension/index.mjs +1 -0
  149. package/dist/kernel/index.d.mts +296 -0
  150. package/dist/kernel/index.mjs +1 -0
  151. package/dist/kernel/namespace/index.d.mts +2 -0
  152. package/dist/kernel/namespace/index.mjs +1 -0
  153. package/dist/kernel/observability/index.d.mts +2 -0
  154. package/dist/kernel/observability/index.mjs +1 -0
  155. package/dist/kernel/providers/index.d.mts +2 -0
  156. package/dist/kernel/providers/index.mjs +1 -0
  157. package/dist/kernel/window/index.d.mts +2 -0
  158. package/dist/kernel/window/index.mjs +1 -0
  159. package/dist/materialization-CuUBu4XI.mjs +1 -0
  160. package/dist/model-registry-CfXytvzx.mjs +1 -0
  161. package/dist/model-registry-Scn_MC2d.mjs +1 -0
  162. package/dist/namespace-5QQqbF-B.d.mts +3133 -0
  163. package/dist/namespace-BM7Djng9.d.mts +189 -0
  164. package/dist/namespace-BoD94mrN.mjs +1 -0
  165. package/dist/namespace-BwzZJqTV.mjs +1 -0
  166. package/dist/namespace-CFLAmQfh.mjs +1 -0
  167. package/dist/namespace-CTm3nEvh.d.mts +51 -0
  168. package/dist/namespace-CaaNnKcR.d.mts +921 -0
  169. package/dist/namespace-CaoZ3S78.d.mts +43 -0
  170. package/dist/namespace-CxhsoFUP.d.mts +607 -0
  171. package/dist/namespace-DD8Oiqo7.d.mts +580 -0
  172. package/dist/namespace-DLovh2Ws.d.mts +1313 -0
  173. package/dist/namespace-DgqkaOVu.d.mts +768 -0
  174. package/dist/namespace-DkRgbZYn.mjs +1 -0
  175. package/dist/namespace-Dr8K0MCp.d.mts +2047 -0
  176. package/dist/namespace-DuXK5AYN.mjs +1 -0
  177. package/dist/namespace-EQniz-Aw.d.mts +142 -0
  178. package/dist/namespace-IV1QK__V.d.mts +159 -0
  179. package/dist/namespace-LViZ-EQk.mjs +1 -0
  180. package/dist/namespace-TyiTsLFv.d.mts +3020 -0
  181. package/dist/namespace-Yna5-Pws.mjs +1 -0
  182. package/dist/namespace-xcmbQlxh.mjs +1 -0
  183. package/dist/native-session-supervisor-B1TnaPUF.mjs +1 -0
  184. package/dist/node/bus-server/index.d.mts +178 -0
  185. package/dist/node/bus-server/index.mjs +1 -0
  186. package/dist/node/bus-server/server-lifecycle.d.mts +2 -0
  187. package/dist/node/bus-server/server-lifecycle.mjs +1 -0
  188. package/dist/node/machine-identity/index.d.mts +85 -0
  189. package/dist/node/machine-identity/index.mjs +3 -0
  190. package/dist/node/transports/index.d.mts +1945 -0
  191. package/dist/node/transports/index.mjs +2 -0
  192. package/dist/orchestrator-shared-CIDiFJMD.mjs +1 -0
  193. package/dist/orchestrator-shared-Dfa7FMyw.d.mts +249 -0
  194. package/dist/package-DKVlsMP3.mjs +1 -0
  195. package/dist/platform-DZ7z-wXD.mjs +1 -0
  196. package/dist/profile-6ynCD5k3.mjs +1 -0
  197. package/dist/provider-context-CK6B4X_8.mjs +1 -0
  198. package/dist/providers/index.d.mts +135 -0
  199. package/dist/providers/index.mjs +1 -0
  200. package/dist/providers-namespace-DSEpli4A.d.mts +583 -0
  201. package/dist/providers-u8i15co9.mjs +1 -0
  202. package/dist/schema-CoyE6mPt.mjs +1 -0
  203. package/dist/schema-M5YTvSAG.d.mts +949 -0
  204. package/dist/schema-e0wU_lcV.mjs +1 -0
  205. package/dist/schema-introspection-Dn1jWQs1.mjs +1 -0
  206. package/dist/schemas-Bd0OjRQf.d.mts +46 -0
  207. package/dist/schemas-C46QfKzv.d.mts +459 -0
  208. package/dist/schemas-CDBSjg7o.d.mts +237 -0
  209. package/dist/schemas-CR1Rripy.mjs +1 -0
  210. package/dist/schemas-CVvwIfG4.mjs +1 -0
  211. package/dist/schemas-CaLhkkLn.mjs +1 -0
  212. package/dist/schemas-ClOOT1W6.d.mts +174 -0
  213. package/dist/schemas-DATniTHb.d.mts +182 -0
  214. package/dist/schemas-DE-GNmSD.mjs +1 -0
  215. package/dist/schemas-DVF1A4DF.d.mts +160 -0
  216. package/dist/schemas-DaRSfYLf.d.mts +73 -0
  217. package/dist/schemas-DiYVzG6e.d.mts +315 -0
  218. package/dist/schemas-hSrzflwZ.mjs +1 -0
  219. package/dist/schemas-j7ivZ2HI.d.mts +944 -0
  220. package/dist/schemas-jFe1AuI-.mjs +1 -0
  221. package/dist/schemas-wg_6PAdV.d.mts +153 -0
  222. package/dist/scoped-bus-04pwo1uM.mjs +1 -0
  223. package/dist/server-lifecycle-FXTPW39-.mjs +1 -0
  224. package/dist/server-lifecycle-YoSGFGnU.d.mts +160 -0
  225. package/dist/service-base/index.d.mts +98 -0
  226. package/dist/service-base/index.mjs +1 -0
  227. package/dist/services/adapter-runtime/index.d.mts +4 -0
  228. package/dist/services/adapter-runtime/index.mjs +1 -0
  229. package/dist/services/adapter-runtime/namespace.d.mts +2 -0
  230. package/dist/services/adapter-runtime/namespace.mjs +1 -0
  231. package/dist/services/adapter-runtime/schemas.d.mts +2 -0
  232. package/dist/services/adapter-runtime/schemas.mjs +1 -0
  233. package/dist/services/adapter-subsystem/index.d.mts +3 -0
  234. package/dist/services/adapter-subsystem/index.mjs +1 -0
  235. package/dist/services/adapter-subsystem/namespace.d.mts +2 -0
  236. package/dist/services/adapter-subsystem/namespace.mjs +1 -0
  237. package/dist/services/agent-runtime/index.d.mts +3 -0
  238. package/dist/services/agent-runtime/index.mjs +1 -0
  239. package/dist/services/agent-runtime/namespace.d.mts +2 -0
  240. package/dist/services/agent-runtime/namespace.mjs +1 -0
  241. package/dist/services/agent-runtime/schemas.d.mts +2 -0
  242. package/dist/services/agent-runtime/schemas.mjs +1 -0
  243. package/dist/services/capability/index.d.mts +2 -0
  244. package/dist/services/capability/index.mjs +1 -0
  245. package/dist/services/cli-detection/namespace.d.mts +56 -0
  246. package/dist/services/cli-detection/namespace.mjs +1 -0
  247. package/dist/services/codebase/index.d.mts +3 -0
  248. package/dist/services/codebase/index.mjs +1 -0
  249. package/dist/services/codebase/namespace.d.mts +2 -0
  250. package/dist/services/codebase/namespace.mjs +1 -0
  251. package/dist/services/codebase/schemas.d.mts +2 -0
  252. package/dist/services/codebase/schemas.mjs +1 -0
  253. package/dist/services/compression/index.d.mts +3 -0
  254. package/dist/services/compression/index.mjs +1 -0
  255. package/dist/services/compression/namespace.d.mts +2 -0
  256. package/dist/services/compression/namespace.mjs +1 -0
  257. package/dist/services/compression/schemas.d.mts +2 -0
  258. package/dist/services/compression/schemas.mjs +1 -0
  259. package/dist/services/context-rules/index.d.mts +412 -0
  260. package/dist/services/context-rules/index.mjs +1 -0
  261. package/dist/services/credential-change/index.d.mts +17 -0
  262. package/dist/services/credential-change/index.mjs +1 -0
  263. package/dist/services/definition/index.d.mts +2 -0
  264. package/dist/services/definition/index.mjs +1 -0
  265. package/dist/services/definition/namespace.d.mts +71 -0
  266. package/dist/services/definition/namespace.mjs +1 -0
  267. package/dist/services/definition/schemas.d.mts +38 -0
  268. package/dist/services/definition/schemas.mjs +1 -0
  269. package/dist/services/dialog/namespace.d.mts +105 -0
  270. package/dist/services/dialog/namespace.mjs +1 -0
  271. package/dist/services/dialog/schemas.d.mts +109 -0
  272. package/dist/services/dialog/schemas.mjs +1 -0
  273. package/dist/services/execution-target/index.d.mts +4 -0
  274. package/dist/services/execution-target/index.mjs +1 -0
  275. package/dist/services/execution-target/namespace.d.mts +2 -0
  276. package/dist/services/execution-target/namespace.mjs +1 -0
  277. package/dist/services/execution-target/schemas.d.mts +2 -0
  278. package/dist/services/execution-target/schemas.mjs +1 -0
  279. package/dist/services/filesystem/index.d.mts +3 -0
  280. package/dist/services/filesystem/index.mjs +1 -0
  281. package/dist/services/filesystem/namespace.d.mts +432 -0
  282. package/dist/services/filesystem/namespace.mjs +1 -0
  283. package/dist/services/filesystem/schemas.d.mts +240 -0
  284. package/dist/services/filesystem/schemas.mjs +1 -0
  285. package/dist/services/git/namespace.d.mts +1163 -0
  286. package/dist/services/git/namespace.mjs +1 -0
  287. package/dist/services/git/schemas.d.mts +932 -0
  288. package/dist/services/git/schemas.mjs +1 -0
  289. package/dist/services/harness/index.d.mts +861 -0
  290. package/dist/services/harness/index.mjs +1 -0
  291. package/dist/services/harness/storage/schema.d.mts +424 -0
  292. package/dist/services/harness/storage/schema.mjs +1 -0
  293. package/dist/services/index.d.mts +6185 -0
  294. package/dist/services/index.mjs +1 -0
  295. package/dist/services/local-notification/index.d.mts +25 -0
  296. package/dist/services/local-notification/index.mjs +1 -0
  297. package/dist/services/local-notification/namespace.d.mts +73 -0
  298. package/dist/services/local-notification/namespace.mjs +1 -0
  299. package/dist/services/local-notification/schemas.d.mts +88 -0
  300. package/dist/services/local-notification/schemas.mjs +1 -0
  301. package/dist/services/log-import/browser.d.mts +3 -0
  302. package/dist/services/log-import/browser.mjs +1 -0
  303. package/dist/services/log-import/index.d.mts +274 -0
  304. package/dist/services/log-import/index.mjs +2 -0
  305. package/dist/services/log-import/log-import.d.mts +3 -0
  306. package/dist/services/log-import/log-import.mjs +1 -0
  307. package/dist/services/log-import/namespace.d.mts +327 -0
  308. package/dist/services/log-import/namespace.mjs +1 -0
  309. package/dist/services/log-import/schemas.d.mts +217 -0
  310. package/dist/services/log-import/schemas.mjs +1 -0
  311. package/dist/services/model-registry/index.d.mts +2 -0
  312. package/dist/services/model-registry/index.mjs +1 -0
  313. package/dist/services/preferences/index.d.mts +3 -0
  314. package/dist/services/preferences/index.mjs +1 -0
  315. package/dist/services/preferences/schemas.d.mts +2 -0
  316. package/dist/services/preferences/schemas.mjs +1 -0
  317. package/dist/services/preferences/storage-namespace.d.mts +3 -0
  318. package/dist/services/preferences/storage-namespace.mjs +1 -0
  319. package/dist/services/provider-context/index.d.mts +2 -0
  320. package/dist/services/provider-context/index.mjs +1 -0
  321. package/dist/services/provider-runtime/index.d.mts +136 -0
  322. package/dist/services/provider-runtime/index.mjs +1 -0
  323. package/dist/services/session/handlers/index.d.mts +2 -0
  324. package/dist/services/session/handlers/index.mjs +1 -0
  325. package/dist/services/session/index.d.mts +10 -0
  326. package/dist/services/session/index.mjs +1 -0
  327. package/dist/services/session/messages/namespace.d.mts +2 -0
  328. package/dist/services/session/messages/namespace.mjs +1 -0
  329. package/dist/services/session/orchestrator-testing/index.d.mts +2 -0
  330. package/dist/services/session/orchestrator-testing/index.mjs +1 -0
  331. package/dist/services/session/session-events/namespace.d.mts +2 -0
  332. package/dist/services/session/session-events/namespace.mjs +1 -0
  333. package/dist/services/session/storage/namespace.d.mts +2 -0
  334. package/dist/services/session/storage/namespace.mjs +1 -0
  335. package/dist/services/session/storage/schema.d.mts +2 -0
  336. package/dist/services/session/storage/schema.mjs +1 -0
  337. package/dist/services/session/testing/index.d.mts +35 -0
  338. package/dist/services/session/testing/index.mjs +65 -0
  339. package/dist/services/session/testing/orchestrator-shared.d.mts +2 -0
  340. package/dist/services/session/testing/orchestrator-shared.mjs +1 -0
  341. package/dist/services/session/turns/namespace.d.mts +2 -0
  342. package/dist/services/session/turns/namespace.mjs +1 -0
  343. package/dist/services/session-editor/index.d.mts +119 -0
  344. package/dist/services/session-editor/index.mjs +1 -0
  345. package/dist/services/settings/index.d.mts +47 -0
  346. package/dist/services/settings/index.mjs +1 -0
  347. package/dist/services/settings/namespace.d.mts +663 -0
  348. package/dist/services/settings/namespace.mjs +1 -0
  349. package/dist/services/settings/storage/clients-namespace.d.mts +2 -0
  350. package/dist/services/settings/storage/clients-namespace.mjs +1 -0
  351. package/dist/services/settings/storage/extension-configs/namespace.d.mts +184 -0
  352. package/dist/services/settings/storage/extension-configs/namespace.mjs +1 -0
  353. package/dist/services/settings/storage/index.d.mts +4 -0
  354. package/dist/services/settings/storage/index.mjs +1 -0
  355. package/dist/services/settings/storage/providers-namespace.d.mts +2 -0
  356. package/dist/services/settings/storage/providers-namespace.mjs +1 -0
  357. package/dist/services/subagent/index.d.mts +2 -0
  358. package/dist/services/subagent/index.mjs +1 -0
  359. package/dist/services/subagent-template/index.d.mts +3 -0
  360. package/dist/services/subagent-template/index.mjs +1 -0
  361. package/dist/services/subagent-template/namespace.d.mts +2 -0
  362. package/dist/services/subagent-template/namespace.mjs +1 -0
  363. package/dist/services/subagent-template/schemas.d.mts +2 -0
  364. package/dist/services/subagent-template/schemas.mjs +1 -0
  365. package/dist/services/tool-approval/index.d.mts +2 -0
  366. package/dist/services/tool-approval/index.mjs +1 -0
  367. package/dist/services/tools/index.d.mts +2 -0
  368. package/dist/services/tools/index.mjs +1 -0
  369. package/dist/services/tray-menu/index.d.mts +4 -0
  370. package/dist/services/tray-menu/index.mjs +1 -0
  371. package/dist/services/tray-menu/namespace.d.mts +2 -0
  372. package/dist/services/tray-menu/namespace.mjs +1 -0
  373. package/dist/services/tray-menu/schemas.d.mts +2 -0
  374. package/dist/services/tray-menu/schemas.mjs +1 -0
  375. package/dist/services/turn/index.d.mts +2 -0
  376. package/dist/services/turn/index.mjs +1 -0
  377. package/dist/services/turn/namespace.d.mts +2 -0
  378. package/dist/services/turn/namespace.mjs +1 -0
  379. package/dist/services/turn/schemas.d.mts +335 -0
  380. package/dist/services/turn/schemas.mjs +1 -0
  381. package/dist/session-BoldSdNZ2.mjs +134 -0
  382. package/dist/session-DuVOYctZ.mjs +1 -0
  383. package/dist/session-lineage-CRsc9g1x.d.mts +65 -0
  384. package/dist/shared-DpOEfD8F.mjs +1 -0
  385. package/dist/shared-schemas-CPShiLNp.mjs +1 -0
  386. package/dist/skill-CQO4mDqK.mjs +1 -0
  387. package/dist/storage/drizzle/client.d.mts +78 -0
  388. package/dist/storage/drizzle/client.mjs +1 -0
  389. package/dist/storage/drizzle/index.d.mts +137 -0
  390. package/dist/storage/drizzle/index.mjs +1 -0
  391. package/dist/storage/handlers/drizzle/index.d.mts +2 -0
  392. package/dist/storage/handlers/drizzle/index.mjs +1 -0
  393. package/dist/storage/handlers/index.d.mts +33 -0
  394. package/dist/storage/handlers/index.mjs +1 -0
  395. package/dist/storage/index.d.mts +192 -0
  396. package/dist/storage/index.mjs +1 -0
  397. package/dist/storage-namespace-BXkoh5Sy.d.mts +221 -0
  398. package/dist/storage-namespace-DWsYLAXa.mjs +1 -0
  399. package/dist/storage-namespace-definition-Bkx5rSto.d.mts +17 -0
  400. package/dist/storage-namespace-definition-CqSdsuCC.mjs +1 -0
  401. package/dist/style.css +3782 -0
  402. package/dist/telemetry-CvdLBWuk.mjs +1 -0
  403. package/dist/testing/drizzle-harness.d.mts +130 -0
  404. package/dist/testing/drizzle-harness.mjs +1 -0
  405. package/dist/testing/index.d.mts +106 -0
  406. package/dist/testing/index.mjs +1 -0
  407. package/dist/timeout-XsYIOKrc.mjs +1 -0
  408. package/dist/tool-approval-service-BvZWhYZp.mjs +1 -0
  409. package/dist/tools/index.d.mts +835 -0
  410. package/dist/tools/index.mjs +1 -0
  411. package/dist/tools/testing/index.d.mts +53 -0
  412. package/dist/tools/testing/index.mjs +1 -0
  413. package/dist/tools-D-luYcDw.mjs +1431 -0
  414. package/dist/tray-menu-service-DuXq5k22.mjs +1 -0
  415. package/dist/types-BCMUtBj1.d.mts +1106 -0
  416. package/dist/types-C2Ob9zz_.d.mts +128 -0
  417. package/dist/types-CCdqjeuH.d.mts +262 -0
  418. package/dist/types-DZHvOc_Q.d.mts +305 -0
  419. package/dist/types-Dy3YTcTF.d.mts +6777 -0
  420. package/dist/types-MfJZ67e9.d.mts +315 -0
  421. package/dist/types-dyP-bXXE.d.mts +31 -0
  422. package/dist/ui-components/index.d.mts +2342 -0
  423. package/dist/ui-components/index.mjs +8 -0
  424. package/dist/ui-config-9bDRwFZr.mjs +1 -0
  425. package/dist/ui-hooks/index.d.mts +1915 -0
  426. package/dist/ui-hooks/index.mjs +1 -0
  427. package/dist/ui-kernel/index.d.mts +2793 -0
  428. package/dist/ui-kernel/index.mjs +1 -0
  429. package/dist/ui-kernel/pages/namespace.d.mts +88 -0
  430. package/dist/ui-kernel/pages/namespace.mjs +1 -0
  431. package/dist/ui-kernel/pages/schemas.d.mts +2 -0
  432. package/dist/ui-kernel/pages/schemas.mjs +1 -0
  433. package/dist/ui-views/index.d.mts +487 -0
  434. package/dist/ui-views/index.mjs +30 -0
  435. package/dist/utils/health-probe.d.mts +26 -0
  436. package/dist/utils/health-probe.mjs +1 -0
  437. package/dist/utils/index.d.mts +262 -0
  438. package/dist/utils/index.mjs +2 -0
  439. package/dist/utils/keychain.d.mts +31 -0
  440. package/dist/utils/keychain.mjs +1 -0
  441. package/dist/utils/project-manifest.d.mts +130 -0
  442. package/dist/utils/project-manifest.mjs +1 -0
  443. package/dist/utils/resolve-package-root.d.mts +12 -0
  444. package/dist/utils/resolve-package-root.mjs +1 -0
  445. package/dist/utils/scope-paths.d.mts +33 -0
  446. package/dist/utils/scope-paths.mjs +1 -0
  447. package/dist/utils/workspace-packages.d.mts +59 -0
  448. package/dist/utils/workspace-packages.mjs +1 -0
  449. package/dist/utils/workspace-root.d.mts +24 -0
  450. package/dist/utils/workspace-root.mjs +2 -0
  451. package/dist/variant-CT6XBP6T.mjs +1 -0
  452. package/dist/version-BeT3ASEe.mjs +1 -0
  453. package/dist/visibility-Cb62p9bv.mjs +1 -0
  454. package/dist/window-registry-CBcrGTv4.d.mts +130 -0
  455. package/dist/window-registry-DW-dKRjQ.mjs +1 -0
  456. package/package.json +1 -1
@@ -0,0 +1,2639 @@
1
+ import * as _$zod from "zod";
2
+ import { z } from "zod";
3
+ import * as _$_makaio_core0 from "@makaio/framework/core";
4
+ import { EventMessagePayload, RequestMessagePayload, SchemaRecord, SubjectDefinition, SubjectRecord } from "@makaio/framework/core";
5
+ import { IMakaioBus } from "@makaio/framework/bus";
6
+ import * as _$_makaio_contracts0 from "@makaio/framework/contracts";
7
+ import { ClientDefinition, ExtensionServiceLifecycle, MakaioNodeExtension } from "@makaio/framework/contracts";
8
+ import { BaseService } from "@makaio/framework/service-base";
9
+ import { ClientAccountIdentifier, ClientDefinition as ClientDefinition$1, ClientExecutionContext, ClientInstallCompleted, ClientInstallProgress, ClientRuntimeObserveRequest, ClientSessionObservedBase, ClientSubjects, ClientUsageSnapshot, ClientWiringEntry, ClientWiringEntrySchema, ManagedInstallDescriptor, ManagedInstallStrategy, PostInstallDescriptor } from "@makaio/framework/contracts/client";
10
+ import * as _$zod_v4_core0 from "zod/v4/core";
11
+
12
+ //#region subsystems/client/src/atomic-modify-file.d.ts
13
+ /**
14
+ * Atomic file read-modify-write utility with per-path mutex serialization.
15
+ *
16
+ * Provides a generic helper for safely updating JSON config files: reads the
17
+ * current JSON, validates it through a caller-supplied parser, applies a
18
+ * modifier, and writes the result atomically (write-to-UUID-tmp then rename).
19
+ * Concurrent calls to the same path are serialized via the caller-owned mutex
20
+ * map.
21
+ * @packageDocumentation
22
+ */
23
+ /**
24
+ * Descriptor returned by an {@link AtomicModifier}.
25
+ * @typeParam TContent - The JSON-serializable type of the file's content.
26
+ * @typeParam TResult - An arbitrary caller-defined result value.
27
+ */
28
+ interface AtomicModifyOutcome<TContent, TResult> {
29
+ /**
30
+ * The (potentially updated) content to persist. Ignored when
31
+ * `changed` is `false`.
32
+ */
33
+ readonly content: TContent;
34
+ /**
35
+ * Whether the file should be written. When `false`, no I/O is performed
36
+ * and the resolved promise carries `result` without touching the disk.
37
+ */
38
+ readonly changed: boolean;
39
+ /** Caller-defined value forwarded as the resolved value of {@link atomicModifyFile}. */
40
+ readonly result: TResult;
41
+ }
42
+ /**
43
+ * Modifier function supplied by the caller.
44
+ *
45
+ * Receives the current file content (or the default value when the file is
46
+ * absent) and returns an {@link AtomicModifyOutcome} describing the desired
47
+ * new content and whether a write is needed.
48
+ *
49
+ * The modifier **must be synchronous or return a resolved-in-the-same-tick
50
+ * promise** — it runs inside the mutex chain so async work inside the modifier
51
+ * is safe, but long-running modifiers will delay subsequent serialized writes.
52
+ * @typeParam TContent - The JSON-serializable type of the file's content.
53
+ * @typeParam TResult - An arbitrary caller-defined result value.
54
+ */
55
+ type AtomicModifier<TContent, TResult> = (current: TContent) => AtomicModifyOutcome<TContent, TResult> | Promise<AtomicModifyOutcome<TContent, TResult>>;
56
+ /**
57
+ * Parser function supplied by the caller.
58
+ *
59
+ * The helper reads disk JSON as `unknown`; client-specific settings modules
60
+ * own the schema that turns unknown JSON into a trusted content type.
61
+ * @typeParam TContent - The validated content type consumed by the modifier.
62
+ */
63
+ type AtomicContentParser<TContent> = (raw: unknown) => TContent;
64
+ /**
65
+ * Read the current file content, validate it with `parseContent`, apply
66
+ * `modifier`, and atomically persist the result when `changed` is `true`.
67
+ *
68
+ * **Atomicity:** the updated content is written to a UUID-suffixed sibling file
69
+ * in the same directory, then renamed into place. Readers never observe a
70
+ * partial write. The temp file is unlinked on write failure.
71
+ *
72
+ * **Serialization:** the caller owns the `mutex` map and passes the same
73
+ * instance for all calls sharing the same logical file namespace. The helper
74
+ * chains on the existing in-flight promise for `filePath` so concurrent calls
75
+ * are queued rather than racing. The entry is pruned from the map once no
76
+ * further work is queued.
77
+ *
78
+ * **Parent directory:** created automatically when absent (`mkdir -p`).
79
+ * @typeParam TContent - The JSON-serializable type of the file's content.
80
+ * @typeParam TResult - An arbitrary caller-defined result value.
81
+ * @param filePath - Absolute path to the target file.
82
+ * @param defaultContent - Raw value parsed when the file does not exist.
83
+ * @param mutex - Module-scoped per-path mutex map owned by the caller.
84
+ * @param parseContent - Parser that validates unknown disk JSON before mutation.
85
+ * @param modifier - Pure function that transforms the current content.
86
+ * @returns The `result` value produced by `modifier`.
87
+ */
88
+ declare function atomicModifyFile<TContent, TResult>(filePath: string, defaultContent: unknown, mutex: Map<string, Promise<void>>, parseContent: AtomicContentParser<TContent>, modifier: AtomicModifier<TContent, TResult>): Promise<TResult>;
89
+ //#endregion
90
+ //#region subsystems/client/src/client-binary-errors.d.ts
91
+ /**
92
+ * Typed error classes for the client binary management subsystem.
93
+ * @packageDocumentation
94
+ */
95
+ /**
96
+ * Thrown by `client.resolveBinary` when no managed version is active and the
97
+ * global PATH scan finds no matching binary for the client.
98
+ *
99
+ * Callers that need to distinguish "binary absent" from other resolution
100
+ * failures (e.g. corrupted managed state, storage errors) should check for
101
+ * this class rather than matching the error message string.
102
+ */
103
+ declare class BinaryNotFoundError extends Error {
104
+ /** Discriminant code for structured error detection without string matching. */
105
+ readonly code: "BINARY_NOT_FOUND";
106
+ /**
107
+ * @param clientId - Stable client identifier for which no binary was found
108
+ */
109
+ constructor(clientId: string);
110
+ }
111
+ //#endregion
112
+ //#region subsystems/client/src/client-account-registry.d.ts
113
+ /**
114
+ * Result returned when account identifiers are observed or ingested.
115
+ */
116
+ interface ClientAccountUpsertResult {
117
+ /** Stable in-memory account ID selected or created for the identifier set. */
118
+ readonly clientAccountId: string;
119
+ /** Latest non-empty display label retained for the account, if any. */
120
+ readonly displayLabel?: string;
121
+ /** Any prior account IDs folded into the canonical account during upsert. */
122
+ readonly mergedAccountIds: ReadonlyArray<string>;
123
+ }
124
+ /**
125
+ * In-memory registry that canonicalizes client accounts across identifiers.
126
+ *
127
+ * Identifiers are scoped by `clientId`, `scheme`, and `value`, so the same raw
128
+ * identifier value used by different clients does not collide.
129
+ */
130
+ declare class ClientAccountRegistry {
131
+ private nextAccountSequence;
132
+ private readonly accountIdsByIdentifier;
133
+ private readonly accounts;
134
+ /**
135
+ * Upsert an account record for the provided identifiers.
136
+ *
137
+ * Reuses an existing account ID when any identifier is already known, and
138
+ * folds all supplied identifiers onto the canonical account mapping.
139
+ * @param options - Client/account identity inputs to observe
140
+ * @returns Canonical account ID plus any merged prior IDs
141
+ */
142
+ upsertAccount(options: {
143
+ clientId: string;
144
+ identifiers: ReadonlyArray<ClientAccountIdentifier>;
145
+ displayLabel?: string;
146
+ }): ClientAccountUpsertResult;
147
+ /**
148
+ * Remove all in-memory state.
149
+ */
150
+ clear(): void;
151
+ private createAccount;
152
+ private mergeInto;
153
+ }
154
+ //#endregion
155
+ //#region subsystems/client/src/binary-strategies/types.d.ts
156
+ /**
157
+ * Injected I/O dependencies for install strategy implementations.
158
+ *
159
+ * Abstracting these operations behind an interface makes every strategy
160
+ * testable without touching the network or file system.
161
+ */
162
+ interface StrategyDependencies {
163
+ /**
164
+ * Fetch `url` and return the full response body as a string.
165
+ * @param url - The URL to fetch.
166
+ * @returns The raw response body text.
167
+ */
168
+ fetchText(url: string): Promise<string>;
169
+ /**
170
+ * Fetch `url`, parse the response body as JSON, and return it.
171
+ * @param url - The URL to fetch.
172
+ * @returns The parsed JSON value.
173
+ */
174
+ fetchJson(url: string): Promise<unknown>;
175
+ /**
176
+ * Download `url` to `destPath` on disk, optionally reporting byte progress.
177
+ * @param url - The URL to download.
178
+ * @param destPath - Absolute destination file path.
179
+ * @param onProgress - Optional callback; `total` is `null` when the server
180
+ * does not advertise a `Content-Length`.
181
+ * @returns The resolved absolute destination path.
182
+ */
183
+ downloadFile(url: string, destPath: string, onProgress?: (downloaded: number, total: number | null) => void): Promise<string>;
184
+ /**
185
+ * Execute a shell command and return its stdout.
186
+ * @param command - The executable to run (no shell expansion).
187
+ * @param args - Positional arguments passed to the executable.
188
+ * @param options - Optional execution options. `cwd` sets the working
189
+ * directory; `env` is merged on top of the parent environment when present
190
+ * (when absent the parent environment is inherited unchanged).
191
+ * @returns Trimmed stdout string.
192
+ */
193
+ exec(command: string, args: string[], options?: {
194
+ cwd?: string;
195
+ env?: Record<string, string>;
196
+ }): Promise<string>;
197
+ /**
198
+ * Extract an archive file into `destDir`.
199
+ * @param archivePath - Absolute path to the archive file.
200
+ * @param destDir - Absolute directory to extract into.
201
+ * @param format - Archive type (`'tar.gz'` or `'zip'`).
202
+ */
203
+ extractArchive(archivePath: string, destDir: string, format: 'tar.gz' | 'zip'): Promise<void>;
204
+ /**
205
+ * Delete a single file from disk.
206
+ *
207
+ * Implementations must be idempotent — if `filePath` does not exist the call
208
+ * should resolve without error.
209
+ * @param filePath - Absolute path to the file to remove.
210
+ */
211
+ deleteFile(filePath: string): Promise<void>;
212
+ /**
213
+ * Compute the checksum of a file at `filePath`.
214
+ * @param filePath - Absolute path to the file to hash.
215
+ * @param algorithm - Hash algorithm name (defaults to `'sha256'`).
216
+ * @returns Lowercase hex-encoded digest string.
217
+ */
218
+ computeChecksum(filePath: string, algorithm?: string): Promise<string>;
219
+ /**
220
+ * Recursively remove a directory and all of its contents.
221
+ *
222
+ * Implementations must be idempotent — if `dirPath` does not exist the
223
+ * call should resolve without error. This mirrors the `force` flag of
224
+ * `fs.rm` from `node:fs/promises`.
225
+ * @param dirPath - Absolute path to the directory to remove.
226
+ */
227
+ removeDirectory(dirPath: string): Promise<void>;
228
+ }
229
+ //#endregion
230
+ //#region subsystems/client/src/client-binary-manager-types.d.ts
231
+ /**
232
+ * Configuration for the managed binary base directory.
233
+ *
234
+ * The manager derives per-client, per-version install directories from
235
+ * `basePath` using the pattern `{basePath}/{clientId}/{version}/`.
236
+ */
237
+ interface ClientBinaryJobRunnerConfig {
238
+ /**
239
+ * Absolute base directory under which all managed binary versions are
240
+ * installed (e.g. `~/.makaio/binaries/`).
241
+ */
242
+ basePath: string;
243
+ /**
244
+ * Framework-owned handlers for declarative post-install descriptors.
245
+ *
246
+ * Client packages declare `postInstall.kind`; the host supplies the handler
247
+ * implementation here. Missing handlers fail the install job rather than
248
+ * silently skipping a declared lifecycle step.
249
+ */
250
+ postInstallHandlers?: ReadonlyMap<string, PostInstallHandler>;
251
+ }
252
+ /**
253
+ * Configuration for the managed binary manager.
254
+ */
255
+ interface ClientBinaryManagerConfig extends ClientBinaryJobRunnerConfig {
256
+ /**
257
+ * Base directory for per-client config isolation directories.
258
+ *
259
+ * Managed binaries get `{configBasePath}/{clientId}/config/` as their
260
+ * isolated config dir (e.g. `~/.makaio/clients/claude-code/config/`).
261
+ *
262
+ * Used by `client.resolveBinary` to construct the managed config path when
263
+ * the definition declares `configIsolation`.
264
+ */
265
+ configBasePath: string;
266
+ }
267
+ /**
268
+ * Context passed to a framework-owned post-install handler.
269
+ */
270
+ interface PostInstallContext {
271
+ /** Stable client identifier being installed. */
272
+ clientId: string;
273
+ /** Concrete version that was installed. */
274
+ version: string;
275
+ /** Absolute directory where the strategy installed the binary. */
276
+ installPath: string;
277
+ /** Declarative descriptor from the client definition. */
278
+ descriptor: PostInstallDescriptor;
279
+ }
280
+ /**
281
+ * Framework-owned handler for a declarative post-install action.
282
+ *
283
+ * Returning metadata is optional; when present it is forwarded on install
284
+ * progress and completion events.
285
+ */
286
+ type PostInstallHandler = (context: PostInstallContext) => Promise<Record<string, unknown> | void> | Record<string, unknown> | void;
287
+ /**
288
+ * An in-flight or completed install/update job.
289
+ *
290
+ * Jobs are created synchronously by `client.install` and `client.update`
291
+ * handlers and executed asynchronously by the {@link ClientBinaryJobRunner}.
292
+ */
293
+ interface InstallJob {
294
+ /** Opaque stable identifier for this job (UUID v4). */
295
+ jobId: string;
296
+ /** Stable client identifier this job is installing. */
297
+ clientId: string;
298
+ /**
299
+ * Concrete version to install. Set immediately after version resolution;
300
+ * remains the resolved version string throughout execution.
301
+ */
302
+ version: string;
303
+ /**
304
+ * Install strategy discriminant corresponding to the managed install
305
+ * descriptor that was used to create the job.
306
+ */
307
+ strategy: ManagedInstallStrategy;
308
+ /** Current lifecycle state of the job. */
309
+ status: 'pending' | 'running' | 'completed' | 'failed';
310
+ /**
311
+ * When `true`, the job runner sets this version as active on successful
312
+ * completion.
313
+ */
314
+ makeActive: boolean;
315
+ /**
316
+ * The originating bus subject that created this job.
317
+ *
318
+ * Used to set the correct `reason` on `client.version.changed` events:
319
+ * `'install'` for `client.install` requests, `'update'` for `client.update`
320
+ * requests.
321
+ */
322
+ reason: 'install' | 'update';
323
+ }
324
+ /**
325
+ * Read-only interface used by the manager to retrieve client definitions.
326
+ *
327
+ * On the production boot path the manager receives a
328
+ * {@link ClientDefinitionRegistry} fully seeded before `init()` is called.
329
+ * The manager depends only on the read side of the registry contract;
330
+ * mutation is available on the concrete {@link ClientDefinitionRegistry} class
331
+ * for tests and administrative tooling.
332
+ */
333
+ interface ClientDefinitionLookup {
334
+ /**
335
+ * Return the static definition for the given client identifier, or
336
+ * `undefined` when no definition is registered.
337
+ * @param clientId - Stable client identifier (e.g. `'claude-code'`)
338
+ * @returns The registered {@link ClientDefinition}, or `undefined`
339
+ */
340
+ getDefinition(clientId: string): ClientDefinition$1 | undefined;
341
+ /**
342
+ * Return all registered definitions known to this lookup.
343
+ *
344
+ * `client.list` uses this to include managed clients that have no installed
345
+ * versions or state rows yet.
346
+ * @returns Registered client definitions
347
+ */
348
+ listDefinitions(): readonly ClientDefinition$1[];
349
+ }
350
+ /**
351
+ * Result passed to the completion callback after a successful install.
352
+ *
353
+ * Bundles the job identity and artifact information into a single object
354
+ * so the callback signature stays stable as new fields are added.
355
+ */
356
+ interface JobCompletionResult {
357
+ /** Job identifier that completed. */
358
+ jobId: string;
359
+ /** Stable client identifier. */
360
+ clientId: string;
361
+ /** Installed version string. */
362
+ version: string;
363
+ /** Absolute path to the installed binary directory. */
364
+ installPath: string;
365
+ /** Whether to activate this version. */
366
+ makeActive: boolean;
367
+ /** Originating operation reason forwarded to `client.version.changed`. */
368
+ reason: 'install' | 'update';
369
+ }
370
+ /**
371
+ * Callback invoked by the job runner when a job completes successfully and
372
+ * the binary has been written to disk but before activation.
373
+ *
374
+ * The manager uses this to persist the installed version to storage and
375
+ * optionally set it as active.
376
+ * @param result - Completion result with job and artifact details
377
+ */
378
+ type JobCompletionCallback = (result: JobCompletionResult) => Promise<void>;
379
+ /**
380
+ * Callback invoked by the job runner at each install pipeline stage transition.
381
+ *
382
+ * The manager provides this callback and emits the typed
383
+ * `client.installJob.progress` bus event.
384
+ * @param payload - Progress event payload to emit
385
+ */
386
+ type JobProgressCallback = (payload: ClientInstallProgress) => void;
387
+ /**
388
+ * Callback invoked by the job runner when the install pipeline terminates
389
+ * (success or failure).
390
+ *
391
+ * The manager provides this callback and emits the typed
392
+ * `client.installJob.completed` bus event.
393
+ * @param payload - Completed event payload to emit
394
+ */
395
+ type JobCompletedCallback = (payload: ClientInstallCompleted) => Promise<void>;
396
+ /**
397
+ * Return `true` when `candidate` resolves within `base`.
398
+ *
399
+ * Used by the manager and job runner to guard against path-traversal
400
+ * in persisted install paths and user-supplied version strings.
401
+ *
402
+ * Both arguments must be absolute paths. Relative inputs are rejected before
403
+ * `path.resolve()` runs so the process working directory cannot turn a
404
+ * relative candidate into an apparently managed path.
405
+ * @param base - Absolute base path
406
+ * @param candidate - Absolute path to validate
407
+ * @returns `true` when the candidate is safely within `base`
408
+ */
409
+ declare function isPathWithinBase(base: string, candidate: string): boolean;
410
+ /**
411
+ * Resolve and validate `basePath`, returning the resolved absolute path.
412
+ *
413
+ * Both {@link ClientBinaryManager} and {@link ClientBinaryJobRunner} call this
414
+ * at construction time so the resolved base is computed once and reused.
415
+ * @param basePath - Raw base path from configuration
416
+ * @param caller - Class name for error messages
417
+ * @returns Resolved absolute base path
418
+ * @throws When `basePath` is empty or not absolute
419
+ */
420
+ declare function resolveAndValidateBasePath(basePath: string, caller: string): string;
421
+ //#endregion
422
+ //#region subsystems/client/src/client-binary-manager.d.ts
423
+ /**
424
+ * In-memory manager for the global `client.*` binary-management contracts.
425
+ *
426
+ * **Responsibilities:**
427
+ * - Handle `client.list`, `client.install`, `client.update`,
428
+ * `client.setActive`, and `client.uninstall` bus subjects.
429
+ * - Delegate async install/update execution to {@link ClientBinaryJobRunner}.
430
+ * - Persist installation state via `client-binary:storage.*` subjects.
431
+ * - Emit `client.version.changed` whenever the active version pointer changes.
432
+ * - Provide typed progress and completed callbacks to the job runner so that
433
+ * bus emissions remain in the manager layer with correct type inference.
434
+ *
435
+ * **One job per client invariant:** only one install or update job is allowed
436
+ * to run for a given client at a time. Concurrent requests are rejected with
437
+ * an error until the in-flight job completes.
438
+ *
439
+ * **Pin-only installs:** version resolution is always derived from the
440
+ * descriptor pin. No upstream feed fetches are performed at runtime; the
441
+ * version is determined statically from the client package.
442
+ */
443
+ declare class ClientBinaryManager extends BaseService {
444
+ private readonly config;
445
+ private readonly definitionLookup;
446
+ private readonly versionResolver;
447
+ private readonly jobRunner;
448
+ private readonly strategyDeps;
449
+ private readonly resolvedBasePath;
450
+ private readonly resolvedConfigBasePath;
451
+ private readonly resolver;
452
+ /**
453
+ * Set of client IDs with an operation (install, update, or uninstall) in
454
+ * progress.
455
+ *
456
+ * Acquired synchronously before any async work to serialize concurrent
457
+ * requests per client and prevent the TOCTOU window between a guard check
458
+ * and the eventual {@link ClientBinaryJobRunner.startJob} call.
459
+ *
460
+ * Released by the `makeCompletedCallback` `.finally()` on job termination,
461
+ * by the `handleUninstall` `finally` block on uninstall completion, or by
462
+ * {@link onDestroy} on manager teardown.
463
+ */
464
+ private readonly pendingClients;
465
+ /**
466
+ * Creates a new binary manager.
467
+ * @param bus - Bus instance for handler registration and event emission
468
+ * @param config - Manager configuration; `basePath` and `configBasePath` must be non-empty absolute paths
469
+ * @param definitionLookup - Client definition registry
470
+ * @param strategyDeps - I/O dependency implementations for strategies
471
+ * @throws When `config.basePath` or `config.configBasePath` is empty or relative
472
+ */
473
+ constructor(bus: IMakaioBus | undefined, config: ClientBinaryManagerConfig, definitionLookup?: ClientDefinitionLookup, strategyDeps?: StrategyDependencies);
474
+ /**
475
+ * Register bus handlers.
476
+ */
477
+ protected onInit(): Promise<void>;
478
+ /**
479
+ * Cancel all running jobs and clear in-memory state.
480
+ */
481
+ protected onDestroy(): void;
482
+ /**
483
+ * Assemble the installation inventory for all managed clients.
484
+ *
485
+ * Delegates to {@link assembleBinaryList} for the read-model assembly logic.
486
+ * @returns Assembled list of client binary entries
487
+ */
488
+ private handleList;
489
+ /**
490
+ * Enqueue a background install job for a managed client binary.
491
+ *
492
+ * Resolves the target version from the descriptor pin (or validates the
493
+ * explicit version against it) and returns a `jobId` immediately. The job
494
+ * runs asynchronously; callers track progress via
495
+ * `client.installJob.progress` and `client.installJob.completed` events.
496
+ * @param clientId - Stable client identifier to install
497
+ * @param requestedVersion - Explicit version to install (must match the
498
+ * descriptor pin), or `undefined` to use the pin directly
499
+ * @returns Job acknowledgement with resolved version
500
+ */
501
+ private handleInstall;
502
+ /**
503
+ * Install the descriptor pin and activate it.
504
+ *
505
+ * Resolves the version from the descriptor pin and enqueues a job with
506
+ * `makeActive: true`. No upstream feed fetch is performed.
507
+ * @param clientId - Stable client identifier to update
508
+ * @returns Job acknowledgement with resolved version
509
+ */
510
+ private handleUpdate;
511
+ /**
512
+ * Switch the active binary pointer to an already-installed version.
513
+ *
514
+ * The requested version must be present in the installed versions list;
515
+ * requests for uninstalled versions are rejected with an error.
516
+ * @param clientId - Stable client identifier
517
+ * @param version - Exact installed version string to activate
518
+ * @returns Updated client and active version
519
+ */
520
+ private handleSetActive;
521
+ /**
522
+ * Remove a specific installed version of a managed client binary.
523
+ *
524
+ * The version row and active-version pointer are cleared atomically in a
525
+ * single storage transaction via `removeVersionAndClearActive`. Filesystem
526
+ * cleanup and event emission occur in the manager layer after the transaction
527
+ * commits, keeping I/O out of the storage handler.
528
+ *
529
+ * If the removed version was active, `client.version.changed` is emitted.
530
+ * No automatic replacement is made — callers must explicitly call
531
+ * `client.setActive` to promote another version.
532
+ * @param clientId - Stable client identifier
533
+ * @param version - Exact version string to remove
534
+ * @returns Removal result with the updated active version
535
+ */
536
+ private handleUninstall;
537
+ /**
538
+ * Update the active version pointer and optionally emit
539
+ * `client.version.changed`.
540
+ *
541
+ * Centralizes the storage-side active-version mutation used by
542
+ * `handleSetActive` and the job completion callback.
543
+ * @param clientId - Stable client identifier
544
+ * @param newActiveVersion - Version to set active, or `null` to clear
545
+ * @param reason - Operation that triggered the change
546
+ * @returns The previous active version before the mutation
547
+ */
548
+ private patchActiveVersion;
549
+ /**
550
+ * Look up and validate a managed client definition.
551
+ *
552
+ * Throws when no definition is registered for `clientId` or when the
553
+ * definition lacks a `managedInstall` descriptor.
554
+ * @param clientId - Stable client identifier
555
+ * @param subject - Bus subject name used in error messages
556
+ * @returns The full definition and its managed install descriptor
557
+ */
558
+ private requireManagedDefinition;
559
+ /**
560
+ * Acquire the per-client operation lock, run `fn`, and release the lock on
561
+ * pre-job errors via the catch path.
562
+ *
563
+ * On successful job start the lock transfers to the
564
+ * `makeCompletedCallback`, which releases it on job termination.
565
+ * @param clientId - Stable client identifier to lock
566
+ * @param fn - Async work to run while the lock is held
567
+ * @returns The result of `fn`
568
+ */
569
+ private withClientLock;
570
+ /**
571
+ * Build an {@link InstallJob} and hand it to the job runner.
572
+ * @param clientId - Stable client identifier
573
+ * @param resolvedVersion - Concrete version to install
574
+ * @param descriptor - Managed install descriptor
575
+ * @param definition - Full client definition (for post-install and version command)
576
+ * @param makeActive - Whether to activate the version after install
577
+ * @param reason - Originating operation
578
+ * @returns The generated `jobId`
579
+ */
580
+ private startInstallJob;
581
+ /**
582
+ * Create the completion callback passed to the job runner.
583
+ *
584
+ * Primes the managed config directory for the installed client, then persists
585
+ * the installed version to storage and optionally sets it as active, then
586
+ * emits `client.version.changed` with the originating operation reason.
587
+ *
588
+ * **Order of operations:**
589
+ * 1. Prime the managed config directory (blocking, no-op if no handler).
590
+ * 2. Record the installed version and optional activation atomically.
591
+ * 3. Emit `client.version.changed` on activation (best-effort).
592
+ *
593
+ * **Consistency guarantee:** version persistence and optional activation
594
+ * are committed through one storage transaction, so a failed activation
595
+ * cannot leave a version row pointing at a directory the runner will remove.
596
+ * @returns Bound completion callback for the job runner
597
+ */
598
+ private makeCompletionCallback;
599
+ /**
600
+ * Resolve the managed config directory for a client.
601
+ *
602
+ * The managed config directory follows the convention established by
603
+ * {@link ClientBinaryManagerConfig.configBasePath}:
604
+ * `{configBasePath}/{clientId}/config/`.
605
+ * @param clientId - Stable client identifier.
606
+ * @returns Absolute path to the client's managed config directory.
607
+ */
608
+ private resolveManagedConfigDir;
609
+ }
610
+ //#endregion
611
+ //#region subsystems/client/src/client-binary-job-runner.d.ts
612
+ /**
613
+ * Executes install jobs asynchronously and delivers progress and completed
614
+ * notifications via caller-provided typed callbacks.
615
+ *
616
+ * **Lifecycle:**
617
+ * 1. The {@link ClientBinaryManager} creates an {@link InstallJob} and calls
618
+ * {@link startJob}.
619
+ * 2. The runner starts the job in the background (fire-and-forget `void`).
620
+ * 3. As the strategy moves through pipeline stages, the runner invokes the
621
+ * `onProgress` callback with typed progress payloads.
622
+ * 4. On success the runner invokes {@link JobCompletionCallback} (for
623
+ * persistence and activation) and then `onCompleted` with
624
+ * `status: 'success'`.
625
+ * 5. On failure the runner invokes `onCompleted` with `status: 'error'` and
626
+ * skips the persistence callback.
627
+ * 6. {@link cancelAll} sets a cancellation flag and clears the job map so
628
+ * that any in-flight async work skips callbacks after shutdown. The
629
+ * underlying I/O (network, disk) is not interrupted.
630
+ */
631
+ declare class ClientBinaryJobRunner {
632
+ #private;
633
+ private readonly strategyDeps;
634
+ private readonly config;
635
+ /** Active jobs keyed by `jobId`. */
636
+ private readonly jobs;
637
+ private readonly resolvedBasePath;
638
+ /**
639
+ * @param strategyDeps - I/O dependency implementations forwarded to each strategy
640
+ * @param config - Job-runner configuration
641
+ */
642
+ constructor(strategyDeps: StrategyDependencies, config: ClientBinaryJobRunnerConfig);
643
+ /**
644
+ * Start a background install job and return immediately.
645
+ *
646
+ * The job is registered in the internal job map and executed asynchronously.
647
+ * Callers must not await the returned value — the job reports its outcome
648
+ * through the provided callbacks.
649
+ *
650
+ * Pipeline order:
651
+ * 1. Strategy execute (download → checksum → extract → install)
652
+ * 2. Post-install hook (if declared)
653
+ * 3. Version verification (if `versionCommand` is provided)
654
+ * 4. `onComplete` persistence callback
655
+ * 5. `onCompleted` bus-event callback
656
+ * @param job - Job descriptor created by the manager
657
+ * @param descriptor - Managed install descriptor for the client
658
+ * @param onProgress - Callback invoked at each pipeline stage transition
659
+ * @param onComplete - Callback invoked by the runner on successful completion (persistence)
660
+ * @param onCompleted - Callback invoked after completion (bus event emission)
661
+ * @param postInstall - Optional post-install descriptor from the client definition
662
+ * @param versionCommand - Optional version command used to verify the installed binary
663
+ * @returns The `jobId` of the started job (same as `job.jobId`)
664
+ */
665
+ startJob(job: InstallJob, descriptor: ManagedInstallDescriptor, onProgress: JobProgressCallback, onComplete: JobCompletionCallback, onCompleted: JobCompletedCallback, postInstall?: PostInstallDescriptor, versionCommand?: readonly [string, ...string[]]): string;
666
+ /**
667
+ * Signal cancellation and clear all tracked jobs.
668
+ *
669
+ * Called by the manager during shutdown. Sets the cancellation flag so that
670
+ * any in-flight async work skips its callbacks after this point. Clears the
671
+ * internal job map to avoid memory leaks across test resets.
672
+ */
673
+ cancelAll(): void;
674
+ /**
675
+ * Invoke the progress callback without propagating exceptions.
676
+ *
677
+ * Progress emission is best-effort: if the manager's progress publisher
678
+ * throws (e.g. a bus error or a subscriber that throws), the error is
679
+ * swallowed so that the install pipeline can continue unaffected.
680
+ * @param onProgress - Progress notification callback provided by the manager
681
+ * @param payload - Progress event payload to emit
682
+ */
683
+ private safeOnProgress;
684
+ /**
685
+ * Emit progress only while the runner is active.
686
+ *
687
+ * Helper methods use this instead of open-coding `#cancelled` checks so a
688
+ * shutdown that arrives between the caller's outer guard and the helper body
689
+ * cannot leak progress events from a destroyed manager.
690
+ * @param onProgress - Progress notification callback provided by the manager
691
+ * @param payload - Progress event payload to emit
692
+ * @returns `true` when the event was emitted; `false` when cancelled
693
+ */
694
+ private emitProgressIfActive;
695
+ /**
696
+ * Execute a single install job to completion.
697
+ *
698
+ * This method drives the strategy pipeline, invokes the progress callback
699
+ * at each stage, calls the persistence callback on success, and always
700
+ * invokes the completed callback at the end regardless of outcome.
701
+ *
702
+ * All callbacks are guarded by the `#cancelled` flag: if {@link cancelAll}
703
+ * is called while the job is in flight (e.g. during shutdown), no further
704
+ * callbacks will fire after that point.
705
+ * @param job - The running job descriptor
706
+ * @param descriptor - Managed install descriptor for the client
707
+ * @param onProgress - Progress notification callback
708
+ * @param onComplete - Persistence callback invoked on successful completion
709
+ * @param onCompleted - Bus event emission callback invoked after all work
710
+ * @param postInstall - Optional declarative post-install descriptor
711
+ * @param versionCommand - Optional version command used to verify the installed binary
712
+ */
713
+ private runJob;
714
+ /**
715
+ * Drive the success-path finalization: emit the `activating` stage when
716
+ * applicable, persist the artifact via `onComplete`, then emit the
717
+ * `client.installJob.completed` event via `onCompleted`.
718
+ *
719
+ * Extracted from {@link runJob} to keep that method within the line-count
720
+ * lint budget while retaining readable control flow.
721
+ * @param job - Running job descriptor
722
+ * @param artifact - Normalized install artifact returned by the strategy
723
+ * @param metadata - Optional post-install handler metadata
724
+ * @param onProgress - Progress callback (best-effort via {@link safeOnProgress})
725
+ * @param onComplete - Persistence callback invoked before event emission
726
+ * @param onCompleted - Bus event emission callback
727
+ */
728
+ private finalizeSuccess;
729
+ /**
730
+ * Best-effort cleanup for an artifact that passed strategy execution but failed
731
+ * before it could be persisted as an installed version.
732
+ * @param installPath - Absolute staged install directory to remove
733
+ */
734
+ private cleanupStagedArtifact;
735
+ /**
736
+ * Execute the install strategy and clean the target directory if the strategy
737
+ * fails after staging files.
738
+ * @param job - Running job descriptor.
739
+ * @param strategy - Concrete install strategy.
740
+ * @param targetDir - Versioned install directory.
741
+ * @param onProgress - Progress notification callback.
742
+ * @returns Normalized install artifact from the strategy.
743
+ */
744
+ private executeStrategy;
745
+ /**
746
+ * Run the optional declarative post-install hook through a framework-owned
747
+ * handler registered on the manager config.
748
+ * @param job - Running job descriptor
749
+ * @param installPath - Absolute installed binary directory
750
+ * @param postInstall - Declarative post-install descriptor, if any
751
+ * @param onProgress - Progress callback used to emit `post-install`
752
+ * @returns Optional handler metadata
753
+ */
754
+ private runPostInstall;
755
+ /**
756
+ * Emit a `verifying` progress event and invoke {@link verifyInstalledVersion}.
757
+ *
758
+ * Emits a `verifying` progress event with `metadata.kind: 'version-command'`
759
+ * before executing the command so that callers can display real-time feedback.
760
+ * The verification runs synchronously after the event is emitted.
761
+ * @param job - Running job descriptor
762
+ * @param installPath - Absolute installed binary directory
763
+ * @param versionCommand - Command and args declared on the client definition
764
+ * @param onProgress - Progress callback for the verifying stage
765
+ * @throws When path validation fails or the binary reports an unexpected version
766
+ */
767
+ private runVersionVerification;
768
+ /**
769
+ * Resolve a post-install handler by descriptor kind.
770
+ * @param postInstall - Declarative post-install descriptor
771
+ * @returns Registered handler for the descriptor kind
772
+ * @throws When no handler is registered for the descriptor kind
773
+ */
774
+ private resolvePostInstallHandler;
775
+ /**
776
+ * Build a progress payload for runner-owned stages.
777
+ * @param job - Running job descriptor
778
+ * @param stage - Install stage to report
779
+ * @param progress - Stage progress value
780
+ * @param installPath - Absolute installed binary directory
781
+ * @param metadata - Optional event metadata
782
+ * @returns Install progress payload
783
+ */
784
+ private buildProgressPayload;
785
+ /**
786
+ * Resolve the absolute install directory for a specific client version.
787
+ *
788
+ * The convention is `{basePath}/{clientId}/{version}/`. Both `clientId` and
789
+ * `version` are resolved against the base path and validated to prevent path
790
+ * traversal sequences (e.g. `..`) from escaping the install root.
791
+ * @param clientId - Stable client identifier
792
+ * @param version - Resolved version string
793
+ * @returns Absolute target directory path
794
+ * @throws When the resolved path would escape `basePath`
795
+ */
796
+ private resolveTargetDir;
797
+ }
798
+ //#endregion
799
+ //#region subsystems/client/src/client-definition-registry.d.ts
800
+ /**
801
+ * Concrete {@link ClientDefinitionLookup} implementation seeded with a fixed
802
+ * set of definitions at construction time.
803
+ *
804
+ * Definitions are indexed by {@link ClientDefinition.id} for O(1) lookup.
805
+ * The constructor validates that all supplied definitions have unique IDs,
806
+ * throwing immediately on a duplicate to surface misconfiguration at boot
807
+ * rather than silently overwriting an existing entry.
808
+ * @example
809
+ * ```ts
810
+ * const registry = new ClientDefinitionRegistry([claudeCodeDefinition]);
811
+ * const manager = new ClientBinaryManager(bus, config, registry, strategyDeps);
812
+ * await manager.init();
813
+ * ```
814
+ */
815
+ declare class ClientDefinitionRegistry implements ClientDefinitionLookup {
816
+ private readonly definitions;
817
+ /**
818
+ * Create a registry pre-seeded with the supplied definitions.
819
+ *
820
+ * Throws when any two definitions share the same `id` — duplicate IDs
821
+ * indicate a misconfigured boot path that should fail loudly rather than
822
+ * silently drop or overwrite an entry.
823
+ * @param initialDefinitions - Ordered list of client definitions to register at construction time
824
+ * @throws When two definitions in `initialDefinitions` share the same `id`
825
+ */
826
+ constructor(initialDefinitions?: readonly ClientDefinition$1[]);
827
+ /**
828
+ * Return the static definition for the given client identifier, or
829
+ * `undefined` when no definition is registered.
830
+ * @param clientId - Stable client identifier (e.g. `'claude-code'`)
831
+ * @returns The registered {@link ClientDefinition}, or `undefined`
832
+ */
833
+ getDefinition(clientId: string): ClientDefinition$1 | undefined;
834
+ /**
835
+ * Return all registered definitions in insertion order.
836
+ *
837
+ * `client.list` uses this to include managed clients that have no installed
838
+ * versions or state rows yet.
839
+ * @returns All registered client definitions
840
+ */
841
+ listDefinitions(): readonly ClientDefinition$1[];
842
+ /**
843
+ * Register a client definition, replacing any existing entry for the same
844
+ * `definition.id`.
845
+ *
846
+ * **Test and admin path only.** This method is intentionally excluded from
847
+ * the normal application boot sequence. On the production path, all
848
+ * definitions are supplied to the constructor so the registry is immutable
849
+ * from the manager's perspective. Call `register` only from tests or
850
+ * administrative tooling that needs to inject or replace a definition after
851
+ * construction.
852
+ * @param definition - Client definition to register; its `id` is used as the registry key
853
+ */
854
+ register(definition: ClientDefinition$1): void;
855
+ /**
856
+ * Internal helper that registers a definition and throws on a duplicate ID.
857
+ *
858
+ * Used exclusively by the constructor to enforce uniqueness during seeding.
859
+ * @param definition - Client definition to register
860
+ * @throws When a definition with the same `id` is already registered
861
+ */
862
+ private registerUnique;
863
+ }
864
+ //#endregion
865
+ //#region subsystems/client/src/client-binary-version-resolver.d.ts
866
+ /**
867
+ * Resolution result returned by {@link ClientBinaryVersionResolver.resolveInstallVersion}.
868
+ */
869
+ interface ResolvedInstallVersion {
870
+ /**
871
+ * Concrete version string to install.
872
+ *
873
+ * Always equals the pinned version from the descriptor. When an explicit
874
+ * version was supplied by the caller it has been validated to match the pin.
875
+ */
876
+ readonly version: string;
877
+ /**
878
+ * `true` when the version was supplied explicitly by the caller and matches
879
+ * the descriptor pin; `false` when the pin was used directly.
880
+ */
881
+ readonly explicit: boolean;
882
+ }
883
+ /**
884
+ * Synchronous, stateless version resolver for managed client binaries.
885
+ *
886
+ * The resolver enforces the pin-only install contract:
887
+ * - When no explicit version is supplied, it returns the descriptor pin.
888
+ * - When an explicit version is supplied, it is accepted only when it equals
889
+ * the descriptor pin; any mismatch throws immediately so the caller can
890
+ * reject the request with a clear message.
891
+ *
892
+ * No network calls, no cache, no async I/O. The concrete version is always
893
+ * known at construction time from the descriptor.
894
+ */
895
+ declare class ClientBinaryVersionResolver {
896
+ /**
897
+ * Resolve the version to install for a `client.install` request.
898
+ *
899
+ * When `explicitVersion` is `undefined`, the descriptor pin is returned
900
+ * directly. When `explicitVersion` is provided, it must exactly match the
901
+ * pin or an error is thrown. Whitespace-only explicit versions are also
902
+ * rejected.
903
+ * @param clientId - Stable client identifier (e.g. `'claude-code'`)
904
+ * @param descriptor - Managed install descriptor carrying the pinned version
905
+ * @param explicitVersion - Version string supplied by the caller, or
906
+ * `undefined` to use the descriptor pin
907
+ * @returns Resolved version and whether it was explicitly requested
908
+ * @throws When `explicitVersion` is an empty/whitespace-only string
909
+ * @throws When `explicitVersion` does not match the descriptor pin
910
+ */
911
+ resolveInstallVersion(clientId: string, descriptor: ManagedInstallDescriptor, explicitVersion?: string): ResolvedInstallVersion;
912
+ }
913
+ //#endregion
914
+ //#region subsystems/client/src/client-runtime-registry-types.d.ts
915
+ /**
916
+ * Shared types for the client runtime registry.
917
+ *
918
+ * Defines the in-memory record shape and upsert result
919
+ * consumed by {@link ClientRuntimeRegistry} and its storage layer.
920
+ * @packageDocumentation
921
+ */
922
+ /**
923
+ * All valid lifecycle status values for a client runtime record.
924
+ *
925
+ * - `'observed'` — weaker evidence only (pid without supervisorSessionId); the
926
+ * runtime has been detected but not yet confirmed as fully started.
927
+ * - `'started'` — strong evidence present (supervisorSessionId, or an adapter
928
+ * confirmed the process); the runtime is confirmed started.
929
+ */
930
+ declare const CLIENT_RUNTIME_STATUSES: readonly ["observed", "started"];
931
+ /** Lifecycle status of a client runtime record. */
932
+ type ClientRuntimeStatus = (typeof CLIENT_RUNTIME_STATUSES)[number];
933
+ /**
934
+ * In-memory record for a single client runtime instance.
935
+ *
936
+ * All fields except `clientRuntimeId`, `clientId`, `status`, `observedAt`,
937
+ * `createdAt`, and `updatedAt` are optional because evidence accumulates
938
+ * incrementally across multiple observations.
939
+ */
940
+ interface ClientRuntimeRecord {
941
+ /** Stable runtime identifier assigned by the registry (UUID v4). */
942
+ readonly clientRuntimeId: string;
943
+ /** Stable client identifier (e.g. `'claude-code'`). */
944
+ readonly clientId: string;
945
+ /** Current lifecycle status of the runtime. */
946
+ status: ClientRuntimeStatus;
947
+ /** Supervisor-assigned session ID, if observed. */
948
+ supervisorSessionId?: string;
949
+ /** OS process ID of the client binary, if observed. */
950
+ pid?: number;
951
+ /** OS process ID of the parent process, if observed. */
952
+ parentPid?: number;
953
+ /** Raw session identifier from the client runtime, if observed. */
954
+ adapterSessionId?: string;
955
+ /** Framework session ID, if already resolved. */
956
+ sessionId?: string;
957
+ /** Working directory of the client process, if observed. */
958
+ cwd?: string;
959
+ /** Full argv of the client process, if observed. */
960
+ argv?: string[];
961
+ /** Arbitrary pass-through metadata from the most recent observation. */
962
+ metadata?: Record<string, unknown>;
963
+ /** Unix epoch timestamp in milliseconds of the latest captured observation while the record was observed. */
964
+ observedAt: number;
965
+ /** Unix epoch timestamp in milliseconds when this record was created. */
966
+ readonly createdAt: number;
967
+ /** Unix epoch timestamp in milliseconds of the last mutation. */
968
+ updatedAt: number;
969
+ }
970
+ /**
971
+ * Result returned by {@link ClientRuntimeRegistry.upsertRuntime}.
972
+ */
973
+ interface RuntimeUpsertResult {
974
+ /** Stable runtime record ID assigned or retrieved by the registry. */
975
+ readonly clientRuntimeId: string;
976
+ /** `true` when this observation created a new runtime record. */
977
+ readonly created: boolean;
978
+ /**
979
+ * `true` when this observation promoted an existing record from `'observed'`
980
+ * to `'started'` status.
981
+ */
982
+ readonly promoted: boolean;
983
+ /** The upserted runtime record (post-enrichment). */
984
+ readonly record: ClientRuntimeRecord;
985
+ }
986
+ //#endregion
987
+ //#region subsystems/client/src/client-runtime-registry.d.ts
988
+ /**
989
+ * In-memory registry that canonicalizes client runtime instances across
990
+ * evidence fields and optionally persists them via a bus-backed handler.
991
+ *
992
+ * Construct the registry with an optional bus instance. When a bus is
993
+ * provided, every upsert is mirrored to the Drizzle handler via the
994
+ * `client-runtime:storage.upsert` subject. Call {@link loadFromStorage}
995
+ * once at boot to hydrate the in-memory map from persisted records.
996
+ */
997
+ declare class ClientRuntimeRegistry {
998
+ private readonly runtimeMap;
999
+ private readonly bus;
1000
+ /**
1001
+ * Creates a new runtime registry.
1002
+ * @param bus - Optional bus instance used to persist runtime records. When
1003
+ * absent, the registry operates purely in memory without persistence.
1004
+ */
1005
+ constructor(bus?: IMakaioBus);
1006
+ /**
1007
+ * Hydrate the in-memory map from all records persisted in storage.
1008
+ *
1009
+ * Must be called once at service boot before accepting observations. When
1010
+ * no bus is wired in, this is a no-op.
1011
+ */
1012
+ loadFromStorage(): Promise<void>;
1013
+ /**
1014
+ * Upsert a runtime record for the provided observation evidence.
1015
+ *
1016
+ * Matching priority:
1017
+ * 1. `supervisorSessionId` — globally unique; matches across clients.
1018
+ * 2. `pid + clientId` — strong OS-level identity.
1019
+ * 3. `adapterSessionId + clientId` — weaker adapter-level identity.
1020
+ *
1021
+ * When no existing record matches, a new runtime is created. When a match
1022
+ * is found, the record is enriched with any new evidence fields and promoted
1023
+ * to `'started'` when the incoming evidence warrants it.
1024
+ * @param input - Runtime observation evidence
1025
+ * @returns Upsert result with the stable `clientRuntimeId` and change flags
1026
+ */
1027
+ upsertRuntime(input: ClientRuntimeObserveRequest): Promise<RuntimeUpsertResult>;
1028
+ /**
1029
+ * Retrieve a runtime record by its stable ID.
1030
+ *
1031
+ * Returns a detached snapshot so caller mutations cannot affect registry
1032
+ * records or secondary indexes.
1033
+ * @param clientRuntimeId - Stable runtime identifier
1034
+ * @returns The record, or `undefined` when not found
1035
+ */
1036
+ getRuntime(clientRuntimeId: string): ClientRuntimeRecord | undefined;
1037
+ /**
1038
+ * Remove all in-memory state.
1039
+ *
1040
+ * Does not touch persisted records — the storage layer is authoritative
1041
+ * across restarts. Call {@link loadFromStorage} to re-hydrate.
1042
+ */
1043
+ clear(): void;
1044
+ /**
1045
+ * Return the number of runtime records currently held in memory.
1046
+ * @returns Number of runtime records in the in-memory map
1047
+ */
1048
+ get size(): number;
1049
+ private persistRecord;
1050
+ }
1051
+ //#endregion
1052
+ //#region subsystems/client/src/client-runtime-service.d.ts
1053
+ /**
1054
+ * In-memory runtime service for the global `client.*` contracts.
1055
+ *
1056
+ * The service owns six concerns:
1057
+ * - account identity canonicalization via {@link ClientAccountRegistry}
1058
+ * - latest usage snapshot retention and `client.usage.snapshot` emission
1059
+ * - active account identity tracking (`account.activate` / `account.getActive`)
1060
+ * - CLI-backed client discovery via storage + CLI detection orchestration
1061
+ * - client runtime instance lifecycle via {@link ClientRuntimeRegistry}
1062
+ * - global wiring aggregation via `client.wiring.list` fan-out to enabled clients
1063
+ */
1064
+ declare class ClientRuntimeService extends BaseService {
1065
+ private readonly accountRegistry;
1066
+ private readonly runtimeRegistry;
1067
+ private readonly latestSnapshots;
1068
+ /**
1069
+ * Most recently activated account identity per client, keyed by `clientId`.
1070
+ *
1071
+ * Populated by the `account.activate` handler and queried by `account.getActive`.
1072
+ * This allows services (e.g. the Claude Code client) to resolve an active
1073
+ * account identity without requiring a persisted session.
1074
+ */
1075
+ private readonly activeIdentities;
1076
+ /**
1077
+ * Creates a new client runtime service.
1078
+ * @param bus - Bus instance used for client request/event handling
1079
+ * @param accountRegistry - In-memory account registry implementation
1080
+ * @param runtimeRegistry - Registry for client runtime instance lifecycle
1081
+ */
1082
+ constructor(bus?: IMakaioBus, accountRegistry?: ClientAccountRegistry, runtimeRegistry?: ClientRuntimeRegistry);
1083
+ /**
1084
+ * Register client runtime handlers on the bus.
1085
+ */
1086
+ protected onInit(): Promise<void>;
1087
+ /**
1088
+ * Clear all in-memory state on destroy.
1089
+ */
1090
+ protected onDestroy(): void;
1091
+ /**
1092
+ * Return the latest snapshot retained for an account, if one exists.
1093
+ * @param clientAccountId - Canonical account ID
1094
+ * @returns Latest snapshot or undefined
1095
+ */
1096
+ getLatestSnapshot(clientAccountId: string): ClientUsageSnapshot | undefined;
1097
+ private handleAccountObserve;
1098
+ private handleUsageIngest;
1099
+ private handleRuntimeObserve;
1100
+ private scanClients;
1101
+ private listScannableStoredClients;
1102
+ /**
1103
+ * Fan out a `wiring.list` request to each enabled client and aggregate the
1104
+ * results.
1105
+ *
1106
+ * Only enabled clients respond; clients whose per-client `wiring.list`
1107
+ * handler is not registered are skipped via `requestOptional`, and clients
1108
+ * whose handler throws (I/O error, timeout, etc.) are omitted with a
1109
+ * warning so that one failing client does not break status for the rest.
1110
+ *
1111
+ * The `payload` object accepts three optional filter fields:
1112
+ * - `clientId` — when present, only the matching client is queried.
1113
+ * - `projectDir` — forwarded verbatim to each per-client handler.
1114
+ * - `makaioCommand` — forwarded verbatim to each per-client handler.
1115
+ * @param payload - Filtering options forwarded to each per-client handler.
1116
+ * @returns Aggregated wiring results for all responding enabled clients.
1117
+ */
1118
+ private listWirings;
1119
+ private consolidateMergedSnapshots;
1120
+ }
1121
+ //#endregion
1122
+ //#region subsystems/client/src/client-config-prime-service.d.ts
1123
+ /**
1124
+ * Handles the generic `client.config.prime` request subject.
1125
+ */
1126
+ declare class ClientConfigPrimeService extends BaseService {
1127
+ /**
1128
+ * @param bus - Bus instance used for handler registration and delegation.
1129
+ */
1130
+ constructor(bus?: IMakaioBus);
1131
+ /**
1132
+ * Register the generic config-prime handler.
1133
+ */
1134
+ protected onInit(): void;
1135
+ }
1136
+ //#endregion
1137
+ //#region subsystems/client/src/client-profile-service.d.ts
1138
+ /**
1139
+ * Handles the `client.profile.*` bus subjects, providing full CRUD for named
1140
+ * client configuration profiles plus filesystem directory management.
1141
+ *
1142
+ * Filesystem layout managed by this service:
1143
+ * ```
1144
+ * {clientsBasePath}/{clientId}/profiles/{name}/
1145
+ * ```
1146
+ */
1147
+ declare class ClientProfileService extends BaseService {
1148
+ private readonly clientsBasePath;
1149
+ /**
1150
+ * @param bus - Bus instance used for handler registration and storage requests
1151
+ * @param clientsBasePath - Absolute path to the top-level clients directory
1152
+ * (e.g. `~/.makaio/clients/`)
1153
+ */
1154
+ constructor(bus: IMakaioBus, clientsBasePath: string);
1155
+ /**
1156
+ * Register all `client.profile.*` handlers.
1157
+ */
1158
+ protected onInit(): Promise<void>;
1159
+ /**
1160
+ * Register the `client.profile.create` handler.
1161
+ */
1162
+ private registerCreateHandler;
1163
+ /**
1164
+ * Register the `client.profile.list` handler.
1165
+ */
1166
+ private registerListHandler;
1167
+ /**
1168
+ * Register the `client.profile.get` handler.
1169
+ */
1170
+ private registerGetHandler;
1171
+ /**
1172
+ * Register the `client.profile.update` handler.
1173
+ */
1174
+ private registerUpdateHandler;
1175
+ /**
1176
+ * Register the `client.profile.delete` handler.
1177
+ */
1178
+ private registerDeleteHandler;
1179
+ /**
1180
+ * Register the `client.profile.setDefault` handler.
1181
+ */
1182
+ private registerSetDefaultHandler;
1183
+ }
1184
+ //#endregion
1185
+ //#region subsystems/client/src/client-session-config-service.d.ts
1186
+ /**
1187
+ * Handles `client.sessionConfig.*` bus subjects, providing per-session config
1188
+ * directory isolation for client processes.
1189
+ */
1190
+ declare class ClientSessionConfigService extends BaseService {
1191
+ private readonly clientsBasePath;
1192
+ private readonly getNow;
1193
+ /**
1194
+ * @param bus - Bus instance used for handler registration and storage requests
1195
+ * @param clientsBasePath - Absolute path to the top-level clients directory
1196
+ * (e.g. `~/.makaio/clients/`)
1197
+ * @param getNow - Returns the current Unix epoch in milliseconds; injectable
1198
+ * for deterministic testing (defaults to `Date.now`)
1199
+ */
1200
+ constructor(bus: IMakaioBus, clientsBasePath: string, getNow?: () => number);
1201
+ /**
1202
+ * Register all `client.sessionConfig.*` handlers and run boot-time cleanup.
1203
+ */
1204
+ protected onInit(): Promise<void>;
1205
+ /**
1206
+ * Resolve the base configuration directory for a session.
1207
+ *
1208
+ * Resolution order:
1209
+ * 1. Explicit `baseConfigDir` from the request payload.
1210
+ * 2. Named profile's `configDir` looked up via storage.
1211
+ * 3. Default profile's `configDir` when no explicit name was provided.
1212
+ * 4. `sessionDir` — the client-owned setup handler decides the actual source
1213
+ * (e.g. `~/.claude` for Claude Code) when no profile is configured.
1214
+ * @param clientId - Canonicalized stable client identifier
1215
+ * @param sessionDir - Absolute path to the already-created session directory
1216
+ * @param profileName - Optional profile name to look up
1217
+ * @param explicitBaseConfigDir - Caller-supplied override, if any
1218
+ * @returns Resolved absolute path for the base config directory
1219
+ */
1220
+ private resolveBaseConfigDir;
1221
+ /**
1222
+ * Scan session directories and remove those older than {@link SESSION_MAX_AGE_MS}.
1223
+ *
1224
+ * When `clientId` is supplied only that client's sessions are scanned.
1225
+ * Omit it to clean across all clients.
1226
+ * @param clientId - Optional client ID to scope cleanup
1227
+ * @returns Absolute paths of all directories that were removed
1228
+ */
1229
+ private cleanupOrphanedDirs;
1230
+ /**
1231
+ * Remove every per-client config directory for a closed framework session.
1232
+ * @param sessionId - Framework session ID from `session.closed`.
1233
+ */
1234
+ private destroySessionDirsForSessionId;
1235
+ /**
1236
+ * Run client-owned session config teardown before removing the directory.
1237
+ * @param clientId - Canonical client identifier.
1238
+ * @param sessionDir - Absolute session config directory to destroy.
1239
+ */
1240
+ private destroyClientSessionDir;
1241
+ /**
1242
+ * Check whether a stale-looking directory belongs to a still-active session.
1243
+ * @param sessionId - Session directory name.
1244
+ * @returns `true` when the session registry still marks the session active.
1245
+ */
1246
+ private isActiveSession;
1247
+ /**
1248
+ * Resolve a session directory for a canonical client ID.
1249
+ * @param clientId - Canonical client identifier.
1250
+ * @param sessionId - Framework session ID.
1251
+ * @param operation - Operation name used in error messages.
1252
+ * @returns Absolute session directory path.
1253
+ */
1254
+ private resolveClientSessionDir;
1255
+ /**
1256
+ * List all client IDs that currently have a directory under `clientsBasePath`.
1257
+ * @returns Array of directory names (one per client)
1258
+ */
1259
+ private listClientIds;
1260
+ }
1261
+ //#endregion
1262
+ //#region subsystems/client/src/client-session-observed-semantics.d.ts
1263
+ /**
1264
+ * Canonical schema for the raw catch-all hook payload delivered on
1265
+ * `client:<id>.hook.received`.
1266
+ *
1267
+ * Client ingress CLIs are dumb bridges: they accept any native hook event and
1268
+ * publish it verbatim on this subject. Downstream normalizers are responsible
1269
+ * for interpreting `eventName` and mapping the `payload` to structured
1270
+ * `client.session.*` observations.
1271
+ *
1272
+ * Fields:
1273
+ * - `eventName` — the hook event name as reported by the client CLI
1274
+ * (e.g. `'PreToolUse'`, `'Stop'`).
1275
+ * - `receivedAt` — Unix epoch timestamp in milliseconds when the bridge
1276
+ * received the hook call.
1277
+ * - `payload` — raw JSON object forwarded verbatim from the client CLI.
1278
+ * - `metadata` — optional pass-through metadata added by the bridge (e.g.
1279
+ * process PID, invocation arguments).
1280
+ */
1281
+ declare const RawClientHookPayloadSchema: z.ZodObject<{
1282
+ eventName: z.ZodString;
1283
+ receivedAt: z.ZodNumber;
1284
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1285
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1286
+ }, z.core.$strip>;
1287
+ type RawClientHookPayload = z.infer<typeof RawClientHookPayloadSchema>;
1288
+ /**
1289
+ * Normalize user-provided client identifiers to the stable suffix used in
1290
+ * `client:<id>` namespaces.
1291
+ * @param clientId - Raw client identifier, optionally prefixed with `client:`
1292
+ * @param caller - Optional function name used in thrown error messages
1293
+ * @returns Canonical lowercase client identifier without the `client:` prefix
1294
+ */
1295
+ declare function canonicalizeClientId(clientId: string, caller?: string): string;
1296
+ type RawClientHookSubjectRecord = SubjectRecord<'hook.received', EventMessagePayload<RawClientHookPayload>>;
1297
+ /**
1298
+ * Subject definition for the raw catch-all hook event in a concrete
1299
+ * `client:<id>` namespace.
1300
+ */
1301
+ type RawClientHookReceivedSubject = SubjectDefinition<RawClientHookSubjectRecord, 'hook.received', `client:${string}`>;
1302
+ /**
1303
+ * Build a non-owning subject definition for `client:<id>.hook.received`.
1304
+ *
1305
+ * This is intentionally not a namespace registration. Concrete client packages
1306
+ * own their full `client:<id>` namespace via {@link createClientNamespace}; the
1307
+ * generic CLI bridge only needs to emit the shared hook subject and must not
1308
+ * accidentally register a narrower namespace before the concrete owner loads.
1309
+ * When the concrete owner is loaded, normal bus schema validation applies. When
1310
+ * it is not loaded, the ad-hoc subject still allows the raw event to traverse
1311
+ * transports to a process that owns the namespace.
1312
+ * @param clientId - Stable client identifier, optionally prefixed with `client:`
1313
+ * @returns Non-owning subject definition for the client's raw hook ingress
1314
+ */
1315
+ declare function createRawClientHookReceivedSubject(clientId: string): RawClientHookReceivedSubject;
1316
+ /**
1317
+ * Default timeout in milliseconds for hook handle requests.
1318
+ *
1319
+ * Shared between the CLI schema default (client-hooks extension) and the
1320
+ * wiring descriptor trailing flags (claude-code client) so both always agree
1321
+ * on the configured wait budget without independent magic numbers.
1322
+ */
1323
+ declare const DEFAULT_HOOK_HANDLE_TIMEOUT_MS = 5000;
1324
+ /**
1325
+ * Schema for the response payload returned by a `makaio hook handle` command.
1326
+ *
1327
+ * The client binary reads this from the command's stdout after the process
1328
+ * exits. All fields default to safe zero-values so partial responses are
1329
+ * still valid.
1330
+ *
1331
+ * Fields:
1332
+ * - `exitCode` — process exit code the binary should use (0–255). Defaults to `0`.
1333
+ * - `stdout` — text written to stdout, forwarded verbatim to the client.
1334
+ * Defaults to `''`.
1335
+ * - `stderr` — text written to stderr, forwarded verbatim to the client.
1336
+ * Defaults to `''`.
1337
+ */
1338
+ declare const ClientHookHandleResponseSchema: z.ZodObject<{
1339
+ exitCode: z.ZodDefault<z.ZodNumber>;
1340
+ stdout: z.ZodDefault<z.ZodString>;
1341
+ stderr: z.ZodDefault<z.ZodString>;
1342
+ }, z.core.$strip>;
1343
+ type ClientHookHandleResponse = z.infer<typeof ClientHookHandleResponseSchema>;
1344
+ type RawClientHookHandleSubjectRecord = SubjectRecord<'hook.handle', RequestMessagePayload<RawClientHookPayload, ClientHookHandleResponse>>;
1345
+ /**
1346
+ * Subject definition for the raw hook handle request/response subject in a
1347
+ * concrete `client:<id>` namespace.
1348
+ *
1349
+ * Carries `RequestMessagePayload<RawClientHookPayload, ClientHookHandleResponse>`
1350
+ * as a phantom type so `bus.requestOptional` infers the correct generics without
1351
+ * additional type annotations at the call site.
1352
+ */
1353
+ type RawClientHookHandleSubject = SubjectDefinition<RawClientHookHandleSubjectRecord, 'hook.handle', `client:${string}`>;
1354
+ /**
1355
+ * Build a non-owning subject definition for `client:<id>.hook.handle`.
1356
+ *
1357
+ * The returned definition uses `isRequest: true` so the bus dispatches it
1358
+ * through the request/response pipeline. Concrete client packages own their
1359
+ * full `client:<id>` namespace via {@link createClientNamespace}; this helper
1360
+ * is intentionally non-owning for the same reasons as
1361
+ * {@link createRawClientHookReceivedSubject} — see that function's doc for
1362
+ * the full rationale.
1363
+ * @param rawClientId - Stable client identifier, optionally prefixed with `client:`
1364
+ * @returns Non-owning subject definition for the client's raw hook handle ingress
1365
+ */
1366
+ declare function createRawClientHookHandleSubject(rawClientId: string): RawClientHookHandleSubject;
1367
+ /**
1368
+ * Trim and return a string value when non-empty, otherwise `undefined`.
1369
+ *
1370
+ * Primitive building block for normalizers that accept `unknown` values from
1371
+ * raw JSON payloads. Returns `undefined` when the input is not a string, or
1372
+ * is a string that is empty or whitespace-only after trimming.
1373
+ * @param value - Unknown value to inspect.
1374
+ * @returns Trimmed non-empty string, or `undefined`.
1375
+ */
1376
+ declare function pickNonEmptyStringValue(value: unknown): string | undefined;
1377
+ /**
1378
+ * Extract a non-empty string value from an unknown-typed hook payload object.
1379
+ *
1380
+ * Convenience helper used by client hook normalizers to pick a single key from
1381
+ * a raw JSON payload. Returns `undefined` when the key is absent, not a
1382
+ * string, or an empty string — so callers can use the `?? undefined` pattern
1383
+ * or spread conditionally without additional checks.
1384
+ * @param payload - Raw hook payload object forwarded by the ingress bridge.
1385
+ * @param key - Property key to read.
1386
+ * @returns Non-empty string value, or `undefined` when absent or empty.
1387
+ */
1388
+ declare function pickNonEmptyString(payload: Record<string, unknown>, key: string): string | undefined;
1389
+ /**
1390
+ * Options for constructing a {@link ClientSessionObservedBase} payload.
1391
+ */
1392
+ interface BuildClientSessionBaseOpts {
1393
+ /** Stable client identifier (e.g. `'codex'`, `'claude-code'`). */
1394
+ clientId: string;
1395
+ /** Framework session ID, if already resolved at emission time. */
1396
+ sessionId?: string;
1397
+ /** Raw session identifier from the client runtime, if available. */
1398
+ adapterSessionId?: string;
1399
+ }
1400
+ /**
1401
+ * Build a {@link ClientSessionObservedBase} payload for a `client.session.*`
1402
+ * observed-semantics event.
1403
+ *
1404
+ * Always stamps `source: 'adapter-derived'` and `observedAt: Date.now()`.
1405
+ * The optional `sessionId` and `adapterSessionId` fields are omitted when
1406
+ * undefined so Zod validation does not receive explicit `undefined` values.
1407
+ * @param opts - Client and session identifiers for the observation
1408
+ * @returns Base payload ready for emission or spread-extension
1409
+ */
1410
+ declare function buildClientSessionBase(opts: BuildClientSessionBaseOpts): ClientSessionObservedBase;
1411
+ /**
1412
+ * Execute an async emission thunk best-effort, swallowing any rejection.
1413
+ *
1414
+ * Adapters use this to emit `client.session.*` observed-semantics events
1415
+ * without risking disruption of the core adapter operation when no handler
1416
+ * is registered for the observed-semantics surface.
1417
+ * @param fn - Async emission thunk to execute fire-and-forget
1418
+ */
1419
+ declare function emitBestEffort(fn: () => Promise<void>): void;
1420
+ //#endregion
1421
+ //#region subsystems/client/src/create-client-namespace.d.ts
1422
+ /**
1423
+ * Result returned by {@link createClientNamespace}.
1424
+ * @typeParam AdditionalSchemas - Extra subject schemas registered alongside the
1425
+ * shared hook subjects. Defaults to an empty record (no extras).
1426
+ */
1427
+ interface ClientNamespaceResult<AdditionalSchemas extends SchemaRecord = Record<never, never>> {
1428
+ /**
1429
+ * The fully-qualified bus namespace domain string (e.g. `'client:codex'`).
1430
+ */
1431
+ readonly namespaceDomain: string;
1432
+ /**
1433
+ * Typed bus subjects for the per-client namespace.
1434
+ *
1435
+ * Always includes `hook.received` for raw hook ingress and `hook.handle` for
1436
+ * hook request handling.
1437
+ * When `additionalSchemas` were provided at construction time the extra
1438
+ * subjects are also present here, fully typed.
1439
+ */
1440
+ readonly subjects: ReturnType<typeof buildClientSubjects<AdditionalSchemas>>;
1441
+ }
1442
+ /**
1443
+ * Build the subjects object for a per-client namespace.
1444
+ *
1445
+ * Extracted to a named generic function so the inferred return type is stable
1446
+ * and can be referenced by {@link ClientNamespaceResult} via instantiation
1447
+ * expressions.
1448
+ * @param clientId - Stable client identifier (e.g. `'codex'`)
1449
+ * @param additionalSchemas - Extra subjects to register alongside the shared
1450
+ * hook subjects.
1451
+ * @returns Namespace subjects with shared hook subjects plus any additional
1452
+ * subjects.
1453
+ */
1454
+ declare function buildClientSubjects<AdditionalSchemas extends SchemaRecord>(clientId: string, additionalSchemas: AdditionalSchemas): _$_makaio_core0.BusSubjects<_$_makaio_core0.FlatSubjectDefinitions<`client:${string}`, {
1455
+ 'hook.received': _$zod.ZodObject<{
1456
+ eventName: _$zod.ZodString;
1457
+ receivedAt: _$zod.ZodNumber;
1458
+ payload: _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodUnknown>;
1459
+ metadata: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodUnknown>>;
1460
+ }, _$zod_v4_core0.$strip>;
1461
+ 'hook.handle': {
1462
+ request: _$zod.ZodObject<{
1463
+ eventName: _$zod.ZodString;
1464
+ receivedAt: _$zod.ZodNumber;
1465
+ payload: _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodUnknown>;
1466
+ metadata: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodUnknown>>;
1467
+ }, _$zod_v4_core0.$strip>;
1468
+ response: _$zod.ZodObject<{
1469
+ exitCode: _$zod.ZodDefault<_$zod.ZodNumber>;
1470
+ stdout: _$zod.ZodDefault<_$zod.ZodString>;
1471
+ stderr: _$zod.ZodDefault<_$zod.ZodString>;
1472
+ }, _$zod_v4_core0.$strip>;
1473
+ };
1474
+ } & AdditionalSchemas>, `client:${string}`>;
1475
+ /**
1476
+ * Create (or retrieve) the per-client bus namespace for `client:<clientId>`.
1477
+ *
1478
+ * The namespace is registered idempotently — calling this function multiple
1479
+ * times with the same `clientId` returns equivalent subjects.
1480
+ *
1481
+ * The resulting namespace pre-registers the `hook.received` and `hook.handle`
1482
+ * subjects so client bridges have consistent hook ingress and request handling
1483
+ * points:
1484
+ *
1485
+ * ```ts
1486
+ * // In @makaio/client-codex
1487
+ * export const { subjects: CodexClientSubjects } = createClientNamespace('codex');
1488
+ * // CodexClientSubjects.hook.received → 'client:codex.hook.received'
1489
+ * // CodexClientSubjects.hook.handle → 'client:codex.hook.handle'
1490
+ * ```
1491
+ *
1492
+ * Clients that need extra subjects pass them as the second argument:
1493
+ *
1494
+ * ```ts
1495
+ * // In @makaio/client-claude-code
1496
+ * export const { subjects } = createClientNamespace('claude-code', {
1497
+ * 'statusline.received': ClaudeCodeStatuslinePayloadSchema,
1498
+ * });
1499
+ * // subjects.statusline.received → 'client:claude-code.statusline.received'
1500
+ * ```
1501
+ * @param clientId - Stable client identifier (e.g. `'codex'`,
1502
+ * `'claude-code'`), optionally prefixed with `client:`. Canonicalized to
1503
+ * lowercase and restricted to letters, numbers, and hyphens.
1504
+ * @param additionalSchemas - Optional extra subject schemas to register alongside
1505
+ * the shared hook subjects. Must not include `hook.received` or `hook.handle`.
1506
+ * @returns Namespace domain string and typed bus subjects.
1507
+ */
1508
+ declare function createClientNamespace<AdditionalSchemas extends SchemaRecord = Record<never, never>>(clientId: string, additionalSchemas?: AdditionalSchemas): ClientNamespaceResult<AdditionalSchemas>;
1509
+ //#endregion
1510
+ //#region subsystems/client/src/wiring-schemas.d.ts
1511
+ /**
1512
+ * Non-empty absolute filesystem path.
1513
+ *
1514
+ * Used for `projectDir` across all config and wiring subjects to ensure paths
1515
+ * are not resolved relative to the service process cwd.
1516
+ */
1517
+ declare const AbsolutePathSchema: z.ZodString;
1518
+ /**
1519
+ * Shared response schema for per-client `wiring.list`.
1520
+ *
1521
+ * Returns all known wiring entries for the requested scope, indicating which
1522
+ * are currently installed.
1523
+ */
1524
+ declare const ClientWiringListResponseSchema: z.ZodObject<{
1525
+ entries: z.ZodArray<z.ZodObject<{
1526
+ group: z.ZodString;
1527
+ name: z.ZodString;
1528
+ installed: z.ZodBoolean;
1529
+ command: z.ZodString;
1530
+ }, z.core.$strip>>;
1531
+ }, z.core.$strip>;
1532
+ /** Inferred type for {@link ClientWiringListResponseSchema}. */
1533
+ type ClientWiringListResponse = z.infer<typeof ClientWiringListResponseSchema>;
1534
+ /**
1535
+ * Shared response schema for per-client `wiring.apply`.
1536
+ *
1537
+ * Reports how many entries were written and how many were already in place.
1538
+ */
1539
+ declare const ClientWiringApplyResponseSchema: z.ZodObject<{
1540
+ applied: z.ZodNumber;
1541
+ skipped: z.ZodNumber;
1542
+ }, z.core.$strip>;
1543
+ /** Inferred type for {@link ClientWiringApplyResponseSchema}. */
1544
+ type ClientWiringApplyResponse = z.infer<typeof ClientWiringApplyResponseSchema>;
1545
+ /**
1546
+ * Shared response schema for per-client `wiring.remove`.
1547
+ *
1548
+ * Reports how many entries were removed from the config file.
1549
+ */
1550
+ declare const ClientWiringRemoveResponseSchema: z.ZodObject<{
1551
+ removed: z.ZodNumber;
1552
+ }, z.core.$strip>;
1553
+ /** Inferred type for {@link ClientWiringRemoveResponseSchema}. */
1554
+ type ClientWiringRemoveResponse = z.infer<typeof ClientWiringRemoveResponseSchema>;
1555
+ /**
1556
+ * A single client's wiring result in the global aggregation response.
1557
+ *
1558
+ * Returned by `client.wiring.list` for each enabled client that responded
1559
+ * to the per-client `wiring.list` bus request.
1560
+ */
1561
+ declare const ClientWiringAggregatedResultSchema: z.ZodObject<{
1562
+ clientId: z.ZodString;
1563
+ entries: z.ZodArray<z.ZodObject<{
1564
+ group: z.ZodString;
1565
+ name: z.ZodString;
1566
+ installed: z.ZodBoolean;
1567
+ command: z.ZodString;
1568
+ }, z.core.$strip>>;
1569
+ }, z.core.$strip>;
1570
+ /** Inferred type for {@link ClientWiringAggregatedResultSchema}. */
1571
+ type ClientWiringAggregatedResult = z.infer<typeof ClientWiringAggregatedResultSchema>;
1572
+ /**
1573
+ * Assert that `projectDir`, when provided, is an absolute path.
1574
+ *
1575
+ * Prevents relative paths from being resolved against the service process cwd
1576
+ * and causing writes to unintended filesystem locations. Used by per-client
1577
+ * wiring handlers as a runtime guard when bus-layer Zod validation may be
1578
+ * skipped in production.
1579
+ * @param projectDir - Path value from the request payload, or `undefined`.
1580
+ * @throws Error When `projectDir` is defined but not an absolute path.
1581
+ */
1582
+ declare function assertAbsoluteProjectDir(projectDir: string | undefined): void;
1583
+ //#endregion
1584
+ //#region subsystems/client/src/create-client-wiring-list-subject.d.ts
1585
+ /** Untyped wiring subject definition returned by {@link createClientWiringSubjectDef}. */
1586
+ interface ClientWiringSubjectDefBase {
1587
+ /** Subject key within the client namespace (e.g. `'wiring.list'`). */
1588
+ subject: string;
1589
+ /** Standard `$meta` applied to all per-client wiring subjects. */
1590
+ $meta: {
1591
+ /** Resolved `client:<id>` namespace for this subject. */namespace: string; /** Always `true` — wiring subjects are request/response pairs. */
1592
+ isRequest: true; /** Always `false` — wiring subjects are not local-only. */
1593
+ local: false; /** Always `false` — wiring subjects are not channels. */
1594
+ channel: false;
1595
+ };
1596
+ }
1597
+ /**
1598
+ * Build a non-owning typed subject definition for any per-client wiring
1599
+ * subject.
1600
+ *
1601
+ * Encapsulates the standard `$meta` structure shared by all
1602
+ * `client:<id>.wiring.*` subjects: `isRequest: true`, `local: false`,
1603
+ * `channel: false`. The `clientId` is canonicalized via
1604
+ * {@link canonicalizeClientId} so callers need not normalize the input.
1605
+ *
1606
+ * This helper returns a plain object — callers cast it to their concrete
1607
+ * {@link SubjectDefinition} type exactly as `createRawClientHookReceivedSubject`
1608
+ * does.
1609
+ * @param clientId - Stable client identifier, optionally prefixed with `client:`.
1610
+ * @param subjectSuffix - Subject key within the namespace (e.g. `'wiring.list'`).
1611
+ * @returns Plain subject definition object ready to be cast to the concrete type.
1612
+ */
1613
+ declare function createClientWiringSubjectDef(clientId: string, subjectSuffix: string): ClientWiringSubjectDefBase;
1614
+ /**
1615
+ * Typed payload for the per-client `wiring.list` request/response pair.
1616
+ *
1617
+ * The request accepts an optional `projectDir` and `makaioCommand` — the
1618
+ * same optional filtering fields supported by all known client wiring
1619
+ * implementations. The response carries an `entries` array.
1620
+ */
1621
+ type ClientWiringListPayload = RequestMessagePayload<{
1622
+ projectDir?: string;
1623
+ makaioCommand: string;
1624
+ }, {
1625
+ entries: ClientWiringEntry[];
1626
+ }>;
1627
+ type ClientWiringListSubjectRecord = SubjectRecord<'wiring.list', ClientWiringListPayload>;
1628
+ /**
1629
+ * Non-owning typed {@link SubjectDefinition} for `client:<id>.wiring.list`.
1630
+ */
1631
+ type ClientWiringListSubjectDef = SubjectDefinition<ClientWiringListSubjectRecord, 'wiring.list', `client:${string}`>;
1632
+ /**
1633
+ * Build a non-owning typed {@link SubjectDefinition} for
1634
+ * `client:<clientId>.wiring.list`.
1635
+ *
1636
+ * This is intentionally **not** a namespace registration. Concrete client
1637
+ * packages own their full `client:<id>` namespace; the aggregator only needs
1638
+ * to dispatch the list request without registering a conflicting namespace.
1639
+ * When the concrete owner is loaded, normal bus schema validation applies;
1640
+ * when it is not, the ad-hoc subject still dispatches locally.
1641
+ * @param clientId - Stable client identifier (e.g. `'claude-code'`,
1642
+ * `'codex'`), optionally prefixed with `client:`.
1643
+ * @returns Non-owning typed subject definition for the per-client wiring list.
1644
+ */
1645
+ declare function createClientWiringListSubjectDef(clientId: string): ClientWiringListSubjectDef;
1646
+ //#endregion
1647
+ //#region subsystems/client/src/package.d.ts
1648
+ /**
1649
+ * Composite service that initialises and destroys the
1650
+ * {@link ClientRuntimeService}, the {@link ClientBinaryManager}, the
1651
+ * {@link ClientConfigPrimeService}, the {@link ClientProfileService}, and the
1652
+ * {@link ClientSessionConfigService}
1653
+ * under a single {@link ExtensionServiceLifecycle} handle.
1654
+ *
1655
+ * The host coordinator calls `init()` once and `destroy()` once; this class
1656
+ * ensures all five services participate in the same lifecycle without any
1657
+ * requiring knowledge of the others.
1658
+ */
1659
+ declare class ClientsCoreService implements ExtensionServiceLifecycle {
1660
+ private readonly runtimeService;
1661
+ private readonly binaryManager;
1662
+ private readonly configPrimeService;
1663
+ private readonly profileService;
1664
+ private readonly sessionConfigService;
1665
+ /**
1666
+ * @param runtimeService - Handles `client.*` runtime observation subjects
1667
+ * @param binaryManager - Handles `client.*` binary-management subjects
1668
+ * @param configPrimeService - Handles generic `client.config.prime` delegation
1669
+ * @param profileService - Handles `client.profile.*` CRUD subjects
1670
+ * @param sessionConfigService - Handles `client.sessionConfig.*` isolation subjects
1671
+ */
1672
+ constructor(runtimeService: ClientRuntimeService, binaryManager: ClientBinaryManager, configPrimeService: ClientConfigPrimeService, profileService: ClientProfileService, sessionConfigService: ClientSessionConfigService);
1673
+ /**
1674
+ * Initialize all five sub-services in parallel.
1675
+ *
1676
+ * Uses {@link Promise.allSettled} so every service always attempts
1677
+ * initialisation — matching the resilience pattern used by {@link destroy}.
1678
+ * If any service fails, the first rejection is re-thrown after all attempts
1679
+ * have settled. Secondary failures are logged for observability.
1680
+ */
1681
+ init(): Promise<void>;
1682
+ /**
1683
+ * Destroy all five sub-services in parallel.
1684
+ *
1685
+ * Uses {@link Promise.allSettled} to guarantee every cleanup runs even when
1686
+ * one rejects. Any rejections are logged for observability — matching the
1687
+ * secondary-failure logging pattern used by {@link init}.
1688
+ */
1689
+ destroy(): Promise<void>;
1690
+ }
1691
+ /** Typed package token for retrieving the clients-core service. */
1692
+ declare const ClientsCoreToken: _$_makaio_contracts0.ExtensionToken<ClientsCoreService>;
1693
+ /**
1694
+ * Options accepted by {@link createClientsCorePackage}.
1695
+ *
1696
+ * Definitions supplied here are seeded into a {@link ClientDefinitionRegistry}
1697
+ * at construction time, before the coordinator calls `init()` on the returned
1698
+ * service. All definitions must be available before `init()` runs — there is
1699
+ * no post-start mutation path on the service surface.
1700
+ */
1701
+ interface ClientsCorePackageOptions {
1702
+ /**
1703
+ * Client definitions to register before service initialisation.
1704
+ *
1705
+ * Typically populated by the boot composition root from discovered client
1706
+ * packages via `loadMakaioExtensions` before calling `coordinator.load`.
1707
+ */
1708
+ readonly definitions?: readonly ClientDefinition[];
1709
+ /**
1710
+ * I/O dependency implementations for the binary install strategies.
1711
+ *
1712
+ * When omitted the manager uses a no-op implementation that throws on every
1713
+ * call — correct for framework-only test callers that do not exercise binary
1714
+ * management, but must be replaced before binary installation is functional.
1715
+ *
1716
+ * Host composition roots pass their concrete strategy dependency
1717
+ * implementation here on real boot paths.
1718
+ */
1719
+ readonly strategyDependencies?: StrategyDependencies;
1720
+ /**
1721
+ * Framework-owned handlers for declarative post-install descriptors.
1722
+ *
1723
+ * Client packages declare `postInstall.kind`; the host supplies the handler
1724
+ * implementation here. Missing handlers fail the install job rather than
1725
+ * silently skipping a declared lifecycle step.
1726
+ *
1727
+ * When omitted no post-install handlers are registered.
1728
+ */
1729
+ readonly postInstallHandlers?: ReadonlyMap<string, PostInstallHandler>;
1730
+ }
1731
+ /**
1732
+ * Run storage handler registrations and return one cleanup that unwinds every
1733
+ * successful registration in reverse order.
1734
+ *
1735
+ * If any registration throws, previously registered handlers are immediately
1736
+ * rolled back so package startup remains retry-safe.
1737
+ * @param registrations - Ordered storage registration callbacks
1738
+ * @returns Cleanup function for all successful registrations
1739
+ */
1740
+ declare function registerStorageHandlersWithRollback(registrations: ReadonlyArray<() => () => void>): () => void;
1741
+ /**
1742
+ * Create the MakaioExtension manifest for the in-memory client runtime service
1743
+ * and the client binary manager.
1744
+ *
1745
+ * `@makaio/runtime-node` calls this factory after loading client packages and passes
1746
+ * the resulting manifest to the extension coordinator. Definitions supplied
1747
+ * via {@link ClientsCorePackageOptions.definitions} are seeded into a
1748
+ * {@link ClientDefinitionRegistry} before `init()` runs, so
1749
+ * `client.list` returns managed clients immediately after service startup.
1750
+ * @example
1751
+ * ```ts
1752
+ * const clientPackages = await loadMakaioExtensions(discoveredClients, { importModule });
1753
+ * const pkg = createClientsCorePackage({
1754
+ * definitions: clientPackages.flatMap((p) => p.clients ?? []),
1755
+ * });
1756
+ * coordinator.load([pkg, ...otherPackages], configDefaults);
1757
+ * await coordinator.startAll();
1758
+ * ```
1759
+ * @param options - Package options including pre-seeded client definitions,
1760
+ * strategy I/O dependencies, and post-install handlers
1761
+ * @returns Configured MakaioExtension manifest
1762
+ */
1763
+ declare function createClientsCorePackage(options?: ClientsCorePackageOptions): MakaioNodeExtension<IMakaioBus>;
1764
+ //#endregion
1765
+ //#region subsystems/client/src/storage/client-binary-storage-namespace.d.ts
1766
+ /**
1767
+ * Zod schema for a persisted installed-version record transported over the bus.
1768
+ */
1769
+ declare const ClientBinaryVersionRecordSchema: z.ZodObject<{
1770
+ id: z.ZodString;
1771
+ clientId: z.ZodString;
1772
+ version: z.ZodString;
1773
+ installPath: z.ZodString;
1774
+ installedAt: z.ZodNumber;
1775
+ createdAt: z.ZodNumber;
1776
+ }, z.core.$strip>;
1777
+ /**
1778
+ * Zod schema for the per-client binary state record transported over the bus.
1779
+ */
1780
+ declare const ClientBinaryStateRecordSchema: z.ZodObject<{
1781
+ clientId: z.ZodString;
1782
+ activeVersion: z.ZodNullable<z.ZodString>;
1783
+ updatedAt: z.ZodNumber;
1784
+ }, z.core.$strip>;
1785
+ /**
1786
+ * Internal bus namespace for client binary storage operations.
1787
+ *
1788
+ * Subjects registered here are consumed exclusively by the Drizzle handler
1789
+ * and the binary manager — they are not part of the public `client.*` namespace.
1790
+ */
1791
+ declare const ClientBinaryStorageNamespace: _$_makaio_core0.BusNamespaceDefinition<"client-binary:storage", {
1792
+ /** Insert a new installed-version row. */insertVersion: {
1793
+ request: z.ZodObject<{
1794
+ id: z.ZodString;
1795
+ clientId: z.ZodString;
1796
+ version: z.ZodString;
1797
+ installPath: z.ZodString;
1798
+ installedAt: z.ZodNumber;
1799
+ createdAt: z.ZodNumber;
1800
+ }, z.core.$strip>;
1801
+ response: z.ZodObject<{
1802
+ success: z.ZodBoolean;
1803
+ }, z.core.$strip>;
1804
+ };
1805
+ /**
1806
+ * Atomically record an installed version and optionally mark it active.
1807
+ *
1808
+ * Used by successful install/update jobs so storage never commits a version
1809
+ * row without the requested active pointer update.
1810
+ */
1811
+ recordInstalledVersion: {
1812
+ request: z.ZodObject<{
1813
+ versionRecord: z.ZodObject<{
1814
+ id: z.ZodString;
1815
+ clientId: z.ZodString;
1816
+ version: z.ZodString;
1817
+ installPath: z.ZodString;
1818
+ installedAt: z.ZodNumber;
1819
+ createdAt: z.ZodNumber;
1820
+ }, z.core.$strip>;
1821
+ makeActive: z.ZodBoolean;
1822
+ updatedAt: z.ZodNumber;
1823
+ }, z.core.$strip>;
1824
+ response: z.ZodObject<{
1825
+ previousActiveVersion: z.ZodNullable<z.ZodString>;
1826
+ activeVersion: z.ZodNullable<z.ZodString>;
1827
+ }, z.core.$strip>;
1828
+ }; /** Return all installed-version rows for a given client. */
1829
+ listVersions: {
1830
+ request: z.ZodObject<{
1831
+ clientId: z.ZodString;
1832
+ }, z.core.$strip>;
1833
+ response: z.ZodObject<{
1834
+ versions: z.ZodArray<z.ZodObject<{
1835
+ id: z.ZodString;
1836
+ clientId: z.ZodString;
1837
+ version: z.ZodString;
1838
+ installPath: z.ZodString;
1839
+ installedAt: z.ZodNumber;
1840
+ createdAt: z.ZodNumber;
1841
+ }, z.core.$strip>>;
1842
+ }, z.core.$strip>;
1843
+ };
1844
+ /**
1845
+ * Return a single-client state + installed-version snapshot from one storage
1846
+ * read boundary.
1847
+ */
1848
+ getSnapshot: {
1849
+ request: z.ZodObject<{
1850
+ clientId: z.ZodString;
1851
+ }, z.core.$strip>;
1852
+ response: z.ZodObject<{
1853
+ state: z.ZodNullable<z.ZodObject<{
1854
+ clientId: z.ZodString;
1855
+ activeVersion: z.ZodNullable<z.ZodString>;
1856
+ updatedAt: z.ZodNumber;
1857
+ }, z.core.$strip>>;
1858
+ versions: z.ZodArray<z.ZodObject<{
1859
+ id: z.ZodString;
1860
+ clientId: z.ZodString;
1861
+ version: z.ZodString;
1862
+ installPath: z.ZodString;
1863
+ installedAt: z.ZodNumber;
1864
+ createdAt: z.ZodNumber;
1865
+ }, z.core.$strip>>;
1866
+ }, z.core.$strip>;
1867
+ }; /** Return all installed-version rows across every client (used for boot hydration). */
1868
+ loadAllVersions: {
1869
+ request: z.ZodObject<{}, z.core.$strip>;
1870
+ response: z.ZodObject<{
1871
+ versions: z.ZodArray<z.ZodObject<{
1872
+ id: z.ZodString;
1873
+ clientId: z.ZodString;
1874
+ version: z.ZodString;
1875
+ installPath: z.ZodString;
1876
+ installedAt: z.ZodNumber;
1877
+ createdAt: z.ZodNumber;
1878
+ }, z.core.$strip>>;
1879
+ }, z.core.$strip>;
1880
+ }; /** Upsert the per-client binary state row. */
1881
+ upsertState: {
1882
+ request: z.ZodObject<{
1883
+ clientId: z.ZodString;
1884
+ activeVersion: z.ZodNullable<z.ZodString>;
1885
+ updatedAt: z.ZodNumber;
1886
+ }, z.core.$strip>;
1887
+ response: z.ZodObject<{
1888
+ success: z.ZodBoolean;
1889
+ }, z.core.$strip>;
1890
+ };
1891
+ /**
1892
+ * Set the active version, creating a state row when one does not exist yet.
1893
+ */
1894
+ setActiveVersion: {
1895
+ request: z.ZodObject<{
1896
+ clientId: z.ZodString;
1897
+ activeVersion: z.ZodNullable<z.ZodString>;
1898
+ updatedAt: z.ZodNumber;
1899
+ }, z.core.$strip>;
1900
+ response: z.ZodObject<{
1901
+ previousActiveVersion: z.ZodNullable<z.ZodString>;
1902
+ activeVersion: z.ZodNullable<z.ZodString>;
1903
+ }, z.core.$strip>;
1904
+ }; /** Return the per-client binary state row, or `null` when it does not exist. */
1905
+ getState: {
1906
+ request: z.ZodObject<{
1907
+ clientId: z.ZodString;
1908
+ }, z.core.$strip>;
1909
+ response: z.ZodObject<{
1910
+ state: z.ZodNullable<z.ZodObject<{
1911
+ clientId: z.ZodString;
1912
+ activeVersion: z.ZodNullable<z.ZodString>;
1913
+ updatedAt: z.ZodNumber;
1914
+ }, z.core.$strip>>;
1915
+ }, z.core.$strip>;
1916
+ }; /** Return the state rows for all clients (used for boot hydration). */
1917
+ loadAllState: {
1918
+ request: z.ZodObject<{}, z.core.$strip>;
1919
+ response: z.ZodObject<{
1920
+ states: z.ZodArray<z.ZodObject<{
1921
+ clientId: z.ZodString;
1922
+ activeVersion: z.ZodNullable<z.ZodString>;
1923
+ updatedAt: z.ZodNumber;
1924
+ }, z.core.$strip>>;
1925
+ }, z.core.$strip>;
1926
+ }; /** Return all state and installed-version rows from one storage read boundary. */
1927
+ loadSnapshot: {
1928
+ request: z.ZodObject<{}, z.core.$strip>;
1929
+ response: z.ZodObject<{
1930
+ states: z.ZodArray<z.ZodObject<{
1931
+ clientId: z.ZodString;
1932
+ activeVersion: z.ZodNullable<z.ZodString>;
1933
+ updatedAt: z.ZodNumber;
1934
+ }, z.core.$strip>>;
1935
+ versions: z.ZodArray<z.ZodObject<{
1936
+ id: z.ZodString;
1937
+ clientId: z.ZodString;
1938
+ version: z.ZodString;
1939
+ installPath: z.ZodString;
1940
+ installedAt: z.ZodNumber;
1941
+ createdAt: z.ZodNumber;
1942
+ }, z.core.$strip>>;
1943
+ }, z.core.$strip>;
1944
+ };
1945
+ /**
1946
+ * Atomically remove an installed-version row and clear the active-version
1947
+ * pointer when it currently points to the deleted version.
1948
+ *
1949
+ * Both operations are executed inside a single SQLite transaction so that
1950
+ * concurrent reads never observe a state where the version row is absent but
1951
+ * the active pointer still references it.
1952
+ */
1953
+ removeVersionAndClearActive: {
1954
+ request: z.ZodObject<{
1955
+ clientId: z.ZodString;
1956
+ version: z.ZodString;
1957
+ updatedAt: z.ZodNumber;
1958
+ }, z.core.$strip>;
1959
+ response: z.ZodObject<{
1960
+ previousActiveVersion: z.ZodNullable<z.ZodString>;
1961
+ activeVersion: z.ZodNullable<z.ZodString>;
1962
+ removedVersion: z.ZodNullable<z.ZodString>;
1963
+ }, z.core.$strip>;
1964
+ };
1965
+ }>;
1966
+ /** Typed bus subjects for client binary storage. */
1967
+ declare const ClientBinaryStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.FlatSubjectDefinitions<"client-binary:storage", {
1968
+ /** Insert a new installed-version row. */insertVersion: {
1969
+ request: z.ZodObject<{
1970
+ id: z.ZodString;
1971
+ clientId: z.ZodString;
1972
+ version: z.ZodString;
1973
+ installPath: z.ZodString;
1974
+ installedAt: z.ZodNumber;
1975
+ createdAt: z.ZodNumber;
1976
+ }, z.core.$strip>;
1977
+ response: z.ZodObject<{
1978
+ success: z.ZodBoolean;
1979
+ }, z.core.$strip>;
1980
+ };
1981
+ /**
1982
+ * Atomically record an installed version and optionally mark it active.
1983
+ *
1984
+ * Used by successful install/update jobs so storage never commits a version
1985
+ * row without the requested active pointer update.
1986
+ */
1987
+ recordInstalledVersion: {
1988
+ request: z.ZodObject<{
1989
+ versionRecord: z.ZodObject<{
1990
+ id: z.ZodString;
1991
+ clientId: z.ZodString;
1992
+ version: z.ZodString;
1993
+ installPath: z.ZodString;
1994
+ installedAt: z.ZodNumber;
1995
+ createdAt: z.ZodNumber;
1996
+ }, z.core.$strip>;
1997
+ makeActive: z.ZodBoolean;
1998
+ updatedAt: z.ZodNumber;
1999
+ }, z.core.$strip>;
2000
+ response: z.ZodObject<{
2001
+ previousActiveVersion: z.ZodNullable<z.ZodString>;
2002
+ activeVersion: z.ZodNullable<z.ZodString>;
2003
+ }, z.core.$strip>;
2004
+ }; /** Return all installed-version rows for a given client. */
2005
+ listVersions: {
2006
+ request: z.ZodObject<{
2007
+ clientId: z.ZodString;
2008
+ }, z.core.$strip>;
2009
+ response: z.ZodObject<{
2010
+ versions: z.ZodArray<z.ZodObject<{
2011
+ id: z.ZodString;
2012
+ clientId: z.ZodString;
2013
+ version: z.ZodString;
2014
+ installPath: z.ZodString;
2015
+ installedAt: z.ZodNumber;
2016
+ createdAt: z.ZodNumber;
2017
+ }, z.core.$strip>>;
2018
+ }, z.core.$strip>;
2019
+ };
2020
+ /**
2021
+ * Return a single-client state + installed-version snapshot from one storage
2022
+ * read boundary.
2023
+ */
2024
+ getSnapshot: {
2025
+ request: z.ZodObject<{
2026
+ clientId: z.ZodString;
2027
+ }, z.core.$strip>;
2028
+ response: z.ZodObject<{
2029
+ state: z.ZodNullable<z.ZodObject<{
2030
+ clientId: z.ZodString;
2031
+ activeVersion: z.ZodNullable<z.ZodString>;
2032
+ updatedAt: z.ZodNumber;
2033
+ }, z.core.$strip>>;
2034
+ versions: z.ZodArray<z.ZodObject<{
2035
+ id: z.ZodString;
2036
+ clientId: z.ZodString;
2037
+ version: z.ZodString;
2038
+ installPath: z.ZodString;
2039
+ installedAt: z.ZodNumber;
2040
+ createdAt: z.ZodNumber;
2041
+ }, z.core.$strip>>;
2042
+ }, z.core.$strip>;
2043
+ }; /** Return all installed-version rows across every client (used for boot hydration). */
2044
+ loadAllVersions: {
2045
+ request: z.ZodObject<{}, z.core.$strip>;
2046
+ response: z.ZodObject<{
2047
+ versions: z.ZodArray<z.ZodObject<{
2048
+ id: z.ZodString;
2049
+ clientId: z.ZodString;
2050
+ version: z.ZodString;
2051
+ installPath: z.ZodString;
2052
+ installedAt: z.ZodNumber;
2053
+ createdAt: z.ZodNumber;
2054
+ }, z.core.$strip>>;
2055
+ }, z.core.$strip>;
2056
+ }; /** Upsert the per-client binary state row. */
2057
+ upsertState: {
2058
+ request: z.ZodObject<{
2059
+ clientId: z.ZodString;
2060
+ activeVersion: z.ZodNullable<z.ZodString>;
2061
+ updatedAt: z.ZodNumber;
2062
+ }, z.core.$strip>;
2063
+ response: z.ZodObject<{
2064
+ success: z.ZodBoolean;
2065
+ }, z.core.$strip>;
2066
+ };
2067
+ /**
2068
+ * Set the active version, creating a state row when one does not exist yet.
2069
+ */
2070
+ setActiveVersion: {
2071
+ request: z.ZodObject<{
2072
+ clientId: z.ZodString;
2073
+ activeVersion: z.ZodNullable<z.ZodString>;
2074
+ updatedAt: z.ZodNumber;
2075
+ }, z.core.$strip>;
2076
+ response: z.ZodObject<{
2077
+ previousActiveVersion: z.ZodNullable<z.ZodString>;
2078
+ activeVersion: z.ZodNullable<z.ZodString>;
2079
+ }, z.core.$strip>;
2080
+ }; /** Return the per-client binary state row, or `null` when it does not exist. */
2081
+ getState: {
2082
+ request: z.ZodObject<{
2083
+ clientId: z.ZodString;
2084
+ }, z.core.$strip>;
2085
+ response: z.ZodObject<{
2086
+ state: z.ZodNullable<z.ZodObject<{
2087
+ clientId: z.ZodString;
2088
+ activeVersion: z.ZodNullable<z.ZodString>;
2089
+ updatedAt: z.ZodNumber;
2090
+ }, z.core.$strip>>;
2091
+ }, z.core.$strip>;
2092
+ }; /** Return the state rows for all clients (used for boot hydration). */
2093
+ loadAllState: {
2094
+ request: z.ZodObject<{}, z.core.$strip>;
2095
+ response: z.ZodObject<{
2096
+ states: z.ZodArray<z.ZodObject<{
2097
+ clientId: z.ZodString;
2098
+ activeVersion: z.ZodNullable<z.ZodString>;
2099
+ updatedAt: z.ZodNumber;
2100
+ }, z.core.$strip>>;
2101
+ }, z.core.$strip>;
2102
+ }; /** Return all state and installed-version rows from one storage read boundary. */
2103
+ loadSnapshot: {
2104
+ request: z.ZodObject<{}, z.core.$strip>;
2105
+ response: z.ZodObject<{
2106
+ states: z.ZodArray<z.ZodObject<{
2107
+ clientId: z.ZodString;
2108
+ activeVersion: z.ZodNullable<z.ZodString>;
2109
+ updatedAt: z.ZodNumber;
2110
+ }, z.core.$strip>>;
2111
+ versions: z.ZodArray<z.ZodObject<{
2112
+ id: z.ZodString;
2113
+ clientId: z.ZodString;
2114
+ version: z.ZodString;
2115
+ installPath: z.ZodString;
2116
+ installedAt: z.ZodNumber;
2117
+ createdAt: z.ZodNumber;
2118
+ }, z.core.$strip>>;
2119
+ }, z.core.$strip>;
2120
+ };
2121
+ /**
2122
+ * Atomically remove an installed-version row and clear the active-version
2123
+ * pointer when it currently points to the deleted version.
2124
+ *
2125
+ * Both operations are executed inside a single SQLite transaction so that
2126
+ * concurrent reads never observe a state where the version row is absent but
2127
+ * the active pointer still references it.
2128
+ */
2129
+ removeVersionAndClearActive: {
2130
+ request: z.ZodObject<{
2131
+ clientId: z.ZodString;
2132
+ version: z.ZodString;
2133
+ updatedAt: z.ZodNumber;
2134
+ }, z.core.$strip>;
2135
+ response: z.ZodObject<{
2136
+ previousActiveVersion: z.ZodNullable<z.ZodString>;
2137
+ activeVersion: z.ZodNullable<z.ZodString>;
2138
+ removedVersion: z.ZodNullable<z.ZodString>;
2139
+ }, z.core.$strip>;
2140
+ };
2141
+ }>, "client-binary:storage">;
2142
+ /** Persisted installed-version record as exchanged over the bus. */
2143
+ type ClientBinaryVersionRecord = z.infer<typeof ClientBinaryVersionRecordSchema>;
2144
+ /** Per-client binary state record as exchanged over the bus. */
2145
+ type ClientBinaryStateRecord = z.infer<typeof ClientBinaryStateRecordSchema>;
2146
+ //#endregion
2147
+ //#region subsystems/client/src/storage/runtime-storage-namespace.d.ts
2148
+ /**
2149
+ * Zod schema for a fully-populated runtime record transported over the bus.
2150
+ *
2151
+ * Mirrors {@link ClientRuntimeRecord} with explicit Zod types so the bus can
2152
+ * validate payloads at runtime.
2153
+ */
2154
+ declare const RuntimeRecordSchema: z.ZodObject<{
2155
+ clientRuntimeId: z.ZodString;
2156
+ clientId: z.ZodString;
2157
+ status: z.ZodEnum<{
2158
+ started: "started";
2159
+ observed: "observed";
2160
+ }>;
2161
+ supervisorSessionId: z.ZodOptional<z.ZodString>;
2162
+ pid: z.ZodOptional<z.ZodNumber>;
2163
+ parentPid: z.ZodOptional<z.ZodNumber>;
2164
+ adapterSessionId: z.ZodOptional<z.ZodString>;
2165
+ sessionId: z.ZodOptional<z.ZodString>;
2166
+ cwd: z.ZodOptional<z.ZodString>;
2167
+ argv: z.ZodOptional<z.ZodArray<z.ZodString>>;
2168
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2169
+ observedAt: z.ZodNumber;
2170
+ createdAt: z.ZodNumber;
2171
+ updatedAt: z.ZodNumber;
2172
+ }, z.core.$strip>;
2173
+ /**
2174
+ * Internal bus namespace for client runtime storage operations.
2175
+ *
2176
+ * Subjects registered here are consumed exclusively by the Drizzle handler
2177
+ * and the registry — they are not part of the public `client.*` namespace.
2178
+ */
2179
+ declare const ClientRuntimeStorageNamespace: _$_makaio_core0.BusNamespaceDefinition<"client-runtime:storage", {
2180
+ upsert: {
2181
+ request: z.ZodObject<{
2182
+ clientRuntimeId: z.ZodString;
2183
+ clientId: z.ZodString;
2184
+ status: z.ZodEnum<{
2185
+ started: "started";
2186
+ observed: "observed";
2187
+ }>;
2188
+ supervisorSessionId: z.ZodOptional<z.ZodString>;
2189
+ pid: z.ZodOptional<z.ZodNumber>;
2190
+ parentPid: z.ZodOptional<z.ZodNumber>;
2191
+ adapterSessionId: z.ZodOptional<z.ZodString>;
2192
+ sessionId: z.ZodOptional<z.ZodString>;
2193
+ cwd: z.ZodOptional<z.ZodString>;
2194
+ argv: z.ZodOptional<z.ZodArray<z.ZodString>>;
2195
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2196
+ observedAt: z.ZodNumber;
2197
+ createdAt: z.ZodNumber;
2198
+ updatedAt: z.ZodNumber;
2199
+ }, z.core.$strip>;
2200
+ response: z.ZodObject<{
2201
+ success: z.ZodBoolean;
2202
+ }, z.core.$strip>;
2203
+ };
2204
+ loadAll: {
2205
+ request: z.ZodObject<{}, z.core.$strip>;
2206
+ response: z.ZodObject<{
2207
+ records: z.ZodArray<z.ZodObject<{
2208
+ clientRuntimeId: z.ZodString;
2209
+ clientId: z.ZodString;
2210
+ status: z.ZodEnum<{
2211
+ started: "started";
2212
+ observed: "observed";
2213
+ }>;
2214
+ supervisorSessionId: z.ZodOptional<z.ZodString>;
2215
+ pid: z.ZodOptional<z.ZodNumber>;
2216
+ parentPid: z.ZodOptional<z.ZodNumber>;
2217
+ adapterSessionId: z.ZodOptional<z.ZodString>;
2218
+ sessionId: z.ZodOptional<z.ZodString>;
2219
+ cwd: z.ZodOptional<z.ZodString>;
2220
+ argv: z.ZodOptional<z.ZodArray<z.ZodString>>;
2221
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2222
+ observedAt: z.ZodNumber;
2223
+ createdAt: z.ZodNumber;
2224
+ updatedAt: z.ZodNumber;
2225
+ }, z.core.$strip>>;
2226
+ }, z.core.$strip>;
2227
+ };
2228
+ }>;
2229
+ /** Typed bus subjects for client runtime storage. */
2230
+ declare const ClientRuntimeStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.FlatSubjectDefinitions<"client-runtime:storage", {
2231
+ upsert: {
2232
+ request: z.ZodObject<{
2233
+ clientRuntimeId: z.ZodString;
2234
+ clientId: z.ZodString;
2235
+ status: z.ZodEnum<{
2236
+ started: "started";
2237
+ observed: "observed";
2238
+ }>;
2239
+ supervisorSessionId: z.ZodOptional<z.ZodString>;
2240
+ pid: z.ZodOptional<z.ZodNumber>;
2241
+ parentPid: z.ZodOptional<z.ZodNumber>;
2242
+ adapterSessionId: z.ZodOptional<z.ZodString>;
2243
+ sessionId: z.ZodOptional<z.ZodString>;
2244
+ cwd: z.ZodOptional<z.ZodString>;
2245
+ argv: z.ZodOptional<z.ZodArray<z.ZodString>>;
2246
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2247
+ observedAt: z.ZodNumber;
2248
+ createdAt: z.ZodNumber;
2249
+ updatedAt: z.ZodNumber;
2250
+ }, z.core.$strip>;
2251
+ response: z.ZodObject<{
2252
+ success: z.ZodBoolean;
2253
+ }, z.core.$strip>;
2254
+ };
2255
+ loadAll: {
2256
+ request: z.ZodObject<{}, z.core.$strip>;
2257
+ response: z.ZodObject<{
2258
+ records: z.ZodArray<z.ZodObject<{
2259
+ clientRuntimeId: z.ZodString;
2260
+ clientId: z.ZodString;
2261
+ status: z.ZodEnum<{
2262
+ started: "started";
2263
+ observed: "observed";
2264
+ }>;
2265
+ supervisorSessionId: z.ZodOptional<z.ZodString>;
2266
+ pid: z.ZodOptional<z.ZodNumber>;
2267
+ parentPid: z.ZodOptional<z.ZodNumber>;
2268
+ adapterSessionId: z.ZodOptional<z.ZodString>;
2269
+ sessionId: z.ZodOptional<z.ZodString>;
2270
+ cwd: z.ZodOptional<z.ZodString>;
2271
+ argv: z.ZodOptional<z.ZodArray<z.ZodString>>;
2272
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2273
+ observedAt: z.ZodNumber;
2274
+ createdAt: z.ZodNumber;
2275
+ updatedAt: z.ZodNumber;
2276
+ }, z.core.$strip>>;
2277
+ }, z.core.$strip>;
2278
+ };
2279
+ }>, "client-runtime:storage">;
2280
+ //#endregion
2281
+ //#region subsystems/client/src/storage/profile-storage-namespace.d.ts
2282
+ /**
2283
+ * Zod schema for a persisted client profile record transported over the bus.
2284
+ *
2285
+ * Reuses {@link ClientProfileSchema} from contracts so the storage namespace
2286
+ * and the public client contract share a single source of truth.
2287
+ */
2288
+ declare const ClientProfileRecordSchema: z.ZodObject<{
2289
+ id: z.ZodString;
2290
+ clientId: z.ZodString;
2291
+ name: z.ZodString;
2292
+ description: z.ZodNullable<z.ZodString>;
2293
+ configDir: z.ZodString;
2294
+ isDefault: z.ZodBoolean;
2295
+ createdAt: z.ZodNumber;
2296
+ updatedAt: z.ZodNumber;
2297
+ }, z.core.$strip>;
2298
+ /**
2299
+ * Internal bus namespace for client profile storage operations.
2300
+ *
2301
+ * Subjects registered here are consumed exclusively by the Drizzle handler
2302
+ * and the profile manager — they are not part of the public `client.*` namespace.
2303
+ */
2304
+ declare const ClientProfileStorageNamespace: _$_makaio_core0.BusNamespaceDefinition<"client-profile:storage", {
2305
+ /** Return a single profile record identified by `(clientId, name)`, or `null` when not found. */get: {
2306
+ request: z.ZodObject<{
2307
+ clientId: z.ZodString;
2308
+ name: z.ZodString;
2309
+ }, z.core.$strip>;
2310
+ response: z.ZodObject<{
2311
+ record: z.ZodNullable<z.ZodObject<{
2312
+ id: z.ZodString;
2313
+ clientId: z.ZodString;
2314
+ name: z.ZodString;
2315
+ description: z.ZodNullable<z.ZodString>;
2316
+ configDir: z.ZodString;
2317
+ isDefault: z.ZodBoolean;
2318
+ createdAt: z.ZodNumber;
2319
+ updatedAt: z.ZodNumber;
2320
+ }, z.core.$strip>>;
2321
+ }, z.core.$strip>;
2322
+ }; /** Return a single profile record by its stable row ID, or `null` when not found. */
2323
+ getById: {
2324
+ request: z.ZodObject<{
2325
+ id: z.ZodString;
2326
+ }, z.core.$strip>;
2327
+ response: z.ZodObject<{
2328
+ record: z.ZodNullable<z.ZodObject<{
2329
+ id: z.ZodString;
2330
+ clientId: z.ZodString;
2331
+ name: z.ZodString;
2332
+ description: z.ZodNullable<z.ZodString>;
2333
+ configDir: z.ZodString;
2334
+ isDefault: z.ZodBoolean;
2335
+ createdAt: z.ZodNumber;
2336
+ updatedAt: z.ZodNumber;
2337
+ }, z.core.$strip>>;
2338
+ }, z.core.$strip>;
2339
+ }; /** Return all profile records for a given client. */
2340
+ list: {
2341
+ request: z.ZodObject<{
2342
+ clientId: z.ZodString;
2343
+ }, z.core.$strip>;
2344
+ response: z.ZodObject<{
2345
+ records: z.ZodArray<z.ZodObject<{
2346
+ id: z.ZodString;
2347
+ clientId: z.ZodString;
2348
+ name: z.ZodString;
2349
+ description: z.ZodNullable<z.ZodString>;
2350
+ configDir: z.ZodString;
2351
+ isDefault: z.ZodBoolean;
2352
+ createdAt: z.ZodNumber;
2353
+ updatedAt: z.ZodNumber;
2354
+ }, z.core.$strip>>;
2355
+ }, z.core.$strip>;
2356
+ };
2357
+ /**
2358
+ * Insert or update a profile record identified by its stable row ID.
2359
+ *
2360
+ * On conflict, all mutable fields (`name`, `description`, `configDir`,
2361
+ * `isDefault`, `updatedAt`) are overwritten. `createdAt` is preserved on
2362
+ * subsequent upserts.
2363
+ */
2364
+ set: {
2365
+ request: z.ZodObject<{
2366
+ id: z.ZodString;
2367
+ clientId: z.ZodString;
2368
+ name: z.ZodString;
2369
+ description: z.ZodNullable<z.ZodString>;
2370
+ configDir: z.ZodString;
2371
+ isDefault: z.ZodBoolean;
2372
+ createdAt: z.ZodNumber;
2373
+ updatedAt: z.ZodNumber;
2374
+ }, z.core.$strip>;
2375
+ response: z.ZodObject<{
2376
+ success: z.ZodBoolean;
2377
+ }, z.core.$strip>;
2378
+ };
2379
+ /**
2380
+ * Delete the profile record identified by `(clientId, name)`.
2381
+ *
2382
+ * Returns `{ success: true }` when a row was deleted and
2383
+ * `{ success: false }` when no matching row was found.
2384
+ */
2385
+ delete: {
2386
+ request: z.ZodObject<{
2387
+ clientId: z.ZodString;
2388
+ name: z.ZodString;
2389
+ }, z.core.$strip>;
2390
+ response: z.ZodObject<{
2391
+ success: z.ZodBoolean;
2392
+ }, z.core.$strip>;
2393
+ };
2394
+ /**
2395
+ * Clear the `isDefault` flag on all profiles for a given client.
2396
+ *
2397
+ * Low-level maintenance operation. Normal default promotion must use
2398
+ * `setDefault` so clearing and promotion share one storage transaction.
2399
+ */
2400
+ clearDefault: {
2401
+ request: z.ZodObject<{
2402
+ clientId: z.ZodString;
2403
+ }, z.core.$strip>;
2404
+ response: z.ZodObject<{
2405
+ success: z.ZodBoolean;
2406
+ }, z.core.$strip>;
2407
+ };
2408
+ /**
2409
+ * Atomically promote one profile to default and clear the previous default.
2410
+ */
2411
+ setDefault: {
2412
+ request: z.ZodObject<{
2413
+ clientId: z.ZodString;
2414
+ name: z.ZodString;
2415
+ }, z.core.$strip>;
2416
+ response: z.ZodObject<{
2417
+ record: z.ZodNullable<z.ZodObject<{
2418
+ id: z.ZodString;
2419
+ clientId: z.ZodString;
2420
+ name: z.ZodString;
2421
+ description: z.ZodNullable<z.ZodString>;
2422
+ configDir: z.ZodString;
2423
+ isDefault: z.ZodBoolean;
2424
+ createdAt: z.ZodNumber;
2425
+ updatedAt: z.ZodNumber;
2426
+ }, z.core.$strip>>;
2427
+ }, z.core.$strip>;
2428
+ };
2429
+ }>;
2430
+ /** Typed bus subjects for client profile storage. */
2431
+ declare const ClientProfileStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.FlatSubjectDefinitions<"client-profile:storage", {
2432
+ /** Return a single profile record identified by `(clientId, name)`, or `null` when not found. */get: {
2433
+ request: z.ZodObject<{
2434
+ clientId: z.ZodString;
2435
+ name: z.ZodString;
2436
+ }, z.core.$strip>;
2437
+ response: z.ZodObject<{
2438
+ record: z.ZodNullable<z.ZodObject<{
2439
+ id: z.ZodString;
2440
+ clientId: z.ZodString;
2441
+ name: z.ZodString;
2442
+ description: z.ZodNullable<z.ZodString>;
2443
+ configDir: z.ZodString;
2444
+ isDefault: z.ZodBoolean;
2445
+ createdAt: z.ZodNumber;
2446
+ updatedAt: z.ZodNumber;
2447
+ }, z.core.$strip>>;
2448
+ }, z.core.$strip>;
2449
+ }; /** Return a single profile record by its stable row ID, or `null` when not found. */
2450
+ getById: {
2451
+ request: z.ZodObject<{
2452
+ id: z.ZodString;
2453
+ }, z.core.$strip>;
2454
+ response: z.ZodObject<{
2455
+ record: z.ZodNullable<z.ZodObject<{
2456
+ id: z.ZodString;
2457
+ clientId: z.ZodString;
2458
+ name: z.ZodString;
2459
+ description: z.ZodNullable<z.ZodString>;
2460
+ configDir: z.ZodString;
2461
+ isDefault: z.ZodBoolean;
2462
+ createdAt: z.ZodNumber;
2463
+ updatedAt: z.ZodNumber;
2464
+ }, z.core.$strip>>;
2465
+ }, z.core.$strip>;
2466
+ }; /** Return all profile records for a given client. */
2467
+ list: {
2468
+ request: z.ZodObject<{
2469
+ clientId: z.ZodString;
2470
+ }, z.core.$strip>;
2471
+ response: z.ZodObject<{
2472
+ records: z.ZodArray<z.ZodObject<{
2473
+ id: z.ZodString;
2474
+ clientId: z.ZodString;
2475
+ name: z.ZodString;
2476
+ description: z.ZodNullable<z.ZodString>;
2477
+ configDir: z.ZodString;
2478
+ isDefault: z.ZodBoolean;
2479
+ createdAt: z.ZodNumber;
2480
+ updatedAt: z.ZodNumber;
2481
+ }, z.core.$strip>>;
2482
+ }, z.core.$strip>;
2483
+ };
2484
+ /**
2485
+ * Insert or update a profile record identified by its stable row ID.
2486
+ *
2487
+ * On conflict, all mutable fields (`name`, `description`, `configDir`,
2488
+ * `isDefault`, `updatedAt`) are overwritten. `createdAt` is preserved on
2489
+ * subsequent upserts.
2490
+ */
2491
+ set: {
2492
+ request: z.ZodObject<{
2493
+ id: z.ZodString;
2494
+ clientId: z.ZodString;
2495
+ name: z.ZodString;
2496
+ description: z.ZodNullable<z.ZodString>;
2497
+ configDir: z.ZodString;
2498
+ isDefault: z.ZodBoolean;
2499
+ createdAt: z.ZodNumber;
2500
+ updatedAt: z.ZodNumber;
2501
+ }, z.core.$strip>;
2502
+ response: z.ZodObject<{
2503
+ success: z.ZodBoolean;
2504
+ }, z.core.$strip>;
2505
+ };
2506
+ /**
2507
+ * Delete the profile record identified by `(clientId, name)`.
2508
+ *
2509
+ * Returns `{ success: true }` when a row was deleted and
2510
+ * `{ success: false }` when no matching row was found.
2511
+ */
2512
+ delete: {
2513
+ request: z.ZodObject<{
2514
+ clientId: z.ZodString;
2515
+ name: z.ZodString;
2516
+ }, z.core.$strip>;
2517
+ response: z.ZodObject<{
2518
+ success: z.ZodBoolean;
2519
+ }, z.core.$strip>;
2520
+ };
2521
+ /**
2522
+ * Clear the `isDefault` flag on all profiles for a given client.
2523
+ *
2524
+ * Low-level maintenance operation. Normal default promotion must use
2525
+ * `setDefault` so clearing and promotion share one storage transaction.
2526
+ */
2527
+ clearDefault: {
2528
+ request: z.ZodObject<{
2529
+ clientId: z.ZodString;
2530
+ }, z.core.$strip>;
2531
+ response: z.ZodObject<{
2532
+ success: z.ZodBoolean;
2533
+ }, z.core.$strip>;
2534
+ };
2535
+ /**
2536
+ * Atomically promote one profile to default and clear the previous default.
2537
+ */
2538
+ setDefault: {
2539
+ request: z.ZodObject<{
2540
+ clientId: z.ZodString;
2541
+ name: z.ZodString;
2542
+ }, z.core.$strip>;
2543
+ response: z.ZodObject<{
2544
+ record: z.ZodNullable<z.ZodObject<{
2545
+ id: z.ZodString;
2546
+ clientId: z.ZodString;
2547
+ name: z.ZodString;
2548
+ description: z.ZodNullable<z.ZodString>;
2549
+ configDir: z.ZodString;
2550
+ isDefault: z.ZodBoolean;
2551
+ createdAt: z.ZodNumber;
2552
+ updatedAt: z.ZodNumber;
2553
+ }, z.core.$strip>>;
2554
+ }, z.core.$strip>;
2555
+ };
2556
+ }>, "client-profile:storage">;
2557
+ /** Persisted client profile record as exchanged over the bus. */
2558
+ type ClientProfileRecord = z.infer<typeof ClientProfileRecordSchema>;
2559
+ //#endregion
2560
+ //#region subsystems/client/src/resolve-client-binary.d.ts
2561
+ /**
2562
+ * Resolve the execution context for a client binary via the bus.
2563
+ *
2564
+ * Uses `requestOptional` so the adapter continues to function in
2565
+ * framework-only boot where no `client.resolveBinary` handler is registered.
2566
+ * In that case `undefined` is returned and callers fall back to PATH lookup.
2567
+ * @param clientId - Stable client identifier to resolve (e.g. `'claude-code'`)
2568
+ * @returns Resolved execution context (source `'managed'` or `'global'`), or
2569
+ * `undefined` when no `client.resolveBinary` handler is registered
2570
+ * (framework-only boot)
2571
+ */
2572
+ declare function resolveClientBinary(clientId: string): Promise<ClientExecutionContext | undefined>;
2573
+ //#endregion
2574
+ //#region subsystems/client/src/wiring-helpers.d.ts
2575
+ /**
2576
+ * Minimal descriptor for a single session-event wiring entry.
2577
+ *
2578
+ * Produced by {@link deriveSessionEventDescriptors} and consumed by the
2579
+ * per-client `buildWiringList`, `applyWiring`, and `removeWiring` functions to
2580
+ * iterate over the events that need hook installation.
2581
+ */
2582
+ interface SessionEventDescriptor {
2583
+ /** Native event name as declared in the client definition (e.g. `'SessionStart'`). */
2584
+ readonly eventName: string;
2585
+ /**
2586
+ * Hook interaction mode for this event.
2587
+ *
2588
+ * - `'event'` — fire-and-forget: install `makaio hook received ...`
2589
+ * - `'request'` — request/response: install `makaio hook handle ...`
2590
+ */
2591
+ readonly mode: 'event' | 'request';
2592
+ }
2593
+ /**
2594
+ * Build a shell-safe client command string from an executable and argv tokens.
2595
+ *
2596
+ * Native client settings store command strings rather than argv arrays, so the
2597
+ * executable and arguments must be rendered with shell quoting before they are
2598
+ * persisted.
2599
+ *
2600
+ * When `envPairs` is provided, each `KEY=value` string is prepended before the
2601
+ * executable as inline environment variable assignments — the standard POSIX
2602
+ * shell pattern for per-command env overrides.
2603
+ * @param makaioCommand - Makaio CLI binary name or absolute path.
2604
+ * @param args - Argument tokens appended after the Makaio command.
2605
+ * @param envPairs - Optional `KEY=value` pairs prepended before the executable.
2606
+ * @returns Shell-safe command string.
2607
+ */
2608
+ declare function buildClientCommand(makaioCommand: string, args: readonly string[], envPairs?: readonly string[]): string;
2609
+ /**
2610
+ * Build the full hook command string for a single session-event wiring entry.
2611
+ *
2612
+ * The resulting command takes the form:
2613
+ * `[envPairs...] <makaioCommand> <sentinel> <eventName>`
2614
+ *
2615
+ * For example, given `'makaio'`, `'hook received claude-code'`, `'SessionStart'`
2616
+ * the function returns `'makaio hook received claude-code SessionStart'`.
2617
+ * @param makaioCommand - Makaio CLI binary name or path (e.g. `'makaio'`).
2618
+ * @param sentinel - Client-specific sentinel string embedded in every Makaio
2619
+ * hook command (e.g. `'hook received claude-code'`).
2620
+ * @param eventName - Native hook event name (e.g. `'SessionStart'`).
2621
+ * @param envPairs - Optional `KEY=value` pairs prepended before the executable.
2622
+ * @param rootFlags - Optional root-level CLI flags inserted between the
2623
+ * executable and the sentinel (e.g. `['--debounce-failure']`).
2624
+ * @returns Full hook command string to write into the client's native config.
2625
+ */
2626
+ declare function buildHookCommand(makaioCommand: string, sentinel: string, eventName: string, envPairs?: readonly string[], rootFlags?: readonly string[]): string;
2627
+ /**
2628
+ * Derive the ordered list of session-event wiring descriptors from a client
2629
+ * definition.
2630
+ *
2631
+ * Only hook events that carry a `frameworkSubject` are included — events
2632
+ * without one are client-internal and do not need framework wiring.
2633
+ * @param clientDefinition - The parsed static client definition whose
2634
+ * `runtimeCapabilities.hookEvents` array is the source of truth.
2635
+ * @returns Read-only array of `{ eventName, mode }` descriptors in declaration order.
2636
+ */
2637
+ declare function deriveSessionEventDescriptors(clientDefinition: ClientDefinition$1): ReadonlyArray<SessionEventDescriptor>;
2638
+ //#endregion
2639
+ export { AbsolutePathSchema, type AtomicContentParser, type AtomicModifier, type AtomicModifyOutcome, BinaryNotFoundError, type BuildClientSessionBaseOpts, CLIENT_RUNTIME_STATUSES, ClientAccountRegistry, type ClientAccountUpsertResult, ClientBinaryJobRunner, ClientBinaryManager, type ClientBinaryManagerConfig, type ClientBinaryStateRecord, ClientBinaryStateRecordSchema, ClientBinaryStorageNamespace, ClientBinaryStorageSubjects, type ClientBinaryVersionRecord, ClientBinaryVersionRecordSchema, ClientBinaryVersionResolver, ClientConfigPrimeService, type ClientDefinitionLookup, ClientDefinitionRegistry, type ClientHookHandleResponse, ClientHookHandleResponseSchema, type ClientNamespaceResult, type ClientProfileRecord, ClientProfileRecordSchema, ClientProfileService, ClientProfileStorageNamespace, ClientProfileStorageSubjects, type ClientRuntimeRecord, ClientRuntimeRegistry, ClientRuntimeService, type ClientRuntimeStatus, ClientRuntimeStorageNamespace, ClientRuntimeStorageSubjects, ClientSessionConfigService, ClientSubjects, type ClientWiringAggregatedResult, ClientWiringAggregatedResultSchema, type ClientWiringApplyResponse, ClientWiringApplyResponseSchema, type ClientWiringEntry, ClientWiringEntrySchema, type ClientWiringListResponse, ClientWiringListResponseSchema, type ClientWiringListSubjectDef, type ClientWiringRemoveResponse, ClientWiringRemoveResponseSchema, type ClientWiringSubjectDefBase, type ClientsCorePackageOptions, ClientsCoreService, ClientsCoreToken, DEFAULT_HOOK_HANDLE_TIMEOUT_MS, type InstallJob, type JobCompletedCallback, type JobCompletionCallback, type JobCompletionResult, type JobProgressCallback, type PostInstallContext, type PostInstallHandler, type RawClientHookHandleSubject, type RawClientHookPayload, RawClientHookPayloadSchema, type RawClientHookReceivedSubject, type ResolvedInstallVersion, RuntimeRecordSchema, type RuntimeUpsertResult, type SessionEventDescriptor, type StrategyDependencies, assertAbsoluteProjectDir, atomicModifyFile, buildClientCommand, buildClientSessionBase, buildHookCommand, canonicalizeClientId, createClientNamespace, createClientWiringListSubjectDef, createClientWiringSubjectDef, createClientsCorePackage, createRawClientHookHandleSubject, createRawClientHookReceivedSubject, deriveSessionEventDescriptors, emitBestEffort, isPathWithinBase, pickNonEmptyString, pickNonEmptyStringValue, registerStorageHandlersWithRollback, resolveAndValidateBasePath, resolveClientBinary };