import { type AgentState, type SkillGraph } from "./graph.ts"; import { type ChangeOrigin, type ChangePlanRecord, type ChangeRequestRecord } from "../engine/contracts.ts"; export declare const CHANGE_SCOPES: readonly ["business", "copy", "pages", "direction", "media"]; export type ChangeScope = (typeof CHANGE_SCOPES)[number]; export type FeedbackGrain = "website" | "page" | "section" | "element"; export type FeedbackKind = "nav_behavior" | "nav_styling" | "content" | "media" | "general"; export type FeedbackItem = { grain: FeedbackGrain; text: string; path?: string; sectionId?: string; hook?: string; kind?: FeedbackKind; target?: string; }; export type MemoryDecision = { id: string; status: "current" | "superseded"; kind: "fact" | "media" | "direction" | "copy" | "preference" | "issue"; acceptance?: "proposal" | "provisional" | "accepted"; summary: string; evidence?: string; grain?: FeedbackGrain; path?: string; sectionId?: string; hook?: string; intent?: "positive" | "negative" | "preserve" | "observation"; origin?: "operator" | "agent" | "editor" | "hosted" | "machine" | "human"; target?: string; supersededBy?: string; }; export type SiteMemory = { schemaVersion: 1; seededAt: string; updatedAt: string; businessHash: string; mediaHash: string; directionHash: string; copyHash: string; factIds: string[]; mediaIds: string[]; decisions: MemoryDecision[]; unresolved: string[]; preferences: FeedbackItem[]; pendingRequest?: { requestId: string; scope: string; startedAt: string; }; acceptedRequests?: Array<{ requestId: string; scope: string; acceptedAt: string; }>; }; export type ChangeRequest = { instruction: string; originalRequest: string; scope: ChangeScope; scopes?: ChangeScope[]; affectedNodes?: string[]; isMixed?: boolean; classifiedScope: ChangeScope; overrideScope?: ChangeScope; evidencePath: string; rationale: string; affectedPages: string[]; proposedChanges: string[]; likes: FeedbackItem[]; dislikes: FeedbackItem[]; preserve: FeedbackItem[]; implementationReason?: string; scopeAmendments?: Array<{ at: string; reason: string; before: ChangeScope[]; after: ChangeScope[]; priorRequest: string; }>; shadowProposal?: { scope: ChangeScope; scopes?: ChangeScope[]; affectedNodes?: string[]; isMixed?: boolean; isAmbiguous?: boolean; rationale?: string; confidence?: number; }; plan?: ChangePlanRecord; origin?: ChangeOrigin; }; export type NavLink = { href: string; label: string; }; export type RefineBaseline = { capturedAt: string; layoutHash: string; structuralLayoutHash?: string; themeHash?: string; businessHash: string; mediaHash: string; copyHash: string; directionHash: string; distHash: string; screenshotHash: string; nodes: AgentState["nodes"]; mediaIds: string[]; factIds: string[]; preserve: FeedbackItem[]; navLinks?: NavLink[]; structuredPreserve?: Array<{ text: string; target?: string; baselineText?: string; error?: string; }>; }; export type RefineReport = { schemaVersion: 1; instruction: string; scope: ChangeScope; classifiedScope: ChangeScope; rationale: string; proposedChanges: string[]; changed: string[]; preserved: string[]; before: { layoutHash: string; distHash: string; screenshotHash: string; }; after: { layoutHash: string; distHash: string; screenshotHash: string; }; memoryKeys: string[]; failures: string[]; skippedLayoutRewrite: boolean; }; export declare const START_NODE: Record; export declare function classifyChange(instruction: string): { scope: ChangeScope; scopes: ChangeScope[]; affectedNodes: string[]; isMixed: boolean; isAmbiguous?: boolean; rationale: string; affectedPages: string[]; proposedChanges: string[]; }; export declare function classifyChangeAsync(instruction: string, opts?: { root?: string; client?: import("./jev/client.ts").JevClient; mode?: import("./jev/types.ts").JevMode; overrideScope?: ChangeScope; threshold?: number; signal?: AbortSignal; }): Promise<{ scope: ChangeScope; scopes?: ChangeScope[]; affectedNodes?: string[]; classifiedScope: ChangeScope; rationale: string; affectedPages: string[]; proposedChanges: string[]; isMixed?: boolean; isAmbiguous?: boolean; confidence?: number; jevEvaluated: boolean; shadowProposal?: { scope: ChangeScope; scopes?: ChangeScope[]; affectedNodes?: string[]; isMixed?: boolean; isAmbiguous?: boolean; rationale?: string; confidence?: number; }; }>; export declare function parseFeedback(instruction: string): { likes: FeedbackItem[]; dislikes: FeedbackItem[]; preserve: FeedbackItem[]; }; export declare function affectedNodeIds(graph: SkillGraph, startId: string): Set; export declare function requestNodesFor(scope: ChangeScope): string[]; export declare function seedSiteMemory(root: string): SiteMemory; export declare function loadSiteMemory(root: string): SiteMemory; export declare function updateSiteMemory(root: string, request: ChangeRequest, extras?: { implementationReason?: string; unresolved?: string[]; }): SiteMemory; export declare function extractNavLinks(root: string): NavLink[]; export declare function structuralLayoutHash(root: string): string; export declare function pageTextHash(root: string): string; export type CopyPlanSection = { id: string; heading?: string; body?: string; factIds?: string[]; note?: string; caption?: string; cta?: string; slots?: Record; }; export type CopyPlanPage = { path: string; sections: CopyPlanSection[]; }; export type CopyPlan = { version: 2; storyboardHash?: string; pages: CopyPlanPage[]; }; export declare function escapeHtml(text: string): string; export declare function isSafeUrl(url: string): boolean; export declare function renderInlineMarkdown(text: string): string; export declare function isProtectedParagraph(html: string): boolean; export declare function findBalancedSlot(html: string, slotName: string): { matchStart: number; matchEnd: number; openTag: string; tagName: string; contentStart: number; contentEnd: number; closeTag: string; } | null; export declare function findBalancedElement(html: string, sectionId: string): { matchStart: number; matchEnd: number; openTag: string; tagName: string; contentStart: number; contentEnd: number; closeTag: string; } | null; export declare function applyCopyPlanToPages(root: string): { applied: boolean; modifiedPages: string[]; changes: Array<{ page: string; sectionId: string; heading?: string; body?: string; note?: string; caption?: string; cta?: string; }>; error?: string; }; export declare function captureRefineBaseline(root: string, state: AgentState, preserve: FeedbackItem[]): RefineBaseline; export declare function loadRefineBaseline(root: string, requestId?: string): RefineBaseline | undefined; export declare function beginChange(opts: { root: string; graph: SkillGraph; state: AgentState; instruction: string; scopeFlag?: string; requestId?: string; classified?: { scope: ChangeScope; scopes?: ChangeScope[]; affectedNodes?: string[]; isMixed?: boolean; rationale: string; affectedPages: string[]; proposedChanges: string[]; shadowProposal?: { scope: ChangeScope; scopes?: ChangeScope[]; affectedNodes?: string[]; isMixed?: boolean; isAmbiguous?: boolean; rationale?: string; confidence?: number; }; }; }): ChangeRequest; export declare function restoreUnchangedLayout(root: string, state: AgentState): boolean; export declare function regressionFailures(root: string, requestId?: string): string[]; export declare function writeRefineReport(root: string, opts?: { skippedLayoutRewrite?: boolean; failures?: string[]; requestId?: string; }): RefineReport; export declare function summarizeRefine(root: string): string | undefined; export declare function consumeRefinePending(root: string): boolean; export declare function loadChangeRequest(root: string, requestId?: string): ChangeRequest | undefined; export declare function mergeImplementationReason(root: string, nodeId: string): void; export declare function detectMemoryDrift(root: string): { drifted: boolean; driftedFiles: string[]; details: string[]; }; export type PrepareRefineResult = { requestId: string; scope: ChangeScope; scopes: ChangeScope[]; classifiedScope: ChangeScope; rationale: string; affectedPages: string[]; proposedChanges: string[]; impactedNodes: string[]; baselinePath: string; drift: { drifted: boolean; driftedFiles: string[]; details: string[]; }; checklist: string[]; }; /** Expand operator classification while retaining the original instruction, * immutable baseline and prior request versions. */ export declare function amendRefineScopes(root: string, requestId: string, scopes: ChangeScope[], reason: string): ChangeRequest; export declare function prepareRefine(opts: { root: string; instruction: string; scope?: string; requestId?: string; plan?: ChangePlanRecord; explicitPreferences?: ChangeRequestRecord["explicitPreferences"]; origin?: ChangeOrigin; }): PrepareRefineResult; export type VerifyRefineResult = { ok: boolean; failures: string[]; summary: string; report?: RefineReport; technical?: "pass" | "fail"; fulfillment?: "pass" | "fail" | "unevaluated"; design?: "pass" | "fail" | "unevaluated"; verifiedSourceRevision?: string; verifiedBuildDigest?: string; completedChecks?: Record; }; export declare function verifyRefine(opts: { root: string; requestId?: string; browser?: boolean; accept?: boolean; }): Promise; /** Called by the engine only after its final locked source/artifact comparison. */ export declare function acceptVerifiedRefine(root: string, requestId: string): void; export declare const REFRESH_PRESERVE_FILES: Set; export declare const REFRESH_PRESERVE_DIRS: RegExp; export declare const REFRESH_PRESERVE_DIR_NAMES: Set;