@artinet/sdk 0.5.18 → 0.6.0-preview.1

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 (399) 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 +18 -6
  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/services/a2a/helpers/message-builder.d.ts +13 -8
  11. package/dist/browser/services/a2a/helpers/message-builder.js +5 -0
  12. package/dist/browser/transport/rpc/parser.d.ts +2 -2
  13. package/dist/browser/transport/rpc/parser.js +6 -6
  14. package/dist/browser/transport/rpc/rpc-client.d.ts +5 -5
  15. package/dist/browser/transport/rpc/rpc-client.js +6 -6
  16. package/dist/browser/transport/streaming/event-stream.d.ts +3 -3
  17. package/dist/browser/transport/streaming/event-stream.js +11 -10
  18. package/dist/browser/types/a2a/a2a.d.ts +378 -0
  19. package/dist/browser/types/a2a/a2a.js +14 -0
  20. package/dist/browser/types/a2a/builder.d.ts +43 -0
  21. package/dist/browser/types/a2a/index.d.ts +3 -0
  22. package/dist/browser/types/a2a/index.js +2 -0
  23. package/dist/{types/interfaces → browser/types}/client.d.ts +25 -27
  24. package/dist/browser/types/core/core.d.ts +31 -0
  25. package/dist/browser/types/core/index.d.ts +1 -0
  26. package/dist/browser/types/core/index.js +1 -0
  27. package/dist/browser/types/index.d.ts +6 -3
  28. package/dist/browser/types/index.js +6 -3
  29. package/dist/browser/types/mcp/index.d.ts +1 -0
  30. package/dist/browser/types/mcp/index.js +1 -0
  31. package/dist/browser/types/{interfaces/services/mcp/service.d.ts → mcp/mcp.d.ts} +4 -3
  32. package/dist/browser/types/{interfaces/services/a2a/context.js → mcp/mcp.js} +1 -1
  33. package/dist/browser/types/storage.d.ts +21 -0
  34. package/dist/browser/utils/common/constants.d.ts +7 -7
  35. package/dist/browser/utils/common/constants.js +9 -9
  36. package/dist/browser/utils/common/errors.d.ts +18 -18
  37. package/dist/browser/utils/common/errors.js +14 -14
  38. package/dist/browser/utils/common/utils.d.ts +23 -0
  39. package/dist/browser/utils/common/utils.js +32 -0
  40. package/dist/client/a2a-client.d.ts +19 -18
  41. package/dist/client/a2a-client.js +18 -6
  42. package/dist/config/default.d.ts +50 -0
  43. package/dist/config/default.js +62 -0
  44. package/dist/config/index.d.ts +158 -0
  45. package/dist/config/index.js +155 -0
  46. package/dist/config/observability.d.ts +119 -0
  47. package/dist/config/observability.js +35 -0
  48. package/dist/extensions/otel.d.ts +98 -0
  49. package/dist/extensions/otel.js +190 -0
  50. package/dist/extensions/pino.d.ts +44 -0
  51. package/dist/extensions/pino.js +107 -0
  52. package/dist/extensions/winston.d.ts +47 -0
  53. package/dist/extensions/winston.js +114 -0
  54. package/dist/index.d.ts +2 -0
  55. package/dist/index.js +2 -0
  56. package/dist/server/express/errors.js +3 -3
  57. package/dist/server/express/middeware.d.ts +2 -2
  58. package/dist/server/express/middeware.js +11 -4
  59. package/dist/server/express/server.d.ts +9 -56
  60. package/dist/server/express/server.js +21 -28
  61. package/dist/services/a2a/execute.d.ts +6 -0
  62. package/dist/services/a2a/execute.js +25 -0
  63. package/dist/services/a2a/factory/builder.d.ts +21 -80
  64. package/dist/services/a2a/factory/builder.js +20 -15
  65. package/dist/services/a2a/factory/context.d.ts +15 -128
  66. package/dist/services/a2a/factory/context.js +31 -136
  67. package/dist/services/a2a/factory/handler.d.ts +6 -0
  68. package/dist/services/a2a/factory/{method.js → handler.js} +2 -2
  69. package/dist/services/a2a/factory/index.d.ts +1 -2
  70. package/dist/services/a2a/factory/index.js +1 -2
  71. package/dist/services/a2a/factory/service.d.ts +20 -7
  72. package/dist/services/a2a/factory/service.js +4 -4
  73. package/dist/services/a2a/factory/state-machine.d.ts +11 -0
  74. package/dist/services/a2a/factory/state-machine.js +66 -0
  75. package/dist/services/a2a/{state/update → handlers}/artifact.d.ts +4 -4
  76. package/dist/services/a2a/handlers/cancel-task.d.ts +11 -0
  77. package/dist/services/a2a/handlers/cancel-task.js +33 -0
  78. package/dist/services/a2a/handlers/get-task.d.ts +11 -0
  79. package/dist/services/a2a/handlers/get-task.js +13 -0
  80. package/dist/services/a2a/handlers/resubscribe-task.d.ts +11 -0
  81. package/dist/services/a2a/handlers/resubscribe-task.js +56 -0
  82. package/dist/services/a2a/handlers/send-message.d.ts +11 -0
  83. package/dist/services/a2a/handlers/send-message.js +35 -0
  84. package/dist/services/a2a/handlers/stream-message.d.ts +11 -0
  85. package/dist/services/a2a/handlers/stream-message.js +19 -0
  86. package/dist/services/a2a/handlers/update.d.ts +17 -0
  87. package/dist/services/a2a/handlers/update.js +114 -0
  88. package/dist/services/a2a/helpers/agentcard-builder.d.ts +9 -5
  89. package/dist/services/a2a/helpers/agentcard-builder.js +4 -0
  90. package/dist/services/a2a/helpers/content.d.ts +2 -2
  91. package/dist/services/a2a/helpers/content.js +4 -0
  92. package/dist/services/a2a/helpers/history.d.ts +6 -2
  93. package/dist/services/a2a/helpers/history.js +4 -0
  94. package/dist/services/a2a/helpers/index.d.ts +2 -2
  95. package/dist/services/a2a/helpers/index.js +2 -2
  96. package/dist/services/a2a/helpers/message-builder.d.ts +13 -8
  97. package/dist/services/a2a/helpers/message-builder.js +5 -0
  98. package/dist/services/a2a/helpers/part.d.ts +9 -9
  99. package/dist/services/a2a/helpers/references.d.ts +6 -0
  100. package/dist/services/a2a/helpers/references.js +22 -0
  101. package/dist/services/a2a/index.d.ts +9 -5
  102. package/dist/services/a2a/index.js +8 -5
  103. package/dist/services/a2a/managers.d.ts +23 -0
  104. package/dist/services/a2a/managers.js +95 -0
  105. package/dist/services/a2a/messenger.d.ts +35 -0
  106. package/dist/services/{core/managers/command.js → a2a/messenger.js} +27 -31
  107. package/dist/services/a2a/service.d.ts +41 -372
  108. package/dist/services/a2a/service.js +238 -83
  109. package/dist/services/a2a/state-machine.d.ts +18 -0
  110. package/dist/services/a2a/state-machine.js +76 -0
  111. package/dist/services/a2a/streams.d.ts +22 -0
  112. package/dist/services/a2a/streams.js +98 -0
  113. package/dist/services/core/index.d.ts +1 -2
  114. package/dist/services/core/index.js +1 -2
  115. package/dist/services/core/manager.d.ts +15 -0
  116. package/dist/services/core/manager.js +42 -0
  117. package/dist/services/mcp/service.d.ts +11 -15
  118. package/dist/services/mcp/service.js +16 -15
  119. package/dist/transport/index.d.ts +0 -1
  120. package/dist/transport/index.js +1 -1
  121. package/dist/transport/rpc/parser.d.ts +2 -2
  122. package/dist/transport/rpc/parser.js +6 -6
  123. package/dist/transport/rpc/rpc-client.d.ts +5 -5
  124. package/dist/transport/rpc/rpc-client.js +6 -6
  125. package/dist/transport/streaming/event-stream.d.ts +3 -3
  126. package/dist/transport/streaming/event-stream.js +11 -10
  127. package/dist/transport/trpc/a2a/factory/router.d.ts +479 -871
  128. package/dist/transport/trpc/a2a/factory/router.js +2 -2
  129. package/dist/transport/trpc/a2a/routes/info.d.ts +108 -8
  130. package/dist/transport/trpc/a2a/routes/info.js +6 -2
  131. package/dist/transport/trpc/a2a/routes/message/route.d.ts +113 -162
  132. package/dist/transport/trpc/a2a/routes/message/route.js +7 -13
  133. package/dist/transport/trpc/a2a/routes/tasks/route.d.ts +114 -212
  134. package/dist/transport/trpc/a2a/routes/tasks/route.js +16 -19
  135. package/dist/transport/trpc/a2a/trpc.d.ts +9 -253
  136. package/dist/types/a2a/a2a.d.ts +378 -0
  137. package/dist/types/a2a/a2a.js +14 -0
  138. package/dist/types/a2a/builder.d.ts +43 -0
  139. package/dist/types/a2a/index.d.ts +3 -0
  140. package/dist/types/a2a/index.js +2 -0
  141. package/dist/{browser/types/interfaces → types}/client.d.ts +25 -27
  142. package/dist/types/core/core.d.ts +31 -0
  143. package/dist/types/core/index.d.ts +1 -0
  144. package/dist/types/core/index.js +1 -0
  145. package/dist/types/index.d.ts +6 -3
  146. package/dist/types/index.js +6 -3
  147. package/dist/types/mcp/index.d.ts +1 -0
  148. package/dist/types/mcp/index.js +1 -0
  149. package/dist/types/{interfaces/services/mcp/service.d.ts → mcp/mcp.d.ts} +4 -3
  150. package/dist/{browser/types/interfaces/services/a2a/engine.js → types/mcp/mcp.js} +1 -1
  151. package/dist/types/storage.d.ts +21 -0
  152. package/dist/utils/common/constants.d.ts +7 -7
  153. package/dist/utils/common/constants.js +9 -9
  154. package/dist/utils/common/errors.d.ts +18 -18
  155. package/dist/utils/common/errors.js +14 -14
  156. package/dist/utils/common/parse.d.ts +7 -0
  157. package/dist/utils/common/parse.js +14 -0
  158. package/dist/utils/common/schema-validation.d.ts +1 -1
  159. package/dist/utils/common/schema-validation.js +7 -7
  160. package/dist/utils/common/utils.d.ts +23 -0
  161. package/dist/utils/common/utils.js +32 -0
  162. package/dist/utils/common/zAsyncIterable-v3.d.ts +1 -1
  163. package/dist/utils/common/zAsyncIterable-v3.js +2 -1
  164. package/dist/utils/index.d.ts +2 -3
  165. package/dist/utils/index.js +2 -3
  166. package/dist/utils/storage/file.d.ts +8 -17
  167. package/dist/utils/storage/file.js +44 -73
  168. package/package.json +73 -13
  169. package/dist/browser/types/ext.d.ts +0 -13
  170. package/dist/browser/types/ext.js +0 -10
  171. package/dist/browser/types/interfaces/index.d.ts +0 -3
  172. package/dist/browser/types/interfaces/index.js +0 -3
  173. package/dist/browser/types/interfaces/services/a2a/builder.d.ts +0 -37
  174. package/dist/browser/types/interfaces/services/a2a/context.d.ts +0 -162
  175. package/dist/browser/types/interfaces/services/a2a/engine.d.ts +0 -7
  176. package/dist/browser/types/interfaces/services/a2a/index.d.ts +0 -5
  177. package/dist/browser/types/interfaces/services/a2a/index.js +0 -5
  178. package/dist/browser/types/interfaces/services/a2a/legacy.d.ts +0 -93
  179. package/dist/browser/types/interfaces/services/a2a/legacy.js +0 -5
  180. package/dist/browser/types/interfaces/services/a2a/service.d.ts +0 -413
  181. package/dist/browser/types/interfaces/services/a2a/service.js +0 -5
  182. package/dist/browser/types/interfaces/services/core/context/command.d.ts +0 -25
  183. package/dist/browser/types/interfaces/services/core/context/command.js +0 -5
  184. package/dist/browser/types/interfaces/services/core/context/context.d.ts +0 -207
  185. package/dist/browser/types/interfaces/services/core/context/context.js +0 -5
  186. package/dist/browser/types/interfaces/services/core/context/index.d.ts +0 -3
  187. package/dist/browser/types/interfaces/services/core/context/index.js +0 -3
  188. package/dist/browser/types/interfaces/services/core/context/types.d.ts +0 -11
  189. package/dist/browser/types/interfaces/services/core/context/types.js +0 -5
  190. package/dist/browser/types/interfaces/services/core/execution/engine.d.ts +0 -106
  191. package/dist/browser/types/interfaces/services/core/execution/engine.js +0 -5
  192. package/dist/browser/types/interfaces/services/core/execution/environment.d.ts +0 -11
  193. package/dist/browser/types/interfaces/services/core/execution/environment.js +0 -5
  194. package/dist/browser/types/interfaces/services/core/execution/execute.d.ts +0 -7
  195. package/dist/browser/types/interfaces/services/core/execution/execute.js +0 -5
  196. package/dist/browser/types/interfaces/services/core/execution/index.d.ts +0 -3
  197. package/dist/browser/types/interfaces/services/core/execution/index.js +0 -3
  198. package/dist/browser/types/interfaces/services/core/index.d.ts +0 -4
  199. package/dist/browser/types/interfaces/services/core/index.js +0 -4
  200. package/dist/browser/types/interfaces/services/core/managers/cancellation.d.ts +0 -9
  201. package/dist/browser/types/interfaces/services/core/managers/cancellation.js +0 -5
  202. package/dist/browser/types/interfaces/services/core/managers/connection.d.ts +0 -9
  203. package/dist/browser/types/interfaces/services/core/managers/connection.js +0 -5
  204. package/dist/browser/types/interfaces/services/core/managers/context.d.ts +0 -17
  205. package/dist/browser/types/interfaces/services/core/managers/context.js +0 -5
  206. package/dist/browser/types/interfaces/services/core/managers/event.d.ts +0 -328
  207. package/dist/browser/types/interfaces/services/core/managers/event.js +0 -5
  208. package/dist/browser/types/interfaces/services/core/managers/index.d.ts +0 -6
  209. package/dist/browser/types/interfaces/services/core/managers/index.js +0 -6
  210. package/dist/browser/types/interfaces/services/core/managers/stream.d.ts +0 -217
  211. package/dist/browser/types/interfaces/services/core/managers/stream.js +0 -5
  212. package/dist/browser/types/interfaces/services/core/managers/task.d.ts +0 -9
  213. package/dist/browser/types/interfaces/services/core/service.d.ts +0 -115
  214. package/dist/browser/types/interfaces/services/core/service.js +0 -5
  215. package/dist/browser/types/interfaces/services/index.d.ts +0 -4
  216. package/dist/browser/types/interfaces/services/index.js +0 -4
  217. package/dist/browser/types/interfaces/services/mcp/index.d.ts +0 -1
  218. package/dist/browser/types/interfaces/services/mcp/index.js +0 -1
  219. package/dist/browser/types/interfaces/services/mcp/service.js +0 -5
  220. package/dist/browser/types/interfaces/storage.d.ts +0 -8
  221. package/dist/browser/types/schemas/a2a/agent.d.ts +0 -2583
  222. package/dist/browser/types/schemas/a2a/agent.js +0 -323
  223. package/dist/browser/types/schemas/a2a/auth.d.ts +0 -908
  224. package/dist/browser/types/schemas/a2a/auth.js +0 -283
  225. package/dist/browser/types/schemas/a2a/error.d.ts +0 -396
  226. package/dist/browser/types/schemas/a2a/error.js +0 -163
  227. package/dist/browser/types/schemas/a2a/index.d.ts +0 -11
  228. package/dist/browser/types/schemas/a2a/index.js +0 -11
  229. package/dist/browser/types/schemas/a2a/kind.d.ts +0 -11
  230. package/dist/browser/types/schemas/a2a/kind.js +0 -20
  231. package/dist/browser/types/schemas/a2a/message.d.ts +0 -10343
  232. package/dist/browser/types/schemas/a2a/message.js +0 -130
  233. package/dist/browser/types/schemas/a2a/notification.d.ts +0 -1517
  234. package/dist/browser/types/schemas/a2a/notification.js +0 -203
  235. package/dist/browser/types/schemas/a2a/parameters.d.ts +0 -956
  236. package/dist/browser/types/schemas/a2a/parameters.js +0 -241
  237. package/dist/browser/types/schemas/a2a/protocol.d.ts +0 -14363
  238. package/dist/browser/types/schemas/a2a/protocol.js +0 -59
  239. package/dist/browser/types/schemas/a2a/rpc.d.ts +0 -182
  240. package/dist/browser/types/schemas/a2a/rpc.js +0 -126
  241. package/dist/browser/types/schemas/a2a/task.d.ts +0 -5886
  242. package/dist/browser/types/schemas/a2a/task.js +0 -134
  243. package/dist/browser/types/schemas/a2a/transport.d.ts +0 -31
  244. package/dist/browser/types/schemas/a2a/transport.js +0 -28
  245. package/dist/browser/types/schemas/index.d.ts +0 -1
  246. package/dist/browser/types/schemas/index.js +0 -1
  247. package/dist/browser/utils/logging/index.d.ts +0 -2
  248. package/dist/browser/utils/logging/index.js +0 -2
  249. package/dist/browser/utils/logging/log.d.ts +0 -33
  250. package/dist/browser/utils/logging/log.js +0 -75
  251. package/dist/browser/utils/logging/logger.d.ts +0 -18
  252. package/dist/browser/utils/logging/logger.js +0 -18
  253. package/dist/services/a2a/factory/event.d.ts +0 -58
  254. package/dist/services/a2a/factory/event.js +0 -177
  255. package/dist/services/a2a/factory/method.d.ts +0 -6
  256. package/dist/services/a2a/managers/cancellation.d.ts +0 -11
  257. package/dist/services/a2a/managers/cancellation.js +0 -16
  258. package/dist/services/a2a/managers/connection.d.ts +0 -11
  259. package/dist/services/a2a/managers/connection.js +0 -16
  260. package/dist/services/a2a/managers/context.d.ts +0 -11
  261. package/dist/services/a2a/managers/context.js +0 -16
  262. package/dist/services/a2a/managers/index.d.ts +0 -5
  263. package/dist/services/a2a/managers/index.js +0 -5
  264. package/dist/services/a2a/managers/task.d.ts +0 -11
  265. package/dist/services/a2a/managers/task.js +0 -16
  266. package/dist/services/a2a/methods/cancel-task.d.ts +0 -7
  267. package/dist/services/a2a/methods/cancel-task.js +0 -43
  268. package/dist/services/a2a/methods/get-task.d.ts +0 -112
  269. package/dist/services/a2a/methods/get-task.js +0 -16
  270. package/dist/services/a2a/methods/resubscribe-task.d.ts +0 -7
  271. package/dist/services/a2a/methods/resubscribe-task.js +0 -80
  272. package/dist/services/a2a/methods/send-message.d.ts +0 -7
  273. package/dist/services/a2a/methods/send-message.js +0 -36
  274. package/dist/services/a2a/methods/stream-message.d.ts +0 -8
  275. package/dist/services/a2a/methods/stream-message.js +0 -21
  276. package/dist/services/a2a/state/index.d.ts +0 -3
  277. package/dist/services/a2a/state/index.js +0 -3
  278. package/dist/services/a2a/state/load.d.ts +0 -14
  279. package/dist/services/a2a/state/load.js +0 -71
  280. package/dist/services/a2a/state/process.d.ts +0 -7
  281. package/dist/services/a2a/state/process.js +0 -13
  282. package/dist/services/a2a/state/update/index.d.ts +0 -2
  283. package/dist/services/a2a/state/update/index.js +0 -2
  284. package/dist/services/a2a/state/update/update.d.ts +0 -23
  285. package/dist/services/a2a/state/update/update.js +0 -123
  286. package/dist/services/core/execution/execute.d.ts +0 -6
  287. package/dist/services/core/execution/execute.js +0 -25
  288. package/dist/services/core/execution/index.d.ts +0 -1
  289. package/dist/services/core/execution/index.js +0 -1
  290. package/dist/services/core/managers/command.d.ts +0 -39
  291. package/dist/services/core/managers/event.d.ts +0 -18
  292. package/dist/services/core/managers/event.js +0 -56
  293. package/dist/services/core/managers/index.d.ts +0 -3
  294. package/dist/services/core/managers/index.js +0 -3
  295. package/dist/services/core/managers/stream.d.ts +0 -20
  296. package/dist/services/core/managers/stream.js +0 -77
  297. package/dist/types/ext.d.ts +0 -13
  298. package/dist/types/ext.js +0 -10
  299. package/dist/types/interfaces/index.d.ts +0 -3
  300. package/dist/types/interfaces/index.js +0 -3
  301. package/dist/types/interfaces/services/a2a/builder.d.ts +0 -37
  302. package/dist/types/interfaces/services/a2a/context.d.ts +0 -162
  303. package/dist/types/interfaces/services/a2a/context.js +0 -5
  304. package/dist/types/interfaces/services/a2a/engine.d.ts +0 -7
  305. package/dist/types/interfaces/services/a2a/engine.js +0 -5
  306. package/dist/types/interfaces/services/a2a/index.d.ts +0 -5
  307. package/dist/types/interfaces/services/a2a/index.js +0 -5
  308. package/dist/types/interfaces/services/a2a/legacy.d.ts +0 -93
  309. package/dist/types/interfaces/services/a2a/legacy.js +0 -5
  310. package/dist/types/interfaces/services/a2a/service.d.ts +0 -413
  311. package/dist/types/interfaces/services/a2a/service.js +0 -5
  312. package/dist/types/interfaces/services/core/context/command.d.ts +0 -25
  313. package/dist/types/interfaces/services/core/context/command.js +0 -5
  314. package/dist/types/interfaces/services/core/context/context.d.ts +0 -207
  315. package/dist/types/interfaces/services/core/context/context.js +0 -5
  316. package/dist/types/interfaces/services/core/context/index.d.ts +0 -3
  317. package/dist/types/interfaces/services/core/context/index.js +0 -3
  318. package/dist/types/interfaces/services/core/context/types.d.ts +0 -11
  319. package/dist/types/interfaces/services/core/context/types.js +0 -5
  320. package/dist/types/interfaces/services/core/execution/engine.d.ts +0 -106
  321. package/dist/types/interfaces/services/core/execution/engine.js +0 -5
  322. package/dist/types/interfaces/services/core/execution/environment.d.ts +0 -11
  323. package/dist/types/interfaces/services/core/execution/environment.js +0 -5
  324. package/dist/types/interfaces/services/core/execution/execute.d.ts +0 -7
  325. package/dist/types/interfaces/services/core/execution/execute.js +0 -5
  326. package/dist/types/interfaces/services/core/execution/index.d.ts +0 -3
  327. package/dist/types/interfaces/services/core/execution/index.js +0 -3
  328. package/dist/types/interfaces/services/core/index.d.ts +0 -4
  329. package/dist/types/interfaces/services/core/index.js +0 -4
  330. package/dist/types/interfaces/services/core/managers/cancellation.d.ts +0 -9
  331. package/dist/types/interfaces/services/core/managers/cancellation.js +0 -5
  332. package/dist/types/interfaces/services/core/managers/connection.d.ts +0 -9
  333. package/dist/types/interfaces/services/core/managers/connection.js +0 -5
  334. package/dist/types/interfaces/services/core/managers/context.d.ts +0 -17
  335. package/dist/types/interfaces/services/core/managers/context.js +0 -5
  336. package/dist/types/interfaces/services/core/managers/event.d.ts +0 -328
  337. package/dist/types/interfaces/services/core/managers/event.js +0 -5
  338. package/dist/types/interfaces/services/core/managers/index.d.ts +0 -6
  339. package/dist/types/interfaces/services/core/managers/index.js +0 -6
  340. package/dist/types/interfaces/services/core/managers/stream.d.ts +0 -217
  341. package/dist/types/interfaces/services/core/managers/stream.js +0 -5
  342. package/dist/types/interfaces/services/core/managers/task.d.ts +0 -9
  343. package/dist/types/interfaces/services/core/service.d.ts +0 -115
  344. package/dist/types/interfaces/services/core/service.js +0 -5
  345. package/dist/types/interfaces/services/index.d.ts +0 -4
  346. package/dist/types/interfaces/services/index.js +0 -4
  347. package/dist/types/interfaces/services/mcp/index.d.ts +0 -1
  348. package/dist/types/interfaces/services/mcp/index.js +0 -1
  349. package/dist/types/interfaces/services/mcp/service.js +0 -5
  350. package/dist/types/interfaces/storage.d.ts +0 -8
  351. package/dist/types/schemas/a2a/agent.d.ts +0 -2583
  352. package/dist/types/schemas/a2a/agent.js +0 -323
  353. package/dist/types/schemas/a2a/auth.d.ts +0 -908
  354. package/dist/types/schemas/a2a/auth.js +0 -283
  355. package/dist/types/schemas/a2a/error.d.ts +0 -396
  356. package/dist/types/schemas/a2a/error.js +0 -163
  357. package/dist/types/schemas/a2a/index.d.ts +0 -11
  358. package/dist/types/schemas/a2a/index.js +0 -11
  359. package/dist/types/schemas/a2a/kind.d.ts +0 -11
  360. package/dist/types/schemas/a2a/kind.js +0 -20
  361. package/dist/types/schemas/a2a/message.d.ts +0 -10343
  362. package/dist/types/schemas/a2a/message.js +0 -130
  363. package/dist/types/schemas/a2a/notification.d.ts +0 -1517
  364. package/dist/types/schemas/a2a/notification.js +0 -203
  365. package/dist/types/schemas/a2a/parameters.d.ts +0 -956
  366. package/dist/types/schemas/a2a/parameters.js +0 -241
  367. package/dist/types/schemas/a2a/protocol.d.ts +0 -14363
  368. package/dist/types/schemas/a2a/protocol.js +0 -59
  369. package/dist/types/schemas/a2a/rpc.d.ts +0 -182
  370. package/dist/types/schemas/a2a/rpc.js +0 -126
  371. package/dist/types/schemas/a2a/task.d.ts +0 -5886
  372. package/dist/types/schemas/a2a/task.js +0 -134
  373. package/dist/types/schemas/a2a/transport.d.ts +0 -31
  374. package/dist/types/schemas/a2a/transport.js +0 -28
  375. package/dist/types/schemas/index.d.ts +0 -1
  376. package/dist/types/schemas/index.js +0 -1
  377. package/dist/utils/logging/index.d.ts +0 -2
  378. package/dist/utils/logging/index.js +0 -2
  379. package/dist/utils/logging/log.d.ts +0 -33
  380. package/dist/utils/logging/log.js +0 -75
  381. package/dist/utils/logging/logger.d.ts +0 -18
  382. package/dist/utils/logging/logger.js +0 -18
  383. package/dist/utils/storage/memory.d.ts +0 -25
  384. package/dist/utils/storage/memory.js +0 -47
  385. /package/dist/browser/types/{interfaces/services/a2a → a2a}/builder.js +0 -0
  386. /package/dist/browser/types/{interfaces/client.js → client.js} +0 -0
  387. /package/dist/browser/types/{interfaces/services/core/managers/task.js → core/core.js} +0 -0
  388. /package/dist/browser/types/{interfaces/services/protocol.d.ts → protocol.d.ts} +0 -0
  389. /package/dist/browser/types/{interfaces/services/protocol.js → protocol.js} +0 -0
  390. /package/dist/browser/types/{interfaces/storage.js → storage.js} +0 -0
  391. /package/dist/services/a2a/{state/update → handlers}/artifact.js +0 -0
  392. /package/dist/services/a2a/{methods → handlers}/index.d.ts +0 -0
  393. /package/dist/services/a2a/{methods → handlers}/index.js +0 -0
  394. /package/dist/types/{interfaces/services/a2a → a2a}/builder.js +0 -0
  395. /package/dist/types/{interfaces/client.js → client.js} +0 -0
  396. /package/dist/types/{interfaces/services/core/managers/task.js → core/core.js} +0 -0
  397. /package/dist/types/{interfaces/services/protocol.d.ts → protocol.d.ts} +0 -0
  398. /package/dist/types/{interfaces/services/protocol.js → protocol.js} +0 -0
  399. /package/dist/types/{interfaces/storage.js → storage.js} +0 -0
@@ -0,0 +1,378 @@
1
+ /**
2
+ * Copyright 2025 The Artinet Project
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { AgentCard, Message, Task, AgentExtension, TaskQueryParams, TaskIdParams, MessageSendParams, SendMessageSuccessResult } from "@artinet/types/a2a";
6
+ import { core } from "../core/index.js";
7
+ import { z } from "zod/v4";
8
+ export type AgentCardParams = (Partial<AgentCard> & Required<Pick<AgentCard, "name">>) | string;
9
+ export declare const UpdateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
10
+ role: z.ZodEnum<{
11
+ user: "user";
12
+ agent: "agent";
13
+ }>;
14
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
15
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
16
+ kind: z.ZodLiteral<"text">;
17
+ text: z.ZodString;
18
+ }, z.core.$strip>, z.ZodObject<{
19
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
20
+ kind: z.ZodLiteral<"file">;
21
+ file: z.ZodUnion<readonly [z.ZodObject<{
22
+ name: z.ZodOptional<z.ZodString>;
23
+ mimeType: z.ZodOptional<z.ZodString>;
24
+ bytes: z.ZodString;
25
+ uri: z.ZodOptional<z.ZodNever>;
26
+ }, z.core.$strip>, z.ZodObject<{
27
+ name: z.ZodOptional<z.ZodString>;
28
+ mimeType: z.ZodOptional<z.ZodString>;
29
+ uri: z.ZodString;
30
+ bytes: z.ZodOptional<z.ZodNever>;
31
+ }, z.core.$strip>]>;
32
+ }, z.core.$strip>, z.ZodObject<{
33
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
34
+ kind: z.ZodLiteral<"data">;
35
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
36
+ }, z.core.$strip>]>>;
37
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
38
+ extensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
39
+ referenceTaskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
40
+ messageId: z.ZodString;
41
+ taskId: z.ZodOptional<z.ZodString>;
42
+ contextId: z.ZodOptional<z.ZodString>;
43
+ kind: z.ZodLiteral<"message">;
44
+ }, z.core.$strip>, z.ZodObject<{
45
+ id: z.ZodString;
46
+ contextId: z.ZodString;
47
+ status: z.ZodObject<{
48
+ state: z.ZodEnum<{
49
+ failed: "failed";
50
+ unknown: "unknown";
51
+ completed: "completed";
52
+ canceled: "canceled";
53
+ rejected: "rejected";
54
+ working: "working";
55
+ submitted: "submitted";
56
+ "input-required": "input-required";
57
+ "auth-required": "auth-required";
58
+ }>;
59
+ message: z.ZodOptional<z.ZodObject<{
60
+ role: z.ZodEnum<{
61
+ user: "user";
62
+ agent: "agent";
63
+ }>;
64
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
65
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
66
+ kind: z.ZodLiteral<"text">;
67
+ text: z.ZodString;
68
+ }, z.core.$strip>, z.ZodObject<{
69
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
70
+ kind: z.ZodLiteral<"file">;
71
+ file: z.ZodUnion<readonly [z.ZodObject<{
72
+ name: z.ZodOptional<z.ZodString>;
73
+ mimeType: z.ZodOptional<z.ZodString>;
74
+ bytes: z.ZodString;
75
+ uri: z.ZodOptional<z.ZodNever>;
76
+ }, z.core.$strip>, z.ZodObject<{
77
+ name: z.ZodOptional<z.ZodString>;
78
+ mimeType: z.ZodOptional<z.ZodString>;
79
+ uri: z.ZodString;
80
+ bytes: z.ZodOptional<z.ZodNever>;
81
+ }, z.core.$strip>]>;
82
+ }, z.core.$strip>, z.ZodObject<{
83
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
84
+ kind: z.ZodLiteral<"data">;
85
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
86
+ }, z.core.$strip>]>>;
87
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
88
+ extensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
89
+ referenceTaskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
90
+ messageId: z.ZodString;
91
+ taskId: z.ZodOptional<z.ZodString>;
92
+ contextId: z.ZodOptional<z.ZodString>;
93
+ kind: z.ZodLiteral<"message">;
94
+ }, z.core.$strip>>;
95
+ timestamp: z.ZodOptional<z.ZodISODateTime>;
96
+ }, z.core.$strip>;
97
+ history: z.ZodOptional<z.ZodArray<z.ZodObject<{
98
+ role: z.ZodEnum<{
99
+ user: "user";
100
+ agent: "agent";
101
+ }>;
102
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
103
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
104
+ kind: z.ZodLiteral<"text">;
105
+ text: z.ZodString;
106
+ }, z.core.$strip>, z.ZodObject<{
107
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
108
+ kind: z.ZodLiteral<"file">;
109
+ file: z.ZodUnion<readonly [z.ZodObject<{
110
+ name: z.ZodOptional<z.ZodString>;
111
+ mimeType: z.ZodOptional<z.ZodString>;
112
+ bytes: z.ZodString;
113
+ uri: z.ZodOptional<z.ZodNever>;
114
+ }, z.core.$strip>, z.ZodObject<{
115
+ name: z.ZodOptional<z.ZodString>;
116
+ mimeType: z.ZodOptional<z.ZodString>;
117
+ uri: z.ZodString;
118
+ bytes: z.ZodOptional<z.ZodNever>;
119
+ }, z.core.$strip>]>;
120
+ }, z.core.$strip>, z.ZodObject<{
121
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
122
+ kind: z.ZodLiteral<"data">;
123
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
124
+ }, z.core.$strip>]>>;
125
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
126
+ extensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
127
+ referenceTaskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
128
+ messageId: z.ZodString;
129
+ taskId: z.ZodOptional<z.ZodString>;
130
+ contextId: z.ZodOptional<z.ZodString>;
131
+ kind: z.ZodLiteral<"message">;
132
+ }, z.core.$strip>>>;
133
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
134
+ artifactId: z.ZodString;
135
+ name: z.ZodOptional<z.ZodString>;
136
+ description: z.ZodOptional<z.ZodString>;
137
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
138
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
139
+ kind: z.ZodLiteral<"text">;
140
+ text: z.ZodString;
141
+ }, z.core.$strip>, z.ZodObject<{
142
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
143
+ kind: z.ZodLiteral<"file">;
144
+ file: z.ZodUnion<readonly [z.ZodObject<{
145
+ name: z.ZodOptional<z.ZodString>;
146
+ mimeType: z.ZodOptional<z.ZodString>;
147
+ bytes: z.ZodString;
148
+ uri: z.ZodOptional<z.ZodNever>;
149
+ }, z.core.$strip>, z.ZodObject<{
150
+ name: z.ZodOptional<z.ZodString>;
151
+ mimeType: z.ZodOptional<z.ZodString>;
152
+ uri: z.ZodString;
153
+ bytes: z.ZodOptional<z.ZodNever>;
154
+ }, z.core.$strip>]>;
155
+ }, z.core.$strip>, z.ZodObject<{
156
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
157
+ kind: z.ZodLiteral<"data">;
158
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
159
+ }, z.core.$strip>]>>;
160
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
161
+ extension: z.ZodOptional<z.ZodArray<z.ZodString>>;
162
+ }, z.core.$strip>>>;
163
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
164
+ kind: z.ZodLiteral<"task">;
165
+ }, z.core.$strip>, z.ZodObject<{
166
+ taskId: z.ZodString;
167
+ contextId: z.ZodString;
168
+ kind: z.ZodLiteral<"status-update">;
169
+ status: z.ZodObject<{
170
+ state: z.ZodEnum<{
171
+ failed: "failed";
172
+ unknown: "unknown";
173
+ completed: "completed";
174
+ canceled: "canceled";
175
+ rejected: "rejected";
176
+ working: "working";
177
+ submitted: "submitted";
178
+ "input-required": "input-required";
179
+ "auth-required": "auth-required";
180
+ }>;
181
+ message: z.ZodOptional<z.ZodObject<{
182
+ role: z.ZodEnum<{
183
+ user: "user";
184
+ agent: "agent";
185
+ }>;
186
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
187
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
188
+ kind: z.ZodLiteral<"text">;
189
+ text: z.ZodString;
190
+ }, z.core.$strip>, z.ZodObject<{
191
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
192
+ kind: z.ZodLiteral<"file">;
193
+ file: z.ZodUnion<readonly [z.ZodObject<{
194
+ name: z.ZodOptional<z.ZodString>;
195
+ mimeType: z.ZodOptional<z.ZodString>;
196
+ bytes: z.ZodString;
197
+ uri: z.ZodOptional<z.ZodNever>;
198
+ }, z.core.$strip>, z.ZodObject<{
199
+ name: z.ZodOptional<z.ZodString>;
200
+ mimeType: z.ZodOptional<z.ZodString>;
201
+ uri: z.ZodString;
202
+ bytes: z.ZodOptional<z.ZodNever>;
203
+ }, z.core.$strip>]>;
204
+ }, z.core.$strip>, z.ZodObject<{
205
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
206
+ kind: z.ZodLiteral<"data">;
207
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
208
+ }, z.core.$strip>]>>;
209
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
210
+ extensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
211
+ referenceTaskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
212
+ messageId: z.ZodString;
213
+ taskId: z.ZodOptional<z.ZodString>;
214
+ contextId: z.ZodOptional<z.ZodString>;
215
+ kind: z.ZodLiteral<"message">;
216
+ }, z.core.$strip>>;
217
+ timestamp: z.ZodOptional<z.ZodISODateTime>;
218
+ }, z.core.$strip>;
219
+ final: z.ZodBoolean;
220
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
221
+ }, z.core.$strip>, z.ZodObject<{
222
+ taskId: z.ZodString;
223
+ contextId: z.ZodString;
224
+ kind: z.ZodLiteral<"artifact-update">;
225
+ artifact: z.ZodObject<{
226
+ artifactId: z.ZodString;
227
+ name: z.ZodOptional<z.ZodString>;
228
+ description: z.ZodOptional<z.ZodString>;
229
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
230
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
231
+ kind: z.ZodLiteral<"text">;
232
+ text: z.ZodString;
233
+ }, z.core.$strip>, z.ZodObject<{
234
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
235
+ kind: z.ZodLiteral<"file">;
236
+ file: z.ZodUnion<readonly [z.ZodObject<{
237
+ name: z.ZodOptional<z.ZodString>;
238
+ mimeType: z.ZodOptional<z.ZodString>;
239
+ bytes: z.ZodString;
240
+ uri: z.ZodOptional<z.ZodNever>;
241
+ }, z.core.$strip>, z.ZodObject<{
242
+ name: z.ZodOptional<z.ZodString>;
243
+ mimeType: z.ZodOptional<z.ZodString>;
244
+ uri: z.ZodString;
245
+ bytes: z.ZodOptional<z.ZodNever>;
246
+ }, z.core.$strip>]>;
247
+ }, z.core.$strip>, z.ZodObject<{
248
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
249
+ kind: z.ZodLiteral<"data">;
250
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
251
+ }, z.core.$strip>]>>;
252
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
253
+ extension: z.ZodOptional<z.ZodArray<z.ZodString>>;
254
+ }, z.core.$strip>;
255
+ append: z.ZodOptional<z.ZodBoolean>;
256
+ lastChunk: z.ZodOptional<z.ZodBoolean>;
257
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
258
+ }, z.core.$strip>]>;
259
+ export type Update = z.infer<typeof UpdateSchema>;
260
+ export type Engine = (context: Context) => AsyncGenerator<Update, void, unknown>;
261
+ export interface BaseContext extends core.Context<Task> {
262
+ readonly service: Service;
263
+ readonly publisher: EventPublisher;
264
+ }
265
+ export interface Context extends BaseContext {
266
+ readonly taskId: string;
267
+ readonly userMessage: Message;
268
+ readonly messages: MessageConsumerProxy;
269
+ extensions?: AgentExtension[];
270
+ references?: Task[];
271
+ getTask: () => Promise<Task>;
272
+ }
273
+ export type ContextParams = Omit<BaseContext, "publisher" | "isCancelled" | "getState" | "abortSignal"> & Omit<Partial<Context>, "userMessage"> & {
274
+ messenger: MessageConsumerProxy;
275
+ task?: Task;
276
+ overrides?: Partial<Omit<EventConsumer, "contextId">>;
277
+ abortSignal?: AbortSignal;
278
+ };
279
+ export interface Contexts extends core.Contexts<Context> {
280
+ create: (params: ContextParams) => Promise<Context>;
281
+ list: () => Promise<Context[]>;
282
+ }
283
+ export interface Tasks extends core.Manager<Task> {
284
+ update: (context: Context, update: Update) => Promise<Task>;
285
+ create: (params: Partial<Task>) => Promise<Task>;
286
+ has: (id: string) => Promise<boolean>;
287
+ }
288
+ export interface Cancellations extends Omit<core.Manager<void>, "get"> {
289
+ has: (id: string) => Promise<boolean>;
290
+ }
291
+ export interface Connections extends Omit<core.Manager<void>, "get"> {
292
+ }
293
+ export interface ServiceOptions {
294
+ abortSignal?: AbortSignal;
295
+ }
296
+ export interface RequestHandler {
297
+ getTask: (input: TaskQueryParams, context?: Context, options?: ServiceOptions) => Promise<Task>;
298
+ cancelTask: (input: TaskIdParams, context?: Context, options?: ServiceOptions) => Promise<Task>;
299
+ sendMessage: (message: MessageSendParams, context?: Context, options?: ServiceOptions) => Promise<SendMessageSuccessResult>;
300
+ streamMessage: (message: MessageSendParams, context?: Context, options?: ServiceOptions) => AsyncGenerator<Update>;
301
+ resubscribe: (input: TaskIdParams, context?: Context, options?: ServiceOptions) => AsyncGenerator<Update>;
302
+ getAgentCard: () => Promise<AgentCard>;
303
+ }
304
+ export interface ExtendedHandler extends RequestHandler {
305
+ getAuthenticatedExtendedCard: () => Promise<AgentCard>;
306
+ }
307
+ export interface Stream {
308
+ readonly contextId: string;
309
+ isAlive: boolean;
310
+ kill: () => Promise<void>;
311
+ updates: Update[];
312
+ context: Context;
313
+ run: (params: {
314
+ service: Service;
315
+ }) => AsyncGenerator<Update>;
316
+ subscribe: () => AsyncGenerator<Update>;
317
+ }
318
+ export interface Streams extends Omit<core.Manager<Stream>, "set"> {
319
+ create: (params: core.Optional<Stream> & {
320
+ context: Context;
321
+ }) => Promise<Stream>;
322
+ has: (id: string) => Promise<boolean>;
323
+ }
324
+ export interface Service extends core.Service<{
325
+ engine: Engine;
326
+ context: Context;
327
+ }>, RequestHandler {
328
+ readonly events?: Events;
329
+ readonly connections: Connections;
330
+ readonly cancellations: Cancellations;
331
+ readonly tasks: Tasks;
332
+ readonly contexts: Contexts;
333
+ readonly streams: Streams;
334
+ engine: Engine;
335
+ agentCard: AgentCard;
336
+ }
337
+ export interface MessageProducer {
338
+ isOpen: boolean;
339
+ send: (message: MessageSendParams) => Promise<void>;
340
+ }
341
+ export type MessageMap = {
342
+ message: [MessageSendParams];
343
+ close: [];
344
+ };
345
+ export interface MessageConsumer extends core.Consumer<MessageSendParams, MessageMap> {
346
+ message: MessageSendParams;
347
+ messages: MessageSendParams[];
348
+ close: () => Promise<void>;
349
+ next: () => Promise<IteratorResult<MessageSendParams>>;
350
+ return: (value: MessageSendParams) => Promise<IteratorResult<MessageSendParams>>;
351
+ }
352
+ export type MessageConsumerProxy = MessageConsumer & MessageSendParams;
353
+ export interface EventConsumer {
354
+ readonly contextId: string;
355
+ readonly onStart?: (context: Context) => Promise<Task>;
356
+ readonly onCancel: (update: Update, current: Task) => Promise<void>;
357
+ readonly onUpdate: (update: Update, current: Task) => Promise<Task>;
358
+ readonly onError: (error: any, current: Task) => Promise<void>;
359
+ onComplete: (current: Task) => Promise<void>;
360
+ }
361
+ export type Emissions = {
362
+ start: [MessageSendParams, Task];
363
+ cancel: [Update];
364
+ update: [Task, Update];
365
+ error: [any, Task];
366
+ complete: [Task];
367
+ };
368
+ export interface EventPublisher extends Omit<EventConsumer, "onComplete" | "onCancel" | "onError" | "onUpdate">, core.Publisher<Emissions> {
369
+ readonly onStart?: (context: Context) => Promise<Task>;
370
+ readonly onCancel: (update: Update) => Promise<void>;
371
+ readonly onUpdate: (update: Update) => Promise<Task>;
372
+ readonly onError: (error: any) => Promise<void>;
373
+ onComplete: () => Promise<void>;
374
+ }
375
+ export interface Events extends core.Manager<EventPublisher> {
376
+ create: (params: core.Optional<EventPublisher>) => Promise<EventPublisher>;
377
+ }
378
+ export * from "@artinet/types/a2a";
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright 2025 The Artinet Project
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ //lets stay really granular with the imports
6
+ import { TaskArtifactUpdateEventSchema, MessageSchema, TaskSchema, TaskStatusUpdateEventSchema, } from "@artinet/types/a2a";
7
+ import { z } from "zod/v4";
8
+ export const UpdateSchema = z.discriminatedUnion("kind", [
9
+ MessageSchema,
10
+ TaskSchema,
11
+ TaskStatusUpdateEventSchema,
12
+ TaskArtifactUpdateEventSchema,
13
+ ]);
14
+ export * from "@artinet/types/a2a";
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Copyright 2025 The Artinet Project
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { MessageSendParams, DataPart, FilePart, TextPart } from "@artinet/types/a2a";
6
+ import { Context } from "./a2a.js";
7
+ /**
8
+ * Restricting to command for now, but could be extended to other types of commands in the future.
9
+ * When we shift to CoreCommand, move this into core.
10
+ */
11
+ export interface StepArgs {
12
+ message: MessageSendParams;
13
+ context: Context;
14
+ skip: () => Promise<void> | void;
15
+ }
16
+ export type BaseArgs = Record<string, unknown>;
17
+ export type EmptyArgs = Record<string, never>;
18
+ export type StepParams<TInboundArgs extends BaseArgs = EmptyArgs> = StepArgs & Partial<{
19
+ content: string;
20
+ args: TInboundArgs;
21
+ }>;
22
+ export type PartContent = DataPart["data"] | FilePart["file"] | TextPart["text"];
23
+ export type StepOutput<TPart extends PartContent> = {
24
+ parts: Array<TPart> | TPart;
25
+ };
26
+ export type StepOutputWithForwardArgs<TPart extends PartContent, TForwardArgs extends BaseArgs = EmptyArgs> = StepOutput<TPart> & {
27
+ args: TForwardArgs;
28
+ };
29
+ export type OutputType<TPart extends PartContent, TForwardArgs extends BaseArgs = EmptyArgs> = StepOutput<TPart> | StepOutputWithForwardArgs<TPart, TForwardArgs> | Array<TPart> | TPart;
30
+ export type Step<TPart extends PartContent = TextPart["text"], TInboundArgs extends BaseArgs = EmptyArgs, TForwardArgs extends BaseArgs = EmptyArgs, TOutput extends OutputType<TPart, TForwardArgs> = OutputType<TPart, TForwardArgs>> = (params: StepParams<TInboundArgs>) => Promise<TOutput> | TOutput;
31
+ export type StepWithKind<TPart extends PartContent = TextPart["text"], TInboundArgs extends BaseArgs = EmptyArgs, TForwardArgs extends BaseArgs = EmptyArgs, TOutput extends OutputType<TPart, TForwardArgs> = OutputType<TPart, TForwardArgs>, TKind extends "text" | "file" | "data" = "text"> = {
32
+ step: Step<TPart, TInboundArgs, TForwardArgs, TOutput>;
33
+ kind: TKind;
34
+ };
35
+ export type OutArgsOf<O> = O extends StepOutputWithForwardArgs<any, infer A> ? A : EmptyArgs;
36
+ export interface StepBuilder<TInboundArgs extends BaseArgs = EmptyArgs> {
37
+ /**
38
+ * Add a step to the builder.
39
+ * @param step - The step to add.
40
+ * @returns A new builder with the step added.
41
+ */
42
+ addStep<TPart extends PartContent = TextPart["text"], TForwardArgs extends BaseArgs = EmptyArgs, TOutput extends OutputType<TPart, TForwardArgs> = OutputType<TPart, TForwardArgs>, TKind extends "text" | "file" | "data" = "text">(step: StepWithKind<TPart, TInboundArgs, TForwardArgs, TOutput, TKind>): StepBuilder<OutArgsOf<TOutput>>;
43
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./builder.js";
2
+ export * as A2A from "./a2a.js";
3
+ export type { Engine as AgentEngine } from "./a2a.js";
@@ -0,0 +1,2 @@
1
+ export * from "./builder.js";
2
+ export * as A2A from "./a2a.js";
@@ -2,9 +2,7 @@
2
2
  * Copyright 2025 The Artinet Project
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- import { TaskPushNotificationConfig, TaskIdParams, Task } from "../schemas/a2a/index.js";
6
- import type { AgentCard, TaskQueryParams, MessageSendParams, Message } from "../schemas/a2a/index.js";
7
- import { UpdateEvent } from "./services/a2a/index.js";
5
+ import { A2A } from "./a2a/index.js";
8
6
  /**
9
7
  * @interface Client
10
8
  * @description Defines the standard contract for an A2A (Agent-to-Agent) client implementation.
@@ -19,24 +17,24 @@ export interface Client {
19
17
  * The AgentCard contains essential information about the agent, such as its capabilities and endpoints.
20
18
  * @param {string} wellKnownPath The standard path (e.g., "/.well-known/a2a") to look for the AgentCard.
21
19
  * @param {string} fallbackPath An alternative path to check if the well-known path fails.
22
- * @returns {Promise<AgentCard>} A promise that resolves with the AgentCard object.
20
+ * @returns {Promise<A2A.AgentCard>} A promise that resolves with the AgentCard object.
23
21
  * @async
24
22
  */
25
- agentCard(): Promise<AgentCard>;
23
+ agentCard(): Promise<A2A.AgentCard>;
26
24
  /**
27
25
  * @description Refreshes the cached AgentCard information by re-fetching it from the server.
28
26
  * Useful when the agent's capabilities or configuration might have changed.
29
- * @returns {Promise<AgentCard>} A promise that resolves with the updated AgentCard object.
27
+ * @returns {Promise<A2A.AgentCard>} A promise that resolves with the updated AgentCard object.
30
28
  * @async
31
29
  */
32
- refreshAgentCard(): Promise<AgentCard>;
30
+ refreshAgentCard(): Promise<A2A.AgentCard>;
33
31
  /**
34
32
  * @description Sends a task request to the agent server.
35
- * @param {MessageSendParams} params Parameters required to send the task, including the task definition and metadata.
36
- * @returns {Promise<Task | null>} A promise that resolves with the initial Task object representing the submitted task, or null if the submission failed.
33
+ * @param {A2A.MessageSendParams} params Parameters required to send the task, including the task definition and metadata.
34
+ * @returns {Promise<A2A.Task | null>} A promise that resolves with the initial Task object representing the submitted task, or null if the submission failed.
37
35
  * @async
38
36
  */
39
- sendMessage(params: MessageSendParams): Promise<Message | Task | null>;
37
+ sendMessage(params: A2A.MessageSendParams): Promise<A2A.Message | A2A.Task | null>;
40
38
  /**
41
39
  * @deprecated Will be removed in v6.Use sendMessage instead.
42
40
  * @description Sends a task request to the agent server.
@@ -44,7 +42,7 @@ export interface Client {
44
42
  * @returns {Promise<Task | null>} A promise that resolves with the initial Task object representing the submitted task, or null if the submission failed.
45
43
  * @async
46
44
  */
47
- sendTask(params: MessageSendParams): Promise<Message | Task | null>;
45
+ sendTask(params: A2A.MessageSendParams): Promise<A2A.Message | A2A.Task | null>;
48
46
  /**
49
47
  * @description Sends a task request and subscribes to real-time updates (status changes, artifact updates) for that task.
50
48
  * This uses a streaming connection if available.
@@ -52,7 +50,7 @@ export interface Client {
52
50
  * @returns {AsyncIterable<UpdateEvent>} An async iterable that yields task status and artifact updates.
53
51
  * @async
54
52
  */
55
- sendStreamingMessage(params: MessageSendParams): AsyncIterable<UpdateEvent>;
53
+ sendStreamingMessage(params: A2A.MessageSendParams): AsyncIterable<A2A.Update>;
56
54
  /**
57
55
  * @deprecated Will be removed in v6Use sendStreamingMessage instead.
58
56
  * @description Sends a task request and subscribes to real-time updates (status changes, artifact updates) for that task.
@@ -61,45 +59,45 @@ export interface Client {
61
59
  * @returns {AsyncIterable<UpdateEvent>} An async iterable that yields task status and artifact updates.
62
60
  * @async
63
61
  */
64
- sendTaskSubscribe(params: MessageSendParams): AsyncIterable<UpdateEvent>;
62
+ sendTaskSubscribe(params: A2A.MessageSendParams): AsyncIterable<A2A.Update>;
65
63
  /**
66
64
  * @description Retrieves the current state of a specific task by its ID.
67
- * @param {TaskQueryParams} params Parameters containing the task ID to query.
68
- * @returns {Promise<Task | null>} A promise that resolves with the Task object, or null if the task is not found.
65
+ * @param {A2A.TaskQueryParams} params Parameters containing the task ID to query.
66
+ * @returns {Promise<A2A.Task | null>} A promise that resolves with the Task object, or null if the task is not found.
69
67
  * @async
70
68
  */
71
- getTask(params: TaskQueryParams): Promise<Task | null>;
69
+ getTask(params: A2A.TaskQueryParams): Promise<A2A.Task | null>;
72
70
  /**
73
71
  * @description Sends a request to cancel an ongoing task.
74
- * @param {TaskIdParams} params Parameters containing the ID of the task to cancel.
75
- * @returns {Promise<Task | null>} A promise that resolves with the final state of the cancelled Task object, or null if cancellation failed or the task wasn't found.
72
+ * @param {A2A.TaskIdParams} params Parameters containing the ID of the task to cancel.
73
+ * @returns {Promise<A2A.Task | null>} A promise that resolves with the final state of the cancelled Task object, or null if cancellation failed or the task wasn't found.
76
74
  * @async
77
75
  */
78
- cancelTask(params: TaskIdParams): Promise<Task | null>;
76
+ cancelTask(params: A2A.TaskIdParams): Promise<A2A.Task | null>;
79
77
  /**
80
78
  * @description Configures push notifications for a specific task. This allows the client
81
79
  * to receive updates asynchronously via a specified webhook URL.
82
80
  * Requires the agent to support the 'pushNotifications' capability.
83
- * @param {TaskPushNotificationConfig} params The configuration details for the push notification, including the task ID and webhook URL.
84
- * @returns {Promise<TaskPushNotificationConfig | null>} A promise that resolves with the applied configuration, or null if the configuration failed.
81
+ * @param {A2A.TaskPushNotificationConfig} params The configuration details for the push notification, including the task ID and webhook URL.
82
+ * @returns {Promise<A2A.TaskPushNotificationConfig | null>} A promise that resolves with the applied configuration, or null if the configuration failed.
85
83
  * @async
86
84
  */
87
- setTaskPushNotification(params: TaskPushNotificationConfig): Promise<TaskPushNotificationConfig | null>;
85
+ setTaskPushNotification(params: A2A.TaskPushNotificationConfig): Promise<A2A.TaskPushNotificationConfig | null>;
88
86
  /**
89
87
  * @description Retrieves the current push notification configuration for a specific task.
90
- * @param {TaskIdParams} params Parameters containing the task ID.
91
- * @returns {Promise<TaskPushNotificationConfig | null>} A promise that resolves with the push notification configuration, or null if not configured or not found.
88
+ * @param {A2A.TaskIdParams} params Parameters containing the task ID.
89
+ * @returns {Promise<A2A.TaskPushNotificationConfig | null>} A promise that resolves with the push notification configuration, or null if not configured or not found.
92
90
  * @async
93
91
  */
94
- getTaskPushNotification(params: TaskIdParams): Promise<TaskPushNotificationConfig | null>;
92
+ getTaskPushNotification(params: A2A.TaskIdParams): Promise<A2A.TaskPushNotificationConfig | null>;
95
93
  /**
96
94
  * @description Resubscribes to updates for an existing task, potentially after a connection drop or client restart.
97
95
  * This allows resuming the stream of status and artifact updates.
98
- * @param {TaskQueryParams} params Parameters containing the task ID to resubscribe to.
96
+ * @param {A2A.TaskQueryParams} params Parameters containing the task ID to resubscribe to.
99
97
  * @returns {AsyncIterable<UpdateEvent>} An async iterable that yields task status and artifact updates.
100
98
  * @async
101
99
  */
102
- resubscribeTask(params: TaskQueryParams): AsyncIterable<UpdateEvent>;
100
+ resubscribeTask(params: A2A.TaskQueryParams): AsyncIterable<A2A.Update>;
103
101
  /**
104
102
  * @description Checks if the agent server supports a specific capability.
105
103
  * @param {"streaming" | "pushNotifications" | "stateTransitionHistory"} capability The capability to check for.
@@ -0,0 +1,31 @@
1
+ import { EventEmitter } from "events";
2
+ export interface Service<Params extends object = object, Result extends unknown = void> {
3
+ execute: (params: Params) => Promise<Result>;
4
+ stop: () => Promise<void>;
5
+ }
6
+ export interface Context<State extends object = object> {
7
+ readonly contextId: string;
8
+ readonly isCancelled: () => Promise<boolean>;
9
+ readonly abortSignal: AbortSignal;
10
+ readonly messages?: AsyncIterable<unknown>;
11
+ readonly publisher?: Publisher;
12
+ readonly getState: (args?: string) => Promise<State | undefined>;
13
+ metadata?: Record<string, unknown>;
14
+ readonly hooks?: Record<string, (...args: unknown[]) => Promise<unknown>>;
15
+ }
16
+ export interface Manager<T = object> {
17
+ get: (id: string) => Promise<T | undefined>;
18
+ set: (id: string, data?: T) => Promise<void>;
19
+ delete: (id: string) => Promise<void>;
20
+ has?: (id: string) => Promise<boolean>;
21
+ list?: () => Promise<T[]>;
22
+ }
23
+ export type Optional<T extends object = object> = Partial<T> & {
24
+ contextId: string;
25
+ };
26
+ export interface Contexts<T extends Context = Context> extends Manager<T> {
27
+ }
28
+ export interface Publisher<EventMap extends Record<string, any[]> = Record<string, any[]>> extends EventEmitter<EventMap> {
29
+ }
30
+ export interface Consumer<Received extends unknown, EventMap extends Record<string, any[]> = Record<string, any[]>> extends AsyncIterable<Received, Received, Received | undefined>, Publisher<EventMap> {
31
+ }
@@ -0,0 +1 @@
1
+ export * as core from "./core.js";
@@ -0,0 +1 @@
1
+ export * as core from "./core.js";
@@ -1,4 +1,7 @@
1
- export * from "./ext.js";
2
- export * from "./schemas/index.js";
3
- export * from "./interfaces/index.js";
1
+ export * from "./a2a/index.js";
2
+ export * from "./core/index.js";
3
+ export * from "./mcp/index.js";
4
+ export * from "./client.js";
5
+ export * from "./protocol.js";
6
+ export * from "./storage.js";
4
7
  export * from "./utils/index.js";
@@ -1,4 +1,7 @@
1
- export * from "./ext.js";
2
- export * from "./schemas/index.js";
3
- export * from "./interfaces/index.js";
1
+ export * from "./a2a/index.js";
2
+ export * from "./core/index.js";
3
+ export * from "./mcp/index.js";
4
+ export * from "./client.js";
5
+ export * from "./protocol.js";
6
+ export * from "./storage.js";
4
7
  export * from "./utils/index.js";
@@ -0,0 +1 @@
1
+ export * as MCP from "./mcp.js";
@@ -0,0 +1 @@
1
+ export * as MCP from "./mcp.js";