perf(panel): add incremental step transport, memoized aggregation, atomic cache writes, and hidden-view gating

- Project display-only step fields in /api/telemetry, skip unchanged step payloads via stepRevision, coalesce identical client refreshes, and share in-flight backend trajectory scans across same-account requests
- Reuse normalized step values and memoize up to two range aggregations in usage-aggregator gated by step timestamps, pricing revision, model overrides, timezone, and source identity; cache per-trajectory model facts and single-agent step preparation via WeakMap/WeakRef
- Persist trajectory checkpoints atomically in trajectory-cache-file.mjs via chunked writevSync + renameSync while reusing serialized step byte slices for unchanged conversations
- Render step turn-rail lines/dots via CSS pseudo-elements, allocate speed-reason nodes on demand, short-circuit unchanged table reconciliations, and cache per-series LOESS publication fits in SessionStepCharts
- Gate DOM updates and timers across closed overlay panels, hover popups, inactive settings tabs, and unchanged ConsumptionView payloads
- Distinguish canceled steps (CORTEX_STEP_STATUS_CANCELED) and untimed compaction steps from generic incomplete timing in speed-metrics and bilingual i18n labels
This commit is contained in:
fish
2026-11-15 23:33:08 +09:00
parent 03d3160ef0
commit 8968e03adb
33 changed files with 1692 additions and 920 deletions
@@ -123,24 +123,29 @@ export const STEP_COLUMN_REGISTRY = Object.freeze({
className: 'cell-value tone-muted',
style: 'font-size: var(--fs-base-sm);',
});
const speedReason = h('div', {
className: 'text-muted',
style: 'font-size: var(--fs-2xs);',
});
const wrapEl = h(
'span',
{ style: 'display: inline-block; vertical-align: middle;' },
[speedMain, speedReason]
[speedMain]
);
const td = h('td', {}, [wrapEl]);
return { td, refs: { td, speedMain, speedReason } };
return { td, refs: { wrapEl, speedMain, speedReason: null } };
},
updateCell: (refs, st) => {
patchText(refs.speedMain, formatMetric(st.tokPerSec, ' tok/s'));
patchAttr(refs.speedMain, 'class', `cell-value ${getSpeedToneClass(st.tokPerSec)}`);
const reason = speedReasonText(st.selectedSpeedReason);
patchText(refs.speedReason, reason);
patchAttr(refs.speedReason, 'hidden', !reason);
if (reason && !refs.speedReason) {
refs.speedReason = h('div', {
className: 'text-muted',
style: 'font-size: var(--fs-2xs);',
});
refs.wrapEl.appendChild(refs.speedReason);
}
if (refs.speedReason) {
patchText(refs.speedReason, reason);
patchAttr(refs.speedReason, 'hidden', !reason);
}
},
},