mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-11-07 05:12:34 +00:00
Verify torch/src/ with lint
- Restore missing source files in `torch/src/` from `torch-lock` dependency. - Setup ESLint in `torch/`. - Fix linting issues in `src/lock-ops.mjs`, `src/lock-utils.mjs`, `src/ops.mjs`, `src/services/memory/embedder.js`. - Mark 'Verify with lint' as completed in `src/todo/TODO_2026-02-14T13-30-00Z.md`. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
8cdf1c523d
commit
22bb29f16f
67 files changed
+7105
-24
No files matched your search
@@ -0,0 +1,49 @@
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { todayDateStr, getIsoWeekStr } from './utils.mjs';
|
||||
|
||||
/**
|
||||
* Scans the local log directory to identify agents that have already completed their task
|
||||
* for the current period (daily or weekly).
|
||||
*
|
||||
* @param {string} cadence - 'daily' or 'weekly'
|
||||
* @param {string} logDir - Path to the log directory (e.g., 'task-logs')
|
||||
* @param {Object} deps - Dependency injection for testing
|
||||
* @returns {Promise<Set<string>>} - Set of agent names that have completed their task
|
||||
*/
|
||||
export async function getCompletedAgents(cadence, logDir, deps) {
|
||||
const { readdir = fs.readdir, getDateStr = todayDateStr, getIsoWeek = getIsoWeekStr } = deps;
|
||||
const completed = new Set();
|
||||
const targetDir = path.join(logDir, cadence);
|
||||
|
||||
try {
|
||||
const files = await readdir(targetDir);
|
||||
const today = getDateStr();
|
||||
const currentWeek = getIsoWeek();
|
||||
|
||||
for (const file of files) {
|
||||
// Format: YYYY-MM-DDTHH-mm-ssZ__<agent>__<status>.md
|
||||
const match = file.match(/^(\d{4}-\d{2}-\d{2})T.*__([a-zA-Z0-9-_]+)__(.*)\.md$/);
|
||||
if (!match) continue;
|
||||
|
||||
const [, datePart, agent, status] = match;
|
||||
|
||||
if (status === 'completed') {
|
||||
if (cadence === 'daily' && datePart === today) {
|
||||
completed.add(agent);
|
||||
} else if (cadence === 'weekly') {
|
||||
const fileWeek = getIsoWeek(datePart); // datePart is YYYY-MM-DD
|
||||
if (fileWeek === currentWeek) {
|
||||
completed.add(agent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
if (err.code !== 'ENOENT') {
|
||||
console.error(`Warning: Failed to read log dir ${targetDir}: ${err.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
return completed;
|
||||
}
|
||||
Reference in new issue
Block a user