|
8 | 8 | resolveViewedImageAsset, |
9 | 9 | resolveWorkEntryToolPresentation, |
10 | 10 | summarizeToolGroup, |
| 11 | + toolGroupSummaryKind, |
11 | 12 | toolItemForDisplay, |
12 | 13 | type WorkLogPresentationEntry, |
13 | 14 | workEntryIndicatesToolFailure, |
@@ -357,3 +358,33 @@ describe("summarizeToolGroup read counts", () => { |
357 | 358 | ).toBe("Read 2 files"); |
358 | 359 | }); |
359 | 360 | }); |
| 361 | + |
| 362 | +describe("summarizeToolGroup approvals", () => { |
| 363 | + const command: WorkLogPresentationEntry = { |
| 364 | + id: "command", |
| 365 | + createdAt: "2026-11-27T00:00:00.000Z", |
| 366 | + label: "pwd", |
| 367 | + tone: "tool", |
| 368 | + itemType: "command_execution", |
| 369 | + command: "pwd", |
| 370 | + toolLifecycleStatus: "completed", |
| 371 | + }; |
| 372 | + const approval: WorkLogPresentationEntry = { |
| 373 | + id: "approval", |
| 374 | + createdAt: "2026-11-27T00:00:00.000Z", |
| 375 | + label: "Approval requested", |
| 376 | + tone: "tool", |
| 377 | + itemType: "approval_request", |
| 378 | + requestKind: "command", |
| 379 | + toolLifecycleStatus: "completed", |
| 380 | + }; |
| 381 | + |
| 382 | + it("does not count the approval for a step as a tool of its own", () => { |
| 383 | + expect(summarizeToolGroup([command, approval]).summary).toBe("Ran 1 command"); |
| 384 | + expect(toolGroupSummaryKind([command, approval])).toBe("command"); |
| 385 | + }); |
| 386 | + |
| 387 | + it("still summarizes a group that only holds an approval", () => { |
| 388 | + expect(summarizeToolGroup([approval]).summary).toBe("Used 1 tool"); |
| 389 | + }); |
| 390 | +}); |
0 commit comments