






















@@ -498,6 +498,51 @@ describe("dispatchTelegramMessage draft streaming", () => {
498498);
499499});
500500501+it("suppresses Telegram tool progress by default", async () => {
502+const draftStream = createDraftStream();
503+createTelegramDraftStream.mockReturnValue(draftStream);
504+dispatchReplyWithBufferedBlockDispatcher.mockImplementation(async ({ replyOptions }) => {
505+await replyOptions?.onToolStart?.({ name: "exec", phase: "start" });
506+await replyOptions?.onItemEvent?.({ progressText: "exec ls ~/Desktop" });
507+return { queuedFinal: false };
508+});
509+510+await dispatchWithContext({ context: createContext(), streamMode: "partial" });
511+512+expect(draftStream.update).not.toHaveBeenCalled();
513+expect(dispatchReplyWithBufferedBlockDispatcher).toHaveBeenCalledWith(
514+expect.objectContaining({
515+replyOptions: expect.objectContaining({
516+suppressDefaultToolProgressMessages: true,
517+}),
518+}),
519+);
520+});
521+522+it("streams Telegram tool progress only when explicitly enabled", async () => {
523+const draftStream = createDraftStream();
524+createTelegramDraftStream.mockReturnValue(draftStream);
525+dispatchReplyWithBufferedBlockDispatcher.mockImplementation(async ({ replyOptions }) => {
526+await replyOptions?.onToolStart?.({ name: "exec", phase: "start" });
527+return { queuedFinal: false };
528+});
529+530+await dispatchWithContext({
531+context: createContext(),
532+streamMode: "partial",
533+telegramCfg: { streaming: { preview: { toolProgress: true } } },
534+});
535+536+expect(draftStream.update).toHaveBeenCalledWith("Working…\n• tool: exec");
537+expect(dispatchReplyWithBufferedBlockDispatcher).toHaveBeenCalledWith(
538+expect.objectContaining({
539+replyOptions: expect.objectContaining({
540+suppressDefaultToolProgressMessages: true,
541+}),
542+}),
543+);
544+});
545+501546it("keeps block streaming enabled when account config enables it", async () => {
502547dispatchReplyWithBufferedBlockDispatcher.mockImplementation(async ({ dispatcherOptions }) => {
503548await dispatcherOptions.deliver({ text: "Hello" }, { kind: "final" });
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。