Files
openclaw/src/plugins/runtime-state.ts
T
Peter Steinberger ccee629359 refactor(plugins): delete registry compat scaffolding (#117749)
* 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
2026-08-01 21:18:47 -07:00

30 lines
1.1 KiB
TypeScript

import { PLUGIN_REGISTRY_STATE } from "./runtime-state-key.js";
// Stores plugin runtime registry state for the current process lifecycle.
import { getActivePluginRegistryWorkspaceDirFromState as getWorkspaceDirFromState } from "./runtime-workspace-state.js";
export { PLUGIN_REGISTRY_STATE };
type PluginRegistry = import("./registry-types.js").PluginRegistry;
export type RegistryState = {
activeRegistry: PluginRegistry | null;
activeVersion: number;
agentEventBridgeUnsubscribe?: (() => void) | undefined;
key: string | null;
workspaceDir: string | null;
runtimeSubagentMode: "default" | "explicit" | "gateway-bindable";
importedPluginIds: Set<string>;
registrationContext?: { registry: PluginRegistry; pluginId: string };
};
type GlobalRegistryState = typeof globalThis & {
[PLUGIN_REGISTRY_STATE]?: RegistryState;
};
export function getPluginRegistryState(): RegistryState | undefined {
return (globalThis as GlobalRegistryState)[PLUGIN_REGISTRY_STATE];
}
export function getActivePluginRegistryWorkspaceDirFromState(): string | undefined {
return getWorkspaceDirFromState();
}