feat: load channel plugins

This commit is contained in:
Peter Steinberger
2026-01-15 02:42:41 +00:00
parent b1e3d79eaa
commit 2b4a68e276
49 changed files with 494 additions and 159 deletions

View File

@@ -6,6 +6,7 @@ import { createSubsystemLogger } from "../logging.js";
import { resolveUserPath } from "../utils.js";
import { discoverClawdbotPlugins } from "./discovery.js";
import { createPluginRegistry, type PluginRecord, type PluginRegistry } from "./registry.js";
import { setActivePluginRegistry } from "./runtime.js";
import type {
ClawdbotPluginConfigSchema,
ClawdbotPluginDefinition,
@@ -188,6 +189,7 @@ function createPluginRecord(params: {
enabled: params.enabled,
status: params.enabled ? "loaded" : "disabled",
toolNames: [],
channelIds: [],
gatewayMethods: [],
cliCommands: [],
services: [],
@@ -211,7 +213,10 @@ export function loadClawdbotPlugins(options: PluginLoadOptions = {}): PluginRegi
const cacheEnabled = options.cache !== false;
if (cacheEnabled) {
const cached = registryCache.get(cacheKey);
if (cached) return cached;
if (cached) {
setActivePluginRegistry(cached, cacheKey);
return cached;
}
}
const { registry, createApi } = createPluginRegistry({
@@ -359,5 +364,6 @@ export function loadClawdbotPlugins(options: PluginLoadOptions = {}): PluginRegi
if (cacheEnabled) {
registryCache.set(cacheKey, registry);
}
setActivePluginRegistry(registry, cacheKey);
return registry;
}