/** * Standalone Survey Review Console — loopback HTTP server that serves the * existing Review Workbench UI wired to a session JSON file for real-time review. * * Routes: * GET / HTML shell that mounts the workbench * GET /api/session Current session state (snapshot + replayed events) * POST /api/events Append review session events to the stored log (same * validation as MCP server), compare-and-swap on the * revision the client last read * GET /api/stream SSE stream: emits "update" events when the session file changes * GET /api/health Health check * GET /dist/* Compiled assets served from the dist tree (traversal-safe) */ import { type ServerReviewSessionRecord } from "../review-workbench/server-review-session.js"; import { type ReviewQueueBinding } from "../review-workbench/queue-binding.js"; import type { ReviewWorkbenchResult, ReviewQueuePresentation } from "../review-workbench/review-workbench.js"; import type { ReviewSessionEvent } from "../review-resource.js"; export interface ReviewConsoleServerOptions { /** Producer-owned display hints; independent of queue binding and application authority. */ readonly presentation?: ReviewQueuePresentation; /** Absolute path to the session JSON file. */ readonly sessionPath: string; /** TCP port. Defaults to 0 (OS-assigned). */ readonly port?: number; /** Host to bind on. Must be a loopback address. Defaults to 127.0.0.1. */ readonly host?: string; /** Producer-owned application. The binding must come from queue construction. */ readonly producerApply?: { readonly binding: ReviewQueueBinding; /** Revalidate domain currency/authentication and apply idempotently under the producer's lock. */ readonly apply: (input: ReviewConsoleApplyInput) => Promise; }; } export interface ReviewConsoleApplyInput { readonly record: ServerReviewSessionRecord; readonly events: readonly ReviewSessionEvent[]; readonly results: readonly ReviewWorkbenchResult[]; readonly revision: string; } export interface ReviewConsoleApplication { readonly reference: string; readonly summary: string; } export interface ReviewConsoleServerHandle { readonly url: string; readonly port: number; readonly host: string; close(): Promise; } export declare function startReviewConsoleServer(options: ReviewConsoleServerOptions): Promise; export declare function runReviewConsole(args: string[]): Promise;