Files
Moltbot/src/agents/bootstrap-cache.ts
Peter Steinberger 40db3fef49 fix(agents): cache bootstrap snapshots per session key
Co-authored-by: Isis Anisoptera <github@lotuswind.net>
2026-02-23 19:19:45 +00:00

26 lines
687 B
TypeScript

import { loadWorkspaceBootstrapFiles, type WorkspaceBootstrapFile } from "./workspace.js";
const cache = new Map<string, WorkspaceBootstrapFile[]>();
export async function getOrLoadBootstrapFiles(params: {
workspaceDir: string;
sessionKey: string;
}): Promise<WorkspaceBootstrapFile[]> {
const existing = cache.get(params.sessionKey);
if (existing) {
return existing;
}
const files = await loadWorkspaceBootstrapFiles(params.workspaceDir);
cache.set(params.sessionKey, files);
return files;
}
export function clearBootstrapSnapshot(sessionKey: string): void {
cache.delete(sessionKey);
}
export function clearAllBootstrapSnapshots(): void {
cache.clear();
}