@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,542 @@
|
|
|
1
|
+
import { jsonSchemaForSpec } from "../jsonschema.js";
|
|
2
|
+
import { isEmitDeclRef } from "../operations/operation.js";
|
|
3
|
+
import "../operations/index.js";
|
|
4
|
+
|
|
5
|
+
//#region src/llm/exporters.ts
|
|
6
|
+
const DEFAULT_SPEC_OPTIONS = {
|
|
7
|
+
format: "full",
|
|
8
|
+
includeSchemas: true,
|
|
9
|
+
includeScenarios: true,
|
|
10
|
+
includeExamples: true,
|
|
11
|
+
includePolicy: true,
|
|
12
|
+
includeSideEffects: true
|
|
13
|
+
};
|
|
14
|
+
const DEFAULT_FEATURE_OPTIONS = {
|
|
15
|
+
...DEFAULT_SPEC_OPTIONS,
|
|
16
|
+
includeRelatedSpecs: true,
|
|
17
|
+
includeRelatedEvents: true,
|
|
18
|
+
includeRelatedPresentations: true
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Export a single spec to context-focused markdown.
|
|
22
|
+
* Includes: goal, context, description, acceptance scenarios.
|
|
23
|
+
* Best for: Understanding what the spec does, providing context to LLMs.
|
|
24
|
+
*/
|
|
25
|
+
function operationSpecToContextMarkdown(spec) {
|
|
26
|
+
const m = spec.meta;
|
|
27
|
+
const lines = [];
|
|
28
|
+
lines.push(`# ${m.key} (v${m.version})`);
|
|
29
|
+
lines.push("");
|
|
30
|
+
lines.push(`> ${m.description}`);
|
|
31
|
+
lines.push("");
|
|
32
|
+
lines.push(`**Type:** ${m.kind} | **Stability:** ${m.stability}`);
|
|
33
|
+
lines.push("");
|
|
34
|
+
lines.push("## Goal");
|
|
35
|
+
lines.push("");
|
|
36
|
+
lines.push(m.goal);
|
|
37
|
+
lines.push("");
|
|
38
|
+
lines.push("## Context");
|
|
39
|
+
lines.push("");
|
|
40
|
+
lines.push(m.context);
|
|
41
|
+
lines.push("");
|
|
42
|
+
if (spec.acceptance?.scenarios?.length) {
|
|
43
|
+
lines.push("## Acceptance Criteria");
|
|
44
|
+
lines.push("");
|
|
45
|
+
for (const s of spec.acceptance.scenarios) {
|
|
46
|
+
lines.push(`### ${s.key}`);
|
|
47
|
+
lines.push("");
|
|
48
|
+
lines.push("**Given:**");
|
|
49
|
+
for (const g of s.given) lines.push(`- ${g}`);
|
|
50
|
+
lines.push("");
|
|
51
|
+
lines.push("**When:**");
|
|
52
|
+
for (const w of s.when) lines.push(`- ${w}`);
|
|
53
|
+
lines.push("");
|
|
54
|
+
lines.push("**Then:**");
|
|
55
|
+
for (const t of s.then) lines.push(`- ${t}`);
|
|
56
|
+
lines.push("");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return lines.join("\n");
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Export a single spec to full markdown with all details.
|
|
63
|
+
* Includes: all fields, I/O schemas, policy, events, examples.
|
|
64
|
+
* Best for: Complete documentation, implementation reference.
|
|
65
|
+
*/
|
|
66
|
+
function operationSpecToFullMarkdown(spec, options = {}) {
|
|
67
|
+
const opts = {
|
|
68
|
+
...DEFAULT_SPEC_OPTIONS,
|
|
69
|
+
...options
|
|
70
|
+
};
|
|
71
|
+
const m = spec.meta;
|
|
72
|
+
const lines = [];
|
|
73
|
+
lines.push(`# ${m.key}.v${m.version}`);
|
|
74
|
+
lines.push("");
|
|
75
|
+
lines.push(`> ${m.description}`);
|
|
76
|
+
lines.push("");
|
|
77
|
+
lines.push("## Metadata");
|
|
78
|
+
lines.push("");
|
|
79
|
+
lines.push("| Field | Value |");
|
|
80
|
+
lines.push("|-------|-------|");
|
|
81
|
+
lines.push(`| Kind | ${m.kind} |`);
|
|
82
|
+
lines.push(`| Stability | ${m.stability} |`);
|
|
83
|
+
lines.push(`| Owners | ${m.owners.join(", ")} |`);
|
|
84
|
+
lines.push(`| Tags | ${m.tags.join(", ")} |`);
|
|
85
|
+
lines.push("");
|
|
86
|
+
lines.push("## Goal");
|
|
87
|
+
lines.push("");
|
|
88
|
+
lines.push(m.goal);
|
|
89
|
+
lines.push("");
|
|
90
|
+
lines.push("## Context");
|
|
91
|
+
lines.push("");
|
|
92
|
+
lines.push(m.context);
|
|
93
|
+
lines.push("");
|
|
94
|
+
if (opts.includeSchemas) {
|
|
95
|
+
lines.push("## Input/Output");
|
|
96
|
+
lines.push("");
|
|
97
|
+
if (spec.io.input) {
|
|
98
|
+
lines.push("### Input Schema");
|
|
99
|
+
lines.push("");
|
|
100
|
+
lines.push("```json");
|
|
101
|
+
try {
|
|
102
|
+
const schema = jsonSchemaForSpec(spec);
|
|
103
|
+
lines.push(JSON.stringify(schema.input ?? {}, null, 2));
|
|
104
|
+
} catch {
|
|
105
|
+
lines.push("// Schema generation not available");
|
|
106
|
+
}
|
|
107
|
+
lines.push("```");
|
|
108
|
+
lines.push("");
|
|
109
|
+
}
|
|
110
|
+
lines.push("### Output Schema");
|
|
111
|
+
lines.push("");
|
|
112
|
+
lines.push("```json");
|
|
113
|
+
try {
|
|
114
|
+
const schema = jsonSchemaForSpec(spec);
|
|
115
|
+
lines.push(JSON.stringify(schema.output ?? {}, null, 2));
|
|
116
|
+
} catch {
|
|
117
|
+
lines.push("// Schema generation not available");
|
|
118
|
+
}
|
|
119
|
+
lines.push("```");
|
|
120
|
+
lines.push("");
|
|
121
|
+
if (spec.io.errors && Object.keys(spec.io.errors).length) {
|
|
122
|
+
lines.push("### Error Codes");
|
|
123
|
+
lines.push("");
|
|
124
|
+
lines.push("| Code | HTTP | Description | When |");
|
|
125
|
+
lines.push("|------|------|-------------|------|");
|
|
126
|
+
for (const [code, err] of Object.entries(spec.io.errors)) lines.push(`| \`${code}\` | ${err.http ?? 400} | ${err.description} | ${err.when} |`);
|
|
127
|
+
lines.push("");
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (opts.includePolicy) {
|
|
131
|
+
lines.push("## Policy");
|
|
132
|
+
lines.push("");
|
|
133
|
+
lines.push(`- **Auth Required:** ${spec.policy.auth}`);
|
|
134
|
+
lines.push(`- **Idempotent:** ${spec.policy.idempotent ?? m.kind === "query"}`);
|
|
135
|
+
if (spec.policy.rateLimit) lines.push(`- **Rate Limit:** ${spec.policy.rateLimit.rpm} rpm per ${spec.policy.rateLimit.key}`);
|
|
136
|
+
if (spec.policy.flags?.length) lines.push(`- **Feature Flags:** ${spec.policy.flags.join(", ")}`);
|
|
137
|
+
if (spec.policy.pii?.length) lines.push(`- **PII Fields:** ${spec.policy.pii.join(", ")}`);
|
|
138
|
+
if (spec.policy.escalate) lines.push(`- **Escalation:** ${spec.policy.escalate}`);
|
|
139
|
+
lines.push("");
|
|
140
|
+
}
|
|
141
|
+
if (opts.includeSideEffects && spec.sideEffects) {
|
|
142
|
+
if (spec.sideEffects.emits?.length) {
|
|
143
|
+
lines.push("## Events Emitted");
|
|
144
|
+
lines.push("");
|
|
145
|
+
for (const e of spec.sideEffects.emits) if (isEmitDeclRef(e)) lines.push(`- \`${e.ref.key}.v${e.ref.version}\` — ${e.when}`);
|
|
146
|
+
else lines.push(`- \`${e.key}.v${e.version}\` — ${e.when}`);
|
|
147
|
+
lines.push("");
|
|
148
|
+
}
|
|
149
|
+
if (spec.sideEffects.analytics?.length) {
|
|
150
|
+
lines.push("## Analytics Events");
|
|
151
|
+
lines.push("");
|
|
152
|
+
for (const a of spec.sideEffects.analytics) lines.push(`- ${a}`);
|
|
153
|
+
lines.push("");
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (opts.includeScenarios && spec.acceptance?.scenarios?.length) {
|
|
157
|
+
lines.push("## Acceptance Scenarios");
|
|
158
|
+
lines.push("");
|
|
159
|
+
for (const s of spec.acceptance.scenarios) {
|
|
160
|
+
lines.push(`### ${s.key}`);
|
|
161
|
+
lines.push("");
|
|
162
|
+
lines.push("**Given:**");
|
|
163
|
+
for (const g of s.given) lines.push(`- ${g}`);
|
|
164
|
+
lines.push("");
|
|
165
|
+
lines.push("**When:**");
|
|
166
|
+
for (const w of s.when) lines.push(`- ${w}`);
|
|
167
|
+
lines.push("");
|
|
168
|
+
lines.push("**Then:**");
|
|
169
|
+
for (const t of s.then) lines.push(`- ${t}`);
|
|
170
|
+
lines.push("");
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (opts.includeExamples && spec.acceptance?.examples?.length) {
|
|
174
|
+
lines.push("## Examples");
|
|
175
|
+
lines.push("");
|
|
176
|
+
for (const ex of spec.acceptance.examples) {
|
|
177
|
+
lines.push(`### ${ex.key}`);
|
|
178
|
+
lines.push("");
|
|
179
|
+
lines.push("**Input:**");
|
|
180
|
+
lines.push("```json");
|
|
181
|
+
lines.push(JSON.stringify(ex.input, null, 2));
|
|
182
|
+
lines.push("```");
|
|
183
|
+
lines.push("");
|
|
184
|
+
lines.push("**Output:**");
|
|
185
|
+
lines.push("```json");
|
|
186
|
+
lines.push(JSON.stringify(ex.output, null, 2));
|
|
187
|
+
lines.push("```");
|
|
188
|
+
lines.push("");
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (spec.transport) {
|
|
192
|
+
lines.push("## Transport Configuration");
|
|
193
|
+
lines.push("");
|
|
194
|
+
if (spec.transport.rest) lines.push(`- **REST:** ${spec.transport.rest.method ?? "POST"} ${spec.transport.rest.path ?? "auto"}`);
|
|
195
|
+
if (spec.transport.gql) lines.push(`- **GraphQL:** ${spec.transport.gql.field ?? "auto"}`);
|
|
196
|
+
if (spec.transport.mcp) lines.push(`- **MCP Tool:** ${spec.transport.mcp.toolName ?? "auto"}`);
|
|
197
|
+
lines.push("");
|
|
198
|
+
}
|
|
199
|
+
return lines.join("\n");
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Export a single spec as an actionable agent prompt.
|
|
203
|
+
* Includes: instructions, full spec, expected output format.
|
|
204
|
+
* Best for: Directly feeding to coding agents for implementation.
|
|
205
|
+
*/
|
|
206
|
+
function operationSpecToAgentPrompt(spec, options) {
|
|
207
|
+
const taskType = options?.taskType ?? "implement";
|
|
208
|
+
const m = spec.meta;
|
|
209
|
+
const lines = [];
|
|
210
|
+
const taskVerb = {
|
|
211
|
+
implement: "Implement",
|
|
212
|
+
test: "Write tests for",
|
|
213
|
+
refactor: "Refactor",
|
|
214
|
+
review: "Review"
|
|
215
|
+
}[taskType];
|
|
216
|
+
lines.push(`# Task: ${taskVerb} ${m.key}.v${m.version}`);
|
|
217
|
+
lines.push("");
|
|
218
|
+
lines.push("## Context");
|
|
219
|
+
lines.push("");
|
|
220
|
+
lines.push(`You are working on a ContractSpec-driven codebase. This spec defines a ${m.kind} operation.`);
|
|
221
|
+
lines.push("");
|
|
222
|
+
lines.push(`**Goal:** ${m.goal}`);
|
|
223
|
+
lines.push("");
|
|
224
|
+
lines.push(`**Background:** ${m.context}`);
|
|
225
|
+
lines.push("");
|
|
226
|
+
lines.push("## Specification");
|
|
227
|
+
lines.push("");
|
|
228
|
+
lines.push(operationSpecToFullMarkdown(spec));
|
|
229
|
+
lines.push("");
|
|
230
|
+
lines.push("## Instructions");
|
|
231
|
+
lines.push("");
|
|
232
|
+
if (taskType === "implement") {
|
|
233
|
+
lines.push("Implement this specification following these requirements:");
|
|
234
|
+
lines.push("");
|
|
235
|
+
lines.push("1. **Type Safety**: Use TypeScript with strict typing. No `any` types.");
|
|
236
|
+
lines.push("2. **Input Validation**: Validate input against the schema before processing.");
|
|
237
|
+
lines.push("3. **Error Handling**: Implement all error cases defined in the spec.");
|
|
238
|
+
lines.push("4. **Events**: Emit events as specified in sideEffects.emits.");
|
|
239
|
+
lines.push("5. **Policy**: Respect auth, rate limits, and feature flags.");
|
|
240
|
+
lines.push("6. **Idempotency**: " + (spec.policy.idempotent ? "This operation MUST be idempotent." : "This operation may have side effects."));
|
|
241
|
+
lines.push("");
|
|
242
|
+
if (spec.policy.pii?.length) {
|
|
243
|
+
lines.push("**PII Handling**: The following fields contain PII and must be handled carefully:");
|
|
244
|
+
for (const field of spec.policy.pii) lines.push(`- ${field}`);
|
|
245
|
+
lines.push("");
|
|
246
|
+
}
|
|
247
|
+
} else if (taskType === "test") {
|
|
248
|
+
lines.push("Write comprehensive tests for this specification:");
|
|
249
|
+
lines.push("");
|
|
250
|
+
lines.push("1. Test all acceptance scenarios defined in the spec.");
|
|
251
|
+
lines.push("2. Test all error cases with appropriate assertions.");
|
|
252
|
+
lines.push("3. Test edge cases and boundary conditions.");
|
|
253
|
+
lines.push("4. Verify events are emitted correctly.");
|
|
254
|
+
lines.push("5. Use descriptive test names following the pattern: \"should [behavior] when [condition]\"");
|
|
255
|
+
lines.push("");
|
|
256
|
+
} else if (taskType === "refactor") {
|
|
257
|
+
lines.push("Refactor this implementation while preserving all behavior:");
|
|
258
|
+
lines.push("");
|
|
259
|
+
lines.push("1. Maintain compliance with the specification.");
|
|
260
|
+
lines.push("2. Improve code clarity and maintainability.");
|
|
261
|
+
lines.push("3. Reduce complexity where possible.");
|
|
262
|
+
lines.push("4. Ensure all existing tests still pass.");
|
|
263
|
+
lines.push("");
|
|
264
|
+
} else if (taskType === "review") {
|
|
265
|
+
lines.push("Review this implementation against the specification:");
|
|
266
|
+
lines.push("");
|
|
267
|
+
lines.push("1. Verify input/output types match the schema.");
|
|
268
|
+
lines.push("2. Check all error cases are handled.");
|
|
269
|
+
lines.push("3. Verify events are emitted as specified.");
|
|
270
|
+
lines.push("4. Check policy compliance (auth, rate limits).");
|
|
271
|
+
lines.push("5. Report any deviations from the spec.");
|
|
272
|
+
lines.push("");
|
|
273
|
+
}
|
|
274
|
+
if (options?.existingCode) {
|
|
275
|
+
lines.push("## Existing Code");
|
|
276
|
+
lines.push("");
|
|
277
|
+
lines.push("```typescript");
|
|
278
|
+
lines.push(options.existingCode);
|
|
279
|
+
lines.push("```");
|
|
280
|
+
lines.push("");
|
|
281
|
+
}
|
|
282
|
+
lines.push("## Expected Output");
|
|
283
|
+
lines.push("");
|
|
284
|
+
if (taskType === "implement" || taskType === "refactor") {
|
|
285
|
+
lines.push("Provide a complete TypeScript implementation. Include:");
|
|
286
|
+
lines.push("- Type definitions for input/output");
|
|
287
|
+
lines.push("- Handler function with proper error handling");
|
|
288
|
+
lines.push("- JSDoc comments explaining the implementation");
|
|
289
|
+
} else if (taskType === "test") lines.push("Provide a complete test file using the testing framework available (prefer Vitest).");
|
|
290
|
+
else if (taskType === "review") {
|
|
291
|
+
lines.push("Provide a structured review with:");
|
|
292
|
+
lines.push("- Compliance status (pass/fail for each requirement)");
|
|
293
|
+
lines.push("- Issues found with severity (error/warning/info)");
|
|
294
|
+
lines.push("- Suggestions for improvement");
|
|
295
|
+
}
|
|
296
|
+
lines.push("");
|
|
297
|
+
return lines.join("\n");
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Export a feature module to markdown.
|
|
301
|
+
* Includes all related specs, events, and presentations.
|
|
302
|
+
*/
|
|
303
|
+
function featureToMarkdown(feature, deps, options = {}) {
|
|
304
|
+
const opts = {
|
|
305
|
+
...DEFAULT_FEATURE_OPTIONS,
|
|
306
|
+
...options
|
|
307
|
+
};
|
|
308
|
+
const m = feature.meta;
|
|
309
|
+
const lines = [];
|
|
310
|
+
lines.push(`# Feature: ${m.title ?? m.key}`);
|
|
311
|
+
lines.push("");
|
|
312
|
+
if (m.description) {
|
|
313
|
+
lines.push(`> ${m.description}`);
|
|
314
|
+
lines.push("");
|
|
315
|
+
}
|
|
316
|
+
lines.push("## Overview");
|
|
317
|
+
lines.push("");
|
|
318
|
+
lines.push(`- **Key:** \`${m.key}\``);
|
|
319
|
+
lines.push(`- **Stability:** ${m.stability}`);
|
|
320
|
+
lines.push(`- **Owners:** ${m.owners.join(", ")}`);
|
|
321
|
+
if (m.tags?.length) lines.push(`- **Tags:** ${m.tags.join(", ")}`);
|
|
322
|
+
lines.push("");
|
|
323
|
+
if (feature.operations?.length) {
|
|
324
|
+
lines.push("## Operations");
|
|
325
|
+
lines.push("");
|
|
326
|
+
lines.push("| Name | Version | Type |");
|
|
327
|
+
lines.push("|------|---------|------|");
|
|
328
|
+
for (const op of feature.operations) {
|
|
329
|
+
const kind = (deps?.specs?.get(op.key, op.version))?.meta.kind ?? "unknown";
|
|
330
|
+
lines.push(`| ${op.key} | v${op.version} | ${kind} |`);
|
|
331
|
+
}
|
|
332
|
+
lines.push("");
|
|
333
|
+
if (opts.includeRelatedSpecs && deps?.specs) {
|
|
334
|
+
lines.push("### Operation Details");
|
|
335
|
+
lines.push("");
|
|
336
|
+
for (const op of feature.operations) {
|
|
337
|
+
const spec = deps.specs.get(op.key, op.version);
|
|
338
|
+
if (spec) {
|
|
339
|
+
lines.push(`---`);
|
|
340
|
+
lines.push("");
|
|
341
|
+
lines.push(operationSpecToFullMarkdown(spec, opts));
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
if (feature.events?.length) {
|
|
347
|
+
lines.push("## Events");
|
|
348
|
+
lines.push("");
|
|
349
|
+
lines.push("| Name | Version |");
|
|
350
|
+
lines.push("|------|---------|");
|
|
351
|
+
for (const evt of feature.events) lines.push(`| ${evt.key} | v${evt.version} |`);
|
|
352
|
+
lines.push("");
|
|
353
|
+
}
|
|
354
|
+
if (feature.presentations?.length) {
|
|
355
|
+
lines.push("## Presentations");
|
|
356
|
+
lines.push("");
|
|
357
|
+
lines.push("| Name | Version |");
|
|
358
|
+
lines.push("|------|---------|");
|
|
359
|
+
for (const pres of feature.presentations) lines.push(`| ${pres.key} | v${pres.version} |`);
|
|
360
|
+
lines.push("");
|
|
361
|
+
if (opts.includeRelatedPresentations && deps?.presentations) {
|
|
362
|
+
lines.push("### Presentation Details");
|
|
363
|
+
lines.push("");
|
|
364
|
+
for (const pres of feature.presentations) {
|
|
365
|
+
const p = deps.presentations.get(pres.key, pres.version);
|
|
366
|
+
if (p) {
|
|
367
|
+
lines.push(`#### ${pres.key}.v${pres.version}`);
|
|
368
|
+
lines.push("");
|
|
369
|
+
lines.push(`- **Type:** ${p.source.type}`);
|
|
370
|
+
if (p.source.type === "component") lines.push(`- **Component:** ${p.source.componentKey}`);
|
|
371
|
+
lines.push("");
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
if (feature.capabilities) {
|
|
377
|
+
if (feature.capabilities.provides?.length) {
|
|
378
|
+
lines.push("## Capabilities Provided");
|
|
379
|
+
lines.push("");
|
|
380
|
+
for (const cap of feature.capabilities.provides) lines.push(`- \`${cap.key}.v${cap.version}\``);
|
|
381
|
+
lines.push("");
|
|
382
|
+
}
|
|
383
|
+
if (feature.capabilities.requires?.length) {
|
|
384
|
+
lines.push("## Capabilities Required");
|
|
385
|
+
lines.push("");
|
|
386
|
+
for (const cap of feature.capabilities.requires) lines.push(`- \`${cap.key}\`${cap.version ? `.v${cap.version}` : ""} (${cap.optional ? "optional" : "required"})`);
|
|
387
|
+
lines.push("");
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
return lines.join("\n");
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Export a presentation descriptor to markdown.
|
|
394
|
+
*/
|
|
395
|
+
function presentationToMarkdown(presentation) {
|
|
396
|
+
const m = presentation.meta;
|
|
397
|
+
const lines = [];
|
|
398
|
+
lines.push(`# Presentation: ${m.key}.v${m.version}`);
|
|
399
|
+
lines.push("");
|
|
400
|
+
if (m.description) {
|
|
401
|
+
lines.push(`> ${m.description}`);
|
|
402
|
+
lines.push("");
|
|
403
|
+
}
|
|
404
|
+
lines.push("## Metadata");
|
|
405
|
+
lines.push("");
|
|
406
|
+
lines.push(`- **Name:** ${m.key}`);
|
|
407
|
+
lines.push(`- **Version:** ${m.version}`);
|
|
408
|
+
if (m.stability) lines.push(`- **Stability:** ${m.stability}`);
|
|
409
|
+
if (m.owners?.length) lines.push(`- **Owners:** ${m.owners.join(", ")}`);
|
|
410
|
+
if (m.tags?.length) lines.push(`- **Tags:** ${m.tags.join(", ")}`);
|
|
411
|
+
lines.push("");
|
|
412
|
+
lines.push("## Source");
|
|
413
|
+
lines.push("");
|
|
414
|
+
lines.push(`- **Type:** ${presentation.source.type}`);
|
|
415
|
+
if (presentation.source.type === "component") {
|
|
416
|
+
lines.push(`- **Framework:** ${presentation.source.framework}`);
|
|
417
|
+
lines.push(`- **Component Key:** ${presentation.source.componentKey}`);
|
|
418
|
+
}
|
|
419
|
+
lines.push("");
|
|
420
|
+
lines.push("## Supported Targets");
|
|
421
|
+
lines.push("");
|
|
422
|
+
for (const target of presentation.targets) lines.push(`- ${target}`);
|
|
423
|
+
lines.push("");
|
|
424
|
+
if (presentation.policy) {
|
|
425
|
+
lines.push("## Policy");
|
|
426
|
+
lines.push("");
|
|
427
|
+
if (presentation.policy.flags?.length) lines.push(`- **Feature Flags:** ${presentation.policy.flags.join(", ")}`);
|
|
428
|
+
if (presentation.policy.pii?.length) lines.push(`- **PII Fields:** ${presentation.policy.pii.join(", ")}`);
|
|
429
|
+
lines.push("");
|
|
430
|
+
}
|
|
431
|
+
return lines.join("\n");
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Export an event spec to markdown.
|
|
435
|
+
*/
|
|
436
|
+
function eventToMarkdown(event) {
|
|
437
|
+
const lines = [];
|
|
438
|
+
lines.push(`# Event: ${event.meta.key}.v${event.meta.version}`);
|
|
439
|
+
lines.push("");
|
|
440
|
+
lines.push("## Metadata");
|
|
441
|
+
lines.push("");
|
|
442
|
+
lines.push(`- **Name:** ${event.meta.key}`);
|
|
443
|
+
lines.push(`- **Version:** ${event.meta.version}`);
|
|
444
|
+
if (event.meta.description) lines.push(`- **Description:** ${event.meta.description}`);
|
|
445
|
+
lines.push("");
|
|
446
|
+
lines.push("## Payload Schema");
|
|
447
|
+
lines.push("");
|
|
448
|
+
lines.push("```json");
|
|
449
|
+
try {
|
|
450
|
+
const zodSchema = event.payload.getZod();
|
|
451
|
+
if ("shape" in zodSchema && zodSchema.shape) {
|
|
452
|
+
const shape = zodSchema.shape;
|
|
453
|
+
const fields = Object.keys(shape);
|
|
454
|
+
lines.push(JSON.stringify({ fields }, null, 2));
|
|
455
|
+
} else lines.push("// Payload schema available at runtime");
|
|
456
|
+
} catch {
|
|
457
|
+
lines.push("// Schema details available at runtime");
|
|
458
|
+
}
|
|
459
|
+
lines.push("```");
|
|
460
|
+
lines.push("");
|
|
461
|
+
return lines.join("\n");
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Export a DocBlock to markdown (already markdown, but formatted consistently).
|
|
465
|
+
*/
|
|
466
|
+
function docBlockToMarkdown(doc) {
|
|
467
|
+
const lines = [];
|
|
468
|
+
lines.push(`# ${doc.title}`);
|
|
469
|
+
lines.push("");
|
|
470
|
+
if (doc.summary) {
|
|
471
|
+
lines.push(`> ${doc.summary}`);
|
|
472
|
+
lines.push("");
|
|
473
|
+
}
|
|
474
|
+
lines.push("## Metadata");
|
|
475
|
+
lines.push("");
|
|
476
|
+
lines.push(`- **ID:** ${doc.id}`);
|
|
477
|
+
lines.push(`- **Kind:** ${doc.kind ?? "reference"}`);
|
|
478
|
+
lines.push(`- **Visibility:** ${doc.visibility ?? "public"}`);
|
|
479
|
+
if (doc.tags?.length) lines.push(`- **Tags:** ${doc.tags.join(", ")}`);
|
|
480
|
+
if (doc.owners?.length) lines.push(`- **Owners:** ${doc.owners.join(", ")}`);
|
|
481
|
+
if (doc.domain) lines.push(`- **Domain:** ${doc.domain}`);
|
|
482
|
+
lines.push("");
|
|
483
|
+
lines.push("## Content");
|
|
484
|
+
lines.push("");
|
|
485
|
+
lines.push(doc.body);
|
|
486
|
+
lines.push("");
|
|
487
|
+
if (doc.links?.length) {
|
|
488
|
+
lines.push("## Related Links");
|
|
489
|
+
lines.push("");
|
|
490
|
+
for (const link of doc.links) lines.push(`- [${link.label}](${link.href})`);
|
|
491
|
+
lines.push("");
|
|
492
|
+
}
|
|
493
|
+
return lines.join("\n");
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Export a spec with a specific format.
|
|
497
|
+
* Convenience function that wraps the format-specific functions.
|
|
498
|
+
*/
|
|
499
|
+
function exportSpec(spec, options = {}) {
|
|
500
|
+
const format = options.format ?? "full";
|
|
501
|
+
let markdown;
|
|
502
|
+
switch (format) {
|
|
503
|
+
case "context":
|
|
504
|
+
markdown = operationSpecToContextMarkdown(spec);
|
|
505
|
+
break;
|
|
506
|
+
case "prompt":
|
|
507
|
+
markdown = operationSpecToAgentPrompt(spec);
|
|
508
|
+
break;
|
|
509
|
+
case "full":
|
|
510
|
+
default:
|
|
511
|
+
markdown = operationSpecToFullMarkdown(spec, options);
|
|
512
|
+
break;
|
|
513
|
+
}
|
|
514
|
+
return {
|
|
515
|
+
spec,
|
|
516
|
+
markdown,
|
|
517
|
+
format,
|
|
518
|
+
meta: {
|
|
519
|
+
specName: spec.meta.key,
|
|
520
|
+
specVersion: spec.meta.version,
|
|
521
|
+
exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
522
|
+
wordCount: markdown.split(/\s+/).length
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Export a feature with a specific format.
|
|
528
|
+
*/
|
|
529
|
+
function exportFeature(feature, deps, options = {}) {
|
|
530
|
+
const format = options.format ?? "full";
|
|
531
|
+
return {
|
|
532
|
+
feature,
|
|
533
|
+
markdown: featureToMarkdown(feature, deps, options),
|
|
534
|
+
format,
|
|
535
|
+
includedSpecs: feature.operations?.map((o) => `${o.key}.v${o.version}`) ?? [],
|
|
536
|
+
includedEvents: feature.events?.map((e) => `${e.key}.v${e.version}`) ?? [],
|
|
537
|
+
includedPresentations: feature.presentations?.map((p) => `${p.key}.v${p.version}`) ?? []
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
//#endregion
|
|
542
|
+
export { docBlockToMarkdown, eventToMarkdown, exportFeature, exportSpec, featureToMarkdown, operationSpecToAgentPrompt, operationSpecToContextMarkdown, operationSpecToFullMarkdown, presentationToMarkdown };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AgentPrompt, AgentType, BatchExportOptions, ExportableItem, FeatureExportOptions, FeatureExportResult, FeatureLookup, ImplementationPlan, LLMExportFormat, SpecExportOptions, SpecExportResult, SpecLookup, VerificationIssue, VerificationReport, VerificationTier } from "./types.js";
|
|
2
|
+
import { docBlockToMarkdown, eventToMarkdown, exportFeature, exportSpec, featureToMarkdown, operationSpecToAgentPrompt, operationSpecToContextMarkdown, operationSpecToFullMarkdown, presentationToMarkdown } from "./exporters.js";
|
|
3
|
+
import { AGENT_SYSTEM_PROMPTS, formatPlanForAgent, generateFixViolationsPrompt, generateImplementationPlan, generateImplementationPrompt, generateReviewPrompt, generateTestPrompt, generateVerificationPrompt } from "./prompts.js";
|
|
4
|
+
export { AGENT_SYSTEM_PROMPTS, type AgentPrompt, type AgentType, type BatchExportOptions, type ExportableItem, type FeatureExportOptions, type FeatureExportResult, type FeatureLookup, type ImplementationPlan, type LLMExportFormat, type SpecExportOptions, type SpecExportResult, type SpecLookup, type VerificationIssue, type VerificationReport, type VerificationTier, docBlockToMarkdown, eventToMarkdown, exportFeature, exportSpec, featureToMarkdown, formatPlanForAgent, generateFixViolationsPrompt, generateImplementationPlan, generateImplementationPrompt, generateReviewPrompt, generateTestPrompt, generateVerificationPrompt, operationSpecToAgentPrompt, operationSpecToContextMarkdown, operationSpecToFullMarkdown, presentationToMarkdown };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { docBlockToMarkdown, eventToMarkdown, exportFeature, exportSpec, featureToMarkdown, operationSpecToAgentPrompt, operationSpecToContextMarkdown, operationSpecToFullMarkdown, presentationToMarkdown } from "./exporters.js";
|
|
2
|
+
import { AGENT_SYSTEM_PROMPTS, formatPlanForAgent, generateFixViolationsPrompt, generateImplementationPlan, generateImplementationPrompt, generateReviewPrompt, generateTestPrompt, generateVerificationPrompt } from "./prompts.js";
|
|
3
|
+
|
|
4
|
+
export { AGENT_SYSTEM_PROMPTS, docBlockToMarkdown, eventToMarkdown, exportFeature, exportSpec, featureToMarkdown, formatPlanForAgent, generateFixViolationsPrompt, generateImplementationPlan, generateImplementationPrompt, generateReviewPrompt, generateTestPrompt, generateVerificationPrompt, operationSpecToAgentPrompt, operationSpecToContextMarkdown, operationSpecToFullMarkdown, presentationToMarkdown };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AnyOperationSpec } from "../operations/operation.js";
|
|
2
|
+
import "../operations/index.js";
|
|
3
|
+
import { AgentPrompt, AgentType, ImplementationPlan } from "./types.js";
|
|
4
|
+
|
|
5
|
+
//#region src/llm/prompts.d.ts
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* System prompts for different agent types.
|
|
9
|
+
*/
|
|
10
|
+
declare const AGENT_SYSTEM_PROMPTS: Record<AgentType, string>;
|
|
11
|
+
/**
|
|
12
|
+
* Generate an implementation prompt for a specific agent type.
|
|
13
|
+
*/
|
|
14
|
+
declare function generateImplementationPrompt(spec: AnyOperationSpec, agent: AgentType, options?: {
|
|
15
|
+
existingCode?: string;
|
|
16
|
+
targetPath?: string;
|
|
17
|
+
}): AgentPrompt;
|
|
18
|
+
/**
|
|
19
|
+
* Generate a test generation prompt.
|
|
20
|
+
*/
|
|
21
|
+
declare function generateTestPrompt(spec: AnyOperationSpec, agent: AgentType, options?: {
|
|
22
|
+
implementationCode?: string;
|
|
23
|
+
testFramework?: 'vitest' | 'jest' | 'bun';
|
|
24
|
+
}): AgentPrompt;
|
|
25
|
+
/**
|
|
26
|
+
* Generate a code review prompt.
|
|
27
|
+
*/
|
|
28
|
+
declare function generateReviewPrompt(spec: AnyOperationSpec, agent: AgentType, implementationCode: string): AgentPrompt;
|
|
29
|
+
/**
|
|
30
|
+
* Generate a verification prompt for AI-powered semantic review.
|
|
31
|
+
*/
|
|
32
|
+
declare function generateVerificationPrompt(spec: AnyOperationSpec, implementationCode: string): AgentPrompt;
|
|
33
|
+
/**
|
|
34
|
+
* Generate a feature implementation plan.
|
|
35
|
+
*/
|
|
36
|
+
declare function generateImplementationPlan(spec: AnyOperationSpec, options?: {
|
|
37
|
+
projectRoot?: string;
|
|
38
|
+
existingFiles?: string[];
|
|
39
|
+
}): ImplementationPlan;
|
|
40
|
+
/**
|
|
41
|
+
* Format an implementation plan for a specific agent.
|
|
42
|
+
*/
|
|
43
|
+
declare function formatPlanForAgent(plan: ImplementationPlan, agent: AgentType): AgentPrompt;
|
|
44
|
+
/**
|
|
45
|
+
* Generate a fix violations prompt after verification.
|
|
46
|
+
*/
|
|
47
|
+
declare function generateFixViolationsPrompt(spec: AnyOperationSpec, implementationCode: string, violations: {
|
|
48
|
+
message: string;
|
|
49
|
+
suggestion?: string;
|
|
50
|
+
}[]): AgentPrompt;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { AGENT_SYSTEM_PROMPTS, formatPlanForAgent, generateFixViolationsPrompt, generateImplementationPlan, generateImplementationPrompt, generateReviewPrompt, generateTestPrompt, generateVerificationPrompt };
|