capsule-ai-cli
Version:
The AI Model Orchestrator - Intelligent multi-model workflows with device-locked licensing
60 lines • 2.44 kB
TypeScript
import { EventEmitter } from 'events';
import { ConversationItem } from './conversation-renderer.js';
export interface UIState {
mode: 'normal' | 'tool-execution' | 'alternate-screen';
isProcessingInput: boolean;
bufferedOutput: BufferedOutput[];
currentToolExecutions: Set<string>;
alternateScreenActive: boolean;
}
export interface BufferedOutput {
id: string;
type: 'console' | 'tool-progress' | 'tool-result' | 'tool-confirmation';
content: string;
timestamp: Date;
metadata?: {
toolName?: string;
executionId?: string;
stream?: 'stdout' | 'stderr';
};
}
export interface UIStateEvents {
'state-changed': (state: UIState) => void;
'output-buffered': (output: BufferedOutput) => void;
'tool-execution-start': (executionId: string) => void;
'tool-execution-end': (executionId: string) => void;
'alternate-screen-enter': () => void;
'alternate-screen-exit': () => void;
'console-output-intercepted': (output: string, stream: 'stdout' | 'stderr') => void;
}
export declare class UIStateManager extends EventEmitter {
private state;
private originalConsoleLog;
private originalConsoleError;
private originalStdoutWrite;
private originalStderrWrite;
private isIntercepting;
private interceptBuffer;
constructor();
emit<K extends keyof UIStateEvents>(event: K, ...args: Parameters<UIStateEvents[K]>): boolean;
on<K extends keyof UIStateEvents>(event: K, listener: UIStateEvents[K]): this;
startIntercepting(): void;
stopIntercepting(): void;
private shouldInterceptOutput;
private isAnsiControlSequence;
private bufferOutput;
flushBufferedOutput(): BufferedOutput[];
setMode(mode: UIState['mode']): void;
startToolExecution(executionId: string): void;
endToolExecution(executionId: string): void;
setAlternateScreenActive(active: boolean): void;
isCurrentlyIntercepting(): boolean;
getState(): Readonly<UIState>;
addToolConfirmationOutput(content: string, metadata?: any): void;
addToolProgressOutput(content: string, executionId: string, toolName?: string): void;
addToolResultOutput(content: string, executionId: string, toolName?: string): void;
formatBufferedOutput(output: BufferedOutput): ConversationItem | null;
reset(): void;
}
export declare const uiStateManager: UIStateManager;
//# sourceMappingURL=ui-state-manager.d.ts.map