@classytic/arc 2.32.0 → 2.34.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 (193) hide show
  1. package/README.md +1 -1
  2. package/bin/arc.js +58 -17
  3. package/dist/{BaseController-Dk34dxhI.mjs → BaseController-CbkuhNI2.mjs} +329 -35
  4. package/dist/{EventTransport-2uVV34WU.d.mts → EventTransport-BEVP50ka.d.mts} +16 -0
  5. package/dist/{EventTransport-BV10D0oG.mjs → EventTransport-tq4CEB-q.mjs} +39 -2
  6. package/dist/{HookSystem-vimw5D7Z.mjs → HookSystem-DqXkMXkB.mjs} +2 -2
  7. package/dist/{ResourceRegistry-BVr7PgA0.mjs → ResourceRegistry-DoALUlOO.mjs} +3 -2
  8. package/dist/{actionPermissions-Dti7ebyv.mjs → actionPermissions-CUeCmpUd.mjs} +1 -1
  9. package/dist/audit/index.d.mts +2 -2
  10. package/dist/audit/index.mjs +2 -2
  11. package/dist/auth/audit.mjs +1 -1
  12. package/dist/auth/index.d.mts +2 -2
  13. package/dist/auth/index.mjs +39 -7
  14. package/dist/auth/redis-session.mjs +1 -1
  15. package/dist/{authorizationDecision-__T3EJDA.mjs → authorizationDecision-CMMLWmuZ.mjs} +6 -2
  16. package/dist/{types-B7XeLEgK.d.mts → base-Csjc2oF-.d.mts} +74 -74
  17. package/dist/{buildHandler-Dn7rzUJo.mjs → buildHandler-BrdYrG_1.mjs} +4 -4
  18. package/dist/cache/index.mjs +4 -4
  19. package/dist/{caching-DFJqHyFs.mjs → caching-BcGmvnHh.mjs} +2 -2
  20. package/dist/cleanup/index.d.mts +17 -5
  21. package/dist/cleanup/index.mjs +240 -7
  22. package/dist/cli/commands/describe.d.mts +1 -1
  23. package/dist/cli/commands/describe.mjs +3 -3
  24. package/dist/cli/commands/docs.mjs +3 -3
  25. package/dist/cli/commands/doctor.mjs +1 -1
  26. package/dist/cli/commands/generate.mjs +2 -2
  27. package/dist/cli/commands/init.mjs +2 -2
  28. package/dist/cli/commands/introspect.mjs +2 -2
  29. package/dist/cli/index.mjs +3 -3
  30. package/dist/{constants-J99LGTJI.mjs → constants-BxCoxmiN.mjs} +1 -1
  31. package/dist/context/index.mjs +3 -3
  32. package/dist/core/index.d.mts +3 -3
  33. package/dist/core/index.mjs +9 -8
  34. package/dist/{core-BwwmNSp7.mjs → core-BYKa8wHu.mjs} +3 -3
  35. package/dist/{createActionRouter-DkJZWo0m.mjs → createActionRouter-D6T0jWhS.mjs} +8 -8
  36. package/dist/{createAggregationRouter-B1exOVD8.mjs → createAggregationRouter-QLV2PrWP.mjs} +7 -7
  37. package/dist/{createApp-Bv0m-Q6_.mjs → createApp-zR-DEesr.mjs} +128 -24
  38. package/dist/{defineAggregation-gX4No1gt.mjs → defineAggregation-Nv-DwfOf.mjs} +1 -1
  39. package/dist/{defineResource-XFPPUu2c.mjs → defineResource-ZhuLonLm.mjs} +297 -23
  40. package/dist/discovery/index.mjs +1 -1
  41. package/dist/docs/index.d.mts +1 -1
  42. package/dist/docs/index.mjs +3 -3
  43. package/dist/{elevation-DNXXxgjl.mjs → elevation-B0tlY8y1.mjs} +4 -4
  44. package/dist/encryption/index.mjs +3 -3
  45. package/dist/{errorHandler-B2AZUJUj.mjs → errorHandler-C7xBqHsI.mjs} +42 -5
  46. package/dist/{errorHandler-CpYUJmPA.d.mts → errorHandler-DI5AN2b5.d.mts} +14 -3
  47. package/dist/{errors-Bh1KK5ps.mjs → errors-Cd_yy7aW.mjs} +1 -1
  48. package/dist/{eventPlugin-GF5nnBIq.d.mts → eventPlugin-DSNEZWfV.d.mts} +29 -1
  49. package/dist/{eventPlugin-Dk_TyXeE.mjs → eventPlugin-Dar8qRaj.mjs} +65 -9
  50. package/dist/events/index.d.mts +5 -351
  51. package/dist/events/index.mjs +5 -780
  52. package/dist/events/transports/redis-stream-entry.d.mts +1 -1
  53. package/dist/events/transports/redis-stream-entry.mjs +1 -1
  54. package/dist/events/transports/redis.d.mts +1 -1
  55. package/dist/events/transports/redis.mjs +1 -1
  56. package/dist/factory/index.d.mts +20 -5
  57. package/dist/factory/index.mjs +7 -7
  58. package/dist/{fastify-augmentation-BppG5bMT.d.mts → fastify-augmentation-DVsTAy6X.d.mts} +3 -3
  59. package/dist/{fields-DEi65pGj.mjs → fields-CojeUkS4.mjs} +1 -1
  60. package/dist/{generate-CRSG0jTv.mjs → generate-DiB0nHPR.mjs} +2 -2
  61. package/dist/{headers-BXjQYbeC.mjs → headers-CveNO9gR.mjs} +2 -2
  62. package/dist/{health-5XnTa2uo.mjs → health-CasG2A28.mjs} +1 -1
  63. package/dist/hooks/index.d.mts +1 -1
  64. package/dist/hooks/index.mjs +2 -2
  65. package/dist/idempotency/index.d.mts +45 -1
  66. package/dist/idempotency/index.mjs +90 -9
  67. package/dist/idempotency/redis.mjs +1 -1
  68. package/dist/{index-zq6VrjaB.d.mts → index-B-DvUzsr.d.mts} +12 -2
  69. package/dist/{index-CpzxqePp.d.mts → index-BcR2bFZQ.d.mts} +707 -373
  70. package/dist/{index-ZWhLTp_s.d.mts → index-C5NnMEKF.d.mts} +1 -1
  71. package/dist/{index-DXlHwvuE.d.mts → index-CFAJEWCX.d.mts} +18 -5
  72. package/dist/{index-C-481Zf2.d.mts → index-ugr1tQlW.d.mts} +17 -1
  73. package/dist/index.d.mts +6 -6
  74. package/dist/index.mjs +13 -12
  75. package/dist/{init-BbfP8aky.mjs → init-mdJ-v4Xp.mjs} +18 -12
  76. package/dist/integrations/event-gateway.d.mts +1 -1
  77. package/dist/integrations/event-gateway.mjs +2 -2
  78. package/dist/integrations/index.d.mts +2 -2
  79. package/dist/integrations/index.mjs +1 -1
  80. package/dist/integrations/jobs/index.d.mts +1 -1
  81. package/dist/integrations/jobs/index.mjs +99 -97
  82. package/dist/integrations/mcp/index.d.mts +12 -3
  83. package/dist/integrations/mcp/index.mjs +2 -2
  84. package/dist/integrations/mcp/testing.d.mts +1 -1
  85. package/dist/integrations/mcp/testing.mjs +2 -2
  86. package/dist/integrations/streamline.mjs +3 -3
  87. package/dist/integrations/webhooks.d.mts +124 -1
  88. package/dist/integrations/webhooks.mjs +180 -2
  89. package/dist/integrations/websocket-pushref-redis.mjs +1 -1
  90. package/dist/integrations/websocket-redis.mjs +1 -1
  91. package/dist/integrations/websocket.mjs +1 -1
  92. package/dist/{interface-BP4IJCBO.mjs → interface-DznJrm9R.mjs} +1 -1
  93. package/dist/{jsonBody-DDSR2HFl.mjs → jsonBody-CfGH-GxO.mjs} +2 -2
  94. package/dist/{keys-B-HBTGXl.mjs → keys-WeKvY1dE.mjs} +1 -1
  95. package/dist/{loadResources-DisEAmkm.mjs → loadResources-Bj-aSsXi.mjs} +2 -2
  96. package/dist/{loadResourcesFromEntry-D1MJp13f.mjs → loadResourcesFromEntry-DwaxNcE2.mjs} +2 -2
  97. package/dist/logger/index.mjs +1 -1
  98. package/dist/{mcpPlugin-CpfVpKHE.mjs → mcpPlugin-DX3PHD7K.mjs} +60 -21
  99. package/dist/{memory-DsuWnj4T.mjs → memory-qYSB7rMQ.mjs} +2 -2
  100. package/dist/{metrics-DdQL8syd.mjs → metrics-D7uchLjN.mjs} +2 -2
  101. package/dist/middleware/index.d.mts +1 -1
  102. package/dist/middleware/index.mjs +3 -3
  103. package/dist/migrations/index.mjs +2 -2
  104. package/dist/{module-Br81am6m.mjs → module-CwKsgZXp.mjs} +1 -1
  105. package/dist/{multipartBody-BnkBLN7v.mjs → multipartBody-4w-S3-PU.mjs} +1 -1
  106. package/dist/{openapi-DIRzvxC0.mjs → openapi-CkV5mQ53.mjs} +6 -6
  107. package/dist/outbox-admin/index.d.mts +2 -2
  108. package/dist/outbox-admin/index.mjs +4 -4
  109. package/dist/outbox-module-C1Bs_FXF.d.mts +382 -0
  110. package/dist/outbox-module-D1QfHqO4.mjs +846 -0
  111. package/dist/permissions/index.d.mts +2 -2
  112. package/dist/permissions/index.mjs +5 -5
  113. package/dist/{permissions-Dl_m0NCe.mjs → permissions-CP47jdi7.mjs} +25 -6
  114. package/dist/{pipe-ELHCP3zj.mjs → pipe-BzzoEhHj.mjs} +2 -2
  115. package/dist/pipeline/index.d.mts +1 -1
  116. package/dist/pipeline/index.mjs +2 -2
  117. package/dist/{pipeline-CPA-jx0M.mjs → pipeline-q69DZzgG.mjs} +6 -6
  118. package/dist/plugins/index.d.mts +6 -6
  119. package/dist/plugins/index.mjs +16 -16
  120. package/dist/plugins/response-cache.mjs +2 -2
  121. package/dist/plugins/tracing-entry.mjs +2 -2
  122. package/dist/{pluralize-C2ZkKbsn.mjs → pluralize-B7xf8qZF.mjs} +1 -1
  123. package/dist/{preloadResources-CDs87fTw.mjs → preloadResources-BkyqeTDz.mjs} +1 -1
  124. package/dist/{preloadResources-T1hmlTEZ.d.mts → preloadResources-g07ldtzh.d.mts} +30 -7
  125. package/dist/presets/filesUpload.d.mts +2 -2
  126. package/dist/presets/filesUpload.mjs +5 -5
  127. package/dist/presets/index.d.mts +2 -2
  128. package/dist/presets/index.mjs +2 -2
  129. package/dist/presets/multiTenant.d.mts +1 -1
  130. package/dist/presets/multiTenant.mjs +3 -3
  131. package/dist/presets/search.d.mts +2 -2
  132. package/dist/presets/search.mjs +2 -2
  133. package/dist/{presets-Dntd_pUO.mjs → presets-BAPijK_A.mjs} +4 -4
  134. package/dist/projection-BKM0Ui-s.mjs +42 -0
  135. package/dist/{queryCachePlugin-Dhps-Ldt.mjs → queryCachePlugin-DhsZ0ZIc.mjs} +49 -7
  136. package/dist/{rateLimit-C7mmAGs3.mjs → rateLimit-D4-ASwsI.mjs} +2 -2
  137. package/dist/{rateLimitKey-CccEFBfk.mjs → rateLimitKey-XngqVNEV.mjs} +1 -1
  138. package/dist/{realtime-DVvVZZFz.mjs → realtime-G1TC6Yzc.mjs} +9 -9
  139. package/dist/{redis-stream-qN6A-RFv.d.mts → redis-stream-mwLWlfHG.d.mts} +1 -1
  140. package/dist/{registerRoute-B_QrjYZS.mjs → registerRoute-Ba8v0PCa.mjs} +4 -4
  141. package/dist/registry/index.d.mts +3 -3
  142. package/dist/registry/index.mjs +3 -3
  143. package/dist/{registry-DqUmzA9W.mjs → registry-CLxCR5LF.mjs} +2 -2
  144. package/dist/{renewingLease-BpP9wwj7.mjs → renewingLease-BnWtbA2U.mjs} +1 -1
  145. package/dist/{replyHelpers-DS-P0b32.mjs → replyHelpers-BSBVCwL3.mjs} +2 -2
  146. package/dist/repositoryFilter-BANpz6BX.mjs +78 -0
  147. package/dist/{requestContext-B6vQF-sy.mjs → requestContext-uYE35JxI.mjs} +1 -1
  148. package/dist/{rolldown-runtime-BhflRrBs.mjs → rolldown-runtime-DNg-KNCk.mjs} +1 -1
  149. package/dist/runtimeCapabilities-Dm88DaTW.mjs +49 -0
  150. package/dist/{schedules-C2Q3uv2d.mjs → schedules-CAcZgia0.mjs} +3 -3
  151. package/dist/{schemaConverter-Crjvczi_.mjs → schemaConverter-XH1RZRyu.mjs} +1 -1
  152. package/dist/{schemaIR-CnyKK_1j.mjs → schemaIR-CDvclAew.mjs} +2 -2
  153. package/dist/schemas/index.mjs +1 -1
  154. package/dist/scim/index.mjs +2 -2
  155. package/dist/scope/index.mjs +5 -5
  156. package/dist/{scope-afz_Ieek.mjs → scope-BaWcqBvr.mjs} +4 -4
  157. package/dist/{simpleEqualityMatcher-C4KiMWUa.mjs → simpleEqualityMatcher-Se8VrsaP.mjs} +1 -1
  158. package/dist/{sse-B9P4Y-UI.mjs → sse-Cf0jUHsh.mjs} +5 -5
  159. package/dist/{sseStream-B3zb_d1h.mjs → sseStream-Bvpi-UXQ.mjs} +2 -2
  160. package/dist/{store-helpers-DmEMHlPQ.mjs → store-helpers-B88p99Z2.mjs} +1 -1
  161. package/dist/{streaming-DPZdQmDz.mjs → streaming-DsT1B5zJ.mjs} +1 -1
  162. package/dist/{subscribe-helpers-sp5xTDVA.mjs → subscribe-helpers-CLIOHsOK.mjs} +2 -2
  163. package/dist/sync/changelog.mjs +1 -1
  164. package/dist/testing/cleanupStoreContract.d.mts +1 -1
  165. package/dist/testing/cleanupStoreContract.mjs +3 -1
  166. package/dist/testing/index.d.mts +24 -12
  167. package/dist/testing/index.mjs +24 -12
  168. package/dist/testing/outboxStoreContract.mjs +1 -1
  169. package/dist/testing/storageContract.mjs +1 -1
  170. package/dist/{transactionContext-BvLKvOIL.mjs → transactionContext-BYtWnwAS.mjs} +1 -1
  171. package/dist/{typeGuards-B_5-hKjJ.mjs → typeGuards-jjKJDN13.mjs} +1 -1
  172. package/dist/types/index.d.mts +3 -3
  173. package/dist/types/index.mjs +1 -1
  174. package/dist/types/storage.mjs +1 -1
  175. package/dist/{types-CT5vu6M0.d.mts → types-BcTumAz_.d.mts} +41 -7
  176. package/dist/{types-CwcUQ610.d.mts → types-BfC83KsP.d.mts} +15 -1
  177. package/dist/{types-DXYX7dIR.mjs → types-CoqIRrkY.mjs} +4 -4
  178. package/dist/{types-C4QE8qnm.d.mts → types-DVLddu2q.d.mts} +144 -1
  179. package/dist/usage/index.d.mts +1 -1
  180. package/dist/usage/index.mjs +0 -0
  181. package/dist/{userHelpers-BNsOXzOd.mjs → userHelpers-CWF5pbZD.mjs} +1 -1
  182. package/dist/utils/index.d.mts +57 -5
  183. package/dist/utils/index.mjs +12 -11
  184. package/dist/{utils-BtOha_Sp.mjs → utils-h1V_sT-t.mjs} +38 -7
  185. package/dist/{validate-PMCPR9El.mjs → validate-CdQlz52F.mjs} +2 -2
  186. package/dist/{versioning-D_rhHfZm.d.mts → versioning-DEs-_hFi.d.mts} +1 -1
  187. package/dist/{versioning-CKv2jz_U.mjs → versioning-rZbyLVD-.mjs} +3 -3
  188. package/package.json +17 -16
  189. package/skills/arc/SKILL.md +96 -4
  190. package/skills/arc/references/api-reference.md +19 -0
  191. package/skills/arc/references/production.md +2 -2
  192. package/dist/projection-CjHhM5W1.mjs +0 -18
  193. package/dist/repositoryFilter-DotlxG3L.mjs +0 -45
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
2
  //#region src/lock/renewingLease.ts
3
3
  /**
4
4
  * Start renewing an ALREADY-ACQUIRED lease. The caller performed the
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-BhflRrBs.mjs";
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-DNg-KNCk.mjs";
3
3
  import { toCanonicalList } from "@classytic/repo-core/pagination";
4
4
  import fp from "fastify-plugin";
5
5
  //#region src/plugins/replyHelpers.ts
@@ -0,0 +1,78 @@
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
+ import { arcLog } from "./logger/index.mjs";
3
+ import { policyRecordToFilter } from "@classytic/repo-core/filter";
4
+ //#region src/core/repositoryFilter.ts
5
+ const NATIVE_FILTER_DIALECT = Symbol.for("@classytic/arc/native-filter-dialect");
6
+ /**
7
+ * Mark a server-owned policy as intentionally adapter-native. This is an
8
+ * explicit escape hatch for semantics absent from repo-core's universal IR
9
+ * (for example MongoDB `$elemMatch`). Never apply it to client input.
10
+ */
11
+ function nativePolicyFilter(dialect, record) {
12
+ return Object.freeze({
13
+ ...record,
14
+ [NATIVE_FILTER_DIALECT]: dialect
15
+ });
16
+ }
17
+ function nativeDialects(value, found = /* @__PURE__ */ new Set()) {
18
+ if (value === null || typeof value !== "object") return found;
19
+ const dialect = value[NATIVE_FILTER_DIALECT];
20
+ if (typeof dialect === "string") found.add(dialect);
21
+ if (Array.isArray(value)) for (const entry of value) nativeDialects(entry, found);
22
+ else for (const entry of Object.values(value)) nativeDialects(entry, found);
23
+ return found;
24
+ }
25
+ function stripNativeMarkers(value) {
26
+ if (Array.isArray(value)) return value.map(stripNativeMarkers);
27
+ if (value === null || typeof value !== "object" || value instanceof Date) return value;
28
+ const out = {};
29
+ for (const [key, entry] of Object.entries(value)) out[key] = stripNativeMarkers(entry);
30
+ return out;
31
+ }
32
+ const log = arcLog("repository-filter");
33
+ let warnedUnconvertible = false;
34
+ /** True for a `{ $op: ... }` operator object (all keys `$`-prefixed). */
35
+ function isOperatorObject(value) {
36
+ if (value === null || typeof value !== "object") return false;
37
+ if (Array.isArray(value) || value instanceof Date) return false;
38
+ const keys = Object.keys(value);
39
+ return keys.length > 0 && keys.some((k) => k.startsWith("$"));
40
+ }
41
+ /**
42
+ * Does this compound filter contain any `$`-operator (top-level logical like
43
+ * `$and`/`$or`, or a field operator object like `{ $in: [...] }`)? If not, it is
44
+ * pure flat equality and portable as-is.
45
+ */
46
+ function filterHasDollarOperator(record) {
47
+ for (const [key, value] of Object.entries(record)) {
48
+ if (key.startsWith("$")) return true;
49
+ if (isOperatorObject(value)) return true;
50
+ }
51
+ return false;
52
+ }
53
+ /**
54
+ * Normalize a compound query/policy filter for the repository layer. Flat
55
+ * equality records pass through unchanged; anything carrying `$`-operators is
56
+ * converted to repo-core {@link Filter} IR so semantics stay explicit. Common
57
+ * operators compile identically across kits; capability-specific operators
58
+ * such as array-element matching fail loudly on adapters that cannot model them.
59
+ */
60
+ function toRepositoryFilter(record) {
61
+ const dialects = nativeDialects(record);
62
+ if (dialects.size > 0) {
63
+ if (dialects.size > 1) throw new Error(`Cannot compose native policy-filter dialects: ${[...dialects].sort().join(", ")}`);
64
+ return stripNativeMarkers(record);
65
+ }
66
+ if (!filterHasDollarOperator(record)) return record;
67
+ try {
68
+ return policyRecordToFilter(record);
69
+ } catch (err) {
70
+ if (!warnedUnconvertible) {
71
+ warnedUnconvertible = true;
72
+ log.warn(`A \`\$\`-operator filter could not be normalized to portable Filter IR (operator outside arc's policy dialect). Passing the raw record to the repository — MongoKit handles it; non-Mongo kits may not. (${err instanceof Error ? err.message : String(err)})`);
73
+ }
74
+ return record;
75
+ }
76
+ }
77
+ //#endregion
78
+ export { toRepositoryFilter as n, nativePolicyFilter as t };
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  //#region src/context/requestContext.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
2
  import "node:module";
3
3
  //#region \0rolldown/runtime.js
4
4
  var __defProp = Object.defineProperty;
@@ -0,0 +1,49 @@
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
+ //#region src/utils/runtimeCapabilities.ts
3
+ /**
4
+ * `Symbol.for` so declarations from two arc copies in one dependency graph
5
+ * land in ONE registry — same reasoning as `ARC_EVENT_TRANSPORT`. Not on the
6
+ * public `fastify.arc` surface; the audit result is the product, not the list.
7
+ */
8
+ const ARC_RUNTIME_CAPABILITIES = Symbol.for("arc.runtimeCapabilities");
9
+ function registryOf(fastify) {
10
+ const holder = fastify;
11
+ if (!holder[ARC_RUNTIME_CAPABILITIES]) holder[ARC_RUNTIME_CAPABILITIES] = [];
12
+ return holder[ARC_RUNTIME_CAPABILITIES];
13
+ }
14
+ /**
15
+ * Declare a runtime capability. Callable from ANY registration context —
16
+ * arc's own plugins, host `plugins()` callbacks, module `plugins` phases —
17
+ * which is the point: the audit sees what the constructor-time guard cannot.
18
+ */
19
+ function declareRuntimeCapability(fastify, decl) {
20
+ registryOf(fastify).push(decl);
21
+ }
22
+ /**
23
+ * The boot audit. Runs once at the end of `buildApp`, after every declarant.
24
+ *
25
+ * - `runtime: 'distributed'` + `durability: 'memory'` + not `accepted` →
26
+ * collected and THROWN as one error naming every violator (fixing them one
27
+ * boot at a time is the checklist experience this replaces).
28
+ * - accepted memory declarations → one info line, so the topology decision is
29
+ * visible in the boot log it was made for.
30
+ * - non-distributed runtimes → nothing to enforce; declarations still logged
31
+ * at debug for `arc doctor`-style tooling.
32
+ */
33
+ function auditRuntimeCapabilities(fastify, runtime) {
34
+ const declarations = registryOf(fastify);
35
+ if (declarations.length === 0) return;
36
+ if (runtime !== "distributed") {
37
+ fastify.log.debug({ capabilities: declarations }, "[arc] runtime capabilities declared (no distributed profile — informational)");
38
+ return;
39
+ }
40
+ const violations = declarations.filter((d) => d.durability === "memory" && !d.accepted);
41
+ const acceptedMemory = declarations.filter((d) => d.durability === "memory" && d.accepted);
42
+ if (acceptedMemory.length > 0) fastify.log.info({ accepted: acceptedMemory.map((d) => d.subsystem) }, "[arc] per-process state accepted by design under runtime: 'distributed'");
43
+ if (violations.length > 0) {
44
+ const lines = violations.map((d) => ` - ${d.subsystem}${d.detail ? ` — ${d.detail}` : ""}`).join("\n");
45
+ throw new Error(`runtime: 'distributed' — ${violations.length} subsystem(s) hold PER-PROCESS state that multi-replica deployment breaks:\n${lines}\nWire a shared store for each, or — where per-process is genuinely intended — have the declarant pass \`accepted: true\` with a reason.`);
46
+ }
47
+ }
48
+ //#endregion
49
+ export { declareRuntimeCapability as n, auditRuntimeCapabilities as t };
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-BhflRrBs.mjs";
3
- import { t as startRenewingLease } from "./renewingLease-BpP9wwj7.mjs";
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-DNg-KNCk.mjs";
3
+ import { t as startRenewingLease } from "./renewingLease-BnWtbA2U.mjs";
4
4
  import fp from "fastify-plugin";
5
5
  //#region src/plugins/schedules.ts
6
6
  var schedules_exports = /* @__PURE__ */ __exportAll({
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
2
  import { arcLog } from "./logger/index.mjs";
3
3
  //#region src/utils/schemaConverter.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
- import { o as toJsonSchema } from "./schemaConverter-Crjvczi_.mjs";
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
+ import { o as toJsonSchema } from "./schemaConverter-XH1RZRyu.mjs";
3
3
  //#region src/core/schemaIR.ts
4
4
  /**
5
5
  * Schema IR — one canonical representation, two adapters.
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
2
  import { errorContractSchema, errorDetailSchema } from "@classytic/repo-core/errors";
3
3
  import { Type, Type as Type$1 } from "typebox";
4
4
  //#region src/schemas/index.ts
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
- import { t as parseJsonBody } from "../jsonBody-DDSR2HFl.mjs";
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
+ import { t as parseJsonBody } from "../jsonBody-CfGH-GxO.mjs";
3
3
  import fp from "fastify-plugin";
4
4
  //#region src/scim/errors.ts
5
5
  var ScimError = class extends Error {
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
- import { C as isService, D as requireUserId, E as requireTeamId, O as scopeFirstCtx, S as isOrgInScope, T as requireOrgId, _ as getUserRoles, a as getDPoPJkt, b as isElevated, c as getOrgId, d as getScopeContext, f as getScopeContextMap, g as getUserId, h as getTenantFromRequest, i as getClientId, l as getOrgRoles, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, r as getAncestorOrgIds, s as getOrgContext, t as AUTHENTICATED_SCOPE, u as getRequestScope, v as hasOrgAccess, w as requireClientId, x as isMember, y as isAuthenticated } from "../types-DXYX7dIR.mjs";
3
- import { n as elevation_default, t as elevationPlugin } from "../elevation-DNXXxgjl.mjs";
4
- import { t as createTenantKeyGenerator } from "../rateLimitKey-CccEFBfk.mjs";
5
- import { t as resolveOrgFromHeader } from "../scope-afz_Ieek.mjs";
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
+ import { C as isService, D as requireUserId, E as requireTeamId, O as scopeFirstCtx, S as isOrgInScope, T as requireOrgId, _ as getUserRoles, a as getDPoPJkt, b as isElevated, c as getOrgId, d as getScopeContext, f as getScopeContextMap, g as getUserId, h as getTenantFromRequest, i as getClientId, l as getOrgRoles, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, r as getAncestorOrgIds, s as getOrgContext, t as AUTHENTICATED_SCOPE, u as getRequestScope, v as hasOrgAccess, w as requireClientId, x as isMember, y as isAuthenticated } from "../types-CoqIRrkY.mjs";
3
+ import { n as elevation_default, t as elevationPlugin } from "../elevation-B0tlY8y1.mjs";
4
+ import { t as createTenantKeyGenerator } from "../rateLimitKey-XngqVNEV.mjs";
5
+ import { t as resolveOrgFromHeader } from "../scope-BaWcqBvr.mjs";
6
6
  export { AUTHENTICATED_SCOPE, PUBLIC_SCOPE, createTenantKeyGenerator, elevation_default as elevationPlugin, elevationPlugin as elevationPluginFn, getAncestorOrgIds, getClientId, getDPoPJkt, getMandate, getOrgContext, getOrgId, getOrgRoles, getRequestScope, getScopeContext, getScopeContextMap, getServiceScopes, getTeamId, getTenantFromRequest, getUserId, getUserRoles, hasOrgAccess, isAuthenticated, isElevated, isMember, isOrgInScope, isService, requireClientId, requireOrgId, requireTeamId, requireUserId, resolveOrgFromHeader, scopeFirstCtx };
@@ -1,7 +1,7 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
- import { a as OrgAccessDeniedError, l as UnauthorizedError } from "./errors-Bh1KK5ps.mjs";
3
- import { n as requireSingleHeaderValue } from "./headers-BXjQYbeC.mjs";
4
- import { n as getUserRoles } from "./userHelpers-BNsOXzOd.mjs";
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
+ import { a as OrgAccessDeniedError, l as UnauthorizedError } from "./errors-Cd_yy7aW.mjs";
3
+ import { n as requireSingleHeaderValue } from "./headers-CveNO9gR.mjs";
4
+ import { n as getUserRoles } from "./userHelpers-CWF5pbZD.mjs";
5
5
  //#region src/scope/resolveOrgFromHeader.ts
6
6
  /**
7
7
  * Create a preHandler hook that resolves org scope from a header.
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
2
  //#region src/utils/simpleEqualityMatcher.ts
3
3
  /**
4
4
  * `simpleEqualityMatcher` — a minimal, dialect-agnostic flat-key equality
@@ -1,9 +1,9 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-BhflRrBs.mjs";
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-DNg-KNCk.mjs";
3
3
  import { arcLog } from "./logger/index.mjs";
4
- import { c as getOrgId, n as PUBLIC_SCOPE } from "./types-DXYX7dIR.mjs";
5
- import { a as promoteStreamTokenToHeader } from "./streaming-DPZdQmDz.mjs";
6
- import { t as openSseStream } from "./sseStream-B3zb_d1h.mjs";
4
+ import { c as getOrgId, n as PUBLIC_SCOPE } from "./types-CoqIRrkY.mjs";
5
+ import { a as promoteStreamTokenToHeader } from "./streaming-DsT1B5zJ.mjs";
6
+ import { t as openSseStream } from "./sseStream-Bvpi-UXQ.mjs";
7
7
  import fp from "fastify-plugin";
8
8
  //#region src/plugins/sse.ts
9
9
  var sse_exports = /* @__PURE__ */ __exportAll({
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
- import { n as forwardedStreamHeaders } from "./streaming-DPZdQmDz.mjs";
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
+ import { n as forwardedStreamHeaders } from "./streaming-DsT1B5zJ.mjs";
3
3
  //#region src/utils/sseStream.ts
4
4
  /**
5
5
  * Take over the reply socket and open an SSE stream. Call ONLY after every
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
2
  //#region src/utils/store-helpers.ts
3
3
  /**
4
4
  * Classify an error thrown by `getOne` / `getById` / `update` as a
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
2
  import { Readable } from "node:stream";
3
3
  //#region src/utils/streaming.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
- import { n as createEvent } from "./EventTransport-BV10D0oG.mjs";
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
+ import { r as createEvent } from "./EventTransport-tq4CEB-q.mjs";
3
3
  //#region src/events/defineEvent.ts
4
4
  /**
5
5
  * defineEvent — Typed Event Definitions with Optional Schema Validation
@@ -1,3 +1,3 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
2
  import { CursorExpiredError, MemoryChangeLogStore } from "@classytic/repo-core/sync";
3
3
  export { CursorExpiredError, MemoryChangeLogStore };
@@ -1,5 +1,5 @@
1
1
 
2
- import { D as CleanupRunStore } from "../types-C4QE8qnm.mjs";
2
+ import { D as CleanupRunStore } from "../types-DVLddu2q.mjs";
3
3
  //#region src/testing/cleanupStoreContract.d.ts
4
4
  interface CleanupRunStoreContractSetupResult {
5
5
  store: CleanupRunStore;
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
2
  import { afterAll, beforeAll, describe, expect, it } from "vitest";
3
3
  //#region src/testing/cleanupStoreContract.ts
4
4
  /**
@@ -50,6 +50,8 @@ function plan(recipeId) {
50
50
  rebuildActions: [],
51
51
  warnings: [],
52
52
  estimatedTotal: 1,
53
+ protectedTotal: 0,
54
+ excludeSteps: [],
53
55
  confirmationPhrase: recipeId,
54
56
  digest: `digest-${recipeId}`
55
57
  };
@@ -1,14 +1,14 @@
1
1
 
2
- import { V as ResourceDefinition } from "../index-CpzxqePp.mjs";
3
2
  import { i as RequestScope } from "../types-ChuShpCP.mjs";
4
- import { l as AnyRecord, r as PermissionCheck } from "../types-B7XeLEgK.mjs";
5
- import { n as ArcModuleInput, o as ModuleDisposer, s as ModuleSetupContext } from "../types-CT5vu6M0.mjs";
6
- import "../index-ZWhLTp_s.mjs";
7
- import { n as preloadResourcesAsync, r as CreateAppOptions, t as preloadResources } from "../preloadResources-T1hmlTEZ.mjs";
3
+ import { l as PermissionCheck, t as AnyRecord } from "../base-Csjc2oF-.mjs";
4
+ import { V as ResourceDefinition } from "../index-BcR2bFZQ.mjs";
5
+ import { n as ArcModuleInput, o as ModuleDisposer, s as ModuleSetupContext } from "../types-BcTumAz_.mjs";
6
+ import "../index-C5NnMEKF.mjs";
7
+ import { n as preloadResourcesAsync, r as CreateAppOptions, t as preloadResources } from "../preloadResources-g07ldtzh.mjs";
8
8
  import { StorageContractSetup, StorageContractSetupResult, runStorageContract } from "./storageContract.mjs";
9
+ import { StandardRepo } from "@classytic/repo-core/repository";
9
10
  import { FastifyInstance, FastifyServerOptions } from "fastify";
10
11
  import { Mock } from "vitest";
11
- import { StandardRepo } from "@classytic/repo-core/repository";
12
12
  //#region src/testing/assertions.d.ts
13
13
  /**
14
14
  * expectArc — Arc-specific response assertions
@@ -611,15 +611,27 @@ declare function createMockRequest(overrides?: Partial<AnyRecord>): unknown;
611
611
  */
612
612
  declare function createMockReply(): unknown;
613
613
  /**
614
- * Create a mock controller for testing
614
+ * Create a mock controller for testing.
615
+ *
616
+ * The return type is ANNOTATED rather than inferred, and writing it out IS the
617
+ * fix: inference expands `Mock`'s default type argument to `Procedure`, which
618
+ * vitest declares in an internal sub-package arc does not depend on. The
619
+ * emitted declaration then referenced that package by name — resolvable under
620
+ * npm's hoisting because `vitest` (a real peer) drags it in, and broken under
621
+ * pnpm's strict layout, where a transitive dep is not reachable from a
622
+ * consumer's root.
623
+ *
624
+ * Bare `Mock` keeps the permissive ergonomics (`.mockResolvedValue(...)`, any
625
+ * arguments) while naming only `vitest`, which arc does declare. Same shape
626
+ * `MockRepository` above uses.
615
627
  */
616
628
  declare function createMockController(repository: StandardRepo<AnyRecord>): {
617
629
  repository: StandardRepo<AnyRecord>;
618
- list: Mock<import("@vitest/spy").Procedure>;
619
- get: Mock<import("@vitest/spy").Procedure>;
620
- create: Mock<import("@vitest/spy").Procedure>;
621
- update: Mock<import("@vitest/spy").Procedure>;
622
- delete: Mock<import("@vitest/spy").Procedure>;
630
+ list: Mock;
631
+ get: Mock;
632
+ create: Mock;
633
+ update: Mock;
634
+ delete: Mock;
623
635
  };
624
636
  /**
625
637
  * Create mock data factory
@@ -1,13 +1,13 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
- import { t as CRUD_OPERATIONS } from "../constants-J99LGTJI.mjs";
3
- import { g as getUserId } from "../types-DXYX7dIR.mjs";
4
- import { t as BaseController } from "../BaseController-Dk34dxhI.mjs";
5
- import { t as defineResource } from "../defineResource-XFPPUu2c.mjs";
6
- import { t as defineAggregation } from "../defineAggregation-gX4No1gt.mjs";
7
- import { E as requireOrgRole } from "../permissions-Dl_m0NCe.mjs";
8
- import { n as createApp } from "../createApp-Bv0m-Q6_.mjs";
9
- import { n as getModuleExports } from "../module-Br81am6m.mjs";
10
- import { n as preloadResourcesAsync, t as preloadResources } from "../preloadResources-CDs87fTw.mjs";
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
+ import { t as CRUD_OPERATIONS } from "../constants-BxCoxmiN.mjs";
3
+ import { g as getUserId } from "../types-CoqIRrkY.mjs";
4
+ import { t as BaseController } from "../BaseController-CbkuhNI2.mjs";
5
+ import { t as defineResource } from "../defineResource-ZhuLonLm.mjs";
6
+ import { t as defineAggregation } from "../defineAggregation-Nv-DwfOf.mjs";
7
+ import { E as requireOrgRole } from "../permissions-CP47jdi7.mjs";
8
+ import { r as createApp } from "../createApp-zR-DEesr.mjs";
9
+ import { n as getModuleExports } from "../module-CwKsgZXp.mjs";
10
+ import { n as preloadResourcesAsync, t as preloadResources } from "../preloadResources-BkyqeTDz.mjs";
11
11
  import { runStorageContract } from "./storageContract.mjs";
12
12
  import Fastify from "fastify";
13
13
  import { afterAll, describe, expect, it, vi } from "vitest";
@@ -251,7 +251,19 @@ function createMockReply() {
251
251
  };
252
252
  }
253
253
  /**
254
- * Create a mock controller for testing
254
+ * Create a mock controller for testing.
255
+ *
256
+ * The return type is ANNOTATED rather than inferred, and writing it out IS the
257
+ * fix: inference expands `Mock`'s default type argument to `Procedure`, which
258
+ * vitest declares in an internal sub-package arc does not depend on. The
259
+ * emitted declaration then referenced that package by name — resolvable under
260
+ * npm's hoisting because `vitest` (a real peer) drags it in, and broken under
261
+ * pnpm's strict layout, where a transitive dep is not reachable from a
262
+ * consumer's root.
263
+ *
264
+ * Bare `Mock` keeps the permissive ergonomics (`.mockResolvedValue(...)`, any
265
+ * arguments) while naming only `vitest`, which arc does declare. Same shape
266
+ * `MockRepository` above uses.
255
267
  */
256
268
  function createMockController(repository) {
257
269
  return {
@@ -1493,7 +1505,7 @@ function pickDefaultAuth(authMode, callerAuth) {
1493
1505
  };
1494
1506
  }
1495
1507
  async function createTestApp(options = {}) {
1496
- const { createApp } = await import("../createApp-Bv0m-Q6_.mjs").then((n) => n.r);
1508
+ const { createApp } = await import("../createApp-zR-DEesr.mjs").then((n) => n.i);
1497
1509
  const { resources = [], db = "in-memory", connectMongoose = false, authMode = "jwt", defaultOrgId, plugins, auth: callerAuth, ...appOptions } = options;
1498
1510
  let dbHandle;
1499
1511
  let dbUri;
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
2
  import { OutboxOwnershipError } from "@classytic/primitives/outbox";
3
3
  import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest";
4
4
  //#region src/testing/outboxStoreContract.ts
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
2
  import { afterAll, beforeAll, describe, expect, it } from "vitest";
3
3
  //#region src/testing/storageContract.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  //#region src/context/transactionContext.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
2
  //#region src/utils/typeGuards.ts
3
3
  /** Check if fastify has the events plugin registered */
4
4
  function hasEvents(instance) {
@@ -1,6 +1,6 @@
1
1
 
2
- import { $ as OpenApiSchemas, A as RequestIdOptions, An as BaseControllerOptions, At as RouteDefinition, Bt as RawRouteHandler, C as RequestContext, D as HealthCheck, Dt as ActionEntry, E as GracefulShutdownOptions, Et as ActionDefinition, F as FastifyWithDecorators, Ft as ControllerLike, G as OnTenantDeleteConfig, Gt as Authenticator, H as CrudController, I as MiddlewareHandler, It as FastifyHandler, J as PresetHook, Jt as TokenPair, K as ResolvedTenantPurge, Kt as AuthenticatorContext, L as RequestWithExtras, Lt as IController, M as EventsDecorator, Mt as RouteMethod, N as FastifyRequestExtras, Nt as RateLimitConfig, O as HealthOptions, Ot as ActionHandlerFn, P as FastifyWithAuth, Pt as ControllerHandler, Q as MiddlewareConfig, Rt as IControllerResponse, S as QueryParserInterface, T as CrudRouterOptions, Tt as ResourceCacheConfig, U as ResourceConfig, Ut as AuthHelpers, Vt as RouteHandler, W as ResourcePermissions, Wt as AuthPluginOptions, X as CrudRouteKey, Y as PresetResult, Z as CrudSchemas, _ as ControllerQueryOptions, a as InferAdapterDoc, at as ResourceExtensions, b as ParsedQuery, c as TypedController, d as PaginationResult, et as RouteSchemaOptions, f as IntrospectionData, g as ArcInternalMetadata, h as ResourceMetadata, i as ValidationResult, it as ResourceHooks, j as ArcDecorator, jt as RouteMcpConfig, k as IntrospectionPluginOptions, kt as ActionsMap, l as TypedRepository, m as RegistryStats, n as ConfigError, nt as FieldRule, o as InferDocType, ot as EventDefinition, p as RegistryEntry, q as PresetFunction, qt as JwtContext, r as ValidateOptions, rt as ResourceHookContext, s as InferResourceDoc, t as RouteHandlerMethod, tt as ArcFieldRule, u as TypedResourceConfig, v as LookupOption, w as ServiceContext, x as PopulateOption, y as OwnershipCheck, zt as IRequestContext } from "../index-CpzxqePp.mjs";
3
2
  import { i as RequestScope } from "../types-ChuShpCP.mjs";
4
- import { a as UserBase, d as JWTPayload, f as ObjectId, i as PermissionContext, l as AnyRecord, m as UserOrganization, n as DataPolicy, p as UserLike, r as PermissionCheck, t as AuthorizationDecision, u as ArcRequest } from "../types-B7XeLEgK.mjs";
3
+ import { a as UserLike, c as DataPolicy, d as UserBase, i as ObjectId, l as PermissionCheck, n as ArcRequest, o as UserOrganization, r as JWTPayload, s as AuthorizationDecision, t as AnyRecord, u as PermissionContext } from "../base-Csjc2oF-.mjs";
4
+ import { $ as OpenApiSchemas, A as RequestIdOptions, An as WriteVerbKey, At as RouteDefinition, C as RequestContext, D as HealthCheck, Dn as MutationWriteContext, Dt as ActionEntry, E as GracefulShutdownOptions, Et as ActionDefinition, F as FastifyWithDecorators, Fn as IControllerResponse, Ft as AuthPluginOptions, G as OnTenantDeleteConfig, H as CrudController, I as MiddlewareHandler, In as IRequestContext, It as Authenticator, J as PresetHook, K as ResolvedTenantPurge, L as RequestWithExtras, Ln as RawRouteHandler, Lt as AuthenticatorContext, M as EventsDecorator, Mn as ControllerLike, Mt as RouteMethod, N as FastifyRequestExtras, Nn as FastifyHandler, Nt as RateLimitConfig, O as HealthOptions, On as ResourceWrites, Ot as ActionHandlerFn, P as FastifyWithAuth, Pn as IController, Pt as AuthHelpers, Q as MiddlewareConfig, Rn as RouteHandler, Rt as JwtContext, S as QueryParserInterface, T as CrudRouterOptions, Tt as ResourceCacheConfig, U as ResourceConfig, W as ResourcePermissions, X as CrudRouteKey, Y as PresetResult, Z as CrudSchemas, _ as ControllerQueryOptions, a as InferAdapterDoc, at as ResourceExtensions, b as ParsedQuery, c as TypedController, d as PaginationResult, et as RouteSchemaOptions, f as IntrospectionData, g as ArcInternalMetadata, h as ResourceMetadata, i as ValidationResult, it as ResourceHooks, j as ArcDecorator, jn as ControllerHandler, jt as RouteMcpConfig, k as IntrospectionPluginOptions, kn as WriteContext, kt as ActionsMap, l as TypedRepository, m as RegistryStats, n as ConfigError, nt as FieldRule, o as InferDocType, ot as EventDefinition, p as RegistryEntry, q as PresetFunction, r as ValidateOptions, rt as ResourceHookContext, s as InferResourceDoc, t as RouteHandlerMethod, tt as ArcFieldRule, u as TypedResourceConfig, v as LookupOption, w as ServiceContext, x as PopulateOption, xn as BaseControllerOptions, y as OwnershipCheck, zt as TokenPair } from "../index-BcR2bFZQ.mjs";
5
5
  import { n as ElevationOptions, t as ElevationEvent } from "../elevation-BXCfVcNG.mjs";
6
- export type { ActionDefinition, ActionEntry, ActionHandlerFn, ActionsMap, AnyRecord, ArcDecorator, ArcFieldRule, ArcInternalMetadata, ArcRequest, AuthHelpers, AuthPluginOptions, Authenticator, AuthenticatorContext, AuthorizationDecision, BaseControllerOptions, ConfigError, ControllerHandler, ControllerLike, ControllerQueryOptions, CrudController, CrudRouteKey, CrudRouterOptions, CrudSchemas, DataPolicy, ElevationEvent, ElevationOptions, EventDefinition, EventsDecorator, FastifyHandler, FastifyRequestExtras, FastifyWithAuth, FastifyWithDecorators, FieldRule, GracefulShutdownOptions, HealthCheck, HealthOptions, IController, IControllerResponse, IRequestContext, InferAdapterDoc, InferDocType, InferResourceDoc, IntrospectionData, IntrospectionPluginOptions, JWTPayload, JwtContext, LookupOption, MiddlewareConfig, MiddlewareHandler, ObjectId, OnTenantDeleteConfig, OpenApiSchemas, OwnershipCheck, PaginationResult, ParsedQuery, PermissionCheck, PermissionContext, PopulateOption, PresetFunction, PresetHook, PresetResult, QueryParserInterface, RateLimitConfig, RawRouteHandler, RegistryEntry, RegistryStats, RequestContext, RequestIdOptions, RequestScope, RequestWithExtras, ResolvedTenantPurge, ResourceCacheConfig, ResourceConfig, ResourceExtensions, ResourceHookContext, ResourceHooks, ResourceMetadata, ResourcePermissions, RouteDefinition, RouteHandler, RouteHandlerMethod, RouteMcpConfig, RouteMethod, RouteSchemaOptions, ServiceContext, TokenPair, TypedController, TypedRepository, TypedResourceConfig, UserBase, UserLike, UserOrganization, ValidateOptions, ValidationResult };
6
+ export type { ActionDefinition, ActionEntry, ActionHandlerFn, ActionsMap, AnyRecord, ArcDecorator, ArcFieldRule, ArcInternalMetadata, ArcRequest, AuthHelpers, AuthPluginOptions, Authenticator, AuthenticatorContext, AuthorizationDecision, BaseControllerOptions, ConfigError, ControllerHandler, ControllerLike, ControllerQueryOptions, CrudController, CrudRouteKey, CrudRouterOptions, CrudSchemas, DataPolicy, ElevationEvent, ElevationOptions, EventDefinition, EventsDecorator, FastifyHandler, FastifyRequestExtras, FastifyWithAuth, FastifyWithDecorators, FieldRule, GracefulShutdownOptions, HealthCheck, HealthOptions, IController, IControllerResponse, IRequestContext, InferAdapterDoc, InferDocType, InferResourceDoc, IntrospectionData, IntrospectionPluginOptions, JWTPayload, JwtContext, LookupOption, MiddlewareConfig, MiddlewareHandler, MutationWriteContext, ObjectId, OnTenantDeleteConfig, OpenApiSchemas, OwnershipCheck, PaginationResult, ParsedQuery, PermissionCheck, PermissionContext, PopulateOption, PresetFunction, PresetHook, PresetResult, QueryParserInterface, RateLimitConfig, RawRouteHandler, RegistryEntry, RegistryStats, RequestContext, RequestIdOptions, RequestScope, RequestWithExtras, ResolvedTenantPurge, ResourceCacheConfig, ResourceConfig, ResourceExtensions, ResourceHookContext, ResourceHooks, ResourceMetadata, ResourcePermissions, ResourceWrites, RouteDefinition, RouteHandler, RouteHandlerMethod, RouteMcpConfig, RouteMethod, RouteSchemaOptions, ServiceContext, TokenPair, TypedController, TypedRepository, TypedResourceConfig, UserBase, UserLike, UserOrganization, ValidateOptions, ValidationResult, WriteContext, WriteVerbKey };
@@ -1,2 +1,2 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
2
  export {};
@@ -1,2 +1,2 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
2
  export {};
@@ -1,6 +1,6 @@
1
1
 
2
- import { n as DomainEvent, r as EventHandler } from "./EventTransport-2uVV34WU.mjs";
3
- import { n as ErrorMapper } from "./errorHandler-CpYUJmPA.mjs";
2
+ import { n as DomainEvent, r as EventHandler } from "./EventTransport-BEVP50ka.mjs";
3
+ import { n as ErrorMapper } from "./errorHandler-DI5AN2b5.mjs";
4
4
  import { FastifyInstance, FastifyPluginAsync } from "fastify";
5
5
  import { LockAdapter } from "@classytic/repo-core/lock";
6
6
  //#region src/plugins/health.d.ts
@@ -49,6 +49,12 @@ interface ScheduleDefinition {
49
49
  handler: (fastify: FastifyInstance) => void | Promise<void>;
50
50
  /** Fire once immediately when the app becomes ready (default: false). */
51
51
  runOnStart?: boolean;
52
+ /**
53
+ * Topology tag: `'relay'` marks an arm a `role: 'relay'` process runs
54
+ * (outbox relays); everything else is `'job'` (default). See
55
+ * `CreateAppOptions.role`.
56
+ */
57
+ kind?: "relay" | "job";
52
58
  /**
53
59
  * Random extra delay in `[0, jitterMs)` added to the FIRST tick only.
54
60
  * Spreads boot-aligned jobs so multiple same-cadence schedules don't all
@@ -440,11 +446,39 @@ interface ArcModule<TExports = unknown> {
440
446
  */
441
447
  readonly dependsOn?: readonly string[];
442
448
  /**
443
- * Fastify plugins / decorators this module needs — the module-level analog
444
- * of the app's `plugins()` slot. Runs in the plugins phase: AFTER the app's
445
- * own `plugins()` (so module infra can build on app foundations like a DB
446
- * connection) and in `dependsOn` order, but BEFORE any module `bootstrap` —
447
- * so engines initialised in `bootstrap` can rely on what's registered here.
449
+ * Infra SETUP function — the module-level analog of the app's `plugins()`
450
+ * slot. Runs in the plugins phase: AFTER the app's own `plugins()` (so
451
+ * module infra can build on app foundations like a DB connection) and in
452
+ * `dependsOn` order, but BEFORE any module `bootstrap` — so engines
453
+ * initialised in `bootstrap` can rely on what's registered here.
454
+ *
455
+ * ## ⚠ This is NOT itself a Fastify plugin
456
+ *
457
+ * Despite the name, arc CALLS this function directly — it is never handed
458
+ * to `fastify.register()`. Two consequences, both of which bite module
459
+ * authors coming from ordinary Fastify plugins:
460
+ *
461
+ * - **You must register plugins yourself.** `await fastify.register(x)`,
462
+ * not `return x`. A returned function is read as a DISPOSER (below),
463
+ * so returning a plugin silently registers nothing and then invokes
464
+ * your plugin as a teardown callback. Arc detects the `fastify-plugin`
465
+ * case and throws; the bare-function case warns.
466
+ * - **There is no encapsulation and no prefix here.** Decorators and
467
+ * hooks you add land on the instance arc passes you — the same
468
+ * instance every other module sees. Fastify's encapsulation applies
469
+ * only inside a `register()` call you make yourself. See
470
+ * https://fastify.dev/docs/latest/Reference/Plugins/
471
+ *
472
+ * ```ts
473
+ * plugins: async (fastify) => {
474
+ * await fastify.register(somePlugin, { prefix: '/x' }); // ✅ register
475
+ * fastify.decorate('thing', thing); // ✅ root-visible
476
+ * // return somePlugin // ❌ never registered
477
+ * },
478
+ * ```
479
+ *
480
+ * The name is kept for the 2.x line; v3 renames the slot to `setup` and
481
+ * REMOVES `plugins` outright — v3 ships no compatibility aliases (v3.md).
448
482
  *
449
483
  * Separating this from `bootstrap` keeps lifecycle intent explicit for
450
484
  * published ecosystem packages: `plugins` = "register infra"; `bootstrap` =
@@ -1,5 +1,5 @@
1
1
 
2
- import { V as ResourceDefinition } from "./index-CpzxqePp.mjs";
2
+ import { V as ResourceDefinition } from "./index-BcR2bFZQ.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/integrations/mcp/types.d.ts
5
5
  /** Behavioral hints for MCP clients (tool annotations per MCP spec) */
@@ -377,6 +377,20 @@ interface McpAuthResult {
377
377
  * Carried on the `service` RequestScope for fine-grained permission checks.
378
378
  */
379
379
  scopes?: readonly string[];
380
+ /**
381
+ * Active team — carried onto a `member` scope so `getTeamId()` answers the
382
+ * same on MCP as on HTTP. Member-only, like the HTTP surface.
383
+ */
384
+ teamId?: string;
385
+ /**
386
+ * Host-defined scope dimensions (`branchId`, `projectId`, `region`, …),
387
+ * carried onto `member` / `service` scopes.
388
+ *
389
+ * Declared explicitly because `requireScopeContext()` AUTHORISES against
390
+ * these: a resource gated on `branchId` denies every MCP call until the
391
+ * resolver supplies it. Non-string entries are dropped rather than coerced.
392
+ */
393
+ context?: Record<string, string>;
380
394
  /** Any extra metadata from the auth resolver */
381
395
  [key: string]: unknown;
382
396
  }
@@ -1,7 +1,7 @@
1
- /*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
2
- import { l as UnauthorizedError, o as OrgRequiredError } from "./errors-Bh1KK5ps.mjs";
3
- import { n as requireSingleHeaderValue } from "./headers-BXjQYbeC.mjs";
4
- import { t as getUserId$1 } from "./userHelpers-BNsOXzOd.mjs";
1
+ /*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
2
+ import { l as UnauthorizedError, o as OrgRequiredError } from "./errors-Cd_yy7aW.mjs";
3
+ import { n as requireSingleHeaderValue } from "./headers-CveNO9gR.mjs";
4
+ import { t as getUserId$1 } from "./userHelpers-CWF5pbZD.mjs";
5
5
  //#region src/scope/types.ts
6
6
  /**
7
7
  * Request Scope — The One Standard