web: unify mobile back and audit controls and link pipeline run history
This commit is contained in:
+8
-1
@@ -1017,7 +1017,9 @@ function closeDetail(view) {
|
||||
restoreListFocus(restore);
|
||||
return;
|
||||
}
|
||||
const route = { kind: view };
|
||||
const route = view === "runs" && state.runFilters.pipelineId != null
|
||||
? { kind: "runs", pipelineId: state.runFilters.pipelineId }
|
||||
: { kind: view };
|
||||
pushRoute(route);
|
||||
applyRoute(route);
|
||||
restoreListFocus(restore);
|
||||
@@ -1525,6 +1527,11 @@ async function applyRoute(route) {
|
||||
}
|
||||
|
||||
if (r.kind === "runs") {
|
||||
if (r.pipelineId != null) {
|
||||
state.runFilters = { ...defaultRunFilters(), pipelineId: r.pipelineId };
|
||||
} else {
|
||||
state.runFilters = { ...state.runFilters, pipelineId: null };
|
||||
}
|
||||
state.selectedRunId = null;
|
||||
state.runDetail = null;
|
||||
state.runStagePane = null;
|
||||
|
||||
+5
-2
@@ -137,7 +137,10 @@ export function parseRoute(pathname, search = "") {
|
||||
if (rest.length) return { ...DEFAULT_ROUTE };
|
||||
|
||||
if (head === "pipelines" && second == null) return { kind: "pipelines" };
|
||||
if (head === "runs" && second == null) return { kind: "runs" };
|
||||
if (head === "runs" && second == null) {
|
||||
const pipelineId = parseId(params?.get("pipeline") ?? "");
|
||||
return pipelineId == null ? { kind: "runs" } : { kind: "runs", pipelineId };
|
||||
}
|
||||
if (head === "chat") {
|
||||
if (second == null) return { kind: "chat" };
|
||||
if (third == null) {
|
||||
@@ -241,7 +244,7 @@ export function serializeRoute(route) {
|
||||
case "pipelines":
|
||||
return "/pipelines";
|
||||
case "runs":
|
||||
return "/runs";
|
||||
return parseId(String(r.pipelineId ?? "")) == null ? "/runs" : `/runs?pipeline=${r.pipelineId}`;
|
||||
case "chat":
|
||||
return "/chat";
|
||||
case "chatSession": {
|
||||
|
||||
+25
-5
@@ -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");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// the rendered/raw diff viewer, the artifact viewer, the human-decision sheet,
|
||||
// the shared cancel/retry confirm and the shared Action-failed report.
|
||||
|
||||
import { h, canCopyLink, canShare, copyArtifactLink, copyText, shareArtifact } from "../dom.js";
|
||||
import { backChevronIcon, h, canCopyLink, canShare, copyArtifactLink, copyText, shareArtifact } from "../dom.js";
|
||||
import { changeKindTone, describeError } from "../format.js";
|
||||
import {
|
||||
BINARY_DIFF_MESSAGE,
|
||||
@@ -856,6 +856,7 @@ function openStageAudit({ title = "Audit", subtitle = "", tabs = [], trigger = n
|
||||
h(
|
||||
"div",
|
||||
{ class: "audit-head" },
|
||||
h("button", { class: "ghost back-button audit-back", type: "button", "aria-label": "Back to stage", title: "Back to stage", onclick: close }, backChevronIcon()),
|
||||
h(
|
||||
"div",
|
||||
{ class: "audit-titles" },
|
||||
@@ -868,7 +869,7 @@ function openStageAudit({ title = "Audit", subtitle = "", tabs = [], trigger = n
|
||||
const nav = h("nav", {
|
||||
class: "audit-tabs",
|
||||
role: "tablist",
|
||||
"aria-orientation": "vertical",
|
||||
"aria-orientation": window.matchMedia("(max-width: 599px)").matches ? "horizontal" : "vertical",
|
||||
"aria-label": "Audit sections",
|
||||
});
|
||||
const body = h("div", {
|
||||
@@ -901,8 +902,8 @@ function openStageAudit({ title = "Audit", subtitle = "", tabs = [], trigger = n
|
||||
onkeydown: (event) => {
|
||||
const index = available.findIndex((entry) => entry.key === tab.key);
|
||||
let next = -1;
|
||||
if (event.key === "ArrowDown") next = (index + 1) % available.length;
|
||||
else if (event.key === "ArrowUp") next = (index - 1 + available.length) % available.length;
|
||||
if (event.key === "ArrowDown" || event.key === "ArrowRight") next = (index + 1) % available.length;
|
||||
else if (event.key === "ArrowUp" || event.key === "ArrowLeft") next = (index - 1 + available.length) % available.length;
|
||||
else if (event.key === "Home") next = 0;
|
||||
else if (event.key === "End") next = available.length - 1;
|
||||
if (next < 0) return;
|
||||
|
||||
@@ -399,6 +399,7 @@ async function openRunDialog(pipeline) {
|
||||
start.prompt = start.intent.prompt;
|
||||
start.workspace = start.intent.workspace;
|
||||
start.notifyMode = start.intent.notifyMode;
|
||||
start.outputFormat = start.intent.outputFormat ?? "";
|
||||
start.error = "A previous launch has an unknown result. Check/retry reconciles that same request; it will not start a duplicate.";
|
||||
}
|
||||
state.runStart = start;
|
||||
@@ -549,7 +550,7 @@ function renderRunStartDialog() {
|
||||
|
||||
const outputField = h("label", { class: "run-start-field", for: "runOutputFormat" });
|
||||
outputField.append(h("span", { class: "run-start-label", text: "Report format" }));
|
||||
const outputFormat = h("select", { id: "runOutputFormat", onchange: (event) => { start.outputFormat = event.target.value; } });
|
||||
const outputFormat = h("select", { id: "runOutputFormat", disabled: start.intent != null, onchange: (event) => { start.outputFormat = event.target.value; } });
|
||||
for (const [value, label] of [["", "No report requirement"], ["html", "HTML report"], ["markdown", "Markdown report"]]) {
|
||||
const option = h("option", { value, text: label });
|
||||
option.selected = start.outputFormat === value;
|
||||
@@ -605,6 +606,18 @@ function renderPipelineDetail() {
|
||||
text: "Run",
|
||||
onclick: () => openRunDialog(d),
|
||||
}),
|
||||
h("button", {
|
||||
class: "pipeline-runs",
|
||||
type: "button",
|
||||
text: "Runs",
|
||||
title: `View runs of ${d.name || "this pipeline"}`,
|
||||
onclick: () => {
|
||||
const route = { kind: "runs", pipelineId: d.id };
|
||||
state.openMenu = null;
|
||||
pushRoute(route);
|
||||
applyRoute(route);
|
||||
},
|
||||
}),
|
||||
),
|
||||
);
|
||||
// The Run dialog is an overlay; append it before the tab branches so Graph
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// the run's artifact gallery. Pure models live in runDetail.js, changes.js,
|
||||
// artifacts.js and actions.js; dialogs are delegated to dialogs.js.
|
||||
|
||||
import { h, kvMono, canCopyLink, canShare, copyArtifactLink, shareArtifact } from "../dom.js";
|
||||
import { backChevronIcon, h, kvMono, canCopyLink, canShare, copyArtifactLink, shareArtifact } from "../dom.js";
|
||||
import { isExecuting, changeKindTone, describeError } from "../format.js";
|
||||
import { resolveArtifactUrl } from "../serverUrl.js";
|
||||
import { runStateOf, runStatusLabel } from "../runs.js";
|
||||
@@ -708,12 +708,12 @@ function renderStagePane(d) {
|
||||
"div",
|
||||
{ class: "stage-pane-bar" },
|
||||
h("button", {
|
||||
class: "stage-pane-back",
|
||||
class: "ghost back-button stage-pane-back",
|
||||
type: "button",
|
||||
"aria-label": "Back",
|
||||
text: "\u2190 Back",
|
||||
"aria-label": "Back to run",
|
||||
title: "Back to run",
|
||||
onclick: closeStagePane,
|
||||
}),
|
||||
}, backChevronIcon()),
|
||||
h(
|
||||
"div",
|
||||
{ class: "stage-pane-titles" },
|
||||
|
||||
@@ -200,6 +200,19 @@ function renderRunToolbar() {
|
||||
h("span", { class: "spacer" }),
|
||||
renderAttentionBell(),
|
||||
);
|
||||
const pipelineId = state.runFilters.pipelineId;
|
||||
if (pipelineId != null) {
|
||||
const name = state.pipelines.find((pipeline) => pipeline.id === pipelineId)?.name ??
|
||||
state.runs.find((run) => run.pipeline_id === pipelineId)?.name ?? `Pipeline ${pipelineId}`;
|
||||
const chip = h("button", {
|
||||
class: "pipeline-filter-chip",
|
||||
type: "button",
|
||||
"aria-label": `Clear pipeline filter: ${name}`,
|
||||
title: `Showing only ${name}`,
|
||||
onclick: () => setPipelineFilter(null),
|
||||
}, h("span", { text: name }), h("span", { "aria-hidden": "true", text: "×" }));
|
||||
toolbar.insertBefore(chip, toolbar.querySelector(".spacer"));
|
||||
}
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
@@ -302,6 +315,7 @@ function toggleStatusFilter(status) {
|
||||
|
||||
function setPipelineFilter(pipelineId) {
|
||||
state.runFilters = { ...state.runFilters, pipelineId };
|
||||
if (state.selectedRunId == null) rt.pushRoute(pipelineId == null ? { kind: "runs" } : { kind: "runs", pipelineId });
|
||||
closeMenu();
|
||||
}
|
||||
|
||||
@@ -312,6 +326,7 @@ function setTimeRangeFilter(timeRange) {
|
||||
|
||||
function clearRunFilters() {
|
||||
state.runFilters = defaultRunFilters();
|
||||
if (state.selectedRunId == null) rt.pushRoute({ kind: "runs" });
|
||||
closeMenu();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user