feat(frontend): central 'working' indicator — elapsed time + model-stream tail
While the model works (active session, no pending widget), CentralStatus shows a Claude-Code-style live status: a pulsing dot, elapsed seconds (ticking), and a short tail of the model's current output — so the centre no longer looks stuck during the long F1 loop. Verbose stream stays in the left panel. No tokens yet (would need the SessionBridge to forward Pi usage). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -5,8 +5,8 @@ import { CentralStatus } from "./CentralStatus";
|
||||
|
||||
beforeEach(() => useSessionStore.getState().resetSession());
|
||||
|
||||
test("renders nothing when there is no user entry and no step messages", () => {
|
||||
const { container } = render(<CentralStatus />);
|
||||
test("renders nothing when not working and there is no user entry or step messages", () => {
|
||||
const { container } = render(<CentralStatus working={false} />);
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
|
||||
@@ -14,7 +14,22 @@ test("echoes the last user entry and the step messages", () => {
|
||||
const st = useSessionStore.getState();
|
||||
st.setLastUserEntry({ kind: "input", text: "how many patients?" });
|
||||
st.applyEvent({ type: "info", level: "info", text: "Searching the schema…" });
|
||||
render(<CentralStatus />);
|
||||
render(<CentralStatus working={false} />);
|
||||
expect(screen.getByText("how many patients?")).toBeInTheDocument();
|
||||
expect(screen.getByText("Searching the schema…")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("shows a working indicator with elapsed time and the model-stream tail while working", () => {
|
||||
useSessionStore.getState().applyEvent({ type: "text_delta", text: "Reading the schema for dim_patient" });
|
||||
render(<CentralStatus working />);
|
||||
// elapsed time (e.g. "0s")
|
||||
expect(screen.getByText(/\d+s/)).toBeInTheDocument();
|
||||
// a short tail of the model's current output
|
||||
expect(screen.getByText(/Reading the schema for dim_patient/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("no working indicator when not working, even with a transcript", () => {
|
||||
useSessionStore.getState().applyEvent({ type: "text_delta", text: "background narration" });
|
||||
render(<CentralStatus working={false} />);
|
||||
expect(screen.queryByText(/\d+s/)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user