import type { Command, CommandSchema } from './types'; export type PromptEvent = { schema: CommandSchema; resolve: (command: Command) => void; reject: (error: Error) => void; }; export type CommandRunnerEvents = { prompt: PromptEvent; }; export type CommandResult = { success: true; result: T; } | { success: false; error: string; } export type CommandRunnerContext = { context: TContext; run: (input: string) => Promise>; runParsed: (command: Command) => Promise<{ success: true; result: unknown } | { success: false; error: string }>; prompt: (schema: CommandSchema | string) => Promise; on: (event: T, listener: (e: CommandRunnerEvents[T]) => void) => void; off: (event: T, listener: (e: CommandRunnerEvents[T]) => void) => void; }; export type CommandRunnerHandler = ( this: CommandRunnerContext, command: Command ) => Promise; export type CommandRunner = { schema: CommandSchema; run: CommandRunnerHandler; };