opencode-anthropic-auth 0.0.2 → 0.0.3
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/.github/workflows/publish.yml +26 -0
- package/bun.lock +43 -0
- package/index.mjs +19 -2
- package/package.json +1 -1
- package/script/publish.ts +29 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
bump:
|
|
7
|
+
description: "Version bump type"
|
|
8
|
+
required: false
|
|
9
|
+
default: "patch"
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
publish:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- uses: actions/setup-node@v4
|
|
18
|
+
with:
|
|
19
|
+
node-version: "20"
|
|
20
|
+
registry-url: "https://registry.npmjs.org"
|
|
21
|
+
|
|
22
|
+
- run: npm install
|
|
23
|
+
|
|
24
|
+
- run: npm publish --access public
|
|
25
|
+
env:
|
|
26
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/bun.lock
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lockfileVersion": 1,
|
|
3
|
+
"workspaces": {
|
|
4
|
+
"": {
|
|
5
|
+
"name": "opencode-anthropic-auth",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@openauthjs/openauth": "^0.4.3",
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"@opencode-ai/plugin": "^0.4.45",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
"packages": {
|
|
15
|
+
"@openauthjs/openauth": ["@openauthjs/openauth@0.4.3", "", { "dependencies": { "@standard-schema/spec": "1.0.0-beta.3", "aws4fetch": "1.0.20", "jose": "5.9.6" }, "peerDependencies": { "arctic": "^2.2.2", "hono": "^4.0.0" } }, "sha512-RlnjqvHzqcbFVymEwhlUEuac4utA5h4nhSK/i2szZuQmxTIqbGUxZ+nM+avM+VV4Ing+/ZaNLKILoXS3yrkOOw=="],
|
|
16
|
+
|
|
17
|
+
"@opencode-ai/plugin": ["@opencode-ai/plugin@0.4.45", "", { "dependencies": { "@opencode-ai/sdk": "0.4.19" } }, "sha512-TuD+FNmA6vN+/B82qayCvOyTXRuAtfvU0U95UKSZoNrYgIBhpD/sW/oS65iUv5QwQqzO8BxI4DYWjmLIqCz8uw=="],
|
|
18
|
+
|
|
19
|
+
"@opencode-ai/sdk": ["@opencode-ai/sdk@0.4.19", "", {}, "sha512-7V+wDR1+m+TQZAraAh/bOSObiA/uysG1YIXZVe6gl1sQAXDtkG2FYCzs0gTZ/ORdkUKEnr3vyQIk895Mu0CC/w=="],
|
|
20
|
+
|
|
21
|
+
"@oslojs/asn1": ["@oslojs/asn1@1.0.0", "", { "dependencies": { "@oslojs/binary": "1.0.0" } }, "sha512-zw/wn0sj0j0QKbIXfIlnEcTviaCzYOY3V5rAyjR6YtOByFtJiT574+8p9Wlach0lZH9fddD4yb9laEAIl4vXQA=="],
|
|
22
|
+
|
|
23
|
+
"@oslojs/binary": ["@oslojs/binary@1.0.0", "", {}, "sha512-9RCU6OwXU6p67H4NODbuxv2S3eenuQ4/WFLrsq+K/k682xrznH5EVWA7N4VFk9VYVcbFtKqur5YQQZc0ySGhsQ=="],
|
|
24
|
+
|
|
25
|
+
"@oslojs/crypto": ["@oslojs/crypto@1.0.1", "", { "dependencies": { "@oslojs/asn1": "1.0.0", "@oslojs/binary": "1.0.0" } }, "sha512-7n08G8nWjAr/Yu3vu9zzrd0L9XnrJfpMioQcvCMxBIiF5orECHe5/3J0jmXRVvgfqMm/+4oxlQ+Sq39COYLcNQ=="],
|
|
26
|
+
|
|
27
|
+
"@oslojs/encoding": ["@oslojs/encoding@1.1.0", "", {}, "sha512-70wQhgYmndg4GCPxPPxPGevRKqTIJ2Nh4OkiMWmDAVYsTQ+Ta7Sq+rPevXyXGdzr30/qZBnyOalCszoMxlyldQ=="],
|
|
28
|
+
|
|
29
|
+
"@oslojs/jwt": ["@oslojs/jwt@0.2.0", "", { "dependencies": { "@oslojs/encoding": "0.4.1" } }, "sha512-bLE7BtHrURedCn4Mco3ma9L4Y1GR2SMBuIvjWr7rmQ4/W/4Jy70TIAgZ+0nIlk0xHz1vNP8x8DCns45Sb2XRbg=="],
|
|
30
|
+
|
|
31
|
+
"@standard-schema/spec": ["@standard-schema/spec@1.0.0-beta.3", "", {}, "sha512-0ifF3BjA1E8SY9C+nUew8RefNOIq0cDlYALPty4rhUm8Rrl6tCM8hBT4bhGhx7I7iXD0uAgt50lgo8dD73ACMw=="],
|
|
32
|
+
|
|
33
|
+
"arctic": ["arctic@2.3.4", "", { "dependencies": { "@oslojs/crypto": "1.0.1", "@oslojs/encoding": "1.1.0", "@oslojs/jwt": "0.2.0" } }, "sha512-+p30BOWsctZp+CVYCt7oAean/hWGW42sH5LAcRQX56ttEkFJWbzXBhmSpibbzwSJkRrotmsA+oAoJoVsU0f5xA=="],
|
|
34
|
+
|
|
35
|
+
"aws4fetch": ["aws4fetch@1.0.20", "", {}, "sha512-/djoAN709iY65ETD6LKCtyyEI04XIBP5xVvfmNxsEP0uJB5tyaGBztSryRr4HqMStr9R06PisQE7m9zDTXKu6g=="],
|
|
36
|
+
|
|
37
|
+
"hono": ["hono@4.9.1", "", {}, "sha512-qfvdJ42t6CQE0N/iSCa8KsW8SQqYD67YB+TYbwPHlnALvX+s7ynh8otR1NEk5jXtUg73gpV/B82OSufDmwtX3w=="],
|
|
38
|
+
|
|
39
|
+
"jose": ["jose@5.9.6", "", {}, "sha512-AMlnetc9+CV9asI19zHmrgS/WYsWUwCn2R7RzlbJWD7F9eWYUTGyBmU9o6PxngtLGOiDGPRu+Uc4fhKzbpteZQ=="],
|
|
40
|
+
|
|
41
|
+
"@oslojs/jwt/@oslojs/encoding": ["@oslojs/encoding@0.4.1", "", {}, "sha512-hkjo6MuIK/kQR5CrGNdAPZhS01ZCXuWDRJ187zh6qqF2+yMHZpD9fAYpX8q2bOO6Ryhl3XpCT6kUX76N8hhm4Q=="],
|
|
42
|
+
}
|
|
43
|
+
}
|
package/index.mjs
CHANGED
|
@@ -121,11 +121,28 @@ export async function AnthropicAuthPlugin({ client }) {
|
|
|
121
121
|
});
|
|
122
122
|
auth.access = json.access_token;
|
|
123
123
|
}
|
|
124
|
+
// Add oauth-2025-04-20 beta to whatever betas are already present
|
|
125
|
+
const incomingBeta = init.headers?.["anthropic-beta"] || "";
|
|
126
|
+
const incomingBetasList = incomingBeta
|
|
127
|
+
.split(",")
|
|
128
|
+
.map((b) => b.trim())
|
|
129
|
+
.filter(Boolean);
|
|
130
|
+
|
|
131
|
+
// Add oauth beta and deduplicate
|
|
132
|
+
const mergedBetas = [
|
|
133
|
+
...new Set([
|
|
134
|
+
"oauth-2025-04-20",
|
|
135
|
+
"claude-code-20250219",
|
|
136
|
+
"interleaved-thinking-2025-05-14",
|
|
137
|
+
"fine-grained-tool-streaming-2025-05-14",
|
|
138
|
+
...incomingBetasList,
|
|
139
|
+
]),
|
|
140
|
+
].join(",");
|
|
141
|
+
|
|
124
142
|
const headers = {
|
|
125
143
|
...init.headers,
|
|
126
144
|
authorization: `Bearer ${auth.access}`,
|
|
127
|
-
"anthropic-beta":
|
|
128
|
-
"oauth-2025-04-20,claude-code-20250219,interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14",
|
|
145
|
+
"anthropic-beta": mergedBetas,
|
|
129
146
|
};
|
|
130
147
|
delete headers["x-api-key"];
|
|
131
148
|
return fetch(input, {
|
package/package.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { $ } from "bun";
|
|
3
|
+
|
|
4
|
+
const dir = new URL("..", import.meta.url).pathname;
|
|
5
|
+
process.chdir(dir);
|
|
6
|
+
|
|
7
|
+
const bumpType = process.argv[2] || "patch";
|
|
8
|
+
|
|
9
|
+
console.log(`Bumping ${bumpType} version...`);
|
|
10
|
+
|
|
11
|
+
// Bump version in package.json
|
|
12
|
+
await $`npm version ${bumpType} --no-git-tag-version`;
|
|
13
|
+
|
|
14
|
+
// Read the new version
|
|
15
|
+
const pkg = await Bun.file("./package.json").json();
|
|
16
|
+
const version = pkg.version;
|
|
17
|
+
|
|
18
|
+
console.log(`New version: ${version}`);
|
|
19
|
+
|
|
20
|
+
// Commit the version bump
|
|
21
|
+
await $`git add package.json`;
|
|
22
|
+
await $`git commit -m "Bump version to ${version}"`;
|
|
23
|
+
await $`git push`;
|
|
24
|
+
|
|
25
|
+
// Trigger GitHub workflow
|
|
26
|
+
console.log(`Triggering publish workflow...`);
|
|
27
|
+
await $`gh workflow run publish.yml -f bump="${bumpType}"`;
|
|
28
|
+
|
|
29
|
+
console.log(`✓ Version bumped to ${version} and publish workflow triggered`);
|