// Core interfaces for the terminal export * from './config'; export interface FileSystemNode { name: string; type: 'file' | 'directory'; content?: string; children?: Map; metadata: FileMetadata; } export interface FileMetadata { created: Date; modified: Date; size: number; permissions: string; isExecutable?: boolean; } export interface Command { name: string; description: string; usage: string; execute(args: string[], options: CommandOptions): Promise; } export interface PromptOptions { message: string; defaultValue?: string; password?: boolean; validate?: (input: string) => boolean | string; } export interface CommandOptions { stdin: InputStream; stdout: OutputStream; stderr: OutputStream; cwd: string; env: Record; fs: IFilesystem; flags?: Record; prompt?: (options: string | PromptOptions) => Promise; } export interface CommandResult { exitCode: number; output?: string; error?: string; } export interface IFilesystem { readFile(path: string): Promise; writeFile(path: string, content: string): Promise; deleteFile(path: string): Promise; readDir(path: string): Promise; createDir(path: string): Promise; exists(path: string): Promise; stat(path: string): Promise; resolvePath(path: string, cwd?: string): string; getCwd(): string; setCwd(path: string): void; isDirectory(path: string): Promise; isFile(path: string): Promise; // Optional reactive hooks: the Vue terminal app relies on these for live // updates; headless embedders (e.g. agent.libx.js backends) may omit them. onFilesystemChange?(listener: () => void): () => void; onCwdChange?(listener: (cwd: string) => void): () => void; } export interface InputStream { read(): Promise; readAll(): Promise; } export interface OutputStream { write(data: string): Promise; close(): Promise; } export interface ParsedCommand { command: string; args: string[]; flags: Record; } export interface CommandPipeline { commands: ParsedCommand[]; operators: PipelineOperator[]; redirects: Redirect[]; } export type PipelineOperator = '|' | '&&' | '||' | ';'; export interface Redirect { /** `>`/`>>` stdout, `2>`/`2>>` stderr, `<` stdin. */ type: '>' | '>>' | '2>' | '2>>' | '<'; target: string; commandIndex: number; } export interface TerminalLine { id: string; type: 'input' | 'output' | 'error' | 'prompt' | 'component'; content: string; timestamp: Date; component?: { name: string; props?: Record; source?: 'local' | 'remote'; url?: string; }; } export interface TerminalHistory { add(command: string): void; get(index: number): string | undefined; getPrevious(): string | undefined; getNext(): string | undefined; search(query: string): string[]; getAll(): string[]; }