@desplega.ai/agent-swarm 1.97.0 → 1.98.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ import {
3
3
  buildAssignmentSummaryBlocks,
4
4
  buildBufferFlushBlocks,
5
5
  buildCancelledBlocks,
6
+ buildCompletedBlockBatches,
6
7
  buildCompletedBlocks,
7
8
  buildFailedBlocks,
8
9
  buildProgressBlocks,
@@ -20,6 +21,7 @@ describe("markdownToSlack", () => {
20
21
  // **hello** → *hello* (Slack bold)
21
22
  expect(markdownToSlack("**hello**")).toBe("*hello*");
22
23
  expect(markdownToSlack("**hello world**")).toBe("*hello world*");
24
+ expect(markdownToSlack("__hello world__")).toBe("*hello world*");
23
25
  });
24
26
 
25
27
  test("converts italic", () => {
@@ -31,7 +33,11 @@ describe("markdownToSlack", () => {
31
33
  });
32
34
 
33
35
  test("converts links", () => {
34
- expect(markdownToSlack("[click](https://example.com)")).toBe("<https://example.com|click>");
36
+ expect(markdownToSlack("[click](https://example.com)")).toBe("click (https://example.com)");
37
+ expect(markdownToSlack("![diagram](https://example.com/a.png)")).toBe(
38
+ "diagram (https://example.com/a.png)",
39
+ );
40
+ expect(markdownToSlack("[click](https://example.com)")).not.toContain("<https://");
35
41
  });
36
42
 
37
43
  test("converts headers to bold", () => {
@@ -163,6 +169,27 @@ describe("buildCompletedBlocks", () => {
163
169
  const totalText = bodySections.map((s) => s.text.text).join("");
164
170
  expect(totalText).toBe(longBody);
165
171
  });
172
+
173
+ test("batches very long body across multiple Slack messages without losing text", () => {
174
+ const longBody = "x".repeat(140_000);
175
+ const batches = buildCompletedBlockBatches({
176
+ agentName: "Alpha",
177
+ taskId: "abcdef12-3456-7890-abcd-ef1234567890",
178
+ body: longBody,
179
+ });
180
+
181
+ expect(batches.length).toBeGreaterThan(1);
182
+ for (const batch of batches) {
183
+ expect(batch.length).toBeLessThanOrEqual(45);
184
+ }
185
+
186
+ const bodyText = batches
187
+ .flatMap((batch) => batch.slice(1))
188
+ .map((block) => block.text.text)
189
+ .join("");
190
+ expect(bodyText).toBe(longBody);
191
+ expect(batches[1][0].text.text).toContain("continued · part 2");
192
+ });
166
193
  });
167
194
 
168
195
  describe("buildFailedBlocks", () => {
@@ -908,6 +935,26 @@ describe("buildTreeBlocks", () => {
908
935
  expect(text).toContain("Result: 42");
909
936
  });
910
937
 
938
+ test("completed root preview converts markdown and marks truncation explicitly", () => {
939
+ const root: TreeNode = {
940
+ taskId: makeTaskId("oooo0002"),
941
+ agentName: "Solo",
942
+ status: "completed",
943
+ slackReplySent: false,
944
+ output: `### Summary\n\n**Not broken** — ${"Automatic review on plain PR creation ".repeat(8)}`,
945
+ children: [],
946
+ };
947
+
948
+ const blocks = buildTreeBlocks([root]);
949
+ const text = blocks[0].text.text;
950
+
951
+ expect(text).toContain("*Summary*");
952
+ expect(text).toContain("*Not broken*");
953
+ expect(text).not.toContain("###");
954
+ expect(text).not.toContain("**Not broken**");
955
+ expect(text).toContain("more chars; full output in thread");
956
+ });
957
+
911
958
  test("completed root with slackReplySent suppresses output", () => {
912
959
  const root: TreeNode = {
913
960
  taskId: makeTaskId("pppp0001"),
package/src/types.ts CHANGED
@@ -725,6 +725,8 @@ export const AgentLogEventTypeSchema = z.enum([
725
725
  "budget.deleted",
726
726
  "pricing.inserted",
727
727
  "pricing.deleted",
728
+ "pricing.refresh",
729
+ "pricing.refresh.failed",
728
730
  // Graceful pause/resume via follow-up
729
731
  "task_superseded",
730
732
  ]);