Skip to main content

Crate zeph_commands

Crate zeph_commands 

Source
Expand description

Slash command registry, handler trait, and channel sink abstraction for Zeph.

This crate provides the non-generic infrastructure for slash command dispatch:

  • ChannelSink — minimal async I/O trait replacing the C: Channel generic in handlers
  • CommandOutput — exhaustive result type for command execution
  • SlashCategory — grouping enum for /help output
  • CommandInfo — static metadata for a registered command
  • CommandHandler — object-safe handler trait (no C generic)
  • CommandRegistry — registry with longest-word-boundary dispatch
  • CommandContext — non-generic dispatch context with trait-object fields
  • traits — sub-trait definitions for subsystem access
  • handlers — concrete handler implementations (session, debug)

§Design

CommandRegistry and CommandHandler are non-generic: they operate on CommandContext, a concrete struct whose fields are trait objects (&mut dyn DebugAccess, etc.). zeph-core implements these traits on its internal state types and constructs CommandContext at dispatch time from Agent<C> fields.

This crate does NOT depend on zeph-core. A change in zeph-core’s agent loop does not recompile zeph-commands.

Re-exports§

pub use commands::COMMANDS;
pub use context::CommandContext;
pub use sink::ChannelSink;
pub use sink::NullSink;
pub use traits::agent::AgentAccess;
pub use traits::agent::NullAgent;

Modules§

commands
Static registry of all slash commands, used for /help output generation.
context
Non-generic command execution context.
handlers
Slash command handler implementations.
sink
Minimal channel I/O trait for slash command handlers.
traits
Sub-trait definitions for command handler context access.

Structs§

CommandError
Error type returned by command handlers.
CommandInfo
Static metadata about a registered command, used for /help output generation.
CommandRegistry
Registry of slash command handlers.

Enums§

CommandOutput
Result of executing a slash command.
SlashCategory
Category for grouping commands in /help output.

Traits§

CommandHandler
A slash command handler that can be registered with CommandRegistry.