opencode-anthropic-fix 0.0.26 → 0.0.28
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 +30 -2
- package/index.mjs +4126 -3550
- package/lib/accounts.mjs +51 -11
- package/lib/accounts.test.mjs +22 -22
- package/lib/config.mjs +15 -1
- package/lib/oauth.mjs +256 -74
- package/lib/oauth.test.mjs +120 -3
- package/lib/rotation.mjs +2 -1
- package/lib/rotation.test.mjs +3 -3
- package/lib/storage.mjs +34 -6
- package/lib/storage.test.mjs +14 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -43,9 +43,10 @@ The [original plugin](https://github.com/anomalyco/opencode-anthropic-auth) prov
|
|
|
43
43
|
- **Standalone CLI** — manage accounts without opening OpenCode
|
|
44
44
|
- **Configurable strategies** — sticky, round-robin, or hybrid account selection
|
|
45
45
|
- **Claude Code signature emulation** — full HTTP header, system prompt, beta flag, and metadata mimicry derived from Claude Code's open source code
|
|
46
|
-
- **OAuth endpoint fingerprint parity** —
|
|
46
|
+
- **OAuth endpoint fingerprint parity** — matches the real CLI's bundled axios 1.13.6 HTTP client signature (`Accept`, `User-Agent`, `Content-Type`) on all OAuth token endpoint calls, required since 2026-03-21 server-side enforcement
|
|
47
|
+
- **Dynamic billing cache hash** — computes the `cch` field in the billing header using the real CLI's `NP1()` algorithm (SHA-256 of salt + first user message chars + version), replacing the static `00000` placeholder
|
|
47
48
|
- **Adaptive thinking for Opus/Sonnet 4.6** — automatically normalizes thinking to `{type: "adaptive"}` for supported models, with `effort-2025-11-24` beta
|
|
48
|
-
- **Upstream-aligned auto betas** — 13+ always-on betas matching Claude Code 2.1.
|
|
49
|
+
- **Upstream-aligned auto betas** — 13+ always-on betas matching Claude Code 2.1.81 (`redact-thinking-2026-02-12` available as opt-in to preserve thinking block visibility)
|
|
49
50
|
- **1M context limit override** — patches `model.limit.context` so OpenCode compacts at the right threshold while `models.dev` catches up
|
|
50
51
|
- **Runtime config + custom betas** — `/anthropic set`, `/anthropic config`, and `/anthropic betas` slash commands for live feature toggling without restarting OpenCode
|
|
51
52
|
- **Files API integration** — upload, list, download, and manage files via `/anthropic files` with endpoint/content-scoped `files-api-2025-04-14` beta injection
|
|
@@ -529,6 +530,33 @@ Account credentials are stored with restrictive file permissions (owner read/wri
|
|
|
529
530
|
|
|
530
531
|
Make sure the plugin is installed in `~/.config/opencode/plugin/`. Restart OpenCode after installing.
|
|
531
532
|
|
|
533
|
+
### "TypeError: undefined is not an object (evaluating 'hook.config')"
|
|
534
|
+
|
|
535
|
+
This usually means OpenCode loaded a broken/missing plugin entry (often a stale file in `~/.config/opencode/plugin/`, or a plugin listed in `opencode.json` that is not actually installed).
|
|
536
|
+
|
|
537
|
+
For OpenCode v1.x, the safest local-dev setup is to link the package directory into OpenCode's `node_modules` and load it by package name:
|
|
538
|
+
|
|
539
|
+
```powershell
|
|
540
|
+
$link = "$env:USERPROFILE\.config\opencode\node_modules\opencode-anthropic-fix"
|
|
541
|
+
$target = "D:\git\opencode-anthropic-fix"
|
|
542
|
+
|
|
543
|
+
New-Item -ItemType Directory -Force -Path (Split-Path $link) | Out-Null
|
|
544
|
+
if (Test-Path $link) { Remove-Item $link -Recurse -Force }
|
|
545
|
+
New-Item -ItemType Junction -Path $link -Target $target
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
Then ensure `~/.config/opencode/opencode.json` contains:
|
|
549
|
+
|
|
550
|
+
```json
|
|
551
|
+
{
|
|
552
|
+
"plugin": ["opencode-anthropic-fix"]
|
|
553
|
+
}
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
If you still see the error, temporarily keep only `"opencode-anthropic-fix"` in the plugin array and add other plugins back one-by-one to find the broken one.
|
|
557
|
+
|
|
558
|
+
Important: remove stale standalone files like `~/.config/opencode/plugin/opencode-anthropic-auth-plugin.js` if present. They can shadow package loading and trigger `hook.config` crashes.
|
|
559
|
+
|
|
532
560
|
### "Auth flow completes but requests fail"
|
|
533
561
|
|
|
534
562
|
Your OAuth token may have expired. Try a quick refresh first, or re-authenticate with fresh browser login:
|