






















@@ -40,25 +40,21 @@ describe("runEmbeddedAttempt memory flush tool forwarding", () => {
4040const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-attempt-memory-flush-"));
41414242try {
43-expect(buildEmbeddedAttemptToolRunContext(createAttemptParams(workspaceDir))).toMatchObject({
44-trigger: "memory",
45-memoryFlushWritePath: MEMORY_RELATIVE_PATH,
46-});
43+const context = buildEmbeddedAttemptToolRunContext(createAttemptParams(workspaceDir));
44+expect(context.trigger).toBe("memory");
45+expect(context.memoryFlushWritePath).toBe(MEMORY_RELATIVE_PATH);
4746} finally {
4847await fs.rm(workspaceDir, { recursive: true, force: true });
4948}
5049});
51505251it("forwards cron job id into tool creation so self-removal can be scoped", () => {
53-expect(
54-buildEmbeddedAttemptToolRunContext({
55-trigger: "cron",
56-jobId: "job-current",
57-}),
58-).toMatchObject({
52+const context = buildEmbeddedAttemptToolRunContext({
5953trigger: "cron",
6054jobId: "job-current",
6155});
56+expect(context.trigger).toBe("cron");
57+expect(context.jobId).toBe("job-current");
6258});
63596460it("activates the memory flush append-only write wrapper", async () => {
@@ -85,17 +81,16 @@ describe("runEmbeddedAttempt memory flush tool forwarding", () => {
8581relativePath: MEMORY_RELATIVE_PATH,
8682});
878388-await expect(
89-wrapped.execute("call-memory-flush-append", {
90-path: MEMORY_RELATIVE_PATH,
91-content: "new durable note",
92-}),
93-).resolves.toMatchObject({
94-content: [{ type: "text", text: `Appended content to ${MEMORY_RELATIVE_PATH}.` }],
95-details: {
96-path: MEMORY_RELATIVE_PATH,
97-appendOnly: true,
98-},
84+const result = await wrapped.execute("call-memory-flush-append", {
85+path: MEMORY_RELATIVE_PATH,
86+content: "new durable note",
87+});
88+expect(result.content).toEqual([
89+{ type: "text", text: `Appended content to ${MEMORY_RELATIVE_PATH}.` },
90+]);
91+expect(result.details).toEqual({
92+path: MEMORY_RELATIVE_PATH,
93+appendOnly: true,
9994});
10095await expect(fs.readFile(memoryFile, "utf-8")).resolves.toBe("seed\nnew durable note");
10196await expect(
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。