opencode-anthropic-auth 0.0.11 → 0.0.13

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/index.mjs +10 -9
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -71,10 +71,12 @@ async function exchange(code, verifier) {
71
71
  export async function AnthropicAuthPlugin({ client }) {
72
72
  return {
73
73
  "experimental.chat.system.transform": (input, output) => {
74
+ const prefix =
75
+ "You are Claude Code, Anthropic's official CLI for Claude.";
74
76
  if (input.model?.providerID === "anthropic") {
75
- output.system.unshift(
76
- "You are Claude Code, Anthropic's official CLI for Claude.",
77
- );
77
+ output.system.unshift(prefix);
78
+ if (output.system[1])
79
+ output.system[1] = prefix + "\n\n" + output.system[1];
78
80
  }
79
81
  },
80
82
  auth: {
@@ -164,20 +166,19 @@ export async function AnthropicAuthPlugin({ client }) {
164
166
  }
165
167
  }
166
168
 
169
+ // Preserve all incoming beta headers while ensuring OAuth requirements
167
170
  const incomingBeta = requestHeaders.get("anthropic-beta") || "";
168
171
  const incomingBetasList = incomingBeta
169
172
  .split(",")
170
173
  .map((b) => b.trim())
171
174
  .filter(Boolean);
172
175
 
173
- const includeClaudeCode = incomingBetasList.includes(
174
- "claude-code-20250219",
175
- );
176
-
177
- const mergedBetas = [
176
+ const requiredBetas = [
178
177
  "oauth-2025-04-20",
179
178
  "interleaved-thinking-2025-05-14",
180
- ...(includeClaudeCode ? ["claude-code-20250219"] : []),
179
+ ];
180
+ const mergedBetas = [
181
+ ...new Set([...requiredBetas, ...incomingBetasList]),
181
182
  ].join(",");
182
183
 
183
184
  requestHeaders.set("authorization", `Bearer ${auth.access}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-anthropic-auth",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "main": "./index.mjs",
5
5
  "devDependencies": {
6
6
  "@opencode-ai/plugin": "^0.4.45"