@wildo-ai/saas-specifications 1.1.2 → 1.1.3

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 (410) hide show
  1. package/dist/esm/_core/brand/brand-asset.schemas.d.ts +4 -6
  2. package/dist/esm/_core/brand/brand-asset.schemas.d.ts.map +1 -1
  3. package/dist/esm/_core/brand/brand-asset.schemas.js +4 -12
  4. package/dist/esm/_core/brand/brand-asset.schemas.js.map +1 -1
  5. package/dist/esm/_core/brand/brand-generation.schemas.d.ts +5 -3
  6. package/dist/esm/_core/brand/brand-generation.schemas.d.ts.map +1 -1
  7. package/dist/esm/_core/brand/brand-generation.schemas.js +5 -2
  8. package/dist/esm/_core/brand/brand-generation.schemas.js.map +1 -1
  9. package/dist/esm/_core/brand/brand-snapshot.schemas.d.ts +10 -3
  10. package/dist/esm/_core/brand/brand-snapshot.schemas.d.ts.map +1 -1
  11. package/dist/esm/_core/brand/brand-snapshot.schemas.js +10 -2
  12. package/dist/esm/_core/brand/brand-snapshot.schemas.js.map +1 -1
  13. package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.d.ts.map +1 -1
  14. package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.js +15 -5
  15. package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.js.map +1 -1
  16. package/dist/esm/_core/build-plan/build-plan-task-graph-validation.d.ts +40 -3
  17. package/dist/esm/_core/build-plan/build-plan-task-graph-validation.d.ts.map +1 -1
  18. package/dist/esm/_core/build-plan/build-plan-task-graph-validation.js +85 -6
  19. package/dist/esm/_core/build-plan/build-plan-task-graph-validation.js.map +1 -1
  20. package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.d.ts.map +1 -1
  21. package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.js +10 -4
  22. package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.js.map +1 -1
  23. package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.d.ts +15 -0
  24. package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.d.ts.map +1 -1
  25. package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.js.map +1 -1
  26. package/dist/esm/_core/compliance-documents/compliance-document-candidate.schemas.d.ts +10 -0
  27. package/dist/esm/_core/compliance-documents/compliance-document-candidate.schemas.d.ts.map +1 -1
  28. package/dist/esm/_core/compliance-documents/compliance-document-candidate.schemas.js +17 -0
  29. package/dist/esm/_core/compliance-documents/compliance-document-candidate.schemas.js.map +1 -1
  30. package/dist/esm/_core/expert-personas/expert-persona-charter.schemas.d.ts +6 -7
  31. package/dist/esm/_core/expert-personas/expert-persona-charter.schemas.d.ts.map +1 -1
  32. package/dist/esm/_core/expert-personas/expert-persona-charter.schemas.js +6 -13
  33. package/dist/esm/_core/expert-personas/expert-persona-charter.schemas.js.map +1 -1
  34. package/dist/esm/_core/expert-personas/expert-persona-validation.d.ts +0 -11
  35. package/dist/esm/_core/expert-personas/expert-persona-validation.d.ts.map +1 -1
  36. package/dist/esm/_core/expert-personas/expert-persona-validation.js +0 -19
  37. package/dist/esm/_core/expert-personas/expert-persona-validation.js.map +1 -1
  38. package/dist/esm/_core/expert-personas/expert-role-template.schemas.d.ts +1 -2
  39. package/dist/esm/_core/expert-personas/expert-role-template.schemas.d.ts.map +1 -1
  40. package/dist/esm/_core/expert-personas/expert-role-template.schemas.js +1 -2
  41. package/dist/esm/_core/expert-personas/expert-role-template.schemas.js.map +1 -1
  42. package/dist/esm/_core/feature-drafts/feature-specification-drafts-generation.schemas.d.ts.map +1 -1
  43. package/dist/esm/_core/feature-drafts/feature-specification-drafts-generation.schemas.js +17 -4
  44. package/dist/esm/_core/feature-drafts/feature-specification-drafts-generation.schemas.js.map +1 -1
  45. package/dist/esm/_core/index.d.ts +1 -0
  46. package/dist/esm/_core/index.d.ts.map +1 -1
  47. package/dist/esm/_core/index.js +1 -0
  48. package/dist/esm/_core/index.js.map +1 -1
  49. package/dist/esm/_core/market/market-snapshot-generation.schemas.d.ts.map +1 -1
  50. package/dist/esm/_core/market/market-snapshot-generation.schemas.js +5 -40
  51. package/dist/esm/_core/market/market-snapshot-generation.schemas.js.map +1 -1
  52. package/dist/esm/_core/market/market-snapshot-validation.d.ts +15 -0
  53. package/dist/esm/_core/market/market-snapshot-validation.d.ts.map +1 -1
  54. package/dist/esm/_core/market/market-snapshot-validation.js.map +1 -1
  55. package/dist/esm/_core/placement-plan/placement-plan-generation.schemas.d.ts.map +1 -1
  56. package/dist/esm/_core/placement-plan/placement-plan-generation.schemas.js +11 -5
  57. package/dist/esm/_core/placement-plan/placement-plan-generation.schemas.js.map +1 -1
  58. package/dist/esm/_core/placement-plan/placement-plan-validation.d.ts +66 -9
  59. package/dist/esm/_core/placement-plan/placement-plan-validation.d.ts.map +1 -1
  60. package/dist/esm/_core/placement-plan/placement-plan-validation.js +62 -20
  61. package/dist/esm/_core/placement-plan/placement-plan-validation.js.map +1 -1
  62. package/dist/esm/_core/placement-plan/placement-plan.schemas.d.ts +4 -1
  63. package/dist/esm/_core/placement-plan/placement-plan.schemas.d.ts.map +1 -1
  64. package/dist/esm/_core/placement-plan/placement-plan.schemas.js +4 -1
  65. package/dist/esm/_core/placement-plan/placement-plan.schemas.js.map +1 -1
  66. package/dist/esm/_core/provider-specification.schemas.d.ts +82 -0
  67. package/dist/esm/_core/provider-specification.schemas.d.ts.map +1 -0
  68. package/dist/esm/_core/provider-specification.schemas.js +144 -0
  69. package/dist/esm/_core/provider-specification.schemas.js.map +1 -0
  70. package/dist/esm/_core/requirements/requirements-snapshot-generation.schemas.d.ts.map +1 -1
  71. package/dist/esm/_core/requirements/requirements-snapshot-generation.schemas.js +13 -8
  72. package/dist/esm/_core/requirements/requirements-snapshot-generation.schemas.js.map +1 -1
  73. package/dist/esm/_core/requirements/requirements-snapshot-validation.d.ts +15 -0
  74. package/dist/esm/_core/requirements/requirements-snapshot-validation.d.ts.map +1 -1
  75. package/dist/esm/_core/requirements/requirements-snapshot-validation.js.map +1 -1
  76. package/dist/esm/_core/roadmap/roadmap-snapshot-generation.schemas.d.ts.map +1 -1
  77. package/dist/esm/_core/roadmap/roadmap-snapshot-generation.schemas.js +7 -2
  78. package/dist/esm/_core/roadmap/roadmap-snapshot-generation.schemas.js.map +1 -1
  79. package/dist/esm/_core/roadmap/roadmap-snapshot-validation.d.ts +15 -0
  80. package/dist/esm/_core/roadmap/roadmap-snapshot-validation.d.ts.map +1 -1
  81. package/dist/esm/_core/roadmap/roadmap-snapshot-validation.js.map +1 -1
  82. package/dist/esm/_core/utils/family-ref-stamping.d.ts +64 -0
  83. package/dist/esm/_core/utils/family-ref-stamping.d.ts.map +1 -0
  84. package/dist/esm/_core/utils/family-ref-stamping.js +73 -0
  85. package/dist/esm/_core/utils/family-ref-stamping.js.map +1 -0
  86. package/dist/esm/_core/vision/vision-snapshot-generation.schemas.d.ts.map +1 -1
  87. package/dist/esm/_core/vision/vision-snapshot-generation.schemas.js +23 -9
  88. package/dist/esm/_core/vision/vision-snapshot-generation.schemas.js.map +1 -1
  89. package/dist/esm/application-creation/application-coding-tasks.application-creation.schemas.d.ts +0 -4
  90. package/dist/esm/application-creation/application-coding-tasks.application-creation.schemas.d.ts.map +1 -1
  91. package/dist/esm/application-creation/application-document-fact-specification.application-creation.schemas.d.ts +7 -7
  92. package/dist/esm/application-creation/application-document-fact-specification.application-creation.schemas.d.ts.map +1 -1
  93. package/dist/esm/application-creation/application-document-fact-specification.application-creation.schemas.js +6 -7
  94. package/dist/esm/application-creation/application-document-fact-specification.application-creation.schemas.js.map +1 -1
  95. package/dist/esm/application-creation/application-document-release-policy-specification.application-creation.schemas.d.ts +3 -3
  96. package/dist/esm/application-creation/application-document-release-policy-specification.application-creation.schemas.js +3 -3
  97. package/dist/esm/application-creation/application-document-release-policy-specification.application-creation.schemas.js.map +1 -1
  98. package/dist/esm/application-creation/application-specification-family-identity.application-creation.schemas.d.ts +2 -2
  99. package/dist/esm/application-creation/application-specification-family-identity.application-creation.schemas.js +2 -2
  100. package/dist/esm/application-creation/application-specification-family-identity.application-creation.schemas.js.map +1 -1
  101. package/dist/esm/application-creation/journey.application-creation.schemas.d.ts +18 -6
  102. package/dist/esm/application-creation/journey.application-creation.schemas.d.ts.map +1 -1
  103. package/dist/esm/application-creation/journey.application-creation.schemas.js +18 -6
  104. package/dist/esm/application-creation/journey.application-creation.schemas.js.map +1 -1
  105. package/dist/esm/application-creation/playbooks.application-creation.schemas.d.ts +8 -23
  106. package/dist/esm/application-creation/playbooks.application-creation.schemas.d.ts.map +1 -1
  107. package/dist/esm/application-creation/playbooks.application-creation.schemas.js +57 -27
  108. package/dist/esm/application-creation/playbooks.application-creation.schemas.js.map +1 -1
  109. package/dist/esm/assurance/application-document-publication.schemas.d.ts +20 -6
  110. package/dist/esm/assurance/application-document-publication.schemas.d.ts.map +1 -1
  111. package/dist/esm/assurance/application-document-publication.schemas.js +26 -10
  112. package/dist/esm/assurance/application-document-publication.schemas.js.map +1 -1
  113. package/dist/esm/assurance/assurance-authority-basis.definitions.d.ts +72 -49
  114. package/dist/esm/assurance/assurance-authority-basis.definitions.d.ts.map +1 -1
  115. package/dist/esm/assurance/assurance-authority-basis.definitions.js +161 -60
  116. package/dist/esm/assurance/assurance-authority-basis.definitions.js.map +1 -1
  117. package/dist/esm/assurance/assurance-authority-basis.schemas.d.ts +25 -0
  118. package/dist/esm/assurance/assurance-authority-basis.schemas.d.ts.map +1 -1
  119. package/dist/esm/assurance/assurance-evidence-requirement-bodies.definitions.d.ts +36 -0
  120. package/dist/esm/assurance/assurance-evidence-requirement-bodies.definitions.d.ts.map +1 -0
  121. package/dist/esm/assurance/assurance-evidence-requirement-bodies.definitions.js +859 -0
  122. package/dist/esm/assurance/assurance-evidence-requirement-bodies.definitions.js.map +1 -0
  123. package/dist/esm/assurance/assurance-foundation.schemas.d.ts +43 -0
  124. package/dist/esm/assurance/assurance-foundation.schemas.d.ts.map +1 -1
  125. package/dist/esm/assurance/assurance-foundation.schemas.js +56 -0
  126. package/dist/esm/assurance/assurance-foundation.schemas.js.map +1 -1
  127. package/dist/esm/assurance/assurance-objective-catalog.definitions.d.ts +14 -7
  128. package/dist/esm/assurance/assurance-objective-catalog.definitions.d.ts.map +1 -1
  129. package/dist/esm/assurance/assurance-objective-catalog.definitions.js +24 -7
  130. package/dist/esm/assurance/assurance-objective-catalog.definitions.js.map +1 -1
  131. package/dist/esm/assurance/assurance-program-generation.schemas.d.ts +8 -1
  132. package/dist/esm/assurance/assurance-program-generation.schemas.d.ts.map +1 -1
  133. package/dist/esm/assurance/assurance-program-generation.schemas.js +10 -2
  134. package/dist/esm/assurance/assurance-program-generation.schemas.js.map +1 -1
  135. package/dist/esm/assurance/assurance-program.schemas.d.ts +447 -11
  136. package/dist/esm/assurance/assurance-program.schemas.d.ts.map +1 -1
  137. package/dist/esm/assurance/assurance-program.schemas.js +293 -5
  138. package/dist/esm/assurance/assurance-program.schemas.js.map +1 -1
  139. package/dist/esm/assurance/assurance-verification-requirement-bodies.definitions.d.ts +35 -0
  140. package/dist/esm/assurance/assurance-verification-requirement-bodies.definitions.d.ts.map +1 -0
  141. package/dist/esm/assurance/assurance-verification-requirement-bodies.definitions.js +999 -0
  142. package/dist/esm/assurance/assurance-verification-requirement-bodies.definitions.js.map +1 -0
  143. package/dist/esm/companion-exports.d.ts +7 -6
  144. package/dist/esm/companion-exports.d.ts.map +1 -1
  145. package/dist/esm/companion-exports.js.map +1 -1
  146. package/dist/esm/engine/_bootstrap.js +3 -1
  147. package/dist/esm/engine/_bootstrap.js.map +1 -1
  148. package/dist/esm/engine/applications/resources/application-api-keys.resource.specification.d.ts.map +1 -1
  149. package/dist/esm/engine/applications/resources/application-api-keys.resource.specification.js +13 -1
  150. package/dist/esm/engine/applications/resources/application-api-keys.resource.specification.js.map +1 -1
  151. package/dist/esm/engine/applications/resources/application-metadata.resource.specification.js +1 -1
  152. package/dist/esm/engine/applications/resources/application-metadata.resource.specification.js.map +1 -1
  153. package/dist/esm/engine/applications/resources/application-oauth-clients.resource.specification.d.ts +2 -0
  154. package/dist/esm/engine/applications/resources/application-oauth-clients.resource.specification.d.ts.map +1 -1
  155. package/dist/esm/engine/applications/resources/application-oauth-clients.resource.specification.js +14 -2
  156. package/dist/esm/engine/applications/resources/application-oauth-clients.resource.specification.js.map +1 -1
  157. package/dist/esm/engine/applications/resources/application-versions.resource.specification.js +9 -9
  158. package/dist/esm/engine/applications/resources/application-versions.resource.specification.js.map +1 -1
  159. package/dist/esm/engine/applications/resources/applications.resource.specification.js +1 -1
  160. package/dist/esm/engine/applications/resources/applications.resource.specification.js.map +1 -1
  161. package/dist/esm/engine/auth/resources/consumable-tokens.resource.specification.js +3 -3
  162. package/dist/esm/engine/auth/resources/consumable-tokens.resource.specification.js.map +1 -1
  163. package/dist/esm/engine/auth/resources/oauth-consent-grants.resource.specification.js +1 -1
  164. package/dist/esm/engine/auth/resources/oauth-consent-grants.resource.specification.js.map +1 -1
  165. package/dist/esm/engine/auth/resources/organization-api-keys.resource.specification.d.ts.map +1 -1
  166. package/dist/esm/engine/auth/resources/organization-api-keys.resource.specification.js +13 -1
  167. package/dist/esm/engine/auth/resources/organization-api-keys.resource.specification.js.map +1 -1
  168. package/dist/esm/engine/auth/resources/organization-oauth-clients.resource.specification.d.ts +2 -0
  169. package/dist/esm/engine/auth/resources/organization-oauth-clients.resource.specification.d.ts.map +1 -1
  170. package/dist/esm/engine/auth/resources/organization-oauth-clients.resource.specification.js +14 -2
  171. package/dist/esm/engine/auth/resources/organization-oauth-clients.resource.specification.js.map +1 -1
  172. package/dist/esm/engine/auth/resources/organization-provider-credentials.resource.specification.d.ts +32 -0
  173. package/dist/esm/engine/auth/resources/organization-provider-credentials.resource.specification.d.ts.map +1 -0
  174. package/dist/esm/engine/auth/resources/organization-provider-credentials.resource.specification.js +308 -0
  175. package/dist/esm/engine/auth/resources/organization-provider-credentials.resource.specification.js.map +1 -0
  176. package/dist/esm/engine/auth/resources/platform-access-grants.resource.specification.js +4 -4
  177. package/dist/esm/engine/auth/resources/platform-access-grants.resource.specification.js.map +1 -1
  178. package/dist/esm/engine/auth/resources/scim-provisioning-config.resource.specification.js +2 -2
  179. package/dist/esm/engine/auth/resources/scim-provisioning-config.resource.specification.js.map +1 -1
  180. package/dist/esm/engine/auth/resources/scim-tokens.resource.specification.js +6 -6
  181. package/dist/esm/engine/auth/resources/scim-tokens.resource.specification.js.map +1 -1
  182. package/dist/esm/engine/auth/resources/siem-delivery-dlq.resource.specification.js +9 -9
  183. package/dist/esm/engine/auth/resources/siem-delivery-dlq.resource.specification.js.map +1 -1
  184. package/dist/esm/engine/auth/resources/siem-export-config.resource.specification.js +2 -2
  185. package/dist/esm/engine/auth/resources/siem-export-config.resource.specification.js.map +1 -1
  186. package/dist/esm/engine/auth/resources/sso-config.resource.specification.d.ts +9 -25
  187. package/dist/esm/engine/auth/resources/sso-config.resource.specification.d.ts.map +1 -1
  188. package/dist/esm/engine/auth/resources/sso-config.resource.specification.js +104 -10
  189. package/dist/esm/engine/auth/resources/sso-config.resource.specification.js.map +1 -1
  190. package/dist/esm/engine/auth/resources/sso-connections.resource.specification.d.ts +0 -6
  191. package/dist/esm/engine/auth/resources/sso-connections.resource.specification.d.ts.map +1 -1
  192. package/dist/esm/engine/auth/resources/user-provider-credentials.resource.specification.d.ts +32 -0
  193. package/dist/esm/engine/auth/resources/user-provider-credentials.resource.specification.d.ts.map +1 -0
  194. package/dist/esm/engine/auth/resources/user-provider-credentials.resource.specification.js +297 -0
  195. package/dist/esm/engine/auth/resources/user-provider-credentials.resource.specification.js.map +1 -0
  196. package/dist/esm/engine/billing/resources/billing-accounts.resource.specification.d.ts.map +1 -1
  197. package/dist/esm/engine/billing/resources/billing-accounts.resource.specification.js +4 -3
  198. package/dist/esm/engine/billing/resources/billing-accounts.resource.specification.js.map +1 -1
  199. package/dist/esm/engine/billing/resources/credit-pools.resource.specification.js +2 -2
  200. package/dist/esm/engine/billing/resources/credit-pools.resource.specification.js.map +1 -1
  201. package/dist/esm/engine/billing/resources/invoice-refs.resource.specification.js +3 -3
  202. package/dist/esm/engine/billing/resources/invoice-refs.resource.specification.js.map +1 -1
  203. package/dist/esm/engine/billing/resources/prices.resource.specification.js +7 -7
  204. package/dist/esm/engine/billing/resources/prices.resource.specification.js.map +1 -1
  205. package/dist/esm/engine/billing/resources/products.resource.specification.js +7 -7
  206. package/dist/esm/engine/billing/resources/products.resource.specification.js.map +1 -1
  207. package/dist/esm/engine/billing/resources/promotions.resource.specification.d.ts.map +1 -1
  208. package/dist/esm/engine/billing/resources/promotions.resource.specification.js +14 -12
  209. package/dist/esm/engine/billing/resources/promotions.resource.specification.js.map +1 -1
  210. package/dist/esm/engine/billing/resources/referrals.resource.specification.js +7 -7
  211. package/dist/esm/engine/billing/resources/referrals.resource.specification.js.map +1 -1
  212. package/dist/esm/engine/billing/resources/subscriptions.resource.specification.d.ts.map +1 -1
  213. package/dist/esm/engine/billing/resources/subscriptions.resource.specification.js +6 -3
  214. package/dist/esm/engine/billing/resources/subscriptions.resource.specification.js.map +1 -1
  215. package/dist/esm/engine/billing/resources/usage-records.resource.specification.d.ts +7 -3
  216. package/dist/esm/engine/billing/resources/usage-records.resource.specification.d.ts.map +1 -1
  217. package/dist/esm/engine/billing/resources/usage-records.resource.specification.js +28 -11
  218. package/dist/esm/engine/billing/resources/usage-records.resource.specification.js.map +1 -1
  219. package/dist/esm/engine/compliance/resources/audit-logs.resource.specification.js +8 -8
  220. package/dist/esm/engine/compliance/resources/audit-logs.resource.specification.js.map +1 -1
  221. package/dist/esm/engine/engine-resource-specifications.registry.d.ts +2 -2
  222. package/dist/esm/engine/engine-resource-specifications.registry.d.ts.map +1 -1
  223. package/dist/esm/engine/engine-resource-specifications.registry.js +6 -2
  224. package/dist/esm/engine/engine-resource-specifications.registry.js.map +1 -1
  225. package/dist/esm/engine/engine-resource-sub-domain.d.ts +20 -0
  226. package/dist/esm/engine/engine-resource-sub-domain.d.ts.map +1 -1
  227. package/dist/esm/engine/engine-resource-sub-domain.js +66 -0
  228. package/dist/esm/engine/engine-resource-sub-domain.js.map +1 -1
  229. package/dist/esm/engine/errors/error-messages.specification.d.ts.map +1 -1
  230. package/dist/esm/engine/errors/error-messages.specification.js +14 -0
  231. package/dist/esm/engine/errors/error-messages.specification.js.map +1 -1
  232. package/dist/esm/engine/features/audit-logs.feature.specification.js +4 -4
  233. package/dist/esm/engine/features/audit-logs.feature.specification.js.map +1 -1
  234. package/dist/esm/engine/features/core-limits.feature.specifications.js +7 -7
  235. package/dist/esm/engine/features/core-limits.feature.specifications.js.map +1 -1
  236. package/dist/esm/engine/features/resources/application-features.resource.specification.js +3 -3
  237. package/dist/esm/engine/features/resources/application-features.resource.specification.js.map +1 -1
  238. package/dist/esm/engine/features/resources/organization-features.resource.specification.js +3 -3
  239. package/dist/esm/engine/features/resources/organization-features.resource.specification.js.map +1 -1
  240. package/dist/esm/engine/features/resources/user-features.resource.specification.js +3 -3
  241. package/dist/esm/engine/features/resources/user-features.resource.specification.js.map +1 -1
  242. package/dist/esm/engine/files/resources/files.resource.specification.js +10 -10
  243. package/dist/esm/engine/files/resources/files.resource.specification.js.map +1 -1
  244. package/dist/esm/engine/flows-actors/resources/a2a-push-delivery-log.resource.specification.js +11 -11
  245. package/dist/esm/engine/flows-actors/resources/a2a-push-delivery-log.resource.specification.js.map +1 -1
  246. package/dist/esm/engine/flows-actors/resources/a2a-token-budget-state.resource.specification.js +4 -4
  247. package/dist/esm/engine/flows-actors/resources/a2a-token-budget-state.resource.specification.js.map +1 -1
  248. package/dist/esm/engine/flows-actors/resources/flow-actor-executions.resource.specification.js +2 -2
  249. package/dist/esm/engine/flows-actors/resources/flow-actor-executions.resource.specification.js.map +1 -1
  250. package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.d.ts +5 -0
  251. package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.d.ts.map +1 -0
  252. package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.js +81 -0
  253. package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.js.map +1 -0
  254. package/dist/esm/engine/frontend-components/app/public-layout-file-upload-grant.frontend-component.specification.d.ts +4 -0
  255. package/dist/esm/engine/frontend-components/app/public-layout-file-upload-grant.frontend-component.specification.d.ts.map +1 -0
  256. package/dist/esm/engine/frontend-components/app/public-layout-file-upload-grant.frontend-component.specification.js +22 -0
  257. package/dist/esm/engine/frontend-components/app/public-layout-file-upload-grant.frontend-component.specification.js.map +1 -0
  258. package/dist/esm/engine/frontend-components/billing/billing-plan-change-preview.frontend-component.specification.d.ts +0 -4
  259. package/dist/esm/engine/frontend-components/billing/billing-plan-change-preview.frontend-component.specification.d.ts.map +0 -1
  260. package/dist/esm/engine/frontend-components/billing/billing-plan-change-preview.frontend-component.specification.js +0 -21
  261. package/dist/esm/engine/frontend-components/billing/billing-plan-change-preview.frontend-component.specification.js.map +0 -1
  262. package/dist/esm/engine/frontend-components/billing/billing-promotion-code-input.frontend-component.specification.d.ts +0 -4
  263. package/dist/esm/engine/frontend-components/billing/billing-promotion-code-input.frontend-component.specification.d.ts.map +0 -1
  264. package/dist/esm/engine/frontend-components/billing/billing-promotion-code-input.frontend-component.specification.js +0 -21
  265. package/dist/esm/engine/frontend-components/billing/billing-promotion-code-input.frontend-component.specification.js.map +0 -1
  266. package/dist/esm/engine/frontend-components/index.d.ts +0 -2
  267. package/dist/esm/engine/frontend-components/index.d.ts.map +1 -1
  268. package/dist/esm/engine/frontend-components/index.js +4 -6
  269. package/dist/esm/engine/frontend-components/index.js.map +1 -1
  270. package/dist/esm/engine/guidance/resources/guidance-state.resource.specification.js +12 -12
  271. package/dist/esm/engine/guidance/resources/guidance-state.resource.specification.js.map +1 -1
  272. package/dist/esm/engine/guidance/resources/lifecycle-state.resource.specification.js +9 -9
  273. package/dist/esm/engine/guidance/resources/lifecycle-state.resource.specification.js.map +1 -1
  274. package/dist/esm/engine/guidance/resources/progression-state.resource.specification.d.ts +8 -0
  275. package/dist/esm/engine/guidance/resources/progression-state.resource.specification.d.ts.map +1 -1
  276. package/dist/esm/engine/guidance/resources/progression-state.resource.specification.js +6 -6
  277. package/dist/esm/engine/guidance/resources/progression-state.resource.specification.js.map +1 -1
  278. package/dist/esm/engine/index.d.ts +1 -0
  279. package/dist/esm/engine/index.d.ts.map +1 -1
  280. package/dist/esm/engine/index.js +1 -0
  281. package/dist/esm/engine/index.js.map +1 -1
  282. package/dist/esm/engine/infrastructure/resources/data-seed-runs.resource.specification.js +17 -17
  283. package/dist/esm/engine/infrastructure/resources/data-seed-runs.resource.specification.js.map +1 -1
  284. package/dist/esm/engine/infrastructure/resources/external-data-pipeline-states.resource.specification.js +7 -7
  285. package/dist/esm/engine/infrastructure/resources/external-data-pipeline-states.resource.specification.js.map +1 -1
  286. package/dist/esm/engine/infrastructure/resources/job-executions.resource.specification.js +8 -8
  287. package/dist/esm/engine/infrastructure/resources/job-executions.resource.specification.js.map +1 -1
  288. package/dist/esm/engine/infrastructure/resources/job-payload-storage.resource.specification.d.ts +7 -2
  289. package/dist/esm/engine/infrastructure/resources/job-payload-storage.resource.specification.d.ts.map +1 -1
  290. package/dist/esm/engine/infrastructure/resources/job-payload-storage.resource.specification.js +10 -5
  291. package/dist/esm/engine/infrastructure/resources/job-payload-storage.resource.specification.js.map +1 -1
  292. package/dist/esm/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.d.ts.map +1 -1
  293. package/dist/esm/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.js +20 -15
  294. package/dist/esm/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.js.map +1 -1
  295. package/dist/esm/engine/notifications/resources/notification-badges.resource.specification.d.ts.map +1 -1
  296. package/dist/esm/engine/notifications/resources/notification-badges.resource.specification.js +11 -10
  297. package/dist/esm/engine/notifications/resources/notification-badges.resource.specification.js.map +1 -1
  298. package/dist/esm/engine/notifications/resources/webhook-config.resource.specification.d.ts.map +1 -1
  299. package/dist/esm/engine/notifications/resources/webhook-config.resource.specification.js +29 -6
  300. package/dist/esm/engine/notifications/resources/webhook-config.resource.specification.js.map +1 -1
  301. package/dist/esm/engine/organizations/resources/organization-members.resource.specification.js +9 -9
  302. package/dist/esm/engine/organizations/resources/organization-members.resource.specification.js.map +1 -1
  303. package/dist/esm/engine/organizations/resources/organization-notifications.resource.specification.js +3 -3
  304. package/dist/esm/engine/organizations/resources/organization-notifications.resource.specification.js.map +1 -1
  305. package/dist/esm/engine/organizations/resources/organization-preferences.resource.specification.js +4 -4
  306. package/dist/esm/engine/organizations/resources/organization-preferences.resource.specification.js.map +1 -1
  307. package/dist/esm/engine/organizations/resources/organization-profiles.resource.specification.js +2 -2
  308. package/dist/esm/engine/organizations/resources/organization-profiles.resource.specification.js.map +1 -1
  309. package/dist/esm/engine/organizations/resources/organization-unit-members.resource.specification.js +1 -1
  310. package/dist/esm/engine/organizations/resources/organization-unit-members.resource.specification.js.map +1 -1
  311. package/dist/esm/engine/organizations/resources/organizations.resource.specification.js +7 -7
  312. package/dist/esm/engine/organizations/resources/organizations.resource.specification.js.map +1 -1
  313. package/dist/esm/engine/providers/_engine-provider-shared.d.ts +9 -0
  314. package/dist/esm/engine/providers/_engine-provider-shared.d.ts.map +1 -0
  315. package/dist/esm/engine/providers/_engine-provider-shared.js +19 -0
  316. package/dist/esm/engine/providers/_engine-provider-shared.js.map +1 -0
  317. package/dist/esm/engine/providers/anthropic.provider.specification.d.ts +7 -0
  318. package/dist/esm/engine/providers/anthropic.provider.specification.d.ts.map +1 -0
  319. package/dist/esm/engine/providers/anthropic.provider.specification.js +33 -0
  320. package/dist/esm/engine/providers/anthropic.provider.specification.js.map +1 -0
  321. package/dist/esm/engine/providers/apple.provider.specification.d.ts +7 -0
  322. package/dist/esm/engine/providers/apple.provider.specification.d.ts.map +1 -0
  323. package/dist/esm/engine/providers/apple.provider.specification.js +35 -0
  324. package/dist/esm/engine/providers/apple.provider.specification.js.map +1 -0
  325. package/dist/esm/engine/providers/email-preview.provider.specification.d.ts +7 -0
  326. package/dist/esm/engine/providers/email-preview.provider.specification.d.ts.map +1 -0
  327. package/dist/esm/engine/providers/email-preview.provider.specification.js +31 -0
  328. package/dist/esm/engine/providers/email-preview.provider.specification.js.map +1 -0
  329. package/dist/esm/engine/providers/github.provider.specification.d.ts +7 -0
  330. package/dist/esm/engine/providers/github.provider.specification.d.ts.map +1 -0
  331. package/dist/esm/engine/providers/github.provider.specification.js +30 -0
  332. package/dist/esm/engine/providers/github.provider.specification.js.map +1 -0
  333. package/dist/esm/engine/providers/google.provider.specification.d.ts +7 -0
  334. package/dist/esm/engine/providers/google.provider.specification.d.ts.map +1 -0
  335. package/dist/esm/engine/providers/google.provider.specification.js +34 -0
  336. package/dist/esm/engine/providers/google.provider.specification.js.map +1 -0
  337. package/dist/esm/engine/providers/grok.provider.specification.d.ts +7 -0
  338. package/dist/esm/engine/providers/grok.provider.specification.d.ts.map +1 -0
  339. package/dist/esm/engine/providers/grok.provider.specification.js +30 -0
  340. package/dist/esm/engine/providers/grok.provider.specification.js.map +1 -0
  341. package/dist/esm/engine/providers/index.d.ts +23 -0
  342. package/dist/esm/engine/providers/index.d.ts.map +1 -0
  343. package/dist/esm/engine/providers/index.js +37 -0
  344. package/dist/esm/engine/providers/index.js.map +1 -0
  345. package/dist/esm/engine/providers/microsoft.provider.specification.d.ts +7 -0
  346. package/dist/esm/engine/providers/microsoft.provider.specification.d.ts.map +1 -0
  347. package/dist/esm/engine/providers/microsoft.provider.specification.js +30 -0
  348. package/dist/esm/engine/providers/microsoft.provider.specification.js.map +1 -0
  349. package/dist/esm/engine/providers/mistral.provider.specification.d.ts +7 -0
  350. package/dist/esm/engine/providers/mistral.provider.specification.d.ts.map +1 -0
  351. package/dist/esm/engine/providers/mistral.provider.specification.js +33 -0
  352. package/dist/esm/engine/providers/mistral.provider.specification.js.map +1 -0
  353. package/dist/esm/engine/providers/openai.provider.specification.d.ts +7 -0
  354. package/dist/esm/engine/providers/openai.provider.specification.d.ts.map +1 -0
  355. package/dist/esm/engine/providers/openai.provider.specification.js +43 -0
  356. package/dist/esm/engine/providers/openai.provider.specification.js.map +1 -0
  357. package/dist/esm/engine/providers/opencode.provider.specification.d.ts +7 -0
  358. package/dist/esm/engine/providers/opencode.provider.specification.d.ts.map +1 -0
  359. package/dist/esm/engine/providers/opencode.provider.specification.js +50 -0
  360. package/dist/esm/engine/providers/opencode.provider.specification.js.map +1 -0
  361. package/dist/esm/engine/providers/perplexity.provider.specification.d.ts +7 -0
  362. package/dist/esm/engine/providers/perplexity.provider.specification.d.ts.map +1 -0
  363. package/dist/esm/engine/providers/perplexity.provider.specification.js +30 -0
  364. package/dist/esm/engine/providers/perplexity.provider.specification.js.map +1 -0
  365. package/dist/esm/engine/providers/resend.provider.specification.d.ts +7 -0
  366. package/dist/esm/engine/providers/resend.provider.specification.d.ts.map +1 -0
  367. package/dist/esm/engine/providers/resend.provider.specification.js +33 -0
  368. package/dist/esm/engine/providers/resend.provider.specification.js.map +1 -0
  369. package/dist/esm/engine/providers/stripe.provider.specification.d.ts +7 -0
  370. package/dist/esm/engine/providers/stripe.provider.specification.d.ts.map +1 -0
  371. package/dist/esm/engine/providers/stripe.provider.specification.js +35 -0
  372. package/dist/esm/engine/providers/stripe.provider.specification.js.map +1 -0
  373. package/dist/esm/engine/providers/twilio.provider.specification.d.ts +7 -0
  374. package/dist/esm/engine/providers/twilio.provider.specification.d.ts.map +1 -0
  375. package/dist/esm/engine/providers/twilio.provider.specification.js +33 -0
  376. package/dist/esm/engine/providers/twilio.provider.specification.js.map +1 -0
  377. package/dist/esm/engine/users/resources/anonymous-users.resource.specification.js +7 -7
  378. package/dist/esm/engine/users/resources/anonymous-users.resource.specification.js.map +1 -1
  379. package/dist/esm/engine/users/resources/inbound-contacts.resource.specification.js +9 -9
  380. package/dist/esm/engine/users/resources/inbound-contacts.resource.specification.js.map +1 -1
  381. package/dist/esm/engine/users/resources/user-credentials.resource.specification.js +2 -2
  382. package/dist/esm/engine/users/resources/user-credentials.resource.specification.js.map +1 -1
  383. package/dist/esm/engine/users/resources/user-identity-links.resource.specification.js +8 -8
  384. package/dist/esm/engine/users/resources/user-identity-links.resource.specification.js.map +1 -1
  385. package/dist/esm/engine/users/resources/user-preferences.resource.specification.d.ts +4 -4
  386. package/dist/esm/engine/users/resources/user-preferences.resource.specification.js +4 -4
  387. package/dist/esm/engine/users/resources/user-preferences.resource.specification.js.map +1 -1
  388. package/dist/esm/engine/users/resources/user-profiles.resource.specification.js +2 -2
  389. package/dist/esm/engine/users/resources/user-profiles.resource.specification.js.map +1 -1
  390. package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.d.ts +4 -4
  391. package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.d.ts.map +1 -1
  392. package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.js +13 -11
  393. package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.js.map +1 -1
  394. package/dist/esm/engine/users/resources/user-self-profiles.resource.specification.js +1 -1
  395. package/dist/esm/engine/users/resources/user-self-profiles.resource.specification.js.map +1 -1
  396. package/dist/esm/engine/users/resources/user-self.resource.specification.js +8 -8
  397. package/dist/esm/engine/users/resources/user-self.resource.specification.js.map +1 -1
  398. package/dist/esm/engine/users/resources/users.resource.specification.d.ts.map +1 -1
  399. package/dist/esm/engine/users/resources/users.resource.specification.js +93 -0
  400. package/dist/esm/engine/users/resources/users.resource.specification.js.map +1 -1
  401. package/dist/esm/technical-documentation/engine-documentation-specification-catalog.companion.d.ts.map +1 -1
  402. package/dist/esm/technical-documentation/engine-documentation-specification-catalog.companion.js +95 -45
  403. package/dist/esm/technical-documentation/engine-documentation-specification-catalog.companion.js.map +1 -1
  404. package/dist/esm/technical-documentation/technical-documentation-units.schemas.d.ts +37 -1
  405. package/dist/esm/technical-documentation/technical-documentation-units.schemas.d.ts.map +1 -1
  406. package/dist/esm/technical-documentation/technical-documentation-units.schemas.js +36 -0
  407. package/dist/esm/technical-documentation/technical-documentation-units.schemas.js.map +1 -1
  408. package/dist/tsconfig.build.tsbuildinfo +1 -1
  409. package/package.json +8 -8
  410. package/dist/assurance/external-framework-mapping.json +0 -980
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Provider specification family (#328).
3
+ *
4
+ * The semantic overlay for an external PROVIDER — the business meaning of a
5
+ * `BackendProviderModule` / frontend provider module: why it exists, which
6
+ * tier it holds, which vendor groups it, where it came from, what it binds,
7
+ * and which secrets an operator must supply. Until this family existed the
8
+ * engine shipped 15 specification families and none for providers, so a
9
+ * generated provider would have shipped zero specification coverage while
10
+ * `framework-specification-maintenance.md` was vacuously satisfied.
11
+ *
12
+ * Shape follows the feature family: a config extending
13
+ * {@link DefinitionSpecificationBaseConfig}, a factory that validates at
14
+ * module load, a map builder that fails closed on duplicates, and a
15
+ * module-level registry consumers can look refs up in.
16
+ *
17
+ * Deliberately NO digest of the operation catalogue (`one-source-of-truth.md`
18
+ * Rule 0 — nothing that is not branchable on git): the catalogue is named by
19
+ * the symbol that declares it, and git carries which bytes that symbol had.
20
+ */
21
+ import { ProviderOriginKind, ProviderTier, } from '@wildo-ai/saas-models';
22
+ import { assertDefinitionSpecificationBaseConfig, assertNonEmptyTrimmedString, assertOptionalCodeSymbolRef, assertOptionalDefinitionSpecificationCodeHandling, assertOptionalNonEmptyProseSlot, } from './definition-specification-validators.js';
23
+ // ── Keys ───────────────────────────────────────────────────────────────────
24
+ export const PROVIDER_SPECIFICATION_KEY_PREFIX = 'providers';
25
+ export function providerSpecificationKeyFor(providerRef) {
26
+ return `${PROVIDER_SPECIFICATION_KEY_PREFIX}/${providerRef}`;
27
+ }
28
+ // ── Validation ─────────────────────────────────────────────────────────────
29
+ function assertNonEmptyStringList(errorPrefix, slot, value) {
30
+ if (!Array.isArray(value)) {
31
+ throw new Error(`${errorPrefix} "${slot}" must be an array.`);
32
+ }
33
+ value.forEach((entry, index) => {
34
+ assertNonEmptyTrimmedString(errorPrefix, `${slot}[${index}]`, entry);
35
+ });
36
+ }
37
+ export function validateProviderSpecification(specificationKey, specification) {
38
+ const errorPrefix = `provider specification "${specificationKey}":`;
39
+ assertDefinitionSpecificationBaseConfig(errorPrefix, specification);
40
+ assertNonEmptyTrimmedString(errorPrefix, 'packageName', specification.packageName);
41
+ assertNonEmptyTrimmedString(errorPrefix, 'vendor', specification.vendor);
42
+ if (!Object.values(ProviderTier).includes(specification.tier)) {
43
+ throw new Error(`${errorPrefix} "tier" must be a ProviderTier member, got "${String(specification.tier)}".`);
44
+ }
45
+ if (!specification.origin || !Object.values(ProviderOriginKind).includes(specification.origin.kind)) {
46
+ throw new Error(`${errorPrefix} "origin.kind" must be a ProviderOriginKind member.`);
47
+ }
48
+ if (specification.origin.kind === ProviderOriginKind.GENERATED) {
49
+ const { catalogue } = specification.origin;
50
+ if (!catalogue) {
51
+ throw new Error(`${errorPrefix} a GENERATED origin must carry its catalogue provenance.`);
52
+ }
53
+ assertNonEmptyTrimmedString(errorPrefix, 'origin.catalogue.sourceRef', catalogue.sourceRef);
54
+ assertNonEmptyTrimmedString(errorPrefix, 'origin.catalogue.sourceVersion', catalogue.sourceVersion);
55
+ }
56
+ // The tier rule, restated on the specification so a spec cannot describe what composition refuses.
57
+ if (specification.tier === ProviderTier.MAIN && specification.origin.kind !== ProviderOriginKind.ENGINE) {
58
+ throw new Error(`${errorPrefix} tier MAIN is the engine's own set; origin is ${specification.origin.kind}.`);
59
+ }
60
+ if (specification.tier === ProviderTier.CATALOGUE && specification.engineCapabilities.length > 0) {
61
+ throw new Error(`${errorPrefix} tier CATALOGUE binds no engine slot, but engineCapabilities lists [${specification.engineCapabilities.join(', ')}].`);
62
+ }
63
+ assertNonEmptyStringList(errorPrefix, 'facets', specification.facets);
64
+ if (specification.facets.length === 0) {
65
+ throw new Error(`${errorPrefix} "facets" must name at least one facet the provider ships a module for.`);
66
+ }
67
+ assertNonEmptyStringList(errorPrefix, 'protocols', specification.protocols);
68
+ assertNonEmptyStringList(errorPrefix, 'providerCapabilities', specification.providerCapabilities);
69
+ assertNonEmptyStringList(errorPrefix, 'engineCapabilities', specification.engineCapabilities);
70
+ if (!Array.isArray(specification.secretsContract)) {
71
+ throw new Error(`${errorPrefix} "secretsContract" must be an array (empty when the provider needs no secret).`);
72
+ }
73
+ const seenEnvVarNames = new Set();
74
+ specification.secretsContract.forEach((entry, index) => {
75
+ assertNonEmptyTrimmedString(errorPrefix, `secretsContract[${index}].slug`, entry.slug);
76
+ assertNonEmptyTrimmedString(errorPrefix, `secretsContract[${index}].envVarName`, entry.envVarName);
77
+ assertNonEmptyTrimmedString(errorPrefix, `secretsContract[${index}].description`, entry.description);
78
+ if (typeof entry.required !== 'boolean') {
79
+ throw new Error(`${errorPrefix} "secretsContract[${index}].required" must be a boolean.`);
80
+ }
81
+ if (seenEnvVarNames.has(entry.envVarName)) {
82
+ throw new Error(`${errorPrefix} duplicate secretsContract envVarName "${entry.envVarName}".`);
83
+ }
84
+ seenEnvVarNames.add(entry.envVarName);
85
+ if (index > 0 && specification.secretsContract[index - 1].slug.localeCompare(entry.slug) >= 0) {
86
+ throw new Error(`${errorPrefix} secretsContract entries must be sorted by slug.`);
87
+ }
88
+ });
89
+ assertOptionalCodeSymbolRef(errorPrefix, 'operationCatalogueSymbol', specification.operationCatalogueSymbol);
90
+ if (specification.operatorPrerequisites !== undefined) {
91
+ assertNonEmptyStringList(errorPrefix, 'operatorPrerequisites', specification.operatorPrerequisites);
92
+ }
93
+ assertOptionalNonEmptyProseSlot(errorPrefix, 'lifecycleRole', specification.lifecycleRole);
94
+ assertOptionalDefinitionSpecificationCodeHandling(errorPrefix, specification.codeHandling);
95
+ }
96
+ // ── Factory ────────────────────────────────────────────────────────────────
97
+ export function providerSpecificationFromDefinition(providerDefinition, draftFactory) {
98
+ const specification = {
99
+ ...draftFactory(),
100
+ ref: providerDefinition.ref,
101
+ };
102
+ validateProviderSpecification(providerSpecificationKeyFor(specification.ref), specification);
103
+ return specification;
104
+ }
105
+ // ── Map builder ────────────────────────────────────────────────────────────
106
+ export function buildProviderSpecificationMap(...specifications) {
107
+ const result = {};
108
+ for (const specification of specifications) {
109
+ const key = providerSpecificationKeyFor(specification.ref);
110
+ if (result[key]) {
111
+ throw new Error(`buildProviderSpecificationMap(): duplicate provider specification key "${key}".`);
112
+ }
113
+ result[key] = specification;
114
+ }
115
+ return result;
116
+ }
117
+ // ── Module-level registry (mirrors the feature family) ─────────────────────
118
+ const registeredProviderSpecifications = new Map();
119
+ export function registerProviderSpecifications(map) {
120
+ for (const [key, specification] of Object.entries(map)) {
121
+ if (typeof key !== 'string' || !key.trim()) {
122
+ throw new Error('registerProviderSpecifications(): every map key must be a non-empty trimmed string.');
123
+ }
124
+ const existing = registeredProviderSpecifications.get(key);
125
+ if (existing && JSON.stringify(existing) !== JSON.stringify(specification)) {
126
+ throw new Error(`registerProviderSpecifications(): provider specification "${key}" was registered twice with divergent shapes.`);
127
+ }
128
+ registeredProviderSpecifications.set(key, specification);
129
+ }
130
+ }
131
+ export function lookupProviderSpecification(providerRef) {
132
+ return registeredProviderSpecifications.get(providerSpecificationKeyFor(providerRef));
133
+ }
134
+ export function hasRegisteredProviderSpecifications() {
135
+ return registeredProviderSpecifications.size > 0;
136
+ }
137
+ export function listRegisteredProviderSpecifications() {
138
+ return Array.from(registeredProviderSpecifications.values());
139
+ }
140
+ /** Test seam only. */
141
+ export function resetProviderSpecificationsForTesting() {
142
+ registeredProviderSpecifications.clear();
143
+ }
144
+ //# sourceMappingURL=provider-specification.schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-specification.schemas.js","sourceRoot":"","sources":["../../../../src/_core/provider-specification.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EACL,kBAAkB,EAClB,YAAY,GAGb,MAAM,uBAAuB,CAAC;AAM/B,OAAO,EACL,uCAAuC,EACvC,2BAA2B,EAC3B,2BAA2B,EAC3B,iDAAiD,EACjD,+BAA+B,GAChC,MA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AC","sourcesContent":["/**\n * Provider specification family (#328).\n *\n * The semantic overlay for an external PROVIDER — the business meaning of a\n * `BackendProviderModule` / frontend provider module: why it exists, which\n * tier it holds, which vendor groups it, where it came from, what it binds,\n * and which secrets an operator must supply. Until this family existed the\n * engine shipped 15 specification families and none for providers, so a\n * generated provider would have shipped zero specification coverage while\n * `framework-specification-maintenance.md` was vacuously satisfied.\n *\n * Shape follows the feature family: a config extending\n * {@link DefinitionSpecificationBaseConfig}, a factory that validates at\n * module load, a map builder that fails closed on duplicates, and a\n * module-level registry consumers can look refs up in.\n *\n * Deliberately NO digest of the operation catalogue (`one-source-of-truth.md`\n * Rule 0 — nothing that is not branchable on git): the catalogue is named by\n * the symbol that declares it, and git carries which bytes that symbol had.\n */\n\nimport type { CodeSymbolRef } from '@wildo-ai/zod-decorators';\nimport {\n ProviderOriginKind,\n ProviderTier,\n type EngineCapability,\n type ProviderOrigin,\n} from '@wildo-ai/saas-models';\n\nimport type {\n DefinitionSpecificationBaseConfig,\n DefinitionSpecificationCodeHandling,\n} from './definition-specification.schemas';\nimport {\n assertDefinitionSpecificationBaseConfig,\n assertNonEmptyTrimmedString,\n assertOptionalCodeSymbolRef,\n assertOptionalDefinitionSpecificationCodeHandling,\n assertOptionalNonEmptyProseSlot,\n} from './definition-specification-validators';\n\n/** One secret the operator supplies, mirrored from the module's `secretsContract`. */\nexport interface ProviderSpecificationSecret {\n /** The contract slug (`apiKey`, `webhookSecret`, …). */\n slug: string;\n /** The environment variable the secret is delivered as. */\n envVarName: string;\n /** Whether the provider cannot start without it. */\n required: boolean;\n /** What the secret is, for the operator who has to obtain it. */\n description: string;\n}\n\nexport interface ProviderSpecificationConfig extends DefinitionSpecificationBaseConfig {\n /** npm package that ships the provider — one package, several facet barrels. */\n packageName: string;\n /** The recorded tier decision; must agree with the module metadata. */\n tier: ProviderTier;\n /** Vendor grouping; equals `ref` for a single-package vendor. */\n vendor: string;\n /** Where the provider's code comes from, with catalogue provenance when generated. */\n origin: ProviderOrigin;\n /** Facets the provider ships a module for (`backend`, `frontend-app`, `frontend-website`, `frontend-techdoc`). */\n facets: string[];\n /** Authoring keys of the protocols the backend module binds (`BUILTIN_PROVIDER_PROTOCOL` members). */\n protocols: string[];\n /** `ProviderCapability` tokens the module claims. */\n providerCapabilities: string[];\n /** Engine slots those tokens bind through `PROVIDER_CAPABILITY_TO_ENGINE_CAPABILITY`. */\n engineCapabilities: EngineCapability[];\n /** The module's secrets contract, sorted by slug. Empty for a provider that needs none. */\n secretsContract: ProviderSpecificationSecret[];\n /**\n * The symbol declaring the provider's OPERATION CATALOGUE, when it has one\n * (the `rest` arm's derived catalogue, S3a). Absent for a provider that\n * exposes engine capabilities only.\n */\n operationCatalogueSymbol?: CodeSymbolRef;\n /** What an operator must obtain or configure before the provider serves. */\n operatorPrerequisites?: string[];\n /** Where the provider is declared in code — owner, the module symbol, supporting symbols. */\n codeHandling?: DefinitionSpecificationCodeHandling;\n}\n\nexport type ProviderSpecification = Record<string, ProviderSpecificationConfig>;\n\nexport type ProviderSpecificationDraft = Omit<ProviderSpecificationConfig, 'ref'>;\n\nexport interface ProviderDefinitionRef {\n /** The provider `ref` — the metadata join key. */\n ref: string;\n}\n\n// ── Keys ───────────────────────────────────────────────────────────────────\n\nexport const PROVIDER_SPECIFICATION_KEY_PREFIX = 'providers';\n\nexport function providerSpecificationKeyFor(providerRef: string): string {\n return `${PROVIDER_SPECIFICATION_KEY_PREFIX}/${providerRef}`;\n}\n\n// ── Validation ─────────────────────────────────────────────────────────────\n\nfunction assertNonEmptyStringList(errorPrefix: string, slot: string, value: unknown): asserts value is string[] {\n if (!Array.isArray(value)) {\n throw new Error(`${errorPrefix} \"${slot}\" must be an array.`);\n }\n value.forEach((entry, index) => {\n assertNonEmptyTrimmedString(errorPrefix, `${slot}[${index}]`, entry);\n });\n}\n\nexport function validateProviderSpecification(\n specificationKey: string,\n specification: ProviderSpecificationConfig,\n): void {\n const errorPrefix = `provider specification \"${specificationKey}\":`;\n\n assertDefinitionSpecificationBaseConfig(errorPrefix, specification);\n assertNonEmptyTrimmedString(errorPrefix, 'packageName', specification.packageName);\n assertNonEmptyTrimmedString(errorPrefix, 'vendor', specification.vendor);\n if (!Object.values(ProviderTier).includes(specification.tier)) {\n throw new Error(`${errorPrefix} \"tier\" must be a ProviderTier member, got \"${String(specification.tier)}\".`);\n }\n if (!specification.origin || !Object.values(ProviderOriginKind).includes(specification.origin.kind)) {\n throw new Error(`${errorPrefix} \"origin.kind\" must be a ProviderOriginKind member.`);\n }\n if (specification.origin.kind === ProviderOriginKind.GENERATED) {\n const { catalogue } = specification.origin;\n if (!catalogue) {\n throw new Error(`${errorPrefix} a GENERATED origin must carry its catalogue provenance.`);\n }\n assertNonEmptyTrimmedString(errorPrefix, 'origin.catalogue.sourceRef', catalogue.sourceRef);\n assertNonEmptyTrimmedString(errorPrefix, 'origin.catalogue.sourceVersion', catalogue.sourceVersion);\n }\n // The tier rule, restated on the specification so a spec cannot describe what composition refuses.\n if (specification.tier === ProviderTier.MAIN && specification.origin.kind !== ProviderOriginKind.ENGINE) {\n throw new Error(`${errorPrefix} tier MAIN is the engine's own set; origin is ${specification.origin.kind}.`);\n }\n if (specification.tier === ProviderTier.CATALOGUE && specification.engineCapabilities.length > 0) {\n throw new Error(\n `${errorPrefix} tier CATALOGUE binds no engine slot, but engineCapabilities lists [${specification.engineCapabilities.join(', ')}].`,\n );\n }\n assertNonEmptyStringList(errorPrefix, 'facets', specification.facets);\n if (specification.facets.length === 0) {\n throw new Error(`${errorPrefix} \"facets\" must name at least one facet the provider ships a module for.`);\n }\n assertNonEmptyStringList(errorPrefix, 'protocols', specification.protocols);\n assertNonEmptyStringList(errorPrefix, 'providerCapabilities', specification.providerCapabilities);\n assertNonEmptyStringList(errorPrefix, 'engineCapabilities', specification.engineCapabilities);\n if (!Array.isArray(specification.secretsContract)) {\n throw new Error(`${errorPrefix} \"secretsContract\" must be an array (empty when the provider needs no secret).`);\n }\n const seenEnvVarNames = new Set<string>();\n specification.secretsContract.forEach((entry, index) => {\n assertNonEmptyTrimmedString(errorPrefix, `secretsContract[${index}].slug`, entry.slug);\n assertNonEmptyTrimmedString(errorPrefix, `secretsContract[${index}].envVarName`, entry.envVarName);\n assertNonEmptyTrimmedString(errorPrefix, `secretsContract[${index}].description`, entry.description);\n if (typeof entry.required !== 'boolean') {\n throw new Error(`${errorPrefix} \"secretsContract[${index}].required\" must be a boolean.`);\n }\n if (seenEnvVarNames.has(entry.envVarName)) {\n throw new Error(`${errorPrefix} duplicate secretsContract envVarName \"${entry.envVarName}\".`);\n }\n seenEnvVarNames.add(entry.envVarName);\n if (index > 0 && specification.secretsContract[index - 1].slug.localeCompare(entry.slug) >= 0) {\n throw new Error(`${errorPrefix} secretsContract entries must be sorted by slug.`);\n }\n });\n assertOptionalCodeSymbolRef(errorPrefix, 'operationCatalogueSymbol', specification.operationCatalogueSymbol);\n if (specification.operatorPrerequisites !== undefined) {\n assertNonEmptyStringList(errorPrefix, 'operatorPrerequisites', specification.operatorPrerequisites);\n }\n assertOptionalNonEmptyProseSlot(errorPrefix, 'lifecycleRole', specification.lifecycleRole);\n assertOptionalDefinitionSpecificationCodeHandling(errorPrefix, specification.codeHandling);\n}\n\n// ── Factory ────────────────────────────────────────────────────────────────\n\nexport function providerSpecificationFromDefinition(\n providerDefinition: ProviderDefinitionRef,\n draftFactory: () => ProviderSpecificationDraft,\n): ProviderSpecificationConfig {\n const specification: ProviderSpecificationConfig = {\n ...draftFactory(),\n ref: providerDefinition.ref,\n };\n validateProviderSpecification(providerSpecificationKeyFor(specification.ref), specification);\n return specification;\n}\n\n// ── Map builder ────────────────────────────────────────────────────────────\n\nexport function buildProviderSpecificationMap(\n ...specifications: ProviderSpecificationConfig[]\n): ProviderSpecification {\n const result: ProviderSpecification = {};\n for (const specification of specifications) {\n const key = providerSpecificationKeyFor(specification.ref);\n if (result[key]) {\n throw new Error(`buildProviderSpecificationMap(): duplicate provider specification key \"${key}\".`);\n }\n result[key] = specification;\n }\n return result;\n}\n\n// ── Module-level registry (mirrors the feature family) ─────────────────────\n\nconst registeredProviderSpecifications = new Map<string, ProviderSpecificationConfig>();\n\nexport function registerProviderSpecifications(map: ProviderSpecification): void {\n for (const [key, specification] of Object.entries(map)) {\n if (typeof key !== 'string' || !key.trim()) {\n throw new Error('registerProviderSpecifications(): every map key must be a non-empty trimmed string.');\n }\n const existing = registeredProviderSpecifications.get(key);\n if (existing && JSON.stringify(existing) !== JSON.stringify(specification)) {\n throw new Error(\n `registerProviderSpecifications(): provider specification \"${key}\" was registered twice with divergent shapes.`,\n );\n }\n registeredProviderSpecifications.set(key, specification);\n }\n}\n\nexport function lookupProviderSpecification(providerRef: string): ProviderSpecificationConfig | undefined {\n return registeredProviderSpecifications.get(providerSpecificationKeyFor(providerRef));\n}\n\nexport function hasRegisteredProviderSpecifications(): boolean {\n return registeredProviderSpecifications.size > 0;\n}\n\nexport function listRegisteredProviderSpecifications(): ProviderSpecificationConfig[] {\n return Array.from(registeredProviderSpecifications.values());\n}\n\n/** Test seam only. */\nexport function resetProviderSpecificationsForTesting(): void {\n registeredProviderSpecifications.clear();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"requirements-snapshot-generation.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/_core/requirements/requirements-snapshot-generation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAKpF,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,iCAAiC,CAAC;AAKzC;;;;;GAKG;AACH,eAAO,MAAM,qCAAqC;;;;;;;kBAOhD,CAAC;AACH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC;AAEpG,yDAAyD;AACzD,eAAO,MAAM,wCAAwC;;;;;;;;kBAQnD,CAAC;AACH,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wCAAwC,CAAC,CAAC;AAE1G;;;;GAIG;AACH,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;kBAa/C,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAElG,6EAA6E;AAC7E,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CAsBxF"}
1
+ {"version":3,"file":"requirements-snapshot-generation.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/_core/requirements/requirements-snapshot-generation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAMpF,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,iCAAiC,CAAC;AAKzC;;;;;GAKG;AACH,eAAO,MAAM,qCAAqC;;;;;;;kBAOhD,CAAC;AACH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC;AAEpG,yDAAyD;AACzD,eAAO,MAAM,wCAAwC;;;;;;;;kBAQnD,CAAC;AACH,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wCAAwC,CAAC,CAAC;AAE1G;;;;GAIG;AACH,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;kBAiB/C,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAElG,6EAA6E;AAC7E,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CAsBxF"}
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { NonFunctionalRequirementKind } from './non-functional-requirement.schemas.js';
3
+ import { applyFamilyRefPrefix } from '../utils/family-ref-stamping.js';
3
4
  import { FUNCTIONAL_REQUIREMENT_REF_PREFIX, NON_FUNCTIONAL_REQUIREMENT_REF_PREFIX, } from './requirements-references.schemas.js';
4
5
  import { RequirementsSnapshotSchema, RequirementsSnapshotVersion, } from './requirements-snapshot.schemas.js';
5
6
  const NonEmptyStringSchema = z.string().trim().min(1);
@@ -37,13 +38,17 @@ export const RequirementsSnapshotGenerationSchema = z.strictObject({
37
38
  functional: z.array(FunctionalRequirementGenerationSchema).min(1),
38
39
  nonFunctional: z.array(NonFunctionalRequirementGenerationSchema),
39
40
  }).superRefine((generated, context) => {
40
- const duplicateFunctionalSlug = firstDuplicate(generated.functional.map(requirement => requirement.slug));
41
- if (duplicateFunctionalSlug !== null) {
42
- context.addIssue({ code: 'custom', message: `duplicate functional requirement slug "${duplicateFunctionalSlug}"`, path: ['functional'] });
41
+ // Keyed on the STAMPED form, not on the authored slug, because `applyFamilyRefPrefix` is deliberately
42
+ // not injective: `login` and `functional-requirement-login` are two distinct slugs that both become
43
+ // `functional-requirement-login`. Checking the slug would let that pair through and produce two
44
+ // requirements sharing one ref, which makes every roadmap and build-plan edge naming it ambiguous.
45
+ const duplicateFunctionalRef = firstDuplicate(generated.functional.map(requirement => applyFamilyRefPrefix(requirement.slug, FUNCTIONAL_REQUIREMENT_REF_PREFIX)));
46
+ if (duplicateFunctionalRef !== null) {
47
+ context.addIssue({ code: 'custom', message: `two functional requirement slugs normalize to the same ref "${duplicateFunctionalRef}"`, path: ['functional'] });
43
48
  }
44
- const duplicateNonFunctionalSlug = firstDuplicate(generated.nonFunctional.map(requirement => requirement.slug));
45
- if (duplicateNonFunctionalSlug !== null) {
46
- context.addIssue({ code: 'custom', message: `duplicate non-functional requirement slug "${duplicateNonFunctionalSlug}"`, path: ['nonFunctional'] });
49
+ const duplicateNonFunctionalRef = firstDuplicate(generated.nonFunctional.map(requirement => applyFamilyRefPrefix(requirement.slug, NON_FUNCTIONAL_REQUIREMENT_REF_PREFIX)));
50
+ if (duplicateNonFunctionalRef !== null) {
51
+ context.addIssue({ code: 'custom', message: `two non-functional requirement slugs normalize to the same ref "${duplicateNonFunctionalRef}"`, path: ['nonFunctional'] });
47
52
  }
48
53
  });
49
54
  /** Normalize strict provider output into the permissive persisted family. */
@@ -52,7 +57,7 @@ export function parseRequirementsSnapshotGeneration(input) {
52
57
  return RequirementsSnapshotSchema.parse({
53
58
  version: RequirementsSnapshotVersion.V1,
54
59
  functional: generated.functional.map(requirement => ({
55
- ref: `${FUNCTIONAL_REQUIREMENT_REF_PREFIX}${requirement.slug}`,
60
+ ref: applyFamilyRefPrefix(requirement.slug, FUNCTIONAL_REQUIREMENT_REF_PREFIX),
56
61
  statement: requirement.statement,
57
62
  ...(requirement.rationale === null ? {} : { rationale: requirement.rationale }),
58
63
  acceptanceCriteria: requirement.acceptanceCriteria,
@@ -60,7 +65,7 @@ export function parseRequirementsSnapshotGeneration(input) {
60
65
  ...(requirement.jobRefs.length === 0 ? {} : { jobRefs: requirement.jobRefs }),
61
66
  })),
62
67
  nonFunctional: generated.nonFunctional.map(requirement => ({
63
- ref: `${NON_FUNCTIONAL_REQUIREMENT_REF_PREFIX}${requirement.slug}`,
68
+ ref: applyFamilyRefPrefix(requirement.slug, NON_FUNCTIONAL_REQUIREMENT_REF_PREFIX),
64
69
  kind: requirement.kind,
65
70
  statement: requirement.statement,
66
71
  ...(requirement.metric === null ? {} : { metric: requirement.metric }),
@@ -1 +1 @@
1
- {"version":3,"file":"requirements-snapshot-generation.schemas.js","sourceRoot":"","sources":["../../../../../src/_core/requirements/requirements-snapshot-generation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EACL,iCAAiC,EACjC,qCAAqC,GACtC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,GAE5B,MAAM,iCAAiC,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EAAU,CAAC;IAC/B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QAClC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { z } from 'zod';\n\nimport { NonFunctionalRequirementKind } from './non-functional-requirement.schemas';\nimport {\n FUNCTIONAL_REQUIREMENT_REF_PREFIX,\n NON_FUNCTIONAL_REQUIREMENT_REF_PREFIX,\n} from './requirements-references.schemas';\nimport {\n RequirementsSnapshotSchema,\n RequirementsSnapshotVersion,\n type RequirementsSnapshot,\n} from './requirements-snapshot.schemas';\n\nconst NonEmptyStringSchema = z.string().trim().min(1);\nconst RequirementSlugSchema = z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);\n\n/**\n * Strict provider-facing functional requirement. The provider supplies a\n * stable semantic slug, while the trusted runner stamps the canonical family\n * prefix and snapshot version. Authoring timestamps/provenance are never model\n * output.\n */\nexport const FunctionalRequirementGenerationSchema = z.strictObject({\n slug: RequirementSlugSchema,\n statement: NonEmptyStringSchema,\n rationale: NonEmptyStringSchema.nullable(),\n acceptanceCriteria: z.array(NonEmptyStringSchema),\n icpRefs: z.array(NonEmptyStringSchema),\n jobRefs: z.array(NonEmptyStringSchema),\n});\nexport type FunctionalRequirementGeneration = z.infer<typeof FunctionalRequirementGenerationSchema>;\n\n/** Strict provider-facing non-functional requirement. */\nexport const NonFunctionalRequirementGenerationSchema = z.strictObject({\n slug: RequirementSlugSchema,\n kind: z.enum(NonFunctionalRequirementKind),\n statement: NonEmptyStringSchema,\n metric: NonEmptyStringSchema.nullable(),\n acceptanceCriteria: z.array(NonEmptyStringSchema),\n icpRefs: z.array(NonEmptyStringSchema),\n jobRefs: z.array(NonEmptyStringSchema),\n});\nexport type NonFunctionalRequirementGeneration = z.infer<typeof NonFunctionalRequirementGenerationSchema>;\n\n/**\n * One complete provider response for the requirements family. A model cannot\n * choose the exceptional empty-functional posture: that posture requires a\n * separately settled Authority Decision at the readiness boundary.\n */\nexport const RequirementsSnapshotGenerationSchema = z.strictObject({\n functional: z.array(FunctionalRequirementGenerationSchema).min(1),\n nonFunctional: z.array(NonFunctionalRequirementGenerationSchema),\n}).superRefine((generated, context) => {\n const duplicateFunctionalSlug = firstDuplicate(generated.functional.map(requirement => requirement.slug));\n if (duplicateFunctionalSlug !== null) {\n context.addIssue({ code: 'custom', message: `duplicate functional requirement slug \"${duplicateFunctionalSlug}\"`, path: ['functional'] });\n }\n\n const duplicateNonFunctionalSlug = firstDuplicate(generated.nonFunctional.map(requirement => requirement.slug));\n if (duplicateNonFunctionalSlug !== null) {\n context.addIssue({ code: 'custom', message: `duplicate non-functional requirement slug \"${duplicateNonFunctionalSlug}\"`, path: ['nonFunctional'] });\n }\n});\nexport type RequirementsSnapshotGeneration = z.infer<typeof RequirementsSnapshotGenerationSchema>;\n\n/** Normalize strict provider output into the permissive persisted family. */\nexport function parseRequirementsSnapshotGeneration(input: unknown): RequirementsSnapshot {\n const generated = RequirementsSnapshotGenerationSchema.parse(input);\n return RequirementsSnapshotSchema.parse({\n version: RequirementsSnapshotVersion.V1,\n functional: generated.functional.map(requirement => ({\n ref: `${FUNCTIONAL_REQUIREMENT_REF_PREFIX}${requirement.slug}`,\n statement: requirement.statement,\n ...(requirement.rationale === null ? {} : { rationale: requirement.rationale }),\n acceptanceCriteria: requirement.acceptanceCriteria,\n ...(requirement.icpRefs.length === 0 ? {} : { icpRefs: requirement.icpRefs }),\n ...(requirement.jobRefs.length === 0 ? {} : { jobRefs: requirement.jobRefs }),\n })),\n nonFunctional: generated.nonFunctional.map(requirement => ({\n ref: `${NON_FUNCTIONAL_REQUIREMENT_REF_PREFIX}${requirement.slug}`,\n kind: requirement.kind,\n statement: requirement.statement,\n ...(requirement.metric === null ? {} : { metric: requirement.metric }),\n acceptanceCriteria: requirement.acceptanceCriteria,\n ...(requirement.icpRefs.length === 0 ? {} : { icpRefs: requirement.icpRefs }),\n ...(requirement.jobRefs.length === 0 ? {} : { jobRefs: requirement.jobRefs }),\n })),\n });\n}\n\nfunction firstDuplicate(values: readonly string[]): string | null {\n const seen = new Set<string>();\n for (const value of values) {\n if (seen.has(value)) return value;\n seen.add(value);\n }\n return null;\n}\n"]}
1
+ {"version":3,"file":"requirements-snapshot-generation.schemas.js","sourceRoot":"","sources":["../../../../../src/_core/requirements/requirements-snapshot-generation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EACL,iCAAiC,EACjC,qCAAqC,GACtC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,GAE5B,MAAM,iCAAiC,CAAC;AAEzC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACtD,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAE7E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,CAAC,YAAY,CAAC;IAClE,IAAI,EAAE,qBAAqB;IAC3B,SAAS,EAAE,oBAAoB;IAC/B,SAAS,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IAC1C,kBAAkB,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;IACjD,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;IACtC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;CACvC,CAAC,CAAC;AAGH,yDAAyD;AACzD,MAAM,C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AAC,WAAW,CAAC,EAAE,CAAC,CAAC;YACzD,GAAG,EAAE,oBAAoB,CAAC,WAAW,CAAC,IAAI,EAAE,qCAAqC,CAAC;YAClF,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,SAAS,EAAE,WAAW,CAAC,SAAS;YAChC,GAAG,CAAC,WAAW,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC;YACtE,kBAAkB,EAAE,WAAW,CAAC,kBAAkB;YAClD,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC;YAC7E,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC;SAC9E,CAAC,CAAC;KACJ,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,MAAyB;IAC/C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QAClC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { z } from 'zod';\n\nimport { NonFunctionalRequirementKind } from './non-functional-requirement.schemas';\nimport { applyFamilyRefPrefix } from '../utils/family-ref-stamping';\nimport {\n FUNCTIONAL_REQUIREMENT_REF_PREFIX,\n NON_FUNCTIONAL_REQUIREMENT_REF_PREFIX,\n} from './requirements-references.schemas';\nimport {\n RequirementsSnapshotSchema,\n RequirementsSnapshotVersion,\n type RequirementsSnapshot,\n} from './requirements-snapshot.schemas';\n\nconst NonEmptyStringSchema = z.string().trim().min(1);\nconst RequirementSlugSchema = z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);\n\n/**\n * Strict provider-facing functional requirement. The provider supplies a\n * stable semantic slug, while the trusted runner stamps the canonical family\n * prefix and snapshot version. Authoring timestamps/provenance are never model\n * output.\n */\nexport const FunctionalRequirementGenerationSchema = z.strictObject({\n slug: RequirementSlugSchema,\n statement: NonEmptyStringSchema,\n rationale: NonEmptyStringSchema.nullable(),\n acceptanceCriteria: z.array(NonEmptyStringSchema),\n icpRefs: z.array(NonEmptyStringSchema),\n jobRefs: z.array(NonEmptyStringSchema),\n});\nexport type FunctionalRequirementGeneration = z.infer<typeof FunctionalRequirementGenerationSchema>;\n\n/** Strict provider-facing non-functional requirement. */\nexport const NonFunctionalRequirementGenerationSchema = z.strictObject({\n slug: RequirementSlugSchema,\n kind: z.enum(NonFunctionalRequirementKind),\n statement: NonEmptyStringSchema,\n metric: NonEmptyStringSchema.nullable(),\n acceptanceCriteria: z.array(NonEmptyStringSchema),\n icpRefs: z.array(NonEmptyStringSchema),\n jobRefs: z.array(NonEmptyStringSchema),\n});\nexport type NonFunctionalRequirementGeneration = z.infer<typeof NonFunctionalRequirementGenerationSchema>;\n\n/**\n * One complete provider response for the requirements family. A model cannot\n * choose the exceptional empty-functional posture: that posture requires a\n * separately settled Authority Decision at the readiness boundary.\n */\nexport const RequirementsSnapshotGenerationSchema = z.strictObject({\n functional: z.array(FunctionalRequirementGenerationSchema).min(1),\n nonFunctional: z.array(NonFunctionalRequirementGenerationSchema),\n}).superRefine((generated, context) => {\n // Keyed on the STAMPED form, not on the authored slug, because `applyFamilyRefPrefix` is deliberately\n // not injective: `login` and `functional-requirement-login` are two distinct slugs that both become\n // `functional-requirement-login`. Checking the slug would let that pair through and produce two\n // requirements sharing one ref, which makes every roadmap and build-plan edge naming it ambiguous.\n const duplicateFunctionalRef = firstDuplicate(generated.functional.map(requirement => applyFamilyRefPrefix(requirement.slug, FUNCTIONAL_REQUIREMENT_REF_PREFIX)));\n if (duplicateFunctionalRef !== null) {\n context.addIssue({ code: 'custom', message: `two functional requirement slugs normalize to the same ref \"${duplicateFunctionalRef}\"`, path: ['functional'] });\n }\n\n const duplicateNonFunctionalRef = firstDuplicate(generated.nonFunctional.map(requirement => applyFamilyRefPrefix(requirement.slug, NON_FUNCTIONAL_REQUIREMENT_REF_PREFIX)));\n if (duplicateNonFunctionalRef !== null) {\n context.addIssue({ code: 'custom', message: `two non-functional requirement slugs normalize to the same ref \"${duplicateNonFunctionalRef}\"`, path: ['nonFunctional'] });\n }\n});\nexport type RequirementsSnapshotGeneration = z.infer<typeof RequirementsSnapshotGenerationSchema>;\n\n/** Normalize strict provider output into the permissive persisted family. */\nexport function parseRequirementsSnapshotGeneration(input: unknown): RequirementsSnapshot {\n const generated = RequirementsSnapshotGenerationSchema.parse(input);\n return RequirementsSnapshotSchema.parse({\n version: RequirementsSnapshotVersion.V1,\n functional: generated.functional.map(requirement => ({\n ref: applyFamilyRefPrefix(requirement.slug, FUNCTIONAL_REQUIREMENT_REF_PREFIX),\n statement: requirement.statement,\n ...(requirement.rationale === null ? {} : { rationale: requirement.rationale }),\n acceptanceCriteria: requirement.acceptanceCriteria,\n ...(requirement.icpRefs.length === 0 ? {} : { icpRefs: requirement.icpRefs }),\n ...(requirement.jobRefs.length === 0 ? {} : { jobRefs: requirement.jobRefs }),\n })),\n nonFunctional: generated.nonFunctional.map(requirement => ({\n ref: applyFamilyRefPrefix(requirement.slug, NON_FUNCTIONAL_REQUIREMENT_REF_PREFIX),\n kind: requirement.kind,\n statement: requirement.statement,\n ...(requirement.metric === null ? {} : { metric: requirement.metric }),\n acceptanceCriteria: requirement.acceptanceCriteria,\n ...(requirement.icpRefs.length === 0 ? {} : { icpRefs: requirement.icpRefs }),\n ...(requirement.jobRefs.length === 0 ? {} : { jobRefs: requirement.jobRefs }),\n })),\n });\n}\n\nfunction firstDuplicate(values: readonly string[]): string | null {\n const seen = new Set<string>();\n for (const value of values) {\n if (seen.has(value)) return value;\n seen.add(value);\n }\n return null;\n}\n"]}
@@ -87,6 +87,21 @@ export interface RequirementsSnapshotValidationResult {
87
87
  ok: boolean;
88
88
  issues: RequirementsSnapshotIssue[];
89
89
  }
90
+ /**
91
+ * Options for this family validator.
92
+ *
93
+ * ## The cross-family sets are OPT-IN, and omitting one SKIPS its check
94
+ *
95
+ * A family validator sees one family. It cannot resolve a reference into another family's
96
+ * vocabulary unless you hand it that family's refs — so each `available*Refs` option is the caller
97
+ * saying "I have this context, use it". Omit one and the matching check does not run: no issue is
98
+ * reported, and the absence looks exactly like a snapshot with no such reference.
99
+ *
100
+ * That is deliberate — the families are decoupled on purpose — but it means a validator called with
101
+ * the snapshot alone is checking this family's INTERNAL consistency only. If you want dangling
102
+ * cross-family references caught, supply the sets; if you validate one family in isolation, expect
103
+ * them to be found later by whatever holds every family at once.
104
+ */
90
105
  export interface ValidateRequirementsSnapshotOptions {
91
106
  /** Override "now" for `STALE_AUTHORED` checks (test affordance). Defaults to `new Date()`. */
92
107
  now?: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"requirements-snapshot-validation.d.ts","sourceRoot":"","sources":["../../../../../src/_core/requirements/requirements-snapshot-validation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,oBAAY,6BAA6B;IACvC;;;;;OAKG;IACH,kBAAkB,uBAAuB;IACzC;;;;OAIG;IACH,aAAa,kBAAkB;IAC/B;;;;;;;OAOG;IACH,mBAAmB,wBAAwB;IAC3C,2EAA2E;IAC3E,0BAA0B,+BAA+B;IACzD,4EAA4E;IAC5E,cAAc,mBAAmB;IACjC;;;;OAIG;IACH,eAAe,oBAAoB;IACnC;;;OAGG;IACH,eAAe,oBAAoB;CACpC;AAED,oBAAY,iCAAiC;IAC3C,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,6BAA6B,CAAC;IACpC,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,iCAAiC,CAAC;CAC7C;AAED,MAAM,WAAW,oCAAoC;IACnD,gDAAgD;IAChD,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,yBAAyB,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,mCAAmC;IAClD,8FAA8F;IAC9F,GAAG,CAAC,EAAE,IAAI,CAAC;IACX;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACxC;AAeD,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE,mCAAmC,GAC5C,oCAAoC,CActC;AAwLD,8DAA8D"}
1
+ {"version":3,"file":"requirements-snapshot-validation.d.ts","sourceRoot":"","sources":["../../../../../src/_core/requirements/requirements-snapshot-validation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,oBAAY,6BAA6B;IACvC;;;;;OAKG;IACH,kBAAkB,uBAAuB;IACzC;;;;OAIG;IACH,aAAa,kBAAkB;IAC/B;;;;;;;OAOG;IACH,mBAAmB,wBAAwB;IAC3C,2EAA2E;IAC3E,0BAA0B,+BAA+B;IACzD,4EAA4E;IAC5E,cAAc,mBAAmB;IACjC;;;;OAIG;IACH,eAAe,oBAAoB;IACnC;;;OAGG;IACH,eAAe,oBAAoB;CACpC;AAED,oBAAY,iCAAiC;IAC3C,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,6BAA6B,CAAC;IACpC,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,iCAAiC,CAAC;CAC7C;AAED,MAAM,WAAW,oCAAoC;IACnD,gDAAgD;IAChD,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,yBAAyB,EAAE,CAAC;CACrC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,mCAAmC;IAClD,8FAA8F;IAC9F,GAAG,CAAC,EAAE,IAAI,CAAC;IACX;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACxC;AAeD,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE,mCAAmC,GAC5C,oCAAoC,CActC;AAwLD,8DAA8D"}
@@ -1 +1 @@
1
- {"version":3,"file":"requirements-snapshot-validation.js","sourceRoot":"","sources":["../../../../../src/_core/requirements/requirements-snapshot-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAI3E,OAAO,EACL,kCAAkC,EAClC,sCAAsC,GACvC,MAAM,mCAAmC,CAAC;AAG3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAN,IAAY,6BAsCX;AAtCD,WAAY,6BAA6B;IACvC;;;;;OAKG;IACH,0EAAyC,CAAA;IACzC;;;;OAIG;IACH,gEAA+B,CAAA;IAC/B;;;;;;;OAOG;IACH,4EAA2C,CAAA;IAC3C,2EAA2E;IAC3E,0FAAyD,CAAA;IACzD,4EAA4E;IAC5E,kEAAiC,CAAA;IACjC;;;;OAIG;IACH,o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D","sourcesContent":["import { ReviewCadence } from '../market/market-authored-metadata.schemas';\nimport type { FunctionalRequirementConfig } from './functional-requirement.schemas';\nimport type { NonFunctionalRequirementConfig } from './non-functional-requirement.schemas';\nimport type { RequirementsAuthoredMetadata } from './requirements-authored-metadata.schemas';\nimport {\n FUNCTIONAL_REQUIREMENT_REF_PATTERN,\n NON_FUNCTIONAL_REQUIREMENT_REF_PATTERN,\n} from './requirements-references.schemas';\nimport type { RequirementsSnapshot } from './requirements-snapshot.schemas';\n\n/**\n * @wildo_source:part:start requirements.snapshot.validation facet:layer:specification facet:family:requirements\n *\n * Authoring-consistency validator for an assembled `RequirementsSnapshot`.\n *\n * The function is a **pure**, **typed** graph walker over the snapshot —\n * no Zod introspection, no registry access, no I/O (the `_core`\n * validator convention shared with `validateMarketSnapshot` /\n * `validateVisionSnapshot` / `validateAssertionSpecificationSnapshot`).\n * Zod already enforces structural validity (ref formats at parse time);\n * this walker adds the cross-entity + completeness checks Zod cannot\n * express, the defence-in-depth ref-format check for type-asserted\n * fixtures that bypass parsing, and the fail-soft cross-family ICP/job\n * ref resolution.\n *\n * Rule table — 7 kinds (scaffold depth, Phase J1 — deeper requirement\n * quality / prioritization / dependency analysis is Phase J2):\n *\n * | Kind | Severity | Trigger |\n * |-------------------------------|----------|--------------------------------------------------------------------------------|\n * | `INVALID_REF_FORMAT` | ERROR | A functional / non-functional ref fails its shared pattern (single source of truth with the Zod schema). Defence in depth for type-asserted fixtures. |\n * | `DUPLICATE_REF` | ERROR | Two functional (or two non-functional) requirements share a ref — the collection silently loses one entity to last-wins indexing. |\n * | `DUPLICATE_CROSS_REF` | WARN | The same `icpRefs` (or `jobRefs`) entry is listed more than once on ONE requirement — the repeat is noise the catalog silently dedupes (or double-counts in coverage). Intra-snapshot, so it runs UNCONDITIONALLY (no external set needed) — mirrors the assertions family's `DUPLICATE_PIN_REF`. |\n * | `NO_FUNCTIONAL_REQUIREMENTS` | WARN | `functional` empty — the requirements brief states no capability the product must provide. |\n * | `STALE_AUTHORED` | WARN | Any entity's `authored.lastAuthoredAt + reviewCadence < now`. No check when `reviewCadence` is undefined or `AS_NEEDED`. |\n * | `UNKNOWN_ICP_REF` | ERROR | An `icpRefs` entry does not resolve in `options.availableIcpRefs`. SKIPPED (fail-soft) when no set is passed — the families are decoupled and the catalog resolves refs. |\n * | `UNKNOWN_JOB_REF` | ERROR | A `jobRefs` entry does not resolve in `options.availableJobRefs`. SKIPPED (fail-soft) when no set is passed. |\n *\n * Severity is a TS enum (project rule — enums over literal unions). The\n * validator never mutates the snapshot. Issue ordering is detector-order\n * then walk-order — NOT a stable contract; callers group/sort by `kind` +\n * `severity` themselves.\n */\nexport enum RequirementsSnapshotIssueKind {\n /**\n * A functional / non-functional ref violates its kebab-case prefix\n * contract. The Zod schema rejects this at parse time; the detector\n * remains as defence in depth for callers that bypass parsing (tests\n * building snapshots with type-asserted fixtures). ERROR.\n */\n INVALID_REF_FORMAT = 'invalid_ref_format',\n /**\n * Two entities in the same collection share a ref. The collection is\n * addressed by ref downstream, so a duplicate silently drops one\n * entity. ERROR.\n */\n DUPLICATE_REF = 'duplicate_ref',\n /**\n * The same ICP / job ref appears more than once on ONE requirement's\n * cross-ref list. The repeat carries no meaning — the catalog dedupes\n * it (or double-counts it in coverage). WARN, not ERROR: the\n * requirement is still valid, the authoring is just untidy. Runs\n * unconditionally (intra-snapshot, needs no external set) — mirrors\n * the assertions family's `DUPLICATE_PIN_REF`.\n */\n DUPLICATE_CROSS_REF = 'duplicate_cross_ref',\n /** `functional` empty — the brief states no required capability (WARN). */\n NO_FUNCTIONAL_REQUIREMENTS = 'no_functional_requirements',\n /** `lastAuthoredAt + reviewCadence < now` (WARN — market/vision parity). */\n STALE_AUTHORED = 'stale_authored',\n /**\n * An `icpRefs` entry does not resolve against the supplied ICP-ref set\n * — a dangling cross-family reference. ERROR when a set is supplied;\n * the whole check is SKIPPED (fail-soft) when it is not.\n */\n UNKNOWN_ICP_REF = 'unknown_icp_ref',\n /**\n * A `jobRefs` entry does not resolve against the supplied job-ref set.\n * ERROR when a set is supplied; SKIPPED (fail-soft) when it is not.\n */\n UNKNOWN_JOB_REF = 'unknown_job_ref',\n}\n\nexport enum RequirementsSnapshotIssueSeverity {\n ERROR = 'error',\n WARN = 'warn',\n}\n\nexport interface RequirementsSnapshotIssue {\n kind: RequirementsSnapshotIssueKind;\n /** Dotted path inside the snapshot (e.g. `'nonFunctional[2].ref'`). */\n path: string;\n message: string;\n severity: RequirementsSnapshotIssueSeverity;\n}\n\nexport interface RequirementsSnapshotValidationResult {\n /** `true` iff no issue has severity `ERROR`. */\n ok: boolean;\n issues: RequirementsSnapshotIssue[];\n}\n\nexport interface ValidateRequirementsSnapshotOptions {\n /** Override \"now\" for `STALE_AUTHORED` checks (test affordance). Defaults to `new Date()`. */\n now?: Date;\n /**\n * Resolvable market ICP refs. When supplied, every `icpRefs` entry not\n * in the set is reported as `UNKNOWN_ICP_REF`. When omitted, the check\n * is skipped entirely (fail-soft — the requirements family is\n * decoupled from the market family; the catalog owns resolution).\n */\n availableIcpRefs?: ReadonlySet<string>;\n /**\n * Resolvable market job refs. Same skip-when-omitted semantics as\n * `availableIcpRefs`, reported as `UNKNOWN_JOB_REF`.\n */\n availableJobRefs?: ReadonlySet<string>;\n}\n\n/**\n * Days-per-cadence mapping, mirrored from the market / vision / assertions\n * validators (module-local there too — a shared promotion is part of the\n * deferred authored-metadata generalization).\n */\nconst REVIEW_CADENCE_TO_DAYS: Record<ReviewCadence, number> = {\n [ReviewCadence.WEEKLY]: 7,\n [ReviewCadence.MONTHLY]: 31,\n [ReviewCadence.QUARTERLY]: 92,\n [ReviewCadence.YEARLY]: 366,\n [ReviewCadence.AS_NEEDED]: Number.POSITIVE_INFINITY,\n};\n\nexport function validateRequirementsSnapshot(\n snapshot: RequirementsSnapshot,\n options?: ValidateRequirementsSnapshotOptions,\n): RequirementsSnapshotValidationResult {\n const issues: RequirementsSnapshotIssue[] = [];\n\n detectInvalidRefFormats(snapshot, issues);\n detectDuplicateRefs(snapshot, issues);\n detectDuplicateCrossRefs(snapshot, issues);\n detectIncompleteness(snapshot, issues);\n detectStaleAuthored(snapshot, options?.now ?? new Date(), issues);\n detectUnknownCrossRefs(snapshot, options, issues);\n\n const ok = issues.every(\n issue => issue.severity !== RequirementsSnapshotIssueSeverity.ERROR,\n );\n return { ok, issues };\n}\n\n// ────────────────────────────────────────────────────────────────────\n// Detectors — one per rule, kept small and independently testable.\n// ────────────────────────────────────────────────────────────────────\n\nfunction detectInvalidRefFormats(\n snapshot: RequirementsSnapshot,\n issues: RequirementsSnapshotIssue[],\n): void {\n snapshot.functional.forEach((entry, index) => {\n if (FUNCTIONAL_REQUIREMENT_REF_PATTERN.test(entry.ref)) return;\n issues.push({\n kind: RequirementsSnapshotIssueKind.INVALID_REF_FORMAT,\n path: `functional[${index}].ref`,\n message: `Functional-requirement ref \"${entry.ref}\" is not kebab-case with the \"functional-requirement-\" prefix.`,\n severity: RequirementsSnapshotIssueSeverity.ERROR,\n });\n });\n snapshot.nonFunctional.forEach((entry, index) => {\n if (NON_FUNCTIONAL_REQUIREMENT_REF_PATTERN.test(entry.ref)) return;\n issues.push({\n kind: RequirementsSnapshotIssueKind.INVALID_REF_FORMAT,\n path: `nonFunctional[${index}].ref`,\n message: `Non-functional-requirement ref \"${entry.ref}\" is not kebab-case with the \"nfr-\" prefix.`,\n severity: RequirementsSnapshotIssueSeverity.ERROR,\n });\n });\n}\n\nfunction detectDuplicateRefs(\n snapshot: RequirementsSnapshot,\n issues: RequirementsSnapshotIssue[],\n): void {\n reportDuplicates(\n snapshot.functional.map(entry => entry.ref),\n 'functional',\n issues,\n );\n reportDuplicates(\n snapshot.nonFunctional.map(entry => entry.ref),\n 'nonFunctional',\n issues,\n );\n}\n\nfunction reportDuplicates(\n refs: string[],\n collection: string,\n issues: RequirementsSnapshotIssue[],\n): void {\n const seen = new Set<string>();\n refs.forEach((ref, index) => {\n if (!seen.has(ref)) {\n seen.add(ref);\n return;\n }\n issues.push({\n kind: RequirementsSnapshotIssueKind.DUPLICATE_REF,\n path: `${collection}[${index}].ref`,\n message: `Duplicate ref \"${ref}\" in ${collection} — refs must be unique; the collection is addressed by ref downstream.`,\n severity: RequirementsSnapshotIssueSeverity.ERROR,\n });\n });\n}\n\nfunction detectDuplicateCrossRefs(\n snapshot: RequirementsSnapshot,\n issues: RequirementsSnapshotIssue[],\n): void {\n const checkList = (\n refs: readonly string[] | undefined,\n entity: FunctionalRequirementConfig | NonFunctionalRequirementConfig,\n path: string,\n ): void => {\n if (refs === undefined) return;\n const seen = new Set<string>();\n refs.forEach((ref, refIndex) => {\n if (!seen.has(ref)) {\n seen.add(ref);\n return;\n }\n issues.push({\n kind: RequirementsSnapshotIssueKind.DUPLICATE_CROSS_REF,\n path: `${path}[${refIndex}]`,\n message: `Cross-ref \"${ref}\" is listed more than once on requirement \"${entity.ref}\" (${path}). Remove the duplicate.`,\n severity: RequirementsSnapshotIssueSeverity.WARN,\n });\n });\n };\n\n const checkEntity = (\n entry: FunctionalRequirementConfig | NonFunctionalRequirementConfig,\n collection: string,\n index: number,\n ): void => {\n checkList(entry.icpRefs, entry, `${collection}[${index}].icpRefs`);\n checkList(entry.jobRefs, entry, `${collection}[${index}].jobRefs`);\n };\n\n snapshot.functional.forEach((entry, index) => checkEntity(entry, 'functional', index));\n snapshot.nonFunctional.forEach((entry, index) => checkEntity(entry, 'nonFunctional', index));\n}\n\nfunction detectIncompleteness(\n snapshot: RequirementsSnapshot,\n issues: RequirementsSnapshotIssue[],\n): void {\n if (snapshot.functional.length === 0) {\n issues.push({\n kind: RequirementsSnapshotIssueKind.NO_FUNCTIONAL_REQUIREMENTS,\n path: 'functional',\n message: 'Requirements brief states no functional requirements — it describes no capability the product must provide.',\n severity: RequirementsSnapshotIssueSeverity.WARN,\n });\n }\n}\n\nfunction detectStaleAuthored(\n snapshot: RequirementsSnapshot,\n now: Date,\n issues: RequirementsSnapshotIssue[],\n): void {\n const checkOne = (authored: RequirementsAuthoredMetadata | undefined, path: string): void => {\n if (authored?.reviewCadence === undefined) return;\n const days = REVIEW_CADENCE_TO_DAYS[authored.reviewCadence];\n if (!Number.isFinite(days)) return;\n const lastAuthored = new Date(authored.lastAuthoredAt).getTime();\n if (Number.isNaN(lastAuthored)) return;\n const ageDays = (now.getTime() - lastAuthored) / (24 * 60 * 60 * 1000);\n if (ageDays <= days) return;\n issues.push({\n kind: RequirementsSnapshotIssueKind.STALE_AUTHORED,\n path,\n message: `Requirements entity at \"${path}\" is ${Math.floor(ageDays)} days old (cadence ${authored.reviewCadence} ⇒ ${days}d). Re-author or remove the cadence.`,\n severity: RequirementsSnapshotIssueSeverity.WARN,\n });\n };\n\n snapshot.functional.forEach((entry, index) =>\n checkOne(entry.authored, `functional[${index}].authored`),\n );\n snapshot.nonFunctional.forEach((entry, index) =>\n checkOne(entry.authored, `nonFunctional[${index}].authored`),\n );\n}\n\nfunction detectUnknownCrossRefs(\n snapshot: RequirementsSnapshot,\n options: ValidateRequirementsSnapshotOptions | undefined,\n issues: RequirementsSnapshotIssue[],\n): void {\n const checkEntity = (\n entry: FunctionalRequirementConfig | NonFunctionalRequirementConfig,\n collection: string,\n index: number,\n ): void => {\n if (options?.availableIcpRefs !== undefined) {\n entry.icpRefs?.forEach((icpRef, refIndex) => {\n if (options.availableIcpRefs!.has(icpRef)) return;\n issues.push({\n kind: RequirementsSnapshotIssueKind.UNKNOWN_ICP_REF,\n path: `${collection}[${index}].icpRefs[${refIndex}]`,\n message: `ICP ref \"${icpRef}\" on requirement \"${entry.ref}\" does not resolve in the supplied ICP-ref set.`,\n severity: RequirementsSnapshotIssueSeverity.ERROR,\n });\n });\n }\n if (options?.availableJobRefs !== undefined) {\n entry.jobRefs?.forEach((jobRef, refIndex) => {\n if (options.availableJobRefs!.has(jobRef)) return;\n issues.push({\n kind: RequirementsSnapshotIssueKind.UNKNOWN_JOB_REF,\n path: `${collection}[${index}].jobRefs[${refIndex}]`,\n message: `Job ref \"${jobRef}\" on requirement \"${entry.ref}\" does not resolve in the supplied job-ref set.`,\n severity: RequirementsSnapshotIssueSeverity.ERROR,\n });\n });\n }\n };\n\n snapshot.functional.forEach((entry, index) => checkEntity(entry, 'functional', index));\n snapshot.nonFunctional.forEach((entry, index) => checkEntity(entry, 'nonFunctional', index));\n}\n/** @wildo_source:part:end requirements.snapshot.validation */\n"]}
1
+ {"version":3,"file":"requirements-snapshot-validation.js","sourceRoot":"","sources":["../../../../../src/_core/requirements/requirements-snapshot-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAI3E,OAAO,EACL,kCAAkC,EAClC,sCAAsC,GACvC,MAAM,mCAAmC,CAAC;AAG3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAN,IAAY,6BAsCX;AAtCD,WAAY,6BAA6B;IACvC;;;;;OAKG;IACH,0EAAyC,CAAA;IACzC;;;;OAIG;IACH,gEAA+B,CAAA;IAC/B;;;;;;;OAOG;IACH,4EAA2C,CAAA;IAC3C,2EAA2E;IAC3E,0FAAyD,CAAA;IACzD,4EAA4E;IAC5E,kEAAiC,CAAA;IACjC;;;;OAIG;IACH,oEAAmC,CAAA;IACnC;;;OAGG;IACH,oEAAmC,CAAA;AACrC,CAAC,EAtCW,6BAA6B,KAA7B,6BAA6B,QAsCxC;AAED,MAAM,CAAN,IAAY,iCAGX;AAHD,WAAY,iCAAiC;IAC3C,oDAAe,CAAA;IACf,kDAAa,CAAA;AACf,CAAC,EAHW,iCAAiC,KAAjC,iCAAiC,QAG5C;AAgDD;;;;GAIG;AACH,MAAM,sBAAsB,GAAkC;IAC5D,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;IACzB,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,EAAE;IAC3B,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,EAAE;IAC7B,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,GAAG;IAC3B,CA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CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE;gBAC1C,IAAI,OAAO,CAAC,gBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC;oBAAE,OAAO;gBAClD,MAAM,CAAC,IAAI,CAAC;oBACV,IAAI,EAAE,6BAA6B,CAAC,eAAe;oBACnD,IAAI,EAAE,GAAG,UAAU,IAAI,KAAK,aAAa,QAAQ,GAAG;oBACpD,OAAO,EAAE,YAAY,MAAM,qBAAqB,KAAK,CAAC,GAAG,iDAAiD;oBAC1G,QAAQ,EAAE,iCAAiC,CAAC,KAAK;iBAClD,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;IAEF,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC;IACvF,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC,CAAC;AAC/F,CAAC;AACD,8DAA8D","sourcesContent":["import { ReviewCadence } from '../market/market-authored-metadata.schemas';\nimport type { FunctionalRequirementConfig } from './functional-requirement.schemas';\nimport type { NonFunctionalRequirementConfig } from './non-functional-requirement.schemas';\nimport type { RequirementsAuthoredMetadata } from './requirements-authored-metadata.schemas';\nimport {\n FUNCTIONAL_REQUIREMENT_REF_PATTERN,\n NON_FUNCTIONAL_REQUIREMENT_REF_PATTERN,\n} from './requirements-references.schemas';\nimport type { RequirementsSnapshot } from './requirements-snapshot.schemas';\n\n/**\n * @wildo_source:part:start requirements.snapshot.validation facet:layer:specification facet:family:requirements\n *\n * Authoring-consistency validator for an assembled `RequirementsSnapshot`.\n *\n * The function is a **pure**, **typed** graph walker over the snapshot —\n * no Zod introspection, no registry access, no I/O (the `_core`\n * validator convention shared with `validateMarketSnapshot` /\n * `validateVisionSnapshot` / `validateAssertionSpecificationSnapshot`).\n * Zod already enforces structural validity (ref formats at parse time);\n * this walker adds the cross-entity + completeness checks Zod cannot\n * express, the defence-in-depth ref-format check for type-asserted\n * fixtures that bypass parsing, and the fail-soft cross-family ICP/job\n * ref resolution.\n *\n * Rule table — 7 kinds (scaffold depth, Phase J1 — deeper requirement\n * quality / prioritization / dependency analysis is Phase J2):\n *\n * | Kind | Severity | Trigger |\n * |-------------------------------|----------|--------------------------------------------------------------------------------|\n * | `INVALID_REF_FORMAT` | ERROR | A functional / non-functional ref fails its shared pattern (single source of truth with the Zod schema). Defence in depth for type-asserted fixtures. |\n * | `DUPLICATE_REF` | ERROR | Two functional (or two non-functional) requirements share a ref — the collection silently loses one entity to last-wins indexing. |\n * | `DUPLICATE_CROSS_REF` | WARN | The same `icpRefs` (or `jobRefs`) entry is listed more than once on ONE requirement — the repeat is noise the catalog silently dedupes (or double-counts in coverage). Intra-snapshot, so it runs UNCONDITIONALLY (no external set needed) — mirrors the assertions family's `DUPLICATE_PIN_REF`. |\n * | `NO_FUNCTIONAL_REQUIREMENTS` | WARN | `functional` empty — the requirements brief states no capability the product must provide. |\n * | `STALE_AUTHORED` | WARN | Any entity's `authored.lastAuthoredAt + reviewCadence < now`. No check when `reviewCadence` is undefined or `AS_NEEDED`. |\n * | `UNKNOWN_ICP_REF` | ERROR | An `icpRefs` entry does not resolve in `options.availableIcpRefs`. SKIPPED (fail-soft) when no set is passed — the families are decoupled and the catalog resolves refs. |\n * | `UNKNOWN_JOB_REF` | ERROR | A `jobRefs` entry does not resolve in `options.availableJobRefs`. SKIPPED (fail-soft) when no set is passed. |\n *\n * Severity is a TS enum (project rule — enums over literal unions). The\n * validator never mutates the snapshot. Issue ordering is detector-order\n * then walk-order — NOT a stable contract; callers group/sort by `kind` +\n * `severity` themselves.\n */\nexport enum RequirementsSnapshotIssueKind {\n /**\n * A functional / non-functional ref violates its kebab-case prefix\n * contract. The Zod schema rejects this at parse time; the detector\n * remains as defence in depth for callers that bypass parsing (tests\n * building snapshots with type-asserted fixtures). ERROR.\n */\n INVALID_REF_FORMAT = 'invalid_ref_format',\n /**\n * Two entities in the same collection share a ref. The collection is\n * addressed by ref downstream, so a duplicate silently drops one\n * entity. ERROR.\n */\n DUPLICATE_REF = 'duplicate_ref',\n /**\n * The same ICP / job ref appears more than once on ONE requirement's\n * cross-ref list. The repeat carries no meaning — the catalog dedupes\n * it (or double-counts it in coverage). WARN, not ERROR: the\n * requirement is still valid, the authoring is just untidy. Runs\n * unconditionally (intra-snapshot, needs no external set) — mirrors\n * the assertions family's `DUPLICATE_PIN_REF`.\n */\n DUPLICATE_CROSS_REF = 'duplicate_cross_ref',\n /** `functional` empty — the brief states no required capability (WARN). */\n NO_FUNCTIONAL_REQUIREMENTS = 'no_functional_requirements',\n /** `lastAuthoredAt + reviewCadence < now` (WARN — market/vision parity). */\n STALE_AUTHORED = 'stale_authored',\n /**\n * An `icpRefs` entry does not resolve against the supplied ICP-ref set\n * — a dangling cross-family reference. ERROR when a set is supplied;\n * the whole check is SKIPPED (fail-soft) when it is not.\n */\n UNKNOWN_ICP_REF = 'unknown_icp_ref',\n /**\n * A `jobRefs` entry does not resolve against the supplied job-ref set.\n * ERROR when a set is supplied; SKIPPED (fail-soft) when it is not.\n */\n UNKNOWN_JOB_REF = 'unknown_job_ref',\n}\n\nexport enum RequirementsSnapshotIssueSeverity {\n ERROR = 'error',\n WARN = 'warn',\n}\n\nexport interface RequirementsSnapshotIssue {\n kind: RequirementsSnapshotIssueKind;\n /** Dotted path inside the snapshot (e.g. `'nonFunctional[2].ref'`). */\n path: string;\n message: string;\n severity: RequirementsSnapshotIssueSeverity;\n}\n\nexport interface RequirementsSnapshotValidationResult {\n /** `true` iff no issue has severity `ERROR`. */\n ok: boolean;\n issues: RequirementsSnapshotIssue[];\n}\n\n/**\n * Options for this family validator.\n *\n * ## The cross-family sets are OPT-IN, and omitting one SKIPS its check\n *\n * A family validator sees one family. It cannot resolve a reference into another family's\n * vocabulary unless you hand it that family's refs — so each `available*Refs` option is the caller\n * saying \"I have this context, use it\". Omit one and the matching check does not run: no issue is\n * reported, and the absence looks exactly like a snapshot with no such reference.\n *\n * That is deliberate — the families are decoupled on purpose — but it means a validator called with\n * the snapshot alone is checking this family's INTERNAL consistency only. If you want dangling\n * cross-family references caught, supply the sets; if you validate one family in isolation, expect\n * them to be found later by whatever holds every family at once.\n */\nexport interface ValidateRequirementsSnapshotOptions {\n /** Override \"now\" for `STALE_AUTHORED` checks (test affordance). Defaults to `new Date()`. */\n now?: Date;\n /**\n * Resolvable market ICP refs. When supplied, every `icpRefs` entry not\n * in the set is reported as `UNKNOWN_ICP_REF`. When omitted, the check\n * is skipped entirely (fail-soft — the requirements family is\n * decoupled from the market family; the catalog owns resolution).\n */\n availableIcpRefs?: ReadonlySet<string>;\n /**\n * Resolvable market job refs. Same skip-when-omitted semantics as\n * `availableIcpRefs`, reported as `UNKNOWN_JOB_REF`.\n */\n availableJobRefs?: ReadonlySet<string>;\n}\n\n/**\n * Days-per-cadence mapping, mirrored from the market / vision / assertions\n * validators (module-local there too — a shared promotion is part of the\n * deferred authored-metadata generalization).\n */\nconst REVIEW_CADENCE_TO_DAYS: Record<ReviewCadence, number> = {\n [ReviewCadence.WEEKLY]: 7,\n [ReviewCadence.MONTHLY]: 31,\n [ReviewCadence.QUARTERLY]: 92,\n [ReviewCadence.YEARLY]: 366,\n [ReviewCadence.AS_NEEDED]: Number.POSITIVE_INFINITY,\n};\n\nexport function validateRequirementsSnapshot(\n snapshot: RequirementsSnapshot,\n options?: ValidateRequirementsSnapshotOptions,\n): RequirementsSnapshotValidationResult {\n const issues: RequirementsSnapshotIssue[] = [];\n\n detectInvalidRefFormats(snapshot, issues);\n detectDuplicateRefs(snapshot, issues);\n detectDuplicateCrossRefs(snapshot, issues);\n detectIncompleteness(snapshot, issues);\n detectStaleAuthored(snapshot, options?.now ?? new Date(), issues);\n detectUnknownCrossRefs(snapshot, options, issues);\n\n const ok = issues.every(\n issue => issue.severity !== RequirementsSnapshotIssueSeverity.ERROR,\n );\n return { ok, issues };\n}\n\n// ────────────────────────────────────────────────────────────────────\n// Detectors — one per rule, kept small and independently testable.\n// ────────────────────────────────────────────────────────────────────\n\nfunction detectInvalidRefFormats(\n snapshot: RequirementsSnapshot,\n issues: RequirementsSnapshotIssue[],\n): void {\n snapshot.functional.forEach((entry, index) => {\n if (FUNCTIONAL_REQUIREMENT_REF_PATTERN.test(entry.ref)) return;\n issues.push({\n kind: RequirementsSnapshotIssueKind.INVALID_REF_FORMAT,\n path: `functional[${index}].ref`,\n message: `Functional-requirement ref \"${entry.ref}\" is not kebab-case with the \"functional-requirement-\" prefix.`,\n severity: RequirementsSnapshotIssueSeverity.ERROR,\n });\n });\n snapshot.nonFunctional.forEach((entry, index) => {\n if (NON_FUNCTIONAL_REQUIREMENT_REF_PATTERN.test(entry.ref)) return;\n issues.push({\n kind: RequirementsSnapshotIssueKind.INVALID_REF_FORMAT,\n path: `nonFunctional[${index}].ref`,\n message: `Non-functional-requirement ref \"${entry.ref}\" is not kebab-case with the \"nfr-\" prefix.`,\n severity: RequirementsSnapshotIssueSeverity.ERROR,\n });\n });\n}\n\nfunction detectDuplicateRefs(\n snapshot: RequirementsSnapshot,\n issues: RequirementsSnapshotIssue[],\n): void {\n reportDuplicates(\n snapshot.functional.map(entry => entry.ref),\n 'functional',\n issues,\n );\n reportDuplicates(\n snapshot.nonFunctional.map(entry => entry.ref),\n 'nonFunctional',\n issues,\n );\n}\n\nfunction reportDuplicates(\n refs: string[],\n collection: string,\n issues: RequirementsSnapshotIssue[],\n): void {\n const seen = new Set<string>();\n refs.forEach((ref, index) => {\n if (!seen.has(ref)) {\n seen.add(ref);\n return;\n }\n issues.push({\n kind: RequirementsSnapshotIssueKind.DUPLICATE_REF,\n path: `${collection}[${index}].ref`,\n message: `Duplicate ref \"${ref}\" in ${collection} — refs must be unique; the collection is addressed by ref downstream.`,\n severity: RequirementsSnapshotIssueSeverity.ERROR,\n });\n });\n}\n\nfunction detectDuplicateCrossRefs(\n snapshot: RequirementsSnapshot,\n issues: RequirementsSnapshotIssue[],\n): void {\n const checkList = (\n refs: readonly string[] | undefined,\n entity: FunctionalRequirementConfig | NonFunctionalRequirementConfig,\n path: string,\n ): void => {\n if (refs === undefined) return;\n const seen = new Set<string>();\n refs.forEach((ref, refIndex) => {\n if (!seen.has(ref)) {\n seen.add(ref);\n return;\n }\n issues.push({\n kind: RequirementsSnapshotIssueKind.DUPLICATE_CROSS_REF,\n path: `${path}[${refIndex}]`,\n message: `Cross-ref \"${ref}\" is listed more than once on requirement \"${entity.ref}\" (${path}). Remove the duplicate.`,\n severity: RequirementsSnapshotIssueSeverity.WARN,\n });\n });\n };\n\n const checkEntity = (\n entry: FunctionalRequirementConfig | NonFunctionalRequirementConfig,\n collection: string,\n index: number,\n ): void => {\n checkList(entry.icpRefs, entry, `${collection}[${index}].icpRefs`);\n checkList(entry.jobRefs, entry, `${collection}[${index}].jobRefs`);\n };\n\n snapshot.functional.forEach((entry, index) => checkEntity(entry, 'functional', index));\n snapshot.nonFunctional.forEach((entry, index) => checkEntity(entry, 'nonFunctional', index));\n}\n\nfunction detectIncompleteness(\n snapshot: RequirementsSnapshot,\n issues: RequirementsSnapshotIssue[],\n): void {\n if (snapshot.functional.length === 0) {\n issues.push({\n kind: RequirementsSnapshotIssueKind.NO_FUNCTIONAL_REQUIREMENTS,\n path: 'functional',\n message: 'Requirements brief states no functional requirements — it describes no capability the product must provide.',\n severity: RequirementsSnapshotIssueSeverity.WARN,\n });\n }\n}\n\nfunction detectStaleAuthored(\n snapshot: RequirementsSnapshot,\n now: Date,\n issues: RequirementsSnapshotIssue[],\n): void {\n const checkOne = (authored: RequirementsAuthoredMetadata | undefined, path: string): void => {\n if (authored?.reviewCadence === undefined) return;\n const days = REVIEW_CADENCE_TO_DAYS[authored.reviewCadence];\n if (!Number.isFinite(days)) return;\n const lastAuthored = new Date(authored.lastAuthoredAt).getTime();\n if (Number.isNaN(lastAuthored)) return;\n const ageDays = (now.getTime() - lastAuthored) / (24 * 60 * 60 * 1000);\n if (ageDays <= days) return;\n issues.push({\n kind: RequirementsSnapshotIssueKind.STALE_AUTHORED,\n path,\n message: `Requirements entity at \"${path}\" is ${Math.floor(ageDays)} days old (cadence ${authored.reviewCadence} ⇒ ${days}d). Re-author or remove the cadence.`,\n severity: RequirementsSnapshotIssueSeverity.WARN,\n });\n };\n\n snapshot.functional.forEach((entry, index) =>\n checkOne(entry.authored, `functional[${index}].authored`),\n );\n snapshot.nonFunctional.forEach((entry, index) =>\n checkOne(entry.authored, `nonFunctional[${index}].authored`),\n );\n}\n\nfunction detectUnknownCrossRefs(\n snapshot: RequirementsSnapshot,\n options: ValidateRequirementsSnapshotOptions | undefined,\n issues: RequirementsSnapshotIssue[],\n): void {\n const checkEntity = (\n entry: FunctionalRequirementConfig | NonFunctionalRequirementConfig,\n collection: string,\n index: number,\n ): void => {\n if (options?.availableIcpRefs !== undefined) {\n entry.icpRefs?.forEach((icpRef, refIndex) => {\n if (options.availableIcpRefs!.has(icpRef)) return;\n issues.push({\n kind: RequirementsSnapshotIssueKind.UNKNOWN_ICP_REF,\n path: `${collection}[${index}].icpRefs[${refIndex}]`,\n message: `ICP ref \"${icpRef}\" on requirement \"${entry.ref}\" does not resolve in the supplied ICP-ref set.`,\n severity: RequirementsSnapshotIssueSeverity.ERROR,\n });\n });\n }\n if (options?.availableJobRefs !== undefined) {\n entry.jobRefs?.forEach((jobRef, refIndex) => {\n if (options.availableJobRefs!.has(jobRef)) return;\n issues.push({\n kind: RequirementsSnapshotIssueKind.UNKNOWN_JOB_REF,\n path: `${collection}[${index}].jobRefs[${refIndex}]`,\n message: `Job ref \"${jobRef}\" on requirement \"${entry.ref}\" does not resolve in the supplied job-ref set.`,\n severity: RequirementsSnapshotIssueSeverity.ERROR,\n });\n });\n }\n };\n\n snapshot.functional.forEach((entry, index) => checkEntity(entry, 'functional', index));\n snapshot.nonFunctional.forEach((entry, index) => checkEntity(entry, 'nonFunctional', index));\n}\n/** @wildo_source:part:end requirements.snapshot.validation */\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"roadmap-snapshot-generation.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/_core/roadmap/roadmap-snapshot-generation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhF,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,4BAA4B,CAAC;AAIpC,eAAO,MAAM,4BAA4B;;;;;;;;;;;kBAWvC,CAAC;AAEH,oEAAoE;AACpE,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;kBAK1C,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF,mFAAmF;AACnF,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAiB9E"}
1
+ {"version":3,"file":"roadmap-snapshot-generation.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/_core/roadmap/roadmap-snapshot-generation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhF,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,4BAA4B,CAAC;AAIpC,eAAO,MAAM,4BAA4B;;;;;;;;;;;kBAWvC,CAAC;AAEH,oEAAoE;AACpE,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;kBAS1C,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF,mFAAmF;AACnF,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAiB9E"}
@@ -2,6 +2,7 @@ import { z } from 'zod';
2
2
  import { NonEmptyStringSchema } from '../market/market-references.schemas.js';
3
3
  import { RoadmapPhaseHorizon, RoadmapPhaseKind } from './roadmap-phase.schemas.js';
4
4
  import { ROADMAP_PHASE_REF_PREFIX } from './roadmap-references.schemas.js';
5
+ import { applyFamilyRefPrefix } from '../utils/family-ref-stamping.js';
5
6
  import { RoadmapSnapshotSchema, RoadmapSnapshotVersion, } from './roadmap-snapshot.schemas.js';
6
7
  const SemanticSlugSchema = z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);
7
8
  export const RoadmapPhaseGenerationSchema = z.strictObject({
@@ -20,7 +21,11 @@ export const RoadmapPhaseGenerationSchema = z.strictObject({
20
21
  export const RoadmapSnapshotGenerationSchema = z.strictObject({
21
22
  phases: z.array(RoadmapPhaseGenerationSchema).min(1),
22
23
  }).superRefine((generated, context) => {
23
- reportDuplicates(generated.phases.map(phase => phase.slug), 'slug', context);
24
+ // Keyed on the STAMPED form, not on the authored slug, because `applyFamilyRefPrefix` is deliberately
25
+ // not injective: `mvp` and `roadmap-phase-mvp` are two distinct slugs that both become
26
+ // `roadmap-phase-mvp`. Checking the slug would let that pair through and produce two phases sharing
27
+ // one ref, which makes every `deliversRequirementRefs` edge pointing at it ambiguous.
28
+ reportDuplicates(generated.phases.map(phase => applyFamilyRefPrefix(phase.slug, ROADMAP_PHASE_REF_PREFIX)), 'slug', context);
24
29
  reportDuplicates(generated.phases.map(phase => phase.sequence), 'sequence', context);
25
30
  });
26
31
  /** Normalize strict provider output into canonical persisted application truth. */
@@ -29,7 +34,7 @@ export function parseRoadmapSnapshotGeneration(input) {
29
34
  return RoadmapSnapshotSchema.parse({
30
35
  version: RoadmapSnapshotVersion.V1,
31
36
  phases: generated.phases.map(phase => ({
32
- ref: `${ROADMAP_PHASE_REF_PREFIX}${phase.slug}`,
37
+ ref: applyFamilyRefPrefix(phase.slug, ROADMAP_PHASE_REF_PREFIX),
33
38
  sequence: phase.sequence,
34
39
  title: phase.title,
35
40
  ...(phase.theme === null ? {} : { theme: phase.theme }),
@@ -1 +1 @@
1
- {"version":3,"file":"roadmap-snapshot-generation.schemas.js","sourceRoot":"","sources":["../../../../../src/_core/roadmap/roadmap-snapshot-generation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GAEvB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAE1E,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,YAAY,CAAC;IACzD,IAAI,EAAE,kBAAkB;IACxB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IAC1B,KAAK,EAAE,oBAAoB;IAC3B,KAAK,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IACtC,SAAS,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IAC1C,YAAY,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IAC7C,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,QAAQ,EAAE;IAC/C,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE;IACzC,uBAAuB,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;IACtD,4BAA4B,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;CAC5D,CAAC,CAAC;AAEH,oEAAoE;AACpE,MAAM,CAA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AAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;IACvI,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { z } from 'zod';\n\nimport { NonEmptyStringSchema } from '../market/market-references.schemas';\nimport { RoadmapPhaseHorizon, RoadmapPhaseKind } from './roadmap-phase.schemas';\nimport { ROADMAP_PHASE_REF_PREFIX } from './roadmap-references.schemas';\nimport {\n RoadmapSnapshotSchema,\n RoadmapSnapshotVersion,\n type RoadmapSnapshot,\n} from './roadmap-snapshot.schemas';\n\nconst SemanticSlugSchema = z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);\n\nexport const RoadmapPhaseGenerationSchema = z.strictObject({\n slug: SemanticSlugSchema,\n sequence: z.number().int(),\n title: NonEmptyStringSchema,\n theme: NonEmptyStringSchema.nullable(),\n objective: NonEmptyStringSchema.nullable(),\n targetWindow: NonEmptyStringSchema.nullable(),\n horizon: z.enum(RoadmapPhaseHorizon).nullable(),\n kind: z.enum(RoadmapPhaseKind).nullable(),\n deliversRequirementRefs: z.array(NonEmptyStringSchema),\n deliversSuccessCriterionRefs: z.array(NonEmptyStringSchema),\n});\n\n/** Strict, non-vacuous provider response for the roadmap family. */\nexport const RoadmapSnapshotGenerationSchema = z.strictObject({\n phases: z.array(RoadmapPhaseGenerationSchema).min(1),\n}).superRefine((generated, context) => {\n reportDuplicates(generated.phases.map(phase => phase.slug), 'slug', context);\n reportDuplicates(generated.phases.map(phase => phase.sequence), 'sequence', context);\n});\nexport type RoadmapSnapshotGeneration = z.infer<typeof RoadmapSnapshotGenerationSchema>;\n\n/** Normalize strict provider output into canonical persisted application truth. */\nexport function parseRoadmapSnapshotGeneration(input: unknown): RoadmapSnapshot {\n const generated = RoadmapSnapshotGenerationSchema.parse(input);\n return RoadmapSnapshotSchema.parse({\n version: RoadmapSnapshotVersion.V1,\n phases: generated.phases.map(phase => ({\n ref: `${ROADMAP_PHASE_REF_PREFIX}${phase.slug}`,\n sequence: phase.sequence,\n title: phase.title,\n ...(phase.theme === null ? {} : { theme: phase.theme }),\n ...(phase.objective === null ? {} : { objective: phase.objective }),\n ...(phase.targetWindow === null ? {} : { targetWindow: phase.targetWindow }),\n ...(phase.horizon === null ? {} : { horizon: phase.horizon }),\n ...(phase.kind === null ? {} : { kind: phase.kind }),\n ...(phase.deliversRequirementRefs.length === 0 ? {} : { deliversRequirementRefs: phase.deliversRequirementRefs }),\n ...(phase.deliversSuccessCriterionRefs.length === 0 ? {} : { deliversSuccessCriterionRefs: phase.deliversSuccessCriterionRefs }),\n })),\n });\n}\n\nfunction reportDuplicates(values: readonly (string | number)[], field: 'slug' | 'sequence', context: z.RefinementCtx): void {\n const seen = new Set<string | number>();\n values.forEach((value, index) => {\n if (!seen.has(value)) {\n seen.add(value);\n return;\n }\n context.addIssue({ code: 'custom', path: ['phases', index, field], message: `duplicate roadmap phase ${field} \"${String(value)}\"` });\n });\n}\n"]}
1
+ {"version":3,"file":"roadmap-snapshot-generation.schemas.js","sourceRoot":"","sources":["../../../../../src/_core/roadmap/roadmap-snapshot-generation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GAEvB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAE1E,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,YAAY,CAAC;IACzD,IAAI,EAAE,kBAAkB;IACxB,QAAQ,EAAE,CAAC,CAAC,M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,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,4BAA4B,EAAE,KAAK,CAAC,4BAA4B,EAAE,CAAC;SACjI,CAAC,CAAC;KACJ,CAAC,CAAC;AACL,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAoC,EAAE,KAA0B,EAAE,OAAwB;IAClH,MAAM,IAAI,GAAG,IAAI,GAAG,EAAmB,CAAC;IACxC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC9B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAChB,OAAO;QACT,CAAC;QACD,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,2BAA2B,KAAK,KAAK,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;IACvI,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { z } from 'zod';\n\nimport { NonEmptyStringSchema } from '../market/market-references.schemas';\nimport { RoadmapPhaseHorizon, RoadmapPhaseKind } from './roadmap-phase.schemas';\nimport { ROADMAP_PHASE_REF_PREFIX } from './roadmap-references.schemas';\nimport { applyFamilyRefPrefix } from '../utils/family-ref-stamping';\nimport {\n RoadmapSnapshotSchema,\n RoadmapSnapshotVersion,\n type RoadmapSnapshot,\n} from './roadmap-snapshot.schemas';\n\nconst SemanticSlugSchema = z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);\n\nexport const RoadmapPhaseGenerationSchema = z.strictObject({\n slug: SemanticSlugSchema,\n sequence: z.number().int(),\n title: NonEmptyStringSchema,\n theme: NonEmptyStringSchema.nullable(),\n objective: NonEmptyStringSchema.nullable(),\n targetWindow: NonEmptyStringSchema.nullable(),\n horizon: z.enum(RoadmapPhaseHorizon).nullable(),\n kind: z.enum(RoadmapPhaseKind).nullable(),\n deliversRequirementRefs: z.array(NonEmptyStringSchema),\n deliversSuccessCriterionRefs: z.array(NonEmptyStringSchema),\n});\n\n/** Strict, non-vacuous provider response for the roadmap family. */\nexport const RoadmapSnapshotGenerationSchema = z.strictObject({\n phases: z.array(RoadmapPhaseGenerationSchema).min(1),\n}).superRefine((generated, context) => {\n // Keyed on the STAMPED form, not on the authored slug, because `applyFamilyRefPrefix` is deliberately\n // not injective: `mvp` and `roadmap-phase-mvp` are two distinct slugs that both become\n // `roadmap-phase-mvp`. Checking the slug would let that pair through and produce two phases sharing\n // one ref, which makes every `deliversRequirementRefs` edge pointing at it ambiguous.\n reportDuplicates(generated.phases.map(phase => applyFamilyRefPrefix(phase.slug, ROADMAP_PHASE_REF_PREFIX)), 'slug', context);\n reportDuplicates(generated.phases.map(phase => phase.sequence), 'sequence', context);\n});\nexport type RoadmapSnapshotGeneration = z.infer<typeof RoadmapSnapshotGenerationSchema>;\n\n/** Normalize strict provider output into canonical persisted application truth. */\nexport function parseRoadmapSnapshotGeneration(input: unknown): RoadmapSnapshot {\n const generated = RoadmapSnapshotGenerationSchema.parse(input);\n return RoadmapSnapshotSchema.parse({\n version: RoadmapSnapshotVersion.V1,\n phases: generated.phases.map(phase => ({\n ref: applyFamilyRefPrefix(phase.slug, ROADMAP_PHASE_REF_PREFIX),\n sequence: phase.sequence,\n title: phase.title,\n ...(phase.theme === null ? {} : { theme: phase.theme }),\n ...(phase.objective === null ? {} : { objective: phase.objective }),\n ...(phase.targetWindow === null ? {} : { targetWindow: phase.targetWindow }),\n ...(phase.horizon === null ? {} : { horizon: phase.horizon }),\n ...(phase.kind === null ? {} : { kind: phase.kind }),\n ...(phase.deliversRequirementRefs.length === 0 ? {} : { deliversRequirementRefs: phase.deliversRequirementRefs }),\n ...(phase.deliversSuccessCriterionRefs.length === 0 ? {} : { deliversSuccessCriterionRefs: phase.deliversSuccessCriterionRefs }),\n })),\n });\n}\n\nfunction reportDuplicates(values: readonly (string | number)[], field: 'slug' | 'sequence', context: z.RefinementCtx): void {\n const seen = new Set<string | number>();\n values.forEach((value, index) => {\n if (!seen.has(value)) {\n seen.add(value);\n return;\n }\n context.addIssue({ code: 'custom', path: ['phases', index, field], message: `duplicate roadmap phase ${field} \"${String(value)}\"` });\n });\n}\n"]}
@@ -96,6 +96,21 @@ export interface RoadmapSnapshotValidationResult {
96
96
  ok: boolean;
97
97
  issues: RoadmapSnapshotIssue[];
98
98
  }
99
+ /**
100
+ * Options for this family validator.
101
+ *
102
+ * ## The cross-family sets are OPT-IN, and omitting one SKIPS its check
103
+ *
104
+ * A family validator sees one family. It cannot resolve a reference into another family's
105
+ * vocabulary unless you hand it that family's refs — so each `available*Refs` option is the caller
106
+ * saying "I have this context, use it". Omit one and the matching check does not run: no issue is
107
+ * reported, and the absence looks exactly like a snapshot with no such reference.
108
+ *
109
+ * That is deliberate — the families are decoupled on purpose — but it means a validator called with
110
+ * the snapshot alone is checking this family's INTERNAL consistency only. If you want dangling
111
+ * cross-family references caught, supply the sets; if you validate one family in isolation, expect
112
+ * them to be found later by whatever holds every family at once.
113
+ */
99
114
  export interface ValidateRoadmapSnapshotOptions {
100
115
  /** Override "now" for `STALE_AUTHORED` checks (test affordance). Defaults to `new Date()`. */
101
116
  now?: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"roadmap-snapshot-validation.d.ts","sourceRoot":"","sources":["../../../../../src/_core/roadmap/roadmap-snapshot-validation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,oBAAY,wBAAwB;IAClC;;;;;OAKG;IACH,kBAAkB,uBAAuB;IACzC;;;OAGG;IACH,aAAa,kBAAkB;IAC/B;;;;OAIG;IACH,kBAAkB,uBAAuB;IACzC;;;;;;;;OAQG;IACH,mBAAmB,wBAAwB;IAC3C,6DAA6D;IAC7D,SAAS,cAAc;IACvB,yFAAyF;IACzF,cAAc,mBAAmB;IACjC;;;;;OAKG;IACH,uBAAuB,4BAA4B;IACnD;;;;OAIG;IACH,6BAA6B,kCAAkC;CAChE;AAED,oBAAY,4BAA4B;IACtC,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,4BAA4B,CAAC;CACxC;AAED,MAAM,WAAW,+BAA+B;IAC9C,gDAAgD;IAChD,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,oBAAoB,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,8BAA8B;IAC7C,8FAA8F;IAC9F,GAAG,CAAC,EAAE,IAAI,CAAC;IACX;;;;;;OAMG;IACH,wBAAwB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC/C;;;;OAIG;IACH,6BAA6B,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACrD;AAeD,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,eAAe,EACzB,OAAO,CAAC,EAAE,8BAA8B,GACvC,+BAA+B,CAejC;AAoKD,yDAAyD"}
1
+ {"version":3,"file":"roadmap-snapshot-validation.d.ts","sourceRoot":"","sources":["../../../../../src/_core/roadmap/roadmap-snapshot-validation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,oBAAY,wBAAwB;IAClC;;;;;OAKG;IACH,kBAAkB,uBAAuB;IACzC;;;OAGG;IACH,aAAa,kBAAkB;IAC/B;;;;OAIG;IACH,kBAAkB,uBAAuB;IACzC;;;;;;;;OAQG;IACH,mBAAmB,wBAAwB;IAC3C,6DAA6D;IAC7D,SAAS,cAAc;IACvB,yFAAyF;IACzF,cAAc,mBAAmB;IACjC;;;;;OAKG;IACH,uBAAuB,4BAA4B;IACnD;;;;OAIG;IACH,6BAA6B,kCAAkC;CAChE;AAED,oBAAY,4BAA4B;IACtC,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,4BAA4B,CAAC;CACxC;AAED,MAAM,WAAW,+BAA+B;IAC9C,gDAAgD;IAChD,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,oBAAoB,EAAE,CAAC;CAChC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,8BAA8B;IAC7C,8FAA8F;IAC9F,GAAG,CAAC,EAAE,IAAI,CAAC;IACX;;;;;;OAMG;IACH,wBAAwB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC/C;;;;OAIG;IACH,6BAA6B,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACrD;AAeD,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,eAAe,EACzB,OAAO,CAAC,EAAE,8BAA8B,GACvC,+BAA+B,CAejC;AAoKD,yDAAyD"}