Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0281a8d
An app's steps are drawn one way, running or done, by the app's name
ataibarkai Dec 4, 2026
dd763b0
A run of steps on one app draws its logo once
ataibarkai Dec 4, 2026
313d885
A running line's text in the reduced-motion test includes "In progress"
ataibarkai Dec 5, 2026
0a69979
An app leads its run of steps: named once, with what was done on it u…
ataibarkai Dec 5, 2026
17f2e5b
A run of one app's steps is that app's line, and rows show its logo, …
ataibarkai Dec 5, 2026
78e9109
A turn's line on one app names it, and every app's logo names its app…
ataibarkai Dec 5, 2026
683d732
A turn's line on one app leads with its name, and its rows on that ap…
ataibarkai Dec 5, 2026
5bad4f4
A step that doesn't open draws its mark in the chevrons' column when …
ataibarkai Dec 5, 2026
fe85f21
A step the server ran is one more row in a turn's opened list, and "w…
ataibarkai Dec 5, 2026
81b8562
The answered-approval layout test finds the turn's work line in eithe…
ataibarkai Dec 5, 2026
16e2fb1
Merge branch 'main' of https://github.com/CopilotKit/openbot into cla…
ataibarkai Dec 5, 2026
29033cd
A lone step on an app is its app's line from its first call, so a sec…
ataibarkai Dec 5, 2026
9941346
Between steps the last line says "Thinking" itself, and a line never …
ataibarkai Dec 5, 2026
4edde5c
A conversation's turn is one group while it runs: its thoughts on the…
ataibarkai Dec 5, 2026
4b9d73d
Browser tests find the Bot's words on the turn's running line as well…
ataibarkai Dec 5, 2026
84e397e
"See all" is the Button primitive, in line with the subtask rows; a s…
ataibarkai Dec 5, 2026
54a72e5
A subtask opens in a view of its own, read as a conversation: what th…
ataibarkai Dec 5, 2026
0d8ff58
The conversation stays under a subtask's page, and a subtask opened a…
ataibarkai Dec 5, 2026
0125cfa
Merge remote-tracking branch 'origin/main' into claude/subtask-own-vi…
ataibarkai Dec 5, 2026
67c2100
A subtask's view and its page are tested as a person uses them, and i…
ataibarkai Dec 5, 2026
b3cb723
The subtask page's browser test and fixture typecheck
ataibarkai Dec 5, 2026
2282275
The transcript's imports stay in order
ataibarkai Dec 5, 2026
0910156
A subtask's view hands its messages one value for what it was asked
ataibarkai Dec 5, 2026
aa37201
Back from a subtask focuses its row in Safari too, and after opening …
ataibarkai Dec 5, 2026
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
26 changes: 24 additions & 2 deletions app/src/components/channels/chat-transcript.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ import {
type SlackNames,
slackNamesIn,
} from "@/lib/slack/mentions";
import {
publishThreadSubtasks,
subtasksOf,
} from "@/lib/subagents/thread-subtasks";
import { readTeamBotConsent } from "@/lib/team-bots";
import { cn } from "@/lib/utils";
import { VOICE_CHAT_ACTIVITY, type VoiceChatEntry } from "@/lib/voice/archive";
Expand Down Expand Up @@ -195,6 +199,7 @@ import { mendedSends } from "./mended-sends";
import { usePacedReveal } from "./paced-reveal";
import { latestPlanPerTurn } from "./plan-turns";
import { ResearchResults } from "./research-results";
import { SubtaskAskContext } from "./subtask-ask";
import { TeamBotConsentCard } from "./team-bot-consent";
import {
MakeArtifactToolbar,
Expand Down Expand Up @@ -579,6 +584,8 @@ function Stopped({
if (event.key !== "Escape" || event.defaultPrevented) return;
const at = event.target instanceof Element ? event.target : null;
if (at?.closest(ESCAPE_BELONGS_TO)) return;
// A subtask's page over the conversation takes Escape: it goes back (`SubtaskPage`).
if (document.querySelector('[data-slot="subtask-page"]')) return;
onDismiss();
};
document.addEventListener("keydown", onKey);
Expand Down Expand Up @@ -1243,6 +1250,7 @@ const TranscriptMessage = memo(function TranscriptMessage({
}) {
const isUser = role === "user";
const live = useArrivedLive();
const subtaskAsk = useContext(SubtaskAskContext);
const [mode] = useState(() => messageMode(live, streaming));
// A person's message arrives whole; only a Bot's reply is paced.
const revealed = usePacedReveal(text, {
Expand All @@ -1263,13 +1271,18 @@ const TranscriptMessage = memo(function TranscriptMessage({
* A task thread's first message is the Bot's brief, not something the person typed: drawn as sent
* from the Bot, without the words that frame it for the model. See `frameBrief`.
*/
const brief = isUser ? readBrief(text) : null;
const asked = isUser && subtaskAsk?.messageId === messageId;
const brief = asked ? text : isUser ? readBrief(text) : null;
if (brief !== null) {
return (
<MessageRow align="end">
<MessageContent>
<Arriving>
<SentFromBot brief={brief} threadId={threadId} />
<SentFromBot
brief={brief}
threadId={threadId}
{...(asked && subtaskAsk ? { from: subtaskAsk.from } : {})}
/>
</Arriving>
</MessageContent>
</MessageRow>
Expand Down Expand Up @@ -2789,6 +2802,15 @@ export function ChatTranscript({
if (taskThread && threadId)
publishThreadWork(threadId, threadWorkOf(visible));
});
/*
* Its subtasks, for the view that opens one of them (`thread-subtasks.ts`), once it draws the live
* conversation: not while its history is on its way, nor while it draws a copy of it (what was
* kept from last time, or the history the join replays), which may not hold every turn yet.
*/
useEffect(() => {
if (threadId && !restoring && !readOnly && !kept)
publishThreadSubtasks(threadId, subtasksOf(visible, busy));
});
const taskWork = {
folds,
lastAskId: [...folds.at.values()].at(-1)?.askId,
Expand Down
19 changes: 19 additions & 0 deletions app/src/components/channels/open-subtask.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { createContext, useContext } from "react";

/**
* Where a subtask's row takes the person: the subtask's own view (`SubtaskView`), given by the
* screen that can show it. A transcript drawn where nothing can show one (a subtask's own view, a
* preview) has none, and its rows open in place to their steps, as they did before there was a view.
*/
export type OpenSubtask = {
/** The address of a subtask's view, so the row is a real link: a new tab, a copied link. */
hrefOf: (toolCallId: string) => string;
/** Open it here. */
open: (toolCallId: string) => void;
};

export const OpenSubtaskContext = createContext<OpenSubtask | null>(null);

export function useOpenSubtask(): OpenSubtask | null {
return useContext(OpenSubtaskContext);
}
16 changes: 16 additions & 0 deletions app/src/components/channels/subtask-ask.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { createContext } from "react";

/**
* The message a subtask's thread starts with, when the transcript draws a subtask's thread
* (`SubtaskView`): what the Bot asked the subagent, drawn as sent from that Bot, as a task's brief
* is (`SentFromBot`), and never as something the person typed.
*
* A context rather than a reading of the text: the words that frame a subagent's task are the
* server's to change, and the view already knows which message it put there.
*/
export const SubtaskAskContext = createContext<{
/** The id of the message that carries the task. */
messageId: string;
/** The Bot that asked, by name. */
from: string;
} | null>(null);
104 changes: 69 additions & 35 deletions app/src/components/channels/subtask-step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { TurnInFlightContext } from "@/components/gallery/streaming";
import { IconChevronRight } from "@/components/icons";
import { subagentStepsQueryOptions } from "@/lib/subagents/queries";
import { toVisibleChatItems, type VisibleChatItem } from "./chat-messages";
import { useOpenSubtask } from "./open-subtask";
import {
foldRereads,
type StepDetails,
Expand Down Expand Up @@ -51,6 +52,7 @@ export function SubtaskStep({
active: boolean;
}) {
const chat = useCopilotChatConfiguration();
const opens = useOpenSubtask();
const [open, setOpen] = useState(false);
const toolCallId = step.subtask?.toolCallId ?? step.id;
const result = step.subtask?.result ?? null;
Expand Down Expand Up @@ -85,47 +87,79 @@ export function SubtaskStep({
const handedBack =
result && "handedBack" in result ? result.handedBack : null;

const line = (
<>
{/* The chevron every line that opens wears (`ToolLine`). */}
<span
aria-hidden
className="tool-line-chevron shrink-0 text-muted-foreground motion-safe:transition-transform"
>
<IconChevronRight className="size-3.5" />
</span>
<span className="flex min-w-0 items-center gap-2">
<StepIcon kind="subtask" />
{/* Shimmers while it works, as every running step does. See `StepRow`. */}
<span className={running ? "shrink-0 tool-line-running" : "shrink-0"}>
{step.label}
</span>
{step.detail ? (
<span className="truncate text-muted-foreground">{step.detail}</span>
) : null}
<SubtaskStatus
answered={result !== null && "answer" in result}
count={count}
handedBack={handedBack !== null}
model={result && "model" in result ? result.model : undefined}
bot={
(result && "bot" in result ? result.bot : undefined) ??
step.subtask?.bot
}
running={running}
step={step}
doing={running ? steps.at(-1)?.label : undefined}
/>
</span>
</>
);
/*
* A ROW THAT OPENS THE SUBTASK'S OWN VIEW, WHERE THERE IS ONE. Opened in place, a subtask's
* steps were a list under its row, drawn smaller and without the Bot's words between them: a
* subagent that worked for ten minutes read as a column of lines under one row. Its view reads it
* as the conversation reads the Bot (`SubtaskView`). A link, so it opens in a new tab too.
*/
if (opens)
return (
<li className="min-w-0">
<a
className="flex min-w-0 cursor-pointer items-center gap-1.5 rounded-md outline-none focus-visible:ring-3 focus-visible:ring-ring/50"
href={opens.hrefOf(toolCallId)}
onClick={(event) => {
// A new tab or window is the browser's, as for any link.
if (
event.defaultPrevented ||
event.button !== 0 ||
event.metaKey ||
event.ctrlKey ||
event.shiftKey ||
event.altKey
)
return;
event.preventDefault();
opens.open(toolCallId);
}}
>
{line}
</a>
</li>
);
return (
<li className="min-w-0">
<details
className="tool-line min-w-0"
onToggle={(event) => setOpen(event.currentTarget.open)}
>
<summary className="flex cursor-pointer list-none items-center gap-1.5">
{/* The chevron every line that opens wears (`ToolLine`). */}
<span
aria-hidden
className="tool-line-chevron shrink-0 text-muted-foreground motion-safe:transition-transform"
>
<IconChevronRight className="size-3.5" />
</span>
<span className="flex min-w-0 items-center gap-2">
<StepIcon kind="subtask" />
{/* Shimmers while it works, as every running step does. See `StepRow`. */}
<span
className={running ? "shrink-0 tool-line-running" : "shrink-0"}
>
{step.label}
</span>
{step.detail ? (
<span className="truncate text-muted-foreground">
{step.detail}
</span>
) : null}
<SubtaskStatus
answered={result !== null && "answer" in result}
count={count}
handedBack={handedBack !== null}
model={result && "model" in result ? result.model : undefined}
bot={
(result && "bot" in result ? result.bot : undefined) ??
step.subtask?.bot
}
running={running}
step={step}
doing={running ? steps.at(-1)?.label : undefined}
/>
</span>
{line}
</summary>
<div className="mt-1.5 space-y-2 pl-5">
{step.subtask?.task ? (
Expand Down Expand Up @@ -260,7 +294,7 @@ function SubtaskStatus({
* The action the subagent stopped before, said plainly. Nothing was done and nobody was asked. The
* Bot does it itself if it still needs doing, and the person is asked then, on the Bot's own card.
*/
function HandedBack({ tool, args }: { tool: string; args: unknown }) {
export function HandedBack({ tool, args }: { tool: string; args: unknown }) {
const { label, detail } = tool.startsWith("mcp__")
? readToolName(tool)
: { label: humanise(tool.replace(/^computer_/, "")), detail: undefined };
Expand Down
Loading
Loading