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: richer Local LLM model cards — age, file size, RAM hint, capability icons
Adam Eivy02bd461cd5cf
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex f2e6e8944a..377192bbbb 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -13,6 +13,7 @@- **Universes list/table index — CRUD all universes at a glance.** New `client/src/pages/Universes.jsx` lists every universe in a table (desktop) / card stack (mobile) with canon-entity count, linked-series count, last-updated, and per-row Share / Sync-to-peer / two-click delete (optimistic remove + rollback, no `window.confirm`) — mirroring the Series Pipeline index. Series counts come from a client-side join against `listPipelineSeries()` (reverse of the join `Pipeline.jsx` already does); canon counts sum the `characters`/`places`/`objects` trunks. The PipelineSeries "Open" link beside the Linked-Universe picker now opens the actually-linked universe instead of a blank builder.- **[ltx-9x16-resolution] 9:16 vertical preset in the video generator.** The Video Gen resolution dropdown now offers `576×1024 (9:16)` — the true portrait mirror of the existing `1024×576 (16:9)` landscape preset — so vertical/social clips are a one-click pick instead of a manual custom size.+- **Richer Local-LLM model cards — age, real file size, RAM hint, and capability icons.** Each model card now shows: a **"published Xd ago"** age for Hugging Face results (reusing the shared `timeAgo` formatter; tooltip with the exact publish date + last-updated) — the server now carries the model's `createdAt` alongside `lastModified`; the **real GGUF file size** (the HF *search* endpoint omits per-file sizes, so the server backfills them from the per-model `?blobs=true` endpoint, cached per repo so the debounced search box doesn't re-fetch); an approximate **"~N GB RAM"** hint (model weights + ~20% overhead, rounded up); and model **capabilities as colored icons** (Vision/Code/Reasoning/Tool-use/Chat/Embeddings) in the LM Studio style, replacing the previous text labels — each icon keeps a `title`/`aria-label` for discoverability.- **[wire-proactive-cos-speech-to-real-triggers] The assistant can now speak up on its own.** With proactive voice enabled, your Chief of Staff speaks first on three kinds of moments — a critical system error, a new task becoming ready, and a high-priority notification — instead of only talking back when you address it. Each kind is rate-limited on its own timer so a burst can't talk over you, and all of it still respects quiet hours and the proactive-voice switch.## Changed@@ -32,6 +33,8 @@## Fixed+- **Deleting an LM Studio model no longer errors with `unknown command 'rm'`.** The delete path shelled out to `lms rm <model> -y`, but the `lms` CLI has no `rm`/`delete` command (and LM Studio's REST API exposes no delete), so every LM Studio model deletion failed. `lmStudioManager.deleteModel()` now removes the model's on-disk `<publisher>/<repo>/` folder directly — resolving an API id that differs from the downloaded repo (e.g. `openai/gpt-oss-20b` → `lmstudio-community/gpt-oss-20b-GGUF`) via a normalized repo-name scan — and prunes the publisher dir when it's left empty. The destructive delete is guarded so it can only ever remove a concrete `<publisher>/<repo>` folder strictly under the models root: traversal ids (`.`, `..`, `/`, `x/..`) are rejected, an ambiguous id that matches multiple variants (e.g. a `-GGUF` and an `-MLX-*` build) refuses rather than guessing, and an exact `publisher/repo` always wins over the fuzzy scan. A currently-loaded model is best-effort unloaded first so the running app isn't left serving deleted files, and the model cache is reset even on a partial failure so the list re-reads the real on-disk state. `localLlm.js` routes LM Studio deletes through it instead of the bogus CLI call.+- **Completed Claude TUI agents now show their final resolution again.** When a TUI agent wrote its `.agent-done` completion sentinel and then ran `/quit`, the process exited within milliseconds — long before the 2s sentinel poll fired — so the shell-exit path finalized the agent first and the poll bailed on `finalized`. The sentinel's markdown summary was therefore never appended to the agent's output, leaving the completed-agent details view blank. The sentinel read now happens inside `finish()` (the single chokepoint for every finalize path — `/quit`-exit, idle-timeout, and the poll), so the resolution is captured no matter which path wins the race. Extracted as an idempotent `ingestDoneSentinel()` helper; the poll watcher is now only an early-finalize trigger.- **Background agent cleanup no longer removes an in-progress manual claim's workspace.** A long-running hands-on task could have its isolated workspace deleted out from under it by the periodic agent-cleanup sweep, which mistook the human-owned workspace for an abandoned agent one. The sweep now leaves manual-claim workspaces alone and only reaps truly abandoned agent workspaces, and it runs on the daily maintenance schedule instead of every 15 minutes.diff --git a/client/src/components/settings/LocalLlmTab.jsx b/client/src/components/settings/LocalLlmTab.jsxindex 0762bfe152..9157a520f6 100644--- a/client/src/components/settings/LocalLlmTab.jsx+++ b/client/src/components/settings/LocalLlmTab.jsx@@ -1,8 +1,8 @@import { useState, useEffect, useRef, useCallback, useMemo } from 'react';-import { Cpu, Box, ArrowRightLeft, Download, Trash2, RefreshCw, Search, Plus, ExternalLink, Star, Link2, Copy, Play, Square, Power, PowerOff } from 'lucide-react';+import { Cpu, Box, ArrowRightLeft, Download, Trash2, RefreshCw, Search, Plus, ExternalLink, Star, Link2, Copy, Play, Square, Power, PowerOff, Eye, Wrench, Brain, Code2, MessageSquare, Boxes } from 'lucide-react';import toast from '../ui/Toast';import BrailleSpinner from '../BrailleSpinner';-import { formatBytes } from '../../utils/formatters';+import { formatBytes, timeAgo } from '../../utils/formatters';import {getLocalLlmStatus, getLocalLlmCatalog, getLocalLlmHuggingFaceSearch, installLocalLlmModel,deleteLocalLlmModel, switchLocalLlmBackend, migrateLocalLlmBackend, installLocalLlmBackend, controlOllamaService@@ -29,6 +29,34 @@ const CATEGORY_LABELS = {const CATEGORY_ORDER = ['reasoning', 'coding', 'vision', 'embedding', 'chat', 'lightweight', 'multilingual'];const categoryLabel = (id) => CATEGORY_LABELS[id] || id;+// Render model capabilities as colored icons (LM Studio style) instead of text.+// `cls` is the icon color; the bordered chip uses the same hue at low opacity.+const CAPABILITY_META = {+ chat: { Icon: MessageSquare, label: 'Chat', cls: 'text-gray-400 border-gray-500/50' },+ code: { Icon: Code2, label: 'Code', cls: 'text-sky-400 border-sky-400/50' },+ reasoning: { Icon: Brain, label: 'Reasoning', cls: 'text-emerald-400 border-emerald-400/50' },+ vision: { Icon: Eye, label: 'Vision', cls: 'text-amber-400 border-amber-400/50' },+ embeddings: { Icon: Boxes, label: 'Embeddings', cls: 'text-violet-400 border-violet-400/50' },+ tools: { Icon: Wrench, label: 'Tool use', cls: 'text-blue-400 border-blue-400/50' },+};++// Parse a human size string ("4.7 GB", "512 MB") back to GB for the RAM hint.+function parseSizeGb(sizeStr) {+ const match = /([\d.]+)\s*(TB|GB|MB|KB)/i.exec(String(sizeStr || ''));+ if (!match) return null;+ const val = parseFloat(match[1]);+ if (!Number.isFinite(val)) return null;+ return val * ({ TB: 1024, GB: 1, MB: 1 / 1024, KB: 1 / (1024 * 1024) }[match[2].toUpperCase()]);+}++// Rough RAM/VRAM to run a model: weights + ~20% overhead (KV cache/runtime),+// rounded up to whole GB with a 1 GB floor. Prefers exact bytes when known.+function recommendedRamGb(m) {+ const gb = Number.isFinite(m?.sizeBytes) ? m.sizeBytes / 1024 ** 3 : parseSizeGb(m?.size);+ if (!gb || gb <= 0) return null;+ return Math.max(1, Math.ceil(gb * 1.2));+}+// 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 };@@ -527,7 +555,12 @@ export function LocalLlmTab() {<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) => (+ {group.models.map((m) => {+ const ram = recommendedRamGb(m);+ const isHf = m.source === 'huggingface';+ const createdMs = new Date(m.createdAt).getTime();+ const updatedMs = new Date(m.updatedAt).getTime();+ return (<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>@@ -536,11 +569,37 @@ export function LocalLlmTab() {<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.source === 'huggingface' && <span>{m.downloads?.toLocaleString?.() || 0} downloads</span>}- {m.source === 'huggingface' && m.license && <span>{m.license}</span>}- {(m.capabilities || []).map((capability) => (- <span key={capability} className="px-1.5 py-0.5 bg-port-border/60 rounded">{capability}</span>- ))}+ {ram && (+ <span title="Approx RAM/VRAM to run this model — weights + ~20% overhead">+ ~{ram} GB RAM+ </span>+ )}+ {isHf && <span>{m.downloads?.toLocaleString?.() || 0} downloads</span>}+ {isHf && Number.isFinite(createdMs) && (+ <span+ title={`Published ${new Date(createdMs).toLocaleDateString()}${Number.isFinite(updatedMs) ? ` · updated ${timeAgo(m.updatedAt)}` : ''}`}+ >+ published {timeAgo(m.createdAt)}+ </span>+ )}+ {isHf && m.license && <span>{m.license}</span>}+ {(m.capabilities || []).map((capability) => {+ const meta = CAPABILITY_META[capability];+ if (!meta) {+ return <span key={capability} className="px-1.5 py-0.5 bg-port-border/60 rounded">{capability}</span>;+ }+ const Icon = meta.Icon;+ return (+ <span+ key={capability}+ title={meta.label}+ aria-label={meta.label}+ className={`inline-flex items-center justify-center w-5 h-5 rounded border ${meta.cls}`}+ >+ <Icon size={12} />+ </span>+ );+ })}</div></div>{m.installed ? (@@ -556,7 +615,8 @@ export function LocalLlmTab() {</button>)}</div>- ))}+ );+ })}</div></div>))}diff --git a/client/src/utils/formatters.js b/client/src/utils/formatters.jsindex fc49a339c3..ada9c096c3 100644--- a/client/src/utils/formatters.js+++ b/client/src/utils/formatters.js@@ -80,7 +80,9 @@ export function formatRuntime(ms) {*/export function timeAgo(dateStr, fallback = 'never') {if (!dateStr) return fallback;- const seconds = Math.floor((Date.now() - new Date(dateStr).getTime()) / 1000);+ const time = new Date(dateStr).getTime();+ if (!Number.isFinite(time)) return fallback; // Invalid Date → fallback, not "NaNy ago"+ const seconds = Math.floor((Date.now() - time) / 1000);if (seconds < 0) return 'just now';if (seconds < 60) return seconds < 10 ? 'just now' : `${seconds}s ago`;const mins = Math.floor(seconds / 60);diff --git a/client/src/utils/formatters.test.js b/client/src/utils/formatters.test.jsindex f9711dbf6e..1a3b1d576e 100644--- a/client/src/utils/formatters.test.js+++ b/client/src/utils/formatters.test.js@@ -1,5 +1,5 @@import { describe, it, expect } from 'vitest';-import { formatDurationMin, formatEventDateTime } from './formatters.js';+import { formatDurationMin, formatEventDateTime, timeAgo } from './formatters.js';describe('formatDurationMin', () => {it('formats sub-hour, exact-hour, and hour+min durations', () => {@@ -65,3 +65,20 @@ describe('formatEventDateTime', () => {);});});++describe('timeAgo', () => {+ it('returns the fallback for null/empty', () => {+ expect(timeAgo(null)).toBe('never');+ expect(timeAgo('', 'n/a')).toBe('n/a');+ });++ it('returns the fallback for an unparseable date instead of "NaNy ago"', () => {+ expect(timeAgo('not-a-date')).toBe('never');+ expect(timeAgo('not-a-date', '—')).toBe('—');+ });++ it('formats a recent past date in days', () => {+ const threeDaysAgo = new Date(Date.now() - 3 * 24 * 3600 * 1000).toISOString();+ expect(timeAgo(threeDaysAgo)).toBe('3d ago');+ });+});diff --git a/server/services/huggingFaceCatalog.js b/server/services/huggingFaceCatalog.jsindex f715b03e7b..4a5ddcb1fd 100644--- a/server/services/huggingFaceCatalog.js+++ b/server/services/huggingFaceCatalog.js@@ -212,6 +212,8 @@ function toResult(model, backend, requestedCategory, installedIds) {publisher: publisherOf(repoId),downloads: Number(model?.downloads || 0),likes: Number(model?.likes || 0),+ sizeBytes: Number.isFinite(file?.size) ? file.size : null,+ createdAt: model?.createdAt || model?.created_at || null,updatedAt: model?.lastModified || model?.last_modified || model?.updatedAt || null,license: licenseOf(model),quant: file?.quant || null,@@ -221,6 +223,13 @@ function toResult(model, backend, requestedCategory, installedIds) {return result}+function hfHeaders() {+ const headers = { Accept: 'application/json' }+ const token = process.env.HUGGINGFACE_TOKEN || process.env.HF_TOKEN+ if (token) headers.Authorization = `Bearer ${token}`+ return headers+}+async function fetchModels(search, limit, useGgufFilter) {const params = new URLSearchParams({search,@@ -231,11 +240,7 @@ async function fetchModels(search, limit, useGgufFilter) {})if (useGgufFilter) params.set('filter', 'gguf')- const headers = { Accept: 'application/json' }- const token = process.env.HUGGINGFACE_TOKEN || process.env.HF_TOKEN- if (token) headers.Authorization = `Bearer ${token}`-- const response = await fetchWithTimeout(`${HF_API_BASE}?${params.toString()}`, { headers }, HF_TIMEOUT_MS)+ const response = await fetchWithTimeout(`${HF_API_BASE}?${params.toString()}`, { headers: hfHeaders() }, HF_TIMEOUT_MS)if (!response.ok) {const text = await response.text().catch(() => '')throw new Error(`Hugging Face search failed: ${response.status}${text ? ` — ${text.slice(0, 160)}` : ''}`)@@ -244,6 +249,38 @@ async function fetchModels(search, limit, useGgufFilter) {return Array.isArray(data) ? data : []}+// The search endpoint returns siblings WITHOUT per-file sizes; only the+// per-model endpoint (?blobs=true) carries them. Cache by repo so repeated+// searches (the box is debounced per keystroke) don't re-fetch. `undefined` =+// not fetched, `null` = fetched-but-no-size (sentinel, per the absent-vs-empty+// rule) so a sizeless repo isn't probed on every search.+const repoSizeCache = new Map()++async function fetchRepoSizeBytes(repoId) {+ if (repoSizeCache.has(repoId)) return repoSizeCache.get(repoId)+ const model = await fetchWithTimeout(`${HF_API_BASE}/${repoId}?blobs=true`, { headers: hfHeaders() }, HF_TIMEOUT_MS)+ .then((res) => (res.ok ? res.json() : null))+ .catch(() => null)+ // Re-run the same quant picker against the now-sized siblings.+ const picked = pickGgufFile(model)+ const bytes = Number.isFinite(picked?.size) ? picked.size : null+ repoSizeCache.set(repoId, bytes)+ return bytes+}++// Backfill real file sizes for results the search endpoint left sizeless.+async function enrichWithSizes(results) {+ await Promise.allSettled(results.map(async (result) => {+ if (Number.isFinite(result.sizeBytes)) return+ const bytes = await fetchRepoSizeBytes(result.repository)+ if (Number.isFinite(bytes)) {+ result.sizeBytes = bytes+ result.size = formatBytes(bytes) || result.size+ }+ }))+ return results+}+export async function searchHuggingFaceModels({ backend, query = '', category = 'all', limit = 12, installedIds = [] }) {if (!isBackend(backend)) return []const requestedCategory = CATEGORY_IDS.has(category) ? category : 'all'@@ -253,7 +290,7 @@ export async function searchHuggingFaceModels({ backend, query = '', category =if (models.length === 0) models = await fetchModels(search, fetchLimit, false)const seen = new Set()- return models+ const results = models.filter(hasGgufSignal).map((model) => toResult(model, backend, requestedCategory, installedIds)).filter(Boolean)@@ -264,4 +301,6 @@ export async function searchHuggingFaceModels({ backend, query = '', category =}).sort((a, b) => b.score - a.score || b.downloads - a.downloads).slice(0, limit)++ return enrichWithSizes(results)}diff --git a/server/services/huggingFaceCatalog.test.js b/server/services/huggingFaceCatalog.test.jsindex a2fe6bfed7..79b332a932 100644--- a/server/services/huggingFaceCatalog.test.js+++ b/server/services/huggingFaceCatalog.test.js@@ -71,6 +71,27 @@ describe('huggingFaceCatalog', () => {expect(results[0].installed).toBe(true)})+ it('backfills file sizes from the per-model blobs endpoint when the search omits them', async () => {+ fetch+ .mockResolvedValueOnce(response([+ {+ modelId: 'nomic-ai/nomic-embed-text-v1.5-GGUF',+ downloads: 50,+ tags: ['gguf'],+ siblings: [{ rfilename: 'nomic-embed-text-v1.5.Q4_K_M.gguf' }] // search returns no size+ }+ ]))+ .mockResolvedValueOnce(response({+ id: 'nomic-ai/nomic-embed-text-v1.5-GGUF',+ siblings: [{ rfilename: 'nomic-embed-text-v1.5.Q4_K_M.gguf', size: 84_106_624 }]+ }))++ const results = await searchHuggingFaceModels({ backend: 'ollama', query: 'nomic-embed' })++ expect(results[0].sizeBytes).toBe(84_106_624)+ expect(results[0].size).toMatch(/\d+(\.\d+)?\s(MB|GB)/)+ })+it('filters out non-GGUF results even if Hugging Face returns them', async () => {fetch.mockResolvedValue(response([{ modelId: 'org/Plain-Safetensors', tags: ['safetensors'], siblings: [] },