# `MingaEditor.Input.AgentPanel`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/input/agent_panel.ex#L1)

Input handler for the agent prompt and side-panel navigation.

When the agent prompt is focused, this handler owns prompt editing in both editor scope and full agent workspaces. When the side panel is visible in editor scope but the prompt is not focused, it owns panel navigation.

In insert mode, it handles prompt editing (Enter, Backspace, Ctrl
combos, arrow keys, @-mention triggers). In normal/visual/
operator-pending mode, it routes keys through the standard Mode FSM
by temporarily swapping the active buffer to the prompt buffer.

Navigation mode (panel visible but input not focused) delegates common
transcript movement keys to semantic chat scroll state.

# `state`

```elixir
@type state() :: MingaEditor.Input.Handler.handler_state()
```

# `dispatch_prompt_via_mode_fsm`

```elixir
@spec dispatch_prompt_via_mode_fsm(
  MingaEditor.State.t(),
  non_neg_integer(),
  non_neg_integer()
) ::
  MingaEditor.State.t()
```

Routes a key through the standard Mode FSM targeting the prompt buffer.

Swaps the active buffer to the prompt buffer, runs the key through
the mode FSM (which handles all vim operations: motions, operators,
visual mode, text objects, undo/redo), then restores the original
active buffer.

If the Mode FSM transitions to insert mode, we leave the mode as
insert so that subsequent keys are handled by `handle_panel_insert`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
