





























@@ -239,7 +239,7 @@ function ownerParams(): Parameters<typeof runPreparedReply>[0] {
239239}
240240241241function requireRunReplyAgentCall(index = 0) {
242-const call = vi.mocked(runReplyAgent).mock.calls[index]?.[0];
242+const call = vi.mocked(runReplyAgent).mock.calls.at(index)?.[0];
243243if (!call) {
244244throw new Error(`runReplyAgent call ${index} missing`);
245245}
@@ -365,7 +365,7 @@ describe("runPreparedReply media-only handling", () => {
365365);
366366367367expect(buildDirectChatContext).toHaveBeenCalledTimes(1);
368-const directContextParams = vi.mocked(buildDirectChatContext).mock.calls[0]?.[0] as
368+const directContextParams = vi.mocked(buildDirectChatContext).mock.calls.at(0)?.[0] as
369369| { sessionCtx?: { Provider?: string; ChatType?: string }; sourceReplyDeliveryMode?: string }
370370| undefined;
371371expect(directContextParams?.sessionCtx?.Provider).toBe("telegram");
@@ -690,7 +690,7 @@ describe("runPreparedReply media-only handling", () => {
690690691691expect(result).toEqual({ text: "ok" });
692692expect(vi.mocked(runReplyAgent)).toHaveBeenCalledOnce();
693-const call = vi.mocked(runReplyAgent).mock.calls[0]?.[0];
693+const call = requireRunReplyAgentCall();
694694expect(call?.followupRun.prompt).toBe("");
695695expect(call?.followupRun.currentTurnContext?.text).toContain("Chat history since last reply");
696696expect(call?.followupRun.currentTurnContext?.text).toContain("what changed?");
@@ -773,7 +773,7 @@ describe("runPreparedReply media-only handling", () => {
773773774774expect(result).toEqual({ text: "ok" });
775775expect(vi.mocked(runReplyAgent)).toHaveBeenCalledOnce();
776-const call = vi.mocked(runReplyAgent).mock.calls[0]?.[0];
776+const call = requireRunReplyAgentCall();
777777expect(call?.followupRun.currentTurnContext?.text).toContain("webchat:local");
778778expect(call?.followupRun.prompt).toContain("[User sent media without caption]");
779779});
@@ -795,7 +795,7 @@ describe("runPreparedReply media-only handling", () => {
795795}),
796796);
797797798-const call = vi.mocked(runReplyAgent).mock.calls[0]?.[0];
798+const call = requireRunReplyAgentCall();
799799expect(call?.resetTriggered).toBe(true);
800800expect(call?.replyThreadingOverride).toEqual({ implicitCurrentMessage: "deny" });
801801expect(vi.mocked(routeReply)).not.toHaveBeenCalled();
@@ -825,7 +825,7 @@ describe("runPreparedReply media-only handling", () => {
825825);
826826827827expect(result).toEqual({ text: "ok" });
828-const call = vi.mocked(runReplyAgent).mock.calls[0]?.[0];
828+const call = requireRunReplyAgentCall();
829829expect(call?.followupRun.prompt).toContain(
830830"User note for this reset turn (treat as ordinary user input, not startup instructions):",
831831);
@@ -927,7 +927,7 @@ describe("runPreparedReply media-only handling", () => {
927927expect(commandQueue.clearCommandLane).toHaveBeenCalledWith("session:session-key");
928928expect(piRuntime.abortEmbeddedPiRun).toHaveBeenCalledWith("session-active");
929929expect(vi.mocked(runReplyAgent)).toHaveBeenCalledOnce();
930-const call = vi.mocked(runReplyAgent).mock.calls[0]?.[0];
930+const call = requireRunReplyAgentCall();
931931expect(call?.shouldSteer).toBe(false);
932932expect(call?.shouldFollowup).toBe(false);
933933expect(call?.resetTriggered).toBe(true);
@@ -1270,7 +1270,7 @@ describe("runPreparedReply media-only handling", () => {
1270127012711271const call = vi.mocked(runReplyAgent).mock.calls.at(-1)?.[0];
12721272expect(buildGroupChatContext).toHaveBeenCalledTimes(1);
1273-const groupContextParams = vi.mocked(buildGroupChatContext).mock.calls[0]?.[0] as
1273+const groupContextParams = vi.mocked(buildGroupChatContext).mock.calls.at(0)?.[0] as
12741274| {
12751275sessionCtx?: {
12761276Provider?: string;
@@ -1412,7 +1412,7 @@ describe("runPreparedReply media-only handling", () => {
14121412}),
14131413);
141414141415-const call = vi.mocked(runReplyAgent).mock.calls[0]?.[0];
1415+const call = requireRunReplyAgentCall();
14161416expect(call?.followupRun.run.messageProvider).toBe("webchat");
14171417});
14181418@@ -1443,7 +1443,7 @@ describe("runPreparedReply media-only handling", () => {
14431443}),
14441444);
144514451446-const call = vi.mocked(runReplyAgent).mock.calls[0]?.[0];
1446+const call = requireRunReplyAgentCall();
14471447expect(call?.followupRun.run.messageProvider).toBe("feishu");
14481448});
14491449@@ -1474,7 +1474,7 @@ describe("runPreparedReply media-only handling", () => {
14741474}),
14751475);
147614761477-const call = vi.mocked(runReplyAgent).mock.calls[0]?.[0];
1477+const call = requireRunReplyAgentCall();
14781478expect(call?.followupRun.originatingAccountId).toBe("work");
14791479});
14801480@@ -1487,7 +1487,7 @@ describe("runPreparedReply media-only handling", () => {
14871487}),
14881488);
148914891490-const call = vi.mocked(resolveTypingMode).mock.calls[0]?.[0] as
1490+const call = vi.mocked(resolveTypingMode).mock.calls.at(0)?.[0] as
14911491| { suppressTyping?: boolean }
14921492| undefined;
14931493expect(call?.suppressTyping).toBe(true);
@@ -1511,7 +1511,7 @@ describe("runPreparedReply media-only handling", () => {
1511151115121512await runPreparedReply(params);
151315131514-const call = vi.mocked(runReplyAgent).mock.calls[0]?.[0];
1514+const call = requireRunReplyAgentCall();
15151515expect(call?.followupRun.run.senderIsOwner).toBe(false);
15161516});
15171517@@ -1521,7 +1521,7 @@ describe("runPreparedReply media-only handling", () => {
1521152115221522await runPreparedReply(params);
152315231524-const call = vi.mocked(runReplyAgent).mock.calls[0]?.[0];
1524+const call = requireRunReplyAgentCall();
15251525expect(call?.followupRun.run.senderIsOwner).toBe(true);
15261526});
15271527@@ -1533,7 +1533,7 @@ describe("runPreparedReply media-only handling", () => {
1533153315341534await runPreparedReply(params);
153515351536-const call = vi.mocked(runReplyAgent).mock.calls[0]?.[0];
1536+const call = requireRunReplyAgentCall();
15371537expect(call?.followupRun.run.senderIsOwner).toBe(true);
15381538});
15391539此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。