@serkanalgur/opencodev2-slim 2.0.9 → 2.0.11

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.
Files changed (3) hide show
  1. package/README.md +12 -0
  2. package/package.json +5 -2
  3. package/src/tui.tsx +7 -1
package/README.md CHANGED
@@ -141,6 +141,18 @@ Note: Compression is performed by the AI assistant using the `compress` tool. Th
141
141
 
142
142
  ## Changelog
143
143
 
144
+ ### 2.0.11
145
+
146
+ - Fix CI publish: add `solid-js`, `@opentui/core`, `@opentui/solid` to `devDependencies`.
147
+ The workflow runs `npm ci --legacy-peer-deps`, which skips peer deps, so loading
148
+ `@opencode/plugin/tui` failed with `Cannot find package 'solid-js'`.
149
+
150
+ ### 2.0.10
151
+
152
+ - Fix `/panel` output showing `User tokens: 0`: user/system messages carry their text
153
+ on a top-level `text` field (not inside `content`), which `deriveStats` now captures.
154
+ - Add regression tests for CLI panel stats.
155
+
144
156
  ### 2.0.9
145
157
 
146
158
  - `feat(panel-as-message)`: `/panel` and `slim-panel` now print the context stats as plain
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serkanalgur/opencodev2-slim",
3
- "version": "2.0.9",
3
+ "version": "2.0.11",
4
4
  "description": "Smart context management plugin for OpenCode v2 - semantic compression, cost-aware pruning, adaptive thresholds",
5
5
  "keywords": [
6
6
  "opencode",
@@ -49,10 +49,13 @@
49
49
  "jsonc-parser": "^3.3.1"
50
50
  },
51
51
  "devDependencies": {
52
- "@opencode/plugin": "^2.0.0",
53
52
  "@opencode-ai/sdk": "^1.18.29",
53
+ "@opencode/plugin": "^2.0.0",
54
+ "@opentui/core": "^0.5.11",
55
+ "@opentui/solid": "^0.5.11",
54
56
  "@types/node": "^22.0.0",
55
57
  "prettier": "^3.4.0",
58
+ "solid-js": "^1.9.12",
56
59
  "tsx": "^4.19.0",
57
60
  "typescript": "^5.7.0"
58
61
  },
package/src/tui.tsx CHANGED
@@ -31,7 +31,7 @@ function emptyStats(): PanelStats {
31
31
  }
32
32
 
33
33
  // Derives context-usage stats from the session transcript.
34
- function deriveStats(messages: readonly unknown[]): PanelStats {
34
+ export function deriveStats(messages: readonly unknown[]): PanelStats {
35
35
  const stats = emptyStats()
36
36
  for (const raw of messages) {
37
37
  const m = raw as {
@@ -55,6 +55,12 @@ function deriveStats(messages: readonly unknown[]): PanelStats {
55
55
  text = m.summary || ""
56
56
  }
57
57
 
58
+ // User/system messages carry their text on a top-level `text` field
59
+ // (not inside a `content` array). Capture it too so their tokens count.
60
+ if (role !== "assistant" && typeof (m as any).text === "string") {
61
+ text += (m as any).text
62
+ }
63
+
58
64
  if (Array.isArray(m.content)) {
59
65
  for (const part of m.content) {
60
66
  if (part?.type === "text" && typeof part.text === "string") {