@classytic/arc 2.41.1 → 2.44.0

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 (248) hide show
  1. package/dist/{EventTransport-CbUKDzZZ.d.mts → EventTransport-CiicKz2Z.d.mts} +1 -1
  2. package/dist/{EventTransport-DSqD_Xsg.mjs → EventTransport-DZWDsaPa.mjs} +22 -17
  3. package/dist/{HookSystem-CMF94SEA.mjs → HookSystem-yjEgn7Cm.mjs} +2 -2
  4. package/dist/{QueryCache-DFA-QrU9.d.mts → QueryCache--5uAuYPW.d.mts} +7 -3
  5. package/dist/{ResourceRegistry-MGpXoxHZ.mjs → ResourceRegistry-DJxHUpE4.mjs} +44 -13
  6. package/dist/acquire-BozJ-9yt.mjs +35 -0
  7. package/dist/actionPermissions-5N04zBL4.mjs +772 -0
  8. package/dist/audit/index.d.mts +46 -8
  9. package/dist/audit/index.mjs +48 -26
  10. package/dist/auth/audit.d.mts +8 -8
  11. package/dist/auth/audit.mjs +1 -1
  12. package/dist/auth/index.d.mts +46 -16
  13. package/dist/auth/index.mjs +134 -156
  14. package/dist/auth/redis-session.d.mts +4 -5
  15. package/dist/auth/redis-session.mjs +1 -1
  16. package/dist/{authorizationDecision-DawKGoXb.mjs → authorizationDecision-wX3SA9w_.mjs} +7 -102
  17. package/dist/{base-CxrV1LmG.d.mts → base-CZyixEQR.d.mts} +27 -5
  18. package/dist/boundedMap-DWiKW7lP.mjs +57 -0
  19. package/dist/{buildHandler-CvxKOc0m.mjs → buildHandler-Bswu_vNb.mjs} +4 -4
  20. package/dist/cache/index.d.mts +31 -43
  21. package/dist/cache/index.mjs +4 -4
  22. package/dist/{caching-DbCBxlgw.mjs → caching-Drp68DIS.mjs} +3 -3
  23. package/dist/claimed-DYvQoZLv.mjs +8 -0
  24. package/dist/cleanup/index.d.mts +18 -22
  25. package/dist/cleanup/index.mjs +27 -73
  26. package/dist/cli/commands/describe.d.mts +7 -5
  27. package/dist/cli/commands/describe.mjs +7 -4
  28. package/dist/cli/commands/docs.d.mts +2 -3
  29. package/dist/cli/commands/docs.mjs +3 -3
  30. package/dist/cli/commands/doctor.d.mts +2 -3
  31. package/dist/cli/commands/doctor.mjs +1 -1
  32. package/dist/cli/commands/generate.mjs +2 -3
  33. package/dist/cli/commands/init.mjs +2 -3
  34. package/dist/cli/commands/introspect.d.mts +2 -3
  35. package/dist/cli/commands/introspect.mjs +2 -2
  36. package/dist/cli/index.mjs +3 -3
  37. package/dist/{constants-D5Ubn1fe.mjs → constants-B2QHb6u6.mjs} +4 -2
  38. package/dist/context/index.d.mts +11 -14
  39. package/dist/context/index.mjs +18 -38
  40. package/dist/core/index.d.mts +3 -3
  41. package/dist/core/index.mjs +8 -8
  42. package/dist/{core-5lazhva9.mjs → core-COcqo0Cp.mjs} +15 -5
  43. package/dist/{createActionRouter-DNqoaK81.mjs → createActionRouter-zG13rpPJ.mjs} +97 -39
  44. package/dist/{createAggregationRouter-BcbQJf10.mjs → createAggregationRouter-CWRz96Vr.mjs} +11 -8
  45. package/dist/{preloadResources-f3boenVZ.mjs → createApp-BGLYtErt.mjs} +305 -394
  46. package/dist/{createMcpServer-CbDWkZ1T.d.mts → createMcpServer-DSztofa9.d.mts} +1 -1
  47. package/dist/{defineAggregation-D_eJjm5A.mjs → defineAggregation--3xguLkk.mjs} +1 -1
  48. package/dist/{defineResource-DxkMTjRn.mjs → defineResource-gUp9ug66.mjs} +118 -1024
  49. package/dist/discovery/index.d.mts +6 -7
  50. package/dist/discovery/index.mjs +1 -1
  51. package/dist/docs/index.d.mts +11 -5
  52. package/dist/docs/index.mjs +4 -4
  53. package/dist/{elevation-CkvG0LG2.mjs → elevation-BG4gnMsJ.mjs} +41 -12
  54. package/dist/{elevation-BXCfVcNG.d.mts → elevation-BW2J3tNj.d.mts} +1 -2
  55. package/dist/encryption/index.d.mts +5 -5
  56. package/dist/encryption/index.mjs +3 -3
  57. package/dist/{errorHandler-D1GHKGlV.mjs → errorHandler-COHw3N1b.mjs} +26 -5
  58. package/dist/{errors-BH7YU_9O.mjs → errors-CW4anJBy.mjs} +58 -23
  59. package/dist/{errors-BGdVwP25.d.mts → errors-JYc9vwqE.d.mts} +9 -0
  60. package/dist/{eventPlugin-B52abJ8W.d.mts → eventPlugin-BtmA4-3P.d.mts} +65 -9
  61. package/dist/{eventPlugin-zZY-unhr.mjs → eventPlugin-BweHAVws.mjs} +82 -21
  62. package/dist/{subscribe-helpers-DatDkcuG.mjs → eventTypes-N4-omQFR.mjs} +151 -17
  63. package/dist/events/index.d.mts +43 -18
  64. package/dist/events/index.mjs +49 -53
  65. package/dist/events/transports/redis-stream-entry.d.mts +1 -1
  66. package/dist/events/transports/redis-stream-entry.mjs +139 -157
  67. package/dist/events/transports/redis.d.mts +5 -6
  68. package/dist/events/transports/redis.mjs +2 -2
  69. package/dist/factory/index.d.mts +42 -27
  70. package/dist/factory/index.mjs +213 -32
  71. package/dist/{fastify-augmentation-Cq2nHVaW.d.mts → fastify-augmentation-DRlCIWE9.d.mts} +11 -25
  72. package/dist/{fields-BHrkoF5y.mjs → fields-A5crhsJb.mjs} +1 -1
  73. package/dist/{fields-I_EeRWND.d.mts → fields-BBSpf8pS.d.mts} +1 -1
  74. package/dist/filter-merge-DGM-GQ1J.mjs +99 -0
  75. package/dist/{generate-BLRf2m3y.mjs → generate-BXKo2Gc8.mjs} +2 -2
  76. package/dist/{headers-BIXWKrzQ.mjs → headers-DKZQKL-Z.mjs} +2 -2
  77. package/dist/health-BYAwA6YS.mjs +22 -0
  78. package/dist/{health-ZRHeDHXH.mjs → health-CrqUp3sz.mjs} +115 -55
  79. package/dist/hooks/index.d.mts +2 -2
  80. package/dist/hooks/index.mjs +2 -3
  81. package/dist/idempotency/index.d.mts +36 -10
  82. package/dist/idempotency/index.mjs +230 -111
  83. package/dist/idempotency/redis.d.mts +1 -1
  84. package/dist/idempotency/redis.mjs +77 -12
  85. package/dist/{index-D4u76eQW.d.mts → index-Beg3aNnK.d.mts} +23 -101
  86. package/dist/{preloadResources-CjS2OfpU.d.mts → index-BkV55WlV.d.mts} +37 -38
  87. package/dist/{index-BHdZD8zK.d.mts → index-Bxriq3so.d.mts} +84 -21
  88. package/dist/index-CUJvoyw3.d.mts +510 -0
  89. package/dist/{index-CbJiYrfv.d.mts → index-Chgz3d0i.d.mts} +1 -1
  90. package/dist/{index-DHbyPo5j.d.mts → index-WH7xgvxS.d.mts} +304 -254
  91. package/dist/index.d.mts +9 -9
  92. package/dist/index.mjs +11 -11
  93. package/dist/{init-CpLkjU18.mjs → init-BPzK5Lnr.mjs} +1 -1
  94. package/dist/integrations/event-gateway.d.mts +11 -7
  95. package/dist/integrations/event-gateway.mjs +4 -4
  96. package/dist/integrations/index.d.mts +3 -3
  97. package/dist/integrations/index.mjs +1 -1
  98. package/dist/integrations/jobs/index.d.mts +1 -1
  99. package/dist/integrations/jobs/index.mjs +18 -5
  100. package/dist/integrations/mcp/index.d.mts +102 -89
  101. package/dist/integrations/mcp/index.mjs +19 -4
  102. package/dist/integrations/mcp/testing.d.mts +8 -9
  103. package/dist/integrations/mcp/testing.mjs +2 -2
  104. package/dist/integrations/streamline.d.mts +85 -144
  105. package/dist/integrations/streamline.mjs +131 -55
  106. package/dist/integrations/webhooks.d.mts +83 -143
  107. package/dist/integrations/webhooks.mjs +36 -80
  108. package/dist/integrations/websocket-pushref-redis.d.mts +5 -6
  109. package/dist/integrations/websocket-pushref-redis.mjs +1 -1
  110. package/dist/integrations/websocket-redis.d.mts +5 -6
  111. package/dist/integrations/websocket-redis.mjs +1 -1
  112. package/dist/integrations/websocket.d.mts +3 -3
  113. package/dist/integrations/websocket.mjs +2 -2
  114. package/dist/{interface-DEWNOMza.d.mts → interface-JJzwH4Ro.d.mts} +34 -2
  115. package/dist/{jsonBody-ELR9lfeU.mjs → jsonBody-YIq-vGLv.mjs} +2 -2
  116. package/dist/{keys-cpZCtcIE.mjs → keys-CpoiZ8hU.mjs} +7 -18
  117. package/dist/{loadResources-BPfWiI5s.mjs → loadResources-6jO52-RR.mjs} +3 -3
  118. package/dist/{loadResourcesFromEntry-ixtfL3J2.mjs → loadResourcesFromEntry-MP8xEppu.mjs} +2 -2
  119. package/dist/logger/index.d.mts +9 -17
  120. package/dist/logger/index.mjs +2 -153
  121. package/dist/logger-D4V1zGLI.mjs +160 -0
  122. package/dist/{mcpPlugin-BX5PujI0.mjs → mcpPlugin-srPc7ItN.mjs} +446 -170
  123. package/dist/{memory-Iotz0cCx.mjs → memory-CTa5pOCW.mjs} +36 -34
  124. package/dist/{metrics-NMsmpRmY.mjs → metrics-DsZrvnpB.mjs} +39 -72
  125. package/dist/middleware/index.d.mts +5 -5
  126. package/dist/middleware/index.mjs +3 -3
  127. package/dist/migrations/index.d.mts +13 -13
  128. package/dist/migrations/index.mjs +2 -2
  129. package/dist/{module-DpLJG2_N.mjs → module--L0iBIZz.mjs} +8 -8
  130. package/dist/mongodb-memory-server-CHhYSq5y.mjs +35539 -0
  131. package/dist/mongoose-CYJCLyi-.mjs +67451 -0
  132. package/dist/multiTenant-CAtYlW6H.d.mts +104 -0
  133. package/dist/{multipartBody-DtRWM6_U.mjs → multipartBody-Cc7eZ9cq.mjs} +46 -7
  134. package/dist/node-D8UZv_8c.mjs +41236 -0
  135. package/dist/{openapi-CmFf3yq_.mjs → openapi-CMegfsm8.mjs} +48 -10
  136. package/dist/outbox-admin/index.d.mts +5 -5
  137. package/dist/outbox-admin/index.mjs +6 -18
  138. package/dist/{outbox-module-D2z5WkDY.mjs → outbox-module-Ryk270jd.mjs} +203 -33
  139. package/dist/{outbox-module-BHdUnuuK.d.mts → outbox-module-gZCHoE4H.d.mts} +79 -6
  140. package/dist/permissions/index.d.mts +5 -4
  141. package/dist/permissions/index.mjs +8 -6
  142. package/dist/{permissions-D8TBH44E.mjs → permissions-C5ijIz5Q.mjs} +149 -33
  143. package/dist/{pipe-FMWNheSO.mjs → pipe-D81zMtWs.mjs} +2 -2
  144. package/dist/pipeline/index.d.mts +7 -7
  145. package/dist/pipeline/index.mjs +2 -2
  146. package/dist/plan-CJGMKoui.mjs +565 -0
  147. package/dist/{BaseController-CYEwjyjN.mjs → plugin-DALd9dcF.mjs} +1269 -346
  148. package/dist/plugins/index.d.mts +17 -14
  149. package/dist/plugins/index.mjs +44 -22
  150. package/dist/plugins/response-cache.d.mts +5 -6
  151. package/dist/plugins/response-cache.mjs +8 -14
  152. package/dist/plugins/tracing-entry.mjs +2 -2
  153. package/dist/{pluralize-CXWZIzTv.mjs → pluralize-COUNYo3d.mjs} +1 -1
  154. package/dist/presets/filesUpload.d.mts +8 -8
  155. package/dist/presets/filesUpload.mjs +5 -5
  156. package/dist/presets/index.d.mts +35 -40
  157. package/dist/presets/index.mjs +4 -4
  158. package/dist/presets/multiTenant.d.mts +2 -107
  159. package/dist/presets/multiTenant.mjs +22 -162
  160. package/dist/presets/search.d.mts +9 -10
  161. package/dist/presets/search.mjs +2 -2
  162. package/dist/{presets-ZJSPgmT2.mjs → presets-CONf2Qem.mjs} +99 -107
  163. package/dist/{projection-BzIgzoKZ.mjs → projection-wFoLqdss.mjs} +2 -2
  164. package/dist/{pushref-registry-Dov9l4qE.d.mts → pushref-registry-UxCkoA4C.d.mts} +1 -1
  165. package/dist/{queryCachePlugin-DZHPOm9p.mjs → queryCachePlugin-BATECpyh.mjs} +12 -14
  166. package/dist/{queryCachePlugin-BzqxconG.d.mts → queryCachePlugin-C2lZjTxk.d.mts} +1 -1
  167. package/dist/{rateLimitKey-BvOvcBDi.mjs → rateLimitKey-DVEZ_UpV.mjs} +1 -1
  168. package/dist/{realtime-8tIQWZz4.mjs → realtime-xyubMKSB.mjs} +25 -21
  169. package/dist/{redis-Bzi1y3F9.d.mts → redis-BDgv9Glw.d.mts} +17 -24
  170. package/dist/redis-stream-BMk-bpQS.d.mts +219 -0
  171. package/dist/redisShapes-CQksY67q.d.mts +55 -0
  172. package/dist/registry/index.d.mts +15 -10
  173. package/dist/registry/index.mjs +4 -4
  174. package/dist/{registry-DNkgGQcK.mjs → registry-Bdzg-hdm.mjs} +13 -10
  175. package/dist/{renewingLease-yF8BdW4b.mjs → renewingLease-BFJxGPuh.mjs} +1 -1
  176. package/dist/{replyHelpers-CNdvMfM4.mjs → replyHelpers-Bnc6lJyy.mjs} +2 -2
  177. package/dist/{requestContext-cDkAUr-P.mjs → requestContext-C10UeFe5.mjs} +1 -1
  178. package/dist/requirement-Bu50QALH.mjs +35 -0
  179. package/dist/requirement-CbiLdQ1n.d.mts +22 -0
  180. package/dist/resourceRateLimit-Wf6d6FL9.d.mts +30 -0
  181. package/dist/resourceRateLimit-urWPJxrt.mjs +180 -0
  182. package/dist/rolldown-runtime-MYrLNGnq.mjs +45 -0
  183. package/dist/routeValidator-DHtpzrzk.mjs +70 -0
  184. package/dist/{runtimeCapabilities-CkhS6jn6.mjs → runtimeCapabilities-DIMKMV2G.mjs} +1 -1
  185. package/dist/{schedules-j6uXXAeJ.mjs → schedules-CKTs5ys8.mjs} +46 -37
  186. package/dist/{schemaConverter-BVA7cFRG.mjs → schemaConverter-BVjkQ5DD.mjs} +2 -2
  187. package/dist/{schemaIR-CTvPDoPB.mjs → schemaIR-BA0Hb21Y.mjs} +2 -2
  188. package/dist/schemas/index.d.mts +20 -10
  189. package/dist/schemas/index.mjs +8 -3
  190. package/dist/scim/index.d.mts +13 -13
  191. package/dist/scim/index.mjs +2 -2
  192. package/dist/scope/index.d.mts +4 -4
  193. package/dist/scope/index.mjs +6 -6
  194. package/dist/{scope-BUi1xV1I.mjs → scope-DINaj7Ax.mjs} +4 -4
  195. package/dist/shutdown-LpLMH8T1.mjs +59 -0
  196. package/dist/{simpleEqualityMatcher-C9bzq2gO.mjs → simpleEqualityMatcher-DbwIM1f1.mjs} +1 -1
  197. package/dist/{sse-BeqVKQKu.mjs → sse-BzJFPX_1.mjs} +11 -15
  198. package/dist/{sseStream-Ppzo-WUH.mjs → sseStream-DQChzGTs.mjs} +2 -2
  199. package/dist/{store-helpers-dW71XVWL.mjs → store-helpers-Coj9RhOZ.mjs} +1 -1
  200. package/dist/{streaming-IcRFjWQU.mjs → streaming-JzB5CAga.mjs} +1 -1
  201. package/dist/subscriberIdentity-DeyppIif.mjs +28 -0
  202. package/dist/tenancy-DxV8OuX2.mjs +43 -0
  203. package/dist/tenantPreparation-CBvvAcAj.mjs +67 -0
  204. package/dist/testing/cleanupStoreContract.d.mts +4 -5
  205. package/dist/testing/cleanupStoreContract.mjs +1 -1
  206. package/dist/testing/index.d.mts +215 -197
  207. package/dist/testing/index.mjs +289 -214
  208. package/dist/testing/outboxStoreContract.d.mts +4 -5
  209. package/dist/testing/outboxStoreContract.mjs +137 -2
  210. package/dist/testing/requiredPorts.d.mts +16 -0
  211. package/dist/testing/requiredPorts.mjs +65 -0
  212. package/dist/testing/storageContract.d.mts +4 -5
  213. package/dist/testing/storageContract.mjs +1 -1
  214. package/dist/timing-CntavTlR.mjs +46 -0
  215. package/dist/{transactionContext-CPbdlnVw.mjs → transactionContext-orvnGu4F.mjs} +1 -1
  216. package/dist/{typeGuards-BLjPgVBm.mjs → typeGuards-kEaP_WmO.mjs} +1 -1
  217. package/dist/types/index.d.mts +4 -4
  218. package/dist/types/index.mjs +1 -1
  219. package/dist/types/storage.mjs +1 -1
  220. package/dist/{types-DfVDvkdP.d.mts → types-BJ-2XqVF.d.mts} +189 -204
  221. package/dist/{types-CWQn9-IC.d.mts → types-D3Ixsh00.d.mts} +22 -9
  222. package/dist/{types-CgenB1gv.mjs → types-fvO6Ovzx.mjs} +4 -4
  223. package/dist/usage/index.d.mts +5 -6
  224. package/dist/usage/index.mjs +5 -5
  225. package/dist/{userHelpers-ChRvkuSZ.mjs → userHelpers-C76zD5pa.mjs} +1 -1
  226. package/dist/utils/index.d.mts +125 -264
  227. package/dist/utils/index.mjs +13 -12
  228. package/dist/{utils-CxcctrAh.mjs → utils-BpkVZ8rB.mjs} +315 -404
  229. package/dist/{validate-DrYWnOzI.mjs → validate-CWp-lsrm.mjs} +6 -14
  230. package/dist/{versioning-D6JIK8Tk.d.mts → versioning-Bsb51gGT.d.mts} +28 -13
  231. package/dist/{versioning-DKkT4hNJ.mjs → versioning-CHhL9P3o.mjs} +4 -4
  232. package/dist/{websocket-BOXVggMf.d.mts → websocket-Cs4awVyD.d.mts} +1 -1
  233. package/dist/{workScope-CxKqoIFn.mjs → workScope-n9a7d_lZ.mjs} +2 -2
  234. package/package.json +57 -59
  235. package/skills/arc/SKILL.md +13 -4
  236. package/skills/arc/references/auth.md +8 -5
  237. package/skills/arc/references/integrations.md +1 -1
  238. package/skills/arc/references/mcp.md +8 -6
  239. package/skills/arc/references/multi-tenancy.md +19 -14
  240. package/skills/arc/references/production.md +27 -10
  241. package/dist/actionPermissions-BoPGQ5-4.mjs +0 -350
  242. package/dist/index-CFfLKMH4.d.mts +0 -290
  243. package/dist/interface-YzIbF7Ii.mjs +0 -17
  244. package/dist/redis-stream-BPKscsTB.d.mts +0 -260
  245. package/dist/registerRoute-Bsnk6NiZ.mjs +0 -364
  246. package/dist/rolldown-runtime-eysyzFAF.mjs +0 -15
  247. package/dist/sync/changelog.d.mts +0 -3
  248. package/dist/sync/changelog.mjs +0 -3
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.41.1 | MIT | https://classytic.com */
2
- import { a as defaultCrudDescription, c as mcpHandlerAdapter, d as toCallToolResult, f as toCallToolSuccess, h as resolveToolCollisions, i as fieldRulesToZod, l as permissionDeniedResult, m as createMcpServer, n as mcpPlugin, o as resolveCrudDescription, p as buildRequestContext, r as resourceToTools, s as invokeController, t as filterResourcesForMcp, u as toCallToolError } from "../../mcpPlugin-BX5PujI0.mjs";
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
+ import { _ as resolveToolCollisions, a as toolInputShape, c as resolveCrudDescription, d as permissionDeniedResult, f as toCallToolError, g as createMcpServer, h as buildRequestContext, i as isZodTypeSchema, l as invokeController, m as toCallToolSuccess, n as mcpPlugin, o as fieldRulesToZod, p as toCallToolResult, r as resourceToTools, s as defaultCrudDescription, t as filterResourcesForMcp, u as mcpHandlerAdapter } from "../../mcpPlugin-srPc7ItN.mjs";
3
3
  //#region src/integrations/mcp/defineTool.ts
4
4
  /**
5
5
  * Define a type-safe MCP tool.
@@ -277,6 +277,9 @@ function definePrompt(name, config) {
277
277
  }
278
278
  //#endregion
279
279
  //#region src/integrations/mcp/realtimeBridge.ts
280
+ function isPlainArgs(value) {
281
+ return value !== null && typeof value === "object" && !Array.isArray(value);
282
+ }
280
283
  /**
281
284
  * Dispatch a batch of tool calls through the host's MCP tool registry.
282
285
  *
@@ -329,7 +332,19 @@ async function dispatchOne(def, call, ctx) {
329
332
  response: { error: "arguments_json is not valid JSON" }
330
333
  };
331
334
  }
332
- if (def.inputSchema) {
335
+ if (isZodTypeSchema(def.inputSchema)) {
336
+ const result = def.inputSchema.safeParse(parsedArgs);
337
+ if (!result.success) return {
338
+ id: call.id,
339
+ name: call.name,
340
+ isError: true,
341
+ response: {
342
+ error: "argument validation failed",
343
+ fields: result.error.issues.map((i) => `${i.path.join(".") || "input"}: ${i.message}`)
344
+ }
345
+ };
346
+ parsedArgs = isPlainArgs(result.data) ? result.data : {};
347
+ } else if (def.inputSchema) {
333
348
  const fieldErrors = [];
334
349
  const validated = {};
335
350
  for (const [key, schema] of Object.entries(def.inputSchema)) {
@@ -376,4 +391,4 @@ function normalizeResult(result) {
376
391
  return {};
377
392
  }
378
393
  //#endregion
379
- export { bridgeToMcp, buildMcpToolsFromBridges, buildRequestContext, createMcpAuthFromBetterAuthApiKey, createMcpServer, customGuard, defaultCrudDescription, definePrompt, defineTool, denied, dispatchRealtimeToolCall, fieldRulesToZod, filterResourcesForMcp, getOrgId, getUserId, guard, hasOrg, invokeController, isAuthenticated, isOrg, mcpHandlerAdapter, mcpPlugin, permissionDeniedResult, requireAuth, requireOrg, requireOrgId, requireRole, resolveCrudDescription, resolveToolCollisions, resourceToTools, toCallToolError, toCallToolResult, toCallToolSuccess };
394
+ export { bridgeToMcp, buildMcpToolsFromBridges, buildRequestContext, createMcpAuthFromBetterAuthApiKey, createMcpServer, customGuard, defaultCrudDescription, definePrompt, defineTool, denied, dispatchRealtimeToolCall, fieldRulesToZod, filterResourcesForMcp, getOrgId, getUserId, guard, hasOrg, invokeController, isAuthenticated, isOrg, mcpHandlerAdapter, mcpPlugin, permissionDeniedResult, requireAuth, requireOrg, requireOrgId, requireRole, resolveCrudDescription, resolveToolCollisions, resourceToTools, toCallToolError, toCallToolResult, toCallToolSuccess, toolInputShape };
@@ -1,10 +1,10 @@
1
1
 
2
- import { c as McpAuthResult, u as McpPluginOptions } from "../../types-CWQn9-IC.mjs";
3
- import { n as McpServerInstance } from "../../createMcpServer-CbDWkZ1T.mjs";
2
+ import { c as McpAuthResult, u as McpPluginOptions } from "../../types-D3Ixsh00.mjs";
3
+ import { n as McpServerInstance } from "../../createMcpServer-DSztofa9.mjs";
4
4
  import { Client } from "@modelcontextprotocol/client";
5
5
  //#region src/integrations/mcp/testing.d.ts
6
6
  /** An MCP client bound to a live loopback server, plus its teardown. */
7
- interface ConnectedMcpTestClient {
7
+ export interface ConnectedMcpTestClient {
8
8
  /** The connected SDK client — full `listTools` / `callTool` / `listPrompts` surface. */
9
9
  client: Client;
10
10
  /** Closes the client and the HTTP server. Always await it. */
@@ -20,8 +20,8 @@ interface ConnectedMcpTestClient {
20
20
  * One implementation, two entry points: this for a server you built, that for
21
21
  * one built from resources.
22
22
  */
23
- declare function connectMcpTestClient(server: McpServerInstance | unknown): Promise<ConnectedMcpTestClient>;
24
- interface TestMcpClientOptions {
23
+ export declare function connectMcpTestClient(server: McpServerInstance | unknown): Promise<ConnectedMcpTestClient>;
24
+ export interface TestMcpClientOptions {
25
25
  /** MCP plugin options (resources, overrides, etc.) — same as mcpPlugin config */
26
26
  pluginOptions?: Pick<McpPluginOptions, "resources" | "overrides" | "expose" | "exclude" | "toolNamePrefix" | "extraTools" | "extraPrompts" | "instructions">;
27
27
  /** Auth identity for the test session */
@@ -29,7 +29,7 @@ interface TestMcpClientOptions {
29
29
  /** Server name (default: 'test-mcp') */
30
30
  serverName?: string;
31
31
  }
32
- interface TestMcpClient {
32
+ export interface TestMcpClient {
33
33
  /** List all registered tools */
34
34
  listTools(): Promise<Array<{
35
35
  name: string;
@@ -68,6 +68,5 @@ interface TestMcpClient {
68
68
  * await client.close();
69
69
  * ```
70
70
  */
71
- declare function createTestMcpClient(options?: TestMcpClientOptions): Promise<TestMcpClient>;
72
- //#endregion
73
- export { ConnectedMcpTestClient, TestMcpClient, TestMcpClientOptions, connectMcpTestClient, createTestMcpClient };
71
+ export declare function createTestMcpClient(options?: TestMcpClientOptions): Promise<TestMcpClient>;
72
+ //#endregion
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.41.1 | MIT | https://classytic.com */
2
- import { m as createMcpServer, r as resourceToTools, t as filterResourcesForMcp } from "../../mcpPlugin-BX5PujI0.mjs";
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
+ import { g as createMcpServer, r as resourceToTools, t as filterResourcesForMcp } from "../../mcpPlugin-srPc7ItN.mjs";
3
3
  //#region src/integrations/mcp/testing.ts
4
4
  /**
5
5
  * Serve an already-built `McpServer` on an ephemeral loopback port and connect
@@ -2,15 +2,11 @@
2
2
  import { FastifyPluginAsync, FastifyRequest } from "fastify";
3
3
  //#region src/integrations/streamline.d.ts
4
4
  /**
5
- * Start options — matches @classytic/streamline v2.3+ `StartOptions`.
6
- *
7
- * v2.3 additions:
8
- * - `tenantId` — required when streamline's `multiTenant.strict: true`.
9
- * Hosts should NOT accept this from the request body in untrusted
10
- * contexts; use `tenantResolver` to extract from auth context instead.
11
- * - `bypassTenant` — admin/cross-tenant operations. Same caveat.
5
+ * Start options — matches streamline's `StartOptions`. `tenantId` /
6
+ * `bypassTenant` must come from auth context (`tenantResolver`), never the
7
+ * request body.
12
8
  */
13
- interface WorkflowStartOptions {
9
+ export interface WorkflowStartOptions {
14
10
  meta?: Record<string, unknown>;
15
11
  idempotencyKey?: string;
16
12
  priority?: number;
@@ -18,7 +14,7 @@ interface WorkflowStartOptions {
18
14
  bypassTenant?: boolean;
19
15
  }
20
16
  /** Minimal workflow interface — matches @classytic/streamline's createWorkflow() return */
21
- interface WorkflowLike {
17
+ export interface WorkflowLike {
22
18
  definition: {
23
19
  id: string;
24
20
  name?: string;
@@ -40,6 +36,13 @@ interface WorkflowLike {
40
36
  timeout?: number;
41
37
  }): Promise<WorkflowRunLike>;
42
38
  shutdown?(): void;
39
+ /**
40
+ * Read for `compensationHandlers` only — whether a failed run will roll
41
+ * back, which decides if `workflow:failed` ends its stream. Absent = no saga.
42
+ */
43
+ options?: {
44
+ compensationHandlers?: unknown;
45
+ };
43
46
  };
44
47
  start(input: unknown, options?: WorkflowStartOptions): Promise<WorkflowRunLike>;
45
48
  resume(runId: string, payload?: unknown): Promise<WorkflowRunLike>;
@@ -48,7 +51,7 @@ interface WorkflowLike {
48
51
  }): Promise<WorkflowRunLike>;
49
52
  get(runId: string): Promise<WorkflowRunLike | null>;
50
53
  shutdown?(): void;
51
- /** Streamline container for event bridging + repository access (streamline >=2.1) */
54
+ /** Streamline container for event bridging + repository access. */
52
55
  container?: {
53
56
  eventBus: {
54
57
  on(event: string, listener: (...args: unknown[]) => void): void;
@@ -58,42 +61,24 @@ interface WorkflowLike {
58
61
  repository?: {
59
62
  getAll(params: Record<string, unknown>, options?: Record<string, unknown>): Promise<unknown>;
60
63
  /**
61
- * Tenant-scoped lookup by id. Used by the DELETE handler for a
62
- * defense-in-depth pre-flight: streamline 2.3.3's `wf.get(runId)` /
63
- * `engine.get` does NOT accept tenant options, so a cross-tenant
64
- * runId can leak data through the engine path. Going through the
65
- * repository here means mongokit's tenant-filter plugin scopes the
66
- * read — cross-tenant requests get a clean 404 and DELETEs only
67
- * touch rows the caller actually owns.
64
+ * Tenant-scoped lookup — the per-run ownership pre-flight. The engine's
65
+ * `get` takes no tenant options, so the tenant-filtered repository read
66
+ * is what stops cross-tenant access (clean 404).
68
67
  */
69
68
  getById?(id: string, options?: Record<string, unknown>): Promise<WorkflowRunLike | null>;
70
- /**
71
- * Hard-delete a run by id. Routed through mongokit's inherited
72
- * `Repository.delete()` so multi-tenant scope + audit/cache plugins
73
- * fire. Wired into `DELETE /:workflowId/runs/:runId` — operator
74
- * escape hatch for dead-lettered or stuck rows.
75
- */
69
+ /** Tenant-scoped hard delete, backing `DELETE /:workflowId/runs/:runId`. */
76
70
  delete?(id: string, options?: Record<string, unknown>): Promise<unknown>;
77
71
  };
78
72
  /**
79
- * Streamline >= 2.3.2 — explicit deploy-time index sync (TTL on
80
- * terminal runs + tenant compounds). When the host configured
81
- * `createContainer({ retention })`, arc's app-level deploy hook
82
- * should call `await container.syncRetentionIndexes()` after
83
- * `mongoose.connect`. Optional so older streamline versions
84
- * (and partial mocks) still satisfy the structural shape.
73
+ * Deploy-time index sync (retention TTL + tenant compounds). Hosts using
74
+ * `createContainer({ retention })` call it after connecting.
85
75
  */
86
76
  syncRetentionIndexes?: () => Promise<void>;
87
- /**
88
- * Streamline >= 2.3.2 — stop background sweepers and release timers.
89
- * Arc's `onClose` hook below calls this on every workflow's container
90
- * during graceful shutdown so SIGTERM doesn't leave the stale-run
91
- * sweeper running. Optional + idempotent.
92
- */
77
+ /** Stop background sweepers; called on `onClose`. Idempotent. */
93
78
  dispose?: () => void;
94
79
  };
95
80
  }
96
- interface WorkflowRunLike {
81
+ export interface WorkflowRunLike {
97
82
  _id: string;
98
83
  workflowId: string;
99
84
  status: string;
@@ -107,43 +92,26 @@ interface WorkflowRunLike {
107
92
  stepLogs?: unknown[];
108
93
  createdAt?: Date;
109
94
  updatedAt?: Date;
110
- /**
111
- * Streamline >= 2.3.3 — pinned definition version (semver) the run
112
- * started under. Hosts surfacing a "stuck on old version" UI read this
113
- * to decide whether to nudge a migration. Optional for back-compat
114
- * with runs created before 2.3.3.
115
- */
95
+ /** Definition version (semver) the run started under. */
116
96
  definitionVersion?: string;
117
- /**
118
- * Streamline >= 2.3.3 — count of stale-recovery / sweeper transitions
119
- * applied to this run. Sweeper dead-letters once this hits
120
- * `RetentionOptions.maxStaleRecoveries`; UIs can highlight runs trending
121
- * toward dead-letter.
122
- */
97
+ /** Stale-recovery transitions so far; dead-lettered at `maxStaleRecoveries`. */
123
98
  recoveryAttempts?: number;
124
- /**
125
- * Streamline >= 2.7 — operator-supplied cancellation reason, set when
126
- * `cancel(runId, { reason })` was called. Absent on runs cancelled without
127
- * a reason or under older streamline. Surfaced so dashboards can show WHY.
128
- */
99
+ /** Reason passed to `cancel(runId, { reason })`, if any. */
129
100
  cancellationReason?: string;
130
101
  }
131
102
  /**
132
- * Streamline >= 2.3.3 dead-letter discriminator. The run.status stays
133
- * `'failed'`; the discrimination is `error.code`:
103
+ * Dead-letter discriminator: `run.status` stays `'failed'`; `error.code` says why:
134
104
  * - `'stale_heartbeat'` — sweeper terminated; transient crash signal.
135
105
  * - `'dead_lettered'` — exceeded `maxStaleRecoveries`; permanent.
136
106
  * - `'VERSION_MISMATCH'` — engine deployed a step graph the run can't
137
107
  * resume against; admin must rewind / migrate / cancel.
138
- *
139
- * Hosts switch on `error.code` for dashboards / alerting.
140
108
  */
141
- declare const STREAMLINE_FAILURE_CODES: {
109
+ export declare const STREAMLINE_FAILURE_CODES: {
142
110
  readonly STALE_HEARTBEAT: "stale_heartbeat";
143
111
  readonly DEAD_LETTERED: "dead_lettered";
144
112
  readonly VERSION_MISMATCH: "VERSION_MISMATCH";
145
113
  };
146
- interface StreamlinePluginOptions {
114
+ export interface StreamlinePluginOptions {
147
115
  /** Array of workflows created with createWorkflow() */
148
116
  workflows: WorkflowLike[];
149
117
  /** URL prefix for workflow endpoints (default: '/workflows') */
@@ -153,65 +121,35 @@ interface StreamlinePluginOptions {
153
121
  /** Connect workflow lifecycle events to Arc's event bus (default: true) */
154
122
  bridgeEvents?: boolean;
155
123
  /**
156
- * Bridge the workflow's internal event bus (step + workflow lifecycle +
157
- * engine telemetry) to Arc's event bus, topic-scoped as
158
- * `workflow.${workflowId}.${eventName}`.
159
- *
160
- * Covers the full streamline 2.3 event surface:
161
- * - Step events: started, completed, failed, waiting, skipped,
162
- * retry-scheduled, compensated
163
- * - Workflow lifecycle: started, completed, failed, waiting, resumed,
164
- * cancelled, recovered, retry, compensating, paused (>= 2.7)
165
- * - Engine telemetry: engine:error, scheduler:error,
166
- * scheduler:circuit-open
167
- *
168
- * Subscriptions use structural `container.eventBus.on(...)` — future
169
- * streamline releases can add events without breaking arc; missing
170
- * events are simply never handled (no crash). Requires the workflow
171
- * to expose `container.eventBus`.
172
- *
173
- * Disabled by default — enable for dashboards or monitoring.
124
+ * Bridge every {@link STREAMLINE_BUS_EVENTS} event (step, workflow
125
+ * lifecycle, engine telemetry) from `container.eventBus` to Arc's event bus
126
+ * as `workflow.${workflowId}.${eventName}`.
174
127
  * @default false
175
128
  */
176
129
  bridgeBusEvents?: boolean;
177
130
  /**
178
131
  * Enable SSE streaming endpoint: GET /:workflowId/runs/:runId/stream
179
132
  * Streams step-level + lifecycle events as Server-Sent Events for live
180
- * UI updates. Auto-closes the stream on terminal workflow events
181
- * (completed / failed / cancelled).
133
+ * UI updates. Auto-closes the stream when the run ends: completed /
134
+ * cancelled / compensated / compensation_failed, and failed only for a
135
+ * workflow with no compensation (a saga keeps streaming its rollback).
182
136
  * @default false
183
137
  */
184
138
  enableStreaming?: boolean;
185
139
  /**
186
- * Enable webhook resume endpoint: POST /hooks/:token
187
- *
188
- * Routes incoming webhook calls through streamline's `resumeHook(token,
189
- * body)` — which validates the token against the stored `hookToken` on
190
- * the waiting step (fail-closed since streamline 2.3). Hosts use this
191
- * for "wait for external approval / SaaS callback" patterns.
192
- *
193
- * Workflows MUST pass `{ hookToken: hook.token }` to `ctx.wait(...)` —
194
- * streamline 2.3 rejects resume otherwise (security). The endpoint is
195
- * registered at the plugin's `prefix` root, NOT scoped per workflow,
196
- * because the token encodes the runId.
197
- *
198
- * Auth is OPTIONAL on this route by design — the token IS the
199
- * authentication. If you also want to gate by user (e.g. only the
200
- * inviting user can approve), set `auth: true` and a permission check.
140
+ * Enable `POST /hooks/:token` (at the prefix root — the token encodes the
141
+ * runId), routed through streamline's `resumeHook(token, body)`, which
142
+ * validates against the waiting step's stored `hookToken` (fail-closed).
143
+ * Workflows MUST pass `{ hookToken: hook.token }` to `ctx.wait(...)`.
201
144
  *
145
+ * The token IS the authentication; `auth` adds a user gate on top.
202
146
  * @default false
203
147
  */
204
148
  enableHookEndpoint?: boolean;
205
149
  /**
206
- * Resolve the tenant id for a request — extract from auth context
207
- * (JWT claim, session, header), NOT from the request body. Returning
208
- * `undefined` skips tenant injection (use for non-multi-tenant routes
209
- * or admin paths that pass `bypassTenant` explicitly).
210
- *
211
- * When set, the resolved tenantId is forwarded to every streamline
212
- * call (`start`, `resume`, `cancel`, `get`, `list`, etc.) so
213
- * streamline's `multiTenant.strict` mode never throws "missing
214
- * tenantId" inside arc's request lifecycle.
150
+ * Resolve the request's tenant id from auth context — NEVER the request
151
+ * body. Forwarded to streamline calls, and enables the per-run tenant
152
+ * ownership check. `undefined` skips tenant scoping.
215
153
  *
216
154
  * @example
217
155
  * tenantResolver: (req) => req.user?.organizationId
@@ -224,63 +162,66 @@ interface StreamlinePluginOptions {
224
162
  * (`allowBypass: true`, the default).
225
163
  */
226
164
  bypassTenantResolver?: (request: FastifyRequest) => boolean;
227
- /** Custom permission check for workflow operations */
165
+ /**
166
+ * Custom permission check for workflow operations. `execute` falls back to
167
+ * `start`, and `pause` / `rewind` to `cancel`, when not set — so restricting
168
+ * the broader operation also covers these.
169
+ */
228
170
  permissions?: {
229
171
  start?: (request: unknown) => boolean | Promise<boolean>;
230
172
  resume?: (request: unknown) => boolean | Promise<boolean>;
231
173
  cancel?: (request: unknown) => boolean | Promise<boolean>;
232
174
  list?: (request: unknown) => boolean | Promise<boolean>;
233
175
  get?: (request: unknown) => boolean | Promise<boolean>;
176
+ execute?: (request: unknown) => boolean | Promise<boolean>;
177
+ pause?: (request: unknown) => boolean | Promise<boolean>;
178
+ rewind?: (request: unknown) => boolean | Promise<boolean>;
179
+ };
180
+ /**
181
+ * Operations whose call requires an idempotency key (400 `arc.idempotency_key_required`
182
+ * when absent; a keyed retry replays). `workflows` narrows it to those ids (default: all).
183
+ * On `start` the header key IS the run's `idempotencyKey`; a different body key is refused.
184
+ * Needs `idempotencyPlugin` enabled.
185
+ */
186
+ idempotency?: {
187
+ readonly required: readonly ("start" | "execute" | "resume" | "rewind")[];
188
+ readonly workflows?: readonly string[];
234
189
  };
235
190
  }
236
191
  /**
237
- * Full event list published on a streamline workflow's internal `eventBus`
238
- * (tracks streamline 2.3's `EventPayloadMap` in
239
- * `@classytic/streamline/src/core/events.ts`).
240
- *
241
- * Hardcoded here by design — arc subscribes via structural
242
- * `eventBus.on(name, handler)`, which is a no-op for events the running
243
- * streamline version doesn't emit. New events a future streamline release
244
- * adds can be bridged by updating this list; arc never breaks just
245
- * because streamline extended its bus.
192
+ * Events published on a streamline workflow's internal `eventBus`. Subscribing
193
+ * to one the running version doesn't emit is a no-op. Pinned against
194
+ * streamline's `ALL_WORKFLOW_EVENT_NAMES` by `tests/integrations/streamline-drift.test.ts`.
246
195
  */
247
- declare const STREAMLINE_BUS_EVENTS: readonly ["step:started", "step:completed", "step:failed", "step:waiting", "step:skipped", "step:retry-scheduled", "step:compensated", "workflow:started", "workflow:completed", "workflow:failed", "workflow:waiting", "workflow:resumed", "workflow:cancelled", "workflow:recovered", "workflow:retry", "workflow:compensating", "workflow:paused", "engine:error", "scheduler:error", "scheduler:circuit-open"];
196
+ export declare const STREAMLINE_BUS_EVENTS: readonly ["step:started", "step:completed", "step:failed", "step:waiting", "step:skipped", "step:retry-scheduled", "step:compensated", "workflow:started", "workflow:completed", "workflow:failed", "workflow:waiting", "workflow:resumed", "workflow:cancelled", "workflow:recovered", "workflow:retry", "workflow:compensating", "workflow:paused", "workflow:compensated", "workflow:compensation_failed", "engine:error", "scheduler:error", "scheduler:circuit-open"];
248
197
  /**
249
- * Non-durable streaming frames from streamline >= 2.6's `ctx.stream(frame)`
250
- * (LLM tokens, percent-complete, live previews).
251
- *
252
- * Delivered on the SSE endpoint ONLY — deliberately excluded from
253
- * `STREAMLINE_BUS_EVENTS` / `bridgeBusEvents` because frames are
254
- * high-frequency, at-most-once UI traffic, not domain events: republishing
255
- * every token onto arc's Redis/Kafka transport would flood it. Subscribers
256
- * that genuinely want frames on the transport can bridge
257
- * `streamline:step.stream` from streamline's own arc-shape transport.
198
+ * Non-durable `ctx.stream(frame)` frames (LLM tokens, progress). SSE ONLY —
199
+ * excluded from `bridgeBusEvents` because high-frequency at-most-once UI
200
+ * traffic would flood arc's event transport.
201
+ */
202
+ export declare const STREAMLINE_STREAM_EVENTS: readonly ["step:stream"];
203
+ /**
204
+ * Workflow events that end a run and auto-close an SSE stream.
258
205
  *
259
- * On streamline < 2.6 the subscription is a structural no-op (the bus never
260
- * emits the event) — no version gate needed.
206
+ * `workflow:failed` is terminal ONLY without compensation handlers: a saga
207
+ * emits `failed` THEN rolls back, so closing there would hide the rollback.
208
+ * See {@link isStreamTerminal}.
261
209
  */
262
- declare const STREAMLINE_STREAM_EVENTS: readonly ["step:stream"];
210
+ export declare const STREAMLINE_TERMINAL_EVENTS: readonly ["workflow:completed", "workflow:failed", "workflow:cancelled", "workflow:compensated", "workflow:compensation_failed"];
263
211
  /**
264
- * Workflow events that should auto-close an SSE stream when observed.
265
- * Recovered / waiting / resumed / retry / compensating are NOT terminal —
266
- * the run is still active after them.
212
+ * Terminal run STATUSES (vs. the event names above). A run in one emits no
213
+ * further events, so SSE sends its snapshot and closes. Pinned against
214
+ * streamline's own list by `tests/integrations/streamline-drift.test.ts`.
267
215
  */
268
- declare const STREAMLINE_TERMINAL_EVENTS: readonly ["workflow:completed", "workflow:failed", "workflow:cancelled"];
216
+ export declare const TERMINAL_RUN_STATUSES: Set<string>;
269
217
  /**
270
- * Terminal run STATUSES (distinct from the terminal EVENT names above).
271
- * Mirrors streamline's `isTerminalState()` — a run in one of these will
272
- * emit no further bus events, so the SSE handler sends its snapshot and
273
- * closes immediately rather than holding a connection open on a dead run.
218
+ * Whether a run has ended, for the purpose of closing its stream — by event
219
+ * name or by status. `failed` ends a run only when nothing will compensate it.
274
220
  */
275
- declare const TERMINAL_RUN_STATUSES: Set<string>;
221
+ export declare function isStreamTerminal(eventOrStatus: string, compensates: boolean, kind: "event" | "status"): boolean;
276
222
  /**
277
- * Pluggable streamline integration for Arc.
278
- *
279
- * Wrapped in `fastify-plugin` so Fastify treats `options.prefix` as a
280
- * plain plugin option (NOT an encapsulation prefix). Without the wrapper,
281
- * Fastify would prepend `options.prefix` to every route, then the plugin
282
- * code would prepend it again — the duplicate-prefix bug.
223
+ * Streamline integration for Arc. Wrapped in `fastify-plugin` so `prefix` is
224
+ * a plain option, not an encapsulation prefix (which would apply it twice).
283
225
  */
284
- declare const streamlinePlugin: FastifyPluginAsync<StreamlinePluginOptions>;
285
- //#endregion
286
- export { STREAMLINE_BUS_EVENTS, STREAMLINE_FAILURE_CODES, STREAMLINE_STREAM_EVENTS, STREAMLINE_TERMINAL_EVENTS, StreamlinePluginOptions, TERMINAL_RUN_STATUSES, WorkflowLike, WorkflowRunLike, WorkflowStartOptions, streamlinePlugin };
226
+ export declare const streamlinePlugin: FastifyPluginAsync<StreamlinePluginOptions>;
227
+ //#endregion