























@@ -1,16 +1,5 @@
1-import { describe, expect, it, vi } from "vitest";
1+import { describe, expect, it } from "vitest";
22import type { OpenClawConfig } from "../config/config.js";
3-4-const resolveDefaultAgentId = vi.hoisted(() => vi.fn(() => "main"));
5-const resolveAgentWorkspaceDir = vi.hoisted(() =>
6-vi.fn((_cfg: OpenClawConfig, agentId: string) => `/workspace/${agentId}`),
7-);
8-9-vi.mock("../agents/agent-scope.js", () => ({
10- resolveDefaultAgentId,
11- resolveAgentWorkspaceDir,
12-}));
13-143import {
154formatMemoryDreamingDay,
165isSameMemoryDreamingDay,
@@ -164,19 +153,13 @@ describe("memory dreaming host helpers", () => {
164153});
165154166155it("dedupes shared workspaces across all configured agents", () => {
167-resolveAgentWorkspaceDir.mockImplementation((_cfg: OpenClawConfig, agentId: string) => {
168-if (agentId === "alpha") {
169-return "/workspace/shared";
170-}
171-if (agentId === "gamma") {
172-return "/workspace/shared";
173-}
174-return `/workspace/${agentId}`;
175-});
176-177156const cfg = {
178157agents: {
179-list: [{ id: "alpha" }, { id: "beta" }, { id: "gamma" }],
158+list: [
159+{ id: "alpha", workspace: "/workspace/shared" },
160+{ id: "beta", workspace: "/workspace/beta" },
161+{ id: "gamma", workspace: "/workspace/shared" },
162+],
180163},
181164} as OpenClawConfig;
182165@@ -193,13 +176,18 @@ describe("memory dreaming host helpers", () => {
193176});
194177195178it("uses default agent fallback and timezone-aware day helpers", () => {
196-resolveDefaultAgentId.mockReturnValue("fallback");
197-const cfg = {} as OpenClawConfig;
179+const cfg = {
180+agents: {
181+defaults: {
182+workspace: "/workspace",
183+},
184+},
185+} as OpenClawConfig;
198186199187expect(resolveMemoryDreamingWorkspaces(cfg)).toEqual([
200188{
201-workspaceDir: "/workspace/fallback",
202-agentIds: ["fallback"],
189+workspaceDir: "/workspace",
190+agentIds: ["main"],
203191},
204192]);
205193此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。