opencode-claude-max-proxy 1.0.0 → 1.0.2
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 +3 -1
- package/bin/claude-proxy.ts +0 -0
- package/package.json +1 -1
- package/src/proxy/server.ts +21 -9
package/README.md
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
[](https://github.com/rynfar/opencode-claude-max-proxy/stargazers)
|
|
6
6
|
|
|
7
|
-
Use your **Claude Max subscription** with OpenCode.
|
|
7
|
+
Use your **Claude Max subscription** with [OpenCode](https://github.com/opencode-ai/opencode). Built to work with [Oh-My-OpenCode](https://github.com/code-yeongyu/oh-my-opencode) and its full agent orchestration system.
|
|
8
|
+
|
|
9
|
+

|
|
8
10
|
|
|
9
11
|
## The Problem
|
|
10
12
|
|
package/bin/claude-proxy.ts
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/src/proxy/server.ts
CHANGED
|
@@ -110,18 +110,30 @@ export function createProxyServer(config: Partial<ProxyConfig> = {}) {
|
|
|
110
110
|
options: { maxTurns: 1, model }
|
|
111
111
|
})
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
113
|
+
const heartbeat = setInterval(() => {
|
|
114
|
+
try {
|
|
115
|
+
controller.enqueue(encoder.encode(`: ping\n\n`))
|
|
116
|
+
} catch {
|
|
117
|
+
clearInterval(heartbeat)
|
|
118
|
+
}
|
|
119
|
+
}, 15_000)
|
|
120
|
+
|
|
121
|
+
try {
|
|
122
|
+
for await (const message of response) {
|
|
123
|
+
if (message.type === "assistant") {
|
|
124
|
+
for (const block of message.message.content) {
|
|
125
|
+
if (block.type === "text") {
|
|
126
|
+
controller.enqueue(encoder.encode(`event: content_block_delta\ndata: ${JSON.stringify({
|
|
127
|
+
type: "content_block_delta",
|
|
128
|
+
index: 0,
|
|
129
|
+
delta: { type: "text_delta", text: block.text }
|
|
130
|
+
})}\n\n`))
|
|
131
|
+
}
|
|
122
132
|
}
|
|
123
133
|
}
|
|
124
134
|
}
|
|
135
|
+
} finally {
|
|
136
|
+
clearInterval(heartbeat)
|
|
125
137
|
}
|
|
126
138
|
|
|
127
139
|
controller.enqueue(encoder.encode(`event: content_block_stop\ndata: ${JSON.stringify({
|