@xtruder/opencode-claude-max-plugin 0.1.17 → 0.2.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/README.md +56 -18
- package/build/index.d.ts.map +1 -1
- package/build/index.js +256 -336
- package/build/model.d.ts.map +1 -1
- package/build/prompt.d.ts.map +1 -1
- package/build/server.d.ts +14 -0
- package/build/server.d.ts.map +1 -0
- package/build/server.js +1212 -0
- package/build/stream.d.ts.map +1 -1
- package/build/usage.d.ts +72 -5
- package/build/usage.d.ts.map +1 -1
- package/package.json +40 -4
- package/src/credentials.ts +156 -0
- package/src/tui.tsx +396 -0
- package/src/usage.ts +331 -0
- package/build/usage-cache.d.ts +0 -15
- package/build/usage-cache.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
An [OpenCode](https://opencode.ai/) plugin that enables Claude Pro/Max subscription access via the official [`@anthropic-ai/sdk`](https://github.com/anthropics/anthropic-sdk-typescript), using OAuth credentials from Claude Code (`~/.claude/.credentials.json`).
|
|
4
4
|
|
|
5
|
+

|
|
6
|
+
|
|
5
7
|
## Why?
|
|
6
8
|
|
|
7
9
|
- **Use your Claude subscription** — Automatically reads OAuth credentials from Claude Code, no separate API key needed
|
|
@@ -9,7 +11,7 @@ An [OpenCode](https://opencode.ai/) plugin that enables Claude Pro/Max subscript
|
|
|
9
11
|
- **Prompt caching** — 98% of input tokens served from cache (system prompt + tools cached globally)
|
|
10
12
|
- **All Claude models** — Opus 4.6, Sonnet 4.6, Haiku 4.5
|
|
11
13
|
- **Extended thinking** — Full reasoning support with thinking variants (high/max)
|
|
12
|
-
- **Usage tracking** —
|
|
14
|
+
- **Usage tracking** — Sidebar widget with live progress bars + `/usage` command with full details
|
|
13
15
|
- **Self-registering** — Models are registered automatically, no manual provider config needed
|
|
14
16
|
|
|
15
17
|
## Installation
|
|
@@ -27,6 +29,57 @@ That's it. The plugin self-registers the `anthropic-sdk` provider and its models
|
|
|
27
29
|
|
|
28
30
|
Then open OpenCode and run `/connect` → Other → `anthropic-sdk`. If Claude Code is installed and you're logged in, credentials are read automatically from `~/.claude/.credentials.json` — no API key needed.
|
|
29
31
|
|
|
32
|
+
### TUI Plugin (sidebar + /usage command)
|
|
33
|
+
|
|
34
|
+
The plugin includes a TUI component that shows subscription usage in the sidebar and registers a `/usage` slash command. To enable it, add the plugin to your `tui.json` as well:
|
|
35
|
+
|
|
36
|
+
**Project-level** (`.opencode/tui.json`):
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"plugin": ["@xtruder/opencode-claude-max-plugin"]
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Or globally** (`~/.config/opencode/tui.json`):
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"plugin": ["@xtruder/opencode-claude-max-plugin"]
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The TUI plugin provides:
|
|
53
|
+
|
|
54
|
+
- **Sidebar widget** — Compact progress bars for 5-hour session and 7-day weekly usage
|
|
55
|
+
- **`/usage` command** — Opens a dialog with full usage breakdown (per-model, extra usage)
|
|
56
|
+
- **Auto-refresh** — Polls the usage API every 60s and after each inference call
|
|
57
|
+
|
|
58
|
+
#### TUI Configuration
|
|
59
|
+
|
|
60
|
+
Options can be set in the `tui.json` plugin entry:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"plugin": [
|
|
65
|
+
[
|
|
66
|
+
"@xtruder/opencode-claude-max-plugin",
|
|
67
|
+
{
|
|
68
|
+
"enabled": true,
|
|
69
|
+
"sidebar": true,
|
|
70
|
+
"poll_interval": 60
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
| Option | Type | Default | Description |
|
|
78
|
+
| --------------- | ------- | ------- | ----------------------------------------- |
|
|
79
|
+
| `enabled` | boolean | `true` | Enable/disable the TUI plugin entirely |
|
|
80
|
+
| `sidebar` | boolean | `true` | Show/hide sidebar usage widget |
|
|
81
|
+
| `poll_interval` | number | `60` | Seconds between usage API polls (min: 10) |
|
|
82
|
+
|
|
30
83
|
### Custom model options
|
|
31
84
|
|
|
32
85
|
If you want to override model settings (e.g. thinking budgets, variants), you can add a `provider` block alongside the plugin:
|
|
@@ -71,25 +124,10 @@ For Claude Code credentials, log in via `claude` CLI first (`claude auth login`)
|
|
|
71
124
|
- MCP tool name remapping (`server_tool` → `mcp__server__tool`)
|
|
72
125
|
- Extended thinking with signature passthrough for multi-turn conversations
|
|
73
126
|
- Prompt caching (98% cache hit rate with full OpenCode tool set)
|
|
127
|
+
- CCH request signing — computes xxHash64 body integrity hash to unlock features like fast mode
|
|
74
128
|
- Subscription rate limit detection — fails fast with clear message instead of hanging
|
|
75
129
|
- Long context auto-detection — adds `context-1m` beta header when request body is large
|
|
76
|
-
- `/usage` slash command
|
|
77
|
-
|
|
78
|
-
## Usage Command
|
|
79
|
-
|
|
80
|
-
After adding the config, run `/usage` inside OpenCode to see your subscription usage:
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
Claude Subscription Usage
|
|
84
|
-
────────────────────────────────────────────────────
|
|
85
|
-
Current session
|
|
86
|
-
████████████████████████████████░░░░░░░░░░░░░░░░░░ 67% used
|
|
87
|
-
Resets 7:00 PM GMT+1
|
|
88
|
-
|
|
89
|
-
Current week (all models)
|
|
90
|
-
████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 8% used
|
|
91
|
-
Resets Mar 30, 7:00 AM GMT+2
|
|
92
|
-
```
|
|
130
|
+
- TUI sidebar with live usage bars + `/usage` slash command with full subscription details
|
|
93
131
|
|
|
94
132
|
## With Vercel AI SDK
|
|
95
133
|
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAiGjD,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAEhC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAA;IAE/B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IAExB;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAAA;CAChD;AA4BD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,GAAE,2BAAgC,GACxC,oBAAoB,CAkItB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAoBhC,CAAA;AAID,eAAe,kBAAkB,CAAA"}
|