import 'reflect-metadata'; import { ProviderInterface, ProviderType, ProviderScope, Token, ProviderRegistryInterface, ProviderRecord, ProviderInjectedRecord, RegistryKind, RegistryType, ProviderEntry, FrontMcpServer } from '@frontmcp/sdk'; import { RegistryAbstract, RegistryBuildMapResult } from '../regsitry'; import { ProviderViews } from './provider.types'; import { Scope } from '../scope'; import HookRegistry from "../hooks/hook.registry"; export default class ProviderRegistry extends RegistryAbstract implements ProviderRegistryInterface { private readonly parentProviders?; /** used to track which registry provided which token */ private readonly providedBy; /** topo order (deps first) */ private order; private registries; constructor(list: ProviderType[], parentProviders?: ProviderRegistry | undefined); getProviders(): ProviderEntry[]; /** Walk up the registry chain to find a def for a token. */ private lookupDefInHierarchy; /** Resolve a DEFAULT-scoped dependency from the hierarchy, enforcing scope & instantiation. */ private resolveDefaultFromHierarchy; protected buildMap(list: ProviderType[]): RegistryBuildMapResult; protected buildGraph(): void; protected topoSort(): void; /** Incremental instantiation for DEFAULT providers. * - Skips already-built singletons unless force:true. * - Can limit to a subset via onlyTokens. */ protected initialize(opts?: { force?: boolean; onlyTokens?: Iterable; }): Promise; /** Return the live singleton map as a read-only view. No copying. */ getAllSingletons(): ReadonlyMap; discoveryDeps(rec: ProviderRecord): Token[]; invocationTokens(_token: Token, rec: ProviderRecord): Token[]; getScope(rec: ProviderRecord): ProviderScope; private withTimeout; private resolveFactoryArg; /** Build a single DEFAULT-scoped singleton (used by incremental instantiating). */ private initiateOne; private buildIntoStore; private resolveManagedForClass; get(token: Token): T; addRegistry(type: RegistryKind, value: RegistryType): void; getRegistries(type: T): RegistryType[T][]; getHooksRegistry(): HookRegistry; getScopeRegistry(): import("@frontmcp/sdk").ScopeRegistryInterface; /** bootstrap helper: resolve a dependency usable during app bootstrap (must be GLOBAL). */ resolveBootstrapDep(t: Token): Promise; /** Lightweight, synchronous resolver for app-scoped DI. * - If `cls` is a registered DEFAULT provider token, returns the singleton (must be instantiated). * - If `cls` is SCOPED in DI, throws (use getScoped/buildViews instead). * - Otherwise, if `cls` is a constructable class not registered in DI, returns `new cls()`. * If it defines a synchronous init(), it will be invoked (async init() is NOT awaited). */ resolve(cls: any): T; mergeFromRegistry(providedBy: ProviderRegistry, exported: { token: Token; def: ProviderRecord; instance: ProviderEntry; }[]): void; /** * Used by plugins to get the exported provider definitions. */ getProviderInfo(token: Token): { token: import("@frontmcp/sdk").Reference; def: ProviderRecord; instance: ProviderEntry; }; injectProvider(injected: Omit): void; addDynamicProviders(dynamicProviders: ProviderRecord[]): Promise; private getWithParents; getActiveScope(): Scope; getActiveServer(): FrontMcpServer; buildViews(session: string): Promise; }