import { loadProfileBootstrapFiles } from "./load-bootstrap-files.js";
//#region src/agent/bootstrap/bootstrap-cache.ts
const cache = /* @__PURE__ */ new Map();
function bootstrapFilesEqual(previous, next) {
	if (previous.length !== next.length) return false;
	return previous.every((file, index) => {
		const updated = next[index];
		return updated !== void 0 && file.name === updated.name && file.path === updated.path && file.content === updated.content && file.missing === updated.missing;
	});
}
async function getOrLoadBootstrapFiles(params) {
	const existing = cache.get(params.sessionKey);
	const files = loadProfileBootstrapFiles(params.profileDir);
	if (existing && existing.profileDir === params.profileDir && bootstrapFilesEqual(existing.files, files)) return existing.files;
	cache.set(params.sessionKey, {
		profileDir: params.profileDir,
		files
	});
	return files;
}
function clearBootstrapSnapshot(sessionKey) {
	cache.delete(sessionKey);
}
function clearAllBootstrapSnapshots() {
	cache.clear();
}
//#endregion
export { clearAllBootstrapSnapshots, clearBootstrapSnapshot, getOrLoadBootstrapFiles };

//# sourceMappingURL=bootstrap-cache.js.map