@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.
43 lines • 2.25 kB
TypeScript
/**
* Terminal-specific dashboard server wiring.
* This keeps terminal HTTP routes, WebSocket upgrades, startup health checks,
* and shutdown handling out of the main dashboard HTTP server.
*/
import type { IncomingMessage, Server as HttpServer, ServerResponse } from "node:http";
import type { Duplex } from "node:stream";
import type { Runner } from "./types.js";
type JsonResponder = (res: ServerResponse, status: number, body: unknown) => void;
/** Request-body limits used by terminal create and upload endpoints. */
interface BodyReadOptions {
maxBytes?: number;
tooLargeMessage?: string;
}
type BodyReader = (req: IncomingMessage, options?: BodyReadOptions) => Promise<string>;
/** Dependencies injected by the dashboard server so terminal handlers stay route-local and testable. */
interface DashboardTerminalDependencies {
absDefault: string;
validRunners: ReadonlySet<string>;
defaultRunner: Runner;
jsonResponse: JsonResponder;
readBody: BodyReader;
idleTimeoutMinutes?: number;
}
/**
* Build the terminal-only dashboard handlers for one server instance.
*
* @param deps - server-local dependencies and limits shared by terminal routes
* @returns terminal route handlers plus the shutdown hook for active sessions
*/
export declare function createDashboardTerminalHandlers(deps: DashboardTerminalDependencies): {
handleTerminalCreateRequest: (req: IncomingMessage, url: URL, res: ServerResponse) => Promise<boolean>;
handleTerminalListRequest: (req: IncomingMessage, url: URL, res: ServerResponse) => Promise<boolean>;
handleTerminalDeleteRequest: (req: IncomingMessage, url: URL, res: ServerResponse) => Promise<boolean>;
handleTerminalUploadRequest: (req: IncomingMessage, url: URL, res: ServerResponse) => Promise<boolean>;
handleHealthRequest: (req: IncomingMessage, url: URL, res: ServerResponse) => Promise<boolean>;
handleTerminalSessionsRequest: (req: IncomingMessage, url: URL, res: ServerResponse) => Promise<boolean>;
handleTerminalUpgrade: (req: IncomingMessage, socket: Duplex, head: Buffer, server: HttpServer) => boolean;
logStartupNotice: () => void;
close: () => Promise<void>;
};
export {};
//# sourceMappingURL=dashboard-terminal.d.ts.map