claude-code-watch 0.0.18 → 0.0.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-watch",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "Web-based real-time monitor for Claude Code.",
5
5
  "main": "./src/server/server.js",
6
6
  "bin": {
package/public/index.html CHANGED
@@ -657,6 +657,8 @@ function handleItemBatch(items) {
657
657
  if (s) { s.title = item.content.slice(0, 30); }
658
658
  continue;
659
659
  }
660
+ const s = sessionsMap.get(item.sessionID);
661
+ if (s) s.lastActivity = Date.now();
660
662
  pushItem(item);
661
663
  }
662
664
  scheduleRender();
@@ -50,11 +50,19 @@ class DashboardServer {
50
50
  return sessionID + ':' + (agentID || '');
51
51
  }
52
52
 
53
+ itemTime(item) {
54
+ if (item.timestamp) {
55
+ const ts = item.timestamp instanceof Date ? item.timestamp : new Date(item.timestamp);
56
+ if (!isNaN(ts.getTime())) return ts.getTime();
57
+ }
58
+ return Date.now();
59
+ }
60
+
53
61
  updateContext(item) {
54
62
  const key = this.getCtxKey(item.sessionID, item.agentID);
55
63
  let ctx = this.contextMap.get(key);
56
64
  if (!ctx) {
57
- ctx = { inputTokens: 0, outputTokens: 0, cacheCreation: 0, cacheRead: 0, model: '', contextWindow: 200000, lastActivity: Date.now() };
65
+ ctx = { inputTokens: 0, outputTokens: 0, cacheCreation: 0, cacheRead: 0, model: '', contextWindow: 200000, lastActivity: this.itemTime(item) };
58
66
  this.contextMap.set(key, ctx);
59
67
  }
60
68
  // inputTokens: Claude API returns cumulative total per call, not incremental — use Math.max
@@ -67,7 +75,7 @@ class DashboardServer {
67
75
  ctx.model = item.model;
68
76
  ctx.contextWindow = contextWindowFor(item.model);
69
77
  }
70
- ctx.lastActivity = Date.now();
78
+ ctx.lastActivity = Math.max(ctx.lastActivity || 0, this.itemTime(item));
71
79
  }
72
80
 
73
81
  cleanupContextMap() {