@makaio/framework 1.0.0-dev-1790614475240 → 1.0.0-dev-1790750768917

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 (418) hide show
  1. package/dist/.makaio-build.json +2 -2
  2. package/dist/adapters/config/index.d.mts +1 -1
  3. package/dist/adapters/config/index.mjs +1 -1
  4. package/dist/adapters/index.d.mts +2 -2
  5. package/dist/adapters/index.mjs +1 -1
  6. package/dist/adapters/node.d.mts +1 -1
  7. package/dist/adapters/node.mjs +1 -1
  8. package/dist/{attempt-record-codec-DXpdMgyI.mjs → attempt-record-codec-zQnXwJF-.mjs} +1 -1
  9. package/dist/{caller-owned-adapter-stub-D8RZEdRn.mjs → caller-owned-adapter-stub-BLbPeCP9.mjs} +1 -1
  10. package/dist/clients/hook-subjects.d.mts +158 -0
  11. package/dist/clients/hook-subjects.mjs +1 -0
  12. package/dist/clients/index.d.mts +3 -129
  13. package/dist/clients/index.mjs +1 -1
  14. package/dist/clients/managed-install.d.mts +1 -1
  15. package/dist/clients/managed-install.mjs +1 -1
  16. package/dist/code-execution/worker-entry.d.mts +1 -1
  17. package/dist/code-execution/worker-entry.mjs +1 -1
  18. package/dist/{code-execution-BspFbEdT.mjs → code-execution-Bdqurit9.mjs} +1 -1
  19. package/dist/{code-execution-DWSux6k1.mjs → code-execution-BwqsnOwu.mjs} +1 -1
  20. package/dist/contracts/adapter/index.d.mts +2 -2
  21. package/dist/contracts/adapter/schemas/session-lineage.d.mts +1 -1
  22. package/dist/contracts/artifact/index.d.mts +2 -2
  23. package/dist/contracts/auth/index.d.mts +2 -2
  24. package/dist/contracts/automation-trigger/index.d.mts +3 -3
  25. package/dist/contracts/canonical-model/index.d.mts +1 -1
  26. package/dist/contracts/capabilities/index.d.mts +1 -1
  27. package/dist/contracts/client/index.d.mts +2 -2
  28. package/dist/contracts/code-execution/index.d.mts +1 -1
  29. package/dist/contracts/common/index.d.mts +1 -1
  30. package/dist/contracts/config/index.d.mts +2 -2
  31. package/dist/contracts/extension/index.d.mts +5 -5
  32. package/dist/contracts/facet/index.d.mts +1 -1
  33. package/dist/contracts/harness/index.d.mts +1 -1
  34. package/dist/contracts/host/index.d.mts +1 -1
  35. package/dist/contracts/index.d.mts +90 -90
  36. package/dist/contracts/materialization/index.d.mts +2 -2
  37. package/dist/contracts/model-registry/index.d.mts +1 -1
  38. package/dist/contracts/native-session-supervisor/index.d.mts +1 -1
  39. package/dist/contracts/platform/index.d.mts +1 -1
  40. package/dist/contracts/provider/index.d.mts +2 -2
  41. package/dist/contracts/reaction/index.d.mts +1 -1
  42. package/dist/contracts/session/index.d.mts +2 -2
  43. package/dist/contracts/shared/index.d.mts +2 -2
  44. package/dist/contracts/skill/index.d.mts +1 -1
  45. package/dist/contracts/telemetry/index.d.mts +1 -1
  46. package/dist/contracts/timeout/index.d.mts +1 -1
  47. package/dist/contracts/variant/index.d.mts +1 -1
  48. package/dist/contracts/worker/index.d.mts +2 -2
  49. package/dist/contracts/workflow/index.d.mts +2 -2
  50. package/dist/{contribution-DTb65rRN.d.mts → contribution-CCVRsaNB.d.mts} +2 -2
  51. package/dist/{definition-DWhjp0db.d.mts → definition-i4PufQpo.d.mts} +1 -1
  52. package/dist/{detached-extension-handle-QrXVNUR2.mjs → detached-extension-handle-DtnyN7vI.mjs} +1 -1
  53. package/dist/{execution-attempt-owner-recovery-BZOEVYFH.mjs → execution-attempt-owner-recovery-CvnTavxP.mjs} +1 -1
  54. package/dist/{execution-target-CDeIBu4b.mjs → execution-target-BumuKpUR.mjs} +1 -1
  55. package/dist/{extension-kOwzAMud.mjs → extension-C9EyvptA.mjs} +1 -1
  56. package/dist/{extension-context-DH84KOm9.d.mts → extension-context-BWrjVPXR.d.mts} +1 -1
  57. package/dist/fast-connection-CAm0eRI4.mjs +1 -0
  58. package/dist/{filesystem-service-CIaAqTRi.mjs → filesystem-service-yIGQgXXP.mjs} +1 -1
  59. package/dist/{framework-packages-D2fycy02.mjs → framework-packages-blqho6Nk.mjs} +1 -1
  60. package/dist/git/index.mjs +1 -1
  61. package/dist/{globby-CxGKRBGC.mjs → globby-DBl3Lybh.mjs} +1 -1
  62. package/dist/{handlers-CfWqy2KP.mjs → handlers-DmEPQqPX.mjs} +1 -1
  63. package/dist/{hook-responses-OETFKaAL.d.mts → hook-responses-v6EA_7WC.d.mts} +1 -1
  64. package/dist/inbound-hooks/fast-connection.d.mts +37 -0
  65. package/dist/inbound-hooks/fast-connection.mjs +1 -0
  66. package/dist/inbound-hooks/index.d.mts +3 -42
  67. package/dist/inbound-hooks/index.mjs +1 -1
  68. package/dist/inbound-hooks/stdio.d.mts +42 -0
  69. package/dist/inbound-hooks/stdio.mjs +1 -0
  70. package/dist/{index-B1uHTa1l.d.mts → index-BBrLhtLK.d.mts} +1 -1
  71. package/dist/{index-DPsQ_cFG2.d.mts → index-BIf8JHBp2.d.mts} +1 -1
  72. package/dist/{index-wQB90bP1.d.mts → index-BytbaguH.d.mts} +4 -4
  73. package/dist/{index-_CsKmUOy.d.mts → index-C0NhPcTU.d.mts} +6 -6
  74. package/dist/{index-1mY0aNe3.d.mts → index-CBzHX2vt.d.mts} +1 -1
  75. package/dist/{index-DyWD9bfP.d.mts → index-CE6cAf_r.d.mts} +1 -1
  76. package/dist/{index-C0Jfr8UK.d.mts → index-CPPulAkE.d.mts} +2 -2
  77. package/dist/{index-3G70bNLs.d.mts → index-CexFpJGs.d.mts} +17 -17
  78. package/dist/{index-CU0AgN84.d.mts → index-CfGPuR1W.d.mts} +3 -3
  79. package/dist/{index-BfFi98B_.d.mts → index-CrZ-G2qH.d.mts} +1 -1
  80. package/dist/{index-BRXETFym.d.mts → index-Cxx1aoPR.d.mts} +1 -1
  81. package/dist/{index-DDCixELI.d.mts → index-D-1RUdHM.d.mts} +1 -1
  82. package/dist/{index-e3AB0Iyv.d.mts → index-DKPap20V.d.mts} +33 -33
  83. package/dist/{index-DHTLIeW62.d.mts → index-DUqPPB_X2.d.mts} +7 -7
  84. package/dist/{index-CLwnkYRD.d.mts → index-DWWP2cUb.d.mts} +1 -1
  85. package/dist/{index-bXozN5vc.d.mts → index-DZkpkd7L.d.mts} +8 -8
  86. package/dist/{index-DrfwkH1x.d.mts → index-D_fMdJbU.d.mts} +8 -8
  87. package/dist/{index-CdkIg4Gu.d.mts → index-DeXQczqV.d.mts} +1 -1
  88. package/dist/{index-CVRQS5jk.d.mts → index-Di2-G_3M.d.mts} +1 -1
  89. package/dist/{index-C-tLT_IE.d.mts → index-DpqO6tbz.d.mts} +14 -14
  90. package/dist/{index-CtwkMknv.d.mts → index-Fmdwbgei.d.mts} +8 -8
  91. package/dist/{index-D9BLsMs8.d.mts → index-OLasQ7NP.d.mts} +1 -1
  92. package/dist/{index-BM8oUon_.d.mts → index-gOYLLgKk.d.mts} +12 -12
  93. package/dist/{index-BYMgvz_a2.d.mts → index-hoGiyiqe2.d.mts} +8 -8
  94. package/dist/{index-t6LnywuE.d.mts → index-l8b_NgVk.d.mts} +1 -1
  95. package/dist/{index-6UlianLY2.d.mts → index-zD2RYwIn2.d.mts} +11 -11
  96. package/dist/kernel/cli/index.d.mts +2 -2
  97. package/dist/kernel/cli/index.mjs +1 -1
  98. package/dist/kernel/cli/register.d.mts +1 -1
  99. package/dist/kernel/cli/register.mjs +1 -1
  100. package/dist/kernel/cli/schemas.mjs +1 -1
  101. package/dist/kernel/extension/index.d.mts +2 -2
  102. package/dist/kernel/extension/index.mjs +1 -1
  103. package/dist/kernel/index.d.mts +5 -5
  104. package/dist/kernel/index.mjs +1 -1
  105. package/dist/kernel/namespace/index.d.mts +1 -1
  106. package/dist/kernel/namespace/index.mjs +1 -1
  107. package/dist/kernel/observability/index.d.mts +1 -1
  108. package/dist/kernel/observability/index.mjs +1 -1
  109. package/dist/kernel/providers/index.d.mts +1 -1
  110. package/dist/kernel/providers/index.mjs +1 -1
  111. package/dist/kernel/window/index.d.mts +1 -1
  112. package/dist/kernel/window/index.mjs +1 -1
  113. package/dist/{lib-BdyGVjpO.mjs → lib-BvRpcV8o.mjs} +1 -1
  114. package/dist/{lib-DxP3tPm9.mjs → lib-C0osDjMk.mjs} +1 -1
  115. package/dist/{load-extensions-eyXZhbRn.mjs → load-extensions-C4HK679X.mjs} +1 -1
  116. package/dist/{load-extensions-CCzTHlUE.d.mts → load-extensions-CMdXwAq-.d.mts} +1 -1
  117. package/dist/mcp-http-server/index.mjs +1 -1
  118. package/dist/{namespace-CHSwZhH7.d.mts → namespace-BH9U2C1O.d.mts} +2 -2
  119. package/dist/{namespace-B9iQN3FQ.d.mts → namespace-C42bZCbK.d.mts} +5 -5
  120. package/dist/namespace-CUKQ8osk.mjs +1 -0
  121. package/dist/{namespace-CMntzAPI.mjs → namespace-D-_gP6_l.mjs} +1 -1
  122. package/dist/{namespace-DAzOxaux.d.mts → namespace-D74MefGI.d.mts} +2 -2
  123. package/dist/{namespace-CNX4llM5.d.mts → namespace-DK5qZpST.d.mts} +6 -6
  124. package/dist/{namespace-D38Fmd0E.d.mts → namespace-DYnHI_Nk.d.mts} +6 -6
  125. package/dist/node/bus-server/index.d.mts +1 -1
  126. package/dist/node/bus-server/index.mjs +1 -1
  127. package/dist/node/bus-server/server-lifecycle.d.mts +1 -1
  128. package/dist/node/bus-server/server-lifecycle.mjs +1 -1
  129. package/dist/{orchestrator-shared-CF-jPH91.mjs → orchestrator-shared-yQ-cLSjx.mjs} +1 -1
  130. package/dist/{ownership-memory-handler-C-y9zQf8.mjs → ownership-memory-handler-BkB4ondL.mjs} +1 -1
  131. package/dist/{package-CeEUAKHI.mjs → package-C-XcWpYW.mjs} +1 -1
  132. package/dist/{package-BSz4hbav.mjs → package-C_PVR-xw.mjs} +1 -1
  133. package/dist/{package-AlsbnlSt.mjs → package-CuXEeVP0.mjs} +1 -1
  134. package/dist/{package-BjtsXnaA.d.mts → package-Ir6SEHkA.d.mts} +1 -1
  135. package/dist/package.json +1 -1
  136. package/dist/{provider-context-D6GIZ5DC.mjs → provider-context-DHS1LRQA.mjs} +1 -1
  137. package/dist/rules/index.d.mts +1 -1
  138. package/dist/rules/index.mjs +1 -1
  139. package/dist/rules/schemas.d.mts +1 -1
  140. package/dist/runtime-bun/index.mjs +1 -1
  141. package/dist/runtime-node/code-execution/index.d.mts +2 -2
  142. package/dist/runtime-node/code-execution/index.mjs +1 -1
  143. package/dist/runtime-node/extension-discovery.d.mts +1 -1
  144. package/dist/runtime-node/extension-validation.d.mts +1 -1
  145. package/dist/runtime-node/extension-validation.mjs +1 -1
  146. package/dist/runtime-node/index.d.mts +5 -5
  147. package/dist/runtime-node/index.mjs +3 -3
  148. package/dist/runtime-node/makaio-config.d.mts +1 -1
  149. package/dist/runtime-node/makaio-config.mjs +1 -1
  150. package/dist/runtime-node/workflow-worker/index.d.mts +1 -1
  151. package/dist/runtime-node/workflow-worker/index.mjs +1 -1
  152. package/dist/runtime-node/workflow-worker/worker-entry.mjs +1 -1
  153. package/dist/{schema-Cz6-4_Dn.mjs → schema-C0lK_6u-.mjs} +1 -1
  154. package/dist/{schemas-BjhhkGN_.d.mts → schemas-BBMHnFq8.d.mts} +4 -4
  155. package/dist/{schemas-DnyXA-9o.d.mts → schemas-C8YaJLKz.d.mts} +2 -2
  156. package/dist/{schemas-BXkSHQaF.d.mts → schemas-CEc_v3dl.d.mts} +2 -2
  157. package/dist/{schemas-D9pXu76T.d.mts → schemas-CtL2su-K.d.mts} +4 -4
  158. package/dist/{schemas-feb64ScA.d.mts → schemas-DNP5mdxx.d.mts} +7 -7
  159. package/dist/{schemas-CBDNnyz4.d.mts → schemas-DnwAE1ao.d.mts} +1 -1
  160. package/dist/{schemas-RwAlAMbq2.d.mts → schemas-DrrpHMbF2.d.mts} +7 -7
  161. package/dist/services/adapter-runtime/index.d.mts +3 -3
  162. package/dist/services/adapter-runtime/index.mjs +1 -1
  163. package/dist/services/adapter-runtime/namespace.d.mts +1 -1
  164. package/dist/services/adapter-runtime/schemas.d.mts +1 -1
  165. package/dist/services/adapter-subsystem/index.d.mts +3 -3
  166. package/dist/services/adapter-subsystem/index.mjs +1 -1
  167. package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
  168. package/dist/services/adapter-subsystem/namespace.mjs +1 -1
  169. package/dist/services/agent-runtime/index.d.mts +2 -2
  170. package/dist/services/agent-runtime/namespace.d.mts +1 -1
  171. package/dist/services/agent-runtime/schemas.d.mts +1 -1
  172. package/dist/services/automation-trigger/index.mjs +1 -1
  173. package/dist/services/capability/index.d.mts +2 -2
  174. package/dist/services/capability/index.mjs +1 -1
  175. package/dist/services/code-execution/index.d.mts +1 -1
  176. package/dist/services/code-execution/index.mjs +1 -1
  177. package/dist/services/codebase/index.d.mts +2 -2
  178. package/dist/services/codebase/namespace.d.mts +1 -1
  179. package/dist/services/codebase/schemas.d.mts +1 -1
  180. package/dist/services/compression/index.d.mts +2 -2
  181. package/dist/services/compression/namespace.d.mts +1 -1
  182. package/dist/services/compression/schemas.d.mts +1 -1
  183. package/dist/services/context-rules/index.d.mts +4 -4
  184. package/dist/services/context-rules/index.mjs +1 -1
  185. package/dist/services/execution-target/index.d.mts +3 -3
  186. package/dist/services/execution-target/index.mjs +1 -1
  187. package/dist/services/execution-target/namespace.d.mts +1 -1
  188. package/dist/services/execution-target/namespace.mjs +1 -1
  189. package/dist/services/execution-target/schemas.d.mts +1 -1
  190. package/dist/services/execution-target/schemas.mjs +1 -1
  191. package/dist/services/filesystem/index.d.mts +1 -1
  192. package/dist/services/filesystem/index.mjs +1 -1
  193. package/dist/services/filesystem/namespace.d.mts +6 -6
  194. package/dist/services/filesystem/schemas.d.mts +3 -3
  195. package/dist/services/git/namespace.mjs +1 -1
  196. package/dist/services/git/schemas.mjs +1 -1
  197. package/dist/services/harness/index.d.mts +3 -3
  198. package/dist/services/harness/index.mjs +1 -1
  199. package/dist/services/index.d.mts +60 -60
  200. package/dist/services/index.mjs +1 -1
  201. package/dist/services/log-import/browser.d.mts +2 -2
  202. package/dist/services/log-import/index.d.mts +2 -2
  203. package/dist/services/log-import/log-import.d.mts +1 -1
  204. package/dist/services/log-import/log-import.mjs +1 -1
  205. package/dist/services/log-import/namespace.mjs +1 -1
  206. package/dist/services/log-import/schemas.mjs +1 -1
  207. package/dist/services/materialization/index.d.mts +1 -1
  208. package/dist/services/materialization/index.mjs +1 -1
  209. package/dist/services/model-registry/index.d.mts +1 -1
  210. package/dist/services/model-registry/index.mjs +1 -1
  211. package/dist/services/preferences/index.d.mts +2 -2
  212. package/dist/services/preferences/schemas.d.mts +1 -1
  213. package/dist/services/preferences/storage-namespace.d.mts +2 -2
  214. package/dist/services/provider-context/index.d.mts +1 -1
  215. package/dist/services/provider-context/index.mjs +1 -1
  216. package/dist/services/provider-runtime/index.mjs +1 -1
  217. package/dist/services/session/handlers/index.d.mts +1 -1
  218. package/dist/services/session/handlers/index.mjs +1 -1
  219. package/dist/services/session/index.d.mts +9 -9
  220. package/dist/services/session/index.mjs +1 -1
  221. package/dist/services/session/messages/namespace.d.mts +1 -1
  222. package/dist/services/session/messages/namespace.mjs +1 -1
  223. package/dist/services/session/orchestrator-testing/index.d.mts +1 -1
  224. package/dist/services/session/orchestrator-testing/index.mjs +1 -1
  225. package/dist/services/session/session-events/namespace.d.mts +1 -1
  226. package/dist/services/session/session-events/namespace.mjs +1 -1
  227. package/dist/services/session/storage/namespace.d.mts +1 -1
  228. package/dist/services/session/storage/schema.d.mts +1 -1
  229. package/dist/services/session/testing/index.mjs +1 -1
  230. package/dist/services/session/testing/orchestrator-shared.d.mts +1 -1
  231. package/dist/services/session/testing/orchestrator-shared.mjs +1 -1
  232. package/dist/services/session/turns/namespace.d.mts +1 -1
  233. package/dist/services/session/turns/namespace.mjs +1 -1
  234. package/dist/services/session-editor/index.d.mts +1 -1
  235. package/dist/services/session-editor/index.mjs +1 -1
  236. package/dist/services/settings/index.d.mts +3 -3
  237. package/dist/services/settings/index.mjs +1 -1
  238. package/dist/services/settings/namespace.d.mts +2 -2
  239. package/dist/services/settings/namespace.mjs +1 -1
  240. package/dist/services/settings/storage/clients-namespace.d.mts +1 -1
  241. package/dist/services/settings/storage/clients-namespace.mjs +1 -1
  242. package/dist/services/settings/storage/index.d.mts +3 -3
  243. package/dist/services/settings/storage/index.mjs +1 -1
  244. package/dist/services/settings/storage/providers-namespace.d.mts +1 -1
  245. package/dist/services/settings/storage/providers-namespace.mjs +1 -1
  246. package/dist/services/subagent/index.d.mts +1 -1
  247. package/dist/services/subagent/index.mjs +1 -1
  248. package/dist/services/subagent-template/index.d.mts +2 -2
  249. package/dist/services/subagent-template/namespace.d.mts +1 -1
  250. package/dist/services/subagent-template/schemas.d.mts +1 -1
  251. package/dist/services/tool-approval/index.d.mts +1 -1
  252. package/dist/services/tool-approval/index.mjs +1 -1
  253. package/dist/services/tools/index.d.mts +1 -1
  254. package/dist/services/tools/index.mjs +1 -1
  255. package/dist/services/tray-menu/index.d.mts +3 -3
  256. package/dist/services/tray-menu/index.mjs +1 -1
  257. package/dist/services/tray-menu/namespace.d.mts +1 -1
  258. package/dist/services/tray-menu/schemas.d.mts +1 -1
  259. package/dist/services/turn/index.d.mts +1 -1
  260. package/dist/services/turn/namespace.d.mts +1 -1
  261. package/dist/services/workflow-transitions/index.d.mts +1 -1
  262. package/dist/services/workflow-transitions/index.mjs +1 -1
  263. package/dist/{session-Tj_635zr.mjs → session-BjV4HPCQ.mjs} +1 -1
  264. package/dist/{session-lineage-BQ9NWlt6.d.mts → session-lineage-CLrQb1Hz.d.mts} +1 -1
  265. package/dist/{src-CkKKoY0M.mjs → src-BDw_ijvA.mjs} +1 -1
  266. package/dist/src-CnTMHQm0.mjs +1 -0
  267. package/dist/storage/drizzle/client.d.mts +1 -1
  268. package/dist/storage/drizzle/client.mjs +1 -1
  269. package/dist/storage/drizzle/index.d.mts +1 -1
  270. package/dist/storage/drizzle/index.mjs +1 -1
  271. package/dist/storage/handlers/drizzle/index.d.mts +1 -1
  272. package/dist/storage/handlers/drizzle/index.mjs +1 -1
  273. package/dist/storage/handlers/index.d.mts +1 -1
  274. package/dist/storage/handlers/index.mjs +1 -1
  275. package/dist/{storage-namespace-NHTWAjaX.d.mts → storage-namespace-DoxNJ9Cg.d.mts} +10 -10
  276. package/dist/{tool-approval-service-BCN4W8eS.mjs → tool-approval-service-Bc0IC6Hj.mjs} +1 -1
  277. package/dist/{tools-BCL_dtHe.mjs → tools-Cbuj-ClQ.mjs} +1 -1
  278. package/dist/{transition-DK43U3QJ.d.mts → transition-DNNBGMtx.d.mts} +2 -2
  279. package/dist/{types-CW-4Y0k_2.d.mts → types-BfuE1-1V2.d.mts} +1 -1
  280. package/dist/{types-jmH0Yad4.d.mts → types-DsZBnL7z.d.mts} +6 -6
  281. package/dist/ui-kernel/index.d.mts +4 -4
  282. package/dist/ui-kernel/pages/namespace.d.mts +4 -4
  283. package/dist/ui-kernel/pages/schemas.d.mts +1 -1
  284. package/dist/{view-builder-tgwZ1ucc.d.mts → view-builder-HU_v1Jg7.d.mts} +2 -2
  285. package/dist/workflow-engine/execution-attempt-repository.d.mts +1 -1
  286. package/dist/workflow-engine/execution-attempt-repository.mjs +1 -1
  287. package/dist/workflow-engine/index.d.mts +19 -19
  288. package/dist/workflow-engine/index.mjs +1 -1
  289. package/dist/workflow-engine/package.d.mts +1 -1
  290. package/dist/workflow-engine/package.mjs +1 -1
  291. package/dist/workflow-engine/provider-operation.d.mts +1 -1
  292. package/dist/workflow-engine/testing/conformance.d.mts +1 -1
  293. package/dist/workflow-engine/testing/conformance.mjs +1 -1
  294. package/dist/workflow-engine/testing/index.d.mts +1 -1
  295. package/dist/workflow-engine/testing/index.mjs +1 -1
  296. package/dist/workflow-engine/testing/sqlite.d.mts +1 -1
  297. package/dist/workflow-engine/testing/sqlite.mjs +1 -1
  298. package/dist/workflow-engine/workflow-orchestrator.mjs +1 -1
  299. package/dist/{workflow-transitions-7d9lGi08.mjs → workflow-transitions-CvT6P03B.mjs} +1 -1
  300. package/dist/{workflow-worker-BCLy_g_a.mjs → workflow-worker-CvQN2dmX.mjs} +1 -1
  301. package/package.json +13 -1
  302. package/dist/namespace-BPf6AbBO.mjs +0 -1
  303. package/dist/src-BZdw54VU.mjs +0 -1
  304. /package/dist/{adapter-auth-runtime-B6yX_QfG.mjs → adapter-auth-runtime-CYgj-Ht4.mjs} +0 -0
  305. /package/dist/{adapter-binding-DF-j-XHg.d.mts → adapter-binding-DG877aQO.d.mts} +0 -0
  306. /package/dist/{attach-error-wNJ8Q5uU.mjs → attach-error-mkj6SVd2.mjs} +0 -0
  307. /package/dist/{attempt-control-evidence-CHBnJoqN.mjs → attempt-control-evidence-DmNT2Wkb.mjs} +0 -0
  308. /package/dist/{attempt-fixtures-D3IsP0KH.mjs → attempt-fixtures-DPGw7peT.mjs} +0 -0
  309. /package/dist/{authority-state-bootstrap-4F5Wc_6l.mjs → authority-state-bootstrap-kIU-C2nI.mjs} +0 -0
  310. /package/dist/{base-orchestrator-DH6W4NQg.d.mts → base-orchestrator-CYU2iHqB.d.mts} +0 -0
  311. /package/dist/{bootstrap-start-client-9nOdeDYl.mjs → bootstrap-start-client-DyKCj6Eu.mjs} +0 -0
  312. /package/dist/{capability-service-BHcRd1td.d.mts → capability-service-BEVVEaTj.d.mts} +0 -0
  313. /package/dist/{client-Sx_N8LXo.d.mts → client-CkfU-f8m.d.mts} +0 -0
  314. /package/dist/{client-binary-version-verifier-DcHCFmsI.mjs → client-binary-version-verifier-CITusS9s.mjs} +0 -0
  315. /package/dist/{client-binary-version-verifier-C8gtKQFO.d.mts → client-binary-version-verifier-DgGke3gW.d.mts} +0 -0
  316. /package/dist/{clients-namespace-CASHxXUM.d.mts → clients-namespace-BRijqVIc.d.mts} +0 -0
  317. /package/dist/{config-namespace-Ctia-VDG.d.mts → config-namespace-9pC41Rtl.d.mts} +0 -0
  318. /package/dist/{create-static-mount-4B-mNtx1.mjs → create-static-mount-Dt-iC0Uq.mjs} +0 -0
  319. /package/dist/{credential-ref-MsnUkz9G.d.mts → credential-ref-DHhA4VTS.d.mts} +0 -0
  320. /package/dist/{cross-spawn-DGqEuNyT.mjs → cross-spawn-DIqCmSCD.mjs} +0 -0
  321. /package/dist/{cursor-storage-BvjxwBW6.mjs → cursor-storage-TgG0XBrI.mjs} +0 -0
  322. /package/dist/{definition-Cx175qXh.d.mts → definition-RnEMoWgj.d.mts} +0 -0
  323. /package/dist/{descriptor-to-package-BPIArq6N.mjs → descriptor-to-package-BmbVrmaM.mjs} +0 -0
  324. /package/dist/{drizzle-_w6sUR8p.mjs → drizzle-C9VHmFKj.mjs} +0 -0
  325. /package/dist/{esm-DwiWcwH0.mjs → esm-CC8hYyqN.mjs} +0 -0
  326. /package/dist/{event-D5_UaIBZ.mjs → event-DK8N_EOT.mjs} +0 -0
  327. /package/dist/{execution-attempt-repository-CY289HlC.mjs → execution-attempt-repository-BMbbbk7n.mjs} +0 -0
  328. /package/dist/{execution-attempt-repository-C2XKRZ3O.d.mts → execution-attempt-repository-Dyluu7wy.d.mts} +0 -0
  329. /package/dist/{extension-discovery-BqSPn73R.d.mts → extension-discovery-DmV1H6kV.d.mts} +0 -0
  330. /package/dist/{extension-namespace-CeRpt6C8.mjs → extension-namespace-BwNmFrd3.mjs} +0 -0
  331. /package/dist/{extension-package-provenance-ClpN3GHp.mjs → extension-package-provenance-DAc6EC8S.mjs} +0 -0
  332. /package/dist/{filesystem-service-5Ecp3nSV.d.mts → filesystem-service-RvR9ogzG.d.mts} +0 -0
  333. /package/dist/{handler-Cc1MhaR4.mjs → handler-BY2DDdyI.mjs} +0 -0
  334. /package/dist/{identity-DgTjgflr.mjs → identity-DBdzjf61.mjs} +0 -0
  335. /package/dist/{index-CwVSr7Ow.d.mts → index-2XwNyZAw.d.mts} +0 -0
  336. /package/dist/{index-B_Hf4XPX.d.mts → index-AtnMf7Qf.d.mts} +0 -0
  337. /package/dist/{index-BCuWtlv5.d.mts → index-B-ZgZuHg.d.mts} +0 -0
  338. /package/dist/{index-u0EteHlR2.d.mts → index-B4MBx8vA2.d.mts} +0 -0
  339. /package/dist/{index-Bmb7jPIe2.d.mts → index-BN4sKsLl2.d.mts} +0 -0
  340. /package/dist/{index-BjrbddkU.d.mts → index-BS3GYAN9.d.mts} +0 -0
  341. /package/dist/{index-CURT4JaX.d.mts → index-BrJ_6xi2.d.mts} +0 -0
  342. /package/dist/{index-w1AeWV4F.d.mts → index-BuRaseJB.d.mts} +0 -0
  343. /package/dist/{index-DmV9ybgT.d.mts → index-C5u82-qr.d.mts} +0 -0
  344. /package/dist/{index-DMgbNdEU.d.mts → index-C9G0Namh.d.mts} +0 -0
  345. /package/dist/{index-C9vF42jh.d.mts → index-CE-VlXE2.d.mts} +0 -0
  346. /package/dist/{index-2YW8DTb62.d.mts → index-CFet5T7v2.d.mts} +0 -0
  347. /package/dist/{index-rik4Uc5G.d.mts → index-CVQ852YA.d.mts} +0 -0
  348. /package/dist/{index-By1UhKYU2.d.mts → index-CVlnG_H22.d.mts} +0 -0
  349. /package/dist/{index-DOui-7u2.d.mts → index-C_LQ5NSy.d.mts} +0 -0
  350. /package/dist/{index-_OD_Nz3m.d.mts → index-Cc5kDe9y.d.mts} +0 -0
  351. /package/dist/{index-DDnY7JhE.d.mts → index-CnyQ2N42.d.mts} +0 -0
  352. /package/dist/{index-BOxMyaqG.d.mts → index-D-rTv5WO.d.mts} +0 -0
  353. /package/dist/{index-BEPn58tG.d.mts → index-D1es2sEA.d.mts} +0 -0
  354. /package/dist/{index-62OoZLGr.d.mts → index-DJZZS_H0.d.mts} +0 -0
  355. /package/dist/{index-N0-r5Hcd.d.mts → index-DggZJ6TT.d.mts} +0 -0
  356. /package/dist/{index-BV3nQpdO.d.mts → index-Do3__CB3.d.mts} +0 -0
  357. /package/dist/{index-DsmyofuM.d.mts → index-lJLrusa5.d.mts} +0 -0
  358. /package/dist/{index-BleQ0SR7.d.mts → index-riopop0h.d.mts} +0 -0
  359. /package/dist/{index-DAqAa9aL.d.mts → index-yfLm_tCv.d.mts} +0 -0
  360. /package/dist/{json-value--pv1-OHx.d.mts → json-value-B2gMynW3.d.mts} +0 -0
  361. /package/dist/{jsonl-transport-Ct1RWs0h.mjs → jsonl-transport-_zPQoMpM.mjs} +0 -0
  362. /package/dist/{lib-DomKag_k.mjs → lib-l8EW0aRq.mjs} +0 -0
  363. /package/dist/{model-registry-CeDu27XL.mjs → model-registry-BJbUh4uw.mjs} +0 -0
  364. /package/dist/{namespace-HLrZerLd.d.mts → namespace-B6S7ZFyX.d.mts} +0 -0
  365. /package/dist/{namespace-CqJhR19O.mjs → namespace-BG-DwVwA.mjs} +0 -0
  366. /package/dist/{namespace-Bo6-o_rW.mjs → namespace-BWTEnslo.mjs} +0 -0
  367. /package/dist/{namespace-Sd6qj6w22.d.mts → namespace-CO9J3NB-2.d.mts} +0 -0
  368. /package/dist/{namespace-CJ5sH_Bp.d.mts → namespace-CVO6bZ4F.d.mts} +0 -0
  369. /package/dist/{namespace-KomML5ti.d.mts → namespace-CytKzWBF.d.mts} +0 -0
  370. /package/dist/{namespace-C9xmGXbW.mjs → namespace-D1tJewLB.mjs} +0 -0
  371. /package/dist/{namespace-DbtfwD5Z.d.mts → namespace-D8pSI--d.d.mts} +0 -0
  372. /package/dist/{namespace-CnRQ8tCJ.mjs → namespace-DS4y8Kv9.mjs} +0 -0
  373. /package/dist/{namespace-J87EeVTm.mjs → namespace-DaFbUCqO.mjs} +0 -0
  374. /package/dist/{namespace-QV_2m25r.d.mts → namespace-Dcs8KeNG.d.mts} +0 -0
  375. /package/dist/{namespace-C_NGRHKs.d.mts → namespace-Dt7hJA-a.d.mts} +0 -0
  376. /package/dist/{namespace-CL9OyrHs.d.mts → namespace-F8g5LZte.d.mts} +0 -0
  377. /package/dist/{namespace-Bz0ZDWhE.d.mts → namespace-u4eoUCLp.d.mts} +0 -0
  378. /package/dist/{node-bridge-backend-DtRT--yn.mjs → node-bridge-backend-CsJ3_7CF.mjs} +0 -0
  379. /package/dist/{node-pty-backend-C72EgRws.mjs → node-pty-backend-o9xyqPMi.mjs} +0 -0
  380. /package/dist/{orchestrator-shared-Bvo0u-1D.d.mts → orchestrator-shared-B96yveBr.d.mts} +0 -0
  381. /package/dist/{out-EjlaPopg.mjs → out-GD8gVf9J.mjs} +0 -0
  382. /package/dist/{ownership-recovery-guard-C9h8K1jo.mjs → ownership-recovery-guard-C00rcqvz.mjs} +0 -0
  383. /package/dist/{package-BCKYMTYG.mjs → package-B6mFblgK.mjs} +0 -0
  384. /package/dist/{package-BwlW7N32.mjs → package-Dke3gaTJ.mjs} +0 -0
  385. /package/dist/{packages-vF9F4M41.mjs → packages-CZ2x-Ver.mjs} +0 -0
  386. /package/dist/{packages-KX9yofCa.d.mts → packages-Fy4a6vQy.d.mts} +0 -0
  387. /package/dist/{providers-CahjB0Kh.mjs → providers-CIb7WiA8.mjs} +0 -0
  388. /package/dist/{providers-namespace-B-l-OQZk.d.mts → providers-namespace-Bg03KVpr.d.mts} +0 -0
  389. /package/dist/{quick-lru-C1yB5RCQ.mjs → quick-lru-BgvUj18f.mjs} +0 -0
  390. /package/dist/{registry-DtaRGU8i.mjs → registry-mZnnYsTk.mjs} +0 -0
  391. /package/dist/{runtime-inputs-B7nWstrY.d.mts → runtime-inputs-qWXJyPAC.d.mts} +0 -0
  392. /package/dist/{schema-DLE6Dqyc.d.mts → schema-C58MdqlI.d.mts} +0 -0
  393. /package/dist/{schema-BnuyCklU.mjs → schema-CdUStsjr.mjs} +0 -0
  394. /package/dist/{schema-introspection-_Yw9L_mB.mjs → schema-introspection-CRLs6TZU.mjs} +0 -0
  395. /package/dist/{schemas-BNQtL3Ln.d.mts → schemas-BKE3qw_w.d.mts} +0 -0
  396. /package/dist/{schemas-C0Fb2-LN.d.mts → schemas-BNG5UOHC.d.mts} +0 -0
  397. /package/dist/{schemas-BNRFKQdz.mjs → schemas-BzzkGp4E.mjs} +0 -0
  398. /package/dist/{schemas-BOT1HUv6.d.mts → schemas-CUfqNSQj.d.mts} +0 -0
  399. /package/dist/{schemas-Djjq4LLs.mjs → schemas-D9hVAoP5.mjs} +0 -0
  400. /package/dist/{schemas-DekYSXka.mjs → schemas-dPLES84M.mjs} +0 -0
  401. /package/dist/{schemas-Dxfk39-v.d.mts → schemas-hXVl5GeF.d.mts} +0 -0
  402. /package/dist/{schemas-BGTuiO3u.d.mts → schemas-zWy59x9Y.d.mts} +0 -0
  403. /package/dist/{server-lifecycle-BjbuCO-s.mjs → server-lifecycle-CmsnIyst.mjs} +0 -0
  404. /package/dist/{server-lifecycle-BINetU26.d.mts → server-lifecycle-DJcc_FqN.d.mts} +0 -0
  405. /package/dist/{shared-schemas-CnOyMY42.mjs → shared-schemas-DwAPAqeD.mjs} +0 -0
  406. /package/dist/{src-CqQSqLQI.mjs → src-CHyuN-wv.mjs} +0 -0
  407. /package/dist/{storage-namespace-TBX8VgK3.mjs → storage-namespace-CYZOP3RS.mjs} +0 -0
  408. /package/dist/{storage-namespace-definition-DV3IipmH.d.mts → storage-namespace-definition--9lrtKns.d.mts} +0 -0
  409. /package/dist/{supports-color-CjiFmM1U.mjs → supports-color-BZuv8Isw.mjs} +0 -0
  410. /package/dist/{tray-menu-service-BRrnoqaY.mjs → tray-menu-service-DGhHTNyy.mjs} +0 -0
  411. /package/dist/{types-CjoaGe_E.d.mts → types-BfQSVqtV.d.mts} +0 -0
  412. /package/dist/{types-B_mVEuYd.d.mts → types-CA6i6flt.d.mts} +0 -0
  413. /package/dist/{types-wwuw7RkB.mjs → types-CGL_-qT6.mjs} +0 -0
  414. /package/dist/{types-CqVuKsLC.d.mts → types-D-Q9gxe2.d.mts} +0 -0
  415. /package/dist/{types-D7WtaoMR.d.mts → types-DEDjIt3d.d.mts} +0 -0
  416. /package/dist/{types-MFZzmywp.d.mts → types-DVZYa4bZ.d.mts} +0 -0
  417. /package/dist/{window-registry-2MZdZPdA.mjs → window-registry-BB_bd5Yu.mjs} +0 -0
  418. /package/dist/{window-registry-1jI3f9ir.d.mts → window-registry-DqVHgb6Y.d.mts} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 1,
3
- "fingerprint": "02099fc14700c8fd141dc3449adbc6c5e6c2f2bfb8d9f88975d94e31a00888ad",
4
- "builtAt": "2026-09-28T16:55:26.154Z",
3
+ "fingerprint": "7f72ac57a71a11e56464aedb2dd43aaededc89342a70ce91a39a1113a8729cc0",
4
+ "builtAt": "2026-09-30T06:47:21.696Z",
5
5
  "declarations": true,
6
6
  "declarationBackend": "tsc"
7
7
  }
@@ -1,4 +1,4 @@
1
- import { $ as bindProviderAuth, B as PreparedAdapterAuthRuntime, G as AdapterAuthError, H as SuppliedAdapterAuthRuntime, J as BoundProviderAuthContext, K as AdapterAuthErrorReason, L as AdapterAuthLeaseHandle, Q as ResolvedConnectorAuthDelivery, R as AdapterAuthRuntimePreparer, U as applySuppliedAdapterAuthRuntime, V as ResolvedAdapterRuntimeConfig, W as prepareAdapterAuthRuntime, X as ResolvedAdapterAuth, Y as ResolveAuthCredentialRefs, Z as ResolvedAuthCredentialValues, _ as BaseAgentConnectorConfig, et as getOptionalAuthCredentialFields, q as BindProviderAuthOptions, tt as resolveBoundProviderAuth, z as BoundAdapterRuntimeConfig } from "../../types-MFZzmywp.mjs";
1
+ import { $ as bindProviderAuth, B as PreparedAdapterAuthRuntime, G as AdapterAuthError, H as SuppliedAdapterAuthRuntime, J as BoundProviderAuthContext, K as AdapterAuthErrorReason, L as AdapterAuthLeaseHandle, Q as ResolvedConnectorAuthDelivery, R as AdapterAuthRuntimePreparer, U as applySuppliedAdapterAuthRuntime, V as ResolvedAdapterRuntimeConfig, W as prepareAdapterAuthRuntime, X as ResolvedAdapterAuth, Y as ResolveAuthCredentialRefs, Z as ResolvedAuthCredentialValues, _ as BaseAgentConnectorConfig, et as getOptionalAuthCredentialFields, q as BindProviderAuthOptions, tt as resolveBoundProviderAuth, z as BoundAdapterRuntimeConfig } from "../../types-DVZYa4bZ.mjs";
2
2
  import { z } from "zod";
3
3
  import { TimeoutConfig, TrackedTimeoutConfig } from "@makaio/framework/utils";
4
4
  import { AIModelSchema, AdapterProviderAuth, ProtocolId, ProviderContext, ResolvedProviderAuth } from "@makaio/framework/contracts";
@@ -1 +1 @@
1
- import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"../../adapter-auth-runtime-B6yX_QfG.mjs";import{z as l}from"zod";import u from"node:fs/promises";import{resolveTimeouts as d}from"@makaio/framework/utils";import{AIModelSchema as f,AuthFieldIdSchema as p}from"@makaio/framework/contracts";import{BaseAdapterConfigSchema as m,ProviderConfigSchema as h,ProviderDefaultsSchema as g}from"@makaio/framework/contracts/config";import{AdapterSubsystemSubjects as _}from"@makaio/framework/services/adapter-subsystem";async function v(e,t={}){if(e.startsWith(`env:`)){let n=e.slice(4);if(!n)throw Error(`Credential reference is missing environment variable name`);return(t.readEnv??(e=>process.env[e]))(n)||null}if(e.startsWith(`file:`)){let n=e.slice(5);if(!n)throw Error(`Credential reference is missing file path`);return(await(t.readFile??(async e=>await u.readFile(e,`utf-8`)))(n)).trim()||null}if(e.startsWith(`keychain:`)){let[n,...r]=e.slice(9).split(`:`);if(!n||r.length===0)throw Error(`Credential reference is missing keychain service or account`);if(!t.resolveKeychain)throw Error(`Keychain credential resolution is not configured`);return t.resolveKeychain(n,r.join(`:`))}return e||null}function y(e,t){let n=e.find(e=>e.id===t);if(!n)throw Error(`Provider definition not found: '${t}'`);if(!b(n))throw Error(`Provider definition '${t}' is missing a defaultModel`);return n}function b(e){return typeof e.defaultModel==`string`&&e.defaultModel.length>0}const x=l.record(l.string(),l.unknown());function S(e){return{getDefaults:()=>e().adapterDefaults,getConfig:t=>C(e,t)}}async function C(e,t){let{adapterName:n,adapterDefaults:r,adapterDefinition:i}=e(),a=T(t),o=t.providerContext.state===`resolved`&&t.providerProtocol!==void 0?t.providerContext.endpointOverrides?.[t.providerProtocol]??null:null,s=d([{layer:`adapter`,source:n,config:i.defaultTimeouts},{layer:`runtime`,source:`config.ts`,config:t.runtimeTimeouts}]),c={...r.providerConfig,...t.providerConfig,baseUrl:o??t.providerConfig?.baseUrl??r.providerConfig?.baseUrl},l=w(t.model??r.model,n,t.agentId),{providerConfig:u,adapterProviderAuth:f,compatibleProviderAuths:p,providerContextRequired:m,...h}=t;return{...r,...h,adapterName:t.adapterName,model:l,cwd:t.cwd??r.cwd??process.cwd(),timeouts:s,providerConfig:c,...a!==void 0&&{boundProviderAuth:a}}}function w(e,t,n){if(e!==void 0&&e.length>0)return e;throw Error(`No model resolved for adapter "${t}" (agentId: ${n}). Provide a model explicitly or configure adapterDefaults.model.`)}function T(e){if(e.providerContext.state===`unresolved`){if(e.providerContextRequired===!0)throw new a(`provider-context-unresolved`,`This adapter requires a resolved provider authentication context.`);return}if(e.adapterProviderAuth===void 0)throw new a(`binding-missing`,`The selected provider has no adapter authentication declaration.`);let t=s({auth:e.providerContext.auth,adapterProviderAuth:e.adapterProviderAuth,compatibleProviderAuths:e.compatibleProviderAuths});if(t.auth.method.owner===`client`&&t.auth.method.clientId!==e.clientId)throw new a(`client-mismatch`,`Selected authentication client does not match the adapter runtime client.`);return t}var E=class extends Error{code;constructor(e,t){super(t),this.code=e,this.name=`ProviderResolutionError`}};async function D(e,t,n){let{snapshot:r}=await e.request(_.resolveProviderRuntimeSnapshot,{providerConfigId:t});if(!r)throw new E(`provider-config-not-found`,`ProviderConfig '${t}' not found`);let i=r.context.endpointOverrides?.[n]??r.definition.endpoints?.[n]??null;return{config:r.config,definition:r.definition,baseUrl:i,auth:r.context.auth}}var O=class extends Error{code;constructor(e){super(`Authenticated provider endpoint resolution failed (${e}).`),this.code=e,this.name=`ProviderEndpointAuthError`}};async function k(t,r,i,a){let{baseUrl:o,auth:s}=await D(t,r,i);if(!o)throw Error(`Could not resolve baseUrl for ProviderConfig '${r}' with protocol '${i}'. Ensure the provider definition or config override declares an endpoint for this protocol.`);if(s.mode!==`explicit`)throw new O(`fetch-auth-unsupported`);let c=p.safeParse(a.credentialFieldId);if(a.kind!==`api-key`||!c.success)throw new O(`fetch-auth-unsupported`);let l=s.definition.fields.find(({id:e})=>e===c.data);if(l===void 0)throw new O(`fetch-auth-unsupported`);let u=s.credentialRefs[l.id];if(u===void 0)throw new O(`fetch-auth-missing`);let d;try{d=(await e(t,{apiKey:u})).apiKey}catch(e){throw e instanceof n&&e.code===`credential-unavailable`?new O(`fetch-auth-missing`):new O(`fetch-auth-resolution-failed`)}if(d===void 0||d.trim()===``)throw new O(`fetch-auth-missing`);return{baseUrl:o,apiKey:d}}var A=class extends Error{code;constructor(e){super(`Adapter runtime snapshot resolution failed (${e}).`),this.code=e,this.name=`AdapterRuntimeSnapshotError`}};async function j(e,t){let n=await e.request(_.resolveAdapterRuntimeSnapshot,t);if(n.status===`error`)throw new A(n.code);let r=n.runtime;if(r.adapterName!==t.adapterName||r.snapshot.context.providerConfigId!==t.providerConfigId)throw new A(`snapshot-identity-mismatch`);let i=s({auth:r.snapshot.context.auth,adapterProviderAuth:r.adapterProviderAuth,compatibleProviderAuths:r.compatibleProviderAuths});if(i.auth.method.owner===`client`&&i.auth.method.clientId!==r.adapterClientId)throw new A(`client-incompatible`);return{...r,boundProviderAuth:i}}export{f as AIModelSchema,a as AdapterAuthError,A as AdapterRuntimeSnapshotError,m as BaseAdapterConfigSchema,x as BaseProviderConfigSchema,n as ConnectorCredentialResolutionError,h as ProviderConfigSchema,g as ProviderDefaultsSchema,O as ProviderEndpointAuthError,E as ProviderResolutionError,c as applySuppliedAdapterAuthRuntime,s as bindProviderAuth,S as createAdapterConfigFactory,y as getDefinitionOrThrow,t as getOptionalAuthCredentialFields,i as prepareAdapterAuthRuntime,j as resolveAdapterRuntimeSnapshot,r as resolveBoundProviderAuth,e as resolveConnectorCredentials,v as resolveCredentialRef,k as resolveProviderEndpoint,D as resolveProviderResolution,o as resolveSessionEnvironment};
1
+ import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"../../adapter-auth-runtime-CYgj-Ht4.mjs";import{z as l}from"zod";import u from"node:fs/promises";import{resolveTimeouts as d}from"@makaio/framework/utils";import{AIModelSchema as f,AuthFieldIdSchema as p}from"@makaio/framework/contracts";import{BaseAdapterConfigSchema as m,ProviderConfigSchema as h,ProviderDefaultsSchema as g}from"@makaio/framework/contracts/config";import{AdapterSubsystemSubjects as _}from"@makaio/framework/services/adapter-subsystem";async function v(e,t={}){if(e.startsWith(`env:`)){let n=e.slice(4);if(!n)throw Error(`Credential reference is missing environment variable name`);return(t.readEnv??(e=>process.env[e]))(n)||null}if(e.startsWith(`file:`)){let n=e.slice(5);if(!n)throw Error(`Credential reference is missing file path`);return(await(t.readFile??(async e=>await u.readFile(e,`utf-8`)))(n)).trim()||null}if(e.startsWith(`keychain:`)){let[n,...r]=e.slice(9).split(`:`);if(!n||r.length===0)throw Error(`Credential reference is missing keychain service or account`);if(!t.resolveKeychain)throw Error(`Keychain credential resolution is not configured`);return t.resolveKeychain(n,r.join(`:`))}return e||null}function y(e,t){let n=e.find(e=>e.id===t);if(!n)throw Error(`Provider definition not found: '${t}'`);if(!b(n))throw Error(`Provider definition '${t}' is missing a defaultModel`);return n}function b(e){return typeof e.defaultModel==`string`&&e.defaultModel.length>0}const x=l.record(l.string(),l.unknown());function S(e){return{getDefaults:()=>e().adapterDefaults,getConfig:t=>C(e,t)}}async function C(e,t){let{adapterName:n,adapterDefaults:r,adapterDefinition:i}=e(),a=T(t),o=t.providerContext.state===`resolved`&&t.providerProtocol!==void 0?t.providerContext.endpointOverrides?.[t.providerProtocol]??null:null,s=d([{layer:`adapter`,source:n,config:i.defaultTimeouts},{layer:`runtime`,source:`config.ts`,config:t.runtimeTimeouts}]),c={...r.providerConfig,...t.providerConfig,baseUrl:o??t.providerConfig?.baseUrl??r.providerConfig?.baseUrl},l=w(t.model??r.model,n,t.agentId),{providerConfig:u,adapterProviderAuth:f,compatibleProviderAuths:p,providerContextRequired:m,...h}=t;return{...r,...h,adapterName:t.adapterName,model:l,cwd:t.cwd??r.cwd??process.cwd(),timeouts:s,providerConfig:c,...a!==void 0&&{boundProviderAuth:a}}}function w(e,t,n){if(e!==void 0&&e.length>0)return e;throw Error(`No model resolved for adapter "${t}" (agentId: ${n}). Provide a model explicitly or configure adapterDefaults.model.`)}function T(e){if(e.providerContext.state===`unresolved`){if(e.providerContextRequired===!0)throw new a(`provider-context-unresolved`,`This adapter requires a resolved provider authentication context.`);return}if(e.adapterProviderAuth===void 0)throw new a(`binding-missing`,`The selected provider has no adapter authentication declaration.`);let t=s({auth:e.providerContext.auth,adapterProviderAuth:e.adapterProviderAuth,compatibleProviderAuths:e.compatibleProviderAuths});if(t.auth.method.owner===`client`&&t.auth.method.clientId!==e.clientId)throw new a(`client-mismatch`,`Selected authentication client does not match the adapter runtime client.`);return t}var E=class extends Error{code;constructor(e,t){super(t),this.code=e,this.name=`ProviderResolutionError`}};async function D(e,t,n){let{snapshot:r}=await e.request(_.resolveProviderRuntimeSnapshot,{providerConfigId:t});if(!r)throw new E(`provider-config-not-found`,`ProviderConfig '${t}' not found`);let i=r.context.endpointOverrides?.[n]??r.definition.endpoints?.[n]??null;return{config:r.config,definition:r.definition,baseUrl:i,auth:r.context.auth}}var O=class extends Error{code;constructor(e){super(`Authenticated provider endpoint resolution failed (${e}).`),this.code=e,this.name=`ProviderEndpointAuthError`}};async function k(t,r,i,a){let{baseUrl:o,auth:s}=await D(t,r,i);if(!o)throw Error(`Could not resolve baseUrl for ProviderConfig '${r}' with protocol '${i}'. Ensure the provider definition or config override declares an endpoint for this protocol.`);if(s.mode!==`explicit`)throw new O(`fetch-auth-unsupported`);let c=p.safeParse(a.credentialFieldId);if(a.kind!==`api-key`||!c.success)throw new O(`fetch-auth-unsupported`);let l=s.definition.fields.find(({id:e})=>e===c.data);if(l===void 0)throw new O(`fetch-auth-unsupported`);let u=s.credentialRefs[l.id];if(u===void 0)throw new O(`fetch-auth-missing`);let d;try{d=(await e(t,{apiKey:u})).apiKey}catch(e){throw e instanceof n&&e.code===`credential-unavailable`?new O(`fetch-auth-missing`):new O(`fetch-auth-resolution-failed`)}if(d===void 0||d.trim()===``)throw new O(`fetch-auth-missing`);return{baseUrl:o,apiKey:d}}var A=class extends Error{code;constructor(e){super(`Adapter runtime snapshot resolution failed (${e}).`),this.code=e,this.name=`AdapterRuntimeSnapshotError`}};async function j(e,t){let n=await e.request(_.resolveAdapterRuntimeSnapshot,t);if(n.status===`error`)throw new A(n.code);let r=n.runtime;if(r.adapterName!==t.adapterName||r.snapshot.context.providerConfigId!==t.providerConfigId)throw new A(`snapshot-identity-mismatch`);let i=s({auth:r.snapshot.context.auth,adapterProviderAuth:r.adapterProviderAuth,compatibleProviderAuths:r.compatibleProviderAuths});if(i.auth.method.owner===`client`&&i.auth.method.clientId!==r.adapterClientId)throw new A(`client-incompatible`);return{...r,boundProviderAuth:i}}export{f as AIModelSchema,a as AdapterAuthError,A as AdapterRuntimeSnapshotError,m as BaseAdapterConfigSchema,x as BaseProviderConfigSchema,n as ConnectorCredentialResolutionError,h as ProviderConfigSchema,g as ProviderDefaultsSchema,O as ProviderEndpointAuthError,E as ProviderResolutionError,c as applySuppliedAdapterAuthRuntime,s as bindProviderAuth,S as createAdapterConfigFactory,y as getDefinitionOrThrow,t as getOptionalAuthCredentialFields,i as prepareAdapterAuthRuntime,j as resolveAdapterRuntimeSnapshot,r as resolveBoundProviderAuth,e as resolveConnectorCredentials,v as resolveCredentialRef,k as resolveProviderEndpoint,D as resolveProviderResolution,o as resolveSessionEnvironment};
@@ -1,5 +1,5 @@
1
- import { $t as SessionToolLedger, A as AgentTeardownArbiter, At as runBestEffortStage, Bt as MessageHandle, C as NormalizedCallUsage, Ct as ObservedExitOptions, D as AdapterProviderDefinition, Dt as reportBestEffortStages, E as StartAgentOptions, Et as exitWasObserved, F as TeardownSubject, Ft as unknownTeardown, Gt as MessageState, Ht as NormalizedMessageInput, I as CreateConnectorRuntimeOptions, It as CONNECTOR_EXIT_OBSERVATION_MS, Jt as AIModel, Kt as ProcessingState, Lt as SWAP_SETTLEMENT_WAIT_MS, M as ConnectorReplacementSettlement, Mt as TeardownReport, N as ConnectorSwapAdmission, Nt as aggregateTeardownReports, O as ConfigFactoryInput, Ot as reportObservedExit, P as ConnectorSwapHandover, Pt as rethrowTeardownFailure, Qt as LedgerSessionContext, R as AdapterAuthRuntimePreparer, Rt as AIAgentConnector, S as GetCapabilitiesResponsePayload, St as SupersededGeneration, T as SendMessageResponsePayload, Tt as describeTeardownFailure, Ut as normalizeMessageInput, Vt as markCompletedWithFinalResult, Wt as MessageResult, Xt as ReasoningLevelMap, Yt as AIReasoningLevel, Zt as ISessionToolLedger, _ as BaseAgentConnectorConfig, _t as BaseConnectorTurn, a as AgentCredentialChangeResponsePayload, at as WireSessionSubjects, b as ContextWindowInput, bt as ConnectorSessionConfig, c as AgentIdentity, ct as QueueableTurn, d as AgentMcpServersSetRequestPayload, dt as rejectQueuedHandles, en as ToolLedgerEntry, f as AgentMcpServersSetResponsePayload, ft as UserMessageQueue, g as AgentStartResult, gt as TurnSubjects, h as AgentSendMessageOptions, ht as ProceduralTurnState, i as AgentCredentialChangeRequestPayload, it as WireSessionConfig, j as ClosableConnectorRuntime, jt as stageFailure, k as IAdapterConfigFactory, kt as reportRepeatTeardown, l as AgentInterruptRequestPayload, lt as SESSION_CLOSED_QUEUE_ERROR, m as AgentModelChangeResponsePayload, mt as ProceduralTurnConfig, n as AgentConnectorConfigOverrides, nt as ProceduralAgentConnector, o as AgentCwdChangeRequestPayload, ot as MergeResult, p as AgentModelChangeRequestPayload, pt as ProceduralConnectorTurn, qt as SendMessageOptions, r as AgentContext, rt as ProceduralConnectorSession, s as AgentCwdChangeResponsePayload, st as ProcessQueueCallbacks, t as AIAgentConfig, u as AgentInterruptResponsePayload, ut as processQueueMessages, v as ConnectorSendMessageOptions, vt as PauseResult, w as SendMessageRequestPayload, wt as capTeardownEvidence, x as ExecutionContext, xt as GenerationRetirementLedger, y as ConnectorStartOptions, yt as BaseConnectorSession, zt as MessageDeliveryMode } from "../types-MFZzmywp.mjs";
2
- import { S as toImportSegment, _ as LogImporter, a as CompactionMetadata, b as ProcessLogFileResult, c as ExternalToolIdentifiers, d as ImportMetadata, f as ImportSegment, g as LogImportTestConfig, h as LogImportSessionContext, l as ExternalToolMeta, m as ImportSegmentTurn, n as LogOrchestratorConfig, o as DiscoveryMetadata, p as ImportSegmentLineage, r as ParseFileResult, s as ExternalToolIdentifier, u as ImportCursorPosition, v as LogImporterConfig, x as StorageMessagePayload, y as NormalizedEvent } from "../base-orchestrator-DH6W4NQg.mjs";
1
+ import { $t as SessionToolLedger, A as AgentTeardownArbiter, At as runBestEffortStage, Bt as MessageHandle, C as NormalizedCallUsage, Ct as ObservedExitOptions, D as AdapterProviderDefinition, Dt as reportBestEffortStages, E as StartAgentOptions, Et as exitWasObserved, F as TeardownSubject, Ft as unknownTeardown, Gt as MessageState, Ht as NormalizedMessageInput, I as CreateConnectorRuntimeOptions, It as CONNECTOR_EXIT_OBSERVATION_MS, Jt as AIModel, Kt as ProcessingState, Lt as SWAP_SETTLEMENT_WAIT_MS, M as ConnectorReplacementSettlement, Mt as TeardownReport, N as ConnectorSwapAdmission, Nt as aggregateTeardownReports, O as ConfigFactoryInput, Ot as reportObservedExit, P as ConnectorSwapHandover, Pt as rethrowTeardownFailure, Qt as LedgerSessionContext, R as AdapterAuthRuntimePreparer, Rt as AIAgentConnector, S as GetCapabilitiesResponsePayload, St as SupersededGeneration, T as SendMessageResponsePayload, Tt as describeTeardownFailure, Ut as normalizeMessageInput, Vt as markCompletedWithFinalResult, Wt as MessageResult, Xt as ReasoningLevelMap, Yt as AIReasoningLevel, Zt as ISessionToolLedger, _ as BaseAgentConnectorConfig, _t as BaseConnectorTurn, a as AgentCredentialChangeResponsePayload, at as WireSessionSubjects, b as ContextWindowInput, bt as ConnectorSessionConfig, c as AgentIdentity, ct as QueueableTurn, d as AgentMcpServersSetRequestPayload, dt as rejectQueuedHandles, en as ToolLedgerEntry, f as AgentMcpServersSetResponsePayload, ft as UserMessageQueue, g as AgentStartResult, gt as TurnSubjects, h as AgentSendMessageOptions, ht as ProceduralTurnState, i as AgentCredentialChangeRequestPayload, it as WireSessionConfig, j as ClosableConnectorRuntime, jt as stageFailure, k as IAdapterConfigFactory, kt as reportRepeatTeardown, l as AgentInterruptRequestPayload, lt as SESSION_CLOSED_QUEUE_ERROR, m as AgentModelChangeResponsePayload, mt as ProceduralTurnConfig, n as AgentConnectorConfigOverrides, nt as ProceduralAgentConnector, o as AgentCwdChangeRequestPayload, ot as MergeResult, p as AgentModelChangeRequestPayload, pt as ProceduralConnectorTurn, qt as SendMessageOptions, r as AgentContext, rt as ProceduralConnectorSession, s as AgentCwdChangeResponsePayload, st as ProcessQueueCallbacks, t as AIAgentConfig, u as AgentInterruptResponsePayload, ut as processQueueMessages, v as ConnectorSendMessageOptions, vt as PauseResult, w as SendMessageRequestPayload, wt as capTeardownEvidence, x as ExecutionContext, xt as GenerationRetirementLedger, y as ConnectorStartOptions, yt as BaseConnectorSession, zt as MessageDeliveryMode } from "../types-DVZYa4bZ.mjs";
2
+ import { S as toImportSegment, _ as LogImporter, a as CompactionMetadata, b as ProcessLogFileResult, c as ExternalToolIdentifiers, d as ImportMetadata, f as ImportSegment, g as LogImportTestConfig, h as LogImportSessionContext, l as ExternalToolMeta, m as ImportSegmentTurn, n as LogOrchestratorConfig, o as DiscoveryMetadata, p as ImportSegmentLineage, r as ParseFileResult, s as ExternalToolIdentifier, u as ImportCursorPosition, v as LogImporterConfig, x as StorageMessagePayload, y as NormalizedEvent } from "../base-orchestrator-CYU2iHqB.mjs";
3
3
  import { z } from "zod";
4
4
  import * as _$_makaio_core0 from "@makaio/framework/core";
5
5
  import { CreateBusNamespaceOptions, ExtractSubjectPayload, FilterablePayloadIntersection, HandlerForSubjectDefinition, RegistrableBusNamespaceDefinition, RequestContext, SchemaRecord, ScopedSubjectDefinition, SubjectDefinition, SubjectRecordFromSchemaRecord } from "@makaio/framework/core";
@@ -1,4 +1,4 @@
1
- import{o as e,t}from"../chunk-DTipWd-i.mjs";import{d as n,h as r,m as i,n as a,p as o,r as s,t as c,v as l}from"../ajv-Cvnmw2yn.mjs";import{i as u,n as d,r as f,t as p}from"../2020-CRfgqanb.mjs";import{n as m,u as h}from"../adapter-auth-runtime-B6yX_QfG.mjs";import{i as ee,n as g,r as _,t as v}from"../cursor-storage-BvjxwBW6.mjs";import{z as y}from"zod";import*as te from"node:fs";import{DeferredPromise as b,resolveTimeouts as ne}from"@makaio/framework/utils";import{AuthenticationError as re,DirectoryNotFoundError as ie,ModelUnavailableError as ae,QuotaExceededError as oe,RateLimitError as se,createBusNamespace as ce}from"@makaio/framework/core";import{AdapterSubjects as x,AgentSubjects as S,AgentToolApproveSchema as le,HarnessSubjects as ue,MCP_CALL_TOOL_NAME as de,McpSubjects as C,ProviderContextSchema as w,RequestCorrelationContextSchema as fe,ResolvedProviderContextSchema as pe,SessionContextSchema as T,SessionSubjects as E,aggregateTeardownEvidence as me,aggregateTeardownResults as he}from"@makaio/framework/contracts";import{MakaioBus as D,NoHandlerError as ge,RequestError as _e}from"@makaio/framework/bus";import{TurnStorageSubjects as ve}from"@makaio/framework/services/turn";import{AuthCredentialRefSchema as ye}from"@makaio/framework/contracts/auth";import{runPostUserMessageHooks as be,runPreUserMessageHooks as xe}from"@makaio/framework/hooks";import{ProviderContextActivationError as O,ProviderContextActivationRollbackError as k,prepareProviderContextActivation as Se,resolveRuntimeProviderContext as Ce}from"@makaio/framework/services/provider-context";import we from"node:os";import{AgentStorageSubjects as A,reserveStartFor as Te}from"@makaio/framework/services/session";import*as Ee from"node:process";function De(e,t,n){let r=ce(e,t,n),i=D.registerNamespace(r);return Object.assign(i,{definition:r})}function Oe(e){let t=[];try{return JSON.stringify(e,function(e,n){if(typeof n==`bigint`)return n.toString();if(typeof n==`object`&&n){for(;t.length>0&&t[t.length-1]!==this;)t.pop();if(t.includes(n))return`[Circular]`;t.push(n)}return n},2)??`[Non-serializable value]`}catch{try{return String(e)}catch{return`[Non-serializable value]`}}}async function ke(e,t,n){let r,i=new Promise((e,i)=>{r=setTimeout(()=>i(Error(n)),t)});try{return await Promise.race([e,i])}finally{r!==void 0&&clearTimeout(r)}}function j(e,t){for(let n of e)try{n()}catch(e){console.warn(`[AIAgent] ${t} cleanup failed:`,e)}}function Ae(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`).replaceAll(`'`,`&apos;`)}function je(e){let t=e.replace(/[^a-zA-Z0-9_-]/g,`_`);return t.length===0?`context`:/^[A-Za-z_]/.test(t)?t:`context_${t}`}function Me(e,t){let n=je(e);return`<${n}>\n${Ae(t)}\n</${n}>`}function Ne(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.name==`string`&&typeof t.description==`string`&&(t.compatibility===void 0||typeof t.compatibility==`string`)}function Pe(e){if(typeof e!=`object`||!e)return!1;let t=e,n=t.metadata,r=n;return typeof t.name==`string`&&typeof t.content==`string`&&(t.license===void 0||typeof t.license==`string`)&&(t.compatibility===void 0||typeof t.compatibility==`string`)&&(t.allowedTools===void 0||typeof t.allowedTools==`string`)&&(n===void 0||typeof n==`object`&&!!n&&Object.values(r??{}).every(e=>typeof e==`string`))}function Fe(e){if(!Array.isArray(e))return;let t=e.filter(Ne).sort((e,t)=>e.name.localeCompare(t.name)).map(e=>e.compatibility?`- ${e.name}: ${e.description} Compatibility: ${e.compatibility}`:`- ${e.name}: ${e.description}`);return t.length>0?t.join(`
1
+ import{o as e,t}from"../chunk-DTipWd-i.mjs";import{d as n,h as r,m as i,n as a,p as o,r as s,t as c,v as l}from"../ajv-Cvnmw2yn.mjs";import{i as u,n as d,r as f,t as p}from"../2020-CRfgqanb.mjs";import{n as m,u as h}from"../adapter-auth-runtime-CYgj-Ht4.mjs";import{i as ee,n as g,r as _,t as v}from"../cursor-storage-TgG0XBrI.mjs";import{z as y}from"zod";import*as te from"node:fs";import{DeferredPromise as b,resolveTimeouts as ne}from"@makaio/framework/utils";import{AuthenticationError as re,DirectoryNotFoundError as ie,ModelUnavailableError as ae,QuotaExceededError as oe,RateLimitError as se,createBusNamespace as ce}from"@makaio/framework/core";import{AdapterSubjects as x,AgentSubjects as S,AgentToolApproveSchema as le,HarnessSubjects as ue,MCP_CALL_TOOL_NAME as de,McpSubjects as C,ProviderContextSchema as w,RequestCorrelationContextSchema as fe,ResolvedProviderContextSchema as pe,SessionContextSchema as T,SessionSubjects as E,aggregateTeardownEvidence as me,aggregateTeardownResults as he}from"@makaio/framework/contracts";import{MakaioBus as D,NoHandlerError as ge,RequestError as _e}from"@makaio/framework/bus";import{TurnStorageSubjects as ve}from"@makaio/framework/services/turn";import{AuthCredentialRefSchema as ye}from"@makaio/framework/contracts/auth";import{runPostUserMessageHooks as be,runPreUserMessageHooks as xe}from"@makaio/framework/hooks";import{ProviderContextActivationError as O,ProviderContextActivationRollbackError as k,prepareProviderContextActivation as Se,resolveRuntimeProviderContext as Ce}from"@makaio/framework/services/provider-context";import we from"node:os";import{AgentStorageSubjects as A,reserveStartFor as Te}from"@makaio/framework/services/session";import*as Ee from"node:process";function De(e,t,n){let r=ce(e,t,n),i=D.registerNamespace(r);return Object.assign(i,{definition:r})}function Oe(e){let t=[];try{return JSON.stringify(e,function(e,n){if(typeof n==`bigint`)return n.toString();if(typeof n==`object`&&n){for(;t.length>0&&t[t.length-1]!==this;)t.pop();if(t.includes(n))return`[Circular]`;t.push(n)}return n},2)??`[Non-serializable value]`}catch{try{return String(e)}catch{return`[Non-serializable value]`}}}async function ke(e,t,n){let r,i=new Promise((e,i)=>{r=setTimeout(()=>i(Error(n)),t)});try{return await Promise.race([e,i])}finally{r!==void 0&&clearTimeout(r)}}function j(e,t){for(let n of e)try{n()}catch(e){console.warn(`[AIAgent] ${t} cleanup failed:`,e)}}function Ae(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`).replaceAll(`'`,`&apos;`)}function je(e){let t=e.replace(/[^a-zA-Z0-9_-]/g,`_`);return t.length===0?`context`:/^[A-Za-z_]/.test(t)?t:`context_${t}`}function Me(e,t){let n=je(e);return`<${n}>\n${Ae(t)}\n</${n}>`}function Ne(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.name==`string`&&typeof t.description==`string`&&(t.compatibility===void 0||typeof t.compatibility==`string`)}function Pe(e){if(typeof e!=`object`||!e)return!1;let t=e,n=t.metadata,r=n;return typeof t.name==`string`&&typeof t.content==`string`&&(t.license===void 0||typeof t.license==`string`)&&(t.compatibility===void 0||typeof t.compatibility==`string`)&&(t.allowedTools===void 0||typeof t.allowedTools==`string`)&&(n===void 0||typeof n==`object`&&!!n&&Object.values(r??{}).every(e=>typeof e==`string`))}function Fe(e){if(!Array.isArray(e))return;let t=e.filter(Ne).sort((e,t)=>e.name.localeCompare(t.name)).map(e=>e.compatibility?`- ${e.name}: ${e.description} Compatibility: ${e.compatibility}`:`- ${e.name}: ${e.description}`);return t.length>0?t.join(`
2
2
  `):void 0}function Ie(e){if(!Array.isArray(e))return;let t=e.filter(Pe).sort((e,t)=>e.name.localeCompare(t.name)).map(e=>{let t=[`## ${e.name}`];return e.compatibility&&t.push(`Compatibility: ${e.compatibility}`),t.push(e.content),t.join(`
3
3
  `)});return t.length>0?t.join(`
4
4
 
@@ -1,4 +1,4 @@
1
- import { _ as LogImporter, i as LogFileChangeEvent, n as LogOrchestratorConfig, t as BaseLogOrchestrator } from "../base-orchestrator-DH6W4NQg.mjs";
1
+ import { _ as LogImporter, i as LogFileChangeEvent, n as LogOrchestratorConfig, t as BaseLogOrchestrator } from "../base-orchestrator-CYU2iHqB.mjs";
2
2
 
3
3
  //#region adapters/core/src/log-importer/jsonl-parser.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import{o as e,t}from"../chunk-DTipWd-i.mjs";import{i as n,r}from"../cursor-storage-BvjxwBW6.mjs";import{t as i}from"../globby-CxGKRBGC.mjs";import*as a from"node:fs/promises";import*as o from"node:path";import{AdapterSubjects as s,ClientSubjects as c,SessionStorageSubjects as l,SessionSubjects as u}from"@makaio/framework/contracts";import{MakaioBus as d}from"@makaio/framework/bus";const f=65536;async function p(e){let{filePath:t,startOffset:n=0}=e,r=[],i=[],o=n,s;try{s=await a.open(t,`r`);let e=await s.stat();if(n>=e.size)return{records:r,bytesRead:n,errors:i};let c=Buffer.alloc(f),l=``,u=n,d=0;for(n>0&&(d=await v(s,n));u<e.size;){let{bytesRead:e}=await s.read(c,0,f,u);if(e===0)break;l+=c.toString(`utf8`,0,e),u+=e;let t=l.split(`
1
+ import{o as e,t}from"../chunk-DTipWd-i.mjs";import{i as n,r}from"../cursor-storage-TgG0XBrI.mjs";import{t as i}from"../globby-DBl3Lybh.mjs";import*as a from"node:fs/promises";import*as o from"node:path";import{AdapterSubjects as s,ClientSubjects as c,SessionStorageSubjects as l,SessionSubjects as u}from"@makaio/framework/contracts";import{MakaioBus as d}from"@makaio/framework/bus";const f=65536;async function p(e){let{filePath:t,startOffset:n=0}=e,r=[],i=[],o=n,s;try{s=await a.open(t,`r`);let e=await s.stat();if(n>=e.size)return{records:r,bytesRead:n,errors:i};let c=Buffer.alloc(f),l=``,u=n,d=0;for(n>0&&(d=await v(s,n));u<e.size;){let{bytesRead:e}=await s.read(c,0,f,u);if(e===0)break;l+=c.toString(`utf8`,0,e),u+=e;let t=l.split(`
2
2
  `),n=t.pop();for(let e of t){if(d++,e.trim()===``){o+=Buffer.byteLength(e,`utf8`)+1;continue}let t=g(e,d);t.success?r.push(t.record):i.push(t.error),o+=Buffer.byteLength(e,`utf8`)+1}l=n??``}return{records:r,bytesRead:o,errors:i}}finally{s&&await s.close()}}async function m(e,t){let n=[],r;try{r=await a.open(e,`r`);let i=Buffer.alloc(f),o=``,s=0;for(;n.length<t;){let{bytesRead:e}=await r.read(i,0,f,s);if(e===0)break;o+=i.toString(`utf8`,0,e),s+=e;let a=o.split(`
3
3
  `);o=a.pop()??``;for(let e of a){if(n.length>=t)break;let r=e.trim();if(r!==``)try{n.push(JSON.parse(r))}catch{}}}return n}finally{r&&await r.close()}}async function h(e,t){let n;try{n=await a.open(e,`r`);let r=Buffer.alloc(f),i=``,o=0;for(;;){let{bytesRead:e}=await n.read(r,0,f,o);if(e===0)break;i+=r.toString(`utf8`,0,e),o+=e;let a=i.split(`
4
4
  `);i=a.pop()??``;for(let e of a){let n=e.trim();if(n!==``)try{if(t(JSON.parse(n)))return!0}catch{}}}return!1}finally{n&&await n.close()}}function g(e,t){try{return{success:!0,record:JSON.parse(e)}}catch(n){return{success:!1,error:{line:t,error:n instanceof Error?n.message:String(n),content:_(e)}}}}function _(e){return e.length<=200?e:e.slice(0,200)+`...`}async function v(e,t){let n=0,r=Buffer.alloc(f),i=0;for(;i<t;){let a=Math.min(f,t-i),{bytesRead:o}=await e.read(r,0,a,i);if(o===0)break;for(let e=0;e<o;e++)r[e]===10&&n++;i+=o}return n}var y=e(t(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)}))(),1),b=class e extends Error{name=`TimeoutError`;constructor(t,n){super(t,n),Error.captureStackTrace?.(this,e)}};const x=e=>e.reason??new DOMException(`This operation was aborted.`,`AbortError`);function S(e,t){let{milliseconds:n,fallback:r,message:i,customTimers:a={setTimeout,clearTimeout},signal:o}=t,s,c,l=new Promise((t,l)=>{if(typeof n!=`number`||Math.sign(n)!==1)throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(o?.aborted){l(x(o));return}if(o&&(c=()=>{l(x(o))},o.addEventListener(`abort`,c,{once:!0})),e.then(t,l),n===1/0)return;let u=new b;s=a.setTimeout.call(void 0,()=>{if(r){try{t(r())}catch(e){l(e)}return}typeof e.cancel==`function`&&e.cancel(),i===!1?t():i instanceof Error?l(i):(u.message=i??`Promise timed out after ${n} milliseconds`,l(u))},n)}).finally(()=>{l.clear(),c&&o&&o.removeEventListener(`abort`,c)});return l.clear=()=>{a.clearTimeout.call(void 0,s),s=void 0},l}function C(e,t,n){let r=0,i=e.length;for(;i>0;){let a=Math.trunc(i/2),o=r+a;n(e[o],t)<=0?(r=++o,i-=a+1):i=a}return r}var w=class{#e=[];#t=0;enqueue(e,t){let{priority:n=0,id:r}=t??{},{size:i}=this,a={priority:n,id:r,run:e};if(i===0){this.#e.length=0,this.#t=0,this.#e.push(a);return}if(this.#e.at(-1).priority>=n){this.#e.push(a);return}this.#n();let o=C(this.#e,a,(e,t)=>t.priority-e.priority);this.#e.splice(o,0,a)}setPriority(e,t){let n=this.#e.findIndex((t,n)=>n>=this.#t&&t.id===e);if(n===-1)throw ReferenceError(`No promise function with the id "${e}" exists in the queue.`);let[r]=this.#e.splice(n,1);this.enqueue(r.run,{priority:t,id:e})}remove(e){let t=this.#e.findIndex((t,n)=>n<this.#t?!1:typeof e==`string`?t.id===e:t.run===e);t!==-1&&this.#e.splice(t,1)}dequeue(){if(this.#t===this.#e.length)return;let e=this.#e[this.#t];return this.#t++,this.#t===this.#e.length?(this.#e.length=0,this.#t=0):this.#t>100&&this.#t>this.#e.length/2&&this.#n(),e?.run}filter(e){let t=[];for(let n=this.#t;n<this.#e.length;n++){let r=this.#e[n];r.priority===e.priority&&t.push(r.run)}return t}get size(){return this.#e.length-this.#t}#n(){this.#t!==0&&(this.#e.splice(0,this.#t),this.#t=0)}},T=class extends y.default{#e;#t;#n=0;#r;#i=!1;#a=!1;#o;#s=0;#c=0;#l;#u;#d;#f=[];#p=0;#m;#h;#g=0;#_;#v;#y=1n;#b=new Map;#x=new Set;timeout;constructor(e){if(super(),e={carryoverIntervalCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:w,strict:!1,...e},!(typeof e.intervalCap==`number`&&e.intervalCap>=1))throw TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??``}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??``}\` (${typeof e.interval})`);if(e.strict&&e.interval===0)throw TypeError("The `strict` option requires a non-zero `interval`");if(e.strict&&e.intervalCap===1/0)throw TypeError("The `strict` option requires a finite `intervalCap`");if(this.#e=e.carryoverIntervalCount??e.carryoverConcurrencyCount??!1,this.#t=e.intervalCap===1/0||e.interval===0,this.#r=e.intervalCap,this.#o=e.interval,this.#d=e.strict,this.#m=new e.queueClass,this.#h=e.queueClass,this.concurrency=e.concurrency,e.timeout!==void 0&&!(Number.isFinite(e.timeout)&&e.timeout>0))throw TypeError(`Expected \`timeout\` to be a positive finite number, got \`${e.timeout}\` (${typeof e.timeout})`);this.timeout=e.timeout,this.#v=e.autoStart===!1,this.#z()}#S(e){for(;this.#p<this.#f.length;){let t=this.#f[this.#p];if(t!==void 0&&e-t>=this.#o)this.#p++;else break}(this.#p>100&&this.#p>this.#f.length/2||this.#p===this.#f.length)&&(this.#f=this.#f.slice(this.#p),this.#p=0)}#C(e){this.#d?this.#f.push(e):this.#n++}#w(){this.#d?this.#f.length>this.#p&&this.#f.pop():this.#n>0&&this.#n--}#T(){return this.#f.length-this.#p}get#E(){return this.#t?!0:this.#d?this.#T()<this.#r:this.#n<this.#r}get#D(){return this.#g<this.#_}#O(){this.#g--,this.#g===0&&this.emit(`pendingZero`),this.#P(),this.emit(`next`)}#k(){this.#u=void 0,this.#I(),this.#F()}#A(e){if(this.#d){if(this.#S(e),this.#T()>=this.#r){let t=this.#f[this.#p],n=this.#o-(e-t);return this.#j(n),!0}return!1}if(this.#l===void 0){let t=this.#s-e;if(t<0){if(this.#c>0){let t=e-this.#c;if(t<this.#o)return this.#j(this.#o-t),!0}this.#n=this.#e?this.#g:0}else return this.#j(t),!0}return!1}#j(e){this.#u===void 0&&(this.#u=setTimeout(()=>{this.#k()},e))}#M(){this.#l&&=(clearInterval(this.#l),void 0)}#N(){this.#u&&=(clearTimeout(this.#u),void 0)}#P(){if(this.#m.size===0){if(this.#M(),this.emit(`empty`),this.#g===0){if(this.#N(),this.#d&&this.#p>0){let e=Date.now();this.#S(e)}this.emit(`idle`)}return!1}let e=!1;if(!this.#v){let t=Date.now(),n=!this.#A(t);if(this.#E&&this.#D){let r=this.#m.dequeue();this.#t||(this.#C(t),this.#B()),this.emit(`active`),r(),n&&this.#F(),e=!0}}return e}#F(){this.#t||this.#l!==void 0||this.#d||(this.#l=setInterval(()=>{this.#I()},this.#o),this.#s=Date.now()+this.#o)}#I(){this.#d||(this.#n===0&&this.#g===0&&this.#l&&this.#M(),this.#n=this.#e?this.#g:0),this.#L(),this.#B()}#L(){for(;this.#P(););}get concurrency(){return this.#_}set concurrency(e){if(!(typeof e==`number`&&e>=1))throw TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#_=e,this.#L()}setPriority(e,t){if(typeof t!=`number`||!Number.isFinite(t))throw TypeError(`Expected \`priority\` to be a finite number, got \`${t}\` (${typeof t})`);this.#m.setPriority(e,t)}async add(e,t={}){return t={timeout:this.timeout,...t,id:t.id??(this.#y++).toString()},new Promise((n,r)=>{let i=Symbol(`task-${t.id}`),a=()=>void 0,o=async()=>{a(),this.#g++,this.#b.set(i,{id:t.id,priority:t.priority??0,startTime:Date.now(),timeout:t.timeout});let o;try{try{t.signal?.throwIfAborted()}catch(e){throw this.#V(),this.#b.delete(i),e}this.#c=Date.now();let r=e({signal:t.signal});if(t.timeout&&(r=S(Promise.resolve(r),{milliseconds:t.timeout,message:`Task timed out after ${t.timeout}ms (queue has ${this.#g} running, ${this.#m.size} waiting)`})),t.signal){let{signal:e}=t;r=Promise.race([r,new Promise((t,n)=>{o=()=>{n(e.reason)},e.addEventListener(`abort`,o,{once:!0})})])}let a=await r;n(a),this.emit(`completed`,a)}catch(e){r(e),this.emit(`error`,e)}finally{o&&t.signal?.removeEventListener(`abort`,o),this.#b.delete(i),queueMicrotask(()=>{this.#O()})}};this.#m.enqueue(o,t);let s=()=>{if(this.#m instanceof w){this.#m.remove(o);return}this.#m.remove?.(t.id)};if(t.signal){let{signal:e}=t,n=()=>{a(),s(),r(e.reason),this.#P(),this.emit(`next`)};if(a=()=>{e.removeEventListener(`abort`,n),this.#x.delete(a)},e.aborted){n();return}e.addEventListener(`abort`,n,{once:!0}),this.#x.add(a)}this.emit(`add`),this.#P()})}async addAll(e,t){return Promise.all(e.map(async e=>this.add(e,t)))}start(){return this.#v?(this.#v=!1,this.#L(),this):this}pause(){this.#v=!0}clear(){for(let e of this.#x)e();this.#m=new this.#h,this.#M(),this.#H(),this.emit(`empty`),this.#g===0&&(this.#N(),this.emit(`idle`)),this.emit(`next`)}async onEmpty(){this.#m.size!==0&&await this.#R(`empty`)}async onSizeLessThan(e){this.#m.size<e||await this.#R([`next`,`active`],()=>this.#m.size<e)}async onIdle(){this.#g===0&&this.#m.size===0||await this.#R(`idle`)}async onPendingZero(){this.#g!==0&&await this.#R(`pendingZero`)}async onRateLimit(){this.isRateLimited||await this.#R(`rateLimit`)}async onRateLimitCleared(){this.isRateLimited&&await this.#R(`rateLimitCleared`)}onError(){return new Promise((e,t)=>{let n=e=>{this.off(`error`,n),t(e)};this.on(`error`,n)})}async#R(e,t){let n=Array.isArray(e)?e:[e];return new Promise(e=>{let r=()=>{if(!(t&&!t())){for(let e of n)this.off(e,r);e()}};for(let e of n)this.on(e,r)})}get size(){return this.#m.size}sizeBy(e){return this.#m.filter(e).length}get pending(){return this.#g}get isPaused(){return this.#v}#z(){this.#t||(this.on(`add`,()=>{this.#m.size>0&&this.#B()}),this.on(`next`,()=>{this.#B()}))}#B(){this.#t||this.#a||(this.#a=!0,queueMicrotask(()=>{this.#a=!1,this.#H()}))}#V(){this.#t||(this.#w(),this.#B())}#H(){let e=this.#i;if(this.#t||this.#m.size===0){e&&(this.#i=!1,this.emit(`rateLimitCleared`));return}let t;if(this.#d){let e=Date.now();this.#S(e),t=this.#T()}else t=this.#n;let n=t>=this.#r;n!==e&&(this.#i=n,this.emit(n?`rateLimit`:`rateLimitCleared`))}get isRateLimited(){return this.#i}get isSaturated(){return this.#g===this.#_&&this.#m.size>0||this.isRateLimited&&this.#m.size>0}get runningTasks(){return[...this.#b.values()].map(e=>({...e,timeoutRemaining:e.timeout?Math.max(0,e.startTime+e.timeout-Date.now()):void 0}))}},E=class{eventQueue;cursorQueue;onEventEmitted;constructor(e){this.onEventEmitted=e.onEventEmitted,this.eventQueue=new T({concurrency:1,interval:1e3,intervalCap:e.eventsPerSecond}),this.cursorQueue=new T({concurrency:1})}queueEvent(e){return this.eventQueue.add(async()=>{await d.emit(e.subject,e.payload),this.onEventEmitted()})}queueAfterEvents(e,t=[]){let n=Promise.all(t);return n.catch(()=>void 0),this.cursorQueue.add(async()=>{await n,await e()})}async drain(){await Promise.all([this.eventQueue.onIdle(),this.cursorQueue.onIdle()])}async onIdle(){await this.drain()}},D=class{options;emittery=new n;trackedFiles=new Map;pollTimer;isPolling=!1;isDisposed=!1;inFlightChecks=new Map;constructor(e){if(!o.isAbsolute(e.directory))throw Error(`Directory must be an absolute path: ${e.directory}`);this.options={directory:e.directory,pattern:e.pattern,pollIntervalMs:e.pollIntervalMs??1e4}}on(e,t){return this.emittery.on(e,t)}once(e,t){return this.emittery.once(e,t)}async start(){this.isDisposed||this.pollTimer===void 0&&(await this.poll(),this.pollTimer=setInterval(()=>{this.poll()},this.options.pollIntervalMs))}stop(){this.pollTimer!==void 0&&(clearInterval(this.pollTimer),this.pollTimer=void 0)}dispose(){this.isDisposed=!0,this.stop(),this.emittery.clearListeners(),this.trackedFiles.clear(),this.inFlightChecks.clear()}isRunning(){return this.pollTimer!==void 0}getTrackedFiles(){return this.trackedFiles}seedFromCursors(e){for(let t of e)this.trackedFiles.set(t.filePath,{size:t.bytesRead,mtimeMs:new Date(t.lastModified).getTime()})}async poll(){if(!this.isDisposed&&!this.isPolling){this.isPolling=!0;try{let e=await this.discoverFiles(),t=new Set(e);for(let e of this.trackedFiles.keys())if(!t.has(e)){if(this.isDisposed)return;this.trackedFiles.delete(e),await this.emittery.emit(`deleted`,{filePath:e})}for(let t of e)try{await this.runFileCheck(t)}catch(e){await this.emitWatcherError(e,t)}if(this.isDisposed)return;await this.emittery.emit(`polled`,{trackedFilePaths:new Set(this.trackedFiles.keys())})}catch(e){await this.emitWatcherError(e)}finally{this.isPolling=!1}}}async discoverFiles(){return i(this.options.pattern,{cwd:this.options.directory,absolute:!0,onlyFiles:!0})}async checkFile(e){if(this.isDisposed)return;let t=await a.stat(e);if(this.isDisposed)return;let n={size:t.size,mtimeMs:t.mtimeMs},r=this.trackedFiles.get(e);if(!r){if(this.trackedFiles.set(e,n),this.isDisposed){this.trackedFiles.delete(e);return}await this.emittery.emit(`change`,{filePath:e,stat:{size:t.size,mtime:t.mtime},changeType:`created`});return}if(n.mtimeMs!==r.mtimeMs){let i=n.size<r.size?`rotated`:`modified`;if(this.trackedFiles.set(e,n),this.isDisposed)return;await this.emittery.emit(`change`,{filePath:e,stat:{size:t.size,mtime:t.mtime},changeType:i})}}clearTrackedFile(e){return this.trackedFiles.delete(e)}clearAllTrackedFiles(){this.trackedFiles.clear()}triggerImmediatePoll(e){this.runFileCheck(e).catch(t=>{this.emitWatcherError(t,e)})}async runFileCheck(e){if(this.isDisposed)return;let t=this.inFlightChecks.get(e);if(t){await t;return}let n=(async()=>{try{await this.checkFile(e)}finally{this.inFlightChecks.delete(e)}})();this.inFlightChecks.set(e,n),await n}async emitWatcherError(e,t){let n=e instanceof Error?e:Error(String(e));try{await this.emittery.emit(`error`,{error:n,filePath:t})}catch(e){console.error(`[LogFileWatcher] Error listener failed:`,e instanceof Error?e.message:String(e))}}},O=class{watcher;constructor(e){this.watcher=new D(e)}isRunning(){return this.watcher.isRunning()}async start(){await this.watcher.start()}stop(){this.watcher.stop()}dispose(){this.watcher.dispose()}onChange(e){return this.watcher.on(`change`,e)}onError(e){return this.watcher.on(`error`,e)}onDeleted(e){return this.watcher.on(`deleted`,e)}onPolled(e){return this.watcher.on(`polled`,({trackedFilePaths:t})=>e(t))}getTrackedFileMtimeMs(e){return this.watcher.getTrackedFiles().get(e)?.mtimeMs}triggerImmediatePoll(e){this.watcher.triggerImmediatePoll(e)}seedFromCursors(e){this.watcher.seedFromCursors(e)}},k=class{filesProcessed=0;eventsEmitted=0;sessionsImported=new Set;sessionsSkipped=new Set;lastLoggedEventCount=0;lastLoggedSnapshot=``;reset(){this.filesProcessed=0,this.eventsEmitted=0,this.sessionsImported.clear(),this.sessionsSkipped.clear(),this.lastLoggedEventCount=0,this.lastLoggedSnapshot=``}recordFileProcessed(){this.filesProcessed++}recordEventEmitted(e){this.eventsEmitted++,!(this.eventsEmitted-this.lastLoggedEventCount<1e3)&&(console.info(`${e} Imported ${this.eventsEmitted} events (${this.sessionsImported.size} sessions)...`),this.lastLoggedEventCount=this.eventsEmitted)}recordSessionImported(e){this.sessionsImported.add(e)}recordSessionSkipped(e){this.sessionsSkipped.add(e)}hasActivity(){return this.eventsEmitted>0||this.filesProcessed>0}stoppedMessage(e){return`${e} Stopped - ${this.eventsEmitted} events from ${this.sessionsImported.size} sessions (${this.sessionsSkipped.size} skipped)`}logProgress(e){if(!this.hasActivity())return;let t=JSON.stringify({eventsEmitted:this.eventsEmitted,filesProcessed:this.filesProcessed,sessionsImported:this.sessionsImported.size,sessionsSkipped:this.sessionsSkipped.size});t!==this.lastLoggedSnapshot&&(this.lastLoggedSnapshot=t,console.info(`${e} Progress: ${this.eventsEmitted} events, ${this.sessionsImported.size} sessions, ${this.filesProcessed} files, ${this.sessionsSkipped.size} skipped`))}};function A(e){return async t=>{try{if(e!==void 0)try{let n=await d.requestOptional(c.runtime.isAdapterManaged,{adapterSessionId:t,clientId:e});if(n.handled&&n.data.managed)return!0}catch{}let n=await d.request(u.getByAdapterSessionId,{adapterSessionId:t});return n.session!==null&&!n.session.isImported}catch{return!1}}}var j=class{checkedSessions=new Map;inFlight=new Map;generations=new Map;async isSkipped(e,t,n){for(;;){let r=this.checkedSessions.get(e);if(r!==void 0)return r;let i=this.generations.get(e)??0,a=this.inFlight.get(e),o;if(a&&a.generation===i?o=a.promise:(o=t(e).then(t=>((this.generations.get(e)??0)===i&&(this.checkedSessions.set(e,t),t&&n(e)),t)).finally(()=>{let t=this.inFlight.get(e);t&&t.generation===i&&this.inFlight.delete(e)}),this.inFlight.set(e,{generation:i,promise:o})),await o,(this.generations.get(e)??0)===i){let t=this.checkedSessions.get(e);if(t!==void 0)return t;continue}}}invalidate(e){this.checkedSessions.delete(e),this.inFlight.delete(e),this.generations.set(e,(this.generations.get(e)??0)+1)}clear(){this.checkedSessions.clear(),this.inFlight.clear(),this.generations.clear()}};function M(e,t,n,r){return!n||!e||r===`rotated`?!1:new Date(e)>=t}function N(e,t,n){for(let r of n??[]){let n=r.line===void 0?``:` at line ${r.line}`;console.warn(`${e} Parse error in ${t}${n}: ${r.error}`)}}async function P(e,t,n,i){let{cursor:a}=await d.request(r.get,{filePath:e});return a&&a.bytesRead>0&&!a.sessionContext&&!t?(await d.request(r.delete,{filePath:e}).catch(()=>{}),i(n),`retry`):a}async function F(e,t,n,r,i,a){let o=await a.parseFile(e,0);N(i,e,o.errors);let s=a.validateRecords(o.records);s.length>0&&await a.handleFirstRead(e,s,o.bytesRead??0,t,n,0,r)}function I(e,t,n,r,i){let a=[];n&&(a.push(i(t.sessionEvent)),a.push(i(t.startedEvent)));let o=r(e,t);for(let e of o)a.push(i(e));return a}function L(e,t){let n=[];for(let r of e)n.push(t(r));return n}function R(e){return typeof e==`object`&&!!e&&`compactionDetected`in e&&e.compactionDetected===!0}function z(e,t,n){return{...e,state:n(t)}}var B=class{tasks=new Set;track(e){this.tasks.add(e),e.finally(()=>{this.tasks.delete(e)})}async drain(){for(;this.tasks.size>0;)await Promise.allSettled([...this.tasks])}},V=class{config;watcher;eventQueue;importer;managedSessionCache=new j;unsubscribeChange;unsubscribeError;unsubscribeDeleted;unsubscribeRuntimeStarted;stats=new k;watcherTasks=new B;progressTimer;constructor(e,t){this.importer=t;let n=e.directory??t.getLogDirectory();this.config={enabled:e.enabled,directory:e.directory,pollIntervalMs:e.pollIntervalMs??1e4,eventsPerSecond:e.eventsPerSecond??100,adapterId:e.adapterId,adapterName:e.adapterName,checkMakaioManaged:e.checkMakaioManaged,clientId:e.clientId,machineId:e.machineId},this.watcher=new O({directory:n,pattern:this.getLogFilePattern(),pollIntervalMs:this.config.pollIntervalMs}),this.eventQueue=new E({eventsPerSecond:this.config.eventsPerSecond,onEventEmitted:()=>{this.stats.recordEventEmitted(this.logPrefix)}})}shouldSkipFile(e){return!1}validateRecords(e){return e}getMaxRecords(){}buildCursorSessionContext(e){let{adapterSessionId:t,sessionEvent:n,startedEvent:r,state:i,...a}=e;return{...a,adapterSessionId:t,sessionEvent:n,startedEvent:r,state:this.importer.serializeState(i)}}usesJsonFormat(){let e=this.getLogFilePattern();return e.includes(`.json`)&&!e.includes(`.jsonl`)}isEnabled(){return this.config.enabled}isRunning(){return this.watcher.isRunning()}async start(){if(!this.config.enabled||this.isRunning())return;let e=this.config.directory??this.importer.getLogDirectory();console.info(`${this.logPrefix} Starting - watching ${e}`),this.stats.reset(),this.managedSessionCache.clear(),this.progressTimer=setInterval(()=>this.stats.logProgress(this.logPrefix),1e4),this.unsubscribeChange=this.watcher.onChange(e=>{this.trackFileChange(e)}),this.unsubscribeError=this.watcher.onError(({error:e,filePath:t})=>{console.warn(`${this.logPrefix} Error${t?` for ${t}`:``}: ${e.message}`)}),this.unsubscribeDeleted=this.watcher.onDeleted(({filePath:e})=>{this.watcherTasks.track(d.request(r.delete,{filePath:e}).then(()=>void 0).catch(()=>{}))}),this.unsubscribeRuntimeStarted=d.on(c.runtime.started,e=>{e.payload.source.layer===`adapter`&&e.payload.adapterSessionId!==void 0&&this.managedSessionCache.invalidate(e.payload.adapterSessionId)}),await this.watcher.start()}async stop(){this.progressTimer&&=(clearInterval(this.progressTimer),void 0),this.unsubscribeChange?.(),this.unsubscribeError?.(),this.unsubscribeDeleted?.(),this.unsubscribeRuntimeStarted?.(),this.unsubscribeChange=void 0,this.unsubscribeError=void 0,this.unsubscribeDeleted=void 0,this.unsubscribeRuntimeStarted=void 0,this.watcher.stop(),await this.watcherTasks.drain(),await this.eventQueue.drain(),this.stats.hasActivity()&&console.info(this.stats.stoppedMessage(this.logPrefix))}async dispose(){await this.stop(),this.watcher.dispose(),this.managedSessionCache.clear()}static createDefaultCheckMakaioManaged(e){return A(e)}async updateCursor(e,t,n,i){await d.request(r.set,{filePath:e,bytesRead:t,lastModified:n.toISOString(),sessionContext:i})}async handleFileChange(e){let{filePath:t,changeType:n,stat:i}=e;if(this.shouldSkipFile(t))return;let a=this.usesJsonFormat();n===`rotated`&&await d.request(r.delete,{filePath:t}).catch(()=>{});let o=await P(t,a,e,e=>this.trackFileChange(e));if(o===`retry`)return;let s=o?.sessionContext!==void 0,c=s?o?.bytesRead??0:0;if(M(o?.lastModified,i.mtime,a,n))return;let l=await this.parseFile(t,a?0:c,this.getMaxRecords());N(this.logPrefix,t,l.errors),this.stats.recordFileProcessed();let u=this.validateRecords(l.records),f=l.bytesRead??0;if(u.length===0){await this.maybeUpdateCursor(t,f,c,i.mtime,a,o?.sessionContext);return}s&&o?.sessionContext?await this.handleIncrementalRead(t,u,o.sessionContext,f,i.mtime,a,c):await this.handleFirstRead(t,u,f,i.mtime,a,c)}trackFileChange(e){let t=this.handleFileChange(e).catch(e=>{console.error(`${this.logPrefix} Error handling file change:`,e instanceof Error?e.message:String(e))});this.watcherTasks.track(t)}async handleFirstRead(e,t,n,r,i,a,o=!0){let s=this.importer.extractSessionContext(t);if(await this.isSessionSkipped(s.adapterSessionId)){await this.maybeUpdateCursor(e,n,a,r,i,this.buildCursorSessionContext(s));return}let c=I(t,s,o,(e,t)=>this.importer.processRecords(e,t),e=>this.queueEvent(e));this.trackImportedSession(s.adapterSessionId),await this.queueCursorUpdate(e,n,a,r,i,this.buildCursorSessionContext(s),c)}trackImportedSession(e){this.stats.recordSessionImported(e)}async handleIncrementalRead(e,t,n,i,a,o,s){if(await this.isSessionSkipped(n.adapterSessionId)){await this.maybeUpdateCursor(e,i,s,a,o,n);return}let c;try{c=this.importer.deserializeState(n.state)}catch(t){console.warn(`${this.logPrefix} Corrupted cursor state for ${e}, deleting cursor and re-importing.`,t instanceof Error?t.message:String(t)),await d.request(r.delete,{filePath:e}).catch(t=>{console.warn(`${this.logPrefix} Failed to delete corrupted cursor for ${e}.`,t instanceof Error?t.message:String(t))}),await F(e,a,o,!0,this.logPrefix,{parseFile:(e,t)=>this.parseFile(e,t),validateRecords:e=>this.validateRecords(e),handleFirstRead:(e,t,n,r,i,a,o)=>this.handleFirstRead(e,t,n,r,i,a,o)});return}let l={adapterSessionId:n.adapterSessionId,model:n.model,cwd:n.cwd,sessionEvent:n.sessionEvent,startedEvent:n.startedEvent,state:c},u=this.importer.processRecords(t,l);if(R(l.state)){await F(e,a,o,!1,this.logPrefix,{parseFile:(e,t)=>this.parseFile(e,t),validateRecords:e=>this.validateRecords(e),handleFirstRead:(e,t,n,r,i,a,o)=>this.handleFirstRead(e,t,n,r,i,a,o)});return}let f=L(u,e=>this.queueEvent(e)),p=z(n,l.state,e=>this.importer.serializeState(e));await this.queueCursorUpdate(e,i,s,a,o,p,f)}async maybeUpdateCursor(e,t,n,r,i,a){(t>n||i)&&await this.updateCursor(e,t,r,a)}async isSessionSkipped(e){return this.managedSessionCache.isSkipped(e,e=>this.importer.isMakaioManaged(e),e=>this.stats.recordSessionSkipped(e))}queueEvent(e){return this.eventQueue.queueEvent(e)}queueCursorUpdate(e,t,n,r,i,a,o=[]){return this.eventQueue.queueAfterEvents(()=>this.maybeUpdateCursor(e,t,n,r,i,a),o)}},H=class extends V{trackingFilePaths=new Set;trackingInactiveCount=new Map;lastSeenMtimeMs=new Map;unsubscribePolled;constructor(e,t){super(e,t)}clearTrackingState(e){this.trackingFilePaths.delete(e),this.trackingInactiveCount.delete(e),this.lastSeenMtimeMs.delete(e)}async persistImportedStatus(e){let{session:t}=await d.request(l.getByLogFilePath,{logFilePath:e});return!t||t.importStatus!==`tracking`||(await d.request(l.updateImportStatus,{sessionId:t.sessionId,importStatus:`imported`})).success?!0:(console.warn(`${this.logPrefix} Failed to persist imported status for ${e}`),!1)}async start(){!this.isEnabled()||this.isRunning()||(await super.start(),this.unsubscribePolled=this.watcher.onPolled(e=>{this.onPollCycle(e).catch(e=>{console.error(`${this.logPrefix} Error handling poll cycle:`,e instanceof Error?e.message:String(e))})}),await this.restorePersistedTrackingState())}async stop(){this.unsubscribePolled?.(),this.unsubscribePolled=void 0,await super.stop()}async dispose(){this.trackingFilePaths.clear(),this.trackingInactiveCount.clear(),this.lastSeenMtimeMs.clear(),await super.dispose()}async handleFileChange(e){let{filePath:t,changeType:n,stat:i}=e;if(this.shouldSkipFile(t))return;let{cursor:a}=await d.request(r.get,{filePath:t});if(!a){await this.discoverNewFile(e);return}n===`modified`&&await this.handleModifiedImportedFile(t,e,i.mtime)}async restorePersistedTrackingState(){this.trackingFilePaths.clear(),this.trackingInactiveCount.clear(),this.lastSeenMtimeMs.clear();try{let{sessions:e}=await d.request(l.listImported,{source:this.config.adapterName,importStatus:`tracking`});for(let t of e){if(t.source!==this.config.adapterName)continue;if(!t.logFilePath){(await d.request(l.updateImportStatus,{sessionId:t.sessionId,importStatus:`imported`})).success||console.warn(`${this.logPrefix} Failed to reset tracking status for session ${t.sessionId}`);continue}let e=this.watcher.getTrackedFileMtimeMs(t.logFilePath);if(e===void 0){(await d.request(l.updateImportStatus,{sessionId:t.sessionId,importStatus:`imported`})).success||console.warn(`${this.logPrefix} Failed to reset tracking status for ${t.logFilePath}`);continue}this.trackingFilePaths.add(t.logFilePath),this.trackingInactiveCount.set(t.logFilePath,0),this.lastSeenMtimeMs.set(t.logFilePath,e)}}catch(e){console.warn(`[DiscoveryOrchestrator] Failed to restore persisted tracking state:`,e instanceof Error?e.message:String(e))}}async discoverNewFile(e){let{filePath:t,stat:n}=e,r=await this.importer.extractDiscoveryMetadata(t);if(!(r.hasMessages??!1)){await this.updateCursor(t,0,n.mtime);return}if(await this.isSessionSkipped(r.adapterSessionId)){await this.updateCursor(t,0,n.mtime);return}let i=this.queueEvent({subject:s.session.discovered,payload:{adapterId:this.config.adapterId,adapterName:this.config.adapterName,adapterSessionId:r.adapterSessionId,model:r.model??null,cwd:r.cwd??null,title:r.title,parentAdapterSessionId:r.parentAdapterSessionId??null,forkPointMessageId:r.forkPointMessageId??null,kind:r.kind??`root`,startedAt:r.startedAt,logFilePath:t}});await this.eventQueue.queueAfterEvents(()=>this.updateCursor(t,0,n.mtime),[i])}async handleModifiedImportedFile(e,t,n){let{session:r}=await d.request(l.getByLogFilePath,{logFilePath:e});if(!r){await this.discoverNewFile(t);return}if(r.source===this.config.adapterName&&!(r.importStatus!==`imported`&&r.importStatus!==`tracking`)){if(await super.handleFileChange(t),r.importStatus===`imported`&&!(await d.request(l.updateImportStatus,{sessionId:r.sessionId,importStatus:`tracking`})).success){console.warn(`${this.logPrefix} Failed to persist tracking status for ${e}`);return}this.trackingFilePaths.add(e),this.lastSeenMtimeMs.set(e,n.getTime()),this.trackingInactiveCount.delete(e),this.watcher.triggerImmediatePoll(e)}}async onPollCycle(e){for(let t of[...this.trackingFilePaths]){if(!e.has(t)){await this.persistImportedStatus(t)&&this.clearTrackingState(t);continue}let n=this.watcher.getTrackedFileMtimeMs(t),r=this.lastSeenMtimeMs.get(t);if(!(n===void 0||r===void 0))try{if(n===r){let e=(this.trackingInactiveCount.get(t)??0)+1;e>=3?await this.persistImportedStatus(t)&&this.clearTrackingState(t):this.trackingInactiveCount.set(t,e)}else this.lastSeenMtimeMs.set(t,n),this.trackingInactiveCount.delete(t)}catch(e){console.warn(`${this.logPrefix} Failed to process tracked file ${t}:`,e instanceof Error?e.message:String(e))}}}};export{V as BaseLogOrchestrator,H as DiscoveryOrchestrator,p as parseJsonlFile,m as readFirstJsonlRecords,h as someJsonlRecord};
@@ -1 +1 @@
1
- import{s as e}from"./execution-attempt-owner-recovery-BZOEVYFH.mjs";import{z as t}from"zod";import{ExecutionAttemptPreparationResultSchema as n,ProviderAllocationRefSchema as r,WorkerAllocationLifetimeSchema as i}from"@makaio/framework/contracts";function a(e){let t=Date.parse(e);if(Number.isNaN(t))throw Error(`Expected an ISO-8601 timestamp, received '${e}'`);return t}function o(e){return new Date(a(e)).toISOString()}function s(e){if(!Number.isSafeInteger(e)||e<=0)throw RangeError(`bootstrapTimeoutMs must be a positive safe integer`);let t=Date.now(),n=t+e;if(!Number.isSafeInteger(n)||!Number.isFinite(new Date(n).getTime()))throw RangeError(`bootstrapTimeoutMs produces an unrepresentable bootstrap deadline`);return{createdAt:new Date(t).toISOString(),bootstrapDeadlineAt:new Date(n).toISOString()}}function c(t){return e(t,e=>n.parse(e))}const l=t.array(t.object({operationId:t.string().min(1),runtimeGeneration:t.number().int().positive(),result:n}).strict());function u(t){return e(t,e=>l.parse(e))}function d(t){return e(t,e=>r.parse(e))}function f(e){return i.parse(e)}function p(e){let t=r.parse(e.currentRef),n=d(e.nextRef);if(t.providerId!==n.providerId)throw Error(`Allocation reference evolution must keep one provider, received '${t.providerId}' and '${n.providerId}'`);return{currentRef:t,nextRef:n}}function m(e,t){if(e.providerId!==t.providerId)throw Error(`Allocation reference for attempt '${e.executionAttemptId}' names provider '${t.providerId}' but the attempt is bound to '${e.providerId??`no provider`}'`)}const h={runtimeGeneration:0,runtimeIncarnationId:null,runtimeReadyAt:null,operationStartGate:`open`,activeOperationId:null,activeOperationKind:null,activeOperationKey:null,activeOperationGeneration:null,activeOperationAdmittedAt:null,lastCompletedOperationId:null};function g(e){return{runtimeGeneration:e.runtimeGeneration,runtimeIncarnationId:e.runtimeIncarnationId,runtimeReadyAt:e.runtimeReadyAt,operationStartGate:e.operationStartGate,activeOperationId:e.activeOperationId,activeOperationKind:e.activeOperationKind,activeOperationKey:e.activeOperationKey,activeOperationGeneration:e.activeOperationGeneration,activeOperationAdmittedAt:e.activeOperationAdmittedAt,lastCompletedOperationId:e.lastCompletedOperationId}}function _(e,t){let n=a(e.createdAt)-a(t.createdAt);return n===0?e.executionAttemptId<t.executionAttemptId?-1:+(e.executionAttemptId>t.executionAttemptId):n}function v(e){let{status:t,claimable:n,settlementKind:r,allocationRef:i,providerId:a}=e,{allocationLifetime:o,provisionerIncarnationId:s}=e;if(t!==`allocated`||n!==!0||r!=null||i===null||a===null||o===null||s===null)throw Error(`Attempt '${e.executionAttemptId}' was selected as recoverable but is not: status '${t}', claimable '${String(n)}', settlement '${String(r)}', allocation '${i===null?`none`:`present`}', provider '${String(a)}', lifetime '${String(o)}', provisioner '${String(s)}'`);return{...e,status:t,claimable:!0,settlementKind:null,allocationRef:i,providerId:a,allocationLifetime:o,provisionerIncarnationId:s}}export{o as a,p as c,m as d,g as f,a as i,u as l,_ as n,f as o,v as p,s as r,d as s,h as t,c as u};
1
+ import{s as e}from"./execution-attempt-owner-recovery-CvnTavxP.mjs";import{z as t}from"zod";import{ExecutionAttemptPreparationResultSchema as n,ProviderAllocationRefSchema as r,WorkerAllocationLifetimeSchema as i}from"@makaio/framework/contracts";function a(e){let t=Date.parse(e);if(Number.isNaN(t))throw Error(`Expected an ISO-8601 timestamp, received '${e}'`);return t}function o(e){return new Date(a(e)).toISOString()}function s(e){if(!Number.isSafeInteger(e)||e<=0)throw RangeError(`bootstrapTimeoutMs must be a positive safe integer`);let t=Date.now(),n=t+e;if(!Number.isSafeInteger(n)||!Number.isFinite(new Date(n).getTime()))throw RangeError(`bootstrapTimeoutMs produces an unrepresentable bootstrap deadline`);return{createdAt:new Date(t).toISOString(),bootstrapDeadlineAt:new Date(n).toISOString()}}function c(t){return e(t,e=>n.parse(e))}const l=t.array(t.object({operationId:t.string().min(1),runtimeGeneration:t.number().int().positive(),result:n}).strict());function u(t){return e(t,e=>l.parse(e))}function d(t){return e(t,e=>r.parse(e))}function f(e){return i.parse(e)}function p(e){let t=r.parse(e.currentRef),n=d(e.nextRef);if(t.providerId!==n.providerId)throw Error(`Allocation reference evolution must keep one provider, received '${t.providerId}' and '${n.providerId}'`);return{currentRef:t,nextRef:n}}function m(e,t){if(e.providerId!==t.providerId)throw Error(`Allocation reference for attempt '${e.executionAttemptId}' names provider '${t.providerId}' but the attempt is bound to '${e.providerId??`no provider`}'`)}const h={runtimeGeneration:0,runtimeIncarnationId:null,runtimeReadyAt:null,operationStartGate:`open`,activeOperationId:null,activeOperationKind:null,activeOperationKey:null,activeOperationGeneration:null,activeOperationAdmittedAt:null,lastCompletedOperationId:null};function g(e){return{runtimeGeneration:e.runtimeGeneration,runtimeIncarnationId:e.runtimeIncarnationId,runtimeReadyAt:e.runtimeReadyAt,operationStartGate:e.operationStartGate,activeOperationId:e.activeOperationId,activeOperationKind:e.activeOperationKind,activeOperationKey:e.activeOperationKey,activeOperationGeneration:e.activeOperationGeneration,activeOperationAdmittedAt:e.activeOperationAdmittedAt,lastCompletedOperationId:e.lastCompletedOperationId}}function _(e,t){let n=a(e.createdAt)-a(t.createdAt);return n===0?e.executionAttemptId<t.executionAttemptId?-1:+(e.executionAttemptId>t.executionAttemptId):n}function v(e){let{status:t,claimable:n,settlementKind:r,allocationRef:i,providerId:a}=e,{allocationLifetime:o,provisionerIncarnationId:s}=e;if(t!==`allocated`||n!==!0||r!=null||i===null||a===null||o===null||s===null)throw Error(`Attempt '${e.executionAttemptId}' was selected as recoverable but is not: status '${t}', claimable '${String(n)}', settlement '${String(r)}', allocation '${i===null?`none`:`present`}', provider '${String(a)}', lifetime '${String(o)}', provisioner '${String(s)}'`);return{...e,status:t,claimable:!0,settlementKind:null,allocationRef:i,providerId:a,allocationLifetime:o,provisionerIncarnationId:s}}export{o as a,p as c,m as d,g as f,a as i,u as l,_ as n,f as o,v as p,s as r,d as s,h as t,c as u};
@@ -1 +1 @@
1
- import{a as e}from"./ownership-recovery-guard-C9h8K1jo.mjs";import{AdapterSubjects as t}from"@makaio/framework/contracts";function n(e){return{ownerInstanceId:e.ownerInstanceId??`test-owner-instance`,settlementAckToken:`test-ack-${e.agentId??crypto.randomUUID()}`}}function r(n){return n.on(t.acknowledgeCallerSettlement,async t=>{if(t.payload.recovery===!0){t.setResult({acknowledged:!0});return}let r=await n.requestOptional(e.updateStatus,{agentId:t.payload.agentId,status:`idle`,expectedStatus:[`starting`,`dead`]});if(!r.handled){t.setResult({acknowledged:!0});return}t.setResult(r.data.success&&r.data.transitioned?{acknowledged:!0}:{acknowledged:!1,reason:`status-refused`})})}export{r as n,n as t};
1
+ import{a as e}from"./ownership-recovery-guard-C00rcqvz.mjs";import{AdapterSubjects as t}from"@makaio/framework/contracts";function n(e){return{ownerInstanceId:e.ownerInstanceId??`test-owner-instance`,settlementAckToken:`test-ack-${e.agentId??crypto.randomUUID()}`}}function r(n){return n.on(t.acknowledgeCallerSettlement,async t=>{if(t.payload.recovery===!0){t.setResult({acknowledged:!0});return}let r=await n.requestOptional(e.updateStatus,{agentId:t.payload.agentId,status:`idle`,expectedStatus:[`starting`,`dead`]});if(!r.handled){t.setResult({acknowledged:!0});return}t.setResult(r.data.success&&r.data.transitioned?{acknowledged:!0}:{acknowledged:!1,reason:`status-refused`})})}export{r as n,n as t};
@@ -0,0 +1,158 @@
1
+ import { z } from "zod";
2
+ import { EventMessagePayload, RequestMessagePayload, SubjectDefinition, SubjectRecord } from "@makaio/framework/core";
3
+ import { ClientSubjects } from "@makaio/framework/contracts/client";
4
+
5
+ //#region subsystems/client/src/hook-subjects.d.ts
6
+ /**
7
+ * Trim and return a string value when non-empty, otherwise `undefined`.
8
+ *
9
+ * Primitive building block for normalizers that accept `unknown` values from
10
+ * raw JSON payloads. Returns `undefined` when the input is not a string, or
11
+ * is a string that is empty or whitespace-only after trimming.
12
+ * @param value - Unknown value to inspect.
13
+ * @returns Trimmed non-empty string, or `undefined`.
14
+ */
15
+ declare function pickNonEmptyStringValue(value: unknown): string | undefined;
16
+ /**
17
+ * Canonical schema for the raw catch-all hook payload delivered on
18
+ * `client:<id>.hook.received`.
19
+ *
20
+ * Client ingress CLIs are dumb bridges: they accept any native hook event and
21
+ * publish it verbatim on this subject. Downstream normalizers are responsible
22
+ * for interpreting `eventName` and mapping the `payload` to structured
23
+ * `client.session.*` observations.
24
+ *
25
+ * Fields:
26
+ * - `eventName` — the hook event name as reported by the client CLI
27
+ * (e.g. `'PreToolUse'`, `'Stop'`).
28
+ * - `receivedAt` — Unix epoch timestamp in milliseconds when the bridge
29
+ * received the hook call.
30
+ * - `payload` — raw JSON object forwarded verbatim from the client CLI.
31
+ * - `metadata` — optional pass-through metadata added by the bridge (e.g.
32
+ * process PID, invocation arguments).
33
+ */
34
+ declare const RawClientHookPayloadSchema: z.ZodObject<{
35
+ eventName: z.ZodString;
36
+ receivedAt: z.ZodNumber;
37
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
38
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
39
+ }, z.core.$strip>;
40
+ /** Parsed raw catch-all hook payload; see {@link RawClientHookPayloadSchema}. */
41
+ type RawClientHookPayload = z.infer<typeof RawClientHookPayloadSchema>;
42
+ /**
43
+ * Normalize user-provided client identifiers to the stable suffix used in
44
+ * `client:<id>` namespaces.
45
+ * @param clientId - Raw client identifier, optionally prefixed with `client:`
46
+ * @param caller - Optional function name used in thrown error messages
47
+ * @returns Canonical lowercase client identifier without the `client:` prefix
48
+ */
49
+ declare function canonicalizeClientId(clientId: string, caller?: string): string;
50
+ type RawClientHookSubjectRecord = SubjectRecord<'hook.received', EventMessagePayload<RawClientHookPayload>>;
51
+ /**
52
+ * Subject definition for the raw catch-all hook event in a concrete
53
+ * `client:<id>` namespace.
54
+ */
55
+ type RawClientHookReceivedSubject = SubjectDefinition<RawClientHookSubjectRecord, 'hook.received', `client:${string}`>;
56
+ /**
57
+ * Build a non-owning subject definition for `client:<id>.hook.received`.
58
+ *
59
+ * This is intentionally not a namespace registration. Concrete client packages
60
+ * own their full `client:<id>` namespace via `createClientNamespace`; the
61
+ * generic CLI bridge only needs to emit the shared hook subject and must not
62
+ * accidentally register a narrower namespace before the concrete owner loads.
63
+ * When the concrete owner is loaded, normal bus schema validation applies. When
64
+ * it is not loaded, the ad-hoc subject still allows the raw event to traverse
65
+ * transports to a process that owns the namespace.
66
+ * @param clientId - Stable client identifier, optionally prefixed with `client:`
67
+ * @returns Non-owning subject definition for the client's raw hook ingress
68
+ */
69
+ declare function createRawClientHookReceivedSubject(clientId: string): RawClientHookReceivedSubject;
70
+ /**
71
+ * Default timeout in milliseconds for hook handle requests.
72
+ *
73
+ * Shared between the CLI schema default (client-hooks extension) and the
74
+ * wiring descriptor trailing flags (claude-code client) so both always agree
75
+ * on the configured wait budget without independent magic numbers.
76
+ */
77
+ declare const DEFAULT_HOOK_HANDLE_TIMEOUT_MS = 5000;
78
+ /**
79
+ * Schema for the response payload returned by a `makaio hook handle` command.
80
+ *
81
+ * The client binary reads this from the command's stdout after the process
82
+ * exits. All fields default to safe zero-values so partial responses are
83
+ * still valid.
84
+ *
85
+ * Fields:
86
+ * - `exitCode` — process exit code the binary should use (0–255). Defaults to `0`.
87
+ * - `stdout` — text written to stdout, forwarded verbatim to the client.
88
+ * Defaults to `''`.
89
+ * - `stderr` — text written to stderr, forwarded verbatim to the client.
90
+ * Defaults to `''`.
91
+ */
92
+ declare const ClientHookHandleResponseSchema: z.ZodObject<{
93
+ exitCode: z.ZodDefault<z.ZodNumber>;
94
+ stdout: z.ZodDefault<z.ZodString>;
95
+ stderr: z.ZodDefault<z.ZodString>;
96
+ }, z.core.$strip>;
97
+ /** Parsed hook handle response; see {@link ClientHookHandleResponseSchema}. */
98
+ type ClientHookHandleResponse = z.infer<typeof ClientHookHandleResponseSchema>;
99
+ /**
100
+ * Frozen no-op hook handle response shared across all client composers.
101
+ *
102
+ * exitCode 0 with empty stdout/stderr is the provider-valid passthrough
103
+ * that permits the tool invocation to proceed unchanged. A single frozen
104
+ * instance avoids per-client duplication and per-call object allocation.
105
+ */
106
+ declare const NOOP_HOOK_HANDLE_RESPONSE: ClientHookHandleResponse;
107
+ type RawClientHookHandleSubjectRecord = SubjectRecord<'hook.handle', RequestMessagePayload<RawClientHookPayload, ClientHookHandleResponse>>;
108
+ /**
109
+ * Subject definition for the raw hook handle request/response subject in a
110
+ * concrete `client:<id>` namespace.
111
+ *
112
+ * Carries `RequestMessagePayload<RawClientHookPayload, ClientHookHandleResponse>`
113
+ * as a phantom type so `bus.requestOptional` infers the correct generics without
114
+ * additional type annotations at the call site.
115
+ */
116
+ type RawClientHookHandleSubject = SubjectDefinition<RawClientHookHandleSubjectRecord, 'hook.handle', `client:${string}`>;
117
+ /**
118
+ * Build a non-owning subject definition for `client:<id>.hook.handle`.
119
+ *
120
+ * The returned definition uses `isRequest: true` so the bus dispatches it
121
+ * through the request/response pipeline, and `hostLocalRequest: true` so the
122
+ * bus accepts direct remote ingress but never relays the request onward to
123
+ * other transports. This matches the owning namespace registration in
124
+ * `createClientNamespace`, which wraps the schema with `hostLocalRequest()`.
125
+ *
126
+ * Concrete client packages own their full `client:<id>` namespace via
127
+ * `createClientNamespace`; this helper is intentionally non-owning for
128
+ * the same reasons as {@link createRawClientHookReceivedSubject} — see that
129
+ * function's doc for the full rationale.
130
+ * @param rawClientId - Stable client identifier, optionally prefixed with `client:`
131
+ * @returns Non-owning subject definition for the client's raw hook handle ingress
132
+ */
133
+ declare function createRawClientHookHandleSubject(rawClientId: string): RawClientHookHandleSubject;
134
+ /**
135
+ * Subject definition for the global `client.runtime.observe` request/response
136
+ * subject.
137
+ *
138
+ * Aliases the type of `ClientSubjects.runtime.observe` (type-only import, erased
139
+ * at runtime) so `bus.requestOptional` infers identical request and response
140
+ * types without loading the contracts module in the CLI hook path.
141
+ */
142
+ type ClientRuntimeObserveSubject = typeof ClientSubjects.runtime.observe;
143
+ /**
144
+ * Build a non-owning subject definition for `client.runtime.observe`.
145
+ *
146
+ * The `$meta` mirrors what `nestSubjectDefinitions` generates for the plain
147
+ * (unwrapped) `runtime.observe` request/response row in `ClientSchemas`, so the
148
+ * bus routes it identically to `ClientSubjects.runtime.observe`. It exists
149
+ * because the hook path must not load the `@makaio/contracts/client` entry at
150
+ * runtime; that entry adds its own client, profile, and account-identity schema
151
+ * chunks on top of the bus. The parity test guards drift against
152
+ * `ClientSubjects.runtime.observe`. The `client` namespace stays owned by the
153
+ * contracts package; this helper does not register anything.
154
+ * @returns Non-owning subject definition for `client.runtime.observe`
155
+ */
156
+ declare function createClientRuntimeObserveSubject(): ClientRuntimeObserveSubject;
157
+ //#endregion
158
+ export { ClientHookHandleResponse, ClientHookHandleResponseSchema, ClientRuntimeObserveSubject, DEFAULT_HOOK_HANDLE_TIMEOUT_MS, NOOP_HOOK_HANDLE_RESPONSE, RawClientHookHandleSubject, RawClientHookPayload, RawClientHookPayloadSchema, RawClientHookReceivedSubject, canonicalizeClientId, createClientRuntimeObserveSubject, createRawClientHookHandleSubject, createRawClientHookReceivedSubject, pickNonEmptyStringValue };
@@ -0,0 +1 @@
1
+ import{z as e}from"zod";function t(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}const n=e.object({eventName:e.string(),receivedAt:e.number().int().finite().nonnegative().describe(`Unix epoch timestamp in milliseconds`),payload:e.record(e.string(),e.unknown()),metadata:e.record(e.string(),e.unknown()).optional()}),r=/^[a-z0-9-]+$/;function i(e,t=`canonicalizeClientId`){let n=e.trim().toLowerCase(),i=n.startsWith(`client:`)?n.slice(7):n;if(i.length===0)throw Error(`[${t}] clientId must be a non-empty string`);if(!r.test(i))throw Error(`[${t}] clientId must contain only lowercase letters, numbers, and hyphens after an optional client: prefix`);return i}function a(e){return{subject:`hook.received`,$meta:{namespace:`client:${i(e,`createRawClientHookReceivedSubject`)}`,isRequest:!1,local:!1,channel:!1}}}const o=5e3,s=e.object({exitCode:e.number().int().min(0).max(255).default(0),stdout:e.string().default(``),stderr:e.string().default(``)}),c=Object.freeze({exitCode:0,stdout:``,stderr:``});function l(e){return{subject:`hook.handle`,$meta:{namespace:`client:${i(e,`createRawClientHookHandleSubject`)}`,isRequest:!0,local:!1,channel:!1,hostLocalRequest:!0}}}function u(){return{subject:`runtime.observe`,$meta:{namespace:`client`,isRequest:!0,local:!1,channel:!1}}}export{s as ClientHookHandleResponseSchema,o as DEFAULT_HOOK_HANDLE_TIMEOUT_MS,c as NOOP_HOOK_HANDLE_RESPONSE,n as RawClientHookPayloadSchema,i as canonicalizeClientId,u as createClientRuntimeObserveSubject,l as createRawClientHookHandleSubject,a as createRawClientHookReceivedSubject,t as pickNonEmptyStringValue};
@@ -1,8 +1,9 @@
1
- import { a as StrategyDependencies, i as InstallStrategy, n as createStrategy, r as InstallArtifact, t as verifyInstalledVersion } from "../client-binary-version-verifier-C8gtKQFO.mjs";
1
+ import { ClientHookHandleResponse, ClientHookHandleResponseSchema, DEFAULT_HOOK_HANDLE_TIMEOUT_MS, NOOP_HOOK_HANDLE_RESPONSE, RawClientHookHandleSubject, RawClientHookPayload, RawClientHookPayloadSchema, RawClientHookReceivedSubject, canonicalizeClientId, createRawClientHookHandleSubject, createRawClientHookReceivedSubject, pickNonEmptyStringValue } from "./hook-subjects.mjs";
2
+ import { a as StrategyDependencies, i as InstallStrategy, n as createStrategy, r as InstallArtifact, t as verifyInstalledVersion } from "../client-binary-version-verifier-DgGke3gW.mjs";
2
3
  import * as _$zod from "zod";
3
4
  import { z } from "zod";
4
5
  import * as _$_makaio_core0 from "@makaio/framework/core";
5
- import { EventMessagePayload, RequestMessagePayload, SchemaRecord, SubjectDefinition, SubjectRecord } from "@makaio/framework/core";
6
+ import { RequestMessagePayload, SchemaRecord, SubjectDefinition, SubjectRecord } from "@makaio/framework/core";
6
7
  import * as _$_makaio_contracts0 from "@makaio/framework/contracts";
7
8
  import { ClientDefinition, ExtensionServiceLifecycle, MakaioNodeExtension } from "@makaio/framework/contracts";
8
9
  import { IMakaioBus } from "@makaio/framework/bus";
@@ -1400,133 +1401,6 @@ declare class ClientSessionTokenService extends BaseService implements ClientSes
1400
1401
  }
1401
1402
  //#endregion
1402
1403
  //#region subsystems/client/src/client-session-observed-semantics.d.ts
1403
- /**
1404
- * Canonical schema for the raw catch-all hook payload delivered on
1405
- * `client:<id>.hook.received`.
1406
- *
1407
- * Client ingress CLIs are dumb bridges: they accept any native hook event and
1408
- * publish it verbatim on this subject. Downstream normalizers are responsible
1409
- * for interpreting `eventName` and mapping the `payload` to structured
1410
- * `client.session.*` observations.
1411
- *
1412
- * Fields:
1413
- * - `eventName` — the hook event name as reported by the client CLI
1414
- * (e.g. `'PreToolUse'`, `'Stop'`).
1415
- * - `receivedAt` — Unix epoch timestamp in milliseconds when the bridge
1416
- * received the hook call.
1417
- * - `payload` — raw JSON object forwarded verbatim from the client CLI.
1418
- * - `metadata` — optional pass-through metadata added by the bridge (e.g.
1419
- * process PID, invocation arguments).
1420
- */
1421
- declare const RawClientHookPayloadSchema: z.ZodObject<{
1422
- eventName: z.ZodString;
1423
- receivedAt: z.ZodNumber;
1424
- payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1425
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1426
- }, z.core.$strip>;
1427
- type RawClientHookPayload = z.infer<typeof RawClientHookPayloadSchema>;
1428
- /**
1429
- * Normalize user-provided client identifiers to the stable suffix used in
1430
- * `client:<id>` namespaces.
1431
- * @param clientId - Raw client identifier, optionally prefixed with `client:`
1432
- * @param caller - Optional function name used in thrown error messages
1433
- * @returns Canonical lowercase client identifier without the `client:` prefix
1434
- */
1435
- declare function canonicalizeClientId(clientId: string, caller?: string): string;
1436
- type RawClientHookSubjectRecord = SubjectRecord<'hook.received', EventMessagePayload<RawClientHookPayload>>;
1437
- /**
1438
- * Subject definition for the raw catch-all hook event in a concrete
1439
- * `client:<id>` namespace.
1440
- */
1441
- type RawClientHookReceivedSubject = SubjectDefinition<RawClientHookSubjectRecord, 'hook.received', `client:${string}`>;
1442
- /**
1443
- * Build a non-owning subject definition for `client:<id>.hook.received`.
1444
- *
1445
- * This is intentionally not a namespace registration. Concrete client packages
1446
- * own their full `client:<id>` namespace via {@link createClientNamespace}; the
1447
- * generic CLI bridge only needs to emit the shared hook subject and must not
1448
- * accidentally register a narrower namespace before the concrete owner loads.
1449
- * When the concrete owner is loaded, normal bus schema validation applies. When
1450
- * it is not loaded, the ad-hoc subject still allows the raw event to traverse
1451
- * transports to a process that owns the namespace.
1452
- * @param clientId - Stable client identifier, optionally prefixed with `client:`
1453
- * @returns Non-owning subject definition for the client's raw hook ingress
1454
- */
1455
- declare function createRawClientHookReceivedSubject(clientId: string): RawClientHookReceivedSubject;
1456
- /**
1457
- * Default timeout in milliseconds for hook handle requests.
1458
- *
1459
- * Shared between the CLI schema default (client-hooks extension) and the
1460
- * wiring descriptor trailing flags (claude-code client) so both always agree
1461
- * on the configured wait budget without independent magic numbers.
1462
- */
1463
- declare const DEFAULT_HOOK_HANDLE_TIMEOUT_MS = 5000;
1464
- /**
1465
- * Schema for the response payload returned by a `makaio hook handle` command.
1466
- *
1467
- * The client binary reads this from the command's stdout after the process
1468
- * exits. All fields default to safe zero-values so partial responses are
1469
- * still valid.
1470
- *
1471
- * Fields:
1472
- * - `exitCode` — process exit code the binary should use (0–255). Defaults to `0`.
1473
- * - `stdout` — text written to stdout, forwarded verbatim to the client.
1474
- * Defaults to `''`.
1475
- * - `stderr` — text written to stderr, forwarded verbatim to the client.
1476
- * Defaults to `''`.
1477
- */
1478
- declare const ClientHookHandleResponseSchema: z.ZodObject<{
1479
- exitCode: z.ZodDefault<z.ZodNumber>;
1480
- stdout: z.ZodDefault<z.ZodString>;
1481
- stderr: z.ZodDefault<z.ZodString>;
1482
- }, z.core.$strip>;
1483
- type ClientHookHandleResponse = z.infer<typeof ClientHookHandleResponseSchema>;
1484
- /**
1485
- * Frozen no-op hook handle response shared across all client composers.
1486
- *
1487
- * exitCode 0 with empty stdout/stderr is the provider-valid passthrough
1488
- * that permits the tool invocation to proceed unchanged. A single frozen
1489
- * instance avoids per-client duplication and per-call object allocation.
1490
- */
1491
- declare const NOOP_HOOK_HANDLE_RESPONSE: ClientHookHandleResponse;
1492
- type RawClientHookHandleSubjectRecord = SubjectRecord<'hook.handle', RequestMessagePayload<RawClientHookPayload, ClientHookHandleResponse>>;
1493
- /**
1494
- * Subject definition for the raw hook handle request/response subject in a
1495
- * concrete `client:<id>` namespace.
1496
- *
1497
- * Carries `RequestMessagePayload<RawClientHookPayload, ClientHookHandleResponse>`
1498
- * as a phantom type so `bus.requestOptional` infers the correct generics without
1499
- * additional type annotations at the call site.
1500
- */
1501
- type RawClientHookHandleSubject = SubjectDefinition<RawClientHookHandleSubjectRecord, 'hook.handle', `client:${string}`>;
1502
- /**
1503
- * Build a non-owning subject definition for `client:<id>.hook.handle`.
1504
- *
1505
- * The returned definition uses `isRequest: true` so the bus dispatches it
1506
- * through the request/response pipeline, and `hostLocalRequest: true` so the
1507
- * bus accepts direct remote ingress but never relays the request onward to
1508
- * other transports. This matches the owning namespace registration in
1509
- * {@link createClientNamespace}, which wraps the schema with
1510
- * `hostLocalRequest()`.
1511
- *
1512
- * Concrete client packages own their full `client:<id>` namespace via
1513
- * {@link createClientNamespace}; this helper is intentionally non-owning for
1514
- * the same reasons as {@link createRawClientHookReceivedSubject} — see that
1515
- * function's doc for the full rationale.
1516
- * @param rawClientId - Stable client identifier, optionally prefixed with `client:`
1517
- * @returns Non-owning subject definition for the client's raw hook handle ingress
1518
- */
1519
- declare function createRawClientHookHandleSubject(rawClientId: string): RawClientHookHandleSubject;
1520
- /**
1521
- * Trim and return a string value when non-empty, otherwise `undefined`.
1522
- *
1523
- * Primitive building block for normalizers that accept `unknown` values from
1524
- * raw JSON payloads. Returns `undefined` when the input is not a string, or
1525
- * is a string that is empty or whitespace-only after trimming.
1526
- * @param value - Unknown value to inspect.
1527
- * @returns Trimmed non-empty string, or `undefined`.
1528
- */
1529
- declare function pickNonEmptyStringValue(value: unknown): string | undefined;
1530
1404
  /**
1531
1405
  * Extract a non-empty string value from an unknown-typed hook payload object.
1532
1406
  *