




























@@ -1288,8 +1288,43 @@ describe("processDiscordMessage draft streaming", () => {
12881288expectSinglePreviewEdit();
12891289});
129012901291-it("keeps preview streaming off by default when streaming is unset", async () => {
1291+it("defaults unset Discord preview streaming to progress mode without drafting text-only turns", async () => {
12921292await runSingleChunkFinalScenario({ maxLinesPerMessage: 5 });
1293+expect(createDiscordDraftStream).toHaveBeenCalledTimes(1);
1294+expect(editMessageDiscord).not.toHaveBeenCalled();
1295+expect(deliverDiscordReply).toHaveBeenCalledTimes(1);
1296+});
1297+1298+it("streams Discord tool progress by default when streaming is unset", async () => {
1299+const draftStream = createMockDraftStreamForTest();
1300+1301+dispatchInboundMessage.mockImplementationOnce(async (params?: DispatchInboundParams) => {
1302+await params?.replyOptions?.onToolStart?.({ name: "exec", phase: "start" });
1303+await params?.replyOptions?.onItemEvent?.({ progressText: "exec done" });
1304+await params?.dispatcher.sendFinalReply({ text: "done" });
1305+return { queuedFinal: true, counts: { final: 1, tool: 0, block: 0 } };
1306+});
1307+1308+const ctx = await createAutomaticSourceDeliveryContext({
1309+discordConfig: { maxLinesPerMessage: 5 },
1310+});
1311+1312+await runProcessDiscordMessage(ctx);
1313+1314+expect(draftStream.update).toHaveBeenCalledWith(expect.stringContaining("Exec"));
1315+expect(draftStream.update).toHaveBeenCalledWith(expect.stringContaining("exec done"));
1316+expect(editMessageDiscord).toHaveBeenCalledWith(
1317+"c1",
1318+"preview-1",
1319+{ content: "done" },
1320+expect.objectContaining({ rest: expect.anything() }),
1321+);
1322+expect(deliverDiscordReply).not.toHaveBeenCalled();
1323+});
1324+1325+it("keeps Discord preview streaming off when explicitly disabled", async () => {
1326+await runSingleChunkFinalScenario({ streaming: { mode: "off" }, maxLinesPerMessage: 5 });
1327+expect(createDiscordDraftStream).not.toHaveBeenCalled();
12931328expect(editMessageDiscord).not.toHaveBeenCalled();
12941329expect(deliverDiscordReply).toHaveBeenCalledTimes(1);
12951330});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。