pi-crew 0.2.14 → 0.2.15
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
package/src/ui/crew-widget.ts
CHANGED
|
@@ -156,9 +156,15 @@ function agentStats(agent: CrewAgentRecord, liveHandle?: LiveAgentHandle): strin
|
|
|
156
156
|
const rawCompleted = act.completedAtMs || 0;
|
|
157
157
|
const nowMs = Date.now();
|
|
158
158
|
const nowSec = Math.floor(nowMs / 1000);
|
|
159
|
-
// Detect if value is in seconds
|
|
160
|
-
// If value
|
|
161
|
-
const isSeconds = (v: number) =>
|
|
159
|
+
// Detect if value is in seconds vs milliseconds by comparing distance to current time
|
|
160
|
+
// If value is closer to nowSec (within ±2 years) AND not close to nowMs, treat as seconds
|
|
161
|
+
const isSeconds = (v: number) => {
|
|
162
|
+
if (v <= 0) return false;
|
|
163
|
+
const distToSec = Math.abs(v - nowSec);
|
|
164
|
+
const distToMs = Math.abs(v - nowMs);
|
|
165
|
+
// If distance to seconds is much smaller AND value is in valid seconds range
|
|
166
|
+
return distToSec < distToMs && distToSec < 31536000 * 2 && v > 1000000000;
|
|
167
|
+
};
|
|
162
168
|
const startedMs = isSeconds(rawStarted) ? rawStarted * 1000 : rawStarted;
|
|
163
169
|
const completedMs = isSeconds(rawCompleted) ? rawCompleted * 1000 : rawCompleted;
|
|
164
170
|
// Validate: startedAtMs should be within reasonable bounds
|
|
@@ -67,8 +67,14 @@ export class LiveConversationOverlay {
|
|
|
67
67
|
const rawStarted = act.startedAtMs || 0;
|
|
68
68
|
const rawCompleted = act.completedAtMs || 0;
|
|
69
69
|
const nowMs = Date.now();
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
const nowSec = Math.floor(nowMs / 1000);
|
|
71
|
+
// Detect if value is in seconds vs milliseconds by comparing distance to current time
|
|
72
|
+
const isSeconds = (v: number) => {
|
|
73
|
+
if (v <= 0) return false;
|
|
74
|
+
const distToSec = Math.abs(v - nowSec);
|
|
75
|
+
const distToMs = Math.abs(v - nowMs);
|
|
76
|
+
return distToSec < distToMs && distToSec < 31536000 * 2 && v > 1000000000;
|
|
77
|
+
};
|
|
72
78
|
const startedMs = isSeconds(rawStarted) ? rawStarted * 1000 : rawStarted;
|
|
73
79
|
const completedMs = isSeconds(rawCompleted) ? rawCompleted * 1000 : rawCompleted;
|
|
74
80
|
const isValidStarted = startedMs > 0 && startedMs < nowMs + 60000 && startedMs > nowMs - 3155692600000;
|