@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.
33 lines • 2.16 kB
TypeScript
/**
* Audit, setup-detect, and setup-prompt HTTP route handlers for the dashboard server.
*
* Backs `/api/audit` (the shared DashboardReport for Home/Setup/Quality), `/api/setup/detect`,
* and `/api/setup`. Aggregate `/api/audit` requests fold a persisted disk cache and a per-request
* profiler over `runAuditBatch`; explicit per-agent requests skip the cache. Handlers return their
* outcome as JSON and never throw to the server, so a failed audit becomes an error body rather than
* a crashed request. Route wiring lives in dashboard-routes.ts; report assembly in dashboard-reporting.ts.
*/
import type { ServerResponse } from "node:http";
import { type DashboardRouteContext } from "./dashboard-route-types.js";
/** Route handlers exported by the dashboard audit/setup route group. */
interface AuditRouteHandlers {
handleAuditRequest: (url: URL, res: ServerResponse) => boolean;
handleSetupDetectRequest: (url: URL, res: ServerResponse) => boolean;
handleSetupRequest: (url: URL, res: ServerResponse) => Promise<boolean>;
}
/**
* Bind the audit/setup route handlers to one server's request context so each closure can reach the
* validated-path resolver, evidence recorder, and JSON responder without per-request wiring. The
* closure shape is intentional because the context is resolved once per server, and binding it here
* lets the handlers be registered as plain `(url, res)` callbacks. Each handler reports validation,
* audit, and cache failures back to the client as a JSON error body instead of throwing, so a failed
* request never crashes the server. The aggregate audit route also folds a disk cache over
* `runAuditBatch` to avoid paying a full re-audit on every fresh Home load.
*
* @param ctx - per-server dashboard route context carrying path validation, the audit cache, and IO hooks
* @returns the three audit/setup handlers; each returns true once it has owned and answered a matching
* request, or false to let the next handler try the URL
*/
export declare function createAuditRouteHandlers(ctx: DashboardRouteContext): AuditRouteHandlers;
export {};
//# sourceMappingURL=dashboard-audit-routes.d.ts.map