opencode-subagent-magazine 1.5.1 → 1.5.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.
@@ -1 +1 @@
1
- export declare const PLUGIN_VERSION = "1.5.1";
1
+ export declare const PLUGIN_VERSION = "1.5.2";
package/dist/_version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // auto-generated
2
- export const PLUGIN_VERSION = "1.5.1";
2
+ export const PLUGIN_VERSION = "1.5.2";
package/dist/index.js CHANGED
@@ -369,8 +369,9 @@ function SubAgentPanel(props) {
369
369
  const [renderTick, setRenderTick] = createSignal(0);
370
370
  let boxEl;
371
371
  let disposed = false;
372
- /** Total context tokens for a sub-agent session.
373
- * Matches opencode-visual-cache's "总计": last assistant message's input + cache.read. */
372
+ /** Total usage tokens for a sub-agent session.
373
+ * Matches opencode's bottom status bar usage: last assistant message with
374
+ * output > 0, summing input + output + reasoning + cache read/write. */
374
375
  const readSessionTokens = (sid) => {
375
376
  if (!sid)
376
377
  return undefined;
@@ -382,10 +383,13 @@ function SubAgentPanel(props) {
382
383
  if (m.role !== "assistant")
383
384
  continue;
384
385
  const t = m.tokens;
385
- if (!t)
386
+ if (!t || !(Number(t.output) > 0))
386
387
  continue;
387
- const cache = t.cache;
388
- const ctx = (Number(t.input) || 0) + (cache?.read ?? 0);
388
+ const ctx = (Number(t.input) || 0) +
389
+ (Number(t.output) || 0) +
390
+ (Number(t.reasoning) || 0) +
391
+ (Number(t.cache?.read) || 0) +
392
+ (Number(t.cache?.write) || 0);
389
393
  if (ctx > 0)
390
394
  return ctx;
391
395
  }
package/dist/tui.js CHANGED
@@ -11,7 +11,7 @@ import { createElement as _$createElement } from "@opentui/solid";
11
11
  import { createMemo, createSignal, createEffect, onMount, onCleanup, untrack, Show, For } from "solid-js";
12
12
 
13
13
  // src/_version.ts
14
- var PLUGIN_VERSION = "1.5.1";
14
+ var PLUGIN_VERSION = "1.5.2";
15
15
 
16
16
  // src/clipboard.ts
17
17
  import { spawn } from "node:child_process";
@@ -755,9 +755,8 @@ function SubAgentPanel(props) {
755
755
  const m = msgs[i];
756
756
  if (m.role !== "assistant") continue;
757
757
  const t2 = m.tokens;
758
- if (!t2) continue;
759
- const cache = t2.cache;
760
- const ctx = (Number(t2.input) || 0) + (cache?.read ?? 0);
758
+ if (!t2 || !(Number(t2.output) > 0)) continue;
759
+ const ctx = (Number(t2.input) || 0) + (Number(t2.output) || 0) + (Number(t2.reasoning) || 0) + (Number(t2.cache?.read) || 0) + (Number(t2.cache?.write) || 0);
761
760
  if (ctx > 0) return ctx;
762
761
  }
763
762
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-subagent-magazine",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "OpenCode TUI plugin monitoring sub-agent invocation status in real time",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",
package/src/_version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // auto-generated
2
- export const PLUGIN_VERSION="1.5.1";
2
+ export const PLUGIN_VERSION="1.5.2";
package/src/index.tsx CHANGED
@@ -428,8 +428,9 @@ function SubAgentPanel(props: {
428
428
  let boxEl: any
429
429
  let disposed = false
430
430
 
431
- /** Total context tokens for a sub-agent session.
432
- * Matches opencode-visual-cache's "总计": last assistant message's input + cache.read. */
431
+ /** Total usage tokens for a sub-agent session.
432
+ * Matches opencode's bottom status bar usage: last assistant message with
433
+ * output > 0, summing input + output + reasoning + cache read/write. */
433
434
  const readSessionTokens = (sid: string): number | undefined => {
434
435
  if (!sid) return undefined
435
436
  try {
@@ -439,9 +440,13 @@ function SubAgentPanel(props: {
439
440
  const m = (msgs as any[])[i]
440
441
  if (m.role !== "assistant") continue
441
442
  const t = m.tokens
442
- if (!t) continue
443
- const cache = t.cache as { read?: number; write?: number } | undefined
444
- const ctx = (Number(t.input) || 0) + (cache?.read ?? 0)
443
+ if (!t || !(Number(t.output) > 0)) continue
444
+ const ctx =
445
+ (Number(t.input) || 0) +
446
+ (Number(t.output) || 0) +
447
+ (Number(t.reasoning) || 0) +
448
+ (Number(t.cache?.read) || 0) +
449
+ (Number(t.cache?.write) || 0)
445
450
  if (ctx > 0) return ctx
446
451
  }
447
452
  }