import { Screen } from '@janbox/storefront-ui/theme'; import { CatalogTemplate, CopilotRequest, NodeRegistry, Snapshot } from '../../../ai'; import { InsertTemplateGroup } from '../sidebar/insert-action'; import { EditorResources } from '../../types'; import { Node, NodeId } from '../../../types'; import { ChatTurn } from './types'; export declare const REPAIR_PREFIX = "The previous proposal failed validation. Fix exactly these issues and resend the whole proposal:\n"; /** Reads the live CraftJS nodes as a snapshot. Not `getSerializedNodes()`, which throws on numeric text. Shares references with craft state; nothing here mutates them. */ export declare function snapshotFromNodes(nodes: Record): Snapshot; /** The direct child of ROOT that is `id` or contains it; `undefined` for ROOT or an unknown id. */ export declare function sectionOf(snapshot: Snapshot, id: string): string | undefined; /** Consumer templates (not the built-in ones) as catalog templates; ones that cannot be converted are skipped. */ export declare function templatesFromGroups(groups: InsertTemplateGroup[] | undefined, registry?: NodeRegistry): CatalogTemplate[]; export type RequestInput = { turns: ChatTurn[]; nodes: Record; selectedId?: NodeId; screen: Screen; resources?: EditorResources; templates: CatalogTemplate[]; registry?: NodeRegistry; }; export declare function buildCopilotRequest(input: RequestInput): { ok: true; request: CopilotRequest; } | { ok: false; error: string; };