@ex-machina/opencode-anthropic-auth 1.7.2 → 1.7.4

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
@@ -26,7 +26,7 @@ Add the plugin to your OpenCode configuration:
26
26
 
27
27
  ```json
28
28
  {
29
- "plugin": ["@ex-machina/opencode-anthropic-auth@1.7.1"]
29
+ "plugin": ["@ex-machina/opencode-anthropic-auth@1.7.3"]
30
30
  }
31
31
  ```
32
32
 
package/dist/index.js CHANGED
@@ -39,6 +39,10 @@ export const AnthropicAuthPlugin = async ({ client }) => {
39
39
  const delay = baseDelayMs * 2 ** (attempt - 1);
40
40
  await new Promise((resolve) => setTimeout(resolve, delay));
41
41
  }
42
+ // Re-read auth to get the latest refresh token.
43
+ // The outer `auth` snapshot may be stale if tokens
44
+ // were rotated since the fetch() call was made.
45
+ const freshAuth = await getAuth();
42
46
  const response = await fetch(TOKEN_URL, {
43
47
  method: 'POST',
44
48
  headers: {
@@ -48,7 +52,7 @@ export const AnthropicAuthPlugin = async ({ client }) => {
48
52
  },
49
53
  body: JSON.stringify({
50
54
  grant_type: 'refresh_token',
51
- refresh_token: auth.refresh,
55
+ refresh_token: freshAuth.refresh,
52
56
  client_id: CLIENT_ID,
53
57
  }),
54
58
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ex-machina/opencode-anthropic-auth",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/ex-machina-co/opencode-anthropic-auth"
@@ -8,7 +8,7 @@
8
8
  "main": "./dist/index.js",
9
9
  "types": "./dist/index.d.ts",
10
10
  "engines": {
11
- "bun": "1.3.12"
11
+ "bun": "1.3.11"
12
12
  },
13
13
  "files": [
14
14
  "dist"
@@ -36,7 +36,7 @@
36
36
  "@changesets/cli": "^2.30.0",
37
37
  "@opencode-ai/plugin": "1.4.7",
38
38
  "@tsconfig/bun": "1.0.10",
39
- "@types/bun": "1.3.12",
39
+ "@types/bun": "1.3.11",
40
40
  "dedent": "^1.7.2",
41
41
  "lefthook": "2.1.6",
42
42
  "typescript": "6.0.2"