Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat: make model performance results-first (#7794)
[._.]/ Adam Eivy47f6e0c1fe58
diff --git a/client/src/App.jsx b/client/src/App.jsxindex 1e366e15dc..c890c9f0e5 100644--- a/client/src/App.jsx+++ b/client/src/App.jsx@@ -399,6 +399,11 @@ export default function App() {{/* Harnesses folded into the AI Providers harnesses view (/ai/harnesses);retires the duplicate /models/harnesses page while keeping bookmarks working. */}<Route path="models/harnesses" element={<Navigate to="/ai/harnesses" replace />} />+ {/* Performance owns task views rather than making one long page. The+ selected result route is more specific so a slash-containing model+ id stays inside the reversible assessment key segment. */}+ <Route path="models/performance/results/:assessmentKey" element={<Models fixedTab="performance" />} />+ <Route path="models/performance/:view" element={<Models fixedTab="performance" />} />{/* A tab's drill-down (today: the LoRA dataset workbench) renders throughModels itself, so it keeps the section header and tab bar — seeTAB_DETAIL there. */}diff --git a/client/src/components/settings/LocalModelAssessments.jsx b/client/src/components/settings/LocalModelAssessments.jsxindex 686df6e970..32f36424d9 100644--- a/client/src/components/settings/LocalModelAssessments.jsx+++ b/client/src/components/settings/LocalModelAssessments.jsx@@ -23,11 +23,13 @@*/import { useCallback, useEffect, useMemo, useRef, useState } from 'react';-import { Gauge, RefreshCw, Trash2, Play, AlertTriangle, History, SlidersHorizontal, ChevronDown, ChevronUp, Terminal } from 'lucide-react';+import { Link, useLocation, useNavigate } from 'react-router';+import { BarChart3, Gauge, RefreshCw, Trash2, Play, AlertTriangle, History, SlidersHorizontal, ChevronDown, ChevronUp, Terminal, FlaskConical } from 'lucide-react';import socket from '../../services/socket';import Drawer from '../Drawer';import BrailleSpinner from '../BrailleSpinner';import toast from '../ui/Toast';+import TabPills from '../ui/TabPills';import { useAsyncAction } from '../../hooks/useAsyncAction';import useMounted from '../../hooks/useMounted';import useUrlParams from '../../hooks/useUrlParams';@@ -35,8 +37,9 @@ import AssessmentSweepPanel from './AssessmentSweepPanel';import ModelCapabilityTests, { TestCell } from './ModelCapabilityTests.jsx';import CapabilityBadges from '../models/CapabilityBadges.jsx';import ModelThroughputReport from './ModelThroughputReport';-import { formatContextTokens, formatDurationMs, throughputLabel } from '../../utils/formatters';+import { formatContextTokens, formatDurationMs, timeAgo, throughputLabel } from '../../utils/formatters';import { tuningNoticeChip } from '../../lib/assessmentTuningNotice';+import { decodeLocalModelAssessmentKey, localModelAssessmentPath } from '../../lib/localModelAssessmentKey';import {getLocalLlmAssessments, runLocalLlmAssessment, runOpenCodeAgentBenchmark, deleteLocalLlmAssessment,getModelCapabilityTests,@@ -49,6 +52,15 @@ const INTENTS = [{ id: 'lightweight', label: 'Lightweight', blurb: 'Favors the smallest resident footprint — room left for other work.' },];+export const PERFORMANCE_VIEWS = [+ { id: 'results', label: 'Results', icon: BarChart3 },+ { id: 'capabilities', label: 'Capabilities', icon: FlaskConical },+ { id: 'agent-checks', label: 'Agent checks', icon: Terminal },+ { id: 'tuning', label: 'Tuning', icon: SlidersHorizontal },+];++const PERFORMANCE_PATH = '/models/performance';+// Fallback labels only. The authoritative roster (label, reachability, knob// catalog) rides on the report as `runtimes` — a hardcoded list here would drift// the moment the server learns a sixth runtime.@@ -152,6 +164,95 @@ function VerdictPill({ verdict }) {);}+function SelectedEvidence({ entry, report, loading, selected, search }) {+ if (!selected) {+ return (+ <aside className="bg-port-bg border border-port-border rounded-lg p-3 space-y-2" aria-label="Selected evidence">+ <h3 className="text-xs font-medium text-gray-300">Selected evidence</h3>+ <p className="text-[11px] text-gray-500">Choose a measured row to inspect its runtime, tuning, timing, and freshness evidence.</p>+ </aside>+ );+ }++ if (loading) {+ return (+ <aside className="bg-port-bg border border-port-border rounded-lg p-3" aria-label="Selected evidence">+ <BrailleSpinner text="Loading selected evidence" />+ </aside>+ );+ }++ if (!entry) {+ return (+ <aside className="bg-port-bg border border-port-border rounded-lg p-3 space-y-2" role="alert" aria-label="Selected evidence">+ <h3 className="text-xs font-medium text-gray-300">Selected evidence unavailable</h3>+ <p className="text-[11px] text-gray-500">+ This measurement is stale, deleted, or no longer installed. Nothing will run from this link.+ </p>+ <Link className="text-xs text-port-accent hover:underline" to={{ pathname: `${PERFORMANCE_PATH}/results`, search }}>+ Return to Results+ </Link>+ </aside>+ );+ }++ const performance = entry.performance || {};+ const tableRow = report?.throughputReport?.rows?.find((row) => entryKey(row) === entryKey(entry));+ const measuredContexts = entry.samples?.map((sample) => sample.contextTokens).filter(Number.isFinite);+ const contextBasis = measuredContexts?.length+ ? measuredContexts.map(formatContextTokens).join(', ')+ : (report?.defaultContextTokens || []).map(formatContextTokens).join(', ');+ const freshness = entry.staleness?.comparable === false+ ? 'Unknown'+ : entry.staleness?.stale+ ? 'Stale'+ : 'Current';+ const timingBasis = tableRow?.timingSource === 'runtime'+ ? 'Runtime-reported timing'+ : tableRow?.timingSource === 'stream-window'+ ? 'Observed stream window'+ : tableRow?.timingSource === 'wall-clock'+ ? 'End-to-end wall clock'+ : 'Timing basis unavailable';++ return (+ <aside className="bg-port-bg border border-port-border rounded-lg p-3 space-y-3" aria-label="Selected evidence">+ <div className="flex items-start justify-between gap-2">+ <div className="min-w-0">+ <h3 className="text-xs font-medium text-gray-300">Selected evidence</h3>+ <p className="text-sm text-white font-mono break-all mt-1">{entry.modelId}</p>+ <p className="text-[11px] text-gray-500">{backendLabel(report, entry.backend)}</p>+ </div>+ <div className="flex items-center gap-1.5 shrink-0">+ <VerdictPill verdict={entry.verdict} />+ <StalePill staleness={entry.staleness} />+ </div>+ </div>++ {entry.reason && <p className="text-[11px] text-port-warning">{entry.reason}</p>}+ {entry.explanation && <p className="text-[11px] text-gray-400">{entry.explanation}</p>}++ <dl className="grid grid-cols-2 gap-x-3 gap-y-2 text-[11px]">+ <div><dt className="text-gray-500">Launch tuning</dt><dd className="text-gray-200">{entry.tuningLabel || 'backend defaults'}</dd></div>+ <div><dt className="text-gray-500">Freshness</dt><dd className={freshness === 'Stale' ? 'text-port-warning' : 'text-gray-200'}>{freshness}</dd></div>+ <div><dt className="text-gray-500">Measured</dt><dd className="text-gray-200">{timeAgo(entry.assessedAt, 'unknown')}</dd></div>+ <div><dt className="text-gray-500">Timing basis</dt><dd className="text-gray-200">{timingBasis}</dd></div>+ <div><dt className="text-gray-500">Context samples</dt><dd className="text-gray-200">{contextBasis || 'not measured'}</dd></div>+ <div><dt className="text-gray-500">Max context</dt><dd className="text-gray-200">{Number.isFinite(performance.maxWorkingContextTokens) ? `${formatContextTokens(performance.maxWorkingContextTokens)} tokens` : 'not measured'}</dd></div>+ <div><dt className="text-gray-500">Throughput</dt><dd className="text-gray-200">{throughputLabel(performance) || 'not measured'}</dd></div>+ <div><dt className="text-gray-500">First token</dt><dd className="text-gray-200">{Number.isFinite(performance.meanTtftMs) ? formatDurationMs(performance.meanTtftMs) : 'not measured'}</dd></div>+ </dl>++ <Link+ className="inline-flex items-center text-xs text-port-accent hover:underline"+ to={{ pathname: `${PERFORMANCE_PATH}/results`, search }}+ >+ Clear selection+ </Link>+ </aside>+ );+}+/*** One runtime's tuning knobs as a form.*@@ -368,10 +469,10 @@ function CapabilityStrip({ capability, backend, modelId, tests, onOpen }) {);}-function RankedRow({ entry, runtimeLabel, onRemeasure, onDelete, onSweepTunings, sweepVariants, busy, capability, capabilityTests, onOpenCapabilityTest }) {+function RankedRow({ entry, runtimeLabel, onRemeasure, onDelete, onSweepTunings, sweepVariants, busy, capability, capabilityTests, onOpenCapabilityTest, selected, search }) {const perf = entry.performance || {};return (- <div className="bg-port-bg border border-port-border rounded-lg p-3 space-y-2">+ <div className={`bg-port-bg border rounded-lg p-3 space-y-2 ${selected ? 'border-port-accent/70' : 'border-port-border'}`}><div className="flex items-start justify-between gap-2 flex-wrap"><div className="min-w-0"><div className="flex items-center gap-2 flex-wrap">@@ -410,6 +511,15 @@ function RankedRow({ entry, runtimeLabel, onRemeasure, onDelete, onSweepTunings,)}</div><div className="flex items-center gap-2 shrink-0">+ <Link+ to={{ pathname: localModelAssessmentPath(entry), search }}+ aria-label={`View evidence for ${entry.modelId}`}+ aria-current={selected ? 'page' : undefined}+ className="min-h-[44px] min-w-[44px] inline-flex items-center justify-center p-1.5 text-gray-400 hover:text-port-accent transition-colors"+ title="View selected evidence"+ >+ <BarChart3 size={13} />+ </Link><buttononClick={() => onRemeasure(entry)}disabled={busy}@@ -613,11 +723,14 @@ function OpenCodeAgentBenchmarkPanel({ results, running, onRun }) {<h3 className="font-medium">Local TUI agent-task check</h3></div><p className="text-[11px] text-gray-500">- Runs one disposable task through each configured local TUI preset using the actual PTY-backed harness.- The agent must create and read a sentinel file in a temporary workspace, so this measures harness- completion including startup and terminal paste overhead. Compare the direct report above for engine- throughput.+ Run one explicit task through each configured local TUI preset and compare completion evidence.</p>+ <details className="border border-port-border/70 rounded px-2 py-1.5">+ <summary className="cursor-pointer text-[11px] text-gray-400">How the task check is measured</summary>+ <p className="text-[11px] text-gray-500 pt-1.5">+ The harness asks the agent to create and read a sentinel file in a temporary workspace. Completion time includes startup and terminal paste overhead; it is not engine throughput.+ </p>+ </details>{leader && (<div className="text-[11px] text-port-accent border border-port-accent/30 rounded px-2 py-1">Current task leader: <span className="font-medium">{leader.target.label}</span> — {formatDurationMs(leader.result.elapsedMs)} fastest completion@@ -661,7 +774,27 @@ function OpenCodeAgentBenchmarkPanel({ results, running, onRun }) {);}-export function LocalModelAssessments() {+export function LocalModelAssessments({ view, taskView, assessmentKey } = {}) {+ const location = useLocation();+ const navigate = useNavigate();+ const pathSegments = location.pathname.split('/').filter(Boolean);+ const pathnameView = pathSegments[0] === 'models' && pathSegments[1] === 'performance'+ ? pathSegments[2]+ : null;+ const pathnameAssessmentKey = pathnameView === 'results' ? pathSegments[3] : null;+ const requestedView = taskView || view || pathnameView || 'results';+ const selectedKey = assessmentKey || pathnameAssessmentKey;+ const validView = PERFORMANCE_VIEWS.some((item) => item.id === requestedView);+ const activeView = validView ? requestedView : 'results';++ useEffect(() => {+ if (!validView) navigate({ pathname: `${PERFORMANCE_PATH}/results`, search: location.search }, { replace: true });+ }, [location.search, navigate, validView]);++ const openView = useCallback((nextView) => {+ navigate({ pathname: `${PERFORMANCE_PATH}/${nextView}`, search: location.search });+ }, [location.search, navigate]);+const [intent, setIntent] = useState('balanced');const [report, setReport] = useState(null);const [loading, setLoading] = useState(true);@@ -754,6 +887,18 @@ export function LocalModelAssessments() {(capabilityReport?.models || []).map((m) => [`${m.backend}:${m.modelId}`, m]),), [capabilityReport]);+ const selectedTuple = useMemo(+ () => decodeLocalModelAssessmentKey(selectedKey),+ [selectedKey],+ );+ const selectedEntry = useMemo(() => {+ if (!selectedTuple) return null;+ const wanted = entryKey(selectedTuple);+ const rows = [report?.ranked, report?.excluded, report?.assessments, report?.uninstalled];+ return rows.flatMap((group) => group || []).find((entry) => entryKey(entry) === wanted) || null;+ }, [report, selectedTuple]);+ const selectedEvidenceLoading = Boolean(selectedKey && !report);+// Both this panel and the suite panel drive the same URL params, so a row's// chip opens the same drawer the matrix does without either owning the other.const openCapabilityTest = useCallback((capBackend, capModel, capTest) => {@@ -956,58 +1101,99 @@ export function LocalModelAssessments() {const activeIntent = INTENTS.find((i) => i.id === intent);return (- <div className="bg-port-card border border-port-border rounded-xl p-4 sm:p-6 space-y-4">+ <div className="space-y-4 min-w-0">{/* No refresh control: the report loads with the tab and reloads itselfafter every run, sweep and discard, so a manual refresh only everre-fetched what was already on screen. */}<div className="flex items-center gap-2"><Gauge size={16} className="text-port-accent" />- <h2 className="text-sm font-medium text-gray-300">Measured Model Assessments</h2>+ <div>+ <h2 className="text-sm font-medium text-gray-300">Model Performance</h2>+ <p className="text-[11px] text-gray-500">Compare measured evidence first, then run a focused check when the result leaves a question.</p>+ </div>{loading && <BrailleSpinner />}</div>- <p className="text-xs text-gray-500">- The install catalog estimates fit from a model's file size. This measures it: one short- generation at each of several context lengths, recording throughput, time to first token, and how- far throughput falls off as context grows — across every local runtime PortOS can reach- (Ollama, LM Studio, llama.cpp, MTPLX, vLLM). Throughput is reported in tokens per second wherever- the runtime reports token counts. Measure a model under more than one launch tuning to- see which configuration this machine actually prefers, or start a sweep to measure everything at- once. Results stay on this machine — they describe this hardware, so they are never synced to a peer.- </p>+ <TabPills+ tabs={PERFORMANCE_VIEWS}+ activeTab={activeView}+ onChange={openView}+ ariaLabel="Model performance tasks"+ controlsIdPrefix="performance-task"+ mobileCompact+ />- <RuntimeRoster runtimes={report?.runtimes} />+ <details hidden={activeView !== 'results'} className="bg-port-card border border-port-border rounded-xl px-4 py-3">+ <summary className="cursor-pointer text-xs text-gray-400">How measurements and rankings work</summary>+ <p className="text-[11px] text-gray-500 pt-2">+ An explicit assessment runs one short generation at each sampled context size and records throughput, first-token timing, context stability, and resident memory. Tokens/s and chars/s remain separate units; missing evidence is never treated as zero. Results stay on this machine because they describe its current hardware and runtime state.+ </p>+ </details>- <OpenCodeAgentBenchmarkPanel- results={agentBenchmarkResults}- running={agentBenchmarkRunning || busy}- onRun={runAgentBenchmark}- />+ <div hidden={activeView !== 'results'}>+ <RuntimeRoster runtimes={report?.runtimes} />+ </div>- {/* The batch run. Kept above the ranking because it is what you come here- to press at the end of the day; the results below are what you read the- next morning. Disabled while a single-model run holds the provider —- two measurements at once would measure the contention. */}- {/* What each model CLAIMS, and what it has proved. Kept above the ranking- because "can it do the job" is the question you ask before "how fast is- it" — and because the matrix is what sends you into a run. */}- <ModelCapabilityTests- report={capabilityReport}- loading={capabilityLoading}- onReload={loadCapabilities}- disabled={busy}- />+ <div+ hidden={activeView !== 'agent-checks'}+ role="tabpanel"+ id="performance-task-agent-checks"+ aria-labelledby="tab-agent-checks"+ >+ <OpenCodeAgentBenchmarkPanel+ results={agentBenchmarkResults}+ running={agentBenchmarkRunning || busy}+ onRun={runAgentBenchmark}+ />+ </div>- <AssessmentSweepPanel- counts={report?.sweepScopes}- contextTokens={report?.defaultContextTokens || []}- disabled={localBusy}- onRunningChange={setSweepRunning}- onSweepFinished={() => load(intent)}- tuningRequest={tuningSweepRequest}- onTuningRequestClose={closeSweepTarget}- />+ <div+ hidden={activeView !== 'capabilities'}+ role="tabpanel"+ id="performance-task-capabilities"+ aria-labelledby="tab-capabilities"+ >+ <ModelCapabilityTests+ report={capabilityReport}+ loading={capabilityLoading}+ onReload={loadCapabilities}+ disabled={busy}+ />+ </div>+ <div+ hidden={activeView !== 'tuning'}+ role="tabpanel"+ id="performance-task-tuning"+ aria-labelledby="tab-tuning"+ className="space-y-4"+ >+ <AssessmentSweepPanel+ counts={report?.sweepScopes}+ contextTokens={report?.defaultContextTokens || []}+ disabled={localBusy}+ onRunningChange={setSweepRunning}+ onSweepFinished={() => load(intent)}+ tuningRequest={tuningSweepRequest}+ onTuningRequestClose={closeSweepTarget}+ />+ <ModelThroughputReport+ report={report?.throughputReport}+ runtimeLabelFor={runtimeLabelFor}+ />+ <TuningComparison+ rows={report?.tuningComparison}+ runtimeLabelFor={runtimeLabelFor}+ />+ </div>++ <div+ hidden={activeView !== 'results'}+ role="tabpanel"+ id="performance-task-results"+ aria-labelledby="tab-results"+ className="space-y-4"+ ><div className="flex items-center gap-2 flex-wrap"><label htmlFor="assessment-intent" className="text-xs text-gray-400">Rank for</label><select@@ -1040,14 +1226,17 @@ export function LocalModelAssessments() {</p>)}- {report.ranked.length > 0 ? (+ <div className="grid gap-4 xl:grid-cols-[minmax(0,1fr)_minmax(18rem,26rem)] items-start"><div className="space-y-2">- {report.ranked.map((entry) => (+ {report.ranked.length > 0 ? (+ <div className="space-y-2">+ {report.ranked.map((entry) => (<RankedRowkey={entryKey(entry)}entry={entry}runtimeLabel={backendLabel(report, entry.backend)}busy={busy}+ selected={selectedTuple && entryKey(entry) === entryKey(selectedTuple)}sweepVariants={gridFor(report, entry.backend).length}onRemeasure={openTarget}onDelete={removeAssessment}@@ -1055,22 +1244,22 @@ export function LocalModelAssessments() {capability={capabilityByModel.get(`${entry.backend}:${entry.modelId}`) || null}capabilityTests={capabilityReport?.tests}onOpenCapabilityTest={openCapabilityTest}+ search={location.search}/>- ))}- </div>- ) : (- <p className="text-xs text-gray-500">- Nothing measured yet. Pick a model below and run an assessment to see how it actually- performs here.- </p>- )}+ ))}+ </div>+ ) : (+ <p className="text-xs text-gray-500">+ Nothing measured yet. Pick a model below and run an assessment to see how it actually performs here.+ </p>+ )}{report.excluded?.length > 0 && (<div className="space-y-1"><h3 className="text-xs font-medium text-gray-400">Measured, but not recommended</h3>{report.excluded.map((entry) => (<div key={entryKey(entry)} className="flex items-center gap-2 text-xs flex-wrap">- <span className="text-gray-300 font-mono break-all">{entry.modelId}</span>+ <Link className="text-gray-300 font-mono break-all hover:text-port-accent" to={{ pathname: localModelAssessmentPath(entry), search: location.search }}>{entry.modelId}</Link>{/* Several rows can name the same model — one per tuning — sothe configuration is what tells them apart. */}<span className="px-1.5 py-0.5 text-[10px] rounded border border-port-border text-gray-500">@@ -1083,16 +1272,6 @@ export function LocalModelAssessments() {</div>)}- <ModelThroughputReport- report={report.throughputReport}- runtimeLabelFor={runtimeLabelFor}- />-- <TuningComparison- rows={report.tuningComparison}- runtimeLabelFor={runtimeLabelFor}- />-{report.unassessed?.length > 0 && (<div className="space-y-1"><h3 className="text-xs font-medium text-gray-400">@@ -1120,8 +1299,18 @@ export function LocalModelAssessments() {</div></div>)}+ </div>+ <SelectedEvidence+ entry={selectedEntry}+ report={report}+ loading={selectedEvidenceLoading}+ selected={Boolean(selectedKey)}+ search={location.search}+ />+ </div></>)}+ </div><AssessmentDrawertarget={pendingTarget}diff --git a/client/src/components/settings/LocalModelAssessments.test.jsx b/client/src/components/settings/LocalModelAssessments.test.jsxindex 64a396020e..52cc8c23e0 100644--- a/client/src/components/settings/LocalModelAssessments.test.jsx+++ b/client/src/components/settings/LocalModelAssessments.test.jsx@@ -37,6 +37,7 @@ import {} from '../../services/api';import toast from '../ui/Toast';import socket from '../../services/socket';+import { localModelAssessmentPath } from '../../lib/localModelAssessmentKey';import LocalModelAssessments from './LocalModelAssessments.jsx';// The measure drawer's target lives in the URL, so every render needs a router.@@ -152,7 +153,7 @@ describe('LocalModelAssessments', () => {taskTokensPerSecond: null, taskCharsPerSecond: null, toolCalls: null, elapsedMs: 4000,});const user = userEvent.setup();- await renderPanel();+ await renderPanel('/models/performance/agent-checks');await user.click(screen.getAllByRole('button', { name: 'Run task check' })[0]);await waitFor(() => expect(runOpenCodeAgentBenchmark).toHaveBeenCalledWith({backend: 'llama', modelId: 'dflash',@@ -249,7 +250,7 @@ describe('LocalModelAssessments', () => {const user = userEvent.setup();getLocalLlmAssessmentSweep.mockResolvedValue({ status: 'running', total: 2, completed: 1, current: null, results: [] });cancelLocalLlmAssessmentSweep.mockResolvedValue({ status: 'cancelled', total: 2, completed: 1, current: null, results: [] });- await renderPanel();+ await renderPanel('/models/performance/tuning');await user.click(await screen.findByRole('button', { name: /stop sweep/i }));// Once for the mount, once because the queue's evidence just changed.@@ -957,3 +958,83 @@ describe('LocalModelAssessments — routable tuning-sweep drawer', () => {expect(screen.queryByRole('dialog', { name: 'Measure this model' })).not.toBeInTheDocument();});});++describe('LocalModelAssessments — focused task views and selected evidence', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ idleSweep();+ getLocalLlmAssessments.mockResolvedValue(report({+ ranked: [rankedEntry({+ backend: 'llama',+ modelId: 'hf.co/example-org/model/Q4_K_M',+ tuningKey: '',+ tuningLabel: null,+ })],+ }));+ });++ it('keeps a legacy measurement drawer open while switching task views', async () => {+ const user = userEvent.setup();+ await renderPanel('/models/performance?measureBackend=llama&measureModel=hf.co%2Fexample-org%2Fmodel%2FQ4_K_M');++ await screen.findByRole('dialog', { name: 'Measure this model' });+ await user.click(screen.getByRole('tab', { name: 'Capabilities' }));++ expect(currentUrl()).toBe('/models/performance/capabilities?measureBackend=llama&measureModel=hf.co%2Fexample-org%2Fmodel%2FQ4_K_M');+ expect(screen.getByRole('dialog', { name: 'Measure this model' })).toBeInTheDocument();+ expect(screen.getByRole('tab', { name: 'Capabilities' })).toHaveAttribute('aria-selected', 'true');+ });++ it('keeps legacy drawer params when selecting evidence', async () => {+ const user = userEvent.setup();+ const entry = rankedEntry({+ backend: 'llama',+ modelId: 'hf.co/example-org/model/Q4_K_M',+ tuningKey: '',+ tuningLabel: null,+ });+ getLocalLlmAssessments.mockResolvedValue(report({ ranked: [entry] }));+ const search = '?measureBackend=llama&measureModel=hf.co%2Fexample-org%2Fmodel%2FQ4_K_M';+ await renderPanel(`/models/performance${search}`);++ await screen.findByRole('dialog', { name: 'Measure this model' });+ await user.click(screen.getByRole('link', { name: 'View evidence for hf.co/example-org/model/Q4_K_M' }));++ expect(currentUrl()).toBe(`${localModelAssessmentPath(entry)}${search}`);+ expect(screen.getByRole('dialog', { name: 'Measure this model' })).toBeInTheDocument();+ });++ it('replaces an unknown task view with Results', async () => {+ await renderPanel('/models/performance/not-a-view');++ await waitFor(() => expect(currentUrl()).toBe('/models/performance/results'));+ expect(screen.getByRole('tab', { name: 'Results' })).toHaveAttribute('aria-selected', 'true');+ });++ it('opens reversible selected evidence for a slash-containing model id', async () => {+ const entry = rankedEntry({+ backend: 'llama',+ modelId: 'hf.co/example-org/model/Q4_K_M',+ tuningKey: '',+ tuningLabel: null,+ });+ getLocalLlmAssessments.mockResolvedValue(report({ ranked: [entry] }));+ const path = localModelAssessmentPath(entry);++ await renderPanel(path);++ expect(await screen.findByRole('heading', { name: 'Selected evidence' })).toBeInTheDocument();+ expect(screen.getAllByText('hf.co/example-org/model/Q4_K_M').length).toBeGreaterThanOrEqual(2);+ expect(screen.getAllByText('backend defaults').length).toBeGreaterThanOrEqual(2);+ expect(screen.queryByText('Selected evidence unavailable')).not.toBeInTheDocument();+ });++ it('offers recovery without guessing when selected evidence is invalid', async () => {+ await renderPanel('/models/performance/results/v1-e30');++ expect(await screen.findByText('Selected evidence unavailable')).toBeInTheDocument();+ const user = userEvent.setup();+ await user.click(screen.getByRole('link', { name: 'Return to Results' }));+ expect(currentUrl()).toBe('/models/performance/results');+ });+});diff --git a/client/src/components/settings/ModelCapabilityTests.jsx b/client/src/components/settings/ModelCapabilityTests.jsxindex 521e1c1c20..f6901fa083 100644--- a/client/src/components/settings/ModelCapabilityTests.jsx+++ b/client/src/components/settings/ModelCapabilityTests.jsx@@ -871,12 +871,14 @@ export default function ModelCapabilityTests({ report, loading, onReload, disabl</div><p className="text-[11px] text-gray-500 leading-relaxed">- Speed says how fast a model runs here; it cannot say whether the model can do the job. Each test below- runs only where the model claims the matching capability — a model with no{' '}- <span className="text-gray-400">vision</span> badge shows <em>not applicable</em> on the image test,- never a failure. Nothing here calls a model until you press a button that names it, and every run keeps- the full output.+ Review task-specific evidence by model. Run a named check only when a saved result is missing or needs refreshing; each run keeps its full output.</p>+ <details className="border border-port-border/70 rounded px-2 py-1.5">+ <summary className="cursor-pointer text-[11px] text-gray-400">How capability evidence is scoped</summary>+ <p className="text-[11px] text-gray-500 leading-snug pt-1.5">+ A test runs only where the model claims the matching capability. A model with no <span className="text-gray-400">vision</span> badge shows <em>not applicable</em> on the image test, never a failure. Navigation and loading this view never call a provider.+ </p>+ </details>{tests.length > 0 && (<div className="grid gap-2 sm:grid-cols-3">@@ -890,7 +892,10 @@ export default function ModelCapabilityTests({ report, loading, onReload, disabl<span className="text-xs font-medium text-gray-200">{t.label}</span><span className="text-[10px] text-gray-500">{t.capabilities.join(' · ')}</span></div>- <p className="text-[11px] text-gray-500 leading-snug">{t.blurb}</p>+ <details className="bg-port-card border border-port-border/70 rounded px-2 py-1">+ <summary className="cursor-pointer text-[10px] text-gray-400">What this test checks</summary>+ <p className="text-[11px] text-gray-500 leading-snug pt-1">{t.blurb}</p>+ </details></div>);})}diff --git a/client/src/lib/README.md b/client/src/lib/README.mdindex 655ef423d2..1a9ff5a91f 100644--- a/client/src/lib/README.md+++ b/client/src/lib/README.md@@ -161,6 +161,7 @@ grep -i "what you want to do" client/src/lib/README.md| `kanbanColumns.js` | `bucketTickets` / `ticketInColumn` / `columnConfig` / `FALLBACK_COLUMNS` — pure column logic for the Jira Kanban board (`components/KanbanBoard.jsx`). Buckets tickets into resolved workflow columns (by status name, or statusCategory for the fallback board), assigns each column a stable unique `id` (Jira `name` is not unique — same-named columns map to different statuses), appends an orphan column for any unmatched status, and precomputes per-column Tailwind color config (Blocked→red, Review/QA→purple, else by category). || `localLlmBackends.js` | `LOCAL_LLM_BACKENDS` (id/label/lucide icon for Ollama + LM Studio) and `localLlmBackendLabel(id)`. The two backends PortOS keeps a model catalog for, shared by the Runtimes view's backend cards and the Model Library's backend picker so a third backend is added in one place. Exported under qualified names because the barrel is flat and `BACKENDS`/`labelFor` are too generic to claim there. || `localLlmTargetKey.js` | `localLlmTargetKey({ backend, modelId })` — stable string key for a local-LLM compare target. Shared by the LocalLlmTab checkbox grid and the LocalLlmPlayground compare URL so a delimiter change can't desync the round-trip. |+| `localModelAssessmentKey.js` | `encodeLocalModelAssessmentKey`, `decodeLocalModelAssessmentKey`, and `localModelAssessmentPath` — reversible base64url identity for a measured backend/model/tuning tuple, including the explicit null backend-default tuning. Invalid keys return `null` so selected-evidence routes can recover without guessing. || `letteringDensity.js` | Re-export of `server/lib/editorial/letteringDensity.js` — `analyzeComicLettering` / `panelLetteringMetrics` / `overflowSeverity` / `sanitizeLetteringThresholds` / `DEFAULT_LETTERING_THRESHOLDS`. Powers the comic-script stage's INLINE per-page warnings (#1313) from the same code the authoritative `comic.lettering-density` check runs. || `loomLayout.js` | FableLoom canvas layout — `layoutLoomGraph(episode, { viewportWidth, orientation })` (BFS + barycenter-ordered positions, persisted `pos` overrides on left-to-right only, orthogonal port-fanned edges, canvas extents), `pickLoomOrientation` (stacks top-to-bottom under `LOOM_STACK_WIDTH` when orientation is not pinned), `loomGraphLayers`, `routeLoomEdges` (forward edges in packed gap lanes; backward/skip edges around the card band), `placeEdgeLabels` (de-collides intent labels), `loomEdgePath(from, to, { laneY, self, orientation })`, `LOOM_NODE_W`/`LOOM_NODE_H`/`LOOM_EDGE_LABEL_MAX`/`LOOM_ORIENTATION`/`LOOM_STACK_WIDTH`. A view-layer layering (shows unreachable nodes in trailing columns), deliberately NOT a mirror of the server's analysis-oriented `computeGraphLayers`. Pure/DOM-free. || `loopbackHost.js` | `isLoopbackHost(host)` / `isLoopbackOrigin()` / `describeMicAvailability()` — Secure Context / loopback-origin heuristics. Use these in any new mic, clipboard, or `getUserMedia`-gated surface; matches the full `127.0.0.0/8` range, IPv6 `::1`, and the browser-bracketed `[::1]` form. |diff --git a/client/src/lib/index.js b/client/src/lib/index.jsindex 3cc6ef047f..012297bf7c 100644--- a/client/src/lib/index.js+++ b/client/src/lib/index.js@@ -128,6 +128,7 @@ export * from './joinInfluenceList.js';export * from './kanbanColumns.js';export * from './localLlmBackends.js';export * from './localLlmTargetKey.js';+export * from './localModelAssessmentKey.js';export * from './loomLayout.js';export * from './loopbackHost.js';export * from './manuscriptAnchors.js';diff --git a/client/src/lib/localModelAssessmentKey.js b/client/src/lib/localModelAssessmentKey.jsnew file mode 100644index 0000000000..4aa96c7869--- /dev/null+++ b/client/src/lib/localModelAssessmentKey.js@@ -0,0 +1,64 @@+const KEY_VERSION = 1;++const isValidTuple = (value) => (+ value+ && typeof value === 'object'+ && !Array.isArray(value)+ && value.version === KEY_VERSION+ && typeof value.backend === 'string'+ && value.backend.length > 0+ && typeof value.modelId === 'string'+ && value.modelId.length > 0+ && (value.tuningKey === null || typeof value.tuningKey === 'string')+);++const toBase64Url = (value) => {+ const bytes = new TextEncoder().encode(value);+ let binary = '';+ for (const byte of bytes) binary += String.fromCharCode(byte);+ return btoa(binary).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/u, '');+};++const fromBase64Url = (value) => {+ const base64 = value.replace(/-/g, '+').replace(/_/g, '/');+ const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, '=');+ const binary = atob(padded);+ const bytes = Uint8Array.from(binary, (character) => character.charCodeAt(0));+ return new TextDecoder().decode(bytes);+};++/**+ * Encode the identity of one persisted assessment for a path segment.+ *+ * Base64url keeps `/`, `:`, spaces, unicode, and tuning punctuation out of the+ * route grammar. `null` is intentional: it is the stable identity of a run+ * taken with the backend defaults, not the absence of a tuning choice.+ */+export function encodeLocalModelAssessmentKey({ backend, modelId, tuningKey = null } = {}) {+ if (typeof backend !== 'string' || !backend || typeof modelId !== 'string' || !modelId) return null;+ const tuple = { version: KEY_VERSION, backend, modelId, tuningKey: tuningKey || null };+ return `v${KEY_VERSION}-${toBase64Url(JSON.stringify(tuple))}`;+}++/**+ * Decode and validate a selected-assessment path segment.+ *+ * Invalid, stale, or tampered keys return null so the page can offer recovery+ * without guessing at a record or starting a provider run.+ */+export function decodeLocalModelAssessmentKey(key) {+ if (typeof key !== 'string' || !key.startsWith(`v${KEY_VERSION}-`)) return null;+ try {+ const value = JSON.parse(fromBase64Url(key.slice(`v${KEY_VERSION}-`.length)));+ return isValidTuple(value)+ ? { backend: value.backend, modelId: value.modelId, tuningKey: value.tuningKey }+ : null;+ } catch {+ return null;+ }+}++export function localModelAssessmentPath(entry) {+ const key = encodeLocalModelAssessmentKey(entry);+ return key ? `/models/performance/results/${key}` : '/models/performance/results';+}diff --git a/client/src/lib/localModelAssessmentKey.test.js b/client/src/lib/localModelAssessmentKey.test.jsnew file mode 100644index 0000000000..c342b72b23--- /dev/null+++ b/client/src/lib/localModelAssessmentKey.test.js@@ -0,0 +1,42 @@+import { describe, expect, it } from 'vitest';+import {+ decodeLocalModelAssessmentKey,+ encodeLocalModelAssessmentKey,+ localModelAssessmentPath,+} from './localModelAssessmentKey';++describe('local model assessment selection keys', () => {+ it('round-trips slash-containing model ids with backend-default tuning', () => {+ const entry = {+ backend: 'llama',+ modelId: 'hf.co/example-org/model/Q4_K_M',+ tuningKey: '',+ };+ const key = encodeLocalModelAssessmentKey(entry);++ expect(key).toMatch(/^v1-[A-Za-z0-9_-]+$/);+ expect(decodeLocalModelAssessmentKey(key)).toEqual({+ backend: 'llama',+ modelId: 'hf.co/example-org/model/Q4_K_M',+ tuningKey: null,+ });+ expect(localModelAssessmentPath(entry)).toBe(`/models/performance/results/${key}`);+ });++ it('keeps distinct launch tunings distinct', () => {+ const base = { backend: 'llama', modelId: 'example/model:7b' };+ const defaultKey = encodeLocalModelAssessmentKey(base);+ const tunedKey = encodeLocalModelAssessmentKey({ ...base, tuningKey: 'ubatchSize=512&flashAttn=true' });++ expect(tunedKey).not.toBe(defaultKey);+ expect(decodeLocalModelAssessmentKey(tunedKey)).toEqual({+ backend: 'llama',+ modelId: 'example/model:7b',+ tuningKey: 'ubatchSize=512&flashAttn=true',+ });+ });++ it.each([undefined, '', 'v2-invalid', 'v1-not-base64', 'v1-e30'])('rejects an invalid key: %s', (key) => {+ expect(decodeLocalModelAssessmentKey(key)).toBeNull();+ });+});diff --git a/client/src/pages/Models.jsx b/client/src/pages/Models.jsxindex e8edc51d19..ce1f97d144 100644--- a/client/src/pages/Models.jsx+++ b/client/src/pages/Models.jsx@@ -87,7 +87,7 @@ export default function Models({ fixedTab, fixedRecordId } = {}) {const params = useParams();const tab = fixedTab || params.tab;const recordId = fixedRecordId || params.recordId;- const { taskView } = params;+ const taskView = params.taskView || params.view || (fixedTab === 'performance' && params.assessmentKey ? 'results' : undefined);if (tab === 'llms' && recordId === 'jev') return <Navigate to={`/models/decision-classifiers/jev${taskView ? '/' + taskView : ''}`} replace />;// An unknown slug lands on LLMs rather than rendering a blank page, matching// the section's default destination in App and the primary navigation.@@ -117,7 +117,9 @@ export default function Models({ fixedTab, fixedRecordId } = {}) {{/* Local boundary rather than the App-level one: a lazy tab must not blankthe section header and tab bar while its chunk loads. */}<Suspense fallback={<PageSkeleton header="none" label="Loading models section" cards={3} sidebar={false} />}>- {DetailContent ? <DetailContent recordId={recordId} /> : <TabContent view={recordId} />}+ {DetailContent+ ? <DetailContent recordId={recordId} />+ : <TabContent view={recordId} taskView={taskView} assessmentKey={params.assessmentKey} />}</Suspense></div></div>diff --git a/client/src/pages/Models.test.jsx b/client/src/pages/Models.test.jsxindex f9cc8f261b..ac02d16fe6 100644--- a/client/src/pages/Models.test.jsx+++ b/client/src/pages/Models.test.jsx@@ -13,7 +13,17 @@ import { MemoryRouter, Route, Routes } from 'react-router';import { ModelsDesktopNavigator, TABS } from '../components/models/ModelsTabsHeader';import SidebarContext from '../components/SidebarContext';-vi.mock('../components/settings/LocalModelAssessments.jsx', () => ({ default: () => <div>assessments panel</div> }));+vi.mock('../components/settings/LocalModelAssessments.jsx', () => ({+ default: ({ taskView, assessmentKey }) => (+ <div+ data-testid="assessments-panel"+ data-task-view={taskView || 'none'}+ data-assessment-key={assessmentKey || 'none'}+ >+ assessments panel+ </div>+ ),+}));vi.mock('../components/settings/LocalLlmTab', () => ({LocalLlmTab: ({ view }) => <div data-testid="llms-view" data-view={view || 'none'}>llms panel</div>,}));@@ -62,6 +72,8 @@ const ownTabs = TABS.filter((t) => !EXTERNAL_TAB_IDS.includes(t.id));const renderAt = (path) => render(<MemoryRouter initialEntries={[path]}><Routes>+ <Route path="/models/performance/results/:assessmentKey" element={<Models fixedTab="performance" />} />+ <Route path="/models/performance/:view" element={<Models fixedTab="performance" />} /><Route path="/models/:tab" element={<Models />} /><Route path="/models/:tab/:recordId" element={<Models />} /><Route path="/models/decision-classifiers/jev/:taskView" element={<Models fixedTab="decision-classifiers" fixedRecordId="jev" />} />@@ -98,6 +110,18 @@ describe('Models', () => {expect(await screen.findByText('llms panel')).toBeInTheDocument();});+ it('passes an explicit Performance task view through the section shell', async () => {+ renderAt('/models/performance/capabilities');+ expect(await screen.findByTestId('assessments-panel')).toHaveAttribute('data-task-view', 'capabilities');+ });++ it('passes a selected assessment key through the results route', async () => {+ renderAt('/models/performance/results/v1-example');+ const panel = await screen.findByTestId('assessments-panel');+ expect(panel).toHaveAttribute('data-task-view', 'results');+ expect(panel).toHaveAttribute('data-assessment-key', 'v1-example');+ });+// The slug comes straight off the URL, so a plain `TAB_CONTENT[tab]` lookup// resolves an Object.prototype member as a "valid" tab and hands it to React as// a component. These must take the unknown-slug path like any other typo.diff --git a/server/lib/navManifest.js b/server/lib/navManifest.jsindex b67c507cde..f2dabecc02 100644--- a/server/lib/navManifest.js+++ b/server/lib/navManifest.js@@ -343,6 +343,10 @@ const RAW_NAV_COMMANDS = [{ id: 'nav.media.training', path: '/models/training', label: 'Training', section: 'Models', tabId: 'training', navGroup: 'Library', previousPaths: ['/media/training', '/media/training/:datasetId'], aliases: ['training', 'lora-training', 'train-lora', 'datasets', 'character-lora'], keywords: ['fine-tune', 'dataset', 'caption', 'dreambooth', 'character consistency', 'train', 'flux lora'] },{ id: 'nav.media.models', path: '/models/media', label: 'Media', section: 'Models', tabId: 'media', navGroup: 'Library', previousPaths: ['/media/models', '/media-models'], aliases: ['media-models', 'image-models', 'video-models', 'huggingface'], keywords: ['hf cache', 'model storage', 'disk', 'add model', 'install model', 'custom model'] },{ id: 'nav.models.performance', path: '/models/performance', label: 'Performance', section: 'Models', tabId: 'performance', navGroup: 'Evaluate', aliases: ['model-performance', 'performance', 'assessments', 'model-assessments', 'benchmark-models', 'tuning'], keywords: ['measure', 'assessment', 'benchmark', 'throughput', 'chars per second', 'ttft', 'context', 'tuning', 'llama.cpp', 'mtplx', 'vllm', 'which model', 'fastest model'] },+ { id: 'nav.models.performance.results', path: '/models/performance/results', label: 'Performance Results', section: 'Models', aliases: ['performance-results', 'assessment-results'], keywords: ['measured results', 'model evidence', 'selected evidence', 'rankings'] },+ { id: 'nav.models.performance.capabilities', path: '/models/performance/capabilities', label: 'Performance Capabilities', section: 'Models', aliases: ['performance-capabilities', 'model-capability-tests'], keywords: ['capability tests', 'model abilities', 'saved capability results'] },+ { id: 'nav.models.performance.agent-checks', path: '/models/performance/agent-checks', label: 'Performance Agent Checks', section: 'Models', aliases: ['performance-agent-checks', 'model-agent-checks'], keywords: ['opencode', 'tui', 'agent task', 'pty'] },+ { id: 'nav.models.performance.tuning', path: '/models/performance/tuning', label: 'Performance Tuning', section: 'Models', aliases: ['performance-tuning', 'assessment-tuning'], keywords: ['tuning comparison', 'sweep', 'launch knobs', 'tokens per second'] },// Absorbed the Dev Tools 'Model Resources' page (#4728), so its aliases and// keywords live here — 'model resources' and 'downloaded models' must keep// resolving after the fold.