opencode-claude-code-acpbridge 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +335 -261
- package/LICENSE +21 -0
- package/README.md +633 -324
- package/dist/acp/claude-config.d.ts +1 -1
- package/dist/plugin/compat.d.ts +14 -0
- package/dist/plugin/compat.d.ts.map +1 -0
- package/dist/plugin/compat.js +45 -0
- package/dist/plugin/compat.js.map +1 -0
- package/dist/plugin/index.d.ts +8 -0
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +124 -30
- package/dist/plugin/index.js.map +1 -1
- package/dist/plugin/pairing.d.ts +66 -0
- package/dist/plugin/pairing.d.ts.map +1 -0
- package/dist/plugin/pairing.js +110 -0
- package/dist/plugin/pairing.js.map +1 -0
- package/dist/provider/factory.d.ts.map +1 -1
- package/dist/provider/factory.js +10 -1
- package/dist/provider/factory.js.map +1 -1
- package/dist/provider/model.d.ts +7 -1
- package/dist/provider/model.d.ts.map +1 -1
- package/dist/provider/model.js +54 -15
- package/dist/provider/model.js.map +1 -1
- package/docs/DEVELOPMENT.md +438 -138
- package/examples/01-minimal.jsonc +14 -9
- package/examples/02-per-agent-permissions.jsonc +39 -0
- package/examples/03-opencode-fidelity.jsonc +21 -0
- package/examples/04-model-and-effort.jsonc +36 -0
- package/examples/05-custom-agents.jsonc +32 -0
- package/examples/06-claude-ecosystem.jsonc +28 -0
- package/examples/07-manual-provider.jsonc +55 -0
- package/examples/08-permission-bridge.jsonc +42 -0
- package/examples/README.md +35 -17
- package/package.json +35 -30
- package/examples/02-permisos-por-agente.jsonc +0 -34
- package/examples/03-fidelidad-opencode.jsonc +0 -21
- package/examples/04-modelo-y-esfuerzo.jsonc +0 -36
- package/examples/05-agentes-personalizados.jsonc +0 -29
- package/examples/06-ecosistema-claude.jsonc +0 -24
- package/examples/07-provider-manual.jsonc +0 -42
- package/examples/08-puente-permisos.jsonc +0 -50
package/CHANGELOG.md
CHANGED
|
@@ -1,327 +1,401 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[Keep a Changelog](https://keepachangelog.com/)
|
|
3
|
+
All notable changes to `opencode-claude-code-acpbridge`. The format is based on
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/) and versions follow [SemVer](https://semver.org/).
|
|
5
|
+
|
|
6
|
+
> **OpenCode V2 only since 0.9.0.** Versions 0.9.0 and later load only in OpenCode V2. If you
|
|
7
|
+
> are still on OpenCode V1, stay on 0.8.x. See [MIGRATION_V2.md](MIGRATION_V2.md).
|
|
8
|
+
|
|
9
|
+
## [0.11.0] — 2026-10-26
|
|
10
|
+
|
|
11
|
+
### Changed — breaking
|
|
12
|
+
|
|
13
|
+
- **One agent per Claude Code mode.** The plugin injects a `claude-<mode>` agent for every
|
|
14
|
+
session mode the agent reports: `claude-default`, `claude-plan`, `claude-acceptedits`,
|
|
15
|
+
`claude-auto`, `claude-dontask`, `claude-bypasspermissions` (the six known modes when
|
|
16
|
+
discovery has none). They replace `claude-code` and `claude-code-plan`, with no aliases:
|
|
17
|
+
rename those agents in your `agents` section (`claude-code` → `claude-default`,
|
|
18
|
+
`claude-code-plan` → `claude-plan`). The mode only governs Claude's native tools; OpenCode's
|
|
19
|
+
tools keep the agent's OpenCode permissions. Effort stays a model variant; `claude-plan`
|
|
20
|
+
keeps `high`.
|
|
21
|
+
- **The `acp` models are paired with the Claude Code agents** (`pairModels`, default `true`).
|
|
22
|
+
OpenCode V2 offers every model to every agent, so the plugin enforces it:
|
|
23
|
+
- selecting an agent or model that breaks the pair moves the session back to a valid model
|
|
24
|
+
(the agent's own, the session's last non-`acp` model, or OpenCode's default `model`);
|
|
25
|
+
- an `acp` request from any other agent fails at once (HTTP 400, `x-should-retry: false`);
|
|
26
|
+
- OpenCode subagents launched from a `claude-*` agent get their own model or the default one
|
|
27
|
+
instead of inheriting `acp`.
|
|
28
|
+
|
|
29
|
+
Agents you declare with an `acp/…` model count as Claude Code agents. `pairModels: false`
|
|
30
|
+
restores the old behaviour.
|
|
31
|
+
- The usage-limit error now says to switch agent rather than model.
|
|
5
32
|
|
|
6
|
-
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- **Each effort variant started its own agent process.** OpenCode V2 builds a new SDK instance
|
|
36
|
+
for every distinct model `settings`, and the effort variants are settings, so `#high`,
|
|
37
|
+
`#low` and the plain model each spawned a `claude-agent-acp` that resumed the same Claude
|
|
38
|
+
session apart from the others (cache partly cold; going back to a variant found a process
|
|
39
|
+
that had missed the turns in between). Provider instances built from the same agent config
|
|
40
|
+
now share one orchestrator: effort switches live with `setSessionConfigOption`, and the
|
|
41
|
+
model without a variant restores the session's own effort.
|
|
42
|
+
|
|
43
|
+
## [0.10.1] — 2026-10-23
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
- **The usage-limit error was retried by OpenCode ≥ 2.1.** OpenCode 2.1 no longer decides
|
|
48
|
+
retries by the wording of the error message: any error it cannot classify is retried,
|
|
49
|
+
about 10 attempts over ~84 s, before the user can switch models. The error is now an
|
|
50
|
+
`APICallError` with HTTP 402 and `x-should-retry: false`. OpenCode classifies that as
|
|
51
|
+
`QuotaExceeded` and fails at once.
|
|
52
|
+
|
|
53
|
+
### Changed
|
|
54
|
+
|
|
55
|
+
- Documentation translated to English and rewritten for newcomers; OpenCode V2 only stated
|
|
56
|
+
explicitly.
|
|
57
|
+
- Runtime messages (usage-limit error, session notes, mode-change notice) translated to English.
|
|
58
|
+
- `@opencode/plugin` peer range narrowed to `^2.0.14` (excludes a future 3.x).
|
|
59
|
+
|
|
60
|
+
### Added
|
|
7
61
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
62
|
+
- MIT `LICENSE` file.
|
|
63
|
+
- Load-time compatibility warnings: OpenCode major version, and `claude-agent-acp` older than
|
|
64
|
+
the tested 0.31.
|
|
65
|
+
- `prepublishOnly` install check (`scripts/check-install.mjs`).
|
|
66
|
+
|
|
67
|
+
## [0.10.0] — 2026-10-22 — history sync, concurrency and continuity across models
|
|
68
|
+
|
|
69
|
+
A full review of the bridge against the OpenCode V2 source, `claude-agent-acp` 0.31 and
|
|
70
|
+
**real** recorded sessions. The goal: switch between `acp` and other models in the same
|
|
71
|
+
session without losing anything, and reuse the Claude Code session whenever possible.
|
|
72
|
+
Everything below is covered by `npm test` (a fake ACP agent plus real V2 prompts) and by the
|
|
73
|
+
scripts that run against the real agent.
|
|
13
74
|
|
|
14
75
|
### Fixed
|
|
15
76
|
|
|
16
|
-
- **
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- **
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- **
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
- **Usage**: `PromptResponse.usage`
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
- **
|
|
39
|
-
`session/close`
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
-
|
|
77
|
+
- **Claude's own reply was resent every turn** as `"Assistant: …"` inside the user message
|
|
78
|
+
(seen in transcripts; the model once called it "a fake message"). The provider now
|
|
79
|
+
recognises its own output (emitted texts, ids carrying its prefix) and does not send it back.
|
|
80
|
+
- **Lost messages**: what you typed while the agent was working (a *steer*), and the message
|
|
81
|
+
sent after **interrupting** a tool, were treated as a continuation of the turn and never
|
|
82
|
+
arrived. Now a steer joins the running turn (Claude Code's native queue), and an
|
|
83
|
+
interruption cancels the turn before the new message is sent.
|
|
84
|
+
- **Turns by another model attributed to Claude**: they arrived as
|
|
85
|
+
`Assistant: [Called tool …]`, so Claude believed it had made them. They now come wrapped in
|
|
86
|
+
`<other_model_turn>`.
|
|
87
|
+
- **Concurrent tool calls dropped** (native subagents running in parallel): the second call
|
|
88
|
+
was lost and the turn hung. Calls are now queued; read-only ones (`readOnlyHint`) are batched
|
|
89
|
+
into one step that OpenCode runs in parallel.
|
|
90
|
+
- **Security**: the bridge's `perm_N` ids repeated across processes, so an old answer
|
|
91
|
+
("Always allow") could approve a new permission. Ids now carry their own prefix and the last
|
|
92
|
+
match wins.
|
|
93
|
+
- An old prompt finishing (cancelled or merged) closed the stream of the following turn; text
|
|
94
|
+
from an aborted turn showed up at the start of the next one.
|
|
95
|
+
- Two simultaneous calls for the same conversation created two sessions (one orphaned).
|
|
96
|
+
- **Usage**: `PromptResponse.usage` is the sum of every request in the turn; reporting it as a
|
|
97
|
+
single request inflated the context size and triggered early compactions. The real context
|
|
98
|
+
occupancy (`usage_update.used`) is reported now, also on tool steps.
|
|
99
|
+
- **Sessions were never closed**: each one left a `claude` process running. Now
|
|
100
|
+
`session/close` is sent when a session is discarded, with an idle TTL (15 min; subagents
|
|
101
|
+
2 min) and an LRU of 6.
|
|
102
|
+
- **Junk titles** (`<invoke name="Read">`): with `preset`, the title instructions never reached
|
|
103
|
+
Claude. The plugin now titles the session from its first message, without calling the model.
|
|
104
|
+
- **OpenCode subagents running on `acp`** (they inherit the parent's model): with no profile,
|
|
105
|
+
every OpenCode tool asked the bridge for permission, and `general` (which has no `question`
|
|
106
|
+
tool) got them denied. Now every agent auto-allows OpenCode's tools, and the bridge denies
|
|
107
|
+
with a reason when the agent cannot ask. Rules are published for every agent.
|
|
108
|
+
- Switching to an agent with a different native profile reused the session with the old
|
|
109
|
+
profile; it now **forks** it (`session/fork`), keeping the context.
|
|
110
|
+
- Going back from plan to `claude-code` downgraded to `default` the mode chosen when the plan
|
|
111
|
+
was approved.
|
|
112
|
+
- Resume after a restart resent the provider's own traffic, and happened even when the
|
|
113
|
+
registry entry belonged to another conversation; the registry is now also updated mid-turn.
|
|
114
|
+
- A session lost on the agent side (dead `claude` process) failed on every turn; it is now
|
|
115
|
+
dropped and resumed.
|
|
116
|
+
- `mcp-runtime` ignored SIGTERM (registering the handler disables the default exit).
|
|
54
117
|
|
|
55
118
|
### Added
|
|
56
119
|
|
|
57
|
-
- **
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
- **`historyMode`** (`shadow`
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
- **`smartRevert`** (
|
|
65
|
-
|
|
66
|
-
- **
|
|
67
|
-
`session/set_model`
|
|
68
|
-
- **
|
|
69
|
-
|
|
70
|
-
- **ExitPlanMode**
|
|
71
|
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
- Log
|
|
76
|
-
`scripts/sanitize-recording.mjs`,
|
|
77
|
-
-
|
|
120
|
+
- **Native compaction**: `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=75` (`autoCompactPct`) makes Claude
|
|
121
|
+
compact before OpenCode does; if OpenCode compacts, the summary comes from the **live
|
|
122
|
+
session** (before: a full cold replay, 17K+ characters in the recording).
|
|
123
|
+
- **`historyMode`** (default `shadow`): a fingerprint made of anchors (user messages + tool ids)
|
|
124
|
+
that is immune to V2 re-rendering (reasoning→text, model switches), transient plan reminders
|
|
125
|
+
and DCP tags. In `shadow` it only logs disagreements; `v2` decides, and also adopts
|
|
126
|
+
OpenCode's checkpoint or catches up with another model's.
|
|
127
|
+
- **`smartRevert`** (on by default): a revert forks the session right before the reverted
|
|
128
|
+
message (`resumeSessionAt`) instead of replaying; `false` turns it off.
|
|
129
|
+
- **One agent process for every model** of the provider; switching models uses
|
|
130
|
+
`session/set_model` without losing the session.
|
|
131
|
+
- **Portable native activity** (`nativeActivity`): Task/WebSearch/Skill leave a `⚙ …` line
|
|
132
|
+
(with its result) in the reply, so any model can see it.
|
|
133
|
+
- **ExitPlanMode** with the real options (auto / accept edits / approve each edit / keep
|
|
134
|
+
planning); a typed answer comes back as feedback.
|
|
135
|
+
- Claude usage limit → a clear, non-retryable error ("switch models").
|
|
136
|
+
- Bounded (~400K characters) and labelled replay; the current request is sent separately.
|
|
137
|
+
- V2's initial **Code Mode** catalog is forwarded as context.
|
|
138
|
+
- Log file under `~/.acp-model-provider/logs/`, the `ACP_RECORD` recorder,
|
|
139
|
+
`scripts/sanitize-recording.mjs`, the `npm test` suite, `scripts/verify-smart-revert.mjs`.
|
|
140
|
+
- Options: `historyMode`, `catchupResultChars`, `parallelTools`, `toolBatchMs`,
|
|
78
141
|
`autoCompactPct`, `nativeActivity(Chars)`, `maxLiveSessions`, `idle/childSessionTtlMs`,
|
|
79
142
|
`smartRevert`; plugin: `titleFromModel`.
|
|
80
143
|
|
|
81
144
|
### Changed
|
|
82
145
|
|
|
83
|
-
-
|
|
84
|
-
|
|
85
|
-
- `allowedTools`
|
|
86
|
-
-
|
|
87
|
-
-
|
|
146
|
+
- Native `Read` is no longer in the default profile (what it read never reached OpenCode's
|
|
147
|
+
history); V2's `read` covers images and PDFs.
|
|
148
|
+
- `allowedTools` defaults to `["mcp__opencode"]` for every agent.
|
|
149
|
+
- The `claude-code*` agents deny `compress` (opencode-dcp).
|
|
150
|
+
- The session registry has an in-memory cache and pruning (30 days / 500 entries).
|
|
88
151
|
|
|
89
|
-
## 0.9.0 —
|
|
152
|
+
## [0.9.0] — 2026-10-01 — OpenCode V2
|
|
90
153
|
|
|
91
|
-
> ⚠️ **0.9.0+
|
|
154
|
+
> ⚠️ **0.9.0+ works only with OpenCode V2; for OpenCode V1 stay on 0.8.x.**
|
|
92
155
|
>
|
|
93
|
-
>
|
|
94
|
-
> (`export default { id, server }`,
|
|
95
|
-
>
|
|
156
|
+
> The port is a **complete runtime breaking change**: the V1 plugin
|
|
157
|
+
> (`export default { id, server }`, `config`/`chat.params` hooks) does not load in OpenCode V2,
|
|
158
|
+
> and the V2 plugin (`Plugin.define`) does not load in OpenCode V1.
|
|
96
159
|
|
|
97
|
-
Port
|
|
160
|
+
Port of the plugin and the provider to OpenCode's **V2** plugin runtime.
|
|
98
161
|
|
|
99
162
|
### Breaking changes
|
|
100
163
|
|
|
101
|
-
|
|
|
164
|
+
| Area | V1 (0.8.x) | V2 (0.9.0) |
|
|
102
165
|
| :--- | :--- | :--- |
|
|
103
|
-
| **
|
|
104
|
-
| **
|
|
105
|
-
| **
|
|
106
|
-
| **
|
|
107
|
-
| **
|
|
108
|
-
| **
|
|
109
|
-
| **
|
|
110
|
-
| **
|
|
111
|
-
| **Revert /
|
|
112
|
-
| **
|
|
113
|
-
| **CLI** | `opencode run`
|
|
114
|
-
| **
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
y [MIGRATION_V2.md](MIGRATION_V2.md).
|
|
166
|
+
| **Plugin runtime** | `export default { id, server }`, `config`/`chat.params` hooks | `Plugin.define({ id, setup })` with the promise API (`setup` returns a cleanup) |
|
|
167
|
+
| **Plugin config** | `"plugin": [[pkg, {opts}]]` | `"plugins": [{ "package", "options" }]` |
|
|
168
|
+
| **Provider auto-registration** | the `config` hook mutated `cfg.provider.acp` | `provider.transform` registers it as `aisdk:<spec>` (with `options.command`); if you declare `provider.<id>` by hand, it is not overwritten |
|
|
169
|
+
| **Per-call injection** | `chat.params` hook → `providerOptions.acp.{ocSession, resumeId, resumeLen}` | `session.hook("context")` → `ocSession`, `ocAgent`, `resumeId`, `resumeLen`, `resumeLastUsage`, `resumeConvKey`, plus the agent's options, per call |
|
|
170
|
+
| **Agents (config)** | `agent:` section with `permission` (map `{tool: "allow"\|"deny"\|"ask"\|glob}`) and `disable` | `agents:` section with `permissions` (ruleset array `[{action, resource, effect}]`), `disabled` and `mode: "subagent"\|"primary"\|"all"` |
|
|
171
|
+
| **Per-agent options** | `agent.<n>.options` (mode/effort/native*) | `plugins[0].options.agents.<n>.options` (same options, different path) |
|
|
172
|
+
| **Permission bridge** | `claude_permission` meta-tool (an `ask` prompt via `ctx.ask`) | emits a **tool call to OpenCode's built-in `question` tool** (dialog `Allow once` / `Always allow` / `Deny`); rules from `agents.<n>.permissions` evaluated in `src/plugin/bridge-rules.ts`, **fail-closed** (deliberately ignores `action:"*"`); `Always allow` is saved in `~/.acp-model-provider/always.json` |
|
|
173
|
+
| **Effort variants** | `acp/opus:low` | `acp/opus#low` (`provider/model#variant`) |
|
|
174
|
+
| **Revert / compaction** | fingerprint via `chat.params` | `session.revert.committed\|cleared` events → `clearLink` |
|
|
175
|
+
| **Local development** | target = a file (`…/dist/index.js`) | target = a **directory path** with a root `index.js` (V2's `Host.resolve` looks for `<dir>/index.*`); files are rejected |
|
|
176
|
+
| **CLI** | `opencode run` applied `agent.model` | `opencode run` **without `-m` ignores `agent.model`** (uses the global model); use `-m acp/…` |
|
|
177
|
+
| **Requirements** | OpenCode V1 | OpenCode **V2 (`>= 2.0.14`)** and the `@agentclientprotocol/claude-agent-acp` agent (formerly `@zed-industries/claude-agent-acp`) |
|
|
178
|
+
|
|
179
|
+
Practical migration guide: [MIGRATION_V2.md](MIGRATION_V2.md) and the [README](README.md).
|
|
118
180
|
|
|
119
181
|
### Added
|
|
120
182
|
|
|
121
|
-
- **
|
|
122
|
-
`provider.<id>`
|
|
123
|
-
- **Revert/
|
|
124
|
-
|
|
125
|
-
- **
|
|
126
|
-
|
|
183
|
+
- **Provider auto-registration as `aisdk:<spec>`** (with `options.command`); if you declare
|
|
184
|
+
`provider.<id>` by hand in config, the plugin no longer overwrites it (new guard).
|
|
185
|
+
- **Revert/compaction**: the plugin listens to `session.revert.*` and clears the session link
|
|
186
|
+
→ a full replay when the history diverges.
|
|
187
|
+
- **Local directory entrypoint**: a root `index.js` re-exports `dist/` (V2's `Host.resolve`
|
|
188
|
+
looks for `<dir>/index.*`); in development, `package` = the directory path.
|
|
127
189
|
|
|
128
190
|
## [0.8.0] — 2026-08-21
|
|
129
191
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
prompt manteniendo la misma sesión de Claude Code.
|
|
192
|
+
A release focused on **token cost** and **session continuity**. Almost every problem had the
|
|
193
|
+
same root cause: the provider recreated the ACP session far too easily, and each recreation
|
|
194
|
+
means a full history replay and a cold prompt cache. Now a conversation survives changes of
|
|
195
|
+
agent, tools and system prompt while keeping the same Claude Code session.
|
|
135
196
|
|
|
136
197
|
### ⚠️ Breaking
|
|
137
198
|
|
|
138
|
-
- **`claudeCode.configDir`
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
OpenCode se disparase nunca y la conversación crecía sin límite.
|
|
199
|
+
- **`claudeCode.configDir` now inherits `~/.claude` by default** (previously `"isolated"`).
|
|
200
|
+
Sessions started from OpenCode are now stored in `~/.claude/projects/…`, so **they can be
|
|
201
|
+
resumed natively with `claude --resume <id>`** (the provider prints the id when it creates
|
|
202
|
+
each session). This does **not** bring back the user's ecosystem: `settingSources`, `tools`
|
|
203
|
+
and `strictMcpConfig` still decide what the agent loads; `configDir` only decides where its
|
|
204
|
+
state lives. To get the old behaviour back: `"configDir": "isolated"`. A welcome side effect:
|
|
205
|
+
the credentials symlink is gone, and with it the class of 401 desync bugs.
|
|
206
|
+
- **The advertised context limit is no longer inflated to 1M** for the `default` model; only
|
|
207
|
+
the real `[1m]` variants declare it. Advertising 1M kept OpenCode's auto-compaction from ever
|
|
208
|
+
triggering, and the conversation grew without bound.
|
|
149
209
|
|
|
150
210
|
### Fixed
|
|
151
211
|
|
|
152
|
-
- **
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
- **
|
|
160
|
-
|
|
161
|
-
**
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
- **
|
|
166
|
-
|
|
167
|
-
- **
|
|
168
|
-
`tools=0`
|
|
169
|
-
- **
|
|
170
|
-
stdio
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
- **
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
- **
|
|
182
|
-
`TurnState`
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
- **`claude-code-plan` no
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
- **
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
- **
|
|
194
|
-
prompt
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
- **
|
|
198
|
-
`providerID: "opencode"` (
|
|
199
|
-
`disallowedTools`.
|
|
200
|
-
- **
|
|
201
|
-
|
|
202
|
-
- **
|
|
203
|
-
- **
|
|
204
|
-
(
|
|
212
|
+
- **Disproportionate token spend (the main cause).** `sentLen` was set at the start of the
|
|
213
|
+
turn and not updated in the continuation branch, so every turn resent as plain text **all the
|
|
214
|
+
`tool-call`/`tool-result` pairs of the previous turn** (full file dumps, shell output, greps)
|
|
215
|
+
that the agent **already had** in its session. It also invalidated the prompt cache every
|
|
216
|
+
turn. The state now records the fingerprint of the history already sent, and the provider's
|
|
217
|
+
own calls (identified by the host's nonce prefix) are left out of the catch-up; other
|
|
218
|
+
models' results are truncated to 2000 characters.
|
|
219
|
+
- **Switching agents destroyed the session and replayed everything.** `systemKey` hashed
|
|
220
|
+
OpenCode's system prompt even with `systemPromptMode: "preset"`, a mode in which that system
|
|
221
|
+
prompt is **never sent to the agent**. Any agent switch, or the churn of OpenCode's dynamic
|
|
222
|
+
blocks (date, `AGENTS.md`, skills), recreated the session over text the agent never saw.
|
|
223
|
+
The system prompt now counts as identity only when it is actually sent, and the
|
|
224
|
+
`claude-code-plan` → build → `claude-code` flow keeps the same ACP session.
|
|
225
|
+
- **A change in the tool set no longer recreates the session.** It is applied live to the
|
|
226
|
+
running session through `notifications/tools/list_changed` over the MCP channel.
|
|
227
|
+
- **The title/summary model call no longer destroyed the conversation.** It arrives with
|
|
228
|
+
`tools=0` on the same model and session; it is now served by a separate throwaway session.
|
|
229
|
+
- **Truncated text and invisible reasoning (same cause).** Text and thinking arrive over ACP
|
|
230
|
+
stdio, while tool calls arrive over the `McpHost` TCP socket, with no guaranteed ordering.
|
|
231
|
+
When a tool call closed the stream, everything still arriving was **silently dropped**, and
|
|
232
|
+
since thinking is emitted right before each tool call, it vanished almost entirely even with
|
|
233
|
+
`effort: max`. Those chunks are now **buffered** and flushed in order into the continuation
|
|
234
|
+
stream.
|
|
235
|
+
- **Reverting messages left both sides out of sync.** The provider kept only a counter, so a
|
|
236
|
+
truncated history fell into a silent fallback that resent **the whole** history on top of a
|
|
237
|
+
session that already had it. The history fingerprint is now compared to tell an *append*
|
|
238
|
+
(send only what's new) from a *revert* / *compaction divergence* (new session from the
|
|
239
|
+
truncated history). The plugin also listens to `session.updated` and drops the registered
|
|
240
|
+
link as soon as the revert point moves.
|
|
241
|
+
- **Two simultaneous conversations destroyed each other's session.** There was a single
|
|
242
|
+
`TurnState` per model instance, shared by every chat and subagent: each turn switched
|
|
243
|
+
conversation and forced a full replay. There is now **one session per conversation** (with an
|
|
244
|
+
LRU bound), and the agent's callbacks are routed by `sessionId`.
|
|
245
|
+
- **`claude-code-plan` had no way out of plan mode.** `ExitPlanMode` was not exposed to the
|
|
246
|
+
agent, it did not see OpenCode's `plan_exit`, and the bridge forced `plan` again every turn:
|
|
247
|
+
a closed loop that left all the already-written `switch_mode` handling dead. `ExitPlanMode`
|
|
248
|
+
is now exposed, and **re-selecting the plan agent by hand re-applies `mode: "plan"`**
|
|
249
|
+
(before, `modeChangedByAgent` was never reset).
|
|
250
|
+
- **Approving a plan granted `bypassPermissions`.** The first `allow_*` option offered by the
|
|
251
|
+
agent was picked, and that is the broadest one. `default` (manual approval of edits) is now
|
|
252
|
+
preferred for `switch_mode`.
|
|
253
|
+
- **The agent did not use OpenCode's `question` tool.** Its instruction lives in OpenCode's
|
|
254
|
+
system prompt, which is not forwarded with `preset`, and its native `AskUserQuestion` is
|
|
255
|
+
disabled by the ACP agent itself. The `question` tool's **description** now says so
|
|
256
|
+
explicitly (a tool description is not a system prompt: it doesn't affect billing).
|
|
257
|
+
- **The agent had no web search.** OpenCode only registers its `websearch` for
|
|
258
|
+
`providerID: "opencode"` (or with exa/parallel), and native `WebSearch` was in
|
|
259
|
+
`disallowedTools`. Native `WebSearch` is now part of the profile.
|
|
260
|
+
- **Tool results arrived flattened to text**, losing images and attachments. Structured
|
|
261
|
+
content is now mapped to MCP blocks.
|
|
262
|
+
- **A rejected `effort` was silently swallowed**; a warning is now printed to stderr.
|
|
263
|
+
- **Cancelling a turn no longer tears down the session**: the turn is cancelled and the session
|
|
264
|
+
(and its cache) is kept for the next message.
|
|
205
265
|
|
|
206
266
|
### Changed
|
|
207
267
|
|
|
208
|
-
- **`claude-code`
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
- **
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
-
|
|
221
|
-
`ACP_DEBUG`,
|
|
268
|
+
- **`claude-code` and `claude-code-plan` share exactly the same tool and permission profile**,
|
|
269
|
+
and differ **only** in their initial mode. Before, they also differed in `nativeTools`, which
|
|
270
|
+
left a half-way state: the agent left plan mode on its own (OpenCode does not switch agents
|
|
271
|
+
because of it) and believed it could edit while OpenCode still gave it the restricted
|
|
272
|
+
profile.
|
|
273
|
+
- **New option `claudeCode.forwardEnvContext`** (default `true`): forwards the **factual** part
|
|
274
|
+
of OpenCode's system prompt (`<env>`: working directory, workspace root, git, platform, date;
|
|
275
|
+
and `<available_references>`) as user context. With `preset` the system prompt never reaches
|
|
276
|
+
the agent, so it worked without knowing where it was. Only factual blocks are sent, never
|
|
277
|
+
OpenCode's behavioural instructions, so the session stays on the subscription (verified with
|
|
278
|
+
`scripts/verify-billing.mjs`). It is sent in full once per session, then only the delta of
|
|
279
|
+
what changed.
|
|
280
|
+
- The Claude Code session id is logged to stderr when the session is created, without needing
|
|
281
|
+
`ACP_DEBUG`, together with the command to resume it.
|
|
222
282
|
|
|
223
283
|
### Known issues
|
|
224
284
|
|
|
225
|
-
-
|
|
226
|
-
|
|
285
|
+
- The per-turn `usage` breakdown is reported cumulatively by the ACP agent, and some turns may
|
|
286
|
+
show a delta of 0; the session total is correct.
|
|
287
|
+
|
|
288
|
+
## Changes between 0.7.0 and 0.8.0
|
|
227
289
|
|
|
228
|
-
|
|
290
|
+
These entries were listed as "Unreleased" after 0.7.0 and shipped with 0.8.0.
|
|
229
291
|
|
|
230
292
|
### Added
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
293
|
+
|
|
294
|
+
- **Proper `ExitPlanMode` handling.** When the agent leaves plan mode (it arrives as a
|
|
295
|
+
`requestPermission` with `toolCall.kind === "switch_mode"`):
|
|
296
|
+
- the **plan** (markdown in `rawInput.plan`) is now **rendered as assistant text** before the
|
|
297
|
+
approval prompt, instead of being buried in the metadata;
|
|
298
|
+
- the permission is labelled consistently as **`ExitPlanMode`** (a
|
|
299
|
+
`permission: { ExitPlanMode: "allow" }` rule is possible; by default it asks);
|
|
300
|
+
- `current_mode_update` is now handled and, once the plan is approved (plan →
|
|
301
|
+
default/acceptEdits), the bridge **stops forcing** the agent's mode again, so the
|
|
302
|
+
implementation continues in the same session instead of going back to plan on the next
|
|
303
|
+
turn.
|
|
240
304
|
|
|
241
305
|
### Fixed
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
features nativos que `claude-code` (subagentes nativos que corren en la suscripción y
|
|
269
|
-
delegan tools a OpenCode), con `mode: "plan"` y sin la tool de edición nativa
|
|
270
|
-
(`NotebookEdit`) por ser modo de solo lectura.
|
|
306
|
+
|
|
307
|
+
- **Switching from a normal agent to `claude-code` (ACP) mid-session ignored all previous
|
|
308
|
+
progress.** Both the live reuse of an ACP session (`this.current`, which survives an agent
|
|
309
|
+
switch intact) and the `resume` after a process restart assumed that the only new thing
|
|
310
|
+
since the last ACP turn was the latest user message (`lastUserBlocks`). If another agent
|
|
311
|
+
(e.g. a different model) ran turns in the same OpenCode conversation in between, those turns
|
|
312
|
+
never reached Claude Code: it resumed/reused with its old history plus only the newest
|
|
313
|
+
message, which looked like a fresh session. `TurnState` now keeps `sentLen` (how far the
|
|
314
|
+
agent's knowledge goes), and each send uses `catchUpBlocks`, which rebuilds as a transcript
|
|
315
|
+
(with role prefixes) **everything** that happened from `sentLen` on: one message in the
|
|
316
|
+
normal case, the whole stretch if another agent ran in between.
|
|
317
|
+
- **Corrupted tool results (stale/misrouted results).** The `toolCallId` was minted as
|
|
318
|
+
`acp_${counter}` with a counter **per `McpHost`** that **reset to 0** on every ACP session
|
|
319
|
+
reset (tool/system prompt change, new conversation, resume). Within one conversation
|
|
320
|
+
OpenCode resends the whole history; after a reset a new call got `acp_1` again, and
|
|
321
|
+
`detectContinuation` matched it with an **old** tool result in the history: glob returned a
|
|
322
|
+
README, bash returned "background agent task launched", and so on. Each host now uses a
|
|
323
|
+
**random nonce prefix** (`acp_<hex>_${counter}`), so ids never collide across sessions,
|
|
324
|
+
process restarts or resumes.
|
|
325
|
+
- **`claude-code-plan`: subagents (`Task`) failed.** The plan agent had no `nativeSubagents`,
|
|
326
|
+
so its `Task` was not Claude Code's native one but OpenCode's forwarded `task`. OpenCode then
|
|
327
|
+
created subagents (`explore`, …) routed to **other providers** (`opencode-go`/`opencode`),
|
|
328
|
+
which failed with *Bad Gateway* / *Insufficient Balance* / *ProviderModelNotFound*.
|
|
329
|
+
`claude-code-plan` now shares the same native feature base as `claude-code` (native
|
|
330
|
+
subagents that run on the subscription and delegate tools to OpenCode), with `mode: "plan"`
|
|
331
|
+
and without the native editing tool (`NotebookEdit`), since plan mode is read-only.
|
|
271
332
|
|
|
272
333
|
## [0.7.0] — 2026-06-27
|
|
273
334
|
|
|
274
|
-
|
|
275
|
-
|
|
335
|
+
Native Claude Code capabilities inside OpenCode, with a **permission bridge** that keeps
|
|
336
|
+
OpenCode in charge of every action ("native power without breaking anything").
|
|
276
337
|
|
|
277
338
|
### Added
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
**
|
|
339
|
+
|
|
340
|
+
- **Permission bridge**: when the agent uses a **native** Claude tool (Skill, Read,
|
|
341
|
+
NotebookEdit, Task, MCP resource search), its `requestPermission` (ACP) is routed to
|
|
342
|
+
**OpenCode's `ask` prompt** through the `claude_permission` meta-tool. The prompt shows the
|
|
343
|
+
**native tool** and the action; it supports **"Allow always"** and **per-tool glob rules**
|
|
282
344
|
(`permission: { Bash: { "git *": "allow" }, Skill: { "*": "ask" } }`).
|
|
283
|
-
- **
|
|
284
|
-
off
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
- **
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
-
|
|
345
|
+
- **Native feature toggles** in `claudeCode` (they compose the SDK options; with all of them
|
|
346
|
+
off you get the clean brain): `nativeTools`, `resourceSearch`, `nativeSubagents` (a subagent
|
|
347
|
+
that delegates to OpenCode), `nativeSkills`, `projectMemory`, `skillShell`, `allowedTools`.
|
|
348
|
+
Verified: **all of them keep the subscription** (0 extra usage).
|
|
349
|
+
- **Hybrid model**: common tools (bash/read/write/edit/grep/…) are orchestrated by OpenCode
|
|
350
|
+
without double permission prompts (`allowedTools: ["mcp__opencode"]`); the better native
|
|
351
|
+
tools go through the bridge.
|
|
352
|
+
- Native **`Read`** tool enabled in the `claude-code` agent (multimodal reading:
|
|
353
|
+
images/PDF/notebooks).
|
|
354
|
+
- Verification scripts (`scripts/`): `verify-billing.mjs`, `spike-permission-bridge.mjs`.
|
|
291
355
|
|
|
292
356
|
### Changed
|
|
293
|
-
|
|
294
|
-
|
|
357
|
+
|
|
358
|
+
- The `claude-code` agent moves from `mode: "bypassPermissions"` to **`mode: "default"`** (so
|
|
359
|
+
the bridge can act). The classic clean brain is still available (`mode: "bypassPermissions"`
|
|
360
|
+
with no toggles).
|
|
295
361
|
|
|
296
362
|
### Fixed
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
-
|
|
363
|
+
|
|
364
|
+
- **`host closed`**: `onCancel` no longer tears down the session while a deferred tool call or
|
|
365
|
+
permission is in flight (OpenCode cancels the stream when it pauses for the `ask`); a
|
|
366
|
+
**watchdog** releases it if the continuation never arrives.
|
|
367
|
+
- **Auth desync (401)**: the credentials symlink of the isolated config dir is **re-linked on
|
|
368
|
+
every start** (the agent could replace it with a stale file when refreshing the token).
|
|
369
|
+
- The bridge **fails closed** (denies on an ambiguous verdict); `endTurn`/reuse **drain**
|
|
370
|
+
pending permissions so the agent is never left hanging.
|
|
371
|
+
- `claude_permission` is **filtered out of the host** (the agent no longer sees it as
|
|
372
|
+
`mcp__opencode__claude_permission`).
|
|
373
|
+
- The agent no longer tries common native tools it cannot run (`disallowedTools`
|
|
374
|
+
Bash/Write/Edit/…).
|
|
306
375
|
|
|
307
376
|
## [0.6.0]
|
|
308
377
|
|
|
309
378
|
### Changed
|
|
310
|
-
|
|
311
|
-
|
|
379
|
+
|
|
380
|
+
- **Renamed**: `acp-model-provider` → **`opencode-claude-code-acpbridge`** (a plugin dedicated
|
|
381
|
+
to using Claude Code inside OpenCode).
|
|
312
382
|
|
|
313
383
|
### Added
|
|
314
|
-
|
|
315
|
-
- `
|
|
316
|
-
|
|
317
|
-
-
|
|
384
|
+
|
|
385
|
+
- `strictMcpConfig` (default `true`): ignores the claude.ai account connectors
|
|
386
|
+
(Gmail/Drive/Supabase/…).
|
|
387
|
+
- `thinking` defaults to `{type:"enabled", display:"summarized"}`: the **reasoning block** is
|
|
388
|
+
visible in OpenCode.
|
|
389
|
+
- **Session resume across processes** (`sessions.json` registry + `unstable_resumeSession`).
|
|
390
|
+
- **Token usage reporting** (mapping of ACP's `PromptResponse.usage`).
|
|
318
391
|
|
|
319
392
|
## [0.5.x]
|
|
320
393
|
|
|
321
394
|
### Added
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
-
|
|
395
|
+
|
|
396
|
+
- **Provider auto-registration** (minimal config): discovers the agent's models and injects
|
|
397
|
+
`provider.acp` with models.dev metadata.
|
|
398
|
+
- **Injected agents** `claude-code` / `claude-code-plan`, with per-agent mode/effort changed
|
|
399
|
+
live; the user's config in `opencode.json` takes precedence (merge).
|
|
400
|
+
- **Subscription billing** (`systemPromptMode: "preset"`): 0 extra usage.
|
|
401
|
+
- Complete documentation (README + `docs/DEVELOPMENT.md` + `examples/`).
|