@ex-machina/opencode-anthropic-auth 1.1.1 → 1.1.2
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/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/index.js +2 -1
- package/dist/transform.js +2 -2
- package/package.json +2 -1
package/dist/constants.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export declare const TOKEN_URL = "https://platform.claude.com/v1/oauth/token";
|
|
|
8
8
|
export declare const OAUTH_SCOPES: string[];
|
|
9
9
|
export declare const TOOL_PREFIX = "mcp_";
|
|
10
10
|
export declare const REQUIRED_BETAS: string[];
|
|
11
|
+
export declare const USER_AGENT = "claude-cli/2.1.2 (external, cli)";
|
package/dist/constants.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -65,7 +65,8 @@ export const AnthropicAuthPlugin = async ({ client }) => {
|
|
|
65
65
|
await response.body?.cancel();
|
|
66
66
|
continue;
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
const body = await response.text().catch(() => '');
|
|
69
|
+
throw new Error(`Token refresh failed: ${response.status} — ${body}`);
|
|
69
70
|
}
|
|
70
71
|
const json = (await response.json());
|
|
71
72
|
// biome-ignore lint/suspicious/noExplicitAny: SDK types don't expose auth.set
|
package/dist/transform.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { REQUIRED_BETAS, TOOL_PREFIX } from './constants';
|
|
1
|
+
import { REQUIRED_BETAS, TOOL_PREFIX, USER_AGENT } from './constants';
|
|
2
2
|
/**
|
|
3
3
|
* Merge headers from a Request object and/or a RequestInit headers value
|
|
4
4
|
* into a single Headers instance.
|
|
@@ -53,7 +53,7 @@ export function mergeBetaHeaders(headers) {
|
|
|
53
53
|
export function setOAuthHeaders(headers, accessToken) {
|
|
54
54
|
headers.set('authorization', `Bearer ${accessToken}`);
|
|
55
55
|
headers.set('anthropic-beta', mergeBetaHeaders(headers));
|
|
56
|
-
headers.set('user-agent',
|
|
56
|
+
headers.set('user-agent', USER_AGENT);
|
|
57
57
|
headers.delete('x-api-key');
|
|
58
58
|
return headers;
|
|
59
59
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ex-machina/opencode-anthropic-auth",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/ex-machina-co/opencode-anthropic-auth"
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"dist"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
|
+
"prepare": "tsc -p tsconfig.build.json",
|
|
14
15
|
"build": "tsc -p tsconfig.build.json",
|
|
15
16
|
"test": "bun test",
|
|
16
17
|
"types": "tsc",
|