ffb5b99114
* plugins: include resolved workspaceDir in provider hook cache keys resolveProviderPluginsForHooks, resolveProviderPluginsForCatalogHooks, and resolveProviderRuntimePlugin used the raw params.workspaceDir for cache keys and plugin-id discovery while resolvePluginProviders already fell back to the active registry workspace. Resolve workspaceDir once at the top of each function so cache keys, candidate filtering, and loading all use the same workspace root. * fix(plugins): inherit runtime workspace for snapshot loads * test(gateway): stub runtime registry seam * fix(plugins): restore workspace fallback after rebase --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import type { PluginRegistry } from "./registry.js";
|
|
|
|
export const PLUGIN_REGISTRY_STATE = Symbol.for("openclaw.pluginRegistryState");
|
|
|
|
export type RegistrySurfaceState = {
|
|
registry: PluginRegistry | null;
|
|
pinned: boolean;
|
|
version: number;
|
|
};
|
|
|
|
export type RegistryState = {
|
|
activeRegistry: PluginRegistry | null;
|
|
activeVersion: number;
|
|
httpRoute: RegistrySurfaceState;
|
|
channel: RegistrySurfaceState;
|
|
key: string | null;
|
|
runtimeSubagentMode: "default" | "explicit" | "gateway-bindable";
|
|
importedPluginIds: Set<string>;
|
|
};
|
|
|
|
type GlobalRegistryState = typeof globalThis & {
|
|
[PLUGIN_REGISTRY_STATE]?: RegistryState;
|
|
};
|
|
|
|
export function getPluginRegistryState(): RegistryState | undefined {
|
|
return (globalThis as GlobalRegistryState)[PLUGIN_REGISTRY_STATE];
|
|
}
|
|
|
|
export function getActivePluginChannelRegistryFromState(): PluginRegistry | null {
|
|
const state = getPluginRegistryState();
|
|
return state?.channel.registry ?? state?.activeRegistry ?? null;
|
|
}
|
|
|
|
export function getActivePluginRegistryWorkspaceDirFromState(): string | undefined {
|
|
const state = getPluginRegistryState();
|
|
return state?.workspaceDir ?? undefined;
|
|
}
|