Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs/plugin-authoring-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,24 @@ 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.

Check `ctx.conversation.workspaceSlots?.aside === true` before passing `aside`
to `ui.Workspace`. The host places it in a box of `asideWidth` (default 320)
over the history's end edge, left of its scrollbar. Docked, it runs from the
history's top to the reader's bottom, and the history's rows and the composer
keep to the width beside it; when the reader would get too narrow, it floats
over the history instead, above the composer. The box
draws nothing in either mode: draw your own card, let it size to its content,
and scroll inside it when it is taller than the box. Only your content takes
pointer input, so the wheel beside or below it scrolls the history. A popover
escapes over the history only from a portal, as `ui.Menu`'s does.
Drive it from your own header control with `asideOpen` and
`onAsideOpenChange`: docked, it shows by default; floating, it shows only once
opened. The host closes it as it floats, restores the docked state when the
reader widens, and closes the overlay on Escape or a press elsewhere in the
reader, reporting each change. Without that control a floating aside stays
closed. `onAsideFloatingChange` tells you whether it floats, for example to
close it after a pick. Messages under the overlay are not marked read.

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
Expand Down
38 changes: 38 additions & 0 deletions src/bundled/channels/Channels.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,49 @@
.soloConversation {
container: solo-conversation / inline-size;
}
/* A workspace's main reader and the page's aside (WorkspaceRow). Isolated, a
floating aside stacks over the reader, never over a narrow dock. */
.workspaceRow {
position: relative;
isolation: isolate;
display: flex;
height: 100%;
min-width: 0;
min-height: 0;
overflow: hidden;
}
.workspaceReader {
flex: 1;
min-height: 0;
min-width: 0;
}
/* The page's aside, from the history's top over its end edge, beside its
scrollbar. Docked, it may run to the reader's bottom, beside the composer;
floating, it stops at the history's bottom, above the composer. It draws
nothing itself: its content draws its card, sizes to it, and scrolls itself
when taller. Only that content takes pointer input, so the wheel beside or
below it scrolls the history. */
.workspaceAside {
position: absolute;
z-index: 1;
display: flex;
flex-direction: column;
inset-block-start: var(--aside-top, 0px);
inset-inline-end: var(--aside-scrollbar, 0px);
max-block-size: var(--aside-height, 100%);
max-inline-size: 100%;
pointer-events: none;
}
.workspaceAside[data-workspace-aside="docked"] {
max-block-size: calc(100% - var(--aside-top, 0px));
}
.workspaceAside > * {
min-block-size: 0;
pointer-events: auto;
}
.workspaceAside[hidden] {
display: none;
}
.conversation
:is(
[data-tab-pane-toggle],
Expand Down
31 changes: 31 additions & 0 deletions src/bundled/channels/PageTabs.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,37 @@ it("a workspace gives its trailing content to its main reader", () => {
expect(screen.getByText("Decision card")).toBeVisible();
});

it.each([
["channel", { channelId: "alpha" }, "conversation in alpha"],
["thread", { channelId: "alpha", threadId: "root" }, "thread in alpha"],
] as const)(
"a workspace docks its aside beside a %s reader",
(_, target, label) => {
const f = fixture();
cleanup();
vi.spyOn(HTMLElement.prototype, "getBoundingClientRect").mockReturnValue(
new DOMRect(0, 0, 1200, 600),
);
render(
<ConversationWorkspace
id="task"
session={f.session}
scope="origin:viewer"
target={target}
label="Task"
host={f.host}
aside={<aside aria-label="Task dashboard" />}
asideWidth={280}
/>,
);
const reader = screen.getByText(label, { exact: false });
const aside = screen.getByRole("complementary", { name: "Task dashboard" });
expect(reader.parentElement?.nextElementSibling).toBe(aside.parentElement);
expect(aside.parentElement).toHaveStyle({ inlineSize: "280px" });
expect(screen.getByRole("tabpanel")).toContainElement(aside);
},
);

it.each([false, true])(
"a workspace shows its header actions before the actions menu (menu=%s)",
(menu) => {
Expand Down
99 changes: 52 additions & 47 deletions src/bundled/channels/PageTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import { panelOpening } from "../../features/panels/service";
import { coveringDock, useCoveredByDock } from "./useCoveredByDock";
import styles from "./Channels.module.css";
import { BOARD_MAIN_MIN_REM } from "./panel-split";
import { WorkspaceRow } from "./WorkspaceRow";

export type { PageTabOptions, PageTabsProps, PageTabTarget };

Expand Down Expand Up @@ -553,53 +554,57 @@ export function PageTabs({
),
actions: workspace?.actions,
content: workspace ? (
<div className={styles.conversation}>
<div className={styles.workspaceReader}>
{primaryTab &&
primaryChannel &&
secondary.canOpenConversation(primaryChannel.id) ? (
<ConversationReader
key={JSON.stringify(primaryTarget)}
tab={primaryTab}
intro={workspace.intro}
trailing={workspace.trailing}
subthreadId={primaryTarget?.subthreadId}
latestRequest={latestRequest}
active={
secondary.selectedMain === "conversation" &&
!covered
}
channel={primaryChannel}
session={session}
scope={scope}
extensions={extensions}
openLink={(url, origin) =>
secondary.openConversationLink(
primaryChannel.id,
url,
origin,
)
}
canOpenLink={(target) =>
!!host.panels.resolve(target)
}
openThread={(messageId, rootId, intent) =>
secondary.openConversationThread(
primaryChannel.id,
messageId,
rootId,
intent,
)
}
close={() => {}}
/>
) : (
<p role="status" className={styles.empty}>
This conversation is no longer available.
</p>
)}
</div>
</div>
<WorkspaceRow
aside={workspace.aside}
width={workspace.asideWidth}
open={workspace.asideOpen}
onOpenChange={workspace.onAsideOpenChange}
onFloatingChange={workspace.onAsideFloatingChange}
>
{primaryTab &&
primaryChannel &&
secondary.canOpenConversation(primaryChannel.id) ? (
<ConversationReader
key={JSON.stringify(primaryTarget)}
tab={primaryTab}
intro={workspace.intro}
trailing={workspace.trailing}
subthreadId={primaryTarget?.subthreadId}
latestRequest={latestRequest}
active={
secondary.selectedMain === "conversation" &&
!covered
}
channel={primaryChannel}
session={session}
scope={scope}
extensions={extensions}
openLink={(url, origin) =>
secondary.openConversationLink(
primaryChannel.id,
url,
origin,
)
}
canOpenLink={(target) =>
!!host.panels.resolve(target)
}
openThread={(messageId, rootId, intent) =>
secondary.openConversationThread(
primaryChannel.id,
messageId,
rootId,
intent,
)
}
close={() => {}}
/>
) : (
<p role="status" className={styles.empty}>
This conversation is no longer available.
</p>
)}
</WorkspaceRow>
) : (
children(open, close, isOpen)
),
Expand Down
Loading
Loading