diff --git a/app/nullius/execution.py b/app/nullius/execution.py index f3c2758b..2e0d91d5 100644 --- a/app/nullius/execution.py +++ b/app/nullius/execution.py @@ -633,13 +633,13 @@ def summary(self) -> dict: def stages(self) -> dict: """The stages said so far, folded for the page (``progress.fold``). - Once the run has failed or been stopped, a stage still running was - cut short by it, and nothing is waiting any more.""" + Once the run has ended, no stage is running or waiting any more. + Counts remain exactly what the progress events reported.""" with self._lock: events = list(self.events) got = progress.fold(events) - if self.state in ("failed", "stopped"): - got["stages"] = [dict(r, state="failed") if r["state"] == "running" else r for r in got["stages"] if r["state"] != "waiting"] + if self.state in ("done", "failed", "stopped"): + got["stages"] = [dict(r, state="done" if self.state == "done" else "failed") if r["state"] == "running" else r for r in got["stages"] if r["state"] != "waiting"] got["current"] = None return got diff --git a/app/nullius/progress.py b/app/nullius/progress.py index bdfcb477..1208bb1f 100644 --- a/app/nullius/progress.py +++ b/app/nullius/progress.py @@ -271,6 +271,10 @@ def fold(events: Iterable[dict]) -> dict: stages[key]["key"] = key stages.setdefault(key, {"key": key, "stage": st, "label": label(ev), "state": "waiting"}) row = stages[key] + if state == "start": + # A later part or retry starts this stage afresh. + for field in ("seconds", "bytes", "total", "detail"): + row.pop(field, None) row["label"] = label(ev) if ev.get("detail") is not None: row["detail"] = ev["detail"] @@ -295,7 +299,7 @@ def fold(events: Iterable[dict]) -> dict: last = seen[-1] if seen else -1 rows = [r for i, r in enumerate(rows) if r["state"] != "waiting" or i > last] if ended: # a run that ended has nothing running, nor anything still to come - rows = [dict(r, state="failed") if r["state"] == "running" and ended == "refused" else r + rows = [dict(r, state="failed" if ended == "refused" else "done") if r["state"] == "running" else r for r in rows if r["state"] != "waiting"] current = next((r for r in rows if r["state"] == "running"), None) return {"stages": rows, "units": units, "current": current["key"] if current else None, "ended": ended, "detail": detail} diff --git a/app/static/runs/board.css b/app/static/runs/board.css index 43fe2e66..df7f4bd9 100644 --- a/app/static/runs/board.css +++ b/app/static/runs/board.css @@ -372,6 +372,19 @@ box-shadow: var(--shadow); font: 12px/1.45 var(--sans); color: var(--text); pointer-events: none; } @media (prefers-reduced-motion: reduce) { .rp *, .rp *::before, .rp *::after { transition: none !important; } } + +/* Run identity belongs on the full run overview, above its views. */ +.run-identity{align-items:center;gap:10px} +.run-identity-card{display:flex;align-items:center;gap:12px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);padding:9px 14px;min-width:0;max-width:100%;color:var(--text);line-height:1.5} +.run-identity-card>div{min-width:0;overflow-wrap:anywhere} +.run-identity-card .k{display:block;color:var(--text-dim);font-size:.75rem} +.run-identity-card .v{display:block;font-weight:500} +.run-identity-sep{width:1px;flex:none;align-self:stretch;background:var(--border)} +.run-identity-mark{width:32px;height:32px;border-radius:8px;background:var(--accent-soft);color:var(--accent);display:grid;place-items:center;font:500 15px/1 var(--mono);flex:none;padding:6px} +.run-identity-mark:has(.agent-logo){padding:4px;background:color-mix(in srgb,var(--text) 8%,transparent);color:var(--text)} +.run-identity-model{display:block;font-size:.8rem;color:var(--text-dim);overflow-wrap:anywhere} + +.run-runner-logo{width:32px;height:32px;flex:none;color:var(--text)} /* the Filtered score under the adjusted rate: a switch per kind of flag, and the rate without those tasks */ .rp .filtered { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; margin: 1rem 18px 0; } .rp .filtered .filter-heading { flex-basis: 100%; color: var(--text-faint); font-size: .8rem; } diff --git a/app/static/runs/live-board.css b/app/static/runs/live-board.css index 0f870e07..b8da7721 100644 --- a/app/static/runs/live-board.css +++ b/app/static/runs/live-board.css @@ -1,4 +1,4 @@ -/* The job page's two views, and the Live board. +/* The job page's views, and the Live board. Scoped to .lb; the phase and outcome hues are the app's own. */ /* ---- the two views ---- */ @@ -183,3 +183,5 @@ .lb-open-row:hover { text-decoration: underline; } /* the board counts the trials itself: the run strip's own task bar would say it twice */ body:has(#live-board) #execution-units { display: none; } + +.view-tabs [role="tab"]:disabled { color: var(--text-faint); cursor: default; } diff --git a/app/static/runs/live-board.js b/app/static/runs/live-board.js index f6a997bf..b7a9d787 100644 --- a/app/static/runs/live-board.js +++ b/app/static/runs/live-board.js @@ -307,8 +307,20 @@ let snap = null, timer = null, misses = 0; // opened while the run was going: the Results rendered with the page are older than its end const startedLive = board.dataset.state !== 'finished'; + let waiting = board.dataset.state === 'unknown'; function paint() { - if (!snap) return; + if (!snap || stateOf(snap) === 'unknown') return; + if (waiting) { + waiting = false; + doc.getElementById('preparing')?.remove(); + const liveTab = doc.getElementById('tab-live'); + if (liveTab) liveTab.disabled = false; + const resultsTab = doc.getElementById('tab-results'); + if (resultsTab) resultsTab.disabled = false; + const dot = doc.getElementById('live-dot'); + if (dot) dot.classList.toggle('on', stateOf(snap) !== 'finished'); + doc.dispatchEvent(new Event('live-ready')); + } const out = render(snap, opts); board.dataset.state = out.state; $('[data-lb-state]').textContent = out.stateLabel; @@ -338,8 +350,18 @@ async function tick() { try { const r = await nulliusFetch(endpoint, {headers: {'Accept': 'application/json'}, cache: 'no-store'}); - if (!r.ok) throw new Error('HTTP ' + r.status); - misses = 0; snap = await r.json(); + if (!r.ok) { + if (waiting && doc.getElementById('execution')?.dataset.live === 'no') { clearInterval(timer); timer = null; } + throw new Error('HTTP ' + r.status); + } + const next = await r.json(); + if (waiting && (next.state === 'unknown' || !next.counts)) { + if (next.state === 'finished' || doc.getElementById('execution')?.dataset.live === 'no') { + clearInterval(timer); timer = null; + } + return; + } + misses = 0; snap = next; } catch (e) { misses += 1; } paint(); } @@ -360,7 +382,7 @@ paint(); if (!snap || stateOf(snap) !== 'finished') { timer = setInterval(tick, 1000); tick(); } } - // The two views of the job page: switched in place, kept in the address as ?view=. + // The views of the job page: switched in place, kept in the address as ?view=. function mountTabs(doc) { const tabs = Array.from(doc.querySelectorAll('[data-view-tab]')); if (!tabs.length) return; @@ -376,11 +398,14 @@ if (view === 'results' && badge && badge.dataset.stale) { location.assign(u); return; } history.replaceState(null, '', u); } - tabs.forEach((t, i) => { + doc.addEventListener('live-ready', () => { + if (!new URL(location.href).searchParams.has('view')) show('live'); + }); + tabs.forEach(t => { t.addEventListener('click', () => show(t.dataset.viewTab)); t.addEventListener('keydown', e => { const d = e.key === 'ArrowRight' ? 1 : e.key === 'ArrowLeft' ? -1 : 0; - if (d) { e.preventDefault(); const n = tabs[(i + d + tabs.length) % tabs.length]; n.focus(); show(n.dataset.viewTab); } + if (d) { e.preventDefault(); const enabled = tabs.filter(t => !t.disabled); const i = enabled.indexOf(t); const n = enabled[(i + d + enabled.length) % enabled.length]; n.focus(); show(n.dataset.viewTab); } }); }); } diff --git a/app/static/traces/conversation.css b/app/static/traces/conversation.css index 69ae22b7..cd4ca46e 100644 --- a/app/static/traces/conversation.css +++ b/app/static/traces/conversation.css @@ -45,18 +45,24 @@ @media(max-width:850px){.reader-selected{padding:18px}.reader-layout{grid-template-columns:minmax(175px,30%) minmax(0,1fr)}.reader-step-nav{align-items:flex-start;flex-direction:column;gap:12px}} @media(max-width:600px){.reader-layout{grid-template-columns:minmax(0,1fr);min-height:0}.reader-index{border-right:0;border-bottom:1px solid var(--border)}.reader-rows{max-height:230px;overflow:auto}.reader-row{padding:10px 12px}.reader-row-preview{-webkit-line-clamp:1}.reader-selected{padding:16px}.reader-content pre{max-height:360px;padding:12px}.reader-search{gap:6px}.reader-toolbar{gap:10px}.reader-jump{width:100%}.reader-jump input{flex:1;min-width:0}.reader-content-nav{gap:6px;font-size:10px}.trial-tabs{gap:22px}.reader-filters{width:100%;justify-content:space-between}.reader-filters button{padding:7px 8px}} -/* the trial's head: what ran, then how it went, one row that wraps */ +/* The trial's own metrics, in a row that wraps. */ .trial-head{display:flex;flex-wrap:wrap;gap:10px;margin:14px 0 6px;align-items:stretch} -.th-card{display:flex;align-items:center;gap:12px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);padding:9px 14px;min-width:0} -.th-card .k,.th-strip .k{display:block;color:var(--text-dim);font-size:.75rem} -.th-card .v{display:block;font-weight:500} -.th-sep{width:1px;align-self:stretch;background:var(--border)} -.th-mark{width:32px;height:32px;border-radius:8px;background:var(--accent-soft);color:var(--accent);display:grid;place-items:center;font:500 15px/1 var(--mono);flex:none;padding:6px} -.th-mark:has(.agent-logo){padding:4px;background:color-mix(in srgb,var(--text) 8%,transparent);color:var(--text)} -.th-model{display:block;font-size:.8rem;color:var(--text-dim);overflow-wrap:anywhere} -/* The cells keep their own width: the strip sits beside the cards while all of them fit on one - line, moves under the cards when they do not, and wraps its cells when the page itself is narrower. - The 1px gaps over the border colour are the rules between cells, on every row. */ +.th-strip .k{display:block;color:var(--text-dim);font-size:.75rem} +/* The 1px gaps over the border colour separate the cells on every row. */ .th-strip{display:flex;flex-wrap:wrap;flex:1 0 auto;max-width:100%;gap:1px;background:var(--border);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden} .th-strip>div{flex:1 0 auto;padding:9px 14px;background:var(--surface);white-space:nowrap} .th-strip .n{display:block;font-size:1.1rem;font-weight:500;font-variant-numeric:tabular-nums} + +/* A shared model-usage card, with compact token and growth charts. */ +#task-usage .mix-bar{height:8px;width:100%} +.usage-section-title{font-size:11px;font-weight:500;letter-spacing:.08em;text-transform:uppercase;color:var(--text-dim);margin:16px 0 10px} +.usage-growth-title{margin-top:24px} + +.usage-stat{display:inline-flex;align-items:center;gap:6px;color:var(--text-dim);font-size:12px;cursor:default}.usage-stat b{color:var(--text);font-weight:500} + +.task-activity{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;align-items:start;margin-bottom:24px} +.task-activity>.panel,.task-activity-left>.panel{min-width:0;margin:0;padding:16px} +.task-activity-left{min-width:0;display:grid;gap:16px;align-content:start} +.usage-tools-table{overflow-x:auto} +#task-tools .tool-names td:first-child{white-space:normal;overflow-wrap:anywhere} +@media(max-width:1000px){.task-activity{grid-template-columns:minmax(0,1fr)}} diff --git a/app/templates/runs/_execution.html b/app/templates/runs/_execution.html index 558b8058..d026880f 100644 --- a/app/templates/runs/_execution.html +++ b/app/templates/runs/_execution.html @@ -31,12 +31,12 @@ {%- if st.state == 'cached' %}cached{% elif st.get('seconds') is not none and st.state in ('done', 'failed') %}{{ st.seconds|secs }}{% endif %} {%- if st.state in ('running', 'failed') and st.detail and st.detail != sp.detail %}{{ st.detail }}{% endif %}{% endfor %} -