@wildo-ai/framework-knowledge 1.1.8 → 1.1.10

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 (480) hide show
  1. package/dist/claude-marketplace/.claude-plugin/marketplace.json +1 -1
  2. package/dist/claude-marketplace/plugins/wildo/.claude-plugin/plugin.json +1 -1
  3. package/dist/claude-marketplace/plugins/wildo/references/acceptance.md +11 -0
  4. package/dist/claude-marketplace/plugins/wildo/references/composites-and-the-loop.md +9 -2
  5. package/dist/claude-marketplace/plugins/wildo/references/creation-state.md +21 -0
  6. package/dist/claude-marketplace/plugins/wildo/references/derived-artifacts.md +121 -0
  7. package/dist/claude-marketplace/plugins/wildo/references/expert-personas-and-deliberations.md +26 -7
  8. package/dist/claude-marketplace/plugins/wildo/references/runs-judges-and-questions.md +31 -5
  9. package/dist/claude-marketplace/plugins/wildo/skills/accept/SKILL.md +4 -2
  10. package/dist/claude-marketplace/plugins/wildo/skills/answer/SKILL.md +29 -2
  11. package/dist/claude-marketplace/plugins/wildo/skills/build/SKILL.md +69 -24
  12. package/dist/claude-marketplace/plugins/wildo/skills/doctor/SKILL.md +10 -0
  13. package/dist/claude-marketplace/plugins/wildo/skills/run/SKILL.md +21 -5
  14. package/dist/claude-marketplace/plugins/wildo/skills/start/SKILL.md +31 -5
  15. package/dist/claude-marketplace/plugins/wildo/skills/status/SKILL.md +2 -0
  16. package/dist/claude-marketplace/plugins/wildo/skills/why/SKILL.md +20 -4
  17. package/dist/esm/framework-knowledge.definitions.d.ts +1 -1
  18. package/dist/esm/framework-knowledge.definitions.d.ts.map +1 -1
  19. package/dist/esm/framework-knowledge.definitions.js +95 -5
  20. package/dist/esm/framework-knowledge.definitions.js.map +1 -1
  21. package/dist/esm/framework-knowledge.loader.d.ts.map +1 -1
  22. package/dist/esm/index.d.ts.map +1 -1
  23. package/dist/esm/playbooks/bottom_up.assemble-verify/playbook.definition.d.ts +2 -2
  24. package/dist/esm/playbooks/bottom_up.assemble-verify/playbook.definition.d.ts.map +1 -1
  25. package/dist/esm/playbooks/bottom_up.assemble-verify/playbook.definition.js +2 -2
  26. package/dist/esm/playbooks/bottom_up.assemble-verify/playbook.definition.js.map +1 -1
  27. package/dist/esm/playbooks/bottom_up.build/playbook.definition.d.ts +11 -11
  28. package/dist/esm/playbooks/bottom_up.build/playbook.definition.d.ts.map +1 -1
  29. package/dist/esm/playbooks/bottom_up.build/playbook.definition.js +29 -22
  30. package/dist/esm/playbooks/bottom_up.build/playbook.definition.js.map +1 -1
  31. package/dist/esm/playbooks/bottom_up.build-decompose/playbook.definition.d.ts +41 -3
  32. package/dist/esm/playbooks/bottom_up.build-decompose/playbook.definition.d.ts.map +1 -1
  33. package/dist/esm/playbooks/bottom_up.build-decompose/playbook.definition.js +175 -14
  34. package/dist/esm/playbooks/bottom_up.build-decompose/playbook.definition.js.map +1 -1
  35. package/dist/esm/playbooks/bottom_up.build-dispatch/playbook.definition.d.ts +1 -1
  36. package/dist/esm/playbooks/bottom_up.build-dispatch/playbook.definition.d.ts.map +1 -1
  37. package/dist/esm/playbooks/bottom_up.build-dispatch/playbook.definition.js +3 -3
  38. package/dist/esm/playbooks/bottom_up.build-dispatch/playbook.definition.js.map +1 -1
  39. package/dist/esm/playbooks/bottom_up.build-scale/playbook.definition.d.ts +1 -1
  40. package/dist/esm/playbooks/bottom_up.build-scale/playbook.definition.js +1 -1
  41. package/dist/esm/playbooks/bottom_up.build-scale/playbook.definition.js.map +1 -1
  42. package/dist/esm/playbooks/bottom_up.conception/playbook.definition.d.ts +8 -4
  43. package/dist/esm/playbooks/bottom_up.conception/playbook.definition.d.ts.map +1 -1
  44. package/dist/esm/playbooks/bottom_up.conception/playbook.definition.js +13 -6
  45. package/dist/esm/playbooks/bottom_up.conception/playbook.definition.js.map +1 -1
  46. package/dist/esm/playbooks/bottom_up.domain-plan/playbook.definition.d.ts +4 -2
  47. package/dist/esm/playbooks/bottom_up.domain-plan/playbook.definition.d.ts.map +1 -1
  48. package/dist/esm/playbooks/bottom_up.domain-plan/playbook.definition.js +90 -13
  49. package/dist/esm/playbooks/bottom_up.domain-plan/playbook.definition.js.map +1 -1
  50. package/dist/esm/playbooks/bottom_up.experience-plan/playbook.definition.d.ts +4 -3
  51. package/dist/esm/playbooks/bottom_up.experience-plan/playbook.definition.d.ts.map +1 -1
  52. package/dist/esm/playbooks/bottom_up.experience-plan/playbook.definition.js +4 -3
  53. package/dist/esm/playbooks/bottom_up.experience-plan/playbook.definition.js.map +1 -1
  54. package/dist/esm/playbooks/bottom_up.foundation/playbook.definition.d.ts +8 -0
  55. package/dist/esm/playbooks/bottom_up.foundation/playbook.definition.d.ts.map +1 -1
  56. package/dist/esm/playbooks/bottom_up.foundation/playbook.definition.js +12 -4
  57. package/dist/esm/playbooks/bottom_up.foundation/playbook.definition.js.map +1 -1
  58. package/dist/esm/playbooks/bottom_up.placement-plan/playbook.definition.d.ts +12 -3
  59. package/dist/esm/playbooks/bottom_up.placement-plan/playbook.definition.d.ts.map +1 -1
  60. package/dist/esm/playbooks/bottom_up.placement-plan/playbook.definition.js +8 -4
  61. package/dist/esm/playbooks/bottom_up.placement-plan/playbook.definition.js.map +1 -1
  62. package/dist/esm/playbooks/bottom_up.website-plan/playbook.definition.d.ts +4 -1
  63. package/dist/esm/playbooks/bottom_up.website-plan/playbook.definition.d.ts.map +1 -1
  64. package/dist/esm/playbooks/bottom_up.website-plan/playbook.definition.js +2 -1
  65. package/dist/esm/playbooks/bottom_up.website-plan/playbook.definition.js.map +1 -1
  66. package/dist/esm/playbooks/cross_cutting.application-creation/playbook.definition.d.ts.map +1 -1
  67. package/dist/esm/playbooks/cross_cutting.compliance/playbook.definition.d.ts.map +1 -1
  68. package/dist/esm/playbooks/cross_cutting.feature-development/playbook.definition.d.ts.map +1 -1
  69. package/dist/esm/playbooks/cross_cutting.refinement/playbook.definition.d.ts.map +1 -1
  70. package/dist/esm/playbooks/refinement.compliance-document-candidate/playbook.definition.d.ts.map +1 -1
  71. package/dist/esm/playbooks/refinement.document-facts/playbook.definition.d.ts +1 -1
  72. package/dist/esm/playbooks/refinement.document-facts/playbook.definition.d.ts.map +1 -1
  73. package/dist/esm/playbooks/refinement.document-facts/playbook.definition.js +13 -1
  74. package/dist/esm/playbooks/refinement.document-facts/playbook.definition.js.map +1 -1
  75. package/dist/esm/playbooks/refinement.feature-contribution/playbook.definition.d.ts.map +1 -1
  76. package/dist/esm/playbooks/refinement.governance-document-candidate/playbook.definition.d.ts.map +1 -1
  77. package/dist/esm/playbooks/top_down.brand-identity/playbook.definition.d.ts +25 -27
  78. package/dist/esm/playbooks/top_down.brand-identity/playbook.definition.d.ts.map +1 -1
  79. package/dist/esm/playbooks/top_down.brand-identity/playbook.definition.js +91 -43
  80. package/dist/esm/playbooks/top_down.brand-identity/playbook.definition.js.map +1 -1
  81. package/dist/esm/playbooks/top_down.brand-name-research/playbook.definition.d.ts +41 -0
  82. package/dist/esm/playbooks/top_down.brand-name-research/playbook.definition.d.ts.map +1 -0
  83. package/dist/esm/playbooks/top_down.brand-name-research/playbook.definition.js +43 -0
  84. package/dist/esm/playbooks/top_down.brand-name-research/playbook.definition.js.map +1 -0
  85. package/dist/esm/playbooks/top_down.brand-name-screening-produce/playbook.definition.d.ts +200 -0
  86. package/dist/esm/playbooks/top_down.brand-name-screening-produce/playbook.definition.d.ts.map +1 -0
  87. package/dist/esm/playbooks/top_down.brand-name-screening-produce/playbook.definition.js +203 -0
  88. package/dist/esm/playbooks/top_down.brand-name-screening-produce/playbook.definition.js.map +1 -0
  89. package/dist/esm/playbooks/top_down.brand-naming/playbook.definition.d.ts +81 -0
  90. package/dist/esm/playbooks/top_down.brand-naming/playbook.definition.d.ts.map +1 -0
  91. package/dist/esm/playbooks/top_down.brand-naming/playbook.definition.js +93 -0
  92. package/dist/esm/playbooks/top_down.brand-naming/playbook.definition.js.map +1 -0
  93. package/dist/esm/playbooks/top_down.business-model/playbook.definition.d.ts +3 -1
  94. package/dist/esm/playbooks/top_down.business-model/playbook.definition.d.ts.map +1 -1
  95. package/dist/esm/playbooks/top_down.business-model/playbook.definition.js +27 -18
  96. package/dist/esm/playbooks/top_down.business-model/playbook.definition.js.map +1 -1
  97. package/dist/esm/playbooks/top_down.capability-map/playbook.definition.d.ts.map +1 -1
  98. package/dist/esm/playbooks/top_down.compliance-analysis/playbook.definition.d.ts +11 -1
  99. package/dist/esm/playbooks/top_down.compliance-analysis/playbook.definition.d.ts.map +1 -1
  100. package/dist/esm/playbooks/top_down.compliance-analysis/playbook.definition.js +11 -11
  101. package/dist/esm/playbooks/top_down.compliance-analysis/playbook.definition.js.map +1 -1
  102. package/dist/esm/playbooks/top_down.compliance-conception/playbook.definition.d.ts +2 -0
  103. package/dist/esm/playbooks/top_down.compliance-conception/playbook.definition.d.ts.map +1 -1
  104. package/dist/esm/playbooks/top_down.compliance-conception/playbook.definition.js +3 -1
  105. package/dist/esm/playbooks/top_down.compliance-conception/playbook.definition.js.map +1 -1
  106. package/dist/esm/playbooks/top_down.compliance-evidence-adequacy/playbook.definition.d.ts.map +1 -1
  107. package/dist/esm/playbooks/top_down.compliance-posture/playbook.definition.d.ts +2 -0
  108. package/dist/esm/playbooks/top_down.compliance-posture/playbook.definition.d.ts.map +1 -1
  109. package/dist/esm/playbooks/top_down.compliance-posture/playbook.definition.js +3 -1
  110. package/dist/esm/playbooks/top_down.compliance-posture/playbook.definition.js.map +1 -1
  111. package/dist/esm/playbooks/top_down.compliance-research/playbook.definition.d.ts.map +1 -1
  112. package/dist/esm/playbooks/top_down.definition/playbook.definition.d.ts +5 -2
  113. package/dist/esm/playbooks/top_down.definition/playbook.definition.d.ts.map +1 -1
  114. package/dist/esm/playbooks/top_down.definition/playbook.definition.js +16 -4
  115. package/dist/esm/playbooks/top_down.definition/playbook.definition.js.map +1 -1
  116. package/dist/esm/playbooks/top_down.expert-personas/playbook.definition.d.ts +27 -6
  117. package/dist/esm/playbooks/top_down.expert-personas/playbook.definition.d.ts.map +1 -1
  118. package/dist/esm/playbooks/top_down.expert-personas/playbook.definition.js +32 -12
  119. package/dist/esm/playbooks/top_down.expert-personas/playbook.definition.js.map +1 -1
  120. package/dist/esm/playbooks/top_down.feature-drafts/playbook.definition.d.ts.map +1 -1
  121. package/dist/esm/playbooks/top_down.market-analysis/playbook.definition.d.ts.map +1 -1
  122. package/dist/esm/playbooks/top_down.market-evidence-adequacy/playbook.definition.d.ts.map +1 -1
  123. package/dist/esm/playbooks/top_down.market-research/playbook.definition.d.ts.map +1 -1
  124. package/dist/esm/playbooks/top_down.market-snapshot-produce/playbook.definition.d.ts +2 -1
  125. package/dist/esm/playbooks/top_down.market-snapshot-produce/playbook.definition.d.ts.map +1 -1
  126. package/dist/esm/playbooks/top_down.market-snapshot-produce/playbook.definition.js +13 -5
  127. package/dist/esm/playbooks/top_down.market-snapshot-produce/playbook.definition.js.map +1 -1
  128. package/dist/esm/playbooks/top_down.phase-gate/playbook.definition.d.ts +7 -3
  129. package/dist/esm/playbooks/top_down.phase-gate/playbook.definition.d.ts.map +1 -1
  130. package/dist/esm/playbooks/top_down.phase-gate/playbook.definition.js +71 -2
  131. package/dist/esm/playbooks/top_down.phase-gate/playbook.definition.js.map +1 -1
  132. package/dist/esm/playbooks/top_down.requirements-definition/playbook.definition.d.ts +2 -1
  133. package/dist/esm/playbooks/top_down.requirements-definition/playbook.definition.d.ts.map +1 -1
  134. package/dist/esm/playbooks/top_down.requirements-definition/playbook.definition.js +23 -8
  135. package/dist/esm/playbooks/top_down.requirements-definition/playbook.definition.js.map +1 -1
  136. package/dist/esm/playbooks/top_down.risk-register/playbook.definition.d.ts +7 -1
  137. package/dist/esm/playbooks/top_down.risk-register/playbook.definition.d.ts.map +1 -1
  138. package/dist/esm/playbooks/top_down.risk-register/playbook.definition.js +4 -2
  139. package/dist/esm/playbooks/top_down.risk-register/playbook.definition.js.map +1 -1
  140. package/dist/esm/playbooks/top_down.scope-roadmap/playbook.definition.d.ts +9 -3
  141. package/dist/esm/playbooks/top_down.scope-roadmap/playbook.definition.d.ts.map +1 -1
  142. package/dist/esm/playbooks/top_down.scope-roadmap/playbook.definition.js +3 -3
  143. package/dist/esm/playbooks/top_down.scope-roadmap/playbook.definition.js.map +1 -1
  144. package/dist/esm/playbooks/top_down.value-proposition/playbook.definition.d.ts.map +1 -1
  145. package/dist/esm/playbooks/top_down.vision-elicitation/playbook.definition.d.ts +35 -2
  146. package/dist/esm/playbooks/top_down.vision-elicitation/playbook.definition.d.ts.map +1 -1
  147. package/dist/esm/playbooks/top_down.vision-elicitation/playbook.definition.js +41 -17
  148. package/dist/esm/playbooks/top_down.vision-elicitation/playbook.definition.js.map +1 -1
  149. package/dist/knowledge/assurance-authority-bases/wildo-safe-baseline-v1/authority-basis.json +1 -1
  150. package/dist/knowledge/assurance-authority-bases/wildo-safe-baseline-v1/external-framework-mapping.json +1 -1
  151. package/dist/knowledge/manifest.json +8 -8
  152. package/dist/knowledge/playbooks/bottom_up.assemble-verify/method.md +22 -7
  153. package/dist/knowledge/playbooks/bottom_up.assemble-verify/playbook.json +3 -3
  154. package/dist/knowledge/playbooks/bottom_up.build/method.md +17 -15
  155. package/dist/knowledge/playbooks/bottom_up.build/playbook.json +4 -3
  156. package/dist/knowledge/playbooks/bottom_up.build-decompose/evaluation-protocol.json +1 -1
  157. package/dist/knowledge/playbooks/bottom_up.build-decompose/evaluation-treatment.json +1 -1
  158. package/dist/knowledge/playbooks/bottom_up.build-decompose/method.md +261 -34
  159. package/dist/knowledge/playbooks/bottom_up.build-decompose/playbook.json +42 -4
  160. package/dist/knowledge/playbooks/bottom_up.build-dispatch/method.md +188 -59
  161. package/dist/knowledge/playbooks/bottom_up.build-dispatch/playbook.json +2 -2
  162. package/dist/knowledge/playbooks/bottom_up.build-scale/method.md +169 -276
  163. package/dist/knowledge/playbooks/bottom_up.build-scale/playbook.json +2 -2
  164. package/dist/knowledge/playbooks/bottom_up.capability-composition/method.md +8 -1
  165. package/dist/knowledge/playbooks/bottom_up.capability-composition/playbook.json +1 -1
  166. package/dist/knowledge/playbooks/bottom_up.conception/method.md +3 -2
  167. package/dist/knowledge/playbooks/bottom_up.conception/playbook.json +11 -3
  168. package/dist/knowledge/playbooks/bottom_up.domain-plan/evaluation-protocol.json +1 -1
  169. package/dist/knowledge/playbooks/bottom_up.domain-plan/evaluation-treatment.json +1 -1
  170. package/dist/knowledge/playbooks/bottom_up.domain-plan/method.md +129 -17
  171. package/dist/knowledge/playbooks/bottom_up.domain-plan/playbook.json +7 -4
  172. package/dist/knowledge/playbooks/bottom_up.experience-plan/method.md +28 -6
  173. package/dist/knowledge/playbooks/bottom_up.experience-plan/playbook.json +5 -4
  174. package/dist/knowledge/playbooks/bottom_up.foundation/playbook.json +13 -5
  175. package/dist/knowledge/playbooks/bottom_up.placement-plan/method.md +50 -0
  176. package/dist/knowledge/playbooks/bottom_up.placement-plan/playbook.json +16 -4
  177. package/dist/knowledge/playbooks/bottom_up.website-plan/method.md +19 -0
  178. package/dist/knowledge/playbooks/bottom_up.website-plan/playbook.json +5 -2
  179. package/dist/knowledge/playbooks/refinement.compliance-document-candidate/method.md +7 -3
  180. package/dist/knowledge/playbooks/refinement.compliance-document-candidate/playbook.json +1 -1
  181. package/dist/knowledge/playbooks/refinement.document-facts/method.md +8 -0
  182. package/dist/knowledge/playbooks/refinement.document-facts/playbook.json +3 -2
  183. package/dist/knowledge/playbooks/refinement.feature-contribution/method.md +5 -2
  184. package/dist/knowledge/playbooks/refinement.feature-contribution/playbook.json +1 -1
  185. package/dist/knowledge/playbooks/top_down.brand-identity/evaluation-protocol.json +1 -1
  186. package/dist/knowledge/playbooks/top_down.brand-identity/evaluation-treatment.json +1 -1
  187. package/dist/knowledge/playbooks/top_down.brand-identity/method.md +75 -37
  188. package/dist/knowledge/playbooks/top_down.brand-identity/playbook.json +35 -38
  189. package/dist/knowledge/playbooks/top_down.brand-name-research/method.md +145 -0
  190. package/dist/knowledge/playbooks/top_down.brand-name-research/playbook.json +57 -0
  191. package/dist/knowledge/playbooks/top_down.brand-name-screening-produce/evaluation-protocol.json +1 -0
  192. package/dist/knowledge/playbooks/top_down.brand-name-screening-produce/evaluation-treatment.json +1 -0
  193. package/dist/knowledge/playbooks/top_down.brand-name-screening-produce/method.md +99 -0
  194. package/dist/knowledge/playbooks/top_down.brand-name-screening-produce/playbook.json +65 -0
  195. package/dist/knowledge/playbooks/top_down.brand-naming/method.md +56 -0
  196. package/dist/knowledge/playbooks/top_down.brand-naming/playbook.json +76 -0
  197. package/dist/knowledge/playbooks/top_down.business-model/evaluation-protocol.json +1 -1
  198. package/dist/knowledge/playbooks/top_down.business-model/evaluation-treatment.json +1 -1
  199. package/dist/knowledge/playbooks/top_down.business-model/method.md +60 -6
  200. package/dist/knowledge/playbooks/top_down.business-model/playbook.json +15 -10
  201. package/dist/knowledge/playbooks/top_down.capability-map/method.md +10 -9
  202. package/dist/knowledge/playbooks/top_down.capability-map/playbook.json +1 -1
  203. package/dist/knowledge/playbooks/top_down.compliance-analysis/playbook.json +30 -10
  204. package/dist/knowledge/playbooks/top_down.compliance-conception/playbook.json +3 -1
  205. package/dist/knowledge/playbooks/top_down.compliance-posture/playbook.json +4 -1
  206. package/dist/knowledge/playbooks/top_down.definition/method.md +8 -3
  207. package/dist/knowledge/playbooks/top_down.definition/playbook.json +6 -4
  208. package/dist/knowledge/playbooks/top_down.expert-personas/playbook.json +16 -2
  209. package/dist/knowledge/playbooks/top_down.feature-drafts/method.md +5 -2
  210. package/dist/knowledge/playbooks/top_down.feature-drafts/playbook.json +1 -1
  211. package/dist/knowledge/playbooks/top_down.market-snapshot-produce/evaluation-protocol.json +1 -1
  212. package/dist/knowledge/playbooks/top_down.market-snapshot-produce/evaluation-treatment.json +1 -1
  213. package/dist/knowledge/playbooks/top_down.market-snapshot-produce/method.md +26 -0
  214. package/dist/knowledge/playbooks/top_down.market-snapshot-produce/playbook.json +4 -2
  215. package/dist/knowledge/playbooks/top_down.phase-gate/evaluation-protocol.json +1 -1
  216. package/dist/knowledge/playbooks/top_down.phase-gate/evaluation-treatment.json +1 -1
  217. package/dist/knowledge/playbooks/top_down.phase-gate/playbook.json +11 -1
  218. package/dist/knowledge/playbooks/top_down.requirements-definition/evaluation-protocol.json +1 -1
  219. package/dist/knowledge/playbooks/top_down.requirements-definition/evaluation-treatment.json +1 -1
  220. package/dist/knowledge/playbooks/top_down.requirements-definition/method.md +84 -9
  221. package/dist/knowledge/playbooks/top_down.requirements-definition/playbook.json +6 -3
  222. package/dist/knowledge/playbooks/top_down.risk-register/method.md +21 -0
  223. package/dist/knowledge/playbooks/top_down.risk-register/playbook.json +8 -2
  224. package/dist/knowledge/playbooks/top_down.scope-roadmap/playbook.json +4 -2
  225. package/dist/knowledge/playbooks/top_down.vision-elicitation/method.md +29 -0
  226. package/dist/knowledge/playbooks/top_down.vision-elicitation/playbook.json +58 -17
  227. package/dist/knowledge/references/brand.name-choice.config.md +144 -0
  228. package/dist/knowledge/references/brand.name-screening.config.md +308 -0
  229. package/dist/knowledge/references/build-plan.task-graph.config.md +119 -11
  230. package/dist/knowledge/references/business-model.pricing-plan.config.md +16 -0
  231. package/dist/knowledge/references/business-model.snapshot.config.md +64 -0
  232. package/dist/knowledge/references/business-model.snapshot.validation.md +68 -4
  233. package/dist/knowledge/references/capability-composition.config.md +67 -4
  234. package/dist/knowledge/references/companion.market.prompt-renderer.md +11 -6
  235. package/dist/knowledge/references/example.authorization.application-roles.office-and-field.md +44 -0
  236. package/dist/knowledge/references/example.backend.custom-operation.audit-event.md +81 -0
  237. package/dist/knowledge/references/example.backend.custom-operation.child-line-total.md +258 -0
  238. package/dist/knowledge/references/example.backend.custom-operation.computed-total.md +153 -0
  239. package/dist/knowledge/references/example.backend.custom-operation.create-related-resource.md +107 -0
  240. package/dist/knowledge/references/example.data-seeding.minimal.md +39 -10
  241. package/dist/knowledge/references/example.data-seeding.row-reference.md +80 -0
  242. package/dist/knowledge/references/example.email.template.minimal.md +1 -1
  243. package/dist/knowledge/references/example.resource.config-wiring.retention-policy-operations.md +74 -0
  244. package/dist/knowledge/references/example.resource.personal-data.free-text-field.md +19 -0
  245. package/dist/knowledge/references/example.resource.personal-data.person-without-account.md +27 -0
  246. package/dist/knowledge/references/example.resource.status-lifecycle.quote.md +152 -0
  247. package/dist/knowledge/references/example.resource.ui-behavior.filter-presets.md +15 -0
  248. package/dist/knowledge/references/example.resource.ui-behavior.operation-icon.md +8 -0
  249. package/dist/knowledge/references/example.views.app-level.home-definition.md +13 -0
  250. package/dist/knowledge/references/example.views.chart-definition.shared.md +83 -0
  251. package/dist/knowledge/references/experience-plan.config.md +60 -7
  252. package/dist/knowledge/references/market.context-block.builder.md +1 -1
  253. package/dist/knowledge/references/market.snapshot.validation.md +1 -1
  254. package/dist/knowledge/references/placement-plan.config.md +43 -0
  255. package/dist/knowledge/references/requirements.functional-requirement.config.md +8 -2
  256. package/dist/knowledge/references/requirements.non-functional-requirement.config.md +2 -0
  257. package/dist/knowledge/references/requirements.references.conventions.md +1 -1
  258. package/dist/knowledge/references/requirements.snapshot.config.md +57 -1
  259. package/dist/knowledge/references/requirements.snapshot.validation.md +35 -1
  260. package/dist/knowledge/references/saas.backend.audit-logs.log-event.md +63 -0
  261. package/dist/knowledge/references/saas.backend.document-sequence.issue-in-operation.md +60 -0
  262. package/dist/knowledge/references/saas.backend.document-sequence.raise-floor.md +156 -0
  263. package/dist/knowledge/references/saas.backend.email.send.md +77 -0
  264. package/dist/knowledge/references/saas.backend.notifications.operation-email-template-ref.md +60 -0
  265. package/dist/knowledge/references/saas.data-seeding.bootstrap-wiring.md +7 -1
  266. package/dist/knowledge/references/saas.data-seeding.computed-entry.md +43 -0
  267. package/dist/knowledge/references/saas.data-seeding.definition-input.md +14 -2
  268. package/dist/knowledge/references/saas.data-seeding.row-reference.md +93 -0
  269. package/dist/knowledge/references/saas.frontend.collection-filter-presets.md +124 -0
  270. package/dist/knowledge/references/saas.frontend.launcher.item-refs.md +316 -0
  271. package/dist/knowledge/references/saas.frontend.launcher.merge-rules.md +106 -0
  272. package/dist/knowledge/references/saas.frontend.launcher.runtime-availability.md +60 -0
  273. package/dist/knowledge/references/saas.frontend.resource-label-params.md +52 -0
  274. package/dist/knowledge/references/saas.frontend.resource-operation-frontend-config.md +47 -18
  275. package/dist/knowledge/references/saas.frontend.resource-ui-behavior-config.md +4 -1
  276. package/dist/knowledge/references/saas.frontend.settings-hub.engine-destination-roles.md +25 -0
  277. package/dist/knowledge/references/saas.frontend.settings-hub.placement.md +2 -2
  278. package/dist/knowledge/references/saas.models.audit.trail-config.md +45 -0
  279. package/dist/knowledge/references/saas.models.notifications.user-notification-definition.md +5 -3
  280. package/dist/knowledge/references/saas.models.queue.scheduled-recovery.md +81 -2
  281. package/dist/knowledge/references/saas.models.resource-config.builder-parameters.md +26 -0
  282. package/dist/knowledge/references/saas.models.roles.definition.md +61 -0
  283. package/dist/knowledge/references/saas.models.roles.organization-defaults.md +97 -0
  284. package/dist/knowledge/references/saas.public-runtime.contract.md +26 -0
  285. package/dist/knowledge/references/saas.specifications.companion-exports.contract.md +10 -0
  286. package/dist/knowledge/references/saas.website.astro.bridge.md +10 -0
  287. package/dist/knowledge/references/saas.website.astro.label-loader.md +12 -0
  288. package/dist/knowledge/references/saas.website.astro.llms-txt-server.md +14 -1
  289. package/dist/knowledge/references/saas.website.astro.site-context.md +13 -0
  290. package/dist/knowledge/references/saas.website.blog.bridge.md +4 -0
  291. package/dist/knowledge/references/saas.website.config.site-context-loader.md +3 -0
  292. package/dist/knowledge/references/saas.website.factories.define-section.md +4 -0
  293. package/dist/knowledge/references/saas.website.legal.public-document-links.md +76 -0
  294. package/dist/knowledge/references/saas.website.page-manifest.schema.md +12 -3
  295. package/dist/knowledge/references/saas.website.page-sections.component.md +72 -0
  296. package/dist/knowledge/references/saas.website.root-config.seo.md +2 -1
  297. package/dist/knowledge/references/saas.website.runtime.context.md +7 -0
  298. package/dist/knowledge/references/saas.website.sections.definition-schema.md +11 -0
  299. package/dist/knowledge/references/saas.website.seo.llms-txt-config.md +2 -0
  300. package/dist/knowledge/references/website-plan.config.md +26 -0
  301. package/dist/knowledge/references/zod.decorators.chainable-runtime.md +13 -0
  302. package/dist/knowledge/references/zod.decorators.decorator-vocabulary.md +7 -0
  303. package/dist/knowledge/references/zod.decorators.document-sequence.md +65 -0
  304. package/dist/knowledge/references/zod.decorators.schema-metadata.md +1 -0
  305. package/dist/knowledge/references/zod.decorators.shared-structural-methods.md +21 -0
  306. package/dist/knowledge/references/zod.factories.bigdecimal.md +1 -0
  307. package/dist/knowledge/references/zod.factories.code.md +1 -0
  308. package/dist/knowledge/references/zod.factories.duration.md +1 -0
  309. package/dist/knowledge/references/zod.factories.money.md +1 -0
  310. package/dist/knowledge/registries/assurance-authority-bases.json +1 -1
  311. package/dist/knowledge/registries/framework-topics.json +374 -1
  312. package/dist/knowledge/registries/playbooks.json +76 -28
  313. package/dist/knowledge/registries/source-tags.json +1513 -898
  314. package/dist/knowledge/rules/live-context-door.md +5 -2
  315. package/dist/knowledge/skills/INDEX.md +5 -2
  316. package/dist/knowledge/skills/application-consumer-documentation-authoring/SKILL.md +16 -3
  317. package/dist/knowledge/skills/application-database-migrations/SKILL.md +14 -3
  318. package/dist/knowledge/skills/application-roles-authoring/SKILL.md +158 -0
  319. package/dist/knowledge/skills/application-roles-authoring/references/framework-application-roles-api.md +169 -0
  320. package/dist/knowledge/skills/application-roles-authoring/references/office-and-field-worked-example.md +63 -0
  321. package/dist/knowledge/skills/authorization-unit-narrowing/SKILL.md +6 -1
  322. package/dist/knowledge/skills/backend-custom-operation/SKILL.md +256 -9
  323. package/dist/knowledge/skills/backend-custom-operation/references/after-the-operation.md +42 -0
  324. package/dist/knowledge/skills/backend-custom-operation/references/framework-audit-log-event-api.md +220 -0
  325. package/dist/knowledge/skills/brand-logo-authoring/SKILL.md +5 -0
  326. package/dist/knowledge/skills/brand-name-screening/SKILL.md +178 -0
  327. package/dist/knowledge/skills/brand-name-screening/references/framework-brand-name-screening-api.md +466 -0
  328. package/dist/knowledge/skills/brand-name-screening/references/screening-procedure.md +87 -0
  329. package/dist/knowledge/skills/compliance-document-authoring/references/document-composition-privacy-notice.md +7 -3
  330. package/dist/knowledge/skills/config-app-shell/SKILL.md +58 -5
  331. package/dist/knowledge/skills/config-app-shell/references/framework-launcher-items-api.md +461 -0
  332. package/dist/knowledge/skills/config-app-shell/references/framework-launcher-visibility-api.md +80 -0
  333. package/dist/knowledge/skills/config-design-system/SKILL.md +28 -6
  334. package/dist/knowledge/skills/config-navigation/SKILL.md +14 -3
  335. package/dist/knowledge/skills/config-saas/SKILL.md +56 -15
  336. package/dist/knowledge/skills/config-saas/references/compliance-declarations.md +65 -2
  337. package/dist/knowledge/skills/config-saas/references/framework-audit-trail-config-api.md +62 -2
  338. package/dist/knowledge/skills/config-saas/references/framework-background-work-api.md +81 -2
  339. package/dist/knowledge/skills/config-saas-backend/SKILL.md +6 -1
  340. package/dist/knowledge/skills/configure-billing/SKILL.md +18 -4
  341. package/dist/knowledge/skills/email-add-template/SKILL.md +28 -6
  342. package/dist/knowledge/skills/email-add-template/references/email-artifact-paths.md +1 -1
  343. package/dist/knowledge/skills/email-add-template/references/framework-email-send-api.md +128 -0
  344. package/dist/knowledge/skills/email-add-template/references/framework-operation-email-template-ref-api.md +99 -0
  345. package/dist/knowledge/skills/engine-component-registration/SKILL.md +6 -1
  346. package/dist/knowledge/skills/engine-product-definitions/SKILL.md +21 -8
  347. package/dist/knowledge/skills/flows-actors-chat-assistant/SKILL.md +10 -2
  348. package/dist/knowledge/skills/flows-actors-llm-agent-invocation/SKILL.md +18 -4
  349. package/dist/knowledge/skills/frontend-component-catalog/SKILL.md +11 -3
  350. package/dist/knowledge/skills/frontend-component-catalog/references/framework-component-catalog.md +2 -1
  351. package/dist/knowledge/skills/frontend-component-catalog/references/framework-component-usage.md +8 -0
  352. package/dist/knowledge/skills/i18n-rerun-pipeline/SKILL.md +19 -5
  353. package/dist/knowledge/skills/i18n-translation-rerun/SKILL.md +10 -2
  354. package/dist/knowledge/skills/inbound-channels/SKILL.md +2 -2
  355. package/dist/knowledge/skills/infra-environment-config/SKILL.md +6 -1
  356. package/dist/knowledge/skills/local-environment-bootstrap/SKILL.md +17 -2
  357. package/dist/knowledge/skills/local-environment-bootstrap/references/derived-artifact-currency.md +122 -0
  358. package/dist/knowledge/skills/local-environment-bootstrap/references/framework-upgrade-and-dependency-alignment.md +11 -0
  359. package/dist/knowledge/skills/local-environment-bootstrap/references/wildo-cli-bootstrap-commands.md +9 -2
  360. package/dist/knowledge/skills/market-add-feature-benefit/SKILL.md +10 -2
  361. package/dist/knowledge/skills/market-alternatives/SKILL.md +10 -2
  362. package/dist/knowledge/skills/market-authoring-overview/SKILL.md +10 -2
  363. package/dist/knowledge/skills/market-category/SKILL.md +21 -7
  364. package/dist/knowledge/skills/market-channels/SKILL.md +6 -1
  365. package/dist/knowledge/skills/market-companion-prompt-enrichment/SKILL.md +22 -4
  366. package/dist/knowledge/skills/market-companion-prompt-enrichment/references/framework-companion-behavior-api.md +12 -2
  367. package/dist/knowledge/skills/market-generation-cli/SKILL.md +21 -11
  368. package/dist/knowledge/skills/market-generation-cli/references/framework-market-generation-cli.md +11 -6
  369. package/dist/knowledge/skills/market-icp/SKILL.md +10 -2
  370. package/dist/knowledge/skills/market-jobs-pains-gains/SKILL.md +6 -1
  371. package/dist/knowledge/skills/market-message-templates-authoring/SKILL.md +6 -1
  372. package/dist/knowledge/skills/market-message-templates-authoring/references/framework-message-template-api.md +1 -1
  373. package/dist/knowledge/skills/market-persona/SKILL.md +14 -3
  374. package/dist/knowledge/skills/market-positioning-authoring/SKILL.md +6 -1
  375. package/dist/knowledge/skills/market-proof-and-objection/SKILL.md +10 -2
  376. package/dist/knowledge/skills/market-scoring-interpretation/SKILL.md +6 -1
  377. package/dist/knowledge/skills/market-snapshot-validation/SKILL.md +15 -4
  378. package/dist/knowledge/skills/market-snapshot-validation/references/framework-snapshot-validation-api.md +1 -1
  379. package/dist/knowledge/skills/market-tone-of-voice/SKILL.md +6 -1
  380. package/dist/knowledge/skills/model-cost-attribution/references/framework-work-unit-api.md +26 -0
  381. package/dist/knowledge/skills/module-companion-exports/SKILL.md +7 -1
  382. package/dist/knowledge/skills/module-companion-exports/references/companion-exports-by-package.md +10 -0
  383. package/dist/knowledge/skills/module-relationships/SKILL.md +37 -8
  384. package/dist/knowledge/skills/pdf-template-authoring/SKILL.md +4 -2
  385. package/dist/knowledge/skills/provider-address-lookup/SKILL.md +14 -3
  386. package/dist/knowledge/skills/provider-frontend-file-picker/SKILL.md +6 -1
  387. package/dist/knowledge/skills/provider-operation-calls/SKILL.md +14 -3
  388. package/dist/knowledge/skills/rate-limit-authoring/SKILL.md +10 -2
  389. package/dist/knowledge/skills/resource-add-field/SKILL.md +10 -2
  390. package/dist/knowledge/skills/resource-add-field/references/framework-field-cross-layer-api.md +46 -17
  391. package/dist/knowledge/skills/resource-add-resource/SKILL.md +14 -2
  392. package/dist/knowledge/skills/resource-add-resource/references/framework-new-resource-core-config-api.md +26 -0
  393. package/dist/knowledge/skills/resource-config-wiring/SKILL.md +29 -3
  394. package/dist/knowledge/skills/resource-config-wiring/references/framework-collection-operation-declarations.md +19 -4
  395. package/dist/knowledge/skills/resource-config-wiring/references/framework-operation-audit-api.md +5 -2
  396. package/dist/knowledge/skills/resource-config-wiring/references/framework-personal-data-declaration-api.md +103 -0
  397. package/dist/knowledge/skills/resource-config-wiring/references/framework-retention-policy-operations.md +135 -0
  398. package/dist/knowledge/skills/resource-config-wiring/references/framework-saas-models-resource-config-api.md +26 -0
  399. package/dist/knowledge/skills/resource-config-wiring/references/framework-user-notifications-api.md +26 -7
  400. package/dist/knowledge/skills/resource-custom-view/SKILL.md +10 -2
  401. package/dist/knowledge/skills/resource-custom-view/references/custom-view-contracts.md +46 -17
  402. package/dist/knowledge/skills/resource-external-data/references/erasure-suppression.md +2 -2
  403. package/dist/knowledge/skills/resource-retention-binding/SKILL.md +5 -1
  404. package/dist/knowledge/skills/resource-schema-authoring/SKILL.md +15 -1
  405. package/dist/knowledge/skills/resource-schema-authoring/references/computed-totals.md +569 -0
  406. package/dist/knowledge/skills/resource-schema-authoring/references/document-numbers.md +358 -0
  407. package/dist/knowledge/skills/resource-schema-authoring/references/framework-decorator-vocabulary-api.md +8 -0
  408. package/dist/knowledge/skills/resource-schema-authoring/references/framework-shared-decorator-methods-api.md +21 -0
  409. package/dist/knowledge/skills/resource-schema-authoring/references/framework-special-factories-api.md +7 -2
  410. package/dist/knowledge/skills/resource-schema-authoring/references/framework-zod-lifecycle-and-chainable-api.md +13 -0
  411. package/dist/knowledge/skills/resource-status-lifecycle/SKILL.md +153 -0
  412. package/dist/knowledge/skills/resource-status-lifecycle/references/commercial-documents.md +46 -0
  413. package/dist/knowledge/skills/resource-status-lifecycle/references/quote-lifecycle-worked-example.md +198 -0
  414. package/dist/knowledge/skills/resource-ui-behavior/SKILL.md +30 -4
  415. package/dist/knowledge/skills/resource-ui-behavior/references/framework-collection-filter-presets-api.md +157 -0
  416. package/dist/knowledge/skills/resource-ui-behavior/references/framework-frontend-resource-ui-contracts-api.md +101 -19
  417. package/dist/knowledge/skills/seeding-authoring/SKILL.md +202 -39
  418. package/dist/knowledge/skills/seeding-authoring/references/cross-seed-row-references.md +67 -0
  419. package/dist/knowledge/skills/seeding-authoring/references/framework-data-seeding-api.md +154 -4
  420. package/dist/knowledge/skills/seeding-authoring/references/seed-row-overlay.md +22 -0
  421. package/dist/knowledge/skills/seeding-operations/references/framework-data-seeding-operations-api.md +7 -1
  422. package/dist/knowledge/skills/settings-placement-authoring/references/framework-settings-destinations-catalog.md +43 -0
  423. package/dist/knowledge/skills/settings-placement-authoring/references/framework-settings-placement-api.md +2 -2
  424. package/dist/knowledge/skills/spec-companion-exports/SKILL.md +6 -1
  425. package/dist/knowledge/skills/spec-companion-exports/references/framework-companion-exports-contract-api.md +10 -0
  426. package/dist/knowledge/skills/spec-component-update/SKILL.md +10 -2
  427. package/dist/knowledge/skills/spec-composite-view-update/SKILL.md +2 -2
  428. package/dist/knowledge/skills/spec-family-update/SKILL.md +71 -66
  429. package/dist/knowledge/skills/spec-family-update/references/family-spec-routing.md +1 -1
  430. package/dist/knowledge/skills/spec-resource-update/SKILL.md +30 -10
  431. package/dist/knowledge/skills/spec-resource-update/references/resource-spec-field-routing.md +28 -0
  432. package/dist/knowledge/skills/spec-update-after-change/SKILL.md +22 -5
  433. package/dist/knowledge/skills/views-add-composite-view/SKILL.md +6 -1
  434. package/dist/knowledge/skills/views-add-custom-view/SKILL.md +10 -2
  435. package/dist/knowledge/skills/views-app-level/SKILL.md +13 -3
  436. package/dist/knowledge/skills/views-app-level/references/application-home.md +56 -0
  437. package/dist/knowledge/skills/views-chart-authoring/SKILL.md +221 -37
  438. package/dist/knowledge/skills/views-composite-authoring/SKILL.md +22 -5
  439. package/dist/knowledge/skills/views-execution-authoring/SKILL.md +1 -1
  440. package/dist/knowledge/skills/website-anonymous-session/SKILL.md +32 -2
  441. package/dist/knowledge/skills/website-blog-authoring/SKILL.md +16 -3
  442. package/dist/knowledge/skills/website-blog-authoring/references/blog-adapter-api.md +4 -0
  443. package/dist/knowledge/skills/website-bundle-discipline/SKILL.md +7 -1
  444. package/dist/knowledge/skills/website-consent-gate-overrides/SKILL.md +13 -1
  445. package/dist/knowledge/skills/website-factory-advanced/SKILL.md +14 -2
  446. package/dist/knowledge/skills/website-inbound-contact-forms/SKILL.md +13 -1
  447. package/dist/knowledge/skills/website-layout-overrides/SKILL.md +6 -1
  448. package/dist/knowledge/skills/website-marketing-metadata-extension/SKILL.md +19 -1
  449. package/dist/knowledge/skills/website-navigation-authoring/SKILL.md +55 -18
  450. package/dist/knowledge/skills/website-navigation-authoring/references/framework-public-document-links-api.md +98 -0
  451. package/dist/knowledge/skills/website-navigation-authoring/references/worked-examples-header-footer.md +8 -11
  452. package/dist/knowledge/skills/website-page-authoring/SKILL.md +100 -8
  453. package/dist/knowledge/skills/website-page-authoring/references/framework-site-context-loader-api.md +3 -0
  454. package/dist/knowledge/skills/website-primitive-overrides/SKILL.md +6 -1
  455. package/dist/knowledge/skills/website-section-contact/SKILL.md +15 -0
  456. package/dist/knowledge/skills/website-section-contact/references/define-website-section-api.md +15 -0
  457. package/dist/knowledge/skills/website-section-cta/SKILL.md +15 -0
  458. package/dist/knowledge/skills/website-section-cta/references/define-website-section-api.md +15 -0
  459. package/dist/knowledge/skills/website-section-faq/SKILL.md +21 -1
  460. package/dist/knowledge/skills/website-section-faq/references/define-website-section-api.md +15 -0
  461. package/dist/knowledge/skills/website-section-feature-benefit-summary/SKILL.md +21 -1
  462. package/dist/knowledge/skills/website-section-feature-benefit-summary/references/define-website-section-api.md +15 -0
  463. package/dist/knowledge/skills/website-section-feature-detail/SKILL.md +25 -2
  464. package/dist/knowledge/skills/website-section-feature-detail/references/define-website-section-api.md +15 -0
  465. package/dist/knowledge/skills/website-section-footer-cta/SKILL.md +15 -0
  466. package/dist/knowledge/skills/website-section-footer-cta/references/define-website-section-api.md +15 -0
  467. package/dist/knowledge/skills/website-section-hero/SKILL.md +33 -10
  468. package/dist/knowledge/skills/website-section-hero/references/define-website-section-api.md +15 -0
  469. package/dist/knowledge/skills/website-section-pricing/SKILL.md +21 -1
  470. package/dist/knowledge/skills/website-section-pricing/references/define-website-section-api.md +15 -0
  471. package/dist/knowledge/skills/website-section-social-proof/SKILL.md +27 -2
  472. package/dist/knowledge/skills/website-section-social-proof/references/define-website-section-api.md +15 -0
  473. package/dist/knowledge/skills/website-seo-aeo-geo/SKILL.md +16 -4
  474. package/dist/knowledge/skills/website-seo-aeo-geo/references/aeo-api.md +11 -0
  475. package/dist/knowledge/skills/website-seo-aeo-geo/references/geo-api.md +16 -1
  476. package/dist/knowledge/skills/website-seo-aeo-geo/references/seo-api.md +2 -1
  477. package/dist/knowledge/topic-index.json +1590 -292
  478. package/dist/tsconfig.build.tsbuildinfo +1 -1
  479. package/dist/tsconfig.tsbuildinfo +1 -1
  480. package/package.json +4 -4
@@ -23,7 +23,7 @@
23
23
  * check for type-asserted fixtures that bypass parsing, and the fail-soft
24
24
  * cross-family ICP / requirement ref resolution.
25
25
  *
26
- * Rule table — 8 kinds (scaffold depth, Phase J1 — deeper pricing / revenue
26
+ * Rule table — 10 kinds (scaffold depth, Phase J1 — deeper pricing / revenue
27
27
  * analysis is Phase J2):
28
28
  *
29
29
  * | Kind | Severity | Trigger |
@@ -31,7 +31,9 @@
31
31
  * | `INVALID_REF_FORMAT` | ERROR | A plan ref fails the shared pattern (single source of truth with the Zod schema). Defence in depth for type-asserted fixtures. |
32
32
  * | `DUPLICATE_REF` | ERROR | Two plans share a ref — the collection silently loses one entity to last-wins indexing. |
33
33
  * | `DUPLICATE_CROSS_REF` | WARN | The same target/include-ref is listed more than once on ONE plan's cross-ref list — the repeat is noise the catalog silently dedupes. Intra-snapshot, so it runs UNCONDITIONALLY (no external set needed) — each cross-ref list is its own namespace. |
34
- * | `NO_PLANS` | WARN | `plans` empty — the business model sketches no pricing. |
34
+ * | `NO_PLANS` | WARN | `plans` empty and nobody has said why — the business model sketches no pricing. SILENT when `pricingTiers` is `UNDECIDED`: there the emptiness is the creator's recorded answer, not owed work. |
35
+ * | `PRICING_TIERS_CONTRADICT_PLANS` | ERROR | The declared `pricingTiers` disagrees with `plans`: `undecided` with plans present, or `creator_stated` / `proposed` with none. |
36
+ * | `PROPOSAL_BASIS_MISMATCH` | ERROR | A plan of a `proposed` sketch has no `proposalBasis`, or a plan of a `creator_stated` one has one. Read through `resolvePricingTiersStatus`, so a hand-authored file with plans and no status counts as stated. |
35
37
  * | `NO_REVENUE_MODEL` | WARN | `plans` are authored but the product-level `revenueModel` is unset — the pricing sketch is classified per-plan (`PricingModelAxis`) but the product's headline revenue model is undeclared. GATED on `plans.length > 0`: an empty snapshot is already fully described by `NO_PLANS`, so this fires only for the sharper "sketched pricing, forgot the revenue model" state (no redundant double-warn on `{}`). |
36
38
  * | `STALE_AUTHORED` | WARN | Any plan's `authored.lastAuthoredAt + reviewCadence < now`. No check when `reviewCadence` is undefined or `AS_NEEDED`. |
37
39
  * | `UNKNOWN_ICP_REF` | ERROR | A `targetIcpRefs` entry does not resolve in `options.availableIcpRefs`. SKIPPED (fail-soft) when no set is passed — the families are decoupled and the catalog resolves refs. |
@@ -69,8 +71,26 @@ export enum BusinessModelLiteSnapshotIssueKind {
69
71
  * NOT a duplicate.
70
72
  */
71
73
  DUPLICATE_CROSS_REF = 'duplicate_cross_ref',
72
- /** `plans` empty — the business model sketches no pricing (WARN). */
74
+ /**
75
+ * `plans` empty and no recorded reason — the business model sketches no
76
+ * pricing (WARN). Not raised when `pricingTiers` is `UNDECIDED`: a considered
77
+ * "not decided yet" is an answer, and warning on it would teach the reader to
78
+ * skim the warning that means work is owed.
79
+ */
73
80
  NO_PLANS = 'no_plans',
81
+ /**
82
+ * The declared `pricingTiers` and the `plans` collection contradict each
83
+ * other — `undecided` while plans are present, or `creator_stated` /
84
+ * `proposed` with no plan. ERROR: one of the two statements is false, and a
85
+ * reader cannot tell which.
86
+ */
87
+ PRICING_TIERS_CONTRADICT_PLANS = 'pricing_tiers_contradict_plans',
88
+ /**
89
+ * A plan's `proposalBasis` disagrees with where the tiers came from — missing
90
+ * on a plan of a `proposed` sketch (a proposal nobody can check), or present
91
+ * on a plan the creator stated (a proposal nobody made). ERROR.
92
+ */
93
+ PROPOSAL_BASIS_MISMATCH = 'proposal_basis_mismatch',
74
94
  /**
75
95
  * `plans` are authored but the product-level `revenueModel` is unset. The
76
96
  * pricing sketch classifies HOW each plan scales (`PricingModelAxis`) but
@@ -171,6 +191,7 @@ export function validateBusinessModelLiteSnapshot(
171
191
  detectDuplicateRefs(snapshot, issues);
172
192
  detectDuplicateCrossRefs(snapshot, issues);
173
193
  detectIncompleteness(snapshot, issues);
194
+ detectPricingTiersDisagreement(snapshot, issues);
174
195
  detectStaleAuthored(snapshot, options?.now ?? new Date(), issues);
175
196
  detectUnknownCrossRefs(snapshot, options, issues);
176
197
 
@@ -257,7 +278,7 @@ function detectIncompleteness(
257
278
  snapshot: BusinessModelLiteSnapshot,
258
279
  issues: BusinessModelLiteSnapshotIssue[],
259
280
  ): void {
260
- if (snapshot.plans.length === 0) {
281
+ if (snapshot.plans.length === 0 && resolvePricingTiersStatus(snapshot) !== PricingTiersStatus.UNDECIDED) {
261
282
  issues.push({
262
283
  kind: BusinessModelLiteSnapshotIssueKind.NO_PLANS,
263
284
  path: 'plans',
@@ -278,6 +299,49 @@ function detectIncompleteness(
278
299
  }
279
300
  }
280
301
 
302
+ function detectPricingTiersDisagreement(
303
+ snapshot: BusinessModelLiteSnapshot,
304
+ issues: BusinessModelLiteSnapshotIssue[],
305
+ ): void {
306
+ const declared = snapshot.pricingTiers;
307
+ if (declared === PricingTiersStatus.UNDECIDED && snapshot.plans.length > 0) {
308
+ issues.push({
309
+ kind: BusinessModelLiteSnapshotIssueKind.PRICING_TIERS_CONTRADICT_PLANS,
310
+ path: 'pricingTiers',
311
+ message: `pricingTiers is "undecided" but ${snapshot.plans.length} plan(s) are present — remove the plans, or declare where they came from.`,
312
+ severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,
313
+ });
314
+ }
315
+ if ((declared === PricingTiersStatus.CREATOR_STATED || declared === PricingTiersStatus.PROPOSED) && snapshot.plans.length === 0) {
316
+ issues.push({
317
+ kind: BusinessModelLiteSnapshotIssueKind.PRICING_TIERS_CONTRADICT_PLANS,
318
+ path: 'pricingTiers',
319
+ message: `pricingTiers is "${declared}" but no plan is present — record the plans, or declare "undecided".`,
320
+ severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,
321
+ });
322
+ }
323
+
324
+ const resolved = resolvePricingTiersStatus(snapshot);
325
+ snapshot.plans.forEach((entry, index) => {
326
+ if (resolved === PricingTiersStatus.PROPOSED && entry.proposalBasis === undefined) {
327
+ issues.push({
328
+ kind: BusinessModelLiteSnapshotIssueKind.PROPOSAL_BASIS_MISMATCH,
329
+ path: `plans[${index}].proposalBasis`,
330
+ message: `Plan "${entry.ref}" is a proposal but states no proposalBasis — name the ICP and requirements it was derived from.`,
331
+ severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,
332
+ });
333
+ }
334
+ if (resolved === PricingTiersStatus.CREATOR_STATED && entry.proposalBasis !== undefined) {
335
+ issues.push({
336
+ kind: BusinessModelLiteSnapshotIssueKind.PROPOSAL_BASIS_MISMATCH,
337
+ path: `plans[${index}].proposalBasis`,
338
+ message: `Plan "${entry.ref}" was stated by the creator but carries a proposalBasis — remove it, or declare pricingTiers "proposed".`,
339
+ severity: BusinessModelLiteSnapshotIssueSeverity.ERROR,
340
+ });
341
+ }
342
+ });
343
+ }
344
+
281
345
  function detectStaleAuthored(
282
346
  snapshot: BusinessModelLiteSnapshot,
283
347
  now: Date,
@@ -114,12 +114,28 @@ export enum CompositionBasis {
114
114
  */
115
115
  INTEGRATION_PLAN_OWNS_WORKERS_AND_MINIONS = 'INTEGRATION_PLAN_OWNS_WORKERS_AND_MINIONS',
116
116
  /**
117
- * The application's configuration declares the languages it serves (`appPreferences.languages`), and
118
- * that decides whether its website is published in more than one locale. A HOST fact rather than a
119
- * family: no specification family declares languages, and the configuration already does, so asking
120
- * anyone would re-state it.
117
+ * The application's configuration declares MORE THAN ONE language (`appPreferences.languages`), so its
118
+ * website is published in a locale for each beyond the primary. A HOST fact rather than a family: no
119
+ * specification family declares languages, and the configuration already does, so asking anyone would
120
+ * re-state it.
121
+ *
122
+ * A NEED basis only. A one-language configuration implies no second locale, and that is
123
+ * {@link CompositionBasis.NO_DECLARATION_IMPLIES_IT} — the configuration was read and implies nothing.
124
+ * Until 2026-10-01 the derivation used this basis for both answers, and the validator refused every
125
+ * one-language application on its first run.
121
126
  */
122
127
  APPLICATION_CONFIG_DECLARES_LANGUAGES = 'APPLICATION_CONFIG_DECLARES_LANGUAGES',
128
+ /**
129
+ * The market snapshot targets countries (a CORE or EXPANSION ICP's geographies) whose languages the
130
+ * application's configuration does not serve, so the website needs a locale for each — named in the
131
+ * decision's detail. Derived by `measureMarketLanguageCoverage`, never asked: both halves are typed
132
+ * declarations (ISO country codes on the ICPs, `appPreferences.languages` in the configuration).
133
+ *
134
+ * Takes precedence over {@link CompositionBasis.APPLICATION_CONFIG_DECLARES_LANGUAGES} when both hold,
135
+ * because it is the one that names a gap: the configuration and the market disagree, and the coherence
136
+ * report says so as well.
137
+ */
138
+ MARKET_TARGETS_UNSERVED_LANGUAGES = 'MARKET_TARGETS_UNSERVED_LANGUAGES',
123
139
  /**
124
140
  * An optional LAYOUT library (the 3D layout, #1827) is the operator's opt-in. Nothing in a product definition
125
141
  * decides a rendering style: most applications are 2D, and one becomes 3D because its operator composes it —
@@ -132,6 +148,44 @@ export enum CompositionBasis {
132
148
  NO_DECLARATION_DECIDES_IT = 'NO_DECLARATION_DECIDES_IT',
133
149
  }
134
150
 
151
+ /**
152
+ * The ONE disposition each basis can justify. Total over {@link CompositionBasis}, so a basis added
153
+ * tomorrow does not compile until somebody says which disposition it supports.
154
+ *
155
+ * A basis is a REASON, and a reason points one way: "the domain plan owns modules" cannot justify
156
+ * NEEDED, "no declaration implies it" cannot justify NEEDED, "the market declares an inbound web
157
+ * channel" cannot justify DECLINED. `validateCapabilityComposition` refuses any decision whose basis
158
+ * this table maps elsewhere, and the derivation's constructors are typed by {@link CompositionBasisFor},
159
+ * so the producer cannot even write the pairing the validator refuses.
160
+ *
161
+ * It exists because the pairing used to live in the validator only, as two hand-kept sets, while the
162
+ * derivation wrote whatever pair it chose. On 2026-10-01 it wrote DECLINED with
163
+ * `APPLICATION_CONFIG_DECLARES_LANGUAGES` for every one-language application; nothing stopped it until
164
+ * the landing refused the record, on a real first run.
165
+ */
166
+ export const COMPOSITION_BASIS_DISPOSITION = {
167
+ [CompositionBasis.MARKET_DECLARES_INBOUND_WEB_CHANNEL]: CompositionDisposition.NEEDED,
168
+ [CompositionBasis.BRAND_BRIEF_LANDED]: CompositionDisposition.NEEDED,
169
+ [CompositionBasis.BUSINESS_MODEL_DECLARES_PRICING_PLANS]: CompositionDisposition.NEEDED,
170
+ [CompositionBasis.MARKET_TARGETS_LEGAL_ENTITIES]: CompositionDisposition.NEEDED,
171
+ [CompositionBasis.REQUIREMENTS_DECLARE_PORTABILITY]: CompositionDisposition.NEEDED,
172
+ [CompositionBasis.APPLICATION_CONFIG_DECLARES_LANGUAGES]: CompositionDisposition.NEEDED,
173
+ [CompositionBasis.MARKET_TARGETS_UNSERVED_LANGUAGES]: CompositionDisposition.NEEDED,
174
+ [CompositionBasis.DOMAIN_PLAN_OWNS_MODULES_AND_RESOURCES]: CompositionDisposition.OWNED_BY_ANOTHER_STEP,
175
+ [CompositionBasis.BUILD_TASKS_OWN_PER_ARTIFACT_SCENARIOS]: CompositionDisposition.OWNED_BY_ANOTHER_STEP,
176
+ [CompositionBasis.PROVIDER_DECISION_OWNS_PROVIDERS]: CompositionDisposition.OWNED_BY_ANOTHER_STEP,
177
+ [CompositionBasis.DEPLOYMENT_OWNS_ENVIRONMENTS]: CompositionDisposition.OWNED_BY_ANOTHER_STEP,
178
+ [CompositionBasis.INTEGRATION_PLAN_OWNS_WORKERS_AND_MINIONS]: CompositionDisposition.OWNED_BY_ANOTHER_STEP,
179
+ [CompositionBasis.OPERATOR_OPTS_INTO_OPTIONAL_LAYOUT]: CompositionDisposition.OWNED_BY_ANOTHER_STEP,
180
+ [CompositionBasis.NO_DECLARATION_IMPLIES_IT]: CompositionDisposition.DECLINED,
181
+ [CompositionBasis.NO_DECLARATION_DECIDES_IT]: CompositionDisposition.DECLINED,
182
+ } as const satisfies Readonly<Record<CompositionBasis, CompositionDisposition>>;
183
+
184
+ /** The bases that can justify disposition `D` — what a typed decision constructor accepts. */
185
+ export type CompositionBasisFor<D extends CompositionDisposition> = {
186
+ [B in CompositionBasis]: (typeof COMPOSITION_BASIS_DISPOSITION)[B] extends D ? B : never;
187
+ }[CompositionBasis];
188
+
135
189
  const NonEmptyStringSchema = z.string().trim().min(1);
136
190
 
137
191
  /** One scenario's decision, with the declaration it was read from. */
@@ -145,6 +199,15 @@ export const CompositionDecisionSchema = z.strictObject({
145
199
  ownedBy: NonEmptyStringSchema.optional(),
146
200
  /** For NO_DECLARATION_DECIDES_IT: the typed declaration that would decide it, so the gap is a named field rather than a question. */
147
201
  missingDeclaration: NonEmptyStringSchema.optional(),
202
+ /**
203
+ * For a NEEDED `add-locale`: the languages the website publishes a locale for, beyond its primary.
204
+ *
205
+ * Carried on the decision so the foundation APPLIES what was decided instead of deciding it again.
206
+ * Before the market could decide a locale, the foundation re-read the configuration's languages and
207
+ * that was the same answer; once a market language the configuration does not serve can make a
208
+ * locale NEEDED, only the decision knows the full set.
209
+ */
210
+ locales: z.array(z.enum(AvailableLanguage).systemEnum('AvailableLanguage')).optional(),
148
211
  });
149
212
  export type CompositionDecision = z.infer<typeof CompositionDecisionSchema>;
150
213
 
@@ -112,19 +112,26 @@ export class MarketPromptUnknownPlaceholderError extends Error {
112
112
  }
113
113
  }
114
114
 
115
- export class MarketPromptMissingRequiredInputError extends Error {
115
+ /*
116
+ * The three errors below describe the CALLER's request — a flag it did not pass, a ref or template it
117
+ * named that the snapshot does not hold — so they extend `IntrospectionInputValidationError` and carry
118
+ * its name across the subprocess boundary: the controller answers 400 with the message instead of a
119
+ * sanitized 500 (#2365). They keep their own classes for `instanceof`; their `name` is the contract.
120
+ * `MarketPromptUnknownPlaceholderError` above stays a plain error: an unknown placeholder is a fault in
121
+ * the AUTHORED template, which no change to the request can fix.
122
+ */
123
+ export class MarketPromptMissingRequiredInputError extends IntrospectionInputValidationError {
116
124
  public readonly missing: MarketMessageRequiredInput[];
117
125
  constructor(templateRef: string, missing: MarketMessageRequiredInput[]) {
118
126
  super(
119
127
  `Template \`${templateRef}\` declares requiredInputs ${missing.map(m => `\`${m}\``).join(', ')} `
120
128
  + `but the caller did not provide them. Pass the matching CLI flag(s) (e.g. \`--icp\`, \`--benefit\`, \`--objection\`, \`--channel\`).`,
121
129
  );
122
- this.name = 'MarketPromptMissingRequiredInputError';
123
130
  this.missing = missing;
124
131
  }
125
132
  }
126
133
 
127
- export class MarketPromptUnknownRefError extends Error {
134
+ export class MarketPromptUnknownRefError extends IntrospectionInputValidationError {
128
135
  public readonly entityKind: string;
129
136
  public readonly providedRef: string;
130
137
  constructor(entityKind: string, providedRef: string, knownRefs: string[]) {
@@ -132,19 +139,17 @@ export class MarketPromptUnknownRefError extends Error {
132
139
  `No ${entityKind} found with ref \`${providedRef}\` in the authored MarketSnapshot. `
133
140
  + `Known ${entityKind} refs: ${knownRefs.length > 0 ? knownRefs.map(r => `\`${r}\``).join(', ') : '(none)'}.`,
134
141
  );
135
- this.name = 'MarketPromptUnknownRefError';
136
142
  this.entityKind = entityKind;
137
143
  this.providedRef = providedRef;
138
144
  }
139
145
  }
140
146
 
141
- export class MarketPromptTemplateNotFoundError extends Error {
147
+ export class MarketPromptTemplateNotFoundError extends IntrospectionInputValidationError {
142
148
  constructor(templateRef: string, knownRefs: string[]) {
143
149
  super(
144
150
  `No MarketMessageTemplate found with ref \`${templateRef}\`. `
145
151
  + `Known templates: ${knownRefs.length > 0 ? knownRefs.map(r => `\`${r}\``).join(', ') : '(none — author one in `specifications/src/market/messaging/`)'}.`,
146
152
  );
147
- this.name = 'MarketPromptTemplateNotFoundError';
148
153
  }
149
154
  }
150
155
 
@@ -0,0 +1,44 @@
1
+ # example.authorization.application-roles.office-and-field
2
+
3
+
4
+ ## Usage Example
5
+
6
+ ```typescript
7
+ *
8
+ * A trade business with office staff and field technicians. Everything below imports from
9
+ * `@wildo-ai/saas-models`.
10
+ *
11
+ * 1. `shared-lib/src/engine/roles.ts` declares the field role. Office staff need no new role: they hold
12
+ * the core `ORG_MEMBER`, so administrators and owners keep everything office staff can do. The field
13
+ * role inherits `ORG_GUEST`, the bottom of the chain, so it starts from almost nothing.
14
+ */
15
+ export const CUSTOM_ROLES_CONFIGURATION: RolesConfiguration = {
16
+ FIELD_TECHNICIAN: {
17
+ role: 'FIELD_TECHNICIAN',
18
+ inheritFrom: CORE_ORG_ROLES.ORG_GUEST,
19
+ isSystemRole: false,
20
+ relatedPrimaryScope: ResourcePrimaryScope.ORGANIZATIONS,
21
+ },
22
+ };
23
+
24
+ /**
25
+ * 2. `wildo.saas.config.ts` → `organizationTypes.<type>.availableOrgRoles` offers it. Omitted, the list
26
+ * defaults to owner, admin and member only, so the field role could never be given to anyone.
27
+ */
28
+ export const workspaceAvailableOrgRoles: Roles[] = [
29
+ CORE_ORG_ROLES.ORG_OWNER,
30
+ CORE_ORG_ROLES.ORG_ADMIN,
31
+ CORE_ORG_ROLES.ORG_MEMBER,
32
+ 'FIELD_TECHNICIAN',
33
+ ];
34
+
35
+ /**
36
+ * 3. Each operation variant's `roles` names who may call it. A holder satisfies a role it holds OR one
37
+ * up its `inheritFrom` chain, so `ORG_MEMBER` here admits office staff, managers, admins and owners,
38
+ * and the field role must be named explicitly wherever technicians are admitted.
39
+ */
40
+ /** Jobs: technicians read the jobs and record progress on them. */
41
+ export const jobReadAndProgressRoles: Roles[] = ['FIELD_TECHNICIAN', CORE_ORG_ROLES.ORG_MEMBER];
42
+ /** Quotes and invoices: office only. A technician holding only the field role is refused. */
43
+ export const quoteAndInvoiceRoles: Roles[] = [CORE_ORG_ROLES.ORG_MEMBER];
44
+ ```
@@ -0,0 +1,81 @@
1
+ # example.backend.custom-operation.audit-event
2
+
3
+
4
+ ## Usage Example
5
+
6
+ ```typescript
7
+ import { AuditEventCategory, AuditEventSeverity, ResourceOperationRiskLevel, ResourceOperationVariantType } from '@wildo-ai/saas-models';
8
+ import {
9
+ createResourceCustomServiceImplementation,
10
+ SAAS_SERVICE_TYPES,
11
+ type AuditLogsBackendService,
12
+ type InversifyContainer,
13
+ type ResourceCustomServiceImplementationFactory,
14
+ type ResourcesRegistryBackendService,
15
+ } from '@wildo-ai/saas-backend-lib';
16
+
17
+ /** In an application these come from its shared-lib (`Sales_ResourceType`, `Quotes_Operations`). */
18
+ enum Sales_ResourceType {
19
+ QUOTES = 'quotes',
20
+ }
21
+ enum Quotes_Operations {
22
+ ISSUE = 'issue',
23
+ }
24
+ /** The application's OWN event types, named once so the trail and every reader agree on the words. */
25
+ enum Sales_AuditEventType {
26
+ QUOTE_ISSUED = 'SALES_QUOTE_ISSUED',
27
+ }
28
+
29
+ /**
30
+ * How each of those event types is classified, declared ONCE as `auditTrail.applicationEventTypes` in the backend
31
+ * configuration (`backend-api/src/saas-config.backend.ts`). Rows of a declared type are recorded and routed to the
32
+ * SIEM with its category and severity, and the labelling pipeline plans its word; an undeclared type is recorded as
33
+ * `data_access` / `info`. Total over the enum by its type, so a new event type without a classification fails to compile.
34
+ */
35
+ export const salesAuditEventTypes = {
36
+ [Sales_AuditEventType.QUOTE_ISSUED]: { category: AuditEventCategory.DATA_ACCESS, severity: AuditEventSeverity.WARNING },
37
+ } satisfies Record<Sales_AuditEventType, { category: AuditEventCategory; severity: AuditEventSeverity }>;
38
+
39
+ const quotesIssueCustomImpl: ResourceCustomServiceImplementationFactory = (
40
+ resourcesRegistryService: ResourcesRegistryBackendService,
41
+ container: InversifyContainer,
42
+ ) => {
43
+ const operationPath = {
44
+ resourceIdentifier: Sales_ResourceType.QUOTES,
45
+ operationIdentifier: Quotes_Operations.ISSUE,
46
+ variantType: ResourceOperationVariantType.API_CALL,
47
+ isOperationDefault: true,
48
+ };
49
+ const requestDtoSchema = resourcesRegistryService.getRequestDtoFromPath(operationPath);
50
+ const responseDtoSchema = resourcesRegistryService.getResponseDtoFromPath(operationPath);
51
+
52
+ // Resolved on first use, never in the factory body: factories run while the container is still being populated.
53
+ let auditLogs: AuditLogsBackendService | undefined;
54
+
55
+ return createResourceCustomServiceImplementation<typeof requestDtoSchema, typeof responseDtoSchema>({
56
+ operationPath,
57
+ requestDtoSchema,
58
+ responseDtoSchema,
59
+ handlers: {
60
+ // The quote's ISSUE transition: the event is recorded once the issued state is the result.
61
+ postfixCoreOperations: async (id, result, executionContext, _operationPath, utils) => {
62
+ auditLogs ??= container.get<AuditLogsBackendService>(SAAS_SERVICE_TYPES.AuditLogsService);
63
+ // The event names WHO acted and WHICH organization it is about: the row is assembled from what you pass, and an
64
+ // organization's audit view lists only rows carrying its id. The context (second argument) adds what kind of
65
+ // principal acted (person, agent, machine), the correlation id and the organization's SIEM routing.
66
+ await auditLogs.logEvent({
67
+ eventType: Sales_AuditEventType.QUOTE_ISSUED,
68
+ riskLevel: ResourceOperationRiskLevel.MEDIUM,
69
+ userId: executionContext.initiatorIds?.userId,
70
+ organizationId: executionContext.initiatorIds?.organizationId,
71
+ eventData: { quoteId: id, quoteNumber: (result as { number?: string } | undefined)?.number },
72
+ }, executionContext);
73
+ utils.logger.debug('Recorded the quote issue in the audit trail');
74
+ return result;
75
+ },
76
+ },
77
+ });
78
+ };
79
+
80
+ export default quotesIssueCustomImpl;
81
+ ```
@@ -0,0 +1,258 @@
1
+ # example.backend.custom-operation.child-line-total
2
+
3
+
4
+ ## Usage Example
5
+
6
+ ```typescript
7
+ // The pure total function and line type of the computed-total recipe (array lines), shared rather than copied.
8
+ import { computeQuoteTotal, type QuoteLine } from './computed-total.example';
9
+ import { z } from 'zod';
10
+ import { CurrencyAllowed, CurrencySchema, z_money } from '@wildo-ai/zod-decorators';
11
+ import {
12
+ CORE_ORG_ROLES,
13
+ CoreResourceOperation,
14
+ CoreResourceType,
15
+ ErrorCustomMessageReference,
16
+ ErrorType,
17
+ RelationshipNature,
18
+ ResourceOperationRiskLevel,
19
+ ResourceOperationVariantType,
20
+ ResourceRelationshipAccessScopeStrategy,
21
+ ResourceRelationshipCardinality,
22
+ createResourceConfiguration_Initialization,
23
+ createResourcesRelationship,
24
+ type ResourceRelationship,
25
+ type ResourceType,
26
+ } from '@wildo-ai/saas-models';
27
+ import {
28
+ createResourceCustomServiceImplementation,
29
+ type ExecutionContext,
30
+ type ResourceCustomServiceImplementationFactory,
31
+ type ResourceOperation_CustomImplementation_Utils,
32
+ type ResourcesRegistryBackendService,
33
+ } from '@wildo-ai/saas-backend-lib';
34
+
35
+ // ── shared-lib: the two resources ───────────────────────────────────────────────────────────────
36
+
37
+ /** In an application these come from its shared-lib. */
38
+ export enum Sales_ResourceType {
39
+ QUOTES = 'quotes',
40
+ QUOTE_LINES = 'quoteLines',
41
+ }
42
+
43
+ export enum Quote_Status {
44
+ DRAFT = 'draft',
45
+ SENT = 'sent',
46
+ }
47
+
48
+ export enum Quote_Operations {
49
+ /** Moves a DRAFT quote to SENT. After it, the quote and its lines are what the customer received. */
50
+ SEND = 'send',
51
+ /** Internal only: recomputes `total` from the quote's lines. Never offered to a client. */
52
+ RECOMPUTE_TOTAL = 'recompute_total',
53
+ }
54
+
55
+ export const Quote_Schema = z.object({
56
+ _id: z.string().min(1).isPrimaryKey(),
57
+ organizationId: z.string().min(1).isDBIndexed().isForeignKey().excludeFromUpdate(),
58
+ title: z.string().trim().min(1).max(200).isSummaryField(),
59
+ // Fixed at create: the total and every line are in this currency, so changing it would strand them.
60
+ currency: CurrencySchema.excludeFromUpdate(),
61
+ // Changed only by the SEND transition: a plain UPDATE that could set it back to DRAFT would unfreeze the lines.
62
+ status: z.enum(Quote_Status).default(Quote_Status.DRAFT).excludeFromCreate().excludeFromUpdate(),
63
+ total: z_money({ currenciesAllowed: [CurrencyAllowed.FIAT] }).optional().isSummaryField().excludeFromCreate().excludeFromUpdate(),
64
+ });
65
+
66
+ /** One line, its own resource: a COMPOSITION child of its quote. `quoteId` never moves to another quote. */
67
+ export const QuoteLine_Schema = z.object({
68
+ _id: z.string().min(1).isPrimaryKey(),
69
+ organizationId: z.string().min(1).isDBIndexed().isForeignKey().excludeFromUpdate(),
70
+ quoteId: z.string().min(1).isDBIndexed().isForeignKey().excludeFromUpdate(),
71
+ description: z.string().trim().min(1).max(500),
72
+ quantity: z.number().int().min(1),
73
+ unitPrice: z_money({ currenciesAllowed: [CurrencyAllowed.FIAT] }),
74
+ });
75
+
76
+ export const sales_ResourceRelationships: ResourceRelationship[] = [
77
+ createResourcesRelationship(CoreResourceType.ORGANIZATIONS, Sales_ResourceType.QUOTES as ResourceType,
78
+ ResourceRelationshipCardinality.ONE, ResourceRelationshipCardinality.MANY,
79
+ { nature: RelationshipNature.COMPOSITION, isPrimaryScope: true, foreignKeyField: 'organizationId' }),
80
+ createResourcesRelationship(CoreResourceType.ORGANIZATIONS, Sales_ResourceType.QUOTE_LINES as ResourceType,
81
+ ResourceRelationshipCardinality.ONE, ResourceRelationshipCardinality.MANY,
82
+ { accessScopeStrategy: ResourceRelationshipAccessScopeStrategy.STANDALONE, isPrimaryScope: true, nature: RelationshipNature.REFERENCE, contextPolicy: { enabled: false }, foreignKeyField: 'organizationId' }),
83
+ createResourcesRelationship(Sales_ResourceType.QUOTES as ResourceType, Sales_ResourceType.QUOTE_LINES as ResourceType,
84
+ ResourceRelationshipCardinality.ONE, ResourceRelationshipCardinality.MANY,
85
+ { nature: RelationshipNature.COMPOSITION, foreignKeyField: 'quoteId' }),
86
+ ];
87
+
88
+ /** Every client-facing operation here: one API_CALL variant for organization members. */
89
+ const apiCall = <const R extends ResourceOperationRiskLevel>(riskLevel: R) => ({
90
+ variants: [{ variantType: ResourceOperationVariantType.API_CALL as const, isDefault: true, roles: [CORE_ORG_ROLES.ORG_MEMBER], riskLevel }],
91
+ });
92
+
93
+ type Quote_CoreOperations = CoreResourceOperation.READ | CoreResourceOperation.LIST | CoreResourceOperation.CREATE | CoreResourceOperation.UPDATE;
94
+ export const quote_ResourceConfiguration_InitializationFactory = (relationships: ResourceRelationship[]) =>
95
+ createResourceConfiguration_Initialization<typeof Quote_Operations, Quote_CoreOperations, typeof Quote_Schema>({
96
+ mainSchema: Quote_Schema,
97
+ resourceIdentifier: Sales_ResourceType.QUOTES,
98
+ resourceFieldIdentifier: 'quoteId',
99
+ resourceRelationships: relationships,
100
+ coreOperations: [CoreResourceOperation.READ, CoreResourceOperation.LIST, CoreResourceOperation.CREATE, CoreResourceOperation.UPDATE],
101
+ customOperation: Quote_Operations,
102
+ operationsConfiguration: {
103
+ [CoreResourceOperation.READ]: apiCall(ResourceOperationRiskLevel.LOW),
104
+ [CoreResourceOperation.LIST]: apiCall(ResourceOperationRiskLevel.LOW),
105
+ [CoreResourceOperation.CREATE]: apiCall(ResourceOperationRiskLevel.MEDIUM),
106
+ [CoreResourceOperation.UPDATE]: apiCall(ResourceOperationRiskLevel.MEDIUM),
107
+ [Quote_Operations.SEND]: {
108
+ variants: [{
109
+ variantType: ResourceOperationVariantType.API_CALL,
110
+ isDefault: true,
111
+ roles: [CORE_ORG_ROLES.ORG_MEMBER],
112
+ riskLevel: ResourceOperationRiskLevel.HIGH,
113
+ resourceOperationLike: CoreResourceOperation.UPDATE,
114
+ requestDto: z.object({}),
115
+ enabledCondition: ({ currentObject }) => currentObject.status === Quote_Status.DRAFT,
116
+ basicPrefixOperation: () => ({ status: Quote_Status.SENT }),
117
+ authoritativeFields: ['status'],
118
+ }],
119
+ },
120
+ [Quote_Operations.RECOMPUTE_TOTAL]: {
121
+ variants: [{
122
+ // INTERNAL_CALL: no route, no button. Only the line operations' hooks call it.
123
+ variantType: ResourceOperationVariantType.INTERNAL_CALL,
124
+ isDefault: true,
125
+ roles: [CORE_ORG_ROLES.ORG_MEMBER],
126
+ riskLevel: ResourceOperationRiskLevel.LOW,
127
+ resourceOperationLike: CoreResourceOperation.UPDATE,
128
+ requestDto: z.object({}),
129
+ // An INTERNAL_CALL variant has no `enabledCondition`: the "only while DRAFT" guard is the prefix's refusal below.
130
+ }],
131
+ },
132
+ },
133
+ });
134
+
135
+ type QuoteLine_CoreOperations = CoreResourceOperation.READ | CoreResourceOperation.LIST | CoreResourceOperation.CREATE | CoreResourceOperation.UPDATE | CoreResourceOperation.DELETE;
136
+ export const quoteLine_ResourceConfiguration_InitializationFactory = (relationships: ResourceRelationship[]) =>
137
+ createResourceConfiguration_Initialization<undefined, QuoteLine_CoreOperations, typeof QuoteLine_Schema>({
138
+ mainSchema: QuoteLine_Schema,
139
+ resourceIdentifier: Sales_ResourceType.QUOTE_LINES,
140
+ resourceFieldIdentifier: 'quoteLineId',
141
+ resourceRelationships: relationships,
142
+ coreOperations: [CoreResourceOperation.READ, CoreResourceOperation.LIST, CoreResourceOperation.CREATE, CoreResourceOperation.UPDATE, CoreResourceOperation.DELETE],
143
+ operationsConfiguration: {
144
+ [CoreResourceOperation.READ]: apiCall(ResourceOperationRiskLevel.LOW),
145
+ [CoreResourceOperation.LIST]: apiCall(ResourceOperationRiskLevel.LOW),
146
+ [CoreResourceOperation.CREATE]: apiCall(ResourceOperationRiskLevel.LOW),
147
+ [CoreResourceOperation.UPDATE]: apiCall(ResourceOperationRiskLevel.LOW),
148
+ [CoreResourceOperation.DELETE]: apiCall(ResourceOperationRiskLevel.LOW),
149
+ },
150
+ });
151
+
152
+ // ── backend-api: the recompute, and the hooks that call it ──────────────────────────────────────
153
+
154
+ /**
155
+ * Every line of a quote. An internal `list` with no pagination returns the full set: that is the engine's internal-call
156
+ * contract, because a total that stopped at a page boundary would be wrong with nothing saying so. (Pass a page only
157
+ * when completeness is not needed; an explicit page is capped by the LIST operation's ceiling.)
158
+ */
159
+ async function readAllQuoteLines(quoteId: string, executionContext: ExecutionContext<any>, utils: ResourceOperation_CustomImplementation_Utils): Promise<QuoteLine[]> {
160
+ const listed = await utils.servicesRegistry.list<QuoteLine>(
161
+ Sales_ResourceType.QUOTE_LINES as ResourceType,
162
+ await utils.executionContextCreator.createForSubCall(executionContext, Sales_ResourceType.QUOTE_LINES as ResourceType, CoreResourceOperation.LIST, utils.serviceOptions),
163
+ { quoteId },
164
+ undefined,
165
+ utils.serviceOptions,
166
+ );
167
+ return Array.isArray(listed) ? listed : listed.data;
168
+ }
169
+
170
+ /**
171
+ * The quote's `recompute_total`: owns `total` (`authoritativeFields`), computes it from every line inside the caller's
172
+ * transaction (each read forwards `utils.serviceOptions`), and refuses a total it cannot compute honestly.
173
+ */
174
+ export const quotesRecomputeTotal: ResourceCustomServiceImplementationFactory = (resourcesRegistryService: ResourcesRegistryBackendService) => {
175
+ const operationPath = {
176
+ resourceIdentifier: Sales_ResourceType.QUOTES,
177
+ operationIdentifier: Quote_Operations.RECOMPUTE_TOTAL,
178
+ variantType: ResourceOperationVariantType.INTERNAL_CALL,
179
+ isOperationDefault: true,
180
+ };
181
+ const requestDtoSchema = resourcesRegistryService.getRequestDtoFromPath(operationPath);
182
+ const responseDtoSchema = resourcesRegistryService.getResponseDtoFromPath(operationPath);
183
+ return createResourceCustomServiceImplementation<typeof requestDtoSchema, typeof responseDtoSchema>({
184
+ operationPath,
185
+ requestDtoSchema,
186
+ responseDtoSchema,
187
+ authoritativeFields: ['total'],
188
+ handlers: {
189
+ prefixCoreOperations: async (quoteId, input, executionContext, _operationPath, utils) => {
190
+ const quote = utils.currentObject as { currency: string; status: Quote_Status };
191
+ // The one guard for every line change: a sent quote's lines are what the customer received. Refusing here fails
192
+ // the line operation's transaction, so the line write is rolled back with it, whichever operation it was.
193
+ if (quote.status !== Quote_Status.DRAFT) {
194
+ throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {
195
+ customMessageReference: ErrorCustomMessageReference.CONFLICT,
196
+ context: { field: 'status', reason: 'quote_not_draft' },
197
+ });
198
+ }
199
+ // Two lines written to one quote at the same moment take turns here, so the second sees the first's line. This
200
+ // operation targets the quote's row, so the framework read `utils.currentObject` with the quote's write lock
201
+ // before this prefix ran (PostgreSQL; on MongoDB a write conflict aborts the second instead). Nothing to add.
202
+ const lines = await readAllQuoteLines(String(quoteId), executionContext, utils);
203
+ const total = computeQuoteTotal(lines, 0, quote.currency);
204
+ if ('refusal' in total) {
205
+ throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {
206
+ customMessageReference: ErrorCustomMessageReference.SERVICE_RESOURCE_VALIDATION_FAILED,
207
+ context: { field: 'total', reason: total.refusal },
208
+ });
209
+ }
210
+ return { ...input, total: total.total } as typeof input;
211
+ },
212
+ },
213
+ });
214
+ };
215
+
216
+ /**
217
+ * One factory per line operation. `transactionalCore` puts the line write and the quote's recompute in ONE transaction,
218
+ * with the quote declared as a participant: a refused recompute (a sent quote, a line in another currency) rolls the
219
+ * line write back, so a line never changes without its quote's total.
220
+ */
221
+ function quoteLinesRecompute(operationIdentifier: CoreResourceOperation.CREATE | CoreResourceOperation.UPDATE | CoreResourceOperation.DELETE): ResourceCustomServiceImplementationFactory {
222
+ // No DTO schemas: the postfix passes the core result through untouched, and DELETE's result (the deletion envelope)
223
+ // is not the response DTO's shape, so declaring one would fail the parse after the row is already gone.
224
+ return () => createResourceCustomServiceImplementation({
225
+ operationPath: {
226
+ resourceIdentifier: Sales_ResourceType.QUOTE_LINES,
227
+ operationIdentifier,
228
+ variantType: ResourceOperationVariantType.API_CALL,
229
+ isOperationDefault: true,
230
+ },
231
+ transactionalCore: true,
232
+ transactionParticipants: { quote: Sales_ResourceType.QUOTES as ResourceType },
233
+ handlers: {
234
+ postfixCoreOperations: async (_id, result, executionContext, _operationPath, utils) => {
235
+ // CREATE: the written line. UPDATE and DELETE: `utils.currentObject`, the stored line read before the write
236
+ // (`quoteId` never changes, and after a DELETE the row is gone).
237
+ const quoteId = (utils.currentObject as QuoteLine & { quoteId?: string } | undefined)?.quoteId
238
+ ?? (result as unknown as { quoteId: string }).quoteId;
239
+ await utils.servicesRegistry.executeCustomOperation(
240
+ Sales_ResourceType.QUOTES as ResourceType,
241
+ Quote_Operations.RECOMPUTE_TOTAL,
242
+ await utils.executionContextCreator.createForSubCall(
243
+ executionContext, Sales_ResourceType.QUOTES as ResourceType, Quote_Operations.RECOMPUTE_TOTAL, utils.serviceOptions,
244
+ ),
245
+ quoteId,
246
+ {},
247
+ utils.serviceOptions,
248
+ );
249
+ return result;
250
+ },
251
+ },
252
+ });
253
+ }
254
+
255
+ export const quoteLinesCreateRecompute: ResourceCustomServiceImplementationFactory = quoteLinesRecompute(CoreResourceOperation.CREATE);
256
+ export const quoteLinesUpdateRecompute: ResourceCustomServiceImplementationFactory = quoteLinesRecompute(CoreResourceOperation.UPDATE);
257
+ export const quoteLinesDeleteRecompute: ResourceCustomServiceImplementationFactory = quoteLinesRecompute(CoreResourceOperation.DELETE);
258
+ ```