Skip to main content

execute_command_via_handle

Function execute_command_via_handle 

Source
pub(crate) fn execute_command_via_handle(
    handle: &Arc<AgentHandle>,
    key: &SessionSlot,
    session_id: Option<&str>,
    new_session_id: Option<String>,
    cmd: Command,
) -> Result<(), AgentError>
Expand description

Forward a Command straight to handle. Pure transport - no pending-interaction bookkeeping; the only commands that consult PendingInteractionSlot (RespondPermission / RespondQuestion) must be handled by the caller before delegation here.

Used by both SessionTask::execute_command (production: actor path) and Workspace::dispatch’s synchronous test fallback when no SessionTask is running for key.

Returns Ok(()) on successful enqueue; Err(...) on AgentHandle send failure (dispatcher channel closed) or on a command dropped for having no session_id yet (pre-Connect).