Merge branch 'main' into web-bell-icon

This commit is contained in:
2026-10-20 01:28:22 +01:00
17 changed files with 484 additions and 104 deletions
+82 -25
View File
@@ -138,41 +138,74 @@
.chat-row .row-title { min-width: 0; }
.chat-row .row-meta { grid-column: 1; }
.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. */
/* Star (top-right) and the more menu (bottom-right) sit over the row's own
corners on hover/focus, so they never become an extra row or reserve width. */
.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);
inset: 0;
opacity: 0;
pointer-events: none;
transition: opacity 100ms ease-out;
}
.chat-row-actions > .chat-star,
.chat-row-actions > .chat-menu-button,
.chat-row-actions > .chat-menu-panel { pointer-events: auto; }
.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;
}
.chat-row.menu-open .chat-row-actions { opacity: 1; }
/* 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 { opacity: 1; }
.chat-row-actions > .chat-star,
.chat-row-actions > .chat-menu-button,
.chat-row-actions > .chat-menu-panel { pointer-events: auto; }
}
.chat-row-actions button { padding: 3px 10px; font-size: 12px; }
.chat-row-actions .chat-menu-item { 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 {
position: absolute;
top: 5px;
right: 6px;
width: 20px;
height: 20px;
min-width: 0;
min-height: 0;
padding: 0;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: var(--radius-control);
background: var(--color-surface);
color: var(--muted);
font-size: 13px;
line-height: 1;
}
.chat-star:hover { color: var(--color-text); }
.chat-star.starred { color: var(--color-accent); }
.chat-row .chat-menu-button {
position: absolute;
right: 6px;
bottom: 5px;
width: 20px;
height: 20px;
min-width: 0;
min-height: 0;
padding: 0;
display: inline-flex;
align-items: center;
justify-content: center;
background: var(--color-surface);
border-radius: var(--radius-control);
font-size: 13px;
line-height: 1;
}
/* The row menu opens below the bottom-right button; the open row stacks above
its neighbours so the panel is not covered by the next row. */
.chat-row .chat-menu-panel { top: calc(100% + 4px); bottom: auto; right: 8px; }
.chat-menu-wrap { position: relative; }
.chat-row-actions.chat-menu-wrap { position: absolute; inset: 0; }
.chat-menu-button { min-width: 30px; font-size: 15px; line-height: 1; }
.chat-menu-panel {
position: absolute;
@@ -275,11 +308,32 @@
.chat-turn-user { justify-content: flex-end; }
.chat-turn-agent { justify-content: flex-start; }
.chat-bubble { max-width: min(560px, 100%); padding: 8px 12px; border-radius: var(--radius-card); }
.user-bubble { background: var(--surface-2); border: 1px solid var(--border); }
.agent-bubble { background: var(--surface); border: 1px solid var(--border); }
/* The operator's turns are accent-tinted and right-aligned; the agent's are the
neutral page surface with a quiet accent edge, so the two never look alike. */
.user-bubble {
background: color-mix(in srgb, var(--accent) 18%, var(--surface-2));
border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
border-bottom-right-radius: 6px;
}
.agent-bubble {
background: var(--surface);
border: 1px solid var(--border);
border-left: 2px solid color-mix(in srgb, var(--accent) 48%, var(--border));
border-bottom-left-radius: 6px;
}
.chat-client { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.chat-user-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-tools { margin: 4px 0 8px; }
.chat-turn-agent { flex-direction: column; align-items: flex-start; }
/* The tool summary is a quiet line next to the message, not a chip inside it. */
.chat-tools { margin: 2px 0 10px; }
.chat-tool-chip {
padding: 2px 0;
border: 0;
background: transparent;
color: var(--muted);
font-size: 11px;
}
.chat-tool-chip:hover { color: var(--color-text); }
.chat-reasoning { margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px dashed var(--border); }
.chat-reasoning-toggle {
@@ -309,11 +363,14 @@
display: inline-flex;
align-items: center;
gap: 6px;
padding: 3px 10px;
background: var(--surface-2);
font-size: 12px;
padding: 2px 0;
border: 0;
background: transparent;
color: var(--muted);
font-size: 11px;
cursor: pointer;
}
.chat-tool-chip:hover { color: var(--color-text); }
.chat-tool-chip-failed { border-color: var(--bad); color: var(--bad); }
.chat-tool-icon { font-size: 12px; line-height: 1; }
.chat-tool-icon-failed { color: var(--bad); }
+39 -2
View File
@@ -312,7 +312,8 @@
.search-kind { flex: 0 0 auto; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 2px; }
/* An artifact result shows the artifact: a real thumbnail for an image, a type
tile for everything else, so "artifact" never stands in for the content. */
.search-row-artifact { align-items: center; }
.search-row-artifact,
.search-row-with-icon { align-items: center; }
.search-thumb {
flex: 0 0 auto;
width: 56px;
@@ -326,6 +327,7 @@
flex: 0 0 auto;
width: 56px;
height: 56px;
color: var(--color-muted);
display: inline-flex;
align-items: center;
justify-content: center;
@@ -336,6 +338,7 @@
font-size: 10px;
letter-spacing: 0.04em;
}
.search-type svg { width: 22px; height: 22px; }
.search-open-run {
margin-top: 4px;
padding: 2px 8px;
@@ -614,7 +617,7 @@
}
.audit-tab:hover { background: var(--tint-hover); color: var(--color-text); }
.audit-tab.active {
background: var(--tint-selected);
background: var(--color-bg);
color: var(--color-text);
font-weight: var(--weight-semibold);
box-shadow: inset 2px 0 0 var(--color-accent);
@@ -632,3 +635,37 @@
}
.audit-tab { white-space: nowrap; }
}
/* Audit documents: rendered/raw switch, the file link, and the session frame. */
.audit-doc-bar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-bottom: 10px;
}
.audit-doc-toggle {
display: inline-flex;
border: 1px solid var(--border);
border-radius: var(--radius-control);
overflow: hidden;
}
.audit-doc-mode {
padding: 4px 10px;
border: 0;
background: transparent;
color: var(--muted);
font-size: 12px;
}
.audit-doc-mode:hover { background: var(--tint-hover); color: var(--color-text); }
.audit-doc-mode.active { background: var(--color-bg); color: var(--color-text); font-weight: 600; }
.audit-doc-open { color: var(--color-accent); font-size: 12px; }
.audit-doc-body { min-height: 0; }
.audit-session-frame {
width: 100%;
height: min(70vh, 720px);
border: 1px solid var(--border);
border-radius: var(--radius-card);
background: var(--color-bg);
}
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

+5 -1
View File
@@ -6,7 +6,11 @@
<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="manifest" href="/manifest.webmanifest" />
<meta name="theme-color" content="#101013" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-title" content="Pipelines" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link rel="stylesheet" href="./design/tokens/tokens.css" />
<link rel="stylesheet" href="./base.css" />
<link rel="stylesheet" href="./shell.css" />
+30
View File
@@ -0,0 +1,30 @@
{
"name": "Pipelines",
"short_name": "Pipelines",
"description": "Run, inspect and steer reusable agent pipelines.",
"start_url": "/",
"scope": "/",
"display": "standalone",
"background_color": "#101013",
"theme_color": "#101013",
"icons": [
{
"src": "/icon-192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
},
{
"src": "/icon-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
},
{
"src": "/icon-maskable-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
]
}
+18 -3
View File
@@ -246,15 +246,30 @@
.stat-del { color: var(--bad); }
/* Full-screen diff viewer overlay (the artifact-viewer idiom). */
/* A dim scrim with one centred panel: the visible outside of the diff (and the
place a click closes it), matching the artifact viewer. */
.change-viewer {
position: fixed;
inset: 0;
z-index: 30;
z-index: 60;
display: flex;
align-items: center;
justify-content: center;
padding: 24px;
background: rgba(0, 0, 0, 0.78);
}
.change-viewer-panel {
display: flex;
flex-direction: column;
gap: 12px;
padding: 20px;
background: rgba(0, 0, 0, 0.86);
width: min(1200px, 100%);
max-height: 100%;
min-height: 0;
padding: 16px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 14px;
box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.change-viewer-head { display: flex; gap: 12px; align-items: flex-start; }
.change-viewer-titles { flex: 1; min-width: 0; display: grid; gap: 2px; }
+1
View File
@@ -30,6 +30,7 @@ const MIME = {
".css": "text/css; charset=utf-8",
".json": "application/json; charset=utf-8",
".svg": "image/svg+xml",
".webmanifest": "application/manifest+json",
".png": "image/png",
".ico": "image/x-icon",
".map": "application/json; charset=utf-8",
+45
View File
@@ -77,6 +77,22 @@ function defaultServerUrl() {
const client = new PipelinesClient();
const repo = new PipelinesRepository(client);
// Register the app's shell service worker where the browser allows it (a secure
// context: https, localhost, or the desktop app). On a plain-LAN http origin the
// page still works; only installation/offline caching is unavailable there.
if (typeof navigator !== "undefined" && "serviceWorker" in navigator) {
const secure =
typeof location !== "undefined" &&
(location.protocol === "https:" ||
location.hostname === "localhost" ||
location.hostname === "127.0.0.1");
if (secure) {
window.addEventListener("load", () => {
navigator.serviceWorker.register("/sw.js").catch(() => undefined);
});
}
}
// Read the persisted settings once: the server URL falls back to the page's own
// proxy endpoint when unset, and the workspace starts blank when unset. Both the
// configured value and the draft start from storage.
@@ -166,6 +182,9 @@ const state = {
chatStars: readChatStars(),
// Whether the CLOSED chats group is expanded (the chevron beside its name).
chatClosedOpen: false,
// The last time each destination's data arrived (manual refresh or a socket
// push); the list's Refresh button shows it on hover.
lastUpdated: {},
// 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.
@@ -1102,11 +1121,32 @@ function renderContent() {
}
}
/** The last-updated words for a view, local time, or the not-yet-loaded note. */
function lastUpdatedTitle(view) {
const at = Number(state.lastUpdated?.[view] ?? 0);
if (!(at > 0)) return "Not refreshed yet";
return `Last updated ${new Date(at).toLocaleTimeString([], {
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
})}`;
}
/** Record that a view's data just arrived, and refresh the hover title in place. */
function touchView(view = state.view) {
state.lastUpdated = { ...(state.lastUpdated ?? {}), [view]: Date.now() };
if (view !== state.view) return;
const button = document.querySelector('.list-pane [data-refresh="true"]');
if (button) button.title = lastUpdatedTitle(view);
}
function refreshButton() {
return h("button", {
class: "ghost",
type: "button",
text: "Refresh",
title: lastUpdatedTitle(state.view),
"data-refresh": "true",
onclick: () => loadCurrentView(true),
});
}
@@ -1554,6 +1594,7 @@ async function loadCurrentView(force = false, { runsFresh = false } = {}) {
state.usage = usage;
state.runsLoaded = true;
}
touchView(state.view);
// The nav badge reads the pipeline count, and the Pipelines destination is
// one click away: load that list once when it has not been seen, whether the
// runs came from the watch's resync or a direct read.
@@ -1830,6 +1871,8 @@ function applyRunEvent(frame) {
} else if (fold.runs !== state.runs) {
state.runs = fold.runs;
listChanged = true;
touchView("runs");
if (state.view === "pipelines") touchView("pipelines");
renderRunState();
// A terminal transition also settles the usage aggregate (the active
// count), which the delta does not carry; one server read refreshes it. A
@@ -1844,6 +1887,7 @@ function applyRunEvent(frame) {
const detailChanged = folded !== detail;
if (detailChanged) {
state.runDetail = folded;
touchView("runs");
renderRunState();
}
if (runDetailNeedsFullSync(frame) && (detailChanged || listChanged)) {
@@ -2106,6 +2150,7 @@ const runtime = {
render,
renderContent,
renderHeader,
touchView,
focusDetailHeading,
focusListHeading,
endpointConfigured,
+50
View File
@@ -164,6 +164,7 @@ function focusElement(element) {
*/
export function createModalController(options = {}) {
const document_ = options.document ?? globalThis.document;
const window_ = options.window ?? globalThis.window;
const getLayer =
typeof options.layer === "function"
? options.layer
@@ -196,6 +197,50 @@ export function createModalController(options = {}) {
let keydownBound = false;
let focusinBound = false;
let fallbackMode = false;
// One history entry per open modal, so the browser Back button closes it the
// same way Escape and the backdrop do. A modal that closes through the UI
// pops its own entry instead of leaving a dead one behind.
let historyPushed = false;
let historyClosing = false;
function pushModalHistory(id) {
if (historyPushed || !window_?.history) return;
try {
window_.history.pushState(
{ ...(window_.history.state ?? {}), pipelinesModal: id },
"",
);
historyPushed = true;
} catch {
// A history-refusing environment simply keeps the UI close paths.
}
}
function popModalHistory() {
if (!historyPushed || historyClosing) return;
historyPushed = false;
try {
// Only pop our own entry. If the app navigated while the dialog was open,
// its route entry is on top now; calling back() here would undo that
// navigation (the dialog's own entry is buried under it).
if (window_.history?.state?.pipelinesModal == null) return;
window_.history.back();
} catch {
// Nothing to pop.
}
}
if (window_?.addEventListener) {
window_.addEventListener("popstate", () => {
if (!historyPushed) return;
historyPushed = false;
const entry = top();
if (!entry) return;
historyClosing = true;
closeEntry(entry, { restore: true });
historyClosing = false;
});
}
function layer() {
return getLayer() ?? document_?.body ?? null;
@@ -471,6 +516,7 @@ export function createModalController(options = {}) {
releaseIfEmpty();
}
if (restore && wasTop) restoreFocus(entry);
if (!stack.length) popModalHistory();
return true;
}
@@ -559,6 +605,10 @@ export function createModalController(options = {}) {
entryOptions.renderManaged !== false,
);
applyStackState();
// Only overlays that act as their own view carry a history entry (the
// viewers). A transient sheet must not, or closing it while the app
// navigates would undo that navigation with history.back().
if (entryOptions.history !== false) pushModalHistory(id);
if (entryOptions.focus !== false) focusInside(entry.panel);
return entry.panel;
}
+1
View File
@@ -202,6 +202,7 @@ function renderAttentionSheet() {
overlay.append(sheet);
attentionLayer.replaceChildren(overlay);
modal.open("attention-sheet", overlay, {
history: false,
// The sheet is rebuilt by renderAttentionSheet, not by renderContent's
// staged set, so it is managed imperatively rather than reconciled away.
renderManaged: false,
+14 -5
View File
@@ -379,6 +379,7 @@ async function loadChatSessions(force = false) {
);
state.chatSessions = [...held, ...listed];
state.chatLoaded = true;
rt.touchView?.("chat");
// Fold this device's seen state in: the active chat has been read, and every
// session seen for the first time gets a baseline so pre-existing chats are
// not all reported as new.
@@ -1079,6 +1080,7 @@ function releaseAttachments(attachments) {
function onChatFrame(message) {
const frame = message?.chat_event;
if (!frame || !frame.session_id) return;
rt.touchView?.("chat");
const sessionId = frame.session_id;
const thread = state.chatThreads.get(sessionId);
if (!thread) return;
@@ -2340,7 +2342,12 @@ function approvalControl(label, decision, sessionId, requestId, extraClass = "")
function renderChatRunningIndicator(thread, now) {
const wrap = h("div", { class: "chat-running", id: "chatRunning" });
const head = h("div", { class: "chat-running-head" });
head.append(h("span", { class: "spinner chat-running-spinner", "aria-hidden": "true" }));
const spinner = h("span", { class: "spinner chat-running-spinner", "aria-hidden": "true" });
// Every streamed delta re-renders the transcript, so a fresh spinner would
// restart its CSS rotation at 0deg many times a second and look frozen. Start
// it at the wall-clock phase instead, so re-renders continue the same turn.
spinner.style.animationDelay = `-${(performance.now() % 800) / 1000}s`;
head.append(spinner);
head.append(
h("span", {
class: "chat-running-label",
@@ -2400,12 +2407,14 @@ function renderChatAgentTurn(turn, streaming = false, elapsedMillis = () => 0) {
const bubble = h("div", { class: "chat-bubble agent-bubble" });
const steps = turn.reasoningSteps;
if (steps.length > 0) bubble.append(renderChatReasoning(turn, streaming));
if (turn.tools.length > 0) {
const tools = renderChatToolCalls(turn, { streaming, elapsedMillis });
if (tools) bubble.append(tools);
}
if (turn.answer.trim() !== "") bubble.append(renderMarkdown(turn.answer));
wrap.append(bubble);
// The tool summary is a quiet line beside the message, not a highlighted chip
// inside it; its panel still opens right there.
if (turn.tools.length > 0) {
const tools = renderChatToolCalls(turn, { streaming, elapsedMillis });
if (tools) wrap.append(tools);
}
return wrap;
}
+3 -1
View File
@@ -88,6 +88,8 @@ function openChangeViewer(files, startIndex, trigger = null) {
"aria-modal": "true",
"aria-label": "Diff viewer",
});
const panel = h("div", { class: "change-viewer-panel" });
overlay.append(panel);
overlay.addEventListener("click", (event) => {
if (event.target === overlay) closeChangeViewer();
});
@@ -197,7 +199,7 @@ function openChangeViewer(files, startIndex, trigger = null) {
body.append(renderRenderedDiff(entry));
}
overlay.replaceChildren(head, controls, body);
panel.replaceChildren(head, controls, body);
};
renderViewer();
+101 -65
View File
@@ -209,93 +209,131 @@ function latestVisitIndex(d, key) {
return Math.max(0, visits.length - 1);
}
/** 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: "input", label: "Input", body: () => auditArtifact(step, "input.md", EMPTY_INPUT_MESSAGE) },
{ key: "output", label: "Output", body: () => auditArtifact(step, "output.md", EMPTY_OUTPUT_MESSAGE) },
{ key: "memory", label: "Memory", body: () => auditArtifact(step, "memory.md", "No memory recorded for this visit.") },
{ key: "session", label: "Session", body: () => auditSession(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));
/**
* One turn file in the audit: the raw bytes and the rendered markdown, with a
* Rendered/Raw switch and a link to the file on the server. The file is fetched
* (not the step's field map), so the outcome section is visible exactly as the
* stage wrote it.
*/
function auditArtifact(step, name, emptyMessage) {
const artifact = systemArtifacts(step).find((entry) => entry.name === name);
const wrap = h("div", { class: "audit-doc" });
if (!artifact) {
wrap.append(h("div", { class: "muted", text: emptyMessage }));
return wrap;
}
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…" }));
if (!resolved) {
wrap.append(h("div", { class: "muted", text: ARTIFACT_SERVER_HINT }));
return wrap;
}
let text = "";
let mode = "rendered";
const bar = h("div", { class: "audit-doc-bar" });
const toggle = h("div", { class: "audit-doc-toggle", role: "group", "aria-label": "Document view" });
const out = h("div", { class: "audit-doc-body" });
const draw = () => {
toggle.replaceChildren(
...[
["rendered", "Rendered"],
["raw", "Raw"],
].map(([key, label]) =>
h("button", {
class: `audit-doc-mode${mode === key ? " active" : ""}`,
type: "button",
"aria-pressed": mode === key ? "true" : "false",
text: label,
onclick: () => {
mode = key;
draw();
},
}),
),
);
out.replaceChildren();
if (mode === "raw" || !looksLikeMarkdown(text)) {
out.append(h("pre", { class: "field-block" }, h("code", { text })));
return;
}
out.append(h("div", { class: "field-markdown" }, rt.views.chat.renderMarkdown(text)));
};
bar.append(
toggle,
h("a", {
class: "audit-doc-open",
href: resolved,
target: "_blank",
rel: "noreferrer",
text: "Open raw file",
}),
);
wrap.append(bar, out);
out.append(h("div", { class: "muted", text: "Loading…" }));
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);
.then((body) => {
text = body;
draw();
})
.catch((error) => {
body.replaceChildren(h("div", { class: "muted", text: describeError(error) }));
out.replaceChildren(h("div", { class: "muted", text: describeError(error) }));
});
return body;
return wrap;
}
/** The exported session, rendered in place, with the raw file one click away. */
function auditSession(step) {
const artifact = systemArtifacts(step).find((entry) => entry.name === "session.html");
if (!artifact) return renderSessionExport(step);
const resolved = resolvedArtifactUrl(artifact, state.url);
const wrap = h("div", { class: "audit-session" });
if (!resolved) {
wrap.append(h("div", { class: "muted", text: ARTIFACT_SERVER_HINT }));
return wrap;
}
wrap.append(
h(
"div",
{ class: "audit-doc-bar" },
h("a", {
class: "audit-doc-open",
href: resolved,
target: "_blank",
rel: "noreferrer",
text: "Open raw file",
}),
),
);
wrap.append(
h("iframe", {
class: "audit-session-frame",
src: resolved,
title: `Session export · ${step.stage}`,
sandbox: "",
}),
);
return wrap;
}
/** The stage's own definition (prompt, tools, configs, edges) in the audit. */
@@ -356,8 +394,6 @@ function renderRunSummaryTab(d, now) {
),
);
// Everything the system wrote for each visit, behind one explicit door.
wrap.append(renderRunAuditSection(d));
return wrap;
}
+52 -2
View File
@@ -397,6 +397,54 @@ function fillSearchResults(area) {
area.replaceChildren(...nodes);
}
/** The inline glyph for a non-artifact search result's kind. */
function searchKindGlyph(kind) {
const ns = "http://www.w3.org/2000/svg";
const svg = document.createElementNS(ns, "svg");
svg.setAttribute("viewBox", "0 0 24 24");
svg.setAttribute("aria-hidden", "true");
svg.setAttribute("focusable", "false");
const paths = {
pipeline: "M7 12h5V6h4M12 12v6h4",
version: "M12 3l9 5-9 5-9-5 9-5ZM3 12l9 5 9-5",
run: "M8 5l11 7-11 7V5Z",
step: "M5 12h10M13 8l4 4-4 4",
field: "M5 7h14M5 12h14M5 17h9",
unknown: "M12 8v8M8 12h8",
};
const path = document.createElementNS(ns, "path");
path.setAttribute("d", paths[kind] ?? paths.unknown);
path.setAttribute("fill", "none");
path.setAttribute("stroke", "currentColor");
path.setAttribute("stroke-width", "1.8");
path.setAttribute("stroke-linecap", "round");
path.setAttribute("stroke-linejoin", "round");
svg.append(path);
if (kind === "pipeline") {
for (const [cx, cy] of [[4, 12], [19, 6], [19, 18]]) {
const dot = document.createElementNS(ns, "circle");
dot.setAttribute("cx", String(cx));
dot.setAttribute("cy", String(cy));
dot.setAttribute("r", "2");
dot.setAttribute("fill", "currentColor");
svg.append(dot);
}
}
return svg;
}
/** The fixed-size leading tile for a non-artifact result: a kind glyph only. */
function searchKindTile(hit) {
const label = searchResultKindLabel(hit);
const tile = h("span", {
class: "search-type search-type-kind",
title: label,
"aria-label": label,
});
tile.append(searchKindGlyph(String(hit?.kind ?? "unknown")));
return tile;
}
/** The short caption on a non-image artifact's type tile. */
function artifactTypeBadge(kind, artifact) {
const name = String(artifact?.name ?? "").toLowerCase();
@@ -460,7 +508,7 @@ function renderSearchResultRow(hit) {
const target = searchTarget(hit);
const artifactHit = hit?.kind === "artifact" && hit.artifact ? hit.artifact : null;
const element = h("div", {
class: `search-row${target ? " clickable" : " readonly"}${artifactHit ? " search-row-artifact" : ""}`,
class: `search-row${target ? " clickable" : " readonly"} search-row-with-icon${artifactHit ? " search-row-artifact" : ""}`,
"data-kind": String(hit?.kind ?? ""),
});
if (target) {
@@ -506,7 +554,9 @@ function renderSearchResultRow(hit) {
);
}
} else {
element.append(h("span", { class: "search-kind muted", text: searchResultKindLabel(hit) }));
// Every row leads with the same fixed-size tile; kinds are symbols, never
// words like "PIPELINE" that make one row look different from another.
element.append(searchKindTile(hit));
}
const main = h("div", { class: "search-row-main" });
main.append(h("div", { class: "search-row-title", text: row.title }));
+43
View File
@@ -0,0 +1,43 @@
// A shell cache for an installed Pipelines app. The API (the WebSocket proxy and
// artifact files) is never cached; static files prefer the network and fall back
// to the last good copy so an installed app still opens when the server is away.
const CACHE = "pipelines-shell-v1";
const SHELL = ["/", "/index.html", "/manifest.webmanifest", "/favicon.svg"];
self.addEventListener("install", (event) => {
event.waitUntil(
caches
.open(CACHE)
.then((cache) => cache.addAll(SHELL))
.catch(() => undefined)
.then(() => self.skipWaiting()),
);
});
self.addEventListener("activate", (event) => {
event.waitUntil(
caches
.keys()
.then((keys) => Promise.all(keys.filter((key) => key !== CACHE).map((key) => caches.delete(key))))
.then(() => self.clients.claim()),
);
});
self.addEventListener("fetch", (event) => {
const request = event.request;
if (request.method !== "GET") return;
const url = new URL(request.url);
if (url.origin !== self.location.origin) return;
if (url.pathname.startsWith("/connect") || url.pathname.startsWith("/artifacts/")) return;
event.respondWith(
fetch(request)
.then((response) => {
if (response.ok) {
const copy = response.clone();
caches.open(CACHE).then((cache) => cache.put(request, copy)).catch(() => undefined);
}
return response;
})
.catch(() => caches.match(request).then((cached) => cached ?? caches.match("/"))),
);
});