@makaio/framework 1.0.0-dev-1779046984397

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 (410) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +363 -0
  3. package/dist/account-identity-Ce1Bwrqi.mjs +1 -0
  4. package/dist/adapter-CbyjCE2d.mjs +1 -0
  5. package/dist/adapters/acp-client/index.d.mts +209 -0
  6. package/dist/adapters/acp-client/index.mjs +1 -0
  7. package/dist/adapters/config/index.d.mts +429 -0
  8. package/dist/adapters/config/index.mjs +1 -0
  9. package/dist/adapters/index.d.mts +4175 -0
  10. package/dist/adapters/index.mjs +11 -0
  11. package/dist/adapters/node.d.mts +263 -0
  12. package/dist/adapters/node.mjs +4 -0
  13. package/dist/adapters/stream-session/index.d.mts +1384 -0
  14. package/dist/adapters/stream-session/index.mjs +1 -0
  15. package/dist/adapters/stream-session/testing/index.d.mts +29 -0
  16. package/dist/adapters/stream-session/testing/index.mjs +1 -0
  17. package/dist/base-orchestrator-9z8TuA5a.d.mts +772 -0
  18. package/dist/bus/index.d.mts +3331 -0
  19. package/dist/bus/index.mjs +1 -0
  20. package/dist/bus-B1seC4M_.mjs +2 -0
  21. package/dist/capability-service-tnpR_TaB.mjs +1 -0
  22. package/dist/chunk-Dc06z0qk.mjs +1 -0
  23. package/dist/chunk-cpUYaJdV.mjs +1 -0
  24. package/dist/cleanEnvForAdapter-DvcIGXTG.mjs +1 -0
  25. package/dist/client-Dh4x4GQN.mjs +1 -0
  26. package/dist/clients/index.d.mts +2786 -0
  27. package/dist/clients/index.mjs +1 -0
  28. package/dist/clients-namespace-B0xAPZ6J.d.mts +332 -0
  29. package/dist/config-namespace-DLSs83zr.d.mts +638 -0
  30. package/dist/config-namespace-MJT8P0Ud.mjs +1 -0
  31. package/dist/contracts/adapter/index.d.mts +3 -0
  32. package/dist/contracts/adapter/index.mjs +1 -0
  33. package/dist/contracts/adapter/schemas/session-lineage.d.mts +2 -0
  34. package/dist/contracts/adapter/schemas/session-lineage.mjs +1 -0
  35. package/dist/contracts/client/index.d.mts +3 -0
  36. package/dist/contracts/client/index.mjs +1 -0
  37. package/dist/contracts/common/index.d.mts +2 -0
  38. package/dist/contracts/common/index.mjs +1 -0
  39. package/dist/contracts/config/index.d.mts +455 -0
  40. package/dist/contracts/config/index.mjs +1 -0
  41. package/dist/contracts/extension/index.d.mts +3 -0
  42. package/dist/contracts/extension/index.mjs +1 -0
  43. package/dist/contracts/harness/index.d.mts +2 -0
  44. package/dist/contracts/harness/index.mjs +1 -0
  45. package/dist/contracts/host/index.d.mts +2 -0
  46. package/dist/contracts/host/index.mjs +1 -0
  47. package/dist/contracts/index.d.mts +12665 -0
  48. package/dist/contracts/index.mjs +1 -0
  49. package/dist/contracts/model-registry/index.d.mts +2 -0
  50. package/dist/contracts/model-registry/index.mjs +1 -0
  51. package/dist/contracts/native-session-supervisor/index.d.mts +2 -0
  52. package/dist/contracts/native-session-supervisor/index.mjs +1 -0
  53. package/dist/contracts/platform/index.d.mts +2 -0
  54. package/dist/contracts/platform/index.mjs +1 -0
  55. package/dist/contracts/provider/index.d.mts +3 -0
  56. package/dist/contracts/provider/index.mjs +1 -0
  57. package/dist/contracts/session/index.d.mts +3 -0
  58. package/dist/contracts/session/index.mjs +1 -0
  59. package/dist/contracts/shared/index.d.mts +2 -0
  60. package/dist/contracts/shared/index.mjs +1 -0
  61. package/dist/contracts/skill/index.d.mts +2 -0
  62. package/dist/contracts/skill/index.mjs +1 -0
  63. package/dist/contracts/toast/index.d.mts +198 -0
  64. package/dist/contracts/toast/index.mjs +1 -0
  65. package/dist/contracts/variant/index.d.mts +2 -0
  66. package/dist/contracts/variant/index.mjs +1 -0
  67. package/dist/core/index.d.mts +1001 -0
  68. package/dist/core/index.mjs +1 -0
  69. package/dist/credential-ref-DLCsoKVZ.mjs +1 -0
  70. package/dist/cursor-storage-DOQdvo9j.mjs +1 -0
  71. package/dist/definition-DkYy1PZz.mjs +1 -0
  72. package/dist/definition-DtUNiGom.d.mts +158 -0
  73. package/dist/definition-DxvZ9e22.d.mts +376 -0
  74. package/dist/drizzle-CWVVw7Er.mjs +1 -0
  75. package/dist/execution-target-BW_uiBVe.mjs +1 -0
  76. package/dist/extension-COqwS-2Q.mjs +1 -0
  77. package/dist/extension-Cbrl4YGX.mjs +1 -0
  78. package/dist/extension-namespace-zaGKi6Qj.mjs +1 -0
  79. package/dist/handlers-iGKUJ380.mjs +41 -0
  80. package/dist/harness-CEq1Zkf9.mjs +1 -0
  81. package/dist/hooks/index.d.mts +423 -0
  82. package/dist/hooks/index.mjs +1 -0
  83. package/dist/host-CXAUGGN0.mjs +1 -0
  84. package/dist/identity-B_A0mE63.mjs +1 -0
  85. package/dist/index-6lyShOoU.d.mts +225 -0
  86. package/dist/index-7sXlairn2.d.mts +43 -0
  87. package/dist/index-BAKM2GMH2.d.mts +535 -0
  88. package/dist/index-BB419vv-.d.mts +3897 -0
  89. package/dist/index-BJOfdtbw.d.mts +729 -0
  90. package/dist/index-BXP9GK5q.d.mts +1075 -0
  91. package/dist/index-BdPwu6c0.d.mts +1730 -0
  92. package/dist/index-BePI0ckL.d.mts +40 -0
  93. package/dist/index-Bigx81Kr.d.mts +37 -0
  94. package/dist/index-BnNqbx2I.d.mts +134 -0
  95. package/dist/index-Bv15sNLn.d.mts +389 -0
  96. package/dist/index-C-myW_aK.d.mts +412 -0
  97. package/dist/index-C9F3Fc1A.d.mts +2938 -0
  98. package/dist/index-CNxS4Tlu.d.mts +1 -0
  99. package/dist/index-CVA0m1g9.d.mts +995 -0
  100. package/dist/index-C_kS2aqV2.d.mts +438 -0
  101. package/dist/index-Ch3ph52M2.d.mts +40 -0
  102. package/dist/index-CnZOKNjU.d.mts +89 -0
  103. package/dist/index-D1T-PPqF.d.mts +67 -0
  104. package/dist/index-D7T8XCku.d.mts +341 -0
  105. package/dist/index-DBQtpFLE.d.mts +4843 -0
  106. package/dist/index-DEw90pa2.d.mts +183 -0
  107. package/dist/index-DQRsGXb5.d.mts +109 -0
  108. package/dist/index-Dd5s4MSm.d.mts +72 -0
  109. package/dist/index-DubqLGH8.d.mts +1002 -0
  110. package/dist/index-ESSDWIB7.d.mts +11 -0
  111. package/dist/index-N5K1NOYs.d.mts +184 -0
  112. package/dist/index-PdUSmPT2.d.mts +180 -0
  113. package/dist/index-SzSiyG61.d.mts +117 -0
  114. package/dist/index-T0471kWA.d.mts +6760 -0
  115. package/dist/index-WKjrpcA_.d.mts +218 -0
  116. package/dist/index-hapw9_En.d.mts +13592 -0
  117. package/dist/index-iID2R9G1.d.mts +1490 -0
  118. package/dist/kernel/cli/index.d.mts +141 -0
  119. package/dist/kernel/cli/index.mjs +1 -0
  120. package/dist/kernel/cli/schemas.d.mts +63 -0
  121. package/dist/kernel/cli/schemas.mjs +1 -0
  122. package/dist/kernel/extension/index.d.mts +2 -0
  123. package/dist/kernel/extension/index.mjs +1 -0
  124. package/dist/kernel/index.d.mts +296 -0
  125. package/dist/kernel/index.mjs +1 -0
  126. package/dist/kernel/namespace/index.d.mts +2 -0
  127. package/dist/kernel/namespace/index.mjs +1 -0
  128. package/dist/kernel/observability/index.d.mts +2 -0
  129. package/dist/kernel/observability/index.mjs +1 -0
  130. package/dist/kernel/providers/index.d.mts +2 -0
  131. package/dist/kernel/providers/index.mjs +1 -0
  132. package/dist/kernel/window/index.d.mts +2 -0
  133. package/dist/kernel/window/index.mjs +1 -0
  134. package/dist/model-registry-BNzpR6TU.mjs +1 -0
  135. package/dist/model-registry-CIscwC52.mjs +1 -0
  136. package/dist/namespace-0yuzAKlr.mjs +1 -0
  137. package/dist/namespace-8cNguvIp.mjs +1 -0
  138. package/dist/namespace-BK2erxpV.d.mts +921 -0
  139. package/dist/namespace-Bmc7AW4J2.mjs +1 -0
  140. package/dist/namespace-C2ufjgaQ.d.mts +767 -0
  141. package/dist/namespace-C54Oj025.d.mts +159 -0
  142. package/dist/namespace-CCDEOwmW.d.mts +1313 -0
  143. package/dist/namespace-CfEWMXBx.mjs +1 -0
  144. package/dist/namespace-CkLUtc0g.d.mts +580 -0
  145. package/dist/namespace-D5Wrt7YU.mjs +1 -0
  146. package/dist/namespace-DZcuLwEA.d.mts +51 -0
  147. package/dist/namespace-Db-p67Rg.mjs +1 -0
  148. package/dist/namespace-FWx6HxaW.d.mts +611 -0
  149. package/dist/namespace-GLGGcWPH.d.mts +43 -0
  150. package/dist/namespace-N0dfwSg6.mjs +1 -0
  151. package/dist/namespace-O5SNY-LV.d.mts +2226 -0
  152. package/dist/namespace-ZbthBQVt.d.mts +142 -0
  153. package/dist/namespace-bq4Prtzn.d.mts +2046 -0
  154. package/dist/namespace-pNcSglBS.mjs +1 -0
  155. package/dist/namespace-ptv-pw_g.d.mts +3019 -0
  156. package/dist/namespace-xkvVw3hf2.d.mts +189 -0
  157. package/dist/native-session-supervisor-L-UIaEfd.mjs +1 -0
  158. package/dist/node/bus-server/index.d.mts +178 -0
  159. package/dist/node/bus-server/index.mjs +1 -0
  160. package/dist/node/bus-server/server-lifecycle.d.mts +2 -0
  161. package/dist/node/bus-server/server-lifecycle.mjs +1 -0
  162. package/dist/node/machine-identity/index.d.mts +85 -0
  163. package/dist/node/machine-identity/index.mjs +3 -0
  164. package/dist/node/transports/index.d.mts +1752 -0
  165. package/dist/node/transports/index.mjs +2 -0
  166. package/dist/orchestrator-shared-DrjtTXYh.d.mts +249 -0
  167. package/dist/orchestrator-shared-Wv1GI2mW.mjs +1 -0
  168. package/dist/platform-BbSLVg5b.mjs +1 -0
  169. package/dist/profile-4StaDQW0.mjs +1 -0
  170. package/dist/provider-context-CNRQ4d5m.mjs +1 -0
  171. package/dist/providers/index.d.mts +135 -0
  172. package/dist/providers/index.mjs +1 -0
  173. package/dist/providers-Cr4Za8a1.mjs +1 -0
  174. package/dist/providers-namespace-CDwxY_DV.d.mts +583 -0
  175. package/dist/schema-BwzXEtT2.d.mts +837 -0
  176. package/dist/schema-CAw_BqaG.mjs +1 -0
  177. package/dist/schema-introspection-D61TT_7b.mjs +1 -0
  178. package/dist/schema-uSGW-6oM.mjs +1 -0
  179. package/dist/schemas-BXstpWVp.mjs +1 -0
  180. package/dist/schemas-BdMU-gew.d.mts +160 -0
  181. package/dist/schemas-C40ZAJ33.mjs +1 -0
  182. package/dist/schemas-C5xtVqdb.d.mts +46 -0
  183. package/dist/schemas-CGZy_rU6.d.mts +13 -0
  184. package/dist/schemas-CLxtoKFy.mjs +1 -0
  185. package/dist/schemas-Co_sVhzz.mjs +1 -0
  186. package/dist/schemas-D9108Iv1.d.mts +182 -0
  187. package/dist/schemas-DENVYyds.d.mts +463 -0
  188. package/dist/schemas-DbWs_hj8.d.mts +174 -0
  189. package/dist/schemas-Di0XnnMX.d.mts +73 -0
  190. package/dist/schemas-KMA1efQg.d.mts +944 -0
  191. package/dist/schemas-qmn5SWPU.d.mts +312 -0
  192. package/dist/schemas-sshQEF3l.d.mts +237 -0
  193. package/dist/server-lifecycle-Cf_SZ27k.d.mts +160 -0
  194. package/dist/server-lifecycle-DbFwlrTW.mjs +1 -0
  195. package/dist/service-base/index.d.mts +98 -0
  196. package/dist/service-base/index.mjs +1 -0
  197. package/dist/services/adapter-runtime/index.d.mts +4 -0
  198. package/dist/services/adapter-runtime/index.mjs +1 -0
  199. package/dist/services/adapter-runtime/namespace.d.mts +2 -0
  200. package/dist/services/adapter-runtime/namespace.mjs +1 -0
  201. package/dist/services/adapter-runtime/schemas.d.mts +2 -0
  202. package/dist/services/adapter-runtime/schemas.mjs +1 -0
  203. package/dist/services/adapter-subsystem/index.d.mts +3 -0
  204. package/dist/services/adapter-subsystem/index.mjs +1 -0
  205. package/dist/services/adapter-subsystem/namespace.d.mts +2 -0
  206. package/dist/services/adapter-subsystem/namespace.mjs +1 -0
  207. package/dist/services/agent-runtime/index.d.mts +3 -0
  208. package/dist/services/agent-runtime/index.mjs +1 -0
  209. package/dist/services/agent-runtime/namespace.d.mts +2 -0
  210. package/dist/services/agent-runtime/namespace.mjs +1 -0
  211. package/dist/services/agent-runtime/schemas.d.mts +2 -0
  212. package/dist/services/agent-runtime/schemas.mjs +1 -0
  213. package/dist/services/capability/index.d.mts +2 -0
  214. package/dist/services/capability/index.mjs +1 -0
  215. package/dist/services/cli-detection/namespace.d.mts +56 -0
  216. package/dist/services/cli-detection/namespace.mjs +1 -0
  217. package/dist/services/codebase/index.d.mts +3 -0
  218. package/dist/services/codebase/index.mjs +1 -0
  219. package/dist/services/codebase/namespace.d.mts +2 -0
  220. package/dist/services/codebase/namespace.mjs +1 -0
  221. package/dist/services/codebase/schemas.d.mts +2 -0
  222. package/dist/services/codebase/schemas.mjs +1 -0
  223. package/dist/services/compression/index.d.mts +3 -0
  224. package/dist/services/compression/index.mjs +1 -0
  225. package/dist/services/compression/namespace.d.mts +2 -0
  226. package/dist/services/compression/namespace.mjs +1 -0
  227. package/dist/services/compression/schemas.d.mts +2 -0
  228. package/dist/services/compression/schemas.mjs +1 -0
  229. package/dist/services/context-rules/index.d.mts +412 -0
  230. package/dist/services/context-rules/index.mjs +1 -0
  231. package/dist/services/credential-change/index.d.mts +17 -0
  232. package/dist/services/credential-change/index.mjs +1 -0
  233. package/dist/services/definition/index.d.mts +2 -0
  234. package/dist/services/definition/index.mjs +1 -0
  235. package/dist/services/definition/namespace.d.mts +71 -0
  236. package/dist/services/definition/namespace.mjs +1 -0
  237. package/dist/services/definition/schemas.d.mts +38 -0
  238. package/dist/services/definition/schemas.mjs +1 -0
  239. package/dist/services/dialog/namespace.d.mts +105 -0
  240. package/dist/services/dialog/namespace.mjs +1 -0
  241. package/dist/services/dialog/schemas.d.mts +109 -0
  242. package/dist/services/dialog/schemas.mjs +1 -0
  243. package/dist/services/execution-target/index.d.mts +4 -0
  244. package/dist/services/execution-target/index.mjs +1 -0
  245. package/dist/services/execution-target/namespace.d.mts +2 -0
  246. package/dist/services/execution-target/namespace.mjs +1 -0
  247. package/dist/services/execution-target/schemas.d.mts +2 -0
  248. package/dist/services/execution-target/schemas.mjs +1 -0
  249. package/dist/services/filesystem/namespace.d.mts +432 -0
  250. package/dist/services/filesystem/namespace.mjs +1 -0
  251. package/dist/services/filesystem/schemas.d.mts +240 -0
  252. package/dist/services/filesystem/schemas.mjs +1 -0
  253. package/dist/services/harness/index.d.mts +861 -0
  254. package/dist/services/harness/index.mjs +1 -0
  255. package/dist/services/harness/storage/schema.d.mts +424 -0
  256. package/dist/services/harness/storage/schema.mjs +1 -0
  257. package/dist/services/index.d.mts +5703 -0
  258. package/dist/services/index.mjs +1 -0
  259. package/dist/services/local-notification/index.d.mts +25 -0
  260. package/dist/services/local-notification/index.mjs +1 -0
  261. package/dist/services/local-notification/namespace.d.mts +73 -0
  262. package/dist/services/local-notification/namespace.mjs +1 -0
  263. package/dist/services/local-notification/schemas.d.mts +88 -0
  264. package/dist/services/local-notification/schemas.mjs +1 -0
  265. package/dist/services/log-import/browser.d.mts +3 -0
  266. package/dist/services/log-import/browser.mjs +1 -0
  267. package/dist/services/log-import/index.d.mts +275 -0
  268. package/dist/services/log-import/index.mjs +2 -0
  269. package/dist/services/log-import/log-import.d.mts +3 -0
  270. package/dist/services/log-import/log-import.mjs +1 -0
  271. package/dist/services/log-import/namespace.d.mts +327 -0
  272. package/dist/services/log-import/namespace.mjs +1 -0
  273. package/dist/services/log-import/schemas.d.mts +217 -0
  274. package/dist/services/log-import/schemas.mjs +1 -0
  275. package/dist/services/model-registry/index.d.mts +2 -0
  276. package/dist/services/model-registry/index.mjs +1 -0
  277. package/dist/services/preferences/index.d.mts +3 -0
  278. package/dist/services/preferences/index.mjs +1 -0
  279. package/dist/services/preferences/schemas.d.mts +2 -0
  280. package/dist/services/preferences/schemas.mjs +1 -0
  281. package/dist/services/preferences/storage-namespace.d.mts +3 -0
  282. package/dist/services/preferences/storage-namespace.mjs +1 -0
  283. package/dist/services/provider-context/index.d.mts +2 -0
  284. package/dist/services/provider-context/index.mjs +1 -0
  285. package/dist/services/provider-runtime/index.d.mts +136 -0
  286. package/dist/services/provider-runtime/index.mjs +1 -0
  287. package/dist/services/session/handlers/index.d.mts +2 -0
  288. package/dist/services/session/handlers/index.mjs +1 -0
  289. package/dist/services/session/index.d.mts +10 -0
  290. package/dist/services/session/index.mjs +1 -0
  291. package/dist/services/session/messages/namespace.d.mts +2 -0
  292. package/dist/services/session/messages/namespace.mjs +1 -0
  293. package/dist/services/session/orchestrator-testing/index.d.mts +2 -0
  294. package/dist/services/session/orchestrator-testing/index.mjs +1 -0
  295. package/dist/services/session/session-events/namespace.d.mts +2 -0
  296. package/dist/services/session/session-events/namespace.mjs +1 -0
  297. package/dist/services/session/storage/namespace.d.mts +2 -0
  298. package/dist/services/session/storage/namespace.mjs +1 -0
  299. package/dist/services/session/storage/schema.d.mts +2 -0
  300. package/dist/services/session/storage/schema.mjs +1 -0
  301. package/dist/services/session/testing/index.d.mts +35 -0
  302. package/dist/services/session/testing/index.mjs +52 -0
  303. package/dist/services/session/testing/orchestrator-shared.d.mts +2 -0
  304. package/dist/services/session/testing/orchestrator-shared.mjs +1 -0
  305. package/dist/services/session/turns/namespace.d.mts +2 -0
  306. package/dist/services/session/turns/namespace.mjs +1 -0
  307. package/dist/services/session-editor/index.d.mts +119 -0
  308. package/dist/services/session-editor/index.mjs +1 -0
  309. package/dist/services/settings/index.d.mts +47 -0
  310. package/dist/services/settings/index.mjs +1 -0
  311. package/dist/services/settings/namespace.d.mts +662 -0
  312. package/dist/services/settings/namespace.mjs +1 -0
  313. package/dist/services/settings/storage/clients-namespace.d.mts +2 -0
  314. package/dist/services/settings/storage/clients-namespace.mjs +1 -0
  315. package/dist/services/settings/storage/extension-configs/namespace.d.mts +184 -0
  316. package/dist/services/settings/storage/extension-configs/namespace.mjs +1 -0
  317. package/dist/services/settings/storage/index.d.mts +4 -0
  318. package/dist/services/settings/storage/index.mjs +1 -0
  319. package/dist/services/settings/storage/providers-namespace.d.mts +2 -0
  320. package/dist/services/settings/storage/providers-namespace.mjs +1 -0
  321. package/dist/services/tool-approval/index.d.mts +2 -0
  322. package/dist/services/tool-approval/index.mjs +1 -0
  323. package/dist/services/tools/index.d.mts +2 -0
  324. package/dist/services/tools/index.mjs +1 -0
  325. package/dist/services/tray-menu/index.d.mts +4 -0
  326. package/dist/services/tray-menu/index.mjs +1 -0
  327. package/dist/services/tray-menu/namespace.d.mts +2 -0
  328. package/dist/services/tray-menu/namespace.mjs +1 -0
  329. package/dist/services/tray-menu/schemas.d.mts +2 -0
  330. package/dist/services/tray-menu/schemas.mjs +1 -0
  331. package/dist/services/turn/index.d.mts +2 -0
  332. package/dist/services/turn/index.mjs +1 -0
  333. package/dist/services/turn/namespace.d.mts +2 -0
  334. package/dist/services/turn/namespace.mjs +1 -0
  335. package/dist/services/turn/schemas.d.mts +335 -0
  336. package/dist/services/turn/schemas.mjs +1 -0
  337. package/dist/services/worker/index.d.mts +3 -0
  338. package/dist/services/worker/index.mjs +1 -0
  339. package/dist/services/worker/namespace.d.mts +2 -0
  340. package/dist/services/worker/namespace.mjs +1 -0
  341. package/dist/services/worker/schemas.d.mts +2 -0
  342. package/dist/services/worker/schemas.mjs +1 -0
  343. package/dist/session-Do6lDZM4.mjs +123 -0
  344. package/dist/session-lineage-Eev4uo4I.d.mts +65 -0
  345. package/dist/session-piI1R5rP.mjs +1 -0
  346. package/dist/shared-DxHLl9UP.mjs +1 -0
  347. package/dist/shared-schemas-BgQv_tnu.mjs +1 -0
  348. package/dist/skill-CB5h-ZFQ.mjs +1 -0
  349. package/dist/storage/drizzle/client.d.mts +78 -0
  350. package/dist/storage/drizzle/client.mjs +1 -0
  351. package/dist/storage/drizzle/index.d.mts +98 -0
  352. package/dist/storage/drizzle/index.mjs +1 -0
  353. package/dist/storage/handlers/drizzle/index.d.mts +2 -0
  354. package/dist/storage/handlers/drizzle/index.mjs +1 -0
  355. package/dist/storage/handlers/index.d.mts +33 -0
  356. package/dist/storage/handlers/index.mjs +1 -0
  357. package/dist/storage/index.d.mts +192 -0
  358. package/dist/storage/index.mjs +1 -0
  359. package/dist/storage-namespace-ADwyijoe.mjs +1 -0
  360. package/dist/storage-namespace-DAm8iWEj.d.mts +221 -0
  361. package/dist/storage-namespace-definition-CHu2k14q.mjs +1 -0
  362. package/dist/storage-namespace-definition-CJgqyXH1.d.mts +17 -0
  363. package/dist/style.css +3782 -0
  364. package/dist/testing/drizzle-harness.d.mts +130 -0
  365. package/dist/testing/drizzle-harness.mjs +1 -0
  366. package/dist/testing/index.d.mts +106 -0
  367. package/dist/testing/index.mjs +1 -0
  368. package/dist/tool-approval-service-BcBSUZCO.mjs +1 -0
  369. package/dist/tools/index.d.mts +825 -0
  370. package/dist/tools/index.mjs +1 -0
  371. package/dist/tools/testing/index.d.mts +53 -0
  372. package/dist/tools/testing/index.mjs +1 -0
  373. package/dist/tools-CDSgj0ee.mjs +1 -0
  374. package/dist/tray-menu-service-CTXC1Elg.mjs +1 -0
  375. package/dist/types-6WxLfoM3.d.mts +31 -0
  376. package/dist/types-BjToUrHp.d.mts +6619 -0
  377. package/dist/types-CD1LJwPc.d.mts +1009 -0
  378. package/dist/types-Cvrj2ogm.d.mts +305 -0
  379. package/dist/types-DYF5LxZY.d.mts +233 -0
  380. package/dist/types-t295YC6T.d.mts +262 -0
  381. package/dist/types-vNpkAe4Y.d.mts +128 -0
  382. package/dist/ui-components/index.d.mts +2342 -0
  383. package/dist/ui-components/index.mjs +8 -0
  384. package/dist/ui-config-CXmbsqZV.mjs +1 -0
  385. package/dist/ui-hooks/index.d.mts +1805 -0
  386. package/dist/ui-hooks/index.mjs +1 -0
  387. package/dist/ui-kernel/index.d.mts +2793 -0
  388. package/dist/ui-kernel/index.mjs +1 -0
  389. package/dist/ui-kernel/pages/namespace.d.mts +88 -0
  390. package/dist/ui-kernel/pages/namespace.mjs +1 -0
  391. package/dist/ui-kernel/pages/schemas.d.mts +2 -0
  392. package/dist/ui-kernel/pages/schemas.mjs +1 -0
  393. package/dist/ui-views/index.d.mts +487 -0
  394. package/dist/ui-views/index.mjs +30 -0
  395. package/dist/utils/health-probe.d.mts +26 -0
  396. package/dist/utils/health-probe.mjs +1 -0
  397. package/dist/utils/index.d.mts +227 -0
  398. package/dist/utils/index.mjs +2 -0
  399. package/dist/utils/keychain.d.mts +31 -0
  400. package/dist/utils/keychain.mjs +1 -0
  401. package/dist/utils/resolve-package-root.d.mts +12 -0
  402. package/dist/utils/resolve-package-root.mjs +1 -0
  403. package/dist/utils/workspace-root.d.mts +27 -0
  404. package/dist/utils/workspace-root.mjs +2 -0
  405. package/dist/variant-D5kSrL3m.mjs +1 -0
  406. package/dist/version-CjS20oXi.mjs +1 -0
  407. package/dist/visibility-CZu8ooOA.mjs +1 -0
  408. package/dist/window-registry-CUftmDr3.mjs +1 -0
  409. package/dist/window-registry-C_IJmY8_.d.mts +130 -0
  410. package/package.json +346 -0
@@ -0,0 +1,3897 @@
1
+ import { A as VersionRange, O as VersionLiteral, r as ClientDefinition } from "./definition-DxvZ9e22.mjs";
2
+ import { t as RequiredTimeoutConfig } from "./schemas-CGZy_rU6.mjs";
3
+ import { o as ProviderDefinitionInput, r as ProtocolId } from "./definition-DtUNiGom.mjs";
4
+ import { B as SESSION_EVENT_TYPES, i as MakaioSessionEvent, p as SessionMessage } from "./types-BjToUrHp.mjs";
5
+ import { D as EntityUIConfig, I as FormFieldProps } from "./index-BJOfdtbw.mjs";
6
+ import { z } from "zod";
7
+ import { MakaioBusLike, PayloadFilter, RegistrableBusNamespaceDefinition, SubjectSchema } from "@makaio/framework/core";
8
+ import { Toolset } from "@makaio/framework/tools";
9
+ import { ComponentType } from "react";
10
+
11
+ //#region packages/contracts/src/extension/browser-entrypoint.d.ts
12
+ /**
13
+ * Browser entrypoint metadata declared by a package manifest.
14
+ *
15
+ * The renderer uses this URL path to load a package's browser bundle.
16
+ */
17
+ declare const BrowserEntrypointSchema: z.ZodObject<{
18
+ entrypoint: z.ZodString;
19
+ }, z.core.$strip>;
20
+ /** Inferred type for browser entrypoint manifest metadata. */
21
+ type BrowserEntrypoint = z.infer<typeof BrowserEntrypointSchema>;
22
+ //#endregion
23
+ //#region packages/contracts/src/extension/contribution-manifest.d.ts
24
+ /**
25
+ * Protocol-specific configuration for an adapter contribution.
26
+ *
27
+ * Acts as a seam for future protocol-level settings (e.g., custom base URLs,
28
+ * auth overrides, timeout policies). Currently intentionally empty — consuming
29
+ * code should treat an absent value the same as `{}`.
30
+ */
31
+ interface ProtocolConfig {
32
+ /** Optional custom endpoint URL overriding the protocol default. */
33
+ readonly endpoint?: string;
34
+ }
35
+ /** Zod schema for {@link ProtocolConfig}. */
36
+ declare const ProtocolConfigSchema: z.ZodObject<{
37
+ endpoint: z.ZodOptional<z.ZodString>;
38
+ }, z.core.$strip>;
39
+ /**
40
+ * Reference to a supported wire protocol, with optional per-protocol config.
41
+ *
42
+ * - **Simple string** — use the protocol with default settings: `'anthropic'`.
43
+ * - **Config object** — declare one or more protocols with overrides:
44
+ * `{ anthropic: { endpoint: 'https://custom.host/v1' } }`.
45
+ *
46
+ * Both forms are valid in the `protocols` array on {@link AdapterManifest}.
47
+ * @example Simple form
48
+ * ```json
49
+ * "protocols": ["anthropic", "openai"]
50
+ * ```
51
+ * @example Config form
52
+ * ```json
53
+ * "protocols": [{ "anthropic": { "endpoint": "https://custom.host/v1" } }]
54
+ * ```
55
+ */
56
+ type ProtocolRef = ProtocolId | { readonly [K in ProtocolId]?: ProtocolConfig };
57
+ /** Zod schema for {@link ProtocolRef}. */
58
+ declare const ProtocolRefSchema: z.ZodUnion<readonly [z.ZodEnum<{
59
+ anthropic: "anthropic";
60
+ openai: "openai";
61
+ }>, z.ZodObject<{
62
+ anthropic: z.ZodOptional<z.ZodObject<{
63
+ endpoint: z.ZodOptional<z.ZodString>;
64
+ }, z.core.$strip>>;
65
+ openai: z.ZodOptional<z.ZodObject<{
66
+ endpoint: z.ZodOptional<z.ZodString>;
67
+ }, z.core.$strip>>;
68
+ }, z.core.$strip>]>;
69
+ /**
70
+ * Reference from an adapter to a client package it depends on.
71
+ *
72
+ * The `version` field follows npm/package.json semver range syntax so the
73
+ * executable adapter contribution can verify compatibility against the
74
+ * installed client (npm package) version. The optional `binaryVersion` field
75
+ * constrains the version of the shipped binary separately — useful when the
76
+ * npm package version and the embedded binary version diverge.
77
+ * @example `{ id: 'claude-code', version: '^1.5.0' }`
78
+ * @example `{ id: 'claude-code', version: '^1.5.0', binaryVersion: '>=1.0.0 <1.2.0' }`
79
+ */
80
+ interface AdapterClientRef {
81
+ /** Stable client identifier matching {@link ClientManifest.id}. */
82
+ readonly id: string;
83
+ /**
84
+ * Semver range the adapter is compatible with for the npm package version.
85
+ *
86
+ * Uses the same syntax as `package.json` dependency fields
87
+ * (e.g., `'^1.5.0'`, `'>=2.0.0'`, `'*'`).
88
+ */
89
+ readonly version: VersionRange;
90
+ /**
91
+ * Optional semver range constraining the binary version separately from the
92
+ * npm package version. The adapter subsystem evaluates this field at
93
+ * activation time by resolving the active client binary.
94
+ *
95
+ * Omit when the binary version is assumed to match the npm package version.
96
+ */
97
+ readonly binaryVersion?: VersionRange;
98
+ }
99
+ /** Zod schema for {@link AdapterClientRef}. */
100
+ declare const AdapterClientRefSchema: z.ZodObject<{
101
+ id: z.ZodString;
102
+ version: z.ZodString;
103
+ binaryVersion: z.ZodOptional<z.ZodString>;
104
+ }, z.core.$strip>;
105
+ /**
106
+ * Describes an adapter contributed by an extension.
107
+ *
108
+ * Serializable metadata for discovery, filtering, and inspection. The
109
+ * executable runtime source is `MakaioExtension.adapters[].manifest`, paired
110
+ * with its adapter definition; descriptor-level contributions do not register
111
+ * adapters by themselves.
112
+ *
113
+ * The `protocols` field is required because an adapter must declare at least
114
+ * which wire protocol(s) it implements; all other fields are optional metadata.
115
+ */
116
+ interface AdapterManifest {
117
+ /**
118
+ * Stable machine identifier for this adapter contribution (e.g., `'claude-code'`).
119
+ *
120
+ * Used as the key in adapter registries. Must be unique within the declaring
121
+ * extension.
122
+ */
123
+ readonly name: string;
124
+ /** Human-readable display name shown in the UI (e.g., `'Claude Code'`). */
125
+ readonly displayName?: string;
126
+ /** Short description of what this adapter does. */
127
+ readonly description?: string;
128
+ /**
129
+ * Client packages this adapter depends on.
130
+ *
131
+ * Each entry declares a required client by ID and semver range. Executable
132
+ * adapter processors verify that referenced clients are installed and
133
+ * compatible before activating the adapter.
134
+ */
135
+ readonly clients?: readonly AdapterClientRef[];
136
+ /**
137
+ * Wire protocol(s) this adapter implements.
138
+ *
139
+ * At least one entry is required. Each entry is either a plain
140
+ * {@link ProtocolId} string or a {@link ProtocolRef} config object with
141
+ * per-protocol overrides.
142
+ */
143
+ readonly protocols: readonly ProtocolRef[];
144
+ /**
145
+ * Identifier of the provider this adapter defaults to.
146
+ *
147
+ * When omitted, the runtime or user selects the provider. Must reference a
148
+ * registered provider definition `id`.
149
+ */
150
+ readonly defaultProvider?: string;
151
+ }
152
+ /** Zod schema for {@link AdapterManifest}. */
153
+ declare const AdapterManifestSchema: z.ZodObject<{
154
+ name: z.ZodString;
155
+ displayName: z.ZodOptional<z.ZodString>;
156
+ description: z.ZodOptional<z.ZodString>;
157
+ clients: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
158
+ id: z.ZodString;
159
+ version: z.ZodString;
160
+ binaryVersion: z.ZodOptional<z.ZodString>;
161
+ }, z.core.$strip>>>>;
162
+ protocols: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
163
+ anthropic: "anthropic";
164
+ openai: "openai";
165
+ }>, z.ZodObject<{
166
+ anthropic: z.ZodOptional<z.ZodObject<{
167
+ endpoint: z.ZodOptional<z.ZodString>;
168
+ }, z.core.$strip>>;
169
+ openai: z.ZodOptional<z.ZodObject<{
170
+ endpoint: z.ZodOptional<z.ZodString>;
171
+ }, z.core.$strip>>;
172
+ }, z.core.$strip>]>>>;
173
+ defaultProvider: z.ZodOptional<z.ZodString>;
174
+ }, z.core.$strip>;
175
+ /**
176
+ * Describes a client binary contributed by an extension.
177
+ *
178
+ * A "client" is a standalone executable (e.g., the Claude Code CLI) that an
179
+ * adapter delegates work to. This manifest is discovery-time metadata;
180
+ * executable `MakaioExtension.clients` definitions are the runtime source for
181
+ * locating, verifying, and managing the binary lifecycle.
182
+ */
183
+ interface ClientManifest {
184
+ /**
185
+ * Stable machine identifier for this client (e.g., `'claude-code'`).
186
+ *
187
+ * Must be unique within the declaring extension. Referenced by
188
+ * {@link AdapterClientRef.id} to express adapter-to-client dependencies.
189
+ */
190
+ readonly id: string;
191
+ /** Human-readable display name (e.g., `'Claude Code'`). */
192
+ readonly name: string;
193
+ /** Short description of what this client binary does. */
194
+ readonly description?: string;
195
+ /**
196
+ * Binary identity for this client.
197
+ *
198
+ * When present, carries the executable name used for PATH detection.
199
+ * When omitted, executable client definitions use {@link id} as the
200
+ * default binary lookup key.
201
+ * @example `{ name: 'claude' }`
202
+ */
203
+ readonly binary?: {
204
+ readonly name: string;
205
+ };
206
+ }
207
+ /** Zod schema for {@link ClientManifest}. */
208
+ declare const ClientManifestSchema: z.ZodObject<{
209
+ id: z.ZodString;
210
+ name: z.ZodString;
211
+ description: z.ZodOptional<z.ZodString>;
212
+ binary: z.ZodOptional<z.ZodObject<{
213
+ name: z.ZodString;
214
+ }, z.core.$strict>>;
215
+ }, z.core.$strict>;
216
+ /**
217
+ * Describes a model provider contributed by an extension.
218
+ *
219
+ * A "provider" is an inference backend (e.g., Anthropic, OpenAI, Z.AI) that
220
+ * adapters use to route model requests. This manifest is discovery-time
221
+ * metadata; executable `MakaioExtension.providers` definitions are the
222
+ * runtime source for credential resolution and model catalog registration.
223
+ * @example
224
+ * ```json
225
+ * { "id": "anthropic", "name": "Anthropic", "description": "Official Anthropic API" }
226
+ * ```
227
+ */
228
+ interface ProviderManifest {
229
+ /**
230
+ * Stable machine identifier for this provider (e.g., `'anthropic'`).
231
+ *
232
+ * Must be unique within the declaring extension. Used as the primary key
233
+ * in provider registries and referenced by
234
+ * {@link AdapterManifest.defaultProvider}.
235
+ */
236
+ readonly id: string;
237
+ /** Human-readable display name (e.g., `'Anthropic'`). */
238
+ readonly name: string;
239
+ /** Short description of this provider. */
240
+ readonly description?: string;
241
+ }
242
+ /** Zod schema for {@link ProviderManifest}. */
243
+ declare const ProviderManifestSchema: z.ZodObject<{
244
+ id: z.ZodString;
245
+ name: z.ZodString;
246
+ description: z.ZodOptional<z.ZodString>;
247
+ }, z.core.$strip>;
248
+ /**
249
+ * Pipeline stage a hash trigger participates in.
250
+ *
251
+ * Mirrors {@link HashTriggerStage} from the runtime contribution types.
252
+ * Kept as a local type alias so this manifest module remains self-contained.
253
+ */
254
+ type TriggerStage = 'gather' | 'transform' | 'action';
255
+ /**
256
+ * Describes a hash trigger contributed by an extension.
257
+ *
258
+ * Serializable metadata for discovery and introspection. The executable
259
+ * runtime source is `MakaioExtension.triggers.createTriggers()`; descriptor
260
+ * contributions are not a registration fallback.
261
+ */
262
+ interface TriggerManifest {
263
+ /**
264
+ * Prefix token this trigger responds to (e.g., `'loop'`, `'file'`).
265
+ *
266
+ * Must be unique within the declaring extension. Used by the hash trigger
267
+ * service to route `#prefix:argument` directives.
268
+ */
269
+ readonly prefix: string;
270
+ /** Human-readable description of what this trigger does. */
271
+ readonly description?: string;
272
+ /**
273
+ * Pipeline stage this trigger participates in.
274
+ *
275
+ * Defaults to `'action'` when omitted.
276
+ */
277
+ readonly stage?: TriggerStage;
278
+ }
279
+ /** Zod schema for {@link TriggerManifest}. */
280
+ declare const TriggerManifestSchema: z.ZodObject<{
281
+ prefix: z.ZodString;
282
+ description: z.ZodOptional<z.ZodString>;
283
+ stage: z.ZodOptional<z.ZodEnum<{
284
+ transform: "transform";
285
+ action: "action";
286
+ gather: "gather";
287
+ }>>;
288
+ }, z.core.$strip>;
289
+ /**
290
+ * Describes a log importer contributed by an extension.
291
+ *
292
+ * Serializable metadata for discovery, filtering, and inspection. The
293
+ * executable runtime source is `MakaioExtension.logImport`; descriptor
294
+ * contributions are not a registration fallback.
295
+ */
296
+ interface LogImporterManifest {
297
+ /**
298
+ * Adapter name used for attribution (e.g., `'plugin:opencode'`).
299
+ *
300
+ * Must be unique within the declaring extension.
301
+ */
302
+ readonly adapterName: string;
303
+ /** Human-readable display name (e.g., `'OpenCode'`). */
304
+ readonly displayName: string;
305
+ /**
306
+ * Glob pattern matching importable log files.
307
+ *
308
+ * Discovery tooling can use this pattern to filter file system entries
309
+ * without loading the extension code.
310
+ * @example `'** /storage/session/* /*.json'`
311
+ */
312
+ readonly logFilePattern?: string;
313
+ }
314
+ /** Zod schema for {@link LogImporterManifest}. */
315
+ declare const LogImporterManifestSchema: z.ZodObject<{
316
+ adapterName: z.ZodString;
317
+ displayName: z.ZodString;
318
+ logFilePattern: z.ZodOptional<z.ZodString>;
319
+ }, z.core.$strip>;
320
+ /**
321
+ * Describes a session event action contributed by an extension.
322
+ *
323
+ * Serializable metadata for discovery and introspection. The executable
324
+ * runtime source is `MakaioExtension.sessionEventActions.createActions()`;
325
+ * descriptor contributions are not a registration fallback.
326
+ */
327
+ interface SessionEventActionManifest {
328
+ /**
329
+ * Unique action identifier within the declaring extension
330
+ * (e.g., `'pin-message:pin'`).
331
+ */
332
+ readonly id: string;
333
+ /** Display label shown in action menus. */
334
+ readonly label: string;
335
+ /** Optional human-readable description. */
336
+ readonly description?: string;
337
+ /** Optional icon identifier. */
338
+ readonly icon?: string;
339
+ /**
340
+ * Whether the action operates on a single event or multiple events.
341
+ *
342
+ * - `'single'` — immediate execution from a kebab menu.
343
+ * - `'multi'` — opens a picker modal for multi-event selection.
344
+ */
345
+ readonly selectionMode: 'single' | 'multi';
346
+ /**
347
+ * Message roles the action applies to.
348
+ *
349
+ * Maps to the `entrypoint.messageRole` field on the runtime action options.
350
+ */
351
+ readonly messageRoles?: readonly ('user' | 'assistant')[];
352
+ }
353
+ /** Zod schema for {@link SessionEventActionManifest}. */
354
+ declare const SessionEventActionManifestSchema: z.ZodObject<{
355
+ id: z.ZodString;
356
+ label: z.ZodString;
357
+ description: z.ZodOptional<z.ZodString>;
358
+ icon: z.ZodOptional<z.ZodString>;
359
+ selectionMode: z.ZodEnum<{
360
+ single: "single";
361
+ multi: "multi";
362
+ }>;
363
+ messageRoles: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
364
+ user: "user";
365
+ assistant: "assistant";
366
+ }>>>>;
367
+ }, z.core.$strip>;
368
+ /**
369
+ * Discovery-time flags for browser UI contribution surfaces.
370
+ *
371
+ * Each boolean flag indicates that the extension's executable
372
+ * {@link ExtensionUiContribution} declares the corresponding surface.
373
+ * Absent or `false` means the surface is not contributed.
374
+ */
375
+ interface UiSurfaceFlags {
376
+ /** Extension contributes one or more tile declarations. */
377
+ readonly tiles?: boolean;
378
+ /** Extension contributes one or more widget declarations. */
379
+ readonly widgets?: boolean;
380
+ /** Extension contributes one or more page declarations. */
381
+ readonly pages?: boolean;
382
+ /** Extension contributes one or more web UI routes. */
383
+ readonly routes?: boolean;
384
+ }
385
+ /** Zod schema for {@link UiSurfaceFlags}. */
386
+ declare const UiSurfaceFlagsSchema: z.ZodObject<{
387
+ tiles: z.ZodOptional<z.ZodBoolean>;
388
+ widgets: z.ZodOptional<z.ZodBoolean>;
389
+ pages: z.ZodOptional<z.ZodBoolean>;
390
+ routes: z.ZodOptional<z.ZodBoolean>;
391
+ }, z.core.$strip>;
392
+ /**
393
+ * Top-level container for all contributions an extension declares.
394
+ *
395
+ * Added as an optional field on {@link ExtensionManifest}. Extensions that do
396
+ * not need discovery-time contribution metadata may omit this field entirely.
397
+ * This manifest is intentionally not a runtime wiring surface; it mirrors the
398
+ * executable contribution fields only for pre-load introspection.
399
+ *
400
+ * Rich metadata fields ({@link adapters}, {@link clients}, {@link providers},
401
+ * {@link triggers}, {@link logImporters}, {@link sessionEventActions}) carry
402
+ * structured data for discovery and filtering. Boolean surface flags
403
+ * ({@link create}, {@link tools}, {@link bootstrap}, etc.) declare which
404
+ * executable surfaces the extension contributes without duplicating runtime
405
+ * detail.
406
+ * @example Extension contributing an adapter and a client
407
+ * ```json
408
+ * {
409
+ * "contributions": {
410
+ * "adapters": [
411
+ * {
412
+ * "name": "claude-code",
413
+ * "protocols": ["anthropic"],
414
+ * "clients": [{ "id": "claude-code", "version": "^1.5.0" }]
415
+ * }
416
+ * ],
417
+ * "clients": [
418
+ * { "id": "claude-code", "name": "Claude Code", "binary": { "name": "claude" } }
419
+ * ]
420
+ * }
421
+ * }
422
+ * ```
423
+ * @example Extension contributing hash triggers and tools
424
+ * ```json
425
+ * {
426
+ * "contributions": {
427
+ * "triggers": [
428
+ * { "prefix": "loop", "description": "Retry-until-success execution", "stage": "action" }
429
+ * ],
430
+ * "create": true,
431
+ * "tools": true,
432
+ * "configSchema": true,
433
+ * "ui": { "widgets": true }
434
+ * }
435
+ * }
436
+ * ```
437
+ */
438
+ interface ContributionManifest {
439
+ /** Adapter contributions declared by this extension. */
440
+ readonly adapters?: readonly AdapterManifest[];
441
+ /** Client binary contributions declared by this extension. */
442
+ readonly clients?: readonly ClientManifest[];
443
+ /** Provider contributions declared by this extension. */
444
+ readonly providers?: readonly ProviderManifest[];
445
+ /** Hash trigger contributions declared by this extension. */
446
+ readonly triggers?: readonly TriggerManifest[];
447
+ /** Log importer contribution declared by this extension. */
448
+ readonly logImporters?: readonly LogImporterManifest[];
449
+ /** Session event action contributions declared by this extension. */
450
+ readonly sessionEventActions?: readonly SessionEventActionManifest[];
451
+ /** Extension provides a service factory ({@link MakaioExtension.create}). */
452
+ readonly create?: boolean;
453
+ /** Extension contributes one or more toolsets ({@link MakaioExtension.tools}). */
454
+ readonly tools?: boolean;
455
+ /** Extension contributes bootstrap import/export ({@link MakaioExtension.bootstrap}). */
456
+ readonly bootstrap?: boolean;
457
+ /** Extension declares a bus namespace ({@link MakaioExtension."namespace"}). */
458
+ readonly namespace?: boolean;
459
+ /** Extension declares a config schema ({@link MakaioExtension.configSchema}). */
460
+ readonly configSchema?: boolean;
461
+ /** Extension declares UI config overrides ({@link MakaioExtension.uiConfig}). */
462
+ readonly uiConfig?: boolean;
463
+ /** Browser UI surface flags ({@link MakaioExtension.ui}). */
464
+ readonly ui?: UiSurfaceFlags;
465
+ }
466
+ /** Zod schema for {@link ContributionManifest}. */
467
+ declare const ContributionManifestSchema: z.ZodObject<{
468
+ adapters: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
469
+ name: z.ZodString;
470
+ displayName: z.ZodOptional<z.ZodString>;
471
+ description: z.ZodOptional<z.ZodString>;
472
+ clients: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
473
+ id: z.ZodString;
474
+ version: z.ZodString;
475
+ binaryVersion: z.ZodOptional<z.ZodString>;
476
+ }, z.core.$strip>>>>;
477
+ protocols: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
478
+ anthropic: "anthropic";
479
+ openai: "openai";
480
+ }>, z.ZodObject<{
481
+ anthropic: z.ZodOptional<z.ZodObject<{
482
+ endpoint: z.ZodOptional<z.ZodString>;
483
+ }, z.core.$strip>>;
484
+ openai: z.ZodOptional<z.ZodObject<{
485
+ endpoint: z.ZodOptional<z.ZodString>;
486
+ }, z.core.$strip>>;
487
+ }, z.core.$strip>]>>>;
488
+ defaultProvider: z.ZodOptional<z.ZodString>;
489
+ }, z.core.$strip>>>>;
490
+ clients: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
491
+ id: z.ZodString;
492
+ name: z.ZodString;
493
+ description: z.ZodOptional<z.ZodString>;
494
+ binary: z.ZodOptional<z.ZodObject<{
495
+ name: z.ZodString;
496
+ }, z.core.$strict>>;
497
+ }, z.core.$strict>>>>;
498
+ providers: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
499
+ id: z.ZodString;
500
+ name: z.ZodString;
501
+ description: z.ZodOptional<z.ZodString>;
502
+ }, z.core.$strip>>>>;
503
+ triggers: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
504
+ prefix: z.ZodString;
505
+ description: z.ZodOptional<z.ZodString>;
506
+ stage: z.ZodOptional<z.ZodEnum<{
507
+ transform: "transform";
508
+ action: "action";
509
+ gather: "gather";
510
+ }>>;
511
+ }, z.core.$strip>>>>;
512
+ logImporters: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
513
+ adapterName: z.ZodString;
514
+ displayName: z.ZodString;
515
+ logFilePattern: z.ZodOptional<z.ZodString>;
516
+ }, z.core.$strip>>>>;
517
+ sessionEventActions: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
518
+ id: z.ZodString;
519
+ label: z.ZodString;
520
+ description: z.ZodOptional<z.ZodString>;
521
+ icon: z.ZodOptional<z.ZodString>;
522
+ selectionMode: z.ZodEnum<{
523
+ single: "single";
524
+ multi: "multi";
525
+ }>;
526
+ messageRoles: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
527
+ user: "user";
528
+ assistant: "assistant";
529
+ }>>>>;
530
+ }, z.core.$strip>>>>;
531
+ create: z.ZodOptional<z.ZodBoolean>;
532
+ tools: z.ZodOptional<z.ZodBoolean>;
533
+ bootstrap: z.ZodOptional<z.ZodBoolean>;
534
+ namespace: z.ZodOptional<z.ZodBoolean>;
535
+ configSchema: z.ZodOptional<z.ZodBoolean>;
536
+ uiConfig: z.ZodOptional<z.ZodBoolean>;
537
+ ui: z.ZodOptional<z.ZodObject<{
538
+ tiles: z.ZodOptional<z.ZodBoolean>;
539
+ widgets: z.ZodOptional<z.ZodBoolean>;
540
+ pages: z.ZodOptional<z.ZodBoolean>;
541
+ routes: z.ZodOptional<z.ZodBoolean>;
542
+ }, z.core.$strip>>;
543
+ }, z.core.$strip>;
544
+ //#endregion
545
+ //#region packages/contracts/src/extension/capability-token.d.ts
546
+ /**
547
+ * Declaration-mergeable registry for extension capability tokens.
548
+ *
549
+ * Extend this interface via `declare module` to register capability tokens that
550
+ * can be referenced by {@link CapabilityToken} at compile time.
551
+ */
552
+ interface CapabilityTokenMap {
553
+ /** Adapter subsystem readiness for adapter metadata, config, and runtime lifecycle. */
554
+ adapters: true;
555
+ }
556
+ /**
557
+ * Compile-time capability token used by extension manifests.
558
+ *
559
+ * Extracting string keys preserves declaration-merged literal tokens without
560
+ * relying on intersections that can collapse to `never` in downstream type
561
+ * contexts.
562
+ */
563
+ type CapabilityToken = Extract<keyof CapabilityTokenMap, string>;
564
+ /**
565
+ * Canonical runtime validator for extension capability tokens.
566
+ *
567
+ * Runtime validation intentionally remains string-based so descriptor JSON stays
568
+ * data-only; declaration merging supplies the compile-time token vocabulary.
569
+ */
570
+ declare const CapabilityTokenSchema: z.ZodType<CapabilityToken>;
571
+ //#endregion
572
+ //#region packages/contracts/src/extension/manifest.d.ts
573
+ /**
574
+ * Visual presentation style for an extension window.
575
+ *
576
+ * - `'tray-popover'` — small overlay anchored to the system tray icon.
577
+ * - `'utility'` — standalone auxiliary window (e.g., settings panel).
578
+ * - `'panel'` — docked or floating workspace panel.
579
+ */
580
+ type WindowStyle = 'tray-popover' | 'utility' | 'panel';
581
+ /**
582
+ * Describes a window surface an extension can open.
583
+ *
584
+ * The shell uses this declaration to pre-register the window and manage
585
+ * its lifecycle without requiring the extension to be initialized first.
586
+ */
587
+ interface WindowManifest {
588
+ /**
589
+ * Identifier unique within the declaring extension.
590
+ * Referenced by {@link TrayManifest.opensWindow} to associate tray
591
+ * actions with specific windows.
592
+ */
593
+ readonly id: string;
594
+ /** Visual presentation style that governs how the shell positions and sizes the window. */
595
+ readonly style: WindowStyle;
596
+ /** Preferred initial width in logical pixels. */
597
+ readonly width?: number;
598
+ /** Preferred initial height in logical pixels. */
599
+ readonly height?: number;
600
+ /**
601
+ * When `true`, the shell ensures at most one instance of this window is
602
+ * open at a time, focusing the existing window instead of opening a new one.
603
+ */
604
+ readonly singleton?: boolean;
605
+ /**
606
+ * Named route parameters this window accepts.
607
+ * The shell uses these to map URL path segments to query params and
608
+ * to generalize window deduplication without hardcoding host IDs.
609
+ */
610
+ readonly params?: readonly WindowParamSpec[];
611
+ }
612
+ /**
613
+ * Specification for a named window route parameter.
614
+ */
615
+ interface WindowParamSpec {
616
+ /** Parameter name (e.g. `'projectId'`). */
617
+ readonly name: string;
618
+ /** Whether this parameter is required for window creation. */
619
+ readonly required?: boolean;
620
+ }
621
+ /** Zod schema for {@link WindowParamSpec}. */
622
+ declare const WindowParamSpecSchema: z.ZodObject<{
623
+ name: z.ZodString;
624
+ required: z.ZodOptional<z.ZodBoolean>;
625
+ }, z.core.$strip>;
626
+ /** Zod schema for {@link WindowManifest}. */
627
+ declare const WindowManifestSchema: z.ZodObject<{
628
+ id: z.ZodString;
629
+ style: z.ZodEnum<{
630
+ "tray-popover": "tray-popover";
631
+ utility: "utility";
632
+ panel: "panel";
633
+ }>;
634
+ width: z.ZodOptional<z.ZodNumber>;
635
+ height: z.ZodOptional<z.ZodNumber>;
636
+ singleton: z.ZodOptional<z.ZodBoolean>;
637
+ params: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
638
+ name: z.ZodString;
639
+ required: z.ZodOptional<z.ZodBoolean>;
640
+ }, z.core.$strip>>>>;
641
+ }, z.core.$strip>;
642
+ /**
643
+ * Describes an extension's entry in the system tray menu.
644
+ *
645
+ * The shell renders tray items grouped by {@link section}. Only one of
646
+ * {@link opensWindow} or {@link action} should be set; if both are present
647
+ * the shell prefers {@link opensWindow}.
648
+ */
649
+ interface TrayManifest {
650
+ /** Human-readable label shown in the tray menu. */
651
+ readonly label: string;
652
+ /**
653
+ * Logical grouping for tray menu layout.
654
+ *
655
+ * - `'utilities'` — system / account tools (e.g., auth switcher).
656
+ * - `'tools'` — productivity tools (e.g., code review).
657
+ * - `'views'` — windows or panels that present content.
658
+ */
659
+ readonly section?: 'utilities' | 'tools' | 'views';
660
+ /**
661
+ * {@link WindowManifest.id} of the window to open when this tray item is
662
+ * clicked. Takes precedence over {@link action} when both are defined.
663
+ */
664
+ readonly opensWindow?: string;
665
+ /**
666
+ * Opaque action identifier echoed in `host:tray.item.clicked` metadata when
667
+ * this tray item is clicked.
668
+ */
669
+ readonly action?: string;
670
+ }
671
+ /** Zod schema for {@link TrayManifest}. */
672
+ declare const TrayManifestSchema: z.ZodObject<{
673
+ label: z.ZodString;
674
+ section: z.ZodOptional<z.ZodEnum<{
675
+ tools: "tools";
676
+ utilities: "utilities";
677
+ views: "views";
678
+ }>>;
679
+ opensWindow: z.ZodOptional<z.ZodString>;
680
+ action: z.ZodOptional<z.ZodString>;
681
+ }, z.core.$strip>;
682
+ /**
683
+ * Describes a single positional argument or named option for a CLI subcommand.
684
+ *
685
+ * This is the serializable, framework-agnostic counterpart to
686
+ * `CliSubcommandDefinition` — it carries only metadata, no handler.
687
+ */
688
+ interface CliArgManifest {
689
+ /**
690
+ * Argument or option name.
691
+ * For positional args this is the display name shown in usage text.
692
+ * For named options it is the schema field name. The CLI adapter converts it
693
+ * to a kebab-case long flag when registering Commander options
694
+ * (e.g. `'clientId'` -\> `--client-id`).
695
+ */
696
+ readonly name: string;
697
+ /** One-line description shown in help text. */
698
+ readonly description: string;
699
+ /** When `true`, the CLI parser rejects invocations that omit this argument. */
700
+ readonly required?: boolean;
701
+ /** When `true`, treat as a positional argument rather than a named option. */
702
+ readonly positional?: boolean;
703
+ /** Short single-character flag alias (e.g. `'-p'`). */
704
+ readonly short?: string;
705
+ /**
706
+ * Value type for this argument or option.
707
+ * Used by manifest-based CLI registration to determine whether an option
708
+ * takes a value or is a boolean flag. Defaults to `'string'` when omitted.
709
+ * Manifest-based registration also uses this metadata to coerce numeric
710
+ * values before they reach the subcommand's Zod schema.
711
+ */
712
+ readonly type?: 'string' | 'boolean' | 'number';
713
+ }
714
+ /** Zod schema for {@link CliArgManifest}. */
715
+ declare const CliArgManifestSchema: z.ZodObject<{
716
+ name: z.ZodString;
717
+ description: z.ZodString;
718
+ required: z.ZodOptional<z.ZodBoolean>;
719
+ positional: z.ZodOptional<z.ZodBoolean>;
720
+ short: z.ZodOptional<z.ZodString>;
721
+ type: z.ZodOptional<z.ZodEnum<{
722
+ string: "string";
723
+ number: "number";
724
+ boolean: "boolean";
725
+ }>>;
726
+ }, z.core.$strip>;
727
+ /**
728
+ * Describes a single subcommand nested under the extension's top-level CLI command.
729
+ *
730
+ * Pure metadata — no handler. Used for help generation and manifest inspection.
731
+ */
732
+ interface CliSubcommandManifest {
733
+ /** Subcommand name (e.g. `'list'`, `'switch'`). */
734
+ readonly name: string;
735
+ /** One-line description shown in help text. */
736
+ readonly description: string;
737
+ /** Arguments and options accepted by this subcommand. */
738
+ readonly args?: readonly CliArgManifest[];
739
+ }
740
+ /** Zod schema for {@link CliSubcommandManifest}. */
741
+ declare const CliSubcommandManifestSchema: z.ZodObject<{
742
+ name: z.ZodString;
743
+ description: z.ZodString;
744
+ args: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
745
+ name: z.ZodString;
746
+ description: z.ZodString;
747
+ required: z.ZodOptional<z.ZodBoolean>;
748
+ positional: z.ZodOptional<z.ZodBoolean>;
749
+ short: z.ZodOptional<z.ZodString>;
750
+ type: z.ZodOptional<z.ZodEnum<{
751
+ string: "string";
752
+ number: "number";
753
+ boolean: "boolean";
754
+ }>>;
755
+ }, z.core.$strip>>>>;
756
+ }, z.core.$strip>;
757
+ /**
758
+ * Describes the top-level CLI command an extension contributes.
759
+ *
760
+ * Serializable and framework-agnostic. The executable extension,
761
+ * `ExtensionCliContribution`, adds the interactive handler and typed subcommand
762
+ * definitions. The CLI router uses this manifest for help generation and
763
+ * command discovery without loading handler code.
764
+ */
765
+ interface CliManifest {
766
+ /** Top-level command name (e.g. `'account-manager'`). */
767
+ readonly name: string;
768
+ /** One-line description shown in help text. */
769
+ readonly description: string;
770
+ /** Non-interactive subcommands registered under this command. */
771
+ readonly subcommands?: readonly CliSubcommandManifest[];
772
+ /**
773
+ * Whether this extension provides an interactive TUI handler.
774
+ *
775
+ * When `true`, invoking the bare command (without a subcommand) launches
776
+ * the interactive handler. When `false` or omitted, bare invocation shows
777
+ * help. This is a serializable declaration in `descriptor.json`; the
778
+ * executable handler itself lives in `ExtensionCliContribution.interactive`.
779
+ *
780
+ * Named `hasInteractive` (not `interactive`) to avoid a type conflict with
781
+ * the `ExtensionCliContribution` property of the same short name, which carries
782
+ * the function implementation rather than a boolean flag.
783
+ */
784
+ readonly hasInteractive?: boolean;
785
+ }
786
+ /** Zod schema for {@link CliManifest}. */
787
+ declare const CliManifestSchema: z.ZodObject<{
788
+ name: z.ZodString;
789
+ description: z.ZodString;
790
+ subcommands: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
791
+ name: z.ZodString;
792
+ description: z.ZodString;
793
+ args: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
794
+ name: z.ZodString;
795
+ description: z.ZodString;
796
+ required: z.ZodOptional<z.ZodBoolean>;
797
+ positional: z.ZodOptional<z.ZodBoolean>;
798
+ short: z.ZodOptional<z.ZodString>;
799
+ type: z.ZodOptional<z.ZodEnum<{
800
+ string: "string";
801
+ number: "number";
802
+ boolean: "boolean";
803
+ }>>;
804
+ }, z.core.$strip>>>>;
805
+ }, z.core.$strip>>>>;
806
+ hasInteractive: z.ZodOptional<z.ZodBoolean>;
807
+ }, z.core.$strip>;
808
+ /**
809
+ * Describes the storage requirements of an extension.
810
+ *
811
+ * Serializable metadata that the runtime uses to run migrations before
812
+ * starting the extension's service. The migrations path is relative to the
813
+ * extension root and resolved to an absolute path by the composition root.
814
+ * Bundled hosts may also provide a stable `migrationSourceId` so migration
815
+ * identity does not collapse onto packaged output paths.
816
+ */
817
+ interface StorageManifest {
818
+ /**
819
+ * Path to the Drizzle migration folder, relative to the extension root.
820
+ *
821
+ * The runtime resolves this to an absolute path and passes it to the
822
+ * host-supplied `runMigrations` callback
823
+ * before any extension services are started. The callback is responsible for
824
+ * applying pending migrations against the shared database using a
825
+ * per-extension tracking table to avoid filename collisions.
826
+ * @example 'drizzle'
827
+ */
828
+ readonly migrations?: string;
829
+ /**
830
+ * Stable runtime identity for the migration bundle.
831
+ *
832
+ * Hosts use this to key deduplication, ledger tables, and bundled migration
833
+ * lookup independently of the on-disk discovery path. When omitted, the
834
+ * resolved migration folder path remains the identity.
835
+ */
836
+ readonly migrationSourceId?: string;
837
+ }
838
+ /** Zod schema for {@link StorageManifest}. */
839
+ declare const StorageManifestSchema: z.ZodObject<{
840
+ migrations: z.ZodOptional<z.ZodString>;
841
+ migrationSourceId: z.ZodOptional<z.ZodString>;
842
+ }, z.core.$strip>;
843
+ /**
844
+ * A structured dependency declaration on another extension.
845
+ *
846
+ * Carries the dependency name, a semver version range the declared extension
847
+ * must satisfy, and an optional `optional` flag for non-fatal dependencies.
848
+ */
849
+ interface ExtensionDependency {
850
+ /** Discriminant — always `'extension'`. */
851
+ readonly type: 'extension';
852
+ /**
853
+ * {@link ExtensionManifest.name} of the required extension.
854
+ *
855
+ * Accepts the same plain or scoped npm identifier format as
856
+ * {@link ExtensionManifest.name}.
857
+ */
858
+ readonly name: string;
859
+ /**
860
+ * Semver range the installed extension version must satisfy.
861
+ *
862
+ * Uses the same syntax as npm range strings (e.g. `'>=1.0.0 <2.0.0'`,
863
+ * `'^1.5.0'`).
864
+ */
865
+ readonly version: VersionRange;
866
+ /**
867
+ * When `true` the extension may start even if this dependency is absent or
868
+ * fails to activate.
869
+ *
870
+ * Omitting this field is equivalent to `false`.
871
+ */
872
+ readonly optional?: boolean;
873
+ }
874
+ /** Zod schema for {@link ExtensionDependency}. */
875
+ declare const ExtensionDependencySchema: z.ZodObject<{
876
+ type: z.ZodLiteral<"extension">;
877
+ name: z.ZodString;
878
+ version: z.ZodString;
879
+ optional: z.ZodOptional<z.ZodBoolean>;
880
+ }, z.core.$strip>;
881
+ /**
882
+ * Factory that creates an {@link ExtensionDependency} with `type: 'extension'`.
883
+ *
884
+ * Prefer this helper over inline object literals to keep dependency
885
+ * declarations concise and consistent across package descriptors.
886
+ * @param name - {@link ExtensionManifest.name} of the required extension.
887
+ * @param version - Semver range the required extension must satisfy.
888
+ * @param optional - When `true`, activation continues if the dependency is absent.
889
+ * @returns A fully-typed {@link ExtensionDependency} object.
890
+ * @example
891
+ * dependencies: [dep('provider-anthropic'), dep('makaio.clients-core')]
892
+ */
893
+ declare function dep(name: string, version?: VersionRange, optional?: boolean): ExtensionDependency;
894
+ /**
895
+ * A typed runtime-environment gate that an extension declares it needs before
896
+ * the kernel will activate it.
897
+ *
898
+ * Two flavors are supported:
899
+ * - `'host'` — the runtime host must be present (e.g. `{ type: 'host', id: 'node' }`).
900
+ * - `'capability'` — the host must advertise the named capability token
901
+ * (e.g. `{ type: 'capability', id: 'storage.drizzle' }`). The optional
902
+ * `version` field requires the host capability to declare a satisfying
903
+ * concrete version.
904
+ *
905
+ * This is an environment compatibility gate, not an extension-to-extension
906
+ * dependency. Use {@link ExtensionManifest.dependencies} for structural ordering.
907
+ */
908
+ type RuntimeRequirement = {
909
+ readonly type: 'host';
910
+ readonly id: string;
911
+ } | {
912
+ readonly type: 'capability';
913
+ readonly id: string;
914
+ readonly version?: VersionRange;
915
+ };
916
+ /** Zod schema for {@link RuntimeRequirement}. */
917
+ declare const RuntimeRequirementSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
918
+ type: z.ZodLiteral<"host">;
919
+ id: z.ZodString;
920
+ }, z.core.$strip>, z.ZodObject<{
921
+ type: z.ZodLiteral<"capability">;
922
+ id: z.ZodString;
923
+ version: z.ZodOptional<z.ZodString>;
924
+ }, z.core.$strip>], "type">;
925
+ /**
926
+ * Pure-data manifest for a Makaio extension.
927
+ *
928
+ * Fully serializable and safe to inspect or transmit without executing any
929
+ * extension code. The shell and registry use this to discover extension surfaces
930
+ * (windows, tray, CLI, storage) before deciding whether to initialize them.
931
+ * @see {@link MakaioExtension} for the executable extension that adds `create`,
932
+ * typed CLI handlers, and storage registration.
933
+ */
934
+ interface ExtensionManifest {
935
+ /**
936
+ * Unique extension identifier.
937
+ *
938
+ * Accepts plain identifiers (e.g. `'account-manager'`) and npm-scoped
939
+ * names (e.g. `'@acme/weather-tools'`). Used as the primary key in the
940
+ * extension registry and as the top-level CLI command name when no
941
+ * {@link cli} override is provided.
942
+ */
943
+ readonly name: string;
944
+ /** Human-readable display name shown in UI surfaces (e.g. `'Auth Switcher'`). */
945
+ readonly displayName: string;
946
+ /**
947
+ * SemVer version of this extension package.
948
+ *
949
+ * Descriptor-only synthesized packages receive this from `descriptor.json`;
950
+ * code-defined executable packages declare the same field directly on their
951
+ * package object.
952
+ */
953
+ readonly version: VersionLiteral;
954
+ /**
955
+ * Execution surface the extension targets.
956
+ *
957
+ * - `'interactive'` — requires a UI shell (e.g., Electron renderer).
958
+ * - `'headless'` — suitable for daemon or CLI-only runtimes.
959
+ * - `'any'` — works in any surface (default when omitted).
960
+ */
961
+ readonly surface?: 'interactive' | 'headless' | 'any';
962
+ /**
963
+ * Structured dependencies on other extensions.
964
+ *
965
+ * The registry ensures all listed extensions are initialized before this
966
+ * extension starts. Each entry carries the dependency name, a semver version
967
+ * range the installed extension must satisfy, and an optional `optional` flag.
968
+ * @see {@link ExtensionDependency}
969
+ */
970
+ readonly dependencies?: readonly ExtensionDependency[];
971
+ /**
972
+ * Runtime-environment gates this extension must satisfy before the kernel
973
+ * activates it.
974
+ *
975
+ * Each entry is a {@link RuntimeRequirement} that declares either a required
976
+ * host identity (e.g. `'node'`) or a host-advertised capability token (e.g.
977
+ * `'storage.drizzle'`). All entries must be satisfied (AND semantics).
978
+ *
979
+ * This is an environment compatibility gate, not an extension-to-extension
980
+ * dependency. Use {@link dependencies} for structural extension ordering.
981
+ */
982
+ readonly requires?: readonly RuntimeRequirement[];
983
+ /**
984
+ * Capability tokens this extension provides when active.
985
+ *
986
+ * Consumers and onboarding surfaces can inspect these declarations to decide
987
+ * whether a capability exists at all before prompting the user to configure it.
988
+ */
989
+ readonly provides?: readonly CapabilityToken[];
990
+ /** Windows this extension can open, keyed by {@link WindowManifest.id}. */
991
+ readonly windows?: readonly WindowManifest[];
992
+ /** System tray entry for this extension. */
993
+ readonly tray?: TrayManifest;
994
+ /**
995
+ * CLI command contributed by this extension.
996
+ *
997
+ * On {@link ExtensionManifest} this is pure metadata. On {@link MakaioExtension}
998
+ * this is widened to `ExtensionCliContribution` with executable handlers.
999
+ */
1000
+ readonly cli?: CliManifest;
1001
+ /** Storage requirements (migrations) declared by this extension. */
1002
+ readonly storage?: StorageManifest;
1003
+ /**
1004
+ * Browser entry point for this extension.
1005
+ * URL path the renderer fetches to load the extension's UI.
1006
+ * @example '/extensions/my-extension/browser/index.js'
1007
+ */
1008
+ readonly browser?: BrowserEntrypoint;
1009
+ /**
1010
+ * Adapters and client binaries contributed by this extension.
1011
+ *
1012
+ * Discovery-time metadata only — serializable and safe to inspect without
1013
+ * loading any extension code. Runtime activation and registration use the
1014
+ * executable contribution fields on {@link MakaioExtension}; descriptor
1015
+ * metadata may mirror those fields for pre-load introspection but is not
1016
+ * used as a fallback wiring source.
1017
+ */
1018
+ readonly contributions?: ContributionManifest;
1019
+ }
1020
+ /** Zod schema for {@link ExtensionManifest}. */
1021
+ declare const ExtensionManifestSchema: z.ZodObject<{
1022
+ name: z.ZodString;
1023
+ displayName: z.ZodString;
1024
+ version: z.ZodString;
1025
+ surface: z.ZodOptional<z.ZodEnum<{
1026
+ any: "any";
1027
+ interactive: "interactive";
1028
+ headless: "headless";
1029
+ }>>;
1030
+ dependencies: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
1031
+ type: z.ZodLiteral<"extension">;
1032
+ name: z.ZodString;
1033
+ version: z.ZodString;
1034
+ optional: z.ZodOptional<z.ZodBoolean>;
1035
+ }, z.core.$strip>>>>;
1036
+ requires: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1037
+ type: z.ZodLiteral<"host">;
1038
+ id: z.ZodString;
1039
+ }, z.core.$strip>, z.ZodObject<{
1040
+ type: z.ZodLiteral<"capability">;
1041
+ id: z.ZodString;
1042
+ version: z.ZodOptional<z.ZodString>;
1043
+ }, z.core.$strip>], "type">>>>;
1044
+ provides: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodType<"adapters", unknown, z.core.$ZodTypeInternals<"adapters", unknown>>>>>;
1045
+ windows: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
1046
+ id: z.ZodString;
1047
+ style: z.ZodEnum<{
1048
+ "tray-popover": "tray-popover";
1049
+ utility: "utility";
1050
+ panel: "panel";
1051
+ }>;
1052
+ width: z.ZodOptional<z.ZodNumber>;
1053
+ height: z.ZodOptional<z.ZodNumber>;
1054
+ singleton: z.ZodOptional<z.ZodBoolean>;
1055
+ params: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
1056
+ name: z.ZodString;
1057
+ required: z.ZodOptional<z.ZodBoolean>;
1058
+ }, z.core.$strip>>>>;
1059
+ }, z.core.$strip>>>>;
1060
+ tray: z.ZodOptional<z.ZodObject<{
1061
+ label: z.ZodString;
1062
+ section: z.ZodOptional<z.ZodEnum<{
1063
+ tools: "tools";
1064
+ utilities: "utilities";
1065
+ views: "views";
1066
+ }>>;
1067
+ opensWindow: z.ZodOptional<z.ZodString>;
1068
+ action: z.ZodOptional<z.ZodString>;
1069
+ }, z.core.$strip>>;
1070
+ cli: z.ZodOptional<z.ZodObject<{
1071
+ name: z.ZodString;
1072
+ description: z.ZodString;
1073
+ subcommands: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
1074
+ name: z.ZodString;
1075
+ description: z.ZodString;
1076
+ args: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
1077
+ name: z.ZodString;
1078
+ description: z.ZodString;
1079
+ required: z.ZodOptional<z.ZodBoolean>;
1080
+ positional: z.ZodOptional<z.ZodBoolean>;
1081
+ short: z.ZodOptional<z.ZodString>;
1082
+ type: z.ZodOptional<z.ZodEnum<{
1083
+ string: "string";
1084
+ number: "number";
1085
+ boolean: "boolean";
1086
+ }>>;
1087
+ }, z.core.$strip>>>>;
1088
+ }, z.core.$strip>>>>;
1089
+ hasInteractive: z.ZodOptional<z.ZodBoolean>;
1090
+ }, z.core.$strip>>;
1091
+ storage: z.ZodOptional<z.ZodObject<{
1092
+ migrations: z.ZodOptional<z.ZodString>;
1093
+ migrationSourceId: z.ZodOptional<z.ZodString>;
1094
+ }, z.core.$strip>>;
1095
+ browser: z.ZodOptional<z.ZodObject<{
1096
+ entrypoint: z.ZodString;
1097
+ }, z.core.$strip>>;
1098
+ contributions: z.ZodOptional<z.ZodObject<{
1099
+ adapters: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
1100
+ name: z.ZodString;
1101
+ displayName: z.ZodOptional<z.ZodString>;
1102
+ description: z.ZodOptional<z.ZodString>;
1103
+ clients: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
1104
+ id: z.ZodString;
1105
+ version: z.ZodString;
1106
+ binaryVersion: z.ZodOptional<z.ZodString>;
1107
+ }, z.core.$strip>>>>;
1108
+ protocols: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
1109
+ anthropic: "anthropic";
1110
+ openai: "openai";
1111
+ }>, z.ZodObject<{
1112
+ anthropic: z.ZodOptional<z.ZodObject<{
1113
+ endpoint: z.ZodOptional<z.ZodString>;
1114
+ }, z.core.$strip>>;
1115
+ openai: z.ZodOptional<z.ZodObject<{
1116
+ endpoint: z.ZodOptional<z.ZodString>;
1117
+ }, z.core.$strip>>;
1118
+ }, z.core.$strip>]>>>;
1119
+ defaultProvider: z.ZodOptional<z.ZodString>;
1120
+ }, z.core.$strip>>>>;
1121
+ clients: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
1122
+ id: z.ZodString;
1123
+ name: z.ZodString;
1124
+ description: z.ZodOptional<z.ZodString>;
1125
+ binary: z.ZodOptional<z.ZodObject<{
1126
+ name: z.ZodString;
1127
+ }, z.core.$strict>>;
1128
+ }, z.core.$strict>>>>;
1129
+ providers: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
1130
+ id: z.ZodString;
1131
+ name: z.ZodString;
1132
+ description: z.ZodOptional<z.ZodString>;
1133
+ }, z.core.$strip>>>>;
1134
+ triggers: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
1135
+ prefix: z.ZodString;
1136
+ description: z.ZodOptional<z.ZodString>;
1137
+ stage: z.ZodOptional<z.ZodEnum<{
1138
+ transform: "transform";
1139
+ action: "action";
1140
+ gather: "gather";
1141
+ }>>;
1142
+ }, z.core.$strip>>>>;
1143
+ logImporters: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
1144
+ adapterName: z.ZodString;
1145
+ displayName: z.ZodString;
1146
+ logFilePattern: z.ZodOptional<z.ZodString>;
1147
+ }, z.core.$strip>>>>;
1148
+ sessionEventActions: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
1149
+ id: z.ZodString;
1150
+ label: z.ZodString;
1151
+ description: z.ZodOptional<z.ZodString>;
1152
+ icon: z.ZodOptional<z.ZodString>;
1153
+ selectionMode: z.ZodEnum<{
1154
+ single: "single";
1155
+ multi: "multi";
1156
+ }>;
1157
+ messageRoles: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
1158
+ user: "user";
1159
+ assistant: "assistant";
1160
+ }>>>>;
1161
+ }, z.core.$strip>>>>;
1162
+ create: z.ZodOptional<z.ZodBoolean>;
1163
+ tools: z.ZodOptional<z.ZodBoolean>;
1164
+ bootstrap: z.ZodOptional<z.ZodBoolean>;
1165
+ namespace: z.ZodOptional<z.ZodBoolean>;
1166
+ configSchema: z.ZodOptional<z.ZodBoolean>;
1167
+ uiConfig: z.ZodOptional<z.ZodBoolean>;
1168
+ ui: z.ZodOptional<z.ZodObject<{
1169
+ tiles: z.ZodOptional<z.ZodBoolean>;
1170
+ widgets: z.ZodOptional<z.ZodBoolean>;
1171
+ pages: z.ZodOptional<z.ZodBoolean>;
1172
+ routes: z.ZodOptional<z.ZodBoolean>;
1173
+ }, z.core.$strip>>;
1174
+ }, z.core.$strip>>;
1175
+ }, z.core.$strip>;
1176
+ //#endregion
1177
+ //#region packages/contracts/src/extension/extension-token.d.ts
1178
+ /**
1179
+ * Typed extension service tokens.
1180
+ *
1181
+ * Extension tokens pair a runtime extension name with the service type the
1182
+ * extension exposes. Consumers import an extension-owned token instead of
1183
+ * repeating string literals at service lookup call sites.
1184
+ */
1185
+ /**
1186
+ * Typed token for retrieving an extension service from an extension context.
1187
+ *
1188
+ * The type parameter is intentionally phantom: the runtime uses {@link name}
1189
+ * while TypeScript carries the expected service type through `getService`.
1190
+ * @typeParam T - Service type exposed by the extension.
1191
+ */
1192
+ interface ExtensionToken<T = unknown> {
1193
+ /** Extension name registered with the runtime coordinator. */
1194
+ readonly name: string;
1195
+ /** Phantom marker for the token's service type. */
1196
+ readonly __service?: T;
1197
+ }
1198
+ /**
1199
+ * Create a typed extension service token.
1200
+ * @param name - Extension name registered with the runtime coordinator.
1201
+ * @returns Frozen token carrying the extension name and service type.
1202
+ */
1203
+ declare function extensionToken<T>(name: string): ExtensionToken<T>;
1204
+ //#endregion
1205
+ //#region packages/contracts/src/extension/adapter-definition.d.ts
1206
+ /**
1207
+ * Adapter-side declaration of a supported provider.
1208
+ *
1209
+ * The adapter declares which providers it can serve by stable definition ID.
1210
+ * The adapter subsystem resolves each ID to a full {@link ProviderDefinitionInput}
1211
+ * from the provider registry at boot. Optional schemas override the adapter-level
1212
+ * defaults for this specific provider.
1213
+ */
1214
+ interface AdapterProviderRef {
1215
+ /** Stable provider definition ID (e.g., `'anthropic'`, `'openai'`). */
1216
+ readonly definitionId: string;
1217
+ /**
1218
+ * Provider-specific config schema override.
1219
+ *
1220
+ * When present, overrides any adapter-level config schema for this provider.
1221
+ */
1222
+ readonly configSchema?: z.ZodObject<z.ZodRawShape>;
1223
+ /**
1224
+ * Provider-specific credential schema override.
1225
+ *
1226
+ * When present, overrides any adapter-level credential schema for this provider.
1227
+ */
1228
+ readonly credentialSchema?: z.ZodObject<z.ZodRawShape>;
1229
+ }
1230
+ /**
1231
+ * Runtime contract for a single provider supported by an adapter.
1232
+ *
1233
+ * This type is the single source of truth for the provider definition wrapper.
1234
+ * Both `ai-adapters-core/src/types/provider-definition.ts` and
1235
+ * `adapter-subsystem/src/adapter-runtime-types.ts` extend or alias this type.
1236
+ */
1237
+ interface AdapterProviderDefinitionContract {
1238
+ /**
1239
+ * Provider identity, model catalog, and endpoint declarations.
1240
+ *
1241
+ * Accepts {@link ProviderDefinitionInput} so adapter packages that declare
1242
+ * static `providerDefinition` constants can omit `availableModels` (which
1243
+ * the registry service populates at boot time). The runtime-resolved type
1244
+ * narrows after the adapter subsystem merges the registry data.
1245
+ */
1246
+ readonly definition: ProviderDefinitionInput;
1247
+ /**
1248
+ * Zod schema for provider-specific configuration fields.
1249
+ *
1250
+ * When present, the adapter subsystem uses this schema to validate and
1251
+ * expose provider configuration via the settings bus handlers.
1252
+ * Not serializable — kept in the definition, not the manifest.
1253
+ */
1254
+ readonly configSchema?: z.ZodObject<z.ZodRawShape>;
1255
+ /**
1256
+ * Zod schema for provider credential fields (e.g., API key, token).
1257
+ *
1258
+ * When present, the adapter subsystem uses this schema to validate
1259
+ * credentials before forwarding them to the adapter factory.
1260
+ * Not serializable — kept in the definition, not the manifest.
1261
+ */
1262
+ readonly credentialSchema?: z.ZodObject<z.ZodRawShape>;
1263
+ }
1264
+ /**
1265
+ * Runtime contract for an adapter contributed by an extension.
1266
+ *
1267
+ * Contains all fields needed by the `AdapterSubsystemService` to register,
1268
+ * initialize, and manage the adapter lifecycle. The generic type parameters
1269
+ * allow higher-level adapter types (e.g., `AIAdapterDefinition`) to narrow
1270
+ * both the return type of {@link createAdapter} and the options it accepts,
1271
+ * without violating TypeScript's contravariant parameter-type rules.
1272
+ *
1273
+ * This interface is not Zod-validatable because it contains functions and
1274
+ * Zod schemas as values. The serializable counterpart is `AdapterManifest`.
1275
+ * @typeParam TAdapter - Concrete adapter instance type returned by {@link createAdapter}.
1276
+ * Defaults to `unknown` so the contract is usable without a type parameter.
1277
+ * @typeParam TOptions - Options type accepted by {@link createAdapter}.
1278
+ * Defaults to `never` so the type-erased base contract (`AdapterContribution.definition`)
1279
+ * is structurally compatible with any specialised definition via contravariance:
1280
+ * `(options?: ConcreteOptions) => Promise<T>` is assignable to `(options?: never) => Promise<T>`.
1281
+ * Specialised adapter interfaces (e.g. `AIAdapterDefinition`) pass a narrower
1282
+ * options type here to gain compile-time safety in their factory signatures.
1283
+ */
1284
+ interface AdapterDefinitionContract<TAdapter = unknown, TOptions = never> {
1285
+ /**
1286
+ * Stable machine identifier for this adapter (e.g., `'claude-code'`).
1287
+ *
1288
+ * Must match `AdapterManifest.name` on the paired manifest entry.
1289
+ * Used as the primary key in adapter registries.
1290
+ */
1291
+ readonly name: string;
1292
+ /**
1293
+ * Human-readable display name shown in the UI (e.g., `'Claude Code'`).
1294
+ *
1295
+ * When omitted, the subsystem falls back to `AdapterManifest.displayName`.
1296
+ */
1297
+ readonly displayName?: string;
1298
+ /** Short description of what this adapter does. */
1299
+ readonly description?: string;
1300
+ /**
1301
+ * Zod schema for adapter-level configuration.
1302
+ *
1303
+ * Used by the `settings.adapter.getConfigSchema` bus handler to generate
1304
+ * JSON Schema for UI form rendering. Currently a seam — no adapter populates
1305
+ * this yet, but it is correctly placed on the definition contract for future
1306
+ * adapter-level configuration UI.
1307
+ */
1308
+ readonly adapterConfigSchema?: z.ZodObject<z.ZodRawShape>;
1309
+ /**
1310
+ * Provider IDs this adapter can serve.
1311
+ *
1312
+ * Each entry declares a provider by definition ID with optional schema
1313
+ * overrides. The adapter subsystem resolves these to full
1314
+ * {@link ProviderDefinitionInput} objects at boot from the provider registry.
1315
+ */
1316
+ readonly providers: readonly AdapterProviderRef[];
1317
+ /**
1318
+ * Default config schema applied to all providers unless overridden
1319
+ * per-provider via {@link AdapterProviderRef.configSchema}.
1320
+ */
1321
+ readonly providerConfigSchema?: z.ZodObject<z.ZodRawShape>;
1322
+ /**
1323
+ * Default credential schema applied to all providers unless overridden
1324
+ * per-provider via {@link AdapterProviderRef.credentialSchema}.
1325
+ */
1326
+ readonly providerCredentialSchema?: z.ZodObject<z.ZodRawShape>;
1327
+ /**
1328
+ * Required timeout defaults for all adapter operations.
1329
+ *
1330
+ * The config factory should read these values instead of importing a
1331
+ * parallel constant, making this contract the single source of truth
1332
+ * for adapter timeout behavior.
1333
+ */
1334
+ readonly defaultTimeouts: RequiredTimeoutConfig;
1335
+ /**
1336
+ * External help links for this adapter (e.g., documentation, support).
1337
+ *
1338
+ * Displayed in the adapter settings UI when present.
1339
+ */
1340
+ readonly helpLinks?: ReadonlyArray<{
1341
+ label: string;
1342
+ url: string;
1343
+ }>;
1344
+ /**
1345
+ * Setup or usage instructions shown in the adapter configuration UI.
1346
+ *
1347
+ * May contain Markdown-formatted text.
1348
+ */
1349
+ readonly instructions?: string;
1350
+ /**
1351
+ * Identifier of the default provider preset for this adapter.
1352
+ *
1353
+ * When omitted, the runtime or user selects the preset.
1354
+ */
1355
+ readonly defaultPresetId?: string;
1356
+ /**
1357
+ * Client identifier this adapter delegates to (e.g., `'claude-code'`).
1358
+ *
1359
+ * References a `ClientManifest.id` declared on the executable
1360
+ * {@link AdapterContribution.manifest}; descriptor contributions may mirror
1361
+ * it for discovery but are not the runtime wiring source.
1362
+ */
1363
+ readonly clientId?: string;
1364
+ /**
1365
+ * Active wire protocol used by this adapter at runtime.
1366
+ *
1367
+ * This is the singular runtime-active protocol consumed by the subsystem
1368
+ * to route requests. The serializable counterpart (`AdapterManifest.protocols`)
1369
+ * may declare additional protocols for discovery-time use.
1370
+ */
1371
+ readonly protocol?: ProtocolId;
1372
+ /**
1373
+ * Factory that creates the adapter instance.
1374
+ *
1375
+ * Called by the subsystem after all configuration is resolved. The
1376
+ * `options` parameter receives merged adapter config (preset + user
1377
+ * overrides). The returned promise resolves to the typed adapter instance.
1378
+ * @param options - Resolved adapter configuration (shape defined by the adapter).
1379
+ * @returns Promise resolving to the adapter instance.
1380
+ */
1381
+ readonly createAdapter: (options?: TOptions) => Promise<TAdapter>;
1382
+ }
1383
+ //#endregion
1384
+ //#region packages/contracts/src/extension/extension-warning.d.ts
1385
+ /**
1386
+ * Discriminated union of actionable responses to an extension warning.
1387
+ *
1388
+ * Each variant carries the data the host needs to execute the action without
1389
+ * further round-trips to the extension.
1390
+ *
1391
+ * - `configure-integration` — open the integration settings for a client.
1392
+ * - `install-extension` — prompt the user to install another extension.
1393
+ * - `open-url` — navigate to an external or internal URL.
1394
+ * - `run-command` — invoke a registered bus command by name.
1395
+ */
1396
+ declare const ExtensionWarningActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1397
+ kind: z.ZodLiteral<"configure-integration">;
1398
+ clientId: z.ZodString;
1399
+ bundle: z.ZodString;
1400
+ }, z.core.$strip>, z.ZodObject<{
1401
+ kind: z.ZodLiteral<"install-extension">;
1402
+ extensionName: z.ZodString;
1403
+ }, z.core.$strip>, z.ZodObject<{
1404
+ kind: z.ZodLiteral<"open-url">;
1405
+ url: z.ZodString;
1406
+ }, z.core.$strip>, z.ZodObject<{
1407
+ kind: z.ZodLiteral<"run-command">;
1408
+ command: z.ZodString;
1409
+ }, z.core.$strip>], "kind">;
1410
+ /**
1411
+ * Severity levels for an {@link ExtensionWarning}.
1412
+ *
1413
+ * - `'info'` — informational note; the extension functions normally.
1414
+ * - `'recommended'` — a recommended configuration is missing; functionality is reduced.
1415
+ * - `'degraded'` — the extension is operating in a degraded fallback mode.
1416
+ */
1417
+ declare const ExtensionWarningSeveritySchema: z.ZodEnum<{
1418
+ info: "info";
1419
+ recommended: "recommended";
1420
+ degraded: "degraded";
1421
+ }>;
1422
+ /**
1423
+ * A single health warning emitted by a package's `checkHealth` hook.
1424
+ *
1425
+ * The host collects these after startup and may display them in the UI as
1426
+ * notification toasts or persistent status indicators.
1427
+ */
1428
+ declare const ExtensionWarningSchema: z.ZodObject<{
1429
+ severity: z.ZodEnum<{
1430
+ info: "info";
1431
+ recommended: "recommended";
1432
+ degraded: "degraded";
1433
+ }>;
1434
+ title: z.ZodString;
1435
+ message: z.ZodString;
1436
+ action: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1437
+ kind: z.ZodLiteral<"configure-integration">;
1438
+ clientId: z.ZodString;
1439
+ bundle: z.ZodString;
1440
+ }, z.core.$strip>, z.ZodObject<{
1441
+ kind: z.ZodLiteral<"install-extension">;
1442
+ extensionName: z.ZodString;
1443
+ }, z.core.$strip>, z.ZodObject<{
1444
+ kind: z.ZodLiteral<"open-url">;
1445
+ url: z.ZodString;
1446
+ }, z.core.$strip>, z.ZodObject<{
1447
+ kind: z.ZodLiteral<"run-command">;
1448
+ command: z.ZodString;
1449
+ }, z.core.$strip>], "kind">>;
1450
+ }, z.core.$strip>;
1451
+ /** Inferred TypeScript type for {@link ExtensionWarningSchema}. */
1452
+ type ExtensionWarning = z.infer<typeof ExtensionWarningSchema>;
1453
+ /** Inferred TypeScript type for {@link ExtensionWarningActionSchema}. */
1454
+ type ExtensionWarningAction = z.infer<typeof ExtensionWarningActionSchema>;
1455
+ /** Inferred TypeScript type for {@link ExtensionWarningSeveritySchema}. */
1456
+ type ExtensionWarningSeverity = z.infer<typeof ExtensionWarningSeveritySchema>;
1457
+ /**
1458
+ * Return the default user-facing label for an extension warning action.
1459
+ *
1460
+ * Kept with the action contract so every surface labels the same action kind
1461
+ * consistently without duplicating switch statements.
1462
+ * @param action - Extension warning action to label.
1463
+ * @returns Short button label for the action kind.
1464
+ */
1465
+ declare function getExtensionWarningActionLabel(action: ExtensionWarningAction): string;
1466
+ /**
1467
+ * Aggregated warning entry grouping all health warnings for a single extension.
1468
+ *
1469
+ * Used as the payload shape for `kernel:extension.warnings.list` responses and
1470
+ * `kernel:extension.warnings.changed` events so consumers receive extension identity
1471
+ * alongside the full warning array in one atomic value.
1472
+ */
1473
+ declare const ExtensionWarningEntrySchema: z.ZodObject<{
1474
+ extensionName: z.ZodString;
1475
+ warnings: z.ZodArray<z.ZodObject<{
1476
+ severity: z.ZodEnum<{
1477
+ info: "info";
1478
+ recommended: "recommended";
1479
+ degraded: "degraded";
1480
+ }>;
1481
+ title: z.ZodString;
1482
+ message: z.ZodString;
1483
+ action: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1484
+ kind: z.ZodLiteral<"configure-integration">;
1485
+ clientId: z.ZodString;
1486
+ bundle: z.ZodString;
1487
+ }, z.core.$strip>, z.ZodObject<{
1488
+ kind: z.ZodLiteral<"install-extension">;
1489
+ extensionName: z.ZodString;
1490
+ }, z.core.$strip>, z.ZodObject<{
1491
+ kind: z.ZodLiteral<"open-url">;
1492
+ url: z.ZodString;
1493
+ }, z.core.$strip>, z.ZodObject<{
1494
+ kind: z.ZodLiteral<"run-command">;
1495
+ command: z.ZodString;
1496
+ }, z.core.$strip>], "kind">>;
1497
+ }, z.core.$strip>>;
1498
+ }, z.core.$strip>;
1499
+ /** Inferred TypeScript type for {@link ExtensionWarningEntrySchema}. */
1500
+ type ExtensionWarningEntry = z.infer<typeof ExtensionWarningEntrySchema>;
1501
+ //#endregion
1502
+ //#region packages/contracts/src/extension/extension-lifecycle.d.ts
1503
+ declare const extensionIdentityBrand: unique symbol;
1504
+ /**
1505
+ * Opaque extension identity minted by the runtime coordinator.
1506
+ *
1507
+ * This identity proves which loaded extension is calling runtime-owned seams
1508
+ * such as future direct channels. Extension code receives it through
1509
+ * {@link ExtensionContext.identity}; external callers cannot construct one
1510
+ * without a type assertion.
1511
+ */
1512
+ interface ExtensionIdentity {
1513
+ /** Extension name associated with this identity. */
1514
+ readonly extensionName: string;
1515
+ /** Opaque brand preventing structural construction. */
1516
+ readonly [extensionIdentityBrand]: true;
1517
+ }
1518
+ /**
1519
+ * Minimal lifecycle shape accepted as an extension service.
1520
+ *
1521
+ * BaseService satisfies this interface, but plain service classes can also
1522
+ * participate in extension startup when they expose the same lifecycle.
1523
+ */
1524
+ interface ExtensionServiceLifecycle {
1525
+ /** Initialize the service when startup work is not constructor-owned. */
1526
+ init?(): Promise<void> | void;
1527
+ /** Destroy the service and release resources when teardown is required. */
1528
+ destroy?(): Promise<void> | void;
1529
+ /**
1530
+ * Called after the extension reaches active state.
1531
+ *
1532
+ * Returns zero or more {@link ExtensionWarning} entries describing integration
1533
+ * health issues the user may want to act on. An empty array (or omitting the
1534
+ * hook entirely) signals that the extension is fully healthy.
1535
+ * @returns Active health warnings, or an empty array when the extension is healthy.
1536
+ */
1537
+ checkHealth?(): Promise<ExtensionWarning[]> | ExtensionWarning[];
1538
+ }
1539
+ /**
1540
+ * Service shape returned by {@link MakaioExtension.create}.
1541
+ *
1542
+ * Any class that extends `BaseService` satisfies this interface structurally
1543
+ * because `BaseService` exposes the same lifecycle methods.
1544
+ */
1545
+ type ExtensionService = ExtensionServiceLifecycle;
1546
+ //#endregion
1547
+ //#region packages/contracts/src/extension/extension-context.d.ts
1548
+ /**
1549
+ * Generic context provided by a host runtime when creating an extension's service.
1550
+ *
1551
+ * Contains host-agnostic runtime seams: the bus instance, extension identity,
1552
+ * extension-local data directory, machine identity, config, service lookup, and
1553
+ * lifecycle controls. Host-specific environment details belong on explicit
1554
+ * context extensions such as {@link NodeExtensionContext}.
1555
+ */
1556
+ interface ExtensionContext<TBus extends MakaioBusLike = MakaioBusLike> {
1557
+ /** Bus instance for registering handlers and emitting events. */
1558
+ readonly bus: TBus;
1559
+ /** Coordinator-minted identity for the extension being created. */
1560
+ readonly identity: ExtensionIdentity;
1561
+ /**
1562
+ * Per-extension writable data directory resolved by the host runtime.
1563
+ *
1564
+ * Use this for extension-local persistence (caches, state files, etc.).
1565
+ */
1566
+ readonly dataDir: string;
1567
+ /**
1568
+ * Stable machine identifier used for machine-scoped persistence and
1569
+ * encryption key derivation.
1570
+ *
1571
+ * Resolved by the composition root (e.g., `node-machine-id`) before
1572
+ * extensions are started.
1573
+ */
1574
+ readonly machineId: string;
1575
+ /**
1576
+ * Resolved configuration for this extension, merged from stored values and
1577
+ * descriptor defaults. Present only when the extension declared a
1578
+ * `configSchema` on its {@link MakaioExtension}.
1579
+ *
1580
+ * Extensions should parse this with their Zod schema to get typed config:
1581
+ * ```ts
1582
+ * const config = parseExtensionConfig(MyConfigSchema, ctx.config);
1583
+ * ```
1584
+ */
1585
+ readonly config?: unknown;
1586
+ /**
1587
+ * Retrieve a service exposed by another active extension.
1588
+ * @param token - Extension-owned token identifying the desired service.
1589
+ * @returns The active service instance, or `undefined` when unavailable.
1590
+ */
1591
+ getService<T>(token: ExtensionToken<T>): T | undefined;
1592
+ /**
1593
+ * Attempt a dynamic import, returning `null` when the package is not installed.
1594
+ *
1595
+ * Only swallows errors caused by the package itself being absent. Transitive
1596
+ * dependency failures and module evaluation errors are re-thrown.
1597
+ * @typeParam T - Expected module shape (caller-asserted, not runtime-verified).
1598
+ * @param specifier - Package specifier to import.
1599
+ * @returns The imported module cast to `T`, or `null` when the package is not installed.
1600
+ */
1601
+ readonly tryImport: <T>(specifier: string) => Promise<T | null>;
1602
+ /**
1603
+ * Abort signal triggered during graceful shutdown.
1604
+ *
1605
+ * Extensions can pass this to long-running operations (fetch, timers, streams)
1606
+ * so they cancel promptly when the runtime is stopping.
1607
+ */
1608
+ readonly signal: AbortSignal;
1609
+ /**
1610
+ * Check whether an extension with the given name is active.
1611
+ *
1612
+ * Returns `true` when the named extension has been loaded and reached
1613
+ * `active` state. Use this for optional integration checks without
1614
+ * requiring an ExtensionToken.
1615
+ * @param name - Extension name to check.
1616
+ * @returns `true` when the extension is active.
1617
+ */
1618
+ readonly hasExtension: (name: string) => boolean;
1619
+ }
1620
+ /**
1621
+ * Node.js host extension context.
1622
+ *
1623
+ * Adds the OS and filesystem fields supplied by Node-based composition roots.
1624
+ * Extensions that need these fields should opt into this context explicitly;
1625
+ * host-agnostic extensions can type themselves against {@link ExtensionContext}.
1626
+ */
1627
+ interface NodeExtensionContext<TBus extends MakaioBusLike = MakaioBusLike> extends ExtensionContext<TBus> {
1628
+ /** Current platform identifier (e.g., `'darwin'`, `'linux'`, `'win32'`). */
1629
+ readonly platform: NodeJS.Platform;
1630
+ /** User's home directory path. */
1631
+ readonly homedir: string;
1632
+ /** Resolved `.makaio` directory root (e.g., `~/.makaio`). */
1633
+ readonly makaioHome: string;
1634
+ /** Current OS username. */
1635
+ readonly username: string;
1636
+ /**
1637
+ * WebSocket URL for the host bus, when the runtime exposes one.
1638
+ *
1639
+ * Detached `bus-websocket` extensions use this to connect back to the host.
1640
+ * Hosts without a WebSocket bus omit it.
1641
+ */
1642
+ readonly busUrl?: string;
1643
+ }
1644
+ //#endregion
1645
+ //#region packages/contracts/src/extension/extension-cli.d.ts
1646
+ /**
1647
+ * Type-erased output channel used by extension-local CLI handlers.
1648
+ *
1649
+ * Runtime code exposes the fully typed helper API via `@makaio/kernel/cli`.
1650
+ */
1651
+ interface ExtensionCliOutputWriter {
1652
+ /** Write text to standard output. */
1653
+ write(text: string): void;
1654
+ /** Write text to standard error. */
1655
+ error(text: string): void;
1656
+ }
1657
+ /**
1658
+ * Type-erased handler context stored in the contracts layer.
1659
+ *
1660
+ * Runtime code provides the fully typed variant in `@makaio/kernel/cli`.
1661
+ */
1662
+ interface ExtensionCliHandlerContext<TBus extends MakaioBusLike = MakaioBusLike> {
1663
+ /** Parsed and validated command arguments/options. */
1664
+ readonly args: unknown;
1665
+ /**
1666
+ * Bus client connected to the running Makaio instance.
1667
+ *
1668
+ * `null` when the bus is unavailable and the contribution's `beforeRun`
1669
+ * hook opted into offline execution.
1670
+ */
1671
+ readonly bus: TBus | null;
1672
+ /** Output channel for writing to stdout and stderr. */
1673
+ readonly output: ExtensionCliOutputWriter;
1674
+ /** Abort signal triggered when the invocation is cancelled. */
1675
+ readonly signal: AbortSignal;
1676
+ /**
1677
+ * Set the process-style exit code for the current command invocation.
1678
+ * @param exitCode - Command exit code to report.
1679
+ */
1680
+ setExitCode(exitCode: number): void;
1681
+ }
1682
+ /**
1683
+ * Interactive entry context stored in the contracts layer.
1684
+ */
1685
+ interface ExtensionCliInteractiveContext<TBus extends MakaioBusLike = MakaioBusLike> {
1686
+ /**
1687
+ * Bus client connected to the running Makaio instance.
1688
+ *
1689
+ * `null` when the bus is unavailable and the contribution's `beforeRun`
1690
+ * hook opted into bus-optional execution.
1691
+ */
1692
+ readonly bus: TBus | null;
1693
+ }
1694
+ /**
1695
+ * Type-erased CLI subcommand entry for collection storage.
1696
+ *
1697
+ * See `@makaio/kernel/cli` for the full typed API including
1698
+ * `defineCliSubcommand`.
1699
+ */
1700
+ interface ExtensionCliSubcommandEntry<TBus extends MakaioBusLike = MakaioBusLike> {
1701
+ /** Subcommand name. */
1702
+ readonly name: string;
1703
+ /** One-line description shown in help text. */
1704
+ readonly description: string;
1705
+ /** Minimal parse-only schema contract kept free of runtime Zod APIs. */
1706
+ readonly schema: {
1707
+ parse(v: unknown): unknown;
1708
+ };
1709
+ /** Handler invoked with the type-erased CLI execution context. */
1710
+ readonly handler: (ctx: ExtensionCliHandlerContext<TBus>) => Promise<void>;
1711
+ }
1712
+ /**
1713
+ * Type-erased context for the {@link ExtensionCliContribution.beforeRun} gate.
1714
+ */
1715
+ interface ExtensionCliBeforeRunContext<TBus extends MakaioBusLike = MakaioBusLike> {
1716
+ /** Subcommand name, or `'__interactive__'` for bare interactive invocations. */
1717
+ readonly subcommandName: string;
1718
+ /** Parsed and validated arguments for the subcommand. */
1719
+ readonly args: Record<string, unknown>;
1720
+ /** Bus client, or `null` when the server is unreachable. */
1721
+ readonly bus: TBus | null;
1722
+ }
1723
+ /**
1724
+ * Type-erased result of an {@link ExtensionCliContribution.beforeRun} gate.
1725
+ */
1726
+ type ExtensionCliBeforeRunResult = {
1727
+ readonly proceed: true;
1728
+ } | {
1729
+ readonly proceed: false;
1730
+ readonly message: string;
1731
+ readonly exitCode?: number;
1732
+ };
1733
+ /**
1734
+ * An extension's CLI contribution declared in its `MakaioExtension` manifest.
1735
+ *
1736
+ * Full implementation types live in `@makaio/kernel/cli`. This contract
1737
+ * keeps the extension layer on the executable shape only.
1738
+ */
1739
+ interface ExtensionCliContribution<TBus extends MakaioBusLike = MakaioBusLike> extends CliManifest {
1740
+ /**
1741
+ * Interactive TUI launched when the command is invoked without a subcommand.
1742
+ */
1743
+ readonly interactive?: (ctx: ExtensionCliInteractiveContext<TBus>) => Promise<void>;
1744
+ /** Declared subcommands exposed by this contribution. */
1745
+ readonly subcommands: ReadonlyArray<ExtensionCliSubcommandEntry<TBus>>;
1746
+ /**
1747
+ * Pre-execution gate that replaces the default bus-required check.
1748
+ * @param context - Subcommand name, parsed args, and bus availability.
1749
+ * @returns Whether to proceed or block with a message.
1750
+ */
1751
+ readonly beforeRun?: (context: ExtensionCliBeforeRunContext<TBus>) => ExtensionCliBeforeRunResult | Promise<ExtensionCliBeforeRunResult>;
1752
+ }
1753
+ //#endregion
1754
+ //#region packages/contracts/src/extension/extension-runtime-boot.d.ts
1755
+ /**
1756
+ * Runtime subsystems with exactly one executable owner per boot.
1757
+ *
1758
+ * These declarations are runtime-owned metadata on {@link MakaioExtension},
1759
+ * not descriptor discovery metadata. Boot uses them to select default
1760
+ * framework packages only when no loaded extension provides the same
1761
+ * executable responsibility.
1762
+ */
1763
+ interface ExtensionRuntimeOwnership {
1764
+ /** Owns the `session.sendMessage` orchestration handlers for this runtime. */
1765
+ readonly sessionOrchestrator?: boolean;
1766
+ }
1767
+ //#endregion
1768
+ //#region packages/contracts/src/extension/contributions/session-event-action-types.d.ts
1769
+ /** Keyboard modifier flags for an action shortcut. */
1770
+ interface ActionShortcutModifiers {
1771
+ /** Meta/Command key. */
1772
+ meta?: boolean;
1773
+ /** Alt/Option key. */
1774
+ alt?: boolean;
1775
+ /** Shift key. */
1776
+ shift?: boolean;
1777
+ /** Control key. */
1778
+ ctrl?: boolean;
1779
+ }
1780
+ /** Full keyboard shortcut definition including modifiers and display metadata. */
1781
+ interface ActionShortcut extends ActionShortcutModifiers {
1782
+ /** Primary key character or name. */
1783
+ key: string;
1784
+ /** Human-readable label shown in keyboard shortcut hints. */
1785
+ label: string;
1786
+ /** Category grouping for the shortcut. */
1787
+ category: ActionCategory;
1788
+ /** Optional human-readable description. */
1789
+ description?: string;
1790
+ /** Whether the shortcut should not activate while focus is in an input field. */
1791
+ skipInInputs?: boolean;
1792
+ /** Optional context scope string or list of scopes. */
1793
+ context?: string | string[];
1794
+ }
1795
+ /**
1796
+ * Extension point for registering custom action categories.
1797
+ *
1798
+ * Extend via declaration merging from packages or UI layers.
1799
+ * @example
1800
+ * ```typescript
1801
+ * declare module '@makaio/framework/contracts' {
1802
+ * interface ActionCategoryMap {
1803
+ * timeline: true;
1804
+ * }
1805
+ * }
1806
+ * ```
1807
+ */
1808
+ interface ActionCategoryMap {
1809
+ /** Default category for uncategorized actions. */
1810
+ general: true;
1811
+ }
1812
+ type RegisteredActionCategory = keyof ActionCategoryMap & string;
1813
+ /** Resolved action category type, extensible via {@link ActionCategoryMap} declaration merging. */
1814
+ type ActionCategory = RegisteredActionCategory;
1815
+ /** Allowed message role values for event action entrypoints. */
1816
+ type MessageRole = 'user' | 'assistant';
1817
+ /** Event filter that matches message events with optional role restriction. */
1818
+ interface MessageEventFilter {
1819
+ /** Discriminant: must be `'message'`. */
1820
+ eventType: 'message';
1821
+ /** Optional list of message roles this filter applies to. */
1822
+ messageRole?: MessageRole[];
1823
+ }
1824
+ /** All core session event types except `'message'`. */
1825
+ type StructuralEventType = Exclude<(typeof SESSION_EVENT_TYPES)[number], 'message'>;
1826
+ /** Event filter that matches structural (non-message) session events. */
1827
+ interface StructuralEventFilter {
1828
+ /** The specific structural event type to match. */
1829
+ eventType: StructuralEventType;
1830
+ }
1831
+ /** Union of message and structural event filters. */
1832
+ type EventFilter = MessageEventFilter | StructuralEventFilter;
1833
+ /**
1834
+ * Context passed to a session event action factory.
1835
+ * @typeParam TBus - Host bus shape supplied by the runtime.
1836
+ */
1837
+ interface SessionEventActionContext<TBus extends MakaioBusLike = MakaioBusLike> {
1838
+ /** Bus instance for registering action handlers. */
1839
+ bus: TBus;
1840
+ /** Name of the extension registering the action. */
1841
+ extensionName: string;
1842
+ /**
1843
+ * Register one executable action with the owning session-event-action service.
1844
+ *
1845
+ * The service package owns the bus subjects and callback plumbing; extension
1846
+ * contributors receive this factory through the contribution context instead
1847
+ * of importing service implementation modules directly.
1848
+ * @param options - Action declaration and runtime callbacks.
1849
+ * @returns Serializable declaration plus unregister hook.
1850
+ */
1851
+ createAction: <TMode extends 'single' | 'multi', TRoles extends MessageRole[]>(options: SessionEventActionOptions<TMode, TRoles, TBus>) => CreateSessionEventActionResult;
1852
+ }
1853
+ /**
1854
+ * Context passed to a session event action's `when` predicate.
1855
+ * @typeParam TRoles - Message roles accepted by the action entrypoint.
1856
+ * @typeParam TBus - Host bus shape supplied by the runtime.
1857
+ */
1858
+ interface WhenContext<TRoles extends MessageRole[] = MessageRole[], TBus extends MakaioBusLike = MakaioBusLike> {
1859
+ /** The message event that triggered the predicate check. */
1860
+ message: SessionMessage & {
1861
+ role: TRoles[number];
1862
+ };
1863
+ /** Active session identifier. */
1864
+ sessionId: string;
1865
+ /** Bus instance for runtime queries. */
1866
+ bus: TBus;
1867
+ }
1868
+ /**
1869
+ * Context passed to a session event action's `onPickerOpen` callback.
1870
+ * @typeParam TRoles - Message roles accepted by the action entrypoint.
1871
+ * @typeParam TBus - Host bus shape supplied by the runtime.
1872
+ */
1873
+ interface PickerOpenContext<TRoles extends MessageRole[] = MessageRole[], TBus extends MakaioBusLike = MakaioBusLike> {
1874
+ /** Entrypoint information for the action. */
1875
+ entrypoint: {
1876
+ /** The message that was actioned. */messageId: string; /** Full message object. */
1877
+ message: SessionMessage & {
1878
+ role: TRoles[number];
1879
+ };
1880
+ };
1881
+ /** Active session identifier. */
1882
+ sessionId: string;
1883
+ /** Active project identifier. */
1884
+ projectId?: string;
1885
+ /** Bus instance for runtime queries. */
1886
+ bus: TBus;
1887
+ }
1888
+ /** Configuration returned by `onPickerOpen` to control the event picker UI. */
1889
+ interface PickerConfig {
1890
+ /** Event IDs that should be pre-selected when the picker opens. */
1891
+ preSelectedEventIds?: string[];
1892
+ /** Maximum number of events that can be selected. */
1893
+ maxSelections?: number;
1894
+ /** Custom title for the picker dialog. */
1895
+ title?: string;
1896
+ }
1897
+ /**
1898
+ * Context passed to a session event action's `onSelectionChange` callback.
1899
+ * @typeParam TBus - Host bus shape supplied by the runtime.
1900
+ */
1901
+ interface SelectionChangeContext<TBus extends MakaioBusLike = MakaioBusLike> {
1902
+ /** Currently selected session events. */
1903
+ selectedEvents: MakaioSessionEvent[];
1904
+ /** Entrypoint information for the action. */
1905
+ entrypoint: {
1906
+ /** The message that was actioned. */messageId: string; /** Full message object. */
1907
+ message: SessionMessage;
1908
+ };
1909
+ /** Active session identifier. */
1910
+ sessionId: string;
1911
+ /** Bus instance for runtime queries. */
1912
+ bus: TBus;
1913
+ }
1914
+ /** Feedback returned by `onSelectionChange` to inform the picker UI. */
1915
+ interface SelectionFeedback {
1916
+ /** Estimated token count for the selected events. */
1917
+ tokenEstimate?: number;
1918
+ /** Warning message to display in the picker. */
1919
+ warning?: string;
1920
+ /** Error message that blocks confirmation. */
1921
+ error?: string;
1922
+ }
1923
+ /** Context passed to a session event action's `onExecute` callback. */
1924
+ interface ExecuteContext<TMode extends 'single' | 'multi' = 'single' | 'multi', TRoles extends MessageRole[] = MessageRole[], TBus extends MakaioBusLike = MakaioBusLike> {
1925
+ /** Entrypoint information for the action. */
1926
+ entrypoint: {
1927
+ /** The message that was actioned. */messageId: string; /** Full message object. */
1928
+ message: SessionMessage & {
1929
+ role: TRoles[number];
1930
+ };
1931
+ };
1932
+ /** Selected events when in multi-selection mode, otherwise `undefined`. */
1933
+ selectedEvents: TMode extends 'multi' ? MakaioSessionEvent[] : undefined;
1934
+ /** Active session identifier. */
1935
+ sessionId: string;
1936
+ /** Active project identifier. */
1937
+ projectId?: string;
1938
+ /** Bus instance for runtime queries. */
1939
+ bus: TBus;
1940
+ }
1941
+ /** Result returned by a session event action's `onExecute` callback. */
1942
+ interface ExecuteResult {
1943
+ /** Whether execution succeeded. */
1944
+ success: boolean;
1945
+ /** Human-readable error message when `success` is `false`. */
1946
+ error?: string;
1947
+ }
1948
+ /** Configuration for a session event action's message entrypoint. */
1949
+ interface EntrypointConfig<TRoles extends MessageRole[] = MessageRole[]> {
1950
+ /** Allowed message roles that can trigger this action. */
1951
+ messageRole: TRoles;
1952
+ }
1953
+ /** Full options for defining a session event action. */
1954
+ interface SessionEventActionOptions<TMode extends 'single' | 'multi' = 'single' | 'multi', TRoles extends MessageRole[] = MessageRole[], TBus extends MakaioBusLike = MakaioBusLike> {
1955
+ /** Unique action identifier within the registering package. */
1956
+ id: string;
1957
+ /** Display label for the action. */
1958
+ label: string;
1959
+ /** Optional human-readable description. */
1960
+ description?: string;
1961
+ /** Optional icon identifier. */
1962
+ icon?: string;
1963
+ /** Message entrypoint configuration. */
1964
+ entrypoint: EntrypointConfig<TRoles>;
1965
+ /** Whether this action operates on a single event or multiple events. */
1966
+ selectionMode: TMode;
1967
+ /** Event type filters for multi-selection mode. */
1968
+ applicableTo?: TMode extends 'multi' ? EventFilter[] : never;
1969
+ /**
1970
+ * Optional predicate that determines whether the action is available.
1971
+ * @param ctx - Context with the triggering message.
1972
+ * @returns `true` when the action should be shown.
1973
+ */
1974
+ when?: (ctx: WhenContext<TRoles, TBus>) => Promise<boolean>;
1975
+ /**
1976
+ * Optional callback invoked when the event picker opens.
1977
+ * @param ctx - Context with entrypoint and session info.
1978
+ * @returns Picker configuration, `false` to cancel, or `void`.
1979
+ */
1980
+ onPickerOpen?: TMode extends 'multi' ? (ctx: PickerOpenContext<TRoles, TBus>) => Promise<PickerConfig | false | void> : never;
1981
+ /**
1982
+ * Optional callback invoked when the event selection changes.
1983
+ * @param ctx - Context with selected events.
1984
+ * @returns Selection feedback to display in the picker.
1985
+ */
1986
+ onSelectionChange?: TMode extends 'multi' ? (ctx: SelectionChangeContext<TBus>) => Promise<SelectionFeedback | void> : never;
1987
+ /** Category grouping for this action. */
1988
+ category?: ActionCategory;
1989
+ /** Optional keyboard shortcut. */
1990
+ shortcut?: ActionShortcut;
1991
+ /**
1992
+ * Main execution callback invoked when the action is confirmed.
1993
+ * @param ctx - Context with entrypoint, selected events, and bus.
1994
+ * @returns Execution result, or `void` on success.
1995
+ */
1996
+ onExecute: (ctx: ExecuteContext<TMode, TRoles, TBus>) => Promise<ExecuteResult | void>;
1997
+ }
1998
+ /** Serializable declaration stored in registries and emitted over the bus. */
1999
+ interface SessionEventActionDeclaration {
2000
+ /** Unique action identifier. */
2001
+ id: string;
2002
+ /** Display label. */
2003
+ label: string;
2004
+ /** Optional description. */
2005
+ description?: string;
2006
+ /** Optional icon identifier. */
2007
+ icon?: string;
2008
+ /** Entrypoint configuration. */
2009
+ entrypoint: EntrypointConfig;
2010
+ /** Selection mode. */
2011
+ selectionMode: 'single' | 'multi';
2012
+ /** Event type filters (multi mode only). */
2013
+ applicableTo?: EventFilter[];
2014
+ /** Whether a `when` predicate was provided. */
2015
+ hasWhenPredicate: boolean;
2016
+ /** Whether an `onPickerOpen` callback was provided. */
2017
+ hasPickerOpenCallback: boolean;
2018
+ /** Whether an `onSelectionChange` callback was provided. */
2019
+ hasSelectionChangeCallback: boolean;
2020
+ /** Resolved action category. */
2021
+ category: ActionCategory;
2022
+ /** Optional keyboard shortcut. */
2023
+ shortcut?: ActionShortcut;
2024
+ }
2025
+ /** Return value from `createSessionEventAction` — declaration plus unregister hook. */
2026
+ interface CreateSessionEventActionResult {
2027
+ /** Serializable declaration for registry and bus publication. */
2028
+ declaration: SessionEventActionDeclaration;
2029
+ /** Unregisters the action and cleans up bus subscriptions. */
2030
+ unregister: () => void;
2031
+ }
2032
+ //#endregion
2033
+ //#region packages/contracts/src/extension/contributions/hash-trigger-types.d.ts
2034
+ /** Pipeline stage a hash trigger participates in. */
2035
+ type HashTriggerStage = 'gather' | 'transform' | 'action';
2036
+ /** Single suggestion entry returned by a hash trigger's suggest call. */
2037
+ interface HashSuggestion {
2038
+ /** Display label shown in the completion UI. */
2039
+ label: string;
2040
+ /** Human-readable explanation of the suggestion. */
2041
+ description: string;
2042
+ /** Whether this suggestion is a leaf (directly usable) or a group (opens sub-list). */
2043
+ kind: 'leaf' | 'group';
2044
+ /** Text inserted into the input when the suggestion is accepted. */
2045
+ insertText: string;
2046
+ /** Underlying value passed to execute when the suggestion is used. */
2047
+ value: string;
2048
+ /** Optional icon identifier for the suggestion entry. */
2049
+ icon?: string;
2050
+ /** Pipeline stage override for this particular suggestion. */
2051
+ stage?: HashTriggerStage;
2052
+ }
2053
+ /** A single entry gathered by a gather-stage hash trigger. */
2054
+ interface GatheredEntry {
2055
+ /** Gathered content string. */
2056
+ content: string;
2057
+ /** Prefix token that matched this entry. */
2058
+ prefix: string;
2059
+ /** Argument portion of the matched hash value. */
2060
+ argument: string;
2061
+ /** Optional arbitrary metadata from the gatherer. */
2062
+ metadata?: Record<string, unknown>;
2063
+ }
2064
+ /** Snapshot of all entries gathered by gather-stage triggers in this pipeline run. */
2065
+ interface GatheredContext {
2066
+ /** Immutable map of prefix → entry. */
2067
+ entries: ReadonlyMap<string, GatheredEntry>;
2068
+ }
2069
+ /**
2070
+ * Context passed to a hash trigger's suggest and execute methods.
2071
+ * @typeParam TBus - Host bus shape supplied by the runtime.
2072
+ */
2073
+ interface HashTriggerContext<TBus extends MakaioBusLike = MakaioBusLike> {
2074
+ /** Active session identifier, if any. */
2075
+ sessionId?: string;
2076
+ /** Active project identifier, if any. */
2077
+ projectId?: string;
2078
+ /** Current message text. */
2079
+ message?: string;
2080
+ /** Bus instance for trigger operations. */
2081
+ bus: TBus;
2082
+ /** Optional abort signal for cancellable operations. */
2083
+ signal?: AbortSignal;
2084
+ /** Entries gathered by earlier gather-stage triggers. */
2085
+ gathered?: GatheredContext;
2086
+ }
2087
+ /** Static descriptor for a registered hash trigger. */
2088
+ interface HashTriggerMetadata {
2089
+ /** Prefix token this trigger responds to (e.g. `'@'`, `'#'`). */
2090
+ prefix: string;
2091
+ /** Human-readable explanation of what this trigger does. */
2092
+ description: string;
2093
+ /** Semantic version of this trigger. */
2094
+ version: string;
2095
+ /** Pipeline stage this trigger participates in. */
2096
+ stage?: HashTriggerStage;
2097
+ /** Names of triggers that must run before this one. */
2098
+ runAfter?: string[];
2099
+ }
2100
+ /** Return value from a hash trigger's suggest call. */
2101
+ interface HashTriggerSuggestResult {
2102
+ /** Suggested completions. */
2103
+ suggestions: HashSuggestion[];
2104
+ /** Optional metadata about the result set. */
2105
+ metadata?: {
2106
+ /** Whether the result set was truncated due to size limits. */truncated?: boolean;
2107
+ };
2108
+ }
2109
+ /**
2110
+ * A registered hash trigger that can suggest completions and execute values.
2111
+ *
2112
+ * Implement this interface and return instances from
2113
+ * `MakaioExtension.triggers.createTriggers` so the runtime registers them
2114
+ * with the HashTriggerService.
2115
+ * @typeParam TBus - Host bus shape supplied by the runtime.
2116
+ */
2117
+ interface HashTrigger<TBus extends MakaioBusLike = MakaioBusLike> {
2118
+ /** Static descriptor used for registration and pipeline ordering. */
2119
+ metadata: HashTriggerMetadata;
2120
+ /**
2121
+ * Return completion suggestions for the current query.
2122
+ * @param query - Text typed after the prefix token.
2123
+ * @param context - Runtime context for this suggestion request.
2124
+ * @returns Suggestion list with optional pagination metadata.
2125
+ */
2126
+ suggest(query: string, context: HashTriggerContext<TBus>): Promise<HashTriggerSuggestResult>;
2127
+ /**
2128
+ * Execute the selected value (optional).
2129
+ *
2130
+ * Called when the user accepts a suggestion whose `kind` is `'leaf'`.
2131
+ * @param value - The accepted suggestion's `value` field.
2132
+ * @param context - Runtime context for this execution.
2133
+ * @returns Resolved content string inserted into the message.
2134
+ */
2135
+ execute?(value: string, context: HashTriggerContext<TBus>): Promise<string>;
2136
+ }
2137
+ //#endregion
2138
+ //#region packages/contracts/src/extension/contributions/ui-context-types.d.ts
2139
+ /**
2140
+ * Extension point for UI scope identifiers.
2141
+ *
2142
+ * Hosts and extensions add host-specific scopes via declaration
2143
+ * merging. Framework defaults stay host-agnostic.
2144
+ */
2145
+ interface UiScopeMap {
2146
+ /** Available in framework-global contexts. */
2147
+ global: true;
2148
+ /** Available regardless of active UI context. */
2149
+ any: true;
2150
+ }
2151
+ /** UI scope identifier, extensible via {@link UiScopeMap}. */
2152
+ type UiScope = keyof UiScopeMap & string;
2153
+ /**
2154
+ * Extension point for UI navigation levels.
2155
+ *
2156
+ * Hosts add domain levels through declaration merging.
2157
+ */
2158
+ interface UiNavigationLevelMap {
2159
+ /** Root shell level with no host context implied. */
2160
+ root: true;
2161
+ /** Available at every registered navigation level. */
2162
+ any: true;
2163
+ }
2164
+ /** UI navigation level, extensible via {@link UiNavigationLevelMap}. */
2165
+ type UiNavigationLevel = keyof UiNavigationLevelMap & string;
2166
+ /**
2167
+ * Runtime UI navigation level.
2168
+ *
2169
+ * Runtime context snapshots describe the active renderer surface. The `'any'`
2170
+ * level is reserved for definition matching and is never an active navigation
2171
+ * level.
2172
+ */
2173
+ type UiRuntimeNavigationLevel = Exclude<UiNavigationLevel, 'any'>;
2174
+ /**
2175
+ * Extension point for typed UI context values.
2176
+ *
2177
+ * Keys are context dimensions; values are the serializable values exposed for
2178
+ * that dimension in a host context snapshot.
2179
+ */
2180
+ interface UiContextValueMap {
2181
+ /** Active session identifier, if the framework shell has one. */
2182
+ session: string;
2183
+ }
2184
+ /** UI context dimension identifier, extensible via {@link UiContextValueMap}. */
2185
+ type UiContextDimension = keyof UiContextValueMap & string;
2186
+ /** Snapshot of host UI context passed to contributed UI. */
2187
+ interface UiContextSnapshot {
2188
+ /** Active navigation level for the renderer surface. */
2189
+ readonly level: UiRuntimeNavigationLevel;
2190
+ /** Active context values keyed by registered context dimension. */
2191
+ readonly values: Partial<{ readonly [K in UiContextDimension]: UiContextValueMap[K] | null }>;
2192
+ }
2193
+ //#endregion
2194
+ //#region packages/contracts/src/extension/contributions/tile-types.d.ts
2195
+ /** Optional feature flags a tile can declare. */
2196
+ interface TileCapabilities {
2197
+ /** Whether this tile supports fullscreen mode. */
2198
+ supportsFullscreen?: boolean;
2199
+ }
2200
+ /**
2201
+ * Props passed to tile components.
2202
+ *
2203
+ * Tiles do not receive host context as direct props; hosts expose context
2204
+ * through their UI runtime.
2205
+ */
2206
+ interface TileProps {
2207
+ /** Optional class name for styling. */
2208
+ className?: string;
2209
+ }
2210
+ /**
2211
+ * Icon loader for a tile.
2212
+ *
2213
+ * Lazy-loads an icon component (typically from `lucide-react`).
2214
+ * @example
2215
+ * ```typescript
2216
+ * icon: () => import('lucide-react').then(m => ({ default: m.Terminal }))
2217
+ * ```
2218
+ */
2219
+ type TileIconLoader = () => Promise<{
2220
+ default: ComponentType<{
2221
+ size?: number;
2222
+ }>;
2223
+ }>;
2224
+ /**
2225
+ * Platform renderers for a tile.
2226
+ *
2227
+ * SEAM: Currently supports React; additional platforms can be added as optional
2228
+ * keys without breaking existing declarations.
2229
+ */
2230
+ interface TileRenderers {
2231
+ /**
2232
+ * React renderer for the web UI.
2233
+ *
2234
+ * Lazy-loaded component module with a default export that accepts
2235
+ * {@link TileProps}.
2236
+ */
2237
+ react: () => Promise<{
2238
+ default: ComponentType<TileProps>;
2239
+ }>;
2240
+ /**
2241
+ * SEAM: Future platform renderers (e.g. `reactNative`, `electron`).
2242
+ *
2243
+ * Additional platforms can be added here as optional keys.
2244
+ */
2245
+ [platform: string]: (() => Promise<{
2246
+ default: ComponentType<TileProps>;
2247
+ }>) | undefined;
2248
+ }
2249
+ /**
2250
+ * Tile declaration contributed by a package.
2251
+ *
2252
+ * Packages declare tiles they provide for pane placement. These are registered
2253
+ * with `TileRegistry` and shown in the "Add Pane" palette.
2254
+ * @example
2255
+ * ```typescript
2256
+ * const terminalExtension: MakaioExtension = {
2257
+ * name: 'terminal',
2258
+ * ui: {
2259
+ * tiles: [
2260
+ * {
2261
+ * id: 'status',
2262
+ * name: 'Status',
2263
+ * description: 'Runtime status panel',
2264
+ * scope: 'global',
2265
+ * icon: () => import('lucide-react').then(m => ({ default: m.Activity })),
2266
+ * allowMultiple: true,
2267
+ * capabilities: { supportsFullscreen: true },
2268
+ * renderers: {
2269
+ * react: () => import('./ui/StatusTile.js'),
2270
+ * },
2271
+ * },
2272
+ * ],
2273
+ * },
2274
+ * };
2275
+ * ```
2276
+ */
2277
+ interface TileDeclaration {
2278
+ /**
2279
+ * Unique tile identifier.
2280
+ *
2281
+ * Must be unique across all packages. Use the package name as a prefix to
2282
+ * avoid collisions.
2283
+ * @example `'status'`, `'session-summary'`
2284
+ */
2285
+ id: string;
2286
+ /**
2287
+ * Display name for the tile.
2288
+ *
2289
+ * Human-readable name shown in the "Add Pane" palette.
2290
+ * @example `'Status'`, `'Session Summary'`
2291
+ */
2292
+ name: string;
2293
+ /**
2294
+ * Optional description of tile purpose.
2295
+ *
2296
+ * Shown in the "Add Pane" palette below the name.
2297
+ */
2298
+ description?: string;
2299
+ /**
2300
+ * Tile scope — where the tile is available.
2301
+ *
2302
+ * Defaults to `'any'` when not specified.
2303
+ */
2304
+ scope?: UiScope;
2305
+ /**
2306
+ * Icon loader for the tile.
2307
+ *
2308
+ * Lazy-loads an icon component for the "Add Pane" palette. Required for
2309
+ * tiles to appear in the palette.
2310
+ */
2311
+ icon: TileIconLoader;
2312
+ /**
2313
+ * Whether multiple instances of this tile are allowed simultaneously.
2314
+ *
2315
+ * Defaults to `true`. When `false`, only one instance can exist at a time.
2316
+ */
2317
+ allowMultiple?: boolean;
2318
+ /** Optional capability flags for the tile. */
2319
+ capabilities?: TileCapabilities;
2320
+ /**
2321
+ * Context dimensions this tile's state depends on.
2322
+ *
2323
+ * When declared, the host can remount the tile when any listed dimension
2324
+ * changes to prevent stale in-memory state from leaking across contexts.
2325
+ */
2326
+ contextDependencies?: UiContextDimension[];
2327
+ /**
2328
+ * Platform-specific renderers.
2329
+ *
2330
+ * Maps platform names to lazy-loaded component modules. At minimum, the
2331
+ * `'react'` platform is required for the web UI.
2332
+ */
2333
+ renderers: TileRenderers;
2334
+ }
2335
+ //#endregion
2336
+ //#region packages/contracts/src/extension/contributions/widget-types.d.ts
2337
+ /**
2338
+ * Widget size variants.
2339
+ *
2340
+ * Defines the visual footprint a widget can occupy in a layout.
2341
+ * - `'small'`: Minimal space, suitable for status indicators
2342
+ * - `'medium'`: Standard panel size, default for most widgets
2343
+ * - `'large'`: Expanded view, for detailed information
2344
+ * - `'full-width'`: Spans the full available width
2345
+ */
2346
+ type WidgetSize$1 = 'small' | 'medium' | 'large' | 'full-width';
2347
+ /**
2348
+ * Serializable widget definition.
2349
+ *
2350
+ * Platform-agnostic description of what data a widget needs and how it
2351
+ * behaves. This definition can be serialized and stored in user preferences.
2352
+ */
2353
+ interface WidgetDefinition {
2354
+ /**
2355
+ * Bus subject for the widget's data source.
2356
+ *
2357
+ * Optional — widgets can render without dynamic data (e.g. static controls).
2358
+ * When provided, the widget requests data from this subject.
2359
+ */
2360
+ dataSource?: string;
2361
+ /**
2362
+ * Events that trigger a widget refresh.
2363
+ *
2364
+ * List of bus event subjects that cause the widget to refresh its data.
2365
+ * @example `['session.updated', 'extension.stateChanged']`
2366
+ */
2367
+ refreshOn?: string[];
2368
+ /**
2369
+ * Supported size variants for this widget.
2370
+ *
2371
+ * Must include at least one size and must include `defaultSize`.
2372
+ */
2373
+ sizes: WidgetSize$1[];
2374
+ /**
2375
+ * Default size when the widget is first added to a layout.
2376
+ *
2377
+ * Must be one of the values in {@link sizes}.
2378
+ */
2379
+ defaultSize: WidgetSize$1;
2380
+ }
2381
+ /**
2382
+ * Props passed to widget components.
2383
+ * @typeParam TData - Type of data from the widget's data source, if any.
2384
+ */
2385
+ interface WidgetProps<TData = unknown> {
2386
+ /** The widget's definition (from declaration). */
2387
+ definition: WidgetDefinition;
2388
+ /** Current size of this widget instance. */
2389
+ size: WidgetSize$1;
2390
+ /** Data from the widget's data source (when `dataSource` is defined). */
2391
+ data?: TData;
2392
+ /** Active host UI context for this widget surface. */
2393
+ uiContext: UiContextSnapshot;
2394
+ }
2395
+ /**
2396
+ * Framework-agnostic UI component shape for lazy widget modules.
2397
+ *
2398
+ * Kept free of React imports so the contracts package does not force React
2399
+ * types onto non-web consumers. React function components are structurally
2400
+ * assignable to the call signature.
2401
+ */
2402
+ type WidgetComponent = ((props: WidgetProps) => unknown) | (new (props: WidgetProps) => unknown);
2403
+ /** Lazy widget component loader. */
2404
+ type WidgetComponentLoader = () => Promise<{
2405
+ default: WidgetComponent;
2406
+ }>;
2407
+ /**
2408
+ * Platform renderers for a widget.
2409
+ *
2410
+ * SEAM: Currently supports React; additional platforms can be added as optional
2411
+ * keys without breaking existing declarations.
2412
+ */
2413
+ interface WidgetRenderers {
2414
+ /**
2415
+ * React renderer for the web UI.
2416
+ *
2417
+ * Lazy-loaded component module with a default export that accepts
2418
+ * `WidgetProps<TData>` where `TData` matches the `dataSource` response.
2419
+ */
2420
+ react: WidgetComponentLoader;
2421
+ /**
2422
+ * SEAM: Future platform renderers (e.g. `reactNative`, `electron`).
2423
+ *
2424
+ * Additional platforms can be added here as optional keys.
2425
+ */
2426
+ [platform: string]: WidgetComponentLoader | undefined;
2427
+ }
2428
+ /**
2429
+ * Widget declaration contributed by a package.
2430
+ *
2431
+ * Packages declare widgets they provide. These are collected into a global
2432
+ * catalog that the UI system uses to populate focus contexts.
2433
+ * @example
2434
+ * ```typescript
2435
+ * const statusExtension: MakaioExtension = {
2436
+ * name: 'status-panel',
2437
+ * ui: {
2438
+ * widgets: [
2439
+ * {
2440
+ * id: 'status-summary',
2441
+ * name: 'Status Summary',
2442
+ * description: 'Shows current runtime status',
2443
+ * scope: 'global',
2444
+ * definition: {
2445
+ * dataSource: 'runtime.getStatus',
2446
+ * refreshOn: ['runtime.ready', 'extension.stateChanged'],
2447
+ * sizes: ['small', 'medium', 'large'],
2448
+ * defaultSize: 'medium',
2449
+ * },
2450
+ * renderers: {
2451
+ * react: () => import('./widgets/StatusSummary.js'),
2452
+ * },
2453
+ * },
2454
+ * ],
2455
+ * },
2456
+ * };
2457
+ * ```
2458
+ */
2459
+ interface WidgetDeclaration {
2460
+ /**
2461
+ * Unique widget identifier.
2462
+ *
2463
+ * Must be unique across all packages. Use the package name as a prefix to
2464
+ * avoid collisions.
2465
+ * @example `'status-summary'`, `'session-activity'`
2466
+ */
2467
+ id: string;
2468
+ /**
2469
+ * Display name for the widget.
2470
+ *
2471
+ * Human-readable name shown in UI when users browse available widgets.
2472
+ */
2473
+ name: string;
2474
+ /**
2475
+ * Optional description of widget purpose.
2476
+ *
2477
+ * Provides additional context about what the widget displays and when to
2478
+ * use it.
2479
+ */
2480
+ description?: string;
2481
+ /**
2482
+ * Widget scope identifier.
2483
+ *
2484
+ * Defaults to `'global'` when not specified.
2485
+ */
2486
+ scope?: UiScope;
2487
+ /**
2488
+ * Serializable widget definition.
2489
+ *
2490
+ * Describes the widget's data needs and behavior without platform-specific
2491
+ * details. Can be serialized and stored in user preferences.
2492
+ */
2493
+ definition: WidgetDefinition;
2494
+ /**
2495
+ * Platform-specific renderers.
2496
+ *
2497
+ * Maps platform names to lazy-loaded component modules. At minimum, the
2498
+ * `'react'` platform is required for the web UI.
2499
+ */
2500
+ renderers: WidgetRenderers;
2501
+ }
2502
+ //#endregion
2503
+ //#region packages/contracts/src/extension/contributions/page-types.d.ts
2504
+ /**
2505
+ * Widget size values used for slot declarations in page layouts.
2506
+ */
2507
+ type WidgetSize = 'small' | 'medium' | 'large' | 'full-width';
2508
+ /**
2509
+ * Normalized slot identifiers for page layout regions.
2510
+ */
2511
+ type SlotId = 'main' | 'sidebar-left' | 'sidebar-right' | 'detail-panel' | 'bottom-panel' | 'widget-zone';
2512
+ /**
2513
+ * Page mode controlling sidebar navigation behavior.
2514
+ *
2515
+ * - `'switch'`: Takes over the workspace; shown in the sidebar "Navigate" section
2516
+ * - `'peek'`: Small overlay that preserves existing state
2517
+ * - `'cover'`: Full-viewport overlay that preserves existing state
2518
+ */
2519
+ type PageMode = 'switch' | 'peek' | 'cover';
2520
+ /** Props passed to all page components. */
2521
+ interface PageComponentProps {
2522
+ /** Optional CSS class name for the page container. */
2523
+ className?: string;
2524
+ /** Current internal route within the page. */
2525
+ internalRoute?: string | null;
2526
+ /**
2527
+ * Callback for internal navigation within the page.
2528
+ * @param route - The new internal route path.
2529
+ */
2530
+ onNavigate?: (route: string) => void;
2531
+ }
2532
+ /** Slot definition for package declarations (fully serializable). */
2533
+ interface SlotDeclaration {
2534
+ /** Slot identifier. */
2535
+ id: SlotId;
2536
+ /** Human-readable slot name. */
2537
+ name: string;
2538
+ /** Sizes accepted by this slot. */
2539
+ acceptsSizes: WidgetSize[];
2540
+ /** Minimum column width in pixels. */
2541
+ minColumnWidth: number;
2542
+ /** Maximum number of columns. */
2543
+ maxColumns: number;
2544
+ /** Whether the slot can be collapsed. */
2545
+ collapsible?: boolean;
2546
+ /** Whether the slot starts collapsed. */
2547
+ defaultCollapsed?: boolean;
2548
+ }
2549
+ /** Content reference for a slot placement (view or widget). */
2550
+ type SlotContentDeclaration = {
2551
+ type: 'view';
2552
+ viewId: string;
2553
+ props?: Record<string, unknown>;
2554
+ } | {
2555
+ type: 'widget';
2556
+ widgetId: string;
2557
+ config?: Record<string, unknown>;
2558
+ };
2559
+ /** Placement declaration with a mandatory flag and optional position. */
2560
+ interface SlotPlacementDeclaration {
2561
+ /**
2562
+ * Stable unique identifier for this placement.
2563
+ *
2564
+ * Used as a React key and for layout persistence.
2565
+ */
2566
+ instanceId: string;
2567
+ /** Content reference for this placement. */
2568
+ content: SlotContentDeclaration;
2569
+ /** Whether this placement is mandatory (cannot be removed by the user). */
2570
+ mandatory: boolean;
2571
+ /** Optional grid position. */
2572
+ position?: {
2573
+ col: number;
2574
+ row: number;
2575
+ };
2576
+ }
2577
+ /**
2578
+ * Page declaration for packages.
2579
+ *
2580
+ * Fully serializable — lazy-loads any custom components. To also register the
2581
+ * page in sidebar navigation (`PageDefinitionRegistry`), provide `mode`,
2582
+ * `level`, and `component`. The package loader will bridge this declaration to
2583
+ * a `PageDefinition` entry automatically.
2584
+ * @example
2585
+ * ```typescript
2586
+ * // Minimal page (slot-layout system only, no sidebar entry):
2587
+ * { id: 'my-page', name: 'My Page', scope: 'any', slots: [], defaultContent: {} }
2588
+ *
2589
+ * // Page with sidebar navigation entry:
2590
+ * {
2591
+ * id: 'my-page',
2592
+ * name: 'My Page',
2593
+ * scope: 'any',
2594
+ * mode: 'switch',
2595
+ * level: 'any',
2596
+ * component: () => import('./MyPage.js'),
2597
+ * slots: [],
2598
+ * defaultContent: {},
2599
+ * }
2600
+ * ```
2601
+ */
2602
+ interface PageDeclaration {
2603
+ /**
2604
+ * Unique page identifier.
2605
+ *
2606
+ * Will be namespaced to `'<package-name>:<page-id>'` by the loader.
2607
+ */
2608
+ id: string;
2609
+ /** Human-readable name. */
2610
+ name: string;
2611
+ /** Optional description shown in page listings. */
2612
+ description?: string;
2613
+ /**
2614
+ * Route path relative to the package mount point.
2615
+ * @example `'dashboard'` becomes `/extensions/my-package/dashboard`
2616
+ */
2617
+ route?: string;
2618
+ /** UI scope for this page context. */
2619
+ scope: UiScope;
2620
+ /** Slot definitions for this page's layout. */
2621
+ slots: SlotDeclaration[];
2622
+ /** Default content per slot. */
2623
+ defaultContent: Partial<Record<SlotId, SlotPlacementDeclaration[]>>;
2624
+ /** Optional page-level icon (lazy-loaded). */
2625
+ icon?: () => Promise<{
2626
+ default: ComponentType<{
2627
+ size?: number;
2628
+ }>;
2629
+ }>;
2630
+ /** Optional page-level layout constraints. */
2631
+ layout?: {
2632
+ /** Minimum page width in pixels. */minWidth?: number;
2633
+ };
2634
+ /**
2635
+ * Navigation mode for sidebar registration.
2636
+ *
2637
+ * When provided alongside `level` and `component`, the package loader
2638
+ * registers this page in the sidebar navigation (`PageDefinitionRegistry`).
2639
+ * Omit to register in the slot-layout system only (`pageRegistry`).
2640
+ */
2641
+ mode?: PageMode;
2642
+ /**
2643
+ * Navigation level for sidebar registration.
2644
+ *
2645
+ * Required when `mode` is provided.
2646
+ */
2647
+ level?: UiNavigationLevel;
2648
+ /**
2649
+ * Lazy-loaded page component for sidebar navigation.
2650
+ *
2651
+ * Required when `mode` is provided. Must return a module with a default
2652
+ * export that accepts {@link PageComponentProps}.
2653
+ * @example
2654
+ * ```typescript
2655
+ * () => import('./MyPage.js').then(m => ({ default: m.MyPage }))
2656
+ * ```
2657
+ */
2658
+ component?: () => Promise<{
2659
+ default: ComponentType<PageComponentProps>;
2660
+ }>;
2661
+ /**
2662
+ * Display order in sidebar (lower = first).
2663
+ *
2664
+ * Only used when `mode` is provided. Defaults to `50` when omitted.
2665
+ */
2666
+ order?: number;
2667
+ }
2668
+ //#endregion
2669
+ //#region packages/contracts/src/extension/contributions/tool-formatter-types.d.ts
2670
+ /** Discriminated content types for formatted tool call output. */
2671
+ type PluginTransformedContentType = 'markdown';
2672
+ /** Formatted content block for tool call display. */
2673
+ interface PluginTransformedContent {
2674
+ /** Content rendering strategy. */
2675
+ type: PluginTransformedContentType;
2676
+ /** Content string interpreted according to `type`. */
2677
+ content: string;
2678
+ }
2679
+ /**
2680
+ * Output from a tool call formatter (package-side declaration).
2681
+ *
2682
+ * All fields are optional — formatters can override any subset.
2683
+ */
2684
+ interface PluginFormattedToolCallOutput {
2685
+ /** Replaces the tool name in the block header. */
2686
+ label?: string;
2687
+ /** Replaces the Arguments section. */
2688
+ content?: PluginTransformedContent;
2689
+ /** Replaces the Output section rendering. */
2690
+ outputContent?: PluginTransformedContent;
2691
+ }
2692
+ /** Input shape passed to a formatter's `format` function. */
2693
+ interface PluginToolCallFormatterInput {
2694
+ /** Name of the tool being called. */
2695
+ toolName: string;
2696
+ /** Arguments passed to the tool. */
2697
+ args: Record<string, unknown>;
2698
+ /** Current status of the tool call. */
2699
+ status: 'pending' | 'running' | 'completed' | 'error';
2700
+ /** Output from the tool when the call has completed. */
2701
+ output?: string;
2702
+ }
2703
+ /**
2704
+ * A tool call formatter declaration contributed by a package.
2705
+ *
2706
+ * Structurally compatible with `ToolCallFormatterDefinition` used by the
2707
+ * UI registry, so the package loader can register declarations directly
2708
+ * without bridging.
2709
+ */
2710
+ interface ToolCallFormatterDeclaration {
2711
+ /** Unique identifier for this formatter. */
2712
+ id: string;
2713
+ /**
2714
+ * Declarative filter matched against the tool call input shape.
2715
+ *
2716
+ * Uses a `PayloadFilter` with dot-path support (e.g. `'args.subagent_type'`).
2717
+ * All conditions are ANDed.
2718
+ */
2719
+ filter: PayloadFilter;
2720
+ /**
2721
+ * Priority for ordering when multiple formatters match.
2722
+ *
2723
+ * Lower number = higher priority (checked first). Default: `50`.
2724
+ */
2725
+ priority: number;
2726
+ /**
2727
+ * Pure function that transforms a tool call block into formatted output.
2728
+ *
2729
+ * Returns `undefined` if the formatter decides not to handle this specific
2730
+ * call, falling through to the next formatter.
2731
+ * @param input - The tool call block data.
2732
+ * @returns Formatted output, or `undefined` to skip to the next formatter.
2733
+ */
2734
+ format: (input: PluginToolCallFormatterInput) => PluginFormattedToolCallOutput | undefined;
2735
+ }
2736
+ //#endregion
2737
+ //#region packages/contracts/src/extension/contributions/web-ui-types.d.ts
2738
+ /**
2739
+ * Request context passed to a WebUI loader function.
2740
+ *
2741
+ * Provides visibility-aware context so loaders can filter data by the active
2742
+ * host UI context. URL params are forwarded from the route match so loaders can
2743
+ * access path segments and query strings.
2744
+ */
2745
+ interface LoaderContext {
2746
+ /**
2747
+ * Active session identifier, if a session is selected.
2748
+ *
2749
+ * `undefined` when no session is currently active.
2750
+ */
2751
+ sessionId?: string;
2752
+ /** Active host UI context for the matched route. */
2753
+ uiContext: UiContextSnapshot;
2754
+ /**
2755
+ * URL parameters from the matched route, including path segments and query
2756
+ * strings.
2757
+ *
2758
+ * Forwarded from the router so loaders can read route-specific identifiers.
2759
+ */
2760
+ params: Record<string, string>;
2761
+ }
2762
+ /**
2763
+ * Loader function that fetches data for a WebUI route.
2764
+ *
2765
+ * Receives a {@link LoaderContext} with active session, UI context, and URL
2766
+ * params so loaders can return visibility-appropriate data. The resolved data
2767
+ * is passed to the component as `loaderData`.
2768
+ * @typeParam TData - Type of data returned by the loader.
2769
+ * @param context - Request context with session, UI context, and URL params.
2770
+ * @returns Promise resolving to the loader data.
2771
+ */
2772
+ type MakaioWebUiLoader<TData = unknown> = (context: LoaderContext) => Promise<TData>;
2773
+ /**
2774
+ * Action function that performs server-side operations.
2775
+ * @typeParam TData - Type of data returned by the action.
2776
+ * @typeParam TArgs - Tuple type of arguments accepted by the action.
2777
+ * @param args - Arguments passed to the action.
2778
+ * @returns Promise resolving to the action result.
2779
+ */
2780
+ type MakaioWebUiAction<TData = unknown, TArgs extends unknown[] = unknown[]> = (...args: TArgs) => Promise<TData>;
2781
+ /**
2782
+ * Record of named actions available to a WebUI route.
2783
+ *
2784
+ * Each action can return different data types.
2785
+ */
2786
+ type MakaioWebUiActions = Record<string, MakaioWebUiAction<unknown, unknown[]>>;
2787
+ /**
2788
+ * Transforms server-side action definitions into client-side Promise-based
2789
+ * executors.
2790
+ *
2791
+ * Used in component props to provide an async/await API for actions.
2792
+ * @typeParam TActions - The server-side action record shape.
2793
+ */
2794
+ type PromisifiedActions<TActions extends MakaioWebUiActions> = { [K in keyof TActions]: TActions[K] extends ((...args: infer Args) => Promise<infer Result>) ? (...args: Args) => Promise<Result> : never };
2795
+ /**
2796
+ * Props passed to a WebUI component.
2797
+ *
2798
+ * Provides type-safe access to loader data, Promise-based action executors,
2799
+ * and the {@link LoaderContext} that was active when the loader ran.
2800
+ * @typeParam TLoaderData - Type of data returned by the loader.
2801
+ * @typeParam TActions - Record of available actions.
2802
+ */
2803
+ type MakaioWebUiComponentProps<TLoaderData = unknown, TActions extends MakaioWebUiActions = MakaioWebUiActions> = {
2804
+ /** Data resolved by the loader before the component was rendered. */loaderData: TLoaderData; /** Promisified action executors for mutating server-side state. */
2805
+ actions: TActions extends MakaioWebUiActions ? PromisifiedActions<TActions> : Record<string, never>; /** The loader context that was active when the loader ran. */
2806
+ loaderContext: LoaderContext;
2807
+ };
2808
+ /**
2809
+ * WebUI route definition for packages.
2810
+ *
2811
+ * Defines a route with path, optional loader/actions, and a lazy-loaded React
2812
+ * component. Provides full TypeScript inference for component props.
2813
+ * @typeParam TLoaderData - Type of data returned by the loader.
2814
+ * @typeParam TActions - Record of available actions (or `undefined` if none).
2815
+ */
2816
+ interface MakaioWebUiRoute<TLoaderData = unknown, TActions extends MakaioWebUiActions | undefined = undefined> {
2817
+ /** Route path relative to the package mount point. */
2818
+ path: string;
2819
+ /** Optional data loader. */
2820
+ loader?: MakaioWebUiLoader<TLoaderData>;
2821
+ /** Optional action handlers. */
2822
+ actions?: TActions;
2823
+ /**
2824
+ * Lazy component loader — called only browser-side.
2825
+ *
2826
+ * Must return a module with a default export of a React component that
2827
+ * accepts the inferred {@link MakaioWebUiComponentProps}.
2828
+ */
2829
+ component: () => Promise<{
2830
+ default: ComponentType<MakaioWebUiComponentProps<TLoaderData, TActions extends MakaioWebUiActions ? TActions : Record<string, never>>>;
2831
+ }>;
2832
+ }
2833
+ /**
2834
+ * Props for custom extension configuration components.
2835
+ *
2836
+ * When an extension provides `ui.configComponent`, the loaded component receives
2837
+ * these props to interact with the extension configuration system.
2838
+ * @typeParam TConfig - Extension configuration type.
2839
+ */
2840
+ interface ExtensionConfigComponentProps<TConfig = unknown> {
2841
+ /** Current configuration values. */
2842
+ config: TConfig;
2843
+ /**
2844
+ * Called when configuration values change.
2845
+ * @param config - Updated configuration.
2846
+ */
2847
+ onChange: (config: TConfig) => void;
2848
+ /** Called when the user confirms the save action. */
2849
+ onSave: () => Promise<void>;
2850
+ /** Whether a save is currently in progress. */
2851
+ isSaving: boolean;
2852
+ /** Validation errors keyed by field name. */
2853
+ errors?: Record<string, string>;
2854
+ }
2855
+ /**
2856
+ * Async loader for registering custom form field types.
2857
+ *
2858
+ * Must return a module with a default export of a React component that accepts
2859
+ * {@link FormFieldProps}.
2860
+ */
2861
+ type ExtensionFieldTypeLoader = () => Promise<{
2862
+ default: ComponentType<FormFieldProps>;
2863
+ }>;
2864
+ /**
2865
+ * Async loader for a custom extension configuration component.
2866
+ *
2867
+ * Must return a module with a default export of a React component that accepts
2868
+ * {@link ExtensionConfigComponentProps}.
2869
+ * @typeParam TConfig - Extension configuration type.
2870
+ */
2871
+ type ExtensionConfigComponentLoader<TConfig = unknown> = () => Promise<{
2872
+ default: ComponentType<ExtensionConfigComponentProps<TConfig>>;
2873
+ }>;
2874
+ //#endregion
2875
+ //#region packages/contracts/src/extension/extension-contributions.d.ts
2876
+ /**
2877
+ * Typed adapter contribution declared by an extension.
2878
+ *
2879
+ * The `manifest` field carries the adapter metadata that runtime processors
2880
+ * consume alongside the executable `definition`. Descriptor-level
2881
+ * `ExtensionManifest.contributions.adapters` may repeat this metadata for
2882
+ * pre-load discovery, but activation reads this executable surface.
2883
+ * @typeParam TAdapter - Concrete adapter instance type. Defaults to `unknown`
2884
+ * for use in collections where the concrete type is not available.
2885
+ */
2886
+ interface AdapterContribution<TAdapter = unknown> {
2887
+ /** Runtime adapter metadata paired with the executable definition. */
2888
+ readonly manifest: AdapterManifest;
2889
+ /**
2890
+ * Full adapter runtime definition.
2891
+ *
2892
+ * Typed via {@link AdapterDefinitionContract} — the adapter subsystem
2893
+ * consumes this directly. The generic parameter allows higher-level types
2894
+ * (e.g., `AIAdapterDefinition`) to narrow the factory return type.
2895
+ */
2896
+ readonly definition: AdapterDefinitionContract<TAdapter>;
2897
+ }
2898
+ /**
2899
+ * Opaque log import contribution declared by an extension.
2900
+ *
2901
+ * Typed as `unknown` in the contracts layer to avoid importing from
2902
+ * `ai-adapters-core`. The log-import contribution processor narrows
2903
+ * this to `PluginLogImport` at processing time.
2904
+ */
2905
+ interface LogImportContribution {
2906
+ /** Adapter name for attribution (e.g. `'opencode'`). */
2907
+ readonly adapterName: string;
2908
+ /** Human-readable display name (e.g. `'OpenCode'`). */
2909
+ readonly displayName: string;
2910
+ /** Full log importer configuration, opaque in contracts. */
2911
+ readonly config: unknown;
2912
+ }
2913
+ /** Tool contribution surface declared by an extension. */
2914
+ interface ExtensionToolsContribution<THostContext extends ExtensionContext = NodeExtensionContext> {
2915
+ /**
2916
+ * Create toolsets for this extension.
2917
+ * @param ctx - Runtime context with bus, host details, and machine identity.
2918
+ * @returns Array of toolsets to register with `ToolRegistry`.
2919
+ */
2920
+ readonly createToolsets: (ctx: THostContext) => Toolset[];
2921
+ }
2922
+ /**
2923
+ * Hash trigger contribution surface declared by an extension.
2924
+ * @typeParam TBus - Host bus shape supplied by the runtime.
2925
+ */
2926
+ interface ExtensionTriggersContribution<TBus extends MakaioBusLike = MakaioBusLike> {
2927
+ /**
2928
+ * Create hash triggers for this extension.
2929
+ * @param bus - The bus instance for trigger operations.
2930
+ * @returns Array of hash triggers to register with `HashTriggerService`.
2931
+ */
2932
+ readonly createTriggers: (bus: TBus) => HashTrigger<TBus>[];
2933
+ }
2934
+ /**
2935
+ * Session event action contribution surface declared by an extension.
2936
+ * @typeParam TBus - Host bus shape supplied by the runtime.
2937
+ */
2938
+ interface ExtensionSessionEventActionsContribution<TBus extends MakaioBusLike = MakaioBusLike> {
2939
+ /**
2940
+ * Create session event actions for this extension.
2941
+ * @param ctx - Context with bus instance and extension metadata.
2942
+ * @returns Map of action ID to registration result (declaration + unregister).
2943
+ */
2944
+ readonly createActions: (ctx: SessionEventActionContext<TBus>) => Record<string, CreateSessionEventActionResult>;
2945
+ }
2946
+ /** Bus namespace introspection surface declared by an extension. */
2947
+ interface ExtensionNamespaceContribution {
2948
+ /**
2949
+ * Schema record for bus subject introspection.
2950
+ *
2951
+ * Keys are subject short-names; values are subject schema descriptors.
2952
+ */
2953
+ readonly schemas: Record<string, SubjectSchema>;
2954
+ }
2955
+ /** Browser UI contribution surface declared by an extension. */
2956
+ interface ExtensionUiContribution {
2957
+ /**
2958
+ * WebUI routes mounted under `/extensions/<extension-name>/`.
2959
+ *
2960
+ * Each route defines a path, an optional data loader, optional action
2961
+ * handlers, and a lazy-loaded React component.
2962
+ */
2963
+ readonly routes?: readonly MakaioWebUiRoute<unknown, MakaioWebUiActions | undefined>[];
2964
+ /**
2965
+ * Tile declarations for pane-placeable content.
2966
+ *
2967
+ * Tiles are registered with `TileRegistry` and shown in the "Add Pane"
2968
+ * palette. Each declaration includes metadata, an icon, and platform
2969
+ * renderers.
2970
+ */
2971
+ readonly tiles?: readonly TileDeclaration[];
2972
+ /**
2973
+ * Widget declarations for small dashboard cards.
2974
+ *
2975
+ * Widgets are registered in the global widget catalog. They are NOT pane
2976
+ * content — use `tiles` for pane-placeable content.
2977
+ */
2978
+ readonly widgets?: readonly WidgetDeclaration[];
2979
+ /**
2980
+ * Page declarations for the page registry and optional sidebar navigation.
2981
+ *
2982
+ * Pages are registered in the page registry. When `mode`, `level`, and
2983
+ * `component` are provided, the loader also registers the page in the
2984
+ * sidebar navigation (`PageDefinitionRegistry`).
2985
+ */
2986
+ readonly pages?: readonly PageDeclaration[];
2987
+ /**
2988
+ * Tool call formatter declarations.
2989
+ *
2990
+ * Formatters customize how specific tool calls are rendered in the chat
2991
+ * UI. Registered with `ToolCallFormatterRegistry` on extension load.
2992
+ */
2993
+ readonly toolFormatters?: readonly ToolCallFormatterDeclaration[];
2994
+ /**
2995
+ * Custom field type loaders for schema-driven forms.
2996
+ *
2997
+ * Maps field type identifiers to lazy-loaded React components that accept
2998
+ * `FormFieldProps`. Registered with `FormFieldRegistry` on extension load.
2999
+ * @example
3000
+ * ```typescript
3001
+ * fieldTypes: {
3002
+ * 'image-upload': () => import('./ui/ImageUploadField.js'),
3003
+ * }
3004
+ * ```
3005
+ */
3006
+ readonly fieldTypes?: Record<string, ExtensionFieldTypeLoader>;
3007
+ /**
3008
+ * Fully custom configuration component loader.
3009
+ *
3010
+ * When provided, the schema-driven form is bypassed entirely. Use this
3011
+ * for complex UIs where &gt;50% of fields need custom rendering.
3012
+ * @example
3013
+ * ```typescript
3014
+ * configComponent: () => import('./ui/CustomConfigPanel.js'),
3015
+ * ```
3016
+ */
3017
+ readonly configComponent?: ExtensionConfigComponentLoader;
3018
+ }
3019
+ //#endregion
3020
+ //#region packages/contracts/src/extension/contributions/bootstrap-types.d.ts
3021
+ /**
3022
+ * Context passed to bootstrap discovery and export operations.
3023
+ * @typeParam TBus - Host bus shape supplied by the runtime.
3024
+ */
3025
+ interface BootstrapDiscoverContext<TBus extends MakaioBusLike = MakaioBusLike> {
3026
+ /** Bus instance for querying the runtime. */
3027
+ bus: TBus;
3028
+ /** Active project identifier. */
3029
+ projectId: string;
3030
+ /** Absolute path to the project repository. */
3031
+ repoPath: string;
3032
+ }
3033
+ /** Context for export operations - identical to discover context. */
3034
+ type BootstrapExportContext<TBus extends MakaioBusLike = MakaioBusLike> = BootstrapDiscoverContext<TBus>;
3035
+ /** Context for import operations - extends discover context with the bootstrap folder path. */
3036
+ interface BootstrapImportContext<TBus extends MakaioBusLike = MakaioBusLike> extends BootstrapDiscoverContext<TBus> {
3037
+ /** Absolute path to the `.makaio/bootstrap/` folder being imported from. */
3038
+ bootstrapFolderPath: string;
3039
+ }
3040
+ /** A single exportable or importable bootstrap asset. */
3041
+ interface BootstrapAsset {
3042
+ /** Identifier of the extension that owns this asset. */
3043
+ extensionId: string;
3044
+ /** Logical asset type (e.g. `'session'`, `'config'`). */
3045
+ type: string;
3046
+ /** Human-readable asset name. */
3047
+ name: string;
3048
+ /** Filename within the bootstrap folder. */
3049
+ filename: string;
3050
+ /** Whether the asset already exists in the target environment. */
3051
+ exists?: boolean;
3052
+ /** Identifier of an existing asset that would be replaced by import. */
3053
+ existingId?: string;
3054
+ }
3055
+ /** Stable key type for bootstrap asset lookups. */
3056
+ type BootstrapAssetKey = string;
3057
+ /**
3058
+ * Build a stable key for a bootstrap asset.
3059
+ * @param asset - The asset to key.
3060
+ * @returns Stable asset key for UI state and list rendering.
3061
+ */
3062
+ declare function getBootstrapAssetKey(asset: BootstrapAsset): BootstrapAssetKey;
3063
+ /** Result of a single bootstrap import operation. */
3064
+ interface BootstrapImportResult {
3065
+ /** Whether the import succeeded. */
3066
+ success: boolean;
3067
+ /** Action taken during import. */
3068
+ action: 'created' | 'replaced' | 'skipped';
3069
+ /** Error message when `success` is `false`. */
3070
+ error?: string;
3071
+ }
3072
+ /** User-selected action for a conflicting bootstrap asset. */
3073
+ interface BootstrapChoice {
3074
+ /** The conflicting asset. */
3075
+ asset: BootstrapAsset;
3076
+ /** Chosen resolution action. */
3077
+ action: 'replace' | 'skip';
3078
+ }
3079
+ /** Result of a completed bootstrap operation (import or export). */
3080
+ interface BootstrapResult {
3081
+ /** The asset that was processed. */
3082
+ asset: BootstrapAsset;
3083
+ /** Action taken. */
3084
+ action: 'replaced' | 'skipped' | 'created';
3085
+ /** Error message when the operation failed. */
3086
+ error?: string;
3087
+ }
3088
+ /** Result of a bootstrap export operation. */
3089
+ interface BootstrapExportResult {
3090
+ /** The asset that was exported. */
3091
+ asset: BootstrapAsset;
3092
+ /** Absolute path to the file that was written. */
3093
+ filePath: string;
3094
+ /** Error message when the export failed. */
3095
+ error?: string;
3096
+ }
3097
+ /**
3098
+ * Bootstrap capability contributed by an extension.
3099
+ *
3100
+ * Participates in project export (`discoverExportable` + `export`) and
3101
+ * project import (`listImportable` + `import`) workflows.
3102
+ * @typeParam TBus - Host bus shape supplied by the runtime.
3103
+ */
3104
+ interface ExtensionBootstrap<TBus extends MakaioBusLike = MakaioBusLike> {
3105
+ /** Subfolder name within `.makaio/bootstrap/` for this extension's assets. */
3106
+ folder: string;
3107
+ /**
3108
+ * List assets that can be imported from the bootstrap folder.
3109
+ * @param ctx - Import context with bus, project, and bootstrap folder path.
3110
+ * @param files - Files present in the bootstrap folder.
3111
+ * @returns Assets available for import.
3112
+ */
3113
+ listImportable: (ctx: BootstrapImportContext<TBus>, files: string[]) => Promise<BootstrapAsset[]>;
3114
+ /**
3115
+ * Discover assets available for export from the current project.
3116
+ * @param ctx - Discovery context with bus and project info.
3117
+ * @returns Assets that can be exported.
3118
+ */
3119
+ discoverExportable: (ctx: BootstrapDiscoverContext<TBus>) => Promise<BootstrapAsset[]>;
3120
+ /**
3121
+ * Export a single asset and return its serialized content.
3122
+ * @param ctx - Export context with bus and project info.
3123
+ * @param asset - The asset to export.
3124
+ * @returns Serialized content string written to the bootstrap folder.
3125
+ */
3126
+ export: (ctx: BootstrapExportContext<TBus>, asset: BootstrapAsset) => Promise<string>;
3127
+ /**
3128
+ * Import a single asset from its serialized content.
3129
+ * @param ctx - Import context with bus, project, and bootstrap folder path.
3130
+ * @param asset - The asset being imported.
3131
+ * @param content - Serialized content string from the bootstrap folder.
3132
+ * @param action - User-selected conflict resolution action.
3133
+ * @returns Result of the import operation.
3134
+ */
3135
+ import: (ctx: BootstrapImportContext<TBus>, asset: BootstrapAsset, content: string, action: 'replace' | 'skip') => Promise<BootstrapImportResult>;
3136
+ }
3137
+ //#endregion
3138
+ //#region packages/contracts/src/extension/makaio-extension.d.ts
3139
+ /**
3140
+ * Awaited contribution processor registered with the runtime coordinator.
3141
+ *
3142
+ * Processors are registered before package startup and are invoked when a
3143
+ * package activates or stops. A processor can filter the packages it handles
3144
+ * by inspecting the executable {@link MakaioExtension} manifest.
3145
+ * @typeParam THostContext - Host context supplied to active extensions.
3146
+ */
3147
+ interface ExtensionContributionProcessor<THostContext extends ExtensionContext = NodeExtensionContext> {
3148
+ /**
3149
+ * Optional activation filter.
3150
+ * @param pkg - Extension manifest to evaluate.
3151
+ * @returns `true` when this processor should handle the extension.
3152
+ */
3153
+ readonly filter?: (pkg: MakaioExtension<THostContext>) => boolean;
3154
+ /**
3155
+ * Called when an extension is being activated.
3156
+ * @param name - Extension package name.
3157
+ * @param pkg - Extension manifest.
3158
+ * @param ctx - Per-extension runtime context.
3159
+ */
3160
+ readonly processActivated: (name: string, pkg: MakaioExtension<THostContext>, ctx: THostContext) => Promise<void>;
3161
+ /**
3162
+ * Called when an extension is stopped or disabled.
3163
+ * @param name - Extension package name.
3164
+ */
3165
+ readonly processStopped?: (name: string) => Promise<void>;
3166
+ }
3167
+ /**
3168
+ * Context for executable boot contributions declared by extension packages.
3169
+ *
3170
+ * This seam runs after all packages have been loaded into the coordinator and
3171
+ * before startup begins, so packages can register contribution processors for
3172
+ * extension surfaces they own.
3173
+ * @typeParam THostContext - Host context supplied to contribution processors.
3174
+ */
3175
+ interface ExtensionRuntimeBootContext<THostContext extends ExtensionContext = NodeExtensionContext> {
3176
+ /** Runtime bus. */
3177
+ readonly bus: THostContext['bus'];
3178
+ /**
3179
+ * Register a contribution processor before package startup.
3180
+ * @param processor - Processor to add to the coordinator.
3181
+ */
3182
+ readonly registerContributionProcessor: (processor: ExtensionContributionProcessor<THostContext>) => void;
3183
+ /**
3184
+ * Enumerate active extensions lazily after startup.
3185
+ * @param callback - Called for each active extension with its context.
3186
+ */
3187
+ readonly forEachActiveExtension: (callback: (name: string, pkg: MakaioExtension<THostContext>, ctx: THostContext) => void) => void;
3188
+ }
3189
+ /**
3190
+ * Executable boot contribution declared by an extension package.
3191
+ *
3192
+ * Use this for runtime wiring that must be installed before
3193
+ * {@link ExtensionContributionProcessor} activation starts, such as registering
3194
+ * processors for extension-owned contribution surfaces.
3195
+ * @typeParam THostContext - Host context supplied by the runtime.
3196
+ */
3197
+ interface ExtensionRuntimeBootContribution<THostContext extends ExtensionContext = NodeExtensionContext> {
3198
+ /**
3199
+ * Configure the runtime coordinator before package startup.
3200
+ * @param context - Minimal boot context supplied by the host runtime.
3201
+ * @returns Optional cleanup callback or callbacks for runtime shutdown.
3202
+ */
3203
+ readonly configure: (context: ExtensionRuntimeBootContext<THostContext>) => void | (() => void) | readonly (() => void)[];
3204
+ }
3205
+ /**
3206
+ * Executable Makaio extension manifest.
3207
+ *
3208
+ * Extends {@link ExtensionManifest} with executable code: a service factory,
3209
+ * a CLI contribution with interactive TUI support, and a Drizzle storage
3210
+ * handler registration callback.
3211
+ *
3212
+ * Source-of-truth rule: fields on this executable extension are the runtime
3213
+ * wiring source. Serializable descriptor fields, including
3214
+ * {@link ExtensionManifest.contributions}, are discovery metadata and are not
3215
+ * promoted into executable contribution surfaces by the loader.
3216
+ *
3217
+ * The host runtime calls {@link create} (if defined) with a
3218
+ * {@link ExtensionContext} to instantiate the service. Window-only extensions
3219
+ * that have no background service may omit {@link create} entirely.
3220
+ * @typeParam THostContext - Concrete context shape supplied by the host
3221
+ * runtime. Defaults to {@link NodeExtensionContext} because the current
3222
+ * framework hosts are Node-based.
3223
+ * @example
3224
+ * ```ts
3225
+ * export const myExtension: MakaioExtension = {
3226
+ * name: 'my-extension',
3227
+ * displayName: 'My Extension',
3228
+ * create: (ctx) => new MyService(ctx.bus),
3229
+ * };
3230
+ * ```
3231
+ */
3232
+ interface MakaioExtension<THostContext extends ExtensionContext = NodeExtensionContext> extends ExtensionManifest {
3233
+ /**
3234
+ * Bus namespace definitions owned by this extension.
3235
+ *
3236
+ * Registered by `ExtensionCoordinator` during extension activation, before
3237
+ * {@link create} is called, so handlers registered during construction can
3238
+ * rely on the namespace being available.
3239
+ *
3240
+ * Extensions that don't own bus namespaces omit this field.
3241
+ */
3242
+ readonly namespaces?: readonly RegistrableBusNamespaceDefinition[];
3243
+ /**
3244
+ * Factory that creates and returns the extension's service.
3245
+ *
3246
+ * Optional — window-only extensions that have no background service may omit
3247
+ * this field entirely. When present, the host calls this during startup; the
3248
+ * extension is responsible for all internal composition (choosing backends,
3249
+ * creating sources, etc.) based on the provided context.
3250
+ * @param ctx - Runtime context with bus, host details, and machine identity.
3251
+ * @returns The extension's service instance (not yet initialized — host calls `init`).
3252
+ */
3253
+ readonly create?: (ctx: THostContext) => ExtensionService | Promise<ExtensionService>;
3254
+ /**
3255
+ * Executable ownership declarations for runtime responsibilities that must
3256
+ * have exactly one owner in a booted runtime.
3257
+ */
3258
+ readonly runtimeOwnership?: ExtensionRuntimeOwnership;
3259
+ /**
3260
+ * Boot-time executable contribution for registering runtime processors or
3261
+ * services before package startup begins.
3262
+ */
3263
+ readonly runtimeBoot?: ExtensionRuntimeBootContribution<THostContext>;
3264
+ /**
3265
+ * When true, startup fails if this extension fails to initialize.
3266
+ *
3267
+ * Optional extensions default to isolated failure so one extension cannot
3268
+ * prevent the runtime from booting. Framework and host core extensions set
3269
+ * this to true when the runtime cannot safely continue without them.
3270
+ */
3271
+ readonly critical?: boolean;
3272
+ /**
3273
+ * Executable CLI contribution registered under `makaio <name>`.
3274
+ *
3275
+ * The runtime exposes the fully typed helper API through
3276
+ * `@makaio/kernel/cli` when authoring CLI commands. This manifest stores
3277
+ * only the type-erased executable shape used after loading.
3278
+ */
3279
+ readonly cli?: ExtensionCliContribution<THostContext['bus']>;
3280
+ /**
3281
+ * Server-side HTTP routes.
3282
+ * Hosts that support HTTP route contributions call `mount()` on a fresh,
3283
+ * rebuildable app graph as extensions activate or stop. Contracts keeps the
3284
+ * app type erased so this layer does not depend on Hono.
3285
+ * @param app - Host-owned HTTP app instance.
3286
+ */
3287
+ readonly http?: {
3288
+ readonly prefix: string;
3289
+ readonly mount: (app: unknown) => void;
3290
+ };
3291
+ /**
3292
+ * Executable storage contribution.
3293
+ *
3294
+ * Extends {@link StorageManifest} (migration paths) with a Drizzle handler
3295
+ * registration callback invoked by the composition root after migrations
3296
+ * have been applied but before services are started.
3297
+ *
3298
+ * The `db` parameter is typed as `unknown` in the contracts layer (which
3299
+ * does not take a drizzle dependency) — composition roots cast it to
3300
+ * `MakaioDatabase` before calling. The returned cleanup function is
3301
+ * invoked during graceful shutdown to unregister bus handlers.
3302
+ */
3303
+ readonly storage?: StorageManifest & {
3304
+ /**
3305
+ * Absolute extension root used to resolve relative storage asset paths.
3306
+ *
3307
+ * Required when a code-defined extension declares relative
3308
+ * {@link StorageManifest.migrations} paths, since there is no descriptor
3309
+ * file path for the runtime to infer from.
3310
+ */
3311
+ readonly packageRoot?: string;
3312
+ /**
3313
+ * Stable runtime identity for the migration bundle.
3314
+ *
3315
+ * Bundled hosts use this instead of packaged output paths when they need a
3316
+ * durable key for migration deduplication and embedded lookup.
3317
+ */
3318
+ readonly migrationSourceId?: string;
3319
+ /**
3320
+ * Registers Drizzle-backed bus storage handlers for this extension.
3321
+ * @param bus - The application bus instance.
3322
+ * @param db - The Drizzle database instance (typed opaquely here; cast at the call site).
3323
+ * @param ctx - Runtime extension context supplying host details and machine identity
3324
+ * (e.g., for machine-scoped storage registration).
3325
+ * @returns Optional cleanup function called during shutdown to unregister handlers.
3326
+ */
3327
+ readonly registerHandlers?: (bus: THostContext['bus'], db: unknown, ctx: THostContext) => (() => void) | void;
3328
+ };
3329
+ /**
3330
+ * Zod schema describing this extension's configuration shape.
3331
+ *
3332
+ * When present, the coordinator:
3333
+ * 1. Exposes the schema as JSON Schema via `extension.getConfigSchema` RPC
3334
+ * 2. Loads stored config from `ExtensionConfigStorageSubjects` at boot
3335
+ * 3. Parses it through this schema and injects the result into
3336
+ * {@link ExtensionContext.config}
3337
+ *
3338
+ * The schema should provide `.default()` values for all optional fields
3339
+ * so parsing `{}` always yields a valid config.
3340
+ */
3341
+ readonly configSchema?: z.ZodType;
3342
+ /**
3343
+ * UI configuration for schema-driven configuration forms.
3344
+ *
3345
+ * Controls how the config form is rendered: edit mode (slidePanel vs full),
3346
+ * which fields to hide, and per-field widget overrides (e.g. slider, color
3347
+ * picker). Only meaningful when {@link configSchema} is also declared.
3348
+ */
3349
+ readonly uiConfig?: EntityUIConfig;
3350
+ /**
3351
+ * Client runtime definitions contributed by this extension.
3352
+ *
3353
+ * Loaded clients are passed to `createClientsCorePackage` during boot and
3354
+ * registered with the client bootstrap service. These definitions are the
3355
+ * runtime source of truth for client wiring; descriptor `contributions.clients`
3356
+ * is discovery metadata only.
3357
+ */
3358
+ readonly clients?: readonly ClientDefinition[];
3359
+ /**
3360
+ * Provider definitions contributed by this extension.
3361
+ *
3362
+ * Each entry defines a model provider (e.g., Anthropic, OpenAI) with its
3363
+ * supported models, capabilities, and credential requirements. Loaded
3364
+ * providers are registered with the provider subsystem during boot.
3365
+ *
3366
+ * Provider definitions are executable extension contributions. Descriptor
3367
+ * `contributions.providers` may mirror provider identity metadata for
3368
+ * pre-load discovery, but is not a registration fallback.
3369
+ */
3370
+ readonly providers?: readonly ProviderDefinitionInput[];
3371
+ /**
3372
+ * Adapter runtime definitions contributed by this extension.
3373
+ *
3374
+ * Each entry pairs JSON-serializable discovery metadata with the full
3375
+ * runtime adapter definition typed via {@link AdapterDefinitionContract}.
3376
+ * The adapter contribution processor consumes this executable field directly;
3377
+ * descriptor `contributions.adapters` is not a registration fallback.
3378
+ */
3379
+ readonly adapters?: readonly AdapterContribution[];
3380
+ /**
3381
+ * Log import capability for external tool session import.
3382
+ *
3383
+ * Opaque in contracts. The log-import contribution processor narrows
3384
+ * `config` to `PluginLogImport` at processing time.
3385
+ */
3386
+ readonly logImport?: LogImportContribution;
3387
+ /**
3388
+ * Tool contribution factory for this extension.
3389
+ *
3390
+ * When present, the runtime calls `createToolsets(ctx)` after all
3391
+ * dependencies are loaded and registers the returned toolsets with
3392
+ * `ToolRegistry`. Extensions that contribute tools should declare a dependency
3393
+ * on the tool-registry service if one is required for registration.
3394
+ */
3395
+ readonly tools?: ExtensionToolsContribution<THostContext>;
3396
+ /**
3397
+ * Hash trigger factory for this extension.
3398
+ *
3399
+ * When present, the runtime calls `createTriggers(bus)` after all
3400
+ * dependencies are loaded, then registers the returned triggers with
3401
+ * `HashTriggerService`.
3402
+ *
3403
+ * Extensions declaring triggers should depend on `'hash-trigger'` to ensure
3404
+ * the service exists when triggers are registered.
3405
+ */
3406
+ readonly triggers?: ExtensionTriggersContribution<THostContext['bus']>;
3407
+ /**
3408
+ * Session event action factory for this extension.
3409
+ *
3410
+ * When present, the runtime calls `createActions(ctx)` after all
3411
+ * dependencies are loaded and registers the returned declarations with
3412
+ * `SessionEventActionService`. Unregister callbacks are stored for
3413
+ * shutdown cleanup.
3414
+ */
3415
+ readonly sessionEventActions?: ExtensionSessionEventActionsContribution<THostContext['bus']>;
3416
+ /**
3417
+ * Bootstrap capability for project config import/export.
3418
+ *
3419
+ * When present, this extension participates in:
3420
+ * - Project export: extension data can be saved to `.makaio/bootstrap/`
3421
+ * - Project import: extension data can be restored from `.makaio/bootstrap/`
3422
+ */
3423
+ readonly bootstrap?: ExtensionBootstrap<THostContext['bus']>;
3424
+ /**
3425
+ * Bus namespace introspection for this extension.
3426
+ *
3427
+ * The domain is auto-prefixed to `'extension:NAME'` to avoid collisions.
3428
+ * Register schemas statically in a `namespace.ts` file for type-safe
3429
+ * subjects, then reference them here for documentation and introspection.
3430
+ */
3431
+ readonly namespace?: ExtensionNamespaceContribution;
3432
+ /**
3433
+ * Browser UI contributions for this extension.
3434
+ *
3435
+ * Groups all UI-layer contribution surfaces. Absent for headless-only
3436
+ * extensions. The coordinator passes this bag to the UI loader
3437
+ * which bridges each surface to the appropriate client-side registry.
3438
+ */
3439
+ readonly ui?: ExtensionUiContribution;
3440
+ }
3441
+ /**
3442
+ * Convenience executable extension type for Node hosts.
3443
+ *
3444
+ * Contracts stays independent of the concrete bus implementation; Node-based
3445
+ * packages bind `TBus` from their host layer (for example `IMakaioBus` from
3446
+ * `@makaio/bus-core`) when they need the full typed bus authoring surface.
3447
+ * @typeParam TBus - Concrete bus type supplied by the Node host.
3448
+ */
3449
+ type MakaioNodeExtension<TBus extends MakaioBusLike> = MakaioExtension<NodeExtensionContext<TBus>>;
3450
+ //#endregion
3451
+ //#region packages/contracts/src/extension/extension-descriptor.d.ts
3452
+ /**
3453
+ * Discriminated union of supported transports for detached extensions.
3454
+ *
3455
+ * - `bus-stdio` — bidirectional Makaio bus over stdin/stdout.
3456
+ * - `bus-websocket` — bidirectional Makaio bus over a WebSocket connection.
3457
+ * - `mcp-stdio` — MCP protocol over stdin/stdout (no restart policy).
3458
+ */
3459
+ declare const DetachedTransportSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3460
+ command: z.ZodString;
3461
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
3462
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
3463
+ healthTimeoutMs: z.ZodOptional<z.ZodNumber>;
3464
+ shutdownTimeoutMs: z.ZodOptional<z.ZodNumber>;
3465
+ restartPolicy: z.ZodOptional<z.ZodEnum<{
3466
+ none: "none";
3467
+ always: "always";
3468
+ "on-crash": "on-crash";
3469
+ }>>;
3470
+ type: z.ZodLiteral<"bus-stdio">;
3471
+ }, z.core.$strip>, z.ZodObject<{
3472
+ command: z.ZodString;
3473
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
3474
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
3475
+ healthTimeoutMs: z.ZodOptional<z.ZodNumber>;
3476
+ shutdownTimeoutMs: z.ZodOptional<z.ZodNumber>;
3477
+ restartPolicy: z.ZodOptional<z.ZodEnum<{
3478
+ none: "none";
3479
+ always: "always";
3480
+ "on-crash": "on-crash";
3481
+ }>>;
3482
+ type: z.ZodLiteral<"bus-websocket">;
3483
+ }, z.core.$strip>, z.ZodObject<{
3484
+ command: z.ZodString;
3485
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
3486
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
3487
+ healthTimeoutMs: z.ZodOptional<z.ZodNumber>;
3488
+ shutdownTimeoutMs: z.ZodOptional<z.ZodNumber>;
3489
+ type: z.ZodLiteral<"mcp-stdio">;
3490
+ }, z.core.$strip>], "type">;
3491
+ /** Inferred type from {@link DetachedTransportSchema}. */
3492
+ type DetachedTransportConfig = z.infer<typeof DetachedTransportSchema>;
3493
+ /**
3494
+ * Convention-based entrypoint declarations for each runtime surface.
3495
+ *
3496
+ * `true` means "use the surface name as the stem". A string value is a custom
3497
+ * stem whose final path segment names the file (e.g. `"cli/index"` resolves to
3498
+ * `src/cli/index.ts` in dev or `dist/cli/index.mjs` in production). Omit
3499
+ * surfaces the extension does not target.
3500
+ *
3501
+ * The runtime resolves the stem by trying `src/{stem}.ts` first (dev), then
3502
+ * `dist/{stem}.mjs` (production). No path prefix or file extension should be
3503
+ * included in the descriptor — those are added by convention.
3504
+ */
3505
+ interface ExtensionEntrypoints {
3506
+ /** Server entry — exports a {@link MakaioExtension} as default export. */
3507
+ readonly server?: true | string;
3508
+ /** Browser entry — bundled JS loaded in the renderer. */
3509
+ readonly browser?: true | string;
3510
+ /** CLI entry — exports an `ExtensionCliContribution` as default export. */
3511
+ readonly cli?: true | string;
3512
+ }
3513
+ /** Zod schema for {@link ExtensionEntrypoints}. */
3514
+ declare const ExtensionEntrypointsSchema: z.ZodObject<{
3515
+ server: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
3516
+ browser: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
3517
+ cli: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
3518
+ }, z.core.$strip>;
3519
+ /**
3520
+ * Shared base fields for all extension descriptors.
3521
+ *
3522
+ * Contains the fields common to both embedded and detached descriptors,
3523
+ * excluding `entrypoints` and `transport` which differ per execution mode.
3524
+ */
3525
+ interface ExtensionDescriptorBase extends ExtensionManifest {
3526
+ /** SemVer version of the extension package. */
3527
+ readonly version: string;
3528
+ /** Framework version range required (npm semver range, e.g. `">=1.0.0 <2.0.0"`). */
3529
+ readonly makaio: {
3530
+ readonly framework: VersionRange;
3531
+ };
3532
+ /**
3533
+ * Default configuration values for this extension.
3534
+ *
3535
+ * Applied when no stored config exists. Keys should match the properties
3536
+ * in the extension's `configSchema` (declared on its {@link MakaioExtension}).
3537
+ * The Zod schema's own `.default()` values layer on top of these.
3538
+ */
3539
+ readonly config?: {
3540
+ readonly defaults?: Readonly<Record<string, unknown>>;
3541
+ };
3542
+ }
3543
+ /**
3544
+ * Descriptor for extensions running in the host process (default mode).
3545
+ *
3546
+ * `entrypoints` is required; `execution` is `'embedded'` or omitted.
3547
+ * `transport` must be absent.
3548
+ */
3549
+ interface EmbeddedDescriptor extends ExtensionDescriptorBase {
3550
+ /**
3551
+ * Handler execution mode — `'embedded'` or omitted (defaults to embedded).
3552
+ * Code is `import()`'d directly into the host process.
3553
+ */
3554
+ readonly execution?: 'embedded';
3555
+ /**
3556
+ * Convention-based entrypoint stems and enabled-surface flags per runtime
3557
+ * surface. Required for embedded extensions.
3558
+ */
3559
+ readonly entrypoints: ExtensionEntrypoints;
3560
+ /** Must be absent for embedded extensions. */
3561
+ readonly transport?: undefined;
3562
+ }
3563
+ /**
3564
+ * Descriptor for extensions running as child processes.
3565
+ *
3566
+ * `transport` is required; `execution` must be `'detached'`.
3567
+ * `entrypoints` must be absent.
3568
+ */
3569
+ interface DetachedDescriptor extends ExtensionDescriptorBase {
3570
+ /**
3571
+ * Handler execution mode — must be `'detached'` for subprocess extensions.
3572
+ * The extension runs as a child process communicating via the chosen transport.
3573
+ */
3574
+ readonly execution: 'detached';
3575
+ /**
3576
+ * Transport configuration for detached extensions.
3577
+ *
3578
+ * Specifies the IPC mechanism and process lifecycle options for the child
3579
+ * process.
3580
+ */
3581
+ readonly transport: DetachedTransportConfig;
3582
+ /** Must be absent for detached extensions. */
3583
+ readonly entrypoints?: undefined;
3584
+ }
3585
+ /**
3586
+ * Discriminated union of extension descriptor shapes.
3587
+ *
3588
+ * Narrows automatically via `execution` check:
3589
+ * - `descriptor.execution === 'detached'` → `DetachedDescriptor`
3590
+ * - Otherwise (including `undefined`) → `EmbeddedDescriptor`
3591
+ *
3592
+ * Use {@link isDetachedDescriptor} for an explicit type guard.
3593
+ */
3594
+ type ExtensionDescriptor = EmbeddedDescriptor | DetachedDescriptor;
3595
+ /**
3596
+ * Type guard for detached extension descriptors.
3597
+ *
3598
+ * After this guard returns `true`, TypeScript narrows the descriptor to
3599
+ * {@link DetachedDescriptor} where `transport` is required and `entrypoints`
3600
+ * is absent.
3601
+ * @param descriptor - The extension descriptor to check.
3602
+ * @returns Whether the descriptor is for a detached (subprocess) extension.
3603
+ */
3604
+ declare function isDetachedDescriptor(descriptor: ExtensionDescriptor): descriptor is DetachedDescriptor;
3605
+ /**
3606
+ * Zod schema for {@link ExtensionDescriptor}.
3607
+ *
3608
+ * Enforces execution-mode invariants via `superRefine`:
3609
+ * - `execution === 'detached'` requires `transport`; `entrypoints` is optional.
3610
+ * - All other modes (including the default embedded mode) require `entrypoints`.
3611
+ *
3612
+ * Note: `satisfies z.ZodType<ExtensionDescriptor>` is intentionally omitted
3613
+ * because `superRefine` wraps the schema in `ZodEffects`, which is incompatible
3614
+ * with that constraint.
3615
+ */
3616
+ declare const ExtensionDescriptorSchema: z.ZodObject<{
3617
+ name: z.ZodString;
3618
+ displayName: z.ZodString;
3619
+ surface: z.ZodOptional<z.ZodEnum<{
3620
+ any: "any";
3621
+ interactive: "interactive";
3622
+ headless: "headless";
3623
+ }>>;
3624
+ dependencies: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
3625
+ type: z.ZodLiteral<"extension">;
3626
+ name: z.ZodString;
3627
+ version: z.ZodString;
3628
+ optional: z.ZodOptional<z.ZodBoolean>;
3629
+ }, z.core.$strip>>>>;
3630
+ requires: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
3631
+ type: z.ZodLiteral<"host">;
3632
+ id: z.ZodString;
3633
+ }, z.core.$strip>, z.ZodObject<{
3634
+ type: z.ZodLiteral<"capability">;
3635
+ id: z.ZodString;
3636
+ version: z.ZodOptional<z.ZodString>;
3637
+ }, z.core.$strip>], "type">>>>;
3638
+ provides: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodType<"adapters", unknown, z.core.$ZodTypeInternals<"adapters", unknown>>>>>;
3639
+ windows: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
3640
+ id: z.ZodString;
3641
+ style: z.ZodEnum<{
3642
+ "tray-popover": "tray-popover";
3643
+ utility: "utility";
3644
+ panel: "panel";
3645
+ }>;
3646
+ width: z.ZodOptional<z.ZodNumber>;
3647
+ height: z.ZodOptional<z.ZodNumber>;
3648
+ singleton: z.ZodOptional<z.ZodBoolean>;
3649
+ params: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
3650
+ name: z.ZodString;
3651
+ required: z.ZodOptional<z.ZodBoolean>;
3652
+ }, z.core.$strip>>>>;
3653
+ }, z.core.$strip>>>>;
3654
+ tray: z.ZodOptional<z.ZodObject<{
3655
+ label: z.ZodString;
3656
+ section: z.ZodOptional<z.ZodEnum<{
3657
+ tools: "tools";
3658
+ utilities: "utilities";
3659
+ views: "views";
3660
+ }>>;
3661
+ opensWindow: z.ZodOptional<z.ZodString>;
3662
+ action: z.ZodOptional<z.ZodString>;
3663
+ }, z.core.$strip>>;
3664
+ cli: z.ZodOptional<z.ZodObject<{
3665
+ name: z.ZodString;
3666
+ description: z.ZodString;
3667
+ subcommands: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
3668
+ name: z.ZodString;
3669
+ description: z.ZodString;
3670
+ args: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
3671
+ name: z.ZodString;
3672
+ description: z.ZodString;
3673
+ required: z.ZodOptional<z.ZodBoolean>;
3674
+ positional: z.ZodOptional<z.ZodBoolean>;
3675
+ short: z.ZodOptional<z.ZodString>;
3676
+ type: z.ZodOptional<z.ZodEnum<{
3677
+ string: "string";
3678
+ number: "number";
3679
+ boolean: "boolean";
3680
+ }>>;
3681
+ }, z.core.$strip>>>>;
3682
+ }, z.core.$strip>>>>;
3683
+ hasInteractive: z.ZodOptional<z.ZodBoolean>;
3684
+ }, z.core.$strip>>;
3685
+ storage: z.ZodOptional<z.ZodObject<{
3686
+ migrations: z.ZodOptional<z.ZodString>;
3687
+ migrationSourceId: z.ZodOptional<z.ZodString>;
3688
+ }, z.core.$strip>>;
3689
+ browser: z.ZodOptional<z.ZodObject<{
3690
+ entrypoint: z.ZodString;
3691
+ }, z.core.$strip>>;
3692
+ contributions: z.ZodOptional<z.ZodObject<{
3693
+ adapters: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
3694
+ name: z.ZodString;
3695
+ displayName: z.ZodOptional<z.ZodString>;
3696
+ description: z.ZodOptional<z.ZodString>;
3697
+ clients: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
3698
+ id: z.ZodString;
3699
+ version: z.ZodString;
3700
+ binaryVersion: z.ZodOptional<z.ZodString>;
3701
+ }, z.core.$strip>>>>;
3702
+ protocols: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
3703
+ anthropic: "anthropic";
3704
+ openai: "openai";
3705
+ }>, z.ZodObject<{
3706
+ anthropic: z.ZodOptional<z.ZodObject<{
3707
+ endpoint: z.ZodOptional<z.ZodString>;
3708
+ }, z.core.$strip>>;
3709
+ openai: z.ZodOptional<z.ZodObject<{
3710
+ endpoint: z.ZodOptional<z.ZodString>;
3711
+ }, z.core.$strip>>;
3712
+ }, z.core.$strip>]>>>;
3713
+ defaultProvider: z.ZodOptional<z.ZodString>;
3714
+ }, z.core.$strip>>>>;
3715
+ clients: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
3716
+ id: z.ZodString;
3717
+ name: z.ZodString;
3718
+ description: z.ZodOptional<z.ZodString>;
3719
+ binary: z.ZodOptional<z.ZodObject<{
3720
+ name: z.ZodString;
3721
+ }, z.core.$strict>>;
3722
+ }, z.core.$strict>>>>;
3723
+ providers: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
3724
+ id: z.ZodString;
3725
+ name: z.ZodString;
3726
+ description: z.ZodOptional<z.ZodString>;
3727
+ }, z.core.$strip>>>>;
3728
+ triggers: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
3729
+ prefix: z.ZodString;
3730
+ description: z.ZodOptional<z.ZodString>;
3731
+ stage: z.ZodOptional<z.ZodEnum<{
3732
+ transform: "transform";
3733
+ action: "action";
3734
+ gather: "gather";
3735
+ }>>;
3736
+ }, z.core.$strip>>>>;
3737
+ logImporters: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
3738
+ adapterName: z.ZodString;
3739
+ displayName: z.ZodString;
3740
+ logFilePattern: z.ZodOptional<z.ZodString>;
3741
+ }, z.core.$strip>>>>;
3742
+ sessionEventActions: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
3743
+ id: z.ZodString;
3744
+ label: z.ZodString;
3745
+ description: z.ZodOptional<z.ZodString>;
3746
+ icon: z.ZodOptional<z.ZodString>;
3747
+ selectionMode: z.ZodEnum<{
3748
+ single: "single";
3749
+ multi: "multi";
3750
+ }>;
3751
+ messageRoles: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
3752
+ user: "user";
3753
+ assistant: "assistant";
3754
+ }>>>>;
3755
+ }, z.core.$strip>>>>;
3756
+ create: z.ZodOptional<z.ZodBoolean>;
3757
+ tools: z.ZodOptional<z.ZodBoolean>;
3758
+ bootstrap: z.ZodOptional<z.ZodBoolean>;
3759
+ namespace: z.ZodOptional<z.ZodBoolean>;
3760
+ configSchema: z.ZodOptional<z.ZodBoolean>;
3761
+ uiConfig: z.ZodOptional<z.ZodBoolean>;
3762
+ ui: z.ZodOptional<z.ZodObject<{
3763
+ tiles: z.ZodOptional<z.ZodBoolean>;
3764
+ widgets: z.ZodOptional<z.ZodBoolean>;
3765
+ pages: z.ZodOptional<z.ZodBoolean>;
3766
+ routes: z.ZodOptional<z.ZodBoolean>;
3767
+ }, z.core.$strip>>;
3768
+ }, z.core.$strip>>;
3769
+ version: z.ZodString;
3770
+ makaio: z.ZodReadonly<z.ZodObject<{
3771
+ framework: z.ZodString;
3772
+ }, z.core.$strict>>;
3773
+ entrypoints: z.ZodOptional<z.ZodObject<{
3774
+ server: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
3775
+ browser: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
3776
+ cli: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
3777
+ }, z.core.$strip>>;
3778
+ execution: z.ZodOptional<z.ZodEnum<{
3779
+ embedded: "embedded";
3780
+ detached: "detached";
3781
+ }>>;
3782
+ transport: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
3783
+ command: z.ZodString;
3784
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
3785
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
3786
+ healthTimeoutMs: z.ZodOptional<z.ZodNumber>;
3787
+ shutdownTimeoutMs: z.ZodOptional<z.ZodNumber>;
3788
+ restartPolicy: z.ZodOptional<z.ZodEnum<{
3789
+ none: "none";
3790
+ always: "always";
3791
+ "on-crash": "on-crash";
3792
+ }>>;
3793
+ type: z.ZodLiteral<"bus-stdio">;
3794
+ }, z.core.$strip>, z.ZodObject<{
3795
+ command: z.ZodString;
3796
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
3797
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
3798
+ healthTimeoutMs: z.ZodOptional<z.ZodNumber>;
3799
+ shutdownTimeoutMs: z.ZodOptional<z.ZodNumber>;
3800
+ restartPolicy: z.ZodOptional<z.ZodEnum<{
3801
+ none: "none";
3802
+ always: "always";
3803
+ "on-crash": "on-crash";
3804
+ }>>;
3805
+ type: z.ZodLiteral<"bus-websocket">;
3806
+ }, z.core.$strip>, z.ZodObject<{
3807
+ command: z.ZodString;
3808
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
3809
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
3810
+ healthTimeoutMs: z.ZodOptional<z.ZodNumber>;
3811
+ shutdownTimeoutMs: z.ZodOptional<z.ZodNumber>;
3812
+ type: z.ZodLiteral<"mcp-stdio">;
3813
+ }, z.core.$strip>], "type">>;
3814
+ config: z.ZodOptional<z.ZodObject<{
3815
+ defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3816
+ }, z.core.$strip>>;
3817
+ }, z.core.$strip>;
3818
+ /**
3819
+ * Parse and validate an extension descriptor from raw JSON input.
3820
+ *
3821
+ * This is the typed wrapper around {@link ExtensionDescriptorSchema} that
3822
+ * returns the {@link ExtensionDescriptor} discriminated union. Throws a Zod
3823
+ * error on invalid input.
3824
+ * @param input - Raw JSON-like value to parse.
3825
+ * @returns Parsed and typed extension descriptor.
3826
+ */
3827
+ declare function parseExtensionDescriptor(input: unknown): ExtensionDescriptor;
3828
+ /** Result shape returned by {@link safeParseExtensionDescriptor}. */
3829
+ type ExtensionDescriptorParseResult = {
3830
+ readonly success: true;
3831
+ readonly data: ExtensionDescriptor;
3832
+ } | {
3833
+ readonly success: false;
3834
+ readonly error: z.ZodError;
3835
+ };
3836
+ /**
3837
+ * Safely parse and validate an extension descriptor from raw JSON input.
3838
+ *
3839
+ * This is the typed wrapper around {@link ExtensionDescriptorSchema} that
3840
+ * returns a result with the {@link ExtensionDescriptor} discriminated union on
3841
+ * success.
3842
+ * @param input - Raw JSON-like value to parse.
3843
+ * @returns Parse result with `data` typed as {@link ExtensionDescriptor} on
3844
+ * success, or a Zod error on failure.
3845
+ */
3846
+ declare function safeParseExtensionDescriptor(input: unknown): ExtensionDescriptorParseResult;
3847
+ //#endregion
3848
+ //#region packages/contracts/src/extension/parse-extension-config.d.ts
3849
+ /**
3850
+ * Parse raw extension config with a Zod schema, applying schema defaults.
3851
+ *
3852
+ * Handles the common extension initialization pattern where `ctx.config` may be
3853
+ * `undefined` (no stored config) or a partial object. The schema is expected
3854
+ * to provide defaults for all optional fields so that parsing `{}` always
3855
+ * yields a valid config.
3856
+ * @param schema - Zod schema with defaults for all optional fields.
3857
+ * @param rawConfig - Raw config value from {@link ExtensionContext.config} (may be undefined).
3858
+ * @returns Validated and defaulted config object.
3859
+ * @example
3860
+ * ```typescript
3861
+ * create: (ctx) => {
3862
+ * const config = parseExtensionConfig(MyConfigSchema, ctx.config);
3863
+ * return new MyService(ctx.bus, config);
3864
+ * },
3865
+ * ```
3866
+ */
3867
+ declare function parseExtensionConfig<T extends z.ZodType>(schema: T, rawConfig: unknown): z.infer<T>;
3868
+ //#endregion
3869
+ //#region packages/contracts/src/extension/extension-config-provider.d.ts
3870
+ /**
3871
+ * Provider for persisted extension configuration and enablement state.
3872
+ *
3873
+ * Injected by the host composition root. When absent, all extensions start
3874
+ * enabled with default (Zod-schema) configuration only.
3875
+ */
3876
+ interface ExtensionConfigProvider {
3877
+ /**
3878
+ * Load persisted configuration for an extension by name.
3879
+ *
3880
+ * Returns `undefined` when no stored config exists for the extension.
3881
+ * Invalid values are ignored by the coordinator during schema parse.
3882
+ * @param name - Extension package name.
3883
+ * @returns Stored configuration object, or `undefined` when absent.
3884
+ */
3885
+ loadConfig(name: string): Record<string, unknown> | undefined;
3886
+ /**
3887
+ * Check whether an extension is enabled in persistent storage.
3888
+ *
3889
+ * Returns `undefined` to indicate no persisted preference — the coordinator
3890
+ * treats `undefined` the same as `true` (start normally).
3891
+ * @param name - Extension package name.
3892
+ * @returns `false` to skip the package at boot, `true` or `undefined` to start normally.
3893
+ */
3894
+ loadEnabled(name: string): boolean | undefined;
3895
+ }
3896
+ //#endregion
3897
+ export { ToolCallFormatterDeclaration as $, AdapterClientRefSchema as $n, WhenContext as $t, ExtensionBootstrap as A, CliManifestSchema as An, HashTriggerContext as At, ExtensionConfigComponentProps as B, StorageManifestSchema as Bn, EventFilter as Bt, BootstrapChoice as C, AdapterProviderDefinitionContract as Cn, UiRuntimeNavigationLevel as Ct, BootstrapImportContext as D, CliArgManifest as Dn, GatheredEntry as Dt, BootstrapExportResult as E, extensionToken as En, GatheredContext as Et, ExtensionToolsContribution as F, ExtensionManifest as Fn, ActionCategoryMap as Ft, MakaioWebUiComponentProps as G, WindowParamSpec as Gn, PickerConfig as Gt, LoaderContext as H, TrayManifestSchema as Hn, ExecuteResult as Ht, ExtensionTriggersContribution as I, ExtensionManifestSchema as In, ActionShortcut as It, PromisifiedActions as J, dep as Jn, SelectionFeedback as Jt, MakaioWebUiLoader as K, WindowParamSpecSchema as Kn, PickerOpenContext as Kt, ExtensionUiContribution as L, RuntimeRequirement as Ln, ActionShortcutModifiers as Lt, AdapterContribution as M, CliSubcommandManifestSchema as Mn, HashTriggerStage as Mt, ExtensionNamespaceContribution as N, ExtensionDependency as Nn, HashTriggerSuggestResult as Nt, BootstrapImportResult as O, CliArgManifestSchema as On, HashSuggestion as Ot, ExtensionSessionEventActionsContribution as P, ExtensionDependencySchema as Pn, ActionCategory as Pt, PluginTransformedContentType as Q, AdapterClientRef as Qn, StructuralEventFilter as Qt, LogImportContribution as R, RuntimeRequirementSchema as Rn, CreateSessionEventActionResult as Rt, BootstrapAssetKey as S, AdapterDefinitionContract as Sn, BrowserEntrypointSchema as Sr, UiNavigationLevelMap as St, BootstrapExportContext as T, ExtensionToken as Tn, UiScopeMap as Tt, MakaioWebUiAction as U, WindowManifest as Un, MessageEventFilter as Ut, ExtensionFieldTypeLoader as V, TrayManifest as Vn, ExecuteContext as Vt, MakaioWebUiActions as W, WindowManifestSchema as Wn, MessageRole as Wt, PluginToolCallFormatterInput as X, CapabilityTokenMap as Xn, SessionEventActionDeclaration as Xt, PluginFormattedToolCallOutput as Y, CapabilityToken as Yn, SessionEventActionContext as Yt, PluginTransformedContent as Z, CapabilityTokenSchema as Zn, SessionEventActionOptions as Zt, ExtensionRuntimeBootContext as _, ExtensionWarningEntrySchema as _n, TriggerManifestSchema as _r, TileRenderers as _t, DetachedTransportSchema as a, ExtensionCliInteractiveContext as an, ContributionManifestSchema as ar, SlotId as at, MakaioNodeExtension as b, ExtensionWarningSeveritySchema as bn, UiSurfaceFlagsSchema as br, UiContextValueMap as bt, ExtensionDescriptorBase as c, ExtensionContext as cn, ProtocolConfig as cr, WidgetDeclaration as ct, ExtensionEntrypoints as d, ExtensionService as dn, ProtocolRefSchema as dr, WidgetRenderers as dt, ExtensionRuntimeOwnership as en, AdapterManifest as er, PageComponentProps as et, ExtensionEntrypointsSchema as f, ExtensionServiceLifecycle as fn, ProviderManifest as fr, WidgetSize$1 as ft, ExtensionContributionProcessor as g, ExtensionWarningEntry as gn, TriggerManifest as gr, TileProps as gt, safeParseExtensionDescriptor as h, ExtensionWarningActionSchema as hn, SessionEventActionManifestSchema as hr, TileIconLoader as ht, DetachedTransportConfig as i, ExtensionCliHandlerContext as in, ContributionManifest as ir, SlotDeclaration as it, getBootstrapAssetKey as j, CliSubcommandManifest as jn, HashTriggerMetadata as jt, BootstrapResult as k, CliManifest as kn, HashTrigger as kt, ExtensionDescriptorParseResult as l, NodeExtensionContext as ln, ProtocolConfigSchema as lr, WidgetDefinition as lt, parseExtensionDescriptor as m, ExtensionWarningAction as mn, SessionEventActionManifest as mr, TileDeclaration as mt, parseExtensionConfig as n, ExtensionCliBeforeRunResult as nn, ClientManifest as nr, PageMode as nt, EmbeddedDescriptor as o, ExtensionCliOutputWriter as on, LogImporterManifest as or, SlotPlacementDeclaration as ot, isDetachedDescriptor as p, ExtensionWarning as pn, ProviderManifestSchema as pr, TileCapabilities as pt, MakaioWebUiRoute as q, WindowStyle as qn, SelectionChangeContext as qt, DetachedDescriptor as r, ExtensionCliContribution as rn, ClientManifestSchema as rr, SlotContentDeclaration as rt, ExtensionDescriptor as s, ExtensionCliSubcommandEntry as sn, LogImporterManifestSchema as sr, WidgetSize as st, ExtensionConfigProvider as t, ExtensionCliBeforeRunContext as tn, AdapterManifestSchema as tr, PageDeclaration as tt, ExtensionDescriptorSchema as u, ExtensionIdentity as un, ProtocolRef as ur, WidgetProps as ut, ExtensionRuntimeBootContribution as v, ExtensionWarningSchema as vn, TriggerStage as vr, UiContextDimension as vt, BootstrapDiscoverContext as w, AdapterProviderRef as wn, UiScope as wt, BootstrapAsset as x, getExtensionWarningActionLabel as xn, BrowserEntrypoint as xr, UiNavigationLevel as xt, MakaioExtension as y, ExtensionWarningSeverity as yn, UiSurfaceFlags as yr, UiContextSnapshot as yt, ExtensionConfigComponentLoader as z, StorageManifest as zn, EntrypointConfig as zt };