import { executeMemoryCommand } from "../../tools/memory.js";
import { buildSuiteResult, ok, runTest } from "../suite-utils.js";
export const memorySuite = {
    id: "memory",
    name: "Memory",
    run: async (context) => {
        const started = Date.now();
        const memoryPath = `/memories/e2e-${context.runId}.txt`;
        const marker = `VisionClaw E2E ${context.runId}`;
        const tests = [
            await runTest("memory", "memory.create", "Create memory file", () => {
                const result = executeMemoryCommand({ command: "create", path: memoryPath, file_text: marker });
                if (result.isError)
                    throw new Error(result.content[0]?.type === "text" ? result.content[0].text : "create failed");
                return Promise.resolve(ok("Memory file created"));
            }),
            await runTest("memory", "memory.view", "View memory file", () => {
                const result = executeMemoryCommand({ command: "view", path: memoryPath });
                const text = result.content[0]?.type === "text" ? result.content[0].text : "";
                if (!text.includes(marker))
                    throw new Error("Memory view mismatch");
                return Promise.resolve(ok("Memory view succeeded"));
            }),
            await runTest("memory", "memory.str_replace", "Replace memory content", () => {
                const updated = `${marker} updated`;
                const result = executeMemoryCommand({
                    command: "str_replace",
                    path: memoryPath,
                    old_str: marker,
                    new_str: updated,
                });
                if (result.isError)
                    throw new Error("str_replace failed");
                const view = executeMemoryCommand({ command: "view", path: memoryPath });
                const text = view.content[0]?.type === "text" ? view.content[0].text : "";
                if (!text.includes("updated"))
                    throw new Error("Updated content not found");
                return Promise.resolve(ok("Memory replace succeeded"));
            }),
            await runTest("memory", "memory.delete", "Delete memory file", () => {
                const result = executeMemoryCommand({ command: "delete", path: memoryPath });
                if (result.isError)
                    throw new Error("delete failed");
                return Promise.resolve(ok("Memory delete succeeded"));
            }),
        ];
        return buildSuiteResult("memory", "Memory", started, tests);
    },
};
//# sourceMappingURL=memory.js.map