nullius-eval 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- _nullius_app/.env.example +55 -0
- _nullius_app/app.py +96 -0
- _nullius_app/requirements.txt +1 -0
- _nullius_app/static/brand/README.md +20 -0
- _nullius_app/static/brand/docker.svg +1 -0
- _nullius_app/static/brand/favicon.svg +1 -0
- _nullius_app/static/brand/huggingface.svg +37 -0
- _nullius_app/static/brand/mark-dark.svg +1 -0
- _nullius_app/static/brand/marks.svg +34 -0
- _nullius_app/static/brand/tokens.json +51 -0
- _nullius_app/static/brand/typesafe.png +0 -0
- _nullius_app/static/brand/wordmark-dark.svg +1 -0
- _nullius_app/static/builder/command-builder-core.js +763 -0
- _nullius_app/static/builder/command-builder.css +248 -0
- _nullius_app/static/builder/command-builder.js +997 -0
- _nullius_app/static/builder/model-picker.js +113 -0
- _nullius_app/static/catalogue/add.js +46 -0
- _nullius_app/static/catalogue/agents/README.md +19 -0
- _nullius_app/static/catalogue/agents/goose.svg +1 -0
- _nullius_app/static/catalogue/agents/jiuwenswarm.svg +33 -0
- _nullius_app/static/catalogue/agents/marks.json +8 -0
- _nullius_app/static/catalogue/agents/mini-swe-agent.svg +7 -0
- _nullius_app/static/catalogue/agents/opencode.svg +7 -0
- _nullius_app/static/catalogue/catalogue.css +436 -0
- _nullius_app/static/catalogue/catalogue.js +87 -0
- _nullius_app/static/catalogue/marks.svg +29 -0
- _nullius_app/static/catalogue/new.js +78 -0
- _nullius_app/static/catalogue/versions.js +27 -0
- _nullius_app/static/compare/comparison.css +117 -0
- _nullius_app/static/controls.js +117 -0
- _nullius_app/static/disclosures.js +70 -0
- _nullius_app/static/fonts/0569c822cab6c510.ttf +0 -0
- _nullius_app/static/fonts/DMSans-Medium.woff2 +0 -0
- _nullius_app/static/fonts/DMSans-Regular.woff2 +0 -0
- _nullius_app/static/fonts/IBMPlexMono-Medium.woff2 +0 -0
- _nullius_app/static/fonts/IBMPlexMono-Regular.woff2 +0 -0
- _nullius_app/static/fonts/InstrumentSerif-Italic.woff2 +0 -0
- _nullius_app/static/fonts/InstrumentSerif-Regular.woff2 +0 -0
- _nullius_app/static/fonts/README.md +11 -0
- _nullius_app/static/fonts/c1e7453ea26a1d1e.ttf +0 -0
- _nullius_app/static/fonts/dmsans-OFL.txt +93 -0
- _nullius_app/static/fonts/ibmplexmono-OFL.txt +93 -0
- _nullius_app/static/fonts/instrumentserif-OFL.txt +93 -0
- _nullius_app/static/fonts.css +49 -0
- _nullius_app/static/notifications.js +49 -0
- _nullius_app/static/onboarding.css +78 -0
- _nullius_app/static/onboarding.js +158 -0
- _nullius_app/static/runs/board.css +358 -0
- _nullius_app/static/runs/board.js +127 -0
- _nullius_app/static/runs/launches.css +88 -0
- _nullius_app/static/runs/live-board.css +186 -0
- _nullius_app/static/runs/live-board.js +394 -0
- _nullius_app/static/runs/path-suggestions.js +119 -0
- _nullius_app/static/runs/start.css +38 -0
- _nullius_app/static/settings/autosave.js +162 -0
- _nullius_app/static/settings/custom-keys.js +100 -0
- _nullius_app/static/settings/data-providers.js +88 -0
- _nullius_app/static/settings/judges.js +61 -0
- _nullius_app/static/settings/modal.css +32 -0
- _nullius_app/static/settings/modal.js +91 -0
- _nullius_app/static/settings/navigation.js +55 -0
- _nullius_app/static/settings/prices.js +68 -0
- _nullius_app/static/settings/providers.js +134 -0
- _nullius_app/static/settings/sandbox.js +20 -0
- _nullius_app/static/settings/settings.css +288 -0
- _nullius_app/static/style.css +1752 -0
- _nullius_app/static/traces/conversation.css +49 -0
- _nullius_app/static/traces/conversation.js +215 -0
- _nullius_app/templates/agents/entry.html +145 -0
- _nullius_app/templates/agents/kits.html +55 -0
- _nullius_app/templates/agents/standard.html +58 -0
- _nullius_app/templates/base.html +479 -0
- _nullius_app/templates/builder/new_run.html +55 -0
- _nullius_app/templates/catalogue/add_dialog.html +32 -0
- _nullius_app/templates/catalogue/benchmark.html +270 -0
- _nullius_app/templates/catalogue/benchmarks.html +91 -0
- _nullius_app/templates/catalogue/new.html +141 -0
- _nullius_app/templates/catalogue/use_bundle.html +11 -0
- _nullius_app/templates/compare/_detail.html +37 -0
- _nullius_app/templates/compare/compare.html +298 -0
- _nullius_app/templates/compare/compare_picker.html +51 -0
- _nullius_app/templates/compare/compare_task.html +329 -0
- _nullius_app/templates/runs/_execution.html +131 -0
- _nullius_app/templates/runs/_runtime.html +5 -0
- _nullius_app/templates/runs/ascii-mark.html +485 -0
- _nullius_app/templates/runs/feasibility.html +127 -0
- _nullius_app/templates/runs/index.html +609 -0
- _nullius_app/templates/runs/job.html +460 -0
- _nullius_app/templates/runs/preparing.html +14 -0
- _nullius_app/templates/runs/reconcile.html +124 -0
- _nullius_app/templates/runs/setup.html +272 -0
- _nullius_app/templates/runs/start.html +51 -0
- _nullius_app/templates/settings/custom_keys.html +82 -0
- _nullius_app/templates/settings/data_providers.html +27 -0
- _nullius_app/templates/settings/settings.html +564 -0
- _nullius_app/templates/traces/_charts.html +165 -0
- _nullius_app/templates/traces/_conversation.html +37 -0
- _nullius_app/templates/traces/_judgement.html +72 -0
- _nullius_app/templates/traces/artifact.html +15 -0
- _nullius_app/templates/traces/trial.html +838 -0
- _nullius_app/templates/workspaces/workspaces.html +54 -0
- _nullius_app/web/__init__.py +1 -0
- _nullius_app/web/agents.py +230 -0
- _nullius_app/web/builder.py +406 -0
- _nullius_app/web/catalogue.py +370 -0
- _nullius_app/web/compare.py +489 -0
- _nullius_app/web/core.py +17 -0
- _nullius_app/web/execute.py +223 -0
- _nullius_app/web/feasibility.py +60 -0
- _nullius_app/web/filters.py +231 -0
- _nullius_app/web/judge.py +623 -0
- _nullius_app/web/judge_tasks.py +33 -0
- _nullius_app/web/onboarding.py +20 -0
- _nullius_app/web/reconcile.py +47 -0
- _nullius_app/web/runs.py +464 -0
- _nullius_app/web/settings.py +324 -0
- _nullius_app/web/shared.py +507 -0
- _nullius_app/web/traces.py +306 -0
- _nullius_app/web/workspaces.py +84 -0
- nullius/__init__.py +32 -0
- nullius/__main__.py +5 -0
- nullius/catalogue/__init__.py +0 -0
- nullius/catalogue/agents/codex/agent.json +222 -0
- nullius/catalogue/agents/codex/config.toml +25 -0
- nullius/catalogue/agents/goose/agent.json +131 -0
- nullius/catalogue/agents/goose/config.yaml +20 -0
- nullius/catalogue/agents/jiuwenswarm/agent.json +197 -0
- nullius/catalogue/agents/jiuwenswarm/agent.py +355 -0
- nullius/catalogue/agents/mini-swe-agent/agent.json +68 -0
- nullius/catalogue/agents/mini-swe-agent/run.py +37 -0
- nullius/catalogue/agents/opencode/agent.json +135 -0
- nullius/catalogue/agents/opencode/opencode.json +32 -0
- nullius/catalogue/agents/reference/agent.json +89 -0
- nullius/catalogue/agents/reference/agent.py +209 -0
- nullius/catalogue/agents/terminus-2/agent.json +64 -0
- nullius/catalogue/agents/terminus-2/run.py +139 -0
- nullius/catalogue/benchmarks/gaia/benchmark.json +72 -0
- nullius/catalogue/benchmarks/gaia/data-source.json +29 -0
- nullius/catalogue/benchmarks/gaia/driver.py +188 -0
- nullius/catalogue/benchmarks/gaia/env/data.Dockerfile +1 -0
- nullius/catalogue/benchmarks/gaia/standard.json +278 -0
- nullius/catalogue/benchmarks/gaia/upstream-settings.json +275 -0
- nullius/catalogue/benchmarks/gsm8k/benchmark.json +34 -0
- nullius/catalogue/benchmarks/gsm8k/driver.py +101 -0
- nullius/catalogue/benchmarks/gsm8k/standard.json +124 -0
- nullius/catalogue/benchmarks/gsm8k/upstream-settings.json +86 -0
- nullius/catalogue/benchmarks/humaneval/benchmark.json +36 -0
- nullius/catalogue/benchmarks/humaneval/driver.py +243 -0
- nullius/catalogue/benchmarks/humaneval/standard.json +115 -0
- nullius/catalogue/benchmarks/humaneval/upstream-settings.json +72 -0
- nullius/catalogue/benchmarks/locomo/benchmark.json +43 -0
- nullius/catalogue/benchmarks/locomo/driver.py +270 -0
- nullius/catalogue/benchmarks/locomo/standard.json +265 -0
- nullius/catalogue/benchmarks/locomo/upstream-settings.json +112 -0
- nullius/catalogue/benchmarks/longmemeval/benchmark.json +65 -0
- nullius/catalogue/benchmarks/longmemeval/driver.py +379 -0
- nullius/catalogue/benchmarks/longmemeval/standard.json +733 -0
- nullius/catalogue/benchmarks/longmemeval/upstream-settings.json +76 -0
- nullius/catalogue/benchmarks/swe-bench-verified/benchmark.json +87 -0
- nullius/catalogue/benchmarks/swe-bench-verified/driver.py +116 -0
- nullius/catalogue/benchmarks/swe-bench-verified/images.json +502 -0
- nullius/catalogue/benchmarks/swe-bench-verified/standard.json +108 -0
- nullius/catalogue/benchmarks/swe-bench-verified/upstream-settings.json +32 -0
- nullius/catalogue/benchmarks/tau3-bench/benchmark.json +49 -0
- nullius/catalogue/benchmarks/tau3-bench/driver.py +608 -0
- nullius/catalogue/benchmarks/tau3-bench/mcp_server.py +114 -0
- nullius/catalogue/benchmarks/tau3-bench/search_relay.py +19 -0
- nullius/catalogue/benchmarks/tau3-bench/standard.json +547 -0
- nullius/catalogue/benchmarks/tau3-bench/upstream-settings.json +639 -0
- nullius/catalogue/benchmarks/terminal-bench/benchmark.json +69 -0
- nullius/catalogue/benchmarks/terminal-bench/driver.py +267 -0
- nullius/catalogue/benchmarks/terminal-bench/standard.json +166 -0
- nullius/catalogue/benchmarks/terminal-bench/upstream-settings.json +36 -0
- nullius/catalogue/capabilities/keyword-memory/capability.json +33 -0
- nullius/catalogue/capabilities/keyword-memory/capability.py +55 -0
- nullius/catalogue/capabilities/mem0/capability.json +135 -0
- nullius/catalogue/capabilities/mem0/capability.py +173 -0
- nullius/catalogue/catalog.py +426 -0
- nullius/catalogue/citation.py +116 -0
- nullius/catalogue/harbor_entry.py +367 -0
- nullius/catalogue/sources.py +107 -0
- nullius/catalogue/storage.py +125 -0
- nullius/cli.py +85 -0
- nullius/compare/__init__.py +0 -0
- nullius/compare/cli.py +265 -0
- nullius/compare/comparison.py +184 -0
- nullius/execution.py +1653 -0
- nullius/gitrefs.py +128 -0
- nullius/harbor/__init__.py +0 -0
- nullius/harbor/feed.py +228 -0
- nullius/harbor/source.py +582 -0
- nullius/hosts.py +368 -0
- nullius/importers/__init__.py +140 -0
- nullius/importers/atif.py +387 -0
- nullius/importers/cli.py +135 -0
- nullius/importers/otel.py +274 -0
- nullius/judge/__init__.py +14 -0
- nullius/judge/batch.py +122 -0
- nullius/judge/client.py +433 -0
- nullius/judge/floors.json +86 -0
- nullius/judge/lanes.py +89 -0
- nullius/judge/questions.py +309 -0
- nullius/judge/reconcile.py +176 -0
- nullius/judge/state.py +224 -0
- nullius/judge/store.py +167 -0
- nullius/migrate.py +268 -0
- nullius/onboarding.py +116 -0
- nullius/paths.py +89 -0
- nullius/prerequisites.py +129 -0
- nullius/prices.py +283 -0
- nullius/progress.py +294 -0
- nullius/providers.py +335 -0
- nullius/recipes/__init__.py +0 -0
- nullius/recipes/launch.py +78 -0
- nullius/redact.py +72 -0
- nullius/runs/__init__.py +0 -0
- nullius/runs/artifacts.py +67 -0
- nullius/runs/classify.py +216 -0
- nullius/runs/cli.py +316 -0
- nullius/runs/feasibility.py +442 -0
- nullius/runs/launches.py +149 -0
- nullius/runs/live.py +715 -0
- nullius/runs/parse.py +1016 -0
- nullius/runs/verifier.py +241 -0
- nullius/sandbox.py +109 -0
- nullius/secrets.py +218 -0
- nullius/settings.py +544 -0
- nullius/standard/__init__.py +15 -0
- nullius/standard/acp.py +305 -0
- nullius/standard/cancellation.py +19 -0
- nullius/standard/cli.py +703 -0
- nullius/standard/conform.py +149 -0
- nullius/standard/container.py +1870 -0
- nullius/standard/definitions.py +1651 -0
- nullius/standard/egress.py +192 -0
- nullius/standard/fidelity.py +256 -0
- nullius/standard/forward.py +139 -0
- nullius/standard/hostreq.py +105 -0
- nullius/standard/howto.py +220 -0
- nullius/standard/install.py +428 -0
- nullius/standard/job.py +551 -0
- nullius/standard/jsonl.py +129 -0
- nullius/standard/kits/agent-conversation-v1/driver.py +27 -0
- nullius/standard/kits/agent-conversation-v1/standard.json +26 -0
- nullius/standard/kits/agent-search-v1/driver.py +171 -0
- nullius/standard/kits/agent-search-v1/standard.json +99 -0
- nullius/standard/kits/agent-task-v1/driver.py +25 -0
- nullius/standard/kits/agent-task-v1/standard.json +100 -0
- nullius/standard/kits/agent-tools-v1/driver.py +206 -0
- nullius/standard/kits/agent-tools-v1/mcp_kit.py +209 -0
- nullius/standard/kits/agent-tools-v1/standard.json +119 -0
- nullius/standard/kits/agent-workspace-v1/driver.py +65 -0
- nullius/standard/kits/agent-workspace-v1/standard.json +95 -0
- nullius/standard/kits/cap-memory-v1/driver.py +39 -0
- nullius/standard/kits/cap-memory-v1/standard.json +91 -0
- nullius/standard/ledger.py +326 -0
- nullius/standard/match.py +66 -0
- nullius/standard/mcp_bridge.py +62 -0
- nullius/standard/mcp_machine.py +193 -0
- nullius/standard/merge.py +239 -0
- nullius/standard/names.py +37 -0
- nullius/standard/network_requirements.py +44 -0
- nullius/standard/pace.py +53 -0
- nullius/standard/payload.py +278 -0
- nullius/standard/pins.py +130 -0
- nullius/standard/ports.py +70 -0
- nullius/standard/prove.py +373 -0
- nullius/standard/recipe.py +746 -0
- nullius/standard/relay.py +785 -0
- nullius/standard/run.py +1781 -0
- nullius/standard/setup_container.py +208 -0
- nullius/standard/shard.py +71 -0
- nullius/standard/web_services.py +30 -0
- nullius/traces/__init__.py +0 -0
- nullius/traces/behavior.py +131 -0
- nullius/traces/charts.py +898 -0
- nullius/traces/conversation.py +159 -0
- nullius/traces/otel.py +608 -0
- nullius/traces/trace.py +1477 -0
- nullius/traces/trajectory.py +586 -0
- nullius/workspace.py +417 -0
- nullius/workspace_cli.py +119 -0
- nullius_eval-0.1.0.dist-info/METADATA +93 -0
- nullius_eval-0.1.0.dist-info/RECORD +291 -0
- nullius_eval-0.1.0.dist-info/WHEEL +5 -0
- nullius_eval-0.1.0.dist-info/entry_points.txt +2 -0
- nullius_eval-0.1.0.dist-info/licenses/LICENSE +202 -0
- nullius_eval-0.1.0.dist-info/licenses/app/static/fonts/dmsans-OFL.txt +93 -0
- nullius_eval-0.1.0.dist-info/licenses/app/static/fonts/ibmplexmono-OFL.txt +93 -0
- nullius_eval-0.1.0.dist-info/licenses/app/static/fonts/instrumentserif-OFL.txt +93 -0
- nullius_eval-0.1.0.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/* The job page's two views, and the Live board.
|
|
2
|
+
One board: a header line, one stats strip, the outcome bar with its chips, every trial as a tile, one table with
|
|
3
|
+
a row per trial in flight, and a drawer for one trial. Scoped to .lb; the phase and outcome hues are the app's own. */
|
|
4
|
+
|
|
5
|
+
/* ---- the two views ---- */
|
|
6
|
+
.view-tabs { display: flex; align-items: flex-end; gap: 2px; margin: 0 0 16px; border-bottom: 1px solid var(--border-soft); }
|
|
7
|
+
.view-tabs [role="tab"] { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px 10px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent;
|
|
8
|
+
background: none; font: 500 14px var(--sans); color: var(--text-dim); cursor: pointer; }
|
|
9
|
+
.view-tabs [role="tab"][aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
|
|
10
|
+
.view-tabs [role="tab"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
|
|
11
|
+
.view-tabs .live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
|
|
12
|
+
.view-tabs .live-dot.on { background: var(--resolved); animation: lb-beat 2s infinite; }
|
|
13
|
+
.view-tabs .results-badge { font: 400 11.5px var(--sans); color: var(--text-faint); }
|
|
14
|
+
.view-tabs .results-badge.ready { font: 500 10.5px/16px var(--sans); letter-spacing: .05em; text-transform: uppercase; padding: 0 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); }
|
|
15
|
+
@keyframes lb-beat { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--resolved) 55%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
|
|
16
|
+
|
|
17
|
+
/* ---- hues: a feed outcome, and a phase ---- */
|
|
18
|
+
.lb { --lb-track: color-mix(in srgb, var(--text-faint) 16%, var(--surface)); --lb-hair: var(--border-soft); }
|
|
19
|
+
.lb .lbo-resolved { --c: var(--resolved); } .lb .lbo-unresolved { --c: var(--failed_verification); } .lb .lbo-scored { --c: var(--scored); }
|
|
20
|
+
.lb .lbo-agent_error { --c: var(--agent_error); } .lb .lbo-infra_error { --c: var(--rate_limited); }
|
|
21
|
+
.lb .lbo-timeout { --c: var(--patch_failed_tests); } .lb .lbo-budget { --c: var(--spending_cap); } .lb .lbo-cancelled { --c: var(--unknown); }
|
|
22
|
+
.lb .lbp-env_setup { --c: var(--rate_limited); } .lb .lbp-agent_setup { --c: var(--patch_failed_tests); }
|
|
23
|
+
.lb .lbp-agent_run { --c: var(--accent); } .lb .lbp-verify { --c: var(--ph-verify); }
|
|
24
|
+
|
|
25
|
+
.lb { border: 1px solid var(--lb-hair); border-radius: var(--radius); background: var(--surface); overflow: hidden; margin-bottom: 18px; }
|
|
26
|
+
.lb [hidden] { display: none !important; }
|
|
27
|
+
.lb-headline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; padding: 13px 18px; border-bottom: 1px solid var(--lb-hair); font-size: 13px; }
|
|
28
|
+
.lb-state { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
|
|
29
|
+
.lb-state i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
|
|
30
|
+
.lb[data-state="running"] .lb-state i { background: var(--resolved); animation: lb-beat 2s infinite; }
|
|
31
|
+
.lb[data-state="preparing"] .lb-state i, .lb[data-state="starting"] .lb-state i { background: var(--warn, var(--patch_failed_tests)); animation: lb-beat 2s infinite; }
|
|
32
|
+
.lb[data-state="finished"] .lb-state i { background: var(--resolved); }
|
|
33
|
+
.lb-clock { font: 12.5px var(--mono); color: var(--text-dim); }
|
|
34
|
+
.lb-meta { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--text-dim); font-size: 12.5px; }
|
|
35
|
+
.lb-meta b { color: var(--text); font: 500 12.5px var(--mono); }
|
|
36
|
+
|
|
37
|
+
.lb-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) repeat(2, minmax(0, 1.2fr)); border-bottom: 1px solid var(--lb-hair); }
|
|
38
|
+
.lb-stat { padding: 11px 18px 12px; border-right: 1px solid var(--lb-hair); min-width: 0; }
|
|
39
|
+
.lb-stat:last-child { border-right: 0; }
|
|
40
|
+
.lb-stat .k { display: block; color: var(--text-dim); font-size: 12px; white-space: nowrap; }
|
|
41
|
+
.lb-stat .k small { color: var(--text-faint); font-size: 11px; }
|
|
42
|
+
.lb-stat .v { display: block; font: 500 21px/1.25 var(--sans); letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
43
|
+
.lb-stat .v small { font-size: 13px; color: var(--text-dim); font-weight: 400; letter-spacing: 0; margin-left: 2px; }
|
|
44
|
+
.lb-stat .v.na { color: var(--text-faint); font-weight: 400; }
|
|
45
|
+
.lb-stat.rate { background: color-mix(in srgb, var(--accent-soft) 50%, transparent); }
|
|
46
|
+
|
|
47
|
+
.lb-mix { display: grid; gap: 9px; padding: 12px 18px; border-bottom: 1px solid var(--lb-hair); }
|
|
48
|
+
.lb-mixbar { display: flex; height: 12px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
|
|
49
|
+
.lb-mixbar span { display: block; height: 100%; background: var(--c); transition: flex-basis .35s ease, opacity .2s; }
|
|
50
|
+
.lb-mixbar span + span { box-shadow: inset 2px 0 0 var(--surface); }
|
|
51
|
+
.lb-legend { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0; padding: 0; list-style: none; }
|
|
52
|
+
.lb-legend button { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 8px; border-radius: 999px; border: 1px solid var(--lb-hair); background: none;
|
|
53
|
+
font: 12.5px var(--sans); color: var(--text-dim); cursor: pointer; font-variant-numeric: tabular-nums; }
|
|
54
|
+
.lb-legend button i { width: 9px; height: 9px; border-radius: 2px; background: var(--c); }
|
|
55
|
+
.lb-legend button b { color: var(--text); font-weight: 500; }
|
|
56
|
+
.lb-legend button[aria-pressed="true"] { border-color: var(--text-dim); background: var(--surface-2); color: var(--text); }
|
|
57
|
+
.lb-legend button:disabled { opacity: .45; cursor: default; }
|
|
58
|
+
.lb-legend .lb-clear { border-style: dashed; }
|
|
59
|
+
.lb-lanes { display: grid; gap: 6px; font-size: 12.5px; color: var(--text-dim); }
|
|
60
|
+
.lb-lane .agent { font: 500 12.5px var(--mono); color: var(--text); }
|
|
61
|
+
.lb-lane b { color: var(--text); font-weight: 500; }
|
|
62
|
+
.lb-winners { overflow-x: auto; }
|
|
63
|
+
.lb-winners table { border-collapse: collapse; font-size: 12.5px; }
|
|
64
|
+
.lb-winners th { text-align: left; font: 400 11.5px var(--sans); color: var(--text-dim); padding: 4px 14px 4px 0; border-bottom: 1px solid var(--lb-hair); white-space: nowrap; }
|
|
65
|
+
.lb-winners td { padding: 4px 14px 4px 0; border-bottom: 1px solid var(--lb-hair); white-space: nowrap; }
|
|
66
|
+
.lb-winners .num { text-align: right; font: 12px var(--mono); }
|
|
67
|
+
.lb-winners .task { font: 12px var(--mono); max-width: 22rem; overflow: hidden; text-overflow: ellipsis; }
|
|
68
|
+
.lb-win { font-weight: 500; font-family: var(--mono); }
|
|
69
|
+
.lb-open { color: var(--patch_failed_tests); }
|
|
70
|
+
.lb-note { margin: 6px 0 0; font-size: 12px; color: var(--text-faint); }
|
|
71
|
+
.lb .na { color: var(--text-faint); }
|
|
72
|
+
|
|
73
|
+
.lb-body { display: grid; grid-template-columns: minmax(0, 1fr) 0; transition: grid-template-columns .3s ease; }
|
|
74
|
+
.lb.open .lb-body { grid-template-columns: minmax(0, 1fr) 380px; }
|
|
75
|
+
.lb-main { min-width: 0; }
|
|
76
|
+
.lb-tiles-wrap { display: flex; align-items: center; gap: 14px; padding: 11px 18px; border-bottom: 1px solid var(--lb-hair); }
|
|
77
|
+
.lb-tiles-wrap > span { color: var(--text-dim); font-size: 12px; flex: none; }
|
|
78
|
+
.lb-tiles { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; min-width: 0; }
|
|
79
|
+
.lb-tile { position: relative; width: 24px; height: 24px; padding: 0; border-radius: 4px; border: 1px dashed color-mix(in srgb, var(--text-faint) 60%, transparent);
|
|
80
|
+
background: none; cursor: pointer; overflow: hidden; }
|
|
81
|
+
.lb-tile i { position: absolute; left: 3px; bottom: 3px; height: 3px; width: calc(var(--p, 0) * (100% - 6px)); border-radius: 2px; background: var(--c, var(--accent)); transition: width .35s linear; }
|
|
82
|
+
.lb-tile.running { border: 1.5px solid var(--c); background: color-mix(in srgb, var(--c) 8%, transparent); }
|
|
83
|
+
.lb-tile.done { border: 0; }
|
|
84
|
+
.lb-tile.done i { inset: 0; width: auto; height: auto; border-radius: 0; background: var(--c); }
|
|
85
|
+
.lb-tile.dim, .lb-row.dim { opacity: .28; }
|
|
86
|
+
.lb-tile[aria-current="true"] { outline: 2px solid var(--text); outline-offset: 2px; }
|
|
87
|
+
.lb-tiles.many { gap: 4px; }
|
|
88
|
+
.lb-tiles.many .lb-tile { width: 18px; height: 18px; border-radius: 3px; }
|
|
89
|
+
.lb-tiles.many .lb-tile i { left: 3px; bottom: 3px; height: 2px; width: calc(var(--p, 0) * (100% - 6px)); }
|
|
90
|
+
.lb-tiles.many .lb-tile.done i { inset: 0; width: auto; height: auto; border-radius: 0; }
|
|
91
|
+
|
|
92
|
+
.lb-scroll { overflow-x: auto; }
|
|
93
|
+
.lb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
|
|
94
|
+
.lb-table th { text-align: left; font: 400 11.5px var(--sans); color: var(--text-dim); padding: 9px 12px 7px; border-bottom: 1px solid var(--lb-hair); white-space: nowrap; }
|
|
95
|
+
.lb-table th:first-child, .lb-table td:first-child { padding-left: 18px; }
|
|
96
|
+
.lb-table .num { text-align: right; font: 12.5px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
97
|
+
.lb-table td { padding: 9px 12px; border-bottom: 1px solid var(--lb-hair); vertical-align: middle; }
|
|
98
|
+
.lb-row { cursor: pointer; transition: background .2s, opacity .2s; }
|
|
99
|
+
.lb-row:hover, .lb-row[aria-current="true"] { background: var(--surface-2); }
|
|
100
|
+
.lb-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
|
|
101
|
+
.lb-row .task { display: inline-block; font: 500 12.5px var(--mono); max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
|
|
102
|
+
.lb-row small { font-size: 11.5px; color: var(--text-faint); margin-left: 6px; }
|
|
103
|
+
.lb-phase { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 12.5px; }
|
|
104
|
+
.lb-ticks { display: inline-flex; gap: 3px; }
|
|
105
|
+
.lb-ticks s { width: 11px; height: 4px; border-radius: 2px; background: var(--lb-track); text-decoration: none; }
|
|
106
|
+
.lb-ticks s.done { background: var(--text-dim); } .lb-ticks s.now { background: var(--c); }
|
|
107
|
+
.lb-limit { display: grid; grid-template-columns: minmax(70px, 1fr) auto; gap: 9px; align-items: center; min-width: 170px; }
|
|
108
|
+
.lb-bar { height: 5px; border-radius: 3px; background: var(--lb-track); overflow: hidden; }
|
|
109
|
+
.lb-bar i { display: block; height: 100%; background: var(--c); border-radius: 0 3px 3px 0; transition: width .35s linear; }
|
|
110
|
+
.lb-bar.near i { background: var(--patch_failed_tests); }
|
|
111
|
+
.lb-limit > span:last-child { font: 12px var(--mono); color: var(--text-dim); white-space: nowrap; }
|
|
112
|
+
.lb-limit b { color: var(--text); font-weight: 500; }
|
|
113
|
+
.lb-line { display: inline-block; font: 12px var(--mono); color: var(--text-dim); max-width: 30rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
|
|
114
|
+
.lb-red { color: var(--patch_failed_tests); }
|
|
115
|
+
.lb-more { display: flex; align-items: center; gap: 12px; padding: 9px 18px; border-bottom: 1px solid var(--lb-hair); font-size: 12.5px; color: var(--text-dim); }
|
|
116
|
+
.lb-quiet { margin: 0; padding: 14px 18px; font-size: 13px; color: var(--text-dim); }
|
|
117
|
+
.lb-settle { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 18px; align-items: center; padding: 14px 18px; background: color-mix(in srgb, var(--resolved) 7%, var(--surface)); }
|
|
118
|
+
.lb-settle p { margin: 0; font-size: 13.5px; }
|
|
119
|
+
.lb-settle small { display: block; color: var(--text-faint); font-size: 12px; margin-top: 2px; }
|
|
120
|
+
.lb-foot { padding: 9px 18px; font-size: 12px; color: var(--text-faint); border-top: 1px solid var(--lb-hair); }
|
|
121
|
+
|
|
122
|
+
/* ---- the drawer: one trial; its phases drawn on its own clock ---- */
|
|
123
|
+
.lb-drawer { min-width: 0; width: 380px; padding: 14px 18px 16px; display: grid; gap: 14px; align-content: start; border-left: 1px solid var(--lb-hair);
|
|
124
|
+
background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
|
|
125
|
+
.lb-drawer header { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
|
|
126
|
+
.lb-drawer h3 { margin: 0; font: 500 13.5px/1.35 var(--mono); text-transform: none; letter-spacing: 0; color: var(--text); overflow-wrap: anywhere; }
|
|
127
|
+
.lb-drawer h3 small { display: block; margin-top: 3px; font: 400 12px var(--sans); text-transform: none; letter-spacing: 0; color: var(--text-dim); }
|
|
128
|
+
.lb-x { width: 28px; height: 28px; flex: none; border: 1px solid var(--lb-hair); border-radius: 7px; background: var(--surface); cursor: pointer; font-size: 16px; line-height: 1; color: var(--text-dim); }
|
|
129
|
+
.lb-river { display: grid; gap: 6px; }
|
|
130
|
+
.lb-rl { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-dim); }
|
|
131
|
+
.lb-track { position: relative; height: 22px; border-radius: 4px; background: var(--lb-track); }
|
|
132
|
+
.lb-seg { position: absolute; top: 4px; bottom: 4px; background: var(--c); border-radius: 2px; transition: width .35s linear, left .35s linear; }
|
|
133
|
+
.lb-seg.now { top: 2px; bottom: 2px; box-shadow: 0 0 0 1.5px var(--surface), 0 0 0 3px color-mix(in srgb, var(--c) 45%, transparent); }
|
|
134
|
+
.lb-seg.near { background: repeating-linear-gradient(135deg, var(--c) 0 5px, color-mix(in srgb, var(--c) 55%, var(--surface)) 5px 8px); }
|
|
135
|
+
.lb-left { position: absolute; top: 2px; bottom: 2px; border: 1px dashed color-mix(in srgb, var(--c) 75%, transparent); border-left: 0; border-radius: 0 3px 3px 0; }
|
|
136
|
+
.lb-cap { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--surface); }
|
|
137
|
+
.lb-pl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
|
|
138
|
+
.lb-pl span { display: grid; gap: 1px; font-size: 11.5px; color: var(--text-dim); }
|
|
139
|
+
.lb-pl span i { width: 14px; height: 4px; border-radius: 2px; background: var(--c); margin-bottom: 3px; }
|
|
140
|
+
.lb-pl span b { font: 500 12px var(--mono); color: var(--text); }
|
|
141
|
+
.lb-pl span.later b { color: var(--text-faint); font-weight: 400; }
|
|
142
|
+
.lb-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; margin: 0; }
|
|
143
|
+
.lb-facts div { display: grid; }
|
|
144
|
+
.lb-facts dt { font-size: 11.5px; color: var(--text-dim); }
|
|
145
|
+
.lb-facts dd { margin: 0; font: 500 13px var(--mono); }
|
|
146
|
+
.lb-evl { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-dim); }
|
|
147
|
+
.lb-ev { display: grid; gap: 3px; font: 11.5px var(--mono); }
|
|
148
|
+
.lb-ev div { display: grid; grid-template-columns: 4.6rem 6.4rem minmax(0, 1fr); gap: 8px; color: var(--text-dim); }
|
|
149
|
+
.lb-ev div span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
150
|
+
.lb-ev .e { color: var(--text); }
|
|
151
|
+
.lb-open-trial { font-size: 12.5px; color: var(--accent); }
|
|
152
|
+
.lb-last { margin: 0; display: grid; gap: 3px; font: 12px var(--mono); color: var(--text-dim); overflow-wrap: anywhere; }
|
|
153
|
+
.lb-last span { font: 11.5px var(--sans); color: var(--text-dim); }
|
|
154
|
+
|
|
155
|
+
@media (max-width: 1000px) {
|
|
156
|
+
.lb-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
157
|
+
.lb-stat:nth-child(3n) { border-right: 0; }
|
|
158
|
+
.lb-stat { border-bottom: 1px solid var(--lb-hair); }
|
|
159
|
+
.lb-body, .lb.open .lb-body { grid-template-columns: minmax(0, 1fr); }
|
|
160
|
+
.lb-drawer { width: auto; border-left: 0; border-top: 1px solid var(--lb-hair); }
|
|
161
|
+
}
|
|
162
|
+
@media (max-width: 640px) {
|
|
163
|
+
.lb-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--lb-hair); }
|
|
164
|
+
.lb-stat { grid-column: span 2; border: 0 !important; background: var(--surface); padding: 9px 12px; }
|
|
165
|
+
.lb-stat:nth-child(4), .lb-stat.rate { grid-column: span 3; }
|
|
166
|
+
.lb-stat.rate { background: color-mix(in srgb, var(--accent-soft) 50%, var(--surface)); }
|
|
167
|
+
.lb-stat .v { font-size: 18px; }
|
|
168
|
+
.lb-meta { margin-left: 0; }
|
|
169
|
+
.lb-tiles-wrap { flex-direction: column; align-items: start; gap: 8px; }
|
|
170
|
+
.lb-settle { grid-template-columns: minmax(0, 1fr); }
|
|
171
|
+
.lb-facts, .lb-pl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
172
|
+
}
|
|
173
|
+
@media (prefers-reduced-motion: reduce) { .lb *, .view-tabs * { animation: none !important; transition: none !important; } }
|
|
174
|
+
|
|
175
|
+
/* a trial Harbor runs again under its own name: which attempt, and how the last one ended */
|
|
176
|
+
.lb-retry { display: block; color: var(--patch_failed_tests, var(--text-dim)); font-size: 11.5px; }
|
|
177
|
+
/* an ended trial, kept below the running ones */
|
|
178
|
+
.lb-ended .lb-outcome { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-dim); }
|
|
179
|
+
.lb-ended .lb-outcome i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
|
|
180
|
+
.lb-ended .lb-took { display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--text-dim); }
|
|
181
|
+
.lb-ended .lb-took b { font: 500 12.5px var(--mono); color: var(--text); }
|
|
182
|
+
.lb-go { width: 1%; text-align: right; white-space: nowrap; }
|
|
183
|
+
.lb-open-row { font-size: 12.5px; color: var(--accent); text-decoration: none; }
|
|
184
|
+
.lb-open-row:hover { text-decoration: underline; }
|
|
185
|
+
/* the board counts the trials itself: the run strip's own task bar would say it twice */
|
|
186
|
+
body:has(#live-board) #execution-units { display: none; }
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
/* The live board: the job page's Live view, drawn from the /job/<id>/live snapshot.
|
|
2
|
+
*
|
|
3
|
+
* Two halves, deliberately separable. `render(snapshot, opts)` is a pure
|
|
4
|
+
* function from the snapshot to HTML strings — no DOM, no fetch — so the route
|
|
5
|
+
* suite can execute it under Node against the hand-made fixtures and assert on
|
|
6
|
+
* what a user would read. `mount(document)` is the only part that touches the
|
|
7
|
+
* page: it polls every second while the job runs, keeps the reader's filter,
|
|
8
|
+
* selected trial and tab, and stops when the feed records the end.
|
|
9
|
+
*
|
|
10
|
+
* One board, top to bottom: a header line, one stats strip, the outcome bar
|
|
11
|
+
* with its filter chips (and, for more than one agent, the lanes and a winner
|
|
12
|
+
* per task), every trial as a tile, one table with a row per trial in flight and, below them, each that ended,
|
|
13
|
+
* and a drawer for one trial, where its phases are drawn on its own clock.
|
|
14
|
+
*
|
|
15
|
+
* Rules the fold already enforces are respected here rather than re-derived:
|
|
16
|
+
* cost, tokens per second and every counter are shown only once reported,
|
|
17
|
+
* never as 0; a column appears only when some trial reported it, and a single
|
|
18
|
+
* missing cell reads "—".
|
|
19
|
+
* The solve rates are the feed's outcomes so far, and say so: Results reads
|
|
20
|
+
* the job's own files.
|
|
21
|
+
*/
|
|
22
|
+
(function (root, factory) {
|
|
23
|
+
if (typeof module === 'object' && module.exports) module.exports = factory();
|
|
24
|
+
else root.NulliusLiveBoard = factory();
|
|
25
|
+
}(typeof self !== 'undefined' ? self : this, function () {
|
|
26
|
+
'use strict';
|
|
27
|
+
const esc = s => String(s == null ? '' : s).replace(/[&<>"']/g, c => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
|
|
28
|
+
const PHASES = ['env_setup', 'agent_setup', 'agent_run', 'verify'];
|
|
29
|
+
const PHASE_LABEL = {env_setup: 'env setup', agent_setup: 'agent setup', agent_run: 'agent run', verify: 'verify'};
|
|
30
|
+
const OUTCOMES = ['resolved', 'unresolved', 'scored', 'agent_error', 'infra_error', 'timeout', 'budget', 'cancelled'];
|
|
31
|
+
const OUTCOME_LABEL = {resolved: 'Resolved', unresolved: 'Unresolved', scored: 'Scored', agent_error: 'Agent error', infra_error: 'Infra error', cancelled: 'Cancelled', timeout: 'Timeout', budget: 'Spending cap'};
|
|
32
|
+
const STATE_LABEL = {preparing: 'Preparing', starting: 'Starting', running: 'Running', finished: 'Finished', unknown: 'Waiting for the feed'};
|
|
33
|
+
const FLIGHT_SHOWN = 12; // past this many in flight, the nearest their limit come first and the rest wait behind a button
|
|
34
|
+
const MANY_TILES = 60; // past this many trials, the tiles are drawn smaller
|
|
35
|
+
|
|
36
|
+
function clock(sec) {
|
|
37
|
+
if (sec == null || !isFinite(sec)) return '—';
|
|
38
|
+
sec = Math.max(0, Math.round(sec));
|
|
39
|
+
const h = Math.floor(sec / 3600), m = Math.floor((sec % 3600) / 60), s = sec % 60;
|
|
40
|
+
return (h ? h + ':' + String(m).padStart(2, '0') : String(m)) + ':' + String(s).padStart(2, '0');
|
|
41
|
+
}
|
|
42
|
+
function count(n) {
|
|
43
|
+
if (n == null) return '—';
|
|
44
|
+
if (n >= 1e6) return (n / 1e6).toFixed(2) + 'M';
|
|
45
|
+
if (n >= 1e3) return (n / 1e3).toFixed(1) + 'k';
|
|
46
|
+
return String(n);
|
|
47
|
+
}
|
|
48
|
+
const hms = iso => iso ? String(iso).slice(11, 19) : '—';
|
|
49
|
+
const secs = iso => Date.parse(iso) / 1000;
|
|
50
|
+
let NOUN = ''; // what the benchmark calls one item ("task", "question"), for a name that is a bare number
|
|
51
|
+
const shortTask = t => { const n = String(t.task || t.trial || '').replace(/^.*?__/, ''); return NOUN && /^\d+$/.test(n) ? NOUN[0].toUpperCase() + NOUN.slice(1) + ' ' + n : n; };
|
|
52
|
+
const redacted = s => esc(s).replace(/\[REDACTED\]/g, '<span class="lb-red">[REDACTED]</span>');
|
|
53
|
+
function tokensOf(t) {
|
|
54
|
+
if (t.n_input_tokens == null && t.n_output_tokens == null) return null;
|
|
55
|
+
return (t.n_input_tokens || 0) + (t.n_output_tokens || 0);
|
|
56
|
+
}
|
|
57
|
+
const pressure = t => (t.timeout_sec && t.elapsed_sec != null ? t.elapsed_sec / t.timeout_sec : 0);
|
|
58
|
+
function stateOf(s) {
|
|
59
|
+
const C = s.counts || {};
|
|
60
|
+
// Infer an omitted state from running and the counts.
|
|
61
|
+
return s.state || (!s.running ? 'finished' : (C.running === 0 && C.completed === 0 && C.total > 0) ? 'starting' : 'running');
|
|
62
|
+
}
|
|
63
|
+
function outcomeCounts(trials) {
|
|
64
|
+
const oc = {}; OUTCOMES.forEach(k => { oc[k] = 0; });
|
|
65
|
+
trials.forEach(t => { if (t.state === 'done' && t.outcome) oc[t.outcome] = (oc[t.outcome] || 0) + 1; });
|
|
66
|
+
return oc;
|
|
67
|
+
}
|
|
68
|
+
function trialHref(t, opts) {
|
|
69
|
+
return opts && opts.trialBase ? `${opts.trialBase.replace(/\/job\//, '/trial/')}/${encodeURIComponent(t.trial)}` : '';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function renderHead(s, state) {
|
|
73
|
+
const start = s.started_at || s.launched_at;
|
|
74
|
+
const when = start ? `${s.started_at ? 'started' : 'launched'} ${hms(start)}` : '';
|
|
75
|
+
const elapsed = s.elapsed_sec != null ? `${clock(s.elapsed_sec)} ${state === 'finished' ? 'in all' : 'elapsed'}` : '';
|
|
76
|
+
return [when, elapsed].filter(Boolean).join(', ');
|
|
77
|
+
}
|
|
78
|
+
function renderMeta(s) {
|
|
79
|
+
const T = s.totals || {}, agents = s.agents || [];
|
|
80
|
+
const bits = [];
|
|
81
|
+
if (agents.length) bits.push(`<span>${agents.length > 1 ? 'agents' : 'agent'} <b>${esc(agents.join(', '))}</b></span>`);
|
|
82
|
+
if (s.n_concurrent) bits.push(`<span><b>${esc(s.n_concurrent)}</b> at a time</span>`);
|
|
83
|
+
const tok = tokensOf(T);
|
|
84
|
+
if (tok != null) {
|
|
85
|
+
const parts = [T.n_cache_tokens != null ? `${count(T.n_cache_tokens)} cached` : '', T.n_output_tokens != null ? `${count(T.n_output_tokens)} out` : ''].filter(Boolean);
|
|
86
|
+
bits.push(`<span><b>${count(tok)}</b> tokens${parts.length ? ' (' + parts.join(', ') + ')' : ''}</span>`);
|
|
87
|
+
}
|
|
88
|
+
// measured, or left out: a rate the window could not measure, and a cost nobody reported, are absent, never 0
|
|
89
|
+
if (s.tokens_per_sec != null) bits.push(`<span><b>${count(Math.round(s.tokens_per_sec))}</b> tokens / s, last 30 s</span>`);
|
|
90
|
+
// as the job page says a cost: to the cent, and under a cent to four decimals ($0.00 beside a cap of $0.004 says nothing)
|
|
91
|
+
if (T.cost_usd != null) bits.push(`<span><b>$${Number(T.cost_usd).toFixed(Number(T.cost_usd) < 0.01 ? 4 : 2)}</b> spent</span>`);
|
|
92
|
+
// a run's spending cap (job.start's budget), said on its own: it counts the judge's and the simulated user's calls
|
|
93
|
+
// too, which the agents' cost beside it does not. As it was given (ledger.usd): cents, and the digits past them it
|
|
94
|
+
// has, to four decimals or to its third figure where that is finer (0.395, 0.00015)
|
|
95
|
+
const capped = v => { v = Number(v); const places = Math.min(12, Math.max(4, 2 - Math.floor(Math.log10(Math.abs(v)))));
|
|
96
|
+
const [whole, part = ''] = v.toFixed(places).replace(/0+$/, '').split('.'); return whole + '.' + part.padEnd(2, '0'); };
|
|
97
|
+
if (s.budget && Number(s.budget.max_usd) > 0) bits.push(`<span>spending cap <b>$${capped(s.budget.max_usd)}</b></span>`);
|
|
98
|
+
if (s.wall_sec) bits.push(`<span>wall <b>${clock(s.wall_sec)}</b> per trial</span>`);
|
|
99
|
+
return bits.join('');
|
|
100
|
+
}
|
|
101
|
+
function stat(k, v, cls, na) {
|
|
102
|
+
return `<div class="lb-stat${cls ? ' ' + cls : ''}"><span class="k">${k}</span><span class="v${na ? ' na' : ''}">${v}</span></div>`;
|
|
103
|
+
}
|
|
104
|
+
const pct = x => `${Math.round(100 * x)}<small>%</small>`;
|
|
105
|
+
function renderStats(s, state, oc) {
|
|
106
|
+
const C = s.counts || {};
|
|
107
|
+
const queued = C.total != null ? Math.max(0, C.total - C.completed - C.running) : null;
|
|
108
|
+
const rate = s.elapsed_sec > 60 && C.completed ? C.completed / (s.elapsed_sec / 60) : null;
|
|
109
|
+
const ran = C.completed - (oc.infra_error || 0) - (oc.budget || 0);
|
|
110
|
+
const when = state === 'finished' ? 'on the feed' : 'so far'; // the feed's outcomes, not the classifier's: Results has those
|
|
111
|
+
// A benchmark that gives a score and no pass or fail has no solve rate: the mean score, over every part scored, stands there.
|
|
112
|
+
const scored = (s.trials || []).filter(t => t.state === 'done' && t.outcome === 'scored' && t.score != null);
|
|
113
|
+
const weight = scored.reduce((n, t) => n + (t.parts || 1), 0);
|
|
114
|
+
const rates = scored.length && !oc.resolved && !oc.unresolved
|
|
115
|
+
? stat(`Mean score <small>${when}</small>`, (scored.reduce((x, t) => x + t.score * (t.parts || 1), 0) / weight).toFixed(2), 'rate')
|
|
116
|
+
: stat(`Raw solve rate <small>${when}</small>`, C.completed ? pct(oc.resolved / C.completed) : '—', 'rate', !C.completed)
|
|
117
|
+
+ stat(`Adjusted <small>${when}</small>`, ran > 0 ? pct(oc.resolved / ran) : '—', 'rate', !(ran > 0));
|
|
118
|
+
return stat('Done', `${C.completed}<small>/${C.total == null ? '?' : C.total}</small>`)
|
|
119
|
+
+ stat('Running', String(C.running))
|
|
120
|
+
+ (C.not_run ? stat('Not run', String(C.not_run)) : stat('Queued', queued == null ? '—' : String(queued), '', queued == null))
|
|
121
|
+
+ stat('Rate', rate ? `${rate.toFixed(1)}<small>/min</small>` : '—', '', !rate)
|
|
122
|
+
+ rates;
|
|
123
|
+
}
|
|
124
|
+
function renderMix(s, oc, filter) {
|
|
125
|
+
const total = (s.counts && s.counts.total) || (s.trials || []).length || 1;
|
|
126
|
+
const graded = oc.scored && !oc.resolved && !oc.unresolved; // scores alone: no empty Resolved and Unresolved beside them
|
|
127
|
+
const shown = OUTCOMES.filter(k => oc[k] || (!graded && (k === 'resolved' || k === 'unresolved')));
|
|
128
|
+
const bar = shown.map(k => `<span class="lbo-${k}" style="flex:0 0 ${(100 * oc[k] / total).toFixed(2)}%${filter && filter !== k ? ';opacity:.3' : ''}"></span>`).join('');
|
|
129
|
+
const chips = shown.map(k => `<li><button type="button" class="lbo-${k}" data-filter="${k}" aria-pressed="${filter === k}"${oc[k] ? '' : ' disabled'}><i></i>${OUTCOME_LABEL[k]} <b>${oc[k]}</b></button></li>`).join('')
|
|
130
|
+
+ (filter ? '<li><button type="button" class="lb-clear" data-filter="">Show all</button></li>' : '');
|
|
131
|
+
return {bar, chips};
|
|
132
|
+
}
|
|
133
|
+
// Several agents in one job: the fold groups the trials into one lane per
|
|
134
|
+
// agent and names a winner per task; the board only lays them out. Nothing
|
|
135
|
+
// unreported reads as 0.
|
|
136
|
+
function renderLanes(lanes, contested) {
|
|
137
|
+
if (!lanes || lanes.length < 2) return '';
|
|
138
|
+
return lanes.map(l => {
|
|
139
|
+
const C = l.counts, T = l.totals || {};
|
|
140
|
+
const facts = [`<b>${C.completed} / ${C.total}</b> completed`,
|
|
141
|
+
C.running ? `<b>${C.running}</b> running` : '',
|
|
142
|
+
`<b>${l.mean_reward == null ? '—' : l.mean_reward.toFixed(2)}</b> mean reward`,
|
|
143
|
+
T.cost_usd != null ? `<b>$${T.cost_usd.toFixed(2)}</b> spent` : '',
|
|
144
|
+
contested ? `<b>${l.wins}</b> won` : ''].filter(Boolean).join(' · ');
|
|
145
|
+
return `<span class="lb-lane" data-lane="${esc(l.agent == null ? '' : l.agent)}"><span class="agent">${esc(l.agent == null ? 'unnamed agent' : l.agent)}</span> ${facts}</span>`;
|
|
146
|
+
}).join('');
|
|
147
|
+
}
|
|
148
|
+
function renderWinners(winners) {
|
|
149
|
+
if (!winners || !winners.length) return '';
|
|
150
|
+
const agents = [];
|
|
151
|
+
winners.forEach(w => w.agents.forEach(a => { if (!agents.includes(a)) agents.push(a); }));
|
|
152
|
+
const rows = winners.map(w => {
|
|
153
|
+
const cells = agents.map(a => {
|
|
154
|
+
if (!(a in w.rewards)) return '<td class="na">did not run</td>';
|
|
155
|
+
const r = w.rewards[a];
|
|
156
|
+
return `<td class="num">${r == null ? '<span class="na">—</span>' : esc(Number(r).toFixed(2))}</td>`;
|
|
157
|
+
}).join('');
|
|
158
|
+
const verdict = w.winner != null ? `<b class="lb-win">${esc(w.winner)}</b>` : (w.decided ? '<span class="na">tie</span>' : '<span class="lb-open">undecided</span>');
|
|
159
|
+
return `<tr data-task="${esc(w.task)}"><td class="task" title="${esc(w.task)}">${esc(w.task)}</td>${cells}<td>${verdict}</td></tr>`;
|
|
160
|
+
}).join('');
|
|
161
|
+
return `<div class="lb-winners" data-winners="${winners.length}"><table><thead><tr><th>Winner per task</th>${agents.map(a => `<th class="num">${esc(a)}</th>`).join('')}<th>winner</th></tr></thead><tbody>${rows}</tbody></table>
|
|
162
|
+
<p class="lb-note">Each agent's best reward on the task so far; a winner is named once every trial of the task ended and one best is strictly higher. A tie names nobody.</p></div>`;
|
|
163
|
+
}
|
|
164
|
+
function renderTiles(trials, opts, agents, ended) {
|
|
165
|
+
return trials.map(t => {
|
|
166
|
+
const st = t.state === 'done' ? 'done' : t.state === 'running' ? 'running' : 'queued';
|
|
167
|
+
const cls = st === 'done' ? ` lbo-${esc(t.outcome || 'cancelled')}` : st === 'running' ? ` lbp-${esc(t.phase)}` : '';
|
|
168
|
+
const w = st === 'running' && t.timeout_sec ? ` style="--p:${Math.min(1, pressure(t)).toFixed(3)}"` : '';
|
|
169
|
+
const dim = opts.filter && t.outcome !== opts.filter ? ' dim' : '';
|
|
170
|
+
const label = `${shortTask(t)}${agents.length > 1 ? ' · ' + (t.agent || '') : ''}: ${st === 'done' ? (OUTCOME_LABEL[t.outcome] || 'ended') : st === 'running' ? PHASE_LABEL[t.phase] || t.phase : ended ? 'not run' : 'queued'}`;
|
|
171
|
+
return `<button type="button" class="lb-tile ${st}${cls}${dim}" data-trial="${esc(t.trial)}"${w} aria-current="${opts.selected === t.trial}" aria-label="${esc(label)}" title="${esc(label)}"><i></i></button>`;
|
|
172
|
+
}).join('');
|
|
173
|
+
}
|
|
174
|
+
function renderFlight(s, state, opts, oc, agents) {
|
|
175
|
+
const trials = s.trials || [], C = s.counts || {};
|
|
176
|
+
const running = trials.filter(t => t.state === 'running');
|
|
177
|
+
if (state === 'preparing' || (state === 'starting' && !running.length)) {
|
|
178
|
+
const st = s.preparing ? s.preparing.stage : null;
|
|
179
|
+
const head = state === 'preparing'
|
|
180
|
+
? `Preparing${st ? ' <b>' + esc(st) + '</b>' : ''}${s.preparing ? ' for ' + clock(s.preparing.elapsed_sec) : ''}. Nothing is scheduled yet.`
|
|
181
|
+
: `Starting: ${C.total == null ? 'trials' : C.total + ' trial' + (C.total === 1 ? '' : 's')} queued, none has entered a phase yet.`;
|
|
182
|
+
return `<p class="lb-quiet">${head}</p>`;
|
|
183
|
+
}
|
|
184
|
+
if (state === 'finished') {
|
|
185
|
+
const how = s.ended_by ? s.ended_by : 'finished';
|
|
186
|
+
return `<div class="lb-settle"><div><p><b>${esc(how[0].toUpperCase() + how.slice(1))} at ${hms(s.finished_at)}</b>${s.elapsed_sec != null ? ' after ' + clock(s.elapsed_sec) : ''}. The feed saw ${C.completed} of ${C.total == null ? '?' : C.total} trials end, ${oc.scored && !oc.resolved && !oc.unresolved ? oc.scored + ' scored' : oc.resolved + ' resolved'}.</p>
|
|
187
|
+
<small>The feed's outcomes are provisional. Results reads the job's own files and the judge, and it is where the score lives.</small></div>
|
|
188
|
+
<a class="btn sm" href="?view=results" data-open-results>Open Results</a></div>`;
|
|
189
|
+
}
|
|
190
|
+
const ended = (t) => ((s.timeline || {})[t.trial] || {}).ended || '';
|
|
191
|
+
const done = trials.filter(t => t.state === 'done').sort((a, b) => ended(a).localeCompare(ended(b)));
|
|
192
|
+
if (!running.length && !done.length) return '<p class="lb-quiet">Nothing is running at this poll.</p>';
|
|
193
|
+
const busy = running.length > FLIGHT_SHOWN, many = done.length > FLIGHT_SHOWN;
|
|
194
|
+
const order = busy ? running.slice().sort((a, b) => pressure(b) - pressure(a)) : running;
|
|
195
|
+
const rows = opts.showAll ? order : order.slice(0, FLIGHT_SHOWN);
|
|
196
|
+
const doneRows = opts.showAll ? done : done.slice(-FLIGHT_SHOWN);
|
|
197
|
+
// a column appears once some trial reported it; a single missing cell is "—"
|
|
198
|
+
const has = {steps: trials.some(t => t.step != null), tokens: trials.some(t => tokensOf(t) != null), line: trials.some(t => t.activity || t.last_line)};
|
|
199
|
+
const body = rows.map(t => {
|
|
200
|
+
const k = PHASES.indexOf(t.phase), p = pressure(t), tok = tokensOf(t), line = t.activity || t.last_line;
|
|
201
|
+
const dim = opts.filter && t.outcome !== opts.filter ? ' dim' : '';
|
|
202
|
+
return `<tr class="lb-row lbp-${esc(t.phase)}${dim}" data-trial="${esc(t.trial)}" tabindex="0" aria-current="${opts.selected === t.trial}">
|
|
203
|
+
<td><span class="task" title="${esc(t.task || t.trial)}">${esc(shortTask(t))}</span>${agents.length > 1 ? `<small>${esc(t.agent || '')}</small>` : ''}${t.attempt > 1 ? `<small class="lb-retry" title="Harbor ran it again after: ${esc((t.retried || []).join(', '))}">attempt ${t.attempt}, after ${esc((t.retried || []).slice(-1)[0] || 'an error').replace('_', ' ')}</small>` : ''}</td>
|
|
204
|
+
<td><span class="lb-phase"><span class="lb-ticks">${PHASES.map((_, j) => `<s class="${j < k ? 'done' : j === k ? 'now' : ''}"></s>`).join('')}</span>${esc(PHASE_LABEL[t.phase] || t.phase || '—')}</span></td>
|
|
205
|
+
<td><span class="lb-limit"><span class="lb-bar${p > .6 ? ' near' : ''}"><i style="width:${(100 * Math.min(1, p)).toFixed(1)}%"></i></span><span><b>${clock(t.elapsed_sec)}</b> of ${t.timeout_sec ? clock(t.timeout_sec) : '—'}</span></span></td>
|
|
206
|
+
${has.steps ? `<td class="num${t.step == null ? ' na' : ''}">${t.step == null ? '—' : esc(t.step)}</td>` : ''}
|
|
207
|
+
${has.tokens ? `<td class="num${tok == null ? ' na' : ''}">${count(tok)}</td>` : ''}
|
|
208
|
+
${has.line ? `<td><span class="lb-line${line ? '' : ' na'}" title="${esc(line || '')}">${line ? redacted(line) : '—'}</span></td>` : ''}<td class="lb-go"></td></tr>`;
|
|
209
|
+
}).join('') + doneRows.map(t => {
|
|
210
|
+
// an ended trial stays, below the running ones: its outcome, its time in all, its tokens, and its page
|
|
211
|
+
const tok = tokensOf(t), line = t.activity || t.last_line, href = trialHref(t, opts);
|
|
212
|
+
const dim = opts.filter && t.outcome !== opts.filter ? ' dim' : '';
|
|
213
|
+
return `<tr class="lb-row lb-ended${dim}" data-trial="${esc(t.trial)}" tabindex="0" aria-current="${opts.selected === t.trial}">
|
|
214
|
+
<td><span class="task" title="${esc(t.task || t.trial)}">${esc(shortTask(t))}</span>${agents.length > 1 ? `<small>${esc(t.agent || '')}</small>` : ''}</td>
|
|
215
|
+
<td><span class="lb-outcome lbo-${esc(t.outcome || 'cancelled')}"><i></i>${esc(OUTCOME_LABEL[t.outcome] || 'Ended')}</span></td>
|
|
216
|
+
<td><span class="lb-took">${t.total_sec != null ? `<b>${clock(t.total_sec)}</b> in all` : '—'}</span></td>
|
|
217
|
+
${has.steps ? `<td class="num${t.step == null ? ' na' : ''}">${t.step == null ? '—' : esc(t.step)}</td>` : ''}
|
|
218
|
+
${has.tokens ? `<td class="num${tok == null ? ' na' : ''}">${count(tok)}</td>` : ''}
|
|
219
|
+
${has.line ? `<td><span class="lb-line${line ? '' : ' na'}" title="${esc(line || '')}">${line ? redacted(line) : '—'}</span></td>` : ''}<td class="lb-go">${href ? `<a class="lb-open-row" href="${esc(href)}">Open →</a>` : ''}</td></tr>`;
|
|
220
|
+
}).join('');
|
|
221
|
+
const said = [busy ? (opts.showAll ? `All ${running.length} in flight` : `${rows.length} of ${running.length} in flight`) + ', nearest their limit first' : '',
|
|
222
|
+
many ? (opts.showAll ? `all ${done.length} ended` : `the last ${doneRows.length} of ${done.length} ended`) : ''].filter(Boolean).join(' · ');
|
|
223
|
+
const more = busy || many ? `<div class="lb-more"><span>${said}</span><button type="button" class="btn sm ghost" data-show-all>${opts.showAll ? 'Show fewer' : 'Show all'}</button></div>` : '';
|
|
224
|
+
return `<div class="lb-scroll"><table class="lb-table"><thead><tr><th>${busy ? 'Trial, the running nearest their limit first' : 'Trial'}</th><th>Phase, or how it ended</th><th>Time in phase, of its limit</th>${has.steps ? '<th class="num">Steps</th>' : ''}${has.tokens ? '<th class="num">Tokens</th>' : ''}${has.line ? '<th>Last line, redacted</th>' : ''}<th class="lb-go" aria-label="Trial page"></th></tr></thead><tbody>${body}</tbody></table></div>${more}`;
|
|
225
|
+
}
|
|
226
|
+
// One trial: its phases on its own clock, from the feed's own phase events
|
|
227
|
+
// (the route carries them as `timeline`), the time left in the phase it is in,
|
|
228
|
+
// the counters it reported, and its latest events.
|
|
229
|
+
function renderDrawer(s, t, opts) {
|
|
230
|
+
const now = secs(s.now);
|
|
231
|
+
const tl = (s.timeline || {})[t.trial] || {starts: {}, ended: null};
|
|
232
|
+
const starts = tl.starts || {}, keys = PHASES.filter(p => starts[p]);
|
|
233
|
+
const t0 = keys.length ? secs(starts[keys[0]]) : null;
|
|
234
|
+
const end = tl.ended ? secs(tl.ended) : now;
|
|
235
|
+
const cur = t.state === 'running' ? t.phase : null;
|
|
236
|
+
const limEnd = cur && t.timeout_sec && starts[cur] ? secs(starts[cur]) + t.timeout_sec : null;
|
|
237
|
+
const span = t0 == null ? 1 : (Math.max(end, limEnd || 0) - t0) || 1;
|
|
238
|
+
const X = v => Math.max(0, Math.min(100, 100 * (v - t0) / span));
|
|
239
|
+
let segs = '';
|
|
240
|
+
keys.forEach((p, k) => {
|
|
241
|
+
const a = secs(starts[p]), b = k + 1 < keys.length ? secs(starts[keys[k + 1]]) : end;
|
|
242
|
+
const isNow = p === cur && k === keys.length - 1;
|
|
243
|
+
segs += `<span class="lb-seg lbp-${p}${isNow ? ' now' : ''}${isNow && pressure(t) > .6 ? ' near' : ''}" style="left:${X(a).toFixed(2)}%;width:${Math.max(.6, X(b) - X(a)).toFixed(2)}%"></span>`;
|
|
244
|
+
});
|
|
245
|
+
if (limEnd) segs += `<span class="lb-left lbp-${cur}" style="left:${X(now).toFixed(2)}%;width:${Math.max(0, X(limEnd) - X(now)).toFixed(2)}%" title="time left in ${esc(PHASE_LABEL[cur])}"></span>`;
|
|
246
|
+
if (tl.ended && t.outcome) segs += `<span class="lb-cap lbo-${esc(t.outcome)}" style="left:${X(end).toFixed(2)}%"></span>`;
|
|
247
|
+
const dur = p => {
|
|
248
|
+
if (t.durations && t.durations[p] != null) return t.durations[p];
|
|
249
|
+
const k = keys.indexOf(p); if (k < 0) return null;
|
|
250
|
+
return (k + 1 < keys.length ? secs(starts[keys[k + 1]]) : end) - secs(starts[p]);
|
|
251
|
+
};
|
|
252
|
+
const phases = PHASES.map(p => { const d = dur(p); return `<span class="lbp-${p}${d == null ? ' later' : ''}"><i></i>${PHASE_LABEL[p]}<b>${d == null ? '—' : clock(d)}${p === cur ? ' so far' : ''}</b></span>`; }).join('');
|
|
253
|
+
const facts = [['Steps', t.step, v => esc(v)], ['Input', t.n_input_tokens, count], ['Cached', t.n_cache_tokens, count], ['Output', t.n_output_tokens, count],
|
|
254
|
+
['Cost', t.cost_usd, v => '$' + Number(v).toFixed(2)], ['Reward', t.reward, v => Number(v).toFixed(2)], ['Score', t.score, v => Number(v).toFixed(2)]].filter(f => f[1] != null);
|
|
255
|
+
const events = (s.tail || []).filter(e => e.trial === t.trial).slice(-6);
|
|
256
|
+
const state = t.state === 'done' ? `${OUTCOME_LABEL[t.outcome] || 'Ended'}${t.total_sec != null ? ', ' + clock(t.total_sec) + ' in all' : ''}`
|
|
257
|
+
: t.state === 'running' ? `${PHASE_LABEL[t.phase] || t.phase}, ${clock(t.elapsed_sec)} of ${t.timeout_sec ? clock(t.timeout_sec) : 'no limit'}`
|
|
258
|
+
: stateOf(s) === 'finished' ? 'Not run' : `Queued${t.position != null ? ', position ' + (t.position + 1) : ''}`;
|
|
259
|
+
const href = trialHref(t, opts);
|
|
260
|
+
return `<header><h3>${esc(shortTask(t))}<small>${esc(state)}${t.agent ? ' · ' + esc(t.agent) : ''}</small></h3><button class="lb-x" type="button" data-close aria-label="Close trial detail">×</button></header>
|
|
261
|
+
<div class="lb-river"><div class="lb-rl"><span>${t0 == null ? 'not started' : hms(starts[keys[0]])}</span><span>${tl.ended ? 'ended ' + hms(tl.ended) : limEnd ? 'limit ' + clock(limEnd - t0) + ' in' : ''}</span></div>
|
|
262
|
+
<div class="lb-track">${segs}</div><div class="lb-pl">${phases}</div></div>
|
|
263
|
+
${t.state !== 'running' && (t.activity || t.last_line) ? `<p class="lb-last"><span>Last line, redacted</span>${redacted(t.activity || t.last_line)}</p>` : ''}
|
|
264
|
+
${facts.length ? `<dl class="lb-facts">${facts.map(([k, v, f]) => `<div><dt>${k}</dt><dd>${f(v)}</dd></div>`).join('')}</dl>` : ''}
|
|
265
|
+
<div class="lb-evl"><span>events.jsonl, latest</span><span>${events.length} in the tail</span></div>
|
|
266
|
+
<div class="lb-ev">${events.length ? events.map(e => `<div><span>${hms(e.ts)}</span><span class="e">${esc(e.event)}</span><span>${redacted(e.phase || e.outcome || e.activity || e.line || '')}</span></div>`).join('') : '<div><span>—</span></div>'}</div>
|
|
267
|
+
${href ? `<a class="lb-open-trial" href="${esc(href)}">Open the trial →</a>` : ''}`;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function render(snapshot, opts) {
|
|
271
|
+
opts = opts || {};
|
|
272
|
+
NOUN = opts.noun || '';
|
|
273
|
+
const s = snapshot, trials = s.trials || [], state = stateOf(s), agents = s.agents || [];
|
|
274
|
+
const oc = outcomeCounts(trials), mix = renderMix(s, oc, opts.filter);
|
|
275
|
+
const lanes = s.lanes || [], winners = s.winners || [];
|
|
276
|
+
const picked = opts.selected ? trials.find(t => t.trial === opts.selected) : null;
|
|
277
|
+
const C = s.counts || {};
|
|
278
|
+
return {
|
|
279
|
+
state,
|
|
280
|
+
stateLabel: state === 'finished' && s.ended_by ? s.ended_by[0].toUpperCase() + s.ended_by.slice(1) : STATE_LABEL[state] || state,
|
|
281
|
+
finished: state === 'finished',
|
|
282
|
+
// The footer says only what the board above does not: the stage a job is preparing, or that nothing has started.
|
|
283
|
+
status: state === 'preparing' ? `preparing${s.preparing && s.preparing.stage ? ' — ' + s.preparing.stage : ''}${s.preparing ? ' · ' + clock(s.preparing.elapsed_sec) + ' in this stage' : ''}`
|
|
284
|
+
: state === 'starting' ? `starting — ${C.total == null ? 'trials' : C.total + ' trial' + (C.total === 1 ? '' : 's')} queued, none has entered a phase yet`
|
|
285
|
+
: '',
|
|
286
|
+
head: renderHead(s, state),
|
|
287
|
+
meta: renderMeta(s),
|
|
288
|
+
stats: renderStats(s, state, oc),
|
|
289
|
+
mixbar: mix.bar,
|
|
290
|
+
legend: mix.chips,
|
|
291
|
+
lanes: lanes.length > 1 ? lanes.length : 0,
|
|
292
|
+
lanesLine: renderLanes(lanes, winners.length > 0),
|
|
293
|
+
winners: renderWinners(winners),
|
|
294
|
+
tilesLabel: `All ${trials.length} trial${trials.length === 1 ? '' : 's'}`,
|
|
295
|
+
manyTiles: trials.length > MANY_TILES,
|
|
296
|
+
tiles: renderTiles(trials, opts, agents, state === 'finished'),
|
|
297
|
+
flight: renderFlight(s, state, opts, oc, agents),
|
|
298
|
+
drawer: picked ? renderDrawer(s, picked, opts) : '',
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function mount(doc) {
|
|
303
|
+
const board = doc.getElementById('live-board');
|
|
304
|
+
if (!board) return;
|
|
305
|
+
const $ = sel => board.querySelector(sel);
|
|
306
|
+
const endpoint = board.dataset.endpoint, trialBase = board.dataset.trialBase;
|
|
307
|
+
const opts = {trialBase, noun: board.dataset.noun || '', filter: null, selected: null, showAll: false};
|
|
308
|
+
let snap = null, timer = null, misses = 0;
|
|
309
|
+
// opened while the run was going: the Results rendered with the page are older than its end
|
|
310
|
+
const startedLive = board.dataset.state !== 'finished';
|
|
311
|
+
function paint() {
|
|
312
|
+
if (!snap) return;
|
|
313
|
+
const out = render(snap, opts);
|
|
314
|
+
board.dataset.state = out.state;
|
|
315
|
+
$('[data-lb-state]').textContent = out.stateLabel;
|
|
316
|
+
$('[data-lb-head]').textContent = out.head;
|
|
317
|
+
$('[data-lb-meta]').innerHTML = out.meta;
|
|
318
|
+
$('[data-lb-stats]').innerHTML = out.stats;
|
|
319
|
+
$('[data-lb-mixbar]').innerHTML = out.mixbar;
|
|
320
|
+
$('[data-lb-legend]').innerHTML = out.legend;
|
|
321
|
+
const lanes = $('[data-lb-lanes]'); lanes.innerHTML = out.lanesLine + out.winners; lanes.hidden = !out.lanes && !out.winners;
|
|
322
|
+
$('[data-lb-tiles-label]').textContent = out.tilesLabel;
|
|
323
|
+
const tiles = $('[data-lb-tiles]'); tiles.innerHTML = out.tiles; tiles.classList.toggle('many', out.manyTiles);
|
|
324
|
+
$('[data-lb-flight]').innerHTML = out.flight;
|
|
325
|
+
const drawer = $('[data-lb-drawer]'); drawer.innerHTML = out.drawer; drawer.hidden = !out.drawer;
|
|
326
|
+
board.classList.toggle('open', !!out.drawer);
|
|
327
|
+
const said = misses ? `feed unavailable (${misses}) — showing the last snapshot` : out.status;
|
|
328
|
+
$('[data-lb-status]').textContent = said; $('[data-lb-foot]').hidden = !said;
|
|
329
|
+
// Trials that ended since the page loaded are not in its Results yet: the badge counts them, and the tab reads them again
|
|
330
|
+
const badge = doc.getElementById('results-badge'), shown = Number(badge?.dataset.trials || 0), done = (snap.counts || {}).completed || 0;
|
|
331
|
+
if (badge && !out.finished && done > shown) { badge.textContent = `${done - shown} new`; badge.dataset.stale = '1'; }
|
|
332
|
+
if (out.finished) {
|
|
333
|
+
// The feed recorded the end: stop asking, and say Results is ready. No reload under the reader.
|
|
334
|
+
if (timer) { clearInterval(timer); timer = null; }
|
|
335
|
+
if (badge) { badge.textContent = 'ready'; badge.classList.add('ready'); if (startedLive) badge.dataset.stale = '1'; }
|
|
336
|
+
const dot = doc.getElementById('live-dot'); if (dot) dot.classList.remove('on');
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
async function tick() {
|
|
340
|
+
try {
|
|
341
|
+
const r = await nulliusFetch(endpoint, {headers: {'Accept': 'application/json'}, cache: 'no-store'});
|
|
342
|
+
if (!r.ok) throw new Error('HTTP ' + r.status);
|
|
343
|
+
misses = 0; snap = await r.json();
|
|
344
|
+
} catch (e) { misses += 1; }
|
|
345
|
+
paint();
|
|
346
|
+
}
|
|
347
|
+
board.addEventListener('click', e => {
|
|
348
|
+
const t = e.target;
|
|
349
|
+
if (t.closest('[data-close]')) { opts.selected = null; return paint(); }
|
|
350
|
+
if (t.closest('[data-show-all]')) { opts.showAll = !opts.showAll; return paint(); }
|
|
351
|
+
const f = t.closest('[data-filter]'); if (f && !f.disabled) { opts.filter = f.dataset.filter && opts.filter !== f.dataset.filter ? f.dataset.filter : null; return paint(); }
|
|
352
|
+
const tr = t.closest('[data-trial]'); if (tr && !t.closest('a')) { opts.selected = opts.selected === tr.dataset.trial ? null : tr.dataset.trial; return paint(); }
|
|
353
|
+
});
|
|
354
|
+
board.addEventListener('keydown', e => {
|
|
355
|
+
const row = e.target.closest && e.target.closest('.lb-row');
|
|
356
|
+
if (row && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); row.click(); }
|
|
357
|
+
if (e.key === 'Escape' && opts.selected) { opts.selected = null; paint(); }
|
|
358
|
+
});
|
|
359
|
+
const initial = doc.getElementById('live-board-initial');
|
|
360
|
+
if (initial) { try { snap = JSON.parse(initial.textContent); } catch (e) { /* the first poll paints */ } }
|
|
361
|
+
paint();
|
|
362
|
+
if (!snap || stateOf(snap) !== 'finished') { timer = setInterval(tick, 1000); tick(); }
|
|
363
|
+
}
|
|
364
|
+
// The two views of the job page: switched in place, kept in the address as ?view=.
|
|
365
|
+
function mountTabs(doc) {
|
|
366
|
+
const tabs = Array.from(doc.querySelectorAll('[data-view-tab]'));
|
|
367
|
+
if (!tabs.length) return;
|
|
368
|
+
function show(view) {
|
|
369
|
+
tabs.forEach(t => {
|
|
370
|
+
const on = t.dataset.viewTab === view;
|
|
371
|
+
t.setAttribute('aria-selected', String(on)); t.tabIndex = on ? 0 : -1;
|
|
372
|
+
doc.getElementById(t.getAttribute('aria-controls')).hidden = !on;
|
|
373
|
+
});
|
|
374
|
+
const u = new URL(location.href); u.searchParams.set('view', view);
|
|
375
|
+
// Results as rendered when the page loaded predate trials or a run that ended since: read them again
|
|
376
|
+
const badge = doc.getElementById('results-badge');
|
|
377
|
+
if (view === 'results' && badge && badge.dataset.stale) { location.assign(u); return; }
|
|
378
|
+
history.replaceState(null, '', u);
|
|
379
|
+
}
|
|
380
|
+
tabs.forEach((t, i) => {
|
|
381
|
+
t.addEventListener('click', () => show(t.dataset.viewTab));
|
|
382
|
+
t.addEventListener('keydown', e => {
|
|
383
|
+
const d = e.key === 'ArrowRight' ? 1 : e.key === 'ArrowLeft' ? -1 : 0;
|
|
384
|
+
if (d) { e.preventDefault(); const n = tabs[(i + d + tabs.length) % tabs.length]; n.focus(); show(n.dataset.viewTab); }
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
if (typeof document !== 'undefined') {
|
|
389
|
+
const go = () => { mountTabs(document); mount(document); };
|
|
390
|
+
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', go);
|
|
391
|
+
else go();
|
|
392
|
+
}
|
|
393
|
+
return {render, renderHead, renderMeta, renderStats, renderMix, renderLanes, renderWinners, renderTiles, renderFlight, renderDrawer, clock, count, tokensOf, stateOf};
|
|
394
|
+
}));
|