@mtayfur/opencode-cache-view 1.0.2 → 1.0.3

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 (2) hide show
  1. package/dist/index.js +2 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -446,7 +446,7 @@ function createSpeedTracker(api) {
446
446
  if (!start || start.sessionID !== event.properties.sessionID)
447
447
  return;
448
448
  clearStream(value.messageID);
449
- const duration = start.firstTokenTime === undefined ? 0 : event.properties.time - start.firstTokenTime;
449
+ const duration = start.firstTokenTime === undefined || start.lastTokenTime === undefined ? 0 : start.lastTokenTime - start.firstTokenTime;
450
450
  const tokens = value.tokens.output + value.tokens.reasoning;
451
451
  if (value.reason === "tool-calls") {
452
452
  pendingToolTurns.add(start.sessionID);
@@ -467,6 +467,7 @@ function createSpeedTracker(api) {
467
467
  return;
468
468
  const now = Date.now();
469
469
  start.firstTokenTime ??= now;
470
+ start.lastTokenTime = now;
470
471
  const previous = streamParts.get(event.properties.partID) ?? {
471
472
  messageID: event.properties.messageID,
472
473
  units: 0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@mtayfur/opencode-cache-view",
4
- "version": "1.0.2",
4
+ "version": "1.0.3",
5
5
  "description": "Minimal OpenCode TUI sidebar for cache hit, estimated tokens, and generation speed.",
6
6
  "repository": {
7
7
  "type": "git",