@contractspec/bundle.library 3.8.12 → 3.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +614 -602
- package/CHANGELOG.md +97 -0
- package/dist/application/context-storage/index.js +1 -1
- package/dist/application/index.js +11 -11
- package/dist/application/mcp/cliMcp.js +6 -6
- package/dist/application/mcp/cliMcp.onboarding.d.ts +4 -0
- package/dist/application/mcp/cliMcp.onboarding.js +2 -0
- package/dist/application/mcp/cliMcp.test.d.ts +1 -0
- package/dist/application/mcp/common.js +1 -1
- package/dist/application/mcp/contractsMcp.js +2 -2
- package/dist/application/mcp/contractsMcp.test.d.ts +1 -0
- package/dist/application/mcp/contractsMcpAdoptionTools.d.ts +3 -0
- package/dist/application/mcp/contractsMcpAdoptionTools.js +2 -0
- package/dist/application/mcp/contractsMcpResources.js +2 -2
- package/dist/application/mcp/contractsMcpTools.js +1 -1
- package/dist/application/mcp/contractsMcpTypes.d.ts +16 -0
- package/dist/application/mcp/docsMcp.catalog.js +2 -2
- package/dist/application/mcp/docsMcp.data.js +1 -1
- package/dist/application/mcp/docsMcp.js +3 -3
- package/dist/application/mcp/docsMcp.prompts.js +3 -3
- package/dist/application/mcp/docsMcp.reference.js +2 -2
- package/dist/application/mcp/docsMcp.resources.js +2 -2
- package/dist/application/mcp/docsMcp.tools.js +2 -2
- package/dist/application/mcp/index.js +11 -11
- package/dist/application/mcp/internalMcp.js +2 -2
- package/dist/application/mcp/normalizeMcpRequest.js +1 -1
- package/dist/application/mcp/providerRankingMcp.js +1 -1
- package/dist/bundles/LibraryBundle.d.ts +19 -111
- package/dist/bundles/LibraryBundle.js +1 -1
- package/dist/bundles/index.js +1 -1
- package/dist/components/docs/DocsIndexPage.js +2 -2
- package/dist/components/docs/advanced/AdvancedMCPPage.js +3 -3
- package/dist/components/docs/advanced/AdvancedOverlayEditorPage.js +1 -1
- package/dist/components/docs/advanced/AdvancedRenderersPage.js +2 -2
- package/dist/components/docs/advanced/AdvancedSpecExperimentsPage.js +4 -4
- package/dist/components/docs/advanced/AdvancedTelemetryPage.js +2 -2
- package/dist/components/docs/advanced/AdvancedWorkflowMonitoringPage.js +2 -2
- package/dist/components/docs/advanced/index.js +9 -9
- package/dist/components/docs/architecture/ArchitectureAppConfigPage.js +6 -6
- package/dist/components/docs/architecture/ArchitectureControlPlanePage.js +3 -3
- package/dist/components/docs/architecture/ArchitectureIntegrationBindingPage.js +7 -7
- package/dist/components/docs/architecture/ArchitectureKnowledgeBindingPage.js +6 -6
- package/dist/components/docs/architecture/ArchitectureMultiTenancyPage.js +2 -2
- package/dist/components/docs/architecture/ArchitectureOverviewPage.js +1 -1
- package/dist/components/docs/architecture/index.js +20 -20
- package/dist/components/docs/comparison/ComparisonAutomationPlatformsPage.js +1 -1
- package/dist/components/docs/comparison/ComparisonEnterprisePlatformsPage.js +1 -1
- package/dist/components/docs/comparison/ComparisonInternalToolBuildersPage.js +1 -1
- package/dist/components/docs/comparison/ComparisonOverviewPage.js +1 -1
- package/dist/components/docs/comparison/ComparisonWindmillPage.js +1 -1
- package/dist/components/docs/comparison/ComparisonWorkflowEnginesPage.js +1 -1
- package/dist/components/docs/comparison/index.js +1 -1
- package/dist/components/docs/docsManifest.js +1 -1
- package/dist/components/docs/ecosystem/IntegrationsPage.js +2 -2
- package/dist/components/docs/ecosystem/PluginsPage.js +4 -4
- package/dist/components/docs/ecosystem/RegistryPage.js +4 -4
- package/dist/components/docs/ecosystem/TemplatesPage.js +3 -3
- package/dist/components/docs/ecosystem/index.js +11 -11
- package/dist/components/docs/examples/DocsExamplesPage.js +1 -17
- package/dist/components/docs/examples/ExampleShowcasePage.d.ts +1 -1
- package/dist/components/docs/examples/ExampleShowcasePage.js +2 -17
- package/dist/components/docs/examples/exampleShowcaseData.d.ts +2 -2
- package/dist/components/docs/examples/exampleShowcaseData.js +2 -17
- package/dist/components/docs/examples/exampleShowcaseData.test.d.ts +1 -0
- package/dist/components/docs/examples/index.js +2 -17
- package/dist/components/docs/generated/docs-index.generated.js +1 -1
- package/dist/components/docs/generated/index.d.ts +7 -1
- package/dist/components/docs/generated/index.js +1 -1
- package/dist/components/docs/generated/loader.js +1 -1
- package/dist/components/docs/getting-started/CLIPage.js +6 -5
- package/dist/components/docs/getting-started/CompatibilityPage.js +1 -1
- package/dist/components/docs/getting-started/DataViewTutorialPage.js +44 -67
- package/dist/components/docs/getting-started/DeveloperToolsPage.js +1 -1
- package/dist/components/docs/getting-started/HelloWorldPage.js +5 -5
- package/dist/components/docs/getting-started/InstallationPage.js +3 -3
- package/dist/components/docs/getting-started/StartHerePage.js +4 -2
- package/dist/components/docs/getting-started/TroubleshootingPage.js +2 -2
- package/dist/components/docs/getting-started/VSCodeExtensionPage.js +1 -1
- package/dist/components/docs/getting-started/getting-started.docblocks.js +2 -2
- package/dist/components/docs/getting-started/index.js +60 -80
- package/dist/components/docs/guides/GuideCIDiffGatingPage.js +2 -2
- package/dist/components/docs/guides/GuideConnectInRepoPage.js +30 -5
- package/dist/components/docs/guides/GuideContractTypesPage.js +6 -6
- package/dist/components/docs/guides/GuideDocsPipelinePage.js +3 -3
- package/dist/components/docs/guides/GuideFirstModuleBundlePage.js +4 -4
- package/dist/components/docs/guides/GuideGenerateDocsClientsSchemasPage.js +2 -2
- package/dist/components/docs/guides/GuideHostBuilderWorkbenchPage.js +21 -6
- package/dist/components/docs/guides/GuideImportExistingCodebasesPage.js +8 -8
- package/dist/components/docs/guides/GuideNextjsOneEndpointPage.js +6 -6
- package/dist/components/docs/guides/GuideReleaseCapsulesPage.d.ts +1 -0
- package/dist/components/docs/guides/GuideReleaseCapsulesPage.js +16 -0
- package/dist/components/docs/guides/GuideSpecValidationTypingPage.js +4 -4
- package/dist/components/docs/guides/GuidesIndexPage.js +2 -2
- package/dist/components/docs/guides/index.d.ts +1 -0
- package/dist/components/docs/guides/index.js +93 -39
- package/dist/components/docs/index.js +690 -419
- package/dist/components/docs/integrations/IntegrationsCircuitBreakersPage.js +2 -2
- package/dist/components/docs/integrations/IntegrationsElevenLabsPage.js +3 -3
- package/dist/components/docs/integrations/IntegrationsGithubPage.js +2 -2
- package/dist/components/docs/integrations/IntegrationsGmailPage.js +3 -3
- package/dist/components/docs/integrations/IntegrationsGoogleCalendarPage.js +3 -3
- package/dist/components/docs/integrations/IntegrationsHealthRoutingPage.js +2 -2
- package/dist/components/docs/integrations/IntegrationsMistralPage.js +2 -2
- package/dist/components/docs/integrations/IntegrationsOpenAIPage.js +2 -2
- package/dist/components/docs/integrations/IntegrationsOverviewPage.js +1 -1
- package/dist/components/docs/integrations/IntegrationsPostmarkPage.js +2 -2
- package/dist/components/docs/integrations/IntegrationsPowensPage.js +2 -2
- package/dist/components/docs/integrations/IntegrationsQdrantPage.js +5 -5
- package/dist/components/docs/integrations/IntegrationsResendPage.js +3 -3
- package/dist/components/docs/integrations/IntegrationsS3Page.js +4 -4
- package/dist/components/docs/integrations/IntegrationsSlackPage.js +2 -2
- package/dist/components/docs/integrations/IntegrationsSpecModelPage.js +2 -2
- package/dist/components/docs/integrations/IntegrationsStripePage.js +2 -2
- package/dist/components/docs/integrations/IntegrationsTwilioPage.js +3 -3
- package/dist/components/docs/integrations/IntegrationsWhatsappMetaPage.js +2 -2
- package/dist/components/docs/integrations/IntegrationsWhatsappTwilioPage.js +2 -2
- package/dist/components/docs/integrations/index.js +39 -39
- package/dist/components/docs/intent/ContractFirstApiPage.js +2 -2
- package/dist/components/docs/intent/DeterministicCodegenPage.js +2 -2
- package/dist/components/docs/intent/GenerateClientFromSchemaPage.js +7 -7
- package/dist/components/docs/intent/OpenapiAlternativePage.js +3 -3
- package/dist/components/docs/intent/SchemaValidationTypescriptPage.js +4 -4
- package/dist/components/docs/intent/SpecDrivenDevelopmentPage.js +2 -2
- package/dist/components/docs/intent/index.js +15 -15
- package/dist/components/docs/intent/intent-pages.docblocks.js +1 -1
- package/dist/components/docs/knowledge/KnowledgeCategoriesPage.js +2 -2
- package/dist/components/docs/knowledge/KnowledgeExamplesPage.js +2 -2
- package/dist/components/docs/knowledge/KnowledgeOverviewPage.js +1 -1
- package/dist/components/docs/knowledge/KnowledgeSourcesPage.js +2 -2
- package/dist/components/docs/knowledge/KnowledgeSpacesPage.js +2 -2
- package/dist/components/docs/knowledge/index.js +5 -5
- package/dist/components/docs/libraries/LibrariesAccessibilityPage.js +3 -3
- package/dist/components/docs/libraries/LibrariesAiAgentPage.js +3 -3
- package/dist/components/docs/libraries/LibrariesAnalyticsPage.js +4 -4
- package/dist/components/docs/libraries/LibrariesContentGenPage.js +2 -2
- package/dist/components/docs/libraries/LibrariesContractsPage.js +43 -18
- package/dist/components/docs/libraries/LibrariesCostTrackingPage.js +3 -3
- package/dist/components/docs/libraries/LibrariesCrossPlatformUIPage.content.d.ts +67 -0
- package/dist/components/docs/libraries/LibrariesCrossPlatformUIPage.content.js +86 -0
- package/dist/components/docs/libraries/LibrariesCrossPlatformUIPage.d.ts +1 -0
- package/dist/components/docs/libraries/LibrariesCrossPlatformUIPage.js +86 -0
- package/dist/components/docs/libraries/LibrariesDataBackendPage.js +2 -2
- package/dist/components/docs/libraries/LibrariesDataViewsPage.js +3 -3
- package/dist/components/docs/libraries/LibrariesDesignSystemPage.js +77 -29
- package/dist/components/docs/libraries/LibrariesEvolutionPage.js +4 -4
- package/dist/components/docs/libraries/LibrariesGraphQLPage.js +2 -2
- package/dist/components/docs/libraries/LibrariesGrowthPage.js +3 -3
- package/dist/components/docs/libraries/LibrariesMultiTenancyPage.js +3 -3
- package/dist/components/docs/libraries/LibrariesObservabilityPage.js +5 -5
- package/dist/components/docs/libraries/LibrariesOverlayEnginePage.js +4 -4
- package/dist/components/docs/libraries/LibrariesOverviewPage.js +1 -1
- package/dist/components/docs/libraries/LibrariesPersonalizationPage.js +4 -4
- package/dist/components/docs/libraries/LibrariesProgressiveDeliveryPage.js +3 -3
- package/dist/components/docs/libraries/LibrariesResiliencePage.js +4 -4
- package/dist/components/docs/libraries/LibrariesRuntimePage.js +2 -2
- package/dist/components/docs/libraries/LibrariesSLOPage.js +3 -3
- package/dist/components/docs/libraries/LibrariesSchemaPage.js +3 -3
- package/dist/components/docs/libraries/LibrariesSupportBotPage.js +3 -3
- package/dist/components/docs/libraries/LibrariesTestingPage.js +3 -3
- package/dist/components/docs/libraries/LibrariesUIKitPage.js +42 -16
- package/dist/components/docs/libraries/LibrariesUIKitWebPage.d.ts +1 -0
- package/dist/components/docs/libraries/LibrariesUIKitWebPage.js +47 -0
- package/dist/components/docs/libraries/LibrariesWorkflowComposerPage.js +3 -3
- package/dist/components/docs/libraries/LibrariesWorkflowsPage.js +2 -2
- package/dist/components/docs/libraries/index.d.ts +2 -0
- package/dist/components/docs/libraries/index.js +338 -110
- package/dist/components/docs/manifesto/ManifestoPage.js +1 -1
- package/dist/components/docs/ops/AutoEvolutionOpsPage.js +2 -2
- package/dist/components/docs/ops/DistributedTracingOpsPage.js +2 -2
- package/dist/components/docs/ops/index.js +3 -3
- package/dist/components/docs/ops/ops-lifecycle.docblocks.js +2 -2
- package/dist/components/docs/ops/ops-runbooks-a.docblocks.js +2 -2
- package/dist/components/docs/ops/ops-runbooks-b.docblocks.js +2 -2
- package/dist/components/docs/ops/ops-slo-tenant.docblocks.js +2 -2
- package/dist/components/docs/ops/ops-top.docs.js +2 -2
- package/dist/components/docs/ops/ops.docs.js +6 -6
- package/dist/components/docs/product/product.docblocks.js +2 -2
- package/dist/components/docs/reference/DocsMarkdownContent.js +2 -2
- package/dist/components/docs/reference/DocsReferenceContent.js +3 -3
- package/dist/components/docs/reference/DocsReferenceIndexClient.js +2 -2
- package/dist/components/docs/reference/DocsReferenceIndexPage.js +2 -2
- package/dist/components/docs/reference/DocsReferencePage.js +3 -3
- package/dist/components/docs/reference/docsMarkdownParser.js +2 -2
- package/dist/components/docs/reference/index.js +4 -4
- package/dist/components/docs/safety/SafetyAuditingPage.js +2 -2
- package/dist/components/docs/safety/SafetyMigrationsPage.js +2 -2
- package/dist/components/docs/safety/SafetyOverviewPage.js +1 -1
- package/dist/components/docs/safety/SafetyPDPPage.js +2 -2
- package/dist/components/docs/safety/SafetySecurityTrustPage.js +1 -1
- package/dist/components/docs/safety/SafetySigningPage.js +3 -3
- package/dist/components/docs/safety/SafetyTenantIsolationPage.js +2 -2
- package/dist/components/docs/safety/index.js +7 -7
- package/dist/components/docs/shared/StudioPrompt.js +1 -1
- package/dist/components/docs/specs/SpecsBuilderControlPlanePage.js +18 -3
- package/dist/components/docs/specs/SpecsCapabilitiesPage.js +2 -2
- package/dist/components/docs/specs/SpecsConnectPage.js +4 -2
- package/dist/components/docs/specs/SpecsDataViewsPage.js +39 -32
- package/dist/components/docs/specs/SpecsModuleBundlesPage.js +3 -3
- package/dist/components/docs/specs/SpecsOverlaysPage.js +2 -2
- package/dist/components/docs/specs/SpecsOverviewPage.js +1 -1
- package/dist/components/docs/specs/SpecsPolicyPage.js +3 -3
- package/dist/components/docs/specs/SpecsWorkflowsPage.js +2 -2
- package/dist/components/docs/specs/index.js +66 -42
- package/dist/components/docs/studio/StudioBYOKPage.js +1 -1
- package/dist/components/docs/studio/StudioDeploymentsPage.js +1 -1
- package/dist/components/docs/studio/StudioGettingStartedPage.js +1 -1
- package/dist/components/docs/studio/StudioIntegrationsPage.js +1 -1
- package/dist/components/docs/studio/StudioOverviewPage.js +1 -1
- package/dist/components/docs/studio/StudioVisualBuilderPage.js +1 -1
- package/dist/components/docs/studio/index.js +1 -1
- package/dist/components/docs/tech/contracts/tech-docs.docblocks.js +2 -2
- package/dist/components/integrations/index.js +2 -2
- package/dist/components/integrations/molecules/IntegrationCard.js +1 -1
- package/dist/components/integrations/organisms/IntegrationMarketplace.js +1 -1
- package/dist/components/integrations/organisms/IntegrationSettings.js +2 -2
- package/dist/components/integrations/organisms/KnowledgeSourceList.js +1 -1
- package/dist/components/legal/PrivacyTemplate.js +1 -1
- package/dist/components/legal/TermsTemplate.js +1 -1
- package/dist/components/legal/index.js +1 -1
- package/dist/components/shared/FeatureGateNotice.js +1 -1
- package/dist/components/shared/index.js +1 -1
- package/dist/components/shell/WorkspaceHeader.js +1 -1
- package/dist/components/shell/WorkspaceProjectShellLayout.js +1 -1
- package/dist/components/shell/WorkspaceShellRenderer.js +1 -1
- package/dist/components/shell/WorkspaceSidebar.js +1 -1
- package/dist/components/shell/index.js +1 -1
- package/dist/components/templates/engine/index.js +1 -1
- package/dist/components/templates/index.js +11 -11
- package/dist/components/templates/messaging/ConversationList.js +2 -2
- package/dist/components/templates/messaging/MessageComposer.js +4 -4
- package/dist/components/templates/messaging/MessageThread.js +3 -3
- package/dist/components/templates/messaging/MessagingWorkspace.js +5 -5
- package/dist/components/templates/messaging/index.js +5 -5
- package/dist/components/templates/recipes/LanguageSwitcher.js +1 -1
- package/dist/components/templates/recipes/RecipeCard.js +1 -1
- package/dist/components/templates/recipes/RecipeDetail.js +1 -1
- package/dist/components/templates/recipes/RecipeList.js +3 -3
- package/dist/components/templates/recipes/index.js +3 -3
- package/dist/components/templates/todos/FilterBar.js +1 -1
- package/dist/components/templates/todos/TaskForm.js +2 -2
- package/dist/components/templates/todos/TaskItem.js +1 -1
- package/dist/components/templates/todos/TaskList.js +5 -5
- package/dist/components/templates/todos/index.js +5 -5
- package/dist/config/contractspec-blueprint.js +1 -1
- package/dist/config/contractspec-branding.js +1 -1
- package/dist/config/contractspec-routes.js +1 -1
- package/dist/config/index.js +1 -1
- package/dist/features/contracts-registry.js +1 -1
- package/dist/features/docs/docs.contracts.js +1 -1
- package/dist/features/docs/index.js +1 -1
- package/dist/features/docs.feature.js +1 -1
- package/dist/features/index.js +1 -1
- package/dist/features/mcp.feature.js +1 -1
- package/dist/features/presentations.feature.js +1 -1
- package/dist/features/registry.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +701 -430
- package/dist/infrastructure/elysia/index.js +1 -1
- package/dist/infrastructure/elysia/logger.js +1 -1
- package/dist/infrastructure/index.js +1 -1
- package/dist/libs/email/client.js +1 -1
- package/dist/libs/email/contact.js +3 -3
- package/dist/libs/email/newsletter.js +3 -3
- package/dist/libs/email/utils.js +2 -2
- package/dist/libs/email/waitlist-application.js +3 -3
- package/dist/libs/email/waitlist.js +3 -3
- package/dist/libs/email.js +6 -6
- package/dist/libs/posthog/client.js +1 -1
- package/dist/libs/posthog/native.js +1 -1
- package/dist/libs/posthog/server.js +1 -1
- package/dist/libs/pricing-examples.js +1 -1
- package/dist/node/application/context-storage/index.js +1 -1
- package/dist/node/application/index.js +11 -11
- package/dist/node/application/mcp/cliMcp.js +6 -6
- package/dist/node/application/mcp/cliMcp.onboarding.js +1 -0
- package/dist/node/application/mcp/common.js +1 -1
- package/dist/node/application/mcp/contractsMcp.js +2 -2
- package/dist/node/application/mcp/contractsMcpAdoptionTools.js +1 -0
- package/dist/node/application/mcp/contractsMcpResources.js +2 -2
- package/dist/node/application/mcp/contractsMcpTools.js +1 -1
- package/dist/node/application/mcp/docsMcp.catalog.js +2 -2
- package/dist/node/application/mcp/docsMcp.data.js +1 -1
- package/dist/node/application/mcp/docsMcp.js +3 -3
- package/dist/node/application/mcp/docsMcp.prompts.js +3 -3
- package/dist/node/application/mcp/docsMcp.reference.js +2 -2
- package/dist/node/application/mcp/docsMcp.resources.js +2 -2
- package/dist/node/application/mcp/docsMcp.tools.js +2 -2
- package/dist/node/application/mcp/index.js +11 -11
- package/dist/node/application/mcp/internalMcp.js +2 -2
- package/dist/node/application/mcp/normalizeMcpRequest.js +1 -1
- package/dist/node/application/mcp/providerRankingMcp.js +1 -1
- package/dist/node/bundles/LibraryBundle.js +1 -1
- package/dist/node/bundles/index.js +1 -1
- package/dist/node/components/docs/DocsIndexPage.js +2 -2
- package/dist/node/components/docs/advanced/AdvancedMCPPage.js +3 -3
- package/dist/node/components/docs/advanced/AdvancedOverlayEditorPage.js +1 -1
- package/dist/node/components/docs/advanced/AdvancedRenderersPage.js +2 -2
- package/dist/node/components/docs/advanced/AdvancedSpecExperimentsPage.js +4 -4
- package/dist/node/components/docs/advanced/AdvancedTelemetryPage.js +2 -2
- package/dist/node/components/docs/advanced/AdvancedWorkflowMonitoringPage.js +2 -2
- package/dist/node/components/docs/advanced/index.js +9 -9
- package/dist/node/components/docs/architecture/ArchitectureAppConfigPage.js +6 -6
- package/dist/node/components/docs/architecture/ArchitectureControlPlanePage.js +3 -3
- package/dist/node/components/docs/architecture/ArchitectureIntegrationBindingPage.js +7 -7
- package/dist/node/components/docs/architecture/ArchitectureKnowledgeBindingPage.js +6 -6
- package/dist/node/components/docs/architecture/ArchitectureMultiTenancyPage.js +2 -2
- package/dist/node/components/docs/architecture/ArchitectureOverviewPage.js +1 -1
- package/dist/node/components/docs/architecture/index.js +20 -20
- package/dist/node/components/docs/comparison/ComparisonAutomationPlatformsPage.js +1 -1
- package/dist/node/components/docs/comparison/ComparisonEnterprisePlatformsPage.js +1 -1
- package/dist/node/components/docs/comparison/ComparisonInternalToolBuildersPage.js +1 -1
- package/dist/node/components/docs/comparison/ComparisonOverviewPage.js +1 -1
- package/dist/node/components/docs/comparison/ComparisonWindmillPage.js +1 -1
- package/dist/node/components/docs/comparison/ComparisonWorkflowEnginesPage.js +1 -1
- package/dist/node/components/docs/comparison/index.js +1 -1
- package/dist/node/components/docs/docsManifest.js +1 -1
- package/dist/node/components/docs/ecosystem/IntegrationsPage.js +2 -2
- package/dist/node/components/docs/ecosystem/PluginsPage.js +4 -4
- package/dist/node/components/docs/ecosystem/RegistryPage.js +4 -4
- package/dist/node/components/docs/ecosystem/TemplatesPage.js +3 -3
- package/dist/node/components/docs/ecosystem/index.js +11 -11
- package/dist/node/components/docs/examples/DocsExamplesPage.js +1 -17
- package/dist/node/components/docs/examples/ExampleShowcasePage.js +2 -17
- package/dist/node/components/docs/examples/exampleShowcaseData.js +2 -17
- package/dist/node/components/docs/examples/index.js +2 -17
- package/dist/node/components/docs/generated/docs-index.generated.js +1 -1
- package/dist/node/components/docs/generated/index.js +1 -1
- package/dist/node/components/docs/generated/loader.js +1 -1
- package/dist/node/components/docs/getting-started/CLIPage.js +6 -5
- package/dist/node/components/docs/getting-started/CompatibilityPage.js +1 -1
- package/dist/node/components/docs/getting-started/DataViewTutorialPage.js +44 -67
- package/dist/node/components/docs/getting-started/DeveloperToolsPage.js +1 -1
- package/dist/node/components/docs/getting-started/HelloWorldPage.js +5 -5
- package/dist/node/components/docs/getting-started/InstallationPage.js +3 -3
- package/dist/node/components/docs/getting-started/StartHerePage.js +4 -2
- package/dist/node/components/docs/getting-started/TroubleshootingPage.js +2 -2
- package/dist/node/components/docs/getting-started/VSCodeExtensionPage.js +1 -1
- package/dist/node/components/docs/getting-started/getting-started.docblocks.js +2 -2
- package/dist/node/components/docs/getting-started/index.js +60 -80
- package/dist/node/components/docs/guides/GuideCIDiffGatingPage.js +2 -2
- package/dist/node/components/docs/guides/GuideConnectInRepoPage.js +30 -5
- package/dist/node/components/docs/guides/GuideContractTypesPage.js +6 -6
- package/dist/node/components/docs/guides/GuideDocsPipelinePage.js +3 -3
- package/dist/node/components/docs/guides/GuideFirstModuleBundlePage.js +4 -4
- package/dist/node/components/docs/guides/GuideGenerateDocsClientsSchemasPage.js +2 -2
- package/dist/node/components/docs/guides/GuideHostBuilderWorkbenchPage.js +21 -6
- package/dist/node/components/docs/guides/GuideImportExistingCodebasesPage.js +8 -8
- package/dist/node/components/docs/guides/GuideNextjsOneEndpointPage.js +6 -6
- package/dist/node/components/docs/guides/GuideReleaseCapsulesPage.js +15 -0
- package/dist/node/components/docs/guides/GuideSpecValidationTypingPage.js +4 -4
- package/dist/node/components/docs/guides/GuidesIndexPage.js +2 -2
- package/dist/node/components/docs/guides/index.js +93 -39
- package/dist/node/components/docs/index.js +690 -419
- package/dist/node/components/docs/integrations/IntegrationsCircuitBreakersPage.js +2 -2
- package/dist/node/components/docs/integrations/IntegrationsElevenLabsPage.js +3 -3
- package/dist/node/components/docs/integrations/IntegrationsGithubPage.js +2 -2
- package/dist/node/components/docs/integrations/IntegrationsGmailPage.js +3 -3
- package/dist/node/components/docs/integrations/IntegrationsGoogleCalendarPage.js +3 -3
- package/dist/node/components/docs/integrations/IntegrationsHealthRoutingPage.js +2 -2
- package/dist/node/components/docs/integrations/IntegrationsMistralPage.js +2 -2
- package/dist/node/components/docs/integrations/IntegrationsOpenAIPage.js +2 -2
- package/dist/node/components/docs/integrations/IntegrationsOverviewPage.js +1 -1
- package/dist/node/components/docs/integrations/IntegrationsPostmarkPage.js +2 -2
- package/dist/node/components/docs/integrations/IntegrationsPowensPage.js +2 -2
- package/dist/node/components/docs/integrations/IntegrationsQdrantPage.js +5 -5
- package/dist/node/components/docs/integrations/IntegrationsResendPage.js +3 -3
- package/dist/node/components/docs/integrations/IntegrationsS3Page.js +4 -4
- package/dist/node/components/docs/integrations/IntegrationsSlackPage.js +2 -2
- package/dist/node/components/docs/integrations/IntegrationsSpecModelPage.js +2 -2
- package/dist/node/components/docs/integrations/IntegrationsStripePage.js +2 -2
- package/dist/node/components/docs/integrations/IntegrationsTwilioPage.js +3 -3
- package/dist/node/components/docs/integrations/IntegrationsWhatsappMetaPage.js +2 -2
- package/dist/node/components/docs/integrations/IntegrationsWhatsappTwilioPage.js +2 -2
- package/dist/node/components/docs/integrations/index.js +39 -39
- package/dist/node/components/docs/intent/ContractFirstApiPage.js +2 -2
- package/dist/node/components/docs/intent/DeterministicCodegenPage.js +2 -2
- package/dist/node/components/docs/intent/GenerateClientFromSchemaPage.js +7 -7
- package/dist/node/components/docs/intent/OpenapiAlternativePage.js +3 -3
- package/dist/node/components/docs/intent/SchemaValidationTypescriptPage.js +4 -4
- package/dist/node/components/docs/intent/SpecDrivenDevelopmentPage.js +2 -2
- package/dist/node/components/docs/intent/index.js +15 -15
- package/dist/node/components/docs/intent/intent-pages.docblocks.js +1 -1
- package/dist/node/components/docs/knowledge/KnowledgeCategoriesPage.js +2 -2
- package/dist/node/components/docs/knowledge/KnowledgeExamplesPage.js +2 -2
- package/dist/node/components/docs/knowledge/KnowledgeOverviewPage.js +1 -1
- package/dist/node/components/docs/knowledge/KnowledgeSourcesPage.js +2 -2
- package/dist/node/components/docs/knowledge/KnowledgeSpacesPage.js +2 -2
- package/dist/node/components/docs/knowledge/index.js +5 -5
- package/dist/node/components/docs/libraries/LibrariesAccessibilityPage.js +3 -3
- package/dist/node/components/docs/libraries/LibrariesAiAgentPage.js +3 -3
- package/dist/node/components/docs/libraries/LibrariesAnalyticsPage.js +4 -4
- package/dist/node/components/docs/libraries/LibrariesContentGenPage.js +2 -2
- package/dist/node/components/docs/libraries/LibrariesContractsPage.js +43 -18
- package/dist/node/components/docs/libraries/LibrariesCostTrackingPage.js +3 -3
- package/dist/node/components/docs/libraries/LibrariesCrossPlatformUIPage.content.js +85 -0
- package/dist/node/components/docs/libraries/LibrariesCrossPlatformUIPage.js +85 -0
- package/dist/node/components/docs/libraries/LibrariesDataBackendPage.js +2 -2
- package/dist/node/components/docs/libraries/LibrariesDataViewsPage.js +3 -3
- package/dist/node/components/docs/libraries/LibrariesDesignSystemPage.js +77 -29
- package/dist/node/components/docs/libraries/LibrariesEvolutionPage.js +4 -4
- package/dist/node/components/docs/libraries/LibrariesGraphQLPage.js +2 -2
- package/dist/node/components/docs/libraries/LibrariesGrowthPage.js +3 -3
- package/dist/node/components/docs/libraries/LibrariesMultiTenancyPage.js +3 -3
- package/dist/node/components/docs/libraries/LibrariesObservabilityPage.js +5 -5
- package/dist/node/components/docs/libraries/LibrariesOverlayEnginePage.js +4 -4
- package/dist/node/components/docs/libraries/LibrariesOverviewPage.js +1 -1
- package/dist/node/components/docs/libraries/LibrariesPersonalizationPage.js +4 -4
- package/dist/node/components/docs/libraries/LibrariesProgressiveDeliveryPage.js +3 -3
- package/dist/node/components/docs/libraries/LibrariesResiliencePage.js +4 -4
- package/dist/node/components/docs/libraries/LibrariesRuntimePage.js +2 -2
- package/dist/node/components/docs/libraries/LibrariesSLOPage.js +3 -3
- package/dist/node/components/docs/libraries/LibrariesSchemaPage.js +3 -3
- package/dist/node/components/docs/libraries/LibrariesSupportBotPage.js +3 -3
- package/dist/node/components/docs/libraries/LibrariesTestingPage.js +3 -3
- package/dist/node/components/docs/libraries/LibrariesUIKitPage.js +42 -16
- package/dist/node/components/docs/libraries/LibrariesUIKitWebPage.js +46 -0
- package/dist/node/components/docs/libraries/LibrariesWorkflowComposerPage.js +3 -3
- package/dist/node/components/docs/libraries/LibrariesWorkflowsPage.js +2 -2
- package/dist/node/components/docs/libraries/index.js +338 -110
- package/dist/node/components/docs/manifesto/ManifestoPage.js +1 -1
- package/dist/node/components/docs/ops/AutoEvolutionOpsPage.js +2 -2
- package/dist/node/components/docs/ops/DistributedTracingOpsPage.js +2 -2
- package/dist/node/components/docs/ops/index.js +3 -3
- package/dist/node/components/docs/ops/ops-lifecycle.docblocks.js +2 -2
- package/dist/node/components/docs/ops/ops-runbooks-a.docblocks.js +2 -2
- package/dist/node/components/docs/ops/ops-runbooks-b.docblocks.js +2 -2
- package/dist/node/components/docs/ops/ops-slo-tenant.docblocks.js +2 -2
- package/dist/node/components/docs/ops/ops-top.docs.js +2 -2
- package/dist/node/components/docs/ops/ops.docs.js +6 -6
- package/dist/node/components/docs/product/product.docblocks.js +2 -2
- package/dist/node/components/docs/reference/DocsMarkdownContent.js +2 -2
- package/dist/node/components/docs/reference/DocsReferenceContent.js +3 -3
- package/dist/node/components/docs/reference/DocsReferenceIndexClient.js +2 -2
- package/dist/node/components/docs/reference/DocsReferenceIndexPage.js +2 -2
- package/dist/node/components/docs/reference/DocsReferencePage.js +3 -3
- package/dist/node/components/docs/reference/docsMarkdownParser.js +2 -2
- package/dist/node/components/docs/reference/index.js +4 -4
- package/dist/node/components/docs/safety/SafetyAuditingPage.js +2 -2
- package/dist/node/components/docs/safety/SafetyMigrationsPage.js +2 -2
- package/dist/node/components/docs/safety/SafetyOverviewPage.js +1 -1
- package/dist/node/components/docs/safety/SafetyPDPPage.js +2 -2
- package/dist/node/components/docs/safety/SafetySecurityTrustPage.js +1 -1
- package/dist/node/components/docs/safety/SafetySigningPage.js +3 -3
- package/dist/node/components/docs/safety/SafetyTenantIsolationPage.js +2 -2
- package/dist/node/components/docs/safety/index.js +7 -7
- package/dist/node/components/docs/shared/StudioPrompt.js +1 -1
- package/dist/node/components/docs/specs/SpecsBuilderControlPlanePage.js +18 -3
- package/dist/node/components/docs/specs/SpecsCapabilitiesPage.js +2 -2
- package/dist/node/components/docs/specs/SpecsConnectPage.js +4 -2
- package/dist/node/components/docs/specs/SpecsDataViewsPage.js +39 -32
- package/dist/node/components/docs/specs/SpecsModuleBundlesPage.js +3 -3
- package/dist/node/components/docs/specs/SpecsOverlaysPage.js +2 -2
- package/dist/node/components/docs/specs/SpecsOverviewPage.js +1 -1
- package/dist/node/components/docs/specs/SpecsPolicyPage.js +3 -3
- package/dist/node/components/docs/specs/SpecsWorkflowsPage.js +2 -2
- package/dist/node/components/docs/specs/index.js +66 -42
- package/dist/node/components/docs/studio/StudioBYOKPage.js +1 -1
- package/dist/node/components/docs/studio/StudioDeploymentsPage.js +1 -1
- package/dist/node/components/docs/studio/StudioGettingStartedPage.js +1 -1
- package/dist/node/components/docs/studio/StudioIntegrationsPage.js +1 -1
- package/dist/node/components/docs/studio/StudioOverviewPage.js +1 -1
- package/dist/node/components/docs/studio/StudioVisualBuilderPage.js +1 -1
- package/dist/node/components/docs/studio/index.js +1 -1
- package/dist/node/components/docs/tech/contracts/tech-docs.docblocks.js +2 -2
- package/dist/node/components/integrations/index.js +2 -2
- package/dist/node/components/integrations/molecules/IntegrationCard.js +1 -1
- package/dist/node/components/integrations/organisms/IntegrationMarketplace.js +1 -1
- package/dist/node/components/integrations/organisms/IntegrationSettings.js +2 -2
- package/dist/node/components/integrations/organisms/KnowledgeSourceList.js +1 -1
- package/dist/node/components/legal/PrivacyTemplate.js +1 -1
- package/dist/node/components/legal/TermsTemplate.js +1 -1
- package/dist/node/components/legal/index.js +1 -1
- package/dist/node/components/shared/FeatureGateNotice.js +1 -1
- package/dist/node/components/shared/index.js +1 -1
- package/dist/node/components/shell/WorkspaceHeader.js +1 -1
- package/dist/node/components/shell/WorkspaceProjectShellLayout.js +1 -1
- package/dist/node/components/shell/WorkspaceShellRenderer.js +1 -1
- package/dist/node/components/shell/WorkspaceSidebar.js +1 -1
- package/dist/node/components/shell/index.js +1 -1
- package/dist/node/components/templates/engine/index.js +1 -1
- package/dist/node/components/templates/index.js +11 -11
- package/dist/node/components/templates/messaging/ConversationList.js +2 -2
- package/dist/node/components/templates/messaging/MessageComposer.js +4 -4
- package/dist/node/components/templates/messaging/MessageThread.js +3 -3
- package/dist/node/components/templates/messaging/MessagingWorkspace.js +5 -5
- package/dist/node/components/templates/messaging/index.js +5 -5
- package/dist/node/components/templates/recipes/LanguageSwitcher.js +1 -1
- package/dist/node/components/templates/recipes/RecipeCard.js +1 -1
- package/dist/node/components/templates/recipes/RecipeDetail.js +1 -1
- package/dist/node/components/templates/recipes/RecipeList.js +3 -3
- package/dist/node/components/templates/recipes/index.js +3 -3
- package/dist/node/components/templates/todos/FilterBar.js +1 -1
- package/dist/node/components/templates/todos/TaskForm.js +2 -2
- package/dist/node/components/templates/todos/TaskItem.js +1 -1
- package/dist/node/components/templates/todos/TaskList.js +5 -5
- package/dist/node/components/templates/todos/index.js +5 -5
- package/dist/node/config/contractspec-blueprint.js +1 -1
- package/dist/node/config/contractspec-branding.js +1 -1
- package/dist/node/config/contractspec-routes.js +1 -1
- package/dist/node/config/index.js +1 -1
- package/dist/node/features/contracts-registry.js +1 -1
- package/dist/node/features/docs/docs.contracts.js +1 -1
- package/dist/node/features/docs/index.js +1 -1
- package/dist/node/features/docs.feature.js +1 -1
- package/dist/node/features/index.js +1 -1
- package/dist/node/features/mcp.feature.js +1 -1
- package/dist/node/features/presentations.feature.js +1 -1
- package/dist/node/features/registry.js +1 -1
- package/dist/node/index.js +701 -430
- package/dist/node/infrastructure/elysia/index.js +1 -1
- package/dist/node/infrastructure/elysia/logger.js +1 -1
- package/dist/node/infrastructure/index.js +1 -1
- package/dist/node/libs/email/client.js +1 -1
- package/dist/node/libs/email/contact.js +3 -3
- package/dist/node/libs/email/newsletter.js +3 -3
- package/dist/node/libs/email/utils.js +2 -2
- package/dist/node/libs/email/waitlist-application.js +3 -3
- package/dist/node/libs/email/waitlist.js +3 -3
- package/dist/node/libs/email.js +6 -6
- package/dist/node/libs/posthog/client.js +1 -1
- package/dist/node/libs/posthog/native.js +1 -1
- package/dist/node/libs/posthog/server.js +1 -1
- package/dist/node/libs/pricing-examples.js +1 -1
- package/dist/node/presentation/features/atoms/FeatureIcon/FeatureIcon.js +1 -1
- package/dist/node/presentation/features/atoms/FeatureIcon/index.js +1 -1
- package/dist/node/presentation/features/atoms/index.js +1 -1
- package/dist/node/presentation/features/hooks/index.js +1 -1
- package/dist/node/presentation/features/hooks/useContractsRegistry.js +1 -1
- package/dist/node/presentation/features/hooks/useFeatureFilters.js +1 -1
- package/dist/node/presentation/features/hooks/useFeatureRegistry.js +1 -1
- package/dist/node/presentation/features/hooks/useRelatedDocs.js +1 -1
- package/dist/node/presentation/features/index.js +1 -1
- package/dist/node/presentation/features/molecules/FeatureCard/FeatureCard.js +1 -1
- package/dist/node/presentation/features/molecules/FeatureCard/index.js +1 -1
- package/dist/node/presentation/features/molecules/FeatureCategoryHeader/FeatureCategoryHeader.js +1 -1
- package/dist/node/presentation/features/molecules/FeatureCategoryHeader/index.js +1 -1
- package/dist/node/presentation/features/molecules/FeatureFilters/FeatureFilters.js +1 -1
- package/dist/node/presentation/features/molecules/FeatureFilters/index.js +1 -1
- package/dist/node/presentation/features/molecules/FeatureHoverPreview/FeatureHoverPreview.js +1 -1
- package/dist/node/presentation/features/molecules/FeatureHoverPreview/index.js +1 -1
- package/dist/node/presentation/features/molecules/index.js +1 -1
- package/dist/node/presentation/features/organisms/FeatureDataViewsList.js +1 -1
- package/dist/node/presentation/features/organisms/FeatureDetail/FeatureDetail.js +1 -1
- package/dist/node/presentation/features/organisms/FeatureDetail/index.js +1 -1
- package/dist/node/presentation/features/organisms/FeatureDiscovery/FeatureDiscovery.js +1 -1
- package/dist/node/presentation/features/organisms/FeatureDiscovery/index.js +1 -1
- package/dist/node/presentation/features/organisms/FeatureEventsList.js +1 -1
- package/dist/node/presentation/features/organisms/FeatureFormsList.js +1 -1
- package/dist/node/presentation/features/organisms/FeatureOperationsList.js +1 -1
- package/dist/node/presentation/features/organisms/FeaturePresentationsList.js +1 -1
- package/dist/node/presentation/features/organisms/index.js +1 -1
- package/dist/node/presentation/features/templates/FeatureDataViewDetailTemplate/FeatureDataViewDetailTemplate.js +1 -1
- package/dist/node/presentation/features/templates/FeatureDataViewDetailTemplate/index.js +1 -1
- package/dist/node/presentation/features/templates/FeatureDataViewsTemplate/FeatureDataViewsTemplate.js +1 -1
- package/dist/node/presentation/features/templates/FeatureDataViewsTemplate/index.js +1 -1
- package/dist/node/presentation/features/templates/FeatureEventDetailTemplate/FeatureEventDetailTemplate.js +1 -1
- package/dist/node/presentation/features/templates/FeatureEventDetailTemplate/index.js +1 -1
- package/dist/node/presentation/features/templates/FeatureEventsTemplate/FeatureEventsTemplate.js +1 -1
- package/dist/node/presentation/features/templates/FeatureEventsTemplate/index.js +1 -1
- package/dist/node/presentation/features/templates/FeatureFormDetailTemplate/FeatureFormDetailTemplate.js +1 -1
- package/dist/node/presentation/features/templates/FeatureFormDetailTemplate/index.js +1 -1
- package/dist/node/presentation/features/templates/FeatureFormsTemplate/FeatureFormsTemplate.js +1 -1
- package/dist/node/presentation/features/templates/FeatureFormsTemplate/index.js +1 -1
- package/dist/node/presentation/features/templates/FeatureOperationDetailTemplate/FeatureOperationDetailTemplate.js +1 -1
- package/dist/node/presentation/features/templates/FeatureOperationDetailTemplate/index.js +1 -1
- package/dist/node/presentation/features/templates/FeatureOperationsTemplate/FeatureOperationsTemplate.js +1 -1
- package/dist/node/presentation/features/templates/FeatureOperationsTemplate/index.js +1 -1
- package/dist/node/presentation/features/templates/FeatureOverviewTemplate/FeatureOverviewTemplate.js +1 -1
- package/dist/node/presentation/features/templates/FeatureOverviewTemplate/index.js +1 -1
- package/dist/node/presentation/features/templates/FeaturePresentationDetailTemplate/FeaturePresentationDetailTemplate.js +1 -1
- package/dist/node/presentation/features/templates/FeaturePresentationDetailTemplate/index.js +1 -1
- package/dist/node/presentation/features/templates/FeaturePresentationsTemplate/FeaturePresentationsTemplate.js +1 -1
- package/dist/node/presentation/features/templates/FeaturePresentationsTemplate/index.js +1 -1
- package/dist/presentation/features/atoms/FeatureIcon/FeatureIcon.js +1 -1
- package/dist/presentation/features/atoms/FeatureIcon/index.js +1 -1
- package/dist/presentation/features/atoms/index.js +1 -1
- package/dist/presentation/features/hooks/index.js +1 -1
- package/dist/presentation/features/hooks/useContractsRegistry.js +1 -1
- package/dist/presentation/features/hooks/useFeatureFilters.js +1 -1
- package/dist/presentation/features/hooks/useFeatureRegistry.js +1 -1
- package/dist/presentation/features/hooks/useRelatedDocs.js +1 -1
- package/dist/presentation/features/index.js +1 -1
- package/dist/presentation/features/molecules/FeatureCard/FeatureCard.js +1 -1
- package/dist/presentation/features/molecules/FeatureCard/index.js +1 -1
- package/dist/presentation/features/molecules/FeatureCategoryHeader/FeatureCategoryHeader.js +1 -1
- package/dist/presentation/features/molecules/FeatureCategoryHeader/index.js +1 -1
- package/dist/presentation/features/molecules/FeatureFilters/FeatureFilters.js +1 -1
- package/dist/presentation/features/molecules/FeatureFilters/index.js +1 -1
- package/dist/presentation/features/molecules/FeatureHoverPreview/FeatureHoverPreview.js +1 -1
- package/dist/presentation/features/molecules/FeatureHoverPreview/index.js +1 -1
- package/dist/presentation/features/molecules/index.js +1 -1
- package/dist/presentation/features/organisms/FeatureDataViewsList.js +1 -1
- package/dist/presentation/features/organisms/FeatureDetail/FeatureDetail.js +1 -1
- package/dist/presentation/features/organisms/FeatureDetail/index.js +1 -1
- package/dist/presentation/features/organisms/FeatureDiscovery/FeatureDiscovery.js +1 -1
- package/dist/presentation/features/organisms/FeatureDiscovery/index.js +1 -1
- package/dist/presentation/features/organisms/FeatureEventsList.js +1 -1
- package/dist/presentation/features/organisms/FeatureFormsList.js +1 -1
- package/dist/presentation/features/organisms/FeatureOperationsList.js +1 -1
- package/dist/presentation/features/organisms/FeaturePresentationsList.js +1 -1
- package/dist/presentation/features/organisms/index.js +1 -1
- package/dist/presentation/features/templates/FeatureDataViewDetailTemplate/FeatureDataViewDetailTemplate.js +1 -1
- package/dist/presentation/features/templates/FeatureDataViewDetailTemplate/index.js +1 -1
- package/dist/presentation/features/templates/FeatureDataViewsTemplate/FeatureDataViewsTemplate.js +1 -1
- package/dist/presentation/features/templates/FeatureDataViewsTemplate/index.js +1 -1
- package/dist/presentation/features/templates/FeatureEventDetailTemplate/FeatureEventDetailTemplate.js +1 -1
- package/dist/presentation/features/templates/FeatureEventDetailTemplate/index.js +1 -1
- package/dist/presentation/features/templates/FeatureEventsTemplate/FeatureEventsTemplate.js +1 -1
- package/dist/presentation/features/templates/FeatureEventsTemplate/index.js +1 -1
- package/dist/presentation/features/templates/FeatureFormDetailTemplate/FeatureFormDetailTemplate.js +1 -1
- package/dist/presentation/features/templates/FeatureFormDetailTemplate/index.js +1 -1
- package/dist/presentation/features/templates/FeatureFormsTemplate/FeatureFormsTemplate.js +1 -1
- package/dist/presentation/features/templates/FeatureFormsTemplate/index.js +1 -1
- package/dist/presentation/features/templates/FeatureOperationDetailTemplate/FeatureOperationDetailTemplate.js +1 -1
- package/dist/presentation/features/templates/FeatureOperationDetailTemplate/index.js +1 -1
- package/dist/presentation/features/templates/FeatureOperationsTemplate/FeatureOperationsTemplate.js +1 -1
- package/dist/presentation/features/templates/FeatureOperationsTemplate/index.js +1 -1
- package/dist/presentation/features/templates/FeatureOverviewTemplate/FeatureOverviewTemplate.js +1 -1
- package/dist/presentation/features/templates/FeatureOverviewTemplate/index.js +1 -1
- package/dist/presentation/features/templates/FeaturePresentationDetailTemplate/FeaturePresentationDetailTemplate.js +1 -1
- package/dist/presentation/features/templates/FeaturePresentationDetailTemplate/index.js +1 -1
- package/dist/presentation/features/templates/FeaturePresentationsTemplate/FeaturePresentationsTemplate.js +1 -1
- package/dist/presentation/features/templates/FeaturePresentationsTemplate/index.js +1 -1
- package/package.json +96 -23
- package/src/application/mcp/cliMcp.onboarding.ts +297 -0
- package/src/application/mcp/cliMcp.test.ts +99 -0
- package/src/application/mcp/cliMcp.ts +30 -3
- package/src/application/mcp/contractsMcp.test.ts +65 -0
- package/src/application/mcp/contractsMcpAdoptionTools.ts +131 -0
- package/src/application/mcp/contractsMcpResources.ts +49 -0
- package/src/application/mcp/contractsMcpTools.ts +2 -0
- package/src/application/mcp/contractsMcpTypes.ts +16 -0
- package/src/bundles/LibraryBundle.ts +19 -130
- package/src/components/docs/docsManifest.test.ts +14 -0
- package/src/components/docs/docsManifest.ts +22 -0
- package/src/components/docs/examples/DocsExamplesPage.tsx +6 -14
- package/src/components/docs/examples/ExampleShowcasePage.tsx +22 -18
- package/src/components/docs/examples/exampleShowcaseData.test.ts +22 -0
- package/src/components/docs/examples/exampleShowcaseData.ts +75 -50
- package/src/components/docs/generated/docs-index._common.json +9 -1
- package/src/components/docs/generated/docs-index.ai-chat.json +1 -1
- package/src/components/docs/generated/docs-index.app-config.json +4 -4
- package/src/components/docs/generated/docs-index.data-grid-showcase.json +9 -1
- package/src/components/docs/generated/docs-index.jobs.json +1 -1
- package/src/components/docs/generated/docs-index.kb-update-pipeline.json +5 -5
- package/src/components/docs/generated/docs-index.learning-journey-crm-onboarding.json +1 -1
- package/src/components/docs/generated/docs-index.learning-journey-platform-tour.json +1 -1
- package/src/components/docs/generated/docs-index.learning-journey-registry.json +1 -1
- package/src/components/docs/generated/docs-index.learning-journey.json +27 -3
- package/src/components/docs/generated/docs-index.locale-jurisdiction-gate.json +8 -0
- package/src/components/docs/generated/docs-index.manifest.json +13 -13
- package/src/components/docs/generated/docs-index.mobile-demo-landing.json +42 -0
- package/src/components/docs/generated/docs-index.platform-agent.json +18 -2
- package/src/components/docs/generated/docs-index.platform-context.json +16 -0
- package/src/components/docs/generated/docs-index.platform-docs.json +9 -1
- package/src/components/docs/generated/docs-index.platform-provider-ranking.json +32 -0
- package/src/components/docs/generated/docs-index.wealth-snapshot.json +4 -4
- package/src/components/docs/generated/index.ts +20 -5
- package/src/components/docs/generated/loader.ts +15 -8
- package/src/components/docs/getting-started/CLIPage.tsx +10 -2
- package/src/components/docs/getting-started/CompatibilityPage.tsx +14 -0
- package/src/components/docs/getting-started/DataViewTutorialPage.tsx +63 -70
- package/src/components/docs/getting-started/StartHerePage.tsx +10 -9
- package/src/components/docs/guides/GuideConnectInRepoPage.tsx +52 -3
- package/src/components/docs/guides/GuideHostBuilderWorkbenchPage.tsx +55 -6
- package/src/components/docs/guides/GuideReleaseCapsulesPage.tsx +147 -0
- package/src/components/docs/guides/GuidesIndexPage.tsx +7 -0
- package/src/components/docs/guides/index.ts +1 -0
- package/src/components/docs/libraries/LibrariesContractsPage.tsx +72 -27
- package/src/components/docs/libraries/LibrariesCrossPlatformUIPage.content.ts +252 -0
- package/src/components/docs/libraries/LibrariesCrossPlatformUIPage.tsx +232 -0
- package/src/components/docs/libraries/LibrariesDesignSystemPage.tsx +140 -55
- package/src/components/docs/libraries/LibrariesOverviewPage.tsx +13 -1
- package/src/components/docs/libraries/LibrariesRuntimePage.tsx +15 -0
- package/src/components/docs/libraries/LibrariesUIKitPage.tsx +78 -25
- package/src/components/docs/libraries/LibrariesUIKitWebPage.tsx +129 -0
- package/src/components/docs/libraries/index.ts +2 -0
- package/src/components/docs/reference/DocsReferenceIndexPage.tsx +1 -1
- package/src/components/docs/specs/SpecsBuilderControlPlanePage.tsx +58 -3
- package/src/components/docs/specs/SpecsConnectPage.tsx +30 -0
- package/src/components/docs/specs/SpecsDataViewsPage.tsx +63 -42
- package/src/index.ts +1 -1
- package/src/components/docs/generated/docs-index.mobile-demo-tasks.json +0 -34
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{defaultDocRegistry as
|
|
1
|
+
var o=Object.defineProperty;var s=(j)=>j;function t(j,w){this[j]=s.bind(null,w)}var Hw=(j,w)=>{for(var H in w)o(j,H,{get:w[H],enumerable:!0,configurable:!0,set:t.bind(w,H)})};var Jw=(j,w)=>()=>(j&&(w=j(j=0)),w);import{defaultDocRegistry as r}from"@contractspec/lib.contracts-spec/docs";var e=20,jj=100;function V(j){return j?.trim().toLowerCase()??""}function O(j){let w=decodeURIComponent(j).trim();if(!w)return"/";return w.startsWith("/")?w:`/${w}`}function wj(j){return(Array.isArray(j)?j:j?[j]:[]).map((H)=>V(H)).filter(Boolean)}function Hj(j){if(!j||Number.isNaN(j))return e;return Math.min(Math.max(j,1),jj)}function Jj(j){if(!j||Number.isNaN(j))return 0;return Math.max(j,0)}function E({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 Yj(j,w){if(!w)return 1;let H=w.split(/\s+/).filter(Boolean),J=V(j.block.title),$=V(j.block.id),Z=V(j.block.summary),U=V(j.block.body),K=V(j.route),Q=(j.block.tags??[]).map((Y)=>V(Y)),L=[J,$,Z,U,K,...Q].join(" ");if(H.some((Y)=>!L.includes(Y)))return 0;let X=0;for(let Y of H){if($.includes(Y))X+=8;if(J.includes(Y))X+=7;if(Q.some((B)=>B.includes(Y)))X+=5;if(Z.includes(Y))X+=4;if(K.includes(Y))X+=3;if(U.includes(Y))X+=2}return X}function S(j,w){let H=V(typeof w.query==="string"?w.query:void 0),J=wj(w.tag),$=V(typeof w.visibility==="string"?w.visibility:void 0),Z=V(typeof w.kind==="string"?w.kind:void 0),U=Hj(typeof w.limit==="number"?w.limit:void 0),K=Jj(typeof w.offset==="number"?w.offset:void 0),Q=j.map((Y)=>({doc:E(Y),score:Yj(Y,H)})).filter(({doc:Y,score:B})=>{let g=H?B>0:!0,u=J.length?J.every((i)=>Y.tags.some((a)=>V(a).includes(i))):!0,n=$?V(Y.visibility)===$:!0,c=Z?V(Y.kind)===Z:!0;return g&&u&&n&&c}).sort((Y,B)=>{if(B.score!==Y.score)return B.score-Y.score;return Y.doc.title.localeCompare(B.doc.title)}),L=Q.slice(K,K+U).map(({doc:Y})=>Y),X=K+L.length<Q.length?K+L.length:void 0;return{docs:L,items:L,total:Q.length,...X!=null?{nextOffset:X}:{}}}function h(j){let w=decodeURIComponent(j),H=r.get(w);if(!H)return;return{doc:E(H),content:String(H.block.body??"")}}function T(j,w){let H=O(w),J=j.find(($)=>O($.route)===H);if(!J)return;return{doc:E(J),content:String(J.block.body??"")}}function v(j){let w=new Map,H=new Map,J=new Map;for(let Z of j){let U=Z.block.kind??"reference",K=Z.block.visibility??"public";H.set(U,(H.get(U)??0)+1),J.set(K,(J.get(K)??0)+1);for(let Q of Z.block.tags??[])w.set(Q,(w.get(Q)??0)+1)}let $=(Z,U)=>[...Z.entries()].sort((K,Q)=>Q[1]-K[1]||K[0].localeCompare(Q[0])).map(([K,Q])=>({[U]:K,count:Q}));return{totalDocs:j.length,tags:$(w,"tag"),kinds:$(H,"kind"),visibilities:$(J,"visibility")}}import{EventRegistry as Zj,OperationSpecRegistry as $j}from"@contractspec/lib.contracts-spec";import{DataViewRegistry as Kj}from"@contractspec/lib.contracts-spec/data-views";import{ContractReferenceDataView as Qj,ContractReferenceQuery as Uj,DocsGenerateCommand as Vj,DocsGeneratedEvent as Xj,DocsIndexDataView as Bj,DocsIndexQuery as Fj,DocsLayoutPresentation as Lj,DocsPublishCommand as Nj,DocsPublishedEvent as Pj,DocsReferencePagePresentation as Wj,DocsSearchForm as Aj,ExampleCatalogDataView as Gj}from"@contractspec/lib.contracts-spec/docs";import{FormRegistry as qj}from"@contractspec/lib.contracts-spec/forms";import{PresentationRegistry as Mj}from"@contractspec/lib.contracts-spec/presentations";import{serializeDataViewSpec as _j,serializeEventSpec as Ij,serializeFormSpec as xj,serializeOperationSpec as Ej,serializePresentationSpec as Rj}from"@contractspec/lib.contracts-spec/serialization";var q=null;function zj(){let j=new $j;return j.register(Fj).register(Uj).register(Vj).register(Nj),j}function Cj(){if(!q)q=zj();return q}function R(j,w){return Cj().get(j,w)}var M=null;function bj(){let j=new Zj;return j.register(Xj).register(Pj),j}function Dj(){if(!M)M=bj();return M}function z(j,w){return Dj().get(j,w)}var _=null;function Oj(){let j=new Mj;return j.register(Lj).register(Wj),j}function Sj(){if(!_)_=Oj();return _}function C(j,w){return Sj().get(j,w)}var I=null;function hj(){let j=new Kj;return j.register(Bj).register(Qj).register(Gj),j}function Tj(){if(!I)I=hj();return I}function b(j,w){return Tj().get(j,w)}var x=null;function vj(){let j=new qj;return j.register(Aj),j}function kj(){if(!x)x=vj();return x}function D(j,w){return kj().get(j)}function k(j,w){let H=R(j,w);return Ej(H)??void 0}function f(j,w){let H=z(j,w);return Ij(H)??void 0}function m(j,w){let H=C(j,w);return Rj(H)??void 0}function y(j,w){let H=b(j,w);return _j(H)??void 0}function p(j,w){let H=D(j,w);return xj(H)??void 0}function fj(){q=null}function mj(){M=null}function yj(){_=null}function pj(){I=null}function dj(){x=null}function Fw(){fj(),mj(),yj(),pj(),dj()}import{defaultDocRegistry as lj}from"@contractspec/lib.contracts-spec/docs";function gj(j){return j?.trim().toLowerCase()??""}function uj(j){for(let w of j??[]){let H=lj.get(w);if(H)return H.route}return}function d(j,w,H,J){let $=j.meta.title??j.meta.key,Z=uj(j.meta.docId),U=j.meta.description;return{key:j.meta.key,version:j.meta.version,type:w,title:$,description:U,markdown:[`# ${$}`,`- Key: ${j.meta.key}`,`- Type: ${w}`,`- Version: ${j.meta.version}`,Z?`- Docs route: ${Z}`:"",U?`
|
|
2
2
|
${U}`:""].filter(Boolean).join(`
|
|
3
|
-
`),...Z?{route:Z}:{},...H?{schema:H}:{},...J?{policy:J}:{},tags:j.meta.tags??[],owners:j.meta.owners??[],stability:j.meta.stability}}function l(j){let w=j.includeSchema??!1,H=
|
|
3
|
+
`),...Z?{route:Z}:{},...H?{schema:H}:{},...J?{policy:J}:{},tags:j.meta.tags??[],owners:j.meta.owners??[],stability:j.meta.stability}}function l(j){let w=j.includeSchema??!1,H=gj(j.type),J=R(j.key,j.version);if(J&&(!H||H==="operation"||H===J.meta.kind))return{reference:d(J,J.meta.kind,w?k(j.key,j.version):void 0,J.policy)};let $=[{type:"data-view",spec:b(j.key,j.version),schema:w?y(j.key,j.version):void 0},{type:"form",spec:D(j.key,j.version),schema:w?p(j.key,j.version):void 0},{type:"presentation",spec:C(j.key,j.version),schema:w?m(j.key,j.version):void 0},{type:"event",spec:z(j.key,j.version),schema:w?f(j.key,j.version):void 0}];for(let Z of $)if(Z.spec&&(!H||H===Z.type))return{reference:d(Z.spec,Z.type,Z.schema)};throw Error(`Contract reference not found: ${j.key}`)}import{defineCommand as P,defineSchemaModel as N,installOp as W,OperationSpecRegistry as nj}from"@contractspec/lib.contracts-spec";import{ContractReferenceInput as cj,ContractReferenceOutput as ij,DocsIndexInput as aj,DocsIndexOutput as oj}from"@contractspec/lib.contracts-spec/docs";import{ScalarTypeEnum as F}from"@contractspec/lib.schema";var A=["@contractspec"],G=["docs","mcp"],sj=N({name:"DocsGetInput",fields:{id:{type:F.String_unsecure(),isOptional:!1}}}),tj=N({name:"DocsGetOutput",fields:{doc:{type:F.JSON(),isOptional:!1},content:{type:F.String_unsecure(),isOptional:!1}}}),rj=N({name:"DocsResolveRouteInput",fields:{route:{type:F.String_unsecure(),isOptional:!1}}}),ej=N({name:"DocsResolveRouteOutput",fields:{doc:{type:F.JSON(),isOptional:!1},content:{type:F.String_unsecure(),isOptional:!1}}}),jw=N({name:"DocsFacetsInput",fields:{}}),ww=N({name:"DocsFacetsOutput",fields:{facets:{type:F.JSON(),isOptional:!1}}});function Iw(j){let w=new nj;return W(w,P({meta:{key:"docs.search",version:"1.0.0",stability:"beta",owners:A,tags:G,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:aj,output:oj},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_search-v1_0_0"}}}),async(H)=>S(j,H)),W(w,P({meta:{key:"docs.get",version:"1.0.0",stability:"beta",owners:A,tags:G,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:sj,output:tj},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_get-v1_0_0"}}}),async({id:H})=>{let J=h(H);if(!J)throw Error(`DocBlock not found: ${H}`);return J}),W(w,P({meta:{key:"docs.resolveRoute",version:"1.0.0",stability:"beta",owners:A,tags:G,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:rj,output:ej},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_resolve_route-v1_0_0"}}}),async({route:H})=>{let J=T(j,H);if(!J)throw Error(`Doc route not found: ${H}`);return J}),W(w,P({meta:{key:"docs.contract.lookup",version:"1.0.0",stability:"beta",owners:A,tags:G,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:cj,output:ij},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_contract_reference-v1_0_0"}}}),async(H)=>l(H)),W(w,P({meta:{key:"docs.list.facets",version:"1.0.0",stability:"beta",owners:A,tags:G,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:jw,output:ww},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_list_facets-v1_0_0"}}}),async()=>({facets:v(j)})),w}export{Iw as buildDocOps};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import{Logger as
|
|
1
|
+
var LY=Object.defineProperty;var qY=(j)=>j;function _Y(j,Y){this[j]=qY.bind(null,Y)}var hJ=(j,Y)=>{for(var J in Y)LY(j,J,{get:Y[J],enumerable:!0,configurable:!0,set:_Y.bind(Y,J)})};var TJ=(j,Y)=>()=>(j&&(Y=j(j=0)),Y);import{Logger as Dj,LogLevel as Cj}from"@contractspec/lib.logger";function Aj(){return"production"}var MY=()=>new Dj({level:Cj.INFO,environment:Aj(),enableTracing:!0,enableTiming:!0,enableContext:!0,enableColors:!1}),D=MY(),yJ=new Dj({level:Cj.WARN,environment:Aj(),enableTracing:!0,enableTiming:!0,enableContext:!0,enableColors:!1}),mJ=new Dj({level:Cj.INFO,environment:Aj(),enableTracing:!0,enableTiming:!0,enableContext:!0,enableColors:!1});import{createNodeAdapters as bY,onboarding as Ej}from"@contractspec/bundle.workspace";import{defineCommand as Ij,definePrompt as GY,defineResourceTemplate as Nj,installOp as zj}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as o,ScalarTypeEnum as q}from"@contractspec/lib.schema";import C from"zod";var E=["cli","mcp","onboarding"],Zj=["@contractspec"];function DY(j){return j?.split(",").map((Y)=>Y.trim()).filter(Boolean)}async function $j(j={}){let Y=bY({cwd:process.cwd(),silent:!0});return Ej.buildOnboardingPlan(Y,{forcedExampleKey:j.example,selectedTracks:DY(j.tracks)})}function pj(j){j.register(Nj({meta:{uriTemplate:"onboarding://tracks",title:"Onboarding tracks",description:"Primary ContractSpec onboarding tracks exposed by the CLI.",mimeType:"application/json",tags:E},input:C.object({}),resolve:async()=>({uri:"onboarding://tracks",mimeType:"application/json",data:JSON.stringify(Ej.listOnboardingTracks(),null,2)})})),j.register(Nj({meta:{uriTemplate:"onboarding://track/{id}",title:"Onboarding track",description:"Track-specific onboarding metadata and recommended commands.",mimeType:"application/json",tags:E},input:C.object({id:C.string()}),resolve:async({id:Y})=>({uri:`onboarding://track/${Y}`,mimeType:"application/json",data:JSON.stringify(Ej.getOnboardingTrack(Y)??null,null,2)})})),j.register(Nj({meta:{uriTemplate:"onboarding://artifacts/{id}{?tracks,example}",title:"Rendered onboarding artifact",description:"Render AGENTS.md or USAGE.md content for the current repo.",mimeType:"text/markdown",tags:E},input:C.object({example:C.string().optional(),id:C.enum(["agent-guide","human-guide"]),tracks:C.string().optional()}),resolve:async({example:Y,id:J,tracks:Q})=>{let $=await $j({example:Y,tracks:Q});return{uri:`onboarding://artifacts/${J}`,mimeType:"text/markdown",data:J==="agent-guide"?$.guides.agentGuide:$.guides.humanGuide}}}))}function lj(j){j.register(GY({meta:{key:"cli.onboarding",version:"1.0.0",title:"Plan a ContractSpec onboarding flow",description:"Suggest the right onboarding track and artifacts for a repo.",tags:E,stability:"beta",owners:Zj},args:[{name:"goal",description:"Repository onboarding goal or focus area.",required:!1,schema:C.string().optional()}],input:C.object({goal:C.string().optional()}),render:async({goal:Y})=>[{type:"text",text:`Use onboarding://tracks and onboarding_suggestTracks-v1_0_0 before recommending repo-local ContractSpec adoption steps.${Y?` Goal: ${Y}.`:""}`},{type:"resource",uri:"onboarding://tracks",title:"Tracks"}]}))}function nj(j){let Y=o({name:"OnboardingSuggestTracksInput",fields:{example:{type:q.String_unsecure(),isOptional:!0},tracks:{type:q.String_unsecure(),isOptional:!0}}}),J=o({name:"OnboardingSuggestTracksOutput",fields:{nextCommands:{type:q.String_unsecure(),isArray:!0,isOptional:!1},primaryTrack:{type:q.String_unsecure(),isOptional:!1},reason:{type:q.String_unsecure(),isOptional:!1},tracks:{type:q.String_unsecure(),isArray:!0,isOptional:!1}}}),Q=o({name:"OnboardingRenderArtifactOutput",fields:{content:{type:q.String_unsecure(),isOptional:!1},primaryTrack:{type:q.String_unsecure(),isOptional:!1}}}),$=o({name:"OnboardingNextCommandOutput",fields:{nextCommand:{type:q.String_unsecure(),isOptional:!1},primaryTrack:{type:q.String_unsecure(),isOptional:!1}}});zj(j,Ij({meta:{key:"onboarding.suggestTracks",version:"1.0.0",stability:"stable",owners:Zj,tags:E,description:"Suggest the recommended ContractSpec onboarding tracks.",goal:"Help agents choose the right onboarding track before editing repo-local guides.",context:"Used inside the CLI MCP server."},io:{input:Y,output:J},policy:{auth:"anonymous"}}),async({example:Z,tracks:X})=>{let U=await $j({example:Z,tracks:X});return{nextCommands:U.nextCommands,primaryTrack:U.primaryTrack.id,reason:U.recommendations[0]?.reason??U.primaryTrack.summary,tracks:U.recommendations.map((V)=>V.track.id)}}),zj(j,Ij({meta:{key:"onboarding.renderArtifacts",version:"1.0.0",stability:"stable",owners:Zj,tags:E,description:"Render onboarding artifacts for the current repo.",goal:"Provide AGENTS.md or USAGE.md content without mutating the repo.",context:"Used inside the CLI MCP server."},io:{input:o({name:"OnboardingRenderArtifactInput",fields:{artifact:{type:q.String_unsecure(),isOptional:!1},example:{type:q.String_unsecure(),isOptional:!0},tracks:{type:q.String_unsecure(),isOptional:!0}}}),output:Q},policy:{auth:"anonymous"}}),async({artifact:Z,example:X,tracks:U})=>{let V=await $j({example:X,tracks:U});return{content:Z==="agent-guide"?V.guides.agentGuide:V.guides.humanGuide,primaryTrack:V.primaryTrack.id}}),zj(j,Ij({meta:{key:"onboarding.nextCommand",version:"1.0.0",stability:"stable",owners:Zj,tags:E,description:"Return the next recommended CLI command for onboarding.",goal:"Help agents choose the next onboarding command without mutating the repo.",context:"Used inside the CLI MCP server."},io:{input:Y,output:$},policy:{auth:"anonymous"}}),async({example:Z,tracks:X})=>{let U=await $j({example:Z,tracks:X});return{nextCommand:U.nextCommands[0]??"contractspec onboard",primaryTrack:U.primaryTrack.id}})}var cj=["application/json","text/event-stream"];function CY(j){return!j||j.includes("*/*")||j.includes("application/*")||cj.some((Y)=>j.includes(Y))}function kj(j){if(j.method!=="POST")return j;let Y=j.headers.get("accept");if(!CY(Y))return j;let J=cj.filter(($)=>!Y?.includes($));if(J.length===0)return j;let Q=new Headers(j.headers);return Q.set("accept",[Y,...J].filter(Boolean).join(", ")),new Request(j,{headers:Q})}import{createMcpServer as AY}from"@contractspec/lib.contracts-runtime-server-mcp/provider-mcp";import{PresentationRegistry as IY}from"@contractspec/lib.contracts-spec/presentations";import{McpServer as NY}from"@modelcontextprotocol/sdk/server/mcp.js";import{WebStandardStreamableHTTPServerTransport as zY}from"@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";import{randomUUID as EY}from"crypto";import{Elysia as kY}from"elysia";var vY={actor:"anonymous",decide:async()=>({effect:"allow"})};function vj(j,Y,J,Q){return new Response(JSON.stringify({jsonrpc:"2.0",error:{code:Y,message:J,...Q?{data:Q}:{}},id:null}),{status:j,headers:{"content-type":"application/json"}})}function ij({logger:j,serverName:Y,ops:J,resources:Q,prompts:$,presentations:Z,stateful:X}){let U=new NY({name:Y,version:"1.0.0"},{capabilities:{tools:{},resources:{},prompts:{},logging:{}}});j.info("Setting up MCP server..."),AY(U,J,Q,$,{logger:j,toolCtx:()=>vY,promptCtx:()=>({locale:"en"}),resourceCtx:()=>({locale:"en"}),presentations:new IY(Z)});let V=new zY({sessionIdGenerator:X?()=>EY():void 0,enableJsonResponse:!0});return U.connect(V).then(()=>({server:U,transport:V}))}async function Xj(j){await Promise.allSettled([j.transport.close(),j.server.close()])}function OY(j){return j instanceof Error?j.stack??j.message:String(j)}function A({logger:j,path:Y,serverName:J,ops:Q,resources:$,prompts:Z,presentations:X,validateAuth:U,requiredAuthMethods:V}){j.info("Setting up MCP handler...",{requiredAuthMethods:V??[]});let B=process.env.CONTRACTSPEC_MCP_STATEFUL==="1",H=new Map;async function K(W){let x=await ij({logger:j,path:Y,serverName:J,ops:Q,resources:$,prompts:Z,presentations:X,stateful:!1});try{return await x.transport.handleRequest(kj(W))}finally{await Xj(x)}}async function P(W){let x=H.get(W);if(!x)return;H.delete(W),await Xj(x)}async function Gj(W){let x=W.headers.get("mcp-session-id"),N,i=!1;if(x){let z=H.get(x);if(!z)return vj(404,-32001,"Session not found");N=z}else N=await ij({logger:j,path:Y,serverName:J,ops:Q,resources:$,prompts:Z,presentations:X,stateful:!0}),i=!0;try{let z=await N.transport.handleRequest(kj(W)),h=N.transport.sessionId;if(h&&!H.has(h))H.set(h,N);if(W.method==="DELETE"&&h)await P(h);else if(!h&&i)await Xj(N);return z}catch(z){if(i)await Xj(N);throw z}}return new kY({name:`mcp-${J}`}).all(Y,async({request:W})=>{try{if(U){let x=await U(W);if(!x.valid)return vj(401,-32002,"Authentication failed",x.reason)}if(B)return await Gj(W);return await K(W)}catch(x){return j.error("Error handling MCP request",{path:Y,method:W.method,error:OY(x)}),vj(500,-32000,"Internal error")}})}import RY from"node:fs/promises";import{defineCommand as hY,definePrompt as TY,defineResourceTemplate as oj,installOp as fY,OperationSpecRegistry as SY,PromptRegistry as yY,ResourceRegistry as mY}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as aj,ScalarTypeEnum as a}from"@contractspec/lib.schema";import t from"path";import T from"zod";var __dirname="/home/runner/work/contractspec/contractspec/packages/bundles/library/src/application/mcp",gY={quickstart:"packages/apps/cli-contractspec/QUICK_START.md",reference:"packages/apps/cli-contractspec/QUICK_REFERENCE.md",readme:"packages/apps/cli-contractspec/README.md"},dY={quickstart:`# ContractSpec CLI quickstart
|
|
2
2
|
|
|
3
|
-
contractspec
|
|
4
|
-
contractspec
|
|
5
|
-
contractspec validate
|
|
3
|
+
contractspec quickstart
|
|
4
|
+
contractspec onboard
|
|
5
|
+
contractspec validate`,reference:`# ContractSpec CLI reference
|
|
6
6
|
|
|
7
|
-
Key commands: create,
|
|
7
|
+
Key commands: onboard, create, generate, validate. See README for full options.`,readme:`# ContractSpec CLI
|
|
8
8
|
|
|
9
|
-
Stabilize AI-generated code across API, DB, UI, events. Use create/
|
|
10
|
-
`)},{type:"resource",uri:"contracts://list",title:"Available contracts"}]})),j}import{defineCommand as R,installOp as v,OperationSpecRegistry as AY}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as _,ScalarTypeEnum as B}from"@contractspec/lib.schema";var T=["@contractspec"],f=["contracts","mcp"];function Tj(j){let Y=new AY,J=_({name:"ContractsListInput",fields:{pattern:{type:B.String_unsecure(),isOptional:!0},type:{type:B.String_unsecure(),isOptional:!0}}}),Q=_({name:"ContractsListOutput",fields:{specs:{type:B.JSON(),isOptional:!1},total:{type:B.Int_unsecure(),isOptional:!1}}});v(Y,R({meta:{key:"contracts.list",version:"1.0.0",stability:"beta",owners:T,tags:f,description:"List contract specs in the workspace.",goal:"Discover available contracts by type, pattern, or owner.",context:"Contracts MCP server."},io:{input:J,output:Q},policy:{auth:"anonymous"}}),async({pattern:V,type:H})=>{let G=await j.listSpecs({pattern:V,type:H});return{specs:G,total:G.length}});let $=_({name:"ContractsGetInput",fields:{path:{type:B.String_unsecure(),isOptional:!1}}}),Z=_({name:"ContractsGetOutput",fields:{content:{type:B.String_unsecure(),isOptional:!1},info:{type:B.JSON(),isOptional:!1}}});v(Y,R({meta:{key:"contracts.get",version:"1.0.0",stability:"beta",owners:T,tags:f,description:"Read a single contract spec file.",goal:"Fetch spec content and parsed metadata.",context:"Contracts MCP server."},io:{input:$,output:Z},policy:{auth:"anonymous"}}),async({path:V})=>{let H=await j.getSpec(V);if(!H)throw Error(`Spec not found: ${V}`);return H});let X=_({name:"ContractsValidateInput",fields:{path:{type:B.String_unsecure(),isOptional:!1}}}),U=_({name:"ContractsValidateOutput",fields:{valid:{type:B.Boolean(),isOptional:!1},errors:{type:B.JSON(),isOptional:!1},warnings:{type:B.JSON(),isOptional:!1}}});v(Y,R({meta:{key:"contracts.validate",version:"1.0.0",stability:"beta",owners:T,tags:f,description:"Validate a contract spec structure.",goal:"Check spec for structural or policy issues.",context:"Contracts MCP server."},io:{input:X,output:U},policy:{auth:"anonymous"}}),async({path:V})=>j.validateSpec(V));let K=_({name:"ContractsBuildInput",fields:{path:{type:B.String_unsecure(),isOptional:!1},dryRun:{type:B.Boolean(),isOptional:!0}}}),P=_({name:"ContractsBuildOutput",fields:{results:{type:B.JSON(),isOptional:!1}}});return v(Y,R({meta:{key:"contracts.build",version:"1.0.0",stability:"beta",owners:T,tags:f,description:"Generate implementation code from a contract spec.",goal:"Produce handler, component, or test skeletons.",context:"Contracts MCP server."},io:{input:K,output:P},policy:{auth:"user"}}),async({path:V,dryRun:H})=>j.buildSpec(V,{dryRun:H})),CY(Y,j),Y}function CY(j,Y){let J=_({name:"ContractsUpdateInput",fields:{path:{type:B.String_unsecure(),isOptional:!1},content:{type:B.String_unsecure(),isOptional:!0},fields:{type:B.JSON(),isOptional:!0}}}),Q=_({name:"ContractsUpdateOutput",fields:{updated:{type:B.Boolean(),isOptional:!1},errors:{type:B.JSON(),isOptional:!1},warnings:{type:B.JSON(),isOptional:!1}}});v(j,R({meta:{key:"contracts.update",version:"1.0.0",stability:"beta",owners:T,tags:f,description:"Update an existing contract spec.",goal:"Modify spec content or individual fields with validation.",context:"Contracts MCP server."},io:{input:J,output:Q},policy:{auth:"user"}}),async({path:X,content:U,fields:K})=>Y.updateSpec(X,{content:U,fields:Array.isArray(K)?K:void 0}));let $=_({name:"ContractsDeleteInput",fields:{path:{type:B.String_unsecure(),isOptional:!1},clean:{type:B.Boolean(),isOptional:!0}}}),Z=_({name:"ContractsDeleteOutput",fields:{deleted:{type:B.Boolean(),isOptional:!1},cleanedFiles:{type:B.JSON(),isOptional:!1},errors:{type:B.JSON(),isOptional:!1}}});v(j,R({meta:{key:"contracts.delete",version:"1.0.0",stability:"beta",owners:T,tags:f,description:"Delete a contract spec and optionally its artifacts.",goal:"Remove a spec file and clean generated handlers/tests.",context:"Contracts MCP server."},io:{input:$,output:Z},policy:{auth:"user"}}),async({path:X,clean:U})=>Y.deleteSpec(X,{clean:U}))}function gJ(j="/api/mcp/contracts",Y){return M({logger:b,path:j,serverName:"contractspec-contracts-mcp",ops:Tj(Y),resources:Rj(Y),prompts:vj()})}import{defaultDocRegistry as IY}from"@contractspec/lib.contracts-spec/docs";var EY=20,zY=100;function q(j){return j?.trim().toLowerCase()??""}function fj(j){let Y=decodeURIComponent(j).trim();if(!Y)return"/";return Y.startsWith("/")?Y:`/${Y}`}function OY(j){return(Array.isArray(j)?j:j?[j]:[]).map((J)=>q(J)).filter(Boolean)}function kY(j){if(!j||Number.isNaN(j))return EY;return Math.min(Math.max(j,1),zY)}function RY(j){if(!j||Number.isNaN(j))return 0;return Math.max(j,0)}function _j({block:j,route:Y}){return{id:j.id,title:j.title,summary:j.summary??"",route:Y,visibility:j.visibility??"public",kind:j.kind??"reference",version:j.version??"1.0.0",tags:j.tags??[]}}function vY(j,Y){if(!Y)return 1;let J=Y.split(/\s+/).filter(Boolean),Q=q(j.block.title),$=q(j.block.id),Z=q(j.block.summary),X=q(j.block.body),U=q(j.route),K=(j.block.tags??[]).map((H)=>q(H)),P=[Q,$,Z,X,U,...K].join(" ");if(J.some((H)=>!P.includes(H)))return 0;let V=0;for(let H of J){if($.includes(H))V+=8;if(Q.includes(H))V+=7;if(K.some((G)=>G.includes(H)))V+=5;if(Z.includes(H))V+=4;if(U.includes(H))V+=3;if(X.includes(H))V+=2}return V}function h(j,Y){let J=q(typeof Y.query==="string"?Y.query:void 0),Q=OY(Y.tag),$=q(typeof Y.visibility==="string"?Y.visibility:void 0),Z=q(typeof Y.kind==="string"?Y.kind:void 0),X=kY(typeof Y.limit==="number"?Y.limit:void 0),U=RY(typeof Y.offset==="number"?Y.offset:void 0),K=j.map((H)=>({doc:_j(H),score:vY(H,J)})).filter(({doc:H,score:G})=>{let Fj=J?G>0:!0,F=Q.length?Q.every((d)=>H.tags.some((N)=>q(N).includes(d))):!0,W=$?q(H.visibility)===$:!0,D=Z?q(H.kind)===Z:!0;return Fj&&F&&W&&D}).sort((H,G)=>{if(G.score!==H.score)return G.score-H.score;return H.doc.title.localeCompare(G.doc.title)}),P=K.slice(U,U+X).map(({doc:H})=>H),V=U+P.length<K.length?U+P.length:void 0;return{docs:P,items:P,total:K.length,...V!=null?{nextOffset:V}:{}}}function jj(j){let Y=decodeURIComponent(j),J=IY.get(Y);if(!J)return;return{doc:_j(J),content:String(J.block.body??"")}}function Yj(j,Y){let J=fj(Y),Q=j.find(($)=>fj($.route)===J);if(!Q)return;return{doc:_j(Q),content:String(Q.block.body??"")}}function Jj(j){let Y=new Map,J=new Map,Q=new Map;for(let Z of j){let X=Z.block.kind??"reference",U=Z.block.visibility??"public";J.set(X,(J.get(X)??0)+1),Q.set(U,(Q.get(U)??0)+1);for(let K of Z.block.tags??[])Y.set(K,(Y.get(K)??0)+1)}let $=(Z,X)=>[...Z.entries()].sort((U,K)=>K[1]-U[1]||U[0].localeCompare(K[0])).map(([U,K])=>({[X]:U,count:K}));return{totalDocs:j.length,tags:$(Y,"tag"),kinds:$(J,"kind"),visibilities:$(Q,"visibility")}}import{EventRegistry as TY,OperationSpecRegistry as fY}from"@contractspec/lib.contracts-spec";import{DataViewRegistry as hY}from"@contractspec/lib.contracts-spec/data-views";import{ContractReferenceDataView as SY,ContractReferenceQuery as yY,DocsGenerateCommand as mY,DocsGeneratedEvent as gY,DocsIndexDataView as dY,DocsIndexQuery as uY,DocsLayoutPresentation as pY,DocsPublishCommand as lY,DocsPublishedEvent as nY,DocsReferencePagePresentation as cY,DocsSearchForm as iY,ExampleCatalogDataView as oY}from"@contractspec/lib.contracts-spec/docs";import{FormRegistry as aY}from"@contractspec/lib.contracts-spec/forms";import{PresentationRegistry as tY}from"@contractspec/lib.contracts-spec/presentations";import{serializeDataViewSpec as sY,serializeEventSpec as rY,serializeFormSpec as eY,serializeOperationSpec as j0,serializePresentationSpec as Y0}from"@contractspec/lib.contracts-spec/serialization";var Qj=null;function J0(){let j=new fY;return j.register(uY).register(yY).register(mY).register(lY),j}function Q0(){if(!Qj)Qj=J0();return Qj}function bj(j,Y){return Q0().get(j,Y)}var Zj=null;function Z0(){let j=new TY;return j.register(gY).register(nY),j}function $0(){if(!Zj)Zj=Z0();return Zj}function Mj(j,Y){return $0().get(j,Y)}var $j=null;function X0(){let j=new tY;return j.register(pY).register(cY),j}function U0(){if(!$j)$j=X0();return $j}function Dj(j,Y){return U0().get(j,Y)}var Xj=null;function V0(){let j=new hY;return j.register(dY).register(SY).register(oY),j}function H0(){if(!Xj)Xj=V0();return Xj}function Nj(j,Y){return H0().get(j,Y)}var Uj=null;function K0(){let j=new aY;return j.register(iY),j}function B0(){if(!Uj)Uj=K0();return Uj}function Aj(j,Y){return B0().get(j)}function hj(j,Y){let J=bj(j,Y);return j0(J)??void 0}function Sj(j,Y){let J=Mj(j,Y);return rY(J)??void 0}function yj(j,Y){let J=Dj(j,Y);return Y0(J)??void 0}function mj(j,Y){let J=Nj(j,Y);return sY(J)??void 0}function gj(j,Y){let J=Aj(j,Y);return eY(J)??void 0}function w0(){Qj=null}function F0(){Zj=null}function W0(){$j=null}function x0(){Xj=null}function P0(){Uj=null}function tJ(){w0(),F0(),W0(),x0(),P0()}import{defaultDocRegistry as q0}from"@contractspec/lib.contracts-spec/docs";function L0(j){return j?.trim().toLowerCase()??""}function G0(j){for(let Y of j??[]){let J=q0.get(Y);if(J)return J.route}return}function dj(j,Y,J,Q){let $=j.meta.title??j.meta.key,Z=G0(j.meta.docId),X=j.meta.description;return{key:j.meta.key,version:j.meta.version,type:Y,title:$,description:X,markdown:[`# ${$}`,`- Key: ${j.meta.key}`,`- Type: ${Y}`,`- Version: ${j.meta.version}`,Z?`- Docs route: ${Z}`:"",X?`
|
|
9
|
+
Stabilize AI-generated code across API, DB, UI, events. Use onboard/create/generate/validate commands.`},Vj=["cli","mcp"],tj=["@contractspec"],uY=(()=>{let j=new Set([process.cwd(),t.resolve(process.cwd(),".."),t.resolve(process.cwd(),"../.."),t.resolve(process.cwd(),"../../..")]);if(typeof __dirname==="string")j.add(t.resolve(__dirname,"../../../../.."));return[...j]})(),Uj=new Map;async function pY(j){if(Uj.has(j))return Uj.get(j);let Y=gY[j];for(let Q of uY){let $=t.resolve(Q,Y);try{let Z=await RY.readFile($,"utf8");return Uj.set(j,Z),Z}catch{}}let J=dY[j];return Uj.set(j,J),J}function lY(){let j=new mY;return j.register(oj({meta:{uriTemplate:"cli://doc/{slug}",title:"CLI documentation",description:"Quickstart, reference, and README for the CLI.",mimeType:"text/markdown",tags:Vj},input:T.object({slug:T.enum(["quickstart","reference","readme"])}),resolve:async({slug:Y})=>{let J=await pY(Y);return{uri:`cli://doc/${Y}`,mimeType:"text/markdown",data:J}}})),j.register(oj({meta:{uriTemplate:"cli://commands",title:"CLI commands summary",description:"Key ContractSpec CLI commands and when to use them.",mimeType:"application/json",tags:Vj},input:T.object({}),resolve:async()=>{return{uri:"cli://commands",mimeType:"application/json",data:JSON.stringify([{command:"contractspec onboard",summary:"Generate repo-local AGENTS.md and USAGE.md guidance plus recommended tracks.",doc:"cli://doc/quickstart"},{command:"contractspec create",summary:"Interactive wizard to author specs (with optional AI).",doc:"cli://doc/quickstart"},{command:"contractspec build <specPath>",summary:"Generate implementation code from a ContractSpec (agents + templates).",doc:"cli://doc/reference"},{command:"contractspec validate <specPath>",summary:"Validate specs and optionally check implementations against them.",doc:"cli://doc/reference"}],null,2)}}})),pj(j),j}function nY(){let j=new yY;return j.register(TY({meta:{key:"cli.usage",version:"1.0.0",title:"Use ContractSpec CLI safely",description:"Remind agents to read CLI docs and pick commands from the canonical list.",tags:Vj,stability:"beta",owners:tj},args:[{name:"goal",description:"Task the user wants to achieve.",required:!1,schema:T.string().optional()}],input:T.object({goal:T.string().optional()}),render:async({goal:Y})=>[{type:"text",text:`Use CLI commands only from cli://commands. Prefer quickstart for newcomers and reference for options.${Y?` Goal: ${Y}.`:""}`},{type:"resource",uri:"cli://commands",title:"Commands"},{type:"resource",uri:"cli://doc/quickstart",title:"Quickstart"}]})),lj(j),j}function cY(){let j=new SY,Y=aj({name:"CliSuggestInput",fields:{goal:{type:a.String_unsecure(),isOptional:!1},prefersAi:{type:a.Boolean(),isOptional:!0}}}),J=aj({name:"CliSuggestOutput",fields:{command:{type:a.String_unsecure(),isOptional:!1},docUri:{type:a.String_unsecure(),isOptional:!1},reason:{type:a.String_unsecure(),isOptional:!1}}}),Q=hY({meta:{key:"cli_suggestCommand",version:"1.0.0",stability:"stable",owners:tj,tags:Vj,description:"Recommend a CLI command for the requested goal.",goal:"Help AI agents choose the correct CLI entrypoint quickly.",context:"Used inside the CLI MCP server."},io:{input:Y,output:J},policy:{auth:"anonymous"}});return fY(j,Q,async({goal:$,prefersAi:Z})=>{let X=$.toLowerCase();if(X.includes("onboard")||X.includes("start")||X.includes("guide")||X.includes("install"))return{command:"contractspec onboard",docUri:"cli://doc/quickstart",reason:"Starts the CLI-first onboarding flow for the current repo."};if(X.includes("create")||X.includes("new"))return{command:Z?"contractspec create --ai":"contractspec create",docUri:"cli://doc/quickstart",reason:"Creates a new ContractSpec interactively (optionally with AI)."};if(X.includes("build")||X.includes("generate"))return{command:"contractspec build <path-to-spec>",docUri:"cli://doc/reference",reason:"Builds implementation code from a spec using agents + templates."};if(X.includes("validate")||X.includes("check"))return{command:"contractspec validate <path-to-spec>",docUri:"cli://doc/reference",reason:"Validates a spec and optionally checks its implementation for drift."};return{command:"contractspec --help",docUri:"cli://doc/readme",reason:"Fallback when the goal is unclear; read README for options."}}),nj(j),j}function HQ(j="/api/mcp/cli"){return A({logger:D,path:j,serverName:"contractspec-cli-mcp",ops:cY(),resources:lY(),prompts:nY()})}import{definePrompt as iY,defineResourceTemplate as s,PromptRegistry as oY,ResourceRegistry as aY}from"@contractspec/lib.contracts-spec";import I from"zod";var tY=["@contractspec"],f=["contracts","mcp"];function sj(j){let Y=new aY;return Y.register(s({meta:{uriTemplate:"contracts://list",title:"Contract specs list",description:"JSON list of all contract specs in the workspace.",mimeType:"application/json",tags:f},input:I.object({}),resolve:async()=>{let J=await j.listSpecs();return{uri:"contracts://list",mimeType:"application/json",data:JSON.stringify(J,null,2)}}})),Y.register(s({meta:{uriTemplate:"contracts://spec/{path}",title:"Contract spec content",description:"Read a single contract spec file by path.",mimeType:"text/plain",tags:f},input:I.object({path:I.string()}),resolve:async({path:J})=>{let Q=await j.getSpec(J);if(!Q)return{uri:`contracts://spec/${encodeURIComponent(J)}`,mimeType:"text/plain",data:`Spec not found: ${J}`};return{uri:`contracts://spec/${encodeURIComponent(J)}`,mimeType:"text/plain",data:Q.content}}})),Y.register(s({meta:{uriTemplate:"contracts://registry/manifest",title:"Remote registry manifest",description:"Contract registry manifest from the remote server.",mimeType:"application/json",tags:f},input:I.object({}),resolve:async()=>{let J=await j.fetchRegistryManifest();return{uri:"contracts://registry/manifest",mimeType:"application/json",data:JSON.stringify(J,null,2)}}})),Y.register(s({meta:{uriTemplate:"adoption://catalog",title:"ContractSpec adoption catalog",description:"Bundled ContractSpec adoption catalog used by Connect and MCP.",mimeType:"application/json",tags:f},input:I.object({}),resolve:async()=>{let J=await j.searchAdoptionCatalog({query:"contractspec"});return{uri:"adoption://catalog",mimeType:"application/json",data:JSON.stringify(J,null,2)}}})),Y.register(s({meta:{uriTemplate:"adoption://policy/{family}",title:"ContractSpec adoption policy",description:"Family-aware adoption recommendation and verdict policy.",mimeType:"application/json",tags:f},input:I.object({family:I.string()}),resolve:async({family:J})=>{let Q=await j.resolveAdoption({family:J,query:J});return{uri:`adoption://policy/${encodeURIComponent(J)}`,mimeType:"application/json",data:JSON.stringify(Q,null,2)}}})),Y}function rj(){let j=new oY;return j.register(iY({meta:{key:"contracts.editor",version:"1.0.0",title:"Contract editing guide",description:"Guide AI agents through reading, editing, and validating contracts.",tags:f,stability:"beta",owners:tY},args:[{name:"goal",description:"What the agent wants to achieve with the contract.",required:!1,schema:I.string().optional()}],input:I.object({goal:I.string().optional()}),render:async({goal:Y})=>[{type:"text",text:["Contract editing workflow:","1. Use contracts.list to discover specs","2. Use contracts.get to read a spec","3. Edit content and call contracts.update","4. Run contracts.validate to verify changes","5. Run contracts.build to regenerate artifacts","6. Use adoption.resolve to prefer existing workspace or ContractSpec surfaces before inventing new ones",Y?`Agent goal: ${Y}`:""].filter(Boolean).join(`
|
|
10
|
+
`)},{type:"resource",uri:"contracts://list",title:"Available contracts"}]})),j}import{defineCommand as Oj,installOp as Rj}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as S,ScalarTypeEnum as b}from"@contractspec/lib.schema";var hj=["@contractspec"],Tj=["contracts","mcp","adoption"];function ej(j,Y){let J=S({name:"AdoptionCatalogSearchInput",fields:{query:{type:b.String_unsecure(),isOptional:!1},family:{type:b.String_unsecure(),isOptional:!0},platform:{type:b.String_unsecure(),isOptional:!0}}}),Q=S({name:"AdoptionCatalogSearchOutput",fields:{results:{type:b.JSON(),isOptional:!1}}});Rj(j,Oj({meta:{key:"adoption.catalog_search",version:"1.0.0",stability:"beta",owners:hj,tags:Tj,description:"Search the local ContractSpec adoption catalog.",goal:"Find relevant ContractSpec reuse candidates for a query.",context:"Contracts MCP server."},io:{input:J,output:Q},policy:{auth:"anonymous"}}),async({family:V,platform:B,query:H})=>({results:await Y.searchAdoptionCatalog({family:V,platform:B,query:H})}));let $=S({name:"AdoptionResolveInput",fields:{family:{type:b.String_unsecure(),isOptional:!1},query:{type:b.String_unsecure(),isOptional:!1},paths:{type:b.JSON(),isOptional:!0},platform:{type:b.String_unsecure(),isOptional:!0},runtime:{type:b.String_unsecure(),isOptional:!0}}}),Z=S({name:"AdoptionResolveOutput",fields:{resolution:{type:b.JSON(),isOptional:!1}}});Rj(j,Oj({meta:{key:"adoption.resolve",version:"1.0.0",stability:"beta",owners:hj,tags:Tj,description:"Resolve the best adoption candidate for one family.",goal:"Provide one ordered recommendation that matches Connect.",context:"Contracts MCP server."},io:{input:$,output:Z},policy:{auth:"anonymous"}}),async({family:V,paths:B,platform:H,query:K,runtime:P})=>({resolution:await Y.resolveAdoption({family:V,paths:Array.isArray(B)?B:void 0,platform:H,query:K,runtime:P})}));let X=S({name:"AdoptionSyncInput",fields:{}}),U=S({name:"AdoptionSyncOutput",fields:{catalogPath:{type:b.String_unsecure(),isOptional:!1},total:{type:b.Int_unsecure(),isOptional:!1}}});Rj(j,Oj({meta:{key:"adoption.sync",version:"1.0.0",stability:"beta",owners:hj,tags:Tj,description:"Mirror the bundled ContractSpec adoption catalog locally.",goal:"Refresh the local adoption catalog used by Connect and MCP.",context:"Contracts MCP server."},io:{input:X,output:U},policy:{auth:"user"}}),async()=>Y.syncAdoptionCatalog())}import{defineCommand as y,installOp as m,OperationSpecRegistry as sY}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as G,ScalarTypeEnum as w}from"@contractspec/lib.schema";var g=["@contractspec"],d=["contracts","mcp"];function jY(j){let Y=new sY,J=G({name:"ContractsListInput",fields:{pattern:{type:w.String_unsecure(),isOptional:!0},type:{type:w.String_unsecure(),isOptional:!0}}}),Q=G({name:"ContractsListOutput",fields:{specs:{type:w.JSON(),isOptional:!1},total:{type:w.Int_unsecure(),isOptional:!1}}});m(Y,y({meta:{key:"contracts.list",version:"1.0.0",stability:"beta",owners:g,tags:d,description:"List contract specs in the workspace.",goal:"Discover available contracts by type, pattern, or owner.",context:"Contracts MCP server."},io:{input:J,output:Q},policy:{auth:"anonymous"}}),async({pattern:H,type:K})=>{let P=await j.listSpecs({pattern:H,type:K});return{specs:P,total:P.length}});let $=G({name:"ContractsGetInput",fields:{path:{type:w.String_unsecure(),isOptional:!1}}}),Z=G({name:"ContractsGetOutput",fields:{content:{type:w.String_unsecure(),isOptional:!1},info:{type:w.JSON(),isOptional:!1}}});m(Y,y({meta:{key:"contracts.get",version:"1.0.0",stability:"beta",owners:g,tags:d,description:"Read a single contract spec file.",goal:"Fetch spec content and parsed metadata.",context:"Contracts MCP server."},io:{input:$,output:Z},policy:{auth:"anonymous"}}),async({path:H})=>{let K=await j.getSpec(H);if(!K)throw Error(`Spec not found: ${H}`);return K});let X=G({name:"ContractsValidateInput",fields:{path:{type:w.String_unsecure(),isOptional:!1}}}),U=G({name:"ContractsValidateOutput",fields:{valid:{type:w.Boolean(),isOptional:!1},errors:{type:w.JSON(),isOptional:!1},warnings:{type:w.JSON(),isOptional:!1}}});m(Y,y({meta:{key:"contracts.validate",version:"1.0.0",stability:"beta",owners:g,tags:d,description:"Validate a contract spec structure.",goal:"Check spec for structural or policy issues.",context:"Contracts MCP server."},io:{input:X,output:U},policy:{auth:"anonymous"}}),async({path:H})=>j.validateSpec(H));let V=G({name:"ContractsBuildInput",fields:{path:{type:w.String_unsecure(),isOptional:!1},dryRun:{type:w.Boolean(),isOptional:!0}}}),B=G({name:"ContractsBuildOutput",fields:{results:{type:w.JSON(),isOptional:!1}}});return m(Y,y({meta:{key:"contracts.build",version:"1.0.0",stability:"beta",owners:g,tags:d,description:"Generate implementation code from a contract spec.",goal:"Produce handler, component, or test skeletons.",context:"Contracts MCP server."},io:{input:V,output:B},policy:{auth:"user"}}),async({path:H,dryRun:K})=>j.buildSpec(H,{dryRun:K})),rY(Y,j),ej(Y,j),Y}function rY(j,Y){let J=G({name:"ContractsUpdateInput",fields:{path:{type:w.String_unsecure(),isOptional:!1},content:{type:w.String_unsecure(),isOptional:!0},fields:{type:w.JSON(),isOptional:!0}}}),Q=G({name:"ContractsUpdateOutput",fields:{updated:{type:w.Boolean(),isOptional:!1},errors:{type:w.JSON(),isOptional:!1},warnings:{type:w.JSON(),isOptional:!1}}});m(j,y({meta:{key:"contracts.update",version:"1.0.0",stability:"beta",owners:g,tags:d,description:"Update an existing contract spec.",goal:"Modify spec content or individual fields with validation.",context:"Contracts MCP server."},io:{input:J,output:Q},policy:{auth:"user"}}),async({path:X,content:U,fields:V})=>Y.updateSpec(X,{content:U,fields:Array.isArray(V)?V:void 0}));let $=G({name:"ContractsDeleteInput",fields:{path:{type:w.String_unsecure(),isOptional:!1},clean:{type:w.Boolean(),isOptional:!0}}}),Z=G({name:"ContractsDeleteOutput",fields:{deleted:{type:w.Boolean(),isOptional:!1},cleanedFiles:{type:w.JSON(),isOptional:!1},errors:{type:w.JSON(),isOptional:!1}}});m(j,y({meta:{key:"contracts.delete",version:"1.0.0",stability:"beta",owners:g,tags:d,description:"Delete a contract spec and optionally its artifacts.",goal:"Remove a spec file and clean generated handlers/tests.",context:"Contracts MCP server."},io:{input:$,output:Z},policy:{auth:"user"}}),async({path:X,clean:U})=>Y.deleteSpec(X,{clean:U}))}function AQ(j="/api/mcp/contracts",Y){return A({logger:D,path:j,serverName:"contractspec-contracts-mcp",ops:jY(Y),resources:sj(Y),prompts:rj()})}import{defaultDocRegistry as eY}from"@contractspec/lib.contracts-spec/docs";var j0=20,Y0=100;function _(j){return j?.trim().toLowerCase()??""}function YY(j){let Y=decodeURIComponent(j).trim();if(!Y)return"/";return Y.startsWith("/")?Y:`/${Y}`}function J0(j){return(Array.isArray(j)?j:j?[j]:[]).map((J)=>_(J)).filter(Boolean)}function Q0(j){if(!j||Number.isNaN(j))return j0;return Math.min(Math.max(j,1),Y0)}function Z0(j){if(!j||Number.isNaN(j))return 0;return Math.max(j,0)}function fj({block:j,route:Y}){return{id:j.id,title:j.title,summary:j.summary??"",route:Y,visibility:j.visibility??"public",kind:j.kind??"reference",version:j.version??"1.0.0",tags:j.tags??[]}}function $0(j,Y){if(!Y)return 1;let J=Y.split(/\s+/).filter(Boolean),Q=_(j.block.title),$=_(j.block.id),Z=_(j.block.summary),X=_(j.block.body),U=_(j.route),V=(j.block.tags??[]).map((K)=>_(K)),B=[Q,$,Z,X,U,...V].join(" ");if(J.some((K)=>!B.includes(K)))return 0;let H=0;for(let K of J){if($.includes(K))H+=8;if(Q.includes(K))H+=7;if(V.some((P)=>P.includes(K)))H+=5;if(Z.includes(K))H+=4;if(U.includes(K))H+=3;if(X.includes(K))H+=2}return H}function u(j,Y){let J=_(typeof Y.query==="string"?Y.query:void 0),Q=J0(Y.tag),$=_(typeof Y.visibility==="string"?Y.visibility:void 0),Z=_(typeof Y.kind==="string"?Y.kind:void 0),X=Q0(typeof Y.limit==="number"?Y.limit:void 0),U=Z0(typeof Y.offset==="number"?Y.offset:void 0),V=j.map((K)=>({doc:fj(K),score:$0(K,J)})).filter(({doc:K,score:P})=>{let Gj=J?P>0:!0,W=Q.length?Q.every((i)=>K.tags.some((z)=>_(z).includes(i))):!0,x=$?_(K.visibility)===$:!0,N=Z?_(K.kind)===Z:!0;return Gj&&W&&x&&N}).sort((K,P)=>{if(P.score!==K.score)return P.score-K.score;return K.doc.title.localeCompare(P.doc.title)}),B=V.slice(U,U+X).map(({doc:K})=>K),H=U+B.length<V.length?U+B.length:void 0;return{docs:B,items:B,total:V.length,...H!=null?{nextOffset:H}:{}}}function Hj(j){let Y=decodeURIComponent(j),J=eY.get(Y);if(!J)return;return{doc:fj(J),content:String(J.block.body??"")}}function Kj(j,Y){let J=YY(Y),Q=j.find(($)=>YY($.route)===J);if(!Q)return;return{doc:fj(Q),content:String(Q.block.body??"")}}function wj(j){let Y=new Map,J=new Map,Q=new Map;for(let Z of j){let X=Z.block.kind??"reference",U=Z.block.visibility??"public";J.set(X,(J.get(X)??0)+1),Q.set(U,(Q.get(U)??0)+1);for(let V of Z.block.tags??[])Y.set(V,(Y.get(V)??0)+1)}let $=(Z,X)=>[...Z.entries()].sort((U,V)=>V[1]-U[1]||U[0].localeCompare(V[0])).map(([U,V])=>({[X]:U,count:V}));return{totalDocs:j.length,tags:$(Y,"tag"),kinds:$(J,"kind"),visibilities:$(Q,"visibility")}}import{EventRegistry as X0,OperationSpecRegistry as U0}from"@contractspec/lib.contracts-spec";import{DataViewRegistry as V0}from"@contractspec/lib.contracts-spec/data-views";import{ContractReferenceDataView as H0,ContractReferenceQuery as K0,DocsGenerateCommand as w0,DocsGeneratedEvent as F0,DocsIndexDataView as B0,DocsIndexQuery as W0,DocsLayoutPresentation as x0,DocsPublishCommand as P0,DocsPublishedEvent as L0,DocsReferencePagePresentation as q0,DocsSearchForm as _0,ExampleCatalogDataView as M0}from"@contractspec/lib.contracts-spec/docs";import{FormRegistry as b0}from"@contractspec/lib.contracts-spec/forms";import{PresentationRegistry as G0}from"@contractspec/lib.contracts-spec/presentations";import{serializeDataViewSpec as D0,serializeEventSpec as C0,serializeFormSpec as A0,serializeOperationSpec as I0,serializePresentationSpec as N0}from"@contractspec/lib.contracts-spec/serialization";var Fj=null;function z0(){let j=new U0;return j.register(W0).register(K0).register(w0).register(P0),j}function E0(){if(!Fj)Fj=z0();return Fj}function Sj(j,Y){return E0().get(j,Y)}var Bj=null;function k0(){let j=new X0;return j.register(F0).register(L0),j}function v0(){if(!Bj)Bj=k0();return Bj}function yj(j,Y){return v0().get(j,Y)}var Wj=null;function O0(){let j=new G0;return j.register(x0).register(q0),j}function R0(){if(!Wj)Wj=O0();return Wj}function mj(j,Y){return R0().get(j,Y)}var xj=null;function h0(){let j=new V0;return j.register(B0).register(H0).register(M0),j}function T0(){if(!xj)xj=h0();return xj}function gj(j,Y){return T0().get(j,Y)}var Pj=null;function f0(){let j=new b0;return j.register(_0),j}function S0(){if(!Pj)Pj=f0();return Pj}function dj(j,Y){return S0().get(j)}function JY(j,Y){let J=Sj(j,Y);return I0(J)??void 0}function QY(j,Y){let J=yj(j,Y);return C0(J)??void 0}function ZY(j,Y){let J=mj(j,Y);return N0(J)??void 0}function $Y(j,Y){let J=gj(j,Y);return D0(J)??void 0}function XY(j,Y){let J=dj(j,Y);return A0(J)??void 0}function y0(){Fj=null}function m0(){Bj=null}function g0(){Wj=null}function d0(){xj=null}function u0(){Pj=null}function TQ(){y0(),m0(),g0(),d0(),u0()}import{defaultDocRegistry as p0}from"@contractspec/lib.contracts-spec/docs";function l0(j){return j?.trim().toLowerCase()??""}function n0(j){for(let Y of j??[]){let J=p0.get(Y);if(J)return J.route}return}function UY(j,Y,J,Q){let $=j.meta.title??j.meta.key,Z=n0(j.meta.docId),X=j.meta.description;return{key:j.meta.key,version:j.meta.version,type:Y,title:$,description:X,markdown:[`# ${$}`,`- Key: ${j.meta.key}`,`- Type: ${Y}`,`- Version: ${j.meta.version}`,Z?`- Docs route: ${Z}`:"",X?`
|
|
11
11
|
${X}`:""].filter(Boolean).join(`
|
|
12
|
-
`),...Z?{route:Z}:{},...J?{schema:J}:{},...Q?{policy:Q}:{},tags:j.meta.tags??[],owners:j.meta.owners??[],stability:j.meta.stability}}function
|
|
12
|
+
`),...Z?{route:Z}:{},...J?{schema:J}:{},...Q?{policy:Q}:{},tags:j.meta.tags??[],owners:j.meta.owners??[],stability:j.meta.stability}}function p(j){let Y=j.includeSchema??!1,J=l0(j.type),Q=Sj(j.key,j.version);if(Q&&(!J||J==="operation"||J===Q.meta.kind))return{reference:UY(Q,Q.meta.kind,Y?JY(j.key,j.version):void 0,Q.policy)};let $=[{type:"data-view",spec:gj(j.key,j.version),schema:Y?$Y(j.key,j.version):void 0},{type:"form",spec:dj(j.key,j.version),schema:Y?XY(j.key,j.version):void 0},{type:"presentation",spec:mj(j.key,j.version),schema:Y?ZY(j.key,j.version):void 0},{type:"event",spec:yj(j.key,j.version),schema:Y?QY(j.key,j.version):void 0}];for(let Z of $)if(Z.spec&&(!J||J===Z.type))return{reference:UY(Z.spec,Z.type,Z.schema)};throw Error(`Contract reference not found: ${j.key}`)}import{definePrompt as VY,PromptRegistry as c0}from"@contractspec/lib.contracts-spec";import L from"zod";var HY=["@contractspec"],KY=["docs","mcp"];function wY(j){let Y=new c0;return Y.register(VY({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:KY,stability:"beta",owners:HY},args:[{name:"topic",description:"Goal or subject to search for.",required:!1,schema:L.string().optional()},{name:"kind",description:"Optional doc kind filter.",required:!1,schema:L.string().optional()},{name:"tag",description:"Optional tag filter.",required:!1,schema:L.string().optional()}],input:L.object({topic:L.string().optional(),kind:L.string().optional(),tag:L.string().optional()}),render:async({topic:J,kind:Q,tag:$})=>{let Z=u(j,{query:J,kind:Q,tag:$,limit:3}),X=Z.docs.length?Z.docs.map((U)=>`- ${U.title} (${U.id}) -> ${U.route}`).join(`
|
|
13
13
|
`):"- 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.",J?`Topic: ${J}`:"",Q?`Kind: ${Q}`:"",$?`Tag: ${$}`:"","Suggested starting docs:",X].filter(Boolean).join(`
|
|
14
|
-
`)},{type:"resource",uri:"docs://index",title:"DocBlocks index"},{type:"resource",uri:"docs://facets",title:"Docs facets"}]}})),Y.register(
|
|
15
|
-
`)},{type:"resource",uri:`docs://contract-reference/${encodeURIComponent(J)}`,title:"Contract reference"}]}})),Y}import{defineResourceTemplate as
|
|
16
|
-
`)})})),j}function
|
|
14
|
+
`)},{type:"resource",uri:"docs://index",title:"DocBlocks index"},{type:"resource",uri:"docs://facets",title:"Docs facets"}]}})),Y.register(VY({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:KY,stability:"beta",owners:HY},args:[{name:"key",description:"ContractSpec key to resolve.",required:!0,schema:L.string()},{name:"version",description:"Optional version override.",required:!1,schema:L.string().optional()},{name:"type",description:"Optional surface type: command, query, form, data-view, presentation, event.",required:!1,schema:L.string().optional()}],input:L.object({key:L.string(),version:L.string().optional(),type:L.string().optional()}),render:async({key:J,version:Q,type:$})=>{let Z=p({key:J,version:Q,type:$,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: ${Z.key}`,`Resolved type: ${Z.type}`,Z.route?`Docs route: ${Z.route}`:"",`Resource URI: docs://contract-reference/${encodeURIComponent(J)}`].filter(Boolean).join(`
|
|
15
|
+
`)},{type:"resource",uri:`docs://contract-reference/${encodeURIComponent(J)}`,title:"Contract reference"}]}})),Y}import{defineResourceTemplate as k,ResourceRegistry as i0}from"@contractspec/lib.contracts-spec";import F from"zod";var v=["docs","mcp"];function FY(j){let Y=new i0,J=(Q)=>u(j,Q);return Y.register(k({meta:{uriTemplate:"docs://index",title:"DocBlocks index",description:"Default ContractSpec docs index resource.",mimeType:"application/json",tags:v},input:F.object({}),resolve:async()=>({uri:"docs://index",mimeType:"application/json",data:JSON.stringify(J({}),null,2)})})),Y.register(k({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:v},input:F.object({query:F.string().optional(),tag:F.string().optional(),kind:F.string().optional(),visibility:F.string().optional(),limit:F.coerce.number().optional(),offset:F.coerce.number().optional()}),resolve:async(Q)=>({uri:"docs://index",mimeType:"application/json",data:JSON.stringify(J(Q),null,2)})})),Y.register(k({meta:{uriTemplate:"docs://list",title:"DocBlocks index (legacy alias)",description:"Compatibility alias for the docs index resource.",mimeType:"application/json",tags:v},input:F.object({}),resolve:async()=>({uri:"docs://list",mimeType:"application/json",data:JSON.stringify(J({}),null,2)})})),Y.register(k({meta:{uriTemplate:"docs://doc/{id}",title:"Doc markdown",description:"Fetch a single DocBlock body by id as markdown.",mimeType:"text/markdown",tags:v},input:F.object({id:F.string()}),resolve:async({id:Q})=>{let $=Hj(Q);if(!$)return{uri:`docs://doc/${encodeURIComponent(Q)}`,mimeType:"text/plain",data:`DocBlock not found: ${Q}`};return{uri:`docs://doc/${encodeURIComponent(Q)}`,mimeType:"text/markdown",data:$.content}}})),Y.register(k({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:v},input:F.object({routePath:F.string()}),resolve:async({routePath:Q})=>({uri:`docs://route/${encodeURIComponent(Q)}`,mimeType:"application/json",data:JSON.stringify(Kj(j,Q)??{error:"not_found",route:Q},null,2)})})),Y.register(k({meta:{uriTemplate:"docs://facets",title:"Docs facets",description:"Counts of available tags, kinds, and visibilities across docs.",mimeType:"application/json",tags:v},input:F.object({}),resolve:async()=>({uri:"docs://facets",mimeType:"application/json",data:JSON.stringify(wj(j),null,2)})})),Y.register(k({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:v},input:F.object({key:F.string(),version:F.string().optional(),type:F.string().optional(),includeSchema:F.coerce.boolean().optional()}),resolve:async({key:Q,version:$,type:Z,includeSchema:X})=>({uri:`docs://contract-reference/${encodeURIComponent(Q)}`,mimeType:"application/json",data:JSON.stringify(p({key:Q,version:$,type:Z,includeSchema:X}),null,2)})})),Y}import{defineCommand as r,defineSchemaModel as l,installOp as e,OperationSpecRegistry as o0}from"@contractspec/lib.contracts-spec";import{ContractReferenceInput as a0,ContractReferenceOutput as t0,DocsIndexInput as s0,DocsIndexOutput as r0}from"@contractspec/lib.contracts-spec/docs";import{ScalarTypeEnum as O}from"@contractspec/lib.schema";var jj=["@contractspec"],Yj=["docs","mcp"],e0=l({name:"DocsGetInput",fields:{id:{type:O.String_unsecure(),isOptional:!1}}}),jJ=l({name:"DocsGetOutput",fields:{doc:{type:O.JSON(),isOptional:!1},content:{type:O.String_unsecure(),isOptional:!1}}}),YJ=l({name:"DocsResolveRouteInput",fields:{route:{type:O.String_unsecure(),isOptional:!1}}}),JJ=l({name:"DocsResolveRouteOutput",fields:{doc:{type:O.JSON(),isOptional:!1},content:{type:O.String_unsecure(),isOptional:!1}}}),QJ=l({name:"DocsFacetsInput",fields:{}}),ZJ=l({name:"DocsFacetsOutput",fields:{facets:{type:O.JSON(),isOptional:!1}}});function BY(j){let Y=new o0;return e(Y,r({meta:{key:"docs.search",version:"1.0.0",stability:"beta",owners:jj,tags:Yj,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:s0,output:r0},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_search-v1_0_0"}}}),async(J)=>u(j,J)),e(Y,r({meta:{key:"docs.get",version:"1.0.0",stability:"beta",owners:jj,tags:Yj,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:e0,output:jJ},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_get-v1_0_0"}}}),async({id:J})=>{let Q=Hj(J);if(!Q)throw Error(`DocBlock not found: ${J}`);return Q}),e(Y,r({meta:{key:"docs.resolveRoute",version:"1.0.0",stability:"beta",owners:jj,tags:Yj,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:YJ,output:JJ},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_resolve_route-v1_0_0"}}}),async({route:J})=>{let Q=Kj(j,J);if(!Q)throw Error(`Doc route not found: ${J}`);return Q}),e(Y,r({meta:{key:"docs.contract.lookup",version:"1.0.0",stability:"beta",owners:jj,tags:Yj,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:a0,output:t0},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_contract_reference-v1_0_0"}}}),async(J)=>p(J)),e(Y,r({meta:{key:"docs.list.facets",version:"1.0.0",stability:"beta",owners:jj,tags:Yj,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:QJ,output:ZJ},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_list_facets-v1_0_0"}}}),async()=>({facets:wj(j)})),Y}import{defaultDocRegistry as $J}from"@contractspec/lib.contracts-spec/docs";function VZ(j="/api/mcp/docs",Y={}){let J=$J.list();return A({logger:D,path:j,serverName:"contractspec-docs-mcp",ops:BY(J),resources:FY(J),prompts:wY(J),presentations:Y.includePresentations?J.map(({descriptor:Q})=>Q):void 0})}import{defineCommand as XJ,definePrompt as UJ,defineResourceTemplate as Lj,installOp as VJ,OperationSpecRegistry as HJ,PromptRegistry as KJ,ResourceRegistry as wJ}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as WY,ScalarTypeEnum as xY}from"@contractspec/lib.schema";import{getExample as FJ,listExamples as BJ,searchExamples as WJ}from"@contractspec/module.examples";import R from"zod";var n=["internal","mcp"],PY=["@contractspec"],Jj={docs:"/api/mcp/docs",cli:"/api/mcp/cli",internal:"/api/mcp/internal",graphql:"/graphql",health:"/health"};function xJ(){let j=new wJ;return j.register(Lj({meta:{uriTemplate:"examples://list{?q}",title:"ContractSpec examples registry",description:"List available examples (templates, integrations, knowledge, scripts). Optional query `q` filters results.",mimeType:"application/json",tags:["examples",...n]},input:R.object({q:R.string().optional()}),resolve:async({q:Y})=>{let J=Y?WJ(Y):[...BJ()];return{uri:Y?`examples://list?q=${encodeURIComponent(Y)}`:"examples://list",mimeType:"application/json",data:JSON.stringify(J,null,2)}}})),j.register(Lj({meta:{uriTemplate:"examples://example/{id}",title:"ContractSpec example (by id)",description:"Fetch a single example manifest by id.",mimeType:"application/json",tags:["examples",...n]},input:R.object({id:R.string().min(1)}),resolve:async({id:Y})=>{let J=FJ(Y);if(!J)return{uri:`examples://example/${encodeURIComponent(Y)}`,mimeType:"application/json",data:JSON.stringify({error:"not_found",id:Y,message:`Unknown example id: ${Y}`},null,2)};return{uri:`examples://example/${encodeURIComponent(Y)}`,mimeType:"application/json",data:JSON.stringify(J,null,2)}}})),j.register(Lj({meta:{uriTemplate:"internal://endpoints",title:"ContractSpec MCP endpoints",description:"Endpoints for docs, CLI, internal MCP servers.",mimeType:"application/json",tags:n},input:R.object({}),resolve:async()=>({uri:"internal://endpoints",mimeType:"application/json",data:JSON.stringify(Jj,null,2)})})),j.register(Lj({meta:{uriTemplate:"internal://playbook",title:"Internal MCP usage playbook",description:"How internal agents should discover docs, CLI usage, and endpoints.",mimeType:"text/markdown",tags:n},input:R.object({}),resolve:async()=>({uri:"internal://playbook",mimeType:"text/markdown",data:["# Internal MCP playbook","- Connect to docs MCP first for canonical specs.","- Use CLI MCP to surface quickstart/reference before running commands.","- Keep calls read-only unless explicitly approved.",`- Endpoints: ${Jj.docs}, ${Jj.cli}, ${Jj.internal}.`,"- For API work, GraphQL at /graphql; health at /health."].join(`
|
|
16
|
+
`)})})),j}function PJ(){let j=new KJ;return j.register(UJ({meta:{key:"internal_bootstrap",version:"1.0.0",title:"Bootstrap internal ContractSpec agent",description:"Points agents to the correct MCP endpoints and guardrails.",tags:n,owners:PY,stability:"beta"},args:[],input:R.object({}),render:async()=>[{type:"text",text:"Start with internal://endpoints to pick the right MCP. Use docs MCP for specifications and CLI MCP for commands. Keep actions read-only unless explicitly approved."},{type:"resource",uri:"internal://endpoints",title:"Endpoints"}]})),j}function LJ(){let j=new HJ,Y=WY({name:"InternalDescribeOutput",fields:{endpoints:{type:xY.JSONObject(),isOptional:!1},notes:{type:xY.String_unsecure(),isOptional:!1}}}),J=XJ({meta:{key:"internal_describe",version:"1.0.0",stability:"stable",owners:PY,tags:n,description:"Return MCP endpoints and guidance for internal ContractSpec agents.",goal:"Speed up internal development with the correct MCP entrypoints.",context:"Used by internal MCP surface; read-only."},io:{input:WY({name:"InternalDescribeInput",fields:{}}),output:Y},policy:{auth:"anonymous"}});return VJ(j,J,async()=>({endpoints:Jj,notes:"Use docs MCP for canonical specs, CLI MCP for contractspec commands, and keep side-effecting actions gated behind human review."})),j}function PZ(j="/api/mcp/internal"){return A({logger:D,path:j,serverName:"contractspec-internal-mcp",ops:LJ(),resources:xJ(),prompts:PJ()})}import{getModelInfo as qJ}from"@contractspec/lib.ai-providers/models";import{definePrompt as _J,defineResourceTemplate as qj,installOp as uj,OperationSpecRegistry as MJ,PromptRegistry as bJ,ResourceRegistry as GJ}from"@contractspec/lib.contracts-spec";import{BenchmarkIngestCommand as DJ,BenchmarkRunCustomCommand as CJ,RankingRefreshCommand as AJ}from"@contractspec/lib.contracts-spec/provider-ranking";import{InMemoryProviderRankingStore as IJ}from"@contractspec/lib.provider-ranking/in-memory-store";import{createDefaultIngesterRegistry as NJ}from"@contractspec/lib.provider-ranking/ingesters";import{computeModelRankings as zJ,normalizeBenchmarkResults as EJ}from"@contractspec/lib.provider-ranking/scoring";import M from"zod";var Mj=M.enum(["rest","mcp","webhook","sdk"]).optional(),bj=M.enum(["api-key","oauth2","bearer","header","basic","webhook-signing","service-account"]).optional(),Qj=["ranking","mcp","ai"],kJ=["platform.ai"],_j=null;function c(){if(!_j)_j=new IJ;return _j}function vJ(){let j=new GJ;return j.register(qj({meta:{uriTemplate:"ranking://leaderboard",title:"AI Model Leaderboard",description:"Current ranked list of AI models by composite score. Supports optional transport and authMethod query filters.",mimeType:"application/json",tags:Qj},input:M.object({transport:Mj,authMethod:bj}),resolve:async({transport:Y,authMethod:J})=>{let $=await c().listModelRankings({limit:100,requiredTransport:Y,requiredAuthMethod:J});return{uri:"ranking://leaderboard",mimeType:"application/json",data:JSON.stringify($,null,2)}}})),j.register(qj({meta:{uriTemplate:"ranking://leaderboard/{dimension}",title:"AI Model Leaderboard by Dimension",description:"Ranked list of AI models filtered by a specific dimension. Supports optional transport and authMethod query filters.",mimeType:"application/json",tags:Qj},input:M.object({dimension:M.string(),transport:Mj,authMethod:bj}),resolve:async({dimension:Y,transport:J,authMethod:Q})=>{let Z=await c().listModelRankings({dimension:Y,limit:100,requiredTransport:J,requiredAuthMethod:Q});return{uri:`ranking://leaderboard/${encodeURIComponent(Y)}`,mimeType:"application/json",data:JSON.stringify(Z,null,2)}}})),j.register(qj({meta:{uriTemplate:"ranking://model/{modelId}",title:"AI Model Profile",description:"Detailed profile for a specific AI model including scores and benchmarks.",mimeType:"application/json",tags:Qj},input:M.object({modelId:M.string()}),resolve:async({modelId:Y})=>{let Q=await c().getModelProfile(Y);if(!Q)return{uri:`ranking://model/${encodeURIComponent(Y)}`,mimeType:"application/json",data:JSON.stringify({error:"not_found",modelId:Y})};let $=Q.costPerMillion==null?(()=>{let Z=qJ(Q.modelId);return Z?.costPerMillion?{...Q,costPerMillion:Z.costPerMillion,displayName:Z.name,contextWindow:Z.contextWindow,capabilities:[...Z.capabilities.vision?["vision"]:[],...Z.capabilities.tools?["tools"]:[],...Z.capabilities.reasoning?["reasoning"]:[],...Z.capabilities.streaming?["streaming"]:[]]}:Q})():Q;return{uri:`ranking://model/${encodeURIComponent(Y)}`,mimeType:"application/json",data:JSON.stringify($,null,2)}}})),j.register(qj({meta:{uriTemplate:"ranking://results",title:"Benchmark Results",description:"List of raw benchmark results from all ingested sources.",mimeType:"application/json",tags:Qj},input:M.object({}),resolve:async()=>{let J=await c().listBenchmarkResults({limit:200});return{uri:"ranking://results",mimeType:"application/json",data:JSON.stringify(J,null,2)}}})),j}function OJ(){let j=new bJ;return j.register(_J({meta:{key:"ranking.advisor",version:"1.0.0",title:"AI Model Advisor",description:"Which AI model is best for a given task? Uses the leaderboard to recommend.",tags:Qj,stability:"beta",owners:kJ},args:[{name:"task",description:"The task or use case to recommend a model for.",required:!0,schema:M.string()},{name:"priority",description:"Priority dimension (coding, reasoning, cost, latency, etc.).",required:!1,schema:M.string().optional()},{name:"transport",description:"Required transport type (rest, mcp, webhook, sdk).",required:!1,schema:Mj},{name:"authMethod",description:"Required auth method (api-key, oauth2, bearer, etc.).",required:!1,schema:bj}],input:M.object({task:M.string(),priority:M.string().optional(),transport:Mj,authMethod:bj}),render:async({task:Y,priority:J,transport:Q,authMethod:$})=>{let Z=[];if(J)Z.push(`Prioritize: ${J}.`);if(Q)Z.push(`Required transport: ${Q}.`);if($)Z.push(`Required auth: ${$}.`);return[{type:"text",text:`Recommend the best AI model for: "${Y}".${Z.length?` ${Z.join(" ")}`:""} Use the leaderboard data to justify your recommendation.`},{type:"resource",uri:J?`ranking://leaderboard/${J}`:"ranking://leaderboard",title:"Leaderboard"}]}})),j}function RJ(){let j=new MJ,Y=NJ();return uj(j,DJ,async(J)=>{let Q=c(),$=J.source,Z=Y.get($);if(!Z)throw Error(`No ingester registered for source: ${$}`);let X=await Z.ingest({sourceUrl:J.sourceUrl,dimensions:J.dimensions}),U=EJ(X);for(let V of U)await Q.upsertBenchmarkResult(V);return{ingestionId:`ingest-${$}-${Date.now()}`,source:$,resultsCount:U.length,status:"completed",ingestedAt:new Date}}),uj(j,CJ,async(J)=>{return{runId:`custom-${Date.now()}`,evalSuiteKey:J.evalSuiteKey,modelId:J.modelId,status:"started",startedAt:new Date}}),uj(j,AJ,async(J)=>{let Q=c(),$=[],Z=0,X=500;while(!0){let H=await Q.listBenchmarkResults({limit:X,offset:Z});if($.push(...H.results),$.length>=H.total||H.results.length<X)break;Z+=X}let U=new Map((await Q.listModelRankings({limit:1e4})).rankings.map((H)=>[H.modelId,H])),V=J.weightOverrides?Array.isArray(J.weightOverrides)?J.weightOverrides:[J.weightOverrides]:void 0,B=zJ($,V?{weightOverrides:V}:void 0,U);for(let H of B)await Q.upsertModelRanking(H);return{modelsRanked:B.length,updatedAt:new Date,status:"completed"}}),j}function NZ(j="/api/mcp/ranking"){return A({logger:D,path:j,serverName:"contractspec-ranking-mcp",ops:RJ(),resources:vJ(),prompts:OJ()})}function zZ(j){_j=j}export{zZ as setProviderRankingStore,NZ as createProviderRankingMcpHandler,PZ as createInternalMcpHandler,VZ as createDocsMcpHandler,AQ as createContractsMcpHandler,HQ as createCliMcpHandler};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Logger as G,LogLevel as P}from"@contractspec/lib.logger";function _(){return"production"}var
|
|
2
|
-
`)})})),j}function
|
|
1
|
+
var v=Object.defineProperty;var S=(j)=>j;function m(j,w){this[j]=S.bind(null,w)}var Fj=(j,w)=>{for(var B in w)v(j,B,{get:w[B],enumerable:!0,configurable:!0,set:m.bind(w,B)})};var Jj=(j,w)=>()=>(j&&(w=j(j=0)),w);import{Logger as G,LogLevel as P}from"@contractspec/lib.logger";function _(){return"production"}var N=()=>new G({level:P.INFO,environment:_(),enableTracing:!0,enableTiming:!0,enableContext:!0,enableColors:!1}),y=N(),Xj=new G({level:P.WARN,environment:_(),enableTracing:!0,enableTiming:!0,enableContext:!0,enableColors:!1}),Zj=new G({level:P.INFO,environment:_(),enableTracing:!0,enableTiming:!0,enableContext:!0,enableColors:!1});var O=["application/json","text/event-stream"];function n(j){return!j||j.includes("*/*")||j.includes("application/*")||O.some((w)=>j.includes(w))}function f(j){if(j.method!=="POST")return j;let w=j.headers.get("accept");if(!n(w))return j;let B=O.filter((F)=>!w?.includes(F));if(B.length===0)return j;let Y=new Headers(j.headers);return Y.set("accept",[w,...B].filter(Boolean).join(", ")),new Request(j,{headers:Y})}import{createMcpServer as l}from"@contractspec/lib.contracts-runtime-server-mcp/provider-mcp";import{PresentationRegistry as g}from"@contractspec/lib.contracts-spec/presentations";import{McpServer as u}from"@modelcontextprotocol/sdk/server/mcp.js";import{WebStandardStreamableHTTPServerTransport as d}from"@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";import{randomUUID as p}from"crypto";import{Elysia as i}from"elysia";var o={actor:"anonymous",decide:async()=>({effect:"allow"})};function b(j,w,B,Y){return new Response(JSON.stringify({jsonrpc:"2.0",error:{code:w,message:B,...Y?{data:Y}:{}},id:null}),{status:j,headers:{"content-type":"application/json"}})}function R({logger:j,serverName:w,ops:B,resources:Y,prompts:F,presentations:H,stateful:W}){let J=new u({name:w,version:"1.0.0"},{capabilities:{tools:{},resources:{},prompts:{},logging:{}}});j.info("Setting up MCP server..."),l(J,B,Y,F,{logger:j,toolCtx:()=>o,promptCtx:()=>({locale:"en"}),resourceCtx:()=>({locale:"en"}),presentations:new g(H)});let z=new d({sessionIdGenerator:W?()=>p():void 0,enableJsonResponse:!0});return J.connect(z).then(()=>({server:J,transport:z}))}async function D(j){await Promise.allSettled([j.transport.close(),j.server.close()])}function a(j){return j instanceof Error?j.stack??j.message:String(j)}function A({logger:j,path:w,serverName:B,ops:Y,resources:F,prompts:H,presentations:W,validateAuth:J,requiredAuthMethods:z}){j.info("Setting up MCP handler...",{requiredAuthMethods:z??[]});let T=process.env.CONTRACTSPEC_MCP_STATEFUL==="1",Z=new Map;async function I(Q){let U=await R({logger:j,path:w,serverName:B,ops:Y,resources:F,prompts:H,presentations:W,stateful:!1});try{return await U.transport.handleRequest(f(Q))}finally{await D(U)}}async function c(Q){let U=Z.get(Q);if(!U)return;Z.delete(Q),await D(U)}async function q(Q){let U=Q.headers.get("mcp-session-id"),k,x=!1;if(U){let K=Z.get(U);if(!K)return b(404,-32001,"Session not found");k=K}else k=await R({logger:j,path:w,serverName:B,ops:Y,resources:F,prompts:H,presentations:W,stateful:!0}),x=!0;try{let K=await k.transport.handleRequest(f(Q)),V=k.transport.sessionId;if(V&&!Z.has(V))Z.set(V,k);if(Q.method==="DELETE"&&V)await c(V);else if(!V&&x)await D(k);return K}catch(K){if(x)await D(k);throw K}}return new i({name:`mcp-${B}`}).all(w,async({request:Q})=>{try{if(J){let U=await J(Q);if(!U.valid)return b(401,-32002,"Authentication failed",U.reason)}if(T)return await q(Q);return await I(Q)}catch(U){return j.error("Error handling MCP request",{path:w,method:Q.method,error:a(U)}),b(500,-32000,"Internal error")}})}import{defineCommand as t,definePrompt as r,defineResourceTemplate as M,installOp as s,OperationSpecRegistry as e,PromptRegistry as jj,ResourceRegistry as wj}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as E,ScalarTypeEnum as h}from"@contractspec/lib.schema";import{getExample as Bj,listExamples as Qj,searchExamples as Uj}from"@contractspec/module.examples";import C from"zod";var X=["internal","mcp"],L=["@contractspec"],$={docs:"/api/mcp/docs",cli:"/api/mcp/cli",internal:"/api/mcp/internal",graphql:"/graphql",health:"/health"};function Yj(){let j=new wj;return j.register(M({meta:{uriTemplate:"examples://list{?q}",title:"ContractSpec examples registry",description:"List available examples (templates, integrations, knowledge, scripts). Optional query `q` filters results.",mimeType:"application/json",tags:["examples",...X]},input:C.object({q:C.string().optional()}),resolve:async({q:w})=>{let B=w?Uj(w):[...Qj()];return{uri:w?`examples://list?q=${encodeURIComponent(w)}`:"examples://list",mimeType:"application/json",data:JSON.stringify(B,null,2)}}})),j.register(M({meta:{uriTemplate:"examples://example/{id}",title:"ContractSpec example (by id)",description:"Fetch a single example manifest by id.",mimeType:"application/json",tags:["examples",...X]},input:C.object({id:C.string().min(1)}),resolve:async({id:w})=>{let B=Bj(w);if(!B)return{uri:`examples://example/${encodeURIComponent(w)}`,mimeType:"application/json",data:JSON.stringify({error:"not_found",id:w,message:`Unknown example id: ${w}`},null,2)};return{uri:`examples://example/${encodeURIComponent(w)}`,mimeType:"application/json",data:JSON.stringify(B,null,2)}}})),j.register(M({meta:{uriTemplate:"internal://endpoints",title:"ContractSpec MCP endpoints",description:"Endpoints for docs, CLI, internal MCP servers.",mimeType:"application/json",tags:X},input:C.object({}),resolve:async()=>({uri:"internal://endpoints",mimeType:"application/json",data:JSON.stringify($,null,2)})})),j.register(M({meta:{uriTemplate:"internal://playbook",title:"Internal MCP usage playbook",description:"How internal agents should discover docs, CLI usage, and endpoints.",mimeType:"text/markdown",tags:X},input:C.object({}),resolve:async()=>({uri:"internal://playbook",mimeType:"text/markdown",data:["# Internal MCP playbook","- Connect to docs MCP first for canonical specs.","- Use CLI MCP to surface quickstart/reference before running commands.","- Keep calls read-only unless explicitly approved.",`- Endpoints: ${$.docs}, ${$.cli}, ${$.internal}.`,"- For API work, GraphQL at /graphql; health at /health."].join(`
|
|
2
|
+
`)})})),j}function kj(){let j=new jj;return j.register(r({meta:{key:"internal_bootstrap",version:"1.0.0",title:"Bootstrap internal ContractSpec agent",description:"Points agents to the correct MCP endpoints and guardrails.",tags:X,owners:L,stability:"beta"},args:[],input:C.object({}),render:async()=>[{type:"text",text:"Start with internal://endpoints to pick the right MCP. Use docs MCP for specifications and CLI MCP for commands. Keep actions read-only unless explicitly approved."},{type:"resource",uri:"internal://endpoints",title:"Endpoints"}]})),j}function Cj(){let j=new e,w=E({name:"InternalDescribeOutput",fields:{endpoints:{type:h.JSONObject(),isOptional:!1},notes:{type:h.String_unsecure(),isOptional:!1}}}),B=t({meta:{key:"internal_describe",version:"1.0.0",stability:"stable",owners:L,tags:X,description:"Return MCP endpoints and guidance for internal ContractSpec agents.",goal:"Speed up internal development with the correct MCP entrypoints.",context:"Used by internal MCP surface; read-only."},io:{input:E({name:"InternalDescribeInput",fields:{}}),output:w},policy:{auth:"anonymous"}});return s(j,B,async()=>({endpoints:$,notes:"Use docs MCP for canonical specs, CLI MCP for contractspec commands, and keep side-effecting actions gated behind human review."})),j}function Ej(j="/api/mcp/internal"){return A({logger:y,path:j,serverName:"contractspec-internal-mcp",ops:Cj(),resources:Yj(),prompts:kj()})}export{Ej as createInternalMcpHandler};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var o=["application/json","text/event-stream"];function
|
|
1
|
+
var c=Object.defineProperty;var l=(n)=>n;function r(n,e){this[n]=l.bind(null,e)}var u=(n,e)=>{for(var t in e)c(n,t,{get:e[t],enumerable:!0,configurable:!0,set:r.bind(e,t)})};var d=(n,e)=>()=>(n&&(e=n(n=0)),e);var o=["application/json","text/event-stream"];function a(n){return!n||n.includes("*/*")||n.includes("application/*")||o.some((e)=>n.includes(e))}function f(n){if(n.method!=="POST")return n;let e=n.headers.get("accept");if(!a(e))return n;let t=o.filter((s)=>!e?.includes(s));if(t.length===0)return n;let i=new Headers(n.headers);return i.set("accept",[e,...t].filter(Boolean).join(", ")),new Request(n,{headers:i})}export{f as normalizeMcpRequest};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Logger as M,LogLevel as k}from"@contractspec/lib.logger";function L(){return"production"}var
|
|
1
|
+
var c=Object.defineProperty;var h=(j)=>j;function m(j,Q){this[j]=h.bind(null,Q)}var Hj=(j,Q)=>{for(var U in Q)c(j,U,{get:Q[U],enumerable:!0,configurable:!0,set:m.bind(Q,U)})};var Pj=(j,Q)=>()=>(j&&(Q=j(j=0)),Q);import{Logger as M,LogLevel as k}from"@contractspec/lib.logger";function L(){return"production"}var u=()=>new M({level:k.INFO,environment:L(),enableTracing:!0,enableTiming:!0,enableContext:!0,enableColors:!1}),q=u(),wj=new M({level:k.WARN,environment:L(),enableTracing:!0,enableTiming:!0,enableContext:!0,enableColors:!1}),_j=new M({level:k.INFO,environment:L(),enableTracing:!0,enableTiming:!0,enableContext:!0,enableColors:!1});var N=["application/json","text/event-stream"];function d(j){return!j||j.includes("*/*")||j.includes("application/*")||N.some((Q)=>j.includes(Q))}function z(j){if(j.method!=="POST")return j;let Q=j.headers.get("accept");if(!d(Q))return j;let U=N.filter((J)=>!Q?.includes(J));if(U.length===0)return j;let Y=new Headers(j.headers);return Y.set("accept",[Q,...U].filter(Boolean).join(", ")),new Request(j,{headers:Y})}import{createMcpServer as l}from"@contractspec/lib.contracts-runtime-server-mcp/provider-mcp";import{PresentationRegistry as p}from"@contractspec/lib.contracts-spec/presentations";import{McpServer as g}from"@modelcontextprotocol/sdk/server/mcp.js";import{WebStandardStreamableHTTPServerTransport as n}from"@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";import{randomUUID as i}from"crypto";import{Elysia as a}from"elysia";var o={actor:"anonymous",decide:async()=>({effect:"allow"})};function y(j,Q,U,Y){return new Response(JSON.stringify({jsonrpc:"2.0",error:{code:Q,message:U,...Y?{data:Y}:{}},id:null}),{status:j,headers:{"content-type":"application/json"}})}function f({logger:j,serverName:Q,ops:U,resources:Y,prompts:J,presentations:D,stateful:B}){let x=new g({name:Q,version:"1.0.0"},{capabilities:{tools:{},resources:{},prompts:{},logging:{}}});j.info("Setting up MCP server..."),l(x,U,Y,J,{logger:j,toolCtx:()=>o,promptCtx:()=>({locale:"en"}),resourceCtx:()=>({locale:"en"}),presentations:new p(D)});let E=new n({sessionIdGenerator:B?()=>i():void 0,enableJsonResponse:!0});return x.connect(E).then(()=>({server:x,transport:E}))}async function K(j){await Promise.allSettled([j.transport.close(),j.server.close()])}function t(j){return j instanceof Error?j.stack??j.message:String(j)}function I({logger:j,path:Q,serverName:U,ops:Y,resources:J,prompts:D,presentations:B,validateAuth:x,requiredAuthMethods:E}){j.info("Setting up MCP handler...",{requiredAuthMethods:E??[]});let _=process.env.CONTRACTSPEC_MCP_STATEFUL==="1",V=new Map;async function R(X){let Z=await f({logger:j,path:Q,serverName:U,ops:Y,resources:J,prompts:D,presentations:B,stateful:!1});try{return await Z.transport.handleRequest(z(X))}finally{await K(Z)}}async function v(X){let Z=V.get(X);if(!Z)return;V.delete(X),await K(Z)}async function S(X){let Z=X.headers.get("mcp-session-id"),H,T=!1;if(Z){let P=V.get(Z);if(!P)return y(404,-32001,"Session not found");H=P}else H=await f({logger:j,path:Q,serverName:U,ops:Y,resources:J,prompts:D,presentations:B,stateful:!0}),T=!0;try{let P=await H.transport.handleRequest(z(X)),W=H.transport.sessionId;if(W&&!V.has(W))V.set(W,H);if(X.method==="DELETE"&&W)await v(W);else if(!W&&T)await K(H);return P}catch(P){if(T)await K(H);throw P}}return new a({name:`mcp-${U}`}).all(Q,async({request:X})=>{try{if(x){let Z=await x(X);if(!Z.valid)return y(401,-32002,"Authentication failed",Z.reason)}if(_)return await S(X);return await R(X)}catch(Z){return j.error("Error handling MCP request",{path:Q,method:X.method,error:t(Z)}),y(500,-32000,"Internal error")}})}import{getModelInfo as s}from"@contractspec/lib.ai-providers/models";import{definePrompt as r,defineResourceTemplate as b,installOp as A,OperationSpecRegistry as e,PromptRegistry as jj,ResourceRegistry as Qj}from"@contractspec/lib.contracts-spec";import{BenchmarkIngestCommand as Uj,BenchmarkRunCustomCommand as Yj,RankingRefreshCommand as Dj}from"@contractspec/lib.contracts-spec/provider-ranking";import{InMemoryProviderRankingStore as Jj}from"@contractspec/lib.provider-ranking/in-memory-store";import{createDefaultIngesterRegistry as Vj}from"@contractspec/lib.provider-ranking/ingesters";import{computeModelRankings as Xj,normalizeBenchmarkResults as Zj}from"@contractspec/lib.provider-ranking/scoring";import $ from"zod";var F=$.enum(["rest","mcp","webhook","sdk"]).optional(),G=$.enum(["api-key","oauth2","bearer","header","basic","webhook-signing","service-account"]).optional(),w=["ranking","mcp","ai"],$j=["platform.ai"],O=null;function C(){if(!O)O=new Jj;return O}function xj(){let j=new Qj;return j.register(b({meta:{uriTemplate:"ranking://leaderboard",title:"AI Model Leaderboard",description:"Current ranked list of AI models by composite score. Supports optional transport and authMethod query filters.",mimeType:"application/json",tags:w},input:$.object({transport:F,authMethod:G}),resolve:async({transport:Q,authMethod:U})=>{let J=await C().listModelRankings({limit:100,requiredTransport:Q,requiredAuthMethod:U});return{uri:"ranking://leaderboard",mimeType:"application/json",data:JSON.stringify(J,null,2)}}})),j.register(b({meta:{uriTemplate:"ranking://leaderboard/{dimension}",title:"AI Model Leaderboard by Dimension",description:"Ranked list of AI models filtered by a specific dimension. Supports optional transport and authMethod query filters.",mimeType:"application/json",tags:w},input:$.object({dimension:$.string(),transport:F,authMethod:G}),resolve:async({dimension:Q,transport:U,authMethod:Y})=>{let D=await C().listModelRankings({dimension:Q,limit:100,requiredTransport:U,requiredAuthMethod:Y});return{uri:`ranking://leaderboard/${encodeURIComponent(Q)}`,mimeType:"application/json",data:JSON.stringify(D,null,2)}}})),j.register(b({meta:{uriTemplate:"ranking://model/{modelId}",title:"AI Model Profile",description:"Detailed profile for a specific AI model including scores and benchmarks.",mimeType:"application/json",tags:w},input:$.object({modelId:$.string()}),resolve:async({modelId:Q})=>{let Y=await C().getModelProfile(Q);if(!Y)return{uri:`ranking://model/${encodeURIComponent(Q)}`,mimeType:"application/json",data:JSON.stringify({error:"not_found",modelId:Q})};let J=Y.costPerMillion==null?(()=>{let D=s(Y.modelId);return D?.costPerMillion?{...Y,costPerMillion:D.costPerMillion,displayName:D.name,contextWindow:D.contextWindow,capabilities:[...D.capabilities.vision?["vision"]:[],...D.capabilities.tools?["tools"]:[],...D.capabilities.reasoning?["reasoning"]:[],...D.capabilities.streaming?["streaming"]:[]]}:Y})():Y;return{uri:`ranking://model/${encodeURIComponent(Q)}`,mimeType:"application/json",data:JSON.stringify(J,null,2)}}})),j.register(b({meta:{uriTemplate:"ranking://results",title:"Benchmark Results",description:"List of raw benchmark results from all ingested sources.",mimeType:"application/json",tags:w},input:$.object({}),resolve:async()=>{let U=await C().listBenchmarkResults({limit:200});return{uri:"ranking://results",mimeType:"application/json",data:JSON.stringify(U,null,2)}}})),j}function Bj(){let j=new jj;return j.register(r({meta:{key:"ranking.advisor",version:"1.0.0",title:"AI Model Advisor",description:"Which AI model is best for a given task? Uses the leaderboard to recommend.",tags:w,stability:"beta",owners:$j},args:[{name:"task",description:"The task or use case to recommend a model for.",required:!0,schema:$.string()},{name:"priority",description:"Priority dimension (coding, reasoning, cost, latency, etc.).",required:!1,schema:$.string().optional()},{name:"transport",description:"Required transport type (rest, mcp, webhook, sdk).",required:!1,schema:F},{name:"authMethod",description:"Required auth method (api-key, oauth2, bearer, etc.).",required:!1,schema:G}],input:$.object({task:$.string(),priority:$.string().optional(),transport:F,authMethod:G}),render:async({task:Q,priority:U,transport:Y,authMethod:J})=>{let D=[];if(U)D.push(`Prioritize: ${U}.`);if(Y)D.push(`Required transport: ${Y}.`);if(J)D.push(`Required auth: ${J}.`);return[{type:"text",text:`Recommend the best AI model for: "${Q}".${D.length?` ${D.join(" ")}`:""} Use the leaderboard data to justify your recommendation.`},{type:"resource",uri:U?`ranking://leaderboard/${U}`:"ranking://leaderboard",title:"Leaderboard"}]}})),j}function Ej(){let j=new e,Q=Vj();return A(j,Uj,async(U)=>{let Y=C(),J=U.source,D=Q.get(J);if(!D)throw Error(`No ingester registered for source: ${J}`);let B=await D.ingest({sourceUrl:U.sourceUrl,dimensions:U.dimensions}),x=Zj(B);for(let E of x)await Y.upsertBenchmarkResult(E);return{ingestionId:`ingest-${J}-${Date.now()}`,source:J,resultsCount:x.length,status:"completed",ingestedAt:new Date}}),A(j,Yj,async(U)=>{return{runId:`custom-${Date.now()}`,evalSuiteKey:U.evalSuiteKey,modelId:U.modelId,status:"started",startedAt:new Date}}),A(j,Dj,async(U)=>{let Y=C(),J=[],D=0,B=500;while(!0){let V=await Y.listBenchmarkResults({limit:B,offset:D});if(J.push(...V.results),J.length>=V.total||V.results.length<B)break;D+=B}let x=new Map((await Y.listModelRankings({limit:1e4})).rankings.map((V)=>[V.modelId,V])),E=U.weightOverrides?Array.isArray(U.weightOverrides)?U.weightOverrides:[U.weightOverrides]:void 0,_=Xj(J,E?{weightOverrides:E}:void 0,x);for(let V of _)await Y.upsertModelRanking(V);return{modelsRanked:_.length,updatedAt:new Date,status:"completed"}}),j}function cj(j="/api/mcp/ranking"){return I({logger:q,path:j,serverName:"contractspec-ranking-mcp",ops:Ej(),resources:xj(),prompts:Bj()})}function hj(j){O=j}export{hj as setProviderRankingStore,cj as createProviderRankingMcpHandler};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineModuleBundle as
|
|
1
|
+
var k=Object.defineProperty;var q=(g)=>g;function v(g,h){this[g]=q.bind(null,h)}var x=(g,h)=>{for(var j in h)k(g,j,{get:h[j],enumerable:!0,configurable:!0,set:v.bind(h,j)})};var y=(g,h)=>()=>(g&&(h=g(g=0)),h);import{defineModuleBundle as w}from"@contractspec/lib.surface-runtime/spec";var C=w({meta:{key:"bundles.library",version:"1.0.0",title:"Library",description:"ContractSpec package declaration for @contractspec/bundle.library."},routes:[{routeId:"default",path:"/",defaultSurface:"main"}],surfaces:{main:{surfaceId:"main",kind:"workbench",title:"Library",slots:[],layouts:[],data:[],verification:{dimensions:{guidance:"Scaffolded guidance profile for Library.",density:"Scaffolded density profile for Library.",dataDepth:"Scaffolded data-depth profile for Library.",control:"Scaffolded control profile for Library.",media:"Scaffolded media profile for Library.",pace:"Scaffolded pace profile for Library.",narrative:"Scaffolded narrative profile for Library."}}}}});export{C as LibraryBundle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineModuleBundle as
|
|
1
|
+
var L=Object.defineProperty;var b=(r)=>r;function g(r,x){this[r]=b.bind(null,x)}var k=(r,x)=>{for(var y in x)L(r,y,{get:x[y],enumerable:!0,configurable:!0,set:g.bind(x,y)})};var m=(r,x)=>()=>(r&&(x=r(r=0)),x);import{defineModuleBundle as h}from"@contractspec/lib.surface-runtime/spec";var j=h({meta:{key:"bundles.library",version:"1.0.0",title:"Library",description:"ContractSpec package declaration for @contractspec/bundle.library."},routes:[{routeId:"default",path:"/",defaultSurface:"main"}],surfaces:{main:{surfaceId:"main",kind:"workbench",title:"Library",slots:[],layouts:[],data:[],verification:{dimensions:{guidance:"Scaffolded guidance profile for Library.",density:"Scaffolded density profile for Library.",dataDepth:"Scaffolded data-depth profile for Library.",control:"Scaffolded control profile for Library.",media:"Scaffolded media profile for Library.",pace:"Scaffolded pace profile for Library.",narrative:"Scaffolded narrative profile for Library."}}}}});export{j as LibraryBundle};
|