opencode-tps-meter 0.1.0 → 0.1.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 +7 -53
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.mjs +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
[](https://www.typescriptlang.org/)
|
|
8
8
|
[](https://bun.sh)
|
|
9
9
|
[](https://opencode.ai)
|
|
10
|
+
[](https://www.npmjs.com/package/opencode-tps-meter)
|
|
10
11
|
[](LICENSE)
|
|
11
12
|
|
|
12
13
|
</div>
|
|
@@ -41,66 +42,19 @@ A live tokens-per-second meter plugin for OpenCode. Track AI token throughput in
|
|
|
41
42
|
|
|
42
43
|
## Installation
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
Add the plugin to your OpenCode configuration file (`~/.config/opencode/opencode.json`):
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
cd opencode-tps-meter
|
|
51
|
-
|
|
52
|
-
# Install dependencies and build
|
|
53
|
-
bun install
|
|
54
|
-
bun run build
|
|
55
|
-
|
|
56
|
-
# Link for local development
|
|
57
|
-
bun link
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Then in your OpenCode project:
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
# Link the plugin locally
|
|
64
|
-
bun link opencode-tps-meter
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### From Git Repository
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
# Install directly from git
|
|
71
|
-
bun add github:ChiR24/opencode-tps-meter
|
|
72
|
-
|
|
73
|
-
# Or with npm
|
|
74
|
-
npm install github:ChiR24/opencode-tps-meter
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"plugin": ["opencode-tps-meter@latest"]
|
|
50
|
+
}
|
|
75
51
|
```
|
|
76
52
|
|
|
77
|
-
### Manual Installation
|
|
78
|
-
|
|
79
|
-
Copy the `dist` folder from this repository into your project's `node_modules/opencode-tps-meter` directory.
|
|
80
|
-
|
|
81
53
|
---
|
|
82
54
|
|
|
83
55
|
## Quick Start
|
|
84
56
|
|
|
85
|
-
|
|
86
|
-
> ```bash
|
|
87
|
-
> bun install
|
|
88
|
-
> bun run build
|
|
89
|
-
> ```
|
|
90
|
-
|
|
91
|
-
### As OpenCode Plugin (Recommended)
|
|
92
|
-
|
|
93
|
-
Create a plugin file in your OpenCode project:
|
|
94
|
-
|
|
95
|
-
```typescript
|
|
96
|
-
// File: tps-meter-plugin.ts (or .js)
|
|
97
|
-
import TpsMeterPlugin from 'opencode-tps-meter';
|
|
98
|
-
|
|
99
|
-
// Export the plugin - it automatically hooks into OpenCode events
|
|
100
|
-
export default TpsMeterPlugin;
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Then configure it in your OpenCode config (see Configuration section below).
|
|
57
|
+
The plugin will automatically hook into OpenCode events and start tracking TPS after installation.
|
|
104
58
|
|
|
105
59
|
### Programmatic Usage
|
|
106
60
|
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EAKf,MAAM,YAAY,CAAC;AAoHpB;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,OAAO,EAAE,aAAa,GACrB,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EAKf,MAAM,YAAY,CAAC;AAoHpB;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,OAAO,EAAE,aAAa,GACrB,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAkWxC;AAGD,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,YAAY,EACZ,MAAM,EACN,cAAc,EACd,YAAY,EACZ,aAAa,EACb,MAAM,EACN,YAAY,EACZ,cAAc,GACf,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -620,6 +620,10 @@ function TpsMeterPlugin(context) {
|
|
|
620
620
|
logger.warn("[TpsMeter] Failed to load config, using defaults:", error instanceof Error ? error.message : String(error));
|
|
621
621
|
config = defaultConfig;
|
|
622
622
|
}
|
|
623
|
+
if (!config) {
|
|
624
|
+
logger.warn("[TpsMeter] Config is undefined, using defaults");
|
|
625
|
+
config = defaultConfig;
|
|
626
|
+
}
|
|
623
627
|
if (!config.enabled) {
|
|
624
628
|
logger.debug("[TpsMeter] Plugin disabled by configuration");
|
|
625
629
|
return {};
|
package/dist/index.mjs
CHANGED
|
@@ -571,6 +571,10 @@ function TpsMeterPlugin(context) {
|
|
|
571
571
|
logger.warn("[TpsMeter] Failed to load config, using defaults:", error instanceof Error ? error.message : String(error));
|
|
572
572
|
config = defaultConfig;
|
|
573
573
|
}
|
|
574
|
+
if (!config) {
|
|
575
|
+
logger.warn("[TpsMeter] Config is undefined, using defaults");
|
|
576
|
+
config = defaultConfig;
|
|
577
|
+
}
|
|
574
578
|
if (!config.enabled) {
|
|
575
579
|
logger.debug("[TpsMeter] Plugin disabled by configuration");
|
|
576
580
|
return {};
|