/** * Slash commands in a chat. A line beginning with `/` is a control, not a * prompt: the host runs it WITHOUT a model turn, so routing it here is what * keeps a `/clear` from reaching the model as prose for it to improvise on. * * Two commands are the channel's own rather than the host's. `/stop` cancels * the running turn — cancellation is an agent method, not a registered command * — and `/help` lists what this chat accepts, which no host command provides. * @module dsh-lark-channel/commands */ import type { HostAgent, HostCommands } from './host.ts'; /** Cancel the running turn. Not a host command: cancellation is an agent method. */ export declare const STOP_COMMAND = "stop"; /** List what this chat accepts. Not a host command: the list is per surface. */ export declare const HELP_COMMAND = "help"; /** * The command one line names, if it names one. * @param text - the message text exactly as received. * @returns the lowercase name without its slash, or undefined for prose. */ export declare function commandName(text: string): string | undefined; /** * Whether one inbound line addresses the channel as a command. * @param text - the message text exactly as received. * @returns whether it opens with a slash and names something. */ export declare function isCommandLine(text: string): boolean; /** What a command line did, for the chat to report. */ export interface CommandOutcome { /** Text to send back, empty when the command's own events already tell the story. */ readonly reply: string; /** Whether the line resolved at all; an unresolved one is a typo worth naming. */ readonly resolved: boolean; } /** * Render the help listing for one agent's available commands. * @param commands - the host command runtime, when composed. * @param agent - the agent whose scope decides what is available. * @returns the markdown listing. */ export declare function helpText(commands: HostCommands | undefined, agent: HostAgent): string; /** * Run one command line for a chat's agent. * * `/stop` and `/help` are answered here; everything else goes to the host * runtime, whose `undefined` means the name never resolved — reported as such * with the listing, because silently feeding a typo to the model is how `/stop` * became a message the bot ignored. * @param line - the complete line, leading slash included. * @param agent - the chat's agent. * @param commands - the host command runtime, when composed. * @param signal - cancellation for the host execution. * @returns what to report to the chat. */ export declare function runCommandLine(line: string, agent: HostAgent, commands: HostCommands | undefined, signal: AbortSignal): Promise; //# sourceMappingURL=commands.d.ts.map