web: put the work first and the audit evidence behind a door

- Turn files (input/memory/output/session) are system artifacts now: they are
  never tiles in the run or stage galleries. Shared public files are attributed
  to the visit that first recorded them, so a run counts 3 stage artifacts, not
  one copy of each per later stage.
- Audit & debug opens a dialog with vertical Input / Output / Memory / Session /
  Definition tabs, for a visit from the stage pane or the run Summary.
- Run tabs are Summary / Graph / Timeline; Input and Output are Summary sections
  with Artifacts, Files changed and Audit. Each stage pane gains Files changed.
- Artifacts gain a gallery/list switch (remembered) and full-name wrapping; the
  copy/share actions are hover-or-focus icon buttons.
- Status badge above the run title; no live badges on the run surfaces. The runs
  list leads with the pipeline name and the stored task title beneath it.
- Chat rows: title + coloured status word only, then directory, then model; no
  operator or closed chips, no dot. The more/star cluster is a hover/focus
  overlay so the title uses the row's width, and an open menu stacks above rows.
  Closed chats collapse behind a chevron. Sessions can be starred locally and
  sort in a Starred group. The chat header no longer repeats status/dir/model.
- A visible rail divider separates Search from the destinations; the page has a
  real favicon/apple-touch icon and the rail brand wears it.
- Smoke updated: no live badges, 3 detail tabs, field hits open Summary sections,
  closed chats expand for checks, the fixture viewer uses shot.png/missing.txt
  and the audit for markdown.
This commit is contained in:
2026-10-20 01:00:01 +01:00
parent ca28d08269
commit d130615fae
25 changed files with 1167 additions and 366 deletions
+70 -57
View File
@@ -3,7 +3,8 @@
// slash commands, notices and the local rename/hide/seen store. Pure models live
// in chat.js and markdown.js; this module owns the DOM and the chat wire wiring.
import { h, renderLiveBadge } from "../dom.js";
import { h } from "../dom.js";
import { writeChatStars } from "../chatStars.js";
import { describeError } from "../format.js";
import { SHELL_OUTPUT_LIMIT, newChatOperationId } from "../repository.js";
import { codeBlockLabel, parseInline, parseMarkdown } from "../markdown.js";
@@ -89,13 +90,11 @@ import {
chatCreateSucceeded,
chatFirstScroll,
chatFollowsAt,
chatHeaderMeta,
chatNoMatchMessage,
chatNoticeLabel,
chatOpensAtNewest,
chatShowJumpToLatest,
chatStartInLabel,
chatStreamState,
closeChatConfirmation,
composerAction,
composerCanSend,
@@ -135,9 +134,6 @@ import {
seedChatSeen,
sessionActivity,
sessionActivityBadge,
sessionChipLabel,
sessionMeta,
sessionStatusLabel,
selectChatDirectory as selectChatDirectoryModel,
sessionTitle,
sessionWorkLabel,
@@ -1532,11 +1528,20 @@ function fillChatRows(rows) {
return;
}
const active = filtered.filter((session) => !session.closed);
const starred = filtered.filter(
(session) => !session.closed && state.chatStars?.has?.(session.id) === true,
);
const active = filtered.filter(
(session) => !session.closed && state.chatStars?.has?.(session.id) !== true,
);
const closed = filtered.filter((session) => session.closed);
// Titles are often repeated ("New chat"); compute the duplicates once so the
// per-row actions name can include the session id only when it is needed.
const duplicateTitles = duplicateChatTitles(filtered);
if (starred.length > 0) {
rows.append(h("div", { class: "chat-group-header", text: "Starred" }));
for (const session of starred) rows.append(renderChatRow(session, duplicateTitles));
}
const groups = groupSessionsByDirectory(active);
if (groups.length > 1) {
for (const group of groups) {
@@ -1547,8 +1552,25 @@ function fillChatRows(rows) {
for (const session of active) rows.append(renderChatRow(session, duplicateTitles));
}
if (closed.length > 0) {
rows.append(h("div", { class: "chat-group-header", text: CLOSED_SECTION_LABEL }));
for (const session of closed) rows.append(renderChatRow(session, duplicateTitles));
const open = state.chatClosedOpen === true;
const toggle = h("button", {
class: "chat-group-toggle",
type: "button",
"aria-expanded": open ? "true" : "false",
"aria-label": `${open ? "Collapse" : "Expand"} ${CLOSED_SECTION_LABEL.toLowerCase()} chats`,
});
toggle.append(
h("span", { class: "chat-group-label", text: CLOSED_SECTION_LABEL }),
h("span", { class: "chevron", text: open ? "\u25be" : "\u25b8" }),
);
toggle.addEventListener("click", () => {
state.chatClosedOpen = !open;
renderContent();
});
rows.append(toggle);
if (open) {
for (const session of closed) rows.append(renderChatRow(session, duplicateTitles));
}
}
if (state.chatError) {
rows.append(h("div", { class: "chat-error muted", text: state.chatError }));
@@ -1571,6 +1593,16 @@ function chatEmpty(message) {
return h("div", { class: "empty" }, h("span", { class: "muted", text: message }));
}
/** Toggle one session's local star, then repaint the list in its new order. */
function toggleChatStar(id) {
const next = new Set(state.chatStars ?? []);
if (next.has(id)) next.delete(id);
else next.add(id);
state.chatStars = next;
writeChatStars(next);
renderContent();
}
/**
* One session row: title, kind chip, a Closed chip only when closed, the
* activity badge word, the work-label meta line and the close/reopen action.
@@ -1591,7 +1623,7 @@ function renderChatRow(session, duplicateTitles = new Set()) {
// The row is a plain container (M6): the session title/meta area is the native
// button and the Chat actions control is its sibling, not a child.
const row = h("div", {
class: `row chat-row${open ? " selected" : ""}`,
class: `row chat-row${open ? " selected" : ""}${state.chatMenu === session.id ? " menu-open" : ""}`,
"data-session": session.id,
});
// Keep background and programmatic clicks opening the session, but never
@@ -1611,24 +1643,22 @@ function renderChatRow(session, duplicateTitles = new Set()) {
});
const head = h("span", { class: "row-head" });
head.append(h("span", { class: "row-title chat-row-title", text: sessionTitle(session) }));
const chip = sessionChipLabel(session);
if (chip) head.append(h("span", { class: "chip chat-kind-chip", text: chip }));
if (session.closed) head.append(h("span", { class: "chip chat-closed-chip", text: CLOSED_CHIP_LABEL }));
if (badge) {
head.append(
h("span", { class: `chat-activity chat-activity-${activity}` },
h("span", { class: "chat-activity-dot", "aria-hidden": "true" }),
h("span", { class: "chat-activity-word", text: badge }),
),
);
// Only the status word, coloured, with no dot and no operator chip. A closed
// session says so here instead of carrying a second chip.
const statusWord = session.closed ? "Closed" : badge;
const statusClass = session.closed ? "chat-activity-closed" : `chat-activity-${activity}`;
if (statusWord) {
head.append(h("span", { class: `chat-activity ${statusClass}`, text: statusWord }));
}
sessionButton.append(head);
sessionButton.append(
h("span", {
class: "row-meta chat-row-meta",
text: sessionMeta(session, sessionWorkLabel(session.busy === true, thread)),
}),
);
const directory = String(session.directory ?? "").trim();
if (directory !== "") {
sessionButton.append(h("span", { class: "row-meta chat-row-meta", text: directory }));
}
const model = String(session.model ?? "").trim();
if (model !== "") {
sessionButton.append(h("span", { class: "row-meta chat-row-model muted", text: model }));
}
row.append(sessionButton, renderChatActionsMenu(session, duplicateTitles));
return row;
}
@@ -1759,6 +1789,20 @@ function renderChatCreate() {
*/
function renderChatActionsMenu(session, duplicateTitles = new Set()) {
const wrap = h("div", { class: "chat-row-actions chat-menu-wrap" });
const starred = state.chatStars?.has?.(session.id) === true;
const star = h("button", {
class: `ghost chat-star${starred ? " starred" : ""}`,
type: "button",
text: starred ? "\u2605" : "\u2606",
"aria-pressed": starred ? "true" : "false",
"aria-label": starred ? "Unstar chat" : "Star chat",
title: starred ? "Unstar chat" : "Star chat",
});
star.addEventListener("click", (event) => {
event.stopPropagation();
toggleChatStar(session.id);
});
wrap.append(star);
const expanded = state.chatMenu === session.id;
const title = sessionTitle(session);
const actionLabel = duplicateTitles.has(title)
@@ -1851,12 +1895,6 @@ function renderChatConversation() {
// The open conversation is the route's one h1; the list heading above becomes
// its h2 while the detail is open.
titles.append(h("h1", { class: "chat-bar-title", id: "detailTitle", tabindex: "-1", text: title }));
const meta = chatHeaderMeta({
model: session?.model,
tag: session?.tag,
directory: session?.directory,
});
if (meta !== "") titles.append(h("div", { class: "chat-bar-meta muted", text: meta }));
bar.append(titles);
if (thread?.hasMore) {
bar.append(
@@ -1875,31 +1913,6 @@ function renderChatConversation() {
if (awaiting) bar.append(approvalJumpButton());
pane.append(bar);
// The context line: the kind chip, the activity word and directory · model.
const context = h("div", { class: "chat-context" });
const chip = session ? sessionChipLabel(session) : null;
if (chip) context.append(h("span", { class: "chip chat-kind-chip", text: chip }));
context.append(
h("span", {
class: "chat-context-activity",
text: sessionStatusLabel(thread?.running === true, session?.closed === true),
}),
);
// The live-stream badge (C5): live while this session is subscribed, the same
// words as the run badge (`live` / `reconnecting` / `not live`).
context.append(
renderLiveBadge({
...chatStreamState(state.connection.kind, state.chatSubscriptions.has(state.chatActiveId)),
title: "Live chat stream",
}),
);
const contextMeta = [session?.directory, session?.model]
.map((value) => String(value ?? "").trim())
.filter((value) => value !== "")
.join(" · ");
if (contextMeta !== "") context.append(h("span", { class: "chat-context-meta muted", text: contextMeta }));
pane.append(context);
// The background-tasks bar (C11) sits above the transcript, outside the
// scroller so the C14 scroll positions are untouched. It is present only while
// a shell is still running and disappears with the last exit.