import { readFileSync } from "node:fs"; import { dirname, resolve } from "node:path"; import { fileURLToPath } from "node:url"; import { describe, expect, it } from "vitest"; describe("memory provider config router wiring", () => { const routerSource = readFileSync( resolve(dirname(fileURLToPath(import.meta.url)), "router.ts"), "utf8", ); it("routes providerConfig through owner-gated getMemoryProviderConfig", () => { expect(routerSource).toContain("getMemoryProviderConfig(deps, context.actor)"); expect(routerSource).not.toMatch(/providerConfig:[\s\S]{0,240}findSpaceMemoryConfig/); }); it("passes actor space and user when resolving memory after thread clear", () => { expect(routerSource).not.toMatch(/memoryProviders\.resolve\(context\.actor\.spaceId\)/); expect(routerSource).toMatch( /memoryProviders[\s\S]{0,120}\.resolve\(\{[\s\S]{0,120}spaceId: context\.actor\.spaceId[\s\S]{0,120}userId: context\.actor\.userId/, ); }); });