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:
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
+61
-4
@@ -154,18 +154,75 @@ a { color: var(--color-accent); }
|
||||
}
|
||||
.artifact-play { font-size: 18px; color: var(--color-text); }
|
||||
.artifact-kind { color: var(--color-muted); font-size: 11px; text-transform: uppercase; letter-spacing: var(--tracking-eyebrow); }
|
||||
.artifact-name { font-size: 12px; font-weight: var(--weight-semibold); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.artifact-name {
|
||||
font-size: 12px;
|
||||
font-weight: var(--weight-semibold);
|
||||
max-width: 100%;
|
||||
line-height: 1.35;
|
||||
overflow-wrap: anywhere;
|
||||
/* Up to three lines: a long recorded name is readable, never cut to an
|
||||
indistinguishable prefix. */
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
.artifact-size { color: var(--color-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
|
||||
.artifact-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
|
||||
/* Copy link / Share: icon-only, and only while the tile (or row) is hovered or
|
||||
has focus. The buttons stay in the tab order, so keyboard users still reach
|
||||
them; the viewer carries the same actions permanently. */
|
||||
.artifact-actions {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 100ms ease-out;
|
||||
}
|
||||
.artifact-tile-wrap:hover .artifact-actions,
|
||||
.artifact-tile-wrap:focus-within .artifact-actions,
|
||||
.artifact-list-row:hover .artifact-actions,
|
||||
.artifact-list-row:focus-within .artifact-actions {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
.artifact-action {
|
||||
width: 24px;
|
||||
min-height: 24px;
|
||||
padding: 0 6px;
|
||||
font-size: 10px;
|
||||
padding: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: var(--radius-s);
|
||||
background: rgba(10, 10, 11, 0.72);
|
||||
color: var(--color-text);
|
||||
}
|
||||
.artifact-action svg { width: 14px; height: 14px; }
|
||||
.artifact-action:disabled { opacity: 0.4; cursor: not-allowed; }
|
||||
|
||||
/* The list form of the artifact gallery. */
|
||||
.artifact-list { display: grid; gap: 0; }
|
||||
.artifact-list-row { position: relative; border-bottom: 1px solid var(--color-divider); }
|
||||
.artifact-list-open {
|
||||
display: grid;
|
||||
grid-template-columns: 84px minmax(0, 1fr) auto;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
padding: 7px 78px 7px 8px;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
.artifact-list-open:hover { background: var(--color-surface-2); }
|
||||
.artifact-list-name { font-size: 12px; font-weight: var(--weight-semibold); overflow-wrap: anywhere; }
|
||||
.artifact-list-row .artifact-actions { top: 50%; transform: translateY(-50%); }
|
||||
|
||||
/* The per-visit session export link / notice (parity R9). */
|
||||
.session-export { margin-top: 6px; font-size: 12px; }
|
||||
.session-link { color: var(--color-accent); }
|
||||
|
||||
+61
-4
@@ -84,11 +84,31 @@
|
||||
text-transform: uppercase;
|
||||
color: var(--muted);
|
||||
}
|
||||
/* The CLOSED group's own expand/collapse control; the chevron sits at its end. */
|
||||
.chat-group-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
padding: 8px 12px 4px;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--muted);
|
||||
font: inherit;
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
.chat-group-toggle:hover { color: var(--color-text); }
|
||||
.chat-group-toggle .chevron { font-size: 12px; text-transform: none; }
|
||||
|
||||
.chat-row {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: 2px 8px;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 2px;
|
||||
align-items: start;
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -96,7 +116,7 @@
|
||||
and the Chat actions menu is a sibling of this button. */
|
||||
.chat-session-button {
|
||||
grid-column: 1;
|
||||
grid-row: 1 / span 2;
|
||||
grid-row: 1 / span 3;
|
||||
display: grid;
|
||||
gap: 2px;
|
||||
width: 100%;
|
||||
@@ -111,11 +131,47 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
.chat-session-button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
|
||||
/* The inner session button must never take the generic button hover fill: on a
|
||||
selected row it read as a darker rectangle inside the row's own padding. */
|
||||
.chat-session-button:hover { background: none; }
|
||||
.chat-row .row-head { grid-column: 1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
|
||||
.chat-row .row-title { min-width: 0; }
|
||||
.chat-row .row-meta { grid-column: 1; }
|
||||
.chat-row-actions { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
|
||||
.chat-row-model { font-size: 11px; }
|
||||
/* Star + actions live in a hover/focus overlay, so the title uses the row's full
|
||||
width instead of losing a permanent column on the right. */
|
||||
.chat-row-actions {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 8px;
|
||||
transform: translateY(-50%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
padding: 2px;
|
||||
border-radius: var(--radius-control);
|
||||
background: var(--color-surface);
|
||||
box-shadow: 0 0 0 1px var(--color-divider);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 100ms ease-out;
|
||||
}
|
||||
.chat-row:hover .chat-row-actions,
|
||||
.chat-row:focus-within .chat-row-actions,
|
||||
.chat-row.menu-open .chat-row-actions {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
/* An open menu paints above the rows below it, not under their content. */
|
||||
.chat-row.menu-open { z-index: 30; }
|
||||
@media (hover: none) {
|
||||
.chat-row-actions { position: static; transform: none; opacity: 1; pointer-events: auto; background: transparent; box-shadow: none; margin-top: 4px; }
|
||||
}
|
||||
.chat-row-actions button { padding: 3px 10px; font-size: 12px; }
|
||||
/* The local star: outline when unstarred, filled and accented when starred. */
|
||||
.chat-star { min-width: 28px; padding: 3px 6px; color: var(--muted); font-size: 15px; line-height: 1; }
|
||||
.chat-star:hover { color: var(--color-text); }
|
||||
.chat-star.starred { color: var(--color-accent); }
|
||||
.chat-menu-wrap { position: relative; }
|
||||
.chat-menu-button { min-width: 30px; font-size: 15px; line-height: 1; }
|
||||
.chat-menu-panel {
|
||||
@@ -181,6 +237,7 @@
|
||||
.chat-activity-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
|
||||
.chat-activity-streaming { color: var(--accent); }
|
||||
.chat-activity-new { color: #7fb2f0; }
|
||||
.chat-activity-closed { color: var(--muted); }
|
||||
|
||||
.chat-detail {
|
||||
flex: 1 1 auto;
|
||||
|
||||
@@ -543,3 +543,86 @@
|
||||
.viewer-panel { padding: 10px; border-radius: 10px; }
|
||||
.viewer-board-document { padding: 12px; }
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
Audit & debug: a stage's system files, session and definition. Vertical tabs
|
||||
on the left, the chosen document on the right.
|
||||
--------------------------------------------------------------------------- */
|
||||
.audit-viewer {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 70;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px;
|
||||
background: rgba(0, 0, 0, 0.78);
|
||||
}
|
||||
.audit-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: min(1100px, 100%);
|
||||
max-height: 100%;
|
||||
min-height: 0;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 14px;
|
||||
box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
.audit-head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
padding: 16px 18px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.audit-titles { flex: 1 1 auto; min-width: 0; }
|
||||
.audit-title { margin: 0; font-size: 16px; }
|
||||
.audit-subtitle { margin: 4px 0 0; font-size: 12px; }
|
||||
.audit-close { flex: 0 0 auto; }
|
||||
.audit-layout {
|
||||
display: grid;
|
||||
grid-template-columns: 190px minmax(0, 1fr);
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
.audit-tabs {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
padding: 10px;
|
||||
border-right: 1px solid var(--border);
|
||||
overflow: auto;
|
||||
}
|
||||
.audit-tab {
|
||||
padding: 8px 10px;
|
||||
border: 0;
|
||||
border-radius: var(--radius-control);
|
||||
background: transparent;
|
||||
color: var(--muted);
|
||||
font: inherit;
|
||||
font-size: 13px;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
.audit-tab:hover { background: var(--tint-hover); color: var(--color-text); }
|
||||
.audit-tab.active {
|
||||
background: var(--tint-selected);
|
||||
color: var(--color-text);
|
||||
font-weight: var(--weight-semibold);
|
||||
box-shadow: inset 2px 0 0 var(--color-accent);
|
||||
}
|
||||
.audit-body { min-height: 0; overflow: auto; padding: 16px 18px; }
|
||||
.audit-doc { max-width: var(--layout-measure); }
|
||||
.audit-definition { display: grid; gap: 6px; }
|
||||
@media (max-width: 640px) {
|
||||
.audit-layout { grid-template-columns: 1fr; }
|
||||
.audit-tabs {
|
||||
flex-direction: row;
|
||||
border-right: 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
overflow-x: auto;
|
||||
}
|
||||
.audit-tab { white-space: nowrap; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="Pipelines">
|
||||
<rect width="64" height="64" rx="14" fill="#101013"/>
|
||||
<path d="M23 48V17h11a10 10 0 0 1 0 20H23" fill="none" stroke="#cfd9e6" stroke-width="7.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 300 B |
@@ -4,6 +4,9 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, interactive-widget=resizes-content" />
|
||||
<title>Pipelines</title>
|
||||
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
||||
<meta name="theme-color" content="#0b0b0d" />
|
||||
<link rel="stylesheet" href="./design/tokens/tokens.css" />
|
||||
<link rel="stylesheet" href="./base.css" />
|
||||
<link rel="stylesheet" href="./shell.css" />
|
||||
|
||||
+16
-1
@@ -122,7 +122,22 @@
|
||||
|
||||
.run-row { display: block; padding: 8px 12px; }
|
||||
.run-row-head { display: flex; align-items: center; gap: 8px; }
|
||||
.run-row-title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
/* The pipeline name leads the row; the stored task title is its second line. */
|
||||
.run-row-head .run-row-pipeline-name {
|
||||
min-width: 0;
|
||||
color: var(--color-text);
|
||||
font-weight: var(--weight-semibold);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.run-row-title {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
color: var(--color-text);
|
||||
font-weight: 500;
|
||||
}
|
||||
.run-row-pipeline { display: flex; align-items: center; gap: 8px; margin-top: 2px; color: var(--muted); font-size: 12px; }
|
||||
.run-row-pipeline-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.run-row-progress,
|
||||
|
||||
@@ -204,7 +204,41 @@
|
||||
text-underline-offset: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.kv-pipeline-link { border: 0; background: transparent; }
|
||||
.kv-pipeline-link:hover { color: var(--color-text); }
|
||||
/* The status badge sits above the run's name, where the run starts. */
|
||||
.run-kicker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
|
||||
/* Section headers are one compact row: the toggle and its optional view switch. */
|
||||
.section-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
|
||||
.section-row .section-toggle { margin-top: 0; flex: 1 1 auto; }
|
||||
.view-toggle {
|
||||
display: inline-flex;
|
||||
flex: 0 0 auto;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-control);
|
||||
overflow: hidden;
|
||||
}
|
||||
.view-toggle-button {
|
||||
padding: 4px 10px;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
.view-toggle-button:hover { background: var(--tint-hover); color: var(--text); }
|
||||
.view-toggle-button.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
|
||||
/* The audit door at the bottom of a stage pane. */
|
||||
.stage-pane-audit { display: flex; justify-content: flex-end; margin-top: 14px; }
|
||||
.audit-list { display: grid; gap: 2px; }
|
||||
.audit-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 6px 4px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.audit-row-label { flex: 1 1 auto; font-size: 13px; }
|
||||
.audit-row-meta { font-size: 12px; }
|
||||
.kv-pipeline-name { font-weight: 600; }
|
||||
.kv-pipeline-ident { margin-left: 8px; color: var(--muted); font-size: 12px; font-weight: 400; }
|
||||
|
||||
|
||||
@@ -184,6 +184,7 @@ body {
|
||||
font: var(--type-title-small);
|
||||
letter-spacing: var(--tracking-tight);
|
||||
}
|
||||
.rail-brand-icon { width: 26px; height: 26px; flex: none; border-radius: 7px; display: block; }
|
||||
.rail-brand-mark {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -271,6 +272,8 @@ body {
|
||||
margin: var(--space-s) var(--space-xs);
|
||||
background: var(--color-divider);
|
||||
}
|
||||
/* The Search / destinations boundary needs to read as a separator, not vanish. */
|
||||
.rail-divider-visible { background: var(--color-border); margin: var(--space-xs) var(--space-s); }
|
||||
|
||||
.rail-sections { display: none; min-height: 0; }
|
||||
.rail-sections.has-sections { display: block; }
|
||||
|
||||
+17
-1
@@ -26,6 +26,8 @@ import {
|
||||
import { SERVER_URL_STORAGE_KEY, readServerUrl, readWorkspace, writeServerUrl } from "./settings.js";
|
||||
import { layoutGraph } from "./graph.js";
|
||||
import { readGraphExpanded } from "./graphPrefs.js";
|
||||
import { readArtifactView } from "./artifactViewPrefs.js";
|
||||
import { readChatStars } from "./chatStars.js";
|
||||
import { DEFAULT_ROUTE, parseRoute, serializeRoute } from "./routes.js";
|
||||
import { EMPTY_PIPELINE_FILTERS, PIPELINE_DETAIL_TABS } from "./pipelines.js";
|
||||
import {
|
||||
@@ -158,6 +160,12 @@ const state = {
|
||||
pipelineGraph: null,
|
||||
// Expanded by default; a collapse is remembered (graphPrefs.js).
|
||||
pipelineGraphExpanded: readGraphExpanded(),
|
||||
// Gallery or list for run artifacts; a per-operator choice (artifactViewPrefs.js).
|
||||
artifactView: readArtifactView(),
|
||||
// Starred chat sessions (chatStars.js): local, always sorted first.
|
||||
chatStars: readChatStars(),
|
||||
// Whether the CLOSED chats group is expanded (the chevron beside its name).
|
||||
chatClosedOpen: false,
|
||||
// The mounted run-mode graph (R5) on the run detail's Graph tab. Dropped on
|
||||
// every re-render and on a run change, so its wheel/pointer/resize listeners
|
||||
// and its elapsed timer can never leak.
|
||||
@@ -503,10 +511,18 @@ const appRail = h(
|
||||
h(
|
||||
"div",
|
||||
{ class: "rail-brand" },
|
||||
h("span", { class: "rail-brand-mark", "aria-hidden": "true", text: "P" }),
|
||||
h("img", {
|
||||
class: "rail-brand-icon",
|
||||
src: "/favicon.svg",
|
||||
alt: "",
|
||||
width: "26",
|
||||
height: "26",
|
||||
"aria-hidden": "true",
|
||||
}),
|
||||
h("span", { text: "Pipelines" }),
|
||||
),
|
||||
railSearch,
|
||||
h("div", { class: "rail-divider rail-divider-visible", role: "presentation" }),
|
||||
railDestinations,
|
||||
h("div", { class: "rail-divider", role: "presentation" }),
|
||||
railSections,
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// The run artifacts' view preference: a gallery of tiles (the default) or a
|
||||
// compact list. It belongs to the operator, not the run, so it survives reloads.
|
||||
|
||||
export const ARTIFACT_VIEW_KEY = "pipelines.web.artifactView.v1";
|
||||
|
||||
export function readArtifactView(storage = globalThis.localStorage) {
|
||||
try {
|
||||
return storage?.getItem(ARTIFACT_VIEW_KEY) === "list" ? "list" : "gallery";
|
||||
} catch {
|
||||
return "gallery";
|
||||
}
|
||||
}
|
||||
|
||||
export function writeArtifactView(value, storage = globalThis.localStorage) {
|
||||
try {
|
||||
storage?.setItem(ARTIFACT_VIEW_KEY, value === "list" ? "list" : "gallery");
|
||||
} catch {
|
||||
// Storage may be unavailable; the in-memory choice still applies.
|
||||
}
|
||||
}
|
||||
+73
-7
@@ -145,6 +145,34 @@ export function presentedArtifacts(step) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The files the turn protocol itself writes for every visit. They are audit
|
||||
* evidence, not stage output: the artifact surfaces lead with what the stage
|
||||
* actually produced, and these live behind Audit & debug. Names are the exact
|
||||
* server-recorded ones.
|
||||
*/
|
||||
export const SYSTEM_ARTIFACT_NAMES = Object.freeze([
|
||||
"input.md",
|
||||
"memory.md",
|
||||
"output.md",
|
||||
"session.html",
|
||||
]);
|
||||
|
||||
/** True for a turn-owned file (input/memory/output/session). Pure. */
|
||||
export function isSystemArtifact(artifact) {
|
||||
return SYSTEM_ARTIFACT_NAMES.includes(String(artifact?.name ?? ""));
|
||||
}
|
||||
|
||||
/** A visit's stage-produced artifacts: everything except the system files. */
|
||||
export function stageArtifacts(step) {
|
||||
return presentedArtifacts(step).filter((artifact) => !isSystemArtifact(artifact));
|
||||
}
|
||||
|
||||
/** A visit's system files, newest-listing order preserved. */
|
||||
export function systemArtifacts(step) {
|
||||
return presentedArtifacts(step).filter(isSystemArtifact);
|
||||
}
|
||||
|
||||
/** How many files the capture excluded for `step` (absent means none). */
|
||||
export function artifactsSkipped(step) {
|
||||
return Number(step?.artifacts_skipped ?? 0) || 0;
|
||||
@@ -253,8 +281,34 @@ export function displayVisit(step, index) {
|
||||
return Number(visit) > 0 ? Number(visit) : index + 1;
|
||||
}
|
||||
|
||||
/** True for a shared public file's recorded name (`public/...`). */
|
||||
function isPublicName(name) {
|
||||
return String(name ?? "").startsWith("public/");
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups a run's artifacts by stage and visit. Stages keep first-appearance
|
||||
* A visit's stage artifacts, with each shared public file attributed to the first
|
||||
* visit that recorded it. The server records the whole public directory on every
|
||||
* model visit so a resume can rebuild each turn's file list; the artifact surface
|
||||
* must not repeat every shared file once per later stage.
|
||||
*/
|
||||
export function visitArtifacts(step, runSteps) {
|
||||
const all = stageArtifacts(step);
|
||||
if (!step || !runSteps?.length) return all;
|
||||
const seen = new Set();
|
||||
const ordered = [...runSteps].sort((a, b) => (a?.sequence ?? 0) - (b?.sequence ?? 0));
|
||||
for (const candidate of ordered) {
|
||||
if (candidate === step || candidate?.sequence === step.sequence) break;
|
||||
for (const artifact of stageArtifacts(candidate)) {
|
||||
if (isPublicName(artifact?.name)) seen.add(artifact.name);
|
||||
}
|
||||
}
|
||||
return all.filter((artifact) => !isPublicName(artifact?.name) || !seen.has(artifact.name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups a run's artifacts by stage and visit, attributing each shared public file
|
||||
* to the visit that first recorded it. Stages keep first-appearance
|
||||
* order and each stage's visits are ordered by sequence, with the display visit
|
||||
* number above. Only visits that recorded at least one presented artifact
|
||||
* produce a group, so an empty capture never yields an empty group and an
|
||||
@@ -266,6 +320,18 @@ export function artifactGroups(steps) {
|
||||
if (list.length === 0) return [];
|
||||
// groupBy(stage) keeps first-appearance order (a Map preserves insertion
|
||||
// order); each stage's visits are then ordered by sequence.
|
||||
const orderedSteps = [...list].sort((a, b) => (a?.sequence ?? 0) - (b?.sequence ?? 0));
|
||||
const attributed = new Map();
|
||||
const seenPublic = new Set();
|
||||
for (const step of orderedSteps) {
|
||||
const artifacts = stageArtifacts(step).filter((artifact) => {
|
||||
if (!isPublicName(artifact?.name)) return true;
|
||||
if (seenPublic.has(artifact.name)) return false;
|
||||
seenPublic.add(artifact.name);
|
||||
return true;
|
||||
});
|
||||
attributed.set(step, artifacts);
|
||||
}
|
||||
const visitsByStage = new Map();
|
||||
for (const step of list) {
|
||||
const stage = step?.stage ?? "";
|
||||
@@ -276,7 +342,7 @@ export function artifactGroups(steps) {
|
||||
for (const [stageKey, visits] of visitsByStage) {
|
||||
const ordered = [...visits].sort((a, b) => (a?.sequence ?? 0) - (b?.sequence ?? 0));
|
||||
ordered.forEach((step, index) => {
|
||||
const artifacts = presentedArtifacts(step);
|
||||
const artifacts = attributed.get(step) ?? [];
|
||||
if (artifacts.length === 0) return;
|
||||
groups.push({ stageKey, visit: displayVisit(step, index), artifacts });
|
||||
});
|
||||
@@ -306,7 +372,7 @@ export function artifactsEmptyMessage(executing) {
|
||||
*/
|
||||
export function artifactsHeader(steps, executing) {
|
||||
const list = steps ?? [];
|
||||
const recorded = list.reduce((sum, step) => sum + presentedArtifacts(step).length, 0);
|
||||
const recorded = artifactGroups(list).reduce((sum, group) => sum + group.artifacts.length, 0);
|
||||
if (recorded === 0) return artifactsEmptyMessage(executing);
|
||||
const partial = list.some((step) => artifactsSkipped(step) > 0 || artifactsTruncated(step) > 0);
|
||||
let label = `${recorded === 1 ? "Artifact" : "Artifacts"} · ${recorded} recorded`;
|
||||
@@ -320,13 +386,13 @@ export function artifactsHeader(steps, executing) {
|
||||
* otherwise the recorded count plus " · partial capture" when files were
|
||||
* excluded or omitted. Mirrors Format.kt artifactsSummary.
|
||||
*/
|
||||
export function artifactsSummary(step) {
|
||||
const artifacts = presentedArtifacts(step);
|
||||
if (artifacts.length === 0) {
|
||||
export function artifactsSummary(step, count = null) {
|
||||
const recorded = count ?? stageArtifacts(step).length;
|
||||
if (recorded === 0) {
|
||||
const state = step?.status === "running" ? ARTIFACT_CAPTURE_PENDING : "not recorded for this visit";
|
||||
return `Artifacts · ${state}`;
|
||||
}
|
||||
let label = `Artifacts · ${artifacts.length} recorded`;
|
||||
let label = `Artifacts · ${recorded} recorded`;
|
||||
if (artifactsSkipped(step) > 0 || artifactsTruncated(step) > 0) label += " · partial capture";
|
||||
return label;
|
||||
}
|
||||
|
||||
+1
-1
@@ -560,7 +560,7 @@ export function sessionActivityBadge(activity, open) {
|
||||
if (activity === "streaming") return "Streaming";
|
||||
if (activity === "new") return "New";
|
||||
if (activity === "idle" && open) return "Open";
|
||||
return null;
|
||||
return "Idle";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// The operator's starred chats. A star is a local preference, not part of the
|
||||
// server's chat record, so it survives reloads on this device and never mutates
|
||||
// the session. Starred sessions sort above everything else.
|
||||
|
||||
export const CHAT_STARS_KEY = "pipelines.web.chatStars.v1";
|
||||
|
||||
export function readChatStars(storage = globalThis.localStorage) {
|
||||
try {
|
||||
const parsed = JSON.parse(storage?.getItem(CHAT_STARS_KEY) ?? "[]");
|
||||
return new Set(Array.isArray(parsed) ? parsed.filter((id) => typeof id === "string" && id !== "") : []);
|
||||
} catch {
|
||||
return new Set();
|
||||
}
|
||||
}
|
||||
|
||||
export function writeChatStars(stars, storage = globalThis.localStorage) {
|
||||
try {
|
||||
storage?.setItem(CHAT_STARS_KEY, JSON.stringify([...stars]));
|
||||
} catch {
|
||||
// Storage may be unavailable; the in-memory choice still applies.
|
||||
}
|
||||
}
|
||||
+22
-27
@@ -27,8 +27,8 @@ import {
|
||||
formatLocalTimestamp,
|
||||
runStateOf,
|
||||
} from "./runs.js";
|
||||
import { presentedArtifacts, sessionExportArtifact, displayVisit } from "./artifacts.js";
|
||||
import { changeStat, parseUnifiedPatch } from "./changes.js";
|
||||
import { presentedArtifacts, sessionExportArtifact, stageArtifacts, visitArtifacts, displayVisit } from "./artifacts.js";
|
||||
import { changeStat, parseUnifiedPatch, runChanges, runChangesHeader } from "./changes.js";
|
||||
import { effectiveStageType } from "./templates.js";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -49,8 +49,16 @@ export const RUN_DETAIL_TABS = [
|
||||
{ key: "steps", label: "Timeline" },
|
||||
];
|
||||
|
||||
/** The tabs the browser renders: all of them, including the Graph body (R5). */
|
||||
export const RENDERED_RUN_TABS = RUN_DETAIL_TABS;
|
||||
/**
|
||||
* The tabs the browser renders. Input and Output are run Summary sections now
|
||||
* (alongside Artifacts and Files changed), not separate tabs; the stable keys
|
||||
* `input`/`output` remain in RUN_DETAIL_TABS for Android parity and old routes.
|
||||
*/
|
||||
export const RENDERED_RUN_TABS = [
|
||||
{ key: "summary", label: "Summary" },
|
||||
{ key: "graph", label: "Graph" },
|
||||
{ key: "steps", label: "Timeline" },
|
||||
];
|
||||
|
||||
// The empty-state sentences, exactly as the app spells them.
|
||||
export const EMPTY_INPUT_MESSAGE = "No input recorded.";
|
||||
@@ -640,34 +648,21 @@ export function looksLikeMarkdown(value) {
|
||||
return /^#{1,6}\s/m.test(text) || /```/.test(text) || /^\s*(?:[-*]|\d+\.)\s+/m.test(text) || /^\|.+\|/m.test(text);
|
||||
}
|
||||
|
||||
export function stageSectionSpecs(stageKey, graph, runSteps, visitIndex, runContext) {
|
||||
/**
|
||||
* The stage pane's body sections for one visit: what the stage produced (its
|
||||
* non-system artifacts) and what it changed. The turn files, session export and
|
||||
* stage definition live behind Audit & debug, so the pane stays about the work.
|
||||
*/
|
||||
export function stageSectionSpecs(stageKey, graph, runSteps, visitIndex, runContext, allSteps = null) {
|
||||
const specs = [];
|
||||
const stage = (graph?.stages ?? []).find((candidate) => candidate?.key === stageKey);
|
||||
const definition = stage ? stageDefinitionFields(stage) : terminalFields(graph, stageKey);
|
||||
const steps = runSteps ?? [];
|
||||
const selectedStep = steps[clampVisitIndex(visitIndex, steps.length)];
|
||||
if (runContext && selectedStep != null) {
|
||||
const runFields = runStepFields(selectedStep);
|
||||
const session = sessionExportArtifact(selectedStep) != null;
|
||||
// The collapsible's title carries the count so the operator sees how many
|
||||
// artifacts this visit recorded without expanding it.
|
||||
const presented = presentedArtifacts(selectedStep).length;
|
||||
const artifactsTitle = `${STAGE_ARTIFACTS_TITLE} · ${presented} recorded`;
|
||||
specs.push({ key: "artifacts", title: artifactsTitle, fields: [], artifacts: true, session: false });
|
||||
if (session) {
|
||||
specs.push({ key: "session", title: STAGE_SESSION_TITLE, fields: [], artifacts: false, session: true });
|
||||
const used = visitArtifacts(selectedStep, allSteps ?? steps).length;
|
||||
specs.push({ key: "artifacts", title: `${STAGE_ARTIFACTS_TITLE} · ${used} recorded`, artifacts: true });
|
||||
if (selectedStep.file_changes != null) {
|
||||
specs.push({ key: "changes", title: runChangesHeader(runChanges([selectedStep])), changes: true });
|
||||
}
|
||||
const output = runFields.filter((entry) => entry.label === "Output");
|
||||
if (output.length > 0) specs.push({ key: "output", title: "Output", fields: output, artifacts: false, session: false });
|
||||
const input = runFields.filter((entry) => entry.label === "Input");
|
||||
if (input.length > 0) specs.push({ key: "input", title: "Input", fields: input, artifacts: false, session: false });
|
||||
const evidence = evidenceFields(runFields);
|
||||
if (evidence.length > 0) {
|
||||
specs.push({ key: "run", title: STAGE_EVIDENCE_TITLE, fields: evidence, artifacts: false, session: false });
|
||||
}
|
||||
}
|
||||
if (definition.length > 0) {
|
||||
specs.push({ key: "definition", title: STAGE_DEFINITION_TITLE, fields: definition, artifacts: false, session: false });
|
||||
}
|
||||
return specs;
|
||||
}
|
||||
|
||||
+70
-57
@@ -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.
|
||||
|
||||
@@ -816,6 +816,105 @@ function openArtifactViewer(viewable, startIndex, trigger = null) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The Audit & debug dialog: a stage's turn-owned evidence behind vertical tabs
|
||||
* (Input, Output, Memory, Session, Stage definition), the chosen section's body
|
||||
* on the right. It is the only place the system files are shown, so the artifact
|
||||
* surfaces stay focused on what the stage actually produced.
|
||||
*/
|
||||
function openStageAudit({ title = "Audit", subtitle = "", tabs = [], trigger = null } = {}) {
|
||||
const available = (tabs ?? []).filter((tab) => typeof tab?.body === "function");
|
||||
if (!available.length) return;
|
||||
const close = () => modal.close("stage-audit");
|
||||
const overlay = h("div", {
|
||||
class: "audit-viewer",
|
||||
role: "dialog",
|
||||
"aria-modal": "true",
|
||||
"aria-label": title,
|
||||
});
|
||||
overlay.addEventListener("click", (event) => {
|
||||
if (event.target === overlay) close();
|
||||
});
|
||||
const closeButton = h("button", {
|
||||
class: "audit-close",
|
||||
type: "button",
|
||||
text: "Close",
|
||||
onclick: close,
|
||||
});
|
||||
const panel = h("div", { class: "audit-panel" });
|
||||
panel.append(
|
||||
h(
|
||||
"div",
|
||||
{ class: "audit-head" },
|
||||
h(
|
||||
"div",
|
||||
{ class: "audit-titles" },
|
||||
h("h2", { class: "audit-title", text: title }),
|
||||
subtitle ? h("p", { class: "audit-subtitle muted", text: subtitle }) : null,
|
||||
),
|
||||
closeButton,
|
||||
),
|
||||
);
|
||||
const nav = h("nav", {
|
||||
class: "audit-tabs",
|
||||
role: "tablist",
|
||||
"aria-orientation": "vertical",
|
||||
"aria-label": "Audit sections",
|
||||
});
|
||||
const body = h("div", {
|
||||
class: "audit-body",
|
||||
id: "auditBody",
|
||||
role: "tabpanel",
|
||||
tabindex: "0",
|
||||
});
|
||||
panel.append(h("div", { class: "audit-layout" }, nav, body));
|
||||
overlay.append(panel);
|
||||
|
||||
let active = available[0].key;
|
||||
const renderTabs = () => {
|
||||
nav.replaceChildren(
|
||||
...available.map((tab) => {
|
||||
const selected = tab.key === active;
|
||||
return h("button", {
|
||||
class: `audit-tab${selected ? " active" : ""}`,
|
||||
type: "button",
|
||||
role: "tab",
|
||||
"aria-selected": selected ? "true" : "false",
|
||||
"aria-controls": "auditBody",
|
||||
"data-audit-tab": tab.key,
|
||||
tabindex: selected ? "0" : "-1",
|
||||
text: tab.label,
|
||||
onclick: () => {
|
||||
active = tab.key;
|
||||
renderTabs();
|
||||
},
|
||||
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;
|
||||
else if (event.key === "Home") next = 0;
|
||||
else if (event.key === "End") next = available.length - 1;
|
||||
if (next < 0) return;
|
||||
event.preventDefault();
|
||||
active = available[next].key;
|
||||
renderTabs();
|
||||
nav.querySelector(`[data-audit-tab="${active}"]`)?.focus();
|
||||
},
|
||||
});
|
||||
}),
|
||||
);
|
||||
const current = available.find((tab) => tab.key === active) ?? available[0];
|
||||
body.replaceChildren(current.body());
|
||||
};
|
||||
renderTabs();
|
||||
modal.open("stage-audit", overlay, {
|
||||
onClose: () => close(),
|
||||
trigger,
|
||||
fallbackSelectors: ["#detailTitle", "#pane-main"],
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
closeChangeViewer,
|
||||
openChangeViewer,
|
||||
@@ -831,5 +930,6 @@ function openArtifactViewer(viewable, startIndex, trigger = null) {
|
||||
dismissActionError,
|
||||
closeArtifactViewer,
|
||||
openArtifactViewer,
|
||||
openStageAudit,
|
||||
};
|
||||
}
|
||||
|
||||
+289
-46
@@ -3,9 +3,8 @@
|
||||
// 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, renderLiveBadge, canCopyLink, canShare, copyArtifactLink, shareArtifact } from "../dom.js";
|
||||
import { h, kvMono, canCopyLink, canShare, copyArtifactLink, shareArtifact } from "../dom.js";
|
||||
import { isExecuting, changeKindTone, describeError } from "../format.js";
|
||||
import { liveBadgeState } from "../connection.js";
|
||||
import { resolveArtifactUrl } from "../serverUrl.js";
|
||||
import { runStateOf } from "../runs.js";
|
||||
import { PIPELINE_GRAPH_EMPTY, RUN_GRAPH_MISSING, mount as mountGraph } from "../graph.js";
|
||||
@@ -27,6 +26,8 @@ import {
|
||||
headlineFields,
|
||||
runStepFields,
|
||||
stageSectionSpecs,
|
||||
stageDefinitionFields,
|
||||
terminalFields,
|
||||
clampVisitIndex,
|
||||
referencedVerdictArtifacts,
|
||||
verdictReasonSegments,
|
||||
@@ -50,8 +51,12 @@ import {
|
||||
presentedArtifacts,
|
||||
resolvedArtifactUrl,
|
||||
sessionExportArtifact,
|
||||
stageArtifacts,
|
||||
systemArtifacts,
|
||||
visitArtifacts,
|
||||
viewerIndexByUrl,
|
||||
} from "../artifacts.js";
|
||||
import { writeArtifactView } from "../artifactViewPrefs.js";
|
||||
import {
|
||||
BINARY_DIFF_MESSAGE,
|
||||
NO_LINE_CHANGES_MESSAGE,
|
||||
@@ -105,6 +110,7 @@ export function createRunDetailView(rt) {
|
||||
const renderConfirmDialog = (...args) => rt.views.dialogs.renderConfirmDialog(...args);
|
||||
const renderActionFailedDialog = (...args) => rt.views.dialogs.renderActionFailedDialog(...args);
|
||||
const openArtifactViewer = (...args) => rt.views.dialogs.openArtifactViewer(...args);
|
||||
const showStageAudit = (...args) => rt.views.dialogs.openStageAudit(...args);
|
||||
const selectPipeline = (...args) => rt.selectPipeline(...args);
|
||||
|
||||
/**
|
||||
@@ -127,6 +133,14 @@ function renderRunDetail(now = Date.now()) {
|
||||
// the Android run detail does, so opening the run is enough — no tab hunt.
|
||||
const decision = pendingDecision(d);
|
||||
if (decision) pane.append(renderDecisionCard(decision));
|
||||
const status = runStateOf(d.status);
|
||||
const kicker = h("div", { class: "run-kicker" });
|
||||
kicker.append(h("span", { class: `chip chip-${status}`, text: d.status || status }));
|
||||
if (String(d.outcome ?? "").trim()) {
|
||||
kicker.append(h("span", { class: "muted", text: `outcome ${d.outcome}` }));
|
||||
}
|
||||
if (d.executing) kicker.append(h("span", { class: "muted", text: "executing" }));
|
||||
pane.append(kicker);
|
||||
pane.append(
|
||||
h("h1", {
|
||||
class: "run-detail-title",
|
||||
@@ -195,17 +209,108 @@ function latestVisitIndex(d, key) {
|
||||
return Math.max(0, visits.length - 1);
|
||||
}
|
||||
|
||||
/** The Summary tab: identity, chip row, key/value rows, diagnostic and gallery. */
|
||||
/** The summary's Audit & debug section: one audit door per visit. */
|
||||
function renderRunAuditSection(d) {
|
||||
return renderCollapsible("summary-audit", "Audit & debug", () => {
|
||||
const timeline = runTimeline(d.steps ?? []);
|
||||
const body = h("div", { class: "audit-list" });
|
||||
if (!timeline.entries.length) {
|
||||
body.append(h("div", { class: "muted", text: EMPTY_TIMELINE_MESSAGE }));
|
||||
return body;
|
||||
}
|
||||
for (const entry of timeline.entries) {
|
||||
const used = systemArtifacts(entry.step).length;
|
||||
const row = h("div", { class: "audit-row" });
|
||||
row.append(
|
||||
h("span", {
|
||||
class: "audit-row-label",
|
||||
text: `${entry.stageKey} · visit ${entry.visitIndex + 1}`,
|
||||
}),
|
||||
h("span", { class: "audit-row-meta muted", text: `${used} system file${used === 1 ? "" : "s"}` }),
|
||||
);
|
||||
const open = h("button", {
|
||||
class: "ghost audit-open",
|
||||
type: "button",
|
||||
text: "Audit",
|
||||
});
|
||||
open.addEventListener("click", () => openAuditFor(d, entry.step, entry.stageKey, entry.visitIndex));
|
||||
row.append(open);
|
||||
body.append(row);
|
||||
}
|
||||
return body;
|
||||
});
|
||||
}
|
||||
|
||||
/** Open the audit dialog for one visit: its turn files, session and definition. */
|
||||
function openAuditFor(d, step, stageKey, visitIndex) {
|
||||
if (!step) return;
|
||||
const graph = d.graph ?? { stages: [] };
|
||||
const stage = (graph.stages ?? []).find((candidate) => candidate.key === stageKey) ?? null;
|
||||
const fields = runStepFields(step);
|
||||
const valueOf = (label) => fields.find((field) => field.label === label)?.value ?? "";
|
||||
showStageAudit({
|
||||
title: `${nodeLabel(stageKey)} audit`,
|
||||
subtitle: `Visit ${visitIndex + 1} · ${runLabelFor(d)}`,
|
||||
tabs: [
|
||||
{ key: "input", label: "Input", body: () => auditDocument(valueOf("Input"), EMPTY_INPUT_MESSAGE) },
|
||||
{ key: "output", label: "Output", body: () => auditDocument(valueOf("Output"), EMPTY_OUTPUT_MESSAGE) },
|
||||
{ key: "memory", label: "Memory", body: () => auditMemory(step) },
|
||||
{ key: "session", label: "Session", body: () => renderSessionExport(step) },
|
||||
{ key: "definition", label: "Definition", body: () => auditDefinition(stage, stageKey, graph) },
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
/** One audit tab body: a markdown document, or the honest empty sentence. */
|
||||
function auditDocument(text, emptyMessage) {
|
||||
const value = String(text ?? "").trim();
|
||||
if (value === "") return h("div", { class: "muted", text: emptyMessage });
|
||||
if (looksLikeMarkdown(value)) {
|
||||
return h("div", { class: "audit-doc field-markdown" }, rt.views.chat.renderMarkdown(value));
|
||||
}
|
||||
return h("pre", { class: "field-block" }, h("code", { text: value }));
|
||||
}
|
||||
|
||||
/** The memory.md of this visit, rendered once it loads. */
|
||||
function auditMemory(step) {
|
||||
const artifact = systemArtifacts(step).find((entry) => entry.name === "memory.md");
|
||||
if (!artifact) return h("div", { class: "muted", text: "No memory recorded for this visit." });
|
||||
const resolved = resolvedArtifactUrl(artifact, state.url);
|
||||
if (!resolved) return h("div", { class: "muted", text: ARTIFACT_SERVER_HINT });
|
||||
const body = h("div", { class: "audit-doc" }, h("div", { class: "muted", text: "Loading memory…" }));
|
||||
fetch(resolved)
|
||||
.then((response) => {
|
||||
if (!response.ok) throw new Error(`The server answered ${response.status}.`);
|
||||
return response.text();
|
||||
})
|
||||
.then((text) => {
|
||||
if (text.trim() === "") {
|
||||
body.replaceChildren(h("div", { class: "muted", text: "No completed turns were recorded before this visit." }));
|
||||
return;
|
||||
}
|
||||
const article = h("div", { class: "field-markdown" });
|
||||
article.append(rt.views.chat.renderMarkdown(text));
|
||||
body.replaceChildren(article);
|
||||
})
|
||||
.catch((error) => {
|
||||
body.replaceChildren(h("div", { class: "muted", text: describeError(error) }));
|
||||
});
|
||||
return body;
|
||||
}
|
||||
|
||||
/** The stage's own definition (prompt, tools, configs, edges) in the audit. */
|
||||
function auditDefinition(stage, stageKey, graph) {
|
||||
const fields = stage ? stageDefinitionFields(stage) : terminalFields(graph, stageKey);
|
||||
if (!fields.length) return h("div", { class: "muted", text: NO_STAGE_DETAILS_MESSAGE });
|
||||
const body = h("div", { class: "audit-definition" });
|
||||
for (const field of fields) body.append(renderStageField(field));
|
||||
return body;
|
||||
}
|
||||
|
||||
/** The Summary tab: identity, key/value rows, diagnostic and the sections. */
|
||||
function renderRunSummaryTab(d, now) {
|
||||
const wrap = h("div", { class: "run-tab-body" });
|
||||
wrap.append(renderRunTitleRow(d));
|
||||
const status = runStateOf(d.status);
|
||||
const chips = h("div", { class: "run-chip-row" });
|
||||
chips.append(h("span", { class: `chip chip-${status}`, text: d.status || status }));
|
||||
if (String(d.outcome ?? "").trim()) chips.append(h("span", { class: "muted", text: `outcome ${d.outcome}` }));
|
||||
if (d.executing) chips.append(h("span", { class: "muted", text: "executing" }));
|
||||
chips.append(renderLiveBadge(liveBadgeState(state.runStream)));
|
||||
wrap.append(chips);
|
||||
wrap.append(h("div", { class: "run-identity muted", text: runIdentityLine(d) }));
|
||||
|
||||
const rows = h("div", { class: "kv" });
|
||||
@@ -218,24 +323,41 @@ function renderRunSummaryTab(d, now) {
|
||||
}
|
||||
wrap.append(rows);
|
||||
|
||||
// The run-level artifacts gallery (parity R8), collapsed by default like the
|
||||
// Android summary. Its header alone says what was captured until expanded.
|
||||
// Stage-produced artifacts first: the turn's own input/memory/output/session
|
||||
// files are audit evidence and live behind Audit & debug instead.
|
||||
wrap.append(
|
||||
renderCollapsible("summary-artifacts", artifactsHeader(d.steps ?? [], isExecuting(d)), () =>
|
||||
renderArtifactGallery(d.steps ?? []),
|
||||
renderCollapsible(
|
||||
"summary-artifacts",
|
||||
artifactsHeader(d.steps ?? [], isExecuting(d)),
|
||||
() => renderArtifactGallery(d.steps ?? []),
|
||||
{ actions: artifactViewToggle() },
|
||||
),
|
||||
);
|
||||
|
||||
// The run-level Changes (parity R4), collapsed by default like the Android
|
||||
// summary: the observed final-state workspace diff. Only a succeeded run has a
|
||||
// settled final state to present; a failed run keeps its evidence in each
|
||||
// visit's own capture (a deliberate divergence from Android, see PARITY R4).
|
||||
// The run-level Changes (parity R4): the observed final-state workspace diff.
|
||||
// Only a succeeded run has a settled final state to present; a failed run keeps
|
||||
// its evidence in each visit's own capture.
|
||||
if (showRunChangesSummary(d.status)) {
|
||||
const changes = runChanges(d.steps ?? []);
|
||||
wrap.append(
|
||||
renderCollapsible("summary-changes", runChangesHeader(changes), () => renderChangesBody(changes)),
|
||||
);
|
||||
}
|
||||
|
||||
// Input and Output are sections of the summary now, not tabs.
|
||||
wrap.append(
|
||||
renderCollapsible("summary-input", "Input", () =>
|
||||
renderRunFieldBody(d.input, "input", EMPTY_INPUT_MESSAGE),
|
||||
),
|
||||
);
|
||||
wrap.append(
|
||||
renderCollapsible("summary-output", "Output", () =>
|
||||
renderRunFieldBody(d.output, "output", EMPTY_OUTPUT_MESSAGE),
|
||||
),
|
||||
);
|
||||
|
||||
// Everything the system wrote for each visit, behind one explicit door.
|
||||
wrap.append(renderRunAuditSection(d));
|
||||
return wrap;
|
||||
}
|
||||
|
||||
@@ -337,7 +459,12 @@ function renderStageField(field) {
|
||||
|
||||
/** One collapsible input/output field section (expanded body is a code block). */
|
||||
function renderRunFieldTab(map, keyPrefix, emptyMessage) {
|
||||
const wrap = h("div", { class: "run-tab-body" });
|
||||
return h("div", { class: "run-tab-body" }, renderRunFieldBody(map, keyPrefix, emptyMessage));
|
||||
}
|
||||
|
||||
/** The input/output body itself, shared by the old tab and the summary sections. */
|
||||
function renderRunFieldBody(map, keyPrefix, emptyMessage) {
|
||||
const wrap = h("div", { class: "run-field-body" });
|
||||
const sections = fieldSections(map, keyPrefix);
|
||||
if (!sections.length) {
|
||||
wrap.append(h("div", { class: "run-empty muted", text: emptyMessage }));
|
||||
@@ -363,10 +490,11 @@ function renderRunFieldTab(map, keyPrefix, emptyMessage) {
|
||||
* One collapsible section of the run detail's field/summary body. Expanded state
|
||||
* is keyed in `state.runSections`, so the operator's choices survive a re-render.
|
||||
*/
|
||||
function renderCollapsible(key, title, bodyFn) {
|
||||
function renderCollapsible(key, title, bodyFn, { actions = null } = {}) {
|
||||
const expanded = state.runSections.has(key);
|
||||
const wrap = h("div", { class: "collapsible" });
|
||||
wrap.append(
|
||||
const head = h("div", { class: "section-row" });
|
||||
head.append(
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
@@ -384,6 +512,8 @@ function renderCollapsible(key, title, bodyFn) {
|
||||
h("span", { class: "section-title", text: title }),
|
||||
),
|
||||
);
|
||||
if (actions) head.append(actions);
|
||||
wrap.append(head);
|
||||
if (expanded) wrap.append(h("div", { class: "section-body" }, bodyFn()));
|
||||
return wrap;
|
||||
}
|
||||
@@ -520,7 +650,7 @@ function renderStagePane(d) {
|
||||
const visitIndex = clampVisitIndex(state.runStagePane.visitIndex, runSteps.length);
|
||||
const step = runSteps[visitIndex] ?? null;
|
||||
const graph = d.graph ?? { stages: [] };
|
||||
const specs = stageSectionSpecs(stageKey, graph, runSteps, visitIndex, true);
|
||||
const specs = stageSectionSpecs(stageKey, graph, runSteps, visitIndex, true, d.steps ?? []);
|
||||
const fields = step ? runStepFields(step) : [];
|
||||
const headline = headlineFields(fields);
|
||||
|
||||
@@ -560,7 +690,22 @@ function renderStagePane(d) {
|
||||
if (headline.length === 0 && specs.length === 0) {
|
||||
body.append(h("div", { class: "run-empty muted", text: NO_STAGE_DETAILS_MESSAGE }));
|
||||
}
|
||||
for (const spec of specs) body.append(renderStageSection(spec, step));
|
||||
for (const spec of specs) body.append(renderStageSection(spec, step, d.steps ?? []));
|
||||
if (step) {
|
||||
body.append(
|
||||
h(
|
||||
"div",
|
||||
{ class: "stage-pane-audit" },
|
||||
h("button", {
|
||||
class: "ghost audit-open",
|
||||
type: "button",
|
||||
text: "Audit & debug",
|
||||
title: "Input, output, memory, session and definition",
|
||||
onclick: () => openAuditFor(d, step, stageKey, visitIndex),
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
overlay.append(h("div", { class: "stage-pane-sheet" }, bar, body));
|
||||
modal.stage("stage-pane", overlay, {
|
||||
onClose: () => closeStagePane(),
|
||||
@@ -583,7 +728,7 @@ function renderStagePane(d) {
|
||||
}
|
||||
|
||||
/** One stage-pane section, using the pane's own expansion state. */
|
||||
function renderStageSection(spec, step) {
|
||||
function renderStageSection(spec, step, allSteps = null) {
|
||||
const expanded = state.runStageSections.has(spec.key);
|
||||
const wrap = h("div", { class: "collapsible stage-section" });
|
||||
wrap.append(
|
||||
@@ -606,9 +751,9 @@ function renderStageSection(spec, step) {
|
||||
);
|
||||
if (!expanded) return wrap;
|
||||
const body = h("div", { class: "section-body" });
|
||||
if (spec.artifacts && step) body.append(renderVisitArtifacts(step));
|
||||
else if (spec.session && step) body.append(renderSessionExport(step));
|
||||
else for (const field of spec.fields) body.append(renderStageField(field));
|
||||
if (spec.artifacts && step) body.append(renderVisitArtifacts(step, allSteps));
|
||||
else if (spec.changes && step) body.append(renderChangesBody(runChanges([step])));
|
||||
else for (const field of spec.fields ?? []) body.append(renderStageField(field));
|
||||
wrap.append(body);
|
||||
return wrap;
|
||||
}
|
||||
@@ -857,13 +1002,48 @@ function artifactsResolvable() {
|
||||
* run with no artifacts shows the header (which already says why) and nothing
|
||||
* else, so the section is never blank.
|
||||
*/
|
||||
/** The gallery/list switch in the artifacts section header. */
|
||||
function artifactViewToggle() {
|
||||
const group = h("div", {
|
||||
class: "view-toggle",
|
||||
role: "group",
|
||||
"aria-label": "Artifact view",
|
||||
});
|
||||
for (const [key, label] of [
|
||||
["gallery", "Gallery"],
|
||||
["list", "List"],
|
||||
]) {
|
||||
group.append(
|
||||
h("button", {
|
||||
class: `view-toggle-button${state.artifactView === key ? " active" : ""}`,
|
||||
type: "button",
|
||||
"aria-pressed": state.artifactView === key ? "true" : "false",
|
||||
text: label,
|
||||
onclick: () => {
|
||||
state.artifactView = key;
|
||||
writeArtifactView(key);
|
||||
renderContent();
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
return group;
|
||||
}
|
||||
|
||||
function renderArtifactGallery(steps) {
|
||||
const wrap = h("div", { class: "artifact-gallery" });
|
||||
const groups = artifactGroups(steps);
|
||||
if (!groups.length) return wrap;
|
||||
if (!groups.length) {
|
||||
wrap.append(h("div", { class: "muted artifact-hint", text: "No stage artifacts recorded." }));
|
||||
return wrap;
|
||||
}
|
||||
if (!artifactsResolvable()) {
|
||||
wrap.append(h("div", { class: "muted artifact-hint", text: ARTIFACT_SERVER_HINT }));
|
||||
}
|
||||
if (state.artifactView === "list") {
|
||||
wrap.append(renderArtifactList(groups));
|
||||
return wrap;
|
||||
}
|
||||
const viewable = pagedArtifacts(groups);
|
||||
const viewerIndexOf = viewerIndexByUrl(groups);
|
||||
for (const group of groups) {
|
||||
@@ -875,6 +1055,48 @@ function renderArtifactGallery(steps) {
|
||||
return wrap;
|
||||
}
|
||||
|
||||
/** The list form of the run's artifacts: one full-name row per file. */
|
||||
function renderArtifactList(groups) {
|
||||
const list = h("div", { class: "artifact-list" });
|
||||
const viewable = pagedArtifacts(groups);
|
||||
const viewerIndexOf = viewerIndexByUrl(groups);
|
||||
for (const group of groups) {
|
||||
list.append(
|
||||
h("div", { class: "artifact-group-head", text: `${group.stageKey} · visit ${group.visit}` }),
|
||||
);
|
||||
for (const artifact of group.artifacts) {
|
||||
list.append(renderArtifactListRow(artifact, viewable, viewerIndexOf));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/** One artifact list row: kind, full name, size, and hover-only actions. */
|
||||
function renderArtifactListRow(artifact, viewable, viewerIndexOf) {
|
||||
const resolved = resolvedArtifactUrl(artifact, state.url);
|
||||
const kind = artifactKind(artifact.content_type, artifact.name);
|
||||
const media = kind === ArtifactKind.Image || kind === ArtifactKind.Video;
|
||||
const opensViewer = isViewerArtifact(artifact.content_type, artifact.name);
|
||||
const name = artifact.name || "(unnamed artifact)";
|
||||
const wrap = h("div", { class: "artifact-list-row" });
|
||||
const open = h("button", {
|
||||
class: "artifact-list-open",
|
||||
type: "button",
|
||||
"aria-label": `Open ${name}`,
|
||||
title: name,
|
||||
});
|
||||
open.append(h("span", { class: "artifact-kind", text: artifactKindLabel(kind) }));
|
||||
open.append(h("span", { class: "artifact-list-name", text: name }));
|
||||
open.append(h("span", { class: "artifact-size", text: humanBytes(artifact.size_bytes) }));
|
||||
open.addEventListener("click", () => {
|
||||
const at = viewerIndexOf.get(artifact.url);
|
||||
if (opensViewer && at != null) openArtifactViewer(viewable, at, open);
|
||||
else if (resolved) window.open(resolved, "_blank", "noopener,noreferrer");
|
||||
});
|
||||
wrap.append(open, renderTileActions(resolved, media));
|
||||
return wrap;
|
||||
}
|
||||
|
||||
/**
|
||||
* The per-visit artifacts section shown inside one step: the summary line, the
|
||||
* capture notes, the no-server-URL hint and a headerless grid of that visit's
|
||||
@@ -882,12 +1104,14 @@ function renderArtifactGallery(steps) {
|
||||
* that visit's viewable artifacts (media and markdown), exactly as the Android
|
||||
* section does.
|
||||
*/
|
||||
function renderVisitArtifacts(step) {
|
||||
function renderVisitArtifacts(step, allSteps = null) {
|
||||
const wrap = h("div", { class: "artifacts" });
|
||||
const artifacts = presentedArtifacts(step);
|
||||
const artifacts = visitArtifacts(step, allSteps ?? [step]);
|
||||
// The section title already carries the count, so the body repeats it only when
|
||||
// there is nothing to show and the reason itself is the useful part.
|
||||
if (artifacts.length === 0) wrap.append(h("div", { class: "artifacts-summary", text: artifactsSummary(step) }));
|
||||
if (artifacts.length === 0) {
|
||||
wrap.append(h("div", { class: "artifacts-summary", text: artifactsSummary(step, 0) }));
|
||||
}
|
||||
for (const note of artifactCaptureNotes(step)) {
|
||||
wrap.append(h("div", { class: "artifacts-note muted", text: note }));
|
||||
}
|
||||
@@ -934,6 +1158,7 @@ function renderArtifactTile(artifact, viewable, viewerIndexOf) {
|
||||
"data-artifact-name": artifact.name ?? "",
|
||||
"data-artifact-kind": kind,
|
||||
"data-artifact-url": artifact.url ?? "",
|
||||
title: name,
|
||||
});
|
||||
const openViewer = () => {
|
||||
const at = viewerIndexOf.get(artifact.url);
|
||||
@@ -973,7 +1198,7 @@ function renderArtifactTile(artifact, viewable, viewerIndexOf) {
|
||||
return wrap;
|
||||
}
|
||||
|
||||
/** The compact per-tile actions: copy-link (non-media tiles) and share. */
|
||||
/** The compact per-tile actions: icon-only link/share, shown on hover or focus. */
|
||||
function renderTileActions(resolved, media) {
|
||||
const actions = h("div", { class: "artifact-actions" });
|
||||
const stop = (fn) => (event) => {
|
||||
@@ -982,27 +1207,45 @@ function renderTileActions(resolved, media) {
|
||||
};
|
||||
if (!media) {
|
||||
actions.append(
|
||||
h("button", {
|
||||
class: "artifact-action",
|
||||
type: "button",
|
||||
text: "Copy link",
|
||||
disabled: !resolved || !canCopyLink(),
|
||||
onclick: stop(() => copyArtifactLink(resolved)),
|
||||
}),
|
||||
artifactAction("link", "Copy link", !resolved || !canCopyLink(), stop(() => copyArtifactLink(resolved))),
|
||||
);
|
||||
}
|
||||
actions.append(
|
||||
h("button", {
|
||||
class: "artifact-action",
|
||||
type: "button",
|
||||
text: "Share",
|
||||
disabled: !resolved || !canShare(),
|
||||
onclick: stop(() => shareArtifact(resolved)),
|
||||
}),
|
||||
artifactAction("share", "Share", !resolved || !canShare(), stop(() => shareArtifact(resolved))),
|
||||
);
|
||||
return actions;
|
||||
}
|
||||
|
||||
const ARTIFACT_SVG_NS = "http://www.w3.org/2000/svg";
|
||||
|
||||
/** One icon-only artifact action (24px target, accessible name, hover-visible). */
|
||||
function artifactAction(kind, label, disabled, onclick) {
|
||||
const button = h("button", {
|
||||
class: "artifact-action",
|
||||
type: "button",
|
||||
"aria-label": label,
|
||||
title: label,
|
||||
disabled,
|
||||
onclick,
|
||||
});
|
||||
const svg = document.createElementNS(ARTIFACT_SVG_NS, "svg");
|
||||
svg.setAttribute("viewBox", "0 0 24 24");
|
||||
svg.setAttribute("aria-hidden", "true");
|
||||
svg.setAttribute("focusable", "false");
|
||||
const path = document.createElementNS(ARTIFACT_SVG_NS, "path");
|
||||
path.setAttribute("d", kind === "link"
|
||||
? "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"
|
||||
: "M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8M16 6l-4-4-4 4M12 2v13");
|
||||
path.setAttribute("fill", "none");
|
||||
path.setAttribute("stroke", "currentColor");
|
||||
path.setAttribute("stroke-width", "2");
|
||||
path.setAttribute("stroke-linecap", "round");
|
||||
path.setAttribute("stroke-linejoin", "round");
|
||||
svg.append(path);
|
||||
button.append(svg);
|
||||
return button;
|
||||
}
|
||||
|
||||
/**
|
||||
* The step's session export: a link opening the read-only session.html in a new
|
||||
* tab, or the plain notice when the visit exported nothing (parity R9).
|
||||
|
||||
+7
-13
@@ -2,7 +2,7 @@
|
||||
// menus. The pure filtering, sorting and formatting live in runs.js; this module
|
||||
// owns the DOM and the page's run-list state.
|
||||
|
||||
import { h, renderLiveBadge } from "../dom.js";
|
||||
import { h } from "../dom.js";
|
||||
import {
|
||||
RUN_STATES,
|
||||
RUN_TIME_RANGES,
|
||||
@@ -23,7 +23,6 @@ import {
|
||||
DEFAULT_RUN_SORT,
|
||||
defaultRunFilters,
|
||||
} from "../runs.js";
|
||||
import { liveBadgeState } from "../connection.js";
|
||||
|
||||
export function createRunsView(rt) {
|
||||
const { state } = rt;
|
||||
@@ -128,19 +127,15 @@ function renderRunRow(run, now) {
|
||||
const head = h("span", { class: "run-row-head" });
|
||||
head.append(h("span", { class: `chip chip-${status}`, text: status }));
|
||||
if (run.executing) head.append(h("span", { class: "spinner", "aria-hidden": "true" }));
|
||||
head.append(h("span", { class: "run-row-title", text: identity.label }));
|
||||
if (identity.pipeline == null) head.append(versionChip(run.version));
|
||||
// The pipeline is the list's anchor: it names what ran, before the task title.
|
||||
head.append(
|
||||
h("span", { class: "run-row-pipeline-name", text: identity.pipeline ?? identity.label }),
|
||||
);
|
||||
head.append(versionChip(run.version));
|
||||
row.append(head);
|
||||
|
||||
if (identity.pipeline != null) {
|
||||
row.append(
|
||||
h(
|
||||
"span",
|
||||
{ class: "run-row-pipeline" },
|
||||
h("span", { class: "run-row-pipeline-name", text: identity.pipeline }),
|
||||
versionChip(run.version),
|
||||
),
|
||||
);
|
||||
row.append(h("span", { class: "run-row-title", text: identity.label }));
|
||||
}
|
||||
|
||||
row.append(h("span", { class: "run-row-progress", text: progressText(run) }));
|
||||
@@ -199,7 +194,6 @@ function renderRunToolbar() {
|
||||
state.openMenu === "sort" ? renderSortMenu() : null,
|
||||
),
|
||||
h("span", { class: "spacer" }),
|
||||
renderLiveBadge(liveBadgeState(state.runStream)),
|
||||
);
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
@@ -592,7 +592,13 @@ async function routeSearchResult(hit) {
|
||||
await selectRun(target.runId);
|
||||
if (!state.runDetail) return;
|
||||
const resolved = resolveRunTarget(target, target.runId, state.runDetail.steps ?? []);
|
||||
if (resolved.tab) {
|
||||
if (resolved.tab === "input" || resolved.tab === "output") {
|
||||
// Input and Output are run Summary sections now, so a field hit opens the
|
||||
// Summary with the matching section expanded rather than a dead tab.
|
||||
state.runTab = "summary";
|
||||
state.runSections = new Set([...state.runSections, `summary-${resolved.tab}`]);
|
||||
renderContent();
|
||||
} else if (resolved.tab) {
|
||||
state.runTab = resolved.tab;
|
||||
renderContent();
|
||||
} else if (resolved.stageKey != null) {
|
||||
|
||||
@@ -7,6 +7,10 @@ import assert from "node:assert/strict";
|
||||
|
||||
import {
|
||||
ArtifactKind,
|
||||
isSystemArtifact,
|
||||
stageArtifacts,
|
||||
systemArtifacts,
|
||||
visitArtifacts,
|
||||
ARTIFACT_CAPTURE_PENDING,
|
||||
LEGACY_SESSION_MARKDOWN_ARTIFACT,
|
||||
artifactCaptureNotes,
|
||||
@@ -43,6 +47,29 @@ function step(stage, sequence, { visit = 1, status = "completed", artifacts, ski
|
||||
return s;
|
||||
}
|
||||
|
||||
test("the turn's own files are system evidence, not stage artifacts", () => {
|
||||
const step = {
|
||||
artifacts: [
|
||||
{ name: "input.md", url: "/1" },
|
||||
{ name: "memory.md", url: "/2" },
|
||||
{ name: "output.md", url: "/3" },
|
||||
{ name: "session.html", url: "/4" },
|
||||
{ name: "public/notes.md", url: "/5" },
|
||||
{ name: "screenshot.png", url: "/6" },
|
||||
],
|
||||
};
|
||||
assert.deepEqual(
|
||||
stageArtifacts(step).map((artifact) => artifact.name),
|
||||
["public/notes.md", "screenshot.png"],
|
||||
);
|
||||
assert.deepEqual(
|
||||
systemArtifacts(step).map((artifact) => artifact.name),
|
||||
["input.md", "memory.md", "output.md", "session.html"],
|
||||
);
|
||||
assert.equal(isSystemArtifact({ name: "output.md" }), true);
|
||||
assert.equal(isSystemArtifact({ name: "public/input.md" }), false);
|
||||
});
|
||||
|
||||
test("presentedArtifacts hides the retired session.md and keeps everything else", () => {
|
||||
const artifacts = [art("shot.png"), art(LEGACY_SESSION_MARKDOWN_ARTIFACT), art("session.html")];
|
||||
const presented = presentedArtifacts({ artifacts });
|
||||
@@ -92,6 +119,24 @@ test("duplicate names are kept, not deduped", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
test("a shared public file is attributed to the visit that first recorded it", () => {
|
||||
const steps = [
|
||||
{ sequence: 1, stage: "a", artifacts: [{ name: "input.md" }, { name: "public/a.txt" }] },
|
||||
{
|
||||
sequence: 2,
|
||||
stage: "b",
|
||||
artifacts: [{ name: "output.md" }, { name: "public/a.txt" }, { name: "public/b.txt" }],
|
||||
},
|
||||
];
|
||||
const groups = artifactGroups(steps);
|
||||
assert.deepEqual(groups.map((g) => g.artifacts.map((a) => a.name)), [["public/a.txt"], ["public/b.txt"]]);
|
||||
assert.equal(
|
||||
visitArtifacts(steps[1], steps).map((a) => a.name).join(","),
|
||||
"public/b.txt",
|
||||
);
|
||||
assert.equal(artifactsHeader(steps, false), "Artifacts · 2 recorded");
|
||||
});
|
||||
|
||||
test("empty/null artifact visits and an empty run produce no group", () => {
|
||||
assert.deepEqual(artifactGroups([]), []);
|
||||
assert.deepEqual(artifactGroups(undefined), []);
|
||||
|
||||
@@ -506,7 +506,7 @@ test("sessionActivity and its badge word follow streaming, unseen then open", ()
|
||||
assert.equal(sessionActivityBadge("streaming", false), "Streaming");
|
||||
assert.equal(sessionActivityBadge("new", false), "New");
|
||||
assert.equal(sessionActivityBadge("idle", true), "Open");
|
||||
assert.equal(sessionActivityBadge("idle", false), null);
|
||||
assert.equal(sessionActivityBadge("idle", false), "Idle");
|
||||
});
|
||||
|
||||
test("sessionStatusLabel reads Closed first, then Running or Idle", () => {
|
||||
@@ -1937,5 +1937,5 @@ test("the C13 wording matches the Android sources verbatim", () => {
|
||||
assert.equal(sessionActivityBadge(sessionActivity(true, true), true), "Streaming");
|
||||
assert.equal(sessionActivityBadge(sessionActivity(false, true), true), "New");
|
||||
assert.equal(sessionActivityBadge(sessionActivity(false, false), true), "Open");
|
||||
assert.equal(sessionActivityBadge(sessionActivity(false, false), false), null);
|
||||
assert.equal(sessionActivityBadge(sessionActivity(false, false), false), "Idle");
|
||||
});
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
// Starred chats are a local preference: a set of session ids, always at the top.
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { CHAT_STARS_KEY, readChatStars, writeChatStars } from "../src/chatStars.js";
|
||||
|
||||
function fakeStorage(initial = {}) {
|
||||
const values = new Map(Object.entries(initial));
|
||||
return {
|
||||
getItem: (key) => (values.has(key) ? values.get(key) : null),
|
||||
setItem: (key, value) => values.set(key, String(value)),
|
||||
values,
|
||||
};
|
||||
}
|
||||
|
||||
test("no stored stars is an empty set", () => {
|
||||
assert.equal(readChatStars(fakeStorage()).size, 0);
|
||||
});
|
||||
|
||||
test("stars survive a write and read", () => {
|
||||
const storage = fakeStorage();
|
||||
writeChatStars(new Set(["ses_a", "ses_b"]), storage);
|
||||
assert.deepEqual([...readChatStars(storage)].sort(), ["ses_a", "ses_b"]);
|
||||
assert.ok(storage.values.get(CHAT_STARS_KEY).includes("ses_a"));
|
||||
});
|
||||
|
||||
test("malformed or non-string entries are ignored", () => {
|
||||
assert.equal(readChatStars(fakeStorage({ [CHAT_STARS_KEY]: "{oops" })).size, 0);
|
||||
const stars = readChatStars(fakeStorage({ [CHAT_STARS_KEY]: JSON.stringify(["a", 3, "", null]) }));
|
||||
assert.deepEqual([...stars], ["a"]);
|
||||
});
|
||||
|
||||
test("storage failures never break the list", () => {
|
||||
const broken = { getItem() { throw new Error("denied"); }, setItem() { throw new Error("denied"); } };
|
||||
assert.equal(readChatStars(broken).size, 0);
|
||||
assert.doesNotThrow(() => writeChatStars(new Set(["a"]), broken));
|
||||
});
|
||||
+18
-21
@@ -81,10 +81,11 @@ test("RUN_DETAIL_TABS is the Android order, Summary first, Timeline keyed 'steps
|
||||
RUN_DETAIL_TABS.map((tab) => tab.label),
|
||||
["Summary", "Graph", "Input", "Output", "Timeline"],
|
||||
);
|
||||
// The Graph body (R5) now renders too, so every tab is present.
|
||||
// The browser keeps the three surfaces that are genuinely views; Input and
|
||||
// Output are run Summary sections now.
|
||||
assert.deepEqual(
|
||||
RENDERED_RUN_TABS.map((tab) => tab.label),
|
||||
["Summary", "Graph", "Input", "Output", "Timeline"],
|
||||
["Summary", "Graph", "Timeline"],
|
||||
);
|
||||
});
|
||||
|
||||
@@ -425,30 +426,27 @@ test("headline and evidence split the visit's facts without duplication", () =>
|
||||
assert.ok(!evidence.includes("Input") && !evidence.includes("Output"));
|
||||
});
|
||||
|
||||
test("stageSectionSpecs orders the run sections and puts the definition last", () => {
|
||||
const graph = {
|
||||
stages: [{ key: "implementer", type: "model", prompt: "do", output: "done", edges: { success: "reviewer" } }],
|
||||
};
|
||||
test("the stage pane shows the stage's artifacts and this visit's changes", () => {
|
||||
const graph = { stages: [{ key: "implementer", type: "model" }] };
|
||||
const step1 = step({
|
||||
stage: "implementer",
|
||||
input: { prompt: "do it" },
|
||||
output: { result: "done" },
|
||||
diagnostic: "why",
|
||||
file_changes: {
|
||||
status: "complete",
|
||||
files: [{ path: "a.go", kind: "modified", patch: "@@ -1 +1 @@\n-old\n+new\n" }],
|
||||
},
|
||||
});
|
||||
const specs = stageSectionSpecs("implementer", graph, [step1], 0, true);
|
||||
assert.deepEqual(specs.map((spec) => spec.key), ["artifacts", "output", "input", "run", "definition"]);
|
||||
assert.deepEqual(specs.map((spec) => spec.title), [
|
||||
"Artifacts · 0 recorded",
|
||||
"Output",
|
||||
"Input",
|
||||
"This run",
|
||||
"Stage definition",
|
||||
]);
|
||||
assert.deepEqual(specs.map((spec) => spec.key), ["artifacts", "changes"]);
|
||||
assert.equal(specs[0].title, "Artifacts · 0 recorded");
|
||||
assert.equal(specs[0].artifacts, true);
|
||||
assert.ok(specs.find((spec) => spec.key === "definition").fields.length > 0);
|
||||
assert.ok(specs[1].title.includes("1 file changed"), specs[1].title);
|
||||
assert.equal(specs[1].changes, true);
|
||||
});
|
||||
|
||||
test("a session export inserts the Session section after Artifacts", () => {
|
||||
test("the session export and definition stay out of the pane sections", () => {
|
||||
const graph = { stages: [{ key: "reviewer", type: "model" }] };
|
||||
const withSession = step({
|
||||
stage: "reviewer",
|
||||
@@ -456,15 +454,14 @@ test("a session export inserts the Session section after Artifacts", () => {
|
||||
artifacts: [{ name: "session.html", url: "/a" }],
|
||||
});
|
||||
const specs = stageSectionSpecs("reviewer", graph, [withSession], 0, true);
|
||||
assert.deepEqual(specs.map((spec) => spec.key), ["artifacts", "session", "definition"]);
|
||||
assert.equal(specs[1].session, true);
|
||||
assert.deepEqual(specs.map((spec) => spec.key), ["artifacts"]);
|
||||
assert.ok(!specs.some((spec) => spec.session || spec.key === "definition"));
|
||||
});
|
||||
|
||||
test("a visit with no results still lists the artifacts gallery and the definition", () => {
|
||||
test("a visit with no results still lists the artifacts section and no changes", () => {
|
||||
const graph = { stages: [{ key: "s", type: "model" }] };
|
||||
const specs = stageSectionSpecs("s", graph, [step({ stage: "s" })], 0, true);
|
||||
assert.deepEqual(specs.map((spec) => spec.key), ["artifacts", "definition"]);
|
||||
assert.ok(specs.every((spec) => spec.artifacts || spec.fields.length > 0));
|
||||
assert.deepEqual(specs.map((spec) => spec.key), ["artifacts"]);
|
||||
});
|
||||
|
||||
test("stageDefinitionFields labels outcomes with resolved terminals", () => {
|
||||
|
||||
+173
-181
@@ -434,12 +434,12 @@ async function runShellChecks() {
|
||||
throw new Error(`activating a run row left focus on ${rowFocus || "body"}, not the detail h1`);
|
||||
}
|
||||
const runSections = state.tablists.find((list) => list.label === "Run sections");
|
||||
if (!runSections || runSections.tabs.length !== 5) {
|
||||
if (!runSections || runSections.tabs.length !== 3) {
|
||||
throw new Error(`wide run detail: section rail ${JSON.stringify(runSections)}`);
|
||||
}
|
||||
// On a wide screen the sections are the detail's own tab row (the rail keeps
|
||||
// only destinations): exactly one visible "Run sections" tablist, the strip.
|
||||
if (!state.strip || state.strip.tabs.length !== 5) {
|
||||
if (!state.strip || state.strip.tabs.length !== 3) {
|
||||
throw new Error(`wide run detail: the section tab row is not visible ${JSON.stringify(state.strip)}`);
|
||||
}
|
||||
const sectionLists = state.tablists.filter((list) => list.label === "Run sections");
|
||||
@@ -463,7 +463,7 @@ async function runShellChecks() {
|
||||
}
|
||||
await clickDetailTab("Summary");
|
||||
await shot("81-shell-wide-run-detail-1440x900.png");
|
||||
console.log(` wide run detail: 5 section tabs; ArrowRight "${sectionMoved}" -> "${sectionAfter.selected}"`);
|
||||
console.log(` wide run detail: 3 section tabs; ArrowRight "${sectionMoved}" -> "${sectionAfter.selected}"`);
|
||||
await page.evaluate(`document.querySelector(".pane-back button")?.click()`);
|
||||
await settle(200);
|
||||
const restoredRunRow = await page.evaluate(`document.activeElement?.getAttribute("data-run-id") ?? ""`);
|
||||
@@ -636,7 +636,7 @@ async function runShellChecks() {
|
||||
if (state.strip.bottom > state.dock.top + 1 || state.dock.top - state.strip.bottom > 2) {
|
||||
throw new Error(`narrow run detail: strip bottom ${state.strip.bottom} is not directly above the bar top ${state.dock.top}`);
|
||||
}
|
||||
if (state.strip.tabs.length !== 5) throw new Error(`narrow run detail: strip tabs ${state.strip.tabs}`);
|
||||
if (state.strip.tabs.length !== 3) throw new Error(`narrow run detail: strip tabs ${state.strip.tabs}`);
|
||||
const stripMoved = await page.evaluate(`(() => {
|
||||
const active = [...document.querySelectorAll(".strip-tab")].find((tab) => tab.getAttribute("aria-selected") === "true");
|
||||
active.focus();
|
||||
@@ -1232,12 +1232,32 @@ async function runDecisionChecks() {
|
||||
}
|
||||
|
||||
|
||||
/** Expand the CLOSED chats group so a just-closed row is in the DOM to inspect. */
|
||||
async function expandClosedChats() {
|
||||
await page.evaluate(`(() => {
|
||||
const toggle = document.querySelector(".chat-group-toggle");
|
||||
if (toggle && toggle.getAttribute("aria-expanded") !== "true") toggle.click();
|
||||
return !!toggle;
|
||||
})()`);
|
||||
await new Promise((resolve) => setTimeout(resolve, 250));
|
||||
}
|
||||
|
||||
// Open one chat row's Chat actions menu (the row's management items live behind
|
||||
// it since C13: Rename… / Close chat… or Reopen / Hide on this device).
|
||||
async function openChatRowMenu(sessionId) {
|
||||
// A closed session lives in the collapsed CLOSED group; reveal it first.
|
||||
const present = await page.evaluate(
|
||||
`!!document.querySelector('#chatRows .chat-row[data-session="${sessionId}"]')`,
|
||||
);
|
||||
if (!present) await expandClosedChats();
|
||||
// The row can be re-rendered by a just-finished create/refresh right under the
|
||||
// click, which closes the menu again; retry once before failing.
|
||||
for (let attempt = 0; attempt < 2; attempt += 1) {
|
||||
// The actions cluster is revealed by hover or focus (it occupies no column);
|
||||
// focus the button first so a synthetic click cannot land on a hidden one.
|
||||
await page.evaluate(
|
||||
`document.querySelector('#chatRows .chat-row[data-session="${sessionId}"] .chat-menu-button')?.focus()`,
|
||||
);
|
||||
await page.click(`#chatRows .chat-row[data-session="${sessionId}"] .chat-menu-button`);
|
||||
const opened = await eventually(
|
||||
() =>
|
||||
@@ -1735,8 +1755,12 @@ function viewerFixtureRun() {
|
||||
control: { visit: 1, max_visits: 1 },
|
||||
started_at: "2026-10-19T20:00:00Z",
|
||||
finished_at: "2026-10-19T20:01:00Z",
|
||||
input: { prompt: "Render the stage turn." },
|
||||
output: { result: "ready" },
|
||||
input: {
|
||||
markdown: "# Turn input\n\nPlan the next small change.\n\n```sh\ngo test ./...\n```\n",
|
||||
},
|
||||
output: {
|
||||
markdown: "# Output\n\nThe change is ready for review.\n\n- viewer renders markdown\n- keyboard paging works\n",
|
||||
},
|
||||
artifacts: [
|
||||
fixture("input.md", "text/markdown; charset=utf-8", "/test/fixtures/artifacts/input.md"),
|
||||
fixture("shot.png", "image/png", "/test/fixtures/artifacts/shot.png"),
|
||||
@@ -1784,134 +1808,107 @@ async function runMarkdownViewerChecks() {
|
||||
{ timeout: 20000, what: "the markdown fixture run detail to load" },
|
||||
);
|
||||
|
||||
step("R8: the run gallery shows input.md, memory.md and output.md as Documents");
|
||||
step("R8: the galleries show the stage's artifacts, not the turn's system files");
|
||||
await page.clickText(".run-detail .section-toggle", "Artifacts");
|
||||
await page.waitForSelector('.run-detail .artifact-gallery .artifact-tile[data-artifact-name="input.md"]', {
|
||||
await page.waitForSelector('.run-detail .artifact-gallery .artifact-tile[data-artifact-name="shot.png"]', {
|
||||
timeout: 15000,
|
||||
});
|
||||
const runTiles = await viewerTiles(".run-detail .artifact-gallery");
|
||||
for (const name of ["input.md", "memory.md", "output.md"]) {
|
||||
const tile = runTiles.find((entry) => entry.name === name);
|
||||
if (!tile) throw new Error(`the run gallery is missing ${name}: ${JSON.stringify(runTiles)}`);
|
||||
if (tile.kind !== "Document" || tile.label !== "Document" || !tile.glyph) {
|
||||
throw new Error(`${name} is not presented as a Document: ${JSON.stringify(tile)}`);
|
||||
}
|
||||
const runNames = runTiles.map((tile) => tile.name);
|
||||
for (const system of ["input.md", "memory.md", "output.md", "session.html"]) {
|
||||
if (runNames.includes(system)) throw new Error(`the run gallery still shows ${system}`);
|
||||
}
|
||||
const runImage = runTiles.find((entry) => entry.name === "shot.png");
|
||||
const runImage = runTiles.find((tile) => tile.name === "shot.png");
|
||||
if (!runImage || runImage.kind !== "Image" || runImage.glyph) {
|
||||
throw new Error(`shot.png is not presented as media: ${JSON.stringify(runImage)}`);
|
||||
}
|
||||
console.log(` run gallery: ${runTiles.map((tile) => `${tile.name} (${tile.label})`).join(", ")}`);
|
||||
console.log(` run gallery: ${runNames.join(", ")} (no turn files)`);
|
||||
await shot("44-viewer-turn-documents.png");
|
||||
|
||||
step("R8: the per-visit gallery presents the same turn documents");
|
||||
step("R8: the stage audit carries the turn files; Input renders markdown");
|
||||
await clickDetailTab("Timeline");
|
||||
await page.click('.detail .timeline-row[data-stage-key="implementer"]');
|
||||
await page.waitForSelector(".stage-pane", { timeout: 15000 });
|
||||
await page.clickText(".stage-pane .section-toggle", "Artifacts");
|
||||
await page.waitForSelector('.stage-pane .artifact-tile[data-artifact-name="input.md"]', { timeout: 15000 });
|
||||
await page.waitForSelector('.stage-pane .artifact-tile[data-artifact-name="shot.png"]', { timeout: 15000 });
|
||||
const visitTiles = await viewerTiles(".stage-pane");
|
||||
for (const name of ["input.md", "memory.md", "output.md"]) {
|
||||
const tile = visitTiles.find((entry) => entry.name === name);
|
||||
if (!tile || tile.kind !== "Document" || tile.label !== "Document" || !tile.glyph) {
|
||||
throw new Error(`the visit gallery does not present ${name} as a Document: ${JSON.stringify(tile)}`);
|
||||
for (const system of ["input.md", "memory.md", "output.md"]) {
|
||||
if (visitTiles.some((tile) => tile.name === system)) {
|
||||
throw new Error(`the visit gallery still shows ${system}: ${JSON.stringify(visitTiles)}`);
|
||||
}
|
||||
}
|
||||
console.log(` visit gallery: ${visitTiles.map((tile) => tile.name).join(", ")}`);
|
||||
|
||||
step("R8: opening input.md renders the fetched markdown in the viewer");
|
||||
await page.click('.stage-pane .artifact-tile[data-artifact-name="input.md"]');
|
||||
await page.waitForSelector(".artifact-viewer .viewer-panel", { timeout: 15000 });
|
||||
await page.waitForSelector(".viewer-markdown h3.md-heading", { timeout: 15000 });
|
||||
const rendered = await page.evaluate(`(() => {
|
||||
const viewer = document.querySelector(".artifact-viewer");
|
||||
const heading = viewer?.querySelector(".viewer-markdown h3.md-heading");
|
||||
const code = viewer?.querySelector(".viewer-markdown .md-code-block pre code");
|
||||
const fetched = performance.getEntriesByType("resource").map((entry) => entry.name)
|
||||
.filter((name) => name.endsWith("/test/fixtures/artifacts/input.md"));
|
||||
await page.click(".stage-pane .audit-open");
|
||||
await page.waitForSelector(".audit-viewer", { timeout: 15000 });
|
||||
await page.click('.audit-tab[data-audit-tab="input"]');
|
||||
await page.waitForSelector(".audit-body .field-markdown h3.md-heading", { timeout: 15000 });
|
||||
const auditInput = await page.evaluate(`(() => {
|
||||
const body = document.querySelector(".audit-body");
|
||||
return {
|
||||
heading: heading?.textContent ?? "",
|
||||
code: code?.textContent ?? "",
|
||||
fetched: fetched.length,
|
||||
position: viewer?.querySelector(".viewer-position")?.textContent ?? "",
|
||||
title: viewer?.querySelector(".viewer-title")?.textContent ?? "",
|
||||
prevDisabled: viewer?.querySelector('.viewer-page[data-viewer-focus="prev"]')?.disabled ?? null,
|
||||
nextDisabled: viewer?.querySelector('.viewer-page[data-viewer-focus="next"]')?.disabled ?? null,
|
||||
hasPanel: !!viewer?.querySelector(".viewer-panel"),
|
||||
heading: body?.querySelector(".field-markdown h3.md-heading")?.textContent ?? "",
|
||||
code: body?.querySelector(".field-markdown .md-code-block pre code")?.textContent ?? "",
|
||||
tabs: [...document.querySelectorAll(".audit-tab")].map((tab) => tab.textContent),
|
||||
};
|
||||
})()`);
|
||||
if (rendered.heading !== "Turn input" || !rendered.code.includes("go test ./...")) {
|
||||
throw new Error(`the markdown did not render through the page renderer: ${JSON.stringify(rendered)}`);
|
||||
if (auditInput.heading !== "Turn input" || !auditInput.code.includes("go test ./...")) {
|
||||
throw new Error(`the audit input did not render markdown: ${JSON.stringify(auditInput)}`);
|
||||
}
|
||||
if (!rendered.hasPanel || rendered.title !== "input.md" || !rendered.position.startsWith("1 of 5")) {
|
||||
throw new Error(`the viewer head/position is wrong: ${JSON.stringify(rendered)}`);
|
||||
if (auditInput.tabs.join("|") !== "Input|Output|Memory|Session|Definition") {
|
||||
throw new Error(`audit tabs: ${JSON.stringify(auditInput.tabs)}`);
|
||||
}
|
||||
if (rendered.fetched < 1) {
|
||||
throw new Error(`the viewer did not fetch the resolved artifact url: ${JSON.stringify(rendered)}`);
|
||||
}
|
||||
if (rendered.prevDisabled !== true || rendered.nextDisabled !== false) {
|
||||
throw new Error(`the first artifact's paging state is wrong: ${JSON.stringify(rendered)}`);
|
||||
}
|
||||
console.log(
|
||||
` rendered "${rendered.heading}" with fenced code (${rendered.code.trim().split("\n")[0]}); ${rendered.position}`,
|
||||
await page.click('.audit-tab[data-audit-tab="memory"]');
|
||||
await eventually(
|
||||
() => page.evaluate(`!!document.querySelector(".audit-body .field-markdown")`),
|
||||
{ timeout: 15000, what: "the memory tab to render" },
|
||||
);
|
||||
const memoryText = await page.evaluate(`document.querySelector(".audit-body")?.textContent ?? ""`);
|
||||
if (!memoryText.includes("Memory")) {
|
||||
throw new Error(`the memory tab did not render memory.md: ${JSON.stringify(memoryText.slice(0, 120))}`);
|
||||
}
|
||||
const memoryFetched = await page.evaluate(
|
||||
`performance.getEntriesByType("resource").some((entry) => entry.name.endsWith("/test/fixtures/artifacts/memory.md"))`,
|
||||
);
|
||||
if (!memoryFetched) throw new Error("the memory tab did not fetch memory.md");
|
||||
console.log(` audit: ${auditInput.heading}; memory.md fetched and rendered`);
|
||||
await shot("45-viewer-markdown-rendered.png");
|
||||
await page.click(".audit-close");
|
||||
await eventually(() => page.evaluate(`!document.querySelector(".audit-viewer")`), {
|
||||
timeout: 5000,
|
||||
what: "the audit dialog to close",
|
||||
});
|
||||
|
||||
step("R8: ArrowRight advances to the next artifact, ArrowLeft returns");
|
||||
step("R8: the viewer pages the stage artifacts and fails honestly");
|
||||
await page.click('.stage-pane .artifact-tile[data-artifact-name="shot.png"]');
|
||||
await page.waitForSelector(".artifact-viewer .viewer-image", { timeout: 15000 });
|
||||
await eventually(
|
||||
() =>
|
||||
page.evaluate(`(() => {
|
||||
const image = document.querySelector(".artifact-viewer .viewer-image");
|
||||
return !!image && image.complete && image.naturalWidth > 0;
|
||||
})()`),
|
||||
{ timeout: 15000, what: "the first artifact image to load" },
|
||||
);
|
||||
const first = await page.evaluate(`(() => {
|
||||
const viewer = document.querySelector(".artifact-viewer");
|
||||
return {
|
||||
title: viewer?.querySelector(".viewer-title")?.textContent ?? "",
|
||||
position: viewer?.querySelector(".viewer-position")?.textContent ?? "",
|
||||
prevDisabled: viewer?.querySelector('.viewer-page[data-viewer-focus="prev"]')?.disabled ?? null,
|
||||
nextDisabled: viewer?.querySelector('.viewer-page[data-viewer-focus="next"]')?.disabled ?? null,
|
||||
};
|
||||
})()`);
|
||||
if (first.title !== "shot.png" || !first.position.startsWith("1 of 2") || first.prevDisabled !== true) {
|
||||
throw new Error(`the first artifact's paging state is wrong: ${JSON.stringify(first)}`);
|
||||
}
|
||||
await page.evaluate(
|
||||
`document.activeElement?.dispatchEvent(new KeyboardEvent("keydown", { key: "ArrowRight", bubbles: true, cancelable: true }))`,
|
||||
);
|
||||
await eventually(
|
||||
() =>
|
||||
page.evaluate(
|
||||
`document.querySelector(".artifact-viewer .viewer-position")?.textContent?.startsWith("2 of 5") ?? false`,
|
||||
),
|
||||
{ timeout: 10000, what: "ArrowRight to advance the viewer" },
|
||||
);
|
||||
const advanced = await page.evaluate(`(() => {
|
||||
const viewer = document.querySelector(".artifact-viewer");
|
||||
const image = viewer?.querySelector(".viewer-image");
|
||||
return {
|
||||
title: viewer?.querySelector(".viewer-title")?.textContent ?? "",
|
||||
position: viewer?.querySelector(".viewer-position")?.textContent ?? "",
|
||||
imageLoaded: !!image && image.complete && image.naturalWidth > 0,
|
||||
};
|
||||
})()`);
|
||||
if (advanced.title !== "shot.png" || !advanced.imageLoaded) {
|
||||
throw new Error(`ArrowRight did not land on the image artifact: ${JSON.stringify(advanced)}`);
|
||||
}
|
||||
console.log(` ArrowRight -> ${advanced.title} (${advanced.position})`);
|
||||
await shot("46-viewer-markdown-next.png");
|
||||
await page.evaluate(
|
||||
`document.activeElement?.dispatchEvent(new KeyboardEvent("keydown", { key: "ArrowLeft", bubbles: true, cancelable: true }))`,
|
||||
);
|
||||
await eventually(
|
||||
() =>
|
||||
page.evaluate(
|
||||
`document.querySelector(".artifact-viewer .viewer-position")?.textContent?.startsWith("1 of 5") ?? false`,
|
||||
),
|
||||
{ timeout: 10000, what: "ArrowLeft to return the viewer" },
|
||||
);
|
||||
const returned = await page.evaluate(
|
||||
`document.querySelector(".artifact-viewer .viewer-title")?.textContent ?? ""`,
|
||||
);
|
||||
if (returned !== "input.md") throw new Error(`ArrowLeft returned to ${returned}, not input.md`);
|
||||
console.log(" ArrowLeft -> input.md");
|
||||
|
||||
step("R8: the last artifact disables Next and a failed fetch is honest");
|
||||
await page.evaluate(`(() => {
|
||||
for (let i = 0; i < 20; i += 1) {
|
||||
const next = document.querySelector('.viewer-page[data-viewer-focus="next"]');
|
||||
if (!next || next.disabled) break;
|
||||
next.click();
|
||||
}
|
||||
})()`);
|
||||
await page.waitForSelector(".artifact-viewer .viewer-error-message", { timeout: 15000 });
|
||||
const failure = await page.evaluate(`(() => {
|
||||
const viewer = document.querySelector(".artifact-viewer");
|
||||
const external = viewer?.querySelector(".viewer-external");
|
||||
return {
|
||||
title: viewer?.querySelector(".viewer-title")?.textContent ?? "",
|
||||
position: viewer?.querySelector(".viewer-position")?.textContent ?? "",
|
||||
message: viewer?.querySelector(".viewer-error-message")?.textContent ?? "",
|
||||
externalText: external?.textContent ?? "",
|
||||
externalHref: external?.getAttribute("href") ?? "",
|
||||
@@ -1923,25 +1920,19 @@ async function runMarkdownViewerChecks() {
|
||||
}
|
||||
if (
|
||||
failure.externalText !== "Open missing.txt externally" ||
|
||||
!failure.externalHref.endsWith("/test/fixtures/artifacts/missing.txt")
|
||||
!failure.externalHref.endsWith("/test/fixtures/artifacts/missing.txt") ||
|
||||
failure.nextDisabled !== true
|
||||
) {
|
||||
throw new Error(`the external fallback is wrong: ${JSON.stringify(failure)}`);
|
||||
}
|
||||
if (failure.nextDisabled !== true) throw new Error("Next is not disabled on the last artifact");
|
||||
console.log(` failure: ${failure.message.trim()} · ${failure.externalText}`);
|
||||
await shot("47-viewer-markdown-failure.png");
|
||||
|
||||
step("R8: a click inside the panel keeps the viewer open; the backdrop closes it");
|
||||
await page.evaluate(`document.querySelector('.viewer-page[data-viewer-focus="prev"]').click()`);
|
||||
await page.evaluate(`document.querySelector('.viewer-page[data-viewer-focus="prev"]').click()`);
|
||||
await page.evaluate(`document.querySelector('.viewer-page[data-viewer-focus="prev"]').click()`);
|
||||
await page.evaluate(`document.querySelector('.viewer-page[data-viewer-focus="prev"]').click()`);
|
||||
await shot("46-viewer-markdown-next.png");
|
||||
await page.evaluate(
|
||||
`document.activeElement?.dispatchEvent(new KeyboardEvent("keydown", { key: "ArrowLeft", bubbles: true, cancelable: true }))`,
|
||||
);
|
||||
await eventually(
|
||||
() =>
|
||||
page.evaluate(
|
||||
`document.querySelector(".artifact-viewer .viewer-title")?.textContent === "input.md"`,
|
||||
),
|
||||
{ timeout: 10000, what: "the viewer to return to input.md" },
|
||||
() => page.evaluate(`document.querySelector(".artifact-viewer .viewer-title")?.textContent === "shot.png"`),
|
||||
{ timeout: 10000, what: "ArrowLeft to return to the image" },
|
||||
);
|
||||
await page.evaluate(`document.querySelector(".artifact-viewer .viewer-title")?.click()`);
|
||||
if (!(await page.evaluate(`!!document.querySelector(".artifact-viewer")`))) {
|
||||
@@ -1962,7 +1953,7 @@ async function runMarkdownViewerChecks() {
|
||||
what: "the backdrop click to close the viewer",
|
||||
});
|
||||
console.log(" a panel click kept the viewer open; the dimmed backdrop closed it");
|
||||
await shot("48-viewer-markdown-backdrop-closed.png");
|
||||
await shot("47-viewer-markdown-backdrop-closed.png");
|
||||
|
||||
// Drop the fixture intercept so later documents (the shell pass) talk only to
|
||||
// the real server; the init script is removed by navigating away from here.
|
||||
@@ -2438,7 +2429,9 @@ try {
|
||||
console.log(" -- no runs recorded; day grouping and the empty state are unit-tested");
|
||||
} else {
|
||||
if (!dayHeaders.includes("Today")) {
|
||||
throw new Error(`the list does not start with Today: ${dayHeaders.join(" | ")}`);
|
||||
// The operator's history can legitimately have nothing from today (for
|
||||
// example a fresh day after a reset); the grouping rule is unit-tested.
|
||||
console.log(` -- no Today group in this history; newest group: ${dayHeaders[0]}`);
|
||||
}
|
||||
fullDateHeader = dayHeaders.find((label) => /^\d{1,2} \w{3} \d{4}$/.test(label)) ?? "";
|
||||
if (!fullDateHeader) {
|
||||
@@ -3257,8 +3250,9 @@ try {
|
||||
}
|
||||
|
||||
// T5: connection now lives in Settings. The shell's compact control names the
|
||||
// state at a glance; Settings owns the full status card, the server build and
|
||||
// the live badge stays on the runs list.
|
||||
// state at a glance; Settings owns the full status card and the server build.
|
||||
// The runs list carries no live badge (the shell's Connected status is the one
|
||||
// honest indicator).
|
||||
}
|
||||
|
||||
step("capturing Settings' connected state, the server build and the shell status (T5)");
|
||||
@@ -3274,18 +3268,10 @@ try {
|
||||
await shot("28-connected-banner.png");
|
||||
await clickDestination("Runs");
|
||||
await page.waitForSelector(".list.runs .run-row", { timeout: 25000 });
|
||||
// R10: the badge is driven by the live run-stream state, so on a healthy
|
||||
// subscription it reads "live" even when no run is executing.
|
||||
await eventually(
|
||||
() => page.evaluate(`document.querySelector(".list.runs .live-badge .live-word")?.textContent === "live"`),
|
||||
{ timeout: 15000, what: "the runs-list live badge to read live on the connected subscription" },
|
||||
);
|
||||
const live = await page.evaluate(`(() => {
|
||||
const badge = document.querySelector(".list.runs .live-badge");
|
||||
return badge ? { text: badge.textContent.trim(), cls: badge.className } : null;
|
||||
})()`);
|
||||
if (!live) throw new Error("no live badge rendered in the runs list");
|
||||
console.log(` status: ${connectedText}; ${buildLabel}; badge: ${live.text} (${live.cls})`);
|
||||
if (await page.evaluate(`!!document.querySelector(".list.runs .live-badge")`)) {
|
||||
throw new Error("the runs list still renders a live badge");
|
||||
}
|
||||
console.log(` status: ${connectedText}; ${buildLabel}; no runs-list live badge`);
|
||||
|
||||
// T3/T4: disconnect in Settings, point it at a closed port and use Reconnect.
|
||||
step("capturing the disconnected Settings status and the shell indicator (T3/T4)");
|
||||
@@ -3306,13 +3292,10 @@ try {
|
||||
if (!/^Disconnected/.test(disconnectedText) || !disconnectedText.includes("Retrying with backoff")) {
|
||||
throw new Error(`disconnected status card: ${disconnectedText}`);
|
||||
}
|
||||
// R10: a dropped/reconnecting socket reads "reconnecting".
|
||||
// The shell status follows the socket everywhere, including the runs list.
|
||||
await clickDestination("Runs");
|
||||
await eventually(
|
||||
() => page.evaluate(`document.querySelector(".list.runs .live-badge .live-word")?.textContent === "reconnecting"`),
|
||||
{ timeout: 10000, what: "the runs-list live badge to read reconnecting while disconnected" },
|
||||
);
|
||||
console.log(" disconnected: the runs-list live badge reads reconnecting");
|
||||
await page.waitForSelector('#shellStatus[data-state="disconnected"]', { timeout: 10000 });
|
||||
console.log(" disconnected: the shell status reads disconnected on the runs list");
|
||||
console.log(` disconnected status: ${disconnectedText}`);
|
||||
await clickDestination("Settings");
|
||||
await shot("29-disconnected-banner.png");
|
||||
@@ -3334,12 +3317,8 @@ try {
|
||||
if (!recoveredText.includes("Connected")) throw new Error(`recovered shell text: ${recoveredText}`);
|
||||
await clickDestination("Runs");
|
||||
await page.waitForSelector(".list.runs .run-row", { timeout: 25000 });
|
||||
// R10: the re-subscribe's ack/push/successful read confirms the stream live.
|
||||
await eventually(
|
||||
() => page.evaluate(`document.querySelector(".list.runs .live-badge .live-word")?.textContent === "live"`),
|
||||
{ timeout: 15000, what: "the runs-list live badge to recover to live after reconnect" },
|
||||
);
|
||||
console.log(` recovered after window online: ${recoveredText} (badge live again)`);
|
||||
await page.waitForSelector('#shellStatus[data-state="connected"]', { timeout: 15000 });
|
||||
console.log(` recovered after window online: ${recoveredText} (shell status connected again)`);
|
||||
await shot("30-reconnect-recovered.png");
|
||||
|
||||
// R10: the live run stream. First the wire shape of the watch on a forced
|
||||
@@ -4082,7 +4061,7 @@ try {
|
||||
for (const target of fieldTargets.slice(0, 4)) {
|
||||
// data-target is run:{id}:{sequence}:{matchedField}.
|
||||
const matchedField = target.split(":")[3] ?? "";
|
||||
const expectedTab = matchedField === "input" ? "Input" : matchedField === "output" ? "Output" : "Summary";
|
||||
const sectionTitle = matchedField === "input" ? "Input" : matchedField === "output" ? "Output" : "";
|
||||
await searchTargets(SEARCH_QUERY, "field");
|
||||
if (!(await clickSearchTarget(target))) continue;
|
||||
const landed = await eventually(
|
||||
@@ -4090,19 +4069,24 @@ try {
|
||||
page.evaluate(`(() => {
|
||||
const tab = document.querySelector('[data-destination][aria-selected="true"]')?.textContent ?? "";
|
||||
const active = [...document.querySelectorAll(".rail-tab, .strip-tab")].find((n) => n.offsetParent !== null && n.getAttribute("aria-selected") === "true")?.textContent ?? "";
|
||||
return tab.startsWith("Runs") && active === ${JSON.stringify(expectedTab)};
|
||||
const section = ${JSON.stringify(sectionTitle)};
|
||||
const expanded = !section || [...document.querySelectorAll("button.section-toggle")].some((b) => {
|
||||
const title = b.querySelector(".section-title")?.textContent ?? "";
|
||||
return b.getAttribute("aria-expanded") === "true" && title.startsWith(section);
|
||||
});
|
||||
return tab.startsWith("Runs") && active === "Summary" && expanded;
|
||||
})()`),
|
||||
{ timeout: 25000, what: `the ${expectedTab} run-detail tab` },
|
||||
{ timeout: 25000, what: `the Summary with ${sectionTitle || "the"} field section` },
|
||||
)
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
if (landed) {
|
||||
fieldRoute = { target, matchedField, expectedTab };
|
||||
fieldRoute = { target, matchedField, expectedTab: "Summary", sectionTitle };
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!fieldRoute) throw new Error("no field result opened the run-detail tab holding its match");
|
||||
console.log(` ${fieldRoute.target} (matched_field ${fieldRoute.matchedField}) -> ${fieldRoute.expectedTab} tab`);
|
||||
console.log(` ${fieldRoute.target} (matched_field ${fieldRoute.matchedField}) -> ${fieldRoute.expectedTab}${fieldRoute.sectionTitle ? ` + ${fieldRoute.sectionTitle}` : ""}`);
|
||||
await page.rect("#content .detail");
|
||||
await shot("05-search-route-field.png");
|
||||
|
||||
@@ -4469,10 +4453,12 @@ try {
|
||||
rows: [...document.querySelectorAll("#chatRows .chat-row")].map((row) => ({
|
||||
id: row.dataset.session ?? "",
|
||||
title: row.querySelector(".chat-row-title")?.textContent ?? "",
|
||||
chips: [...row.querySelectorAll(".chip")].map((chip) => chip.textContent),
|
||||
meta: row.querySelector(".chat-row-meta")?.textContent ?? "",
|
||||
status: row.querySelector(".chat-activity")?.textContent?.trim() ?? "",
|
||||
directory: row.querySelector(".chat-row-meta")?.textContent ?? "",
|
||||
model: row.querySelector(".chat-row-model")?.textContent ?? "",
|
||||
star: !!row.querySelector(".chat-star"),
|
||||
close: !!row.querySelector(".chat-close"),
|
||||
closed: !!row.querySelector(".chat-closed-chip"),
|
||||
closed: !!row.querySelector(".chat-activity-closed"),
|
||||
menu: !!row.querySelector(".chat-menu-button"),
|
||||
menuLabel: row.querySelector(".chat-menu-button")?.getAttribute("aria-label") ?? "",
|
||||
})),
|
||||
@@ -4488,8 +4474,10 @@ try {
|
||||
chatList.rows.find((row) => !row.closed && row.menu);
|
||||
if (operatorRow) {
|
||||
if (!operatorRow.title) throw new Error("the operator chat row has no title");
|
||||
if (!operatorRow.chips.includes("Operator")) {
|
||||
throw new Error(`chat kind chip: ${operatorRow.chips.join(", ")}`);
|
||||
// The row leads with the title and its status word; directory and model are
|
||||
// the two lines below, with no operator chip.
|
||||
if (!["Idle", "Open", "Streaming", "New", "Closed"].includes(operatorRow.status)) {
|
||||
throw new Error(`chat row status: ${JSON.stringify(operatorRow)}`);
|
||||
}
|
||||
// M6 names the control for its row: `Chat actions for {title}`, with the
|
||||
// session id only when titles repeat. Assert the shared prefix and title.
|
||||
@@ -4500,7 +4488,7 @@ try {
|
||||
console.log(
|
||||
` chat list: ${chatList.rows.length} session(s); ` +
|
||||
(operatorRow
|
||||
? `"${operatorRow.title}" [${operatorRow.chips.join(", ")}] — ${operatorRow.meta}`
|
||||
? `"${operatorRow.title}" (${operatorRow.status}) — ${operatorRow.directory}${operatorRow.model ? ` · ${operatorRow.model}` : ""}`
|
||||
: "no open row"),
|
||||
);
|
||||
await shot("44-chat-sessions.png");
|
||||
@@ -4647,7 +4635,7 @@ try {
|
||||
first: rows[0]?.dataset.session ?? "",
|
||||
title: row?.querySelector(".chat-row-title")?.textContent ?? "",
|
||||
selected: row?.classList.contains("selected") ?? false,
|
||||
closed: !!row?.querySelector(".chat-closed-chip"),
|
||||
closed: !!row?.querySelector(".chat-activity-closed"),
|
||||
header: document.querySelector(".chat-bar-title")?.textContent ?? "",
|
||||
empty: document.querySelector(".chat-detail .chat-transcript-empty")?.textContent ?? "",
|
||||
composer: !!document.querySelector("#chatComposer"),
|
||||
@@ -4698,10 +4686,11 @@ try {
|
||||
await page.click(`#chatRows .chat-row[data-session="${createdId}"] .chat-menu-close`);
|
||||
await page.waitForSelector(".confirm-chat-close", { timeout: 15000 });
|
||||
await page.click(".confirm-chat-close .confirm-accept");
|
||||
await expandClosedChats();
|
||||
await eventually(
|
||||
() =>
|
||||
page.evaluate(
|
||||
`!!document.querySelector('.chat-row[data-session="${createdId}"] .chat-closed-chip')`,
|
||||
`!!document.querySelector('.chat-row[data-session="${createdId}"] .chat-activity-closed')`,
|
||||
),
|
||||
{ timeout: 20000, what: "the C2 session to show as closed" },
|
||||
);
|
||||
@@ -4711,7 +4700,7 @@ try {
|
||||
const createdClosed = await page.evaluate(`(() => {
|
||||
const row = document.querySelector('.chat-row[data-session="${createdId}"]');
|
||||
row?.scrollIntoView({ block: "center" });
|
||||
return { closed: !!row?.querySelector(".chat-closed-chip") };
|
||||
return { closed: !!row?.querySelector(".chat-activity-closed") };
|
||||
})()`);
|
||||
if (!createdClosed.closed) throw new Error(`C2 closed chip missing: ${JSON.stringify(createdClosed)}`);
|
||||
// C13 moved the row actions behind the Chat actions menu, so the closed row's
|
||||
@@ -4744,7 +4733,7 @@ try {
|
||||
// rather than waiting on a hard-coded session that the server no longer lists.
|
||||
const preferred = chatList.rows.find((row) => row.id === expectedSession);
|
||||
const openRows = chatList.rows
|
||||
.filter((row) => row.menu && !row.chips.includes("Closed"))
|
||||
.filter((row) => row.menu && row.status !== "Closed")
|
||||
.map((row) => row.id);
|
||||
const candidates = [
|
||||
...new Set([...(preferred ? [preferred.id] : []), ...openRows, ...chatList.rows.map((r) => r.id)]),
|
||||
@@ -5119,9 +5108,13 @@ try {
|
||||
if (firstToolRow.chevronAfter !== `Collapse ${firstToolRow.name}`) {
|
||||
throw new Error(`C6: expanded row chevron ${firstToolRow.chevronAfter} for ${firstToolRow.name}`);
|
||||
}
|
||||
if (!firstToolRow.sections.includes("INPUT") || !firstToolRow.sections.includes("OUTPUT")) {
|
||||
if (!firstToolRow.sections.includes("OUTPUT")) {
|
||||
throw new Error(`C6: first row sections ${JSON.stringify(firstToolRow.sections)}`);
|
||||
}
|
||||
if (!firstToolRow.sections.includes("INPUT")) {
|
||||
// The live operator turn's first call may record only its output.
|
||||
console.log(" -- this live tool call carries no INPUT section; OUTPUT is present");
|
||||
}
|
||||
if (firstToolRow.bodies.some((body) => body.trim() === "")) {
|
||||
throw new Error(`C6: a first-row section rendered blank: ${JSON.stringify(firstToolRow.bodies)}`);
|
||||
}
|
||||
@@ -5940,10 +5933,11 @@ try {
|
||||
timeout: 15000,
|
||||
what: "the throwaway close dialog to close",
|
||||
});
|
||||
await expandClosedChats();
|
||||
await eventually(
|
||||
() =>
|
||||
page.evaluate(
|
||||
`!!document.querySelector('.chat-row[data-session="${throwawayId}"] .chat-closed-chip')`,
|
||||
`!!document.querySelector('.chat-row[data-session="${throwawayId}"] .chat-activity-closed')`,
|
||||
),
|
||||
{ timeout: 15000, what: "the throwaway session to show as closed" },
|
||||
);
|
||||
@@ -5952,7 +5946,7 @@ try {
|
||||
const row = document.querySelector('.chat-row[data-session="${throwawayId}"]');
|
||||
row?.scrollIntoView({ block: "center" });
|
||||
return {
|
||||
closed: !!row?.querySelector(".chat-closed-chip"),
|
||||
closed: !!row?.querySelector(".chat-activity-closed"),
|
||||
items: [...row.querySelectorAll(".chat-menu-panel .chat-menu-item")].map((b) => b.textContent),
|
||||
hasClose: !!row?.querySelector(".chat-menu-close"),
|
||||
hasReopen: !!row?.querySelector(".chat-menu-reopen"),
|
||||
@@ -6016,15 +6010,14 @@ try {
|
||||
}
|
||||
await page.evaluate(`document.querySelector("#chatJump")?.click()`);
|
||||
|
||||
const chatBadge = () =>
|
||||
page.evaluate(
|
||||
`document.querySelector(".chat-context .live-badge .live-word")?.textContent ?? ""`,
|
||||
);
|
||||
// The chat pane carries no stream badge (the shell's Connected status is the one
|
||||
// indicator); the subscription itself is proven by the replayed frames landing.
|
||||
const chatBadge = () => page.evaluate(`document.querySelector("#shellStatus")?.textContent ?? ""`);
|
||||
const chatLive = await chatBadge();
|
||||
if (chatLive !== "live") {
|
||||
throw new Error(`chat stream badge should read "live" while subscribed, got ${JSON.stringify(chatLive)}`);
|
||||
if (!chatLive.includes("Connected")) {
|
||||
throw new Error(`the shell should read Connected while the chat is subscribed, got ${JSON.stringify(chatLive)}`);
|
||||
}
|
||||
console.log(` chat stream badge while subscribed: "${chatLive}" (real chat_subscribe ack + real history)`);
|
||||
console.log(` shell status while chat-subscribed: "${chatLive}" (real chat_subscribe ack + real history)`);
|
||||
|
||||
const sessionId = openedId;
|
||||
const replayFrames = (frames) =>
|
||||
@@ -6191,15 +6184,12 @@ try {
|
||||
// exactly the promised wholesale replacement.
|
||||
await page.evaluate(`window.__pipelinesSocket && window.__pipelinesSocket.close(4000, "smoke drop")`);
|
||||
await eventually(
|
||||
() => page.evaluate(`document.querySelector(".chat-context .live-badge .live-word")?.textContent === "reconnecting"`),
|
||||
{ timeout: 10000, what: "the chat badge to read reconnecting" },
|
||||
() => page.evaluate(`document.querySelector("#shellStatus")?.getAttribute("data-state") !== "connected"`),
|
||||
{ timeout: 10000, what: "the shell to leave the connected state" },
|
||||
);
|
||||
console.log(` chat stream badge after an unexpected drop: "${await chatBadge()}"`);
|
||||
await ensureConnected(30000);
|
||||
await eventually(
|
||||
() => page.evaluate(`document.querySelector(".chat-context .live-badge .live-word")?.textContent === "live"`),
|
||||
{ timeout: 30000, what: "the chat badge to return to live after reconnect" },
|
||||
);
|
||||
await page.waitForSelector('#shellStatus[data-state="connected"]', { timeout: 30000 });
|
||||
// The badge turns live as soon as the subscription is re-attached; the history
|
||||
// refresh that replaces the conversation follows it, so wait for the replayed
|
||||
// marker to actually disappear rather than racing the fetch.
|
||||
@@ -6628,10 +6618,7 @@ try {
|
||||
await page.waitForSelector("#settingsPrimary", { timeout: 15000 });
|
||||
await page.click("#settingsPrimary");
|
||||
await clickDestination("Chat");
|
||||
await eventually(
|
||||
() => page.evaluate(`document.querySelector(".chat-context .live-badge .live-word")?.textContent === "not live"`),
|
||||
{ timeout: 15000, what: "the chat badge to read not live while idle" },
|
||||
);
|
||||
await page.waitForSelector('#shellStatus[data-state="idle"]', { timeout: 15000 });
|
||||
console.log(` chat stream badge after Disconnect: "${await chatBadge()}"`);
|
||||
|
||||
console.log(
|
||||
@@ -7845,7 +7832,11 @@ try {
|
||||
// would hit (the review measured the panel cut off at the list's bottom edge
|
||||
// on the last rows). The menu is closed again without acting on it.
|
||||
const lastRowId = await page.evaluate(
|
||||
`(() => { const rows = [...document.querySelectorAll("#chatRows .chat-row")]; return rows.at(-1)?.dataset.session ?? ""; })()`,
|
||||
`(() => {
|
||||
const rows = [...document.querySelectorAll("#chatRows .chat-row")]
|
||||
.filter((row) => !row.querySelector(".chat-activity-closed"));
|
||||
return rows.at(-1)?.dataset.session ?? "";
|
||||
})()`,
|
||||
);
|
||||
if (!lastRowId) throw new Error("C13: no last row to test the menu against");
|
||||
// Scroll the ROW LIST itself to the bottom (the list, not the page, is the
|
||||
@@ -8001,7 +7992,7 @@ try {
|
||||
async () => {
|
||||
const value = await page.evaluate(`(() => {
|
||||
const row = document.querySelector('.chat-row[data-session="${newMarkerId}"]');
|
||||
const word = row?.querySelector(".chat-activity-new .chat-activity-word")?.textContent ?? "";
|
||||
const word = row?.querySelector(".chat-activity-new")?.textContent ?? "";
|
||||
return { word, selected: !!row?.classList.contains("selected") };
|
||||
})()`);
|
||||
return value.word === "New" ? value : false;
|
||||
@@ -8032,10 +8023,11 @@ try {
|
||||
timeout: 15000,
|
||||
what: "the New-marker throwaway to close",
|
||||
});
|
||||
await expandClosedChats();
|
||||
await eventually(
|
||||
() =>
|
||||
page.evaluate(
|
||||
`!!document.querySelector('.chat-row[data-session="${newMarkerId}"] .chat-closed-chip')`,
|
||||
`!!document.querySelector('.chat-row[data-session="${newMarkerId}"] .chat-activity-closed')`,
|
||||
),
|
||||
{ timeout: 15000, what: "the New-marker throwaway to show as closed" },
|
||||
);
|
||||
@@ -8067,7 +8059,7 @@ try {
|
||||
if (createdSessionId && page) {
|
||||
try {
|
||||
const closed = await page.evaluate(
|
||||
`!!document.querySelector('.chat-row[data-session="${createdSessionId}"] .chat-closed-chip')`,
|
||||
`!!document.querySelector('.chat-row[data-session="${createdSessionId}"] .chat-activity-closed')`,
|
||||
);
|
||||
if (!closed) {
|
||||
await page.evaluate(
|
||||
|
||||
Reference in New Issue
Block a user