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 +1 -1
- package/public/index.html +2 -0
- package/src/server/server.js +10 -2
package/package.json
CHANGED
package/public/index.html
CHANGED
package/src/server/server.js
CHANGED
|
@@ -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:
|
|
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 =
|
|
78
|
+
ctx.lastActivity = Math.max(ctx.lastActivity || 0, this.itemTime(item));
|
|
71
79
|
}
|
|
72
80
|
|
|
73
81
|
cleanupContextMap() {
|