MingaEditor.Agent.SlashCommand.Registry (Minga v0.1.0)

Copy Markdown View Source

Source-owned registry for extension-contributed agent slash commands.

Built-in slash commands remain static in MingaEditor.Agent.SlashCommand. Extension declarations are stored here so cleanup and reload no longer depend on scanning running manifests.

Summary

Types

Registry entry for one slash command.

Source that contributed slash commands.

Functions

Returns all registered extension slash commands in deterministic registration order.

Returns registry entries in deterministic registration order.

Registers a source-owned batch of slash command declarations. Same-source batches replace prior entries.

Starts the slash command registry.

Removes all slash commands owned by a source.

Types

entry()

@type entry() :: %{
  source: source(),
  id: String.t(),
  command: MingaEditor.Agent.SlashCommand.Command.t()
}

Registry entry for one slash command.

source()

Source that contributed slash commands.

state()

@type state() :: [entry()]

Functions

commands()

@spec commands() :: [MingaEditor.Agent.SlashCommand.Command.t()]

Returns all registered extension slash commands in deterministic registration order.

entries()

@spec entries() :: [entry()]

Returns registry entries in deterministic registration order.

register_many(source, commands, opts \\ [])

@spec register_many(
  source(),
  [{atom() | String.t(), String.t(), keyword()}],
  keyword()
) :: :ok

Registers a source-owned batch of slash command declarations. Same-source batches replace prior entries.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

Starts the slash command registry.

unregister_source(source)

@spec unregister_source(source()) :: :ok

Removes all slash commands owned by a source.