import { ChangeList } from '../service/transformPage'; import { ToolDefinition, ToolHandler } from '../models/types'; /** * Text instruction that tells the model to return a JSON array of change operations. * Append this to for builders that don't support structured outputs. */ export declare const CHANGE_OPS_FORMAT_INSTRUCTION = "Return a JSON object with two fields: \"message\" and \"changes\".\n\n\"message\" is a brief (1 sentence) message to the user explaining what you changed. It is shown in the chat feed as the assistant's reply \u2014 write it directly to the user, not a description of the JSON.\n\"changes\" is an array of change operations to apply to the page. Do NOT return the full HTML page.\n\nEach change operation must be one of:\n{ \"op\": \"update\", \"nodeId\": \"\", \"html\": \"\" }\n \u2014 replaces the innerHTML of the target element\n\n{ \"op\": \"replace\", \"nodeId\": \"\", \"html\": \"\" }\n \u2014 replaces the entire element (outerHTML) with new markup\n\n{ \"op\": \"delete\", \"nodeId\": \"\" }\n \u2014 removes the element from the page\n\n{ \"op\": \"insert\", \"parentId\": \"\", \"position\": \"prepend\"|\"append\"|\"before\"|\"after\", \"html\": \"\" }\n \u2014 inserts new HTML relative to the parent element\n\n{ \"op\": \"style-element\", \"nodeId\": \"\", \"style\": \"\" }\n \u2014 sets the style attribute of the target element (must be unlocked)\n\n{ \"op\": \"search-replace\", \"nodeId\": \"\", \"search\": \"\", \"replace\": \"\" }\n \u2014 finds exact text within a script/style block and replaces it. Use empty string for replace to delete.\n\n{ \"op\": \"search-insert\", \"nodeId\": \"\", \"after\": \"\", \"content\": \"\" }\n \u2014 inserts new content immediately after the matched text in a script/style block.\n\nFor partial edits to large scripts/styles, use search-replace or search-insert instead of\nreplacing the entire block with update.\nCopy the search/after text exactly as it appears in the source.\nWhen making multiple edits to the same block, ensure each search string targets distinct text.\nTo delete code, use search-replace with an empty replace string.\n\nReturn ONLY the JSON object. Example:\n{\n \"message\": \"Changed the heading and added a new notice.\",\n \"changes\": [\n { \"op\": \"update\", \"nodeId\": \"5\", \"html\": \"

Hello world

\" },\n { \"op\": \"insert\", \"parentId\": \"3\", \"position\": \"append\", \"html\": \"
New message
\" }\n ]\n}"; /** * JSON schema for Anthropic structured outputs. * Wraps the change-ops array in `{ message, changes }` so the model always * emits a user-facing message alongside its page changes. */ export declare const CHANGE_OPS_SCHEMA: Record; /** * Variant of CHANGE_OPS_SCHEMA that omits ranged write operations (search-replace, search-insert). * Used for medium/hard/re-write changes where the model should replace full blocks instead of * attempting partial edits. */ export declare const CHANGE_OPS_SCHEMA_NO_RANGED: Record; /** * Text instruction variant for no-ranged-writes mode. * Tells the model to use `update` for full innerHTML replacement instead of partial edits. */ export declare const CHANGE_OPS_FORMAT_INSTRUCTION_NO_RANGED = "For script and style blocks, use \"update\" to replace the full innerHTML or \"replace\" to replace the full outerHTML. Do NOT use partial search-replace edits."; /** * OpenAI structured outputs require a root-level object. * Matches the Anthropic shape: { message, changes }. */ export declare const OPENAI_CHANGE_OPS_SCHEMA: Record; export type SectionMode = /** Always rendered in full. Never sketched. Used for small/universally relevant sections. */ 'always-full' /** Sketched by default; rendered in full when the classifier expands it. */ | 'classifier-decides' /** Skipped entirely when sketch === null; otherwise sketched/expanded like classifier-decides. */ | 'always-omit-when-empty'; export interface ContextSection { /** Section title, e.g. "", "". Used as the classifier expand-set key. */ title: string; /** Full render — what the model sees when this section is expanded. */ content: string; /** * Compact render — what the classifier sees, and what the model sees when this * section is NOT expanded. `null` means "omit entirely from the prompt when not * expanded" (used by always-omit-when-empty sections that have nothing to say, * or by always-full sections where sketch is irrelevant). */ sketch: string | null; /** Default behavior for this section. Producer-declared. */ mode: SectionMode; /** * If true, this section is always rendered in full on the initial page build, * regardless of classifier output. Defaults to false. */ forceFullOnInitial?: boolean; /** How the model should work with this section (appended to instructions) */ instructions: string; } export type BuilderResult = { kind: 'transforms'; changes: ChangeList; message?: string; } | { kind: 'reply'; text: string; } | { kind: 'error'; error: Error; }; export interface Attachment { mediaType: string; data: string; name?: string; } export interface Builder { run(currentPage: ContextSection, additionalSections: ContextSection[], userMessage: string, newBuild: boolean, attachments?: Attachment[], tools?: ToolDefinition[], toolHandlers?: Record, onToolCall?: (names: string[]) => void): Promise; } //# sourceMappingURL=types.d.ts.map