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