import { type ToolContext } from '../tools/types.js'; import { type ConnectivityFingerprint, type ConnectivityFingerprintDiff } from './connectivity-fingerprint.js'; import { type LayoutAutofixAllowlist, type LayoutAutofixPreview, type LayoutAutofixReport } from '../layout/autofix.js'; import type { PlacementConstraintRegion } from '../layout/placement.js'; export interface GatherLiveLayoutAutofixPreviewOptions { allowlist?: Partial; hardKeepouts?: readonly PlacementConstraintRegion[]; callerReservedRegions?: readonly PlacementConstraintRegion[]; minimumClearance?: number; maxMoves?: number; } export interface LiveLayoutAutofixPreviewResult { preview: LayoutAutofixPreview; primitiveCount: number; unavailablePrimitiveIds: string[]; } /** * Reads live sheet geometry and every component's real rendered bounds, then * runs the pure `previewLayoutAutofix` engine against them -- read-only, no * writes. `schematic.listComponents` is the only bridge source available for * primitive identity, so every live primitive here is typed 'component'; * text/label/annotation/section-box primitives (and therefore TEXT_OVERLAP / * SECTION_BOX_TOO_SMALL violations) are out of reach until the bridge exposes * them independently -- same limitation already documented on * easyeda_schematic_primitive_bounds. */ export declare function gatherLiveLayoutAutofixPreview(ctx: ToolContext, projectId: string, options?: GatherLiveLayoutAutofixPreviewOptions): Promise; export interface ApplyLiveLayoutAutofixOptions extends GatherLiveLayoutAutofixPreviewOptions { /** Compute and return the preview only -- never opens a transaction or writes. */ dryRun?: boolean; batchSize?: number; } export interface ApplyLiveLayoutAutofixResult { preview: LayoutAutofixPreview; primitiveCount: number; unavailablePrimitiveIds: string[]; applied: boolean; batchesVerified: number; actualStateReadAfterFailure: boolean; beforeFingerprint?: ConnectivityFingerprint; afterFingerprint?: ConnectivityFingerprint; connectivityDiff?: ConnectivityFingerprintDiff; report: LayoutAutofixReport; transactionId?: string; transactionState?: string; errorCode?: string; error?: string; } /** * Recomputes the autofix preview against current live state, then -- unless * dryRun is set or there are no moves to make -- applies it through the * shared global TransactionManager with batch-by-batch connectivity- * fingerprint verification (applyLayoutAutofix). Any connectivity change, * write failure, or readback instability rolls the whole transaction back; * this function never throws for those cases, it reports them in the * returned errorCode/error fields instead (mirroring handleSchematicBatchWrite's * catch-and-report convention). */ export declare function applyLiveLayoutAutofix(ctx: ToolContext, projectId: string, options?: ApplyLiveLayoutAutofixOptions): Promise;