@artinet/sdk 0.5.17 → 0.6.0-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (316) hide show
  1. package/README.md +51 -557
  2. package/dist/browser/browser.d.ts +9 -0
  3. package/dist/browser/browser.js +10 -0
  4. package/dist/browser/client/a2a-client.d.ts +127 -0
  5. package/dist/browser/client/a2a-client.js +233 -0
  6. package/dist/browser/client/index.d.ts +1 -0
  7. package/dist/browser/client/index.js +1 -0
  8. package/dist/browser/config/index.d.ts +158 -0
  9. package/dist/browser/config/index.js +155 -0
  10. package/dist/browser/config/observability.d.ts +119 -0
  11. package/dist/browser/config/observability.js +35 -0
  12. package/dist/browser/services/a2a/helpers/message-builder.d.ts +17 -0
  13. package/dist/browser/services/a2a/helpers/message-builder.js +66 -0
  14. package/dist/browser/transport/rpc/parser.d.ts +15 -0
  15. package/dist/browser/transport/rpc/parser.js +48 -0
  16. package/dist/browser/transport/rpc/rpc-client.d.ts +80 -0
  17. package/dist/browser/transport/rpc/rpc-client.js +189 -0
  18. package/dist/browser/transport/streaming/event-stream.d.ts +25 -0
  19. package/dist/browser/transport/streaming/event-stream.js +100 -0
  20. package/dist/browser/types/a2a/a2a.d.ts +378 -0
  21. package/dist/browser/types/a2a/a2a.js +14 -0
  22. package/dist/browser/types/a2a/builder.d.ts +43 -0
  23. package/dist/browser/types/a2a/index.d.ts +3 -0
  24. package/dist/browser/types/a2a/index.js +2 -0
  25. package/dist/{types/interfaces → browser/types}/client.d.ts +25 -27
  26. package/dist/browser/types/core/core.d.ts +31 -0
  27. package/dist/browser/types/core/index.d.ts +1 -0
  28. package/dist/browser/types/core/index.js +1 -0
  29. package/dist/{types/interfaces/services → browser/types}/index.d.ts +3 -0
  30. package/dist/{types/interfaces/services → browser/types}/index.js +3 -0
  31. package/dist/browser/types/mcp/index.d.ts +1 -0
  32. package/dist/browser/types/mcp/index.js +1 -0
  33. package/dist/{types/interfaces/services/mcp/service.d.ts → browser/types/mcp/mcp.d.ts} +4 -3
  34. package/dist/browser/types/mcp/mcp.js +5 -0
  35. package/dist/browser/types/storage.d.ts +21 -0
  36. package/dist/browser/types/utils/index.d.ts +1 -0
  37. package/dist/browser/types/utils/index.js +1 -0
  38. package/dist/browser/types/utils/transform.d.ts +64 -0
  39. package/dist/browser/types/utils/transform.js +35 -0
  40. package/dist/browser/utils/common/constants.d.ts +11 -0
  41. package/dist/browser/utils/common/constants.js +38 -0
  42. package/dist/browser/utils/common/errors.d.ts +24 -0
  43. package/dist/browser/utils/common/errors.js +42 -0
  44. package/dist/browser/utils/common/utils.d.ts +32 -0
  45. package/dist/browser/utils/common/utils.js +43 -0
  46. package/dist/client/a2a-client.d.ts +21 -19
  47. package/dist/client/a2a-client.js +30 -9
  48. package/dist/config/default.d.ts +50 -0
  49. package/dist/config/default.js +62 -0
  50. package/dist/config/index.d.ts +158 -0
  51. package/dist/config/index.js +155 -0
  52. package/dist/config/observability.d.ts +119 -0
  53. package/dist/config/observability.js +35 -0
  54. package/dist/extensions/otel.d.ts +98 -0
  55. package/dist/extensions/otel.js +190 -0
  56. package/dist/extensions/pino.d.ts +44 -0
  57. package/dist/extensions/pino.js +107 -0
  58. package/dist/extensions/winston.d.ts +47 -0
  59. package/dist/extensions/winston.js +114 -0
  60. package/dist/index.d.ts +2 -0
  61. package/dist/index.js +2 -0
  62. package/dist/server/express/errors.js +3 -3
  63. package/dist/server/express/middeware.d.ts +2 -2
  64. package/dist/server/express/middeware.js +36 -9
  65. package/dist/server/express/server.d.ts +9 -55
  66. package/dist/server/express/server.js +51 -32
  67. package/dist/services/a2a/execute.d.ts +6 -0
  68. package/dist/services/a2a/execute.js +25 -0
  69. package/dist/services/a2a/factory/builder.d.ts +21 -80
  70. package/dist/services/a2a/factory/builder.js +23 -13
  71. package/dist/services/a2a/factory/context.d.ts +15 -128
  72. package/dist/services/a2a/factory/context.js +31 -136
  73. package/dist/services/a2a/factory/handler.d.ts +6 -0
  74. package/dist/services/a2a/factory/{method.js → handler.js} +2 -2
  75. package/dist/services/a2a/factory/index.d.ts +1 -2
  76. package/dist/services/a2a/factory/index.js +1 -2
  77. package/dist/services/a2a/factory/service.d.ts +20 -7
  78. package/dist/services/a2a/factory/service.js +4 -4
  79. package/dist/services/a2a/factory/state-machine.d.ts +11 -0
  80. package/dist/services/a2a/factory/state-machine.js +66 -0
  81. package/dist/services/a2a/{state/update → handlers}/artifact.d.ts +4 -4
  82. package/dist/services/a2a/handlers/cancel-task.d.ts +11 -0
  83. package/dist/services/a2a/handlers/cancel-task.js +33 -0
  84. package/dist/services/a2a/handlers/get-task.d.ts +11 -0
  85. package/dist/services/a2a/handlers/get-task.js +13 -0
  86. package/dist/services/a2a/handlers/resubscribe-task.d.ts +11 -0
  87. package/dist/services/a2a/handlers/resubscribe-task.js +56 -0
  88. package/dist/services/a2a/handlers/send-message.d.ts +11 -0
  89. package/dist/services/a2a/handlers/send-message.js +35 -0
  90. package/dist/services/a2a/handlers/stream-message.d.ts +11 -0
  91. package/dist/services/a2a/handlers/stream-message.js +19 -0
  92. package/dist/services/a2a/handlers/update.d.ts +17 -0
  93. package/dist/services/a2a/handlers/update.js +114 -0
  94. package/dist/services/a2a/helpers/agentcard-builder.d.ts +9 -5
  95. package/dist/services/a2a/helpers/agentcard-builder.js +5 -0
  96. package/dist/services/a2a/helpers/content.d.ts +2 -2
  97. package/dist/services/a2a/helpers/content.js +4 -0
  98. package/dist/services/a2a/helpers/history.d.ts +6 -0
  99. package/dist/services/a2a/helpers/history.js +7 -0
  100. package/dist/services/a2a/helpers/index.d.ts +3 -1
  101. package/dist/services/a2a/helpers/index.js +3 -1
  102. package/dist/services/a2a/helpers/message-builder.d.ts +13 -8
  103. package/dist/services/a2a/helpers/message-builder.js +5 -0
  104. package/dist/services/a2a/helpers/part.d.ts +9 -9
  105. package/dist/services/a2a/helpers/references.d.ts +6 -0
  106. package/dist/services/a2a/helpers/references.js +22 -0
  107. package/dist/services/a2a/index.d.ts +9 -5
  108. package/dist/services/a2a/index.js +8 -5
  109. package/dist/services/a2a/managers.d.ts +23 -0
  110. package/dist/services/a2a/managers.js +95 -0
  111. package/dist/services/a2a/messenger.d.ts +35 -0
  112. package/dist/services/{core/managers/command.js → a2a/messenger.js} +27 -31
  113. package/dist/services/a2a/service.d.ts +41 -371
  114. package/dist/services/a2a/service.js +239 -70
  115. package/dist/services/a2a/state-machine.d.ts +18 -0
  116. package/dist/services/a2a/state-machine.js +76 -0
  117. package/dist/services/a2a/streams.d.ts +22 -0
  118. package/dist/services/a2a/streams.js +98 -0
  119. package/dist/services/core/index.d.ts +1 -2
  120. package/dist/services/core/index.js +1 -2
  121. package/dist/services/core/manager.d.ts +15 -0
  122. package/dist/services/core/manager.js +42 -0
  123. package/dist/services/mcp/service.d.ts +11 -15
  124. package/dist/services/mcp/service.js +16 -16
  125. package/dist/transport/index.d.ts +0 -1
  126. package/dist/transport/index.js +1 -1
  127. package/dist/transport/rpc/parser.d.ts +2 -2
  128. package/dist/transport/rpc/parser.js +7 -7
  129. package/dist/transport/rpc/rpc-client.d.ts +5 -5
  130. package/dist/transport/rpc/rpc-client.js +7 -7
  131. package/dist/transport/streaming/event-stream.d.ts +3 -3
  132. package/dist/transport/streaming/event-stream.js +11 -10
  133. package/dist/transport/trpc/a2a/factory/router.d.ts +479 -871
  134. package/dist/transport/trpc/a2a/factory/router.js +2 -2
  135. package/dist/transport/trpc/a2a/routes/info.d.ts +108 -8
  136. package/dist/transport/trpc/a2a/routes/info.js +6 -2
  137. package/dist/transport/trpc/a2a/routes/message/route.d.ts +113 -162
  138. package/dist/transport/trpc/a2a/routes/message/route.js +7 -13
  139. package/dist/transport/trpc/a2a/routes/tasks/route.d.ts +114 -212
  140. package/dist/transport/trpc/a2a/routes/tasks/route.js +16 -19
  141. package/dist/transport/trpc/a2a/trpc.d.ts +9 -253
  142. package/dist/types/a2a/a2a.d.ts +378 -0
  143. package/dist/types/a2a/a2a.js +14 -0
  144. package/dist/types/a2a/builder.d.ts +43 -0
  145. package/dist/types/a2a/index.d.ts +3 -0
  146. package/dist/types/a2a/index.js +2 -0
  147. package/dist/types/client.d.ts +133 -0
  148. package/dist/types/core/core.d.ts +31 -0
  149. package/dist/types/core/core.js +1 -0
  150. package/dist/types/core/index.d.ts +1 -0
  151. package/dist/types/core/index.js +1 -0
  152. package/dist/types/index.d.ts +6 -3
  153. package/dist/types/index.js +6 -3
  154. package/dist/types/mcp/index.d.ts +1 -0
  155. package/dist/types/mcp/index.js +1 -0
  156. package/dist/types/mcp/mcp.d.ts +50 -0
  157. package/dist/types/mcp/mcp.js +5 -0
  158. package/dist/types/protocol.d.ts +33 -0
  159. package/dist/types/protocol.js +34 -0
  160. package/dist/types/storage.d.ts +21 -0
  161. package/dist/utils/common/constants.d.ts +7 -7
  162. package/dist/utils/common/constants.js +10 -10
  163. package/dist/utils/common/errors.d.ts +18 -17
  164. package/dist/utils/common/errors.js +14 -13
  165. package/dist/utils/common/parse.d.ts +7 -0
  166. package/dist/utils/common/parse.js +14 -0
  167. package/dist/utils/common/schema-validation.d.ts +2 -0
  168. package/dist/utils/common/schema-validation.js +12 -0
  169. package/dist/utils/common/utils.d.ts +23 -0
  170. package/dist/utils/common/utils.js +32 -0
  171. package/dist/utils/common/zAsyncIterable-v3.d.ts +1 -1
  172. package/dist/utils/common/zAsyncIterable-v3.js +2 -1
  173. package/dist/utils/index.d.ts +3 -3
  174. package/dist/utils/index.js +3 -3
  175. package/dist/utils/storage/file.d.ts +8 -17
  176. package/dist/utils/storage/file.js +44 -73
  177. package/package.json +86 -23
  178. package/dist/services/a2a/factory/event.d.ts +0 -58
  179. package/dist/services/a2a/factory/event.js +0 -177
  180. package/dist/services/a2a/factory/method.d.ts +0 -6
  181. package/dist/services/a2a/managers/cancellation.d.ts +0 -11
  182. package/dist/services/a2a/managers/cancellation.js +0 -16
  183. package/dist/services/a2a/managers/connection.d.ts +0 -11
  184. package/dist/services/a2a/managers/connection.js +0 -16
  185. package/dist/services/a2a/managers/context.d.ts +0 -11
  186. package/dist/services/a2a/managers/context.js +0 -16
  187. package/dist/services/a2a/managers/index.d.ts +0 -5
  188. package/dist/services/a2a/managers/index.js +0 -5
  189. package/dist/services/a2a/managers/task.d.ts +0 -11
  190. package/dist/services/a2a/managers/task.js +0 -16
  191. package/dist/services/a2a/methods/cancel-task.d.ts +0 -7
  192. package/dist/services/a2a/methods/cancel-task.js +0 -43
  193. package/dist/services/a2a/methods/get-task.d.ts +0 -112
  194. package/dist/services/a2a/methods/get-task.js +0 -14
  195. package/dist/services/a2a/methods/resubscribe-task.d.ts +0 -7
  196. package/dist/services/a2a/methods/resubscribe-task.js +0 -80
  197. package/dist/services/a2a/methods/send-message.d.ts +0 -7
  198. package/dist/services/a2a/methods/send-message.js +0 -19
  199. package/dist/services/a2a/methods/stream-message.d.ts +0 -8
  200. package/dist/services/a2a/methods/stream-message.js +0 -21
  201. package/dist/services/a2a/state/index.d.ts +0 -3
  202. package/dist/services/a2a/state/index.js +0 -3
  203. package/dist/services/a2a/state/load.d.ts +0 -14
  204. package/dist/services/a2a/state/load.js +0 -71
  205. package/dist/services/a2a/state/process.d.ts +0 -7
  206. package/dist/services/a2a/state/process.js +0 -13
  207. package/dist/services/a2a/state/update/index.d.ts +0 -2
  208. package/dist/services/a2a/state/update/index.js +0 -2
  209. package/dist/services/a2a/state/update/update.d.ts +0 -23
  210. package/dist/services/a2a/state/update/update.js +0 -123
  211. package/dist/services/core/execution/execute.d.ts +0 -6
  212. package/dist/services/core/execution/execute.js +0 -25
  213. package/dist/services/core/execution/index.d.ts +0 -1
  214. package/dist/services/core/execution/index.js +0 -1
  215. package/dist/services/core/managers/command.d.ts +0 -39
  216. package/dist/services/core/managers/event.d.ts +0 -18
  217. package/dist/services/core/managers/event.js +0 -56
  218. package/dist/services/core/managers/index.d.ts +0 -3
  219. package/dist/services/core/managers/index.js +0 -3
  220. package/dist/services/core/managers/stream.d.ts +0 -20
  221. package/dist/services/core/managers/stream.js +0 -77
  222. package/dist/types/ext.d.ts +0 -13
  223. package/dist/types/ext.js +0 -10
  224. package/dist/types/interfaces/index.d.ts +0 -3
  225. package/dist/types/interfaces/index.js +0 -3
  226. package/dist/types/interfaces/services/a2a/builder.d.ts +0 -37
  227. package/dist/types/interfaces/services/a2a/context.d.ts +0 -162
  228. package/dist/types/interfaces/services/a2a/engine.d.ts +0 -7
  229. package/dist/types/interfaces/services/a2a/index.d.ts +0 -5
  230. package/dist/types/interfaces/services/a2a/index.js +0 -5
  231. package/dist/types/interfaces/services/a2a/legacy.d.ts +0 -93
  232. package/dist/types/interfaces/services/a2a/service.d.ts +0 -409
  233. package/dist/types/interfaces/services/a2a/service.js +0 -5
  234. package/dist/types/interfaces/services/core/context/command.d.ts +0 -25
  235. package/dist/types/interfaces/services/core/context/command.js +0 -5
  236. package/dist/types/interfaces/services/core/context/context.d.ts +0 -207
  237. package/dist/types/interfaces/services/core/context/context.js +0 -5
  238. package/dist/types/interfaces/services/core/context/index.d.ts +0 -3
  239. package/dist/types/interfaces/services/core/context/index.js +0 -3
  240. package/dist/types/interfaces/services/core/context/types.d.ts +0 -11
  241. package/dist/types/interfaces/services/core/context/types.js +0 -5
  242. package/dist/types/interfaces/services/core/execution/engine.d.ts +0 -106
  243. package/dist/types/interfaces/services/core/execution/engine.js +0 -5
  244. package/dist/types/interfaces/services/core/execution/environment.d.ts +0 -11
  245. package/dist/types/interfaces/services/core/execution/environment.js +0 -5
  246. package/dist/types/interfaces/services/core/execution/execute.d.ts +0 -7
  247. package/dist/types/interfaces/services/core/execution/execute.js +0 -5
  248. package/dist/types/interfaces/services/core/execution/index.d.ts +0 -3
  249. package/dist/types/interfaces/services/core/execution/index.js +0 -3
  250. package/dist/types/interfaces/services/core/index.d.ts +0 -4
  251. package/dist/types/interfaces/services/core/index.js +0 -4
  252. package/dist/types/interfaces/services/core/managers/cancellation.d.ts +0 -9
  253. package/dist/types/interfaces/services/core/managers/cancellation.js +0 -5
  254. package/dist/types/interfaces/services/core/managers/connection.d.ts +0 -9
  255. package/dist/types/interfaces/services/core/managers/connection.js +0 -5
  256. package/dist/types/interfaces/services/core/managers/context.d.ts +0 -17
  257. package/dist/types/interfaces/services/core/managers/context.js +0 -5
  258. package/dist/types/interfaces/services/core/managers/event.d.ts +0 -328
  259. package/dist/types/interfaces/services/core/managers/event.js +0 -5
  260. package/dist/types/interfaces/services/core/managers/index.d.ts +0 -6
  261. package/dist/types/interfaces/services/core/managers/index.js +0 -6
  262. package/dist/types/interfaces/services/core/managers/stream.d.ts +0 -217
  263. package/dist/types/interfaces/services/core/managers/stream.js +0 -5
  264. package/dist/types/interfaces/services/core/managers/task.d.ts +0 -9
  265. package/dist/types/interfaces/services/core/service.d.ts +0 -115
  266. package/dist/types/interfaces/services/core/service.js +0 -5
  267. package/dist/types/interfaces/services/mcp/index.d.ts +0 -1
  268. package/dist/types/interfaces/services/mcp/index.js +0 -1
  269. package/dist/types/interfaces/services/mcp/service.js +0 -5
  270. package/dist/types/interfaces/storage.d.ts +0 -8
  271. package/dist/types/schemas/a2a/agent.d.ts +0 -2583
  272. package/dist/types/schemas/a2a/agent.js +0 -323
  273. package/dist/types/schemas/a2a/auth.d.ts +0 -908
  274. package/dist/types/schemas/a2a/auth.js +0 -283
  275. package/dist/types/schemas/a2a/error.d.ts +0 -396
  276. package/dist/types/schemas/a2a/error.js +0 -163
  277. package/dist/types/schemas/a2a/index.d.ts +0 -11
  278. package/dist/types/schemas/a2a/index.js +0 -11
  279. package/dist/types/schemas/a2a/kind.d.ts +0 -11
  280. package/dist/types/schemas/a2a/kind.js +0 -20
  281. package/dist/types/schemas/a2a/message.d.ts +0 -10343
  282. package/dist/types/schemas/a2a/message.js +0 -130
  283. package/dist/types/schemas/a2a/notification.d.ts +0 -1517
  284. package/dist/types/schemas/a2a/notification.js +0 -203
  285. package/dist/types/schemas/a2a/parameters.d.ts +0 -956
  286. package/dist/types/schemas/a2a/parameters.js +0 -241
  287. package/dist/types/schemas/a2a/protocol.d.ts +0 -14363
  288. package/dist/types/schemas/a2a/protocol.js +0 -59
  289. package/dist/types/schemas/a2a/rpc.d.ts +0 -182
  290. package/dist/types/schemas/a2a/rpc.js +0 -126
  291. package/dist/types/schemas/a2a/task.d.ts +0 -5886
  292. package/dist/types/schemas/a2a/task.js +0 -134
  293. package/dist/types/schemas/a2a/transport.d.ts +0 -31
  294. package/dist/types/schemas/a2a/transport.js +0 -28
  295. package/dist/types/schemas/index.d.ts +0 -1
  296. package/dist/types/schemas/index.js +0 -1
  297. package/dist/utils/logging/index.d.ts +0 -2
  298. package/dist/utils/logging/index.js +0 -2
  299. package/dist/utils/logging/log.d.ts +0 -33
  300. package/dist/utils/logging/log.js +0 -75
  301. package/dist/utils/logging/logger.d.ts +0 -18
  302. package/dist/utils/logging/logger.js +0 -18
  303. package/dist/utils/storage/memory.d.ts +0 -25
  304. package/dist/utils/storage/memory.js +0 -47
  305. /package/dist/{types/interfaces/services → browser/types}/a2a/builder.js +0 -0
  306. /package/dist/{types/interfaces → browser/types}/client.js +0 -0
  307. /package/dist/{types/interfaces/services/core/managers/task.js → browser/types/core/core.js} +0 -0
  308. /package/dist/{types/interfaces/services → browser/types}/protocol.d.ts +0 -0
  309. /package/dist/{types/interfaces/services → browser/types}/protocol.js +0 -0
  310. /package/dist/{types/interfaces → browser/types}/storage.js +0 -0
  311. /package/dist/services/a2a/{state/update → handlers}/artifact.js +0 -0
  312. /package/dist/services/a2a/{methods → handlers}/index.d.ts +0 -0
  313. /package/dist/services/a2a/{methods → handlers}/index.js +0 -0
  314. /package/dist/types/{interfaces/services/a2a/context.js → a2a/builder.js} +0 -0
  315. /package/dist/types/{interfaces/services/a2a/engine.js → client.js} +0 -0
  316. /package/dist/types/{interfaces/services/a2a/legacy.js → storage.js} +0 -0
@@ -1,134 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { z } from "zod";
6
- import { MessageSchema, ArtifactSchema } from "./parameters.js";
7
- import { JSONRPCErrorResponseSchema, JSONRPCRequestSchema, JSONRPCSuccessResponseSchema, } from "./rpc.js";
8
- import { KindSchema } from "./kind.js";
9
- /**
10
- * @description Represents the state of a task within the A2A protocol.
11
- */
12
- export const TaskStateSchema = z
13
- .enum([
14
- "submitted",
15
- "working",
16
- "input-required",
17
- "completed",
18
- "canceled",
19
- "failed",
20
- "rejected",
21
- "auth-required",
22
- "unknown",
23
- ])
24
- .describe("Defines the lifecycle states of a Task.");
25
- export const TaskState = TaskStateSchema.enum;
26
- /**
27
- * Basic parameters used for task ID operations.
28
- */
29
- export const TaskIdParamsSchema = z
30
- .object({
31
- id: z.string().describe("The ID of the task to query."),
32
- metadata: z
33
- .record(z.string(), z.unknown())
34
- .optional()
35
- .describe("Additional metadata to include in the request."),
36
- })
37
- .describe("Defines the parameters for a request to get a task.");
38
- /**
39
- * Parameters used for querying task-related information by ID.
40
- */
41
- export const TaskQueryParamsSchema = TaskIdParamsSchema.extend({
42
- historyLength: z.number().optional(),
43
- });
44
- /**
45
- * Represents the status of a task at a specific point in time.
46
- */
47
- export const TaskStatusSchema = z.object({
48
- state: TaskStateSchema,
49
- message: MessageSchema.optional(),
50
- timestamp: z.string().datetime().optional(),
51
- });
52
- /**
53
- * Represents a task being processed by an agent.
54
- */
55
- export const TaskSchema = z.object({
56
- id: z.string(),
57
- contextId: z.string(),
58
- status: TaskStatusSchema,
59
- history: z.array(MessageSchema).optional(),
60
- artifacts: z.array(ArtifactSchema).optional(),
61
- metadata: z.record(z.string(), z.unknown()).optional(),
62
- kind: KindSchema.refine((kind) => kind === "task"),
63
- });
64
- /**
65
- * Represents a status update event for a task, typically used in streaming scenarios.
66
- */
67
- export const TaskStatusUpdateEventSchema = z.object({
68
- taskId: z.string(),
69
- contextId: z.string(),
70
- kind: KindSchema.refine((kind) => kind === "status-update"),
71
- status: TaskStatusSchema,
72
- final: z.boolean(),
73
- metadata: z.record(z.string(), z.unknown()).optional(),
74
- });
75
- /**
76
- * Represents an artifact update event for a task, typically used in streaming scenarios.
77
- */
78
- export const TaskArtifactUpdateEventSchema = z.object({
79
- taskId: z.string(),
80
- contextId: z.string(),
81
- kind: KindSchema.refine((kind) => kind === "artifact-update"),
82
- artifact: ArtifactSchema,
83
- append: z.boolean().optional(),
84
- lastChunk: z.boolean().optional(),
85
- metadata: z.record(z.string(), z.unknown()).optional(),
86
- });
87
- /**
88
- * @description Request to retrieve the current state of a task.
89
- */
90
- export const GetTaskRequestSchema = JSONRPCRequestSchema.extend({
91
- method: z.literal("tasks/get"),
92
- params: TaskQueryParamsSchema.describe("Defines the parameters for a request to get a task."),
93
- }).describe("Represents a JSON-RPC request for the `tasks/get` method.");
94
- /**
95
- * @description Represents a successful JSON-RPC response for the `tasks/get` method.
96
- */
97
- export const GetTaskSuccessResponseSchema = JSONRPCSuccessResponseSchema.extend({
98
- /**
99
- * @required The result of the request, which can be a direct reply Message or the initial Task object.
100
- */
101
- result: TaskSchema.describe("The result of the request, which can be a direct reply Message or the initial Task object."),
102
- }).describe("JSON-RPC success response model for the 'tasks/get' method.");
103
- /**
104
- * @description Represents a JSON-RPC response for the `tasks/get` method.
105
- */
106
- export const GetTaskResponseSchema = z
107
- .union([GetTaskSuccessResponseSchema, JSONRPCErrorResponseSchema])
108
- .describe("Represents a JSON-RPC response for the `tasks/get` method.");
109
- /**
110
- * @description Request to re-subscribe to a task's updates.
111
- */
112
- export const TaskResubscriptionRequestSchema = JSONRPCRequestSchema.extend({
113
- method: z.literal("tasks/resubscribe"),
114
- params: TaskIdParamsSchema.describe("Defines the parameters for a request to re-subscribe to a task's updates."),
115
- }).describe("Represents a JSON-RPC request for the `tasks/resubscribe` method.");
116
- /**
117
- * @description Request to cancel a task.
118
- */
119
- export const CancelTaskRequestSchema = JSONRPCRequestSchema.extend({
120
- method: z.literal("tasks/cancel"),
121
- params: TaskIdParamsSchema.describe("Defines the parameters for a request to cancel a task."),
122
- }).describe("Represents a JSON-RPC request for the `tasks/cancel` method.");
123
- /**
124
- * @description Represents a successful JSON-RPC response for the `tasks/cancel` method.
125
- */
126
- export const CancelTaskSuccessResponseSchema = JSONRPCSuccessResponseSchema.extend({
127
- result: TaskSchema.describe("The result of the request, which can be a direct reply Message or the initial Task object."),
128
- }).describe("JSON-RPC success response model for the 'tasks/cancel' method.");
129
- /**
130
- * @description Represents a JSON-RPC response for the `tasks/cancel` method.
131
- */
132
- export const CancelTaskResponseSchema = z
133
- .union([CancelTaskSuccessResponseSchema, JSONRPCErrorResponseSchema])
134
- .describe("Represents a JSON-RPC response for the `tasks/cancel` method.");
@@ -1,31 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { z } from "zod";
6
- /**
7
- * @description Supported A2A transport protocols.
8
- */
9
- export declare const TransportProtocolSchema: z.ZodEnum<["JSONRPC", "GRPC", "HTTP+JSON"]>;
10
- export type TransportProtocol = z.infer<typeof TransportProtocolSchema>;
11
- /**
12
- * @description Declares a combination of a target URL and a transport protocol for interacting with the agent.
13
- * This allows agents to expose the same functionality over multiple transport mechanisms.
14
- */
15
- export declare const AgentInterfaceSchema: z.ZodObject<{
16
- /**
17
- * @required The URL where this interface is available. Must be a valid absolute HTTPS URL in production.
18
- */
19
- url: z.ZodString;
20
- /**
21
- * @required The transport protocol supported at this URL.
22
- */
23
- transport: z.ZodUnion<[z.ZodEnum<["JSONRPC", "GRPC", "HTTP+JSON"]>, z.ZodString]>;
24
- }, "strip", z.ZodTypeAny, {
25
- url: string;
26
- transport: string;
27
- }, {
28
- url: string;
29
- transport: string;
30
- }>;
31
- export type AgentInterface = z.infer<typeof AgentInterfaceSchema>;
@@ -1,28 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { z } from "zod";
6
- /**
7
- * @description Supported A2A transport protocols.
8
- */
9
- export const TransportProtocolSchema = z.enum(["JSONRPC", "GRPC", "HTTP+JSON"]);
10
- /**
11
- * @description Declares a combination of a target URL and a transport protocol for interacting with the agent.
12
- * This allows agents to expose the same functionality over multiple transport mechanisms.
13
- */
14
- export const AgentInterfaceSchema = z.object({
15
- /**
16
- * @required The URL where this interface is available. Must be a valid absolute HTTPS URL in production.
17
- */
18
- url: z
19
- .string()
20
- .url()
21
- .describe("The URL where this interface is available. Must be a valid absolute HTTPS URL in production."),
22
- /**
23
- * @required The transport protocol supported at this URL.
24
- */
25
- transport: z
26
- .union([TransportProtocolSchema, z.string()])
27
- .describe("The transport protocol supported at this URL."),
28
- });
@@ -1 +0,0 @@
1
- export * from "./a2a/index.js";
@@ -1 +0,0 @@
1
- export * from "./a2a/index.js";
@@ -1,2 +0,0 @@
1
- export * from "./log.js";
2
- export * from "./logger.js";
@@ -1,2 +0,0 @@
1
- export * from "./log.js";
2
- export * from "./logger.js";
@@ -1,33 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- /**
6
- * Logger utility for server operations
7
- * @param context The context of the log (e.g., "A2AServer", "TaskStore")
8
- * @param message The message to log
9
- * @param data Optional data to include in the log
10
- */
11
- export declare function logDebug(context: string, message: string, data?: unknown): void;
12
- /**
13
- * Logger utility for server errors
14
- * @param context The context of the log (e.g., "A2AServer", "TaskStore")
15
- * @param message The message to log
16
- * @param error The error object
17
- * @param data Optional additional data
18
- */
19
- export declare function logError(context: string, message: string, error: unknown, data?: unknown): void;
20
- /**
21
- * Logger utility for server warnings
22
- * @param context The context of the log (e.g., "A2AServer", "TaskStore")
23
- * @param message The message to log
24
- * @param data Optional data to include in the log
25
- */
26
- export declare function logWarn(context: string, message: string, data?: unknown): void;
27
- /**
28
- * Logger utility for server information
29
- * @param context The context of the log (e.g., "A2AServer", "TaskStore")
30
- * @param message The message to log
31
- * @param data Optional data to include in the log
32
- */
33
- export declare function logInfo(context: string, message: string, data?: unknown): void;
@@ -1,75 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { logger, level } from "./logger.js";
6
- /**
7
- * Logger utility for server operations
8
- * @param context The context of the log (e.g., "A2AServer", "TaskStore")
9
- * @param message The message to log
10
- * @param data Optional data to include in the log
11
- */
12
- export function logDebug(context, message, data) {
13
- const logData = { component: context };
14
- if (data !== undefined) {
15
- logData.data = data;
16
- }
17
- if (level === "silent" || level === "warning" || level === "error" || level === "info") {
18
- return;
19
- }
20
- logger.debug(logData, message);
21
- }
22
- /**
23
- * Logger utility for server errors
24
- * @param context The context of the log (e.g., "A2AServer", "TaskStore")
25
- * @param message The message to log
26
- * @param error The error object
27
- * @param data Optional additional data
28
- */
29
- export function logError(context, message, error, data) {
30
- const logData = {
31
- component: context,
32
- err: error instanceof Error ? error : new Error(String(error)),
33
- };
34
- if (data !== undefined) {
35
- logData.data = data;
36
- }
37
- if (level === "silent") {
38
- return;
39
- }
40
- logger.error(logData, message);
41
- }
42
- /**
43
- * Logger utility for server warnings
44
- * @param context The context of the log (e.g., "A2AServer", "TaskStore")
45
- * @param message The message to log
46
- * @param data Optional data to include in the log
47
- */
48
- export function logWarn(context, message, data) {
49
- const logData = { component: context };
50
- if (data !== undefined) {
51
- logData.data = data;
52
- }
53
- if (level === "silent" || level === "error") {
54
- return;
55
- }
56
- logger.warn(logData, message);
57
- }
58
- /**
59
- * Logger utility for server information
60
- * @param context The context of the log (e.g., "A2AServer", "TaskStore")
61
- * @param message The message to log
62
- * @param data Optional data to include in the log
63
- */
64
- export function logInfo(context, message, data) {
65
- const logData = { component: context };
66
- if (data !== undefined) {
67
- logData.data = data;
68
- }
69
- if (level === "error" ||
70
- level === "warning" ||
71
- level === "silent") {
72
- return;
73
- }
74
- logger.info(logData, message);
75
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- /**
6
- * A lightweight cross-platform logger instance
7
- */
8
- export declare const logger: Console;
9
- export declare let level: "trace" | "verbose" | "debug" | "info" | "warning" | "error" | "silent";
10
- /**
11
- * Configures the logger with the specified options
12
- * @param options - Logger configuration options
13
- */
14
- export declare function configureLogger(options: {
15
- level?: "trace" | "verbose" | "debug" | "info" | "warning" | "error" | "silent";
16
- name?: string;
17
- prettyPrint?: boolean;
18
- }): Console;
@@ -1,18 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- /**
6
- * A lightweight cross-platform logger instance
7
- */
8
- export const logger = console;
9
- export let level = "silent";
10
- /**
11
- * Configures the logger with the specified options
12
- * @param options - Logger configuration options
13
- */
14
- export function configureLogger(options) {
15
- level = options.level || "silent";
16
- return logger;
17
- }
18
- configureLogger({ level: "silent" });
@@ -1,25 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { TaskAndHistory, TaskManagerInterface } from "../../types/index.js";
6
- /**
7
- * In-memory implementation of the TaskStore interface.
8
- * Stores tasks and their history in memory. Not persisted between server restarts.
9
- */
10
- export declare class InMemoryTaskStore implements TaskManagerInterface<TaskAndHistory> {
11
- private store;
12
- /**
13
- * Loads a task and its history by task ID.
14
- * @param taskId The ID of the task to load.
15
- * @returns A promise resolving to the task and history, or null if not found.
16
- */
17
- getState(taskId: string): Promise<TaskAndHistory | undefined>;
18
- /**
19
- * Saves a task and its history.
20
- * @param data The task and history to save.
21
- * @returns A promise that resolves when the save is complete.
22
- */
23
- setState(taskId: string, data: TaskAndHistory): Promise<void>;
24
- getStates(): Promise<string[]>;
25
- }
@@ -1,47 +0,0 @@
1
- /**
2
- * Copyright 2025 The Artinet Project
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { logDebug } from "../logging/log.js";
6
- /**
7
- * In-memory implementation of the TaskStore interface.
8
- * Stores tasks and their history in memory. Not persisted between server restarts.
9
- */
10
- export class InMemoryTaskStore {
11
- store = new Map();
12
- /**
13
- * Loads a task and its history by task ID.
14
- * @param taskId The ID of the task to load.
15
- * @returns A promise resolving to the task and history, or null if not found.
16
- */
17
- async getState(taskId) {
18
- logDebug("InMemoryTaskStore", `Loading task: ${taskId}`);
19
- const entry = this.store.get(taskId);
20
- // Return copies to prevent external mutation
21
- return entry
22
- ? {
23
- task: { ...entry.task },
24
- history: [...entry.history],
25
- }
26
- : undefined;
27
- }
28
- /**
29
- * Saves a task and its history.
30
- * @param data The task and history to save.
31
- * @returns A promise that resolves when the save is complete.
32
- */
33
- async setState(taskId, data) {
34
- logDebug("InMemoryTaskStore", `Saving task: ${data.task.id}`);
35
- if (taskId !== data.task.id) {
36
- throw new Error("Task ID mismatch");
37
- }
38
- // Store copies to prevent internal mutation if caller reuses objects
39
- this.store.set(taskId, {
40
- task: { ...data.task },
41
- history: [...data.history],
42
- });
43
- }
44
- async getStates() {
45
- return Array.from(this.store.keys());
46
- }
47
- }