opencode-claude-code-acpbridge 0.10.0 → 0.10.1
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 +301 -261
- package/LICENSE +21 -0
- package/README.md +597 -321
- 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.map +1 -1
- package/dist/plugin/index.js +9 -3
- package/dist/plugin/index.js.map +1 -1
- package/dist/provider/model.d.ts +2 -1
- package/dist/provider/model.d.ts.map +1 -1
- package/dist/provider/model.js +20 -9
- package/dist/provider/model.js.map +1 -1
- package/docs/DEVELOPMENT.md +413 -136
- package/examples/01-minimal.jsonc +12 -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 +35 -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
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
2
|
+
// Minimal config (OpenCode V2 only). The plugin asks Claude Code which models it
|
|
3
|
+
// offers, registers the `acp` provider with them, and adds two agents:
|
|
4
|
+
// `claude-code` and `claude-code-plan`. Usage counts against your Claude
|
|
5
|
+
// SUBSCRIPTION (systemPromptMode "preset" is the default).
|
|
5
6
|
"$schema": "https://opencode.ai/config.json",
|
|
6
7
|
"plugins": [
|
|
7
8
|
{ "package": "opencode-claude-code-acpbridge", "options": { "command": "claude-agent-acp" } }
|
|
8
9
|
]
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
10
|
+
// How to use it: in the TUI pick the "claude-code" agent (or the "acp/default"
|
|
11
|
+
// model). From the command line:
|
|
12
|
+
// opencode run --agent claude-code -m acp/default "…"
|
|
13
|
+
// If the `claude` binary is not found automatically, add to "options":
|
|
14
|
+
// "claudeExecutable": "/path/to/claude"
|
|
15
|
+
// Local development: "package" can be the DIRECTORY of your checkout instead of
|
|
16
|
+
// the npm name (build it first with `npm run build`; the root `index.js` is the
|
|
17
|
+
// entry point OpenCode loads from a directory).
|
|
15
18
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Restrict what an agent may do with OpenCode V2 PERMISSION rules, without
|
|
3
|
+
// touching the plugin. Your `agents` section is merged with what the plugin
|
|
4
|
+
// injects: declare only `permissions` and the agent keeps its model and options.
|
|
5
|
+
//
|
|
6
|
+
// A rule is { action, resource, effect }; when several match, the LAST one wins.
|
|
7
|
+
// `action` is the OpenCode tool's permission name. Common ones: read, glob, grep,
|
|
8
|
+
// edit (also covers write and patch), shell, webfetch, websearch, question.
|
|
9
|
+
//
|
|
10
|
+
// The same rules also feed the plugin's PERMISSION BRIDGE: a rule whose `action`
|
|
11
|
+
// is a native Claude Code tool name (Skill, NotebookEdit, WebSearch…) answers
|
|
12
|
+
// that tool's permission request without a dialog. See 08-permission-bridge.jsonc.
|
|
13
|
+
"$schema": "https://opencode.ai/config.json",
|
|
14
|
+
"plugins": [
|
|
15
|
+
{ "package": "opencode-claude-code-acpbridge", "options": { "command": "claude-agent-acp" } }
|
|
16
|
+
],
|
|
17
|
+
"agents": {
|
|
18
|
+
"claude-code": {
|
|
19
|
+
// A strict read-only agent: no edits and no shell; reading, searching and web are fine.
|
|
20
|
+
"permissions": [
|
|
21
|
+
{ "action": "edit", "resource": "*", "effect": "deny" },
|
|
22
|
+
{ "action": "shell", "resource": "*", "effect": "deny" },
|
|
23
|
+
{ "action": "read", "resource": "*", "effect": "allow" },
|
|
24
|
+
{ "action": "grep", "resource": "*", "effect": "allow" },
|
|
25
|
+
{ "action": "glob", "resource": "*", "effect": "allow" },
|
|
26
|
+
{ "action": "webfetch", "resource": "*", "effect": "allow" }
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"claude-code-plan": {
|
|
30
|
+
// The planning agent: never edit, and ask before running any shell command.
|
|
31
|
+
"permissions": [
|
|
32
|
+
{ "action": "edit", "resource": "*", "effect": "deny" },
|
|
33
|
+
{ "action": "shell", "resource": "*", "effect": "ask" }
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Note: Claude proposes tool calls but OpenCode executes them, so these rules
|
|
38
|
+
// are the right place to limit what the agent can do.
|
|
39
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use case: you want Claude to FOLLOW OpenCode's system prompt and agents (for
|
|
3
|
+
// example your "build" agent with your own instructions) instead of behaving
|
|
4
|
+
// like native Claude Code.
|
|
5
|
+
//
|
|
6
|
+
// ⚠️ COST: forwarding OpenCode's system prompt makes Anthropic treat the session
|
|
7
|
+
// as a third-party app, so it is billed as EXTRA USAGE (paid), not against your
|
|
8
|
+
// subscription. Only use this if you accept that.
|
|
9
|
+
"$schema": "https://opencode.ai/config.json",
|
|
10
|
+
"plugins": [
|
|
11
|
+
{ "package": "opencode-claude-code-acpbridge",
|
|
12
|
+
"options": {
|
|
13
|
+
"command": "claude-agent-acp",
|
|
14
|
+
"claudeCode": {
|
|
15
|
+
"systemPromptMode": "append" // "append" (Claude Code preset + OpenCode's) or "replace" (OpenCode's only)
|
|
16
|
+
}
|
|
17
|
+
} }
|
|
18
|
+
]
|
|
19
|
+
// With this, any OpenCode agent that uses an acp/* model follows its own system
|
|
20
|
+
// prompt. To go back to the subscription, remove systemPromptMode (default "preset").
|
|
21
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Choose the model and the reasoning effort (OpenCode V2 only).
|
|
3
|
+
//
|
|
4
|
+
// The effort is a VARIANT of the model: in the TUI you pick e.g. "acp/default#max"
|
|
5
|
+
// or "acp/haiku#low" (V2 syntax `provider/model#variant`). Available efforts:
|
|
6
|
+
// low, medium, high, xhigh, max (only on models that expose effort levels).
|
|
7
|
+
"$schema": "https://opencode.ai/config.json",
|
|
8
|
+
"plugins": [
|
|
9
|
+
{ "package": "opencode-claude-code-acpbridge",
|
|
10
|
+
"options": {
|
|
11
|
+
"command": "claude-agent-acp",
|
|
12
|
+
"claudeCode": {
|
|
13
|
+
// Defaults for every use of the provider, when the agent/variant doesn't set them:
|
|
14
|
+
"effort": "high",
|
|
15
|
+
// Setting `thinking` replaces the default ({type:"enabled", display:"summarized"}).
|
|
16
|
+
// Keep `display: "summarized"`, or the reasoning block stops showing in OpenCode.
|
|
17
|
+
"thinking": { "type": "enabled", "budgetTokens": 16000, "display": "summarized" }
|
|
18
|
+
}
|
|
19
|
+
} }
|
|
20
|
+
],
|
|
21
|
+
"agents": {
|
|
22
|
+
// Maximum quality for the built-in agent: Opus with the maximum effort.
|
|
23
|
+
"claude-code": { "model": "acp/default#max" },
|
|
24
|
+
// A fast extra agent, declared in OpenCode's own `agents` section: Haiku with low
|
|
25
|
+
// effort. It runs on the acp provider with the plain profile (OpenCode's tools, no
|
|
26
|
+
// native Claude Code extras such as skills or native subagents).
|
|
27
|
+
"claude-code-fast": {
|
|
28
|
+
"description": "Fast Claude Code (Haiku, low effort)",
|
|
29
|
+
"mode": "primary",
|
|
30
|
+
"model": "acp/haiku#low"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Don't add agents through the plugin's `options.agents` just to get an extra one:
|
|
34
|
+
// that list REPLACES the built-in claude-code / claude-code-plan (see 05-custom-agents.jsonc).
|
|
35
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Define YOUR OWN injected agents (per model, per mode) in place of the built-in
|
|
3
|
+
// ones. `options.mode` is the Claude Code session mode; `variant` is the effort.
|
|
4
|
+
"$schema": "https://opencode.ai/config.json",
|
|
5
|
+
"plugins": [
|
|
6
|
+
{ "package": "opencode-claude-code-acpbridge",
|
|
7
|
+
"options": {
|
|
8
|
+
"command": "claude-agent-acp",
|
|
9
|
+
// This list REPLACES the built-in agents (claude-code / claude-code-plan).
|
|
10
|
+
// Your agents get exactly the `options` you write here: they do NOT inherit the
|
|
11
|
+
// built-in native profile (native subagents, skills, project memory…). Add those
|
|
12
|
+
// options yourself if you want them, e.g. "nativeSkills": true.
|
|
13
|
+
// Use "agents": false to inject none and declare every agent yourself in the
|
|
14
|
+
// `agents` section of this file.
|
|
15
|
+
"agents": {
|
|
16
|
+
"cc-opus": { "model": "default", "variant": "high", "options": { "mode": "default" } },
|
|
17
|
+
"cc-sonnet": { "model": "sonnet", "options": { "mode": "default" } },
|
|
18
|
+
"cc-plan": { "model": "default", "variant": "high", "options": { "mode": "plan" } }
|
|
19
|
+
}
|
|
20
|
+
} }
|
|
21
|
+
],
|
|
22
|
+
// `mode: "primary"` (and permissions) go in OpenCode's own `agents` section:
|
|
23
|
+
"agents": {
|
|
24
|
+
"cc-opus": { "mode": "primary" },
|
|
25
|
+
"cc-sonnet": { "mode": "primary" },
|
|
26
|
+
"cc-plan": { "mode": "primary" }
|
|
27
|
+
}
|
|
28
|
+
// What you declare in `agents` wins over the plugin's definitions: the plugin only
|
|
29
|
+
// fills `model` and `description` when they are missing.
|
|
30
|
+
// To make OpenCode the only permission authority (no bridge for native tools), use
|
|
31
|
+
// "options": { "mode": "bypassPermissions" } on an agent.
|
|
32
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Advanced: instead of the "clean brain", let Claude Code load more of YOUR real
|
|
3
|
+
// Claude Code setup — settings, hooks and agents from ~/.claude and the project,
|
|
4
|
+
// plus the MCP servers and claude.ai connectors bound to your account.
|
|
5
|
+
//
|
|
6
|
+
// ⚠️ Implications:
|
|
7
|
+
// - settingSources loads settings (hooks, agents, skills) from user/project/local.
|
|
8
|
+
// - strictMcpConfig:false lets through MCP servers from ~/.claude.json and the
|
|
9
|
+
// claude.ai connectors (Gmail, Drive, Notion…) as extra native tools.
|
|
10
|
+
// - If those hooks/agents add an aggressive system prompt of their own, the session
|
|
11
|
+
// may be billed as EXTRA USAGE (like append/replace). Check with ACP_DEBUG=1.
|
|
12
|
+
"$schema": "https://opencode.ai/config.json",
|
|
13
|
+
"plugins": [
|
|
14
|
+
{ "package": "opencode-claude-code-acpbridge",
|
|
15
|
+
"options": {
|
|
16
|
+
"command": "claude-agent-acp",
|
|
17
|
+
"claudeCode": {
|
|
18
|
+
// Already the default: Claude Code keeps its state in your ~/.claude, so sessions
|
|
19
|
+
// can be resumed with `claude --resume <id>`. "isolated" would use a clean dir instead.
|
|
20
|
+
"configDir": false,
|
|
21
|
+
"settingSources": ["user", "project"], // load settings (hooks/agents/skills)
|
|
22
|
+
"strictMcpConfig": false // let ~/.claude.json MCP servers and claude.ai connectors in
|
|
23
|
+
// Native file/shell tools (Bash, Read, Write, Edit…) stay disabled on the built-in
|
|
24
|
+
// agents on purpose: OpenCode runs those, so everything stays in its history.
|
|
25
|
+
}
|
|
26
|
+
} }
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Full control: declare the `acp` provider yourself in OpenCode's config.
|
|
3
|
+
// Normally you DON'T need this: with `options.command` the plugin registers the
|
|
4
|
+
// provider on its own (with the models Claude Code reports and their metadata).
|
|
5
|
+
// Declaring it by hand is for pinning the settings, names, costs and limits of the
|
|
6
|
+
// models you list, or for setups where discovery can't run. When `acp` is already
|
|
7
|
+
// declared, the plugin doesn't register its own definition. In OpenCode 2.1.1 the
|
|
8
|
+
// values you set here win, and models or variants you don't list still show up
|
|
9
|
+
// from discovery: this pins values, it doesn't hide models.
|
|
10
|
+
//
|
|
11
|
+
// This uses the native OpenCode V2 `providers` format. (V2 still accepts the old V1
|
|
12
|
+
// `provider` block with `npm`/`options`, but migrates it and drops unknown fields.)
|
|
13
|
+
"$schema": "https://opencode.ai/config.json",
|
|
14
|
+
"providers": {
|
|
15
|
+
"acp": {
|
|
16
|
+
"name": "Claude Code (ACP)",
|
|
17
|
+
// `aisdk:` + the npm package. For local development use the built entry point:
|
|
18
|
+
// "aisdk:file:///path/to/opencode-claude-code-acpbridge/dist/index.js"
|
|
19
|
+
"package": "aisdk:opencode-claude-code-acpbridge",
|
|
20
|
+
// Passed to the provider factory (same keys as the plugin options below).
|
|
21
|
+
"settings": {
|
|
22
|
+
"command": "claude-agent-acp",
|
|
23
|
+
"claudeExecutable": "/home/you/.local/bin/claude",
|
|
24
|
+
"claudeCode": { "systemPromptMode": "preset" }
|
|
25
|
+
},
|
|
26
|
+
"models": {
|
|
27
|
+
"default": {
|
|
28
|
+
"name": "Opus (recommended)",
|
|
29
|
+
"capabilities": { "tools": true },
|
|
30
|
+
"limit": { "context": 1000000, "output": 64000 },
|
|
31
|
+
"cost": { "input": 5, "output": 25, "cache": { "read": 0.5, "write": 6.25 } },
|
|
32
|
+
// Effort levels as variants: picking "acp/default#high" sends { effort: "high" }.
|
|
33
|
+
"variants": [
|
|
34
|
+
{ "id": "low", "settings": { "effort": "low" } },
|
|
35
|
+
{ "id": "high", "settings": { "effort": "high" } },
|
|
36
|
+
{ "id": "max", "settings": { "effort": "max" } }
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"sonnet": {
|
|
40
|
+
"name": "Sonnet",
|
|
41
|
+
"capabilities": { "tools": true },
|
|
42
|
+
"limit": { "context": 200000, "output": 64000 },
|
|
43
|
+
"cost": { "input": 3, "output": 15, "cache": { "read": 0.3, "write": 3.75 } }
|
|
44
|
+
},
|
|
45
|
+
"haiku": { "name": "Haiku", "capabilities": { "tools": true } }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
// Keep loading the plugin: it injects the agents and passes the per-call context
|
|
50
|
+
// (session link, resume data, per-agent options). Since `acp` already exists, it
|
|
51
|
+
// doesn't overwrite it.
|
|
52
|
+
"plugins": [
|
|
53
|
+
{ "package": "opencode-claude-code-acpbridge", "options": { "command": "claude-agent-acp" } }
|
|
54
|
+
]
|
|
55
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Permission bridge (OpenCode V2 only).
|
|
3
|
+
//
|
|
4
|
+
// The built-in `claude-code` agents keep a few NATIVE Claude Code tools that
|
|
5
|
+
// OpenCode has no equivalent for: Skill, NotebookEdit, WebSearch, native subagents
|
|
6
|
+
// (Task), MCP resource search, and ExitPlanMode. When Claude wants to use one of
|
|
7
|
+
// them, Claude Code asks for permission, and the plugin answers like this:
|
|
8
|
+
//
|
|
9
|
+
// 1. Your rules first. A rule in `agents.<agent>.permissions` whose `action` is the
|
|
10
|
+
// native tool name decides with no dialog: `allow` runs it, `deny` blocks it.
|
|
11
|
+
// `resource` is matched against the tool's target (the skill name, the
|
|
12
|
+
// notebook path, the command…) and accepts globs.
|
|
13
|
+
// 2. No matching rule → OpenCode shows a "Permission" dialog with
|
|
14
|
+
// `Allow once` / `Always allow` / `Deny`. "Always allow" is saved in
|
|
15
|
+
// `~/.acp-model-provider/always.json` and applies from then on.
|
|
16
|
+
// Anything unclear is treated as Deny (fail-closed).
|
|
17
|
+
//
|
|
18
|
+
// ExitPlanMode is special: leaving plan mode shows the plan with the choices Claude
|
|
19
|
+
// Code itself offers (each one approves and sets the next session mode, or rejects
|
|
20
|
+
// and keeps planning; typing your own answer sends it back as feedback).
|
|
21
|
+
"$schema": "https://opencode.ai/config.json",
|
|
22
|
+
"plugins": [
|
|
23
|
+
{ "package": "opencode-claude-code-acpbridge", "options": { "command": "claude-agent-acp" } }
|
|
24
|
+
],
|
|
25
|
+
"agents": {
|
|
26
|
+
"claude-code": {
|
|
27
|
+
"permissions": [
|
|
28
|
+
{ "action": "Skill", "resource": "*", "effect": "allow" }, // any skill: allow
|
|
29
|
+
{ "action": "WebSearch", "resource": "*", "effect": "allow" }, // native web search: allow
|
|
30
|
+
{ "action": "NotebookEdit", "resource": "*", "effect": "ask" } // editing Jupyter notebooks: ask
|
|
31
|
+
// A catch-all `"action": "*"` rule is IGNORED by the bridge on purpose: OpenCode's
|
|
32
|
+
// defaults contain `*: allow`, which would approve every native tool silently.
|
|
33
|
+
// The bridge's default is already "ask" for any native tool without a rule.
|
|
34
|
+
// The plugin adds `{ action: "question", resource: "*", effect: "allow" }` by
|
|
35
|
+
// itself (the dialog runs through OpenCode's `question` tool): don't declare it.
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// To change WHICH native features an agent has (skills, native subagents, extra
|
|
40
|
+
// native tools), you must define the agent yourself in the plugin's
|
|
41
|
+
// `options.agents`. That list replaces the built-in agents: see 05-custom-agents.jsonc.
|
|
42
|
+
}
|
package/examples/README.md
CHANGED
|
@@ -1,22 +1,40 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Configuration examples
|
|
2
2
|
|
|
3
|
-
`opencode.json`
|
|
3
|
+
Ready-made `opencode.json` files for common use cases. **OpenCode V2 only**: these use the V2
|
|
4
|
+
config format (`"plugins": [{ "package", "options" }]`, `"agents"`, `"providers"`) and don't work
|
|
5
|
+
with OpenCode V1.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
Copy the one that fits into `~/.config/opencode/opencode.json` (applies to every project) or
|
|
8
|
+
into `opencode.json` at the root of a project. Merge it with what you already have.
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
> **Local development** (without the npm package): replace
|
|
11
|
+
> `"package": "opencode-claude-code-acpbridge"` with the **directory** of your checkout, e.g.
|
|
12
|
+
> `"package": "/path/to/opencode-claude-code-acpbridge"`. OpenCode V2 rejects a file as a plugin
|
|
13
|
+
> target. The directory needs the root `index.js`, which re-exports `dist/`, so build it first
|
|
14
|
+
> with `npm run build`. Everything else stays the same.
|
|
15
|
+
|
|
16
|
+
| File | Use case | Key settings |
|
|
8
17
|
|---|---|---|
|
|
9
|
-
| [`01-minimal.jsonc`](01-minimal.jsonc) | **
|
|
10
|
-
| [`02-
|
|
11
|
-
| [`03-
|
|
12
|
-
| [`04-
|
|
13
|
-
| [`05-
|
|
14
|
-
| [`06-
|
|
15
|
-
| [`07-provider
|
|
16
|
-
| [`08-
|
|
18
|
+
| [`01-minimal.jsonc`](01-minimal.jsonc) | **Get started**: the plugin registers everything; usage goes against your subscription. | `plugins[]` with `{package, options:{command}}` |
|
|
19
|
+
| [`02-per-agent-permissions.jsonc`](02-per-agent-permissions.jsonc) | **Limit what an agent can do** without touching the plugin. | `agents.*.permissions` (rules) |
|
|
20
|
+
| [`03-opencode-fidelity.jsonc`](03-opencode-fidelity.jsonc) | Claude **follows OpenCode's system prompt and agents** (billed as *extra usage*). | `claudeCode.systemPromptMode: "append"` |
|
|
21
|
+
| [`04-model-and-effort.jsonc`](04-model-and-effort.jsonc) | **Choose model and effort** (fast and cheap, or maximum quality), plus an extra agent. | `agents.*.model` with `#variant` (`acp/default#max`) |
|
|
22
|
+
| [`05-custom-agents.jsonc`](05-custom-agents.jsonc) | **Your own agents** (per model, per mode) instead of the built-in ones. | `plugins[0].options.agents` (definitions) + `agents` (mode) |
|
|
23
|
+
| [`06-claude-ecosystem.jsonc`](06-claude-ecosystem.jsonc) | **Load your Claude Code setup** (settings/hooks/agents from `~/.claude`, account MCP connectors). | `claudeCode.settingSources`, `strictMcpConfig: false` |
|
|
24
|
+
| [`07-manual-provider.jsonc`](07-manual-provider.jsonc) | **Full control**: you declare the provider yourself; the plugin respects it. | `providers.acp` |
|
|
25
|
+
| [`08-permission-bridge.jsonc`](08-permission-bridge.jsonc) | **Permission bridge**: rules per native Claude Code tool. | `agents.*.permissions` with native tool names |
|
|
17
26
|
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
27
|
+
Notes for all of them:
|
|
28
|
+
- **Billing.** The default `systemPromptMode: "preset"` keeps usage on your Claude
|
|
29
|
+
**subscription** (no extra usage). Change it only if you accept *extra usage*.
|
|
30
|
+
- **Logs and caches.**
|
|
31
|
+
- Debug logs: `ACP_DEBUG=1 opencode run …`. A daily log is written by default (`ACP_LOG=0` turns it off) to
|
|
32
|
+
`~/.acp-model-provider/logs/`.
|
|
33
|
+
- Refresh the model list: `npx opencode-claude-code-acpbridge sync claude-agent-acp`.
|
|
34
|
+
- **Requirement.** The ACP agent is `@agentclientprotocol/claude-agent-acp` (binary
|
|
35
|
+
`claude-agent-acp`); install it with `npm i -g @agentclientprotocol/claude-agent-acp`.
|
|
36
|
+
- **CLI.** `opencode run --agent claude-code -m acp/default "…"`. Without `-m`, `run` ignores
|
|
37
|
+
the agent's `model` and uses the global model from your config: that's how the V2 CLI works.
|
|
38
|
+
- **Agent definitions.** The plugin's `options.agents` **replaces** the built-in `claude-code` /
|
|
39
|
+
`claude-code-plan`. To add an extra agent and keep the built-in ones, declare it in OpenCode's
|
|
40
|
+
own `agents` section with an `acp/…` model (example 04).
|
package/package.json
CHANGED
|
@@ -1,7 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-claude-code-acpbridge",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Use Claude Code inside OpenCode. An OpenCode plugin + model provider that bridges Claude Code over ACP (Agent Client Protocol): run it on your Claude subscription while OpenCode orchestrates the tools, permissions and TUI.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Antonio Orizondo Leyva",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/aorizondo/opencode-claude-code-acpbridge.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/aorizondo/opencode-claude-code-acpbridge#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/aorizondo/opencode-claude-code-acpbridge/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"opencode",
|
|
17
|
+
"opencode-plugin",
|
|
18
|
+
"claude-code",
|
|
19
|
+
"claude",
|
|
20
|
+
"anthropic",
|
|
21
|
+
"acp",
|
|
22
|
+
"agent-client-protocol",
|
|
23
|
+
"ai-sdk",
|
|
24
|
+
"language-model",
|
|
25
|
+
"provider",
|
|
26
|
+
"opencode-v2",
|
|
27
|
+
"claude-subscription"
|
|
28
|
+
],
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=18",
|
|
31
|
+
"opencode": ">=2.0.14"
|
|
32
|
+
},
|
|
5
33
|
"type": "module",
|
|
6
34
|
"main": "./dist/index.js",
|
|
7
35
|
"types": "./dist/index.d.ts",
|
|
@@ -19,37 +47,14 @@
|
|
|
19
47
|
"dist",
|
|
20
48
|
"docs",
|
|
21
49
|
"examples",
|
|
22
|
-
"CHANGELOG.md"
|
|
50
|
+
"CHANGELOG.md",
|
|
51
|
+
"LICENSE"
|
|
23
52
|
],
|
|
24
53
|
"scripts": {
|
|
25
54
|
"build": "tsc",
|
|
26
|
-
"prepublishOnly": "npm run
|
|
27
|
-
"test": "tsc && node --test --test-timeout=20000 \"test/*.test.mjs\""
|
|
28
|
-
|
|
29
|
-
"keywords": [
|
|
30
|
-
"opencode",
|
|
31
|
-
"opencode-plugin",
|
|
32
|
-
"claude-code",
|
|
33
|
-
"claude",
|
|
34
|
-
"anthropic",
|
|
35
|
-
"acp",
|
|
36
|
-
"agent-client-protocol",
|
|
37
|
-
"ai-sdk",
|
|
38
|
-
"language-model",
|
|
39
|
-
"provider"
|
|
40
|
-
],
|
|
41
|
-
"license": "MIT",
|
|
42
|
-
"author": "Antonio Orizondo",
|
|
43
|
-
"repository": {
|
|
44
|
-
"type": "git",
|
|
45
|
-
"url": "git+https://github.com/aorizondo/opencode-claude-code-acpbridge.git"
|
|
46
|
-
},
|
|
47
|
-
"homepage": "https://github.com/aorizondo/opencode-claude-code-acpbridge#readme",
|
|
48
|
-
"bugs": {
|
|
49
|
-
"url": "https://github.com/aorizondo/opencode-claude-code-acpbridge/issues"
|
|
50
|
-
},
|
|
51
|
-
"engines": {
|
|
52
|
-
"node": ">=18"
|
|
55
|
+
"prepublishOnly": "npm test && npm run check:install",
|
|
56
|
+
"test": "tsc && node --test --test-timeout=20000 \"test/*.test.mjs\"",
|
|
57
|
+
"check:install": "node scripts/check-install.mjs"
|
|
53
58
|
},
|
|
54
59
|
"dependencies": {
|
|
55
60
|
"@agentclientprotocol/sdk": "^0.14.1",
|
|
@@ -62,7 +67,7 @@
|
|
|
62
67
|
},
|
|
63
68
|
"peerDependencies": {
|
|
64
69
|
"@ai-sdk/provider": "^3.0.0",
|
|
65
|
-
"@opencode/plugin": "
|
|
70
|
+
"@opencode/plugin": "^2.0.14",
|
|
66
71
|
"ai": "^6.0.0"
|
|
67
72
|
},
|
|
68
73
|
"peerDependenciesMeta": {
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Filtrar/controlar las herramientas del agente vía PERMISOS de OpenCode V2
|
|
3
|
-
// (ruleset), sin tocar el código del plugin. Tu sección `agents` tiene
|
|
4
|
-
// precedencia: declaras solo `permissions` y heredas model/options del plugin.
|
|
5
|
-
// El ruleset también alimenta el PUENTE de permisos (reglas allow/deny
|
|
6
|
-
// resuelven las tools nativas de Claude sin diálogo).
|
|
7
|
-
"$schema": "https://opencode.ai/config.json",
|
|
8
|
-
"plugins": [
|
|
9
|
-
{ "package": "opencode-claude-code-acpbridge", "options": { "command": "claude-agent-acp" } }
|
|
10
|
-
],
|
|
11
|
-
"agents": {
|
|
12
|
-
"claude-code": {
|
|
13
|
-
// Read-only "duro": deniega escritura y shell, permite lectura/búsqueda/web.
|
|
14
|
-
"permissions": [
|
|
15
|
-
{ "action": "edit", "resource": "*", "effect": "deny" },
|
|
16
|
-
{ "action": "write", "resource": "*", "effect": "deny" },
|
|
17
|
-
{ "action": "bash", "resource": "*", "effect": "deny" },
|
|
18
|
-
{ "action": "read", "resource": "*", "effect": "allow" },
|
|
19
|
-
{ "action": "grep", "resource": "*", "effect": "allow" },
|
|
20
|
-
{ "action": "glob", "resource": "*", "effect": "allow" },
|
|
21
|
-
{ "action": "webfetch", "resource": "*", "effect": "allow" }
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
"claude-code-plan": {
|
|
25
|
-
// El agente de plan: pedir confirmación para todo lo demás.
|
|
26
|
-
"permissions": [
|
|
27
|
-
{ "action": "edit", "resource": "*", "effect": "deny" },
|
|
28
|
-
{ "action": "bash", "resource": "*", "effect": "ask" }
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
// Nota: las tools se ejecutan en OpenCode; este ruleset es la forma
|
|
33
|
-
// recomendada de acotarlas.
|
|
34
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Caso: quieres que el agente SIGA el system prompt y los agentes de OpenCode
|
|
3
|
-
// (p. ej. tu agente "build" con tus instrucciones), no que actúe como Claude
|
|
4
|
-
// Code nativo.
|
|
5
|
-
//
|
|
6
|
-
// ⚠️ COSTE: reenviar el system de OpenCode hace que Anthropic clasifique la
|
|
7
|
-
// sesión como app de terceros → se factura como EXTRA USAGE (de pago), no
|
|
8
|
-
// contra tu suscripción. Úsalo solo si lo aceptas.
|
|
9
|
-
"$schema": "https://opencode.ai/config.json",
|
|
10
|
-
"plugins": [
|
|
11
|
-
{ "package": "opencode-claude-code-acpbridge",
|
|
12
|
-
"options": {
|
|
13
|
-
"command": "claude-agent-acp",
|
|
14
|
-
"claudeCode": {
|
|
15
|
-
"systemPromptMode": "append" // "append" (preset+OpenCode) o "replace" (solo OpenCode)
|
|
16
|
-
}
|
|
17
|
-
} }
|
|
18
|
-
]
|
|
19
|
-
// Con esto, cualquier agente de OpenCode usando un modelo acp/* respeta su
|
|
20
|
-
// propio system. Para volver a la suscripción, quita systemPromptMode (default "preset").
|
|
21
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Fijar modelo y esfuerzo de razonamiento (OpenCode V2).
|
|
3
|
-
//
|
|
4
|
-
// El esfuerzo (effort) es una VARIANTE del modelo: en la TUI eliges
|
|
5
|
-
// p. ej. "acp/opus#max" o "acp/haiku#low" (sintaxis V2 `provider/model#variant`).
|
|
6
|
-
// Aquí mostramos cómo fijarlo por agente (config `agents`) y/o con las
|
|
7
|
-
// options ACP del agente en las options del plugin.
|
|
8
|
-
"$schema": "https://opencode.ai/config.json",
|
|
9
|
-
"plugins": [
|
|
10
|
-
{ "package": "opencode-claude-code-acpbridge",
|
|
11
|
-
"options": {
|
|
12
|
-
"command": "claude-agent-acp",
|
|
13
|
-
"claudeCode": {
|
|
14
|
-
// Por defecto para cualquier uso del provider (si no lo fija el agente):
|
|
15
|
-
"effort": "high",
|
|
16
|
-
"thinking": { "type": "enabled", "budgetTokens": 16000 }
|
|
17
|
-
},
|
|
18
|
-
// Options ACP por agente (mode, effort, …): el context hook las inyecta
|
|
19
|
-
// por llamada y se aplican en caliente (setSessionMode/setSessionConfigOption).
|
|
20
|
-
"agents": {
|
|
21
|
-
"claude-code-fast": {
|
|
22
|
-
"description": "Claude Code rápido (Haiku, esfuerzo bajo)",
|
|
23
|
-
"model": "haiku", "variant": "low",
|
|
24
|
-
"options": { "mode": "default" }
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
} }
|
|
28
|
-
],
|
|
29
|
-
"agents": {
|
|
30
|
-
// Máxima calidad: Opus con esfuerzo máximo (`model#variant`).
|
|
31
|
-
"claude-code": { "model": "acp/default#max" },
|
|
32
|
-
// El agente nuevo (definido arriba en las options del plugin) aparece en el
|
|
33
|
-
// selector como primario:
|
|
34
|
-
"claude-code-fast": { "mode": "primary" }
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Definir TUS propios agentes inyectados (por modelo, por modo), reemplazando
|
|
3
|
-
// los de serie. `options.mode` es el modo ACP; `variant` el esfuerzo.
|
|
4
|
-
"$schema": "https://opencode.ai/config.json",
|
|
5
|
-
"plugins": [
|
|
6
|
-
{ "package": "opencode-claude-code-acpbridge",
|
|
7
|
-
"options": {
|
|
8
|
-
"command": "claude-agent-acp",
|
|
9
|
-
// Esta lista REEMPLAZA los agentes por defecto (claude-code / claude-code-plan).
|
|
10
|
-
// Usa "agents": false para no inyectar ninguno y declararlos todos a mano
|
|
11
|
-
// en la sección `agents` de este mismo fichero.
|
|
12
|
-
"agents": {
|
|
13
|
-
"cc-opus": { "model": "default", "variant": "high", "options": { "mode": "default" } },
|
|
14
|
-
"cc-sonnet": { "model": "sonnet", "options": { "mode": "default" } },
|
|
15
|
-
"cc-plan": { "model": "default", "variant": "high", "options": { "mode": "plan" } }
|
|
16
|
-
}
|
|
17
|
-
} }
|
|
18
|
-
],
|
|
19
|
-
// `mode: "primary"` (y permisos) van en la sección `agents` de config V2:
|
|
20
|
-
"agents": {
|
|
21
|
-
"cc-opus": { "mode": "primary" },
|
|
22
|
-
"cc-sonnet": { "mode": "primary" },
|
|
23
|
-
"cc-plan": { "mode": "primary" }
|
|
24
|
-
}
|
|
25
|
-
// Recuerda: lo que declares en `agents` manda sobre las defs del plugin
|
|
26
|
-
// (model/description solo se rellenan si faltan; options hacen merge profundo).
|
|
27
|
-
// Para "OpenCode es la única autoridad" sin round-trip, usa
|
|
28
|
-
// "options": { "mode": "bypassPermissions" } (sin puente de permisos).
|
|
29
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Caso avanzado: en lugar del "cerebro limpio", quieres que el agente herede
|
|
3
|
-
// TU Claude Code real — skills, subagents, hooks y MCP servers de ~/.claude.
|
|
4
|
-
//
|
|
5
|
-
// ⚠️ Implicaciones:
|
|
6
|
-
// - configDir:false hace que el agente use tu ~/.claude (con su auth y ecosistema).
|
|
7
|
-
// - settingSources carga settings (hooks/agents) de user/project/local.
|
|
8
|
-
// - Si esos hooks/agents añaden un system propio agresivo, puede dispararse
|
|
9
|
-
// EXTRA USAGE (igual que con append/replace). Vigila con ACP_DEBUG.
|
|
10
|
-
"$schema": "https://opencode.ai/config.json",
|
|
11
|
-
"plugins": [
|
|
12
|
-
{ "package": "opencode-claude-code-acpbridge",
|
|
13
|
-
"options": {
|
|
14
|
-
"command": "claude-agent-acp",
|
|
15
|
-
"claudeCode": {
|
|
16
|
-
"configDir": false, // hereda ~/.claude (en vez de "isolated")
|
|
17
|
-
"settingSources": ["user", "project"], // carga settings (hooks/agents/skills)
|
|
18
|
-
"tools": ["read", "grep", "glob"] // habilita algunas tools NATIVAS de Claude
|
|
19
|
-
// OJO: habilitar tools nativas mezcla dos ejecutores (Claude + OpenCode).
|
|
20
|
-
// Para "OpenCode orquesta" puro, deja tools en [] (el default).
|
|
21
|
-
}
|
|
22
|
-
} }
|
|
23
|
-
]
|
|
24
|
-
}
|