@contractspec/bundle.library 3.8.10 → 3.8.11

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 (643) hide show
  1. package/.turbo/turbo-build.log +606 -594
  2. package/CHANGELOG.md +37 -0
  3. package/dist/application/context-storage/index.js +1 -28
  4. package/dist/application/index.js +13 -2133
  5. package/dist/application/mcp/cliMcp.js +4 -452
  6. package/dist/application/mcp/common.js +1 -193
  7. package/dist/application/mcp/contractsMcp.js +2 -549
  8. package/dist/application/mcp/contractsMcpResources.js +2 -123
  9. package/dist/application/mcp/contractsMcpTools.js +1 -199
  10. package/dist/application/mcp/docsMcp.catalog.js +3 -381
  11. package/dist/application/mcp/docsMcp.data.js +1 -147
  12. package/dist/application/mcp/docsMcp.js +6 -1039
  13. package/dist/application/mcp/docsMcp.prompts.js +6 -521
  14. package/dist/application/mcp/docsMcp.reference.js +3 -235
  15. package/dist/application/mcp/docsMcp.resources.js +3 -519
  16. package/dist/application/mcp/docsMcp.tools.js +3 -518
  17. package/dist/application/mcp/index.js +13 -2106
  18. package/dist/application/mcp/internalMcp.js +2 -410
  19. package/dist/application/mcp/normalizeMcpRequest.js +1 -21
  20. package/dist/application/mcp/providerRankingMcp.js +1 -530
  21. package/dist/bundles/LibraryBundle.js +1 -138
  22. package/dist/bundles/index.js +1 -138
  23. package/dist/components/docs/DocsIndexPage.js +2 -912
  24. package/dist/components/docs/advanced/AdvancedMCPPage.js +4 -271
  25. package/dist/components/docs/advanced/AdvancedOverlayEditorPage.js +1 -107
  26. package/dist/components/docs/advanced/AdvancedRenderersPage.js +2 -118
  27. package/dist/components/docs/advanced/AdvancedSpecExperimentsPage.js +4 -92
  28. package/dist/components/docs/advanced/AdvancedTelemetryPage.js +2 -373
  29. package/dist/components/docs/advanced/AdvancedWorkflowMonitoringPage.js +2 -99
  30. package/dist/components/docs/advanced/index.js +10 -1055
  31. package/dist/components/docs/architecture/ArchitectureAppConfigPage.js +6 -243
  32. package/dist/components/docs/architecture/ArchitectureControlPlanePage.js +3 -160
  33. package/dist/components/docs/architecture/ArchitectureIntegrationBindingPage.js +7 -259
  34. package/dist/components/docs/architecture/ArchitectureKnowledgeBindingPage.js +6 -374
  35. package/dist/components/docs/architecture/ArchitectureMultiTenancyPage.js +2 -166
  36. package/dist/components/docs/architecture/ArchitectureOverviewPage.js +1 -143
  37. package/dist/components/docs/architecture/index.js +20 -1340
  38. package/dist/components/docs/comparison/ComparisonAutomationPlatformsPage.js +1 -245
  39. package/dist/components/docs/comparison/ComparisonEnterprisePlatformsPage.js +1 -230
  40. package/dist/components/docs/comparison/ComparisonInternalToolBuildersPage.js +1 -245
  41. package/dist/components/docs/comparison/ComparisonOverviewPage.js +1 -202
  42. package/dist/components/docs/comparison/ComparisonWindmillPage.js +1 -254
  43. package/dist/components/docs/comparison/ComparisonWorkflowEnginesPage.js +1 -339
  44. package/dist/components/docs/comparison/index.js +1 -1510
  45. package/dist/components/docs/docsManifest.js +1 -611
  46. package/dist/components/docs/docsManifest.test.d.ts +1 -0
  47. package/dist/components/docs/ecosystem/IntegrationsPage.js +2 -103
  48. package/dist/components/docs/ecosystem/PluginsPage.js +13 -179
  49. package/dist/components/docs/ecosystem/RegistryPage.js +7 -100
  50. package/dist/components/docs/ecosystem/TemplatesPage.js +3 -141
  51. package/dist/components/docs/ecosystem/ecosystem.docblocks.js +2 -48
  52. package/dist/components/docs/ecosystem/index.js +23 -569
  53. package/dist/components/docs/examples/DocsExamplesPage.js +4 -124
  54. package/dist/components/docs/examples/ExampleShowcasePage.js +4 -244
  55. package/dist/components/docs/examples/exampleShowcaseData.js +4 -39
  56. package/dist/components/docs/examples/index.js +4 -330
  57. package/dist/components/docs/generated/docs-index.generated.js +1 -5
  58. package/dist/components/docs/generated/index.js +1 -74
  59. package/dist/components/docs/generated/loader.js +1 -74
  60. package/dist/components/docs/getting-started/CLIPage.js +4 -271
  61. package/dist/components/docs/getting-started/CompatibilityPage.js +1 -173
  62. package/dist/components/docs/getting-started/DataViewTutorialPage.js +4 -134
  63. package/dist/components/docs/getting-started/DeveloperToolsPage.js +1 -194
  64. package/dist/components/docs/getting-started/HelloWorldPage.js +5 -183
  65. package/dist/components/docs/getting-started/InstallationPage.js +3 -154
  66. package/dist/components/docs/getting-started/StartHerePage.js +2 -129
  67. package/dist/components/docs/getting-started/TroubleshootingPage.js +2 -168
  68. package/dist/components/docs/getting-started/VSCodeExtensionPage.js +1 -432
  69. package/dist/components/docs/getting-started/getting-started.docblocks.js +4 -41
  70. package/dist/components/docs/getting-started/index.js +18 -1869
  71. package/dist/components/docs/guides/GuideCIDiffGatingPage.js +2 -196
  72. package/dist/components/docs/guides/GuideConnectInRepoPage.d.ts +1 -0
  73. package/dist/components/docs/guides/GuideConnectInRepoPage.js +44 -0
  74. package/dist/components/docs/guides/GuideContractTypesPage.js +6 -541
  75. package/dist/components/docs/guides/GuideDocsPipelinePage.js +3 -207
  76. package/dist/components/docs/guides/GuideFirstModuleBundlePage.d.ts +1 -0
  77. package/dist/components/docs/guides/GuideFirstModuleBundlePage.js +76 -0
  78. package/dist/components/docs/guides/GuideGenerateDocsClientsSchemasPage.js +2 -209
  79. package/dist/components/docs/guides/GuideHostBuilderWorkbenchPage.d.ts +1 -0
  80. package/dist/components/docs/guides/GuideHostBuilderWorkbenchPage.js +70 -0
  81. package/dist/components/docs/guides/GuideImportExistingCodebasesPage.js +8 -754
  82. package/dist/components/docs/guides/GuideNextjsOneEndpointPage.js +6 -268
  83. package/dist/components/docs/guides/GuideSpecValidationTypingPage.js +4 -196
  84. package/dist/components/docs/guides/GuidesIndexPage.js +2 -169
  85. package/dist/components/docs/guides/guides.docblocks.js +11 -75
  86. package/dist/components/docs/guides/index.d.ts +3 -0
  87. package/dist/components/docs/guides/index.js +213 -2428
  88. package/dist/components/docs/index.js +542 -24310
  89. package/dist/components/docs/integrations/IntegrationsCircuitBreakersPage.js +2 -42
  90. package/dist/components/docs/integrations/IntegrationsElevenLabsPage.js +3 -105
  91. package/dist/components/docs/integrations/IntegrationsGithubPage.js +3 -142
  92. package/dist/components/docs/integrations/IntegrationsGmailPage.js +3 -109
  93. package/dist/components/docs/integrations/IntegrationsGoogleCalendarPage.js +3 -79
  94. package/dist/components/docs/integrations/IntegrationsHealthRoutingPage.js +3 -146
  95. package/dist/components/docs/integrations/IntegrationsMistralPage.js +5 -150
  96. package/dist/components/docs/integrations/IntegrationsOpenAIPage.js +5 -140
  97. package/dist/components/docs/integrations/IntegrationsOverviewPage.js +1 -160
  98. package/dist/components/docs/integrations/IntegrationsPostmarkPage.js +4 -218
  99. package/dist/components/docs/integrations/IntegrationsPowensPage.js +4 -300
  100. package/dist/components/docs/integrations/IntegrationsQdrantPage.js +5 -111
  101. package/dist/components/docs/integrations/IntegrationsResendPage.js +3 -102
  102. package/dist/components/docs/integrations/IntegrationsS3Page.js +4 -124
  103. package/dist/components/docs/integrations/IntegrationsSlackPage.js +3 -144
  104. package/dist/components/docs/integrations/IntegrationsSpecModelPage.js +7 -290
  105. package/dist/components/docs/integrations/IntegrationsStripePage.js +6 -327
  106. package/dist/components/docs/integrations/IntegrationsTwilioPage.js +3 -128
  107. package/dist/components/docs/integrations/IntegrationsWhatsappMetaPage.js +2 -146
  108. package/dist/components/docs/integrations/IntegrationsWhatsappTwilioPage.js +2 -156
  109. package/dist/components/docs/integrations/index.js +52 -3100
  110. package/dist/components/docs/intent/ContractFirstApiPage.js +2 -126
  111. package/dist/components/docs/intent/DeterministicCodegenPage.js +2 -148
  112. package/dist/components/docs/intent/GenerateClientFromSchemaPage.js +7 -207
  113. package/dist/components/docs/intent/OpenapiAlternativePage.js +3 -201
  114. package/dist/components/docs/intent/SchemaValidationTypescriptPage.js +4 -144
  115. package/dist/components/docs/intent/SpecDrivenDevelopmentPage.js +2 -126
  116. package/dist/components/docs/intent/index.js +15 -1135
  117. package/dist/components/docs/intent/intent-pages.docblocks.js +1 -201
  118. package/dist/components/docs/knowledge/KnowledgeCategoriesPage.js +6 -750
  119. package/dist/components/docs/knowledge/KnowledgeExamplesPage.js +4 -175
  120. package/dist/components/docs/knowledge/KnowledgeOverviewPage.js +1 -116
  121. package/dist/components/docs/knowledge/KnowledgeSourcesPage.js +8 -391
  122. package/dist/components/docs/knowledge/KnowledgeSpacesPage.js +6 -302
  123. package/dist/components/docs/knowledge/index.js +21 -1730
  124. package/dist/components/docs/libraries/LibrariesAccessibilityPage.js +3 -198
  125. package/dist/components/docs/libraries/LibrariesAiAgentPage.js +3 -141
  126. package/dist/components/docs/libraries/LibrariesAnalyticsPage.js +4 -80
  127. package/dist/components/docs/libraries/LibrariesContentGenPage.js +2 -100
  128. package/dist/components/docs/libraries/LibrariesContractsPage.js +2 -284
  129. package/dist/components/docs/libraries/LibrariesCostTrackingPage.js +3 -112
  130. package/dist/components/docs/libraries/LibrariesDataBackendPage.js +2 -166
  131. package/dist/components/docs/libraries/LibrariesDataViewsPage.js +3 -186
  132. package/dist/components/docs/libraries/LibrariesDesignSystemPage.js +4 -279
  133. package/dist/components/docs/libraries/LibrariesEvolutionPage.js +4 -127
  134. package/dist/components/docs/libraries/LibrariesGraphQLPage.js +2 -173
  135. package/dist/components/docs/libraries/LibrariesGrowthPage.js +3 -88
  136. package/dist/components/docs/libraries/LibrariesMultiTenancyPage.js +3 -108
  137. package/dist/components/docs/libraries/LibrariesObservabilityPage.js +5 -130
  138. package/dist/components/docs/libraries/LibrariesOverlayEnginePage.js +4 -110
  139. package/dist/components/docs/libraries/LibrariesOverviewPage.js +1 -170
  140. package/dist/components/docs/libraries/LibrariesPersonalizationPage.js +4 -114
  141. package/dist/components/docs/libraries/LibrariesProgressiveDeliveryPage.js +3 -132
  142. package/dist/components/docs/libraries/LibrariesResiliencePage.js +4 -120
  143. package/dist/components/docs/libraries/LibrariesRuntimePage.js +2 -200
  144. package/dist/components/docs/libraries/LibrariesSLOPage.js +3 -116
  145. package/dist/components/docs/libraries/LibrariesSchemaPage.js +3 -273
  146. package/dist/components/docs/libraries/LibrariesSupportBotPage.js +3 -134
  147. package/dist/components/docs/libraries/LibrariesTestingPage.js +3 -133
  148. package/dist/components/docs/libraries/LibrariesUIKitPage.js +2 -230
  149. package/dist/components/docs/libraries/LibrariesWorkflowComposerPage.js +3 -88
  150. package/dist/components/docs/libraries/LibrariesWorkflowsPage.js +2 -181
  151. package/dist/components/docs/libraries/index.js +54 -4147
  152. package/dist/components/docs/manifesto/ManifestoPage.js +1 -86
  153. package/dist/components/docs/ops/AutoEvolutionOpsPage.js +2 -132
  154. package/dist/components/docs/ops/DistributedTracingOpsPage.js +2 -71
  155. package/dist/components/docs/ops/index.js +3 -202
  156. package/dist/components/docs/ops/ops-lifecycle.docblocks.js +3 -38
  157. package/dist/components/docs/ops/ops-runbooks-a.docblocks.js +3 -94
  158. package/dist/components/docs/ops/ops-runbooks-b.docblocks.js +3 -76
  159. package/dist/components/docs/ops/ops-slo-tenant.docblocks.js +3 -76
  160. package/dist/components/docs/ops/ops-top.docs.js +2 -17
  161. package/dist/components/docs/ops/ops.docs.js +10 -302
  162. package/dist/components/docs/product/product.docblocks.js +5 -72
  163. package/dist/components/docs/reference/DocsMarkdownContent.js +2 -196
  164. package/dist/components/docs/reference/DocsReferenceContent.js +3 -256
  165. package/dist/components/docs/reference/DocsReferenceIndexClient.js +2 -127
  166. package/dist/components/docs/reference/DocsReferenceIndexPage.js +2 -206
  167. package/dist/components/docs/reference/DocsReferencePage.js +3 -265
  168. package/dist/components/docs/reference/docsMarkdownParser.js +2 -92
  169. package/dist/components/docs/reference/index.js +4 -470
  170. package/dist/components/docs/safety/SafetyAuditingPage.js +2 -350
  171. package/dist/components/docs/safety/SafetyMigrationsPage.js +2 -359
  172. package/dist/components/docs/safety/SafetyOverviewPage.js +1 -101
  173. package/dist/components/docs/safety/SafetyPDPPage.js +2 -301
  174. package/dist/components/docs/safety/SafetySecurityTrustPage.js +1 -206
  175. package/dist/components/docs/safety/SafetySigningPage.js +3 -90
  176. package/dist/components/docs/safety/SafetyTenantIsolationPage.js +2 -79
  177. package/dist/components/docs/safety/index.js +7 -1480
  178. package/dist/components/docs/shared/StudioPrompt.js +1 -31
  179. package/dist/components/docs/specs/SpecsBuilderControlPlanePage.d.ts +1 -0
  180. package/dist/components/docs/specs/SpecsBuilderControlPlanePage.js +34 -0
  181. package/dist/components/docs/specs/SpecsCapabilitiesPage.js +2 -158
  182. package/dist/components/docs/specs/SpecsConnectPage.d.ts +1 -0
  183. package/dist/components/docs/specs/SpecsConnectPage.js +8 -0
  184. package/dist/components/docs/specs/SpecsDataViewsPage.js +2 -260
  185. package/dist/components/docs/specs/SpecsModuleBundlesPage.d.ts +1 -0
  186. package/dist/components/docs/specs/SpecsModuleBundlesPage.js +67 -0
  187. package/dist/components/docs/specs/SpecsOverlaysPage.js +2 -372
  188. package/dist/components/docs/specs/SpecsOverviewPage.js +1 -186
  189. package/dist/components/docs/specs/SpecsPolicyPage.js +3 -420
  190. package/dist/components/docs/specs/SpecsWorkflowsPage.js +2 -325
  191. package/dist/components/docs/specs/index.d.ts +3 -0
  192. package/dist/components/docs/specs/index.js +109 -1715
  193. package/dist/components/docs/studio/StudioBYOKPage.js +1 -26
  194. package/dist/components/docs/studio/StudioDeploymentsPage.js +1 -26
  195. package/dist/components/docs/studio/StudioGettingStartedPage.js +1 -26
  196. package/dist/components/docs/studio/StudioIntegrationsPage.js +1 -26
  197. package/dist/components/docs/studio/StudioOverviewPage.js +1 -157
  198. package/dist/components/docs/studio/StudioVisualBuilderPage.js +1 -26
  199. package/dist/components/docs/studio/index.js +1 -282
  200. package/dist/components/docs/tech/contracts/tech-docs.docblocks.js +2 -19
  201. package/dist/components/integrations/index.js +2 -600
  202. package/dist/components/integrations/molecules/IntegrationCard.js +1 -100
  203. package/dist/components/integrations/organisms/IntegrationMarketplace.js +1 -214
  204. package/dist/components/integrations/organisms/IntegrationSettings.js +2 -284
  205. package/dist/components/integrations/organisms/KnowledgeSourceList.js +1 -103
  206. package/dist/components/legal/PrivacyTemplate.js +1 -1025
  207. package/dist/components/legal/TermsTemplate.js +1 -941
  208. package/dist/components/legal/index.js +1 -1963
  209. package/dist/components/shared/FeatureGateNotice.js +1 -38
  210. package/dist/components/shared/index.js +1 -38
  211. package/dist/components/shell/WorkspaceHeader.js +1 -100
  212. package/dist/components/shell/WorkspaceProjectShellLayout.js +1 -222
  213. package/dist/components/shell/WorkspaceShellRenderer.js +1 -228
  214. package/dist/components/shell/WorkspaceSidebar.js +1 -68
  215. package/dist/components/shell/index.js +1 -287
  216. package/dist/components/templates/engine/index.js +1 -39
  217. package/dist/components/templates/index.js +11 -965
  218. package/dist/components/templates/messaging/ConversationList.js +2 -83
  219. package/dist/components/templates/messaging/MessageComposer.js +4 -150
  220. package/dist/components/templates/messaging/MessageThread.js +3 -83
  221. package/dist/components/templates/messaging/MessagingWorkspace.js +5 -265
  222. package/dist/components/templates/messaging/index.js +5 -269
  223. package/dist/components/templates/recipes/LanguageSwitcher.js +1 -16
  224. package/dist/components/templates/recipes/RecipeCard.js +1 -80
  225. package/dist/components/templates/recipes/RecipeDetail.js +1 -74
  226. package/dist/components/templates/recipes/RecipeList.js +3 -245
  227. package/dist/components/templates/recipes/index.js +3 -248
  228. package/dist/components/templates/todos/FilterBar.js +1 -107
  229. package/dist/components/templates/todos/TaskForm.js +2 -158
  230. package/dist/components/templates/todos/TaskItem.js +1 -77
  231. package/dist/components/templates/todos/TaskList.js +5 -449
  232. package/dist/components/templates/todos/index.js +5 -452
  233. package/dist/config/contractspec-blueprint.js +1 -123
  234. package/dist/config/contractspec-branding.js +1 -44
  235. package/dist/config/contractspec-routes.js +1 -24
  236. package/dist/config/index.js +1 -126
  237. package/dist/features/contracts-registry.js +1 -178
  238. package/dist/features/docs/docs.contracts.js +1 -17
  239. package/dist/features/docs/index.js +1 -17
  240. package/dist/features/docs.feature.js +1 -33
  241. package/dist/features/index.js +1 -315
  242. package/dist/features/mcp.feature.js +1 -30
  243. package/dist/features/presentations.feature.js +1 -33
  244. package/dist/features/registry.js +1 -116
  245. package/dist/index.js +556 -28593
  246. package/dist/infrastructure/elysia/index.js +1 -35
  247. package/dist/infrastructure/elysia/logger.js +1 -35
  248. package/dist/infrastructure/index.js +1 -35
  249. package/dist/libs/email/client.js +1 -114
  250. package/dist/libs/email/contact.js +12 -165
  251. package/dist/libs/email/newsletter.js +6 -167
  252. package/dist/libs/email/types.js +0 -2
  253. package/dist/libs/email/utils.js +2 -8
  254. package/dist/libs/email/waitlist-application.js +28 -209
  255. package/dist/libs/email/waitlist.js +6 -167
  256. package/dist/libs/email.js +46 -363
  257. package/dist/libs/posthog/client.js +1 -63
  258. package/dist/libs/posthog/native.js +1 -23
  259. package/dist/libs/posthog/server.js +1 -13
  260. package/dist/libs/pricing-examples.js +1 -18
  261. package/dist/node/application/context-storage/index.js +1 -28
  262. package/dist/node/application/index.js +13 -2133
  263. package/dist/node/application/mcp/cliMcp.js +4 -452
  264. package/dist/node/application/mcp/common.js +1 -193
  265. package/dist/node/application/mcp/contractsMcp.js +2 -549
  266. package/dist/node/application/mcp/contractsMcpResources.js +2 -123
  267. package/dist/node/application/mcp/contractsMcpTools.js +1 -199
  268. package/dist/node/application/mcp/docsMcp.catalog.js +3 -381
  269. package/dist/node/application/mcp/docsMcp.data.js +1 -147
  270. package/dist/node/application/mcp/docsMcp.js +6 -1039
  271. package/dist/node/application/mcp/docsMcp.prompts.js +6 -521
  272. package/dist/node/application/mcp/docsMcp.reference.js +3 -235
  273. package/dist/node/application/mcp/docsMcp.resources.js +3 -519
  274. package/dist/node/application/mcp/docsMcp.tools.js +3 -518
  275. package/dist/node/application/mcp/index.js +13 -2106
  276. package/dist/node/application/mcp/internalMcp.js +2 -410
  277. package/dist/node/application/mcp/normalizeMcpRequest.js +1 -21
  278. package/dist/node/application/mcp/providerRankingMcp.js +1 -530
  279. package/dist/node/bundles/LibraryBundle.js +1 -138
  280. package/dist/node/bundles/index.js +1 -138
  281. package/dist/node/components/docs/DocsIndexPage.js +2 -912
  282. package/dist/node/components/docs/advanced/AdvancedMCPPage.js +4 -271
  283. package/dist/node/components/docs/advanced/AdvancedOverlayEditorPage.js +1 -107
  284. package/dist/node/components/docs/advanced/AdvancedRenderersPage.js +2 -118
  285. package/dist/node/components/docs/advanced/AdvancedSpecExperimentsPage.js +4 -92
  286. package/dist/node/components/docs/advanced/AdvancedTelemetryPage.js +2 -373
  287. package/dist/node/components/docs/advanced/AdvancedWorkflowMonitoringPage.js +2 -99
  288. package/dist/node/components/docs/advanced/index.js +10 -1055
  289. package/dist/node/components/docs/architecture/ArchitectureAppConfigPage.js +6 -243
  290. package/dist/node/components/docs/architecture/ArchitectureControlPlanePage.js +3 -160
  291. package/dist/node/components/docs/architecture/ArchitectureIntegrationBindingPage.js +7 -259
  292. package/dist/node/components/docs/architecture/ArchitectureKnowledgeBindingPage.js +6 -374
  293. package/dist/node/components/docs/architecture/ArchitectureMultiTenancyPage.js +2 -166
  294. package/dist/node/components/docs/architecture/ArchitectureOverviewPage.js +1 -143
  295. package/dist/node/components/docs/architecture/index.js +20 -1340
  296. package/dist/node/components/docs/comparison/ComparisonAutomationPlatformsPage.js +1 -245
  297. package/dist/node/components/docs/comparison/ComparisonEnterprisePlatformsPage.js +1 -230
  298. package/dist/node/components/docs/comparison/ComparisonInternalToolBuildersPage.js +1 -245
  299. package/dist/node/components/docs/comparison/ComparisonOverviewPage.js +1 -202
  300. package/dist/node/components/docs/comparison/ComparisonWindmillPage.js +1 -254
  301. package/dist/node/components/docs/comparison/ComparisonWorkflowEnginesPage.js +1 -339
  302. package/dist/node/components/docs/comparison/index.js +1 -1510
  303. package/dist/node/components/docs/docsManifest.js +1 -611
  304. package/dist/node/components/docs/ecosystem/IntegrationsPage.js +2 -103
  305. package/dist/node/components/docs/ecosystem/PluginsPage.js +13 -179
  306. package/dist/node/components/docs/ecosystem/RegistryPage.js +7 -100
  307. package/dist/node/components/docs/ecosystem/TemplatesPage.js +3 -141
  308. package/dist/node/components/docs/ecosystem/ecosystem.docblocks.js +2 -48
  309. package/dist/node/components/docs/ecosystem/index.js +23 -569
  310. package/dist/node/components/docs/examples/DocsExamplesPage.js +4 -124
  311. package/dist/node/components/docs/examples/ExampleShowcasePage.js +4 -244
  312. package/dist/node/components/docs/examples/exampleShowcaseData.js +4 -39
  313. package/dist/node/components/docs/examples/index.js +4 -330
  314. package/dist/node/components/docs/generated/docs-index.generated.js +1 -5
  315. package/dist/node/components/docs/generated/index.js +1 -74
  316. package/dist/node/components/docs/generated/loader.js +1 -74
  317. package/dist/node/components/docs/getting-started/CLIPage.js +4 -271
  318. package/dist/node/components/docs/getting-started/CompatibilityPage.js +1 -173
  319. package/dist/node/components/docs/getting-started/DataViewTutorialPage.js +4 -134
  320. package/dist/node/components/docs/getting-started/DeveloperToolsPage.js +1 -194
  321. package/dist/node/components/docs/getting-started/HelloWorldPage.js +5 -183
  322. package/dist/node/components/docs/getting-started/InstallationPage.js +3 -154
  323. package/dist/node/components/docs/getting-started/StartHerePage.js +2 -129
  324. package/dist/node/components/docs/getting-started/TroubleshootingPage.js +2 -168
  325. package/dist/node/components/docs/getting-started/VSCodeExtensionPage.js +1 -432
  326. package/dist/node/components/docs/getting-started/getting-started.docblocks.js +4 -41
  327. package/dist/node/components/docs/getting-started/index.js +18 -1869
  328. package/dist/node/components/docs/guides/GuideCIDiffGatingPage.js +2 -196
  329. package/dist/node/components/docs/guides/GuideConnectInRepoPage.js +43 -0
  330. package/dist/node/components/docs/guides/GuideContractTypesPage.js +6 -541
  331. package/dist/node/components/docs/guides/GuideDocsPipelinePage.js +3 -207
  332. package/dist/node/components/docs/guides/GuideFirstModuleBundlePage.js +75 -0
  333. package/dist/node/components/docs/guides/GuideGenerateDocsClientsSchemasPage.js +2 -209
  334. package/dist/node/components/docs/guides/GuideHostBuilderWorkbenchPage.js +69 -0
  335. package/dist/node/components/docs/guides/GuideImportExistingCodebasesPage.js +8 -754
  336. package/dist/node/components/docs/guides/GuideNextjsOneEndpointPage.js +6 -268
  337. package/dist/node/components/docs/guides/GuideSpecValidationTypingPage.js +4 -196
  338. package/dist/node/components/docs/guides/GuidesIndexPage.js +2 -169
  339. package/dist/node/components/docs/guides/guides.docblocks.js +11 -75
  340. package/dist/node/components/docs/guides/index.js +213 -2428
  341. package/dist/node/components/docs/index.js +542 -24310
  342. package/dist/node/components/docs/integrations/IntegrationsCircuitBreakersPage.js +2 -42
  343. package/dist/node/components/docs/integrations/IntegrationsElevenLabsPage.js +3 -105
  344. package/dist/node/components/docs/integrations/IntegrationsGithubPage.js +3 -142
  345. package/dist/node/components/docs/integrations/IntegrationsGmailPage.js +3 -109
  346. package/dist/node/components/docs/integrations/IntegrationsGoogleCalendarPage.js +3 -79
  347. package/dist/node/components/docs/integrations/IntegrationsHealthRoutingPage.js +3 -146
  348. package/dist/node/components/docs/integrations/IntegrationsMistralPage.js +5 -150
  349. package/dist/node/components/docs/integrations/IntegrationsOpenAIPage.js +5 -140
  350. package/dist/node/components/docs/integrations/IntegrationsOverviewPage.js +1 -160
  351. package/dist/node/components/docs/integrations/IntegrationsPostmarkPage.js +4 -218
  352. package/dist/node/components/docs/integrations/IntegrationsPowensPage.js +4 -300
  353. package/dist/node/components/docs/integrations/IntegrationsQdrantPage.js +5 -111
  354. package/dist/node/components/docs/integrations/IntegrationsResendPage.js +3 -102
  355. package/dist/node/components/docs/integrations/IntegrationsS3Page.js +4 -124
  356. package/dist/node/components/docs/integrations/IntegrationsSlackPage.js +3 -144
  357. package/dist/node/components/docs/integrations/IntegrationsSpecModelPage.js +7 -290
  358. package/dist/node/components/docs/integrations/IntegrationsStripePage.js +6 -327
  359. package/dist/node/components/docs/integrations/IntegrationsTwilioPage.js +3 -128
  360. package/dist/node/components/docs/integrations/IntegrationsWhatsappMetaPage.js +2 -146
  361. package/dist/node/components/docs/integrations/IntegrationsWhatsappTwilioPage.js +2 -156
  362. package/dist/node/components/docs/integrations/index.js +52 -3100
  363. package/dist/node/components/docs/intent/ContractFirstApiPage.js +2 -126
  364. package/dist/node/components/docs/intent/DeterministicCodegenPage.js +2 -148
  365. package/dist/node/components/docs/intent/GenerateClientFromSchemaPage.js +7 -207
  366. package/dist/node/components/docs/intent/OpenapiAlternativePage.js +3 -201
  367. package/dist/node/components/docs/intent/SchemaValidationTypescriptPage.js +4 -144
  368. package/dist/node/components/docs/intent/SpecDrivenDevelopmentPage.js +2 -126
  369. package/dist/node/components/docs/intent/index.js +15 -1135
  370. package/dist/node/components/docs/intent/intent-pages.docblocks.js +1 -201
  371. package/dist/node/components/docs/knowledge/KnowledgeCategoriesPage.js +6 -750
  372. package/dist/node/components/docs/knowledge/KnowledgeExamplesPage.js +4 -175
  373. package/dist/node/components/docs/knowledge/KnowledgeOverviewPage.js +1 -116
  374. package/dist/node/components/docs/knowledge/KnowledgeSourcesPage.js +8 -391
  375. package/dist/node/components/docs/knowledge/KnowledgeSpacesPage.js +6 -302
  376. package/dist/node/components/docs/knowledge/index.js +21 -1730
  377. package/dist/node/components/docs/libraries/LibrariesAccessibilityPage.js +3 -198
  378. package/dist/node/components/docs/libraries/LibrariesAiAgentPage.js +3 -141
  379. package/dist/node/components/docs/libraries/LibrariesAnalyticsPage.js +4 -80
  380. package/dist/node/components/docs/libraries/LibrariesContentGenPage.js +2 -100
  381. package/dist/node/components/docs/libraries/LibrariesContractsPage.js +2 -284
  382. package/dist/node/components/docs/libraries/LibrariesCostTrackingPage.js +3 -112
  383. package/dist/node/components/docs/libraries/LibrariesDataBackendPage.js +2 -166
  384. package/dist/node/components/docs/libraries/LibrariesDataViewsPage.js +3 -186
  385. package/dist/node/components/docs/libraries/LibrariesDesignSystemPage.js +4 -279
  386. package/dist/node/components/docs/libraries/LibrariesEvolutionPage.js +4 -127
  387. package/dist/node/components/docs/libraries/LibrariesGraphQLPage.js +2 -173
  388. package/dist/node/components/docs/libraries/LibrariesGrowthPage.js +3 -88
  389. package/dist/node/components/docs/libraries/LibrariesMultiTenancyPage.js +3 -108
  390. package/dist/node/components/docs/libraries/LibrariesObservabilityPage.js +5 -130
  391. package/dist/node/components/docs/libraries/LibrariesOverlayEnginePage.js +4 -110
  392. package/dist/node/components/docs/libraries/LibrariesOverviewPage.js +1 -170
  393. package/dist/node/components/docs/libraries/LibrariesPersonalizationPage.js +4 -114
  394. package/dist/node/components/docs/libraries/LibrariesProgressiveDeliveryPage.js +3 -132
  395. package/dist/node/components/docs/libraries/LibrariesResiliencePage.js +4 -120
  396. package/dist/node/components/docs/libraries/LibrariesRuntimePage.js +2 -200
  397. package/dist/node/components/docs/libraries/LibrariesSLOPage.js +3 -116
  398. package/dist/node/components/docs/libraries/LibrariesSchemaPage.js +3 -273
  399. package/dist/node/components/docs/libraries/LibrariesSupportBotPage.js +3 -134
  400. package/dist/node/components/docs/libraries/LibrariesTestingPage.js +3 -133
  401. package/dist/node/components/docs/libraries/LibrariesUIKitPage.js +2 -230
  402. package/dist/node/components/docs/libraries/LibrariesWorkflowComposerPage.js +3 -88
  403. package/dist/node/components/docs/libraries/LibrariesWorkflowsPage.js +2 -181
  404. package/dist/node/components/docs/libraries/index.js +54 -4147
  405. package/dist/node/components/docs/manifesto/ManifestoPage.js +1 -86
  406. package/dist/node/components/docs/ops/AutoEvolutionOpsPage.js +2 -132
  407. package/dist/node/components/docs/ops/DistributedTracingOpsPage.js +2 -71
  408. package/dist/node/components/docs/ops/index.js +3 -202
  409. package/dist/node/components/docs/ops/ops-lifecycle.docblocks.js +3 -38
  410. package/dist/node/components/docs/ops/ops-runbooks-a.docblocks.js +3 -94
  411. package/dist/node/components/docs/ops/ops-runbooks-b.docblocks.js +3 -76
  412. package/dist/node/components/docs/ops/ops-slo-tenant.docblocks.js +3 -76
  413. package/dist/node/components/docs/ops/ops-top.docs.js +2 -17
  414. package/dist/node/components/docs/ops/ops.docs.js +10 -302
  415. package/dist/node/components/docs/product/product.docblocks.js +5 -72
  416. package/dist/node/components/docs/reference/DocsMarkdownContent.js +2 -196
  417. package/dist/node/components/docs/reference/DocsReferenceContent.js +3 -256
  418. package/dist/node/components/docs/reference/DocsReferenceIndexClient.js +2 -127
  419. package/dist/node/components/docs/reference/DocsReferenceIndexPage.js +2 -206
  420. package/dist/node/components/docs/reference/DocsReferencePage.js +3 -265
  421. package/dist/node/components/docs/reference/docsMarkdownParser.js +2 -92
  422. package/dist/node/components/docs/reference/index.js +4 -470
  423. package/dist/node/components/docs/safety/SafetyAuditingPage.js +2 -350
  424. package/dist/node/components/docs/safety/SafetyMigrationsPage.js +2 -359
  425. package/dist/node/components/docs/safety/SafetyOverviewPage.js +1 -101
  426. package/dist/node/components/docs/safety/SafetyPDPPage.js +2 -301
  427. package/dist/node/components/docs/safety/SafetySecurityTrustPage.js +1 -206
  428. package/dist/node/components/docs/safety/SafetySigningPage.js +3 -90
  429. package/dist/node/components/docs/safety/SafetyTenantIsolationPage.js +2 -79
  430. package/dist/node/components/docs/safety/index.js +7 -1480
  431. package/dist/node/components/docs/shared/StudioPrompt.js +1 -31
  432. package/dist/node/components/docs/specs/SpecsBuilderControlPlanePage.js +33 -0
  433. package/dist/node/components/docs/specs/SpecsCapabilitiesPage.js +2 -158
  434. package/dist/node/components/docs/specs/SpecsConnectPage.js +7 -0
  435. package/dist/node/components/docs/specs/SpecsDataViewsPage.js +2 -260
  436. package/dist/node/components/docs/specs/SpecsModuleBundlesPage.js +66 -0
  437. package/dist/node/components/docs/specs/SpecsOverlaysPage.js +2 -372
  438. package/dist/node/components/docs/specs/SpecsOverviewPage.js +1 -186
  439. package/dist/node/components/docs/specs/SpecsPolicyPage.js +3 -420
  440. package/dist/node/components/docs/specs/SpecsWorkflowsPage.js +2 -325
  441. package/dist/node/components/docs/specs/index.js +109 -1715
  442. package/dist/node/components/docs/studio/StudioBYOKPage.js +1 -26
  443. package/dist/node/components/docs/studio/StudioDeploymentsPage.js +1 -26
  444. package/dist/node/components/docs/studio/StudioGettingStartedPage.js +1 -26
  445. package/dist/node/components/docs/studio/StudioIntegrationsPage.js +1 -26
  446. package/dist/node/components/docs/studio/StudioOverviewPage.js +1 -157
  447. package/dist/node/components/docs/studio/StudioVisualBuilderPage.js +1 -26
  448. package/dist/node/components/docs/studio/index.js +1 -282
  449. package/dist/node/components/docs/tech/contracts/tech-docs.docblocks.js +2 -19
  450. package/dist/node/components/integrations/index.js +2 -600
  451. package/dist/node/components/integrations/molecules/IntegrationCard.js +1 -100
  452. package/dist/node/components/integrations/organisms/IntegrationMarketplace.js +1 -214
  453. package/dist/node/components/integrations/organisms/IntegrationSettings.js +2 -284
  454. package/dist/node/components/integrations/organisms/KnowledgeSourceList.js +1 -103
  455. package/dist/node/components/legal/PrivacyTemplate.js +1 -1025
  456. package/dist/node/components/legal/TermsTemplate.js +1 -941
  457. package/dist/node/components/legal/index.js +1 -1963
  458. package/dist/node/components/shared/FeatureGateNotice.js +1 -38
  459. package/dist/node/components/shared/index.js +1 -38
  460. package/dist/node/components/shell/WorkspaceHeader.js +1 -100
  461. package/dist/node/components/shell/WorkspaceProjectShellLayout.js +1 -222
  462. package/dist/node/components/shell/WorkspaceShellRenderer.js +1 -228
  463. package/dist/node/components/shell/WorkspaceSidebar.js +1 -68
  464. package/dist/node/components/shell/index.js +1 -287
  465. package/dist/node/components/templates/engine/index.js +1 -39
  466. package/dist/node/components/templates/index.js +11 -965
  467. package/dist/node/components/templates/messaging/ConversationList.js +2 -83
  468. package/dist/node/components/templates/messaging/MessageComposer.js +4 -150
  469. package/dist/node/components/templates/messaging/MessageThread.js +3 -83
  470. package/dist/node/components/templates/messaging/MessagingWorkspace.js +5 -265
  471. package/dist/node/components/templates/messaging/index.js +5 -269
  472. package/dist/node/components/templates/recipes/LanguageSwitcher.js +1 -16
  473. package/dist/node/components/templates/recipes/RecipeCard.js +1 -80
  474. package/dist/node/components/templates/recipes/RecipeDetail.js +1 -74
  475. package/dist/node/components/templates/recipes/RecipeList.js +3 -245
  476. package/dist/node/components/templates/recipes/index.js +3 -248
  477. package/dist/node/components/templates/todos/FilterBar.js +1 -107
  478. package/dist/node/components/templates/todos/TaskForm.js +2 -158
  479. package/dist/node/components/templates/todos/TaskItem.js +1 -77
  480. package/dist/node/components/templates/todos/TaskList.js +5 -449
  481. package/dist/node/components/templates/todos/index.js +5 -452
  482. package/dist/node/config/contractspec-blueprint.js +1 -123
  483. package/dist/node/config/contractspec-branding.js +1 -44
  484. package/dist/node/config/contractspec-routes.js +1 -24
  485. package/dist/node/config/index.js +1 -126
  486. package/dist/node/features/contracts-registry.js +1 -178
  487. package/dist/node/features/docs/docs.contracts.js +1 -17
  488. package/dist/node/features/docs/index.js +1 -17
  489. package/dist/node/features/docs.feature.js +1 -33
  490. package/dist/node/features/index.js +1 -315
  491. package/dist/node/features/mcp.feature.js +1 -30
  492. package/dist/node/features/presentations.feature.js +1 -33
  493. package/dist/node/features/registry.js +1 -116
  494. package/dist/node/index.js +556 -28593
  495. package/dist/node/infrastructure/elysia/index.js +1 -35
  496. package/dist/node/infrastructure/elysia/logger.js +1 -35
  497. package/dist/node/infrastructure/index.js +1 -35
  498. package/dist/node/libs/email/client.js +1 -114
  499. package/dist/node/libs/email/contact.js +12 -165
  500. package/dist/node/libs/email/newsletter.js +6 -167
  501. package/dist/node/libs/email/types.js +0 -2
  502. package/dist/node/libs/email/utils.js +2 -8
  503. package/dist/node/libs/email/waitlist-application.js +28 -209
  504. package/dist/node/libs/email/waitlist.js +6 -167
  505. package/dist/node/libs/email.js +46 -363
  506. package/dist/node/libs/posthog/client.js +1 -63
  507. package/dist/node/libs/posthog/native.js +1 -23
  508. package/dist/node/libs/posthog/server.js +1 -13
  509. package/dist/node/libs/pricing-examples.js +1 -18
  510. package/dist/node/presentation/features/atoms/FeatureIcon/FeatureIcon.js +1 -97
  511. package/dist/node/presentation/features/atoms/FeatureIcon/index.js +1 -97
  512. package/dist/node/presentation/features/atoms/index.js +1 -97
  513. package/dist/node/presentation/features/hooks/index.js +1 -397
  514. package/dist/node/presentation/features/hooks/useContractsRegistry.js +1 -289
  515. package/dist/node/presentation/features/hooks/useFeatureFilters.js +1 -75
  516. package/dist/node/presentation/features/hooks/useFeatureRegistry.js +1 -147
  517. package/dist/node/presentation/features/hooks/useRelatedDocs.js +1 -28
  518. package/dist/node/presentation/features/index.js +1 -3063
  519. package/dist/node/presentation/features/molecules/FeatureCard/FeatureCard.js +1 -366
  520. package/dist/node/presentation/features/molecules/FeatureCard/index.js +1 -366
  521. package/dist/node/presentation/features/molecules/FeatureCategoryHeader/FeatureCategoryHeader.js +1 -50
  522. package/dist/node/presentation/features/molecules/FeatureCategoryHeader/index.js +1 -50
  523. package/dist/node/presentation/features/molecules/FeatureFilters/FeatureFilters.js +1 -92
  524. package/dist/node/presentation/features/molecules/FeatureFilters/index.js +1 -92
  525. package/dist/node/presentation/features/molecules/FeatureHoverPreview/FeatureHoverPreview.js +1 -176
  526. package/dist/node/presentation/features/molecules/FeatureHoverPreview/index.js +1 -176
  527. package/dist/node/presentation/features/molecules/index.js +1 -505
  528. package/dist/node/presentation/features/organisms/FeatureDataViewsList.js +1 -304
  529. package/dist/node/presentation/features/organisms/FeatureDetail/FeatureDetail.js +1 -154
  530. package/dist/node/presentation/features/organisms/FeatureDetail/index.js +1 -154
  531. package/dist/node/presentation/features/organisms/FeatureDiscovery/FeatureDiscovery.js +1 -909
  532. package/dist/node/presentation/features/organisms/FeatureDiscovery/index.js +1 -909
  533. package/dist/node/presentation/features/organisms/FeatureEventsList.js +1 -302
  534. package/dist/node/presentation/features/organisms/FeatureFormsList.js +1 -302
  535. package/dist/node/presentation/features/organisms/FeatureOperationsList.js +1 -180
  536. package/dist/node/presentation/features/organisms/FeaturePresentationsList.js +1 -304
  537. package/dist/node/presentation/features/organisms/index.js +1 -1359
  538. package/dist/node/presentation/features/templates/FeatureDataViewDetailTemplate/FeatureDataViewDetailTemplate.js +1 -332
  539. package/dist/node/presentation/features/templates/FeatureDataViewDetailTemplate/index.js +1 -332
  540. package/dist/node/presentation/features/templates/FeatureDataViewsTemplate/FeatureDataViewsTemplate.js +1 -342
  541. package/dist/node/presentation/features/templates/FeatureDataViewsTemplate/index.js +1 -342
  542. package/dist/node/presentation/features/templates/FeatureEventDetailTemplate/FeatureEventDetailTemplate.js +1 -303
  543. package/dist/node/presentation/features/templates/FeatureEventDetailTemplate/index.js +1 -303
  544. package/dist/node/presentation/features/templates/FeatureEventsTemplate/FeatureEventsTemplate.js +1 -340
  545. package/dist/node/presentation/features/templates/FeatureEventsTemplate/index.js +1 -340
  546. package/dist/node/presentation/features/templates/FeatureFormDetailTemplate/FeatureFormDetailTemplate.js +1 -329
  547. package/dist/node/presentation/features/templates/FeatureFormDetailTemplate/index.js +1 -329
  548. package/dist/node/presentation/features/templates/FeatureFormsTemplate/FeatureFormsTemplate.js +1 -340
  549. package/dist/node/presentation/features/templates/FeatureFormsTemplate/index.js +1 -340
  550. package/dist/node/presentation/features/templates/FeatureOperationDetailTemplate/FeatureOperationDetailTemplate.js +1 -302
  551. package/dist/node/presentation/features/templates/FeatureOperationDetailTemplate/index.js +1 -302
  552. package/dist/node/presentation/features/templates/FeatureOperationsTemplate/FeatureOperationsTemplate.js +1 -218
  553. package/dist/node/presentation/features/templates/FeatureOperationsTemplate/index.js +1 -218
  554. package/dist/node/presentation/features/templates/FeatureOverviewTemplate/FeatureOverviewTemplate.js +1 -187
  555. package/dist/node/presentation/features/templates/FeatureOverviewTemplate/index.js +1 -187
  556. package/dist/node/presentation/features/templates/FeaturePresentationDetailTemplate/FeaturePresentationDetailTemplate.js +1 -306
  557. package/dist/node/presentation/features/templates/FeaturePresentationDetailTemplate/index.js +1 -306
  558. package/dist/node/presentation/features/templates/FeaturePresentationsTemplate/FeaturePresentationsTemplate.js +1 -342
  559. package/dist/node/presentation/features/templates/FeaturePresentationsTemplate/index.js +1 -342
  560. package/dist/presentation/features/atoms/FeatureIcon/FeatureIcon.js +1 -97
  561. package/dist/presentation/features/atoms/FeatureIcon/index.js +1 -97
  562. package/dist/presentation/features/atoms/index.js +1 -97
  563. package/dist/presentation/features/hooks/index.js +1 -397
  564. package/dist/presentation/features/hooks/useContractsRegistry.js +1 -289
  565. package/dist/presentation/features/hooks/useFeatureFilters.js +1 -75
  566. package/dist/presentation/features/hooks/useFeatureRegistry.js +1 -147
  567. package/dist/presentation/features/hooks/useRelatedDocs.js +1 -28
  568. package/dist/presentation/features/index.js +1 -3063
  569. package/dist/presentation/features/molecules/FeatureCard/FeatureCard.js +1 -366
  570. package/dist/presentation/features/molecules/FeatureCard/index.js +1 -366
  571. package/dist/presentation/features/molecules/FeatureCategoryHeader/FeatureCategoryHeader.js +1 -50
  572. package/dist/presentation/features/molecules/FeatureCategoryHeader/index.js +1 -50
  573. package/dist/presentation/features/molecules/FeatureFilters/FeatureFilters.js +1 -92
  574. package/dist/presentation/features/molecules/FeatureFilters/index.js +1 -92
  575. package/dist/presentation/features/molecules/FeatureHoverPreview/FeatureHoverPreview.js +1 -176
  576. package/dist/presentation/features/molecules/FeatureHoverPreview/index.js +1 -176
  577. package/dist/presentation/features/molecules/index.js +1 -505
  578. package/dist/presentation/features/organisms/FeatureDataViewsList.js +1 -304
  579. package/dist/presentation/features/organisms/FeatureDetail/FeatureDetail.js +1 -154
  580. package/dist/presentation/features/organisms/FeatureDetail/index.js +1 -154
  581. package/dist/presentation/features/organisms/FeatureDiscovery/FeatureDiscovery.js +1 -909
  582. package/dist/presentation/features/organisms/FeatureDiscovery/index.js +1 -909
  583. package/dist/presentation/features/organisms/FeatureEventsList.js +1 -302
  584. package/dist/presentation/features/organisms/FeatureFormsList.js +1 -302
  585. package/dist/presentation/features/organisms/FeatureOperationsList.js +1 -180
  586. package/dist/presentation/features/organisms/FeaturePresentationsList.js +1 -304
  587. package/dist/presentation/features/organisms/index.js +1 -1359
  588. package/dist/presentation/features/templates/FeatureDataViewDetailTemplate/FeatureDataViewDetailTemplate.js +1 -332
  589. package/dist/presentation/features/templates/FeatureDataViewDetailTemplate/index.js +1 -332
  590. package/dist/presentation/features/templates/FeatureDataViewsTemplate/FeatureDataViewsTemplate.js +1 -342
  591. package/dist/presentation/features/templates/FeatureDataViewsTemplate/index.js +1 -342
  592. package/dist/presentation/features/templates/FeatureEventDetailTemplate/FeatureEventDetailTemplate.js +1 -303
  593. package/dist/presentation/features/templates/FeatureEventDetailTemplate/index.js +1 -303
  594. package/dist/presentation/features/templates/FeatureEventsTemplate/FeatureEventsTemplate.js +1 -340
  595. package/dist/presentation/features/templates/FeatureEventsTemplate/index.js +1 -340
  596. package/dist/presentation/features/templates/FeatureFormDetailTemplate/FeatureFormDetailTemplate.js +1 -329
  597. package/dist/presentation/features/templates/FeatureFormDetailTemplate/index.js +1 -329
  598. package/dist/presentation/features/templates/FeatureFormsTemplate/FeatureFormsTemplate.js +1 -340
  599. package/dist/presentation/features/templates/FeatureFormsTemplate/index.js +1 -340
  600. package/dist/presentation/features/templates/FeatureOperationDetailTemplate/FeatureOperationDetailTemplate.js +1 -302
  601. package/dist/presentation/features/templates/FeatureOperationDetailTemplate/index.js +1 -302
  602. package/dist/presentation/features/templates/FeatureOperationsTemplate/FeatureOperationsTemplate.js +1 -218
  603. package/dist/presentation/features/templates/FeatureOperationsTemplate/index.js +1 -218
  604. package/dist/presentation/features/templates/FeatureOverviewTemplate/FeatureOverviewTemplate.js +1 -187
  605. package/dist/presentation/features/templates/FeatureOverviewTemplate/index.js +1 -187
  606. package/dist/presentation/features/templates/FeaturePresentationDetailTemplate/FeaturePresentationDetailTemplate.js +1 -306
  607. package/dist/presentation/features/templates/FeaturePresentationDetailTemplate/index.js +1 -306
  608. package/dist/presentation/features/templates/FeaturePresentationsTemplate/FeaturePresentationsTemplate.js +1 -342
  609. package/dist/presentation/features/templates/FeaturePresentationsTemplate/index.js +1 -342
  610. package/package.json +103 -31
  611. package/src/components/docs/DocsIndexPage.tsx +55 -0
  612. package/src/components/docs/architecture/ArchitectureControlPlanePage.tsx +19 -0
  613. package/src/components/docs/architecture/ArchitectureOverviewPage.tsx +34 -0
  614. package/src/components/docs/docsManifest.test.ts +70 -0
  615. package/src/components/docs/docsManifest.ts +71 -1
  616. package/src/components/docs/ecosystem/PluginsPage.tsx +24 -10
  617. package/src/components/docs/ecosystem/RegistryPage.tsx +11 -6
  618. package/src/components/docs/generated/docs-index._common.json +206 -273
  619. package/src/components/docs/generated/docs-index.control-plane.json +18 -0
  620. package/src/components/docs/generated/docs-index.defineExample.json +10 -0
  621. package/src/components/docs/generated/docs-index.manifest.json +22 -12
  622. package/src/components/docs/generated/docs-index.platform-acp.json +64 -0
  623. package/src/components/docs/generated/docs-index.platform-agent.json +89 -1
  624. package/src/components/docs/generated/docs-index.platform-context.json +48 -0
  625. package/src/components/docs/generated/docs-index.platform-control-plane.json +72 -0
  626. package/src/components/docs/generated/docs-index.platform-database.json +40 -0
  627. package/src/components/docs/generated/docs-index.platform-docs.json +64 -0
  628. package/src/components/docs/generated/docs-index.platform-provider-ranking.json +89 -1
  629. package/src/components/docs/generated/docs-index.pocket-family-office.json +8 -0
  630. package/src/components/docs/generated/docs-index.unknown.json +8 -0
  631. package/src/components/docs/guides/GuideConnectInRepoPage.tsx +184 -0
  632. package/src/components/docs/guides/GuideFirstModuleBundlePage.tsx +182 -0
  633. package/src/components/docs/guides/GuideHostBuilderWorkbenchPage.tsx +230 -0
  634. package/src/components/docs/guides/GuidesIndexPage.tsx +21 -0
  635. package/src/components/docs/guides/index.ts +3 -0
  636. package/src/components/docs/specs/SpecsBuilderControlPlanePage.tsx +210 -0
  637. package/src/components/docs/specs/SpecsConnectPage.tsx +162 -0
  638. package/src/components/docs/specs/SpecsModuleBundlesPage.tsx +223 -0
  639. package/src/components/docs/specs/SpecsOverlaysPage.tsx +20 -0
  640. package/src/components/docs/specs/SpecsOverviewPage.tsx +44 -0
  641. package/src/components/docs/specs/index.ts +3 -0
  642. package/src/components/docs/studio/StudioOverviewPage.tsx +26 -0
  643. package/src/infrastructure/elysia/logger.ts +11 -3
@@ -1,1039 +1,6 @@
1
- // src/infrastructure/elysia/logger.ts
2
- import { Logger, LogLevel } from "@contractspec/lib.logger";
3
- var createAppLogger = () => new Logger({
4
- level: LogLevel.INFO,
5
- environment: "production",
6
- enableTracing: true,
7
- enableTiming: true,
8
- enableContext: true,
9
- enableColors: false
10
- });
11
- var appLogger = createAppLogger();
12
- var dbLogger = new Logger({
13
- level: LogLevel.WARN,
14
- environment: "production",
15
- enableTracing: true,
16
- enableTiming: true,
17
- enableContext: true,
18
- enableColors: false
19
- });
20
- var authLogger = new Logger({
21
- level: LogLevel.INFO,
22
- environment: "production",
23
- enableTracing: true,
24
- enableTiming: true,
25
- enableContext: true,
26
- enableColors: false
27
- });
28
- // src/application/mcp/normalizeMcpRequest.ts
29
- var REQUIRED_ACCEPT_TYPES = ["application/json", "text/event-stream"];
30
- function canNormalizeAcceptHeader(acceptHeader) {
31
- return !acceptHeader || acceptHeader.includes("*/*") || acceptHeader.includes("application/*") || REQUIRED_ACCEPT_TYPES.some((value) => acceptHeader.includes(value));
32
- }
33
- function normalizeMcpRequest(request) {
34
- if (request.method !== "POST")
35
- return request;
36
- const acceptHeader = request.headers.get("accept");
37
- if (!canNormalizeAcceptHeader(acceptHeader))
38
- return request;
39
- const missingTypes = REQUIRED_ACCEPT_TYPES.filter((value) => !acceptHeader?.includes(value));
40
- if (missingTypes.length === 0)
41
- return request;
42
- const headers = new Headers(request.headers);
43
- headers.set("accept", [acceptHeader, ...missingTypes].filter(Boolean).join(", "));
44
- return new Request(request, { headers });
45
- }
46
-
47
- // src/application/mcp/common.ts
48
- import { createMcpServer } from "@contractspec/lib.contracts-runtime-server-mcp/provider-mcp";
49
- import { PresentationRegistry } from "@contractspec/lib.contracts-spec/presentations";
50
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
51
- import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
52
- import { randomUUID } from "crypto";
53
- import { Elysia } from "elysia";
54
- var baseCtx = {
55
- actor: "anonymous",
56
- decide: async () => ({ effect: "allow" })
57
- };
58
- function createJsonRpcErrorResponse(status, code, message, data) {
59
- return new Response(JSON.stringify({
60
- jsonrpc: "2.0",
61
- error: {
62
- code,
63
- message,
64
- ...data ? { data } : {}
65
- },
66
- id: null
67
- }), {
68
- status,
69
- headers: {
70
- "content-type": "application/json"
71
- }
72
- });
73
- }
74
- function createSessionState({
75
- logger,
76
- serverName,
77
- ops,
78
- resources,
79
- prompts,
80
- presentations,
81
- stateful
82
- }) {
83
- const server = new McpServer({
84
- name: serverName,
85
- version: "1.0.0"
86
- }, {
87
- capabilities: {
88
- tools: {},
89
- resources: {},
90
- prompts: {},
91
- logging: {}
92
- }
93
- });
94
- logger.info("Setting up MCP server...");
95
- createMcpServer(server, ops, resources, prompts, {
96
- logger,
97
- toolCtx: () => baseCtx,
98
- promptCtx: () => ({ locale: "en" }),
99
- resourceCtx: () => ({ locale: "en" }),
100
- presentations: new PresentationRegistry(presentations)
101
- });
102
- const transport = new WebStandardStreamableHTTPServerTransport({
103
- sessionIdGenerator: stateful ? () => randomUUID() : undefined,
104
- enableJsonResponse: true
105
- });
106
- return server.connect(transport).then(() => ({ server, transport }));
107
- }
108
- async function closeSessionState(state) {
109
- await Promise.allSettled([state.transport.close(), state.server.close()]);
110
- }
111
- function toErrorMessage(error) {
112
- return error instanceof Error ? error.stack ?? error.message : String(error);
113
- }
114
- function createMcpElysiaHandler({
115
- logger,
116
- path,
117
- serverName,
118
- ops,
119
- resources,
120
- prompts,
121
- presentations,
122
- validateAuth,
123
- requiredAuthMethods
124
- }) {
125
- logger.info("Setting up MCP handler...", {
126
- requiredAuthMethods: requiredAuthMethods ?? []
127
- });
128
- const isStateful = process.env.CONTRACTSPEC_MCP_STATEFUL === "1";
129
- const sessions = new Map;
130
- async function handleStateless(request) {
131
- const state = await createSessionState({
132
- logger,
133
- path,
134
- serverName,
135
- ops,
136
- resources,
137
- prompts,
138
- presentations,
139
- stateful: false
140
- });
141
- try {
142
- return await state.transport.handleRequest(normalizeMcpRequest(request));
143
- } finally {
144
- await closeSessionState(state);
145
- }
146
- }
147
- async function closeSession(sessionId) {
148
- const state = sessions.get(sessionId);
149
- if (!state)
150
- return;
151
- sessions.delete(sessionId);
152
- await closeSessionState(state);
153
- }
154
- async function handleStateful(request) {
155
- const requestedSessionId = request.headers.get("mcp-session-id");
156
- let state;
157
- let createdState = false;
158
- if (requestedSessionId) {
159
- const existing = sessions.get(requestedSessionId);
160
- if (!existing) {
161
- return createJsonRpcErrorResponse(404, -32001, "Session not found");
162
- }
163
- state = existing;
164
- } else {
165
- state = await createSessionState({
166
- logger,
167
- path,
168
- serverName,
169
- ops,
170
- resources,
171
- prompts,
172
- presentations,
173
- stateful: true
174
- });
175
- createdState = true;
176
- }
177
- try {
178
- const response = await state.transport.handleRequest(normalizeMcpRequest(request));
179
- const activeSessionId = state.transport.sessionId;
180
- if (activeSessionId && !sessions.has(activeSessionId)) {
181
- sessions.set(activeSessionId, state);
182
- }
183
- if (request.method === "DELETE" && activeSessionId) {
184
- await closeSession(activeSessionId);
185
- } else if (!activeSessionId && createdState) {
186
- await closeSessionState(state);
187
- }
188
- return response;
189
- } catch (error) {
190
- if (createdState) {
191
- await closeSessionState(state);
192
- }
193
- throw error;
194
- }
195
- }
196
- return new Elysia({ name: `mcp-${serverName}` }).all(path, async ({ request }) => {
197
- try {
198
- if (validateAuth) {
199
- const authResult = await validateAuth(request);
200
- if (!authResult.valid) {
201
- return createJsonRpcErrorResponse(401, -32002, "Authentication failed", authResult.reason);
202
- }
203
- }
204
- if (isStateful) {
205
- return await handleStateful(request);
206
- }
207
- return await handleStateless(request);
208
- } catch (error) {
209
- logger.error("Error handling MCP request", {
210
- path,
211
- method: request.method,
212
- error: toErrorMessage(error)
213
- });
214
- return createJsonRpcErrorResponse(500, -32000, "Internal error");
215
- }
216
- });
217
- }
218
-
219
- // src/application/mcp/docsMcp.data.ts
220
- import { defaultDocRegistry } from "@contractspec/lib.contracts-spec/docs";
221
- var DEFAULT_LIMIT = 20;
222
- var MAX_LIMIT = 100;
223
- function normalizeText(value) {
224
- return value?.trim().toLowerCase() ?? "";
225
- }
226
- function normalizeRoute(route) {
227
- const decoded = decodeURIComponent(route).trim();
228
- if (!decoded)
229
- return "/";
230
- return decoded.startsWith("/") ? decoded : `/${decoded}`;
231
- }
232
- function normalizeTags(value) {
233
- const tags = Array.isArray(value) ? value : value ? [value] : [];
234
- return tags.map((tag) => normalizeText(tag)).filter(Boolean);
235
- }
236
- function clampLimit(limit) {
237
- if (!limit || Number.isNaN(limit))
238
- return DEFAULT_LIMIT;
239
- return Math.min(Math.max(limit, 1), MAX_LIMIT);
240
- }
241
- function clampOffset(offset) {
242
- if (!offset || Number.isNaN(offset))
243
- return 0;
244
- return Math.max(offset, 0);
245
- }
246
- function toDocSummary({ block, route }) {
247
- return {
248
- id: block.id,
249
- title: block.title,
250
- summary: block.summary ?? "",
251
- route,
252
- visibility: block.visibility ?? "public",
253
- kind: block.kind ?? "reference",
254
- version: block.version ?? "1.0.0",
255
- tags: block.tags ?? []
256
- };
257
- }
258
- function scoreDoc(route, query) {
259
- if (!query)
260
- return 1;
261
- const tokens = query.split(/\s+/).filter(Boolean);
262
- const title = normalizeText(route.block.title);
263
- const id = normalizeText(route.block.id);
264
- const summary = normalizeText(route.block.summary);
265
- const body = normalizeText(route.block.body);
266
- const path = normalizeText(route.route);
267
- const tags = (route.block.tags ?? []).map((tag) => normalizeText(tag));
268
- const haystack = [title, id, summary, body, path, ...tags].join(" ");
269
- if (tokens.some((token) => !haystack.includes(token)))
270
- return 0;
271
- let score = 0;
272
- for (const token of tokens) {
273
- if (id.includes(token))
274
- score += 8;
275
- if (title.includes(token))
276
- score += 7;
277
- if (tags.some((tag) => tag.includes(token)))
278
- score += 5;
279
- if (summary.includes(token))
280
- score += 4;
281
- if (path.includes(token))
282
- score += 3;
283
- if (body.includes(token))
284
- score += 2;
285
- }
286
- return score;
287
- }
288
- function searchDocs(routes, args) {
289
- const query = normalizeText(typeof args.query === "string" ? args.query : undefined);
290
- const tags = normalizeTags(args.tag);
291
- const visibility = normalizeText(typeof args.visibility === "string" ? args.visibility : undefined);
292
- const kind = normalizeText(typeof args.kind === "string" ? args.kind : undefined);
293
- const limit = clampLimit(typeof args.limit === "number" ? args.limit : undefined);
294
- const offset = clampOffset(typeof args.offset === "number" ? args.offset : undefined);
295
- const ranked = routes.map((route) => ({
296
- doc: toDocSummary(route),
297
- score: scoreDoc(route, query)
298
- })).filter(({ doc, score }) => {
299
- const matchesQuery = query ? score > 0 : true;
300
- const matchesTags = tags.length ? tags.every((tag) => doc.tags.some((docTag) => normalizeText(docTag).includes(tag))) : true;
301
- const matchesVisibility = visibility ? normalizeText(doc.visibility) === visibility : true;
302
- const matchesKind = kind ? normalizeText(doc.kind) === kind : true;
303
- return matchesQuery && matchesTags && matchesVisibility && matchesKind;
304
- }).sort((left, right) => {
305
- if (right.score !== left.score)
306
- return right.score - left.score;
307
- return left.doc.title.localeCompare(right.doc.title);
308
- });
309
- const docs = ranked.slice(offset, offset + limit).map(({ doc }) => doc);
310
- const nextOffset = offset + docs.length < ranked.length ? offset + docs.length : undefined;
311
- return {
312
- docs,
313
- items: docs,
314
- total: ranked.length,
315
- ...nextOffset != null ? { nextOffset } : {}
316
- };
317
- }
318
- function getDocById(id) {
319
- const normalizedId = decodeURIComponent(id);
320
- const found = defaultDocRegistry.get(normalizedId);
321
- if (!found)
322
- return;
323
- return {
324
- doc: toDocSummary(found),
325
- content: String(found.block.body ?? "")
326
- };
327
- }
328
- function getDocByRoute(routes, routePath) {
329
- const normalizedPath = normalizeRoute(routePath);
330
- const found = routes.find((route) => normalizeRoute(route.route) === normalizedPath);
331
- if (!found)
332
- return;
333
- return {
334
- doc: toDocSummary(found),
335
- content: String(found.block.body ?? "")
336
- };
337
- }
338
- function listDocFacets(routes) {
339
- const tags = new Map;
340
- const kinds = new Map;
341
- const visibilities = new Map;
342
- for (const route of routes) {
343
- const kind = route.block.kind ?? "reference";
344
- const visibility = route.block.visibility ?? "public";
345
- kinds.set(kind, (kinds.get(kind) ?? 0) + 1);
346
- visibilities.set(visibility, (visibilities.get(visibility) ?? 0) + 1);
347
- for (const tag of route.block.tags ?? []) {
348
- tags.set(tag, (tags.get(tag) ?? 0) + 1);
349
- }
350
- }
351
- const toEntries = (values, key) => [...values.entries()].sort((left, right) => right[1] - left[1] || left[0].localeCompare(right[0])).map(([value, count]) => ({ [key]: value, count }));
352
- return {
353
- totalDocs: routes.length,
354
- tags: toEntries(tags, "tag"),
355
- kinds: toEntries(kinds, "kind"),
356
- visibilities: toEntries(visibilities, "visibility")
357
- };
358
- }
359
-
360
- // src/features/contracts-registry.ts
361
- import {
362
- EventRegistry,
363
- OperationSpecRegistry
364
- } from "@contractspec/lib.contracts-spec";
365
- import {
366
- DataViewRegistry
367
- } from "@contractspec/lib.contracts-spec/data-views";
368
- import {
369
- ContractReferenceDataView,
370
- ContractReferenceQuery,
371
- DocsGenerateCommand,
372
- DocsGeneratedEvent,
373
- DocsIndexDataView,
374
- DocsIndexQuery,
375
- DocsLayoutPresentation,
376
- DocsPublishCommand,
377
- DocsPublishedEvent,
378
- DocsReferencePagePresentation,
379
- DocsSearchForm,
380
- ExampleCatalogDataView
381
- } from "@contractspec/lib.contracts-spec/docs";
382
- import { FormRegistry } from "@contractspec/lib.contracts-spec/forms";
383
- import {
384
- PresentationRegistry as PresentationRegistry2
385
- } from "@contractspec/lib.contracts-spec/presentations";
386
- import {
387
- serializeDataViewSpec,
388
- serializeEventSpec,
389
- serializeFormSpec,
390
- serializeOperationSpec,
391
- serializePresentationSpec
392
- } from "@contractspec/lib.contracts-spec/serialization";
393
- var operationRegistry = null;
394
- function createContractSpecOperationRegistry() {
395
- const registry = new OperationSpecRegistry;
396
- registry.register(DocsIndexQuery).register(ContractReferenceQuery).register(DocsGenerateCommand).register(DocsPublishCommand);
397
- return registry;
398
- }
399
- function getContractSpecOperationRegistry() {
400
- if (!operationRegistry) {
401
- operationRegistry = createContractSpecOperationRegistry();
402
- }
403
- return operationRegistry;
404
- }
405
- function resolveOperationSpec(key, version) {
406
- return getContractSpecOperationRegistry().get(key, version);
407
- }
408
- var eventRegistry = null;
409
- function createContractSpecEventRegistry() {
410
- const registry = new EventRegistry;
411
- registry.register(DocsGeneratedEvent).register(DocsPublishedEvent);
412
- return registry;
413
- }
414
- function getContractSpecEventRegistry() {
415
- if (!eventRegistry) {
416
- eventRegistry = createContractSpecEventRegistry();
417
- }
418
- return eventRegistry;
419
- }
420
- function resolveEventSpec(key, version) {
421
- return getContractSpecEventRegistry().get(key, version);
422
- }
423
- var presentationRegistry = null;
424
- function createContractSpecPresentationRegistry() {
425
- const registry = new PresentationRegistry2;
426
- registry.register(DocsLayoutPresentation).register(DocsReferencePagePresentation);
427
- return registry;
428
- }
429
- function getContractSpecPresentationRegistry() {
430
- if (!presentationRegistry) {
431
- presentationRegistry = createContractSpecPresentationRegistry();
432
- }
433
- return presentationRegistry;
434
- }
435
- function resolvePresentationSpec(key, version) {
436
- return getContractSpecPresentationRegistry().get(key, version);
437
- }
438
- var dataViewRegistry = null;
439
- function createContractSpecDataViewRegistry() {
440
- const registry = new DataViewRegistry;
441
- registry.register(DocsIndexDataView).register(ContractReferenceDataView).register(ExampleCatalogDataView);
442
- return registry;
443
- }
444
- function getContractSpecDataViewRegistry() {
445
- if (!dataViewRegistry) {
446
- dataViewRegistry = createContractSpecDataViewRegistry();
447
- }
448
- return dataViewRegistry;
449
- }
450
- function resolveDataViewSpec(key, version) {
451
- return getContractSpecDataViewRegistry().get(key, version);
452
- }
453
- var formRegistry = null;
454
- function createContractSpecFormRegistry() {
455
- const registry = new FormRegistry;
456
- registry.register(DocsSearchForm);
457
- return registry;
458
- }
459
- function getContractSpecFormRegistry() {
460
- if (!formRegistry) {
461
- formRegistry = createContractSpecFormRegistry();
462
- }
463
- return formRegistry;
464
- }
465
- function resolveFormSpec(key, _version) {
466
- return getContractSpecFormRegistry().get(key);
467
- }
468
- function resolveSerializedOperationSpec(key, version) {
469
- const spec = resolveOperationSpec(key, version);
470
- return serializeOperationSpec(spec) ?? undefined;
471
- }
472
- function resolveSerializedEventSpec(key, version) {
473
- const spec = resolveEventSpec(key, version);
474
- return serializeEventSpec(spec) ?? undefined;
475
- }
476
- function resolveSerializedPresentationSpec(key, version) {
477
- const spec = resolvePresentationSpec(key, version);
478
- return serializePresentationSpec(spec) ?? undefined;
479
- }
480
- function resolveSerializedDataViewSpec(key, version) {
481
- const spec = resolveDataViewSpec(key, version);
482
- return serializeDataViewSpec(spec) ?? undefined;
483
- }
484
- function resolveSerializedFormSpec(key, version) {
485
- const spec = resolveFormSpec(key, version);
486
- return serializeFormSpec(spec) ?? undefined;
487
- }
488
- function resetContractSpecOperationRegistry() {
489
- operationRegistry = null;
490
- }
491
- function resetContractSpecEventRegistry() {
492
- eventRegistry = null;
493
- }
494
- function resetContractSpecPresentationRegistry() {
495
- presentationRegistry = null;
496
- }
497
- function resetContractSpecDataViewRegistry() {
498
- dataViewRegistry = null;
499
- }
500
- function resetContractSpecFormRegistry() {
501
- formRegistry = null;
502
- }
503
- function resetAllContractSpecRegistries() {
504
- resetContractSpecOperationRegistry();
505
- resetContractSpecEventRegistry();
506
- resetContractSpecPresentationRegistry();
507
- resetContractSpecDataViewRegistry();
508
- resetContractSpecFormRegistry();
509
- }
510
-
511
- // src/application/mcp/docsMcp.reference.ts
512
- import { defaultDocRegistry as defaultDocRegistry2 } from "@contractspec/lib.contracts-spec/docs";
513
- function normalizeText2(value) {
514
- return value?.trim().toLowerCase() ?? "";
515
- }
516
- function routeFromDocIds(docIds) {
517
- for (const docId of docIds ?? []) {
518
- const doc = defaultDocRegistry2.get(docId);
519
- if (doc)
520
- return doc.route;
521
- }
522
- return;
523
- }
524
- function toReference(spec, type, schema, policy) {
525
- const title = spec.meta.title ?? spec.meta.key;
526
- const route = routeFromDocIds(spec.meta.docId);
527
- const description = spec.meta.description;
528
- return {
529
- key: spec.meta.key,
530
- version: spec.meta.version,
531
- type,
532
- title,
533
- description,
534
- markdown: [
535
- `# ${title}`,
536
- `- Key: ${spec.meta.key}`,
537
- `- Type: ${type}`,
538
- `- Version: ${spec.meta.version}`,
539
- route ? `- Docs route: ${route}` : "",
540
- description ? `
541
- ${description}` : ""
542
- ].filter(Boolean).join(`
543
- `),
544
- ...route ? { route } : {},
545
- ...schema ? { schema } : {},
546
- ...policy ? { policy } : {},
547
- tags: spec.meta.tags ?? [],
548
- owners: spec.meta.owners ?? [],
549
- stability: spec.meta.stability
550
- };
551
- }
552
- function resolveContractReference(args) {
553
- const includeSchema = args.includeSchema ?? false;
554
- const requestedType = normalizeText2(args.type);
555
- const operation = resolveOperationSpec(args.key, args.version);
556
- if (operation && (!requestedType || requestedType === "operation" || requestedType === operation.meta.kind)) {
557
- return {
558
- reference: toReference(operation, operation.meta.kind, includeSchema ? resolveSerializedOperationSpec(args.key, args.version) : undefined, operation.policy)
559
- };
560
- }
561
- const resolvers = [
562
- {
563
- type: "data-view",
564
- spec: resolveDataViewSpec(args.key, args.version),
565
- schema: includeSchema ? resolveSerializedDataViewSpec(args.key, args.version) : undefined
566
- },
567
- {
568
- type: "form",
569
- spec: resolveFormSpec(args.key, args.version),
570
- schema: includeSchema ? resolveSerializedFormSpec(args.key, args.version) : undefined
571
- },
572
- {
573
- type: "presentation",
574
- spec: resolvePresentationSpec(args.key, args.version),
575
- schema: includeSchema ? resolveSerializedPresentationSpec(args.key, args.version) : undefined
576
- },
577
- {
578
- type: "event",
579
- spec: resolveEventSpec(args.key, args.version),
580
- schema: includeSchema ? resolveSerializedEventSpec(args.key, args.version) : undefined
581
- }
582
- ];
583
- for (const candidate of resolvers) {
584
- if (candidate.spec && (!requestedType || requestedType === candidate.type)) {
585
- return {
586
- reference: toReference(candidate.spec, candidate.type, candidate.schema)
587
- };
588
- }
589
- }
590
- throw new Error(`Contract reference not found: ${args.key}`);
591
- }
592
-
593
- // src/application/mcp/docsMcp.prompts.ts
594
- import { definePrompt, PromptRegistry } from "@contractspec/lib.contracts-spec";
595
- import z from "zod";
596
- var DOC_OWNERS = ["@contractspec"];
597
- var DOC_TAGS = ["docs", "mcp"];
598
- function buildDocPrompts(routes) {
599
- const prompts = new PromptRegistry;
600
- prompts.register(definePrompt({
601
- meta: {
602
- key: "docs.navigator",
603
- version: "1.0.0",
604
- title: "Find relevant ContractSpec docs",
605
- description: "Guide agents to search, filter, and open the right ContractSpec docs.",
606
- tags: DOC_TAGS,
607
- stability: "beta",
608
- owners: DOC_OWNERS
609
- },
610
- args: [
611
- {
612
- name: "topic",
613
- description: "Goal or subject to search for.",
614
- required: false,
615
- schema: z.string().optional()
616
- },
617
- {
618
- name: "kind",
619
- description: "Optional doc kind filter.",
620
- required: false,
621
- schema: z.string().optional()
622
- },
623
- {
624
- name: "tag",
625
- description: "Optional tag filter.",
626
- required: false,
627
- schema: z.string().optional()
628
- }
629
- ],
630
- input: z.object({
631
- topic: z.string().optional(),
632
- kind: z.string().optional(),
633
- tag: z.string().optional()
634
- }),
635
- render: async ({ topic, kind, tag }) => {
636
- const matches = searchDocs(routes, {
637
- query: topic,
638
- kind,
639
- tag,
640
- limit: 3
641
- });
642
- const suggestedDocs = matches.docs.length ? matches.docs.map((doc) => `- ${doc.title} (${doc.id}) -> ${doc.route}`).join(`
643
- `) : "- No direct pre-match. Use docs_list_facets-v1_0_0 to browse tags and kinds.";
644
- return [
645
- {
646
- type: "text",
647
- text: [
648
- "Use docs_search-v1_0_0 first, then read docs://doc/{id} for the strongest matches.",
649
- "Use docs_resolve_route-v1_0_0 when the user already gives you a docs URL or route.",
650
- "Use docs_list_facets-v1_0_0 or docs://facets to browse the docs taxonomy before guessing.",
651
- topic ? `Topic: ${topic}` : "",
652
- kind ? `Kind: ${kind}` : "",
653
- tag ? `Tag: ${tag}` : "",
654
- "Suggested starting docs:",
655
- suggestedDocs
656
- ].filter(Boolean).join(`
657
- `)
658
- },
659
- {
660
- type: "resource",
661
- uri: "docs://index",
662
- title: "DocBlocks index"
663
- },
664
- {
665
- type: "resource",
666
- uri: "docs://facets",
667
- title: "Docs facets"
668
- }
669
- ];
670
- }
671
- }));
672
- prompts.register(definePrompt({
673
- meta: {
674
- key: "docs.reference.guide",
675
- version: "1.0.0",
676
- title: "Resolve a ContractSpec reference",
677
- description: "Guide agents to fetch the canonical reference payload for a ContractSpec surface.",
678
- tags: DOC_TAGS,
679
- stability: "beta",
680
- owners: DOC_OWNERS
681
- },
682
- args: [
683
- {
684
- name: "key",
685
- description: "ContractSpec key to resolve.",
686
- required: true,
687
- schema: z.string()
688
- },
689
- {
690
- name: "version",
691
- description: "Optional version override.",
692
- required: false,
693
- schema: z.string().optional()
694
- },
695
- {
696
- name: "type",
697
- description: "Optional surface type: command, query, form, data-view, presentation, event.",
698
- required: false,
699
- schema: z.string().optional()
700
- }
701
- ],
702
- input: z.object({
703
- key: z.string(),
704
- version: z.string().optional(),
705
- type: z.string().optional()
706
- }),
707
- render: async ({ key, version, type }) => {
708
- const reference = resolveContractReference({
709
- key,
710
- version,
711
- type,
712
- includeSchema: true
713
- }).reference;
714
- return [
715
- {
716
- type: "text",
717
- text: [
718
- "Use docs_contract_reference-v1_0_0 when you need the canonical docs payload for a ContractSpec surface.",
719
- "Use docs_get-v1_0_0 only when you already know the exact DocBlock id and need raw markdown.",
720
- `Resolved key: ${reference.key}`,
721
- `Resolved type: ${reference.type}`,
722
- reference.route ? `Docs route: ${reference.route}` : "",
723
- `Resource URI: docs://contract-reference/${encodeURIComponent(key)}`
724
- ].filter(Boolean).join(`
725
- `)
726
- },
727
- {
728
- type: "resource",
729
- uri: `docs://contract-reference/${encodeURIComponent(key)}`,
730
- title: "Contract reference"
731
- }
732
- ];
733
- }
734
- }));
735
- return prompts;
736
- }
737
-
738
- // src/application/mcp/docsMcp.resources.ts
739
- import {
740
- defineResourceTemplate,
741
- ResourceRegistry
742
- } from "@contractspec/lib.contracts-spec";
743
- import z2 from "zod";
744
- var DOC_TAGS2 = ["docs", "mcp"];
745
- function buildDocResources(routes) {
746
- const resources = new ResourceRegistry;
747
- const readDocIndex = (input) => searchDocs(routes, input);
748
- resources.register(defineResourceTemplate({
749
- meta: {
750
- uriTemplate: "docs://index",
751
- title: "DocBlocks index",
752
- description: "Default ContractSpec docs index resource.",
753
- mimeType: "application/json",
754
- tags: DOC_TAGS2
755
- },
756
- input: z2.object({}),
757
- resolve: async () => ({
758
- uri: "docs://index",
759
- mimeType: "application/json",
760
- data: JSON.stringify(readDocIndex({}), null, 2)
761
- })
762
- }));
763
- resources.register(defineResourceTemplate({
764
- meta: {
765
- uriTemplate: "docs://index{?query,tag,kind,visibility,limit,offset}",
766
- title: "DocBlocks index",
767
- description: "Search and paginate ContractSpec docs by query, tag, kind, or visibility.",
768
- mimeType: "application/json",
769
- tags: DOC_TAGS2
770
- },
771
- input: z2.object({
772
- query: z2.string().optional(),
773
- tag: z2.string().optional(),
774
- kind: z2.string().optional(),
775
- visibility: z2.string().optional(),
776
- limit: z2.coerce.number().optional(),
777
- offset: z2.coerce.number().optional()
778
- }),
779
- resolve: async (input) => ({
780
- uri: "docs://index",
781
- mimeType: "application/json",
782
- data: JSON.stringify(readDocIndex(input), null, 2)
783
- })
784
- }));
785
- resources.register(defineResourceTemplate({
786
- meta: {
787
- uriTemplate: "docs://list",
788
- title: "DocBlocks index (legacy alias)",
789
- description: "Compatibility alias for the docs index resource.",
790
- mimeType: "application/json",
791
- tags: DOC_TAGS2
792
- },
793
- input: z2.object({}),
794
- resolve: async () => ({
795
- uri: "docs://list",
796
- mimeType: "application/json",
797
- data: JSON.stringify(readDocIndex({}), null, 2)
798
- })
799
- }));
800
- resources.register(defineResourceTemplate({
801
- meta: {
802
- uriTemplate: "docs://doc/{id}",
803
- title: "Doc markdown",
804
- description: "Fetch a single DocBlock body by id as markdown.",
805
- mimeType: "text/markdown",
806
- tags: DOC_TAGS2
807
- },
808
- input: z2.object({ id: z2.string() }),
809
- resolve: async ({ id }) => {
810
- const found = getDocById(id);
811
- if (!found) {
812
- return {
813
- uri: `docs://doc/${encodeURIComponent(id)}`,
814
- mimeType: "text/plain",
815
- data: `DocBlock not found: ${id}`
816
- };
817
- }
818
- return {
819
- uri: `docs://doc/${encodeURIComponent(id)}`,
820
- mimeType: "text/markdown",
821
- data: found.content
822
- };
823
- }
824
- }));
825
- resources.register(defineResourceTemplate({
826
- meta: {
827
- uriTemplate: "docs://route/{routePath}",
828
- title: "Doc by route",
829
- description: "Resolve a docs route to the matching DocBlock summary and body.",
830
- mimeType: "application/json",
831
- tags: DOC_TAGS2
832
- },
833
- input: z2.object({ routePath: z2.string() }),
834
- resolve: async ({ routePath }) => ({
835
- uri: `docs://route/${encodeURIComponent(routePath)}`,
836
- mimeType: "application/json",
837
- data: JSON.stringify(getDocByRoute(routes, routePath) ?? {
838
- error: "not_found",
839
- route: routePath
840
- }, null, 2)
841
- })
842
- }));
843
- resources.register(defineResourceTemplate({
844
- meta: {
845
- uriTemplate: "docs://facets",
846
- title: "Docs facets",
847
- description: "Counts of available tags, kinds, and visibilities across docs.",
848
- mimeType: "application/json",
849
- tags: DOC_TAGS2
850
- },
851
- input: z2.object({}),
852
- resolve: async () => ({
853
- uri: "docs://facets",
854
- mimeType: "application/json",
855
- data: JSON.stringify(listDocFacets(routes), null, 2)
856
- })
857
- }));
858
- resources.register(defineResourceTemplate({
859
- meta: {
860
- uriTemplate: "docs://contract-reference/{key}{?version,type,includeSchema}",
861
- title: "Contract reference",
862
- description: "Resolve a ContractSpec surface into a docs-ready reference payload.",
863
- mimeType: "application/json",
864
- tags: DOC_TAGS2
865
- },
866
- input: z2.object({
867
- key: z2.string(),
868
- version: z2.string().optional(),
869
- type: z2.string().optional(),
870
- includeSchema: z2.coerce.boolean().optional()
871
- }),
872
- resolve: async ({ key, version, type, includeSchema }) => ({
873
- uri: `docs://contract-reference/${encodeURIComponent(key)}`,
874
- mimeType: "application/json",
875
- data: JSON.stringify(resolveContractReference({ key, version, type, includeSchema }), null, 2)
876
- })
877
- }));
878
- return resources;
879
- }
880
-
881
- // src/application/mcp/docsMcp.tools.ts
882
- import {
883
- defineCommand,
884
- defineSchemaModel,
885
- installOp,
886
- OperationSpecRegistry as OperationSpecRegistry2
887
- } from "@contractspec/lib.contracts-spec";
888
- import {
889
- ContractReferenceInput,
890
- ContractReferenceOutput,
891
- DocsIndexInput,
892
- DocsIndexOutput
893
- } from "@contractspec/lib.contracts-spec/docs";
894
- import { ScalarTypeEnum } from "@contractspec/lib.schema";
895
- var DOC_OWNERS2 = ["@contractspec"];
896
- var DOC_TAGS3 = ["docs", "mcp"];
897
- var DocsGetInput = defineSchemaModel({
898
- name: "DocsGetInput",
899
- fields: {
900
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
901
- }
902
- });
903
- var DocsGetOutput = defineSchemaModel({
904
- name: "DocsGetOutput",
905
- fields: {
906
- doc: { type: ScalarTypeEnum.JSON(), isOptional: false },
907
- content: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
908
- }
909
- });
910
- var DocsResolveRouteInput = defineSchemaModel({
911
- name: "DocsResolveRouteInput",
912
- fields: {
913
- route: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
914
- }
915
- });
916
- var DocsResolveRouteOutput = defineSchemaModel({
917
- name: "DocsResolveRouteOutput",
918
- fields: {
919
- doc: { type: ScalarTypeEnum.JSON(), isOptional: false },
920
- content: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
921
- }
922
- });
923
- var DocsFacetsInput = defineSchemaModel({
924
- name: "DocsFacetsInput",
925
- fields: {}
926
- });
927
- var DocsFacetsOutput = defineSchemaModel({
928
- name: "DocsFacetsOutput",
929
- fields: {
930
- facets: { type: ScalarTypeEnum.JSON(), isOptional: false }
931
- }
932
- });
933
- function buildDocOps(routes) {
934
- const registry = new OperationSpecRegistry2;
935
- installOp(registry, defineCommand({
936
- meta: {
937
- key: "docs.search",
938
- version: "1.0.0",
939
- stability: "beta",
940
- owners: DOC_OWNERS2,
941
- tags: DOC_TAGS3,
942
- description: "Search ContractSpec docs by query, tag, kind, or visibility.",
943
- goal: "Find the most relevant DocBlocks without browsing the full corpus.",
944
- context: "Read-only docs MCP search surface."
945
- },
946
- io: { input: DocsIndexInput, output: DocsIndexOutput },
947
- policy: { auth: "anonymous" },
948
- transport: { mcp: { toolName: "docs_search-v1_0_0" } }
949
- }), async (args) => searchDocs(routes, args));
950
- installOp(registry, defineCommand({
951
- meta: {
952
- key: "docs.get",
953
- version: "1.0.0",
954
- stability: "beta",
955
- owners: DOC_OWNERS2,
956
- tags: DOC_TAGS3,
957
- description: "Read a single DocBlock by id.",
958
- goal: "Fetch the exact markdown content and metadata for a known doc id.",
959
- context: "Read-only docs MCP surface."
960
- },
961
- io: { input: DocsGetInput, output: DocsGetOutput },
962
- policy: { auth: "anonymous" },
963
- transport: { mcp: { toolName: "docs_get-v1_0_0" } }
964
- }), async ({ id }) => {
965
- const found = getDocById(id);
966
- if (!found)
967
- throw new Error(`DocBlock not found: ${id}`);
968
- return found;
969
- });
970
- installOp(registry, defineCommand({
971
- meta: {
972
- key: "docs.resolveRoute",
973
- version: "1.0.0",
974
- stability: "beta",
975
- owners: DOC_OWNERS2,
976
- tags: DOC_TAGS3,
977
- description: "Resolve a docs route to the matching DocBlock.",
978
- goal: "Turn a route or URL path into a canonical doc id and markdown body.",
979
- context: "Read-only docs MCP surface."
980
- },
981
- io: { input: DocsResolveRouteInput, output: DocsResolveRouteOutput },
982
- policy: { auth: "anonymous" },
983
- transport: { mcp: { toolName: "docs_resolve_route-v1_0_0" } }
984
- }), async ({ route }) => {
985
- const found = getDocByRoute(routes, route);
986
- if (!found)
987
- throw new Error(`Doc route not found: ${route}`);
988
- return found;
989
- });
990
- installOp(registry, defineCommand({
991
- meta: {
992
- key: "docs.contract.lookup",
993
- version: "1.0.0",
994
- stability: "beta",
995
- owners: DOC_OWNERS2,
996
- tags: DOC_TAGS3,
997
- description: "Resolve a ContractSpec surface into a docs-ready reference payload.",
998
- goal: "Get canonical docs metadata, route, and optional schema for a spec key.",
999
- context: "Read-only docs MCP surface."
1000
- },
1001
- io: { input: ContractReferenceInput, output: ContractReferenceOutput },
1002
- policy: { auth: "anonymous" },
1003
- transport: { mcp: { toolName: "docs_contract_reference-v1_0_0" } }
1004
- }), async (args) => resolveContractReference(args));
1005
- installOp(registry, defineCommand({
1006
- meta: {
1007
- key: "docs.list.facets",
1008
- version: "1.0.0",
1009
- stability: "beta",
1010
- owners: DOC_OWNERS2,
1011
- tags: DOC_TAGS3,
1012
- description: "List docs taxonomy facets such as tags, kinds, and visibilities.",
1013
- goal: "Help agents browse the docs corpus before making targeted reads.",
1014
- context: "Read-only docs MCP surface."
1015
- },
1016
- io: { input: DocsFacetsInput, output: DocsFacetsOutput },
1017
- policy: { auth: "anonymous" },
1018
- transport: { mcp: { toolName: "docs_list_facets-v1_0_0" } }
1019
- }), async () => ({ facets: listDocFacets(routes) }));
1020
- return registry;
1021
- }
1022
-
1023
- // src/application/mcp/docsMcp.ts
1024
- import { defaultDocRegistry as defaultDocRegistry3 } from "@contractspec/lib.contracts-spec/docs";
1025
- function createDocsMcpHandler(path = "/api/mcp/docs", options = {}) {
1026
- const routes = defaultDocRegistry3.list();
1027
- return createMcpElysiaHandler({
1028
- logger: appLogger,
1029
- path,
1030
- serverName: "contractspec-docs-mcp",
1031
- ops: buildDocOps(routes),
1032
- resources: buildDocResources(routes),
1033
- prompts: buildDocPrompts(routes),
1034
- presentations: options.includePresentations ? routes.map(({ descriptor }) => descriptor) : undefined
1035
- });
1036
- }
1037
- export {
1038
- createDocsMcpHandler
1039
- };
1
+ import{Logger as g,LogLevel as d}from"@contractspec/lib.logger";function u(){return"production"}var Gj=()=>new g({level:d.INFO,environment:u(),enableTracing:!0,enableTiming:!0,enableContext:!0,enableColors:!1}),e=Gj(),hw=new g({level:d.WARN,environment:u(),enableTracing:!0,enableTiming:!0,enableContext:!0,enableColors:!1}),kw=new g({level:d.INFO,environment:u(),enableTracing:!0,enableTiming:!0,enableContext:!0,enableColors:!1});var jj=["application/json","text/event-stream"];function Nj(j){return!j||j.includes("*/*")||j.includes("application/*")||jj.some((w)=>j.includes(w))}function n(j){if(j.method!=="POST")return j;let w=j.headers.get("accept");if(!Nj(w))return j;let Y=jj.filter((U)=>!w?.includes(U));if(Y.length===0)return j;let J=new Headers(j.headers);return J.set("accept",[w,...Y].filter(Boolean).join(", ")),new Request(j,{headers:J})}import{createMcpServer as Lj}from"@contractspec/lib.contracts-runtime-server-mcp/provider-mcp";import{PresentationRegistry as Ej}from"@contractspec/lib.contracts-spec/presentations";import{McpServer as xj}from"@modelcontextprotocol/sdk/server/mcp.js";import{WebStandardStreamableHTTPServerTransport as Mj}from"@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";import{randomUUID as _j}from"crypto";import{Elysia as Aj}from"elysia";var Cj={actor:"anonymous",decide:async()=>({effect:"allow"})};function i(j,w,Y,J){return new Response(JSON.stringify({jsonrpc:"2.0",error:{code:w,message:Y,...J?{data:J}:{}},id:null}),{status:j,headers:{"content-type":"application/json"}})}function wj({logger:j,serverName:w,ops:Y,resources:J,prompts:U,presentations:Q,stateful:K}){let Z=new xj({name:w,version:"1.0.0"},{capabilities:{tools:{},resources:{},prompts:{},logging:{}}});j.info("Setting up MCP server..."),Lj(Z,Y,J,U,{logger:j,toolCtx:()=>Cj,promptCtx:()=>({locale:"en"}),resourceCtx:()=>({locale:"en"}),presentations:new Ej(Q)});let V=new Mj({sessionIdGenerator:K?()=>_j():void 0,enableJsonResponse:!0});return Z.connect(V).then(()=>({server:Z,transport:V}))}async function T(j){await Promise.allSettled([j.transport.close(),j.server.close()])}function Ij(j){return j instanceof Error?j.stack??j.message:String(j)}function Yj({logger:j,path:w,serverName:Y,ops:J,resources:U,prompts:Q,presentations:K,validateAuth:Z,requiredAuthMethods:V}){j.info("Setting up MCP handler...",{requiredAuthMethods:V??[]});let L=process.env.CONTRACTSPEC_MCP_STATEFUL==="1",H=new Map;async function $(B){let F=await wj({logger:j,path:w,serverName:Y,ops:J,resources:U,prompts:Q,presentations:K,stateful:!1});try{return await F.transport.handleRequest(n(B))}finally{await T(F)}}async function G(B){let F=H.get(B);if(!F)return;H.delete(B),await T(F)}async function p(B){let F=B.headers.get("mcp-session-id"),N,q=!1;if(F){let E=H.get(F);if(!E)return i(404,-32001,"Session not found");N=E}else N=await wj({logger:j,path:w,serverName:Y,ops:J,resources:U,prompts:Q,presentations:K,stateful:!0}),q=!0;try{let E=await N.transport.handleRequest(n(B)),A=N.transport.sessionId;if(A&&!H.has(A))H.set(A,N);if(B.method==="DELETE"&&A)await G(A);else if(!A&&q)await T(N);return E}catch(E){if(q)await T(N);throw E}}return new Aj({name:`mcp-${Y}`}).all(w,async({request:B})=>{try{if(Z){let F=await Z(B);if(!F.valid)return i(401,-32002,"Authentication failed",F.reason)}if(L)return await p(B);return await $(B)}catch(F){return j.error("Error handling MCP request",{path:w,method:B.method,error:Ij(F)}),i(500,-32000,"Internal error")}})}import{defaultDocRegistry as Rj}from"@contractspec/lib.contracts-spec/docs";var qj=20,bj=100;function P(j){return j?.trim().toLowerCase()??""}function Jj(j){let w=decodeURIComponent(j).trim();if(!w)return"/";return w.startsWith("/")?w:`/${w}`}function Oj(j){return(Array.isArray(j)?j:j?[j]:[]).map((Y)=>P(Y)).filter(Boolean)}function Dj(j){if(!j||Number.isNaN(j))return qj;return Math.min(Math.max(j,1),bj)}function zj(j){if(!j||Number.isNaN(j))return 0;return Math.max(j,0)}function c({block:j,route:w}){return{id:j.id,title:j.title,summary:j.summary??"",route:w,visibility:j.visibility??"public",kind:j.kind??"reference",version:j.version??"1.0.0",tags:j.tags??[]}}function Tj(j,w){if(!w)return 1;let Y=w.split(/\s+/).filter(Boolean),J=P(j.block.title),U=P(j.block.id),Q=P(j.block.summary),K=P(j.block.body),Z=P(j.route),V=(j.block.tags??[]).map(($)=>P($)),L=[J,U,Q,K,Z,...V].join(" ");if(Y.some(($)=>!L.includes($)))return 0;let H=0;for(let $ of Y){if(U.includes($))H+=8;if(J.includes($))H+=7;if(V.some((G)=>G.includes($)))H+=5;if(Q.includes($))H+=4;if(Z.includes($))H+=3;if(K.includes($))H+=2}return H}function C(j,w){let Y=P(typeof w.query==="string"?w.query:void 0),J=Oj(w.tag),U=P(typeof w.visibility==="string"?w.visibility:void 0),Q=P(typeof w.kind==="string"?w.kind:void 0),K=Dj(typeof w.limit==="number"?w.limit:void 0),Z=zj(typeof w.offset==="number"?w.offset:void 0),V=j.map(($)=>({doc:c($),score:Tj($,Y)})).filter(({doc:$,score:G})=>{let p=Y?G>0:!0,B=J.length?J.every((q)=>$.tags.some((E)=>P(E).includes(q))):!0,F=U?P($.visibility)===U:!0,N=Q?P($.kind)===Q:!0;return p&&B&&F&&N}).sort(($,G)=>{if(G.score!==$.score)return G.score-$.score;return $.doc.title.localeCompare(G.doc.title)}),L=V.slice(Z,Z+K).map(({doc:$})=>$),H=Z+L.length<V.length?Z+L.length:void 0;return{docs:L,items:L,total:V.length,...H!=null?{nextOffset:H}:{}}}function S(j){let w=decodeURIComponent(j),Y=Rj.get(w);if(!Y)return;return{doc:c(Y),content:String(Y.block.body??"")}}function h(j,w){let Y=Jj(w),J=j.find((U)=>Jj(U.route)===Y);if(!J)return;return{doc:c(J),content:String(J.block.body??"")}}function k(j){let w=new Map,Y=new Map,J=new Map;for(let Q of j){let K=Q.block.kind??"reference",Z=Q.block.visibility??"public";Y.set(K,(Y.get(K)??0)+1),J.set(Z,(J.get(Z)??0)+1);for(let V of Q.block.tags??[])w.set(V,(w.get(V)??0)+1)}let U=(Q,K)=>[...Q.entries()].sort((Z,V)=>V[1]-Z[1]||Z[0].localeCompare(V[0])).map(([Z,V])=>({[K]:Z,count:V}));return{totalDocs:j.length,tags:U(w,"tag"),kinds:U(Y,"kind"),visibilities:U(J,"visibility")}}import{EventRegistry as Sj,OperationSpecRegistry as hj}from"@contractspec/lib.contracts-spec";import{DataViewRegistry as kj}from"@contractspec/lib.contracts-spec/data-views";import{ContractReferenceDataView as fj,ContractReferenceQuery as vj,DocsGenerateCommand as yj,DocsGeneratedEvent as mj,DocsIndexDataView as lj,DocsIndexQuery as pj,DocsLayoutPresentation as gj,DocsPublishCommand as dj,DocsPublishedEvent as uj,DocsReferencePagePresentation as nj,DocsSearchForm as ij,ExampleCatalogDataView as cj}from"@contractspec/lib.contracts-spec/docs";import{FormRegistry as aj}from"@contractspec/lib.contracts-spec/forms";import{PresentationRegistry as oj}from"@contractspec/lib.contracts-spec/presentations";import{serializeDataViewSpec as tj,serializeEventSpec as rj,serializeFormSpec as sj,serializeOperationSpec as ej,serializePresentationSpec as jw}from"@contractspec/lib.contracts-spec/serialization";var f=null;function ww(){let j=new hj;return j.register(pj).register(vj).register(yj).register(dj),j}function Yw(){if(!f)f=ww();return f}function a(j,w){return Yw().get(j,w)}var v=null;function Jw(){let j=new Sj;return j.register(mj).register(uj),j}function Qw(){if(!v)v=Jw();return v}function o(j,w){return Qw().get(j,w)}var y=null;function Uw(){let j=new oj;return j.register(gj).register(nj),j}function Zw(){if(!y)y=Uw();return y}function t(j,w){return Zw().get(j,w)}var m=null;function $w(){let j=new kj;return j.register(lj).register(fj).register(cj),j}function Kw(){if(!m)m=$w();return m}function r(j,w){return Kw().get(j,w)}var l=null;function Vw(){let j=new aj;return j.register(ij),j}function Xw(){if(!l)l=Vw();return l}function s(j,w){return Xw().get(j)}function Qj(j,w){let Y=a(j,w);return ej(Y)??void 0}function Uj(j,w){let Y=o(j,w);return rj(Y)??void 0}function Zj(j,w){let Y=t(j,w);return jw(Y)??void 0}function $j(j,w){let Y=r(j,w);return tj(Y)??void 0}function Kj(j,w){let Y=s(j,w);return sj(Y)??void 0}function Hw(){f=null}function Bw(){v=null}function Fw(){y=null}function Ww(){m=null}function Pw(){l=null}function jY(){Hw(),Bw(),Fw(),Ww(),Pw()}import{defaultDocRegistry as Gw}from"@contractspec/lib.contracts-spec/docs";function Nw(j){return j?.trim().toLowerCase()??""}function Lw(j){for(let w of j??[]){let Y=Gw.get(w);if(Y)return Y.route}return}function Vj(j,w,Y,J){let U=j.meta.title??j.meta.key,Q=Lw(j.meta.docId),K=j.meta.description;return{key:j.meta.key,version:j.meta.version,type:w,title:U,description:K,markdown:[`# ${U}`,`- Key: ${j.meta.key}`,`- Type: ${w}`,`- Version: ${j.meta.version}`,Q?`- Docs route: ${Q}`:"",K?`
2
+ ${K}`:""].filter(Boolean).join(`
3
+ `),...Q?{route:Q}:{},...Y?{schema:Y}:{},...J?{policy:J}:{},tags:j.meta.tags??[],owners:j.meta.owners??[],stability:j.meta.stability}}function I(j){let w=j.includeSchema??!1,Y=Nw(j.type),J=a(j.key,j.version);if(J&&(!Y||Y==="operation"||Y===J.meta.kind))return{reference:Vj(J,J.meta.kind,w?Qj(j.key,j.version):void 0,J.policy)};let U=[{type:"data-view",spec:r(j.key,j.version),schema:w?$j(j.key,j.version):void 0},{type:"form",spec:s(j.key,j.version),schema:w?Kj(j.key,j.version):void 0},{type:"presentation",spec:t(j.key,j.version),schema:w?Zj(j.key,j.version):void 0},{type:"event",spec:o(j.key,j.version),schema:w?Uj(j.key,j.version):void 0}];for(let Q of U)if(Q.spec&&(!Y||Y===Q.type))return{reference:Vj(Q.spec,Q.type,Q.schema)};throw Error(`Contract reference not found: ${j.key}`)}import{definePrompt as Xj,PromptRegistry as Ew}from"@contractspec/lib.contracts-spec";import W from"zod";var Hj=["@contractspec"],Bj=["docs","mcp"];function Fj(j){let w=new Ew;return w.register(Xj({meta:{key:"docs.navigator",version:"1.0.0",title:"Find relevant ContractSpec docs",description:"Guide agents to search, filter, and open the right ContractSpec docs.",tags:Bj,stability:"beta",owners:Hj},args:[{name:"topic",description:"Goal or subject to search for.",required:!1,schema:W.string().optional()},{name:"kind",description:"Optional doc kind filter.",required:!1,schema:W.string().optional()},{name:"tag",description:"Optional tag filter.",required:!1,schema:W.string().optional()}],input:W.object({topic:W.string().optional(),kind:W.string().optional(),tag:W.string().optional()}),render:async({topic:Y,kind:J,tag:U})=>{let Q=C(j,{query:Y,kind:J,tag:U,limit:3}),K=Q.docs.length?Q.docs.map((Z)=>`- ${Z.title} (${Z.id}) -> ${Z.route}`).join(`
4
+ `):"- No direct pre-match. Use docs_list_facets-v1_0_0 to browse tags and kinds.";return[{type:"text",text:["Use docs_search-v1_0_0 first, then read docs://doc/{id} for the strongest matches.","Use docs_resolve_route-v1_0_0 when the user already gives you a docs URL or route.","Use docs_list_facets-v1_0_0 or docs://facets to browse the docs taxonomy before guessing.",Y?`Topic: ${Y}`:"",J?`Kind: ${J}`:"",U?`Tag: ${U}`:"","Suggested starting docs:",K].filter(Boolean).join(`
5
+ `)},{type:"resource",uri:"docs://index",title:"DocBlocks index"},{type:"resource",uri:"docs://facets",title:"Docs facets"}]}})),w.register(Xj({meta:{key:"docs.reference.guide",version:"1.0.0",title:"Resolve a ContractSpec reference",description:"Guide agents to fetch the canonical reference payload for a ContractSpec surface.",tags:Bj,stability:"beta",owners:Hj},args:[{name:"key",description:"ContractSpec key to resolve.",required:!0,schema:W.string()},{name:"version",description:"Optional version override.",required:!1,schema:W.string().optional()},{name:"type",description:"Optional surface type: command, query, form, data-view, presentation, event.",required:!1,schema:W.string().optional()}],input:W.object({key:W.string(),version:W.string().optional(),type:W.string().optional()}),render:async({key:Y,version:J,type:U})=>{let Q=I({key:Y,version:J,type:U,includeSchema:!0}).reference;return[{type:"text",text:["Use docs_contract_reference-v1_0_0 when you need the canonical docs payload for a ContractSpec surface.","Use docs_get-v1_0_0 only when you already know the exact DocBlock id and need raw markdown.",`Resolved key: ${Q.key}`,`Resolved type: ${Q.type}`,Q.route?`Docs route: ${Q.route}`:"",`Resource URI: docs://contract-reference/${encodeURIComponent(Y)}`].filter(Boolean).join(`
6
+ `)},{type:"resource",uri:`docs://contract-reference/${encodeURIComponent(Y)}`,title:"Contract reference"}]}})),w}import{defineResourceTemplate as x,ResourceRegistry as xw}from"@contractspec/lib.contracts-spec";import X from"zod";var M=["docs","mcp"];function Wj(j){let w=new xw,Y=(J)=>C(j,J);return w.register(x({meta:{uriTemplate:"docs://index",title:"DocBlocks index",description:"Default ContractSpec docs index resource.",mimeType:"application/json",tags:M},input:X.object({}),resolve:async()=>({uri:"docs://index",mimeType:"application/json",data:JSON.stringify(Y({}),null,2)})})),w.register(x({meta:{uriTemplate:"docs://index{?query,tag,kind,visibility,limit,offset}",title:"DocBlocks index",description:"Search and paginate ContractSpec docs by query, tag, kind, or visibility.",mimeType:"application/json",tags:M},input:X.object({query:X.string().optional(),tag:X.string().optional(),kind:X.string().optional(),visibility:X.string().optional(),limit:X.coerce.number().optional(),offset:X.coerce.number().optional()}),resolve:async(J)=>({uri:"docs://index",mimeType:"application/json",data:JSON.stringify(Y(J),null,2)})})),w.register(x({meta:{uriTemplate:"docs://list",title:"DocBlocks index (legacy alias)",description:"Compatibility alias for the docs index resource.",mimeType:"application/json",tags:M},input:X.object({}),resolve:async()=>({uri:"docs://list",mimeType:"application/json",data:JSON.stringify(Y({}),null,2)})})),w.register(x({meta:{uriTemplate:"docs://doc/{id}",title:"Doc markdown",description:"Fetch a single DocBlock body by id as markdown.",mimeType:"text/markdown",tags:M},input:X.object({id:X.string()}),resolve:async({id:J})=>{let U=S(J);if(!U)return{uri:`docs://doc/${encodeURIComponent(J)}`,mimeType:"text/plain",data:`DocBlock not found: ${J}`};return{uri:`docs://doc/${encodeURIComponent(J)}`,mimeType:"text/markdown",data:U.content}}})),w.register(x({meta:{uriTemplate:"docs://route/{routePath}",title:"Doc by route",description:"Resolve a docs route to the matching DocBlock summary and body.",mimeType:"application/json",tags:M},input:X.object({routePath:X.string()}),resolve:async({routePath:J})=>({uri:`docs://route/${encodeURIComponent(J)}`,mimeType:"application/json",data:JSON.stringify(h(j,J)??{error:"not_found",route:J},null,2)})})),w.register(x({meta:{uriTemplate:"docs://facets",title:"Docs facets",description:"Counts of available tags, kinds, and visibilities across docs.",mimeType:"application/json",tags:M},input:X.object({}),resolve:async()=>({uri:"docs://facets",mimeType:"application/json",data:JSON.stringify(k(j),null,2)})})),w.register(x({meta:{uriTemplate:"docs://contract-reference/{key}{?version,type,includeSchema}",title:"Contract reference",description:"Resolve a ContractSpec surface into a docs-ready reference payload.",mimeType:"application/json",tags:M},input:X.object({key:X.string(),version:X.string().optional(),type:X.string().optional(),includeSchema:X.coerce.boolean().optional()}),resolve:async({key:J,version:U,type:Q,includeSchema:K})=>({uri:`docs://contract-reference/${encodeURIComponent(J)}`,mimeType:"application/json",data:JSON.stringify(I({key:J,version:U,type:Q,includeSchema:K}),null,2)})})),w}import{defineCommand as b,defineSchemaModel as R,installOp as O,OperationSpecRegistry as Mw}from"@contractspec/lib.contracts-spec";import{ContractReferenceInput as _w,ContractReferenceOutput as Aw,DocsIndexInput as Cw,DocsIndexOutput as Iw}from"@contractspec/lib.contracts-spec/docs";import{ScalarTypeEnum as _}from"@contractspec/lib.schema";var D=["@contractspec"],z=["docs","mcp"],Rw=R({name:"DocsGetInput",fields:{id:{type:_.String_unsecure(),isOptional:!1}}}),qw=R({name:"DocsGetOutput",fields:{doc:{type:_.JSON(),isOptional:!1},content:{type:_.String_unsecure(),isOptional:!1}}}),bw=R({name:"DocsResolveRouteInput",fields:{route:{type:_.String_unsecure(),isOptional:!1}}}),Ow=R({name:"DocsResolveRouteOutput",fields:{doc:{type:_.JSON(),isOptional:!1},content:{type:_.String_unsecure(),isOptional:!1}}}),Dw=R({name:"DocsFacetsInput",fields:{}}),zw=R({name:"DocsFacetsOutput",fields:{facets:{type:_.JSON(),isOptional:!1}}});function Pj(j){let w=new Mw;return O(w,b({meta:{key:"docs.search",version:"1.0.0",stability:"beta",owners:D,tags:z,description:"Search ContractSpec docs by query, tag, kind, or visibility.",goal:"Find the most relevant DocBlocks without browsing the full corpus.",context:"Read-only docs MCP search surface."},io:{input:Cw,output:Iw},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_search-v1_0_0"}}}),async(Y)=>C(j,Y)),O(w,b({meta:{key:"docs.get",version:"1.0.0",stability:"beta",owners:D,tags:z,description:"Read a single DocBlock by id.",goal:"Fetch the exact markdown content and metadata for a known doc id.",context:"Read-only docs MCP surface."},io:{input:Rw,output:qw},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_get-v1_0_0"}}}),async({id:Y})=>{let J=S(Y);if(!J)throw Error(`DocBlock not found: ${Y}`);return J}),O(w,b({meta:{key:"docs.resolveRoute",version:"1.0.0",stability:"beta",owners:D,tags:z,description:"Resolve a docs route to the matching DocBlock.",goal:"Turn a route or URL path into a canonical doc id and markdown body.",context:"Read-only docs MCP surface."},io:{input:bw,output:Ow},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_resolve_route-v1_0_0"}}}),async({route:Y})=>{let J=h(j,Y);if(!J)throw Error(`Doc route not found: ${Y}`);return J}),O(w,b({meta:{key:"docs.contract.lookup",version:"1.0.0",stability:"beta",owners:D,tags:z,description:"Resolve a ContractSpec surface into a docs-ready reference payload.",goal:"Get canonical docs metadata, route, and optional schema for a spec key.",context:"Read-only docs MCP surface."},io:{input:_w,output:Aw},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_contract_reference-v1_0_0"}}}),async(Y)=>I(Y)),O(w,b({meta:{key:"docs.list.facets",version:"1.0.0",stability:"beta",owners:D,tags:z,description:"List docs taxonomy facets such as tags, kinds, and visibilities.",goal:"Help agents browse the docs corpus before making targeted reads.",context:"Read-only docs MCP surface."},io:{input:Dw,output:zw},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_list_facets-v1_0_0"}}}),async()=>({facets:k(j)})),w}import{defaultDocRegistry as Tw}from"@contractspec/lib.contracts-spec/docs";function qY(j="/api/mcp/docs",w={}){let Y=Tw.list();return Yj({logger:e,path:j,serverName:"contractspec-docs-mcp",ops:Pj(Y),resources:Wj(Y),prompts:Fj(Y),presentations:w.includePresentations?Y.map(({descriptor:J})=>J):void 0})}export{qY as createDocsMcpHandler};