@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,105 @@
1
+ /**
2
+ * Inbound `MeshJob` dispatch wrapper (Phase 1 — MeshJob substrate).
3
+ *
4
+ * Mirrors Python's `_mcp_mesh.engine.job_dispatch.maybe_dispatch_as_job`.
5
+ *
6
+ * When a tool registered with `task: true` receives an inbound
7
+ * `tools/call` carrying `X-Mesh-Job-Id`, this wrapper:
8
+ *
9
+ * 1. Reads `X-Mesh-Job-Id` and (optionally) `X-Mesh-Timeout` from the
10
+ * propagated headers (TS upstream proxies inject these into the
11
+ * tool's args under `_mesh_headers`; the inbound `tools/call`
12
+ * handler in agent.ts extracts them into a header dict before
13
+ * invoking this wrapper).
14
+ * 2. Builds a `JobController` from `@mcpmesh/core` bound to that job
15
+ * id and the running agent's instance id.
16
+ * 3. Sets BOTH the JS-side `CURRENT_JOB` AsyncLocalStorage AND the
17
+ * Rust-side `with_job` task-local via `withJobAsync` from
18
+ * `@mcpmesh/core`. Both are needed:
19
+ * * JS-side for in-process `currentJob()` reads;
20
+ * * Rust-side for the cancel-registry binding (so
21
+ * `POST /jobs/{id}/cancel` can fire the in-flight token) and
22
+ * for outbound HTTP header injection on Rust-originated work.
23
+ * 4. Injects the `JobController` into the user function's args at
24
+ * `meshJobParamIndex`.
25
+ * 5. Awaits the user function inside both contexts.
26
+ * 6. Auto-completes the controller with the user's return value if the
27
+ * user did not explicitly call `complete()`/`fail()`.
28
+ *
29
+ * Tools without `task: true` are bypassed entirely (zero overhead).
30
+ * `task: true` tools invoked WITHOUT `X-Mesh-Job-Id` (a regular
31
+ * synchronous `tools/call`) fall through to the user function with
32
+ * `null` in the MeshJob slot per `MESHJOB_DDDI_CONTRACT.md`.
33
+ *
34
+ * The dispatch logic is centralised here so the per-tool wrapper in
35
+ * `agent.ts` and the claim dispatcher both call into the same path.
36
+ */
37
+ import { JobController } from "@mcpmesh/core";
38
+ /**
39
+ * Read `X-Mesh-Job-Id` / `X-Mesh-Timeout` from a header dict (case
40
+ * normalised to lowercase). Returns `[null, null]` when absent or
41
+ * malformed.
42
+ */
43
+ export declare function readJobHeaders(headers: Record<string, string> | null | undefined): [string | null, number | null];
44
+ /**
45
+ * Run `invoke()` inside a job context (when `jobId` is set) or
46
+ * directly (otherwise).
47
+ *
48
+ * `invoke` must be a thunk — when the caller wants to inject the
49
+ * controller into the user function's args, it is the caller's
50
+ * responsibility to overlay the controller before passing the thunk.
51
+ *
52
+ * `controller` may be `null` when the call is NOT a job (no
53
+ * `X-Mesh-Job-Id`). In that case the wrapper just runs the thunk.
54
+ *
55
+ * @param jobId - Server-assigned job UUID (from `X-Mesh-Job-Id`), or
56
+ * `null` when the call is a regular `tools/call`.
57
+ * @param deadlineSecs - Per-attempt deadline in seconds (from
58
+ * `X-Mesh-Timeout`), or `null`.
59
+ * @param controller - Pre-constructed `JobController` bound to `jobId`,
60
+ * or `null` when not running as a job.
61
+ * @param invoke - Thunk that runs the user function and returns its
62
+ * result. The caller has already overlaid the controller into the
63
+ * user function's args at `meshJobParamIndex`.
64
+ * @param retryOn - Issue #894: per-tool retry-eligible exception
65
+ * whitelist. When the user thunk raises an Error matching one of the
66
+ * constructor classes, the wrapper calls `controller.releaseLease`
67
+ * instead of `controller.fail` so a peer replica can re-claim within
68
+ * ~5s. `undefined` / `[]` disables retry (existing fail-on-throw
69
+ * behaviour). Match check is `err instanceof cls`.
70
+ */
71
+ export declare function runWithJobContext<T>(jobId: string | null, deadlineSecs: number | null, controller: JobController | null, invoke: () => Promise<T>, retryOn?: ReadonlyArray<new (...args: unknown[]) => Error>): Promise<T>;
72
+ /**
73
+ * Construct a `JobController` for `(jobId, instanceId, registryUrl)`.
74
+ *
75
+ * Wraps the napi binding so callers don't import `@mcpmesh/core`
76
+ * directly — keeps the injection point in agent.ts compact.
77
+ */
78
+ export declare function makeJobController(jobId: string, instanceId: string, registryUrl: string): JobController;
79
+ /**
80
+ * Build the positional call args array for a `task: true` tool, splicing
81
+ * the `controller` into the user signature at `meshJobParamIndex`.
82
+ *
83
+ * Position 0 is always the parsed `args` payload; deps begin at 1. The
84
+ * MeshJob slot is orthogonal to MeshTool positional indexing — when
85
+ * `meshJobParamIndex` lands inside the dep range the deps shift past
86
+ * it; when it lands after all deps the helper pads any gap with `null`
87
+ * and places the controller at the trailing position.
88
+ *
89
+ * Centralised here so both the inbound HTTP wrapper (agent.ts) and the
90
+ * claim-path dispatcher (claim handler in agent.ts) share one
91
+ * implementation — historically these splice loops had drifted apart.
92
+ *
93
+ * @param payload - The parsed `args` payload (signature position 0).
94
+ * @param deps - Resolved dep proxies (or `MeshJobSubmitter` for the
95
+ * meshJobDepIndex slot, or `null` for unresolved deps) in declaration
96
+ * order. Positionally injected starting at sig pos 1.
97
+ * @param controller - The `JobController` to inject at
98
+ * `meshJobParamIndex`, or `null` when the call is not running under
99
+ * a job context.
100
+ * @param meshJobParamIndex - Signature position where the controller
101
+ * should land, or `undefined` when the user didn't declare a MeshJob
102
+ * slot (controller is then dropped — the user just doesn't get one).
103
+ */
104
+ export declare function spliceJobController<D>(payload: unknown, deps: ReadonlyArray<D>, controller: JobController | null, meshJobParamIndex: number | undefined): unknown[];
105
+ //# sourceMappingURL=inbound-job-dispatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound-job-dispatch.d.ts","sourceRoot":"","sources":["../src/inbound-job-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EAAE,aAAa,EAAgB,MAAM,eAAe,CAAC;AAM5D;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,GACjD,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,CAahC;AAwCD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EACvC,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,YAAY,EAAE,MAAM,GAAG,IAAI,EAC3B,UAAU,EAAE,aAAa,GAAG,IAAI,EAChC,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACxB,OAAO,CAAC,EAAE,aAAa,CAAC,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,KAAK,CAAC,GACzD,OAAO,CAAC,CAAC,CAAC,CAkKZ;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,aAAa,CAEf;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EACtB,UAAU,EAAE,aAAa,GAAG,IAAI,EAChC,iBAAiB,EAAE,MAAM,GAAG,SAAS,GACpC,OAAO,EAAE,CAyBX"}
@@ -0,0 +1,335 @@
1
+ /**
2
+ * Inbound `MeshJob` dispatch wrapper (Phase 1 — MeshJob substrate).
3
+ *
4
+ * Mirrors Python's `_mcp_mesh.engine.job_dispatch.maybe_dispatch_as_job`.
5
+ *
6
+ * When a tool registered with `task: true` receives an inbound
7
+ * `tools/call` carrying `X-Mesh-Job-Id`, this wrapper:
8
+ *
9
+ * 1. Reads `X-Mesh-Job-Id` and (optionally) `X-Mesh-Timeout` from the
10
+ * propagated headers (TS upstream proxies inject these into the
11
+ * tool's args under `_mesh_headers`; the inbound `tools/call`
12
+ * handler in agent.ts extracts them into a header dict before
13
+ * invoking this wrapper).
14
+ * 2. Builds a `JobController` from `@mcpmesh/core` bound to that job
15
+ * id and the running agent's instance id.
16
+ * 3. Sets BOTH the JS-side `CURRENT_JOB` AsyncLocalStorage AND the
17
+ * Rust-side `with_job` task-local via `withJobAsync` from
18
+ * `@mcpmesh/core`. Both are needed:
19
+ * * JS-side for in-process `currentJob()` reads;
20
+ * * Rust-side for the cancel-registry binding (so
21
+ * `POST /jobs/{id}/cancel` can fire the in-flight token) and
22
+ * for outbound HTTP header injection on Rust-originated work.
23
+ * 4. Injects the `JobController` into the user function's args at
24
+ * `meshJobParamIndex`.
25
+ * 5. Awaits the user function inside both contexts.
26
+ * 6. Auto-completes the controller with the user's return value if the
27
+ * user did not explicitly call `complete()`/`fail()`.
28
+ *
29
+ * Tools without `task: true` are bypassed entirely (zero overhead).
30
+ * `task: true` tools invoked WITHOUT `X-Mesh-Job-Id` (a regular
31
+ * synchronous `tools/call`) fall through to the user function with
32
+ * `null` in the MeshJob slot per `MESHJOB_DDDI_CONTRACT.md`.
33
+ *
34
+ * The dispatch logic is centralised here so the per-tool wrapper in
35
+ * `agent.ts` and the claim dispatcher both call into the same path.
36
+ */
37
+ import { JobController, withJobAsync } from "@mcpmesh/core";
38
+ import { CURRENT_JOB } from "./job-context.js";
39
+ const _HDR_JOB_ID = "x-mesh-job-id";
40
+ const _HDR_TIMEOUT = "x-mesh-timeout";
41
+ /**
42
+ * Read `X-Mesh-Job-Id` / `X-Mesh-Timeout` from a header dict (case
43
+ * normalised to lowercase). Returns `[null, null]` when absent or
44
+ * malformed.
45
+ */
46
+ export function readJobHeaders(headers) {
47
+ if (!headers)
48
+ return [null, null];
49
+ const jobId = headers[_HDR_JOB_ID] ?? null;
50
+ if (!jobId)
51
+ return [null, null];
52
+ const timeoutRaw = headers[_HDR_TIMEOUT];
53
+ let deadlineSecs = null;
54
+ if (timeoutRaw) {
55
+ const parsed = parseFloat(timeoutRaw);
56
+ if (Number.isFinite(parsed) && parsed > 0) {
57
+ deadlineSecs = parsed;
58
+ }
59
+ }
60
+ return [jobId, deadlineSecs];
61
+ }
62
+ /**
63
+ * Best-effort JSON-safety check for the auto-complete payload.
64
+ *
65
+ * Mirrors the Python helper: primitives, plain arrays of safe values,
66
+ * and plain objects keyed by strings with safe values pass through.
67
+ * Anything else (Map, Set, class instances, Symbol, BigInt, undefined,
68
+ * functions) gets wrapped as `{ value: String(result) }` so the Rust
69
+ * JSON layer doesn't error inside auto-complete.
70
+ *
71
+ * The plain-object check uses `Object.getPrototypeOf` rather than
72
+ * `Object.entries`, because Maps/Sets/class instances have empty
73
+ * `Object.entries(...)` results — which would otherwise (mis-)pass the
74
+ * "every entry is safe" guard.
75
+ */
76
+ function isJsonSafe(value) {
77
+ if (value === null)
78
+ return true;
79
+ const t = typeof value;
80
+ if (t === "boolean" || t === "number" || t === "string") {
81
+ // Reject NaN / +Infinity — they JSON-stringify to `null` and would
82
+ // round-trip lossy through the registry's payload column.
83
+ if (t === "number" && !Number.isFinite(value))
84
+ return false;
85
+ return true;
86
+ }
87
+ if (Array.isArray(value))
88
+ return value.every(isJsonSafe);
89
+ if (t === "object") {
90
+ // Plain-object check: prototype must be Object.prototype or null.
91
+ // This rejects Maps, Sets, Dates, class instances, etc. — all of
92
+ // which serialise to `{}` (lossy) under default JSON.stringify and
93
+ // would not survive the FFI serde-json round-trip cleanly.
94
+ const proto = Object.getPrototypeOf(value);
95
+ if (proto !== Object.prototype && proto !== null)
96
+ return false;
97
+ return Object.entries(value).every(([k, v]) => typeof k === "string" && isJsonSafe(v));
98
+ }
99
+ return false;
100
+ }
101
+ /**
102
+ * Run `invoke()` inside a job context (when `jobId` is set) or
103
+ * directly (otherwise).
104
+ *
105
+ * `invoke` must be a thunk — when the caller wants to inject the
106
+ * controller into the user function's args, it is the caller's
107
+ * responsibility to overlay the controller before passing the thunk.
108
+ *
109
+ * `controller` may be `null` when the call is NOT a job (no
110
+ * `X-Mesh-Job-Id`). In that case the wrapper just runs the thunk.
111
+ *
112
+ * @param jobId - Server-assigned job UUID (from `X-Mesh-Job-Id`), or
113
+ * `null` when the call is a regular `tools/call`.
114
+ * @param deadlineSecs - Per-attempt deadline in seconds (from
115
+ * `X-Mesh-Timeout`), or `null`.
116
+ * @param controller - Pre-constructed `JobController` bound to `jobId`,
117
+ * or `null` when not running as a job.
118
+ * @param invoke - Thunk that runs the user function and returns its
119
+ * result. The caller has already overlaid the controller into the
120
+ * user function's args at `meshJobParamIndex`.
121
+ * @param retryOn - Issue #894: per-tool retry-eligible exception
122
+ * whitelist. When the user thunk raises an Error matching one of the
123
+ * constructor classes, the wrapper calls `controller.releaseLease`
124
+ * instead of `controller.fail` so a peer replica can re-claim within
125
+ * ~5s. `undefined` / `[]` disables retry (existing fail-on-throw
126
+ * behaviour). Match check is `err instanceof cls`.
127
+ */
128
+ export async function runWithJobContext(jobId, deadlineSecs, controller, invoke, retryOn) {
129
+ if (!jobId || !controller) {
130
+ // Not a job — run directly.
131
+ return invoke();
132
+ }
133
+ const snap = {
134
+ jobId,
135
+ deadlineSecsRemaining: deadlineSecs,
136
+ };
137
+ // Auto-complete on successful return iff the user didn't already
138
+ // close the row themselves. Matches Python's `_run_and_autocomplete`.
139
+ // On exception we let the throw propagate; we attempt a best-effort
140
+ // `controller.fail(...)` only if the controller is not yet terminal.
141
+ //
142
+ // We capture the user's actual return value in a closure (`captured`)
143
+ // and feed only a JSON-safe sentinel (`null`) through the napi
144
+ // boundary in `withJobAsync`. The user value goes back to the JS
145
+ // caller via the returned closure variable — keeping non-JSON-safe
146
+ // returns (Map, Symbol, class instance, BigInt, undefined) from
147
+ // hitting the Rust serde-json round-trip and producing a cryptic
148
+ // FFI error. The auto-complete path still applies `isJsonSafe` and
149
+ // wraps non-safe values for `controller.complete(...)`.
150
+ let captured;
151
+ let didCapture = false;
152
+ // Issue #894: when retryOn matches we suppress the user's exception
153
+ // and the wrapper returns the default value of T (undefined). The
154
+ // claim-dispatch path is the primary consumer; it ignores the return
155
+ // value when re-claim happens. Inbound HTTP path is a no-op for
156
+ // retryOn since headers-driven invocations don't auto-retry on the
157
+ // producer side anyway.
158
+ let suppressed = false;
159
+ const runAndAutoComplete = async () => {
160
+ try {
161
+ captured = await invoke();
162
+ didCapture = true;
163
+ }
164
+ catch (err) {
165
+ // Step 1: probe is_terminal — if user already called complete/fail,
166
+ // their terminal call is the source of truth; leave the row alone
167
+ // and propagate.
168
+ let alreadyTerminal = false;
169
+ try {
170
+ alreadyTerminal = await controller.isTerminal();
171
+ }
172
+ catch {
173
+ // Probe failed; treat as not-terminal so we still attempt a
174
+ // best-effort terminal report below.
175
+ }
176
+ if (alreadyTerminal)
177
+ throw err;
178
+ // Step 2 (issue #894): retryOn match → releaseLease so a peer
179
+ // replica can re-claim within ~5s. Suppress the exception on
180
+ // success — the job lifecycle becomes the registry's responsibility.
181
+ if (retryOn &&
182
+ retryOn.length > 0 &&
183
+ err instanceof Error &&
184
+ retryOn.some((cls) => err instanceof cls)) {
185
+ const reason = `${err.constructor.name}: ${err.message}`;
186
+ try {
187
+ await controller.releaseLease(reason);
188
+ suppressed = true;
189
+ return null;
190
+ }
191
+ catch (releaseErr) {
192
+ // releaseLease failed — fall back to fail() so the row
193
+ // doesn't sit in `working` until lease expiry. Best-effort;
194
+ // swallow any further failure (the registry's lease sweeper
195
+ // is the ultimate backstop). Log for parity with Python
196
+ // (`job_dispatch.py:365-383`) so operators can correlate
197
+ // unexpected fail-rows with the underlying release failure.
198
+ console.warn(`[mesh-jobs] release_lease failed for job=${jobId} (${releaseErr instanceof Error
199
+ ? releaseErr.message
200
+ : String(releaseErr)}); falling back to fail()`);
201
+ try {
202
+ await controller.fail(`retry-eligible ${reason}; release_lease failed: ${releaseErr instanceof Error
203
+ ? releaseErr.message
204
+ : String(releaseErr)}`);
205
+ }
206
+ catch (failErr) {
207
+ console.debug(`[mesh-jobs] fallback fail() also failed for job=${jobId}:`, failErr);
208
+ }
209
+ suppressed = true;
210
+ return null;
211
+ }
212
+ }
213
+ // Step 3: non-retryable → existing behaviour (best-effort fail()
214
+ // then propagate).
215
+ try {
216
+ await controller.fail(err instanceof Error ? err.message : String(err));
217
+ }
218
+ catch {
219
+ // Swallow — the registry sweep is the ultimate backstop.
220
+ }
221
+ throw err;
222
+ }
223
+ // Only auto-complete if the user didn't already call complete/fail.
224
+ try {
225
+ const alreadyTerminal = await controller.isTerminal();
226
+ if (alreadyTerminal)
227
+ return null;
228
+ }
229
+ catch {
230
+ // If we can't probe, skip auto-complete to avoid double-flush.
231
+ return null;
232
+ }
233
+ try {
234
+ const safe = isJsonSafe(captured)
235
+ ? captured
236
+ : { value: String(captured) };
237
+ await controller.complete(safe);
238
+ }
239
+ catch {
240
+ // Auto-complete failed — registry sweep will eventually mark
241
+ // the row terminal. Don't shadow the user's return value.
242
+ }
243
+ return null;
244
+ };
245
+ // Bind the JS-side ALS first; then bind the Rust-side task-local
246
+ // around the same Promise so cancel registry + outbound headers see
247
+ // the active job. Both must be set in parallel because the Rust
248
+ // task-local does NOT cross the FFI boundary into the Node loop.
249
+ //
250
+ // The Promise handed to `withJobAsync` resolves to `null` (the
251
+ // sentinel) — Rust serde never sees the user's value, so non-JSON
252
+ // returns can't trip the FFI boundary. The user's actual return is
253
+ // pulled from `captured` after the await resolves.
254
+ return CURRENT_JOB.run(snap, async () => {
255
+ const body = runAndAutoComplete();
256
+ await withJobAsync(jobId, deadlineSecs, body);
257
+ if (!didCapture) {
258
+ if (suppressed) {
259
+ // Issue #894: the user threw a retryOn-matched exception and the
260
+ // wrapper called releaseLease() (or its fail() fallback). The
261
+ // lifecycle is now the registry's concern — return undefined to
262
+ // unwind. wrappedExecute (agent.ts) maps undefined/null to the
263
+ // empty string "" before FastMCP serialises the response, which
264
+ // is benign here because the registry's row state (working/failed)
265
+ // is what consumers poll on, not the inbound HTTP body.
266
+ return undefined;
267
+ }
268
+ // Defensive: the body resolved without setting `captured` —
269
+ // should be unreachable since runAndAutoComplete only returns
270
+ // after invoke() succeeds (which sets captured), but guard
271
+ // against future refactors.
272
+ throw new Error("runWithJobContext: invoke completed but no value was captured");
273
+ }
274
+ return captured;
275
+ });
276
+ }
277
+ /**
278
+ * Construct a `JobController` for `(jobId, instanceId, registryUrl)`.
279
+ *
280
+ * Wraps the napi binding so callers don't import `@mcpmesh/core`
281
+ * directly — keeps the injection point in agent.ts compact.
282
+ */
283
+ export function makeJobController(jobId, instanceId, registryUrl) {
284
+ return new JobController(jobId, instanceId, registryUrl);
285
+ }
286
+ /**
287
+ * Build the positional call args array for a `task: true` tool, splicing
288
+ * the `controller` into the user signature at `meshJobParamIndex`.
289
+ *
290
+ * Position 0 is always the parsed `args` payload; deps begin at 1. The
291
+ * MeshJob slot is orthogonal to MeshTool positional indexing — when
292
+ * `meshJobParamIndex` lands inside the dep range the deps shift past
293
+ * it; when it lands after all deps the helper pads any gap with `null`
294
+ * and places the controller at the trailing position.
295
+ *
296
+ * Centralised here so both the inbound HTTP wrapper (agent.ts) and the
297
+ * claim-path dispatcher (claim handler in agent.ts) share one
298
+ * implementation — historically these splice loops had drifted apart.
299
+ *
300
+ * @param payload - The parsed `args` payload (signature position 0).
301
+ * @param deps - Resolved dep proxies (or `MeshJobSubmitter` for the
302
+ * meshJobDepIndex slot, or `null` for unresolved deps) in declaration
303
+ * order. Positionally injected starting at sig pos 1.
304
+ * @param controller - The `JobController` to inject at
305
+ * `meshJobParamIndex`, or `null` when the call is not running under
306
+ * a job context.
307
+ * @param meshJobParamIndex - Signature position where the controller
308
+ * should land, or `undefined` when the user didn't declare a MeshJob
309
+ * slot (controller is then dropped — the user just doesn't get one).
310
+ */
311
+ export function spliceJobController(payload, deps, controller, meshJobParamIndex) {
312
+ const callArgs = [payload];
313
+ let depCursor = 0;
314
+ let pos = 1;
315
+ while (depCursor < deps.length || pos === meshJobParamIndex) {
316
+ if (pos === meshJobParamIndex) {
317
+ callArgs.push(controller);
318
+ pos += 1;
319
+ continue;
320
+ }
321
+ callArgs.push(deps[depCursor]);
322
+ depCursor += 1;
323
+ pos += 1;
324
+ }
325
+ // Trailing meshJobParamIndex case (after all deps).
326
+ if (meshJobParamIndex !== undefined &&
327
+ callArgs.length <= meshJobParamIndex) {
328
+ while (callArgs.length < meshJobParamIndex) {
329
+ callArgs.push(null);
330
+ }
331
+ callArgs[meshJobParamIndex] = controller;
332
+ }
333
+ return callArgs;
334
+ }
335
+ //# sourceMappingURL=inbound-job-dispatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound-job-dispatch.js","sourceRoot":"","sources":["../src/inbound-job-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,WAAW,EAA2B,MAAM,kBAAkB,CAAC;AAExE,MAAM,WAAW,GAAG,eAAe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,SAAS;QACX,CAAC;QACD,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;QAC/B,SAAS,IAAI,CAAC,CAAC;QACf,GAAG,IAAI,CAAC,CAAC;IACX,CAAC;IACD,oDAAoD;IACpD,IACE,iBAAiB,KAAK,SAAS;QAC/B,QAAQ,CAAC,MAAM,IAAI,iBAAiB,EACpC,CAAC;QACD,OAAO,QAAQ,CAAC,MAAM,GAAG,iBAAiB,EAAE,CAAC;YAC3C,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;QACD,QAAQ,CAAC,iBAAiB,CAAC,GAAG,UAAU,CAAC;IAC3C,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -54,6 +54,23 @@ import { route, routeWithConfig } from "./route.js";
54
54
  import { bindToExpress } from "./api-runtime.js";
55
55
  import { llm } from "./llm.js";
56
56
  import { llmProvider } from "./llm-provider.js";
57
+ import { sseStream } from "./sse-stream.js";
58
+ import { mount as a2aMount } from "./a2a/producer/index.js";
59
+ /**
60
+ * `mesh.a2a` namespace — A2A v1.0 producer surface (issue #933).
61
+ *
62
+ * Sibling to `mesh.route(...)` for "user-owned Express app, DDDI of mesh
63
+ * tools" — but tailored to the A2A protocol's two-routes-per-skill shape
64
+ * (dispatch + agent card). One call to `mesh.a2a.mount(app, config,
65
+ * handler)` wires both routes plus the heartbeat surface emission.
66
+ */
67
+ interface MeshA2ANamespace {
68
+ /**
69
+ * Mount an A2A v1.0 producer surface. Wires the JSON-RPC dispatch route
70
+ * and the agent-card discovery route on the provided Express app.
71
+ */
72
+ mount: typeof a2aMount;
73
+ }
57
74
  interface MeshNamespace {
58
75
  (server: import("fastmcp").FastMCP, config: import("./types.js").AgentConfig): MeshAgent;
59
76
  route: typeof route;
@@ -64,6 +81,10 @@ interface MeshNamespace {
64
81
  llm: typeof llm;
65
82
  /** Create a zero-code LLM provider tool */
66
83
  llmProvider: typeof llmProvider;
84
+ /** Pipe an AsyncIterable<string> to an Express response as text/event-stream */
85
+ sseStream: typeof sseStream;
86
+ /** A2A v1.0 producer surface (issue #933). */
87
+ a2a: MeshA2ANamespace;
67
88
  }
68
89
  /**
69
90
  * Main mesh function with route and llm helpers attached.
@@ -73,18 +94,21 @@ interface MeshNamespace {
73
94
  * - `mesh.bind(app, options)` - Bind to Express, introspect routes
74
95
  * - `mesh.llm(config)` - Create LLM-powered tool with agentic loop
75
96
  * - `mesh.llmProvider(config)` - Create zero-code LLM provider
97
+ * - `mesh.sseStream(res, asyncIterable)` - Forward async iterable as SSE
76
98
  */
77
99
  declare const mesh: MeshNamespace;
78
100
  export { mesh, MeshAgent };
101
+ export { IN_WORKER_SYMBOL } from "./agent.js";
102
+ export { __getWorkerToolMap } from "./agent.js";
103
+ export { runWithTraceContext, runWithPropagatedHeaders } from "./proxy.js";
79
104
  export { FastMCP } from "fastmcp";
80
105
  export { meshExpress, MeshExpress, type MeshExpressConfig } from "./express.js";
81
106
  export { getApiRuntime, ApiRuntime, bindToExpress, introspectExpressRoutes, type ApiRuntimeConfig, } from "./api-runtime.js";
82
107
  export { route, routeWithConfig, RouteRegistry, type MeshRouteHandler, type MeshRouteHandlerWithNext, type RouteDependencies, type MeshRouteConfig, type RouteMetadata, } from "./route.js";
83
- export { createProxy, normalizeDependency, getCurrentPropagatedHeaders, extractContent, type MultiContentResult } from "./proxy.js";
108
+ export { createProxy, normalizeDependency, getCurrentPropagatedHeaders, extractContent, streamMcpTool, type MultiContentResult } from "./proxy.js";
84
109
  export { initTracing, isTracingAvailable, generateTraceId, generateSpanId, parseTraceContext, createTraceHeaders, publishTraceSpan, type TraceContext, type AgentMetadata, type SpanData, } from "./tracing.js";
85
110
  export { llm, LlmToolRegistry, buildLlmAgentSpecs, handleLlmToolsUpdated, handleLlmProviderAvailable, handleLlmProviderUnavailable, getLlmToolMetadata, isLlmTool, type LlmToolConfig, type ResolvedProvider, type FastMcpToolDef, } from "./llm.js";
86
- export { MeshLlmAgent, VercelDirectProvider, LiteLLMProvider, // Deprecated: use VercelDirectProvider instead
87
- MeshDelegatedProvider, createLlmToolProxy, type MeshLlmAgentConfig, type AgentRunContext, type LlmProvider, } from "./llm-agent.js";
111
+ export { MeshLlmAgent, MeshDelegatedProvider, createLlmToolProxy, type MeshLlmAgentConfig, type AgentRunContext, type LlmProvider, } from "./llm-agent.js";
88
112
  export { llmProvider, loadProvider, extractVendorFromModel, extractModelName, isLlmProviderTool, getLlmProviderMeta, } from "./llm-provider.js";
89
113
  export { ProviderHandlerRegistry, GenericHandler, ClaudeHandler, OpenAIHandler, type ProviderHandler, type ProviderHandlerConstructor, type VendorCapabilities, type ToolSchema, type OutputSchema, type PreparedRequest, type OutputMode, } from "./provider-handlers/index.js";
90
114
  export { uploadMedia, downloadMedia, mediaResult, MediaResult, createMediaResult, saveUpload, saveUploadResult, getMediaStore, guessMimeType, formatForOpenai, resolveMediaInputs, LocalMediaStore, S3MediaStore, resolveResourceLinks, hasResourceLink, type MediaStore, type MediaUploadResult, type ResolvedContent, } from "./media/index.js";
@@ -92,10 +116,22 @@ export { mediaParam } from "./types.js";
92
116
  export { enrichSchemaWithMediaTypes } from "./media-param.js";
93
117
  export { MaxIterationsError, ToolExecutionError, LLMAPIError, ResponseParseError as LlmResponseParseError, ProviderUnavailableError, } from "./errors.js";
94
118
  export { parseSSEResponse, isSSEResponse, parseSSEStream } from "./sse.js";
119
+ export { sseStream } from "./sse-stream.js";
95
120
  export { debug, createDebug, isAnyDebugEnabled } from "./debug.js";
96
121
  export { renderTemplate, clearTemplateCache, registerHelper, registerPartial, isFileTemplate, extractFilePath, setTemplateBasePath, getTemplateBasePath, findAndSetBasePath, } from "./template.js";
97
122
  export { ResponseParser, createResponseParser, extractJson, zodSchemaToPromptDescription, formatZodError, } from "./response-parser.js";
123
+ export type { MeshJob } from "./types.js";
124
+ export { CURRENT_JOB, currentJob, remainingSeconds, withJobAsync, type JobContextSnapshot, } from "./job-context.js";
125
+ export { resolveMeshJobSignature, ResolverError, type ResolvedSignature, type ResolvedMeshToolDep, type ResolverInput, } from "./resolver-meshjob.js";
126
+ export { MeshJobSubmitter, type SubmitOptions, } from "./mesh-job-submitter.js";
127
+ export { readJobHeaders, runWithJobContext, makeJobController, } from "./inbound-job-dispatch.js";
128
+ export { ClaimDispatcher, type ClaimHandler, } from "./claim-dispatcher.js";
129
+ export { registerJobHelperTools } from "./jobs-helper-tools.js";
130
+ export { registerCancelRoute } from "./jobs-cancel-route.js";
131
+ export { JobController, JobProxy } from "@mcpmesh/core";
132
+ export { A2AClient, A2AJob, A2AStream, A2ABearer, A2AError, A2ATimeoutError, A2AAuthError, A2AJobError, A2AJobFailedError, A2AJobCanceledError, type A2AClientConfig, type A2ABearerConfig, type A2AMessage, type A2AResponse, type A2ATaskEnvelope, type A2AEvent, type A2AEventKind, } from "./a2a/index.js";
133
+ export { A2AProducerRegistry, A2ATaskStore, buildAgentCard, buildBearerAuthMiddleware, buildCompletedTask, buildDispatcherMiddleware, buildFailedTask, buildWorkingTask, stringifyResult, TERMINAL_EVICTION_MS, DEFAULT_INPUT_MODES as A2A_DEFAULT_INPUT_MODES, DEFAULT_OUTPUT_MODES as A2A_DEFAULT_OUTPUT_MODES, JSONRPC_AUTH_ERROR as A2A_JSONRPC_AUTH_ERROR, JSONRPC_PARSE_ERROR as A2A_JSONRPC_PARSE_ERROR, JSONRPC_INVALID_REQUEST as A2A_JSONRPC_INVALID_REQUEST, JSONRPC_METHOD_NOT_FOUND as A2A_JSONRPC_METHOD_NOT_FOUND, JSONRPC_INVALID_PARAMS as A2A_JSONRPC_INVALID_PARAMS, type A2AMountConfig, type A2ASurfaceMetadata, type A2ADependencies, type A2AHandler, type CardRenderContext as A2ACardRenderContext, type TaskRecord as A2ATaskRecord, } from "./a2a/producer/index.js";
98
134
  export type { AgentConfig, ResolvedAgentConfig, MeshToolDef, ToolMeta, DependencySpec, NormalizedDependency, ResolvedDependency, DependencyKwargs, McpMeshTool, McpMeshAgent, // Deprecated, use McpMeshTool
99
- JsAgentHandle, JsMeshEvent, JsAgentSpec, JsToolSpec, JsDependencySpec, JsLlmAgentSpec, JsLlmToolInfo, JsLlmProviderInfo, LlmProviderSpec, LlmFilterSpec, LlmFilterMode, LlmMeta, LlmToolCall, LlmContentPart, LlmMessage, LlmToolCallRequest, LlmToolDefinition, LlmCompletionParams, LlmCompletionResponse, MeshLlmConfig, LlmAgent, LlmCallOptions, LlmToolProxy, LlmMessageInput, LlmContextMode, LlmOutputMode, MeshLlmRequest, MeshLlmUsage, MeshLlmResponse, LlmProviderConfig, MediaParamMeta, } from "./types.js";
135
+ JsAgentHandle, JsMeshEvent, JsAgentSpec, JsToolSpec, JsDependencySpec, JsLlmAgentSpec, JsLlmToolInfo, JsLlmProviderInfo, LlmProviderSpec, LlmFilterSpec, LlmFilterMode, LlmMeta, LlmToolCall, LlmContentPart, LlmMessage, LlmToolCallRequest, LlmToolDefinition, LlmCompletionParams, LlmCompletionResponse, MeshLlmConfig, LlmAgent, LlmCallOptions, LlmToolProxy, LlmMessageInput, LlmContextMode, LlmOutputMode, MeshLlmRequest, MeshLlmUsage, MeshLlmResponse, LlmProviderConfig, MediaParamMeta, MeshA2AConfig, } from "./types.js";
100
136
  export default mesh;
101
137
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,EAAkB,SAAS,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;A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,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGnE,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,WAAW,EACX,4BAA4B,EAC5B,cAAc,GACf,MAAM,sBAAsB,CAAC;AAG9B,YAAY,EACV,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,YAAY,EAAE,8BAA8B;AAC5C,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,iBAAiB,EAEjB,eAAe,EACf,aAAa,EACb,aAAa,EACb,OAAO,EACP,WAAW,EACX,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,EACb,QAAQ,EACR,cAAc,EACd,YAAY,EAEZ,eAAe,EACf,cAAc,EACd,aAAa,EAEb,cAAc,EACd,YAAY,EACZ,eAAe,EACf,iBAAiB,EAEjB,cAAc,GACf,MAAM,YAAY,CAAC;AAGpB,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,EAAkB,SAAS,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B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