




























@@ -108,13 +108,23 @@ afterAll(async () => {
108108describe("memory cli", () => {
109109const inactiveMemorySecretDiagnostic = "agents.defaults.memorySearch.remote.apiKey inactive"; // pragma: allowlist secret
110110111+function firstMockCallArg(mock: { mock: { calls: unknown[][] } }, label: string): unknown {
112+const call = mock.mock.calls[0];
113+if (!call) {
114+throw new Error(`expected ${label} call`);
115+}
116+return call[0];
117+}
118+111119function expectCliSync(sync: ReturnType<typeof vi.fn>) {
112-const syncCall = sync.mock.calls.at(0)?.[0] as
113-| { reason?: unknown; force?: unknown; progress?: unknown }
114-| undefined;
115-expect(syncCall?.reason).toBe("cli");
116-expect(syncCall?.force).toBe(false);
117-expect(typeof syncCall?.progress).toBe("function");
120+const syncCall = firstMockCallArg(sync, "sync") as {
121+reason?: unknown;
122+force?: unknown;
123+progress?: unknown;
124+};
125+expect(syncCall.reason).toBe("cli");
126+expect(syncCall.force).toBe(false);
127+expect(typeof syncCall.progress).toBe("function");
118128}
119129120130function makeMemoryStatus(overrides: Record<string, unknown> = {}) {
@@ -353,12 +363,13 @@ describe("memory cli", () => {
353363354364await runMemoryCli(["status"]);
355365356-const secretRefsCall = resolveCommandSecretRefsViaGateway.mock.calls.at(0)?.[0] as
357-| { config?: unknown; commandName?: unknown; targetIds?: unknown }
358-| undefined;
359-expect(secretRefsCall?.config).toBe(config);
360-expect(secretRefsCall?.commandName).toBe("memory status");
361-expect(secretRefsCall?.targetIds).toStrictEqual(
366+const secretRefsCall = firstMockCallArg(
367+resolveCommandSecretRefsViaGateway,
368+"resolve command secret refs",
369+) as { config?: unknown; commandName?: unknown; targetIds?: unknown };
370+expect(secretRefsCall.config).toBe(config);
371+expect(secretRefsCall.commandName).toBe("memory status");
372+expect(secretRefsCall.targetIds).toStrictEqual(
362373new Set([
363374"agents.defaults.memorySearch.remote.apiKey",
364375"agents.list[].memorySearch.remote.apiKey",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。