@mcpmesh/sdk 1.3.4 → 2.0.0-beta.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 (262) hide show
  1. package/dist/__tests__/a2a/a2a-bearer.spec.d.ts +2 -0
  2. package/dist/__tests__/a2a/a2a-bearer.spec.d.ts.map +1 -0
  3. package/dist/__tests__/a2a/a2a-bearer.spec.js +58 -0
  4. package/dist/__tests__/a2a/a2a-bearer.spec.js.map +1 -0
  5. package/dist/__tests__/a2a/a2a-client.spec.d.ts +2 -0
  6. package/dist/__tests__/a2a/a2a-client.spec.d.ts.map +1 -0
  7. package/dist/__tests__/a2a/a2a-client.spec.js +334 -0
  8. package/dist/__tests__/a2a/a2a-client.spec.js.map +1 -0
  9. package/dist/__tests__/a2a/a2a-job.spec.d.ts +2 -0
  10. package/dist/__tests__/a2a/a2a-job.spec.d.ts.map +1 -0
  11. package/dist/__tests__/a2a/a2a-job.spec.js +255 -0
  12. package/dist/__tests__/a2a/a2a-job.spec.js.map +1 -0
  13. package/dist/__tests__/a2a/a2a-stream.spec.d.ts +2 -0
  14. package/dist/__tests__/a2a/a2a-stream.spec.d.ts.map +1 -0
  15. package/dist/__tests__/a2a/a2a-stream.spec.js +278 -0
  16. package/dist/__tests__/a2a/a2a-stream.spec.js.map +1 -0
  17. package/dist/__tests__/a2a/agent-a2a-config.spec.d.ts +2 -0
  18. package/dist/__tests__/a2a/agent-a2a-config.spec.d.ts.map +1 -0
  19. package/dist/__tests__/a2a/agent-a2a-config.spec.js +262 -0
  20. package/dist/__tests__/a2a/agent-a2a-config.spec.js.map +1 -0
  21. package/dist/__tests__/a2a/producer/auth-filter.spec.d.ts +2 -0
  22. package/dist/__tests__/a2a/producer/auth-filter.spec.d.ts.map +1 -0
  23. package/dist/__tests__/a2a/producer/auth-filter.spec.js +127 -0
  24. package/dist/__tests__/a2a/producer/auth-filter.spec.js.map +1 -0
  25. package/dist/__tests__/a2a/producer/card-builder.spec.d.ts +2 -0
  26. package/dist/__tests__/a2a/producer/card-builder.spec.d.ts.map +1 -0
  27. package/dist/__tests__/a2a/producer/card-builder.spec.js +113 -0
  28. package/dist/__tests__/a2a/producer/card-builder.spec.js.map +1 -0
  29. package/dist/__tests__/a2a/producer/dispatcher.spec.d.ts +2 -0
  30. package/dist/__tests__/a2a/producer/dispatcher.spec.d.ts.map +1 -0
  31. package/dist/__tests__/a2a/producer/dispatcher.spec.js +850 -0
  32. package/dist/__tests__/a2a/producer/dispatcher.spec.js.map +1 -0
  33. package/dist/__tests__/a2a/producer/mount-surface-push.spec.d.ts +2 -0
  34. package/dist/__tests__/a2a/producer/mount-surface-push.spec.d.ts.map +1 -0
  35. package/dist/__tests__/a2a/producer/mount-surface-push.spec.js +164 -0
  36. package/dist/__tests__/a2a/producer/mount-surface-push.spec.js.map +1 -0
  37. package/dist/__tests__/a2a/producer/mount.spec.d.ts +2 -0
  38. package/dist/__tests__/a2a/producer/mount.spec.d.ts.map +1 -0
  39. package/dist/__tests__/a2a/producer/mount.spec.js +433 -0
  40. package/dist/__tests__/a2a/producer/mount.spec.js.map +1 -0
  41. package/dist/__tests__/a2a/producer/public-url-cache.spec.d.ts +2 -0
  42. package/dist/__tests__/a2a/producer/public-url-cache.spec.d.ts.map +1 -0
  43. package/dist/__tests__/a2a/producer/public-url-cache.spec.js +116 -0
  44. package/dist/__tests__/a2a/producer/public-url-cache.spec.js.map +1 -0
  45. package/dist/__tests__/a2a/producer/sse-emitter.spec.d.ts +2 -0
  46. package/dist/__tests__/a2a/producer/sse-emitter.spec.d.ts.map +1 -0
  47. package/dist/__tests__/a2a/producer/sse-emitter.spec.js +754 -0
  48. package/dist/__tests__/a2a/producer/sse-emitter.spec.js.map +1 -0
  49. package/dist/__tests__/a2a/producer/state-translator.spec.d.ts +2 -0
  50. package/dist/__tests__/a2a/producer/state-translator.spec.d.ts.map +1 -0
  51. package/dist/__tests__/a2a/producer/state-translator.spec.js +124 -0
  52. package/dist/__tests__/a2a/producer/state-translator.spec.js.map +1 -0
  53. package/dist/__tests__/a2a/producer/task-store.spec.d.ts +2 -0
  54. package/dist/__tests__/a2a/producer/task-store.spec.d.ts.map +1 -0
  55. package/dist/__tests__/a2a/producer/task-store.spec.js +180 -0
  56. package/dist/__tests__/a2a/producer/task-store.spec.js.map +1 -0
  57. package/dist/__tests__/agent-add-tool.spec.d.ts +2 -0
  58. package/dist/__tests__/agent-add-tool.spec.d.ts.map +1 -0
  59. package/dist/__tests__/agent-add-tool.spec.js +483 -0
  60. package/dist/__tests__/agent-add-tool.spec.js.map +1 -0
  61. package/dist/__tests__/api-runtime-race.spec.d.ts +2 -0
  62. package/dist/__tests__/api-runtime-race.spec.d.ts.map +1 -0
  63. package/dist/__tests__/api-runtime-race.spec.js +193 -0
  64. package/dist/__tests__/api-runtime-race.spec.js.map +1 -0
  65. package/dist/__tests__/claim-dispatcher.spec.d.ts +2 -0
  66. package/dist/__tests__/claim-dispatcher.spec.d.ts.map +1 -0
  67. package/dist/__tests__/claim-dispatcher.spec.js +408 -0
  68. package/dist/__tests__/claim-dispatcher.spec.js.map +1 -0
  69. package/dist/__tests__/inbound-job-dispatch.spec.d.ts +2 -0
  70. package/dist/__tests__/inbound-job-dispatch.spec.d.ts.map +1 -0
  71. package/dist/__tests__/inbound-job-dispatch.spec.js +185 -0
  72. package/dist/__tests__/inbound-job-dispatch.spec.js.map +1 -0
  73. package/dist/__tests__/job-controller-progress.spec.d.ts +2 -0
  74. package/dist/__tests__/job-controller-progress.spec.d.ts.map +1 -0
  75. package/dist/__tests__/job-controller-progress.spec.js +85 -0
  76. package/dist/__tests__/job-controller-progress.spec.js.map +1 -0
  77. package/dist/__tests__/jobs-cancel-route.spec.d.ts +2 -0
  78. package/dist/__tests__/jobs-cancel-route.spec.d.ts.map +1 -0
  79. package/dist/__tests__/jobs-cancel-route.spec.js +88 -0
  80. package/dist/__tests__/jobs-cancel-route.spec.js.map +1 -0
  81. package/dist/__tests__/llm-agent-stream.test.d.ts +14 -0
  82. package/dist/__tests__/llm-agent-stream.test.d.ts.map +1 -0
  83. package/dist/__tests__/llm-agent-stream.test.js +341 -0
  84. package/dist/__tests__/llm-agent-stream.test.js.map +1 -0
  85. package/dist/__tests__/llm-provider.test.js +22 -1
  86. package/dist/__tests__/llm-provider.test.js.map +1 -1
  87. package/dist/__tests__/media-resolver.test.js +40 -0
  88. package/dist/__tests__/media-resolver.test.js.map +1 -1
  89. package/dist/__tests__/mesh-job-submitter.spec.d.ts +2 -0
  90. package/dist/__tests__/mesh-job-submitter.spec.d.ts.map +1 -0
  91. package/dist/__tests__/mesh-job-submitter.spec.js +110 -0
  92. package/dist/__tests__/mesh-job-submitter.spec.js.map +1 -0
  93. package/dist/__tests__/proxy-stream.test.d.ts +9 -0
  94. package/dist/__tests__/proxy-stream.test.d.ts.map +1 -0
  95. package/dist/__tests__/proxy-stream.test.js +347 -0
  96. package/dist/__tests__/proxy-stream.test.js.map +1 -0
  97. package/dist/__tests__/resolver-meshjob.spec.d.ts +26 -0
  98. package/dist/__tests__/resolver-meshjob.spec.d.ts.map +1 -0
  99. package/dist/__tests__/resolver-meshjob.spec.js +201 -0
  100. package/dist/__tests__/resolver-meshjob.spec.js.map +1 -0
  101. package/dist/__tests__/schema-verdict-policy.test.d.ts +6 -0
  102. package/dist/__tests__/schema-verdict-policy.test.d.ts.map +1 -0
  103. package/dist/__tests__/schema-verdict-policy.test.js +126 -0
  104. package/dist/__tests__/schema-verdict-policy.test.js.map +1 -0
  105. package/dist/__tests__/sse-stream.test.d.ts +12 -0
  106. package/dist/__tests__/sse-stream.test.d.ts.map +1 -0
  107. package/dist/__tests__/sse-stream.test.js +170 -0
  108. package/dist/__tests__/sse-stream.test.js.map +1 -0
  109. package/dist/a2a/a2a-bearer.d.ts +27 -0
  110. package/dist/a2a/a2a-bearer.d.ts.map +1 -0
  111. package/dist/a2a/a2a-bearer.js +63 -0
  112. package/dist/a2a/a2a-bearer.js.map +1 -0
  113. package/dist/a2a/a2a-client.d.ts +114 -0
  114. package/dist/a2a/a2a-client.d.ts.map +1 -0
  115. package/dist/a2a/a2a-client.js +405 -0
  116. package/dist/a2a/a2a-client.js.map +1 -0
  117. package/dist/a2a/a2a-event.d.ts +25 -0
  118. package/dist/a2a/a2a-event.d.ts.map +1 -0
  119. package/dist/a2a/a2a-event.js +9 -0
  120. package/dist/a2a/a2a-event.js.map +1 -0
  121. package/dist/a2a/a2a-job.d.ts +58 -0
  122. package/dist/a2a/a2a-job.d.ts.map +1 -0
  123. package/dist/a2a/a2a-job.js +264 -0
  124. package/dist/a2a/a2a-job.js.map +1 -0
  125. package/dist/a2a/a2a-stream.d.ts +39 -0
  126. package/dist/a2a/a2a-stream.d.ts.map +1 -0
  127. package/dist/a2a/a2a-stream.js +290 -0
  128. package/dist/a2a/a2a-stream.js.map +1 -0
  129. package/dist/a2a/errors.d.ts +29 -0
  130. package/dist/a2a/errors.d.ts.map +1 -0
  131. package/dist/a2a/errors.js +48 -0
  132. package/dist/a2a/errors.js.map +1 -0
  133. package/dist/a2a/index.d.ts +12 -0
  134. package/dist/a2a/index.d.ts.map +1 -0
  135. package/dist/a2a/index.js +11 -0
  136. package/dist/a2a/index.js.map +1 -0
  137. package/dist/a2a/producer/auth-filter.d.ts +34 -0
  138. package/dist/a2a/producer/auth-filter.d.ts.map +1 -0
  139. package/dist/a2a/producer/auth-filter.js +39 -0
  140. package/dist/a2a/producer/auth-filter.js.map +1 -0
  141. package/dist/a2a/producer/card-builder.d.ts +59 -0
  142. package/dist/a2a/producer/card-builder.d.ts.map +1 -0
  143. package/dist/a2a/producer/card-builder.js +59 -0
  144. package/dist/a2a/producer/card-builder.js.map +1 -0
  145. package/dist/a2a/producer/dispatcher.d.ts +276 -0
  146. package/dist/a2a/producer/dispatcher.d.ts.map +1 -0
  147. package/dist/a2a/producer/dispatcher.js +896 -0
  148. package/dist/a2a/producer/dispatcher.js.map +1 -0
  149. package/dist/a2a/producer/index.d.ts +26 -0
  150. package/dist/a2a/producer/index.d.ts.map +1 -0
  151. package/dist/a2a/producer/index.js +23 -0
  152. package/dist/a2a/producer/index.js.map +1 -0
  153. package/dist/a2a/producer/mount.d.ts +75 -0
  154. package/dist/a2a/producer/mount.d.ts.map +1 -0
  155. package/dist/a2a/producer/mount.js +422 -0
  156. package/dist/a2a/producer/mount.js.map +1 -0
  157. package/dist/a2a/producer/public-url-cache.d.ts +73 -0
  158. package/dist/a2a/producer/public-url-cache.d.ts.map +1 -0
  159. package/dist/a2a/producer/public-url-cache.js +0 -0
  160. package/dist/a2a/producer/public-url-cache.js.map +1 -0
  161. package/dist/a2a/producer/registry.d.ts +138 -0
  162. package/dist/a2a/producer/registry.d.ts.map +1 -0
  163. package/dist/a2a/producer/registry.js +117 -0
  164. package/dist/a2a/producer/registry.js.map +1 -0
  165. package/dist/a2a/producer/sse-emitter.d.ts +85 -0
  166. package/dist/a2a/producer/sse-emitter.d.ts.map +1 -0
  167. package/dist/a2a/producer/sse-emitter.js +405 -0
  168. package/dist/a2a/producer/sse-emitter.js.map +1 -0
  169. package/dist/a2a/producer/state-translator.d.ts +63 -0
  170. package/dist/a2a/producer/state-translator.d.ts.map +1 -0
  171. package/dist/a2a/producer/state-translator.js +108 -0
  172. package/dist/a2a/producer/state-translator.js.map +1 -0
  173. package/dist/a2a/producer/task-store.d.ts +128 -0
  174. package/dist/a2a/producer/task-store.d.ts.map +1 -0
  175. package/dist/a2a/producer/task-store.js +128 -0
  176. package/dist/a2a/producer/task-store.js.map +1 -0
  177. package/dist/agent.d.ts +99 -0
  178. package/dist/agent.d.ts.map +1 -1
  179. package/dist/agent.js +754 -19
  180. package/dist/agent.js.map +1 -1
  181. package/dist/api-runtime.d.ts +25 -0
  182. package/dist/api-runtime.d.ts.map +1 -1
  183. package/dist/api-runtime.js +75 -2
  184. package/dist/api-runtime.js.map +1 -1
  185. package/dist/claim-dispatcher.d.ts +126 -0
  186. package/dist/claim-dispatcher.d.ts.map +1 -0
  187. package/dist/claim-dispatcher.js +478 -0
  188. package/dist/claim-dispatcher.js.map +1 -0
  189. package/dist/express.d.ts.map +1 -1
  190. package/dist/express.js +33 -6
  191. package/dist/express.js.map +1 -1
  192. package/dist/inbound-job-dispatch.d.ts +105 -0
  193. package/dist/inbound-job-dispatch.d.ts.map +1 -0
  194. package/dist/inbound-job-dispatch.js +335 -0
  195. package/dist/inbound-job-dispatch.js.map +1 -0
  196. package/dist/index.d.ts +40 -4
  197. package/dist/index.d.ts.map +1 -1
  198. package/dist/index.js +40 -3
  199. package/dist/index.js.map +1 -1
  200. package/dist/job-context.d.ts +107 -0
  201. package/dist/job-context.d.ts.map +1 -0
  202. package/dist/job-context.js +95 -0
  203. package/dist/job-context.js.map +1 -0
  204. package/dist/jobs-cancel-route.d.ts +36 -0
  205. package/dist/jobs-cancel-route.d.ts.map +1 -0
  206. package/dist/jobs-cancel-route.js +60 -0
  207. package/dist/jobs-cancel-route.js.map +1 -0
  208. package/dist/jobs-helper-tools.d.ts +48 -0
  209. package/dist/jobs-helper-tools.d.ts.map +1 -0
  210. package/dist/jobs-helper-tools.js +133 -0
  211. package/dist/jobs-helper-tools.js.map +1 -0
  212. package/dist/llm-agent.d.ts +62 -53
  213. package/dist/llm-agent.d.ts.map +1 -1
  214. package/dist/llm-agent.js +211 -292
  215. package/dist/llm-agent.js.map +1 -1
  216. package/dist/llm-provider.d.ts +11 -4
  217. package/dist/llm-provider.d.ts.map +1 -1
  218. package/dist/llm-provider.js +57 -4
  219. package/dist/llm-provider.js.map +1 -1
  220. package/dist/llm.d.ts +4 -1
  221. package/dist/llm.d.ts.map +1 -1
  222. package/dist/llm.js +7 -17
  223. package/dist/llm.js.map +1 -1
  224. package/dist/media/resolver.d.ts.map +1 -1
  225. package/dist/media/resolver.js +3 -2
  226. package/dist/media/resolver.js.map +1 -1
  227. package/dist/mesh-job-submitter.d.ts +83 -0
  228. package/dist/mesh-job-submitter.d.ts.map +1 -0
  229. package/dist/mesh-job-submitter.js +143 -0
  230. package/dist/mesh-job-submitter.js.map +1 -0
  231. package/dist/provider-handlers/gemini-handler.js +5 -0
  232. package/dist/provider-handlers/gemini-handler.js.map +1 -1
  233. package/dist/proxy.d.ts +40 -0
  234. package/dist/proxy.d.ts.map +1 -1
  235. package/dist/proxy.js +375 -2
  236. package/dist/proxy.js.map +1 -1
  237. package/dist/resolver-meshjob.d.ts +170 -0
  238. package/dist/resolver-meshjob.d.ts.map +1 -0
  239. package/dist/resolver-meshjob.js +159 -0
  240. package/dist/resolver-meshjob.js.map +1 -0
  241. package/dist/route.d.ts +4 -0
  242. package/dist/route.d.ts.map +1 -1
  243. package/dist/route.js.map +1 -1
  244. package/dist/schema-normalize.d.ts +62 -0
  245. package/dist/schema-normalize.d.ts.map +1 -0
  246. package/dist/schema-normalize.js +128 -0
  247. package/dist/schema-normalize.js.map +1 -0
  248. package/dist/sse-stream.d.ts +44 -0
  249. package/dist/sse-stream.d.ts.map +1 -0
  250. package/dist/sse-stream.js +173 -0
  251. package/dist/sse-stream.js.map +1 -0
  252. package/dist/tool-worker-entry.d.ts +21 -0
  253. package/dist/tool-worker-entry.d.ts.map +1 -0
  254. package/dist/tool-worker-entry.js +162 -0
  255. package/dist/tool-worker-entry.js.map +1 -0
  256. package/dist/tool-worker-pool.d.ts +49 -0
  257. package/dist/tool-worker-pool.d.ts.map +1 -0
  258. package/dist/tool-worker-pool.js +272 -0
  259. package/dist/tool-worker-pool.js.map +1 -0
  260. package/dist/types.d.ts +351 -9
  261. package/dist/types.d.ts.map +1 -1
  262. package/package.json +5 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"a2a-stream.js","sourceRoot":"","sources":["../../src/a2a/a2a-stream.ts"],"names":[],"mappings":"AAqBA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,aAAa,GAChB,MAAoC,CAAC,YAAY;IAClD,MAAM,CAAC,GAAG,CAAC,qBAA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,CAAC;iBACzD,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;gBAC/B,MAAM,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;gBAC/B,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAAE,QAAQ,GAAG,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;QACD,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC;QACzB,MAAM,KAAK,GAAG,QAAQ,KAAK,IAAI,CAAC;QAChC,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,KAAK;YACL,QAAQ;YACR,OAAO;YACP,KAAK;YACL,GAAG,EAAE,QAAQ;SACd,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,oBAAoB,CAC3B,SAAkC;IAElC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;IAC9B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAClE,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC1D,MAAM,IAAI,GAAI,KAAiC,CAAC,IAAI,CAAC;IACrD,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACrD,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Error hierarchy for the A2A consumer surface (issue #917).
3
+ *
4
+ * Mirrors `_a2a_consumer.A2AJobFailed` / `A2AJobCanceled` (Python) and
5
+ * `A2AException` / `A2AJobFailedException` / `A2AJobCanceledException`
6
+ * (Java). Each subclass sets `name` explicitly so `instanceof` works
7
+ * across module boundaries (ES module dual-loading, multiple SDK
8
+ * copies under monorepo workspaces).
9
+ */
10
+ export declare class A2AError extends Error {
11
+ readonly cause?: unknown | undefined;
12
+ constructor(message: string, cause?: unknown | undefined);
13
+ }
14
+ export declare class A2ATimeoutError extends A2AError {
15
+ constructor(message: string, cause?: unknown);
16
+ }
17
+ export declare class A2AAuthError extends A2AError {
18
+ constructor(message: string, cause?: unknown);
19
+ }
20
+ export declare class A2AJobError extends A2AError {
21
+ constructor(message: string, cause?: unknown);
22
+ }
23
+ export declare class A2AJobFailedError extends A2AJobError {
24
+ constructor(message: string, cause?: unknown);
25
+ }
26
+ export declare class A2AJobCanceledError extends A2AJobError {
27
+ constructor(message: string, cause?: unknown);
28
+ }
29
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/a2a/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,qBAAa,QAAS,SAAQ,KAAK;aACY,KAAK,CAAC,EAAE,OAAO;gBAAhD,OAAO,EAAE,MAAM,EAAkB,KAAK,CAAC,EAAE,OAAO,YAAA;CAI7D;AAED,qBAAa,eAAgB,SAAQ,QAAQ;gBAC/B,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI7C;AAED,qBAAa,YAAa,SAAQ,QAAQ;gBAC5B,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI7C;AAED,qBAAa,WAAY,SAAQ,QAAQ;gBAC3B,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI7C;AAED,qBAAa,iBAAkB,SAAQ,WAAW;gBACpC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI7C;AAED,qBAAa,mBAAoB,SAAQ,WAAW;gBACtC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI7C"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Error hierarchy for the A2A consumer surface (issue #917).
3
+ *
4
+ * Mirrors `_a2a_consumer.A2AJobFailed` / `A2AJobCanceled` (Python) and
5
+ * `A2AException` / `A2AJobFailedException` / `A2AJobCanceledException`
6
+ * (Java). Each subclass sets `name` explicitly so `instanceof` works
7
+ * across module boundaries (ES module dual-loading, multiple SDK
8
+ * copies under monorepo workspaces).
9
+ */
10
+ export class A2AError extends Error {
11
+ cause;
12
+ constructor(message, cause) {
13
+ super(message);
14
+ this.cause = cause;
15
+ this.name = "A2AError";
16
+ }
17
+ }
18
+ export class A2ATimeoutError extends A2AError {
19
+ constructor(message, cause) {
20
+ super(message, cause);
21
+ this.name = "A2ATimeoutError";
22
+ }
23
+ }
24
+ export class A2AAuthError extends A2AError {
25
+ constructor(message, cause) {
26
+ super(message, cause);
27
+ this.name = "A2AAuthError";
28
+ }
29
+ }
30
+ export class A2AJobError extends A2AError {
31
+ constructor(message, cause) {
32
+ super(message, cause);
33
+ this.name = "A2AJobError";
34
+ }
35
+ }
36
+ export class A2AJobFailedError extends A2AJobError {
37
+ constructor(message, cause) {
38
+ super(message, cause);
39
+ this.name = "A2AJobFailedError";
40
+ }
41
+ }
42
+ export class A2AJobCanceledError extends A2AJobError {
43
+ constructor(message, cause) {
44
+ super(message, cause);
45
+ this.name = "A2AJobCanceledError";
46
+ }
47
+ }
48
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/a2a/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACY;IAA7C,YAAY,OAAe,EAAkB,KAAe;QAC1D,KAAK,CAAC,OAAO,CAAC,CAAC;QAD4B,UAAK,GAAL,KAAK,CAAU;QAE1D,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,QAAQ;IAC3C,YAAY,OAAe,EAAE,KAAe;QAC1C,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,QAAQ;IACxC,YAAY,OAAe,EAAE,KAAe;QAC1C,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,OAAO,WAAY,SAAQ,QAAQ;IACvC,YAAY,OAAe,EAAE,KAAe;QAC1C,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IAChD,YAAY,OAAe,EAAE,KAAe;QAC1C,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,WAAW;IAClD,YAAY,OAAe,EAAE,KAAe;QAC1C,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * A2A consumer surface barrel — re-exports the public types and
3
+ * runtime classes the SDK consumer reaches for via
4
+ * `import { A2AClient, A2ABearer } from "@mcpmesh/sdk"` (issue #917).
5
+ */
6
+ export { A2AClient, type A2AClientConfig, type A2AMessage, type A2AResponse, type A2ATaskEnvelope, DEFAULT_TIMEOUT_MS, DEFAULT_POLL_INTERVAL_MS, DEFAULT_POLL_INTERVAL_MAX_MS, POLL_BACKOFF_FACTOR, isTerminalState, isCanceledState, } from "./a2a-client.js";
7
+ export { A2AJob } from "./a2a-job.js";
8
+ export { A2AStream } from "./a2a-stream.js";
9
+ export type { A2AEvent, A2AEventKind } from "./a2a-event.js";
10
+ export { A2ABearer, type A2ABearerConfig } from "./a2a-bearer.js";
11
+ export { A2AError, A2ATimeoutError, A2AAuthError, A2AJobError, A2AJobFailedError, A2AJobCanceledError, } from "./errors.js";
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/a2a/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,SAAS,EACT,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,4BAA4B,EAC5B,mBAAmB,EACnB,eAAe,EACf,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EACL,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * A2A consumer surface barrel — re-exports the public types and
3
+ * runtime classes the SDK consumer reaches for via
4
+ * `import { A2AClient, A2ABearer } from "@mcpmesh/sdk"` (issue #917).
5
+ */
6
+ export { A2AClient, DEFAULT_TIMEOUT_MS, DEFAULT_POLL_INTERVAL_MS, DEFAULT_POLL_INTERVAL_MAX_MS, POLL_BACKOFF_FACTOR, isTerminalState, isCanceledState, } from "./a2a-client.js";
7
+ export { A2AJob } from "./a2a-job.js";
8
+ export { A2AStream } from "./a2a-stream.js";
9
+ export { A2ABearer } from "./a2a-bearer.js";
10
+ export { A2AError, A2ATimeoutError, A2AAuthError, A2AJobError, A2AJobFailedError, A2AJobCanceledError, } from "./errors.js";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/a2a/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,SAAS,EAKT,kBAAkB,EAClB,wBAAwB,EACxB,4BAA4B,EAC5B,mBAAmB,EACnB,eAAe,EACf,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAwB,MAAM,iBAAiB,CAAC;AAClE,OAAO,EACL,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Bearer-token authentication gate for `mesh.a2a.mount(...)` surfaces (spec §6).
3
+ *
4
+ * Mounted as Express middleware on the `POST {path}` route only — the agent
5
+ * card endpoint (`GET {path}/.well-known/agent.json`) is always reachable
6
+ * without auth (spec §6.2 + conformance checklist) so clients can discover
7
+ * the authentication scheme before authenticating.
8
+ *
9
+ * Phase 1 semantics:
10
+ * 1. The producer MUST require an `Authorization: Bearer <token>` header.
11
+ * 2. The producer MUST reject headers that:
12
+ * - are missing entirely;
13
+ * - have a non-`Bearer` scheme (case-insensitive prefix check);
14
+ * - have an empty token after the `Bearer ` prefix (whitespace-only counts as empty).
15
+ * 3. The producer MUST NOT validate the token value. Value-level validation
16
+ * is Phase 2+ (spec §6.2 + Appendix B item 4).
17
+ *
18
+ * Error shape (spec §6.3): HTTP 401 with a JSON-RPC envelope carrying
19
+ * `error.code = -32001` and `id = null` (the request body is never parsed
20
+ * at this stage). The `-32001` code sits in the implementation-defined
21
+ * `-32000` … `-32099` server-error range and matches the Python / Java
22
+ * producers exactly for cross-runtime parity.
23
+ */
24
+ import type { RequestHandler } from "express";
25
+ /** Implementation-defined server-error code for authentication failures. */
26
+ export declare const JSONRPC_AUTH_ERROR = -32001;
27
+ /**
28
+ * Build the Express middleware that enforces the bearer-token presence
29
+ * check. The middleware is only mounted when the surface declared
30
+ * `auth: "bearer"` — mounts without `auth` get no middleware so the dispatch
31
+ * route is reachable without authentication.
32
+ */
33
+ export declare function buildBearerAuthMiddleware(): RequestHandler;
34
+ //# sourceMappingURL=auth-filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-filter.d.ts","sourceRoot":"","sources":["../../../src/a2a/producer/auth-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAyB,cAAc,EAAY,MAAM,SAAS,CAAC;AAE/E,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,SAAS,CAAC;AAIzC;;;;;GAKG;AACH,wBAAgB,yBAAyB,IAAI,cAAc,CAoC1D"}
@@ -0,0 +1,39 @@
1
+ /** Implementation-defined server-error code for authentication failures. */
2
+ export const JSONRPC_AUTH_ERROR = -32001;
3
+ const BEARER_PREFIX = "Bearer ";
4
+ /**
5
+ * Build the Express middleware that enforces the bearer-token presence
6
+ * check. The middleware is only mounted when the surface declared
7
+ * `auth: "bearer"` — mounts without `auth` get no middleware so the dispatch
8
+ * route is reachable without authentication.
9
+ */
10
+ export function buildBearerAuthMiddleware() {
11
+ return function bearerAuthMiddleware(req, res, next) {
12
+ const authz = req.headers["authorization"];
13
+ if (typeof authz !== "string" || authz.length === 0) {
14
+ writeAuthError(res, "Authentication required: missing Authorization: Bearer <token> header");
15
+ return;
16
+ }
17
+ // Case-insensitive prefix check on "Bearer ".
18
+ if (authz.length < BEARER_PREFIX.length ||
19
+ authz.substring(0, BEARER_PREFIX.length).toLowerCase() !== BEARER_PREFIX.toLowerCase()) {
20
+ writeAuthError(res, "Authentication required: missing Authorization: Bearer <token> header");
21
+ return;
22
+ }
23
+ const token = authz.substring(BEARER_PREFIX.length).trim();
24
+ if (token.length === 0) {
25
+ writeAuthError(res, "Authentication required: empty bearer token in Authorization header");
26
+ return;
27
+ }
28
+ // Phase 1: presence check only — DO NOT validate token value.
29
+ next();
30
+ };
31
+ }
32
+ function writeAuthError(res, message) {
33
+ res.status(401).type("application/json").send(JSON.stringify({
34
+ jsonrpc: "2.0",
35
+ error: { code: JSONRPC_AUTH_ERROR, message },
36
+ id: null,
37
+ }));
38
+ }
39
+ //# sourceMappingURL=auth-filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-filter.js","sourceRoot":"","sources":["../../../src/a2a/producer/auth-filter.ts"],"names":[],"mappings":"AAyBA,4EAA4E;AAC5E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAK,CAAC;AAEzC,MAAM,aAAa,GAAG,SAAS,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB;IACvC,OAAO,SAAS,oBAAoB,CAClC,GAAY,EACZ,GAAa,EACb,IAAkB;QAElB,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QAC3C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpD,cAAc,CACZ,GAAG,EACH,uEAAuE,CACxE,CAAC;YACF,OAAO;QACT,CAAC;QACD,8CAA8C;QAC9C,IACE,KAAK,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM;YACnC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC,WAAW,EAAE,EACtF,CAAC;YACD,cAAc,CACZ,GAAG,EACH,uEAAuE,CACxE,CAAC;YACF,OAAO;QACT,CAAC;QACD,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QAC3D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,cAAc,CACZ,GAAG,EACH,qEAAqE,CACtE,CAAC;YACF,OAAO;QACT,CAAC;QACD,8DAA8D;QAC9D,IAAI,EAAE,CAAC;IACT,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,GAAa,EAAE,OAAe;IACpD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAC3C,IAAI,CAAC,SAAS,CAAC;QACb,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE;QAC5C,EAAE,EAAE,IAAI;KACT,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Builds A2A v1.0 AgentCard JSON for `GET {path}/.well-known/agent.json`
3
+ * (spec §3).
4
+ *
5
+ * One card per surface — multi-skill grouping under a single card is v2
6
+ * scope (spec Appendix B item 1). Mirrors the Python builder
7
+ * `_mcp_mesh.engine.a2a_card.build_agent_card` and Java's
8
+ * `MeshA2ACardBuilder.build`.
9
+ *
10
+ * Auto-populates from the surface's mount config (skill id, name,
11
+ * description, tags) and the resolved `auth` scheme. Cross-agent dependency
12
+ * input schemas are not surfaced today (mirrors Python — Chunk 1B may add
13
+ * `skills[0].metadata.input_schema` when a local `agent.addTool`
14
+ * registration is co-resident).
15
+ */
16
+ import type { A2ASurfaceMetadata } from "./registry.js";
17
+ /**
18
+ * A2A v1.0 default input modes. Materialised at card-render time (not at
19
+ * heartbeat-emit time per spec §2.1).
20
+ */
21
+ export declare const DEFAULT_INPUT_MODES: readonly string[];
22
+ /**
23
+ * A2A v1.0 default output modes. Materialised at card-render time.
24
+ */
25
+ export declare const DEFAULT_OUTPUT_MODES: readonly string[];
26
+ /**
27
+ * Per-render context the SDK supplies to {@link buildAgentCard}. The agent
28
+ * name / version typically come from the API runtime's resolved config; the
29
+ * `publicUrl` is the registry-stamped FQDN cached per `(path, skillId)`,
30
+ * with a local-fallback (`http://{host}:{port}{path}`) when no stamped URL
31
+ * is available yet (spec §2.4).
32
+ */
33
+ export interface CardRenderContext {
34
+ /** Agent display name (mirrors `mesh.agent(name=...)` value). */
35
+ readonly agentName: string;
36
+ /** Agent version (semver). Defaults to `"1.0.0"` on the card. */
37
+ readonly agentVersion?: string;
38
+ /** Free-form agent description; falls back to `agentName` on the card. */
39
+ readonly agentDescription?: string;
40
+ /**
41
+ * The producer's public `POST {path}` URL. MUST be omitted (NOT emitted
42
+ * as `""`) when no URL is available — clients should fail loudly rather
43
+ * than chase a blank URL. Resolution order at mount time:
44
+ * 1. Registry-stamped FQDN from {@link A2APublicUrlCache} (populated
45
+ * from `surface_updated` heartbeat responses).
46
+ * 2. Local-fallback `http://{host}:{port}{path}` per spec §2.4.
47
+ * 3. Omitted (`undefined`) when neither host nor cached URL is known.
48
+ */
49
+ readonly publicUrl?: string;
50
+ }
51
+ /**
52
+ * Build the agent card JSON for a single surface.
53
+ *
54
+ * The returned plain object is JSON-serializable with deterministic key
55
+ * order (modern JS Maps + plain object literals preserve insertion order
56
+ * per ECMA-262).
57
+ */
58
+ export declare function buildAgentCard(surface: A2ASurfaceMetadata, ctx: CardRenderContext): Record<string, unknown>;
59
+ //# sourceMappingURL=card-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card-builder.d.ts","sourceRoot":"","sources":["../../../src/a2a/producer/card-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAAyB,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAAyB,CAAC;AAE5E;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,iEAAiE;IACjE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,iEAAiE;IACjE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,0EAA0E;IAC1E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC;;;;;;;;OAQG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,kBAAkB,EAC3B,GAAG,EAAE,iBAAiB,GACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmDzB"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * A2A v1.0 default input modes. Materialised at card-render time (not at
3
+ * heartbeat-emit time per spec §2.1).
4
+ */
5
+ export const DEFAULT_INPUT_MODES = ["application/json"];
6
+ /**
7
+ * A2A v1.0 default output modes. Materialised at card-render time.
8
+ */
9
+ export const DEFAULT_OUTPUT_MODES = ["application/json"];
10
+ /**
11
+ * Build the agent card JSON for a single surface.
12
+ *
13
+ * The returned plain object is JSON-serializable with deterministic key
14
+ * order (modern JS Maps + plain object literals preserve insertion order
15
+ * per ECMA-262).
16
+ */
17
+ export function buildAgentCard(surface, ctx) {
18
+ const name = ctx.agentName && ctx.agentName.length > 0 ? ctx.agentName : "agent";
19
+ const version = ctx.agentVersion && ctx.agentVersion.length > 0 ? ctx.agentVersion : "1.0.0";
20
+ const description = ctx.agentDescription && ctx.agentDescription.length > 0
21
+ ? ctx.agentDescription
22
+ : name;
23
+ const skill = {
24
+ id: surface.skillId,
25
+ name: surface.skillName,
26
+ description: surface.description.length > 0 ? surface.description : surface.skillName,
27
+ tags: [...surface.tags],
28
+ inputModes: [...DEFAULT_INPUT_MODES],
29
+ outputModes: [...DEFAULT_OUTPUT_MODES],
30
+ };
31
+ // Spec §3.2: capabilities.streaming MUST be true. Even in Chunk 1A (sync
32
+ // only) we advertise streaming=true so the wire shape matches Python /
33
+ // Java — Chunk 1B wires the real SSE handlers behind it.
34
+ const capabilities = {
35
+ streaming: true,
36
+ pushNotifications: false,
37
+ stateTransitionHistory: false,
38
+ };
39
+ const card = {
40
+ name,
41
+ description,
42
+ version,
43
+ capabilities,
44
+ defaultInputModes: [...DEFAULT_INPUT_MODES],
45
+ defaultOutputModes: [...DEFAULT_OUTPUT_MODES],
46
+ skills: [skill],
47
+ };
48
+ if (ctx.publicUrl && ctx.publicUrl.length > 0) {
49
+ card.url = ctx.publicUrl;
50
+ }
51
+ // Spec §3.2 / §6.1: authentication.schemes is a list. For bearer-token
52
+ // surfaces emit ["bearer"]; otherwise an empty list (NOT "none" — A2A
53
+ // v1.0 has no "none" scheme).
54
+ card.authentication = {
55
+ schemes: surface.auth === "bearer" ? ["bearer"] : [],
56
+ };
57
+ return card;
58
+ }
59
+ //# sourceMappingURL=card-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card-builder.js","sourceRoot":"","sources":["../../../src/a2a/producer/card-builder.ts"],"names":[],"mappings":"AAiBA;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAsB,CAAC,kBAAkB,CAAC,CAAC;AAE3E;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAsB,CAAC,kBAAkB,CAAC,CAAC;AA4B5E;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,OAA2B,EAC3B,GAAsB;IAEtB,MAAM,IAAI,GACR,GAAG,CAAC,SAAS,IAAI,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;IACtE,MAAM,OAAO,GACX,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC;IAC/E,MAAM,WAAW,GACf,GAAG,CAAC,gBAA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AAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,276 @@
1
+ /**
2
+ * JSON-RPC 2.0 dispatcher for `mesh.a2a.mount(...)` producer surfaces
3
+ * (spec §4).
4
+ *
5
+ * Chunk 1B coverage:
6
+ * - `tasks/send` — sync handler return → `state=completed`; `JobProxy`
7
+ * return → `state=working` envelope with the task parked in
8
+ * {@link A2ATaskStore} (spec §4.3 long-running branch); handler
9
+ * exception → `state=failed` (spec §4.3).
10
+ * - `tasks/get` — looks up the cached terminal envelope OR pulls live
11
+ * status from the parked `JobProxy` and translates the mesh state to
12
+ * A2A via {@link state-translator} (spec §4.4 / §7.2).
13
+ * - `tasks/cancel` — calls `proxy.cancel()` on the parked task, then
14
+ * re-reads status; idempotent ack for already-terminal tasks (spec
15
+ * §4.5). Cancel double-failure synthesizes `state=canceled` rather
16
+ * than propagating exceptions.
17
+ * - `tasks/sendSubscribe` / `tasks/resubscribe` — exposed indirectly
18
+ * through {@link buildSendSubscribeStream} / {@link buildResubscribeStream}
19
+ * which return a framework-agnostic {@link SseStreamPlan}. The Express
20
+ * SSE adapter ({@link sse-emitter}) materialises each plan as a
21
+ * `text/event-stream` response. The dispatcher itself never touches
22
+ * Express response streaming so it stays unit-testable without an
23
+ * HTTP server (spec §4.6 / §4.7 / §5).
24
+ *
25
+ * Error handling per spec §4.1:
26
+ * - Empty / non-JSON body → HTTP 400 + `-32700 Parse error`
27
+ * - Missing `method` field → `-32600 Invalid Request` (NOT `-32601`; the
28
+ * misleading `"Method not implemented: 'null'"` bug from issue #934
29
+ * must not recur)
30
+ * - Unknown method → `-32601 Method not implemented: '<method>'`
31
+ *
32
+ * Handler exceptions are surfaced per spec §4.3: they become `state=failed`
33
+ * Task envelopes, NOT JSON-RPC errors. JSON-RPC errors are reserved for
34
+ * protocol-level issues.
35
+ */
36
+ import type { RequestHandler } from "express";
37
+ import { JobProxy } from "@mcpmesh/core";
38
+ import type { McpMeshTool } from "../../types.js";
39
+ import { RouteRegistry } from "../../route.js";
40
+ import { MeshJobSubmitter } from "../../mesh-job-submitter.js";
41
+ import type { A2ASurfaceMetadata } from "./registry.js";
42
+ import { A2ATaskStore, type TaskRecord } from "./task-store.js";
43
+ /** JSON-RPC: Parse error (request body is not valid JSON). Spec §4.1. */
44
+ export declare const JSONRPC_PARSE_ERROR = -32700;
45
+ /** JSON-RPC: Invalid Request (well-formed JSON but missing `method` field). Spec §4.1. */
46
+ export declare const JSONRPC_INVALID_REQUEST = -32600;
47
+ /** JSON-RPC: Method not found (unknown `tasks/*` verb). Spec §4.1. */
48
+ export declare const JSONRPC_METHOD_NOT_FOUND = -32601;
49
+ /** JSON-RPC: Invalid params (missing or unknown task id). Spec §4.4. */
50
+ export declare const JSONRPC_INVALID_PARAMS = -32602;
51
+ /**
52
+ * Dependencies object passed to A2A handlers — keyed by capability name,
53
+ * same shape as `mesh.route()`'s `deps` parameter. Values are `null` when
54
+ * the underlying dependency hasn't been resolved yet (registry has not
55
+ * reported a `dependency_available` event for it).
56
+ */
57
+ export type A2ADependencies = Record<string, McpMeshTool | null>;
58
+ /**
59
+ * Handler signature for `mesh.a2a.mount(...)`. Receives:
60
+ *
61
+ * 1. Resolved dependencies (`deps`) — keyed by capability name, same shape
62
+ * as `mesh.route()`'s `deps` parameter. Destructure to access individual
63
+ * `McpMeshTool` proxies.
64
+ * 2. The raw A2A `tasks/send` `payload` (the `message` object the client
65
+ * sent).
66
+ * 3. A framework-managed {@link MeshJobSubmitter} (`jobSubmitter`) — issue
67
+ * #936. Bound to the producer's task capability so long-running handlers
68
+ * can `await jobSubmitter.submit(payload)` without hand-constructing the
69
+ * submitter from `getApiRuntime().getServiceId()` and the registry URL.
70
+ * The capability defaults to the first declared `dependencies[]` entry
71
+ * on the mount config; when no deps are declared, falls back to the
72
+ * `skillId` with `-` replaced by `_` (the canonical kebab-to-snake
73
+ * convention — so a `"generate-report"` skill submits to the
74
+ * `generate_report` task capability without further configuration).
75
+ *
76
+ * Return value: any JSON-serializable value or a `JobProxy`.
77
+ * - JSON-serializable value → framework wraps it into the A2A v1.0 `Task`
78
+ * envelope per spec §4.3 — `String` returns pass through verbatim;
79
+ * everything else is JSON-stringified.
80
+ * - `JobProxy` → framework parks the task (`state=working`) and pulls
81
+ * live status on subsequent `tasks/get` / `tasks/cancel` /
82
+ * `tasks/sendSubscribe` / `tasks/resubscribe` calls (spec §4.3
83
+ * long-running branch).
84
+ *
85
+ * Throw an exception to surface as `state=failed` (spec §4.3 "handler
86
+ * raised" branch).
87
+ */
88
+ export type A2AHandler<D extends A2ADependencies = A2ADependencies> = (deps: D, payload: Record<string, unknown>, jobSubmitter: MeshJobSubmitter | null) => unknown | Promise<unknown>;
89
+ /**
90
+ * Construction inputs for {@link A2ADispatcher}. The dispatcher itself is
91
+ * surface-agnostic — the {@link buildDispatcherMiddleware} factory binds it
92
+ * to a specific surface so the per-route Express middleware can dispatch
93
+ * without consulting a path-keyed registry on every request.
94
+ */
95
+ export interface DispatcherDeps {
96
+ /** The registered surface this dispatcher is bound to. */
97
+ readonly surface: A2ASurfaceMetadata;
98
+ /** The user-supplied handler. */
99
+ readonly handler: A2AHandler;
100
+ /** Shared task store. */
101
+ readonly taskStore: A2ATaskStore;
102
+ /** Shared `RouteRegistry` for dependency resolution (DDDI). */
103
+ readonly routeRegistry: RouteRegistry;
104
+ /**
105
+ * Lazy provider for the {@link MeshJobSubmitter} auto-injected on the
106
+ * third handler arg (issue #936). Called on every dispatch so the
107
+ * provider can return `null` until the api-runtime has finished
108
+ * initialising; the dispatcher caches the resolved value internally
109
+ * after the first non-null return.
110
+ *
111
+ * Optional for back-compat with existing callers; when omitted the
112
+ * handler receives `null` on the third arg.
113
+ */
114
+ readonly jobSubmitterProvider?: () => MeshJobSubmitter | null;
115
+ }
116
+ /**
117
+ * Build an Express request handler that dispatches `POST {path}` requests
118
+ * for a single surface.
119
+ *
120
+ * Routes JSON-RPC envelopes that return a single response body
121
+ * (`tasks/send`, `tasks/get`, `tasks/cancel`). SSE verbs
122
+ * (`tasks/sendSubscribe`, `tasks/resubscribe`) are dispatched by a
123
+ * sibling middleware ({@link buildSseDispatcherMiddleware}) that the
124
+ * mount wires in front of this one — when the SSE middleware sees an
125
+ * SSE-eligible method it consumes the request; otherwise it calls
126
+ * `next()` and execution falls through here.
127
+ */
128
+ export declare function buildDispatcherMiddleware(deps: DispatcherDeps): RequestHandler;
129
+ /**
130
+ * Build the SSE stream plan for a `tasks/sendSubscribe` request. The
131
+ * dispatcher invokes the user handler eagerly (before the stream opens)
132
+ * so handler exceptions become a single SSE failed frame, not an opaque
133
+ * HTTP error mid-stream (spec §4.6).
134
+ */
135
+ export declare function buildSendSubscribeStream(reqId: unknown, params: Record<string, unknown>, deps: DispatcherDeps): Promise<SseStreamPlan>;
136
+ /**
137
+ * Build the SSE stream plan for a `tasks/resubscribe` request (spec §4.7).
138
+ * Looks up the parked task, emits an initial state=working event, then
139
+ * resumes polling from the registry's current view (no replay).
140
+ */
141
+ export declare function buildResubscribeStream(reqId: unknown, params: Record<string, unknown>, taskStore: A2ATaskStore): SseStreamPlan;
142
+ /**
143
+ * Pull the latest status from a parked task's `JobProxy` and project it
144
+ * into an A2A v1.0 Task envelope. Handles the "transient unreachability"
145
+ * branch per spec §4.4 by returning `state=working` with the error text
146
+ * in `status.message` rather than throwing — matches Python's
147
+ * `a2a.py:718-735` behavior.
148
+ *
149
+ * Used by `tasks/get` (top-level dispatcher) and exposed via
150
+ * {@link projectLiveStatus} for the SSE emitter's terminal-frame
151
+ * synthesis.
152
+ */
153
+ export declare function buildTaskFromLiveStatus(taskStore: A2ATaskStore, taskId: string, record: TaskRecord): Promise<Record<string, unknown>>;
154
+ /**
155
+ * Project the live status of a parked task into an A2A v1.0 Task
156
+ * envelope. Exposed for the SSE emitter so it can render terminal
157
+ * frames consistently with `tasks/get`.
158
+ */
159
+ export declare function projectLiveStatus(taskStore: A2ATaskStore, taskId: string): Promise<Record<string, unknown> | null>;
160
+ /**
161
+ * Build a `state=completed` Task envelope (spec §4.3). The handler result
162
+ * is stringified per the spec — string returns pass through verbatim,
163
+ * everything else is JSON-stringified. `null` / `undefined` produce an
164
+ * empty-string artifact.
165
+ *
166
+ * Exported for testability + the symmetry with the SSE artifact frame
167
+ * builder.
168
+ */
169
+ export declare function buildCompletedTask(taskId: string, sessionId: string, requestMessage: Record<string, unknown>, result: unknown): Record<string, unknown>;
170
+ /**
171
+ * Build a `state=failed` Task envelope (spec §4.3 "handler raised"
172
+ * branch). The error text is folded into `status.message.parts[0].text`.
173
+ */
174
+ export declare function buildFailedTask(taskId: string, sessionId: string, requestMessage: Record<string, unknown>, errorText: string): Record<string, unknown>;
175
+ /**
176
+ * Build a `state=working` Task envelope (spec §4.3 long-running branch /
177
+ * spec §4.4 transient unreachability fallback).
178
+ */
179
+ export declare function buildWorkingTask(taskId: string, sessionId: string, requestMessage?: Record<string, unknown>, progressMessage?: string | null, progress?: number | null): Record<string, unknown>;
180
+ /**
181
+ * Build a `state=canceled` Task envelope (spec §4.5 cancel fallback / spec
182
+ * §7.2). Used when:
183
+ * - `tasks/cancel` post-cancel status read didn't show terminal yet, OR
184
+ * - both `proxy.cancel()` AND `proxy.status()` threw, OR
185
+ * - the parked task lost its `JobProxy` reference.
186
+ */
187
+ export declare function buildCanceledTask(taskId: string, sessionId: string, requestMessage: Record<string, unknown> | undefined, reason: string | undefined): Record<string, unknown>;
188
+ /**
189
+ * Build a Task envelope from a `JobProxy.status()` result dict (spec
190
+ * §4.4). Mirrors Python's `_build_task_from_status` and Java's
191
+ * `MeshA2ADispatcher.buildTaskFromStatus` — folds `error` /
192
+ * `progress_message` into A2A `status.message`, materialises an artifact
193
+ * for completed tasks when the final result is available, and lifts
194
+ * `progress` to `metadata.progress`.
195
+ *
196
+ * Per Appendix A, `progress` is emitted as a real JSON number (no
197
+ * stringification) and `parts[0].type` is always `"text"`.
198
+ */
199
+ export declare function buildTaskFromStatus(taskId: string, sessionId: string, requestMessage: Record<string, unknown> | undefined, a2aState: string, meshStatus: Record<string, unknown>, finalResult: unknown, hasFinalResult: boolean): Record<string, unknown>;
200
+ /**
201
+ * Stringify a handler return value as the text body of the `result`
202
+ * artifact. `string` returns pass through verbatim; everything else is
203
+ * JSON-stringified. Non-serializable returns fall back to `String(value)`
204
+ * so the artifact is always well-formed (mirrors Python's `default=str`
205
+ * coercion in `a2a.py:403`).
206
+ */
207
+ export declare function stringifyResult(value: unknown): string;
208
+ /**
209
+ * Build a JSON-RPC envelope carrying an A2A v1.0 `TaskStatusUpdateEvent`
210
+ * (spec §5.2).
211
+ *
212
+ * Per Appendix A:
213
+ * - `final` MUST be a real JSON boolean (no stringification).
214
+ * - `progress` (when non-null) MUST be a JSON number.
215
+ * - `parts[0].type` MUST be emitted as `"text"`.
216
+ *
217
+ * @param reqId JSON-RPC request id to echo
218
+ * @param taskId A2A task id
219
+ * @param a2aState one of the four enumerated A2A states
220
+ * @param messageText optional text for `status.message.parts[0].text`
221
+ * @param finalFlag `true` only on the terminal frame
222
+ * @param progress optional numeric progress; emitted as `metadata.progress`
223
+ */
224
+ export declare function buildStatusUpdateFrame(reqId: unknown, taskId: string, a2aState: string, messageText: string | null | undefined, finalFlag: boolean, progress: number | null | undefined): Record<string, unknown>;
225
+ /**
226
+ * Build a JSON-RPC envelope carrying an A2A v1.0 `TaskArtifactUpdateEvent`
227
+ * (spec §5.2). The handler result is stringified per the
228
+ * {@link stringifyResult} contract.
229
+ */
230
+ export declare function buildArtifactUpdateFrame(reqId: unknown, taskId: string, value: unknown): Record<string, unknown>;
231
+ /**
232
+ * `instanceof`-based detection with duck-type fallback. JobProxy is a
233
+ * napi-rs class that survives across module loaders; using `instanceof`
234
+ * first matches Java's branching. The duck-type fallback covers any
235
+ * future case where a JobProxy-shaped object is returned (subclass /
236
+ * test double).
237
+ */
238
+ declare function isJobProxy(value: unknown): value is JobProxy;
239
+ /**
240
+ * Framework-agnostic description of an SSE stream for a single
241
+ * `tasks/sendSubscribe` / `tasks/resubscribe` call. The Express SSE
242
+ * adapter ({@link sse-emitter}) maps this into a `text/event-stream`
243
+ * response body.
244
+ *
245
+ * Four shapes:
246
+ * - `error` — preflight error before SSE is even started (parse error,
247
+ * unknown task id, missing path). Adapter emits a JSON-RPC error
248
+ * response, NOT an SSE stream.
249
+ * - `single-frame` — one terminal SSE frame then close (sync handler
250
+ * completed, handler raised, already-terminal resubscribe).
251
+ * - `sync-completed` — one artifact frame + one final status frame then
252
+ * close (sync handler called via `tasks/sendSubscribe`).
253
+ * - `long-running` — initial working frame, then poll loop with progress
254
+ * frames, keepalives, and a terminal frame.
255
+ */
256
+ export type SseStreamPlan = {
257
+ readonly kind: "error";
258
+ readonly errorBody: Record<string, unknown>;
259
+ readonly httpStatus: number;
260
+ } | {
261
+ readonly kind: "single-frame";
262
+ readonly frame: Record<string, unknown>;
263
+ } | {
264
+ readonly kind: "sync-completed";
265
+ readonly reqId: unknown;
266
+ readonly taskId: string;
267
+ readonly artifactFrame: Record<string, unknown>;
268
+ readonly terminalFrame: Record<string, unknown>;
269
+ } | {
270
+ readonly kind: "long-running";
271
+ readonly reqId: unknown;
272
+ readonly taskId: string;
273
+ readonly proxy: JobProxy;
274
+ };
275
+ export { isJobProxy as __isJobProxyForTests, };
276
+ //# sourceMappingURL=dispatcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../../../src/a2a/producer/dispatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,KAAK,EAAW,cAAc,EAAY,MAAM,SAAS,CAAC;AAGjE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,k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