UNPKG

@blundergoat/goat-flow

Version:

AI coding agent harness and local dashboard for Claude Code, OpenAI Codex, Google Antigravity, and GitHub Copilot - setup audits, guardrails, structured skills, deny hooks, and persistent learning loops.

85 lines 4.78 kB
import type { DashboardAuditProfileSpan, DashboardAuditProfiler } from "./dashboard-route-types.js"; import type { AuditReport } from "../audit/types.js"; import type { QualityHistoryEntry } from "../quality/history.js"; import type { AgentId } from "../types.js"; import type { DashboardReport } from "./types.js"; /** * Home-card projection of the latest quality report, stripped to display totals. */ interface LatestQualitySummary { id: string; date: string; time: string; agent: AgentId; setupTotal: number; systemTotal: number; blockerCount: number; majorCount: number; minorCount: number; evidenceMethods: string[]; scope: string | null; } /** * Decide whether to collect per-span audit timings for one request. Profiling is gated on both an * explicit opt-in and a trust signal so an untrusted caller cannot force the extra timing work. * * @param url - the request URL; profiling requires the `profile=true` query parameter * @param devMode - true when the server runs in dev mode; otherwise the `GOAT_FLOW_AUDIT_PROFILE=1` * environment flag must be set to allow profiling on a packaged server * @returns true only when the request opts in AND the server is trusted to expose timings */ export declare function shouldProfileAuditRequest(url: URL, devMode: boolean): boolean; export declare function createDashboardAuditProfiler(enabled: boolean): DashboardAuditProfiler; export declare function appendAuditProfile<T extends object>(body: T, profiler: DashboardAuditProfiler): T & { _profile?: { summedSpanMs: number; spans: DashboardAuditProfileSpan[]; }; }; /** * Project one quality-history entry into the compact Home-card summary, deriving severity counts and * the distinct evidence methods from its findings so the dashboard never loads the full report. * * @param entry - the latest matching history entry, or null when no history matches the filter * @returns the display summary, or null when entry is null - null means "no quality run to show yet" * (an expected empty state, not an error) */ export declare function buildLatestQualitySummary(entry: QualityHistoryEntry | null): LatestQualitySummary | null; export declare function buildAuditCacheSignature(projectPath: string, packageVersion: string): string; /** * Attach compact Home-only learning-loop context (loop health plus recent lessons) to a dashboard * report, served from a per-project in-memory cache keyed by a content signature with a 60s TTL so * repeated Home loads avoid re-scanning `.goat-flow`. Returns a new report; the input is not mutated. * * @param report - the base dashboard report to extend; returned unchanged except for the two added fields * @param projectPath - absolute project root whose `.goat-flow` learning-loop content is summarised * @param fresh - when true, bypass the cache and recompute (used right after a fresh audit so the * first response reflects current content) * @returns a copy of the report with `learningLoop` and `recentLessons` populated; `learningLoop` is * null when the loop directories are absent or unreadable */ export declare function enrichDashboardReport(report: DashboardReport, projectPath: string, fresh?: boolean): DashboardReport; /** * Assemble the `/api/audit` DashboardReport from one aggregate audit and the per-agent audits, * deriving agent cards from per-agent results and overall scopes/status from the aggregate. Always * runs learning-loop enrichment with fresh=true so a newly built report reflects current content. * * @param auditRpt - the aggregate (dashboard-wide) audit supplying scopes, overall status, and target * @param perAgentAudits - one entry per managed agent, each id paired with that agent's audit report; * becomes the per-agent `agentScores` cards * @param projectPath - absolute project root, used for the learning-loop enrichment pass * @param profiler - optional per-request profiler; when present the enrichment pass is timed as a span * @returns the fully populated dashboard report ready to serialise to the client */ export declare function buildDashboardReport(auditRpt: AuditReport, perAgentAudits: { id: string; audit: AuditReport; }[], projectPath: string, profiler?: DashboardAuditProfiler): DashboardReport; export declare function readAuditCache(projectPath: string, packageVersion: string, signature: string): { report: DashboardReport; cachedAt: string; } | null; export declare function writeAuditCache(projectPath: string, packageVersion: string, signature: string, report: DashboardReport): void; export declare function buildQualityAuditCacheKey(projectPath: string, agent: AgentId): string; export {}; //# sourceMappingURL=dashboard-reporting.d.ts.map