/** * Shared UI utilities and types * * Internal module to avoid circular imports between index.ts and ui-resource.handler.ts. */ import { type ImportResolver } from '@frontmcp/uipack/resolver'; /** Per-tool resource metadata attached to `ui://widget/{tool}.html` content reads. */ export interface UIResourceMeta { /** * CSP directives the host should apply to the widget iframe. Emitted on * the resource content item's `_meta` so MCP Apps hosts (Claude) actually * honor it — `_meta.ui.csp` on the tool is ignored (#455). */ csp?: { connectDomains?: string[]; resourceDomains?: string[]; }; /** * MCP Apps permissions (future-compatibility slot — currently sourced from * `uiConfig.permissions` if present so it round-trips to the resource). */ permissions?: unknown; } /** Tool UI Registry — manages compiled widgets and rendering. */ export declare class ToolUIRegistry { private widgets; private manifests; private resourceMeta; private resolver?; constructor(resolver?: ImportResolver); getStaticWidget(name: string): string | undefined; hasAny(): boolean; getManifest(toolName: string): Record | undefined; /** * Per-tool resource metadata for the `ui://widget/{tool}.html` content read. * Returns `undefined` when nothing was configured — the handler should * omit `_meta` entirely in that case so MCP clients don't see an empty * object. */ getResourceMeta(toolName: string): UIResourceMeta | undefined; detectUIType(template: unknown): string; compileStaticWidgetAsync(options: Record): Promise; /** * Sync `resourceMeta[toolName]` to the current `uiConfig`. Called before * every render so the entry stays consistent with the latest decorator * state, including the case where a user removes a previously-set * `ui.csp` / `ui.permissions` field on re-compile. */ private updateResourceMetaFromConfig; compileLeanWidgetAsync(options: Record): Promise; compileHybridWidgetAsync(options: Record): Promise; buildHybridComponentPayload(options: Record): Record | undefined; renderAndRegisterAsync(options: Record): Promise<{ meta: Record; }>; } export declare const UI_RESOURCE_SCHEME = "ui"; export declare function isUIResourceUri(uri: string): boolean; export declare function isStaticWidgetUri(uri: string): boolean; export interface ParsedWidgetUri { toolName: string; extension: string; } export declare function parseWidgetUri(uri: string): ParsedWidgetUri | null; export declare function buildStaticWidgetUri(toolName: string): string; export declare function getUIResourceMimeType(_platformOrUri?: string): string; //# sourceMappingURL=ui-shared.d.ts.map