Skip to content
Python

Trace index in the right rail (#856)

Rohit Prasadf6a7fe36ed9f
diff --git a/surfaces/gui/e2e/trace-index.spec.ts b/surfaces/gui/e2e/trace-index.spec.ts
new file mode 100644
index 00000000..7f6adc57
--- /dev/null
+++ b/surfaces/gui/e2e/trace-index.spec.ts
@@ -0,0 +1,122 @@
+// UX-060: the trace index. The rail's Trace section lists the session's turns by the first
+// words of each message of yours; a row goes to that message and opens the trace on its
+// turn, at the artifact-reading width with the same index as the panel's left column. The
+// old doors — the top-bar "Session trace" button and the hover-row link — are gone; the
+// footer link under each answer stays.
+import { expect, type Page } from "@playwright/test";
+import { test, seedSessionMessages } from "./fixtures";
+
+const TS = 1755600000;
+const SESSION = "pinned-cowork-1";
+
+const HISTORY = [
+ { role: "user", content: "What does greet.py do? One sentence.", ts: TS, mid: "u1" },
+ { role: "assistant", content: "It greets.", ts: TS + 3, mid: "a1" },
+ { role: "user", content: "List the files in this repo.", ts: TS + 60, mid: "u2" },
+ { role: "assistant", content: "README.md and greet.py.", ts: TS + 62, mid: "a2" },
+ { role: "user", content: "What is the latest commit?", ts: TS + 120, mid: "u3" },
+ { role: "assistant", content: "abc123 init.", ts: TS + 121, mid: "a3" },
+];
+
+const turn = (n: number, first: string, last: string, ms: number, warn = 0) => ({
+ turn_id: `t${n}`, seq: n, kind: "user", trigger: "user", status: "done",
+ started_at: (TS + (n - 1) * 60) * 1000, duration_ms: ms, first_message_id: first, last_message_id: last,
+ stamp: {}, buckets: { total: ms, model: ms }, usage: { pill: 1000 * n },
+ issues: warn ? { warn } : undefined, total: 1000 * n, at_least: false, warn, auto_approved: 0, asked: 0,
+});
+const TURNS = [turn(1, "u1", "a1", 2600, 2), turn(2, "u2", "a2", 1200), turn(3, "u3", "a3", 900)];
+
+async function seedTrace(page: Page) {
+ await seedSessionMessages(page, SESSION, HISTORY);
+ await page.route(new RegExp(`/v1/sessions/${SESSION}/footers$`), (route) =>
+ route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ turns: TURNS, recording: true }) }));
+ await page.route(new RegExp(`/v1/sessions/${SESSION}/turns$`), (route) =>
+ route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ turns: TURNS }) }));
+}
+
+test("the rail's Trace section indexes the turns and is the one way in", async ({ page }) => {
+ await seedTrace(page);
+ await page.goto("/");
+ await page.getByText("Draft the launch note").first().click();
+
+ // The old doors are gone; the footer link under an answer stays.
+ await expect(page.getByTestId("steps-open")).toHaveCount(0);
+ await expect(page.getByTestId("bubble-steps")).toHaveCount(0);
+ await expect(page.getByTestId("turn-footer-steps").first()).toBeVisible();
+
+ // Collapsed header: turns and issues. Expanded: a row per message, with its glance.
+ const head = page.getByTestId("rail-toggle-trace");
+ await expect(head).toContainText("3 turns");
+ await expect(head).toContainText("2 issues");
+ await head.click();
+ await expect(page.getByTestId("trace-row-1")).toContainText("What does greet.py do?");
+ await expect(page.getByTestId("trace-row-1")).toContainText("2.6s");
+ await expect(page.getByTestId("trace-row-3")).toContainText("What is the latest commit?");
+});
+
+test("a row goes to its message and opens the trace on that turn, index beside it", async ({ page }) => {
+ await seedTrace(page);
+ await page.goto("/");
+ await page.getByText("Draft the launch note").first().click();
+ await page.getByTestId("rail-toggle-trace").click();
+ await page.getByTestId("trace-row-2").click();
+
+ // The panel opens on turn 2, with the index as its left column marking that turn.
+ const panel = page.getByTestId("steps-panel");
+ await expect(panel).toBeVisible();
+ await expect(panel.getByTestId("steps-turn")).toContainText("Turn 2 of 3");
+ await expect(panel.getByTestId("steps-index")).toBeVisible();
+ await expect(panel.getByTestId("trace-row-2")).toHaveAttribute("aria-current", "true");
+
+ // The open trace is wider than the 332px rail (the artifact-reading width).
+ const box = await page.locator(".right-rail").boundingBox();
+ expect(box?.width ?? 0).toBeGreaterThan(500);
+
+ // The message it indexes was brought into view and briefly marked.
+ await expect(page.locator("#msg-u2")).toBeInViewport();
+ await expect(page.locator("#msg-u2")).toHaveClass(/msg-flash/);
+
+ // The index inside the panel moves the shown turn too.
+ await panel.getByTestId("trace-row-3").click();
+ await expect(panel.getByTestId("steps-turn")).toContainText("Turn 3 of 3");
+});
+
+test("the stretch icon left of ✕ takes the trace to full width and back, and is remembered", async ({ page }) => {
+ await seedTrace(page);
+ await page.goto("/");
+ await page.getByText("Draft the launch note").first().click();
+ await page.getByTestId("rail-toggle-trace").click();
+ await page.getByTestId("trace-row-1").click();
+ const panel = page.getByTestId("steps-panel");
+ await expect(panel).toBeVisible();
+ const main = await page.locator(".main").boundingBox();
+ const side = await page.locator(".right-rail").boundingBox();
+ expect(side!.width).toBeLessThan(main!.width - 100);
+
+ await panel.getByTestId("rail-stretch").click();
+ await expect.poll(async () => (await page.locator(".right-rail").boundingBox())!.width).toBeGreaterThan(main!.width - 4);
+ await expect(panel.getByTestId("rail-stretch")).toHaveAttribute("aria-pressed", "true");
+
+ // Reopening keeps the choice; the icon brings the rail back to the side.
+ await page.reload();
+ await page.getByText("Draft the launch note").first().click();
+ await page.getByTestId("rail-toggle-trace").click();
+ await page.getByTestId("trace-row-1").click();
+ await expect.poll(async () => (await page.locator(".right-rail").boundingBox())!.width).toBeGreaterThan(main!.width - 4);
+ await page.getByTestId("steps-panel").getByTestId("rail-stretch").click();
+ await expect.poll(async () => (await page.locator(".right-rail").boundingBox())!.width).toBeLessThan(main!.width - 100);
+});
+
+test("hovering a row lets the message run to three lines", async ({ page }) => {
+ await seedSessionMessages(page, SESSION, [
+ { role: "user", content: "A much longer question that certainly does not fit on one line of a narrow rail, because it keeps going on about the details of the thing being asked for.", ts: TS, mid: "u1" },
+ { role: "assistant", content: "ok", ts: TS + 1, mid: "a1" },
+ ]);
+ await page.goto("/");
+ await page.getByText("Draft the launch note").first().click();
+ await page.getByTestId("rail-toggle-trace").click();
+ const words = page.getByTestId("trace-row-1").locator(".trace-words");
+ const rest = (await words.boundingBox())!.height;
+ await page.getByTestId("trace-row-1").hover();
+ await expect.poll(async () => (await words.boundingBox())!.height).toBeGreaterThan(rest * 1.8);
+});
diff --git a/surfaces/gui/src/App.tsx b/surfaces/gui/src/App.tsx
index bd052d6c..148ba8ea 100644
--- a/surfaces/gui/src/App.tsx
+++ b/surfaces/gui/src/App.tsx
@@ -1,4 +1,5 @@
-import { useCallback, useEffect, useLayoutEffect, useRef, useState, type PointerEvent } from "react";
+import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type PointerEvent } from "react";
+import { traceRows, type TraceRow } from "./obs3";
import { useTranslation } from "react-i18next";
import {
announceInboxUnlock,
@@ -1714,6 +1715,29 @@ export function App() {
const openSessionFromInbox = (sid: string, ws: string, ag: string) => selectSession(sid, ws, ag);
// Phase 3: open one recorded turn's Steps, in its own session (Usage's heaviest turns,
// TeamView's events and evidence, an automation run's Steps).
+ // UX-060: the rail's trace index — one row per message of yours, joined to its recorded
+ // turn. Clicking a row goes to the message in the conversation and opens its trace.
+ const traceIndex = useMemo(
+ () => (agent === "chat" ? [] : traceRows(items as any, (footers?.turns || []).map((f) => ({
+ turn_id: f.turn_id, first_message_id: f.first_message_id, duration_ms: f.duration_ms,
+ status: f.status, issues: f.warn || 0,
+ })), running)),
+ [items, footers, running, agent],
+ );
+ const openTraceRow = (row: TraceRow) => {
+ {
+ const el = (row.mid && document.getElementById(`msg-${row.mid}`)) ||
+ document.querySelector<HTMLElement>(`[data-user-n="${row.n}"]`);
+ if (el) {
+ el.scrollIntoView({ block: "center", behavior: "smooth" });
+ el.classList.remove("msg-flash");
+ void el.offsetWidth; // restart the animation when the same row is clicked twice
+ el.classList.add("msg-flash");
+ window.setTimeout(() => el.classList.remove("msg-flash"), 1600);
+ }
+ }
+ if (row.turnId && sessionId) openTurnSteps(sessionId, row.turnId);
+ };
const openTurnSteps = (sid: string, turnId: string) => {
const w = sessions.find((x) => x.session_id === sid);
const open = () => {
@@ -2335,23 +2359,8 @@ export function App() {
{surface === "session" && (
<SandboxChip info={sandboxInfo} onOpenSettings={() => openSettings("sandbox")} />
)}
- {/* UX-059 OB-1: every step of each turn, and where the time and tokens went. */}
- {surface === "session" && agent !== "chat" && (
- <button
- className={"topbar-steps-btn" + (stepsOpen ? " active" : "")}
- onMouseDown={(e) => e.stopPropagation()}
- onClick={() => {
- setStepsOpen(!stepsOpen);
- setTeamViewOpen(false);
- setRailHidden(false);
- }}
- title={t("steps.open_title")}
- aria-pressed={stepsOpen}
- data-testid="steps-open"
- >
- <span>{t("steps.open_session")}</span>
- </button>
- )}
+ {/* The trace is reached from the rail's Trace index and each answer's footer
+ (UX-060) — no top-bar button. */}
{/* §32: the panel toggle is the ONE session-panel entry, for every non-chat persona
(the rail now carries Access, so code-family gets it too). */}
{agent !== "chat" && (
@@ -2755,6 +2764,8 @@ export function App() {
onOpenIntegrations={() => openSettings("connectors")}
context={contextInfo}
sessionUsage={usage}
+ traceRows={traceIndex}
+ onOpenTrace={openTraceRow}
agentTaskKey={agentTaskKey}
machineName={curSession?.machine_name}
machineOffline={!!curSession?.machine_offline}
diff --git a/surfaces/gui/src/components/Icon.tsx b/surfaces/gui/src/components/Icon.tsx
index ff476e03..5d8558ad 100644
--- a/surfaces/gui/src/components/Icon.tsx
+++ b/surfaces/gui/src/components/Icon.tsx
@@ -2,6 +2,8 @@
// currentColor, rounded caps/joins. Replaces emoji in the chrome for a crisp, consistent look.
export type IconName =
+ | "stretch"
+ | "unstretch"
| "sparkle"
| "logo"
| "sidebar"
@@ -216,6 +218,19 @@ export function Icon({
<path d="M6 6l12 12M18 6L6 18" />
</svg>
);
+ // Full width and back (UX-060): two arrows out of / into the corners.
+ case "stretch":
+ return (
+ <svg {...s}>
+ <path d="M14 4h6v6M20 4l-7 7M10 20H4v-6M4 20l7-7" />
+ </svg>
+ );
+ case "unstretch":
+ return (
+ <svg {...s}>
+ <path d="M20 10h-6V4M14 10l6-6M4 14h6v6M10 14l-6 6" />
+ </svg>
+ );
case "warning":
// Caution triangle (Lucide-style): rounded triangle + exclamation. Marks the
// bypass-approvals mode in the picker — the one option that switches approvals off.
diff --git a/surfaces/gui/src/components/RightRail.glance.test.tsx b/surfaces/gui/src/components/RightRail.glance.test.tsx
index cb4f7cb8..60e7da93 100644
--- a/surfaces/gui/src/components/RightRail.glance.test.tsx
+++ b/surfaces/gui/src/components/RightRail.glance.test.tsx
@@ -162,3 +162,30 @@ describe("header summaries", () => {
expect(head.querySelector(".rail-summary.attention")).not.toBeNull();
});
});
+
+describe("the Trace section (UX-060)", () => {
+ const rows = [
+ { n: 1, mid: "u1", words: "What does greet.py do?", turnId: "t1", durationMs: 2600, issues: 2, working: false },
+ { n: 2, mid: "u2", words: "List the files", turnId: "t2", durationMs: 1200, issues: 0, working: false },
+ { n: 3, mid: "u3", words: "Latest commit?", turnId: null, durationMs: null, issues: 0, working: true },
+ ];
+
+ it("is the one way into the trace: turns and issues on the header, a row per message", () => {
+ const onOpenTrace = vi.fn();
+ render(<RightRail {...baseProps} traceRows={rows} onOpenTrace={onOpenTrace} />);
+ const head = screen.getByTestId("rail-toggle-trace");
+ expect(head.textContent).toContain("3 turns");
+ expect(head.textContent).toContain("2 issues");
+ fireEvent.click(head);
+ expect(screen.getByTestId("trace-row-1").textContent).toContain("What does greet.py do?");
+ expect(screen.getByTestId("trace-row-1").textContent).toContain("2.6s");
+ expect(screen.getByTestId("trace-row-3").textContent).toContain("Working…");
+ fireEvent.click(screen.getByTestId("trace-row-2"));
+ expect(onOpenTrace).toHaveBeenCalledWith(expect.objectContaining({ turnId: "t2", mid: "u2" }));
+ });
+
+ it("renders nothing before the first message", () => {
+ render(<RightRail {...baseProps} traceRows={[]} onOpenTrace={() => {}} />);
+ expect(screen.queryByTestId("rail-toggle-trace")).toBeNull();
+ });
+});
diff --git a/surfaces/gui/src/components/RightRail.tsx b/surfaces/gui/src/components/RightRail.tsx
index 0102cc2d..5ddd1cc7 100644
--- a/surfaces/gui/src/components/RightRail.tsx
+++ b/surfaces/gui/src/components/RightRail.tsx
@@ -25,6 +25,9 @@ import { ContextPanel, ContextSummary } from "./RailContext";
import { BoardSection } from "./BoardPanel";
import { TeamRail } from "./TeamRail";
import type { TeamSummary } from "../teamView";
+import type { TraceRow } from "../obs3";
+import { TraceIndex } from "./TraceIndex";
+import { RailStretchContext, StretchButton, useRailStretchState } from "../railStretch";
import type { WorkerFilter } from "../teamRoster";
import { Icon } from "./Icon";
@@ -32,7 +35,7 @@ import type { SessionUsage } from "../types";
import { Markdown, OPEN_ARTIFACT_EVENT } from "./Markdown";
// (ContextInfo/SessionUsage power the Context section; see RailContext.tsx.)
-type Panel = "context" | "progress" | "agents" | "artifacts" | "board" | "journal" | "team" | "files";
+type Panel = "context" | "progress" | "trace" | "agents" | "artifacts" | "board" | "journal" | "team" | "files";
// Quiet file-type icons for the artifact list (the colored kind pills read as noisy).
function kindIcon(kind: string): "file" | "fileCode" | "image" | "table" {
@@ -111,6 +114,10 @@ interface Props {
teamMachine?: string;
// Bumped when a [.](board:) chip in the transcript is clicked — expands the Board section.
openBoardKey?: number;
+ // UX-060: the trace index — one row per message of yours; a row goes to the message and
+ // opens its turn's trace. The section is the one way into the trace from the rail.
+ traceRows?: TraceRow[];
+ onOpenTrace?: (row: TraceRow) => void;
}
export function RightRail({
@@ -153,14 +160,19 @@ export function RightRail({
teamSummary,
teamMachine,
openBoardKey = 0,
+ traceRows = [],
+ onOpenTrace,
}: Props) {
const { t } = useTranslation();
+ // UX-060: full width for the rail's wide form (trace, artifact), remembered per device.
+ const stretch = useRailStretchState();
// Seventeenth pass: every panel starts collapsed and nothing auto-expands — a count
// chip is the maximum signal. One exception survives (solo sessions only): Progress
// still auto-opens the first time a live turn has todos.
const [open, setOpen] = useState<Record<Panel, boolean>>({
context: false,
progress: false,
+ trace: false,
agents: false,
artifacts: false,
board: false,
@@ -346,8 +358,9 @@ export function RightRail({
if (!active) return null;
return (
- <aside className={"right-rail" + (selected || teamView ? " artifact-mode" : "")}>
- {teamView && <div className="team-resize-handle" role="separator" aria-label={t("teamview.resize")} aria-orientation="vertical" tabIndex={0}
+ <RailStretchContext.Provider value={stretch}>
+ <aside className={"right-rail" + (selected || teamView ? " artifact-mode" : "") + ((selected || teamView) && stretch.stretched ? " stretched" : "")}>
+ {teamView && !stretch.stretched && <div className="team-resize-handle" role="separator" aria-label={t("teamview.resize")} aria-orientation="vertical" tabIndex={0}
onKeyDown={e => { if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return; e.preventDefault(); const width = e.currentTarget.parentElement!.getBoundingClientRect().width + (e.key === "ArrowLeft" ? 32 : -32); document.documentElement.style.setProperty("--team-rail-w", Math.min(window.innerWidth * .75, Math.max(320, width)) + "px"); }}
onPointerDown={e => { e.preventDefault(); e.currentTarget.setPointerCapture(e.pointerId); }}
onPointerMove={e => { if (e.currentTarget.hasPointerCapture(e.pointerId)) document.documentElement.style.setProperty("--team-rail-w", Math.min(window.innerWidth * .75, Math.max(320, window.innerWidth - e.clientX)) + "px"); }}
@@ -445,6 +458,27 @@ export function RightRail({
</RailSection>
)}
+ {/* UX-060: the trace index — the one way into the trace from the rail. A row per
+ message of yours; the header counts turns and issues. Nothing before the
+ first message. */}
+ {traceRows.length > 0 && onOpenTrace && (() => {
+ const issues = traceRows.reduce((n, r) => n + r.issues, 0);
+ return (
+ <RailSection
+ title={t("rail.trace_title")}
+ summary={
+ t("rail.trace_turns", { count: traceRows.length }) +
+ (issues ? " · " + t("rail.trace_issues", { count: issues }) : "")
+ }
+ summaryAttention={issues > 0}
+ open={open.trace}
+ onToggle={() => setOpen({ ...open, trace: !open.trace })}
+ >
+ <TraceIndex rows={traceRows} onPick={onOpenTrace} testId="rail-trace" />
+ </RailSection>
+ );
+ })()}
+
{/* Async subagents (OPE-257): active runs + done history, zero chrome when
none ever ran. Amber only while one waits on an approval. */}
{agentTasks.length > 0 && (() => {
@@ -669,6 +703,7 @@ export function RightRail({
</>
)}
</aside>
+ </RailStretchContext.Provider>
);
}
@@ -839,6 +874,7 @@ function ArtifactViewer({
<div className="artifact-path">{artifact.path}</div>
</div>
<div className="rail-actions">
+ <StretchButton className="artifact-icon-btn" labels={{ stretch: t("rail.stretch"), unstretch: t("rail.unstretch") }} />
{isHtml && (
<button
className="artifact-icon-btn"
diff --git a/surfaces/gui/src/components/StepsPanel.tsx b/surfaces/gui/src/components/StepsPanel.tsx
index abf6b11f..c9bb3add 100644
--- a/surfaces/gui/src/components/StepsPanel.tsx
+++ b/surfaces/gui/src/components/StepsPanel.tsx
@@ -23,8 +23,10 @@ import {
} from "../api";
import { formatTokens } from "../usage";
import { canonicalModel } from "../modelNames";
-import { turnTexts, wakeKey } from "../obs3";
+import { formatDuration, traceRows, turnTexts, wakeKey } from "../obs3";
import { TurnList, TurnStrip } from "./TurnPicker";
+import { TraceIndex } from "./TraceIndex";
+import { StretchButton } from "../railStretch";
type T = (k: string, o?: any) => string;
@@ -40,15 +42,7 @@ export function wakeLine(turn: RecordedTurn, t: T): string | null {
}
/** 0.1s, 3.4s, 41s, 2m 14s: the panel's one duration format. */
-export function formatDuration(ms: number | null | undefined): string {
- if (ms == null || !Number.isFinite(ms)) return "—";
- if (ms > 0 && ms < 100) return "<0.1s";
- if (ms < 10_000) return `${(ms / 1000).toFixed(1)}s`;
- if (ms < 60_000) return `${Math.round(ms / 1000)}s`;
- const m = Math.floor(ms / 60_000);
- const s = Math.round((ms % 60_000) / 1000);
- return s ? `${m}m ${s}s` : `${m}m`;
-}
+export { formatDuration };
/** A moment in the turn as the mock writes it: 00:52.1 */
function clock(ms: number): string {
@@ -533,14 +527,33 @@ export function StepsPanel({
</div>
);
+ // UX-060: the trace index as the panel's left column — the same rows as the rail's
+ // Trace section, the shown turn marked. Rows are messages of yours, so a session with
+ // none (an automation's turns) keeps the single-column panel.
+ const index = useMemo(() => traceRows(conversation, (turns || []).map((tn) => ({
+ turn_id: tn.turn_id, first_message_id: tn.first_message_id, duration_ms: tn.duration_ms,
+ status: tn.status, issues: tn.issues?.warn || 0,
+ }))), [conversation, turns]);
+ const indexed = index.length > 0 && !!turns && turns.length > 0;
return (
- <div className={"team-view steps-panel" + (inspecting ? " inspecting" : "")} data-testid="steps-panel"
+ <div className={"team-view steps-panel" + (inspecting ? " inspecting" : "") + (indexed ? " indexed" : "")} data-testid="steps-panel"
tabIndex={-1} onKeyDown={onKeyDown}>
+ {indexed && (
+ <aside className="steps-index-col" data-testid="steps-index">
+ <TraceIndex rows={index} current={turn?.turn_id} testId="steps-index-rows"
+ onPick={(row) => {
+ const i = turns!.findIndex((tn) => tn.turn_id === row.turnId);
+ if (i >= 0) { setTurnIdx(i); setTab("timeline"); setSelected(null); }
+ }} />
+ </aside>
+ )}
+ <div className="steps-main">
<div className="steps-railhead">
<div className="steps-railhead-title">
<strong>{t("steps.title")}</strong>
{picker}
<span className="steps-sp" />
+ <StretchButton className="steps-close" labels={{ stretch: t("rail.stretch"), unstretch: t("rail.unstretch") }} />
<button className="steps-close" aria-label={t("steps.close")} onClick={onClose}>✕</button>
</div>
{turns && turns.length > 0 && turnIdx != null && (
@@ -636,6 +649,7 @@ export function StepsPanel({
/>
</div>
)}
+ </div>
</div>
);
}
diff --git a/surfaces/gui/src/components/TraceIndex.tsx b/surfaces/gui/src/components/TraceIndex.tsx
new file mode 100644
index 00000000..7120c034
--- /dev/null
+++ b/surfaces/gui/src/components/TraceIndex.tsx
@@ -0,0 +1,49 @@
+// UX-060: the trace index — one row per message of yours, the way into the trace. The same
+// list sits in the rail's Trace section (collapsed rail) and as the open panel's left column,
+// so the index never moves or disappears; the panel only adds a detail pane beside it.
+import { useTranslation } from "react-i18next";
+import { formatDuration, type TraceRow } from "../obs3";
+
+export function TraceIndex({
+ rows,
+ current,
+ onPick,
+ testId = "trace-index",
+}: {
+ rows: TraceRow[];
+ // The turn the panel shows, when it is open.
+ current?: string | null;
+ onPick: (row: TraceRow) => void;
+ testId?: string;
+}) {
+ const { t } = useTranslation();
+ return (
+ <div className="trace-index" data-testid={testId}>
+ {rows.map((r) => {
+ const isCurrent = !!current && r.turnId === current;
+ const glance = r.working
+ ? t("rail.sum_working")
+ : r.durationMs != null
+ ? formatDuration(r.durationMs)
+ : r.turnId
+ ? ""
+ : t("rail.trace_no_trace");
+ return (
+ <button
+ key={r.mid || r.n}
+ className={"trace-row" + (isCurrent ? " current" : "") + (!r.turnId && !r.working ? " none" : "")}
+ data-testid={`trace-row-${r.n}`}
+ aria-current={isCurrent || undefined}
+ title={t("rail.trace_row_title")}
+ onClick={() => onPick(r)}
+ >
+ <span className="trace-n">{r.n}</span>
+ <span className="trace-words">{r.words}</span>
+ {r.issues > 0 && <span className="trace-dot" aria-label={t("rail.trace_issues", { count: r.issues })} />}
+ <span className={"trace-glance" + (r.working ? " live" : "")}>{glance}</span>
+ </button>
+ );
+ })}
+ </div>
+ );
+}
diff --git a/surfaces/gui/src/components/Transcript.test.tsx b/surfaces/gui/src/components/Transcript.test.tsx
index 3da89130..b1490731 100644
--- a/surfaces/gui/src/components/Transcript.test.tsx
+++ b/surfaces/gui/src/components/Transcript.test.tsx
@@ -411,12 +411,12 @@ describe("mode notice", () => {
expect(screen.getByText("Context compacted").className).not.toContain("notice-block");
});
- it("offers the turn's steps from its answer", () => {
- // UX-059 OB-1: a "Steps" link in each answer's footer, with the answer's time.
- const onOpenSteps = vi.fn();
- render(<Transcript items={[{ kind: "user", text: "hi", ts: 100 }, { kind: "assistant", text: "hello", ts: 105 }] as any}
- onApprove={() => {}} onOpenSteps={onOpenSteps} />);
- fireEvent.click(screen.getByTestId("bubble-steps"));
- expect(onOpenSteps).toHaveBeenCalledWith(105);
+ it("carries no trace link in the hover strip, and a user message is addressable by its id", () => {
+ // UX-060: the trace is reached from the turn footer and the rail's index; the hover
+ // strip keeps copy + time only. The rail's index scrolls to `#msg-<mid>`.
+ render(<Transcript items={[{ kind: "user", text: "hi", ts: 100, mid: "m1" }, { kind: "assistant", text: "hello", ts: 105 }] as any}
+ onApprove={() => {}} onOpenSteps={vi.fn()} />);
+ expect(screen.queryByTestId("bubble-steps")).toBeNull();
+ expect(document.getElementById("msg-m1")?.textContent).toContain("hi");
});
});
diff --git a/surfaces/gui/src/components/Transcript.tsx b/surfaces/gui/src/components/Transcript.tsx
index 835d5668..5384603d 100644
--- a/surfaces/gui/src/components/Transcript.tsx
+++ b/surfaces/gui/src/components/Transcript.tsx
@@ -39,7 +39,9 @@ function ClampedUserText({ text }: { text: string }) {
// Lives in a ZERO-HEIGHT strip under the bubble (absolute, inside the transcript's 20px gap)
// so revealing it on group-hover never shifts the layout. `ts` is unix seconds — canonical
// messages carry it, pre-stamp history doesn't, so the time simply omits itself when absent.
-function BubbleMeta({ text, ts, align, onOpenSteps }: { text: string; ts?: number; align: "left" | "right"; onOpenSteps?: (ts?: number) => void }) {
+// The trace itself is reached from the turn footer and the rail's Trace index (UX-060), so
+// this strip carries no third link to it.
+function BubbleMeta({ text, ts, align }: { text: string; ts?: number; align: "left" | "right" }) {
const { t } = useTranslation();
const [copied, setCopied] = useState(false);
const when = typeof ts === "number" ? new Date(ts * 1000) : null;
@@ -75,17 +77,6 @@ function BubbleMeta({ text, ts, align, onOpenSteps }: { text: string; ts?: numbe
{when.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" })}
</span>
)}
- {onOpenSteps && (
- // UX-059 OB-1: the turn's steps, from its answer.
- <button
- className="cursor-pointer hover:text-muted"
- data-testid="bubble-steps"
- title={t("steps.open_title")}
- onClick={() => onOpenSteps(ts)}
- >
- {t("steps.open")}
- </button>
- )}
</div>
</div>
);
@@ -649,6 +640,9 @@ export function Transcript({ items, running, streamingText, onRetry, onOpenConne
/>
);
};
+ // UX-060: the n-th message of yours, so the trace index can land on it before the
+ // message has a server id (a live send). `data-user-n` on each user bubble.
+ let userN = 0;
return (
<div className="transcript">
{blocks.map((block, bi) => {
@@ -680,7 +674,8 @@ export function Transcript({ items, running, streamingText, onRetry, onOpenConne
return <TeamCreatedLine key={bi} workers={item.workers} />;
case "user":
return (
- <div className="group self-end max-w-[78%] flex flex-col items-end" key={bi}>
+ <div className="group self-end max-w-[78%] flex flex-col items-end" key={bi}
+ id={item.mid ? `msg-${item.mid}` : undefined} data-mid={item.mid} data-user-n={++userN}>
<div className="bubble-user px-3.5 py-2.5 rounded-[14px_14px_4px_14px] bg-solid text-onSolid text-body leading-relaxed whitespace-pre-wrap">
{item.attachments && item.attachments.length > 0 && (
<div className="bubble-attachments">
@@ -711,7 +706,7 @@ export function Transcript({ items, running, streamingText, onRetry, onOpenConne
<div className="who">{t("transcript.who_assistant")}</div>
{item.reasoning && <ThinkingBlock text={item.reasoning} />}
<Markdown text={item.text} />
- <BubbleMeta text={item.text} ts={item.ts} align="left" onOpenSteps={onOpenSteps} />
+ <BubbleMeta text={item.text} ts={item.ts} align="left" />
{footerFor(bi, item)}
</div>
);
diff --git a/surfaces/gui/src/itemsFromMessages.ts b/surfaces/gui/src/itemsFromMessages.ts
index 4ad3b8c2..99a3be0b 100644
--- a/surfaces/gui/src/itemsFromMessages.ts
+++ b/surfaces/gui/src/itemsFromMessages.ts
@@ -61,6 +61,8 @@ export function itemsFromMessages(messages: ConversationMessage[]): Item[] {
if (typeof m._display === "string" && m._display) user.text = m._display;
// `ts` (unix seconds) is the server's canonical-message stamp; older sessions have none.
if (typeof m.ts === "number") user.ts = m.ts;
+ // The server's message id: the trace index joins the message to its turn by it (UX-060).
+ if (typeof (m as any).mid === "string") user.mid = (m as any).mid;
if (user.text || user.attachments?.length) items.push(user);
} else if (m.role === "assistant") {
if (m.content || m.reasoning)
diff --git a/surfaces/gui/src/locales/en.json b/surfaces/gui/src/locales/en.json
index c5239d90..e75fbb8b 100644
--- a/surfaces/gui/src/locales/en.json
+++ b/surfaces/gui/src/locales/en.json
@@ -362,6 +362,15 @@
"ctx_model_io": "{{in}} in · {{out}} out",
"ctx_compacted_one": "Compacted — {{count}} earlier message summarized",
"ctx_compacted_other": "Compacted — {{count}} earlier messages summarized",
+ "trace_title": "Trace",
+ "trace_turns_one": "{{count}} turn",
+ "trace_turns_other": "{{count}} turns",
+ "trace_issues_one": "{{count}} issue",
+ "trace_issues_other": "{{count}} issues",
+ "trace_no_trace": "no trace",
+ "trace_row_title": "Go to this message and open its trace",
+ "stretch": "Full width",
+ "unstretch": "Back to the side",
"agents_title": "Subagents",
"agents_running_one": "{{count}} running",
"agents_running_other": "{{count}} running",
@@ -3436,7 +3445,6 @@
},
"title": "Trace",
"open": "Trace",
- "open_session": "Session trace",
"open_title": "Every step of each turn, and where the time and tokens went",
"close": "Close the trace",
"prev_turn": "Previous turn",
diff --git a/surfaces/gui/src/locales/zh.json b/surfaces/gui/src/locales/zh.json
index 5473d223..3ef9d059 100644
--- a/surfaces/gui/src/locales/zh.json
+++ b/surfaces/gui/src/locales/zh.json
@@ -350,6 +350,15 @@
"ctx_approx": "约 {{tokens}}",
"ctx_model_io": "输入 {{in}} · 输出 {{out}}",
"ctx_compacted_other": "已压缩 — {{count}} 条较早消息已被摘要",
+ "trace_title": "追踪",
+ "trace_turns_one": "{{count}} 轮",
+ "trace_turns_other": "{{count}} 轮",
+ "trace_issues_one": "{{count}} 个问题",
+ "trace_issues_other": "{{count}} 个问题",
+ "trace_no_trace": "无追踪",
+ "trace_row_title": "跳到这条消息并打开它的追踪",
+ "stretch": "全宽显示",
+ "unstretch": "收回侧边",
"agents_title": "子智能体",
"agents_running_other": "{{count}} 个运行中",
"agents_waiting_other": "{{count}} 个等待中",
@@ -3380,7 +3389,6 @@
},
"title": "追踪",
"open": "追踪",
- "open_session": "会话追踪",
"open_title": "每一轮的每个步骤,以及时间和令牌用在了哪里",
"close": "关闭追踪",
"prev_turn": "上一轮",
diff --git a/surfaces/gui/src/obs3.test.ts b/surfaces/gui/src/obs3.test.ts
index 72cf372f..2e0a8bcd 100644
--- a/surfaces/gui/src/obs3.test.ts
+++ b/surfaces/gui/src/obs3.test.ts
@@ -3,6 +3,8 @@
import { afterEach, describe, expect, it } from "vitest";
import {
approverPart,
+ traceRows,
+ turnTexts,
comparable,
footerParts,
healthTone,
@@ -115,6 +117,52 @@ describe("the turn footer", () => {
expect(turnForAnswer([], 1, 0)).toBeNull();
});
+ it("labels turns by the message that started them, not by splitting at answers (UX-060)", () => {
+ // Three quick turns a minute apart once read "(no message of yours)" twice: the split
+ // at `last_message_id` lost them. With `first_message_id` each turn names its message.
+ const items = [
+ { kind: "user", text: "What does greet.py do?", mid: "u1" }, { kind: "assistant", text: "It greets.", mid: "a1" },
+ { kind: "user", text: "List the files", mid: "u2" }, { kind: "assistant", text: "README, greet.py", mid: "a2" },
+ { kind: "user", text: "Latest commit?", mid: "u3" }, { kind: "assistant", text: "abc", mid: "a3" },
+ ] as any;
+ const texts = turnTexts([
+ { turn_id: "t1", first_message_id: "u1" }, { turn_id: "t2", first_message_id: "u2" }, { turn_id: "t3", first_message_id: "u3" },
+ ], items);
+ expect(texts.get("t1")?.user).toBe("What does greet.py do?");
+ expect(texts.get("t2")?.user).toBe("List the files");
+ expect(texts.get("t3")?.user).toBe("Latest commit?");
+ expect(texts.get("t3")?.answer).toBe("abc");
+ // Older recordings without first ids keep the answer split.
+ const old = turnTexts([{ turn_id: "t1", last_message_id: "a1" }, { turn_id: "t2", last_message_id: "a3" }], items);
+ expect(old.get("t1")?.user).toBe("What does greet.py do?");
+ expect(old.get("t2")?.user).toBe("List the files\nLatest commit?");
+ });
+
+ it("builds the trace index from your messages, joined to their turns (UX-060)", () => {
+ const items = [
+ { kind: "user", text: "First question here", mid: "u1" }, { kind: "assistant", text: "a", mid: "a1" },
+ { kind: "user", text: "Second one", mid: "u2" }, { kind: "assistant", text: "b", mid: "a2" },
+ { kind: "user", text: "Third, still running", mid: "u3" },
+ ] as any;
+ const rows = traceRows(items, [
+ { turn_id: "t1", first_message_id: "u1", duration_ms: 2600, issues: 2 },
+ { turn_id: "t2", first_message_id: "u2", duration_ms: 1200 },
+ ], true);
+ expect(rows.map((r) => [r.n, r.turnId, r.durationMs, r.issues, r.working])).toEqual([
+ [1, "t1", 2600, 2, false], [2, "t2", 1200, 0, false], [3, null, null, 0, true],
+ ]);
+ expect(rows[0].words).toBe("First question here");
+ // Not running: a message without a turn is a greyed row, not a live one.
+ expect(traceRows(items, [], false).map((r) => r.working)).toEqual([false, false, false]);
+ // Messages only: a turn the transcript cannot show (a wake) adds no row.
+ expect(traceRows(items, [{ turn_id: "w", first_message_id: null, duration_ms: 10 }]).length).toBe(3);
+ // Live messages (no id yet) pair with the unclaimed turns in order.
+ const live = items.map(({ mid, ...rest }: any) => rest);
+ expect(traceRows(live, [
+ { turn_id: "t1", first_message_id: "u1", duration_ms: 2600 }, { turn_id: "t2", first_message_id: "u2", duration_ms: 1200 },
+ ], true).map((r) => [r.turnId, r.working])).toEqual([["t1", false], ["t2", false], [null, true]]);
+ });
+
it("says where a rating went (§8.3)", () => {
expect(whereKey(null).key).toBe("p3.fb.where_local");
expect(whereKey({ local: true, export: null, managed: false, with_note: false }).key).toBe("p3.fb.where_local");
diff --git a/surfaces/gui/src/obs3.ts b/surfaces/gui/src/obs3.ts
index 2fd763c6..30055c0a 100644
--- a/surfaces/gui/src/obs3.ts
+++ b/surfaces/gui/src/obs3.ts
@@ -289,7 +289,7 @@ function filesOf(args: any): string[] {
* previous turn's last message to its own (`last_message_id`, the answer's `mid`). A turn with
* no answer yet (running, or cut off) gets what is left at the end when it is the last one. */
export function turnTexts(
- turns: { turn_id: string; last_message_id?: string | null }[],
+ turns: { turn_id: string; first_message_id?: string | null; last_message_id?: string | null }[],
items: ConvItem[],
): Map<string, TurnText> {
const at = new Map<string, number>();
@@ -309,6 +309,18 @@ export function turnTexts(
}
out.set(tid, part);
};
+ // UX-060: a turn knows the message that started it (`first_message_id`); when every turn
+ // does, its part runs from there to the next turn's start. Splitting at answers (below)
+ // mislabelled turns a minute apart, so it is only the fallback for older recordings.
+ const starts = turns.map((tn) => (tn.first_message_id != null ? at.get(tn.first_message_id) : undefined));
+ if (turns.length > 0 && starts.every((s) => s != null)) {
+ turns.forEach((tn, k) => {
+ const from = starts[k] as number;
+ const to = k + 1 < turns.length ? (starts[k + 1] as number) : items.length;
+ fill(tn.turn_id, from, Math.max(from, to));
+ });
+ return out;
+ }
let start = 0;
turns.forEach((tn, k) => {
const end = tn.last_message_id != null ? at.get(tn.last_message_id) : undefined;
@@ -322,6 +334,58 @@ export function turnTexts(
return out;
}
+export function formatDuration(ms: number | null | undefined): string {
+ if (ms == null || !Number.isFinite(ms)) return "—";
+ if (ms > 0 && ms < 100) return "<0.1s";
+ if (ms < 10_000) return `${(ms / 1000).toFixed(1)}s`;
+ if (ms < 60_000) return `${Math.round(ms / 1000)}s`;
+ const m = Math.floor(ms / 60_000);
+ const s = Math.round((ms % 60_000) / 1000);
+ return s ? `${m}m ${s}s` : `${m}m`;
+}
+
+// -- the trace index (UX-060) -------------------------------------------------------------------
+/** One row per message of yours, joined to the turn it started by the turn's
+ * `first_message_id`. Rows come from the transcript alone, so a message whose turn was never
+ * recorded still has one (greyed, no trace); the last one shows "Working…" while a turn runs. */
+export interface TraceRow {
+ n: number;
+ mid?: string;
+ words: string;
+ turnId: string | null;
+ durationMs: number | null;
+ issues: number;
+ working: boolean;
+}
+
+export function traceRows(
+ items: { kind: string; text?: string; mid?: string }[],
+ turns: { turn_id: string; first_message_id?: string | null; duration_ms: number | null; status?: string; issues?: number }[],
+ running = false,
+): TraceRow[] {
+ const byFirst = new Map<string, (typeof turns)[number]>();
+ for (const tn of turns) if (tn.first_message_id) byFirst.set(tn.first_message_id, tn);
+ const users = items.filter((it) => it.kind === "user");
+ // A message sent in this window has no id until the session is reopened; those pair
+ // with the turns no id claimed, in order — one message, one turn.
+ const claimed = new Set(users.map((it) => it.mid).filter((m): m is string => !!m && byFirst.has(m)));
+ const spare = turns.filter((tn) => tn.first_message_id && !claimed.has(tn.first_message_id));
+ return users.map((it, i) => {
+ const tn = it.mid && byFirst.has(it.mid) ? byFirst.get(it.mid) : it.mid ? undefined : spare.shift();
+ const last = i === users.length - 1;
+ const working = tn ? tn.duration_ms == null && (tn.status === "running" || (last && running)) : last && running;
+ return {
+ n: i + 1,
+ mid: it.mid,
+ words: firstWords(it.text || "", 60),
+ turnId: tn?.turn_id ?? null,
+ durationMs: tn?.duration_ms ?? null,
+ issues: tn?.issues ?? 0,
+ working,
+ };
+ });
+}
+
/** Whether a turn matches the list's search: its number, what you asked, the answer, tool
* names, file names and its issues' titles, ignoring case. */
export function turnMatches(n: number, text: TurnText | undefined, issueTitles: string[], query: string): boolean {
diff --git a/surfaces/gui/src/railStretch.tsx b/surfaces/gui/src/railStretch.tsx
new file mode 100644
index 00000000..0419bf35
--- /dev/null
+++ b/surfaces/gui/src/railStretch.tsx
@@ -0,0 +1,56 @@
+// UX-060: the right rail's full-width mode, for what it shows in its wide form (the trace,
+// an artifact). The rail owns the state and remembers it per device; the panel inside
+// renders the toggle — a stretch icon left of its ✕ (owner placement 2026-11-08).
+import { createContext, useContext, useState } from "react";
+import { Icon } from "./components/Icon";
+
+export interface RailStretch {
+ stretched: boolean;
+ toggle: () => void;
+}
+
+export const RailStretchContext = createContext<RailStretch | null>(null);
+
+/** The toggle, or null outside a rail (tests, a panel rendered on its own). */
+export function useRailStretch(): RailStretch | null {
+ return useContext(RailStretchContext);
+}
+
+const KEY = "ocw:rail-stretched";
+
+export function useRailStretchState(): RailStretch {
+ const [stretched, setStretched] = useState<boolean>(() => {
+ try {
+ return localStorage.getItem(KEY) === "1";
+ } catch {
+ return false;
+ }
+ });
+ const toggle = () =>
+ setStretched((s) => {
+ try {
+ localStorage.setItem(KEY, s ? "0" : "1");
+ } catch {
+ /* no storage: the choice lasts the window */
+ }
+ return !s;
+ });
+ return { stretched, toggle };
+}
+
+export function StretchButton({ className, labels }: { className: string; labels: { stretch: string; unstretch: string } }) {
+ const ctx = useRailStretch();
+ if (!ctx) return null;
+ return (
+ <button
+ className={className}
+ data-testid="rail-stretch"
+ aria-pressed={ctx.stretched}
+ aria-label={ctx.stretched ? labels.unstretch : labels.stretch}
+ title={ctx.stretched ? labels.unstretch : labels.stretch}
+ onClick={ctx.toggle}
+ >
+ <Icon name={ctx.stretched ? "unstretch" : "stretch"} size={14} />
+ </button>
+ );
+}
diff --git a/surfaces/gui/src/styles.css b/surfaces/gui/src/styles.css
index 5856114c..196b4980 100644
--- a/surfaces/gui/src/styles.css
+++ b/surfaces/gui/src/styles.css
@@ -1066,16 +1066,15 @@ html[data-theme="dark"] .aglyph-f7 { color: #9aa5b3; }
.task-card:hover .task-card-act { opacity: 1; color: var(--accent); }
.task-card.gated .task-card-act { opacity: 1; color: var(--accent); }
-/* Topbar "Artifacts (N)" affordance, shown when the side panel is hidden; the Steps
- button (UX-059 OB-1) looks the same */
-.topbar-artifacts-btn, .topbar-steps-btn {
+/* Topbar "Artifacts (N)" affordance, shown when the side panel is hidden. */
+.topbar-artifacts-btn {
display: inline-flex; align-items: center; gap: 6px;
padding: 5px 10px; margin-right: 6px;
border: 1px solid var(--line-strong); border-radius: 8px;
background: var(--panel); color: var(--muted); cursor: pointer;
font: inherit; font-size: var(--fs-ui);
}
-.topbar-artifacts-btn:hover, .topbar-steps-btn:hover { color: var(--ink); border-color: var(--accent); }
+.topbar-artifacts-btn:hover { color: var(--ink); border-color: var(--accent); }
.topbar-artifacts-count {
/* Neutral count (owner call 2026-08-21): a passive tally is not a primary action,
an active state, or a live signal — the accent budget says no cobalt here. */
@@ -2589,6 +2588,40 @@ html[data-theme="dark"] { --bar-model:#4c8dff; --bar-tool:#3fb8ad; --bar-wait:#3
.steps-railbody { flex:1; min-height:0; overflow:auto; padding:6px 0; }
.steps-split { flex:1; min-height:0; display:grid; grid-template-columns:minmax(0,1fr) min(520px, 62%); }
.steps-split .steps-list { border-right:1px solid var(--line); }
+/* UX-060: the open trace takes the artifact-reading width and keeps the trace index as its
+ left column, so the index in the rail never disappears — it gains a detail pane. The
+ team-view rule above sets a narrower width; this one, later, wins for the trace. */
+.main:has(.steps-panel) { --artifact-rail-w: var(--team-rail-w, min(62vw, 960px)); }
+.main:has(.steps-panel.inspecting) { --artifact-rail-w: min(78vw, 1180px); }
+/* Full width (the stretch icon left of ✕): the rail takes the whole content area; the
+ conversation is hidden, the left nav untouched. Last, so it wins over every width above. */
+.main.rail-open:has(.right-rail.artifact-mode.stretched) { --artifact-rail-w: 100%; }
+.steps-panel.indexed { flex-direction: row; }
+.steps-index-col { flex: 0 0 236px; min-width: 0; border-right: 1px solid var(--line); overflow-y: auto; padding: 10px 6px; }
+.steps-index-col .trace-index { padding: 0; }
+.steps-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
+/* The trace index rows (rail section and the panel's column share them). */
+.trace-index { display: flex; flex-direction: column; gap: 1px; }
+.trace-row { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: var(--fs-ui); text-align: left; padding: 5px 6px; border-radius: 7px; cursor: pointer; }
+.trace-row:hover { background: var(--paper); }
+.trace-row.current { background: var(--paper); }
+.trace-row.current .trace-n { color: var(--ink); font-weight: 600; }
+.trace-row.none .trace-words { color: var(--muted); }
+.trace-n { flex: none; min-width: 16px; font-size: var(--fs-label); color: var(--faint); font-variant-numeric: tabular-nums; text-align: right; }
+.trace-row { align-items: flex-start; }
+.trace-row .trace-n, .trace-row .trace-glance, .trace-row .trace-dot { margin-top: 2px; }
+/* One line at rest; hovering lets the message run to three lines (the rows below slide,
+ they do not jump); the panel's column has room for two at rest. */
+.trace-words { flex: 1; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; line-height: 1.4; max-height: 1.4em; transition: max-height .18s ease; overflow-wrap: anywhere; }
+.trace-row:hover .trace-words, .trace-row:focus-visible .trace-words { -webkit-line-clamp: 3; max-height: 4.2em; }
+.steps-index-col .trace-words { -webkit-line-clamp: 2; max-height: 2.8em; }
+.steps-index-col .trace-row:hover .trace-words, .steps-index-col .trace-row:focus-visible .trace-words { -webkit-line-clamp: 3; max-height: 4.2em; }
+.trace-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: #f59e0b; }
+.trace-glance { flex: none; font-size: var(--fs-label); color: var(--faint); font-variant-numeric: tabular-nums; }
+.trace-glance.live { color: var(--muted); }
+/* A row's click lands on its message: a short highlight, then nothing. */
+@keyframes msg-flash { 0% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); } 100% { box-shadow: 0 0 0 3px transparent; } }
+.msg-flash > .bubble-user { animation: msg-flash 1.5s ease-out; }
/* The timeline (OB-1): one row per step on the turn's time axis. */
.steps-timeline { display:flex; flex-direction:column; }
diff --git a/surfaces/gui/src/types.ts b/surfaces/gui/src/types.ts
index 372b9250..bfdda5ed 100644
--- a/surfaces/gui/src/types.ts
+++ b/surfaces/gui/src/types.ts
@@ -176,7 +176,9 @@ export interface Attachment {
// `ts` = unix seconds (the server's canonical-message stamp; live items stamp locally).
// Optional: sessions saved before the server stamped timestamps have none.
export type Item =
- | { kind: "user"; text: string; attachments?: Attachment[]; ts?: number }
+ // `mid` is the server's message id (a replayed session has it; a live send gets it from
+ // turn_start) — the trace index joins a message to its turn by it (UX-060).
+ | { kind: "user"; text: string; attachments?: Attachment[]; ts?: number; mid?: string }
// A connector-delivered inbound message (Slack/Salesforce/…), rendered as a structured card
// (ConnectorMessageCard) instead of a plain user bubble. Generalizes to any connector via the
// registry — no per-connector special-casing.