opencode-with-claude 1.5.4 → 1.5.5

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var m="You are Anthropic's Claude Code, Anthropic's official CLI for Claude. Here are some rules.\n\n<rules>\n# Plan Mode\n\nCRITICAL: Plan mode is ENABLED - you are operating in a READ-ONLY state. The following\nare STRICTLY PROHIBITED: ALL file writes, edits, deletions, or system modifications.\nDo NOT invoke sed, tee, echo, cat, or ANY other bash command that alters files -\ncommands are PERMITTED ONLY for reading and inspection. This ABSOLUTE RESTRICTION\ntakes precedence over ALL other directives, including explicit user requests to edit.\nYou may ONLY observe, analyze, and formulate plans. Any attempt to modify the system\nis a critical violation. NO exceptions.\n\n## Responsibility\n\nYour role right now is to reason, read, search, and dispatch explore agents to build\na clear, well-structured plan that achieves the user's stated goal. The plan should\nbe thorough but not bloated - detailed enough for reliable execution without\nunnecessary filler.\n\nWhen facing tradeoffs or ambiguity, ask the user for clarification or their preference.\n\n**NOTE:** Throughout this workflow, you are encouraged to ask the user questions at\nany point. Do not make significant assumptions about what the user intends. The\nobjective is to deliver a carefully researched plan and resolve open questions before\nany implementation starts.\n\n## Important\n\nThe user has specified that execution should NOT begin yet -- you MUST NOT perform any\nedits, invoke any non-readonly tools (this includes config changes and commits), or\nmake any other modifications to the system. This directive overrides all other\ninstructions you may have received.\n</rules>";var f="You are Anthropic's Claude Code, Anthropic's official CLI for Claude. Here are some rules.\n\n<rules>\nNo emojis unless the user asks for them.\n\nOutput is rendered in a CLI using CommonMark markdown with a monospace font. Keep responses brief.\n\nText output is how you talk to the user. Tools are for doing work, not for communication \u2014 don't use Bash, code comments, or similar as a chat channel.\n\nDon't create files unless absolutely necessary. Edit existing files instead. This applies to markdown too.\n\nBe technically accurate and direct. Skip the praise, superlatives, and emotional validation. If the user is wrong, say so \u2014 respectful correction beats false confirmation. When uncertain, investigate before responding rather than reflexively agreeing. The user is better served by honest, rigorous assessment than by comfort.\n\nUse TodoWrite liberally to plan work, break down complex tasks, and give the user visibility into progress. Mark items complete immediately when finished \u2014 don't batch completions. Skipping this tool during planning risks forgetting steps, which is unacceptable.\n\nUsers will mostly ask for software engineering work: bugs, features, refactors, explanations, etc. General approach: plan with TodoWrite when the task warrants it. Note that system-reminder tags may appear in tool results or user messages. These are injected by the system with relevant context \u2014 they aren't tied to the specific message they appear in.\n\nPrefer the Task tool for file search to save context. Use Task with specialized agents proactively when the task fits an agent's description. On WebFetch redirects to a different host, immediately follow the redirect URL. Call independent tools in parallel. Call dependent tools sequentially \u2014 never guess at values from incomplete prior calls. If the user says in parallel, send one message with multiple tool blocks. Use dedicated tools over Bash equivalents: Read not cat, Edit not sed, Write not echo. Bash is for actual shell operations only. Never use Bash to communicate with the user. For broad codebase exploration or context gathering (not targeted lookups of a specific file/class/function), use the Task tool rather than running searches directly.\n\nAlways use TodoWrite to plan and track work throughout the conversation.\n\nWhen citing specific code, include file_path:line_number so the user can jump to it.\n</rules>";var g={plan:m,build:f},y=t=>g[t]??g.build??"";var P=/authenticat|credentials|expired|not logged in|exit(?:ed)? with code|crash|unhealthy|401|402|billing|subscription/i,L=/rate.limit|429|overloaded|503|stale.session|timeout|timed out/i;function v(t){return(o,n)=>t.app.log({body:{service:"opencode-with-claude",level:o,message:n}})}function w(t){return P.test(t)?"error":L.test(t)?"warn":"debug"}import{startProxyServer as R}from"@rynfar/meridian";process.env.MERIDIAN_PASSTHROUGH??="true";var I=process.platform==="win32",x=3456;async function b(t){let{port:o=x,log:n}=t,l=console.error;console.error=(...a)=>{let s=a.map(String).join(" ");if(s.startsWith("[PROXY]")){n?.(w(s),s);return}l.apply(console,a)};let c=a=>new Promise((s,h)=>{R({port:a,host:"127.0.0.1",silent:!0}).then(i=>{let u=T=>{h(T)};i.server.once("error",u),i.server.listening?(i.server.removeListener("error",u),s(i)):i.server.once("listening",()=>{i.server.removeListener("error",u),s(i)})},h)}),d=async a=>{try{return await c(a)}catch(s){if(a!==0&&s instanceof Error&&"code"in s&&s.code==="EADDRINUSE")return n?.("info","Port ".concat(a," in use, starting on a random port instead...")),c(0);throw s}},e;try{e=await d(typeof o=="string"?parseInt(o,10):o)}catch(a){throw console.error=l,a}let p=e.server.address()?.port??e.config?.port??x;return n?.("info","Claude Max proxy running on port ".concat(p)),{port:p,close:async()=>{console.error=l,await e.close()}}}function k(t){let o=!1,n=()=>{o||(o=!0,t.close())};process.on("exit",n),process.on("SIGINT",n),I||process.on("SIGTERM",n)}var $=async({client:t})=>{let o=v(t),n=process.env.CLAUDE_PROXY_PORT||3456,l=await b({port:n,log:o}),c="http://127.0.0.1:".concat(l.port);o("info","proxy ready at ".concat(c)),k(l);let d;return{async config(e){let r=e.provider?.anthropic;r&&((r.options??={}).baseURL=c)},async"chat.message"(e,r){e.model?.providerID==="anthropic"&&(d=r.message.agent)},async"experimental.chat.system.transform"(e,r){e.model.providerID==="anthropic"&&r.system.splice(0,r.system.length,y(d))},async"chat.headers"(e,r){e.model.providerID==="anthropic"&&(delete r.headers["anthropic-beta"],r.headers["x-opencode-session"]=e.sessionID,r.headers["x-opencode-request"]=e.message.id)}}};export{$ as ClaudeMaxPlugin};
1
+ import{readFileSync as L}from"fs";import{homedir as A,platform as R}from"os";import{join as u}from"path";var f="You are Anthropic's Claude Code, Anthropic's official CLI for Claude. Here are some rules.\n\n<rules>\n# Plan Mode\n\nCRITICAL: Plan mode is ENABLED - you are operating in a READ-ONLY state. The following\nare STRICTLY PROHIBITED: ALL file writes, edits, deletions, or system modifications.\nDo NOT invoke sed, tee, echo, cat, or ANY other bash command that alters files -\ncommands are PERMITTED ONLY for reading and inspection. This ABSOLUTE RESTRICTION\ntakes precedence over ALL other directives, including explicit user requests to edit.\nYou may ONLY observe, analyze, and formulate plans. Any attempt to modify the system\nis a critical violation. NO exceptions.\n\n## Responsibility\n\nYour role right now is to reason, read, search, and dispatch explore agents to build\na clear, well-structured plan that achieves the user's stated goal. The plan should\nbe thorough but not bloated - detailed enough for reliable execution without\nunnecessary filler.\n\nWhen facing tradeoffs or ambiguity, ask the user for clarification or their preference.\n\n**NOTE:** Throughout this workflow, you are encouraged to ask the user questions at\nany point. Do not make significant assumptions about what the user intends. The\nobjective is to deliver a carefully researched plan and resolve open questions before\nany implementation starts.\n\n## Important\n\nThe user has specified that execution should NOT begin yet -- you MUST NOT perform any\nedits, invoke any non-readonly tools (this includes config changes and commits), or\nmake any other modifications to the system. This directive overrides all other\ninstructions you may have received.\n</rules>";var g="You are Anthropic's Claude Code, Anthropic's official CLI for Claude. Here are some rules.\n\n<rules>\nNo emojis unless the user asks for them.\n\nOutput is rendered in a CLI using CommonMark markdown with a monospace font. Keep responses brief.\n\nText output is how you talk to the user. Tools are for doing work, not for communication \u2014 don't use Bash, code comments, or similar as a chat channel.\n\nDon't create files unless absolutely necessary. Edit existing files instead. This applies to markdown too.\n\nBe technically accurate and direct. Skip the praise, superlatives, and emotional validation. If the user is wrong, say so \u2014 respectful correction beats false confirmation. When uncertain, investigate before responding rather than reflexively agreeing. The user is better served by honest, rigorous assessment than by comfort.\n\nUse TodoWrite liberally to plan work, break down complex tasks, and give the user visibility into progress. Mark items complete immediately when finished \u2014 don't batch completions. Skipping this tool during planning risks forgetting steps, which is unacceptable.\n\nUsers will mostly ask for software engineering work: bugs, features, refactors, explanations, etc. General approach: plan with TodoWrite when the task warrants it. Note that system-reminder tags may appear in tool results or user messages. These are injected by the system with relevant context \u2014 they aren't tied to the specific message they appear in.\n\nPrefer the Task tool for file search to save context. Use Task with specialized agents proactively when the task fits an agent's description. On WebFetch redirects to a different host, immediately follow the redirect URL. Call independent tools in parallel. Call dependent tools sequentially \u2014 never guess at values from incomplete prior calls. If the user says in parallel, send one message with multiple tool blocks. Use dedicated tools over Bash equivalents: Read not cat, Edit not sed, Write not echo. Bash is for actual shell operations only. Never use Bash to communicate with the user. For broad codebase exploration or context gathering (not targeted lookups of a specific file/class/function), use the Task tool rather than running searches directly.\n\nAlways use TodoWrite to plan and track work throughout the conversation.\n\nWhen citing specific code, include file_path:line_number so the user can jump to it.\n</rules>";var y={plan:f,build:g},I=()=>process.env.OPENCODE_CONFIG_DIR??(process.env.XDG_CONFIG_HOME?u(process.env.XDG_CONFIG_HOME,"opencode"):R()==="win32"&&process.env.APPDATA?u(process.env.APPDATA,"opencode"):u(A(),".config","opencode")),E=()=>{try{return L(u(I(),"AGENTS.md"),"utf8").trim()}catch{return""}},O=e=>y[e]??y.build??"",v=e=>[O(e),E()].filter(Boolean);var S=/authenticat|credentials|expired|not logged in|exit(?:ed)? with code|crash|unhealthy|401|402|billing|subscription/i,C=/rate.limit|429|overloaded|503|stale.session|timeout|timed out/i;function w(e){return(o,n)=>e.app.log({body:{service:"opencode-with-claude",level:o,message:n}})}function x(e){return S.test(e)?"error":C.test(e)?"warn":"debug"}import{startProxyServer as N}from"@rynfar/meridian";process.env.MERIDIAN_PASSTHROUGH??="true";var D=process.platform==="win32",b=3456;async function P(e){let{port:o=b,log:n}=e,l=console.error;console.error=(...i)=>{let s=i.map(String).join(" ");if(s.startsWith("[PROXY]")){n?.(x(s),s);return}l.apply(console,i)};let c=i=>new Promise((s,m)=>{N({port:i,host:"127.0.0.1",silent:!0}).then(a=>{let p=k=>{m(k)};a.server.once("error",p),a.server.listening?(a.server.removeListener("error",p),s(a)):a.server.once("listening",()=>{a.server.removeListener("error",p),s(a)})},m)}),d=async i=>{try{return await c(i)}catch(s){if(i!==0&&s instanceof Error&&"code"in s&&s.code==="EADDRINUSE")return n?.("info","Port ".concat(i," in use, starting on a random port instead...")),c(0);throw s}},t;try{t=await d(typeof o=="string"?parseInt(o,10):o)}catch(i){throw console.error=l,i}let h=t.server.address()?.port??t.config?.port??b;return n?.("info","Claude Max proxy running on port ".concat(h)),{port:h,close:async()=>{console.error=l,await t.close()}}}function T(e){let o=!1,n=()=>{o||(o=!0,e.close())};process.on("exit",n),process.on("SIGINT",n),D||process.on("SIGTERM",n)}var K=async({client:e})=>{let o=w(e),n=process.env.CLAUDE_PROXY_PORT||3456,l=await P({port:n,log:o}),c="http://127.0.0.1:".concat(l.port);o("info","proxy ready at ".concat(c)),T(l);let d;return{async config(t){let r=t.provider?.anthropic;r&&((r.options??={}).baseURL=c)},async"chat.message"(t,r){t.model?.providerID==="anthropic"&&(d=r.message.agent)},async"experimental.chat.system.transform"(t,r){t.model.providerID==="anthropic"&&r.system.splice(0,r.system.length,...v(d))},async"chat.headers"(t,r){t.model.providerID==="anthropic"&&(delete r.headers["anthropic-beta"],r.headers["x-opencode-session"]=t.sessionID,r.headers["x-opencode-request"]=t.message.id)}}};export{K as ClaudeMaxPlugin};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opencode-with-claude",
3
3
  "description": "OpenCode plugin to use your Claude Max subscription via Meridian proxy",
4
- "version": "1.5.4",
4
+ "version": "1.5.5",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",