web: unify mobile back and audit controls and link pipeline run history

This commit is contained in:
2026-10-20 16:25:07 +01:00
parent 4e35da7473
commit 6841cdd2a4
16 changed files with 239 additions and 36 deletions
+25 -5
View File
@@ -779,6 +779,7 @@ function onChatEvent(frame) {
const wasQueued = thread.queued === true;
const next = applyChatEvent(thread, frame, Date.now());
state.chatThreads.set(sessionId, next);
refreshChatRowActivity(sessionId, next);
if (state.view === "chat" && sessionId === state.chatActiveId) {
// The composer's Stop lives outside the transcript. A step frame changes
// running here, so update the mounted primary control now; the transcript-only
@@ -1637,6 +1638,11 @@ async function sendChatPrompt(sessionId, session) {
operation_id: operationId,
parts: [{ type: "text", text }, ...fileParts],
};
// Sending is an explicit request to see the new turn, even if the operator
// had scrolled up to read earlier history. Later manual scrolling still wins.
state.chatFollowing = true;
state.chatAnchor = null;
state.chatPending = null;
setThread(sessionId, {
draft: "",
attachments: [],
@@ -2077,10 +2083,9 @@ function renderChatRow(session, duplicateTitles = new Set(), home = "") {
});
const head = h("span", { class: "row-head" });
head.append(h("span", { class: "row-title chat-row-title", text: sessionTitle(session) }));
head.append(chatBackendLogo(session.backend));
// 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 statusWord = session.closed ? "Closed" : activity === "streaming" ? "" : badge;
const statusClass = session.closed ? "chat-activity-closed" : `chat-activity-${activity}`;
if (statusWord) {
head.append(h("span", { class: `chat-activity ${statusClass}`, text: statusWord }));
@@ -2096,10 +2101,24 @@ function renderChatRow(session, duplicateTitles = new Set(), home = "") {
if (model !== "") {
sessionButton.append(h("span", { class: "row-meta chat-row-model muted", text: model }));
}
row.append(sessionButton, renderChatActionsMenu(session, duplicateTitles));
row.append(sessionButton, chatBackendLogo(session.backend, activity), renderChatActionsMenu(session, duplicateTitles));
return row;
}
/** Keep the fixed harness mark current without repainting the list or its rows. */
function refreshChatRowActivity(sessionId, thread) {
const row = document.querySelector(`#chatRows .chat-row[data-session="${CSS.escape(sessionId)}"]`);
const icon = row?.querySelector(".chat-backend-logo");
if (!icon) return;
const session = state.chatSessions.find((entry) => entry.id === sessionId);
const unseen = session && isChatSessionUnseen(session, { activeId: state.chatActiveId, seen: state.chatSeen, opened: true });
const activity = sessionActivity(thread?.running === true, unseen);
icon.dataset.activity = activity;
const label = chatBackendLabel(session?.backend || "opencode");
icon.setAttribute("aria-label", activity === "streaming" ? `${label} · Running` : label);
icon.title = activity === "streaming" ? `${label} · Running` : label;
}
/**
* The create pane (C2): the app's NewChatPane. A back control leaves without
* creating, then the directory error / loading / picker states in the app's own
@@ -2107,13 +2126,14 @@ function renderChatRow(session, duplicateTitles = new Set(), home = "") {
* server string is set with textContent.
*/
/** One agent's mark on the right of its chat row. */
function chatBackendLogo(backend) {
function chatBackendLogo(backend, activity = "idle") {
const value = String(backend ?? "").trim().toLowerCase() || "opencode";
const label = chatBackendLabel(value);
const wrap = h("span", {
class: `chat-backend-logo chat-backend-${value}`,
title: label,
"aria-label": label,
"aria-label": activity === "streaming" ? `${label} · Running` : label,
"data-activity": activity,
});
const NS = "http://www.w3.org/2000/svg";
const svg = document.createElementNS(NS, "svg");