Files
openclaw/src/agents/fallback-skip-cache.test-support.ts
Peter Steinberger 580938097f refactor(agents): privatize internal helper surfaces (#108219)
* refactor(agents): privatize internal helper surfaces

* chore(deadcode): shrink unused-export baseline
2026-07-15 02:47:05 -07:00

26 lines
866 B
TypeScript

type FallbackSkipCacheState = {
buckets: Map<string, Map<string, unknown>>;
lastGlobalPruneAtMs: number;
};
function getFallbackSkipCacheGlobals() {
return globalThis as typeof globalThis & {
openclawFallbackSkipCache?: Map<string, Map<string, unknown>>;
openclawFallbackSkipCacheState?: FallbackSkipCacheState;
};
}
export function resetFallbackSkipCacheForTest(): void {
const globals = getFallbackSkipCacheGlobals();
globals.openclawFallbackSkipCache?.clear();
globals.openclawFallbackSkipCacheState?.buckets.clear();
if (globals.openclawFallbackSkipCacheState) {
globals.openclawFallbackSkipCacheState.lastGlobalPruneAtMs = 0;
}
}
export function listFallbackSkipCacheSessionIdsForTest(): string[] {
const globals = getFallbackSkipCacheGlobals();
return [...(globals.openclawFallbackSkipCacheState?.buckets.keys() ?? [])];
}