Slash command registry and dispatcher for the agent chat input.
When the user types / at the start of input and submits, the text is
routed here instead of being sent to the LLM. Each command is a simple
{description, handler_fn} where the handler receives the editor state
and any arguments after the command name.
Summary
Types
A registered slash command.
A completion candidate for agent slash input.
Editor state (same as EditorState.t()).
Functions
Returns the list of all registered slash commands (static and dynamic).
Returns completion candidates for the current slash input, without the leading slash.
Returns commands whose names start with the given prefix.
Returns slash commands contributed by loaded extensions.
Parses and executes a slash command from raw input text.
Returns true when a slash command may contain secrets and must not enter prompt history.
Returns true if the given text is a slash command (starts with /).
Types
@type command() :: MingaEditor.Agent.SlashCommand.Command.t()
A registered slash command.
A completion candidate for agent slash input.
@type state() :: map()
Editor state (same as EditorState.t()).
Functions
@spec commands() :: [command()]
Returns the list of all registered slash commands (static and dynamic).
@spec completion_candidates(state(), String.t()) :: [completion_candidate()]
Returns completion candidates for the current slash input, without the leading slash.
Returns commands whose names start with the given prefix.
@spec dynamic_commands() :: [MingaEditor.Agent.SlashCommand.Command.t()]
Returns slash commands contributed by loaded extensions.
Parses and executes a slash command from raw input text.
Returns {:ok, state} if the command was recognized and executed,
or {:error, message} if the command is unknown.
Returns true when a slash command may contain secrets and must not enter prompt history.
Returns true if the given text is a slash command (starts with /).