diff --git a/docs/plugin-authoring-guide.md b/docs/plugin-authoring-guide.md index b270017200..570c7f4183 100644 --- a/docs/plugin-authoring-guide.md +++ b/docs/plugin-authoring-guide.md @@ -96,6 +96,16 @@ then. Use compact icon buttons with an `aria-label` and `title`, and set workspace with `registerWorkspace(component, { slots })` names the optional props its component renders. +Check `ctx.conversation.workspaceSlots?.trailing === true` in the same way +before passing `trailing` to `ui.Workspace`. The Channels workspace shows that +content as a card over the +bottom of the channel timeline, in its own scroll layer: scrolling over the +card grows it, then slides it up. Render the whole card at rest too, since +growing scrolls it into view: let `expanded` change labels, not what the card +holds. Keep its controls in view with `position: sticky; bottom: 0` and an +opaque background, and draw its outline with a box shadow rather than a bottom +border. + For `ctx.agents.ui.Transcript`, give each turn a unique `turnId` that stays the same across reads. Return a new turn when it changes. Leave previously returned turns and their items untouched. ## Migration writes diff --git a/src/bundled/channels/ChannelBody.tsx b/src/bundled/channels/ChannelBody.tsx index 19cf1189c2..58502008c1 100644 --- a/src/bundled/channels/ChannelBody.tsx +++ b/src/bundled/channels/ChannelBody.tsx @@ -16,6 +16,7 @@ import styles from "./Channels.module.css"; export const ChannelBody = memo(function ChannelBody({ cached, intro, + trailing, latestRequest, viewer, revealMessageId, @@ -30,6 +31,7 @@ export const ChannelBody = memo(function ChannelBody({ onContentReady?(channelId: string): void; cached: boolean; intro?: ReactNode; + trailing?: ChannelTimelineProps["trailing"]; latestRequest?: AbortSignal | undefined; viewer?: string | undefined; navigation?: PageNavigation | undefined; @@ -127,6 +129,7 @@ export const ChannelBody = memo(function ChannelBody({ ({ inlineTarget, marksRead, onOpenThread, + trailing, }: { holding?: boolean; inlineTarget?: { messageId: string }; marksRead?: boolean; onOpenThread(id: string, root: string, intent?: "reply"): void; + trailing?: { content(state: object): import("react").ReactNode }; }) => { threadOpeners.push(onOpenThread); return ( @@ -79,6 +81,7 @@ vi.mock("./ChannelBody", () => ({ data-marks-read={marksRead} > Conversation content + {trailing?.content({ expanded: false, toggle() {} })} ); }, @@ -641,6 +644,28 @@ it("a conversation tab opens a reply at its message as the thread", () => { expect(screen.queryByText("Conversation content")).toBeNull(); }); +it.each(["conversation", "thread"] as const)( + "only a channel timeline shows the workspace's trailing content (%s)", + (kind) => { + const c = openingAt([]); + render( +

Decision card

}} + />, + ); + c.settle(); + expect(screen.queryByText("Decision card") !== null).toBe( + kind === "conversation", + ); + }, +); + it("a thread tab asks its reader to reveal for each open at a message, not on restore", () => { const c = openingAt([]); const tab = { diff --git a/src/bundled/channels/ConversationTab.tsx b/src/bundled/channels/ConversationTab.tsx index 7221945b4e..a88612dfd4 100644 --- a/src/bundled/channels/ConversationTab.tsx +++ b/src/bundled/channels/ConversationTab.tsx @@ -8,7 +8,10 @@ import { } from "react"; import type { ChannelSummary } from "../../features/relay/contracts"; import type { RelaySession } from "../../features/relay/session"; -import type { ConversationExtensions } from "../../features/conversation/contracts"; +import type { + ConversationExtensions, + ConversationWorkspaceProps, +} from "../../features/conversation/contracts"; import { ConversationChannel, ConversationComposer, @@ -29,6 +32,8 @@ import styles from "./ChannelTabs.module.css"; type ConversationTabProps = { tab: Tab; intro?: ReactNode; + /** Only the channel timeline shows it, not a thread. */ + trailing?: ConversationWorkspaceProps["trailing"]; subthreadId?: string | undefined; latestRequest?: AbortSignal | undefined; active: boolean; @@ -57,6 +62,7 @@ type ConversationTabProps = { export function ConversationTab({ tab, intro, + trailing, subthreadId, latestRequest, active, @@ -208,6 +214,7 @@ export function ConversationTab({ ({ onResolvedRoot, parent, intro, + trailing, }: { intro?: import("react").ReactNode; + trailing?: { content(state: object): import("react").ReactNode }; tab: Tab; channel: { name: string }; visit: boolean; @@ -52,6 +54,7 @@ vi.mock("./ConversationTab", () => ({ > {intro} {tab.kind} in {channel.name} + {trailing?.content({ expanded: false, toggle() {} })} {!visit && " unvisited"} {onResolvedRoot && ( + + + + ), + }; +}