Commit Graph

28 Commits

Author SHA1 Message Date
saravanakumardb1
e5acd1dc26 fix(mission-control): dedupe whisper binaries and clean WSL package metadata
Prevent duplicate React keys by de-duplicating whisper binary names and improve WSL package reporting so system metadata shows stable, user-friendly versions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-22 18:03:59 -08:00
saravanakumardb1
112341e162 fix(local-llms): harden WSL setup and dashboard Ollama connectivity
Stabilize Windows+WSL setup by fixing script line-ending pitfalls, WSL Ollama host detection, and dashboard startup behavior so models are detected reliably in Mission Control.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-22 16:44:58 -08:00
saravanakumardb1
b1d2e4ec81 fix(local-llms): cross-platform audit — 8 bugs/gaps fixed
- setup-tts.sh: make fully cross-platform (macOS + Linux/WSL2)
  - OS detection, apt fallback, CUDA PyTorch install, nvidia-smi check
  - cross-platform playback hints, HF_MIRROR env override
- api/system/route.ts: fix ffmpeg detection (use -version not --version)
- api/system/memory/route.ts: remove unused total variable in Linux path
- api/system/exec/route.ts: expand allowlist with Linux commands
  (head, tail, grep, which, ps, uname, free, lscpu, nvidia-smi, etc.)
- api/tts/route.ts: cross-platform venv path + CUDA/MPS label
- api/whisper/route.ts: Linux binary/model paths
- api/ollama/logs/route.ts: Linux log paths + WSL2 hint
- test_qwen_tts.py: platform-aware speech text + CUDA device detection
- test_orpheus_tts.py: platform-aware text, move import sys to top
- setup-guide.md: fix false auto-detect claim, add HF_MIRROR hint
2026-02-21 15:27:49 -08:00
saravanakumardb1
f85b455eb5 ci: update CI/CD configuration 2026-02-21 14:13:07 -08:00
saravanakumardb1
6d98d12f04 feat(local-llm): Phase G — projects + multi-model orchestration (G1-G7)
G1: Project CRUD in IndexedDB (already added in Phase F commit)
G2: Project sidebar section with create, pin, delete, and active selection
G3: Project system context injection (via project default model/agent/context)
G4: Cmd+P project switcher modal with keyboard navigation
G5: Chain orchestration — sequential multi-model pipeline with {prev} placeholder
G6: Race orchestration — parallel model competition with timing
G7: Vote orchestration — consensus synthesis from multiple model responses
2026-02-20 00:47:34 -08:00
saravanakumardb1
52f3d16b65 feat(local-llm): Phase F — scheduled tasks (F1-F7)
F1: cron-parser integration + cron utility functions (parse, nextRun, toHuman, shouldRunNow)
F2: ScheduledTask + Project + Orchestration CRUD in IndexedDB
F3: Task editor modal (schedule, model, input source, output action, prompt)
F4: Browser-based task runner with setInterval + cron matching
F5: /api/system/exec — safe shell command execution with allowlist
F6: Task run history stored per task (last 20 runs)
F7: 5 built-in task templates (morning brief, git diff, disk usage, code review, deps)
2026-02-20 00:44:53 -08:00
saravanakumardb1
e15a5a2f2f feat(local-llm): Phase E — response enhancements (E1-E5)
E1: Per-message action bar (copy, regenerate dropdown, rating) on hover
E2: Per-code-block copy button in MarkdownResponse with 'Copied!' feedback
E3: 'Try with other model' — regenerate dropdown shows loaded models
E4: Live streaming metrics (token count + tok/s during stream)
E5: Rating (thumbs up/down) persisted per message in IndexedDB
2026-02-20 00:40:49 -08:00
saravanakumardb1
d625be283c feat(local-llm): Phase D model router + multi-modal input (D1-D7)
- add lib/router.ts with task classifier, model hint mapping, resolve fallback chain, and auto-detect defaults
- integrate auto-routing mode in conversation model selector with __auto__ option
- persist/read model defaults from localStorage (llm-model-defaults)
- route prompts to selected/routed model before streaming
- add multi-modal input controls (attach file, image, voice)
- support attachment chips, removal, drag-and-drop file attach
- add audio transcription flow via /api/whisper/transcribe and append result to input
- support sending attachments payload alongside text from InputBar
2026-02-20 00:31:54 -08:00
saravanakumardb1
d18b695029 feat(local-llm): Phase C custom agents (C1-C5)
- add built-in agents library (10 seeded agents)
- add agent CRUD/seeding/export/import helpers in db layer
- seed agents on workspace load
- add agent strip in sidebar and launch-from-agent flow
- add command palette support for agent entries
- add agent conversation wiring (agentId, systemPrompt, welcome message)
- render agent badge in conversation header
- add example prompt chips in input bar for agent conversations
- add AgentEditor modal for creating/updating custom agents
2026-02-20 00:26:46 -08:00
saravanakumardb1
7ae92da16e feat(local-llm): Phase B quick actions + command palette (B1-B6)
- add fuse.js dependency and command palette modal (Cmd+K)
- add built-in quick actions library (30 templates across categories)
- add quick action CRUD + seeding + import/export helpers in db layer
- seed quick actions on workspace load and list top actions in sidebar
- implement quick action launcher -> creates preconfigured conversation
- add custom quick action editor modal for creating/editing actions
- wire command palette system actions and conversation navigation
- support passing QA template into conversation input via query param
2026-02-20 00:19:17 -08:00
saravanakumardb1
e17bb311c9 feat(local-llm): Phase A foundation (A1-A8) workspace + indexeddb
- add idb dependency and create typed db layer (conversations/messages/agents/etc)
- extend app/lib/types.ts with v4 workspace interfaces
- move existing dashboard to /mission-control route group
- create / workspace route group with sidebar shell and conversation pages
- implement conversation list grouping + search in sidebar
- implement conversation view with streaming via /api/ollama/chat
- add context bar and token/context utilities
- add /api/ollama/title endpoint for auto-title generation
- add v3->v4 migration utility (llm-inference-log + llm-chat-* to indexeddb)
- wire migration in workspace layout and cmd+/ sidebar toggle

Implements roadmap Phase A tasks A1-A8.
2026-02-20 00:11:27 -08:00
saravanakumardb1
07d391101a feat(local-llm): Phase 6 — data persistence + export (F29-F31)
F29: Export/import settings — gear icon in header opens settings popover,
     export downloads all llm-* localStorage as JSON, import validates
     and merges, both with toast feedback
F30: Inference history log — saves prompt/response/model/metrics to
     llm-inference-log (capped 100 FIFO), searchable panel with replay
     button, count badge in header toggle
F31: Factory reset — confirm dialog clears all llm-* localStorage keys,
     resets all component state to defaults
2026-02-19 23:29:40 -08:00
saravanakumardb1
44ad8a6301 feat(local-llm): Phase 5 — response quality + interaction (F24-F28)
F24: Vision image upload — file picker for vision models, base64 encoding,
     passed through stream API to Ollama generate endpoint
F25: Markdown rendering — ReactMarkdown replaces raw <pre> for all
     prompt responses and chat assistant messages
F26: Syntax highlighting — Prism-based code blocks with language labels
     and oneDark theme via react-syntax-highlighter
F27: <think> block collapse — auto-detect and collapse DeepSeek R1
     reasoning traces into expandable details with word count
F28: Ollama library link — button next to Pull input opens ollama.com/library
2026-02-19 23:25:20 -08:00
saravanakumardb1
588d21c70e feat(local-llm): Phase 4 — runtime metrics + UX polish (N11-N14)
N11: Persist tok/s per model to localStorage (llm-model-benchmarks),
     display on model card as faded accent text
N12: Live countdown to auto-unload — 1s interval, color-coded
     (green >5m, yellow 1-5m, red <1m 'Unloading soon')
N13: Session stats per model (prompts + tokens) in expanded details
N14: Co-load suggestions strip below models list showing which
     unloaded models fit in remaining free memory
2026-02-19 23:20:30 -08:00
saravanakumardb1
6f6baf99c8 feat(local-llm): Phase 3 — model intelligence badges + sort + version (N6-N10)
N6: <think> warning badge for DeepSeek R1 and distilled variants
N7: Vision model indicator for llava, bakllava, moondream, qwen-vl, etc.
N8: Architecture/family badge as pill on every model card
N9: Sort dropdown (A-Z, size, params, running, recent) with localStorage persist
N10: Ollama server version fetched from /api/version, shown in stats card
2026-02-19 23:17:07 -08:00
saravanakumardb1
7f042975de feat(local-llm): Phase 2 — rich metadata + persistence (N4-N5, BN3-BN4)
N4: RamBudgetBar component — stacked horizontal bar showing OS+Apps,
    loaded models (by name with color), and free memory segments
N5: Context window size — extract context_length from /api/show
    model_info, cache in modelMetadata state, display on card
BN3: Persist chat messages to localStorage (llm-chat-{model}),
     restore on modal re-open, capped at 50 messages
BN4: Logs panel refresh button — RefreshCw icon next to toggle
2026-02-19 23:13:22 -08:00
saravanakumardb1
040013e495 feat(local-llm): Phase 1 — pre-load intelligence + bug fixes (N1-N3, BN1-BN2, BN5)
N1: Estimated RAM per model with quant-aware multipliers (Q4=1.2x, Q5=1.25x, Q8=1.1x, F16=1.05x)
N2: Will-it-fit indicator (green/yellow/red dot) next to Load button
N3: Aggregate loaded model VRAM in panel header badge
BN1: Compare buttons now filter to running models only
BN2: AbortController on compare stream, cancel on modal close
BN5: Delete confirmation shows model name + disk reclaim size
2026-02-19 23:09:49 -08:00
saravanakumardb1
1552006feb fix(local-llm): proxy extraction health check through API route
Move extraction service health check from direct browser fetch
(http://localhost:4005/health) to server-side /api/extraction/health
proxy. Eliminates ERR_CONNECTION_REFUSED console errors when the
extraction service is not running locally.
2026-02-19 15:53:02 -08:00
saravanakumardb1
8bdd5ee1c8 feat(local-llm): Sprint 7 — all remaining features (F5,F7,F8,F12,F13,F15,CQ5,S3)
Features:
- F5: Model comparison side-by-side — after a prompt response, click
  any other model to compare. Responses display in two-column grid.
- F7: System resource sparklines — memory usage ring buffer (30 points)
  with SVG sparkline component in the memory stats card.
- F8: Ollama logs viewer — collapsible terminal-style panel below main
  grid. Fetches from /api/ollama/logs route. Color-coded by level.
- F12: Whisper transcription test — file upload button in Whisper panel.
  Uploads audio to /api/whisper/transcribe, displays text + latency.
- F13: Responsive mobile layout — p-3/sm:p-6 padding, gap-3/sm:gap-4,
  hidden sm:inline for header text, responsive comparison grid.
- F15: Extraction service panel — health check to localhost:4005 on
  each refresh. Status card in right column with endpoint + service.

Code quality:
- CQ5: Skeleton shimmer loading UI — 4 skeleton cards shown while
  initial data loads. Uses CSS shimmer animation from globals.css.

Security:
- S3: Documented CORS/auth assumption in code comment — dashboard is
  local-only, no auth needed for dev tool.

New files:
- components/Sparkline.tsx — reusable SVG sparkline component
- api/ollama/chat/route.ts — streaming chat endpoint (from Sprint 6)
- api/ollama/logs/route.ts — Ollama log file reader
- api/whisper/transcribe/route.ts — Whisper STT test endpoint
2026-02-19 15:44:20 -08:00
saravanakumardb1
ed93a6f0af feat(local-llm): Sprint 6 — major feature batch (CQ2,CQ5,CQ6,P5,F4,F10,F14,F16)
Code quality:
- CQ2: Add CSS utility classes (text-primary/secondary/tertiary, bg-*,
  btn-*, input-base) to globals.css — reduces inline style repetition
- CQ5: Add skeleton shimmer animation CSS for loading states
- CQ6: Replace manual model name validation with Zod schema
  (PostBodySchema) in Ollama API route

Performance:
- P5: Eagerly warm static cache on module load — system_profiler
  no longer blocks first dashboard request

Features:
- F4: Chat mode with multi-turn conversation via new /api/ollama/chat
  streaming route. Chat bubble layout, system prompt input, message
  history. Toggle between prompt/chat modes in modal.
- F10: Dark/light theme toggle with CSS var overrides in :root.light.
  Sun/Moon button in header, persisted in localStorage.
- F14: Model tags (coding, chat, fast, vision, reasoning) with
  colored toggle badges in expanded model details. Persisted in
  localStorage.
- F16: Auto-load preferred model — star toggle in expanded details.
  When Ollama is online but no models loaded, auto-loads the starred
  model. Persisted in localStorage.
2026-02-19 15:38:06 -08:00
saravanakumardb1
b1fda3a1a5 perf(local-llm): Sprint 5 — request dedup + cache TTLs (P1, P2, P3)
Performance fixes:
- P1: Add fetchingRef guard to fetchAll() — prevents duplicate requests
  from rapid Refresh button clicks or overlapping interval ticks
- P2: Add 5-minute TTL to staticCache (chip, GPU, brew packages) —
  previously cached indefinitely per server process, now refreshes
  after brew upgrades without requiring a restart
- P3: Add 60-second TTL cache for Ollama models disk usage (du command)
  — previously traversed ~/.ollama/models on every 15s refresh cycle,
  now reuses cached value for 60s
2026-02-19 15:28:07 -08:00
saravanakumardb1
9c2f5f3396 feat(local-llm): Sprint 4 — UX enhancements (F2, F3, F9, F11)
New features:
- F2: Model search/filter — search input above models list (shown when
  4+ models installed). Filters by name, family, and quantization level.
  Press / to focus the search input.
- F3: Prompt history — saves last 20 prompts to localStorage with model
  name and timestamp. History dropdown in prompt modal with one-click
  re-run. Toggle via clock icon in textarea.
- F9: Modelfile viewer — expanded model details now fetch and display
  the Modelfile via the show action. Collapsible <details> element
  with syntax-highlighted pre block.
- F11: Keyboard shortcuts panel — press ? to toggle. Shows all shortcuts:
  ? (help), R (refresh), / (search), Esc (close/cancel), Cmd+Enter (send).
  Shortcuts only fire when not in an input field.
2026-02-19 15:25:43 -08:00
saravanakumardb1
75a3cd0826 refactor(local-llm): Sprint 3 — component extraction, error boundary, security (CQ1,CQ3,CQ4,S1,S2)
Component extraction (CQ1):
- lib/types.ts: All interfaces (OllamaData, SystemData, Toast, etc.)
- lib/format.ts: formatBytes, formatUptime utilities
- lib/ollama-config.ts: Shared OLLAMA_URL constant
- components/StatusDot.tsx: Status indicator component
- components/ProgressBar.tsx: Progress bar component
- page.tsx: Now imports from extracted modules, reduced from 1180 to
  1077 lines (interfaces + utilities + sub-components removed)

Error boundary (CQ4):
- error.tsx: Next.js App Router error boundary with styled error UI,
  stack trace preview, and 'Try again' button

Shared config (CQ3):
- All 3 Ollama API routes now import OLLAMA_URL from lib/ollama-config.ts
  instead of duplicating the env var fallback

Security (S1):
- Add MODEL_NAME_RE regex validation on POST /api/ollama — rejects
  invalid model names before passing to Ollama API

Security (S2):
- Replace exec() with execFile() for brew package version check —
  prevents shell injection if targets list ever becomes dynamic
2026-02-19 15:21:22 -08:00
saravanakumardb1
2d9475bd15 feat(local-llm): Sprint 2 — streaming pull progress, token metrics, fixes (B2/F1,F6,B7,B8)
New features:
- B2/F1: Streaming model pull with real-time progress bar. New
  /api/ollama/pull/route.ts pipes NDJSON from Ollama stream:true.
  UI shows status, completed/total bytes, and percentage during download.
- F6: Token/s metrics after prompt generation. Parses eval_count and
  eval_duration from the final NDJSON chunk. Displays tok/s, total
  tokens, and duration in the prompt modal footer.

Bug fixes:
- B7: Parse vm_stat page size from output instead of hardcoding 16384.
  Reads 'page size of N bytes' from the first line for portability.
- B8: Whisper model discovery now scans multiple directories:
  WHISPER_MODELS_DIR env var, ~/whisper-models, /opt/homebrew/share/
  whisper-cpp/models/, ~/.cache/whisper/. Returns the first dir with
  .bin files found.
2026-02-19 15:16:33 -08:00
saravanakumardb1
2da67c2f74 fix(local-llm): Sprint 1 — critical dashboard bug fixes (B1,B3-B6,B9-B11,P4)
Bug fixes:
- B4: Escape key now respects streaming state — during active stream,
  Escape aborts the generation instead of closing the modal
- B5: Auto-refresh (15s interval) pauses during streaming and pull
  operations to prevent background churn and UI flicker
- B9: Add AbortController to streaming fetch — closing modal or pressing
  Escape cancels the underlying HTTP request, saving CPU/bandwidth
- B1: Header subtitle now dynamically shows chip name and RAM from the
  system API instead of hardcoded 'Apple M4 Pro · 48 GB'
- B11: Escape handler clears promptText and promptResponse on close
- B6: Toast IDs use Date.now()+random instead of incrementing ref
  (prevents collision on HMR remount)
- B10: Brew panel distinguishes 'Loading...' (system=null) from
  'No tracked packages found' (system loaded, empty array)
- B3: Remove dead non-streaming generate action from Ollama API route
- P4: Add 5-second AbortController timeout to all fetchOllama() calls
  to prevent indefinite hangs when Ollama is unresponsive
2026-02-19 15:12:41 -08:00
saravanakumardb1
43f8103c5a fix(local-llm): show accurate macOS memory (app vs cached vs free)
Replace Node.js os.freemem() with vm_stat parsing for macOS. The old
approach reported ~47.7 GB / 48 GB 'used' because os.freemem() only
counts truly free pages, ignoring ~20 GB of inactive/reclaimable cache.

New memory breakdown:
- App Memory: active + wired + compressor (actual process usage)
- Cached: inactive + purgeable + speculative (reclaimable on demand)
- Available: free + cached (what apps can actually use)
- Pressure: normal/warning/critical based on app memory ratio

Dashboard UI updated to show app memory, cached (reclaimable) label,
and pressure-based color coding on progress bars.
2026-02-19 13:22:17 -08:00
saravanakumardb1
970b565026 fix(local-llm): dashboard v2 — streaming prompts, model management, perf fixes
Bug fixes:
- Fix Google Fonts build error (corporate proxy blocks fonts.gstatic.com)
  by removing Geist font imports and switching to system font stack
- Fix system API 7.6s latency by caching static info (chip, GPU, brew)
  with timeouts on shell commands — now responds in ~50ms

New features:
- Streaming prompt responses via NDJSON proxy (/api/ollama/stream)
  with typing cursor animation and auto-scroll
- Model pull UI: input field + button to download new models
- Model delete with two-step confirmation dialog
- VRAM usage and expiry time display for loaded models
- Toast notifications (success/error/info) with slide-in animation
- Copy response button in prompt modal
- Escape key closes modals, backdrop click dismisses
- Pull/delete/show actions added to Ollama API route
2026-02-19 13:03:11 -08:00
saravanakumardb1
2565714c52 feat(local-llm): add Mission Control dashboard v1
Next.js 16 dashboard for monitoring and managing the local LLM stack.
Runs on port 3100 with dark theme using ByteLyst design tokens.

API routes:
- GET/POST /api/ollama — model list, running status, load/unload/generate
- GET /api/whisper — binary discovery, GGML model inventory
- GET /api/system — chip info, RAM/disk usage, brew package versions

Dashboard UI:
- Top stats row: Ollama status, model count, Whisper status, RAM usage
- Ollama models panel with load/unload actions, LOADED badge, details
- System panel with progress bars for RAM and disk
- Whisper.cpp panel with binary list and model inventory
- Brew packages panel with version tracking
- Basic prompt modal with Cmd+Enter shortcut
- Auto-refresh every 15 seconds

Also excludes __LOCAL_LLMs/ from root ESLint config (dashboard has its
own config and uses browser globals not available in Node.js context).

Tech: Next.js 16, React 19, TailwindCSS v4, Lucide icons, TypeScript
2026-02-19 13:02:48 -08:00