

























@@ -150,32 +150,29 @@ describe("spawnSubagentDirect thread binding delivery", () => {
150150);
151151152152expect(result.status).toBe("accepted");
153-expect(hookRequester).toMatchObject({
154-channel: "matrix",
155-accountId: "bot-alpha",
156-to: `room:${boundRoom}`,
157-});
153+expect(hookRequester?.channel).toBe("matrix");
154+expect(hookRequester?.accountId).toBe("bot-alpha");
155+expect(hookRequester?.to).toBe(`room:${boundRoom}`);
158156const agentCall = hoisted.callGatewayMock.mock.calls.find(
159157([call]) => (call as { method?: string }).method === "agent",
160158)?.[0] as { params?: Record<string, unknown> } | undefined;
161-expect(agentCall?.params).toMatchObject({
162-channel: "matrix",
163-accountId: "bot-alpha",
164-to: `room:${boundRoom}`,
165-threadId: "$thread-root",
166-deliver: true,
167-});
168-expect(hoisted.registerSubagentRunMock).toHaveBeenCalledWith(
169-expect.objectContaining({
170-requesterOrigin: {
171-channel: "matrix",
172-accountId: "bot-beta",
173-to: `room:${boundRoom}`,
174-},
175-expectsCompletionMessage: false,
176-spawnMode: "session",
177-}),
178-);
159+expect(agentCall?.params?.channel).toBe("matrix");
160+expect(agentCall?.params?.accountId).toBe("bot-alpha");
161+expect(agentCall?.params?.to).toBe(`room:${boundRoom}`);
162+expect(agentCall?.params?.threadId).toBe("$thread-root");
163+expect(agentCall?.params?.deliver).toBe(true);
164+const registeredRun = hoisted.registerSubagentRunMock.mock.calls[0]?.[0] as
165+| {
166+requesterOrigin?: { channel?: string; accountId?: string; to?: string };
167+expectsCompletionMessage?: boolean;
168+spawnMode?: string;
169+}
170+| undefined;
171+expect(registeredRun?.requesterOrigin?.channel).toBe("matrix");
172+expect(registeredRun?.requesterOrigin?.accountId).toBe("bot-beta");
173+expect(registeredRun?.requesterOrigin?.to).toBe(`room:${boundRoom}`);
174+expect(registeredRun?.expectsCompletionMessage).toBe(false);
175+expect(registeredRun?.spawnMode).toBe("session");
179176});
180177181178it("keeps completion announcements when only a generic binding is available", async () => {
@@ -221,21 +218,19 @@ describe("spawnSubagentDirect thread binding delivery", () => {
221218const agentCall = hoisted.callGatewayMock.mock.calls.find(
222219([call]) => (call as { method?: string }).method === "agent",
223220)?.[0] as { params?: Record<string, unknown> } | undefined;
224-expect(agentCall?.params).toMatchObject({
225-channel: "matrix",
226-accountId: "sut",
227-to: "room:!parent:example",
228-deliver: false,
229-});
230-expect(hoisted.registerSubagentRunMock).toHaveBeenCalledWith(
231-expect.objectContaining({
232-expectsCompletionMessage: true,
233-requesterOrigin: {
234-channel: "matrix",
235-accountId: "sut",
236-to: "room:!parent:example",
237-},
238-}),
239-);
221+expect(agentCall?.params?.channel).toBe("matrix");
222+expect(agentCall?.params?.accountId).toBe("sut");
223+expect(agentCall?.params?.to).toBe("room:!parent:example");
224+expect(agentCall?.params?.deliver).toBe(false);
225+const registeredRun = hoisted.registerSubagentRunMock.mock.calls[0]?.[0] as
226+| {
227+requesterOrigin?: { channel?: string; accountId?: string; to?: string };
228+expectsCompletionMessage?: boolean;
229+}
230+| undefined;
231+expect(registeredRun?.expectsCompletionMessage).toBe(true);
232+expect(registeredRun?.requesterOrigin?.channel).toBe("matrix");
233+expect(registeredRun?.requesterOrigin?.accountId).toBe("sut");
234+expect(registeredRun?.requesterOrigin?.to).toBe("room:!parent:example");
240235});
241236});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。