feat(wave2): add @mosaic/openclaw-context plugin to monorepo

- OpenClaw → OpenBrain context engine plugin migrated from mosaic/openclaw-openbrain-context
- Depends on @mosaic/types workspace:*
- Typecheck passing
This commit is contained in:
2026-03-06 18:33:09 -06:00
parent 2828a83b66
commit d583dd39c8
15 changed files with 2554 additions and 14 deletions

View File

@@ -0,0 +1,30 @@
import { describe, expect, it, vi } from "vitest";
import { OPENBRAIN_CONTEXT_ENGINE_ID, register } from "../src/index.js";
describe("plugin register()", () => {
it("registers the openbrain context engine factory", async () => {
const registerContextEngine = vi.fn();
register({
registerContextEngine,
pluginConfig: {
baseUrl: "https://brain.example.com",
apiKey: "secret",
},
logger: {
debug: vi.fn(),
info: vi.fn(),
warn: vi.fn(),
error: vi.fn(),
},
});
expect(registerContextEngine).toHaveBeenCalledTimes(1);
const [id, factory] = registerContextEngine.mock.calls[0] as [string, () => Promise<unknown> | unknown];
expect(id).toBe(OPENBRAIN_CONTEXT_ENGINE_ID);
const engine = await factory();
expect(engine).toHaveProperty("info.id", OPENBRAIN_CONTEXT_ENGINE_ID);
});
});