@frontmcp/sdk 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{src/auth → auth}/instances/instance.local-primary-auth.d.ts +1 -1
- package/{src/auth → auth}/instances/instance.remote-primary-auth.d.ts +1 -1
- package/{src/auth → auth}/session/index.d.ts +1 -0
- package/auth/session/vercel-kv-session.store.d.ts +96 -0
- package/{src/common → common}/interfaces/internal/primary-auth-provider.interface.d.ts +1 -4
- package/{src/common → common}/metadata/front-mcp.metadata.d.ts +1779 -67
- package/{src/common → common}/metadata/prompt.metadata.d.ts +4 -0
- package/{src/common → common}/metadata/resource.metadata.d.ts +8 -0
- package/{src/common → common}/metadata/tool-ui.metadata.d.ts +2 -2
- package/{src/common → common}/metadata/tool.metadata.d.ts +4 -0
- package/{src/common → common}/schemas/http-output.schema.d.ts +24 -6
- package/common/types/options/auth/app-auth.schema.d.ts +275 -0
- package/common/types/options/auth/auth.interfaces.d.ts +461 -0
- package/common/types/options/auth/auth.schema.d.ts +284 -0
- package/common/types/options/auth/auth.utils.d.ts +32 -0
- package/common/types/options/auth/index.d.ts +16 -0
- package/common/types/options/auth/orchestrated.schema.d.ts +381 -0
- package/common/types/options/auth/public.schema.d.ts +42 -0
- package/common/types/options/auth/shared.schemas.d.ts +120 -0
- package/common/types/options/auth/transparent.schema.d.ts +56 -0
- package/common/types/options/auth/transport.deprecated.d.ts +63 -0
- package/{src/common → common}/types/options/index.d.ts +1 -1
- package/common/types/options/redis.options.d.ts +190 -0
- package/{src/common → common}/types/options/server-info.options.d.ts +4 -0
- package/{src/common → common}/types/options/transport.options.d.ts +74 -5
- package/{src/common → common}/utils/decide-request-intent.utils.d.ts +6 -7
- package/common/utils/global-config.utils.d.ts +36 -0
- package/{src/common → common}/utils/index.d.ts +1 -0
- package/{src/completion → completion}/flows/complete.flow.d.ts +6 -8
- package/{src/errors → errors}/index.d.ts +1 -1
- package/{src/errors → errors}/mcp.error.d.ts +9 -0
- package/esm/index.mjs +22664 -0
- package/esm/mcp-apps/index.mjs +723 -0
- package/esm/package.json +81 -0
- package/{src/front-mcp → front-mcp}/front-mcp.providers.d.ts +246 -38
- package/front-mcp/index.d.ts +2 -0
- package/{src/index.d.ts → index.d.ts} +1 -1
- package/index.js +22957 -0
- package/logger/logger.tokens.d.ts +1 -0
- package/{src/logging → logging}/flows/set-level.flow.d.ts +6 -8
- package/mcp-apps/index.js +799 -0
- package/package.json +37 -17
- package/{src/prompt → prompt}/flows/get-prompt.flow.d.ts +14 -8
- package/{src/prompt → prompt}/flows/prompts-list.flow.d.ts +8 -7
- package/{src/resource → resource}/flows/read-resource.flow.d.ts +8 -9
- package/{src/resource → resource}/flows/resource-templates-list.flow.d.ts +8 -7
- package/{src/resource → resource}/flows/resources-list.flow.d.ts +8 -7
- package/{src/resource → resource}/flows/subscribe-resource.flow.d.ts +6 -8
- package/{src/resource → resource}/flows/unsubscribe-resource.flow.d.ts +6 -8
- package/store/adapters/store.vercel-kv.adapter.d.ts +86 -0
- package/{src/store → store}/index.d.ts +2 -0
- package/store/store.factory.d.ts +86 -0
- package/{src/tool → tool}/flows/call-tool.flow.d.ts +18 -9
- package/{src/tool → tool}/flows/tools-list.flow.d.ts +9 -8
- package/{src/tool → tool}/ui/index.d.ts +4 -4
- package/{src/tool → tool}/ui/platform-adapters.d.ts +2 -2
- package/{src/tool → tool}/ui/template-helpers.d.ts +5 -7
- package/{src/tool → tool}/ui/ui-resource.handler.d.ts +1 -1
- package/{src/transport → transport}/mcp-handlers/complete-request.handler.d.ts +4 -15
- package/{src/transport → transport}/mcp-handlers/get-prompt-request.handler.d.ts +5 -15
- package/{src/transport → transport}/mcp-handlers/index.d.ts +67 -195
- package/{src/transport → transport}/mcp-handlers/list-prompts-request.handler.d.ts +5 -15
- package/{src/transport → transport}/mcp-handlers/list-resource-templates-request.handler.d.ts +5 -15
- package/{src/transport → transport}/mcp-handlers/list-resources-request.handler.d.ts +5 -15
- package/{src/transport → transport}/mcp-handlers/list-tools-request.handler.d.ts +5 -15
- package/{src/transport → transport}/mcp-handlers/logging-set-level-request.handler.d.ts +3 -14
- package/{src/transport → transport}/mcp-handlers/read-resource-request.handler.d.ts +4 -15
- package/{src/transport → transport}/mcp-handlers/subscribe-request.handler.d.ts +3 -14
- package/{src/transport → transport}/mcp-handlers/unsubscribe-request.handler.d.ts +3 -14
- package/{src/transport → transport}/transport.registry.d.ts +5 -1
- package/README.md +0 -460
- package/src/adapter/adapter.instance.js +0 -70
- package/src/adapter/adapter.instance.js.map +0 -1
- package/src/adapter/adapter.regsitry.js +0 -54
- package/src/adapter/adapter.regsitry.js.map +0 -1
- package/src/adapter/adapter.utils.js +0 -83
- package/src/adapter/adapter.utils.js.map +0 -1
- package/src/app/app.registry.js +0 -66
- package/src/app/app.registry.js.map +0 -1
- package/src/app/app.utils.js +0 -58
- package/src/app/app.utils.js.map +0 -1
- package/src/app/instances/app.local.instance.js +0 -67
- package/src/app/instances/app.local.instance.js.map +0 -1
- package/src/app/instances/app.remote.instance.js +0 -36
- package/src/app/instances/app.remote.instance.js.map +0 -1
- package/src/app/instances/index.js +0 -6
- package/src/app/instances/index.js.map +0 -1
- package/src/auth/auth.registry.js +0 -219
- package/src/auth/auth.registry.js.map +0 -1
- package/src/auth/auth.utils.js +0 -84
- package/src/auth/auth.utils.js.map +0 -1
- package/src/auth/authorization/authorization.class.js +0 -217
- package/src/auth/authorization/authorization.class.js.map +0 -1
- package/src/auth/authorization/authorization.types.js +0 -79
- package/src/auth/authorization/authorization.types.js.map +0 -1
- package/src/auth/authorization/index.js +0 -19
- package/src/auth/authorization/index.js.map +0 -1
- package/src/auth/authorization/orchestrated.authorization.js +0 -306
- package/src/auth/authorization/orchestrated.authorization.js.map +0 -1
- package/src/auth/authorization/public.authorization.js +0 -132
- package/src/auth/authorization/public.authorization.js.map +0 -1
- package/src/auth/authorization/transparent.authorization.js +0 -147
- package/src/auth/authorization/transparent.authorization.js.map +0 -1
- package/src/auth/consent/consent.types.js +0 -119
- package/src/auth/consent/consent.types.js.map +0 -1
- package/src/auth/consent/index.js +0 -13
- package/src/auth/consent/index.js.map +0 -1
- package/src/auth/detection/auth-provider-detection.js +0 -230
- package/src/auth/detection/auth-provider-detection.js.map +0 -1
- package/src/auth/detection/index.js +0 -15
- package/src/auth/detection/index.js.map +0 -1
- package/src/auth/flows/auth.verify.flow.js +0 -379
- package/src/auth/flows/auth.verify.flow.js.map +0 -1
- package/src/auth/flows/oauth.authorize.flow.js +0 -822
- package/src/auth/flows/oauth.authorize.flow.js.map +0 -1
- package/src/auth/flows/oauth.callback.flow.js +0 -357
- package/src/auth/flows/oauth.callback.flow.js.map +0 -1
- package/src/auth/flows/oauth.register.flow.js +0 -201
- package/src/auth/flows/oauth.register.flow.js.map +0 -1
- package/src/auth/flows/oauth.token.flow.js +0 -319
- package/src/auth/flows/oauth.token.flow.js.map +0 -1
- package/src/auth/flows/session.verify.flow.js +0 -304
- package/src/auth/flows/session.verify.flow.js.map +0 -1
- package/src/auth/flows/well-known.jwks.flow.js +0 -89
- package/src/auth/flows/well-known.jwks.flow.js.map +0 -1
- package/src/auth/flows/well-known.oauth-authorization-server.flow.js +0 -122
- package/src/auth/flows/well-known.oauth-authorization-server.flow.js.map +0 -1
- package/src/auth/flows/well-known.prm.flow.js +0 -106
- package/src/auth/flows/well-known.prm.flow.js.map +0 -1
- package/src/auth/instances/instance.local-primary-auth.js +0 -308
- package/src/auth/instances/instance.local-primary-auth.js.map +0 -1
- package/src/auth/instances/instance.remote-primary-auth.js +0 -49
- package/src/auth/instances/instance.remote-primary-auth.js.map +0 -1
- package/src/auth/jwks/dev-key-persistence.js +0 -219
- package/src/auth/jwks/dev-key-persistence.js.map +0 -1
- package/src/auth/jwks/index.js +0 -7
- package/src/auth/jwks/index.js.map +0 -1
- package/src/auth/jwks/jwks.service.js +0 -303
- package/src/auth/jwks/jwks.service.js.map +0 -1
- package/src/auth/jwks/jwks.types.js +0 -3
- package/src/auth/jwks/jwks.types.js.map +0 -1
- package/src/auth/jwks/jwks.utils.js +0 -32
- package/src/auth/jwks/jwks.utils.js.map +0 -1
- package/src/auth/machine-id.js +0 -32
- package/src/auth/machine-id.js.map +0 -1
- package/src/auth/oauth/flows/oauth.authorize.flow.js +0 -33
- package/src/auth/oauth/flows/oauth.authorize.flow.js.map +0 -1
- package/src/auth/oauth/flows/oauth.device-authorization.flow.js +0 -48
- package/src/auth/oauth/flows/oauth.device-authorization.flow.js.map +0 -1
- package/src/auth/oauth/flows/oauth.introspect.flow.js +0 -28
- package/src/auth/oauth/flows/oauth.introspect.flow.js.map +0 -1
- package/src/auth/oauth/flows/oauth.par.flow.js +0 -29
- package/src/auth/oauth/flows/oauth.par.flow.js.map +0 -1
- package/src/auth/oauth/flows/oauth.revoke.flow.js +0 -27
- package/src/auth/oauth/flows/oauth.revoke.flow.js.map +0 -1
- package/src/auth/oauth/flows/oauth.token.flow.js +0 -59
- package/src/auth/oauth/flows/oauth.token.flow.js.map +0 -1
- package/src/auth/oauth/flows/oauth.userinfo.flow.js +0 -24
- package/src/auth/oauth/flows/oauth.userinfo.flow.js.map +0 -1
- package/src/auth/oauth/flows/oidc.logout.flow.js +0 -20
- package/src/auth/oauth/flows/oidc.logout.flow.js.map +0 -1
- package/src/auth/session/authorization-vault.js +0 -817
- package/src/auth/session/authorization-vault.js.map +0 -1
- package/src/auth/session/authorization.store.js +0 -323
- package/src/auth/session/authorization.store.js.map +0 -1
- package/src/auth/session/encrypted-authorization-vault.js +0 -493
- package/src/auth/session/encrypted-authorization-vault.js.map +0 -1
- package/src/auth/session/index.js +0 -16
- package/src/auth/session/index.js.map +0 -1
- package/src/auth/session/record/session.base.js +0 -125
- package/src/auth/session/record/session.base.js.map +0 -1
- package/src/auth/session/record/session.stateful.js +0 -55
- package/src/auth/session/record/session.stateful.js.map +0 -1
- package/src/auth/session/record/session.stateless.js +0 -32
- package/src/auth/session/record/session.stateless.js.map +0 -1
- package/src/auth/session/record/session.transparent.js +0 -22
- package/src/auth/session/record/session.transparent.js.map +0 -1
- package/src/auth/session/redis-session.store.js +0 -204
- package/src/auth/session/redis-session.store.js.map +0 -1
- package/src/auth/session/session.crypto.js +0 -47
- package/src/auth/session/session.crypto.js.map +0 -1
- package/src/auth/session/session.schema.js +0 -13
- package/src/auth/session/session.schema.js.map +0 -1
- package/src/auth/session/session.service.js +0 -105
- package/src/auth/session/session.service.js.map +0 -1
- package/src/auth/session/session.transport.js +0 -20
- package/src/auth/session/session.transport.js.map +0 -1
- package/src/auth/session/session.types.js +0 -4
- package/src/auth/session/session.types.js.map +0 -1
- package/src/auth/session/token.refresh.js +0 -63
- package/src/auth/session/token.refresh.js.map +0 -1
- package/src/auth/session/token.store.js +0 -53
- package/src/auth/session/token.store.js.map +0 -1
- package/src/auth/session/token.vault.js +0 -54
- package/src/auth/session/token.vault.js.map +0 -1
- package/src/auth/session/transport-session.manager.js +0 -298
- package/src/auth/session/transport-session.manager.js.map +0 -1
- package/src/auth/session/transport-session.types.js +0 -111
- package/src/auth/session/transport-session.types.js.map +0 -1
- package/src/auth/session/utils/auth-token.utils.js +0 -57
- package/src/auth/session/utils/auth-token.utils.js.map +0 -1
- package/src/auth/session/utils/session-id.utils.js +0 -217
- package/src/auth/session/utils/session-id.utils.js.map +0 -1
- package/src/auth/session/utils/tiny-ttl-cache.js +0 -26
- package/src/auth/session/utils/tiny-ttl-cache.js.map +0 -1
- package/src/auth/session/vault-encryption.js +0 -263
- package/src/auth/session/vault-encryption.js.map +0 -1
- package/src/auth/ui/base-layout.js +0 -279
- package/src/auth/ui/base-layout.js.map +0 -1
- package/src/auth/ui/index.js +0 -34
- package/src/auth/ui/index.js.map +0 -1
- package/src/auth/ui/templates.js +0 -426
- package/src/auth/ui/templates.js.map +0 -1
- package/src/auth/utils/audience.validator.js +0 -196
- package/src/auth/utils/audience.validator.js.map +0 -1
- package/src/auth/utils/index.js +0 -7
- package/src/auth/utils/index.js.map +0 -1
- package/src/auth/utils/www-authenticate.utils.js +0 -183
- package/src/auth/utils/www-authenticate.utils.js.map +0 -1
- package/src/common/common.schema.js +0 -35
- package/src/common/common.schema.js.map +0 -1
- package/src/common/constants.js +0 -13
- package/src/common/constants.js.map +0 -1
- package/src/common/decorators/adapter.decorator.js +0 -20
- package/src/common/decorators/adapter.decorator.js.map +0 -1
- package/src/common/decorators/app.decorator.js +0 -44
- package/src/common/decorators/app.decorator.js.map +0 -1
- package/src/common/decorators/auth-provider.decorator.js +0 -20
- package/src/common/decorators/auth-provider.decorator.js.map +0 -1
- package/src/common/decorators/decorator-utils.js +0 -195
- package/src/common/decorators/decorator-utils.js.map +0 -1
- package/src/common/decorators/flow.decorator.js +0 -19
- package/src/common/decorators/flow.decorator.js.map +0 -1
- package/src/common/decorators/front-mcp.decorator.js +0 -67
- package/src/common/decorators/front-mcp.decorator.js.map +0 -1
- package/src/common/decorators/hook.decorator.js +0 -178
- package/src/common/decorators/hook.decorator.js.map +0 -1
- package/src/common/decorators/index.js +0 -16
- package/src/common/decorators/index.js.map +0 -1
- package/src/common/decorators/logger.decorator.js +0 -20
- package/src/common/decorators/logger.decorator.js.map +0 -1
- package/src/common/decorators/plugin.decorator.js +0 -39
- package/src/common/decorators/plugin.decorator.js.map +0 -1
- package/src/common/decorators/prompt.decorator.js +0 -38
- package/src/common/decorators/prompt.decorator.js.map +0 -1
- package/src/common/decorators/provider.decorator.js +0 -20
- package/src/common/decorators/provider.decorator.js.map +0 -1
- package/src/common/decorators/resource.decorator.js +0 -94
- package/src/common/decorators/resource.decorator.js.map +0 -1
- package/src/common/decorators/tool.decorator.js +0 -45
- package/src/common/decorators/tool.decorator.js.map +0 -1
- package/src/common/dynamic/dynamic.adapter.js +0 -28
- package/src/common/dynamic/dynamic.adapter.js.map +0 -1
- package/src/common/dynamic/dynamic.plugin.js +0 -42
- package/src/common/dynamic/dynamic.plugin.js.map +0 -1
- package/src/common/dynamic/dynamic.utils.js +0 -27
- package/src/common/dynamic/dynamic.utils.js.map +0 -1
- package/src/common/dynamic/index.js +0 -6
- package/src/common/dynamic/index.js.map +0 -1
- package/src/common/entries/adapter.entry.js +0 -8
- package/src/common/entries/adapter.entry.js.map +0 -1
- package/src/common/entries/app.entry.js +0 -9
- package/src/common/entries/app.entry.js.map +0 -1
- package/src/common/entries/auth-provider.entry.js +0 -8
- package/src/common/entries/auth-provider.entry.js.map +0 -1
- package/src/common/entries/base.entry.js +0 -17
- package/src/common/entries/base.entry.js.map +0 -1
- package/src/common/entries/flow.entry.js +0 -21
- package/src/common/entries/flow.entry.js.map +0 -1
- package/src/common/entries/hook.entry.js +0 -20
- package/src/common/entries/hook.entry.js.map +0 -1
- package/src/common/entries/index.js +0 -17
- package/src/common/entries/index.js.map +0 -1
- package/src/common/entries/logger.entry.js +0 -8
- package/src/common/entries/logger.entry.js.map +0 -1
- package/src/common/entries/plugin.entry.js +0 -8
- package/src/common/entries/plugin.entry.js.map +0 -1
- package/src/common/entries/prompt.entry.js +0 -18
- package/src/common/entries/prompt.entry.js.map +0 -1
- package/src/common/entries/provider.entry.js +0 -8
- package/src/common/entries/provider.entry.js.map +0 -1
- package/src/common/entries/resource.entry.js +0 -35
- package/src/common/entries/resource.entry.js.map +0 -1
- package/src/common/entries/scope.entry.js +0 -14
- package/src/common/entries/scope.entry.js.map +0 -1
- package/src/common/entries/tool.entry.js +0 -31
- package/src/common/entries/tool.entry.js.map +0 -1
- package/src/common/flow/flow.utils.js +0 -96
- package/src/common/flow/flow.utils.js.map +0 -1
- package/src/common/index.js +0 -20
- package/src/common/index.js.map +0 -1
- package/src/common/interfaces/adapter.interface.js +0 -3
- package/src/common/interfaces/adapter.interface.js.map +0 -1
- package/src/common/interfaces/app.interface.js +0 -3
- package/src/common/interfaces/app.interface.js.map +0 -1
- package/src/common/interfaces/auth-hook.interface.js +0 -135
- package/src/common/interfaces/auth-hook.interface.js.map +0 -1
- package/src/common/interfaces/auth-provider.interface.js +0 -18
- package/src/common/interfaces/auth-provider.interface.js.map +0 -1
- package/src/common/interfaces/base.interface.js +0 -3
- package/src/common/interfaces/base.interface.js.map +0 -1
- package/src/common/interfaces/execution-context.interface.js +0 -166
- package/src/common/interfaces/execution-context.interface.js.map +0 -1
- package/src/common/interfaces/flow.interface.js +0 -95
- package/src/common/interfaces/flow.interface.js.map +0 -1
- package/src/common/interfaces/front-mcp.interface.js +0 -3
- package/src/common/interfaces/front-mcp.interface.js.map +0 -1
- package/src/common/interfaces/hook.interface.js +0 -3
- package/src/common/interfaces/hook.interface.js.map +0 -1
- package/src/common/interfaces/index.js +0 -21
- package/src/common/interfaces/index.js.map +0 -1
- package/src/common/interfaces/internal/flow.utils.js +0 -83
- package/src/common/interfaces/internal/flow.utils.js.map +0 -1
- package/src/common/interfaces/internal/index.js +0 -7
- package/src/common/interfaces/internal/index.js.map +0 -1
- package/src/common/interfaces/internal/primary-auth-provider.interface.js +0 -81
- package/src/common/interfaces/internal/primary-auth-provider.interface.js.map +0 -1
- package/src/common/interfaces/internal/registry.interface.js +0 -3
- package/src/common/interfaces/internal/registry.interface.js.map +0 -1
- package/src/common/interfaces/logger.interface.js +0 -10
- package/src/common/interfaces/logger.interface.js.map +0 -1
- package/src/common/interfaces/plugin.interface.js +0 -3
- package/src/common/interfaces/plugin.interface.js.map +0 -1
- package/src/common/interfaces/prompt.interface.js +0 -81
- package/src/common/interfaces/prompt.interface.js.map +0 -1
- package/src/common/interfaces/provider.interface.js +0 -18
- package/src/common/interfaces/provider.interface.js.map +0 -1
- package/src/common/interfaces/resource.interface.js +0 -56
- package/src/common/interfaces/resource.interface.js.map +0 -1
- package/src/common/interfaces/scope.interface.js +0 -3
- package/src/common/interfaces/scope.interface.js.map +0 -1
- package/src/common/interfaces/server.interface.js +0 -18
- package/src/common/interfaces/server.interface.js.map +0 -1
- package/src/common/interfaces/session-hook.interface.js +0 -140
- package/src/common/interfaces/session-hook.interface.js.map +0 -1
- package/src/common/interfaces/tool-hook.interface.js +0 -92
- package/src/common/interfaces/tool-hook.interface.js.map +0 -1
- package/src/common/interfaces/tool.interface.js +0 -117
- package/src/common/interfaces/tool.interface.js.map +0 -1
- package/src/common/metadata/adapter.metadata.js +0 -10
- package/src/common/metadata/adapter.metadata.js.map +0 -1
- package/src/common/metadata/app.metadata.js +0 -30
- package/src/common/metadata/app.metadata.js.map +0 -1
- package/src/common/metadata/auth-provider.metadata.js +0 -19
- package/src/common/metadata/auth-provider.metadata.js.map +0 -1
- package/src/common/metadata/flow.metadata.js +0 -15
- package/src/common/metadata/flow.metadata.js.map +0 -1
- package/src/common/metadata/front-mcp.metadata.js +0 -29
- package/src/common/metadata/front-mcp.metadata.js.map +0 -1
- package/src/common/metadata/hook.metadata.js +0 -3
- package/src/common/metadata/hook.metadata.js.map +0 -1
- package/src/common/metadata/index.js +0 -17
- package/src/common/metadata/index.js.map +0 -1
- package/src/common/metadata/logger.metadata.js +0 -10
- package/src/common/metadata/logger.metadata.js.map +0 -1
- package/src/common/metadata/plugin.metadata.js +0 -18
- package/src/common/metadata/plugin.metadata.js.map +0 -1
- package/src/common/metadata/prompt.metadata.js +0 -27
- package/src/common/metadata/prompt.metadata.js.map +0 -1
- package/src/common/metadata/provider.metadata.js +0 -36
- package/src/common/metadata/provider.metadata.js.map +0 -1
- package/src/common/metadata/resource.metadata.js +0 -31
- package/src/common/metadata/resource.metadata.js.map +0 -1
- package/src/common/metadata/tool-ui.metadata.js +0 -12
- package/src/common/metadata/tool-ui.metadata.js.map +0 -1
- package/src/common/metadata/tool.metadata.js +0 -55
- package/src/common/metadata/tool.metadata.js.map +0 -1
- package/src/common/migrate/auth-transport.migrate.js +0 -140
- package/src/common/migrate/auth-transport.migrate.js.map +0 -1
- package/src/common/migrate/index.js +0 -6
- package/src/common/migrate/index.js.map +0 -1
- package/src/common/providers/base-config.provider.js +0 -128
- package/src/common/providers/base-config.provider.js.map +0 -1
- package/src/common/records/adapter.record.js +0 -11
- package/src/common/records/adapter.record.js.map +0 -1
- package/src/common/records/app.record.js +0 -9
- package/src/common/records/app.record.js.map +0 -1
- package/src/common/records/auth-provider.record.js +0 -12
- package/src/common/records/auth-provider.record.js.map +0 -1
- package/src/common/records/flow.record.js +0 -8
- package/src/common/records/flow.record.js.map +0 -1
- package/src/common/records/hook.record.js +0 -8
- package/src/common/records/hook.record.js.map +0 -1
- package/src/common/records/index.js +0 -16
- package/src/common/records/index.js.map +0 -1
- package/src/common/records/logger.record.js +0 -8
- package/src/common/records/logger.record.js.map +0 -1
- package/src/common/records/plugin.record.js +0 -11
- package/src/common/records/plugin.record.js.map +0 -1
- package/src/common/records/prompt.record.js +0 -9
- package/src/common/records/prompt.record.js.map +0 -1
- package/src/common/records/provider.record.js +0 -14
- package/src/common/records/provider.record.js.map +0 -1
- package/src/common/records/resource.record.js +0 -20
- package/src/common/records/resource.record.js.map +0 -1
- package/src/common/records/scope.record.js +0 -9
- package/src/common/records/scope.record.js.map +0 -1
- package/src/common/records/tool.record.js +0 -9
- package/src/common/records/tool.record.js.map +0 -1
- package/src/common/schemas/annotated-class.schema.js +0 -109
- package/src/common/schemas/annotated-class.schema.js.map +0 -1
- package/src/common/schemas/http-input.schema.js +0 -13
- package/src/common/schemas/http-input.schema.js.map +0 -1
- package/src/common/schemas/http-output.schema.js +0 -321
- package/src/common/schemas/http-output.schema.js.map +0 -1
- package/src/common/schemas/index.js +0 -8
- package/src/common/schemas/index.js.map +0 -1
- package/src/common/schemas/session-header.schema.js +0 -42
- package/src/common/schemas/session-header.schema.js.map +0 -1
- package/src/common/tokens/adapter.tokens.js +0 -11
- package/src/common/tokens/adapter.tokens.js.map +0 -1
- package/src/common/tokens/app.tokens.js +0 -30
- package/src/common/tokens/app.tokens.js.map +0 -1
- package/src/common/tokens/auth-provider.tokens.js +0 -12
- package/src/common/tokens/auth-provider.tokens.js.map +0 -1
- package/src/common/tokens/base.tokens.js +0 -9
- package/src/common/tokens/base.tokens.js.map +0 -1
- package/src/common/tokens/flow-hook.tokens.js +0 -9
- package/src/common/tokens/flow-hook.tokens.js.map +0 -1
- package/src/common/tokens/flow.tokens.js +0 -16
- package/src/common/tokens/flow.tokens.js.map +0 -1
- package/src/common/tokens/front-mcp.tokens.js +0 -24
- package/src/common/tokens/front-mcp.tokens.js.map +0 -1
- package/src/common/tokens/index.js +0 -17
- package/src/common/tokens/index.js.map +0 -1
- package/src/common/tokens/logger.tokens.js +0 -11
- package/src/common/tokens/logger.tokens.js.map +0 -1
- package/src/common/tokens/plugin.tokens.js +0 -18
- package/src/common/tokens/plugin.tokens.js.map +0 -1
- package/src/common/tokens/prompt.tokens.js +0 -14
- package/src/common/tokens/prompt.tokens.js.map +0 -1
- package/src/common/tokens/provider.tokens.js +0 -12
- package/src/common/tokens/provider.tokens.js.map +0 -1
- package/src/common/tokens/resource.tokens.js +0 -28
- package/src/common/tokens/resource.tokens.js.map +0 -1
- package/src/common/tokens/server.tokens.js +0 -11
- package/src/common/tokens/server.tokens.js.map +0 -1
- package/src/common/tokens/tool.tokens.js +0 -21
- package/src/common/tokens/tool.tokens.js.map +0 -1
- package/src/common/types/auth/index.js +0 -6
- package/src/common/types/auth/index.js.map +0 -1
- package/src/common/types/auth/jwt.types.js +0 -36
- package/src/common/types/auth/jwt.types.js.map +0 -1
- package/src/common/types/auth/session.types.js +0 -53
- package/src/common/types/auth/session.types.js.map +0 -1
- package/src/common/types/common.types.js +0 -3
- package/src/common/types/common.types.js.map +0 -1
- package/src/common/types/index.js +0 -7
- package/src/common/types/index.js.map +0 -1
- package/src/common/types/options/auth.options.d.ts +0 -1266
- package/src/common/types/options/auth.options.js +0 -560
- package/src/common/types/options/auth.options.js.map +0 -1
- package/src/common/types/options/http.options.js +0 -10
- package/src/common/types/options/http.options.js.map +0 -1
- package/src/common/types/options/index.js +0 -11
- package/src/common/types/options/index.js.map +0 -1
- package/src/common/types/options/logging.options.js +0 -33
- package/src/common/types/options/logging.options.js.map +0 -1
- package/src/common/types/options/redis.options.d.ts +0 -22
- package/src/common/types/options/redis.options.js +0 -45
- package/src/common/types/options/redis.options.js.map +0 -1
- package/src/common/types/options/server-info.options.js +0 -13
- package/src/common/types/options/server-info.options.js.map +0 -1
- package/src/common/types/options/session.options.js +0 -32
- package/src/common/types/options/session.options.js.map +0 -1
- package/src/common/types/options/transport.options.js +0 -121
- package/src/common/types/options/transport.options.js.map +0 -1
- package/src/common/utils/decide-request-intent.utils.js +0 -391
- package/src/common/utils/decide-request-intent.utils.js.map +0 -1
- package/src/common/utils/index.js +0 -6
- package/src/common/utils/index.js.map +0 -1
- package/src/common/utils/path.utils.js +0 -66
- package/src/common/utils/path.utils.js.map +0 -1
- package/src/completion/flows/complete.flow.js +0 -199
- package/src/completion/flows/complete.flow.js.map +0 -1
- package/src/context/frontmcp-context-storage.js +0 -183
- package/src/context/frontmcp-context-storage.js.map +0 -1
- package/src/context/frontmcp-context.js +0 -360
- package/src/context/frontmcp-context.js.map +0 -1
- package/src/context/frontmcp-context.provider.js +0 -61
- package/src/context/frontmcp-context.provider.js.map +0 -1
- package/src/context/index.js +0 -64
- package/src/context/index.js.map +0 -1
- package/src/context/request-context-storage.js +0 -183
- package/src/context/request-context-storage.js.map +0 -1
- package/src/context/request-context.js +0 -209
- package/src/context/request-context.js.map +0 -1
- package/src/context/request-context.provider.js +0 -51
- package/src/context/request-context.provider.js.map +0 -1
- package/src/context/session-key.provider.js +0 -65
- package/src/context/session-key.provider.js.map +0 -1
- package/src/context/trace-context.js +0 -142
- package/src/context/trace-context.js.map +0 -1
- package/src/errors/authorization-required.error.js +0 -274
- package/src/errors/authorization-required.error.js.map +0 -1
- package/src/errors/error-handler.js +0 -107
- package/src/errors/error-handler.js.map +0 -1
- package/src/errors/index.js +0 -44
- package/src/errors/index.js.map +0 -1
- package/src/errors/mcp.error.js +0 -398
- package/src/errors/mcp.error.js.map +0 -1
- package/src/exceptions/mcp-exceptions/session-missing.exception.js +0 -11
- package/src/exceptions/mcp-exceptions/session-missing.exception.js.map +0 -1
- package/src/exceptions/mcp-exceptions/unsupported-client-version.exception.js +0 -15
- package/src/exceptions/mcp-exceptions/unsupported-client-version.exception.js.map +0 -1
- package/src/flows/flow.instance.js +0 -420
- package/src/flows/flow.instance.js.map +0 -1
- package/src/flows/flow.registry.js +0 -121
- package/src/flows/flow.registry.js.map +0 -1
- package/src/flows/flow.stages.js +0 -113
- package/src/flows/flow.stages.js.map +0 -1
- package/src/flows/flow.utils.js +0 -36
- package/src/flows/flow.utils.js.map +0 -1
- package/src/front-mcp/front-mcp.js +0 -63
- package/src/front-mcp/front-mcp.js.map +0 -1
- package/src/front-mcp/front-mcp.providers.js +0 -29
- package/src/front-mcp/front-mcp.providers.js.map +0 -1
- package/src/front-mcp/front-mcp.tokens.js +0 -5
- package/src/front-mcp/front-mcp.tokens.js.map +0 -1
- package/src/front-mcp/index.d.ts +0 -1
- package/src/front-mcp/index.js +0 -5
- package/src/front-mcp/index.js.map +0 -1
- package/src/front-mcp/serverless-handler.js +0 -61
- package/src/front-mcp/serverless-handler.js.map +0 -1
- package/src/hooks/hook.instance.js +0 -26
- package/src/hooks/hook.instance.js.map +0 -1
- package/src/hooks/hook.registry.js +0 -152
- package/src/hooks/hook.registry.js.map +0 -1
- package/src/hooks/hooks.utils.js +0 -34
- package/src/hooks/hooks.utils.js.map +0 -1
- package/src/index.js +0 -36
- package/src/index.js.map +0 -1
- package/src/logger/instances/instance.console-logger.js +0 -75
- package/src/logger/instances/instance.console-logger.js.map +0 -1
- package/src/logger/instances/instance.logger.js +0 -77
- package/src/logger/instances/instance.logger.js.map +0 -1
- package/src/logger/logger.registry.js +0 -96
- package/src/logger/logger.registry.js.map +0 -1
- package/src/logger/logger.tokens.js +0 -3
- package/src/logger/logger.tokens.js.map +0 -1
- package/src/logger/logger.types.js +0 -8
- package/src/logger/logger.types.js.map +0 -1
- package/src/logger/logger.utils.js +0 -42
- package/src/logger/logger.utils.js.map +0 -1
- package/src/logging/flows/set-level.flow.js +0 -108
- package/src/logging/flows/set-level.flow.js.map +0 -1
- package/src/mcp-apps/csp.js +0 -267
- package/src/mcp-apps/csp.js.map +0 -1
- package/src/mcp-apps/index.js +0 -91
- package/src/mcp-apps/index.js.map +0 -1
- package/src/mcp-apps/schemas.js +0 -345
- package/src/mcp-apps/schemas.js.map +0 -1
- package/src/mcp-apps/template.js +0 -419
- package/src/mcp-apps/template.js.map +0 -1
- package/src/mcp-apps/types.js +0 -59
- package/src/mcp-apps/types.js.map +0 -1
- package/src/notification/index.js +0 -13
- package/src/notification/index.js.map +0 -1
- package/src/notification/notification.service.js +0 -731
- package/src/notification/notification.service.js.map +0 -1
- package/src/plugin/plugin.registry.js +0 -152
- package/src/plugin/plugin.registry.js.map +0 -1
- package/src/plugin/plugin.utils.js +0 -88
- package/src/plugin/plugin.utils.js.map +0 -1
- package/src/prompt/flows/get-prompt.flow.js +0 -214
- package/src/prompt/flows/get-prompt.flow.js.map +0 -1
- package/src/prompt/flows/prompts-list.flow.js +0 -176
- package/src/prompt/flows/prompts-list.flow.js.map +0 -1
- package/src/prompt/index.js +0 -17
- package/src/prompt/index.js.map +0 -1
- package/src/prompt/prompt.events.js +0 -25
- package/src/prompt/prompt.events.js.map +0 -1
- package/src/prompt/prompt.instance.js +0 -120
- package/src/prompt/prompt.instance.js.map +0 -1
- package/src/prompt/prompt.registry.js +0 -380
- package/src/prompt/prompt.registry.js.map +0 -1
- package/src/prompt/prompt.types.js +0 -11
- package/src/prompt/prompt.types.js.map +0 -1
- package/src/prompt/prompt.utils.js +0 -136
- package/src/prompt/prompt.utils.js.map +0 -1
- package/src/provider/provider.registry.js +0 -868
- package/src/provider/provider.registry.js.map +0 -1
- package/src/provider/provider.types.js +0 -3
- package/src/provider/provider.types.js.map +0 -1
- package/src/provider/provider.utils.js +0 -103
- package/src/provider/provider.utils.js.map +0 -1
- package/src/regsitry/index.js +0 -5
- package/src/regsitry/index.js.map +0 -1
- package/src/regsitry/registry.base.js +0 -32
- package/src/regsitry/registry.base.js.map +0 -1
- package/src/resource/flows/read-resource.flow.js +0 -270
- package/src/resource/flows/read-resource.flow.js.map +0 -1
- package/src/resource/flows/resource-templates-list.flow.js +0 -191
- package/src/resource/flows/resource-templates-list.flow.js.map +0 -1
- package/src/resource/flows/resources-list.flow.js +0 -196
- package/src/resource/flows/resources-list.flow.js.map +0 -1
- package/src/resource/flows/subscribe-resource.flow.js +0 -123
- package/src/resource/flows/subscribe-resource.flow.js.map +0 -1
- package/src/resource/flows/unsubscribe-resource.flow.js +0 -107
- package/src/resource/flows/unsubscribe-resource.flow.js.map +0 -1
- package/src/resource/index.js +0 -20
- package/src/resource/index.js.map +0 -1
- package/src/resource/resource.events.js +0 -17
- package/src/resource/resource.events.js.map +0 -1
- package/src/resource/resource.instance.js +0 -163
- package/src/resource/resource.instance.js.map +0 -1
- package/src/resource/resource.registry.js +0 -468
- package/src/resource/resource.registry.js.map +0 -1
- package/src/resource/resource.types.js +0 -11
- package/src/resource/resource.types.js.map +0 -1
- package/src/resource/resource.utils.js +0 -151
- package/src/resource/resource.utils.js.map +0 -1
- package/src/scope/flows/http.request.flow.js +0 -474
- package/src/scope/flows/http.request.flow.js.map +0 -1
- package/src/scope/index.js +0 -6
- package/src/scope/index.js.map +0 -1
- package/src/scope/scope.instance.js +0 -263
- package/src/scope/scope.instance.js.map +0 -1
- package/src/scope/scope.registry.js +0 -94
- package/src/scope/scope.registry.js.map +0 -1
- package/src/scope/scope.utils.js +0 -61
- package/src/scope/scope.utils.js.map +0 -1
- package/src/server/adapters/base.host.adapter.js +0 -8
- package/src/server/adapters/base.host.adapter.js.map +0 -1
- package/src/server/adapters/express.host.adapter.js +0 -70
- package/src/server/adapters/express.host.adapter.js.map +0 -1
- package/src/server/server.instance.js +0 -54
- package/src/server/server.instance.js.map +0 -1
- package/src/server/server.types.js +0 -3
- package/src/server/server.types.js.map +0 -1
- package/src/server/server.validation.js +0 -192
- package/src/server/server.validation.js.map +0 -1
- package/src/store/adapters/store.base.adapter.js +0 -16
- package/src/store/adapters/store.base.adapter.js.map +0 -1
- package/src/store/adapters/store.memory.adapter.js +0 -89
- package/src/store/adapters/store.memory.adapter.js.map +0 -1
- package/src/store/adapters/store.redis.adapter.js +0 -104
- package/src/store/adapters/store.redis.adapter.js.map +0 -1
- package/src/store/index.js +0 -12
- package/src/store/index.js.map +0 -1
- package/src/store/store.helpers.js +0 -67
- package/src/store/store.helpers.js.map +0 -1
- package/src/store/store.registry.js +0 -37
- package/src/store/store.registry.js.map +0 -1
- package/src/store/store.tokens.js +0 -7
- package/src/store/store.tokens.js.map +0 -1
- package/src/store/store.types.js +0 -11
- package/src/store/store.types.js.map +0 -1
- package/src/store/store.utils.js +0 -18
- package/src/store/store.utils.js.map +0 -1
- package/src/tool/flows/call-tool.flow.js +0 -616
- package/src/tool/flows/call-tool.flow.js.map +0 -1
- package/src/tool/flows/tools-list.flow.js +0 -328
- package/src/tool/flows/tools-list.flow.js.map +0 -1
- package/src/tool/tool.events.js +0 -16
- package/src/tool/tool.events.js.map +0 -1
- package/src/tool/tool.instance.js +0 -117
- package/src/tool/tool.instance.js.map +0 -1
- package/src/tool/tool.registry.js +0 -353
- package/src/tool/tool.registry.js.map +0 -1
- package/src/tool/tool.types.js +0 -10
- package/src/tool/tool.types.js.map +0 -1
- package/src/tool/tool.utils.js +0 -366
- package/src/tool/tool.utils.js.map +0 -1
- package/src/tool/ui/index.js +0 -63
- package/src/tool/ui/index.js.map +0 -1
- package/src/tool/ui/platform-adapters.js +0 -18
- package/src/tool/ui/platform-adapters.js.map +0 -1
- package/src/tool/ui/template-helpers.js +0 -112
- package/src/tool/ui/template-helpers.js.map +0 -1
- package/src/tool/ui/ui-resource-template.js +0 -64
- package/src/tool/ui/ui-resource-template.js.map +0 -1
- package/src/tool/ui/ui-resource.handler.js +0 -129
- package/src/tool/ui/ui-resource.handler.js.map +0 -1
- package/src/transport/adapters/transport.local.adapter.js +0 -148
- package/src/transport/adapters/transport.local.adapter.js.map +0 -1
- package/src/transport/adapters/transport.sse.adapter.js +0 -65
- package/src/transport/adapters/transport.sse.adapter.js.map +0 -1
- package/src/transport/adapters/transport.streamable-http.adapter.js +0 -112
- package/src/transport/adapters/transport.streamable-http.adapter.js.map +0 -1
- package/src/transport/flows/handle.sse.flow.js +0 -197
- package/src/transport/flows/handle.sse.flow.js.map +0 -1
- package/src/transport/flows/handle.stateless-http.flow.js +0 -102
- package/src/transport/flows/handle.stateless-http.flow.js.map +0 -1
- package/src/transport/flows/handle.streamable-http.flow.js +0 -315
- package/src/transport/flows/handle.streamable-http.flow.js.map +0 -1
- package/src/transport/legacy/legacy.sse.tranporter.js +0 -185
- package/src/transport/legacy/legacy.sse.tranporter.js.map +0 -1
- package/src/transport/mcp-handlers/Initialized-notification.hanlder.js +0 -14
- package/src/transport/mcp-handlers/Initialized-notification.hanlder.js.map +0 -1
- package/src/transport/mcp-handlers/call-tool-request.handler.js +0 -46
- package/src/transport/mcp-handlers/call-tool-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/complete-request.handler.js +0 -11
- package/src/transport/mcp-handlers/complete-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/get-prompt-request.handler.js +0 -11
- package/src/transport/mcp-handlers/get-prompt-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/index.js +0 -57
- package/src/transport/mcp-handlers/index.js.map +0 -1
- package/src/transport/mcp-handlers/initialize-request.handler.js +0 -109
- package/src/transport/mcp-handlers/initialize-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/list-prompts-request.handler.js +0 -11
- package/src/transport/mcp-handlers/list-prompts-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/list-resource-templates-request.handler.js +0 -12
- package/src/transport/mcp-handlers/list-resource-templates-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/list-resources-request.handler.js +0 -12
- package/src/transport/mcp-handlers/list-resources-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/list-tools-request.handler.js +0 -11
- package/src/transport/mcp-handlers/list-tools-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/logging-set-level-request.handler.js +0 -34
- package/src/transport/mcp-handlers/logging-set-level-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/mcp-handlers.types.js +0 -3
- package/src/transport/mcp-handlers/mcp-handlers.types.js.map +0 -1
- package/src/transport/mcp-handlers/read-resource-request.handler.js +0 -12
- package/src/transport/mcp-handlers/read-resource-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/roots-list-changed-notification.handler.js +0 -26
- package/src/transport/mcp-handlers/roots-list-changed-notification.handler.js.map +0 -1
- package/src/transport/mcp-handlers/subscribe-request.handler.js +0 -34
- package/src/transport/mcp-handlers/subscribe-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/unsubscribe-request.handler.js +0 -34
- package/src/transport/mcp-handlers/unsubscribe-request.handler.js.map +0 -1
- package/src/transport/transport.error.js +0 -25
- package/src/transport/transport.error.js.map +0 -1
- package/src/transport/transport.event-store.js +0 -36
- package/src/transport/transport.event-store.js.map +0 -1
- package/src/transport/transport.local.js +0 -71
- package/src/transport/transport.local.js.map +0 -1
- package/src/transport/transport.registry.js +0 -523
- package/src/transport/transport.registry.js.map +0 -1
- package/src/transport/transport.remote.js +0 -31
- package/src/transport/transport.remote.js.map +0 -1
- package/src/transport/transport.types.js +0 -3
- package/src/transport/transport.types.js.map +0 -1
- package/src/types/drinen-hooks.types.js +0 -3
- package/src/types/drinen-hooks.types.js.map +0 -1
- package/src/types/invoke.type.js +0 -34
- package/src/types/invoke.type.js.map +0 -1
- package/src/types/token.types.js +0 -3
- package/src/types/token.types.js.map +0 -1
- package/src/utils/content.utils.js +0 -194
- package/src/utils/content.utils.js.map +0 -1
- package/src/utils/index.js +0 -55
- package/src/utils/index.js.map +0 -1
- package/src/utils/lineage.utils.js +0 -82
- package/src/utils/lineage.utils.js.map +0 -1
- package/src/utils/metadata.utils.js +0 -26
- package/src/utils/metadata.utils.js.map +0 -1
- package/src/utils/naming.utils.js +0 -136
- package/src/utils/naming.utils.js.map +0 -1
- package/src/utils/server.utils.js +0 -59
- package/src/utils/server.utils.js.map +0 -1
- package/src/utils/string.utils.js +0 -10
- package/src/utils/string.utils.js.map +0 -1
- package/src/utils/token.utils.js +0 -65
- package/src/utils/token.utils.js.map +0 -1
- package/src/utils/types.utils.js +0 -3
- package/src/utils/types.utils.js.map +0 -1
- package/src/utils/uri-template.utils.js +0 -113
- package/src/utils/uri-template.utils.js.map +0 -1
- package/src/utils/uri-validation.utils.js +0 -76
- package/src/utils/uri-validation.utils.js.map +0 -1
- package/{src/adapter → adapter}/adapter.instance.d.ts +0 -0
- package/{src/adapter → adapter}/adapter.regsitry.d.ts +0 -0
- package/{src/adapter → adapter}/adapter.utils.d.ts +0 -0
- package/{src/app → app}/app.registry.d.ts +0 -0
- package/{src/app → app}/app.utils.d.ts +0 -0
- package/{src/app → app}/instances/app.local.instance.d.ts +0 -0
- package/{src/app → app}/instances/app.remote.instance.d.ts +0 -0
- package/{src/app → app}/instances/index.d.ts +0 -0
- package/{src/auth → auth}/auth.registry.d.ts +0 -0
- package/{src/auth → auth}/auth.utils.d.ts +0 -0
- package/{src/auth → auth}/authorization/authorization.class.d.ts +0 -0
- package/{src/auth → auth}/authorization/authorization.types.d.ts +0 -0
- package/{src/auth → auth}/authorization/index.d.ts +0 -0
- package/{src/auth → auth}/authorization/orchestrated.authorization.d.ts +0 -0
- package/{src/auth → auth}/authorization/public.authorization.d.ts +0 -0
- package/{src/auth → auth}/authorization/transparent.authorization.d.ts +0 -0
- package/{src/auth → auth}/consent/consent.types.d.ts +0 -0
- package/{src/auth → auth}/consent/index.d.ts +0 -0
- package/{src/auth → auth}/detection/auth-provider-detection.d.ts +0 -0
- package/{src/auth → auth}/detection/index.d.ts +0 -0
- package/{src/auth → auth}/flows/auth.verify.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/oauth.authorize.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/oauth.callback.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/oauth.register.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/oauth.token.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/session.verify.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/well-known.jwks.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/well-known.oauth-authorization-server.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/well-known.prm.flow.d.ts +0 -0
- package/{src/auth → auth}/jwks/dev-key-persistence.d.ts +0 -0
- package/{src/auth → auth}/jwks/index.d.ts +0 -0
- package/{src/auth → auth}/jwks/jwks.service.d.ts +0 -0
- package/{src/auth → auth}/jwks/jwks.types.d.ts +0 -0
- package/{src/auth → auth}/jwks/jwks.utils.d.ts +0 -0
- package/{src/auth → auth}/machine-id.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.authorize.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.device-authorization.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.introspect.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.par.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.revoke.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.token.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.userinfo.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oidc.logout.flow.d.ts +0 -0
- package/{src/auth → auth}/session/authorization-vault.d.ts +0 -0
- package/{src/auth → auth}/session/authorization.store.d.ts +0 -0
- package/{src/auth → auth}/session/encrypted-authorization-vault.d.ts +0 -0
- package/{src/auth → auth}/session/record/session.base.d.ts +0 -0
- package/{src/auth → auth}/session/record/session.stateful.d.ts +0 -0
- package/{src/auth → auth}/session/record/session.stateless.d.ts +0 -0
- package/{src/auth → auth}/session/record/session.transparent.d.ts +0 -0
- package/{src/auth → auth}/session/redis-session.store.d.ts +0 -0
- package/{src/auth → auth}/session/session.crypto.d.ts +0 -0
- package/{src/auth → auth}/session/session.schema.d.ts +0 -0
- package/{src/auth → auth}/session/session.service.d.ts +0 -0
- package/{src/auth → auth}/session/session.transport.d.ts +0 -0
- package/{src/auth → auth}/session/session.types.d.ts +0 -0
- package/{src/auth → auth}/session/token.refresh.d.ts +0 -0
- package/{src/auth → auth}/session/token.store.d.ts +0 -0
- package/{src/auth → auth}/session/token.vault.d.ts +0 -0
- package/{src/auth → auth}/session/transport-session.manager.d.ts +0 -0
- package/{src/auth → auth}/session/transport-session.types.d.ts +0 -0
- package/{src/auth → auth}/session/utils/auth-token.utils.d.ts +0 -0
- package/{src/auth → auth}/session/utils/session-id.utils.d.ts +0 -0
- package/{src/auth → auth}/session/utils/tiny-ttl-cache.d.ts +0 -0
- package/{src/auth → auth}/session/vault-encryption.d.ts +0 -0
- package/{src/auth → auth}/ui/base-layout.d.ts +0 -0
- package/{src/auth → auth}/ui/index.d.ts +0 -0
- package/{src/auth → auth}/ui/templates.d.ts +0 -0
- package/{src/auth → auth}/utils/audience.validator.d.ts +0 -0
- package/{src/auth → auth}/utils/index.d.ts +0 -0
- package/{src/auth → auth}/utils/www-authenticate.utils.d.ts +0 -0
- package/{src/common → common}/common.schema.d.ts +0 -0
- package/{src/common → common}/constants.d.ts +0 -0
- package/{src/common → common}/decorators/adapter.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/app.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/auth-provider.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/decorator-utils.d.ts +0 -0
- package/{src/common → common}/decorators/flow.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/front-mcp.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/hook.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/index.d.ts +0 -0
- package/{src/common → common}/decorators/logger.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/plugin.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/prompt.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/provider.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/resource.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/tool.decorator.d.ts +0 -0
- package/{src/common → common}/dynamic/dynamic.adapter.d.ts +0 -0
- package/{src/common → common}/dynamic/dynamic.plugin.d.ts +0 -0
- package/{src/common → common}/dynamic/dynamic.utils.d.ts +0 -0
- package/{src/common → common}/dynamic/index.d.ts +0 -0
- package/{src/common → common}/entries/adapter.entry.d.ts +0 -0
- package/{src/common → common}/entries/app.entry.d.ts +0 -0
- package/{src/common → common}/entries/auth-provider.entry.d.ts +0 -0
- package/{src/common → common}/entries/base.entry.d.ts +0 -0
- package/{src/common → common}/entries/flow.entry.d.ts +0 -0
- package/{src/common → common}/entries/hook.entry.d.ts +0 -0
- package/{src/common → common}/entries/index.d.ts +0 -0
- package/{src/common → common}/entries/logger.entry.d.ts +0 -0
- package/{src/common → common}/entries/plugin.entry.d.ts +0 -0
- package/{src/common → common}/entries/prompt.entry.d.ts +0 -0
- package/{src/common → common}/entries/provider.entry.d.ts +0 -0
- package/{src/common → common}/entries/resource.entry.d.ts +0 -0
- package/{src/common → common}/entries/scope.entry.d.ts +0 -0
- package/{src/common → common}/entries/tool.entry.d.ts +0 -0
- package/{src/common → common}/flow/flow.utils.d.ts +0 -0
- package/{src/common → common}/index.d.ts +0 -0
- package/{src/common → common}/interfaces/adapter.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/app.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/auth-hook.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/auth-provider.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/base.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/execution-context.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/flow.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/front-mcp.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/hook.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/index.d.ts +0 -0
- package/{src/common → common}/interfaces/internal/flow.utils.d.ts +0 -0
- package/{src/common → common}/interfaces/internal/index.d.ts +0 -0
- package/{src/common → common}/interfaces/internal/registry.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/logger.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/plugin.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/prompt.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/provider.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/resource.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/scope.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/server.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/session-hook.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/tool-hook.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/tool.interface.d.ts +0 -0
- package/{src/common → common}/metadata/adapter.metadata.d.ts +0 -0
- package/{src/common → common}/metadata/app.metadata.d.ts +42 -42
- /package/{src/common → common}/metadata/auth-provider.metadata.d.ts +0 -0
- /package/{src/common → common}/metadata/flow.metadata.d.ts +0 -0
- /package/{src/common → common}/metadata/hook.metadata.d.ts +0 -0
- /package/{src/common → common}/metadata/index.d.ts +0 -0
- /package/{src/common → common}/metadata/logger.metadata.d.ts +0 -0
- /package/{src/common → common}/metadata/plugin.metadata.d.ts +0 -0
- /package/{src/common → common}/metadata/provider.metadata.d.ts +0 -0
- /package/{src/common → common}/migrate/auth-transport.migrate.d.ts +0 -0
- /package/{src/common → common}/migrate/index.d.ts +0 -0
- /package/{src/common → common}/providers/base-config.provider.d.ts +0 -0
- /package/{src/common → common}/records/adapter.record.d.ts +0 -0
- /package/{src/common → common}/records/app.record.d.ts +0 -0
- /package/{src/common → common}/records/auth-provider.record.d.ts +0 -0
- /package/{src/common → common}/records/flow.record.d.ts +0 -0
- /package/{src/common → common}/records/hook.record.d.ts +0 -0
- /package/{src/common → common}/records/index.d.ts +0 -0
- /package/{src/common → common}/records/logger.record.d.ts +0 -0
- /package/{src/common → common}/records/plugin.record.d.ts +0 -0
- /package/{src/common → common}/records/prompt.record.d.ts +0 -0
- /package/{src/common → common}/records/provider.record.d.ts +0 -0
- /package/{src/common → common}/records/resource.record.d.ts +0 -0
- /package/{src/common → common}/records/scope.record.d.ts +0 -0
- /package/{src/common → common}/records/tool.record.d.ts +0 -0
- /package/{src/common → common}/schemas/annotated-class.schema.d.ts +0 -0
- /package/{src/common → common}/schemas/http-input.schema.d.ts +0 -0
- /package/{src/common → common}/schemas/index.d.ts +0 -0
- /package/{src/common → common}/schemas/session-header.schema.d.ts +0 -0
- /package/{src/common → common}/tokens/adapter.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/app.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/auth-provider.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/base.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/flow-hook.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/flow.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/front-mcp.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/index.d.ts +0 -0
- /package/{src/common → common}/tokens/logger.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/plugin.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/prompt.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/provider.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/resource.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/server.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/tool.tokens.d.ts +0 -0
- /package/{src/common → common}/types/auth/index.d.ts +0 -0
- /package/{src/common → common}/types/auth/jwt.types.d.ts +0 -0
- /package/{src/common → common}/types/auth/session.types.d.ts +0 -0
- /package/{src/common → common}/types/common.types.d.ts +0 -0
- /package/{src/common → common}/types/index.d.ts +0 -0
- /package/{src/logger/logger.tokens.d.ts → common/types/options/auth/auth.typecheck.d.ts} +0 -0
- /package/{src/common → common}/types/options/http.options.d.ts +0 -0
- /package/{src/common → common}/types/options/logging.options.d.ts +0 -0
- /package/{src/common → common}/types/options/session.options.d.ts +0 -0
- /package/{src/common → common}/utils/path.utils.d.ts +0 -0
- /package/{src/context → context}/frontmcp-context-storage.d.ts +0 -0
- /package/{src/context → context}/frontmcp-context.d.ts +0 -0
- /package/{src/context → context}/frontmcp-context.provider.d.ts +0 -0
- /package/{src/context → context}/index.d.ts +0 -0
- /package/{src/context → context}/request-context-storage.d.ts +0 -0
- /package/{src/context → context}/request-context.d.ts +0 -0
- /package/{src/context → context}/request-context.provider.d.ts +0 -0
- /package/{src/context → context}/session-key.provider.d.ts +0 -0
- /package/{src/context → context}/trace-context.d.ts +0 -0
- /package/{src/errors → errors}/authorization-required.error.d.ts +0 -0
- /package/{src/errors → errors}/error-handler.d.ts +0 -0
- /package/{src/exceptions → exceptions}/mcp-exceptions/session-missing.exception.d.ts +0 -0
- /package/{src/exceptions → exceptions}/mcp-exceptions/unsupported-client-version.exception.d.ts +0 -0
- /package/{src/flows → flows}/flow.instance.d.ts +0 -0
- /package/{src/flows → flows}/flow.registry.d.ts +0 -0
- /package/{src/flows → flows}/flow.stages.d.ts +0 -0
- /package/{src/flows → flows}/flow.utils.d.ts +0 -0
- /package/{src/front-mcp → front-mcp}/front-mcp.d.ts +0 -0
- /package/{src/front-mcp → front-mcp}/front-mcp.tokens.d.ts +0 -0
- /package/{src/front-mcp → front-mcp}/serverless-handler.d.ts +0 -0
- /package/{src/hooks → hooks}/hook.instance.d.ts +0 -0
- /package/{src/hooks → hooks}/hook.registry.d.ts +0 -0
- /package/{src/hooks → hooks}/hooks.utils.d.ts +0 -0
- /package/{src/logger → logger}/instances/instance.console-logger.d.ts +0 -0
- /package/{src/logger → logger}/instances/instance.logger.d.ts +0 -0
- /package/{src/logger → logger}/logger.registry.d.ts +0 -0
- /package/{src/logger → logger}/logger.types.d.ts +0 -0
- /package/{src/logger → logger}/logger.utils.d.ts +0 -0
- /package/{src/mcp-apps → mcp-apps}/csp.d.ts +0 -0
- /package/{src/mcp-apps → mcp-apps}/index.d.ts +0 -0
- /package/{src/mcp-apps → mcp-apps}/schemas.d.ts +0 -0
- /package/{src/mcp-apps → mcp-apps}/template.d.ts +0 -0
- /package/{src/mcp-apps → mcp-apps}/types.d.ts +0 -0
- /package/{src/notification → notification}/index.d.ts +0 -0
- /package/{src/notification → notification}/notification.service.d.ts +0 -0
- /package/{src/plugin → plugin}/plugin.registry.d.ts +0 -0
- /package/{src/plugin → plugin}/plugin.utils.d.ts +0 -0
- /package/{src/prompt → prompt}/index.d.ts +0 -0
- /package/{src/prompt → prompt}/prompt.events.d.ts +0 -0
- /package/{src/prompt → prompt}/prompt.instance.d.ts +0 -0
- /package/{src/prompt → prompt}/prompt.registry.d.ts +0 -0
- /package/{src/prompt → prompt}/prompt.types.d.ts +0 -0
- /package/{src/prompt → prompt}/prompt.utils.d.ts +0 -0
- /package/{src/provider → provider}/provider.registry.d.ts +0 -0
- /package/{src/provider → provider}/provider.types.d.ts +0 -0
- /package/{src/provider → provider}/provider.utils.d.ts +0 -0
- /package/{src/regsitry → regsitry}/index.d.ts +0 -0
- /package/{src/regsitry → regsitry}/registry.base.d.ts +0 -0
- /package/{src/resource → resource}/index.d.ts +0 -0
- /package/{src/resource → resource}/resource.events.d.ts +0 -0
- /package/{src/resource → resource}/resource.instance.d.ts +0 -0
- /package/{src/resource → resource}/resource.registry.d.ts +0 -0
- /package/{src/resource → resource}/resource.types.d.ts +0 -0
- /package/{src/resource → resource}/resource.utils.d.ts +0 -0
- /package/{src/scope → scope}/flows/http.request.flow.d.ts +0 -0
- /package/{src/scope → scope}/index.d.ts +0 -0
- /package/{src/scope → scope}/scope.instance.d.ts +0 -0
- /package/{src/scope → scope}/scope.registry.d.ts +0 -0
- /package/{src/scope → scope}/scope.utils.d.ts +0 -0
- /package/{src/server → server}/adapters/base.host.adapter.d.ts +0 -0
- /package/{src/server → server}/adapters/express.host.adapter.d.ts +0 -0
- /package/{src/server → server}/server.instance.d.ts +0 -0
- /package/{src/server → server}/server.types.d.ts +0 -0
- /package/{src/server → server}/server.validation.d.ts +0 -0
- /package/{src/store → store}/adapters/store.base.adapter.d.ts +0 -0
- /package/{src/store → store}/adapters/store.memory.adapter.d.ts +0 -0
- /package/{src/store → store}/adapters/store.redis.adapter.d.ts +0 -0
- /package/{src/store → store}/store.helpers.d.ts +0 -0
- /package/{src/store → store}/store.registry.d.ts +0 -0
- /package/{src/store → store}/store.tokens.d.ts +0 -0
- /package/{src/store → store}/store.types.d.ts +0 -0
- /package/{src/store → store}/store.utils.d.ts +0 -0
- /package/{src/tool → tool}/tool.events.d.ts +0 -0
- /package/{src/tool → tool}/tool.instance.d.ts +0 -0
- /package/{src/tool → tool}/tool.registry.d.ts +0 -0
- /package/{src/tool → tool}/tool.types.d.ts +0 -0
- /package/{src/tool → tool}/tool.utils.d.ts +0 -0
- /package/{src/tool → tool}/ui/ui-resource-template.d.ts +0 -0
- /package/{src/transport → transport}/adapters/transport.local.adapter.d.ts +0 -0
- /package/{src/transport → transport}/adapters/transport.sse.adapter.d.ts +0 -0
- /package/{src/transport → transport}/adapters/transport.streamable-http.adapter.d.ts +0 -0
- /package/{src/transport → transport}/flows/handle.sse.flow.d.ts +0 -0
- /package/{src/transport → transport}/flows/handle.stateless-http.flow.d.ts +0 -0
- /package/{src/transport → transport}/flows/handle.streamable-http.flow.d.ts +0 -0
- /package/{src/transport → transport}/legacy/legacy.sse.tranporter.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/Initialized-notification.hanlder.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/call-tool-request.handler.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/initialize-request.handler.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/mcp-handlers.types.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/roots-list-changed-notification.handler.d.ts +0 -0
- /package/{src/transport → transport}/transport.error.d.ts +0 -0
- /package/{src/transport → transport}/transport.event-store.d.ts +0 -0
- /package/{src/transport → transport}/transport.local.d.ts +0 -0
- /package/{src/transport → transport}/transport.remote.d.ts +0 -0
- /package/{src/transport → transport}/transport.types.d.ts +0 -0
- /package/{src/types → types}/drinen-hooks.types.d.ts +0 -0
- /package/{src/types → types}/invoke.type.d.ts +0 -0
- /package/{src/types → types}/token.types.d.ts +0 -0
- /package/{src/utils → utils}/content.utils.d.ts +0 -0
- /package/{src/utils → utils}/index.d.ts +0 -0
- /package/{src/utils → utils}/lineage.utils.d.ts +0 -0
- /package/{src/utils → utils}/metadata.utils.d.ts +0 -0
- /package/{src/utils → utils}/naming.utils.d.ts +0 -0
- /package/{src/utils → utils}/server.utils.d.ts +0 -0
- /package/{src/utils → utils}/string.utils.d.ts +0 -0
- /package/{src/utils → utils}/token.utils.d.ts +0 -0
- /package/{src/utils → utils}/types.utils.d.ts +0 -0
- /package/{src/utils → utils}/uri-template.utils.d.ts +0 -0
- /package/{src/utils → utils}/uri-validation.utils.d.ts +0 -0
|
@@ -1,468 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// file: libs/sdk/src/resource/resource.registry.ts
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
const resource_events_1 = require("./resource.events");
|
|
7
|
-
const resource_utils_1 = require("./resource.utils");
|
|
8
|
-
const regsitry_1 = require("../regsitry");
|
|
9
|
-
const resource_instance_1 = require("./resource.instance");
|
|
10
|
-
const resource_types_1 = require("./resource.types");
|
|
11
|
-
const read_resource_flow_1 = tslib_1.__importDefault(require("./flows/read-resource.flow"));
|
|
12
|
-
const resources_list_flow_1 = tslib_1.__importDefault(require("./flows/resources-list.flow"));
|
|
13
|
-
const resource_templates_list_flow_1 = tslib_1.__importDefault(require("./flows/resource-templates-list.flow"));
|
|
14
|
-
const subscribe_resource_flow_1 = tslib_1.__importDefault(require("./flows/subscribe-resource.flow"));
|
|
15
|
-
const unsubscribe_resource_flow_1 = tslib_1.__importDefault(require("./flows/unsubscribe-resource.flow"));
|
|
16
|
-
class ResourceRegistry extends regsitry_1.RegistryAbstract {
|
|
17
|
-
/** Who owns this registry (used for provenance). */
|
|
18
|
-
owner;
|
|
19
|
-
/** Resources truly owned/constructed by THIS registry (with lineage applied) */
|
|
20
|
-
localRows = [];
|
|
21
|
-
/** Adopted resource rows from each child registry (references to the same instances) */
|
|
22
|
-
adopted = new Map();
|
|
23
|
-
/** Children registries that we track */
|
|
24
|
-
children = new Set();
|
|
25
|
-
// ---- O(1) indexes over EFFECTIVE set (local + adopted) ----
|
|
26
|
-
byQualifiedId = new Map(); // qualifiedId -> row
|
|
27
|
-
byName = new Map(); // baseName -> rows
|
|
28
|
-
byUri = new Map(); // uri -> row (static resources)
|
|
29
|
-
byUriTemplate = new Map(); // uriTemplate -> row (templates)
|
|
30
|
-
byOwnerAndName = new Map(); // "ownerKey:name" -> row
|
|
31
|
-
byOwner = new Map(); // ownerKey -> rows
|
|
32
|
-
// version + emitter
|
|
33
|
-
version = 0;
|
|
34
|
-
emitter = new resource_events_1.ResourceEmitter();
|
|
35
|
-
constructor(providers, list, owner) {
|
|
36
|
-
// disable auto so subclass fields initialize first
|
|
37
|
-
super('ResourceRegistry', providers, list, false);
|
|
38
|
-
this.owner = owner;
|
|
39
|
-
// now it's safe to run the lifecycle
|
|
40
|
-
this.buildGraph();
|
|
41
|
-
this.ready = this.initialize();
|
|
42
|
-
}
|
|
43
|
-
/* -------------------- Build-time: defs + dep checks -------------------- */
|
|
44
|
-
buildMap(list) {
|
|
45
|
-
const tokens = new Set();
|
|
46
|
-
const defs = new Map();
|
|
47
|
-
const graph = new Map();
|
|
48
|
-
for (const raw of list) {
|
|
49
|
-
// Determine if it's a template or static resource
|
|
50
|
-
const isTemplate = (0, resource_utils_1.isResourceTemplate)(raw);
|
|
51
|
-
const rec = isTemplate ? (0, resource_utils_1.normalizeResourceTemplate)(raw) : (0, resource_utils_1.normalizeResource)(raw);
|
|
52
|
-
const provide = rec.provide;
|
|
53
|
-
tokens.add(provide);
|
|
54
|
-
defs.set(provide, rec);
|
|
55
|
-
graph.set(provide, new Set());
|
|
56
|
-
}
|
|
57
|
-
return { tokens, defs, graph };
|
|
58
|
-
}
|
|
59
|
-
buildGraph() {
|
|
60
|
-
for (const token of this.tokens) {
|
|
61
|
-
const rec = this.defs.get(token);
|
|
62
|
-
const deps = (0, resource_utils_1.resourceDiscoveryDeps)(rec);
|
|
63
|
-
for (const d of deps) {
|
|
64
|
-
// Validate against hierarchical providers; throws early if missing
|
|
65
|
-
this.providers.get(d);
|
|
66
|
-
this.graph.get(token).add(d);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
/* -------------------- Initialize: create ONE ResourceInstance per local resource -------------------- */
|
|
71
|
-
async initialize() {
|
|
72
|
-
// Instantiate each local resource once and store in this.instances
|
|
73
|
-
for (const token of this.tokens) {
|
|
74
|
-
const rec = this.defs.get(token);
|
|
75
|
-
// Single, authoritative instance per local resource
|
|
76
|
-
const ri = new resource_instance_1.ResourceInstance(rec, this.providers, this.owner);
|
|
77
|
-
this.instances.set(token, ri);
|
|
78
|
-
const lineage = this.owner ? [this.owner] : [];
|
|
79
|
-
const row = this.makeRow(token, ri, lineage, this);
|
|
80
|
-
this.localRows.push(row);
|
|
81
|
-
}
|
|
82
|
-
// Adopt resources from child app registries
|
|
83
|
-
const childAppRegistries = this.providers.getRegistries('AppRegistry');
|
|
84
|
-
childAppRegistries.forEach((appRegistry) => {
|
|
85
|
-
const apps = appRegistry.getApps();
|
|
86
|
-
for (const app of apps) {
|
|
87
|
-
const appResourceRegistries = app.providers.getRegistries('ResourceRegistry');
|
|
88
|
-
appResourceRegistries
|
|
89
|
-
.filter((r) => r.owner.kind === 'app')
|
|
90
|
-
.forEach((appResourceRegistry) => {
|
|
91
|
-
this.adoptFromChild(appResourceRegistry, appResourceRegistry.owner);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
// Adopt resources from other child resource registries
|
|
96
|
-
const childResourceRegistries = this.providers.getRegistries('ResourceRegistry');
|
|
97
|
-
childResourceRegistries
|
|
98
|
-
.filter((r) => r !== this)
|
|
99
|
-
.forEach((resourceRegistry) => {
|
|
100
|
-
this.adoptFromChild(resourceRegistry, resourceRegistry.owner);
|
|
101
|
-
});
|
|
102
|
-
// Build effective indexes from (locals + already adopted children)
|
|
103
|
-
this.reindex();
|
|
104
|
-
this.bump('reset');
|
|
105
|
-
// Register resource flows with the scope
|
|
106
|
-
const scope = this.providers.getActiveScope();
|
|
107
|
-
await scope.registryFlows(read_resource_flow_1.default, resources_list_flow_1.default, resource_templates_list_flow_1.default, subscribe_resource_flow_1.default, unsubscribe_resource_flow_1.default);
|
|
108
|
-
}
|
|
109
|
-
/* -------------------- Adoption: reference child instances (no cloning) -------------------- */
|
|
110
|
-
/**
|
|
111
|
-
* Adopt resources from a child registry. Parent runs after children are ready.
|
|
112
|
-
* We *reference* the child's resource instances; no duplicates are created.
|
|
113
|
-
*/
|
|
114
|
-
adoptFromChild(child, _childOwner) {
|
|
115
|
-
if (this.children.has(child))
|
|
116
|
-
return;
|
|
117
|
-
const childRows = child.listAllIndexed();
|
|
118
|
-
const prepend = this.owner ? [this.owner] : [];
|
|
119
|
-
const adoptedRows = childRows.map((r) => this.relineage(r, prepend));
|
|
120
|
-
this.adopted.set(child, adoptedRows);
|
|
121
|
-
this.children.add(child);
|
|
122
|
-
// keep live if child changes
|
|
123
|
-
child.subscribe({ immediate: false }, () => {
|
|
124
|
-
const latest = child.listAllIndexed().map((r) => this.relineage(r, prepend));
|
|
125
|
-
this.adopted.set(child, latest);
|
|
126
|
-
this.reindex();
|
|
127
|
-
this.bump('reset');
|
|
128
|
-
});
|
|
129
|
-
this.reindex();
|
|
130
|
-
this.bump('reset');
|
|
131
|
-
}
|
|
132
|
-
/* -------------------- Public API -------------------- */
|
|
133
|
-
/**
|
|
134
|
-
* Get all static resources (not templates)
|
|
135
|
-
*/
|
|
136
|
-
getResources(includeHidden = false) {
|
|
137
|
-
const all = this.listAllIndexed();
|
|
138
|
-
return all
|
|
139
|
-
.filter((r) => !r.isTemplate)
|
|
140
|
-
.filter((r) => {
|
|
141
|
-
const meta = r.instance.metadata;
|
|
142
|
-
const hidden = 'hideFromDiscovery' in meta && meta.hideFromDiscovery === true;
|
|
143
|
-
return !hidden || includeHidden;
|
|
144
|
-
})
|
|
145
|
-
.map((r) => r.instance);
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Get all resource templates
|
|
149
|
-
*/
|
|
150
|
-
getResourceTemplates() {
|
|
151
|
-
const all = this.listAllIndexed();
|
|
152
|
-
return all.filter((r) => r.isTemplate).map((r) => r.instance);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Get inline resources (local only)
|
|
156
|
-
*/
|
|
157
|
-
getInlineResources() {
|
|
158
|
-
return [...this.instances.values()];
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Find a resource by exact URI match
|
|
162
|
-
*/
|
|
163
|
-
findByUri(uri) {
|
|
164
|
-
const row = this.byUri.get(uri);
|
|
165
|
-
return row?.instance;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Match a URI against template resources and extract parameters
|
|
169
|
-
*/
|
|
170
|
-
matchTemplateByUri(uri) {
|
|
171
|
-
// Try each template resource
|
|
172
|
-
for (const row of this.listAllIndexed()) {
|
|
173
|
-
if (!row.isTemplate)
|
|
174
|
-
continue;
|
|
175
|
-
const match = row.instance.matchUri(uri);
|
|
176
|
-
if (match.matches) {
|
|
177
|
-
return { instance: row.instance, params: match.params };
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return undefined;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Find a resource by URI - tries exact match first, then template matching
|
|
184
|
-
*/
|
|
185
|
-
findResourceForUri(uri) {
|
|
186
|
-
// Try exact URI match first
|
|
187
|
-
const exact = this.findByUri(uri);
|
|
188
|
-
if (exact) {
|
|
189
|
-
return { instance: exact, params: {} };
|
|
190
|
-
}
|
|
191
|
-
// Try template matching
|
|
192
|
-
return this.matchTemplateByUri(uri);
|
|
193
|
-
}
|
|
194
|
-
/** Internal snapshot of effective indexed rows (locals + adopted). */
|
|
195
|
-
listAllIndexed() {
|
|
196
|
-
return [...this.localRows, ...[...this.adopted.values()].flat()];
|
|
197
|
-
}
|
|
198
|
-
/** List all instances (locals + adopted). */
|
|
199
|
-
listAllInstances() {
|
|
200
|
-
return this.listAllIndexed().map((r) => r.instance);
|
|
201
|
-
}
|
|
202
|
-
/** List instances by owner path (e.g. "app:Portal/plugin:Okta") */
|
|
203
|
-
listByOwner(ownerPath) {
|
|
204
|
-
return (this.byOwner.get(ownerPath) ?? []).map((r) => r.instance);
|
|
205
|
-
}
|
|
206
|
-
/* -------------------- Indexing & lookups -------------------- */
|
|
207
|
-
reindex() {
|
|
208
|
-
const effective = this.listAllIndexed();
|
|
209
|
-
this.byQualifiedId.clear();
|
|
210
|
-
this.byName.clear();
|
|
211
|
-
this.byUri.clear();
|
|
212
|
-
this.byUriTemplate.clear();
|
|
213
|
-
this.byOwnerAndName.clear();
|
|
214
|
-
this.byOwner.clear();
|
|
215
|
-
for (const r of effective) {
|
|
216
|
-
this.byQualifiedId.set(r.qualifiedId, r);
|
|
217
|
-
const listByName = this.byName.get(r.baseName) ?? [];
|
|
218
|
-
listByName.push(r);
|
|
219
|
-
this.byName.set(r.baseName, listByName);
|
|
220
|
-
const byOwnerKey = this.byOwner.get(r.ownerKey) ?? [];
|
|
221
|
-
byOwnerKey.push(r);
|
|
222
|
-
this.byOwner.set(r.ownerKey, byOwnerKey);
|
|
223
|
-
const on = `${r.ownerKey}:${r.baseName}`;
|
|
224
|
-
if (!this.byOwnerAndName.has(on))
|
|
225
|
-
this.byOwnerAndName.set(on, r);
|
|
226
|
-
// Index by URI or URI template
|
|
227
|
-
if (r.isTemplate && r.uriTemplate) {
|
|
228
|
-
this.byUriTemplate.set(r.uriTemplate, r);
|
|
229
|
-
}
|
|
230
|
-
else if (r.uri) {
|
|
231
|
-
this.byUri.set(r.uri, r);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
/* -------------------- Conflict-aware exported names -------------------- */
|
|
236
|
-
/**
|
|
237
|
-
* Produce unique, MCP-valid exported names.
|
|
238
|
-
*/
|
|
239
|
-
exportResolvedNames(opts) {
|
|
240
|
-
const cfg = { ...resource_types_1.DEFAULT_RESOURCE_EXPORT_OPTS, ...(opts ?? {}) };
|
|
241
|
-
const rows = this.listAllIndexed().map((r) => {
|
|
242
|
-
const base = (0, resource_utils_1.normalizeSegment)(r.baseName, cfg.case);
|
|
243
|
-
const isLocal = r.source === this;
|
|
244
|
-
const provider = (0, resource_utils_1.normalizeProviderId)(this.providerIdOf(r.instance), cfg.case);
|
|
245
|
-
const ownerPath = (0, resource_utils_1.normalizeOwnerPath)(r.ownerKey, cfg.case);
|
|
246
|
-
return { base, row: r, isLocal, provider, ownerPath };
|
|
247
|
-
});
|
|
248
|
-
// group by standardized base
|
|
249
|
-
const byBase = new Map();
|
|
250
|
-
for (const r of rows) {
|
|
251
|
-
const list = byBase.get(r.base) ?? [];
|
|
252
|
-
list.push(r);
|
|
253
|
-
byBase.set(r.base, list);
|
|
254
|
-
}
|
|
255
|
-
const out = new Map();
|
|
256
|
-
for (const [base, group] of byBase.entries()) {
|
|
257
|
-
if (group.length === 1) {
|
|
258
|
-
const g = group[0];
|
|
259
|
-
out.set((0, resource_utils_1.ensureMaxLen)(base, cfg.maxLen), g.row.instance);
|
|
260
|
-
continue;
|
|
261
|
-
}
|
|
262
|
-
const locals = group.filter((g) => g.isLocal);
|
|
263
|
-
const children = group.filter((g) => !g.isLocal);
|
|
264
|
-
if (cfg.prefixChildrenOnConflict && locals.length > 0) {
|
|
265
|
-
// Locals
|
|
266
|
-
if (locals.length === 1) {
|
|
267
|
-
const localName = (0, resource_utils_1.ensureMaxLen)(base, cfg.maxLen);
|
|
268
|
-
out.set(disambiguate(localName, out, cfg), locals[0].row.instance);
|
|
269
|
-
}
|
|
270
|
-
else {
|
|
271
|
-
for (const l of locals) {
|
|
272
|
-
const pref = (0, resource_utils_1.normalizeOwnerPath)(l.ownerPath, cfg.case);
|
|
273
|
-
const name = (0, resource_utils_1.ensureMaxLen)(`${pref}${(0, resource_utils_1.sepFor)(cfg.case)}${base}`, cfg.maxLen);
|
|
274
|
-
out.set(disambiguate(name, out, cfg), l.row.instance);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
// Children
|
|
278
|
-
for (const c of children) {
|
|
279
|
-
const pre = cfg.prefixSource === 'provider' ? c.provider ?? c.ownerPath : c.ownerPath;
|
|
280
|
-
const name = (0, resource_utils_1.ensureMaxLen)(`${pre}${(0, resource_utils_1.sepFor)(cfg.case)}${base}`, cfg.maxLen);
|
|
281
|
-
out.set(disambiguate(name, out, cfg), c.row.instance);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
else {
|
|
285
|
-
// Prefix everyone by source
|
|
286
|
-
for (const r of group) {
|
|
287
|
-
const pre = cfg.prefixSource === 'provider' ? r.provider ?? r.ownerPath : r.ownerPath;
|
|
288
|
-
const name = (0, resource_utils_1.ensureMaxLen)(`${pre}${(0, resource_utils_1.sepFor)(cfg.case)}${base}`, cfg.maxLen);
|
|
289
|
-
out.set(disambiguate(name, out, cfg), r.row.instance);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
return [...out.entries()].sort((a, b) => a[0].localeCompare(b[0])).map(([name, instance]) => ({ name, instance }));
|
|
294
|
-
function disambiguate(candidate, pool, cfg) {
|
|
295
|
-
if (!pool.has(candidate))
|
|
296
|
-
return candidate;
|
|
297
|
-
const maxAttempts = 10000;
|
|
298
|
-
let n = 2;
|
|
299
|
-
while (n <= maxAttempts) {
|
|
300
|
-
const withN = (0, resource_utils_1.ensureMaxLen)(`${candidate}${(0, resource_utils_1.sepFor)(cfg.case)}${n}`, cfg.maxLen);
|
|
301
|
-
if (!pool.has(withN))
|
|
302
|
-
return withN;
|
|
303
|
-
n++;
|
|
304
|
-
}
|
|
305
|
-
throw new Error(`Failed to disambiguate name "${candidate}" after ${maxAttempts} attempts`);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
/** Lookup by the exported (resolved) name. */
|
|
309
|
-
getExported(name, opts) {
|
|
310
|
-
const pairs = this.exportResolvedNames(opts);
|
|
311
|
-
return pairs.find((p) => p.name === name)?.instance;
|
|
312
|
-
}
|
|
313
|
-
/* -------------------- Subscriptions -------------------- */
|
|
314
|
-
subscribe(opts, cb) {
|
|
315
|
-
const filter = opts.filter ?? (() => true);
|
|
316
|
-
if (opts.immediate) {
|
|
317
|
-
cb({
|
|
318
|
-
kind: 'reset',
|
|
319
|
-
changeScope: 'global',
|
|
320
|
-
version: this.version,
|
|
321
|
-
snapshot: this.listAllInstances().filter(filter),
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
return this.emitter.on((e) => cb({ ...e, snapshot: this.listAllInstances().filter(filter) }));
|
|
325
|
-
}
|
|
326
|
-
bump(kind) {
|
|
327
|
-
const version = ++this.version;
|
|
328
|
-
this.emitter.emit({ kind, changeScope: 'global', version, snapshot: this.listAllInstances() });
|
|
329
|
-
}
|
|
330
|
-
/* -------------------- Helpers -------------------- */
|
|
331
|
-
/** Build an IndexedResource row */
|
|
332
|
-
makeRow(token, instance, lineage, source) {
|
|
333
|
-
const ownerKey = (0, resource_utils_1.ownerKeyOf)(lineage);
|
|
334
|
-
const baseName = instance.name;
|
|
335
|
-
const qualifiedName = (0, resource_utils_1.qualifiedNameOf)(lineage, baseName);
|
|
336
|
-
const qualifiedId = `${ownerKey}:${(0, utils_1.tokenName)(token)}`;
|
|
337
|
-
return {
|
|
338
|
-
token,
|
|
339
|
-
instance,
|
|
340
|
-
baseName,
|
|
341
|
-
uri: instance.uri,
|
|
342
|
-
uriTemplate: instance.uriTemplate,
|
|
343
|
-
isTemplate: instance.isTemplate,
|
|
344
|
-
lineage,
|
|
345
|
-
ownerKey,
|
|
346
|
-
qualifiedName,
|
|
347
|
-
qualifiedId,
|
|
348
|
-
source,
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
/** Clone a child row and prepend lineage (with adjacent de-dup to avoid double prefixes). */
|
|
352
|
-
relineage(row, prepend) {
|
|
353
|
-
const merged = [...prepend, ...row.lineage];
|
|
354
|
-
const lineage = dedupLineage(merged);
|
|
355
|
-
const ownerKey = (0, resource_utils_1.ownerKeyOf)(lineage);
|
|
356
|
-
const qualifiedName = (0, resource_utils_1.qualifiedNameOf)(lineage, row.baseName);
|
|
357
|
-
const qualifiedId = `${ownerKey}:${(0, utils_1.tokenName)(row.token)}`;
|
|
358
|
-
return {
|
|
359
|
-
token: row.token,
|
|
360
|
-
instance: row.instance, // REFERENCE the same instance
|
|
361
|
-
baseName: row.baseName,
|
|
362
|
-
uri: row.uri,
|
|
363
|
-
uriTemplate: row.uriTemplate,
|
|
364
|
-
isTemplate: row.isTemplate,
|
|
365
|
-
lineage,
|
|
366
|
-
ownerKey,
|
|
367
|
-
qualifiedName,
|
|
368
|
-
qualifiedId,
|
|
369
|
-
source: row.source, // keep original source (who constructed instance)
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
/** Best-effort provider id used for prefixing. */
|
|
373
|
-
providerIdOf(inst) {
|
|
374
|
-
try {
|
|
375
|
-
const meta = inst.getMetadata?.();
|
|
376
|
-
if (!meta || typeof meta !== 'object')
|
|
377
|
-
return undefined;
|
|
378
|
-
const metaObj = meta;
|
|
379
|
-
const maybe = metaObj['providerId'] ?? metaObj['provider'] ?? metaObj['ownerId'];
|
|
380
|
-
if (typeof maybe === 'string' && maybe.length > 0)
|
|
381
|
-
return maybe;
|
|
382
|
-
const cls = metaObj['cls'];
|
|
383
|
-
if (cls && typeof cls === 'function') {
|
|
384
|
-
const id = (0, utils_1.getMetadata)('id', cls);
|
|
385
|
-
if (typeof id === 'string' && id.length > 0)
|
|
386
|
-
return id;
|
|
387
|
-
if ('name' in cls && typeof cls.name === 'string')
|
|
388
|
-
return cls.name;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
catch {
|
|
392
|
-
/* ignore */
|
|
393
|
-
}
|
|
394
|
-
return undefined;
|
|
395
|
-
}
|
|
396
|
-
/** True if this registry (or adopted children) has any resources. */
|
|
397
|
-
hasAny() {
|
|
398
|
-
return this.listAllIndexed().length > 0 || this.tokens.size > 0;
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Get the MCP capabilities for resources.
|
|
402
|
-
* These are reported to clients during initialization.
|
|
403
|
-
*/
|
|
404
|
-
getCapabilities() {
|
|
405
|
-
return this.hasAny()
|
|
406
|
-
? {
|
|
407
|
-
resources: {
|
|
408
|
-
// Subscription support per MCP 2025-11-25 spec
|
|
409
|
-
subscribe: true,
|
|
410
|
-
// List change notifications are only supported when resources are registered
|
|
411
|
-
listChanged: true,
|
|
412
|
-
},
|
|
413
|
-
}
|
|
414
|
-
: {};
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* Dynamically register a resource or resource template at runtime.
|
|
418
|
-
*
|
|
419
|
-
* Used for system resources like the ui:// template that should be
|
|
420
|
-
* registered when tools with UI configs exist.
|
|
421
|
-
*
|
|
422
|
-
* @param resourceDef - Resource class, function, or template to register
|
|
423
|
-
*/
|
|
424
|
-
registerDynamicResource(resourceDef) {
|
|
425
|
-
const isTemplate = (0, resource_utils_1.isResourceTemplate)(resourceDef);
|
|
426
|
-
const rec = isTemplate ? (0, resource_utils_1.normalizeResourceTemplate)(resourceDef) : (0, resource_utils_1.normalizeResource)(resourceDef);
|
|
427
|
-
const token = rec.provide;
|
|
428
|
-
// Skip if already registered
|
|
429
|
-
if (this.tokens.has(token)) {
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
// Add to registry structures
|
|
433
|
-
this.tokens.add(token);
|
|
434
|
-
this.defs.set(token, rec);
|
|
435
|
-
// Build dependency graph (same pattern as buildGraph)
|
|
436
|
-
const deps = (0, resource_utils_1.resourceDiscoveryDeps)(rec);
|
|
437
|
-
const depSet = new Set();
|
|
438
|
-
for (const d of deps) {
|
|
439
|
-
// Validate against hierarchical providers; throws early if missing
|
|
440
|
-
this.providers.get(d);
|
|
441
|
-
depSet.add(d);
|
|
442
|
-
}
|
|
443
|
-
this.graph.set(token, depSet);
|
|
444
|
-
// Create instance
|
|
445
|
-
const ri = new resource_instance_1.ResourceInstance(rec, this.providers, this.owner);
|
|
446
|
-
this.instances.set(token, ri);
|
|
447
|
-
// Add to local rows with lineage
|
|
448
|
-
const lineage = this.owner ? [this.owner] : [];
|
|
449
|
-
const row = this.makeRow(token, ri, lineage, this);
|
|
450
|
-
this.localRows.push(row);
|
|
451
|
-
// Rebuild indexes and emit change event
|
|
452
|
-
this.reindex();
|
|
453
|
-
this.bump('reset');
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
exports.default = ResourceRegistry;
|
|
457
|
-
/* -------------------- lineage utility -------------------- */
|
|
458
|
-
/** Remove only adjacent duplicates like [adapter:x, adapter:x] → [adapter:x] */
|
|
459
|
-
function dedupLineage(l) {
|
|
460
|
-
const out = [];
|
|
461
|
-
for (const o of l) {
|
|
462
|
-
const last = out[out.length - 1];
|
|
463
|
-
if (!last || last.kind !== o.kind || last.id !== o.id)
|
|
464
|
-
out.push(o);
|
|
465
|
-
}
|
|
466
|
-
return out;
|
|
467
|
-
}
|
|
468
|
-
//# sourceMappingURL=resource.registry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resource.registry.js","sourceRoot":"","sources":["../../../src/resource/resource.registry.ts"],"names":[],"mappings":";AAAA,mDAAmD;;;AAYnD,oCAAkD;AAClD,uDAAyE;AAEzE,qDAY0B;AAC1B,0CAAuE;AACvE,2DAAuD;AACvD,qDAAwG;AACxG,4FAA0D;AAC1D,8FAA4D;AAC5D,gHAA6E;AAC7E,sGAAoE;AACpE,0GAAwE;AAGxE,MAAqB,gBACnB,SAAQ,2BAIP;IAGD,oDAAoD;IACpD,KAAK,CAAgB;IAErB,gFAAgF;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libs/sdk/src/resource/resource.registry.ts\n\nimport {\n EntryLineage,\n EntryOwnerRef,\n Token,\n ResourceEntry,\n ResourceRecord,\n ResourceTemplateRecord,\n ResourceRegistryInterface,\n ResourceType,\n} from '../common';\nimport { getMetadata, tokenName } from '../utils';\nimport { ResourceChangeEvent, ResourceEmitter } from './resource.events';\nimport ProviderRegistry from '../provider/provider.registry';\nimport {\n ensureMaxLen,\n normalizeOwnerPath,\n normalizeProviderId,\n normalizeSegment,\n normalizeResource,\n normalizeResourceTemplate,\n isResourceTemplate,\n ownerKeyOf,\n qualifiedNameOf,\n sepFor,\n resourceDiscoveryDeps,\n} from './resource.utils';\nimport { RegistryAbstract, RegistryBuildMapResult } from '../regsitry';\nimport { ResourceInstance } from './resource.instance';\nimport { DEFAULT_RESOURCE_EXPORT_OPTS, ResourceExportOptions, IndexedResource } from './resource.types';\nimport ReadResourceFlow from './flows/read-resource.flow';\nimport ResourcesListFlow from './flows/resources-list.flow';\nimport ResourceTemplatesListFlow from './flows/resource-templates-list.flow';\nimport SubscribeResourceFlow from './flows/subscribe-resource.flow';\nimport UnsubscribeResourceFlow from './flows/unsubscribe-resource.flow';\nimport type { ServerCapabilities } from '@modelcontextprotocol/sdk/types.js';\n\nexport default class ResourceRegistry\n extends RegistryAbstract<\n ResourceInstance, // instances map holds ResourceInstance\n ResourceRecord | ResourceTemplateRecord,\n ResourceType[]\n >\n implements ResourceRegistryInterface\n{\n /** Who owns this registry (used for provenance). */\n owner: EntryOwnerRef;\n\n /** Resources truly owned/constructed by THIS registry (with lineage applied) */\n private localRows: IndexedResource[] = [];\n\n /** Adopted resource rows from each child registry (references to the same instances) */\n private adopted = new Map<ResourceRegistry, IndexedResource[]>();\n\n /** Children registries that we track */\n private children = new Set<ResourceRegistry>();\n\n // ---- O(1) indexes over EFFECTIVE set (local + adopted) ----\n private byQualifiedId = new Map<string, IndexedResource>(); // qualifiedId -> row\n private byName = new Map<string, IndexedResource[]>(); // baseName -> rows\n private byUri = new Map<string, IndexedResource>(); // uri -> row (static resources)\n private byUriTemplate = new Map<string, IndexedResource>(); // uriTemplate -> row (templates)\n private byOwnerAndName = new Map<string, IndexedResource>(); // \"ownerKey:name\" -> row\n private byOwner = new Map<string, IndexedResource[]>(); // ownerKey -> rows\n\n // version + emitter\n private version = 0;\n private emitter = new ResourceEmitter();\n\n constructor(providers: ProviderRegistry, list: ResourceType[], owner: EntryOwnerRef) {\n // disable auto so subclass fields initialize first\n super('ResourceRegistry', providers, list, false);\n this.owner = owner;\n\n // now it's safe to run the lifecycle\n this.buildGraph();\n this.ready = this.initialize();\n }\n\n /* -------------------- Build-time: defs + dep checks -------------------- */\n\n protected override buildMap(list: ResourceType[]): RegistryBuildMapResult<ResourceRecord | ResourceTemplateRecord> {\n const tokens = new Set<Token>();\n const defs = new Map<Token, ResourceRecord | ResourceTemplateRecord>();\n const graph = new Map<Token, Set<Token>>();\n\n for (const raw of list) {\n // Determine if it's a template or static resource\n const isTemplate = isResourceTemplate(raw);\n const rec = isTemplate ? normalizeResourceTemplate(raw) : normalizeResource(raw);\n\n const provide = rec.provide;\n tokens.add(provide);\n defs.set(provide, rec);\n graph.set(provide, new Set());\n }\n return { tokens, defs, graph };\n }\n\n protected buildGraph() {\n for (const token of this.tokens) {\n const rec = this.defs.get(token)!;\n const deps = resourceDiscoveryDeps(rec);\n\n for (const d of deps) {\n // Validate against hierarchical providers; throws early if missing\n this.providers.get(d);\n this.graph.get(token)!.add(d);\n }\n }\n }\n\n /* -------------------- Initialize: create ONE ResourceInstance per local resource -------------------- */\n\n protected override async initialize(): Promise<void> {\n // Instantiate each local resource once and store in this.instances\n for (const token of this.tokens) {\n const rec = this.defs.get(token)!;\n\n // Single, authoritative instance per local resource\n const ri = new ResourceInstance(rec, this.providers, this.owner);\n this.instances.set(token as Token<ResourceInstance>, ri);\n\n const lineage: EntryLineage = this.owner ? [this.owner] : [];\n const row = this.makeRow(token, ri, lineage, this);\n this.localRows.push(row);\n }\n\n // Adopt resources from child app registries\n const childAppRegistries = this.providers.getRegistries('AppRegistry');\n childAppRegistries.forEach((appRegistry) => {\n const apps = appRegistry.getApps();\n for (const app of apps) {\n const appResourceRegistries = app.providers.getRegistries('ResourceRegistry');\n appResourceRegistries\n .filter((r) => r.owner.kind === 'app')\n .forEach((appResourceRegistry) => {\n this.adoptFromChild(appResourceRegistry as ResourceRegistry, appResourceRegistry.owner);\n });\n }\n });\n\n // Adopt resources from other child resource registries\n const childResourceRegistries = this.providers.getRegistries('ResourceRegistry');\n childResourceRegistries\n .filter((r) => r !== this)\n .forEach((resourceRegistry) => {\n this.adoptFromChild(resourceRegistry as ResourceRegistry, resourceRegistry.owner);\n });\n\n // Build effective indexes from (locals + already adopted children)\n this.reindex();\n this.bump('reset');\n\n // Register resource flows with the scope\n const scope = this.providers.getActiveScope();\n await scope.registryFlows(\n ReadResourceFlow,\n ResourcesListFlow,\n ResourceTemplatesListFlow,\n SubscribeResourceFlow,\n UnsubscribeResourceFlow,\n );\n }\n\n /* -------------------- Adoption: reference child instances (no cloning) -------------------- */\n\n /**\n * Adopt resources from a child registry. Parent runs after children are ready.\n * We *reference* the child's resource instances; no duplicates are created.\n */\n adoptFromChild(child: ResourceRegistry, _childOwner: EntryOwnerRef): void {\n if (this.children.has(child)) return;\n\n const childRows = child.listAllIndexed();\n const prepend: EntryLineage = this.owner ? [this.owner] : [];\n\n const adoptedRows = childRows.map((r) => this.relineage(r, prepend));\n\n this.adopted.set(child, adoptedRows);\n this.children.add(child);\n\n // keep live if child changes\n child.subscribe({ immediate: false }, () => {\n const latest = child.listAllIndexed().map((r) => this.relineage(r, prepend));\n this.adopted.set(child, latest);\n this.reindex();\n this.bump('reset');\n });\n\n this.reindex();\n this.bump('reset');\n }\n\n /* -------------------- Public API -------------------- */\n\n /**\n * Get all static resources (not templates)\n */\n getResources(includeHidden = false): ResourceEntry[] {\n const all = this.listAllIndexed();\n return all\n .filter((r) => !r.isTemplate)\n .filter((r) => {\n const meta = r.instance.metadata;\n const hidden = 'hideFromDiscovery' in meta && meta.hideFromDiscovery === true;\n return !hidden || includeHidden;\n })\n .map((r) => r.instance);\n }\n\n /**\n * Get all resource templates\n */\n getResourceTemplates(): ResourceEntry[] {\n const all = this.listAllIndexed();\n return all.filter((r) => r.isTemplate).map((r) => r.instance);\n }\n\n /**\n * Get inline resources (local only)\n */\n getInlineResources(): ResourceEntry[] {\n return [...this.instances.values()];\n }\n\n /**\n * Find a resource by exact URI match\n */\n findByUri(uri: string): ResourceInstance | undefined {\n const row = this.byUri.get(uri);\n return row?.instance;\n }\n\n /**\n * Match a URI against template resources and extract parameters\n */\n matchTemplateByUri(uri: string): { instance: ResourceInstance; params: Record<string, string> } | undefined {\n // Try each template resource\n for (const row of this.listAllIndexed()) {\n if (!row.isTemplate) continue;\n\n const match = row.instance.matchUri(uri);\n if (match.matches) {\n return { instance: row.instance, params: match.params };\n }\n }\n return undefined;\n }\n\n /**\n * Find a resource by URI - tries exact match first, then template matching\n */\n findResourceForUri(uri: string): { instance: ResourceInstance; params: Record<string, string> } | undefined {\n // Try exact URI match first\n const exact = this.findByUri(uri);\n if (exact) {\n return { instance: exact, params: {} };\n }\n\n // Try template matching\n return this.matchTemplateByUri(uri);\n }\n\n /** Internal snapshot of effective indexed rows (locals + adopted). */\n listAllIndexed(): IndexedResource[] {\n return [...this.localRows, ...[...this.adopted.values()].flat()];\n }\n\n /** List all instances (locals + adopted). */\n listAllInstances(): readonly ResourceInstance[] {\n return this.listAllIndexed().map((r) => r.instance);\n }\n\n /** List instances by owner path (e.g. \"app:Portal/plugin:Okta\") */\n listByOwner(ownerPath: string): readonly ResourceInstance[] {\n return (this.byOwner.get(ownerPath) ?? []).map((r) => r.instance);\n }\n\n /* -------------------- Indexing & lookups -------------------- */\n\n private reindex() {\n const effective = this.listAllIndexed();\n\n this.byQualifiedId.clear();\n this.byName.clear();\n this.byUri.clear();\n this.byUriTemplate.clear();\n this.byOwnerAndName.clear();\n this.byOwner.clear();\n\n for (const r of effective) {\n this.byQualifiedId.set(r.qualifiedId, r);\n\n const listByName = this.byName.get(r.baseName) ?? [];\n listByName.push(r);\n this.byName.set(r.baseName, listByName);\n\n const byOwnerKey = this.byOwner.get(r.ownerKey) ?? [];\n byOwnerKey.push(r);\n this.byOwner.set(r.ownerKey, byOwnerKey);\n\n const on = `${r.ownerKey}:${r.baseName}`;\n if (!this.byOwnerAndName.has(on)) this.byOwnerAndName.set(on, r);\n\n // Index by URI or URI template\n if (r.isTemplate && r.uriTemplate) {\n this.byUriTemplate.set(r.uriTemplate, r);\n } else if (r.uri) {\n this.byUri.set(r.uri, r);\n }\n }\n }\n\n /* -------------------- Conflict-aware exported names -------------------- */\n\n /**\n * Produce unique, MCP-valid exported names.\n */\n exportResolvedNames(opts?: ResourceExportOptions): Array<{ name: string; instance: ResourceInstance }> {\n const cfg = { ...DEFAULT_RESOURCE_EXPORT_OPTS, ...(opts ?? {}) };\n\n const rows = this.listAllIndexed().map((r) => {\n const base = normalizeSegment(r.baseName, cfg.case);\n const isLocal = r.source === this;\n const provider = normalizeProviderId(this.providerIdOf(r.instance), cfg.case);\n const ownerPath = normalizeOwnerPath(r.ownerKey, cfg.case);\n return { base, row: r, isLocal, provider, ownerPath };\n });\n\n // group by standardized base\n const byBase = new Map<string, typeof rows>();\n for (const r of rows) {\n const list = byBase.get(r.base) ?? [];\n list.push(r);\n byBase.set(r.base, list);\n }\n\n const out = new Map<string, ResourceInstance>();\n\n for (const [base, group] of byBase.entries()) {\n if (group.length === 1) {\n const g = group[0];\n out.set(ensureMaxLen(base, cfg.maxLen), g.row.instance);\n continue;\n }\n\n const locals = group.filter((g) => g.isLocal);\n const children = group.filter((g) => !g.isLocal);\n\n if (cfg.prefixChildrenOnConflict && locals.length > 0) {\n // Locals\n if (locals.length === 1) {\n const localName = ensureMaxLen(base, cfg.maxLen);\n out.set(disambiguate(localName, out, cfg), locals[0].row.instance);\n } else {\n for (const l of locals) {\n const pref = normalizeOwnerPath(l.ownerPath, cfg.case);\n const name = ensureMaxLen(`${pref}${sepFor(cfg.case)}${base}`, cfg.maxLen);\n out.set(disambiguate(name, out, cfg), l.row.instance);\n }\n }\n\n // Children\n for (const c of children) {\n const pre = cfg.prefixSource === 'provider' ? c.provider ?? c.ownerPath : c.ownerPath;\n const name = ensureMaxLen(`${pre}${sepFor(cfg.case)}${base}`, cfg.maxLen);\n out.set(disambiguate(name, out, cfg), c.row.instance);\n }\n } else {\n // Prefix everyone by source\n for (const r of group) {\n const pre = cfg.prefixSource === 'provider' ? r.provider ?? r.ownerPath : r.ownerPath;\n const name = ensureMaxLen(`${pre}${sepFor(cfg.case)}${base}`, cfg.maxLen);\n out.set(disambiguate(name, out, cfg), r.row.instance);\n }\n }\n }\n\n return [...out.entries()].sort((a, b) => a[0].localeCompare(b[0])).map(([name, instance]) => ({ name, instance }));\n\n function disambiguate(candidate: string, pool: Map<string, any>, cfg: Required<ResourceExportOptions>): string {\n if (!pool.has(candidate)) return candidate;\n const maxAttempts = 10000;\n let n = 2;\n while (n <= maxAttempts) {\n const withN = ensureMaxLen(`${candidate}${sepFor(cfg.case)}${n}`, cfg.maxLen);\n if (!pool.has(withN)) return withN;\n n++;\n }\n throw new Error(`Failed to disambiguate name \"${candidate}\" after ${maxAttempts} attempts`);\n }\n }\n\n /** Lookup by the exported (resolved) name. */\n getExported(name: string, opts?: ResourceExportOptions): ResourceInstance | undefined {\n const pairs = this.exportResolvedNames(opts);\n return pairs.find((p) => p.name === name)?.instance;\n }\n\n /* -------------------- Subscriptions -------------------- */\n\n subscribe(\n opts: { immediate?: boolean; filter?: (i: ResourceInstance) => boolean },\n cb: (evt: ResourceChangeEvent) => void,\n ): () => void {\n const filter = opts.filter ?? (() => true);\n if (opts.immediate) {\n cb({\n kind: 'reset',\n changeScope: 'global',\n version: this.version,\n snapshot: this.listAllInstances().filter(filter),\n });\n }\n return this.emitter.on((e) => cb({ ...e, snapshot: this.listAllInstances().filter(filter) }));\n }\n\n private bump(kind: ResourceChangeEvent['kind']) {\n const version = ++this.version;\n this.emitter.emit({ kind, changeScope: 'global', version, snapshot: this.listAllInstances() });\n }\n\n /* -------------------- Helpers -------------------- */\n\n /** Build an IndexedResource row */\n private makeRow(\n token: Token,\n instance: ResourceInstance,\n lineage: EntryLineage,\n source: ResourceRegistry,\n ): IndexedResource {\n const ownerKey = ownerKeyOf(lineage);\n const baseName = instance.name;\n const qualifiedName = qualifiedNameOf(lineage, baseName);\n const qualifiedId = `${ownerKey}:${tokenName(token)}`;\n return {\n token,\n instance,\n baseName,\n uri: instance.uri,\n uriTemplate: instance.uriTemplate,\n isTemplate: instance.isTemplate,\n lineage,\n ownerKey,\n qualifiedName,\n qualifiedId,\n source,\n };\n }\n\n /** Clone a child row and prepend lineage (with adjacent de-dup to avoid double prefixes). */\n private relineage(row: IndexedResource, prepend: EntryLineage): IndexedResource {\n const merged = [...prepend, ...row.lineage];\n const lineage = dedupLineage(merged);\n\n const ownerKey = ownerKeyOf(lineage);\n const qualifiedName = qualifiedNameOf(lineage, row.baseName);\n const qualifiedId = `${ownerKey}:${tokenName(row.token)}`;\n return {\n token: row.token,\n instance: row.instance, // REFERENCE the same instance\n baseName: row.baseName,\n uri: row.uri,\n uriTemplate: row.uriTemplate,\n isTemplate: row.isTemplate,\n lineage,\n ownerKey,\n qualifiedName,\n qualifiedId,\n source: row.source, // keep original source (who constructed instance)\n };\n }\n\n /** Best-effort provider id used for prefixing. */\n private providerIdOf(inst: ResourceInstance): string | undefined {\n try {\n const meta: unknown = inst.getMetadata?.();\n if (!meta || typeof meta !== 'object') return undefined;\n\n const metaObj = meta as Record<string, unknown>;\n const maybe = metaObj['providerId'] ?? metaObj['provider'] ?? metaObj['ownerId'];\n if (typeof maybe === 'string' && maybe.length > 0) return maybe;\n\n const cls = metaObj['cls'];\n if (cls && typeof cls === 'function') {\n const id = getMetadata('id', cls);\n if (typeof id === 'string' && id.length > 0) return id;\n if ('name' in cls && typeof cls.name === 'string') return cls.name;\n }\n } catch {\n /* ignore */\n }\n return undefined;\n }\n\n /** True if this registry (or adopted children) has any resources. */\n hasAny(): boolean {\n return this.listAllIndexed().length > 0 || this.tokens.size > 0;\n }\n\n /**\n * Get the MCP capabilities for resources.\n * These are reported to clients during initialization.\n */\n getCapabilities(): Partial<ServerCapabilities> {\n return this.hasAny()\n ? {\n resources: {\n // Subscription support per MCP 2025-11-25 spec\n subscribe: true,\n // List change notifications are only supported when resources are registered\n listChanged: true,\n },\n }\n : {};\n }\n\n /**\n * Dynamically register a resource or resource template at runtime.\n *\n * Used for system resources like the ui:// template that should be\n * registered when tools with UI configs exist.\n *\n * @param resourceDef - Resource class, function, or template to register\n */\n registerDynamicResource(resourceDef: ResourceType): void {\n const isTemplate = isResourceTemplate(resourceDef);\n const rec = isTemplate ? normalizeResourceTemplate(resourceDef) : normalizeResource(resourceDef);\n const token = rec.provide;\n\n // Skip if already registered\n if (this.tokens.has(token)) {\n return;\n }\n\n // Add to registry structures\n this.tokens.add(token);\n this.defs.set(token, rec);\n\n // Build dependency graph (same pattern as buildGraph)\n const deps = resourceDiscoveryDeps(rec);\n const depSet = new Set<Token>();\n for (const d of deps) {\n // Validate against hierarchical providers; throws early if missing\n this.providers.get(d);\n depSet.add(d);\n }\n this.graph.set(token, depSet);\n\n // Create instance\n const ri = new ResourceInstance(rec, this.providers, this.owner);\n this.instances.set(token as Token<ResourceInstance>, ri);\n\n // Add to local rows with lineage\n const lineage: EntryLineage = this.owner ? [this.owner] : [];\n const row = this.makeRow(token, ri, lineage, this);\n this.localRows.push(row);\n\n // Rebuild indexes and emit change event\n this.reindex();\n this.bump('reset');\n }\n}\n\n/* -------------------- lineage utility -------------------- */\n\n/** Remove only adjacent duplicates like [adapter:x, adapter:x] → [adapter:x] */\nfunction dedupLineage(l: EntryLineage): EntryLineage {\n const out: EntryLineage = [];\n for (const o of l) {\n const last = out[out.length - 1];\n if (!last || last.kind !== o.kind || last.id !== o.id) out.push(o);\n }\n return out;\n}\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// file: libs/sdk/src/resource/resource.types.ts
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.DEFAULT_RESOURCE_EXPORT_OPTS = void 0;
|
|
5
|
-
exports.DEFAULT_RESOURCE_EXPORT_OPTS = {
|
|
6
|
-
case: 'snake',
|
|
7
|
-
maxLen: 64,
|
|
8
|
-
prefixChildrenOnConflict: true,
|
|
9
|
-
prefixSource: 'provider',
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=resource.types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resource.types.js","sourceRoot":"","sources":["../../../src/resource/resource.types.ts"],"names":[],"mappings":";AAAA,gDAAgD;;;AAuDnC,QAAA,4BAA4B,GAAoC;IAC3E,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,EAAE;IACV,wBAAwB,EAAE,IAAI;IAC9B,YAAY,EAAE,UAAU;CACzB,CAAC","sourcesContent":["// file: libs/sdk/src/resource/resource.types.ts\n\nimport { EntryLineage, Token, Type, FuncType } from '../common';\nimport { ResourceInstance } from './resource.instance';\nimport ResourceRegistry from './resource.registry';\nimport type { NameCase } from '../utils/naming.utils';\n\n// ============================================================================\n// Resource Template Type (interface equivalent)\n// ============================================================================\n\nexport interface ResourceTemplateInterface<In = any, Out = any> {\n execute(uri: string, params: Record<string, string>, context: any): Promise<Out>;\n}\n\nexport type ResourceTemplateType<In = any, Out = any> =\n | Type<ResourceTemplateInterface<In, Out>>\n | FuncType<ResourceTemplateInterface<In, Out>>;\n\n// ============================================================================\n// Indexed Resource (for registry internal use)\n// ============================================================================\n\n/** Internal augmented row: instance + provenance + token */\nexport type IndexedResource = {\n token: Token;\n instance: ResourceInstance;\n /** base resource name from metadata (unmodified) */\n baseName: string;\n /** URI for static resources */\n uri?: string;\n /** URI template for template resources */\n uriTemplate?: string;\n /** Whether this is a template resource */\n isTemplate: boolean;\n /** lineage & qualified info */\n lineage: EntryLineage;\n ownerKey: string; // \"app:Portal/plugin:Okta\"\n qualifiedName: string; // \"app:Portal/plugin:Okta:resourceName\"\n qualifiedId: string; // \"app:Portal/plugin:Okta:tokenName(<token>)\"\n /** which registry constructed the instance (the \"owner\" registry) */\n source: ResourceRegistry;\n};\n\n// ============================================================================\n// Export Name Options\n// ============================================================================\n\nexport type ResourceExportOptions = {\n case?: NameCase; // default 'snake'\n maxLen?: number; // default 64\n prefixChildrenOnConflict?: boolean; // default true\n prefixSource?: 'provider' | 'owner'; // default 'provider'\n};\n\nexport const DEFAULT_RESOURCE_EXPORT_OPTS: Required<ResourceExportOptions> = {\n case: 'snake',\n maxLen: 64,\n prefixChildrenOnConflict: true,\n prefixSource: 'provider',\n};\n"]}
|