mirror of
https://github.com/block/buzz.git
synced 2026-11-25 02:31:36 +00:00
refactor(agents): drop transcript compact mode and simplify row spacing
- Remove the compact layout prop from AgentSessionTranscriptList, ManagedAgentSessionPanel, and AgentSessionThreadPanel; always render the tighter transcript density - Revert consecutive tool-call grouping (tool_group segments, ToolCallGroup, segment spacing helpers) and render each tool as a normal transcript row - Add symmetric per-type row spacing: my-2.5 for messages, my-1 for tools, my-2 for other items - Simplify ToolItem wrapper padding now that grouped/compact props are gone
This commit is contained in:
@@ -2,7 +2,6 @@ import type { TranscriptItem } from "./agentSessionTypes";
|
||||
|
||||
export type TranscriptTurnSegment =
|
||||
| { kind: "item"; item: TranscriptItem }
|
||||
| { kind: "tool_group"; items: Extract<TranscriptItem, { type: "tool" }>[] }
|
||||
| { kind: "setup"; items: Extract<TranscriptItem, { type: "lifecycle" }>[] }
|
||||
| {
|
||||
kind: "prompt";
|
||||
@@ -68,9 +67,7 @@ function classifyTurnItems(items: TranscriptItem[]): TranscriptTurnSegment[] {
|
||||
const activity = items.filter((item) => !consumed.has(item));
|
||||
|
||||
if (!userPrompt) {
|
||||
return groupConsecutiveToolSegments(
|
||||
activity.map((item) => ({ kind: "item", item })),
|
||||
);
|
||||
return activity.map((item) => ({ kind: "item", item }));
|
||||
}
|
||||
|
||||
const segments: TranscriptTurnSegment[] = [
|
||||
@@ -93,34 +90,7 @@ function classifyTurnItems(items: TranscriptItem[]): TranscriptTurnSegment[] {
|
||||
segments.push({ kind: "item", item });
|
||||
}
|
||||
|
||||
return groupConsecutiveToolSegments(segments);
|
||||
}
|
||||
|
||||
function groupConsecutiveToolSegments(
|
||||
segments: TranscriptTurnSegment[],
|
||||
): TranscriptTurnSegment[] {
|
||||
const grouped: TranscriptTurnSegment[] = [];
|
||||
let toolBuffer: Extract<TranscriptItem, { type: "tool" }>[] = [];
|
||||
|
||||
const flushTools = () => {
|
||||
if (toolBuffer.length === 0) {
|
||||
return;
|
||||
}
|
||||
grouped.push({ kind: "tool_group", items: toolBuffer });
|
||||
toolBuffer = [];
|
||||
};
|
||||
|
||||
for (const segment of segments) {
|
||||
if (segment.kind === "item" && segment.item.type === "tool") {
|
||||
toolBuffer.push(segment.item);
|
||||
continue;
|
||||
}
|
||||
flushTools();
|
||||
grouped.push(segment);
|
||||
}
|
||||
|
||||
flushTools();
|
||||
return grouped;
|
||||
return segments;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,8 +162,6 @@ export function flattenDisplayBlocks(
|
||||
for (const segment of block.segments) {
|
||||
if (segment.kind === "item") {
|
||||
result.push(segment.item);
|
||||
} else if (segment.kind === "tool_group") {
|
||||
result.push(...segment.items);
|
||||
} else if (segment.kind === "prompt") {
|
||||
result.push(segment.user);
|
||||
result.push(...segment.setup);
|
||||
|
||||
Reference in New Issue
Block a user