mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-14 22:54:01 -06:00
ccee629359
* refactor(plugins): delete registry compat scaffolding * test(plugins): update CLI registry handle mock * fix(plugins): preserve explicitly initialized hook registries * test(plugins): update registry ownership fixtures * fix(channels): restore registry snapshot memo
33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
import { PluginLoaderCacheState } from "./loader-cache-state.js";
|
|
import { resolvePluginLoadCacheContext } from "./loader-load-context.js";
|
|
import type { PluginLoadOptions } from "./loader-types.js";
|
|
import { clearPluginRuntimeArtifactResolutionMemo } from "./plugin-runtime-artifact-resolution.js";
|
|
import type { PluginRegistry } from "./registry-types.js";
|
|
|
|
const MAX_PLUGIN_REGISTRY_CACHE_ENTRIES = 128;
|
|
|
|
export const pluginLoaderCacheState = new PluginLoaderCacheState<PluginRegistry>(
|
|
MAX_PLUGIN_REGISTRY_CACHE_ENTRIES,
|
|
);
|
|
|
|
export function setCachedPluginRegistry(cacheKey: string, registry: PluginRegistry): void {
|
|
pluginLoaderCacheState.set(cacheKey, registry);
|
|
}
|
|
|
|
export function getReusableCachedPluginRegistry(cacheKey: string): PluginRegistry | undefined {
|
|
return pluginLoaderCacheState.get(cacheKey);
|
|
}
|
|
|
|
export function clearPluginRegistryLoadCache(): void {
|
|
clearPluginRuntimeArtifactResolutionMemo();
|
|
pluginLoaderCacheState.clearCachedRegistries();
|
|
}
|
|
|
|
export function resolvePluginRegistryLoadCacheKey(options: PluginLoadOptions = {}): string {
|
|
return resolvePluginLoadCacheContext(options).cacheKey;
|
|
}
|
|
|
|
export function isPluginRegistryLoadInFlight(options: PluginLoadOptions = {}): boolean {
|
|
return pluginLoaderCacheState.isLoadInFlight(resolvePluginRegistryLoadCacheKey(options));
|
|
}
|