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.
- package/index.mjs +10 -9
- 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
|
-
|
|
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
|
|
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
|
-
|
|
179
|
+
];
|
|
180
|
+
const mergedBetas = [
|
|
181
|
+
...new Set([...requiredBetas, ...incomingBetasList]),
|
|
181
182
|
].join(",");
|
|
182
183
|
|
|
183
184
|
requestHeaders.set("authorization", `Bearer ${auth.access}`);
|