Repository navigation
agent: sign in to an agent from the chat, through ACP - #18
Merged
Merged
Conversation
The agent's `authMethods` (from `initialize`) are read; a session start (or a prompt after a
sign-out) the agent refuses with `auth_required` (-32000) shows them as buttons in the
conversation instead of "The agent refused to start". An `agent` method sends
`authenticate { methodId }`, says "Waiting for <agent> to sign in..." and opens the session
again; a `terminal` method runs the agent's own command with the method's args and env through
a `terminal.run` command, and restarts the agent when it exits 0. Terminal methods never go to
`authenticate`. "Chat: Sign Out of the Agent" sends `logout` when the agent offers it.
What happens next at each step is `auth.Flow`, std-only and tested with the method parsing and
the request writers (`src/auth.zig`).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
foxnne
marked this pull request as ready for review
October 19, 2026 19:51
foxnne
added a commit
to fizzyedit/ghostty
that referenced
this pull request
Oct 19, 2026
Registers the internal command `terminal.run` that fizzyedit/chat#18 defined, so the chat's terminal sign-in (Claude Code's ACP adapter offers only `claude /login`) works. The program runs in a bottom-panel pane of its own with the request's argv, env and cwd; on exit the pane keeps its output with the exit code and a Close button, and the caller's `done` command gets `.{ tag, code }`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
foxnne
added a commit
to fizzyedit/ghostty
that referenced
this pull request
Oct 19, 2026
) Registers the internal command `terminal.run` that fizzyedit/chat#18 defined, so the chat's terminal sign-in (Claude Code's ACP adapter offers only `claude /login`) works. The program runs in a bottom-panel pane of its own with the request's argv, env and cwd; on exit the pane keeps its output with the exit code and a Close button, and the caller's `done` command gets `.{ tag, code }`. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of fizzyedit/plans
plans/AGENTS_ANYWHERE_PLAN.md, step 5 (sections 3–4).What changes
initializenow reads the agent'sauthMethodsandagentCapabilities.auth.logout, andadvertises
clientCapabilities.auth.terminalwhile some plugin registersterminal.run.session/new,session/resume,session/load, or a prompt after a sign-out comes backauth_required(-32000), the chat shows the agent's methods as buttons throughchat.ask. Itno longer prints "The agent refused to start". Any other refusal, or
auth_requiredfrom anagent with no methods, still gets the old note.
agentmethod: the chat sendsauthenticate { methodId }and shows "Waiting for tosign in...". On success it opens the session again, resuming the saved one if there was one, and
anything queued is sent. On failure it says why and shows the buttons again.
terminalmethod: the chat runs the configured agent command plus the method'sargs,with its
env, throughterminal.run. When that exits 0 the chat restarts the agent. Any otherexit shows the buttons again. A terminal method is never sent to
authenticate.agent.sign_out), sendslogout. It is enabled only while a running agent hasauth.logout.a sign-in is sent again once signed in. Terminal methods are shown only while
terminal.runexists.
acp.Inbound.responsenow carries the errorcode.Named seam:
terminal.runNo plugin runs a program in a terminal pane yet: ghostty's plugin registers no commands. So
src/auth.zigdefines the contract a terminal plugin fills:terminal.run { title, argv, env, cwd, done, tag }.donecommand with{ tag, code }.Until a plugin offers it, the chat does not advertise
auth.terminal. The spec then says theagent should not offer terminal methods. If an agent offers them anyway, the chat shows them,
and the chat leaves it out of the buttons. If that leaves no buttons, the chat says to sign in
with the agent's own CLI.
Claude's ACP adapter (0.93.0) offers only terminal methods (
claude-ai-login,console-login:--cli auth login …). So signing a logged-out Claude in needs the ghosttyfollow-up. A logged-in Claude is unaffected.
Checked against the spec
agentclientprotocol.com/protocol/authentication and the schema's
ErrorCode(
auth_required= -32000), on 2026-10-19:typeabsent meansagent.envis an object map.logouttakes{}, and is sent only whenagentCapabilities.auth.logoutis non-null.Verify
zig build test: new tests insrc/auth.zigcover method parsing (unknown types left out,terminal args/env, logout), the
initialize/authenticate/logoutrequest writers, andauth_required→ choose →authenticate→ retry, including a refusal and a terminal exit.--quietDebug fizzy from main, on its own profile, driven throughthe control socket:
shown. Its
initializeadvertisesauth.logoutand two terminal methods.agentmethod and a terminal one; it refusessession/newandprompts with -32000 until
authenticate):terminal.run.and answered.
🤖 Generated with Claude Code