@lssm/lib.contracts 1.41.0 → 1.42.1
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 +7 -4
- package/dist/_virtual/rolldown_runtime.js +37 -1
- package/dist/app-config/app-config.feature.d.ts +11 -0
- package/dist/app-config/app-config.feature.js +54 -1
- package/dist/app-config/branding.d.ts +55 -0
- package/dist/app-config/contracts.d.ts +245 -0
- package/dist/app-config/contracts.js +395 -1
- package/dist/app-config/docs/app-config.docblock.d.ts +6 -0
- package/dist/app-config/docs/app-config.docblock.js +21 -220
- package/dist/app-config/events.d.ts +122 -0
- package/dist/app-config/events.js +174 -1
- package/dist/app-config/index.d.ts +9 -0
- package/dist/app-config/index.js +8 -1
- package/dist/app-config/lifecycle-contracts.d.ts +273 -0
- package/dist/app-config/lifecycle-contracts.js +440 -1
- package/dist/app-config/lifecycle.d.ts +27 -0
- package/dist/app-config/runtime.d.ts +117 -0
- package/dist/app-config/runtime.js +617 -1
- package/dist/app-config/spec.d.ts +172 -0
- package/dist/app-config/spec.js +36 -1
- package/dist/app-config/validation.d.ts +49 -0
- package/dist/app-config/validation.js +538 -1
- package/dist/capabilities/capabilities.d.ts +48 -0
- package/dist/capabilities/capabilities.js +50 -0
- package/dist/capabilities/docs/capabilities.docblock.d.ts +6 -0
- package/dist/capabilities/docs/capabilities.docblock.js +21 -1
- 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 -1
- package/dist/client/index.d.ts +6 -0
- package/dist/client/index.js +9 -1
- package/dist/client/react/drivers/rn-reusables.d.ts +22 -0
- package/dist/client/react/drivers/rn-reusables.js +21 -1
- package/dist/client/react/drivers/shadcn.d.ts +12 -0
- package/dist/client/react/drivers/shadcn.js +11 -1
- package/dist/client/react/feature-render.d.ts +21 -0
- package/dist/client/react/feature-render.js +44 -1
- package/dist/client/react/form-render.d.ts +92 -0
- package/dist/client/react/form-render.js +298 -1
- package/dist/client/react/index.d.ts +5 -0
- package/dist/client/react/index.js +8 -1
- package/dist/contract-registry/index.d.ts +3 -0
- package/dist/contract-registry/index.js +3 -1
- package/dist/contract-registry/schemas.d.ts +124 -0
- package/dist/contract-registry/schemas.js +61 -1
- package/dist/contract-registry/types.d.ts +46 -0
- package/dist/data-views/data-views.d.ts +138 -0
- package/dist/data-views/data-views.js +58 -0
- package/dist/data-views/docs/data-views.docblock.d.ts +6 -0
- package/dist/data-views/docs/data-views.docblock.js +21 -1
- package/dist/data-views/index.d.ts +4 -0
- package/dist/data-views/index.js +5 -0
- package/dist/data-views/query-generator.d.ts +40 -0
- package/dist/data-views/query-generator.js +48 -1
- package/dist/data-views/runtime.d.ts +27 -0
- package/dist/data-views/runtime.js +39 -1
- package/dist/docs/accessibility_wcag_compliance_specs.docblock.d.ts +6 -0
- package/dist/docs/accessibility_wcag_compliance_specs.docblock.js +17 -350
- package/dist/docs/index.d.ts +6 -0
- package/dist/docs/index.js +27 -1
- package/dist/docs/meta.docs.d.ts +6 -0
- package/dist/docs/meta.docs.js +18 -2
- package/dist/docs/presentations.d.ts +33 -0
- package/dist/docs/presentations.js +64 -1
- package/dist/docs/registry.d.ts +23 -0
- package/dist/docs/registry.js +51 -1
- package/dist/docs/tech/auth/better-auth-nextjs.docblock.d.ts +6 -0
- package/dist/docs/tech/auth/better-auth-nextjs.docblock.js +25 -2
- package/dist/docs/tech/contracts/README.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/README.docblock.js +21 -1
- package/dist/docs/tech/contracts/create-subscription.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/create-subscription.docblock.js +21 -1
- package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.js +21 -180
- package/dist/docs/tech/contracts/migrations.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/migrations.docblock.js +21 -1
- package/dist/docs/tech/contracts/openapi-export.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/openapi-export.docblock.js +25 -5
- 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 +19 -60
- package/dist/docs/tech/contracts/overlays.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/overlays.docblock.js +21 -68
- package/dist/docs/tech/contracts/tests.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/tests.docblock.js +21 -132
- package/dist/docs/tech/contracts/themes.docblock.d.ts +6 -0
- package/dist/docs/tech/contracts/themes.docblock.js +21 -1
- 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 +21 -106
- package/dist/docs/tech/lifecycle-stage-system.docblock.d.ts +6 -0
- package/dist/docs/tech/lifecycle-stage-system.docblock.js +17 -213
- package/dist/docs/tech/llm/llm-integration.docblock.d.ts +7 -0
- package/dist/docs/tech/llm/llm-integration.docblock.js +76 -7
- package/dist/docs/tech/mcp-endpoints.docblock.d.ts +6 -0
- package/dist/docs/tech/mcp-endpoints.docblock.js +38 -1
- package/dist/docs/tech/presentation-runtime.docblock.d.ts +6 -0
- package/dist/docs/tech/presentation-runtime.docblock.js +17 -1
- package/dist/docs/tech/schema/README.docblock.d.ts +6 -0
- package/dist/docs/tech/schema/README.docblock.js +21 -262
- package/dist/docs/tech/studio/learning-events.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/learning-events.docblock.js +49 -1
- package/dist/docs/tech/studio/learning-journeys.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/learning-journeys.docblock.js +25 -2
- package/dist/docs/tech/studio/platform-admin-panel.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/platform-admin-panel.docblock.js +24 -2
- package/dist/docs/tech/studio/project-access-teams.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/project-access-teams.docblock.js +26 -16
- package/dist/docs/tech/studio/project-routing.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/project-routing.docblock.js +68 -1
- package/dist/docs/tech/studio/sandbox-unlogged.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/sandbox-unlogged.docblock.js +23 -2
- package/dist/docs/tech/studio/team-invitations.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/team-invitations.docblock.js +41 -36
- package/dist/docs/tech/studio/workspace-ops.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/workspace-ops.docblock.js +48 -1
- package/dist/docs/tech/studio/workspaces.docblock.d.ts +6 -0
- package/dist/docs/tech/studio/workspaces.docblock.js +24 -2
- package/dist/docs/tech/telemetry-ingest.docblock.d.ts +6 -0
- package/dist/docs/tech/telemetry-ingest.docblock.js +37 -3
- package/dist/docs/tech/templates/runtime.docblock.d.ts +6 -0
- package/dist/docs/tech/templates/runtime.docblock.js +21 -1
- package/dist/docs/tech/vscode-extension.docblock.d.ts +6 -0
- package/dist/docs/tech/vscode-extension.docblock.js +37 -3
- package/dist/docs/tech/workflows/overview.docblock.d.ts +6 -0
- package/dist/docs/tech/workflows/overview.docblock.js +21 -1
- package/dist/docs/tech-contracts.docs.d.ts +6 -0
- package/dist/docs/tech-contracts.docs.js +27 -7
- package/dist/docs/types.d.ts +41 -0
- package/dist/events.d.ts +47 -0
- package/dist/events.js +19 -1
- package/dist/experiments/docs/experiments.docblock.d.ts +6 -0
- package/dist/experiments/docs/experiments.docblock.js +21 -128
- package/dist/experiments/evaluator.d.ts +37 -0
- package/dist/experiments/evaluator.js +101 -1
- package/dist/experiments/spec-resolver.d.ts +17 -0
- package/dist/experiments/spec.d.ts +82 -0
- package/dist/experiments/spec.js +33 -1
- package/dist/features.d.ts +104 -0
- package/dist/features.js +91 -1
- package/dist/forms/docs/forms.docblock.d.ts +6 -0
- package/dist/forms/docs/forms.docblock.js +21 -1
- package/dist/forms/forms.d.ts +266 -0
- package/dist/forms/forms.js +146 -0
- package/dist/forms/index.d.ts +2 -0
- package/dist/forms/index.js +3 -0
- package/dist/index.d.ts +142 -0
- package/dist/index.js +119 -1
- package/dist/install.d.ts +77 -0
- package/dist/install.js +40 -1
- package/dist/integrations/binding.d.ts +17 -0
- package/dist/integrations/connection.d.ts +51 -0
- package/dist/integrations/docs/integrations.docblock.d.ts +6 -0
- package/dist/integrations/docs/integrations.docblock.js +94 -1
- package/dist/integrations/health.d.ts +21 -0
- package/dist/integrations/health.js +69 -1
- package/dist/integrations/index.d.ts +34 -0
- package/dist/integrations/index.js +23 -1
- package/dist/integrations/integrations.feature.d.ts +11 -0
- package/dist/integrations/integrations.feature.js +60 -0
- package/dist/integrations/openbanking/contracts/accounts.d.ts +289 -0
- package/dist/integrations/openbanking/contracts/accounts.js +236 -1
- package/dist/integrations/openbanking/contracts/balances.d.ts +165 -0
- package/dist/integrations/openbanking/contracts/balances.js +166 -1
- package/dist/integrations/openbanking/contracts/index.d.ts +10 -0
- package/dist/integrations/openbanking/contracts/index.js +12 -1
- package/dist/integrations/openbanking/contracts/transactions.d.ts +213 -0
- package/dist/integrations/openbanking/contracts/transactions.js +217 -1
- package/dist/integrations/openbanking/guards.d.ts +12 -0
- package/dist/integrations/openbanking/guards.js +33 -1
- package/dist/integrations/openbanking/models.d.ts +228 -0
- package/dist/integrations/openbanking/models.js +240 -1
- package/dist/integrations/openbanking/openbanking.feature.d.ts +11 -0
- package/dist/integrations/openbanking/openbanking.feature.js +69 -1
- package/dist/integrations/openbanking/telemetry.d.ts +15 -0
- package/dist/integrations/openbanking/telemetry.js +39 -1
- 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/elevenlabs.d.ts +7 -0
- package/dist/integrations/providers/elevenlabs.js +55 -1
- package/dist/integrations/providers/email.d.ts +86 -0
- package/dist/integrations/providers/embedding.d.ts +24 -0
- package/dist/integrations/providers/gcs-storage.d.ts +7 -0
- package/dist/integrations/providers/gcs-storage.js +78 -1
- package/dist/integrations/providers/gmail.d.ts +7 -0
- package/dist/integrations/providers/gmail.js +90 -1
- package/dist/integrations/providers/google-calendar.d.ts +7 -0
- package/dist/integrations/providers/google-calendar.js +69 -1
- package/dist/integrations/providers/impls/elevenlabs-voice.d.ts +20 -0
- package/dist/integrations/providers/impls/elevenlabs-voice.js +95 -1
- package/dist/integrations/providers/impls/gcs-storage.d.ts +24 -0
- package/dist/integrations/providers/impls/gcs-storage.js +88 -1
- package/dist/integrations/providers/impls/gmail-inbound.d.ts +26 -0
- package/dist/integrations/providers/impls/gmail-inbound.js +200 -1
- package/dist/integrations/providers/impls/gmail-outbound.d.ts +18 -0
- package/dist/integrations/providers/impls/gmail-outbound.js +104 -5
- package/dist/integrations/providers/impls/google-calendar.d.ts +23 -0
- package/dist/integrations/providers/impls/google-calendar.js +154 -1
- package/dist/integrations/providers/impls/index.d.ts +15 -0
- package/dist/integrations/providers/impls/index.js +16 -1
- package/dist/integrations/providers/impls/mistral-embedding.d.ts +23 -0
- package/dist/integrations/providers/impls/mistral-embedding.js +41 -1
- package/dist/integrations/providers/impls/mistral-llm.d.ts +31 -0
- package/dist/integrations/providers/impls/mistral-llm.js +247 -1
- package/dist/integrations/providers/impls/postmark-email.d.ts +19 -0
- package/dist/integrations/providers/impls/postmark-email.js +55 -1
- package/dist/integrations/providers/impls/powens-client.d.ts +124 -0
- package/dist/integrations/providers/impls/powens-client.js +171 -1
- package/dist/integrations/providers/impls/powens-openbanking.d.ts +27 -0
- package/dist/integrations/providers/impls/powens-openbanking.js +218 -1
- package/dist/integrations/providers/impls/provider-factory.d.ts +26 -0
- package/dist/integrations/providers/impls/provider-factory.js +145 -1
- package/dist/integrations/providers/impls/qdrant-vector.d.ts +24 -0
- package/dist/integrations/providers/impls/qdrant-vector.js +69 -1
- package/dist/integrations/providers/impls/stripe-payments.d.ts +28 -0
- package/dist/integrations/providers/impls/stripe-payments.js +202 -1
- package/dist/integrations/providers/impls/twilio-sms.d.ts +20 -0
- package/dist/integrations/providers/impls/twilio-sms.js +58 -1
- package/dist/integrations/providers/index.d.ts +22 -0
- package/dist/integrations/providers/index.js +13 -1
- package/dist/integrations/providers/llm.d.ts +82 -0
- package/dist/integrations/providers/mistral.d.ts +7 -0
- package/dist/integrations/providers/mistral.js +71 -1
- package/dist/integrations/providers/openbanking.d.ts +128 -0
- package/dist/integrations/providers/payments.d.ts +109 -0
- package/dist/integrations/providers/postmark.d.ts +7 -0
- package/dist/integrations/providers/postmark.js +71 -1
- package/dist/integrations/providers/powens.d.ts +7 -0
- package/dist/integrations/providers/powens.js +119 -1
- package/dist/integrations/providers/qdrant.d.ts +7 -0
- package/dist/integrations/providers/qdrant.js +76 -1
- package/dist/integrations/providers/registry.d.ts +11 -0
- package/dist/integrations/providers/registry.js +34 -1
- package/dist/integrations/providers/sms.d.ts +34 -0
- package/dist/integrations/providers/storage.d.ts +60 -0
- package/dist/integrations/providers/stripe.d.ts +7 -0
- package/dist/integrations/providers/stripe.js +86 -1
- package/dist/integrations/providers/twilio-sms.d.ts +7 -0
- package/dist/integrations/providers/twilio-sms.js +64 -1
- package/dist/integrations/providers/vector-store.d.ts +43 -0
- package/dist/integrations/providers/voice.d.ts +34 -0
- package/dist/integrations/runtime.d.ts +99 -0
- package/dist/integrations/runtime.js +186 -1
- package/dist/integrations/secrets/aws-secret-manager.d.ts +31 -0
- package/dist/integrations/secrets/aws-secret-manager.js +231 -1
- package/dist/integrations/secrets/env-secret-provider.d.ts +31 -0
- package/dist/integrations/secrets/env-secret-provider.js +81 -1
- package/dist/integrations/secrets/gcp-secret-manager.d.ts +32 -0
- package/dist/integrations/secrets/gcp-secret-manager.js +229 -1
- package/dist/integrations/secrets/index.d.ts +7 -0
- package/dist/integrations/secrets/index.js +8 -1
- package/dist/integrations/secrets/manager.d.ts +47 -0
- package/dist/integrations/secrets/manager.js +103 -1
- package/dist/integrations/secrets/provider.d.ts +52 -0
- package/dist/integrations/secrets/provider.js +58 -1
- package/dist/integrations/secrets/scaleway-secret-manager.d.ts +38 -0
- package/dist/integrations/secrets/scaleway-secret-manager.js +247 -1
- package/dist/integrations/secrets-types.d.ts +17 -0
- package/dist/integrations/spec.d.ts +75 -0
- package/dist/integrations/spec.js +39 -1
- package/dist/jobs/define-job.d.ts +18 -0
- package/dist/jobs/define-job.js +16 -1
- package/dist/jobs/gcp-cloud-tasks.d.ts +41 -0
- package/dist/jobs/gcp-cloud-tasks.js +53 -1
- package/dist/jobs/gcp-pubsub.d.ts +25 -0
- package/dist/jobs/gcp-pubsub.js +39 -1
- package/dist/jobs/handlers/gmail-sync-handler.d.ts +9 -0
- package/dist/jobs/handlers/gmail-sync-handler.js +9 -1
- package/dist/jobs/handlers/index.d.ts +9 -0
- package/dist/jobs/handlers/index.js +12 -1
- package/dist/jobs/handlers/ping-handler.d.ts +10 -0
- package/dist/jobs/handlers/ping-handler.js +15 -1
- package/dist/jobs/handlers/storage-document-handler.d.ts +12 -0
- package/dist/jobs/handlers/storage-document-handler.js +14 -1
- package/dist/jobs/index.d.ts +3 -0
- package/dist/jobs/index.js +4 -1
- package/dist/jobs/memory-queue.d.ts +18 -0
- package/dist/jobs/memory-queue.js +71 -1
- package/dist/jobs/queue.d.ts +131 -0
- package/dist/jobs/queue.js +33 -1
- package/dist/jobs/scaleway-sqs-queue.d.ts +30 -0
- package/dist/jobs/scaleway-sqs-queue.js +153 -1
- package/dist/jsonschema.d.ts +28 -0
- package/dist/jsonschema.js +32 -1
- package/dist/knowledge/binding.d.ts +25 -0
- package/dist/knowledge/docs/knowledge.docblock.d.ts +6 -0
- package/dist/knowledge/docs/knowledge.docblock.js +21 -138
- package/dist/knowledge/index.d.ts +11 -0
- package/dist/knowledge/index.js +10 -1
- package/dist/knowledge/ingestion/document-processor.d.ts +24 -0
- package/dist/knowledge/ingestion/document-processor.js +54 -1
- package/dist/knowledge/ingestion/embedding-service.d.ts +12 -0
- package/dist/knowledge/ingestion/embedding-service.js +25 -1
- package/dist/knowledge/ingestion/gmail-adapter.d.ts +18 -0
- package/dist/knowledge/ingestion/gmail-adapter.js +50 -5
- package/dist/knowledge/ingestion/index.d.ts +6 -0
- package/dist/knowledge/ingestion/index.js +7 -1
- package/dist/knowledge/ingestion/storage-adapter.d.ts +15 -0
- package/dist/knowledge/ingestion/storage-adapter.js +26 -1
- package/dist/knowledge/ingestion/vector-indexer.d.ts +18 -0
- package/dist/knowledge/ingestion/vector-indexer.js +32 -1
- package/dist/knowledge/knowledge.feature.d.ts +11 -0
- package/dist/knowledge/knowledge.feature.js +61 -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 -1
- package/dist/knowledge/query/service.d.ts +29 -0
- package/dist/knowledge/query/service.js +64 -2
- package/dist/knowledge/runtime.d.ts +32 -0
- package/dist/knowledge/runtime.js +49 -1
- package/dist/knowledge/source.d.ts +32 -0
- package/dist/knowledge/spaces/email-threads.d.ts +7 -0
- package/dist/knowledge/spaces/email-threads.js +37 -1
- package/dist/knowledge/spaces/financial-docs.d.ts +7 -0
- package/dist/knowledge/spaces/financial-docs.js +37 -1
- package/dist/knowledge/spaces/financial-overview.d.ts +7 -0
- package/dist/knowledge/spaces/financial-overview.js +41 -1
- package/dist/knowledge/spaces/index.d.ts +7 -0
- package/dist/knowledge/spaces/index.js +8 -1
- package/dist/knowledge/spaces/product-canon.d.ts +7 -0
- package/dist/knowledge/spaces/product-canon.js +37 -1
- package/dist/knowledge/spaces/support-faq.d.ts +7 -0
- package/dist/knowledge/spaces/support-faq.js +40 -1
- package/dist/knowledge/spaces/uploaded-docs.d.ts +7 -0
- package/dist/knowledge/spaces/uploaded-docs.js +37 -1
- package/dist/knowledge/spec.d.ts +48 -0
- package/dist/knowledge/spec.js +39 -1
- package/dist/llm/exporters.d.ts +69 -0
- package/dist/llm/exporters.js +542 -8
- package/dist/llm/index.d.ts +4 -0
- package/dist/llm/index.js +4 -1
- package/dist/llm/prompts.d.ts +52 -0
- package/dist/llm/prompts.js +246 -56
- package/dist/llm/types.d.ts +214 -0
- package/dist/markdown.d.ts +22 -0
- package/dist/markdown.js +119 -3
- package/dist/migrations.d.ts +52 -0
- package/dist/migrations.js +33 -1
- package/dist/onboarding-base.d.ts +138 -0
- package/dist/onboarding-base.js +195 -1
- package/dist/openapi.d.ts +31 -0
- package/dist/openapi.js +75 -1
- package/dist/operations/index.d.ts +3 -0
- package/dist/operations/index.js +4 -0
- package/dist/operations/operation.d.ts +180 -0
- package/dist/operations/operation.js +35 -0
- package/dist/operations/registry.d.ts +103 -0
- package/dist/operations/registry.js +252 -0
- package/dist/ownership.d.ts +84 -0
- package/dist/ownership.js +38 -1
- package/dist/policy/docs/policy.docblock.d.ts +6 -0
- package/dist/policy/docs/policy.docblock.js +21 -1
- package/dist/policy/engine.d.ts +40 -0
- package/dist/policy/engine.js +223 -1
- 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 -1
- 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 -1
- package/dist/presentations/docs/presentations-conventions.docblock.d.ts +6 -0
- package/dist/presentations/docs/presentations-conventions.docblock.js +20 -7
- 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 +60 -0
- package/dist/prompt.js +10 -1
- package/dist/promptRegistry.d.ts +15 -0
- package/dist/promptRegistry.js +34 -1
- package/dist/regenerator/adapters.d.ts +19 -0
- package/dist/regenerator/docs/regenerator.docblock.d.ts +6 -0
- package/dist/regenerator/docs/regenerator.docblock.js +21 -184
- package/dist/regenerator/executor.d.ts +70 -0
- package/dist/regenerator/executor.js +86 -1
- package/dist/regenerator/index.d.ts +7 -0
- package/dist/regenerator/index.js +6 -1
- package/dist/regenerator/service.d.ts +33 -0
- package/dist/regenerator/service.js +92 -1
- package/dist/regenerator/sinks.d.ts +26 -0
- package/dist/regenerator/sinks.js +32 -1
- package/dist/regenerator/types.d.ts +107 -0
- package/dist/regenerator/utils.d.ts +9 -0
- package/dist/regenerator/utils.js +51 -1
- package/dist/registry-utils.d.ts +106 -0
- package/dist/registry-utils.js +122 -0
- package/dist/registry.d.ts +30 -0
- package/dist/registry.js +58 -1
- package/dist/resources.d.ts +64 -0
- package/dist/resources.js +50 -1
- package/dist/schema-to-markdown.d.ts +54 -0
- package/dist/schema-to-markdown.js +214 -10
- 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 +77 -0
- package/dist/server/graphql-pothos.d.ts +31 -0
- package/dist/server/graphql-pothos.js +127 -1
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +10 -1
- package/dist/server/mcp/createMcpServer.d.ts +15 -0
- package/dist/server/mcp/createMcpServer.js +28 -1
- package/dist/server/mcp/mcpTypes.d.ts +30 -0
- package/dist/server/mcp/registerPresentations.d.ts +7 -0
- package/dist/server/mcp/registerPresentations.js +112 -1
- package/dist/server/mcp/registerPrompts.d.ts +8 -0
- package/dist/server/mcp/registerPrompts.js +36 -2
- package/dist/server/mcp/registerResources.d.ts +8 -0
- package/dist/server/mcp/registerResources.js +35 -1
- package/dist/server/mcp/registerTools.d.ts +8 -0
- package/dist/server/mcp/registerTools.js +22 -1
- package/dist/server/provider-mcp.d.ts +2 -0
- package/dist/server/provider-mcp.js +3 -1
- package/dist/server/rest-elysia.d.ts +40 -0
- package/dist/server/rest-elysia.js +20 -1
- package/dist/server/rest-express.d.ts +16 -0
- package/dist/server/rest-express.js +36 -1
- package/dist/server/rest-generic.d.ts +32 -0
- package/dist/server/rest-generic.js +124 -1
- package/dist/server/rest-next-app.d.ts +35 -0
- package/dist/server/rest-next-app.js +38 -1
- package/dist/server/rest-next-mcp.d.ts +11 -0
- package/dist/server/rest-next-mcp.js +45 -1
- package/dist/server/rest-next-pages.d.ts +9 -0
- package/dist/server/rest-next-pages.js +22 -1
- package/dist/telemetry/anomaly.d.ts +27 -0
- package/dist/telemetry/anomaly.js +48 -1
- package/dist/telemetry/docs/telemetry.docblock.d.ts +6 -0
- package/dist/telemetry/docs/telemetry.docblock.js +21 -139
- package/dist/telemetry/index.d.ts +4 -0
- package/dist/telemetry/index.js +5 -1
- package/dist/telemetry/spec.d.ts +91 -0
- package/dist/telemetry/spec.js +69 -1
- package/dist/telemetry/tracker.d.ts +51 -0
- package/dist/telemetry/tracker.js +76 -1
- package/dist/tests/index.d.ts +3 -0
- package/dist/tests/index.js +4 -1
- package/dist/tests/runner.d.ts +43 -0
- package/dist/tests/runner.js +150 -1
- package/dist/tests/spec.d.ts +89 -0
- package/dist/tests/spec.js +33 -1
- package/dist/themes.d.ts +53 -0
- package/dist/themes.js +39 -1
- package/dist/translations/catalog.d.ts +28 -0
- package/dist/translations/tenant.d.ts +15 -0
- package/dist/types.d.ts +92 -0
- package/dist/workflow/adapters/db-adapter.d.ts +46 -0
- package/dist/workflow/adapters/db-adapter.js +83 -1
- package/dist/workflow/adapters/file-adapter.d.ts +14 -0
- package/dist/workflow/adapters/file-adapter.js +11 -1
- package/dist/workflow/adapters/index.d.ts +4 -0
- package/dist/workflow/adapters/index.js +5 -1
- package/dist/workflow/adapters/memory-store.d.ts +18 -0
- package/dist/workflow/adapters/memory-store.js +58 -1
- package/dist/workflow/expression.d.ts +9 -0
- package/dist/workflow/expression.js +99 -1
- package/dist/workflow/index.d.ts +10 -0
- package/dist/workflow/index.js +9 -1
- package/dist/workflow/runner.d.ts +74 -0
- package/dist/workflow/runner.js +337 -1
- package/dist/workflow/sla-monitor.d.ts +20 -0
- package/dist/workflow/sla-monitor.js +47 -1
- package/dist/workflow/spec.d.ts +105 -0
- package/dist/workflow/spec.js +55 -1
- package/dist/workflow/state.d.ts +35 -0
- package/dist/workflow/validation.d.ts +29 -0
- package/dist/workflow/validation.js +176 -1
- package/dist/workspace-config/contractsrc-schema.d.ts +786 -0
- package/dist/workspace-config/contractsrc-schema.js +247 -0
- package/dist/workspace-config/index.d.ts +2 -0
- package/dist/workspace-config/index.js +3 -0
- package/package.json +287 -266
- package/dist/capabilities.js +0 -1
- package/dist/contracts-adapter-hydration.js +0 -1
- package/dist/contracts-adapter-input.js +0 -1
- package/dist/data-views.js +0 -1
- package/dist/docs/PUBLISHING.docblock.js +0 -76
- package/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -383
- package/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -68
- package/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -140
- package/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -86
- package/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -1
- package/dist/forms.js +0 -1
- package/dist/integrations/contracts.js +0 -1
- package/dist/knowledge/contracts.js +0 -1
- package/dist/node_modules/@pothos/plugin-complexity/esm/calculate-complexity.js +0 -1
- package/dist/node_modules/@pothos/plugin-complexity/esm/defaults.js +0 -1
- package/dist/node_modules/@pothos/plugin-complexity/esm/index.js +0 -1
- package/dist/node_modules/@pothos/plugin-complexity/esm/types.js +0 -1
- package/dist/node_modules/@pothos/plugin-complexity/esm/util.js +0 -1
- package/dist/node_modules/@pothos/plugin-complexity/esm/validator.js +0 -1
- package/dist/node_modules/@pothos/plugin-dataloader/esm/field-builder.js +0 -1
- package/dist/node_modules/@pothos/plugin-dataloader/esm/index.js +0 -1
- package/dist/node_modules/@pothos/plugin-dataloader/esm/refs/index.js +0 -1
- package/dist/node_modules/@pothos/plugin-dataloader/esm/refs/interface.js +0 -1
- package/dist/node_modules/@pothos/plugin-dataloader/esm/refs/node.js +0 -1
- package/dist/node_modules/@pothos/plugin-dataloader/esm/refs/object.js +0 -1
- package/dist/node_modules/@pothos/plugin-dataloader/esm/refs/union.js +0 -1
- package/dist/node_modules/@pothos/plugin-dataloader/esm/schema-builder.js +0 -1
- package/dist/node_modules/@pothos/plugin-dataloader/esm/util.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/connection-helpers.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/field-builder.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/index.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/interface-ref.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/model-loader.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/node-ref.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/object-ref.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/prisma-field-builder.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/schema-builder.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/cursors.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/datamodel.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/deep-equal.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/description.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/get-client.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/loader-map.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/map-query.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/relation-map.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/selections.js +0 -1
- package/dist/node_modules/@pothos/plugin-prisma/esm/util/usage.js +0 -1
- package/dist/node_modules/@pothos/plugin-tracing/esm/index.js +0 -1
- package/dist/node_modules/@pothos/plugin-tracing/esm/util.js +0 -1
- package/dist/node_modules/dataloader/index.js +0 -7
- package/dist/node_modules/graphql/error/GraphQLError.js +0 -5
- package/dist/node_modules/graphql/error/index.js +0 -1
- package/dist/node_modules/graphql/error/locatedError.js +0 -1
- package/dist/node_modules/graphql/error/syntaxError.js +0 -1
- package/dist/node_modules/graphql/execution/collectFields.js +0 -1
- package/dist/node_modules/graphql/execution/execute.js +0 -1
- package/dist/node_modules/graphql/execution/index.js +0 -1
- package/dist/node_modules/graphql/execution/mapAsyncIterator.js +0 -1
- package/dist/node_modules/graphql/execution/subscribe.js +0 -1
- package/dist/node_modules/graphql/execution/values.js +0 -1
- package/dist/node_modules/graphql/graphql.js +0 -1
- package/dist/node_modules/graphql/index.js +0 -1
- package/dist/node_modules/graphql/jsutils/Path.js +0 -1
- package/dist/node_modules/graphql/jsutils/devAssert.js +0 -1
- package/dist/node_modules/graphql/jsutils/didYouMean.js +0 -1
- package/dist/node_modules/graphql/jsutils/groupBy.js +0 -1
- package/dist/node_modules/graphql/jsutils/identityFunc.js +0 -1
- package/dist/node_modules/graphql/jsutils/inspect.js +0 -1
- package/dist/node_modules/graphql/jsutils/instanceOf.js +0 -12
- package/dist/node_modules/graphql/jsutils/invariant.js +0 -1
- package/dist/node_modules/graphql/jsutils/isAsyncIterable.js +0 -1
- package/dist/node_modules/graphql/jsutils/isIterableObject.js +0 -1
- package/dist/node_modules/graphql/jsutils/isObjectLike.js +0 -1
- package/dist/node_modules/graphql/jsutils/isPromise.js +0 -1
- package/dist/node_modules/graphql/jsutils/keyMap.js +0 -1
- package/dist/node_modules/graphql/jsutils/keyValMap.js +0 -1
- package/dist/node_modules/graphql/jsutils/mapValue.js +0 -1
- package/dist/node_modules/graphql/jsutils/memoize3.js +0 -1
- package/dist/node_modules/graphql/jsutils/naturalCompare.js +0 -1
- package/dist/node_modules/graphql/jsutils/printPathArray.js +0 -1
- package/dist/node_modules/graphql/jsutils/promiseForObject.js +0 -1
- package/dist/node_modules/graphql/jsutils/promiseReduce.js +0 -1
- package/dist/node_modules/graphql/jsutils/suggestionList.js +0 -1
- package/dist/node_modules/graphql/jsutils/toError.js +0 -1
- package/dist/node_modules/graphql/jsutils/toObjMap.js +0 -1
- package/dist/node_modules/graphql/language/ast.js +0 -1
- package/dist/node_modules/graphql/language/blockString.js +0 -3
- package/dist/node_modules/graphql/language/characterClasses.js +0 -1
- package/dist/node_modules/graphql/language/directiveLocation.js +0 -1
- package/dist/node_modules/graphql/language/index.js +0 -1
- package/dist/node_modules/graphql/language/kinds.js +0 -1
- package/dist/node_modules/graphql/language/lexer.js +0 -3
- package/dist/node_modules/graphql/language/location.js +0 -1
- package/dist/node_modules/graphql/language/parser.js +0 -1
- package/dist/node_modules/graphql/language/predicates.js +0 -1
- package/dist/node_modules/graphql/language/printLocation.js +0 -2
- package/dist/node_modules/graphql/language/printString.js +0 -1
- package/dist/node_modules/graphql/language/printer.js +0 -34
- package/dist/node_modules/graphql/language/schemaCoordinateLexer.js +0 -1
- package/dist/node_modules/graphql/language/source.js +0 -1
- package/dist/node_modules/graphql/language/tokenKind.js +0 -1
- package/dist/node_modules/graphql/language/visitor.js +0 -1
- package/dist/node_modules/graphql/type/assertName.js +0 -1
- package/dist/node_modules/graphql/type/definition.js +0 -1
- package/dist/node_modules/graphql/type/directives.js +0 -1
- package/dist/node_modules/graphql/type/index.js +0 -1
- package/dist/node_modules/graphql/type/introspection.js +0 -3
- package/dist/node_modules/graphql/type/scalars.js +0 -1
- package/dist/node_modules/graphql/type/schema.js +0 -1
- package/dist/node_modules/graphql/type/validate.js +0 -3
- package/dist/node_modules/graphql/utilities/TypeInfo.js +0 -1
- package/dist/node_modules/graphql/utilities/assertValidName.js +0 -1
- package/dist/node_modules/graphql/utilities/astFromValue.js +0 -1
- package/dist/node_modules/graphql/utilities/buildASTSchema.js +0 -1
- package/dist/node_modules/graphql/utilities/buildClientSchema.js +0 -1
- package/dist/node_modules/graphql/utilities/coerceInputValue.js +0 -1
- package/dist/node_modules/graphql/utilities/concatAST.js +0 -1
- package/dist/node_modules/graphql/utilities/extendSchema.js +0 -1
- package/dist/node_modules/graphql/utilities/findBreakingChanges.js +0 -1
- package/dist/node_modules/graphql/utilities/getIntrospectionQuery.js +0 -107
- package/dist/node_modules/graphql/utilities/getOperationAST.js +0 -1
- package/dist/node_modules/graphql/utilities/getOperationRootType.js +0 -1
- package/dist/node_modules/graphql/utilities/index.js +0 -1
- package/dist/node_modules/graphql/utilities/introspectionFromSchema.js +0 -1
- package/dist/node_modules/graphql/utilities/lexicographicSortSchema.js +0 -1
- package/dist/node_modules/graphql/utilities/printSchema.js +0 -13
- package/dist/node_modules/graphql/utilities/resolveSchemaCoordinate.js +0 -1
- package/dist/node_modules/graphql/utilities/separateOperations.js +0 -1
- package/dist/node_modules/graphql/utilities/sortValueNode.js +0 -1
- package/dist/node_modules/graphql/utilities/stripIgnoredCharacters.js +0 -1
- package/dist/node_modules/graphql/utilities/typeComparators.js +0 -1
- package/dist/node_modules/graphql/utilities/typeFromAST.js +0 -1
- package/dist/node_modules/graphql/utilities/valueFromAST.js +0 -1
- package/dist/node_modules/graphql/utilities/valueFromASTUntyped.js +0 -1
- package/dist/node_modules/graphql/validation/ValidationContext.js +0 -1
- package/dist/node_modules/graphql/validation/index.js +0 -1
- package/dist/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/KnownDirectivesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/KnownTypeNamesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/MaxIntrospectionDepthRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/ScalarLeafsRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js +0 -1
- package/dist/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +0 -1
- package/dist/node_modules/graphql/validation/specifiedRules.js +0 -1
- package/dist/node_modules/graphql/validation/validate.js +0 -5
- package/dist/node_modules/graphql/version.js +0 -1
- package/dist/openbanking/docs/openbanking.docblock.js +0 -109
- package/dist/presentations.backcompat.js +0 -1
- package/dist/presentations.js +0 -1
- package/dist/presentations.v2.js +0 -7
- package/dist/spec.js +0 -1
- package/dist/types/all.js +0 -0
- /package/dist/{node_modules/@pothos/plugin-prisma/esm/types.js → integrations/secrets-types.js} +0 -0
|
@@ -1 +1,153 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { DEFAULT_RETRY_POLICY } from "./queue.js";
|
|
2
|
+
import { randomUUID } from "crypto";
|
|
3
|
+
import { DeleteMessageCommand, ReceiveMessageCommand, SQSClient, SendMessageCommand } from "@aws-sdk/client-sqs";
|
|
4
|
+
|
|
5
|
+
//#region src/jobs/scaleway-sqs-queue.ts
|
|
6
|
+
var ScalewaySqsJobQueue = class {
|
|
7
|
+
sqs;
|
|
8
|
+
queueUrl;
|
|
9
|
+
waitTimeSeconds;
|
|
10
|
+
maxNumberOfMessages;
|
|
11
|
+
visibilityTimeoutSeconds;
|
|
12
|
+
handlers = /* @__PURE__ */ new Map();
|
|
13
|
+
running = false;
|
|
14
|
+
constructor(config) {
|
|
15
|
+
const accessKeyId = process.env.SCALEWAY_ACCESS_KEY_QUEUE;
|
|
16
|
+
const secretAccessKey = process.env.SCALEWAY_SECRET_KEY_QUEUE;
|
|
17
|
+
if (!accessKeyId || !secretAccessKey) throw new Error("Missing SCALEWAY_ACCESS_KEY_QUEUE / SCALEWAY_SECRET_KEY_QUEUE in env");
|
|
18
|
+
this.sqs = new SQSClient({
|
|
19
|
+
region: config.region ?? process.env.SCALEWAY_REGION ?? "par",
|
|
20
|
+
endpoint: "https://sqs.mnq.fr-par.scaleway.com",
|
|
21
|
+
credentials: {
|
|
22
|
+
accessKeyId,
|
|
23
|
+
secretAccessKey
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
this.queueUrl = config.queueUrl;
|
|
27
|
+
this.waitTimeSeconds = config.waitTimeSeconds ?? 20;
|
|
28
|
+
this.maxNumberOfMessages = config.maxNumberOfMessages ?? 5;
|
|
29
|
+
this.visibilityTimeoutSeconds = config.visibilityTimeoutSeconds ?? 60;
|
|
30
|
+
}
|
|
31
|
+
async enqueue(jobType, payload, options = {}) {
|
|
32
|
+
const id = randomUUID();
|
|
33
|
+
const now = /* @__PURE__ */ new Date();
|
|
34
|
+
const envelope = {
|
|
35
|
+
id,
|
|
36
|
+
type: jobType,
|
|
37
|
+
payload
|
|
38
|
+
};
|
|
39
|
+
await this.sqs.send(new SendMessageCommand({
|
|
40
|
+
QueueUrl: this.queueUrl,
|
|
41
|
+
MessageBody: JSON.stringify(envelope),
|
|
42
|
+
DelaySeconds: options.delaySeconds ?? 0
|
|
43
|
+
}));
|
|
44
|
+
return {
|
|
45
|
+
id,
|
|
46
|
+
type: jobType,
|
|
47
|
+
version: 1,
|
|
48
|
+
payload,
|
|
49
|
+
status: "pending",
|
|
50
|
+
priority: options.priority ?? 0,
|
|
51
|
+
attempts: 0,
|
|
52
|
+
maxRetries: options.maxRetries ?? DEFAULT_RETRY_POLICY.maxRetries,
|
|
53
|
+
createdAt: now,
|
|
54
|
+
updatedAt: now
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
register(jobType, handler) {
|
|
58
|
+
if (this.handlers.has(jobType)) throw new Error(`Handler already registered for job type "${jobType}"`);
|
|
59
|
+
this.handlers.set(jobType, handler);
|
|
60
|
+
}
|
|
61
|
+
start() {
|
|
62
|
+
if (this.running) return;
|
|
63
|
+
this.running = true;
|
|
64
|
+
this.pollLoop().catch((err) => {
|
|
65
|
+
console.error("[queue] Fatal error in poll loop", err);
|
|
66
|
+
process.exit(1);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async stop() {
|
|
70
|
+
this.running = false;
|
|
71
|
+
}
|
|
72
|
+
async pollLoop() {
|
|
73
|
+
console.log("[queue] SQS worker started for queue:", this.queueUrl);
|
|
74
|
+
while (this.running) try {
|
|
75
|
+
const messages = (await this.sqs.send(new ReceiveMessageCommand({
|
|
76
|
+
QueueUrl: this.queueUrl,
|
|
77
|
+
MaxNumberOfMessages: this.maxNumberOfMessages,
|
|
78
|
+
WaitTimeSeconds: this.waitTimeSeconds,
|
|
79
|
+
VisibilityTimeout: this.visibilityTimeoutSeconds,
|
|
80
|
+
MessageSystemAttributeNames: ["ApproximateReceiveCount"]
|
|
81
|
+
}))).Messages ?? [];
|
|
82
|
+
if (messages.length === 0) continue;
|
|
83
|
+
for (const msg of messages) {
|
|
84
|
+
if (!msg.Body || !msg.ReceiptHandle) {
|
|
85
|
+
console.warn("[queue] Message missing Body or ReceiptHandle", msg.MessageId);
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
let envelope;
|
|
89
|
+
try {
|
|
90
|
+
envelope = JSON.parse(msg.Body);
|
|
91
|
+
} catch (err) {
|
|
92
|
+
console.error(`[queue] Failed to parse message body (id=${msg.MessageId}), deleting`, err);
|
|
93
|
+
await this.deleteMessage(msg.ReceiptHandle);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const handler = this.handlers.get(envelope.type);
|
|
97
|
+
if (!handler) {
|
|
98
|
+
console.error(`[queue] No handler registered for type "${envelope.type}", deleting message`);
|
|
99
|
+
await this.deleteMessage(msg.ReceiptHandle);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const now = /* @__PURE__ */ new Date();
|
|
103
|
+
const attempts = parseInt(msg.Attributes?.ApproximateReceiveCount ?? "1", 10);
|
|
104
|
+
const job = {
|
|
105
|
+
id: envelope.id,
|
|
106
|
+
type: envelope.type,
|
|
107
|
+
version: 1,
|
|
108
|
+
payload: envelope.payload,
|
|
109
|
+
status: "pending",
|
|
110
|
+
priority: 0,
|
|
111
|
+
attempts,
|
|
112
|
+
maxRetries: DEFAULT_RETRY_POLICY.maxRetries,
|
|
113
|
+
createdAt: now,
|
|
114
|
+
updatedAt: now
|
|
115
|
+
};
|
|
116
|
+
job.status = "running";
|
|
117
|
+
job.updatedAt = /* @__PURE__ */ new Date();
|
|
118
|
+
try {
|
|
119
|
+
await handler(job);
|
|
120
|
+
job.status = "completed";
|
|
121
|
+
job.updatedAt = /* @__PURE__ */ new Date();
|
|
122
|
+
await this.deleteMessage(msg.ReceiptHandle);
|
|
123
|
+
} catch (err) {
|
|
124
|
+
job.status = "failed";
|
|
125
|
+
job.lastError = err instanceof Error ? err.message : "Unknown job error";
|
|
126
|
+
job.updatedAt = /* @__PURE__ */ new Date();
|
|
127
|
+
console.error(`[queue] Error while handling job type=${job.type} id=${job.id}`, err);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
} catch (err) {
|
|
131
|
+
if (!!err && typeof err === "object" && "$response" in err) console.error("[queue] Error while polling SQS", err, err.$response);
|
|
132
|
+
else console.error("[queue] Error while polling SQS", err);
|
|
133
|
+
await this.sleep(5e3);
|
|
134
|
+
}
|
|
135
|
+
console.log("[queue] SQS worker stopped");
|
|
136
|
+
}
|
|
137
|
+
async deleteMessage(receiptHandle) {
|
|
138
|
+
try {
|
|
139
|
+
await this.sqs.send(new DeleteMessageCommand({
|
|
140
|
+
QueueUrl: this.queueUrl,
|
|
141
|
+
ReceiptHandle: receiptHandle
|
|
142
|
+
}));
|
|
143
|
+
} catch (err) {
|
|
144
|
+
console.error("[queue] Failed to delete message", err);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
async sleep(ms) {
|
|
148
|
+
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
//#endregion
|
|
153
|
+
export { ScalewaySqsJobQueue };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Stability, Tag } from "./ownership.js";
|
|
2
|
+
import "./operations/index.js";
|
|
3
|
+
import { OpKind, OperationSpec } from "./operations/operation.js";
|
|
4
|
+
import * as _lssm_lib_schema0 from "@lssm/lib.schema";
|
|
5
|
+
import { AnySchemaModel } from "@lssm/lib.schema";
|
|
6
|
+
import z from "zod";
|
|
7
|
+
|
|
8
|
+
//#region src/jsonschema.d.ts
|
|
9
|
+
declare function jsonSchemaForSpec(spec: OperationSpec<AnySchemaModel, AnySchemaModel>): {
|
|
10
|
+
input: z.core.ZodStandardJSONSchemaPayload<_lssm_lib_schema0.TopLevelZodFromModel<_lssm_lib_schema0.SchemaModelFieldsAnyConfig<AnySchemaModel | _lssm_lib_schema0.AnyFieldType | _lssm_lib_schema0.AnyEnumType>>> | null;
|
|
11
|
+
output: z.core.ZodStandardJSONSchemaPayload<_lssm_lib_schema0.TopLevelZodFromModel<_lssm_lib_schema0.SchemaModelFieldsAnyConfig<AnySchemaModel | _lssm_lib_schema0.AnyFieldType | _lssm_lib_schema0.AnyEnumType>>> | null;
|
|
12
|
+
meta: {
|
|
13
|
+
name: string;
|
|
14
|
+
version: number;
|
|
15
|
+
kind: OpKind;
|
|
16
|
+
description: string;
|
|
17
|
+
tags: Tag[];
|
|
18
|
+
stability: Stability;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
/** Helper to derive default REST path */
|
|
22
|
+
declare function defaultRestPath(name: string, version: number): string;
|
|
23
|
+
/** Helper to derive default MCP tool name */
|
|
24
|
+
declare function defaultMcpTool(name: string, version: number): string;
|
|
25
|
+
/** Helper to derive default GraphQL field name */
|
|
26
|
+
declare function defaultGqlField(name: string, version: number): string;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { defaultGqlField, defaultMcpTool, defaultRestPath, jsonSchemaForSpec };
|
package/dist/jsonschema.js
CHANGED
|
@@ -1 +1,32 @@
|
|
|
1
|
-
import
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/jsonschema.ts
|
|
4
|
+
function jsonSchemaForSpec(spec) {
|
|
5
|
+
return {
|
|
6
|
+
input: spec.io.input ? z.toJSONSchema(spec.io.input.getZod()) : null,
|
|
7
|
+
output: spec.io.output ? z.toJSONSchema(spec.io.output.getZod()) : null,
|
|
8
|
+
meta: {
|
|
9
|
+
name: spec.meta.key,
|
|
10
|
+
version: spec.meta.version,
|
|
11
|
+
kind: spec.meta.kind,
|
|
12
|
+
description: spec.meta.description,
|
|
13
|
+
tags: spec.meta.tags ?? [],
|
|
14
|
+
stability: spec.meta.stability ?? "stable"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/** Helper to derive default REST path */
|
|
19
|
+
function defaultRestPath(name, version) {
|
|
20
|
+
return `/${name.replace(/\./g, "/")}/v${version}`;
|
|
21
|
+
}
|
|
22
|
+
/** Helper to derive default MCP tool name */
|
|
23
|
+
function defaultMcpTool(name, version) {
|
|
24
|
+
return `${name}-v${version}`;
|
|
25
|
+
}
|
|
26
|
+
/** Helper to derive default GraphQL field name */
|
|
27
|
+
function defaultGqlField(name, version) {
|
|
28
|
+
return `${name.replace(/\./g, "_")}_v${version}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { defaultGqlField, defaultMcpTool, defaultRestPath, jsonSchemaForSpec };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/knowledge/binding.d.ts
|
|
2
|
+
interface AppKnowledgeBinding {
|
|
3
|
+
/** Which KnowledgeSpace to use. */
|
|
4
|
+
spaceKey: string;
|
|
5
|
+
spaceVersion?: number;
|
|
6
|
+
/** Optional: scope to specific workflows/agents. */
|
|
7
|
+
scope?: {
|
|
8
|
+
workflows?: string[];
|
|
9
|
+
agents?: string[];
|
|
10
|
+
operations?: string[];
|
|
11
|
+
};
|
|
12
|
+
/** Usage constraints. */
|
|
13
|
+
constraints?: {
|
|
14
|
+
/** Max tokens per query. */
|
|
15
|
+
maxTokensPerQuery?: number;
|
|
16
|
+
/** Max queries per minute. */
|
|
17
|
+
maxQueriesPerMinute?: number;
|
|
18
|
+
};
|
|
19
|
+
/** Priority when multiple spaces overlap. */
|
|
20
|
+
priority?: number;
|
|
21
|
+
/** Whether access to the space is required (blocking) or optional. */
|
|
22
|
+
required?: boolean;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { AppKnowledgeBinding };
|
|
@@ -1,138 +1,21 @@
|
|
|
1
|
-
import{registerDocBlocks
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
spaces available to any vertical.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- Access policy (trust level, automation write permissions).
|
|
23
|
-
- Indexing configuration (embedding model, chunk size, vector DB slot).
|
|
24
|
-
|
|
25
|
-
## Sources & Bindings
|
|
26
|
-
|
|
27
|
-
- \`KnowledgeSourceConfig\` records tenant-specific connections (bucket,
|
|
28
|
-
Gmail labels, sync cadence). Pocket Family Office provides sample
|
|
29
|
-
configs in \`knowledge/sources.sample.ts\`.
|
|
30
|
-
- \`AppKnowledgeBinding\` associates spaces with workflows/agents and adds
|
|
31
|
-
per-tenant constraints (rate limits, scopes).
|
|
32
|
-
|
|
33
|
-
Validation ensures that:
|
|
34
|
-
|
|
35
|
-
- All referenced spaces exist in the registry.
|
|
36
|
-
- At least one source is configured per binding.
|
|
37
|
-
- External/ephemeral spaces trigger warnings for policy-sensitive flows.
|
|
38
|
-
|
|
39
|
-
## Ingestion Pipeline
|
|
40
|
-
|
|
41
|
-
Implemented in \`packages/libs/contracts/src/knowledge/ingestion\`:
|
|
42
|
-
|
|
43
|
-
1. **DocumentProcessor** – pluggable MIME extractors producing
|
|
44
|
-
\`DocumentFragment\`s.
|
|
45
|
-
2. **EmbeddingService** – batches fragments through an \`EmbeddingProvider\`
|
|
46
|
-
(Mistral in the reference implementation).
|
|
47
|
-
3. **VectorIndexer** – upserts fragments into a \`VectorStoreProvider\`
|
|
48
|
-
(Qdrant in production, with in-memory implementations for tests).
|
|
49
|
-
4. **Adapters**
|
|
50
|
-
- \`GmailIngestionAdapter\`: list threads → convert to raw documents →
|
|
51
|
-
index.
|
|
52
|
-
- \`StorageIngestionAdapter\`: fetch object from storage provider →
|
|
53
|
-
index.
|
|
54
|
-
|
|
55
|
-
Background jobs (see \`jobs/\`) orchestrate ingestion via Cloud Tasks /
|
|
56
|
-
Pub/Sub or in-memory workers. Handlers:
|
|
57
|
-
|
|
58
|
-
- \`storage-document-handler\` – resolves storage object + indexes.
|
|
59
|
-
- \`gmail-sync-handler\` – syncs threads based on label/date filters.
|
|
60
|
-
|
|
61
|
-
## Query Service
|
|
62
|
-
|
|
63
|
-
\`KnowledgeQueryService\` performs retrieval-augmented generation:
|
|
64
|
-
|
|
65
|
-
1. Embed the user query using the configured provider.
|
|
66
|
-
2. Search the vector store for top-k matches.
|
|
67
|
-
3. Compose prompts combining system instructions + contextual snippets.
|
|
68
|
-
4. Invoke the LLM provider (Mistral) and return the answer plus
|
|
69
|
-
references and token usage.
|
|
70
|
-
|
|
71
|
-
The service is designed for tooling: workflows can execute it directly
|
|
72
|
-
or through custom operations (see \`pfo.summary.generate\` contract).
|
|
73
|
-
|
|
74
|
-
## Guardrails
|
|
75
|
-
|
|
76
|
-
- Automation can only write to spaces where \`automationWritable\` is true.
|
|
77
|
-
- Canonical spaces default to high trust; external/ephemeral spaces are
|
|
78
|
-
flagged during validation.
|
|
79
|
-
- Telemetry captures query volumes per tenant + space.
|
|
80
|
-
|
|
81
|
-
## Extending
|
|
82
|
-
|
|
83
|
-
1. Define a new \`KnowledgeSpaceSpec\` with indexing/retention policies.
|
|
84
|
-
2. Add sources pointing to storage providers or APIs.
|
|
85
|
-
3. Register adapters if ingestion requires bespoke logic.
|
|
86
|
-
4. Reference the space in blueprints (\`AppKnowledgeBinding\`) and update
|
|
87
|
-
workflows/agents accordingly.
|
|
88
|
-
|
|
89
|
-
The Pocket Family Office tests (\`tests/pocket-family-office.test.ts\`)
|
|
90
|
-
show how to wire the ingestion pipeline, index a document, and run an
|
|
91
|
-
end-to-end knowledge query using in-memory providers.
|
|
92
|
-
## Knowledge Spaces & Guardrails
|
|
93
|
-
|
|
94
|
-
Knowledge surfaces (\`KnowledgeSpaceSpec\`) describe curated corpora that agents and workflows can consult. Tenant bindings (\`AppKnowledgeBinding\`) declare which spaces are active, who can use them, and optional usage constraints.
|
|
95
|
-
|
|
96
|
-
### Binding recap
|
|
97
|
-
|
|
98
|
-
- \`spaceKey\` / \`spaceVersion\`: pointer to the \`KnowledgeSpaceSpec\`
|
|
99
|
-
- \`scope.workflows\` / \`scope.agents\`: explicit allow-lists for consumers
|
|
100
|
-
- \`constraints.maxTokensPerQuery\` & \`constraints.maxQueriesPerMinute\`: throttling knobs for LLM-backed search
|
|
101
|
-
- \`required\`: mark the binding as blocking (defaults to \`true\`)
|
|
102
|
-
|
|
103
|
-
At runtime, \`ResolvedAppConfig.knowledge\` contains \`ResolvedKnowledge\` entries with the bound space, active sources, and the binding metadata above.
|
|
104
|
-
|
|
105
|
-
### KnowledgeAccessGuard
|
|
106
|
-
|
|
107
|
-
\`KnowledgeAccessGuard\` (\`@lssm/lib.contracts/knowledge/runtime\`) centralises the access checks that must run before any workflow/agent reads or mutates a knowledge space.
|
|
108
|
-
|
|
109
|
-
\`\`\`ts
|
|
110
|
-
import { KnowledgeAccessGuard } from '@lssm/lib.contracts/knowledge/runtime';
|
|
111
|
-
|
|
112
|
-
const guard = new KnowledgeAccessGuard({
|
|
113
|
-
disallowWriteCategories: ['external', 'ephemeral'], // default
|
|
114
|
-
requireWorkflowBinding: true,
|
|
115
|
-
requireAgentBinding: false,
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
const result = guard.checkAccess(resolvedKnowledge, {
|
|
119
|
-
tenantId,
|
|
120
|
-
appId,
|
|
121
|
-
workflowName: 'order-processing',
|
|
122
|
-
operation: 'read', // or 'write' / 'search'
|
|
123
|
-
}, resolvedAppConfig);
|
|
124
|
-
|
|
125
|
-
if (!result.allowed) {
|
|
126
|
-
throw new Error(result.reason);
|
|
127
|
-
}
|
|
128
|
-
\`\`\`
|
|
129
|
-
|
|
130
|
-
Key behaviours:
|
|
131
|
-
|
|
132
|
-
- **Binding**: rejects access when the space is not present in the resolved tenant config.
|
|
133
|
-
- **Category guardrails**: blocks writes to \`external\` and \`ephemeral\` spaces by default; allows reads but emits warnings for \`ephemeral\`.
|
|
134
|
-
- **Workflow/agent scoping**: when \`requireWorkflowBinding\` or \`requireAgentBinding\` is enabled, only explicitly authorised consumers may access the space.
|
|
135
|
-
|
|
136
|
-
Use the guard inside workflow operations or agent resolvers to guarantee multi-tenant isolation and honour data governance rules.
|
|
137
|
-
|
|
138
|
-
`}];e(t);export{t as tech_contracts_knowledge_DocBlocks};
|
|
1
|
+
import { registerDocBlocks } from "../../docs/registry.js";
|
|
2
|
+
|
|
3
|
+
//#region src/knowledge/docs/knowledge.docblock.ts
|
|
4
|
+
const tech_contracts_knowledge_DocBlocks = [{
|
|
5
|
+
id: "docs.tech.contracts.knowledge",
|
|
6
|
+
title: "Knowledge Layer",
|
|
7
|
+
summary: "The knowledge layer turns unstructured inputs (uploads, email threads,",
|
|
8
|
+
kind: "reference",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
route: "/docs/tech/contracts/knowledge",
|
|
11
|
+
tags: [
|
|
12
|
+
"tech",
|
|
13
|
+
"contracts",
|
|
14
|
+
"knowledge"
|
|
15
|
+
],
|
|
16
|
+
body: "# Knowledge Layer\n\nThe knowledge layer turns unstructured inputs (uploads, email threads,\nnotes) into searchable context for agents and workflows. The Pocket\nFamily Office vertical ships a minimal but production-ready stack that\ncovers ingestion, indexing, querying, and guardrails.\n\n## Knowledge Spaces\n\nKnowledge is organised via `KnowledgeSpaceSpec` definitions under\n`packages/libs/contracts/src/knowledge/spaces`:\n\n- `knowledge.financial-docs` – canonical invoices, bills, and contracts.\n- `knowledge.email-threads` – operational Gmail threads.\n- `knowledge.support-faq` / `knowledge.product-canon` – reusable shared\n spaces available to any vertical.\n\nEach space defines:\n\n- Ownership metadata (domain, owners, stability tags).\n- Retention policy (TTL/archival).\n- Access policy (trust level, automation write permissions).\n- Indexing configuration (embedding model, chunk size, vector DB slot).\n\n## Sources & Bindings\n\n- `KnowledgeSourceConfig` records tenant-specific connections (bucket,\n Gmail labels, sync cadence). Pocket Family Office provides sample\n configs in `knowledge/sources.sample.ts`.\n- `AppKnowledgeBinding` associates spaces with workflows/agents and adds\n per-tenant constraints (rate limits, scopes).\n\nValidation ensures that:\n\n- All referenced spaces exist in the registry.\n- At least one source is configured per binding.\n- External/ephemeral spaces trigger warnings for policy-sensitive flows.\n\n## Ingestion Pipeline\n\nImplemented in `packages/libs/contracts/src/knowledge/ingestion`:\n\n1. **DocumentProcessor** – pluggable MIME extractors producing\n `DocumentFragment`s.\n2. **EmbeddingService** – batches fragments through an `EmbeddingProvider`\n (Mistral in the reference implementation).\n3. **VectorIndexer** – upserts fragments into a `VectorStoreProvider`\n (Qdrant in production, with in-memory implementations for tests).\n4. **Adapters**\n - `GmailIngestionAdapter`: list threads → convert to raw documents →\n index.\n - `StorageIngestionAdapter`: fetch object from storage provider →\n index.\n\nBackground jobs (see `jobs/`) orchestrate ingestion via Cloud Tasks /\nPub/Sub or in-memory workers. Handlers:\n\n- `storage-document-handler` – resolves storage object + indexes.\n- `gmail-sync-handler` – syncs threads based on label/date filters.\n\n## Query Service\n\n`KnowledgeQueryService` performs retrieval-augmented generation:\n\n1. Embed the user query using the configured provider.\n2. Search the vector store for top-k matches.\n3. Compose prompts combining system instructions + contextual snippets.\n4. Invoke the LLM provider (Mistral) and return the answer plus\n references and token usage.\n\nThe service is designed for tooling: workflows can execute it directly\nor through custom operations (see `pfo.summary.generate` contract).\n\n## Guardrails\n\n- Automation can only write to spaces where `automationWritable` is true.\n- Canonical spaces default to high trust; external/ephemeral spaces are\n flagged during validation.\n- Telemetry captures query volumes per tenant + space.\n\n## Extending\n\n1. Define a new `KnowledgeSpaceSpec` with indexing/retention policies.\n2. Add sources pointing to storage providers or APIs.\n3. Register adapters if ingestion requires bespoke logic.\n4. Reference the space in blueprints (`AppKnowledgeBinding`) and update\n workflows/agents accordingly.\n\nThe Pocket Family Office tests (`tests/pocket-family-office.test.ts`)\nshow how to wire the ingestion pipeline, index a document, and run an\nend-to-end knowledge query using in-memory providers.\n## Knowledge Spaces & Guardrails\n\nKnowledge surfaces (`KnowledgeSpaceSpec`) describe curated corpora that agents and workflows can consult. Tenant bindings (`AppKnowledgeBinding`) declare which spaces are active, who can use them, and optional usage constraints.\n\n### Binding recap\n\n- `spaceKey` / `spaceVersion`: pointer to the `KnowledgeSpaceSpec`\n- `scope.workflows` / `scope.agents`: explicit allow-lists for consumers\n- `constraints.maxTokensPerQuery` & `constraints.maxQueriesPerMinute`: throttling knobs for LLM-backed search\n- `required`: mark the binding as blocking (defaults to `true`)\n\nAt runtime, `ResolvedAppConfig.knowledge` contains `ResolvedKnowledge` entries with the bound space, active sources, and the binding metadata above.\n\n### KnowledgeAccessGuard\n\n`KnowledgeAccessGuard` (`@lssm/lib.contracts/knowledge/runtime`) centralises the access checks that must run before any workflow/agent reads or mutates a knowledge space.\n\n```ts\nimport { KnowledgeAccessGuard } from '@lssm/lib.contracts/knowledge/runtime';\n\nconst guard = new KnowledgeAccessGuard({\n disallowWriteCategories: ['external', 'ephemeral'], // default\n requireWorkflowBinding: true,\n requireAgentBinding: false,\n});\n\nconst result = guard.checkAccess(resolvedKnowledge, {\n tenantId,\n appId,\n workflowName: 'order-processing',\n operation: 'read', // or 'write' / 'search'\n}, resolvedAppConfig);\n\nif (!result.allowed) {\n throw new Error(result.reason);\n}\n```\n\nKey behaviours:\n\n- **Binding**: rejects access when the space is not present in the resolved tenant config.\n- **Category guardrails**: blocks writes to `external` and `ephemeral` spaces by default; allows reads but emits warnings for `ephemeral`.\n- **Workflow/agent scoping**: when `requireWorkflowBinding` or `requireAgentBinding` is enabled, only explicitly authorised consumers may access the space.\n\nUse the guard inside workflow operations or agent resolvers to guarantee multi-tenant isolation and honour data governance rules.\n\n"
|
|
17
|
+
}];
|
|
18
|
+
registerDocBlocks(tech_contracts_knowledge_DocBlocks);
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { tech_contracts_knowledge_DocBlocks };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { KnowledgeAccessPolicy, KnowledgeCategory, KnowledgeIndexingConfig, KnowledgeRetentionPolicy, KnowledgeSpaceMeta, KnowledgeSpaceRegistry, KnowledgeSpaceSpec, makeKnowledgeSpaceKey } from "./spec.js";
|
|
2
|
+
import { KnowledgeSourceConfig, KnowledgeSourceMeta, KnowledgeSourceType } from "./source.js";
|
|
3
|
+
import { AppKnowledgeBinding } from "./binding.js";
|
|
4
|
+
import { productCanonKnowledgeSpace, registerProductCanonKnowledgeSpace } from "./spaces/product-canon.js";
|
|
5
|
+
import { registerSupportFaqKnowledgeSpace, supportFaqKnowledgeSpace } from "./spaces/support-faq.js";
|
|
6
|
+
import { emailThreadsKnowledgeSpace, registerEmailThreadsKnowledgeSpace } from "./spaces/email-threads.js";
|
|
7
|
+
import { registerUploadedDocsKnowledgeSpace, uploadedDocsKnowledgeSpace } from "./spaces/uploaded-docs.js";
|
|
8
|
+
import { financialDocsKnowledgeSpace, registerFinancialDocsKnowledgeSpace } from "./spaces/financial-docs.js";
|
|
9
|
+
import { financialOverviewKnowledgeSpace, registerFinancialOverviewKnowledgeSpace } from "./spaces/financial-overview.js";
|
|
10
|
+
import "./spaces/index.js";
|
|
11
|
+
export { AppKnowledgeBinding, KnowledgeAccessPolicy, KnowledgeCategory, KnowledgeIndexingConfig, KnowledgeRetentionPolicy, KnowledgeSourceConfig, KnowledgeSourceMeta, KnowledgeSourceType, KnowledgeSpaceMeta, KnowledgeSpaceRegistry, KnowledgeSpaceSpec, emailThreadsKnowledgeSpace, financialDocsKnowledgeSpace, financialOverviewKnowledgeSpace, makeKnowledgeSpaceKey, productCanonKnowledgeSpace, registerEmailThreadsKnowledgeSpace, registerFinancialDocsKnowledgeSpace, registerFinancialOverviewKnowledgeSpace, registerProductCanonKnowledgeSpace, registerSupportFaqKnowledgeSpace, registerUploadedDocsKnowledgeSpace, supportFaqKnowledgeSpace, uploadedDocsKnowledgeSpace };
|
package/dist/knowledge/index.js
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { KnowledgeSpaceRegistry, makeKnowledgeSpaceKey } from "./spec.js";
|
|
2
|
+
import { productCanonKnowledgeSpace, registerProductCanonKnowledgeSpace } from "./spaces/product-canon.js";
|
|
3
|
+
import { registerSupportFaqKnowledgeSpace, supportFaqKnowledgeSpace } from "./spaces/support-faq.js";
|
|
4
|
+
import { emailThreadsKnowledgeSpace, registerEmailThreadsKnowledgeSpace } from "./spaces/email-threads.js";
|
|
5
|
+
import { registerUploadedDocsKnowledgeSpace, uploadedDocsKnowledgeSpace } from "./spaces/uploaded-docs.js";
|
|
6
|
+
import { financialDocsKnowledgeSpace, registerFinancialDocsKnowledgeSpace } from "./spaces/financial-docs.js";
|
|
7
|
+
import { financialOverviewKnowledgeSpace, registerFinancialOverviewKnowledgeSpace } from "./spaces/financial-overview.js";
|
|
8
|
+
import "./spaces/index.js";
|
|
9
|
+
|
|
10
|
+
export { KnowledgeSpaceRegistry, emailThreadsKnowledgeSpace, financialDocsKnowledgeSpace, financialOverviewKnowledgeSpace, makeKnowledgeSpaceKey, productCanonKnowledgeSpace, registerEmailThreadsKnowledgeSpace, registerFinancialDocsKnowledgeSpace, registerFinancialOverviewKnowledgeSpace, registerProductCanonKnowledgeSpace, registerSupportFaqKnowledgeSpace, registerUploadedDocsKnowledgeSpace, supportFaqKnowledgeSpace, uploadedDocsKnowledgeSpace };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/knowledge/ingestion/document-processor.d.ts
|
|
2
|
+
interface RawDocument {
|
|
3
|
+
id: string;
|
|
4
|
+
mimeType: string;
|
|
5
|
+
data: Uint8Array;
|
|
6
|
+
metadata?: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
interface DocumentFragment {
|
|
9
|
+
id: string;
|
|
10
|
+
documentId: string;
|
|
11
|
+
text: string;
|
|
12
|
+
metadata?: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
type Extractor = (input: RawDocument) => Promise<DocumentFragment[]>;
|
|
15
|
+
declare class DocumentProcessor {
|
|
16
|
+
private readonly extractors;
|
|
17
|
+
constructor();
|
|
18
|
+
registerExtractor(mimeType: string, extractor: Extractor): void;
|
|
19
|
+
process(document: RawDocument): Promise<DocumentFragment[]>;
|
|
20
|
+
private extractText;
|
|
21
|
+
private extractJson;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { DocumentFragment, DocumentProcessor, RawDocument };
|
|
@@ -1 +1,54 @@
|
|
|
1
|
-
import{Buffer
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
2
|
+
|
|
3
|
+
//#region src/knowledge/ingestion/document-processor.ts
|
|
4
|
+
var DocumentProcessor = class {
|
|
5
|
+
extractors = /* @__PURE__ */ new Map();
|
|
6
|
+
constructor() {
|
|
7
|
+
this.registerExtractor("text/plain", this.extractText);
|
|
8
|
+
this.registerExtractor("application/json", this.extractJson);
|
|
9
|
+
}
|
|
10
|
+
registerExtractor(mimeType, extractor) {
|
|
11
|
+
this.extractors.set(mimeType.toLowerCase(), extractor);
|
|
12
|
+
}
|
|
13
|
+
async process(document) {
|
|
14
|
+
const extractor = this.extractors.get(document.mimeType.toLowerCase()) ?? this.extractors.get("*/*");
|
|
15
|
+
if (!extractor) throw new Error(`No extractor registered for mime type ${document.mimeType}`);
|
|
16
|
+
const fragments = await extractor(document);
|
|
17
|
+
if (fragments.length === 0) return [{
|
|
18
|
+
id: `${document.id}:0`,
|
|
19
|
+
documentId: document.id,
|
|
20
|
+
text: "",
|
|
21
|
+
metadata: document.metadata
|
|
22
|
+
}];
|
|
23
|
+
return fragments;
|
|
24
|
+
}
|
|
25
|
+
async extractText(document) {
|
|
26
|
+
const text = Buffer.from(document.data).toString("utf-8");
|
|
27
|
+
return [{
|
|
28
|
+
id: `${document.id}:0`,
|
|
29
|
+
documentId: document.id,
|
|
30
|
+
text,
|
|
31
|
+
metadata: document.metadata
|
|
32
|
+
}];
|
|
33
|
+
}
|
|
34
|
+
async extractJson(document) {
|
|
35
|
+
const text = Buffer.from(document.data).toString("utf-8");
|
|
36
|
+
try {
|
|
37
|
+
const json = JSON.parse(text);
|
|
38
|
+
return [{
|
|
39
|
+
id: `${document.id}:0`,
|
|
40
|
+
documentId: document.id,
|
|
41
|
+
text: JSON.stringify(json, null, 2),
|
|
42
|
+
metadata: {
|
|
43
|
+
...document.metadata,
|
|
44
|
+
contentType: "application/json"
|
|
45
|
+
}
|
|
46
|
+
}];
|
|
47
|
+
} catch {
|
|
48
|
+
return this.extractText(document);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { DocumentProcessor };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EmbeddingProvider, EmbeddingResult } from "../../integrations/providers/embedding.js";
|
|
2
|
+
import { DocumentFragment } from "./document-processor.js";
|
|
3
|
+
|
|
4
|
+
//#region src/knowledge/ingestion/embedding-service.d.ts
|
|
5
|
+
declare class EmbeddingService {
|
|
6
|
+
private readonly provider;
|
|
7
|
+
private readonly batchSize;
|
|
8
|
+
constructor(provider: EmbeddingProvider, batchSize?: number);
|
|
9
|
+
embedFragments(fragments: DocumentFragment[]): Promise<EmbeddingResult[]>;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { EmbeddingService };
|
|
@@ -1 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/knowledge/ingestion/embedding-service.ts
|
|
2
|
+
var EmbeddingService = class {
|
|
3
|
+
provider;
|
|
4
|
+
batchSize;
|
|
5
|
+
constructor(provider, batchSize = 16) {
|
|
6
|
+
this.provider = provider;
|
|
7
|
+
this.batchSize = batchSize;
|
|
8
|
+
}
|
|
9
|
+
async embedFragments(fragments) {
|
|
10
|
+
const results = [];
|
|
11
|
+
for (let i = 0; i < fragments.length; i += this.batchSize) {
|
|
12
|
+
const documents = fragments.slice(i, i + this.batchSize).map((fragment) => ({
|
|
13
|
+
id: fragment.id,
|
|
14
|
+
text: fragment.text,
|
|
15
|
+
metadata: fragment.metadata
|
|
16
|
+
}));
|
|
17
|
+
const embeddings = await this.provider.embedDocuments(documents);
|
|
18
|
+
results.push(...embeddings);
|
|
19
|
+
}
|
|
20
|
+
return results;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { EmbeddingService };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EmailInboundProvider, EmailThread } from "../../integrations/providers/email.js";
|
|
2
|
+
import { DocumentProcessor } from "./document-processor.js";
|
|
3
|
+
import { EmbeddingService } from "./embedding-service.js";
|
|
4
|
+
import { VectorIndexer } from "./vector-indexer.js";
|
|
5
|
+
|
|
6
|
+
//#region src/knowledge/ingestion/gmail-adapter.d.ts
|
|
7
|
+
declare class GmailIngestionAdapter {
|
|
8
|
+
private readonly gmail;
|
|
9
|
+
private readonly processor;
|
|
10
|
+
private readonly embeddings;
|
|
11
|
+
private readonly indexer;
|
|
12
|
+
constructor(gmail: EmailInboundProvider, processor: DocumentProcessor, embeddings: EmbeddingService, indexer: VectorIndexer);
|
|
13
|
+
syncThreads(query?: Parameters<EmailInboundProvider['listThreads']>[0]): Promise<void>;
|
|
14
|
+
ingestThread(thread: EmailThread): Promise<void>;
|
|
15
|
+
private toRawDocument;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { GmailIngestionAdapter };
|
|
@@ -1,6 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/knowledge/ingestion/gmail-adapter.ts
|
|
2
|
+
var GmailIngestionAdapter = class {
|
|
3
|
+
constructor(gmail, processor, embeddings, indexer) {
|
|
4
|
+
this.gmail = gmail;
|
|
5
|
+
this.processor = processor;
|
|
6
|
+
this.embeddings = embeddings;
|
|
7
|
+
this.indexer = indexer;
|
|
8
|
+
}
|
|
9
|
+
async syncThreads(query) {
|
|
10
|
+
const threads = await this.gmail.listThreads(query);
|
|
11
|
+
for (const thread of threads) await this.ingestThread(thread);
|
|
12
|
+
}
|
|
13
|
+
async ingestThread(thread) {
|
|
14
|
+
const document = this.toRawDocument(thread);
|
|
15
|
+
const fragments = await this.processor.process(document);
|
|
16
|
+
const embeddings = await this.embeddings.embedFragments(fragments);
|
|
17
|
+
await this.indexer.upsert(fragments, embeddings);
|
|
18
|
+
}
|
|
19
|
+
toRawDocument(thread) {
|
|
20
|
+
const content = composeThreadText(thread);
|
|
21
|
+
return {
|
|
22
|
+
id: thread.id,
|
|
23
|
+
mimeType: "text/plain",
|
|
24
|
+
data: Buffer.from(content, "utf-8"),
|
|
25
|
+
metadata: {
|
|
26
|
+
subject: thread.subject ?? "",
|
|
27
|
+
participants: thread.participants.map((p) => p.email).join(", "),
|
|
28
|
+
updatedAt: thread.updatedAt.toISOString()
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
function composeThreadText(thread) {
|
|
34
|
+
const header = [`Subject: ${thread.subject ?? ""}`, `Snippet: ${thread.snippet ?? ""}`];
|
|
35
|
+
const messageTexts = thread.messages.map((message) => {
|
|
36
|
+
const parts = [`From: ${formatAddress(message.from)}`, `To: ${message.to.map(formatAddress).join(", ")}`];
|
|
37
|
+
if (message.sentAt) parts.push(`Date: ${message.sentAt.toISOString()}`);
|
|
38
|
+
const body = message.textBody ?? stripHtml(message.htmlBody ?? "");
|
|
39
|
+
return `${parts.join("\n")}\n\n${body ?? ""}`;
|
|
40
|
+
});
|
|
41
|
+
return [...header, ...messageTexts].join("\n\n---\n\n");
|
|
42
|
+
}
|
|
43
|
+
function formatAddress(address) {
|
|
44
|
+
return address.name ? `${address.name} <${address.email}>` : address.email;
|
|
45
|
+
}
|
|
46
|
+
function stripHtml(html) {
|
|
47
|
+
return html.replace(/<[^>]+>/g, " ");
|
|
48
|
+
}
|
|
3
49
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
`)}function n(e){return e.name?`${e.name} <${e.email}>`:e.email}function r(e){return e.replace(/<[^>]+>/g,` `)}export{e as GmailIngestionAdapter};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { GmailIngestionAdapter };
|