From 14cccbaf1200674ee0feb33c878ca3a8ec764830 Mon Sep 17 00:00:00 2001 From: Gil Birman Date: Thu, 19 Nov 2026 23:43:47 -0600 Subject: [PATCH 1/2] feat(conversation): render a page's aside beside the workspace reader `ConversationWorkspaceProps.aside` renders after the main tab's reader, between the transcript and the side pane, in a positioned row that is the aside's offset parent. The aside sets its own width. Plugins detect the slot with `conversation.workspaceSlots.aside === true`; an older host ignores the prop. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Gil Birman --- docs/plugin-architecture.md | 9 +++++++++ docs/plugin-authoring-guide.md | 6 +++++- src/bundled/channels/Channels.module.css | 9 +++++++++ src/bundled/channels/PageTabs.test.tsx | 20 ++++++++++++++++++++ src/bundled/channels/PageTabs.tsx | 3 ++- src/features/conversation/contracts.ts | 3 +++ src/features/conversation/service.test.tsx | 11 +++++++++++ src/features/conversation/service.tsx | 8 ++++++++ 8 files changed, 67 insertions(+), 2 deletions(-) diff --git a/docs/plugin-architecture.md b/docs/plugin-architecture.md index 2016330cc9..7c6eaf6d91 100644 --- a/docs/plugin-architecture.md +++ b/docs/plugin-architecture.md @@ -3341,6 +3341,15 @@ The tab workspace belongs to Channels, which supplies it with slot. `ui.Tabs` is undefined while no enabled plugin provides it, so a page reads it at render and falls back to its own layout. +`conversation.ui.Workspace` comes from the same provider. Its optional props +grow over time, so `conversation.workspaceSlots` names each one this host +renders as `true`. An older host lacks the flag, or the whole object, and +ignores the prop. +With `workspaceSlots.aside`, `aside` renders after the main tab's reader, +between the transcript and the side pane. The host gives it no width, frame or +scrolling. Its offset parent is the row of the reader and the aside, so a page +can watch that row's size to choose its own layout. + `open({ channelId, messageId })` opens the conversation at that message. The shared `useMessageOpening` reader waits for verified history (cached rows decide nothing), reads older pages until the message loads (at most 25 pages diff --git a/docs/plugin-authoring-guide.md b/docs/plugin-authoring-guide.md index 52f7433229..6ba36ae198 100644 --- a/docs/plugin-authoring-guide.md +++ b/docs/plugin-authoring-guide.md @@ -317,7 +317,7 @@ Add `"host"` to `inject`, then: Check that it exists before use. Channels supplies it through `registerWorkspace`, with the same provider lifetime as `ui.Tabs`. Set the page's `layout` to `"workspace"`. Pass - `{ id, session, scope, target, label, intro?, actions?, detail?, latestRequest? }`. + `{ id, session, scope, target, label, intro?, aside?, actions?, detail?, latestRequest? }`. Set `target` to `{ channelId, threadId?, subthreadId?, messageId? }`. Omit `threadId` for the channel timeline. Supply a thread ID to show the thread. Add `subthreadId` to show and compose within a branch of that thread. @@ -327,6 +327,10 @@ Add `"host"` to `inject`, then: the signal to that opening. Omit it on Back or Forward. An aborted signal is ignored, and an explicit `target.messageId` takes precedence. `intro` supplies content at the start of history. It scrolls with the messages. + `aside` renders after the main tab's reader, before the side pane, when + `ctx.conversation.workspaceSlots?.aside === true`; an older host ignores it. + It sets its own width. Its offset parent is the row of the reader and the + aside. `actions` supplies entries in the header's three-dot menu and the tab's context menu, with `{ label, run() }`. `detail: { target, rootId? }` initially selects a panel diff --git a/src/bundled/channels/Channels.module.css b/src/bundled/channels/Channels.module.css index 7c5f196aa0..94a76d5651 100644 --- a/src/bundled/channels/Channels.module.css +++ b/src/bundled/channels/Channels.module.css @@ -51,6 +51,15 @@ .soloConversation { container: solo-conversation / inline-size; } +/* A workspace's main reader and the page's aside, which this row positions. */ +.workspaceRow { + position: relative; + display: flex; + height: 100%; + min-width: 0; + min-height: 0; + overflow: hidden; +} .workspaceReader { flex: 1; min-height: 0; diff --git a/src/bundled/channels/PageTabs.test.tsx b/src/bundled/channels/PageTabs.test.tsx index 3454cb76a9..babb13df7e 100644 --- a/src/bundled/channels/PageTabs.test.tsx +++ b/src/bundled/channels/PageTabs.test.tsx @@ -452,6 +452,26 @@ it("a workspace owns its main reader, intro, menu, and no initial detail", async expect(source).toHaveBeenCalledOnce(); }); +it("a workspace places its aside after the main reader, in the reader's row", () => { + const f = fixture(); + cleanup(); + render( + } + />, + ); + const reader = screen.getByText("conversation in alpha", { exact: false }); + const aside = screen.getByRole("complementary", { name: "Task dashboard" }); + expect(reader.parentElement?.nextElementSibling).toBe(aside); + expect(screen.getByRole("tabpanel")).toContainElement(aside); +}); + it.each([false, true])( "a workspace requests composer focus unless another editor owns it (editing=%s)", (editing) => { diff --git a/src/bundled/channels/PageTabs.tsx b/src/bundled/channels/PageTabs.tsx index 92b75e9326..79697be6a3 100644 --- a/src/bundled/channels/PageTabs.tsx +++ b/src/bundled/channels/PageTabs.tsx @@ -528,7 +528,7 @@ export function PageTabs({ ), actions: workspace?.actions, content: workspace ? ( -
+
{primaryTab && primaryChannel && @@ -573,6 +573,7 @@ export function PageTabs({

)}
+ {workspace.aside}
) : ( children(open, close, isOpen) diff --git a/src/features/conversation/contracts.ts b/src/features/conversation/contracts.ts index 4c053aeb51..a4bc5a65ea 100644 --- a/src/features/conversation/contracts.ts +++ b/src/features/conversation/contracts.ts @@ -482,6 +482,9 @@ export type ConversationWorkspaceProps = { label: string; /** Content at the start of history. It scrolls with the messages. */ intro?: ReactNode; + /** Content after the main tab's reader, before the side pane. It sets its + * own width; its offset parent is the row of the reader and the aside. */ + aside?: ReactNode; /** Actions in the pane's menu and the main tab's context menu. */ actions?: readonly { label: string; run(): void }[]; /** Select this panel on entry. Closing it keeps the main conversation. */ diff --git a/src/features/conversation/service.test.tsx b/src/features/conversation/service.test.tsx index f71ec423d1..0fa37c70c7 100644 --- a/src/features/conversation/service.test.tsx +++ b/src/features/conversation/service.test.tsx @@ -103,6 +103,17 @@ it("provides ui.Tabs only while a plugin supplies the tab workspace", async () = h.runtime.reconcile([]); await vi.waitFor(() => expect(h.service.ui.Tabs).toBeUndefined()); }); +it("tells plugins that ui.Workspace renders an aside", async () => { + let slots: unknown; + const h = harness({ + inject: ["conversation"], + apply(ctx) { + slots = ctx.conversation.workspaceSlots; + }, + }); + h.runtime.reconcile([h.plugin]); + await vi.waitFor(() => expect(slots).toHaveProperty("aside", true)); +}); it("bundled Emoji really registers a picker and a renderer, including reaction metadata", async () => { const h = harness(emoji); h.runtime.reconcile([h.plugin]); diff --git a/src/features/conversation/service.tsx b/src/features/conversation/service.tsx index c86e42f7d9..981c7c8068 100644 --- a/src/features/conversation/service.tsx +++ b/src/features/conversation/service.tsx @@ -134,6 +134,11 @@ export type Conversation = { registerTabs(component: ComponentType): void; /** Provides `ui.Workspace` while the plugin runs; the first one wins. */ registerWorkspace(component: ComponentType): void; + /** The optional `ui.Workspace` props this host renders; check one before + * passing it. */ + readonly workspaceSlots: Readonly<{ + aside: true; + }>; /** Solo chat icons; the sidebar shows the first one. */ chatIcons: ContributionReader; /** Shows `component` as each Solo chat's sidebar icon while the providing @@ -216,6 +221,9 @@ export class ConversationService extends Service implements Conversation { readonly chatIcons; private readonly chatIconEntries; readonly ui: Conversation["ui"]; + readonly workspaceSlots: Conversation["workspaceSlots"] = Object.freeze({ + aside: true, + }); constructor(ctx: Context) { super(ctx, "conversation"); const attachments = createContributions(ctx); From 0e8b323283105f91de409da5965520b0c9a063c4 Mon Sep 17 00:00:00 2001 From: Gil Birman Date: Fri, 20 Nov 2026 00:26:34 -0600 Subject: [PATCH 2/2] Address review feedback round 1 - Cover the aside's offset parent and its place between the transcript and the side pane in the conversation workspace browser suite; jsdom cannot compute layout. Fails without `.workspaceRow`'s position. - Type `workspaceSlots` and its flag as optional, as other feature-detected capabilities are, so plugin code checks before use. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Gil Birman --- src/features/conversation/service.tsx | 10 ++--- tests/browser/conversation-workspace.spec.mjs | 38 +++++++++++++++++++ tests/browser/plugin-fixtures.tsx | 4 ++ 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/src/features/conversation/service.tsx b/src/features/conversation/service.tsx index 981c7c8068..b22e94ad06 100644 --- a/src/features/conversation/service.tsx +++ b/src/features/conversation/service.tsx @@ -134,10 +134,10 @@ export type Conversation = { registerTabs(component: ComponentType): void; /** Provides `ui.Workspace` while the plugin runs; the first one wins. */ registerWorkspace(component: ComponentType): void; - /** The optional `ui.Workspace` props this host renders; check one before - * passing it. */ - readonly workspaceSlots: Readonly<{ - aside: true; + /** The optional `ui.Workspace` props this host renders. An older host lacks + * a slot's flag, or the whole object, and ignores that prop. */ + readonly workspaceSlots?: Readonly<{ + aside?: true; }>; /** Solo chat icons; the sidebar shows the first one. */ chatIcons: ContributionReader; @@ -221,7 +221,7 @@ export class ConversationService extends Service implements Conversation { readonly chatIcons; private readonly chatIconEntries; readonly ui: Conversation["ui"]; - readonly workspaceSlots: Conversation["workspaceSlots"] = Object.freeze({ + readonly workspaceSlots = Object.freeze({ aside: true, }); constructor(ctx: Context) { diff --git a/tests/browser/conversation-workspace.spec.mjs b/tests/browser/conversation-workspace.spec.mjs index 30b8fd1a71..d032d6c35b 100644 --- a/tests/browser/conversation-workspace.spec.mjs +++ b/tests/browser/conversation-workspace.spec.mjs @@ -139,6 +139,44 @@ test("reselect uncovers the transcript and keeps the narrow reply dock available await expect(side).toBeVisible(); }); +test("an aside sits between the transcript and the side pane, positioned by their row", async ({ + page, + app, +}) => { + await open(page, app); + const region = history(page); + await select(page, { channelId: "alpha" }); + await expectBottom(page, region); + const replyTab = await openReplyTab(app, region); + const dock = page.locator("[data-panel-workspace]"); + await expect(dock.getByRole("tab", { name: replyTab })).toBeVisible(); + + const aside = page.getByRole("complementary", { name: "Reader aside" }); + // The page's content sets the aside's width. + await aside.evaluate((element) => { + element.style.width = "160px"; + }); + const layout = await aside.evaluate((element) => { + const box = (node) => node.getBoundingClientRect(); + const row = element.offsetParent; + const history = document.querySelector( + '[aria-label="Channel message history"]', + ); + return { + inRow: row === element.parentElement && row.contains(history), + aside: box(element), + row: box(row), + history: box(history), + dock: box(document.querySelector("[data-panel-workspace]")), + }; + }); + expect(layout.inRow).toBe(true); + expect(layout.aside.width).toBe(160); + expect(layout.history.right).toBeLessThanOrEqual(layout.aside.left); + expect(layout.aside.right).toBe(layout.row.right); + expect(layout.aside.right).toBeLessThanOrEqual(layout.dock.left); +}); + test("a gesture retires a queued latest request before new messages arrive", async ({ page, app, diff --git a/tests/browser/plugin-fixtures.tsx b/tests/browser/plugin-fixtures.tsx index 9bd89e879a..8caa493df1 100644 --- a/tests/browser/plugin-fixtures.tsx +++ b/tests/browser/plugin-fixtures.tsx @@ -508,6 +508,10 @@ export const fixturePlugins: readonly BundledPlugin[] = [ scope={connection.scope} label="Transcript fixture" target={target} + // Zero width, so only the aside test changes the layout. + aside={ +