@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
27 lines • 1.93 kB
TypeScript
/** `unknown`: nothing registers the name. `interactive_only`: a TUI builtin sent as a prompt. */
export type UnknownCommandReason = "unknown" | "interactive_only";
/** Names a prompt can resolve, split by whether the prompt path itself can run them. */
export interface CommandCatalog {
/** Extension commands, prompt templates, and `skill:<name>` for loaded skills. */
readonly promptCommands: ReadonlySet<string>;
/** TUI builtins (`model`, `settings`, ...) that only the interactive editor dispatches. */
readonly interactiveCommands: ReadonlySet<string>;
}
/** Command-shaped input that no command handles, rejected before it reaches the model. */
export declare class UnknownCommandError extends Error {
/** The command name without its leading `/`. */
readonly command: string;
/** Up to three known command names (without `/`) close to `command`. */
readonly suggestions: readonly string[];
readonly reason: UnknownCommandReason;
constructor(command: string, suggestions: readonly string[], reason: UnknownCommandReason);
}
/** How a protocol client confirms that a refused unknown command should be sent as text. */
export declare const UNKNOWN_COMMAND_CONFIRM_HINT = "Resend with \"unknownCommandAsText\": true to send it as text.";
/** Rebuild the typed rejection from an RPC `unknown_command` failure's `errorData`, if it is well formed. */
export declare function unknownCommandErrorFromWire(data: unknown): UnknownCommandError | undefined;
/** The command name of command-shaped text, or `undefined` when the text is ordinary prose or a path. */
export declare function commandShapedName(text: string): string | undefined;
/** The rejection for command-shaped `text` whose name the catalog cannot resolve, if any. */
export declare function findUnknownCommand(text: string, catalog: CommandCatalog): UnknownCommandError | undefined;
//# sourceMappingURL=unknown-command.d.ts.map