Skip to content

Editor Integration (ACP)

Want to use Hya right inside your code editor—like Zed or any editor that speaks the Agent Client Protocol (ACP v1)—without switching windows?

Your editor can launch hya acp automatically. Behind the scenes, hya acp connects straight to your local Hya background server (starting it if needed), so your editor shares the exact same saved conversations, model keys, and Project permission rules as your terminal and browser UI.


1. Connect Zed (or another ACP editor)

Add hya with argument "acp" to your editor’s custom agent settings. For example, in Zed (~/.config/zed/settings.json):

{
"agent_servers": {
"hya": {
"type": "custom",
"command": "hya",
"args": ["acp"]
}
}
}

Open a project folder in Zed, open the Agent panel, pick hya, and start chatting!

Orchestrators (Paseo, T3 Code)

Orchestrators run hya acp like an editor (Paseo: a provider with "extends": "acp" and "command": ["hya", "acp"]; T3 Code: Settings → Providers → Add provider → Local ACP command hya with argument acp). They also open throwaway sessions to generate titles, branch names, and commit messages. Give those their own entry with --temp, so they leave no session or Project in Hya:

  • T3 Code: add a second local ACP command, hya with arguments acp and --temp (named, say, “hya (temp)”), and pick one of its models under Settings → Threads → Text generation model.
  • Paseo: add a provider "hya-temp": { "extends": "acp", "label": "hya (temp)", "command": ["hya", "acp", "--temp"] } and list it under agents.metadataGeneration.providers (Paseo’s Automatic choice may otherwise pick the regular hya entry).

Tips for first-time setup

  • Set up your API key once: hya acp uses whatever model and credentials you already configured in Hya (hya provider add, hya auth login, or /key in the TUI). Override the starting model per editor entry with "args": ["--model", "anthropic/claude-sonnet-4-6", "acp"], or switch it per session from the editor’s model menu.
  • Quick offline test (no API key needed): Set "args": ["--db", "/tmp/hya-editor.db", "--model", "hya/offline", "acp"] and send "hello"—the built-in offline model echoes your message right inside your editor.
  • Requires Hya 0.54.0 or newer: If you just ran hya update while an older background server was still running, run hya server restart once so the daemon matches your new binary.

2. What you can do from the editor

  • Pick up any conversation: the editor’s session history lists the hya sessions of the folder you opened (root sessions whose working directory is that folder and that have been used). Opening one replays its whole transcript—your messages, answers, reasoning, tool calls, and the current plan—and continues it. Deleting one from the editor deletes it in hya too.
  • Switch mode, model, and thinking effort: the session’s permission mode (default, accept_edits, plan, dont_ask, bypass, plus bundle modes) is offered both as ACP session modes and as the mode config option; model lists the models whose provider is ready to use; effort appears when the current model has reasoning variants (default clears the choice). Changes made elsewhere (another client, or the agent leaving plan mode) show up in the editor too.
  • Attach context: paste or drop images (sent to the model as image attachments), mention files (embedded file contents are inlined into the prompt), or link files ([name](uri) for the model to read with its tools).
  • Run slash commands: the session’s hya commands and skills appear in the editor’s command menu; a prompt that starts with /name runs that command (/name args passes the arguments).
  • Follow the work: answer text and reasoning stream as they are written; tool calls show their kind (read, edit, execute, search, fetch), the files they touch, edit and write diffs, and their output; the todo list shows as the agent plan; title changes, context compactions (to editors that accept them), and context-window usage are reported as they happen.
  • Approve tools in the editor: permission asks offer Allow once, Always allow (saved as a rule in permissions.toml, only offered when hya knows what to remember), and Reject once. File asks use the backend’s resolved path for locations and diffs, so an orchestrator can auto-approve by policy (for example, edits inside the workspace). External-directory grants use ACP kind other with the resolved directory as their location. Questions the agent asks the user are shown as a form when the editor supports ACP form elicitation, and are declined otherwise.
  • Bring your own MCP servers: the MCP servers your editor configures are attached to each session you open: stdio servers run inside hya acp in the session’s folder, HTTP and SSE servers are reached by the daemon with the headers you set.

3. How hya acp works

  • Stdio JSON-RPC 2.0: Your editor talks to hya acp over newline-delimited JSON-RPC on stdin/stdout (logs go to stderr).
  • One prompt at a time per session: A prompt that meets another turn on the session (another client’s, or a multi-agent lead’s own wake) waits for it: hya acp retries CreateTurn on session_busy with a short backoff (100 ms rising to 1 s, about 6 s in all), then again after each turn end, revert, or 1 s idle check, until the prompt is admitted or session/cancel ends the wait with stopReason: "cancelled". Closing the editor tab or stdin cancels any active turn, stops editor-launched MCP servers for that session, and leaves your Hya background daemon and saved chat history intact.
  • Temp chats (hya acp --temp): every new session is a temp chat: the daemon deletes it, used or not, a few seconds after the editor closes it or exits (even when killed), and it never registers a Project—it joins the Project that already contains cwd, else it has none. Temp chats are never listed, and the adapter offers no session/fork (a fork is an ordinary session). See temp chats.
  • Unused sessions leave nothing behind: a session opened with session/new is created ephemeral. hya acp keeps it alive while the editor holds it open; one that is closed (or whose editor exits) before its first prompt is deleted by the daemon a few seconds later. Orchestrators that open a session only to read the models and modes therefore do not fill your session list.
  • Protocol version: hya acp speaks ACP v1; a client that asks for a newer version in initialize gets protocolVersion: 1 back and falls back.
  • Hya runs the tools: file reads, edits, and commands run in the Hya daemon, shared with the TUI and other clients, under Hya’s own permission rules, file snapshots (for revert), and output limits. hya acp therefore does not use the editor’s (stable) fs/* and terminal/* methods, which would route around all three. Unsaved editor buffers are not visible to the agent; save first.
  • Not supported: audio prompts, per-session system prompts, additional workspace directories (add extra folders as roots of the Project instead), logout (Hya keeps one credential per provider and offers no authenticate; configure credentials with hya auth login <provider>, authMethods is empty), and the unstable providers/* methods.

4. ACP v1 protocol reference

Agent capabilities

initialize negotiates protocolVersion: 1 and answers:

{
"protocolVersion": 1,
"agentInfo": { "name": "hya", "version": "0.54.0" },
"agentCapabilities": {
"loadSession": true,
"promptCapabilities": { "image": true, "audio": false, "embeddedContext": true },
"mcpCapabilities": { "http": true, "sse": true },
"sessionCapabilities": { "list": {}, "delete": {}, "resume": {}, "close": {}, "fork": {} }
},
"authMethods": []
}

Hya reads the editor’s clientCapabilities.elicitation.form to decide whether to ask questions through elicitation/create, clientCapabilities.session.compaction to decide whether to send compaction_update, and clientCapabilities.session.notices to decide whether to send a notice when the daemon stops (other Hya errors end an active prompt with an error response). It does not call the editor’s fs/* or terminal/* methods. fork is ACP’s unstable session/fork and is not offered with --temp.

Methods

Method Direction Summary
initialize Editor → Hya Negotiates ACP v1 and the capabilities above.
session/new Editor → Hya { cwd, mcpServers }: creates a session in the absolute directory cwd (resolving its Project) and returns { sessionId, modes, configOptions }, followed by an available_commands_update.
session/load Editor → Hya { sessionId, cwd, mcpServers }: replays the transcript and plan as session/update notifications, then returns { modes, configOptions }, followed by an available_commands_update.
session/resume Editor → Hya Same as session/load without the replay.
session/fork Editor → Hya Unstable. { sessionId, cwd, mcpServers }: forks the session at its head into a new session (an ordinary one, with the default permission mode) and returns { sessionId, modes, configOptions }, followed by an available_commands_update.
session/list Editor → Hya { cwd?, cursor? }: used root sessions that are not temp chats (of cwd when given), newest first, as { sessionId, cwd, title, updatedAt }, with nextCursor while more remain.
session/delete Editor → Hya { sessionId }: deletes the session and its event log.
session/set_mode Editor → Hya { sessionId, modeId }: sets the permission mode; a config_option_update follows.
session/set_config_option Editor → Hya { sessionId, configId, value } for mode, model, or effort; returns every option, and a current_mode_update when the mode changed.
session/prompt Editor → Hya { sessionId, prompt } with text, image, resource (text, or an image blob), and resource_link blocks. Resolves with { stopReason: "end_turn" | "max_tokens" | "cancelled" }.
session/cancel Editor → Hya Notification { sessionId } cancelling the active turn cleanly (idempotent).
session/close Editor → Hya Cancels any active turn on { sessionId } and shuts down its session-scoped MCP servers while keeping the saved transcript.
session/update Hya → Editor user_message_chunk (replay only), agent_message_chunk, agent_thought_chunk, tool_call, tool_call_update, plan, available_commands_update, current_mode_update, config_option_update, session_info_update (title), usage_update (context tokens used and the model’s window, when known), compaction_update (a completed compaction with its summary, when the client advertised session.compaction), and notice (a warning that the daemon is stopping, when the client advertised session.notices).
session/request_permission Hya → Editor { sessionId, toolCall, options }: toolCall carries kind, locations, content (an edit’s diff), and rawInput; option ids are allow, always (when offered), and deny. Any other outcome rejects once.
elicitation/create Hya → Editor Form mode, session scope, one required string field answer (an enum of the question’s options when it has any). accept answers; decline and cancel reject the question.

Example session/prompt request with an image and a mentioned file:

{"jsonrpc":"2.0","id":3,"method":"session/prompt","params":{"sessionId":"<sessionId>","prompt":[
{"type":"text","text":"Why does this fail? "},
{"type":"image","mimeType":"image/png","data":"<base64>","uri":"file:///work/repo/shot.png"},
{"type":"resource","resource":{"uri":"file:///work/repo/src/main.rs","text":"fn main() {}"}}]}}

Embedded text reaches the model as <resource uri="…">…</resource> blocks after the prompt text.

Config options

configId Category Values
mode mode The ids of ListPermissionModes for the session.
model model provider/model ids of models whose provider is authenticated (or needs no auth), plus the session’s current model. Changing it keeps the effort when the new model accepts it.
effort thought_level default and the current model’s reasoning variants; present only for models with variants.

Error codes

JSON-RPC code When returned
-32601 Method not found (including session/fork when running with --temp).
-32602 Invalid parameters (relative cwd, malformed MCP server name, unknown config value, unsupported content such as audio).
-32002 Unknown, deleted, or closed sessionId.
-32010 The editor sent a prompt while its previous prompt on that session is still running.
-32000 (auth_required) Model provider rejected credentials (error.data.code == "provider_auth", e.g. expired OAuth or HTTP 401/403).
-32011 Any other backend turn failure (error.data.code carries the Hya error code).

Editor-supplied MCP servers (OpenMcpSession)

MCP server names use ASCII letters, digits, _, or - without __; their tools appear to the model as mcp__<name>__<tool>. When an editor passes stdio servers ({ name, command, args, env }, command absolute), hya acp spawns them in the session’s cwd—keeping editor command lines and secrets inside the local adapter process—and bridges their streams to the daemon over owner-only Unix sockets. HTTP and SSE servers ({ type: "http" | "sse", name, url, headers }) are passed to the daemon, which connects to them directly and sends headers only to the configured URL’s origin (rejecting cross-origin redirects and cross-origin SSE endpoints). hya acp creates new sessions via CreateSession so the session watch opens immediately, then attaches or replaces session MCP servers through hya.v2.Mcp/OpenMcpSession (POST /v2/mcp/session SSE)—sending an empty peer list when reopening an existing session with no MCP servers so earlier exports are cleared. Two editor sessions can bind the same MCP server name to different tool sets without colliding.