anomalyco / anomalyco/opencode
[FEATURE]: Session-scoped bidirectional model and agent selection for attached TUI / ACP
@jlongster is already working on this.
Since Sep 13, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Feature hasn’t been suggested before.
- I have verified this feature I am about to request has not been suggested before.
Describe the enhancement you want to request
We embed an attached OpenCode TUI in a browser terminal while a controller owns the same runtime through ACP. We need supported selection state, change events, and setters for the model, variant, and primary agent, so the controller and TUI stay in sync.
Observed on OpenCode 1.18.30 (Linux, TUI attached inside tmux):
- Change the model using the built-in picker in
opencode attach, without submitting a prompt. The TUI selection changes, butGET /session/{id}does not immediately reflect it. - Change the persisted model with
POST /api/session/{id}/model. Native readback changes, but the attached TUI picker does not follow. - ACP
session/set_config_optioncan acknowledge a model change without updating that persisted selection.
Could OpenCode provide a session-scoped API/event contract that keeps these selections consistent? A supported TUI-plugin API would also help. Changes should affect subsequent turns, survive reconnects, and preserve draft prompt text without requiring simulated keystrokes or a TUI restart.
The model divergence above was reproduced using real picker interactions. Agent/variant synchronization is an enhancement request for the same use case, not a claim of independently reproduced bugs. This report describes the tested version, not a verification of current dev behavior.
Related, but not the same request: #47836, #43179, #46311. Happy to follow a preferred existing API or discuss the design before proposing a patch.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.