Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

feat(chat): the plan is pinned under the newest message, in Agent and Code (CA P1)

purple76f66d7dc915
diff --git a/e2e/ca-shots.spec.ts b/e2e/ca-shots.spec.ts
index 5e69667d..df9d4af9 100644
--- a/e2e/ca-shots.spec.ts
+++ b/e2e/ca-shots.spec.ts
@@ -144,3 +144,41 @@ test.describe('CA shots', () => {
})
}
})
+
+const PLAN_RUN: Turn[] = [
+ {
+ text: 'Here is the plan.',
+ toolCalls: [{ name: 'todo_write', args: { todos: [
+ { content: 'Read src/math.ts', status: 'completed' },
+ { content: 'Implement median()', status: 'in_progress' },
+ { content: 'Run the tests', status: 'pending' },
+ { content: 'Summarise the change', status: 'pending' },
+ ] } }],
+ },
+ { text: 'Reading the file.', toolCalls: [{ name: 'file_read', args: { path: 'src/math.ts' } }] },
+ { text: 'I stopped here: `median()` still needs its even-length case.' },
+]
+
+test.describe('CA shots: pinned plan', () => {
+ test.skip(!OUT, 'set LU_CA_SHOTS to a folder')
+ for (const theme of ['dark', 'light'] as const) {
+ for (const width of [1280, 375]) {
+ test(`plan ${theme} ${width}`, async ({ page }) => {
+ await boot(page, PLAN_RUN, width, theme, true)
+ // The Code tab: the plan used to sit in its right column.
+ if (width >= 1024) await page.getByRole('button', { name: 'Code', exact: true }).click()
+ else {
+ await page.getByRole('banner').getByRole('button', { name: 'Main navigation' }).click().catch(() => {})
+ await page.getByRole('button', { name: 'Code', exact: true }).first().click().catch(() => {})
+ }
+ await openNewChat(page)
+ await send(page, 'median() in src/math.ts is missing, implement it and run the tests')
+ await expect(page.getByTestId('plan-pinned')).toBeVisible({ timeout: 30_000 })
+ await shot(page, `plan-${theme}-${width}-1-running`)
+ await page.evaluate(() => (window as unknown as { __E2E_RELEASE_TOOLS__?: () => void }).__E2E_RELEASE_TOOLS__?.())
+ await expect(page.getByTestId('plan-run-stopped')).toBeVisible({ timeout: 60_000 })
+ await shot(page, `plan-${theme}-${width}-2-ended`)
+ })
+ }
+ }
+})
diff --git a/e2e/code-agent-runs-calls-named-function.spec.ts b/e2e/code-agent-runs-calls-named-function.spec.ts
index a215bd69..4a8a845b 100644
--- a/e2e/code-agent-runs-calls-named-function.spec.ts
+++ b/e2e/code-agent-runs-calls-named-function.spec.ts
@@ -61,8 +61,7 @@ test('a call named "function" and a !function_call text both run their tool', as
await expect(main.getByText('VERIFIER_READ_DONE')).toBeVisible({ timeout: 30_000 })
// The todo list landed in the plan, the file was really read.
- await expect(page.getByTestId('plan-header').or(page.getByTestId('plan-panel')).first()
- .getByRole('button', { name: /^plan /i })).toBeVisible({ timeout: 15_000 })
+ await expect(page.getByTestId('plan-pinned').getByTestId('plan-count')).toBeVisible({ timeout: 15_000 })
const reads = (await toolCalls(page)).filter((c) => c.cmd === 'fs_read')
expect(reads.some((c) => (c.path ?? '').replace(/\\/g, '/').endsWith('core/verifier.py'))).toBe(true)
diff --git a/e2e/coding-agent.spec.ts b/e2e/coding-agent.spec.ts
index 8ff5b64d..5cd44f94 100644
--- a/e2e/coding-agent.spec.ts
+++ b/e2e/coding-agent.spec.ts
@@ -282,33 +282,22 @@ test('the plan the model writes shows up above the composer and tracks progress'
await instruct(page, 'fix the parser and prove it')
await expect(page.getByRole('main').getByText('PLAN_RUN_DONE')).toBeVisible({ timeout: 30_000 })
- // PlanBar has TWO homes and they disagree about the default state ON PURPOSE
- // (chat/PlanBar.tsx): 'header' starts collapsed so it costs one line above
- // the transcript, 'panel' — the Code tab's Explorer column — starts expanded.
- // The old version assumed "collapsed" and clicked a bare text node, so on the
- // surface that renders the panel the click COLLAPSED the plan and the step
- // list it then looked for was the one it had just closed. That is what made
- // this spec pass or fail with whichever home the run happened to render.
- //
- // Which home is showing is not what this spec is about, so it drives the
- // strip through BOTH states and asserts each one. The toggle names the state
- // it is in, so nothing here is assumed.
- const strip = page.getByTestId('plan-header').or(page.getByTestId('plan-panel')).first()
- const planToggle = strip.getByRole('button', { name: /^plan 1\/3/ })
- await expect(planToggle).toBeVisible({ timeout: 15_000 })
- if ((await planToggle.getAttribute('title')) === 'Collapse the plan') await planToggle.click()
-
- // Collapsed: the counter and the step that is running right now — and NOT
- // the whole list, which is the part that would push the composer away.
- await expect(planToggle).toHaveAttribute('title', 'Show every step')
- await expect(planToggle).toContainText('patch the parser')
+ // The plan is pinned under the newest message (CA, 13.11.2026), open by
+ // default like the Claude Code desktop app. The toggle names the state it
+ // is in, so nothing here is assumed.
+ const strip = page.getByTestId('plan-pinned')
+ await expect(strip.getByTestId('plan-count')).toHaveText('1 of 3 done', { timeout: 15_000 })
+ await expect(strip.getByText('read the config')).toBeVisible()
+ await expect(strip.getByText('run the suite')).toBeVisible()
+
+ // Folded: the counter and the step that is running right now, not the list.
+ await strip.getByTitle('Collapse the plan').click()
+ await expect(strip.getByTitle('Show every step')).toContainText('patch the parser')
await expect(strip.getByText('read the config')).toHaveCount(0)
- // Expanded: every step, and the strip follows the model's second update.
- await planToggle.click()
- await expect(planToggle).toHaveAttribute('title', 'Collapse the plan')
+ // And open again.
+ await strip.getByTitle('Show every step').click()
await expect(strip.getByText('read the config')).toBeVisible()
- await expect(strip.getByText('run the suite')).toBeVisible()
// `todo_write` must never have gone near the Rust bridge: it is pure
// conversation state, and a backend round trip would mean a permission gate
diff --git a/e2e/planleiste-nach-dem-lauf.spec.ts b/e2e/planleiste-nach-dem-lauf.spec.ts
index f5c1df40..2318c903 100644
--- a/e2e/planleiste-nach-dem-lauf.spec.ts
+++ b/e2e/planleiste-nach-dem-lauf.spec.ts
@@ -82,7 +82,7 @@ test('nach dem Lauf sagt die Planleiste, dass sie stehengeblieben ist', async ({
await box.type('mach vier Schritte')
await page.keyboard.press('Enter')
- const band = page.getByTestId('plan-header')
+ const band = page.getByTestId('plan-pinned')
await expect(band).toBeVisible({ timeout: 30_000 })
// Der Lauf muss WIRKLICH vorbei sein, sonst prueft der Rest nichts.
@@ -92,8 +92,8 @@ test('nach dem Lauf sagt die Planleiste, dass sie stehengeblieben ist', async ({
// Und der Kreisel steht. Gemessen war er der zweite Teil derselben Luege:
// aufgeklappt drehte er sich nach dem Ende des Laufs unbegrenzt weiter.
- await band.getByRole('button').first().click()
- await expect(band.getByText('Schritt vier')).toBeVisible()
+ // Die Liste ist offen, seit sie unter der neuesten Nachricht haengt (CA).
+ await expect(band.getByTestId('plan-steps').getByText('Schritt vier')).toBeVisible()
const drehend = await band.locator('.animate-spin').count()
expect(drehend).toBe(0)
})
@@ -122,7 +122,7 @@ test('waehrend der Lauf laeuft, sagt sie nichts von einem Ende', async ({ page }
await box.type('lauf lange')
await page.keyboard.press('Enter')
- const band = page.getByTestId('plan-header')
+ const band = page.getByTestId('plan-pinned')
await expect(band).toBeVisible({ timeout: 30_000 })
// The tool call has reached the bridge and is waiting: from here the run
diff --git a/src/components/chat/ChatView.tsx b/src/components/chat/ChatView.tsx
index 0b1742f4..a4438759 100644
--- a/src/components/chat/ChatView.tsx
+++ b/src/components/chat/ChatView.tsx
@@ -30,7 +30,6 @@ import { PluginsDropdown } from './PluginsDropdown'
import { ModelSelector } from '../models/ModelSelector'
import { useConversationModelHint } from './ConversationModelNote'
import { GoalBar } from './GoalBar'
-import { PlanBar } from './PlanBar'
import { LoopBar } from './LoopBar'
import { GroupCostHint } from './GroupCostHint'
import { GroupRoundBar } from './GroupRoundBar'
@@ -463,19 +462,9 @@ export function ChatView() {
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.25, ease: 'easeOut' }}
>
- {/* The plan, for plain chat and for Agent alike. It belongs
- above the transcript, not at the prompt box: the Chat
- surface has no right-hand column to hand it to, and a plan
- is what the run is going to DO, so it reads before the
- output, not after it. Collapsed by default so it costs one
- line, and it renders nothing at all while there is no plan,
- so the empty case costs zero.
- (Die uebrigen Sitzungsanzeigen sind mit D-S18 unter das
- Transkript gezogen; der Plan bleibt, weil
- `the-prompt-window-is-the-prompt-window.test.ts` genau
- diese Reihenfolge festnagelt.) */}
- <PlanBar />
-
+ {/* The plan is no longer a band up here: since CA
+ (13.11.2026) it is pinned under the newest message,
+ inside MessageList (PlanBar.tsx says why). */}
{/* Der Platz, an den die Zeilen aus dem Composer gezogen
sind (21.09.2026: „NICHTS im prompt fenster!").
Oben im Verlauf, ruhig, mit x, und ausdruecklich NICHT am
@@ -497,6 +486,7 @@ export function ChatView() {
pendingApprovalId={pendingApproval?.id ?? null}
onApprove={approveToolCall}
onReject={rejectToolCall}
+ onContinuePlan={(text) => sendMessage(text)}
/>
)}
@@ -645,9 +635,9 @@ export function ChatView() {
Regel dieses Hauses. Diese Leiste ist ein Geschwister der
Box, kein Inhalt darin.
- Der PlanBar bleibt oben, denn `the-prompt-window-is-the-prompt-
- window.test.ts` verlangt Plan vor Transkript, und er
- rendert ohnehin `null`, solange es keinen Plan gibt. */}
+ Der Plan steht seit CA (13.11.2026) nicht mehr hier oben,
+ sondern angeheftet unter der neuesten Nachricht im
+ Transkript (MessageList, PlanBar.tsx). */}
{/* Auf der Breite der Promptbox, nicht auf der des ganzen
Bereichs. Gemessen am Windows-Bau (1296x808): die Leiste
war 980,9 px breit gegen 792,3 px Promptbox, ragte also
diff --git a/src/components/chat/CodexView.tsx b/src/components/chat/CodexView.tsx
index c8c2800f..ed47a421 100644
--- a/src/components/chat/CodexView.tsx
+++ b/src/components/chat/CodexView.tsx
@@ -1,4 +1,5 @@
import { registerChatSender } from '../../lib/remote-chat-senders'
+import { PlanBar } from './PlanBar'
import { composeFileMessage } from '../../lib/chat-files'
import { useCodex } from '../../hooks/useCodex'
import { RequestUsageLine } from './RequestUsageLine'
@@ -787,6 +788,9 @@ export function CodexView() {
message={messages[messages.length - 1]?.role === 'assistant' ? messages[messages.length - 1] : undefined}
/>
)}
+ {/* The run's plan, pinned under the newest message (PlanBar.tsx).
+ It used to be the footer of the Explorer column. */}
+ {!readOnly && <PlanBar conversationId={activeConversationId} onContinue={(text) => sendInstruction(text, { shownMode })} />}
</div>
)}
</div>
diff --git a/src/components/chat/ExplorerPanel.tsx b/src/components/chat/ExplorerPanel.tsx
index 0a680c0c..ff4ea7e2 100644
--- a/src/components/chat/ExplorerPanel.tsx
+++ b/src/components/chat/ExplorerPanel.tsx
@@ -63,11 +63,9 @@ import {
type ExplorerNode,
type FsList,
} from '../../lib/explorer-tree'
-import { PlanBar } from './PlanBar'
import { PlanApprovalBar } from './PlanApprovalBar'
import { FilePreview } from './FilePreview'
import { useChatStore } from '../../stores/chatStore'
-import { useTodoStore } from '../../stores/todoStore'
import { HINWEIS_TEXT } from '../../lib/hinweis'
import { workspacePickRefusedMessage } from '../../lib/workspace-rejected'
@@ -148,10 +146,9 @@ export function ExplorerPanel({ onApprovePlan }: Props) {
const planWaiting = useCodexStore((s) =>
activeConversationId ? !!s.planApprovalByConversation[activeConversationId] : false,
)
- const planSteps = useTodoStore((s) =>
- activeConversationId ? (s.byConversation[activeConversationId]?.length ?? 0) : 0,
- )
- const planHasSomething = planWaiting || planSteps > 0
+ // The run's progress list moved into the transcript (PlanBar.tsx, CA
+ // 13.11.2026). What stays in this column is the approval card.
+ const planHasSomething = planWaiting
const load = async (dir: string) => {
setBusy((b) => (b.includes(dir) ? b : [...b, dir]))
@@ -300,7 +297,7 @@ export function ExplorerPanel({ onApprovePlan }: Props) {
{planHasSomething && (
<button
onClick={() => setExplorerCollapsed(false)}
- title={planWaiting ? 'A plan is waiting for your approval' : 'Show the plan'}
+ title="A plan is waiting for your approval"
data-testid="explorer-plan-waiting"
className={`mt-1 p-1 rounded transition-colors hover:bg-gray-100 dark:hover:bg-white/5 ${
planWaiting ? 'text-lu-accent' : 'text-gray-400 dark:text-gray-500'
@@ -476,12 +473,11 @@ export function ExplorerPanel({ onApprovePlan }: Props) {
<FilePreview key={selected.path} node={selected} root={root} onClose={() => setSelected(null)} />
)}
- {/* Bottom of the column, and the only place either of these renders.
- `shrink-0` so a long file tree can never squeeze the plan, and with
+ {/* Bottom of the column, the only place the approval card renders.
+ `shrink-0` so a long file tree can never squeeze the card, and with
it the Approve-and-run button, down to nothing. */}
<div className="shrink-0 border-t border-gray-200 dark:border-white/[0.04]">
<PlanApprovalBar onApprove={onApprovePlan} />
- <PlanBar variant="panel" />
</div>
</aside>
)
diff --git a/src/components/chat/MessageList.tsx b/src/components/chat/MessageList.tsx
index d267c836..afc0c821 100644
--- a/src/components/chat/MessageList.tsx
+++ b/src/components/chat/MessageList.tsx
@@ -1,4 +1,5 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import { PlanBar } from './PlanBar'
import type { CSSProperties } from 'react'
import { useChatStore } from '../../stores/chatStore'
import { useSettingsStore } from '../../stores/settingsStore'
@@ -81,9 +82,11 @@ interface Props {
pendingApprovalId?: string | null
onApprove?: () => void
onReject?: () => void
+ /** Sends a message in this chat: the pinned plan's "Continue". */
+ onContinuePlan?: (text: string) => void
}
-export function MessageList({ isGenerating, isThisChatGenerating, isLoadingModel, onRegenerate, onRegenerateSpeaker, onEdit, pendingApprovalId, onApprove, onReject }: Props) {
+export function MessageList({ isGenerating, isThisChatGenerating, isLoadingModel, onRegenerate, onRegenerateSpeaker, onEdit, pendingApprovalId, onApprove, onReject, onContinuePlan }: Props) {
const showTyping = isThisChatGenerating ?? isGenerating
// The question of the first use of computer control is open in this conversation.
const chatAsked = useComputerStore((s) => !!s.chatAsk && !s.chatAsk.voice && (s.chatAsk.conversationId === null || s.chatAsk.conversationId === useChatStore.getState().activeConversationId))
@@ -365,6 +368,8 @@ export function MessageList({ isGenerating, isThisChatGenerating, isLoadingModel
message={lastMessage}
/>
)}
+ {/* The run's plan, pinned under the newest message (PlanBar.tsx). */}
+ {!readOnly && <PlanBar conversationId={conversation.id} onContinue={onContinuePlan} />}
</div>
</div>
<CompactLayerRail view={layers} />
diff --git a/src/components/chat/PlanBar.tsx b/src/components/chat/PlanBar.tsx
index 2b584c54..5b0d9e53 100644
--- a/src/components/chat/PlanBar.tsx
+++ b/src/components/chat/PlanBar.tsx
@@ -1,28 +1,39 @@
-// The model's own plan for the current task.
+// The model's own plan for the current task, pinned under the newest message.
//
// On a long run the transcript scrolls away and the user is left guessing which
// step the agent is on and whether it still remembers the goal. The agent writes
// this list through `todo_write` and keeps it current, so progress is one glance
// instead of a scroll back through twenty tool calls.
//
-// Two homes, and neither one touches the prompt window. The owner has asked for
-// that five times now, last on 2026-08-22: the prompt window is the prompt
-// window, nothing about plans may be visible there, on any surface, in any
-// state. So there is no composer variant to reach for:
-// - 'header' (LU tab, plain chat and Agent alike): a status band under the
-// header row and above the transcript, next to the other standing status
-// controls. Collapsed to the current step by default, because a ten-item
-// list would push the conversation down.
-// - 'panel' (Code tab): the BOTTOM section of the Explorer column, full
-// column width and expanded by default. Bottom because the owner read the
-// column top down on 2026-08-22 and the files are what he wants first;
-// the plan is the footer of that column, not its headline.
-// Expanded state is per session, not persisted, because a plan is short-lived.
+// Where it lives (CA, 13.11.2026, David: "wie in der Claude-Code-Desktop-App"):
+// at the END of the transcript, right under the newest message, in both the
+// LU tab (Chat and Agent, MessageList) and the Code tab (CodexView). It is
+// `sticky bottom-0` inside the transcript's own scroll box, so while the run
+// writes it moves down with the conversation, and a reader who scrolls up still
+// has it at the bottom edge of the transcript. Before this it sat in two other
+// homes: a band above the transcript (LU tab) and the bottom of the Explorer
+// column (Code tab). The right column no longer shows it; the plan APPROVAL
+// card stays there (PlanApprovalBar), because that is a question with its own
+// button, not progress.
+//
+// It is still never inside the prompt window. The owner asked for that five
+// times (last 2026-08-22), and `the-prompt-window-is-the-prompt-window.test.ts`
+// keeps it: the plan is part of the transcript, not of the composer.
+//
+// One row per step: open (empty circle), running (spinner, bold), done (tick,
+// muted and struck through). Exactly one row runs: a model that marks two
+// steps `in_progress` gets the first one shown as running and the other as
+// open, never as done (a typo must not tick off work). The model replaces the
+// whole list on every `todo_write`, so a changed plan replaces this list whole.
+//
+// Collapsible to one line ("3 of 5 done" and the step that runs). When the run
+// is over, a short closing box sits under the list: the plan is done (and
+// whether changes still wait for approval), or the run ended with steps open,
+// with "Continue" and "Clear plan".
-import { useState } from 'react'
+import { useState, type ReactNode } from 'react'
import { AlertCircle, CheckCircle2, Circle, ChevronDown, ChevronRight, Loader2, ListTodo, X } from 'lucide-react'
-import { useTodoStore } from '../../stores/todoStore'
-import { useChatStore } from '../../stores/chatStore'
+import { useTodoStore, type TodoItem } from '../../stores/todoStore'
import { useCodexStore } from '../../stores/codexStore'
import { useGenerationStore } from '../../stores/generationStore'
import { useStagedChangesStore } from '../../stores/stagedChangesStore'
@@ -32,7 +43,7 @@ import { isRunStopped } from '../../lib/run-stop'
import { isActiveCodexStatus } from '../../types/codex'
import { HINWEIS_TEXT } from '../../lib/hinweis'
-/** What the collapsed bar says once the model ticked off every step. Ticking
+/** What the closing box says once the model ticked off every step. Ticking
* off a step is not the same as the change being on disk. */
export function planDoneLabel(pendingChanges: number): string {
if (pendingChanges <= 0) return 'every step done'
@@ -40,185 +51,181 @@ export function planDoneLabel(pendingChanges: number): string {
}
/**
- * Was die Leiste sagt, wenn der Lauf vorbei ist und der Plan offen blieb.
+ * Was die Liste sagt, wenn der Lauf vorbei ist und der Plan offen blieb.
*
* Gemessen am 03.09.2026 im laufenden Build: ein Lauf endete mit vier
* Schritten, von denen drei abgehakt waren, und die Leiste stand danach
- * unveraendert auf "PLAN 3/4", mit dem vierten Punkt als Ueberschrift und,
- * aufgeklappt, einem Kreisel, der weiterdrehte. Kein Wort davon, dass nichts
- * mehr laeuft. Genau so hat eine Persona es gemeldet ("blieb stehen").
- *
- * Die Zahl war dabei richtig: der Aufraeum-Steer in `plan-reconcile.ts` hat
- * ein Budget von zwei, und danach endet der Lauf mit offenem Plan. Die
- * Schlusszeile aus `turn-summary.ts` sagt das auch, aber NUR wenn das Modell
- * selbst nichts geschrieben hat. Schreibt es "fertig, alles erledigt", faellt
- * der Hinweis weg, und genau dann ist er am noetigsten. Die Leiste ist die
- * zweite Stelle, an der es stehen kann, und sie steht immer da.
+ * unveraendert auf "PLAN 3/4", mit einem Kreisel, der weiterdrehte. Kein Wort
+ * davon, dass nichts mehr laeuft. Die Schlusszeile aus `turn-summary.ts` sagt
+ * es nur, wenn das Modell selbst nichts geschrieben hat; die Liste sagt es
+ * immer.
*/
export function planStoppedLabel(done: number, total: number): string {
const open = total - done
return `the run ended here, ${done} of ${total} steps done, ${open} still open`
}
-export type PlanBarVariant = 'header' | 'panel'
+export type PlanRowState = 'done' | 'running' | 'open'
+
+/**
+ * The state each row shows. Exactly one row runs, and only while the run does:
+ * the first `in_progress` one. A second `in_progress` reads as open, never as
+ * done. After the run nothing spins: the step that was running reads as
+ * stopped (`open`, with the quiet tone the caller adds).
+ */
+export function planRowStates(todos: TodoItem[], runActive: boolean): PlanRowState[] {
+ let running = false
+ return todos.map((t) => {
+ if (t.status === 'completed') return 'done'
+ if (t.status === 'in_progress' && runActive && !running) {
+ running = true
+ return 'running'
+ }
+ return 'open'
+ })
+}
+
+/** "3 of 5 done", the collapsed line's count. */
+export function planCountLabel(todos: TodoItem[]): string {
+ const done = todos.filter((t) => t.status === 'completed').length
+ return `${done} of ${todos.length} done`
+}
interface Props {
- variant?: PlanBarVariant
+ conversationId: string | null | undefined
+ /** Sends a message in this chat; the "Continue" button uses it. */
+ onContinue?: (text: string) => void
}
-export function PlanBar({ variant = 'header' }: Props) {
- const panel = variant === 'panel'
- const activeConversationId = useChatStore((s) => s.activeConversationId)
- const todos = useTodoStore((s) =>
- activeConversationId ? s.byConversation[activeConversationId] : undefined,
- )
+export function PlanBar({ conversationId, onContinue }: Props) {
+ const todos = useTodoStore((s) => (conversationId ? s.byConversation[conversationId] : undefined))
// Ticking off every step is not the same as the work being on disk. In
// Stage-and-Approve the writes wait in the queue, and Morgan read "every step
// done" on a run whose six file changes had all been refused (2026-08-11).
- const pending = useStagedChangesStore((s) =>
- activeConversationId ? (s.byChat[activeConversationId]?.length ?? 0) : 0,
- )
+ const pending = useStagedChangesStore((s) => (conversationId ? (s.byChat[conversationId]?.length ?? 0) : 0))
const clearTodos = useTodoStore((s) => s.clearTodos)
- // Laeuft ueberhaupt noch etwas auf dieser Konversation. Beide Quellen einzeln
- // abonniert, damit die Leiste neu zeichnet, wenn der Lauf endet; das Urteil
- // selbst kommt aus `run-idle.ts`, der einen Stelle, die die zwei Quellen
- // versoehnt (AS-08). `generating` allein ist die Haelfte, die der Stop des
- // Coding-Agenten zuerst loescht.
- const generating = useGenerationStore((s) =>
- activeConversationId ? s.generating[activeConversationId] === true : false,
- )
- const threadStatus = useCodexStore((s) =>
- activeConversationId ? s.threads[activeConversationId]?.status : undefined,
- )
+ // Is anything still running in this conversation. Both sources subscribed
+ // on their own so the list redraws when the run ends; the verdict comes from
+ // `run-idle.ts` (AS-08). `generating` alone is the half that the coding
+ // agent's stop clears first.
+ const generating = useGenerationStore((s) => (conversationId ? s.generating[conversationId] === true : false))
+ const threadStatus = useCodexStore((s) => (conversationId ? s.threads[conversationId]?.status : undefined))
const runActive = isActiveCodexStatus(
- runStatusFrom(generating, threadStatus, isRunStopped(activeConversationId), isRunQueued(activeConversationId)),
+ runStatusFrom(generating, threadStatus, isRunStopped(conversationId), isRunQueued(conversationId)),
)
- const [expanded, setExpanded] = useState(panel)
+ const [collapsed, setCollapsed] = useState(false)
- if (!activeConversationId || !todos || todos.length === 0) return null
+ if (!conversationId || !todos || todos.length === 0) return null
+ const states = planRowStates(todos, runActive)
const done = todos.filter((t) => t.status === 'completed').length
- const current = todos.find((t) => t.status === 'in_progress')
const allDone = done === todos.length
- // Der Lauf ist vorbei und der Plan ist es nicht. Das ist die Aussage, die
- // vorher nirgends stand.
const stoppedShort = !allDone && !runActive
- // Collapsed, the one line that matters is what is happening NOW. With nothing
- // in progress (plan written but not started, or everything finished) fall back
- // to the first item that is still open, and only then to the last one.
- const headline = current ?? todos.find((t) => t.status === 'pending') ?? todos[todos.length - 1]
+ const runningIdx = states.indexOf('running')
+ // Collapsed, the one line that matters is what is happening NOW, else the
+ // first step still open, else the last one.
+ const headline = todos[runningIdx] ?? todos.find((t) => t.status !== 'completed') ?? todos[todos.length - 1]
+ const nextOpen = todos.find((t) => t.status !== 'completed')
return (
- <div
- // 'header' sits directly above the transcript, so it rides the SAME
- // measure column and the same px-3 gutter the bubbles use — a band that
- // ran the full window width while the answers below it stopped at 760px
- // read as a second, wider layout stacked on the first. 'panel' is the
- // Code Explorer column and owns its own width, so it keeps out of this.
- className={panel ? 'w-full p-1.5' : 'mx-auto w-full max-w-[var(--lu-measure)] px-3 pt-1'}
- data-testid={panel ? 'plan-panel' : 'plan-header'}
- >
- {/* Neutral on purpose (30.09.2026: "dunkel LU design, nicht
- abheben"). The plan is a footer of the column, it takes the column's
- own surface and line colour instead of a blue box of its own. */}
- <div className="w-full rounded-md border border-gray-200 dark:border-white/[0.06] bg-white dark:bg-white/[0.02]">
- <div className="flex items-center gap-1.5 px-2 py-1">
+ <div className="sticky bottom-0 z-10 px-3 pt-2 pb-1" data-testid="plan-pinned">
+ <div className="rounded-lg lu-elevated overflow-hidden">
+ <div className="flex items-center gap-1.5 px-2.5 py-1.5">
<button
- onClick={() => setExpanded((v) => !v)}
- title={expanded ? 'Collapse the plan' : 'Show every step'}
+ type="button"
+ onClick={() => setCollapsed((v) => !v)}
+ aria-expanded={!collapsed}
+ title={collapsed ? 'Show every step' : 'Collapse the plan'}
className="flex items-center gap-1.5 min-w-0 flex-1 text-left"
>
- {expanded ? (
- <ChevronDown size={9} className="text-gray-400 dark:text-gray-500 shrink-0" />
+ {collapsed ? (
+ <ChevronRight size={12} className="text-gray-400 dark:text-gray-500 shrink-0" />
) : (
- <ChevronRight size={9} className="text-gray-400 dark:text-gray-500 shrink-0" />
+ <ChevronDown size={12} className="text-gray-400 dark:text-gray-500 shrink-0" />
)}
- <ListTodo size={9} className="text-gray-400 dark:text-gray-500 shrink-0" />
- <span className="text-[0.55rem] uppercase tracking-wider text-gray-500 shrink-0">
- plan {done}/{todos.length}
+ <ListTodo size={12} className="text-gray-500 dark:text-gray-400 shrink-0" />
+ <span className="t-micro font-medium text-gray-700 dark:text-gray-200 shrink-0" data-testid="plan-count">
+ {planCountLabel(todos)}
</span>
- {!expanded && (
- <span
- className="flex-1 min-w-0 truncate t-micro text-gray-700 dark:text-gray-300"
- title={headline.content}
- >
- {headline.content}
+ {collapsed && (
+ <span className="flex-1 min-w-0 truncate t-micro text-gray-600 dark:text-gray-300" title={headline.content}>
+ · {headline.content}
</span>
)}
</button>
<button
- onClick={() => clearTodos(activeConversationId)}
+ type="button"
+ onClick={() => clearTodos(conversationId)}
title="Clear the plan"
- className="flex items-center justify-center w-4 h-4 rounded text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-white/5 transition-colors shrink-0"
+ aria-label="Clear the plan"
+ className="flex items-center justify-center w-5 h-5 rounded text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-white/5 transition-colors shrink-0"
>
- <X size={10} />
+ <X size={11} />
</button>
</div>
- {expanded && (
- // Capped so a fifteen-step plan cannot push the transcript off
- // screen, and in the panel so it cannot push the file tree out of
- // view.
- <ul className={`px-2 pb-1.5 space-y-0.5 overflow-y-auto ${panel ? 'max-h-48 scrollbar-thin' : 'max-h-40'}`}>
- {todos.map((t, i) => (
- <li key={`${i}-${t.content}`} className="flex items-start gap-1.5">
- {t.status === 'completed' ? (
- <CheckCircle2 size={10} className="text-gray-400 dark:text-gray-500 shrink-0 mt-[1px]" />
- ) : t.status === 'in_progress' ? (
- // Ein Kreisel, der sich dreht, behauptet Arbeit. Nach dem Ende
- // des Laufs ist das eine Behauptung ueber nichts: gemessen
- // drehte er nach dem letzten Wort des Modells unbegrenzt
- // weiter. Ohne Lauf steht er still und wird ruhig grau, wie
- // die Zeile unten, die dasselbe in Worten sagt. (Hier stand
- // Bernstein. Ein angehaltener Schritt ist kein halber Fehler,
- // siehe `lib/hinweis.ts`.)
- <Loader2
- size={10}
- className={`shrink-0 mt-[1px] ${runActive ? 'text-gray-600 dark:text-gray-300 animate-spin' : HINWEIS_TEXT.ruhig}`}
- />
- ) : (
- <Circle size={10} className="text-gray-300 dark:text-gray-700 shrink-0 mt-[1px]" />
- )}
- <span
- className={`t-micro leading-snug ${
- t.status === 'completed'
- ? 'text-gray-500 line-through'
- : t.status === 'in_progress'
- ? 'text-gray-800 dark:text-gray-100 font-medium'
- : 'text-gray-600 dark:text-gray-400'
- }`}
- >
- {t.content}
- </span>
- </li>
- ))}
+ {!collapsed && (
+ // Capped so a fifteen-step plan cannot cover the transcript it pins to.
+ <ul className="px-2.5 pb-2 space-y-1 max-h-56 overflow-y-auto scrollbar-thin" data-testid="plan-steps">
+ {todos.map((t, i) => {
+ const state = states[i]
+ const halted = !runActive && t.status === 'in_progress'
+ return (
+ <li key={`${i}-${t.content}`} className="flex items-start gap-2" data-state={state}>
+ {state === 'done' ? (
+ <CheckCircle2 size={13} className="text-gray-400 dark:text-gray-500 shrink-0 mt-[1px]" />
+ ) : state === 'running' ? (
+ <Loader2 size={13} className="text-gray-700 dark:text-gray-200 animate-spin shrink-0 mt-[1px]" />
+ ) : (
+ <Circle size={13} className={`shrink-0 mt-[1px] ${halted ? HINWEIS_TEXT.ruhig : 'text-gray-300 dark:text-gray-600'}`} />
+ )}
+ <span
+ className={`t-control leading-snug ${
+ state === 'done'
+ ? 'text-gray-400 dark:text-gray-500 line-through'
+ : state === 'running'
+ ? 'text-gray-900 dark:text-gray-50 font-medium'
+ : 'text-gray-600 dark:text-gray-300'
+ }`}
+ >
+ {t.content}
+ </span>
+ </li>
+ )
+ })}
</ul>
)}
- {(panel || !expanded) && allDone && (
- // In the header band this is the collapsed summary line. In the panel
- // the list is open by default, so the line has to stay: "every step done"
- // while six writes sit refused in the queue is exactly the sentence
- // Morgan believed.
- <Schlusszeile
- testid="plan-all-done"
- Symbol={CheckCircle2}
- ton={pending > 0 ? 'ruhig' : 'gut'}
- text={planDoneLabel(pending)}
- />
+ {!runActive && allDone && (
+ <Abschluss testid="plan-all-done" Symbol={CheckCircle2} ton={pending > 0 ? 'ruhig' : 'gut'}>
+ <span className="first-letter:uppercase inline-block">{planDoneLabel(pending)}.</span>
+ </Abschluss>
)}
{stoppedShort && (
- // Das Gegenstueck zur Zeile darueber, und aus demselben Grund an
- // derselben Stelle: sie steht IMMER, aufgeklappt wie zugeklappt.
- // Zugeklappt las die Leiste sonst "PLAN 3/4" mit dem vierten Punkt
- // daneben und sah aus wie ein Lauf, der gleich weitermacht.
- <Schlusszeile
- testid="plan-run-stopped"
- Symbol={AlertCircle}
- ton="ruhig"
- text={planStoppedLabel(done, todos.length)}
- />
+ <Abschluss testid="plan-run-stopped" Symbol={AlertCircle} ton="ruhig">
+ <span className="first-letter:uppercase inline-block">{planStoppedLabel(done, todos.length)}.</span>
+ {nextOpen && <span> Next: {nextOpen.content}</span>}
+ <div className="mt-1.5 flex flex-wrap gap-1.5">
+ {onContinue && (
+ <button
+ type="button"
+ onClick={() => onContinue('continue')}
+ data-testid="plan-continue"
+ className="lu-control lu-primary px-3 t-control font-medium"
+ >
+ Continue
+ </button>
+ )}
+ <button
+ type="button"
+ onClick={() => clearTodos(conversationId)}
+ className="lu-control px-3 t-control text-gray-800 dark:text-gray-100 border border-gray-300 dark:border-white/15 hover:bg-gray-100 dark:hover:bg-white/[0.06] transition-colors"
+ >
+ Clear plan
+ </button>
+ </div>
+ </Abschluss>
)}
</div>
</div>
@@ -226,35 +233,26 @@ export function PlanBar({ variant = 'header' }: Props) {
}
/**
- * Die eine Zeile unter der Liste, in zwei Toenen.
- *
- * Zusammengelegt, weil es jetzt ZWEI davon gibt (fertiger Plan, abgebrochener
- * Lauf) und zwei Abschriften derselben Zeile genau so auseinanderlaufen, wie
- * es die Typo-Sperrklinke beschreibt: die zweite entsteht durch Abschreiben
- * der ersten und bringt frische Umgehungen mit. Eine Groessenangabe, ein
- * Abstand, zwei Toene.
- *
- * Die zwei Toene sind `gut` (der Plan ist durch) und `ruhig`. Vorher hiess der
- * zweite `warnung` und war bernsteinfarben, an beiden Stellen zu Unrecht:
- * weder ein Lauf, der endet, noch eine Aenderung, die auf Freigabe wartet, ist
- * ein Fehler. Ruhig ist derselbe Ton wie sekundaerer Text, `lib/hinweis.ts`.
+ * The closing box under the list once the run is over, in two tones: `gut`
+ * (the plan is through) and `ruhig`. Neither a run that ends nor a change that
+ * waits for approval is an error, so no amber (`lib/hinweis.ts`).
*/
-function Schlusszeile({
+function Abschluss({
testid,
Symbol,
ton,
- text,
+ children,
}: {
testid: string
Symbol: typeof CheckCircle2
ton: 'gut' | 'ruhig'
- text: string
+ children: ReactNode
}) {
- const farbe = ton === 'gut' ? 'text-emerald-400' : HINWEIS_TEXT.ruhig
+ const farbe = ton === 'gut' ? 'text-emerald-600 dark:text-emerald-400' : HINWEIS_TEXT.ruhig
return (
- <div className={`px-2 pb-1 flex items-center gap-1.5 ${farbe}`} data-testid={testid}>
- <Symbol size={9} className="shrink-0" />
- <span className="text-[0.55rem] leading-snug">{text}</span>
+ <div className="border-t border-gray-200 dark:border-white/[0.06] px-2.5 py-2 flex items-start gap-2" data-testid={testid}>
+ <Symbol size={13} className={`shrink-0 mt-[1px] ${farbe}`} />
+ <div className="t-control leading-snug text-gray-700 dark:text-gray-200 min-w-0">{children}</div>
</div>
)
}
diff --git a/src/components/chat/__tests__/die-eingangsseite-hat-eine-tuer.test.ts b/src/components/chat/__tests__/die-eingangsseite-hat-eine-tuer.test.ts
index 275d0a33..009b5136 100644
--- a/src/components/chat/__tests__/die-eingangsseite-hat-eine-tuer.test.ts
+++ b/src/components/chat/__tests__/die-eingangsseite-hat-eine-tuer.test.ts
@@ -178,7 +178,6 @@ describe('D-S18: was vor dem ersten Inhalt steht', () => {
const strip = VIEW_CODE.indexOf('data-testid="chat-session-strip"')
const list = VIEW_CODE.indexOf('<MessageList')
const composer = VIEW_CODE.indexOf('<ChatInput')
- const plan = VIEW_CODE.indexOf('<PlanBar />')
it('die Sitzungsleiste steht unter dem Transkript, nicht darueber', () => {
expect(strip).toBeGreaterThan(-1)
@@ -197,9 +196,8 @@ describe('D-S18: was vor dem ersten Inhalt steht', () => {
expect(above.slice(0, 200)).not.toContain('chat-session-strip')
})
- it('der Plan bleibt oben — der ist das Einzige, was vor dem Inhalt gehoert', () => {
- expect(plan).toBeGreaterThan(-1)
- expect(list).toBeGreaterThan(plan)
- expect(VIEW_CODE.match(/<PlanBar\b/g)).toHaveLength(1)
+ it('der Plan steht nicht mehr davor, er haengt unter der neuesten Nachricht', () => {
+ // Seit CA (13.11.2026) im Transkript angeheftet (MessageList, PlanBar.tsx).
+ expect(VIEW_CODE).not.toMatch(/<PlanBar\b/)
})
})
diff --git a/src/components/chat/__tests__/plan-done-vs-applied.test.ts b/src/components/chat/__tests__/plan-done-vs-applied.test.ts
index b0cffbd7..7a12c8d3 100644
--- a/src/components/chat/__tests__/plan-done-vs-applied.test.ts
+++ b/src/components/chat/__tests__/plan-done-vs-applied.test.ts
@@ -42,70 +42,51 @@ describe('the bar reads the staging queue', () => {
expect(src).toMatch(/planDoneLabel\(pending\)/)
})
- it('the warning survives the panel, where the list is open by default', () => {
+ it('the warning stands under the list whatever its fold, once the run is over', () => {
const src = read('../PlanBar.tsx')
- // Collapsed-only would have hidden the Morgan line in the panel, because
- // the panel starts expanded.
- expect(src).toMatch(/\(panel \|\| !expanded\) && allDone/)
- expect(src).toMatch(/useState\(panel\)/)
+ // Collapsed-only once hid the Morgan line where the list started open.
+ // Since CA (13.11.2026) the closing box hangs on the run, not on the fold.
+ expect(src).toMatch(/\{!runActive && allDone && \(/)
})
})
-describe('the plan moved into the panel (C2)', () => {
- it('PlanBar has a panel variant and a header variant, no composer one', () => {
- const src = read('../PlanBar.tsx')
- expect(src).toMatch(/variant = 'header'/)
- expect(src).toMatch(/panel = variant === 'panel'/)
- // The old 70% wrapper was the composer's; in a 280px column it squeezed the
- // plan into a third of the panel, and at the prompt box it had no business
- // being at all. The panel therefore still owns its full column width and
- // must never pick up a measure or a percentage.
- expect(src).toMatch(/panel \? 'w-full p-1\.5'/)
- const panelBranch = src.slice(src.indexOf("panel ? 'w-full p-1.5'"))
- expect(panelBranch.slice(0, panelBranch.indexOf(':'))).not.toMatch(/max-w-|70%/)
- // The header band, by contrast, sits directly above the transcript and
- // rides the SAME measure column and gutter as the bubbles (design wave 1) —
- // a status band running the full window width above 760px of answers read
- // as a second layout stacked on the first.
- expect(src).toMatch(/mx-auto w-full max-w-\[var\(--lu-measure\)\] px-3 pt-1/)
- })
-
+describe('the plan is pinned under the newest message (CA, 13.11.2026)', () => {
+ // C2 (2.6.6) moved it into the Code panel, 2026-08-22 put it at the bottom of
+ // that column and into a header band on the LU tab. David, 13.11.2026: like
+ // the Claude Code desktop app, under the newest message, in both tabs. The
+ // invariant that it never enters the prompt window lives in
+ // the-prompt-window-is-the-prompt-window.test.ts.
it('the clear button and the staged count came along, unchanged', () => {
const src = read('../PlanBar.tsx')
- expect(src).toMatch(/clearTodos\(activeConversationId\)/)
- expect(src).toMatch(/s\.byChat\[activeConversationId\]\?\.length \?\? 0/)
+ expect(src).toMatch(/clearTodos\(conversationId\)/)
+ expect(src).toMatch(/s\.byChat\[conversationId\]\?\.length \?\? 0/)
})
- it('the coding composer carries no plan, not even the approval card', () => {
+ it('the coding composer carries no plan', () => {
const src = read('../CodexView.tsx')
- // C1 had put the plan APPROVAL card here (a button plus the plan text the
- // user is approving). It went down into the panel too on 2026-08-22: the
- // prompt window is the prompt window.
- // 21.09.2026: dieser Composer reicht gar nichts mehr nach oben durch
- // („NICHTS im prompt fenster!"). LoopBar und GoalBar sind Bedienelemente
- // und weiterhin da, nur als Geschwister UEBER dem Kasten. Der Anspruch
- // dieses Falles ist unveraendert: hier lebt kein Plan.
expect(src).not.toMatch(/composerAbove/)
expect(src).toMatch(/<LoopBar onStop=\{stopCodex\} \/>/)
expect(src).toMatch(/<GoalBar \/>/)
- expect(src).not.toMatch(/PlanBar/)
expect(src).not.toMatch(/PlanApprovalBar/)
})
- it('the panel renders it, below the tree', () => {
- const src = read('../ExplorerPanel.tsx')
- expect(src).toMatch(/<PlanBar variant="panel" \/>/)
- const plan = src.indexOf('<PlanBar variant="panel" />')
- const tree = src.indexOf('{rows.map((row) => {')
- expect(plan).toBeGreaterThan(-1)
- expect(plan).toBeGreaterThan(tree)
+ it('the Code tab renders it after the run anchor, inside the transcript', () => {
+ const src = read('../CodexView.tsx')
+ const anchor = src.indexOf('<WorkingAnchor')
+ const plan = src.indexOf('<PlanBar conversationId={activeConversationId}')
+ expect(plan).toBeGreaterThan(anchor)
+ expect(src.indexOf('<ChatInput')).toBeGreaterThan(plan)
+ })
+
+ it('the LU tab renders it at the end of MessageList, not in a band above', () => {
+ const list = read('../MessageList.tsx')
+ expect(list.indexOf('<PlanBar conversationId={conversation.id}')).toBeGreaterThan(list.indexOf('<WorkingAnchor'))
+ expect(read('../ChatView.tsx')).not.toMatch(/<PlanBar\b/)
})
- it('and the chat tab shows it in the header band, not at its composer', () => {
- // The Chat and Agent surface has no right-hand column, so the plan sits
- // with the standing status controls above the transcript instead.
- const src = read('../ChatView.tsx')
- expect(src).toMatch(/<PlanBar \/>/)
- expect(src.indexOf('<PlanBar />')).toBeLessThan(src.indexOf('<MessageList'))
+ it('and the right column no longer repeats it', () => {
+ const src = read('../ExplorerPanel.tsx')
+ expect(src).not.toMatch(/<PlanBar\b/)
+ expect(src).toMatch(/<PlanApprovalBar onApprove=\{onApprovePlan\} \/>/)
})
})
diff --git a/src/components/chat/__tests__/plan-pinned-under-the-newest-message.test.tsx b/src/components/chat/__tests__/plan-pinned-under-the-newest-message.test.tsx
new file mode 100644
index 00000000..b87b025e
--- /dev/null
+++ b/src/components/chat/__tests__/plan-pinned-under-the-newest-message.test.tsx
@@ -0,0 +1,138 @@
+/**
+ * @vitest-environment jsdom
+ *
+ * CA (13.11.2026, David): the plan is pinned under the newest message, like
+ * the Claude Code desktop app. One row per step, exactly one runs, the list
+ * folds to one line, and once the run is over a closing box says how it ended.
+ * Same component for local and cloud models: it reads only the plan the model
+ * wrote through todo_write.
+ */
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { act, cleanup, fireEvent, render } from '@testing-library/react'
+import { PlanBar, planRowStates, planCountLabel } from '../PlanBar'
+import { useTodoStore, writeTodos, type TodoItem } from '../../../stores/todoStore'
+import { useGenerationStore } from '../../../stores/generationStore'
+import { useStagedChangesStore } from '../../../stores/stagedChangesStore'
+
+const CONV = 'conv-plan'
+
+function running(on: boolean) {
+ useGenerationStore.setState((s) => ({ generating: { ...s.generating, [CONV]: on } }))
+}
+
+beforeEach(() => {
+ useTodoStore.setState({ byConversation: {}, updatedAt: {} })
+ useStagedChangesStore.setState({ byChat: {} } as never)
+ running(false)
+})
+afterEach(() => cleanup())
+
+const PLAN: TodoItem[] = [
+ { content: 'Read the file', status: 'completed' },
+ { content: 'Write median()', status: 'in_progress' },
+ { content: 'Run the tests', status: 'pending' },
+]
+
+describe('planRowStates', () => {
+ it('one step runs while the run does', () => {
+ expect(planRowStates(PLAN, true)).toEqual(['done', 'running', 'open'])
+ })
+
+ it('a second in_progress reads as open, never as done', () => {
+ const two = [...PLAN.slice(0, 2), { content: 'Run the tests', status: 'in_progress' as const }]
+ expect(planRowStates(two, true)).toEqual(['done', 'running', 'open'])
+ })
+
+ it('nothing spins once the run is over', () => {
+ expect(planRowStates(PLAN, false)).toEqual(['done', 'open', 'open'])
+ })
+
+ it('counts done steps for the folded line', () => {
+ expect(planCountLabel(PLAN)).toBe('1 of 3 done')
+ })
+})
+
+describe('PlanBar, pinned in the transcript', () => {
+ it('shows nothing without a plan', () => {
+ const v = render(<PlanBar conversationId={CONV} />)
+ expect(v.queryByTestId('plan-pinned')).toBeNull()
+ })
+
+ it('lists every step with its state and sticks to the bottom of the transcript', () => {
+ running(true)
+ writeTodos(CONV, PLAN)
+ const v = render(<PlanBar conversationId={CONV} />)
+ const box = v.getByTestId('plan-pinned')
+ expect(box.className).toMatch(/\bsticky\b/)
+ expect(box.className).toMatch(/\bbottom-0\b/)
+ const rows = [...v.getByTestId('plan-steps').querySelectorAll('li')]
+ expect(rows.map((r) => r.getAttribute('data-state'))).toEqual(['done', 'running', 'open'])
+ expect(v.getByTestId('plan-count').textContent).toBe('1 of 3 done')
+ expect(v.container.querySelectorAll('.animate-spin')).toHaveLength(1)
+ // No closing box while the run goes.
+ expect(v.queryByTestId('plan-all-done')).toBeNull()
+ expect(v.queryByTestId('plan-run-stopped')).toBeNull()
+ })
+
+ it('updates live and replaces the whole list when the plan changes', () => {
+ running(true)
+ writeTodos(CONV, PLAN)
+ const v = render(<PlanBar conversationId={CONV} />)
+ act(() => {
+ writeTodos(CONV, [
+ { content: 'Read the file', status: 'completed' },
+ { content: 'Write median()', status: 'completed' },
+ { content: 'Run the tests', status: 'in_progress' },
+ ])
+ })
+ expect([...v.getByTestId('plan-steps').querySelectorAll('li')].map((r) => r.getAttribute('data-state')))
+ .toEqual(['done', 'done', 'running'])
+ act(() => { writeTodos(CONV, [{ content: 'Start over with a test first', status: 'in_progress' }]) })
+ const rows = [...v.getByTestId('plan-steps').querySelectorAll('li')]
+ expect(rows).toHaveLength(1)
+ expect(rows[0].textContent).toContain('Start over with a test first')
+ expect(v.queryByText('Write median()')).toBeNull()
+ })
+
+ it('folds to one line with the count and the running step', () => {
+ running(true)
+ writeTodos(CONV, PLAN)
+ const v = render(<PlanBar conversationId={CONV} />)
+ fireEvent.click(v.getByTitle('Collapse the plan'))
+ expect(v.queryByTestId('plan-steps')).toBeNull()
+ expect(v.getByTestId('plan-pinned').textContent).toContain('1 of 3 done')
+ expect(v.getByTestId('plan-pinned').textContent).toContain('Write median()')
+ fireEvent.click(v.getByTitle('Show every step'))
+ expect(v.getByTestId('plan-steps')).toBeTruthy()
+ })
+
+ it('a finished run gets a closing box, and names changes still waiting', () => {
+ writeTodos(CONV, PLAN.map((t) => ({ ...t, status: 'completed' as const })))
+ const v = render(<PlanBar conversationId={CONV} />)
+ expect(v.getByTestId('plan-all-done').textContent).toContain('every step done')
+ act(() => { useStagedChangesStore.setState({ byChat: { [CONV]: [{}, {}] } } as never) })
+ expect(v.getByTestId('plan-all-done').textContent).toContain('2 changes still waiting for your approval')
+ })
+
+ it('a run that ended with steps open says so, with Continue and Clear plan', () => {
+ writeTodos(CONV, PLAN)
+ const onContinue = vi.fn()
+ const v = render(<PlanBar conversationId={CONV} onContinue={onContinue} />)
+ const box = v.getByTestId('plan-run-stopped')
+ expect(box.textContent).toContain('the run ended here, 1 of 3 steps done, 2 still open')
+ expect(box.textContent).toContain('Next: Write median()')
+ expect(v.container.querySelectorAll('.animate-spin')).toHaveLength(0)
+ fireEvent.click(v.getByTestId('plan-continue'))
+ expect(onContinue).toHaveBeenCalledWith('continue')
+ fireEvent.click(v.getByText('Clear plan'))
+ expect(useTodoStore.getState().byConversation[CONV]).toBeUndefined()
+ expect(v.queryByTestId('plan-pinned')).toBeNull()
+ })
+
+ it('the closing box stays when the list is folded', () => {
+ writeTodos(CONV, PLAN)
+ const v = render(<PlanBar conversationId={CONV} />)
+ fireEvent.click(v.getByTitle('Collapse the plan'))
+ expect(v.getByTestId('plan-run-stopped')).toBeTruthy()
+ })
+})
diff --git a/src/components/chat/__tests__/plan-sagt-wann-der-lauf-endete.test.ts b/src/components/chat/__tests__/plan-sagt-wann-der-lauf-endete.test.ts
index 8138b4e1..8f1c5e07 100644
--- a/src/components/chat/__tests__/plan-sagt-wann-der-lauf-endete.test.ts
+++ b/src/components/chat/__tests__/plan-sagt-wann-der-lauf-endete.test.ts
@@ -59,13 +59,14 @@ describe('die Leiste fragt beide Laufquellen, nicht nur eine', () => {
})
it('holt das Urteil aus run-idle statt sich ein zweites zu bauen', () => {
- expect(src).toMatch(/runStatusFrom\(generating, threadStatus, isRunStopped\(activeConversationId\), isRunQueued\(activeConversationId\)\)/)
+ expect(src).toMatch(/runStatusFrom\(generating, threadStatus, isRunStopped\(conversationId\), isRunQueued\(conversationId\)\)/)
expect(src).toMatch(/const stoppedShort = !allDone && !runActive/)
})
it('sagt es zugeklappt wie aufgeklappt, wie die Zeile fuer den fertigen Plan', () => {
- // Nur zugeklappt haette es im Code-Panel versteckt, das aufgeklappt
- // startet. Es ist derselbe Fehler, den die Morgan-Zeile schon einmal hatte.
+ // Nur zugeklappt haette es versteckt, solange die Liste offen ist. Es ist
+ // derselbe Fehler, den die Morgan-Zeile schon einmal hatte. Seit CA
+ // (13.11.2026) haengt der Abschlusskasten an keinem Klappzustand.
expect(src).toMatch(/\{stoppedShort && \(/)
expect(src).toMatch(/testid="plan-run-stopped"/)
// Und sie teilt sich die Zeile mit der Morgan-Zeile, statt sie
@@ -73,7 +74,7 @@ describe('die Leiste fragt beide Laufquellen, nicht nur eine', () => {
// in `die-typo-leiter-und-ihre-umgehung.test.ts` hat genau das schon
// einmal aufgefangen.
expect(src).toMatch(/testid="plan-all-done"/)
- expect(src.match(/function Schlusszeile\(/g) ?? []).toHaveLength(1)
+ expect(src.match(/function Abschluss\(/g) ?? []).toHaveLength(1)
})
it('der Kreisel dreht nur, solange wirklich etwas laeuft', () => {
@@ -85,7 +86,13 @@ describe('die Leiste fragt beide Laufquellen, nicht nur eine', () => {
// nichts mehr laeuft, ist kein halber Fehler, sondern ruhig. Die Aussage
// des Tests ist dieselbe geblieben und haengt jetzt an der Bewegung
// statt an der Farbe: es dreht sich nur, was wirklich laeuft.
- expect(src).toMatch(/runActive \? 'text-gray-600 dark:text-gray-300 animate-spin' : HINWEIS_TEXT\.ruhig/)
+ // Seit CA (13.11.2026) entscheidet `planRowStates`: 'running' gibt es nur
+ // bei laufendem Lauf, und nur fuer EINEN Schritt (Verhalten in
+ // plan-pinned-under-the-newest-message.test.tsx). Ein angehaltener
+ // Schritt ist ein ruhiger Kreis.
+ expect(src).toMatch(/t\.status === 'in_progress' && runActive && !running/)
+ expect(src).toMatch(/state === 'running' \? \(\s*<Loader2[^>]*animate-spin/)
+ expect(src).toMatch(/halted \? HINWEIS_TEXT\.ruhig/)
// Und es gibt genau EINE Drehung in der Datei, sonst koennte daneben ein
// zweiter Kreisel stehen, den kein Lauf mehr anhaelt.
expect(src.match(/animate-spin/g) ?? []).toHaveLength(1)
diff --git a/src/components/chat/__tests__/the-prompt-window-is-the-prompt-window.test.ts b/src/components/chat/__tests__/the-prompt-window-is-the-prompt-window.test.ts
index b7c87c52..7b5adb80 100644
--- a/src/components/chat/__tests__/the-prompt-window-is-the-prompt-window.test.ts
+++ b/src/components/chat/__tests__/the-prompt-window-is-the-prompt-window.test.ts
@@ -21,10 +21,12 @@
* the prompt window itself and is checked as a whole.
*
* Where a plan is allowed to be instead:
- * - Code: the BOTTOM of the Explorer column (ExplorerPanel), plan progress
- * and Approve-and-run together, below the tree and the file preview.
- * - Chat and Agent: the header band above the transcript, with the other
- * standing status controls. No right-hand column exists there.
+ * - The run's progress list (PlanBar): pinned under the newest message,
+ * INSIDE the transcript, on every surface (MessageList for Chat and Agent,
+ * CodexView's transcript for Code). David, 13.11.2026: like the Claude Code
+ * desktop app. It is part of the conversation, not of the prompt box.
+ * - Approve-and-run (PlanApprovalBar): the BOTTOM of the Explorer column on
+ * Code, below the tree and the file preview.
*
* Run: npx vitest run src/components/chat/__tests__/the-prompt-window-is-the-prompt-window.test.ts
*/
@@ -41,8 +43,8 @@ const THE_RULE =
'Im Promptfenster darf nichts von Plaenen zu sehen sein. Das Promptfenster ist das Promptfenster.'
const WHERE_IT_BELONGS =
- 'The plan has a home: the BOTTOM of the Explorer column on Code (ExplorerPanel), ' +
- 'and the header band above the transcript on Chat and Agent (ChatView). Put it there.'
+ 'The plan has a home: pinned under the newest message inside the transcript (PlanBar in ' +
+ 'MessageList and in CodexView\'s transcript), and Approve-and-run at the bottom of the Explorer column. Put it there.'
/** Every component file under src/components, by component name. */
function componentFiles(dir: string, out: Record<string, string> = {}): Record<string, string> {
@@ -149,7 +151,8 @@ describe('the plan components the invariant is about', () => {
it('offer no composer shape to reach for any more', () => {
const src = readFileSync(resolve(CHAT, 'PlanBar.tsx'), 'utf8')
- expect(src).toMatch(/PlanBarVariant = 'header' \| 'panel'/)
+ // One shape only since CA (13.11.2026): pinned in the transcript.
+ expect(src).not.toMatch(/PlanBarVariant/)
expect(src).not.toMatch(/'composer'/)
})
})
@@ -193,21 +196,28 @@ describe('and nothing sits immediately at the prompt box either', () => {
// rendered as a sibling right above <ChatInput> would look identical to the
// user, so each surface also has to prove where its plan actually is.
- it('the LU tab renders its plan in the header band, above the transcript', () => {
- const src = readFileSync(resolve(CHAT, 'ChatView.tsx'), 'utf8')
- const plan = src.indexOf('<PlanBar />')
- const transcript = src.indexOf('<MessageList')
- const composer = src.indexOf('<ChatInput')
- expect(plan).toBeGreaterThan(-1)
- expect(transcript).toBeGreaterThan(plan)
- expect(composer).toBeGreaterThan(transcript)
- // One plan on the surface, so "the other one" cannot quietly be at the box.
- expect(src.match(/<PlanBar\b/g)).toHaveLength(1)
+ it('the LU tab renders its plan at the end of the transcript, inside MessageList', () => {
+ const view = readFileSync(resolve(CHAT, 'ChatView.tsx'), 'utf8')
+ const list = readFileSync(resolve(CHAT, 'MessageList.tsx'), 'utf8')
+ // Not in ChatView itself, so nothing can stand as a sibling at the box.
+ expect(view).not.toMatch(/<PlanBar\b/)
+ expect(view.indexOf('<ChatInput')).toBeGreaterThan(view.indexOf('<MessageList'))
+ // In MessageList: once, after the messages and the run anchor, inside the
+ // scrolling transcript (the box that `scrollRef` scrolls).
+ expect(list.match(/<PlanBar\b/g)).toHaveLength(1)
+ const plan = list.indexOf('<PlanBar')
+ expect(plan).toBeGreaterThan(list.indexOf('<WorkingAnchor'))
+ expect(plan).toBeGreaterThan(list.indexOf('ref={scrollRef}'))
+ expect(plan).toBeLessThan(list.indexOf('<CompactLayerRail'))
})
- it('the Code tab has no plan in the view at all, panel only', () => {
+ it('the Code tab renders its plan at the end of its transcript, never in the composer', () => {
const src = readFileSync(resolve(CHAT, 'CodexView.tsx'), 'utf8')
- expect(src).not.toMatch(/PlanBar/)
+ expect(src.match(/<PlanBar\b/g)).toHaveLength(1)
+ const plan = src.indexOf('<PlanBar')
+ expect(plan).toBeGreaterThan(src.indexOf('<WorkingAnchor'))
+ expect(plan).toBeGreaterThan(src.indexOf('ref={scrollRef}'))
+ expect(plan).toBeLessThan(src.indexOf('<CompactLayerRail'))
expect(src).not.toMatch(/PlanApprovalBar/)
// The approve callback still leaves from here, because this view owns the
// send. Losing this line would leave an Approve button that runs nothing.
@@ -215,25 +225,27 @@ describe('and nothing sits immediately at the prompt box either', () => {
})
})
-describe('the Code panel keeps the plan at the bottom', () => {
+describe('the Code panel keeps the approval card at the bottom', () => {
// 2026-08-22: the plan sitting at the TOP of the column made no sense
// to him. Files first, plan as the footer of the column.
const src = readFileSync(resolve(CHAT, 'ExplorerPanel.tsx'), 'utf8')
const tree = src.indexOf('{rows.map((row) => {')
const preview = src.indexOf('<FilePreview')
const approval = src.indexOf('<PlanApprovalBar')
- const plan = src.indexOf('<PlanBar variant="panel" />')
+ // The progress list left this column (CA, 13.11.2026); only the approval
+ // card is still here, and the column does not repeat the list.
+ it('without the progress list', () => {
+ expect(src).not.toMatch(/<PlanBar\b/)
+ })
it('below the file tree', () => {
expect(tree).toBeGreaterThan(-1)
expect(approval).toBeGreaterThan(tree)
- expect(plan).toBeGreaterThan(tree)
})
it('below the file preview, so it is the last section in the column', () => {
expect(preview).toBeGreaterThan(-1)
expect(approval).toBeGreaterThan(preview)
- expect(plan).toBeGreaterThan(preview)
})
it('with the approval card, which came down from the composer with it', () => {
diff --git a/src/components/chat/__tests__/zwei-baender-sind-eine-flaeche.test.ts b/src/components/chat/__tests__/zwei-baender-sind-eine-flaeche.test.ts
index 18ff0ef4..40ec5648 100644
--- a/src/components/chat/__tests__/zwei-baender-sind-eine-flaeche.test.ts
+++ b/src/components/chat/__tests__/zwei-baender-sind-eine-flaeche.test.ts
@@ -161,10 +161,11 @@ describe('D-S18: das dritte Band bleibt unter dem Transkript', () => {
})
it('und ChatView legt vor dem Transkript nichts Neues davor', () => {
- // Was oberhalb von <MessageList> im Chat-Zweig steht, sind genau drei
- // Elemente, und alle drei rendern `null`, solange sie nichts zu sagen
- // haben: <PlanBar /> ohne Plan, <ChatNotices /> ohne Zeile,
- // <RetrievalErrorBar /> ohne Fehler. Im Normalfall kostet also keines von
+ // Was oberhalb von <MessageList> im Chat-Zweig steht, sind genau zwei
+ // Elemente, und beide rendern `null`, solange sie nichts zu sagen
+ // haben: <ChatNotices /> ohne Zeile, <RetrievalErrorBar /> ohne Fehler.
+ // (Der Plan stand hier als drittes; seit CA, 13.11.2026, haengt er unter
+ // der neuesten Nachricht im Transkript.) Im Normalfall kostet also keines von
// ihnen ein Band. Jedes WEITERE Element hier waere ein drittes Band durch
// die Hintertuer.
//
@@ -175,7 +176,7 @@ describe('D-S18: das dritte Band bleibt unter dem Transkript', () => {
// solange nichts passiert ist.
const zweig = VIEW.slice(VIEW.indexOf('key="chat"'), VIEW.indexOf('<MessageList'))
const elemente = [...zweig.matchAll(/<([A-Z][A-Za-z]*)\b/g)].map((m) => m[1])
- expect(elemente).toEqual(['PlanBar', 'ChatNotices', 'RetrievalErrorBar'])
+ expect(elemente).toEqual(['ChatNotices', 'RetrievalErrorBar'])
// Und die Bedingung, unter der das zulaessig ist: beide Neuen sind im
// Ruhezustand wirklich nichts.
expect(codeOnly(read('chat/ChatNotices.tsx'))).toMatch(/notices\.length === 0\) return null/)