getaimeter 0.6.1 → 0.6.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.
- package/package.json +1 -1
- package/watcher.js +17 -8
package/package.json
CHANGED
package/watcher.js
CHANGED
|
@@ -646,17 +646,26 @@ function startWatching() {
|
|
|
646
646
|
const cursorDbs = findCursorDbs(watchPaths);
|
|
647
647
|
if (cursorDbs.length > 0) {
|
|
648
648
|
log('Cursor databases found:', cursorDbs.join(', '));
|
|
649
|
-
//
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
649
|
+
// Always pre-populate _cursorSeenKeys on startup so we don't re-report
|
|
650
|
+
// historical conversations. On first run, also set the mtime offset.
|
|
651
|
+
for (const dbPath of cursorDbs) {
|
|
652
|
+
try {
|
|
653
|
+
if (isFirstRun) {
|
|
653
654
|
const mtime = fs.statSync(dbPath).mtimeMs;
|
|
654
655
|
setOffset(dbPath + ':mtime', mtime);
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
656
|
+
}
|
|
657
|
+
// Dry-run extraction to populate _cursorSeenKeys (discard results)
|
|
658
|
+
const existing = extractCursorUsage(dbPath);
|
|
659
|
+
if (isFirstRun && existing.length > 0) {
|
|
660
|
+
log(`Cursor: marked ${existing.length} existing conversations as read`);
|
|
661
|
+
} else if (existing.length > 0) {
|
|
662
|
+
// Not first run but has new data since last mtime — report it
|
|
663
|
+
reportEvents(existing);
|
|
664
|
+
log(`Cursor: catch-up reported ${existing.length} events`);
|
|
665
|
+
}
|
|
666
|
+
} catch (err) {
|
|
667
|
+
logError('Cursor startup scan:', err.message);
|
|
658
668
|
}
|
|
659
|
-
log('Cursor: marked existing conversations as read');
|
|
660
669
|
}
|
|
661
670
|
}
|
|
662
671
|
|