opencode-with-claude 1.3.1 → 1.3.3
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 +2 -2
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Use [OpenCode](https://opencode.ai) with your [Claude Max](https://claude.ai) su
|
|
|
6
6
|
|
|
7
7
|
## What this is
|
|
8
8
|
|
|
9
|
-
An [OpenCode](https://opencode.ai) plugin that runs [
|
|
9
|
+
An [OpenCode](https://opencode.ai) plugin that runs [Meridian](https://github.com/rynfar/meridian) *(formerly opencode-claude-max-proxy)* for you: **start OpenCode once** and the proxy comes up with it; **quit OpenCode** and the proxy stops. No separate proxy CLI or Docker container to manage.
|
|
10
10
|
|
|
11
11
|
**Compared to running the proxy yourself:**
|
|
12
12
|
|
|
@@ -149,7 +149,7 @@ This project calls publicly available npm packages using your own authenticated
|
|
|
149
149
|
|
|
150
150
|
## Credits
|
|
151
151
|
|
|
152
|
-
Built on top of [
|
|
152
|
+
Built on top of [Meridian](https://github.com/rynfar/meridian) by [@rynfar](https://github.com/rynfar), which provides the core proxy that bridges the Anthropic Agent SDK to the standard API.
|
|
153
153
|
|
|
154
154
|
Powered by the [Claude Agent SDK](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk) by Anthropic and [OpenCode](https://opencode.ai).
|
|
155
155
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function d(o){return(
|
|
1
|
+
function d(o){return(s,t)=>o.app.log({body:{service:"opencode-with-claude",level:s,message:t}})}import{startProxyServer as g}from"@rynfar/meridian";var m=process.platform==="win32",y=3456,x=/authenticat|credentials|expired|not logged in|exit(?:ed)? with code|crash|unhealthy|401|402|billing|subscription/i,P=/rate.limit|429|overloaded|503|stale.session|timeout|timed out/i;function w(o){return x.test(o)?"error":P.test(o)?"warn":"debug"}async function h(o){let{port:s=y,log:t}=o,e=console.error;console.error=(...r)=>{let a=r.map(String).join(" ");if(a.startsWith("[PROXY]")){t(w(a),a);return}e.apply(console,r)};let i=async r=>{try{return await g({port:r,host:"127.0.0.1",silent:!0})}catch(a){if(r!==0&&a instanceof Error&&"code"in a&&a.code==="EADDRINUSE")return await t("info",`Port ${r} in use, starting on a random port instead...`),g({port:0,host:"127.0.0.1",silent:!0});throw a}},n;try{n=await i(s)}catch(r){throw console.error=e,r}let c=n.server.address()?.port??n.config?.port??y;return await t("info",`Claude Max proxy running on port ${c}`),{port:c,close:async()=>{console.error=e,await n.close()}}}async function p(o,s){try{let t=await fetch(`http://127.0.0.1:${o}/health`,{signal:AbortSignal.timeout(5e3)}),e=await t.json();if(e.status==="healthy")return{ok:!0};if(e.status==="degraded"){let n=typeof e.error=="string"?e.error:"Could not verify auth status";return await s("warn",`[claude-max] ${n}. Requests may still work \u2014 if they hang, try running 'claude login' in your terminal.`),{ok:!0,message:n}}let i=typeof e.error=="string"?e.error:`Proxy health check returned status: ${e.status??t.status}`;return await s("error",`[claude-max] ${i}`),{ok:!1,message:i}}catch(t){let e=t instanceof Error?t.message:String(t);return await s("error",`[claude-max] Health check failed: ${e}`),{ok:!1,message:`Health check failed: ${e}`}}}function f(o){let s=!1,t=()=>{s||(s=!0,o.close())};process.on("exit",t),process.on("SIGINT",t),m||process.on("SIGTERM",t)}var S=async({client:o,$:s,directory:t})=>{let e=d(o),i=parseInt(process.env.CLAUDE_PROXY_PORT||"",10)||void 0,n=await h({port:i,log:e}),l=`http://127.0.0.1:${n.port}`;await e("info",`proxy ready at ${l}`),f(n);let c=await p(n.port,e);return c.ok||await e("error",`[claude-max] Proxy started but is not healthy: ${c.message}. Requests will likely fail.`),{async config(r){r.provider??={},r.provider.anthropic??={},r.provider.anthropic.options??={},r.provider.anthropic.options.baseURL=l,r.provider.anthropic.options.apiKey="claude-max-proxy"},async"chat.params"(r,a){if(r.provider?.info?.id!=="anthropic")return;let u=await p(n.port,e);if(!u.ok)throw new Error(`Claude Max proxy is not healthy: ${u.message}`)},async"chat.headers"(r,a){r.model.providerID==="anthropic"&&(a.headers["x-opencode-session"]=r.sessionID,a.headers["x-opencode-request"]=r.message.id)}}};export{S as ClaudeMaxPlugin};
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-with-claude",
|
|
3
|
-
"description": "OpenCode plugin to use your Claude Max subscription via
|
|
4
|
-
"version": "1.3.
|
|
3
|
+
"description": "OpenCode plugin to use your Claude Max subscription via Meridian proxy",
|
|
4
|
+
"version": "1.3.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"
|
|
9
|
+
"@rynfar/meridian": "^1.22.1"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@opencode-ai/plugin": "^1.3.
|
|
12
|
+
"@opencode-ai/plugin": "^1.3.9",
|
|
13
13
|
"@types/node": "^25.5.0",
|
|
14
14
|
"tsup": "^8.5.1",
|
|
15
15
|
"typescript": "^6.0.2"
|