




























@@ -215,8 +215,9 @@ describe("memory cli", () => {
215215216216it("prints vector status when available", async () => {
217217const close = vi.fn(async () => {});
218+const probeVectorAvailability = vi.fn(async () => true);
218219mockManager({
219-probeVectorAvailability: vi.fn(async () => true),
220+ probeVectorAvailability,
220221status: () =>
221222makeMemoryStatus({
222223files: 2,
@@ -236,6 +237,7 @@ describe("memory cli", () => {
236237const log = spyRuntimeLogs(defaultRuntime);
237238await runMemoryCli(["status"]);
238239240+expect(probeVectorAvailability).not.toHaveBeenCalled();
239241expect(log).toHaveBeenCalledWith(expect.stringContaining("Vector: ready"));
240242expect(log).toHaveBeenCalledWith(expect.stringContaining("Vector dims: 1024"));
241243expect(log).toHaveBeenCalledWith(expect.stringContaining("Vector path: /opt/sqlite-vec.dylib"));
@@ -246,6 +248,36 @@ describe("memory cli", () => {
246248expect(close).toHaveBeenCalled();
247249});
248250251+it("keeps plain status from probing vector or embeddings", async () => {
252+const close = vi.fn(async () => {});
253+const probeVectorAvailability = vi.fn(async () => {
254+throw new Error("unexpected vector probe");
255+});
256+const probeEmbeddingAvailability = vi.fn(async () => {
257+throw new Error("unexpected embedding probe");
258+});
259+mockManager({
260+ probeVectorAvailability,
261+ probeEmbeddingAvailability,
262+status: () =>
263+makeMemoryStatus({
264+provider: "auto",
265+requestedProvider: "auto",
266+vector: { enabled: true },
267+}),
268+ close,
269+});
270+271+const log = spyRuntimeLogs(defaultRuntime);
272+await runMemoryCli(["status"]);
273+274+expect(probeVectorAvailability).not.toHaveBeenCalled();
275+expect(probeEmbeddingAvailability).not.toHaveBeenCalled();
276+expect(log).toHaveBeenCalledWith(expect.stringContaining("Provider: auto"));
277+expect(log).toHaveBeenCalledWith(expect.stringContaining("Vector: unknown"));
278+expect(close).toHaveBeenCalled();
279+});
280+249281it("resolves configured memory SecretRefs through gateway snapshot", async () => {
250282getRuntimeConfig.mockReturnValue({
251283agents: {
@@ -335,9 +367,10 @@ describe("memory cli", () => {
335367336368it("prints embeddings status when deep", async () => {
337369const close = vi.fn(async () => {});
370+const probeVectorAvailability = vi.fn(async () => true);
338371const probeEmbeddingAvailability = vi.fn(async () => ({ ok: true }));
339372mockManager({
340-probeVectorAvailability: vi.fn(async () => true),
373+ probeVectorAvailability,
341374 probeEmbeddingAvailability,
342375status: () => makeMemoryStatus({ files: 1, chunks: 1 }),
343376 close,
@@ -346,6 +379,7 @@ describe("memory cli", () => {
346379const log = spyRuntimeLogs(defaultRuntime);
347380await runMemoryCli(["status", "--deep"]);
348381382+expect(probeVectorAvailability).toHaveBeenCalled();
349383expect(probeEmbeddingAvailability).toHaveBeenCalled();
350384expect(log).toHaveBeenCalledWith(expect.stringContaining("Embeddings: ready"));
351385expect(close).toHaveBeenCalled();
@@ -544,9 +578,10 @@ describe("memory cli", () => {
544578it("reindexes on status --index", async () => {
545579const close = vi.fn(async () => {});
546580const sync = vi.fn(async () => {});
581+const probeVectorAvailability = vi.fn(async () => true);
547582const probeEmbeddingAvailability = vi.fn(async () => ({ ok: true }));
548583mockManager({
549-probeVectorAvailability: vi.fn(async () => true),
584+ probeVectorAvailability,
550585 probeEmbeddingAvailability,
551586 sync,
552587status: () => makeMemoryStatus({ files: 1, chunks: 1 }),
@@ -557,6 +592,7 @@ describe("memory cli", () => {
557592await runMemoryCli(["status", "--index"]);
558593559594expectCliSync(sync);
595+expect(probeVectorAvailability).toHaveBeenCalled();
560596expect(probeEmbeddingAvailability).toHaveBeenCalled();
561597expect(getMemorySearchManager).toHaveBeenCalledWith({
562598cfg: {},
@@ -723,8 +759,15 @@ describe("memory cli", () => {
723759724760it("prints status json output when requested", async () => {
725761const close = vi.fn(async () => {});
762+const probeVectorAvailability = vi.fn(async () => {
763+throw new Error("unexpected vector probe");
764+});
765+const probeEmbeddingAvailability = vi.fn(async () => {
766+throw new Error("unexpected embedding probe");
767+});
726768mockManager({
727-probeVectorAvailability: vi.fn(async () => true),
769+ probeVectorAvailability,
770+ probeEmbeddingAvailability,
728771status: () => makeMemoryStatus({ workspaceDir: undefined }),
729772 close,
730773});
@@ -739,6 +782,8 @@ describe("memory cli", () => {
739782}
740783expect(Array.isArray(payload)).toBe(true);
741784expect((payload[0] as Record<string, unknown>)?.agentId).toBe("main");
785+expect(probeVectorAvailability).not.toHaveBeenCalled();
786+expect(probeEmbeddingAvailability).not.toHaveBeenCalled();
742787expect(close).toHaveBeenCalled();
743788});
744789此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。