import type { McpBlockDefinition, McpBlockItem, McpEditableFieldConfig, McpFieldConfig, McpPageState, McpRequestContext, McpServerAdapter } from './types.js'; export type CatalogOption = { key: string; type: string; label?: string; default?: string; allowedValues?: string[]; min?: number; max?: number; encoding: string; }; export type CatalogTextField = { name: string; label: string; type: McpEditableFieldConfig['type']; required: boolean; maxLength?: number; }; export type CatalogChildField = { name: string; label: string; cardinality: number; allowedBundles: string[]; }; export type CatalogBundle = { bundle: string; label: string; description?: string; textFields: CatalogTextField[]; /** Non-text props that may be set on creation (defaults from the definition). */ otherProps: string[]; options: CatalogOption[]; childFields: CatalogChildField[]; defaultProps: Record; maxInstances?: number; /** Only allowed inside the subtree of one of these root bundles. */ onlyInside?: string[]; }; export type Catalog = { bundles: Map; fieldConfig: McpFieldConfig[]; scopes: Record; }; export declare function buildCatalog(adapter: McpServerAdapter, ctx: McpRequestContext, definitions: McpBlockDefinition[]): Promise; /** * Index of the blocks of a page state. */ export type StateIndex = { blocks: Map; /** Ordered children of a host field, keyed by `${hostUuid}:${field}`. */ children: Map; }; export declare function indexState(state: McpPageState): StateIndex; export declare function getBundle(catalog: Catalog, bundle: string): CatalogBundle; /** * Get the field config for a host field. */ export declare function getHostFieldConfig(catalog: Catalog, hostType: 'page' | 'block', hostBundle: string, field: string): McpFieldConfig; /** * The single child field of a block bundle, used when the caller omits it. */ export declare function getDefaultChildField(catalog: Catalog, hostType: 'page' | 'block', hostBundle: string): string; export declare function assertAllowedInField(catalog: Catalog, config: McpFieldConfig, bundle: string, rootBundle: string | null): void; /** * Strip everything but a small set of inline/structural tags from markup. * Only `href`, `target` and `rel` survive on links. */ export declare function sanitizeMarkup(html: string): string; /** * Validate and normalize the text field values of a block. */ export declare function normalizeFieldValues(bundle: CatalogBundle, values: Record): Record; /** * Validate and encode option values of a block. */ export declare function normalizeOptions(bundle: CatalogBundle, values: Record): Record;