@contractspec/bundle.library 3.7.6 → 3.8.2

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 (900) hide show
  1. package/.turbo/turbo-build.log +258 -252
  2. package/AGENTS.md +42 -24
  3. package/CHANGELOG.md +56 -0
  4. package/README.md +59 -37
  5. package/dist/application/index.d.ts +1 -1
  6. package/dist/application/index.js +842 -840
  7. package/dist/application/mcp/cliMcp.js +30 -30
  8. package/dist/application/mcp/common.d.ts +2 -2
  9. package/dist/application/mcp/common.js +2 -2
  10. package/dist/application/mcp/contractsMcp.d.ts +1 -1
  11. package/dist/application/mcp/contractsMcp.js +163 -163
  12. package/dist/application/mcp/docsMcp.js +31 -31
  13. package/dist/application/mcp/index.d.ts +2 -2
  14. package/dist/application/mcp/index.js +842 -840
  15. package/dist/application/mcp/internalMcp.js +30 -30
  16. package/dist/application/mcp/providerRankingMcp.js +35 -33
  17. package/dist/components/docs/DocsIndexPage.js +859 -212
  18. package/dist/components/docs/advanced/AdvancedMCPPage.js +15 -15
  19. package/dist/components/docs/advanced/AdvancedOverlayEditorPage.js +4 -4
  20. package/dist/components/docs/advanced/AdvancedRenderersPage.js +7 -7
  21. package/dist/components/docs/advanced/AdvancedSpecExperimentsPage.js +9 -9
  22. package/dist/components/docs/advanced/AdvancedTelemetryPage.js +16 -16
  23. package/dist/components/docs/advanced/AdvancedWorkflowMonitoringPage.js +6 -6
  24. package/dist/components/docs/advanced/index.d.ts +2 -2
  25. package/dist/components/docs/advanced/index.js +57 -57
  26. package/dist/components/docs/architecture/ArchitectureAppConfigPage.js +10 -10
  27. package/dist/components/docs/architecture/ArchitectureControlPlanePage.js +8 -8
  28. package/dist/components/docs/architecture/ArchitectureIntegrationBindingPage.js +14 -14
  29. package/dist/components/docs/architecture/ArchitectureKnowledgeBindingPage.js +16 -16
  30. package/dist/components/docs/architecture/ArchitectureMultiTenancyPage.js +7 -7
  31. package/dist/components/docs/architecture/ArchitectureOverviewPage.js +90 -411
  32. package/dist/components/docs/architecture/index.d.ts +3 -3
  33. package/dist/components/docs/architecture/index.js +145 -466
  34. package/dist/components/docs/comparison/ComparisonAutomationPlatformsPage.js +6 -6
  35. package/dist/components/docs/comparison/ComparisonEnterprisePlatformsPage.js +7 -7
  36. package/dist/components/docs/comparison/ComparisonInternalToolBuildersPage.js +6 -6
  37. package/dist/components/docs/comparison/ComparisonOverviewPage.js +4 -4
  38. package/dist/components/docs/comparison/ComparisonWindmillPage.js +6 -6
  39. package/dist/components/docs/comparison/ComparisonWorkflowEnginesPage.js +6 -6
  40. package/dist/components/docs/comparison/index.d.ts +2 -2
  41. package/dist/components/docs/comparison/index.js +35 -35
  42. package/dist/components/docs/docsManifest.d.ts +42 -0
  43. package/dist/components/docs/docsManifest.js +612 -0
  44. package/dist/components/docs/ecosystem/IntegrationsPage.js +5 -5
  45. package/dist/components/docs/ecosystem/PluginsPage.js +7 -7
  46. package/dist/components/docs/ecosystem/RegistryPage.js +4 -4
  47. package/dist/components/docs/ecosystem/TemplatesPage.js +11 -11
  48. package/dist/components/docs/ecosystem/index.d.ts +2 -2
  49. package/dist/components/docs/ecosystem/index.js +27 -27
  50. package/dist/components/docs/examples/DocsExamplesPage.js +59 -6
  51. package/dist/components/docs/examples/ExampleShowcasePage.d.ts +5 -0
  52. package/dist/components/docs/examples/ExampleShowcasePage.js +258 -0
  53. package/dist/components/docs/examples/exampleShowcaseData.d.ts +10 -0
  54. package/dist/components/docs/examples/exampleShowcaseData.js +53 -0
  55. package/dist/components/docs/examples/index.d.ts +1 -0
  56. package/dist/components/docs/examples/index.js +265 -6
  57. package/dist/components/docs/getting-started/CLIPage.js +9 -9
  58. package/dist/components/docs/getting-started/CompatibilityPage.js +12 -12
  59. package/dist/components/docs/getting-started/DataViewTutorialPage.js +7 -7
  60. package/dist/components/docs/getting-started/DeveloperToolsPage.js +10 -10
  61. package/dist/components/docs/getting-started/HelloWorldPage.js +8 -8
  62. package/dist/components/docs/getting-started/InstallationPage.js +10 -10
  63. package/dist/components/docs/getting-started/StartHerePage.js +8 -8
  64. package/dist/components/docs/getting-started/TroubleshootingPage.js +12 -12
  65. package/dist/components/docs/getting-started/VSCodeExtensionPage.js +13 -13
  66. package/dist/components/docs/getting-started/index.d.ts +5 -5
  67. package/dist/components/docs/getting-started/index.js +89 -89
  68. package/dist/components/docs/guides/GuideCIDiffGatingPage.js +13 -13
  69. package/dist/components/docs/guides/GuideContractTypesPage.js +33 -33
  70. package/dist/components/docs/guides/GuideDocsPipelinePage.js +13 -13
  71. package/dist/components/docs/guides/GuideGenerateDocsClientsSchemasPage.js +13 -13
  72. package/dist/components/docs/guides/GuideImportExistingCodebasesPage.js +35 -35
  73. package/dist/components/docs/guides/GuideNextjsOneEndpointPage.js +15 -15
  74. package/dist/components/docs/guides/GuideSpecValidationTypingPage.js +13 -13
  75. package/dist/components/docs/guides/GuidesIndexPage.js +69 -46
  76. package/dist/components/docs/guides/index.d.ts +4 -4
  77. package/dist/components/docs/guides/index.js +174 -151
  78. package/dist/components/docs/index.d.ts +13 -12
  79. package/dist/components/docs/index.js +15220 -16233
  80. package/dist/components/docs/integrations/IntegrationsCircuitBreakersPage.js +4 -4
  81. package/dist/components/docs/integrations/IntegrationsElevenLabsPage.js +7 -7
  82. package/dist/components/docs/integrations/IntegrationsGithubPage.js +11 -11
  83. package/dist/components/docs/integrations/IntegrationsGmailPage.js +7 -7
  84. package/dist/components/docs/integrations/IntegrationsGoogleCalendarPage.js +5 -5
  85. package/dist/components/docs/integrations/IntegrationsHealthRoutingPage.js +12 -12
  86. package/dist/components/docs/integrations/IntegrationsMistralPage.js +12 -12
  87. package/dist/components/docs/integrations/IntegrationsOpenAIPage.js +11 -11
  88. package/dist/components/docs/integrations/IntegrationsOverviewPage.js +119 -736
  89. package/dist/components/docs/integrations/IntegrationsPostmarkPage.js +12 -12
  90. package/dist/components/docs/integrations/IntegrationsPowensPage.js +24 -24
  91. package/dist/components/docs/integrations/IntegrationsQdrantPage.js +9 -9
  92. package/dist/components/docs/integrations/IntegrationsResendPage.js +7 -7
  93. package/dist/components/docs/integrations/IntegrationsS3Page.js +9 -9
  94. package/dist/components/docs/integrations/IntegrationsSlackPage.js +11 -11
  95. package/dist/components/docs/integrations/IntegrationsSpecModelPage.js +19 -19
  96. package/dist/components/docs/integrations/IntegrationsStripePage.js +25 -25
  97. package/dist/components/docs/integrations/IntegrationsTwilioPage.js +9 -9
  98. package/dist/components/docs/integrations/IntegrationsWhatsappMetaPage.js +12 -12
  99. package/dist/components/docs/integrations/IntegrationsWhatsappTwilioPage.js +13 -13
  100. package/dist/components/docs/integrations/index.d.ts +1 -1
  101. package/dist/components/docs/integrations/index.js +614 -1231
  102. package/dist/components/docs/intent/ContractFirstApiPage.js +8 -8
  103. package/dist/components/docs/intent/DeterministicCodegenPage.js +9 -9
  104. package/dist/components/docs/intent/GenerateClientFromSchemaPage.js +13 -13
  105. package/dist/components/docs/intent/OpenapiAlternativePage.js +13 -13
  106. package/dist/components/docs/intent/SchemaValidationTypescriptPage.js +9 -9
  107. package/dist/components/docs/intent/SpecDrivenDevelopmentPage.js +8 -8
  108. package/dist/components/docs/intent/index.d.ts +3 -3
  109. package/dist/components/docs/intent/index.js +766 -766
  110. package/dist/components/docs/knowledge/KnowledgeCategoriesPage.js +38 -38
  111. package/dist/components/docs/knowledge/KnowledgeExamplesPage.js +9 -9
  112. package/dist/components/docs/knowledge/KnowledgeOverviewPage.js +91 -439
  113. package/dist/components/docs/knowledge/KnowledgeSourcesPage.js +28 -28
  114. package/dist/components/docs/knowledge/KnowledgeSpacesPage.js +21 -21
  115. package/dist/components/docs/knowledge/index.d.ts +1 -1
  116. package/dist/components/docs/knowledge/index.js +437 -785
  117. package/dist/components/docs/libraries/LibrariesAccessibilityPage.js +16 -16
  118. package/dist/components/docs/libraries/LibrariesAiAgentPage.js +8 -8
  119. package/dist/components/docs/libraries/LibrariesAnalyticsPage.js +6 -6
  120. package/dist/components/docs/libraries/LibrariesContentGenPage.js +6 -6
  121. package/dist/components/docs/libraries/LibrariesContractsPage.js +16 -16
  122. package/dist/components/docs/libraries/LibrariesCostTrackingPage.js +6 -6
  123. package/dist/components/docs/libraries/LibrariesDataBackendPage.js +14 -14
  124. package/dist/components/docs/libraries/LibrariesDataViewsPage.js +7 -7
  125. package/dist/components/docs/libraries/LibrariesDesignSystemPage.js +13 -13
  126. package/dist/components/docs/libraries/LibrariesEvolutionPage.js +7 -7
  127. package/dist/components/docs/libraries/LibrariesGraphQLPage.js +13 -13
  128. package/dist/components/docs/libraries/LibrariesGrowthPage.js +5 -5
  129. package/dist/components/docs/libraries/LibrariesMultiTenancyPage.js +5 -5
  130. package/dist/components/docs/libraries/LibrariesObservabilityPage.js +7 -7
  131. package/dist/components/docs/libraries/LibrariesOverlayEnginePage.js +6 -6
  132. package/dist/components/docs/libraries/LibrariesOverviewPage.js +117 -430
  133. package/dist/components/docs/libraries/LibrariesPersonalizationPage.js +6 -6
  134. package/dist/components/docs/libraries/LibrariesProgressiveDeliveryPage.js +6 -6
  135. package/dist/components/docs/libraries/LibrariesResiliencePage.js +6 -6
  136. package/dist/components/docs/libraries/LibrariesRuntimePage.js +13 -13
  137. package/dist/components/docs/libraries/LibrariesSLOPage.js +6 -6
  138. package/dist/components/docs/libraries/LibrariesSchemaPage.js +16 -16
  139. package/dist/components/docs/libraries/LibrariesSupportBotPage.js +7 -7
  140. package/dist/components/docs/libraries/LibrariesTestingPage.js +7 -7
  141. package/dist/components/docs/libraries/LibrariesUIKitPage.js +10 -10
  142. package/dist/components/docs/libraries/LibrariesWorkflowComposerPage.js +5 -5
  143. package/dist/components/docs/libraries/LibrariesWorkflowsPage.js +8 -8
  144. package/dist/components/docs/libraries/index.d.ts +4 -4
  145. package/dist/components/docs/libraries/index.js +1308 -1621
  146. package/dist/components/docs/manifesto/ManifestoPage.js +33 -138
  147. package/dist/components/docs/ops/AutoEvolutionOpsPage.js +9 -9
  148. package/dist/components/docs/ops/DistributedTracingOpsPage.js +5 -5
  149. package/dist/components/docs/ops/index.js +14 -14
  150. package/dist/components/docs/reference/DocsMarkdownContent.js +1 -1
  151. package/dist/components/docs/reference/DocsReferenceContent.js +2 -2
  152. package/dist/components/docs/reference/DocsReferenceIndexClient.js +8 -8
  153. package/dist/components/docs/reference/DocsReferenceIndexPage.js +8 -8
  154. package/dist/components/docs/reference/DocsReferencePage.js +2 -2
  155. package/dist/components/docs/reference/index.js +10 -10
  156. package/dist/components/docs/safety/SafetyAuditingPage.js +16 -16
  157. package/dist/components/docs/safety/SafetyMigrationsPage.js +15 -15
  158. package/dist/components/docs/safety/SafetyOverviewPage.js +69 -206
  159. package/dist/components/docs/safety/SafetyPDPPage.js +12 -12
  160. package/dist/components/docs/safety/SafetySecurityTrustPage.js +11 -11
  161. package/dist/components/docs/safety/SafetySigningPage.js +7 -7
  162. package/dist/components/docs/safety/SafetyTenantIsolationPage.js +6 -6
  163. package/dist/components/docs/safety/index.d.ts +3 -3
  164. package/dist/components/docs/safety/index.js +616 -753
  165. package/dist/components/docs/shared/StudioPrompt.js +5 -5
  166. package/dist/components/docs/specs/SpecsCapabilitiesPage.js +12 -12
  167. package/dist/components/docs/specs/SpecsDataViewsPage.js +14 -14
  168. package/dist/components/docs/specs/SpecsOverlaysPage.js +14 -14
  169. package/dist/components/docs/specs/SpecsOverviewPage.js +135 -297
  170. package/dist/components/docs/specs/SpecsPolicyPage.js +29 -29
  171. package/dist/components/docs/specs/SpecsWorkflowsPage.js +18 -18
  172. package/dist/components/docs/specs/index.d.ts +3 -3
  173. package/dist/components/docs/specs/index.js +814 -976
  174. package/dist/components/docs/studio/StudioBYOKPage.js +1 -1
  175. package/dist/components/docs/studio/StudioDeploymentsPage.js +1 -1
  176. package/dist/components/docs/studio/StudioGettingStartedPage.js +1 -1
  177. package/dist/components/docs/studio/StudioIntegrationsPage.js +1 -1
  178. package/dist/components/docs/studio/StudioOverviewPage.js +109 -56
  179. package/dist/components/docs/studio/StudioVisualBuilderPage.js +1 -1
  180. package/dist/components/docs/studio/index.d.ts +4 -4
  181. package/dist/components/docs/studio/index.js +170 -117
  182. package/dist/components/integrations/index.js +25 -25
  183. package/dist/components/integrations/molecules/IntegrationCard.js +5 -5
  184. package/dist/components/integrations/organisms/IntegrationMarketplace.js +12 -12
  185. package/dist/components/integrations/organisms/IntegrationSettings.js +7 -7
  186. package/dist/components/integrations/organisms/KnowledgeSourceList.js +6 -6
  187. package/dist/components/legal/PrivacyTemplate.js +67 -67
  188. package/dist/components/legal/TermsTemplate.js +54 -54
  189. package/dist/components/legal/index.js +121 -121
  190. package/dist/components/shared/FeatureGateNotice.js +4 -4
  191. package/dist/components/shared/index.js +4 -4
  192. package/dist/components/shell/WorkspaceHeader.js +4 -4
  193. package/dist/components/shell/WorkspaceProjectShellLayout.d.ts +3 -3
  194. package/dist/components/shell/WorkspaceProjectShellLayout.js +10 -10
  195. package/dist/components/shell/WorkspaceShellRenderer.d.ts +4 -4
  196. package/dist/components/shell/WorkspaceShellRenderer.js +8 -8
  197. package/dist/components/shell/WorkspaceSidebar.js +2 -2
  198. package/dist/components/shell/index.d.ts +1 -1
  199. package/dist/components/shell/index.js +12 -12
  200. package/dist/components/templates/engine/index.d.ts +1 -1
  201. package/dist/components/templates/index.d.ts +1 -1
  202. package/dist/components/templates/index.js +835 -835
  203. package/dist/components/templates/messaging/ConversationList.js +11 -11
  204. package/dist/components/templates/messaging/MessageComposer.js +11 -11
  205. package/dist/components/templates/messaging/MessageThread.js +6 -6
  206. package/dist/components/templates/messaging/MessagingWorkspace.js +23 -23
  207. package/dist/components/templates/messaging/index.d.ts +1 -1
  208. package/dist/components/templates/messaging/index.js +23 -23
  209. package/dist/components/templates/recipes/LanguageSwitcher.js +1 -1
  210. package/dist/components/templates/recipes/RecipeCard.js +5 -5
  211. package/dist/components/templates/recipes/RecipeDetail.js +8 -8
  212. package/dist/components/templates/recipes/RecipeList.js +17 -17
  213. package/dist/components/templates/recipes/index.d.ts +2 -2
  214. package/dist/components/templates/recipes/index.js +17 -17
  215. package/dist/components/templates/todos/FilterBar.d.ts +1 -1
  216. package/dist/components/templates/todos/FilterBar.js +9 -9
  217. package/dist/components/templates/todos/TaskForm.js +14 -14
  218. package/dist/components/templates/todos/TaskItem.js +4 -4
  219. package/dist/components/templates/todos/TaskList.js +30 -30
  220. package/dist/components/templates/todos/index.d.ts +2 -2
  221. package/dist/components/templates/todos/index.js +30 -30
  222. package/dist/config/index.d.ts +2 -2
  223. package/dist/features/contracts-registry.d.ts +3 -3
  224. package/dist/features/contracts-registry.js +15 -15
  225. package/dist/features/docs/docs.contracts.d.ts +1 -1
  226. package/dist/features/docs/docs.contracts.js +2 -2
  227. package/dist/features/docs/index.d.ts +1 -1
  228. package/dist/features/docs/index.js +2 -2
  229. package/dist/features/index.d.ts +4 -4
  230. package/dist/features/index.js +18 -18
  231. package/dist/features/registry.js +1 -1
  232. package/dist/index.d.ts +2 -2
  233. package/dist/index.js +17034 -18047
  234. package/dist/libs/email/client.js +1 -1
  235. package/dist/libs/email/contact.js +1 -1
  236. package/dist/libs/email/newsletter.js +1 -1
  237. package/dist/libs/email/waitlist-application.js +1 -1
  238. package/dist/libs/email/waitlist.js +1 -1
  239. package/dist/libs/email.d.ts +1 -1
  240. package/dist/libs/email.js +1 -1
  241. package/dist/node/application/index.js +842 -840
  242. package/dist/node/application/mcp/cliMcp.js +30 -30
  243. package/dist/node/application/mcp/common.js +2 -2
  244. package/dist/node/application/mcp/contractsMcp.js +163 -163
  245. package/dist/node/application/mcp/docsMcp.js +31 -31
  246. package/dist/node/application/mcp/index.js +842 -840
  247. package/dist/node/application/mcp/internalMcp.js +30 -30
  248. package/dist/node/application/mcp/providerRankingMcp.js +35 -33
  249. package/dist/node/components/docs/DocsIndexPage.js +859 -212
  250. package/dist/node/components/docs/advanced/AdvancedMCPPage.js +15 -15
  251. package/dist/node/components/docs/advanced/AdvancedOverlayEditorPage.js +4 -4
  252. package/dist/node/components/docs/advanced/AdvancedRenderersPage.js +7 -7
  253. package/dist/node/components/docs/advanced/AdvancedSpecExperimentsPage.js +9 -9
  254. package/dist/node/components/docs/advanced/AdvancedTelemetryPage.js +16 -16
  255. package/dist/node/components/docs/advanced/AdvancedWorkflowMonitoringPage.js +6 -6
  256. package/dist/node/components/docs/advanced/index.js +57 -57
  257. package/dist/node/components/docs/architecture/ArchitectureAppConfigPage.js +10 -10
  258. package/dist/node/components/docs/architecture/ArchitectureControlPlanePage.js +8 -8
  259. package/dist/node/components/docs/architecture/ArchitectureIntegrationBindingPage.js +14 -14
  260. package/dist/node/components/docs/architecture/ArchitectureKnowledgeBindingPage.js +16 -16
  261. package/dist/node/components/docs/architecture/ArchitectureMultiTenancyPage.js +7 -7
  262. package/dist/node/components/docs/architecture/ArchitectureOverviewPage.js +90 -411
  263. package/dist/node/components/docs/architecture/index.js +145 -466
  264. package/dist/node/components/docs/comparison/ComparisonAutomationPlatformsPage.js +6 -6
  265. package/dist/node/components/docs/comparison/ComparisonEnterprisePlatformsPage.js +7 -7
  266. package/dist/node/components/docs/comparison/ComparisonInternalToolBuildersPage.js +6 -6
  267. package/dist/node/components/docs/comparison/ComparisonOverviewPage.js +4 -4
  268. package/dist/node/components/docs/comparison/ComparisonWindmillPage.js +6 -6
  269. package/dist/node/components/docs/comparison/ComparisonWorkflowEnginesPage.js +6 -6
  270. package/dist/node/components/docs/comparison/index.js +35 -35
  271. package/dist/node/components/docs/docsManifest.js +611 -0
  272. package/dist/node/components/docs/ecosystem/IntegrationsPage.js +5 -5
  273. package/dist/node/components/docs/ecosystem/PluginsPage.js +7 -7
  274. package/dist/node/components/docs/ecosystem/RegistryPage.js +4 -4
  275. package/dist/node/components/docs/ecosystem/TemplatesPage.js +11 -11
  276. package/dist/node/components/docs/ecosystem/index.js +27 -27
  277. package/dist/node/components/docs/examples/DocsExamplesPage.js +59 -6
  278. package/dist/node/components/docs/examples/ExampleShowcasePage.js +257 -0
  279. package/dist/node/components/docs/examples/exampleShowcaseData.js +52 -0
  280. package/dist/node/components/docs/examples/index.js +265 -6
  281. package/dist/node/components/docs/getting-started/CLIPage.js +9 -9
  282. package/dist/node/components/docs/getting-started/CompatibilityPage.js +12 -12
  283. package/dist/node/components/docs/getting-started/DataViewTutorialPage.js +7 -7
  284. package/dist/node/components/docs/getting-started/DeveloperToolsPage.js +10 -10
  285. package/dist/node/components/docs/getting-started/HelloWorldPage.js +8 -8
  286. package/dist/node/components/docs/getting-started/InstallationPage.js +10 -10
  287. package/dist/node/components/docs/getting-started/StartHerePage.js +8 -8
  288. package/dist/node/components/docs/getting-started/TroubleshootingPage.js +12 -12
  289. package/dist/node/components/docs/getting-started/VSCodeExtensionPage.js +13 -13
  290. package/dist/node/components/docs/getting-started/index.js +89 -89
  291. package/dist/node/components/docs/guides/GuideCIDiffGatingPage.js +13 -13
  292. package/dist/node/components/docs/guides/GuideContractTypesPage.js +33 -33
  293. package/dist/node/components/docs/guides/GuideDocsPipelinePage.js +13 -13
  294. package/dist/node/components/docs/guides/GuideGenerateDocsClientsSchemasPage.js +13 -13
  295. package/dist/node/components/docs/guides/GuideImportExistingCodebasesPage.js +35 -35
  296. package/dist/node/components/docs/guides/GuideNextjsOneEndpointPage.js +15 -15
  297. package/dist/node/components/docs/guides/GuideSpecValidationTypingPage.js +13 -13
  298. package/dist/node/components/docs/guides/GuidesIndexPage.js +69 -46
  299. package/dist/node/components/docs/guides/index.js +174 -151
  300. package/dist/node/components/docs/index.js +15220 -16233
  301. package/dist/node/components/docs/integrations/IntegrationsCircuitBreakersPage.js +4 -4
  302. package/dist/node/components/docs/integrations/IntegrationsElevenLabsPage.js +7 -7
  303. package/dist/node/components/docs/integrations/IntegrationsGithubPage.js +11 -11
  304. package/dist/node/components/docs/integrations/IntegrationsGmailPage.js +7 -7
  305. package/dist/node/components/docs/integrations/IntegrationsGoogleCalendarPage.js +5 -5
  306. package/dist/node/components/docs/integrations/IntegrationsHealthRoutingPage.js +12 -12
  307. package/dist/node/components/docs/integrations/IntegrationsMistralPage.js +12 -12
  308. package/dist/node/components/docs/integrations/IntegrationsOpenAIPage.js +11 -11
  309. package/dist/node/components/docs/integrations/IntegrationsOverviewPage.js +119 -736
  310. package/dist/node/components/docs/integrations/IntegrationsPostmarkPage.js +12 -12
  311. package/dist/node/components/docs/integrations/IntegrationsPowensPage.js +24 -24
  312. package/dist/node/components/docs/integrations/IntegrationsQdrantPage.js +9 -9
  313. package/dist/node/components/docs/integrations/IntegrationsResendPage.js +7 -7
  314. package/dist/node/components/docs/integrations/IntegrationsS3Page.js +9 -9
  315. package/dist/node/components/docs/integrations/IntegrationsSlackPage.js +11 -11
  316. package/dist/node/components/docs/integrations/IntegrationsSpecModelPage.js +19 -19
  317. package/dist/node/components/docs/integrations/IntegrationsStripePage.js +25 -25
  318. package/dist/node/components/docs/integrations/IntegrationsTwilioPage.js +9 -9
  319. package/dist/node/components/docs/integrations/IntegrationsWhatsappMetaPage.js +12 -12
  320. package/dist/node/components/docs/integrations/IntegrationsWhatsappTwilioPage.js +13 -13
  321. package/dist/node/components/docs/integrations/index.js +614 -1231
  322. package/dist/node/components/docs/intent/ContractFirstApiPage.js +8 -8
  323. package/dist/node/components/docs/intent/DeterministicCodegenPage.js +9 -9
  324. package/dist/node/components/docs/intent/GenerateClientFromSchemaPage.js +13 -13
  325. package/dist/node/components/docs/intent/OpenapiAlternativePage.js +13 -13
  326. package/dist/node/components/docs/intent/SchemaValidationTypescriptPage.js +9 -9
  327. package/dist/node/components/docs/intent/SpecDrivenDevelopmentPage.js +8 -8
  328. package/dist/node/components/docs/intent/index.js +766 -766
  329. package/dist/node/components/docs/knowledge/KnowledgeCategoriesPage.js +38 -38
  330. package/dist/node/components/docs/knowledge/KnowledgeExamplesPage.js +9 -9
  331. package/dist/node/components/docs/knowledge/KnowledgeOverviewPage.js +91 -439
  332. package/dist/node/components/docs/knowledge/KnowledgeSourcesPage.js +28 -28
  333. package/dist/node/components/docs/knowledge/KnowledgeSpacesPage.js +21 -21
  334. package/dist/node/components/docs/knowledge/index.js +437 -785
  335. package/dist/node/components/docs/libraries/LibrariesAccessibilityPage.js +16 -16
  336. package/dist/node/components/docs/libraries/LibrariesAiAgentPage.js +8 -8
  337. package/dist/node/components/docs/libraries/LibrariesAnalyticsPage.js +6 -6
  338. package/dist/node/components/docs/libraries/LibrariesContentGenPage.js +6 -6
  339. package/dist/node/components/docs/libraries/LibrariesContractsPage.js +16 -16
  340. package/dist/node/components/docs/libraries/LibrariesCostTrackingPage.js +6 -6
  341. package/dist/node/components/docs/libraries/LibrariesDataBackendPage.js +14 -14
  342. package/dist/node/components/docs/libraries/LibrariesDataViewsPage.js +7 -7
  343. package/dist/node/components/docs/libraries/LibrariesDesignSystemPage.js +13 -13
  344. package/dist/node/components/docs/libraries/LibrariesEvolutionPage.js +7 -7
  345. package/dist/node/components/docs/libraries/LibrariesGraphQLPage.js +13 -13
  346. package/dist/node/components/docs/libraries/LibrariesGrowthPage.js +5 -5
  347. package/dist/node/components/docs/libraries/LibrariesMultiTenancyPage.js +5 -5
  348. package/dist/node/components/docs/libraries/LibrariesObservabilityPage.js +7 -7
  349. package/dist/node/components/docs/libraries/LibrariesOverlayEnginePage.js +6 -6
  350. package/dist/node/components/docs/libraries/LibrariesOverviewPage.js +117 -430
  351. package/dist/node/components/docs/libraries/LibrariesPersonalizationPage.js +6 -6
  352. package/dist/node/components/docs/libraries/LibrariesProgressiveDeliveryPage.js +6 -6
  353. package/dist/node/components/docs/libraries/LibrariesResiliencePage.js +6 -6
  354. package/dist/node/components/docs/libraries/LibrariesRuntimePage.js +13 -13
  355. package/dist/node/components/docs/libraries/LibrariesSLOPage.js +6 -6
  356. package/dist/node/components/docs/libraries/LibrariesSchemaPage.js +16 -16
  357. package/dist/node/components/docs/libraries/LibrariesSupportBotPage.js +7 -7
  358. package/dist/node/components/docs/libraries/LibrariesTestingPage.js +7 -7
  359. package/dist/node/components/docs/libraries/LibrariesUIKitPage.js +10 -10
  360. package/dist/node/components/docs/libraries/LibrariesWorkflowComposerPage.js +5 -5
  361. package/dist/node/components/docs/libraries/LibrariesWorkflowsPage.js +8 -8
  362. package/dist/node/components/docs/libraries/index.js +1308 -1621
  363. package/dist/node/components/docs/manifesto/ManifestoPage.js +33 -138
  364. package/dist/node/components/docs/ops/AutoEvolutionOpsPage.js +9 -9
  365. package/dist/node/components/docs/ops/DistributedTracingOpsPage.js +5 -5
  366. package/dist/node/components/docs/ops/index.js +14 -14
  367. package/dist/node/components/docs/reference/DocsMarkdownContent.js +1 -1
  368. package/dist/node/components/docs/reference/DocsReferenceContent.js +2 -2
  369. package/dist/node/components/docs/reference/DocsReferenceIndexClient.js +8 -8
  370. package/dist/node/components/docs/reference/DocsReferenceIndexPage.js +8 -8
  371. package/dist/node/components/docs/reference/DocsReferencePage.js +2 -2
  372. package/dist/node/components/docs/reference/index.js +10 -10
  373. package/dist/node/components/docs/safety/SafetyAuditingPage.js +16 -16
  374. package/dist/node/components/docs/safety/SafetyMigrationsPage.js +15 -15
  375. package/dist/node/components/docs/safety/SafetyOverviewPage.js +69 -206
  376. package/dist/node/components/docs/safety/SafetyPDPPage.js +12 -12
  377. package/dist/node/components/docs/safety/SafetySecurityTrustPage.js +11 -11
  378. package/dist/node/components/docs/safety/SafetySigningPage.js +7 -7
  379. package/dist/node/components/docs/safety/SafetyTenantIsolationPage.js +6 -6
  380. package/dist/node/components/docs/safety/index.js +616 -753
  381. package/dist/node/components/docs/shared/StudioPrompt.js +5 -5
  382. package/dist/node/components/docs/specs/SpecsCapabilitiesPage.js +12 -12
  383. package/dist/node/components/docs/specs/SpecsDataViewsPage.js +14 -14
  384. package/dist/node/components/docs/specs/SpecsOverlaysPage.js +14 -14
  385. package/dist/node/components/docs/specs/SpecsOverviewPage.js +135 -297
  386. package/dist/node/components/docs/specs/SpecsPolicyPage.js +29 -29
  387. package/dist/node/components/docs/specs/SpecsWorkflowsPage.js +18 -18
  388. package/dist/node/components/docs/specs/index.js +814 -976
  389. package/dist/node/components/docs/studio/StudioBYOKPage.js +1 -1
  390. package/dist/node/components/docs/studio/StudioDeploymentsPage.js +1 -1
  391. package/dist/node/components/docs/studio/StudioGettingStartedPage.js +1 -1
  392. package/dist/node/components/docs/studio/StudioIntegrationsPage.js +1 -1
  393. package/dist/node/components/docs/studio/StudioOverviewPage.js +109 -56
  394. package/dist/node/components/docs/studio/StudioVisualBuilderPage.js +1 -1
  395. package/dist/node/components/docs/studio/index.js +170 -117
  396. package/dist/node/components/integrations/index.js +25 -25
  397. package/dist/node/components/integrations/molecules/IntegrationCard.js +5 -5
  398. package/dist/node/components/integrations/organisms/IntegrationMarketplace.js +12 -12
  399. package/dist/node/components/integrations/organisms/IntegrationSettings.js +7 -7
  400. package/dist/node/components/integrations/organisms/KnowledgeSourceList.js +6 -6
  401. package/dist/node/components/legal/PrivacyTemplate.js +67 -67
  402. package/dist/node/components/legal/TermsTemplate.js +54 -54
  403. package/dist/node/components/legal/index.js +121 -121
  404. package/dist/node/components/shared/FeatureGateNotice.js +4 -4
  405. package/dist/node/components/shared/index.js +4 -4
  406. package/dist/node/components/shell/WorkspaceHeader.js +4 -4
  407. package/dist/node/components/shell/WorkspaceProjectShellLayout.js +10 -10
  408. package/dist/node/components/shell/WorkspaceShellRenderer.js +8 -8
  409. package/dist/node/components/shell/WorkspaceSidebar.js +2 -2
  410. package/dist/node/components/shell/index.js +12 -12
  411. package/dist/node/components/templates/index.js +835 -835
  412. package/dist/node/components/templates/messaging/ConversationList.js +11 -11
  413. package/dist/node/components/templates/messaging/MessageComposer.js +11 -11
  414. package/dist/node/components/templates/messaging/MessageThread.js +6 -6
  415. package/dist/node/components/templates/messaging/MessagingWorkspace.js +23 -23
  416. package/dist/node/components/templates/messaging/index.js +23 -23
  417. package/dist/node/components/templates/recipes/LanguageSwitcher.js +1 -1
  418. package/dist/node/components/templates/recipes/RecipeCard.js +5 -5
  419. package/dist/node/components/templates/recipes/RecipeDetail.js +8 -8
  420. package/dist/node/components/templates/recipes/RecipeList.js +17 -17
  421. package/dist/node/components/templates/recipes/index.js +17 -17
  422. package/dist/node/components/templates/todos/FilterBar.js +9 -9
  423. package/dist/node/components/templates/todos/TaskForm.js +14 -14
  424. package/dist/node/components/templates/todos/TaskItem.js +4 -4
  425. package/dist/node/components/templates/todos/TaskList.js +30 -30
  426. package/dist/node/components/templates/todos/index.js +30 -30
  427. package/dist/node/features/contracts-registry.js +15 -15
  428. package/dist/node/features/docs/docs.contracts.js +2 -2
  429. package/dist/node/features/docs/index.js +2 -2
  430. package/dist/node/features/index.js +18 -18
  431. package/dist/node/features/registry.js +1 -1
  432. package/dist/node/index.js +17034 -18047
  433. package/dist/node/libs/email/client.js +1 -1
  434. package/dist/node/libs/email/contact.js +1 -1
  435. package/dist/node/libs/email/newsletter.js +1 -1
  436. package/dist/node/libs/email/waitlist-application.js +1 -1
  437. package/dist/node/libs/email/waitlist.js +1 -1
  438. package/dist/node/libs/email.js +1 -1
  439. package/dist/node/presentation/features/atoms/FeatureIcon/FeatureIcon.js +7 -7
  440. package/dist/node/presentation/features/atoms/FeatureIcon/index.js +7 -7
  441. package/dist/node/presentation/features/atoms/index.js +7 -7
  442. package/dist/node/presentation/features/hooks/index.js +56 -56
  443. package/dist/node/presentation/features/hooks/useContractsRegistry.js +18 -18
  444. package/dist/node/presentation/features/hooks/useFeatureFilters.js +1 -1
  445. package/dist/node/presentation/features/hooks/useFeatureRegistry.js +1 -1
  446. package/dist/node/presentation/features/hooks/useRelatedDocs.js +1 -1
  447. package/dist/node/presentation/features/index.js +1364 -1364
  448. package/dist/node/presentation/features/molecules/FeatureCard/FeatureCard.js +15 -15
  449. package/dist/node/presentation/features/molecules/FeatureCard/index.js +15 -15
  450. package/dist/node/presentation/features/molecules/FeatureCategoryHeader/FeatureCategoryHeader.js +7 -7
  451. package/dist/node/presentation/features/molecules/FeatureCategoryHeader/index.js +7 -7
  452. package/dist/node/presentation/features/molecules/FeatureFilters/FeatureFilters.js +1 -1
  453. package/dist/node/presentation/features/molecules/FeatureFilters/index.js +1 -1
  454. package/dist/node/presentation/features/molecules/FeatureHoverPreview/FeatureHoverPreview.js +5 -5
  455. package/dist/node/presentation/features/molecules/FeatureHoverPreview/index.js +5 -5
  456. package/dist/node/presentation/features/molecules/index.js +77 -77
  457. package/dist/node/presentation/features/organisms/FeatureDataViewsList.js +18 -18
  458. package/dist/node/presentation/features/organisms/FeatureDiscovery/FeatureDiscovery.js +121 -121
  459. package/dist/node/presentation/features/organisms/FeatureDiscovery/index.js +121 -121
  460. package/dist/node/presentation/features/organisms/FeatureEventsList.js +18 -18
  461. package/dist/node/presentation/features/organisms/FeatureFormsList.js +18 -18
  462. package/dist/node/presentation/features/organisms/FeatureOperationsList.js +15 -15
  463. package/dist/node/presentation/features/organisms/FeaturePresentationsList.js +18 -18
  464. package/dist/node/presentation/features/organisms/index.js +401 -401
  465. package/dist/node/presentation/features/templates/FeatureDataViewDetailTemplate/FeatureDataViewDetailTemplate.js +13 -13
  466. package/dist/node/presentation/features/templates/FeatureDataViewDetailTemplate/index.js +13 -13
  467. package/dist/node/presentation/features/templates/FeatureDataViewsTemplate/FeatureDataViewsTemplate.js +20 -20
  468. package/dist/node/presentation/features/templates/FeatureDataViewsTemplate/index.js +20 -20
  469. package/dist/node/presentation/features/templates/FeatureEventDetailTemplate/FeatureEventDetailTemplate.js +12 -12
  470. package/dist/node/presentation/features/templates/FeatureEventDetailTemplate/index.js +12 -12
  471. package/dist/node/presentation/features/templates/FeatureEventsTemplate/FeatureEventsTemplate.js +18 -18
  472. package/dist/node/presentation/features/templates/FeatureEventsTemplate/index.js +18 -18
  473. package/dist/node/presentation/features/templates/FeatureFormDetailTemplate/FeatureFormDetailTemplate.js +13 -13
  474. package/dist/node/presentation/features/templates/FeatureFormDetailTemplate/index.js +13 -13
  475. package/dist/node/presentation/features/templates/FeatureFormsTemplate/FeatureFormsTemplate.js +20 -20
  476. package/dist/node/presentation/features/templates/FeatureFormsTemplate/index.js +20 -20
  477. package/dist/node/presentation/features/templates/FeatureOperationDetailTemplate/FeatureOperationDetailTemplate.js +8 -8
  478. package/dist/node/presentation/features/templates/FeatureOperationDetailTemplate/index.js +8 -8
  479. package/dist/node/presentation/features/templates/FeatureOperationsTemplate/FeatureOperationsTemplate.js +15 -15
  480. package/dist/node/presentation/features/templates/FeatureOperationsTemplate/index.js +15 -15
  481. package/dist/node/presentation/features/templates/FeatureOverviewTemplate/FeatureOverviewTemplate.js +2 -2
  482. package/dist/node/presentation/features/templates/FeatureOverviewTemplate/index.js +2 -2
  483. package/dist/node/presentation/features/templates/FeaturePresentationDetailTemplate/FeaturePresentationDetailTemplate.js +12 -12
  484. package/dist/node/presentation/features/templates/FeaturePresentationDetailTemplate/index.js +12 -12
  485. package/dist/node/presentation/features/templates/FeaturePresentationsTemplate/FeaturePresentationsTemplate.js +18 -18
  486. package/dist/node/presentation/features/templates/FeaturePresentationsTemplate/index.js +18 -18
  487. package/dist/presentation/features/atoms/FeatureIcon/FeatureIcon.js +7 -7
  488. package/dist/presentation/features/atoms/FeatureIcon/index.d.ts +1 -1
  489. package/dist/presentation/features/atoms/FeatureIcon/index.js +7 -7
  490. package/dist/presentation/features/atoms/index.js +7 -7
  491. package/dist/presentation/features/hooks/index.d.ts +3 -3
  492. package/dist/presentation/features/hooks/index.js +56 -56
  493. package/dist/presentation/features/hooks/useContractsRegistry.js +18 -18
  494. package/dist/presentation/features/hooks/useFeatureFilters.js +1 -1
  495. package/dist/presentation/features/hooks/useFeatureRegistry.js +1 -1
  496. package/dist/presentation/features/hooks/useRelatedDocs.js +1 -1
  497. package/dist/presentation/features/index.d.ts +14 -14
  498. package/dist/presentation/features/index.js +1364 -1364
  499. package/dist/presentation/features/molecules/FeatureCard/FeatureCard.js +15 -15
  500. package/dist/presentation/features/molecules/FeatureCard/index.js +15 -15
  501. package/dist/presentation/features/molecules/FeatureCategoryHeader/FeatureCategoryHeader.js +7 -7
  502. package/dist/presentation/features/molecules/FeatureCategoryHeader/index.js +7 -7
  503. package/dist/presentation/features/molecules/FeatureFilters/FeatureFilters.js +1 -1
  504. package/dist/presentation/features/molecules/FeatureFilters/index.js +1 -1
  505. package/dist/presentation/features/molecules/FeatureHoverPreview/FeatureHoverPreview.js +5 -5
  506. package/dist/presentation/features/molecules/FeatureHoverPreview/index.js +5 -5
  507. package/dist/presentation/features/molecules/index.d.ts +1 -1
  508. package/dist/presentation/features/molecules/index.js +77 -77
  509. package/dist/presentation/features/organisms/FeatureDataViewsList.js +18 -18
  510. package/dist/presentation/features/organisms/FeatureDiscovery/FeatureDiscovery.js +121 -121
  511. package/dist/presentation/features/organisms/FeatureDiscovery/index.d.ts +1 -1
  512. package/dist/presentation/features/organisms/FeatureDiscovery/index.js +121 -121
  513. package/dist/presentation/features/organisms/FeatureEventsList.js +18 -18
  514. package/dist/presentation/features/organisms/FeatureFormsList.js +18 -18
  515. package/dist/presentation/features/organisms/FeatureOperationsList.js +15 -15
  516. package/dist/presentation/features/organisms/FeaturePresentationsList.js +18 -18
  517. package/dist/presentation/features/organisms/index.d.ts +4 -4
  518. package/dist/presentation/features/organisms/index.js +401 -401
  519. package/dist/presentation/features/templates/FeatureDataViewDetailTemplate/FeatureDataViewDetailTemplate.js +13 -13
  520. package/dist/presentation/features/templates/FeatureDataViewDetailTemplate/index.js +13 -13
  521. package/dist/presentation/features/templates/FeatureDataViewDetailTemplate/types.d.ts +1 -1
  522. package/dist/presentation/features/templates/FeatureDataViewsTemplate/FeatureDataViewsTemplate.js +20 -20
  523. package/dist/presentation/features/templates/FeatureDataViewsTemplate/index.js +20 -20
  524. package/dist/presentation/features/templates/FeatureEventDetailTemplate/FeatureEventDetailTemplate.js +12 -12
  525. package/dist/presentation/features/templates/FeatureEventDetailTemplate/index.js +12 -12
  526. package/dist/presentation/features/templates/FeatureEventsTemplate/FeatureEventsTemplate.js +18 -18
  527. package/dist/presentation/features/templates/FeatureEventsTemplate/index.js +18 -18
  528. package/dist/presentation/features/templates/FeatureFormDetailTemplate/FeatureFormDetailTemplate.js +13 -13
  529. package/dist/presentation/features/templates/FeatureFormDetailTemplate/index.js +13 -13
  530. package/dist/presentation/features/templates/FeatureFormsTemplate/FeatureFormsTemplate.js +20 -20
  531. package/dist/presentation/features/templates/FeatureFormsTemplate/index.js +20 -20
  532. package/dist/presentation/features/templates/FeatureOperationDetailTemplate/FeatureOperationDetailTemplate.js +8 -8
  533. package/dist/presentation/features/templates/FeatureOperationDetailTemplate/index.js +8 -8
  534. package/dist/presentation/features/templates/FeatureOperationsTemplate/FeatureOperationsTemplate.js +15 -15
  535. package/dist/presentation/features/templates/FeatureOperationsTemplate/index.js +15 -15
  536. package/dist/presentation/features/templates/FeatureOverviewTemplate/FeatureOverviewTemplate.js +2 -2
  537. package/dist/presentation/features/templates/FeatureOverviewTemplate/index.js +2 -2
  538. package/dist/presentation/features/templates/FeaturePresentationDetailTemplate/FeaturePresentationDetailTemplate.js +12 -12
  539. package/dist/presentation/features/templates/FeaturePresentationDetailTemplate/index.js +12 -12
  540. package/dist/presentation/features/templates/FeaturePresentationsTemplate/FeaturePresentationsTemplate.js +18 -18
  541. package/dist/presentation/features/templates/FeaturePresentationsTemplate/index.js +18 -18
  542. package/package.json +70 -32
  543. package/src/__tests__/env-setup.ts +1 -1
  544. package/src/__tests__/mocks/prisma.ts +78 -78
  545. package/src/__tests__/setup.ts +2 -2
  546. package/src/application/context-storage/index.ts +42 -42
  547. package/src/application/index.ts +1 -1
  548. package/src/application/mcp/cliMcp.ts +221 -221
  549. package/src/application/mcp/common.ts +210 -210
  550. package/src/application/mcp/contractsMcp.ts +15 -15
  551. package/src/application/mcp/contractsMcpResources.ts +119 -119
  552. package/src/application/mcp/contractsMcpTools.ts +218 -218
  553. package/src/application/mcp/contractsMcpTypes.ts +35 -35
  554. package/src/application/mcp/docsMcp.ts +173 -173
  555. package/src/application/mcp/index.ts +2 -2
  556. package/src/application/mcp/internalMcp.ts +204 -204
  557. package/src/application/mcp/providerRankingMcp.ts +346 -344
  558. package/src/bundles/LibraryBundle.ts +136 -136
  559. package/src/components/docs/DocsIndexPage.tsx +189 -241
  560. package/src/components/docs/advanced/AdvancedMCPPage.tsx +168 -168
  561. package/src/components/docs/advanced/AdvancedOverlayEditorPage.tsx +52 -52
  562. package/src/components/docs/advanced/AdvancedRenderersPage.tsx +53 -53
  563. package/src/components/docs/advanced/AdvancedSpecExperimentsPage.tsx +48 -48
  564. package/src/components/docs/advanced/AdvancedTelemetryPage.tsx +205 -205
  565. package/src/components/docs/advanced/AdvancedWorkflowMonitoringPage.tsx +42 -42
  566. package/src/components/docs/advanced/index.ts +2 -2
  567. package/src/components/docs/architecture/ArchitectureAppConfigPage.tsx +127 -127
  568. package/src/components/docs/architecture/ArchitectureControlPlanePage.tsx +79 -79
  569. package/src/components/docs/architecture/ArchitectureIntegrationBindingPage.tsx +147 -147
  570. package/src/components/docs/architecture/ArchitectureKnowledgeBindingPage.tsx +193 -193
  571. package/src/components/docs/architecture/ArchitectureMultiTenancyPage.tsx +73 -73
  572. package/src/components/docs/architecture/ArchitectureOverviewPage.tsx +98 -273
  573. package/src/components/docs/architecture/index.ts +3 -3
  574. package/src/components/docs/comparison/ComparisonAutomationPlatformsPage.tsx +137 -137
  575. package/src/components/docs/comparison/ComparisonEnterprisePlatformsPage.tsx +138 -138
  576. package/src/components/docs/comparison/ComparisonInternalToolBuildersPage.tsx +147 -147
  577. package/src/components/docs/comparison/ComparisonOverviewPage.tsx +106 -106
  578. package/src/components/docs/comparison/ComparisonWindmillPage.tsx +143 -143
  579. package/src/components/docs/comparison/ComparisonWorkflowEnginesPage.tsx +168 -168
  580. package/src/components/docs/comparison/index.ts +2 -2
  581. package/src/components/docs/docsManifest.ts +720 -0
  582. package/src/components/docs/ecosystem/IntegrationsPage.tsx +45 -45
  583. package/src/components/docs/ecosystem/PluginsPage.tsx +77 -77
  584. package/src/components/docs/ecosystem/RegistryPage.tsx +48 -48
  585. package/src/components/docs/ecosystem/TemplatesPage.tsx +52 -52
  586. package/src/components/docs/ecosystem/ecosystem.docblocks.ts +42 -42
  587. package/src/components/docs/ecosystem/index.ts +2 -2
  588. package/src/components/docs/examples/DocsExamplesPage.tsx +78 -66
  589. package/src/components/docs/examples/ExampleShowcasePage.tsx +122 -0
  590. package/src/components/docs/examples/exampleShowcaseData.ts +65 -0
  591. package/src/components/docs/examples/index.ts +1 -0
  592. package/src/components/docs/generated/docs-index._common.json +1757 -1757
  593. package/src/components/docs/generated/docs-index.agent-console.json +376 -376
  594. package/src/components/docs/generated/docs-index.ai-chat-assistant.json +8 -8
  595. package/src/components/docs/generated/docs-index.ai-chat.json +104 -104
  596. package/src/components/docs/generated/docs-index.ai-support-bot.json +8 -8
  597. package/src/components/docs/generated/docs-index.analytics-dashboard.json +168 -168
  598. package/src/components/docs/generated/docs-index.app-config.json +136 -136
  599. package/src/components/docs/generated/docs-index.audit-trail.json +48 -48
  600. package/src/components/docs/generated/docs-index.calendar-google.json +8 -8
  601. package/src/components/docs/generated/docs-index.content-generation.json +8 -8
  602. package/src/components/docs/generated/docs-index.crm-pipeline.json +160 -160
  603. package/src/components/docs/generated/docs-index.email-gmail.json +8 -8
  604. package/src/components/docs/generated/docs-index.feature-flags.json +216 -216
  605. package/src/components/docs/generated/docs-index.files.json +176 -176
  606. package/src/components/docs/generated/docs-index.generated.ts +19 -19
  607. package/src/components/docs/generated/docs-index.health.json +96 -96
  608. package/src/components/docs/generated/docs-index.identity-rbac.json +312 -312
  609. package/src/components/docs/generated/docs-index.in-app-docs.json +8 -8
  610. package/src/components/docs/generated/docs-index.integration-hub.json +264 -264
  611. package/src/components/docs/generated/docs-index.integration-posthog.json +8 -8
  612. package/src/components/docs/generated/docs-index.integration-stripe.json +8 -8
  613. package/src/components/docs/generated/docs-index.integration-supabase.json +8 -8
  614. package/src/components/docs/generated/docs-index.jobs.json +136 -136
  615. package/src/components/docs/generated/docs-index.kb-update-pipeline.json +128 -128
  616. package/src/components/docs/generated/docs-index.knowledge-canon.json +8 -8
  617. package/src/components/docs/generated/docs-index.learning-journey-ambient-coach.json +8 -8
  618. package/src/components/docs/generated/docs-index.learning-journey-crm-onboarding.json +48 -48
  619. package/src/components/docs/generated/docs-index.learning-journey-duo-drills.json +8 -8
  620. package/src/components/docs/generated/docs-index.learning-journey-platform-tour.json +48 -48
  621. package/src/components/docs/generated/docs-index.learning-journey-quest-challenges.json +8 -8
  622. package/src/components/docs/generated/docs-index.learning-journey-registry.json +32 -32
  623. package/src/components/docs/generated/docs-index.learning-journey-studio-onboarding.json +48 -48
  624. package/src/components/docs/generated/docs-index.learning-journey-ui-coaching.json +8 -8
  625. package/src/components/docs/generated/docs-index.learning-journey-ui-gamified.json +8 -8
  626. package/src/components/docs/generated/docs-index.learning-journey-ui-onboarding.json +8 -8
  627. package/src/components/docs/generated/docs-index.learning-journey-ui-shared.json +8 -8
  628. package/src/components/docs/generated/docs-index.learning-journey.json +216 -216
  629. package/src/components/docs/generated/docs-index.learning-patterns.json +8 -8
  630. package/src/components/docs/generated/docs-index.lifecycle-cli.json +8 -8
  631. package/src/components/docs/generated/docs-index.lifecycle-dashboard.json +8 -8
  632. package/src/components/docs/generated/docs-index.locale-jurisdiction-gate.json +48 -48
  633. package/src/components/docs/generated/docs-index.manifest.json +376 -376
  634. package/src/components/docs/generated/docs-index.marketplace.json +336 -336
  635. package/src/components/docs/generated/docs-index.meeting-recorder-providers.json +8 -8
  636. package/src/components/docs/generated/docs-index.meeting-recorder.json +48 -48
  637. package/src/components/docs/generated/docs-index.metrics.json +200 -200
  638. package/src/components/docs/generated/docs-index.minimal.json +16 -16
  639. package/src/components/docs/generated/docs-index.notifications.json +64 -64
  640. package/src/components/docs/generated/docs-index.openbanking-powens.json +8 -8
  641. package/src/components/docs/generated/docs-index.openbanking.json +64 -64
  642. package/src/components/docs/generated/docs-index.opencode-cli.json +16 -16
  643. package/src/components/docs/generated/docs-index.personalization.json +8 -8
  644. package/src/components/docs/generated/docs-index.platform-acp.json +72 -72
  645. package/src/components/docs/generated/docs-index.platform-agent.json +96 -96
  646. package/src/components/docs/generated/docs-index.platform-context.json +56 -56
  647. package/src/components/docs/generated/docs-index.platform-database.json +48 -48
  648. package/src/components/docs/generated/docs-index.platform-docs.json +88 -88
  649. package/src/components/docs/generated/docs-index.platform-integrations.json +320 -320
  650. package/src/components/docs/generated/docs-index.platform-knowledge.json +56 -56
  651. package/src/components/docs/generated/docs-index.platform-provider-ranking.json +96 -96
  652. package/src/components/docs/generated/docs-index.pocket-family-office.json +120 -120
  653. package/src/components/docs/generated/docs-index.policy-safe-knowledge-assistant.json +8 -8
  654. package/src/components/docs/generated/docs-index.product-intent.json +8 -8
  655. package/src/components/docs/generated/docs-index.project-management-sync.json +8 -8
  656. package/src/components/docs/generated/docs-index.saas-boilerplate.json +208 -208
  657. package/src/components/docs/generated/docs-index.service-business-os.json +192 -192
  658. package/src/components/docs/generated/docs-index.team-hub.json +184 -184
  659. package/src/components/docs/generated/docs-index.unknown.json +512 -512
  660. package/src/components/docs/generated/docs-index.versioned-knowledge-base.json +80 -80
  661. package/src/components/docs/generated/docs-index.video-api-showcase.json +32 -32
  662. package/src/components/docs/generated/docs-index.video-docs-terminal.json +8 -8
  663. package/src/components/docs/generated/docs-index.video-marketing-clip.json +8 -8
  664. package/src/components/docs/generated/docs-index.voice-providers.json +8 -8
  665. package/src/components/docs/generated/docs-index.wealth-snapshot.json +152 -152
  666. package/src/components/docs/generated/docs-index.workflow-system.json +432 -432
  667. package/src/components/docs/generated/docs-index.workspace-cli.json +8 -8
  668. package/src/components/docs/generated/index.ts +6 -6
  669. package/src/components/docs/generated/loader.ts +49 -49
  670. package/src/components/docs/getting-started/CLIPage.tsx +157 -157
  671. package/src/components/docs/getting-started/CompatibilityPage.tsx +69 -69
  672. package/src/components/docs/getting-started/DataViewTutorialPage.tsx +63 -63
  673. package/src/components/docs/getting-started/DeveloperToolsPage.tsx +141 -140
  674. package/src/components/docs/getting-started/HelloWorldPage.tsx +88 -88
  675. package/src/components/docs/getting-started/InstallationPage.tsx +78 -78
  676. package/src/components/docs/getting-started/StartHerePage.tsx +64 -64
  677. package/src/components/docs/getting-started/TroubleshootingPage.tsx +68 -68
  678. package/src/components/docs/getting-started/VSCodeExtensionPage.tsx +233 -233
  679. package/src/components/docs/getting-started/getting-started.docblocks.ts +30 -30
  680. package/src/components/docs/getting-started/index.ts +6 -5
  681. package/src/components/docs/guides/GuideCIDiffGatingPage.tsx +88 -88
  682. package/src/components/docs/guides/GuideContractTypesPage.tsx +266 -266
  683. package/src/components/docs/guides/GuideDocsPipelinePage.tsx +78 -78
  684. package/src/components/docs/guides/GuideGenerateDocsClientsSchemasPage.tsx +89 -89
  685. package/src/components/docs/guides/GuideImportExistingCodebasesPage.tsx +360 -360
  686. package/src/components/docs/guides/GuideNextjsOneEndpointPage.tsx +117 -117
  687. package/src/components/docs/guides/GuideSpecValidationTypingPage.tsx +82 -82
  688. package/src/components/docs/guides/GuidesIndexPage.tsx +109 -99
  689. package/src/components/docs/guides/guides.docblocks.ts +60 -60
  690. package/src/components/docs/guides/index.ts +4 -4
  691. package/src/components/docs/index.ts +26 -40
  692. package/src/components/docs/integrations/IntegrationsCircuitBreakersPage.tsx +22 -22
  693. package/src/components/docs/integrations/IntegrationsElevenLabsPage.tsx +41 -41
  694. package/src/components/docs/integrations/IntegrationsGithubPage.tsx +66 -66
  695. package/src/components/docs/integrations/IntegrationsGmailPage.tsx +44 -44
  696. package/src/components/docs/integrations/IntegrationsGoogleCalendarPage.tsx +31 -31
  697. package/src/components/docs/integrations/IntegrationsHealthRoutingPage.tsx +80 -80
  698. package/src/components/docs/integrations/IntegrationsMistralPage.tsx +65 -65
  699. package/src/components/docs/integrations/IntegrationsOpenAIPage.tsx +54 -54
  700. package/src/components/docs/integrations/IntegrationsOverviewPage.tsx +124 -529
  701. package/src/components/docs/integrations/IntegrationsPostmarkPage.tsx +97 -97
  702. package/src/components/docs/integrations/IntegrationsPowensPage.tsx +165 -165
  703. package/src/components/docs/integrations/IntegrationsQdrantPage.tsx +44 -44
  704. package/src/components/docs/integrations/IntegrationsResendPage.tsx +40 -40
  705. package/src/components/docs/integrations/IntegrationsS3Page.tsx +48 -48
  706. package/src/components/docs/integrations/IntegrationsSlackPage.tsx +70 -70
  707. package/src/components/docs/integrations/IntegrationsSpecModelPage.tsx +139 -139
  708. package/src/components/docs/integrations/IntegrationsStripePage.tsx +153 -153
  709. package/src/components/docs/integrations/IntegrationsTwilioPage.tsx +50 -50
  710. package/src/components/docs/integrations/IntegrationsWhatsappMetaPage.tsx +69 -69
  711. package/src/components/docs/integrations/IntegrationsWhatsappTwilioPage.tsx +73 -73
  712. package/src/components/docs/integrations/index.ts +1 -1
  713. package/src/components/docs/intent/ContractFirstApiPage.tsx +61 -61
  714. package/src/components/docs/intent/DeterministicCodegenPage.tsx +81 -80
  715. package/src/components/docs/intent/GenerateClientFromSchemaPage.tsx +108 -108
  716. package/src/components/docs/intent/OpenapiAlternativePage.tsx +98 -98
  717. package/src/components/docs/intent/SchemaValidationTypescriptPage.tsx +79 -79
  718. package/src/components/docs/intent/SpecDrivenDevelopmentPage.tsx +67 -67
  719. package/src/components/docs/intent/index.ts +3 -3
  720. package/src/components/docs/intent/intent-pages.docblocks.ts +186 -186
  721. package/src/components/docs/knowledge/KnowledgeCategoriesPage.tsx +304 -304
  722. package/src/components/docs/knowledge/KnowledgeExamplesPage.tsx +84 -84
  723. package/src/components/docs/knowledge/KnowledgeOverviewPage.tsx +76 -285
  724. package/src/components/docs/knowledge/KnowledgeSourcesPage.tsx +171 -171
  725. package/src/components/docs/knowledge/KnowledgeSpacesPage.tsx +132 -132
  726. package/src/components/docs/knowledge/index.ts +1 -1
  727. package/src/components/docs/libraries/LibrariesAccessibilityPage.tsx +95 -95
  728. package/src/components/docs/libraries/LibrariesAiAgentPage.tsx +58 -58
  729. package/src/components/docs/libraries/LibrariesAnalyticsPage.tsx +39 -39
  730. package/src/components/docs/libraries/LibrariesContentGenPage.tsx +41 -41
  731. package/src/components/docs/libraries/LibrariesContractsPage.tsx +132 -132
  732. package/src/components/docs/libraries/LibrariesCostTrackingPage.tsx +47 -47
  733. package/src/components/docs/libraries/LibrariesDataBackendPage.tsx +73 -73
  734. package/src/components/docs/libraries/LibrariesDataViewsPage.tsx +76 -76
  735. package/src/components/docs/libraries/LibrariesDesignSystemPage.tsx +115 -115
  736. package/src/components/docs/libraries/LibrariesEvolutionPage.tsx +64 -64
  737. package/src/components/docs/libraries/LibrariesGraphQLPage.tsx +92 -92
  738. package/src/components/docs/libraries/LibrariesGrowthPage.tsx +37 -37
  739. package/src/components/docs/libraries/LibrariesMultiTenancyPage.tsx +47 -47
  740. package/src/components/docs/libraries/LibrariesObservabilityPage.tsx +58 -58
  741. package/src/components/docs/libraries/LibrariesOverlayEnginePage.tsx +51 -51
  742. package/src/components/docs/libraries/LibrariesOverviewPage.tsx +137 -301
  743. package/src/components/docs/libraries/LibrariesPersonalizationPage.tsx +57 -57
  744. package/src/components/docs/libraries/LibrariesProgressiveDeliveryPage.tsx +51 -51
  745. package/src/components/docs/libraries/LibrariesResiliencePage.tsx +54 -54
  746. package/src/components/docs/libraries/LibrariesRuntimePage.tsx +96 -96
  747. package/src/components/docs/libraries/LibrariesSLOPage.tsx +52 -52
  748. package/src/components/docs/libraries/LibrariesSchemaPage.tsx +131 -131
  749. package/src/components/docs/libraries/LibrariesSupportBotPage.tsx +59 -59
  750. package/src/components/docs/libraries/LibrariesTestingPage.tsx +64 -64
  751. package/src/components/docs/libraries/LibrariesUIKitPage.tsx +85 -85
  752. package/src/components/docs/libraries/LibrariesWorkflowComposerPage.tsx +38 -38
  753. package/src/components/docs/libraries/LibrariesWorkflowsPage.tsx +79 -79
  754. package/src/components/docs/libraries/index.ts +4 -4
  755. package/src/components/docs/manifesto/ManifestoPage.tsx +61 -132
  756. package/src/components/docs/ops/AutoEvolutionOpsPage.tsx +81 -81
  757. package/src/components/docs/ops/DistributedTracingOpsPage.tsx +28 -28
  758. package/src/components/docs/ops/ops-lifecycle.docblocks.ts +32 -32
  759. package/src/components/docs/ops/ops-runbooks-a.docblocks.ts +60 -60
  760. package/src/components/docs/ops/ops-runbooks-b.docblocks.ts +60 -60
  761. package/src/components/docs/ops/ops-slo-tenant.docblocks.ts +61 -61
  762. package/src/components/docs/ops/ops-top.docs.ts +10 -10
  763. package/src/components/docs/ops/ops.docs.ts +6 -6
  764. package/src/components/docs/product/product.docblocks.ts +60 -60
  765. package/src/components/docs/reference/DocsMarkdownContent.tsx +74 -74
  766. package/src/components/docs/reference/DocsReferenceContent.tsx +51 -51
  767. package/src/components/docs/reference/DocsReferenceIndexClient.tsx +106 -105
  768. package/src/components/docs/reference/DocsReferenceIndexPage.tsx +2 -2
  769. package/src/components/docs/reference/DocsReferencePage.tsx +3 -3
  770. package/src/components/docs/reference/docsMarkdownParser.ts +90 -90
  771. package/src/components/docs/safety/SafetyAuditingPage.tsx +189 -189
  772. package/src/components/docs/safety/SafetyMigrationsPage.tsx +189 -189
  773. package/src/components/docs/safety/SafetyOverviewPage.tsx +70 -157
  774. package/src/components/docs/safety/SafetyPDPPage.tsx +163 -163
  775. package/src/components/docs/safety/SafetySecurityTrustPage.tsx +89 -89
  776. package/src/components/docs/safety/SafetySigningPage.tsx +38 -38
  777. package/src/components/docs/safety/SafetyTenantIsolationPage.tsx +39 -39
  778. package/src/components/docs/safety/index.ts +3 -3
  779. package/src/components/docs/shared/StudioPrompt.tsx +17 -17
  780. package/src/components/docs/specs/SpecsCapabilitiesPage.tsx +79 -79
  781. package/src/components/docs/specs/SpecsDataViewsPage.tsx +142 -142
  782. package/src/components/docs/specs/SpecsOverlaysPage.tsx +202 -202
  783. package/src/components/docs/specs/SpecsOverviewPage.tsx +118 -193
  784. package/src/components/docs/specs/SpecsPolicyPage.tsx +233 -233
  785. package/src/components/docs/specs/SpecsWorkflowsPage.tsx +156 -156
  786. package/src/components/docs/specs/index.ts +3 -3
  787. package/src/components/docs/studio/StudioBYOKPage.tsx +11 -11
  788. package/src/components/docs/studio/StudioDeploymentsPage.tsx +11 -11
  789. package/src/components/docs/studio/StudioGettingStartedPage.tsx +11 -11
  790. package/src/components/docs/studio/StudioIntegrationsPage.tsx +11 -11
  791. package/src/components/docs/studio/StudioOverviewPage.tsx +94 -73
  792. package/src/components/docs/studio/StudioVisualBuilderPage.tsx +11 -11
  793. package/src/components/docs/studio/index.ts +4 -4
  794. package/src/components/docs/tech/contracts/tech-docs.docblocks.ts +10 -10
  795. package/src/components/integrations/molecules/IntegrationCard.tsx +71 -72
  796. package/src/components/integrations/organisms/IntegrationMarketplace.tsx +116 -116
  797. package/src/components/integrations/organisms/IntegrationSettings.tsx +201 -201
  798. package/src/components/integrations/organisms/KnowledgeSourceList.tsx +93 -94
  799. package/src/components/legal/PrivacyTemplate.tsx +611 -611
  800. package/src/components/legal/TermsTemplate.tsx +675 -675
  801. package/src/components/shared/FeatureGateNotice.tsx +26 -27
  802. package/src/components/shell/WorkspaceHeader.tsx +80 -80
  803. package/src/components/shell/WorkspaceProjectShellLayout.tsx +59 -58
  804. package/src/components/shell/WorkspaceShellRenderer.tsx +69 -68
  805. package/src/components/shell/WorkspaceSidebar.tsx +58 -58
  806. package/src/components/shell/index.ts +1 -1
  807. package/src/components/templates/engine/index.ts +29 -28
  808. package/src/components/templates/index.ts +1 -1
  809. package/src/components/templates/messaging/ConversationList.tsx +68 -69
  810. package/src/components/templates/messaging/MessageComposer.tsx +59 -59
  811. package/src/components/templates/messaging/MessageThread.tsx +73 -74
  812. package/src/components/templates/messaging/MessagingWorkspace.tsx +18 -19
  813. package/src/components/templates/messaging/index.ts +1 -1
  814. package/src/components/templates/messaging/types.ts +17 -17
  815. package/src/components/templates/recipes/LanguageSwitcher.tsx +20 -20
  816. package/src/components/templates/recipes/RecipeCard.tsx +56 -56
  817. package/src/components/templates/recipes/RecipeDetail.tsx +43 -43
  818. package/src/components/templates/recipes/RecipeList.tsx +62 -63
  819. package/src/components/templates/recipes/index.ts +2 -2
  820. package/src/components/templates/recipes/types.ts +24 -24
  821. package/src/components/templates/todos/FilterBar.tsx +84 -84
  822. package/src/components/templates/todos/TaskForm.tsx +118 -119
  823. package/src/components/templates/todos/TaskItem.tsx +78 -78
  824. package/src/components/templates/todos/TaskList.tsx +106 -107
  825. package/src/components/templates/todos/index.ts +2 -2
  826. package/src/components/templates/todos/types.ts +11 -11
  827. package/src/config/contractspec-blueprint.ts +55 -55
  828. package/src/config/contractspec-branding.ts +37 -37
  829. package/src/config/contractspec-routes.ts +22 -22
  830. package/src/config/index.ts +14 -15
  831. package/src/features/contracts-registry.ts +118 -118
  832. package/src/features/docs/docs.contracts.ts +6 -6
  833. package/src/features/docs/index.ts +6 -6
  834. package/src/features/docs.feature.ts +27 -27
  835. package/src/features/index.ts +59 -63
  836. package/src/features/mcp.feature.ts +24 -24
  837. package/src/features/presentations.feature.ts +27 -27
  838. package/src/features/registry.ts +14 -14
  839. package/src/index.ts +2 -2
  840. package/src/infrastructure/elysia/logger.ts +21 -21
  841. package/src/libs/email/client.test.ts +81 -81
  842. package/src/libs/email/client.ts +111 -111
  843. package/src/libs/email/contact.ts +35 -35
  844. package/src/libs/email/newsletter.ts +46 -46
  845. package/src/libs/email/types.ts +29 -29
  846. package/src/libs/email/utils.ts +5 -5
  847. package/src/libs/email/waitlist-application.ts +69 -69
  848. package/src/libs/email/waitlist.ts +46 -46
  849. package/src/libs/email.ts +7 -7
  850. package/src/libs/posthog/client.ts +44 -44
  851. package/src/libs/posthog/native.ts +23 -22
  852. package/src/libs/posthog/server.ts +7 -7
  853. package/src/libs/pricing-examples.ts +12 -12
  854. package/src/presentation/features/atoms/FeatureIcon/FeatureIcon.tsx +90 -90
  855. package/src/presentation/features/atoms/FeatureIcon/index.ts +3 -3
  856. package/src/presentation/features/hooks/index.ts +9 -9
  857. package/src/presentation/features/hooks/useContractsRegistry.ts +23 -23
  858. package/src/presentation/features/hooks/useFeatureFilters.ts +117 -117
  859. package/src/presentation/features/hooks/useFeatureRegistry.ts +40 -40
  860. package/src/presentation/features/hooks/useRelatedDocs.ts +28 -28
  861. package/src/presentation/features/index.ts +50 -52
  862. package/src/presentation/features/molecules/FeatureCard/FeatureCard.tsx +80 -80
  863. package/src/presentation/features/molecules/FeatureCard/types.ts +6 -6
  864. package/src/presentation/features/molecules/FeatureCategoryHeader/FeatureCategoryHeader.tsx +54 -54
  865. package/src/presentation/features/molecules/FeatureCategoryHeader/index.ts +2 -2
  866. package/src/presentation/features/molecules/FeatureFilters/FeatureFilters.tsx +67 -67
  867. package/src/presentation/features/molecules/FeatureFilters/types.ts +20 -20
  868. package/src/presentation/features/molecules/FeatureHoverPreview/FeatureHoverPreview.tsx +120 -121
  869. package/src/presentation/features/molecules/FeatureHoverPreview/index.ts +2 -2
  870. package/src/presentation/features/molecules/index.ts +8 -8
  871. package/src/presentation/features/organisms/FeatureDataViewsList.tsx +21 -21
  872. package/src/presentation/features/organisms/FeatureDetail/FeatureDetail.tsx +86 -86
  873. package/src/presentation/features/organisms/FeatureDetail/types.ts +4 -4
  874. package/src/presentation/features/organisms/FeatureDiscovery/FeatureDiscovery.tsx +210 -210
  875. package/src/presentation/features/organisms/FeatureDiscovery/index.ts +3 -3
  876. package/src/presentation/features/organisms/FeatureDiscovery/types.ts +10 -10
  877. package/src/presentation/features/organisms/FeatureEventsList.tsx +19 -19
  878. package/src/presentation/features/organisms/FeatureFormsList.tsx +19 -19
  879. package/src/presentation/features/organisms/FeatureOperationsList.tsx +21 -21
  880. package/src/presentation/features/organisms/FeaturePresentationsList.tsx +21 -21
  881. package/src/presentation/features/organisms/index.ts +6 -6
  882. package/src/presentation/features/templates/FeatureDataViewDetailTemplate/FeatureDataViewDetailTemplate.tsx +219 -219
  883. package/src/presentation/features/templates/FeatureDataViewDetailTemplate/types.ts +7 -7
  884. package/src/presentation/features/templates/FeatureDataViewsTemplate/FeatureDataViewsTemplate.tsx +26 -26
  885. package/src/presentation/features/templates/FeatureEventDetailTemplate/FeatureEventDetailTemplate.tsx +195 -195
  886. package/src/presentation/features/templates/FeatureEventDetailTemplate/types.ts +7 -7
  887. package/src/presentation/features/templates/FeatureEventsTemplate/FeatureEventsTemplate.tsx +26 -26
  888. package/src/presentation/features/templates/FeatureFormDetailTemplate/FeatureFormDetailTemplate.tsx +216 -216
  889. package/src/presentation/features/templates/FeatureFormDetailTemplate/types.ts +7 -7
  890. package/src/presentation/features/templates/FeatureFormsTemplate/FeatureFormsTemplate.tsx +26 -26
  891. package/src/presentation/features/templates/FeatureOperationDetailTemplate/FeatureOperationDetailTemplate.tsx +228 -228
  892. package/src/presentation/features/templates/FeatureOperationDetailTemplate/types.ts +7 -7
  893. package/src/presentation/features/templates/FeatureOperationsTemplate/FeatureOperationsTemplate.tsx +26 -26
  894. package/src/presentation/features/templates/FeatureOverviewTemplate/FeatureOverviewTemplate.tsx +24 -24
  895. package/src/presentation/features/templates/FeaturePresentationDetailTemplate/FeaturePresentationDetailTemplate.tsx +201 -201
  896. package/src/presentation/features/templates/FeaturePresentationDetailTemplate/types.ts +8 -8
  897. package/src/presentation/features/templates/FeaturePresentationsTemplate/FeaturePresentationsTemplate.tsx +26 -26
  898. package/src/presentation/features/templates/types.ts +2 -2
  899. package/tsconfig.json +12 -12
  900. package/tsdown.config.js +5 -5
@@ -1,11 +1,38 @@
1
1
  // @bun
2
+ // src/infrastructure/elysia/logger.ts
3
+ import { Logger, LogLevel } from "@contractspec/lib.logger";
4
+ var createAppLogger = () => new Logger({
5
+ level: LogLevel.INFO,
6
+ environment: "production",
7
+ enableTracing: true,
8
+ enableTiming: true,
9
+ enableContext: true,
10
+ enableColors: false
11
+ });
12
+ var appLogger = createAppLogger();
13
+ var dbLogger = new Logger({
14
+ level: LogLevel.WARN,
15
+ environment: "production",
16
+ enableTracing: true,
17
+ enableTiming: true,
18
+ enableContext: true,
19
+ enableColors: false
20
+ });
21
+ var authLogger = new Logger({
22
+ level: LogLevel.INFO,
23
+ environment: "production",
24
+ enableTracing: true,
25
+ enableTiming: true,
26
+ enableContext: true,
27
+ enableColors: false
28
+ });
2
29
  // src/application/mcp/common.ts
3
- import { PresentationRegistry } from "@contractspec/lib.contracts-spec/presentations";
30
+ import { randomUUID } from "crypto";
4
31
  import { createMcpServer } from "@contractspec/lib.contracts-runtime-server-mcp/provider-mcp";
32
+ import { PresentationRegistry } from "@contractspec/lib.contracts-spec/presentations";
5
33
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
6
34
  import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
7
35
  import { Elysia } from "elysia";
8
- import { randomUUID } from "crypto";
9
36
  var baseCtx = {
10
37
  actor: "anonymous",
11
38
  decide: async () => ({ effect: "allow" })
@@ -171,44 +198,10 @@ function createMcpElysiaHandler({
171
198
  });
172
199
  }
173
200
 
174
- // src/infrastructure/elysia/logger.ts
175
- import { Logger, LogLevel } from "@contractspec/lib.logger";
176
- var createAppLogger = () => new Logger({
177
- level: LogLevel.INFO,
178
- environment: "production",
179
- enableTracing: true,
180
- enableTiming: true,
181
- enableContext: true,
182
- enableColors: false
183
- });
184
- var appLogger = createAppLogger();
185
- var dbLogger = new Logger({
186
- level: LogLevel.WARN,
187
- environment: "production",
188
- enableTracing: true,
189
- enableTiming: true,
190
- enableContext: true,
191
- enableColors: false
192
- });
193
- var authLogger = new Logger({
194
- level: LogLevel.INFO,
195
- environment: "production",
196
- enableTracing: true,
197
- enableTiming: true,
198
- enableContext: true,
199
- enableColors: false
200
- });
201
- // src/features/docs/docs.contracts.ts
202
- import {
203
- DocSummaryModel,
204
- DocsIndexInput,
205
- DocsIndexOutput,
206
- DocsIndexQuery,
207
- DocsIndexQuery as DocsIndexQuery2,
208
- ContractReferenceQuery
209
- } from "@contractspec/lib.contracts-spec/docs";
210
- // src/application/mcp/docsMcp.ts
201
+ // src/application/mcp/cliMcp.ts
202
+ import fs from "fs/promises";
211
203
  import {
204
+ defineCommand,
212
205
  definePrompt,
213
206
  defineResourceTemplate,
214
207
  installOp,
@@ -216,165 +209,9 @@ import {
216
209
  PromptRegistry,
217
210
  ResourceRegistry
218
211
  } from "@contractspec/lib.contracts-spec";
219
- import { defaultDocRegistry } from "@contractspec/lib.contracts-spec/docs";
220
- import z from "zod";
221
- var DOC_OWNERS = ["@contractspec"];
222
- var DOC_TAGS = ["docs", "mcp"];
223
- function buildDocResources(routes) {
224
- const resources = new ResourceRegistry;
225
- resources.register(defineResourceTemplate({
226
- meta: {
227
- uriTemplate: "docs://list",
228
- title: "DocBlocks index",
229
- description: "All registered DocBlocks with route, visibility, tags, and summary.",
230
- mimeType: "application/json",
231
- tags: DOC_TAGS
232
- },
233
- input: z.object({}),
234
- resolve: async () => {
235
- const docs = routes.map(({ block, route }) => ({
236
- id: block.id,
237
- title: block.title,
238
- summary: block.summary ?? "",
239
- tags: block.tags ?? [],
240
- visibility: block.visibility ?? "public",
241
- route
242
- }));
243
- return {
244
- uri: "docs://list",
245
- mimeType: "application/json",
246
- data: JSON.stringify(docs, null, 2)
247
- };
248
- }
249
- }));
250
- resources.register(defineResourceTemplate({
251
- meta: {
252
- uriTemplate: "docs://doc/{id}",
253
- title: "DocBlock markdown",
254
- description: "Fetch DocBlock body by id as markdown.",
255
- mimeType: "text/markdown",
256
- tags: DOC_TAGS
257
- },
258
- input: z.object({ id: z.string() }),
259
- resolve: async ({ id }) => {
260
- const found = defaultDocRegistry.get(id);
261
- if (!found) {
262
- return {
263
- uri: `docs://doc/${encodeURIComponent(id)}`,
264
- mimeType: "text/plain",
265
- data: `DocBlock not found: ${id}`
266
- };
267
- }
268
- return {
269
- uri: `docs://doc/${encodeURIComponent(id)}`,
270
- mimeType: "text/markdown",
271
- data: String(found.block.body ?? "")
272
- };
273
- }
274
- }));
275
- return resources;
276
- }
277
- function buildDocPrompts() {
278
- const prompts = new PromptRegistry;
279
- prompts.register(definePrompt({
280
- meta: {
281
- key: "docs.navigator",
282
- version: "1.0.0",
283
- title: "Find relevant ContractSpec docs",
284
- description: "Guide agents to pick the right DocBlock by topic or tag.",
285
- tags: DOC_TAGS,
286
- stability: "beta",
287
- owners: DOC_OWNERS
288
- },
289
- args: [
290
- {
291
- name: "topic",
292
- description: "Goal or subject to search for.",
293
- required: false,
294
- schema: z.string().optional()
295
- },
296
- {
297
- name: "tag",
298
- description: "Optional tag filter.",
299
- required: false,
300
- schema: z.string().optional()
301
- }
302
- ],
303
- input: z.object({
304
- topic: z.string().optional(),
305
- tag: z.string().optional()
306
- }),
307
- render: async ({ topic, tag }) => {
308
- const parts = [
309
- {
310
- type: "text",
311
- text: `Use the docs index to choose DocBlocks. If a specific topic is provided, prefer docs whose id/title/summary match it.${topic ? ` Topic: ${topic}.` : ""}${tag ? ` Tag: ${tag}.` : ""}`
312
- },
313
- {
314
- type: "resource",
315
- uri: "docs://list",
316
- title: "DocBlocks index"
317
- }
318
- ];
319
- return parts;
320
- }
321
- }));
322
- return prompts;
323
- }
324
- function buildDocOps(routes) {
325
- const registry = new OperationSpecRegistry;
326
- installOp(registry, DocsIndexQuery, async (args) => {
327
- const query = args.query?.toLowerCase().trim();
328
- const tagsFilter = args.tag?.map((t) => t.toLowerCase().trim()) ?? [];
329
- const visibility = args.visibility?.toLowerCase().trim();
330
- const docs = routes.map(({ block, route }) => ({
331
- id: block.id,
332
- title: block.title,
333
- summary: block.summary ?? "",
334
- tags: block.tags ?? [],
335
- visibility: (block.visibility ?? "public").toLowerCase(),
336
- route
337
- })).filter((doc) => {
338
- const matchesQuery = query ? doc.id.toLowerCase().includes(query) || doc.title.toLowerCase().includes(query) || doc.summary.toLowerCase().includes(query) : true;
339
- const matchesTags = tagsFilter.length ? tagsFilter.every((t) => doc.tags.some((tag) => tag.toLowerCase().includes(t))) : true;
340
- const matchesVisibility = visibility ? doc.visibility === visibility : true;
341
- return matchesQuery && matchesTags && matchesVisibility;
342
- });
343
- return {
344
- docs,
345
- items: docs,
346
- total: docs.length
347
- };
348
- });
349
- return registry;
350
- }
351
- function createDocsMcpHandler(path = "/api/mcp/docs") {
352
- const routes = defaultDocRegistry.list();
353
- return createMcpElysiaHandler({
354
- logger: appLogger,
355
- path,
356
- serverName: "contractspec-docs-mcp",
357
- ops: buildDocOps(routes),
358
- resources: buildDocResources(routes),
359
- prompts: buildDocPrompts(),
360
- presentations: routes.map(({ descriptor }) => descriptor)
361
- });
362
- }
363
-
364
- // src/application/mcp/cliMcp.ts
365
- import fs from "fs/promises";
366
- import path from "path";
367
- import {
368
- defineCommand,
369
- definePrompt as definePrompt2,
370
- defineResourceTemplate as defineResourceTemplate2,
371
- installOp as installOp2,
372
- OperationSpecRegistry as OperationSpecRegistry2,
373
- PromptRegistry as PromptRegistry2,
374
- ResourceRegistry as ResourceRegistry2
375
- } from "@contractspec/lib.contracts-spec";
376
212
  import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
377
- import z2 from "zod";
213
+ import path from "path";
214
+ import z from "zod";
378
215
  var __dirname = "/home/runner/work/contractspec/contractspec/packages/bundles/library/src/application/mcp";
379
216
  var CLI_DOC_PATHS = {
380
217
  quickstart: "packages/apps/cli-contractspec/QUICK_START.md",
@@ -427,8 +264,8 @@ async function loadCliDoc(key) {
427
264
  return fallback;
428
265
  }
429
266
  function buildCliResources() {
430
- const resources = new ResourceRegistry2;
431
- resources.register(defineResourceTemplate2({
267
+ const resources = new ResourceRegistry;
268
+ resources.register(defineResourceTemplate({
432
269
  meta: {
433
270
  uriTemplate: "cli://doc/{slug}",
434
271
  title: "CLI documentation",
@@ -436,8 +273,8 @@ function buildCliResources() {
436
273
  mimeType: "text/markdown",
437
274
  tags: CLI_DOC_TAGS
438
275
  },
439
- input: z2.object({
440
- slug: z2.enum(["quickstart", "reference", "readme"])
276
+ input: z.object({
277
+ slug: z.enum(["quickstart", "reference", "readme"])
441
278
  }),
442
279
  resolve: async ({ slug }) => {
443
280
  const data = await loadCliDoc(slug);
@@ -448,7 +285,7 @@ function buildCliResources() {
448
285
  };
449
286
  }
450
287
  }));
451
- resources.register(defineResourceTemplate2({
288
+ resources.register(defineResourceTemplate({
452
289
  meta: {
453
290
  uriTemplate: "cli://commands",
454
291
  title: "CLI commands summary",
@@ -456,7 +293,7 @@ function buildCliResources() {
456
293
  mimeType: "application/json",
457
294
  tags: CLI_DOC_TAGS
458
295
  },
459
- input: z2.object({}),
296
+ input: z.object({}),
460
297
  resolve: async () => {
461
298
  const commands = [
462
299
  {
@@ -485,8 +322,8 @@ function buildCliResources() {
485
322
  return resources;
486
323
  }
487
324
  function buildCliPrompts() {
488
- const prompts = new PromptRegistry2;
489
- prompts.register(definePrompt2({
325
+ const prompts = new PromptRegistry;
326
+ prompts.register(definePrompt({
490
327
  meta: {
491
328
  key: "cli.usage",
492
329
  version: "1.0.0",
@@ -501,10 +338,10 @@ function buildCliPrompts() {
501
338
  name: "goal",
502
339
  description: "Task the user wants to achieve.",
503
340
  required: false,
504
- schema: z2.string().optional()
341
+ schema: z.string().optional()
505
342
  }
506
343
  ],
507
- input: z2.object({ goal: z2.string().optional() }),
344
+ input: z.object({ goal: z.string().optional() }),
508
345
  render: async ({ goal }) => [
509
346
  {
510
347
  type: "text",
@@ -521,7 +358,7 @@ function buildCliPrompts() {
521
358
  return prompts;
522
359
  }
523
360
  function buildCliOps() {
524
- const registry = new OperationSpecRegistry2;
361
+ const registry = new OperationSpecRegistry;
525
362
  const CliSuggestInput = defineSchemaModel({
526
363
  name: "CliSuggestInput",
527
364
  fields: {
@@ -556,7 +393,7 @@ function buildCliOps() {
556
393
  auth: "anonymous"
557
394
  }
558
395
  });
559
- installOp2(registry, suggestSpec, async ({ goal, prefersAi }) => {
396
+ installOp(registry, suggestSpec, async ({ goal, prefersAi }) => {
560
397
  const lower = goal.toLowerCase();
561
398
  if (lower.includes("create") || lower.includes("new")) {
562
399
  return {
@@ -598,831 +435,996 @@ function createCliMcpHandler(path2 = "/api/mcp/cli") {
598
435
  });
599
436
  }
600
437
 
601
- // src/application/mcp/internalMcp.ts
438
+ // src/application/mcp/contractsMcpResources.ts
602
439
  import {
603
- defineCommand as defineCommand2,
604
- definePrompt as definePrompt3,
605
- defineResourceTemplate as defineResourceTemplate3,
606
- installOp as installOp3,
607
- OperationSpecRegistry as OperationSpecRegistry3,
608
- PromptRegistry as PromptRegistry3,
609
- ResourceRegistry as ResourceRegistry3
440
+ definePrompt as definePrompt2,
441
+ defineResourceTemplate as defineResourceTemplate2,
442
+ PromptRegistry as PromptRegistry2,
443
+ ResourceRegistry as ResourceRegistry2
610
444
  } from "@contractspec/lib.contracts-spec";
611
- import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
612
- import z3 from "zod";
613
- import {
614
- getExample,
615
- listExamples,
616
- searchExamples
617
- } from "@contractspec/module.examples";
618
- var INTERNAL_TAGS = ["internal", "mcp"];
619
- var INTERNAL_OWNERS = ["@contractspec"];
620
- var ENDPOINTS = {
621
- docs: "/api/mcp/docs",
622
- cli: "/api/mcp/cli",
623
- internal: "/api/mcp/internal",
624
- graphql: "/graphql",
625
- health: "/health"
626
- };
627
- function buildInternalResources() {
628
- const resources = new ResourceRegistry3;
629
- resources.register(defineResourceTemplate3({
445
+ import z2 from "zod";
446
+ var OWNERS = ["@contractspec"];
447
+ var TAGS = ["contracts", "mcp"];
448
+ function buildContractsResources(services) {
449
+ const resources = new ResourceRegistry2;
450
+ resources.register(defineResourceTemplate2({
630
451
  meta: {
631
- uriTemplate: "examples://list{?q}",
632
- title: "ContractSpec examples registry",
633
- description: "List available examples (templates, integrations, knowledge, scripts). Optional query `q` filters results.",
452
+ uriTemplate: "contracts://list",
453
+ title: "Contract specs list",
454
+ description: "JSON list of all contract specs in the workspace.",
634
455
  mimeType: "application/json",
635
- tags: ["examples", ...INTERNAL_TAGS]
456
+ tags: TAGS
636
457
  },
637
- input: z3.object({ q: z3.string().optional() }),
638
- resolve: async ({ q }) => {
639
- const items = q ? searchExamples(q) : [...listExamples()];
458
+ input: z2.object({}),
459
+ resolve: async () => {
460
+ const specs = await services.listSpecs();
640
461
  return {
641
- uri: q ? `examples://list?q=${encodeURIComponent(q)}` : "examples://list",
462
+ uri: "contracts://list",
642
463
  mimeType: "application/json",
643
- data: JSON.stringify(items, null, 2)
464
+ data: JSON.stringify(specs, null, 2)
644
465
  };
645
466
  }
646
467
  }));
647
- resources.register(defineResourceTemplate3({
468
+ resources.register(defineResourceTemplate2({
648
469
  meta: {
649
- uriTemplate: "examples://example/{id}",
650
- title: "ContractSpec example (by id)",
651
- description: "Fetch a single example manifest by id.",
652
- mimeType: "application/json",
653
- tags: ["examples", ...INTERNAL_TAGS]
470
+ uriTemplate: "contracts://spec/{path}",
471
+ title: "Contract spec content",
472
+ description: "Read a single contract spec file by path.",
473
+ mimeType: "text/plain",
474
+ tags: TAGS
654
475
  },
655
- input: z3.object({ id: z3.string().min(1) }),
656
- resolve: async ({ id }) => {
657
- const example = getExample(id);
658
- if (!example) {
476
+ input: z2.object({ path: z2.string() }),
477
+ resolve: async ({ path: path2 }) => {
478
+ const result = await services.getSpec(path2);
479
+ if (!result) {
659
480
  return {
660
- uri: `examples://example/${encodeURIComponent(id)}`,
661
- mimeType: "application/json",
662
- data: JSON.stringify({ error: "not_found", id, message: `Unknown example id: ${id}` }, null, 2)
481
+ uri: `contracts://spec/${encodeURIComponent(path2)}`,
482
+ mimeType: "text/plain",
483
+ data: `Spec not found: ${path2}`
663
484
  };
664
485
  }
665
486
  return {
666
- uri: `examples://example/${encodeURIComponent(id)}`,
667
- mimeType: "application/json",
668
- data: JSON.stringify(example, null, 2)
487
+ uri: `contracts://spec/${encodeURIComponent(path2)}`,
488
+ mimeType: "text/plain",
489
+ data: result.content
669
490
  };
670
491
  }
671
492
  }));
672
- resources.register(defineResourceTemplate3({
493
+ resources.register(defineResourceTemplate2({
673
494
  meta: {
674
- uriTemplate: "internal://endpoints",
675
- title: "ContractSpec MCP endpoints",
676
- description: "Endpoints for docs, CLI, internal MCP servers.",
677
- mimeType: "application/json",
678
- tags: INTERNAL_TAGS
679
- },
680
- input: z3.object({}),
681
- resolve: async () => ({
682
- uri: "internal://endpoints",
495
+ uriTemplate: "contracts://registry/manifest",
496
+ title: "Remote registry manifest",
497
+ description: "Contract registry manifest from the remote server.",
683
498
  mimeType: "application/json",
684
- data: JSON.stringify(ENDPOINTS, null, 2)
685
- })
686
- }));
687
- resources.register(defineResourceTemplate3({
688
- meta: {
689
- uriTemplate: "internal://playbook",
690
- title: "Internal MCP usage playbook",
691
- description: "How internal agents should discover docs, CLI usage, and endpoints.",
692
- mimeType: "text/markdown",
693
- tags: INTERNAL_TAGS
499
+ tags: TAGS
694
500
  },
695
- input: z3.object({}),
696
- resolve: async () => ({
697
- uri: "internal://playbook",
698
- mimeType: "text/markdown",
699
- data: [
700
- "# Internal MCP playbook",
701
- "- Connect to docs MCP first for canonical specs.",
702
- "- Use CLI MCP to surface quickstart/reference before running commands.",
703
- "- Keep calls read-only unless explicitly approved.",
704
- `- Endpoints: ${ENDPOINTS.docs}, ${ENDPOINTS.cli}, ${ENDPOINTS.internal}.`,
705
- "- For API work, GraphQL at /graphql; health at /health."
706
- ].join(`
707
- `)
708
- })
501
+ input: z2.object({}),
502
+ resolve: async () => {
503
+ const manifest = await services.fetchRegistryManifest();
504
+ return {
505
+ uri: "contracts://registry/manifest",
506
+ mimeType: "application/json",
507
+ data: JSON.stringify(manifest, null, 2)
508
+ };
509
+ }
709
510
  }));
710
511
  return resources;
711
512
  }
712
- function buildInternalPrompts() {
713
- const prompts = new PromptRegistry3;
714
- prompts.register(definePrompt3({
513
+ function buildContractsPrompts() {
514
+ const prompts = new PromptRegistry2;
515
+ prompts.register(definePrompt2({
715
516
  meta: {
716
- key: "internal_bootstrap",
517
+ key: "contracts.editor",
717
518
  version: "1.0.0",
718
- title: "Bootstrap internal ContractSpec agent",
719
- description: "Points agents to the correct MCP endpoints and guardrails.",
720
- tags: INTERNAL_TAGS,
721
- owners: INTERNAL_OWNERS,
722
- stability: "beta"
519
+ title: "Contract editing guide",
520
+ description: "Guide AI agents through reading, editing, and validating contracts.",
521
+ tags: TAGS,
522
+ stability: "beta",
523
+ owners: OWNERS
723
524
  },
724
- args: [],
725
- input: z3.object({}),
726
- render: async () => [
525
+ args: [
526
+ {
527
+ name: "goal",
528
+ description: "What the agent wants to achieve with the contract.",
529
+ required: false,
530
+ schema: z2.string().optional()
531
+ }
532
+ ],
533
+ input: z2.object({ goal: z2.string().optional() }),
534
+ render: async ({ goal }) => [
727
535
  {
728
536
  type: "text",
729
- text: "Start with internal://endpoints to pick the right MCP. Use docs MCP for specifications and CLI MCP for commands. Keep actions read-only unless explicitly approved."
537
+ text: [
538
+ "Contract editing workflow:",
539
+ "1. Use contracts.list to discover specs",
540
+ "2. Use contracts.get to read a spec",
541
+ "3. Edit content and call contracts.update",
542
+ "4. Run contracts.validate to verify changes",
543
+ "5. Run contracts.build to regenerate artifacts",
544
+ goal ? `Agent goal: ${goal}` : ""
545
+ ].filter(Boolean).join(`
546
+ `)
730
547
  },
731
548
  {
732
549
  type: "resource",
733
- uri: "internal://endpoints",
734
- title: "Endpoints"
550
+ uri: "contracts://list",
551
+ title: "Available contracts"
735
552
  }
736
553
  ]
737
554
  }));
738
555
  return prompts;
739
556
  }
740
- function buildInternalOps() {
741
- const registry = new OperationSpecRegistry3;
742
- const InternalDescribeOutput = defineSchemaModel2({
743
- name: "InternalDescribeOutput",
557
+
558
+ // src/application/mcp/contractsMcpTools.ts
559
+ import {
560
+ defineCommand as defineCommand2,
561
+ installOp as installOp2,
562
+ OperationSpecRegistry as OperationSpecRegistry2
563
+ } from "@contractspec/lib.contracts-spec";
564
+ import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
565
+ var OWNERS2 = ["@contractspec"];
566
+ var TAGS2 = ["contracts", "mcp"];
567
+ function buildContractsOps(services) {
568
+ const registry = new OperationSpecRegistry2;
569
+ const ListInput = defineSchemaModel2({
570
+ name: "ContractsListInput",
744
571
  fields: {
745
- endpoints: {
746
- type: ScalarTypeEnum2.JSONObject(),
747
- isOptional: false
748
- },
749
- notes: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
572
+ pattern: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
573
+ type: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true }
574
+ }
575
+ });
576
+ const ListOutput = defineSchemaModel2({
577
+ name: "ContractsListOutput",
578
+ fields: {
579
+ specs: { type: ScalarTypeEnum2.JSON(), isOptional: false },
580
+ total: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false }
750
581
  }
751
582
  });
752
- const describeSpec = defineCommand2({
583
+ installOp2(registry, defineCommand2({
753
584
  meta: {
754
- key: "internal_describe",
585
+ key: "contracts.list",
755
586
  version: "1.0.0",
756
- stability: "stable",
757
- owners: INTERNAL_OWNERS,
758
- tags: INTERNAL_TAGS,
759
- description: "Return MCP endpoints and guidance for internal ContractSpec agents.",
760
- goal: "Speed up internal development with the correct MCP entrypoints.",
761
- context: "Used by internal MCP surface; read-only."
587
+ stability: "beta",
588
+ owners: OWNERS2,
589
+ tags: TAGS2,
590
+ description: "List contract specs in the workspace.",
591
+ goal: "Discover available contracts by type, pattern, or owner.",
592
+ context: "Contracts MCP server."
762
593
  },
763
- io: {
764
- input: defineSchemaModel2({
765
- name: "InternalDescribeInput",
766
- fields: {}
767
- }),
768
- output: InternalDescribeOutput
594
+ io: { input: ListInput, output: ListOutput },
595
+ policy: { auth: "anonymous" }
596
+ }), async ({ pattern, type }) => {
597
+ const specs = await services.listSpecs({ pattern, type });
598
+ return { specs, total: specs.length };
599
+ });
600
+ const GetInput = defineSchemaModel2({
601
+ name: "ContractsGetInput",
602
+ fields: {
603
+ path: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
604
+ }
605
+ });
606
+ const GetOutput = defineSchemaModel2({
607
+ name: "ContractsGetOutput",
608
+ fields: {
609
+ content: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
610
+ info: { type: ScalarTypeEnum2.JSON(), isOptional: false }
611
+ }
612
+ });
613
+ installOp2(registry, defineCommand2({
614
+ meta: {
615
+ key: "contracts.get",
616
+ version: "1.0.0",
617
+ stability: "beta",
618
+ owners: OWNERS2,
619
+ tags: TAGS2,
620
+ description: "Read a single contract spec file.",
621
+ goal: "Fetch spec content and parsed metadata.",
622
+ context: "Contracts MCP server."
769
623
  },
770
- policy: {
771
- auth: "anonymous"
624
+ io: { input: GetInput, output: GetOutput },
625
+ policy: { auth: "anonymous" }
626
+ }), async ({ path: path2 }) => {
627
+ const result = await services.getSpec(path2);
628
+ if (!result)
629
+ throw new Error(`Spec not found: ${path2}`);
630
+ return result;
631
+ });
632
+ const ValidateInput = defineSchemaModel2({
633
+ name: "ContractsValidateInput",
634
+ fields: {
635
+ path: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
772
636
  }
773
637
  });
774
- installOp3(registry, describeSpec, async () => ({
775
- endpoints: ENDPOINTS,
776
- notes: "Use docs MCP for canonical specs, CLI MCP for contractspec commands, and keep side-effecting actions gated behind human review."
777
- }));
778
- return registry;
779
- }
780
- function createInternalMcpHandler(path2 = "/api/mcp/internal") {
781
- return createMcpElysiaHandler({
782
- logger: appLogger,
783
- path: path2,
784
- serverName: "contractspec-internal-mcp",
785
- ops: buildInternalOps(),
786
- resources: buildInternalResources(),
787
- prompts: buildInternalPrompts()
638
+ const ValidateOutput = defineSchemaModel2({
639
+ name: "ContractsValidateOutput",
640
+ fields: {
641
+ valid: { type: ScalarTypeEnum2.Boolean(), isOptional: false },
642
+ errors: { type: ScalarTypeEnum2.JSON(), isOptional: false },
643
+ warnings: { type: ScalarTypeEnum2.JSON(), isOptional: false }
644
+ }
788
645
  });
789
- }
790
-
791
- // src/application/mcp/providerRankingMcp.ts
792
- import {
793
- definePrompt as definePrompt4,
794
- defineResourceTemplate as defineResourceTemplate4,
795
- installOp as installOp4,
796
- OperationSpecRegistry as OperationSpecRegistry4,
797
- PromptRegistry as PromptRegistry4,
798
- ResourceRegistry as ResourceRegistry4
799
- } from "@contractspec/lib.contracts-spec";
800
- import {
801
- BenchmarkIngestCommand,
802
- BenchmarkRunCustomCommand,
803
- RankingRefreshCommand
804
- } from "@contractspec/lib.contracts-spec/provider-ranking";
805
- import z4 from "zod";
806
- import { getModelInfo } from "@contractspec/lib.ai-providers/models";
807
- import { InMemoryProviderRankingStore } from "@contractspec/lib.provider-ranking/in-memory-store";
808
- import { createDefaultIngesterRegistry } from "@contractspec/lib.provider-ranking/ingesters";
809
- import { computeModelRankings } from "@contractspec/lib.provider-ranking/scoring";
810
- import { normalizeBenchmarkResults } from "@contractspec/lib.provider-ranking/scoring";
811
- var TransportFilterSchema = z4.enum(["rest", "mcp", "webhook", "sdk"]).optional();
812
- var AuthFilterSchema = z4.enum([
813
- "api-key",
814
- "oauth2",
815
- "bearer",
816
- "header",
817
- "basic",
818
- "webhook-signing",
819
- "service-account"
820
- ]).optional();
821
- var RANKING_TAGS = ["ranking", "mcp", "ai"];
822
- var RANKING_OWNERS = ["platform.ai"];
823
- var sharedStore = null;
824
- function getStore() {
825
- if (!sharedStore) {
826
- sharedStore = new InMemoryProviderRankingStore;
827
- }
828
- return sharedStore;
829
- }
830
- function buildRankingResources() {
831
- const resources = new ResourceRegistry4;
832
- resources.register(defineResourceTemplate4({
646
+ installOp2(registry, defineCommand2({
833
647
  meta: {
834
- uriTemplate: "ranking://leaderboard",
835
- title: "AI Model Leaderboard",
836
- description: "Current ranked list of AI models by composite score. Supports optional transport and authMethod query filters.",
837
- mimeType: "application/json",
838
- tags: RANKING_TAGS
648
+ key: "contracts.validate",
649
+ version: "1.0.0",
650
+ stability: "beta",
651
+ owners: OWNERS2,
652
+ tags: TAGS2,
653
+ description: "Validate a contract spec structure.",
654
+ goal: "Check spec for structural or policy issues.",
655
+ context: "Contracts MCP server."
839
656
  },
840
- input: z4.object({
841
- transport: TransportFilterSchema,
842
- authMethod: AuthFilterSchema
843
- }),
844
- resolve: async ({ transport, authMethod }) => {
845
- const store = getStore();
846
- const result = await store.listModelRankings({
847
- limit: 100,
848
- requiredTransport: transport,
849
- requiredAuthMethod: authMethod
850
- });
851
- return {
852
- uri: "ranking://leaderboard",
853
- mimeType: "application/json",
854
- data: JSON.stringify(result, null, 2)
855
- };
657
+ io: { input: ValidateInput, output: ValidateOutput },
658
+ policy: { auth: "anonymous" }
659
+ }), async ({ path: path2 }) => services.validateSpec(path2));
660
+ const BuildInput = defineSchemaModel2({
661
+ name: "ContractsBuildInput",
662
+ fields: {
663
+ path: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
664
+ dryRun: { type: ScalarTypeEnum2.Boolean(), isOptional: true }
856
665
  }
857
- }));
858
- resources.register(defineResourceTemplate4({
666
+ });
667
+ const BuildOutput = defineSchemaModel2({
668
+ name: "ContractsBuildOutput",
669
+ fields: {
670
+ results: { type: ScalarTypeEnum2.JSON(), isOptional: false }
671
+ }
672
+ });
673
+ installOp2(registry, defineCommand2({
859
674
  meta: {
860
- uriTemplate: "ranking://leaderboard/{dimension}",
861
- title: "AI Model Leaderboard by Dimension",
862
- description: "Ranked list of AI models filtered by a specific dimension. Supports optional transport and authMethod query filters.",
863
- mimeType: "application/json",
864
- tags: RANKING_TAGS
675
+ key: "contracts.build",
676
+ version: "1.0.0",
677
+ stability: "beta",
678
+ owners: OWNERS2,
679
+ tags: TAGS2,
680
+ description: "Generate implementation code from a contract spec.",
681
+ goal: "Produce handler, component, or test skeletons.",
682
+ context: "Contracts MCP server."
865
683
  },
866
- input: z4.object({
867
- dimension: z4.string(),
868
- transport: TransportFilterSchema,
869
- authMethod: AuthFilterSchema
870
- }),
871
- resolve: async ({ dimension, transport, authMethod }) => {
872
- const store = getStore();
873
- const result = await store.listModelRankings({
874
- dimension,
875
- limit: 100,
876
- requiredTransport: transport,
877
- requiredAuthMethod: authMethod
878
- });
879
- return {
880
- uri: `ranking://leaderboard/${encodeURIComponent(dimension)}`,
881
- mimeType: "application/json",
882
- data: JSON.stringify(result, null, 2)
883
- };
684
+ io: { input: BuildInput, output: BuildOutput },
685
+ policy: { auth: "user" }
686
+ }), async ({ path: path2, dryRun }) => services.buildSpec(path2, { dryRun }));
687
+ registerMutationTools(registry, services);
688
+ return registry;
689
+ }
690
+ function registerMutationTools(registry, services) {
691
+ const UpdateInput = defineSchemaModel2({
692
+ name: "ContractsUpdateInput",
693
+ fields: {
694
+ path: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
695
+ content: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
696
+ fields: { type: ScalarTypeEnum2.JSON(), isOptional: true }
697
+ }
698
+ });
699
+ const UpdateOutput = defineSchemaModel2({
700
+ name: "ContractsUpdateOutput",
701
+ fields: {
702
+ updated: { type: ScalarTypeEnum2.Boolean(), isOptional: false },
703
+ errors: { type: ScalarTypeEnum2.JSON(), isOptional: false },
704
+ warnings: { type: ScalarTypeEnum2.JSON(), isOptional: false }
884
705
  }
706
+ });
707
+ installOp2(registry, defineCommand2({
708
+ meta: {
709
+ key: "contracts.update",
710
+ version: "1.0.0",
711
+ stability: "beta",
712
+ owners: OWNERS2,
713
+ tags: TAGS2,
714
+ description: "Update an existing contract spec.",
715
+ goal: "Modify spec content or individual fields with validation.",
716
+ context: "Contracts MCP server."
717
+ },
718
+ io: { input: UpdateInput, output: UpdateOutput },
719
+ policy: { auth: "user" }
720
+ }), async ({ path: path2, content, fields }) => services.updateSpec(path2, {
721
+ content,
722
+ fields: Array.isArray(fields) ? fields : undefined
885
723
  }));
886
- resources.register(defineResourceTemplate4({
724
+ const DeleteInput = defineSchemaModel2({
725
+ name: "ContractsDeleteInput",
726
+ fields: {
727
+ path: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
728
+ clean: { type: ScalarTypeEnum2.Boolean(), isOptional: true }
729
+ }
730
+ });
731
+ const DeleteOutput = defineSchemaModel2({
732
+ name: "ContractsDeleteOutput",
733
+ fields: {
734
+ deleted: { type: ScalarTypeEnum2.Boolean(), isOptional: false },
735
+ cleanedFiles: { type: ScalarTypeEnum2.JSON(), isOptional: false },
736
+ errors: { type: ScalarTypeEnum2.JSON(), isOptional: false }
737
+ }
738
+ });
739
+ installOp2(registry, defineCommand2({
887
740
  meta: {
888
- uriTemplate: "ranking://model/{modelId}",
889
- title: "AI Model Profile",
890
- description: "Detailed profile for a specific AI model including scores and benchmarks.",
741
+ key: "contracts.delete",
742
+ version: "1.0.0",
743
+ stability: "beta",
744
+ owners: OWNERS2,
745
+ tags: TAGS2,
746
+ description: "Delete a contract spec and optionally its artifacts.",
747
+ goal: "Remove a spec file and clean generated handlers/tests.",
748
+ context: "Contracts MCP server."
749
+ },
750
+ io: { input: DeleteInput, output: DeleteOutput },
751
+ policy: { auth: "user" }
752
+ }), async ({ path: path2, clean }) => services.deleteSpec(path2, { clean }));
753
+ }
754
+
755
+ // src/application/mcp/contractsMcp.ts
756
+ function createContractsMcpHandler(path2 = "/api/mcp/contracts", services) {
757
+ return createMcpElysiaHandler({
758
+ logger: appLogger,
759
+ path: path2,
760
+ serverName: "contractspec-contracts-mcp",
761
+ ops: buildContractsOps(services),
762
+ resources: buildContractsResources(services),
763
+ prompts: buildContractsPrompts()
764
+ });
765
+ }
766
+
767
+ // src/features/docs/docs.contracts.ts
768
+ import {
769
+ ContractReferenceQuery,
770
+ DocSummaryModel,
771
+ DocsIndexInput,
772
+ DocsIndexOutput,
773
+ DocsIndexQuery,
774
+ DocsIndexQuery as DocsIndexQuery2
775
+ } from "@contractspec/lib.contracts-spec/docs";
776
+ // src/application/mcp/docsMcp.ts
777
+ import {
778
+ definePrompt as definePrompt3,
779
+ defineResourceTemplate as defineResourceTemplate3,
780
+ installOp as installOp3,
781
+ OperationSpecRegistry as OperationSpecRegistry3,
782
+ PromptRegistry as PromptRegistry3,
783
+ ResourceRegistry as ResourceRegistry3
784
+ } from "@contractspec/lib.contracts-spec";
785
+ import { defaultDocRegistry } from "@contractspec/lib.contracts-spec/docs";
786
+ import z3 from "zod";
787
+ var DOC_OWNERS = ["@contractspec"];
788
+ var DOC_TAGS = ["docs", "mcp"];
789
+ function buildDocResources(routes) {
790
+ const resources = new ResourceRegistry3;
791
+ resources.register(defineResourceTemplate3({
792
+ meta: {
793
+ uriTemplate: "docs://list",
794
+ title: "DocBlocks index",
795
+ description: "All registered DocBlocks with route, visibility, tags, and summary.",
891
796
  mimeType: "application/json",
892
- tags: RANKING_TAGS
797
+ tags: DOC_TAGS
893
798
  },
894
- input: z4.object({ modelId: z4.string() }),
895
- resolve: async ({ modelId }) => {
896
- const store = getStore();
897
- const profile = await store.getModelProfile(modelId);
898
- if (!profile) {
899
- return {
900
- uri: `ranking://model/${encodeURIComponent(modelId)}`,
901
- mimeType: "application/json",
902
- data: JSON.stringify({ error: "not_found", modelId })
903
- };
904
- }
905
- const enriched = profile.costPerMillion == null ? (() => {
906
- const info = getModelInfo(profile.modelId);
907
- return info?.costPerMillion ? {
908
- ...profile,
909
- costPerMillion: info.costPerMillion,
910
- displayName: info.name,
911
- contextWindow: info.contextWindow,
912
- capabilities: [
913
- ...info.capabilities.vision ? ["vision"] : [],
914
- ...info.capabilities.tools ? ["tools"] : [],
915
- ...info.capabilities.reasoning ? ["reasoning"] : [],
916
- ...info.capabilities.streaming ? ["streaming"] : []
917
- ]
918
- } : profile;
919
- })() : profile;
799
+ input: z3.object({}),
800
+ resolve: async () => {
801
+ const docs = routes.map(({ block, route }) => ({
802
+ id: block.id,
803
+ title: block.title,
804
+ summary: block.summary ?? "",
805
+ tags: block.tags ?? [],
806
+ visibility: block.visibility ?? "public",
807
+ route
808
+ }));
920
809
  return {
921
- uri: `ranking://model/${encodeURIComponent(modelId)}`,
810
+ uri: "docs://list",
922
811
  mimeType: "application/json",
923
- data: JSON.stringify(enriched, null, 2)
812
+ data: JSON.stringify(docs, null, 2)
924
813
  };
925
814
  }
926
815
  }));
927
- resources.register(defineResourceTemplate4({
816
+ resources.register(defineResourceTemplate3({
928
817
  meta: {
929
- uriTemplate: "ranking://results",
930
- title: "Benchmark Results",
931
- description: "List of raw benchmark results from all ingested sources.",
932
- mimeType: "application/json",
933
- tags: RANKING_TAGS
818
+ uriTemplate: "docs://doc/{id}",
819
+ title: "DocBlock markdown",
820
+ description: "Fetch DocBlock body by id as markdown.",
821
+ mimeType: "text/markdown",
822
+ tags: DOC_TAGS
934
823
  },
935
- input: z4.object({}),
936
- resolve: async () => {
937
- const store = getStore();
938
- const result = await store.listBenchmarkResults({ limit: 200 });
824
+ input: z3.object({ id: z3.string() }),
825
+ resolve: async ({ id }) => {
826
+ const found = defaultDocRegistry.get(id);
827
+ if (!found) {
828
+ return {
829
+ uri: `docs://doc/${encodeURIComponent(id)}`,
830
+ mimeType: "text/plain",
831
+ data: `DocBlock not found: ${id}`
832
+ };
833
+ }
939
834
  return {
940
- uri: "ranking://results",
941
- mimeType: "application/json",
942
- data: JSON.stringify(result, null, 2)
835
+ uri: `docs://doc/${encodeURIComponent(id)}`,
836
+ mimeType: "text/markdown",
837
+ data: String(found.block.body ?? "")
943
838
  };
944
839
  }
945
840
  }));
946
841
  return resources;
947
842
  }
948
- function buildRankingPrompts() {
949
- const prompts = new PromptRegistry4;
950
- prompts.register(definePrompt4({
843
+ function buildDocPrompts() {
844
+ const prompts = new PromptRegistry3;
845
+ prompts.register(definePrompt3({
951
846
  meta: {
952
- key: "ranking.advisor",
847
+ key: "docs.navigator",
953
848
  version: "1.0.0",
954
- title: "AI Model Advisor",
955
- description: "Which AI model is best for a given task? Uses the leaderboard to recommend.",
956
- tags: RANKING_TAGS,
849
+ title: "Find relevant ContractSpec docs",
850
+ description: "Guide agents to pick the right DocBlock by topic or tag.",
851
+ tags: DOC_TAGS,
957
852
  stability: "beta",
958
- owners: RANKING_OWNERS
853
+ owners: DOC_OWNERS
959
854
  },
960
855
  args: [
961
856
  {
962
- name: "task",
963
- description: "The task or use case to recommend a model for.",
964
- required: true,
965
- schema: z4.string()
966
- },
967
- {
968
- name: "priority",
969
- description: "Priority dimension (coding, reasoning, cost, latency, etc.).",
970
- required: false,
971
- schema: z4.string().optional()
972
- },
973
- {
974
- name: "transport",
975
- description: "Required transport type (rest, mcp, webhook, sdk).",
857
+ name: "topic",
858
+ description: "Goal or subject to search for.",
976
859
  required: false,
977
- schema: TransportFilterSchema
860
+ schema: z3.string().optional()
978
861
  },
979
862
  {
980
- name: "authMethod",
981
- description: "Required auth method (api-key, oauth2, bearer, etc.).",
863
+ name: "tag",
864
+ description: "Optional tag filter.",
982
865
  required: false,
983
- schema: AuthFilterSchema
866
+ schema: z3.string().optional()
984
867
  }
985
868
  ],
986
- input: z4.object({
987
- task: z4.string(),
988
- priority: z4.string().optional(),
989
- transport: TransportFilterSchema,
990
- authMethod: AuthFilterSchema
869
+ input: z3.object({
870
+ topic: z3.string().optional(),
871
+ tag: z3.string().optional()
991
872
  }),
992
- render: async ({ task, priority, transport, authMethod }) => {
993
- const constraints = [];
994
- if (priority)
995
- constraints.push(`Prioritize: ${priority}.`);
996
- if (transport)
997
- constraints.push(`Required transport: ${transport}.`);
998
- if (authMethod)
999
- constraints.push(`Required auth: ${authMethod}.`);
1000
- return [
873
+ render: async ({ topic, tag }) => {
874
+ const parts = [
1001
875
  {
1002
876
  type: "text",
1003
- text: `Recommend the best AI model for: "${task}".${constraints.length ? ` ${constraints.join(" ")}` : ""} Use the leaderboard data to justify your recommendation.`
877
+ text: `Use the docs index to choose DocBlocks. If a specific topic is provided, prefer docs whose id/title/summary match it.${topic ? ` Topic: ${topic}.` : ""}${tag ? ` Tag: ${tag}.` : ""}`
1004
878
  },
1005
879
  {
1006
880
  type: "resource",
1007
- uri: priority ? `ranking://leaderboard/${priority}` : "ranking://leaderboard",
1008
- title: "Leaderboard"
881
+ uri: "docs://list",
882
+ title: "DocBlocks index"
1009
883
  }
1010
884
  ];
885
+ return parts;
1011
886
  }
1012
887
  }));
1013
888
  return prompts;
1014
889
  }
1015
- function buildRankingOps() {
1016
- const registry = new OperationSpecRegistry4;
1017
- const ingesterRegistry = createDefaultIngesterRegistry();
1018
- installOp4(registry, BenchmarkIngestCommand, async (args) => {
1019
- const store = getStore();
1020
- const source = args.source;
1021
- const ingester = ingesterRegistry.get(source);
1022
- if (!ingester) {
1023
- throw new Error(`No ingester registered for source: ${source}`);
1024
- }
1025
- const rawResults = await ingester.ingest({
1026
- sourceUrl: args.sourceUrl,
1027
- dimensions: args.dimensions
890
+ function buildDocOps(routes) {
891
+ const registry = new OperationSpecRegistry3;
892
+ installOp3(registry, DocsIndexQuery, async (args) => {
893
+ const query = args.query?.toLowerCase().trim();
894
+ const tagsFilter = args.tag?.map((t) => t.toLowerCase().trim()) ?? [];
895
+ const visibility = args.visibility?.toLowerCase().trim();
896
+ const docs = routes.map(({ block, route }) => ({
897
+ id: block.id,
898
+ title: block.title,
899
+ summary: block.summary ?? "",
900
+ tags: block.tags ?? [],
901
+ visibility: (block.visibility ?? "public").toLowerCase(),
902
+ route
903
+ })).filter((doc) => {
904
+ const matchesQuery = query ? doc.id.toLowerCase().includes(query) || doc.title.toLowerCase().includes(query) || doc.summary.toLowerCase().includes(query) : true;
905
+ const matchesTags = tagsFilter.length ? tagsFilter.every((t) => doc.tags.some((tag) => tag.toLowerCase().includes(t))) : true;
906
+ const matchesVisibility = visibility ? doc.visibility === visibility : true;
907
+ return matchesQuery && matchesTags && matchesVisibility;
1028
908
  });
1029
- const normalized = normalizeBenchmarkResults(rawResults);
1030
- for (const result of normalized) {
1031
- await store.upsertBenchmarkResult(result);
1032
- }
1033
- return {
1034
- ingestionId: `ingest-${source}-${Date.now()}`,
1035
- source,
1036
- resultsCount: normalized.length,
1037
- status: "completed",
1038
- ingestedAt: new Date
1039
- };
1040
- });
1041
- installOp4(registry, BenchmarkRunCustomCommand, async (args) => {
1042
909
  return {
1043
- runId: `custom-${Date.now()}`,
1044
- evalSuiteKey: args.evalSuiteKey,
1045
- modelId: args.modelId,
1046
- status: "started",
1047
- startedAt: new Date
1048
- };
1049
- });
1050
- installOp4(registry, RankingRefreshCommand, async (args) => {
1051
- const store = getStore();
1052
- const allResults = [];
1053
- let offset = 0;
1054
- const pageSize = 500;
1055
- while (true) {
1056
- const page = await store.listBenchmarkResults({
1057
- limit: pageSize,
1058
- offset
1059
- });
1060
- allResults.push(...page.results);
1061
- if (allResults.length >= page.total || page.results.length < pageSize)
1062
- break;
1063
- offset += pageSize;
1064
- }
1065
- const existingRankings = new Map((await store.listModelRankings({ limit: 1e4 })).rankings.map((r) => [
1066
- r.modelId,
1067
- r
1068
- ]));
1069
- const weightOverrides = args.weightOverrides ? Array.isArray(args.weightOverrides) ? args.weightOverrides : [args.weightOverrides] : undefined;
1070
- const newRankings = computeModelRankings(allResults, weightOverrides ? {
1071
- weightOverrides
1072
- } : undefined, existingRankings);
1073
- for (const ranking of newRankings) {
1074
- await store.upsertModelRanking(ranking);
1075
- }
1076
- return {
1077
- modelsRanked: newRankings.length,
1078
- updatedAt: new Date,
1079
- status: "completed"
910
+ docs,
911
+ items: docs,
912
+ total: docs.length
1080
913
  };
1081
914
  });
1082
915
  return registry;
1083
916
  }
1084
- function createProviderRankingMcpHandler(path2 = "/api/mcp/ranking") {
917
+ function createDocsMcpHandler(path2 = "/api/mcp/docs") {
918
+ const routes = defaultDocRegistry.list();
1085
919
  return createMcpElysiaHandler({
1086
920
  logger: appLogger,
1087
921
  path: path2,
1088
- serverName: "contractspec-ranking-mcp",
1089
- ops: buildRankingOps(),
1090
- resources: buildRankingResources(),
1091
- prompts: buildRankingPrompts()
922
+ serverName: "contractspec-docs-mcp",
923
+ ops: buildDocOps(routes),
924
+ resources: buildDocResources(routes),
925
+ prompts: buildDocPrompts(),
926
+ presentations: routes.map(({ descriptor }) => descriptor)
1092
927
  });
1093
928
  }
1094
- function setProviderRankingStore(store) {
1095
- sharedStore = store;
1096
- }
1097
929
 
1098
- // src/application/mcp/contractsMcpTools.ts
930
+ // src/application/mcp/internalMcp.ts
1099
931
  import {
1100
932
  defineCommand as defineCommand3,
1101
- installOp as installOp5,
1102
- OperationSpecRegistry as OperationSpecRegistry5
933
+ definePrompt as definePrompt4,
934
+ defineResourceTemplate as defineResourceTemplate4,
935
+ installOp as installOp4,
936
+ OperationSpecRegistry as OperationSpecRegistry4,
937
+ PromptRegistry as PromptRegistry4,
938
+ ResourceRegistry as ResourceRegistry4
1103
939
  } from "@contractspec/lib.contracts-spec";
1104
940
  import { defineSchemaModel as defineSchemaModel3, ScalarTypeEnum as ScalarTypeEnum3 } from "@contractspec/lib.schema";
1105
- var OWNERS = ["@contractspec"];
1106
- var TAGS = ["contracts", "mcp"];
1107
- function buildContractsOps(services) {
1108
- const registry = new OperationSpecRegistry5;
1109
- const ListInput = defineSchemaModel3({
1110
- name: "ContractsListInput",
1111
- fields: {
1112
- pattern: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
1113
- type: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true }
1114
- }
1115
- });
1116
- const ListOutput = defineSchemaModel3({
1117
- name: "ContractsListOutput",
1118
- fields: {
1119
- specs: { type: ScalarTypeEnum3.JSON(), isOptional: false },
1120
- total: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false }
1121
- }
1122
- });
1123
- installOp5(registry, defineCommand3({
1124
- meta: {
1125
- key: "contracts.list",
1126
- version: "1.0.0",
1127
- stability: "beta",
1128
- owners: OWNERS,
1129
- tags: TAGS,
1130
- description: "List contract specs in the workspace.",
1131
- goal: "Discover available contracts by type, pattern, or owner.",
1132
- context: "Contracts MCP server."
1133
- },
1134
- io: { input: ListInput, output: ListOutput },
1135
- policy: { auth: "anonymous" }
1136
- }), async ({ pattern, type }) => {
1137
- const specs = await services.listSpecs({ pattern, type });
1138
- return { specs, total: specs.length };
1139
- });
1140
- const GetInput = defineSchemaModel3({
1141
- name: "ContractsGetInput",
1142
- fields: {
1143
- path: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false }
1144
- }
1145
- });
1146
- const GetOutput = defineSchemaModel3({
1147
- name: "ContractsGetOutput",
1148
- fields: {
1149
- content: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
1150
- info: { type: ScalarTypeEnum3.JSON(), isOptional: false }
1151
- }
1152
- });
1153
- installOp5(registry, defineCommand3({
941
+ import {
942
+ getExample,
943
+ listExamples,
944
+ searchExamples
945
+ } from "@contractspec/module.examples";
946
+ import z4 from "zod";
947
+ var INTERNAL_TAGS = ["internal", "mcp"];
948
+ var INTERNAL_OWNERS = ["@contractspec"];
949
+ var ENDPOINTS = {
950
+ docs: "/api/mcp/docs",
951
+ cli: "/api/mcp/cli",
952
+ internal: "/api/mcp/internal",
953
+ graphql: "/graphql",
954
+ health: "/health"
955
+ };
956
+ function buildInternalResources() {
957
+ const resources = new ResourceRegistry4;
958
+ resources.register(defineResourceTemplate4({
1154
959
  meta: {
1155
- key: "contracts.get",
1156
- version: "1.0.0",
1157
- stability: "beta",
1158
- owners: OWNERS,
1159
- tags: TAGS,
1160
- description: "Read a single contract spec file.",
1161
- goal: "Fetch spec content and parsed metadata.",
1162
- context: "Contracts MCP server."
960
+ uriTemplate: "examples://list{?q}",
961
+ title: "ContractSpec examples registry",
962
+ description: "List available examples (templates, integrations, knowledge, scripts). Optional query `q` filters results.",
963
+ mimeType: "application/json",
964
+ tags: ["examples", ...INTERNAL_TAGS]
1163
965
  },
1164
- io: { input: GetInput, output: GetOutput },
1165
- policy: { auth: "anonymous" }
1166
- }), async ({ path: path2 }) => {
1167
- const result = await services.getSpec(path2);
1168
- if (!result)
1169
- throw new Error(`Spec not found: ${path2}`);
1170
- return result;
1171
- });
1172
- const ValidateInput = defineSchemaModel3({
1173
- name: "ContractsValidateInput",
1174
- fields: {
1175
- path: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false }
1176
- }
1177
- });
1178
- const ValidateOutput = defineSchemaModel3({
1179
- name: "ContractsValidateOutput",
1180
- fields: {
1181
- valid: { type: ScalarTypeEnum3.Boolean(), isOptional: false },
1182
- errors: { type: ScalarTypeEnum3.JSON(), isOptional: false },
1183
- warnings: { type: ScalarTypeEnum3.JSON(), isOptional: false }
966
+ input: z4.object({ q: z4.string().optional() }),
967
+ resolve: async ({ q }) => {
968
+ const items = q ? searchExamples(q) : [...listExamples()];
969
+ return {
970
+ uri: q ? `examples://list?q=${encodeURIComponent(q)}` : "examples://list",
971
+ mimeType: "application/json",
972
+ data: JSON.stringify(items, null, 2)
973
+ };
1184
974
  }
1185
- });
1186
- installOp5(registry, defineCommand3({
975
+ }));
976
+ resources.register(defineResourceTemplate4({
1187
977
  meta: {
1188
- key: "contracts.validate",
1189
- version: "1.0.0",
1190
- stability: "beta",
1191
- owners: OWNERS,
1192
- tags: TAGS,
1193
- description: "Validate a contract spec structure.",
1194
- goal: "Check spec for structural or policy issues.",
1195
- context: "Contracts MCP server."
978
+ uriTemplate: "examples://example/{id}",
979
+ title: "ContractSpec example (by id)",
980
+ description: "Fetch a single example manifest by id.",
981
+ mimeType: "application/json",
982
+ tags: ["examples", ...INTERNAL_TAGS]
1196
983
  },
1197
- io: { input: ValidateInput, output: ValidateOutput },
1198
- policy: { auth: "anonymous" }
1199
- }), async ({ path: path2 }) => services.validateSpec(path2));
1200
- const BuildInput = defineSchemaModel3({
1201
- name: "ContractsBuildInput",
1202
- fields: {
1203
- path: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
1204
- dryRun: { type: ScalarTypeEnum3.Boolean(), isOptional: true }
1205
- }
1206
- });
1207
- const BuildOutput = defineSchemaModel3({
1208
- name: "ContractsBuildOutput",
1209
- fields: {
1210
- results: { type: ScalarTypeEnum3.JSON(), isOptional: false }
984
+ input: z4.object({ id: z4.string().min(1) }),
985
+ resolve: async ({ id }) => {
986
+ const example = getExample(id);
987
+ if (!example) {
988
+ return {
989
+ uri: `examples://example/${encodeURIComponent(id)}`,
990
+ mimeType: "application/json",
991
+ data: JSON.stringify({ error: "not_found", id, message: `Unknown example id: ${id}` }, null, 2)
992
+ };
993
+ }
994
+ return {
995
+ uri: `examples://example/${encodeURIComponent(id)}`,
996
+ mimeType: "application/json",
997
+ data: JSON.stringify(example, null, 2)
998
+ };
1211
999
  }
1212
- });
1213
- installOp5(registry, defineCommand3({
1000
+ }));
1001
+ resources.register(defineResourceTemplate4({
1214
1002
  meta: {
1215
- key: "contracts.build",
1216
- version: "1.0.0",
1217
- stability: "beta",
1218
- owners: OWNERS,
1219
- tags: TAGS,
1220
- description: "Generate implementation code from a contract spec.",
1221
- goal: "Produce handler, component, or test skeletons.",
1222
- context: "Contracts MCP server."
1003
+ uriTemplate: "internal://endpoints",
1004
+ title: "ContractSpec MCP endpoints",
1005
+ description: "Endpoints for docs, CLI, internal MCP servers.",
1006
+ mimeType: "application/json",
1007
+ tags: INTERNAL_TAGS
1223
1008
  },
1224
- io: { input: BuildInput, output: BuildOutput },
1225
- policy: { auth: "user" }
1226
- }), async ({ path: path2, dryRun }) => services.buildSpec(path2, { dryRun }));
1227
- registerMutationTools(registry, services);
1228
- return registry;
1009
+ input: z4.object({}),
1010
+ resolve: async () => ({
1011
+ uri: "internal://endpoints",
1012
+ mimeType: "application/json",
1013
+ data: JSON.stringify(ENDPOINTS, null, 2)
1014
+ })
1015
+ }));
1016
+ resources.register(defineResourceTemplate4({
1017
+ meta: {
1018
+ uriTemplate: "internal://playbook",
1019
+ title: "Internal MCP usage playbook",
1020
+ description: "How internal agents should discover docs, CLI usage, and endpoints.",
1021
+ mimeType: "text/markdown",
1022
+ tags: INTERNAL_TAGS
1023
+ },
1024
+ input: z4.object({}),
1025
+ resolve: async () => ({
1026
+ uri: "internal://playbook",
1027
+ mimeType: "text/markdown",
1028
+ data: [
1029
+ "# Internal MCP playbook",
1030
+ "- Connect to docs MCP first for canonical specs.",
1031
+ "- Use CLI MCP to surface quickstart/reference before running commands.",
1032
+ "- Keep calls read-only unless explicitly approved.",
1033
+ `- Endpoints: ${ENDPOINTS.docs}, ${ENDPOINTS.cli}, ${ENDPOINTS.internal}.`,
1034
+ "- For API work, GraphQL at /graphql; health at /health."
1035
+ ].join(`
1036
+ `)
1037
+ })
1038
+ }));
1039
+ return resources;
1229
1040
  }
1230
- function registerMutationTools(registry, services) {
1231
- const UpdateInput = defineSchemaModel3({
1232
- name: "ContractsUpdateInput",
1233
- fields: {
1234
- path: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
1235
- content: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
1236
- fields: { type: ScalarTypeEnum3.JSON(), isOptional: true }
1237
- }
1238
- });
1239
- const UpdateOutput = defineSchemaModel3({
1240
- name: "ContractsUpdateOutput",
1241
- fields: {
1242
- updated: { type: ScalarTypeEnum3.Boolean(), isOptional: false },
1243
- errors: { type: ScalarTypeEnum3.JSON(), isOptional: false },
1244
- warnings: { type: ScalarTypeEnum3.JSON(), isOptional: false }
1245
- }
1246
- });
1247
- installOp5(registry, defineCommand3({
1041
+ function buildInternalPrompts() {
1042
+ const prompts = new PromptRegistry4;
1043
+ prompts.register(definePrompt4({
1248
1044
  meta: {
1249
- key: "contracts.update",
1045
+ key: "internal_bootstrap",
1250
1046
  version: "1.0.0",
1251
- stability: "beta",
1252
- owners: OWNERS,
1253
- tags: TAGS,
1254
- description: "Update an existing contract spec.",
1255
- goal: "Modify spec content or individual fields with validation.",
1256
- context: "Contracts MCP server."
1047
+ title: "Bootstrap internal ContractSpec agent",
1048
+ description: "Points agents to the correct MCP endpoints and guardrails.",
1049
+ tags: INTERNAL_TAGS,
1050
+ owners: INTERNAL_OWNERS,
1051
+ stability: "beta"
1257
1052
  },
1258
- io: { input: UpdateInput, output: UpdateOutput },
1259
- policy: { auth: "user" }
1260
- }), async ({ path: path2, content, fields }) => services.updateSpec(path2, {
1261
- content,
1262
- fields: Array.isArray(fields) ? fields : undefined
1053
+ args: [],
1054
+ input: z4.object({}),
1055
+ render: async () => [
1056
+ {
1057
+ type: "text",
1058
+ text: "Start with internal://endpoints to pick the right MCP. Use docs MCP for specifications and CLI MCP for commands. Keep actions read-only unless explicitly approved."
1059
+ },
1060
+ {
1061
+ type: "resource",
1062
+ uri: "internal://endpoints",
1063
+ title: "Endpoints"
1064
+ }
1065
+ ]
1263
1066
  }));
1264
- const DeleteInput = defineSchemaModel3({
1265
- name: "ContractsDeleteInput",
1266
- fields: {
1267
- path: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
1268
- clean: { type: ScalarTypeEnum3.Boolean(), isOptional: true }
1269
- }
1270
- });
1271
- const DeleteOutput = defineSchemaModel3({
1272
- name: "ContractsDeleteOutput",
1067
+ return prompts;
1068
+ }
1069
+ function buildInternalOps() {
1070
+ const registry = new OperationSpecRegistry4;
1071
+ const InternalDescribeOutput = defineSchemaModel3({
1072
+ name: "InternalDescribeOutput",
1273
1073
  fields: {
1274
- deleted: { type: ScalarTypeEnum3.Boolean(), isOptional: false },
1275
- cleanedFiles: { type: ScalarTypeEnum3.JSON(), isOptional: false },
1276
- errors: { type: ScalarTypeEnum3.JSON(), isOptional: false }
1074
+ endpoints: {
1075
+ type: ScalarTypeEnum3.JSONObject(),
1076
+ isOptional: false
1077
+ },
1078
+ notes: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false }
1277
1079
  }
1278
1080
  });
1279
- installOp5(registry, defineCommand3({
1081
+ const describeSpec = defineCommand3({
1280
1082
  meta: {
1281
- key: "contracts.delete",
1083
+ key: "internal_describe",
1282
1084
  version: "1.0.0",
1283
- stability: "beta",
1284
- owners: OWNERS,
1285
- tags: TAGS,
1286
- description: "Delete a contract spec and optionally its artifacts.",
1287
- goal: "Remove a spec file and clean generated handlers/tests.",
1288
- context: "Contracts MCP server."
1085
+ stability: "stable",
1086
+ owners: INTERNAL_OWNERS,
1087
+ tags: INTERNAL_TAGS,
1088
+ description: "Return MCP endpoints and guidance for internal ContractSpec agents.",
1089
+ goal: "Speed up internal development with the correct MCP entrypoints.",
1090
+ context: "Used by internal MCP surface; read-only."
1289
1091
  },
1290
- io: { input: DeleteInput, output: DeleteOutput },
1291
- policy: { auth: "user" }
1292
- }), async ({ path: path2, clean }) => services.deleteSpec(path2, { clean }));
1092
+ io: {
1093
+ input: defineSchemaModel3({
1094
+ name: "InternalDescribeInput",
1095
+ fields: {}
1096
+ }),
1097
+ output: InternalDescribeOutput
1098
+ },
1099
+ policy: {
1100
+ auth: "anonymous"
1101
+ }
1102
+ });
1103
+ installOp4(registry, describeSpec, async () => ({
1104
+ endpoints: ENDPOINTS,
1105
+ notes: "Use docs MCP for canonical specs, CLI MCP for contractspec commands, and keep side-effecting actions gated behind human review."
1106
+ }));
1107
+ return registry;
1108
+ }
1109
+ function createInternalMcpHandler(path2 = "/api/mcp/internal") {
1110
+ return createMcpElysiaHandler({
1111
+ logger: appLogger,
1112
+ path: path2,
1113
+ serverName: "contractspec-internal-mcp",
1114
+ ops: buildInternalOps(),
1115
+ resources: buildInternalResources(),
1116
+ prompts: buildInternalPrompts()
1117
+ });
1293
1118
  }
1294
1119
 
1295
- // src/application/mcp/contractsMcpResources.ts
1120
+ // src/application/mcp/providerRankingMcp.ts
1121
+ import { getModelInfo } from "@contractspec/lib.ai-providers/models";
1296
1122
  import {
1297
1123
  definePrompt as definePrompt5,
1298
1124
  defineResourceTemplate as defineResourceTemplate5,
1125
+ installOp as installOp5,
1126
+ OperationSpecRegistry as OperationSpecRegistry5,
1299
1127
  PromptRegistry as PromptRegistry5,
1300
1128
  ResourceRegistry as ResourceRegistry5
1301
1129
  } from "@contractspec/lib.contracts-spec";
1130
+ import {
1131
+ BenchmarkIngestCommand,
1132
+ BenchmarkRunCustomCommand,
1133
+ RankingRefreshCommand
1134
+ } from "@contractspec/lib.contracts-spec/provider-ranking";
1135
+ import { InMemoryProviderRankingStore } from "@contractspec/lib.provider-ranking/in-memory-store";
1136
+ import { createDefaultIngesterRegistry } from "@contractspec/lib.provider-ranking/ingesters";
1137
+ import {
1138
+ computeModelRankings,
1139
+ normalizeBenchmarkResults
1140
+ } from "@contractspec/lib.provider-ranking/scoring";
1302
1141
  import z5 from "zod";
1303
- var OWNERS2 = ["@contractspec"];
1304
- var TAGS2 = ["contracts", "mcp"];
1305
- function buildContractsResources(services) {
1142
+ var TransportFilterSchema = z5.enum(["rest", "mcp", "webhook", "sdk"]).optional();
1143
+ var AuthFilterSchema = z5.enum([
1144
+ "api-key",
1145
+ "oauth2",
1146
+ "bearer",
1147
+ "header",
1148
+ "basic",
1149
+ "webhook-signing",
1150
+ "service-account"
1151
+ ]).optional();
1152
+ var RANKING_TAGS = ["ranking", "mcp", "ai"];
1153
+ var RANKING_OWNERS = ["platform.ai"];
1154
+ var sharedStore = null;
1155
+ function getStore() {
1156
+ if (!sharedStore) {
1157
+ sharedStore = new InMemoryProviderRankingStore;
1158
+ }
1159
+ return sharedStore;
1160
+ }
1161
+ function buildRankingResources() {
1306
1162
  const resources = new ResourceRegistry5;
1307
1163
  resources.register(defineResourceTemplate5({
1308
1164
  meta: {
1309
- uriTemplate: "contracts://list",
1310
- title: "Contract specs list",
1311
- description: "JSON list of all contract specs in the workspace.",
1165
+ uriTemplate: "ranking://leaderboard",
1166
+ title: "AI Model Leaderboard",
1167
+ description: "Current ranked list of AI models by composite score. Supports optional transport and authMethod query filters.",
1168
+ mimeType: "application/json",
1169
+ tags: RANKING_TAGS
1170
+ },
1171
+ input: z5.object({
1172
+ transport: TransportFilterSchema,
1173
+ authMethod: AuthFilterSchema
1174
+ }),
1175
+ resolve: async ({ transport, authMethod }) => {
1176
+ const store = getStore();
1177
+ const result = await store.listModelRankings({
1178
+ limit: 100,
1179
+ requiredTransport: transport,
1180
+ requiredAuthMethod: authMethod
1181
+ });
1182
+ return {
1183
+ uri: "ranking://leaderboard",
1184
+ mimeType: "application/json",
1185
+ data: JSON.stringify(result, null, 2)
1186
+ };
1187
+ }
1188
+ }));
1189
+ resources.register(defineResourceTemplate5({
1190
+ meta: {
1191
+ uriTemplate: "ranking://leaderboard/{dimension}",
1192
+ title: "AI Model Leaderboard by Dimension",
1193
+ description: "Ranked list of AI models filtered by a specific dimension. Supports optional transport and authMethod query filters.",
1312
1194
  mimeType: "application/json",
1313
- tags: TAGS2
1195
+ tags: RANKING_TAGS
1314
1196
  },
1315
- input: z5.object({}),
1316
- resolve: async () => {
1317
- const specs = await services.listSpecs();
1197
+ input: z5.object({
1198
+ dimension: z5.string(),
1199
+ transport: TransportFilterSchema,
1200
+ authMethod: AuthFilterSchema
1201
+ }),
1202
+ resolve: async ({ dimension, transport, authMethod }) => {
1203
+ const store = getStore();
1204
+ const result = await store.listModelRankings({
1205
+ dimension,
1206
+ limit: 100,
1207
+ requiredTransport: transport,
1208
+ requiredAuthMethod: authMethod
1209
+ });
1318
1210
  return {
1319
- uri: "contracts://list",
1211
+ uri: `ranking://leaderboard/${encodeURIComponent(dimension)}`,
1320
1212
  mimeType: "application/json",
1321
- data: JSON.stringify(specs, null, 2)
1213
+ data: JSON.stringify(result, null, 2)
1322
1214
  };
1323
1215
  }
1324
1216
  }));
1325
1217
  resources.register(defineResourceTemplate5({
1326
1218
  meta: {
1327
- uriTemplate: "contracts://spec/{path}",
1328
- title: "Contract spec content",
1329
- description: "Read a single contract spec file by path.",
1330
- mimeType: "text/plain",
1331
- tags: TAGS2
1219
+ uriTemplate: "ranking://model/{modelId}",
1220
+ title: "AI Model Profile",
1221
+ description: "Detailed profile for a specific AI model including scores and benchmarks.",
1222
+ mimeType: "application/json",
1223
+ tags: RANKING_TAGS
1332
1224
  },
1333
- input: z5.object({ path: z5.string() }),
1334
- resolve: async ({ path: path2 }) => {
1335
- const result = await services.getSpec(path2);
1336
- if (!result) {
1225
+ input: z5.object({ modelId: z5.string() }),
1226
+ resolve: async ({ modelId }) => {
1227
+ const store = getStore();
1228
+ const profile = await store.getModelProfile(modelId);
1229
+ if (!profile) {
1337
1230
  return {
1338
- uri: `contracts://spec/${encodeURIComponent(path2)}`,
1339
- mimeType: "text/plain",
1340
- data: `Spec not found: ${path2}`
1231
+ uri: `ranking://model/${encodeURIComponent(modelId)}`,
1232
+ mimeType: "application/json",
1233
+ data: JSON.stringify({ error: "not_found", modelId })
1341
1234
  };
1342
1235
  }
1236
+ const enriched = profile.costPerMillion == null ? (() => {
1237
+ const info = getModelInfo(profile.modelId);
1238
+ return info?.costPerMillion ? {
1239
+ ...profile,
1240
+ costPerMillion: info.costPerMillion,
1241
+ displayName: info.name,
1242
+ contextWindow: info.contextWindow,
1243
+ capabilities: [
1244
+ ...info.capabilities.vision ? ["vision"] : [],
1245
+ ...info.capabilities.tools ? ["tools"] : [],
1246
+ ...info.capabilities.reasoning ? ["reasoning"] : [],
1247
+ ...info.capabilities.streaming ? ["streaming"] : []
1248
+ ]
1249
+ } : profile;
1250
+ })() : profile;
1343
1251
  return {
1344
- uri: `contracts://spec/${encodeURIComponent(path2)}`,
1345
- mimeType: "text/plain",
1346
- data: result.content
1252
+ uri: `ranking://model/${encodeURIComponent(modelId)}`,
1253
+ mimeType: "application/json",
1254
+ data: JSON.stringify(enriched, null, 2)
1347
1255
  };
1348
1256
  }
1349
1257
  }));
1350
1258
  resources.register(defineResourceTemplate5({
1351
1259
  meta: {
1352
- uriTemplate: "contracts://registry/manifest",
1353
- title: "Remote registry manifest",
1354
- description: "Contract registry manifest from the remote server.",
1260
+ uriTemplate: "ranking://results",
1261
+ title: "Benchmark Results",
1262
+ description: "List of raw benchmark results from all ingested sources.",
1355
1263
  mimeType: "application/json",
1356
- tags: TAGS2
1264
+ tags: RANKING_TAGS
1357
1265
  },
1358
1266
  input: z5.object({}),
1359
1267
  resolve: async () => {
1360
- const manifest = await services.fetchRegistryManifest();
1268
+ const store = getStore();
1269
+ const result = await store.listBenchmarkResults({ limit: 200 });
1361
1270
  return {
1362
- uri: "contracts://registry/manifest",
1271
+ uri: "ranking://results",
1363
1272
  mimeType: "application/json",
1364
- data: JSON.stringify(manifest, null, 2)
1273
+ data: JSON.stringify(result, null, 2)
1365
1274
  };
1366
1275
  }
1367
1276
  }));
1368
1277
  return resources;
1369
1278
  }
1370
- function buildContractsPrompts() {
1279
+ function buildRankingPrompts() {
1371
1280
  const prompts = new PromptRegistry5;
1372
1281
  prompts.register(definePrompt5({
1373
1282
  meta: {
1374
- key: "contracts.editor",
1283
+ key: "ranking.advisor",
1375
1284
  version: "1.0.0",
1376
- title: "Contract editing guide",
1377
- description: "Guide AI agents through reading, editing, and validating contracts.",
1378
- tags: TAGS2,
1285
+ title: "AI Model Advisor",
1286
+ description: "Which AI model is best for a given task? Uses the leaderboard to recommend.",
1287
+ tags: RANKING_TAGS,
1379
1288
  stability: "beta",
1380
- owners: OWNERS2
1289
+ owners: RANKING_OWNERS
1381
1290
  },
1382
1291
  args: [
1383
1292
  {
1384
- name: "goal",
1385
- description: "What the agent wants to achieve with the contract.",
1293
+ name: "task",
1294
+ description: "The task or use case to recommend a model for.",
1295
+ required: true,
1296
+ schema: z5.string()
1297
+ },
1298
+ {
1299
+ name: "priority",
1300
+ description: "Priority dimension (coding, reasoning, cost, latency, etc.).",
1386
1301
  required: false,
1387
1302
  schema: z5.string().optional()
1388
- }
1389
- ],
1390
- input: z5.object({ goal: z5.string().optional() }),
1391
- render: async ({ goal }) => [
1303
+ },
1392
1304
  {
1393
- type: "text",
1394
- text: [
1395
- "Contract editing workflow:",
1396
- "1. Use contracts.list to discover specs",
1397
- "2. Use contracts.get to read a spec",
1398
- "3. Edit content and call contracts.update",
1399
- "4. Run contracts.validate to verify changes",
1400
- "5. Run contracts.build to regenerate artifacts",
1401
- goal ? `Agent goal: ${goal}` : ""
1402
- ].filter(Boolean).join(`
1403
- `)
1305
+ name: "transport",
1306
+ description: "Required transport type (rest, mcp, webhook, sdk).",
1307
+ required: false,
1308
+ schema: TransportFilterSchema
1404
1309
  },
1405
1310
  {
1406
- type: "resource",
1407
- uri: "contracts://list",
1408
- title: "Available contracts"
1311
+ name: "authMethod",
1312
+ description: "Required auth method (api-key, oauth2, bearer, etc.).",
1313
+ required: false,
1314
+ schema: AuthFilterSchema
1409
1315
  }
1410
- ]
1316
+ ],
1317
+ input: z5.object({
1318
+ task: z5.string(),
1319
+ priority: z5.string().optional(),
1320
+ transport: TransportFilterSchema,
1321
+ authMethod: AuthFilterSchema
1322
+ }),
1323
+ render: async ({ task, priority, transport, authMethod }) => {
1324
+ const constraints = [];
1325
+ if (priority)
1326
+ constraints.push(`Prioritize: ${priority}.`);
1327
+ if (transport)
1328
+ constraints.push(`Required transport: ${transport}.`);
1329
+ if (authMethod)
1330
+ constraints.push(`Required auth: ${authMethod}.`);
1331
+ return [
1332
+ {
1333
+ type: "text",
1334
+ text: `Recommend the best AI model for: "${task}".${constraints.length ? ` ${constraints.join(" ")}` : ""} Use the leaderboard data to justify your recommendation.`
1335
+ },
1336
+ {
1337
+ type: "resource",
1338
+ uri: priority ? `ranking://leaderboard/${priority}` : "ranking://leaderboard",
1339
+ title: "Leaderboard"
1340
+ }
1341
+ ];
1342
+ }
1411
1343
  }));
1412
1344
  return prompts;
1413
1345
  }
1414
-
1415
- // src/application/mcp/contractsMcp.ts
1416
- function createContractsMcpHandler(path2 = "/api/mcp/contracts", services) {
1346
+ function buildRankingOps() {
1347
+ const registry = new OperationSpecRegistry5;
1348
+ const ingesterRegistry = createDefaultIngesterRegistry();
1349
+ installOp5(registry, BenchmarkIngestCommand, async (args) => {
1350
+ const store = getStore();
1351
+ const source = args.source;
1352
+ const ingester = ingesterRegistry.get(source);
1353
+ if (!ingester) {
1354
+ throw new Error(`No ingester registered for source: ${source}`);
1355
+ }
1356
+ const rawResults = await ingester.ingest({
1357
+ sourceUrl: args.sourceUrl,
1358
+ dimensions: args.dimensions
1359
+ });
1360
+ const normalized = normalizeBenchmarkResults(rawResults);
1361
+ for (const result of normalized) {
1362
+ await store.upsertBenchmarkResult(result);
1363
+ }
1364
+ return {
1365
+ ingestionId: `ingest-${source}-${Date.now()}`,
1366
+ source,
1367
+ resultsCount: normalized.length,
1368
+ status: "completed",
1369
+ ingestedAt: new Date
1370
+ };
1371
+ });
1372
+ installOp5(registry, BenchmarkRunCustomCommand, async (args) => {
1373
+ return {
1374
+ runId: `custom-${Date.now()}`,
1375
+ evalSuiteKey: args.evalSuiteKey,
1376
+ modelId: args.modelId,
1377
+ status: "started",
1378
+ startedAt: new Date
1379
+ };
1380
+ });
1381
+ installOp5(registry, RankingRefreshCommand, async (args) => {
1382
+ const store = getStore();
1383
+ const allResults = [];
1384
+ let offset = 0;
1385
+ const pageSize = 500;
1386
+ while (true) {
1387
+ const page = await store.listBenchmarkResults({
1388
+ limit: pageSize,
1389
+ offset
1390
+ });
1391
+ allResults.push(...page.results);
1392
+ if (allResults.length >= page.total || page.results.length < pageSize)
1393
+ break;
1394
+ offset += pageSize;
1395
+ }
1396
+ const existingRankings = new Map((await store.listModelRankings({ limit: 1e4 })).rankings.map((r) => [
1397
+ r.modelId,
1398
+ r
1399
+ ]));
1400
+ const weightOverrides = args.weightOverrides ? Array.isArray(args.weightOverrides) ? args.weightOverrides : [args.weightOverrides] : undefined;
1401
+ const newRankings = computeModelRankings(allResults, weightOverrides ? {
1402
+ weightOverrides
1403
+ } : undefined, existingRankings);
1404
+ for (const ranking of newRankings) {
1405
+ await store.upsertModelRanking(ranking);
1406
+ }
1407
+ return {
1408
+ modelsRanked: newRankings.length,
1409
+ updatedAt: new Date,
1410
+ status: "completed"
1411
+ };
1412
+ });
1413
+ return registry;
1414
+ }
1415
+ function createProviderRankingMcpHandler(path2 = "/api/mcp/ranking") {
1417
1416
  return createMcpElysiaHandler({
1418
1417
  logger: appLogger,
1419
1418
  path: path2,
1420
- serverName: "contractspec-contracts-mcp",
1421
- ops: buildContractsOps(services),
1422
- resources: buildContractsResources(services),
1423
- prompts: buildContractsPrompts()
1419
+ serverName: "contractspec-ranking-mcp",
1420
+ ops: buildRankingOps(),
1421
+ resources: buildRankingResources(),
1422
+ prompts: buildRankingPrompts()
1424
1423
  });
1425
1424
  }
1425
+ function setProviderRankingStore(store) {
1426
+ sharedStore = store;
1427
+ }
1426
1428
  export {
1427
1429
  setProviderRankingStore,
1428
1430
  createProviderRankingMcpHandler,