import type { Context } from '../core/context.js'; import type { SlashCommand } from '../types/slash-command.js'; /** * A slash command registered with the CLI or available to plugins. * Plugins receive a view of the registry via PluginAPI.slashCommands. * * Commands registered by plugins use a namespaced name: `pluginName:commandName`. * This prevents collisions with built-in commands and other plugins. */ export type { SlashCommand }; export declare class SlashCommandRegistry { private readonly cmds; /** * Register a command. * * Trust tiers, by `owner` and `opts.official`: * * - **Built-ins** (`owner === 'core'`) and **official plugins** * (`opts.official === true`, set by the host only for first-party plugins * loaded from the built-in factory list) claim the **bare** command name * (`/prompts`). They may override one another — last write wins — so an * official plugin can replace a built-in. Official plugins are *also* * reachable under their `owner:name` namespace. * - **External plugins** (any other `owner`) are isolated under the * `owner:name` namespace: invocable only as `/owner:cmd`, never by bare * name, and unable to shadow or override a built-in or official command. * * Officiality is supplied by the host based on the plugin's load source, not * self-declared by the plugin — an external plugin cannot name itself into * the official tier. */ register(cmd: SlashCommand, owner?: string, opts?: { official?: boolean | undefined; }): void; unregister(name: string): boolean; /** * Bulk-register multiple slash commands at once. */ registerAll(cmds: SlashCommand[], owner?: string): void; get(name: string): SlashCommand | undefined; ownerOf(name: string): string | undefined; list(): SlashCommand[]; listWithOwner(): Array<{ cmd: SlashCommand; owner: string; fullName: string; }>; /** * Parse a slash command line. Accepts both: * `/cmd args` → builtin command (owner=core) * `/pluginName:cmd args` → plugin command * The command name is split at the first `:` if the prefix matches a known owner. */ dispatch(line: string, ctx: Context): Promise<{ exit?: boolean | undefined; message?: string | undefined; runText?: string | undefined; metadata?: Record; } | null>; } //# sourceMappingURL=slash-command-registry.d.ts.map