atris 3.57.2 → 3.57.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.
- package/commands/integrations.js +11 -2
- package/package.json +1 -1
package/commands/integrations.js
CHANGED
|
@@ -443,8 +443,16 @@ async function gmailTriage(options = {}) {
|
|
|
443
443
|
const accountId = resolveGmailAccountId(options.accountId);
|
|
444
444
|
const limit = Number.isInteger(options.limit) && options.limit > 0 ? options.limit : 25;
|
|
445
445
|
const messages = await gmailInbox({ accountId, limit, quiet: true });
|
|
446
|
+
// The hourly pass rereads the newest window, so without this filter a message
|
|
447
|
+
// gets one row per hour it lingers and counts measure dwell time, not preference.
|
|
448
|
+
const seen = new Set(
|
|
449
|
+
readGmailVerdicts({ root: options.root, filePath: options.filePath, account: accountId, limit: null })
|
|
450
|
+
.map((row) => row.message_id),
|
|
451
|
+
);
|
|
452
|
+
const fresh = messages.filter((message) => !seen.has(String(message.id || message.message_id || '')));
|
|
453
|
+
const skipped = messages.length - fresh.length;
|
|
446
454
|
const ts = new Date().toISOString();
|
|
447
|
-
const rows =
|
|
455
|
+
const rows = fresh.map((message) => {
|
|
448
456
|
const { verdict, reason } = gmailTriageVerdict(message, { details: true });
|
|
449
457
|
return {
|
|
450
458
|
ts,
|
|
@@ -460,7 +468,8 @@ async function gmailTriage(options = {}) {
|
|
|
460
468
|
|
|
461
469
|
const keepCount = rows.filter((row) => row.verdict === 'keep').length;
|
|
462
470
|
const archiveCount = rows.length - keepCount;
|
|
463
|
-
|
|
471
|
+
const skippedNote = skipped > 0 ? ` (${skipped} already judged)` : '';
|
|
472
|
+
console.log(`gmail triage recorded ${keepCount} keep and ${archiveCount} archive verdict${rows.length === 1 ? '' : 's'}${skippedNote}.`);
|
|
464
473
|
return rows;
|
|
465
474
|
}
|
|
466
475
|
|