ACP connectors, the session's model and mode, and a socket for the user's answers - #30
Merged
Merged
Conversation
… user's answers A connector is a named ACP agent: its command line, what it can do, its defaults. wfpy discovers the known ones on the PATH (opencode acp, Zed's claude-agent-acp for Claude Code, codex-acp, gemini --experimental-acp), the user's ~/.config/wfpy/connectors.toml adds or overrides, the workspace's .wfpy/connectors.toml at the project root overrides both; `wfpy connectors [--json]` lists them, available or not. The ACP transport is now `acp` (opencode-acp its older name): an agent names its connector, @agent(transport="acp", connector="claude"), a run's --acp-connector is the default, an explicit --agent-cli-acp-command wins as before. A connector's or an agent's model and mode are set on the session through what the agent offers at new_session or load_session: a config option `model` (Claude Code: default, sonnet, haiku, opus...) and the session modes; what is not offered is logged and left, OpenCode keeping its OPENCODE_CONFIG_CONTENT. --elicit-socket PATH puts the agents' questions and permission requests to whoever listens on a Unix socket, one JSON object a line, the wire format documented on SocketElicitationHandler: the IDE's side of the human port. No listener, a closed one, a reply to another question: a declined question, never a failed run. Verified on the adapter: a session with model=sonnet mode=default applied; a write permission answered Reject over the socket leaves no file, Allow writes it. 26 tests; the whole suite passes.
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.
Connectors. A connector is a named ACP agent: its command line, what it can do, its defaults. wfpy discovers the known ones on the PATH (
opencode acp, Zed'sclaude-agent-acpfor Claude Code,codex-acp,gemini --experimental-acp); the user's~/.config/wfpy/connectors.toml(XDG) adds or overrides; the workspace's.wfpy/connectors.tomlat the project root (the directory with apyproject.tomlor.gitabove the workflow file) overrides both.wfpy connectors [--json]lists them, available (the command's first word on the PATH) or not.The transport.
acpis the generic ACP transport (opencode-acpstays as its older name). An agent names its connector,@agent(transport="acp", connector="claude"); a run's--acp-connector NAMEis the default (opencode when nothing names one); an explicit--agent-cli-acp-commandwins as before. A connector's or an agent'smodelandmodeare applied to the session through what the agent offers atnew_session/load_session: amodelconfig option (Claude Code: default, sonnet, haiku, opus...) matched by value, name or prefix, and the session modes by id; what is not offered is logged and left. OpenCode keepsOPENCODE_CONFIG_CONTENT.The human port, for an IDE.
--elicit-socket PATH: the agents' questions and, over ACP, their permission requests go to whoever listens on a Unix socket, one JSON object a line; the wire format is onSocketElicitationHandler:No listener, a closed one, a reply to another question: a declined question (the reject option for a permission), never a failed run.
Verified on the adapter: a session with
model=sonnet mode=defaultapplied (appliedin the response); a write permission answered Reject over the socket leaves no file, Allow writes it;wfpy connectorson this machine lists opencode and claude available, codex and gemini not. 26 new tests; whole suite 637 passed.