mirror of
https://github.com/hasso5703/alzeo.git
synced 2026-12-05 12:24:28 +01:00
Hasan, 2026-12-04: a Qwen4 lane on a machine dedicated to it, with all the context it can hold. Its Load stops every lane beside first, the embeddings lane too (the OCR and Clipstral lanes already, for want of room), and none of them starts while it serves or is the boot lane: the embeddings lane's unit's head refuses it now as the OCR and Clipstral lanes' do, and the cockpit says so before the click. Tests red on the old code (the head, the plan), green now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2069 lines
182 KiB
JavaScript
2069 lines
182 KiB
JavaScript
"use strict";
|
||
/* Alzeo cockpit, the base every view stands on.
|
||
|
||
One state payload (a server-sent event stream, with polling behind it) drives every
|
||
view through renderers that write text nodes only, never HTML built from data. Each
|
||
renderer is registered against the collector it reads (on()), runs isolated (one that
|
||
throws marks its own panels and nothing else), and every panel says how fresh its
|
||
sources are. Every action goes through one sheet that shows its exact command, one
|
||
server-side job lock, and one dock visible from every view and every browser.
|
||
|
||
The files load in order: base, the views, then boot.js starts the transport. */
|
||
|
||
// ── small tools ─────────────────────────────────────────────────────────────────
|
||
const $ = id => document.getElementById(id);
|
||
const GIB = 1024 ** 3;
|
||
const gib = b => b == null || isNaN(b) ? null : b / GIB;
|
||
// gibibytes, said as such: 1024 cubed is a GiB, not a GB
|
||
const fmtGiB = (b, d = 1) => b == null || isNaN(b) ? '…' : (b / GIB).toFixed(d) + ' GiB';
|
||
// room on a disk, in the unit it reads in: "0.0 GiB" of the 54 KiB four stray revisions free read as nothing at all
|
||
const fmtRoom = b => b == null || isNaN(b) ? '…' : b >= GIB / 10 ? fmtGiB(b) : b >= 2 ** 20 ? (b / 2 ** 20).toFixed(0) + ' MiB'
|
||
: b >= 1024 ? (b / 1024).toFixed(0) + ' KiB' : `${b} bytes`;
|
||
const fmtN = n => n == null || isNaN(n) ? '…' : Number(n).toLocaleString('en');
|
||
const fmtK = n => n == null ? '?' : n >= 1e6 ? (n / 1e6).toFixed(2).replace(/\.?0+$/, '') + 'M' : Math.round(n / 1000) + 'K';
|
||
// rounded once, before it is split: minutes floored and seconds rounded read "8 min 60"
|
||
const fmtDur = s => {
|
||
if (s == null || isNaN(s)) return '?';
|
||
const r = Math.max(0, Math.round(s));
|
||
return r < 90 ? r + ' s' : r < 3600 ? Math.floor(r / 60) + ' min ' + String(r % 60).padStart(2, '0')
|
||
: Math.floor(r / 3600) + ' h ' + String(Math.floor((r % 3600) / 60)).padStart(2, '0');
|
||
};
|
||
// minutes for a plan, not a stopwatch: "about 13 min". The minutes are rounded before the hours
|
||
// are split off: rounded after, 7,170 s read "1 h 60" and 3,599 s "60 min" (found in review,
|
||
// 2026-10-21)
|
||
const fmtMin = s => {
|
||
if (s == null) return '?';
|
||
if (s < 90) return Math.round(s) + ' s';
|
||
const m = Math.round(s / 60);
|
||
return m < 60 ? m + ' min' : Math.floor(m / 60) + ' h ' + String(m % 60).padStart(2, '0');
|
||
};
|
||
// a time of day is ambiguous once the page reloads events written on another day
|
||
const clockTime = ts => {
|
||
const d = new Date(ts * 1000), now = new Date();
|
||
const hm = d.toLocaleTimeString([], {hour12: false, hour: '2-digit', minute: '2-digit'});
|
||
if (d.toDateString() === now.toDateString()) return hm;
|
||
return d.toLocaleDateString([], {day: '2-digit', month: '2-digit'}) + ' ' + hm;
|
||
};
|
||
const el = (tag, cls, txt) => { const n = document.createElement(tag); if (cls) n.className = cls; if (txt != null) n.textContent = txt; return n; };
|
||
const clear = n => { if (n) while (n.firstChild) n.removeChild(n.firstChild); };
|
||
const setText = (id, txt) => { const e = typeof id === 'string' ? $(id) : id; if (e && e.textContent !== String(txt)) e.textContent = txt; };
|
||
const setTitle = (id, txt) => { const e = typeof id === 'string' ? $(id) : id; if (e) e.title = txt || ''; };
|
||
const show = (id, on) => { const e = typeof id === 'string' ? $(id) : id; if (e) e.hidden = !on; };
|
||
const isTailnet = a => /^100\.(6[4-9]|[7-9]\d|1[01]\d|12[0-7])\.\d{1,3}\.\d{1,3}$/.test(a || '');
|
||
const cssVar = v => getComputedStyle(document.documentElement).getPropertyValue(v).trim();
|
||
// quoted for a shell: an apostrophe in a prompt must not end the string halfway
|
||
const shq = s => "'" + String(s).replace(/'/g, `'\\''`) + "'";
|
||
function cap(id, text, kind, lamp){
|
||
const e = typeof id === 'string' ? $(id) : id; if (!e) return;
|
||
clear(e); e.className = 'cap' + (kind ? ' ' + kind : '');
|
||
if (lamp !== false){ const l = el('span', 'lamp' + (kind === 'ok' ? ' ok' : kind === 'warn' ? ' warn' : kind === 'err' ? ' err' : kind === 'cool' ? ' cool' : kind === 'orange' ? ' orange' : '') + (lamp === 'live' ? ' live' : '')); e.append(l); }
|
||
e.append(document.createTextNode(text));
|
||
}
|
||
// Each cell carries its column's name: on a phone a wide table stacks into cards, and a
|
||
// line without its header is a number nobody can read. A cell spanning columns has none.
|
||
function labelCells(t){
|
||
const heads = t.tHead ? [...t.tHead.rows[0].cells].map(c => c.textContent.trim()) : [];
|
||
[...t.tBodies[0].rows].forEach(tr => {
|
||
let i = 0;
|
||
[...tr.cells].forEach(td => { const n = td.colSpan || 1; if (n === 1 && heads[i]) td.dataset.label = heads[i]; i += n; });
|
||
});
|
||
}
|
||
function facts(dl, rows){
|
||
clear(dl);
|
||
rows.forEach(([k, v, cls]) => { if (v == null) return; dl.append(el('dt', null, k)); const dd = el('dd', cls || null, v); dl.append(dd); });
|
||
}
|
||
|
||
// ── vocabulary: one word per engine state, everywhere ─────────────────────────
|
||
const STATE_LABEL = {
|
||
stopped: 'stopped', failed: 'failed', starting: 'starting', 'loading-weights': 'loading weights',
|
||
'loading-draft': 'loading the draft head', 'allocating-kv': 'allocating the KV pool',
|
||
'capturing-graphs': 'capturing CUDA graphs', 'warming-up': 'warming up', ready: 'ready',
|
||
degraded: 'ready but not answering', stopping: 'stopping', wedged: 'wedged: no generation',
|
||
orphan: 'running outside systemd'};
|
||
// the word for a lane, with what the start guard or a lost scheduler adds to its state: a lane
|
||
// held by the guard read "starting", one it refused "failed" (engine-preflight.sh, issue #26),
|
||
// a flash lane on a GPU outside its ATS mode is no matter of memory (issue #54), and neither is the
|
||
// Qwen3.8 Flash-Next FP4-Local lane missing a file it reads (its unit's guard); a lane beside every lane whose start the box had
|
||
// too little memory for says that
|
||
const stateLabel = e => !e ? '' : startLevel(e) === 'still' ? 'barely moving' : e.held ? 'waiting for GPU memory' : e.refused ? 'not starting: GPU memory held'
|
||
: e.cannot ? 'cannot start on this GPU' : e.lacks ? 'cannot start: a file is missing' : e.room ? 'not started: too little memory' : e.zombie ? 'lost its scheduler' : e.state === 'failed' && e.crashed_serving ? 'restarting after a crash'
|
||
: (STATE_LABEL[e.state] || e.state);
|
||
const sentence = s => s ? s.charAt(0).toUpperCase() + s.slice(1) : '';
|
||
const STATE_KIND = {ready: 'ok', degraded: 'warn', failed: 'err', stopped: '', stopping: 'warn', wedged: 'err', orphan: 'err'};
|
||
const TRANSITIONAL = new Set(['starting', 'loading-weights', 'loading-draft', 'allocating-kv', 'capturing-graphs', 'warming-up']);
|
||
// a unit that is not running, whatever its container does: its button offers Start
|
||
const UNIT_DOWN = new Set(['stopped', 'failed', 'orphan']);
|
||
const stateKind = st => STATE_KIND[st] ?? 'warn';
|
||
const stateLive = st => st === 'stopping' || TRANSITIONAL.has(st) ? 'live' : true;
|
||
const STAGE_LABEL = {'init': 'init', 'loading-weights': 'weights', 'loading-draft': 'draft', 'allocating-kv': 'KV pool',
|
||
'capturing-graphs': 'graphs', 'warming-up': 'warmup'};
|
||
const ALL_STAGES = Object.keys(STAGE_LABEL);
|
||
|
||
const U27 = 'qwen38-sglang.service', UFLASH = 'qwen38-flash.service', IMAGE_UNIT = 'qwen38-image.service',
|
||
VIDEO_UNIT = 'qwen38-video.service', KOLIBRI_UNIT = 'qwen38-kolibri.service', NEMOTRON_UNIT = 'qwen38-nemotron.service',
|
||
NEMOTRON_SUPER_UNIT = 'qwen38-nemotron-super.service', FLASH_LOCAL_UNIT = 'qwen38-flash-local.service',
|
||
ORNITH_UNIT = 'qwen38-ornith-122b.service', FLASH_UNSLOTH_UNIT = 'qwen38-flash-unsloth.service',
|
||
IMAGE_H3_UNIT = 'qwen38-image-h3.service', TRANSCRIBE_UNIT = 'qwen38-transcribe.service',
|
||
LFM25_UNIT = 'qwen38-lfm25.service', LFM3_UNIT = 'qwen38-lfm3.service', INKLING_UNIT = 'qwen38-inkling.service', QWEN4_35B_UNIT = 'qwen38-qwen4-35b.service',
|
||
EMBED_UNIT = 'qwen38-embed.service',
|
||
CLIPSTRAL_UNIT = 'qwen38-clipstral.service', OCR_UNIT = 'qwen38-ocr.service',
|
||
PROXY_UNIT = 'qwen38-keepalive.service', AGENT_UNIT = 'opencode-web.service',
|
||
// the speech lane, on the CPU beside whichever lane serves: none of LANE_UNITS, which take the GPU in turn (v1.58)
|
||
SPEECH_UNIT = 'qwen38-speech.service';
|
||
// the order of the Now view's rack and the Lanes view's cards: the text lanes from the most capable model to the least (Hasan,
|
||
// 2026-11-30), roughly: Flash-Next's three builds, Qwen4 35B-A3B (better than the 27B and Flash-Next's equal by its maker's own
|
||
// comparisons, 2026-12-04), Inkling 2 Mini (the 27B's equal by its card), the 27B, Ornith, Super VL,
|
||
// Kolibri, Bolt, and Liquid AI's two small ones; then the images, the video and the speech recognizer,
|
||
// and the two embeddings lanes, on the CPU beside every one of them (v1.60), and the OvisOCR3 lane, beside them on the GPU (v1.62), last
|
||
const LANE_UNITS = [FLASH_LOCAL_UNIT, UFLASH, FLASH_UNSLOTH_UNIT, QWEN4_35B_UNIT, INKLING_UNIT, U27, ORNITH_UNIT, NEMOTRON_SUPER_UNIT, KOLIBRI_UNIT, NEMOTRON_UNIT, LFM25_UNIT, LFM3_UNIT, IMAGE_UNIT, IMAGE_H3_UNIT, VIDEO_UNIT, TRANSCRIBE_UNIT, EMBED_UNIT, CLIPSTRAL_UNIT, OCR_UNIT];
|
||
// Among them, the lanes beside every lane, on the CPU (and the OvisOCR3 lane on the GPU, with a share of its own): a card and a bay like the others, never the lane that serves nor
|
||
// the boot lane, which are the GPU's turn. Taken for them, the embeddings lane running alone was what "served" (a Load
|
||
// of the 27B stopped it first, the text actions read a text engine ready on a closed :30000) and, enabled at boot,
|
||
// the lane the box boots (code review of v1.60.0)
|
||
const BESIDE_UNITS = new Set([EMBED_UNIT, CLIPSTRAL_UNIT, OCR_UNIT]);
|
||
// the image lanes, Qwen-Image 2.1 and MiniMax-H3-Image: one Image view addresses the one that serves (image.js, imgUnit)
|
||
const isImageLane = u => u === IMAGE_UNIT || u === IMAGE_H3_UNIT;
|
||
// the two Nemotron lanes, Bolt and Super VL: one vLLM image, the same routes and the same limits
|
||
const isNemotron = u => u === NEMOTRON_UNIT || u === NEMOTRON_SUPER_UNIT;
|
||
// the vLLM lanes on b12x, the two Nemotron lanes, the Qwen3.8 Flash-Next FP4-Local lane and the Ornith lane: the
|
||
// same routes, the same counters, the same belts that cannot act; each says its own name
|
||
const isB12x = u => isNemotron(u) || u === FLASH_LOCAL_UNIT || u === ORNITH_UNIT;
|
||
const b12xName = u => `the ${LANE_NAME[u]} lane`;
|
||
// the vLLM lanes the server reads from one table (cockpit.py TABLE_LANES): the b12x family's, and the Liquid AI LFM3
|
||
// lane's, on vLLM's own nightly without b12x or a drafter: the same routes, counters and belts that cannot act
|
||
const isVllmTable = u => isB12x(u) || u === LFM3_UNIT;
|
||
// the llama.cpp lanes (the Unsloth GGUF lane, v1.48): none of SGLang's routes either, its own counters, its own name
|
||
const isLlamacpp = u => u === FLASH_UNSLOTH_UNIT;
|
||
const llamacppName = u => `the ${LANE_NAME[u]} lane`;
|
||
// The lanes' names in sentences, each its family's official name (decision 1180 of Hasan, 2026-11-07: no name of
|
||
// our own, neither for a lane nor for its default version)
|
||
const LANE_NAME = {[U27]: 'Qwen3.8 27B', [UFLASH]: 'Qwen3.8 Flash-Next', [FLASH_LOCAL_UNIT]: 'Qwen3.8 Flash-Next FP4-Local',
|
||
[KOLIBRI_UNIT]: 'Kolibri-1', [NEMOTRON_UNIT]: 'Nemotron 3.5 Bolt', [NEMOTRON_SUPER_UNIT]: 'Nemotron 3.5 Super VL',
|
||
[ORNITH_UNIT]: 'Ornith 1.5 122B', [FLASH_UNSLOTH_UNIT]: 'Qwen3.8 Flash-Next Unsloth GGUF',
|
||
[IMAGE_UNIT]: 'Qwen-Image 2.1', [IMAGE_H3_UNIT]: 'MiniMax-H3-Image', [VIDEO_UNIT]: 'MiniMax-H3',
|
||
[TRANSCRIBE_UNIT]: 'NVIDIA Nemotron Transcribe', [LFM25_UNIT]: 'Liquid AI LFM2.5 24B-A2B',
|
||
[LFM3_UNIT]: 'Liquid AI LFM3', [INKLING_UNIT]: 'Inkling 2 Mini', [QWEN4_35B_UNIT]: 'Qwen4 35B-A3B',
|
||
[EMBED_UNIT]: 'pplx-embed v1 0.6B',
|
||
[CLIPSTRAL_UNIT]: 'Mistral Multimodal Embed 1B', [OCR_UNIT]: 'OvisOCR3'};
|
||
// What each lane is, for people: the kind of work it does and the one line that says so.
|
||
// `lane` names the lane's hue in the stylesheet (--lane-<lane>); `maker` its mark in img/logos.
|
||
const LANE_META = {
|
||
[U27]: {title: 'Qwen3.8 27B', kind: 'Text, up to 1M tokens of context', desc: 'Dense 27B in NVFP4 with a DFlash2 draft. The long-context lane.', view: 'agent', lane: '27b', maker: 'qwen'},
|
||
[UFLASH]: {title: 'Qwen3.8 Flash-Next', kind: 'Text, 262K tokens of context', desc: 'Mixture of experts, 176B in NVFP4 with its own draft head. The fast lane for agents.', view: 'agent', lane: 'flash', maker: 'qwen'},
|
||
[FLASH_LOCAL_UNIT]: {title: 'Qwen3.8 Flash-Next FP4-Local', kind: 'Text and images, 262K tokens of context', desc: 'Qwen3.8-Flash-Next, 176B, in NVIDIA’s own FP4 build, distilled from its full precision, served by vLLM with b12x as NVIDIA’s model card says. Reasoning, tool calls and vision.', view: 'agent', lane: 'flash-local', maker: 'nvidia'},
|
||
[KOLIBRI_UNIT]: {title: 'Kolibri-1', kind: 'Text, 262K tokens, German and English', desc: 'Aleph Alpha’s mixture of experts, 78B with 3.5B active, served by vLLM. Reasoning and tool calls.', view: 'agent', lane: 'kolibri', maker: 'alephalpha'},
|
||
[NEMOTRON_UNIT]: {title: 'Nemotron 3.5 Bolt', kind: 'Text, images and video, 262K tokens', desc: 'NVIDIA’s mixture of experts, 74B with 9B active in 2 bits, served by vLLM with its drafter. Reasoning, tool calls and vision.', view: 'agent', lane: 'nemotron', maker: 'nvidia'},
|
||
[NEMOTRON_SUPER_UNIT]: {title: 'Nemotron 3.5 Super VL', kind: 'Text, images and video, 1M tokens', desc: 'NVIDIA’s mixture of experts, 120B with 12B active in NVFP4, served by vLLM with its drafter. Reasoning, tool calls and vision over a 1M window.', view: 'agent', lane: 'nemotron-super', maker: 'nvidia'},
|
||
[ORNITH_UNIT]: {title: 'Ornith 1.5 122B', kind: 'Text, images and video, 1M tokens', desc: 'Ornith AI’s mixture of experts, 122B with 8 of its 256 experts active, in its authors’ NVFP4 build, served by vLLM with b12x and its MTP head. Reasoning, tool calls and vision.', view: 'agent', lane: 'ornith-122b', maker: 'ornith'},
|
||
[FLASH_UNSLOTH_UNIT]: {title: 'Qwen3.8 Flash-Next Unsloth GGUF', kind: 'Text, 262K tokens of context', desc: 'Qwen3.8-Flash-Next, 176B, in Unsloth’s dynamic GGUF (UD-IQ3_XXS or UD-Q4_K_XL), served by llama.cpp with an n-gram lookup and a DFlash2 draft, its n-gram (PLE) table read from the disk. Reasoning and tool calls.', view: 'agent', lane: 'flash-unsloth', maker: 'unsloth'},
|
||
[LFM25_UNIT]: {title: 'Liquid AI LFM2.5 24B-A2B', kind: 'Text, 131K tokens of context', desc: 'Liquid AI’s hybrid mixture of experts, 24B with 2B active, in its official FP8 build with its DSpark draft, served by SGLang. It reasons before every answer, and calls tools.', view: 'agent', lane: 'lfm25', maker: 'liquid'},
|
||
[INKLING_UNIT]: {title: 'Inkling 2 Mini', kind: 'Text and images, 1M tokens of context', desc: 'Thinking Machines’ looped mixture of experts, 26.4B with 3.4B active, its middle layers run three times per token, served by SGLang with the DSpark draft head of its checkpoint, its KV cache holding the model’s whole window. Reasoning at the effort asked, tool calls and vision.', view: 'agent', lane: 'inkling', maker: 'thinkingmachines'},
|
||
[QWEN4_35B_UNIT]: {title: 'Qwen4 35B-A3B', kind: 'Text, images and video, 1M tokens of context', desc: 'Qwen’s mixture of experts, 35B with 3B active, hybrid linear and sparse attention, in RadixArk’s NVFP4 build, served by SGLang with RadixArk’s DFlash2 draft and Qwen’s tokenizer, its KV cache holding the model’s whole window. Reasoning at the effort asked, tool calls and vision.', view: 'agent', lane: 'qwen4-35b', maker: 'qwen'},
|
||
[LFM3_UNIT]: {title: 'Liquid AI LFM3', kind: 'Text, 262K tokens of context', desc: 'Liquid AI’s small hybrid model, 1.7B, in its official NVFP4 build, served by vLLM. Post-trained for agents: reasoning (on or off) and tool calls, many requests at once.', view: 'agent', lane: 'lfm3', maker: 'liquid'},
|
||
[IMAGE_UNIT]: {title: 'Qwen-Image 2.1', kind: 'Images', desc: 'Create, edit with up to ten references, cut out with a real alpha channel.', view: 'image', lane: 'image', maker: 'qwen'},
|
||
[IMAGE_H3_UNIT]: {title: 'MiniMax-H3-Image', kind: 'Images, up to 16.9 megapixels', desc: 'MiniMax’s image model in six steps: create, or edit with up to ten references, at 2K in about 16 s and 4K in about 82 s. Its licence is not granted in the EU, the UK, South Korea or the US.', view: 'image', lane: 'image-h3', maker: 'minimax'},
|
||
[VIDEO_UNIT]: {title: 'MiniMax-H3', kind: 'Video with sound', desc: 'Video and audio made together, from a prompt or from keyframes.', view: 'video', lane: 'video', maker: 'minimax'},
|
||
// its own view since v1.54: the Transcription tab drives it through the cockpit's relay; programs still ask it on its port with the box's key
|
||
[TRANSCRIBE_UNIT]: {title: 'NVIDIA Nemotron Transcribe', kind: 'Speech to text, on its own port', desc: 'NVIDIA’s speech recognizer, 30B with 4B active, in GGUF Q8_0, served by llama.cpp on port 30036 with the box’s key: /v1/audio/transcriptions and /v1/realtime. Measured on this box: French WER 2.76 %, English 0.40 %, about ten times faster than real time.', view: 'transcribe', lane: 'transcribe', maker: 'nvidia'},
|
||
|
||
[EMBED_UNIT]: {title: 'pplx-embed v1 0.6B', kind: 'Embeddings, on the CPU beside every lane', desc: 'Perplexity’s embeddings model (MIT), 0.6B in float32 with mean pooling, served by this project’s own server on the CPU on a port of its own: /v1/embeddings, 1024 dimensions, through the proxy with the box’s key or on that port on the box. It runs beside whichever lane serves and stops nothing.', view: 'lanes', lane: 'embeddings', maker: 'perplexity'},
|
||
[CLIPSTRAL_UNIT]: {title: 'Mistral Multimodal Embed 1B', kind: 'Embeddings of texts and images, on the CPU beside the others', desc: 'Mistral’s Clipstral (Apache-2.0), 1.24B: texts and images in one space of 1024 dimensions, so that a text finds the images it describes. Served by this project’s own server on the CPU on a port of its own: /v1/embeddings in the shape of Mistral’s API, through the proxy with the box’s key and this model’s name, or on that port on the box. It stops nothing, and runs beside every lane but Flash-Next, Nemotron 3.5 Super VL and Kolibri-1 FP8, which leave the box too little memory.', view: 'lanes', lane: 'clipstral', maker: 'mistral'},
|
||
[OCR_UNIT]: {title: 'OvisOCR3', kind: 'Documents read, on the GPU beside every lane', desc: 'ATH-MaaS’s OCR model (Apache-2.0), 0.8B built on Qwen3.5: PDFs, scans and photos read as text, tables and formulas, each block placed on its page, and fields read by name. Served by SGLang on the GPU with a share of the memory of its own, behind this project’s front on port 30032: the OCR view, and /v1/ocr in Mistral’s shape through the proxy.', view: 'ocr', lane: 'ocr', maker: 'ovis'}};
|
||
// a lane's maker's mark, as an image the stylesheet sizes (the marks belong to their owners, img/logos/NOTICE.md)
|
||
function makerMark(unit, cls = 'mark'){
|
||
const box = el('span', cls); box.setAttribute('aria-hidden', 'true');
|
||
const img = el('img'); img.src = `/static/img/logos/${LANE_META[unit].maker}.svg`; img.alt = ''; img.decoding = 'async';
|
||
box.append(img); return box;
|
||
}
|
||
// How long each lane takes to answer after a start, before the box has seen one of its
|
||
// boots (measured on the reference box). Once a lane booted in front of the cockpit, the
|
||
// median of its own boots replaces these.
|
||
const READY_DEFAULT = {[U27]: 540, [UFLASH]: 780, [FLASH_LOCAL_UNIT]: 1020, [KOLIBRI_UNIT]: 600, [NEMOTRON_UNIT]: 450, [NEMOTRON_SUPER_UNIT]: 660, [ORNITH_UNIT]: 420, [FLASH_UNSLOTH_UNIT]: 420, [IMAGE_UNIT]: 70, [IMAGE_H3_UNIT]: 451, [VIDEO_UNIT]: 720, [TRANSCRIBE_UNIT]: 15, [LFM25_UNIT]: 290, [LFM3_UNIT]: 160, [INKLING_UNIT]: 180, [QWEN4_35B_UNIT]: 580, [EMBED_UNIT]: 10, [CLIPSTRAL_UNIT]: 10, [OCR_UNIT]: 150};
|
||
const TARGET_UNIT = t => t === 'image' || t === 'image-turbo' ? IMAGE_UNIT : t === 'image-h3' ? IMAGE_H3_UNIT : t === 'video' ? VIDEO_UNIT
|
||
: t === 'transcribe' ? TRANSCRIBE_UNIT : t === 'lfm25' ? LFM25_UNIT : t === 'lfm3' ? LFM3_UNIT : t === 'inkling' ? INKLING_UNIT : t === 'qwen4-35b' ? QWEN4_35B_UNIT
|
||
: String(t).startsWith('kolibri') ? KOLIBRI_UNIT : t === 'nemotron-super' ? NEMOTRON_SUPER_UNIT : String(t).startsWith('nemotron') ? NEMOTRON_UNIT
|
||
: t === 'flash-local' ? FLASH_LOCAL_UNIT : t === 'ornith-122b' ? ORNITH_UNIT : String(t).startsWith('flash-unsloth') ? FLASH_UNSLOTH_UNIT
|
||
: t === 'embeddings' ? EMBED_UNIT : t === 'clipstral' ? CLIPSTRAL_UNIT : t === 'ocr' ? OCR_UNIT : String(t).startsWith('flash') ? UFLASH : U27;
|
||
const LANE_TARGETS = {[U27]: ['stock', 'uncensored', 'fp8', 'uncensored-fp8', 'arete', 'daisyrose'], [UFLASH]: ['flash', 'flash-uncensored', 'flash-nvda'],
|
||
[FLASH_LOCAL_UNIT]: ['flash-local'],
|
||
[KOLIBRI_UNIT]: ['kolibri', 'kolibri-nvfp4'], [NEMOTRON_UNIT]: ['nemotron'], [NEMOTRON_SUPER_UNIT]: ['nemotron-super'],
|
||
[ORNITH_UNIT]: ['ornith-122b'], [FLASH_UNSLOTH_UNIT]: ['flash-unsloth-iq3', 'flash-unsloth'], [IMAGE_UNIT]: ['image', 'image-turbo'],
|
||
[IMAGE_H3_UNIT]: ['image-h3'], [VIDEO_UNIT]: ['video'], [TRANSCRIBE_UNIT]: ['transcribe'], [LFM25_UNIT]: ['lfm25'],
|
||
[LFM3_UNIT]: ['lfm3'], [INKLING_UNIT]: ['inkling'], [QWEN4_35B_UNIT]: ['qwen4-35b'], [EMBED_UNIT]: ['embeddings'],
|
||
[CLIPSTRAL_UNIT]: ['clipstral'], [OCR_UNIT]: ['ocr']};
|
||
// Each version's official name: the model, its precision, and who publishes it, read off the repository its
|
||
// installer pins (decisions 1180 and 1185: "abliterated", the word of those builds' own makers, never "uncensored"
|
||
// nor "stock"; the targets' ids, in commands, do not change). dashboard/tests/test_target_names.py reads each
|
||
// repository back from the installers.
|
||
const TARGET_NAME = {stock: 'Qwen3.8 27B NVFP4 · RadixArk', uncensored: 'Qwen3.8 27B abliterated NVFP4 · edp1096',
|
||
fp8: 'Qwen3.8 27B FP8 · Qwen', 'uncensored-fp8': 'Qwen3.8 27B abliterated FP8 · edp1096',
|
||
arete: 'Arete 27B NVFP4 · atakans',
|
||
daisyrose: 'DaisyRose 27B NVFP4 · RadixArk',
|
||
flash: 'Qwen3.8 Flash-Next NVFP4 · RadixArk', 'flash-uncensored': 'Qwen3.8 Flash-Next abliterated NVFP4 · dealignai',
|
||
'flash-nvda': 'Qwen3.8 Flash-Next NVFP4 · NVIDIA', 'flash-local': 'Qwen3.8 Flash-Next FP4-Local · NVIDIA',
|
||
image: 'Qwen-Image 2.1 · Qwen', 'image-turbo': 'Qwen-Image 2.1 Turbo · Qwen', video: 'MiniMax-H3 · MiniMax',
|
||
kolibri: 'Kolibri-1 FP8 · Aleph Alpha', 'kolibri-nvfp4': 'Kolibri-1 NVFP4 · Quantinine',
|
||
nemotron: 'Nemotron 3.5 Bolt 24GB · NVIDIA', 'nemotron-super': 'Nemotron 3.5 Super VL NVFP4 · NVIDIA',
|
||
'ornith-122b': 'Ornith 1.5 122B NVFP4 · Ornith AI', 'flash-unsloth': 'Qwen3.8 Flash-Next UD-Q4_K_XL GGUF · Unsloth',
|
||
'flash-unsloth-iq3': 'Qwen3.8 Flash-Next UD-IQ3_XXS GGUF · Unsloth',
|
||
'image-h3': 'MiniMax-H3-Image · MiniMax',
|
||
transcribe: 'NVIDIA Nemotron 3.5 Transcribe 30B-A4B Q8_0 GGUF · mradermacher',
|
||
lfm25: 'LFM2.5 24B-A2B FP8 · Liquid AI', lfm3: 'LFM3 1.7B NVFP4 · Liquid AI',
|
||
inkling: 'Inkling 2 Mini · Thinking Machines', 'qwen4-35b': 'Qwen4-35B-A3B NVFP4 · RadixArk',
|
||
embeddings: 'pplx-embed v1 0.6B · Perplexity', clipstral: 'Mistral Multimodal Embed 1B · Mistral AI', ocr: 'OvisOCR3 · ATH-MaaS'};
|
||
// A version's name on its button in Lanes, and the line that tells it apart once chosen. A
|
||
// target is declared in the tables of this block: a page test fails when one lacks a name or a line.
|
||
const TARGET_SHORT_NAME = {stock: 'NVFP4 · RadixArk', uncensored: 'Abliterated NVFP4 · edp1096', fp8: 'FP8 · Qwen',
|
||
'uncensored-fp8': 'Abliterated FP8 · edp1096', arete: 'Arete NVFP4 · atakans', daisyrose: 'DaisyRose NVFP4 · RadixArk', flash: 'NVFP4 · RadixArk', 'flash-uncensored': 'Abliterated NVFP4 · dealignai',
|
||
'flash-nvda': 'NVFP4 · NVIDIA', image: 'Base', 'image-turbo': 'Turbo', video: 'H3', kolibri: 'FP8 · Aleph Alpha',
|
||
'kolibri-nvfp4': 'NVFP4 · Quantinine', nemotron: 'Bolt', 'nemotron-super': 'Super VL', 'flash-local': 'FP4-Local',
|
||
'ornith-122b': '122B', 'flash-unsloth': 'UD-Q4_K_XL · Unsloth', 'flash-unsloth-iq3': 'UD-IQ3_XXS · Unsloth',
|
||
'image-h3': 'H3-Image', transcribe: 'Q8_0', lfm25: 'FP8 · Liquid AI', lfm3: 'NVFP4 · Liquid AI',
|
||
inkling: 'NVFP4 and MXFP8 · Thinking Machines', 'qwen4-35b': 'NVFP4 · RadixArk', embeddings: 'pplx-embed', clipstral: 'Clipstral', ocr: 'OvisOCR3'};
|
||
const TARGET_LINE = {
|
||
stock: 'The default: smallest and fastest', uncensored: 'Refusals removed, same size and speed',
|
||
fp8: "Qwen's own weights: the most faithful, and heavier", 'uncensored-fp8': 'Refusals removed, and heavier',
|
||
arete: 'Nous Research’s fine-tune, the same size and serving path',
|
||
daisyrose: 'RadixArk’s RL-only fine-tune, the same size and serving path',
|
||
flash: 'The default', 'flash-uncensored': 'Refusals removed', 'flash-nvda': "NVIDIA's own export",
|
||
image: '40 steps, the most detail', 'image-turbo': '8 steps, about 4.5 times faster', video: 'The one version',
|
||
kolibri: "Aleph Alpha's own weights: the reference", 'kolibri-nvfp4': '4-bit experts: faster under load, French a little weaker',
|
||
nemotron: 'The one version: 2-bit experts and their drafter',
|
||
'nemotron-super': 'The one version: NVFP4 and its drafter, a 1M window',
|
||
'flash-local': 'The one version: NVIDIA’s FP4 build and its MTP head',
|
||
'ornith-122b': 'The one version: its authors’ NVFP4 build and its MTP head',
|
||
'flash-unsloth': 'Unsloth’s dynamic 4-bit GGUF, with an n-gram lookup and a DFlash2 draft: two requests at once',
|
||
'flash-unsloth-iq3': 'The default: its experts in 3-bit, faster, four requests at once',
|
||
'image-h3': 'The one version: six steps, up to 16.9 megapixels',
|
||
transcribe: 'The one version: Q8_0 and its F16 projector',
|
||
lfm25: 'The one version: its official FP8 and its DSpark draft',
|
||
lfm3: 'The one version: its official NVFP4',
|
||
inkling: 'The one version: its NVFP4 and MXFP8 experts and its DSpark draft head',
|
||
'qwen4-35b': 'The one version: RadixArk’s NVFP4 experts, its DFlash2 draft and Qwen’s tokenizer',
|
||
embeddings: 'The one version: 0.6B in float32, 1024 dimensions',
|
||
clipstral: 'The one version: 1.24B, texts and images in 1024 dimensions',
|
||
ocr: 'The one version: 0.8B in bfloat16, its prompts from its own folder'};
|
||
const TARGET_NOTE = {
|
||
embeddings: 'Perplexity’s pplx-embed-v1-0.6b (MIT), 0.6B in float32 with mean pooling, served by this project’s own server on the CPU, capped by its cgroup and pinned to the A725 cores, its vectors the int8 ones of the ONNX export Perplexity publishes. On the reference box: 736 to 741 tokens/s over 16 inputs of 512 tokens, a question of twelve words in 0.11 s, 1 GiB of its own. For texts: documents, code, an index to search with words. The first Load downloads about 3 GB, and the Qwen3.8 27B lane’s image on a box without it.',
|
||
clipstral: 'Mistral’s Multimodal Embed 1B (codename Clipstral, Apache-2.0): texts and images in one space, so that a sentence finds the photos it describes, served by this project’s own server on the CPU, its vectors those of the code Mistral publishes. On the reference box: 0.91 s a photo, 1,024 tokens/s of texts when indexing, ready in 7 to 9 s, 6.4 GiB at its highest. Documents, OCR-heavy content and code are out of its scope, by its card. The first Load downloads about 3 GB, and the Qwen3.8 27B lane’s image on a box without it.',
|
||
ocr: 'ATH-MaaS’s OvisOCR3 (Apache-2.0), 0.8B built on Qwen3.5: documents read as Markdown, tables, formulas in LaTeX and fields by name, each block placed on its page, by SGLang on the GPU beside the lane that serves, with a share of the memory of its own. Each document’s pages are drawn in a container of their own, with no network. The first Load downloads about 2 GB, and SGLang 1.0.0’s image on a box without it.',
|
||
stock: 'The NVFP4 quantization this repo pins by default: smallest and fastest of the 27B targets. The first switch downloads about 22 GB.',
|
||
uncensored: 'The abliterated NVFP4 checkpoint: same size and speed as RadixArk’s NVFP4, refusals removed. The first switch downloads about 22 GB.',
|
||
fp8: 'Qwen’s own FP8 release: the most faithful weights of this lane, and the heaviest. 30.9 GB against 21.9 GB for NVFP4, taken out of the KV pool: 771,139 tokens against 863,398 on the same 1M unit, and a slower decode. The first switch downloads about 31 GB.',
|
||
'uncensored-fp8': 'The abliterated weights in Qwen’s FP8 format: the same 30.9 GB and the same cost in pool and speed as FP8. The first switch downloads about 31 GB.',
|
||
arete: 'Arete 27B, Nous Research’s fine-tune of Qwen3.8 27B (Apache-2.0), in atakans’s NVFP4 build of 21.1 GB: the serving path of RadixArk’s NVFP4 with its DFlash2 draft, and the same fp8 KV cache, which its switch declares in the checkpoint’s config. Measured on this box on 2026-11-14: GSM8K 99.2 %, MMLU 88.0 %, HumanEval 96.3 %, 69 to 72 tokens/s alone, the needle found at 120,000 and 300,000 tokens. The first switch downloads about 21 GB.',
|
||
daisyrose: 'DaisyRose 27B, RadixArk’s reinforcement-learning-only fine-tune of Qwen3.8 27B (Apache-2.0, no SFT, no distillation), in RadixArk’s NVFP4 build of 21.95 GB: the serving path of RadixArk’s NVFP4 with its DFlash2 draft, and the same fp8 KV cache, which its switch declares in the checkpoint’s config (it declares none, like Arete’s). Nothing measured on this box yet; RadixArk publishes Terminal-Bench 2.1 at 75.5 against 73.0 for Qwen3.8-27B (xhigh reasoning). The first switch downloads about 22 GB.',
|
||
flash: 'The Qwen3.8 Flash-Next lane: its own unit, its own image, and a 47.7 GiB N-gram table on the NVMe that the server rewrites at every boot. The first switch downloads about 136 GB.',
|
||
'flash-uncensored': 'The abliterated build of the same 176B tree, byte-identical in layout, so every serving flag is the same. The first switch downloads about 136 GB.',
|
||
'flash-nvda': 'NVIDIA’s own mixed-precision export of the same model, served with a pinned MoE runner. The first switch downloads about 133 GB.',
|
||
image: 'Text to image, editing with up to ten references, native RGBA. 31 GiB of weights that do not fit beside a text lane. The first switch downloads about 33 GB.',
|
||
'image-turbo': 'Qwen’s eight-step distillation of the same model, for the same three uses: a 1024 × 1024 image in 7.5 s against 34 s, at the same memory, the eight steps fixed by the checkpoint. The first switch downloads about 33 GB.',
|
||
video: 'Text to video with joint audio, plus first and last frame conditioning. The checkpoint does not fit beside a text lane. The first switch downloads about 145 GB.',
|
||
kolibri: 'Aleph Alpha’s official FP8 release, served as their model card says: vLLM 0.29 with their plugin, 262,144 tokens of context, temperature 1.0, top_p 0.97, top_k 128, reasoning on (effort low, medium, high or none per request). German and English are its languages. Measured on this box: 48 tokens/s alone, 166 at 8 requests. The first switch downloads about 79 GB.',
|
||
'kolibri-nvfp4': 'The same model with its routed experts in 4-bit NVFP4 (Quantinine), attention and everything else the official FP8 bit for bit: 53 tokens/s alone and 248 at 8 requests, in 42.8 GiB instead of 73.6. English and German text score level with the FP8; French measurably lower (about 4 % of perplexity). The first switch downloads about 46 GB.',
|
||
nemotron: 'NVIDIA’s Nemotron 3.5 Bolt, its experts in 2 bits, served as its model card says: vLLM nightly with b12x, its LiLiCorr drafter, 262,144 tokens of context, temperature 1.0, top_p 0.95, reasoning on (off, efficient or full per request). It reads images and video. Measured on this box: 140 tokens/s alone on code, 50 on prose, 201 in all at 16 requests, 24 requests at the full window. The first switch downloads about 26 GB.',
|
||
'nemotron-super': 'NVIDIA’s Nemotron 3.5 Super VL in NVFP4, served as its model card says for a DGX Spark: its LiLiCorr drafter, a window of 1,048,576 tokens, the Mamba state in float16 with stochastic rounding, temperature 1.0, top_p 0.95, reasoning on (off, efficient or full per request), in the Nemotron 3.5 Bolt lane’s vLLM image. It reads images and video. Measured on this box: 70 tokens/s alone on code, 31 on prose, its whole window 1.1 to 1.3 times over in its cache. The first switch downloads about 77 GB.',
|
||
'flash-local': 'NVIDIA’s own FP4 build of the flash model, served as its model card says for a DGX Spark: vLLM with b12x, its experts and its n-gram table in NVFP4 after a quantization-aware distillation from the full precision (GPQA Diamond 91.5 % against 92.2 % on NVIDIA’s card), an MTP head drafting 4 tokens, 262,144 tokens of context and a KV cache of about 920,000 tokens, reasoning on at lean as on the other Qwen lanes unless a request asks for another level (xhigh by default with FLASH_LOCAL_EFFORT=xhigh). Its table is read at every token: with the HF cache on another disk, its first Load copies the table’s files (32 GB) beside your home directory. The first boot tunes b12x’s kernels for this GPU, about 17 min; the next ones take about 6. The first switch downloads about 102 GB.',
|
||
'ornith-122b': 'Ornith AI’s Ornith 1.5 122B (MIT) in its authors’ NVFP4 build, served by vLLM with b12x in the Qwen3.8 Flash-Next FP4-Local lane’s image: its experts and output head in NVFP4, its projections in FP8, an MTP head drafting 2 tokens, 1,048,576 tokens of context (its own 262,144 stretched four times with YaRN), temperature 0.6, top_p 0.95, top_k 20, reasoning on (off with effort none or minimal). It reads images and video. The first switch downloads about 78 GB.',
|
||
'flash-unsloth': 'Unsloth’s dynamic GGUF of the flash model (UD-Q4_K_XL, 76.9 GiB of weights), served by llama.cpp’s own server with its n-gram lookup and ggml-org’s DFlash2 draft (Q8_0), its weights copied into the GPU’s memory and its n-gram (PLE) table (26.8 GiB) read from the disk as the tokens need it: 262,144 tokens of context for each of two requests at once (1,048,576 for one request at a time with FLASH_UNSLOTH_CONTEXT=1m given to its installer), the model card’s sampling (temperature 1.0, top_p 0.95, top_k 20), reasoning on at lean as on the other Qwen lanes unless a request asks for another level. Measured on this box at that sampling, one request, on its image (llama.cpp b12316, 2026-11-12, each text’s first pass): 51.8 tokens/s on code, 56.9 in reasoning, 31.5 on prose and 123.7 on a rewrite of code (27.9, 27.7, 27.3 and 27.4 without the lookup and the draft, on the image before it); two requests at once, 63.2 tokens/s in all. The first switch downloads about 112 GB.',
|
||
'flash-unsloth-iq3': 'Unsloth’s UD-IQ3_XXS GGUF of the same model, served the same way (llama.cpp’s own server, its n-gram lookup and ggml-org’s DFlash2 draft, the same chat template and sampling): its experts in 3-bit, 51.1 GiB of weights where UD-Q4_K_XL has 76.9, and the same n-gram (PLE) table, read from the disk. The room it leaves goes to more requests at once: 262,144 tokens of context for each of four, the KV cache in q8_0 (1,048,576 for one request at a time with FLASH_UNSLOTH_CONTEXT=1m given to its installer). Measured on this box, one request at temperature 0 on its image (llama.cpp b12316, 2026-11-14, each text’s first pass, two windows of 262,144 for both quantizations, the GPU capped at 2,400 MHz): 69.4 tokens/s on code, 76.4 in reasoning, 37.7 on prose and 171.7 on a rewrite of code, where UD-Q4_K_XL gave 55.6, 60.5, 32.0 and 129.8; with its four windows, 66.2 tokens/s for one request and 71.5 in all with four (the GPU capped at 2,000 MHz). At the medium effort and temperature 0, four requests at once (llama.cpp b12291 built on this box, 2026-11-14): GSM8K 98.8 % (250 questions; 98.4 % for UD-Q4_K_XL on the same bench) and HumanEval 98.2 % (164 problems; 99.4 %), the box keeping 28.7 GiB available at the lowest. The lane’s default since v1.49.0. The first switch downloads about 85 GB, 55 when UD-Q4_K_XL is there (the n-gram table is one file for the two).',
|
||
'image-h3': 'MiniMax’s MiniMax-H3-Image, served by SGLang Diffusion from its main branch: text to image and editing with up to ten references, six steps fixed by the checkpoint with no guidance, from 2048 × 2048 to 16.9 megapixels (4736 × 3552, 6272 × 2688), one image per call. Measured on the reference box at this lane’s SGLang commit: 2048 × 2048 in 15.6 s, 4736 × 3552 in 81 s, an edit at 2048 × 2048 with a 1024-pixel reference in 24 s, the engine at 92.3 GB at its peak: it fits beside no other lane. Its text encoder is MiniMax-H3’s, the video lane’s, fetched with it when the video lane has not. Its licence, the MiniMax-H3-Image Community License, is not granted in the European Union, the United Kingdom, South Korea or the United States; elsewhere commercial use above USD 1 million of annual revenue, or as a service hosted for others, needs MiniMax’s written authorization. The first switch downloads about 69 GB, and 67 more without the video lane.',
|
||
transcribe: 'NVIDIA’s Nemotron-3.5-Transcribe-30B-A4B in mradermacher’s GGUF Q8_0 with its F16 projector (36.5 GB), served by llama.cpp’s own server in the Qwen3.8 Flash-Next Unsloth GGUF lane’s image, on a port of its own (30036) with the box’s key: /v1/audio/transcriptions and the /v1/realtime websocket, reasoning off, a window of 65,536 tokens, as the reference box measured it (French WER 2.76 % over 20 excerpts, English 0.40 %, ready in 15 s once its files are on disk). The proxy and opencode are text clients and do not reach it. It fits beside no text lane. The first switch downloads about 37 GB.',
|
||
lfm25: 'Liquid AI’s LFM2.5 24B-A2B in its official FP8 build (its linear weights in FP8 by blocks of 128 × 128), with its official DSpark draft, served by SGLang in the Qwen3.8 27B lane’s image as Liquid AI’s card gives the command: 131,072 tokens of context, the draft proposing blocks of 9 tokens, its own chat template and sampling (temperature 0.1, top_k 50, repetition_penalty 1.05). Its template opens a reasoning block at every answer, whatever a request asks: no effort or switch turns it off, and System One does not run on it. Tool calls in its own format, which the engine turns into OpenAI tool calls. Measured on the reference box on 2026-11-14: ready in 286 s, GSM8K 91.2 % (250 questions, 8 requests at once), 362 tokens/s in all at the median under those 8, the draft accepting 5.28 tokens at the median, a KV cache of 1,667,049 tokens, the box keeping 24 GiB available at the lowest. Its licence, the LFM Open License v1.0, does not grant commercial use to a company with an annual revenue of 10 million US dollars or more. The first switch downloads about 26 GB.',
|
||
lfm3: 'Liquid AI’s LFM3 1.7B in its official NVFP4 build (ModelOpt, weights and activations by groups of 16), served by vLLM’s own nightly image (LFM3 is in no vLLM release yet) with the model’s whole window, 262,144 tokens, its own chat template and sampling (temperature 0.1, top_k 50, repetition_penalty 1.1), a memory share of 0.75 that keeps the box room (vLLM’s KV cache otherwise grows into all the memory left). It reasons by default and can be asked not to (the none variant, pi’s off): its template reads that switch and no level. Tool calls in Qwen3-Coder’s form, which the engine turns into OpenAI tool calls. Measured on the reference box on 2026-11-16, before its share was set: ready in about 2 min 40 s, GSM8K 89.6 % (250 questions), 87.7 tokens/s alone and 3,912 in all at 128 requests, a prompt of 131,072 tokens computed in 10.2 s, an agent’s next turn served 99 to 100 % from the prefix cache. Its licence, the LFM Open License v1.0, does not grant commercial use to a company with an annual revenue of 10 million US dollars or more. The first switch downloads about 2 GB.',
|
||
inkling: 'Thinking Machines’ Inkling 2 Mini (Apache-2.0, with Thinking Machines’ Model Acceptable Use Policy), a looped mixture of experts: 26.4B parameters with 3.4B active, its middle twelve layers run three times per token (5.4B effective), its experts in NVFP4 and MXFP8. Served by SGLang from the image its cookbook gives the model (it is in no SGLang release yet) with the cookbook’s DGX Spark recipe, a few flags measured on the box and the DSpark draft head of its checkpoint verifying 8 tokens a step, at the Qwen3.8 27B lane’s memory share (0.76), the model’s window of 1,048,576 tokens, its own chat template and sampling (temperature 1.0). It reasons at the effort a request asks, from none to xhigh, high by default; its card says the lowest effort does not turn the reasoning off, and System One does not run on it. It reads images. Measured on the reference box at its share of 0.76 (2026-12-01): ready in 127 to 226 s, a KV cache of 1,196,960 tokens at the least, the window whole, 161.8 tokens/s in all under 48 agents with the GPU clock capped at 2,000 MHz. At the recipe’s share of 0.45 (2026-11-22 to 24): 64.7 tokens/s at bench.sh’s greedy median against 72.3 for the Qwen3.8 27B, 30.3 tokens/s alone and 89.2 in all at 8 requests against 34.0 and 119.0, a prompt of 32,015 tokens computed in 10.0 s, three tool calls of three, GSM8K 98.0 % (250 questions) and HumanEval 97.6 % (164) at its default effort. The first switch downloads about 21 GB.',
|
||
'qwen4-35b': 'Qwen’s Qwen4-35B-A3B (Apache-2.0), a mixture of experts: 35B parameters with 3B active per token, a 20B n-gram embedding table beside them, Gated DeltaNet and Qwen Sparse Attention over the model’s window of 1,048,576 tokens; text, images and video in. In RadixArk’s NVFP4 build (its routed experts in NVFP4, the rest as Qwen published it), served by SGLang from the image its cookbook gives Qwen4 (it is in no SGLang release yet) with the DFlash2 arm of the cookbook’s DGX Spark recipe: RadixArk’s DFlash2 draft proposing 7 tokens at a time, its own KV cache in BF16, a memory share of 0.72, and the model’s KV cache in FP8 so that it holds the whole window, Qwen’s tokenizer and the sampling of Qwen’s card (temperature 1.0 when it reasons, 0.7 when it does not). It reasons at the effort a request asks (off, low, high or xhigh, high by default; the proxy maps the other levels clients send onto these four). It reads images. On the reference box (2026-12-04, the GPU clock capped at 2,000 MHz): 61 tok/s on one stream (1,024 tokens in, 512 out), 85 to 127 on bench.sh’s greedy probes and up to 151 on its sampled one, 41 requests at a time, a KV cache of 1,278,336 tokens, a needle found at 900,000 tokens, GSM8K 0.976. The first switch downloads about 48 GB.'};
|
||
// What the first switch to a target downloads, in GB of 10^9, as its note says it
|
||
const targetGB = t => Number((/The first (?:switch|Load) downloads about (\d+) GB/.exec(TARGET_NOTE[t] || '') || [])[1]) || null;
|
||
// What installs a lane this box does not have. Since v1.20 a plain ./install.sh installs
|
||
// every lane, so one missing here was left out (a --no-<lane> on the last run) or did not fit:
|
||
// --with-<lane> installs it beside the lane that serves, which keeps serving. A text lane comes with
|
||
// its default target; the others download when they are loaded.
|
||
const LANE_INSTALL = {[U27]: './install.sh --with-27b', [UFLASH]: './install.sh --with-flash', [IMAGE_UNIT]: './install.sh --with-image',
|
||
[VIDEO_UNIT]: './install.sh --with-video', [KOLIBRI_UNIT]: './install.sh --with-kolibri',
|
||
[NEMOTRON_UNIT]: './install.sh --with-nemotron', [NEMOTRON_SUPER_UNIT]: './install.sh --with-nemotron-super',
|
||
[FLASH_LOCAL_UNIT]: './install.sh --with-flash-local', [ORNITH_UNIT]: './install.sh --with-ornith-122b',
|
||
[FLASH_UNSLOTH_UNIT]: './install.sh --with-flash-unsloth', [IMAGE_H3_UNIT]: './install.sh --with-image-h3',
|
||
[TRANSCRIBE_UNIT]: './install.sh --with-transcribe', [LFM25_UNIT]: './install.sh --with-lfm25',
|
||
[LFM3_UNIT]: './install.sh --with-lfm3', [INKLING_UNIT]: './install.sh --with-inkling',
|
||
[QWEN4_35B_UNIT]: './install.sh --with-qwen4-35b', [EMBED_UNIT]: './install.sh --with-embeddings',
|
||
[CLIPSTRAL_UNIT]: './install.sh --with-clipstral', [OCR_UNIT]: './install.sh --with-ocr'};
|
||
// A lane a 64 GB DGX Spark cannot hold (boxmem.py, which the machine panel carries): where another
|
||
// lane names the command that installs it, it says it needs a 128 GB box. Unknown is no refusal.
|
||
const laneFits = unit => {
|
||
const box = (F.machine || {}).box || {};
|
||
return box.cls !== '64' || !Array.isArray(box.fits) || box.fits.includes(unit);
|
||
};
|
||
// A switch target the same way: the 27B's FP8 ones are not a 64 GB box's (boxmem.py's targets)
|
||
const targetFits = target => {
|
||
const box = (F.machine || {}).box || {};
|
||
return box.cls !== '64' || !Array.isArray(box.targets) || box.targets.includes(target);
|
||
};
|
||
const NEEDS_128 = 'needs a 128 GB DGX Spark';
|
||
const installHint = unit => laneFits(unit) ? `Install it on the box: ${LANE_INSTALL[unit]}`
|
||
: `It ${NEEDS_128}, and this box is a 64 GB one.`;
|
||
// What the box is, from the same panel: the name its maker sells it under and its memory class
|
||
// ("ASUS Ascent GX10, 128 GB"), or null while unknown.
|
||
const boxName = (box = (F.machine || {}).box || {}) => box.cls ? `${box.name || 'GB10 box'}, ${box.cls} GB` : null;
|
||
|
||
// ── the facts every view shares (each guarded against missing data) ──────────
|
||
const F = {life: null, units: {}, config: {}, job: null, load: {}, pool: null, window: 262144, ceiling: 0, usable: 0.92,
|
||
maxRun: null, target: null, containers: {}, proxy: null, agent: null, update: null, memFloor: null, toolTargets: null, resent: null, machine: null,
|
||
gpu: null, ocfit: null, transcribe: null, feedRows: null};
|
||
const engines = () => (F.life && F.life.engines) || {};
|
||
// the ports the text engine and its proxy answer on here (PORT= and PROXY_PORT= of the installer), as the cockpit read them
|
||
const enginePort = () => ':' + (((F.config || {}).ports || {}).engine || 30000);
|
||
const proxyPort = () => ':' + (((F.config || {}).ports || {}).proxy || 30001);
|
||
function servingEngine(){ return Object.entries(engines()).find(([n, e]) => !BESIDE_UNITS.has(n) && (!UNIT_DOWN.has(e.state) || e.restarting)) || null; }
|
||
// The lane holds its seat: the GPU's goes to one lane at a time, a lane beside every lane has one of its own. Its card read
|
||
// "Load" beside "Stop" while it served, and its bay "Load this lane" (found by the stability check, 2026-12-01).
|
||
function seated(unit){
|
||
const s = servingEngine(), e = engines()[unit];
|
||
return BESIDE_UNITS.has(unit) ? !!e && (!UNIT_DOWN.has(e.state) || !!e.restarting) : !!(s && s[0] === unit);
|
||
}
|
||
// The lane enabled at boot, or null when none is (or systemctl did not say). enabledUnit()
|
||
// falls back on the 27B, a default to show logs of; said as a fact, it read "27B starts at
|
||
// boot" on a box that boots nothing (found 2026-10-02).
|
||
function bootUnit(){
|
||
const e = Object.entries(F.units || {}).find(([n, u]) => LANE_UNITS.includes(n) && !BESIDE_UNITS.has(n) && u.enabled === 'enabled');
|
||
return e ? e[0] : null;
|
||
}
|
||
function enabledUnit(){ return bootUnit() || U27; }
|
||
// systemctl answered for every lane that can be the boot lane (a unit not installed answers too, with no file state)
|
||
const bootKnown = () => LANE_UNITS.every(n => BESIDE_UNITS.has(n) || (F.units && F.units[n] && F.units[n].enabled !== '?' && F.units[n].enabled !== undefined));
|
||
function servingReady(){ const s = servingEngine(); return !!(s && ['ready', 'degraded', 'wedged'].includes(s[1].state)); }
|
||
// A TEXT engine is up: the pool, the context window, flush, abort and smoke all talk to
|
||
// the text engine on :30000, and with a lane that serves none of it (the image and video
|
||
// lanes, the transcribe lane on its own port) that port is closed.
|
||
function textReady(){ const s = servingEngine(); return servingReady() && !!s && !isImageLane(s[0]) && s[0] !== VIDEO_UNIT && s[0] !== TRANSCRIBE_UNIT; }
|
||
const imageServing = () => { const s = servingEngine(); return !!s && isImageLane(s[0]); };
|
||
const videoServing = () => { const s = servingEngine(); return !!s && s[0] === VIDEO_UNIT; };
|
||
const transcribeServing = () => { const s = servingEngine(); return !!s && s[0] === TRANSCRIBE_UNIT; };
|
||
// answering on its own port: only at ready or degraded, like the capsule of the Now view, so a copied
|
||
// test is not offered while the lane boots and its curl would fail (review of v1.53.0, 2026-11-19)
|
||
const transcribeReady = () => { const s = servingEngine(); return !!s && s[0] === TRANSCRIBE_UNIT && (s[1].state === 'ready' || s[1].state === 'degraded'); };
|
||
function bootSeconds(unit){
|
||
const b = ((engines()[unit] || {}).boots || []).slice().sort((a, c) => a - c), n = b.length;
|
||
// the median: the middle boot, or the mean of the two middle ones for an even count
|
||
return n ? (n % 2 ? b[(n - 1) / 2] : Math.round((b[n / 2 - 1] + b[n / 2]) / 2)) : (READY_DEFAULT[unit] || 540);
|
||
}
|
||
const readyIn = unit => 'about ' + fmtDur(bootSeconds(unit));
|
||
// ── a start under way, in the words every place that shows one shares ─────────────────────────
|
||
// What is usual and whether it moves are the server's (lifecycle.py, boot_usual and boot_watch): the median of the starts
|
||
// this box recorded (the reference box's time for a lane with none), past `long` it is longer than usual, and it barely
|
||
// moves once nothing of it did. From the median on, every place said "about 0 s left", for 5 min 21 s of a start that
|
||
// never got past its weights (2026-11-29).
|
||
const startLevel = e => (e && TRANSITIONAL.has(e.state) && e.watch && e.watch.level) || 'normal';
|
||
const startKind = e => ({still: 'err', long: 'warn'})[startLevel(e)] || '';
|
||
const startUsual = (unit, e) => e.usual || {s: e.eta || READY_DEFAULT[unit] || 540, n: e.eta ? (e.boots || []).length : 0};
|
||
const startFrom = u => !u.n ? 'the reference box' : u.n === 1 ? 'the one start recorded here' : `median of ${u.n} starts`;
|
||
const startPct = (unit, e) => { const u = startUsual(unit, e); return u.s && e.elapsed ? Math.min(97, 100 * e.elapsed / u.s) : null; };
|
||
function startLeft(unit, e){
|
||
const u = startUsual(unit, e), level = startLevel(e);
|
||
if (level === 'still') return `barely moving for ${fmtDur(e.watch.still_s)}`;
|
||
if (e.elapsed == null || !u.s) return '';
|
||
if (level === 'long') return `longer than usual: ${fmtDur(u.s)} (${startFrom(u)})`;
|
||
const left = Math.round(u.s - e.elapsed);
|
||
return left > 0 ? `about ${fmtDur(left)} left (${startFrom(u)})` : `at its usual time, ${fmtDur(u.s)} (${startFrom(u)})`;
|
||
}
|
||
const fmtGB = b => (b / 1e9).toFixed(1) + ' GB';
|
||
const fmtRate = b => (b >= 1e7 ? Math.round(b / 1e6) : (b / 1e6).toFixed(1)) + ' MB/s';
|
||
// what it has done so far, in facts the cockpit read: [name, words] each
|
||
function startFacts(e){
|
||
const w = e.watch, out = [];
|
||
if (!w) return out;
|
||
const weights = e.state === 'loading-weights' || e.state === 'loading-draft';
|
||
const gbOf = w.size && w.read <= w.size ? ` of ${fmtGB(w.size)}` : '';
|
||
if (weights && w.read != null) out.push(['Disk', w.read < 5e7 ? `nothing read${gbOf && ` of its ${fmtGB(w.size)} checkpoint`}`
|
||
: `${gbOf ? (w.read / 1e9).toFixed(1) : fmtGB(w.read)}${gbOf} read` + (w.read_rate != null ? `, ${fmtRate(w.read_rate)}` : '')]);
|
||
const grows = !weights || w.mem_rate == null ? '' : w.mem_rate >= 1e6 ? `+${fmtRate(w.mem_rate)}` : 'still';
|
||
const taken = w.taken == null ? '' : `${fmtGiB(Math.max(0, w.taken))} taken${w.took > 0 ? ` (${fmtGiB(w.took)} last time, once ready)` : ''}`;
|
||
if (taken || grows) out.push(['Memory', [taken, grows].filter(Boolean).join(', ')]);
|
||
if (w.gpu_w != null || w.gpu_use != null) out.push(['GPU', [w.gpu_use != null ? `${w.gpu_use} %` : null, w.gpu_w != null ? `${w.gpu_w.toFixed(0)} W` : null].filter(Boolean).join(', ')]);
|
||
// its own stamp goes: its age is said
|
||
const line = (w.line || '').replace(/^\[[^\]]*\]\s*/, '');
|
||
if (line) out.push(['Last log line', `${w.line_least ? 'at least ' : ''}${fmtDur(w.line_age)} ago: ${line.length > 110 ? line.slice(0, 109) + '…' : line}`]);
|
||
return out;
|
||
}
|
||
const startPace = w => w && w.pace_s ? `At this pace its ${fmtGB(w.size)} take ${fmtMin(w.pace_s)}.` : '';
|
||
// the text engine's served target, when it is one of this unit's
|
||
const ownTarget = unit => F.target && TARGET_UNIT(F.target) === unit ? F.target : null;
|
||
// What the serving engine itself says it serves, only from a read taken after this engine
|
||
// started: the read comes every 30 s and is kept through a restart, so for up to 30 s after
|
||
// one it still names the previous engine's checkpoint. The image engine's answer is read by
|
||
// the cockpit once per life of its unit, so it is never the previous one's. null when there
|
||
// is no such read.
|
||
function servedTarget(unit){
|
||
const s = servingEngine(), age = lastAges.engine_info;
|
||
if (!s || s[0] !== unit || unit === VIDEO_UNIT) return null;
|
||
if (isImageLane(unit)) return s[1].served_target || null;
|
||
return s[1].elapsed != null && age != null && age < s[1].elapsed ? ownTarget(unit) : null;
|
||
}
|
||
function laneTarget(unit){
|
||
// A target of another lane is the previous engine's, read before this one answered.
|
||
return servedTarget(unit) || (engines()[unit] || {}).target || null;
|
||
}
|
||
function laneLabel(unit){
|
||
if (unit === AGENT_UNIT) return 'the opencode web server';
|
||
if (unit === PROXY_UNIT) return 'the keepalive proxy';
|
||
if (unit === SPEECH_UNIT) return 'the speech lane';
|
||
const t = laneTarget(unit);
|
||
return (t && TARGET_NAME[t]) || LANE_NAME[unit] || unit.replace('.service', '');
|
||
}
|
||
// A lane's name in two parts, the family (LANE_NAME) and what follows it (its precision and who publishes it), for
|
||
// the places too narrow for the whole: a phone's capsule says the family alone (the version's full name pushed
|
||
// its state, "ready", out of it, 2026-11-08), and a bay's title breaks between the two, never after the " · ".
|
||
function nameParts(full, unit){
|
||
const fam = LANE_NAME[unit] || '';
|
||
return fam && full.startsWith(fam + ' ') ? [fam, full.slice(fam.length + 1)] : [full, ''];
|
||
}
|
||
// The engine a lane runs and its version, the one way the page says them (decision 1178): dashboard/engines.py's
|
||
// table, which its tests check against the installers' pins. 'SGLang 1.0.0'; '' for a unit with none. The lane that
|
||
// serves says the version its engine reports (engine_info): when that is not the one the pinned image reports (an
|
||
// image of the operator's), the engine's own word is said, never the pin's.
|
||
// a lane's kind with the window it runs, where that is the 1M one its installer offers (FLASH_LOCAL_CONTEXT=1m,
|
||
// discussion #63, and FLASH_UNSLOTH_CONTEXT=1m): the words of LANE_META say the native window, and said "262K" of a
|
||
// lane serving 1,048,576. The lane that serves says its engine's window (engine_info), the others the one their unit
|
||
// starts with: a unit staged again while its lane serves names a window its engine does not run yet (code review of
|
||
// v1.45.2)
|
||
const laneKind = unit => {
|
||
const k = LANE_META[unit].kind, live = F.liveEngine && F.liveEngine.unit === unit ? F.liveEngine.window : 0;
|
||
const w = live > 0 ? live : ((F.engineTable || {})[unit] || {}).window;
|
||
return w >= 1000000 && /262K tokens/.test(k) ? k.replace('262K tokens', '1M tokens') : k;
|
||
};
|
||
function engineLabel(unit){
|
||
// the table the cockpit reads every 30 s (engine_table)
|
||
const e = ((F.engineTable || {})[unit]);
|
||
if (!e) return '';
|
||
// the engine's own word, for the lane that serves (F.liveEngine, cleared once that lane no longer serves)
|
||
const live = F.liveEngine && F.liveEngine.unit === unit ? String(F.liveEngine.version || '').replace(/^vLLM /, '') : '';
|
||
if (live) return e.reports && live !== e.reports ? `${e.engine} ${live}` : e.label;
|
||
// a lane its installer set on an image of the operator's: not the pin's version (pinned, read in its unit)
|
||
return e.pinned === false ? `${e.engine}, another image` : e.label;
|
||
}
|
||
// When systemctl did not say ('?'), the lifecycle's list decides: it leaves out a diffusion lane
|
||
// with no unit file. Read as installed, '?' showed the image and video lanes of a box whose
|
||
// systemctl did not answer as installed, their checkpoint "…" for good (a CI runner, 2026-10-02).
|
||
const installed = unit => { const u = F.units[unit]; return u && u.enabled !== '?' ? u.enabled !== '' : !!engines()[unit]; };
|
||
const blockedFor = key => ((F.life || {}).blocked || {})[key] || null;
|
||
|
||
// ── the bus: renderers per collector, isolated ────────────────────────────────
|
||
const HANDLERS = {}; // collector -> [fn]
|
||
const AFTER = []; // hooks after every payload
|
||
function on(src, fn){ (HANDLERS[src] = HANDLERS[src] || []).push(fn); }
|
||
function afterApply(fn){ AFTER.push(fn); }
|
||
let lastMsgAt = 0, lastState = null, lastAges = {}, lastErrors = {}, offline = false;
|
||
const lastGood = {}, renderErr = {}, warned = {};
|
||
function warnOnce(name, msg){ if (warned[name] === msg) return; warned[name] = msg; console.warn(name, msg); }
|
||
// order matters a little: config, units and engine info feed the others
|
||
const ORDER = ['config', 'units', 'repo', 'engine_info', 'engine_fast', 'lifecycle', 'machine', 'gpu'];
|
||
function apply(state){
|
||
lastState = state; lastMsgAt = Date.now();
|
||
const serverNow = Math.max(0, ...Object.values(state).map(w => w && w.ts ? w.ts : 0));
|
||
const errors = {}, ages = {};
|
||
for (const [name, wrap] of Object.entries(state)){
|
||
const bad = !!(wrap && wrap.data && wrap.data.error);
|
||
if (bad) errors[name] = wrap.data.error;
|
||
// a collector that keeps failing must not look fresh just because it keeps trying
|
||
if (wrap && wrap.ts && !bad) lastGood[name] = wrap.ts;
|
||
ages[name] = lastGood[name] != null ? Math.max(0, serverNow - lastGood[name]) : null;
|
||
}
|
||
const names = ORDER.filter(n => n in state).concat(Object.keys(state).filter(n => !ORDER.includes(n)));
|
||
for (const name of names){
|
||
const fns = HANDLERS[name]; if (!fns) continue;
|
||
const wrap = state[name] || {};
|
||
for (const fn of fns){
|
||
try{
|
||
if (errors[name]) throw new Error(errors[name]);
|
||
fn(wrap.data || {});
|
||
delete renderErr[name]; delete warned[name];
|
||
}catch(e){
|
||
if (!errors[name]) renderErr[name] = e.message; // a bug here, not a dead source
|
||
warnOnce(name, e.message);
|
||
if (name === 'engine_info') try { (HANDLERS.engine_info_down || []).forEach(f => f()); } catch { /* keep going */ }
|
||
}
|
||
}
|
||
}
|
||
lastAges = ages; lastErrors = errors;
|
||
freshness();
|
||
AFTER.forEach(fn => { try { fn(state, errors); } catch(e){ warnOnce('after', e.message); } });
|
||
}
|
||
function freshness(){
|
||
// age = how old the server said the sample was, PLUS how long we have had no payload
|
||
const drift = lastMsgAt ? Math.max(0, (Date.now() - lastMsgAt) / 1000) : 0;
|
||
const periods = (F.config && F.config.periods) || {};
|
||
document.querySelectorAll('[data-src]').forEach(sec => {
|
||
const srcs = sec.dataset.src.split(',');
|
||
let worst = 0, stale = false, err = null;
|
||
srcs.forEach(s => {
|
||
const a = lastAges[s], p = periods[s] || 5;
|
||
if (a != null){ const t = a + drift; worst = Math.max(worst, t); if (t > 3 * p + 3) stale = true; }
|
||
if (renderErr[s]) err = err || `${s} render error: ${renderErr[s]}`;
|
||
else if (lastErrors[s] && s !== 'engine_info') err = err || `${s}: ${lastErrors[s]}`;
|
||
});
|
||
const head = [...sec.children].find(c => c.localName === 'header');
|
||
const age = head && head.querySelector('.age');
|
||
if (age){ setText(age, err ? 'no data: ' + err.slice(0, 60) : stale ? `stale, ${fmtDur(worst)} old` : worst > 4 ? `${Math.round(worst)} s ago` : 'live'); }
|
||
sec.classList.toggle('stale', stale || !!err);
|
||
});
|
||
}
|
||
|
||
// ── the transport: SSE, polling behind it, an offline watch ───────────────────
|
||
let es = null, pollTimer = null, sseUp = false, lastSseTry = 0;
|
||
function login(){ leavingForLogin = true; location.href = '/login' + (location.hash || ''); }
|
||
function setConn(onl, label){
|
||
const l = $('conn-lamp'); if (l) l.className = 'lamp' + (onl ? ' ok live' : offline ? ' err' : ' warn');
|
||
setText('conn-lbl', label);
|
||
}
|
||
function startPolling(){
|
||
if (pollTimer) return;
|
||
pollTimer = setInterval(async () => {
|
||
try{
|
||
const r = await fetch('/api/state'); if (r.status === 401) return login();
|
||
apply(await r.json()); setConn(true, 'polling');
|
||
if (!sseUp && Date.now() - lastSseTry > 15000) connect(); // climb back to the live stream
|
||
}catch{ setConn(false, 'offline'); }
|
||
}, 2000);
|
||
}
|
||
function connect(){
|
||
lastSseTry = Date.now();
|
||
if (es){ try { es.close(); } catch { /* already gone */ } } // never two streams at once
|
||
// handlers hold their OWN stream: a late event from a replaced one must not flip the state
|
||
// the first frame has every collector, the next ones those read since: with their data, or their time alone when it is the same
|
||
const src = new EventSource('/api/stream?changes=1'), whole = {};
|
||
es = src;
|
||
src.onopen = () => { if (es !== src) return; sseUp = true; setConn(true, 'live'); if (pollTimer){ clearInterval(pollTimer); pollTimer = null; } };
|
||
src.onmessage = ev => {
|
||
if (es !== src) return;
|
||
try {
|
||
for (const [name, w] of Object.entries(JSON.parse(ev.data))) whole[name] = 'data' in w ? w : {...whole[name], ts: w.ts};
|
||
apply({...whole}); setConn(true, 'live');
|
||
} catch(e){ console.warn('bad frame', e.message); }
|
||
};
|
||
src.onerror = () => {
|
||
if (es !== src){ try { src.close(); } catch { /* gone */ } return; }
|
||
sseUp = false; setConn(false, 'reconnecting'); src.close(); startPolling(); setTimeout(connect, 3000);
|
||
};
|
||
}
|
||
function startTransport(){
|
||
fetch('/api/state').then(r => { if (r.status === 401){ login(); return null; } return r.json(); })
|
||
.then(s => { if (s){ apply(s); connect(); } })
|
||
.catch(() => { setConn(false, 'offline'); startPolling(); });
|
||
// offline watch, on the client's clock
|
||
setInterval(() => {
|
||
const was = offline; offline = !!lastMsgAt && Date.now() - lastMsgAt > 6000;
|
||
if (offline) setConn(false, 'no data for ' + fmtDur((Date.now() - lastMsgAt) / 1000));
|
||
if (lastState) freshness();
|
||
// drawn again at each second of a lost connection: the banner kept the "7 s" of its first drawing (audit, 2026-11-30)
|
||
if ((was !== offline || offline) && lastState) renderBanners(lastState, lastErrors), renderNotices();
|
||
if (was !== offline) applyBusy();
|
||
}, 1000);
|
||
}
|
||
async function csrf(){
|
||
const t = await fetch('/api/csrf', {method: 'POST'});
|
||
if (t.status === 401){ login(); throw new Error('signed out'); }
|
||
return (await t.json()).token;
|
||
}
|
||
async function postJSON(path, body){
|
||
const tok = await csrf();
|
||
const r = await fetch(path, {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({...body, csrf: tok})});
|
||
if (r.status === 401){ login(); throw new Error('signed out'); }
|
||
let out = {};
|
||
try { out = await r.json(); } catch { /* an empty answer */ }
|
||
return {status: r.status, ok: r.ok, out};
|
||
}
|
||
|
||
// ── router: views, the rail, the phone menu ───────────────────────────────────
|
||
const VIEWS = ['now', 'lanes', 'traffic', 'machine', 'agent', 'decide', 'image', 'video', 'transcribe', 'ocr', 'library', 'logs', 'settings'];
|
||
// the old tab names still land: links in the docs and bookmarks say #agent, #engines
|
||
const ALIAS = {overview: 'now', engines: 'lanes', requests: 'traffic', systemone: 'decide', models: 'library', setup: 'settings'};
|
||
const ON_SHOW = {};
|
||
let activeView = 'now';
|
||
function onShow(view, fn){ (ON_SHOW[view] = ON_SHOW[view] || []).push(fn); }
|
||
const ON_HIDE = {};
|
||
function onHide(view, fn){ (ON_HIDE[view] = ON_HIDE[view] || []).push(fn); }
|
||
function showView(name, push = true){
|
||
name = ALIAS[name] || name;
|
||
if (!VIEWS.includes(name)) name = 'now';
|
||
const was = activeView; activeView = name; document.body.dataset.view = name;
|
||
VIEWS.forEach(v => { const s = $('view-' + v); if (s) s.classList.toggle('active', v === name); });
|
||
document.querySelectorAll('.rail .nav').forEach(b => {
|
||
if (b.dataset.view === name) b.setAttribute('aria-current', 'page'); else b.removeAttribute('aria-current');
|
||
});
|
||
if (push && location.hash !== '#' + name) history.replaceState(null, '', '#' + name);
|
||
setRailOpen(false);
|
||
if (was !== name){
|
||
setNotices(false); window.scrollTo({top: 0});
|
||
(ON_HIDE[was] || []).forEach(fn => { try { fn(); } catch(e){ warnOnce('hide ' + was, e.message); } });
|
||
}
|
||
(ON_SHOW[name] || []).forEach(fn => { try { fn(); } catch(e){ warnOnce('show ' + name, e.message); } });
|
||
}
|
||
function setRailOpen(open){
|
||
document.body.classList.toggle('railopen', open);
|
||
const b = $('menubtn'); if (b) b.setAttribute('aria-expanded', String(open));
|
||
}
|
||
function setRailMin(min){
|
||
document.body.classList.toggle('railmin', min);
|
||
const b = $('railbtn');
|
||
if (b){ b.setAttribute('aria-expanded', String(!min)); setText(b.querySelector('span'), min ? 'Expand' : 'Collapse');
|
||
if (min) b.title = 'Expand'; else b.removeAttribute('title'); }
|
||
try { localStorage.setItem('cockpit.rail', min ? 'min' : 'open'); } catch { /* storage may be unavailable */ }
|
||
}
|
||
function badge(view, txt, kind){ const b = $('bdg-' + view); if (b){ setText(b, txt || ''); b.className = 'bdg' + (kind ? ' ' + kind : ''); } }
|
||
|
||
// ── toasts ────────────────────────────────────────────────────────────────────
|
||
// An error stays until it is closed, and a screen reader says it at once: the 24 errors the page tells this way went after
|
||
// 4.2 s, read or not (WCAG 2.2.1; audit of 2026-11-30). A warning says why something was refused: it keeps 8 s at least.
|
||
function toast(text, kind, ms = 4200){
|
||
const box = $('toasts'); if (!box) return;
|
||
const t = el('div', 'toast' + (kind ? ' ' + kind : ''), text), err = kind === 'err';
|
||
// the same words, still on the screen, are said once: three clicks on a microphone refused left three errors to close
|
||
t.said = `${kind || ''}:${text}`;
|
||
[...box.children].filter(c => c.said === t.said).forEach(c => c.remove());
|
||
if (err){
|
||
t.setAttribute('role', 'alert');
|
||
const x = el('button', 'toast-x'); x.type = 'button'; x.setAttribute('aria-label', 'Close this message');
|
||
x.addEventListener('click', () => t.remove()); t.append(x);
|
||
}
|
||
box.append(t);
|
||
// the oldest goes first, an error after every other one, and never what was just said: with four errors on the screen it
|
||
// was the one put out, so nothing but errors was seen until one was closed (review of v1.60.0)
|
||
while (box.children.length > 4){
|
||
const old = [...box.children].find(c => c !== t && !c.classList.contains('err')) || (err ? box.firstChild : null);
|
||
if (!old) break;
|
||
old.remove();
|
||
}
|
||
if (!err) setTimeout(() => t.remove(), kind === 'warn' ? Math.max(ms, 8000) : ms);
|
||
}
|
||
// The update: the README's one command in its long form, get.sh from GitHub itself (v1.41.0),
|
||
// run from this checkout so that get.sh updates this clone. The server sends it; a page newer
|
||
// than the process that serves it builds it.
|
||
function updateCmd(cfg){
|
||
const c = cfg || {};
|
||
return (c.terminal_only || {}).update
|
||
|| `cd ${c.repo_dir || '~/dgx-spark-qwen38'} && curl -fsSL https://raw.githubusercontent.com/hasso5703/alzeo/main/get.sh | bash`;
|
||
}
|
||
// The installer of this very clone, for one get.sh refuses to update: off its channel's branch
|
||
// (main or stable), or with commits of its own past origin/main (a worktree a developer installs
|
||
// from; cockpit.py, release_state's clone_local)
|
||
function localInstallCmd(cfg){
|
||
const c = cfg || {};
|
||
return (c.terminal_only || {}).update_stack || `cd ${c.repo_dir || '~/dgx-spark-qwen38'} && ./install.sh`;
|
||
}
|
||
// ./install.sh --recommended through the same one command (get.sh hands install.sh what follows -s --)
|
||
function recommendedCmd(cfg){
|
||
const c = cfg || {};
|
||
return (c.terminal_only || {}).recommended
|
||
|| `cd ${c.repo_dir || '~/dgx-spark-qwen38'} && curl -fsSL https://raw.githubusercontent.com/hasso5703/alzeo/main/get.sh | bash -s -- --recommended`;
|
||
}
|
||
// The clipboard API exists in a secure context only: on the box's LAN or Tailscale address, plain
|
||
// HTTP, every copy control said the browser refused (found 2026-10-21, a GX10's cockpit opened by its
|
||
// Tailscale address). A selected textarea and execCommand('copy'), still inside the click, copy there.
|
||
async function copyText(txt){
|
||
if (navigator.clipboard && window.isSecureContext){
|
||
try { await navigator.clipboard.writeText(txt); toast('Copied.', 'ok', 1800); return true; } catch { /* the textarea below */ }
|
||
}
|
||
// 16 px: under it, iOS Safari zooms the whole page on the field's focus and never zooms back
|
||
// (cockpit.css); and the focus goes back where it was, on the button for a keyboard
|
||
const back = document.activeElement;
|
||
const ta = el('textarea'); ta.value = txt; ta.readOnly = true; ta.dataset.copy = '';
|
||
ta.style.cssText = 'position:fixed; top:-1000px; left:0; opacity:0; font-size:16px';
|
||
document.body.append(ta); ta.select(); ta.setSelectionRange(0, txt.length);
|
||
let done = false;
|
||
try { done = document.execCommand('copy'); } catch { done = false; }
|
||
ta.remove();
|
||
if (back && back !== document.body && back.focus) back.focus({ preventScroll: true });
|
||
if (done) toast('Copied.', 'ok', 1800); else toast('The browser refused the clipboard; select the text instead.', 'warn');
|
||
return done;
|
||
}
|
||
// A copy icon carries its field: the same button, drawn as a copy mark at rest and a green
|
||
// check for a moment after a successful copy. The text may be a function for a command that
|
||
// is rebuilt while the view is open.
|
||
function copyGlyph(){
|
||
const NS = 'http://www.w3.org/2000/svg', s = document.createElementNS(NS, 'svg');
|
||
s.setAttribute('viewBox', '0 0 24 24'); s.setAttribute('aria-hidden', 'true');
|
||
const rect = document.createElementNS(NS, 'rect');
|
||
rect.setAttribute('class', 'g-copy'); rect.setAttribute('x', '8.5'); rect.setAttribute('y', '8.5');
|
||
rect.setAttribute('width', '12.5'); rect.setAttribute('height', '12.5'); rect.setAttribute('rx', '2.5');
|
||
const back = document.createElementNS(NS, 'path');
|
||
back.setAttribute('class', 'g-copy');
|
||
back.setAttribute('d', 'M15.5 8.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v8.5a2 2 0 0 0 2 2h3.5');
|
||
const check = document.createElementNS(NS, 'path');
|
||
check.setAttribute('class', 'g-check'); check.setAttribute('d', 'M4.5 12.5 9.5 17.5 19.5 7');
|
||
s.append(rect, back, check);
|
||
return s;
|
||
}
|
||
function wireCopyButton(btn, text, label = 'Copy'){
|
||
if (!btn) return btn;
|
||
if (!btn.querySelector('svg')) btn.append(copyGlyph());
|
||
const get = () => typeof text === 'function' ? text() : text;
|
||
const reset = () => { btn.classList.remove('copied'); btn.setAttribute('aria-label', label); btn.title = label; };
|
||
btn.setAttribute('aria-label', label); btn.title = label;
|
||
btn.addEventListener('click', async () => {
|
||
if (!await copyText(String(get() || ''))) return;
|
||
btn.classList.add('copied'); btn.setAttribute('aria-label', 'Copied'); btn.title = 'Copied';
|
||
clearTimeout(btn.copyTimer); btn.copyTimer = setTimeout(reset, 1600);
|
||
});
|
||
return btn;
|
||
}
|
||
function copyIconButton(text, label){
|
||
const b = el('button', 'icon-btn copy-icon copy-inline'); b.type = 'button';
|
||
b.append(copyGlyph());
|
||
return wireCopyButton(b, text, label);
|
||
}
|
||
|
||
// ── actions: one sheet, the exact command, the warnings, one job at a time ─────
|
||
// a GPU clock cap as the page says it: "2,400 MHz", or "no cap" (the Machine view, ops.js)
|
||
const gpuCapName = cap => cap === 'none' ? 'no cap' : `${fmtN(Number(cap))} MHz`;
|
||
// Same vocabulary as the server's event feed: an action reads as a sentence.
|
||
const ACTION_PHRASE = {
|
||
speech_boot: p => p.verb === 'enable' ? 'start the speech lane with the box' : 'no longer start the speech lane with the box',
|
||
unit: p => `${p.verb || 'act on'} ${laneLabel(String(p.unit || ''))}`,
|
||
boot_off: p => `no longer start ${LANE_NAME[p.unit] || p.unit || 'a lane'} with the box`,
|
||
switch: p => `point the boot at ${TARGET_NAME[p.target] || p.target || 'a target'}`,
|
||
flush_cache: () => 'flush the engine cache', abort_all: () => 'abort every generation in flight',
|
||
smoke: () => 'run a smoke generation', diag_bundle: () => 'write a diagnostics bundle',
|
||
fit_opencode: () => 'fit the opencode limits to this engine',
|
||
delete_strays: () => 'delete the stray revisions from the model caches',
|
||
delete_repo: p => `delete ${p.repo || 'a repository'} from the model cache`,
|
||
delete_image: p => `delete the engine image ${p.image || ''}`,
|
||
delete_runtime: p => `delete the ${runtimeName(p.item) || 'runtime'}`,
|
||
apply_pending: p => `put in place the update ${LANE_NAME[p.unit] || p.unit || 'a lane'} waited for`,
|
||
fetch: p => `download the checkpoint of ${TARGET_NAME[p.target] || p.target || 'a target'}`,
|
||
clients: p => `set the clients for the window of ${TARGET_NAME[p.target] || p.target || 'a lane'}`,
|
||
prepare: p => `build the runtime of the ${laneOfTarget(p.target) || ''} lane`,
|
||
gpu_clock: p => p.cap === 'none' ? 'lift the GPU clock cap' : `cap the GPU clock at ${gpuCapName(p.cap)}`};
|
||
function actionPhrase(action, params){
|
||
const f = ACTION_PHRASE[action]; if (f) return f(params || {});
|
||
const p = params || {}; return action + (Object.keys(p).length ? ' ' + Object.entries(p).map(([k, v]) => `${k} ${v}`).join(', ') : '');
|
||
}
|
||
const cap1 = s => String(s).charAt(0).toUpperCase() + String(s).slice(1);
|
||
// these three talk to the text engine: without one they can only fail
|
||
const NEEDS_ENGINE = new Set(['flush_cache', 'abort_all', 'smoke']);
|
||
// what the Kolibri lane's vLLM has no route for: offered there, these could only fail (found in
|
||
// review, 2026-10-14). The fit reads SGLang's /server_info, and Kolibri's limits are its own. Abort
|
||
// all goes through the proxy, which stops vLLM's generations and llama.cpp's too (v1.40.3).
|
||
const KOLIBRI_CANNOT = {
|
||
flush_cache: 'The Kolibri-1 lane has no cache flush route: vLLM evicts its prefix cache by itself.',
|
||
fit_opencode: 'The Kolibri-1 lane\'s opencode limits are its own, set when it is loaded: there is nothing to fit to its pool.'};
|
||
// the Nemotron lanes run on vLLM too: the same two
|
||
const NEMOTRON_CANNOT = {
|
||
flush_cache: 'The Nemotron 3.5 Bolt lane has no cache flush route: vLLM evicts its prefix cache by itself.',
|
||
fit_opencode: 'The Nemotron 3.5 Bolt lane\'s opencode limits are its own, set when it is loaded: there is nothing to fit to its pool.'};
|
||
// and the Nemotron 3.5 Super VL lane, in its own name (cockpit.py NEMOTRON_SUPER_CANNOT)
|
||
const NEMOTRON_SUPER_CANNOT = {
|
||
flush_cache: 'The Nemotron 3.5 Super VL lane has no cache flush route: vLLM evicts its prefix cache by itself.',
|
||
fit_opencode: 'The Nemotron 3.5 Super VL lane\'s opencode limits are its own, set when it is loaded: there is nothing to fit to its pool.'};
|
||
// and the Qwen3.8 Flash-Next FP4-Local lane, in its own name, as the server says it (cockpit.py FLASH_LOCAL_CANNOT)
|
||
const FLASH_LOCAL_CANNOT = {
|
||
flush_cache: 'The Qwen3.8 Flash-Next FP4-Local lane has no cache flush route: vLLM evicts its prefix cache by itself.',
|
||
fit_opencode: 'The Qwen3.8 Flash-Next FP4-Local lane\'s opencode limits are its own, set when it is loaded: its window decides them, not its pool.'};
|
||
// and the Ornith lane, in its own name (cockpit.py ORNITH_CANNOT)
|
||
const ORNITH_CANNOT = {
|
||
flush_cache: 'The Ornith 1.5 122B lane has no cache flush route: vLLM evicts its prefix cache by itself.',
|
||
fit_opencode: 'The Ornith 1.5 122B lane\'s opencode limits are its own, set when it is loaded: its window decides them, not its pool.'};
|
||
// and the Liquid AI LFM3 lane, in its own name (cockpit.py LFM3_CANNOT)
|
||
const LFM3_CANNOT = {
|
||
flush_cache: 'The Liquid AI LFM3 lane has no cache flush route: vLLM evicts its prefix cache by itself.',
|
||
fit_opencode: 'The Liquid AI LFM3 lane\'s opencode limits are its own, set when it is loaded: its window decides them, not its pool.'};
|
||
// and the Unsloth GGUF lane, llama.cpp's, in its own name (cockpit.py FLASH_UNSLOTH_CANNOT)
|
||
const FLASH_UNSLOTH_CANNOT = {
|
||
flush_cache: 'The Qwen3.8 Flash-Next Unsloth GGUF lane has no cache flush route: llama.cpp keeps and evicts its prompt cache by itself.',
|
||
fit_opencode: 'The Qwen3.8 Flash-Next Unsloth GGUF lane\'s opencode limits are its own, set when it is loaded: its window decides them, not its pool.'};
|
||
function cannotWhy(name){
|
||
const s = servingEngine();
|
||
return !s ? '' : s[0] === KOLIBRI_UNIT ? (KOLIBRI_CANNOT[name] || '') : s[0] === FLASH_LOCAL_UNIT ? (FLASH_LOCAL_CANNOT[name] || '')
|
||
: s[0] === FLASH_UNSLOTH_UNIT ? (FLASH_UNSLOTH_CANNOT[name] || '') : s[0] === LFM3_UNIT ? (LFM3_CANNOT[name] || '')
|
||
: s[0] === ORNITH_UNIT ? (ORNITH_CANNOT[name] || '') : s[0] === NEMOTRON_SUPER_UNIT ? (NEMOTRON_SUPER_CANNOT[name] || '')
|
||
: isNemotron(s[0]) ? (NEMOTRON_CANNOT[name] || '') : '';
|
||
}
|
||
function noEngineWhy(){
|
||
if (textReady()) return '';
|
||
if (imageServing()) return 'The image lane is serving: this talks to the text engine, which is not running.';
|
||
if (videoServing()) return 'The video lane is serving: this talks to the text engine, which is not running.';
|
||
if (transcribeServing()) return 'The NVIDIA Nemotron Transcribe lane is serving: this talks to the text engine, which is not running.';
|
||
const u = bootUnit();
|
||
return 'No text engine is serving. Start one first' + (u && !isImageLane(u) && u !== VIDEO_UNIT && u !== TRANSCRIBE_UNIT ? ` (it answers in ${readyIn(u)}).` : ' from Lanes.');
|
||
}
|
||
function busyWhy(){
|
||
if (offline) return 'The cockpit is unreachable: actions wait until the connection is back.';
|
||
if (loadRunning()) return `A load is running (${TARGET_NAME[SHEET.target]}). Wait for it to finish, or bring its window back with the job button.`;
|
||
if (F.job && F.job.current) return `Another action is running (${actionPhrase(F.job.current.action, F.job.current.params)}). Wait for it to finish.`;
|
||
return '';
|
||
}
|
||
// switch-model.sh restarts opencode-web when the config it reads changed, as fit_opencode says of its own rewrite
|
||
const AGENT_RESTART = 'If the Agent server runs and its config changed, it restarts to read it: a reply it is writing then is cut short.';
|
||
const EXPLAIN = {
|
||
speech_boot: p => p.verb === 'enable' ? 'systemd enables the speech lane: from the next boot it starts with the box and holds its host memory (2.5 GB with the 0.6B recognizer, 4.2 with the 1.7B) beside whichever lane serves. It does not start it now.'
|
||
: 'systemd disables the speech lane at boot: it stays as it is now, and after the next boot it is started by hand, here or with systemctl.',
|
||
unit: p => {
|
||
const lane = laneLabel(p.unit);
|
||
if (p.unit === AGENT_UNIT) return {stop: 'systemd stops opencode serve: the Agent view goes dark until the server is started again.',
|
||
start: 'systemd starts opencode serve on loopback; the Agent view is back within seconds.',
|
||
restart: 'systemd restarts opencode serve, which picks up an upgraded binary; the Agent view reconnects by itself.'}[p.verb] || '';
|
||
if (p.unit === SPEECH_UNIT) return {stop: 'systemd stops the speech lane: its audio routes answer nothing until it is started again, and the host memory it holds comes back. The lane that serves is not touched.',
|
||
start: 'systemd starts the speech lane on the CPU, beside the lane that serves: it takes no GPU memory, holds host memory instead (2.5 GB with the 0.6B recognizer, 4.2 with the 1.7B), and answers within seconds.',
|
||
restart: 'systemd restarts the speech lane: a transcription or a sentence being made right now is lost, and it answers again within seconds.'}[p.verb] || '';
|
||
if (p.unit === PROXY_UNIT) return p.verb === 'stop' ? `systemd stops the keepalive proxy. The engine keeps running, but agent clients on ${proxyPort()} lose their door until it is back.` : `systemd starts the keepalive proxy on ${proxyPort()}.`;
|
||
// the boot of a lane beside every lane (its card's button; the server takes both for those lanes alone)
|
||
if (p.verb === 'enable') return `systemd enables ${lane}: from the next boot it starts with the box, beside whichever lane serves, and holds its host memory. It does not start it now.`;
|
||
if (p.verb === 'disable') return `systemd disables ${lane} at boot: it stays as it is now, and after the next boot it is started by hand, here or with systemctl, or by its Load, which enables it again.`;
|
||
if (p.verb === 'stop') return `systemd stops ${lane}. Its memory comes back at once; no other lane starts by itself.`;
|
||
if (p.verb === 'restart') return `systemd restarts ${lane}; it answers again in ${readyIn(p.unit)}.`;
|
||
return `systemd starts ${lane}: it loads its weights and answers in ${readyIn(p.unit)}. Follow the boot in the dock and on the Now view.`;
|
||
},
|
||
boot_off: p => `systemd no longer starts ${LANE_NAME[p.unit]} with the box. It stays as it is now, serving or stopped, and after the next boot no lane serves until one is loaded here, or started on the box.`,
|
||
switch: p => (TARGET_NOTE[p.target] ? TARGET_NOTE[p.target] + '\n\n' : '') +
|
||
`switch-model.sh verifies the checkpoint, makes this lane the one enabled at boot and ${TARGET_UNIT(p.target) === VIDEO_UNIT || TARGET_UNIT(p.target) === IMAGE_H3_UNIT ? 'changes nothing else'
|
||
: TARGET_UNIT(p.target) === TRANSCRIBE_UNIT ? 'fetches what its GGUF files lack and puts in its unit for them: the proxy and opencode, text clients, stay as they are'
|
||
: TARGET_UNIT(p.target) === IMAGE_UNIT ? 'points its unit at this checkpoint'
|
||
: TARGET_UNIT(p.target) === KOLIBRI_UNIT ? `points its unit at this checkpoint and its memory share, and makes ${LANE_NAME[KOLIBRI_UNIT]} opencode's default model, with its compaction`
|
||
: TARGET_UNIT(p.target) === FLASH_LOCAL_UNIT ? `puts in its unit for this checkpoint, with its chat template and, when the HF cache is on another disk, the copies of its n-gram table, and makes ${LANE_NAME[FLASH_LOCAL_UNIT]} opencode's default model, with its compaction`
|
||
: TARGET_UNIT(p.target) === ORNITH_UNIT ? `puts in its unit for this checkpoint, and makes ${LANE_NAME[ORNITH_UNIT]} opencode's default model, with its compaction`
|
||
: TARGET_UNIT(p.target) === FLASH_UNSLOTH_UNIT ? `fetches what its GGUF files and its draft lack, puts in its unit for them with its chat template, and makes ${LANE_NAME[FLASH_UNSLOTH_UNIT]} opencode's default model, with its compaction`
|
||
: TARGET_UNIT(p.target) === LFM25_UNIT ? `fetches what its checkpoint and its draft lack, puts in its unit for them, and makes ${LANE_NAME[LFM25_UNIT]} opencode's default model, with its compaction`
|
||
: TARGET_UNIT(p.target) === LFM3_UNIT ? `puts in its unit for this checkpoint, and makes ${LANE_NAME[LFM3_UNIT]} opencode's default model, with its compaction`
|
||
: TARGET_UNIT(p.target) === INKLING_UNIT ? `fetches what its checkpoint lacks, puts in its unit for it, and makes ${LANE_NAME[INKLING_UNIT]} opencode's default model, with its compaction`
|
||
: TARGET_UNIT(p.target) === QWEN4_35B_UNIT ? `fetches what its checkpoint and its draft lack, puts in its unit for them, and makes ${LANE_NAME[QWEN4_35B_UNIT]} opencode's default model, with its compaction`
|
||
: isNemotron(TARGET_UNIT(p.target)) ? `points its unit at this checkpoint and its memory share, and makes ${LANE_NAME[TARGET_UNIT(p.target)]} opencode's default model, with its compaction`
|
||
: 'rewrites its unit and the opencode default model'}. It never restarts anything.`,
|
||
flush_cache: () => 'Empties the radix cache. Harmless; the engine refuses it while requests run.',
|
||
abort_all: () => { const u = (servingEngine() || [])[0];
|
||
return 'Every running or queued generation stops now, and each client is cut: an agent retries its request (end its turn in the agent).'
|
||
+ (u === KOLIBRI_UNIT || isVllmTable(u) || isLlamacpp(u) ? ` On this lane's engine, ${isLlamacpp(u) ? 'llama.cpp' : 'vLLM'}, the proxy closes each connection it relays: a generation sent to the engine straight goes on.` : ''); },
|
||
smoke: () => 'One real generation through the proxy, up to 2,048 tokens, the way a client uses it.',
|
||
diag_bundle: () => 'Collects logs, state and versions into a tarball in your home; the API key is masked everywhere.',
|
||
fit_opencode: () => 'Reads the KV pool of the engine serving now and rewrites only opencode’s context and output limits, so a conversation can never outgrow it. A dated backup is written first. If the Agent server runs, it restarts to read them: a reply it is writing then is cut short.',
|
||
clients: p => `switch-model.sh ${p.target} --clients sets the limits of opencode, pi and claude-local for the window ${LANE_NAME[TARGET_UNIT(p.target)]}’s unit starts with, `
|
||
+ 'with the lane’s name in opencode. opencode’s default model and its compaction stay with the lane the boot names, and nothing else changes: '
|
||
+ 'no fetch, no unit, no boot, no engine. ' + AGENT_RESTART,
|
||
// what the cap cost and gave on the reference box, and its limits (ops.js, the Machine view)
|
||
gpu_clock: p => gpuCapExplain(p.cap)};
|
||
// the stray revisions the last scan of the checkpoints offered to delete (Library, scanRegistry)
|
||
const REG_STRAYS = {list: [], bytes: 0};
|
||
// Library's Delete of one repository: the plan the server made for it (GET /api/registry/plan), which the sheet shows
|
||
const REG_DELETE = {plan: null, image: null, runtime: null};
|
||
// Library's runtimes and caches, by the server's item names (cockpit.py, RUNTIME_ITEMS)
|
||
const RUNTIME_NAME = {image: 'Qwen-Image 2.1 runtime', 'image-h3': 'MiniMax-H3-Image runtime', video: 'MiniMax-H3 video runtime',
|
||
'diffusion-caches': 'Diffusion caches of the first start', 'flash-table': `${LANE_NAME[UFLASH]} PLE table`,
|
||
'flash-local-table': `${LANE_NAME[FLASH_LOCAL_UNIT]} table copies`, speech: 'Speech lane models and runtime'};
|
||
// a lane's compile cache is an item by its folder in ~/.config/qwen38, <lane>-cache (the 27B's is sglang-cache)
|
||
const runtimeName = item => {
|
||
const lane = item === 'sglang-cache' ? '27b' : String(item || '').replace(/-cache$/, '');
|
||
const unit = /-cache$/.test(item) && Object.keys(SIDE_LANE).find(u => SIDE_LANE[u] === lane);
|
||
return RUNTIME_NAME[item] || (unit ? `${LANE_NAME[unit]} compile cache` : item);
|
||
};
|
||
// the lane a Load's target belongs to, by prepare-lane.sh's names (the cockpit's target_lane)
|
||
const laneOfTarget = t => SIDE_LANE[TARGET_UNIT(t)];
|
||
EXPLAIN.prepare = p => {
|
||
const lane = laneOfTarget(p.target), text = lane === 'flash' || lane === '27b';
|
||
return (text ? `prepare-lane.sh ${lane} ${p.target} builds what the lane runs, and fetches the checkpoint of ${TARGET_NAME[p.target] || p.target}: `
|
||
: `prepare-lane.sh runs install-${lane}.sh --prepare, which builds the lane's runtime: `)
|
||
+ `${LANE_RUNTIME[lane] || 'its runtime'}, as the user, with no sudo. It changes nothing else: no unit, no boot, no engine.`;
|
||
};
|
||
EXPLAIN.fetch = p => `switch-model.sh fetches the checkpoint of ${TARGET_NAME[p.target] || p.target} into the cache as a switch to it does: `
|
||
+ 'the cache first, resumable, its room checked before. It changes nothing else: no unit, no boot, no engine. The dock shows the bytes as they come.';
|
||
EXPLAIN.delete_strays = () => {
|
||
const s = REG_STRAYS;
|
||
return `Removes from the Hugging Face cache ${s.list.map(x => `${x.repo.split('/').pop()} ${x.rev.slice(0, 10)} (${fmtRoom(x.bytes)})`).join(', ')}`
|
||
+ `, ${fmtRoom(s.bytes)} in all: each one's snapshot and the blobs only it links to. No pin, no installed unit and no ref names them, `
|
||
+ 'so no lane reads them, and a blob another revision shares stays. The cockpit scans again when you confirm, and deletes only what is still stray.';
|
||
};
|
||
EXPLAIN.delete_repo = p => {
|
||
const d = REG_DELETE.plan || {}, kept = (d.kept_why || []).length;
|
||
return `Removes ${p.repo} from ${d.cache || 'its cache'}: ${fmtRoom(d.bytes)} freed on ${d.mount || 'its disk'}`
|
||
+ (kept ? `, keeping ${fmtGiB(d.kept_bytes)} of it (${d.kept_why.join('; ')})` : '') + '. '
|
||
+ (d.identical ? `The Hub still serves ${(d.revisions || []).length === 1 ? 'this revision' : 'each of its revisions'} exactly as it is here: a download gets it back. ` : '')
|
||
+ 'No lane, container or process reads it now, and a blob another repository shares stays. '
|
||
+ 'The cockpit plans it again when you confirm, asks the Hub again, and deletes only then.';
|
||
};
|
||
EXPLAIN.delete_image = p => {
|
||
const d = REG_DELETE.image || {};
|
||
return `Removes the image ${p.image} and each of its names (${(d.names || []).join(', ')}) with docker rmi: `
|
||
+ `${d.bytes == null ? 'the bytes only it holds' : fmtGiB(d.bytes)} freed on ${d.mount || 'its disk'}, the layers no other image has. `
|
||
+ (d.obtainable ? ((d.registry || [])[0] || {}).how ? 'Its lane builds it again here. ' : 'Its registry still serves it by its digest: a pull gets it back. ' : '')
|
||
+ 'No container starts from it and no lane that runs it serves. The cockpit plans it again when you confirm.';
|
||
};
|
||
EXPLAIN.delete_runtime = p => {
|
||
const d = REG_DELETE.runtime || {};
|
||
return `Removes ${d.what || (d.paths || []).join(', ')}: ${fmtRoom(d.bytes)} freed on ${d.mount || 'its disk'}. ${d.back || ''} `
|
||
+ 'No lane, container or process uses it now. The cockpit plans it again when you confirm, and deletes only then.';
|
||
};
|
||
const TITLE = {unit: p => `${cap1(p.verb)} ${laneLabel(p.unit)}`,
|
||
speech_boot: p => p.verb === 'enable' ? 'Start the speech lane with the box' : 'No longer start the speech lane with the box',
|
||
boot_off: p => `No longer start ${LANE_NAME[p.unit]} with the box`, switch: p => `Point the boot at ${TARGET_NAME[p.target] || p.target}`,
|
||
flush_cache: () => 'Flush the engine cache', abort_all: () => 'Abort every generation in flight', smoke: () => 'Run a smoke generation',
|
||
diag_bundle: () => 'Write a diagnostics bundle', fit_opencode: () => 'Fit the opencode limits',
|
||
delete_strays: () => 'Delete the stray revisions',
|
||
delete_repo: p => `Delete ${String(p.repo || '').split('/').pop()}`,
|
||
delete_image: p => `Delete the image ${p.image}`,
|
||
delete_runtime: p => `Delete the ${runtimeName(p.item)}`,
|
||
fetch: p => `Download ${TARGET_NAME[p.target] || p.target}`,
|
||
clients: p => `Set the clients for the window of ${TARGET_NAME[p.target] || p.target}`,
|
||
prepare: p => `Build the ${laneOfTarget(p.target)} lane's runtime`,
|
||
gpu_clock: p => p.cap === 'none' ? 'Lift the GPU clock cap' : `Cap the GPU clock at ${gpuCapName(p.cap)}`};
|
||
const VERB = {unit: p => cap1(p.verb) + ' ' + (LANE_NAME[p.unit] || laneLabel(p.unit)),
|
||
speech_boot: p => p.verb === 'enable' ? 'Start it with the box' : 'Stop starting it with the box', boot_off: () => 'Stop starting it with the box', switch: () => 'Point the boot', flush_cache: () => 'Flush',
|
||
abort_all: () => 'Abort all', smoke: () => 'Run the probe', diag_bundle: () => 'Write the bundle', fit_opencode: () => 'Fit the limits',
|
||
delete_strays: () => 'Delete them', delete_repo: p => p.lose === 'yes' ? 'Delete it anyway' : 'Delete it',
|
||
delete_image: p => p.lose === 'yes' ? 'Delete it anyway' : 'Delete it', delete_runtime: () => 'Delete it', fetch: () => 'Download', clients: () => 'Set the clients', prepare: () => 'Build it',
|
||
gpu_clock: p => p.cap === 'none' ? 'Lift the cap' : `Cap at ${gpuCapName(p.cap)}`};
|
||
// the GPU clock cap runs as a python job on the server, which hands the page each cap's exact command (its
|
||
// config); the sheet shows that command, not the job's name, unless this machine has no nvidia-smi (ops.js, GC),
|
||
// where None runs nothing and only forgets the cap kept
|
||
const argvFor = (name, p) => name === 'unit' ? ['sudo', '-n', '/usr/bin/systemctl', p.verb, p.unit]
|
||
: name === 'speech_boot' ? ['sudo', '-n', '/usr/bin/systemctl', p.verb, SPEECH_UNIT]
|
||
: name === 'fit_opencode' ? ['python3', 'oc-fit-limits.py', '--restart-agent']
|
||
: name === 'boot_off' ? ['sudo', '-n', '/usr/bin/systemctl', 'disable', p.unit]
|
||
: name === 'switch' ? ['bash', 'switch-model.sh', p.target] : name === 'fetch' ? ['bash', 'switch-model.sh', p.target, '--fetch']
|
||
: name === 'clients' ? ['bash', 'switch-model.sh', p.target, '--clients']
|
||
: name === 'prepare' ? ['bash', 'prepare-lane.sh', laneOfTarget(p.target)].concat(['flash', '27b'].includes(laneOfTarget(p.target)) ? [p.target] : [])
|
||
: name === 'gpu_clock' && GC.has !== false && ((F.config || {}).gpu_clock_argv || {})[p.cap] ? F.config.gpu_clock_argv[p.cap]
|
||
: ['cockpit', name];
|
||
|
||
let SHEET = null; // {mode: 'one'|'journey', ...}
|
||
// A dialog hands the focus back to what opened it: closing one left it on the body, so a
|
||
// keyboard had to start again from the top of the page.
|
||
const OPENER = {sheet: null, menu: null, viewer: null};
|
||
const giveBack = k => { const e = OPENER[k]; OPENER[k] = null; if (e && e.isConnected && typeof e.focus === 'function') e.focus(); };
|
||
function openSheet(focusId = 'sh-go'){
|
||
const a = document.activeElement; OPENER.sheet = a && !a.closest('#scrim') ? a : OPENER.sheet;
|
||
$('scrim').hidden = false; setTimeout(() => $(focusId).focus(), 0);
|
||
}
|
||
// A result's screen takes the shape of what it shows: its own proportions, as wide as the
|
||
// column allows and no taller than most of the window (78vh, through a max-width derived
|
||
// from the ratio), centred. Both result screens went back to their 16:9 box when the result
|
||
// arrived, so a portrait sat small in the middle of it and a gallery of images was cut at
|
||
// its bottom (Hasan, 2026-10-10). A size of 0 lets the box follow what it holds (a gallery);
|
||
// no size at all gives the screen its default back.
|
||
function fitScreen(sc, w, h){
|
||
if (w > 0 && h > 0){ sc.style.aspectRatio = `${w} / ${h}`; sc.style.maxWidth = `calc(78vh * ${(w / h).toFixed(4)})`; sc.classList.add('fit'); return; }
|
||
sc.style.aspectRatio = w === 0 ? 'auto' : ''; sc.style.maxWidth = ''; sc.classList.remove('fit');
|
||
}
|
||
// The image viewer: a result over the whole window, fitted to it or drawn at its own pixels
|
||
// (one image pixel to one screen pixel, whatever the display's density), closed by Escape,
|
||
// its Close button or a click beside the picture; the focus goes back where it was.
|
||
function openViewer(src, w, h, name){
|
||
const a = document.activeElement; OPENER.viewer = a && !a.closest('#viewer') ? a : OPENER.viewer;
|
||
const v = $('viewer-img'); v.src = src; v.alt = `The image at full size, ${w} by ${h}`; v.style.width = '';
|
||
$('viewer-pane').classList.remove('actual'); $('viewer-actual').setAttribute('aria-pressed', 'false');
|
||
setText('viewer-size', `${w} × ${h}`); $('viewer-dl').href = src; $('viewer-dl').setAttribute('download', name);
|
||
$('viewer').hidden = false; setTimeout(() => { if (!$('viewer').hidden) $('viewer-close').focus(); }, 0);
|
||
}
|
||
function viewerActual(){
|
||
const pane = $('viewer-pane'), v = $('viewer-img'), on = !pane.classList.contains('actual');
|
||
pane.classList.toggle('actual', on); $('viewer-actual').setAttribute('aria-pressed', String(on));
|
||
v.style.width = on && v.naturalWidth ? `${Math.round(v.naturalWidth / (window.devicePixelRatio || 1))}px` : '';
|
||
}
|
||
function closeViewer(){ $('viewer').hidden = true; giveBack('viewer'); }
|
||
// A load whose steps are running is put away, not closed: its steps go on, the dock follows the step that
|
||
// runs, and the job button brings the window back. The window held the whole page through a 20-minute
|
||
// download, and reloading the page to get it back stopped the chain (Hasan, 2026-10-12).
|
||
// Nothing else starts while a load runs, its window shown or put away: its next step could stop the lane
|
||
// that work would run on (one engine at a time), and two chains would race on the same lanes. A window is
|
||
// put away only while its steps run: a step that fails always brings it back.
|
||
const loadRunning = () => !!(SHEET && SHEET.running && SHEET.mode === 'journey');
|
||
const loadAway = () => loadRunning() && !!SHEET.hidden;
|
||
const LOAD_RUNNING = 'A load is still running: the job button brings its window back.';
|
||
// A window a failure brought back keeps its first second: the Escape or the click the person aimed at what
|
||
// it covered (the viewer, the page) must not dismiss why the load failed. Its Cancel closes it at once.
|
||
const BACK_GUARD_MS = 1000;
|
||
const justBack = () => !!(SHEET && SHEET.backAt && Date.now() - SHEET.backAt < BACK_GUARD_MS);
|
||
// The reason a lane's own work (an image, a video, a decision) waits, shown under its button.
|
||
const laneWorkWaits = () => loadRunning() ? `A load is running (${TARGET_NAME[SHEET.target]}): its steps stop and start lanes. Wait for it to finish.` : '';
|
||
function closeSheet(){
|
||
if (loadRunning()) SHEET.hidden = true; // put away: its steps go on
|
||
else if (SHEET && SHEET.running) return; // one action closes its window once the job is accepted
|
||
else { const s = SHEET; SHEET = null; if (s && s.onClose) s.onClose(); }
|
||
$('scrim').hidden = true; giveBack('sheet'); journeyChanged();
|
||
}
|
||
// Brought back by the job button while the steps run: the focus goes to Hide (Go is disabled then).
|
||
function reopenJourney(){
|
||
if (!loadAway()) return false;
|
||
SHEET.hidden = false; openSheet('sh-cancel'); journeyChanged(); return true;
|
||
}
|
||
// The job button: the job that runs, or a load put away while it waits between two steps (a stopped lane
|
||
// reading down can take 90 s), so the window always has a way back. It shows on a narrow screen too
|
||
// (.away), where the head has no room for the plain job button.
|
||
function renderPip(){
|
||
const pip = $('jobpip'); if (!pip) return;
|
||
const cur = (F.job || {}).current, away = loadAway();
|
||
pip.hidden = !(cur || away); pip.classList.toggle('away', away);
|
||
const what = cur ? describeJob(cur) : away ? `Load ${TARGET_NAME[SHEET.target]}: between steps` : '';
|
||
setText('jobpip-what', what || '…'); pip.title = what; // cut short on a phone: the whole of it on hover
|
||
}
|
||
function journeyChanged(){ renderPip(); applyBusy(); }
|
||
// fn runs when a load starts or ends, not at every tick of a job: the views whose own work waits for a
|
||
// load (image, video, decide) say so under their button then.
|
||
function onLoadChange(fn){ let seen = false; on('busy', () => { const k = loadRunning(); if (k !== seen){ seen = k; fn(); } }); }
|
||
// A page closed or reloaded stops the chain after the step that runs; with the window put away nothing on
|
||
// screen says so, so the browser asks first. Not in a dry run, whose loads are a walk-through, and not
|
||
// when the page itself goes to the login (a session that ended cannot run the chain anyway).
|
||
let leavingForLogin = false;
|
||
const leaveWarning = () => loadAway() && !F.config.dry_run && !leavingForLogin;
|
||
function askAction(name, params, warns, opts = {}){
|
||
if (offline) return toast('The cockpit is unreachable right now: nothing can be started.', 'err');
|
||
if (loadRunning()) return toast(LOAD_RUNNING, 'warn');
|
||
if (NEEDS_ENGINE.has(name) && !textReady()) return toast(noEngineWhy(), 'warn');
|
||
if (cannotWhy(name)) return toast(cannotWhy(name), 'warn');
|
||
if (F.job && F.job.current) return toast(busyWhy(), 'warn');
|
||
if (!$('scrim').hidden) return;
|
||
const p = params || {};
|
||
setText('sh-title', (TITLE[name] ? TITLE[name](p) : name));
|
||
setText('sh-lede', (EXPLAIN[name] ? EXPLAIN[name](p) : '') + (F.config.dry_run ? '\n\nDry run: nothing will really be executed.' : ''));
|
||
const w = $('sh-warns'); clear(w); (warns || []).forEach(x => w.append(el('p', null, x))); w.hidden = !(warns && warns.length);
|
||
$('sh-journey').hidden = true; show('sh-cmd-lbl', true); show('sh-cmd', true);
|
||
// a job of the cockpit's own runs no command: the sheet showed "cockpit diag_bundle", which is none (found 2026-11-30)
|
||
const argv = argvFor(name, p), own = argv[0] === 'cockpit';
|
||
setText('sh-cmd-lbl', own ? 'A job of this cockpit, which runs no command of its own' : 'The exact command');
|
||
show('sh-cmd', !own); setText('sh-cmd', own ? '' : argv.join(' '));
|
||
setText('sh-status', ''); $('sh-status').className = 'status';
|
||
const go = $('sh-go'); go.disabled = false; setText(go, VERB[name] ? VERB[name](p) : 'Run it');
|
||
// the boot of a lane, enabled or not, stops nothing: no danger in it
|
||
go.className = 'btn ' + (opts.danger || (name === 'unit' && !['start', 'enable', 'disable'].includes(p.verb)) || name === 'abort_all' ? 'danger solid' : 'primary');
|
||
SHEET = {mode: 'one', name, params: p, onClose: opts.onClose};
|
||
openSheet();
|
||
}
|
||
// Run one action; resolves {ok, status, out}. The sheet shows refusals where they happened.
|
||
async function runAction(name, params){
|
||
const {status, out} = await postJSON('/api/action', {name, params});
|
||
return {ok: status === 202, status, out};
|
||
}
|
||
async function sheetGo(){
|
||
if (!SHEET || SHEET.running) return;
|
||
if (SHEET.mode === 'journey') return runJourney();
|
||
SHEET.running = true; const go = $('sh-go'); go.disabled = true; $('sh-cancel').disabled = true; setText('sh-status', 'sending…');
|
||
const {name, params} = SHEET;
|
||
try{
|
||
const r = await runAction(name, params);
|
||
if (r.ok){
|
||
if (name === 'unit' && isImageLane(params.unit) && params.verb !== 'start') IMG_INTERRUPTED_AT.t = Date.now();
|
||
if (name === 'unit' && params.unit === VIDEO_UNIT && params.verb !== 'start') VID_INTERRUPTED_AT.t = Date.now();
|
||
SHEET.running = false; closeSheet(!0);
|
||
toast(`${cap1(actionPhrase(name, params))}: running${r.out.dry_run ? ' (dry run)' : ''}. The dock follows it.`, 'ok');
|
||
dockPinned = false; return;
|
||
}
|
||
if (r.status === 409 && r.out.reasons){ $('sh-status').className = 'status err'; setText('sh-status', 'Blocked: ' + r.out.reasons.join('; ')); }
|
||
else if (r.status === 409){ SHEET.running = false; closeSheet(); toast(r.out.message || 'Another action is already running.', 'warn'); return; }
|
||
else { $('sh-status').className = 'status err'; setText('sh-status', `Refused (${r.status}): ` + (r.out.error || JSON.stringify(r.out))); }
|
||
}catch(e){ $('sh-status').className = 'status err'; setText('sh-status', 'The request failed: ' + e.message); }
|
||
finally{ if (SHEET){ SHEET.running = false; } go.disabled = false; $('sh-cancel').disabled = false; }
|
||
}
|
||
const IMG_INTERRUPTED_AT = {t: 0}, VID_INTERRUPTED_AT = {t: 0};
|
||
|
||
// ── the lane journey: loading a lane is one path, each step its own job ───────
|
||
// The server knows three moves (switch, stop, start) and refuses them out of order; the
|
||
// page chains them, one job after the other, and says each command before it runs.
|
||
// what a side lane's first Load builds before its switch fetches the checkpoint
|
||
const LANE_RUNTIME = {flash: 'its SGLang image (about 16 GB to download), its checkpoint (about 136 GB) and its reduced draft vocabulary',
|
||
'27b': 'its SGLang image (about 17 GB to download), its DFlash2 draft (about 2 GB) and its checkpoint (22 to 31 GB)',
|
||
image: 'a venv and SGLang Diffusion, about 12 GB, about 10 minutes',
|
||
'image-h3': 'a venv and SGLang Diffusion from its main branch, with FlashInfer’s kernels, about 15 GB, about 10 minutes',
|
||
video: 'a venv and SGLang Diffusion, about 12 GB, about 10 minutes, and the Turbo adapter',
|
||
kolibri: 'its vLLM image, about 10 GB to download (23 GB on disk), pulled and built here',
|
||
nemotron: 'its vLLM image, about 11 GB to download (25 GB on disk), pulled and built here',
|
||
'nemotron-super': 'the Nemotron 3.5 Bolt lane’s vLLM image, about 11 GB to download (25 GB on disk), pulled and built here once for both lanes',
|
||
'flash-local': 'its vLLM image with b12x, about 10 GB to download (18 GB on disk), pulled as its model card names it',
|
||
'ornith-122b': 'the Qwen3.8 Flash-Next FP4-Local lane’s vLLM image with b12x, about 10 GB to download (18 GB on disk), pulled once for the two',
|
||
'flash-unsloth': 'llama.cpp’s own server image for arm64 with CUDA, about 2.7 GB to download (4.5 GB on disk), pulled as its project publishes it',
|
||
transcribe: 'the Qwen3.8 Flash-Next Unsloth GGUF lane’s llama.cpp server image, about 2.7 GB to download (4.5 GB on disk), pulled once for the two',
|
||
lfm25: 'the Qwen3.8 27B lane’s SGLang image (about 17 GB to download), pulled once for the two',
|
||
lfm3: 'vLLM’s own nightly image, about 11.5 GB to download (28 GB on disk), pulled as published',
|
||
inkling: 'SGLang’s own image for it, about 16.4 GB to download (38.6 GB on disk), pulled as its cookbook names it',
|
||
'qwen4-35b': 'SGLang’s own image for Qwen4, about 16.3 GB to download (37.8 GB on disk), pulled as its cookbook names it',
|
||
embeddings: 'the Qwen3.8 27B lane’s SGLang image (about 17 GB to download, already here on a box that has that lane) and Perplexity’s model (about 2.4 GB), into the Hugging Face cache',
|
||
clipstral: 'the Qwen3.8 27B lane’s SGLang image (about 17 GB to download, already here on a box that has that lane) and Mistral’s model (about 2.5 GB), into the Hugging Face cache',
|
||
ocr: 'SGLang’s image (16.8 GB to download, 38.5 GB on the disk, nothing on a box that has the 27B lane’s image, the same digest), its model (about 1.7 GB) into the Hugging Face cache, and the PDF reader pypdfium2 (about 4 MB)'};
|
||
const SIDE_LANE = {[IMAGE_UNIT]: 'image', [VIDEO_UNIT]: 'video', [KOLIBRI_UNIT]: 'kolibri', [NEMOTRON_UNIT]: 'nemotron',
|
||
[NEMOTRON_SUPER_UNIT]: 'nemotron-super', [FLASH_LOCAL_UNIT]: 'flash-local', [ORNITH_UNIT]: 'ornith-122b',
|
||
[FLASH_UNSLOTH_UNIT]: 'flash-unsloth', [IMAGE_H3_UNIT]: 'image-h3', [TRANSCRIBE_UNIT]: 'transcribe',
|
||
[LFM25_UNIT]: 'lfm25', [LFM3_UNIT]: 'lfm3', [INKLING_UNIT]: 'inkling', [QWEN4_35B_UNIT]: 'qwen4-35b', [EMBED_UNIT]: 'embeddings', [CLIPSTRAL_UNIT]: 'clipstral', [OCR_UNIT]: 'ocr',
|
||
[UFLASH]: 'flash', [U27]: '27b'};
|
||
// The lanes whose clients follow the window their unit starts with (FLASH_LOCAL_CONTEXT=1m, FLASH_UNSLOTH_CONTEXT=1m):
|
||
// switch-model.sh sets opencode, pi and claude-local for that window, and nothing else does. The Load of such a lane as
|
||
// the boot lane started or restarted its unit alone, so a window chosen with --units-only reached the engine and not
|
||
// the clients: back from 1M they kept a context of 830,000 tokens where the proxy refuses a prompt past 250,000, and
|
||
// on the way to 1M they kept 205,000 (code review of v1.48.0, 2026-11-12; the FP4-Local lane's since v1.45.2). Its Load
|
||
// now sets them first, with the step that sets them at every other Load, and a Load that starts nothing adds nothing.
|
||
const WINDOW_CLIENTS = new Set([FLASH_LOCAL_UNIT, FLASH_UNSLOTH_UNIT]);
|
||
const clientsStep = (unit, target) => ({name: 'switch', params: {target}, title: `Set the clients for ${LANE_NAME[unit]}’s window`,
|
||
desc: 'Verifies its files and sets opencode, pi and claude-local for the window its unit starts with. The lane does not restart. ' + AGENT_RESTART});
|
||
// The same clients for a lane that serves without being the boot lane, whose switch would point the boot at it: the
|
||
// clients alone (switch-model.sh --clients). The Load of an update to it set none, and a window chosen with
|
||
// --units-only reached the engine at its restart and not the clients (review of v1.48.0, 2026-11-13).
|
||
const clientsOnlyStep = (unit, target) => ({name: 'clients', params: {target}, title: `Set the clients for ${LANE_NAME[unit]}’s window`,
|
||
desc: 'Sets the limits of opencode, pi and claude-local, and the lane’s name in opencode, for the window its unit starts with; the boot and '
|
||
+ 'opencode’s default model stay where they are, and the lane does not restart. ' + AGENT_RESTART});
|
||
// The Load of a lane beside every lane (the embeddings lane, the Clipstral lane): no switch target and no GPU to take in
|
||
// turn. Its preparation pulls its image and fetches its model (its installer's --prepare, no sudo), an update that
|
||
// waited goes in place, then the unit is enabled at boot and started, or restarted when it runs and
|
||
// an update waited for it or left it owed: the lane that serves serves throughout, which is the
|
||
// point of a lane on the CPU beside every lane. A start of an active unit applies nothing, a wait
|
||
// marked stale is neither prepared nor posed, as for every lane, and a lane running up to date and
|
||
// enabled has nothing to load (code review of v1.60.0).
|
||
// where a lane beside answers, and what a restart of it cuts
|
||
const BESIDE_ROUTE = {[EMBED_UNIT]: 'the proxy’s /v1/embeddings', [CLIPSTRAL_UNIT]: 'the proxy’s /v1/embeddings',
|
||
[OCR_UNIT]: 'the OCR view and the proxy’s /v1/ocr'};
|
||
const BESIDE_WORK = {[EMBED_UNIT]: 'an embedding it is computing', [CLIPSTRAL_UNIT]: 'an embedding it is computing',
|
||
[OCR_UNIT]: 'a document it is reading'};
|
||
function besideJourneySteps(unit){
|
||
const target = LANE_TARGETS[unit][0], steps = [], e = engines()[unit];
|
||
const pendAll = (F.pending || {})[unit];
|
||
const stale = !!pendAll && pendAll.length > 0 && String(pendAll[0]).startsWith('stale:');
|
||
const pend = stale ? null : pendAll;
|
||
if ((F.lanesReady || {})[target] === false || pend)
|
||
steps.push({name: 'prepare', params: {target},
|
||
title: pend ? `Download what the update of ${LANE_NAME[unit]} needs` : `Download ${LANE_NAME[unit]}`,
|
||
desc: pend ? `What its new unit reads and this box lacks${pend.length ? ': ' + pend.join('; ') : ''}, with no sudo. It serves meanwhile.`
|
||
: `Its first Load: ${LANE_RUNTIME[target]}, with no sudo.`});
|
||
if (pend)
|
||
steps.push({name: 'apply_pending', params: {unit}, title: `Put in place the update ${LANE_NAME[unit]} waited for`,
|
||
desc: `Its new unit replaces the one it served with${pend.length ? ', now that the box has what it lacked: ' + pend.join('; ') : ''}. Nothing restarts yet.`});
|
||
const up = !!e && !UNIT_DOWN.has(e.state);
|
||
// The OvisOCR3 lane, on the GPU, beside the lane that serves when the box holds both, else in its turn (decision 1662): a lane
|
||
// that leaves the box too little, or a box that has too little now, stops first, and the OCR view offers to load it again
|
||
// (decision 1669). In its turn it is not enabled at boot: the box boots its boot lane alone, as before. The lanes beside on
|
||
// the CPU are refused there instead (roomWarns).
|
||
const s = unit === OCR_UNIT && !up ? servingEngine() : null;
|
||
const avail = ((F.machine || {}).mem || {}).MemAvailable, room = BESIDE_ROOM_GIB[unit], little = s ? leavesLittle(s[0]) : 0;
|
||
const turn = !!s && (!!little || (avail != null && avail / GIB < room));
|
||
if ((F.units[unit] || {}).enabled !== 'enabled' && !turn)
|
||
steps.push({name: 'unit', params: {verb: 'enable', unit}, title: `Enable ${LANE_NAME[unit]} at boot`,
|
||
desc: 'No unit stops and no boot lane moves.'});
|
||
if (up && (pend || updateOwed(unit)))
|
||
steps.push({name: 'unit', params: {verb: 'restart', unit}, title: `Restart ${LANE_NAME[unit]} on what the update installed`,
|
||
desc: `It answers again in about ${READY_DEFAULT[unit]} s; ${BESIDE_WORK[unit]} then is cut, and the lane that serves is not touched.`});
|
||
else if (!up){
|
||
if (turn)
|
||
steps.push({name: 'unit', params: {verb: 'stop', unit: s[0]}, title: `Stop ${LANE_NAME[s[0]]}`, turn: !little,
|
||
desc: (little ? `${LANE_NAME[s[0]]} leaves the box as little as ${little} GiB`
|
||
: `The box has ${(Math.floor(avail / GIB * 10) / 10).toFixed(1)} GiB of memory available`)
|
||
+ `, and ${LANE_NAME[unit]} starts with ${room} GiB at least: ${LANE_NAME[s[0]]} stops first, the requests its clients `
|
||
+ 'are making end, and the OCR view offers to load it again.'});
|
||
steps.push({name: 'unit', params: {verb: 'start', unit}, title: `Start ${LANE_NAME[unit]}`,
|
||
desc: `It answers in about ${READY_DEFAULT[unit]} s, on its own port and through ${BESIDE_ROUTE[unit]}. `
|
||
+ (turn && (F.units[unit] || {}).enabled !== 'enabled' ? 'In its turn it is not enabled at boot: the box boots its boot lane alone, as before.'
|
||
: "Its memory is the box's: a lane loaded while it runs gets a smaller KV cache, or leaves the box less.")});
|
||
}
|
||
return steps;
|
||
}
|
||
|
||
function laneJourneySteps(target){
|
||
const unit = TARGET_UNIT(target);
|
||
// a lane beside every lane: its Load downloads what it lacks, enables it and
|
||
// starts it, and stops nothing (no switch drives it)
|
||
if (BESIDE_UNITS.has(unit)) return besideJourneySteps(unit);
|
||
const steps = [];
|
||
// installed on demand: a lane whose runtime is not built yet builds it first, as the user
|
||
const lane = SIDE_LANE[unit];
|
||
// an update that waits for this Load (decision 1408): its preparation fetches what the new unit lacks, the step after
|
||
// puts the unit in place; the restart below applies it
|
||
const pendAll = (F.pending || {})[unit];
|
||
// a wait the unit in place changed since (a switch) is marked stale by the cockpit: said before the Load, which
|
||
// would download what it lacks and then drop it, so no step is proposed for it (review of v1.52.0, 2026-11-19)
|
||
const stale = !!pendAll && pendAll.length > 0 && String(pendAll[0]).startsWith('stale:');
|
||
const pend = stale ? null : pendAll;
|
||
// the 27B's and the flash lane's waiting unit or launcher goes in place by apply_pending (their switch rewrites only
|
||
// the target); a lane beside them takes its new unit from its switch, which renders it and fetches its checkpoint
|
||
// A wait serving ANOTHER target than the one asked is neither prepared nor posed: the switch renders the unit
|
||
// in place for the asked target and clears the wait (c59e015), and downloads nothing for the wait's target
|
||
// (third review of v1.52.0, 2026-11-19, GLM 5.3: the journey prepared the wait's checkpoint, 45 GB, then the
|
||
// switch overwrote it)
|
||
const pendTarget = (F.pendingTargets || {})[unit] || null;
|
||
const pendAsked = !pend || !pendTarget || pendTarget === target;
|
||
const applies = !!pend && pendAsked && (unit === U27 || unit === UFLASH);
|
||
if (lane && ((F.lanesReady || {})[lane] === false || (pend && pendAsked)))
|
||
steps.push({name: 'prepare', params: {target},
|
||
title: pend && pendAsked ? `Download what the update of ${LANE_NAME[unit]} needs` : `Build the runtime of ${LANE_NAME[unit]}`,
|
||
desc: pend && pendAsked ? `What its new unit reads and this box lacks${pend.length ? ': ' + pend.join('; ') : ''}, with no sudo. It serves meanwhile.`
|
||
: `Its first Load: ${LANE_RUNTIME[lane]}, with no sudo.` + (lane === 'flash' || lane === '27b' ? '' : ' The next step fetches its checkpoint.')});
|
||
if (applies)
|
||
steps.push({name: 'apply_pending', params: {unit}, title: `Put in place the update ${LANE_NAME[unit]} waited for`,
|
||
desc: `Its new unit replaces the one it served with${pend.length ? ', now that the box has what it lacked: ' + pend.join('; ') : ''}. Nothing restarts yet.`});
|
||
// The Load of the lane that serves this very target, with an update owed to it, is the
|
||
// restart that applies the update and nothing else: the steps below would point the boot at
|
||
// it (a lane started as installed is not the boot lane) or switch it back, which no update
|
||
// asked for (found in review, 2026-10-17). The lane's card asks the same of it (lanes.js).
|
||
const sv0 = servingEngine();
|
||
if (sv0 && sv0[0] === unit && laneTarget(unit) === target && (updateOwed(unit) || applies))
|
||
return steps.concat(!WINDOW_CLIENTS.has(unit) ? [] : bootUnit() === unit ? [clientsStep(unit, target)] : [clientsOnlyStep(unit, target)],
|
||
[{name: 'unit', params: {verb: 'restart', unit}, title: `Restart ${LANE_NAME[unit]} on what the update installed`,
|
||
desc: `It answers again in ${readyIn(unit)}.` + (isImageLane(unit) || unit === VIDEO_UNIT ? ' A generation in flight is lost.' : '')}]);
|
||
const serving = servingEngine();
|
||
// none enabled: the switch step makes this one the boot lane, as it does from any other
|
||
const enabled = bootUnit();
|
||
const curTarget = (engines()[unit] || {}).target;
|
||
// a lane that cannot start as installed (its checkpoint or a copy of its table missing) gets the
|
||
// switch, which fetches and copies them, even as the boot lane already: its Load started it
|
||
// alone and it failed again on the same missing file (found in review, 2026-10-20)
|
||
const whole = !lane || (F.lanesStartable || {})[lane] !== false;
|
||
const switchAt = steps.length;
|
||
if (enabled !== unit || (curTarget && curTarget !== target) || (!curTarget && LANE_TARGETS[unit].length > 1 && target !== LANE_TARGETS[unit][0])
|
||
|| !whole || (pend && pendAsked && !applies))
|
||
// for a boot lane that lacks a file, the step fetches or copies it: up to 102 GB, not a check
|
||
steps.push({name: 'switch', params: {target},
|
||
title: pend && pendAsked && !applies ? `Put the update of ${LANE_NAME[unit]} in place`
|
||
: whole || enabled !== unit ? `Point the boot at ${TARGET_NAME[target]}` : `Bring back what ${LANE_NAME[unit]} lacks`,
|
||
desc: pend && pendAsked && !applies ? 'Fetches the checkpoint its new unit reads, puts that unit in place and makes this lane the one enabled at boot. Nothing restarts.'
|
||
: whole ? 'Verifies the checkpoint, downloads what this box lacks of it and makes this lane the one enabled at boot. Nothing restarts.'
|
||
: 'Fetches what its checkpoint lacks' + (unit === FLASH_LOCAL_UNIT ? ' and copies its n-gram table again (up to 102 GB to fetch, 32 GB to copy)' : '')
|
||
+ ', and makes this lane the one enabled at boot. Nothing restarts.'});
|
||
const pointed = steps.length > switchAt;
|
||
if (serving && serving[0] !== unit)
|
||
steps.push({name: 'unit', params: {verb: 'stop', unit: serving[0]}, title: `Stop ${laneLabel(serving[0])}`,
|
||
desc: isImageLane(serving[0]) || serving[0] === VIDEO_UNIT ? 'A generation in flight is lost.' : serving[0] === TRANSCRIBE_UNIT ? 'A transcription in flight is lost.' : `Clients on ${proxyPort()} see the engine unavailable until the next one answers.`});
|
||
// The engine serves what it loaded when it started; a switch since then (a journey that
|
||
// stopped after its first step, switch-model.sh from a terminal) changed only what the
|
||
// next start loads, and the restart is still owed. Read against the unit's file alone, the
|
||
// journey had no step left and said "already serving" of a checkpoint that was not
|
||
// (found 2026-10-05: flash served while its unit pointed at flash-uncensored).
|
||
const served = servedTarget(unit), owed = !!(served && served !== target);
|
||
// The image engine says what it serves (cockpit.py, once per life of its unit): a switch
|
||
// that only points the unit at the checkpoint it already serves owes no restart, which
|
||
// would end a generation for nothing.
|
||
const switched = isImageLane(unit) && served ? owed : steps.length || owed;
|
||
// An update that changed what this engine starts with, while it served, owes a restart
|
||
// too: what it brought applies at the next start (cockpit.py, stale_engines).
|
||
const updated = !!updateOwed(unit);
|
||
if (serving && serving[0] === unit && (switched || updated))
|
||
steps.push({name: 'unit', params: {verb: 'restart', unit},
|
||
title: switched ? `Restart ${LANE_NAME[unit]} on the new checkpoint` : `Restart ${LANE_NAME[unit]} on what the update installed`,
|
||
desc: `It answers again in ${readyIn(unit)}.` + (isImageLane(unit) || unit === VIDEO_UNIT ? ' A generation in flight is lost.' : '')});
|
||
else if (!serving || serving[0] !== unit)
|
||
steps.push({name: 'unit', params: {verb: 'start', unit}, title: `Start ${LANE_NAME[unit]}`, desc: `It loads and answers in ${readyIn(unit)}.`});
|
||
// a lane whose share of the memory is fixed and which leaves the box too little for the Clipstral lane beside it: that one stops
|
||
// first, and does not start again while this one serves or boots (its unit's head)
|
||
const at = steps.findIndex(s => s.name === 'unit' && s.params.unit === unit && s.params.verb !== 'stop');
|
||
// a lane that takes the box alone (decision 1725) stops every lane beside first, the embeddings lane too
|
||
for (const b of [EMBED_UNIT, CLIPSTRAL_UNIT, OCR_UNIT])
|
||
if (at >= 0 && unit !== UFLASH && besideUp(b) && (ALONE.has(unit) || (b !== EMBED_UNIT && LEAVES_LITTLE_GIB(unit, target))))
|
||
steps.splice(at, 0, {name: 'unit', params: {verb: 'stop', unit: b}, title: `Stop ${LANE_NAME[b]}`,
|
||
desc: ALONE.has(unit) ? `${LANE_NAME[unit]} takes the box alone, its KV cache holding its whole window: this lane stops first. Start it again once another lane serves.`
|
||
: `${LANE_NAME[unit]} leaves the box as little as ${LEAVES_LITTLE_GIB(unit, target)} GiB, and this lane holds ${BESIDE_HOLDS_GIB[b]}: start it again once another lane serves.`});
|
||
// the lane the OvisOCR3 lane's Load stopped for want of room: the two did not fit, and the OCR lane stops first (decision 1669)
|
||
if (at >= 0 && ocrTurn() === unit && !steps.some(s => s.name === 'unit' && s.params.unit === OCR_UNIT && s.params.verb === 'stop'))
|
||
steps.splice(at, 0, {name: 'unit', params: {verb: 'stop', unit: OCR_UNIT}, title: `Stop ${LANE_NAME[OCR_UNIT]}`,
|
||
desc: `It started in its turn, once ${LANE_NAME[unit]} had stopped: the box had too little memory for both. ${BESIDE_WORK[OCR_UNIT][0].toUpperCase() + BESIDE_WORK[OCR_UNIT].slice(1)} `
|
||
+ 'is cut. Load it again once this lane serves: it waits its turn again if the box still has too little.'});
|
||
// a boot lane whose clients follow its window, started or restarted: they are set first, where its switch would be
|
||
if (WINDOW_CLIENTS.has(unit) && !pointed && steps.length && steps[steps.length - 1].params.unit === unit)
|
||
steps.splice(switchAt, 0, clientsStep(unit, target));
|
||
return steps;
|
||
}
|
||
// What an update owes the engine of this unit, in words, or null (cockpit.py, stale_engines).
|
||
// Only for an engine that serves: one that boots starts on what is installed, and the tier's
|
||
// answer from before its restart offered that restart again, which would throw the boot away.
|
||
// And not while a switch waits for its restart: the switch rewrote the same files, the "next
|
||
// start loads" banner says so, and its Load applies both; the restart offered here undid the
|
||
// switch (both found in review, 2026-10-17).
|
||
function updateOwed(unit){
|
||
const why = unit && ((F.update || {}).stale_engines || {})[unit];
|
||
if (!why) return null;
|
||
const e = engines()[unit] || {};
|
||
if (e.state !== 'ready' && e.state !== 'degraded') return null;
|
||
const served = servedTarget(unit);
|
||
if (served && e.target && served !== e.target) return null;
|
||
return why;
|
||
}
|
||
// The memory a Load takes from a box whose CPU and GPU share it, said before the first click. A lane beside every lane starts
|
||
// with this much available at least, which its unit's head asks (EMBED_ROOM_GIB and CLIPSTRAL_ROOM_GIB in its installer), and
|
||
// holds that much (docs/embed-lane.md). A lane loaded while one runs gets what it leaves, and three leave the box too little by
|
||
// themselves: the least MemAvailable their own pages give (docs/flash-lane.md, docs/nemotron-super-lane.md, docs/kolibri-lane.md
|
||
// for the FP8 one). The Clipstral lane does not start beside one of them, nor while the box boots one whose share of the memory is
|
||
// fixed (its unit's head).
|
||
const BESIDE_ROOM_GIB = {[EMBED_UNIT]: 9, [CLIPSTRAL_UNIT]: 12, [OCR_UNIT]: 16},
|
||
BESIDE_HOLDS_GIB = {[EMBED_UNIT]: 1, [CLIPSTRAL_UNIT]: 5, [OCR_UNIT]: 13};
|
||
const LEAVES_LITTLE_GIB = (unit, target) => ({[UFLASH]: 6.9, [NEMOTRON_SUPER_UNIT]: 9.1, [QWEN4_35B_UNIT]: 13.5})[unit] || (unit === KOLIBRI_UNIT && target === 'kolibri' ? 10.9 : 0);
|
||
const leavesLittle = u => LEAVES_LITTLE_GIB(u, laneTarget(u));
|
||
// The lanes that take the box alone (decision 1725, Hasan: the Qwen4 35B-A3B lane with all the context it can hold): their Load
|
||
// stops every lane beside first, and no lane beside starts while one serves or is the boot lane (their units' heads refuse it).
|
||
const ALONE = new Set([QWEN4_35B_UNIT]);
|
||
const besideUp = u => { const e = engines()[u]; return !!e && !UNIT_DOWN.has(e.state); };
|
||
// The lane the OvisOCR3 lane's Load stopped for want of room (decision 1662), as this browser remembers it: the two did not fit,
|
||
// and that lane's Load stops the OCR lane first (decision 1669). A lane stopped because it leaves the box too little needs no
|
||
// memory: its own Load stops the OCR lane for that, or sizes itself by what is left (the flash lane). Another browser does not
|
||
// know it, and its Load of that lane warns that the OCR lane keeps its memory instead (roomWarns). Forgotten once that lane
|
||
// serves again, and set anew at each start of the OCR lane.
|
||
const OCR_TURN_KEY = 'cockpit.ocr.turn';
|
||
function ocrTurnSet(u){
|
||
try { if (u) localStorage.setItem(OCR_TURN_KEY, u); else localStorage.removeItem(OCR_TURN_KEY); } catch { /* storage may be unavailable */ }
|
||
}
|
||
function ocrTurn(){
|
||
let u = null;
|
||
try { u = localStorage.getItem(OCR_TURN_KEY); } catch { return null; }
|
||
if (!u || !LANE_UNITS.includes(u) || BESIDE_UNITS.has(u)) return null;
|
||
const s = servingEngine();
|
||
if (s && s[0] === u){ ocrTurnSet(null); return null; }
|
||
return besideUp(OCR_UNIT) ? u : null;
|
||
}
|
||
function tightLane(){
|
||
const s = servingEngine(), b = bootUnit();
|
||
return s && leavesLittle(s[0]) ? s[0] : b && b !== UFLASH && leavesLittle(b) ? b : null;
|
||
}
|
||
function roomWarns(unit, target, steps){
|
||
const does = verbs => steps.some(s => s.name === 'unit' && s.params.unit === unit && verbs.includes(s.params.verb));
|
||
if (BESIDE_UNITS.has(unit)){
|
||
// the OvisOCR3 lane's Load that stops the lane that serves first: its step says why, and the start then has its room
|
||
if (unit === OCR_UNIT && steps.some(s => s.name === 'unit' && s.params.verb === 'stop' && s.params.unit !== unit)) return [];
|
||
const starts = does(['start']), again = does(['restart']), out = [];
|
||
const sv = servingEngine(), alone = [sv && sv[0], bootUnit()].find(u => u && ALONE.has(u));
|
||
if (starts && alone && unit !== OCR_UNIT)
|
||
return [`${LANE_NAME[alone]} takes the box alone, its KV cache holding its whole window: this lane does not start beside it, nor while it is the boot lane. Load another lane first.`];
|
||
const tight = starts ? tightLane() : null, little = tight ? leavesLittle(tight) : 0, holds = BESIDE_HOLDS_GIB[unit];
|
||
if (tight && unit === CLIPSTRAL_UNIT) out.push(`${LANE_NAME[tight]} leaves the box as little as ${little} GiB, and this lane holds ${holds}: its start would be refused. Load another lane first.`);
|
||
// the boot lane, stopped, that leaves the box too little (the one that serves would have stopped first, above): the two
|
||
// never run together, and the OvisOCR3 lane's unit's head and that lane's Load see to it
|
||
else if (tight && unit === OCR_UNIT) out.push(`${LANE_NAME[tight]}, the boot lane, leaves the box as little as ${little} GiB, and this lane holds ${holds}: the two never run together. This lane does not start beside it at boot, and its Load stops this lane first.`);
|
||
else if (tight && little - holds < 5) out.push(`${LANE_NAME[tight]} leaves the box as little as ${little} GiB, and this lane holds ${holds} of them: a long prompt there can come near the 3 GiB under which generations are stopped.`);
|
||
const avail = ((F.machine || {}).mem || {}).MemAvailable, room = BESIDE_ROOM_GIB[unit], has = avail == null ? null : avail / GIB + (again ? holds : 0);
|
||
if ((starts || again) && has != null && has < room)
|
||
out.push(`The box ${again ? 'would have' : 'has'} ${(Math.floor(has * 10) / 10).toFixed(1)} GiB of memory available${again ? ' once it stops' : ''} and this lane starts with ${room} GiB at least: its start would be refused. `
|
||
+ 'Stop the lane that serves first, or load one that leaves the box more.');
|
||
return out;
|
||
}
|
||
const up = [...BESIDE_UNITS].filter(u => besideUp(u) && !steps.some(s => s.name === 'unit' && s.params.unit === u && s.params.verb === 'stop'));
|
||
if (!up.length || !does(['start', 'restart'])) return [];
|
||
const many = up.length > 1, little = LEAVES_LITTLE_GIB(unit, target);
|
||
return [`${up.map(u => LANE_NAME[u]).join(' and ')} run${many ? '' : 's'} beside every lane and keep${many ? '' : 's'} ${many ? 'their' : 'its'} memory: a lane loaded now gets a smaller KV cache, or leaves the box less. `
|
||
+ (little ? `This one leaves the box as little as ${little} GiB by itself: stop ${many ? 'them' : 'it'} first.` : `Stop ${many ? 'them' : 'it'} first to give it everything.`)];
|
||
}
|
||
function askJourney(target, opts = {}){
|
||
if (offline) return toast('The cockpit is unreachable right now: nothing can be started.', 'err');
|
||
if (loadRunning()) return toast(LOAD_RUNNING, 'warn');
|
||
if (F.job && F.job.current) return toast(busyWhy(), 'warn');
|
||
if (!$('scrim').hidden) return;
|
||
const unit = TARGET_UNIT(target);
|
||
if (!installed(unit)) return toast(`${LANE_NAME[unit]} is not installed on this box. ${installHint(unit)}`, 'warn', 7000);
|
||
const steps = laneJourneySteps(target);
|
||
if (!steps.length) return toast(`${TARGET_NAME[target]} is already serving.`, 'ok');
|
||
setText('sh-title', `Load ${TARGET_NAME[target]}`);
|
||
setText('sh-lede', (TARGET_NOTE[target] || '') + `\n\nThe page runs these steps one after the other, each as its own job, and stops at the first that fails. Hide puts this window away while they run; closing the page stops the chain after the step that is running.` + (F.config.dry_run ? '\n\nDry run: nothing will really be executed, the state on the box never moves, and a gate can refuse a later step of the walk-through because it still reads the box as it was.' : ''));
|
||
const w = $('sh-warns'); clear(w);
|
||
// the Load of a lane beside every lane stops nothing and takes no turn on the GPU: none of the warnings below,
|
||
// which are a Load's that takes that turn from the lane that serves, is true of it (code review of v1.60.0)
|
||
const serving = BESIDE_UNITS.has(unit) ? null : servingEngine();
|
||
const warns = roomWarns(unit, target, steps);
|
||
if (serving && serving[0] === UFLASH && TRANSITIONAL.has(serving[1].state)) warns.push('Flash is booting: stopping now throws that boot away, and the next start takes a whole boot again.');
|
||
if (serving && serving[0] !== unit && (serving[0] === U27 || serving[0] === UFLASH || serving[0] === LFM25_UNIT || serving[0] === INKLING_UNIT || serving[0] === QWEN4_35B_UNIT || serving[0] === KOLIBRI_UNIT || isVllmTable(serving[0]) || isLlamacpp(serving[0]))) warns.push(`Agent clients on ${proxyPort()} lose their engine until a text lane answers again.`);
|
||
// stopped for another lane, or restarted on its other checkpoint: either ends a generation
|
||
if (serving && (isImageLane(serving[0]) || serving[0] === VIDEO_UNIT) && steps.some(s => s.name === 'unit' && s.params.unit === serving[0]))
|
||
warns.push('A generation in flight on ' + laneLabel(serving[0]) + ' is lost.');
|
||
warns.forEach(x => w.append(el('p', null, x))); w.hidden = !warns.length;
|
||
const j = $('sh-journey'); clear(j); j.hidden = false;
|
||
steps.forEach((s, i) => {
|
||
const li = el('li'); li.dataset.i = i;
|
||
const n = el('span', 'n', String(i + 1));
|
||
const body = el('div'); body.append(el('div', 't', s.title), el('div', 'd', s.desc));
|
||
const c = el('pre', 'cmd', argvFor(s.name, s.params).join(' ')); body.append(c);
|
||
li.append(n, body); j.append(li);
|
||
});
|
||
show('sh-cmd-lbl', false); show('sh-cmd', false);
|
||
setText('sh-status', journeyTime(steps, unit, target)); $('sh-status').className = 'status';
|
||
const go = $('sh-go'); go.disabled = false; go.className = 'btn primary'; setText(go, `Load ${LANE_NAME[unit]}`);
|
||
SHEET = {mode: 'journey', target, steps, idx: 0, onClose: opts.onClose};
|
||
openSheet();
|
||
if (steps.some(s => s.name === 'switch' || s.name === 'prepare')) journeyPlan(SHEET, unit);
|
||
}
|
||
// How long a Load takes: the page can time a boot, not a download, so "in all" is said only of a Load with none. It stood
|
||
// over 133 GB of one (found 2026-11-30). plan: what the server says of the checkpoint (cockpit.py load_plan), once it did.
|
||
function journeyTime(steps, unit, target, plan){
|
||
const boot = fmtMin(bootSeconds(unit) + 15), n = `${steps.length} step${steps.length > 1 ? 's' : ''}`, gb = targetGB(target);
|
||
if (steps.some(s => s.name === 'prepare'))
|
||
return `${n}: its first Load downloads first (the line under each step says how far it is), then it answers in about ${boot}`;
|
||
const fetches = steps.some(s => s.name === 'switch'), state = plan && plan.state;
|
||
if (!fetches || state === 'complete') return `${n}, about ${boot} in all`;
|
||
if (gb && (state === 'absent' || state === 'incomplete'))
|
||
return `${n}: ${state === 'absent' ? `about ${gb} GB` : `the rest of about ${gb} GB`} to download first, then it answers in about ${boot}`;
|
||
return `${n}, its boot about ${boot}: what this box lacks of its checkpoint downloads first`;
|
||
}
|
||
// The sheet, once the server has said what of the checkpoint is here and the room on its disk: the step's words, the time,
|
||
// and a warning before the first click when the download does not fit (the scripts refuse it, a step or two later).
|
||
async function journeyPlan(sheet, unit){
|
||
let plan = null;
|
||
try { const r = await fetch('/api/load-plan?target=' + encodeURIComponent(sheet.target)); if (r.ok) plan = await r.json(); } catch { /* the words of before stay */ }
|
||
if (!plan || SHEET !== sheet || sheet.running || sheet.idx) return;
|
||
const gb = targetGB(sheet.target), i = sheet.steps.findIndex(s => s.name === 'switch'), step = sheet.steps[i];
|
||
const said = plan.state === 'complete' ? 'Verifies the checkpoint, already on this box, and makes this lane the one enabled at boot. Nothing restarts.'
|
||
: gb && plan.state === 'absent' ? `Downloads the checkpoint (about ${gb} GB), verifies it and makes this lane the one enabled at boot. Nothing restarts.`
|
||
: gb && plan.state === 'incomplete' ? `Downloads the rest of the checkpoint (about ${gb} GB in all), verifies it and makes this lane the one enabled at boot. Nothing restarts.` : '';
|
||
if (step && said && step.desc.startsWith('Verifies the checkpoint, downloads what')){
|
||
step.desc = said; setText($('sh-journey').children[i].querySelector('.d'), said);
|
||
}
|
||
const dk = ((F.machine || {}).disks || {}).docker;
|
||
const room = [plan.free != null ? `${fmtGB(plan.free)} on ${plan.mount} (its checkpoint)` : '',
|
||
sheet.steps.some(s => s.name === 'prepare') && dk && dk.free != null ? `${fmtGB(dk.free)} on Docker’s disk` : ''].filter(Boolean);
|
||
const downloads = plan.state !== 'complete' || sheet.steps.some(s => s.name === 'prepare');
|
||
setText('sh-status', journeyTime(sheet.steps, unit, sheet.target, plan) + (downloads && room.length ? `. Free now: ${room.join(', ')}` : ''));
|
||
if (gb && plan.state === 'absent' && plan.free != null && plan.free < gb * 1e9){
|
||
const w = $('sh-warns');
|
||
w.append(el('p', null, `Its checkpoint takes about ${gb} GB, and ${plan.mount} has ${fmtGB(plan.free)} free: this Load would stop at its download. Free some room first (Library says what can go).`));
|
||
w.hidden = false;
|
||
}
|
||
}
|
||
function jStep(i, cls){ const li = $('sh-journey').children[i]; if (li) li.className = cls; }
|
||
// What the step running now is doing, under it: its time so far and its job's last output
|
||
// line. The window said only "Step 1 of 2" through a 22-minute download, and it read as
|
||
// frozen (2026-10-05); the dock had the line, under the sheet.
|
||
function jLive(i, text){
|
||
const li = $('sh-journey').children[i]; if (!li) return;
|
||
let p = li.querySelector('.live');
|
||
if (!p){ if (text == null) return; p = el('div', 'd live'); li.lastChild.append(p); }
|
||
if (text == null) p.remove(); else setText(p, text);
|
||
}
|
||
const jobLast = cur => String((cur.lines || []).slice(-1)[0] || '').replace(/\x1b\[[0-9;]*[A-Za-z]/g, '').trim();
|
||
async function runJourney(){
|
||
const S = SHEET; S.running = true;
|
||
$('sh-go').disabled = true; setText($('sh-cancel'), 'Hide'); journeyChanged();
|
||
// A step that fails stops the chain, said in one place: the window comes back over whatever was open
|
||
// (the menu, the image viewer), with the focus on its status line, never on a button, and deaf to Escape
|
||
// and to a click outside it for a second (justBack): a key or a click the person aimed elsewhere can
|
||
// neither run the step again nor dismiss why it failed.
|
||
let fail = null;
|
||
try {
|
||
for (let i = S.idx; i < S.steps.length; i++){
|
||
S.at = i;
|
||
const st = S.steps[i]; jStep(i, 'run');
|
||
setText('sh-status', `Step ${i + 1} of ${S.steps.length}: ${st.title}…`);
|
||
let r;
|
||
try { r = await runAction(st.name, st.params); } catch(e){ r = {ok: false, status: 0, out: {error: e.message}}; }
|
||
if (!r.ok){
|
||
const why = r.out.reasons ? r.out.reasons.join('; ') : r.out.error || r.out.message || 'HTTP ' + r.status;
|
||
fail = {i, text: `Step ${i + 1} refused: ` + why + (F.config.dry_run && r.out.reasons ? ' (dry run: the steps above changed nothing on the box, so the gate still reads the state as it was)' : '')};
|
||
break;
|
||
}
|
||
const id = r.out.job || r.out.id; S.jobId = id;
|
||
const res = await waitJob(id, cur => { const last = jobLast(cur); jLive(i, fmtDur(cur.elapsed) + ' so far' + (last ? ': ' + last : '')); });
|
||
S.jobId = null;
|
||
if (!res.ok){
|
||
fail = {i, text: `Step ${i + 1} ${res.why}. ` + (res.lost ? 'The Now view and Logs say where the lane is before anything is retried.' : 'Its log is in the dock.')};
|
||
break;
|
||
}
|
||
jLive(i, null);
|
||
jStep(i, 'done');
|
||
if (st.name === 'unit' && st.params.unit === OCR_UNIT && st.params.verb === 'start')
|
||
ocrTurnSet(((S.steps.find(x => x.turn) || {}).params || {}).unit || null);
|
||
if (st.name === 'unit' && st.params.verb !== 'start'){
|
||
if (isImageLane(st.params.unit)) IMG_INTERRUPTED_AT.t = Date.now();
|
||
if (st.params.unit === VIDEO_UNIT) VID_INTERRUPTED_AT.t = Date.now();
|
||
// the next start is refused until the stopped lane reads down: wait for it, after a stop alone. An enable
|
||
// stops nothing and a restart brings its lane back up: neither reads down, and the wait held the next
|
||
// step, or the end of the Load, its whole 90 s (code review of v1.60.0).
|
||
// A dry run never moves the engine state, so the wait would burn its whole
|
||
// budget on every stop step and read as a stuck journey.
|
||
if (st.params.verb === 'stop' && !F.config.dry_run) await waitFor(() => { const e = engines()[st.params.unit]; return !e || UNIT_DOWN.has(e.state); }, 90000);
|
||
}
|
||
}
|
||
} catch (e) { // an error in the page itself: the chain stops where it was, said like a failed step
|
||
fail = {i: S.at || 0, text: `Step ${(S.at || 0) + 1} stopped on an error in the page (${e && e.message ? e.message : e}). The Now view and Logs say where the lane is before anything is retried.`};
|
||
}
|
||
if (fail){
|
||
jStep(fail.i, 'fail'); S.running = false; S.idx = fail.i; S.jobId = null;
|
||
$('sh-status').className = 'status err'; setText('sh-status', fail.text);
|
||
$('sh-go').disabled = false; setText($('sh-cancel'), 'Cancel'); setText($('sh-go'), 'Retry from here');
|
||
if (S.hidden && SHEET === S){
|
||
closeMenu(); if (!$('viewer').hidden) closeViewer();
|
||
S.hidden = false; S.backAt = Date.now(); openSheet('sh-status');
|
||
}
|
||
journeyChanged(); return;
|
||
}
|
||
// nothing is left to cancel: the button only closes the window, which closes itself below
|
||
S.running = false; setText($('sh-cancel'), 'Close');
|
||
setText('sh-status', 'Done. The lane is booting: the Now view and the dock follow it.');
|
||
if (S.hidden){ // put away: the page stays where the person went, a toast says it ended
|
||
if (SHEET === S) closeSheet(); else journeyChanged();
|
||
toast(`Load ${TARGET_NAME[S.target]}: every step done. The lane is booting; the Now view and the dock follow it.`, 'ok', 7000);
|
||
return;
|
||
}
|
||
setTimeout(() => { if (SHEET === S) closeSheet(); showView('now'); }, 900);
|
||
}
|
||
// A job is done when the job collector shows it finished. Resolves {ok, why} ({lost} too, for
|
||
// a job the cockpit no longer knows). It follows the job for as long as the job runs: the
|
||
// server bounds every action itself (a switch has 7,200 s, for a download), and a fixed
|
||
// 20 min here gave up 2 minutes before a healthy 22-minute switch to flash-uncensored (a
|
||
// 135 GB checkpoint) ended, so the restart after it never ran (found 2026-10-05).
|
||
// onTick(job) sees the running job at every tick.
|
||
const JOB_LOST_MS = 60 * 1000;
|
||
function waitJob(id, onTick){
|
||
let gone = null;
|
||
return new Promise(resolve => {
|
||
const tick = () => {
|
||
const j = F.job || {};
|
||
const cur = j.current, found = (j.recent || []).find(x => x.id === id);
|
||
if (found && (!cur || cur.id !== id)){
|
||
return resolve(found.status === 'done' ? {ok: true} : {ok: false, why: (found.result || {}).stopped ? 'was stopped'
|
||
: `failed${found.rc != null ? ' with exit code ' + found.rc : ''}`});
|
||
}
|
||
if (cur && cur.id === id){
|
||
gone = null;
|
||
if (onTick) try { onTick(cur); } catch { /* the live line is a courtesy, never the wait */ }
|
||
} else if (gone === null) gone = Date.now();
|
||
// neither running nor finished: a cockpit restarted under it keeps no job history
|
||
else if (Date.now() - gone > JOB_LOST_MS) return resolve({ok: false, lost: true, why: 'is no longer known to the cockpit (restarted?), so how it ended is unknown'});
|
||
setTimeout(tick, 500);
|
||
};
|
||
tick();
|
||
});
|
||
}
|
||
function waitFor(pred, timeoutMs){
|
||
const t0 = Date.now();
|
||
// a predicate that throws (state not read yet after a reconnect) counts as not yet: a throw inside the
|
||
// timer would leave the promise pending for good, and a load waiting on it running forever
|
||
const holds = () => { try { return !!pred(); } catch { return false; } };
|
||
return new Promise(resolve => { const tick = () => { if (holds() || Date.now() - t0 > timeoutMs) return resolve(); setTimeout(tick, 500); }; tick(); });
|
||
}
|
||
|
||
// ── the dock: the job running now, from every view and every browser ─────────
|
||
let dockPinned = false, dockHidden = null, lastFinished, stopAsked = null;
|
||
const JOBLINES = {id: null, lines: [], final: null, read: null};
|
||
// A job that prints nothing, like systemctl, said "starting…" under "Stop 27B" while it stopped the lane, and its log
|
||
// "(no output yet)" after it had ended (issue #64): it says what it does in its own verb, and its log the command first
|
||
const UNIT_DOING = {start: 'starting', stop: 'stopping', restart: 'restarting'};
|
||
const jobDoing = j => `${(j.action === 'unit' && UNIT_DOING[(j.params || {}).verb]) || 'running'}, nothing printed yet`;
|
||
// "(it printed nothing)" only once its last lines were read: a page opened after the job had ended said it of a job
|
||
// that printed hundreds of lines until the fetch answered, and for good when it failed (review of v1.45.0). And no
|
||
// "$" line in a dry run, where nothing runs: the server's own line says what would have (review of v1.45.0)
|
||
function jobLog(j, lines, ended){
|
||
const head = j && j.argv && !j.dry_run ? ['$ ' + j.argv.join(' ')] : [];
|
||
const none = !ended ? '(nothing printed yet)' : j && JOBLINES.read === j.id ? '(it printed nothing)' : '(reading its log…)';
|
||
return head.concat(lines.length ? lines : [none]).join('\n');
|
||
}
|
||
function describeJob(j){ return cap1(actionPhrase(j.action, j.params)) + (j.origin === 'autoheal' ? ', by the autoheal belt' : '')
|
||
+ (j.origin === 'boot' ? ', again at the cockpit’s start' : '') + (j.dry_run ? ' (dry run)' : ''); }
|
||
function renderJob(d){
|
||
F.job = d;
|
||
const dock = $('dock'), cur = d.current, recent = (d.recent || [])[0];
|
||
const now = Date.now() / 1000;
|
||
let showIt = false, shown = null;
|
||
if (cur){
|
||
shown = cur;
|
||
showIt = dockHidden !== cur.id;
|
||
dock.className = 'dock'; $('dock-lamp').className = 'lamp warn live';
|
||
setText('dock-what', describeJob(cur)); setText('dock-time', fmtDur(cur.elapsed));
|
||
show('dock-bar', true);
|
||
$('dock-stop').disabled = stopAsked === cur.id;
|
||
if (JOBLINES.id !== cur.id){ JOBLINES.id = cur.id; JOBLINES.lines = []; }
|
||
if (cur.lines && cur.lines.length) JOBLINES.lines = cur.lines;
|
||
setText('dock-last', JOBLINES.lines.length ? JOBLINES.lines[JOBLINES.lines.length - 1] : jobDoing(cur));
|
||
} else {
|
||
if (recent && (now - (recent.ended || recent.started) < 60 || dockPinned) && dockHidden !== recent.id){
|
||
showIt = true; shown = recent;
|
||
const ok = recent.status === 'done';
|
||
dock.className = 'dock ' + (ok ? 'done' : 'failed'); $('dock-lamp').className = 'lamp ' + (ok ? 'ok' : 'err');
|
||
setText('dock-what', describeJob(recent)); setText('dock-time', fmtDur(recent.elapsed)); show('dock-bar', false);
|
||
const r = recent.result || {};
|
||
setText('dock-last', r.stopped ? 'stopped: what came is kept, and starting it again goes on from there' : r.reply ? `reply: ${r.reply}` : r.path ? `written: ${r.path}` : r.reason === 'busy' ? 'the engine refused: requests still running'
|
||
: ok ? (recent.argv ? `finished, exit code ${recent.rc}` : 'finished') : `failed${recent.rc != null ? ` (exit code ${recent.rc})` : ''}: open the log`);
|
||
if (JOBLINES.id !== recent.id){ JOBLINES.id = recent.id; JOBLINES.lines = []; }
|
||
// its last lines are fetched once it ended: the running snapshot stops short of the end
|
||
if (JOBLINES.final !== recent.id){ JOBLINES.final = recent.id; fetchJobLines(recent.id); }
|
||
}
|
||
if (recent){
|
||
if (lastFinished === undefined) lastFinished = recent.id; // first sight: adopt, do not act
|
||
else if (lastFinished !== recent.id){ lastFinished = recent.id; (HANDLERS.job_finished || []).forEach(f => { try { f(recent); } catch { /* isolated */ } }); }
|
||
}
|
||
}
|
||
show('dock-stop', !!(cur && cur.stoppable));
|
||
dock.hidden = !showIt;
|
||
renderPip();
|
||
setText('dock-pre', jobLog(shown, JOBLINES.lines, !cur));
|
||
const pre = $('dock-pre'); if (!pre.hidden) pre.scrollTop = pre.scrollHeight;
|
||
const say = cur ? `${describeJob(cur)}: running` : recent ? `${describeJob(recent)}: ${recent.status}` : '';
|
||
say && sayOnce('job', say);
|
||
applyBusy();
|
||
}
|
||
async function fetchJobLines(id){
|
||
try{ const r = await fetch('/api/jobs/' + id); if (r.status === 401) return login(); if (!r.ok) return;
|
||
const j = await r.json(); if (JOBLINES.id === id){ JOBLINES.lines = j.lines || []; JOBLINES.read = id; setText('dock-pre', jobLog(Object.assign({id}, j), JOBLINES.lines, true)); } }
|
||
catch { /* the dock keeps what it has */ }
|
||
}
|
||
// what a screen reader hears when a lane or a job changes state, once per change
|
||
const SAID = {};
|
||
function sayOnce(key, txt){ if (SAID[key] === txt) return; SAID[key] = txt; setText('sayer', txt); }
|
||
|
||
// Every control that runs an action is disabled, with its reason, while it cannot.
|
||
// [data-busy] is the same disabling for a control that does not open the action sheet
|
||
// (the sign-out button signs out at once): data-act means "opens the sheet", nothing else.
|
||
function applyBusy(){
|
||
const why = busyWhy(), eng = noEngineWhy();
|
||
document.querySelectorAll('[data-act], [data-busy]').forEach(b => {
|
||
const need = NEEDS_ENGINE.has(b.dataset.act) ? eng : '';
|
||
const own = b.dataset.blocked || '';
|
||
b.disabled = !!(why || need || own);
|
||
b.title = why || need || own || b.dataset.title || '';
|
||
});
|
||
(HANDLERS.busy || []).forEach(f => { try { f(why); } catch { /* isolated */ } });
|
||
}
|
||
|
||
// ── banners: what you did not go looking for ──────────────────────────────────
|
||
// The settings conformity.py compares that are no variable of their own, as the page names them
|
||
// (v1.36.0): the same names install.sh's list gives them.
|
||
const CF_NAME = {'target.27b': '27B target', 'target.flash': 'flash target', DRAFT2: '27B drafter',
|
||
KOLIBRI_VARIANT: 'Kolibri-1 checkpoint', IMAGE_MODEL: 'image model', VIDEO_VARIANT: 'video variant',
|
||
FLASH_UNSLOTH_TARGET: 'Unsloth GGUF target'};
|
||
const cfName = i => CF_NAME[i.knob] || i.knob;
|
||
function wedgeNext(){
|
||
const c = F.config || {};
|
||
if (c.autoheal) return 'The autoheal belt restarts it' + (c.autoheal_grace_s ? ` after its ${fmtDur(c.autoheal_grace_s)} grace period` : '');
|
||
return 'Nothing restarts it by itself (the autoheal belt is off; COCKPIT_AUTOHEAL=1 arms it): stop it and start it again from Lanes';
|
||
}
|
||
function renderBanners(state, errors){
|
||
const box = $('banners'); if (!box) return;
|
||
const want = [];
|
||
// cmd: a command the banner asks to run, shown apart with its copy icon (Hasan, 2026-10-21:
|
||
// selecting it by hand out of a sentence was the only way)
|
||
// list: lines a banner shows one under the other, between its title and its sentence (the commits of the clone)
|
||
// acts: what can be done about it from here, a button each ([words, what it does])
|
||
const add = (kind, strong, text, cmd, list, acts) => want.push([kind, strong, text, cmd, list, acts]);
|
||
// another lane of the GPU up, whose Load is the way out a banner below names: a lane beside every lane is none
|
||
const otherUp = n => Object.entries(engines()).some(([m, x]) => m !== n && !BESIDE_UNITS.has(m) && (!UNIT_DOWN.has(x.state) || x.restarting));
|
||
if (offline) add('err', 'Connection lost.', `No data from the cockpit for ${fmtDur((Date.now() - lastMsgAt) / 1000)}: what is on screen is frozen and actions wait.`);
|
||
if (F.config && F.config.dry_run) add('info', 'Dry run.', 'Every action is confirmed, logged and audited as usual, but nothing is executed. This instance exists for tests.');
|
||
Object.entries(engines()).forEach(([n, e]) => {
|
||
const name = LANE_NAME[n] || n;
|
||
// a start that barely moves: what did not, what is unlike a start that served, what to do. In minutes: a banner whose
|
||
// text moves every 2 s is read out again each time
|
||
if (startLevel(e) === 'still') add('err', `${name} barely moves.`,
|
||
`${fmtMin(Math.floor(e.watch.still_s / 60) * 60)} of ${STATE_LABEL[e.state]} with no log line, next to no disk and memory, the GPU at rest. `
|
||
+ `${startPace(e.watch)} ${(e.watch.todo || []).join(' ')}`.trim(), null, e.watch.causes,
|
||
[['Read its journal', () => { LOGS_WANT.src = n; showView('logs'); }], [`Stop ${name}`, () => askAction('unit', {verb: 'stop', unit: n}, [])]]);
|
||
if (e.state === 'wedged') add('err', `${name} is wedged.`, `It answers health checks but generates nothing. ${wedgeNext()}. The Logs view has the scheduler forensics.`);
|
||
// the start guard holds a start while the last engine's GPU memory is not back, and refuses
|
||
// it if it stays held: that is no crash, and saying "keeps crashing" sent people after one
|
||
if (e.held) add('warn', `${name} waits for GPU memory.`, `${sentence(e.held)}. It starts by itself once that memory is back: starting on memory the driver kept is how sglang#40948 froze a DGX Spark until a power cycle.`);
|
||
// the GPU itself: no wait, memory or reboot changes it, and systemd does not start it again.
|
||
// Said while no other lane is up, whose Load is the way out it names: a unit that exited 78
|
||
// stays failed until a reboot, and the banner stayed red over the lane that serves.
|
||
if (e.state === 'failed' && e.cannot) { if (!otherUp(n)) add('err', `${name} cannot start on this box.`, `${sentence(e.cannot)}. Load another lane from Lanes.`); }
|
||
// a file the engine reads is missing (its checkpoint, a copy of its table): the unit exited 78
|
||
// and stays failed, and its Load fetches the file again (its switch step, laneJourneySteps)
|
||
// (a lane beside every lane starts whichever lane is up: that its model is missing is said all the same)
|
||
else if (e.state === 'failed' && e.lacks) { if (BESIDE_UNITS.has(n) || !otherUp(n)) add('err', `${name} cannot start: a file it reads is missing.`, `${sentence(e.lacks)}.`); }
|
||
// a start the box had too little memory for is refused, not broken: its card and its bay say it
|
||
else if (e.state === 'failed' && e.room) { /* nothing */ }
|
||
else if (e.state === 'failed' && e.refused) add('err', `${name} is not starting.`, `${sentence(e.refused)}. ` + (e.restarting ? 'systemd checks again every 15 s and starts it once that memory is back; if nothing holds it, a reboot frees it.' : 'Start it again from Lanes once that memory is back; if nothing holds it, a reboot frees it.'));
|
||
else if (e.state === 'failed' && e.restarting && e.crashed_serving) add('warn', `${name} stopped while it was serving and is starting again.`, 'systemd starts it again 15 s after it stops, and the lane comes back by itself. Its journal in Logs says why it stopped.');
|
||
else if (e.state === 'failed' && e.restarting) add('err', `${name} keeps crashing.`, `It dies during startup and systemd relaunches it every 15 s${e.restarts ? ` (${e.restarts} so far)` : ''}. Stop it from Lanes to end the loop; its journal is in Logs.`);
|
||
else if (e.state === 'failed' && e.result === 'timeout') add('warn', `${name} was killed while stopping.`, 'It did not exit within its stop timeout. Nothing broke while it served: start it again when you need it.');
|
||
else if (e.state === 'failed') add('err', `${name} failed.`, 'systemd reports the unit failed. Read its journal in Logs, then start it again from Lanes.');
|
||
// a server alive without its scheduler answers nothing, and systemd sees nothing wrong
|
||
if (e.zombie) add('err', `${name} lost its scheduler.`, 'Its server process lives on and answers nothing, and systemd sees nothing wrong, so it would never come back by itself. '
|
||
+ ((F.config || {}).zombie_restart ? (e.zombie_in > 0 ? `The cockpit restarts it in ${fmtDur(e.zombie_in)}.` : 'The cockpit restarts it now.') : 'Stop it and start it again from Lanes (COCKPIT_ZOMBIE_RESTART=0 keeps the cockpit from doing it).'));
|
||
else if (e.state === 'degraded') add('warn', `${name} stopped answering.`, 'It was serving; health probes retry every 2 s. If it stays here, Logs says why.');
|
||
});
|
||
// A switch that is not restarted yet: the unit loads one checkpoint at its next start while
|
||
// the engine serves another, and nothing else on the page said so.
|
||
const sv = servingEngine();
|
||
// degraded too: it still serves what it loaded, and the update banner below keeps quiet then
|
||
if (sv && (sv[0] === U27 || sv[0] === UFLASH || sv[0] === KOLIBRI_UNIT || isB12x(sv[0]) || isLlamacpp(sv[0]) || isImageLane(sv[0])) && (sv[1].state === 'ready' || sv[1].state === 'degraded')){
|
||
const served = servedTarget(sv[0]), next = sv[1].target;
|
||
if (served && next && served !== next)
|
||
add('info', `${TARGET_NAME[served]} is serving, and the lane's next start loads ${TARGET_NAME[next]}.`,
|
||
`The switch to ${TARGET_NAME[next]} is written but its restart has not run, so clients still get ${TARGET_NAME[served]}. Load ${TARGET_NAME[next]} in Lanes restarts it (${readyIn(sv[0])}).`);
|
||
}
|
||
// An update rewrote what the serving engine starts with (its unit, a file it reads at its
|
||
// start, its image) and left it serving, as an update does: only the installer's output
|
||
// said a restart was owed (found 2026-10-16: Bolt's prefix cache settings, v1.35.0).
|
||
// the GPU's clock held low while a lane loads or serves (lifecycle.py, gpu_held), unless the banner above says it
|
||
const gh = (F.gpu || {}).held;
|
||
if (gh && !(engines()[gh.unit] && startLevel(engines()[gh.unit]) === 'still'))
|
||
add('warn', 'The GPU’s clock is held low.', `It reads ${fmtN(gh.mhz)} MHz at most${gh.max_mhz ? ` of ${fmtN(gh.max_mhz)}` : ''} while ${LANE_NAME[gh.unit] || gh.unit} ${gh.doing === 'loading' ? 'loads' : 'answers'}; `
|
||
+ `the driver ${(gh.limits || []).length ? 'says what limits it: ' + gh.limits.join(', ') : 'gives no reason'}${F.gpu.driver ? ` (NVIDIA driver ${F.gpu.driver})` : ''}. `
|
||
+ 'If it outlasts the lane, shut the box down and cut its power for a minute (on the reference box, a change of driver and reboots did not bring it back).');
|
||
const upd0 = sv && updateOwed(sv[0]);
|
||
if (upd0) add('warn', `${laneLabel(sv[0])} runs what it started with, not what the update installed.`,
|
||
`${upd0}. It applies at its next start: Restart ${LANE_NAME[sv[0]]} to apply the update, on its card in Lanes (it answers again in ${readyIn(sv[0])}).`);
|
||
// since v1.40.3 the stop goes through the proxy, which cuts each client instead of letting its
|
||
// stream end as if the answer were whole, and holds new generations back while memory is short.
|
||
// What it did is the cockpit's to say (mem_floor.said): it claimed every generation stopped and
|
||
// new requests held where the proxy had cut none (code review, 2026-10-26)
|
||
if (F.memFloor && F.memFloor.aborts && F.memFloor.last_abort && Date.now() / 1000 - F.memFloor.last_abort < 600){
|
||
const ago = fmtDur(Date.now() / 1000 - F.memFloor.last_abort);
|
||
add('warn', 'The memory floor fired.', F.memFloor.via === 'proxy' && F.memFloor.said
|
||
? `Memory fell under ${F.memFloor.gib} GiB with requests running, ${ago} ago. To keep the box out of a livelock: ${F.memFloor.said}.`
|
||
: `Memory fell under ${F.memFloor.gib} GiB with requests running: every generation was aborted ${ago} ago to keep the box out of a livelock.`);
|
||
}
|
||
// Cohere's report (2026-10-26): the proxy writes down a tool call whose arguments name an Alibaba
|
||
// Cloud host or a cloud metadata address, whatever the client, and relays it as it came (v6.48)
|
||
const tt = F.toolTargets;
|
||
if (tt && tt.count && tt.last)
|
||
add('err', `A model asked a tool to reach ${tt.last.hosts}.`,
|
||
`${tt.count === 1 ? 'One tool call' : `${tt.count} tool calls`} in the last 24 h named an Alibaba Cloud host or a cloud metadata address (Cohere's report on Qwen3.8-Flash-Next), the last ${fmtDur(Math.max(0, Date.now() / 1000 - tt.last.at))} ago in a ${tt.last.tool} call on ${tt.last.path}. The proxy only reports it: whether the call ran depends on the client and its rules (docs/agents-and-network.md).`);
|
||
// A long prompt sent again after its client left it without an answer (proxy v6.49, issue #61): on
|
||
// the Ornith lane Claude Code left a prompt of 500,161 tokens after 620 s, twice, then 300 s, twice,
|
||
// and the engine kept what it had computed only every other time, so its answer came after 35 min
|
||
const rs = F.resent;
|
||
if (rs && rs.count && rs.last)
|
||
add('warn', 'A client gave up on a long prompt and sent it again.',
|
||
`${rs.count === 1 ? 'Once' : `${rs.count} times`} in the last 24 h, the last ${fmtDur(Math.max(0, Date.now() / 1000 - rs.last.at))} ago: `
|
||
+ `${rs.last.who} left it without an answer after ${fmtDur(rs.last.secs)} (${rs.last.n} time${rs.last.n > 1 ? 's' : ''} in a row), `
|
||
+ `and the engine computed it again, from what its prefix cache had kept of it, if anything. ${rs.last.advice}.`);
|
||
const upd = F.update || {};
|
||
// An update that runs now (install.sh keeps a file while it lasts, the cockpit checks its process):
|
||
// the banners that ask for one wait, since one runs (an ASUS Ascent GX10, 2026-10-21: an update of
|
||
// 1 h 45, a checkpoint of 144 GB, under the orange banner that asked for it), and so does the one
|
||
// that asks to restart this cockpit, which the update restarts
|
||
const run = upd.install_running;
|
||
if (run) add('info', run.to ? `Installing ${run.to}.` : 'The installer is running.',
|
||
`It started ${fmtMin(Math.max(0, Date.now() / 1000 - run.started))} ago. There is nothing to run meanwhile: this page says what is left to do once it ends.`);
|
||
if (upd.behind && !run) add('info', `Version ${upd.latest} is out; this box runs ${upd.installed}.`, 'The update keeps your choices, and moves a default an older release left to today\'s: it lists both before its first step. Update with:', updateCmd(F.config));
|
||
// The services behind their own clone (v1.36.0): installed.json names the release and the
|
||
// commit the last run that ended well installed. A git pull with no ./install.sh moves the
|
||
// clone and not the services, and a run stopped at --no-start updated neither the side lanes,
|
||
// nor the proxy, nor the cockpit; a box no run of v1.36.0 or later recorded is said once.
|
||
if (upd.behind_clone && !run){
|
||
const why = upd.behind_clone_why;
|
||
// the same release on both sides names the commits (Hasan's capture, 2026-10-29: "the services run
|
||
// v1.40.4, the clone is v1.40.4" said nothing of what moved); "past it" only with the commits the server found
|
||
// past the recorded one, which it looks for only in a clone that descends from it (review, 2026-10-30). The
|
||
// server names the two commits only for the same release on both sides: it alone decides that case here.
|
||
const same = !!upd.installed_commit, n = upd.commits_count, cs = upd.commits || [];
|
||
const past = n ? `${n === 1 ? 'one commit' : n + ' commits'} past it, at` : 'at';
|
||
// a clone get.sh refuses to update (off its channel's branch, or with commits of its own) gets its own installer: get.sh, which the
|
||
// banner gave it, refused (review of v1.48.0, 2026-11-13)
|
||
const cmd = upd.clone_local ? localInstallCmd(F.config) : updateCmd(F.config);
|
||
if (why === 'commit') add('orange', same
|
||
? `The clone moved on since the last install: the services run ${upd.installed} at ${upd.installed_commit}, the clone is ${past} ${upd.clone_commit}.`
|
||
: `The clone moved on since the last install: the services run ${upd.installed}, the clone is ${upd.clone || 'newer'}.`,
|
||
upd.clone_local ? 'This clone is off its channel\'s branch (main or stable) or holds commits of its own, which the one-line update refuses to install. Run its installer so the services follow it:'
|
||
: 'A git pull changes the files, not what runs. Run the installer so the services follow it:', cmd,
|
||
// one commit a line: joined by commas, subjects that hold commas themselves ran into each other (review)
|
||
same && cs.length ? cs.concat(n > cs.length ? [`and ${n - cs.length} more`] : []) : null);
|
||
else if (why === 'no-start') add('orange', 'The last install stopped at --no-start.',
|
||
'The side lanes, the proxy and the cockpit were not updated with it. Run it again without --no-start:', cmd);
|
||
else add('orange', `No install of v1.36.0 or later recorded what this box runs.`,
|
||
'The services run a release before it, or one an install that did not end well left. Run the installer once:', cmd);
|
||
}
|
||
// This box against what its clone recommends (v1.36.0, 2026-10-17): an orange banner when the
|
||
// next update moves something, so that nobody runs behind in silence. The operator's own
|
||
// choices make none (Hasan, 2026-10-17: a choice is not a delay, and a box that keeps one wore
|
||
// the banner for good); Settings lists each difference.
|
||
const cf = (upd.conformity || {}).items || [];
|
||
const moves = cf.filter(i => i.group === 'moves');
|
||
if (moves.length && !run){
|
||
const rel = upd.conformity.release || 'this release', kept = cf.length - moves.length;
|
||
add('orange', `This box runs ${moves.length === 1 ? 'a default' : moves.length + ' defaults'} of an older release.`,
|
||
`${moves.map(i => `${cfName(i)} ${i.value}`).join(', ')}: the next update moves ${moves.length === 1 ? 'it' : 'them'} to what ${rel} recommends`
|
||
+ (kept ? `, and keeps ${kept === 1 ? 'one setting' : kept + ' settings'} of yours` : '') + '. Settings lists each difference, and the variable that keeps it.');
|
||
}
|
||
if ((upd.stale_code || []).length && !run) add('warn', 'This cockpit runs older code than the files on disk.', `${upd.stale_code.join(', ')} changed under it. Restart it:`, 'sudo systemctl restart qwen38-dashboard.service');
|
||
// An update staged a new unit that waits for its lane's Load (decision 1408): until then the lane
|
||
// serves the release it served, and the only trace on the main screen was the Lanes tab's small
|
||
// badge, invisible on a phone with the rail closed (review of v1.53.0, 2026-11-19). A wait marked
|
||
// stale is dropped by its Load, not applied, so it gets no banner.
|
||
if (!run) Object.entries(F.pending || {}).forEach(([unit, lacks]) => {
|
||
if ((lacks[0] || '').startsWith('stale:')) return;
|
||
add('orange', `An update waits for the ${LANE_NAME[unit] || unit} lane's Load.`,
|
||
`Until its Load the lane serves the release it served. Load it from its card in Lanes${lacks.length ? `, which downloads ${lacks.join('; ')} first` : ''}.`);
|
||
});
|
||
const ocf = F.ocfit;
|
||
// A Load writes the lane's nominal pair before its engine has a pool, and the cockpit lowers
|
||
// it once the engine is ready: while its own fit runs, or waits for the engine to finish
|
||
// warming up, that is a note, not a warning (it warned for ~9 s after every Load of the 27B,
|
||
// then for up to 30 s while the engine warmed up, second GX10, 2026-10-22)
|
||
const ocWaits = ocf && ocf.autofit === 'waiting for the engine';
|
||
if (ocf && !ocf.ok && (ocf.autofit === 'started' || ocf.autofit === 'fitting' || ocWaits))
|
||
add('info', 'The cockpit is fitting opencode to this engine.', `opencode's limits were written before ${ocf.served} booted, ${fmtN(ocf.asked)} tokens, and this boot serves ${fmtN(ocf.limit)}: the cockpit lowers them to fit${ocWaits ? ' as soon as the engine is ready' : ''}, and the Agent view's server restarts to read them. Nothing to do.`);
|
||
else if (ocf && !ocf.ok) add('warn', 'opencode asks for more than this engine can hold.', `${ocf.why}: opencode declares ${fmtN(ocf.asked)} tokens, and ${ocf.served} can serve ${fmtN(ocf.limit)}. A session would break when the proxy refuses the prompt. Settings has "Fit the limits to this engine".`);
|
||
// An address the cockpit was given and this box does not have (Tailscale down, or its address changed since the
|
||
// install): the page opens here, and nobody reaches it from there, which nothing said.
|
||
const deaf = ((F.here || {}).listeners || []).find(l => !l.listening && l.addr !== '127.0.0.1' && l.addr !== '::1');
|
||
if (deaf) add('warn', `The cockpit does not answer on ${deaf.addr}.`,
|
||
`${cap1(deaf.error || '')}. It tries again by itself. If that address changed for good, give the cockpit the new one, on the box:`,
|
||
`cd ${(F.config || {}).repo_dir || '~/dgx-spark-qwen38'} && DASH_BIND="$(${isTailnet(deaf.addr) ? 'tailscale ip -4 | head -1' : "hostname -I | awk '{print $1}'"})" dashboard/install-dashboard.sh`);
|
||
// A box that chose ./install.sh --opencode 1 stays on OpenCode 1 at every update while every other box
|
||
// serves OpenCode 2, the default since v1.56.0: nobody stays behind without knowing it (decision 1564)
|
||
if ((F.agent || {}).major_choice === '1')
|
||
add('orange', 'opencode 1 on this box: behind.',
|
||
'This box chose ./install.sh --opencode 1, so every update keeps it on OpenCode 1 while the others serve OpenCode 2, '
|
||
+ 'the default since v1.56.0. To move to it (./install.sh --opencode 1 stays the way back), on the box:', './install.sh --opencode 2');
|
||
((F.life || {}).orphans || []).forEach(o => add('warn', `${LANE_NAME[o.unit] || o.unit} is running outside systemd.`,
|
||
`The container ${o.container} serves, but its unit is not running, so no other engine may start and a reboot will not bring it back. Start it from Lanes to replace it, or remove it:`, `docker rm -f ${o.container}`));
|
||
if (errors.lifecycle) add('warn', 'Engine state unknown.', 'The lifecycle collector failed: ' + String(errors.lifecycle).slice(0, 120));
|
||
// drawn only when it changed: a live region re-read twice a second is noise
|
||
// (and of a list, how many: its words hold watts and MHz, and a button drawn again at each reading is one nobody presses)
|
||
const sig = JSON.stringify(want.map(w => [w[0], w[1], !!w[3], (w[4] || []).length, (w[5] || []).map(a => a[0])]));
|
||
if (box.dataset.sig === sig){
|
||
[...box.children].forEach((b, i) => {
|
||
const t = b.querySelector('.t'); if (t) setText(t, want[i][2]);
|
||
const c = b.querySelector('.bcmd .cmd'); if (c) setText(c, want[i][3]);
|
||
b.querySelectorAll('.blist li').forEach((li, k) => setText(li, want[i][4][k]));
|
||
});
|
||
return;
|
||
}
|
||
box.dataset.sig = sig; clear(box);
|
||
want.forEach(([kind, strong, text, cmd, list, acts]) => {
|
||
const b = el('div', 'banner ' + kind);
|
||
b.append(el('span', 'lamp ' + (kind === 'err' ? 'err' : kind === 'warn' ? 'warn' : kind === 'orange' ? 'orange' : '')));
|
||
const p = el('div'); p.append(el('b', null, strong + ' '));
|
||
if (list && list.length){ const ul = el('ul', 'blist'); list.forEach(x => ul.append(el('li', null, x))); p.append(ul); }
|
||
p.append(el('span', 't', text));
|
||
if (cmd){
|
||
const pre = el('pre', 'cmd', cmd), btn = el('button', 'icon-btn copy-icon'), c = el('div', 'copy-field bcmd');
|
||
btn.type = 'button'; wireCopyButton(btn, () => pre.textContent, 'Copy the command');
|
||
c.append(pre, btn); p.append(c);
|
||
}
|
||
if (acts && acts.length){
|
||
const row = el('div', 'btn-row bacts');
|
||
acts.forEach(([words, run]) => { const x = el('button', 'btn sm', words); x.type = 'button'; x.addEventListener('click', run); row.append(x); });
|
||
p.append(row);
|
||
}
|
||
b.append(p); box.append(b);
|
||
});
|
||
}
|
||
afterApply(renderBanners);
|
||
|
||
// ── the notices line: one line of the page, always there, for what the banners say ──
|
||
// A banner in the page's flow pushed everything under it by 120 to 420 px as it came and went (Hasan, 2026-11-30). The
|
||
// line has the gravest one's words and their number; a press, the keyboard included, opens the whole of each over the page.
|
||
const NOTICE_RANK = ['err', 'warn', 'orange', 'info'];
|
||
const noticeKind = b => NOTICE_RANK.find(k => b.classList.contains(k)) || 'info';
|
||
function renderNotices(){
|
||
const box = $('notices'), bar = $('notice'); if (!box) return;
|
||
const all = [...$('banners').children];
|
||
const ranked = all.slice().sort((a, b) => NOTICE_RANK.indexOf(noticeKind(a)) - NOTICE_RANK.indexOf(noticeKind(b))), top = ranked[0];
|
||
if (!top) setNotices(false);
|
||
NOTICE_RANK.forEach(k => box.classList.toggle(k, !!top && noticeKind(top) === k));
|
||
box.classList.toggle('quiet', !top); bar.disabled = !top;
|
||
$('notice-lamp').className = 'lamp' + (top ? ' ' + noticeKind(top) : '');
|
||
const strong = top ? top.querySelector('b').textContent.trim() : 'Nothing to report.';
|
||
setText('notice-strong', strong); setText('notice-sub', top ? top.querySelector('.t').textContent : boxName() || '');
|
||
setText('notice-n', all.length > 1 ? `${all.length} notices` : all.length ? 'Read' : '');
|
||
bar.setAttribute('aria-label', top ? `${strong} ${all.length > 1 ? all.length + ' notices' : 'One notice'}: read ${all.length > 1 ? 'them' : 'it'}` : strong);
|
||
// a reader is told of each, the gravest first: one that came under it was never said (review of v1.60.0)
|
||
setText('notice-say', ranked.map(b => b.querySelector('b').textContent.trim()).join(' '));
|
||
}
|
||
function setNotices(open){
|
||
const was = $('notices').classList.contains('open'); if (was === open) return;
|
||
$('notices').classList.toggle('open', open); $('notice').setAttribute('aria-expanded', String(open));
|
||
}
|
||
afterApply(renderNotices);
|
||
|
||
// ── sparklines: canvas, bounded series, device resolution ─────────────────────
|
||
const SERIES = {};
|
||
function push(name, v, max = 180){ (SERIES[name] = SERIES[name] || []).push(v); if (SERIES[name].length > max) SERIES[name].shift(); }
|
||
function drawSpark(canvas, name, color, yMax, opts = {}){
|
||
if (!canvas || !canvas.getContext) return;
|
||
const dpr = Math.min(window.devicePixelRatio || 1, 2);
|
||
const w = canvas.clientWidth || 600, h = canvas.clientHeight || 64;
|
||
if (canvas.width !== Math.round(w * dpr) || canvas.height !== Math.round(h * dpr)){ canvas.width = Math.round(w * dpr); canvas.height = Math.round(h * dpr); }
|
||
const c = canvas.getContext('2d'); if (!c) return;
|
||
c.setTransform(dpr, 0, 0, dpr, 0, 0); c.clearRect(0, 0, w, h);
|
||
const data = SERIES[name] || [];
|
||
c.strokeStyle = cssVar('--spark-grid') || 'rgba(255,255,255,.06)'; c.lineWidth = 1;
|
||
[0.25, 0.5, 0.75].forEach(f => { c.beginPath(); c.moveTo(0, Math.round(h * f) + .5); c.lineTo(w, Math.round(h * f) + .5); c.stroke(); });
|
||
if (data.length < 2){ c.fillStyle = cssVar('--fg-3'); c.font = '12px Geist, system-ui'; c.textAlign = 'center'; c.fillText(opts.empty || 'collecting…', w / 2, h / 2 + 4); return; }
|
||
const m = yMax || Math.max(...data, 1e-9);
|
||
const at = (v, i) => [i * (w / (data.length - 1)), h - Math.min(v / m, 1) * (h - 8) - 4];
|
||
const g = c.createLinearGradient(0, 0, 0, h); g.addColorStop(0, color); g.addColorStop(1, 'rgba(0,0,0,0)');
|
||
c.beginPath(); data.forEach((v, i) => { const [x, y] = at(v, i); i ? c.lineTo(x, y) : c.moveTo(x, y); });
|
||
c.lineTo(w, h); c.lineTo(0, h); c.closePath(); c.globalAlpha = .25; c.fillStyle = g; c.fill(); c.globalAlpha = 1;
|
||
c.beginPath(); data.forEach((v, i) => { const [x, y] = at(v, i); i ? c.lineTo(x, y) : c.moveTo(x, y); });
|
||
c.strokeStyle = color; c.lineWidth = 2; c.lineJoin = 'round'; c.stroke();
|
||
const [lx, ly] = at(data[data.length - 1], data.length - 1);
|
||
c.fillStyle = color; c.beginPath(); c.arc(lx - 2, ly, 3, 0, 6.284); c.fill();
|
||
}
|
||
|
||
// ── collectors every view shares ───────────────────────────────────────────────
|
||
on('config', d => {
|
||
F.config = d; F.usable = d.usable_frac || F.usable;
|
||
setText('ver', 'v' + (d.version || '?') + (d.dry_run ? ', dry run' : ''));
|
||
show('drytag', !!d.dry_run);
|
||
document.querySelectorAll('[data-port]').forEach(e => setText(e, e.dataset.port === 'engine' ? enginePort() : proxyPort()));
|
||
});
|
||
on('units', d => { F.units = d.units || {}; });
|
||
on('lifecycle', d => { F.life = d; });
|
||
on('repo', d => { F.proxy = d.proxy || null; });
|
||
on('update', d => { F.update = d || {}; });
|
||
// which side lanes are prepared, their runtime built (installed on demand: units at install,
|
||
// runtime at the first Load): true, false, or null for a lane not installed
|
||
on('lanes_ready', d => { F.lanesReady = d || {}; });
|
||
on('lanes_startable', d => { F.lanesStartable = d || {}; });
|
||
// an update that waits for a lane's Load (decision 1408): {unit: [what its new unit lacks]} (cockpit.py, pending_units)
|
||
on('pending', d => { F.pending = d || {}; });
|
||
// the target each waiting unit serves (cockpit.py, pending_target): a Load toward another target neither
|
||
// prepares nor poses the wait, the switch renders the unit in place for the asked target and clears it
|
||
on('pending_targets', d => { F.pendingTargets = d || {}; });
|
||
// how this very page's connection came in: the address of the box it arrived at, the one it came from (cockpit.py, here)
|
||
on('here', d => { F.here = d; });
|
||
on('agent', d => { F.agent = d; });
|
||
on('containers', d => { F.containers = d.containers || {}; });
|
||
on('job', renderJob);
|
||
on('engine_info', d => {
|
||
if (d.prompt_ceiling_tokens != null) F.ceiling = d.prompt_ceiling_tokens;
|
||
F.target = d.served_target || null;
|
||
const i = d.info || {};
|
||
F.model = i.model_path || null;
|
||
if (i.max_total_num_tokens) F.pool = i.max_total_num_tokens;
|
||
if (i.context_length) F.window = i.context_length;
|
||
if (i.max_running_requests) F.maxRun = i.max_running_requests;
|
||
});
|
||
on('engine_fast', d => { F.load = (d.load || [])[0] || {}; F.noEngine = !d.load; F.memFloor = d.mem_floor || F.memFloor; F.prompt = d.prompt || null; F.canary = !!d.canary_inflight; });
|
||
on('machine', d => { F.machine = d; });
|
||
on('gpu', d => { F.gpu = d; });
|
||
on('opencode', d => { F.ocfit = d.fit || null; });
|
||
// The pool a lane's facts show. The history holds the boots this cockpit watched, so a
|
||
// cockpit restarted after the serving lane booted read the boot before as "this boot"
|
||
// (400,384 tokens beside a live 491,136 on 2026-09-30): the serving text lane shows
|
||
// what its engine reports now, every other lane its last recorded boot.
|
||
const livePool = (unit, e) => {
|
||
const s = servingEngine();
|
||
// the engine read is refreshed every 30 s: right after a switch it can still be the
|
||
// previous lane's, which says so by its target
|
||
return !!(s && s[0] === unit && textReady() && F.pool && (!F.target || !e || !e.target || F.target === e.target));
|
||
};
|
||
function lanePool(unit, e){ return livePool(unit, e) ? F.pool : (e && e.pools && e.pools.last) || null; }
|
||
// The engine's own window caps it too: on Kolibri, a 2.2M-token pool and no proxy ceiling read
|
||
// "about 1.8M tokens" while vLLM refuses a prompt past 262,144 (found in review, 2026-10-14).
|
||
const singleLimit = () => F.pool ? Math.min(Math.round(F.pool * F.usable), F.ceiling > 0 ? F.ceiling : Infinity,
|
||
F.window > 0 ? F.window : Infinity) : null;
|
||
// physical pool occupancy: the engine dedupes shared prefixes, so the requests' summed
|
||
// lengths ("logical") can read past the pool while the pool never overflows
|
||
const physTokens = l => (l.num_used_tokens != null ? l.num_used_tokens : l.num_tokens) || 0;
|
||
// the load counts a queued request in num_reqs too (running plus waiting, the /get_load shape):
|
||
// what runs is the difference (01/10: "5 Running, 3 Waiting" for two running and three queued)
|
||
const runningReqs = l => Math.max(0, (l.num_reqs || 0) - (l.num_waiting_reqs || 0));
|
||
const waitingReqs = l => l.num_waiting_reqs || 0;
|
||
const loadWords = l => [runningReqs(l) ? `${runningReqs(l)} running` : '', waitingReqs(l) ? `${waitingReqs(l)} waiting` : ''].filter(Boolean).join(', ');
|
||
// The one running request's prompt, while vLLM computes it (lc.prompt_progress): a prompt the cache
|
||
// cannot serve takes minutes, 19 for 494,089 tokens on the Ornith lane, and the page said only
|
||
// "1 running" and "quiet" through all of it (issue #61, 2026-10-30). The time left is a floor.
|
||
// a floor stays a floor once written: rounded down, where fmtMin rounds to the nearest minute and said
|
||
// "at least 3 min" of 150 s (code review, 2026-10-31)
|
||
const fmtAtLeast = s => {
|
||
if (s < 90) return Math.floor(s) + ' s';
|
||
const m = Math.floor(s / 60);
|
||
return m < 60 ? m + ' min' : Math.floor(m / 60) + ' h ' + String(m % 60).padStart(2, '0');
|
||
};
|
||
// how far a prompt the cache could not serve has got (issue #61): the Activity panel of Now, and the feed's row
|
||
const promptProgress = p => !p ? '' : `${Math.round(100 * p.share)} % of ${fmtN(p.tokens)} tokens after ${fmtDur(p.elapsed)}`
|
||
+ (p.left_min_s != null ? `, at least ${fmtAtLeast(p.left_min_s)} left` : p.share >= 0.99 ? ', almost done' : '');
|
||
const promptWords = p => !p ? '' : `computing its prompt: ${promptProgress(p)}`;
|
||
|
||
// ── wiring the shell ──────────────────────────────────────────────────────────
|
||
function wireShell(){
|
||
document.querySelectorAll('.rail .nav').forEach(b => b.addEventListener('click', () => showView(b.dataset.view)));
|
||
window.addEventListener('hashchange', () => showView(location.hash.slice(1) || 'now', false));
|
||
$('menubtn').addEventListener('click', () => {
|
||
const open = !document.body.classList.contains('railopen'); setRailOpen(open);
|
||
if (open) setTimeout(() => { const b = document.querySelector('.rail .nav[aria-current="page"]') || document.querySelector('.rail .nav'); if (b) b.focus(); }, 0);
|
||
});
|
||
document.addEventListener('click', e => { if (document.body.classList.contains('railopen') && !e.target.closest('.rail') && !e.target.closest('#menubtn')) setRailOpen(false); });
|
||
try { setRailMin(localStorage.getItem('cockpit.rail') === 'min'); } catch { setRailMin(false); }
|
||
$('railbtn').addEventListener('click', () => setRailMin(!document.body.classList.contains('railmin')));
|
||
$('serving').addEventListener('click', () => showView('lanes'));
|
||
$('lanebtn').addEventListener('click', () => showView('lanes'));
|
||
$('notice').addEventListener('click', () => setNotices(!$('notices').classList.contains('open')));
|
||
document.addEventListener('click', e => { if (!e.target.closest('#notices')) setNotices(false); });
|
||
// a text cut by its box says the whole of itself under the mouse, whatever the box: read when the pointer comes, so
|
||
// that a value that changes is never an old one
|
||
document.addEventListener('pointerover', e => {
|
||
const b = e.target && e.target.closest && e.target.closest('.facts dd, .cut, .cap, .vital .s, .panel > header h2, .panel > header .aside, .bay h3, .bay .kind, .bay .faint, .timeline .m, .notice-txt');
|
||
if (!b || b.scrollWidth <= b.clientWidth + 1 && b.scrollHeight <= b.clientHeight + 1){ if (b && b.dataset.cut != null){ b.removeAttribute('title'); delete b.dataset.cut; } return; }
|
||
if (!b.title || b.dataset.cut != null){ b.title = b.textContent.trim(); b.dataset.cut = ''; }
|
||
});
|
||
$('jobpip').addEventListener('click', () => {
|
||
const cur = (F.job || {}).current;
|
||
if (loadAway() && (!cur || cur.id === SHEET.jobId) && reopenJourney()) return;
|
||
dockHidden = null; dockPinned = true; $('dock').hidden = false;
|
||
});
|
||
window.addEventListener('beforeunload', e => { if (leaveWarning()){ e.preventDefault(); e.returnValue = ''; } });
|
||
// the sheet
|
||
$('sh-cancel').addEventListener('click', () => closeSheet());
|
||
$('sh-go').addEventListener('click', sheetGo);
|
||
$('scrim').addEventListener('click', e => { if (e.target === $('scrim') && !justBack()) closeSheet(); });
|
||
$('viewer-close').addEventListener('click', closeViewer);
|
||
$('viewer-actual').addEventListener('click', viewerActual);
|
||
// the picture says its own size once decoded: the label, and the 100 % width, follow it
|
||
$('viewer-img').addEventListener('load', () => { const v = $('viewer-img'); if (!v.naturalWidth) return;
|
||
setText('viewer-size', `${v.naturalWidth} × ${v.naturalHeight}`);
|
||
if ($('viewer-pane').classList.contains('actual')) v.style.width = `${Math.round(v.naturalWidth / (window.devicePixelRatio || 1))}px`; });
|
||
$('viewer').addEventListener('click', e => { if (e.target === $('viewer') || e.target === $('viewer-pane')) closeViewer(); });
|
||
document.addEventListener('keydown', e => {
|
||
if (!$('viewer').hidden){
|
||
if (e.key === 'Escape') closeViewer();
|
||
if (e.key === 'Tab'){ // focus stays on the viewer's own controls
|
||
const f = [...$('viewer').querySelectorAll('button, a[href]')];
|
||
const i = f.indexOf(document.activeElement);
|
||
e.preventDefault(); f[(i + (e.shiftKey ? -1 : 1) + f.length) % f.length].focus();
|
||
}
|
||
return;
|
||
}
|
||
if (!$('scrim').hidden){
|
||
if (e.key === 'Escape' && !justBack()) closeSheet();
|
||
if (e.key === 'Tab'){ // focus stays inside the sheet
|
||
const f = [...$('sheet').querySelectorAll('button')].filter(b => !b.disabled);
|
||
if (!f.length) return;
|
||
const i = f.indexOf(document.activeElement);
|
||
e.preventDefault(); f[(i + (e.shiftKey ? -1 : 1) + f.length) % f.length].focus();
|
||
}
|
||
return;
|
||
}
|
||
if (!$('menu').hidden){
|
||
if (e.key === 'Escape') closeMenu();
|
||
if (e.key === 'Tab'){ // focus stays inside the menu, as in the sheet
|
||
const f = [...$('menu').querySelectorAll('button')].filter(b => !b.disabled);
|
||
if (!f.length) return;
|
||
const i = f.indexOf(document.activeElement);
|
||
e.preventDefault(); f[(i + (e.shiftKey ? -1 : 1) + f.length) % f.length].focus();
|
||
}
|
||
return;
|
||
}
|
||
if (e.key === 'Escape' && $('notices').classList.contains('open')){ setNotices(false); $('notice').focus(); return; }
|
||
if (e.key === 'Escape' && document.body.classList.contains('railopen')){ setRailOpen(false); $('menubtn').focus(); }
|
||
});
|
||
// the dock
|
||
$('dock-log').addEventListener('click', () => {
|
||
const pre = $('dock-pre'), open = pre.hidden; pre.hidden = !open; dockPinned = open;
|
||
$('dock-log').setAttribute('aria-expanded', String(open)); setText($('dock-log'), open ? 'Hide log' : 'Log');
|
||
if (open && JOBLINES.id) fetchJobLines(JOBLINES.id);
|
||
});
|
||
$('dock-stop').addEventListener('click', async () => {
|
||
const id = ((F.job || {}).current || {}).id;
|
||
if (!id || stopAsked === id) return;
|
||
stopAsked = id; $('dock-stop').disabled = true;
|
||
let why = '';
|
||
try { const r = await postJSON('/api/job/stop', {id}); if (!r.ok) why = r.out.error || 'HTTP ' + r.status; }
|
||
catch (e){ why = e.message; }
|
||
if (why){ stopAsked = null; $('dock-stop').disabled = false; toast('Not stopped: ' + why, 'err'); }
|
||
});
|
||
$('dock-close').addEventListener('click', () => {
|
||
const j = F.job || {}; dockHidden = (j.current || (j.recent || [])[0] || {}).id || null; dockPinned = false; $('dock').hidden = true;
|
||
});
|
||
// the actions menu
|
||
$('actbtn').addEventListener('click', openMenu);
|
||
$('logoutbtn').addEventListener('click', async () => {
|
||
try {
|
||
const r = await postJSON('/api/logout', {});
|
||
if (!r.ok) return toast('Could not sign out (' + r.status + '): the session is still open.', 'err');
|
||
} catch (e) {
|
||
if (e.message !== 'signed out') return toast('Could not sign out: ' + e.message, 'err');
|
||
}
|
||
leavingForLogin = true;
|
||
location.href = '/';
|
||
});
|
||
$('menu-close').addEventListener('click', closeMenu);
|
||
$('menu').addEventListener('click', e => { if (e.target === $('menu')) closeMenu(); });
|
||
}
|
||
const MENU_ITEMS = [
|
||
['diag_bundle', 'Write a diagnostics bundle', 'Why a load failed, for whoever helps: logs, state and versions in a tarball in your home, key masked.'],
|
||
['smoke', 'Run a smoke generation', 'One real generation through the proxy, the way a client uses it.'],
|
||
['flush_cache', 'Flush the engine cache', 'Empties the radix cache; harmless, refused while requests run.'],
|
||
['abort_all', 'Abort every generation', 'Every running or queued generation ends now.'],
|
||
['fit_opencode', 'Fit the opencode limits', 'Match opencode to the pool this boot got.']];
|
||
function openMenu(){
|
||
const box = $('menu-list'); clear(box);
|
||
MENU_ITEMS.forEach(([act, t, d]) => {
|
||
const b = el('button', 'btn block act');
|
||
const no = cannotWhy(act);
|
||
b.dataset.act = act; b.dataset.title = no || d;
|
||
if (no) b.setAttribute('aria-disabled', 'true');
|
||
b.append(el('span', null, t), el('span', 'faint', no || d));
|
||
b.addEventListener('click', () => { closeMenu(); askAction(act, {}, []); });
|
||
box.append(b);
|
||
});
|
||
const a = document.activeElement; OPENER.menu = a && !a.closest('#menu') ? a : OPENER.menu;
|
||
$('menu').hidden = false; applyBusy();
|
||
setTimeout(() => { const f = [...$('menu-list').querySelectorAll('button')].find(b => !b.disabled) || $('menu-close'); if (f) f.focus(); }, 0);
|
||
}
|
||
function closeMenu(){ if ($('menu').hidden) return; $('menu').hidden = true; giveBack('menu'); }
|