opencode-claude-max-proxy 1.12.0 → 1.12.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/README.md +26 -24
- package/dist/{cli-x0mnz7nm.js → cli-s4sk7eks.js} +7 -3
- package/dist/cli.js +1 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,30 +15,22 @@ We avoid that limitation by forwarding tool calls instead of executing them. Whe
|
|
|
15
15
|
From Claude’s perspective, tool usage proceeds normally. From OpenCode’s perspective, it is interacting with the Anthropic API. Execution remains distributed according to the configured agents, allowing different models to handle different roles without being constrained by the SDK.
|
|
16
16
|
|
|
17
17
|
```
|
|
18
|
-
|
|
19
|
-
│
|
|
20
|
-
|
|
21
|
-
│
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
│
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
│
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
│
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
│ │ │ │
|
|
35
|
-
│ │ │ ▼
|
|
36
|
-
│ │ │ ◄────────────
|
|
37
|
-
│ │ │ Resume turn
|
|
38
|
-
│ │ │
|
|
39
|
-
│ │ ◄───────────── │
|
|
40
|
-
│ │ response │
|
|
41
|
-
└──────────┘ └───────────────┘
|
|
18
|
+
OpenCode ──► Proxy (localhost) ──► Claude Max (Agent SDK)
|
|
19
|
+
│
|
|
20
|
+
tool_use response
|
|
21
|
+
│
|
|
22
|
+
Proxy intercepts ◄─────────┘
|
|
23
|
+
(stop turn)
|
|
24
|
+
│
|
|
25
|
+
▼
|
|
26
|
+
OpenCode agent system
|
|
27
|
+
(routes to GPT-5.4, Gemini, etc.)
|
|
28
|
+
│
|
|
29
|
+
▼
|
|
30
|
+
Proxy resumes SDK ──► Claude continues
|
|
31
|
+
│
|
|
32
|
+
▼
|
|
33
|
+
OpenCode ◄── final response
|
|
42
34
|
```
|
|
43
35
|
|
|
44
36
|
## How Passthrough Works
|
|
@@ -54,6 +46,14 @@ The Claude Agent SDK exposes a `PreToolUse` hook that fires before any tool exec
|
|
|
54
46
|
|
|
55
47
|
## Quick Start
|
|
56
48
|
|
|
49
|
+
### One-Liner Install
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
curl -fsSL https://raw.githubusercontent.com/ianjwhite99/opencode-with-claude/main/install.sh | bash
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Installs everything (Claude CLI, OpenCode, proxy) and gives you an `oc` command. See [opencode-with-claude](https://github.com/ianjwhite99/opencode-with-claude) for details.
|
|
56
|
+
|
|
57
57
|
### Prerequisites
|
|
58
58
|
|
|
59
59
|
1. **Claude Max subscription** — [Subscribe here](https://claude.ai/settings/billing)
|
|
@@ -361,3 +361,5 @@ MIT
|
|
|
361
361
|
## Credits
|
|
362
362
|
|
|
363
363
|
Built with the [Claude Agent SDK](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk) by Anthropic.
|
|
364
|
+
|
|
365
|
+
[opencode-with-claude](https://github.com/ianjwhite99/opencode-with-claude) installer by [@ianjwhite99](https://github.com/ianjwhite99). Multimodal support based on work by [@juanferreiramorel](https://github.com/juanferreiramorel). Per-terminal proxy idea by [@calebdw](https://github.com/calebdw). README cleanup by [@skipships](https://github.com/skipships).
|
|
@@ -12799,6 +12799,7 @@ ${conversationParts}` : conversationParts;
|
|
|
12799
12799
|
}
|
|
12800
12800
|
}, 15000);
|
|
12801
12801
|
const skipBlockIndices = new Set;
|
|
12802
|
+
const streamedToolUseIds = new Set;
|
|
12802
12803
|
let messageStartEmitted = false;
|
|
12803
12804
|
try {
|
|
12804
12805
|
for await (const message of response) {
|
|
@@ -12836,6 +12837,8 @@ ${conversationParts}` : conversationParts;
|
|
|
12836
12837
|
if (block?.type === "tool_use" && typeof block.name === "string") {
|
|
12837
12838
|
if (passthrough && block.name.startsWith(PASSTHROUGH_MCP_PREFIX)) {
|
|
12838
12839
|
block.name = stripMcpPrefix(block.name);
|
|
12840
|
+
if (block.id)
|
|
12841
|
+
streamedToolUseIds.add(block.id);
|
|
12839
12842
|
} else if (block.name.startsWith("mcp__")) {
|
|
12840
12843
|
if (eventIndex !== undefined)
|
|
12841
12844
|
skipBlockIndices.add(eventIndex);
|
|
@@ -12883,9 +12886,10 @@ data: ${JSON.stringify(event)}
|
|
|
12883
12886
|
storeSession(opencodeSessionId, body.messages || [], currentSessionId);
|
|
12884
12887
|
}
|
|
12885
12888
|
if (!streamClosed) {
|
|
12886
|
-
|
|
12887
|
-
|
|
12888
|
-
|
|
12889
|
+
const unseenToolUses = capturedToolUses.filter((tu) => !streamedToolUseIds.has(tu.id));
|
|
12890
|
+
if (passthrough && unseenToolUses.length > 0 && messageStartEmitted) {
|
|
12891
|
+
for (let i = 0;i < unseenToolUses.length; i++) {
|
|
12892
|
+
const tu = unseenToolUses[i];
|
|
12889
12893
|
const blockIndex = eventsForwarded + i;
|
|
12890
12894
|
safeEnqueue(encoder.encode(`event: content_block_start
|
|
12891
12895
|
data: ${JSON.stringify({
|
package/dist/cli.js
CHANGED
package/dist/server.js
CHANGED