@artinet/sdk 0.5.18 → 0.6.0-preview.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (434) hide show
  1. package/README.md +36 -617
  2. package/dist/browser/browser.d.ts +1 -1
  3. package/dist/browser/browser.js +1 -1
  4. package/dist/browser/client/a2a-client.d.ts +19 -18
  5. package/dist/browser/client/a2a-client.js +20 -8
  6. package/dist/browser/config/index.d.ts +158 -0
  7. package/dist/browser/config/index.js +155 -0
  8. package/dist/browser/config/observability.d.ts +119 -0
  9. package/dist/browser/config/observability.js +35 -0
  10. package/dist/browser/create/agentcard-builder.d.ts +47 -0
  11. package/dist/browser/create/agentcard-builder.js +65 -0
  12. package/dist/browser/create/base.d.ts +4 -0
  13. package/dist/browser/create/describe.d.ts +8 -0
  14. package/dist/browser/create/describe.js +8 -0
  15. package/dist/browser/create/message-builder.d.ts +78 -0
  16. package/dist/browser/create/message-builder.js +108 -0
  17. package/dist/browser/create/part-builder.d.ts +60 -0
  18. package/dist/browser/create/part-builder.js +81 -0
  19. package/dist/browser/create/task-builder.d.ts +251 -0
  20. package/dist/browser/create/task-builder.js +379 -0
  21. package/dist/browser/transport/rpc/parser.d.ts +2 -2
  22. package/dist/browser/transport/rpc/parser.js +7 -6
  23. package/dist/browser/transport/rpc/rpc-client.d.ts +5 -5
  24. package/dist/browser/transport/rpc/rpc-client.js +6 -6
  25. package/dist/browser/transport/streaming/event-stream.d.ts +3 -3
  26. package/dist/browser/transport/streaming/event-stream.js +11 -10
  27. package/dist/browser/types/a2a/a2a.d.ts +382 -0
  28. package/dist/browser/types/a2a/a2a.js +14 -0
  29. package/dist/browser/types/a2a/index.d.ts +5 -0
  30. package/dist/browser/types/a2a/index.js +1 -0
  31. package/dist/browser/types/{interfaces/client.d.ts → client.d.ts} +25 -27
  32. package/dist/browser/types/core/core.d.ts +31 -0
  33. package/dist/browser/types/core/index.d.ts +1 -0
  34. package/dist/browser/types/core/index.js +1 -0
  35. package/dist/browser/types/index.d.ts +6 -3
  36. package/dist/browser/types/index.js +6 -3
  37. package/dist/browser/types/mcp/index.d.ts +1 -0
  38. package/dist/browser/types/mcp/index.js +1 -0
  39. package/dist/{types/interfaces/services/mcp/service.d.ts → browser/types/mcp/mcp.d.ts} +4 -3
  40. package/dist/browser/types/{interfaces/services/a2a/builder.js → mcp/mcp.js} +1 -1
  41. package/dist/browser/types/storage.d.ts +21 -0
  42. package/dist/browser/utils/common/constants.d.ts +2 -7
  43. package/dist/browser/utils/common/constants.js +5 -32
  44. package/dist/browser/utils/common/errors.d.ts +74 -18
  45. package/dist/browser/utils/common/errors.js +81 -28
  46. package/dist/browser/utils/common/utils.d.ts +23 -0
  47. package/dist/browser/utils/common/utils.js +32 -0
  48. package/dist/client/a2a-client.d.ts +19 -18
  49. package/dist/client/a2a-client.js +20 -8
  50. package/dist/config/default.d.ts +50 -0
  51. package/dist/config/default.js +62 -0
  52. package/dist/config/index.d.ts +158 -0
  53. package/dist/config/index.js +155 -0
  54. package/dist/config/observability.d.ts +119 -0
  55. package/dist/config/observability.js +35 -0
  56. package/dist/create/agent-builder.d.ts +77 -0
  57. package/dist/create/agent-builder.js +20 -0
  58. package/dist/create/agentcard-builder.d.ts +47 -0
  59. package/dist/create/agentcard-builder.js +66 -0
  60. package/dist/create/base.d.ts +4 -0
  61. package/dist/create/base.js +1 -0
  62. package/dist/create/create.d.ts +762 -0
  63. package/dist/create/create.js +556 -0
  64. package/dist/create/describe.d.ts +8 -0
  65. package/dist/create/describe.js +8 -0
  66. package/dist/create/index.d.ts +4 -0
  67. package/dist/create/index.js +4 -0
  68. package/dist/create/message-builder.d.ts +78 -0
  69. package/dist/create/message-builder.js +110 -0
  70. package/dist/create/part-builder.d.ts +60 -0
  71. package/dist/create/part-builder.js +84 -0
  72. package/dist/create/status-builder.d.ts +26 -0
  73. package/dist/create/status-builder.js +46 -0
  74. package/dist/create/task-builder.d.ts +251 -0
  75. package/dist/create/task-builder.js +384 -0
  76. package/dist/create/transform.d.ts +16 -0
  77. package/dist/create/transform.js +106 -0
  78. package/dist/extensions/otel.d.ts +98 -0
  79. package/dist/extensions/otel.js +190 -0
  80. package/dist/extensions/pino.d.ts +44 -0
  81. package/dist/extensions/pino.js +107 -0
  82. package/dist/extensions/winston.d.ts +47 -0
  83. package/dist/extensions/winston.js +114 -0
  84. package/dist/index.d.ts +4 -0
  85. package/dist/index.js +4 -0
  86. package/dist/server/express/errors.js +7 -11
  87. package/dist/server/express/middeware.d.ts +2 -2
  88. package/dist/server/express/middeware.js +26 -40
  89. package/dist/server/express/server.d.ts +14 -56
  90. package/dist/server/express/server.js +46 -35
  91. package/dist/services/a2a/execute.d.ts +11 -0
  92. package/dist/services/a2a/execute.js +32 -0
  93. package/dist/services/a2a/factory/context.d.ts +15 -128
  94. package/dist/services/a2a/factory/context.js +30 -136
  95. package/dist/services/a2a/factory/handler.d.ts +6 -0
  96. package/dist/services/a2a/factory/handler.js +14 -0
  97. package/dist/services/a2a/factory/index.d.ts +1 -3
  98. package/dist/services/a2a/factory/index.js +1 -3
  99. package/dist/services/a2a/factory/service.d.ts +20 -7
  100. package/dist/services/a2a/factory/service.js +5 -5
  101. package/dist/services/a2a/factory/state-machine.d.ts +11 -0
  102. package/dist/services/a2a/factory/state-machine.js +88 -0
  103. package/dist/services/a2a/handlers/artifact.d.ts +7 -0
  104. package/dist/services/a2a/handlers/artifact.js +28 -0
  105. package/dist/services/a2a/handlers/cancel-task.d.ts +11 -0
  106. package/dist/services/a2a/handlers/cancel-task.js +35 -0
  107. package/dist/services/a2a/handlers/get-task.d.ts +11 -0
  108. package/dist/services/a2a/handlers/get-task.js +13 -0
  109. package/dist/services/a2a/handlers/resubscribe-task.d.ts +19 -0
  110. package/dist/services/a2a/handlers/resubscribe-task.js +59 -0
  111. package/dist/services/a2a/handlers/send-message.d.ts +11 -0
  112. package/dist/services/a2a/handlers/send-message.js +31 -0
  113. package/dist/services/a2a/handlers/stream-message.d.ts +19 -0
  114. package/dist/services/a2a/handlers/stream-message.js +23 -0
  115. package/dist/services/a2a/handlers/update.d.ts +17 -0
  116. package/dist/services/a2a/handlers/update.js +119 -0
  117. package/dist/services/a2a/helpers/content.d.ts +6 -2
  118. package/dist/services/a2a/helpers/content.js +9 -1
  119. package/dist/services/a2a/helpers/history.d.ts +6 -2
  120. package/dist/services/a2a/helpers/history.js +4 -0
  121. package/dist/services/a2a/helpers/index.d.ts +3 -3
  122. package/dist/services/a2a/helpers/index.js +3 -3
  123. package/dist/services/a2a/helpers/part.d.ts +9 -9
  124. package/dist/services/a2a/helpers/references.d.ts +6 -0
  125. package/dist/services/a2a/helpers/references.js +22 -0
  126. package/dist/services/a2a/index.d.ts +9 -5
  127. package/dist/services/a2a/index.js +8 -5
  128. package/dist/services/a2a/managers.d.ts +23 -0
  129. package/dist/services/a2a/managers.js +101 -0
  130. package/dist/services/a2a/messenger.d.ts +35 -0
  131. package/dist/services/{core/managers/command.js → a2a/messenger.js} +27 -31
  132. package/dist/services/a2a/service.d.ts +45 -372
  133. package/dist/services/a2a/service.js +232 -84
  134. package/dist/services/a2a/state-machine.d.ts +18 -0
  135. package/dist/services/a2a/state-machine.js +78 -0
  136. package/dist/services/a2a/streams.d.ts +22 -0
  137. package/dist/services/a2a/streams.js +98 -0
  138. package/dist/services/core/index.d.ts +1 -2
  139. package/dist/services/core/index.js +1 -2
  140. package/dist/services/core/manager.d.ts +15 -0
  141. package/dist/services/core/manager.js +42 -0
  142. package/dist/services/mcp/service.d.ts +11 -15
  143. package/dist/services/mcp/service.js +16 -15
  144. package/dist/transport/index.d.ts +0 -1
  145. package/dist/transport/index.js +1 -1
  146. package/dist/transport/rpc/parser.d.ts +2 -2
  147. package/dist/transport/rpc/parser.js +7 -6
  148. package/dist/transport/rpc/rpc-client.d.ts +5 -5
  149. package/dist/transport/rpc/rpc-client.js +6 -6
  150. package/dist/transport/streaming/event-stream.d.ts +3 -3
  151. package/dist/transport/streaming/event-stream.js +11 -10
  152. package/dist/transport/trpc/a2a/factory/router.d.ts +479 -871
  153. package/dist/transport/trpc/a2a/factory/router.js +2 -2
  154. package/dist/transport/trpc/a2a/routes/info.d.ts +108 -8
  155. package/dist/transport/trpc/a2a/routes/info.js +6 -2
  156. package/dist/transport/trpc/a2a/routes/message/route.d.ts +113 -162
  157. package/dist/transport/trpc/a2a/routes/message/route.js +7 -13
  158. package/dist/transport/trpc/a2a/routes/tasks/route.d.ts +114 -212
  159. package/dist/transport/trpc/a2a/routes/tasks/route.js +16 -19
  160. package/dist/transport/trpc/a2a/trpc.d.ts +9 -253
  161. package/dist/types/a2a/a2a.d.ts +382 -0
  162. package/dist/types/a2a/a2a.js +14 -0
  163. package/dist/types/a2a/index.d.ts +5 -0
  164. package/dist/types/a2a/index.js +1 -0
  165. package/dist/types/{interfaces/client.d.ts → client.d.ts} +25 -27
  166. package/dist/types/core/core.d.ts +31 -0
  167. package/dist/types/core/core.js +1 -0
  168. package/dist/types/core/index.d.ts +1 -0
  169. package/dist/types/core/index.js +1 -0
  170. package/dist/types/index.d.ts +6 -3
  171. package/dist/types/index.js +6 -3
  172. package/dist/types/mcp/index.d.ts +1 -0
  173. package/dist/types/mcp/index.js +1 -0
  174. package/dist/{browser/types/interfaces/services/mcp/service.d.ts → types/mcp/mcp.d.ts} +4 -3
  175. package/dist/{browser/types/interfaces/services/a2a/context.js → types/mcp/mcp.js} +1 -1
  176. package/dist/types/storage.d.ts +21 -0
  177. package/dist/utils/common/constants.d.ts +2 -7
  178. package/dist/utils/common/constants.js +5 -32
  179. package/dist/utils/common/errors.d.ts +74 -18
  180. package/dist/utils/common/errors.js +81 -28
  181. package/dist/utils/common/parse.d.ts +7 -0
  182. package/dist/utils/common/parse.js +14 -0
  183. package/dist/utils/common/schema-validation.d.ts +2 -2
  184. package/dist/utils/common/schema-validation.js +7 -7
  185. package/dist/utils/common/utils.d.ts +23 -0
  186. package/dist/utils/common/utils.js +32 -0
  187. package/dist/utils/common/zAsyncIterable-v3.d.ts +1 -1
  188. package/dist/utils/common/zAsyncIterable-v3.js +2 -1
  189. package/dist/utils/index.d.ts +2 -3
  190. package/dist/utils/index.js +2 -3
  191. package/dist/utils/storage/file.d.ts +8 -17
  192. package/dist/utils/storage/file.js +44 -73
  193. package/package.json +76 -13
  194. package/dist/browser/services/a2a/helpers/message-builder.d.ts +0 -12
  195. package/dist/browser/services/a2a/helpers/message-builder.js +0 -61
  196. package/dist/browser/types/ext.d.ts +0 -13
  197. package/dist/browser/types/ext.js +0 -10
  198. package/dist/browser/types/interfaces/index.d.ts +0 -3
  199. package/dist/browser/types/interfaces/index.js +0 -3
  200. package/dist/browser/types/interfaces/services/a2a/builder.d.ts +0 -37
  201. package/dist/browser/types/interfaces/services/a2a/context.d.ts +0 -162
  202. package/dist/browser/types/interfaces/services/a2a/engine.d.ts +0 -7
  203. package/dist/browser/types/interfaces/services/a2a/engine.js +0 -5
  204. package/dist/browser/types/interfaces/services/a2a/index.d.ts +0 -5
  205. package/dist/browser/types/interfaces/services/a2a/index.js +0 -5
  206. package/dist/browser/types/interfaces/services/a2a/legacy.d.ts +0 -93
  207. package/dist/browser/types/interfaces/services/a2a/legacy.js +0 -5
  208. package/dist/browser/types/interfaces/services/a2a/service.d.ts +0 -413
  209. package/dist/browser/types/interfaces/services/a2a/service.js +0 -5
  210. package/dist/browser/types/interfaces/services/core/context/command.d.ts +0 -25
  211. package/dist/browser/types/interfaces/services/core/context/command.js +0 -5
  212. package/dist/browser/types/interfaces/services/core/context/context.d.ts +0 -207
  213. package/dist/browser/types/interfaces/services/core/context/context.js +0 -5
  214. package/dist/browser/types/interfaces/services/core/context/index.d.ts +0 -3
  215. package/dist/browser/types/interfaces/services/core/context/index.js +0 -3
  216. package/dist/browser/types/interfaces/services/core/context/types.d.ts +0 -11
  217. package/dist/browser/types/interfaces/services/core/context/types.js +0 -5
  218. package/dist/browser/types/interfaces/services/core/execution/engine.d.ts +0 -106
  219. package/dist/browser/types/interfaces/services/core/execution/engine.js +0 -5
  220. package/dist/browser/types/interfaces/services/core/execution/environment.d.ts +0 -11
  221. package/dist/browser/types/interfaces/services/core/execution/environment.js +0 -5
  222. package/dist/browser/types/interfaces/services/core/execution/execute.d.ts +0 -7
  223. package/dist/browser/types/interfaces/services/core/execution/execute.js +0 -5
  224. package/dist/browser/types/interfaces/services/core/execution/index.d.ts +0 -3
  225. package/dist/browser/types/interfaces/services/core/execution/index.js +0 -3
  226. package/dist/browser/types/interfaces/services/core/index.d.ts +0 -4
  227. package/dist/browser/types/interfaces/services/core/index.js +0 -4
  228. package/dist/browser/types/interfaces/services/core/managers/cancellation.d.ts +0 -9
  229. package/dist/browser/types/interfaces/services/core/managers/cancellation.js +0 -5
  230. package/dist/browser/types/interfaces/services/core/managers/connection.d.ts +0 -9
  231. package/dist/browser/types/interfaces/services/core/managers/connection.js +0 -5
  232. package/dist/browser/types/interfaces/services/core/managers/context.d.ts +0 -17
  233. package/dist/browser/types/interfaces/services/core/managers/context.js +0 -5
  234. package/dist/browser/types/interfaces/services/core/managers/event.d.ts +0 -328
  235. package/dist/browser/types/interfaces/services/core/managers/event.js +0 -5
  236. package/dist/browser/types/interfaces/services/core/managers/index.d.ts +0 -6
  237. package/dist/browser/types/interfaces/services/core/managers/index.js +0 -6
  238. package/dist/browser/types/interfaces/services/core/managers/stream.d.ts +0 -217
  239. package/dist/browser/types/interfaces/services/core/managers/stream.js +0 -5
  240. package/dist/browser/types/interfaces/services/core/managers/task.d.ts +0 -9
  241. package/dist/browser/types/interfaces/services/core/service.d.ts +0 -115
  242. package/dist/browser/types/interfaces/services/core/service.js +0 -5
  243. package/dist/browser/types/interfaces/services/index.d.ts +0 -4
  244. package/dist/browser/types/interfaces/services/index.js +0 -4
  245. package/dist/browser/types/interfaces/services/mcp/index.d.ts +0 -1
  246. package/dist/browser/types/interfaces/services/mcp/index.js +0 -1
  247. package/dist/browser/types/interfaces/services/mcp/service.js +0 -5
  248. package/dist/browser/types/interfaces/storage.d.ts +0 -8
  249. package/dist/browser/types/schemas/a2a/agent.d.ts +0 -2583
  250. package/dist/browser/types/schemas/a2a/agent.js +0 -323
  251. package/dist/browser/types/schemas/a2a/auth.d.ts +0 -908
  252. package/dist/browser/types/schemas/a2a/auth.js +0 -283
  253. package/dist/browser/types/schemas/a2a/error.d.ts +0 -396
  254. package/dist/browser/types/schemas/a2a/error.js +0 -163
  255. package/dist/browser/types/schemas/a2a/index.d.ts +0 -11
  256. package/dist/browser/types/schemas/a2a/index.js +0 -11
  257. package/dist/browser/types/schemas/a2a/kind.d.ts +0 -11
  258. package/dist/browser/types/schemas/a2a/kind.js +0 -20
  259. package/dist/browser/types/schemas/a2a/message.d.ts +0 -10343
  260. package/dist/browser/types/schemas/a2a/message.js +0 -130
  261. package/dist/browser/types/schemas/a2a/notification.d.ts +0 -1517
  262. package/dist/browser/types/schemas/a2a/notification.js +0 -203
  263. package/dist/browser/types/schemas/a2a/parameters.d.ts +0 -956
  264. package/dist/browser/types/schemas/a2a/parameters.js +0 -241
  265. package/dist/browser/types/schemas/a2a/protocol.d.ts +0 -14363
  266. package/dist/browser/types/schemas/a2a/protocol.js +0 -59
  267. package/dist/browser/types/schemas/a2a/rpc.d.ts +0 -182
  268. package/dist/browser/types/schemas/a2a/rpc.js +0 -126
  269. package/dist/browser/types/schemas/a2a/task.d.ts +0 -5886
  270. package/dist/browser/types/schemas/a2a/task.js +0 -134
  271. package/dist/browser/types/schemas/a2a/transport.d.ts +0 -31
  272. package/dist/browser/types/schemas/a2a/transport.js +0 -28
  273. package/dist/browser/types/schemas/index.d.ts +0 -1
  274. package/dist/browser/types/schemas/index.js +0 -1
  275. package/dist/browser/utils/logging/index.d.ts +0 -2
  276. package/dist/browser/utils/logging/index.js +0 -2
  277. package/dist/browser/utils/logging/log.d.ts +0 -33
  278. package/dist/browser/utils/logging/log.js +0 -75
  279. package/dist/browser/utils/logging/logger.d.ts +0 -18
  280. package/dist/browser/utils/logging/logger.js +0 -18
  281. package/dist/services/a2a/factory/builder.d.ts +0 -351
  282. package/dist/services/a2a/factory/builder.js +0 -365
  283. package/dist/services/a2a/factory/event.d.ts +0 -58
  284. package/dist/services/a2a/factory/event.js +0 -177
  285. package/dist/services/a2a/factory/method.d.ts +0 -6
  286. package/dist/services/a2a/factory/method.js +0 -14
  287. package/dist/services/a2a/helpers/agentcard-builder.d.ts +0 -7
  288. package/dist/services/a2a/helpers/agentcard-builder.js +0 -23
  289. package/dist/services/a2a/helpers/message-builder.d.ts +0 -12
  290. package/dist/services/a2a/helpers/message-builder.js +0 -61
  291. package/dist/services/a2a/managers/cancellation.d.ts +0 -11
  292. package/dist/services/a2a/managers/cancellation.js +0 -16
  293. package/dist/services/a2a/managers/connection.d.ts +0 -11
  294. package/dist/services/a2a/managers/connection.js +0 -16
  295. package/dist/services/a2a/managers/context.d.ts +0 -11
  296. package/dist/services/a2a/managers/context.js +0 -16
  297. package/dist/services/a2a/managers/index.d.ts +0 -5
  298. package/dist/services/a2a/managers/index.js +0 -5
  299. package/dist/services/a2a/managers/task.d.ts +0 -11
  300. package/dist/services/a2a/managers/task.js +0 -16
  301. package/dist/services/a2a/methods/cancel-task.d.ts +0 -7
  302. package/dist/services/a2a/methods/cancel-task.js +0 -43
  303. package/dist/services/a2a/methods/get-task.d.ts +0 -112
  304. package/dist/services/a2a/methods/get-task.js +0 -16
  305. package/dist/services/a2a/methods/resubscribe-task.d.ts +0 -7
  306. package/dist/services/a2a/methods/resubscribe-task.js +0 -80
  307. package/dist/services/a2a/methods/send-message.d.ts +0 -7
  308. package/dist/services/a2a/methods/send-message.js +0 -36
  309. package/dist/services/a2a/methods/stream-message.d.ts +0 -8
  310. package/dist/services/a2a/methods/stream-message.js +0 -21
  311. package/dist/services/a2a/state/index.d.ts +0 -3
  312. package/dist/services/a2a/state/index.js +0 -3
  313. package/dist/services/a2a/state/load.d.ts +0 -14
  314. package/dist/services/a2a/state/load.js +0 -71
  315. package/dist/services/a2a/state/process.d.ts +0 -7
  316. package/dist/services/a2a/state/process.js +0 -13
  317. package/dist/services/a2a/state/update/artifact.d.ts +0 -10
  318. package/dist/services/a2a/state/update/artifact.js +0 -39
  319. package/dist/services/a2a/state/update/index.d.ts +0 -2
  320. package/dist/services/a2a/state/update/index.js +0 -2
  321. package/dist/services/a2a/state/update/update.d.ts +0 -23
  322. package/dist/services/a2a/state/update/update.js +0 -123
  323. package/dist/services/core/execution/execute.d.ts +0 -6
  324. package/dist/services/core/execution/execute.js +0 -25
  325. package/dist/services/core/execution/index.d.ts +0 -1
  326. package/dist/services/core/execution/index.js +0 -1
  327. package/dist/services/core/managers/command.d.ts +0 -39
  328. package/dist/services/core/managers/event.d.ts +0 -18
  329. package/dist/services/core/managers/event.js +0 -56
  330. package/dist/services/core/managers/index.d.ts +0 -3
  331. package/dist/services/core/managers/index.js +0 -3
  332. package/dist/services/core/managers/stream.d.ts +0 -20
  333. package/dist/services/core/managers/stream.js +0 -77
  334. package/dist/types/ext.d.ts +0 -13
  335. package/dist/types/ext.js +0 -10
  336. package/dist/types/interfaces/index.d.ts +0 -3
  337. package/dist/types/interfaces/index.js +0 -3
  338. package/dist/types/interfaces/services/a2a/builder.d.ts +0 -37
  339. package/dist/types/interfaces/services/a2a/builder.js +0 -5
  340. package/dist/types/interfaces/services/a2a/context.d.ts +0 -162
  341. package/dist/types/interfaces/services/a2a/context.js +0 -5
  342. package/dist/types/interfaces/services/a2a/engine.d.ts +0 -7
  343. package/dist/types/interfaces/services/a2a/engine.js +0 -5
  344. package/dist/types/interfaces/services/a2a/index.d.ts +0 -5
  345. package/dist/types/interfaces/services/a2a/index.js +0 -5
  346. package/dist/types/interfaces/services/a2a/legacy.d.ts +0 -93
  347. package/dist/types/interfaces/services/a2a/legacy.js +0 -5
  348. package/dist/types/interfaces/services/a2a/service.d.ts +0 -413
  349. package/dist/types/interfaces/services/a2a/service.js +0 -5
  350. package/dist/types/interfaces/services/core/context/command.d.ts +0 -25
  351. package/dist/types/interfaces/services/core/context/command.js +0 -5
  352. package/dist/types/interfaces/services/core/context/context.d.ts +0 -207
  353. package/dist/types/interfaces/services/core/context/context.js +0 -5
  354. package/dist/types/interfaces/services/core/context/index.d.ts +0 -3
  355. package/dist/types/interfaces/services/core/context/index.js +0 -3
  356. package/dist/types/interfaces/services/core/context/types.d.ts +0 -11
  357. package/dist/types/interfaces/services/core/context/types.js +0 -5
  358. package/dist/types/interfaces/services/core/execution/engine.d.ts +0 -106
  359. package/dist/types/interfaces/services/core/execution/engine.js +0 -5
  360. package/dist/types/interfaces/services/core/execution/environment.d.ts +0 -11
  361. package/dist/types/interfaces/services/core/execution/environment.js +0 -5
  362. package/dist/types/interfaces/services/core/execution/execute.d.ts +0 -7
  363. package/dist/types/interfaces/services/core/execution/execute.js +0 -5
  364. package/dist/types/interfaces/services/core/execution/index.d.ts +0 -3
  365. package/dist/types/interfaces/services/core/execution/index.js +0 -3
  366. package/dist/types/interfaces/services/core/index.d.ts +0 -4
  367. package/dist/types/interfaces/services/core/index.js +0 -4
  368. package/dist/types/interfaces/services/core/managers/cancellation.d.ts +0 -9
  369. package/dist/types/interfaces/services/core/managers/cancellation.js +0 -5
  370. package/dist/types/interfaces/services/core/managers/connection.d.ts +0 -9
  371. package/dist/types/interfaces/services/core/managers/connection.js +0 -5
  372. package/dist/types/interfaces/services/core/managers/context.d.ts +0 -17
  373. package/dist/types/interfaces/services/core/managers/context.js +0 -5
  374. package/dist/types/interfaces/services/core/managers/event.d.ts +0 -328
  375. package/dist/types/interfaces/services/core/managers/event.js +0 -5
  376. package/dist/types/interfaces/services/core/managers/index.d.ts +0 -6
  377. package/dist/types/interfaces/services/core/managers/index.js +0 -6
  378. package/dist/types/interfaces/services/core/managers/stream.d.ts +0 -217
  379. package/dist/types/interfaces/services/core/managers/stream.js +0 -5
  380. package/dist/types/interfaces/services/core/managers/task.d.ts +0 -9
  381. package/dist/types/interfaces/services/core/service.d.ts +0 -115
  382. package/dist/types/interfaces/services/core/service.js +0 -5
  383. package/dist/types/interfaces/services/index.d.ts +0 -4
  384. package/dist/types/interfaces/services/index.js +0 -4
  385. package/dist/types/interfaces/services/mcp/index.d.ts +0 -1
  386. package/dist/types/interfaces/services/mcp/index.js +0 -1
  387. package/dist/types/interfaces/services/mcp/service.js +0 -5
  388. package/dist/types/interfaces/storage.d.ts +0 -8
  389. package/dist/types/schemas/a2a/agent.d.ts +0 -2583
  390. package/dist/types/schemas/a2a/agent.js +0 -323
  391. package/dist/types/schemas/a2a/auth.d.ts +0 -908
  392. package/dist/types/schemas/a2a/auth.js +0 -283
  393. package/dist/types/schemas/a2a/error.d.ts +0 -396
  394. package/dist/types/schemas/a2a/error.js +0 -163
  395. package/dist/types/schemas/a2a/index.d.ts +0 -11
  396. package/dist/types/schemas/a2a/index.js +0 -11
  397. package/dist/types/schemas/a2a/kind.d.ts +0 -11
  398. package/dist/types/schemas/a2a/kind.js +0 -20
  399. package/dist/types/schemas/a2a/message.d.ts +0 -10343
  400. package/dist/types/schemas/a2a/message.js +0 -130
  401. package/dist/types/schemas/a2a/notification.d.ts +0 -1517
  402. package/dist/types/schemas/a2a/notification.js +0 -203
  403. package/dist/types/schemas/a2a/parameters.d.ts +0 -956
  404. package/dist/types/schemas/a2a/parameters.js +0 -241
  405. package/dist/types/schemas/a2a/protocol.d.ts +0 -14363
  406. package/dist/types/schemas/a2a/protocol.js +0 -59
  407. package/dist/types/schemas/a2a/rpc.d.ts +0 -182
  408. package/dist/types/schemas/a2a/rpc.js +0 -126
  409. package/dist/types/schemas/a2a/task.d.ts +0 -5886
  410. package/dist/types/schemas/a2a/task.js +0 -134
  411. package/dist/types/schemas/a2a/transport.d.ts +0 -31
  412. package/dist/types/schemas/a2a/transport.js +0 -28
  413. package/dist/types/schemas/index.d.ts +0 -1
  414. package/dist/types/schemas/index.js +0 -1
  415. package/dist/utils/logging/index.d.ts +0 -2
  416. package/dist/utils/logging/index.js +0 -2
  417. package/dist/utils/logging/log.d.ts +0 -33
  418. package/dist/utils/logging/log.js +0 -75
  419. package/dist/utils/logging/logger.d.ts +0 -18
  420. package/dist/utils/logging/logger.js +0 -18
  421. package/dist/utils/storage/memory.d.ts +0 -25
  422. package/dist/utils/storage/memory.js +0 -47
  423. /package/dist/browser/{types/interfaces/services/core/managers/task.js → create/base.js} +0 -0
  424. /package/dist/browser/types/{interfaces/client.js → client.js} +0 -0
  425. /package/dist/{types/interfaces/services/core/managers/task.js → browser/types/core/core.js} +0 -0
  426. /package/dist/browser/types/{interfaces/services/protocol.d.ts → protocol.d.ts} +0 -0
  427. /package/dist/browser/types/{interfaces/services/protocol.js → protocol.js} +0 -0
  428. /package/dist/browser/types/{interfaces/storage.js → storage.js} +0 -0
  429. /package/dist/services/a2a/{methods → handlers}/index.d.ts +0 -0
  430. /package/dist/services/a2a/{methods → handlers}/index.js +0 -0
  431. /package/dist/types/{interfaces/client.js → client.js} +0 -0
  432. /package/dist/types/{interfaces/services/protocol.d.ts → protocol.d.ts} +0 -0
  433. /package/dist/types/{interfaces/services/protocol.js → protocol.js} +0 -0
  434. /package/dist/types/{interfaces/storage.js → storage.js} +0 -0
@@ -2,21 +2,26 @@
2
2
  * Copyright 2025 The Artinet Project
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- import { logError, logDebug } from "../logging/log.js";
5
+ import { A2A } from "../../types/index.js";
6
6
  import fs from "fs/promises";
7
7
  import path from "path";
8
+ import { logger } from "../../config/index.js";
9
+ import { Tasks } from "../../services/a2a/managers.js";
10
+ import { formatJson, safeParseSchema } from "../index.js";
8
11
  /**
9
12
  * File-based implementation of the TaskStore interface.
10
13
  * Stores tasks and their history as JSON files on disk.
11
14
  */
12
- export class FileStore {
15
+ export class Files extends Tasks {
13
16
  baseDir;
14
17
  /**
15
18
  * Creates a new FileStore.
16
19
  * @param baseDir The base directory to store task files in.
17
20
  */
18
21
  constructor(baseDir) {
22
+ super(new Map());
19
23
  this.baseDir = baseDir;
24
+ logger.info(`FileStore[init]: baseDir`, { baseDir });
20
25
  }
21
26
  /**
22
27
  * Constructs the file path for a task.
@@ -26,14 +31,6 @@ export class FileStore {
26
31
  getTaskFilePath(taskId) {
27
32
  return path.join(this.baseDir, `${taskId}.task.json`);
28
33
  }
29
- /**
30
- * Constructs the file path for a task's history.
31
- * @param taskId The task ID
32
- * @returns The full file path for the history JSON file
33
- */
34
- getHistoryFilePath(taskId) {
35
- return path.join(this.baseDir, `${taskId}.history.json`);
36
- }
37
34
  /**
38
35
  * Ensures the base directory exists.
39
36
  * @returns A promise that resolves when the directory exists.
@@ -43,7 +40,7 @@ export class FileStore {
43
40
  await fs.mkdir(this.baseDir, { recursive: true });
44
41
  }
45
42
  catch (error) {
46
- logError("FileStore", `Failed to create directory: ${this.baseDir}`, error);
43
+ logger.warn(`FileStore[ensureBaseDir]: ${this.baseDir}`, error);
47
44
  throw error;
48
45
  }
49
46
  }
@@ -53,15 +50,15 @@ export class FileStore {
53
50
  * @param data The data to write
54
51
  * @returns A promise that resolves when the write is complete
55
52
  */
56
- async writeJsonFile(filePath, data) {
53
+ async writeJsonFile(filePath, task) {
57
54
  try {
58
55
  await this.ensureBaseDir();
59
- await fs.writeFile(filePath, JSON.stringify(data, null, 2), {
56
+ await fs.writeFile(filePath, formatJson(task), {
60
57
  encoding: "utf8",
61
58
  });
62
59
  }
63
60
  catch (error) {
64
- logError("FileStore", `Failed to write file: ${filePath}`, error);
61
+ logger.warn(`FileStore[writeJsonFile]: ${filePath}`, error);
65
62
  throw error;
66
63
  }
67
64
  }
@@ -73,88 +70,62 @@ export class FileStore {
73
70
  async readJsonFile(filePath) {
74
71
  try {
75
72
  const content = await fs.readFile(filePath, { encoding: "utf8" });
76
- return JSON.parse(content);
73
+ return await safeParseSchema(content, A2A.TaskSchema);
77
74
  }
78
75
  catch (error) {
79
76
  if (error.code === "ENOENT") {
80
- // File not found - return null rather than throwing
77
+ logger.warn(`FileStore[readJsonFile]: ${filePath} not found`);
81
78
  return null;
82
79
  }
83
- logError("FileStore", `Failed to read file: ${filePath}`, error);
84
80
  throw error;
85
81
  }
86
82
  }
87
- /**
88
- * Type guard to validate the structure of history file content.
89
- * @param content The content to check
90
- * @returns True if the content is a valid history file content
91
- */
92
- isHistoryFileContent(content) {
93
- return (content !== undefined &&
94
- typeof content === "object" &&
95
- content !== null &&
96
- "messageHistory" in content &&
97
- Array.isArray(content.messageHistory));
98
- }
99
83
  /**
100
84
  * Loads a task and its history by task ID.
101
85
  * @param taskId The ID of the task to load.
102
86
  * @returns A promise resolving to the task and history, or null if not found.
103
87
  */
104
- async getState(taskId) {
105
- logDebug("FileStore", `Loading task: ${taskId}`);
106
- const taskFilePath = this.getTaskFilePath(taskId);
107
- const historyFilePath = this.getHistoryFilePath(taskId);
108
- // Read task file first - if it doesn't exist, the task doesn't exist.
109
- const task = await this.readJsonFile(taskFilePath).catch(() => undefined);
110
- if (!task) {
111
- return undefined; // Task not found
112
- }
113
- // Task exists, now try to read history. It might not exist yet.
114
- let history = [];
115
- try {
116
- const historyContent = await this.readJsonFile(historyFilePath).catch(() => undefined);
117
- // Validate the structure
118
- if (this.isHistoryFileContent(historyContent)) {
119
- history = historyContent.messageHistory;
120
- }
121
- else if (historyContent !== null) {
122
- // Log a warning if the history file exists but is malformed
123
- logError("FileStore", `Malformed history file found for task ${taskId}`, new Error("Invalid history file format"), { path: historyFilePath });
124
- // Proceed with empty history
125
- }
126
- // If historyContent is null (file not found), history remains []
127
- }
128
- catch (error) {
129
- // Log error reading history but proceed with empty history
130
- logError("FileStore", `Error reading history file for task ${taskId}`, error, { path: historyFilePath });
131
- // Proceed with empty history
132
- }
133
- return { task, history };
88
+ async get(taskId) {
89
+ const task = (await super.get(taskId)) ??
90
+ (await this.readJsonFile(this.getTaskFilePath(taskId)).catch(() => undefined));
91
+ return task ?? undefined;
134
92
  }
135
93
  /**
136
94
  * Saves a task and its history.
137
95
  * @param data The task and history to save.
138
96
  * @returns A promise that resolves when the save is complete.
139
97
  */
140
- async setState(taskId, data) {
141
- logDebug("FileStore", `Saving task: ${data.task.id}`);
142
- if (taskId !== data.task.id) {
98
+ async set(taskId, task) {
99
+ logger.debug(`FileStore[set]: ${taskId}`);
100
+ if (!task) {
101
+ return;
102
+ }
103
+ if (task && taskId !== task.id) {
104
+ logger.warn("FileStore", `Task ID mismatch: ${taskId} !== ${task.id}`);
143
105
  throw new Error("Task ID mismatch");
144
106
  }
145
107
  const taskFilePath = this.getTaskFilePath(taskId);
146
- const historyFilePath = this.getHistoryFilePath(taskId);
147
- // For simplicity and atomicity, we'll write each file individually
148
- // First, write the task file
149
- await this.writeJsonFile(taskFilePath, data.task);
150
- // Then, write the history file
151
- // We'll wrap it in an object to allow for future extensibility
152
- await this.writeJsonFile(historyFilePath, {
153
- messageHistory: data.history,
154
- });
108
+ await this.writeJsonFile(taskFilePath, task);
109
+ await super.set(taskId, task);
110
+ }
111
+ async delete(taskId) {
112
+ logger.debug(`FileStore[delete]: ${taskId}`);
113
+ const taskFilePath = this.getTaskFilePath(taskId);
114
+ await fs.unlink(taskFilePath);
115
+ await super.delete(taskId);
116
+ }
117
+ async has(taskId) {
118
+ if (await super.has(taskId)) {
119
+ return true;
120
+ }
121
+ const taskFilePath = this.getTaskFilePath(taskId);
122
+ return fs
123
+ .access(taskFilePath)
124
+ .then(() => true)
125
+ .catch(() => false);
155
126
  }
156
- async getStates() {
127
+ async list() {
157
128
  const taskIds = await fs.readdir(this.baseDir);
158
- return taskIds.map((taskId) => taskId.replace(".task.json", ""));
129
+ return Promise.all(taskIds.map((taskId) => this.get(taskId).catch(() => undefined))).then((tasks) => tasks.filter((task) => task !== undefined));
159
130
  }
160
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artinet/sdk",
3
- "version": "0.5.18",
3
+ "version": "0.6.0-preview.2",
4
4
  "description": "A TypeScript SDK for building collaborative AI agents.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,10 +17,36 @@
17
17
  "import": "./dist/index.js",
18
18
  "default": "./dist/index.js"
19
19
  },
20
+ "./trpc": {
21
+ "types": "./dist/transport/trpc/index.d.ts",
22
+ "import": "./dist/transport/trpc/index.js",
23
+ "default": "./dist/transport/trpc/index.js"
24
+ },
20
25
  "./types": {
21
26
  "types": "./dist/types/index.d.ts",
22
27
  "import": "./dist/types/index.js",
23
28
  "default": "./dist/types/index.js"
29
+ },
30
+ "./pino": {
31
+ "types": "./dist/extensions/pino.d.ts",
32
+ "node": {
33
+ "import": "./dist/extensions/pino.js",
34
+ "default": "./dist/extensions/pino.js"
35
+ }
36
+ },
37
+ "./winston": {
38
+ "types": "./dist/extensions/winston.d.ts",
39
+ "node": {
40
+ "import": "./dist/extensions/winston.js",
41
+ "default": "./dist/extensions/winston.js"
42
+ }
43
+ },
44
+ "./otel": {
45
+ "types": "./dist/extensions/opentelemetry.d.ts",
46
+ "node": {
47
+ "import": "./dist/extensions/opentelemetry.js",
48
+ "default": "./dist/extensions/opentelemetry.js"
49
+ }
24
50
  }
25
51
  },
26
52
  "rootDir": ".",
@@ -65,37 +91,74 @@
65
91
  },
66
92
  "homepage": "https://github.com/the-artinet-project/artinet-sdk#readme",
67
93
  "dependencies": {
68
- "@modelcontextprotocol/sdk": "^1.20.1",
69
- "@trpc/server": "^11.4.3",
70
- "@types/cors": "^2.8.17",
71
- "@types/escape-html": "^1.0.4",
72
- "@types/express": "^5.0.1",
94
+ "@artinet/types": "^0.0.9-alpha.3",
73
95
  "cors": "^2.8.5",
74
96
  "escape-html": "^1.0.3",
75
97
  "eventsource-parser": "^3.0.1",
76
98
  "express": "^5.1.0",
77
- "uuid": "^11.1.0",
78
- "zod": "^3.23.8"
99
+ "uuid": "^13.0.0",
100
+ "zod": "^3.25"
101
+ },
102
+ "peerDependencies": {
103
+ "@a2a-js/sdk": "^0.3.7",
104
+ "@modelcontextprotocol/sdk": "^1.24.3",
105
+ "@trpc/server": "^11.4.3",
106
+ "@opentelemetry/api": "^1.9.0"
107
+ },
108
+ "optionalDependencies": {
109
+ "pino": "^10.1.0",
110
+ "winston": "^3.19.0"
111
+ },
112
+ "peerDependenciesMeta": {
113
+ "@modelcontextprotocol/sdk": {
114
+ "optional": false
115
+ },
116
+ "@trpc/server": {
117
+ "optional": true
118
+ },
119
+ "@a2a-js/sdk": {
120
+ "optional": true
121
+ },
122
+ "@opentelemetry/api": {
123
+ "optional": false
124
+ },
125
+ "pino": {
126
+ "optional": true
127
+ },
128
+ "winston": {
129
+ "optional": true
130
+ }
79
131
  },
80
132
  "devDependencies": {
133
+ "@a2a-js/sdk": "^0.3.7",
81
134
  "@cfworker/json-schema": "^4.1.1",
82
135
  "@eslint/js": "^9.25.1",
83
- "@types/jest": "^29.5.14",
84
- "@types/node": "^20.17.50",
136
+ "@opentelemetry/api": "^1.9.0",
137
+ "@types/cors": "^2.8.17",
138
+ "@types/escape-html": "^1.0.4",
139
+ "@types/express": "^5.0.1",
140
+ "@types/jest": "^30.0.0",
141
+ "@types/node": "^25.0.3",
85
142
  "@types/supertest": "latest",
86
143
  "eslint": "^9.25.1",
87
144
  "globals": "^16.0.0",
88
- "jest": "^29.7.0",
145
+ "jest": "^30.2.0",
89
146
  "msw": "^2.7.5",
90
- "rimraf": "^5.0.5",
147
+ "@modelcontextprotocol/sdk": "^1.24.3",
148
+ "pino": "^10.1.0",
149
+ "pino-caller": "^4.0.0",
150
+ "pino-pretty": "^13.1.3",
151
+ "rimraf": "^6.1.2",
91
152
  "supertest": "latest",
153
+ "@trpc/server": "^11.4.3",
92
154
  "ts-jest": "^29.3.2",
93
155
  "ts-node": "^10.9.1",
94
156
  "ts-patch": "^3.3.0",
95
157
  "tsx": "^4.20.4",
96
158
  "typescript": "^5.2.2",
97
159
  "typescript-eslint": "^8.31.0",
98
- "typescript-transform-paths": "^3.5.5"
160
+ "typescript-transform-paths": "^3.5.5",
161
+ "winston": "^3.19.0"
99
162
  },
100
163
  "engines": {
101
164
  "node": ">=18.9.1"
@@ -1,12 +0,0 @@
1
- import { MessageSendParams, Message as MessageType, MessageSendConfiguration } from "../../../types/index.js";
2
- export declare class MessageBuilder {
3
- message: MessageType;
4
- constructor(message?: Partial<MessageType>);
5
- valueOf(): MessageType;
6
- }
7
- export declare class MessageSendConfigurationBuilder {
8
- configuration: MessageSendConfiguration;
9
- constructor(configuration?: Partial<MessageSendConfiguration> | null);
10
- valueOf(): MessageSendConfiguration;
11
- }
12
- export declare const createMessageSendParams: (messageSendParams: Partial<MessageSendParams> | string) => MessageSendParams;
@@ -1,61 +0,0 @@
1
- import { v4 as uuidv4 } from "uuid";
2
- export class MessageBuilder {
3
- constructor(message = {}) {
4
- this.message = {
5
- role: "user",
6
- parts: [],
7
- metadata: undefined,
8
- extensions: undefined,
9
- referenceTaskIds: undefined,
10
- messageId: uuidv4(),
11
- taskId: undefined,
12
- contextId: undefined,
13
- kind: "message",
14
- };
15
- this.message.role = message.role ?? this.message.role;
16
- this.message.parts = message.parts ?? this.message.parts;
17
- this.message.metadata = message.metadata ?? this.message.metadata;
18
- this.message.extensions = message.extensions ?? this.message.extensions;
19
- this.message.referenceTaskIds =
20
- message.referenceTaskIds ?? this.message.referenceTaskIds;
21
- this.message.messageId = message.messageId ?? this.message.messageId;
22
- this.message.taskId = message.taskId ?? this.message.taskId;
23
- this.message.contextId = message.contextId ?? this.message.contextId;
24
- }
25
- valueOf() {
26
- return this.message;
27
- }
28
- }
29
- export class MessageSendConfigurationBuilder {
30
- constructor(configuration = {}) {
31
- this.configuration = {
32
- acceptedOutputModes: undefined,
33
- historyLength: undefined,
34
- pushNotificationConfig: undefined,
35
- blocking: undefined,
36
- };
37
- this.configuration.acceptedOutputModes =
38
- configuration?.acceptedOutputModes ??
39
- this.configuration.acceptedOutputModes;
40
- this.configuration.historyLength =
41
- configuration?.historyLength ?? this.configuration.historyLength;
42
- this.configuration.pushNotificationConfig =
43
- configuration?.pushNotificationConfig ??
44
- this.configuration.pushNotificationConfig;
45
- this.configuration.blocking =
46
- configuration?.blocking ?? this.configuration.blocking;
47
- }
48
- valueOf() {
49
- return this.configuration;
50
- }
51
- }
52
- export const createMessageSendParams = (messageSendParams) => {
53
- const isString = typeof messageSendParams === "string";
54
- return {
55
- message: new MessageBuilder(isString
56
- ? { parts: [{ text: messageSendParams, kind: "text" }] }
57
- : messageSendParams.message).valueOf(),
58
- configuration: new MessageSendConfigurationBuilder(isString ? undefined : messageSendParams.configuration).valueOf(),
59
- metadata: isString ? undefined : messageSendParams.metadata,
60
- };
61
- };
@@ -1,13 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- /**
6
- * For artinet specific conventions
7
- * AgentInfo will expand to incorporate additional details required from other protocols
8
- * (e.g. AgentFAQ(NANDA), AgentCard(A2A), etc.)
9
- */
10
- export { AgentCardSchema as AgentInfoSchema } from "./schemas/a2a/index.js";
11
- export type { AgentCard as AgentInfo } from "./schemas/a2a/index.js";
12
- export type { A2AEngine as AgentEngine } from "./interfaces/services/a2a/index.js";
13
- export type { A2AServiceInterface as Agent } from "./interfaces/services/a2a/index.js";
@@ -1,10 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- /**
6
- * For artinet specific conventions
7
- * AgentInfo will expand to incorporate additional details required from other protocols
8
- * (e.g. AgentFAQ(NANDA), AgentCard(A2A), etc.)
9
- */
10
- export { AgentCardSchema as AgentInfoSchema } from "./schemas/a2a/index.js";
@@ -1,3 +0,0 @@
1
- export * from "./services/index.js";
2
- export * from "./storage.js";
3
- export * from "./client.js";
@@ -1,3 +0,0 @@
1
- export * from "./services/index.js";
2
- export * from "./storage.js";
3
- export * from "./client.js";
@@ -1,37 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { Context, Command, TextPart, DataPart, FilePart } from "../../../index.js";
6
- /**
7
- * Restricting to command for now, but could be extended to other types of commands in the future.
8
- * When we shift to CoreCommand, move this into core.
9
- */
10
- export interface StepArgs<TCommand extends Command = Command> {
11
- command: TCommand;
12
- context: Context;
13
- }
14
- export type StepParams<TCommand extends Command = Command, TInboundArgs extends readonly unknown[] = []> = StepArgs<TCommand> & Partial<{
15
- content: string;
16
- args: TInboundArgs;
17
- }>;
18
- export type StepOutput<TPart extends DataPart["data"] | FilePart["file"] | TextPart["text"]> = {
19
- parts: Array<TPart> | TPart;
20
- };
21
- export type StepOutputWithForwardArgs<TPart extends DataPart["data"] | FilePart["file"] | TextPart["text"], TForwardArgs extends readonly unknown[] = []> = StepOutput<TPart> & {
22
- args: TForwardArgs;
23
- };
24
- export type Step<TCommand extends Command = Command, TPart extends DataPart["data"] | FilePart["file"] | TextPart["text"] = TextPart["text"], TInboundArgs extends readonly unknown[] = [], TForwardArgs extends readonly unknown[] = [], TOutput extends StepOutput<TPart> | StepOutputWithForwardArgs<TPart, TForwardArgs> | Array<TPart> | TPart = StepOutput<TPart>> = (params: StepParams<TCommand, TInboundArgs>) => Promise<TOutput> | TOutput;
25
- export type StepWithKind<TCommand extends Command = Command, TPart extends DataPart["data"] | FilePart["file"] | TextPart["text"] = TextPart["text"], TInboundArgs extends readonly unknown[] = [], TForwardArgs extends readonly unknown[] = [], TOutput extends StepOutput<TPart> | StepOutputWithForwardArgs<TPart, TForwardArgs> | Array<TPart> | TPart = StepOutput<TPart>, TKind extends "text" | "file" | "data" = "text"> = {
26
- step: Step<TCommand, TPart, TInboundArgs, TForwardArgs, TOutput>;
27
- kind: TKind;
28
- };
29
- export type OutArgsOf<O> = O extends StepOutputWithForwardArgs<any, infer A> ? A : [];
30
- export interface StepBuilder<TCommand extends Command = Command, TInboundArgs extends readonly unknown[] = []> {
31
- /**
32
- * Add a step to the builder.
33
- * @param step - The step to add.
34
- * @returns A new builder with the step added.
35
- */
36
- addStep<TPart extends DataPart["data"] | FilePart["file"] | TextPart["text"] = TextPart["text"], TForwardArgs extends readonly unknown[] = [], TOutput extends StepOutput<TPart> | StepOutputWithForwardArgs<TPart, TForwardArgs> | Array<TPart> | TPart = StepOutput<TPart>, TKind extends "text" | "file" | "data" = "text">(step: StepWithKind<TCommand, TPart, TInboundArgs, TForwardArgs, TOutput, TKind>): StepBuilder<TCommand, OutArgsOf<TOutput>>;
37
- }
@@ -1,162 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- /**
6
- * @fileoverview A2A (Agent-to-Agent) Context Type Definitions
7
- *
8
- * This module provides type definitions for the Agent-to-Agent communication context,
9
- * extending the core context types with A2A-specific functionality for task handling,
10
- * message processing, and event management.
11
- *
12
- * @module A2AContext
13
- * @version 0.5.7
14
- * @since 0.5.6
15
- * @author The Artinet Project
16
- */
17
- import { type TaskStatusUpdateEvent, type TaskArtifactUpdateEvent, type Task, type Message, A2ARequest, MessageSendParams } from "../../../schemas/a2a/index.js";
18
- import { CoreCommand, CoreState, CoreUpdate } from "../core/context/types.js";
19
- import { CoreContext } from "../core/context/context.js";
20
- import { TaskAndHistory } from "./legacy.js";
21
- /**
22
- * Represents the possible types of updates that can be yielded by a TaskHandler.
23
- *
24
- * This union type encompasses all event types that can be emitted during A2A
25
- * task processing, providing a type-safe way to handle different update scenarios.
26
- *
27
- * @description Either a Message, Task, TaskStatusUpdateEvent, or TaskArtifactUpdateEvent.
28
- *
29
- * @public
30
- * @since 0.5.6
31
- */
32
- export type UpdateEvent = Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent;
33
- /**
34
- * A2A Command type that extends CoreCommand with A2A-specific parameter constraints.
35
- *
36
- * This generic type provides type-safe command handling for A2A operations,
37
- * ensuring that command parameters conform to the expected A2A request structure.
38
- *
39
- * @template TParams - The parameter type for the command, must extend A2ARequest params
40
- * @default MessageSendParams - Default parameter type for message sending operations
41
- *
42
- * @example
43
- * ```typescript
44
- * // Using default MessageSendParams
45
- * const messageCommand: Command = {
46
- * type: 'send_message',
47
- * params: { content: 'Hello', recipient: 'agent123' }
48
- * };
49
- *
50
- * // Using custom parameter type
51
- * interface CustomParams extends NonNullable<A2ARequest["params"]> {
52
- * customField: string;
53
- * }
54
- * const customCommand: Command<CustomParams> = {
55
- * type: 'custom_action',
56
- * params: { customField: 'value' }
57
- * };
58
- * ```
59
- *
60
- * @public
61
- * @since 0.5.6
62
- */
63
- export type Command<TParams extends NonNullable<A2ARequest["params"]> = MessageSendParams> = CoreCommand<TParams>;
64
- /**
65
- * A2A State type that extends CoreState with task and history management.
66
- *
67
- * This type represents the state container for A2A operations, including
68
- * task tracking and historical data management capabilities.
69
- *
70
- * @example
71
- * ```typescript
72
- * const state: State = {
73
- * data: {
74
- * currentTask: taskInstance,
75
- * history: [...previousTasks]
76
- * },
77
- * metadata: {
78
- * lastUpdated: new Date(),
79
- * version: '1.0.0'
80
- * }
81
- * };
82
- * ```
83
- *
84
- * @public
85
- * @since 0.5.6
86
- */
87
- export type State = CoreState<TaskAndHistory>;
88
- /**
89
- * A2A Update type that extends CoreUpdate with A2A-specific update events.
90
- *
91
- * This generic type provides type-safe update handling for A2A operations,
92
- * ensuring that updates conform to the expected UpdateEvent structure.
93
- *
94
- * @template TUpdate - The update event type, must extend UpdateEvent
95
- * @default UpdateEvent - Default update event type
96
- *
97
- * @example
98
- * ```typescript
99
- * // Using default UpdateEvent
100
- * const update: Update = {
101
- * type: 'task_status_update',
102
- * payload: statusUpdateEvent
103
- * };
104
- *
105
- * // Using specific update type
106
- * const messageUpdate: Update<Message> = {
107
- * type: 'message',
108
- * payload: messageEvent
109
- * };
110
- * ```
111
- *
112
- * @public
113
- * @since 0.5.6
114
- */
115
- export type Update<TUpdate extends UpdateEvent = UpdateEvent> = CoreUpdate<TUpdate>;
116
- /**
117
- * A2A Context type that combines Command, State, and Update types for complete context management.
118
- *
119
- * This is the main context type for A2A operations, providing a comprehensive
120
- * type-safe interface for handling commands, managing state, and processing updates
121
- * within the Agent-to-Agent communication framework.
122
- *
123
- * @template TCommand - The command type, must extend Command
124
- * @template TState - The state type, must extend State
125
- * @template TUpdate - The update type, must extend Update<UpdateEvent>
126
- *
127
- * @default TCommand - Command<MessageSendParams>
128
- * @default TState - State
129
- * @default TUpdate - Update<UpdateEvent>
130
- *
131
- * @example
132
- * ```typescript
133
- * // Using default types
134
- * const context: Context = {
135
- * command: messageCommand,
136
- * state: currentState,
137
- * update: latestUpdate,
138
- * // ... other context properties
139
- * };
140
- *
141
- * // Using custom types
142
- * interface CustomCommand extends Command<CustomParams> {
143
- * priority: number;
144
- * }
145
- *
146
- * const customContext: Context<CustomCommand, State, Update<Task>> = {
147
- * command: customCommand,
148
- * state: currentState,
149
- * update: taskUpdate,
150
- * // ... other context properties
151
- * };
152
- * ```
153
- *
154
- * @remarks
155
- * This context type is designed to be the primary interface for A2A service
156
- * implementations, providing type safety and ensuring proper handling of
157
- * agent-to-agent communication patterns.
158
- *
159
- * @public
160
- * @since 0.5.6
161
- */
162
- export type Context<TCommand extends Command = Command<MessageSendParams>, TState extends State = State, TUpdate extends Update<UpdateEvent> = Update<UpdateEvent>> = CoreContext<TCommand, TState, TUpdate>;
@@ -1,7 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { ExecutionEngine } from "../core/execution/index.js";
6
- import { Command, State, Update } from "./context.js";
7
- export type A2AEngine = ExecutionEngine<Command, State, Update>;
@@ -1,5 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- export * from "./builder.js";
2
- export * from "./context.js";
3
- export * from "./engine.js";
4
- export * from "./legacy.js";
5
- export * from "./service.js";
@@ -1,5 +0,0 @@
1
- export * from "./builder.js";
2
- export * from "./context.js";
3
- export * from "./engine.js";
4
- export * from "./legacy.js";
5
- export * from "./service.js";