






















@@ -60,6 +60,7 @@ function expectMemoryRuntimeLoaded(rawConfig: unknown, autoEnabledConfig: unknow
6060expect.objectContaining({
6161config: autoEnabledConfig,
6262activationSourceConfig: rawConfig,
63+onlyPluginIds: ["memory-core"],
6364}),
6465);
6566}
@@ -159,6 +160,63 @@ describe("memory runtime auto-enable loading", () => {
159160await expectAutoEnabledMemoryRuntimeCase({ run, expectedResult });
160161});
161162163+it("loads only the configured memory slot plugin", async () => {
164+const rawConfig = {
165+plugins: {
166+slots: {
167+memory: "memory-lancedb",
168+},
169+},
170+};
171+const runtime = createMemoryRuntimeFixture();
172+applyPluginAutoEnableMock.mockReturnValue({
173+config: rawConfig,
174+changes: [],
175+autoEnabledReasons: {},
176+});
177+getMemoryRuntimeMock.mockReturnValueOnce(undefined).mockReturnValue(runtime);
178+179+await getActiveMemorySearchManager({
180+cfg: rawConfig as never,
181+agentId: "main",
182+});
183+184+expect(resolveRuntimePluginRegistryMock).toHaveBeenCalledWith(
185+expect.objectContaining({
186+onlyPluginIds: ["memory-lancedb"],
187+}),
188+);
189+});
190+191+it("does not fall back to broad plugin loading when the memory slot is disabled", async () => {
192+const rawConfig = {
193+plugins: {
194+slots: {
195+memory: "none",
196+},
197+},
198+};
199+applyPluginAutoEnableMock.mockReturnValue({
200+config: rawConfig,
201+changes: [],
202+autoEnabledReasons: {},
203+});
204+getMemoryRuntimeMock.mockReturnValue(undefined);
205+206+await expect(
207+getActiveMemorySearchManager({
208+cfg: rawConfig as never,
209+agentId: "main",
210+}),
211+).resolves.toEqual({ manager: null, error: "memory plugin unavailable" });
212+213+expect(applyPluginAutoEnableMock).toHaveBeenCalledWith({
214+config: rawConfig,
215+env: process.env,
216+});
217+expect(resolveRuntimePluginRegistryMock).not.toHaveBeenCalled();
218+});
219+162220it.each([
163221{
164222name: "does not bootstrap the memory runtime just to close managers",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。