Give Eve agents a first-class Mem0 recall/capture provider so they can use Mem0 in the agent loop instead of MCP. Co-authored-by: Cursor <cursoragent@cursor.com>
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { captureCompletedTurn } from "../src/capture.js";
|
|
import { createFakeStore } from "./helpers.js";
|
|
|
|
describe("captureCompletedTurn", () => {
|
|
it("adds the current turn under the locked scope", async () => {
|
|
const store = createFakeStore();
|
|
const captured = await captureCompletedTurn({
|
|
store,
|
|
scopeKey: "scope_abc",
|
|
infer: true,
|
|
metadata: { source: "eve" },
|
|
turnInput: [{ role: "user", content: "I am vegetarian" }],
|
|
messages: [
|
|
{ role: "user", content: "I am vegetarian" },
|
|
{ role: "assistant", content: "Got it." },
|
|
],
|
|
});
|
|
|
|
expect(captured).toBe(true);
|
|
expect(store.added).toEqual([
|
|
{
|
|
userId: "scope_abc",
|
|
messages: [
|
|
{ role: "user", content: "I am vegetarian" },
|
|
{ role: "assistant", content: "Got it." },
|
|
],
|
|
},
|
|
]);
|
|
});
|
|
|
|
it("does not write when the turn has no user text", async () => {
|
|
const store = createFakeStore();
|
|
const captured = await captureCompletedTurn({
|
|
store,
|
|
scopeKey: "scope_abc",
|
|
infer: true,
|
|
metadata: {},
|
|
turnInput: [],
|
|
messages: [],
|
|
});
|
|
expect(captured).toBe(false);
|
|
expect(store.added).toEqual([]);
|
|
});
|
|
});
|