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

- Turn files (input/memory/output/session) are system artifacts now: they are
  never tiles in the run or stage galleries. Shared public files are attributed
  to the visit that first recorded them, so a run counts 3 stage artifacts, not
  one copy of each per later stage.
- Audit & debug opens a dialog with vertical Input / Output / Memory / Session /
  Definition tabs, for a visit from the stage pane or the run Summary.
- Run tabs are Summary / Graph / Timeline; Input and Output are Summary sections
  with Artifacts, Files changed and Audit. Each stage pane gains Files changed.
- Artifacts gain a gallery/list switch (remembered) and full-name wrapping; the
  copy/share actions are hover-or-focus icon buttons.
- Status badge above the run title; no live badges on the run surfaces. The runs
  list leads with the pipeline name and the stored task title beneath it.
- Chat rows: title + coloured status word only, then directory, then model; no
  operator or closed chips, no dot. The more/star cluster is a hover/focus
  overlay so the title uses the row's width, and an open menu stacks above rows.
  Closed chats collapse behind a chevron. Sessions can be starred locally and
  sort in a Starred group. The chat header no longer repeats status/dir/model.
- A visible rail divider separates Search from the destinations; the page has a
  real favicon/apple-touch icon and the rail brand wears it.
- Smoke updated: no live badges, 3 detail tabs, field hits open Summary sections,
  closed chats expand for checks, the fixture viewer uses shot.png/missing.txt
  and the audit for markdown.
This commit is contained in:
2026-10-20 01:00:01 +01:00
parent ca28d08269
commit d130615fae
25 changed files with 1167 additions and 366 deletions
+73 -7
View File
@@ -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;
}