Skip to content

Commit 46dbbb4

Browse files
tulsi-builderBasilBotclaude
committed
feat(agents): open the latest transcript from agent activity
The transcript now opens at its latest step and follows new steps while the reader stays at the end; the order stays oldest first, matching the conversation beside it. Opening an agent from the composer's Working now indicator, when its work is in one known conversation, shows that conversation's transcript directly; closing it closes the profile panel. A Working now row for work in the conversation already shown opens its activity instead of navigating nowhere. Ambiguous or unconfirmed work keeps the overview, and a transcript the reader chooses is never replaced by a lookup that finishes later. Co-authored-by: BasilBot <399581b6165ab01343e3a1324774b1024d76942aea563468f93c975e5ee5193c@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: tulsi <[email protected]>
1 parent 1b6f9ca commit 46dbbb4

21 files changed

Lines changed: 448 additions & 44 deletions

‎src/bundled/agents/AgentDetails.tsx‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ export function AgentDetails({
7878
messageAction,
7979
conversation,
8080
initialActivity,
81+
initialTranscript,
82+
close,
8183
communities,
8284
}: {
8385
agents: Agents;
@@ -90,6 +92,9 @@ export function AgentDetails({
9092
messageAction: (variant: "glass" | "subtle") => ReactNode;
9193
conversation?: AgentConversation | undefined;
9294
initialActivity?: boolean;
95+
initialTranscript?: boolean;
96+
/** Closes the panel showing the agent. */
97+
close?: () => void;
9398
communities?: CommunityReader | undefined;
9499
}) {
95100
const { pack, src: backdrop } = useAgentPortraitSource(agent, agent.relay);
@@ -375,6 +380,8 @@ export function AgentDetails({
375380
channels={channels}
376381
conversation={conversation}
377382
initialActivity={initialActivity}
383+
initialTranscript={initialTranscript}
384+
close={close}
378385
settingsHost={settings.settingsHost}
379386
onDiscard={settings.discard}
380387
memories={memories}

‎src/bundled/agents/AgentTabs.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export function AgentTabs(props: {
2727
settingsContent: ReactNode;
2828
conversation?: AgentConversation | undefined;
2929
initialActivity?: boolean | undefined;
30+
initialTranscript?: boolean | undefined;
31+
close?: (() => void) | undefined;
3032
onDiscard?: () => void;
3133
}) {
3234
const settingsContent = (

‎src/bundled/builderlab/adapter-type/Activity.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ function ActivityFeed({
8686
transcript={transcript}
8787
agentName={agent.name}
8888
state={(turnId) => state.get(turnId)}
89+
follow={false}
8990
before={
9091
<>
9192
<Note>

‎src/bundled/claude-code/tabs.test.tsx‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,55 @@ it("lists saved conversations and shows one's transcript, or that it is gone", a
352352
expect(save).not.toHaveBeenCalled();
353353
});
354354

355+
it("opens the conversation's transcript when opened from its activity, once", async () => {
356+
const root = "e".repeat(64);
357+
localStorage.setItem(
358+
"buzz.claude-code.sessions.v1",
359+
JSON.stringify({
360+
[agent().key]: { [`channel/${root}`]: { id: "kept", seen: 0, at: 2 } },
361+
}),
362+
);
363+
const transcript = JSON.stringify({
364+
type: "assistant",
365+
uuid: "u1",
366+
timestamp: "2026-10-09T10:00:05Z",
367+
message: { content: [{ type: "text", text: "Two files." }] },
368+
});
369+
const Activity = tab(
370+
installed({ files: { "./-Users-me--buzz/kept.jsonl": transcript } }).type,
371+
1,
372+
);
373+
const conversation = { channelId: "channel", rootId: root };
374+
const { unmount } = render(
375+
<Activity
376+
agent={agent()}
377+
save={vi.fn()}
378+
conversation={conversation}
379+
initialTranscript
380+
/>,
381+
);
382+
const user = userEvent.setup();
383+
expect(await screen.findByText("Two files.")).toBeVisible();
384+
await user.click(screen.getByRole("button", { name: "Back to profile" }));
385+
expect(
386+
screen.getByRole("button", {
387+
name: "View transcript: channel",
388+
}),
389+
).toBeVisible();
390+
expect(screen.queryByText("Two files.")).toBeNull();
391+
unmount();
392+
// Opened from the profile itself, it lists conversations instead.
393+
render(
394+
<Activity agent={agent()} save={vi.fn()} conversation={conversation} />,
395+
);
396+
expect(
397+
screen.getByRole("button", {
398+
name: "View transcript: channel",
399+
}),
400+
).toBeVisible();
401+
expect(screen.queryByText("Two files.")).toBeNull();
402+
});
403+
355404
it("shows the transcript and that sessions may be missing when some history cannot be read", async () => {
356405
localStorage.setItem(
357406
"buzz.claude-code.sessions.v1",

‎src/bundled/claude-code/tabs.tsx‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,9 +704,13 @@ export function createTabs({
704704
function ActivityTab({
705705
agent,
706706
conversation,
707+
initialTranscript,
708+
close,
707709
}: {
708710
agent: AgentViewProps<Config>["agent"];
709711
conversation?: AgentViewProps<Config>["conversation"];
712+
initialTranscript?: AgentViewProps<Config>["initialTranscript"];
713+
close?: AgentViewProps<Config>["close"];
710714
}) {
711715
const sessions = useSyncExternalStore(
712716
(listener) => runtime.subscribe(listener),
@@ -731,7 +735,12 @@ export function createTabs({
731735
const running = busy.get(key);
732736
return running === undefined ? undefined : running ? "Working" : "Idle";
733737
};
734-
const { open, show, back } = useOpenTranscript(conversation, label);
738+
const { open, show, back } = useOpenTranscript(
739+
conversation,
740+
label,
741+
initialTranscript ? here : undefined,
742+
close,
743+
);
735744
return (
736745
<div className={activityStyles.activity}>
737746
{conversation && (

‎src/bundled/codex/tabs.test.tsx‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,50 @@ it("brings an open transcript's tab back, and closes it when the profile moves",
384384
expect(tab(transcript)).toHaveAttribute("aria-selected", "true");
385385
});
386386

387+
it("opened from activity, shows the transcript, and closing it closes the panel", async () => {
388+
const root = "e".repeat(64);
389+
const f = fixture({
390+
saved: {
391+
[JSON.stringify(["channel", root])]: {
392+
threadId: "kept",
393+
workspace: "/w",
394+
at: 2,
395+
},
396+
},
397+
});
398+
const close = vi.fn();
399+
render(
400+
<PanelWorkspace
401+
value="profile"
402+
select={() => undefined}
403+
items={[
404+
{
405+
id: "profile",
406+
label: "Sol",
407+
close: () => undefined,
408+
content: (
409+
<f.tabs.ActivityTab
410+
{...f.props()}
411+
conversation={{ channelId: "channel", rootId: root }}
412+
initialTranscript
413+
close={close}
414+
/>
415+
),
416+
},
417+
]}
418+
/>,
419+
);
420+
const transcript = "#general · thread eeeeeeee";
421+
expect(await screen.findByRole("tab", { name: transcript })).toHaveAttribute(
422+
"aria-selected",
423+
"true",
424+
);
425+
await userEvent.click(
426+
screen.getByRole("button", { name: `Close ${transcript} tab` }),
427+
);
428+
expect(close).toHaveBeenCalledOnce();
429+
});
430+
387431
it("finds the thread's Codex session another build started", async () => {
388432
const root = "f".repeat(64);
389433
const tag = sessionTag("a".repeat(64), { channelId: "channel", root });

‎src/bundled/codex/tabs.tsx‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,9 +814,13 @@ export function createTabs(
814814
function ActivityTab({
815815
agent,
816816
conversation,
817+
initialTranscript,
818+
close,
817819
}: {
818820
agent: AgentViewProps<Config>["agent"];
819821
conversation?: AgentViewProps<Config>["conversation"];
822+
initialTranscript?: AgentViewProps<Config>["initialTranscript"];
823+
close?: AgentViewProps<Config>["close"];
820824
}) {
821825
const sessions = useSyncExternalStore(runtime.subscribe, () =>
822826
runtime.sessions(agent.key),
@@ -832,7 +836,12 @@ export function createTabs(
832836
const recent = conversations
833837
.filter((item) => item.key !== here?.key)
834838
.slice(0, CONVERSATION_LIMIT);
835-
const { open, show, back } = useOpenTranscript(conversation, label);
839+
const { open, show, back } = useOpenTranscript(
840+
conversation,
841+
label,
842+
initialTranscript ? here : undefined,
843+
close,
844+
);
836845
const saved = new Set(conversations.map((row) => row.key));
837846
const views = new Map(sessions.map((view) => [view.key, view]));
838847
const unbound = sessions.filter((view) => !saved.has(view.key));

‎src/bundled/goose/tabs.tsx‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,9 +811,13 @@ export function createTabs({
811811
function ActivityTab({
812812
agent,
813813
conversation,
814+
initialTranscript,
815+
close,
814816
}: {
815817
agent: AgentViewProps<Config>["agent"];
816818
conversation?: AgentViewProps<Config>["conversation"];
819+
initialTranscript?: AgentViewProps<Config>["initialTranscript"];
820+
close?: AgentViewProps<Config>["close"];
817821
}) {
818822
const workspace = readConfig(agent.config).workspace;
819823
const live = useSyncExternalStore(
@@ -862,7 +866,12 @@ export function createTabs({
862866
row.title
863867
? titled(agent.name, row.title)
864868
: `${row.channelId.slice(0, 8)} · ${row.root ? `thread ${row.root.slice(0, 8)}` : "channel"}`;
865-
const { open, show, back } = useOpenTranscript(conversation, label);
869+
const { open, show, back } = useOpenTranscript(
870+
conversation,
871+
label,
872+
initialTranscript ? here : undefined,
873+
close,
874+
);
866875
const rows = (recent.value ?? [])
867876
.filter((row) => row.sessionId !== here?.sessionId)
868877
.slice(0, RECENT_LIMIT)

‎src/bundled/pi/tabs.tsx‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,9 +689,13 @@ export function createTabs({
689689
function ActivityTab({
690690
agent,
691691
conversation,
692+
initialTranscript,
693+
close,
692694
}: {
693695
agent: AgentViewProps<Config>["agent"];
694696
conversation?: AgentViewProps<Config>["conversation"];
697+
initialTranscript?: AgentViewProps<Config>["initialTranscript"];
698+
close?: AgentViewProps<Config>["close"];
695699
}) {
696700
const working = useSyncExternalStore(
697701
(listener) => runtime.subscribe(listener),
@@ -725,6 +729,8 @@ export function createTabs({
725729
<PlaceList
726730
agent={agent}
727731
conversation={conversation}
732+
initialTranscript={initialTranscript}
733+
close={close}
728734
places={places}
729735
working={working}
730736
/>
@@ -734,11 +740,15 @@ export function createTabs({
734740
function PlaceList({
735741
agent,
736742
conversation,
743+
initialTranscript,
744+
close,
737745
places,
738746
working,
739747
}: {
740748
agent: AgentViewProps<Config>["agent"];
741749
conversation?: AgentViewProps<Config>["conversation"];
750+
initialTranscript?: AgentViewProps<Config>["initialTranscript"];
751+
close?: AgentViewProps<Config>["close"];
742752
places: readonly Place[];
743753
working: readonly number[];
744754
}) {
@@ -749,7 +759,12 @@ export function createTabs({
749759
);
750760
const status = (place: Place) =>
751761
working.includes(place.conversation) ? "Working" : undefined;
752-
const { open, show, back } = useOpenTranscript(conversation, label);
762+
const { open, show, back } = useOpenTranscript(
763+
conversation,
764+
label,
765+
initialTranscript ? here : undefined,
766+
close,
767+
);
753768
const recent = places
754769
.filter((place) => place.key !== here?.key)
755770
.slice(0, CONVERSATION_LIMIT);

‎src/bundled/profiles/ProfilePanel.test.tsx‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ it("exposes thinking through the named profile avatar across tabs", async () =>
349349
function renderAgentActivity(
350350
tabs: { title: string; role?: string }[],
351351
rootId?: string,
352+
transcript = false,
352353
) {
353354
const owner = createRelaySession(null);
354355
const snapshot = {
@@ -372,11 +373,14 @@ function renderAgentActivity(
372373
role,
373374
component: ({
374375
conversation,
376+
initialTranscript,
375377
}: {
376378
conversation?: { channelId: string; rootId?: string };
379+
initialTranscript?: boolean;
377380
}) => (
378381
<>
379382
<p>Echo {title.toLowerCase()}</p>
383+
{initialTranscript && <p>Transcript first</p>}
380384
{conversation && (
381385
<p>
382386
Opened from {conversation.channelId}/
@@ -410,7 +414,7 @@ function renderAgentActivity(
410414
<ProfilePanel
411415
relay={relay}
412416
agents={agents}
413-
target={profileActivityViewTarget(key) ?? ""}
417+
target={profileActivityViewTarget(key, { transcript }) ?? ""}
414418
context={{
415419
channelId: "originating-channel",
416420
...(rootId && { rootId }),
@@ -454,6 +458,24 @@ it("opens an agent's activity on its type's Activity tab, the profile's only one
454458
}
455459
});
456460

461+
it("asks the Activity tab for its transcript only when the opener knows the conversation", () => {
462+
const tabs = [{ title: "Activity", role: "activity" }];
463+
// Work in several threads opens the plain destination, never a transcript.
464+
let dispose = renderAgentActivity(tabs);
465+
try {
466+
expect(screen.getByText("Echo activity")).toBeVisible();
467+
expect(screen.queryByText("Transcript first")).toBeNull();
468+
} finally {
469+
dispose();
470+
}
471+
dispose = renderAgentActivity(tabs, "thread-root", true);
472+
try {
473+
expect(screen.getByText("Transcript first")).toBeVisible();
474+
} finally {
475+
dispose();
476+
}
477+
});
478+
457479
it("opens an agent's activity on its type's first tab when the type has no Activity tab", () => {
458480
const dispose = renderAgentActivity([
459481
{ title: "Settings", role: "settings" },

0 commit comments

Comments
 (0)