feat: integrate Cortex local memory into OpenClaw
This commit is contained in:
parent
f07efd4d70
commit
9343f3b15b
@ -98,3 +98,63 @@ describe("sortLocaleStrings", () => {
|
||||
expect(sortLocaleStrings(new Set(["beta", "alpha"]))).toEqual(["alpha", "beta"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("renderOverview", () => {
|
||||
it("includes Cortex status details from the gateway snapshot", async () => {
|
||||
Object.defineProperty(globalThis, "localStorage", {
|
||||
configurable: true,
|
||||
value: {
|
||||
getItem: () => null,
|
||||
setItem: () => {},
|
||||
removeItem: () => {},
|
||||
},
|
||||
});
|
||||
const { renderOverview } = await import("./overview.ts");
|
||||
const template = renderOverview({
|
||||
connected: true,
|
||||
hello: {
|
||||
snapshot: {
|
||||
cortex: {
|
||||
enabled: true,
|
||||
mode: "technical",
|
||||
graphPath: ".cortex/context.json",
|
||||
lastCaptureAtMs: Date.now() - 5_000,
|
||||
lastCaptureReason: "high-signal memory candidate",
|
||||
lastCaptureStored: true,
|
||||
lastSyncPlatforms: ["claude-code", "cursor"],
|
||||
},
|
||||
},
|
||||
} as never,
|
||||
settings: {
|
||||
gatewayUrl: "ws://127.0.0.1:18789",
|
||||
token: "",
|
||||
sessionKey: "main",
|
||||
},
|
||||
password: "",
|
||||
lastError: null,
|
||||
lastErrorCode: null,
|
||||
presenceCount: 1,
|
||||
sessionsCount: 1,
|
||||
cronEnabled: null,
|
||||
cronNext: null,
|
||||
lastChannelsRefresh: null,
|
||||
onSettingsChange: () => {},
|
||||
onPasswordChange: () => {},
|
||||
onSessionKeyChange: () => {},
|
||||
onConnect: () => {},
|
||||
onRefresh: () => {},
|
||||
onOpenCortexPreview: () => {},
|
||||
onOpenCortexConflicts: () => {},
|
||||
onOpenCortexSync: () => {},
|
||||
}) as { strings: TemplateStringsArray; values: unknown[] };
|
||||
|
||||
expect(template.strings.join("")).toContain("Cortex");
|
||||
const renderedValues = JSON.stringify(template.values);
|
||||
|
||||
expect(renderedValues).toContain("Preview in chat");
|
||||
expect(renderedValues).toContain("Conflicts in chat");
|
||||
expect(renderedValues).toContain("Sync coding");
|
||||
expect(renderedValues).toContain("technical · stored");
|
||||
expect(renderedValues).toContain("high-signal memory candidate");
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user