# E2E Spec: Slash Command Instructions

## Overview
Test the slash command handler (`/info`, `/agent`, `/list`, `/new`, `/status`, `/help`,
`/echo`, `/toggle-debug`, `/sendmedia`, `/reset`) that routes all `/`-prefixed messages.
Covers `internal/dispatcher/instructions.go`.

## Setup
Create InstructionHandler with mock Dispatcher and AgentOverrides.
Use mock Channel that captures outbound messages.

## Test Cases

### Command Routing
- `/info` shows the AgentTeam server connection, conversation, and current agent
- `/agent` without args shows help text
- `/agent <name>` switches to named agent (case-insensitive match on ID and Name)
- `/agent <index>` switches to agent by 1-based index
- `/agent <index>` out of range shows error
- `/agent <nonexistent>` shows "not found" message
- `/list` shows sorted agent list
- `/new` stops current session
- `/new` when idle shows "idle" message
- `/status` shows agent name, runtime, model, session info
- `/status` when unbound shows "unbound" message
- `/help` shows help text
- `/echo <text>` echoes text with timing report
- `/echo` without args shows only timing report
- `/toggle-debug` toggles on supported channel (AgentTeam)
- `/toggle-debug` on unsupported channel shows "unsupported"
- `/sendmedia <path>` sends media file via channel
- `/sendmedia` without args shows usage
- `/reset` stops session and clears workspace
- Unknown slash command returns (false, nil) — not handled

### Agent Resolution Priority
- Override takes precedence over channel config
- Channel config agentID used when no override
- Single agent used when no config or override
- Empty agentID when multiple agents and no config/override

### Command Parsing
- `splitSlashCommand` lowercases command name
- `consumeCommandArg` handles double-quoted args
- `consumeCommandArg` handles single-quoted args
- `consumeCommandArg` handles unquoted args (space delimited)
- `consumeCommandArg` handles empty input (returns error)
- `consumeCommandArg` handles unterminated quotes (returns error)

### Agent Switching Side Effects
- Setting agent override stores in AgentOverrides
- Setting agent override stops current session via Dispatcher
- Agent switch shows agent name, ID, runtime, model, description
