
























@@ -459,6 +459,18 @@ describe("dispatchCronDelivery — double-announce guard", () => {
459459});
460460461461it("applies TTS directives before direct cron announce delivery and mirrors spoken text", async () => {
462+vi.mocked(deliverOutboundPayloads).mockImplementationOnce(async (deliveryParams) => {
463+deliveryParams.onPayload?.({
464+text: "Morning briefing complete.",
465+mediaUrls: [
466+"file:///tmp/chart.png",
467+"file:///tmp/narration.ogg",
468+"file:///tmp/cron-tts.mp3",
469+],
470+audioAsVoice: true,
471+});
472+return [{ ok: true } as never];
473+});
462474maybeApplyTtsToPayloadMock.mockImplementation(async (params: { payload: unknown }) => {
463475const payload = params.payload as { text?: string };
464476expect(payload.text).toBe("[[tts]] Morning briefing complete.");
@@ -637,14 +649,14 @@ describe("dispatchCronDelivery — double-announce guard", () => {
637649);
638650});
639651640-it("keeps media filenames in main-session awareness before suppressing the mirror", async () => {
652+it("keeps effective media-only payloads in main-session awareness before suppressing the mirror", async () => {
641653mockResolvedOutboundRoute({
642654sessionKey: "agent:main:main",
643655baseSessionKey: "agent:main:main",
644656});
645657vi.mocked(deliverOutboundPayloads).mockImplementationOnce(async (params) => {
646658params.onPayload?.({
647-text: "Main session briefing.",
659+text: "",
648660mediaUrls: ["https://example.com/main-chart.png"],
649661});
650662return [{ channel: "telegram", messageId: "tg-main-media" }];
@@ -663,7 +675,7 @@ describe("dispatchCronDelivery — double-announce guard", () => {
663675expect(state.result).toBeUndefined();
664676expect(state.delivered).toBe(true);
665677expect(appendAssistantMessageToSessionTranscript).not.toHaveBeenCalled();
666-expect(enqueueSystemEvent).toHaveBeenCalledWith("Main session briefing.\nmain-chart.png", {
678+expect(enqueueSystemEvent).toHaveBeenCalledWith("main-chart.png", {
667679sessionKey: "agent:main:main",
668680contextKey: "cron-direct-delivery:v1:cron:test-job:1000:telegram::123456:",
669681forceSenderIsOwnerFalse: true,
@@ -814,6 +826,10 @@ describe("dispatchCronDelivery — double-announce guard", () => {
814826});
815827816828it("skips main-session awareness for isolated cron jobs with implicit delivery targets", async () => {
829+mockResolvedOutboundRoute({
830+sessionKey: "agent:main:main",
831+baseSessionKey: "agent:main:main",
832+});
817833const params = makeBaseParams({
818834synthesizedText: "Implicit cron update.",
819835resolvedDeliveryMode: "implicit",
@@ -825,6 +841,7 @@ describe("dispatchCronDelivery — double-announce guard", () => {
825841expect(state.deliveryAttempted).toBe(true);
826842expect(deliverOutboundPayloads).toHaveBeenCalledTimes(1);
827843expect(enqueueSystemEvent).not.toHaveBeenCalled();
844+expect(appendAssistantMessageToSessionTranscript).not.toHaveBeenCalled();
828845});
829846830847it("skips awareness text when direct delivery strips a silent caption", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。