@contractspec/lib.contracts 0.0.0-canary-20260113162409
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/LICENSE +21 -0
- package/README.md +109 -0
- package/dist/_virtual/rolldown_runtime.js +37 -0
- package/dist/app-config/app-config.capability.d.ts +7 -0
- package/dist/app-config/app-config.capability.js +23 -0
- package/dist/app-config/app-config.feature.d.ts +11 -0
- package/dist/app-config/app-config.feature.js +61 -0
- package/dist/app-config/branding.d.ts +55 -0
- package/dist/app-config/branding.js +0 -0
- package/dist/app-config/contracts.d.ts +245 -0
- package/dist/app-config/contracts.js +395 -0
- package/dist/app-config/docs/app-config.docblock.d.ts +6 -0
- package/dist/app-config/docs/app-config.docblock.js +21 -0
- package/dist/app-config/events.d.ts +122 -0
- package/dist/app-config/events.js +174 -0
- package/dist/app-config/index.d.ts +10 -0
- package/dist/app-config/index.js +9 -0
- package/dist/app-config/lifecycle-contracts.d.ts +273 -0
- package/dist/app-config/lifecycle-contracts.js +440 -0
- package/dist/app-config/lifecycle.d.ts +27 -0
- package/dist/app-config/lifecycle.js +0 -0
- package/dist/app-config/runtime.d.ts +120 -0
- package/dist/app-config/runtime.js +617 -0
- package/dist/app-config/spec.d.ts +175 -0
- package/dist/app-config/spec.js +19 -0
- package/dist/app-config/validation.d.ts +49 -0
- package/dist/app-config/validation.js +538 -0
- package/dist/capabilities/capabilities.d.ts +41 -0
- package/dist/capabilities/capabilities.js +48 -0
- package/dist/capabilities/docs/capabilities.docblock.d.ts +6 -0
- package/dist/capabilities/docs/capabilities.docblock.js +21 -0
- package/dist/capabilities/index.d.ts +3 -0
- package/dist/capabilities/index.js +4 -0
- package/dist/capabilities/openbanking.d.ts +10 -0
- package/dist/capabilities/openbanking.js +92 -0
- package/dist/client/index.d.ts +6 -0
- package/dist/client/index.js +9 -0
- package/dist/client/react/drivers/rn-reusables.d.ts +22 -0
- package/dist/client/react/drivers/rn-reusables.js +21 -0
- package/dist/client/react/drivers/shadcn.d.ts +12 -0
- package/dist/client/react/drivers/shadcn.js +11 -0
- package/dist/client/react/feature-render.d.ts +23 -0
- package/dist/client/react/feature-render.js +44 -0
- package/dist/client/react/form-render.d.ts +92 -0
- package/dist/client/react/form-render.js +301 -0
- package/dist/client/react/index.d.ts +5 -0
- package/dist/client/react/index.js +8 -0
- package/dist/contract-registry/index.d.ts +3 -0
- package/dist/contract-registry/index.js +3 -0
- package/dist/contract-registry/schemas.d.ts +124 -0
- package/dist/contract-registry/schemas.js +61 -0
- package/dist/contract-registry/types.d.ts +46 -0
- package/dist/contract-registry/types.js +0 -0
- package/dist/data-views/data-views.d.ts +5 -0
- package/dist/data-views/data-views.js +5 -0
- package/dist/data-views/docs/data-views.docblock.d.ts +6 -0
- package/dist/data-views/docs/data-views.docblock.js +21 -0
- package/dist/data-views/index.d.ts +4 -0
- package/dist/data-views/index.js +4 -0
- package/dist/data-views/query-generator.d.ts +40 -0
- package/dist/data-views/query-generator.js +48 -0
- package/dist/data-views/registry.d.ts +17 -0
- package/dist/data-views/registry.js +20 -0
- package/dist/data-views/runtime.d.ts +32 -0
- package/dist/data-views/runtime.js +68 -0
- package/dist/data-views/spec.d.ts +32 -0
- package/dist/data-views/spec.js +10 -0
- package/dist/data-views/types.d.ts +157 -0
- package/dist/data-views/types.js +0 -0
- package/dist/docs/accessibility_wcag_compliance_specs.docblock.d.ts +6 -0
- package/dist/docs/accessibility_wcag_compliance_specs.docblock.js +17 -0
- package/dist/docs/index.d.ts +6 -0
- package/dist/docs/index.js +30 -0
- package/dist/docs/meta.docs.d.ts +6 -0
- package/dist/docs/meta.docs.js +29 -0
- package/dist/docs/presentations.d.ts +31 -0
- package/dist/docs/presentations.js +57 -0
- package/dist/docs/registry.d.ts +23 -0
- package/dist/docs/registry.js +51 -0
- package/dist/docs/tech/auth/better-auth-nextjs.docblock.d.ts +6 -0
- package/dist/docs/tech/auth/better-auth-nextjs.docblock.js +81 -0
- package/dist/docs/tech/cli.docblock.d.ts +6 -0
- package/dist/docs/tech/cli.docblock.js +138 -0
- package/dist/docs/tech/contracts/README.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/README.docblock.js +21 -0
- package/dist/docs/tech/contracts/migrations.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/migrations.docblock.js +21 -0
- package/dist/docs/tech/contracts/openapi-export.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/openapi-export.docblock.js +58 -0
- package/dist/docs/tech/contracts/openapi-import.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/openapi-import.docblock.js +65 -0
- package/dist/docs/tech/contracts/ops-to-presentation-linking.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/ops-to-presentation-linking.docblock.js +21 -0
- package/dist/docs/tech/contracts/overlays.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/overlays.docblock.js +21 -0
- package/dist/docs/tech/contracts/tests.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/tests.docblock.js +21 -0
- package/dist/docs/tech/contracts/themes.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/themes.docblock.js +21 -0
- package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.js +126 -0
- package/dist/docs/tech/lifecycle-stage-system.docblock.d.ts +6 -0
- package/dist/docs/tech/lifecycle-stage-system.docblock.js +17 -0
- package/dist/docs/tech/llm/llm-integration.docblock.d.ts +7 -0
- package/dist/docs/tech/llm/llm-integration.docblock.js +358 -0
- package/dist/docs/tech/mcp-endpoints.docblock.d.ts +6 -0
- package/dist/docs/tech/mcp-endpoints.docblock.js +38 -0
- package/dist/docs/tech/presentation-runtime.docblock.d.ts +6 -0
- package/dist/docs/tech/presentation-runtime.docblock.js +17 -0
- package/dist/docs/tech/schema/README.docblock.d.ts +6 -0
- package/dist/docs/tech/schema/README.docblock.js +21 -0
- package/dist/docs/tech/studio/learning-events.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/learning-events.docblock.js +49 -0
- package/dist/docs/tech/studio/learning-journeys.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/learning-journeys.docblock.js +80 -0
- package/dist/docs/tech/studio/platform-admin-panel.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/platform-admin-panel.docblock.js +85 -0
- package/dist/docs/tech/studio/project-access-teams.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/project-access-teams.docblock.js +48 -0
- package/dist/docs/tech/studio/project-routing.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/project-routing.docblock.js +68 -0
- package/dist/docs/tech/studio/sandbox-unlogged.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/sandbox-unlogged.docblock.js +41 -0
- package/dist/docs/tech/studio/team-invitations.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/team-invitations.docblock.js +70 -0
- package/dist/docs/tech/studio/workspace-ops.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/workspace-ops.docblock.js +48 -0
- package/dist/docs/tech/studio/workspaces.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/workspaces.docblock.js +63 -0
- package/dist/docs/tech/telemetry-ingest.docblock.d.ts +6 -0
- package/dist/docs/tech/telemetry-ingest.docblock.js +156 -0
- package/dist/docs/tech/vscode-extension.docblock.d.ts +6 -0
- package/dist/docs/tech/vscode-extension.docblock.js +102 -0
- package/dist/docs/tech-contracts.docs.d.ts +6 -0
- package/dist/docs/tech-contracts.docs.js +96 -0
- package/dist/docs/types.d.ts +41 -0
- package/dist/docs/types.js +0 -0
- package/dist/events.d.ts +47 -0
- package/dist/events.js +19 -0
- package/dist/examples/docs/examples.docblock.d.ts +6 -0
- package/dist/examples/docs/examples.docblock.js +165 -0
- package/dist/examples/index.d.ts +13 -0
- package/dist/examples/index.js +13 -0
- package/dist/examples/registry.d.ts +43 -0
- package/dist/examples/registry.js +88 -0
- package/dist/examples/schema.d.ts +282 -0
- package/dist/examples/schema.js +125 -0
- package/dist/examples/types.d.ts +167 -0
- package/dist/examples/types.js +43 -0
- package/dist/examples/validation.d.ts +65 -0
- package/dist/examples/validation.js +144 -0
- package/dist/experiments/docs/experiments.docblock.d.ts +6 -0
- package/dist/experiments/docs/experiments.docblock.js +21 -0
- package/dist/experiments/evaluator.d.ts +37 -0
- package/dist/experiments/evaluator.js +101 -0
- package/dist/experiments/spec-resolver.d.ts +17 -0
- package/dist/experiments/spec-resolver.js +0 -0
- package/dist/experiments/spec.d.ts +80 -0
- package/dist/experiments/spec.js +15 -0
- package/dist/features/index.d.ts +13 -0
- package/dist/features/index.js +12 -0
- package/dist/features/install.d.ts +22 -0
- package/dist/features/install.js +36 -0
- package/dist/features/registry.d.ts +26 -0
- package/dist/features/registry.js +49 -0
- package/dist/features/types.d.ts +88 -0
- package/dist/features/types.js +0 -0
- package/dist/features/validation.d.ts +8 -0
- package/dist/features/validation.js +14 -0
- package/dist/forms/docs/forms.docblock.d.ts +6 -0
- package/dist/forms/docs/forms.docblock.js +21 -0
- package/dist/forms/forms.d.ts +266 -0
- package/dist/forms/forms.js +143 -0
- package/dist/forms/index.d.ts +2 -0
- package/dist/forms/index.js +3 -0
- package/dist/index.d.ts +154 -0
- package/dist/index.js +132 -0
- package/dist/install.d.ts +77 -0
- package/dist/install.js +40 -0
- package/dist/integrations/binding.d.ts +17 -0
- package/dist/integrations/binding.js +0 -0
- package/dist/integrations/connection.d.ts +51 -0
- package/dist/integrations/connection.js +0 -0
- package/dist/integrations/docs/integrations.docblock.d.ts +6 -0
- package/dist/integrations/docs/integrations.docblock.js +94 -0
- package/dist/integrations/health.d.ts +21 -0
- package/dist/integrations/health.js +69 -0
- package/dist/integrations/index.d.ts +34 -0
- package/dist/integrations/index.js +23 -0
- package/dist/integrations/integrations.capability.d.ts +7 -0
- package/dist/integrations/integrations.capability.js +17 -0
- package/dist/integrations/integrations.feature.d.ts +11 -0
- package/dist/integrations/integrations.feature.js +67 -0
- package/dist/integrations/openbanking/contracts/accounts.d.ts +289 -0
- package/dist/integrations/openbanking/contracts/accounts.js +236 -0
- package/dist/integrations/openbanking/contracts/balances.d.ts +165 -0
- package/dist/integrations/openbanking/contracts/balances.js +166 -0
- package/dist/integrations/openbanking/contracts/index.d.ts +10 -0
- package/dist/integrations/openbanking/contracts/index.js +12 -0
- package/dist/integrations/openbanking/contracts/transactions.d.ts +213 -0
- package/dist/integrations/openbanking/contracts/transactions.js +217 -0
- package/dist/integrations/openbanking/guards.d.ts +12 -0
- package/dist/integrations/openbanking/guards.js +33 -0
- package/dist/integrations/openbanking/models.d.ts +228 -0
- package/dist/integrations/openbanking/models.js +240 -0
- package/dist/integrations/openbanking/openbanking.capability.d.ts +7 -0
- package/dist/integrations/openbanking/openbanking.capability.js +21 -0
- package/dist/integrations/openbanking/openbanking.feature.d.ts +11 -0
- package/dist/integrations/openbanking/openbanking.feature.js +76 -0
- package/dist/integrations/openbanking/telemetry.d.ts +15 -0
- package/dist/integrations/openbanking/telemetry.js +39 -0
- package/dist/integrations/operations.d.ts +437 -0
- package/dist/integrations/operations.js +392 -0
- package/dist/integrations/providers/calendar.d.ts +78 -0
- package/dist/integrations/providers/calendar.js +0 -0
- package/dist/integrations/providers/elevenlabs.d.ts +8 -0
- package/dist/integrations/providers/elevenlabs.js +56 -0
- package/dist/integrations/providers/email.d.ts +86 -0
- package/dist/integrations/providers/email.js +0 -0
- package/dist/integrations/providers/embedding.d.ts +24 -0
- package/dist/integrations/providers/embedding.js +0 -0
- package/dist/integrations/providers/gcs-storage.d.ts +8 -0
- package/dist/integrations/providers/gcs-storage.js +79 -0
- package/dist/integrations/providers/gmail.d.ts +8 -0
- package/dist/integrations/providers/gmail.js +91 -0
- package/dist/integrations/providers/google-calendar.d.ts +8 -0
- package/dist/integrations/providers/google-calendar.js +70 -0
- package/dist/integrations/providers/impls/elevenlabs-voice.d.ts +20 -0
- package/dist/integrations/providers/impls/elevenlabs-voice.js +95 -0
- package/dist/integrations/providers/impls/gcs-storage.d.ts +24 -0
- package/dist/integrations/providers/impls/gcs-storage.js +88 -0
- package/dist/integrations/providers/impls/gmail-inbound.d.ts +26 -0
- package/dist/integrations/providers/impls/gmail-inbound.js +200 -0
- package/dist/integrations/providers/impls/gmail-outbound.d.ts +18 -0
- package/dist/integrations/providers/impls/gmail-outbound.js +105 -0
- package/dist/integrations/providers/impls/google-calendar.d.ts +23 -0
- package/dist/integrations/providers/impls/google-calendar.js +154 -0
- package/dist/integrations/providers/impls/index.d.ts +15 -0
- package/dist/integrations/providers/impls/index.js +16 -0
- package/dist/integrations/providers/impls/mistral-embedding.d.ts +23 -0
- package/dist/integrations/providers/impls/mistral-embedding.js +41 -0
- package/dist/integrations/providers/impls/mistral-llm.d.ts +31 -0
- package/dist/integrations/providers/impls/mistral-llm.js +247 -0
- package/dist/integrations/providers/impls/postmark-email.d.ts +19 -0
- package/dist/integrations/providers/impls/postmark-email.js +55 -0
- package/dist/integrations/providers/impls/powens-client.d.ts +124 -0
- package/dist/integrations/providers/impls/powens-client.js +171 -0
- package/dist/integrations/providers/impls/powens-openbanking.d.ts +27 -0
- package/dist/integrations/providers/impls/powens-openbanking.js +218 -0
- package/dist/integrations/providers/impls/provider-factory.d.ts +26 -0
- package/dist/integrations/providers/impls/provider-factory.js +146 -0
- package/dist/integrations/providers/impls/qdrant-vector.d.ts +24 -0
- package/dist/integrations/providers/impls/qdrant-vector.js +69 -0
- package/dist/integrations/providers/impls/stripe-payments.d.ts +28 -0
- package/dist/integrations/providers/impls/stripe-payments.js +202 -0
- package/dist/integrations/providers/impls/twilio-sms.d.ts +20 -0
- package/dist/integrations/providers/impls/twilio-sms.js +58 -0
- package/dist/integrations/providers/index.d.ts +22 -0
- package/dist/integrations/providers/index.js +13 -0
- package/dist/integrations/providers/llm.d.ts +82 -0
- package/dist/integrations/providers/llm.js +0 -0
- package/dist/integrations/providers/mistral.d.ts +8 -0
- package/dist/integrations/providers/mistral.js +72 -0
- package/dist/integrations/providers/openbanking.d.ts +128 -0
- package/dist/integrations/providers/openbanking.js +0 -0
- package/dist/integrations/providers/payments.d.ts +109 -0
- package/dist/integrations/providers/payments.js +0 -0
- package/dist/integrations/providers/postmark.d.ts +8 -0
- package/dist/integrations/providers/postmark.js +72 -0
- package/dist/integrations/providers/powens.d.ts +8 -0
- package/dist/integrations/providers/powens.js +120 -0
- package/dist/integrations/providers/qdrant.d.ts +8 -0
- package/dist/integrations/providers/qdrant.js +77 -0
- package/dist/integrations/providers/registry.d.ts +11 -0
- package/dist/integrations/providers/registry.js +34 -0
- package/dist/integrations/providers/sms.d.ts +34 -0
- package/dist/integrations/providers/sms.js +0 -0
- package/dist/integrations/providers/storage.d.ts +60 -0
- package/dist/integrations/providers/storage.js +0 -0
- package/dist/integrations/providers/stripe.d.ts +8 -0
- package/dist/integrations/providers/stripe.js +87 -0
- package/dist/integrations/providers/twilio-sms.d.ts +8 -0
- package/dist/integrations/providers/twilio-sms.js +65 -0
- package/dist/integrations/providers/vector-store.d.ts +43 -0
- package/dist/integrations/providers/vector-store.js +0 -0
- package/dist/integrations/providers/voice.d.ts +34 -0
- package/dist/integrations/providers/voice.js +0 -0
- package/dist/integrations/runtime.d.ts +99 -0
- package/dist/integrations/runtime.js +186 -0
- package/dist/integrations/secrets/aws-secret-manager.d.ts +31 -0
- package/dist/integrations/secrets/aws-secret-manager.js +231 -0
- package/dist/integrations/secrets/env-secret-provider.d.ts +31 -0
- package/dist/integrations/secrets/env-secret-provider.js +81 -0
- package/dist/integrations/secrets/gcp-secret-manager.d.ts +32 -0
- package/dist/integrations/secrets/gcp-secret-manager.js +229 -0
- package/dist/integrations/secrets/index.d.ts +7 -0
- package/dist/integrations/secrets/index.js +8 -0
- package/dist/integrations/secrets/manager.d.ts +47 -0
- package/dist/integrations/secrets/manager.js +103 -0
- package/dist/integrations/secrets/provider.d.ts +52 -0
- package/dist/integrations/secrets/provider.js +58 -0
- package/dist/integrations/secrets/scaleway-secret-manager.d.ts +38 -0
- package/dist/integrations/secrets/scaleway-secret-manager.js +247 -0
- package/dist/integrations/secrets-types.d.ts +17 -0
- package/dist/integrations/secrets-types.js +0 -0
- package/dist/integrations/spec.d.ts +77 -0
- package/dist/integrations/spec.js +22 -0
- package/dist/jobs/define-job.d.ts +18 -0
- package/dist/jobs/define-job.js +16 -0
- package/dist/jobs/gcp-cloud-tasks.d.ts +41 -0
- package/dist/jobs/gcp-cloud-tasks.js +53 -0
- package/dist/jobs/gcp-pubsub.d.ts +25 -0
- package/dist/jobs/gcp-pubsub.js +39 -0
- package/dist/jobs/handlers/gmail-sync-handler.d.ts +9 -0
- package/dist/jobs/handlers/gmail-sync-handler.js +9 -0
- package/dist/jobs/handlers/index.d.ts +9 -0
- package/dist/jobs/handlers/index.js +12 -0
- package/dist/jobs/handlers/ping-handler.d.ts +10 -0
- package/dist/jobs/handlers/ping-handler.js +15 -0
- package/dist/jobs/handlers/storage-document-handler.d.ts +12 -0
- package/dist/jobs/handlers/storage-document-handler.js +14 -0
- package/dist/jobs/index.d.ts +3 -0
- package/dist/jobs/index.js +4 -0
- package/dist/jobs/memory-queue.d.ts +18 -0
- package/dist/jobs/memory-queue.js +71 -0
- package/dist/jobs/queue.d.ts +131 -0
- package/dist/jobs/queue.js +33 -0
- package/dist/jobs/scaleway-sqs-queue.d.ts +30 -0
- package/dist/jobs/scaleway-sqs-queue.js +153 -0
- package/dist/jsonschema.d.ts +42 -0
- package/dist/jsonschema.js +51 -0
- package/dist/knowledge/binding.d.ts +25 -0
- package/dist/knowledge/binding.js +0 -0
- package/dist/knowledge/docs/knowledge.docblock.d.ts +6 -0
- package/dist/knowledge/docs/knowledge.docblock.js +21 -0
- package/dist/knowledge/index.d.ts +11 -0
- package/dist/knowledge/index.js +10 -0
- package/dist/knowledge/ingestion/document-processor.d.ts +24 -0
- package/dist/knowledge/ingestion/document-processor.js +54 -0
- package/dist/knowledge/ingestion/embedding-service.d.ts +12 -0
- package/dist/knowledge/ingestion/embedding-service.js +25 -0
- package/dist/knowledge/ingestion/gmail-adapter.d.ts +18 -0
- package/dist/knowledge/ingestion/gmail-adapter.js +51 -0
- package/dist/knowledge/ingestion/index.d.ts +6 -0
- package/dist/knowledge/ingestion/index.js +7 -0
- package/dist/knowledge/ingestion/storage-adapter.d.ts +15 -0
- package/dist/knowledge/ingestion/storage-adapter.js +26 -0
- package/dist/knowledge/ingestion/vector-indexer.d.ts +18 -0
- package/dist/knowledge/ingestion/vector-indexer.js +32 -0
- package/dist/knowledge/knowledge.capability.d.ts +7 -0
- package/dist/knowledge/knowledge.capability.js +21 -0
- package/dist/knowledge/knowledge.feature.d.ts +11 -0
- package/dist/knowledge/knowledge.feature.js +68 -0
- package/dist/knowledge/operations.d.ts +318 -0
- package/dist/knowledge/operations.js +321 -0
- package/dist/knowledge/query/index.d.ts +2 -0
- package/dist/knowledge/query/index.js +3 -0
- package/dist/knowledge/query/service.d.ts +29 -0
- package/dist/knowledge/query/service.js +65 -0
- package/dist/knowledge/runtime.d.ts +32 -0
- package/dist/knowledge/runtime.js +49 -0
- package/dist/knowledge/source.d.ts +32 -0
- package/dist/knowledge/source.js +0 -0
- package/dist/knowledge/spaces/email-threads.d.ts +7 -0
- package/dist/knowledge/spaces/email-threads.js +37 -0
- package/dist/knowledge/spaces/financial-docs.d.ts +7 -0
- package/dist/knowledge/spaces/financial-docs.js +37 -0
- package/dist/knowledge/spaces/financial-overview.d.ts +7 -0
- package/dist/knowledge/spaces/financial-overview.js +41 -0
- package/dist/knowledge/spaces/index.d.ts +7 -0
- package/dist/knowledge/spaces/index.js +8 -0
- package/dist/knowledge/spaces/product-canon.d.ts +7 -0
- package/dist/knowledge/spaces/product-canon.js +37 -0
- package/dist/knowledge/spaces/support-faq.d.ts +7 -0
- package/dist/knowledge/spaces/support-faq.js +40 -0
- package/dist/knowledge/spaces/uploaded-docs.d.ts +7 -0
- package/dist/knowledge/spaces/uploaded-docs.js +37 -0
- package/dist/knowledge/spec.d.ts +46 -0
- package/dist/knowledge/spec.js +17 -0
- package/dist/llm/exporters.d.ts +70 -0
- package/dist/llm/exporters.js +542 -0
- package/dist/llm/index.d.ts +4 -0
- package/dist/llm/index.js +4 -0
- package/dist/llm/prompts.d.ts +52 -0
- package/dist/llm/prompts.js +410 -0
- package/dist/llm/types.d.ts +215 -0
- package/dist/llm/types.js +0 -0
- package/dist/markdown.d.ts +22 -0
- package/dist/markdown.js +119 -0
- package/dist/migrations.d.ts +52 -0
- package/dist/migrations.js +31 -0
- package/dist/model-registry.d.ts +13 -0
- package/dist/model-registry.js +33 -0
- package/dist/onboarding-base.d.ts +138 -0
- package/dist/onboarding-base.js +195 -0
- package/dist/openapi.d.ts +31 -0
- package/dist/openapi.js +82 -0
- package/dist/operations/index.d.ts +3 -0
- package/dist/operations/index.js +4 -0
- package/dist/operations/operation.d.ts +186 -0
- package/dist/operations/operation.js +35 -0
- package/dist/operations/registry.d.ts +54 -0
- package/dist/operations/registry.js +176 -0
- package/dist/ownership.d.ts +84 -0
- package/dist/ownership.js +38 -0
- package/dist/policy/docs/policy.docblock.d.ts +6 -0
- package/dist/policy/docs/policy.docblock.js +21 -0
- package/dist/policy/engine.d.ts +40 -0
- package/dist/policy/engine.js +225 -0
- package/dist/policy/index.d.ts +5 -0
- package/dist/policy/index.js +5 -0
- package/dist/policy/opa-adapter.d.ts +45 -0
- package/dist/policy/opa-adapter.js +71 -0
- package/dist/policy/registry.d.ts +9 -0
- package/dist/policy/registry.js +11 -0
- package/dist/policy/spec.d.ts +103 -0
- package/dist/policy/spec.js +0 -0
- package/dist/presentations/docs/presentations-conventions.docblock.d.ts +6 -0
- package/dist/presentations/docs/presentations-conventions.docblock.js +21 -0
- package/dist/presentations/index.d.ts +4 -0
- package/dist/presentations/index.js +5 -0
- package/dist/presentations/presentations.d.ts +50 -0
- package/dist/presentations/presentations.js +7 -0
- package/dist/presentations/registry.d.ts +10 -0
- package/dist/presentations/registry.js +12 -0
- package/dist/presentations/transform-engine.d.ts +66 -0
- package/dist/presentations/transform-engine.js +282 -0
- package/dist/prompt.d.ts +53 -0
- package/dist/prompt.js +10 -0
- package/dist/promptRegistry.d.ts +15 -0
- package/dist/promptRegistry.js +31 -0
- package/dist/regenerator/adapters.d.ts +19 -0
- package/dist/regenerator/adapters.js +0 -0
- package/dist/regenerator/docs/regenerator.docblock.d.ts +6 -0
- package/dist/regenerator/docs/regenerator.docblock.js +21 -0
- package/dist/regenerator/executor.d.ts +70 -0
- package/dist/regenerator/executor.js +86 -0
- package/dist/regenerator/index.d.ts +7 -0
- package/dist/regenerator/index.js +6 -0
- package/dist/regenerator/service.d.ts +33 -0
- package/dist/regenerator/service.js +93 -0
- package/dist/regenerator/sinks.d.ts +26 -0
- package/dist/regenerator/sinks.js +32 -0
- package/dist/regenerator/types.d.ts +107 -0
- package/dist/regenerator/types.js +0 -0
- package/dist/regenerator/utils.d.ts +9 -0
- package/dist/regenerator/utils.js +51 -0
- package/dist/registry-utils.d.ts +106 -0
- package/dist/registry-utils.js +122 -0
- package/dist/registry.d.ts +32 -0
- package/dist/registry.js +61 -0
- package/dist/resources.d.ts +64 -0
- package/dist/resources.js +50 -0
- package/dist/schema-to-markdown.d.ts +54 -0
- package/dist/schema-to-markdown.js +217 -0
- package/dist/server/contracts-adapter-hydration.d.ts +15 -0
- package/dist/server/contracts-adapter-hydration.js +41 -0
- package/dist/server/contracts-adapter-input.d.ts +9 -0
- package/dist/server/contracts-adapter-input.js +83 -0
- package/dist/server/graphql-pothos.d.ts +31 -0
- package/dist/server/graphql-pothos.js +134 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +10 -0
- package/dist/server/mcp/createMcpServer.d.ts +15 -0
- package/dist/server/mcp/createMcpServer.js +27 -0
- package/dist/server/mcp/mcpTypes.d.ts +27 -0
- package/dist/server/mcp/mcpTypes.js +0 -0
- package/dist/server/mcp/registerPresentations.d.ts +7 -0
- package/dist/server/mcp/registerPresentations.js +54 -0
- package/dist/server/mcp/registerPrompts.d.ts +8 -0
- package/dist/server/mcp/registerPrompts.js +41 -0
- package/dist/server/mcp/registerResources.d.ts +8 -0
- package/dist/server/mcp/registerResources.js +35 -0
- package/dist/server/mcp/registerTools.d.ts +8 -0
- package/dist/server/mcp/registerTools.js +22 -0
- package/dist/server/provider-mcp.d.ts +2 -0
- package/dist/server/provider-mcp.js +3 -0
- package/dist/server/rest-elysia.d.ts +40 -0
- package/dist/server/rest-elysia.js +20 -0
- package/dist/server/rest-express.d.ts +16 -0
- package/dist/server/rest-express.js +36 -0
- package/dist/server/rest-generic.d.ts +32 -0
- package/dist/server/rest-generic.js +124 -0
- package/dist/server/rest-next-app.d.ts +35 -0
- package/dist/server/rest-next-app.js +38 -0
- package/dist/server/rest-next-mcp.d.ts +11 -0
- package/dist/server/rest-next-mcp.js +45 -0
- package/dist/server/rest-next-pages.d.ts +9 -0
- package/dist/server/rest-next-pages.js +22 -0
- package/dist/telemetry/anomaly.d.ts +27 -0
- package/dist/telemetry/anomaly.js +48 -0
- package/dist/telemetry/docs/telemetry.docblock.d.ts +6 -0
- package/dist/telemetry/docs/telemetry.docblock.js +21 -0
- package/dist/telemetry/index.d.ts +4 -0
- package/dist/telemetry/index.js +5 -0
- package/dist/telemetry/spec.d.ts +91 -0
- package/dist/telemetry/spec.js +42 -0
- package/dist/telemetry/tracker.d.ts +51 -0
- package/dist/telemetry/tracker.js +76 -0
- package/dist/tests/index.d.ts +3 -0
- package/dist/tests/index.js +4 -0
- package/dist/tests/runner.d.ts +43 -0
- package/dist/tests/runner.js +150 -0
- package/dist/tests/spec.d.ts +82 -0
- package/dist/tests/spec.js +34 -0
- package/dist/themes.d.ts +51 -0
- package/dist/themes.js +17 -0
- package/dist/translations/catalog.d.ts +28 -0
- package/dist/translations/catalog.js +0 -0
- package/dist/translations/tenant.d.ts +15 -0
- package/dist/translations/tenant.js +0 -0
- package/dist/types.d.ts +92 -0
- package/dist/types.js +0 -0
- package/dist/versioning/index.d.ts +3 -0
- package/dist/versioning/index.js +4 -0
- package/dist/versioning/types.d.ts +127 -0
- package/dist/versioning/types.js +24 -0
- package/dist/versioning/utils.d.ts +95 -0
- package/dist/versioning/utils.js +180 -0
- package/dist/workflow/adapters/db-adapter.d.ts +46 -0
- package/dist/workflow/adapters/db-adapter.js +83 -0
- package/dist/workflow/adapters/file-adapter.d.ts +14 -0
- package/dist/workflow/adapters/file-adapter.js +11 -0
- package/dist/workflow/adapters/index.d.ts +4 -0
- package/dist/workflow/adapters/index.js +5 -0
- package/dist/workflow/adapters/memory-store.d.ts +18 -0
- package/dist/workflow/adapters/memory-store.js +58 -0
- package/dist/workflow/expression.d.ts +9 -0
- package/dist/workflow/expression.js +99 -0
- package/dist/workflow/index.d.ts +17 -0
- package/dist/workflow/index.js +16 -0
- package/dist/workflow/overview.docblock.d.ts +6 -0
- package/dist/workflow/overview.docblock.js +21 -0
- package/dist/workflow/runner.d.ts +77 -0
- package/dist/workflow/runner.js +337 -0
- package/dist/workflow/sla-monitor.d.ts +20 -0
- package/dist/workflow/sla-monitor.js +47 -0
- package/dist/workflow/spec.d.ts +93 -0
- package/dist/workflow/spec.js +11 -0
- package/dist/workflow/state.d.ts +35 -0
- package/dist/workflow/state.js +0 -0
- package/dist/workflow/validation.d.ts +29 -0
- package/dist/workflow/validation.js +176 -0
- package/dist/workspace-config/contractsrc-schema.d.ts +1162 -0
- package/dist/workspace-config/contractsrc-schema.js +421 -0
- package/dist/workspace-config/index.d.ts +2 -0
- package/dist/workspace-config/index.js +3 -0
- package/dist/workspace-config/workspace-config.docblock.d.ts +6 -0
- package/dist/workspace-config/workspace-config.docblock.js +45 -0
- package/package.json +618 -0
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
import { operationSpecToAgentPrompt, operationSpecToFullMarkdown } from "./exporters.js";
|
|
2
|
+
|
|
3
|
+
//#region src/llm/prompts.ts
|
|
4
|
+
/**
|
|
5
|
+
* System prompts for different agent types.
|
|
6
|
+
*/
|
|
7
|
+
const AGENT_SYSTEM_PROMPTS = {
|
|
8
|
+
"claude-code": `You are an expert TypeScript developer working with ContractSpec, a spec-first development framework.
|
|
9
|
+
|
|
10
|
+
Your code follows these principles:
|
|
11
|
+
- Type-safe with comprehensive TypeScript types (no \`any\`)
|
|
12
|
+
- Well-documented with JSDoc comments
|
|
13
|
+
- Production-ready with proper error handling
|
|
14
|
+
- Following SOLID principles and clean code practices
|
|
15
|
+
- Modular and testable
|
|
16
|
+
|
|
17
|
+
When implementing specs:
|
|
18
|
+
1. Validate input against the schema before processing
|
|
19
|
+
2. Handle all error cases defined in the spec
|
|
20
|
+
3. Emit events as specified in sideEffects
|
|
21
|
+
4. Respect policy constraints (auth, rate limits, PII handling)
|
|
22
|
+
5. Follow the acceptance scenarios as your implementation guide
|
|
23
|
+
|
|
24
|
+
Generate clean, idiomatic TypeScript that exactly matches the specification.`,
|
|
25
|
+
"cursor-cli": `You are implementing features for a ContractSpec-driven codebase.
|
|
26
|
+
|
|
27
|
+
ContractSpec is a spec-first framework where specifications define:
|
|
28
|
+
- Operations (commands and queries) with typed I/O
|
|
29
|
+
- Events that operations emit
|
|
30
|
+
- Presentations for UI components
|
|
31
|
+
- Features that group related specs
|
|
32
|
+
|
|
33
|
+
When working with specs:
|
|
34
|
+
- Read the spec carefully before implementing
|
|
35
|
+
- Match the input/output types exactly
|
|
36
|
+
- Implement all error cases
|
|
37
|
+
- Follow the acceptance scenarios
|
|
38
|
+
- Respect policy constraints
|
|
39
|
+
|
|
40
|
+
Use the project's existing patterns and conventions.`,
|
|
41
|
+
"generic-mcp": `You are a code generation assistant working with ContractSpec specifications.
|
|
42
|
+
|
|
43
|
+
ContractSpec specs define:
|
|
44
|
+
- meta: name, version, kind (command/query), description, goal, context
|
|
45
|
+
- io: input schema, output schema, error definitions
|
|
46
|
+
- policy: auth level, rate limits, feature flags, PII handling
|
|
47
|
+
- sideEffects: events to emit, analytics, audit
|
|
48
|
+
- acceptance: scenarios and examples
|
|
49
|
+
|
|
50
|
+
Your task is to generate or modify code that complies with the given specification.
|
|
51
|
+
Follow the spec exactly and handle all defined cases.`
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Generate an implementation prompt for a specific agent type.
|
|
55
|
+
*/
|
|
56
|
+
function generateImplementationPrompt(spec, agent, options) {
|
|
57
|
+
const systemPrompt = AGENT_SYSTEM_PROMPTS[agent];
|
|
58
|
+
const specMarkdown = operationSpecToFullMarkdown(spec);
|
|
59
|
+
let taskPrompt;
|
|
60
|
+
if (agent === "claude-code") taskPrompt = `## Implementation Task
|
|
61
|
+
|
|
62
|
+
Implement the following ContractSpec operation:
|
|
63
|
+
|
|
64
|
+
${specMarkdown}
|
|
65
|
+
|
|
66
|
+
${options?.targetPath ? `**Target file:** \`${options.targetPath}\`\n` : ""}
|
|
67
|
+
${options?.existingCode ? `**Existing code to modify:**\n\`\`\`typescript\n${options.existingCode}\n\`\`\`\n` : ""}
|
|
68
|
+
|
|
69
|
+
Generate a complete, production-ready TypeScript implementation that:
|
|
70
|
+
1. Exports a handler function matching the spec signature
|
|
71
|
+
2. Validates input using the schema
|
|
72
|
+
3. Handles all defined error cases
|
|
73
|
+
4. Emits events as specified
|
|
74
|
+
5. Includes JSDoc documentation
|
|
75
|
+
|
|
76
|
+
Provide ONLY the TypeScript code.`;
|
|
77
|
+
else if (agent === "cursor-cli") taskPrompt = `Implement this ContractSpec operation.
|
|
78
|
+
|
|
79
|
+
${specMarkdown}
|
|
80
|
+
|
|
81
|
+
${options?.targetPath ? `Target: ${options.targetPath}\n` : ""}
|
|
82
|
+
|
|
83
|
+
Requirements:
|
|
84
|
+
- TypeScript with strict types
|
|
85
|
+
- Handle all error cases
|
|
86
|
+
- Emit specified events
|
|
87
|
+
- Follow acceptance scenarios`;
|
|
88
|
+
else taskPrompt = operationSpecToAgentPrompt(spec, {
|
|
89
|
+
taskType: "implement",
|
|
90
|
+
existingCode: options?.existingCode
|
|
91
|
+
});
|
|
92
|
+
return {
|
|
93
|
+
agent,
|
|
94
|
+
systemPrompt,
|
|
95
|
+
taskPrompt
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Generate a test generation prompt.
|
|
100
|
+
*/
|
|
101
|
+
function generateTestPrompt(spec, agent, options) {
|
|
102
|
+
const framework = options?.testFramework ?? "vitest";
|
|
103
|
+
const taskPrompt = `## Test Generation Task
|
|
104
|
+
|
|
105
|
+
Generate comprehensive tests for this specification:
|
|
106
|
+
|
|
107
|
+
${operationSpecToFullMarkdown(spec)}
|
|
108
|
+
|
|
109
|
+
${options?.implementationCode ? `**Implementation:**\n\`\`\`typescript\n${options.implementationCode}\n\`\`\`\n` : ""}
|
|
110
|
+
|
|
111
|
+
**Test Framework:** ${framework}
|
|
112
|
+
|
|
113
|
+
Generate tests that:
|
|
114
|
+
1. Cover all acceptance scenarios from the spec
|
|
115
|
+
2. Test all defined error cases
|
|
116
|
+
3. Verify input validation
|
|
117
|
+
4. Check event emissions
|
|
118
|
+
5. Test edge cases
|
|
119
|
+
|
|
120
|
+
Use descriptive test names: "should [behavior] when [condition]"
|
|
121
|
+
|
|
122
|
+
Provide a complete test file.`;
|
|
123
|
+
return {
|
|
124
|
+
agent,
|
|
125
|
+
systemPrompt: AGENT_SYSTEM_PROMPTS[agent],
|
|
126
|
+
taskPrompt
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Generate a code review prompt.
|
|
131
|
+
*/
|
|
132
|
+
function generateReviewPrompt(spec, agent, implementationCode) {
|
|
133
|
+
const taskPrompt = `## Code Review Task
|
|
134
|
+
|
|
135
|
+
Review this implementation against its specification:
|
|
136
|
+
|
|
137
|
+
**Specification:**
|
|
138
|
+
${operationSpecToFullMarkdown(spec)}
|
|
139
|
+
|
|
140
|
+
**Implementation:**
|
|
141
|
+
\`\`\`typescript
|
|
142
|
+
${implementationCode}
|
|
143
|
+
\`\`\`
|
|
144
|
+
|
|
145
|
+
Provide a structured review:
|
|
146
|
+
|
|
147
|
+
### Compliance Check
|
|
148
|
+
- [ ] Input types match spec
|
|
149
|
+
- [ ] Output types match spec
|
|
150
|
+
- [ ] All error cases handled
|
|
151
|
+
- [ ] Events emitted correctly
|
|
152
|
+
- [ ] Policy constraints respected
|
|
153
|
+
|
|
154
|
+
### Issues Found
|
|
155
|
+
List any issues with severity (error/warning/info)
|
|
156
|
+
|
|
157
|
+
### Suggestions
|
|
158
|
+
List improvements and recommendations
|
|
159
|
+
|
|
160
|
+
Be thorough and precise. Focus on spec compliance first, then code quality.`;
|
|
161
|
+
return {
|
|
162
|
+
agent,
|
|
163
|
+
systemPrompt: AGENT_SYSTEM_PROMPTS[agent],
|
|
164
|
+
taskPrompt
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Generate a verification prompt for AI-powered semantic review.
|
|
169
|
+
*/
|
|
170
|
+
function generateVerificationPrompt(spec, implementationCode) {
|
|
171
|
+
return {
|
|
172
|
+
agent: "generic-mcp",
|
|
173
|
+
taskPrompt: `## Semantic Verification Task
|
|
174
|
+
|
|
175
|
+
Verify that this implementation fulfills the specification's intent.
|
|
176
|
+
|
|
177
|
+
**Specification:**
|
|
178
|
+
${operationSpecToFullMarkdown(spec)}
|
|
179
|
+
|
|
180
|
+
**Implementation:**
|
|
181
|
+
\`\`\`typescript
|
|
182
|
+
${implementationCode}
|
|
183
|
+
\`\`\`
|
|
184
|
+
|
|
185
|
+
Analyze and respond with JSON:
|
|
186
|
+
|
|
187
|
+
\`\`\`json
|
|
188
|
+
{
|
|
189
|
+
"passed": true/false,
|
|
190
|
+
"score": 0-100,
|
|
191
|
+
"compliance": {
|
|
192
|
+
"inputTypes": { "match": true/false, "issues": [] },
|
|
193
|
+
"outputTypes": { "match": true/false, "issues": [] },
|
|
194
|
+
"errorHandling": { "coverage": "full/partial/none", "missing": [] },
|
|
195
|
+
"eventEmission": { "correct": true/false, "issues": [] },
|
|
196
|
+
"policyCompliance": { "auth": true/false, "rateLimit": true/false, "pii": true/false }
|
|
197
|
+
},
|
|
198
|
+
"scenarios": [
|
|
199
|
+
{ "name": "scenario name", "covered": true/false, "notes": "" }
|
|
200
|
+
],
|
|
201
|
+
"issues": [
|
|
202
|
+
{ "severity": "error/warning/info", "category": "type/export/import/scenario/error_handling/semantic", "message": "", "suggestion": "" }
|
|
203
|
+
],
|
|
204
|
+
"summary": "Brief summary of verification results"
|
|
205
|
+
}
|
|
206
|
+
\`\`\``
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Generate a feature implementation plan.
|
|
211
|
+
*/
|
|
212
|
+
function generateImplementationPlan(spec, options) {
|
|
213
|
+
const m = spec.meta;
|
|
214
|
+
const fileStructure = [];
|
|
215
|
+
const basePath = options?.projectRoot ?? "src";
|
|
216
|
+
const specPath = m.key.replace(/\./g, "/");
|
|
217
|
+
if (m.kind === "command" || m.kind === "query") fileStructure.push({
|
|
218
|
+
path: `${basePath}/${specPath}/handler.ts`,
|
|
219
|
+
purpose: "Main handler implementation",
|
|
220
|
+
type: "create"
|
|
221
|
+
}, {
|
|
222
|
+
path: `${basePath}/${specPath}/types.ts`,
|
|
223
|
+
purpose: "Type definitions",
|
|
224
|
+
type: "create"
|
|
225
|
+
}, {
|
|
226
|
+
path: `${basePath}/${specPath}/handler.test.ts`,
|
|
227
|
+
purpose: "Handler tests",
|
|
228
|
+
type: "create"
|
|
229
|
+
});
|
|
230
|
+
const steps = [];
|
|
231
|
+
let order = 1;
|
|
232
|
+
steps.push({
|
|
233
|
+
order: order++,
|
|
234
|
+
title: "Define Types",
|
|
235
|
+
description: "Create TypeScript types for input, output, and internal data structures",
|
|
236
|
+
acceptanceCriteria: [
|
|
237
|
+
"Input type matches spec schema exactly",
|
|
238
|
+
"Output type matches spec schema exactly",
|
|
239
|
+
"Error types defined for all error cases"
|
|
240
|
+
]
|
|
241
|
+
});
|
|
242
|
+
steps.push({
|
|
243
|
+
order: order++,
|
|
244
|
+
title: "Implement Input Validation",
|
|
245
|
+
description: "Add validation logic for the input payload",
|
|
246
|
+
acceptanceCriteria: [
|
|
247
|
+
"All required fields are validated",
|
|
248
|
+
"Type constraints are enforced",
|
|
249
|
+
"Validation errors return appropriate error codes"
|
|
250
|
+
]
|
|
251
|
+
});
|
|
252
|
+
steps.push({
|
|
253
|
+
order: order++,
|
|
254
|
+
title: "Implement Core Logic",
|
|
255
|
+
description: "Implement the main business logic of the operation",
|
|
256
|
+
acceptanceCriteria: spec.acceptance?.scenarios?.map((s) => s.key) ?? ["Operation completes successfully for valid input"]
|
|
257
|
+
});
|
|
258
|
+
if (spec.io.errors && Object.keys(spec.io.errors).length > 0) steps.push({
|
|
259
|
+
order: order++,
|
|
260
|
+
title: "Implement Error Handling",
|
|
261
|
+
description: "Handle all defined error cases",
|
|
262
|
+
acceptanceCriteria: Object.entries(spec.io.errors).map(([code, err]) => `Handle ${code}: ${err.when}`)
|
|
263
|
+
});
|
|
264
|
+
if (spec.sideEffects?.emits?.length) steps.push({
|
|
265
|
+
order: order++,
|
|
266
|
+
title: "Implement Event Emission",
|
|
267
|
+
description: "Emit events as specified",
|
|
268
|
+
acceptanceCriteria: spec.sideEffects.emits.map((e) => {
|
|
269
|
+
if ("ref" in e) return `Emit ${e.ref.key}.v${e.ref.version} when ${e.when}`;
|
|
270
|
+
return `Emit ${e.key}.v${e.version} when ${e.when}`;
|
|
271
|
+
})
|
|
272
|
+
});
|
|
273
|
+
steps.push({
|
|
274
|
+
order: order++,
|
|
275
|
+
title: "Write Tests",
|
|
276
|
+
description: "Create comprehensive test suite",
|
|
277
|
+
acceptanceCriteria: [
|
|
278
|
+
"All acceptance scenarios covered",
|
|
279
|
+
"All error cases tested",
|
|
280
|
+
"Edge cases handled",
|
|
281
|
+
"Events verified"
|
|
282
|
+
]
|
|
283
|
+
});
|
|
284
|
+
const constraints = {
|
|
285
|
+
policy: [],
|
|
286
|
+
security: [],
|
|
287
|
+
pii: []
|
|
288
|
+
};
|
|
289
|
+
constraints.policy.push(`Auth level: ${spec.policy.auth}`);
|
|
290
|
+
if (spec.policy.idempotent !== void 0) constraints.policy.push(`Idempotent: ${spec.policy.idempotent}`);
|
|
291
|
+
if (spec.policy.rateLimit) constraints.policy.push(`Rate limit: ${spec.policy.rateLimit.rpm} rpm per ${spec.policy.rateLimit.key}`);
|
|
292
|
+
if (spec.policy.flags?.length) constraints.policy.push(`Feature flags required: ${spec.policy.flags.join(", ")}`);
|
|
293
|
+
if (spec.policy.escalate) constraints.security.push(`Escalation required: ${spec.policy.escalate}`);
|
|
294
|
+
if (spec.policy.pii?.length) constraints.pii = spec.policy.pii;
|
|
295
|
+
return {
|
|
296
|
+
target: {
|
|
297
|
+
type: "spec",
|
|
298
|
+
key: m.key,
|
|
299
|
+
version: m.version
|
|
300
|
+
},
|
|
301
|
+
context: {
|
|
302
|
+
goal: m.goal,
|
|
303
|
+
description: m.description,
|
|
304
|
+
background: m.context
|
|
305
|
+
},
|
|
306
|
+
specMarkdown: operationSpecToFullMarkdown(spec),
|
|
307
|
+
fileStructure,
|
|
308
|
+
steps,
|
|
309
|
+
constraints,
|
|
310
|
+
verificationChecklist: [
|
|
311
|
+
"Input validation works for all cases",
|
|
312
|
+
"Output matches expected schema",
|
|
313
|
+
"All error cases return correct codes",
|
|
314
|
+
"Events are emitted with correct payloads",
|
|
315
|
+
"Auth requirements are enforced",
|
|
316
|
+
"Rate limiting is applied (if applicable)",
|
|
317
|
+
"PII fields are handled correctly",
|
|
318
|
+
"All acceptance scenarios pass",
|
|
319
|
+
"Tests provide adequate coverage"
|
|
320
|
+
]
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Format an implementation plan for a specific agent.
|
|
325
|
+
*/
|
|
326
|
+
function formatPlanForAgent(plan, agent) {
|
|
327
|
+
let taskPrompt;
|
|
328
|
+
if (agent === "claude-code") taskPrompt = `## Implementation Plan: ${plan.target.key}.v${plan.target.version}
|
|
329
|
+
|
|
330
|
+
### Context
|
|
331
|
+
**Goal:** ${plan.context.goal}
|
|
332
|
+
|
|
333
|
+
**Background:** ${plan.context.background}
|
|
334
|
+
|
|
335
|
+
### Specification
|
|
336
|
+
${plan.specMarkdown}
|
|
337
|
+
|
|
338
|
+
### File Structure
|
|
339
|
+
${plan.fileStructure.map((f) => `- \`${f.path}\` (${f.type}): ${f.purpose}`).join("\n")}
|
|
340
|
+
|
|
341
|
+
### Implementation Steps
|
|
342
|
+
${plan.steps.map((s) => `
|
|
343
|
+
#### Step ${s.order}: ${s.title}
|
|
344
|
+
${s.description}
|
|
345
|
+
|
|
346
|
+
**Acceptance Criteria:**
|
|
347
|
+
${s.acceptanceCriteria.map((c) => `- [ ] ${c}`).join("\n")}
|
|
348
|
+
`).join("\n")}
|
|
349
|
+
|
|
350
|
+
### Constraints
|
|
351
|
+
${plan.constraints.policy.length ? `**Policy:**\n${plan.constraints.policy.map((p) => `- ${p}`).join("\n")}\n` : ""}
|
|
352
|
+
${plan.constraints.security.length ? `**Security:**\n${plan.constraints.security.map((s) => `- ${s}`).join("\n")}\n` : ""}
|
|
353
|
+
${plan.constraints.pii.length ? `**PII Handling:**\n${plan.constraints.pii.map((p) => `- ${p}`).join("\n")}\n` : ""}
|
|
354
|
+
|
|
355
|
+
### Verification Checklist
|
|
356
|
+
${plan.verificationChecklist.map((c) => `- [ ] ${c}`).join("\n")}
|
|
357
|
+
|
|
358
|
+
Implement this plan step by step.`;
|
|
359
|
+
else if (agent === "cursor-cli") taskPrompt = `# ${plan.target.key}.v${plan.target.version}
|
|
360
|
+
|
|
361
|
+
${plan.context.goal}
|
|
362
|
+
|
|
363
|
+
## Spec
|
|
364
|
+
${plan.specMarkdown}
|
|
365
|
+
|
|
366
|
+
## Files to create
|
|
367
|
+
${plan.fileStructure.map((f) => `${f.type}: ${f.path}`).join("\n")}
|
|
368
|
+
|
|
369
|
+
## Steps
|
|
370
|
+
${plan.steps.map((s) => `${s.order}. ${s.title}`).join("\n")}`;
|
|
371
|
+
else taskPrompt = `Implementation plan for ${plan.target.key}.v${plan.target.version}
|
|
372
|
+
|
|
373
|
+
${plan.specMarkdown}
|
|
374
|
+
|
|
375
|
+
Steps:
|
|
376
|
+
${plan.steps.map((s) => `${s.order}. ${s.title}: ${s.description}`).join("\n")}`;
|
|
377
|
+
return {
|
|
378
|
+
agent,
|
|
379
|
+
systemPrompt: AGENT_SYSTEM_PROMPTS[agent],
|
|
380
|
+
taskPrompt
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Generate a fix violations prompt after verification.
|
|
385
|
+
*/
|
|
386
|
+
function generateFixViolationsPrompt(spec, implementationCode, violations) {
|
|
387
|
+
return {
|
|
388
|
+
agent: "generic-mcp",
|
|
389
|
+
taskPrompt: `## Fix Specification Violations
|
|
390
|
+
|
|
391
|
+
The following implementation has violations against its specification:
|
|
392
|
+
|
|
393
|
+
**Specification:**
|
|
394
|
+
${operationSpecToFullMarkdown(spec)}
|
|
395
|
+
|
|
396
|
+
**Current Implementation:**
|
|
397
|
+
\`\`\`typescript
|
|
398
|
+
${implementationCode}
|
|
399
|
+
\`\`\`
|
|
400
|
+
|
|
401
|
+
**Violations Found:**
|
|
402
|
+
${violations.map((v, i) => `${i + 1}. ${v.message}${v.suggestion ? `\n Suggestion: ${v.suggestion}` : ""}`).join("\n")}
|
|
403
|
+
|
|
404
|
+
Fix ALL violations while maintaining existing functionality.
|
|
405
|
+
Provide the corrected implementation.`
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
//#endregion
|
|
410
|
+
export { AGENT_SYSTEM_PROMPTS, formatPlanForAgent, generateFixViolationsPrompt, generateImplementationPlan, generateImplementationPrompt, generateReviewPrompt, generateTestPrompt, generateVerificationPrompt };
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { DocBlock } from "../docs/types.js";
|
|
2
|
+
import { PresentationSpec } from "../presentations/presentations.js";
|
|
3
|
+
import { AnyOperationSpec } from "../operations/operation.js";
|
|
4
|
+
import "../operations/index.js";
|
|
5
|
+
import { FeatureModuleSpec } from "../features/types.js";
|
|
6
|
+
import "../features/index.js";
|
|
7
|
+
import { EventSpec } from "../events.js";
|
|
8
|
+
import { AnySchemaModel } from "@contractspec/lib.schema";
|
|
9
|
+
|
|
10
|
+
//#region src/llm/types.d.ts
|
|
11
|
+
|
|
12
|
+
/** Supported export formats for LLM consumption */
|
|
13
|
+
type LLMExportFormat = 'context' | 'full' | 'prompt';
|
|
14
|
+
/** Supported agent types for implementation guidance */
|
|
15
|
+
type AgentType = 'claude-code' | 'cursor-cli' | 'generic-mcp';
|
|
16
|
+
/** Verification tiers */
|
|
17
|
+
type VerificationTier = 'structure' | 'behavior' | 'ai_review';
|
|
18
|
+
/** Options for exporting specs to markdown */
|
|
19
|
+
interface SpecExportOptions {
|
|
20
|
+
/** Export format: context (summary), full (all details), prompt (actionable) */
|
|
21
|
+
format: LLMExportFormat;
|
|
22
|
+
/** Include JSON Schema for I/O types */
|
|
23
|
+
includeSchemas?: boolean;
|
|
24
|
+
/** Include acceptance scenarios */
|
|
25
|
+
includeScenarios?: boolean;
|
|
26
|
+
/** Include examples */
|
|
27
|
+
includeExamples?: boolean;
|
|
28
|
+
/** Include policy details */
|
|
29
|
+
includePolicy?: boolean;
|
|
30
|
+
/** Include side effects (events, analytics) */
|
|
31
|
+
includeSideEffects?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** Options for exporting features to markdown */
|
|
34
|
+
interface FeatureExportOptions extends SpecExportOptions {
|
|
35
|
+
/** Include related specs inline */
|
|
36
|
+
includeRelatedSpecs?: boolean;
|
|
37
|
+
/** Include related events inline */
|
|
38
|
+
includeRelatedEvents?: boolean;
|
|
39
|
+
/** Include related presentations inline */
|
|
40
|
+
includeRelatedPresentations?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/** Result of spec export */
|
|
43
|
+
interface SpecExportResult {
|
|
44
|
+
/** The spec that was exported */
|
|
45
|
+
spec: AnyOperationSpec;
|
|
46
|
+
/** Generated markdown content */
|
|
47
|
+
markdown: string;
|
|
48
|
+
/** Export format used */
|
|
49
|
+
format: LLMExportFormat;
|
|
50
|
+
/** Metadata about the export */
|
|
51
|
+
meta: {
|
|
52
|
+
specName: string;
|
|
53
|
+
specVersion: string;
|
|
54
|
+
exportedAt: string;
|
|
55
|
+
wordCount: number;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** Result of feature export */
|
|
59
|
+
interface FeatureExportResult {
|
|
60
|
+
/** The feature that was exported */
|
|
61
|
+
feature: FeatureModuleSpec;
|
|
62
|
+
/** Generated markdown content */
|
|
63
|
+
markdown: string;
|
|
64
|
+
/** Export format used */
|
|
65
|
+
format: LLMExportFormat;
|
|
66
|
+
/** Included specs */
|
|
67
|
+
includedSpecs: string[];
|
|
68
|
+
/** Included events */
|
|
69
|
+
includedEvents: string[];
|
|
70
|
+
/** Included presentations */
|
|
71
|
+
includedPresentations: string[];
|
|
72
|
+
}
|
|
73
|
+
/** Implementation plan generated for agents */
|
|
74
|
+
interface ImplementationPlan {
|
|
75
|
+
/** Feature/spec being implemented */
|
|
76
|
+
target: {
|
|
77
|
+
type: 'spec' | 'feature' | 'presentation';
|
|
78
|
+
key: string;
|
|
79
|
+
version: string;
|
|
80
|
+
};
|
|
81
|
+
/** Context section */
|
|
82
|
+
context: {
|
|
83
|
+
goal: string;
|
|
84
|
+
description: string;
|
|
85
|
+
background: string;
|
|
86
|
+
};
|
|
87
|
+
/** Full spec markdown */
|
|
88
|
+
specMarkdown: string;
|
|
89
|
+
/** Suggested file structure */
|
|
90
|
+
fileStructure: {
|
|
91
|
+
path: string;
|
|
92
|
+
purpose: string;
|
|
93
|
+
type: 'create' | 'modify';
|
|
94
|
+
}[];
|
|
95
|
+
/** Ordered implementation steps */
|
|
96
|
+
steps: {
|
|
97
|
+
order: number;
|
|
98
|
+
title: string;
|
|
99
|
+
description: string;
|
|
100
|
+
acceptanceCriteria: string[];
|
|
101
|
+
}[];
|
|
102
|
+
/** Constraints to follow */
|
|
103
|
+
constraints: {
|
|
104
|
+
policy: string[];
|
|
105
|
+
security: string[];
|
|
106
|
+
pii: string[];
|
|
107
|
+
};
|
|
108
|
+
/** Verification checklist */
|
|
109
|
+
verificationChecklist: string[];
|
|
110
|
+
}
|
|
111
|
+
/** Verification issue found during implementation check */
|
|
112
|
+
interface VerificationIssue {
|
|
113
|
+
/** Issue severity */
|
|
114
|
+
severity: 'error' | 'warning' | 'info';
|
|
115
|
+
/** Issue category */
|
|
116
|
+
category: 'type' | 'export' | 'import' | 'scenario' | 'example' | 'error_handling' | 'semantic';
|
|
117
|
+
/** Issue message */
|
|
118
|
+
message: string;
|
|
119
|
+
/** Location in code if applicable */
|
|
120
|
+
location?: {
|
|
121
|
+
file?: string;
|
|
122
|
+
line?: number;
|
|
123
|
+
column?: number;
|
|
124
|
+
};
|
|
125
|
+
/** Suggested fix */
|
|
126
|
+
suggestion?: string;
|
|
127
|
+
}
|
|
128
|
+
/** Result of implementation verification */
|
|
129
|
+
interface VerificationReport {
|
|
130
|
+
/** Verification tier that was run */
|
|
131
|
+
tier: VerificationTier;
|
|
132
|
+
/** Overall pass/fail */
|
|
133
|
+
passed: boolean;
|
|
134
|
+
/** Score from 0-100 */
|
|
135
|
+
score: number;
|
|
136
|
+
/** Issues found */
|
|
137
|
+
issues: VerificationIssue[];
|
|
138
|
+
/** Suggestions for improvement */
|
|
139
|
+
suggestions: string[];
|
|
140
|
+
/** Coverage metrics */
|
|
141
|
+
coverage: {
|
|
142
|
+
scenarios: {
|
|
143
|
+
total: number;
|
|
144
|
+
covered: number;
|
|
145
|
+
};
|
|
146
|
+
errors: {
|
|
147
|
+
total: number;
|
|
148
|
+
handled: number;
|
|
149
|
+
};
|
|
150
|
+
fields: {
|
|
151
|
+
total: number;
|
|
152
|
+
implemented: number;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
/** Metadata about the verification */
|
|
156
|
+
meta: {
|
|
157
|
+
specName: string;
|
|
158
|
+
specVersion: string;
|
|
159
|
+
implementationPath: string;
|
|
160
|
+
verifiedAt: string;
|
|
161
|
+
duration: number;
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/** Agent-specific prompt format */
|
|
165
|
+
interface AgentPrompt {
|
|
166
|
+
/** Agent type this prompt is for */
|
|
167
|
+
agent: AgentType;
|
|
168
|
+
/** System prompt (if applicable) */
|
|
169
|
+
systemPrompt?: string;
|
|
170
|
+
/** User/task prompt */
|
|
171
|
+
taskPrompt: string;
|
|
172
|
+
/** Additional context resources */
|
|
173
|
+
resources?: {
|
|
174
|
+
uri: string;
|
|
175
|
+
title: string;
|
|
176
|
+
mimeType: string;
|
|
177
|
+
}[];
|
|
178
|
+
}
|
|
179
|
+
/** Input for spec lookup */
|
|
180
|
+
interface SpecLookup {
|
|
181
|
+
name: string;
|
|
182
|
+
version?: string;
|
|
183
|
+
}
|
|
184
|
+
/** Input for feature lookup */
|
|
185
|
+
interface FeatureLookup {
|
|
186
|
+
key: string;
|
|
187
|
+
}
|
|
188
|
+
/** Batch export options */
|
|
189
|
+
interface BatchExportOptions extends SpecExportOptions {
|
|
190
|
+
/** Glob pattern to match spec files */
|
|
191
|
+
pattern?: string;
|
|
192
|
+
/** Spec types to include */
|
|
193
|
+
types?: ('command' | 'query' | 'event' | 'presentation' | 'feature')[];
|
|
194
|
+
/** Output format */
|
|
195
|
+
outputFormat?: 'single' | 'per-spec' | 'per-feature';
|
|
196
|
+
}
|
|
197
|
+
/** Exportable item types */
|
|
198
|
+
type ExportableItem = {
|
|
199
|
+
type: 'spec';
|
|
200
|
+
item: AnyOperationSpec;
|
|
201
|
+
} | {
|
|
202
|
+
type: 'feature';
|
|
203
|
+
item: FeatureModuleSpec;
|
|
204
|
+
} | {
|
|
205
|
+
type: 'presentation';
|
|
206
|
+
item: PresentationSpec;
|
|
207
|
+
} | {
|
|
208
|
+
type: 'event';
|
|
209
|
+
item: EventSpec<AnySchemaModel>;
|
|
210
|
+
} | {
|
|
211
|
+
type: 'doc';
|
|
212
|
+
item: DocBlock;
|
|
213
|
+
};
|
|
214
|
+
//#endregion
|
|
215
|
+
export { AgentPrompt, AgentType, BatchExportOptions, ExportableItem, FeatureExportOptions, FeatureExportResult, FeatureLookup, ImplementationPlan, LLMExportFormat, SpecExportOptions, SpecExportResult, SpecLookup, VerificationIssue, VerificationReport, VerificationTier };
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { OperationSpecRegistry } from "./operations/registry.js";
|
|
2
|
+
import { FeatureRegistry } from "./features/registry.js";
|
|
3
|
+
import { PresentationRegistry } from "./presentations/registry.js";
|
|
4
|
+
import "./presentations/index.js";
|
|
5
|
+
import "./features/index.js";
|
|
6
|
+
|
|
7
|
+
//#region src/markdown.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Render simple Markdown docs for each spec.
|
|
10
|
+
* Useful for dev portals and repo docs generation.
|
|
11
|
+
*/
|
|
12
|
+
declare function operationsToMarkdown(registry: OperationSpecRegistry, _extras?: {
|
|
13
|
+
presentations?: PresentationRegistry;
|
|
14
|
+
features?: FeatureRegistry;
|
|
15
|
+
}): string;
|
|
16
|
+
/** Render presentations and features as additional sections. */
|
|
17
|
+
declare function docsToMarkdown(reg: OperationSpecRegistry, extras: {
|
|
18
|
+
presentations?: PresentationRegistry;
|
|
19
|
+
features?: FeatureRegistry;
|
|
20
|
+
}): string;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { docsToMarkdown, operationsToMarkdown };
|