@artinet/sdk 0.5.18 → 0.6.0-preview.2

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 (434) hide show
  1. package/README.md +36 -617
  2. package/dist/browser/browser.d.ts +1 -1
  3. package/dist/browser/browser.js +1 -1
  4. package/dist/browser/client/a2a-client.d.ts +19 -18
  5. package/dist/browser/client/a2a-client.js +20 -8
  6. package/dist/browser/config/index.d.ts +158 -0
  7. package/dist/browser/config/index.js +155 -0
  8. package/dist/browser/config/observability.d.ts +119 -0
  9. package/dist/browser/config/observability.js +35 -0
  10. package/dist/browser/create/agentcard-builder.d.ts +47 -0
  11. package/dist/browser/create/agentcard-builder.js +65 -0
  12. package/dist/browser/create/base.d.ts +4 -0
  13. package/dist/browser/create/describe.d.ts +8 -0
  14. package/dist/browser/create/describe.js +8 -0
  15. package/dist/browser/create/message-builder.d.ts +78 -0
  16. package/dist/browser/create/message-builder.js +108 -0
  17. package/dist/browser/create/part-builder.d.ts +60 -0
  18. package/dist/browser/create/part-builder.js +81 -0
  19. package/dist/browser/create/task-builder.d.ts +251 -0
  20. package/dist/browser/create/task-builder.js +379 -0
  21. package/dist/browser/transport/rpc/parser.d.ts +2 -2
  22. package/dist/browser/transport/rpc/parser.js +7 -6
  23. package/dist/browser/transport/rpc/rpc-client.d.ts +5 -5
  24. package/dist/browser/transport/rpc/rpc-client.js +6 -6
  25. package/dist/browser/transport/streaming/event-stream.d.ts +3 -3
  26. package/dist/browser/transport/streaming/event-stream.js +11 -10
  27. package/dist/browser/types/a2a/a2a.d.ts +382 -0
  28. package/dist/browser/types/a2a/a2a.js +14 -0
  29. package/dist/browser/types/a2a/index.d.ts +5 -0
  30. package/dist/browser/types/a2a/index.js +1 -0
  31. package/dist/browser/types/{interfaces/client.d.ts → client.d.ts} +25 -27
  32. package/dist/browser/types/core/core.d.ts +31 -0
  33. package/dist/browser/types/core/index.d.ts +1 -0
  34. package/dist/browser/types/core/index.js +1 -0
  35. package/dist/browser/types/index.d.ts +6 -3
  36. package/dist/browser/types/index.js +6 -3
  37. package/dist/browser/types/mcp/index.d.ts +1 -0
  38. package/dist/browser/types/mcp/index.js +1 -0
  39. package/dist/{types/interfaces/services/mcp/service.d.ts → browser/types/mcp/mcp.d.ts} +4 -3
  40. package/dist/browser/types/{interfaces/services/a2a/builder.js → mcp/mcp.js} +1 -1
  41. package/dist/browser/types/storage.d.ts +21 -0
  42. package/dist/browser/utils/common/constants.d.ts +2 -7
  43. package/dist/browser/utils/common/constants.js +5 -32
  44. package/dist/browser/utils/common/errors.d.ts +74 -18
  45. package/dist/browser/utils/common/errors.js +81 -28
  46. package/dist/browser/utils/common/utils.d.ts +23 -0
  47. package/dist/browser/utils/common/utils.js +32 -0
  48. package/dist/client/a2a-client.d.ts +19 -18
  49. package/dist/client/a2a-client.js +20 -8
  50. package/dist/config/default.d.ts +50 -0
  51. package/dist/config/default.js +62 -0
  52. package/dist/config/index.d.ts +158 -0
  53. package/dist/config/index.js +155 -0
  54. package/dist/config/observability.d.ts +119 -0
  55. package/dist/config/observability.js +35 -0
  56. package/dist/create/agent-builder.d.ts +77 -0
  57. package/dist/create/agent-builder.js +20 -0
  58. package/dist/create/agentcard-builder.d.ts +47 -0
  59. package/dist/create/agentcard-builder.js +66 -0
  60. package/dist/create/base.d.ts +4 -0
  61. package/dist/create/base.js +1 -0
  62. package/dist/create/create.d.ts +762 -0
  63. package/dist/create/create.js +556 -0
  64. package/dist/create/describe.d.ts +8 -0
  65. package/dist/create/describe.js +8 -0
  66. package/dist/create/index.d.ts +4 -0
  67. package/dist/create/index.js +4 -0
  68. package/dist/create/message-builder.d.ts +78 -0
  69. package/dist/create/message-builder.js +110 -0
  70. package/dist/create/part-builder.d.ts +60 -0
  71. package/dist/create/part-builder.js +84 -0
  72. package/dist/create/status-builder.d.ts +26 -0
  73. package/dist/create/status-builder.js +46 -0
  74. package/dist/create/task-builder.d.ts +251 -0
  75. package/dist/create/task-builder.js +384 -0
  76. package/dist/create/transform.d.ts +16 -0
  77. package/dist/create/transform.js +106 -0
  78. package/dist/extensions/otel.d.ts +98 -0
  79. package/dist/extensions/otel.js +190 -0
  80. package/dist/extensions/pino.d.ts +44 -0
  81. package/dist/extensions/pino.js +107 -0
  82. package/dist/extensions/winston.d.ts +47 -0
  83. package/dist/extensions/winston.js +114 -0
  84. package/dist/index.d.ts +4 -0
  85. package/dist/index.js +4 -0
  86. package/dist/server/express/errors.js +7 -11
  87. package/dist/server/express/middeware.d.ts +2 -2
  88. package/dist/server/express/middeware.js +26 -40
  89. package/dist/server/express/server.d.ts +14 -56
  90. package/dist/server/express/server.js +46 -35
  91. package/dist/services/a2a/execute.d.ts +11 -0
  92. package/dist/services/a2a/execute.js +32 -0
  93. package/dist/services/a2a/factory/context.d.ts +15 -128
  94. package/dist/services/a2a/factory/context.js +30 -136
  95. package/dist/services/a2a/factory/handler.d.ts +6 -0
  96. package/dist/services/a2a/factory/handler.js +14 -0
  97. package/dist/services/a2a/factory/index.d.ts +1 -3
  98. package/dist/services/a2a/factory/index.js +1 -3
  99. package/dist/services/a2a/factory/service.d.ts +20 -7
  100. package/dist/services/a2a/factory/service.js +5 -5
  101. package/dist/services/a2a/factory/state-machine.d.ts +11 -0
  102. package/dist/services/a2a/factory/state-machine.js +88 -0
  103. package/dist/services/a2a/handlers/artifact.d.ts +7 -0
  104. package/dist/services/a2a/handlers/artifact.js +28 -0
  105. package/dist/services/a2a/handlers/cancel-task.d.ts +11 -0
  106. package/dist/services/a2a/handlers/cancel-task.js +35 -0
  107. package/dist/services/a2a/handlers/get-task.d.ts +11 -0
  108. package/dist/services/a2a/handlers/get-task.js +13 -0
  109. package/dist/services/a2a/handlers/resubscribe-task.d.ts +19 -0
  110. package/dist/services/a2a/handlers/resubscribe-task.js +59 -0
  111. package/dist/services/a2a/handlers/send-message.d.ts +11 -0
  112. package/dist/services/a2a/handlers/send-message.js +31 -0
  113. package/dist/services/a2a/handlers/stream-message.d.ts +19 -0
  114. package/dist/services/a2a/handlers/stream-message.js +23 -0
  115. package/dist/services/a2a/handlers/update.d.ts +17 -0
  116. package/dist/services/a2a/handlers/update.js +119 -0
  117. package/dist/services/a2a/helpers/content.d.ts +6 -2
  118. package/dist/services/a2a/helpers/content.js +9 -1
  119. package/dist/services/a2a/helpers/history.d.ts +6 -2
  120. package/dist/services/a2a/helpers/history.js +4 -0
  121. package/dist/services/a2a/helpers/index.d.ts +3 -3
  122. package/dist/services/a2a/helpers/index.js +3 -3
  123. package/dist/services/a2a/helpers/part.d.ts +9 -9
  124. package/dist/services/a2a/helpers/references.d.ts +6 -0
  125. package/dist/services/a2a/helpers/references.js +22 -0
  126. package/dist/services/a2a/index.d.ts +9 -5
  127. package/dist/services/a2a/index.js +8 -5
  128. package/dist/services/a2a/managers.d.ts +23 -0
  129. package/dist/services/a2a/managers.js +101 -0
  130. package/dist/services/a2a/messenger.d.ts +35 -0
  131. package/dist/services/{core/managers/command.js → a2a/messenger.js} +27 -31
  132. package/dist/services/a2a/service.d.ts +45 -372
  133. package/dist/services/a2a/service.js +232 -84
  134. package/dist/services/a2a/state-machine.d.ts +18 -0
  135. package/dist/services/a2a/state-machine.js +78 -0
  136. package/dist/services/a2a/streams.d.ts +22 -0
  137. package/dist/services/a2a/streams.js +98 -0
  138. package/dist/services/core/index.d.ts +1 -2
  139. package/dist/services/core/index.js +1 -2
  140. package/dist/services/core/manager.d.ts +15 -0
  141. package/dist/services/core/manager.js +42 -0
  142. package/dist/services/mcp/service.d.ts +11 -15
  143. package/dist/services/mcp/service.js +16 -15
  144. package/dist/transport/index.d.ts +0 -1
  145. package/dist/transport/index.js +1 -1
  146. package/dist/transport/rpc/parser.d.ts +2 -2
  147. package/dist/transport/rpc/parser.js +7 -6
  148. package/dist/transport/rpc/rpc-client.d.ts +5 -5
  149. package/dist/transport/rpc/rpc-client.js +6 -6
  150. package/dist/transport/streaming/event-stream.d.ts +3 -3
  151. package/dist/transport/streaming/event-stream.js +11 -10
  152. package/dist/transport/trpc/a2a/factory/router.d.ts +479 -871
  153. package/dist/transport/trpc/a2a/factory/router.js +2 -2
  154. package/dist/transport/trpc/a2a/routes/info.d.ts +108 -8
  155. package/dist/transport/trpc/a2a/routes/info.js +6 -2
  156. package/dist/transport/trpc/a2a/routes/message/route.d.ts +113 -162
  157. package/dist/transport/trpc/a2a/routes/message/route.js +7 -13
  158. package/dist/transport/trpc/a2a/routes/tasks/route.d.ts +114 -212
  159. package/dist/transport/trpc/a2a/routes/tasks/route.js +16 -19
  160. package/dist/transport/trpc/a2a/trpc.d.ts +9 -253
  161. package/dist/types/a2a/a2a.d.ts +382 -0
  162. package/dist/types/a2a/a2a.js +14 -0
  163. package/dist/types/a2a/index.d.ts +5 -0
  164. package/dist/types/a2a/index.js +1 -0
  165. package/dist/types/{interfaces/client.d.ts → client.d.ts} +25 -27
  166. package/dist/types/core/core.d.ts +31 -0
  167. package/dist/types/core/core.js +1 -0
  168. package/dist/types/core/index.d.ts +1 -0
  169. package/dist/types/core/index.js +1 -0
  170. package/dist/types/index.d.ts +6 -3
  171. package/dist/types/index.js +6 -3
  172. package/dist/types/mcp/index.d.ts +1 -0
  173. package/dist/types/mcp/index.js +1 -0
  174. package/dist/{browser/types/interfaces/services/mcp/service.d.ts → types/mcp/mcp.d.ts} +4 -3
  175. package/dist/{browser/types/interfaces/services/a2a/context.js → types/mcp/mcp.js} +1 -1
  176. package/dist/types/storage.d.ts +21 -0
  177. package/dist/utils/common/constants.d.ts +2 -7
  178. package/dist/utils/common/constants.js +5 -32
  179. package/dist/utils/common/errors.d.ts +74 -18
  180. package/dist/utils/common/errors.js +81 -28
  181. package/dist/utils/common/parse.d.ts +7 -0
  182. package/dist/utils/common/parse.js +14 -0
  183. package/dist/utils/common/schema-validation.d.ts +2 -2
  184. package/dist/utils/common/schema-validation.js +7 -7
  185. package/dist/utils/common/utils.d.ts +23 -0
  186. package/dist/utils/common/utils.js +32 -0
  187. package/dist/utils/common/zAsyncIterable-v3.d.ts +1 -1
  188. package/dist/utils/common/zAsyncIterable-v3.js +2 -1
  189. package/dist/utils/index.d.ts +2 -3
  190. package/dist/utils/index.js +2 -3
  191. package/dist/utils/storage/file.d.ts +8 -17
  192. package/dist/utils/storage/file.js +44 -73
  193. package/package.json +76 -13
  194. package/dist/browser/services/a2a/helpers/message-builder.d.ts +0 -12
  195. package/dist/browser/services/a2a/helpers/message-builder.js +0 -61
  196. package/dist/browser/types/ext.d.ts +0 -13
  197. package/dist/browser/types/ext.js +0 -10
  198. package/dist/browser/types/interfaces/index.d.ts +0 -3
  199. package/dist/browser/types/interfaces/index.js +0 -3
  200. package/dist/browser/types/interfaces/services/a2a/builder.d.ts +0 -37
  201. package/dist/browser/types/interfaces/services/a2a/context.d.ts +0 -162
  202. package/dist/browser/types/interfaces/services/a2a/engine.d.ts +0 -7
  203. package/dist/browser/types/interfaces/services/a2a/engine.js +0 -5
  204. package/dist/browser/types/interfaces/services/a2a/index.d.ts +0 -5
  205. package/dist/browser/types/interfaces/services/a2a/index.js +0 -5
  206. package/dist/browser/types/interfaces/services/a2a/legacy.d.ts +0 -93
  207. package/dist/browser/types/interfaces/services/a2a/legacy.js +0 -5
  208. package/dist/browser/types/interfaces/services/a2a/service.d.ts +0 -413
  209. package/dist/browser/types/interfaces/services/a2a/service.js +0 -5
  210. package/dist/browser/types/interfaces/services/core/context/command.d.ts +0 -25
  211. package/dist/browser/types/interfaces/services/core/context/command.js +0 -5
  212. package/dist/browser/types/interfaces/services/core/context/context.d.ts +0 -207
  213. package/dist/browser/types/interfaces/services/core/context/context.js +0 -5
  214. package/dist/browser/types/interfaces/services/core/context/index.d.ts +0 -3
  215. package/dist/browser/types/interfaces/services/core/context/index.js +0 -3
  216. package/dist/browser/types/interfaces/services/core/context/types.d.ts +0 -11
  217. package/dist/browser/types/interfaces/services/core/context/types.js +0 -5
  218. package/dist/browser/types/interfaces/services/core/execution/engine.d.ts +0 -106
  219. package/dist/browser/types/interfaces/services/core/execution/engine.js +0 -5
  220. package/dist/browser/types/interfaces/services/core/execution/environment.d.ts +0 -11
  221. package/dist/browser/types/interfaces/services/core/execution/environment.js +0 -5
  222. package/dist/browser/types/interfaces/services/core/execution/execute.d.ts +0 -7
  223. package/dist/browser/types/interfaces/services/core/execution/execute.js +0 -5
  224. package/dist/browser/types/interfaces/services/core/execution/index.d.ts +0 -3
  225. package/dist/browser/types/interfaces/services/core/execution/index.js +0 -3
  226. package/dist/browser/types/interfaces/services/core/index.d.ts +0 -4
  227. package/dist/browser/types/interfaces/services/core/index.js +0 -4
  228. package/dist/browser/types/interfaces/services/core/managers/cancellation.d.ts +0 -9
  229. package/dist/browser/types/interfaces/services/core/managers/cancellation.js +0 -5
  230. package/dist/browser/types/interfaces/services/core/managers/connection.d.ts +0 -9
  231. package/dist/browser/types/interfaces/services/core/managers/connection.js +0 -5
  232. package/dist/browser/types/interfaces/services/core/managers/context.d.ts +0 -17
  233. package/dist/browser/types/interfaces/services/core/managers/context.js +0 -5
  234. package/dist/browser/types/interfaces/services/core/managers/event.d.ts +0 -328
  235. package/dist/browser/types/interfaces/services/core/managers/event.js +0 -5
  236. package/dist/browser/types/interfaces/services/core/managers/index.d.ts +0 -6
  237. package/dist/browser/types/interfaces/services/core/managers/index.js +0 -6
  238. package/dist/browser/types/interfaces/services/core/managers/stream.d.ts +0 -217
  239. package/dist/browser/types/interfaces/services/core/managers/stream.js +0 -5
  240. package/dist/browser/types/interfaces/services/core/managers/task.d.ts +0 -9
  241. package/dist/browser/types/interfaces/services/core/service.d.ts +0 -115
  242. package/dist/browser/types/interfaces/services/core/service.js +0 -5
  243. package/dist/browser/types/interfaces/services/index.d.ts +0 -4
  244. package/dist/browser/types/interfaces/services/index.js +0 -4
  245. package/dist/browser/types/interfaces/services/mcp/index.d.ts +0 -1
  246. package/dist/browser/types/interfaces/services/mcp/index.js +0 -1
  247. package/dist/browser/types/interfaces/services/mcp/service.js +0 -5
  248. package/dist/browser/types/interfaces/storage.d.ts +0 -8
  249. package/dist/browser/types/schemas/a2a/agent.d.ts +0 -2583
  250. package/dist/browser/types/schemas/a2a/agent.js +0 -323
  251. package/dist/browser/types/schemas/a2a/auth.d.ts +0 -908
  252. package/dist/browser/types/schemas/a2a/auth.js +0 -283
  253. package/dist/browser/types/schemas/a2a/error.d.ts +0 -396
  254. package/dist/browser/types/schemas/a2a/error.js +0 -163
  255. package/dist/browser/types/schemas/a2a/index.d.ts +0 -11
  256. package/dist/browser/types/schemas/a2a/index.js +0 -11
  257. package/dist/browser/types/schemas/a2a/kind.d.ts +0 -11
  258. package/dist/browser/types/schemas/a2a/kind.js +0 -20
  259. package/dist/browser/types/schemas/a2a/message.d.ts +0 -10343
  260. package/dist/browser/types/schemas/a2a/message.js +0 -130
  261. package/dist/browser/types/schemas/a2a/notification.d.ts +0 -1517
  262. package/dist/browser/types/schemas/a2a/notification.js +0 -203
  263. package/dist/browser/types/schemas/a2a/parameters.d.ts +0 -956
  264. package/dist/browser/types/schemas/a2a/parameters.js +0 -241
  265. package/dist/browser/types/schemas/a2a/protocol.d.ts +0 -14363
  266. package/dist/browser/types/schemas/a2a/protocol.js +0 -59
  267. package/dist/browser/types/schemas/a2a/rpc.d.ts +0 -182
  268. package/dist/browser/types/schemas/a2a/rpc.js +0 -126
  269. package/dist/browser/types/schemas/a2a/task.d.ts +0 -5886
  270. package/dist/browser/types/schemas/a2a/task.js +0 -134
  271. package/dist/browser/types/schemas/a2a/transport.d.ts +0 -31
  272. package/dist/browser/types/schemas/a2a/transport.js +0 -28
  273. package/dist/browser/types/schemas/index.d.ts +0 -1
  274. package/dist/browser/types/schemas/index.js +0 -1
  275. package/dist/browser/utils/logging/index.d.ts +0 -2
  276. package/dist/browser/utils/logging/index.js +0 -2
  277. package/dist/browser/utils/logging/log.d.ts +0 -33
  278. package/dist/browser/utils/logging/log.js +0 -75
  279. package/dist/browser/utils/logging/logger.d.ts +0 -18
  280. package/dist/browser/utils/logging/logger.js +0 -18
  281. package/dist/services/a2a/factory/builder.d.ts +0 -351
  282. package/dist/services/a2a/factory/builder.js +0 -365
  283. package/dist/services/a2a/factory/event.d.ts +0 -58
  284. package/dist/services/a2a/factory/event.js +0 -177
  285. package/dist/services/a2a/factory/method.d.ts +0 -6
  286. package/dist/services/a2a/factory/method.js +0 -14
  287. package/dist/services/a2a/helpers/agentcard-builder.d.ts +0 -7
  288. package/dist/services/a2a/helpers/agentcard-builder.js +0 -23
  289. package/dist/services/a2a/helpers/message-builder.d.ts +0 -12
  290. package/dist/services/a2a/helpers/message-builder.js +0 -61
  291. package/dist/services/a2a/managers/cancellation.d.ts +0 -11
  292. package/dist/services/a2a/managers/cancellation.js +0 -16
  293. package/dist/services/a2a/managers/connection.d.ts +0 -11
  294. package/dist/services/a2a/managers/connection.js +0 -16
  295. package/dist/services/a2a/managers/context.d.ts +0 -11
  296. package/dist/services/a2a/managers/context.js +0 -16
  297. package/dist/services/a2a/managers/index.d.ts +0 -5
  298. package/dist/services/a2a/managers/index.js +0 -5
  299. package/dist/services/a2a/managers/task.d.ts +0 -11
  300. package/dist/services/a2a/managers/task.js +0 -16
  301. package/dist/services/a2a/methods/cancel-task.d.ts +0 -7
  302. package/dist/services/a2a/methods/cancel-task.js +0 -43
  303. package/dist/services/a2a/methods/get-task.d.ts +0 -112
  304. package/dist/services/a2a/methods/get-task.js +0 -16
  305. package/dist/services/a2a/methods/resubscribe-task.d.ts +0 -7
  306. package/dist/services/a2a/methods/resubscribe-task.js +0 -80
  307. package/dist/services/a2a/methods/send-message.d.ts +0 -7
  308. package/dist/services/a2a/methods/send-message.js +0 -36
  309. package/dist/services/a2a/methods/stream-message.d.ts +0 -8
  310. package/dist/services/a2a/methods/stream-message.js +0 -21
  311. package/dist/services/a2a/state/index.d.ts +0 -3
  312. package/dist/services/a2a/state/index.js +0 -3
  313. package/dist/services/a2a/state/load.d.ts +0 -14
  314. package/dist/services/a2a/state/load.js +0 -71
  315. package/dist/services/a2a/state/process.d.ts +0 -7
  316. package/dist/services/a2a/state/process.js +0 -13
  317. package/dist/services/a2a/state/update/artifact.d.ts +0 -10
  318. package/dist/services/a2a/state/update/artifact.js +0 -39
  319. package/dist/services/a2a/state/update/index.d.ts +0 -2
  320. package/dist/services/a2a/state/update/index.js +0 -2
  321. package/dist/services/a2a/state/update/update.d.ts +0 -23
  322. package/dist/services/a2a/state/update/update.js +0 -123
  323. package/dist/services/core/execution/execute.d.ts +0 -6
  324. package/dist/services/core/execution/execute.js +0 -25
  325. package/dist/services/core/execution/index.d.ts +0 -1
  326. package/dist/services/core/execution/index.js +0 -1
  327. package/dist/services/core/managers/command.d.ts +0 -39
  328. package/dist/services/core/managers/event.d.ts +0 -18
  329. package/dist/services/core/managers/event.js +0 -56
  330. package/dist/services/core/managers/index.d.ts +0 -3
  331. package/dist/services/core/managers/index.js +0 -3
  332. package/dist/services/core/managers/stream.d.ts +0 -20
  333. package/dist/services/core/managers/stream.js +0 -77
  334. package/dist/types/ext.d.ts +0 -13
  335. package/dist/types/ext.js +0 -10
  336. package/dist/types/interfaces/index.d.ts +0 -3
  337. package/dist/types/interfaces/index.js +0 -3
  338. package/dist/types/interfaces/services/a2a/builder.d.ts +0 -37
  339. package/dist/types/interfaces/services/a2a/builder.js +0 -5
  340. package/dist/types/interfaces/services/a2a/context.d.ts +0 -162
  341. package/dist/types/interfaces/services/a2a/context.js +0 -5
  342. package/dist/types/interfaces/services/a2a/engine.d.ts +0 -7
  343. package/dist/types/interfaces/services/a2a/engine.js +0 -5
  344. package/dist/types/interfaces/services/a2a/index.d.ts +0 -5
  345. package/dist/types/interfaces/services/a2a/index.js +0 -5
  346. package/dist/types/interfaces/services/a2a/legacy.d.ts +0 -93
  347. package/dist/types/interfaces/services/a2a/legacy.js +0 -5
  348. package/dist/types/interfaces/services/a2a/service.d.ts +0 -413
  349. package/dist/types/interfaces/services/a2a/service.js +0 -5
  350. package/dist/types/interfaces/services/core/context/command.d.ts +0 -25
  351. package/dist/types/interfaces/services/core/context/command.js +0 -5
  352. package/dist/types/interfaces/services/core/context/context.d.ts +0 -207
  353. package/dist/types/interfaces/services/core/context/context.js +0 -5
  354. package/dist/types/interfaces/services/core/context/index.d.ts +0 -3
  355. package/dist/types/interfaces/services/core/context/index.js +0 -3
  356. package/dist/types/interfaces/services/core/context/types.d.ts +0 -11
  357. package/dist/types/interfaces/services/core/context/types.js +0 -5
  358. package/dist/types/interfaces/services/core/execution/engine.d.ts +0 -106
  359. package/dist/types/interfaces/services/core/execution/engine.js +0 -5
  360. package/dist/types/interfaces/services/core/execution/environment.d.ts +0 -11
  361. package/dist/types/interfaces/services/core/execution/environment.js +0 -5
  362. package/dist/types/interfaces/services/core/execution/execute.d.ts +0 -7
  363. package/dist/types/interfaces/services/core/execution/execute.js +0 -5
  364. package/dist/types/interfaces/services/core/execution/index.d.ts +0 -3
  365. package/dist/types/interfaces/services/core/execution/index.js +0 -3
  366. package/dist/types/interfaces/services/core/index.d.ts +0 -4
  367. package/dist/types/interfaces/services/core/index.js +0 -4
  368. package/dist/types/interfaces/services/core/managers/cancellation.d.ts +0 -9
  369. package/dist/types/interfaces/services/core/managers/cancellation.js +0 -5
  370. package/dist/types/interfaces/services/core/managers/connection.d.ts +0 -9
  371. package/dist/types/interfaces/services/core/managers/connection.js +0 -5
  372. package/dist/types/interfaces/services/core/managers/context.d.ts +0 -17
  373. package/dist/types/interfaces/services/core/managers/context.js +0 -5
  374. package/dist/types/interfaces/services/core/managers/event.d.ts +0 -328
  375. package/dist/types/interfaces/services/core/managers/event.js +0 -5
  376. package/dist/types/interfaces/services/core/managers/index.d.ts +0 -6
  377. package/dist/types/interfaces/services/core/managers/index.js +0 -6
  378. package/dist/types/interfaces/services/core/managers/stream.d.ts +0 -217
  379. package/dist/types/interfaces/services/core/managers/stream.js +0 -5
  380. package/dist/types/interfaces/services/core/managers/task.d.ts +0 -9
  381. package/dist/types/interfaces/services/core/service.d.ts +0 -115
  382. package/dist/types/interfaces/services/core/service.js +0 -5
  383. package/dist/types/interfaces/services/index.d.ts +0 -4
  384. package/dist/types/interfaces/services/index.js +0 -4
  385. package/dist/types/interfaces/services/mcp/index.d.ts +0 -1
  386. package/dist/types/interfaces/services/mcp/index.js +0 -1
  387. package/dist/types/interfaces/services/mcp/service.js +0 -5
  388. package/dist/types/interfaces/storage.d.ts +0 -8
  389. package/dist/types/schemas/a2a/agent.d.ts +0 -2583
  390. package/dist/types/schemas/a2a/agent.js +0 -323
  391. package/dist/types/schemas/a2a/auth.d.ts +0 -908
  392. package/dist/types/schemas/a2a/auth.js +0 -283
  393. package/dist/types/schemas/a2a/error.d.ts +0 -396
  394. package/dist/types/schemas/a2a/error.js +0 -163
  395. package/dist/types/schemas/a2a/index.d.ts +0 -11
  396. package/dist/types/schemas/a2a/index.js +0 -11
  397. package/dist/types/schemas/a2a/kind.d.ts +0 -11
  398. package/dist/types/schemas/a2a/kind.js +0 -20
  399. package/dist/types/schemas/a2a/message.d.ts +0 -10343
  400. package/dist/types/schemas/a2a/message.js +0 -130
  401. package/dist/types/schemas/a2a/notification.d.ts +0 -1517
  402. package/dist/types/schemas/a2a/notification.js +0 -203
  403. package/dist/types/schemas/a2a/parameters.d.ts +0 -956
  404. package/dist/types/schemas/a2a/parameters.js +0 -241
  405. package/dist/types/schemas/a2a/protocol.d.ts +0 -14363
  406. package/dist/types/schemas/a2a/protocol.js +0 -59
  407. package/dist/types/schemas/a2a/rpc.d.ts +0 -182
  408. package/dist/types/schemas/a2a/rpc.js +0 -126
  409. package/dist/types/schemas/a2a/task.d.ts +0 -5886
  410. package/dist/types/schemas/a2a/task.js +0 -134
  411. package/dist/types/schemas/a2a/transport.d.ts +0 -31
  412. package/dist/types/schemas/a2a/transport.js +0 -28
  413. package/dist/types/schemas/index.d.ts +0 -1
  414. package/dist/types/schemas/index.js +0 -1
  415. package/dist/utils/logging/index.d.ts +0 -2
  416. package/dist/utils/logging/index.js +0 -2
  417. package/dist/utils/logging/log.d.ts +0 -33
  418. package/dist/utils/logging/log.js +0 -75
  419. package/dist/utils/logging/logger.d.ts +0 -18
  420. package/dist/utils/logging/logger.js +0 -18
  421. package/dist/utils/storage/memory.d.ts +0 -25
  422. package/dist/utils/storage/memory.js +0 -47
  423. /package/dist/browser/{types/interfaces/services/core/managers/task.js → create/base.js} +0 -0
  424. /package/dist/browser/types/{interfaces/client.js → client.js} +0 -0
  425. /package/dist/{types/interfaces/services/core/managers/task.js → browser/types/core/core.js} +0 -0
  426. /package/dist/browser/types/{interfaces/services/protocol.d.ts → protocol.d.ts} +0 -0
  427. /package/dist/browser/types/{interfaces/services/protocol.js → protocol.js} +0 -0
  428. /package/dist/browser/types/{interfaces/storage.js → storage.js} +0 -0
  429. /package/dist/services/a2a/{methods → handlers}/index.d.ts +0 -0
  430. /package/dist/services/a2a/{methods → handlers}/index.js +0 -0
  431. /package/dist/types/{interfaces/client.js → client.js} +0 -0
  432. /package/dist/types/{interfaces/services/protocol.d.ts → protocol.d.ts} +0 -0
  433. /package/dist/types/{interfaces/services/protocol.js → protocol.js} +0 -0
  434. /package/dist/types/{interfaces/storage.js → storage.js} +0 -0
@@ -1,328 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- /**
6
- * @fileoverview Core Event Manager Interface Definitions
7
- *
8
- * This module defines interfaces for managing events throughout the execution lifecycle
9
- * of core services. It provides type-safe event handling, lifecycle management, and
10
- * state transitions for command execution contexts.
11
- *
12
- * @module CoreEventManager
13
- * @version 0.5.7
14
- * @since 0.5.6
15
- * @author The Artinet Project
16
- */
17
- import { EventEmitter } from "events";
18
- import { CoreCommand, CoreState, CoreUpdate, CoreContext } from "../context/index.js";
19
- /**
20
- * Configuration options for EventManager lifecycle callbacks.
21
- *
22
- * This interface defines optional callback functions that are invoked during
23
- * different phases of command execution, providing hooks for custom logic
24
- * and state management throughout the execution lifecycle.
25
- *
26
- * @template TCommand - The command type, must extend CoreCommand
27
- * @template TState - The state type, must extend CoreState
28
- * @template TUpdate - The update type, must extend CoreUpdate
29
- *
30
- * @example
31
- * ```typescript
32
- * const eventOptions: EventManagerOptions<MyCommand, MyState, MyUpdate> = {
33
- * onStart: async (context) => {
34
- * console.log('Execution started for context:', context.contextId);
35
- * return initialState;
36
- * },
37
- * onUpdate: async (current, update) => {
38
- * console.log('Processing update:', update);
39
- * return { ...current, lastUpdate: update };
40
- * },
41
- * onComplete: async (finalState) => {
42
- * console.log('Execution completed successfully');
43
- * }
44
- * };
45
- * ```
46
- *
47
- * @public
48
- * @since 0.5.6
49
- */
50
- export interface EventManagerOptions<TCommand extends CoreCommand = CoreCommand, TState extends CoreState = CoreState, TUpdate extends CoreUpdate = CoreUpdate> {
51
- /**
52
- * Called when execution starts for a new context.
53
- *
54
- * This callback is invoked at the beginning of command execution,
55
- * allowing for initialization of state and setup of execution context.
56
- *
57
- * @param context - The execution context containing command and environment data
58
- * @returns Promise resolving to the initial state for this execution
59
- *
60
- * @example
61
- * ```typescript
62
- * onStart: async (context) => {
63
- * const userId = context.command.metadata?.userId;
64
- * return {
65
- * userId,
66
- * startTime: new Date(),
67
- * status: 'initializing'
68
- * };
69
- * }
70
- * ```
71
- */
72
- readonly onStart?: (context: CoreContext<TCommand, TState, TUpdate>) => Promise<TState>;
73
- /**
74
- * Called when execution is cancelled.
75
- *
76
- * This callback handles cleanup and state updates when an execution
77
- * is cancelled before completion, ensuring proper resource cleanup.
78
- *
79
- * @param current - The current state at the time of cancellation
80
- * @param update - The update that triggered the cancellation
81
- * @returns Promise that resolves when cancellation handling is complete
82
- *
83
- * @example
84
- * ```typescript
85
- * onCancel: async (current, update) => {
86
- * await cleanupResources(current.resourceIds);
87
- * await logCancellation(current.userId, update.reason);
88
- * }
89
- * ```
90
- */
91
- readonly onCancel?: (current: TState, update: TUpdate) => Promise<void>;
92
- /**
93
- * Called for each update during execution.
94
- *
95
- * This is the primary callback for processing updates and evolving state
96
- * throughout the execution lifecycle. It receives the current state and
97
- * an update, returning the new state.
98
- *
99
- * @param current - The current state before applying the update
100
- * @param update - The update to be processed
101
- * @returns Promise resolving to the new state after applying the update
102
- *
103
- * @example
104
- * ```typescript
105
- * onUpdate: async (current, update) => {
106
- * switch (update.type) {
107
- * case 'progress':
108
- * return { ...current, progress: update.progress };
109
- * case 'data':
110
- * return { ...current, data: [...current.data, update.data] };
111
- * default:
112
- * return current;
113
- * }
114
- * }
115
- * ```
116
- */
117
- readonly onUpdate?: (current: TState, update: TUpdate) => Promise<TState>;
118
- /**
119
- * Called when an error occurs during execution.
120
- *
121
- * This callback handles error scenarios, allowing for custom error processing,
122
- * logging, and recovery strategies.
123
- *
124
- * @param current - The current state when the error occurred
125
- * @param error - The error that occurred (can be any type)
126
- * @returns Promise that resolves when error handling is complete
127
- *
128
- * @example
129
- * ```typescript
130
- * onError: async (current, error) => {
131
- * console.error('Execution error:', error);
132
- * await notifyAdministrators(error, current);
133
- * await saveErrorLog(current.contextId, error);
134
- * }
135
- * ```
136
- */
137
- readonly onError?: (current: TState, error: any) => Promise<void>;
138
- /**
139
- * Called when execution completes successfully.
140
- *
141
- * This callback is invoked upon successful completion of command execution,
142
- * allowing for cleanup, final state processing, and completion notifications.
143
- *
144
- * @param current - The final state after successful completion
145
- * @returns Promise that resolves when completion handling is done
146
- *
147
- * @example
148
- * ```typescript
149
- * onComplete: async (finalState) => {
150
- * await saveResults(finalState.results);
151
- * await notifyCompletion(finalState.userId);
152
- * await cleanupTemporaryResources();
153
- * }
154
- * ```
155
- */
156
- readonly onComplete?: (current: TState) => Promise<void>;
157
- /**
158
- * Optional state getter function.
159
- *
160
- * @deprecated This property may be removed in future versions.
161
- * Use the EventManagerInterface.getState method instead.
162
- *
163
- * @returns The current state
164
- */
165
- readonly getState?: () => TState;
166
- }
167
- /**
168
- * Event map defining the structure of events emitted by EventManager.
169
- *
170
- * This interface maps event names to their corresponding argument tuples,
171
- * providing type safety for event emission and subscription.
172
- *
173
- * @template TCommand - The command type, must extend CoreCommand
174
- * @template TState - The state type, must extend CoreState
175
- * @template TUpdate - The update type, must extend CoreUpdate
176
- *
177
- * @example
178
- * ```typescript
179
- * // Event manager will emit these events with the specified argument types
180
- * eventManager.on('start', (command: TCommand, state: TState) => {
181
- * console.log('Execution started');
182
- * });
183
- *
184
- * eventManager.on('update', (state: TState, update: TUpdate) => {
185
- * console.log('State updated');
186
- * });
187
- * ```
188
- *
189
- * @public
190
- * @since 0.5.6
191
- */
192
- export interface EventManagerMap<TCommand extends CoreCommand = CoreCommand, TState extends CoreState = CoreState, TUpdate extends CoreUpdate = CoreUpdate> {
193
- /** Emitted when execution starts - [command, initialState] */
194
- start: [TCommand, TState];
195
- /** Emitted when execution is cancelled - [cancelUpdate] */
196
- cancel: [TUpdate];
197
- /** Emitted when state is updated - [currentState, update] */
198
- update: [TState, TUpdate];
199
- /** Emitted when an error occurs - [error, currentState] */
200
- error: [any, TState];
201
- /** Emitted when execution completes - [finalState] */
202
- complete: [TState];
203
- }
204
- /**
205
- * Main interface for EventManager implementations.
206
- *
207
- * This interface extends EventEmitter to provide typed event handling
208
- * and defines the contract for managing execution lifecycle events.
209
- * Implementations must handle state transitions, error scenarios, and
210
- * provide access to current execution state.
211
- *
212
- * @template TCommand - The command type, must extend CoreCommand
213
- * @template TState - The state type, must extend CoreState
214
- * @template TUpdate - The update type, must extend CoreUpdate
215
- *
216
- * @example
217
- * ```typescript
218
- * class MyEventManager implements EventManagerInterface<MyCommand, MyState, MyUpdate> {
219
- * constructor(
220
- * public readonly contextId: string,
221
- * private options: EventManagerOptions<MyCommand, MyState, MyUpdate>
222
- * ) {
223
- * super();
224
- * }
225
- *
226
- * async onUpdate(update: MyUpdate): Promise<MyState> {
227
- * const current = this.getState();
228
- * const newState = await this.options.onUpdate?.(current, update) ?? current;
229
- * this.emit('update', newState, update);
230
- * return newState;
231
- * }
232
- *
233
- * // ... other method implementations
234
- * }
235
- * ```
236
- *
237
- * @public
238
- * @since 0.5.6
239
- */
240
- export interface EventManagerInterface<TCommand extends CoreCommand = CoreCommand, TState extends CoreState = CoreState, TUpdate extends CoreUpdate = CoreUpdate> extends EventEmitter<EventManagerMap<TCommand, TState, TUpdate>> {
241
- /**
242
- * Unique identifier for this execution context.
243
- *
244
- * This ID is used to track and manage the specific execution instance
245
- * throughout its lifecycle.
246
- */
247
- readonly contextId: string;
248
- /**
249
- * Optional callback for handling execution start.
250
- *
251
- * When present, this function is called to initialize state for a new execution.
252
- *
253
- * @param context - The execution context
254
- * @returns Promise resolving to initial state
255
- */
256
- readonly onStart?: (context: CoreContext<TCommand, TState, TUpdate>) => Promise<TState>;
257
- /**
258
- * Handles execution cancellation.
259
- *
260
- * This method processes cancellation requests and performs necessary cleanup.
261
- *
262
- * @param update - The update that triggered cancellation
263
- * @returns Promise that resolves when cancellation is complete
264
- *
265
- * @example
266
- * ```typescript
267
- * await eventManager.onCancel(cancellationUpdate);
268
- * ```
269
- */
270
- readonly onCancel: (update: TUpdate) => Promise<void>;
271
- /**
272
- * Processes state updates during execution.
273
- *
274
- * This is the primary method for handling state evolution throughout
275
- * the execution lifecycle.
276
- *
277
- * @param update - The update to process
278
- * @returns Promise resolving to the new state
279
- *
280
- * @example
281
- * ```typescript
282
- * const newState = await eventManager.onUpdate(progressUpdate);
283
- * ```
284
- */
285
- readonly onUpdate: (update: TUpdate) => Promise<TState>;
286
- /**
287
- * Handles errors that occur during execution.
288
- *
289
- * This method processes error scenarios and performs error recovery logic.
290
- *
291
- * @param error - The error that occurred
292
- * @returns Promise that resolves when error handling is complete
293
- *
294
- * @example
295
- * ```typescript
296
- * await eventManager.onError(new Error('Something went wrong'));
297
- * ```
298
- */
299
- readonly onError: (error: any) => Promise<void>;
300
- /**
301
- * Handles successful completion of execution.
302
- *
303
- * This method is called when execution completes successfully and
304
- * performs final cleanup and notification tasks.
305
- *
306
- * @returns Promise that resolves when completion handling is done
307
- *
308
- * @example
309
- * ```typescript
310
- * await eventManager.onComplete();
311
- * ```
312
- */
313
- onComplete: () => Promise<void>;
314
- /**
315
- * Gets the current execution state.
316
- *
317
- * @deprecated This method may be removed in future versions.
318
- * Consider using state management through the context instead.
319
- *
320
- * @returns The current state
321
- *
322
- * @example
323
- * ```typescript
324
- * const currentState = eventManager.getState();
325
- * ```
326
- */
327
- readonly getState: () => TState;
328
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- export {};
@@ -1,6 +0,0 @@
1
- export * from "./cancellation.js";
2
- export * from "./connection.js";
3
- export * from "./context.js";
4
- export * from "./event.js";
5
- export * from "./stream.js";
6
- export * from "./task.js";
@@ -1,6 +0,0 @@
1
- export * from "./cancellation.js";
2
- export * from "./connection.js";
3
- export * from "./context.js";
4
- export * from "./event.js";
5
- export * from "./stream.js";
6
- export * from "./task.js";
@@ -1,217 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- /**
6
- * @fileoverview Core Stream Manager Interface Definition
7
- *
8
- * This module defines the interface for managing execution streams in the core service
9
- * framework. It provides functionality for handling async execution, update collection,
10
- * and streaming results from execution engines to consumers.
11
- *
12
- * @module CoreStreamManager
13
- * @version 0.5.7
14
- * @since 0.5.6
15
- * @author The Artinet Project
16
- */
17
- import { CoreCommand, CoreState, CoreUpdate } from "../../../../index.js";
18
- import { CoreContext } from "../context/index.js";
19
- import { ExecutionEngine } from "../execution/index.js";
20
- import { ServiceInterface } from "../service.js";
21
- /**
22
- * Interface for managing execution streams and update collection.
23
- *
24
- * The StreamManager is responsible for coordinating the execution of commands
25
- * through execution engines, collecting updates as they are produced, and
26
- * providing a streaming interface for consumers to receive real-time updates.
27
- *
28
- * This interface supports both push-based update collection and pull-based
29
- * streaming, making it suitable for various execution patterns including
30
- * long-running tasks, batch operations, and real-time processing.
31
- *
32
- * @template TCommand - The command type, must extend CoreCommand
33
- * @template TState - The state type, must extend CoreState
34
- * @template TUpdate - The update type, must extend CoreUpdate
35
- *
36
- * @example
37
- * ```typescript
38
- * class MyStreamManager implements StreamManagerInterface<MyCommand, MyState, MyUpdate> {
39
- * private updates: MyUpdate[] = [];
40
- * private completed = false;
41
- *
42
- * constructor(
43
- * private contextId: string,
44
- * private context: CoreContext<MyCommand, MyState, MyUpdate>
45
- * ) {}
46
- *
47
- * async *stream(engine: ExecutionEngine<MyCommand, MyState, MyUpdate>) {
48
- * for await (const update of engine(this.context)) {
49
- * this.addUpdate(update);
50
- * yield update;
51
- * }
52
- * this.setCompleted();
53
- * }
54
- *
55
- * // ... implement other interface methods
56
- * }
57
- * ```
58
- *
59
- * @public
60
- * @since 0.5.6
61
- */
62
- export interface StreamManagerInterface<TCommand extends CoreCommand = CoreCommand, TState extends CoreState = CoreState, TUpdate extends CoreUpdate = CoreUpdate> {
63
- /**
64
- * Gets the unique identifier for the execution context.
65
- *
66
- * This ID is used to track and correlate updates with their specific
67
- * execution instance across the system.
68
- *
69
- * @returns The context ID string
70
- *
71
- * @example
72
- * ```typescript
73
- * const contextId = streamManager.getContextId();
74
- * console.log(`Processing execution: ${contextId}`);
75
- * ```
76
- */
77
- getContextId(): string;
78
- /**
79
- * Adds an update to the internal update collection.
80
- *
81
- * This method is typically called by execution engines or other
82
- * components to record updates as they occur during execution.
83
- * Updates are stored in order and can be retrieved later.
84
- *
85
- * @param update - The update to add to the collection
86
- *
87
- * @example
88
- * ```typescript
89
- * const progressUpdate: MyUpdate = {
90
- * type: 'progress',
91
- * progress: 0.5,
92
- * message: 'Halfway complete'
93
- * };
94
- * streamManager.addUpdate(progressUpdate);
95
- * ```
96
- */
97
- addUpdate(update: TUpdate): void;
98
- /**
99
- * Retrieves all updates that have been collected so far.
100
- *
101
- * Returns a copy of the internal update collection, providing
102
- * access to the complete execution history up to this point.
103
- *
104
- * @returns Array of all collected updates in chronological order
105
- *
106
- * @example
107
- * ```typescript
108
- * const allUpdates = streamManager.getUpdates();
109
- * console.log(`Collected ${allUpdates.length} updates so far`);
110
- *
111
- * // Process updates
112
- * for (const update of allUpdates) {
113
- * processUpdate(update);
114
- * }
115
- * ```
116
- */
117
- getUpdates(): TUpdate[];
118
- /**
119
- * Checks whether the execution has completed.
120
- *
121
- * This flag indicates whether the execution engine has finished
122
- * processing and no more updates will be produced.
123
- *
124
- * @returns True if execution is complete, false if still running
125
- *
126
- * @example
127
- * ```typescript
128
- * if (streamManager.isCompleted()) {
129
- * console.log('Execution finished');
130
- * finalizeResults(streamManager.getUpdates());
131
- * } else {
132
- * console.log('Execution still in progress...');
133
- * }
134
- * ```
135
- */
136
- isCompleted(): boolean;
137
- /**
138
- * Marks the execution as completed.
139
- *
140
- * This method is called when the execution engine has finished
141
- * processing, indicating that no more updates will be produced.
142
- * It triggers any completion-related cleanup or finalization.
143
- *
144
- * @example
145
- * ```typescript
146
- * // Called by execution engine when done
147
- * await executeTask();
148
- * streamManager.setCompleted();
149
- * ```
150
- */
151
- setCompleted(): void;
152
- /**
153
- * Gets the current execution context.
154
- *
155
- * Returns the context object that contains command, state, and
156
- * execution environment information for this stream.
157
- *
158
- * @returns The execution context
159
- *
160
- * @example
161
- * ```typescript
162
- * const context = streamManager.getExecutionContext();
163
- * const command = context.command;
164
- * const currentState = context.State();
165
- * ```
166
- */
167
- getExecutionContext(): CoreContext<TCommand, TState, TUpdate>;
168
- /**
169
- * Sets or updates the execution context.
170
- *
171
- * This method allows updating the context during execution,
172
- * which may be necessary for dynamic execution scenarios.
173
- *
174
- * @param executionContext - The new execution context to set
175
- *
176
- * @example
177
- * ```typescript
178
- * const updatedContext = createNewContext(command, newState);
179
- * streamManager.setExecutionContext(updatedContext);
180
- * ```
181
- */
182
- setExecutionContext(executionContext: CoreContext<TCommand, TState, TUpdate>): void;
183
- /**
184
- * Creates an async generator stream for real-time update consumption.
185
- *
186
- * This is the primary method for executing commands and streaming results.
187
- * It runs the provided execution engine with the current context and
188
- * yields updates as they are produced, providing a real-time stream
189
- * of execution progress.
190
- *
191
- * @param engine - The execution engine to run
192
- * @param service - Optional service interface for additional functionality
193
- * @returns AsyncGenerator that yields updates as they occur
194
- *
195
- * @example
196
- * ```typescript
197
- * // Basic streaming
198
- * for await (const update of streamManager.stream(myEngine)) {
199
- * console.log('Received update:', update);
200
- * await processUpdate(update);
201
- * }
202
- *
203
- * // With service integration
204
- * const service = createMyService();
205
- * for await (const update of streamManager.stream(myEngine, service)) {
206
- * await service.handleUpdate(update);
207
- * yield update; // Re-yield to downstream consumers
208
- * }
209
- * ```
210
- *
211
- * @remarks
212
- * The stream will continue yielding updates until the execution engine
213
- * completes. The StreamManager automatically handles update collection
214
- * and completion status during streaming.
215
- */
216
- stream(engine: ExecutionEngine<TCommand, TState, TUpdate>, service?: ServiceInterface<TCommand, TState, TUpdate>): AsyncGenerator<TUpdate>;
217
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- export {};
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- export interface TaskManagerInterface<TaskType extends {} = {}> {
6
- getState(id: string): Promise<TaskType | undefined> | TaskType | undefined;
7
- setState(id: string, data: TaskType): Promise<void> | void;
8
- getStates(): Promise<string[]> | string[];
9
- }
@@ -1,115 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- /**
6
- * @fileoverview Core Service Interface Definition
7
- *
8
- * This module defines the fundamental service interface that all core services
9
- * must implement. It provides the contract for executing commands through
10
- * execution engines and managing service lifecycle.
11
- *
12
- * @module CoreService
13
- * @version 0.5.7
14
- * @since 0.5.6
15
- * @author The Artinet Project
16
- */
17
- import { CoreContext, CoreCommand, CoreState, CoreUpdate } from "./context/index.js";
18
- import { ExecutionEngine } from "./execution/index.js";
19
- /**
20
- * Core service interface defining the contract for all service implementations.
21
- *
22
- * Services are responsible for orchestrating command execution through execution
23
- * engines, managing the execution lifecycle, and providing a consistent interface
24
- * for starting and stopping operations. This interface serves as the foundation
25
- * for all service types in the core framework.
26
- *
27
- * The service acts as a coordinator between execution engines and the broader
28
- * system, handling concerns like resource management, execution tracking, and
29
- * graceful shutdown while delegating the actual command processing to engines.
30
- *
31
- * @public
32
- * @since 0.5.6
33
- */
34
- export interface ServiceInterface<TCommand extends CoreCommand = CoreCommand, TState extends CoreState = CoreState, TUpdate extends CoreUpdate = CoreUpdate> {
35
- /**
36
- * Executes a command using the provided execution engine and context.
37
- *
38
- * This is the primary method for processing commands. The service receives
39
- * an execution engine (which defines how to process the command) and a
40
- * context (which contains the command, state, and execution environment).
41
- *
42
- * The service is responsible for:
43
- * - Coordinating the execution process
44
- * - Managing resources during execution
45
- * - Handling the stream of updates from the engine
46
- * - Ensuring proper cleanup on completion or failure
47
- *
48
- * @param engine - The execution engine that will process the command
49
- * @param context - The execution context containing command and environment
50
- * @returns Promise that resolves when execution is complete
51
- *
52
- * @throws Should handle and wrap any execution errors appropriately
53
- *
54
- * @example
55
- * ```typescript
56
- * // Basic execution
57
- * await service.execute(myEngine, executionContext);
58
- *
59
- * // With error handling
60
- * try {
61
- * await service.execute(myEngine, executionContext);
62
- * } catch (error) {
63
- * console.error('Execution failed:', error);
64
- * await handleExecutionError(error, executionContext);
65
- * }
66
- * ```
67
- *
68
- * @example
69
- * ```typescript
70
- * // Service implementation with update handling
71
- * async execute(engine, context) {
72
- * const updates: TUpdate[] = [];
73
- *
74
- * try {
75
- * for await (const update of engine(context)) {
76
- * updates.push(update);
77
- * await this.notifySubscribers(update);
78
- *
79
- * if (context.isCancelled()) {
80
- * console.log('Execution cancelled');
81
- * break;
82
- * }
83
- * }
84
- * } catch (error) {
85
- * await this.handleExecutionError(error, context);
86
- * throw error;
87
- * }
88
- *
89
- * console.log(`Execution completed with ${updates.length} updates`);
90
- * }
91
- * ```
92
- */
93
- execute: (engine: ExecutionEngine<TCommand, TState, TUpdate>, context: CoreContext<TCommand, TState, TUpdate>) => Promise<void>;
94
- /**
95
- * Stops the service and performs cleanup operations.
96
- *
97
- * This method is called to gracefully shut down the service, ensuring that
98
- * all active executions are properly terminated and resources are cleaned up.
99
- * Implementation should handle stopping active executions, releasing resources,
100
- * and preparing for service shutdown.
101
- *
102
- * The stop method should be idempotent - calling it multiple times should
103
- * not cause errors or unexpected behavior.
104
- *
105
- * @returns Promise that resolves when the service has been stopped and cleaned up
106
- *
107
- * @example
108
- * ```typescript
109
- * // Graceful shutdown
110
- * await service.stop();
111
- * console.log('Service stopped successfully');
112
- * ```
113
- */
114
- stop: () => Promise<void>;
115
- }