mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-10-27 16:01:54 +00:00
`frontend-console-debug-agent` run: - Fixed a 403 Forbidden error in `src/dashboard.mjs` preventing `src/constants.mjs` from loading by adding it to the `allowedPaths` whitelist. - Refactored `src/lock-ops.mjs` to fix a critical syntax error in `LockPublisher` class. - Fixed a typo in `src/cmd-check.mjs` (`queryLocksFn` -> `queryLocks`). - Added `@playwright/test` for frontend debugging. - Added `scripts/agent/debug_frontend.mjs` for reproduction. Co-authored-by: PR0M3TH3AN <[email protected]>
53 lines
1.7 KiB
JavaScript
53 lines
1.7 KiB
JavaScript
import {
|
|
loadTorchConfig,
|
|
getRelays,
|
|
getNamespace,
|
|
} from './torch-config.mjs';
|
|
import { getRoster } from './roster.mjs';
|
|
import { queryLocks } from './lock-ops.mjs';
|
|
import { todayDateStr } from './utils.mjs';
|
|
|
|
export async function cmdCheck(cadence) {
|
|
const relays = await getRelays();
|
|
const namespace = await getNamespace();
|
|
const dateStr = todayDateStr();
|
|
const config = await loadTorchConfig();
|
|
const pausedAgents = (cadence === 'daily' ? config.scheduler.paused.daily : config.scheduler.paused.weekly) || [];
|
|
|
|
console.error(`Checking locks: namespace=${namespace}, cadence=${cadence}, date=${dateStr}`);
|
|
console.error(`Relays: ${relays.join(', ')}`);
|
|
if (pausedAgents.length > 0) {
|
|
console.error(`Paused agents: ${pausedAgents.join(', ')}`);
|
|
}
|
|
|
|
const locks = await queryLocks(relays, cadence, dateStr, namespace);
|
|
const lockedAgents = [...new Set(locks.map((l) => l.agent).filter(Boolean))];
|
|
const roster = await getRoster(cadence);
|
|
|
|
const excludedAgents = [...new Set([...lockedAgents, ...pausedAgents])];
|
|
const unknownLockedAgents = lockedAgents.filter((agent) => !roster.includes(agent));
|
|
const available = roster.filter((a) => !excludedAgents.includes(a));
|
|
|
|
const result = {
|
|
namespace,
|
|
cadence,
|
|
date: dateStr,
|
|
locked: lockedAgents.sort(),
|
|
paused: pausedAgents.sort(),
|
|
excluded: excludedAgents.sort(),
|
|
available: available.sort(),
|
|
lockCount: locks.length,
|
|
unknownLockedAgents: unknownLockedAgents.sort(),
|
|
locks: locks.map((l) => ({
|
|
agent: l.agent,
|
|
eventId: l.eventId,
|
|
createdAt: l.createdAtIso,
|
|
expiresAt: l.expiresAtIso,
|
|
platform: l.platform,
|
|
})),
|
|
};
|
|
|
|
console.log(JSON.stringify(result, null, 2));
|
|
return result;
|
|
}
|