opencode-with-claude 1.3.2 → 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 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 [opencode-claude-max-proxy](https://github.com/rynfar/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.
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 [opencode-claude-max-proxy](https://github.com/rynfar/opencode-claude-max-proxy) by [@rynfar](https://github.com/rynfar), which provides the core proxy that bridges the Anthropic Agent SDK to the standard API.
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(a,t)=>o.app.log({body:{service:"opencode-with-claude",level:a,message:t}})}import{startProxyServer as y}from"opencode-claude-max-proxy";var f=process.platform==="win32",m=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 g(o){let{port:a=m,log:t}=o,e=console.error;console.error=(...r)=>{let n=r.map(String).join(" ");if(n.startsWith("[PROXY]")){t(w(n),n);return}e.apply(console,r)};let i=async r=>{try{return await y({port:r,host:"127.0.0.1",silent:!0})}catch(n){if(r!==0&&n instanceof Error&&"code"in n&&n.code==="EADDRINUSE")return await t("info",`Port ${r} in use, starting on a random port instead...`),y({port:0,host:"127.0.0.1",silent:!0});throw n}},s;try{s=await i(a)}catch(r){throw console.error=e,r}let c=s.server.address().port;return await t("info",`Claude Max proxy running on port ${c}`),{port:c,close:async()=>{console.error=e,await s.close()}}}async function p(o,a){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 s=typeof e.error=="string"?e.error:"Could not verify auth status";return await a("warn",`[claude-max] ${s}. Requests may still work \u2014 if they hang, try running 'claude login' in your terminal.`),{ok:!0,message:s}}let i=typeof e.error=="string"?e.error:`Proxy health check returned status: ${e.status??t.status}`;return await a("error",`[claude-max] ${i}`),{ok:!1,message:i}}catch(t){let e=t instanceof Error?t.message:String(t);return await a("error",`[claude-max] Health check failed: ${e}`),{ok:!1,message:`Health check failed: ${e}`}}}function h(o){let a=!1,t=()=>{a||(a=!0,o.close())};process.on("exit",t),process.on("SIGINT",t),f||process.on("SIGTERM",t)}var S=async({client:o,$:a,directory:t})=>{let e=d(o),i=parseInt(process.env.CLAUDE_PROXY_PORT||"",10)||void 0,s=await g({port:i,log:e}),l=`http://127.0.0.1:${s.port}`;await e("info",`proxy ready at ${l}`),h(s);let c=await p(s.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,n){if(r.provider?.info?.id!=="anthropic")return;let u=await p(s.port,e);if(!u.ok)throw new Error(`Claude Max proxy is not healthy: ${u.message}`)},async"chat.headers"(r,n){r.model.providerID==="anthropic"&&(n.headers["x-opencode-session"]=r.sessionID,n.headers["x-opencode-request"]=r.message.id)}}};export{S as ClaudeMaxPlugin};
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 local proxy",
4
- "version": "1.3.2",
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
- "opencode-claude-max-proxy": "^1.18.2"
9
+ "@rynfar/meridian": "^1.22.1"
10
10
  },
11
11
  "devDependencies": {
12
- "@opencode-ai/plugin": "^1.3.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"