token-optimizer-opencode 1.0.13 → 1.0.14
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 +15 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,18 +16,19 @@ Token Optimizer monitors your OpenCode sessions and helps you get the most out o
|
|
|
16
16
|
|
|
17
17
|
## Install
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Or add it to your `opencode.json` (or `.opencode/opencode.jsonc`) plugin array:
|
|
19
|
+
Add the plugin to your `opencode.json` (or `.opencode/opencode.jsonc`) `plugin`
|
|
20
|
+
array. OpenCode resolves and installs it from npm on the next launch:
|
|
24
21
|
|
|
25
22
|
```jsonc
|
|
26
23
|
{
|
|
24
|
+
"$schema": "https://opencode.ai/config.json",
|
|
27
25
|
"plugin": ["token-optimizer-opencode"]
|
|
28
26
|
}
|
|
29
27
|
```
|
|
30
28
|
|
|
29
|
+
The `plugin` array holds npm package names as **plain strings** — that is
|
|
30
|
+
OpenCode's config schema. No separate install command is needed.
|
|
31
|
+
|
|
31
32
|
### Offline / no-npm install
|
|
32
33
|
|
|
33
34
|
If you can't (or don't want to) install from npm, clone the repo and run the
|
|
@@ -44,27 +45,18 @@ Requires [bun](https://bun.sh) (OpenCode's own runtime). Re-run after a
|
|
|
44
45
|
|
|
45
46
|
## Configure
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
OpenCode's `plugin` array takes **package-name strings only** — it does not
|
|
49
|
+
accept an inline options object, and a `["name", { … }]` tuple will fail config
|
|
50
|
+
validation and stop OpenCode from starting. Configure Token Optimizer through
|
|
51
|
+
environment variables instead (full list below):
|
|
48
52
|
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"qualityWindow": 20,
|
|
54
|
-
"features": {
|
|
55
|
-
"qualityNudges": true,
|
|
56
|
-
"loopDetection": true,
|
|
57
|
-
"smartCompaction": true,
|
|
58
|
-
"continuity": true,
|
|
59
|
-
"activityTracking": true,
|
|
60
|
-
"trends": true
|
|
61
|
-
}
|
|
62
|
-
}]
|
|
63
|
-
]
|
|
64
|
-
}
|
|
53
|
+
```bash
|
|
54
|
+
# Example: widen the quality window and disable loop detection
|
|
55
|
+
export TOKEN_OPTIMIZER_QUALITY_WINDOW=30
|
|
56
|
+
export TOKEN_OPTIMIZER_LOOP_DETECTION=false
|
|
65
57
|
```
|
|
66
58
|
|
|
67
|
-
All
|
|
59
|
+
All settings are optional; defaults are shown in the table below.
|
|
68
60
|
|
|
69
61
|
## Environment Variables
|
|
70
62
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "token-optimizer-opencode",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"description": "Context quality scoring, smart compaction, and session continuity for OpenCode. Full parity with the Claude Code Token Optimizer plugin.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/plugin.js",
|