refactor: adopt chat plugin builder in zalouser

This commit is contained in:
Peter Steinberger
2026-03-22 22:17:12 +00:00
parent bdd35a6239
commit 5a8f77aa6a
2 changed files with 299 additions and 294 deletions

View File

@@ -12,7 +12,7 @@ import type { PluginRegistry } from "./registry.js";
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-plugin-binding-"));
const approvalsPath = path.join(tempRoot, "plugin-binding-approvals.json");
function createPluginRegistryStub(): PluginRegistry {
function createEmptyPluginRegistry(): PluginRegistry {
return {
plugins: [],
tools: [],
@@ -32,7 +32,7 @@ function createPluginRegistryStub(): PluginRegistry {
commands: [],
conversationBindingResolvedHandlers: [],
diagnostics: [],
};
} as unknown as PluginRegistry;
}
const sessionBindingState = vi.hoisted(() => {
const records = new Map<string, SessionBindingRecord>();
@@ -105,7 +105,7 @@ const sessionBindingState = vi.hoisted(() => {
});
const pluginRuntimeState = vi.hoisted(() => ({
registry: createPluginRegistryStub(),
registry: createEmptyPluginRegistry(),
}));
vi.mock("../infra/home-dir.js", async (importOriginal) => {