@classytic/arc 2.45.2 → 2.46.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 (321) hide show
  1. package/README.md +1 -1
  2. package/dist/{EventTransport-CiicKz2Z.d.mts → EventTransport-CYEoCJGe.d.mts} +0 -2
  3. package/dist/{EventTransport-DHb1tpu-.mjs → EventTransport-DNgD9NP4.mjs} +3 -4
  4. package/dist/{HookSystem-C1u0EUnt.mjs → HookSystem-DRbPzEcP.mjs} +3 -4
  5. package/dist/{QueryCache--5uAuYPW.d.mts → QueryCache-DdvrGG8Q.d.mts} +1 -3
  6. package/dist/{ResourceRegistry-D2jXWVN_.mjs → ResourceRegistry-Douk51fa.mjs} +15 -4
  7. package/dist/{acquire-DTkA8Lme.mjs → acquire-RbtvDg9s.mjs} +2 -3
  8. package/dist/{actionPermissions-DRVk6m7x.mjs → actionPermissions-De0AJ7hm.mjs} +37 -42
  9. package/dist/audit/index.d.mts +2 -10
  10. package/dist/audit/index.mjs +8 -12
  11. package/dist/auth/audit.d.mts +0 -2
  12. package/dist/auth/audit.mjs +2 -3
  13. package/dist/auth/index.d.mts +9 -17
  14. package/dist/auth/index.mjs +26 -29
  15. package/dist/auth/redis-session.d.mts +2 -4
  16. package/dist/auth/redis-session.mjs +2 -3
  17. package/dist/{authorizationDecision-D48fUJv1.mjs → authorizationDecision-DeZMrHcm.mjs} +5 -6
  18. package/dist/{base-CZyixEQR.d.mts → base-HXNgPQww.d.mts} +1 -7
  19. package/dist/{boundedMap-DkKiPifd.mjs → boundedMap-2WBh3gM9.mjs} +2 -3
  20. package/dist/{buildHandler-BiZ4VATS.mjs → buildHandler-DxVOOBpw.mjs} +5 -6
  21. package/dist/cache/index.d.mts +4 -10
  22. package/dist/cache/index.mjs +5 -6
  23. package/dist/{caching-Cj0as-P1.mjs → caching-BYRwYrUo.mjs} +3 -4
  24. package/dist/{claimed-ChI13rUR.mjs → claimed-DYlELdnm.mjs} +2 -3
  25. package/dist/cleanup/index.d.mts +4 -18
  26. package/dist/cleanup/index.mjs +12 -20
  27. package/dist/cli/commands/describe.d.mts +1 -3
  28. package/dist/cli/commands/describe.mjs +4 -5
  29. package/dist/cli/commands/docs.d.mts +1 -3
  30. package/dist/cli/commands/docs.mjs +4 -5
  31. package/dist/cli/commands/doctor.d.mts +1 -3
  32. package/dist/cli/commands/doctor.mjs +2 -3
  33. package/dist/cli/commands/generate.d.mts +1 -1
  34. package/dist/cli/commands/generate.mjs +2 -2
  35. package/dist/cli/commands/init.d.mts +1 -1
  36. package/dist/cli/commands/init.mjs +2 -2
  37. package/dist/cli/commands/introspect.d.mts +1 -3
  38. package/dist/cli/commands/introspect.mjs +3 -4
  39. package/dist/cli/index.d.mts +2 -2
  40. package/dist/cli/index.mjs +3 -3
  41. package/dist/{constants-D_aiew34.mjs → constants-CHZMUwBW.mjs} +2 -3
  42. package/dist/context/index.d.mts +0 -8
  43. package/dist/context/index.mjs +6 -7
  44. package/dist/core/index.d.mts +3 -3
  45. package/dist/core/index.mjs +8 -8
  46. package/dist/{core-QIZ2560Y.mjs → core-D9rS2BxO.mjs} +9 -12
  47. package/dist/{createActionRouter-CvH84dyx.mjs → createActionRouter-0qkCRzTL.mjs} +7 -8
  48. package/dist/{createAggregationRouter-DGyK2Hp6.mjs → createAggregationRouter-CUf5Esd9.mjs} +9 -10
  49. package/dist/{createApp-CKjZpmq9.mjs → createApp-DZIXfDKD.mjs} +49 -62
  50. package/dist/{createMcpServer-DSztofa9.d.mts → createMcpServer-DeVpqQF-.d.mts} +1 -3
  51. package/dist/{defineAggregation-BLza7Ca4.mjs → defineAggregation-bmKQ4NmC.mjs} +2 -3
  52. package/dist/{defineResource-CEo0gDCb.mjs → defineResource-CGmdmGwh.mjs} +78 -29
  53. package/dist/discovery/index.d.mts +1 -3
  54. package/dist/discovery/index.mjs +2 -3
  55. package/dist/docs/index.d.mts +8 -8
  56. package/dist/docs/index.mjs +4 -5
  57. package/dist/{elevation-BJTsSnke.mjs → elevation-CzhqAyVN.mjs} +9 -10
  58. package/dist/{elevation-BW2J3tNj.d.mts → elevation-DPD0hcU-.d.mts} +0 -2
  59. package/dist/encryption/index.d.mts +1 -7
  60. package/dist/encryption/index.mjs +8 -13
  61. package/dist/{errorHandler--4rSMMvq.d.mts → errorHandler-B9r88jZV.d.mts} +8 -3
  62. package/dist/{errorHandler-2p4SL5zm.mjs → errorHandler-dFyGOEoB.mjs} +16 -6
  63. package/dist/{errors-grZkIA8N.mjs → errors-BY8vzlP4.mjs} +2 -3
  64. package/dist/{errors-JYc9vwqE.d.mts → errors-DTo0me1o.d.mts} +0 -2
  65. package/dist/{eventPlugin-BtmA4-3P.d.mts → eventPlugin-BY38F6yK.d.mts} +1 -7
  66. package/dist/{eventPlugin-ItcYBGUs.mjs → eventPlugin-eMhAPtQA.mjs} +10 -12
  67. package/dist/{eventTypes-Ck6fD3ne.mjs → eventTypes-Do2KYeJx.mjs} +5 -8
  68. package/dist/events/index.d.mts +4 -16
  69. package/dist/events/index.mjs +8 -9
  70. package/dist/events/transports/redis-stream-entry.d.mts +1 -1
  71. package/dist/events/transports/redis-stream-entry.mjs +5 -6
  72. package/dist/events/transports/redis.d.mts +2 -4
  73. package/dist/events/transports/redis.mjs +3 -4
  74. package/dist/{externalPaths-CmGOxOtD.d.mts → externalPaths-BOqdq5wr.d.mts} +0 -2
  75. package/dist/factory/index.d.mts +4 -14
  76. package/dist/factory/index.mjs +12 -18
  77. package/dist/{fastify-augmentation-DRlCIWE9.d.mts → fastify-augmentation-Dtn0IIRn.d.mts} +4 -10
  78. package/dist/{fields-BBSpf8pS.d.mts → fields-JTkrtO-r.d.mts} +0 -2
  79. package/dist/{fields-BRX0Krcj.mjs → fields-LnbCcvsw.mjs} +2 -3
  80. package/dist/{filter-merge-CDc7YMwX.mjs → filter-merge-BAWi019Q.mjs} +2 -3
  81. package/dist/{generate-DCGuEbqI.d.mts → generate-C-g_KOkV.d.mts} +0 -4
  82. package/dist/{generate-hvg7V2g1.mjs → generate-oXoDnpJf.mjs} +7 -12
  83. package/dist/{headers-Cqkg4LzI.mjs → headers-DBd3Qheo.mjs} +3 -4
  84. package/dist/{health-PVt0VjOx.mjs → health-BlJu9GXS.mjs} +2 -3
  85. package/dist/{health-DyeP3mTW.mjs → health-Dp-3EC9o.mjs} +4 -7
  86. package/dist/hooks/index.d.mts +1 -1
  87. package/dist/hooks/index.mjs +2 -2
  88. package/dist/idempotency/index.d.mts +3 -9
  89. package/dist/idempotency/index.mjs +10 -13
  90. package/dist/idempotency/redis.d.mts +1 -1
  91. package/dist/idempotency/redis.mjs +3 -4
  92. package/dist/{index-Bxriq3so.d.mts → index-B5i9-vuP.d.mts} +4 -26
  93. package/dist/{index-Chgz3d0i.d.mts → index-BAXDo5eE.d.mts} +1 -7
  94. package/dist/{index-Beg3aNnK.d.mts → index-BTxzJ_MN.d.mts} +67 -25
  95. package/dist/{index-CUJvoyw3.d.mts → index-Bqfo8hLz.d.mts} +2 -24
  96. package/dist/{index-uhkUA5-U.d.mts → index-CUdaoCYt.d.mts} +13 -23
  97. package/dist/{index-WH7xgvxS.d.mts → index-DyJFTJLA.d.mts} +31 -92
  98. package/dist/index.d.mts +7 -9
  99. package/dist/index.mjs +12 -13
  100. package/dist/{init-jC3rMPzb.mjs → init-BOaNkLYb.mjs} +18 -35
  101. package/dist/{init-Cscs4lab.d.mts → init-CV2_Fw3H.d.mts} +0 -4
  102. package/dist/integrations/event-gateway.d.mts +3 -5
  103. package/dist/integrations/event-gateway.mjs +3 -4
  104. package/dist/integrations/index.d.mts +3 -3
  105. package/dist/integrations/index.mjs +1 -1
  106. package/dist/integrations/jobs/index.d.mts +1 -1
  107. package/dist/integrations/jobs/index.mjs +7 -11
  108. package/dist/integrations/mcp/index.d.mts +7 -39
  109. package/dist/integrations/mcp/index.mjs +8 -14
  110. package/dist/integrations/mcp/testing.d.mts +3 -5
  111. package/dist/integrations/mcp/testing.mjs +3 -4
  112. package/dist/integrations/streamline.d.mts +1 -3
  113. package/dist/integrations/streamline.mjs +4 -5
  114. package/dist/integrations/webhooks.d.mts +2 -4
  115. package/dist/integrations/webhooks.mjs +4 -5
  116. package/dist/integrations/websocket-pushref-redis.d.mts +2 -4
  117. package/dist/integrations/websocket-pushref-redis.mjs +2 -3
  118. package/dist/integrations/websocket-redis.d.mts +2 -4
  119. package/dist/integrations/websocket-redis.mjs +2 -3
  120. package/dist/integrations/websocket.d.mts +2 -2
  121. package/dist/integrations/websocket.mjs +13 -24
  122. package/dist/{interface-JJzwH4Ro.d.mts → interface-BmExzQRD.d.mts} +0 -2
  123. package/dist/{interface-BOk3YnTz.d.mts → interface-WR1U0K7t.d.mts} +0 -2
  124. package/dist/{jsonBody-ptwyzZQ-.mjs → jsonBody-DpRpKR_K.mjs} +3 -4
  125. package/dist/{keys-C1vFuSbv.mjs → keys-FBz6Ull-.mjs} +2 -3
  126. package/dist/{loadResources-CHPDyIPn.mjs → loadResources-Bx1sKPnF.mjs} +4 -5
  127. package/dist/{loadResourcesFromEntry-BkHHTu_B.mjs → loadResourcesFromEntry-b_jcqbxh.mjs} +3 -4
  128. package/dist/logger/index.d.mts +1 -3
  129. package/dist/logger/index.mjs +2 -2
  130. package/dist/{logger-C5bvCiAK.mjs → logger-CbFcIEBZ.mjs} +3 -5
  131. package/dist/{mcpPlugin-C9qohJCF.mjs → mcpPlugin-yix548XX.mjs} +41 -60
  132. package/dist/{memory-CxiTwT0j.mjs → memory-Bgw5dn8N.mjs} +4 -5
  133. package/dist/{metrics-Ckp2zRy-.mjs → metrics-CZDQWVjS.mjs} +4 -5
  134. package/dist/middleware/index.d.mts +1 -5
  135. package/dist/middleware/index.mjs +4 -5
  136. package/dist/migrations/index.d.mts +0 -2
  137. package/dist/migrations/index.mjs +3 -4
  138. package/dist/{module-CfnKuIuH.mjs → module-Dsc_nKL5.mjs} +2 -3
  139. package/dist/{multiTenant-CAtYlW6H.d.mts → multiTenant-XCxAUlru.d.mts} +1 -5
  140. package/dist/{multipartBody-BFasGtP9.mjs → multipartBody-B85ek8Kj.mjs} +2 -3
  141. package/dist/observeSend-BK-JN1jK.mjs +20 -0
  142. package/dist/{openapi-DAPxjYHX.mjs → openapi-Co7hl073.mjs} +18 -28
  143. package/dist/outbox-admin/index.d.mts +2 -4
  144. package/dist/outbox-admin/index.mjs +6 -7
  145. package/dist/{outbox-module-gZCHoE4H.d.mts → outbox-module-XvUThpqn.d.mts} +2 -8
  146. package/dist/{outbox-module-B4FAkx3A.mjs → outbox-module-mg9kDYkd.mjs} +13 -17
  147. package/dist/permissions/index.d.mts +4 -4
  148. package/dist/permissions/index.mjs +7 -7
  149. package/dist/{permissions-B14c3OMp.mjs → permissions-A1oKtpiC.mjs} +19 -29
  150. package/dist/{pipe-CQv7PsAK.mjs → pipe-Czpw9U2n.mjs} +3 -4
  151. package/dist/pipeline/index.d.mts +1 -9
  152. package/dist/pipeline/index.mjs +5 -8
  153. package/dist/{plan-CpnTykjb.mjs → plan-KVseuBCL.mjs} +5 -9
  154. package/dist/{plugin-DXTjVg_Q.mjs → plugin-DTWt_8C3.mjs} +130 -62
  155. package/dist/plugins/index.d.mts +8 -16
  156. package/dist/plugins/index.mjs +22 -26
  157. package/dist/plugins/response-cache.d.mts +2 -4
  158. package/dist/plugins/response-cache.mjs +10 -10
  159. package/dist/plugins/tracing-entry.d.mts +1 -1
  160. package/dist/plugins/tracing-entry.mjs +3 -4
  161. package/dist/{pluralize-C3VJKRGp.mjs → pluralize-msB9X3yw.mjs} +2 -3
  162. package/dist/presets/filesUpload.d.mts +4 -6
  163. package/dist/presets/filesUpload.mjs +6 -7
  164. package/dist/presets/index.d.mts +3 -19
  165. package/dist/presets/index.mjs +2 -2
  166. package/dist/presets/multiTenant.d.mts +1 -1
  167. package/dist/presets/multiTenant.mjs +7 -7
  168. package/dist/presets/search.d.mts +3 -5
  169. package/dist/presets/search.mjs +3 -4
  170. package/dist/{presets-CquqYJPy.mjs → presets-qKCehiJM.mjs} +11 -18
  171. package/dist/{projection-CgfSLOSM.mjs → projection-ClBqtsIw.mjs} +3 -4
  172. package/dist/{pushref-registry-UxCkoA4C.d.mts → pushref-registry-d86QUaSq.d.mts} +0 -6
  173. package/dist/{queryCachePlugin-D0HUISHJ.mjs → queryCachePlugin-3gJj5Rbz.mjs} +8 -10
  174. package/dist/{queryCachePlugin-C2lZjTxk.d.mts → queryCachePlugin-DYQUyeJ9.d.mts} +2 -4
  175. package/dist/{rateLimitKey-AvkBOMkl.mjs → rateLimitKey-Kro---xl.mjs} +2 -3
  176. package/dist/{realtime-CbWtVbqK.mjs → realtime-Ber8uJN2.mjs} +17 -19
  177. package/dist/{redis-BDgv9Glw.d.mts → redis-RpDMemdm.d.mts} +2 -4
  178. package/dist/{redis-stream-BMk-bpQS.d.mts → redis-stream-CS1N9dwM.d.mts} +1 -3
  179. package/dist/{redisShapes-CQksY67q.d.mts → redisShapes-CqBXTn_s.d.mts} +0 -2
  180. package/dist/registry/index.d.mts +2 -12
  181. package/dist/registry/index.mjs +3 -3
  182. package/dist/{registry-BVwpAuFI.mjs → registry-BA-_vFYk.mjs} +7 -12
  183. package/dist/{renewingLease-CykpeNcQ.mjs → renewingLease-CMY8YOcc.mjs} +2 -3
  184. package/dist/{replyHelpers-DA51IZio.mjs → replyHelpers-DK9P_XSz.mjs} +3 -4
  185. package/dist/{requestContext-DIWHKDtQ.mjs → requestContext-GYO_0gEw.mjs} +2 -3
  186. package/dist/{requirement-CbiLdQ1n.d.mts → requirement-CTRQjjQx.d.mts} +0 -2
  187. package/dist/{requirement-Cp_fsMDL.mjs → requirement-DeNjZIH3.mjs} +2 -3
  188. package/dist/{resourceRateLimit-Wf6d6FL9.d.mts → resourceRateLimit-DCWglD7V.d.mts} +1 -3
  189. package/dist/{resourceRateLimit-BFuluodF.mjs → resourceRateLimit-tHLbrtWc.mjs} +3 -4
  190. package/dist/{rolldown-runtime-D_lMdYOd.mjs → rolldown-runtime-Kv1fZdLg.mjs} +2 -3
  191. package/dist/{routeValidator-DuLonYwr.mjs → routeValidator-C_H5NanI.mjs} +2 -3
  192. package/dist/{runtimeCapabilities-CydRfm0i.mjs → runtimeCapabilities-DWqbxkyw.mjs} +2 -3
  193. package/dist/{schedules-B693KXxa.mjs → schedules-eO_RzhCU.mjs} +132 -9
  194. package/dist/{schemaConverter-DNvZWTV6.mjs → schemaConverter-DBJrPZN4.mjs} +3 -4
  195. package/dist/{schemaIR-REV2y7Wd.mjs → schemaIR-CEScKT2v.mjs} +3 -4
  196. package/dist/schemas/index.d.mts +0 -2
  197. package/dist/schemas/index.mjs +2 -3
  198. package/dist/scim/index.d.mts +0 -12
  199. package/dist/scim/index.mjs +10 -18
  200. package/dist/scope/index.d.mts +2 -6
  201. package/dist/scope/index.mjs +5 -5
  202. package/dist/{scope-Bevxy_ST.mjs → scope-B-Sm9m_E.mjs} +5 -6
  203. package/dist/{sessionManager-qimlKV0P.d.mts → sessionManager-CdvDF04x.d.mts} +2 -4
  204. package/dist/{shutdown-CfrqPR7A.mjs → shutdown-DzLFbe27.mjs} +2 -3
  205. package/dist/{simpleEqualityMatcher-BJwfuRKP.mjs → simpleEqualityMatcher-DOJhwQ8g.mjs} +2 -3
  206. package/dist/{sse-CuNNWr2z.mjs → sse-2972pVwV.mjs} +8 -9
  207. package/dist/{sseStream-C_2ujAVY.mjs → sseStream-AWLEeNV-.mjs} +3 -4
  208. package/dist/{storage-Cx9Sz3Ou.d.mts → storage-odC5MNKN.d.mts} +0 -2
  209. package/dist/{store-helpers-C8uBGCbb.mjs → store-helpers-VzjgVTkM.mjs} +2 -3
  210. package/dist/{streaming-Bdq_M4d5.mjs → streaming-DvraWW6x.mjs} +2 -3
  211. package/dist/{subscriberIdentity-B-KpZkdl.mjs → subscriberIdentity-Bya56jsg.mjs} +2 -3
  212. package/dist/{tenancy-C5PCvm1h.mjs → tenancy-DSa_0hhw.mjs} +3 -4
  213. package/dist/{tenantPreparation-dYvWrgNa.mjs → tenantPreparation-BrpkQre3.mjs} +5 -6
  214. package/dist/testing/cleanupStoreContract.d.mts +2 -4
  215. package/dist/testing/cleanupStoreContract.mjs +2 -3
  216. package/dist/testing/index.d.mts +6 -32
  217. package/dist/testing/index.mjs +24 -37
  218. package/dist/testing/outboxStoreContract.d.mts +1 -3
  219. package/dist/testing/outboxStoreContract.mjs +3 -4
  220. package/dist/testing/requiredPorts.d.mts +2 -4
  221. package/dist/testing/requiredPorts.mjs +3 -4
  222. package/dist/testing/storageContract.d.mts +2 -4
  223. package/dist/testing/storageContract.mjs +2 -3
  224. package/dist/{timing-DCqsezX8.mjs → timing-6rQTuCwg.mjs} +3 -5
  225. package/dist/{tracing-Dro5eH6j.d.mts → tracing-JSFiBl5r.d.mts} +0 -2
  226. package/dist/{transactionContext-DrcNyjpv.mjs → transactionContext-DaxYUEgH.mjs} +2 -3
  227. package/dist/{typeGuards-CEl10KPy.mjs → typeGuards-UKnX8wPX.mjs} +2 -3
  228. package/dist/types/index.d.mts +4 -4
  229. package/dist/types/index.mjs +1 -1
  230. package/dist/types/storage.d.mts +1 -1
  231. package/dist/types/storage.mjs +1 -1
  232. package/dist/{types-ByHn9rEO.d.mts → types-0Dqlbgn8.d.mts} +0 -2
  233. package/dist/{types-D3Ixsh00.d.mts → types-BYEb_dLW.d.mts} +2 -4
  234. package/dist/{types-BJ-2XqVF.d.mts → types-BeEJm-DV.d.mts} +114 -14
  235. package/dist/{types-DVLddu2q.d.mts → types-C0YJAiL0.d.mts} +0 -2
  236. package/dist/{types-D9NWjpYc.mjs → types-CuGjhn83.mjs} +5 -6
  237. package/dist/{types-Ddl9OjmE.d.mts → types-DnkIALZ8.d.mts} +0 -4
  238. package/dist/usage/index.d.mts +2 -10
  239. package/dist/usage/index.mjs +8 -12
  240. package/dist/{userHelpers-BHig1kHq.mjs → userHelpers-oX5_mOVs.mjs} +2 -3
  241. package/dist/utils/index.d.mts +5 -39
  242. package/dist/utils/index.mjs +12 -12
  243. package/dist/{utils-BG5P7_Vb.mjs → utils-CjjGOT4E.mjs} +20 -30
  244. package/dist/{validate-D_mdOCir.mjs → validate-4RlTKOJb.mjs} +5 -7
  245. package/dist/{versioning-DBGHjPh7.mjs → versioning-Dk2-19La.mjs} +4 -5
  246. package/dist/{versioning-Bqm_57Qt.d.mts → versioning-S18y2-0C.d.mts} +1 -15
  247. package/dist/{websocket-Cs4awVyD.d.mts → websocket-BGuc-WVZ.d.mts} +1 -15
  248. package/dist/{workScope-DPPfM4m6.mjs → workScope-DoBsoVo4.mjs} +3 -4
  249. package/llms.txt +37 -30
  250. package/package.json +9 -8
  251. package/skills/arc/SKILL.md +65 -844
  252. package/skills/arc/references/agent-auth.md +82 -193
  253. package/skills/arc/references/api-reference.md +41 -245
  254. package/skills/arc/references/auth-api-keys.md +99 -0
  255. package/skills/arc/references/auth-better-auth-overlay.md +87 -0
  256. package/skills/arc/references/auth-better-auth.md +78 -0
  257. package/skills/arc/references/auth-permissions.md +100 -0
  258. package/skills/arc/references/auth-strategies.md +122 -0
  259. package/skills/arc/references/boot.md +80 -0
  260. package/skills/arc/references/enterprise-auth.md +65 -81
  261. package/skills/arc/references/events-outbox.md +90 -0
  262. package/skills/arc/references/events.md +75 -440
  263. package/skills/arc/references/integrations-jobs.md +74 -0
  264. package/skills/arc/references/integrations-realtime.md +84 -0
  265. package/skills/arc/references/integrations-webhooks.md +71 -0
  266. package/skills/arc/references/integrations-workflows.md +47 -0
  267. package/skills/arc/references/mcp-auth.md +83 -0
  268. package/skills/arc/references/mcp-custom-tools.md +125 -0
  269. package/skills/arc/references/mcp-setup.md +115 -0
  270. package/skills/arc/references/mcp-testing.md +63 -0
  271. package/skills/arc/references/multi-tenancy.md +56 -230
  272. package/skills/arc/references/permissions-scope.md +81 -0
  273. package/skills/arc/references/production-api.md +119 -0
  274. package/skills/arc/references/production-audit.md +101 -0
  275. package/skills/arc/references/production-boot.md +91 -0
  276. package/skills/arc/references/production-caching.md +63 -0
  277. package/skills/arc/references/production-distributed.md +75 -0
  278. package/skills/arc/references/production-idempotency.md +83 -0
  279. package/skills/arc/references/production-observability.md +83 -0
  280. package/skills/arc/references/production-realtime.md +70 -0
  281. package/skills/arc/references/production-reliability.md +100 -0
  282. package/skills/arc/references/production-shutdown.md +43 -0
  283. package/skills/arc/references/querying.md +76 -0
  284. package/skills/arc/references/resources.md +97 -0
  285. package/skills/arc/references/schedules.md +79 -0
  286. package/skills/arc/references/scim.md +61 -208
  287. package/skills/arc/references/tenancy-scope-install.md +82 -0
  288. package/skills/arc/references/testing.md +101 -144
  289. package/skills/arc/references/usage-cleanup-capabilities.md +45 -0
  290. package/skills/arc/references/validation.md +91 -0
  291. package/skills/arc/references/writes-hooks-errors.md +80 -0
  292. package/skills/arc-code-review/SKILL.md +67 -114
  293. package/skills/arc-code-review/references/arc-cheatsheet.md +68 -167
  294. package/skills/arc-code-review/references/mongokit-repositories.md +104 -0
  295. package/skills/arc-code-review/references/recipe-events-cache-jobs.md +112 -0
  296. package/skills/arc-code-review/references/recipe-resource.md +100 -0
  297. package/skills/arc-code-review/references/recipe-schemas-fields.md +93 -0
  298. package/skills/arc-code-review/references/recipe-scope-permissions.md +82 -0
  299. package/skills/arc-code-review/references/scaffolding.md +61 -198
  300. package/skills/arc-code-review/references/severity.md +49 -102
  301. package/skills/arc-code-review/references/smells-auth-scope.md +80 -0
  302. package/skills/arc-code-review/references/smells-data-events.md +66 -0
  303. package/skills/arc-code-review/references/smells-imports-style.md +59 -0
  304. package/skills/arc-code-review/references/smells-platform.md +89 -0
  305. package/skills/arc-code-review/references/smells-routes-schemas.md +66 -0
  306. package/skills/arc-module-publishing/SKILL.md +82 -208
  307. package/skills/arc-module-publishing/references/action-presets-and-plugins.md +87 -0
  308. package/skills/arc-module-publishing/references/build-and-types.md +73 -0
  309. package/skills/arc-module-publishing/references/module-lifecycle.md +101 -0
  310. package/skills/arc-module-publishing/references/package-manifest.md +34 -122
  311. package/skills/arc-module-publishing/references/publishing-workflow.md +44 -140
  312. package/skills/arc-module-publishing/references/resource-assembly.md +102 -0
  313. package/skills/arc-module-publishing/references/testing-packages.md +82 -0
  314. package/skills/arc/references/auth.md +0 -729
  315. package/skills/arc/references/integrations.md +0 -452
  316. package/skills/arc/references/mcp.md +0 -691
  317. package/skills/arc/references/production.md +0 -835
  318. package/skills/arc-code-review/references/anti-patterns.md +0 -1008
  319. package/skills/arc-code-review/references/migration-recipes.md +0 -649
  320. package/skills/arc-code-review/references/mongokit-migration.md +0 -360
  321. package/skills/arc-module-publishing/references/authoring-modules.md +0 -327
@@ -1,238 +1,127 @@
1
- # Agent Auth — DPoP + Capability Mandates
1
+ # Agent auth: DPoP and capability mandates
2
2
 
3
- The 2025 stack for AI-agent-led actions on protected resources: **OAuth 2.1** (RFC 9700), **DPoP** (RFC 9449), **OAuth Protected Resource Metadata** (RFC 9728), **AP2** (Google + Anthropic + Stripe Agent Payments Protocol), **Stripe x402 / Agentic Commerce**, **MCP authorization**.
3
+ Gate AI-agent and machine actions on a verified mandate and sender-bound credential (AP2, x402, MCP authorization, RFC 9449, RFC 9728). Arc does NOT parse JWTs or verify DPoP proofs: your `authenticate` verifies, populates scope, and arc checks the verified claims against the action.
4
4
 
5
- Arc 2.13 adds three permission helpers and two scope fields to model these patterns cleanly. **Arc doesn't parse JWTs or verify DPoP proofs** — that's a 1-2 line `jose` call in your authenticate function. Arc validates *what's already proved* against the action being attempted.
6
-
7
- ## The two new scope fields
8
-
9
- `RequestScope.service` gains two optional fields (additive, no breaking change):
5
+ ## Scope fields (service kind)
10
6
 
11
7
  ```typescript
12
8
  {
13
- kind: 'service',
14
- clientId,
15
- organizationId,
16
- scopes,
17
- // ── new in 2.13 ──
18
- mandate?: Mandate, // capability mandate (AP2 / x402 / MCP)
19
- dpopJkt?: string, // DPoP key thumbprint (RFC 7638)
20
- // existing fields preserved
9
+ kind: 'service', clientId, organizationId, scopes,
10
+ mandate?: Mandate, // capability mandate
11
+ dpopJkt?: string, // DPoP key thumbprint (RFC 7638)
21
12
  }
22
- ```
23
-
24
- The `Mandate` type:
25
13
 
26
- ```typescript
27
14
  interface Mandate {
28
- id: string; // jti
29
- capability: string; // 'payment.charge' / 'data.export' / 'inbox.send'
30
- cap?: number; // numeric ceiling
31
- currency?: string; // ISO 4217 when monetary
32
- expiresAt?: number; // epoch ms
33
- parent?: string; // delegation chain
34
- audience?: string; // 'invoice:INV-7' — resource binding
35
- meta?: Record<string, unknown>; // verifier-supplied extras
15
+ id: string; // jti
16
+ capability: string; // 'payment.charge', 'data.export', 'inbox.send'
17
+ cap?: number; // numeric ceiling (meaning per capability)
18
+ currency?: string; // ISO 4217 when monetary
19
+ expiresAt?: number; // epoch ms
20
+ parent?: string; // delegation chain
21
+ audience?: string; // resource binding, e.g. 'invoice:INV-7'
22
+ meta?: Record<string, unknown>; // verifier extras
36
23
  }
37
24
  ```
38
25
 
39
- Read with `getMandate(scope)` / `getDPoPJkt(scope)` from `@classytic/arc/scope`.
40
-
41
- ## Permission helpers
42
-
43
- Three new combinators in `@classytic/arc/permissions`:
44
-
45
- ### `requireDPoP()` — sender-constrained credentials
26
+ Read with `getMandate(scope)`, `getDPoPJkt(scope)` from `@classytic/arc/scope`.
46
27
 
47
- The inbound credential must be DPoP-bound. Arc reads `scope.dpopJkt`; your authenticate function performs `jose.dpop.verify()` and sets the field.
28
+ ## Permission helpers (`@classytic/arc/permissions`)
48
29
 
49
- ```typescript
50
- import { requireDPoP } from "@classytic/arc/permissions";
51
-
52
- permissions: {
53
- charge: allOf(requireServiceScope("payment.write"), requireDPoP()),
54
- }
55
- ```
30
+ | Helper | Passes when |
31
+ |---|---|
32
+ | `requireDPoP()` | Service scope with `dpopJkt`, or elevated |
33
+ | `requireMandate(capability, opts?)` | Mandate capability matches, not expired, audience bound, `validateAmount` ok |
34
+ | `requireAgentScope(opts)` | Service identity + OAuth scope + mandate + DPoP, in one call |
56
35
 
57
- Pass behavior: service scope with `dpopJkt` set → grant. Elevated → grant. Anything else → deny.
36
+ `requireMandate` options:
58
37
 
59
- ### `requireMandate(capability, opts?)` — capability-scoped authorization
38
+ | Option | Meaning |
39
+ |---|---|
40
+ | `audience` | String or `(ctx) => string`; mandate must carry the same `audience` (a missing audience is denied) |
41
+ | `validateAmount(ctx, mandate)` | Return `true` or a denial string |
42
+ | `ttlGraceMs` | Clock-skew grace after `expiresAt` (default 30000) |
43
+ | `noElevatedBypass` | `true` makes elevated admins present a mandate too (break-glass flows) |
60
44
 
61
- The presented mandate must:
62
- 1. Authorize the requested `capability`
63
- 2. Not be expired (with optional grace window)
64
- 3. Be bound to the right resource (when `audience` opt is set)
65
- 4. Pass `validateAmount(ctx, mandate)` (when set)
45
+ `requireAgentScope` takes the `requireMandate` options plus `capability` (required), `scopes` (the service must hold ANY listed), `requireDPoP` (default true). Prefer it over hand-composing `allOf(requireServiceScope, requireMandate, requireDPoP)`: fewer misconfigurations and one tag for MCP/OpenAPI/audit tooling.
66
46
 
67
47
  ```typescript
68
- import { requireMandate } from "@classytic/arc/permissions";
69
-
70
- permissions: {
71
- pay: requireMandate("payment.charge", {
72
- audience: (ctx) => `invoice:${ctx.params?.id}`,
73
- validateAmount: (ctx, mandate) => {
74
- const amount = (ctx.data as { amount?: number })?.amount ?? 0;
75
- if (amount <= (mandate.cap ?? 0)) return true;
76
- return `Amount ${amount} exceeds mandate cap ${mandate.cap}`;
77
- },
78
- ttlGraceMs: 30_000, // default: 30s clock skew
79
- noElevatedBypass: false, // platform admins normally bypass; set true for break-glass audit flows
80
- }),
81
- }
82
- ```
83
-
84
- ### `requireAgentScope(opts)` — composite gate
85
-
86
- Bundles the three things every high-value agent endpoint needs (service identity + capability mandate + DPoP binding) into one call:
87
-
88
- ```typescript
89
- import { requireAgentScope } from "@classytic/arc/permissions";
48
+ import { requireAgentScope } from '@classytic/arc/permissions';
90
49
 
91
50
  defineResource({
92
- name: "invoice",
51
+ name: 'invoice',
93
52
  actions: {
94
53
  pay: {
95
54
  handler: payInvoice,
96
55
  permissions: requireAgentScope({
97
- capability: "payment.charge",
98
- scopes: ["payment.write"], // OAuth `scopes` the client must hold
99
- requireDPoP: true, // default true
56
+ capability: 'payment.charge',
57
+ scopes: ['payment.write'],
100
58
  audience: (ctx) => `invoice:${ctx.params?.id}`,
101
- validateAmount: (ctx, m) => (ctx.data as { amount: number }).amount <= (m.cap ?? 0),
59
+ validateAmount: (ctx, m) => {
60
+ const amount = (ctx.data as { amount?: number })?.amount ?? 0;
61
+ return amount <= (m.cap ?? 0) || `Amount ${amount} exceeds mandate cap ${m.cap}`;
62
+ },
102
63
  }),
103
64
  },
104
65
  },
105
66
  });
106
67
  ```
107
68
 
108
- Use this instead of hand-composing `allOf(requireServiceScope(...), requireMandate(...), requireDPoP())` — fewer ways to misconfigure, one metadata tag downstream tools (audit, MCP, OpenAPI) can read.
109
-
110
- ## Wiring — the authenticate callback
111
-
112
- Arc takes no position on which credential format you use. Whatever your verifier produces — JWT, JWT-VC mandate, opaque API key with metadata sidecar — populates `RequestScope.service`:
69
+ ## Wiring `authenticate`
113
70
 
114
71
  ```typescript
115
- import { jwtVerify, createRemoteJWKSet } from "jose";
116
-
117
- const JWKS = createRemoteJWKSet(new URL("https://idp.example.com/.well-known/jwks.json"));
118
-
119
- await createApp({
120
- auth: {
121
- type: "authenticator",
122
- authenticate: async (request) => {
123
- const auth = request.headers.authorization?.split(" ");
124
- if (auth?.[0] !== "Mandate") return null;
125
-
126
- // 1. Verify the mandate JWT (signature, iss, aud, exp)
127
- const { payload } = await jwtVerify(auth[1], JWKS, {
128
- issuer: "https://idp.example.com",
129
- audience: "https://api.example.com",
130
- });
131
-
132
- // 2. Verify the DPoP proof header (RFC 9449)
133
- // — pseudocode; use jose.dpop.verify() in production
134
- const dpopJkt = await verifyDPoPProof(request, payload.cnf?.jkt);
135
- if (!dpopJkt) return null;
136
-
137
- // 3. Populate scope with mandate + DPoP fingerprint
138
- request.scope = {
139
- kind: "service",
140
- clientId: payload.iss as string,
141
- organizationId: (payload.org as string) ?? "",
142
- scopes: ((payload.scope as string) ?? "").split(" ").filter(Boolean),
143
- mandate: {
144
- id: payload.jti as string,
145
- capability: payload.cap as string,
146
- cap: payload.amount as number | undefined,
147
- currency: payload.currency as string | undefined,
148
- expiresAt: (payload.exp as number) * 1000,
149
- audience: payload.aud as string | undefined,
150
- parent: payload.parent as string | undefined,
151
- },
152
- dpopJkt,
153
- };
154
-
155
- return { id: payload.iss as string };
156
- },
72
+ import { jwtVerify, createRemoteJWKSet } from 'jose';
73
+
74
+ const JWKS = createRemoteJWKSet(new URL('https://idp.example.com/.well-known/jwks.json'));
75
+
76
+ auth: {
77
+ type: 'authenticator',
78
+ authenticate: async (request, reply) => {
79
+ const [scheme, credential] = request.headers.authorization?.split(' ') ?? [];
80
+ if (scheme !== 'Mandate' || !credential) return reply.code(401).send({ code: 'arc.unauthorized', message: 'Unauthorized', status: 401 });
81
+
82
+ const { payload } = await jwtVerify(credential, JWKS, {
83
+ issuer: 'https://idp.example.com',
84
+ audience: 'https://api.example.com',
85
+ });
86
+ const dpopJkt = await verifyDPoPProof(request, payload.cnf?.jkt); // your DPoP verifier
87
+ if (!dpopJkt) return reply.code(401).send({ code: 'arc.unauthorized', message: 'DPoP proof invalid', status: 401 });
88
+
89
+ request.scope = {
90
+ kind: 'service',
91
+ clientId: String(payload.iss),
92
+ organizationId: String(payload.org ?? ''),
93
+ scopes: String(payload.scope ?? '').split(' ').filter(Boolean),
94
+ mandate: {
95
+ id: String(payload.jti),
96
+ capability: String(payload.cap),
97
+ cap: payload.amount as number | undefined,
98
+ currency: payload.currency as string | undefined,
99
+ expiresAt: (payload.exp as number) * 1000,
100
+ audience: payload.aud as string | undefined,
101
+ parent: payload.parent as string | undefined,
102
+ },
103
+ dpopJkt,
104
+ };
105
+ request.user = { id: String(payload.iss) };
157
106
  },
158
- });
107
+ }
159
108
  ```
160
109
 
161
- ## Mandate flow — typical AP2 / x402 sequence
110
+ Arc takes no position on credential format (JWT, JWT-VC, opaque key plus sidecar). Anything that fills `scope.mandate` and `scope.dpopJkt` works.
162
111
 
163
- ```
164
- ┌──────────────┐
165
- user grants │ │
166
- "charge up to │ Customer │
167
- $50 on inv 7" │ │
168
- └──────┬───────┘
169
- │
170
- ┌─────────▼──────────┐
171
- │ Issues mandate │
172
- │ - cap: 50 USD │
173
- │ - audience: │
174
- │ "invoice:INV-7" │
175
- │ - exp: now + 60s │
176
- │ - cnf.jkt: agent │
177
- └─────────┬──────────┘
178
- │
179
- ▼
180
- ┌──────────────────────┐
181
- │ AI Agent │
182
- │ signs + presents │
183
- │ mandate via DPoP │
184
- └──────────┬───────────┘
185
- │
186
- ▼
187
- ┌──────────────────────┐
188
- │ Arc app │
189
- │ authenticate fn: │
190
- │ - verify mandate │
191
- │ - verify DPoP │
192
- │ - set scope.mandate │
193
- │ + scope.dpopJkt │
194
- └──────────┬───────────┘
195
- │
196
- ▼
197
- ┌──────────────────────┐
198
- │ requireAgentScope: │
199
- │ - cap satisfied? │
200
- │ - audience match? │
201
- │ - DPoP bound? │
202
- │ - not expired? │
203
- └──────────┬───────────┘
204
- │
205
- ✓ allow / ✗ deny
206
- ```
112
+ Flow: user grants a limited mandate (cap, audience, short TTL, key binding) => IdP mints it => agent presents it with a DPoP proof => `authenticate` verifies and fills scope => `requireAgentScope` checks cap, audience, expiry, binding.
207
113
 
208
- ## Audit — every gated action gets a row
114
+ ## Audit
209
115
 
210
- Pair with `@classytic/arc/auth/audit` to record every agent action through the canonical `auditPlugin` store. Mandate id, audience, cap, dpopJkt all flow into `metadata` on the audit row — full forensic chain.
116
+ Audit rows take the actor from the validated scope (`userId`, else `clientId`). Record mandate details explicitly through the audit logger:
211
117
 
212
118
  ```typescript
213
- auditPlugin({
214
- actor: (request) =>
215
- request.scope?.kind === "service"
216
- ? {
217
- kind: "service",
218
- clientId: getClientId(request.scope),
219
- mandateId: getMandate(request.scope)?.id,
220
- dpopJkt: getDPoPJkt(request.scope),
221
- }
222
- : { kind: "user", userId: getUserId(request.scope) },
119
+ await app.audit.custom('invoice', id, 'pay', {
120
+ mandateId: getMandate(request.scope)?.id,
121
+ dpopJkt: getDPoPJkt(request.scope),
223
122
  });
224
123
  ```
225
124
 
226
- ## What's NOT in arc (deliberate)
227
-
228
- - **DPoP proof verification** — one `jose.dpop.verify()` call in your authenticate function. Arc would have to peer-dep `jose`; the host already has it.
229
- - **JWT-VC mandate parser** — host's verifier (your IdP / AP2 issuer / custom).
230
- - **Mandate issuance** — that's the IdP's job (or your token endpoint when you mint per-action mandates).
231
- - **Risk scoring / device trust** — out of framework scope. Layer Castle / Stytch / Auth0 Risk separately.
232
-
233
- ## See also
125
+ ## Not in arc
234
126
 
235
- - [enterprise-auth.md](enterprise-auth.md) — full enterprise-auth surface
236
- - [scim.md](scim.md) — IdP provisioning (the user-creation path agents authenticate against)
237
- - [auth.md](auth.md) — Better Auth + service identity setup
238
- - [`playground/enterprise-auth/`](../../../playground/enterprise-auth/) — runnable smoke
127
+ DPoP proof verification, mandate JWT/VC parsing, mandate issuance, risk scoring and device trust. These belong to your verifier, IdP or a vendor.
@@ -1,248 +1,44 @@
1
- # Subpath Imports — Full Enumeration
2
-
3
- Arc ships heavily tree-shaken: every feature has its own subpath. Pay only for what you import.
4
-
5
- ## Core
6
-
7
- ```typescript
8
- import { defineResource, BaseController, BaseCrudController, allowPublic } from '@classytic/arc';
9
- // createApp rateLimit gains `plan: { resolve, limits, default }` (2.22) — per-plan ceilings, `false` = unlimited, fail-safe fallback.
10
- import { createApp, loadResources } from '@classytic/arc/factory';
11
- import { defineModule, getModuleExports, orderModules } from '@classytic/arc/factory';
12
- // Worker role (2.23) — same options object, headless process (no routes, no auth;
13
- // events/jobs/schedules run). Primitive: `mountRoutes: false`; preset: 'worker'.
14
- import { createWorker } from '@classytic/arc/factory';
15
- import type { ArcWorker, CreateWorkerOptions } from '@classytic/arc/factory';
16
-
17
- // Programmatic resource assembly (2.21) — for module authors composing
18
- // base config + host seams without casts. Arrays concat, plain objects
19
- // deep-merge, class instances last-win, `undefined` never clobbers.
20
- import { mergeResourceConfig } from '@classytic/arc';
21
- import type { ResourceSeams, SeamedResourceConfig, AdapterLike } from '@classytic/arc';
22
- ```
23
-
24
- ## Adapters (kit-owned, never arc)
25
-
26
- ```typescript
27
- import { createMongooseAdapter } from '@classytic/mongokit/adapter';
28
- import { createDrizzleAdapter } from '@classytic/sqlitekit/adapter';
29
- import { createPrismaAdapter } from '@classytic/prismakit/adapter';
30
-
31
- import type {
32
- DataAdapter,
33
- RepositoryLike,
34
- AdapterRepositoryInput,
35
- AdapterFactory,
36
- OpenApiSchemas,
37
- SchemaMetadata,
38
- FieldMetadata,
39
- RelationMetadata,
40
- } from '@classytic/repo-core/adapter';
41
- import { asRepositoryLike, isRepository } from '@classytic/repo-core/adapter';
42
- ```
43
-
44
- `MinimalRepo` / `StandardRepo` import directly from `@classytic/repo-core/repository`.
45
-
46
- ## Auth
47
-
48
- ```typescript
49
- import { createBetterAuthAdapter, extractBetterAuthOpenApi } from '@classytic/arc/auth';
50
-
51
- // Kit-owned BA overlays:
52
- import { createBetterAuthOverlay, registerBetterAuthStubs } from '@classytic/mongokit/better-auth';
53
- import { resolveBetterAuthCollections, BA_COLLECTIONS_BY_PLUGIN } from '@classytic/repo-core/better-auth';
54
- ```
55
-
56
- ## Permissions + scope
57
-
58
- ```typescript
59
- import {
60
- allowPublic, requireAuth, requireRoles, requireOwnership,
61
- requireOrgMembership, requireOrgRole, requireTeamMembership,
62
- requireServiceScope, requireScopeContext, requireOrgInScope,
63
- // Platform-only role gate — an ORG role can never satisfy it. Required by
64
- // globally-scoped surfaces (jobsPlugin managementRoutes) that cannot filter by tenant.
65
- requirePlatformRole,
66
-
67
- // Agent-auth (2.13) — DPoP + capability mandates (AP2 / x402 / MCP)
68
- requireAgentScope, requireMandate, requireDPoP,
69
- type RequireAgentScopeOptions, type RequireMandateOptions,
70
- allOf, anyOf, when, denyAll,
71
- permissionMatrix, // 2.21: { read, write, delete? } → full CRUD map
72
- createDynamicPermissionMatrix, createRoleHierarchy,
73
- fields, roles,
74
- } from '@classytic/arc/permissions';
75
-
76
- import {
77
- isMember, isService, isElevated, isAuthenticated, hasOrgAccess,
78
- getUserId, getUserRoles, getOrgId, getOrgRoles, getTeamId, getClientId,
79
- getServiceScopes, getScopeContext, getScopeContextMap,
80
- getAncestorOrgIds, isOrgInScope, getRequestScope,
81
- // Agent-auth scope accessors (2.13)
82
- getMandate, getDPoPJkt, type Mandate,
83
- requireUserId, requireClientId, // throw 401 (UnauthorizedError) if absent
84
- requireOrgId, requireTeamId, // throw 403 (OrgRequiredError) if absent
85
- createTenantKeyGenerator,
86
- } from '@classytic/arc/scope';
87
- ```
88
-
89
- ## Cache
90
-
91
- ```typescript
92
- // HOST-LEVEL cache (action results, custom routes — NOT repo-bound paths)
93
- import { MemoryCacheStore, RedisCacheStore, QueryCache } from '@classytic/arc/cache';
94
-
95
- // REPO-BOUND cache (canonical) — getById/getAll/aggregate/count/etc
96
- // Install once on the kit's repo; arc forwards declarative `cache:`
97
- // config to req.cache automatically.
98
- import { cachePlugin, type CacheOptions } from '@classytic/repo-core/cache';
99
- // Per-call shape (TanStack-shaped):
100
- // { staleTime, gcTime, swr, tags, bypass, enabled, key }
101
- ```
102
-
103
- ## Events
104
-
105
- ```typescript
106
- import { eventPlugin, EventOutbox, MemoryOutboxStore } from '@classytic/arc/events';
107
- import { RedisEventTransport } from '@classytic/arc/events/redis';
108
- import { RedisStreamEventTransport } from '@classytic/arc/events/redis-stream';
109
-
110
- // Event types live in primitives, NOT arc:
111
- import type { EventMeta, DomainEvent, EventTransport, EventHandler } from '@classytic/primitives/events';
112
- import { createEvent, createChildEvent, matchEventPattern } from '@classytic/primitives/events';
113
- ```
114
-
115
- ## Plugins
116
-
117
- ```typescript
118
- import {
119
- healthPlugin, gracefulShutdownPlugin, ssePlugin,
120
- metricsPlugin, versioningPlugin,
121
- schedulesPlugin, // 2.21: interval jobs, optional LockAdapter leader lease, no Redis
122
- type ScheduleDefinition,
123
- } from '@classytic/arc/plugins';
124
- // Lock contract (schedules.lock / MigrationRunner.lock) — one ecosystem standard:
125
- // import type { LockAdapter } from '@classytic/repo-core/lock';
126
- import { tracingPlugin } from '@classytic/arc/plugins/tracing';
127
- import { auditPlugin } from '@classytic/arc/audit';
128
- import { idempotencyPlugin } from '@classytic/arc/idempotency';
129
- // Runtime capability registry (2.33) — declare process-local state so a
130
- // `runtime: 'distributed'` boot fails on undeclared memory state:
131
- import { declareRuntimeCapability } from '@classytic/arc/utils';
132
- ```
133
-
134
- **Idempotency store — the one schema mistake that matters.** Backing the store
135
- with a repository requires the key path to survive the filter. A Mongoose
136
- schema with NO declared paths under a global `strictQuery: true` has EVERY
137
- filter key stripped, so `getOne({ _id: key })` becomes `getOne({})`: one row
138
- absorbs every key and responses replay across keys AND users. Declare the path
139
- and pin the option on the schema:
140
-
141
- ```typescript
142
- new Schema({ _id: String }, { strict: false, strictQuery: false, timestamps: false })
143
- // NOT `new Schema({}, { _id: false, strict: false })`
144
- ```
145
-
146
- The plugin's boot self-check (default on, `selfCheck: false` to disable) probes
147
- for exactly this and refuses to register; the adapter also throws
148
- `IdempotencyStoreMisconfiguredError` on any cross-key read at runtime.
149
-
150
- ## Integrations
151
-
152
- ```typescript
153
- import { jobsPlugin } from '@classytic/arc/integrations/jobs';
154
- import { websocketPlugin } from '@classytic/arc/integrations/websocket';
155
- import { eventGatewayPlugin } from '@classytic/arc/integrations/event-gateway';
156
- import { webhookPlugin } from '@classytic/arc/integrations/webhooks';
157
- import { mcpPlugin, defineTool, definePrompt, fieldRulesToZod, resourceToTools } from '@classytic/arc/mcp';
158
- ```
159
-
160
- ## Enterprise auth (2.13)
161
-
162
- ```typescript
163
- // SCIM 2.0 — IdP provisioning
164
- import {
165
- scimPlugin,
166
- type ScimPluginOptions,
167
- type ScimResourceMapping,
168
- parseScimFilter, parseScimPatch,
169
- DEFAULT_USER_MAPPING, DEFAULT_GROUP_MAPPING,
170
- SCIM_USER_SCHEMA, SCIM_GROUP_SCHEMA,
171
- ScimError,
172
- } from '@classytic/arc/scim';
173
-
174
- // Better Auth → arc audit bridge
175
- import {
176
- wireBetterAuthAudit,
177
- type AuthEvent, type AuthEventName,
178
- type WireBetterAuthAuditOptions,
179
- } from '@classytic/arc/auth/audit';
180
- ```
181
-
182
- ## Hooks + presets
183
-
184
- ```typescript
185
- import { createHookSystem, beforeCreate, afterCreate, beforeUpdate, afterUpdate } from '@classytic/arc/hooks';
186
- import {
187
- bulkPreset, softDeletePreset, slugLookupPreset, treePreset,
188
- ownedByUserPreset, multiTenantPreset, auditedPreset, searchPreset,
189
- filesUploadPreset,
190
- type TenantFieldSpec,
191
- } from '@classytic/arc/presets';
192
- ```
193
-
194
- ## Usage (2.22)
195
-
196
- ```typescript
197
- // Per-actor, per-period (UTC YYYY-MM) usage counters — the accounting layer for
198
- // quotas, plan enforcement, and usage-based billing. Decorates `fastify.usage`.
199
- // requireQuota = the enforcement half: PermissionCheck gating on counters
200
- // (429 quota.exceeded with { kind, used, limit, period, resetsAt }; limit may
201
- // be a number, false = unlimited, or a plan-aware resolver; fail-open default).
202
- import { usagePlugin, MemoryUsageStore, usagePeriod, requireQuota } from '@classytic/arc/usage';
203
- import type { UsageStore, UsageBucket, UsagePluginOptions, UsageMeter, QuotaOptions } from '@classytic/arc/usage';
204
- // Canonical store contract + cross-kit conformance: @classytic/repo-core/usage +
205
- // runUsageStoreContract from @classytic/repo-core/testing; Mongo adapter:
206
- // createMongoUsageStore from @classytic/mongokit/usage (>=3.22).
207
- ```
208
-
209
- ## Testing
210
-
211
- ```typescript
212
- import {
213
- createTestApp, expectArc, createHttpTestHarness,
214
- TestAuthSession, TestAuthProvider, TestFixtures,
215
- runStorageContract,
216
- bootModuleApp, // 2.22: real app around modules ("boots green ⇒ composes");
217
- // t.exports<T>(name) typed accessor; DB via `database` seam —
218
- // mongoMemoryDatabase default, any kit injectable
219
- mongoMemoryDatabase,
220
- } from '@classytic/arc/testing';
221
- ```
222
-
223
- ## Utilities
224
-
225
- ```typescript
226
- import {
227
- createStateMachine, CircuitBreaker, withCompensation, defineGuard,
228
- retry, queryParser,
229
- // AI SDK / OpenAI streams → Fastify reply (no JsonToSseTransformStream boilerplate)
230
- pipeUIMessageStreamToReply, UI_MESSAGE_STREAM_HEADERS, isReadableStream,
231
- } from '@classytic/arc/utils';
232
- import { defineMigration, MigrationRunner } from '@classytic/arc/migrations';
233
- import { Type, ArcListResponse } from '@classytic/arc/schemas';
234
- ```
235
-
236
- ## Type-only barrel
237
-
238
- ```typescript
239
- // Type-only — produces `export {}` at runtime; this is correct
240
- import type { ArcRequest, IRequestContext, IControllerResponse } from '@classytic/arc/types';
241
- ```
1
+ # Subpath import map
2
+
3
+ Import only from these subpaths (tree-shaken, no deep imports). Authoritative list: `api-surface.json`. Adapters live in kits (`@classytic/mongokit/adapter`, `@classytic/sqlitekit/adapter`, `@classytic/prismakit/adapter`); adapter and repository types come from `@classytic/repo-core/adapter` and `@classytic/repo-core/repository`. Event types come from `@classytic/primitives/events`, the outbox contract from `@classytic/primitives/outbox`. `@classytic/arc/types` and `@classytic/arc/types/storage` are type-only.
4
+
5
+ | Subpath | Main exports |
6
+ |---|---|
7
+ | `@classytic/arc` | `defineResource`, `defineAction`, `defineAggregation`, `defineResourceVariants`, `mergeResourceConfig`, `BaseController`, `BaseCrudController`, `BulkMixin`, `SlugMixin`, `SoftDeleteMixin`, `TreeMixin`, permission helpers, `ArcError`, `NotFoundError`, `ValidationError`, `createDomainError`, constants (`CRUD_OPERATIONS`, `DEFAULT_LIMIT` ...) |
8
+ | `/core` | Same resource and controller API plus `routeInput`, `crudInput`, `parsed`, `noPayloadSchema`, `createCrudRouter`, `QueryResolver`, `AccessControl`, `BodySanitizer`, `validateResourceConfig` |
9
+ | `/factory` | `createApp`, `createWorker`, `loadResources`, `defineModule`, `extendModule`, `getModuleExports`, `orderModules`, `planModules`, `verifyModuleGraph`, `renderModuleGraph`, `toAsyncApi`, `toFetchHandler`, `eventTopology`, `verifyEventDurability`, `createRelayNudge`, presets (`productionPreset`, `developmentPreset`, `testingPreset`, `edgePreset`) |
10
+ | `/permissions` | `allowPublic`, `requireAuth`, `requireRoles`, `requireOwnership`, `requireOrgMembership`, `requireOrgRole`, `requireTeamMembership`, `requireServiceScope`, `requireScopeContext`, `requireOrgInScope`, `requirePlatformRole`, `requireGrant`, `requireAgentScope`, `requireMandate`, `requireDPoP`, `allOf`, `anyOf`, `not`, `when`, `allow`, `deny`, `denyAll`, `permissionMatrix`, `createDynamicPermissionMatrix`, `createRoleHierarchy`, `fields`, `roles`, `introspectModule` |
11
+ | `/scope` | `getUserId`, `getOrgId`, `getOrgRoles`, `getTeamId`, `getClientId`, `getScopeContext`, `getRequestScope`, `getServiceScopes`, `getMandate`, `getDPoPJkt`, `isMember`, `isService`, `isElevated`, `isAuthenticated`, `hasOrgAccess`, `isOrgInScope`, `requireUserId`, `requireOrgId`, `requireTeamId`, `requireClientId`, `elevationPlugin`, `createTenantKeyGenerator`, `PUBLIC_SCOPE`, `AUTHENTICATED_SCOPE` |
12
+ | `/presets` (+ `/presets/tenant`, `/files-upload`, `/search`) | `multiTenantPreset`, `softDeletePreset`, `bulkPreset`, `slugLookupPreset`, `treePreset`, `ownedByUserPreset`, `auditedPreset`, `searchPreset`, `filesUploadPreset`, `registerPreset`, `applyPresets` |
13
+ | `/auth` (+ `/auth/redis`, `/auth/audit`) | `authPlugin`, `createBetterAuthAdapter`, `extractBetterAuthOpenApi`, `createSessionManager`, `MemorySessionStore`, `RedisSessionStore`, `wireBetterAuthAudit` |
14
+ | `/scim` | `scimPlugin`, `parseScimFilter`, `parseScimPatch`, `ScimError`, `DEFAULT_USER_MAPPING`, `DEFAULT_GROUP_MAPPING`, `SCIM_USER_SCHEMA`, `SCIM_GROUP_SCHEMA` |
15
+ | `/cache` | `QueryCache`, `queryCachePlugin`, `MemoryCacheStore`, `RedisCacheStore`, `ioredisAsCacheClient`, `upstashAsCacheClient`. Repo-bound cache: `cachePlugin` from `@classytic/repo-core/cache` |
16
+ | `/events` | `eventPlugin`, `MemoryEventTransport`, `defineEvent`, `createEventRegistry`, `withRetry`, `withInbox`, `withSubscriberId`, `wrapWithSchema`, `subscribeWithSchema`, `wrapWithBoundary`, `subscribeWithBoundary`, `createDeadLetterPublisher`, `EventOutbox`, `MemoryOutboxStore`, `repositoryAsOutboxStore`, `createOutboxModule`, `exponentialBackoff`, `readOutboxHealth`, `crudEventType`, `ARC_LIFECYCLE_EVENTS` |
17
+ | `/events/redis`, `/events/redis-stream` | `RedisEventTransport`, `RedisStreamTransport` |
18
+ | `/outbox-admin` | `createOutboxAdminModule` |
19
+ | `/plugins` | `healthPlugin`, `gracefulShutdownPlugin`, `ssePlugin`, `metricsPlugin`, `versioningPlugin`, `schedulesPlugin`, `cachingPlugin`, `pressurePlugin`, `realtimePlugin`, `requestIdPlugin`, `errorHandlerPlugin`, `createPlugin`, `createDailyGate`, `createMemoryDailyLedger`; types `DailyLedger`, `DailyScheduleOptions`, `ScheduleRunContext`, `ScheduleDefinition` |
20
+ | `/plugins/tracing`, `/plugins/response-cache` | `tracingPlugin`, `traced`, `createSpan`; `responseCachePlugin` |
21
+ | `/audit` | `auditPlugin`, `MemoryAuditStore`, `repositoryAsAuditStore`, `createAuditEntry` |
22
+ | `/idempotency` (+ `/idempotency/redis`) | `idempotencyPlugin`, `MemoryIdempotencyStore`, `repositoryAsIdempotencyStore`, `IdempotencyStoreMisconfiguredError`; `RedisIdempotencyStore` |
23
+ | `/usage` | `usagePlugin`, `MemoryUsageStore`, `RedisUsageStore`, `usagePeriod`, `requireQuota` |
24
+ | `/hooks`, `/pipeline`, `/middleware` | `createHookSystem`, `beforeCreate`, `afterCreate`, `beforeUpdate` ...; `pipe`, `guard`, `transform`, `intercept`; `multipartBody` |
25
+ | `/context`, `/logger` | `requestContext`, `transactionContext`, `runWorkScope`; `arcLog`, `configureArcLogger` |
26
+ | `/registry`, `/discovery`, `/docs` | `ResourceRegistry`, `introspectionPlugin`; `discoverResources`; `openApiPlugin`, `scalarPlugin`, `buildOpenApiSpec` |
27
+ | `/schemas` | `Type`, `ArcListResponse`, `ArcErrorResponse`, `ArcPaginationQuery` |
28
+ | `/utils` | `createStateMachine`, `CircuitBreaker`, `withCompensation`, `defineGuard`, `declareRuntimeCapability`, `createQueryParser`, `ArcQueryParser`, `createError`, `pipeUIMessageStreamToReply`, `listResponse`, `errorContractSchema`, error classes |
29
+ | `/migrations` | `defineMigration`, `MigrationRunner`, `MigrationRegistry`, `MongoMigrationStore` |
30
+ | `/cleanup` | `createDataCleanupModule`, `createCleanupService`, `createCleanupRegistry`, `recipeFromSteps` |
31
+ | `/encryption` | `encryptionPlugin`, `encryptField`, `decryptField`, `createStaticKeyProvider` |
32
+ | `/mcp` (+ `/mcp/testing`) | `mcpPlugin`, `defineTool`, `definePrompt`, `resourceToTools`, `fieldRulesToZod`, `createMcpServer`; `createTestMcpClient` |
33
+ | `/integrations/jobs` | `jobsPlugin`, `defineJob` |
34
+ | `/integrations/websocket` (+ `-redis`, `-pushref-redis`) | `websocketPlugin`, `RoomManager`, `GeoRoom`; `RedisWebSocketAdapter`; `RedisPushRefStore` |
35
+ | `/integrations/event-gateway`, `/streamline`, `/webhooks` | `eventGatewayPlugin`; `streamlinePlugin`; `webhookPlugin`, `verifyWebhook`, `createDurableWebhookModule` |
36
+ | `/testing` (+ `/testing/storage`, `/cleanup`, `/outbox`, `/ports`) | `createTestApp`, `expectArc`, `createHttpTestHarness`, `bootModuleApp`, `createTestFixtures`, `runStorageContract`, `runOutboxStoreContract`, `assertRequiresPorts` |
37
+ | `/cli` | `describe`, `doctor`, `generate`, `init`, `introspect`, `exportDocs` |
242
38
 
243
39
  ## Notes
244
40
 
245
- - **No default exports** outside Fastify plugin entry files (`fp()`-wrapped plugin entries — grep `export default fp` in src/ for the authoritative list).
246
- - **Type-only subpaths** produce `export {}` at runtime — interfaces are erased.
247
- - **Adapters live in kits**, not arc. Arc 2.12+ ships zero kit-bound adapters.
248
- - **Event types live in `@classytic/primitives/events`**, not `@classytic/arc/events`. Arc re-exports the runtime `MemoryEventTransport` only.
41
+ - No default exports except `fp()`-wrapped plugin entry files.
42
+ - Type-only subpaths compile to `export {}`.
43
+ - Idempotency backed by a repository: the key path must survive query filtering. A Mongoose schema with no declared paths under global `strictQuery: true` strips every filter key, so one row absorbs all keys. Use `new Schema({ _id: String }, { strict: false, strictQuery: false, timestamps: false })`. The plugin's boot self-check (`selfCheck: false` disables) refuses to start on this.
44
+ - Lock contract for `schedules.lock` and `MigrationRunner.lock`: `LockAdapter` from `@classytic/repo-core/lock`.