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.
Files changed (41) hide show
  1. package/CHANGELOG.md +335 -261
  2. package/LICENSE +21 -0
  3. package/README.md +633 -324
  4. package/dist/acp/claude-config.d.ts +1 -1
  5. package/dist/plugin/compat.d.ts +14 -0
  6. package/dist/plugin/compat.d.ts.map +1 -0
  7. package/dist/plugin/compat.js +45 -0
  8. package/dist/plugin/compat.js.map +1 -0
  9. package/dist/plugin/index.d.ts +8 -0
  10. package/dist/plugin/index.d.ts.map +1 -1
  11. package/dist/plugin/index.js +124 -30
  12. package/dist/plugin/index.js.map +1 -1
  13. package/dist/plugin/pairing.d.ts +66 -0
  14. package/dist/plugin/pairing.d.ts.map +1 -0
  15. package/dist/plugin/pairing.js +110 -0
  16. package/dist/plugin/pairing.js.map +1 -0
  17. package/dist/provider/factory.d.ts.map +1 -1
  18. package/dist/provider/factory.js +10 -1
  19. package/dist/provider/factory.js.map +1 -1
  20. package/dist/provider/model.d.ts +7 -1
  21. package/dist/provider/model.d.ts.map +1 -1
  22. package/dist/provider/model.js +54 -15
  23. package/dist/provider/model.js.map +1 -1
  24. package/docs/DEVELOPMENT.md +438 -138
  25. package/examples/01-minimal.jsonc +14 -9
  26. package/examples/02-per-agent-permissions.jsonc +39 -0
  27. package/examples/03-opencode-fidelity.jsonc +21 -0
  28. package/examples/04-model-and-effort.jsonc +36 -0
  29. package/examples/05-custom-agents.jsonc +32 -0
  30. package/examples/06-claude-ecosystem.jsonc +28 -0
  31. package/examples/07-manual-provider.jsonc +55 -0
  32. package/examples/08-permission-bridge.jsonc +42 -0
  33. package/examples/README.md +35 -17
  34. package/package.json +35 -30
  35. package/examples/02-permisos-por-agente.jsonc +0 -34
  36. package/examples/03-fidelidad-opencode.jsonc +0 -21
  37. package/examples/04-modelo-y-esfuerzo.jsonc +0 -36
  38. package/examples/05-agentes-personalizados.jsonc +0 -29
  39. package/examples/06-ecosistema-claude.jsonc +0 -24
  40. package/examples/07-provider-manual.jsonc +0 -42
  41. package/examples/08-puente-permisos.jsonc +0 -50
package/CHANGELOG.md CHANGED
@@ -1,327 +1,401 @@
1
1
  # Changelog
2
2
 
3
- Todas las versiones notables de `opencode-claude-code-acpbridge`. Formato basado en
4
- [Keep a Changelog](https://keepachangelog.com/); versionado [SemVer](https://semver.org/).
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
- ## [0.10.0] — 2026-10-22 — sincronía de historial, concurrencia y continuidad entre modelos
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
- Revisión completa del puente contra el código de OpenCode V2, `claude-agent-acp` 0.31 y
9
- sesiones **reales** grabadas. Objetivo: alternar entre `acp` y otros modelos en la misma
10
- sesión sin perder nada, y que la sesión de Claude Code se reutilice siempre que se pueda.
11
- Todo lo de abajo está cubierto por `npm test` (agente ACP falso + prompts reales de V2) y por
12
- los scripts contra el agente real.
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
- - **La respuesta propia se reenviaba cada turno** como `"Assistant: …"` dentro del mensaje
17
- del usuario (visto en transcripciones: el modelo llegó a llamarlo "mensaje falso"). El
18
- provider reconoce ahora su propia salida (textos emitidos, ids con su prefijo) y no la
19
- devuelve.
20
- - **Mensajes perdidos**: lo que escribías mientras el agente trabajaba (*steer*) y el mensaje
21
- tras **interrumpir** una tool se trataban como continuación del turno y nunca llegaban.
22
- Ahora el steer entra en el turno en curso (cola nativa de Claude Code) y la interrupción
23
- cancela el turno antes de enviar el mensaje nuevo.
24
- - **Turnos de otro modelo atribuidos a Claude**: llegaban como `Assistant: [Called tool …]` y
25
- Claude creía haberlos hecho él. Ahora van en `<other_model_turn>`.
26
- - **Tool-calls concurrentes descartadas** (subagentes nativos en paralelo): la segunda se
27
- perdía y el turno colgaba. Ahora se encolan; las de solo lectura (`readOnlyHint`) se
28
- agrupan en un paso que OpenCode ejecuta en paralelo.
29
- - **Seguridad**: los ids `perm_N` del puente se repetían entre procesos y una respuesta
30
- vieja ("Always allow") podía aprobar un permiso nuevo. Ids con prefijo propio y última
31
- coincidencia.
32
- - La finalización de un prompt viejo (cancelado o fusionado) cerraba el stream del turno
33
- siguiente; texto de un turno abortado aparecía al principio del siguiente.
34
- - Dos llamadas simultáneas a la misma conversación creaban dos sesiones (una huérfana).
35
- - **Usage**: `PromptResponse.usage` es la suma de todos los requests del turno; reportarla
36
- como un único request inflaba el contexto y adelantaba compactaciones. Ahora se reporta
37
- la ocupación real (`usage_update.used`), también en los pasos con tools.
38
- - **Sesiones nunca cerradas**: cada una dejaba vivo un proceso `claude`. Ahora
39
- `session/close` al descartar, TTL de inactividad (15 min; subagentes 2 min) y LRU de 6.
40
- - **Títulos basura** (`<invoke name="Read">`): con `preset` las instrucciones de título no
41
- llegaban a Claude. El plugin titula a partir del primer mensaje, sin llamar al modelo.
42
- - **Subagentes de OpenCode sobre `acp`** (heredan el modelo del padre): sin perfil, cada tool
43
- de OpenCode pedía permiso al puente y el `general` (sin `question`) las veía denegadas.
44
- Ahora todo agente auto-permite las tools de OpenCode y el puente deniega con motivo si el
45
- agente no puede preguntar. Reglas publicadas para todos los agentes.
46
- - Cambiar a un agente con otro perfil nativo reutilizaba la sesión con el perfil viejo;
47
- ahora la **bifurca** (`session/fork`) conservando el contexto.
48
- - Volver de plan a `claude-code` rebajaba a `default` el modo elegido al aprobar el plan.
49
- - El resume tras reinicio reenviaba tráfico propio y se hacía aunque el registro fuese de
50
- otra conversación; el registro se actualiza también a mitad de turno.
51
- - Una sesión perdida en el agente (proceso `claude` muerto) fallaba en cada turno; ahora se
52
- suelta y se reanuda.
53
- - `mcp-runtime` ignoraba SIGTERM (registrar el handler desactiva la salida por defecto).
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
- - **Compactación nativa**: `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=75` (`autoCompactPct`) para que
58
- Claude compacte antes que OpenCode; si OpenCode compacta, el resumen sale de la **sesión
59
- viva** (antes: replay completo en frío, 17K+ caracteres en la grabación).
60
- - **`historyMode`** (`shadow` por defecto): huella por anclas (mensajes del usuario + ids de
61
- tools) inmune a re-renderizados de V2 (reasoning→texto, cambio de modelo), recordatorios de
62
- plan transitorios y etiquetas de DCP. En `shadow` solo registra discrepancias; `v2` decide
63
- y además adopta el checkpoint de OpenCode o pone al día con el de otro modelo.
64
- - **`smartRevert`** (por defecto): un revert bifurca la sesión justo antes del mensaje
65
- revertido (`resumeSessionAt`) en vez de replay; `false` lo desactiva.
66
- - **Un proceso del agente para todos los modelos** del provider; cambio de modelo con
67
- `session/set_model` sin perder la sesión.
68
- - **Actividad nativa portable** (`nativeActivity`): Task/WebSearch/Skill dejan una línea
69
- `⚙ …` (con su resultado) en la respuesta → visible para cualquier modelo.
70
- - **ExitPlanMode** con las opciones reales (auto / aceptar ediciones / aprobar cada edición /
71
- seguir planificando); una respuesta escrita vuelve como feedback.
72
- - Límite de uso de Claude → error claro, no reintentable ("cambia de modelo").
73
- - Replay acotado (~400K caracteres) y etiquetado; petición actual aparte.
74
- - Catálogo inicial de **Code Mode** de V2 reenviado como contexto.
75
- - Log a fichero `~/.acp-model-provider/logs/`, grabador `ACP_RECORD`,
76
- `scripts/sanitize-recording.mjs`, suite `npm test`, `scripts/verify-smart-revert.mjs`.
77
- - Opciones: `historyMode`, `catchupResultChars`, `parallelTools`, `toolBatchMs`,
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
- - El `Read` nativo sale del perfil por defecto (lo que leía no quedaba en el historial de
84
- OpenCode); el `read` de V2 cubre imágenes/PDF.
85
- - `allowedTools` vale `["mcp__opencode"]` por defecto para cualquier agente.
86
- - Los agentes `claude-code*` deniegan `compress` (opencode-dcp).
87
- - Registro de sesiones con caché en memoria y poda (30 días / 500 entradas).
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 — OpenCode V2 (2026-10-01)
152
+ ## [0.9.0] — 2026-10-01 — OpenCode V2
90
153
 
91
- > ⚠️ **0.9.0+ solo funciona con OpenCode V2; para OpenCode V1 conserva 0.8.x.**
154
+ > ⚠️ **0.9.0+ works only with OpenCode V2; for OpenCode V1 stay on 0.8.x.**
92
155
  >
93
- > El port es un **breaking change total de runtime**: el plugin V1
94
- > (`export default { id, server }`, hooks `config`/`chat.params`) no se carga en
95
- > OpenCode V2, y el plugin V2 (`Plugin.define`) no se carga en OpenCode V1.
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 del plugin y del provider al runtime de plugins **V2** de OpenCode.
160
+ Port of the plugin and the provider to OpenCode's **V2** plugin runtime.
98
161
 
99
162
  ### Breaking changes
100
163
 
101
- | Área | V1 (0.8.x) | V2 (0.9.0) |
164
+ | Area | V1 (0.8.x) | V2 (0.9.0) |
102
165
  | :--- | :--- | :--- |
103
- | **Runtime de plugins** | `export default { id, server }`, hooks `config`/`chat.params` | `Plugin.define({ id, setup })` con API de promesas (`setup` retorna cleanup) |
104
- | **Config del plugin** | `"plugin": [[pkg, {opts}]]` | `"plugins": [{ "package", "options" }]` |
105
- | **Auto-registro del provider** | el hook `config` mutaba `cfg.provider.acp` | `provider.transform` lo registra como `aisdk:<spec>` (con `options.command`); si declaras `provider.<id>` a mano, no lo sobreescribe |
106
- | **Inyección por llamada** | hook `chat.params` → `providerOptions.acp.{ocSession, resumeId, resumeLen}` | `session.hook("context")` → `ocSession`, `ocAgent`, `resumeId`, `resumeLen`, `resumeLastUsage`, `resumeConvKey` + options del agente por llamada |
107
- | **Agentes (config)** | sección `agent:` con `permission` (mapa `{tool: "allow"\|"deny"\|"ask"\|glob}`) y `disable` | sección `agents:` con `permissions` (ruleset array `[{action, resource, effect}]`), `disabled` y `mode: "subagent"\|"primary"\|"all"` |
108
- | **Options por agente** | `agent.<n>.options` (mode/effort/native*) | `plugins[0].options.agents.<n>.options` (misma options, otra ruta) |
109
- | **Puente de permisos** | meta-tool `claude_permission` (prompt `ask` con `ctx.ask`) | emite un **tool-call de la tool nativa `question`** de OpenCode (diálogo `Allow once` / `Always allow` / `Deny`); reglas desde `agents.<n>.permissions` evaluadas en `src/plugin/bridge-rules.ts`, **fail-closed** (ignora `action:"*"` a propósito); `Always allow` persiste en `~/.acp-model-provider/always.json` |
110
- | **Variantes de esfuerzo** | `acp/opus:low` | `acp/opus#low` (`provider/model#variant`) |
111
- | **Revert / compactación** | fingerprint por `chat.params` | eventos `session.revert.committed\|cleared` → `clearLink` |
112
- | **Desarrollo local** | destino = fichero (`…/dist/index.js`) | destino = **ruta de directorio** con `index.js` raíz (V2 `Host.resolve` busca `<dir>/index.*`); los ficheros se rechazan |
113
- | **CLI** | `opencode run` aplicaba `agent.model` | `opencode run` **sin `-m` ignora `agent.model`** (usa el model global); usa `-m acp/…` |
114
- | **Requisitos** | OpenCode V1 | OpenCode **V2 (`>= 2.0.14`)** y agente `@agentclientprotocol/claude-agent-acp` (antes `@zed-industries/claude-agent-acp`) |
115
-
116
- Guía práctica de migración: ver [README § De 0.8.x (V1) a 0.9.x (V2)](README.md#de-08x-v1-a-09x-v2)
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
- - **Auto-registro del provider como `aisdk:<spec>`** (con `options.command`); si declaras
122
- `provider.<id>` a mano en config, el plugin ya no lo sobreescribe (guard nuevo).
123
- - **Revert/compactación**: el plugin escucha `session.revert.*` y limpia el enlace de
124
- sesión → replay completo cuando la historia diverge.
125
- - **Entrypoint de directorio local**: `index.js` en la raíz re-exporta `dist/`
126
- (`Host.resolve` de V2 busca `<dir>/index.*`); en dev, `package` = ruta de directorio.
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
- Versión centrada en el **coste de tokens** y en la **continuidad de sesión**. La causa
131
- común de casi todos los problemas era la misma: el provider recreaba la sesión ACP con
132
- demasiada facilidad, y cada recreación implica replay del historial completo y cache de
133
- prompt frío. Ahora una conversación sobrevive a cambios de agente, de tools y de system
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` pasa a heredar `~/.claude` por defecto** (antes `"isolated"`).
139
- Las sesiones iniciadas desde OpenCode se guardan ahora en `~/.claude/projects/…`, así
140
- que **se pueden retomar nativamente con `claude --resume <id>`** (el provider imprime el
141
- id al crear cada sesión). Esto **no** reintroduce el ecosistema del usuario: `settingSources`,
142
- `tools` y `strictMcpConfig` siguen gobernando qué carga el agente; `configDir` solo decide
143
- dónde vive su estado. Para volver al comportamiento anterior: `"configDir": "isolated"`.
144
- Efecto colateral positivo: desaparece el symlink de credenciales y con él la clase de
145
- bugs de desincronización 401.
146
- - **El límite de contexto publicado deja de inflarse a 1M** para el modelo `default`; solo
147
- las variantes `[1m]` reales lo declaran. Anunciar 1M impedía que la auto-compactación de
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
- - **Gasto de tokens desproporcionado (causa principal).** `sentLen` se fijaba al inicio del
153
- turno y no se actualizaba en la rama de continuación, así que en cada turno se reenviaban
154
- como texto plano **todos los `tool-call`/`tool-result` del turno anterior** — volcados
155
- íntegros de ficheros, salidas de shell, greps — que el agente **ya tenía** en su sesión.
156
- Además invalidaba el prompt cache en cada turno. Ahora el estado registra la huella del
157
- historial ya enviado y las llamadas propias (identificadas por el prefijo nonce del host)
158
- se omiten del catch-up; los resultados ajenos se truncan a 2000 caracteres.
159
- - **Cambiar de agente destruía la sesión y replayaba todo.** `systemKey` hasheaba el system
160
- prompt de OpenCode incluso con `systemPromptMode: "preset"`, modo en el que ese system
161
- **nunca se envía al agente**. Cualquier cambio de agente — o el vaivén de los bloques
162
- dinámicos de OpenCode (fecha, `AGENTS.md`, skills) — recreaba la sesión por un texto que
163
- el agente jamás vio. Ahora el system solo cuenta como identidad cuando de verdad viaja,
164
- y el flujo `claude-code-plan` → build → `claude-code` mantiene la misma sesión ACP.
165
- - **Un cambio en el set de tools ya no recrea la sesión.** Se aplica en caliente a la sesión
166
- viva mediante `notifications/tools/list_changed` por el canal MCP.
167
- - **La llamada del modelo de títulos/resúmenes ya no destruía la conversación.** Llega con
168
- `tools=0` sobre el mismo modelo y sesión; ahora se atiende en una sesión efímera aparte.
169
- - **Texto truncado y razonamiento invisible (misma causa).** Texto y thinking llegan por
170
- stdio ACP mientras las tool-calls llegan por el socket TCP del `McpHost`, sin orden
171
- garantizado. Al cerrar el stream por una tool-call, todo lo que seguía llegando se
172
- **descartaba en silencio** — y el thinking se emite justo antes de cada tool-call, por eso
173
- desaparecía casi entero aun con `effort: max`. Ahora esos chunks se **bufferizan** y se
174
- vuelcan en orden en el stream de continuación.
175
- - **Revertir mensajes dejaba las dos partes desincronizadas.** El provider solo guardaba un
176
- contador, así que un historial truncado caía en un fallback silencioso que reenviaba
177
- **todo** el historial encima de una sesión que ya lo tenía. Ahora se compara la huella del
178
- historial y se distingue *append* (envía solo lo nuevo) de *revert* / *divergencia por
179
- compactación* (sesión nueva desde el historial truncado). El plugin además escucha
180
- `session.updated` y descarta el enlace registrado en cuanto se mueve el punto de revert.
181
- - **Dos conversaciones simultáneas se destruían la sesión mutuamente.** Había un único
182
- `TurnState` por instancia de modelo, compartido por todos los chats y subagentes: cada
183
- turno alternaba de conversación y forzaba replay completo. Ahora hay **una sesión por
184
- conversación** (con cota LRU) y los callbacks del agente se enrutan por `sessionId`.
185
- - **`claude-code-plan` no tenía forma de salir de modo plan.** `ExitPlanMode` no estaba
186
- expuesta al agente, no veía el `plan_exit` de OpenCode, y el bridge le re-forzaba `plan`
187
- en cada turno: un ciclo cerrado que dejaba muerto todo el manejo de `switch_mode` ya
188
- escrito. Ahora se expone `ExitPlanMode`, y **volver a elegir el agente de plan a mano
189
- vuelve a aplicar `mode: "plan"`** (antes `modeChangedByAgent` no se reseteaba nunca).
190
- - **Aprobar un plan concedía `bypassPermissions`.** Se elegía la primera opción `allow_*`
191
- ofrecida por el agente, que es la más amplia. Ahora se prefiere `default` (aprobación
192
- manual de ediciones) para `switch_mode`.
193
- - **El agente no usaba la tool `question` de OpenCode.** Su instrucción vive en el system
194
- prompt de OpenCode, que con `preset` no se reenvía, y su `AskUserQuestion` nativa está
195
- deshabilitada por el propio agente ACP. Ahora la **descripción** de `question` lo indica
196
- explícitamente (una descripción de tool no es system prompt: no afecta a la facturación).
197
- - **El agente se quedaba sin búsqueda web.** OpenCode solo registra su `websearch` para
198
- `providerID: "opencode"` (o con exa/parallel), y `WebSearch` nativa estaba en
199
- `disallowedTools`. Ahora `WebSearch` nativa forma parte del perfil.
200
- - **Los resultados de tools llegaban aplanados a texto**, perdiendo imágenes y adjuntos.
201
- Ahora el contenido estructurado se mapea a bloques MCP.
202
- - **Un `effort` rechazado se tragaba en silencio**; ahora se avisa por stderr.
203
- - **Cancelar un turno ya no tira la sesión**: se cancela el turno y se conserva la sesión
204
- (y su cache) para el siguiente mensaje.
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` y `claude-code-plan` comparten exactamente el mismo perfil de tools y
209
- permisos**, y difieren **solo** en el modo inicial. Antes diferían también en
210
- `nativeTools`, lo que dejaba un estado a medias: el agente salía de plan por su cuenta
211
- (OpenCode no cambia de agente por ello) y creía poder editar mientras OpenCode seguía
212
- dándole el perfil restringido.
213
- - **Nueva opción `claudeCode.forwardEnvContext`** (default `true`): reenvía la parte
214
- **factual** del system prompt de OpenCode (`<env>` — directorio de trabajo, raíz del
215
- workspace, git, plataforma, fecha — y `<available_references>`) como contexto de usuario.
216
- Con `preset` el system nunca llega al agente y trabajaba sin saber dónde estaba. Solo
217
- viajan bloques factuales, nunca las instrucciones de comportamiento de OpenCode, así que
218
- la sesión sigue en suscripción (verificado con `scripts/verify-billing.mjs`). Se envía
219
- completo una vez por sesión y después solo el delta de lo que cambió.
220
- - El id de sesión de Claude Code se registra por stderr al crearla, sin necesidad de
221
- `ACP_DEBUG`, junto al comando para retomarla.
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
- - El desglose de `usage` por turno lo reporta el agente ACP de forma acumulativa y algún
226
- turno puede aparecer con delta 0; el total de la sesión sí es correcto.
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
- ## [Unreleased]
290
+ These entries were listed as "Unreleased" after 0.7.0 and shipped with 0.8.0.
229
291
 
230
292
  ### Added
231
- - **Manejo correcto de `ExitPlanMode`.** Cuando el agente sale de modo plan (llega como
232
- `requestPermission` con `toolCall.kind === "switch_mode"`):
233
- - el **plan** (markdown en `rawInput.plan`) ahora se **renderiza como texto** del
234
- asistente antes del prompt de aprobación, en vez de quedar enterrado en la metadata;
235
- - el permiso se etiqueta de forma estable como **`ExitPlanMode`** (regla
236
- `permission: { ExitPlanMode: "allow" }` posible; por defecto pregunta);
237
- - se escucha `current_mode_update` y, tras aprobar (plan → default/acceptEdits), el
238
- bridge **deja de re-forzar** el modo del agente, de modo que la implementación continúa
239
- en la misma sesión en lugar de volver a plan en el siguiente turno.
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
- - **Cambiar de agente normal a `claude-code` (ACP) a mitad de sesión ignoraba todo
243
- el progreso previo.** Tanto la reutilización en caliente de una sesión ACP viva
244
- (`this.current`, que sobrevive intacta a un cambio de agente) como el `resume`
245
- tras un reinicio de proceso asumían que lo único nuevo desde el último turno ACP
246
- era el último mensaje de usuario (`lastUserBlocks`). Si entre medias otro agente
247
- (p. ej. un modelo distinto) corrió turnos sobre la misma conversación de
248
- OpenCode, esos turnos nunca llegaban a Claude Code: se resumía/reutilizaba con
249
- su historial antiguo y solo el mensaje más reciente, dando la impresión de una
250
- sesión nueva. Ahora `TurnState` guarda `sentLen` (hasta dónde llega el
251
- conocimiento del agente) y cada envío usa `catchUpBlocks`, que reconstruye como
252
- transcripción (con prefijo de rol) **todo** lo ocurrido desde `sentLen` en
253
- adelante — 1 mensaje en el caso normal, el tramo completo si hubo un agente
254
- intercalado.
255
- - **Corrupción de resultados de tools (resultados rancios/misruteados).** El `toolCallId`
256
- se acuñaba como `acp_${counter}` con un contador **por `McpHost`** que se **reinicia a 0**
257
- en cada reset de sesión ACP (cambio de tools/system prompt, nueva conversación, resume).
258
- Dentro de una misma conversación, OpenCode reenvía todo el historial; tras un reset una
259
- llamada nueva volvía a recibir `acp_1` y `detectContinuation` la casaba con un tool-result
260
- **viejo** del historial → glob devolvía un README, bash devolvía "background agent task
261
- launched", etc. Ahora cada host usa un **prefijo nonce aleatorio** (`acp_<hex>_${counter}`),
262
- así que los IDs nunca colisionan entre sesiones, reinicios de proceso ni resume.
263
- - **`claude-code-plan`: los subagentes (`Task`) fallaban.** El agente de plan no tenía
264
- `nativeSubagents`, así que su `Task` no era el nativo de Claude Code sino el `task`
265
- reenviado de OpenCode → OpenCode creaba subagentes (`explore`, …) enrutados a **otros
266
- providers** (`opencode-go`/`opencode`), que caían con *Bad Gateway* / *Insufficient
267
- Balance* / *ProviderModelNotFound*. Ahora `claude-code-plan` comparte la misma base de
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
- Capacidades nativas de Claude Code dentro de OpenCode, con un **puente de permisos**
275
- que mantiene a OpenCode al mando de cada acción ("potencia nativa sin estropear nada").
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
- - **Puente de permisos**: cuando el agente usa una tool **nativa** de Claude (Skill, Read,
279
- NotebookEdit, Task, búsqueda de recursos MCP), su `requestPermission` (ACP) se enruta al
280
- **prompt `ask` de OpenCode** vía la meta-tool `claude_permission`. El prompt muestra la
281
- **tool nativa** y la acción; soporta **"Allow always"** y **reglas glob por tool**
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
- - **Toggles de features nativos** en `claudeCode` (componen las options del SDK; con todos
284
- off = cerebro limpio): `nativeTools`, `resourceSearch`, `nativeSubagents` (subagente que
285
- delega a OpenCode), `nativeSkills`, `projectMemory`, `skillShell`, `allowedTools`.
286
- Verificado: **todos mantienen la suscripción** (0 extra usage).
287
- - **Modelo híbrido**: las tools comunes (bash/read/write/edit/grep/…) las orquesta OpenCode
288
- sin doble permiso (`allowedTools: ["mcp__opencode"]`); las nativas superiores van por el puente.
289
- - Tool nativa **`Read`** habilitada en el agente `claude-code` (lectura multimodal: imágenes/PDF/notebooks).
290
- - Scripts de verificación (`scripts/`): `verify-billing.mjs`, `spike-permission-bridge.mjs`.
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
- - El agente `claude-code` pasa de `mode: "bypassPermissions"` a **`mode: "default"`** (para que el
294
- puente actúe). El "cerebro limpio" clásico sigue disponible (`mode: "bypassPermissions"` + sin toggles).
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
- - **`host closed`**: `onCancel` ya no derriba la sesión mientras hay un tool-call/permiso diferido en
298
- vuelo (OpenCode cancela el stream al pausar para el `ask`); un **watchdog** libera si la continuación
299
- no llega.
300
- - **Desincronización de auth (401)**: el symlink de credenciales del config dir aislado se **re-enlaza en
301
- cada arranque** (el agente podía reemplazarlo con un archivo obsoleto al refrescar el token).
302
- - El puente **falla cerrado** (deniega ante un veredicto ambiguo); `endTurn`/reuse **drenan** los permisos
303
- pendientes para que el agente nunca quede colgado.
304
- - `claude_permission` se **filtra del host** (el agente ya no la ve como `mcp__opencode__claude_permission`).
305
- - El agente ya no intenta tools nativas comunes que no puede ejecutar (`disallowedTools` Bash/Write/Edit/…).
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
- - **Renombrado**: `acp-model-provider` → **`opencode-claude-code-acpbridge`** (plugin exclusivo para usar
311
- Claude Code en OpenCode).
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
- - `strictMcpConfig` (default `true`): ignora los connectors de la cuenta claude.ai (Gmail/Drive/Supabase/…).
315
- - `thinking` por defecto `{type:"enabled", display:"summarized"}`: el **bloque de razonamiento** se ve en OpenCode.
316
- - **Reanudación de sesión entre procesos** (registro `sessions.json` + `unstable_resumeSession`).
317
- - **Reporte de consumo de tokens** (mapeo de `PromptResponse.usage` del ACP).
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
- - **Auto-registro** del provider (config mínima): descubre los modelos del agente e inyecta `provider.acp`
323
- con metadata de models.dev.
324
- - **Agentes inyectados** `claude-code` / `claude-code-plan`, con modo/esfuerzo por agente en caliente; la
325
- config del usuario en `opencode.json` tiene precedencia (merge).
326
- - **Facturación por suscripción** (`systemPromptMode: "preset"`): 0 extra usage.
327
- - Documentación completa (README + `docs/DEVELOPMENT.md` + `examples/`).
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/`).