@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
@@ -25,13 +25,40 @@ function createContextStorageService(options) {
25
25
  return { store, pipeline };
26
26
  }
27
27
 
28
+ // src/infrastructure/elysia/logger.ts
29
+ import { Logger, LogLevel } from "@contractspec/lib.logger";
30
+ var createAppLogger = () => new Logger({
31
+ level: LogLevel.INFO,
32
+ environment: "production",
33
+ enableTracing: true,
34
+ enableTiming: true,
35
+ enableContext: true,
36
+ enableColors: false
37
+ });
38
+ var appLogger = createAppLogger();
39
+ var dbLogger = new Logger({
40
+ level: LogLevel.WARN,
41
+ environment: "production",
42
+ enableTracing: true,
43
+ enableTiming: true,
44
+ enableContext: true,
45
+ enableColors: false
46
+ });
47
+ var authLogger = new Logger({
48
+ level: LogLevel.INFO,
49
+ environment: "production",
50
+ enableTracing: true,
51
+ enableTiming: true,
52
+ enableContext: true,
53
+ enableColors: false
54
+ });
28
55
  // src/application/mcp/common.ts
29
- import { PresentationRegistry } from "@contractspec/lib.contracts-spec/presentations";
56
+ import { randomUUID } from "crypto";
30
57
  import { createMcpServer } from "@contractspec/lib.contracts-runtime-server-mcp/provider-mcp";
58
+ import { PresentationRegistry } from "@contractspec/lib.contracts-spec/presentations";
31
59
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
32
60
  import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
33
61
  import { Elysia } from "elysia";
34
- import { randomUUID } from "crypto";
35
62
  var baseCtx = {
36
63
  actor: "anonymous",
37
64
  decide: async () => ({ effect: "allow" })
@@ -197,44 +224,10 @@ function createMcpElysiaHandler({
197
224
  });
198
225
  }
199
226
 
200
- // src/infrastructure/elysia/logger.ts
201
- import { Logger, LogLevel } from "@contractspec/lib.logger";
202
- var createAppLogger = () => new Logger({
203
- level: LogLevel.INFO,
204
- environment: "production",
205
- enableTracing: true,
206
- enableTiming: true,
207
- enableContext: true,
208
- enableColors: false
209
- });
210
- var appLogger = createAppLogger();
211
- var dbLogger = new Logger({
212
- level: LogLevel.WARN,
213
- environment: "production",
214
- enableTracing: true,
215
- enableTiming: true,
216
- enableContext: true,
217
- enableColors: false
218
- });
219
- var authLogger = new Logger({
220
- level: LogLevel.INFO,
221
- environment: "production",
222
- enableTracing: true,
223
- enableTiming: true,
224
- enableContext: true,
225
- enableColors: false
226
- });
227
- // src/features/docs/docs.contracts.ts
228
- import {
229
- DocSummaryModel,
230
- DocsIndexInput,
231
- DocsIndexOutput,
232
- DocsIndexQuery,
233
- DocsIndexQuery as DocsIndexQuery2,
234
- ContractReferenceQuery
235
- } from "@contractspec/lib.contracts-spec/docs";
236
- // src/application/mcp/docsMcp.ts
227
+ // src/application/mcp/cliMcp.ts
228
+ import fs from "fs/promises";
237
229
  import {
230
+ defineCommand,
238
231
  definePrompt,
239
232
  defineResourceTemplate,
240
233
  installOp,
@@ -242,165 +235,9 @@ import {
242
235
  PromptRegistry,
243
236
  ResourceRegistry
244
237
  } from "@contractspec/lib.contracts-spec";
245
- import { defaultDocRegistry } from "@contractspec/lib.contracts-spec/docs";
246
- import z from "zod";
247
- var DOC_OWNERS = ["@contractspec"];
248
- var DOC_TAGS = ["docs", "mcp"];
249
- function buildDocResources(routes) {
250
- const resources = new ResourceRegistry;
251
- resources.register(defineResourceTemplate({
252
- meta: {
253
- uriTemplate: "docs://list",
254
- title: "DocBlocks index",
255
- description: "All registered DocBlocks with route, visibility, tags, and summary.",
256
- mimeType: "application/json",
257
- tags: DOC_TAGS
258
- },
259
- input: z.object({}),
260
- resolve: async () => {
261
- const docs = routes.map(({ block, route }) => ({
262
- id: block.id,
263
- title: block.title,
264
- summary: block.summary ?? "",
265
- tags: block.tags ?? [],
266
- visibility: block.visibility ?? "public",
267
- route
268
- }));
269
- return {
270
- uri: "docs://list",
271
- mimeType: "application/json",
272
- data: JSON.stringify(docs, null, 2)
273
- };
274
- }
275
- }));
276
- resources.register(defineResourceTemplate({
277
- meta: {
278
- uriTemplate: "docs://doc/{id}",
279
- title: "DocBlock markdown",
280
- description: "Fetch DocBlock body by id as markdown.",
281
- mimeType: "text/markdown",
282
- tags: DOC_TAGS
283
- },
284
- input: z.object({ id: z.string() }),
285
- resolve: async ({ id }) => {
286
- const found = defaultDocRegistry.get(id);
287
- if (!found) {
288
- return {
289
- uri: `docs://doc/${encodeURIComponent(id)}`,
290
- mimeType: "text/plain",
291
- data: `DocBlock not found: ${id}`
292
- };
293
- }
294
- return {
295
- uri: `docs://doc/${encodeURIComponent(id)}`,
296
- mimeType: "text/markdown",
297
- data: String(found.block.body ?? "")
298
- };
299
- }
300
- }));
301
- return resources;
302
- }
303
- function buildDocPrompts() {
304
- const prompts = new PromptRegistry;
305
- prompts.register(definePrompt({
306
- meta: {
307
- key: "docs.navigator",
308
- version: "1.0.0",
309
- title: "Find relevant ContractSpec docs",
310
- description: "Guide agents to pick the right DocBlock by topic or tag.",
311
- tags: DOC_TAGS,
312
- stability: "beta",
313
- owners: DOC_OWNERS
314
- },
315
- args: [
316
- {
317
- name: "topic",
318
- description: "Goal or subject to search for.",
319
- required: false,
320
- schema: z.string().optional()
321
- },
322
- {
323
- name: "tag",
324
- description: "Optional tag filter.",
325
- required: false,
326
- schema: z.string().optional()
327
- }
328
- ],
329
- input: z.object({
330
- topic: z.string().optional(),
331
- tag: z.string().optional()
332
- }),
333
- render: async ({ topic, tag }) => {
334
- const parts = [
335
- {
336
- type: "text",
337
- 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}.` : ""}`
338
- },
339
- {
340
- type: "resource",
341
- uri: "docs://list",
342
- title: "DocBlocks index"
343
- }
344
- ];
345
- return parts;
346
- }
347
- }));
348
- return prompts;
349
- }
350
- function buildDocOps(routes) {
351
- const registry = new OperationSpecRegistry;
352
- installOp(registry, DocsIndexQuery, async (args) => {
353
- const query = args.query?.toLowerCase().trim();
354
- const tagsFilter = args.tag?.map((t) => t.toLowerCase().trim()) ?? [];
355
- const visibility = args.visibility?.toLowerCase().trim();
356
- const docs = routes.map(({ block, route }) => ({
357
- id: block.id,
358
- title: block.title,
359
- summary: block.summary ?? "",
360
- tags: block.tags ?? [],
361
- visibility: (block.visibility ?? "public").toLowerCase(),
362
- route
363
- })).filter((doc) => {
364
- const matchesQuery = query ? doc.id.toLowerCase().includes(query) || doc.title.toLowerCase().includes(query) || doc.summary.toLowerCase().includes(query) : true;
365
- const matchesTags = tagsFilter.length ? tagsFilter.every((t) => doc.tags.some((tag) => tag.toLowerCase().includes(t))) : true;
366
- const matchesVisibility = visibility ? doc.visibility === visibility : true;
367
- return matchesQuery && matchesTags && matchesVisibility;
368
- });
369
- return {
370
- docs,
371
- items: docs,
372
- total: docs.length
373
- };
374
- });
375
- return registry;
376
- }
377
- function createDocsMcpHandler(path = "/api/mcp/docs") {
378
- const routes = defaultDocRegistry.list();
379
- return createMcpElysiaHandler({
380
- logger: appLogger,
381
- path,
382
- serverName: "contractspec-docs-mcp",
383
- ops: buildDocOps(routes),
384
- resources: buildDocResources(routes),
385
- prompts: buildDocPrompts(),
386
- presentations: routes.map(({ descriptor }) => descriptor)
387
- });
388
- }
389
-
390
- // src/application/mcp/cliMcp.ts
391
- import fs from "fs/promises";
392
- import path from "path";
393
- import {
394
- defineCommand,
395
- definePrompt as definePrompt2,
396
- defineResourceTemplate as defineResourceTemplate2,
397
- installOp as installOp2,
398
- OperationSpecRegistry as OperationSpecRegistry2,
399
- PromptRegistry as PromptRegistry2,
400
- ResourceRegistry as ResourceRegistry2
401
- } from "@contractspec/lib.contracts-spec";
402
238
  import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
403
- import z2 from "zod";
239
+ import path from "path";
240
+ import z from "zod";
404
241
  var __dirname = "/home/runner/work/contractspec/contractspec/packages/bundles/library/src/application/mcp";
405
242
  var CLI_DOC_PATHS = {
406
243
  quickstart: "packages/apps/cli-contractspec/QUICK_START.md",
@@ -453,8 +290,8 @@ async function loadCliDoc(key) {
453
290
  return fallback;
454
291
  }
455
292
  function buildCliResources() {
456
- const resources = new ResourceRegistry2;
457
- resources.register(defineResourceTemplate2({
293
+ const resources = new ResourceRegistry;
294
+ resources.register(defineResourceTemplate({
458
295
  meta: {
459
296
  uriTemplate: "cli://doc/{slug}",
460
297
  title: "CLI documentation",
@@ -462,8 +299,8 @@ function buildCliResources() {
462
299
  mimeType: "text/markdown",
463
300
  tags: CLI_DOC_TAGS
464
301
  },
465
- input: z2.object({
466
- slug: z2.enum(["quickstart", "reference", "readme"])
302
+ input: z.object({
303
+ slug: z.enum(["quickstart", "reference", "readme"])
467
304
  }),
468
305
  resolve: async ({ slug }) => {
469
306
  const data = await loadCliDoc(slug);
@@ -474,7 +311,7 @@ function buildCliResources() {
474
311
  };
475
312
  }
476
313
  }));
477
- resources.register(defineResourceTemplate2({
314
+ resources.register(defineResourceTemplate({
478
315
  meta: {
479
316
  uriTemplate: "cli://commands",
480
317
  title: "CLI commands summary",
@@ -482,7 +319,7 @@ function buildCliResources() {
482
319
  mimeType: "application/json",
483
320
  tags: CLI_DOC_TAGS
484
321
  },
485
- input: z2.object({}),
322
+ input: z.object({}),
486
323
  resolve: async () => {
487
324
  const commands = [
488
325
  {
@@ -511,8 +348,8 @@ function buildCliResources() {
511
348
  return resources;
512
349
  }
513
350
  function buildCliPrompts() {
514
- const prompts = new PromptRegistry2;
515
- prompts.register(definePrompt2({
351
+ const prompts = new PromptRegistry;
352
+ prompts.register(definePrompt({
516
353
  meta: {
517
354
  key: "cli.usage",
518
355
  version: "1.0.0",
@@ -527,10 +364,10 @@ function buildCliPrompts() {
527
364
  name: "goal",
528
365
  description: "Task the user wants to achieve.",
529
366
  required: false,
530
- schema: z2.string().optional()
367
+ schema: z.string().optional()
531
368
  }
532
369
  ],
533
- input: z2.object({ goal: z2.string().optional() }),
370
+ input: z.object({ goal: z.string().optional() }),
534
371
  render: async ({ goal }) => [
535
372
  {
536
373
  type: "text",
@@ -547,7 +384,7 @@ function buildCliPrompts() {
547
384
  return prompts;
548
385
  }
549
386
  function buildCliOps() {
550
- const registry = new OperationSpecRegistry2;
387
+ const registry = new OperationSpecRegistry;
551
388
  const CliSuggestInput = defineSchemaModel({
552
389
  name: "CliSuggestInput",
553
390
  fields: {
@@ -582,7 +419,7 @@ function buildCliOps() {
582
419
  auth: "anonymous"
583
420
  }
584
421
  });
585
- installOp2(registry, suggestSpec, async ({ goal, prefersAi }) => {
422
+ installOp(registry, suggestSpec, async ({ goal, prefersAi }) => {
586
423
  const lower = goal.toLowerCase();
587
424
  if (lower.includes("create") || lower.includes("new")) {
588
425
  return {
@@ -624,831 +461,996 @@ function createCliMcpHandler(path2 = "/api/mcp/cli") {
624
461
  });
625
462
  }
626
463
 
627
- // src/application/mcp/internalMcp.ts
464
+ // src/application/mcp/contractsMcpResources.ts
628
465
  import {
629
- defineCommand as defineCommand2,
630
- definePrompt as definePrompt3,
631
- defineResourceTemplate as defineResourceTemplate3,
632
- installOp as installOp3,
633
- OperationSpecRegistry as OperationSpecRegistry3,
634
- PromptRegistry as PromptRegistry3,
635
- ResourceRegistry as ResourceRegistry3
466
+ definePrompt as definePrompt2,
467
+ defineResourceTemplate as defineResourceTemplate2,
468
+ PromptRegistry as PromptRegistry2,
469
+ ResourceRegistry as ResourceRegistry2
636
470
  } from "@contractspec/lib.contracts-spec";
637
- import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
638
- import z3 from "zod";
639
- import {
640
- getExample,
641
- listExamples,
642
- searchExamples
643
- } from "@contractspec/module.examples";
644
- var INTERNAL_TAGS = ["internal", "mcp"];
645
- var INTERNAL_OWNERS = ["@contractspec"];
646
- var ENDPOINTS = {
647
- docs: "/api/mcp/docs",
648
- cli: "/api/mcp/cli",
649
- internal: "/api/mcp/internal",
650
- graphql: "/graphql",
651
- health: "/health"
652
- };
653
- function buildInternalResources() {
654
- const resources = new ResourceRegistry3;
655
- resources.register(defineResourceTemplate3({
471
+ import z2 from "zod";
472
+ var OWNERS = ["@contractspec"];
473
+ var TAGS = ["contracts", "mcp"];
474
+ function buildContractsResources(services) {
475
+ const resources = new ResourceRegistry2;
476
+ resources.register(defineResourceTemplate2({
656
477
  meta: {
657
- uriTemplate: "examples://list{?q}",
658
- title: "ContractSpec examples registry",
659
- description: "List available examples (templates, integrations, knowledge, scripts). Optional query `q` filters results.",
478
+ uriTemplate: "contracts://list",
479
+ title: "Contract specs list",
480
+ description: "JSON list of all contract specs in the workspace.",
660
481
  mimeType: "application/json",
661
- tags: ["examples", ...INTERNAL_TAGS]
482
+ tags: TAGS
662
483
  },
663
- input: z3.object({ q: z3.string().optional() }),
664
- resolve: async ({ q }) => {
665
- const items = q ? searchExamples(q) : [...listExamples()];
484
+ input: z2.object({}),
485
+ resolve: async () => {
486
+ const specs = await services.listSpecs();
666
487
  return {
667
- uri: q ? `examples://list?q=${encodeURIComponent(q)}` : "examples://list",
488
+ uri: "contracts://list",
668
489
  mimeType: "application/json",
669
- data: JSON.stringify(items, null, 2)
490
+ data: JSON.stringify(specs, null, 2)
670
491
  };
671
492
  }
672
493
  }));
673
- resources.register(defineResourceTemplate3({
494
+ resources.register(defineResourceTemplate2({
674
495
  meta: {
675
- uriTemplate: "examples://example/{id}",
676
- title: "ContractSpec example (by id)",
677
- description: "Fetch a single example manifest by id.",
678
- mimeType: "application/json",
679
- tags: ["examples", ...INTERNAL_TAGS]
496
+ uriTemplate: "contracts://spec/{path}",
497
+ title: "Contract spec content",
498
+ description: "Read a single contract spec file by path.",
499
+ mimeType: "text/plain",
500
+ tags: TAGS
680
501
  },
681
- input: z3.object({ id: z3.string().min(1) }),
682
- resolve: async ({ id }) => {
683
- const example = getExample(id);
684
- if (!example) {
502
+ input: z2.object({ path: z2.string() }),
503
+ resolve: async ({ path: path2 }) => {
504
+ const result = await services.getSpec(path2);
505
+ if (!result) {
685
506
  return {
686
- uri: `examples://example/${encodeURIComponent(id)}`,
687
- mimeType: "application/json",
688
- data: JSON.stringify({ error: "not_found", id, message: `Unknown example id: ${id}` }, null, 2)
507
+ uri: `contracts://spec/${encodeURIComponent(path2)}`,
508
+ mimeType: "text/plain",
509
+ data: `Spec not found: ${path2}`
689
510
  };
690
511
  }
691
512
  return {
692
- uri: `examples://example/${encodeURIComponent(id)}`,
693
- mimeType: "application/json",
694
- data: JSON.stringify(example, null, 2)
513
+ uri: `contracts://spec/${encodeURIComponent(path2)}`,
514
+ mimeType: "text/plain",
515
+ data: result.content
695
516
  };
696
517
  }
697
518
  }));
698
- resources.register(defineResourceTemplate3({
519
+ resources.register(defineResourceTemplate2({
699
520
  meta: {
700
- uriTemplate: "internal://endpoints",
701
- title: "ContractSpec MCP endpoints",
702
- description: "Endpoints for docs, CLI, internal MCP servers.",
703
- mimeType: "application/json",
704
- tags: INTERNAL_TAGS
705
- },
706
- input: z3.object({}),
707
- resolve: async () => ({
708
- uri: "internal://endpoints",
521
+ uriTemplate: "contracts://registry/manifest",
522
+ title: "Remote registry manifest",
523
+ description: "Contract registry manifest from the remote server.",
709
524
  mimeType: "application/json",
710
- data: JSON.stringify(ENDPOINTS, null, 2)
711
- })
712
- }));
713
- resources.register(defineResourceTemplate3({
714
- meta: {
715
- uriTemplate: "internal://playbook",
716
- title: "Internal MCP usage playbook",
717
- description: "How internal agents should discover docs, CLI usage, and endpoints.",
718
- mimeType: "text/markdown",
719
- tags: INTERNAL_TAGS
525
+ tags: TAGS
720
526
  },
721
- input: z3.object({}),
722
- resolve: async () => ({
723
- uri: "internal://playbook",
724
- mimeType: "text/markdown",
725
- data: [
726
- "# Internal MCP playbook",
727
- "- Connect to docs MCP first for canonical specs.",
728
- "- Use CLI MCP to surface quickstart/reference before running commands.",
729
- "- Keep calls read-only unless explicitly approved.",
730
- `- Endpoints: ${ENDPOINTS.docs}, ${ENDPOINTS.cli}, ${ENDPOINTS.internal}.`,
731
- "- For API work, GraphQL at /graphql; health at /health."
732
- ].join(`
733
- `)
734
- })
527
+ input: z2.object({}),
528
+ resolve: async () => {
529
+ const manifest = await services.fetchRegistryManifest();
530
+ return {
531
+ uri: "contracts://registry/manifest",
532
+ mimeType: "application/json",
533
+ data: JSON.stringify(manifest, null, 2)
534
+ };
535
+ }
735
536
  }));
736
537
  return resources;
737
538
  }
738
- function buildInternalPrompts() {
739
- const prompts = new PromptRegistry3;
740
- prompts.register(definePrompt3({
539
+ function buildContractsPrompts() {
540
+ const prompts = new PromptRegistry2;
541
+ prompts.register(definePrompt2({
741
542
  meta: {
742
- key: "internal_bootstrap",
543
+ key: "contracts.editor",
743
544
  version: "1.0.0",
744
- title: "Bootstrap internal ContractSpec agent",
745
- description: "Points agents to the correct MCP endpoints and guardrails.",
746
- tags: INTERNAL_TAGS,
747
- owners: INTERNAL_OWNERS,
748
- stability: "beta"
545
+ title: "Contract editing guide",
546
+ description: "Guide AI agents through reading, editing, and validating contracts.",
547
+ tags: TAGS,
548
+ stability: "beta",
549
+ owners: OWNERS
749
550
  },
750
- args: [],
751
- input: z3.object({}),
752
- render: async () => [
551
+ args: [
552
+ {
553
+ name: "goal",
554
+ description: "What the agent wants to achieve with the contract.",
555
+ required: false,
556
+ schema: z2.string().optional()
557
+ }
558
+ ],
559
+ input: z2.object({ goal: z2.string().optional() }),
560
+ render: async ({ goal }) => [
753
561
  {
754
562
  type: "text",
755
- 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."
563
+ text: [
564
+ "Contract editing workflow:",
565
+ "1. Use contracts.list to discover specs",
566
+ "2. Use contracts.get to read a spec",
567
+ "3. Edit content and call contracts.update",
568
+ "4. Run contracts.validate to verify changes",
569
+ "5. Run contracts.build to regenerate artifacts",
570
+ goal ? `Agent goal: ${goal}` : ""
571
+ ].filter(Boolean).join(`
572
+ `)
756
573
  },
757
574
  {
758
575
  type: "resource",
759
- uri: "internal://endpoints",
760
- title: "Endpoints"
576
+ uri: "contracts://list",
577
+ title: "Available contracts"
761
578
  }
762
579
  ]
763
580
  }));
764
581
  return prompts;
765
582
  }
766
- function buildInternalOps() {
767
- const registry = new OperationSpecRegistry3;
768
- const InternalDescribeOutput = defineSchemaModel2({
769
- name: "InternalDescribeOutput",
583
+
584
+ // src/application/mcp/contractsMcpTools.ts
585
+ import {
586
+ defineCommand as defineCommand2,
587
+ installOp as installOp2,
588
+ OperationSpecRegistry as OperationSpecRegistry2
589
+ } from "@contractspec/lib.contracts-spec";
590
+ import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
591
+ var OWNERS2 = ["@contractspec"];
592
+ var TAGS2 = ["contracts", "mcp"];
593
+ function buildContractsOps(services) {
594
+ const registry = new OperationSpecRegistry2;
595
+ const ListInput = defineSchemaModel2({
596
+ name: "ContractsListInput",
770
597
  fields: {
771
- endpoints: {
772
- type: ScalarTypeEnum2.JSONObject(),
773
- isOptional: false
774
- },
775
- notes: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
598
+ pattern: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
599
+ type: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true }
600
+ }
601
+ });
602
+ const ListOutput = defineSchemaModel2({
603
+ name: "ContractsListOutput",
604
+ fields: {
605
+ specs: { type: ScalarTypeEnum2.JSON(), isOptional: false },
606
+ total: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false }
776
607
  }
777
608
  });
778
- const describeSpec = defineCommand2({
609
+ installOp2(registry, defineCommand2({
779
610
  meta: {
780
- key: "internal_describe",
611
+ key: "contracts.list",
781
612
  version: "1.0.0",
782
- stability: "stable",
783
- owners: INTERNAL_OWNERS,
784
- tags: INTERNAL_TAGS,
785
- description: "Return MCP endpoints and guidance for internal ContractSpec agents.",
786
- goal: "Speed up internal development with the correct MCP entrypoints.",
787
- context: "Used by internal MCP surface; read-only."
613
+ stability: "beta",
614
+ owners: OWNERS2,
615
+ tags: TAGS2,
616
+ description: "List contract specs in the workspace.",
617
+ goal: "Discover available contracts by type, pattern, or owner.",
618
+ context: "Contracts MCP server."
788
619
  },
789
- io: {
790
- input: defineSchemaModel2({
791
- name: "InternalDescribeInput",
792
- fields: {}
793
- }),
794
- output: InternalDescribeOutput
620
+ io: { input: ListInput, output: ListOutput },
621
+ policy: { auth: "anonymous" }
622
+ }), async ({ pattern, type }) => {
623
+ const specs = await services.listSpecs({ pattern, type });
624
+ return { specs, total: specs.length };
625
+ });
626
+ const GetInput = defineSchemaModel2({
627
+ name: "ContractsGetInput",
628
+ fields: {
629
+ path: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
630
+ }
631
+ });
632
+ const GetOutput = defineSchemaModel2({
633
+ name: "ContractsGetOutput",
634
+ fields: {
635
+ content: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
636
+ info: { type: ScalarTypeEnum2.JSON(), isOptional: false }
637
+ }
638
+ });
639
+ installOp2(registry, defineCommand2({
640
+ meta: {
641
+ key: "contracts.get",
642
+ version: "1.0.0",
643
+ stability: "beta",
644
+ owners: OWNERS2,
645
+ tags: TAGS2,
646
+ description: "Read a single contract spec file.",
647
+ goal: "Fetch spec content and parsed metadata.",
648
+ context: "Contracts MCP server."
795
649
  },
796
- policy: {
797
- auth: "anonymous"
650
+ io: { input: GetInput, output: GetOutput },
651
+ policy: { auth: "anonymous" }
652
+ }), async ({ path: path2 }) => {
653
+ const result = await services.getSpec(path2);
654
+ if (!result)
655
+ throw new Error(`Spec not found: ${path2}`);
656
+ return result;
657
+ });
658
+ const ValidateInput = defineSchemaModel2({
659
+ name: "ContractsValidateInput",
660
+ fields: {
661
+ path: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
798
662
  }
799
663
  });
800
- installOp3(registry, describeSpec, async () => ({
801
- endpoints: ENDPOINTS,
802
- notes: "Use docs MCP for canonical specs, CLI MCP for contractspec commands, and keep side-effecting actions gated behind human review."
803
- }));
804
- return registry;
805
- }
806
- function createInternalMcpHandler(path2 = "/api/mcp/internal") {
807
- return createMcpElysiaHandler({
808
- logger: appLogger,
809
- path: path2,
810
- serverName: "contractspec-internal-mcp",
811
- ops: buildInternalOps(),
812
- resources: buildInternalResources(),
813
- prompts: buildInternalPrompts()
664
+ const ValidateOutput = defineSchemaModel2({
665
+ name: "ContractsValidateOutput",
666
+ fields: {
667
+ valid: { type: ScalarTypeEnum2.Boolean(), isOptional: false },
668
+ errors: { type: ScalarTypeEnum2.JSON(), isOptional: false },
669
+ warnings: { type: ScalarTypeEnum2.JSON(), isOptional: false }
670
+ }
814
671
  });
815
- }
816
-
817
- // src/application/mcp/providerRankingMcp.ts
818
- import {
819
- definePrompt as definePrompt4,
820
- defineResourceTemplate as defineResourceTemplate4,
821
- installOp as installOp4,
822
- OperationSpecRegistry as OperationSpecRegistry4,
823
- PromptRegistry as PromptRegistry4,
824
- ResourceRegistry as ResourceRegistry4
825
- } from "@contractspec/lib.contracts-spec";
826
- import {
827
- BenchmarkIngestCommand,
828
- BenchmarkRunCustomCommand,
829
- RankingRefreshCommand
830
- } from "@contractspec/lib.contracts-spec/provider-ranking";
831
- import z4 from "zod";
832
- import { getModelInfo } from "@contractspec/lib.ai-providers/models";
833
- import { InMemoryProviderRankingStore } from "@contractspec/lib.provider-ranking/in-memory-store";
834
- import { createDefaultIngesterRegistry } from "@contractspec/lib.provider-ranking/ingesters";
835
- import { computeModelRankings } from "@contractspec/lib.provider-ranking/scoring";
836
- import { normalizeBenchmarkResults } from "@contractspec/lib.provider-ranking/scoring";
837
- var TransportFilterSchema = z4.enum(["rest", "mcp", "webhook", "sdk"]).optional();
838
- var AuthFilterSchema = z4.enum([
839
- "api-key",
840
- "oauth2",
841
- "bearer",
842
- "header",
843
- "basic",
844
- "webhook-signing",
845
- "service-account"
846
- ]).optional();
847
- var RANKING_TAGS = ["ranking", "mcp", "ai"];
848
- var RANKING_OWNERS = ["platform.ai"];
849
- var sharedStore = null;
850
- function getStore() {
851
- if (!sharedStore) {
852
- sharedStore = new InMemoryProviderRankingStore;
853
- }
854
- return sharedStore;
855
- }
856
- function buildRankingResources() {
857
- const resources = new ResourceRegistry4;
858
- resources.register(defineResourceTemplate4({
672
+ installOp2(registry, defineCommand2({
859
673
  meta: {
860
- uriTemplate: "ranking://leaderboard",
861
- title: "AI Model Leaderboard",
862
- description: "Current ranked list of AI models by composite score. Supports optional transport and authMethod query filters.",
863
- mimeType: "application/json",
864
- tags: RANKING_TAGS
674
+ key: "contracts.validate",
675
+ version: "1.0.0",
676
+ stability: "beta",
677
+ owners: OWNERS2,
678
+ tags: TAGS2,
679
+ description: "Validate a contract spec structure.",
680
+ goal: "Check spec for structural or policy issues.",
681
+ context: "Contracts MCP server."
865
682
  },
866
- input: z4.object({
867
- transport: TransportFilterSchema,
868
- authMethod: AuthFilterSchema
869
- }),
870
- resolve: async ({ transport, authMethod }) => {
871
- const store = getStore();
872
- const result = await store.listModelRankings({
873
- limit: 100,
874
- requiredTransport: transport,
875
- requiredAuthMethod: authMethod
876
- });
877
- return {
878
- uri: "ranking://leaderboard",
879
- mimeType: "application/json",
880
- data: JSON.stringify(result, null, 2)
881
- };
683
+ io: { input: ValidateInput, output: ValidateOutput },
684
+ policy: { auth: "anonymous" }
685
+ }), async ({ path: path2 }) => services.validateSpec(path2));
686
+ const BuildInput = defineSchemaModel2({
687
+ name: "ContractsBuildInput",
688
+ fields: {
689
+ path: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
690
+ dryRun: { type: ScalarTypeEnum2.Boolean(), isOptional: true }
882
691
  }
883
- }));
884
- resources.register(defineResourceTemplate4({
692
+ });
693
+ const BuildOutput = defineSchemaModel2({
694
+ name: "ContractsBuildOutput",
695
+ fields: {
696
+ results: { type: ScalarTypeEnum2.JSON(), isOptional: false }
697
+ }
698
+ });
699
+ installOp2(registry, defineCommand2({
885
700
  meta: {
886
- uriTemplate: "ranking://leaderboard/{dimension}",
887
- title: "AI Model Leaderboard by Dimension",
888
- description: "Ranked list of AI models filtered by a specific dimension. Supports optional transport and authMethod query filters.",
889
- mimeType: "application/json",
890
- tags: RANKING_TAGS
701
+ key: "contracts.build",
702
+ version: "1.0.0",
703
+ stability: "beta",
704
+ owners: OWNERS2,
705
+ tags: TAGS2,
706
+ description: "Generate implementation code from a contract spec.",
707
+ goal: "Produce handler, component, or test skeletons.",
708
+ context: "Contracts MCP server."
891
709
  },
892
- input: z4.object({
893
- dimension: z4.string(),
894
- transport: TransportFilterSchema,
895
- authMethod: AuthFilterSchema
896
- }),
897
- resolve: async ({ dimension, transport, authMethod }) => {
898
- const store = getStore();
899
- const result = await store.listModelRankings({
900
- dimension,
901
- limit: 100,
902
- requiredTransport: transport,
903
- requiredAuthMethod: authMethod
904
- });
905
- return {
906
- uri: `ranking://leaderboard/${encodeURIComponent(dimension)}`,
907
- mimeType: "application/json",
908
- data: JSON.stringify(result, null, 2)
909
- };
710
+ io: { input: BuildInput, output: BuildOutput },
711
+ policy: { auth: "user" }
712
+ }), async ({ path: path2, dryRun }) => services.buildSpec(path2, { dryRun }));
713
+ registerMutationTools(registry, services);
714
+ return registry;
715
+ }
716
+ function registerMutationTools(registry, services) {
717
+ const UpdateInput = defineSchemaModel2({
718
+ name: "ContractsUpdateInput",
719
+ fields: {
720
+ path: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
721
+ content: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
722
+ fields: { type: ScalarTypeEnum2.JSON(), isOptional: true }
723
+ }
724
+ });
725
+ const UpdateOutput = defineSchemaModel2({
726
+ name: "ContractsUpdateOutput",
727
+ fields: {
728
+ updated: { type: ScalarTypeEnum2.Boolean(), isOptional: false },
729
+ errors: { type: ScalarTypeEnum2.JSON(), isOptional: false },
730
+ warnings: { type: ScalarTypeEnum2.JSON(), isOptional: false }
910
731
  }
732
+ });
733
+ installOp2(registry, defineCommand2({
734
+ meta: {
735
+ key: "contracts.update",
736
+ version: "1.0.0",
737
+ stability: "beta",
738
+ owners: OWNERS2,
739
+ tags: TAGS2,
740
+ description: "Update an existing contract spec.",
741
+ goal: "Modify spec content or individual fields with validation.",
742
+ context: "Contracts MCP server."
743
+ },
744
+ io: { input: UpdateInput, output: UpdateOutput },
745
+ policy: { auth: "user" }
746
+ }), async ({ path: path2, content, fields }) => services.updateSpec(path2, {
747
+ content,
748
+ fields: Array.isArray(fields) ? fields : undefined
911
749
  }));
912
- resources.register(defineResourceTemplate4({
750
+ const DeleteInput = defineSchemaModel2({
751
+ name: "ContractsDeleteInput",
752
+ fields: {
753
+ path: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
754
+ clean: { type: ScalarTypeEnum2.Boolean(), isOptional: true }
755
+ }
756
+ });
757
+ const DeleteOutput = defineSchemaModel2({
758
+ name: "ContractsDeleteOutput",
759
+ fields: {
760
+ deleted: { type: ScalarTypeEnum2.Boolean(), isOptional: false },
761
+ cleanedFiles: { type: ScalarTypeEnum2.JSON(), isOptional: false },
762
+ errors: { type: ScalarTypeEnum2.JSON(), isOptional: false }
763
+ }
764
+ });
765
+ installOp2(registry, defineCommand2({
913
766
  meta: {
914
- uriTemplate: "ranking://model/{modelId}",
915
- title: "AI Model Profile",
916
- description: "Detailed profile for a specific AI model including scores and benchmarks.",
767
+ key: "contracts.delete",
768
+ version: "1.0.0",
769
+ stability: "beta",
770
+ owners: OWNERS2,
771
+ tags: TAGS2,
772
+ description: "Delete a contract spec and optionally its artifacts.",
773
+ goal: "Remove a spec file and clean generated handlers/tests.",
774
+ context: "Contracts MCP server."
775
+ },
776
+ io: { input: DeleteInput, output: DeleteOutput },
777
+ policy: { auth: "user" }
778
+ }), async ({ path: path2, clean }) => services.deleteSpec(path2, { clean }));
779
+ }
780
+
781
+ // src/application/mcp/contractsMcp.ts
782
+ function createContractsMcpHandler(path2 = "/api/mcp/contracts", services) {
783
+ return createMcpElysiaHandler({
784
+ logger: appLogger,
785
+ path: path2,
786
+ serverName: "contractspec-contracts-mcp",
787
+ ops: buildContractsOps(services),
788
+ resources: buildContractsResources(services),
789
+ prompts: buildContractsPrompts()
790
+ });
791
+ }
792
+
793
+ // src/features/docs/docs.contracts.ts
794
+ import {
795
+ ContractReferenceQuery,
796
+ DocSummaryModel,
797
+ DocsIndexInput,
798
+ DocsIndexOutput,
799
+ DocsIndexQuery,
800
+ DocsIndexQuery as DocsIndexQuery2
801
+ } from "@contractspec/lib.contracts-spec/docs";
802
+ // src/application/mcp/docsMcp.ts
803
+ import {
804
+ definePrompt as definePrompt3,
805
+ defineResourceTemplate as defineResourceTemplate3,
806
+ installOp as installOp3,
807
+ OperationSpecRegistry as OperationSpecRegistry3,
808
+ PromptRegistry as PromptRegistry3,
809
+ ResourceRegistry as ResourceRegistry3
810
+ } from "@contractspec/lib.contracts-spec";
811
+ import { defaultDocRegistry } from "@contractspec/lib.contracts-spec/docs";
812
+ import z3 from "zod";
813
+ var DOC_OWNERS = ["@contractspec"];
814
+ var DOC_TAGS = ["docs", "mcp"];
815
+ function buildDocResources(routes) {
816
+ const resources = new ResourceRegistry3;
817
+ resources.register(defineResourceTemplate3({
818
+ meta: {
819
+ uriTemplate: "docs://list",
820
+ title: "DocBlocks index",
821
+ description: "All registered DocBlocks with route, visibility, tags, and summary.",
917
822
  mimeType: "application/json",
918
- tags: RANKING_TAGS
823
+ tags: DOC_TAGS
919
824
  },
920
- input: z4.object({ modelId: z4.string() }),
921
- resolve: async ({ modelId }) => {
922
- const store = getStore();
923
- const profile = await store.getModelProfile(modelId);
924
- if (!profile) {
925
- return {
926
- uri: `ranking://model/${encodeURIComponent(modelId)}`,
927
- mimeType: "application/json",
928
- data: JSON.stringify({ error: "not_found", modelId })
929
- };
930
- }
931
- const enriched = profile.costPerMillion == null ? (() => {
932
- const info = getModelInfo(profile.modelId);
933
- return info?.costPerMillion ? {
934
- ...profile,
935
- costPerMillion: info.costPerMillion,
936
- displayName: info.name,
937
- contextWindow: info.contextWindow,
938
- capabilities: [
939
- ...info.capabilities.vision ? ["vision"] : [],
940
- ...info.capabilities.tools ? ["tools"] : [],
941
- ...info.capabilities.reasoning ? ["reasoning"] : [],
942
- ...info.capabilities.streaming ? ["streaming"] : []
943
- ]
944
- } : profile;
945
- })() : profile;
825
+ input: z3.object({}),
826
+ resolve: async () => {
827
+ const docs = routes.map(({ block, route }) => ({
828
+ id: block.id,
829
+ title: block.title,
830
+ summary: block.summary ?? "",
831
+ tags: block.tags ?? [],
832
+ visibility: block.visibility ?? "public",
833
+ route
834
+ }));
946
835
  return {
947
- uri: `ranking://model/${encodeURIComponent(modelId)}`,
836
+ uri: "docs://list",
948
837
  mimeType: "application/json",
949
- data: JSON.stringify(enriched, null, 2)
838
+ data: JSON.stringify(docs, null, 2)
950
839
  };
951
840
  }
952
841
  }));
953
- resources.register(defineResourceTemplate4({
842
+ resources.register(defineResourceTemplate3({
954
843
  meta: {
955
- uriTemplate: "ranking://results",
956
- title: "Benchmark Results",
957
- description: "List of raw benchmark results from all ingested sources.",
958
- mimeType: "application/json",
959
- tags: RANKING_TAGS
844
+ uriTemplate: "docs://doc/{id}",
845
+ title: "DocBlock markdown",
846
+ description: "Fetch DocBlock body by id as markdown.",
847
+ mimeType: "text/markdown",
848
+ tags: DOC_TAGS
960
849
  },
961
- input: z4.object({}),
962
- resolve: async () => {
963
- const store = getStore();
964
- const result = await store.listBenchmarkResults({ limit: 200 });
850
+ input: z3.object({ id: z3.string() }),
851
+ resolve: async ({ id }) => {
852
+ const found = defaultDocRegistry.get(id);
853
+ if (!found) {
854
+ return {
855
+ uri: `docs://doc/${encodeURIComponent(id)}`,
856
+ mimeType: "text/plain",
857
+ data: `DocBlock not found: ${id}`
858
+ };
859
+ }
965
860
  return {
966
- uri: "ranking://results",
967
- mimeType: "application/json",
968
- data: JSON.stringify(result, null, 2)
861
+ uri: `docs://doc/${encodeURIComponent(id)}`,
862
+ mimeType: "text/markdown",
863
+ data: String(found.block.body ?? "")
969
864
  };
970
865
  }
971
866
  }));
972
867
  return resources;
973
868
  }
974
- function buildRankingPrompts() {
975
- const prompts = new PromptRegistry4;
976
- prompts.register(definePrompt4({
869
+ function buildDocPrompts() {
870
+ const prompts = new PromptRegistry3;
871
+ prompts.register(definePrompt3({
977
872
  meta: {
978
- key: "ranking.advisor",
873
+ key: "docs.navigator",
979
874
  version: "1.0.0",
980
- title: "AI Model Advisor",
981
- description: "Which AI model is best for a given task? Uses the leaderboard to recommend.",
982
- tags: RANKING_TAGS,
875
+ title: "Find relevant ContractSpec docs",
876
+ description: "Guide agents to pick the right DocBlock by topic or tag.",
877
+ tags: DOC_TAGS,
983
878
  stability: "beta",
984
- owners: RANKING_OWNERS
879
+ owners: DOC_OWNERS
985
880
  },
986
881
  args: [
987
882
  {
988
- name: "task",
989
- description: "The task or use case to recommend a model for.",
990
- required: true,
991
- schema: z4.string()
992
- },
993
- {
994
- name: "priority",
995
- description: "Priority dimension (coding, reasoning, cost, latency, etc.).",
996
- required: false,
997
- schema: z4.string().optional()
998
- },
999
- {
1000
- name: "transport",
1001
- description: "Required transport type (rest, mcp, webhook, sdk).",
883
+ name: "topic",
884
+ description: "Goal or subject to search for.",
1002
885
  required: false,
1003
- schema: TransportFilterSchema
886
+ schema: z3.string().optional()
1004
887
  },
1005
888
  {
1006
- name: "authMethod",
1007
- description: "Required auth method (api-key, oauth2, bearer, etc.).",
889
+ name: "tag",
890
+ description: "Optional tag filter.",
1008
891
  required: false,
1009
- schema: AuthFilterSchema
892
+ schema: z3.string().optional()
1010
893
  }
1011
894
  ],
1012
- input: z4.object({
1013
- task: z4.string(),
1014
- priority: z4.string().optional(),
1015
- transport: TransportFilterSchema,
1016
- authMethod: AuthFilterSchema
895
+ input: z3.object({
896
+ topic: z3.string().optional(),
897
+ tag: z3.string().optional()
1017
898
  }),
1018
- render: async ({ task, priority, transport, authMethod }) => {
1019
- const constraints = [];
1020
- if (priority)
1021
- constraints.push(`Prioritize: ${priority}.`);
1022
- if (transport)
1023
- constraints.push(`Required transport: ${transport}.`);
1024
- if (authMethod)
1025
- constraints.push(`Required auth: ${authMethod}.`);
1026
- return [
899
+ render: async ({ topic, tag }) => {
900
+ const parts = [
1027
901
  {
1028
902
  type: "text",
1029
- text: `Recommend the best AI model for: "${task}".${constraints.length ? ` ${constraints.join(" ")}` : ""} Use the leaderboard data to justify your recommendation.`
903
+ 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}.` : ""}`
1030
904
  },
1031
905
  {
1032
906
  type: "resource",
1033
- uri: priority ? `ranking://leaderboard/${priority}` : "ranking://leaderboard",
1034
- title: "Leaderboard"
907
+ uri: "docs://list",
908
+ title: "DocBlocks index"
1035
909
  }
1036
910
  ];
911
+ return parts;
1037
912
  }
1038
913
  }));
1039
914
  return prompts;
1040
915
  }
1041
- function buildRankingOps() {
1042
- const registry = new OperationSpecRegistry4;
1043
- const ingesterRegistry = createDefaultIngesterRegistry();
1044
- installOp4(registry, BenchmarkIngestCommand, async (args) => {
1045
- const store = getStore();
1046
- const source = args.source;
1047
- const ingester = ingesterRegistry.get(source);
1048
- if (!ingester) {
1049
- throw new Error(`No ingester registered for source: ${source}`);
1050
- }
1051
- const rawResults = await ingester.ingest({
1052
- sourceUrl: args.sourceUrl,
1053
- dimensions: args.dimensions
916
+ function buildDocOps(routes) {
917
+ const registry = new OperationSpecRegistry3;
918
+ installOp3(registry, DocsIndexQuery, async (args) => {
919
+ const query = args.query?.toLowerCase().trim();
920
+ const tagsFilter = args.tag?.map((t) => t.toLowerCase().trim()) ?? [];
921
+ const visibility = args.visibility?.toLowerCase().trim();
922
+ const docs = routes.map(({ block, route }) => ({
923
+ id: block.id,
924
+ title: block.title,
925
+ summary: block.summary ?? "",
926
+ tags: block.tags ?? [],
927
+ visibility: (block.visibility ?? "public").toLowerCase(),
928
+ route
929
+ })).filter((doc) => {
930
+ const matchesQuery = query ? doc.id.toLowerCase().includes(query) || doc.title.toLowerCase().includes(query) || doc.summary.toLowerCase().includes(query) : true;
931
+ const matchesTags = tagsFilter.length ? tagsFilter.every((t) => doc.tags.some((tag) => tag.toLowerCase().includes(t))) : true;
932
+ const matchesVisibility = visibility ? doc.visibility === visibility : true;
933
+ return matchesQuery && matchesTags && matchesVisibility;
1054
934
  });
1055
- const normalized = normalizeBenchmarkResults(rawResults);
1056
- for (const result of normalized) {
1057
- await store.upsertBenchmarkResult(result);
1058
- }
1059
- return {
1060
- ingestionId: `ingest-${source}-${Date.now()}`,
1061
- source,
1062
- resultsCount: normalized.length,
1063
- status: "completed",
1064
- ingestedAt: new Date
1065
- };
1066
- });
1067
- installOp4(registry, BenchmarkRunCustomCommand, async (args) => {
1068
935
  return {
1069
- runId: `custom-${Date.now()}`,
1070
- evalSuiteKey: args.evalSuiteKey,
1071
- modelId: args.modelId,
1072
- status: "started",
1073
- startedAt: new Date
1074
- };
1075
- });
1076
- installOp4(registry, RankingRefreshCommand, async (args) => {
1077
- const store = getStore();
1078
- const allResults = [];
1079
- let offset = 0;
1080
- const pageSize = 500;
1081
- while (true) {
1082
- const page = await store.listBenchmarkResults({
1083
- limit: pageSize,
1084
- offset
1085
- });
1086
- allResults.push(...page.results);
1087
- if (allResults.length >= page.total || page.results.length < pageSize)
1088
- break;
1089
- offset += pageSize;
1090
- }
1091
- const existingRankings = new Map((await store.listModelRankings({ limit: 1e4 })).rankings.map((r) => [
1092
- r.modelId,
1093
- r
1094
- ]));
1095
- const weightOverrides = args.weightOverrides ? Array.isArray(args.weightOverrides) ? args.weightOverrides : [args.weightOverrides] : undefined;
1096
- const newRankings = computeModelRankings(allResults, weightOverrides ? {
1097
- weightOverrides
1098
- } : undefined, existingRankings);
1099
- for (const ranking of newRankings) {
1100
- await store.upsertModelRanking(ranking);
1101
- }
1102
- return {
1103
- modelsRanked: newRankings.length,
1104
- updatedAt: new Date,
1105
- status: "completed"
936
+ docs,
937
+ items: docs,
938
+ total: docs.length
1106
939
  };
1107
940
  });
1108
941
  return registry;
1109
942
  }
1110
- function createProviderRankingMcpHandler(path2 = "/api/mcp/ranking") {
943
+ function createDocsMcpHandler(path2 = "/api/mcp/docs") {
944
+ const routes = defaultDocRegistry.list();
1111
945
  return createMcpElysiaHandler({
1112
946
  logger: appLogger,
1113
947
  path: path2,
1114
- serverName: "contractspec-ranking-mcp",
1115
- ops: buildRankingOps(),
1116
- resources: buildRankingResources(),
1117
- prompts: buildRankingPrompts()
948
+ serverName: "contractspec-docs-mcp",
949
+ ops: buildDocOps(routes),
950
+ resources: buildDocResources(routes),
951
+ prompts: buildDocPrompts(),
952
+ presentations: routes.map(({ descriptor }) => descriptor)
1118
953
  });
1119
954
  }
1120
- function setProviderRankingStore(store) {
1121
- sharedStore = store;
1122
- }
1123
955
 
1124
- // src/application/mcp/contractsMcpTools.ts
956
+ // src/application/mcp/internalMcp.ts
1125
957
  import {
1126
958
  defineCommand as defineCommand3,
1127
- installOp as installOp5,
1128
- OperationSpecRegistry as OperationSpecRegistry5
959
+ definePrompt as definePrompt4,
960
+ defineResourceTemplate as defineResourceTemplate4,
961
+ installOp as installOp4,
962
+ OperationSpecRegistry as OperationSpecRegistry4,
963
+ PromptRegistry as PromptRegistry4,
964
+ ResourceRegistry as ResourceRegistry4
1129
965
  } from "@contractspec/lib.contracts-spec";
1130
966
  import { defineSchemaModel as defineSchemaModel3, ScalarTypeEnum as ScalarTypeEnum3 } from "@contractspec/lib.schema";
1131
- var OWNERS = ["@contractspec"];
1132
- var TAGS = ["contracts", "mcp"];
1133
- function buildContractsOps(services) {
1134
- const registry = new OperationSpecRegistry5;
1135
- const ListInput = defineSchemaModel3({
1136
- name: "ContractsListInput",
1137
- fields: {
1138
- pattern: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
1139
- type: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true }
1140
- }
1141
- });
1142
- const ListOutput = defineSchemaModel3({
1143
- name: "ContractsListOutput",
1144
- fields: {
1145
- specs: { type: ScalarTypeEnum3.JSON(), isOptional: false },
1146
- total: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false }
1147
- }
1148
- });
1149
- installOp5(registry, defineCommand3({
1150
- meta: {
1151
- key: "contracts.list",
1152
- version: "1.0.0",
1153
- stability: "beta",
1154
- owners: OWNERS,
1155
- tags: TAGS,
1156
- description: "List contract specs in the workspace.",
1157
- goal: "Discover available contracts by type, pattern, or owner.",
1158
- context: "Contracts MCP server."
1159
- },
1160
- io: { input: ListInput, output: ListOutput },
1161
- policy: { auth: "anonymous" }
1162
- }), async ({ pattern, type }) => {
1163
- const specs = await services.listSpecs({ pattern, type });
1164
- return { specs, total: specs.length };
1165
- });
1166
- const GetInput = defineSchemaModel3({
1167
- name: "ContractsGetInput",
1168
- fields: {
1169
- path: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false }
1170
- }
1171
- });
1172
- const GetOutput = defineSchemaModel3({
1173
- name: "ContractsGetOutput",
1174
- fields: {
1175
- content: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
1176
- info: { type: ScalarTypeEnum3.JSON(), isOptional: false }
1177
- }
1178
- });
1179
- installOp5(registry, defineCommand3({
967
+ import {
968
+ getExample,
969
+ listExamples,
970
+ searchExamples
971
+ } from "@contractspec/module.examples";
972
+ import z4 from "zod";
973
+ var INTERNAL_TAGS = ["internal", "mcp"];
974
+ var INTERNAL_OWNERS = ["@contractspec"];
975
+ var ENDPOINTS = {
976
+ docs: "/api/mcp/docs",
977
+ cli: "/api/mcp/cli",
978
+ internal: "/api/mcp/internal",
979
+ graphql: "/graphql",
980
+ health: "/health"
981
+ };
982
+ function buildInternalResources() {
983
+ const resources = new ResourceRegistry4;
984
+ resources.register(defineResourceTemplate4({
1180
985
  meta: {
1181
- key: "contracts.get",
1182
- version: "1.0.0",
1183
- stability: "beta",
1184
- owners: OWNERS,
1185
- tags: TAGS,
1186
- description: "Read a single contract spec file.",
1187
- goal: "Fetch spec content and parsed metadata.",
1188
- context: "Contracts MCP server."
986
+ uriTemplate: "examples://list{?q}",
987
+ title: "ContractSpec examples registry",
988
+ description: "List available examples (templates, integrations, knowledge, scripts). Optional query `q` filters results.",
989
+ mimeType: "application/json",
990
+ tags: ["examples", ...INTERNAL_TAGS]
1189
991
  },
1190
- io: { input: GetInput, output: GetOutput },
1191
- policy: { auth: "anonymous" }
1192
- }), async ({ path: path2 }) => {
1193
- const result = await services.getSpec(path2);
1194
- if (!result)
1195
- throw new Error(`Spec not found: ${path2}`);
1196
- return result;
1197
- });
1198
- const ValidateInput = defineSchemaModel3({
1199
- name: "ContractsValidateInput",
1200
- fields: {
1201
- path: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false }
1202
- }
1203
- });
1204
- const ValidateOutput = defineSchemaModel3({
1205
- name: "ContractsValidateOutput",
1206
- fields: {
1207
- valid: { type: ScalarTypeEnum3.Boolean(), isOptional: false },
1208
- errors: { type: ScalarTypeEnum3.JSON(), isOptional: false },
1209
- warnings: { type: ScalarTypeEnum3.JSON(), isOptional: false }
992
+ input: z4.object({ q: z4.string().optional() }),
993
+ resolve: async ({ q }) => {
994
+ const items = q ? searchExamples(q) : [...listExamples()];
995
+ return {
996
+ uri: q ? `examples://list?q=${encodeURIComponent(q)}` : "examples://list",
997
+ mimeType: "application/json",
998
+ data: JSON.stringify(items, null, 2)
999
+ };
1210
1000
  }
1211
- });
1212
- installOp5(registry, defineCommand3({
1001
+ }));
1002
+ resources.register(defineResourceTemplate4({
1213
1003
  meta: {
1214
- key: "contracts.validate",
1215
- version: "1.0.0",
1216
- stability: "beta",
1217
- owners: OWNERS,
1218
- tags: TAGS,
1219
- description: "Validate a contract spec structure.",
1220
- goal: "Check spec for structural or policy issues.",
1221
- context: "Contracts MCP server."
1004
+ uriTemplate: "examples://example/{id}",
1005
+ title: "ContractSpec example (by id)",
1006
+ description: "Fetch a single example manifest by id.",
1007
+ mimeType: "application/json",
1008
+ tags: ["examples", ...INTERNAL_TAGS]
1222
1009
  },
1223
- io: { input: ValidateInput, output: ValidateOutput },
1224
- policy: { auth: "anonymous" }
1225
- }), async ({ path: path2 }) => services.validateSpec(path2));
1226
- const BuildInput = defineSchemaModel3({
1227
- name: "ContractsBuildInput",
1228
- fields: {
1229
- path: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
1230
- dryRun: { type: ScalarTypeEnum3.Boolean(), isOptional: true }
1231
- }
1232
- });
1233
- const BuildOutput = defineSchemaModel3({
1234
- name: "ContractsBuildOutput",
1235
- fields: {
1236
- results: { type: ScalarTypeEnum3.JSON(), isOptional: false }
1010
+ input: z4.object({ id: z4.string().min(1) }),
1011
+ resolve: async ({ id }) => {
1012
+ const example = getExample(id);
1013
+ if (!example) {
1014
+ return {
1015
+ uri: `examples://example/${encodeURIComponent(id)}`,
1016
+ mimeType: "application/json",
1017
+ data: JSON.stringify({ error: "not_found", id, message: `Unknown example id: ${id}` }, null, 2)
1018
+ };
1019
+ }
1020
+ return {
1021
+ uri: `examples://example/${encodeURIComponent(id)}`,
1022
+ mimeType: "application/json",
1023
+ data: JSON.stringify(example, null, 2)
1024
+ };
1237
1025
  }
1238
- });
1239
- installOp5(registry, defineCommand3({
1026
+ }));
1027
+ resources.register(defineResourceTemplate4({
1240
1028
  meta: {
1241
- key: "contracts.build",
1242
- version: "1.0.0",
1243
- stability: "beta",
1244
- owners: OWNERS,
1245
- tags: TAGS,
1246
- description: "Generate implementation code from a contract spec.",
1247
- goal: "Produce handler, component, or test skeletons.",
1248
- context: "Contracts MCP server."
1029
+ uriTemplate: "internal://endpoints",
1030
+ title: "ContractSpec MCP endpoints",
1031
+ description: "Endpoints for docs, CLI, internal MCP servers.",
1032
+ mimeType: "application/json",
1033
+ tags: INTERNAL_TAGS
1249
1034
  },
1250
- io: { input: BuildInput, output: BuildOutput },
1251
- policy: { auth: "user" }
1252
- }), async ({ path: path2, dryRun }) => services.buildSpec(path2, { dryRun }));
1253
- registerMutationTools(registry, services);
1254
- return registry;
1035
+ input: z4.object({}),
1036
+ resolve: async () => ({
1037
+ uri: "internal://endpoints",
1038
+ mimeType: "application/json",
1039
+ data: JSON.stringify(ENDPOINTS, null, 2)
1040
+ })
1041
+ }));
1042
+ resources.register(defineResourceTemplate4({
1043
+ meta: {
1044
+ uriTemplate: "internal://playbook",
1045
+ title: "Internal MCP usage playbook",
1046
+ description: "How internal agents should discover docs, CLI usage, and endpoints.",
1047
+ mimeType: "text/markdown",
1048
+ tags: INTERNAL_TAGS
1049
+ },
1050
+ input: z4.object({}),
1051
+ resolve: async () => ({
1052
+ uri: "internal://playbook",
1053
+ mimeType: "text/markdown",
1054
+ data: [
1055
+ "# Internal MCP playbook",
1056
+ "- Connect to docs MCP first for canonical specs.",
1057
+ "- Use CLI MCP to surface quickstart/reference before running commands.",
1058
+ "- Keep calls read-only unless explicitly approved.",
1059
+ `- Endpoints: ${ENDPOINTS.docs}, ${ENDPOINTS.cli}, ${ENDPOINTS.internal}.`,
1060
+ "- For API work, GraphQL at /graphql; health at /health."
1061
+ ].join(`
1062
+ `)
1063
+ })
1064
+ }));
1065
+ return resources;
1255
1066
  }
1256
- function registerMutationTools(registry, services) {
1257
- const UpdateInput = defineSchemaModel3({
1258
- name: "ContractsUpdateInput",
1259
- fields: {
1260
- path: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
1261
- content: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
1262
- fields: { type: ScalarTypeEnum3.JSON(), isOptional: true }
1263
- }
1264
- });
1265
- const UpdateOutput = defineSchemaModel3({
1266
- name: "ContractsUpdateOutput",
1267
- fields: {
1268
- updated: { type: ScalarTypeEnum3.Boolean(), isOptional: false },
1269
- errors: { type: ScalarTypeEnum3.JSON(), isOptional: false },
1270
- warnings: { type: ScalarTypeEnum3.JSON(), isOptional: false }
1271
- }
1272
- });
1273
- installOp5(registry, defineCommand3({
1067
+ function buildInternalPrompts() {
1068
+ const prompts = new PromptRegistry4;
1069
+ prompts.register(definePrompt4({
1274
1070
  meta: {
1275
- key: "contracts.update",
1071
+ key: "internal_bootstrap",
1276
1072
  version: "1.0.0",
1277
- stability: "beta",
1278
- owners: OWNERS,
1279
- tags: TAGS,
1280
- description: "Update an existing contract spec.",
1281
- goal: "Modify spec content or individual fields with validation.",
1282
- context: "Contracts MCP server."
1073
+ title: "Bootstrap internal ContractSpec agent",
1074
+ description: "Points agents to the correct MCP endpoints and guardrails.",
1075
+ tags: INTERNAL_TAGS,
1076
+ owners: INTERNAL_OWNERS,
1077
+ stability: "beta"
1283
1078
  },
1284
- io: { input: UpdateInput, output: UpdateOutput },
1285
- policy: { auth: "user" }
1286
- }), async ({ path: path2, content, fields }) => services.updateSpec(path2, {
1287
- content,
1288
- fields: Array.isArray(fields) ? fields : undefined
1079
+ args: [],
1080
+ input: z4.object({}),
1081
+ render: async () => [
1082
+ {
1083
+ type: "text",
1084
+ 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."
1085
+ },
1086
+ {
1087
+ type: "resource",
1088
+ uri: "internal://endpoints",
1089
+ title: "Endpoints"
1090
+ }
1091
+ ]
1289
1092
  }));
1290
- const DeleteInput = defineSchemaModel3({
1291
- name: "ContractsDeleteInput",
1292
- fields: {
1293
- path: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
1294
- clean: { type: ScalarTypeEnum3.Boolean(), isOptional: true }
1295
- }
1296
- });
1297
- const DeleteOutput = defineSchemaModel3({
1298
- name: "ContractsDeleteOutput",
1093
+ return prompts;
1094
+ }
1095
+ function buildInternalOps() {
1096
+ const registry = new OperationSpecRegistry4;
1097
+ const InternalDescribeOutput = defineSchemaModel3({
1098
+ name: "InternalDescribeOutput",
1299
1099
  fields: {
1300
- deleted: { type: ScalarTypeEnum3.Boolean(), isOptional: false },
1301
- cleanedFiles: { type: ScalarTypeEnum3.JSON(), isOptional: false },
1302
- errors: { type: ScalarTypeEnum3.JSON(), isOptional: false }
1100
+ endpoints: {
1101
+ type: ScalarTypeEnum3.JSONObject(),
1102
+ isOptional: false
1103
+ },
1104
+ notes: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false }
1303
1105
  }
1304
1106
  });
1305
- installOp5(registry, defineCommand3({
1107
+ const describeSpec = defineCommand3({
1306
1108
  meta: {
1307
- key: "contracts.delete",
1109
+ key: "internal_describe",
1308
1110
  version: "1.0.0",
1309
- stability: "beta",
1310
- owners: OWNERS,
1311
- tags: TAGS,
1312
- description: "Delete a contract spec and optionally its artifacts.",
1313
- goal: "Remove a spec file and clean generated handlers/tests.",
1314
- context: "Contracts MCP server."
1111
+ stability: "stable",
1112
+ owners: INTERNAL_OWNERS,
1113
+ tags: INTERNAL_TAGS,
1114
+ description: "Return MCP endpoints and guidance for internal ContractSpec agents.",
1115
+ goal: "Speed up internal development with the correct MCP entrypoints.",
1116
+ context: "Used by internal MCP surface; read-only."
1315
1117
  },
1316
- io: { input: DeleteInput, output: DeleteOutput },
1317
- policy: { auth: "user" }
1318
- }), async ({ path: path2, clean }) => services.deleteSpec(path2, { clean }));
1118
+ io: {
1119
+ input: defineSchemaModel3({
1120
+ name: "InternalDescribeInput",
1121
+ fields: {}
1122
+ }),
1123
+ output: InternalDescribeOutput
1124
+ },
1125
+ policy: {
1126
+ auth: "anonymous"
1127
+ }
1128
+ });
1129
+ installOp4(registry, describeSpec, async () => ({
1130
+ endpoints: ENDPOINTS,
1131
+ notes: "Use docs MCP for canonical specs, CLI MCP for contractspec commands, and keep side-effecting actions gated behind human review."
1132
+ }));
1133
+ return registry;
1134
+ }
1135
+ function createInternalMcpHandler(path2 = "/api/mcp/internal") {
1136
+ return createMcpElysiaHandler({
1137
+ logger: appLogger,
1138
+ path: path2,
1139
+ serverName: "contractspec-internal-mcp",
1140
+ ops: buildInternalOps(),
1141
+ resources: buildInternalResources(),
1142
+ prompts: buildInternalPrompts()
1143
+ });
1319
1144
  }
1320
1145
 
1321
- // src/application/mcp/contractsMcpResources.ts
1146
+ // src/application/mcp/providerRankingMcp.ts
1147
+ import { getModelInfo } from "@contractspec/lib.ai-providers/models";
1322
1148
  import {
1323
1149
  definePrompt as definePrompt5,
1324
1150
  defineResourceTemplate as defineResourceTemplate5,
1151
+ installOp as installOp5,
1152
+ OperationSpecRegistry as OperationSpecRegistry5,
1325
1153
  PromptRegistry as PromptRegistry5,
1326
1154
  ResourceRegistry as ResourceRegistry5
1327
1155
  } from "@contractspec/lib.contracts-spec";
1156
+ import {
1157
+ BenchmarkIngestCommand,
1158
+ BenchmarkRunCustomCommand,
1159
+ RankingRefreshCommand
1160
+ } from "@contractspec/lib.contracts-spec/provider-ranking";
1161
+ import { InMemoryProviderRankingStore } from "@contractspec/lib.provider-ranking/in-memory-store";
1162
+ import { createDefaultIngesterRegistry } from "@contractspec/lib.provider-ranking/ingesters";
1163
+ import {
1164
+ computeModelRankings,
1165
+ normalizeBenchmarkResults
1166
+ } from "@contractspec/lib.provider-ranking/scoring";
1328
1167
  import z5 from "zod";
1329
- var OWNERS2 = ["@contractspec"];
1330
- var TAGS2 = ["contracts", "mcp"];
1331
- function buildContractsResources(services) {
1168
+ var TransportFilterSchema = z5.enum(["rest", "mcp", "webhook", "sdk"]).optional();
1169
+ var AuthFilterSchema = z5.enum([
1170
+ "api-key",
1171
+ "oauth2",
1172
+ "bearer",
1173
+ "header",
1174
+ "basic",
1175
+ "webhook-signing",
1176
+ "service-account"
1177
+ ]).optional();
1178
+ var RANKING_TAGS = ["ranking", "mcp", "ai"];
1179
+ var RANKING_OWNERS = ["platform.ai"];
1180
+ var sharedStore = null;
1181
+ function getStore() {
1182
+ if (!sharedStore) {
1183
+ sharedStore = new InMemoryProviderRankingStore;
1184
+ }
1185
+ return sharedStore;
1186
+ }
1187
+ function buildRankingResources() {
1332
1188
  const resources = new ResourceRegistry5;
1333
1189
  resources.register(defineResourceTemplate5({
1334
1190
  meta: {
1335
- uriTemplate: "contracts://list",
1336
- title: "Contract specs list",
1337
- description: "JSON list of all contract specs in the workspace.",
1191
+ uriTemplate: "ranking://leaderboard",
1192
+ title: "AI Model Leaderboard",
1193
+ description: "Current ranked list of AI models by composite score. Supports optional transport and authMethod query filters.",
1194
+ mimeType: "application/json",
1195
+ tags: RANKING_TAGS
1196
+ },
1197
+ input: z5.object({
1198
+ transport: TransportFilterSchema,
1199
+ authMethod: AuthFilterSchema
1200
+ }),
1201
+ resolve: async ({ transport, authMethod }) => {
1202
+ const store = getStore();
1203
+ const result = await store.listModelRankings({
1204
+ limit: 100,
1205
+ requiredTransport: transport,
1206
+ requiredAuthMethod: authMethod
1207
+ });
1208
+ return {
1209
+ uri: "ranking://leaderboard",
1210
+ mimeType: "application/json",
1211
+ data: JSON.stringify(result, null, 2)
1212
+ };
1213
+ }
1214
+ }));
1215
+ resources.register(defineResourceTemplate5({
1216
+ meta: {
1217
+ uriTemplate: "ranking://leaderboard/{dimension}",
1218
+ title: "AI Model Leaderboard by Dimension",
1219
+ description: "Ranked list of AI models filtered by a specific dimension. Supports optional transport and authMethod query filters.",
1338
1220
  mimeType: "application/json",
1339
- tags: TAGS2
1221
+ tags: RANKING_TAGS
1340
1222
  },
1341
- input: z5.object({}),
1342
- resolve: async () => {
1343
- const specs = await services.listSpecs();
1223
+ input: z5.object({
1224
+ dimension: z5.string(),
1225
+ transport: TransportFilterSchema,
1226
+ authMethod: AuthFilterSchema
1227
+ }),
1228
+ resolve: async ({ dimension, transport, authMethod }) => {
1229
+ const store = getStore();
1230
+ const result = await store.listModelRankings({
1231
+ dimension,
1232
+ limit: 100,
1233
+ requiredTransport: transport,
1234
+ requiredAuthMethod: authMethod
1235
+ });
1344
1236
  return {
1345
- uri: "contracts://list",
1237
+ uri: `ranking://leaderboard/${encodeURIComponent(dimension)}`,
1346
1238
  mimeType: "application/json",
1347
- data: JSON.stringify(specs, null, 2)
1239
+ data: JSON.stringify(result, null, 2)
1348
1240
  };
1349
1241
  }
1350
1242
  }));
1351
1243
  resources.register(defineResourceTemplate5({
1352
1244
  meta: {
1353
- uriTemplate: "contracts://spec/{path}",
1354
- title: "Contract spec content",
1355
- description: "Read a single contract spec file by path.",
1356
- mimeType: "text/plain",
1357
- tags: TAGS2
1245
+ uriTemplate: "ranking://model/{modelId}",
1246
+ title: "AI Model Profile",
1247
+ description: "Detailed profile for a specific AI model including scores and benchmarks.",
1248
+ mimeType: "application/json",
1249
+ tags: RANKING_TAGS
1358
1250
  },
1359
- input: z5.object({ path: z5.string() }),
1360
- resolve: async ({ path: path2 }) => {
1361
- const result = await services.getSpec(path2);
1362
- if (!result) {
1251
+ input: z5.object({ modelId: z5.string() }),
1252
+ resolve: async ({ modelId }) => {
1253
+ const store = getStore();
1254
+ const profile = await store.getModelProfile(modelId);
1255
+ if (!profile) {
1363
1256
  return {
1364
- uri: `contracts://spec/${encodeURIComponent(path2)}`,
1365
- mimeType: "text/plain",
1366
- data: `Spec not found: ${path2}`
1257
+ uri: `ranking://model/${encodeURIComponent(modelId)}`,
1258
+ mimeType: "application/json",
1259
+ data: JSON.stringify({ error: "not_found", modelId })
1367
1260
  };
1368
1261
  }
1262
+ const enriched = profile.costPerMillion == null ? (() => {
1263
+ const info = getModelInfo(profile.modelId);
1264
+ return info?.costPerMillion ? {
1265
+ ...profile,
1266
+ costPerMillion: info.costPerMillion,
1267
+ displayName: info.name,
1268
+ contextWindow: info.contextWindow,
1269
+ capabilities: [
1270
+ ...info.capabilities.vision ? ["vision"] : [],
1271
+ ...info.capabilities.tools ? ["tools"] : [],
1272
+ ...info.capabilities.reasoning ? ["reasoning"] : [],
1273
+ ...info.capabilities.streaming ? ["streaming"] : []
1274
+ ]
1275
+ } : profile;
1276
+ })() : profile;
1369
1277
  return {
1370
- uri: `contracts://spec/${encodeURIComponent(path2)}`,
1371
- mimeType: "text/plain",
1372
- data: result.content
1278
+ uri: `ranking://model/${encodeURIComponent(modelId)}`,
1279
+ mimeType: "application/json",
1280
+ data: JSON.stringify(enriched, null, 2)
1373
1281
  };
1374
1282
  }
1375
1283
  }));
1376
1284
  resources.register(defineResourceTemplate5({
1377
1285
  meta: {
1378
- uriTemplate: "contracts://registry/manifest",
1379
- title: "Remote registry manifest",
1380
- description: "Contract registry manifest from the remote server.",
1286
+ uriTemplate: "ranking://results",
1287
+ title: "Benchmark Results",
1288
+ description: "List of raw benchmark results from all ingested sources.",
1381
1289
  mimeType: "application/json",
1382
- tags: TAGS2
1290
+ tags: RANKING_TAGS
1383
1291
  },
1384
1292
  input: z5.object({}),
1385
1293
  resolve: async () => {
1386
- const manifest = await services.fetchRegistryManifest();
1294
+ const store = getStore();
1295
+ const result = await store.listBenchmarkResults({ limit: 200 });
1387
1296
  return {
1388
- uri: "contracts://registry/manifest",
1297
+ uri: "ranking://results",
1389
1298
  mimeType: "application/json",
1390
- data: JSON.stringify(manifest, null, 2)
1299
+ data: JSON.stringify(result, null, 2)
1391
1300
  };
1392
1301
  }
1393
1302
  }));
1394
1303
  return resources;
1395
1304
  }
1396
- function buildContractsPrompts() {
1305
+ function buildRankingPrompts() {
1397
1306
  const prompts = new PromptRegistry5;
1398
1307
  prompts.register(definePrompt5({
1399
1308
  meta: {
1400
- key: "contracts.editor",
1309
+ key: "ranking.advisor",
1401
1310
  version: "1.0.0",
1402
- title: "Contract editing guide",
1403
- description: "Guide AI agents through reading, editing, and validating contracts.",
1404
- tags: TAGS2,
1311
+ title: "AI Model Advisor",
1312
+ description: "Which AI model is best for a given task? Uses the leaderboard to recommend.",
1313
+ tags: RANKING_TAGS,
1405
1314
  stability: "beta",
1406
- owners: OWNERS2
1315
+ owners: RANKING_OWNERS
1407
1316
  },
1408
1317
  args: [
1409
1318
  {
1410
- name: "goal",
1411
- description: "What the agent wants to achieve with the contract.",
1319
+ name: "task",
1320
+ description: "The task or use case to recommend a model for.",
1321
+ required: true,
1322
+ schema: z5.string()
1323
+ },
1324
+ {
1325
+ name: "priority",
1326
+ description: "Priority dimension (coding, reasoning, cost, latency, etc.).",
1412
1327
  required: false,
1413
1328
  schema: z5.string().optional()
1414
- }
1415
- ],
1416
- input: z5.object({ goal: z5.string().optional() }),
1417
- render: async ({ goal }) => [
1329
+ },
1418
1330
  {
1419
- type: "text",
1420
- text: [
1421
- "Contract editing workflow:",
1422
- "1. Use contracts.list to discover specs",
1423
- "2. Use contracts.get to read a spec",
1424
- "3. Edit content and call contracts.update",
1425
- "4. Run contracts.validate to verify changes",
1426
- "5. Run contracts.build to regenerate artifacts",
1427
- goal ? `Agent goal: ${goal}` : ""
1428
- ].filter(Boolean).join(`
1429
- `)
1331
+ name: "transport",
1332
+ description: "Required transport type (rest, mcp, webhook, sdk).",
1333
+ required: false,
1334
+ schema: TransportFilterSchema
1430
1335
  },
1431
1336
  {
1432
- type: "resource",
1433
- uri: "contracts://list",
1434
- title: "Available contracts"
1337
+ name: "authMethod",
1338
+ description: "Required auth method (api-key, oauth2, bearer, etc.).",
1339
+ required: false,
1340
+ schema: AuthFilterSchema
1435
1341
  }
1436
- ]
1342
+ ],
1343
+ input: z5.object({
1344
+ task: z5.string(),
1345
+ priority: z5.string().optional(),
1346
+ transport: TransportFilterSchema,
1347
+ authMethod: AuthFilterSchema
1348
+ }),
1349
+ render: async ({ task, priority, transport, authMethod }) => {
1350
+ const constraints = [];
1351
+ if (priority)
1352
+ constraints.push(`Prioritize: ${priority}.`);
1353
+ if (transport)
1354
+ constraints.push(`Required transport: ${transport}.`);
1355
+ if (authMethod)
1356
+ constraints.push(`Required auth: ${authMethod}.`);
1357
+ return [
1358
+ {
1359
+ type: "text",
1360
+ text: `Recommend the best AI model for: "${task}".${constraints.length ? ` ${constraints.join(" ")}` : ""} Use the leaderboard data to justify your recommendation.`
1361
+ },
1362
+ {
1363
+ type: "resource",
1364
+ uri: priority ? `ranking://leaderboard/${priority}` : "ranking://leaderboard",
1365
+ title: "Leaderboard"
1366
+ }
1367
+ ];
1368
+ }
1437
1369
  }));
1438
1370
  return prompts;
1439
1371
  }
1440
-
1441
- // src/application/mcp/contractsMcp.ts
1442
- function createContractsMcpHandler(path2 = "/api/mcp/contracts", services) {
1372
+ function buildRankingOps() {
1373
+ const registry = new OperationSpecRegistry5;
1374
+ const ingesterRegistry = createDefaultIngesterRegistry();
1375
+ installOp5(registry, BenchmarkIngestCommand, async (args) => {
1376
+ const store = getStore();
1377
+ const source = args.source;
1378
+ const ingester = ingesterRegistry.get(source);
1379
+ if (!ingester) {
1380
+ throw new Error(`No ingester registered for source: ${source}`);
1381
+ }
1382
+ const rawResults = await ingester.ingest({
1383
+ sourceUrl: args.sourceUrl,
1384
+ dimensions: args.dimensions
1385
+ });
1386
+ const normalized = normalizeBenchmarkResults(rawResults);
1387
+ for (const result of normalized) {
1388
+ await store.upsertBenchmarkResult(result);
1389
+ }
1390
+ return {
1391
+ ingestionId: `ingest-${source}-${Date.now()}`,
1392
+ source,
1393
+ resultsCount: normalized.length,
1394
+ status: "completed",
1395
+ ingestedAt: new Date
1396
+ };
1397
+ });
1398
+ installOp5(registry, BenchmarkRunCustomCommand, async (args) => {
1399
+ return {
1400
+ runId: `custom-${Date.now()}`,
1401
+ evalSuiteKey: args.evalSuiteKey,
1402
+ modelId: args.modelId,
1403
+ status: "started",
1404
+ startedAt: new Date
1405
+ };
1406
+ });
1407
+ installOp5(registry, RankingRefreshCommand, async (args) => {
1408
+ const store = getStore();
1409
+ const allResults = [];
1410
+ let offset = 0;
1411
+ const pageSize = 500;
1412
+ while (true) {
1413
+ const page = await store.listBenchmarkResults({
1414
+ limit: pageSize,
1415
+ offset
1416
+ });
1417
+ allResults.push(...page.results);
1418
+ if (allResults.length >= page.total || page.results.length < pageSize)
1419
+ break;
1420
+ offset += pageSize;
1421
+ }
1422
+ const existingRankings = new Map((await store.listModelRankings({ limit: 1e4 })).rankings.map((r) => [
1423
+ r.modelId,
1424
+ r
1425
+ ]));
1426
+ const weightOverrides = args.weightOverrides ? Array.isArray(args.weightOverrides) ? args.weightOverrides : [args.weightOverrides] : undefined;
1427
+ const newRankings = computeModelRankings(allResults, weightOverrides ? {
1428
+ weightOverrides
1429
+ } : undefined, existingRankings);
1430
+ for (const ranking of newRankings) {
1431
+ await store.upsertModelRanking(ranking);
1432
+ }
1433
+ return {
1434
+ modelsRanked: newRankings.length,
1435
+ updatedAt: new Date,
1436
+ status: "completed"
1437
+ };
1438
+ });
1439
+ return registry;
1440
+ }
1441
+ function createProviderRankingMcpHandler(path2 = "/api/mcp/ranking") {
1443
1442
  return createMcpElysiaHandler({
1444
1443
  logger: appLogger,
1445
1444
  path: path2,
1446
- serverName: "contractspec-contracts-mcp",
1447
- ops: buildContractsOps(services),
1448
- resources: buildContractsResources(services),
1449
- prompts: buildContractsPrompts()
1445
+ serverName: "contractspec-ranking-mcp",
1446
+ ops: buildRankingOps(),
1447
+ resources: buildRankingResources(),
1448
+ prompts: buildRankingPrompts()
1450
1449
  });
1451
1450
  }
1451
+ function setProviderRankingStore(store) {
1452
+ sharedStore = store;
1453
+ }
1452
1454
  export {
1453
1455
  setProviderRankingStore,
1454
1456
  createProviderRankingMcpHandler,