@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,772 @@
1
+ import { SubjectDefinition } from "@makaio/framework/core";
2
+ import { SessionLineageKind, SessionMessageBlock, SessionMetadata } from "@makaio/framework/contracts";
3
+ import { JsonObject } from "type-fest";
4
+
5
+ //#region adapters/core/src/log-importer/types.d.ts
6
+ /**
7
+ * Normalized event produced by log importers.
8
+ *
9
+ * Represents a single event extracted from an external tool's log file,
10
+ * normalized to Makaio's subject/payload format for emission to the bus.
11
+ * @remarks
12
+ * Events may include optional {@link ImportMetadata} to distinguish
13
+ * imported events from live events and preserve original timestamps.
14
+ * @see {@link LogImporter} - Interface that produces these events
15
+ * @see {@link ImportMetadata} - Provenance metadata for imported events
16
+ */
17
+ interface NormalizedEvent {
18
+ /** The Makaio subject definition for this event */
19
+ subject: SubjectDefinition;
20
+ /** Event payload matching the subject's schema, may include _import metadata */
21
+ payload: Record<string, unknown>;
22
+ }
23
+ /**
24
+ * Base interface for adapter name identifiers used in log import provenance.
25
+ *
26
+ * Extended via declaration merging by adapters and extensions to register
27
+ * new adapter names for log import provenance.
28
+ * @remarks
29
+ * Adapters and extensions extend this interface to add their adapter names:
30
+ * ```typescript
31
+ * declare module '@makaio/framework/adapters' {
32
+ * interface ExternalToolIdentifiers {
33
+ * 'claude-code-cli': ExternalToolMeta;
34
+ * 'my-custom-adapter': ExternalToolMeta;
35
+ * }
36
+ * }
37
+ * ```
38
+ * @see {@link ExternalToolMeta} - Metadata interface for adapter identifiers
39
+ * @see {@link ExternalToolIdentifier} - Type alias for registered adapter names
40
+ */
41
+ interface ExternalToolIdentifiers {}
42
+ /**
43
+ * Metadata interface for external tool identifiers.
44
+ *
45
+ * Currently empty - provides a seam for future metadata like display names,
46
+ * log format descriptions, or file patterns.
47
+ * @remarks
48
+ * Future extension might include:
49
+ * - `displayName?: string` - Human-readable tool name
50
+ * - `format?: 'jsonl' | 'json' | 'text'` - Expected log format
51
+ * - `filePattern?: string` - Glob pattern for log files
52
+ */
53
+ interface ExternalToolMeta {}
54
+ /**
55
+ * Known adapter names used for log import provenance.
56
+ *
57
+ * Used in {@link ImportMetadata.tool} to identify the source adapter.
58
+ * Extensible via declaration merging of {@link ExternalToolIdentifiers}.
59
+ * Falls back to `string` when no augmentations are in scope, so the core
60
+ * package is usable standalone while still providing autocomplete for
61
+ * known keys when augmentations are present.
62
+ */
63
+ type ExternalToolIdentifier = keyof ExternalToolIdentifiers | (string & {});
64
+ /**
65
+ * Provenance metadata for imported events.
66
+ *
67
+ * Added to event payloads under `_import` key to distinguish
68
+ * imported events from live events and preserve original context.
69
+ * @remarks
70
+ * This metadata enables:
71
+ * - Filtering imported vs live events in queries
72
+ * - Accurate timeline reconstruction with original timestamps
73
+ * - Debugging import issues by tracing back to source files
74
+ * @see {@link NormalizedEvent} - Events containing this metadata
75
+ */
76
+ interface ImportMetadata {
77
+ /** Always 'external' to indicate imported (not live) event */
78
+ source: 'external';
79
+ /** Adapter name that produced the original log (e.g., 'claude-code-cli') */
80
+ tool: ExternalToolIdentifier;
81
+ /** Original timestamp from the external tool's log record (ISO 8601) */
82
+ originalTimestamp?: string;
83
+ /** Always false for imported events (they are replayed, not streamed) */
84
+ streaming: false;
85
+ }
86
+ /**
87
+ * Cursor position for tracking import progress within a file.
88
+ *
89
+ * Used to resume import from the last successfully processed position
90
+ * after restarts, avoiding duplicate event emission.
91
+ * @remarks
92
+ * Cursors track byte offsets rather than line numbers for efficiency
93
+ * and to handle partial lines correctly. The lastModified timestamp
94
+ * enables detection of file truncation/rotation.
95
+ * @see {@link LogImporter} - Uses cursors for incremental import
96
+ */
97
+ interface ImportCursorPosition {
98
+ /** Absolute path to the log file being tracked */
99
+ filePath: string;
100
+ /** Number of bytes successfully read and processed */
101
+ bytesRead: number;
102
+ /** ISO 8601 timestamp of file's last modification when cursor was saved */
103
+ lastModified: string;
104
+ /**
105
+ * Session context for incremental imports (persisted on first read).
106
+ * Contains adapter-specific state needed to resume processing mid-session.
107
+ */
108
+ sessionContext?: SessionMetadata & {
109
+ /** Adapter's native session identifier */adapterSessionId: string; /** Session discovered event (emitted once at session start) */
110
+ sessionEvent: NormalizedEvent; /** Agent started event (emitted once at session start) */
111
+ startedEvent: NormalizedEvent; /** Serialized adapter-specific state for resumption */
112
+ state: JsonObject;
113
+ };
114
+ }
115
+ /**
116
+ * Session context for incremental log imports.
117
+ *
118
+ * Contains adapter-specific state that must persist across chunks during
119
+ * incremental import. Created on first read and restored from cursor on
120
+ * subsequent reads.
121
+ * @typeParam TState - Adapter-specific resumable state type
122
+ * @see {@link LogImporter.extractSessionContext} - Creates this context
123
+ * @see {@link LogImporter.processRecords} - Uses this context
124
+ */
125
+ interface LogImportSessionContext<TState = unknown> extends SessionMetadata {
126
+ /** Adapter's native session identifier */
127
+ adapterSessionId: string;
128
+ /**
129
+ * Session discovered event (adapter creates with adapter-specific payload).
130
+ * Emitted once when the session is first discovered.
131
+ */
132
+ sessionEvent: NormalizedEvent;
133
+ /**
134
+ * Agent started event (adapter creates with model, cwd, etc.).
135
+ * Emitted once when the session starts processing.
136
+ */
137
+ startedEvent: NormalizedEvent;
138
+ /** Resumable import state - adapter-specific */
139
+ state: TState;
140
+ }
141
+ /**
142
+ * Message payload ready for persistence via MessageStorageSubjects.
143
+ *
144
+ * Adapters return this from {@link ProcessLogFileResult.messagePayloads}.
145
+ * Uses {@link SessionMessageBlock} as the canonical block type.
146
+ */
147
+ interface StorageMessagePayload {
148
+ /** Adapter's native message ID — used for upsert deduplication */
149
+ adapterMessageId: string;
150
+ /** Message role */
151
+ role: 'user' | 'assistant';
152
+ /** Plain text for FTS indexing */
153
+ contentText: string;
154
+ /** Structured content blocks */
155
+ blocks: SessionMessageBlock[];
156
+ /** Agent ID (defaults to 'main' for non-subagent messages) */
157
+ agentId: string;
158
+ /** Adapter's session ID */
159
+ adapterSessionId: string;
160
+ /** Unix ms timestamp */
161
+ timestamp: number;
162
+ /** Input modality or origin. `'compact'` = injected summary after a compaction boundary. */
163
+ origin?: 'voice' | 'text' | 'compact';
164
+ }
165
+ /**
166
+ * Canonical lineage metadata for an import segment.
167
+ *
168
+ * Every imported session segment carries explicit lineage — there is no
169
+ * "unknown" state. Root sessions use `kind: 'root'` with a null parent.
170
+ */
171
+ interface ImportSegmentLineage {
172
+ /** Relationship of this segment to its parent. */
173
+ kind: SessionLineageKind;
174
+ /** Adapter session ID of the parent segment, null for root sessions. */
175
+ parentAdapterSessionId: string | null;
176
+ /** Message ID where this session diverged from parent (null for root, subagent, and compress). */
177
+ forkPointMessageId: string | null;
178
+ }
179
+ /**
180
+ * Compaction boundary metadata from the external tool's log.
181
+ */
182
+ interface CompactionMetadata {
183
+ /** How compaction was triggered. */
184
+ trigger: 'manual' | 'auto';
185
+ /** Token count before compaction (null if unavailable). */
186
+ preTokens: number | null;
187
+ /** Unix ms timestamp of the compaction event (null if unavailable). */
188
+ timestamp: number | null;
189
+ }
190
+ /**
191
+ * Canonical import segment — the structural tree of imported session data.
192
+ *
193
+ * This is the single source of truth for compaction structure and lineage
194
+ * during import. The importer is the canonical owner of this contract.
195
+ * @remarks
196
+ * - Every segment carries explicit {@link ImportSegmentLineage}
197
+ * - Children represent compaction boundaries or nested segments
198
+ * - Use {@link toImportSegment} to convert a {@link ProcessLogFileResult}
199
+ */
200
+ interface ImportSegment {
201
+ /** Adapter's native session identifier for this segment. */
202
+ adapterSessionId: string;
203
+ /** Explicit lineage metadata — always present, never inferred post-import. */
204
+ lineage: ImportSegmentLineage;
205
+ /** Storage-ready message payloads for this segment. */
206
+ messages: StorageMessagePayload[];
207
+ /** Compaction metadata from the boundary record (absent if not a compress child). */
208
+ compaction?: CompactionMetadata;
209
+ /** Child segments (compress children, nested compactions). */
210
+ children?: ImportSegment[];
211
+ }
212
+ /**
213
+ * Result of processing a complete log file.
214
+ *
215
+ * The full import pipeline result. For the structural tree without event data,
216
+ * see {@link ImportSegment} and {@link toImportSegment}.
217
+ * @see {@link LogImporter.processLogFile}
218
+ */
219
+ interface ProcessLogFileResult {
220
+ /** Adapter session ID extracted from the log */
221
+ adapterSessionId: string;
222
+ /** Session discovered event (adapter.session.discovered) */
223
+ sessionEvent: NormalizedEvent;
224
+ /** All normalized message events including agent.started */
225
+ messageEvents: NormalizedEvent[];
226
+ /** Storage-ready message payloads extracted from records */
227
+ messagePayloads: StorageMessagePayload[];
228
+ /** Explicit lineage metadata — always present, never inferred post-import. */
229
+ lineage: ImportSegmentLineage;
230
+ /** Compress child results — one per compaction boundary. Absent when no compaction. */
231
+ compressChildren?: ProcessLogFileResult[];
232
+ /** Compaction metadata from the boundary record. */
233
+ compactionMetadata?: CompactionMetadata;
234
+ }
235
+ /**
236
+ * Converts a {@link ProcessLogFileResult} to a canonical {@link ImportSegment}.
237
+ *
238
+ * Strips bus-emission fields (sessionEvent, messageEvents) and recursively
239
+ * converts children, producing the clean structural tree.
240
+ * @param result - The full import result from an adapter
241
+ * @returns A canonical import segment tree
242
+ */
243
+ declare function toImportSegment(result: ProcessLogFileResult): ImportSegment;
244
+ /**
245
+ * Lightweight metadata extracted during session discovery.
246
+ *
247
+ * Contains only the fields needed to populate the `adapter.session.discovered`
248
+ * event without running the full import pipeline.
249
+ * @see {@link LogImporter.extractDiscoveryMetadata} - Method that returns this type
250
+ */
251
+ interface DiscoveryMetadata {
252
+ /** Session identifier from the external tool */
253
+ adapterSessionId: string;
254
+ /** Model used (null if unknown or not present in logs) */
255
+ model: string | null;
256
+ /** Working directory (null if not present in logs) */
257
+ cwd: string | null;
258
+ /** Human-readable session title (truncated to 200 chars) */
259
+ title: string;
260
+ /**
261
+ * Whether the log file contains at least one importable message (user or assistant).
262
+ * Files with only system/metadata records should set this to `false` so the
263
+ * discovery orchestrator can skip them.
264
+ * Optional for backward compatibility with out-of-tree importers; consumers
265
+ * should treat `undefined` as `false`.
266
+ */
267
+ hasMessages?: boolean;
268
+ /** Parent session's adapter ID (null/undefined if root session). */
269
+ parentAdapterSessionId?: string | null;
270
+ /** Message ID where this session diverged from parent (null/undefined if root or subagent). */
271
+ forkPointMessageId?: string | null;
272
+ /** Relationship to parent: root session, user fork, or subagent. Defaults to 'root' if omitted. */
273
+ kind?: SessionLineageKind;
274
+ /** Unix ms timestamp of when the session started in the external tool. */
275
+ startedAt?: number;
276
+ }
277
+ /**
278
+ * Contract for log importers (adapters and extensions).
279
+ *
280
+ * Importers implement this interface to import external session logs
281
+ * into Makaio's event system. Both AI adapters (Claude Code, Codex, Gemini)
282
+ * and extensions can provide log importers.
283
+ * @remarks
284
+ * The importer is responsible for:
285
+ * - Locating log files in tool-specific directories
286
+ * - Parsing tool-specific log formats
287
+ * - Detecting compatible log formats via {@link canHandle}
288
+ * - Extracting session context from initial records
289
+ * - Processing records into normalized events with context
290
+ * - Serializing/deserializing state for cursor persistence
291
+ * - Detecting sessions already managed by Makaio (to skip)
292
+ *
293
+ * The generic `TRecord` type represents the tool's native log record format
294
+ * (e.g., Claude Code's JSONL records with `type`, `message`, `sessionId`).
295
+ * @typeParam TRecord - The tool's native log record type
296
+ * @typeParam TState - The resumable state type (defaults to unknown)
297
+ * @see {@link NormalizedEvent} - Output format for normalized events
298
+ * @see {@link ImportMetadata} - Provenance metadata added to events
299
+ * @see {@link ImportCursorPosition} - Cursor tracking for incremental import
300
+ * @see {@link LogImportSessionContext} - Session context for incremental imports
301
+ */
302
+ interface LogImporter<TRecord, TState = unknown> {
303
+ /**
304
+ * Check if this importer can handle the given log sample.
305
+ *
306
+ * Used for auto-detection during log upload to match importers with
307
+ * unknown log formats. Inspects a sample record/line to determine compatibility.
308
+ * @param sample - Sample log content (JSONL line or parsed JSON object)
309
+ * @returns Boolean or confidence score (0-1) indicating compatibility
310
+ * @remarks
311
+ * Simple implementations return boolean. Advanced implementations can return
312
+ * a confidence score for disambiguation when multiple importers claim support.
313
+ *
314
+ * Example implementations:
315
+ * - Claude Code: Check for `type` field in `['started', 'message', 'tool_use']`
316
+ * - Codex: Check for `event` field matching Codex schema patterns
317
+ * - Gemini: Check for Gemini-specific log structure
318
+ *
319
+ * Return `{ confidence: 0.95 }` for high confidence matches,
320
+ * `{ confidence: 0.5 }` for ambiguous formats, or `false` for incompatible.
321
+ */
322
+ canHandle(sample: string | JsonObject): boolean | {
323
+ confidence: number;
324
+ };
325
+ /**
326
+ * Get the root directory containing this tool's log files.
327
+ * @returns Absolute path to the log directory (may contain subdirectories)
328
+ * @remarks
329
+ * Examples of log directories:
330
+ * - Claude Code: `~/.claude/projects/` (contains `session.jsonl` files)
331
+ * - Codex: `~/.codex/sessions/` (date-organized subdirectories)
332
+ * - Gemini: `~/.gemini/tmp/` (hash-organized project directories)
333
+ */
334
+ getLogDirectory(): string;
335
+ /**
336
+ * Parse a single line/record from log file content.
337
+ * @param content - Raw line content from the log file (JSONL) or full file (JSON)
338
+ * @param sourceFilePath - Optional path to the source file (for importers that need path context)
339
+ * @returns Parsed record or null if line is malformed/unparseable
340
+ * @remarks
341
+ * Implementations should be lenient - return null for malformed records
342
+ * rather than throwing. The caller will log a warning and continue.
343
+ *
344
+ * The optional `sourceFilePath` parameter enables importers to store file path
345
+ * context in records when needed (e.g., deriving storage roots from path structure).
346
+ */
347
+ parseRecord(content: string | JsonObject, sourceFilePath?: string): TRecord | null;
348
+ /**
349
+ * Check if a session is managed by Makaio (should be skipped during import).
350
+ * @param sessionId - The external tool's session identifier
351
+ * @returns True if Makaio manages this session, false if it should be imported
352
+ * @remarks
353
+ * This prevents re-importing sessions that Makaio already tracks via live
354
+ * streaming. Implementation typically queries AdapterSessionStorage for the
355
+ * sessionId to check if the session has status='live'.
356
+ *
357
+ * May be async to support database lookups.
358
+ */
359
+ isMakaioManaged(sessionId: string): Promise<boolean>;
360
+ /**
361
+ * Extract lightweight discovery metadata from a log file.
362
+ *
363
+ * Optimized for minimal I/O — reads only enough of the file to populate
364
+ * the four discovery fields. Used by the DiscoveryOrchestrator to avoid
365
+ * the full parseFile → extractSessionContext pipeline.
366
+ * @param filePath - Absolute path to the log file
367
+ * @returns Discovery metadata with session ID, model, cwd, and title
368
+ */
369
+ extractDiscoveryMetadata(filePath: string): Promise<DiscoveryMetadata>;
370
+ /**
371
+ * Extract session context from records (called on first read only).
372
+ *
373
+ * Creates the session context including session/started events and
374
+ * initial adapter state. This is only called when no existing cursor
375
+ * context exists (i.e., first time reading this file).
376
+ * @param records - Initial batch of parsed records from the file
377
+ * @returns Session context with events and initial state
378
+ * @remarks
379
+ * The returned context is persisted in the cursor and restored on
380
+ * subsequent reads via {@link deserializeState}.
381
+ */
382
+ extractSessionContext(records: TRecord[]): LogImportSessionContext<TState>;
383
+ /**
384
+ * Process records into events (context always provided).
385
+ *
386
+ * Converts adapter-specific records to normalized Makaio events using
387
+ * the provided session context. Updates context.state as needed for
388
+ * stateful processing (e.g., turn tracking).
389
+ * @param records - Batch of parsed records to process
390
+ * @param context - Session context (from extractSessionContext or restored)
391
+ * @returns Array of normalized events (may be empty)
392
+ * @remarks
393
+ * This replaces the stateless `toNormalizedEvents` method. The context
394
+ * provides session metadata and mutable adapter state for tracking
395
+ * things like conversation turns across chunks.
396
+ *
397
+ * Implementations should add {@link ImportMetadata} to payloads
398
+ * under the `_import` key for provenance tracking.
399
+ */
400
+ processRecords(records: TRecord[], context: LogImportSessionContext<TState>): NormalizedEvent[];
401
+ /**
402
+ * Serialize adapter state for cursor persistence.
403
+ *
404
+ * Converts the adapter's typed state to a JSON-serializable object
405
+ * for storage in the cursor.
406
+ * @param state - Adapter-specific state to serialize
407
+ * @returns JSON-serializable representation of the state
408
+ */
409
+ serializeState(state: TState): JsonObject;
410
+ /**
411
+ * Restore adapter state from cursor.
412
+ *
413
+ * Converts the serialized state back to the adapter's typed state
414
+ * when resuming from a persisted cursor.
415
+ * @param raw - Serialized state from cursor storage
416
+ * @returns Restored adapter-specific state
417
+ */
418
+ deserializeState(raw: JsonObject): TState;
419
+ /**
420
+ * Process a complete log file in a single call.
421
+ *
422
+ * Composes extractSessionContext + processRecords + message extraction.
423
+ * Adapters that need special handling (fork detection, field normalization)
424
+ * should override this method.
425
+ * @param records - All parsed records from the log file
426
+ * @returns Combined session metadata, events, and message payloads
427
+ */
428
+ processLogFile(records: TRecord | TRecord[]): ProcessLogFileResult;
429
+ }
430
+ /**
431
+ * Configuration for log importer constructor.
432
+ *
433
+ * Minimal config required to instantiate a log importer for testing.
434
+ */
435
+ interface LogImporterConfig {
436
+ /** Unique identifier for the adapter instance */
437
+ adapterId: string;
438
+ /** Human-readable adapter name */
439
+ adapterName: string;
440
+ /** Optional session ownership check used by importer implementations that can skip Makaio-managed sessions. */
441
+ checkMakaioManaged?: (sessionId: string) => Promise<boolean>;
442
+ }
443
+ /**
444
+ * Test configuration for log import conformance tests.
445
+ *
446
+ * Host-owned log importer packages may use this shape to describe their
447
+ * test fixtures and importer constructors.
448
+ * @see {@link LogImporter} - Base interface that LogImporterClass must implement
449
+ */
450
+ interface LogImportTestConfig<TRecord = unknown, TState = unknown> {
451
+ /**
452
+ * Fixture file name for conformance tests.
453
+ *
454
+ * Relative to the conformance harness fixture directory.
455
+ * @example 'codex-session.jsonl' or 'gemini-session.json'
456
+ */
457
+ fixtureFile: string;
458
+ /**
459
+ * Log importer class constructor.
460
+ *
461
+ * Must implement {@link LogImporter} for conformance tests.
462
+ */
463
+ LogImporterClass: new (config: LogImporterConfig) => LogImporter<TRecord, TState>;
464
+ }
465
+ //#endregion
466
+ //#region adapters/core/src/log-importer/event-queue.d.ts
467
+ interface LogImportEventQueueConfig {
468
+ readonly eventsPerSecond: number;
469
+ readonly onEventEmitted: () => void;
470
+ }
471
+ /**
472
+ * Serializes log-import event delivery and cursor writes.
473
+ *
474
+ * Cursor tasks accept the event promises they depend on, so event emission
475
+ * failures reject the cursor task instead of advancing import progress.
476
+ */
477
+ declare class LogImportEventQueue {
478
+ private readonly eventQueue;
479
+ private readonly cursorQueue;
480
+ private readonly onEventEmitted;
481
+ constructor(config: LogImportEventQueueConfig);
482
+ /**
483
+ * Queue a normalized event and return its delivery promise.
484
+ * @param event - Normalized event to emit
485
+ * @returns Promise that resolves after delivery or rejects on emit failure
486
+ */
487
+ queueEvent(event: NormalizedEvent): Promise<void>;
488
+ /**
489
+ * Queue a cursor/progress task behind previously queued event deliveries.
490
+ * @param task - Cursor/progress task to run after event delivery succeeds
491
+ * @param precedingEventPromises - Emission promises queued before this task
492
+ * @returns Promise that rejects if a preceding event or the task itself fails
493
+ */
494
+ queueAfterEvents(task: () => Promise<void>, precedingEventPromises?: readonly Promise<void>[]): Promise<void>;
495
+ /** Wait until all queued event and cursor tasks finish. */
496
+ drain(): Promise<void>;
497
+ /** Alias for callers that use queue-idle terminology instead of shutdown-drain terminology. */
498
+ onIdle(): Promise<void>;
499
+ }
500
+ //#endregion
501
+ //#region adapters/core/src/log-importer/log-import-watcher.d.ts
502
+ interface LogFileChangeEvent {
503
+ /** Absolute path to the changed file. */
504
+ filePath: string;
505
+ /** Current file stats needed for cursor and rotation handling. */
506
+ stat: {
507
+ /** File size in bytes. */size: number; /** Last modification time. */
508
+ mtime: Date;
509
+ };
510
+ /** Type of change detected by the watcher. */
511
+ changeType: 'created' | 'modified' | 'rotated';
512
+ }
513
+ interface LogImportWatcherOptions {
514
+ /** Directory to watch for log files. */
515
+ directory: string;
516
+ /** Glob pattern used to discover log files. */
517
+ pattern: string;
518
+ /** Polling interval in milliseconds. */
519
+ pollIntervalMs: number;
520
+ }
521
+ /**
522
+ * Adapter-log watcher facade used by orchestrators.
523
+ *
524
+ * Keeps the concrete file-watcher package out of the exported orchestrator API,
525
+ * while preserving the small operations subclasses need for discovery tracking.
526
+ */
527
+ declare class LogImportWatcher {
528
+ private readonly watcher;
529
+ constructor(options: LogImportWatcherOptions);
530
+ /** @returns True when the underlying watcher is actively polling. */
531
+ isRunning(): boolean;
532
+ /** Start watching the configured log directory. */
533
+ start(): Promise<void>;
534
+ /** Stop watching while preserving tracked file state. */
535
+ stop(): void;
536
+ /** Dispose watcher resources and listeners. */
537
+ dispose(): void;
538
+ /**
539
+ * Subscribe to file change events.
540
+ * @param handler - Callback receiving a log file change event.
541
+ * @returns Function that unsubscribes the handler.
542
+ */
543
+ onChange(handler: (event: LogFileChangeEvent) => void | Promise<void>): () => void;
544
+ /**
545
+ * Subscribe to watcher errors.
546
+ * @param handler - Callback receiving the error and optional file path.
547
+ * @returns Function that unsubscribes the handler.
548
+ */
549
+ onError(handler: (event: {
550
+ error: Error;
551
+ filePath?: string;
552
+ }) => void | Promise<void>): () => void;
553
+ /**
554
+ * Subscribe to tracked-file deletion events.
555
+ * @param handler - Callback receiving the deleted file path.
556
+ * @returns Function that unsubscribes the handler.
557
+ */
558
+ onDeleted(handler: (event: {
559
+ filePath: string;
560
+ }) => void | Promise<void>): () => void;
561
+ /**
562
+ * Subscribe to completed watcher poll cycles.
563
+ * @param handler - Callback receiving the current tracked file path set.
564
+ * @returns Function that unsubscribes the poll handler.
565
+ */
566
+ onPolled(handler: (trackedFilePaths: ReadonlySet<string>) => void | Promise<void>): () => void;
567
+ /**
568
+ * Read the watcher's last observed mtime for a file.
569
+ * @param filePath - Absolute path to inspect.
570
+ * @returns Last observed mtime in milliseconds, or undefined when untracked.
571
+ */
572
+ getTrackedFileMtimeMs(filePath: string): number | undefined;
573
+ /**
574
+ * Schedule a single-file watcher poll.
575
+ * @param filePath - Absolute path to poll immediately.
576
+ */
577
+ triggerImmediatePoll(filePath: string): void;
578
+ /**
579
+ * Seed watcher state from persisted cursor positions.
580
+ * @param cursors - Cursor positions used to initialize tracked file state.
581
+ */
582
+ seedFromCursors(cursors: Array<Pick<ImportCursorPosition, 'filePath' | 'bytesRead' | 'lastModified'>>): void;
583
+ }
584
+ //#endregion
585
+ //#region adapters/core/src/log-importer/orchestrator-config.d.ts
586
+ /** Configuration for log import orchestrators. */
587
+ interface LogOrchestratorConfig {
588
+ enabled: boolean;
589
+ directory?: string;
590
+ pollIntervalMs?: number;
591
+ eventsPerSecond?: number;
592
+ adapterId: string;
593
+ adapterName: string;
594
+ checkMakaioManaged?: (sessionId: string) => Promise<boolean>;
595
+ }
596
+ /** Result of parsing a log file. */
597
+ interface ParseFileResult<TRecord> {
598
+ records: TRecord[];
599
+ bytesRead?: number;
600
+ errors?: Array<{
601
+ line?: number;
602
+ error: string;
603
+ }>;
604
+ }
605
+ //#endregion
606
+ //#region adapters/core/src/log-importer/base-orchestrator.d.ts
607
+ /**
608
+ * Abstract base class for log import orchestrators.
609
+ *
610
+ * Supports JSONL (byte offset cursors) and JSON (mtime-based) file formats.
611
+ * Concrete implementations provide adapter-specific file parsing.
612
+ * @typeParam TRecord - The adapter's native log record type
613
+ * @typeParam TState - The adapter's resumable state type (default: unknown)
614
+ */
615
+ declare abstract class BaseLogOrchestrator<TRecord, TState = unknown> {
616
+ protected readonly config: Required<Omit<LogOrchestratorConfig, 'checkMakaioManaged' | 'directory'>> & {
617
+ checkMakaioManaged?: LogOrchestratorConfig['checkMakaioManaged'];
618
+ directory?: string;
619
+ };
620
+ protected readonly watcher: LogImportWatcher;
621
+ protected readonly eventQueue: LogImportEventQueue;
622
+ /** Log prefix for console output - set by subclass */
623
+ protected abstract readonly logPrefix: string;
624
+ /** Importer instance - subclasses create and manage their own typed instance. */
625
+ protected readonly importer: LogImporter<TRecord, TState>;
626
+ private readonly managedSessionCache;
627
+ private unsubscribeChange?;
628
+ private unsubscribeError?;
629
+ private unsubscribeDeleted?;
630
+ private readonly stats;
631
+ private readonly watcherTasks;
632
+ private progressTimer?;
633
+ protected constructor(config: LogOrchestratorConfig, importer: LogImporter<TRecord, TState>);
634
+ /** Get the glob pattern for log files to watch. */
635
+ protected abstract getLogFilePattern(): string;
636
+ /**
637
+ * Determine whether a discovered file should be skipped before processing.
638
+ *
639
+ * Default implementation never skips. Subclasses may override to exclude
640
+ * files by name (e.g., ephemeral compaction summary files).
641
+ * @param _filePath - Absolute path to the candidate file
642
+ * @returns `true` to skip the file entirely, `false` to process normally
643
+ */
644
+ protected shouldSkipFile(_filePath: string): boolean;
645
+ /**
646
+ * Parse a log file from the given byte offset.
647
+ * @param filePath - Path to the log file
648
+ * @param startOffset - Byte offset to start reading from
649
+ * @param maxRecords - Optional maximum number of records to return (for shallow discovery)
650
+ */
651
+ protected abstract parseFile(filePath: string, startOffset: number, maxRecords?: number): Promise<ParseFileResult<TRecord>>;
652
+ /**
653
+ * Validate and filter parsed records. Default: returns records as-is.
654
+ * @param records - Raw parsed records
655
+ * @returns Validated/filtered records
656
+ */
657
+ protected validateRecords(records: TRecord[]): TRecord[];
658
+ /**
659
+ * Returns the maximum number of records to parse per file.
660
+ * Override in subclasses to limit parsing (e.g., discovery mode).
661
+ * @returns Maximum record count, or `undefined` for no limit.
662
+ */
663
+ protected getMaxRecords(): number | undefined;
664
+ /**
665
+ * Builds the serialized session context for cursor persistence.
666
+ * @param context - The import session context to serialize.
667
+ * @returns Serialized cursor session context.
668
+ */
669
+ protected buildCursorSessionContext(context: LogImportSessionContext<TState>): NonNullable<ImportCursorPosition['sessionContext']>;
670
+ /**
671
+ * Check if this orchestrator uses JSON format (mtime-based cursor).
672
+ * @returns True if JSON format, false for JSONL
673
+ */
674
+ protected usesJsonFormat(): boolean;
675
+ isEnabled(): boolean;
676
+ isRunning(): boolean;
677
+ start(): Promise<void>;
678
+ stop(): Promise<void>;
679
+ dispose(): Promise<void>;
680
+ /** @returns Function that checks if a session is Makaio-managed. */
681
+ static createDefaultCheckMakaioManaged(): (sessionId: string) => Promise<boolean>;
682
+ protected updateCursor(filePath: string, bytesRead: number, mtime: Date, sessionContext?: ImportCursorPosition['sessionContext']): Promise<void>;
683
+ /**
684
+ * Handle a file-change event: resolve cursor state and route to first-read or
685
+ * incremental-read as appropriate.
686
+ *
687
+ * Subclasses (e.g., {@link DiscoveryOrchestrator}) may override this method to
688
+ * substitute an entirely different dispatch strategy.
689
+ * @param event - File change event from the watcher
690
+ */
691
+ protected handleFileChange(event: LogFileChangeEvent): Promise<void>;
692
+ /**
693
+ * Track a watcher-triggered file import so shutdown can wait for any cursor
694
+ * work that the handler enqueues before draining the shared FIFO queue.
695
+ * @param event - File change event to process
696
+ */
697
+ protected trackFileChange(event: LogFileChangeEvent): void;
698
+ /**
699
+ * Handle the first read of a log file.
700
+ *
701
+ * Extracts session context, emits session lifecycle events, processes records,
702
+ * and saves the cursor. Subclasses may override to change behavior (e.g.,
703
+ * {@link DiscoveryOrchestrator} skips message processing).
704
+ * @param filePath - Path to the log file
705
+ * @param records - Records parsed from the file
706
+ * @param bytesRead - Bytes read during this parse
707
+ * @param mtime - File modification time
708
+ * @param isJsonFormat - Whether the file uses JSON (mtime-based) format
709
+ * @param startOffset - Byte offset this read started from
710
+ * @param emitLifecycleEvents - Whether to emit session and started lifecycle events for this pass
711
+ */
712
+ protected handleFirstRead(filePath: string, records: TRecord[], bytesRead: number, mtime: Date, isJsonFormat: boolean, startOffset: number, emitLifecycleEvents?: boolean): Promise<void>;
713
+ /**
714
+ * Record that a session has been imported, updating import statistics.
715
+ *
716
+ * Protected to allow subclasses to update stats when processing additional
717
+ * sessions (e.g., compress child sessions from compacted files).
718
+ * @param adapterSessionId - The session ID that was imported
719
+ */
720
+ protected trackImportedSession(adapterSessionId: string): void;
721
+ /**
722
+ * Handle an incremental read of a log file.
723
+ *
724
+ * Processes new records since the last cursor position. Subclasses may override
725
+ * to skip incremental processing (e.g., {@link DiscoveryOrchestrator}).
726
+ * @param filePath - Path to the log file
727
+ * @param records - New records since last read
728
+ * @param cursorContext - Existing cursor session context
729
+ * @param bytesRead - Bytes read during this parse
730
+ * @param mtime - File modification time
731
+ * @param isJsonFormat - Whether the file uses JSON (mtime-based) format
732
+ * @param startOffset - Byte offset this read started from
733
+ */
734
+ protected handleIncrementalRead(filePath: string, records: TRecord[], cursorContext: NonNullable<ImportCursorPosition['sessionContext']>, bytesRead: number, mtime: Date, isJsonFormat: boolean, startOffset: number): Promise<void>;
735
+ protected maybeUpdateCursor(filePath: string, bytesRead: number, startOffset: number, mtime: Date, isJsonFormat: boolean, sessionContext?: ImportCursorPosition['sessionContext']): Promise<void>;
736
+ /**
737
+ * Determine whether an adapter session should be skipped from import.
738
+ *
739
+ * Delegates to the managed-session cache so concurrent checks for the same
740
+ * `adapterSessionId` share one storage lookup and tracked skips update stats.
741
+ * @param adapterSessionId - External adapter session ID being evaluated
742
+ * @returns Promise resolving to true when the session is Makaio-managed and should be skipped
743
+ */
744
+ protected isSessionSkipped(adapterSessionId: string): Promise<boolean>;
745
+ /**
746
+ * Queue a normalized event and return its delivery promise.
747
+ * @param event - Normalized event to emit
748
+ * @returns Promise that resolves after delivery or rejects on emit failure
749
+ */
750
+ protected queueEvent(event: NormalizedEvent): Promise<void>;
751
+ /**
752
+ * Enqueue a cursor write as a PQueue task so it executes after all previously
753
+ * queued events for the same batch have been emitted.
754
+ *
755
+ * PQueue runs tasks with concurrency=1 in FIFO order, so placing the cursor
756
+ * write at the back of the queue after all `queueEvent` calls guarantees that
757
+ * the cursor advances only once every preceding event in the batch has been
758
+ * delivered. This prevents the race where a process exit after `queueEvent`
759
+ * but before queue drain would leave events lost yet the cursor advanced.
760
+ * @param filePath - Path to the log file
761
+ * @param bytesRead - Total bytes read at the new cursor position
762
+ * @param startOffset - Byte offset this read started from
763
+ * @param mtime - File modification time
764
+ * @param isJsonFormat - Whether the file uses JSON (mtime-based) format
765
+ * @param sessionContext - Serialized session context for the cursor
766
+ * @param precedingEventPromises - Emission promises queued before this cursor write
767
+ * @returns Promise that resolves when the cursor write has completed
768
+ */
769
+ protected queueCursorUpdate(filePath: string, bytesRead: number, startOffset: number, mtime: Date, isJsonFormat: boolean, sessionContext?: ImportCursorPosition['sessionContext'], precedingEventPromises?: Promise<void>[]): Promise<void>;
770
+ }
771
+ //#endregion
772
+ export { LogImporterConfig as _, CompactionMetadata as a, StorageMessagePayload as b, ExternalToolIdentifiers as c, ImportMetadata as d, ImportSegment as f, LogImporter as g, LogImportTestConfig as h, LogFileChangeEvent as i, ExternalToolMeta as l, LogImportSessionContext as m, LogOrchestratorConfig as n, DiscoveryMetadata as o, ImportSegmentLineage as p, ParseFileResult as r, ExternalToolIdentifier as s, BaseLogOrchestrator as t, ImportCursorPosition as u, NormalizedEvent as v, toImportSegment as x, ProcessLogFileResult as y };