/** * Auto-Optimizer (CLI side) * * Two-phase pipeline for project file optimization, modeled after auto-research. * * Phase 1 — Analyze (action: "analyze"): * 1. Scan project filesystem for optimization candidates (size, duplication, complexity). * 2. Build an analysis prompt for the agent. * 3. Send prompt to the agent session via manager.prompt() with skipPersistence. * 4. Parse the agent's response into structured AutoOptimizeRecommendation[]. * 5. Emit auto_optimize_analysis_complete via relay with recommendations. * * Phase 2 — Execute (action: "execute"): * 1. Receive approvedItemIds from the frame. * 2. Apply each approved recommendation via the agent session. * 3. Run quality gates (type-check, lint, tests) on modified files. * 4. Emit auto_optimize_execution_complete with per-item results and gate status. * * All errors are surfaced as auto_optimize_error events on the wire. */ import type { SessionStore } from "../server/storage.js"; import type { SessionStreamManager, Subscriber } from "../server/session-stream.js"; import type { RelayClient } from "./client.js"; export interface AutoOptimizeInput { projectId: string; sessionId: string; action: "analyze" | "execute"; approvedItemIds?: string[]; } export interface AutoOptimizeDeps { store: SessionStore; manager: SessionStreamManager; relay: Pick; subscribers: Map; cwd: string; logger?: { error: (...args: unknown[]) => void; }; } export declare function handleAutoOptimize(input: AutoOptimizeInput, deps: AutoOptimizeDeps): Promise; //# sourceMappingURL=auto-optimizer.d.ts.map