import type { AgentAdapter } from './types'; export interface AgentRegistration { id: string; instanceId: string; handle: THandle; adapter: AgentAdapter; } export interface AgentRegistry { register: (registration: AgentRegistration) => void; unregister: (id: string, instanceId: string) => void; /** Resolve a single live registration by `(adapter id, instance id)`. */ get: (id: string, instanceId: string) => AgentRegistration | undefined; /** * Snapshot every currently-mounted registration. Optionally filter by * adapter id (e.g. `list('data-table')` → all live tables). The MCP UI * bridge uses this to answer "which instances exist right now?". */ list: (id?: string) => AgentRegistration[]; /** * Observe mount/unmount events. Returns an unsubscribe function. Fires after * the registry has applied the change, so a `list()` inside the listener * reflects the new state. */ subscribe: (listener: (event: AgentRegistryEvent) => void) => () => void; } /** Emitted by {@link AgentRegistry.subscribe} whenever the registry changes. */ export interface AgentRegistryEvent { type: 'register' | 'unregister'; id: string; instanceId: string; } /** * Reference implementation of {@link AgentRegistry}. The kit ships this so the * platform's MCP UI bridge can mount a working registry with one line: * * ```ts * (globalThis as { __alfadocs_agent?: AgentRegistry }).__alfadocs_agent = * createAgentRegistry(); * ``` * * It keeps a `(id, instanceId)` keyed map and a listener set; it has no React * or DOM dependency, so a host can also drive it from a worker or test. */ export declare function createAgentRegistry(): AgentRegistry; /** * Register a live component instance with the host agent registry, if one * is mounted. No-op when `globalThis.__alfadocs_agent` is undefined, so the * call is safe to add unconditionally inside any kit component. * * Re-registers when `instanceId` or `handle` changes; deregisters on * unmount. */ export declare function useAgentRegistration(adapter: AgentAdapter, handle: THandle | null | undefined, instanceId: string | null | undefined): void; //# sourceMappingURL=registry.d.ts.map