Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

feat(cowork): show subagent notes in the timeline, move the count to the chip

Akarshan Biswas76a221cff84d
diff --git a/web-app/src/containers/CoworkTasksChip.tsx b/web-app/src/containers/CoworkTasksChip.tsx
index a4d841405..651178194 100644
--- a/web-app/src/containers/CoworkTasksChip.tsx
+++ b/web-app/src/containers/CoworkTasksChip.tsx
@@ -11,7 +11,13 @@ import type { SubagentRun } from '@/types/coworkSession'
/**
* Opens the background-tasks rail, and stays out of the way until the agent
- * has dispatched a subagent — the same rule the changes chip follows.
+ * has dispatched a subagent -- the same rule the changes chip follows.
+ *
+ * This is also where "N subagents running" is reported. It used to be a row in
+ * the transcript, which put it in the wrong place twice over: a dispatched
+ * child outlives the turn that started it, so the row went stale under a
+ * conversation that had moved on, and the count belongs next to the thing that
+ * opens the list rather than buried in the scrollback.
*/
export function CoworkTasksChip({
subagents,
@@ -34,7 +40,11 @@ export function CoworkTasksChip({
variant="ghost"
size="xs"
aria-pressed={open}
- aria-label={t('common:backgroundTasks')}
+ aria-label={
+ active > 0
+ ? t('common:subagentsRunning', { count: active })
+ : t('common:backgroundTasks')
+ }
onClick={onToggle}
className={cn('shrink-0', open && 'text-primary')}
>
@@ -48,7 +58,11 @@ export function CoworkTasksChip({
</span>
</Button>
</TooltipTrigger>
- <TooltipContent>{t('common:backgroundTasks')}</TooltipContent>
+ <TooltipContent>
+ {active > 0
+ ? t('common:subagentsRunning', { count: active })
+ : t('common:backgroundTasks')}
+ </TooltipContent>
</Tooltip>
)
}
diff --git a/web-app/src/containers/MessageItem.test.tsx b/web-app/src/containers/MessageItem.test.tsx
index 17abbf84b..a8b95ecf3 100644
--- a/web-app/src/containers/MessageItem.test.tsx
+++ b/web-app/src/containers/MessageItem.test.tsx
@@ -1,8 +1,7 @@
-import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
-import { render, screen, act } from '@testing-library/react'
+import { describe, it, expect, vi } from 'vitest'
+import { render, screen } from '@testing-library/react'
import { MessageItem } from './MessageItem'
import type { UIMessage } from 'ai'
-import type { SubagentRun } from '@/types/coworkSession'
vi.mock('@/i18n/react-i18next-compat', () => ({
useTranslation: () => ({ t: (k: string) => k }),
@@ -11,15 +10,7 @@ vi.mock('@tanstack/react-router', () => ({
useParams: () => ({}),
}))
-describe('agent activity status', () => {
- beforeEach(() => {
- vi.useFakeTimers()
- vi.setSystemTime(new Date(2024, 0, 1, 0, 0, 0))
- })
- afterEach(() => {
- vi.useRealTimers()
- })
-
+describe('what a turn shows besides its messages', () => {
const pendingWrite: UIMessage = {
id: 'm1',
role: 'assistant',
@@ -33,9 +24,10 @@ describe('agent activity status', () => {
],
} as UIMessage
- /// The call's own card sits one row above with its name, arguments and a
- /// ticking duration, so a status row saying "Writing report.html" printed the
- /// same thing twice.
+ /// Every kind of progress now reports itself where it happens: a tool call on
+ /// its own card, a subagent on the chip beside the composer. What is left
+ /// here is the model-load and prompt-reading progress, which has nowhere
+ /// else to go.
it('leaves a pending tool call to its own card', () => {
render(
<MessageItem
@@ -48,55 +40,28 @@ describe('agent activity status', () => {
expect(screen.queryByRole('status')).not.toBeInTheDocument()
})
- /// A subagent is the exception: it works in a lane of its own, so nothing in
- /// this turn reports it and the row is the only place it shows.
- it('reports a running subagent, and ticks its elapsed time', () => {
- const subagents: SubagentRun[] = [
- {
- runId: 'r1',
- name: 'researcher',
- status: 'running',
- startedAt: Date.now(),
- turns: [],
- },
- ]
+ it('renders a system note on its own, with no message chrome', () => {
render(
<MessageItem
- message={pendingWrite}
+ message={
+ {
+ id: 'sys-1',
+ role: 'system',
+ parts: [
+ {
+ type: 'text',
+ text: "Subagent 'researcher' (c1) finished. Its full answer is in /tmp/subagents/r.md",
+ },
+ ],
+ } as UIMessage
+ }
isFirstMessage={false}
isLastMessage={true}
- status="streaming"
- subagents={subagents}
+ status="ready"
/>
)
- expect(screen.getByText(/researcher: working/)).toBeInTheDocument()
- expect(screen.getByText(/0ms/)).toBeInTheDocument()
-
- act(() => {
- vi.advanceTimersByTime(3000)
- })
- expect(screen.getByText(/3s/)).toBeInTheDocument()
- })
-
- it('drops the row once the subagent finishes', () => {
- const subagents: SubagentRun[] = [
- {
- runId: 'r1',
- name: 'researcher',
- status: 'done',
- startedAt: Date.now(),
- turns: [],
- },
- ]
- render(
- <MessageItem
- message={pendingWrite}
- isFirstMessage={false}
- isLastMessage={true}
- status="streaming"
- subagents={subagents}
- />
- )
- expect(screen.queryByRole('status')).not.toBeInTheDocument()
+ expect(screen.getByText(/finished/)).toBeInTheDocument()
+ // No copy/remember/regenerate: nobody said it, so there is nothing to act on.
+ expect(screen.queryByRole('button')).not.toBeInTheDocument()
})
})
diff --git a/web-app/src/containers/MessageItem.tsx b/web-app/src/containers/MessageItem.tsx
index 0fa69674d..1edde4832 100644
--- a/web-app/src/containers/MessageItem.tsx
+++ b/web-app/src/containers/MessageItem.tsx
@@ -3,14 +3,7 @@ import { memo, useState, useCallback, useEffect, useMemo } from 'react'
import type { UIMessage, ChatStatus } from 'ai'
import { RenderMarkdown } from './RenderMarkdown'
import { cn } from '@/lib/utils'
-import { formatDuration } from '@/lib/utils'
-import {
- subagentActivityLabel,
- usedSkillNames,
- type ActivityLabel,
-} from '@/lib/agentActivity'
-import type { SubagentRun } from '@/types/coworkSession'
-import { Loader } from 'lucide-react'
+import { usedSkillNames } from '@/lib/agentActivity'
import { ChainOfThoughtGroup } from './message/ChainOfThoughtGroup'
import {
@@ -33,6 +26,7 @@ import {
IconAlertTriangle,
IconChevronLeft,
IconChevronRight,
+ IconSparkles,
} from '@tabler/icons-react'
import { EditMessageDialog } from '@/containers/dialogs/EditMessageDialog'
import { DeleteMessageDialog } from '@/containers/dialogs/DeleteMessageDialog'
@@ -69,9 +63,6 @@ export type MessageItemProps = {
onRetry?: (messageId: string, text: string) => void
versionInfo?: { index: number; count: number }
onSwitchVersion?: (messageId: string, dir: -1 | 1) => void
- // Cowork only: the session's background subagent runs. Omitted in regular
- // chat threads, which never spawn subagents.
- subagents?: SubagentRun[]
isAnimating?: boolean
hideActions?: boolean
}
@@ -84,7 +75,6 @@ export const MessageItem = memo(
status,
isAnimating,
hideActions,
- subagents,
reasoningContainerRef,
isReasoningAtBottom,
onReasoningScroll,
@@ -176,28 +166,6 @@ export const MessageItem = memo(
[message.parts]
)
- // The activity row reports a running subagent, and only that.
- //
- // A tool call is already on screen as its own card one row above, with its
- // name, its arguments and a ticking duration, so labelling it here printed
- // the same thing twice a row apart -- the duplication the trace header was
- // trimmed for earlier. A subagent has no card: it works in a lane of its
- // own, so this is the only place its progress shows.
- // Memoized so the reference is stable for the elapsed-time interval effect.
- const activityLabel = useMemo<ActivityLabel>(() => {
- if (!subagents || subagents.length === 0) return null
- return subagentActivityLabel(subagents)
- }, [subagents])
-
- // Re-render once a second while a label is showing, purely to advance the
- // elapsed-time readout -- no state carried, just a tick.
- const [, forceTick] = useState(0)
- useEffect(() => {
- if (!activityLabel) return
- const id = setInterval(() => forceTick((n) => n + 1), 1000)
- return () => clearInterval(id)
- }, [activityLabel])
-
const isStreaming =
(isLastMessage &&
(status === CHAT_STATUS.STREAMING ||
@@ -547,6 +515,21 @@ export const MessageItem = memo(
</div>
) : null
+ // A note the run folded into the conversation, not something either party
+ // said: no actions, no trace, no timestamp. It is on screen because it is
+ // what the next turn is replying to -- a turn that reacts to a subagent
+ // finishing reads as a non sequitur without it.
+ if (message.role === 'system') {
+ return (
+ <div className="mb-4 flex items-start gap-2 rounded-md border border-border/50 bg-muted/30 px-3 py-2 text-xs text-muted-foreground">
+ <IconSparkles size={14} className="mt-0.5 shrink-0 text-primary" />
+ <span className="min-w-0 whitespace-pre-wrap">
+ {getFullTextContent()}
+ </span>
+ </div>
+ )
+ }
+
return (
<div
className={cn(
@@ -573,30 +556,15 @@ export const MessageItem = memo(
</div>
)}
+ {/* Model-load and prompt-reading progress only: a running tool call
+ reports itself on its own card, and a running subagent on the chip
+ beside the composer. */}
{isLastMessage &&
message.role === 'assistant' &&
!awaitingApproval &&
- (hasPendingToolCall ||
- status === CHAT_STATUS.SUBMITTED ||
- activityLabel) && (
+ (hasPendingToolCall || status === CHAT_STATUS.SUBMITTED) && (
<div className="mt-2">
- {activityLabel ? (
- <div
- role="status"
- aria-live="polite"
- className="flex items-center gap-2 text-xs"
- >
- <Loader className="animate-spin w-3.5 h-3.5 text-primary shrink-0" />
- <span className="font-medium text-foreground">
- {activityLabel.text}
- </span>
- <span className="text-muted-foreground tabular-nums">
- {formatDuration(activityLabel.startedAt)}
- </span>
- </div>
- ) : (
- <PromptProgress hideIdle={hasPendingToolCall} />
- )}
+ <PromptProgress hideIdle={hasPendingToolCall} />
</div>
)}
diff --git a/web-app/src/containers/__tests__/CoworkTasksChip.test.tsx b/web-app/src/containers/__tests__/CoworkTasksChip.test.tsx
new file mode 100644
index 000000000..518fab427
--- /dev/null
+++ b/web-app/src/containers/__tests__/CoworkTasksChip.test.tsx
@@ -0,0 +1,60 @@
+import { describe, it, expect, vi } from 'vitest'
+import { render, screen } from '@testing-library/react'
+import '@testing-library/jest-dom'
+
+vi.mock('@/i18n/react-i18next-compat', () => ({
+ useTranslation: () => ({
+ t: (k: string, opts?: Record<string, unknown>) =>
+ opts ? `${k} ${Object.values(opts).join(' ')}` : k,
+ }),
+}))
+
+import { CoworkTasksChip } from '../CoworkTasksChip'
+import type { SubagentRun } from '@/types/coworkSession'
+
+const run = (runId: string, status: SubagentRun['status']): SubagentRun => ({
+ runId,
+ name: 'researcher',
+ status,
+ startedAt: 0,
+ turns: [],
+})
+
+describe('CoworkTasksChip', () => {
+ // Nothing dispatched is nothing to say, so the dock row stays quiet.
+ it('renders nothing before a subagent is dispatched', () => {
+ const { container } = render(
+ <CoworkTasksChip subagents={[]} open={false} onToggle={vi.fn()} />
+ )
+ expect(container).toBeEmptyDOMElement()
+ })
+
+ /// The count that used to sit in the transcript. It belongs here: a child
+ /// outlives the turn that dispatched it, so a row in the scrollback went
+ /// stale under a conversation that had moved on.
+ it('counts the running children against the total', () => {
+ render(
+ <CoworkTasksChip
+ subagents={[run('a', 'running'), run('b', 'running'), run('c', 'done')]}
+ open={false}
+ onToggle={vi.fn()}
+ />
+ )
+ expect(screen.getByText('2/3')).toBeInTheDocument()
+ expect(
+ screen.getByLabelText('common:subagentsRunning 2')
+ ).toBeInTheDocument()
+ })
+
+ it('reports the total once they have all finished', () => {
+ render(
+ <CoworkTasksChip
+ subagents={[run('a', 'done'), run('b', 'done')]}
+ open={false}
+ onToggle={vi.fn()}
+ />
+ )
+ expect(screen.getByText('2')).toBeInTheDocument()
+ expect(screen.getByLabelText('common:backgroundTasks')).toBeInTheDocument()
+ })
+})
diff --git a/web-app/src/containers/__tests__/MessageItem.test.tsx b/web-app/src/containers/__tests__/MessageItem.test.tsx
index 8bb5d18fe..722a54197 100644
--- a/web-app/src/containers/__tests__/MessageItem.test.tsx
+++ b/web-app/src/containers/__tests__/MessageItem.test.tsx
@@ -588,40 +588,31 @@ describe('MessageItem', () => {
).not.toBeInTheDocument()
})
- it('shows child activity while the parent awaits that subagent', () => {
+ /// A note the run folded in, not something either party said: the turn after
+ /// it is a reply to it, and reads as a non sequitur on its own.
+ it('renders a system note as a plain row, with no actions', () => {
render(
<MessageItem
message={
makeMsg({
+ role: 'system',
parts: [
- {
- type: 'tool-await_subagent',
- state: 'input-available',
- toolCallId: 'tc-await',
- input: { run_id: 'sub-robotics-researcher-1' },
- },
+ { type: 'text', text: "Subagent 'researcher' (c1) finished." },
],
}) as any
}
- isFirstMessage
+ isFirstMessage={false}
isLastMessage
status={'ready' as any}
- subagents={[
- {
- runId: 'sub-robotics-researcher-1',
- name: 'robotics-researcher',
- status: 'running',
- startedAt: Date.now() - 1_000,
- turns: [],
- },
- ]}
+ onEdit={vi.fn()}
+ onDelete={vi.fn()}
/>
)
-
- expect(screen.getByRole('status')).toHaveTextContent(
- 'robotics-researcher: working'
- )
- expect(screen.getByRole('status')).not.toHaveTextContent('Await subagent')
+ expect(
+ screen.getByText("Subagent 'researcher' (c1) finished.")
+ ).toBeInTheDocument()
+ expect(screen.queryByTestId('edit-btn')).not.toBeInTheDocument()
+ expect(screen.queryByTestId('delete-btn')).not.toBeInTheDocument()
})
it('hides progress while a tool call awaits approval', () => {
diff --git a/web-app/src/lib/__tests__/coworkTurns.test.ts b/web-app/src/lib/__tests__/coworkTurns.test.ts
index c15d1861f..768d14466 100644
--- a/web-app/src/lib/__tests__/coworkTurns.test.ts
+++ b/web-app/src/lib/__tests__/coworkTurns.test.ts
@@ -135,6 +135,26 @@ describe('coworkTurnsToUIMessages', () => {
expect(part.input).toEqual({ path: 'game.html', content: 'done' })
})
+ /// A note the run folded in ends the assistant's message: what follows is a
+ /// reply to it, not a continuation of what came before.
+ it('gives a system note its own message, closing the assistant one', () => {
+ const msgs = coworkTurnsToUIMessages([
+ { role: 'user', content: 'go' },
+ { role: 'assistant', content: 'dispatched' },
+ { role: 'system', content: "Subagent 'researcher' finished." },
+ { role: 'assistant', content: 'here is what it found' },
+ ])
+ expect(msgs.map((m) => m.role)).toEqual([
+ 'user',
+ 'assistant',
+ 'system',
+ 'assistant',
+ ])
+ expect((msgs[2].parts[0] as { text: string }).text).toBe(
+ "Subagent 'researcher' finished."
+ )
+ })
+
it('keeps ids unique across prefixes so committed and live turns can merge', () => {
const turns: CoworkTurn[] = [{ role: 'user', content: 'hi' }]
const committed = coworkTurnsToUIMessages(turns, 'c')
diff --git a/web-app/src/lib/agentActivity.test.ts b/web-app/src/lib/agentActivity.test.ts
index 9df5ff41d..e211351a7 100644
--- a/web-app/src/lib/agentActivity.test.ts
+++ b/web-app/src/lib/agentActivity.test.ts
@@ -3,10 +3,8 @@ import {
toolActivityText,
completedToolLabel,
usedSkillNames,
- subagentActivityLabel,
awaitsModel,
} from './agentActivity'
-import type { SubagentRun } from '@/hooks/useCoworkSessions'
import type { CoworkTurn } from '@/types/coworkSession'
describe('toolActivityText', () => {
@@ -96,73 +94,6 @@ describe('usedSkillNames', () => {
})
})
-describe('subagentActivityLabel', () => {
- it('returns null when no subagent is running', () => {
- const subagents: SubagentRun[] = [
- {
- runId: 'r1',
- name: 'Researcher',
- status: 'done',
- startedAt: 1,
- turns: [],
- },
- ]
- expect(subagentActivityLabel(subagents)).toBeNull()
- })
-
- it('labels a single running subagent with its own tool activity', () => {
- const subagents: SubagentRun[] = [
- {
- runId: 'r1',
- name: 'Researcher',
- status: 'running',
- startedAt: 1000,
- turns: [
- {
- role: 'tool',
- content: '',
- name: 'write',
- args: { path: 'notes.md' },
- status: 'running',
- },
- ],
- },
- ]
- expect(subagentActivityLabel(subagents)).toEqual({
- text: 'Researcher: Writing notes.md',
- startedAt: 1000,
- })
- })
-
- it('labels a single running subagent with "working" when it has no tool turn', () => {
- const subagents: SubagentRun[] = [
- {
- runId: 'r1',
- name: 'Researcher',
- status: 'running',
- startedAt: 1000,
- turns: [],
- },
- ]
- expect(subagentActivityLabel(subagents)).toEqual({
- text: 'Researcher: working',
- startedAt: 1000,
- })
- })
-
- it('labels multiple running subagents with a count and earliest startedAt', () => {
- const subagents: SubagentRun[] = [
- { runId: 'r1', name: 'A', status: 'running', startedAt: 2000, turns: [] },
- { runId: 'r2', name: 'B', status: 'running', startedAt: 1000, turns: [] },
- { runId: 'r3', name: 'C', status: 'done', startedAt: 500, turns: [] },
- ]
- expect(subagentActivityLabel(subagents)).toEqual({
- text: '2 subagents working',
- startedAt: 1000,
- })
- })
-})
-
describe('awaitsModel', () => {
const tool = (status: CoworkTurn['status']): CoworkTurn => ({
role: 'tool',
@@ -194,4 +125,10 @@ describe('awaitsModel', () => {
false
)
})
+
+ /// A note the run just folded in is followed by a model call, with nothing on
+ /// screen until it answers -- the same gap a question leaves.
+ it('waits on the model after a system note', () => {
+ expect(awaitsModel(true, [{ role: 'system', content: 'done' }])).toBe(true)
+ })
})
diff --git a/web-app/src/lib/agentActivity.ts b/web-app/src/lib/agentActivity.ts
index a091a5d26..be333d5a0 100644
--- a/web-app/src/lib/agentActivity.ts
+++ b/web-app/src/lib/agentActivity.ts
@@ -1,6 +1,4 @@
-import type { CoworkTurn, SubagentRun } from '@/types/coworkSession'
-
-export type ActivityLabel = { text: string; startedAt: number } | null
+import type { CoworkTurn } from '@/types/coworkSession'
const MAX_COMMAND_LEN = 60
@@ -94,32 +92,6 @@ export function usedSkillNames(parts: ToolPartLike[]): string[] {
return [...names]
}
-function lastRunningToolTurn(turns: CoworkTurn[]): CoworkTurn | undefined {
- for (let i = turns.length - 1; i >= 0; i--) {
- const turn = turns[i]
- if (turn.role === 'tool' && turn.status === 'running') return turn
- }
- return undefined
-}
-
-/** null if no subagent is running; else a combined label + earliest startedAt. */
-export function subagentActivityLabel(subagents: SubagentRun[]): ActivityLabel {
- const running = subagents.filter((s) => s.status === 'running')
- if (running.length === 0) return null
-
- if (running.length === 1) {
- const run = running[0]
- const activeTurn = lastRunningToolTurn(run.turns)
- const detail = activeTurn
- ? toolActivityText(activeTurn.name ?? 'tool', activeTurn.args)
- : 'working'
- return { text: `${run.name}: ${detail}`, startedAt: run.startedAt }
- }
-
- const startedAt = Math.min(...running.map((s) => s.startedAt))
- return { text: `${running.length} subagents working`, startedAt }
-}
-
/**
* Whether a running agent is waiting on the model with nothing to show for it.
*
@@ -131,6 +103,8 @@ export function awaitsModel(running: boolean, turns: CoworkTurn[]): boolean {
if (!running) return false
const last = turns.at(-1)
if (!last) return true
- if (last.role === 'user') return true
+ // A question or a note the run just folded in: both are followed by a model
+ // call, with nothing on screen until it answers.
+ if (last.role === 'user' || last.role === 'system') return true
return last.role === 'tool' && last.status === 'done'
}
diff --git a/web-app/src/lib/coworkTurns.ts b/web-app/src/lib/coworkTurns.ts
index 861928166..ab3604748 100644
--- a/web-app/src/lib/coworkTurns.ts
+++ b/web-app/src/lib/coworkTurns.ts
@@ -52,6 +52,19 @@ export function coworkTurnsToUIMessages(
return
}
+ // A note from the run, not from either party: it ends the assistant's
+ // message for the same reason a question does -- what follows is a reply to
+ // it, not a continuation of what came before.
+ if (turn.role === 'system') {
+ flushAssistant()
+ messages.push({
+ id: `${idPrefix}-sys-${i}`,
+ role: 'system',
+ parts: [{ type: 'text', text: turn.content }],
+ } as any)
+ return
+ }
+
if (turn.role === 'assistant') {
// Split out <think>/<thought> reasoning into reasoning parts (same helper
// the chat loader uses) so the agent's chain-of-thought renders in the
diff --git a/web-app/src/locales/en/common.json b/web-app/src/locales/en/common.json
index e1bfa696e..3de97e338 100644
--- a/web-app/src/locales/en/common.json
+++ b/web-app/src/locales/en/common.json
@@ -630,6 +630,8 @@
"todoPanelTitle": "Progress",
"todoPanelEmpty": "No todo list yet.",
"backgroundTasks": "Background tasks",
+ "subagentsRunning_one": "{{count}} subagent running",
+ "subagentsRunning_other": "{{count}} subagents running",
"noBackgroundTasks": "No background tasks yet.",
"running": "Running",
"queued": "Queued",
diff --git a/web-app/src/routeTree.gen.ts b/web-app/src/routeTree.gen.ts
index 804429e34..b8f917e40 100644
--- a/web-app/src/routeTree.gen.ts
+++ b/web-app/src/routeTree.gen.ts
@@ -26,10 +26,10 @@ import { Route as SettingsHttpsProxyRouteImport } from './routes/settings/https-
import { Route as SettingsHardwareRouteImport } from './routes/settings/hardware'
import { Route as SettingsGeneralRouteImport } from './routes/settings/general'
import { Route as SettingsExtensionsRouteImport } from './routes/settings/extensions'
+import { Route as SettingsCoworkRouteImport } from './routes/settings/cowork'
import { Route as SettingsClaudeCodeRouteImport } from './routes/settings/claude-code'
import { Route as SettingsAttachmentsRouteImport } from './routes/settings/attachments'
import { Route as SettingsAssistantRouteImport } from './routes/settings/assistant'
-import { Route as SettingsCoworkRouteImport } from './routes/settings/cowork'
import { Route as ProjectProjectIdRouteImport } from './routes/project/$projectId'
import { Route as LocalApiServerLogsRouteImport } from './routes/local-api-server/logs'
import { Route as HubModelIdRouteImport } from './routes/hub/$modelId'
@@ -121,6 +121,11 @@ const SettingsExtensionsRoute = SettingsExtensionsRouteImport.update({
path: '/settings/extensions',
getParentRoute: () => rootRouteImport,
} as any)
+const SettingsCoworkRoute = SettingsCoworkRouteImport.update({
+ id: '/settings/cowork',
+ path: '/settings/cowork',
+ getParentRoute: () => rootRouteImport,
+} as any)
const SettingsClaudeCodeRoute = SettingsClaudeCodeRouteImport.update({
id: '/settings/claude-code',
path: '/settings/claude-code',
@@ -136,11 +141,6 @@ const SettingsAssistantRoute = SettingsAssistantRouteImport.update({
path: '/settings/assistant',
getParentRoute: () => rootRouteImport,
} as any)
-const SettingsCoworkRoute = SettingsCoworkRouteImport.update({
- id: '/settings/cowork',
- path: '/settings/cowork',
- getParentRoute: () => rootRouteImport,
-} as any)
const ProjectProjectIdRoute = ProjectProjectIdRouteImport.update({
id: '/project/$projectId',
path: '/project/$projectId',
@@ -177,10 +177,10 @@ export interface FileRoutesByFullPath {
'/hub/$modelId': typeof HubModelIdRoute
'/local-api-server/logs': typeof LocalApiServerLogsRoute
'/project/$projectId': typeof ProjectProjectIdRoute
- '/settings/cowork': typeof SettingsCoworkRoute
'/settings/assistant': typeof SettingsAssistantRoute
'/settings/attachments': typeof SettingsAttachmentsRoute
'/settings/claude-code': typeof SettingsClaudeCodeRoute
+ '/settings/cowork': typeof SettingsCoworkRoute
'/settings/extensions': typeof SettingsExtensionsRoute
'/settings/general': typeof SettingsGeneralRoute
'/settings/hardware': typeof SettingsHardwareRoute
@@ -205,10 +205,10 @@ export interface FileRoutesByTo {
'/hub/$modelId': typeof HubModelIdRoute
'/local-api-server/logs': typeof LocalApiServerLogsRoute
'/project/$projectId': typeof ProjectProjectIdRoute
- '/settings/cowork': typeof SettingsCoworkRoute
'/settings/assistant': typeof SettingsAssistantRoute
'/settings/attachments': typeof SettingsAttachmentsRoute
'/settings/claude-code': typeof SettingsClaudeCodeRoute
+ '/settings/cowork': typeof SettingsCoworkRoute
'/settings/extensions': typeof SettingsExtensionsRoute
'/settings/general': typeof SettingsGeneralRoute
'/settings/hardware': typeof SettingsHardwareRoute
@@ -234,10 +234,10 @@ export interface FileRoutesById {
'/hub/$modelId': typeof HubModelIdRoute
'/local-api-server/logs': typeof LocalApiServerLogsRoute
'/project/$projectId': typeof ProjectProjectIdRoute
- '/settings/cowork': typeof SettingsCoworkRoute
'/settings/assistant': typeof SettingsAssistantRoute
'/settings/attachments': typeof SettingsAttachmentsRoute
'/settings/claude-code': typeof SettingsClaudeCodeRoute
+ '/settings/cowork': typeof SettingsCoworkRoute
'/settings/extensions': typeof SettingsExtensionsRoute
'/settings/general': typeof SettingsGeneralRoute
'/settings/hardware': typeof SettingsHardwareRoute
@@ -264,10 +264,10 @@ export interface FileRouteTypes {
| '/hub/$modelId'
| '/local-api-server/logs'
| '/project/$projectId'
- | '/settings/cowork'
| '/settings/assistant'
| '/settings/attachments'
| '/settings/claude-code'
+ | '/settings/cowork'
| '/settings/extensions'
| '/settings/general'
| '/settings/hardware'
@@ -292,10 +292,10 @@ export interface FileRouteTypes {
| '/hub/$modelId'
| '/local-api-server/logs'
| '/project/$projectId'
- | '/settings/cowork'
| '/settings/assistant'
| '/settings/attachments'
| '/settings/claude-code'
+ | '/settings/cowork'
| '/settings/extensions'
| '/settings/general'
| '/settings/hardware'
@@ -320,10 +320,10 @@ export interface FileRouteTypes {
| '/hub/$modelId'
| '/local-api-server/logs'
| '/project/$projectId'
- | '/settings/cowork'
| '/settings/assistant'
| '/settings/attachments'
| '/settings/claude-code'
+ | '/settings/cowork'
| '/settings/extensions'
| '/settings/general'
| '/settings/hardware'
@@ -349,10 +349,10 @@ export interface RootRouteChildren {
HubModelIdRoute: typeof HubModelIdRoute
LocalApiServerLogsRoute: typeof LocalApiServerLogsRoute
ProjectProjectIdRoute: typeof ProjectProjectIdRoute
- SettingsCoworkRoute: typeof SettingsCoworkRoute
SettingsAssistantRoute: typeof SettingsAssistantRoute
SettingsAttachmentsRoute: typeof SettingsAttachmentsRoute
SettingsClaudeCodeRoute: typeof SettingsClaudeCodeRoute
+ SettingsCoworkRoute: typeof SettingsCoworkRoute
SettingsExtensionsRoute: typeof SettingsExtensionsRoute
SettingsGeneralRoute: typeof SettingsGeneralRoute
SettingsHardwareRoute: typeof SettingsHardwareRoute
@@ -490,6 +490,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof SettingsExtensionsRouteImport
parentRoute: typeof rootRouteImport
}
+ '/settings/cowork': {
+ id: '/settings/cowork'
+ path: '/settings/cowork'
+ fullPath: '/settings/cowork'
+ preLoaderRoute: typeof SettingsCoworkRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/settings/claude-code': {
id: '/settings/claude-code'
path: '/settings/claude-code'
@@ -511,13 +518,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof SettingsAssistantRouteImport
parentRoute: typeof rootRouteImport
}
- '/settings/cowork': {
- id: '/settings/cowork'
- path: '/settings/cowork'
- fullPath: '/settings/cowork'
- preLoaderRoute: typeof SettingsCoworkRouteImport
- parentRoute: typeof rootRouteImport
- }
'/project/$projectId': {
id: '/project/$projectId'
path: '/project/$projectId'
@@ -565,10 +565,10 @@ const rootRouteChildren: RootRouteChildren = {
HubModelIdRoute: HubModelIdRoute,
LocalApiServerLogsRoute: LocalApiServerLogsRoute,
ProjectProjectIdRoute: ProjectProjectIdRoute,
- SettingsCoworkRoute: SettingsCoworkRoute,
SettingsAssistantRoute: SettingsAssistantRoute,
SettingsAttachmentsRoute: SettingsAttachmentsRoute,
SettingsClaudeCodeRoute: SettingsClaudeCodeRoute,
+ SettingsCoworkRoute: SettingsCoworkRoute,
SettingsExtensionsRoute: SettingsExtensionsRoute,
SettingsGeneralRoute: SettingsGeneralRoute,
SettingsHardwareRoute: SettingsHardwareRoute,
diff --git a/web-app/src/routes/cowork.tsx b/web-app/src/routes/cowork.tsx
index 676fa740b..5ef5c2446 100644
--- a/web-app/src/routes/cowork.tsx
+++ b/web-app/src/routes/cowork.tsx
@@ -631,7 +631,17 @@ function CoworkPage() {
return () => `${sid}-asst-${n++}`
})(),
inbox: {
- take: () => inbox.take(),
+ // Shown as it is delivered, not as it is queued: the transcript
+ // then reads in the order the model saw things, and the turn that
+ // reacts to a subagent finishing has the note it is replying to
+ // directly above it.
+ take: () => {
+ const pings = inbox.take()
+ pushLive(
+ pings.map((content) => ({ role: 'system' as const, content }))
+ )
+ return pings
+ },
pending: () => inbox.pending(),
wait: () => inbox.wait(controller.signal),
},
@@ -1026,11 +1036,6 @@ function CoworkPage() {
? handleDeleteQuestion
: undefined
}
- // Only the last message can show the live subagent row,
- // so only it needs the runs.
- subagents={
- i === uiMessages.length - 1 ? subagents : undefined
- }
reasoningContainerRef={reasoningContainerRef}
isReasoningAtBottom={isReasoningAtBottom}
onReasoningScroll={handleReasoningScroll}
diff --git a/web-app/src/types/coworkSession.ts b/web-app/src/types/coworkSession.ts
index 0e0b6ca23..2301a3afb 100644
--- a/web-app/src/types/coworkSession.ts
+++ b/web-app/src/types/coworkSession.ts
@@ -8,9 +8,14 @@
*/
/** A single visible transcript entry. `tool` rows are display-only and carry the
- * structured call/result so the UI can render a tool card. */
+ * structured call/result so the UI can render a tool card.
+ *
+ * `system` rows are the out-of-band notes the run folds into the conversation
+ * -- today, a backgrounded subagent reporting that it finished. They are shown
+ * because they change what the agent does next, and reading a turn that reacts
+ * to one is otherwise reading half a conversation. */
export type CoworkTurn = {
- role: 'user' | 'assistant' | 'tool'
+ role: 'user' | 'assistant' | 'tool' | 'system'
content: string
/** User-row only: data URLs of images attached via paste/file picker. */
images?: string[]