@wildo-ai/saas-backend-lib 1.1.2 → 1.1.3
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/dist/esm/applications/services/worker-remote-client-factory.backend.service.d.ts.map +1 -1
- package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js +19 -1
- package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js.map +1 -1
- package/dist/esm/base-classes/models/manual-controllers.backend.definition.d.ts.map +1 -1
- package/dist/esm/base-classes/models/manual-controllers.backend.definition.js +4 -0
- package/dist/esm/base-classes/models/manual-controllers.backend.definition.js.map +1 -1
- package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts +35 -0
- package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts.map +1 -0
- package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js +111 -0
- package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js.map +1 -0
- package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts +50 -0
- package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts.map +1 -0
- package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js +199 -0
- package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js.map +1 -0
- package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts +111 -0
- package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts.map +1 -1
- package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js +140 -0
- package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js.map +1 -1
- package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js +27 -6
- package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts +124 -13
- package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js +207 -21
- package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts +60 -8
- package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js +174 -26
- package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts +47 -4
- package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js +96 -29
- package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts +55 -0
- package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts.map +1 -0
- package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js +114 -0
- package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js.map +1 -0
- package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts +89 -14
- package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js +84 -11
- package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js +9 -1
- package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts +49 -0
- package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js +171 -18
- package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js +23 -3
- package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js +20 -0
- package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts +22 -0
- package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js +4 -1
- package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts +11 -0
- package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js +39 -5
- package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js.map +1 -1
- package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts +181 -2
- package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js +529 -41
- package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts +36 -3
- package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/system-access.backend.service.js +70 -8
- package/dist/esm/base-classes/services/services/system-access.backend.service.js.map +1 -1
- package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts +28 -0
- package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts.map +1 -0
- package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js +90 -0
- package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js.map +1 -0
- package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts +44 -0
- package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts.map +1 -0
- package/dist/esm/billing/batches/usage-flush.batch.backend.service.js +99 -0
- package/dist/esm/billing/batches/usage-flush.batch.backend.service.js.map +1 -0
- package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts +91 -0
- package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts.map +1 -0
- package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js +152 -0
- package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js.map +1 -0
- package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts +186 -0
- package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts.map +1 -0
- package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js +474 -0
- package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js.map +1 -0
- package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts +100 -0
- package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js +209 -6
- package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js.map +1 -1
- package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts +200 -4
- package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/back-office/usage-metering.backend.service.js +593 -64
- package/dist/esm/billing/services/back-office/usage-metering.backend.service.js.map +1 -1
- package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts +36 -0
- package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts.map +1 -0
- package/dist/esm/billing/services/billing-adapter-registry.backend.js +83 -0
- package/dist/esm/billing/services/billing-adapter-registry.backend.js.map +1 -0
- package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts +9 -0
- package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts.map +1 -1
- package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js +11 -1
- package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js +48 -7
- package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts +38 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js +67 -2
- package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts +30 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js +43 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js.map +1 -1
- package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts +11 -3
- package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js +30 -16
- package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js +104 -25
- package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts +18 -1
- package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js +106 -2
- package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js.map +1 -1
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts +52 -0
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts.map +1 -0
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js +74 -0
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js.map +1 -0
- package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts +104 -11
- package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js +260 -26
- package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js.map +1 -1
- package/dist/esm/billing/testing/mock-billing-provider.d.ts +30 -1
- package/dist/esm/billing/testing/mock-billing-provider.d.ts.map +1 -1
- package/dist/esm/billing/testing/mock-billing-provider.js +25 -0
- package/dist/esm/billing/testing/mock-billing-provider.js.map +1 -1
- package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js +11 -4
- package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts +225 -13
- package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js +340 -62
- package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts +244 -7
- package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js +386 -5
- package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js +7 -1
- package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts +6 -2
- package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js +31 -9
- package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts +42 -0
- package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js +57 -1
- package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts +110 -0
- package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts.map +1 -0
- package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js +192 -0
- package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js.map +1 -0
- package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js +31 -0
- package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js.map +1 -1
- package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts +5 -0
- package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts.map +1 -1
- package/dist/esm/config/bootstrap/application-runtime-profile.backend.js +6 -0
- package/dist/esm/config/bootstrap/application-runtime-profile.backend.js.map +1 -1
- package/dist/esm/config/models/app-config.backend.schemas.d.ts +142 -46
- package/dist/esm/config/models/app-config.backend.schemas.d.ts.map +1 -1
- package/dist/esm/config/models/app-config.backend.schemas.js +121 -12
- package/dist/esm/config/models/app-config.backend.schemas.js.map +1 -1
- package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts +38 -15
- package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts.map +1 -1
- package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js +17 -2
- package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js.map +1 -1
- package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts +0 -1
- package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts.map +1 -1
- package/dist/esm/config/services/app-configuration-loader.backend.service.js +68 -76
- package/dist/esm/config/services/app-configuration-loader.backend.service.js.map +1 -1
- package/dist/esm/config/services/app-configuration.backend.service.d.ts.map +1 -1
- package/dist/esm/config/services/app-configuration.backend.service.js +23 -1
- package/dist/esm/config/services/app-configuration.backend.service.js.map +1 -1
- package/dist/esm/config/services/app-configuration.backend.utils.d.ts +33 -0
- package/dist/esm/config/services/app-configuration.backend.utils.d.ts.map +1 -1
- package/dist/esm/config/services/app-configuration.backend.utils.js +39 -1
- package/dist/esm/config/services/app-configuration.backend.utils.js.map +1 -1
- package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts +25 -0
- package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts.map +1 -1
- package/dist/esm/config/services/application-startup-config-validator.backend.service.js +41 -1
- package/dist/esm/config/services/application-startup-config-validator.backend.service.js.map +1 -1
- package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.d.ts.map +1 -1
- package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js +48 -0
- package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js.map +1 -1
- package/dist/esm/errors/services/error-builder.backend.service.d.ts +13 -1
- package/dist/esm/errors/services/error-builder.backend.service.d.ts.map +1 -1
- package/dist/esm/errors/services/error-builder.backend.service.js +13 -1
- package/dist/esm/errors/services/error-builder.backend.service.js.map +1 -1
- package/dist/esm/errors/services/error-handler.backend.service.d.ts +70 -7
- package/dist/esm/errors/services/error-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/errors/services/error-handler.backend.service.js +129 -8
- package/dist/esm/errors/services/error-handler.backend.service.js.map +1 -1
- package/dist/esm/errors/services/rate-limit.backend.service.d.ts +66 -0
- package/dist/esm/errors/services/rate-limit.backend.service.d.ts.map +1 -1
- package/dist/esm/errors/services/rate-limit.backend.service.js +102 -25
- package/dist/esm/errors/services/rate-limit.backend.service.js.map +1 -1
- package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts +5 -0
- package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts.map +1 -1
- package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js +25 -0
- package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js.map +1 -1
- package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts +33 -0
- package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts.map +1 -1
- package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js +40 -0
- package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js.map +1 -1
- package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts +59 -2
- package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts.map +1 -1
- package/dist/esm/external-data/external-data-pipeline-run.backend.service.js +52 -17
- package/dist/esm/external-data/external-data-pipeline-run.backend.service.js.map +1 -1
- package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts +4 -2
- package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts.map +1 -1
- package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.js.map +1 -1
- package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts +256 -0
- package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts.map +1 -0
- package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js +333 -0
- package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js.map +1 -0
- package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts +56 -0
- package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts.map +1 -0
- package/dist/esm/external-providers/operations/provider-operation-request.backend.js +211 -0
- package/dist/esm/external-providers/operations/provider-operation-request.backend.js.map +1 -0
- package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts +45 -0
- package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts.map +1 -0
- package/dist/esm/external-providers/operations/provider-request-signing.backend.js +216 -0
- package/dist/esm/external-providers/operations/provider-request-signing.backend.js.map +1 -0
- package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts +56 -0
- package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts.map +1 -0
- package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js +78 -0
- package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js.map +1 -0
- package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts +1 -1
- package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js +2 -2
- package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js.map +1 -1
- package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts +89 -0
- package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts.map +1 -0
- package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js +164 -0
- package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js.map +1 -0
- package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts +26 -27
- package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js +50 -64
- package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js.map +1 -1
- package/dist/esm/external-providers/services/document-extraction.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/document-extraction.backend.service.js +3 -3
- package/dist/esm/external-providers/services/document-extraction.backend.service.js.map +1 -1
- package/dist/esm/external-providers/services/embeddings.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/embeddings.backend.service.js +4 -4
- package/dist/esm/external-providers/services/embeddings.backend.service.js.map +1 -1
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +292 -7
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +533 -45
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
- package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js +25 -2
- package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js.map +1 -1
- package/dist/esm/files/controllers/file.controller.d.ts.map +1 -1
- package/dist/esm/files/controllers/file.controller.js +21 -13
- package/dist/esm/files/controllers/file.controller.js.map +1 -1
- package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js +39 -15
- package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js.map +1 -1
- package/dist/esm/files/services/file-scanning.backend.service.d.ts +94 -9
- package/dist/esm/files/services/file-scanning.backend.service.d.ts.map +1 -1
- package/dist/esm/files/services/file-scanning.backend.service.js +197 -17
- package/dist/esm/files/services/file-scanning.backend.service.js.map +1 -1
- package/dist/esm/files/services/file-text-extraction.backend.service.d.ts +60 -1
- package/dist/esm/files/services/file-text-extraction.backend.service.d.ts.map +1 -1
- package/dist/esm/files/services/file-text-extraction.backend.service.js +167 -8
- package/dist/esm/files/services/file-text-extraction.backend.service.js.map +1 -1
- package/dist/esm/files/services/file-upload-grant.backend.service.d.ts +53 -2
- package/dist/esm/files/services/file-upload-grant.backend.service.d.ts.map +1 -1
- package/dist/esm/files/services/file-upload-grant.backend.service.js +127 -3
- package/dist/esm/files/services/file-upload-grant.backend.service.js.map +1 -1
- package/dist/esm/files/services/files.backend.service.d.ts +68 -0
- package/dist/esm/files/services/files.backend.service.d.ts.map +1 -1
- package/dist/esm/files/services/files.backend.service.js +175 -5
- package/dist/esm/files/services/files.backend.service.js.map +1 -1
- package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts +109 -0
- package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts.map +1 -0
- package/dist/esm/files/storage/application-storage-key.backend.utils.js +123 -0
- package/dist/esm/files/storage/application-storage-key.backend.utils.js.map +1 -0
- package/dist/esm/files/storage/file-storage-provider.types.d.ts +16 -10
- package/dist/esm/files/storage/file-storage-provider.types.d.ts.map +1 -1
- package/dist/esm/files/storage/file-storage-provider.types.js.map +1 -1
- package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts +67 -8
- package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts.map +1 -1
- package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js +101 -28
- package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js.map +1 -1
- package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.d.ts.map +1 -1
- package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js +8 -55
- package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js.map +1 -1
- package/dist/esm/files/utils/file-field-schema-path.backend.utils.d.ts.map +1 -1
- package/dist/esm/files/utils/file-field-schema-path.backend.utils.js +20 -0
- package/dist/esm/files/utils/file-field-schema-path.backend.utils.js.map +1 -1
- package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts +86 -0
- package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts.map +1 -0
- package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js +288 -0
- package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js.map +1 -0
- package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts +15 -0
- package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js +76 -5
- package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/a2a/controllers/a2a.controller.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js +6 -1
- package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js.map +1 -1
- package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts +60 -0
- package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js +63 -0
- package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts +74 -0
- package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js +196 -40
- package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts +7 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js +53 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts +18 -0
- package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js +18 -0
- package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts +12 -7
- package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts +0 -13
- package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts.map +1 -1
- package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js +14 -22
- package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js.map +1 -1
- package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts +8 -3
- package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts.map +1 -1
- package/dist/esm/flows-actors/models/core-facets.backend.definitions.js +25 -15
- package/dist/esm/flows-actors/models/core-facets.backend.definitions.js.map +1 -1
- package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts +13 -1
- package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/models/flows-actors.backend.schemas.js.map +1 -1
- package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts +88 -8
- package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts.map +1 -1
- package/dist/esm/flows-actors/models/function-tools.backend.definitions.js +333 -31
- package/dist/esm/flows-actors/models/function-tools.backend.definitions.js.map +1 -1
- package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.d.ts.map +1 -1
- package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js +4 -2
- package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js.map +1 -1
- package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts +113 -0
- package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts.map +1 -0
- package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js +62 -0
- package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js.map +1 -0
- package/dist/esm/flows-actors/services/actors-system.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/actors-system.backend.service.js +0 -2
- package/dist/esm/flows-actors/services/actors-system.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/services/agents.backend.service.d.ts +28 -1
- package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/agents.backend.service.js +204 -18
- package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts +5 -1
- package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/conversational-execution.backend.service.js +79 -16
- package/dist/esm/flows-actors/services/conversational-execution.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts +34 -5
- package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/flows-actors-registry.service.js +154 -20
- package/dist/esm/flows-actors/services/flows-actors-registry.service.js.map +1 -1
- package/dist/esm/flows-actors/services/flows.backend.services.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/flows.backend.services.js +27 -23
- package/dist/esm/flows-actors/services/flows.backend.services.js.map +1 -1
- package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js +7 -1
- package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js.map +1 -1
- package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts +90 -0
- package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts.map +1 -0
- package/dist/esm/flows-actors/services/mcp-client.backend.service.js +368 -0
- package/dist/esm/flows-actors/services/mcp-client.backend.service.js.map +1 -0
- package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts +9 -5
- package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js +12 -17
- package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +8 -4
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
- package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts +0 -207
- package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts.map +1 -1
- package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js +8 -243
- package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js.map +1 -1
- package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.d.ts.map +1 -1
- package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.js.map +1 -1
- package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts +9 -14
- package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts.map +1 -1
- package/dist/esm/guidance/services/milestone-evaluator.backend.service.js +18 -89
- package/dist/esm/guidance/services/milestone-evaluator.backend.service.js.map +1 -1
- package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts +86 -0
- package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts.map +1 -0
- package/dist/esm/guidance/services/progression-state-store.backend.service.js +155 -0
- package/dist/esm/guidance/services/progression-state-store.backend.service.js.map +1 -0
- package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts +10 -0
- package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts.map +1 -1
- package/dist/esm/i18n/controllers/i18n-controller.backend.service.js +55 -5
- package/dist/esm/i18n/controllers/i18n-controller.backend.service.js.map +1 -1
- package/dist/esm/index.d.ts +11 -4
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +31 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/inject/models/container.d.ts.map +1 -1
- package/dist/esm/inject/models/container.js +78 -10
- package/dist/esm/inject/models/container.js.map +1 -1
- package/dist/esm/inject/models/service-types.d.ts +17 -3
- package/dist/esm/inject/models/service-types.d.ts.map +1 -1
- package/dist/esm/inject/models/service-types.js +19 -3
- package/dist/esm/inject/models/service-types.js.map +1 -1
- package/dist/esm/mcp/controllers/mcp.controller.d.ts.map +1 -1
- package/dist/esm/mcp/controllers/mcp.controller.js +20 -0
- package/dist/esm/mcp/controllers/mcp.controller.js.map +1 -1
- package/dist/esm/mcp/services/mcp-server.backend.service.d.ts +56 -1
- package/dist/esm/mcp/services/mcp-server.backend.service.d.ts.map +1 -1
- package/dist/esm/mcp/services/mcp-server.backend.service.js +107 -11
- package/dist/esm/mcp/services/mcp-server.backend.service.js.map +1 -1
- package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts.map +1 -1
- package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js +22 -0
- package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js.map +1 -1
- package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.d.ts.map +1 -1
- package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js +49 -4
- package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js.map +1 -1
- package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts +66 -0
- package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts.map +1 -0
- package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js +199 -0
- package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js.map +1 -0
- package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts +149 -13
- package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts.map +1 -1
- package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js +411 -19
- package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js.map +1 -1
- package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts +11 -2
- package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.js.map +1 -1
- package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts +28 -9
- package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts.map +1 -1
- package/dist/esm/monitoring/logger/models/logger.backend.schemas.js +30 -10
- package/dist/esm/monitoring/logger/models/logger.backend.schemas.js.map +1 -1
- package/dist/esm/monitoring/logger/services/logger.service.d.ts +12 -0
- package/dist/esm/monitoring/logger/services/logger.service.d.ts.map +1 -1
- package/dist/esm/monitoring/logger/services/logger.service.js +52 -11
- package/dist/esm/monitoring/logger/services/logger.service.js.map +1 -1
- package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts +62 -0
- package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts.map +1 -0
- package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js +78 -0
- package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js.map +1 -0
- package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts +309 -0
- package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts.map +1 -0
- package/dist/esm/monitoring/observability/audit-observation-emission.backend.js +385 -0
- package/dist/esm/monitoring/observability/audit-observation-emission.backend.js.map +1 -0
- package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts +1 -0
- package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts.map +1 -1
- package/dist/esm/monitoring/observability/models/observability.backend.schemas.js.map +1 -1
- package/dist/esm/monitoring/observability/services/metrics.service.d.ts +21 -0
- package/dist/esm/monitoring/observability/services/metrics.service.d.ts.map +1 -1
- package/dist/esm/monitoring/observability/services/metrics.service.js +38 -0
- package/dist/esm/monitoring/observability/services/metrics.service.js.map +1 -1
- package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts +0 -80
- package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts.map +0 -1
- package/dist/esm/notifications/email/models/email-context-provider.interface.js +0 -25
- package/dist/esm/notifications/email/models/email-context-provider.interface.js.map +0 -1
- package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts +0 -49
- package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts.map +0 -1
- package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js +0 -141
- package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js.map +0 -1
- package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts +0 -37
- package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts.map +0 -1
- package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js +0 -121
- package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js.map +0 -1
- package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts +66 -1
- package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/email/services/email-template-registry.backend.service.js +105 -10
- package/dist/esm/notifications/email/services/email-template-registry.backend.service.js.map +1 -1
- package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts +0 -58
- package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts.map +0 -1
- package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js +0 -223
- package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js.map +0 -1
- package/dist/esm/notifications/email/services/email-template-validator.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/email/services/email-template-validator.backend.service.js +10 -1
- package/dist/esm/notifications/email/services/email-template-validator.backend.service.js.map +1 -1
- package/dist/esm/notifications/email/services/email.backend.service.d.ts +60 -4
- package/dist/esm/notifications/email/services/email.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/email/services/email.backend.service.js +145 -43
- package/dist/esm/notifications/email/services/email.backend.service.js.map +1 -1
- package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts +0 -1
- package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts.map +1 -1
- package/dist/esm/notifications/email/utils/color-conversion.utils.js.map +1 -1
- package/dist/esm/notifications/services/notification-badge.backend.service.d.ts +142 -21
- package/dist/esm/notifications/services/notification-badge.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/services/notification-badge.backend.service.js +283 -58
- package/dist/esm/notifications/services/notification-badge.backend.service.js.map +1 -1
- package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts +99 -13
- package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js +422 -66
- package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js.map +1 -1
- package/dist/esm/notifications/sms/services/sms.backend.service.d.ts +2 -2
- package/dist/esm/notifications/sms/services/sms.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/sms/services/sms.backend.service.js +5 -5
- package/dist/esm/notifications/sms/services/sms.backend.service.js.map +1 -1
- package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts +117 -5
- package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js +164 -6
- package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts +0 -6
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js +46 -1
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js +16 -6
- package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js +12 -12
- package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts +16 -0
- package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js +18 -0
- package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js.map +1 -1
- package/dist/esm/organizations/batches/organization-purge.batch.backend.service.d.ts +2 -2
- package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js +2 -2
- package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js.map +1 -1
- package/dist/esm/organizations/services/organization-custom-implementation.backend.service.d.ts.map +1 -1
- package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js +63 -2
- package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js.map +1 -1
- package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts +66 -0
- package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts.map +1 -0
- package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js +257 -0
- package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js.map +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts +12 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts.map +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.binding.js +47 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.binding.js.map +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts +87 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts.map +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.interface.js +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.interface.js.map +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts +31 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts.map +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.options.js +13 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.options.js.map +1 -0
- package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts +19 -25
- package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js +33 -0
- package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js.map +1 -1
- package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts +2 -2
- package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/domain-queue-consumer.backend.service.js +1 -4
- package/dist/esm/queue/domain-queue-consumer.backend.service.js.map +1 -1
- package/dist/esm/queue/job-consumer.backend.service.d.ts +2 -2
- package/dist/esm/queue/job-consumer.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/job-consumer.backend.service.js +1 -4
- package/dist/esm/queue/job-consumer.backend.service.js.map +1 -1
- package/dist/esm/queue/job-executor.backend.service.d.ts +2 -2
- package/dist/esm/queue/job-executor.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/job-executor.backend.service.js +1 -4
- package/dist/esm/queue/job-executor.backend.service.js.map +1 -1
- package/dist/esm/queue/queue-monitoring.backend.service.d.ts +8 -4
- package/dist/esm/queue/queue-monitoring.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/queue-monitoring.backend.service.js +25 -17
- package/dist/esm/queue/queue-monitoring.backend.service.js.map +1 -1
- package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts +16 -1
- package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/queue-worker-initializer.backend.service.js +16 -1
- package/dist/esm/queue/queue-worker-initializer.backend.service.js.map +1 -1
- package/dist/esm/queue/queue.backend.service.d.ts +3 -3
- package/dist/esm/queue/queue.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/queue.backend.service.js +26 -4
- package/dist/esm/queue/queue.backend.service.js.map +1 -1
- package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts +2 -2
- package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/worker-shutdown-manager.backend.service.js +18 -3
- package/dist/esm/queue/worker-shutdown-manager.backend.service.js.map +1 -1
- package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts +50 -25
- package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts.map +1 -1
- package/dist/esm/rag/utils/rag-chunking.backend.utils.js +147 -39
- package/dist/esm/rag/utils/rag-chunking.backend.utils.js.map +1 -1
- package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts +12 -3
- package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts.map +1 -1
- package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js +12 -3
- package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js.map +1 -1
- package/dist/esm/requests/service/websocket.service.d.ts +9 -0
- package/dist/esm/requests/service/websocket.service.d.ts.map +1 -1
- package/dist/esm/requests/service/websocket.service.js +32 -8
- package/dist/esm/requests/service/websocket.service.js.map +1 -1
- package/dist/esm/resources/models/custom-service-implementations.backend.definition.d.ts.map +1 -1
- package/dist/esm/resources/models/custom-service-implementations.backend.definition.js +14 -2
- package/dist/esm/resources/models/custom-service-implementations.backend.definition.js.map +1 -1
- package/dist/esm/resources/models/resources-operations.backend.definitions.d.ts.map +1 -1
- package/dist/esm/resources/models/resources-operations.backend.definitions.js +2 -0
- package/dist/esm/resources/models/resources-operations.backend.definitions.js.map +1 -1
- package/dist/esm/resources/models/resources-relationships.backend.definitions.d.ts.map +1 -1
- package/dist/esm/resources/models/resources-relationships.backend.definitions.js +14 -0
- package/dist/esm/resources/models/resources-relationships.backend.definitions.js.map +1 -1
- package/dist/esm/resources/models/resources-types.backend.schemas.d.ts +2 -1
- package/dist/esm/resources/models/resources-types.backend.schemas.d.ts.map +1 -1
- package/dist/esm/resources/models/resources-types.backend.schemas.js +8 -0
- package/dist/esm/resources/models/resources-types.backend.schemas.js.map +1 -1
- package/dist/esm/resources/services/resources-registry.backend.service.d.ts +60 -5
- package/dist/esm/resources/services/resources-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/resources/services/resources-registry.backend.service.js +90 -6
- package/dist/esm/resources/services/resources-registry.backend.service.js.map +1 -1
- package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts +36 -3
- package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts.map +1 -1
- package/dist/esm/runtime/controllers/health-controller.backend.service.js +32 -10
- package/dist/esm/runtime/controllers/health-controller.backend.service.js.map +1 -1
- package/dist/esm/runtime/domain-module.backend.definitions.d.ts +24 -0
- package/dist/esm/runtime/domain-module.backend.definitions.d.ts.map +1 -1
- package/dist/esm/runtime/domain-module.backend.definitions.js +24 -0
- package/dist/esm/runtime/domain-module.backend.definitions.js.map +1 -1
- package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts +51 -0
- package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts.map +1 -1
- package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.js.map +1 -1
- package/dist/esm/runtime/services/http-server.backend.service.d.ts +26 -0
- package/dist/esm/runtime/services/http-server.backend.service.d.ts.map +1 -1
- package/dist/esm/runtime/services/http-server.backend.service.js +181 -1
- package/dist/esm/runtime/services/http-server.backend.service.js.map +1 -1
- package/dist/esm/runtime/services/start-application.backend.service.d.ts +19 -1
- package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
- package/dist/esm/runtime/services/start-application.backend.service.js +261 -77
- package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
- package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts +15 -0
- package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js +28 -0
- package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts +5 -1
- package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js +24 -4
- package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js +29 -4
- package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts +114 -0
- package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js +354 -3
- package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts +1 -0
- package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/models/cimd.backend.schemas.js +22 -0
- package/dist/esm/security/authentications/models/cimd.backend.schemas.js.map +1 -1
- package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts +15 -0
- package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.js.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts +0 -2
- package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js +23 -14
- package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts +0 -1
- package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js +15 -12
- package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts +113 -3
- package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js +207 -30
- package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts +95 -2
- package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js +153 -9
- package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts +190 -0
- package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/anonymous-session.backend.service.js +377 -53
- package/dist/esm/security/authentications/services/anonymous-session.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js +68 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts +41 -0
- package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js +202 -23
- package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js +42 -1
- package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js +34 -4
- package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts +29 -5
- package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js +77 -5
- package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts +17 -1
- package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js +49 -17
- package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts +43 -1
- package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js +277 -97
- package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts +28 -5
- package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js +72 -12
- package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js +3 -0
- package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js.map +1 -1
- package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts +28 -0
- package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts.map +1 -0
- package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js +283 -0
- package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js.map +1 -0
- package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts +4 -3
- package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js +4 -3
- package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts +35 -0
- package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js +111 -21
- package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts +14 -1
- package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js +49 -8
- package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js +4 -0
- package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js.map +1 -1
- package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js +6 -0
- package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts +37 -1
- package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js +51 -0
- package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js.map +1 -1
- package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts +41 -0
- package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js +45 -0
- package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js.map +1 -1
- package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts +116 -0
- package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts.map +1 -0
- package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js +162 -0
- package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js.map +1 -0
- package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts +20 -20
- package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js +27 -28
- package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js.map +1 -1
- package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js +77 -3
- package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js.map +1 -1
- package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts +4 -0
- package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authorizations/role-ceiling.backend.utils.js +4 -0
- package/dist/esm/security/authorizations/role-ceiling.backend.utils.js.map +1 -1
- package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts +93 -0
- package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts.map +1 -0
- package/dist/esm/security/authorizations/role-conferral.backend.utils.js +95 -0
- package/dist/esm/security/authorizations/role-conferral.backend.utils.js.map +1 -0
- package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts +124 -1
- package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts.map +1 -1
- package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js +142 -5
- package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js.map +1 -1
- package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts +74 -8
- package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authorizations/services/authorizations.backend.service.js +175 -19
- package/dist/esm/security/authorizations/services/authorizations.backend.service.js.map +1 -1
- package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts +6 -14
- package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js +13 -22
- package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js.map +1 -1
- package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts +60 -0
- package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js +79 -0
- package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js.map +1 -0
- package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts +161 -0
- package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js +512 -0
- package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts +59 -0
- package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js +22 -0
- package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js.map +1 -0
- package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts +44 -0
- package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js +20 -0
- package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts +191 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js +385 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts +41 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js +358 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts +160 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js +266 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts +111 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js +107 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts +54 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js +153 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts +195 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js +387 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts +45 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js +291 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts +62 -0
- package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js +29 -0
- package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js.map +1 -0
- package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts +127 -0
- package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js +277 -0
- package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js.map +1 -0
- package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts +66 -0
- package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js +75 -0
- package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js.map +1 -0
- package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts +21 -3
- package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts.map +1 -1
- package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js +26 -16
- package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js.map +1 -1
- package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts +9 -4
- package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/credential-rotation-grace.backend.utils.js +9 -4
- package/dist/esm/security/credential-rotation-grace.backend.utils.js.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts +26 -0
- package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js +43 -0
- package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts +8 -1
- package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js +49 -0
- package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/security/scim/controllers/scim.backend.controller.d.ts.map +1 -1
- package/dist/esm/security/scim/controllers/scim.backend.controller.js +17 -5
- package/dist/esm/security/scim/controllers/scim.backend.controller.js.map +1 -1
- package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts +67 -29
- package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts.map +1 -1
- package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js +47 -25
- package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js.map +1 -1
- package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts +10 -2
- package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js +10 -2
- package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js.map +1 -1
- package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts +143 -0
- package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts.map +1 -0
- package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js +258 -0
- package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js.map +1 -0
- package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts +39 -0
- package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts.map +1 -0
- package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js +159 -0
- package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +11 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
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oCY,2BAA2B;IADvC,UAAU,EAAE;IAGR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAC9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAC9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,qCAAqC,CAAC,CAAA;IAChE,WAAA,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAA;IACpC,WAAA,MAAM,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAA;IACzC,WAAA,MAAM,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAA;IAClD,WAAA,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;IAC3C,WAAA,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;IAC3C,WAAA,MAAM,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAA;IACvC,YAAA,MAAM,CAAC,kBAAkB,CAAC,+BAA+B,CAAC,CAAA;qCAVhB,aAAa;QACM,0BAA0B;QAC1B,mBAAmB;QAC2B,qCAAqC;QAC/E,uBAAuB;QAChB,4BAA4B;QACb,+BAA+B;QACvC,uBAAuB;QAC9B,uBAAuB;QACxB,YAAY;QACkB,6CAA6C;GAZ1I,2BAA2B,CA6oCvC","sourcesContent":["import 'reflect-metadata';\nimport { inject, injectable } from 'inversify';\nimport type { Request, Response } from 'express';\nimport cors from 'cors';\nimport {\n ErrorType,\n MachineAccessOperation,\n MANUAL_CONTROLLER_ROUTES_URLS,\n ManualControllerRouteKey,\n ResourceServerKind,\n ResourceType,\n WildoError_Backend,\n} from '@wildo-ai/saas-models';\nimport { AbstractControllerBackendService } from '~wildo-backend-lib/base-classes/services/controllers/abstract-controller.backend.service';\nimport { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport { ErrorHandlerService } from '~wildo-backend-lib/errors/services/error-handler.backend.service';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport { AuditLogsBackendService } from '~wildo-backend-lib/compliance/audit-trails/services/audit-logs.backend.service';\nimport { getClientIpFromRequest } from '~wildo-backend-lib/runtime/utils/request-client-ip.utils';\nimport { RedisService } from '~wildo-backend-lib/databases/services/redis.service';\nimport { recordExternalTokenAuthFailure } from '~wildo-backend-lib/security/authentications/services/utils/machine-auth-rate-limit.backend.utils';\nimport {\n MCP_EXTERNAL_CALL_RATE_MAX,\n MCP_EXTERNAL_CALL_RATE_WINDOW_SECONDS,\n assertExternalTurnWithinRate,\n resolvePrincipalRateKey,\n} from '~wildo-backend-lib/security/authentications/services/utils/external-turn-rate-limit.backend.utils';\nimport { ExecutionContextCreatorBackendService } from '~wildo-backend-lib/runtime/services/execution-context-creator.backend.service';\nimport { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport { AppConfigurationService } from '~wildo-backend-lib/config/services/app-configuration.backend.service';\nimport { McpServerBackendService } from '~wildo-backend-lib/mcp/services/mcp-server.backend.service';\nimport {\n McpToolAdapterBackendService,\n mcpReachableScopesForPrincipal,\n mcpPrincipalForAuthenticatedCaller,\n McpCallerPrincipal,\n} from '~wildo-backend-lib/mcp/services/mcp-tool-adapter.backend.service';\nimport { ResourceServerInstancesRegistryBackendService } from '~wildo-backend-lib/mcp/services/resource-server-instances-registry.backend.service';\nimport { MCP_TOOL_NAME_SEPARATOR,\n MCP_UPLOAD_GRANT_TOOL_MARKER,\n} from '~wildo-backend-lib/mcp/models/mcp-tool.backend.schemas';\nimport { OIDC_SUPPORTED_IDENTITY_SCOPES } from '~wildo-backend-lib/security/authentications/services/oidc-user-claims.backend.service';\nimport { isMcpValueWrappedRequestDto, unwrapMcpValueEnvelope } from '~wildo-backend-lib/mcp/utils/zod-to-mcp-json-schema.backend.utils';\nimport {\n MCP_PROTOCOL_VERSION,\n MCP_SUPPORTED_PROTOCOL_VERSIONS,\n MCP_TOOLS_LIST_CACHE_TTL_MS,\n MCP_DISCOVER_CACHE_TTL_MS,\n Mcp_CacheScope,\n isStatelessMcpProtocolVersion,\n decodeMcpHeaderValue,\n MCP_METHODS_REQUIRING_NAME_HEADER,\n MCP_STATELESS_PROTOCOL_VERSION,\n MCP_ASSUMED_PROTOCOL_VERSION_WHEN_HEADER_ABSENT,\n MCP_META_PROTOCOL_VERSION_KEY,\n Mcp_JsonRpcErrorCode,\n Mcp_JsonRpcRequestSchema,\n Mcp_ToolsCallParamsSchema,\n MCP_SERVER_INSTRUCTIONS,\n MCP_TOOL_EXECUTION_ERROR_TYPES,\n} from '~wildo-backend-lib/mcp/models/mcp-protocol.backend.schemas';\nimport type { SocketAuthResult } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\n\n/** A JSON-RPC id is `string | number | null` (absent → treated as null in a response). */\ntype JsonRpcId = string | number | null;\n\n/**\n * Inbound Model Context Protocol (MCP) transport controller — a THIN JSON-RPC 2.0\n * wrapper over {@link McpServerBackendService}, mirroring {@link A2AControllerBackendService}.\n * Exposes a curated set of resource operations as MCP tools to external AI agents:\n *\n * - `GET /.well-known/oauth-protected-resource` — RFC 9728 Protected Resource\n * Metadata (public, CORS-open): advertises this server's `resource` identifier +\n * the `authorization_servers` (the app's own OIDC provider) a client uses to obtain\n * a token.\n * - `POST /mcp` — JSON-RPC 2.0. `initialize` is public; `tools/list` is PROGRESSIVELY principal-aware\n * (a valid Bearer → the caller's catalog, a user-delegated token additionally surfacing USER_SELF\n * tools; an ANONYMOUS caller reaches nothing and is CHALLENGED, which is the 401 every client needs\n * in order to begin authorization); `tools/call` is Bearer-credentialed, RFC 8707\n * audience-bound (validated in\n * {@link ExecutionContextCreatorBackendService.authenticateExternalToken}), and the\n * server re-runs `authorizeInController` BEFORE dispatch (fail-closed, roles-only).\n * - `POST /mcp/:instanceRef` + `GET /mcp/:instanceRef/.well-known/oauth-protected-resource` — the R-2\n * NAMED server instances. Each declared instance is a SEPARATE resource server: its own URL, its own\n * RFC 8707 audience (`…/mcp/<ref>`), its own metadata, and its own curated catalog (membership is\n * EXCLUSIVE — a curated operation LEAVES the default catalog). An unknown ref 404s before\n * parsing/auth and never falls back to the default catalog.\n * - Response mode (Streamable HTTP): a POST result is `application/json` by default, or an SSE stream\n * (`text/event-stream`, a single message event) when the client's `Accept` negotiates it. **JSON wins a\n * tie** — the spec makes clients advertise BOTH, so only an explicit RFC 9110 `q`-value preference for\n * SSE selects it (see {@link MCPControllerBackendService.acceptsEventStream}). `GET /mcp`\n * → 405 (no server-initiated stream — no notifications/sampling yet). Transport-level errors\n * (401 / 429 / 503) are always plain HTTP, never SSE.\n *\n * Auth model (D6): a client-credentials / api-key MACHINE principal. Its token is\n * audience-bound to THE ADDRESSED SURFACE's own resource identifier (`mcpResourceUri(instanceRef)` →\n * `${apiAudience}/mcp` or `${apiAudience}/mcp/<ref>`, advertised in that surface's RFC 9728 metadata) —\n * the generic API audience is NOT accepted here (2026-07-29 flip), so an API token and an MCP token\n * never cross, and a token minted for one instance is rejected at another.\n * A user-delegated caller (an `authorization_code` token bound to this endpoint) additionally reaches\n * their USER_SELF tools — see the progressive principal-aware `tools/list` + the `callTool` gate.\n *\n * Curation is NOT authorization. `mcp.exposed` / `mcp.servers` decide which operations are shaped as\n * tools and which surface advertises them; every `tools/call` still re-runs the operation's own role\n * authorization, so exposure can only ever be a SUBSET of what the caller's roles already permit.\n *\n * NOTE: `setupRoutes()` runs inside the `super()` constructor before this subclass's\n * field initializers, so it only BINDS handlers — the injected services are read at\n * REQUEST time. Standard manual-controller pattern.\n */\n@injectable()\nexport class MCPControllerBackendService extends AbstractControllerBackendService {\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService) errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.ErrorHandlerService) errorHandler: ErrorHandlerService,\n @inject(SAAS_SERVICE_TYPES.ExecutionContextCreatorBackendService) private readonly executionContextCreator: ExecutionContextCreatorBackendService,\n @inject(SAAS_SERVICE_TYPES.McpServer) private readonly mcpServer: McpServerBackendService,\n @inject(SAAS_SERVICE_TYPES.McpToolAdapter) private readonly toolAdapter: McpToolAdapterBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService) private readonly resourcesRegistry: ResourcesRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.AppConfigService) private readonly appConfigService: AppConfigurationService,\n @inject(SAAS_SERVICE_TYPES.AuditLogsService) private readonly auditLogs: AuditLogsBackendService,\n @inject(SAAS_SERVICE_TYPES.RedisService) private readonly redisService: RedisService,\n @inject(SAAS_SERVICE_TYPES.ResourceServerInstancesRegistry) private readonly resourceServerInstances: ResourceServerInstancesRegistryBackendService,\n ) {\n super(logger, errorBuilder, errorHandler, 'MCPController');\n }\n\n protected setupRoutes(): void {\n // RFC 9728 metadata is PUBLIC, non-credentialed discovery an MCP client fetches\n // cross-origin to learn where to get a token — CORS-open GET, like the OIDC\n // discovery doc. The JSON-RPC endpoint stays under the restrictive global CORS.\n const publicMetadataCors = cors({ origin: '*', methods: ['GET'], credentials: false });\n\n const metadataUrl = MANUAL_CONTROLLER_ROUTES_URLS[ManualControllerRouteKey.MCP_PROTECTED_RESOURCE_METADATA];\n this.router.get(metadataUrl, publicMetadataCors, this.asyncHandler(this.handleProtectedResourceMetadata.bind(this)));\n this.logRouteRegistration('GET', metadataUrl, 'MCP protected-resource metadata (RFC 9728, public)');\n\n const mcpUrl = MANUAL_CONTROLLER_ROUTES_URLS[ManualControllerRouteKey.MCP_ENDPOINT];\n this.router.post(mcpUrl, this.asyncHandler(this.handleJsonRpc.bind(this)));\n this.logRouteRegistration('POST', mcpUrl, 'MCP JSON-RPC endpoint (initialize, tools/list, tools/call; SSE or JSON per Accept)');\n\n // GET /mcp — the Streamable-HTTP server-initiated SSE stream. This server has no server-initiated\n // messages (no notifications / sampling), so respond 405 + `Allow: POST` — the spec-sanctioned\n // answer when a server offers no GET stream. Explicit 405 (not an unhandled 404) so clients probe\n // cleanly and fall back to the POST response-mode SSE.\n this.router.get(mcpUrl, (_req: Request, res: Response) => {\n res.set('Allow', 'POST').status(405).json({\n jsonrpc: '2.0', id: null,\n error: { code: Mcp_JsonRpcErrorCode.METHOD_NOT_FOUND, message: 'the MCP endpoint offers no server-initiated SSE stream; use POST' },\n });\n });\n this.logRouteRegistration('GET', mcpUrl, 'MCP endpoint GET → 405 (no server-initiated SSE stream)');\n\n // DELETE /mcp — the session-termination verb of the `2025-03-26`…`2025-11-25` transport, which\n // `2026-07-28` removed along with protocol-level sessions. We never implemented sessions, so\n // there is nothing to terminate; the spec names the answer for a server in exactly this position:\n //\n // \"HTTP GET or DELETE to the MCP endpoint: respond with `405 Method Not Allowed`.\"\n // spec-cite: MCP 2026-07-28 — Streamable HTTP § Earlier Streamable HTTP Revisions\n //\n // Registered EXPLICITLY rather than left to a framework 404, for the same reason as the GET: an\n // older client that sent DELETE would read a bare 404 as \"this server has no MCP endpoint\" and\n // fall back to the deprecated HTTP+SSE transport, against a server that speaks Streamable HTTP.\n this.router.delete(mcpUrl, (_req: Request, res: Response) => {\n res.set('Allow', 'POST').status(405).json({\n jsonrpc: '2.0', id: null,\n error: { code: Mcp_JsonRpcErrorCode.METHOD_NOT_FOUND, message: 'the MCP endpoint has no sessions to terminate; use POST' },\n });\n });\n this.logRouteRegistration('DELETE', mcpUrl, 'MCP endpoint DELETE → 405 (no protocol-level sessions)');\n\n // ── R-2: NAMED MCP server instances (`/mcp/:instanceRef`) ────────────────────\n // Each declared instance is a SEPARATE resource server: its own URL, its own RFC 8707 audience\n // (`…/mcp/<ref>`), its own PRM, and its own curated tool catalog. Routes are registered\n // unconditionally (not gated on `hasInstances`) because the registry is populated during startup\n // AFTER `setupRoutes` runs inside `super()` — an unknown ref is rejected at REQUEST time by\n // `resolveInstanceRef` (404), which is the same fail-closed answer with no ordering hazard.\n // More-specific paths first: the metadata route has more segments than `/mcp/:instanceRef`, so\n // Express matches it exactly and it can never be swallowed by the instance route.\n const instanceMetadataUrl = `${mcpUrl}/:instanceRef${MANUAL_CONTROLLER_ROUTES_URLS[ManualControllerRouteKey.MCP_PROTECTED_RESOURCE_METADATA]}`;\n this.router.get(instanceMetadataUrl, publicMetadataCors, this.asyncHandler(this.handleProtectedResourceMetadata.bind(this)));\n this.logRouteRegistration('GET', instanceMetadataUrl, 'Per-instance MCP protected-resource metadata (RFC 9728, public)');\n\n const instanceUrl = `${mcpUrl}/:instanceRef`;\n this.router.post(instanceUrl, this.asyncHandler(this.handleJsonRpc.bind(this)));\n this.logRouteRegistration('POST', instanceUrl, 'Named MCP server instance (JSON-RPC; own audience + curated catalog)');\n\n this.router.get(instanceUrl, (_req: Request, res: Response) => {\n res.set('Allow', 'POST').status(405).json({\n jsonrpc: '2.0', id: null,\n error: { code: Mcp_JsonRpcErrorCode.METHOD_NOT_FOUND, message: 'the MCP endpoint offers no server-initiated SSE stream; use POST' },\n });\n });\n this.logRouteRegistration('GET', instanceUrl, 'Named MCP server instance GET → 405 (no server-initiated SSE stream)');\n\n // A named instance IS an MCP endpoint, so it owes the same answer as the default one. Registered\n // separately because Express matches `/mcp` and `/mcp/:instanceRef` as distinct routes — the base\n // DELETE handler does NOT cover the instance path, and without this an older client that sends\n // the retired session-termination verb to `/mcp/support` reads the framework 404 as \"no MCP\n // endpoint here\" and falls back to the deprecated HTTP+SSE transport.\n //\n // Found by probing the running server, not by a test: the base-endpoint pin passed while every\n // named instance answered 404. One verb, two routes — the recurring one-of-N shape.\n this.router.delete(instanceUrl, (_req: Request, res: Response) => {\n res.set('Allow', 'POST').status(405).json({\n jsonrpc: '2.0', id: null,\n error: { code: Mcp_JsonRpcErrorCode.METHOD_NOT_FOUND, message: 'the MCP endpoint has no sessions to terminate; use POST' },\n });\n });\n this.logRouteRegistration('DELETE', instanceUrl, 'Named MCP server instance DELETE → 405 (no protocol-level sessions)');\n }\n\n /**\n * Resolve the NAMED server instance addressed by this request, or the DEFAULT server.\n *\n * - No `:instanceRef` path param ⇒ `{ instanceRef: undefined }` — the default `/mcp` surface.\n * - A param naming a DECLARED instance ⇒ that ref (drives the audience + the catalog filter).\n * - A param naming an UNDECLARED instance ⇒ `undefined` (the caller 404s). Fail-closed: an\n * unknown ref must never silently fall back to the default catalog, which would hand a caller\n * tools the (non-existent) server was never meant to expose.\n */\n private resolveInstanceRef(req: Request): { instanceRef?: string } | undefined {\n const requested = (req.params as Record<string, string | undefined>)?.instanceRef;\n if (!requested) return { instanceRef: undefined };\n const instance = this.resourceServerInstances.tryGetInstance(ResourceServerKind.MCP, requested);\n return instance ? { instanceRef: instance.ref } : undefined;\n }\n\n /**\n * `GET /.well-known/oauth-protected-resource` (default server) and\n * `GET /mcp/:instanceRef/.well-known/oauth-protected-resource` (a named instance) — RFC 9728 metadata.\n *\n * Each instance advertises its OWN `resource` (its canonical audience), which is exactly the `aud` a\n * token must carry to be accepted there — so a client that discovers an instance and follows its\n * metadata obtains a token scoped to that instance and nothing else.\n */\n private async handleProtectedResourceMetadata(req: Request, res: Response): Promise<void> {\n const resolved = this.resolveInstanceRef(req);\n if (!resolved) {\n res.status(404).json({ error: 'not_found', error_description: 'no such MCP server instance' });\n return;\n }\n const apiAudience = this.appConfigService.resolveApiResourceAudience();\n const mcpResource = this.mcpResourceUri(resolved.instanceRef);\n if (!apiAudience || !mcpResource) {\n res.status(503).json({ error: 'temporarily_unavailable', error_description: 'resource audience is not resolvable (app public URL unset)' });\n return;\n }\n res.set('Cache-Control', 'public, max-age=3600');\n res.status(200).json({\n // This MCP resource server's canonical URI (the `aud` an audience-bound token must carry).\n resource: mcpResource,\n // The app's own OIDC provider (issuer == the API audience base).\n authorization_servers: [apiAudience],\n bearer_methods_supported: ['header'],\n /**\n * The OIDC identity scopes a delegated client should request — NOT authorization scopes.\n *\n * Wildo's authorization is roles-only, so this document once advertised `[]`, which was\n * TRUTHFUL and turned out to be unusable. A real client (Cursor, 2026-08-11) read the empty set,\n * concluded there was nothing to authorize, reported \"successfully authenticated\" and **never\n * opened a browser** — so no token was ever obtained and every `tools/call` stayed 401. The\n * scope-selection strategy tells a client to take the challenge's `scope` and otherwise fall\n * back to this field; supplying neither leaves it with no way to start an authorization request.\n *\n * These are the scopes a dynamically registered client is actually granted\n * (`/oauth/register` confines to exactly this set), so advertising them describes what a client\n * will really receive rather than inventing a vocabulary. They remain IDENTITY scopes: nothing\n * here grants access to a tool, which roles alone still decide.\n *\n * spec-cite: MCP 2026-07-28 — Authorization § Scope Selection Strategy.\n */\n scopes_supported: [...OIDC_SUPPORTED_IDENTITY_SCOPES],\n });\n }\n\n /**\n * Pick the protocol revision to answer `initialize` with.\n *\n * Returns the CLIENT's requested revision when this server serves it, else this server's own\n * newest — exactly the two-branch rule in Lifecycle § Version Negotiation. A malformed or absent\n * `params.protocolVersion` falls to our newest, which is also what a client that sent nothing\n * parseable can most reasonably be given.\n */\n private negotiateProtocolVersion(params: unknown, declaredVersion?: string): string {\n const requested = (params as { protocolVersion?: unknown } | undefined)?.protocolVersion;\n if (typeof requested === 'string' && MCP_SUPPORTED_PROTOCOL_VERSIONS.includes(requested)) return requested;\n // Fall back to what the REQUEST resolved to (header / `_meta`) before falling back to our\n // newest: a client that declared its revision on the transport but omitted it from the\n // `initialize` body has still told us what it speaks, and answering our newest instead would\n // hand it a version it may not support — whose own rule is to disconnect.\n if (declaredVersion && MCP_SUPPORTED_PROTOCOL_VERSIONS.includes(declaredVersion)) return declaredVersion;\n return MCP_PROTOCOL_VERSION;\n }\n\n /**\n * Validate the mirrored request-metadata headers against the body. Returns a reason, or\n * `undefined` when everything agrees.\n *\n * The hazard being closed is a SPLIT BRAIN, not sloppiness: \"This prevents potential security\n * vulnerabilities when different components in the network rely on different sources of truth\n * (e.g., a load balancer routing on the header value while the MCP server executes based on the\n * body value).\"\n * spec-cite: MCP 2026-07-28 — Streamable HTTP § Server Validation\n *\n * A MISSING required header is a validation failure too, not a tolerated omission — the spec lists\n * \"a required standard header … is missing\" first among its failure conditions. Tolerating it\n * would leave an intermediary routing on a header this server never checked.\n */\n private findRequestMetadataHeaderMismatch(req: Request, method: string, params: unknown): string | undefined {\n const headerVersion = req.headers['mcp-protocol-version'];\n if (typeof headerVersion !== 'string') {\n return 'MCP-Protocol-Version header is required';\n }\n const metaVersion = (params as { _meta?: Record<string, unknown> } | undefined)?._meta?.[MCP_META_PROTOCOL_VERSION_KEY];\n if (typeof metaVersion === 'string' && metaVersion !== headerVersion) {\n return `MCP-Protocol-Version header value '${headerVersion}' does not match body value '${metaVersion}'`;\n }\n\n const headerMethod = req.headers['mcp-method'];\n if (typeof headerMethod !== 'string') return 'Mcp-Method header is required';\n if (headerMethod !== method) {\n return `Mcp-Method header value '${headerMethod}' does not match body value '${method}'`;\n }\n\n if (!MCP_METHODS_REQUIRING_NAME_HEADER.includes(method)) return undefined;\n\n const headerName = req.headers['mcp-name'];\n if (typeof headerName !== 'string') return 'Mcp-Name header is required';\n const p = (params ?? {}) as { name?: unknown; uri?: unknown };\n const bodyName = typeof p.name === 'string' ? p.name : (typeof p.uri === 'string' ? p.uri : undefined);\n // A body with NO target used to pass this gate, because the comparison carried a\n // `bodyName !== undefined &&` guard and was therefore skipped when there was nothing to compare\n // against. The header exists so a proxy can route without parsing the body, and this is exactly\n // the case where it asserts a routing target the body does not support.\n //\n // **Dropping that guard is what makes this correct** — the comparison below then rejects\n // `'todos__list' !== undefined` on its own. This early return exists only for the MESSAGE:\n // \"does not match body value 'undefined'\" describes a mismatch, when the real fault is that\n // there is nothing to match. Proven by mutation: removing only this block changes nothing;\n // restoring the guard as well is what reddens the pin.\n if (bodyName === undefined) {\n return `Mcp-Name header names '${decodeMcpHeaderValue(headerName)}' but the request body carries no target`;\n }\n // Decoded BEFORE comparison — a client MUST use the Base64 sentinel for any value that is not\n // header-safe, so comparing raw would reject exactly the names the encoding exists to carry.\n if (decodeMcpHeaderValue(headerName) !== bodyName) {\n return `Mcp-Name header value '${headerName}' does not match body value '${bodyName}'`;\n }\n return undefined;\n }\n\n /**\n * The protocol revision THIS request is written against.\n *\n * `_meta` wins over the header because a stateless request carries its revision in the body and a\n * proxy cannot rewrite it there; the header is the transport mirror of the same value. When\n * neither is present the request predates both mechanisms, so it gets the handshake default the\n * specification assigns rather than our newest — answering our newest to a client that said\n * nothing is how a `2025-03-26` client gets told it is speaking something it may not support.\n */\n private resolveDeclaredProtocolVersion(req: Request): string | undefined {\n const meta = (req.body as { params?: { _meta?: Record<string, unknown> } } | undefined)?.params?._meta;\n const declared = meta?.[MCP_META_PROTOCOL_VERSION_KEY];\n if (typeof declared === 'string' && MCP_SUPPORTED_PROTOCOL_VERSIONS.includes(declared)) return declared;\n\n const header = req.headers['mcp-protocol-version'];\n if (typeof header === 'string' && MCP_SUPPORTED_PROTOCOL_VERSIONS.includes(header)) return header;\n\n return undefined;\n }\n\n /**\n * The revision whose RULES this request is held to.\n *\n * Distinct from {@link resolveDeclaredProtocolVersion} on purpose, and the distinction is\n * load-bearing. When a client declares nothing the specification tells us how to READ the request\n * — assume `2025-03-26` — but that assumption must never become what we ADVERTISE back: a client\n * that said nothing has requested nothing, and `initialize` must then answer this server's newest,\n * not the floor we read it at.\n *\n * Collapsing the two (returning the assumed default from one helper and feeding it into\n * negotiation) silently downgraded every handshake client to `2025-03-26`. Two existing pins\n * caught it immediately, which is the argument for keeping them narrow enough to fail loudly.\n */\n private resolveEffectiveProtocolVersion(req: Request): string {\n return this.resolveDeclaredProtocolVersion(req) ?? MCP_ASSUMED_PROTOCOL_VERSION_WHEN_HEADER_ABSENT;\n }\n\n /**\n * `POST /mcp` — JSON-RPC 2.0 dispatch. Application-level failures are returned as\n * JSON-RPC error envelopes (HTTP 200) per the protocol; a missing/invalid Bearer on\n * `tools/call` returns HTTP 401 + `WWW-Authenticate` pointing at the RFC 9728 metadata\n * (the OAuth resource-server challenge). A malformed envelope yields a null-id error.\n */\n private async handleJsonRpc(req: Request, res: Response): Promise<void> {\n // R-2: which server instance is being addressed (default `/mcp`, or a declared `/mcp/<ref>`).\n // An unknown ref 404s BEFORE any parsing/auth — it is not a server, so it has no JSON-RPC surface.\n const resolved = this.resolveInstanceRef(req);\n if (!resolved) {\n res.status(404).json({ error: 'not_found', error_description: 'no such MCP server instance' });\n return;\n }\n const instanceRef = resolved.instanceRef;\n\n // ── Origin: refuse ANY browser-originated call ───────────────────────────────────────────\n //\n // \"Servers MUST validate the `Origin` header on all incoming connections to prevent DNS\n // rebinding attacks\"\n // spec-cite: MCP 2025-06-18 — Transports § Streamable HTTP → Security Warning\n //\n // The policy is a FLAT REFUSAL of any request carrying an `Origin`, not an allow-list, because\n // this endpoint has no legitimate browser caller: it is machine-to-machine and authenticated by\n // a Bearer machine token, so a page able to call it would have had to keep that token somewhere\n // browser-reachable — which is a credential leak whether or not the origin is recognised.\n //\n // An ABSENT `Origin` is allowed, and that is the whole reason this is safe to ship: browsers\n // attach `Origin` to every cross-origin request, while the MCP clients that actually use this\n // surface (desktop hosts, CLIs, agent runtimes) are not browsers and send none. An allow-list\n // keyed on configured frontend URLs would have been the obvious move and is worse twice over —\n // it invents a second origin authority beside the WebSocket service's, and it implies a browser\n // MCP client is a supported shape when it is a misconfiguration.\n //\n // Defence in depth rather than the primary control: a rebinding page cannot set `Authorization`\n // cross-origin without a preflight this endpoint does not answer permissively, so it never got\n // past the auth gate either. Both are cheap; the one that fails closed on its own is kept.\n const requestOrigin = req.headers.origin;\n if (typeof requestOrigin === 'string' && requestOrigin.length > 0) {\n this.logger.warn('[MCP] Refused a browser-originated JSON-RPC call', { origin: requestOrigin, instanceRef });\n res.status(403).json({\n error: 'origin_not_allowed',\n error_description: 'the MCP endpoint does not accept browser-originated requests',\n });\n return;\n }\n\n // ── MCP-Protocol-Version header ──────────────────────────────────────────────────────────\n //\n // \"If the server receives a request with an invalid or unsupported `MCP-Protocol-Version`, it\n // MUST respond with `400 Bad Request`.\"\n // spec-cite: MCP 2025-06-18 — Transports § Protocol Version Header\n //\n // ABSENT is not invalid — the spec assigns a default rather than requiring the header on the\n // first exchange, and demanding it would break the `initialize` request itself, which is sent\n // before any version has been negotiated to put in it.\n const declaredVersion = req.headers['mcp-protocol-version'];\n if (typeof declaredVersion === 'string' && !MCP_SUPPORTED_PROTOCOL_VERSIONS.includes(declaredVersion)) {\n // A JSON-RPC error body, NOT a plain one — and the shape is what makes it useful.\n //\n // A client that supports both eras probes with a modern request and decides from the RESPONSE\n // BODY whether to fall back: \"If the body contains a recognized modern JSON-RPC error, the\n // server speaks a modern version of MCP — retry using the advertised `supported` versions or\n // correct the request, rather than falling back.\"\n // spec-cite: MCP 2026-07-28 — Streamable HTTP § Backward Compatibility\n //\n // A plain `{error: '…'}` body is NOT a recognized JSON-RPC error, so it would send exactly\n // that client down the legacy HTTP+SSE path — against a server that speaks the modern one.\n // The earlier comment here reasoned that a JSON-RPC body \"would imply the message was\n // processed\"; that is true of application errors and wrong here, because the spec makes this\n // response the fallback DISCRIMINATOR.\n res.status(400).json({\n jsonrpc: '2.0',\n id: null,\n error: {\n code: Mcp_JsonRpcErrorCode.UNSUPPORTED_PROTOCOL_VERSION,\n message: `MCP-Protocol-Version '${declaredVersion}' is not supported`,\n data: { supported: MCP_SUPPORTED_PROTOCOL_VERSIONS },\n },\n });\n return;\n }\n\n // ── The effective revision for THIS request ──────────────────────────────────────────────\n //\n // From `2026-07-28` MCP is stateless: the revision travels per request rather than being agreed\n // once by a handshake. Three sources, most specific first — the `_meta` key (stateless\n // revisions), then the transport header, then the handshake default for everything older.\n //\n // \"Every request declares the protocol version it is using via the\n // `io.modelcontextprotocol/protocolVersion` key in its `_meta` field […] On Streamable HTTP,\n // the same value is also carried in the `MCP-Protocol-Version` header.\"\n // spec-cite: MCP — Versioning § Negotiation\n //\n // Resolved BEFORE dispatch because the revision decides which RULES apply, and the obligations\n // that arrived with `2026-07-28` (required `Mcp-Method`/`Mcp-Name`, the `resultType` envelope)\n // must never be applied to a request written against an earlier one. Serving several revisions\n // at once is explicitly sanctioned — \"Clients and servers MAY support multiple protocol versions\n // simultaneously\" — and is what makes this migration additive rather than breaking.\n // The revision whose RULES this request is held to. Not consumed yet: the obligations that read\n // it — required `Mcp-Method`/`Mcp-Name`, the `resultType` envelope, `ttlMs`/`cacheScope` — arrive\n // in migration steps M3/M4. Resolved here rather than at each future site because the whole point\n // of the seam is that ONE decision governs which rules apply; deriving it separately per\n // obligation is how three of four sites end up disagreeing.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const effectiveVersion = this.resolveEffectiveProtocolVersion(req);\n // What the client actually DECLARED, or undefined. Deliberately separate — see the resolver's\n // JSDoc: feeding the assumed default into negotiation downgraded every handshake client.\n const declaredVersionForNegotiation = this.resolveDeclaredProtocolVersion(req);\n\n const parsed = Mcp_JsonRpcRequestSchema.safeParse(req.body);\n if (!parsed.success) {\n this.sendRpcError(req, res, null, Mcp_JsonRpcErrorCode.INVALID_REQUEST, 'malformed JSON-RPC 2.0 request');\n return;\n }\n const { id, method, params } = parsed.data;\n const rpcId: JsonRpcId = id ?? null;\n\n // ── Request-metadata headers — `2026-07-28` ONLY ─────────────────────────────────────────\n //\n // This is HAZARD 1 in code. `Mcp-Method` is \"Required For: All requests\" and `Mcp-Name` for\n // `tools/call` / `resources/read` / `prompts/get`; a `2025-06-18` client sends NEITHER, so\n // validating unconditionally would reject every existing client on its first request.\n // spec-cite: MCP 2026-07-28 — Streamable HTTP § Standard Request Headers\n //\n // The rule is gated on what the request DECLARED, which is why the declared/effective split\n // matters: a request that never claimed `2026-07-28` is never held to it.\n if (isStatelessMcpProtocolVersion(declaredVersionForNegotiation)) {\n const mismatch = this.findRequestMetadataHeaderMismatch(req, method, params);\n if (mismatch) {\n // 400 + `-32020`, both mandated. The status is what a legacy-probing client keys on to tell\n // a modern server from an old one, and the JSON-RPC body is what stops it falling back.\n this.sendRpcError(req, res, rpcId, Mcp_JsonRpcErrorCode.HEADER_MISMATCH, mismatch, 400);\n return;\n }\n }\n\n // ── JSON-RPC NOTIFICATIONS: acknowledge, never answer ────────────────────────────────────\n //\n // A notification is a message with NO `id`. Streamable HTTP is explicit about the reply:\n //\n // \"If the input is a JSON-RPC response or notification: If the server accepts the input, the\n // server MUST return HTTP status code 202 Accepted with no body.\"\n // spec-cite: MCP 2025-06-18 — Transports § Streamable HTTP → Sending Messages to the Server, item 4\n //\n // This matters far beyond tidiness, because EVERY conformant client sends one immediately after\n // `initialize`:\n //\n // \"After successful initialization, the client MUST send an `initialized` notification to\n // indicate it is ready to begin normal operations\" — `{\"jsonrpc\":\"2.0\",\"method\":\"notifications/initialized\"}`\n // spec-cite: MCP 2025-06-18 — Lifecycle § Initialization\n //\n // Before this, that notification fell through to the `default` arm and was answered with a\n // METHOD_NOT_FOUND error envelope — the server telling every client, on every connection, that\n // the one message the specification obliges it to send is unsupported. Clients that surface or\n // fail on an initialization error would never have reached `tools/list`.\n //\n // Acknowledged rather than routed: this server negotiates `tools` only, so no notification it\n // can legally receive changes any state. An UNKNOWN notification is also accepted (202) rather\n // than refused, because refusing is reserved for input the server \"cannot accept\", and a\n // notification it does not recognise is one it can safely ignore — the sender is not waiting on\n // an answer either way, so an error response would be a reply nobody reads to a message that\n // caused no harm.\n if (id === undefined) {\n res.status(202).end();\n return;\n }\n\n switch (method) {\n case 'initialize':\n this.sendRpcResult(req, res, rpcId, {\n // Negotiated, not asserted:\n // \"If the server supports the requested protocol version, it MUST respond with the same\n // version. Otherwise, the server MUST respond with another protocol version it supports.\"\n // spec-cite: MCP 2025-06-18 — Lifecycle § Version Negotiation\n //\n // This previously answered `MCP_PROTOCOL_VERSION` unconditionally, which silently told a\n // 2025-03-26 client it was talking 2025-06-18. The client's own rule on that is to\n // disconnect if it does not support the version it is handed, so an unconditional answer\n // converts a working pairing into a dropped connection.\n protocolVersion: this.negotiateProtocolVersion(params, declaredVersionForNegotiation),\n capabilities: { tools: { listChanged: false } },\n serverInfo: { name: 'wildo-mcp', version: '1.0.0' },\n });\n return;\n case 'server/discover':\n // \"`server/discover` lets a client query a server's supported protocol versions,\n // capabilities, and identity before sending any other requests. Servers **MUST**\n // implement it.\"\n // spec-cite: MCP 2026-07-28 — Discovery\n //\n // Answered for EVERY revision, not gated on `2026-07-28`. It costs an older client nothing\n // (it will never call it) and gating it would mean a stateless client probing a server that\n // also serves older revisions gets METHOD_NOT_FOUND — the same first-exchange failure the\n // `notifications/initialized` defect caused, arriving through the newer door.\n //\n // ── UNAUTHENTICATED, and that is a DECISION rather than an omission ──────────────────\n //\n // Three reasons, in order of weight:\n //\n // 1. It discloses nothing a caller cannot already learn. The response carries supported\n // revisions, a capability SHAPE (`tools`) and a self-reported name — no tool names, no\n // descriptions, no tenant data. The RFC 9728 protected-resource metadata beside it is\n // deliberately public and already reveals that this endpoint exists and which\n // authorization server guards it.\n // 2. Requiring a token would invert the order of operations. A conforming `2026-07-28`\n // request must carry `MCP-Protocol-Version`, so a client has to learn which revisions\n // this server speaks BEFORE it can construct one — and it obtains its token from an\n // authorization server it discovers through the public metadata. Gating discovery behind\n // the credential you need discovery to acquire is a loop.\n // 3. It is the documented backward-compatibility probe. A client that cannot call it\n // unauthenticated falls back to the deprecated transport against a server that speaks\n // the modern one.\n //\n // What this does NOT license: `tools/list` CHALLENGES an anonymous caller (its catalogue is\n // empty) and `tools/call` still authenticates fail-closed. Discovery being open is not a\n // precedent for the catalogue or the invocation being open.\n this.sendRpcResult(req, res, rpcId, this.withResultEnvelope({\n supportedVersions: MCP_SUPPORTED_PROTOCOL_VERSIONS,\n // TOOLS ONLY — a deliberate, recorded position, not an omission. Advertising a capability\n // we do not serve would have a client probe `resources/list` and get METHOD_NOT_FOUND.\n capabilities: { tools: {} },\n // \"Optional natural-language guidance for LLMs on how to use this server effectively.\"\n // spec-cite: MCP 2026-07-28 — Discovery § Data Types → DiscoverResult\n //\n // Carries the CONVENTIONS no single tool schema can express — the naming pattern, that\n // scope rides the credential rather than the arguments, the collection envelope, and that\n // the annotations are worth reading before a retry. Each was previously learnable only by\n // making a call and reading the failure.\n instructions: MCP_SERVER_INSTRUCTIONS,\n _meta: { 'io.modelcontextprotocol/serverInfo': { name: 'wildo-mcp', version: '1.0.0' } },\n // PUBLIC: supported revisions, capability shape and server identity are identical for every\n // caller, so a shared cache serving one client's answer to another discloses nothing.\n // The envelope is applied UNCONDITIONALLY here, unlike everywhere else.\n //\n // `server/discover` exists only from `2026-07-28` — a client that calls it is a\n // stateless-era client by definition, whatever it did or did not put in `_meta`. Gating on\n // the declared revision would hand exactly that client a hint-less result when it omitted\n // the key, and the caching rule names this method specifically as one whose result MUST\n // carry hints. So the method itself is the declaration.\n }, MCP_STATELESS_PROTOCOL_VERSION, { ttlMs: MCP_DISCOVER_CACHE_TTL_MS, cacheScope: Mcp_CacheScope.PUBLIC }));\n return;\n case 'tools/list':\n await this.handleToolsList(req, res, rpcId, params, instanceRef, effectiveVersion);\n return;\n case 'tools/call':\n await this.handleToolsCall(req, res, rpcId, params, instanceRef, effectiveVersion);\n return;\n default:\n // \"If the server does not implement the requested RPC method, it MUST respond with\n // `404 Not Found` and a JSON-RPC error with code `-32601`.\"\n // spec-cite: MCP 2026-07-28 — Streamable HTTP § Protocol Version Header\n //\n // 404 ONLY for a request that declared the stateless revision. Older revisions carry a\n // METHOD_NOT_FOUND on HTTP 200 per plain JSON-RPC, and changing that under them would break\n // clients that key on the status — the same per-revision discipline as the metadata headers.\n this.sendRpcError(\n req, res, rpcId, Mcp_JsonRpcErrorCode.METHOD_NOT_FOUND, `method '${method}' is not supported`,\n isStatelessMcpProtocolVersion(declaredVersionForNegotiation) ? 404 : 200,\n );\n }\n }\n\n /**\n * `tools/list` — PROGRESSIVE principal-awareness across THREE principals.\n *\n * A caller presenting a VALID Bearer bound to THIS MCP endpoint gets the catalog for its principal —\n * a user-delegated token additionally surfaces its USER_SELF tools. An ANONYMOUS caller reaches\n * nothing, and an empty anonymous catalogue is CHALLENGED rather than returned as an empty page. An\n * INVALID/expired Bearer is answered `invalid_token`, not silently downgraded.\n *\n * Both of those were the opposite until 2026-08-11, and the reversal is the point: an anonymous\n * caller was classified as a MACHINE principal and handed ORG/APP tools it could not invoke, so the\n * 401 that clients gate their login window on never fired. A real client reported \"successfully\n * authenticated\" having never opened a browser.\n */\n private async handleToolsList(req: Request, res: Response, id: JsonRpcId, params: unknown, instanceRef?: string, effectiveVersion = MCP_PROTOCOL_VERSION): Promise<void> {\n // ── Pagination cursor ─────────────────────────────────────────────────────────────────────\n //\n // This server does not paginate `tools/list`: the catalogue is small and bounded by the app's\n // own `mcp.exposed` declarations, so every call returns the complete set and NEVER emits a\n // `nextCursor`. That is allowed — pagination is a server capability, and a client \"SHOULD treat\n // a missing `nextCursor` as the end of results\".\n //\n // But it makes every cursor we RECEIVE invalid by construction: a cursor is opaque and can only\n // have come from a `nextCursor` we issued, and we issue none. Silently ignoring it and returning\n // the full page again is the dangerous answer — a client resuming from a stale cursor would be\n // handed the whole catalogue as though it were the next page, and one that kept paging would\n // loop forever on a `nextCursor` that never arrives.\n //\n // \"Invalid cursors SHOULD result in an error with code -32602 (Invalid params).\"\n // spec-cite: MCP 2026-07-28 — Pagination § Error Handling\n //\n // Presence is what makes it invalid, not the value: \"an empty string is a valid cursor and thus\n // MUST NOT be treated as the end of results\", so `cursor: ''` is a real cursor and is refused\n // like any other. Only an ABSENT cursor is a first-page request.\n const requestedCursor = (params as { cursor?: unknown } | undefined)?.cursor;\n if (requestedCursor !== undefined && requestedCursor !== null) {\n this.sendRpcError(req, res, id, Mcp_JsonRpcErrorCode.INVALID_PARAMS, 'tools/list does not paginate; this server never issues a nextCursor, so the supplied cursor is not one it can resume from');\n return;\n }\n\n const token = this.extractBearerToken(req);\n // The Bearer is validated against THIS instance's audience — a token minted for another instance\n // does not upgrade the catalog here.\n const mcpResource = this.mcpResourceUri(instanceRef);\n const apiAudience = this.appConfigService.resolveApiResourceAudience();\n let principal = McpCallerPrincipal.ANONYMOUS;\n if (token && mcpResource) {\n try {\n const auth = await this.executionContextCreator.authenticateExternalToken(token, mcpResource);\n // A user-delegated (`authorization_code`) token carries a `userId`; a machine token does not.\n principal = auth.initiatorIds?.userId ? McpCallerPrincipal.USER_DELEGATED : McpCallerPrincipal.MACHINE;\n } catch {\n // A PRESENTED-but-bad credential is answered, not ignored. Until 2026-08-11 this degraded\n // silently to the public catalogue, which hid an expiry from the one caller able to fix it:\n // the client saw a plausible list, called a tool, and only then learned its token was dead.\n // `invalid_token` tells it to REFRESH rather than restart authorization.\n if (!apiAudience) {\n this.sendRpcError(req, res, id, Mcp_JsonRpcErrorCode.INTERNAL_ERROR, 'resource audience is not resolvable');\n return;\n }\n this.sendUnauthenticated(req, res, id, apiAudience, instanceRef, 'the access token is invalid, expired, or not audience-bound', 'invalid_token');\n return;\n }\n }\n\n const reachableScopes = mcpReachableScopesForPrincipal(principal);\n const tools = this.mcpServer.listTools({ reachableScopes, instanceRef });\n\n /**\n * An anonymous caller with nothing to list is CHALLENGED rather than handed an empty page.\n *\n * This is the rung a client's whole authorization flow hangs from. Clients open the login window\n * on a 401 during connect — and a reconnect is `initialize` + `tools/list`. Answering 200 there\n * means the session comes up \"working\", so authorization is never attempted and every later\n * `tools/call` fails 401 forever. Cursor demonstrated exactly this on 2026-08-11: clicking\n * Authenticate reported success without ever opening a browser.\n *\n * Scoped deliberately narrow — it fires ONLY when no credentials were presented AND the catalogue\n * is empty:\n * - a caller that presented a token gets its (possibly empty) catalogue, never a challenge:\n * \"This set MAY be empty\" is a legitimate answer to an authenticated principal, and\n * challenging one that already authenticated would loop it.\n * - an app whose anonymous catalogue is NON-empty stays public and is never challenged, so a\n * genuinely public MCP server remains expressible the day an anonymous dispatch path exists.\n *\n * spec-cite: MCP 2026-07-28 — Server Features § Tools (the tool set \"MAY be empty\" and \"MAY vary\n * by the authorization presented on the request\").\n */\n if (principal === McpCallerPrincipal.ANONYMOUS && tools.length === 0) {\n if (!apiAudience) {\n this.sendRpcError(req, res, id, Mcp_JsonRpcErrorCode.INTERNAL_ERROR, 'resource audience is not resolvable');\n return;\n }\n this.sendUnauthenticated(req, res, id, apiAudience, instanceRef, 'a Bearer access token is required to list this server\\'s tools');\n return;\n }\n // Strip the internal fields the descriptor carries for re-resolution before serialising.\n this.sendRpcResult(req, res, id, this.withResultEnvelope({\n // Sorted by name. \"Servers SHOULD return tools from `tools/list` in a deterministic order to\n // enable client-side caching and improve LLM prompt cache hit rates.\"\n // spec-cite: MCP 2026-07-28 — Key Changes § Minor changes item 3\n //\n // Applied for EVERY revision, not gated: a stable order cannot break an older client, and\n // deriving it from registry iteration order would make the catalogue reorder itself on an\n // unrelated resource being registered — silently costing every client its prompt cache.\n tools: tools\n .map((t) => ({\n name: t.name,\n description: t.description,\n inputSchema: t.inputSchema,\n ...(t.annotations ? { annotations: t.annotations } : {}),\n }))\n .sort((a, b) => a.name.localeCompare(b.name)),\n // PRIVATE, and this is a security decision rather than a default.\n //\n // A tool catalogue looks like the textbook `public` case — \"lists of tools […] when they are\n // identical for all users\". OURS ARE NOT. The catalogue widens for a user-delegated token\n // (`mcpReachableScopesForPrincipal(isUserDelegated)`), so a `public` scope would let a shared\n // gateway serve a delegated caller's wider catalogue to a machine caller — which the spec warns\n // about in as many words: a `public` result \"may be shared between callers even if the Result\n // is coming from an authenticated endpoint\".\n // spec-cite: MCP 2026-07-28 — Caching § Security Considerations, and § Choosing a Cache Scope\n // (\"`private` is appropriate for […] filtered list results that vary per user\").\n }, effectiveVersion, { ttlMs: MCP_TOOLS_LIST_CACHE_TTL_MS, cacheScope: Mcp_CacheScope.PRIVATE }));\n }\n\n /** `tools/call` — authenticate (fail-closed) → build the machine EC → dispatch via the server. */\n private async handleToolsCall(req: Request, res: Response, id: JsonRpcId, params: unknown, instanceRef?: string, effectiveVersion = MCP_PROTOCOL_VERSION): Promise<void> {\n const parsedParams = Mcp_ToolsCallParamsSchema.safeParse(params);\n if (!parsedParams.success) {\n this.sendRpcError(req, res, id, Mcp_JsonRpcErrorCode.INVALID_PARAMS, parsedParams.error.issues[0]?.message ?? 'invalid params');\n return;\n }\n const { name: toolName, arguments: toolArgs } = parsedParams.data;\n\n const apiAudience = this.appConfigService.resolveApiResourceAudience();\n // R-2: the token must be audience-bound to THIS instance (`…/mcp/<ref>`), so a token minted for\n // another server — or for the default one — is rejected here. Per-instance isolation is enforced by\n // the same RFC 8707 check the 2026-07-29 flip made strict; no auth-layer change was needed.\n const mcpResource = this.mcpResourceUri(instanceRef);\n if (!apiAudience || !mcpResource) {\n this.sendRpcError(req, res, id, Mcp_JsonRpcErrorCode.INTERNAL_ERROR, 'resource audience is not resolvable');\n return;\n }\n\n // ── OAuth 2.1 resource-server auth (D6/D7) ──────────────────────────────────\n const token = this.extractBearerToken(req);\n if (!token) {\n this.sendUnauthenticated(req, res, id, apiAudience, instanceRef, 'a Bearer access token is required');\n return;\n }\n let auth: SocketAuthResult;\n try {\n // `authenticateExternalToken` accepts BOTH a machine token (client_credentials → its own\n // org/app scope) AND a user-delegated token (authorization_code → the consenting user's scope).\n // Since the 2026-07-29 flip BOTH arms bind `aud` to THIS `mcpResource`: a machine token must be\n // minted for the MCP audience (the generic API audience is rejected here), and a delegated token\n // is verified aud-agnostically then bound to `mcpResource`. The scope for dispatch is resolved\n // principal-agnostically below.\n auth = await this.executionContextCreator.authenticateExternalToken(token, mcpResource);\n } catch {\n // SIEM-2 symmetry (S2): a rejected token at the token-USE seam feeds the shared per-IP failure\n // counter AND emits MACHINE_AUTH_FAILED, so a revoked/expired/forged token hammering /mcp is\n // visible to the SIEM (was invisible — only the token-MINT endpoint audited failures).\n void recordExternalTokenAuthFailure(\n { redisService: this.redisService, logger: this.logger, auditLogs: this.auditLogs },\n { clientIp: getClientIpFromRequest(req), resourceServer: ResourceServerKind.MCP, reason: 'external_token_invalid' },\n );\n this.sendUnauthenticated(req, res, id, apiAudience, instanceRef, 'the access token is invalid, expired, or not audience-bound');\n return;\n }\n\n // ── Per-principal call throttle (resource-op flood guard) ───────────────────\n // Cap `tools/call` dispatches per authenticated principal per window, rejecting a saturated\n // principal with a transport-level 429 + Retry-After BEFORE any dispatch. Fails open on a\n // limiter outage. (Distinct cap from A2A: an MCP call dispatches a CRUD op, not an LLM turn.)\n const principalKey = resolvePrincipalRateKey(auth);\n if (principalKey) {\n const rate = await assertExternalTurnWithinRate(\n { redisService: this.redisService, logger: this.logger },\n {\n principalKey,\n resourceServer: ResourceServerKind.MCP,\n maxPerWindow: MCP_EXTERNAL_CALL_RATE_MAX,\n windowSeconds: MCP_EXTERNAL_CALL_RATE_WINDOW_SECONDS,\n applicationEnv: this.appConfigService.applicationEnv,\n },\n );\n if (rate.kind === 'rate_limited') {\n this.sendRateLimited(req, res, id, rate.retryAfterSeconds);\n return;\n }\n }\n\n // ── Resolve the operation to build a correctly-scoped principal EC ───────────\n // Progressive principal-awareness: a user-delegated caller (carries a `userId`) can reach USER_SELF\n // operations; a machine caller reaches ORG/APP only. Resolve with the caller's reachable scopes so\n // this gate matches the server's `callTool` gate (advertise ≡ callable), and a crafted name for a\n // scope the caller cannot use fails closed HERE (before the service layer).\n const { resourceType, operationIdentifier } = this.parseToolName(toolName);\n const reachableScopes = mcpReachableScopesForPrincipal(mcpPrincipalForAuthenticatedCaller(!!auth.initiatorIds?.userId));\n // Issue #312, D11: a derived upload-grant tool resolves through its PARENT operation — that is\n // the operation whose scope the principal context must be built for, and whose instance id the\n // transport splits out of the arguments. The server re-resolves it the same way before minting.\n const derivedUploadGrant = resourceType && operationIdentifier && operationIdentifier.includes(MCP_UPLOAD_GRANT_TOOL_MARKER)\n ? this.toolAdapter.resolveUploadGrantTool(resourceType, operationIdentifier, reachableScopes, instanceRef)\n : undefined;\n const operation = derivedUploadGrant?.parentOperation ?? (resourceType && operationIdentifier\n ? this.toolAdapter.resolveExposableOperation(resourceType, operationIdentifier, reachableScopes, instanceRef)\n : undefined);\n if (!operation) {\n // A crafted / non-exposed name never reaches the service layer (would otherwise 403).\n this.sendRpcError(req, res, id, Mcp_JsonRpcErrorCode.METHOD_NOT_FOUND, `tool '${toolName}' does not map to an exposable operation`);\n return;\n }\n\n // SIEM-2: audit machine resource-access at the authorized-dispatch boundary — the caller is\n // authenticated + the tool resolved to an exposable operation, about to dispatch. Fire-and-forget\n // (no-op for a user principal). This records the access ATTEMPT: it fires BEFORE the per-op roles\n // authorization inside `callTool`, so a subsequent roles denial does NOT suppress the row and the\n // row carries no allow/deny outcome — a SIEM sees that the machine reached this operation, not\n // whether the call ultimately succeeded. The shared shaper owns machine-principal detection + F4\n // org routing (A2A + MCP never drift).\n this.auditLogs.logMachineResourceAccessFromAuth(auth, {\n resourceServer: ResourceServerKind.MCP,\n resourceIdentifier: toolName,\n operationIdentifier: MachineAccessOperation.MCP_TOOLS_CALL,\n ipAddress: getClientIpFromRequest(req),\n });\n\n // Scope bundle for the operation's parent scope. Forward WHICHEVER of org/app the authenticated\n // principal carries and let `buildContextFromSocketAuth` filter it to the operation's DECLARED\n // scope parameter (org-scoped op → organizationId, app-scoped op → applicationId). A MACHINE\n // principal carries exactly one (org XOR app). A USER-delegated principal carries the user's\n // resolved ACTIVE org — since 2026-07-31 taken from the delegating OAuth client's own tenant\n // (`azp` → org-scoped client → organizationId), which is what restored org-scoped tool access for\n // MULTI-ORG members; they previously resolved to no org and had every org-scoped call denied.\n // It still resolves to none for an app-scoped/unknown client or a zero-membership user, in which\n // case org-scoped ops continue to fail closed. That rides PLUS the applicationId — the filter picks the\n // right one per operation, so a user is never mis-scoped to the application scope. The\n // authoritative identity (userId / machineCredential) always rides `auth.initiatorIds`.\n const contextIds: Record<string, string> = {\n ...(auth.initiatorIds?.organizationId ? { organizationId: auth.initiatorIds.organizationId } : {}),\n ...(auth.initiatorIds?.applicationId ? { applicationId: auth.initiatorIds.applicationId } : {}),\n };\n\n // F-MCP-WRAP: a union/primitive-root tool (e.g. the todos-create `one_time | recurring` DTO)\n // advertises a `{value:...}` envelope; unwrap it symmetrically and pass the payload straight\n // through — such tools are creates with NO path-param id to split out (otherwise the DTO would\n // receive `{value:...}` and fail validation). Object-root tools keep the resource-id split so\n // READ/UPDATE/DELETE dispatch with a `resourceId` (path-param analogue).\n // A derived upload-grant tool never carries the parent's envelope — its arguments are the instance\n // id (UPDATE) plus a lifetime — so it always takes the id-split branch.\n const { resourceId, body }: { resourceId?: string; body: unknown } = !derivedUploadGrant && isMcpValueWrappedRequestDto(operation.requestDto)\n ? { body: unwrapMcpValueEnvelope(operation.requestDto, toolArgs) }\n : this.extractResourceId(resourceType, toolArgs);\n\n try {\n const executionContext = await this.executionContextCreator.buildContextFromSocketAuth(auth, operation, contextIds);\n const result = await this.mcpServer.callTool(toolName, body, executionContext, { ...(resourceId ? { resourceId } : {}), instanceRef });\n // ── MCP tool-result envelope ──────────────────────────────────────────────────────────────\n //\n // BOTH representations, deliberately:\n //\n // - `structuredContent` — the result as a JSON VALUE. Every tool here returns a resource DTO,\n // which is structured data by construction, so shipping it only as prose forced every agent\n // to parse JSON back out of a string it was told was text. The spec exists for exactly this\n // shape (its own worked example is a `list_users` array).\n // - `content` — the same payload serialized, kept because the spec asks for it:\n // \"For backwards compatibility, a tool that returns structured content SHOULD also return\n // the serialized JSON in a TextContent block.\"\n // spec-cite: MCP 2026-07-28 — Tools § Tool Result → Structured Content\n //\n // No `outputSchema` is advertised, and that is why `structuredContent` can be sent\n // unconditionally: the conformance obligation is one-directional — \"If an output schema is\n // provided: Servers MUST provide structured results that conform to this schema\"\n // (spec-cite: same page, § Output Schema). Structured content without a declared schema is\n // explicitly permitted, so this is additive and commits us to nothing we cannot yet derive.\n //\n // `text` is stringified defensively: `toResponseSafeToolOutput` passes `undefined` straight\n // through for a void operation, and `JSON.stringify(undefined)` is `undefined` — which would\n // have emitted a TextContent block whose REQUIRED `text` field was absent. `'null'` is the\n // honest JSON rendering of \"no result\", and `structuredContent` is omitted entirely in that\n // case rather than carrying a null that the agent would read as a value.\n const serializedResult = JSON.stringify(result.result) ?? 'null';\n // `withResultEnvelope` — NOT optional here, and its absence was a real gap found by reviewing\n // this block after adding `structuredContent` to it. Under the stateless revision every result\n // carries `resultType`, and on a TOOL result that field is load-bearing rather than decorative:\n // it is the discriminator between a completed call and `input_required`, the multi-round-trip\n // shape. A client switching on `resultType` received `undefined` from every tool call we\n // served, while `server/discover` and `tools/list` both carried it — the invariant had been\n // applied at two of its three sites, and the migration ledger recorded it as done.\n // spec-cite: MCP 2026-07-28 — Tools § Calling Tools (the CallToolResult example carries\n // `\"resultType\": \"complete\"`), and § Input Required Tool Results for the value it discriminates.\n //\n // No cache hints: a tool call mutates or reads live state per caller and is never cacheable —\n // which is why the envelope takes them as an explicit argument rather than always adding them.\n this.sendRpcResult(req, res, id, this.withResultEnvelope({\n content: [{ type: 'text', text: serializedResult }],\n ...(result.result === undefined ? {} : { structuredContent: result.result }),\n isError: false,\n }, effectiveVersion));\n } catch (error) {\n this.sendToolError(req, res, id, error, effectiveVersion);\n }\n }\n\n // ── helpers ───────────────────────────────────────────────────────────────\n\n /**\n * The MCP endpoint's absolute URI (`${apiAudience}/mcp`) — this resource server's identity and the\n * `aud` an audience-bound token must carry. Delegates to the single audience authority\n * (`resolveResourceServerAudience(MCP)`) so the token MINT (which validates a requested `resource`\n * against the SAME function) and this verify-side audience cannot drift. `undefined` when the app\n * public base URL is unresolvable (→ the caller fails closed with 503 / INTERNAL_ERROR).\n */\n private mcpResourceUri(instanceRef?: string): string | undefined {\n return this.appConfigService.resolveResourceServerAudience(ResourceServerKind.MCP, instanceRef);\n }\n\n private extractBearerToken(req: Request): string | undefined {\n const header = req.headers['authorization'];\n if (typeof header !== 'string' || !header.startsWith('Bearer ')) return undefined;\n const token = header.slice('Bearer '.length).trim();\n return token.length > 0 ? token : undefined;\n }\n\n /** Split `<resource>__<operation>` on the FIRST `__` (resource ids use single underscores). */\n private parseToolName(toolName: string): { resourceType: ResourceType | undefined; operationIdentifier: string | undefined } {\n const at = toolName.indexOf(MCP_TOOL_NAME_SEPARATOR);\n if (at <= 0 || at + MCP_TOOL_NAME_SEPARATOR.length >= toolName.length) {\n return { resourceType: undefined, operationIdentifier: undefined };\n }\n return {\n resourceType: toolName.slice(0, at) as ResourceType,\n operationIdentifier: toolName.slice(at + MCP_TOOL_NAME_SEPARATOR.length),\n };\n }\n\n /**\n * Pull the resource's own id field out of the tool arguments. When present it becomes\n * the service call's `resourceId` (path-param analogue) and is removed from the body;\n * otherwise the call is a collection operation (no id).\n */\n private extractResourceId(\n resourceType: ResourceType,\n args: Record<string, unknown> | undefined,\n ): { resourceId?: string; body: unknown } {\n if (!args) return { body: args };\n const fieldIdentifier = this.resourcesRegistry.getAllResourceFieldIdentifiers()[resourceType];\n if (fieldIdentifier && typeof args[fieldIdentifier] === 'string') {\n const { [fieldIdentifier]: id, ...rest } = args;\n return { resourceId: id as string, body: rest };\n }\n return { body: args };\n }\n\n /**\n * Whether to answer in the Streamable-HTTP **SSE** response mode rather than `application/json`.\n *\n * **JSON WINS A TIE — deliberately, and this is load-bearing.** The MCP Streamable-HTTP spec REQUIRES a\n * client to advertise BOTH (`Accept: application/json, text/event-stream`) and leaves the choice to the\n * server. The previous implementation was a bare `includes('text/event-stream')`, which matched that\n * spec-mandated header — so EVERY conformant MCP client was served SSE. A client that then parsed the\n * body as JSON (the reasonable default for a synchronous JSON-RPC call) got `{}`: the\n * `client-integration-app` integrator's `tools/list` silently returned an empty result, its agent saw no\n * tools, and both real-LLM integration scenarios degraded to INCONCLUSIVE — reading as \"no LLM credits\"\n * while actually being this defect. It went unnoticed because the SSE proof used\n * `Accept: text/event-stream` ALONE, which no conformant client sends.\n *\n * spec-cite: MCP 2025-06-18 §Transports → Streamable HTTP → \"Sending Messages to the Server\", item 2:\n * \"The client MUST include an `Accept` header, listing both `application/json` and `text/event-stream`\n * as supported content types.\" Item 5 is what leaves the choice to the server: it \"MUST either return\n * `Content-Type: text/event-stream` … or `Content-Type: application/json`\", and \"The client MUST\n * support both these cases.\" Checked against the revision this server advertises — `MCP_PROTOCOL_VERSION`\n * is `2025-06-18`. https://modelcontextprotocol.io/specification/2025-06-18/basic/transports\n *\n * The rules, in order:\n * 1. the client must accept `text/event-stream` at all — otherwise JSON;\n * 2. if it ALSO accepts JSON (explicitly, via `* / *`, or by sending no `Accept` at all), JSON wins.\n * Our results are synchronous single-message payloads, so JSON is the cheaper, more interoperable\n * representation and the right default;\n * 3. UNLESS the client explicitly ranks SSE above JSON with RFC 9110 `q` values\n * (`application/json;q=0.1, text/event-stream;q=0.9`). That keeps the SSE path REACHABLE — without\n * it, rule 2 would make SSE dead code for every spec-conformant client — and it honours a genuine,\n * explicitly-stated client preference rather than inventing a Wildo-specific opt-in.\n */\n private acceptsEventStream(req: Request): boolean {\n const header = String(req.headers['accept'] ?? '').toLowerCase().trim();\n // No `Accept` at all ⇒ the client expressed no preference ⇒ JSON (the default representation).\n if (!header) return false;\n\n // RFC 9110 §12.5.1: `q=0` means \"NOT acceptable\", not \"acceptable but least preferred\". A client\n // that explicitly refuses SSE must never be served SSE, even when it names no alternative.\n const sseQuality = this.acceptQuality(header, 'text/event-stream');\n if (sseQuality === undefined || sseQuality === 0) return false;\n\n // `*/*` makes JSON acceptable just as much as an explicit `application/json` does.\n const jsonQuality = this.acceptQuality(header, 'application/json') ?? this.acceptQuality(header, '*/*');\n if (jsonQuality === undefined) return true; // SSE is the only representation the client will take.\n\n // Both acceptable ⇒ JSON unless the client explicitly ranked SSE higher. (A `q=0` on JSON makes it\n // unacceptable, and `sseQuality > 0` at this point, so SSE correctly wins that case too.)\n return sseQuality > jsonQuality;\n }\n\n /**\n * The RFC 9110 quality value this `Accept` header assigns to one media type, or `undefined` when the\n * type is not present. A media range with no explicit `q` parameter defaults to `1.0`. Deliberately a\n * narrow lookup rather than a general `Accept` parser: only two media types are ever negotiated here.\n */\n private acceptQuality(header: string, mediaType: string): number | undefined {\n for (const part of header.split(',')) {\n const [type, ...params] = part.split(';').map((segment) => segment.trim());\n if (type !== mediaType) continue;\n const qParam = params.find((param) => param.startsWith('q='));\n if (!qParam) return 1;\n const parsed = Number.parseFloat(qParam.slice('q='.length));\n return Number.isFinite(parsed) ? parsed : 1;\n }\n return undefined;\n }\n\n /**\n * Write a single JSON-RPC message as a Streamable-HTTP SSE stream, then close it. Our tool calls are\n * synchronous (one response, no progress/notifications/server-initiated messages), so the stream\n * carries exactly one message event and ends — spec-compliant for a synchronous request/response over\n * the SSE response mode. (When a long-running tool or notifications land, this becomes multi-event.)\n */\n private writeSseMessage(res: Response, payload: unknown): void {\n res.status(200).set({\n 'Content-Type': 'text/event-stream',\n 'Cache-Control': 'no-cache, no-transform',\n Connection: 'keep-alive',\n // \"When initiating an SSE stream, servers SHOULD include the `X-Accel-Buffering: no` header in\n // the HTTP response. This instructs reverse proxies (such as nginx) to disable response\n // buffering, ensuring that SSE events are delivered to clients immediately rather than being\n // held in a buffer.\"\n // spec-cite: MCP 2026-07-28 — Streamable HTTP § Receiving Messages\n //\n // Applied to EVERY revision: a buffering proxy does not care which protocol version is in the\n // body, and the failure it causes — a stream that arrives all at once at the end, or not at\n // all — looks like a server hang rather than a proxy setting. `no-transform` above already\n // asks intermediaries not to modify the payload; this asks them not to hold it.\n 'X-Accel-Buffering': 'no',\n });\n res.write(`data: ${JSON.stringify(payload)}\\n\\n`);\n res.end();\n }\n\n /**\n * Send a 200 JSON-RPC result — as an SSE stream when the client negotiated `text/event-stream`\n * (Streamable-HTTP response mode), else as `application/json`. Both are spec-compliant.\n */\n /**\n * Add the `2026-07-28` result envelope — and ONLY for a request written against it.\n *\n * \"All results now carry a required `resultType` field: `\"complete\"` for ordinary results […]\n * Clients **MUST** treat results from earlier-protocol servers that omit the field as\n * `\"complete\"`.\"\n * spec-cite: MCP 2026-07-28 — Key Changes § Major changes item 8\n *\n * \"Servers MUST include caching hints on results with `resultType: \"complete\"` returned by […]\n * `server/discover`, `tools/list` […]\"\n * spec-cite: MCP 2026-07-28 — Caching § Cacheable Results\n *\n * Gated on the revision because the envelope is the visible half of Hazard 1: stamping fields from\n * a newer revision onto a response to an older client is the mirror image of demanding headers it\n * never sends. The spec's own instruction — treat an omitted `resultType` as complete — is what\n * makes omission the correct behaviour there, not a shortcut.\n */\n private withResultEnvelope(\n result: Record<string, unknown>,\n effectiveVersion: string,\n cache?: { ttlMs: number; cacheScope: Mcp_CacheScope },\n ): Record<string, unknown> {\n if (!isStatelessMcpProtocolVersion(effectiveVersion)) return result;\n return { ...result, resultType: 'complete', ...(cache ? { ttlMs: cache.ttlMs, cacheScope: cache.cacheScope } : {}) };\n }\n\n private sendRpcResult(req: Request, res: Response, id: JsonRpcId, result: unknown): void {\n const payload = { jsonrpc: '2.0', id, result };\n if (this.acceptsEventStream(req)) { this.writeSseMessage(res, payload); return; }\n res.status(200).json(payload);\n }\n\n /**\n * Send a JSON-RPC error. A 200-status APPLICATION error is SSE-framed when the client negotiated it\n * (same as a result); a TRANSPORT-level error (401 / 429 / 503) is ALWAYS a plain HTTP response with\n * that status, never SSE — the client must observe it at the HTTP layer.\n */\n private sendRpcError(req: Request, res: Response, id: JsonRpcId, code: Mcp_JsonRpcErrorCode, message: string, httpStatus = 200): void {\n const payload = { jsonrpc: '2.0', id, error: { code, message } };\n if (httpStatus === 200 && this.acceptsEventStream(req)) { this.writeSseMessage(res, payload); return; }\n res.status(httpStatus).json(payload);\n }\n\n /**\n * RFC 9728 challenge: 401 + `WWW-Authenticate` naming the protected-resource metadata of the SERVER THE\n * CLIENT ACTUALLY ADDRESSED (transport-level; plain HTTP).\n *\n * The `instanceRef` is load-bearing, not cosmetic. This pointer is the ONLY discovery route a client\n * has: Wildo's PRM lives at a NON-STANDARD path (`…/mcp/<ref>/.well-known/oauth-protected-resource`\n * rather than the RFC's origin-root `/.well-known/oauth-protected-resource/<path>`), so a client cannot\n * derive it from the request URL and must follow this header. Pointing every 401 at the DEFAULT\n * metadata made named instances undiscoverable AND unusable: the client would read the default PRM,\n * mint a token for the DEFAULT audience, present it at `/mcp/<ref>`, be rejected on the audience check,\n * re-read the same default metadata, and loop forever — with each iteration looking like a plain auth\n * failure rather than a discovery bug.\n */\n private sendUnauthenticated(\n req: Request,\n res: Response,\n id: JsonRpcId,\n apiAudience: string,\n instanceRef: string | undefined,\n message: string,\n /**\n * RFC 6750 § 3.1 `error` code. Supply `invalid_token` when the caller DID present a credential\n * and it failed — the distinction is actionable: a client seeing `invalid_token` refreshes, while\n * a bare challenge means \"you have not authorized yet\" and starts the whole flow. Omitted for the\n * no-credentials case, which is the bare challenge.\n */\n oauthError?: string,\n ): void {\n // `scope` accompanies the metadata pointer because it is the FIRST rung of the client's\n // scope-selection ladder — a client takes the challenge's `scope` and only falls back to the\n // protected-resource document's `scopes_supported`. Carrying neither is what left Cursor with no\n // authorization request to build on 2026-08-11, so it silently skipped the browser leg entirely.\n // The value is the identity set a delegated client is actually granted, kept identical to the\n // metadata document's so the two rungs can never disagree.\n // spec-cite: MCP 2026-07-28 — Authorization § Scope Selection Strategy; RFC 6750 § 3.\n const challengeScope = OIDC_SUPPORTED_IDENTITY_SCOPES.join(' ');\n res.set(\n 'WWW-Authenticate',\n [\n 'Bearer',\n [\n ...(oauthError ? [`error=\"${oauthError}\"`] : []),\n `resource_metadata=\"${this.mcpProtectedResourceMetadataUri(apiAudience, instanceRef)}\"`,\n `scope=\"${challengeScope}\"`,\n ].join(', '),\n ].join(' '),\n );\n this.sendRpcError(req, res, id, Mcp_JsonRpcErrorCode.UNAUTHENTICATED, message, 401);\n }\n\n /**\n * The absolute RFC 9728 metadata URL for one MCP surface. Built from the SAME two route constants\n * `setupRoutes` composes the metadata routes from, so the advertised URL and the mounted route cannot\n * drift — change the constants and both move together.\n *\n * Note the deliberate asymmetry: the DEFAULT server's metadata hangs off the API audience root, while a\n * named instance's hangs off that instance's own audience (`…/mcp/<ref>`). That mirrors how the routes\n * are actually mounted.\n */\n private mcpProtectedResourceMetadataUri(apiAudience: string, instanceRef?: string): string {\n const metadataRoute = MANUAL_CONTROLLER_ROUTES_URLS[ManualControllerRouteKey.MCP_PROTECTED_RESOURCE_METADATA];\n if (!instanceRef) return `${apiAudience}${metadataRoute}`;\n return `${apiAudience}${MANUAL_CONTROLLER_ROUTES_URLS[ManualControllerRouteKey.MCP_ENDPOINT]}/${instanceRef}${metadataRoute}`;\n }\n\n /**\n * Transport-level throttle response: HTTP 429 + `Retry-After`, carrying a valid JSON-RPC\n * error envelope with `RATE_LIMITED`. Distinct from the 200-envelope app errors because\n * rate-limiting is a transport concern a client should honor at the HTTP layer (so never SSE).\n */\n private sendRateLimited(req: Request, res: Response, id: JsonRpcId, retryAfterSeconds: number): void {\n res.set('Retry-After', String(retryAfterSeconds));\n this.sendRpcError(req, res, id, Mcp_JsonRpcErrorCode.RATE_LIMITED, 'Rate limit exceeded; retry after the indicated delay.', 429);\n }\n\n /**\n * A thrown `callTool` failure → JSON-RPC error (a 200 envelope: the call transported OK, the tool\n * failed). An authorization/authentication denial (the fail-closed path) surfaces as UNAUTHENTICATED\n * so the caller sees the rejection; anything else is an INTERNAL_ERROR carrying the classified type.\n * SSE-framed when the client negotiated it (same as any 200 result).\n */\n private sendToolError(req: Request, res: Response, id: JsonRpcId, error: unknown, effectiveVersion = MCP_PROTOCOL_VERSION): void {\n const wildo = this.asWildoError(error);\n const type = wildo?.type;\n const message = (wildo?.customMessageReference as string) ?? (error instanceof Error ? error.message : 'tool execution failed');\n this.logDebug('MCP tools/call failed', { type, message });\n\n // ── TOOL EXECUTION ERROR vs PROTOCOL ERROR ────────────────────────────────────────────────\n //\n // The specification splits these by WHO CAN FIX IT, and the split decides whether the agent is\n // ever shown the reason: \"Clients MAY provide protocol errors to language models, though these\n // are less likely to result in successful recovery. Clients SHOULD provide tool execution errors\n // to language models to enable self-correction.\"\n // spec-cite: MCP 2026-07-28 — Tools § Error Handling\n //\n // Every failure used to leave here as a protocol error, so a bad field produced a reply the\n // client was entitled to withhold from the model — which then retried the same call unchanged.\n if (type && MCP_TOOL_EXECUTION_ERROR_TYPES.has(type)) {\n // Sanitised through the SAME boundary the HTTP path uses, so a tool caller learns exactly what\n // a REST caller would and not one field more. That boundary deliberately preserves `zodIssues`\n // and `fieldName` for VALIDATION — the field-level detail that makes the error actionable — while\n // stripping internal context. Re-deriving a bespoke projection here would be a second disclosure\n // policy for the same errors, and the two would drift.\n const safe = wildo ? this.errorBuilder.sanitizeErrorForClient(wildo) : undefined;\n const detail = safe?.context ? ` ${JSON.stringify(safe.context)}` : '';\n this.sendRpcResult(req, res, id, this.withResultEnvelope({\n content: [{ type: 'text', text: `${message}${detail}` }],\n isError: true,\n }, effectiveVersion));\n return;\n }\n\n // Everything else stays a PROTOCOL error. AUTHENTICATION / AUTHORIZATION in particular: a client\n // opens its OAuth window on an authentication failure, so returning one as a successful result\n // carrying an apology would remove the only signal that drives authorization.\n const isAuthDenial = type === ErrorType.AUTHENTICATION || type === ErrorType.AUTHORIZATION;\n const code = isAuthDenial ? Mcp_JsonRpcErrorCode.UNAUTHENTICATED : Mcp_JsonRpcErrorCode.INTERNAL_ERROR;\n const payload = { jsonrpc: '2.0', id, error: { code, message, data: type ? { type } : undefined } };\n if (this.acceptsEventStream(req)) { this.writeSseMessage(res, payload); return; }\n res.status(200).json(payload);\n }\n\n private asWildoError(error: unknown): WildoError_Backend | undefined {\n return !!error && typeof error === 'object' && 'statusCode' in error && 'type' in error\n ? (error as WildoError_Backend)\n : undefined;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mcp.controller.js","sourceRoot":"","sources":["../../../../../src/mcp/controllers/mcp.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EACL,SAAS,EACT,sBAAsB,EACtB,6BAA6B,EAC7B,wBAAwB,EACxB,kBAAkB,GAGnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gCAAgC,EAAE,MAAM,0FAA0F,CAAC;AAC5I,OAAO,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAC7F,OAAO,EAAE,0BAA0B,EAAE,MAAM,k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;YACrF,CAAC,CAAE,KAA4B;YAC/B,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;CACF,CAAA;AAlqCY,2BAA2B;IADvC,UAAU,EAAE;IAGR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAC9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAC9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,qCAAqC,CAAC,CAAA;IAChE,WAAA,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAA;IACpC,WAAA,MAAM,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAA;IACzC,WAAA,MAAM,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAA;IAClD,WAAA,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;IAC3C,WAAA,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;IAC3C,WAAA,MAAM,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAA;IACvC,YAAA,MAAM,CAAC,kBAAkB,CAAC,+BAA+B,CAAC,CAAA;qCAVhB,aAAa;QACM,0BAA0B;QAC1B,mBAAmB;QAC2B,qCAAqC;QAC/E,uBAAuB;QAChB,4BAA4B;QACb,+BAA+B;QACvC,uBAAuB;QAC9B,uBAAuB;QACxB,YAAY;QACkB,6CAA6C;GAZ1I,2BAA2B,CAkqCvC","sourcesContent":["import 'reflect-metadata';\nimport { inject, injectable } from 'inversify';\nimport type { Request, Response } from 'express';\nimport cors from 'cors';\nimport {\n ErrorType,\n MachineAccessOperation,\n MANUAL_CONTROLLER_ROUTES_URLS,\n ManualControllerRouteKey,\n ResourceServerKind,\n ResourceType,\n WildoError_Backend,\n} from '@wildo-ai/saas-models';\nimport { AbstractControllerBackendService } from '~wildo-backend-lib/base-classes/services/controllers/abstract-controller.backend.service';\nimport { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport { ErrorHandlerService } from '~wildo-backend-lib/errors/services/error-handler.backend.service';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport { AuditLogsBackendService } from '~wildo-backend-lib/compliance/audit-trails/services/audit-logs.backend.service';\nimport { getClientIpFromRequest } from '~wildo-backend-lib/runtime/utils/request-client-ip.utils';\nimport { RedisService } from '~wildo-backend-lib/databases/services/redis.service';\nimport { recordExternalTokenAuthFailure } from '~wildo-backend-lib/security/authentications/services/utils/machine-auth-rate-limit.backend.utils';\nimport {\n MCP_EXTERNAL_CALL_RATE_MAX,\n MCP_EXTERNAL_CALL_RATE_WINDOW_SECONDS,\n assertExternalTurnWithinRate,\n resolvePrincipalRateKey,\n} from '~wildo-backend-lib/security/authentications/services/utils/external-turn-rate-limit.backend.utils';\nimport { ExecutionContextCreatorBackendService } from '~wildo-backend-lib/runtime/services/execution-context-creator.backend.service';\nimport { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport { AppConfigurationService } from '~wildo-backend-lib/config/services/app-configuration.backend.service';\nimport { McpServerBackendService } from '~wildo-backend-lib/mcp/services/mcp-server.backend.service';\nimport {\n McpToolAdapterBackendService,\n mcpReachableScopesForPrincipal,\n mcpPrincipalForAuthenticatedCaller,\n McpCallerPrincipal,\n} from '~wildo-backend-lib/mcp/services/mcp-tool-adapter.backend.service';\nimport { ResourceServerInstancesRegistryBackendService } from '~wildo-backend-lib/mcp/services/resource-server-instances-registry.backend.service';\nimport { MCP_TOOL_NAME_SEPARATOR,\n MCP_UPLOAD_GRANT_TOOL_MARKER,\n} from '~wildo-backend-lib/mcp/models/mcp-tool.backend.schemas';\nimport { OIDC_SUPPORTED_IDENTITY_SCOPES } from '~wildo-backend-lib/security/authentications/services/oidc-user-claims.backend.service';\nimport { isMcpValueWrappedRequestDto, unwrapMcpValueEnvelope } from '~wildo-backend-lib/mcp/utils/zod-to-mcp-json-schema.backend.utils';\nimport {\n MCP_PROTOCOL_VERSION,\n MCP_SUPPORTED_PROTOCOL_VERSIONS,\n MCP_TOOLS_LIST_CACHE_TTL_MS,\n MCP_DISCOVER_CACHE_TTL_MS,\n Mcp_CacheScope,\n isStatelessMcpProtocolVersion,\n decodeMcpHeaderValue,\n MCP_METHODS_REQUIRING_NAME_HEADER,\n MCP_STATELESS_PROTOCOL_VERSION,\n MCP_ASSUMED_PROTOCOL_VERSION_WHEN_HEADER_ABSENT,\n MCP_META_PROTOCOL_VERSION_KEY,\n Mcp_JsonRpcErrorCode,\n Mcp_JsonRpcRequestSchema,\n Mcp_ToolsCallParamsSchema,\n MCP_SERVER_INSTRUCTIONS,\n MCP_TOOL_EXECUTION_ERROR_TYPES,\n} from '~wildo-backend-lib/mcp/models/mcp-protocol.backend.schemas';\nimport type { SocketAuthResult } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\n\n/** A JSON-RPC id is `string | number | null` (absent → treated as null in a response). */\ntype JsonRpcId = string | number | null;\n\n/**\n * Inbound Model Context Protocol (MCP) transport controller — a THIN JSON-RPC 2.0\n * wrapper over {@link McpServerBackendService}, mirroring {@link A2AControllerBackendService}.\n * Exposes a curated set of resource operations as MCP tools to external AI agents:\n *\n * - `GET /.well-known/oauth-protected-resource` — RFC 9728 Protected Resource\n * Metadata (public, CORS-open): advertises this server's `resource` identifier +\n * the `authorization_servers` (the app's own OIDC provider) a client uses to obtain\n * a token.\n * - `POST /mcp` — JSON-RPC 2.0. `initialize` is public; `tools/list` is PROGRESSIVELY principal-aware\n * (a valid Bearer → the caller's catalog, a user-delegated token additionally surfacing USER_SELF\n * tools; an ANONYMOUS caller reaches nothing and is CHALLENGED, which is the 401 every client needs\n * in order to begin authorization); `tools/call` is Bearer-credentialed, RFC 8707\n * audience-bound (validated in\n * {@link ExecutionContextCreatorBackendService.authenticateExternalToken}), and the\n * server re-runs `authorizeInController` BEFORE dispatch (fail-closed, roles-only).\n * - `POST /mcp/:instanceRef` + `GET /mcp/:instanceRef/.well-known/oauth-protected-resource` — the R-2\n * NAMED server instances. Each declared instance is a SEPARATE resource server: its own URL, its own\n * RFC 8707 audience (`…/mcp/<ref>`), its own metadata, and its own curated catalog (membership is\n * EXCLUSIVE — a curated operation LEAVES the default catalog). An unknown ref 404s before\n * parsing/auth and never falls back to the default catalog.\n * - Response mode (Streamable HTTP): a POST result is `application/json` by default, or an SSE stream\n * (`text/event-stream`, a single message event) when the client's `Accept` negotiates it. **JSON wins a\n * tie** — the spec makes clients advertise BOTH, so only an explicit RFC 9110 `q`-value preference for\n * SSE selects it (see {@link MCPControllerBackendService.acceptsEventStream}). `GET /mcp`\n * → 405 (no server-initiated stream — no notifications/sampling yet). Transport-level errors\n * (401 / 429 / 503) are always plain HTTP, never SSE.\n *\n * Auth model (D6): a client-credentials / api-key MACHINE principal. Its token is\n * audience-bound to THE ADDRESSED SURFACE's own resource identifier (`mcpResourceUri(instanceRef)` →\n * `${apiAudience}/mcp` or `${apiAudience}/mcp/<ref>`, advertised in that surface's RFC 9728 metadata) —\n * the generic API audience is NOT accepted here (2026-07-29 flip), so an API token and an MCP token\n * never cross, and a token minted for one instance is rejected at another.\n * A user-delegated caller (an `authorization_code` token bound to this endpoint) additionally reaches\n * their USER_SELF tools — see the progressive principal-aware `tools/list` + the `callTool` gate.\n *\n * Curation is NOT authorization. `mcp.exposed` / `mcp.servers` decide which operations are shaped as\n * tools and which surface advertises them; every `tools/call` still re-runs the operation's own role\n * authorization, so exposure can only ever be a SUBSET of what the caller's roles already permit.\n *\n * NOTE: `setupRoutes()` runs inside the `super()` constructor before this subclass's\n * field initializers, so it only BINDS handlers — the injected services are read at\n * REQUEST time. Standard manual-controller pattern.\n */\n@injectable()\nexport class MCPControllerBackendService extends AbstractControllerBackendService {\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService) errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.ErrorHandlerService) errorHandler: ErrorHandlerService,\n @inject(SAAS_SERVICE_TYPES.ExecutionContextCreatorBackendService) private readonly executionContextCreator: ExecutionContextCreatorBackendService,\n @inject(SAAS_SERVICE_TYPES.McpServer) private readonly mcpServer: McpServerBackendService,\n @inject(SAAS_SERVICE_TYPES.McpToolAdapter) private readonly toolAdapter: McpToolAdapterBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService) private readonly resourcesRegistry: ResourcesRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.AppConfigService) private readonly appConfigService: AppConfigurationService,\n @inject(SAAS_SERVICE_TYPES.AuditLogsService) private readonly auditLogs: AuditLogsBackendService,\n @inject(SAAS_SERVICE_TYPES.RedisService) private readonly redisService: RedisService,\n @inject(SAAS_SERVICE_TYPES.ResourceServerInstancesRegistry) private readonly resourceServerInstances: ResourceServerInstancesRegistryBackendService,\n ) {\n super(logger, errorBuilder, errorHandler, 'MCPController');\n }\n\n protected setupRoutes(): void {\n // RFC 9728 metadata is PUBLIC, non-credentialed discovery an MCP client fetches\n // cross-origin to learn where to get a token — CORS-open GET, like the OIDC\n // discovery doc. The JSON-RPC endpoint stays under the restrictive global CORS.\n const publicMetadataCors = cors({ origin: '*', methods: ['GET'], credentials: false });\n\n const metadataUrl = MANUAL_CONTROLLER_ROUTES_URLS[ManualControllerRouteKey.MCP_PROTECTED_RESOURCE_METADATA];\n this.router.get(metadataUrl, publicMetadataCors, this.asyncHandler(this.handleProtectedResourceMetadata.bind(this)));\n this.logRouteRegistration('GET', metadataUrl, 'MCP protected-resource metadata (RFC 9728, public)');\n\n const mcpUrl = MANUAL_CONTROLLER_ROUTES_URLS[ManualControllerRouteKey.MCP_ENDPOINT];\n this.router.post(mcpUrl, this.asyncHandler(this.handleJsonRpc.bind(this)));\n this.logRouteRegistration('POST', mcpUrl, 'MCP JSON-RPC endpoint (initialize, tools/list, tools/call; SSE or JSON per Accept)');\n\n // GET /mcp — the Streamable-HTTP server-initiated SSE stream. This server has no server-initiated\n // messages (no notifications / sampling), so respond 405 + `Allow: POST` — the spec-sanctioned\n // answer when a server offers no GET stream. Explicit 405 (not an unhandled 404) so clients probe\n // cleanly and fall back to the POST response-mode SSE.\n this.router.get(mcpUrl, (_req: Request, res: Response) => {\n res.set('Allow', 'POST').status(405).json({\n jsonrpc: '2.0', id: null,\n error: { code: Mcp_JsonRpcErrorCode.METHOD_NOT_FOUND, message: 'the MCP endpoint offers no server-initiated SSE stream; use POST' },\n });\n });\n this.logRouteRegistration('GET', mcpUrl, 'MCP endpoint GET → 405 (no server-initiated SSE stream)');\n\n // DELETE /mcp — the session-termination verb of the `2025-03-26`…`2025-11-25` transport, which\n // `2026-07-28` removed along with protocol-level sessions. We never implemented sessions, so\n // there is nothing to terminate; the spec names the answer for a server in exactly this position:\n //\n // \"HTTP GET or DELETE to the MCP endpoint: respond with `405 Method Not Allowed`.\"\n // spec-cite: MCP 2026-07-28 — Streamable HTTP § Earlier Streamable HTTP Revisions\n //\n // Registered EXPLICITLY rather than left to a framework 404, for the same reason as the GET: an\n // older client that sent DELETE would read a bare 404 as \"this server has no MCP endpoint\" and\n // fall back to the deprecated HTTP+SSE transport, against a server that speaks Streamable HTTP.\n this.router.delete(mcpUrl, (_req: Request, res: Response) => {\n res.set('Allow', 'POST').status(405).json({\n jsonrpc: '2.0', id: null,\n error: { code: Mcp_JsonRpcErrorCode.METHOD_NOT_FOUND, message: 'the MCP endpoint has no sessions to terminate; use POST' },\n });\n });\n this.logRouteRegistration('DELETE', mcpUrl, 'MCP endpoint DELETE → 405 (no protocol-level sessions)');\n\n // ── R-2: NAMED MCP server instances (`/mcp/:instanceRef`) ────────────────────\n // Each declared instance is a SEPARATE resource server: its own URL, its own RFC 8707 audience\n // (`…/mcp/<ref>`), its own PRM, and its own curated tool catalog. Routes are registered\n // unconditionally (not gated on `hasInstances`) because the registry is populated during startup\n // AFTER `setupRoutes` runs inside `super()` — an unknown ref is rejected at REQUEST time by\n // `resolveInstanceRef` (404), which is the same fail-closed answer with no ordering hazard.\n // More-specific paths first: the metadata route has more segments than `/mcp/:instanceRef`, so\n // Express matches it exactly and it can never be swallowed by the instance route.\n const instanceMetadataUrl = `${mcpUrl}/:instanceRef${MANUAL_CONTROLLER_ROUTES_URLS[ManualControllerRouteKey.MCP_PROTECTED_RESOURCE_METADATA]}`;\n this.router.get(instanceMetadataUrl, publicMetadataCors, this.asyncHandler(this.handleProtectedResourceMetadata.bind(this)));\n this.logRouteRegistration('GET', instanceMetadataUrl, 'Per-instance MCP protected-resource metadata (RFC 9728, public)');\n\n const instanceUrl = `${mcpUrl}/:instanceRef`;\n this.router.post(instanceUrl, this.asyncHandler(this.handleJsonRpc.bind(this)));\n this.logRouteRegistration('POST', instanceUrl, 'Named MCP server instance (JSON-RPC; own audience + curated catalog)');\n\n this.router.get(instanceUrl, (_req: Request, res: Response) => {\n res.set('Allow', 'POST').status(405).json({\n jsonrpc: '2.0', id: null,\n error: { code: Mcp_JsonRpcErrorCode.METHOD_NOT_FOUND, message: 'the MCP endpoint offers no server-initiated SSE stream; use POST' },\n });\n });\n this.logRouteRegistration('GET', instanceUrl, 'Named MCP server instance GET → 405 (no server-initiated SSE stream)');\n\n // A named instance IS an MCP endpoint, so it owes the same answer as the default one. Registered\n // separately because Express matches `/mcp` and `/mcp/:instanceRef` as distinct routes — the base\n // DELETE handler does NOT cover the instance path, and without this an older client that sends\n // the retired session-termination verb to `/mcp/support` reads the framework 404 as \"no MCP\n // endpoint here\" and falls back to the deprecated HTTP+SSE transport.\n //\n // Found by probing the running server, not by a test: the base-endpoint pin passed while every\n // named instance answered 404. One verb, two routes — the recurring one-of-N shape.\n this.router.delete(instanceUrl, (_req: Request, res: Response) => {\n res.set('Allow', 'POST').status(405).json({\n jsonrpc: '2.0', id: null,\n error: { code: Mcp_JsonRpcErrorCode.METHOD_NOT_FOUND, message: 'the MCP endpoint has no sessions to terminate; use POST' },\n });\n });\n this.logRouteRegistration('DELETE', instanceUrl, 'Named MCP server instance DELETE → 405 (no protocol-level sessions)');\n }\n\n /**\n * Resolve the NAMED server instance addressed by this request, or the DEFAULT server.\n *\n * - No `:instanceRef` path param ⇒ `{ instanceRef: undefined }` — the default `/mcp` surface.\n * - A param naming a DECLARED instance ⇒ that ref (drives the audience + the catalog filter).\n * - A param naming an UNDECLARED instance ⇒ `undefined` (the caller 404s). Fail-closed: an\n * unknown ref must never silently fall back to the default catalog, which would hand a caller\n * tools the (non-existent) server was never meant to expose.\n */\n private resolveInstanceRef(req: Request): { instanceRef?: string } | undefined {\n const requested = (req.params as Record<string, string | undefined>)?.instanceRef;\n if (!requested) return { instanceRef: undefined };\n const instance = this.resourceServerInstances.tryGetInstance(ResourceServerKind.MCP, requested);\n return instance ? { instanceRef: instance.ref } : undefined;\n }\n\n /**\n * `GET /.well-known/oauth-protected-resource` (default server) and\n * `GET /mcp/:instanceRef/.well-known/oauth-protected-resource` (a named instance) — RFC 9728 metadata.\n *\n * Each instance advertises its OWN `resource` (its canonical audience), which is exactly the `aud` a\n * token must carry to be accepted there — so a client that discovers an instance and follows its\n * metadata obtains a token scoped to that instance and nothing else.\n */\n private async handleProtectedResourceMetadata(req: Request, res: Response): Promise<void> {\n const resolved = this.resolveInstanceRef(req);\n if (!resolved) {\n res.status(404).json({ error: 'not_found', error_description: 'no such MCP server instance' });\n return;\n }\n const apiAudience = this.appConfigService.resolveApiResourceAudience();\n const mcpResource = this.mcpResourceUri(resolved.instanceRef);\n if (!apiAudience || !mcpResource) {\n res.status(503).json({ error: 'temporarily_unavailable', error_description: 'resource audience is not resolvable (app public URL unset)' });\n return;\n }\n res.set('Cache-Control', 'public, max-age=3600');\n res.status(200).json({\n // This MCP resource server's canonical URI (the `aud` an audience-bound token must carry).\n resource: mcpResource,\n // The app's own OIDC provider (issuer == the API audience base).\n authorization_servers: [apiAudience],\n bearer_methods_supported: ['header'],\n /**\n * The OIDC identity scopes a delegated client should request — NOT authorization scopes.\n *\n * Wildo's authorization is roles-only, so this document once advertised `[]`, which was\n * TRUTHFUL and turned out to be unusable. A real client (Cursor, 2026-08-11) read the empty set,\n * concluded there was nothing to authorize, reported \"successfully authenticated\" and **never\n * opened a browser** — so no token was ever obtained and every `tools/call` stayed 401. The\n * scope-selection strategy tells a client to take the challenge's `scope` and otherwise fall\n * back to this field; supplying neither leaves it with no way to start an authorization request.\n *\n * These are the scopes a dynamically registered client is actually granted\n * (`/oauth/register` confines to exactly this set), so advertising them describes what a client\n * will really receive rather than inventing a vocabulary. They remain IDENTITY scopes: nothing\n * here grants access to a tool, which roles alone still decide.\n *\n * spec-cite: MCP 2026-07-28 — Authorization § Scope Selection Strategy.\n */\n scopes_supported: [...OIDC_SUPPORTED_IDENTITY_SCOPES],\n });\n }\n\n /**\n * Pick the protocol revision to answer `initialize` with.\n *\n * Returns the CLIENT's requested revision when this server serves it, else this server's own\n * newest — exactly the two-branch rule in Lifecycle § Version Negotiation. A malformed or absent\n * `params.protocolVersion` falls to our newest, which is also what a client that sent nothing\n * parseable can most reasonably be given.\n */\n private negotiateProtocolVersion(params: unknown, declaredVersion?: string): string {\n const requested = (params as { protocolVersion?: unknown } | undefined)?.protocolVersion;\n if (typeof requested === 'string' && MCP_SUPPORTED_PROTOCOL_VERSIONS.includes(requested)) return requested;\n // Fall back to what the REQUEST resolved to (header / `_meta`) before falling back to our\n // newest: a client that declared its revision on the transport but omitted it from the\n // `initialize` body has still told us what it speaks, and answering our newest instead would\n // hand it a version it may not support — whose own rule is to disconnect.\n if (declaredVersion && MCP_SUPPORTED_PROTOCOL_VERSIONS.includes(declaredVersion)) return declaredVersion;\n return MCP_PROTOCOL_VERSION;\n }\n\n /**\n * Validate the mirrored request-metadata headers against the body. Returns a reason, or\n * `undefined` when everything agrees.\n *\n * The hazard being closed is a SPLIT BRAIN, not sloppiness: \"This prevents potential security\n * vulnerabilities when different components in the network rely on different sources of truth\n * (e.g., a load balancer routing on the header value while the MCP server executes based on the\n * body value).\"\n * spec-cite: MCP 2026-07-28 — Streamable HTTP § Server Validation\n *\n * A MISSING required header is a validation failure too, not a tolerated omission — the spec lists\n * \"a required standard header … is missing\" first among its failure conditions. Tolerating it\n * would leave an intermediary routing on a header this server never checked.\n */\n private findRequestMetadataHeaderMismatch(req: Request, method: string, params: unknown): string | undefined {\n const headerVersion = req.headers['mcp-protocol-version'];\n if (typeof headerVersion !== 'string') {\n return 'MCP-Protocol-Version header is required';\n }\n const metaVersion = (params as { _meta?: Record<string, unknown> } | undefined)?._meta?.[MCP_META_PROTOCOL_VERSION_KEY];\n if (typeof metaVersion === 'string' && metaVersion !== headerVersion) {\n return `MCP-Protocol-Version header value '${headerVersion}' does not match body value '${metaVersion}'`;\n }\n\n const headerMethod = req.headers['mcp-method'];\n if (typeof headerMethod !== 'string') return 'Mcp-Method header is required';\n if (headerMethod !== method) {\n return `Mcp-Method header value '${headerMethod}' does not match body value '${method}'`;\n }\n\n if (!MCP_METHODS_REQUIRING_NAME_HEADER.includes(method)) return undefined;\n\n const headerName = req.headers['mcp-name'];\n if (typeof headerName !== 'string') return 'Mcp-Name header is required';\n const p = (params ?? {}) as { name?: unknown; uri?: unknown };\n const bodyName = typeof p.name === 'string' ? p.name : (typeof p.uri === 'string' ? p.uri : undefined);\n // A body with NO target used to pass this gate, because the comparison carried a\n // `bodyName !== undefined &&` guard and was therefore skipped when there was nothing to compare\n // against. The header exists so a proxy can route without parsing the body, and this is exactly\n // the case where it asserts a routing target the body does not support.\n //\n // **Dropping that guard is what makes this correct** — the comparison below then rejects\n // `'todos__list' !== undefined` on its own. This early return exists only for the MESSAGE:\n // \"does not match body value 'undefined'\" describes a mismatch, when the real fault is that\n // there is nothing to match. Proven by mutation: removing only this block changes nothing;\n // restoring the guard as well is what reddens the pin.\n if (bodyName === undefined) {\n return `Mcp-Name header names '${decodeMcpHeaderValue(headerName)}' but the request body carries no target`;\n }\n // Decoded BEFORE comparison — a client MUST use the Base64 sentinel for any value that is not\n // header-safe, so comparing raw would reject exactly the names the encoding exists to carry.\n if (decodeMcpHeaderValue(headerName) !== bodyName) {\n return `Mcp-Name header value '${headerName}' does not match body value '${bodyName}'`;\n }\n return undefined;\n }\n\n /**\n * The protocol revision THIS request is written against.\n *\n * `_meta` wins over the header because a stateless request carries its revision in the body and a\n * proxy cannot rewrite it there; the header is the transport mirror of the same value. When\n * neither is present the request predates both mechanisms, so it gets the handshake default the\n * specification assigns rather than our newest — answering our newest to a client that said\n * nothing is how a `2025-03-26` client gets told it is speaking something it may not support.\n */\n private resolveDeclaredProtocolVersion(req: Request): string | undefined {\n const meta = (req.body as { params?: { _meta?: Record<string, unknown> } } | undefined)?.params?._meta;\n const declared = meta?.[MCP_META_PROTOCOL_VERSION_KEY];\n if (typeof declared === 'string' && MCP_SUPPORTED_PROTOCOL_VERSIONS.includes(declared)) return declared;\n\n const header = req.headers['mcp-protocol-version'];\n if (typeof header === 'string' && MCP_SUPPORTED_PROTOCOL_VERSIONS.includes(header)) return header;\n\n return undefined;\n }\n\n /**\n * The revision whose RULES this request is held to.\n *\n * Distinct from {@link resolveDeclaredProtocolVersion} on purpose, and the distinction is\n * load-bearing. When a client declares nothing the specification tells us how to READ the request\n * — assume `2025-03-26` — but that assumption must never become what we ADVERTISE back: a client\n * that said nothing has requested nothing, and `initialize` must then answer this server's newest,\n * not the floor we read it at.\n *\n * Collapsing the two (returning the assumed default from one helper and feeding it into\n * negotiation) silently downgraded every handshake client to `2025-03-26`. Two existing pins\n * caught it immediately, which is the argument for keeping them narrow enough to fail loudly.\n */\n private resolveEffectiveProtocolVersion(req: Request): string {\n return this.resolveDeclaredProtocolVersion(req) ?? MCP_ASSUMED_PROTOCOL_VERSION_WHEN_HEADER_ABSENT;\n }\n\n /**\n * `POST /mcp` — JSON-RPC 2.0 dispatch. Application-level failures are returned as\n * JSON-RPC error envelopes (HTTP 200) per the protocol; a missing/invalid Bearer on\n * `tools/call` returns HTTP 401 + `WWW-Authenticate` pointing at the RFC 9728 metadata\n * (the OAuth resource-server challenge). A malformed envelope yields a null-id error.\n */\n private async handleJsonRpc(req: Request, res: Response): Promise<void> {\n // R-2: which server instance is being addressed (default `/mcp`, or a declared `/mcp/<ref>`).\n // An unknown ref 404s BEFORE any parsing/auth — it is not a server, so it has no JSON-RPC surface.\n const resolved = this.resolveInstanceRef(req);\n if (!resolved) {\n res.status(404).json({ error: 'not_found', error_description: 'no such MCP server instance' });\n return;\n }\n const instanceRef = resolved.instanceRef;\n\n // ── Origin: refuse ANY browser-originated call ───────────────────────────────────────────\n //\n // \"Servers MUST validate the `Origin` header on all incoming connections to prevent DNS\n // rebinding attacks\"\n // spec-cite: MCP 2025-06-18 — Transports § Streamable HTTP → Security Warning\n //\n // The policy is a FLAT REFUSAL of any request carrying an `Origin`, not an allow-list, because\n // this endpoint has no legitimate browser caller: it is machine-to-machine and authenticated by\n // a Bearer machine token, so a page able to call it would have had to keep that token somewhere\n // browser-reachable — which is a credential leak whether or not the origin is recognised.\n //\n // An ABSENT `Origin` is allowed, and that is the whole reason this is safe to ship: browsers\n // attach `Origin` to every cross-origin request, while the MCP clients that actually use this\n // surface (desktop hosts, CLIs, agent runtimes) are not browsers and send none. An allow-list\n // keyed on configured frontend URLs would have been the obvious move and is worse twice over —\n // it invents a second origin authority beside the WebSocket service's, and it implies a browser\n // MCP client is a supported shape when it is a misconfiguration.\n //\n // Defence in depth rather than the primary control: a rebinding page cannot set `Authorization`\n // cross-origin without a preflight this endpoint does not answer permissively, so it never got\n // past the auth gate either. Both are cheap; the one that fails closed on its own is kept.\n const requestOrigin = req.headers.origin;\n if (typeof requestOrigin === 'string' && requestOrigin.length > 0) {\n this.logger.warn('[MCP] Refused a browser-originated JSON-RPC call', { origin: requestOrigin, instanceRef });\n res.status(403).json({\n error: 'origin_not_allowed',\n error_description: 'the MCP endpoint does not accept browser-originated requests',\n });\n return;\n }\n\n // ── MCP-Protocol-Version header ──────────────────────────────────────────────────────────\n //\n // \"If the server receives a request with an invalid or unsupported `MCP-Protocol-Version`, it\n // MUST respond with `400 Bad Request`.\"\n // spec-cite: MCP 2025-06-18 — Transports § Protocol Version Header\n //\n // ABSENT is not invalid — the spec assigns a default rather than requiring the header on the\n // first exchange, and demanding it would break the `initialize` request itself, which is sent\n // before any version has been negotiated to put in it.\n const declaredVersion = req.headers['mcp-protocol-version'];\n if (typeof declaredVersion === 'string' && !MCP_SUPPORTED_PROTOCOL_VERSIONS.includes(declaredVersion)) {\n // A JSON-RPC error body, NOT a plain one — and the shape is what makes it useful.\n //\n // A client that supports both eras probes with a modern request and decides from the RESPONSE\n // BODY whether to fall back: \"If the body contains a recognized modern JSON-RPC error, the\n // server speaks a modern version of MCP — retry using the advertised `supported` versions or\n // correct the request, rather than falling back.\"\n // spec-cite: MCP 2026-07-28 — Streamable HTTP § Backward Compatibility\n //\n // A plain `{error: '…'}` body is NOT a recognized JSON-RPC error, so it would send exactly\n // that client down the legacy HTTP+SSE path — against a server that speaks the modern one.\n // The earlier comment here reasoned that a JSON-RPC body \"would imply the message was\n // processed\"; that is true of application errors and wrong here, because the spec makes this\n // response the fallback DISCRIMINATOR.\n res.status(400).json({\n jsonrpc: '2.0',\n id: null,\n error: {\n code: Mcp_JsonRpcErrorCode.UNSUPPORTED_PROTOCOL_VERSION,\n message: `MCP-Protocol-Version '${declaredVersion}' is not supported`,\n data: { supported: MCP_SUPPORTED_PROTOCOL_VERSIONS },\n },\n });\n return;\n }\n\n // ── The effective revision for THIS request ──────────────────────────────────────────────\n //\n // From `2026-07-28` MCP is stateless: the revision travels per request rather than being agreed\n // once by a handshake. Three sources, most specific first — the `_meta` key (stateless\n // revisions), then the transport header, then the handshake default for everything older.\n //\n // \"Every request declares the protocol version it is using via the\n // `io.modelcontextprotocol/protocolVersion` key in its `_meta` field […] On Streamable HTTP,\n // the same value is also carried in the `MCP-Protocol-Version` header.\"\n // spec-cite: MCP — Versioning § Negotiation\n //\n // Resolved BEFORE dispatch because the revision decides which RULES apply, and the obligations\n // that arrived with `2026-07-28` (required `Mcp-Method`/`Mcp-Name`, the `resultType` envelope)\n // must never be applied to a request written against an earlier one. Serving several revisions\n // at once is explicitly sanctioned — \"Clients and servers MAY support multiple protocol versions\n // simultaneously\" — and is what makes this migration additive rather than breaking.\n // The revision whose RULES this request is held to. Not consumed yet: the obligations that read\n // it — required `Mcp-Method`/`Mcp-Name`, the `resultType` envelope, `ttlMs`/`cacheScope` — arrive\n // in migration steps M3/M4. Resolved here rather than at each future site because the whole point\n // of the seam is that ONE decision governs which rules apply; deriving it separately per\n // obligation is how three of four sites end up disagreeing.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const effectiveVersion = this.resolveEffectiveProtocolVersion(req);\n // What the client actually DECLARED, or undefined. Deliberately separate — see the resolver's\n // JSDoc: feeding the assumed default into negotiation downgraded every handshake client.\n const declaredVersionForNegotiation = this.resolveDeclaredProtocolVersion(req);\n\n const parsed = Mcp_JsonRpcRequestSchema.safeParse(req.body);\n if (!parsed.success) {\n this.sendRpcError(req, res, null, Mcp_JsonRpcErrorCode.INVALID_REQUEST, 'malformed JSON-RPC 2.0 request');\n return;\n }\n const { id, method, params } = parsed.data;\n const rpcId: JsonRpcId = id ?? null;\n\n // ── Request-metadata headers — `2026-07-28` ONLY ─────────────────────────────────────────\n //\n // This is HAZARD 1 in code. `Mcp-Method` is \"Required For: All requests\" and `Mcp-Name` for\n // `tools/call` / `resources/read` / `prompts/get`; a `2025-06-18` client sends NEITHER, so\n // validating unconditionally would reject every existing client on its first request.\n // spec-cite: MCP 2026-07-28 — Streamable HTTP § Standard Request Headers\n //\n // The rule is gated on what the request DECLARED, which is why the declared/effective split\n // matters: a request that never claimed `2026-07-28` is never held to it.\n if (isStatelessMcpProtocolVersion(declaredVersionForNegotiation)) {\n const mismatch = this.findRequestMetadataHeaderMismatch(req, method, params);\n if (mismatch) {\n // 400 + `-32020`, both mandated. The status is what a legacy-probing client keys on to tell\n // a modern server from an old one, and the JSON-RPC body is what stops it falling back.\n this.sendRpcError(req, res, rpcId, Mcp_JsonRpcErrorCode.HEADER_MISMATCH, mismatch, 400);\n return;\n }\n }\n\n // ── JSON-RPC NOTIFICATIONS: acknowledge, never answer ────────────────────────────────────\n //\n // A notification is a message with NO `id`. Streamable HTTP is explicit about the reply:\n //\n // \"If the input is a JSON-RPC response or notification: If the server accepts the input, the\n // server MUST return HTTP status code 202 Accepted with no body.\"\n // spec-cite: MCP 2025-06-18 — Transports § Streamable HTTP → Sending Messages to the Server, item 4\n //\n // This matters far beyond tidiness, because EVERY conformant client sends one immediately after\n // `initialize`:\n //\n // \"After successful initialization, the client MUST send an `initialized` notification to\n // indicate it is ready to begin normal operations\" — `{\"jsonrpc\":\"2.0\",\"method\":\"notifications/initialized\"}`\n // spec-cite: MCP 2025-06-18 — Lifecycle § Initialization\n //\n // Before this, that notification fell through to the `default` arm and was answered with a\n // METHOD_NOT_FOUND error envelope — the server telling every client, on every connection, that\n // the one message the specification obliges it to send is unsupported. Clients that surface or\n // fail on an initialization error would never have reached `tools/list`.\n //\n // Acknowledged rather than routed: this server negotiates `tools` only, so no notification it\n // can legally receive changes any state. An UNKNOWN notification is also accepted (202) rather\n // than refused, because refusing is reserved for input the server \"cannot accept\", and a\n // notification it does not recognise is one it can safely ignore — the sender is not waiting on\n // an answer either way, so an error response would be a reply nobody reads to a message that\n // caused no harm.\n if (id === undefined) {\n res.status(202).end();\n return;\n }\n\n switch (method) {\n case 'initialize':\n this.sendRpcResult(req, res, rpcId, {\n // Negotiated, not asserted:\n // \"If the server supports the requested protocol version, it MUST respond with the same\n // version. Otherwise, the server MUST respond with another protocol version it supports.\"\n // spec-cite: MCP 2025-06-18 — Lifecycle § Version Negotiation\n //\n // This previously answered `MCP_PROTOCOL_VERSION` unconditionally, which silently told a\n // 2025-03-26 client it was talking 2025-06-18. The client's own rule on that is to\n // disconnect if it does not support the version it is handed, so an unconditional answer\n // converts a working pairing into a dropped connection.\n protocolVersion: this.negotiateProtocolVersion(params, declaredVersionForNegotiation),\n capabilities: { tools: { listChanged: false } },\n serverInfo: { name: 'wildo-mcp', version: '1.0.0' },\n });\n return;\n case 'server/discover':\n // \"`server/discover` lets a client query a server's supported protocol versions,\n // capabilities, and identity before sending any other requests. Servers **MUST**\n // implement it.\"\n // spec-cite: MCP 2026-07-28 — Discovery\n //\n // Answered for EVERY revision, not gated on `2026-07-28`. It costs an older client nothing\n // (it will never call it) and gating it would mean a stateless client probing a server that\n // also serves older revisions gets METHOD_NOT_FOUND — the same first-exchange failure the\n // `notifications/initialized` defect caused, arriving through the newer door.\n //\n // ── UNAUTHENTICATED, and that is a DECISION rather than an omission ──────────────────\n //\n // Three reasons, in order of weight:\n //\n // 1. It discloses nothing a caller cannot already learn. The response carries supported\n // revisions, a capability SHAPE (`tools`) and a self-reported name — no tool names, no\n // descriptions, no tenant data. The RFC 9728 protected-resource metadata beside it is\n // deliberately public and already reveals that this endpoint exists and which\n // authorization server guards it.\n // 2. Requiring a token would invert the order of operations. A conforming `2026-07-28`\n // request must carry `MCP-Protocol-Version`, so a client has to learn which revisions\n // this server speaks BEFORE it can construct one — and it obtains its token from an\n // authorization server it discovers through the public metadata. Gating discovery behind\n // the credential you need discovery to acquire is a loop.\n // 3. It is the documented backward-compatibility probe. A client that cannot call it\n // unauthenticated falls back to the deprecated transport against a server that speaks\n // the modern one.\n //\n // What this does NOT license: `tools/list` CHALLENGES an anonymous caller (its catalogue is\n // empty) and `tools/call` still authenticates fail-closed. Discovery being open is not a\n // precedent for the catalogue or the invocation being open.\n this.sendRpcResult(req, res, rpcId, this.withResultEnvelope({\n supportedVersions: MCP_SUPPORTED_PROTOCOL_VERSIONS,\n // TOOLS ONLY — a deliberate, recorded position, not an omission. Advertising a capability\n // we do not serve would have a client probe `resources/list` and get METHOD_NOT_FOUND.\n capabilities: { tools: {} },\n // \"Optional natural-language guidance for LLMs on how to use this server effectively.\"\n // spec-cite: MCP 2026-07-28 — Discovery § Data Types → DiscoverResult\n //\n // Carries the CONVENTIONS no single tool schema can express — the naming pattern, that\n // scope rides the credential rather than the arguments, the collection envelope, and that\n // the annotations are worth reading before a retry. Each was previously learnable only by\n // making a call and reading the failure.\n instructions: MCP_SERVER_INSTRUCTIONS,\n _meta: { 'io.modelcontextprotocol/serverInfo': { name: 'wildo-mcp', version: '1.0.0' } },\n // PUBLIC: supported revisions, capability shape and server identity are identical for every\n // caller, so a shared cache serving one client's answer to another discloses nothing.\n // The envelope is applied UNCONDITIONALLY here, unlike everywhere else.\n //\n // `server/discover` exists only from `2026-07-28` — a client that calls it is a\n // stateless-era client by definition, whatever it did or did not put in `_meta`. Gating on\n // the declared revision would hand exactly that client a hint-less result when it omitted\n // the key, and the caching rule names this method specifically as one whose result MUST\n // carry hints. So the method itself is the declaration.\n }, MCP_STATELESS_PROTOCOL_VERSION, { ttlMs: MCP_DISCOVER_CACHE_TTL_MS, cacheScope: Mcp_CacheScope.PUBLIC }));\n return;\n case 'tools/list':\n await this.handleToolsList(req, res, rpcId, params, instanceRef, effectiveVersion);\n return;\n case 'tools/call':\n await this.handleToolsCall(req, res, rpcId, params, instanceRef, effectiveVersion);\n return;\n default:\n // \"If the server does not implement the requested RPC method, it MUST respond with\n // `404 Not Found` and a JSON-RPC error with code `-32601`.\"\n // spec-cite: MCP 2026-07-28 — Streamable HTTP § Protocol Version Header\n //\n // 404 ONLY for a request that declared the stateless revision. Older revisions carry a\n // METHOD_NOT_FOUND on HTTP 200 per plain JSON-RPC, and changing that under them would break\n // clients that key on the status — the same per-revision discipline as the metadata headers.\n this.sendRpcError(\n req, res, rpcId, Mcp_JsonRpcErrorCode.METHOD_NOT_FOUND, `method '${method}' is not supported`,\n isStatelessMcpProtocolVersion(declaredVersionForNegotiation) ? 404 : 200,\n );\n }\n }\n\n /**\n * `tools/list` — PROGRESSIVE principal-awareness across THREE principals.\n *\n * A caller presenting a VALID Bearer bound to THIS MCP endpoint gets the catalog for its principal —\n * a user-delegated token additionally surfaces its USER_SELF tools. An ANONYMOUS caller reaches\n * nothing, and an empty anonymous catalogue is CHALLENGED rather than returned as an empty page. An\n * INVALID/expired Bearer is answered `invalid_token`, not silently downgraded.\n *\n * Both of those were the opposite until 2026-08-11, and the reversal is the point: an anonymous\n * caller was classified as a MACHINE principal and handed ORG/APP tools it could not invoke, so the\n * 401 that clients gate their login window on never fired. A real client reported \"successfully\n * authenticated\" having never opened a browser.\n */\n private async handleToolsList(req: Request, res: Response, id: JsonRpcId, params: unknown, instanceRef?: string, effectiveVersion = MCP_PROTOCOL_VERSION): Promise<void> {\n // ── Pagination cursor ─────────────────────────────────────────────────────────────────────\n //\n // This server does not paginate `tools/list`: the catalogue is small and bounded by the app's\n // own `mcp.exposed` declarations, so every call returns the complete set and NEVER emits a\n // `nextCursor`. That is allowed — pagination is a server capability, and a client \"SHOULD treat\n // a missing `nextCursor` as the end of results\".\n //\n // But it makes every cursor we RECEIVE invalid by construction: a cursor is opaque and can only\n // have come from a `nextCursor` we issued, and we issue none. Silently ignoring it and returning\n // the full page again is the dangerous answer — a client resuming from a stale cursor would be\n // handed the whole catalogue as though it were the next page, and one that kept paging would\n // loop forever on a `nextCursor` that never arrives.\n //\n // \"Invalid cursors SHOULD result in an error with code -32602 (Invalid params).\"\n // spec-cite: MCP 2026-07-28 — Pagination § Error Handling\n //\n // Presence is what makes it invalid, not the value: \"an empty string is a valid cursor and thus\n // MUST NOT be treated as the end of results\", so `cursor: ''` is a real cursor and is refused\n // like any other. Only an ABSENT cursor is a first-page request.\n const requestedCursor = (params as { cursor?: unknown } | undefined)?.cursor;\n if (requestedCursor !== undefined && requestedCursor !== null) {\n this.sendRpcError(req, res, id, Mcp_JsonRpcErrorCode.INVALID_PARAMS, 'tools/list does not paginate; this server never issues a nextCursor, so the supplied cursor is not one it can resume from');\n return;\n }\n\n const token = this.extractBearerToken(req);\n // The Bearer is validated against THIS instance's audience — a token minted for another instance\n // does not upgrade the catalog here.\n const mcpResource = this.mcpResourceUri(instanceRef);\n const apiAudience = this.appConfigService.resolveApiResourceAudience();\n let principal = McpCallerPrincipal.ANONYMOUS;\n if (token && mcpResource) {\n try {\n const auth = await this.executionContextCreator.authenticateExternalToken(token, mcpResource);\n // A user-delegated (`authorization_code`) token carries a `userId`; a machine token does not.\n principal = auth.initiatorIds?.userId ? McpCallerPrincipal.USER_DELEGATED : McpCallerPrincipal.MACHINE;\n } catch {\n // A PRESENTED-but-bad credential is answered, not ignored. Until 2026-08-11 this degraded\n // silently to the public catalogue, which hid an expiry from the one caller able to fix it:\n // the client saw a plausible list, called a tool, and only then learned its token was dead.\n // `invalid_token` tells it to REFRESH rather than restart authorization.\n if (!apiAudience) {\n this.sendRpcError(req, res, id, Mcp_JsonRpcErrorCode.INTERNAL_ERROR, 'resource audience is not resolvable');\n return;\n }\n this.sendUnauthenticated(req, res, id, apiAudience, instanceRef, 'the access token is invalid, expired, or not audience-bound', 'invalid_token');\n return;\n }\n }\n\n const reachableScopes = mcpReachableScopesForPrincipal(principal);\n const tools = this.mcpServer.listTools({ reachableScopes, instanceRef });\n\n /**\n * An anonymous caller with nothing to list is CHALLENGED rather than handed an empty page.\n *\n * This is the rung a client's whole authorization flow hangs from. Clients open the login window\n * on a 401 during connect — and a reconnect is `initialize` + `tools/list`. Answering 200 there\n * means the session comes up \"working\", so authorization is never attempted and every later\n * `tools/call` fails 401 forever. Cursor demonstrated exactly this on 2026-08-11: clicking\n * Authenticate reported success without ever opening a browser.\n *\n * Scoped deliberately narrow — it fires ONLY when no credentials were presented AND the catalogue\n * is empty:\n * - a caller that presented a token gets its (possibly empty) catalogue, never a challenge:\n * \"This set MAY be empty\" is a legitimate answer to an authenticated principal, and\n * challenging one that already authenticated would loop it.\n * - an app whose anonymous catalogue is NON-empty stays public and is never challenged, so a\n * genuinely public MCP server remains expressible the day an anonymous dispatch path exists.\n *\n * spec-cite: MCP 2026-07-28 — Server Features § Tools (the tool set \"MAY be empty\" and \"MAY vary\n * by the authorization presented on the request\").\n */\n if (principal === McpCallerPrincipal.ANONYMOUS && tools.length === 0) {\n if (!apiAudience) {\n this.sendRpcError(req, res, id, Mcp_JsonRpcErrorCode.INTERNAL_ERROR, 'resource audience is not resolvable');\n return;\n }\n this.sendUnauthenticated(req, res, id, apiAudience, instanceRef, 'a Bearer access token is required to list this server\\'s tools');\n return;\n }\n // Strip the internal fields the descriptor carries for re-resolution before serialising.\n this.sendRpcResult(req, res, id, this.withResultEnvelope({\n // Sorted by name. \"Servers SHOULD return tools from `tools/list` in a deterministic order to\n // enable client-side caching and improve LLM prompt cache hit rates.\"\n // spec-cite: MCP 2026-07-28 — Key Changes § Minor changes item 3\n //\n // Applied for EVERY revision, not gated: a stable order cannot break an older client, and\n // deriving it from registry iteration order would make the catalogue reorder itself on an\n // unrelated resource being registered — silently costing every client its prompt cache.\n tools: tools\n .map((t) => ({\n name: t.name,\n description: t.description,\n inputSchema: t.inputSchema,\n ...(t.annotations ? { annotations: t.annotations } : {}),\n }))\n .sort((a, b) => a.name.localeCompare(b.name)),\n // PRIVATE, and this is a security decision rather than a default.\n //\n // A tool catalogue looks like the textbook `public` case — \"lists of tools […] when they are\n // identical for all users\". OURS ARE NOT. The catalogue widens for a user-delegated token\n // (`mcpReachableScopesForPrincipal(isUserDelegated)`), so a `public` scope would let a shared\n // gateway serve a delegated caller's wider catalogue to a machine caller — which the spec warns\n // about in as many words: a `public` result \"may be shared between callers even if the Result\n // is coming from an authenticated endpoint\".\n // spec-cite: MCP 2026-07-28 — Caching § Security Considerations, and § Choosing a Cache Scope\n // (\"`private` is appropriate for […] filtered list results that vary per user\").\n }, effectiveVersion, { ttlMs: MCP_TOOLS_LIST_CACHE_TTL_MS, cacheScope: Mcp_CacheScope.PRIVATE }));\n }\n\n /** `tools/call` — authenticate (fail-closed) → build the machine EC → dispatch via the server. */\n private async handleToolsCall(req: Request, res: Response, id: JsonRpcId, params: unknown, instanceRef?: string, effectiveVersion = MCP_PROTOCOL_VERSION): Promise<void> {\n const parsedParams = Mcp_ToolsCallParamsSchema.safeParse(params);\n if (!parsedParams.success) {\n this.sendRpcError(req, res, id, Mcp_JsonRpcErrorCode.INVALID_PARAMS, parsedParams.error.issues[0]?.message ?? 'invalid params');\n return;\n }\n const { name: toolName, arguments: toolArgs } = parsedParams.data;\n\n const apiAudience = this.appConfigService.resolveApiResourceAudience();\n // R-2: the token must be audience-bound to THIS instance (`…/mcp/<ref>`), so a token minted for\n // another server — or for the default one — is rejected here. Per-instance isolation is enforced by\n // the same RFC 8707 check the 2026-07-29 flip made strict; no auth-layer change was needed.\n const mcpResource = this.mcpResourceUri(instanceRef);\n if (!apiAudience || !mcpResource) {\n this.sendRpcError(req, res, id, Mcp_JsonRpcErrorCode.INTERNAL_ERROR, 'resource audience is not resolvable');\n return;\n }\n\n // ── OAuth 2.1 resource-server auth (D6/D7) ──────────────────────────────────\n const token = this.extractBearerToken(req);\n if (!token) {\n this.sendUnauthenticated(req, res, id, apiAudience, instanceRef, 'a Bearer access token is required');\n return;\n }\n let auth: SocketAuthResult;\n try {\n // `authenticateExternalToken` accepts BOTH a machine token (client_credentials → its own\n // org/app scope) AND a user-delegated token (authorization_code → the consenting user's scope).\n // Since the 2026-07-29 flip BOTH arms bind `aud` to THIS `mcpResource`: a machine token must be\n // minted for the MCP audience (the generic API audience is rejected here), and a delegated token\n // is verified aud-agnostically then bound to `mcpResource`. The scope for dispatch is resolved\n // principal-agnostically below.\n auth = await this.executionContextCreator.authenticateExternalToken(token, mcpResource);\n } catch {\n // SIEM-2 symmetry (S2): a rejected token at the token-USE seam feeds the shared per-IP failure\n // counter AND emits MACHINE_AUTH_FAILED, so a revoked/expired/forged token hammering /mcp is\n // visible to the SIEM (was invisible — only the token-MINT endpoint audited failures).\n void recordExternalTokenAuthFailure(\n { redisService: this.redisService, logger: this.logger, auditLogs: this.auditLogs },\n { clientIp: getClientIpFromRequest(req), resourceServer: ResourceServerKind.MCP, reason: 'external_token_invalid' },\n );\n this.sendUnauthenticated(req, res, id, apiAudience, instanceRef, 'the access token is invalid, expired, or not audience-bound');\n return;\n }\n\n // ── Per-principal call throttle (resource-op flood guard) ───────────────────\n // Cap `tools/call` dispatches per authenticated principal per window, rejecting a saturated\n // principal with a transport-level 429 + Retry-After BEFORE any dispatch. Fails open on a\n // limiter outage. (Distinct cap from A2A: an MCP call dispatches a CRUD op, not an LLM turn.)\n const principalKey = resolvePrincipalRateKey(auth);\n if (principalKey) {\n const rate = await assertExternalTurnWithinRate(\n { redisService: this.redisService, logger: this.logger },\n {\n principalKey,\n resourceServer: ResourceServerKind.MCP,\n maxPerWindow: MCP_EXTERNAL_CALL_RATE_MAX,\n windowSeconds: MCP_EXTERNAL_CALL_RATE_WINDOW_SECONDS,\n applicationEnv: this.appConfigService.applicationEnv,\n },\n );\n if (rate.kind === 'rate_limited') {\n this.sendRateLimited(req, res, id, rate.retryAfterSeconds);\n return;\n }\n }\n\n // ── Resolve the operation to build a correctly-scoped principal EC ───────────\n // Progressive principal-awareness: a user-delegated caller (carries a `userId`) can reach USER_SELF\n // operations; a machine caller reaches ORG/APP only. Resolve with the caller's reachable scopes so\n // this gate matches the server's `callTool` gate (advertise ≡ callable), and a crafted name for a\n // scope the caller cannot use fails closed HERE (before the service layer).\n const { resourceType, operationIdentifier } = this.parseToolName(toolName);\n const reachableScopes = mcpReachableScopesForPrincipal(mcpPrincipalForAuthenticatedCaller(!!auth.initiatorIds?.userId));\n // Issue #312, D11: a derived upload-grant tool resolves through its PARENT operation — that is\n // the operation whose scope the principal context must be built for, and whose instance id the\n // transport splits out of the arguments. The server re-resolves it the same way before minting.\n const derivedUploadGrant = resourceType && operationIdentifier && operationIdentifier.includes(MCP_UPLOAD_GRANT_TOOL_MARKER)\n ? this.toolAdapter.resolveUploadGrantTool(resourceType, operationIdentifier, reachableScopes, instanceRef)\n : undefined;\n const operation = derivedUploadGrant?.parentOperation ?? (resourceType && operationIdentifier\n ? this.toolAdapter.resolveExposableOperation(resourceType, operationIdentifier, reachableScopes, instanceRef)\n : undefined);\n if (!operation) {\n // A crafted / non-exposed name never reaches the service layer (would otherwise 403).\n this.sendRpcError(req, res, id, Mcp_JsonRpcErrorCode.METHOD_NOT_FOUND, `tool '${toolName}' does not map to an exposable operation`);\n return;\n }\n\n // SIEM-2: audit machine resource-access at the authorized-dispatch boundary — the caller is\n // authenticated + the tool resolved to an exposable operation, about to dispatch. Fire-and-forget\n // (no-op for a user principal). This records the access ATTEMPT: it fires BEFORE the per-op roles\n // authorization inside `callTool`, so a subsequent roles denial does NOT suppress the row and the\n // row carries no allow/deny outcome — a SIEM sees that the machine reached this operation, not\n // whether the call ultimately succeeded. The shared shaper owns machine-principal detection + F4\n // org routing (A2A + MCP never drift).\n this.auditLogs.logMachineResourceAccessFromAuth(auth, {\n resourceServer: ResourceServerKind.MCP,\n resourceIdentifier: toolName,\n operationIdentifier: MachineAccessOperation.MCP_TOOLS_CALL,\n ipAddress: getClientIpFromRequest(req),\n });\n\n // Scope bundle for the operation's parent scope. Forward WHICHEVER of org/app the authenticated\n // principal carries and let `buildContextFromSocketAuth` filter it to the operation's DECLARED\n // scope parameter (org-scoped op → organizationId, app-scoped op → applicationId). A MACHINE\n // principal carries exactly one (org XOR app). A USER-delegated principal carries the user's\n // resolved ACTIVE org — since 2026-07-31 taken from the delegating OAuth client's own tenant\n // (`azp` → org-scoped client → organizationId), which is what restored org-scoped tool access for\n // MULTI-ORG members; they previously resolved to no org and had every org-scoped call denied.\n // It still resolves to none for an app-scoped/unknown client or a zero-membership user, in which\n // case org-scoped ops continue to fail closed. That rides PLUS the applicationId — the filter picks the\n // right one per operation, so a user is never mis-scoped to the application scope. The\n // authoritative identity (userId / machineCredential) always rides `auth.initiatorIds`.\n const contextIds: Record<string, string> = {\n ...(auth.initiatorIds?.organizationId ? { organizationId: auth.initiatorIds.organizationId } : {}),\n ...(auth.initiatorIds?.applicationId ? { applicationId: auth.initiatorIds.applicationId } : {}),\n };\n\n // F-MCP-WRAP: a union/primitive-root tool (e.g. the todos-create `one_time | recurring` DTO)\n // advertises a `{value:...}` envelope; unwrap it symmetrically and pass the payload straight\n // through — such tools are creates with NO path-param id to split out (otherwise the DTO would\n // receive `{value:...}` and fail validation). Object-root tools keep the resource-id split so\n // READ/UPDATE/DELETE dispatch with a `resourceId` (path-param analogue).\n // A derived upload-grant tool never carries the parent's envelope — its arguments are the instance\n // id (UPDATE) plus a lifetime — so it always takes the id-split branch.\n const { resourceId, body }: { resourceId?: string; body: unknown } = !derivedUploadGrant && isMcpValueWrappedRequestDto(operation.requestDto)\n ? { body: unwrapMcpValueEnvelope(operation.requestDto, toolArgs) }\n : this.extractResourceId(resourceType, toolArgs);\n\n try {\n const executionContext = await this.executionContextCreator.buildContextFromSocketAuth(auth, operation, contextIds);\n const result = await this.mcpServer.callTool(toolName, body, executionContext, { ...(resourceId ? { resourceId } : {}), instanceRef });\n // ── MCP tool-result envelope ──────────────────────────────────────────────────────────────\n //\n // BOTH representations, deliberately:\n //\n // - `structuredContent` — the result as a JSON VALUE. Every tool here returns a resource DTO,\n // which is structured data by construction, so shipping it only as prose forced every agent\n // to parse JSON back out of a string it was told was text. The spec exists for exactly this\n // shape (its own worked example is a `list_users` array).\n // - `content` — the same payload serialized, kept because the spec asks for it:\n // \"For backwards compatibility, a tool that returns structured content SHOULD also return\n // the serialized JSON in a TextContent block.\"\n // spec-cite: MCP 2026-07-28 — Tools § Tool Result → Structured Content\n //\n // No `outputSchema` is advertised, and that is why `structuredContent` can be sent\n // unconditionally: the conformance obligation is one-directional — \"If an output schema is\n // provided: Servers MUST provide structured results that conform to this schema\"\n // (spec-cite: same page, § Output Schema). Structured content without a declared schema is\n // explicitly permitted, so this is additive and commits us to nothing we cannot yet derive.\n //\n // `text` is stringified defensively: `toResponseSafeToolOutput` passes `undefined` straight\n // through for a void operation, and `JSON.stringify(undefined)` is `undefined` — which would\n // have emitted a TextContent block whose REQUIRED `text` field was absent. `'null'` is the\n // honest JSON rendering of \"no result\", and `structuredContent` is omitted entirely in that\n // case rather than carrying a null that the agent would read as a value.\n const serializedResult = JSON.stringify(result.result) ?? 'null';\n // `withResultEnvelope` — NOT optional here, and its absence was a real gap found by reviewing\n // this block after adding `structuredContent` to it. Under the stateless revision every result\n // carries `resultType`, and on a TOOL result that field is load-bearing rather than decorative:\n // it is the discriminator between a completed call and `input_required`, the multi-round-trip\n // shape. A client switching on `resultType` received `undefined` from every tool call we\n // served, while `server/discover` and `tools/list` both carried it — the invariant had been\n // applied at two of its three sites, and the migration ledger recorded it as done.\n // spec-cite: MCP 2026-07-28 — Tools § Calling Tools (the CallToolResult example carries\n // `\"resultType\": \"complete\"`), and § Input Required Tool Results for the value it discriminates.\n //\n // No cache hints: a tool call mutates or reads live state per caller and is never cacheable —\n // which is why the envelope takes them as an explicit argument rather than always adding them.\n this.sendRpcResult(req, res, id, this.withResultEnvelope({\n content: [{ type: 'text', text: serializedResult }],\n ...(result.result === undefined ? {} : { structuredContent: result.result }),\n isError: false,\n }, effectiveVersion));\n } catch (error) {\n this.sendToolError(req, res, id, error, effectiveVersion);\n }\n }\n\n // ── helpers ───────────────────────────────────────────────────────────────\n\n /**\n * The MCP endpoint's absolute URI (`${apiAudience}/mcp`) — this resource server's identity and the\n * `aud` an audience-bound token must carry. Delegates to the single audience authority\n * (`resolveResourceServerAudience(MCP)`) so the token MINT (which validates a requested `resource`\n * against the SAME function) and this verify-side audience cannot drift. `undefined` when the app\n * public base URL is unresolvable (→ the caller fails closed with 503 / INTERNAL_ERROR).\n */\n private mcpResourceUri(instanceRef?: string): string | undefined {\n return this.appConfigService.resolveResourceServerAudience(ResourceServerKind.MCP, instanceRef);\n }\n\n private extractBearerToken(req: Request): string | undefined {\n const header = req.headers['authorization'];\n if (typeof header !== 'string' || !header.startsWith('Bearer ')) return undefined;\n const token = header.slice('Bearer '.length).trim();\n return token.length > 0 ? token : undefined;\n }\n\n /** Split `<resource>__<operation>` on the FIRST `__` (resource ids use single underscores). */\n private parseToolName(toolName: string): { resourceType: ResourceType | undefined; operationIdentifier: string | undefined } {\n const at = toolName.indexOf(MCP_TOOL_NAME_SEPARATOR);\n if (at <= 0 || at + MCP_TOOL_NAME_SEPARATOR.length >= toolName.length) {\n return { resourceType: undefined, operationIdentifier: undefined };\n }\n return {\n resourceType: toolName.slice(0, at) as ResourceType,\n operationIdentifier: toolName.slice(at + MCP_TOOL_NAME_SEPARATOR.length),\n };\n }\n\n /**\n * Pull the resource's own id field out of the tool arguments. When present it becomes\n * the service call's `resourceId` (path-param analogue) and is removed from the body;\n * otherwise the call is a collection operation (no id).\n */\n private extractResourceId(\n resourceType: ResourceType,\n args: Record<string, unknown> | undefined,\n ): { resourceId?: string; body: unknown } {\n if (!args) return { body: args };\n const fieldIdentifier = this.resourcesRegistry.getAllResourceFieldIdentifiers()[resourceType];\n if (fieldIdentifier && typeof args[fieldIdentifier] === 'string') {\n const { [fieldIdentifier]: id, ...rest } = args;\n return { resourceId: id as string, body: rest };\n }\n return { body: args };\n }\n\n /**\n * Whether to answer in the Streamable-HTTP **SSE** response mode rather than `application/json`.\n *\n * **JSON WINS A TIE — deliberately, and this is load-bearing.** The MCP Streamable-HTTP spec REQUIRES a\n * client to advertise BOTH (`Accept: application/json, text/event-stream`) and leaves the choice to the\n * server. The previous implementation was a bare `includes('text/event-stream')`, which matched that\n * spec-mandated header — so EVERY conformant MCP client was served SSE. A client that then parsed the\n * body as JSON (the reasonable default for a synchronous JSON-RPC call) got `{}`: the\n * `client-integration-app` integrator's `tools/list` silently returned an empty result, its agent saw no\n * tools, and both real-LLM integration scenarios degraded to INCONCLUSIVE — reading as \"no LLM credits\"\n * while actually being this defect. It went unnoticed because the SSE proof used\n * `Accept: text/event-stream` ALONE, which no conformant client sends.\n *\n * spec-cite: MCP 2025-06-18 §Transports → Streamable HTTP → \"Sending Messages to the Server\", item 2:\n * \"The client MUST include an `Accept` header, listing both `application/json` and `text/event-stream`\n * as supported content types.\" Item 5 is what leaves the choice to the server: it \"MUST either return\n * `Content-Type: text/event-stream` … or `Content-Type: application/json`\", and \"The client MUST\n * support both these cases.\" Checked against the revision this server advertises — `MCP_PROTOCOL_VERSION`\n * is `2025-06-18`. https://modelcontextprotocol.io/specification/2025-06-18/basic/transports\n *\n * The rules, in order:\n * 1. the client must accept `text/event-stream` at all — otherwise JSON;\n * 2. if it ALSO accepts JSON (explicitly, via `* / *`, or by sending no `Accept` at all), JSON wins.\n * Our results are synchronous single-message payloads, so JSON is the cheaper, more interoperable\n * representation and the right default;\n * 3. UNLESS the client explicitly ranks SSE above JSON with RFC 9110 `q` values\n * (`application/json;q=0.1, text/event-stream;q=0.9`). That keeps the SSE path REACHABLE — without\n * it, rule 2 would make SSE dead code for every spec-conformant client — and it honours a genuine,\n * explicitly-stated client preference rather than inventing a Wildo-specific opt-in.\n */\n private acceptsEventStream(req: Request): boolean {\n const header = String(req.headers['accept'] ?? '').toLowerCase().trim();\n // No `Accept` at all ⇒ the client expressed no preference ⇒ JSON (the default representation).\n if (!header) return false;\n\n // RFC 9110 §12.5.1: `q=0` means \"NOT acceptable\", not \"acceptable but least preferred\". A client\n // that explicitly refuses SSE must never be served SSE, even when it names no alternative.\n const sseQuality = this.acceptQuality(header, 'text/event-stream');\n if (sseQuality === undefined || sseQuality === 0) return false;\n\n // `*/*` makes JSON acceptable just as much as an explicit `application/json` does.\n const jsonQuality = this.acceptQuality(header, 'application/json') ?? this.acceptQuality(header, '*/*');\n if (jsonQuality === undefined) return true; // SSE is the only representation the client will take.\n\n // Both acceptable ⇒ JSON unless the client explicitly ranked SSE higher. (A `q=0` on JSON makes it\n // unacceptable, and `sseQuality > 0` at this point, so SSE correctly wins that case too.)\n return sseQuality > jsonQuality;\n }\n\n /**\n * The RFC 9110 quality value this `Accept` header assigns to one media type, or `undefined` when the\n * type is not present. A media range with no explicit `q` parameter defaults to `1.0`. Deliberately a\n * narrow lookup rather than a general `Accept` parser: only two media types are ever negotiated here.\n */\n private acceptQuality(header: string, mediaType: string): number | undefined {\n for (const part of header.split(',')) {\n const [type, ...params] = part.split(';').map((segment) => segment.trim());\n if (type !== mediaType) continue;\n const qParam = params.find((param) => param.startsWith('q='));\n if (!qParam) return 1;\n const parsed = Number.parseFloat(qParam.slice('q='.length));\n return Number.isFinite(parsed) ? parsed : 1;\n }\n return undefined;\n }\n\n /**\n * Write a single JSON-RPC message as a Streamable-HTTP SSE stream, then close it. Our tool calls are\n * synchronous (one response, no progress/notifications/server-initiated messages), so the stream\n * carries exactly one message event and ends — spec-compliant for a synchronous request/response over\n * the SSE response mode. (When a long-running tool or notifications land, this becomes multi-event.)\n */\n private writeSseMessage(res: Response, payload: unknown): void {\n res.status(200).set({\n 'Content-Type': 'text/event-stream',\n 'Cache-Control': 'no-cache, no-transform',\n Connection: 'keep-alive',\n // \"When initiating an SSE stream, servers SHOULD include the `X-Accel-Buffering: no` header in\n // the HTTP response. This instructs reverse proxies (such as nginx) to disable response\n // buffering, ensuring that SSE events are delivered to clients immediately rather than being\n // held in a buffer.\"\n // spec-cite: MCP 2026-07-28 — Streamable HTTP § Receiving Messages\n //\n // Applied to EVERY revision: a buffering proxy does not care which protocol version is in the\n // body, and the failure it causes — a stream that arrives all at once at the end, or not at\n // all — looks like a server hang rather than a proxy setting. `no-transform` above already\n // asks intermediaries not to modify the payload; this asks them not to hold it.\n 'X-Accel-Buffering': 'no',\n });\n res.write(`data: ${JSON.stringify(payload)}\\n\\n`);\n res.end();\n }\n\n /**\n * Send a 200 JSON-RPC result — as an SSE stream when the client negotiated `text/event-stream`\n * (Streamable-HTTP response mode), else as `application/json`. Both are spec-compliant.\n */\n /**\n * Add the `2026-07-28` result envelope — and ONLY for a request written against it.\n *\n * \"All results now carry a required `resultType` field: `\"complete\"` for ordinary results […]\n * Clients **MUST** treat results from earlier-protocol servers that omit the field as\n * `\"complete\"`.\"\n * spec-cite: MCP 2026-07-28 — Key Changes § Major changes item 8\n *\n * \"Servers MUST include caching hints on results with `resultType: \"complete\"` returned by […]\n * `server/discover`, `tools/list` […]\"\n * spec-cite: MCP 2026-07-28 — Caching § Cacheable Results\n *\n * Gated on the revision because the envelope is the visible half of Hazard 1: stamping fields from\n * a newer revision onto a response to an older client is the mirror image of demanding headers it\n * never sends. The spec's own instruction — treat an omitted `resultType` as complete — is what\n * makes omission the correct behaviour there, not a shortcut.\n */\n private withResultEnvelope(\n result: Record<string, unknown>,\n effectiveVersion: string,\n cache?: { ttlMs: number; cacheScope: Mcp_CacheScope },\n ): Record<string, unknown> {\n if (!isStatelessMcpProtocolVersion(effectiveVersion)) return result;\n return { ...result, resultType: 'complete', ...(cache ? { ttlMs: cache.ttlMs, cacheScope: cache.cacheScope } : {}) };\n }\n\n private sendRpcResult(req: Request, res: Response, id: JsonRpcId, result: unknown): void {\n const payload = { jsonrpc: '2.0', id, result };\n if (this.acceptsEventStream(req)) { this.writeSseMessage(res, payload); return; }\n res.status(200).json(payload);\n }\n\n /**\n * Send a JSON-RPC error. A 200-status APPLICATION error is SSE-framed when the client negotiated it\n * (same as a result); a TRANSPORT-level error (401 / 429 / 503) is ALWAYS a plain HTTP response with\n * that status, never SSE — the client must observe it at the HTTP layer.\n */\n private sendRpcError(req: Request, res: Response, id: JsonRpcId, code: Mcp_JsonRpcErrorCode, message: string, httpStatus = 200): void {\n const payload = { jsonrpc: '2.0', id, error: { code, message } };\n if (httpStatus === 200 && this.acceptsEventStream(req)) { this.writeSseMessage(res, payload); return; }\n res.status(httpStatus).json(payload);\n }\n\n /**\n * RFC 9728 challenge: 401 + `WWW-Authenticate` naming the protected-resource metadata of the SERVER THE\n * CLIENT ACTUALLY ADDRESSED (transport-level; plain HTTP).\n *\n * The `instanceRef` is load-bearing, not cosmetic. This pointer is the ONLY discovery route a client\n * has: Wildo's PRM lives at a NON-STANDARD path (`…/mcp/<ref>/.well-known/oauth-protected-resource`\n * rather than the RFC's origin-root `/.well-known/oauth-protected-resource/<path>`), so a client cannot\n * derive it from the request URL and must follow this header. Pointing every 401 at the DEFAULT\n * metadata made named instances undiscoverable AND unusable: the client would read the default PRM,\n * mint a token for the DEFAULT audience, present it at `/mcp/<ref>`, be rejected on the audience check,\n * re-read the same default metadata, and loop forever — with each iteration looking like a plain auth\n * failure rather than a discovery bug.\n */\n private sendUnauthenticated(\n req: Request,\n res: Response,\n id: JsonRpcId,\n apiAudience: string,\n instanceRef: string | undefined,\n message: string,\n /**\n * RFC 6750 § 3.1 `error` code. Supply `invalid_token` when the caller DID present a credential\n * and it failed — the distinction is actionable: a client seeing `invalid_token` refreshes, while\n * a bare challenge means \"you have not authorized yet\" and starts the whole flow. Omitted for the\n * no-credentials case, which is the bare challenge.\n */\n oauthError?: string,\n ): void {\n // `scope` accompanies the metadata pointer because it is the FIRST rung of the client's\n // scope-selection ladder — a client takes the challenge's `scope` and only falls back to the\n // protected-resource document's `scopes_supported`. Carrying neither is what left Cursor with no\n // authorization request to build on 2026-08-11, so it silently skipped the browser leg entirely.\n // The value is the identity set a delegated client is actually granted, kept identical to the\n // metadata document's so the two rungs can never disagree.\n // spec-cite: MCP 2026-07-28 — Authorization § Scope Selection Strategy; RFC 6750 § 3.\n const challengeScope = OIDC_SUPPORTED_IDENTITY_SCOPES.join(' ');\n res.set(\n 'WWW-Authenticate',\n [\n 'Bearer',\n [\n ...(oauthError ? [`error=\"${oauthError}\"`] : []),\n `resource_metadata=\"${this.mcpProtectedResourceMetadataUri(apiAudience, instanceRef)}\"`,\n `scope=\"${challengeScope}\"`,\n ].join(', '),\n ].join(' '),\n );\n this.sendRpcError(req, res, id, Mcp_JsonRpcErrorCode.UNAUTHENTICATED, message, 401);\n }\n\n /**\n * The absolute RFC 9728 metadata URL for one MCP surface. Built from the SAME two route constants\n * `setupRoutes` composes the metadata routes from, so the advertised URL and the mounted route cannot\n * drift — change the constants and both move together.\n *\n * Note the deliberate asymmetry: the DEFAULT server's metadata hangs off the API audience root, while a\n * named instance's hangs off that instance's own audience (`…/mcp/<ref>`). That mirrors how the routes\n * are actually mounted.\n */\n private mcpProtectedResourceMetadataUri(apiAudience: string, instanceRef?: string): string {\n const metadataRoute = MANUAL_CONTROLLER_ROUTES_URLS[ManualControllerRouteKey.MCP_PROTECTED_RESOURCE_METADATA];\n if (!instanceRef) return `${apiAudience}${metadataRoute}`;\n return `${apiAudience}${MANUAL_CONTROLLER_ROUTES_URLS[ManualControllerRouteKey.MCP_ENDPOINT]}/${instanceRef}${metadataRoute}`;\n }\n\n /**\n * Transport-level throttle response: HTTP 429 + `Retry-After`, carrying a valid JSON-RPC\n * error envelope with `RATE_LIMITED`. Distinct from the 200-envelope app errors because\n * rate-limiting is a transport concern a client should honor at the HTTP layer (so never SSE).\n */\n private sendRateLimited(req: Request, res: Response, id: JsonRpcId, retryAfterSeconds: number): void {\n res.set('Retry-After', String(retryAfterSeconds));\n this.sendRpcError(req, res, id, Mcp_JsonRpcErrorCode.RATE_LIMITED, 'Rate limit exceeded; retry after the indicated delay.', 429);\n }\n\n /**\n * A thrown `callTool` failure → JSON-RPC error (a 200 envelope: the call transported OK, the tool\n * failed). An authorization/authentication denial (the fail-closed path) surfaces as UNAUTHENTICATED\n * so the caller sees the rejection; anything else is an INTERNAL_ERROR carrying the classified type.\n * SSE-framed when the client negotiated it (same as any 200 result).\n */\n private sendToolError(req: Request, res: Response, id: JsonRpcId, error: unknown, effectiveVersion = MCP_PROTOCOL_VERSION): void {\n const wildo = this.asWildoError(error);\n const type = wildo?.type;\n const message = (wildo?.customMessageReference as string) ?? (error instanceof Error ? error.message : 'tool execution failed');\n this.logDebug('MCP tools/call failed', { type, message });\n\n // ── THROTTLE REFUSAL ──────────────────────────────────────────────────────────────────────\n //\n // `callTool` enforces the operation's OWN declared `rateLimit` policy (the per-endpoint budget\n // the HTTP seam has always enforced, previously bypassed on this plane) and signals a refusal\n // by throwing RATE_LIMIT. That is the same EVENT the per-principal cap raises above, so it\n // must leave through the same door: HTTP 429 + `Retry-After` + JSON-RPC `RATE_LIMITED`.\n //\n // Without this branch it would fall through to the default arm and surface as a 200-framed\n // INTERNAL_ERROR — one refusal wearing two shapes, with the operator-authored one wearing the\n // shape that tells a client \"the server broke, nothing you can do\" instead of \"wait N seconds\".\n // A well-behaved agent would have retried immediately and forever.\n //\n // The retry hint rides `context.retryAfterSeconds` on the raw error (the sanitiser strips\n // context for non-VALIDATION types, so it is read BEFORE that boundary); the declared window\n // is the floor when the limiter could not report a live TTL.\n if (type === ErrorType.RATE_LIMIT) {\n const hinted = Number(wildo?.context?.retryAfterSeconds);\n this.sendRateLimited(req, res, id, Number.isFinite(hinted) && hinted > 0 ? hinted : 60);\n return;\n }\n\n // ── TOOL EXECUTION ERROR vs PROTOCOL ERROR ────────────────────────────────────────────────\n //\n // The specification splits these by WHO CAN FIX IT, and the split decides whether the agent is\n // ever shown the reason: \"Clients MAY provide protocol errors to language models, though these\n // are less likely to result in successful recovery. Clients SHOULD provide tool execution errors\n // to language models to enable self-correction.\"\n // spec-cite: MCP 2026-07-28 — Tools § Error Handling\n //\n // Every failure used to leave here as a protocol error, so a bad field produced a reply the\n // client was entitled to withhold from the model — which then retried the same call unchanged.\n if (type && MCP_TOOL_EXECUTION_ERROR_TYPES.has(type)) {\n // Sanitised through the SAME boundary the HTTP path uses, so a tool caller learns exactly what\n // a REST caller would and not one field more. That boundary deliberately preserves `zodIssues`\n // and `fieldName` for VALIDATION — the field-level detail that makes the error actionable — while\n // stripping internal context. Re-deriving a bespoke projection here would be a second disclosure\n // policy for the same errors, and the two would drift.\n const safe = wildo ? this.errorBuilder.sanitizeErrorForClient(wildo) : undefined;\n const detail = safe?.context ? ` ${JSON.stringify(safe.context)}` : '';\n this.sendRpcResult(req, res, id, this.withResultEnvelope({\n content: [{ type: 'text', text: `${message}${detail}` }],\n isError: true,\n }, effectiveVersion));\n return;\n }\n\n // Everything else stays a PROTOCOL error. AUTHENTICATION / AUTHORIZATION in particular: a client\n // opens its OAuth window on an authentication failure, so returning one as a successful result\n // carrying an apology would remove the only signal that drives authorization.\n const isAuthDenial = type === ErrorType.AUTHENTICATION || type === ErrorType.AUTHORIZATION;\n const code = isAuthDenial ? Mcp_JsonRpcErrorCode.UNAUTHENTICATED : Mcp_JsonRpcErrorCode.INTERNAL_ERROR;\n const payload = { jsonrpc: '2.0', id, error: { code, message, data: type ? { type } : undefined } };\n if (this.acceptsEventStream(req)) { this.writeSseMessage(res, payload); return; }\n res.status(200).json(payload);\n }\n\n private asWildoError(error: unknown): WildoError_Backend | undefined {\n return !!error && typeof error === 'object' && 'statusCode' in error && 'type' in error\n ? (error as WildoError_Backend)\n : undefined;\n }\n}\n"]}
|