UNPKG

@ideascol/cli-maker

Version:
50 lines (49 loc) 1.68 kB
import type { SessionOptions, SessionMessage, ShellCommandResult } from '../interfaces'; /** * Interactive REPL session — enables persistent, multi-turn CLI experiences * with slash commands, tool calls, streaming output, and conversation history. */ export declare class InteractiveSession { private history; private tools; private slashCommands; private options; private rl; private inputHistory; private running; private theme; constructor(options: SessionOptions); /** * Start the interactive session loop. Resolves when the user exits. */ start(): Promise<void>; /** * Programmatically stop the session from within a handler. */ stop(): void; /** * Execute a shell command entered via the `!` prefix. Pure function over * options + input; returns a structured result. Exposed for testing and * for advanced consumers that want to drive shell execution programmatically. * * Security: returns `{ status: 'disabled' }` unless `shellCommandsEnabled` * is true. When `allowedShellCommands` is set, only commands whose first * whitespace-delimited token matches an entry will execute. */ handleShellCommand(shellCmd: string): ShellCommandResult; private renderShellResult; /** * Get the current conversation history (read-only copy). */ getHistory(): SessionMessage[]; private renderWelcomeScreen; private readInput; private buildContext; private executeTool; private print; private printStream; private printMarkdown; private addToHistory; private mergeSlashCommands; private cleanup; }