/** * Console UI — Interactive terminal dashboard for Network-AI * * A TUI (text user interface) built with Node.js builtins (readline + ANSI * escape codes). Zero external dependencies. * * Features: * - Live event feed with timestamped entries * - Status bar (agents, budget, FSM state) * - Command input with auto-completion * - Approval prompts (approve/deny inline) * - Color-coded output * * @module ConsoleUI * @version 1.0.0 */ import { EventEmitter } from 'events'; /** ANSI color/style codes */ export declare const ansi: { reset: string; bold: string; dim: string; italic: string; underline: string; black: string; red: string; green: string; yellow: string; blue: string; magenta: string; cyan: string; white: string; gray: string; bgBlack: string; bgRed: string; bgGreen: string; bgYellow: string; bgBlue: string; bgMagenta: string; bgCyan: string; bgWhite: string; clearScreen: string; clearLine: string; cursorHome: string; hideCursor: string; showCursor: string; }; /** Status data displayed in the header bar */ export interface ConsoleStatus { version: string; agents: { active: number; total: number; }; budget: { usedPercent: number; }; fsm: { state: string; }; pendingApprovals: number; } /** A feed entry displayed in the live feed */ export interface FeedEntry { time: string; icon: string; message: string; level: 'info' | 'warn' | 'error' | 'success' | 'approval'; } /** Command handler function */ export type CommandHandler = (args: string, ui: ConsoleUI) => Promise | void; /** Console UI options */ export interface ConsoleUIOptions { /** Title shown in the header */ title?: string; /** Version string */ version?: string; /** Custom prompt string (default: '> ') */ prompt?: string; /** Maximum feed entries to keep (default: 200) */ maxFeedEntries?: number; /** Input stream (default: process.stdin) */ input?: NodeJS.ReadableStream; /** Output stream (default: process.stdout) */ output?: NodeJS.WritableStream; } /** * Interactive terminal UI for Network-AI agent runtime. * * @example * ```typescript * const ui = new ConsoleUI({ title: 'Network-AI', version: '4.13.1' }); * ui.command('status', (args, ui) => { ui.log('All systems operational'); }); * ui.command('approve', async (args, ui) => { ... }); * await ui.start(); * ``` */ export declare class ConsoleUI extends EventEmitter { private readonly opts; private rl; private commands; private feed; private status; private running; constructor(opts?: ConsoleUIOptions); /** Register a command handler */ command(name: string, handler: CommandHandler, description?: string): void; /** Update the status bar */ updateStatus(partial: Partial): void; /** Add an entry to the live feed */ log(message: string, level?: FeedEntry['level']): void; /** Get all feed entries */ getFeed(): ReadonlyArray; /** Clear the feed */ clearFeed(): void; /** Get current status */ getStatus(): Readonly; /** Start the interactive console */ start(): Promise; /** Stop the console */ stop(): void; /** Whether the console is currently running */ get isRunning(): boolean; /** Show the help text */ showHelp(): void; /** Render the header/status bar */ renderHeader(): void; private write; private renderPrompt; private writeFeedEntry; private budgetColor; private handleInput; } //# sourceMappingURL=console-ui.d.ts.map