@contractspec/lib.contracts 1.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (528) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +109 -0
  3. package/dist/_virtual/rolldown_runtime.js +37 -0
  4. package/dist/app-config/app-config.feature.d.ts +12 -0
  5. package/dist/app-config/app-config.feature.js +54 -0
  6. package/dist/app-config/branding.d.ts +55 -0
  7. package/dist/app-config/branding.js +0 -0
  8. package/dist/app-config/contracts.d.ts +245 -0
  9. package/dist/app-config/contracts.js +395 -0
  10. package/dist/app-config/docs/app-config.docblock.d.ts +6 -0
  11. package/dist/app-config/docs/app-config.docblock.js +21 -0
  12. package/dist/app-config/events.d.ts +122 -0
  13. package/dist/app-config/events.js +174 -0
  14. package/dist/app-config/index.d.ts +9 -0
  15. package/dist/app-config/index.js +8 -0
  16. package/dist/app-config/lifecycle-contracts.d.ts +273 -0
  17. package/dist/app-config/lifecycle-contracts.js +440 -0
  18. package/dist/app-config/lifecycle.d.ts +27 -0
  19. package/dist/app-config/lifecycle.js +0 -0
  20. package/dist/app-config/runtime.d.ts +120 -0
  21. package/dist/app-config/runtime.js +617 -0
  22. package/dist/app-config/spec.d.ts +173 -0
  23. package/dist/app-config/spec.js +36 -0
  24. package/dist/app-config/validation.d.ts +49 -0
  25. package/dist/app-config/validation.js +538 -0
  26. package/dist/capabilities/capabilities.d.ts +48 -0
  27. package/dist/capabilities/capabilities.js +50 -0
  28. package/dist/capabilities/docs/capabilities.docblock.d.ts +6 -0
  29. package/dist/capabilities/docs/capabilities.docblock.js +21 -0
  30. package/dist/capabilities/index.d.ts +3 -0
  31. package/dist/capabilities/index.js +4 -0
  32. package/dist/capabilities/openbanking.d.ts +10 -0
  33. package/dist/capabilities/openbanking.js +92 -0
  34. package/dist/client/index.d.ts +6 -0
  35. package/dist/client/index.js +9 -0
  36. package/dist/client/react/drivers/rn-reusables.d.ts +22 -0
  37. package/dist/client/react/drivers/rn-reusables.js +21 -0
  38. package/dist/client/react/drivers/shadcn.d.ts +12 -0
  39. package/dist/client/react/drivers/shadcn.js +11 -0
  40. package/dist/client/react/feature-render.d.ts +23 -0
  41. package/dist/client/react/feature-render.js +44 -0
  42. package/dist/client/react/form-render.d.ts +92 -0
  43. package/dist/client/react/form-render.js +298 -0
  44. package/dist/client/react/index.d.ts +5 -0
  45. package/dist/client/react/index.js +8 -0
  46. package/dist/contract-registry/index.d.ts +3 -0
  47. package/dist/contract-registry/index.js +3 -0
  48. package/dist/contract-registry/schemas.d.ts +124 -0
  49. package/dist/contract-registry/schemas.js +61 -0
  50. package/dist/contract-registry/types.d.ts +46 -0
  51. package/dist/contract-registry/types.js +0 -0
  52. package/dist/data-views/data-views.d.ts +5 -0
  53. package/dist/data-views/data-views.js +4 -0
  54. package/dist/data-views/docs/data-views.docblock.d.ts +6 -0
  55. package/dist/data-views/docs/data-views.docblock.js +21 -0
  56. package/dist/data-views/index.d.ts +4 -0
  57. package/dist/data-views/index.js +4 -0
  58. package/dist/data-views/query-generator.d.ts +40 -0
  59. package/dist/data-views/query-generator.js +48 -0
  60. package/dist/data-views/registry.d.ts +51 -0
  61. package/dist/data-views/registry.js +82 -0
  62. package/dist/data-views/runtime.d.ts +28 -0
  63. package/dist/data-views/runtime.js +39 -0
  64. package/dist/data-views/spec.d.ts +32 -0
  65. package/dist/data-views/spec.js +10 -0
  66. package/dist/data-views/types.d.ts +157 -0
  67. package/dist/data-views/types.js +0 -0
  68. package/dist/docs/accessibility_wcag_compliance_specs.docblock.d.ts +6 -0
  69. package/dist/docs/accessibility_wcag_compliance_specs.docblock.js +17 -0
  70. package/dist/docs/index.d.ts +6 -0
  71. package/dist/docs/index.js +29 -0
  72. package/dist/docs/meta.docs.d.ts +6 -0
  73. package/dist/docs/meta.docs.js +29 -0
  74. package/dist/docs/presentations.d.ts +33 -0
  75. package/dist/docs/presentations.js +64 -0
  76. package/dist/docs/registry.d.ts +23 -0
  77. package/dist/docs/registry.js +51 -0
  78. package/dist/docs/tech/auth/better-auth-nextjs.docblock.d.ts +6 -0
  79. package/dist/docs/tech/auth/better-auth-nextjs.docblock.js +81 -0
  80. package/dist/docs/tech/contracts/README.docblock.d.ts +6 -0
  81. package/dist/docs/tech/contracts/README.docblock.js +21 -0
  82. package/dist/docs/tech/contracts/create-subscription.docblock.d.ts +6 -0
  83. package/dist/docs/tech/contracts/create-subscription.docblock.js +21 -0
  84. package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.d.ts +6 -0
  85. package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.js +21 -0
  86. package/dist/docs/tech/contracts/migrations.docblock.d.ts +6 -0
  87. package/dist/docs/tech/contracts/migrations.docblock.js +21 -0
  88. package/dist/docs/tech/contracts/openapi-export.docblock.d.ts +6 -0
  89. package/dist/docs/tech/contracts/openapi-export.docblock.js +58 -0
  90. package/dist/docs/tech/contracts/openapi-import.docblock.d.ts +6 -0
  91. package/dist/docs/tech/contracts/openapi-import.docblock.js +65 -0
  92. package/dist/docs/tech/contracts/ops-to-presentation-linking.docblock.d.ts +6 -0
  93. package/dist/docs/tech/contracts/ops-to-presentation-linking.docblock.js +21 -0
  94. package/dist/docs/tech/contracts/overlays.docblock.d.ts +6 -0
  95. package/dist/docs/tech/contracts/overlays.docblock.js +21 -0
  96. package/dist/docs/tech/contracts/tests.docblock.d.ts +6 -0
  97. package/dist/docs/tech/contracts/tests.docblock.js +21 -0
  98. package/dist/docs/tech/contracts/themes.docblock.d.ts +6 -0
  99. package/dist/docs/tech/contracts/themes.docblock.js +21 -0
  100. package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.d.ts +6 -0
  101. package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.js +21 -0
  102. package/dist/docs/tech/lifecycle-stage-system.docblock.d.ts +6 -0
  103. package/dist/docs/tech/lifecycle-stage-system.docblock.js +17 -0
  104. package/dist/docs/tech/llm/llm-integration.docblock.d.ts +7 -0
  105. package/dist/docs/tech/llm/llm-integration.docblock.js +358 -0
  106. package/dist/docs/tech/mcp-endpoints.docblock.d.ts +6 -0
  107. package/dist/docs/tech/mcp-endpoints.docblock.js +38 -0
  108. package/dist/docs/tech/presentation-runtime.docblock.d.ts +6 -0
  109. package/dist/docs/tech/presentation-runtime.docblock.js +17 -0
  110. package/dist/docs/tech/schema/README.docblock.d.ts +6 -0
  111. package/dist/docs/tech/schema/README.docblock.js +21 -0
  112. package/dist/docs/tech/studio/learning-events.docblock.d.ts +6 -0
  113. package/dist/docs/tech/studio/learning-events.docblock.js +49 -0
  114. package/dist/docs/tech/studio/learning-journeys.docblock.d.ts +6 -0
  115. package/dist/docs/tech/studio/learning-journeys.docblock.js +80 -0
  116. package/dist/docs/tech/studio/platform-admin-panel.docblock.d.ts +6 -0
  117. package/dist/docs/tech/studio/platform-admin-panel.docblock.js +85 -0
  118. package/dist/docs/tech/studio/project-access-teams.docblock.d.ts +6 -0
  119. package/dist/docs/tech/studio/project-access-teams.docblock.js +46 -0
  120. package/dist/docs/tech/studio/project-routing.docblock.d.ts +6 -0
  121. package/dist/docs/tech/studio/project-routing.docblock.js +68 -0
  122. package/dist/docs/tech/studio/sandbox-unlogged.docblock.d.ts +6 -0
  123. package/dist/docs/tech/studio/sandbox-unlogged.docblock.js +41 -0
  124. package/dist/docs/tech/studio/team-invitations.docblock.d.ts +6 -0
  125. package/dist/docs/tech/studio/team-invitations.docblock.js +70 -0
  126. package/dist/docs/tech/studio/workspace-ops.docblock.d.ts +6 -0
  127. package/dist/docs/tech/studio/workspace-ops.docblock.js +48 -0
  128. package/dist/docs/tech/studio/workspaces.docblock.d.ts +6 -0
  129. package/dist/docs/tech/studio/workspaces.docblock.js +63 -0
  130. package/dist/docs/tech/telemetry-ingest.docblock.d.ts +6 -0
  131. package/dist/docs/tech/telemetry-ingest.docblock.js +156 -0
  132. package/dist/docs/tech/templates/runtime.docblock.d.ts +6 -0
  133. package/dist/docs/tech/templates/runtime.docblock.js +21 -0
  134. package/dist/docs/tech/vscode-extension.docblock.d.ts +6 -0
  135. package/dist/docs/tech/vscode-extension.docblock.js +102 -0
  136. package/dist/docs/tech-contracts.docs.d.ts +6 -0
  137. package/dist/docs/tech-contracts.docs.js +96 -0
  138. package/dist/docs/types.d.ts +41 -0
  139. package/dist/docs/types.js +0 -0
  140. package/dist/events.d.ts +47 -0
  141. package/dist/events.js +19 -0
  142. package/dist/experiments/docs/experiments.docblock.d.ts +6 -0
  143. package/dist/experiments/docs/experiments.docblock.js +21 -0
  144. package/dist/experiments/evaluator.d.ts +37 -0
  145. package/dist/experiments/evaluator.js +101 -0
  146. package/dist/experiments/spec-resolver.d.ts +17 -0
  147. package/dist/experiments/spec-resolver.js +0 -0
  148. package/dist/experiments/spec.d.ts +82 -0
  149. package/dist/experiments/spec.js +33 -0
  150. package/dist/features/index.d.ts +5 -0
  151. package/dist/features/index.js +5 -0
  152. package/dist/features/install.d.ts +22 -0
  153. package/dist/features/install.js +36 -0
  154. package/dist/features/registry.d.ts +26 -0
  155. package/dist/features/registry.js +49 -0
  156. package/dist/features/types.d.ts +88 -0
  157. package/dist/features/types.js +0 -0
  158. package/dist/features/validation.d.ts +8 -0
  159. package/dist/features/validation.js +14 -0
  160. package/dist/forms/docs/forms.docblock.d.ts +6 -0
  161. package/dist/forms/docs/forms.docblock.js +21 -0
  162. package/dist/forms/forms.d.ts +266 -0
  163. package/dist/forms/forms.js +146 -0
  164. package/dist/forms/index.d.ts +2 -0
  165. package/dist/forms/index.js +3 -0
  166. package/dist/index.d.ts +147 -0
  167. package/dist/index.js +121 -0
  168. package/dist/install.d.ts +77 -0
  169. package/dist/install.js +40 -0
  170. package/dist/integrations/binding.d.ts +17 -0
  171. package/dist/integrations/binding.js +0 -0
  172. package/dist/integrations/connection.d.ts +51 -0
  173. package/dist/integrations/connection.js +0 -0
  174. package/dist/integrations/docs/integrations.docblock.d.ts +6 -0
  175. package/dist/integrations/docs/integrations.docblock.js +94 -0
  176. package/dist/integrations/health.d.ts +21 -0
  177. package/dist/integrations/health.js +69 -0
  178. package/dist/integrations/index.d.ts +34 -0
  179. package/dist/integrations/index.js +23 -0
  180. package/dist/integrations/integrations.feature.d.ts +12 -0
  181. package/dist/integrations/integrations.feature.js +60 -0
  182. package/dist/integrations/openbanking/contracts/accounts.d.ts +289 -0
  183. package/dist/integrations/openbanking/contracts/accounts.js +236 -0
  184. package/dist/integrations/openbanking/contracts/balances.d.ts +165 -0
  185. package/dist/integrations/openbanking/contracts/balances.js +166 -0
  186. package/dist/integrations/openbanking/contracts/index.d.ts +10 -0
  187. package/dist/integrations/openbanking/contracts/index.js +12 -0
  188. package/dist/integrations/openbanking/contracts/transactions.d.ts +213 -0
  189. package/dist/integrations/openbanking/contracts/transactions.js +217 -0
  190. package/dist/integrations/openbanking/guards.d.ts +12 -0
  191. package/dist/integrations/openbanking/guards.js +33 -0
  192. package/dist/integrations/openbanking/models.d.ts +228 -0
  193. package/dist/integrations/openbanking/models.js +240 -0
  194. package/dist/integrations/openbanking/openbanking.feature.d.ts +12 -0
  195. package/dist/integrations/openbanking/openbanking.feature.js +69 -0
  196. package/dist/integrations/openbanking/telemetry.d.ts +15 -0
  197. package/dist/integrations/openbanking/telemetry.js +39 -0
  198. package/dist/integrations/operations.d.ts +437 -0
  199. package/dist/integrations/operations.js +392 -0
  200. package/dist/integrations/providers/calendar.d.ts +78 -0
  201. package/dist/integrations/providers/calendar.js +0 -0
  202. package/dist/integrations/providers/elevenlabs.d.ts +7 -0
  203. package/dist/integrations/providers/elevenlabs.js +55 -0
  204. package/dist/integrations/providers/email.d.ts +86 -0
  205. package/dist/integrations/providers/email.js +0 -0
  206. package/dist/integrations/providers/embedding.d.ts +24 -0
  207. package/dist/integrations/providers/embedding.js +0 -0
  208. package/dist/integrations/providers/gcs-storage.d.ts +7 -0
  209. package/dist/integrations/providers/gcs-storage.js +78 -0
  210. package/dist/integrations/providers/gmail.d.ts +7 -0
  211. package/dist/integrations/providers/gmail.js +90 -0
  212. package/dist/integrations/providers/google-calendar.d.ts +7 -0
  213. package/dist/integrations/providers/google-calendar.js +69 -0
  214. package/dist/integrations/providers/impls/elevenlabs-voice.d.ts +20 -0
  215. package/dist/integrations/providers/impls/elevenlabs-voice.js +95 -0
  216. package/dist/integrations/providers/impls/gcs-storage.d.ts +24 -0
  217. package/dist/integrations/providers/impls/gcs-storage.js +88 -0
  218. package/dist/integrations/providers/impls/gmail-inbound.d.ts +26 -0
  219. package/dist/integrations/providers/impls/gmail-inbound.js +200 -0
  220. package/dist/integrations/providers/impls/gmail-outbound.d.ts +18 -0
  221. package/dist/integrations/providers/impls/gmail-outbound.js +105 -0
  222. package/dist/integrations/providers/impls/google-calendar.d.ts +23 -0
  223. package/dist/integrations/providers/impls/google-calendar.js +154 -0
  224. package/dist/integrations/providers/impls/index.d.ts +15 -0
  225. package/dist/integrations/providers/impls/index.js +16 -0
  226. package/dist/integrations/providers/impls/mistral-embedding.d.ts +23 -0
  227. package/dist/integrations/providers/impls/mistral-embedding.js +41 -0
  228. package/dist/integrations/providers/impls/mistral-llm.d.ts +31 -0
  229. package/dist/integrations/providers/impls/mistral-llm.js +247 -0
  230. package/dist/integrations/providers/impls/postmark-email.d.ts +19 -0
  231. package/dist/integrations/providers/impls/postmark-email.js +55 -0
  232. package/dist/integrations/providers/impls/powens-client.d.ts +124 -0
  233. package/dist/integrations/providers/impls/powens-client.js +171 -0
  234. package/dist/integrations/providers/impls/powens-openbanking.d.ts +27 -0
  235. package/dist/integrations/providers/impls/powens-openbanking.js +218 -0
  236. package/dist/integrations/providers/impls/provider-factory.d.ts +26 -0
  237. package/dist/integrations/providers/impls/provider-factory.js +145 -0
  238. package/dist/integrations/providers/impls/qdrant-vector.d.ts +24 -0
  239. package/dist/integrations/providers/impls/qdrant-vector.js +69 -0
  240. package/dist/integrations/providers/impls/stripe-payments.d.ts +28 -0
  241. package/dist/integrations/providers/impls/stripe-payments.js +202 -0
  242. package/dist/integrations/providers/impls/twilio-sms.d.ts +20 -0
  243. package/dist/integrations/providers/impls/twilio-sms.js +58 -0
  244. package/dist/integrations/providers/index.d.ts +22 -0
  245. package/dist/integrations/providers/index.js +13 -0
  246. package/dist/integrations/providers/llm.d.ts +82 -0
  247. package/dist/integrations/providers/llm.js +0 -0
  248. package/dist/integrations/providers/mistral.d.ts +7 -0
  249. package/dist/integrations/providers/mistral.js +71 -0
  250. package/dist/integrations/providers/openbanking.d.ts +128 -0
  251. package/dist/integrations/providers/openbanking.js +0 -0
  252. package/dist/integrations/providers/payments.d.ts +109 -0
  253. package/dist/integrations/providers/payments.js +0 -0
  254. package/dist/integrations/providers/postmark.d.ts +7 -0
  255. package/dist/integrations/providers/postmark.js +71 -0
  256. package/dist/integrations/providers/powens.d.ts +7 -0
  257. package/dist/integrations/providers/powens.js +119 -0
  258. package/dist/integrations/providers/qdrant.d.ts +7 -0
  259. package/dist/integrations/providers/qdrant.js +76 -0
  260. package/dist/integrations/providers/registry.d.ts +11 -0
  261. package/dist/integrations/providers/registry.js +34 -0
  262. package/dist/integrations/providers/sms.d.ts +34 -0
  263. package/dist/integrations/providers/sms.js +0 -0
  264. package/dist/integrations/providers/storage.d.ts +60 -0
  265. package/dist/integrations/providers/storage.js +0 -0
  266. package/dist/integrations/providers/stripe.d.ts +7 -0
  267. package/dist/integrations/providers/stripe.js +86 -0
  268. package/dist/integrations/providers/twilio-sms.d.ts +7 -0
  269. package/dist/integrations/providers/twilio-sms.js +64 -0
  270. package/dist/integrations/providers/vector-store.d.ts +43 -0
  271. package/dist/integrations/providers/vector-store.js +0 -0
  272. package/dist/integrations/providers/voice.d.ts +34 -0
  273. package/dist/integrations/providers/voice.js +0 -0
  274. package/dist/integrations/runtime.d.ts +99 -0
  275. package/dist/integrations/runtime.js +186 -0
  276. package/dist/integrations/secrets/aws-secret-manager.d.ts +31 -0
  277. package/dist/integrations/secrets/aws-secret-manager.js +231 -0
  278. package/dist/integrations/secrets/env-secret-provider.d.ts +31 -0
  279. package/dist/integrations/secrets/env-secret-provider.js +81 -0
  280. package/dist/integrations/secrets/gcp-secret-manager.d.ts +32 -0
  281. package/dist/integrations/secrets/gcp-secret-manager.js +229 -0
  282. package/dist/integrations/secrets/index.d.ts +7 -0
  283. package/dist/integrations/secrets/index.js +8 -0
  284. package/dist/integrations/secrets/manager.d.ts +47 -0
  285. package/dist/integrations/secrets/manager.js +103 -0
  286. package/dist/integrations/secrets/provider.d.ts +52 -0
  287. package/dist/integrations/secrets/provider.js +58 -0
  288. package/dist/integrations/secrets/scaleway-secret-manager.d.ts +38 -0
  289. package/dist/integrations/secrets/scaleway-secret-manager.js +247 -0
  290. package/dist/integrations/secrets-types.d.ts +17 -0
  291. package/dist/integrations/secrets-types.js +0 -0
  292. package/dist/integrations/spec.d.ts +75 -0
  293. package/dist/integrations/spec.js +39 -0
  294. package/dist/jobs/define-job.d.ts +18 -0
  295. package/dist/jobs/define-job.js +16 -0
  296. package/dist/jobs/gcp-cloud-tasks.d.ts +41 -0
  297. package/dist/jobs/gcp-cloud-tasks.js +53 -0
  298. package/dist/jobs/gcp-pubsub.d.ts +25 -0
  299. package/dist/jobs/gcp-pubsub.js +39 -0
  300. package/dist/jobs/handlers/gmail-sync-handler.d.ts +9 -0
  301. package/dist/jobs/handlers/gmail-sync-handler.js +9 -0
  302. package/dist/jobs/handlers/index.d.ts +9 -0
  303. package/dist/jobs/handlers/index.js +12 -0
  304. package/dist/jobs/handlers/ping-handler.d.ts +10 -0
  305. package/dist/jobs/handlers/ping-handler.js +15 -0
  306. package/dist/jobs/handlers/storage-document-handler.d.ts +12 -0
  307. package/dist/jobs/handlers/storage-document-handler.js +14 -0
  308. package/dist/jobs/index.d.ts +3 -0
  309. package/dist/jobs/index.js +4 -0
  310. package/dist/jobs/memory-queue.d.ts +18 -0
  311. package/dist/jobs/memory-queue.js +71 -0
  312. package/dist/jobs/queue.d.ts +131 -0
  313. package/dist/jobs/queue.js +33 -0
  314. package/dist/jobs/scaleway-sqs-queue.d.ts +30 -0
  315. package/dist/jobs/scaleway-sqs-queue.js +153 -0
  316. package/dist/jsonschema.d.ts +27 -0
  317. package/dist/jsonschema.js +32 -0
  318. package/dist/knowledge/binding.d.ts +25 -0
  319. package/dist/knowledge/binding.js +0 -0
  320. package/dist/knowledge/docs/knowledge.docblock.d.ts +6 -0
  321. package/dist/knowledge/docs/knowledge.docblock.js +21 -0
  322. package/dist/knowledge/index.d.ts +11 -0
  323. package/dist/knowledge/index.js +10 -0
  324. package/dist/knowledge/ingestion/document-processor.d.ts +24 -0
  325. package/dist/knowledge/ingestion/document-processor.js +54 -0
  326. package/dist/knowledge/ingestion/embedding-service.d.ts +12 -0
  327. package/dist/knowledge/ingestion/embedding-service.js +25 -0
  328. package/dist/knowledge/ingestion/gmail-adapter.d.ts +18 -0
  329. package/dist/knowledge/ingestion/gmail-adapter.js +51 -0
  330. package/dist/knowledge/ingestion/index.d.ts +6 -0
  331. package/dist/knowledge/ingestion/index.js +7 -0
  332. package/dist/knowledge/ingestion/storage-adapter.d.ts +15 -0
  333. package/dist/knowledge/ingestion/storage-adapter.js +26 -0
  334. package/dist/knowledge/ingestion/vector-indexer.d.ts +18 -0
  335. package/dist/knowledge/ingestion/vector-indexer.js +32 -0
  336. package/dist/knowledge/knowledge.feature.d.ts +12 -0
  337. package/dist/knowledge/knowledge.feature.js +61 -0
  338. package/dist/knowledge/operations.d.ts +318 -0
  339. package/dist/knowledge/operations.js +321 -0
  340. package/dist/knowledge/query/index.d.ts +2 -0
  341. package/dist/knowledge/query/index.js +3 -0
  342. package/dist/knowledge/query/service.d.ts +29 -0
  343. package/dist/knowledge/query/service.js +65 -0
  344. package/dist/knowledge/runtime.d.ts +32 -0
  345. package/dist/knowledge/runtime.js +49 -0
  346. package/dist/knowledge/source.d.ts +32 -0
  347. package/dist/knowledge/source.js +0 -0
  348. package/dist/knowledge/spaces/email-threads.d.ts +7 -0
  349. package/dist/knowledge/spaces/email-threads.js +37 -0
  350. package/dist/knowledge/spaces/financial-docs.d.ts +7 -0
  351. package/dist/knowledge/spaces/financial-docs.js +37 -0
  352. package/dist/knowledge/spaces/financial-overview.d.ts +7 -0
  353. package/dist/knowledge/spaces/financial-overview.js +41 -0
  354. package/dist/knowledge/spaces/index.d.ts +7 -0
  355. package/dist/knowledge/spaces/index.js +8 -0
  356. package/dist/knowledge/spaces/product-canon.d.ts +7 -0
  357. package/dist/knowledge/spaces/product-canon.js +37 -0
  358. package/dist/knowledge/spaces/support-faq.d.ts +7 -0
  359. package/dist/knowledge/spaces/support-faq.js +40 -0
  360. package/dist/knowledge/spaces/uploaded-docs.d.ts +7 -0
  361. package/dist/knowledge/spaces/uploaded-docs.js +37 -0
  362. package/dist/knowledge/spec.d.ts +48 -0
  363. package/dist/knowledge/spec.js +39 -0
  364. package/dist/llm/exporters.d.ts +70 -0
  365. package/dist/llm/exporters.js +542 -0
  366. package/dist/llm/index.d.ts +4 -0
  367. package/dist/llm/index.js +4 -0
  368. package/dist/llm/prompts.d.ts +52 -0
  369. package/dist/llm/prompts.js +410 -0
  370. package/dist/llm/types.d.ts +215 -0
  371. package/dist/llm/types.js +0 -0
  372. package/dist/markdown.d.ts +22 -0
  373. package/dist/markdown.js +119 -0
  374. package/dist/migrations.d.ts +52 -0
  375. package/dist/migrations.js +33 -0
  376. package/dist/model-registry.d.ts +13 -0
  377. package/dist/model-registry.js +33 -0
  378. package/dist/onboarding-base.d.ts +138 -0
  379. package/dist/onboarding-base.js +195 -0
  380. package/dist/openapi.d.ts +31 -0
  381. package/dist/openapi.js +75 -0
  382. package/dist/operations/index.d.ts +3 -0
  383. package/dist/operations/index.js +4 -0
  384. package/dist/operations/operation.d.ts +186 -0
  385. package/dist/operations/operation.js +35 -0
  386. package/dist/operations/registry.d.ts +103 -0
  387. package/dist/operations/registry.js +252 -0
  388. package/dist/ownership.d.ts +84 -0
  389. package/dist/ownership.js +38 -0
  390. package/dist/policy/docs/policy.docblock.d.ts +6 -0
  391. package/dist/policy/docs/policy.docblock.js +21 -0
  392. package/dist/policy/engine.d.ts +40 -0
  393. package/dist/policy/engine.js +223 -0
  394. package/dist/policy/index.d.ts +5 -0
  395. package/dist/policy/index.js +5 -0
  396. package/dist/policy/opa-adapter.d.ts +45 -0
  397. package/dist/policy/opa-adapter.js +71 -0
  398. package/dist/policy/registry.d.ts +9 -0
  399. package/dist/policy/registry.js +11 -0
  400. package/dist/policy/spec.d.ts +103 -0
  401. package/dist/policy/spec.js +0 -0
  402. package/dist/presentations/docs/presentations-conventions.docblock.d.ts +6 -0
  403. package/dist/presentations/docs/presentations-conventions.docblock.js +21 -0
  404. package/dist/presentations/index.d.ts +4 -0
  405. package/dist/presentations/index.js +5 -0
  406. package/dist/presentations/presentations.d.ts +50 -0
  407. package/dist/presentations/presentations.js +7 -0
  408. package/dist/presentations/registry.d.ts +10 -0
  409. package/dist/presentations/registry.js +12 -0
  410. package/dist/presentations/transform-engine.d.ts +66 -0
  411. package/dist/presentations/transform-engine.js +282 -0
  412. package/dist/prompt.d.ts +60 -0
  413. package/dist/prompt.js +10 -0
  414. package/dist/promptRegistry.d.ts +15 -0
  415. package/dist/promptRegistry.js +34 -0
  416. package/dist/regenerator/adapters.d.ts +19 -0
  417. package/dist/regenerator/adapters.js +0 -0
  418. package/dist/regenerator/docs/regenerator.docblock.d.ts +6 -0
  419. package/dist/regenerator/docs/regenerator.docblock.js +21 -0
  420. package/dist/regenerator/executor.d.ts +70 -0
  421. package/dist/regenerator/executor.js +86 -0
  422. package/dist/regenerator/index.d.ts +7 -0
  423. package/dist/regenerator/index.js +6 -0
  424. package/dist/regenerator/service.d.ts +33 -0
  425. package/dist/regenerator/service.js +93 -0
  426. package/dist/regenerator/sinks.d.ts +26 -0
  427. package/dist/regenerator/sinks.js +32 -0
  428. package/dist/regenerator/types.d.ts +107 -0
  429. package/dist/regenerator/types.js +0 -0
  430. package/dist/regenerator/utils.d.ts +9 -0
  431. package/dist/regenerator/utils.js +51 -0
  432. package/dist/registry-utils.d.ts +106 -0
  433. package/dist/registry-utils.js +122 -0
  434. package/dist/registry.d.ts +31 -0
  435. package/dist/registry.js +61 -0
  436. package/dist/resources.d.ts +64 -0
  437. package/dist/resources.js +50 -0
  438. package/dist/schema-to-markdown.d.ts +54 -0
  439. package/dist/schema-to-markdown.js +217 -0
  440. package/dist/server/contracts-adapter-hydration.d.ts +15 -0
  441. package/dist/server/contracts-adapter-hydration.js +41 -0
  442. package/dist/server/contracts-adapter-input.d.ts +9 -0
  443. package/dist/server/contracts-adapter-input.js +83 -0
  444. package/dist/server/graphql-pothos.d.ts +31 -0
  445. package/dist/server/graphql-pothos.js +134 -0
  446. package/dist/server/index.d.ts +9 -0
  447. package/dist/server/index.js +10 -0
  448. package/dist/server/mcp/createMcpServer.d.ts +15 -0
  449. package/dist/server/mcp/createMcpServer.js +27 -0
  450. package/dist/server/mcp/mcpTypes.d.ts +27 -0
  451. package/dist/server/mcp/mcpTypes.js +0 -0
  452. package/dist/server/mcp/registerPresentations.d.ts +7 -0
  453. package/dist/server/mcp/registerPresentations.js +63 -0
  454. package/dist/server/mcp/registerPrompts.d.ts +8 -0
  455. package/dist/server/mcp/registerPrompts.js +37 -0
  456. package/dist/server/mcp/registerResources.d.ts +8 -0
  457. package/dist/server/mcp/registerResources.js +35 -0
  458. package/dist/server/mcp/registerTools.d.ts +8 -0
  459. package/dist/server/mcp/registerTools.js +22 -0
  460. package/dist/server/provider-mcp.d.ts +2 -0
  461. package/dist/server/provider-mcp.js +3 -0
  462. package/dist/server/rest-elysia.d.ts +40 -0
  463. package/dist/server/rest-elysia.js +20 -0
  464. package/dist/server/rest-express.d.ts +16 -0
  465. package/dist/server/rest-express.js +36 -0
  466. package/dist/server/rest-generic.d.ts +32 -0
  467. package/dist/server/rest-generic.js +124 -0
  468. package/dist/server/rest-next-app.d.ts +35 -0
  469. package/dist/server/rest-next-app.js +38 -0
  470. package/dist/server/rest-next-mcp.d.ts +11 -0
  471. package/dist/server/rest-next-mcp.js +45 -0
  472. package/dist/server/rest-next-pages.d.ts +9 -0
  473. package/dist/server/rest-next-pages.js +22 -0
  474. package/dist/telemetry/anomaly.d.ts +27 -0
  475. package/dist/telemetry/anomaly.js +48 -0
  476. package/dist/telemetry/docs/telemetry.docblock.d.ts +6 -0
  477. package/dist/telemetry/docs/telemetry.docblock.js +21 -0
  478. package/dist/telemetry/index.d.ts +4 -0
  479. package/dist/telemetry/index.js +5 -0
  480. package/dist/telemetry/spec.d.ts +91 -0
  481. package/dist/telemetry/spec.js +69 -0
  482. package/dist/telemetry/tracker.d.ts +51 -0
  483. package/dist/telemetry/tracker.js +76 -0
  484. package/dist/tests/index.d.ts +3 -0
  485. package/dist/tests/index.js +4 -0
  486. package/dist/tests/runner.d.ts +43 -0
  487. package/dist/tests/runner.js +150 -0
  488. package/dist/tests/spec.d.ts +81 -0
  489. package/dist/tests/spec.js +33 -0
  490. package/dist/themes.d.ts +53 -0
  491. package/dist/themes.js +39 -0
  492. package/dist/translations/catalog.d.ts +28 -0
  493. package/dist/translations/catalog.js +0 -0
  494. package/dist/translations/tenant.d.ts +15 -0
  495. package/dist/translations/tenant.js +0 -0
  496. package/dist/types.d.ts +92 -0
  497. package/dist/types.js +0 -0
  498. package/dist/workflow/adapters/db-adapter.d.ts +46 -0
  499. package/dist/workflow/adapters/db-adapter.js +83 -0
  500. package/dist/workflow/adapters/file-adapter.d.ts +14 -0
  501. package/dist/workflow/adapters/file-adapter.js +11 -0
  502. package/dist/workflow/adapters/index.d.ts +4 -0
  503. package/dist/workflow/adapters/index.js +5 -0
  504. package/dist/workflow/adapters/memory-store.d.ts +18 -0
  505. package/dist/workflow/adapters/memory-store.js +58 -0
  506. package/dist/workflow/expression.d.ts +9 -0
  507. package/dist/workflow/expression.js +99 -0
  508. package/dist/workflow/index.d.ts +10 -0
  509. package/dist/workflow/index.js +9 -0
  510. package/dist/workflow/overview.docblock.d.ts +6 -0
  511. package/dist/workflow/overview.docblock.js +21 -0
  512. package/dist/workflow/runner.d.ts +75 -0
  513. package/dist/workflow/runner.js +337 -0
  514. package/dist/workflow/sla-monitor.d.ts +20 -0
  515. package/dist/workflow/sla-monitor.js +47 -0
  516. package/dist/workflow/spec.d.ts +106 -0
  517. package/dist/workflow/spec.js +55 -0
  518. package/dist/workflow/state.d.ts +35 -0
  519. package/dist/workflow/state.js +0 -0
  520. package/dist/workflow/validation.d.ts +29 -0
  521. package/dist/workflow/validation.js +176 -0
  522. package/dist/workspace-config/contractsrc-schema.d.ts +862 -0
  523. package/dist/workspace-config/contractsrc-schema.js +281 -0
  524. package/dist/workspace-config/index.d.ts +2 -0
  525. package/dist/workspace-config/index.js +3 -0
  526. package/dist/workspace-config/workspace-config.docblock.d.ts +6 -0
  527. package/dist/workspace-config/workspace-config.docblock.js +45 -0
  528. package/package.json +598 -0
@@ -0,0 +1,157 @@
1
+ import { OwnerShipMeta } from "../ownership.js";
2
+ import { EventRef, OpRef, PresentationRef } from "../features/types.js";
3
+ import "../features/index.js";
4
+
5
+ //#region src/data-views/types.d.ts
6
+ /**
7
+ * Supported data view kinds.
8
+ */
9
+ type DataViewKind = 'list' | 'detail' | 'table' | 'grid';
10
+ /**
11
+ * Metadata for a data view spec.
12
+ */
13
+ interface DataViewMeta extends OwnerShipMeta {
14
+ /** Canonical entity slug (e.g., "space", "resident"). */
15
+ entity: string;
16
+ }
17
+ /**
18
+ * Source configuration for fetching data in a data view.
19
+ */
20
+ interface DataViewSource {
21
+ /** Primary query used to fetch items for this view. */
22
+ primary: OpRef;
23
+ /** Optional operation used to fetch a single item (detail views). */
24
+ item?: OpRef;
25
+ /** Optional record mutation operations (used for inline editing or actions). */
26
+ mutations?: {
27
+ create?: OpRef;
28
+ update?: OpRef;
29
+ delete?: OpRef;
30
+ };
31
+ /** Events that should trigger refresh when emitted. */
32
+ refreshEvents?: EventRef[];
33
+ }
34
+ /**
35
+ * Display formatting hints for data view fields.
36
+ */
37
+ type DataViewFieldFormat = 'text' | 'number' | 'currency' | 'percentage' | 'date' | 'dateTime' | 'boolean' | 'badge';
38
+ /**
39
+ * Field definition within a data view.
40
+ */
41
+ interface DataViewField {
42
+ /** Unique identifier for the field within the view. */
43
+ key: string;
44
+ /** Human-friendly label for headers/tooltips. */
45
+ label: string;
46
+ /** Dot-path into the data item (e.g., "address.city"). */
47
+ dataPath: string;
48
+ /** Optional description surfaced in tooltips or docs. */
49
+ description?: string;
50
+ /** Optional formatting hint for renderers. */
51
+ format?: DataViewFieldFormat;
52
+ /** When true, the field can be used for sorting. */
53
+ sortable?: boolean;
54
+ /** When true, the field can be used for filtering. */
55
+ filterable?: boolean;
56
+ /** Optional width hint for table layouts. */
57
+ width?: 'auto' | 'xs' | 'sm' | 'md' | 'lg';
58
+ /** Optional presentation override (e.g., card component). */
59
+ presentation?: PresentationRef;
60
+ }
61
+ /**
62
+ * Filter definition for a data view.
63
+ */
64
+ interface DataViewFilter {
65
+ key: string;
66
+ label: string;
67
+ field: string;
68
+ type: 'search' | 'enum' | 'number' | 'date' | 'boolean';
69
+ options?: {
70
+ value: string;
71
+ label: string;
72
+ }[];
73
+ }
74
+ /**
75
+ * Action that can be triggered from a data view.
76
+ */
77
+ interface DataViewAction {
78
+ key: string;
79
+ label: string;
80
+ kind: 'navigation' | 'operation';
81
+ /** Operation invoked when kind === 'operation'. */
82
+ operation?: OpRef;
83
+ /** Optional feature flag gating the action. */
84
+ requiresFlag?: string;
85
+ }
86
+ /**
87
+ * Section configuration for detail views.
88
+ */
89
+ interface DataViewSections {
90
+ title?: string;
91
+ description?: string;
92
+ fields: string[];
93
+ }
94
+ /**
95
+ * Base configuration shared by all data view kinds.
96
+ */
97
+ interface DataViewBaseConfig {
98
+ kind: DataViewKind;
99
+ fields: DataViewField[];
100
+ primaryField?: string;
101
+ secondaryFields?: string[];
102
+ filters?: DataViewFilter[];
103
+ actions?: DataViewAction[];
104
+ }
105
+ /**
106
+ * List view configuration.
107
+ */
108
+ interface DataViewListConfig extends DataViewBaseConfig {
109
+ kind: 'list';
110
+ layout?: 'card' | 'compact';
111
+ }
112
+ /**
113
+ * Detail view configuration.
114
+ */
115
+ interface DataViewDetailConfig extends DataViewBaseConfig {
116
+ kind: 'detail';
117
+ sections?: DataViewSections[];
118
+ }
119
+ /**
120
+ * Table column configuration.
121
+ */
122
+ interface DataViewTableColumn {
123
+ field: string;
124
+ label?: string;
125
+ width?: 'auto' | 'xs' | 'sm' | 'md' | 'lg';
126
+ align?: 'left' | 'center' | 'right';
127
+ }
128
+ /**
129
+ * Table view configuration.
130
+ */
131
+ interface DataViewTableConfig extends DataViewBaseConfig {
132
+ kind: 'table';
133
+ columns?: DataViewTableColumn[];
134
+ rowSelectable?: boolean;
135
+ density?: 'comfortable' | 'compact';
136
+ }
137
+ /**
138
+ * Grid view configuration.
139
+ */
140
+ interface DataViewGridConfig extends DataViewBaseConfig {
141
+ kind: 'grid';
142
+ columns?: number;
143
+ }
144
+ /**
145
+ * Union of all data view configurations.
146
+ */
147
+ type DataViewConfig = DataViewListConfig | DataViewDetailConfig | DataViewTableConfig | DataViewGridConfig;
148
+ /**
149
+ * Presentation references for different view states.
150
+ */
151
+ interface DataViewStates {
152
+ empty?: PresentationRef;
153
+ error?: PresentationRef;
154
+ loading?: PresentationRef;
155
+ }
156
+ //#endregion
157
+ export { DataViewAction, DataViewBaseConfig, DataViewConfig, DataViewDetailConfig, DataViewField, DataViewFieldFormat, DataViewFilter, DataViewGridConfig, DataViewKind, DataViewListConfig, DataViewMeta, DataViewSections, DataViewSource, DataViewStates, DataViewTableColumn, DataViewTableConfig };
File without changes
@@ -0,0 +1,6 @@
1
+ import { DocBlock } from "@contractspec/lib.contracts/docs";
2
+
3
+ //#region src/docs/accessibility_wcag_compliance_specs.docblock.d.ts
4
+ declare const accessibility_wcag_compliance_specs_DocBlocks: DocBlock[];
5
+ //#endregion
6
+ export { accessibility_wcag_compliance_specs_DocBlocks };
@@ -0,0 +1,17 @@
1
+ import { registerDocBlocks } from "./registry.js";
2
+
3
+ //#region src/docs/accessibility_wcag_compliance_specs.docblock.ts
4
+ const accessibility_wcag_compliance_specs_DocBlocks = [{
5
+ id: "docs.accessibility_wcag_compliance_specs",
6
+ title: "Accessibility & WCAG Compliance — **specs.md**",
7
+ summary: "> **Goal:** Ship interfaces that are usable by everyone, by default. This spec sets non‑negotiable rules, checklists, and CI gates to meet **WCAG\xA02.2 AA** (aim for AAA where low‑cost), align with **EN\xA0301\xA0549** (EU), and keep parity on **web (Next.js)** and **mobile (Expo/React\xA0Native)**.",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/accessibility_wcag_compliance_specs",
11
+ tags: ["accessibility_wcag_compliance_specs"],
12
+ body: "# Accessibility & WCAG Compliance — **specs.md**\n\n> **Goal:** Ship interfaces that are usable by everyone, by default. This spec sets non‑negotiable rules, checklists, and CI gates to meet **WCAG\xA02.2 AA** (aim for AAA where low‑cost), align with **EN\xA0301\xA0549** (EU), and keep parity on **web (Next.js)** and **mobile (Expo/React\xA0Native)**.\n\n---\n\n## 0) Scope & Principles\n\n- **Standards:** WCAG\xA02.2\xA0AA (incl. new 2.2 SCs: Focus Not Obscured, Focus Appearance, Target Size, Dragging Movements, Accessible Authentication, Redundant Entry). EN\xA0301\xA0549 compliance by conformance to WCAG.\n- **Principles:** Perceivable, Operable, Understandable, Robust (POUR).\n- **Rule of ARIA:** “No ARIA is better than bad ARIA.” Prefer native elements.\n- **Definition of Done (DoD):** No Critical/Major a11y issues in CI; keyboard complete; SR (screen reader) smoke test passed; contrasts pass; acceptance criteria below satisfied.\n- **Repo Alignment:** Web apps use **Radix Primitives + shadcn** wrappers centralized in `packages/lssm/libs/ui-kit-web`. Prefer those components over per‑app duplicates (`packages/*/apps/*/src/components/ui`). When missing, add to `ui-kit-web` first, then adopt app‑side.\n\n---\n\n## 1) Design Requirements (Design System & Tokens)\n\n**1.1 Color & Contrast**\n\n- Body text, icons essential to meaning: **≥\xA04.5:1**; large text (≥\xA018.66px regular / 14px bold): **≥\xA03:1**.\n- Interactive states (default/hover/active/disabled/focus) must maintain contrast **≥\xA03:1** against adjacent colors; text within components follows text ratios.\n- Provide light & dark themes with tokens that guarantee minimums. **Never rely solely on color** to convey meaning; pair with text, shape, or icon.\n\n**1.2 Focus Indicators (WCAG\xA02.4.11/12)**\n\n- Every interactive element has a **visible focus** with clear offset; indicator contrast **≥\xA03:1** vs adjacent colors and indicator **area ≥\xA02\xA0CSS\xA0px** thick.\n- Focus **must not be obscured** by sticky headers/footers or scroll containers.\n\n**1.3 Motion & Preferences**\n\n- Respect `prefers-reduced-motion`: suppress large parallax, auto‑animations; provide instant alternatives.\n- Avoid motion that could trigger vestibular issues; under PRM, use fade/scale under **150ms**.\n\n**1.4 Target Size (2.5.8)**\n\n- Hit areas **≥\xA024×24\xA0CSS\xA0px** (web) and **≥\xA044×44\xA0dp** (mobile) unless exempt.\n\n**1.5 Typography & Layout**\n\n- Support zoom to **400%** without loss of content/functionality; responsive reflow at **320\xA0CSS\xA0px** width.\n- Maintain clear heading hierarchy (h1…h6), one **h1** per view.\n\n- Repository baseline (Web): default body text uses Tailwind `text-lg` (≈18px). As of 2025‑09‑20, the repository bumped all Tailwind typography scale usages by +1 step (e.g., `text-sm`→`text-base`, `text-base`→`text-lg`, …, `text-8xl`→`text-9xl`). For long‑form content, default to `prose-lg`.\n- Do not use `text-xs` for body copy. Reserve `text-sm` only for non‑essential meta (timestamps, fine print) while ensuring contrast and touch targets remain compliant.\n- When increasing font size, ensure line height supports readability. Prefer Tailwind defaults or `leading-relaxed`/`leading-7` for body text where dense blocks appear.\n\n**1.6 Iconography & Imagery**\n\n- Decorative images: `alt=\"\"` or `aria-hidden=\"true\"`.\n- Informative images: concise, specific **alt**; complex charts require a **data table or long description**.\n\n---\n\n## 2) Content Requirements (UX Writing)\n\n- Links say **what happens** (avoid “click here”).\n- Buttons start with verbs; avoid ambiguous labels.\n- Form labels are **visible**; placeholders are **not labels**.\n- Error messages: human + programmatic association; avoid color‑only.\n- Authentication: allow **copy/paste**, password managers, and avoid cognitive tests alone (**3.3.7/3.3.8/3.3.9**).\n- Avoid CAPTCHAs that block users; if unavoidable, provide **multiple alternatives** (logic-free).\n\n---\n\n## 3) Engineering Requirements (Web — Next.js/React)\n\n> Use and extend `packages/lssm/libs/ui-kit-web` as the default UI surface. It wraps **Radix** primitives with sensible a11y defaults (focus rings, roles, keyboard, ARIA binding). When a gap exists, add it to `ui-kit-web` first.\n\n**3.1 Semantics & Landmarks**\n\n- Use native elements: `<button>`, `<a href>`, `<label for>`, `<fieldset>`, `<legend>`, `<table>`, etc.\n- Landmarks per page: `header`, `nav`, `main`, `aside`, `footer`. Provide a **Skip to main content** link.\n- Provide a **Route Announcer** (`aria-live=\"polite\"`) and move focus to page **h1** after navigation.\n\n**3.2 Keyboard**\n\n- All functionality available with keyboard alone. Tab order follows DOM/visual order; **no keyboard traps**.\n- Common bindings:\n - Space/Enter → activate button; Enter on link;\n - Esc closes dialogs/menus;\n - Arrow keys for lists/menus/tablists with **roving tabindex**.\n\n**3.3 Focus Management**\n\n- On route change (Next.js), move focus to the page `<h1>` or container and announce via a live region.\n- Dialogs/menus: **trap focus** inside; return focus to invoking control on close.\n- Don’t steal focus except after explicit user action.\n\n**3.4 Forms**\n\n- Each input has a `<label>` or `aria-label`. Group related inputs with `<fieldset><legend>`.\n- Associate errors via `aria-describedby` or inline IDs; announce with `role=\"alert\"` (assertive only for critical).\n- Provide **autocomplete** tokens for known fields; show **inline validation** and do not block on **onBlur** alone.\n\n**3.5 ARIA Usage**\n\n- Only when needed; match patterns (dialog, menu, combobox, tablist, listbox) per ARIA Authoring Practices.\n- Ensure **name/role/value** are programmatically determinable.\n\n**3.6 Media**\n\n- Videos: **captions**; provide **transcripts** for audio; audio descriptions for essential visual info.\n- No auto‑playing audio. Auto‑playing video must be muted and pausable; provide controls.\n\n**3.7 Tables & Data**\n\n- Use `<th scope>` for headers; captions via `<caption>`; announce sorting via `aria-sort`.\n- Provide CSV/JSON export where charts are primary.\n\n**3.8 Performance & Robustness**\n\n- Avoid content shifts that move focus; reserve space or use skeletons.\n- Maintain accessible names through hydration/SSR; avoid `dangerouslySetInnerHTML` where possible.\n\n**3.9 Next.js specifics**\n\n- Use `next/link` for navigation; ensure links are **links**, not buttons.\n- `next/image` must include **alt** (empty if decorative).\n- Announce route changes with a **global live region** and shift focus to the new view.\n\n**3.10 Accessibility library integration**\n\n- Import `@contractspec/lib.accessibility` at app root. It auto-imports its `styles.css` via the package entry; ensure bundlers keep CSS side effects. If your app tree-shakes CSS, explicitly import the stylesheet once in your root layout:\n\n```tsx\n// app/layout.tsx\nimport '@contractspec/lib.accessibility'; // includes tokens and provider exports\n// or if needed: import '@contractspec/lib.accessibility/src/styles.css';\n```\n\n- Wrap the app with `AccessibilityProvider` and include an element with `id=\"main\"` for the skip link target.\n\n---\n\n## 3b) lssm/ui-kit-web — Component Patterns & Defaults\n\n> Source: `packages/lssm/libs/ui-kit-web/ui/*`\n\n- **Button/Input/Textarea**: Built‑in `focus-visible` rings; ensure visible labels via `FormLabel` or `aria-label`.\n- **Form** (`form.tsx`): `FormControl` wires `aria-invalid` and `aria-describedby` to `FormMessage` and `FormDescription`. Prefer `FormMessage` for inline errors. Add `role=\"alert\"` only for critical.\n- **Dialog/Sheet/Dropdown**: Use Radix wrappers for focus‑trap and return‑focus. Provide `DialogTitle` + `DialogDescription` for name/description.\n- **Select/Combobox**: Prefer `SelectTrigger` with visible label; for icon‑only triggers, supply `aria-label`. Document examples in each app.\n- **Tabs**: Use `TabsList`, `TabsTrigger`, `TabsContent`; names are programmatically determinable.\n- **Toast/Toaster**: Prefer non‑blocking announcements; map critical to assertive region; include action buttons with clear labels.\n- **Table**: Use `TableCaption`; ensure `TableHead` cells use proper `scope`. Provide `aria-sort` on sortable headers.\n- **Utilities to add (repo action)**:\n - `SkipLink` component and pattern in layouts.\n - `RouteAnnouncer` (`aria-live=\"polite\"`) and **FocusOnRouteChange** helper.\n - `VisuallyHidden` wrapper (Radix visually-hidden or minimal utility).\n - `useReducedMotion` helper; honor in animated components.\n - Touch‑size variants (≥44×44) for interactive atoms.\n\n---\n\n## 4) Engineering Requirements (Mobile — Expo/React\xA0Native)\n\n- Set `accessibilityLabel`, `accessibilityHint`, and `accessibilityRole` on touchables.\n- Ensure **hit slop** / min size **≥\xA044×44\xA0dp**.\n- Support Dynamic Type / font scaling; no clipped text at **200%**.\n- Respect **Invert Colors** and **Reduce Motion**; avoid flashing.\n- Group related items with `accessibilityElements` ordering; hide decoration with `accessible={false}` or `importantForAccessibility=\"no-hide-descendants\"` when appropriate.\n- Test with **VoiceOver (iOS)** and **TalkBack (Android)**.\n\n---\n\n## 5) Component Patterns (Acceptance Rules)\n\n**Buttons & Links**\n\n- Use `<button>` for actions, `<a href>` for navigation. Provide disabled states that are perceivable beyond color.\n\n**Navigation**\n\n- Provide **Skip link**. One primary nav landmark. Indicate current page (`aria-current=\"page\"`).\n\n**Menus/Combobox/Autocomplete**\n\n- Follow ARIA patterns: focus moves into list; `aria-expanded`, `aria-controls`, `aria-activedescendant` when applicable; Esc closes; typing filters.\n\n**Modals/Dialogs**\n\n- `role=\"dialog\"` or `alertdialog` with **label**; focus trapped; background inert; Esc closes; return focus to trigger.\n\n**Tabs**\n\n- `role=\"tablist\"`; tabs are in the tab order; arrow keys switch focus; content is `role=\"tabpanel\"` with `aria-labelledby`.\n\n**Toasts/Notifications**\n\n- Non-critical: `aria-live=\"polite\"`; critical: `role=\"alert\"` sparingly.\n\n**Infinite Scroll / “Load More”**\n\n- Provide **Load more** control; announce new content to SR; preserve keyboard position.\n\n**Drag & Drop (2.5.7)**\n\n- Provide **non‑drag** alternative (e.g., move up/down buttons).\n\n**Charts & Maps**\n\n- Provide **table alternative** or textual summary; keyboard access to datapoints where interactive.\n\n---\n\n## 6) Testing & CI (Blocking Gates)\n\n**Static & Unit**\n\n- `eslint-plugin-jsx-a11y` — error on violations.\n- `jest-axe` — unit tests for components.\n\n**Automated Integration**\n\n- `axe-core` via Playwright or Cypress on critical flows.\n- `pa11y-ci` on key routes; threshold: **0 Critical / 0 Serious** to merge.\n- Lighthouse CI a11y score **≥\xA095** on target pages.\n\n**Manual QA (per release)**\n\n- **Keyboard patrol:** navigate primary flows without mouse.\n- **Screen reader smoke:** NVDA (Windows) or VoiceOver (macOS/iOS) across login, navigation, forms, dialogs.\n- **Zoom & Reflow:** 200–400% & 320\xA0px width.\n- **Color/Contrast check:** tokens in both themes.\n\n**Reporting**\n\n- A11y issues labeled: `a11y-blocker`, `a11y-bug`, `a11y-enhancement` with WCAG ref.\n\n---\n\n## 7) Repository‑Specific Adoption Plan\n\n- Centralize UI usage on `packages/lssm/libs/ui-kit-web` and de‑duplicate per‑app `components/ui` where feasible.\n- Introduce `SkipLink`, `RouteAnnouncer`, `FocusOnRouteChange`, and `VisuallyHidden` in `ui-kit-web`. Adopt in app layouts (`app/layout.tsx`) first.\n- Add `useReducedMotion` and wire into animated components (e.g., `drawer`, `tooltip`, `carousel`).\n- Add touch‑size variants to `Button`, `IconButton`, `TabsTrigger`, toggles.\n- Document Select label patterns and error association in Forms.\n\n---\n\n## 8) Code Snippets\n\n**Skip Link**\n\n```html\n<a\n class=\"sr-only focus:not-sr-only focus-visible:outline focus-visible:ring-4 focus-visible:ring-offset-2\"\n href=\"#main\"\n >Skip to main content</a\n>\n<main id=\"main\">…</main>\n```\n\n**Dialog (Radix + shadcn/ui) — essentials**\n\n```tsx\n// Ensure label, description, focus trap, and return focus on close remain intact\n<Dialog>\n <DialogTrigger asChild>\n <button aria-haspopup=\"dialog\">Open settings</button>\n </DialogTrigger>\n <DialogContent aria-describedby=\"settings-desc\">\n <DialogTitle>Settings</DialogTitle>\n <p id=\"settings-desc\">Update your preferences.</p>\n <DialogClose asChild>\n <button>Close</button>\n </DialogClose>\n </DialogContent>\n</Dialog>\n```\n\n**Form error association**\n\n```tsx\n<label htmlFor=\"email\">Email</label>\n<input id=\"email\" name=\"email\" type=\"email\" aria-describedby=\"email-err\" />\n<p id=\"email-err\" role=\"alert\">Enter a valid email.</p>\n```\n\n**Route change announcement (Next.js)**\n\n```tsx\n// Add once at app root\n<div\n aria-live=\"polite\"\n aria-atomic=\"true\"\n id=\"route-announcer\"\n className=\"sr-only\"\n/>\n```\n\n---\n\n## 9) Exceptions & Waivers\n\n- If a criterion cannot be met, file an issue with: context, attempted alternatives, WCAG reference, impact assessment, and a remediation date. **Temporary waivers only.**\n\n---\n\n## 10) Ownership\n\n- **Design:** maintains token contrast, component specs.\n- **Engineering:** enforces CI gates, implements patterns.\n- **QA:** runs manual checks per release.\n- **PM:** blocks release if AA not met on user‑visible flows.\n\n---\n\n## 11) References (internalize; no external dependency at runtime)\n\n- WCAG\xA02.2 (AA), EN\xA0301\xA0549. ARIA Authoring Practices. Platform HIG (Apple, Material).\n- `packages/lssm/libs/ui-kit-web` as the canonical UI source for web.\n\n> **Bottom line:** Shipping means **accessible by default**. We don’t trade a11y for speed; we bake it into speed.\n\n---\n\n## 12) Adoption Status (2025-09-23)\n\n- web-artisan: AccessibilityProvider integrated; sr-only/forced-colors applied; 44x44 targets; forms announce errors; jest-axe and cypress-axe in place.\n- web-strit: AccessibilityProvider integrated; forced-colors, sr-only; forms announce errors; 44x44 targets; contrast tokens and text-scale wired; jest-axe and cypress-axe in place.\n- web-coliving: AccessibilityProvider integrated; forced-colors and focus visibility added; text-scale wired; landing pages converted to `Section`/stacks with text-lg defaults; CTA capture standardized; ESLint guard for text-xs in main content; jest-axe and cypress-axe in place. Next: audit icon-only controls and ensure 44x44 targets; add role=\"alert\" where critical.\n\n> CI gates: run eslint a11y, jest-axe on components, and cypress-axe on critical flows per app.\n\n---\n\n## 13) CI Hardening & Visual QA\n\n- Linting: Run eslint with jsx-a11y rules across all web apps; block on violations.\n- Unit: Run jest-axe for ui-kit-web and app-level components.\n- Integration: cypress-axe on key flows (auth, forms, dialogs, tables).\n- Synthetic scans: pa11y-ci on critical pages (0 Critical/Serious policy).\n- Performance/A11y audit: Lighthouse CI with a11y score >= 95 on target routes.\n- Artifacts: Upload pa11y and Lighthouse reports per PR; annotate failures.\n\n### Recent additions (2025-09-26)\n\n- AutocompleteInput (groceries): Upgraded to ARIA combobox pattern with `aria-controls`, `aria-activedescendant`, `Escape`/`Tab` handling, and labelled listbox.\n- Cypress a11y tests added for furniture and incidents modules on `/modules` and operators flows; checks run axe with critical/serious impacts.\n\n## 14) Accessibility Telemetry (PostHog)\n\n- Events (anonymized): a11y_pref_changed (text_scale, contrast_mode, reduce_motion), a11y_panel_opened.\n- Properties: app, route, previous_value, new_value, timestamp.\n- Dashboards: Adoption over time, per app/route; correlation with reduced bounce on forms.\n- Privacy: No PII; aggregate only.\n"
13
+ }];
14
+ registerDocBlocks(accessibility_wcag_compliance_specs_DocBlocks);
15
+
16
+ //#endregion
17
+ export { accessibility_wcag_compliance_specs_DocBlocks };
@@ -0,0 +1,6 @@
1
+ import { DocBlock, DocBlockLink, DocKind, DocVisibility } from "./types.js";
2
+ import { DocPresentationOptions, DocPresentationRoute, docBlockToPresentationSpec, docBlockToPresentationV2, docBlocksToPresentationRoutes, docBlocksToPresentationSpecs, mapDocRoutes } from "./presentations.js";
3
+ import { DocId, DocRegistry, defaultDocRegistry, docId, listRegisteredDocBlocks, registerDocBlocks } from "./registry.js";
4
+ import { techContractsDocs } from "./tech-contracts.docs.js";
5
+ import { metaDocs } from "./meta.docs.js";
6
+ export { DocBlock, DocBlockLink, DocId, DocKind, DocPresentationOptions, DocPresentationRoute, DocRegistry, DocVisibility, defaultDocRegistry, docBlockToPresentationSpec, docBlockToPresentationV2, docBlocksToPresentationRoutes, docBlocksToPresentationSpecs, docId, listRegisteredDocBlocks, mapDocRoutes, metaDocs, registerDocBlocks, techContractsDocs };
@@ -0,0 +1,29 @@
1
+ import { docBlockToPresentationSpec, docBlockToPresentationV2, docBlocksToPresentationRoutes, docBlocksToPresentationSpecs, mapDocRoutes } from "./presentations.js";
2
+ import { DocRegistry, defaultDocRegistry, docId, listRegisteredDocBlocks, registerDocBlocks } from "./registry.js";
3
+ import { techContractsDocs } from "./tech-contracts.docs.js";
4
+ import { metaDocs } from "./meta.docs.js";
5
+ import "./accessibility_wcag_compliance_specs.docblock.js";
6
+ import "./tech/lifecycle-stage-system.docblock.js";
7
+ import "./tech/presentation-runtime.docblock.js";
8
+ import "./tech/auth/better-auth-nextjs.docblock.js";
9
+ import "./tech/schema/README.docblock.js";
10
+ import "./tech/templates/runtime.docblock.js";
11
+ import "../workflow/overview.docblock.js";
12
+ import "./tech/mcp-endpoints.docblock.js";
13
+ import "./tech/vscode-extension.docblock.js";
14
+ import "./tech/telemetry-ingest.docblock.js";
15
+ import "./tech/contracts/openapi-export.docblock.js";
16
+ import "./tech/contracts/openapi-import.docblock.js";
17
+ import "../workspace-config/workspace-config.docblock.js";
18
+ import "./tech/studio/workspaces.docblock.js";
19
+ import "./tech/studio/sandbox-unlogged.docblock.js";
20
+ import "./tech/studio/workspace-ops.docblock.js";
21
+ import "./tech/studio/project-routing.docblock.js";
22
+ import "./tech/studio/platform-admin-panel.docblock.js";
23
+ import "./tech/studio/learning-events.docblock.js";
24
+ import "./tech/studio/learning-journeys.docblock.js";
25
+ import "./tech/studio/project-access-teams.docblock.js";
26
+ import "./tech/studio/team-invitations.docblock.js";
27
+ import "./tech/llm/llm-integration.docblock.js";
28
+
29
+ export { DocRegistry, defaultDocRegistry, docBlockToPresentationSpec, docBlockToPresentationV2, docBlocksToPresentationRoutes, docBlocksToPresentationSpecs, docId, listRegisteredDocBlocks, mapDocRoutes, metaDocs, registerDocBlocks, techContractsDocs };
@@ -0,0 +1,6 @@
1
+ import { DocBlock } from "./types.js";
2
+
3
+ //#region src/docs/meta.docs.d.ts
4
+ declare const metaDocs: DocBlock[];
5
+ //#endregion
6
+ export { metaDocs };
@@ -0,0 +1,29 @@
1
+ import { registerDocBlocks } from "./registry.js";
2
+
3
+ //#region src/docs/meta.docs.ts
4
+ const metaDocs = [{
5
+ id: "docs.meta.docblocks-process",
6
+ title: "DocBlocks process",
7
+ summary: "How to author goal/how/usage DocBlocks close to code.",
8
+ kind: "reference",
9
+ visibility: "mixed",
10
+ route: "/docs/meta/docblocks-process",
11
+ tags: ["docs", "process"],
12
+ body: `## DocBlocks authoring rules
13
+
14
+ - Colocate docs beside implementation; avoid barrel /docs folders.
15
+ - Split intent:
16
+ - **goal**: why this exists (before implementation).
17
+ - **how**: operational/runbook steps.
18
+ - **usage**: quick checklist for consumers.
19
+ - Use \`visibility\`: public | internal | mixed.
20
+ - Prefer routes like \`/docs/<domain>/<topic>/<kind>\`; ids mirror that.
21
+ - Keep body Markdown LLM-friendly; avoid HTML.
22
+ - Add owners/tags/domain/stability when known.
23
+ - For presentations/markdown outputs, rely on TransformEngine via DocRegistry.
24
+ - No sourcePath; DocBlocks are canonical.`
25
+ }];
26
+ registerDocBlocks(metaDocs);
27
+
28
+ //#endregion
29
+ export { metaDocs };
@@ -0,0 +1,33 @@
1
+ import { DocBlock } from "./types.js";
2
+ import { PresentationSpec, PresentationTarget } from "../presentations/presentations.js";
3
+ import { Stability } from "../ownership.js";
4
+
5
+ //#region src/docs/presentations.d.ts
6
+ interface DocPresentationOptions {
7
+ /**
8
+ * Namespace for presentation meta.key (e.g., web-landing.docs.ops).
9
+ * Defaults to the DocBlock id.
10
+ */
11
+ namespace?: string;
12
+ /** Route prefix when no explicit route is provided on the block. Defaults to /docs. */
13
+ routePrefix?: string;
14
+ /** Default presentation targets. */
15
+ defaultTargets?: PresentationTarget[];
16
+ /** Default version when block.version is not set. */
17
+ defaultVersion?: number;
18
+ /** Default stability if not provided on the DocBlock. */
19
+ defaultStability?: Stability;
20
+ }
21
+ interface DocPresentationRoute {
22
+ route: string;
23
+ descriptor: PresentationSpec;
24
+ block: DocBlock;
25
+ }
26
+ declare function docBlockToPresentationSpec(block: DocBlock, options?: DocPresentationOptions): PresentationSpec;
27
+ /** @deprecated Use docBlockToPresentationSpec instead */
28
+ declare const docBlockToPresentationV2: typeof docBlockToPresentationSpec;
29
+ declare function docBlocksToPresentationRoutes(blocks: DocBlock[], options?: DocPresentationOptions): DocPresentationRoute[];
30
+ declare function docBlocksToPresentationSpecs(blocks: DocBlock[], options?: DocPresentationOptions): PresentationSpec[];
31
+ declare function mapDocRoutes(routes: DocPresentationRoute[]): [string, PresentationSpec][];
32
+ //#endregion
33
+ export { DocPresentationOptions, DocPresentationRoute, docBlockToPresentationSpec, docBlockToPresentationV2, docBlocksToPresentationRoutes, docBlocksToPresentationSpecs, mapDocRoutes };
@@ -0,0 +1,64 @@
1
+ //#region src/docs/presentations.ts
2
+ const DEFAULT_TARGETS = [
3
+ "markdown",
4
+ "application/json",
5
+ "application/xml",
6
+ "react"
7
+ ];
8
+ function normalizeRoute(route) {
9
+ if (!route.length) return "/";
10
+ const withLeading = route.startsWith("/") ? route : `/${route}`;
11
+ return withLeading === "/" ? "/" : withLeading.replace(/\/+$/, "");
12
+ }
13
+ function deriveRoute(block, routePrefix) {
14
+ if (block.route) return normalizeRoute(block.route);
15
+ const prefix = routePrefix ?? "/docs";
16
+ const slug = block.id.replace(/^docs\.?/, "").replace(/\./g, "/").replace(/\/+/g, "/");
17
+ return normalizeRoute(slug.startsWith("/") ? slug : `${prefix}/${slug}`);
18
+ }
19
+ function buildName(block, namespace) {
20
+ return namespace ? `${namespace}.${block.id}` : block.id;
21
+ }
22
+ function docBlockToPresentationSpec(block, options) {
23
+ const targets = options?.defaultTargets ?? DEFAULT_TARGETS;
24
+ const version = block.version ?? options?.defaultVersion ?? 1;
25
+ const stability = block.stability ?? options?.defaultStability ?? "stable";
26
+ return {
27
+ meta: {
28
+ key: buildName(block, options?.namespace),
29
+ title: block.title,
30
+ version,
31
+ description: block.summary ?? block.title,
32
+ tags: block.tags || [],
33
+ owners: block.owners || [],
34
+ domain: block.domain || "",
35
+ stability,
36
+ goal: `Documentation of: ${block.summary}`,
37
+ context: `Auto-generated`
38
+ },
39
+ policy: block.visibility && block.visibility !== "public" ? { flags: [block.visibility] } : void 0,
40
+ source: {
41
+ type: "blocknotejs",
42
+ docJson: block.body
43
+ },
44
+ targets
45
+ };
46
+ }
47
+ /** @deprecated Use docBlockToPresentationSpec instead */
48
+ const docBlockToPresentationV2 = docBlockToPresentationSpec;
49
+ function docBlocksToPresentationRoutes(blocks, options) {
50
+ return blocks.map((block) => ({
51
+ block,
52
+ route: deriveRoute(block, options?.routePrefix),
53
+ descriptor: docBlockToPresentationSpec(block, options)
54
+ }));
55
+ }
56
+ function docBlocksToPresentationSpecs(blocks, options) {
57
+ return blocks.map((block) => docBlockToPresentationSpec(block, options));
58
+ }
59
+ function mapDocRoutes(routes) {
60
+ return routes.map(({ route, descriptor }) => [route, descriptor]);
61
+ }
62
+
63
+ //#endregion
64
+ export { docBlockToPresentationSpec, docBlockToPresentationV2, docBlocksToPresentationRoutes, docBlocksToPresentationSpecs, mapDocRoutes };
@@ -0,0 +1,23 @@
1
+ import { DocBlock } from "./types.js";
2
+ import { PresentationSpec } from "../presentations/presentations.js";
3
+ import { DocPresentationOptions, DocPresentationRoute } from "./presentations.js";
4
+
5
+ //#region src/docs/registry.d.ts
6
+ type DocId = string & {
7
+ __docId: true;
8
+ };
9
+ declare class DocRegistry {
10
+ private readonly routes;
11
+ constructor(blocks?: DocBlock[], options?: DocPresentationOptions);
12
+ register(block: DocBlock, options?: DocPresentationOptions): this;
13
+ list(): DocPresentationRoute[];
14
+ get(id: string): DocPresentationRoute | undefined;
15
+ toRouteTuples(): [string, PresentationSpec][];
16
+ toPresentationSpecs(options?: DocPresentationOptions): PresentationSpec[];
17
+ }
18
+ declare const defaultDocRegistry: DocRegistry;
19
+ declare function registerDocBlocks(blocks: DocBlock[]): void;
20
+ declare function listRegisteredDocBlocks(): DocBlock[];
21
+ declare function docId(id: string): DocId;
22
+ //#endregion
23
+ export { DocId, DocRegistry, defaultDocRegistry, docId, listRegisteredDocBlocks, registerDocBlocks };
@@ -0,0 +1,51 @@
1
+ import { docBlockToPresentationSpec, docBlocksToPresentationRoutes } from "./presentations.js";
2
+
3
+ //#region src/docs/registry.ts
4
+ var DocRegistry = class {
5
+ routes = /* @__PURE__ */ new Map();
6
+ constructor(blocks = [], options) {
7
+ blocks.forEach((block) => this.register(block, options));
8
+ }
9
+ register(block, options) {
10
+ const [route] = docBlocksToPresentationRoutes([block], options);
11
+ if (route) this.routes.set(block.id, route);
12
+ return this;
13
+ }
14
+ list() {
15
+ return [...this.routes.values()];
16
+ }
17
+ get(id) {
18
+ return this.routes.get(id);
19
+ }
20
+ toRouteTuples() {
21
+ return this.list().map(({ route, descriptor }) => [route, descriptor]);
22
+ }
23
+ toPresentationSpecs(options) {
24
+ return this.list().map(({ block }) => docBlockToPresentationSpec(block, options));
25
+ }
26
+ };
27
+ const requiredFields = [
28
+ "id",
29
+ "title",
30
+ "body",
31
+ "kind",
32
+ "visibility",
33
+ "route"
34
+ ];
35
+ const defaultDocRegistry = new DocRegistry();
36
+ function registerDocBlocks(blocks) {
37
+ for (const block of blocks) {
38
+ for (const field of requiredFields) if (!block[field]) throw new Error(`DocBlock ${block.id ?? "<missing id>"} missing field ${String(field)}`);
39
+ defaultDocRegistry.register(block);
40
+ }
41
+ }
42
+ function listRegisteredDocBlocks() {
43
+ return defaultDocRegistry.list().map((r) => r.block);
44
+ }
45
+ function docId(id) {
46
+ if (!defaultDocRegistry.get(id)) throw new Error(`DocBlock not registered: ${id}`);
47
+ return id;
48
+ }
49
+
50
+ //#endregion
51
+ export { DocRegistry, defaultDocRegistry, docId, listRegisteredDocBlocks, registerDocBlocks };
@@ -0,0 +1,6 @@
1
+ import { DocBlock } from "@contractspec/lib.contracts/docs";
2
+
3
+ //#region src/docs/tech/auth/better-auth-nextjs.docblock.d.ts
4
+ declare const tech_auth_better_auth_nextjs_DocBlocks: DocBlock[];
5
+ //#endregion
6
+ export { tech_auth_better_auth_nextjs_DocBlocks };
@@ -0,0 +1,81 @@
1
+ import { registerDocBlocks } from "../../registry.js";
2
+
3
+ //#region src/docs/tech/auth/better-auth-nextjs.docblock.ts
4
+ const tech_auth_better_auth_nextjs_DocBlocks = [{
5
+ id: "docs.tech.auth.better-auth-nextjs",
6
+ title: "Better Auth + Next.js integration (ContractSpec)",
7
+ summary: "How ContractSpec wires Better Auth into Next.js (server config, client singleton, and proxy cookie-only redirects).",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/tech/auth/better-auth-nextjs",
11
+ tags: [
12
+ "auth",
13
+ "better-auth",
14
+ "nextjs",
15
+ "cookies",
16
+ "proxy",
17
+ "hmr"
18
+ ],
19
+ body: `# Better Auth + Next.js integration (ContractSpec)
20
+
21
+ This repo uses Better Auth as the primary auth layer (sessions, organizations, teams, API keys, and OAuth).
22
+
23
+ ## Server config (Better Auth)
24
+
25
+ - Source: \`packages/bundles/contractspec-studio/src/application/services/auth.ts\`
26
+ - Important: \`nextCookies()\` must be the **last** plugin in the Better Auth plugin list so \`Set-Cookie\` is applied correctly in Next.js environments.
27
+
28
+ ## Better Auth Admin plugin
29
+
30
+ ContractSpec Studio enables the Better Auth **Admin plugin** to support platform-admin user operations (list users, impersonation, etc.).
31
+
32
+ - Server: \`admin()\` plugin in \`packages/bundles/contractspec-studio/src/application/services/auth.ts\`
33
+ - Client: \`adminClient()\` in \`packages/bundles/contractspec-studio/src/presentation/providers/auth/client.ts\`
34
+
35
+ ### PLATFORM_ADMIN ⇒ Better Auth admin role
36
+
37
+ Better Auth Admin endpoints authorize via \`user.role\`. ContractSpec enforces an org-driven rule:
38
+
39
+ - If the **active organization** has \`type = PLATFORM_ADMIN\`, the signed-in user is ensured to have \`User.role\` containing \`admin\`.
40
+ - This is applied in the session creation hook and re-checked in \`assertsPlatformAdmin()\`.
41
+
42
+ This keeps admin enablement deterministic and avoids manual role backfills.
43
+
44
+ ## Client config (React web + Expo)
45
+
46
+ To avoid duplicate background refresh/polling loops in dev (Fast Refresh/HMR), the Better Auth client is implemented as a singleton cached on \`globalThis\`.
47
+
48
+ - Web client: \`packages/bundles/contractspec-studio/src/presentation/providers/auth/client.ts\`
49
+ - Native client: \`packages/bundles/contractspec-studio/src/presentation/providers/auth/client.native.ts\`
50
+
51
+ Import guidance:
52
+
53
+ - If you only need the context/hook, prefer importing from \`@contractspec/bundle.studio/presentation/providers/auth\`.
54
+ - If you explicitly need the Better Auth client instance (e.g. admin impersonation, direct API calls), import from \`@contractspec/bundle.studio/presentation/providers/auth/client\`.
55
+
56
+ ## Public routes (login / signup)
57
+
58
+ Public auth pages should avoid eager \`authClient\` initialization.
59
+
60
+ Pattern used:
61
+
62
+ - In the submit handler, dynamically import \`@contractspec/bundle.studio/presentation/providers/auth/index.web\` and call \`authClient.signIn.*\` / \`authClient.signUp.*\`.
63
+
64
+ This prevents session refresh behavior from starting just because a public page rendered.
65
+
66
+ ## Next.js proxy auth (web-landing)
67
+
68
+ The Next.js proxy/middleware is used for **redirect decisions only**. It must not perform DB-backed session reads on every request.
69
+
70
+ - Source: \`packages/apps/web-landing/src/proxy.ts\`
71
+ - Approach: cookie-only checks via Better Auth cookies helpers:
72
+ - \`getSessionCookie(request)\`
73
+ - \`getCookieCache(request)\`
74
+
75
+ These checks are intentionally optimistic and should only gate routing. Full authorization must still be enforced on server-side actions/routes and GraphQL resolvers.
76
+ `
77
+ }];
78
+ registerDocBlocks(tech_auth_better_auth_nextjs_DocBlocks);
79
+
80
+ //#endregion
81
+ export { tech_auth_better_auth_nextjs_DocBlocks };
@@ -0,0 +1,6 @@
1
+ import { DocBlock } from "@contractspec/lib.contracts/docs";
2
+
3
+ //#region src/docs/tech/contracts/README.docblock.d.ts
4
+ declare const tech_contracts_README_DocBlocks: DocBlock[];
5
+ //#endregion
6
+ export { tech_contracts_README_DocBlocks };
@@ -0,0 +1,21 @@
1
+ import { registerDocBlocks } from "../../registry.js";
2
+
3
+ //#region src/docs/tech/contracts/README.docblock.ts
4
+ const tech_contracts_README_DocBlocks = [{
5
+ id: "docs.tech.contracts.README",
6
+ title: "Contracts: Specs, Registry, Handlers, Adapters",
7
+ summary: "- `packages/lssm/libs/contracts` defines the contracts core (OperationSpecRegistry, OperationSpec, PresentationSpec, install helpers, REST/MCP adapters, ...).",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/tech/contracts/README",
11
+ tags: [
12
+ "tech",
13
+ "contracts",
14
+ "README"
15
+ ],
16
+ body: "## Contracts: Specs, Registry, Handlers, Adapters\n\n### What lives where\n\n- `packages/lssm/libs/contracts` defines the contracts core (OperationSpecRegistry, OperationSpec, PresentationSpec, install helpers, REST/MCP adapters).\n- `packages/lssm/libs/schema` defines the schema dictionary (`SchemaModel`, `FieldType`) used to describe I/O once and map to multiple targets (zod, GraphQL, JSON Schema).\n- App adapters (e.g. GraphQL) live close to the app. Example: `packages/hcircle/apps/api-coliving/src/graphql/contracts-adapter.ts`.\n\n### npm distribution\n\n- `@contractspec/lib.contracts` (root) keeps the legacy \\\"everything\\\" surface for backward compatibility.\n- `@contractspec/lib.contracts/client` exposes only browser-safe helpers (React renderers, client SDK, drivers). Import from this entry when bundling for the web or React Native to avoid dragging server adapters.\n- `@contractspec/lib.contracts/server` covers HTTP/MCP adapters, registries, integrations, and other Node-only helpers.\n- `@contractspec/lib.contracts/types` exports the runtime handler context utilities, while `@contractspec/lib.contracts/types/all` re-exports every type alias/interface across the package via `export type` so consumers can import a single module for typings without shipping runtime code.\n- `@contractspec/lib.schema`, `@contractspec/lib.design-system`, `@contractspec/lib.ui-kit`, `@contractspec/lib.ui-kit-web`, `@contractspec/lib.accessibility`, and the presentation runtime packages are published to npm alongside contracts; prefer the scoped packages to keep tree-shaking intact.\n- Bundlers with conditional exports should resolve subpaths first; keep root imports for server-only code paths.\n\n### Core concepts\n\n- **OperationSpec**: immutable description of an operation.\n - `meta`: `{ name, version, kind: 'query' | 'command' }`\n - `io`: `{ input: SchemaModel | zod schema, output: SchemaModel | zod schema }`\n - `policy`: `{ auth?: {...}, rateLimit?: {...}, flags?: string[] }`\n - `transport.gql.field?`: explicit GraphQL field name (otherwise derived via `defaultGqlField`).\n- **OperationSpecRegistry**: registry of specs + handlers. Use `installOp(reg, spec, handler)` to attach a handler.\n- **Handler**: `(ctx, input) => Promise<output>` implementing the operation.\n- **CapabilitySpec**: canonical capability declaration stored in `src/capabilities.ts`. Tracks `meta` (`{ key, version, kind, title, description, domain, owners, tags, stability }`), `provides` surfaces (`operation`, `event`, `workflow`, `presentation`, `resource`), and `requires` which other capabilities must be present. Enforced during `installFeature`.\n- **PolicySpec**: declarative policy rules (`src/policy/spec.ts`) covering ABAC/ReBAC, consent + rate limit requirements, field-level controls, and PII guidance. `PolicyEngine` evaluates refs, while `OPAPolicyAdapter` lets OPA override/augment runtime decisions.\n- **TelemetrySpec**: analytics definitions (`src/telemetry/spec.ts`) describing event semantics, privacy level, retention, sampling, and anomaly detection. `TelemetryTracker` handles redaction/sampling, `TelemetryAnomalyMonitor` raises alerts, and specs integrate with contracts/workflows via `ctx.telemetry`.\n- **TestSpec**: declarative scenario definitions in `src/tests/spec.ts`. `TestRunner` executes fixtures/actions/assertions against a `OperationSpecRegistry`, and the CLI (`contractspec test`) wraps the runner for automation.\n- **ExperimentSpec**: experiment definitions (`src/experiments/spec.ts`) describing variants, allocation strategies, and success metrics. `ExperimentEvaluator` assigns variants (random/sticky/targeted) and integrates with Policy/Telemetry for safe experimentation.\n- **AppBlueprintSpec / TenantAppConfig**: global blueprints and per-tenant overrides (`src/app-config/spec.ts`). `resolveAppConfig()` merges the two into a `ResolvedAppConfig`, while `composeAppConfig()` hydrates the merged view against registries and reports missing references for safe rollout.\n- **RegeneratorService**: background daemon (`src/regenerator/service.ts`) that consumes telemetry/error/behavior signals, evaluates regeneration rules, and produces `SpecChangeProposal`s for Studio review.\n- **DataViewSpec**: declarative data presentation layer in `src/data-views.ts`. Describes entity projections (`fields`, `filters`, `actions`) with `view.kind` (`list`, `table`, `detail`, `grid`), ties to query operations via `source.primary`, and exposes optional presentation-based empty/error states.\n- **ThemeSpec**: design token + component variant definitions in `src/themes.ts`. Supports inheritance (`extends`), tenant/user overrides, and component-specific variant metadata for the design system.\n- **MigrationSpec**: schema/data migration descriptors (`src/migrations.ts`) with ordered step plans, dependency tracking, and pre/post checks to support automated database/content migrations.\n- **WorkflowSpec**: typed definition of multi-step workflows living in `src/workflow/spec.ts`. `WorkflowRegistry` stores versioned specs, and `validateWorkflowSpec()` (in `src/workflow/validation.ts`) checks graph integrity, step references, and reachability.\n\n### Lifecycle\n\n1. Define the spec (I/O via `SchemaModel` or zod) in a vertical lib (e.g. `contracts-coliving`).\n2. Register it: `installOp(registry, spec, handler)` within the app/service.\n3. Expose it via an adapter (REST, GraphQL, MCP). Each adapter maps the I/O to its transport and enforces policy.\n4. Validate at runtime: parse `input` before executing, parse `output` before returning.\n\n### Adapters\n\n- **REST**: see `packages/lssm/libs/contracts/src/server/rest-*`. Binds routes, validates request/response, maps errors/policies.\n- **MCP**: see `packages/lssm/libs/contracts/src/server/provider-mcp.ts` (standalone MCP server) and `packages/lssm/libs/contracts/src/server/rest-next-mcp.ts` (MCP over Next.js route). Provides tools/resources/prompts.\n - Tools + resources are registered from Zod schemas.\n - Resource templates are keyed by full `ResourceMeta.uriTemplate` (e.g. `docs://list`, `docs://doc/{id}`), so multiple templates can share a scheme (`docs://*`) without collisions.\n- **GraphQL (Pothos)**: see `packages/lssm/libs/contracts/src/server/graphql-pothos.ts`. Adds Query/Mutation fields by transforming contract I/O to GraphQL types.\n\n### GraphQL adapter behaviour (summary)\n\n- Field naming: `spec.transport.gql.field` or `<name_with_dots>_v<version>`.\n- Input/Output types from `SchemaModel` (preferred) or fallback zod introspection.\n- Scalars: String/Int/Float/Boolean/Date/JSON; Objects/Arrays/Enums; unions for outputs; input unions => JSON.\n- Policy: auth gate checks GraphQL context; optional feature flag gating.\n- Complexity & tracing: attaches hints and records timings; log includes `{ specName, version }`.\n\n#### Returns mapping and hydration\n\n- `spec.transport.gql.returns` can declare the GraphQL return wrapper: e.g. `\"Spot\"` or `[Spot]`. If omitted, the adapter infers from `io.output` (SchemaModel) or `resourceRef.graphQLType`.\n- Resource outputs: when `io.output` is a `resourceRef(...)` or `transport.gql.resource` is set, the adapter will optionally hydrate via a `ResourceRegistry` using `contracts-adapter-hydration.ts`:\n - Grammar is parsed with `parseReturns()`.\n - Entities are resolved via `hydrateResourceIfNeeded(resources, result, { template, varName, returns })` after handler execution.\n\n### Resource outputs\n\n- Declare resource outputs using `resourceRef(uriTemplate, opts)`.\n- `opts.varName` (default `id`) selects the identifier field returned by the handler for URI substitution.\n- `opts.graphQLType` is the GraphQL return type name (e.g., `Spot`) or list form (e.g., `[Spot]`).\n- `opts.many: true` indicates the handler returns an array of resources. The handler type becomes an array of items that include the identifier field.\n\nExample:\n\n```ts\nio: {\n input: ListThingsInput,\n output: resourceRef('myapp://thing/{id}', { graphQLType: '[Thing]', many: true }),\n}\n```\n\nHandler return (simplified): `{ id: string | number }[]`.\n\n### Errors\n\n- Validation errors → transport 400/GraphQL UserInputError.\n- Policy/auth errors → 401/403 or GraphQL ForbiddenError.\n- Handler errors → mapped to transport error with safe message.\n\n### Versioning & naming\n\n- Keep `meta.version` monotonic. Clients should pin to a versioned field/key.\n- Avoid renaming existing fields; add new fields with new versions.\n\n### Ownership metadata (OwnerShipMeta)\n\nAll contracts, events, features, and presentations reference a shared ownership schema (source of truth in `packages/lssm/libs/contracts/src/ownership.ts`).\n\n- Required fields: `title`, `description`, `domain`, `owners[]`, `tags[]`, `stability`.\n- Curated enums: the library exports suggested constants for owners and tags; free-form strings are still allowed for forward-compatibility.\n- Operations (`spec.ts`): `meta` requires `stability`, `owners`, and `tags` alongside `name`, `version`, `kind`, `description`, `goal`, and `context`.\n- Presentations V2: `meta` is a partial of ownership plus `description`.\n- Events: may specify `ownership` (recommended) for discoverability and docs.\n\n### Quick start\n\n```ts\n// app bootstrap\nconst reg = new OperationSpecRegistry();\ninstallOp(reg, BeginSignupSpec, beginSignupHandler);\nregisterContractsOnBuilder(gqlSchemaBuilder, reg); // GraphQL\n// or: createRestRouter(reg) // REST\n```\n"
17
+ }];
18
+ registerDocBlocks(tech_contracts_README_DocBlocks);
19
+
20
+ //#endregion
21
+ export { tech_contracts_README_DocBlocks };
@@ -0,0 +1,6 @@
1
+ import { DocBlock } from "@contractspec/lib.contracts/docs";
2
+
3
+ //#region src/docs/tech/contracts/create-subscription.docblock.d.ts
4
+ declare const tech_contracts_create_subscription_DocBlocks: DocBlock[];
5
+ //#endregion
6
+ export { tech_contracts_create_subscription_DocBlocks };
@@ -0,0 +1,21 @@
1
+ import { registerDocBlocks } from "../../registry.js";
2
+
3
+ //#region src/docs/tech/contracts/create-subscription.docblock.ts
4
+ const tech_contracts_create_subscription_DocBlocks = [{
5
+ id: "docs.tech.contracts.create-subscription",
6
+ title: "Subscriptions via Better Auth Stripe",
7
+ summary: "This app uses Better Auth's Stripe plugin for subscription management.",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/tech/contracts/create-subscription",
11
+ tags: [
12
+ "tech",
13
+ "contracts",
14
+ "create-subscription"
15
+ ],
16
+ body: "### Subscriptions via Better Auth Stripe\n\nThis app uses Better Auth's Stripe plugin for subscription management.\n\nKey endpoints:\n\n- `/api/auth/[...all]` – Better Auth server\n- `/api/auth/stripe/webhook` – Stripe webhook handled by Better Auth\n\nClient usage (org mode):\n\n```ts\nimport { subscription } from '@/lib/auth-client';\n\nawait subscription.upgrade({\n plan: 'core',\n annual: true,\n referenceId: activeOrganization?.id,\n successUrl: '/dashboard',\n cancelUrl: '/pricing',\n});\n```\n\nPlans are configured in `src/lib/auth.ts` referencing env-provided price IDs. See Better Auth Stripe docs: [plugins: Stripe](`https://better-auth.com/docs/plugins/stripe.mdx`) and [Using with organizations](`https://www.better-auth.com/docs/plugins/stripe#using-with-organizations`).\n\nLanding pricing UX\n\n- Components: `SectionEyebrow`, `PriceBadge`, `FeatureList`, `PriceCard`\n- Sections: `PricingSection`, `StoryPricingBenefits`\n- Canonical pricing source: `src/lib/pricing/config.ts`\n\nTrial period\n\n- Le plan « Essentiel » inclut une période d’essai gratuite de 30 jours.\n- Config côté auth: `freeTrial: { days: 30 }` dans `src/lib/auth.ts` (Better Auth Stripe plugin).\n- Config côté pricing: `trial: { days: 30 }` dans `src/lib/pricing/config.ts`.\n\nDashboard badges\n\n- Le `Tableau de bord` affiche des badges d’état d’abonnement:\n - « Essai · se termine le JJ/MM/AAAA » lorsque l’essai est en cours\n - « Abonnement actif » lorsque l’abonnement est actif\n - « Annulé · fin au terme de la période » lorsque la résiliation est planifiée\n- Composant: `components/dashboard/DashboardPage/molecules/Header.tsx`\n- Source des états: hook `useProfileBillingPage()` (`components/profile/ProfileBillingPage/hooks/useProfileBillingPage.tsx`)\n"
17
+ }];
18
+ registerDocBlocks(tech_contracts_create_subscription_DocBlocks);
19
+
20
+ //#endregion
21
+ export { tech_contracts_create_subscription_DocBlocks };