
























@@ -3891,7 +3891,10 @@ describe("sendPolicy deny — suppress delivery, not processing (#53328)", () =>
38913891sendPolicy: "deny",
38923892};
38933893const dispatcher = createDispatcher();
3894-const replyResolver = vi.fn(async () => ({ text: "agent reply" }) satisfies ReplyPayload);
3894+const replyResolver = vi.fn(async (_ctx: MsgContext, opts?: GetReplyOptions) => {
3895+expect(opts?.suppressTyping).toBe(true);
3896+return { text: "agent reply" } satisfies ReplyPayload;
3897+});
38953898const ctx = buildTestCtx({ SessionKey: "test:session" });
3896389938973900await dispatchReplyFromConfig({
@@ -4220,8 +4223,11 @@ describe("sendPolicy deny — suppress delivery, not processing (#53328)", () =>
42204223itemEvent: vi.fn(),
42214224planUpdate: vi.fn(),
42224225toolResult: vi.fn(),
4226+typingStart: vi.fn(async () => {}),
42234227};
42244228const replyResolver = vi.fn(async (_ctx: MsgContext, opts?: GetReplyOptions) => {
4229+expect(opts?.suppressTyping).toBe(false);
4230+await opts?.onReplyStart?.();
42254231await opts?.onPartialReply?.({ text: "draft leak" });
42264232await opts?.onReasoningStream?.({ text: "reasoning leak" });
42274233await opts?.onAssistantMessageStart?.();
@@ -4244,6 +4250,7 @@ describe("sendPolicy deny — suppress delivery, not processing (#53328)", () =>
42444250onPartialReply: callbacks.partial,
42454251onReasoningStream: callbacks.reasoning,
42464252onAssistantMessageStart: callbacks.assistantStart,
4253+onReplyStart: callbacks.typingStart,
42474254onBlockReplyQueued: callbacks.blockQueued,
42484255onToolStart: callbacks.toolStart,
42494256onItemEvent: callbacks.itemEvent,
@@ -4257,7 +4264,11 @@ describe("sendPolicy deny — suppress delivery, not processing (#53328)", () =>
42574264expect(dispatcher.sendFinalReply).not.toHaveBeenCalled();
42584265expect(dispatcher.sendBlockReply).not.toHaveBeenCalled();
42594266expect(dispatcher.sendToolResult).not.toHaveBeenCalled();
4260-for (const callback of Object.values(callbacks)) {
4267+expect(callbacks.typingStart).toHaveBeenCalledTimes(1);
4268+for (const [name, callback] of Object.entries(callbacks)) {
4269+if (name === "typingStart") {
4270+continue;
4271+}
42614272expect(callback).not.toHaveBeenCalled();
42624273}
42634274expect(hookMocks.runner.runReplyDispatch).toHaveBeenCalledWith(
@@ -4275,6 +4286,7 @@ describe("sendPolicy deny — suppress delivery, not processing (#53328)", () =>
42754286const dispatcher = createDispatcher();
42764287const replyResolver = vi.fn(async (_ctx: MsgContext, opts?: GetReplyOptions) => {
42774288expect(opts?.sourceReplyDeliveryMode).toBe("message_tool_only");
4289+expect(opts?.suppressTyping).toBe(false);
42784290return { text: "final reply" } satisfies ReplyPayload;
42794291});
42804292此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。