




















@@ -1199,6 +1199,7 @@ describe("deliverSubagentAnnouncement completion delivery", () => {
11991199const result = await deliverDiscordDirectMessageCompletion({
12001200 callGateway,
12011201 sendMessage,
1202+sourceTool: "music_generate",
12021203internalEvents: [
12031204{
12041205type: "task_completion",
@@ -1219,14 +1220,15 @@ describe("deliverSubagentAnnouncement completion delivery", () => {
12191220expectRecordFields(result, {
12201221delivered: false,
12211222path: "direct",
1222-error: "completion agent did not produce a visible reply",
1223+error: "completion agent did not deliver through the message tool",
12231224});
12241225expectGatewayAgentParams(callGateway, {
1225-deliver: true,
1226+deliver: false,
12261227channel: "discord",
12271228accountId: "acct-1",
12281229to: "dm:U123",
12291230threadId: undefined,
1231+sourceReplyDeliveryMode: "message_tool_only",
12301232});
12311233expect(sendMessage).not.toHaveBeenCalled();
12321234});
@@ -1243,6 +1245,7 @@ describe("deliverSubagentAnnouncement completion delivery", () => {
12431245const result = await deliverDiscordDirectMessageCompletion({
12441246 callGateway,
12451247 sendMessage,
1248+sourceTool: "music_generate",
12461249internalEvents: [
12471250{
12481251type: "task_completion",
@@ -1265,14 +1268,27 @@ describe("deliverSubagentAnnouncement completion delivery", () => {
12651268path: "direct",
12661269});
12671270expect(callGateway).toHaveBeenCalledTimes(1);
1271+expectGatewayAgentParams(callGateway, {
1272+deliver: false,
1273+channel: "discord",
1274+accountId: "acct-1",
1275+to: "dm:U123",
1276+threadId: undefined,
1277+sourceReplyDeliveryMode: "message_tool_only",
1278+});
12681279expect(sendMessage).not.toHaveBeenCalled();
12691280});
127012811271-it("delivers generated media completions through the announce agent in automatic DMs", async () => {
1282+it("requires generated media completion DMs to use the message tool", async () => {
12721283const callGateway = createGatewayMock({
12731284result: {
1274-payloads: [
1285+payloads: [],
1286+messagingToolSentTargets: [
12751287{
1288+tool: "message",
1289+provider: "discord",
1290+accountId: "acct-1",
1291+to: "dm:U123",
12761292text: "The track is ready.",
12771293mediaUrls: ["/tmp/generated-night-drive.mp3"],
12781294},
@@ -1307,11 +1323,63 @@ describe("deliverSubagentAnnouncement completion delivery", () => {
13071323path: "direct",
13081324});
13091325expectGatewayAgentParams(callGateway, {
1310-deliver: true,
1326+deliver: false,
13111327channel: "discord",
13121328accountId: "acct-1",
13131329to: "dm:U123",
13141330threadId: undefined,
1331+sourceReplyDeliveryMode: "message_tool_only",
1332+});
1333+expect(sendMessage).not.toHaveBeenCalled();
1334+});
1335+1336+it("accepts failed generated media completion notices through the message tool", async () => {
1337+const callGateway = createGatewayMock({
1338+result: {
1339+payloads: [],
1340+messagingToolSentTargets: [
1341+{
1342+tool: "message",
1343+provider: "discord",
1344+accountId: "acct-1",
1345+to: "dm:U123",
1346+text: "Music generation failed: provider failed.",
1347+},
1348+],
1349+},
1350+});
1351+const sendMessage = createSendMessageMock();
1352+const result = await deliverDiscordDirectMessageCompletion({
1353+ callGateway,
1354+ sendMessage,
1355+sourceTool: "music_generate",
1356+internalEvents: [
1357+{
1358+type: "task_completion",
1359+source: "music_generation",
1360+childSessionKey: "music_generate:task-123",
1361+childSessionId: "task-123",
1362+announceType: "music generation task",
1363+taskLabel: "night-drive synthwave",
1364+status: "error",
1365+statusLabel: "failed",
1366+result: "provider failed",
1367+replyInstruction: "Deliver the failure through the message tool.",
1368+},
1369+],
1370+});
1371+1372+expectRecordFields(result, {
1373+delivered: true,
1374+path: "direct",
1375+});
1376+expectGatewayAgentParams(callGateway, {
1377+deliver: false,
1378+channel: "discord",
1379+accountId: "acct-1",
1380+to: "dm:U123",
1381+threadId: undefined,
1382+sourceReplyDeliveryMode: "message_tool_only",
13151383});
13161384expect(sendMessage).not.toHaveBeenCalled();
13171385});
@@ -1358,7 +1426,7 @@ describe("deliverSubagentAnnouncement completion delivery", () => {
13581426expectRecordFields(result, {
13591427delivered: false,
13601428path: "direct",
1361-error: "completion agent did not deliver generated media",
1429+error: "completion agent did not deliver through the message tool",
13621430});
13631431expect(sendMessage).not.toHaveBeenCalled();
13641432});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。