mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-23 22:55:24 +00:00
refactor(plugins): reuse createEmptyPluginRegistry
This commit is contained in:
@@ -1,20 +1,4 @@
|
||||
import type { PluginRegistry } from "./registry.js";
|
||||
|
||||
const createEmptyRegistry = (): PluginRegistry => ({
|
||||
plugins: [],
|
||||
tools: [],
|
||||
hooks: [],
|
||||
typedHooks: [],
|
||||
channels: [],
|
||||
providers: [],
|
||||
gatewayHandlers: {},
|
||||
httpHandlers: [],
|
||||
httpRoutes: [],
|
||||
cliRegistrars: [],
|
||||
services: [],
|
||||
commands: [],
|
||||
diagnostics: [],
|
||||
});
|
||||
import { createEmptyPluginRegistry, type PluginRegistry } from "./registry.js";
|
||||
|
||||
const REGISTRY_STATE = Symbol.for("openclaw.pluginRegistryState");
|
||||
|
||||
@@ -29,7 +13,7 @@ const state: RegistryState = (() => {
|
||||
};
|
||||
if (!globalState[REGISTRY_STATE]) {
|
||||
globalState[REGISTRY_STATE] = {
|
||||
registry: createEmptyRegistry(),
|
||||
registry: createEmptyPluginRegistry(),
|
||||
key: null,
|
||||
};
|
||||
}
|
||||
@@ -47,7 +31,7 @@ export function getActivePluginRegistry(): PluginRegistry | null {
|
||||
|
||||
export function requireActivePluginRegistry(): PluginRegistry {
|
||||
if (!state.registry) {
|
||||
state.registry = createEmptyRegistry();
|
||||
state.registry = createEmptyPluginRegistry();
|
||||
}
|
||||
return state.registry;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user