eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
55 lines (54 loc) • 2.21 kB
TypeScript
export type PromptCommandExtensionName = "model" | "channels" | "deploy" | "login" | "vc";
/** The slash commands the prompt accepts. */
export type PromptCommand = {
type: "new";
} | {
type: "exit";
} | {
type: "help";
} | {
type: "loglevel";
argument: string;
} | {
type: "extension";
name: PromptCommandExtensionName;
argument: string;
};
/**
* Metadata for one slash command. The registry describes commands — their
* names, aliases, and discovery copy — it never executes them: dispatch stays
* with the runner and the prompt-command handler.
*/
export interface PromptCommandSpec {
/** Canonical name without the slash, e.g. "model". */
readonly name: string;
readonly aliases: readonly string[];
/** One-line discovery copy shown by the typeahead. */
readonly description: string;
/** Argument shape shown dim after the name, e.g. "[provider/model]". */
readonly argumentHint?: string;
/** Accepts a trailing argument (enables `/name <arg>` parsing). */
readonly takesArgument: boolean;
/** Maps a recognized invocation to its parsed command. */
readonly build: (argument: string) => PromptCommand;
}
/**
* Every slash command the prompt accepts, in typeahead display order. One
* module owns the command list so the runner's dispatch, the renderer's
* transcript-echo suppression, and command discovery cannot drift apart.
*/
export declare const PROMPT_COMMANDS: readonly PromptCommandSpec[];
/**
* Recognizes the slash commands the prompt accepts. `/new` clears the
* session and transcript; `/exit` (and `/quit`) terminate the TUI like
* Ctrl+C; extension commands are dispatched outside the runner. Anything
* else — including unknown `/text` — is a normal message.
*/
export declare function parsePromptCommand(prompt: string): PromptCommand | null;
/** True for prompts that are commands, which never echo as user messages. */
export declare function isPromptControlCommand(prompt: string): boolean;
/**
* The table `/help` prints: one line per command — slash name, argument
* hint, and aliases padded into a column, description after.
*/
export declare function formatPromptCommandHelp(): string;