@artinet/sdk 0.5.4 → 0.5.6

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 (622) hide show
  1. package/CHANGELOG.md +106 -20
  2. package/README.md +472 -215
  3. package/dist/client/a2a-client.js +6 -1
  4. package/dist/client/a2a-client.js.map +1 -1
  5. package/dist/index.js +3 -2
  6. package/dist/index.js.map +1 -1
  7. package/dist/server/express/errors.js +51 -0
  8. package/dist/server/express/errors.js.map +1 -0
  9. package/dist/server/express/index.js +4 -0
  10. package/dist/server/express/index.js.map +1 -0
  11. package/dist/server/express/middeware.js +116 -0
  12. package/dist/server/express/middeware.js.map +1 -0
  13. package/dist/server/express/server.js +80 -0
  14. package/dist/server/express/server.js.map +1 -0
  15. package/dist/server/index.js +1 -7
  16. package/dist/server/index.js.map +1 -1
  17. package/dist/services/a2a/factory/builder.js +392 -0
  18. package/dist/services/a2a/factory/builder.js.map +1 -0
  19. package/dist/services/a2a/factory/context.js +151 -0
  20. package/dist/services/a2a/factory/context.js.map +1 -0
  21. package/dist/services/a2a/factory/event.js +182 -0
  22. package/dist/services/a2a/factory/event.js.map +1 -0
  23. package/dist/services/a2a/factory/index.js +6 -0
  24. package/dist/services/a2a/factory/index.js.map +1 -0
  25. package/dist/services/a2a/factory/method.js +15 -0
  26. package/dist/services/a2a/factory/method.js.map +1 -0
  27. package/dist/services/a2a/factory/service.js +12 -0
  28. package/dist/services/a2a/factory/service.js.map +1 -0
  29. package/dist/services/a2a/helpers/index.js +2 -0
  30. package/dist/services/a2a/helpers/index.js.map +1 -0
  31. package/dist/services/a2a/helpers/part.js +47 -0
  32. package/dist/services/a2a/helpers/part.js.map +1 -0
  33. package/dist/services/a2a/index.js +5 -1
  34. package/dist/services/a2a/index.js.map +1 -1
  35. package/dist/services/a2a/managers/cancellation.js +17 -0
  36. package/dist/services/a2a/managers/cancellation.js.map +1 -0
  37. package/dist/services/a2a/managers/connection.js +17 -0
  38. package/dist/services/a2a/managers/connection.js.map +1 -0
  39. package/dist/services/a2a/managers/context.js +17 -0
  40. package/dist/services/a2a/managers/context.js.map +1 -0
  41. package/dist/services/a2a/managers/index.js +6 -0
  42. package/dist/services/a2a/managers/index.js.map +1 -0
  43. package/dist/services/a2a/managers/task.js +17 -0
  44. package/dist/services/a2a/managers/task.js.map +1 -0
  45. package/dist/services/a2a/methods/cancel-task.js +47 -0
  46. package/dist/services/a2a/methods/cancel-task.js.map +1 -0
  47. package/dist/services/a2a/methods/get-task.js +15 -0
  48. package/dist/services/a2a/methods/get-task.js.map +1 -0
  49. package/dist/services/a2a/methods/index.js +6 -0
  50. package/dist/services/a2a/methods/index.js.map +1 -0
  51. package/dist/services/a2a/methods/resubscribe-task.js +77 -0
  52. package/dist/services/a2a/methods/resubscribe-task.js.map +1 -0
  53. package/dist/services/a2a/methods/send-message.js +20 -0
  54. package/dist/services/a2a/methods/send-message.js.map +1 -0
  55. package/dist/services/a2a/methods/stream-message.js +39 -0
  56. package/dist/services/a2a/methods/stream-message.js.map +1 -0
  57. package/dist/services/a2a/service.js +88 -239
  58. package/dist/services/a2a/service.js.map +1 -1
  59. package/dist/services/a2a/state/index.js +4 -0
  60. package/dist/services/a2a/state/index.js.map +1 -0
  61. package/dist/services/a2a/state/load.js +43 -0
  62. package/dist/services/a2a/state/load.js.map +1 -0
  63. package/dist/services/a2a/state/process.js +14 -0
  64. package/dist/services/a2a/state/process.js.map +1 -0
  65. package/dist/services/a2a/state/update/artifact.js +40 -0
  66. package/dist/services/a2a/state/update/artifact.js.map +1 -0
  67. package/dist/services/a2a/state/update/index.js +3 -0
  68. package/dist/services/a2a/state/update/index.js.map +1 -0
  69. package/dist/{server/lib/update/base.js → services/a2a/state/update/update.js} +23 -9
  70. package/dist/services/a2a/state/update/update.js.map +1 -0
  71. package/dist/services/core/execution/execute.js +26 -0
  72. package/dist/services/core/execution/execute.js.map +1 -0
  73. package/dist/services/core/execution/index.js +2 -0
  74. package/dist/services/core/execution/index.js.map +1 -0
  75. package/dist/services/core/index.js +3 -0
  76. package/dist/services/core/index.js.map +1 -0
  77. package/dist/services/core/managers/command.js +95 -0
  78. package/dist/services/core/managers/command.js.map +1 -0
  79. package/dist/services/core/managers/event.js +57 -0
  80. package/dist/services/core/managers/event.js.map +1 -0
  81. package/dist/services/core/managers/index.js +4 -0
  82. package/dist/services/core/managers/index.js.map +1 -0
  83. package/dist/services/core/managers/stream.js +78 -0
  84. package/dist/services/core/managers/stream.js.map +1 -0
  85. package/dist/services/index.js +2 -1
  86. package/dist/services/index.js.map +1 -1
  87. package/dist/transport/index.js +1 -1
  88. package/dist/transport/index.js.map +1 -1
  89. package/dist/transport/rpc/parser.js +13 -5
  90. package/dist/transport/rpc/parser.js.map +1 -1
  91. package/dist/transport/rpc/rpc-client.js +10 -2
  92. package/dist/transport/rpc/rpc-client.js.map +1 -1
  93. package/dist/transport/streaming/event-stream.js +5 -1
  94. package/dist/transport/streaming/event-stream.js.map +1 -1
  95. package/dist/transport/trpc/a2a/factory/index.js +2 -0
  96. package/dist/transport/trpc/a2a/factory/index.js.map +1 -0
  97. package/dist/transport/trpc/a2a/factory/router.js +17 -0
  98. package/dist/transport/trpc/a2a/factory/router.js.map +1 -0
  99. package/dist/transport/trpc/a2a/index.js +4 -0
  100. package/dist/transport/trpc/a2a/index.js.map +1 -0
  101. package/dist/transport/trpc/a2a/routes/index.js +4 -0
  102. package/dist/transport/trpc/a2a/routes/index.js.map +1 -0
  103. package/dist/transport/trpc/a2a/routes/info.js +10 -0
  104. package/dist/transport/trpc/a2a/routes/info.js.map +1 -0
  105. package/dist/transport/trpc/a2a/routes/message/index.js +2 -0
  106. package/dist/transport/trpc/a2a/routes/message/index.js.map +1 -0
  107. package/dist/transport/trpc/a2a/routes/message/route.js +38 -0
  108. package/dist/transport/trpc/a2a/routes/message/route.js.map +1 -0
  109. package/dist/transport/trpc/a2a/routes/tasks/index.js +2 -0
  110. package/dist/transport/trpc/a2a/routes/tasks/index.js.map +1 -0
  111. package/dist/transport/trpc/a2a/routes/tasks/route.js +71 -0
  112. package/dist/transport/trpc/a2a/routes/tasks/route.js.map +1 -0
  113. package/dist/transport/trpc/a2a/trpc.js +36 -0
  114. package/dist/transport/trpc/a2a/trpc.js.map +1 -0
  115. package/dist/transport/trpc/index.js +2 -0
  116. package/dist/transport/trpc/index.js.map +1 -0
  117. package/dist/types/client/a2a-client.d.ts +5 -1
  118. package/dist/types/client/a2a-client.d.ts.map +1 -1
  119. package/dist/types/ext.js +11 -0
  120. package/dist/types/ext.js.map +1 -0
  121. package/dist/types/index.d.ts +3 -2
  122. package/dist/types/index.d.ts.map +1 -1
  123. package/dist/types/index.js +3 -4
  124. package/dist/types/index.js.map +1 -1
  125. package/dist/types/interfaces/client.js +6 -0
  126. package/dist/types/interfaces/client.js.map +1 -0
  127. package/dist/types/interfaces/index.js +4 -0
  128. package/dist/types/interfaces/index.js.map +1 -0
  129. package/dist/types/interfaces/services/a2a/builder.js +2 -0
  130. package/dist/types/interfaces/services/a2a/builder.js.map +1 -0
  131. package/dist/types/interfaces/services/a2a/context.js +6 -0
  132. package/dist/types/interfaces/services/a2a/context.js.map +1 -0
  133. package/dist/types/interfaces/services/a2a/engine.js +6 -0
  134. package/dist/types/interfaces/services/a2a/engine.js.map +1 -0
  135. package/dist/types/interfaces/services/a2a/index.js +6 -0
  136. package/dist/types/interfaces/services/a2a/index.js.map +1 -0
  137. package/dist/types/interfaces/services/a2a/legacy.js +6 -0
  138. package/dist/types/interfaces/services/a2a/legacy.js.map +1 -0
  139. package/dist/types/interfaces/services/a2a/service.js +6 -0
  140. package/dist/types/interfaces/services/a2a/service.js.map +1 -0
  141. package/dist/types/interfaces/services/core/context/command.js +6 -0
  142. package/dist/types/interfaces/services/core/context/command.js.map +1 -0
  143. package/dist/types/interfaces/services/core/context/context.js +6 -0
  144. package/dist/types/interfaces/services/core/context/context.js.map +1 -0
  145. package/dist/types/interfaces/services/core/context/index.js +4 -0
  146. package/dist/types/interfaces/services/core/context/index.js.map +1 -0
  147. package/dist/types/interfaces/services/core/context/types.js +6 -0
  148. package/dist/types/interfaces/services/core/context/types.js.map +1 -0
  149. package/dist/types/interfaces/services/core/execution/engine.js +6 -0
  150. package/dist/types/interfaces/services/core/execution/engine.js.map +1 -0
  151. package/dist/types/interfaces/services/core/execution/environment.js +6 -0
  152. package/dist/types/interfaces/services/core/execution/environment.js.map +1 -0
  153. package/dist/types/interfaces/services/core/execution/execute.js +6 -0
  154. package/dist/types/interfaces/services/core/execution/execute.js.map +1 -0
  155. package/dist/types/interfaces/services/core/execution/index.js +4 -0
  156. package/dist/types/interfaces/services/core/execution/index.js.map +1 -0
  157. package/dist/types/interfaces/services/core/index.js +5 -0
  158. package/dist/types/interfaces/services/core/index.js.map +1 -0
  159. package/dist/types/interfaces/services/core/managers/cancellation.js +6 -0
  160. package/dist/types/interfaces/services/core/managers/cancellation.js.map +1 -0
  161. package/dist/types/interfaces/services/core/managers/connection.js +6 -0
  162. package/dist/types/interfaces/services/core/managers/connection.js.map +1 -0
  163. package/dist/types/interfaces/services/core/managers/context.js +6 -0
  164. package/dist/types/interfaces/services/core/managers/context.js.map +1 -0
  165. package/dist/types/interfaces/services/core/managers/event.js +6 -0
  166. package/dist/types/interfaces/services/core/managers/event.js.map +1 -0
  167. package/dist/types/interfaces/services/core/managers/index.js +7 -0
  168. package/dist/types/interfaces/services/core/managers/index.js.map +1 -0
  169. package/dist/types/interfaces/services/core/managers/stream.js +6 -0
  170. package/dist/types/interfaces/services/core/managers/stream.js.map +1 -0
  171. package/dist/types/interfaces/services/core/managers/task.js +2 -0
  172. package/dist/types/interfaces/services/core/managers/task.js.map +1 -0
  173. package/dist/types/interfaces/services/core/service.js +6 -0
  174. package/dist/types/interfaces/services/core/service.js.map +1 -0
  175. package/dist/types/interfaces/services/index.js +4 -0
  176. package/dist/types/interfaces/services/index.js.map +1 -0
  177. package/dist/types/{services → interfaces/services}/protocol.js +4 -0
  178. package/dist/types/interfaces/services/protocol.js.map +1 -0
  179. package/dist/types/interfaces/storage.js +6 -0
  180. package/dist/types/interfaces/storage.js.map +1 -0
  181. package/dist/types/schemas/a2a/agent.js +319 -0
  182. package/dist/types/schemas/a2a/agent.js.map +1 -0
  183. package/dist/types/schemas/a2a/auth.js +274 -0
  184. package/dist/types/schemas/a2a/auth.js.map +1 -0
  185. package/dist/types/schemas/a2a/error.js +119 -0
  186. package/dist/types/schemas/a2a/error.js.map +1 -1
  187. package/dist/types/schemas/a2a/index.js +8 -4
  188. package/dist/types/schemas/a2a/index.js.map +1 -1
  189. package/dist/types/schemas/a2a/kind.js +21 -0
  190. package/dist/types/schemas/a2a/kind.js.map +1 -0
  191. package/dist/types/schemas/a2a/message.js +130 -1
  192. package/dist/types/schemas/a2a/message.js.map +1 -1
  193. package/dist/types/schemas/a2a/notification.js +202 -1
  194. package/dist/types/schemas/a2a/notification.js.map +1 -1
  195. package/dist/types/schemas/a2a/parameters.js +241 -1
  196. package/dist/types/schemas/a2a/parameters.js.map +1 -1
  197. package/dist/types/schemas/a2a/protocol.js +60 -0
  198. package/dist/types/schemas/a2a/protocol.js.map +1 -0
  199. package/dist/types/schemas/a2a/rpc.js +126 -1
  200. package/dist/types/schemas/a2a/rpc.js.map +1 -1
  201. package/dist/types/schemas/a2a/task.js +131 -12
  202. package/dist/types/schemas/a2a/task.js.map +1 -1
  203. package/dist/types/schemas/a2a/transport.js +28 -0
  204. package/dist/types/schemas/a2a/transport.js.map +1 -0
  205. package/dist/types/schemas/deployment/index.js +3 -0
  206. package/dist/types/schemas/deployment/index.js.map +1 -0
  207. package/dist/types/schemas/deployment/proxy.js +6 -0
  208. package/dist/types/schemas/deployment/proxy.js.map +1 -0
  209. package/dist/types/schemas/deployment/request.js +88 -0
  210. package/dist/types/schemas/deployment/request.js.map +1 -0
  211. package/dist/types/schemas/index.js +1 -0
  212. package/dist/types/schemas/index.js.map +1 -1
  213. package/dist/types/server/express/errors.d.ts +10 -0
  214. package/dist/types/server/express/errors.d.ts.map +1 -0
  215. package/dist/types/server/express/index.d.ts +4 -0
  216. package/dist/types/server/express/index.d.ts.map +1 -0
  217. package/dist/types/server/express/middeware.d.ts +8 -0
  218. package/dist/types/server/express/middeware.d.ts.map +1 -0
  219. package/dist/types/server/express/server.d.ts +71 -0
  220. package/dist/types/server/express/server.d.ts.map +1 -0
  221. package/dist/types/server/index.d.ts +1 -7
  222. package/dist/types/server/index.d.ts.map +1 -1
  223. package/dist/types/services/a2a/factory/builder.d.ts +352 -0
  224. package/dist/types/services/a2a/factory/builder.d.ts.map +1 -0
  225. package/dist/types/services/a2a/factory/context.d.ts +133 -0
  226. package/dist/types/services/a2a/factory/context.d.ts.map +1 -0
  227. package/dist/types/services/a2a/factory/event.d.ts +59 -0
  228. package/dist/types/services/a2a/factory/event.d.ts.map +1 -0
  229. package/dist/types/services/a2a/factory/index.d.ts +6 -0
  230. package/dist/types/services/a2a/factory/index.d.ts.map +1 -0
  231. package/dist/types/services/a2a/factory/method.d.ts +7 -0
  232. package/dist/types/services/a2a/factory/method.d.ts.map +1 -0
  233. package/dist/types/services/a2a/factory/service.d.ts +10 -0
  234. package/dist/types/services/a2a/factory/service.d.ts.map +1 -0
  235. package/dist/types/services/a2a/helpers/index.d.ts +2 -0
  236. package/dist/types/services/a2a/helpers/index.d.ts.map +1 -0
  237. package/dist/types/services/a2a/helpers/part.d.ts +49 -0
  238. package/dist/types/services/a2a/helpers/part.d.ts.map +1 -0
  239. package/dist/types/services/a2a/index.d.ts +5 -1
  240. package/dist/types/services/a2a/index.d.ts.map +1 -1
  241. package/dist/types/services/a2a/managers/cancellation.d.ts +12 -0
  242. package/dist/types/services/a2a/managers/cancellation.d.ts.map +1 -0
  243. package/dist/types/services/a2a/managers/connection.d.ts +12 -0
  244. package/dist/types/services/a2a/managers/connection.d.ts.map +1 -0
  245. package/dist/types/services/a2a/managers/context.d.ts +12 -0
  246. package/dist/types/services/a2a/managers/context.d.ts.map +1 -0
  247. package/dist/types/services/a2a/managers/index.d.ts +6 -0
  248. package/dist/types/services/a2a/managers/index.d.ts.map +1 -0
  249. package/dist/types/services/a2a/managers/task.d.ts +12 -0
  250. package/dist/types/services/a2a/managers/task.d.ts.map +1 -0
  251. package/dist/types/services/a2a/methods/cancel-task.d.ts +8 -0
  252. package/dist/types/services/a2a/methods/cancel-task.d.ts.map +1 -0
  253. package/dist/types/services/a2a/methods/get-task.d.ts +113 -0
  254. package/dist/types/services/a2a/methods/get-task.d.ts.map +1 -0
  255. package/dist/types/services/a2a/methods/index.d.ts +6 -0
  256. package/dist/types/services/a2a/methods/index.d.ts.map +1 -0
  257. package/dist/types/services/a2a/methods/resubscribe-task.d.ts +8 -0
  258. package/dist/types/services/a2a/methods/resubscribe-task.d.ts.map +1 -0
  259. package/dist/types/services/a2a/methods/send-message.d.ts +8 -0
  260. package/dist/types/services/a2a/methods/send-message.d.ts.map +1 -0
  261. package/dist/types/services/a2a/methods/stream-message.d.ts +9 -0
  262. package/dist/types/services/a2a/methods/stream-message.d.ts.map +1 -0
  263. package/dist/types/services/a2a/service.d.ts +375 -41
  264. package/dist/types/services/a2a/service.d.ts.map +1 -1
  265. package/dist/types/services/a2a/state/index.d.ts +4 -0
  266. package/dist/types/services/a2a/state/index.d.ts.map +1 -0
  267. package/dist/types/services/a2a/state/load.d.ts +15 -0
  268. package/dist/types/services/a2a/state/load.d.ts.map +1 -0
  269. package/dist/types/services/a2a/state/process.d.ts +8 -0
  270. package/dist/types/services/a2a/state/process.d.ts.map +1 -0
  271. package/dist/types/services/a2a/state/update/artifact.d.ts +11 -0
  272. package/dist/types/services/a2a/state/update/artifact.d.ts.map +1 -0
  273. package/dist/types/services/a2a/state/update/index.d.ts +3 -0
  274. package/dist/types/services/a2a/state/update/index.d.ts.map +1 -0
  275. package/dist/types/services/a2a/state/update/update.d.ts +24 -0
  276. package/dist/types/services/a2a/state/update/update.d.ts.map +1 -0
  277. package/dist/types/services/core/execution/execute.d.ts +7 -0
  278. package/dist/types/services/core/execution/execute.d.ts.map +1 -0
  279. package/dist/types/services/core/execution/index.d.ts +2 -0
  280. package/dist/types/services/core/execution/index.d.ts.map +1 -0
  281. package/dist/types/services/core/index.d.ts +3 -0
  282. package/dist/types/services/core/index.d.ts.map +1 -0
  283. package/dist/types/services/core/managers/command.d.ts +40 -0
  284. package/dist/types/services/core/managers/command.d.ts.map +1 -0
  285. package/dist/types/services/core/managers/event.d.ts +19 -0
  286. package/dist/types/services/core/managers/event.d.ts.map +1 -0
  287. package/dist/types/services/core/managers/index.d.ts +4 -0
  288. package/dist/types/services/core/managers/index.d.ts.map +1 -0
  289. package/dist/types/services/core/managers/stream.d.ts +21 -0
  290. package/dist/types/services/core/managers/stream.d.ts.map +1 -0
  291. package/dist/types/services/index.d.ts +2 -1
  292. package/dist/types/services/index.d.ts.map +1 -1
  293. package/dist/types/transport/index.d.ts +1 -1
  294. package/dist/types/transport/index.d.ts.map +1 -1
  295. package/dist/types/transport/rpc/parser.d.ts +5 -1
  296. package/dist/types/transport/rpc/parser.d.ts.map +1 -1
  297. package/dist/types/transport/rpc/rpc-client.d.ts +5 -1
  298. package/dist/types/transport/rpc/rpc-client.d.ts.map +1 -1
  299. package/dist/types/transport/streaming/event-stream.d.ts +5 -1
  300. package/dist/types/transport/streaming/event-stream.d.ts.map +1 -1
  301. package/dist/types/transport/trpc/a2a/factory/index.d.ts +2 -0
  302. package/dist/types/transport/trpc/a2a/factory/index.d.ts.map +1 -0
  303. package/dist/types/transport/trpc/a2a/factory/router.d.ts +2631 -0
  304. package/dist/types/transport/trpc/a2a/factory/router.d.ts.map +1 -0
  305. package/dist/types/transport/trpc/a2a/index.d.ts +4 -0
  306. package/dist/types/transport/trpc/a2a/index.d.ts.map +1 -0
  307. package/dist/types/transport/trpc/a2a/routes/index.d.ts +4 -0
  308. package/dist/types/transport/trpc/a2a/routes/index.d.ts.map +1 -0
  309. package/dist/types/transport/trpc/a2a/routes/info.d.ts +102 -0
  310. package/dist/types/transport/trpc/a2a/routes/info.d.ts.map +1 -0
  311. package/dist/types/transport/trpc/a2a/routes/message/index.d.ts +2 -0
  312. package/dist/types/transport/trpc/a2a/routes/message/index.d.ts.map +1 -0
  313. package/dist/types/transport/trpc/a2a/routes/message/route.d.ts +523 -0
  314. package/dist/types/transport/trpc/a2a/routes/message/route.d.ts.map +1 -0
  315. package/dist/types/transport/trpc/a2a/routes/tasks/index.d.ts +2 -0
  316. package/dist/types/transport/trpc/a2a/routes/tasks/index.d.ts.map +1 -0
  317. package/dist/types/transport/trpc/a2a/routes/tasks/route.d.ts +646 -0
  318. package/dist/types/transport/trpc/a2a/routes/tasks/route.d.ts.map +1 -0
  319. package/dist/types/transport/trpc/a2a/trpc.d.ts +272 -0
  320. package/dist/types/transport/trpc/a2a/trpc.d.ts.map +1 -0
  321. package/dist/types/transport/trpc/index.d.ts +2 -0
  322. package/dist/types/transport/trpc/index.d.ts.map +1 -0
  323. package/dist/types/types/ext.d.ts +14 -0
  324. package/dist/types/types/ext.d.ts.map +1 -0
  325. package/dist/types/types/index.d.ts +3 -4
  326. package/dist/types/types/index.d.ts.map +1 -1
  327. package/dist/types/types/{client.d.ts → interfaces/client.d.ts} +7 -2
  328. package/dist/types/types/interfaces/client.d.ts.map +1 -0
  329. package/dist/types/types/interfaces/index.d.ts +4 -0
  330. package/dist/types/types/interfaces/index.d.ts.map +1 -0
  331. package/dist/types/types/interfaces/services/a2a/builder.d.ts +33 -0
  332. package/dist/types/types/interfaces/services/a2a/builder.d.ts.map +1 -0
  333. package/dist/types/types/interfaces/services/a2a/context.d.ts +163 -0
  334. package/dist/types/types/interfaces/services/a2a/context.d.ts.map +1 -0
  335. package/dist/types/types/interfaces/services/a2a/engine.d.ts +8 -0
  336. package/dist/types/types/interfaces/services/a2a/engine.d.ts.map +1 -0
  337. package/dist/types/types/interfaces/services/a2a/index.d.ts +6 -0
  338. package/dist/types/types/interfaces/services/a2a/index.d.ts.map +1 -0
  339. package/dist/types/types/interfaces/services/a2a/legacy.d.ts +90 -0
  340. package/dist/types/types/interfaces/services/a2a/legacy.d.ts.map +1 -0
  341. package/dist/types/types/interfaces/services/a2a/service.d.ts +409 -0
  342. package/dist/types/types/interfaces/services/a2a/service.d.ts.map +1 -0
  343. package/dist/types/types/interfaces/services/core/context/command.d.ts +26 -0
  344. package/dist/types/types/interfaces/services/core/context/command.d.ts.map +1 -0
  345. package/dist/types/types/interfaces/services/core/context/context.d.ts +208 -0
  346. package/dist/types/types/interfaces/services/core/context/context.d.ts.map +1 -0
  347. package/dist/types/types/interfaces/services/core/context/index.d.ts +4 -0
  348. package/dist/types/types/interfaces/services/core/context/index.d.ts.map +1 -0
  349. package/dist/types/types/interfaces/services/core/context/types.d.ts +12 -0
  350. package/dist/types/types/interfaces/services/core/context/types.d.ts.map +1 -0
  351. package/dist/types/types/interfaces/services/core/execution/engine.d.ts +107 -0
  352. package/dist/types/types/interfaces/services/core/execution/engine.d.ts.map +1 -0
  353. package/dist/types/types/interfaces/services/core/execution/environment.d.ts +12 -0
  354. package/dist/types/types/interfaces/services/core/execution/environment.d.ts.map +1 -0
  355. package/dist/types/types/interfaces/services/core/execution/execute.d.ts +8 -0
  356. package/dist/types/types/interfaces/services/core/execution/execute.d.ts.map +1 -0
  357. package/dist/types/types/interfaces/services/core/execution/index.d.ts +4 -0
  358. package/dist/types/types/interfaces/services/core/execution/index.d.ts.map +1 -0
  359. package/dist/types/types/interfaces/services/core/index.d.ts +5 -0
  360. package/dist/types/types/interfaces/services/core/index.d.ts.map +1 -0
  361. package/dist/types/types/interfaces/services/core/managers/cancellation.d.ts +10 -0
  362. package/dist/types/types/interfaces/services/core/managers/cancellation.d.ts.map +1 -0
  363. package/dist/types/types/interfaces/services/core/managers/connection.d.ts +10 -0
  364. package/dist/types/types/interfaces/services/core/managers/connection.d.ts.map +1 -0
  365. package/dist/types/types/interfaces/services/core/managers/context.d.ts +18 -0
  366. package/dist/types/types/interfaces/services/core/managers/context.d.ts.map +1 -0
  367. package/dist/types/types/interfaces/services/core/managers/event.d.ts +329 -0
  368. package/dist/types/types/interfaces/services/core/managers/event.d.ts.map +1 -0
  369. package/dist/types/types/interfaces/services/core/managers/index.d.ts +7 -0
  370. package/dist/types/types/interfaces/services/core/managers/index.d.ts.map +1 -0
  371. package/dist/types/types/interfaces/services/core/managers/stream.d.ts +218 -0
  372. package/dist/types/types/interfaces/services/core/managers/stream.d.ts.map +1 -0
  373. package/dist/types/types/interfaces/services/core/managers/task.d.ts +10 -0
  374. package/dist/types/types/interfaces/services/core/managers/task.d.ts.map +1 -0
  375. package/dist/types/types/interfaces/services/core/service.d.ts +116 -0
  376. package/dist/types/types/interfaces/services/core/service.d.ts.map +1 -0
  377. package/dist/types/types/interfaces/services/index.d.ts +4 -0
  378. package/dist/types/types/interfaces/services/index.d.ts.map +1 -0
  379. package/dist/types/types/{services → interfaces/services}/protocol.d.ts +4 -0
  380. package/dist/types/types/interfaces/services/protocol.d.ts.map +1 -0
  381. package/dist/types/types/interfaces/storage.d.ts +9 -0
  382. package/dist/types/types/interfaces/storage.d.ts.map +1 -0
  383. package/dist/types/types/schemas/a2a/agent.d.ts +509 -0
  384. package/dist/types/types/schemas/a2a/agent.d.ts.map +1 -0
  385. package/dist/types/types/schemas/a2a/auth.d.ts +285 -0
  386. package/dist/types/types/schemas/a2a/auth.d.ts.map +1 -0
  387. package/dist/types/types/schemas/a2a/error.d.ts +133 -27
  388. package/dist/types/types/schemas/a2a/error.d.ts.map +1 -1
  389. package/dist/types/types/schemas/a2a/index.d.ts +8 -216
  390. package/dist/types/types/schemas/a2a/index.d.ts.map +1 -1
  391. package/dist/types/types/schemas/a2a/kind.d.ts +28 -0
  392. package/dist/types/types/schemas/a2a/kind.d.ts.map +1 -0
  393. package/dist/types/types/schemas/a2a/message.d.ts +2549 -69
  394. package/dist/types/types/schemas/a2a/message.d.ts.map +1 -1
  395. package/dist/types/types/schemas/a2a/notification.d.ts +321 -70
  396. package/dist/types/types/schemas/a2a/notification.d.ts.map +1 -1
  397. package/dist/types/types/schemas/a2a/parameters.d.ts +287 -167
  398. package/dist/types/types/schemas/a2a/parameters.d.ts.map +1 -1
  399. package/dist/types/types/schemas/a2a/protocol.d.ts +3207 -0
  400. package/dist/types/types/schemas/a2a/protocol.d.ts.map +1 -0
  401. package/dist/types/types/schemas/a2a/rpc.d.ts +42 -89
  402. package/dist/types/types/schemas/a2a/rpc.d.ts.map +1 -1
  403. package/dist/types/types/schemas/a2a/task.d.ts +1460 -214
  404. package/dist/types/types/schemas/a2a/task.d.ts.map +1 -1
  405. package/dist/types/types/schemas/a2a/transport.d.ts +28 -0
  406. package/dist/types/types/schemas/a2a/transport.d.ts.map +1 -0
  407. package/dist/types/types/schemas/deployment/index.d.ts +3 -0
  408. package/dist/types/types/schemas/deployment/index.d.ts.map +1 -0
  409. package/dist/types/types/{proxy.d.ts → schemas/deployment/proxy.d.ts} +6 -2
  410. package/dist/types/types/schemas/deployment/proxy.d.ts.map +1 -0
  411. package/dist/types/types/schemas/deployment/request.d.ts +508 -0
  412. package/dist/types/types/schemas/deployment/request.d.ts.map +1 -0
  413. package/dist/types/types/utils/index.d.ts +2 -0
  414. package/dist/types/types/utils/index.d.ts.map +1 -0
  415. package/dist/types/types/{transform.d.ts → utils/transform.d.ts} +4 -0
  416. package/dist/types/types/utils/transform.d.ts.map +1 -0
  417. package/dist/types/utils/api/register.d.ts +4 -0
  418. package/dist/types/utils/api/register.d.ts.map +1 -1
  419. package/dist/types/utils/common/constants.d.ts +8 -4
  420. package/dist/types/utils/common/constants.d.ts.map +1 -1
  421. package/dist/types/utils/common/errors.d.ts +6 -12
  422. package/dist/types/utils/common/errors.d.ts.map +1 -1
  423. package/dist/types/utils/common/utils.d.ts +4 -14
  424. package/dist/types/utils/common/utils.d.ts.map +1 -1
  425. package/dist/types/utils/common/zAsyncIterable.d.ts +23 -0
  426. package/dist/types/utils/common/zAsyncIterable.d.ts.map +1 -0
  427. package/dist/types/utils/deployment/agents.d.ts +5 -1
  428. package/dist/types/utils/deployment/agents.d.ts.map +1 -1
  429. package/dist/types/utils/deployment/bundler.d.ts +4 -0
  430. package/dist/types/utils/deployment/bundler.d.ts.map +1 -1
  431. package/dist/types/utils/deployment/full-deployment.d.ts +12 -2
  432. package/dist/types/utils/deployment/full-deployment.d.ts.map +1 -1
  433. package/dist/types/utils/deployment/index.d.ts +5 -0
  434. package/dist/types/utils/deployment/index.d.ts.map +1 -0
  435. package/dist/types/utils/deployment/task-wrapper.d.ts +6 -2
  436. package/dist/types/utils/deployment/task-wrapper.d.ts.map +1 -1
  437. package/dist/types/utils/deployment/test-deployment.d.ts +7 -2
  438. package/dist/types/utils/deployment/test-deployment.d.ts.map +1 -1
  439. package/dist/types/utils/index.d.ts +4 -6
  440. package/dist/types/utils/index.d.ts.map +1 -1
  441. package/dist/types/utils/index.js +2 -0
  442. package/dist/types/utils/index.js.map +1 -0
  443. package/dist/types/utils/logging/index.d.ts +3 -0
  444. package/dist/types/utils/logging/index.d.ts.map +1 -0
  445. package/dist/types/utils/logging/log.d.ts +4 -0
  446. package/dist/types/utils/logging/log.d.ts.map +1 -1
  447. package/dist/types/utils/logging/logger.d.ts +4 -0
  448. package/dist/types/utils/logging/logger.d.ts.map +1 -1
  449. package/dist/types/{server/lib → utils}/storage/file.d.ts +9 -4
  450. package/dist/types/utils/storage/file.d.ts.map +1 -0
  451. package/dist/types/{server/lib → utils}/storage/memory.d.ts +9 -4
  452. package/dist/types/utils/storage/memory.d.ts.map +1 -0
  453. package/dist/types/{transform.js → utils/transform.js} +2 -1
  454. package/dist/types/utils/transform.js.map +1 -0
  455. package/dist/utils/api/register.js +4 -0
  456. package/dist/utils/api/register.js.map +1 -1
  457. package/dist/utils/common/constants.js +20 -11
  458. package/dist/utils/common/constants.js.map +1 -1
  459. package/dist/utils/common/errors.js +7 -40
  460. package/dist/utils/common/errors.js.map +1 -1
  461. package/dist/utils/common/utils.js +4 -46
  462. package/dist/utils/common/utils.js.map +1 -1
  463. package/dist/utils/common/zAsyncIterable.js +40 -0
  464. package/dist/utils/common/zAsyncIterable.js.map +1 -0
  465. package/dist/utils/deployment/agents.js +4 -0
  466. package/dist/utils/deployment/agents.js.map +1 -1
  467. package/dist/utils/deployment/bundler.js +4 -0
  468. package/dist/utils/deployment/bundler.js.map +1 -1
  469. package/dist/utils/deployment/full-deployment.js +6 -2
  470. package/dist/utils/deployment/full-deployment.js.map +1 -1
  471. package/dist/utils/deployment/index.js +5 -0
  472. package/dist/utils/deployment/index.js.map +1 -0
  473. package/dist/utils/deployment/task-wrapper.js +4 -0
  474. package/dist/utils/deployment/task-wrapper.js.map +1 -1
  475. package/dist/utils/deployment/test-deployment.js +15 -7
  476. package/dist/utils/deployment/test-deployment.js.map +1 -1
  477. package/dist/utils/index.js +10 -6
  478. package/dist/utils/index.js.map +1 -1
  479. package/dist/utils/logging/index.js +3 -0
  480. package/dist/utils/logging/index.js.map +1 -0
  481. package/dist/utils/logging/log.js +4 -0
  482. package/dist/utils/logging/log.js.map +1 -1
  483. package/dist/utils/logging/logger.js +13 -0
  484. package/dist/utils/logging/logger.js.map +1 -1
  485. package/dist/{server/lib → utils}/storage/file.js +17 -6
  486. package/dist/utils/storage/file.js.map +1 -0
  487. package/dist/{server/lib → utils}/storage/memory.js +15 -5
  488. package/dist/utils/storage/memory.js.map +1 -0
  489. package/package.json +16 -5
  490. package/dist/server/a2a-server.js +0 -237
  491. package/dist/server/a2a-server.js.map +0 -1
  492. package/dist/server/interfaces/params.js +0 -3
  493. package/dist/server/interfaces/params.js.map +0 -1
  494. package/dist/server/interfaces/server.js +0 -2
  495. package/dist/server/interfaces/server.js.map +0 -1
  496. package/dist/server/interfaces/store.js +0 -18
  497. package/dist/server/interfaces/store.js.map +0 -1
  498. package/dist/server/lib/express-server.js +0 -252
  499. package/dist/server/lib/express-server.js.map +0 -1
  500. package/dist/server/lib/json-middleware.js +0 -3
  501. package/dist/server/lib/json-middleware.js.map +0 -1
  502. package/dist/server/lib/middleware/a2a-methods.js +0 -140
  503. package/dist/server/lib/middleware/a2a-methods.js.map +0 -1
  504. package/dist/server/lib/middleware/factory.js +0 -59
  505. package/dist/server/lib/middleware/factory.js.map +0 -1
  506. package/dist/server/lib/state.js +0 -80
  507. package/dist/server/lib/state.js.map +0 -1
  508. package/dist/server/lib/storage/file.js.map +0 -1
  509. package/dist/server/lib/storage/memory.js.map +0 -1
  510. package/dist/server/lib/update/base.js.map +0 -1
  511. package/dist/services/a2a/repository.js +0 -160
  512. package/dist/services/a2a/repository.js.map +0 -1
  513. package/dist/services/manager.js +0 -61
  514. package/dist/services/manager.js.map +0 -1
  515. package/dist/services/mcp/index.js +0 -2
  516. package/dist/services/mcp/index.js.map +0 -1
  517. package/dist/services/mcp/service.js +0 -75
  518. package/dist/services/mcp/service.js.map +0 -1
  519. package/dist/transport/streaming/stream.js +0 -111
  520. package/dist/transport/streaming/stream.js.map +0 -1
  521. package/dist/types/client.js +0 -2
  522. package/dist/types/client.js.map +0 -1
  523. package/dist/types/express.js +0 -2
  524. package/dist/types/express.js.map +0 -1
  525. package/dist/types/extended-schema.js +0 -7
  526. package/dist/types/extended-schema.js.map +0 -1
  527. package/dist/types/proxy.js +0 -2
  528. package/dist/types/proxy.js.map +0 -1
  529. package/dist/types/schemas/a2a/auth/auth.js +0 -2
  530. package/dist/types/schemas/a2a/auth/auth.js.map +0 -1
  531. package/dist/types/schemas/a2a/auth/base.js +0 -2
  532. package/dist/types/schemas/a2a/auth/base.js.map +0 -1
  533. package/dist/types/schemas/a2a/auth/index.js +0 -4
  534. package/dist/types/schemas/a2a/auth/index.js.map +0 -1
  535. package/dist/types/schemas/a2a/auth/oauth.js +0 -2
  536. package/dist/types/schemas/a2a/auth/oauth.js.map +0 -1
  537. package/dist/types/schemas/a2a/ref.js +0 -25
  538. package/dist/types/schemas/a2a/ref.js.map +0 -1
  539. package/dist/types/server/a2a-server.d.ts +0 -145
  540. package/dist/types/server/a2a-server.d.ts.map +0 -1
  541. package/dist/types/server/interfaces/params.d.ts +0 -109
  542. package/dist/types/server/interfaces/params.d.ts.map +0 -1
  543. package/dist/types/server/interfaces/server.d.ts +0 -35
  544. package/dist/types/server/interfaces/server.d.ts.map +0 -1
  545. package/dist/types/server/interfaces/store.d.ts +0 -35
  546. package/dist/types/server/interfaces/store.d.ts.map +0 -1
  547. package/dist/types/server/lib/express-server.d.ts +0 -59
  548. package/dist/types/server/lib/express-server.d.ts.map +0 -1
  549. package/dist/types/server/lib/json-middleware.d.ts +0 -3
  550. package/dist/types/server/lib/json-middleware.d.ts.map +0 -1
  551. package/dist/types/server/lib/middleware/a2a-methods.d.ts +0 -7
  552. package/dist/types/server/lib/middleware/a2a-methods.d.ts.map +0 -1
  553. package/dist/types/server/lib/middleware/factory.d.ts +0 -12
  554. package/dist/types/server/lib/middleware/factory.d.ts.map +0 -1
  555. package/dist/types/server/lib/state.d.ts +0 -20
  556. package/dist/types/server/lib/state.d.ts.map +0 -1
  557. package/dist/types/server/lib/storage/file.d.ts.map +0 -1
  558. package/dist/types/server/lib/storage/memory.d.ts.map +0 -1
  559. package/dist/types/server/lib/update/base.d.ts +0 -21
  560. package/dist/types/server/lib/update/base.d.ts.map +0 -1
  561. package/dist/types/services/a2a/repository.d.ts +0 -77
  562. package/dist/types/services/a2a/repository.d.ts.map +0 -1
  563. package/dist/types/services/a2a/repository.js +0 -2
  564. package/dist/types/services/a2a/repository.js.map +0 -1
  565. package/dist/types/services/a2a/service.js +0 -2
  566. package/dist/types/services/a2a/service.js.map +0 -1
  567. package/dist/types/services/context.js +0 -29
  568. package/dist/types/services/context.js.map +0 -1
  569. package/dist/types/services/dispatcher.js +0 -33
  570. package/dist/types/services/dispatcher.js.map +0 -1
  571. package/dist/types/services/index.js +0 -9
  572. package/dist/types/services/index.js.map +0 -1
  573. package/dist/types/services/manager.d.ts +0 -44
  574. package/dist/types/services/manager.d.ts.map +0 -1
  575. package/dist/types/services/manager.js +0 -2
  576. package/dist/types/services/manager.js.map +0 -1
  577. package/dist/types/services/mcp/index.d.ts +0 -2
  578. package/dist/types/services/mcp/index.d.ts.map +0 -1
  579. package/dist/types/services/mcp/service.d.ts +0 -30
  580. package/dist/types/services/mcp/service.d.ts.map +0 -1
  581. package/dist/types/services/mcp/service.js +0 -8
  582. package/dist/types/services/mcp/service.js.map +0 -1
  583. package/dist/types/services/protocol.js.map +0 -1
  584. package/dist/types/services/service.js +0 -2
  585. package/dist/types/services/service.js.map +0 -1
  586. package/dist/types/transform.js.map +0 -1
  587. package/dist/types/transport/streaming/stream.d.ts +0 -42
  588. package/dist/types/transport/streaming/stream.d.ts.map +0 -1
  589. package/dist/types/types/client.d.ts.map +0 -1
  590. package/dist/types/types/express.d.ts +0 -66
  591. package/dist/types/types/express.d.ts.map +0 -1
  592. package/dist/types/types/extended-schema.d.ts +0 -174
  593. package/dist/types/types/extended-schema.d.ts.map +0 -1
  594. package/dist/types/types/proxy.d.ts.map +0 -1
  595. package/dist/types/types/schemas/a2a/auth/auth.d.ts +0 -80
  596. package/dist/types/types/schemas/a2a/auth/auth.d.ts.map +0 -1
  597. package/dist/types/types/schemas/a2a/auth/base.d.ts +0 -16
  598. package/dist/types/types/schemas/a2a/auth/base.d.ts.map +0 -1
  599. package/dist/types/types/schemas/a2a/auth/index.d.ts +0 -4
  600. package/dist/types/types/schemas/a2a/auth/index.d.ts.map +0 -1
  601. package/dist/types/types/schemas/a2a/auth/oauth.d.ts +0 -124
  602. package/dist/types/types/schemas/a2a/auth/oauth.d.ts.map +0 -1
  603. package/dist/types/types/schemas/a2a/ref.d.ts +0 -2057
  604. package/dist/types/types/schemas/a2a/ref.d.ts.map +0 -1
  605. package/dist/types/types/services/a2a/repository.d.ts +0 -85
  606. package/dist/types/types/services/a2a/repository.d.ts.map +0 -1
  607. package/dist/types/types/services/a2a/service.d.ts +0 -29
  608. package/dist/types/types/services/a2a/service.d.ts.map +0 -1
  609. package/dist/types/types/services/context.d.ts +0 -167
  610. package/dist/types/types/services/context.d.ts.map +0 -1
  611. package/dist/types/types/services/dispatcher.d.ts +0 -20
  612. package/dist/types/types/services/dispatcher.d.ts.map +0 -1
  613. package/dist/types/types/services/index.d.ts +0 -9
  614. package/dist/types/types/services/index.d.ts.map +0 -1
  615. package/dist/types/types/services/manager.d.ts +0 -42
  616. package/dist/types/types/services/manager.d.ts.map +0 -1
  617. package/dist/types/types/services/mcp/service.d.ts +0 -57
  618. package/dist/types/types/services/mcp/service.d.ts.map +0 -1
  619. package/dist/types/types/services/protocol.d.ts.map +0 -1
  620. package/dist/types/types/services/service.d.ts +0 -35
  621. package/dist/types/types/services/service.d.ts.map +0 -1
  622. package/dist/types/types/transform.d.ts.map +0 -1
@@ -0,0 +1,392 @@
1
+ /**
2
+ * Copyright 2025 The Artinet Project
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /**
6
+ * @fileoverview A2A Agent Builder and Execution Engine Factory
7
+ *
8
+ * This module provides a fluent builder API for constructing A2A agents and
9
+ * execution engines. It enables declarative definition of multi-step agent
10
+ * workflows with type-safe step composition and automatic execution orchestration.
11
+ *
12
+ * @module A2ABuilder
13
+ * @version 1.0.0
14
+ * @since 0.5.6
15
+ * @author The Artinet Project
16
+ */
17
+ import { TaskState, } from "../../../types/index.js";
18
+ import { createAgent } from "./service.js";
19
+ /**
20
+ * Fluent builder for constructing A2A agent execution engines.
21
+ *
22
+ * The EngineBuilder provides a type-safe, fluent API for composing multi-step
23
+ * agent workflows. It supports method chaining to build complex agent behaviors
24
+ * from individual processing steps, with automatic type inference and validation.
25
+ *
26
+ * @template TCommand - The command type, defaults to MessageSendParams
27
+ * @template TInboundArgs - The arguments type received from previous steps
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const agent = EngineBuilder.create()
32
+ * .text(async ({ command }) => {
33
+ * return `Processing: ${command.message.content}`;
34
+ * })
35
+ * .data(async ({ args }) => {
36
+ * return { processed: true, timestamp: Date.now() };
37
+ * })
38
+ * .text(async ({ args }) => {
39
+ * return `Completed at ${new Date(args[0].timestamp)}`;
40
+ * })
41
+ * .createAgent({ agentCard: myAgentCard });
42
+ * ```
43
+ *
44
+ * @public
45
+ * @since 0.5.6
46
+ */
47
+ export class EngineBuilder {
48
+ //@typescript-eslint/no-explicit-any
49
+ steps = [];
50
+ /**
51
+ * Private constructor to enforce factory method usage.
52
+ *
53
+ * @param steps - Initial steps array
54
+ */
55
+ constructor(
56
+ //@typescript-eslint/no-explicit-any
57
+ steps = []) {
58
+ this.steps = steps;
59
+ }
60
+ /**
61
+ * Creates a new EngineBuilder instance.
62
+ *
63
+ * @template TCommand - The command type for the builder
64
+ * @template TInboundArgs - The initial arguments type
65
+ * @returns A new EngineBuilder instance
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * const builder = EngineBuilder.create<MyCommand, [string, number]>();
70
+ * ```
71
+ */
72
+ static create() {
73
+ return new EngineBuilder();
74
+ }
75
+ addStep(step) {
76
+ return new EngineBuilder([
77
+ ...this.steps,
78
+ step,
79
+ ]);
80
+ }
81
+ /**
82
+ * Adds a text processing step to the workflow.
83
+ *
84
+ * @template TPart - The text part type
85
+ * @template TForwardArgs - Arguments to forward to next step
86
+ * @template TOutput - The output type of the step
87
+ * @param step - The text step implementation
88
+ * @returns New builder instance with updated type parameters
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * builder.text(async ({ command, args }) => {
93
+ * return `Hello, ${command.message.content}!`;
94
+ * });
95
+ * ```
96
+ */
97
+ text(step) {
98
+ return this.addStep({
99
+ step: step,
100
+ kind: "text",
101
+ });
102
+ }
103
+ /**
104
+ * Adds a file processing step to the workflow.
105
+ *
106
+ * @template TPart - The file part type
107
+ * @template TForwardArgs - Arguments to forward to next step
108
+ * @template TOutput - The output type of the step
109
+ * @param step - The file step implementation
110
+ * @returns New builder instance with updated type parameters
111
+ *
112
+ * @example
113
+ * ```typescript
114
+ * builder.file(async ({ command, args }) => {
115
+ * return {
116
+ * name: 'output.txt',
117
+ * mimeType: 'text/plain',
118
+ * bytes: Buffer.from(command.message.content)
119
+ * };
120
+ * });
121
+ * ```
122
+ */
123
+ file(step) {
124
+ return this.addStep({
125
+ step: step,
126
+ kind: "file",
127
+ });
128
+ }
129
+ /**
130
+ * Adds a data processing step to the workflow.
131
+ *
132
+ * @template TPart - The data part type
133
+ * @template TForwardArgs - Arguments to forward to next step
134
+ * @template TOutput - The output type of the step
135
+ * @param step - The data step implementation
136
+ * @returns New builder instance with updated type parameters
137
+ *
138
+ * @example
139
+ * ```typescript
140
+ * builder.data(async ({ command, args }) => {
141
+ * return {
142
+ * analysis: analyzeText(command.message.content),
143
+ * timestamp: Date.now()
144
+ * };
145
+ * });
146
+ * ```
147
+ */
148
+ data(step) {
149
+ return this.addStep({
150
+ step: step,
151
+ kind: "data",
152
+ });
153
+ }
154
+ /**
155
+ * Creates a complete A2A agent using the built workflow.
156
+ *
157
+ * @param params - Agent factory parameters (excluding engine)
158
+ * @returns Configured A2A agent instance
159
+ *
160
+ * @example
161
+ * ```typescript
162
+ * const agent = builder.createAgent({
163
+ * agentCard: {
164
+ * id: 'my-agent',
165
+ * name: 'Assistant Agent',
166
+ * capabilities: ['text-processing']
167
+ * }
168
+ * });
169
+ * ```
170
+ */
171
+ createAgent(params) {
172
+ return createAgent({
173
+ ...params,
174
+ engine: this.createAgentEngine(),
175
+ });
176
+ }
177
+ /**
178
+ * Creates an agent execution engine from the built workflow.
179
+ *
180
+ * @returns Agent execution engine function
181
+ *
182
+ * @example
183
+ * ```typescript
184
+ * const engine = builder.createAgentEngine();
185
+ * // Use engine with service execution
186
+ * ```
187
+ */
188
+ createAgentEngine() {
189
+ return createAgentExecutor(this.build());
190
+ }
191
+ /**
192
+ * Builds the step list for the workflow.
193
+ *
194
+ * @returns Array of workflow steps
195
+ * @throws Error if no steps have been added
196
+ *
197
+ * @example
198
+ * ```typescript
199
+ * const steps = builder.build();
200
+ * ```
201
+ */
202
+ build() {
203
+ if (this.steps.length === 0) {
204
+ throw new Error("No steps provided");
205
+ }
206
+ return this.steps;
207
+ }
208
+ }
209
+ /**
210
+ * Convenience factory function for creating an agent builder with default parameters.
211
+ *
212
+ * @returns New EngineBuilder instance with MessageSendParams command type
213
+ *
214
+ * @example
215
+ * ```typescript
216
+ * const agent = AgentBuilder()
217
+ * .text(async ({ command }) => `Hello ${command.message.content}!`)
218
+ * .createAgent({ agentCard: myCard });
219
+ * ```
220
+ *
221
+ * @public
222
+ * @since 0.5.6
223
+ */
224
+ export const AgentBuilder = () => EngineBuilder.create();
225
+ const partToMessagePart = (kind, part) => {
226
+ switch (kind) {
227
+ case "text": {
228
+ return { kind: "text", text: part };
229
+ }
230
+ case "file": {
231
+ const filePart = part;
232
+ return filePart.uri
233
+ ? {
234
+ kind: "file",
235
+ file: {
236
+ uri: filePart.uri,
237
+ name: filePart.name,
238
+ mimeType: filePart.mimeType,
239
+ },
240
+ }
241
+ : {
242
+ kind: "file",
243
+ file: {
244
+ bytes: filePart.bytes ?? "",
245
+ name: filePart.name,
246
+ mimeType: filePart.mimeType,
247
+ },
248
+ };
249
+ }
250
+ case "data": {
251
+ return { kind: "data", data: part };
252
+ }
253
+ default:
254
+ throw new Error("Invalid part kind");
255
+ }
256
+ };
257
+ /**
258
+ * Creates an agent execution engine from a list of workflow steps.
259
+ *
260
+ * This function transforms a list of step definitions into an executable
261
+ * agent engine that processes commands through the defined workflow,
262
+ * yielding updates as each step completes.
263
+ *
264
+ * @param stepsList - Array of workflow steps to execute
265
+ * @returns Agent execution engine function
266
+ *
267
+ * @example
268
+ * ```typescript
269
+ * const steps = [
270
+ * { kind: 'text', step: greetingStep },
271
+ * { kind: 'data', step: analysisStep }
272
+ * ];
273
+ * const engine = createAgentExecutor(steps);
274
+ * ```
275
+ *
276
+ * @public
277
+ * @since 0.5.6
278
+ */
279
+ export function createAgentExecutor(stepsList) {
280
+ return async function* (context) {
281
+ const stepArgs = {
282
+ command: context.command,
283
+ context: context,
284
+ args: [],
285
+ };
286
+ const contextId = context.command.message.contextId;
287
+ const taskId = context.command.message.taskId;
288
+ const messageId = context.command.message.messageId;
289
+ if (!contextId || !taskId) {
290
+ throw new Error("Context ID and task ID are required");
291
+ }
292
+ const taskStarted = {
293
+ taskId: taskId,
294
+ contextId: contextId,
295
+ kind: "status-update",
296
+ status: {
297
+ state: TaskState.submitted,
298
+ timestamp: new Date().toISOString(),
299
+ },
300
+ final: false,
301
+ };
302
+ yield taskStarted;
303
+ const finalMessage = {
304
+ taskId: taskId,
305
+ contextId: contextId,
306
+ messageId: messageId,
307
+ kind: "message",
308
+ role: "agent",
309
+ parts: [],
310
+ };
311
+ for (const step of stepsList) {
312
+ const ret = await step.step({ ...stepArgs });
313
+ let parts = [];
314
+ if (Array.isArray(ret)) {
315
+ parts = ret.map((part) => partToMessagePart(step.kind, part));
316
+ const taskStatusUpdate = {
317
+ taskId: taskId,
318
+ contextId: contextId,
319
+ kind: "status-update",
320
+ status: {
321
+ state: TaskState.working,
322
+ timestamp: new Date().toISOString(),
323
+ message: {
324
+ messageId: messageId,
325
+ kind: "message",
326
+ role: "agent",
327
+ parts: parts,
328
+ },
329
+ },
330
+ final: false,
331
+ };
332
+ yield taskStatusUpdate;
333
+ }
334
+ else if (typeof ret === "object") {
335
+ parts = Array.isArray(ret.parts)
336
+ ? ret.parts.map((part) => partToMessagePart(step.kind, part))
337
+ : [partToMessagePart(step.kind, ret.parts)];
338
+ const taskStatusUpdate = {
339
+ taskId: taskId,
340
+ contextId: contextId,
341
+ kind: "status-update",
342
+ status: {
343
+ state: TaskState.working,
344
+ timestamp: new Date().toISOString(),
345
+ message: {
346
+ messageId: messageId,
347
+ kind: "message",
348
+ role: "agent",
349
+ parts: parts,
350
+ },
351
+ },
352
+ final: false,
353
+ };
354
+ yield taskStatusUpdate;
355
+ stepArgs.args = ret.args;
356
+ }
357
+ else {
358
+ parts = [partToMessagePart(step.kind, ret)];
359
+ const taskStatusUpdate = {
360
+ taskId: taskId,
361
+ contextId: contextId,
362
+ kind: "status-update",
363
+ status: {
364
+ state: TaskState.working,
365
+ timestamp: new Date().toISOString(),
366
+ message: {
367
+ messageId: messageId,
368
+ kind: "message",
369
+ role: "agent",
370
+ parts: parts,
371
+ },
372
+ },
373
+ final: false,
374
+ };
375
+ yield taskStatusUpdate;
376
+ }
377
+ finalMessage.parts.push(...parts);
378
+ }
379
+ const task = {
380
+ kind: "task",
381
+ id: taskId,
382
+ contextId: contextId,
383
+ status: {
384
+ state: TaskState.completed,
385
+ timestamp: new Date().toISOString(),
386
+ message: finalMessage,
387
+ },
388
+ };
389
+ yield task;
390
+ };
391
+ }
392
+ //# sourceMappingURL=builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder.js","sourceRoot":"","sources":["../../../../src/services/a2a/factory/builder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAWL,SAAS,GASV,gCAAyB;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAkI3C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,aAAa;IAKxB,oCAAoC;IAC5B,KAAK,GAA2D,EAAE,CAAC;IAE3E;;;;OAIG;IACH;IACE,oCAAoC;IACpC,QAAgE,EAAE;QAElE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;;;;;;;;OAWG;IACI,MAAM,CAAC,MAAM;QAIlB,OAAO,IAAI,aAAa,EAA0B,CAAC;IACrD,CAAC;IAED,OAAO,CAaL,IAOC;QAED,OAAO,IAAI,aAAa,CAA+B;YACrD,GAAG,IAAI,CAAC,KAAK;YACb,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACI,IAAI,CAQT,IAAoE;QACpE,OAAO,IAAI,CAAC,OAAO,CAAuC;YACxD,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACI,IAAI,CAQT,IAAoE;QACpE,OAAO,IAAI,CAAC,OAAO,CAAuC;YACxD,IAAI,EAAE,IAAI;YACV,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AAC;YACzB,CAAC;YACD,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QACpC,CAAC;QACD,MAAM,IAAI,GAAS;YACjB,IAAI,EAAE,MAAM;YACZ,EAAE,EAAE,MAAM;YACV,SAAS,EAAE,SAAS;YACpB,MAAM,EAAE;gBACN,KAAK,EAAE,SAAS,CAAC,SAAS;gBAC1B,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACnC,OAAO,EAAE,YAAY;aACtB;SACF,CAAC;QACF,MAAM,IAAI,CAAC;IACb,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,151 @@
1
+ /**
2
+ * Copyright 2025 The Artinet Project
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { createEventManager } from "./event.js";
6
+ import { v4 as uuidv4 } from "uuid";
7
+ import { CommandChannel } from "../../core/managers/command.js";
8
+ /**
9
+ * Creates a command channel proxy for the given command.
10
+ *
11
+ * This function wraps a command in a proxy interface that provides
12
+ * controlled access to command data and may add additional functionality
13
+ * such as validation, logging, or transformation.
14
+ *
15
+ * @template TCommand - The command type, must extend Command
16
+ * @param request - The command to wrap in a proxy
17
+ * @returns Command proxy interface for the request
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * const command: MessageSendParams = {
22
+ * message: {
23
+ * content: 'Hello, world!',
24
+ * recipient: 'agent-123'
25
+ * }
26
+ * };
27
+ *
28
+ * const commandProxy = createCommandChannel(command);
29
+ * // Use commandProxy to access command data safely
30
+ * ```
31
+ *
32
+ * @public
33
+ * @since 0.5.6
34
+ */
35
+ export function createCommandChannel(request) {
36
+ return CommandChannel.create(request);
37
+ }
38
+ /**
39
+ * Creates a complete A2A execution context for command processing.
40
+ *
41
+ * This is the main factory function for creating execution contexts in the A2A
42
+ * framework. It assembles all the necessary components including command proxy,
43
+ * event management, cancellation handling, and state management into a cohesive
44
+ * execution environment.
45
+ *
46
+ * The context serves as the primary execution environment passed to execution
47
+ * engines and provides access to all the resources and capabilities needed
48
+ * for command processing.
49
+ *
50
+ * @template TCommand - The command type, must extend Command
51
+ * @template TState - The state type, must extend State
52
+ * @template TUpdate - The update type, must extend Update
53
+ *
54
+ * @param request - The command to execute
55
+ * @param service - The A2A service instance
56
+ * @param contextManager - Manager for context lifecycle
57
+ * @param abortSignal - Optional abort signal for cancellation
58
+ * @param contextId - Optional context ID (generates UUID if not provided)
59
+ * @param eventOverrides - Optional event manager configuration overrides
60
+ * @returns Fully configured execution context
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * // Basic context creation
65
+ * const context = createContext(
66
+ * messageCommand,
67
+ * a2aService,
68
+ * contextManager
69
+ * );
70
+ *
71
+ * // Execute with the context
72
+ * for await (const update of engine(context)) {
73
+ * console.log('Update:', update);
74
+ * }
75
+ * ```
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * // Context creation with custom options
80
+ * const abortController = new AbortController();
81
+ * const customEventOptions = {
82
+ * onStart: async (ctx) => {
83
+ * console.log('Custom start handler');
84
+ * return initialState;
85
+ * }
86
+ * };
87
+ *
88
+ * const context = createContext(
89
+ * command,
90
+ * service,
91
+ * contextManager,
92
+ * abortController.signal,
93
+ * 'custom-context-id',
94
+ * customEventOptions
95
+ * );
96
+ *
97
+ * // Cancel after 30 seconds
98
+ * setTimeout(() => abortController.abort(), 30000);
99
+ * ```
100
+ *
101
+ * @remarks
102
+ * **Context Lifecycle:**
103
+ * 1. Command proxy is created to wrap the incoming request
104
+ * 2. Event manager is instantiated with service and override options
105
+ * 3. Cancellation mechanisms are configured (abort signal + service cancellation)
106
+ * 4. State accessor is bound to the event manager
107
+ * 5. Complete context is registered with the context manager
108
+ *
109
+ * **Cancellation Handling:**
110
+ * The context provides multiple cancellation mechanisms:
111
+ * - AbortSignal for standard cancellation patterns
112
+ * - Service-level cancellation tracking
113
+ * - Combined cancellation status through isCancelled()
114
+ *
115
+ * **Event Management:**
116
+ * The context includes an event manager that handles:
117
+ * - Execution lifecycle events (start, update, complete, error)
118
+ * - State transitions and persistence
119
+ * - Custom event handling through overrides
120
+ *
121
+ * @public
122
+ * @since 0.5.6
123
+ */
124
+ export function createContext(request, service, contextManager, abortSignal = new AbortController().signal, contextId = uuidv4(), eventOverrides) {
125
+ // Note: Context reuse logic is currently disabled for testing
126
+ // Future versions may re-enable context reuse for performance optimization
127
+ // if (contextId && contextId.length > 0) {
128
+ // //disable for testing
129
+ // const context = contextManager.getContext(contextId);
130
+ // if (!context) {
131
+ // console.error("createExecutionContext", contextId, "Context not found");
132
+ // throw new TRPCError({
133
+ // code: "NOT_FOUND",
134
+ // message: "Context not found",
135
+ // });
136
+ // }
137
+ // return context;
138
+ // }
139
+ let newEventManager;
140
+ const context = {
141
+ contextId: contextId,
142
+ command: createCommandChannel(request),
143
+ events: (newEventManager = createEventManager(service, contextId, eventOverrides)),
144
+ signal: abortSignal,
145
+ isCancelled: () => abortSignal?.aborted || service.isCancelled(contextId),
146
+ State: () => newEventManager.getState(),
147
+ };
148
+ contextManager.setContext(contextId, context);
149
+ return context;
150
+ }
151
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/services/a2a/factory/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0BH,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAiB;IAEjB,OAAO,cAAc,CAAC,MAAM,CAAW,OAAO,CAAC,CAAC;AAClD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqFG;AACH,MAAM,UA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