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
address review: five correctness fixes in local-model assessments (#4539)
[._.]/ Adam Eivyf2cff4d2330d
diff --git a/client/src/components/settings/LocalModelAssessments.jsx b/client/src/components/settings/LocalModelAssessments.jsxindex 48b07060d7..02faea1a32 100644--- a/client/src/components/settings/LocalModelAssessments.jsx+++ b/client/src/components/settings/LocalModelAssessments.jsx@@ -17,7 +17,7 @@* choice. Same for an axis that wasn't measured: it is omitted, not zeroed.*/-import { useCallback, useEffect, useState } from 'react';+import { useCallback, useEffect, useRef, useState } from 'react';import { Gauge, RefreshCw, Trash2, Play, AlertTriangle } from 'lucide-react';import Modal from '../ui/Modal';import BrailleSpinner from '../BrailleSpinner';@@ -85,12 +85,14 @@ function AssessmentConsentModal({ target, contextTokens, onCancel, onConfirm, ruloads the model into memory. The result stays on this machine and is never synced to a peer.</p><div className="flex gap-3 pt-1">+ {/* Stays enabled while the run is in flight — it aborts the request+ rather than merely closing the modal, so the user is never stuck+ watching a multi-minute job they no longer want. */}<buttononClick={onCancel}- disabled={running}- className="flex-1 px-4 py-2 bg-port-card border border-port-border hover:border-port-accent text-white text-sm font-medium rounded-lg transition-colors disabled:opacity-50"+ className="flex-1 px-4 py-2 bg-port-card border border-port-border hover:border-port-accent text-white text-sm font-medium rounded-lg transition-colors">- Cancel+ {running ? 'Stop' : 'Cancel'}</button><buttononClick={onConfirm}@@ -219,15 +221,30 @@ export function LocalModelAssessments() {useEffect(() => { load(intent); }, [load, intent]);+ // A run occupies the local provider for minutes. Without an abort, leaving+ // the page (or changing your mind) leaves it running with nobody listening —+ // the server drops the assessment on an aborted signal rather than recording a+ // cancel as a `does-not-fit`.+ const runControllerRef = useRef(null);+ useEffect(() => () => runControllerRef.current?.abort(), []);+const [runAssessment, running] = useAsyncAction(async (target) => {+ const controller = new AbortController();+ runControllerRef.current = controller;+ // An aborted fetch rejects with the generic "Server unreachable" message.+ // That is OUR abort, not a failure, so swallow it here rather than letting+ // useAsyncAction toast an error the user just asked for.const result = await runLocalLlmAssessment({ backend: target.backend, modelId: target.modelId },- { silent: true },- );- // Reactive update rather than a refetch of the whole report — except the- // ranking itself is server-derived, so pull the fresh ranking once the run- // lands. Keeping the local swap would mean re-implementing the scoring here.- await load(intent);+ { silent: true, signal: controller.signal },+ ).catch((err) => {+ if (controller.signal.aborted) return { cancelled: true };+ throw err;+ }).finally(() => { runControllerRef.current = null; });+ // The ranking is server-derived, so pull the fresh report once a run lands+ // rather than re-implementing the scoring here. A cancelled run recorded+ // nothing, so there is nothing new to fetch.+ if (!result?.cancelled) await load(intent);return result;}, { errorMessage: 'Assessment failed' });@@ -235,7 +252,10 @@ export function LocalModelAssessments() {const target = pendingTarget;const result = await runAssessment(target);setPendingTarget(null);- if (result) {+// An aborted run recorded nothing on either side, so there is no verdict+ // to report — marked `cancelled` by the abort catch above, or by the server+ // when it saw the signal drop mid-run.+ if (result && !result.cancelled) {const verdict = VERDICT_META[result.verdict]?.label || result.verdict;toast.success(`${target.modelId}: ${verdict}`);}@@ -252,6 +272,11 @@ export function LocalModelAssessments() {return true;}, { errorMessage: 'Could not discard that measurement' });+ const cancelRun = () => {+ runControllerRef.current?.abort();+ setPendingTarget(null);+ };+const busy = running || removing;const activeIntent = INTENTS.find((i) => i.id === intent);@@ -378,7 +403,7 @@ export function LocalModelAssessments() {target={pendingTarget}contextTokens={report?.defaultContextTokens || []}running={running}- onCancel={() => (running ? null : setPendingTarget(null))}+ onCancel={cancelRun}onConfirm={confirmRun}/></div>diff --git a/client/src/components/settings/LocalModelAssessments.test.jsx b/client/src/components/settings/LocalModelAssessments.test.jsxindex 57b87ef333..9def1063ef 100644--- a/client/src/components/settings/LocalModelAssessments.test.jsx+++ b/client/src/components/settings/LocalModelAssessments.test.jsx@@ -11,6 +11,7 @@ vi.mock('../../services/api', () => ({vi.mock('../ui/Toast', () => ({ default: { success: vi.fn(), error: vi.fn() } }));import { getLocalLlmAssessments, runLocalLlmAssessment, deleteLocalLlmAssessment } from '../../services/api';+import toast from '../ui/Toast';import LocalModelAssessments from './LocalModelAssessments.jsx';const report = (overrides = {}) => ({@@ -103,7 +104,7 @@ describe('LocalModelAssessments', () => {await user.click(screen.getByRole('button', { name: /run assessment/i }));await waitFor(() => expect(runLocalLlmAssessment).toHaveBeenCalledWith({ backend: 'ollama', modelId: 'example-model:7b' },- { silent: true },+ expect.objectContaining({ silent: true, signal: expect.any(AbortSignal) }),));});@@ -151,6 +152,53 @@ describe('LocalModelAssessments', () => {expect(deleteLocalLlmAssessment).toHaveBeenCalledWith('ollama', 'example-model:7b', { silent: true });});+ it('aborts an in-flight run when the user stops it, without toasting a failure', async () => {+ const user = userEvent.setup();+ getLocalLlmAssessments.mockResolvedValue(report({+ unassessed: [{ backend: 'ollama', modelId: 'example-model:7b', params: '7B' }],+ }));+ // A run occupies the local provider for minutes; the modal's only exit must+ // stay live and actually abort, not merely close over a job still running.+ let capturedSignal;+ runLocalLlmAssessment.mockImplementation((_payload, options) => {+ capturedSignal = options.signal;+ return new Promise((_resolve, reject) => {+ options.signal.addEventListener('abort', () => reject(new Error('Server unreachable')));+ });+ });+ render(<LocalModelAssessments />);++ await user.click(await screen.findByRole('button', { name: /measure/i }));+ await user.click(screen.getByRole('button', { name: /run assessment/i }));+ await waitFor(() => expect(screen.getByRole('button', { name: /stop/i })).toBeInTheDocument());++ await user.click(screen.getByRole('button', { name: /stop/i }));+ await waitFor(() => expect(capturedSignal.aborted).toBe(true));+ // The abort is what the user asked for — it must not surface as an error.+ expect(toast.error).not.toHaveBeenCalled();+ expect(toast.success).not.toHaveBeenCalled();+ });++ it('aborts a run in flight when the panel unmounts', async () => {+ const user = userEvent.setup();+ getLocalLlmAssessments.mockResolvedValue(report({+ unassessed: [{ backend: 'ollama', modelId: 'example-model:7b', params: '7B' }],+ }));+ let capturedSignal;+ runLocalLlmAssessment.mockImplementation((_payload, options) => {+ capturedSignal = options.signal;+ return new Promise(() => {});+ });+ const { unmount } = render(<LocalModelAssessments />);++ await user.click(await screen.findByRole('button', { name: /measure/i }));+ await user.click(screen.getByRole('button', { name: /run assessment/i }));+ await waitFor(() => expect(capturedSignal).toBeDefined());++ unmount();+ expect(capturedSignal.aborted).toBe(true);+ });+it('explains a model that ran but was excluded from the ranking', async () => {getLocalLlmAssessments.mockResolvedValue(report({excluded: [{ backend: 'ollama', modelId: 'example-model:70b', verdict: 'does-not-fit', reason: 'out of memory' }],diff --git a/server/lib/localModelAssessment.js b/server/lib/localModelAssessment.jsindex 3a4be9e15b..f34d25368a 100644--- a/server/lib/localModelAssessment.js+++ b/server/lib/localModelAssessment.js@@ -125,18 +125,31 @@ function meanOf(samples, field) {/*** Collapse the per-context samples into one performance summary.*- * `contextDegradation` is the ratio of the slowest measured throughput to the- * fastest (0..1]; 1 means throughput held flat across every context length,- * 0.25 means the longest context ran at a quarter of the shortest. `null` when- * fewer than two context lengths produced throughput — a single sample cannot- * describe a trend, and reporting `1` there would fake perfect scaling.+ * `contextDegradation` is the ratio of the throughput at the LARGEST working+ * context to the peak throughput across all contexts (0..1]; 1 means the longest+ * context ran as fast as the fastest one did, 0.25 means it ran at a quarter of+ * that.+ *+ * It is deliberately anchored to the longest context rather than to the slowest+ * sample. Results are not always monotonic — a mid-range context can dip below+ * both its neighbours from an unrelated hiccup — and a min-based ratio would+ * both contradict what this number is reported as ("held X% of peak throughput+ * at its longest context") and penalize the ranking for a one-off intermediate+ * outlier instead of for the long-context behavior the axis is about.+ *+ * `null` when fewer than two context lengths produced throughput: a single+ * sample cannot describe a trend, and reporting `1` there would fake perfect+ * scaling.** @param {Array<object>} samples*/export function summarizePerformance(samples) {- const throughputs = okSamples(samples).map((s) => s.charsPerSecond).filter((v) => isMeasured(v) && v > 0);- const fastest = throughputs.length ? Math.max(...throughputs) : null;- const slowest = throughputs.length ? Math.min(...throughputs) : null;+ const measured = okSamples(samples)+ .filter((s) => isMeasured(s.charsPerSecond) && s.charsPerSecond > 0 && isMeasured(s.contextTokens));+ const fastest = measured.length ? Math.max(...measured.map((s) => s.charsPerSecond)) : null;+ const atLongest = measured.length+ ? measured.reduce((longest, s) => (s.contextTokens > longest.contextTokens ? s : longest)).charsPerSecond+ : null;return {samplesRun: Array.isArray(samples) ? samples.length : 0,samplesOk: okSamples(samples).length,@@ -144,8 +157,10 @@ export function summarizePerformance(samples) {meanTtftMs: meanOf(samples, 'ttftMs'),peakCharsPerSecond: fastest,maxWorkingContextTokens: maxWorkingContextTokens(samples),+ // Clamped: the longest context can measure marginally ABOVE the peak of the+ // others only through noise, and a >1 "degradation" is meaningless.contextDegradation:- throughputs.length >= 2 && fastest > 0 ? Number((slowest / fastest).toFixed(3)) : null,+ measured.length >= 2 && fastest > 0 ? Number(Math.min(1, atLongest / fastest).toFixed(3)) : null,};}diff --git a/server/lib/localModelAssessment.test.js b/server/lib/localModelAssessment.test.jsindex 421eec3446..cf80dcea47 100644--- a/server/lib/localModelAssessment.test.js+++ b/server/lib/localModelAssessment.test.js@@ -95,6 +95,18 @@ describe('summarizePerformance', () => {expect(perf.contextDegradation).toBe(0.5);});+ it('measures degradation at the LONGEST context, not at the slowest sample', () => {+ // Results are not monotonic in practice. A mid-range dip must not be+ // reported as the long-context behavior — the number is rendered as+ // "held X% of peak at its longest context", so it has to mean that.+ const perf = summarizePerformance([okSample(512, 100), okSample(4096, 50), okSample(16384, 80)]);+ expect(perf.contextDegradation).toBe(0.8);+ });++ it('clamps degradation at 1 when the longest context measured above the others', () => {+ expect(summarizePerformance([okSample(512, 80), okSample(4096, 100)]).contextDegradation).toBe(1);+ });+it('does not fake a degradation trend from a single sample', () => {// Reporting 1 here would claim "throughput held flat across contexts" on// the strength of one data point.diff --git a/server/services/localModelAssessments.js b/server/services/localModelAssessments.jsindex 174e700bfd..bb2f6602ec 100644--- a/server/services/localModelAssessments.js+++ b/server/services/localModelAssessments.js@@ -59,7 +59,11 @@ import {} from '../lib/localModelAssessment.js';import { runLocalLlmTest } from './localLlmPlayground.js';import { listModels } from './localLlm.js';-import { getLoadedModels as getLoadedOllamaModels } from './ollamaManager.js';+import {+ getLoadedModels as getLoadedOllamaModels,+ getLastInstalledModelsError as getOllamaListError,+} from './ollamaManager.js';+import { getLastListError as getLmStudioListError } from './lmStudioManager.js';const ASSESSMENTS_DIR = join(PATHS.data, 'local-llm');const ASSESSMENTS_FILE = join(ASSESSMENTS_DIR, 'assessments.json');@@ -311,6 +315,18 @@ export async function runAssessment({ backend, modelId, contextTokens = DEFAULT_performance: summarizePerformance(samples),};+ // A cancelled run is NOT evidence. `runLocalLlmTest` converts a client+ // disconnect into the same "Timed out after Nms" result a genuine resource+ // failure produces, so persisting here would record a user closing the tab as+ // `does-not-fit` — or, if they cancelled before the first sample landed, as an+ // `unknown` that silently removes the model from the "not yet measured" list.+ // Return the partial record so the caller can show what was gathered, but+ // leave the store untouched.+ if (signal?.aborted) {+ console.log(`📏 Local LLM: ${backend}/${modelId} assessment cancelled — not recorded`);+ return { ...assessment, cancelled: true };+ }+console.log(`📏 Local LLM: ${backend}/${modelId} → ${verdict} (${assessment.performance.samplesOk}/${samples.length} samples ok)`);return saveAssessment(assessment);}@@ -328,20 +344,42 @@ export async function getAssessmentReport({ intent = 'balanced' } = {}) {const { assessments, readError } = await loadStore();const resolvedIntent = ASSESSMENT_INTENTS.includes(intent) ? intent : 'balanced';- const installedByBackend = Object.fromEntries(- await Promise.all(- ['ollama', 'lmstudio'].map(async (backend) => [backend, await listModels(backend).catch(() => null)])- )+ // Both managers cache an EMPTY list on a failed read rather than throwing, so+ // `[]` alone cannot distinguish "this backend has no models" from "the list+ // could not be read" — and presenting the second as the first would silently+ // hide every assessable model plus the reason. Each manager's own list-error+ // getter is the authoritative signal; a `.catch` here is only the backstop.+ const listed = Object.fromEntries(await Promise.all(+ ['ollama', 'lmstudio'].map(async (backend) => {+ const models = await listModels(backend).catch((err) => ({ error: err?.message || 'model list failed' }));+ if (!Array.isArray(models)) return [backend, { models: null, error: models.error }];+ const error = backend === 'ollama' ? getOllamaListError() : getLmStudioListError();+ return [backend, { models, error: error || null }];+ })+ ));++ const listErrors = Object.entries(listed).filter(([, r]) => r.error).map(([backend]) => backend);+ const installedKeys = new Set(+ Object.entries(listed).flatMap(([backend, r]) => (r.models || []).map((m) => assessmentKey(backend, m?.id))));- const { ranked, excluded } = rankByIntent(assessments, resolvedIntent);+ // A model the user has since deleted must not keep showing up as a+ // recommendation — it cannot run. But only drop it when the backend's list is+ // TRUSTWORTHY: an unreadable list would otherwise wipe every recommendation+ // for that backend, which is the same "failed read read as empty" mistake.+ const trusted = new Set(Object.entries(listed).filter(([, r]) => Array.isArray(r.models) && !r.error).map(([backend]) => backend));+ const isStillInstalled = (a) =>+ !trusted.has(a?.backend) || installedKeys.has(assessmentKey(a?.backend, a?.modelId));+ const stillInstalled = assessments.filter(isStillInstalled);+ const uninstalled = assessments+ .filter((a) => !isStillInstalled(a))+ .map((a) => ({ backend: a?.backend || null, modelId: a?.modelId || null }));++ const { ranked, excluded } = rankByIntent(stillInstalled, resolvedIntent);const assessedKeys = new Set(assessments.map((a) => assessmentKey(a?.backend, a?.modelId)));const unassessed = [];- for (const [backend, models] of Object.entries(installedByBackend)) {- // `null` = the backend's model list could not be read. Reporting it as `[]`- // would claim "this backend has nothing to assess", which is a different- // (and wrong) statement — skip it instead.+ for (const [backend, { models }] of Object.entries(listed)) {if (!Array.isArray(models)) continue;for (const model of models) {if (model?.id && !assessedKeys.has(assessmentKey(backend, model.id))) {@@ -356,10 +394,12 @@ export async function getAssessmentReport({ intent = 'balanced' } = {}) {defaultContextTokens: DEFAULT_CONTEXT_TOKENS,assessments,unassessed,- // Which backends could not be listed at all — distinct from "listed, empty".- listErrors: Object.entries(installedByBackend)- .filter(([, models]) => !Array.isArray(models))- .map(([backend]) => backend),+ // Backends whose model list could not be trusted — distinct from "listed,+ // and legitimately empty".+ listErrors,+ // Measurements for models that are no longer installed. Kept on disk (a+ // re-install should not cost another run) but excluded from the ranking.+ uninstalled,readError,ranked,excluded,diff --git a/server/services/localModelAssessments.test.js b/server/services/localModelAssessments.test.jsindex 5152bac63f..c17f36f4de 100644--- a/server/services/localModelAssessments.test.js+++ b/server/services/localModelAssessments.test.js@@ -23,7 +23,14 @@ const listModels = vi.fn();vi.mock('./localLlm.js', () => ({ listModels: (...args) => listModels(...args) }));const getLoadedModels = vi.fn();-vi.mock('./ollamaManager.js', () => ({ getLoadedModels: (...args) => getLoadedModels(...args) }));+const getOllamaListError = vi.fn();+vi.mock('./ollamaManager.js', () => ({+ getLoadedModels: (...args) => getLoadedModels(...args),+ getLastInstalledModelsError: () => getOllamaListError(),+}));++const getLmStudioListError = vi.fn();+vi.mock('./lmStudioManager.js', () => ({ getLastListError: () => getLmStudioListError() }));// A fixed, generous memory budget so the memory axis is deterministic.vi.mock('../lib/localMemory.js', () => ({ getAvailableMemoryGb: async () => 64 }));@@ -44,6 +51,8 @@ beforeEach(() => {runLocalLlmTest.mockReset();listModels.mockReset().mockResolvedValue([{ id: 'example-model:7b', params: '7B' }]);getLoadedModels.mockReset().mockResolvedValue([{ id: 'example-model:7b', name: 'example-model:7b', size: 5 * 2 ** 30 }]);+ getOllamaListError.mockReset().mockReturnValue(null);+ getLmStudioListError.mockReset().mockReturnValue(null);});describe('buildSamplePrompt', () => {@@ -125,15 +134,24 @@ describe('loadAssessments / getAssessmentReport (read path)', () => {expect(report.unassessed).toContainEqual({ backend: 'ollama', modelId: 'example-model:7b', params: '7B' });});- it('flags a backend whose model list could not be read, rather than reporting it empty', async () => {- listModels.mockImplementation(async (backend) => {- if (backend === 'lmstudio') throw new Error('LM Studio unreachable');- return [{ id: 'example-model:7b', params: '7B' }];- });+ it('flags a backend whose model list could not be read, even though it returned []', async () => {+ // Both managers cache an EMPTY list on a failed read instead of throwing, so+ // the manager's own error getter is the only signal that separates "no+ // models installed" from "the list could not be read".+ listModels.mockImplementation(async (backend) => (backend === 'lmstudio' ? [] : [{ id: 'example-model:7b', params: '7B' }]));+ getLmStudioListError.mockReturnValue('LM Studio is unavailable');const report = await svc.getAssessmentReport();expect(report.listErrors).toEqual(['lmstudio']);});+ it('still flags a backend when the model list throws outright', async () => {+ listModels.mockImplementation(async (backend) => {+ if (backend === 'ollama') throw new Error('Ollama unreachable');+ return [];+ });+ expect((await svc.getAssessmentReport()).listErrors).toEqual(['ollama']);+ });+it('falls back to the balanced intent for an unrecognized one', async () => {expect((await svc.getAssessmentReport({ intent: 'nonsense' })).intent).toBe('balanced');});@@ -241,6 +259,68 @@ describe('runAssessment', () => {});});+describe('uninstalled models', () => {+ it('stops recommending a model the user has since deleted', async () => {+ runLocalLlmTest.mockResolvedValue(okRun());+ await svc.runAssessment({ backend: 'ollama', modelId: 'example-model:7b', contextTokens: [512, 4096] });++ listModels.mockResolvedValue([]);+ const report = await svc.getAssessmentReport();+ // It can no longer run, so it must not be ranked — but the measurement stays+ // on disk so a re-install doesn't cost another run.+ expect(report.ranked).toEqual([]);+ expect(report.uninstalled).toContainEqual({ backend: 'ollama', modelId: 'example-model:7b' });+ expect(report.assessments).toHaveLength(1);+ });++ it('keeps recommending when the backend list is UNTRUSTWORTHY rather than wiping it', async () => {+ runLocalLlmTest.mockResolvedValue(okRun());+ await svc.runAssessment({ backend: 'ollama', modelId: 'example-model:7b', contextTokens: [512, 4096] });++ // An unreadable list returning [] must not be read as "everything was+ // uninstalled" — that is the same failed-read-as-empty mistake.+ listModels.mockResolvedValue([]);+ getOllamaListError.mockReturnValue('Ollama is unavailable');+ const report = await svc.getAssessmentReport();+ expect(report.ranked.map((r) => r.modelId)).toEqual(['example-model:7b']);+ expect(report.uninstalled).toEqual([]);+ });+});++describe('cancellation', () => {+ it('does not persist a run the client aborted mid-way', async () => {+ // runLocalLlmTest turns a client disconnect into the same "Timed out" result+ // a real resource failure produces. Persisting it would record the user+ // closing the tab as `does-not-fit`.+ const controller = new AbortController();+ runLocalLlmTest.mockImplementation(async () => {+ controller.abort();+ return { text: '', error: 'Timed out after 120000ms' };+ });++ const result = await svc.runAssessment({+ backend: 'ollama', modelId: 'example-model:7b', contextTokens: [512, 4096], signal: controller.signal,+ });+ expect(result.cancelled).toBe(true);+ expect(await svc.loadAssessments()).toEqual([]);+ });++ it('leaves an earlier measurement intact when a re-run is cancelled', async () => {+ runLocalLlmTest.mockResolvedValue(okRun(40, 150));+ await svc.runAssessment({ backend: 'ollama', modelId: 'example-model:7b', contextTokens: [512] });++ const controller = new AbortController();+ controller.abort();+ await svc.runAssessment({+ backend: 'ollama', modelId: 'example-model:7b', contextTokens: [512], signal: controller.signal,+ });++ const stored = await svc.loadAssessments();+ expect(stored).toHaveLength(1);+ expect(stored[0].performance.meanCharsPerSecond).toBe(150);+ });+});+describe('deleteAssessment', () => {it('removes a record and reports that it did', async () => {runLocalLlmTest.mockResolvedValue(okRun());diff --git a/server/services/ollamaManager.js b/server/services/ollamaManager.jsindex 4c1ea45be2..6ede1b3b8d 100644--- a/server/services/ollamaManager.js+++ b/server/services/ollamaManager.js@@ -90,6 +90,12 @@ let isAvailable = null// too — otherwise the catalog-overlay path re-hits /api/tags on every keystroke.let installedModels = nulllet lastLoadedModelsError = null+// Why /api/tags last returned nothing. `getInstalledModels` deliberately caches+// an empty list on failure (see its comment), so `[]` alone cannot distinguish+// "Ollama has no models installed" from "the list could not be read" — callers+// that must not present a failed read as an empty backend consult this.+// Mirrors lmStudioManager's `getLastListError`.+let lastInstalledModelsError = nulllet lastCheckAt = nulllet managedProcess = nulllet managedProcessPid = null@@ -692,16 +698,21 @@ async function stopServer() {*/async function getInstalledModels(forceRefresh = false) {if (!forceRefresh && installedModels !== null) return installedModels- if (!(await checkOllamaAvailable())) return []+ if (!(await checkOllamaAvailable())) {+ lastInstalledModelsError = status.lastError || 'Ollama is unavailable'+ return []+ }const data = await ollamaRequest('/api/tags').catch(() => null)if (!data?.models) {// Cache the empty result so a /api/tags failure while Ollama stays up for// /api/version (the availability probe) doesn't re-hit on every catalog// keystroke; a forceRefresh (status refresh / pull / delete) recovers it.+ lastInstalledModelsError = 'Ollama model list (/api/tags) returned no data'installedModels = []return installedModels}+ lastInstalledModelsError = nullinstalledModels = data.models.map((m) => ({id: m.name || m.model,@@ -874,6 +885,11 @@ async function getLoadedModels() {}))}+/** Last `/api/tags` error (null only after a trustworthy installed list). */+function getLastInstalledModelsError() {+ return lastInstalledModelsError+}+/** Last `/api/ps` error (null only after a trustworthy residency list). */function getLastLoadedModelsError() {return lastLoadedModelsError@@ -1539,6 +1555,7 @@ export {getInstalledModels,getModelCapabilities,getLoadedModels,+ getLastInstalledModelsError,getLastLoadedModelsError,unloadModel,pullModel,