mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-25 07:31:18 +00:00
* feat(plugin-sdk): support removing pairing requests * refactor(reef): centralize peer trust in SQLite * chore: defer Reef release note * fix(reef): share runtime state across module instances * refactor(reef): narrow trust store boundary * test(reef): pass config to account description
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import type { PluginRuntime } from "openclaw/plugin-sdk/core";
|
|
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
import { importFreshModule } from "openclaw/plugin-sdk/test-fixtures";
|
|
import { afterEach, describe, expect, it } from "vitest";
|
|
|
|
const reefRuntimeSlot = createPluginRuntimeStore<PluginRuntime>({
|
|
pluginId: "reef",
|
|
errorMessage: "test",
|
|
});
|
|
const activeReefSlot = createPluginRuntimeStore<unknown>({
|
|
key: "plugin-runtime:reef:active",
|
|
errorMessage: "test",
|
|
});
|
|
|
|
afterEach(() => {
|
|
reefRuntimeSlot.clearRuntime();
|
|
activeReefSlot.clearRuntime();
|
|
});
|
|
|
|
describe("Reef runtime state", () => {
|
|
it("shares the core runtime and active channel across duplicate module instances", async () => {
|
|
const first = await importFreshModule<typeof import("./runtime.js")>(
|
|
import.meta.url,
|
|
"./runtime.js?reef-runtime-first",
|
|
);
|
|
const second = await importFreshModule<typeof import("./runtime.js")>(
|
|
import.meta.url,
|
|
"./runtime.js?reef-runtime-second",
|
|
);
|
|
const runtime = { state: {} } as PluginRuntime;
|
|
const active = { flow: {}, friends: {}, reviews: {} } as never;
|
|
|
|
first.setReefRuntime(runtime);
|
|
first.setActiveReef(active);
|
|
|
|
expect(second.getReefRuntime()).toBe(runtime);
|
|
expect(second.getActiveReef()).toBe(active);
|
|
});
|
|
});
|