UNPKG

framework

Version:

The (AI) Framework: turnkey, zero-config AI orchestration that wraps a coding-agent CLI (Claude Code) as a black box and takes you from an idea to a running app. Vite for AI.

37 lines 1.68 kB
/** * The daemon's per-project error state (#1500): a background job that finds a project in a state * the user has to fix — and can only fix if told — records it here, and clears it the moment the * state is good again. The dashboard renders what is recorded; nothing else reads it. * * The first emitter is the data-branch sync (#1599): a push origin rejects, or a repo with no * origin at all, used to be a console line on the daemon's stdout and nothing else, which is the * worst way to handle a state nobody can see. * * In memory on purpose. Every emitter re-evaluates on its own cadence — the sync every minute — * so a restarted daemon re-learns each error within a tick, and there is no stale record to * outlive the condition that raised it. */ export function projectErrorStore(now = () => new Date()) { const byProject = new Map(); return { set(projectPath, code, message) { let errors = byProject.get(projectPath); if (!errors) byProject.set(projectPath, (errors = new Map())); const since = errors.get(code)?.since ?? now().toISOString(); errors.set(code, { code, message, since }); }, clear(projectPath, code) { const errors = byProject.get(projectPath); if (!errors) return; errors.delete(code); if (errors.size === 0) byProject.delete(projectPath); }, list(projectPath) { return [...(byProject.get(projectPath)?.values() ?? [])].sort((a, b) => a.since.localeCompare(b.since)); }, }; } //# sourceMappingURL=project-errors.js.map