Files
buzz/desktop/src/features/channels/lib/agentSessionPanelPresentation.ts
ss-dev-00 403de26214 feat(desktop): pin the conversation transcript variant to the cover drawer
The last wire of the feature, and what makes the four slices above one thing:
the cover drawer now renders the conversation transcript, so opening agent
activity in a channel lands in the reading view rather than the dense activity
feed. Resolves the `TODO(#6538)` slice A landed with.

The variant is chosen by presentation, not inferred from panel width. Width was
only ever a proxy, and a breakable one — the split pane can be dragged wide and
a narrow overlay can be tall. The presentation that already decided to cover is
the thing that knows this is a reading surface, so it decides the variant too.

Non-cover hosts return `undefined` rather than `"default"`: the panel already
defaults, and naming it here would imply this function decides the non-cover
variant when the profile panel picks `compactPreview` at its own call site.

Asserted end-to-end on the transcript's `data-transcript-variant` marker rather
than on the prop, so the test proves the value survives the whole path from the
resolver through `ChannelAgentSessionSurface` and the panel to the transcript.
It lives in the screenshot spec because the marker only renders once the
transcript has content, and that is the spec that seeds a turn. Verified
discriminating: reverting the pinned value alone fails the assertion.

Co-authored-by: Bradley Axen <baxen@squareup.com>
Signed-off-by: Bradley Axen <baxen@squareup.com>
Signed-off-by: ss-dev-00 <a02c4e0850e5e612b4ddf95dbe2f5c56467cf27c6552203bc833ff438fb31971@buzz.block.builderlab.xyz>
2026-08-26 15:29:31 -07:00

66 lines
2.5 KiB
TypeScript

import type { AgentSessionTranscriptVariant } from "@/features/agents/ui/agentSessionTranscriptContext";
/**
* `AnimatePresence` key shared by every agent activity presentation.
*
* The split pane and the cover drawer are two containers for one session, so
* presence is a property of the session, not of either container — crossing the
* viewport breakpoint changes how it is shown, not whether it is open.
*/
export const AGENT_SESSION_SURFACE_KEY = "agent-session-surface";
export type AgentSessionPanelPresentation = {
enterMotion: boolean;
isSinglePanelView: boolean;
layout: "standalone" | "split";
transcriptVariant: AgentSessionTranscriptVariant | undefined;
transparentChrome: boolean;
};
type AgentSessionPanelPresentationOptions = {
/** The panel is rendered inside the agent activity cover drawer. */
isCoverDrawer: boolean;
isSinglePanelView: boolean;
useSplitAuxiliaryPane: boolean;
};
/**
* Maps channel presentation into the agent session panel's layout props.
*
* The transcript variant is pinned here rather than inferred from panel width.
* The cover drawer is the reading surface, so it gets `conversation`; every
* other host keeps the dense activity feed. Width is a proxy that breaks — the
* split pane can be dragged wide and a narrow overlay can be tall — so the
* presentation that decided to cover is what decides the reading view too.
*/
export function getAgentSessionPanelPresentation({
isCoverDrawer,
isSinglePanelView,
useSplitAuxiliaryPane,
}: AgentSessionPanelPresentationOptions): AgentSessionPanelPresentation {
if (isCoverDrawer) {
return {
// The drawer animates itself; a second slide inside it would compound.
enterMotion: false,
// Fills the drawer, and selects the standalone header chrome that owns
// its own backdrop — the drawer is not sharing the channel's header, and
// it has no resizable neighbour to draw a resize border against.
isSinglePanelView: true,
layout: "standalone",
transcriptVariant: "conversation",
transparentChrome: false,
};
}
return {
enterMotion: true,
isSinglePanelView: useSplitAuxiliaryPane ? false : isSinglePanelView,
layout: useSplitAuxiliaryPane ? "split" : "standalone",
// Undefined, not `"default"`: the panel already defaults, and naming it
// here would claim this function decides the non-cover variant when the
// profile panel's `compactPreview` is chosen at its own call site.
transcriptVariant: undefined,
transparentChrome: useSplitAuxiliaryPane,
};
}