/** * Doctor check — Brainstorm Audit (Phase 6) * * Reads every .IDE_Plans/pi-senai/Brainstorm//brainstorm-dispatch.md * the project has produced and surfaces findings about dispatch choices. * * Checks (all advisory, never blocking): * 1. Audit log missing → warning ("approvals without audit trail") * 2. Dispatch cap exceeded → warning ("cap was 3, log shows N") * 3. Many inline reads → info ("X reads inline — fine if quick") * 4. Suspicious inline scan → warning ("'inline' but task mentions many files") * 5. Skipped decision → warning ("skipped dispatch where registry had a match") * 6. Audit log unreadable → warning ("could not parse the audit file") * * Reads only — never writes. Audit failures don't block the doctor report. */ import { BRAINSTORM_DISPATCH_CAP } from "../brainstorm/guard.js"; import type { DiagnosticSection } from "./_types.js"; /** Naive markdown parser for our audit log format. Extracts: * - run id, started, seed * - per-turn decisions (decision kind, agent, reason, task, etc.) * - summary stats * * Tolerates missing fields (returns what it can find). Pure. */ export interface ParsedAuditLog { brainstormRunId: string; startedAt: string; seed: string; decisions: Array<{ turn: number; decision: string; agent?: string; reason?: string; task?: string; }>; summary: { totalDispatches: number; dispatchesByAgent: Record; inlineReads: number; skipped: number; sideChannel: number; }; } export declare function parseAuditLog(content: string): ParsedAuditLog | null; /** The main doctor check. Returns a DiagnosticSection for the doctor * report. Always returns a section (even when empty) so the report * is stable. */ export declare function checkBrainstormAudit(cwd: string): DiagnosticSection; /** Re-export the cap so the doctor report can mention the threshold. */ export { BRAINSTORM_DISPATCH_CAP };