refactor(boltbot): decouple EigenCloud provider, audit-only mode
This commit is contained in:
parent
1382694aaa
commit
9e6e431c59
@ -1,6 +1,5 @@
|
|||||||
import type { MoltbotPluginApi } from "clawdbot/plugin-sdk";
|
import type { MoltbotPluginApi } from "clawdbot/plugin-sdk";
|
||||||
import { emptyPluginConfigSchema } from "clawdbot/plugin-sdk";
|
import { emptyPluginConfigSchema } from "clawdbot/plugin-sdk";
|
||||||
import { eigenCloudProvider } from "./src/provider.js";
|
|
||||||
import { createActionLogger } from "./src/action-logger.js";
|
import { createActionLogger } from "./src/action-logger.js";
|
||||||
import { createReceiptStore } from "./src/receipt-store.js";
|
import { createReceiptStore } from "./src/receipt-store.js";
|
||||||
import { registerBoltbotApi } from "./src/api.js";
|
import { registerBoltbotApi } from "./src/api.js";
|
||||||
@ -8,13 +7,11 @@ import { registerDashboardRoutes } from "./src/dashboard-serve.js";
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
id: "boltbot",
|
id: "boltbot",
|
||||||
name: "Boltbot — Trustless Hosting",
|
name: "Boltbot — Audit Dashboard",
|
||||||
description: "EigenCloud verification layer for Moltbot",
|
description: "Tool-call audit trail and verification dashboard for Moltbot",
|
||||||
configSchema: emptyPluginConfigSchema(),
|
configSchema: emptyPluginConfigSchema(),
|
||||||
|
|
||||||
register(api: MoltbotPluginApi) {
|
register(api: MoltbotPluginApi) {
|
||||||
api.registerProvider(eigenCloudProvider);
|
|
||||||
|
|
||||||
const store = createReceiptStore(process.env.BOLTBOT_RECEIPT_BACKEND);
|
const store = createReceiptStore(process.env.BOLTBOT_RECEIPT_BACKEND);
|
||||||
const logger = createActionLogger(store);
|
const logger = createActionLogger(store);
|
||||||
api.on("after_tool_call", logger);
|
api.on("after_tool_call", logger);
|
||||||
|
|||||||
@ -25,7 +25,7 @@ describe("boltbot plugin integration", () => {
|
|||||||
const mod = await import("../../index.js");
|
const mod = await import("../../index.js");
|
||||||
const plugin = mod.default;
|
const plugin = mod.default;
|
||||||
expect(plugin.id).toBe("boltbot");
|
expect(plugin.id).toBe("boltbot");
|
||||||
expect(plugin.name).toBe("Boltbot — Trustless Hosting");
|
expect(plugin.name).toBe("Boltbot — Audit Dashboard");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("register wires provider, hook, and routes", async () => {
|
it("register wires provider, hook, and routes", async () => {
|
||||||
@ -46,20 +46,20 @@ describe("boltbot plugin integration", () => {
|
|||||||
|
|
||||||
plugin.register(mockApi as any);
|
plugin.register(mockApi as any);
|
||||||
|
|
||||||
// REQ-1: Provider registered
|
// No provider in audit-only mode
|
||||||
expect(registered.providers).toHaveLength(1);
|
expect(registered.providers).toHaveLength(0);
|
||||||
expect(registered.providers[0].id).toBe("eigencloud");
|
|
||||||
|
|
||||||
// REQ-3: after_tool_call hook registered
|
// after_tool_call hook registered
|
||||||
expect(registered.hooks).toHaveLength(1);
|
expect(registered.hooks).toHaveLength(1);
|
||||||
expect(registered.hooks[0].name).toBe("after_tool_call");
|
expect(registered.hooks[0].name).toBe("after_tool_call");
|
||||||
|
|
||||||
// REQ-7: 3 HTTP routes registered
|
// 4 HTTP routes: receipts, receipt, stats, dashboard
|
||||||
expect(registered.routes).toHaveLength(3);
|
expect(registered.routes).toHaveLength(4);
|
||||||
const paths = registered.routes.map((r: any) => r.path);
|
const paths = registered.routes.map((r: any) => r.path);
|
||||||
expect(paths).toContain("/boltbot/receipts");
|
expect(paths).toContain("/boltbot/receipts");
|
||||||
expect(paths).toContain("/boltbot/receipt");
|
expect(paths).toContain("/boltbot/receipt");
|
||||||
expect(paths).toContain("/boltbot/stats");
|
expect(paths).toContain("/boltbot/stats");
|
||||||
|
expect(paths).toContain("/boltbot/dashboard");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("after_tool_call hook fires and creates receipt", async () => {
|
it("after_tool_call hook fires and creates receipt", async () => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user