1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// SPDX-FileCopyrightText: 2026 Andrei G <bug-ops>
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Non-generic command execution context.
//!
//! [`CommandContext`] is the single argument passed to every [`CommandHandler`]. It provides
//! access to agent subsystems through trait objects, eliminating the `C: Channel` generic from
//! `CommandHandler` and `CommandRegistry`.
//!
//! `zeph-core` constructs a `CommandContext` at dispatch time from `Agent<C>` fields:
//!
//! ```rust,ignore
//! let mut ctx = CommandContext {
//! sink: &mut sink_adapter,
//! debug: &mut self.debug_state,
//! messages: &mut messages_impl,
//! session: &session_impl,
//! agent: &mut agent_impl,
//! };
//! registry.dispatch(&mut ctx, input).await;
//! ```
//!
//! [`CommandHandler`]: crate::CommandHandler
use crateChannelSink;
use crateAgentAccess;
use crateDebugAccess;
use crateMessageAccess;
use crateSessionAccess;
/// Typed access to agent subsystems for slash command handlers.
///
/// Each field is a trait object providing access to one subsystem group. Constructed by
/// `zeph-core` at dispatch time from `Agent<C>` fields. Handlers receive `&mut CommandContext`
/// and access only the fields they need.
///
/// # Lifetimes
///
/// The lifetime `'a` ties all references to the dispatch scope. A `CommandContext` must not
/// outlive the `&mut Agent<C>` it was constructed from.