| ... | @@ -5,10 +5,6 @@ import { | ... | @@ -5,10 +5,6 @@ import { |
| 5 | foldSubagentActivities, | 5 | foldSubagentActivities, |
| 6 | formatSubagentModelLabel, | 6 | formatSubagentModelLabel, |
| 7 | formatSubagentTokenCount, | 7 | formatSubagentTokenCount, |
| 8 | isAgentAttributedToolActivity, | | |
| 9 | isSubagentActivityKind, | | |
| 10 | isTimelineBypassActivity, | | |
| 11 | workflowCardMembers, | | |
| 12 | } from "./subagentRuntime.ts"; | 8 | } from "./subagentRuntime.ts"; |
| 13 | | 9 | |
| 14 | let sequence = 0; | 10 | let sequence = 0; |
| ... | @@ -557,64 +553,6 @@ describe("deriveAgentPanelModel", () => { | ... | @@ -557,64 +553,6 @@ describe("deriveAgentPanelModel", () => { |
| 557 | }); | 553 | }); |
| 558 | }); | 554 | }); |
| 559 | | 555 | |
| 560 | describe("workflowCardMembers", () => { | | |
| 561 | it("orders by urgency (failed, running, waiting) and reports overflow", () => { | | |
| 562 | const roster = fold([ | | |
| 563 | activity("task.started", { taskId: "wf-1", taskType: "local_workflow" }), | | |
| 564 | ...[..."abcdefghij"].map((letter, index) => | | |
| 565 | activity("task.progress", { | | |
| 566 | taskId: `wf-1:wf:${index}`, | | |
| 567 | title: `agent-${letter}`, | | |
| 568 | status: index === 3 ? "failed" : index < 3 ? "completed" : "running", | | |
| 569 | ...(index === 3 ? { error: "died" } : {}), | | |
| 570 | parentAgentId: "wf-1", | | |
| 571 | agentIndex: index, | | |
| 572 | phaseIndex: 0, | | |
| 573 | phaseTitle: "Work", | | |
| 574 | }), | | |
| 575 | ), | | |
| 576 | ]); | | |
| 577 | const model = deriveAgentPanelModel({ agents: roster }); | | |
| 578 | const { visible, overflow } = workflowCardMembers(model.workflows[0]!, 8); | | |
| 579 | expect(visible).toHaveLength(8); | | |
| 580 | expect(overflow).toBe(2); | | |
| 581 | expect(visible[0]!.status).toBe("failed"); | | |
| 582 | expect(visible.filter((agent) => agent.status === "completed").length).toBeLessThanOrEqual(2); | | |
| 583 | }); | | |
| 584 | }); | | |
| 585 | | | |
| 586 | describe("timeline predicates", () => { | | |
| 587 | it("recognizes subagent activity kinds as fold input", () => { | | |
| 588 | for (const kind of [ | | |
| 589 | "task.started", | | |
| 590 | "task.progress", | | |
| 591 | "task.updated", | | |
| 592 | "task.completed", | | |
| 593 | "tool.progress", | | |
| 594 | ]) { | | |
| 595 | expect(isSubagentActivityKind(kind)).toBe(true); | | |
| 596 | } | | |
| 597 | expect(isSubagentActivityKind("tool.completed")).toBe(false); | | |
| 598 | }); | | |
| 599 | | | |
| 600 | it("attributed tool rows are re-homed; unattributed rows stay in the timeline", () => { | | |
| 601 | expect(isAgentAttributedToolActivity(activity("tool.completed", { agentId: "task-1" }))).toBe( | | |
| 602 | true, | | |
| 603 | ); | | |
| 604 | expect(isAgentAttributedToolActivity(activity("tool.completed", {}))).toBe(false); | | |
| 605 | expect(isAgentAttributedToolActivity(activity("tool.completed", { agentId: " " }))).toBe( | | |
| 606 | false, | | |
| 607 | ); | | |
| 608 | }); | | |
| 609 | | | |
| 610 | it("timelineBypass rows never render in the parent chat", () => { | | |
| 611 | expect(isTimelineBypassActivity(activity("task.progress", { timelineBypass: true }))).toBe( | | |
| 612 | true, | | |
| 613 | ); | | |
| 614 | expect(isTimelineBypassActivity(activity("task.progress", {}))).toBe(false); | | |
| 615 | }); | | |
| 616 | }); | | |
| 617 | | | |
| 618 | describe("formatSubagentTokenCount", () => { | 556 | describe("formatSubagentTokenCount", () => { |
| 619 | it("formats plain counters", () => { | 557 | it("formats plain counters", () => { |
| 620 | expect(formatSubagentTokenCount(950)).toBe("950"); | 558 | expect(formatSubagentTokenCount(950)).toBe("950"); |