mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-11-10 06:42:34 +00:00
Install and setup TORCH in torch/ directory
- Added `torch-lock` dependency to `torch/package.json` - Initialized TORCH structure using `cmdInit` (mocked interaction) - Updated `torch/package.json` with TORCH CLI scripts (`lock:check`, `lock:lock`, etc.) - Updated `torch/torch-config.json` with Nostr configuration - Added `type: module` to `torch/package.json` to support ES modules - Cleaned up extraneous directories (`test_logs`, `todo`, etc.) from initialization Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
22cdb75b2b
commit
8761455bd4
170 files changed
+31085
-13
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