# `SuperPi.Event.Renderer.ACP`
[🔗](https://github.com/oleksandr/super-pi-beam/blob/v0.1.0/lib/super_pi/event/renderer/acp.ex#L1)

Renders events as [Agent Client Protocol](https://agentclientprotocol.com) `session/update`
payloads, for `SuperPi.ACP.Server`.

Output items:

- `{:update, map}` - the `update` of a `session/update` notification.
- `{:permission, params, request_id}` - params of a `session/request_permission` request. The
  server sends it and answers `SuperPi.UI.Broker.respond(request_id, option_id)`.

| Event | ACP |
|---|---|
| `text_delta` | `agent_message_chunk` |
| `thinking_delta` | `agent_thought_chunk` |
| `tool_started` | `tool_call`, status `pending` |
| `permission_request` | `session/request_permission` for that tool call |
| `ui_resolved` of a permission | `tool_call_update`, status `in_progress` (on approval) |
| `tool_completed` | `tool_call_update`, status `completed` or `failed` |
| `tool_blocked` | `tool_call_update`, status `failed` |
| `subagent_started`, `subagent_finished` | a `tool_call` of kind `other` and its update |
| `plan_updated` | `plan` |
| `mode_changed` | `current_mode_update` |
| `turn_*` | nothing. The server answers `session/prompt` with a stop reason. |

A tool call is `pending` from `tool_started` until it is approved, or until it completes when no
approval was needed. The permission option kinds are already ACP's (`allow_once`, `allow_always`,
`reject_once`, `reject_always`), so the mapping is a rename of fields.

Running commands are shown as a `tool_call` of kind `execute`, never through the editor's
`terminal/*` methods. `SandboxRunner` gives process-group kill, output spill and the sandbox, and
an editor terminal gives none of that and bypasses `permissions.deny`.

Options: `:session_id`.

# `kind`

```elixir
@spec kind(String.t()) :: String.t()
```

ACP `kind` of a tool: `read`, `edit`, `search`, `execute`, `fetch` or `other`.

---

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