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
Group local LLM catalog by use case
Adam Eivy331316fed910
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 169325e606..50e6db43a4 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -1,7 +1,7 @@# Unreleased Changes## Added-- **[local-llm-backend-management] Local LLMs — pick a backend at setup, manage models, and migrate between Ollama and LM Studio.** Setup now asks whether you want **Ollama** or **LM Studio** for local on-device models and installs the chosen one if it's missing (`scripts/setup-llm.js`, wired into `npm run setup`; `npm run setup:llm` to run it standalone). The choice is recorded as `LLM_BACKEND` in `.env`, and the matching AI provider is auto-enabled on boot. A new **Settings → Local LLMs** tab (reachable from the sidebar, ⌘K, and voice) shows both backends' status, **one-click installs a missing backend** (Homebrew on macOS for both; the official script for Ollama on Linux; a download link elsewhere — with live installer output over the socket), can **start or stop Ollama directly** when the local server is installed but not running, makes clear **both backends can run at the same time** — the **Default** marker (formerly the misleading "Active" badge, which read as a running-state indicator) just picks which one PortOS routes local runs to, and **Set as Default** changes it without moving anything — and lets you **move models between the two in either direction, independently of the default**: the GGUF weights are portable (only the on-disk *layout* differs — Ollama's content-addressed blob store vs LM Studio's plain file tree), so each backend card's **Import from…** action offers **Link** (hardlink the GGUF so both backends share one file on disk — zero extra space, falling back to a copy across filesystems) or **Copy** (an independent duplicate), with **no re-download** either way; models that can't be shared/copied — LM Studio MLX-format, sharded, or (when targeting Ollama) multimodal — re-pull the cross-backend catalog equivalent. It also manages models like the LoRA/Media-Models pages do: a curated cross-backend catalog with search, one-click install, free-text "pull by name", and delete — with live pull progress over the `localLlm:progress` socket. Server side: `server/services/ollamaManager.js` (native Ollama HTTP API + local GGUF import via `/api/create`, with link mode pre-placing a content-addressed `blobs/sha256-…` hardlink so create dedups against it), `server/services/lmStudioManager.js` (hardlink-or-copy GGUF into LM Studio's model tree), `server/services/localLlm.js` (unified orchestration + `.env` default marker + provider enabling + bidirectional link/copy migrate, decoupled from the default), `server/lib/localLlmCatalog.js` (pure catalog + install-id mapping), `server/lib/localLlmDisk.js` (pure on-disk GGUF/manifest reasoning for the local-share/copy fast-path), and `/api/local-llm/*` routes.+- **[local-llm-backend-management] Local LLMs — pick a backend at setup, manage models, and migrate between Ollama and LM Studio.** Setup now asks whether you want **Ollama** or **LM Studio** for local on-device models and installs the chosen one if it's missing (`scripts/setup-llm.js`, wired into `npm run setup`; `npm run setup:llm` to run it standalone). The choice is recorded as `LLM_BACKEND` in `.env`, and the matching AI provider is auto-enabled on boot. A new **Settings → Local LLMs** tab (reachable from the sidebar, ⌘K, and voice) shows both backends' status, **one-click installs a missing backend** (Homebrew on macOS for both; the official script for Ollama on Linux; a download link elsewhere — with live installer output over the socket), can **start or stop Ollama directly** when the local server is installed but not running, makes clear **both backends can run at the same time** — the **Default** marker (formerly the misleading "Active" badge, which read as a running-state indicator) just picks which one PortOS routes local runs to, and **Set as Default** changes it without moving anything — and lets you **move models between the two in either direction, independently of the default**: the GGUF weights are portable (only the on-disk *layout* differs — Ollama's content-addressed blob store vs LM Studio's plain file tree), so each backend card's **Import from…** action offers **Link** (hardlink the GGUF so both backends share one file on disk — zero extra space, falling back to a copy across filesystems) or **Copy** (an independent duplicate), with **no re-download** either way; models that can't be shared/copied — LM Studio MLX-format, sharded, or (when targeting Ollama) multimodal — re-pull the cross-backend catalog equivalent. It also manages models like the LoRA/Media-Models pages do: a curated cross-backend catalog bucketed by **Reasoning**, **Coding**, **Image Analysis**, **Text Embeddings**, **Chat**, **Small & Fast**, and **Multilingual**, with current Hugging Face GGUF/MLX recommendations (including Devstral Small 2, Ministral 3, Qwen3 4B, Granite 3.2, Gemma 3 270M, GLM-4.6V Flash, and Nomic Embed v2 MoE), search, one-click install, free-text "pull by name", and delete — with live pull progress over the `localLlm:progress` socket. Server side: `server/services/ollamaManager.js` (native Ollama HTTP API + local GGUF import via `/api/create`, with link mode pre-placing a content-addressed `blobs/sha256-…` hardlink so create dedups against it), `server/services/lmStudioManager.js` (hardlink-or-copy GGUF into LM Studio's model tree), `server/services/localLlm.js` (unified orchestration + `.env` default marker + provider enabling + bidirectional link/copy migrate, decoupled from the default), `server/lib/localLlmCatalog.js` (pure catalog + install-id mapping), `server/lib/localLlmDisk.js` (pure on-disk GGUF/manifest reasoning for the local-share/copy fast-path), and `/api/local-llm/*` routes.- **[codex5-onboarding-capability-map] Capabilities page — every connected system at a glance.** A new Capabilities page (under System) shows the status of each integration on one screen: AI Providers, Calendar, Brain & Memory, Voice, Tailscale & HTTPS, Genome & Health, Telegram, Messages, and Apps & Processes. Every row says whether it's set up and healthy — Ready, Degraded, Error, or Not set up — and links straight to its settings, so the page works as both a first-run setup checklist and a quick runtime health overview. Reachable from the sidebar, ⌘K, and voice.- **Federated media collections + per-category sync integrity.** Media collections are now a first-class peer-sync record kind (`mediaCollection` in `PEER_SUBSCRIBABLE_KINDS`, schema-version-gated at `mediaCollections: 1`): they auto-subscribe on create, push per-record on edit, and propagate deletes via tombstones — collections now reach parity between federated machines the way universes/series already did, instead of only riding along as `linkedCollection` cargo or the opt-in 60s snapshot. Required adding soft-delete to collections (`deleted`/`deletedAt`; `deleteCollection` marks instead of splicing; `listCollections({ includeDeleted })`; tombstone-aware LWW merge; tombstone GC), so a delete on one node can't be resurrected by a reverse-subscribed peer. Synced images now carry their **generation prompts**: the peer asset manifest advertises a canonical gen-params-only `sidecarSha256` (machine-local hash-cache stripped so it converges across peers), and the asset-pull worker fetches each image's `.metadata.json` sidecar alongside the bytes — fixing images that previously landed in "Unsorted" with no prompts. A new per-category **sync integrity** surface (`GET /api/peer-sync/manifest`, `GET /api/peer-sync/integrity`, pure `computeRecordIntegrity` diff) drives a `SyncBadge` on every Universe / Series / Media-Collection row (in-sync / diverged / assets-missing / local-only / on-peer-only / "not syncing — enable?") plus a deep-linkable `SyncDetailDrawer` (`/…/:id/sync`) showing the per-peer breakdown, previews, and manual actions: **Sync to peer** (`POST /sync-record`, force-push bypassing the unchanged-hash short-circuit), **Sync now** (`POST /sync-now`, backfill-subscribe + retry a peer's pending pushes), and **Pull missing prompts** (`POST /pull-metadata` + a button on the Unsorted view that backfills sidecars from online peers). `mediaCollections` sync stays **opt-in** per peer (default off); the badge surfaces a clear "enable?" state rather than flipping the default.- **Manual tombstone GC trigger.** The 60s `syncOrchestrator` sweep buffers tombstones for 24h to give every peer time to ack a deletion before the bytes leave disk — fine for normal use, painful right after a mass-delete. New `POST /api/sync/tombstones/sweep` (Zod-validated optional `{ graceMs }` clamped to `[0, 24h]`) calls `sweepTombstones({ graceMs })` so callers can shrink the buffer; the per-kind null-cutoff refusal (snapshot-mode peer with no per-record subscription) still fires independently of `graceMs` to preserve resurrection safety. Companion `GET /api/sync/tombstones/status` returns the dry-run refusal status without invoking the prune helpers. A new "GC tombstones now" section on the Instances page (between SelfCard/AddPeer and the peers list) POSTs `graceMs: 0` and surfaces per-kind prune counts + any refusals in a toast; the button is disabled only when every kind is refused. `scripts/gc-tombstones-now.js` is the equivalent CLI path (dry-run by default; `--apply` to prune) for headless cleanups — uses the same "stop the server first, single-process write-tail isn't cross-process safe" wording as `cleanup-test-data.js`. `sweepTombstones` now returns `{ universes, series, issues, refused }` so the manual trigger can explain why a kind didn't shrink. The orchestrator path keeps the 24h default behavior unchanged.diff --git a/client/src/components/settings/LocalLlmTab.jsx b/client/src/components/settings/LocalLlmTab.jsxindex f2e59791f6..eb55bc2fe0 100644--- a/client/src/components/settings/LocalLlmTab.jsx+++ b/client/src/components/settings/LocalLlmTab.jsx@@ -1,4 +1,4 @@-import { useState, useEffect, useRef, useCallback } from 'react';+import { useState, useEffect, useRef, useCallback, useMemo } from 'react';import { Cpu, Box, ArrowRightLeft, Download, Trash2, RefreshCw, Search, Plus, ExternalLink, Star, Link2, Copy, Play, Square } from 'lucide-react';import toast from '../ui/Toast';import BrailleSpinner from '../BrailleSpinner';@@ -17,6 +17,18 @@ const labelFor = (id) => BACKENDS.find((b) => b.id === id)?.label || id;const btnClass = 'flex items-center gap-1.5 px-2 py-1 text-xs font-medium rounded transition-colors disabled:opacity-50';+const CATEGORY_LABELS = {+ chat: 'Chat',+ reasoning: 'Reasoning',+ coding: 'Coding',+ vision: 'Image Analysis',+ embedding: 'Text Embeddings',+ lightweight: 'Small & Fast',+ multilingual: 'Multilingual'+};+const CATEGORY_ORDER = ['reasoning', 'coding', 'vision', 'embedding', 'chat', 'lightweight', 'multilingual'];+const categoryLabel = (id) => CATEGORY_LABELS[id] || id;+// Summarize a migrate result for the success toast (per-model statuses → counts).function summarizeMigrate(r) {const c = { linked: 0, copied: 0, installed: 0, started: 0, failed: 0, skipped: 0 };@@ -157,6 +169,7 @@ export function LocalLlmTab() {const [loading, setLoading] = useState(true);const [selected, setSelected] = useState('ollama');const [catalog, setCatalog] = useState([]);+ const [activeCategory, setActiveCategory] = useState('all');const [query, setQuery] = useState('');const [manualId, setManualId] = useState('');const [actionInProgress, setActionInProgress] = useState(null);@@ -246,6 +259,25 @@ export function LocalLlmTab() {const busy = actionInProgress != null;const selectedData = status?.[selected];const installedModels = selectedData?.models || [];+ const catalogCategories = useMemo(() => {+ const counts = new Map();+ for (const model of catalog) counts.set(model.category || 'chat', (counts.get(model.category || 'chat') || 0) + 1);+ return CATEGORY_ORDER+ .filter((id) => counts.has(id))+ .map((id) => ({ id, label: categoryLabel(id), count: counts.get(id) }));+ }, [catalog]);+ const visibleCatalogGroups = useMemo(() => {+ const categoryIds = activeCategory === 'all'+ ? catalogCategories.map((c) => c.id)+ : [activeCategory];+ return categoryIds+ .map((category) => ({+ category,+ label: categoryLabel(category),+ models: catalog.filter((model) => (model.category || 'chat') === category)+ }))+ .filter((group) => group.models.length > 0);+ }, [activeCategory, catalog, catalogCategories]);// LM Studio's REST fallback returns { pending: true } — the download was only// queued, not finished — so don't claim "installed" in that case.@@ -331,7 +363,7 @@ export function LocalLlmTab() {{BACKENDS.map((b) => (<buttonkey={b.id}- onClick={() => setSelected(b.id)}+ onClick={() => { setSelected(b.id); setActiveCategory('all'); }}className={`px-2.5 py-1 text-xs rounded transition-colors ${selected === b.id ? 'bg-port-accent/20 text-port-accent' : 'bg-port-bg text-gray-400 hover:text-white'}`}>{b.label}@@ -397,33 +429,71 @@ export function LocalLlmTab() {</div></div>+ {catalogCategories.length > 0 && (+ <div className="flex flex-wrap gap-1.5">+ <button+ onClick={() => setActiveCategory('all')}+ className={`px-2.5 py-1 text-xs rounded transition-colors ${activeCategory === 'all' ? 'bg-port-accent/20 text-port-accent' : 'bg-port-bg text-gray-400 hover:text-white'}`}+ >+ All ({catalog.length})+ </button>+ {catalogCategories.map((category) => (+ <button+ key={category.id}+ onClick={() => setActiveCategory(category.id)}+ className={`px-2.5 py-1 text-xs rounded transition-colors ${activeCategory === category.id ? 'bg-port-accent/20 text-port-accent' : 'bg-port-bg text-gray-400 hover:text-white'}`}+ >+ {category.label} ({category.count})+ </button>+ ))}+ </div>+ )}+{/* Catalog cards */}- <div className="grid grid-cols-1 md:grid-cols-2 gap-2">- {catalog.map((m) => (- <div key={m.id} className="flex items-start gap-3 bg-port-bg border border-port-border rounded-lg p-3">- <div className="flex-1 min-w-0">- <div className="text-sm text-white truncate">{m.name} <span className="text-xs text-gray-500">· {m.params}</span></div>- <div className="text-xs text-gray-500 truncate">{m.id}</div>- <div className="text-xs text-gray-500 mt-0.5">{m.description}</div>- <div className="text-[11px] text-gray-600 mt-0.5">{m.size} · {(m.capabilities || []).join(', ')}</div>- </div>- {m.installed ? (- <span className="text-xs px-2 py-1 text-port-success shrink-0">Installed</span>- ) : (- <button- onClick={() => install(m.id)}- disabled={busy}- className="px-2.5 py-1 text-xs bg-port-accent/20 hover:bg-port-accent/30 text-port-accent rounded disabled:opacity-50 flex items-center gap-1 shrink-0"- >- {actionInProgress === `install-${m.id}` ? <BrailleSpinner /> : <Download size={12} />}- Install- </button>+ <div className="space-y-4">+ {visibleCatalogGroups.map((group) => (+ <div key={group.category} className="space-y-2">+ {activeCategory === 'all' && (+ <h3 className="text-xs font-medium text-gray-400">{group.label}</h3>)}+ <div className="grid grid-cols-1 md:grid-cols-2 gap-2">+ {group.models.map((m) => (+ <div key={m.id} className="flex items-start gap-3 bg-port-bg border border-port-border rounded-lg p-3">+ <div className="flex-1 min-w-0">+ <div className="text-sm text-white truncate">{m.name} <span className="text-xs text-gray-500">· {m.params}</span></div>+ <div className="text-xs text-gray-500 truncate">{m.id}</div>+ <div className="text-xs text-gray-500 mt-0.5">{m.description}</div>+ <div className="flex items-center gap-1.5 flex-wrap text-[11px] text-gray-600 mt-1">+ <span className="text-gray-500">{categoryLabel(m.category)}</span>+ <span>{m.size}</span>+ {(m.capabilities || []).map((capability) => (+ <span key={capability} className="px-1.5 py-0.5 bg-port-border/60 rounded">{capability}</span>+ ))}+ </div>+ </div>+ {m.installed ? (+ <span className="text-xs px-2 py-1 text-port-success shrink-0">Installed</span>+ ) : (+ <button+ onClick={() => install(m.id)}+ disabled={busy}+ className="px-2.5 py-1 text-xs bg-port-accent/20 hover:bg-port-accent/30 text-port-accent rounded disabled:opacity-50 flex items-center gap-1 shrink-0"+ >+ {actionInProgress === `install-${m.id}` ? <BrailleSpinner /> : <Download size={12} />}+ Install+ </button>+ )}+ </div>+ ))}+ </div></div>))}{catalog.length === 0 && (<p className="text-xs text-gray-500">No catalog matches{query ? ` for "${query}"` : ''}.</p>)}+ {catalog.length > 0 && visibleCatalogGroups.length === 0 && (+ <p className="text-xs text-gray-500">No {categoryLabel(activeCategory)} matches{query ? ` for "${query}"` : ''}.</p>+ )}</div>{/* Installed models */}diff --git a/server/lib/localLlmCatalog.js b/server/lib/localLlmCatalog.jsindex 17a3190bc7..4aed3b7281 100644--- a/server/lib/localLlmCatalog.js+++ b/server/lib/localLlmCatalog.js@@ -18,7 +18,17 @@ export const BACKENDS = ['ollama', 'lmstudio'];export const isBackend = (b) => BACKENDS.includes(b);-// Each entry: { key, name, params, size, family, description, capabilities,+export const LOCAL_LLM_CATEGORIES = [+ { id: 'chat', label: 'Chat' },+ { id: 'reasoning', label: 'Reasoning' },+ { id: 'coding', label: 'Coding' },+ { id: 'vision', label: 'Image Analysis' },+ { id: 'embedding', label: 'Text Embeddings' },+ { id: 'lightweight', label: 'Small & Fast' },+ { id: 'multilingual', label: 'Multilingual' }+];++// Each entry: { key, name, category, params, size, family, description, capabilities,// ollama?, lmstudio? }// `ollama` / `lmstudio` are the exact pull/download ids for that backend.// A missing id means there is no well-known build of that model for that@@ -27,6 +37,7 @@ export const LOCAL_LLM_CATALOG = [{key: 'llama3.2',name: 'Llama 3.2 3B',+ category: 'chat',params: '3B',size: '2.0 GB',family: 'llama',@@ -38,6 +49,7 @@ export const LOCAL_LLM_CATALOG = [{key: 'llama3.1',name: 'Llama 3.1 8B',+ category: 'chat',params: '8B',size: '4.7 GB',family: 'llama',@@ -49,6 +61,7 @@ export const LOCAL_LLM_CATALOG = [{key: 'qwen2.5',name: 'Qwen2.5 7B',+ category: 'multilingual',params: '7B',size: '4.7 GB',family: 'qwen',@@ -60,6 +73,7 @@ export const LOCAL_LLM_CATALOG = [{key: 'qwen2.5-coder',name: 'Qwen2.5 Coder 7B',+ category: 'coding',params: '7B',size: '4.7 GB',family: 'qwen',@@ -71,6 +85,7 @@ export const LOCAL_LLM_CATALOG = [{key: 'mistral',name: 'Mistral 7B',+ category: 'chat',params: '7B',size: '4.1 GB',family: 'mistral',@@ -82,6 +97,7 @@ export const LOCAL_LLM_CATALOG = [{key: 'gemma2',name: 'Gemma 2 9B',+ category: 'chat',params: '9B',size: '5.4 GB',family: 'gemma',@@ -93,6 +109,7 @@ export const LOCAL_LLM_CATALOG = [{key: 'phi3',name: 'Phi-3 Mini',+ category: 'lightweight',params: '3.8B',size: '2.3 GB',family: 'phi',@@ -104,6 +121,7 @@ export const LOCAL_LLM_CATALOG = [{key: 'deepseek-r1',name: 'DeepSeek-R1 Distill 7B',+ category: 'reasoning',params: '7B',size: '4.7 GB',family: 'deepseek',@@ -115,6 +133,7 @@ export const LOCAL_LLM_CATALOG = [{key: 'gpt-oss-20b',name: 'GPT-OSS 20B',+ category: 'reasoning',params: '20B',size: '12 GB',family: 'gpt-oss',@@ -126,6 +145,7 @@ export const LOCAL_LLM_CATALOG = [{key: 'llava',name: 'LLaVA 7B (vision)',+ category: 'vision',params: '7B',size: '4.5 GB',family: 'llava',@@ -137,6 +157,7 @@ export const LOCAL_LLM_CATALOG = [{key: 'codellama',name: 'Code Llama 7B',+ category: 'coding',params: '7B',size: '3.8 GB',family: 'llama',@@ -148,6 +169,7 @@ export const LOCAL_LLM_CATALOG = [{key: 'smollm2',name: 'SmolLM2 1.7B',+ category: 'lightweight',params: '1.7B',size: '1.1 GB',family: 'smollm',@@ -159,6 +181,7 @@ export const LOCAL_LLM_CATALOG = [{key: 'nomic-embed-text',name: 'Nomic Embed Text',+ category: 'embedding',params: '137M',size: '274 MB',family: 'embedding',@@ -166,6 +189,89 @@ export const LOCAL_LLM_CATALOG = [capabilities: ['embeddings'],ollama: 'nomic-embed-text',lmstudio: 'nomic-ai/nomic-embed-text-v1.5-GGUF'+ },+ {+ key: 'nomic-embed-text-v2-moe',+ name: 'Nomic Embed Text v2 MoE',+ category: 'embedding',+ params: '0.5B',+ size: '344 MB',+ family: 'embedding',+ description: 'Newer multilingual text-embedding MoE for semantic search and recall.',+ capabilities: ['embeddings', 'multilingual'],+ ollama: 'hf.co/nomic-ai/nomic-embed-text-v2-moe-GGUF:Q4_K_M',+ lmstudio: 'nomic-ai/nomic-embed-text-v2-moe-GGUF'+ },+ {+ key: 'qwen3-4b-instruct-2507',+ name: 'Qwen3 4B Instruct 2507',+ category: 'lightweight',+ params: '4B',+ size: '2.6 GB',+ family: 'qwen',+ description: 'Compact current Qwen3 instruct model for fast local chat and tool workflows.',+ capabilities: ['chat', 'tools', 'multilingual'],+ ollama: 'hf.co/lmstudio-community/Qwen3-4B-Instruct-2507-GGUF:Q4_K_M',+ lmstudio: 'lmstudio-community/Qwen3-4B-Instruct-2507-GGUF'+ },+ {+ key: 'granite-3.2-8b-instruct',+ name: 'Granite 3.2 8B Instruct',+ category: 'reasoning',+ params: '8B',+ size: '4.9 GB',+ family: 'granite',+ description: 'Apache-licensed IBM Granite instruct model with long context and thinking controls.',+ capabilities: ['chat', 'reasoning', 'multilingual'],+ ollama: 'hf.co/lmstudio-community/granite-3.2-8b-instruct-GGUF:Q4_K_M',+ lmstudio: 'lmstudio-community/granite-3.2-8b-instruct-GGUF'+ },+ {+ key: 'gemma-3-270m-it',+ name: 'Gemma 3 270M IT',+ category: 'lightweight',+ params: '270M',+ size: '253 MB',+ family: 'gemma',+ description: 'Tiny instruction model for cheap classification, routing, and quick local utilities.',+ capabilities: ['chat', 'classification'],+ ollama: 'hf.co/lmstudio-community/gemma-3-270m-it-GGUF:Q4_K_M',+ lmstudio: 'lmstudio-community/gemma-3-270m-it-GGUF'+ },+ {+ key: 'ministral-3-14b-instruct-2512',+ name: 'Ministral 3 14B Instruct 2512',+ category: 'reasoning',+ params: '14B',+ size: '8.6 GB',+ family: 'mistral',+ description: 'Current Mistral-family instruct model for strong local reasoning and general work.',+ capabilities: ['chat', 'reasoning', 'tools'],+ ollama: 'hf.co/lmstudio-community/Ministral-3-14B-Instruct-2512-GGUF:Q4_K_M',+ lmstudio: 'lmstudio-community/Ministral-3-14B-Instruct-2512-GGUF'+ },+ {+ key: 'devstral-small-2-24b',+ name: 'Devstral Small 2 24B',+ category: 'coding',+ params: '24B',+ size: '14 GB',+ family: 'mistral',+ description: 'Agentic coding model for repo navigation, edits, and software-engineering tasks.',+ capabilities: ['chat', 'code', 'tools', 'vision'],+ ollama: 'hf.co/unsloth/Devstral-Small-2-24B-Instruct-2512-GGUF:UD-Q4_K_XL',+ lmstudio: 'unsloth/Devstral-Small-2-24B-Instruct-2512-GGUF'+ },+ {+ key: 'glm-4.6v-flash',+ name: 'GLM-4.6V Flash',+ category: 'vision',+ params: 'Vision',+ size: '7.1 GB',+ family: 'glm',+ description: 'MLX vision-language model for image analysis on Apple Silicon.',+ capabilities: ['chat', 'vision'],+ lmstudio: 'lmstudio-community/GLM-4.6V-Flash-MLX-4bit'}];@@ -204,6 +310,7 @@ export function getCatalog(backend, installedIds = []) {id: entry[backend],key: entry.key,name: entry.name,+ category: entry.category,params: entry.params,size: entry.size,family: entry.family,@@ -215,7 +322,7 @@ export function getCatalog(backend, installedIds = []) {/*** Filter the per-backend catalog by a free-text query against name, id,- * family, and description. Empty query returns the full catalog.+ * family, category, and description. Empty query returns the full catalog.*/export function searchCatalog(backend, query, installedIds = []) {const all = getCatalog(backend, installedIds);@@ -224,6 +331,7 @@ export function searchCatalog(backend, query, installedIds = []) {return all.filter((m) =>m.name.toLowerCase().includes(q) ||m.id.toLowerCase().includes(q) ||+ m.category.toLowerCase().includes(q) ||m.family.toLowerCase().includes(q) ||m.description.toLowerCase().includes(q));}diff --git a/server/lib/localLlmCatalog.test.js b/server/lib/localLlmCatalog.test.jsindex 218e685760..2d6acf6550 100644--- a/server/lib/localLlmCatalog.test.js+++ b/server/lib/localLlmCatalog.test.js@@ -1,6 +1,6 @@import { describe, it, expect } from 'vitest';import {- BACKENDS, isBackend, LOCAL_LLM_CATALOG, getCatalog, searchCatalog, mapModelToBackend+ BACKENDS, isBackend, LOCAL_LLM_CATALOG, LOCAL_LLM_CATEGORIES, getCatalog, searchCatalog, mapModelToBackend} from './localLlmCatalog.js';describe('localLlmCatalog', () => {@@ -19,16 +19,21 @@ describe('localLlmCatalog', () => {const ollama = getCatalog('ollama');const llama = ollama.find((m) => m.key === 'llama3.2');expect(llama.id).toBe('llama3.2');+ expect(llama.category).toBe('chat');const lms = getCatalog('lmstudio');const llamaLms = lms.find((m) => m.key === 'llama3.2');expect(llamaLms.id).toBe('lmstudio-community/Llama-3.2-3B-Instruct-GGUF');});it('only includes entries that ship a build for the backend', () => {- // Every catalog entry currently has both ids, so counts match the catalog.expect(getCatalog('ollama').length).toBe(LOCAL_LLM_CATALOG.filter((e) => e.ollama).length);});+ it('keeps every entry in a known category', () => {+ const categories = new Set(LOCAL_LLM_CATEGORIES.map((c) => c.id));+ expect(LOCAL_LLM_CATALOG.every((entry) => categories.has(entry.category))).toBe(true);+ });+it('marks installed models (tag-insensitive for Ollama)', () => {const list = getCatalog('ollama', ['llama3.2:latest']);expect(list.find((m) => m.id === 'llama3.2').installed).toBe(true);@@ -52,6 +57,7 @@ describe('localLlmCatalog', () => {it('filters by name, family, and description', () => {expect(searchCatalog('ollama', 'coder').some((m) => m.key === 'qwen2.5-coder')).toBe(true);expect(searchCatalog('ollama', 'vision').some((m) => m.key === 'llava')).toBe(true);+ expect(searchCatalog('ollama', 'embedding').some((m) => m.key === 'nomic-embed-text-v2-moe')).toBe(true);expect(searchCatalog('ollama', 'zzzznotamodel')).toEqual([]);});});