



























@@ -2663,6 +2663,32 @@ describe("dispatchTelegramMessage draft streaming", () => {
26632663expectDeliveredReply(0, { text: "Branch is up to date" });
26642664});
266526652666+it("clears progress drafts before durable verbose tool output", async () => {
2667+const { answerDraftStream } = setupDraftStreams({ answerMessageId: 2001 });
2668+dispatchReplyWithBufferedBlockDispatcher.mockImplementation(
2669+async ({ dispatcherOptions, replyOptions }) => {
2670+await replyOptions?.onToolStart?.({ name: "exec", phase: "start" });
2671+replyOptions?.onVerboseProgressVisibility?.(() => true);
2672+await dispatcherOptions.deliver({ text: "Tool output visible to Telegram" }, { kind: "tool" });
2673+await dispatcherOptions.deliver({ text: "Final answer" }, { kind: "final" });
2674+return { queuedFinal: true };
2675+},
2676+);
2677+2678+await dispatchWithContext({
2679+context: createContext(),
2680+streamMode: "progress",
2681+telegramCfg: { streaming: { mode: "progress", progress: { label: "Shelling" } } },
2682+});
2683+2684+expect(answerDraftStream.update).toHaveBeenCalledWith("Shelling\n\n`🛠️ Exec`");
2685+expectDeliveredReply(0, { text: "Tool output visible to Telegram" });
2686+expectDeliveredReply(0, { text: "Final answer" }, 1);
2687+expect(answerDraftStream.clear.mock.invocationCallOrder[0]).toBeLessThan(
2688+deliverReplies.mock.invocationCallOrder[0],
2689+);
2690+});
2691+26662692it("does not stream text-only tool results into progress drafts", async () => {
26672693const { answerDraftStream } = setupDraftStreams({ answerMessageId: 2001 });
26682694dispatchReplyWithBufferedBlockDispatcher.mockImplementation(
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。