- TypeScript 63.1%
- JavaScript 33.9%
- CSS 3%
| apps | ||
| docs | ||
| packages | ||
| tests | ||
| .gitignore | ||
| .prettierignore | ||
| AGENTS.md | ||
| eslint.config.mjs | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| THIRD_PARTY_NOTICES.md | ||
| tsconfig.base.json | ||
Mio AI Lab
A compact Electron desktop app built with React, Tailwind CSS, Radix UI, Framer Motion, and Node.js. The navigation contains Chat, Translation, Providers, Usage, Models, Runtimes, Tasks, and Settings. Settings is a dedicated page with left-side Appearance, Translation, Search, Model testing, Background work, and About categories; category selection supports browser history and direct links. Appearance offers System/Dark/Light themes and System/Reduced/Full motion, applied across the app and persisted across restarts. Runtimes gathers the managed third-party software. About shows live application/runtime versions, OS and architecture, CPU/core/instruction information, RAM, graphics adapters/drivers/reported GPU memory, and capacity/free space on the application data volume. Refresh updates the hardware snapshot; missing readings and detection failures are shown explicitly. Chat V2 provides a local workspace with its own secondary navigation. Managed local runtime downloads and model tests are available.
Translation
Both language pickers offer search, an alphabetical multi-column list, and selection checkmarks. Pin languages inside either picker for shared quick access; pins are saved locally across restarts. Auto detect is available only for the source language. The menu adapts to smaller windows and supports keyboard navigation and Escape to close.
Translation (#translation) translates text with streaming output, Stop, Copy, language selection/swap, and a model picker containing both Translation Models and Text Models. By default it starts after a 900 ms pause in typing or pasting. Translate / Ctrl+Enter also submits immediately. Focus changes and reloads do not resend text. New application sessions start with empty input and output. Paste an image into the input to recognize its text locally before translation. File translation, dictionary, glossaries, and style tools are deferred.
Image OCR
Runtimes → Python · OCR → Set up OCR runtime automatically installs and manages Python on Windows x64. No system Python or launcher is required. The app downloads uv 0.13.5 (SHA-256 a38b8d1902b7cfbc76b423ba1bb456f623f42064cdc72628b6075b89afd1019a), verifies the archive, safely extracts it, and uses its pinned metadata to install CPython 3.12.15 (build 20261021). Python stays under userData/managed/hayai-ocr-v2.5-nova/tools/python; installation disables PATH executable links and Windows registry registration. uv configuration and caches stay app-managed. A private environment per CPU/CUDA device installs PyTorch 2.9.0, Transformers 4.57.1, Pillow 12.0.0, and huggingface-hub 0.36.0. Setup checks imports before publishing readiness, runs as a cancellable/retryable Task, and does not download or load models. Allow several GB for dependencies. Other platforms report that managed OCR Python currently supports Windows x64; there is no fallback to system Python.
Models → OCR Models (#models/ocr) is a separate model library with the same searchable download dialog and info popovers as Translation Models. The initial preset is Hayai OCR v2.5 Nova at revision 4ec63b9d7a52c8a7b6406a658d538ffef2746793, including SigLIP2 NaFlex preprocessing/configuration at b53b807d3a2d5e2b3911292f2d69e5341cdc064c. Every model/configuration/code file has a pinned size and SHA-256; the verified set is published atomically. Downloads use Tasks with progress, cancellation, retries, configured timeout/concurrency, and safe redirect/storage checks. They do not load a model or install the runtime. Select a registered default, rename it, or remove its registration while preserving files. Redownload verifies existing files before registration. A removed default stays unavailable until explicitly selected; model discovery never silently changes it. The model requires its pinned custom Python code (trust_remote_code).
Existing OCR model files from the earlier combined setup are adopted in place when the catalog is first created, without copying/removing them. Existing working Python environments remain usable. New runtime setup uses app-managed Python and separate device environments, preserving the previous environment. Catalog/default/name changes persist in models.json; they do not change Text/Translation model defaults or chat models. Basic availability checks are lightweight; full integrity checks run on explicit download/reregistration, never before each image.
Paste a PNG, JPEG, or WebP crop (maximum 10 MB / 16 million pixels) directly into Text to translate. Its preview appears above the editable text; recognized text is appended below it, preserving any existing source. Recognition automatically feeds the usual translation debounce when automatic translation is enabled; otherwise choose Translate. The output pane is unchanged. Recognition errors keep the image for retry. Remove cancels pending OCR and ignores late results; leaving the page also cancels pending OCR. Images stay in page memory and are not saved. Only recognized text goes to the selected translation provider, which may be remote.
Hayai is a crop recognizer for Japanese, Chinese, Korean, and English, including vertical and multiline manga lettering. Use individual bubbles rather than full pages; page layout detection is not included. OCR can misread or hallucinate lettering; recognized text remains editable. A 512-token recognition limit suits short bubble crops; split very dense crops into smaller images.
OCR runs in a dedicated local Python worker, independently of the app's llama.cpp/Ollama translation connection. Both models can remain loaded; Ollama does not need to host Hayai. CPU is the default to preserve translation VRAM; CUDA explicitly uses the PyTorch CUDA 12.8 wheel and requires a compatible NVIDIA driver and sufficient memory for both models. Save the device preference, then run setup for that device. Quality offers 256/384/512 patches (default 512 for fine manga lettering). Settings persist in the OCR directory's settings.json. No recognition-time network access or automatic device/provider fallback is permitted. The worker stays loaded until settings change, explicit cancel/unload, process failure, or app exit. Startup has a three-minute timeout, recognition five minutes, and each setup command thirty minutes.
node --test tests/ocr.test.mjs tests/ocr-models.test.mjs tests/managed-python.test.mjs covers OCR contracts, worker reuse/cancellation, runtime setup, model integrity/storage checks, legacy adoption, registration/default persistence and preservation. npm run test:ocr:electron covers renderer paste/preview, recognition-to-translation flow, cancellation and settings. npm run test:ocr-models:electron covers category routing, download details, default selection, rename/removal and Runtimes integration. npm run test:ocr:live performs real managed Python/runtime setup, verified model download, Japanese recognition and resident worker reuse in .artifacts/ocr-live (override with MIO_OCR_LIVE_PROFILE; MIO_OCR_LIVE_TOOLS optionally reuses app-managed Python tools). A real CPU run on 2026-10-23 recognized a rendered こんにちは crop correctly using automatically installed Python 3.12.15. This is a narrow runtime smoke, not a manga accuracy benchmark; CUDA and GPU memory fit alongside a translation model remain unverified.
Translation input, output, and section progress are session-only. No translation revisions or history are saved, and there are no revision save/restore or undo/redo controls. Native input-editor undo remains available. A new application session starts with blank input/output and does not replay inference. Language pins, model defaults, and translation preferences remain persisted. Legacy translation/translation.sqlite files are left untouched and are no longer read or written. The retired historyLimit preference is accepted on reads of older settings and omitted from future saves.
Language choices include the languages listed in Tencent's Hy-MT2 model card, plus common Text Model languages. Model-specific translation quality is not guaranteed by the selector. Auto detection uses bundled franc-min statistics locally, with uncertainty for short, mixed, or ambiguous input; it never loads a model or sends text to a provider. Detection identifies English/Chinese without guessing dialect or script variant; explicit American/British and Simplified/Traditional choices remain available. Swap languages also moves the current translated output into the source editor, using a detected source where available; it is disabled while output is stale or active.
Passages up to 200,000 characters split into bounded sections, preserving original line/paragraph separators and outer whitespace. Each request budgets input and output against the selected model's context; estimates are not model-specific tokenizer counts. Output-limit truncation retries smaller sections (bounded to 12 subdivisions). Section progress is visible; blocked, empty, failed, or unfinished responses stop further requests and retain completed/partial output. Retry reuses matching completed sections when source, languages, model/provider versions, and the section plan still match. Up to 4,096 original sections are accepted. There is no cross-section conversation history; very long passages can therefore have terminology inconsistencies. The output-token setting applies per section.
Models → Text Models / Translation Models → Set as default saves a default for each category. The first registered model becomes the initial default. Existing chat overrides are preserved; chats with no override use the current Text Models default. The translator prefers the Translation Models default and uses the Text Models default when no translation model is configured; its picker can override either. Deleted configured defaults remain unavailable until replaced, preventing an unnoticed provider switch. Default IDs persist in settings/model-defaults.json.
Local requests automatically install the selected CPU/CUDA llama.cpp variant if missing, launch it, and wait for the requested GGUF to become ready. With no configured models, the translator's first request downloads/registers Hy-MT2 1.8B Q4_K_M (1.06 GiB), then installs the runtime. Downloads run in Tasks and remain separately cancellable; stopping translation stops its setup wait without cancelling a shared download. No download or generation begins merely by opening the app. Remote Text Models use their configured backend connection; the picker labels their execution location. Local failures never trigger remote/provider/CPU fallback.
Hy-MT2 uses a user translation instruction without a system prompt. Dense 1.8B/7B models use temperature 0.7, top P 0.6, top K 20, and repetition penalty 1.05; 30B-A3B uses top P 1, top K -1, and repetition penalty 1. Text Models retain sampling settings while chat-specific system instructions are replaced by translation instructions for this workflow only. Source/provider version checks reject stale selections. Context/output budgeting, inactivity timeouts, cancellation, sanitized diagnostics, and Usage tracking apply; partial, truncated, empty, or failed results are not labelled complete.
Settings → Translation persists automatic/manual behavior, debounce (300–10,000 ms), inactivity timeout (1–3,600 seconds), and output tokens (64–32,768) in settings/translation.json. Defaults are automatic, 900 ms, 180 seconds, and 4,096 tokens; output is additionally capped by instance settings and half the effective context. Runtimes → llama.cpp exposes resident status, explicit Unload, and idle retention (0–1,440 minutes). The default 0 keeps the model loaded until a model/configuration switch, explicit unload, process failure, or app exit. A lease prevents switches during active local inference, and one shared inference lane serializes chat, translation, and tests. Idle-timeout changes apply after the next request.
Index-Translate 9B is recognized from its GGUF filename/general.name metadata or the remote model ID. The translator applies the official standard translation prompt and generation guidance: one user message using the Chinese instruction template, temperature 0 (greedy), thinking disabled, and no system message. Auto detect omits the source-language name; explicit languages and regional variants use their full picker labels. Sampling filters, seed, penalties, and custom stop strings are omitted so the server/model defaults apply. This profile applies to every section, including when selected from Text Models. Saved model/chat settings are preserved. Existing context and output-token controls remain effective; the official client's 1,024-token default is adjustable guidance rather than a fixed limit. Automated request tests establish the prompt and settings sent; Index-Translate inference quality and runtime compatibility remain unqualified.
Validation: npm run test:translation:electron uses a local fixture provider for paste/edit/debounce, focus/reload deduplication, overrides, streaming cancellation, settings, and chat defaults. npm run test:translation:live uses an existing Hy-MT2 GGUF (MIO_TRANSLATION_GGUF, defaulting to the app-managed 1.8B path) and installs the pinned CPU runtime into an isolated test profile if needed. npm run test:translation:cuda tests Automatic GPU selection and real CUDA translation, reusing the existing pinned CUDA installation from MIO_LIVE_RUNTIME_TOOLS (default .artifacts/live-runtime/tools) when available, otherwise installing it automatically. Real Hy-MT2 1.8B translation passed on CPU and on an NVIDIA RTX 4070 (driver 617.42), including confirmed GPU offload, consecutive-request reuse, Text Model override, and explicit unload. Hy-MT2 7B/30B remain unqualified by these smokes.
Translation Models
Models → Translation Models (#models/translation) manages a separate library of translation-only GGUFs. The native Import GGUF picker registers files in place, without copying or modifying them. Reimporting the same path refreshes its metadata and preserves its registration/name. The bounded GGUF v2/v3 reader reports file size, architecture, tensor/parameter counts, tensor types, tokenizer/context/license fields when supplied, and counted previews for large arrays. It reads at most 64 MiB of headers and never decodes tensor weights. Metadata is a snapshot, not a runtime compatibility guarantee. Translation models do not appear in Conversations or text-model tests. Rename changes the display name; Remove deletes only the registration, preserving imported and downloaded files.
Download models opens a searchable, built-in preset index. The Q4_K_M presets below come from Tencent's official Hugging Face repositories; revisions, byte sizes, and LFS SHA-256 hashes were verified on 2026-10-23. The modal exposes these pins, license/source links, and memory notes. File sizes are not runtime memory requirements; 30B-A3B has approximately 3B active parameters but still stores the full mixture-of-experts weights.
| Model | File bytes | Pinned revision | Official source |
|---|---|---|---|
| Hy-MT2 1.8B | 1,133,080,448 | a0c709d9fac510f2c807aa3af52872340dc37a4a |
Tencent 1.8B GGUF |
| Hy-MT2 7B | 4,624,648,896 | ab8472660ac61fac25f1af43fac2599d52a8a775 |
Tencent 7B GGUF |
| Hy-MT2 30B-A3B | 18,236,702,880 | fd3dcbb6b31e9e03923ef4f9f42500f74c3851c3 |
Tencent 30B GGUF |
The index also includes all 12 text-model variants from IndexTeam's official Index-Translate 9B GGUF repository: Q2_K, Q3_K_S/M/L, IQ4_XS, Q4_K_S/M, Q5_K_S/M, Q6_K, Q8_0, and F16. Revision 645939fbab839a656f1bc39975a872bc8ad749f8, exact byte sizes, and LFS SHA-256 hashes were checked on 2026-10-23. Q4_K_M is the recommended balance (5,780,090,304 bytes); lower-bit options trade quality for size. Runtime/context buffers need additional memory. Image projector supplements are excluded from this text-only catalog. Download availability does not establish live runtime compatibility or translation quality; these variants have not been qualified with local inference.
Downloads run in the existing task queue and survive page navigation. Tasks exposes progress, cancel, and retry for failed/cancelled/interrupted downloads. Storage is userData/managed/translation-models/<preset-id>/; the isolated registry is userData/models/translation/text-models.json and preserves existing text-model data. Downloads use HTTPS with bounded redirects to approved Hugging Face storage hosts, preflight free disk space, reject linked storage paths, stream into unique staging files, check pinned length/SHA-256, inspect GGUF, and publish atomically before registration. Failed or cancelled partial downloads are removed; completed files remain if registration fails and are reverified on retry. Removing and redownloading a preset verifies and re-registers its existing file. Changed files are preserved and fail verification. Retries restart incomplete transfers; there is no partial-file resume.
Existing Settings → Background work → Download request timeout / Simultaneous downloads controls apply to model downloads as well. Increase the default 600-second request timeout for large models or slow connections. Management remains separate from inference: importing, browsing presets, and choosing category defaults do not start a model. Run npm run test:translation-models:electron for the isolated-profile management smoke test; download failure/security tests use small GGUF fixtures, not full model weights.
Providers
Providers → Text providers registers OpenAI-compatible connections independently of models. Add, edit, and remove registrations; save a registration without contacting it, or choose Save & validate. Each provider shows its base URL, encrypted-key presence, timeout, validation status/time, and a searchable, read-only snapshot of available models. Selecting a provider is URL-backed and survives reloads; registrations and discovery results persist across app restarts. There are no model add, selection, configuration, or inference actions here.
Presets use official documented endpoints: OpenAI, DeepSeek, Groq, Mistral, OpenRouter, and xAI. Custom APIs can use their own base URL; remote connections require HTTPS, while localhost supports HTTP for local endpoints. Custom endpoints may be keyless.
Registrations are atomically persisted to Electron application data under providers/text-providers.json. API keys are encrypted with Electron safeStorage and never returned by the preload API. Saving a key fails if OS encryption is unavailable or Linux would use plaintext storage. An empty key field while editing retains the existing key; custom providers can explicitly remove it. Changing endpoints requires re-entering or removing the key, and changing connection details clears old validation and model discovery. Provider names and per-provider connection timeouts (1–60 seconds) are adjustable here; this feature adds no global Settings entries.
Validation performs bounded GET /models requests (16 MiB, at most 10,000 models) within the configured deadline. Redirects are refused and TLS verification remains enabled. A successful authenticated response is compared with an anonymous request: a public catalog cannot certify an API key and is marked Key unverified. OpenRouter additionally uses its authenticated GET /key endpoint. Validation supports cancellation, redacts credentials, does not display provider error bodies, and retains a clearly labelled older catalog after refresh failure. Model catalogs can contain non-text models, and successful discovery does not establish inference permissions, quota, or billing readiness.
Development
Use Node.js 22 LTS (22.16 or newer) and npm.
npm install
npm run dev
Development builds the shared/backend/desktop packages, starts Vite on 127.0.0.1:5173, then opens Electron. Restart npm run dev after backend, contracts, or desktop changes; frontend and shared UI changes hot reload. The frontend can run in a browser, but desktop status requires the Electron preload bridge.
npm run build
npm start
This starts Electron against the built frontend; it does not produce a distributable installer. Packaging, signing, and updates are future work.
Workspace
apps/desktop: Electron lifecycle, sandboxed preload, validated IPC.apps/frontend: React workspace and hash-backed navigation.apps/backend: Node.js services hosted by the main process; no separate HTTP server.packages/contracts: Public service/IPC types and input validation.packages/ui: Shared Radix-based controls.
The renderer has no Node.js access. A narrow typed preload API retrieves status, reads/writes validated appearance preferences, retrieves a local system snapshot, and manages text provider registrations. Appearance preferences are atomically saved to settings/appearance.json under Electron’s application data directory; invalid existing files produce a visible error and are preserved. Hardware detection uses the backend-only systeminformation library and does not expose device serials, hostnames, or arbitrary commands/paths to the renderer. Unexpected IPC arguments, untrusted callers, new windows, and unsolicited permissions are rejected. Provider validation sends the registered API key only to that provider’s endpoint on explicit request. Provider validation does not transmit prompts or conversation content. Model tests send only the explicit test prompt and saved system instructions to the selected endpoint.
Validation
npm run typecheck
npm run lint
npm run format:check
npm test
npm run build
npm run test:electron
npm run test:providers:electron
npm run test:usage:electron
Tests cover trusted renderer URLs, IPC arguments, appearance validation, persistence, serialized writes, corrupt-file preservation, failed-write recovery, partial hardware probe failure, and GPU memory conversion. test:electron checks preload IPC, sandbox settings, the Chat V2 workspace, removed V1 APIs, settings categories, history navigation, persisted appearance after reload, system-theme changes, and About loading in a native window, uses an isolated profile under .artifacts/, briefly shows it without requesting focus to capture .artifacts/electron-smoke.png, then exits. GPU details depend on OS/driver reporting; unreported memory is shown as unavailable and is not estimated from Windows AdapterRAM. CPU instruction reporting can be incomplete. Hardware discovery does not certify AI runtime compatibility.
Provider tests also cover registry persistence, encrypted credential boundaries, endpoint/key changes, anonymous catalogs, redirects, response limits, failure redaction, cancellation/races, corrupt registries, and authenticated discovery against a local HTTP fixture. test:providers:electron runs registration/edit/removal dialogs, real OS credential encryption, validation, read-only model search, reload persistence, rejected-key handling, and cancellation in an isolated profile, capturing .artifacts/providers-electron-smoke.png. These fixtures do not establish live hosted-provider compatibility; no live provider credentials are included.
Manual validation should additionally check Back/Forward, navigation toggling, keyboard focus and settings category navigation, and resizing.
Usage
Usage is a dedicated, hash-routed page with browser history for date ranges, combined filters, grouping, time intervals, and request-history pages. It shows input/output/total reported tokens, token-reporting coverage, request/failure counts, cumulative duration, daily or monthly UTC timelines, category breakdowns, and 50-row history pages. Group and filter by provider name, model, activity, modality, execution location, or outcome. Provider IDs remain on historical records (hover a provider in history); names are snapshots at execution time. Refresh reads the latest ledger.
The backend-only UsageStore writes a local SQLite WAL ledger under usage/usage.sqlite in Electron application data, independent of provider registrations. Request IDs are unique for idempotent recording. Missing token counts and non-inference activity are explicitly distinct from reported zero; totals never estimate missing usage. Provider verification is recorded as one logical attempt, potentially comprising multiple HTTP requests, with metadata modality and not-applicable tokens. Success means discovery completed, not necessarily that an API key was verified. Failed and cancelled attempts are included. Local means a localhost endpoint; remote means another host, rather than a claim about its hardware.
Historical conversation activity remains in the same backend usage ledger, including the actual model, execution location, outcome, and provider-reported counts. No renderer write API exists. This feature does not backfill earlier activity, obtain account-wide billing, estimate cost, or log prompts, responses, endpoint URLs, credentials, or raw error bodies. Attempts interrupted by a process crash before completion cannot currently be reconstructed. Input/output totals are disjoint counts supplied by the inference adapter; cached/reasoning subdivisions must not be double-counted.
Settings review: date ranges, categories, grouping, and intervals belong on Usage and persist in its URL. Recording is automatic and local; no ineffective global toggles or new application-wide preferences were added. Existing settings and provider data are preserved. Usage tests cover persistence, idempotency, token coverage, filtering, UTC boundaries, monthly grouping, pagination, invalid inputs, and verification integration.
test:usage:electron seeds an isolated fixture ledger, verifies populated totals and token coverage, combined routing/filter/group behavior, Back navigation, and rejected invalid IPC, then captures .artifacts/usage-electron-smoke.png. The standard Electron smoke also checks the empty Usage page. These fixtures do not make paid inference requests or establish live-provider token accounting.
Models
Models → Text Models manages named, reusable configurations. Add a model from a searchable registered provider catalog or choose a local GGUF v2/v3 file with the native picker. Edit, duplicate with independent settings, filter/search, inspect, and remove configurations. Selection is hash-backed and survives reloads. Removal never changes original GGUF files or provider models. Missing providers/catalog models leave saved configurations intact and visibly unavailable.
Per-instance settings include optional temperature, top P, output-token limit, seed, frequency/presence penalties, system prompt, stop sequences, and context-window budgeting (also used for local context allocation). Blank numeric settings inherit provider/runtime defaults. Settings review: model sampling choices stay on the instance; runtime defaults live under Runtimes → llama.cpp and download concurrency under Settings → Background work. The Test action uses the saved settings for one explicit inference request; provider/model support varies.
The backend serializes writes and atomically persists validated configurations and local metadata under models/text-models.json in Electron application data. Corrupt registries are preserved and reported. Local file reads are authorized through the native picker; renderer calls accept source IDs, never arbitrary file paths. Registering a local reference does not install a runtime or copy model files. The separate Test action loads the GGUF in the downloaded runtime. Choose the same file again to refresh metadata. File presence/integrity is not monitored between inspections.
The detail pane shows source provenance, provider validation/catalog timestamps, file size/inspection time, settings, and searchable source metadata. Provider discovery now retains bounded additional model fields (such as architecture, capabilities, context, pricing, and licensing when present), redacting credential-like fields and the active API key. Existing catalogs gain these fields on the next explicit provider validation. GGUF inspection reads the header, all metadata keys, tensor type counts and parameter counts, with tensor previews and counted previews for large arrays/strings. Limits: 64 MiB header, 10,000 metadata fields, 100,000 tensors, one million array elements, bounded nesting, and 4 MiB extracted metadata. Unsupported/truncated files fail visibly. No metadata is guessed or fetched from third-party sites.
tests/models.test.mjs covers validation, source authorization, independent reusable settings, persistence, corrupt-file preservation, GGUF bounds/truncation, tensor inspection, source-file preservation, and provider metadata redaction.
npm run test:models:electron exercises local and remote model forms, a fixture-backed searchable provider catalog, the native picker IPC boundary with an injected test selection, add/edit/duplicate/remove, independent instance settings, metadata search, source filtering, Back/Forward, reload persistence, narrow-window layout, and invalid IPC rejection. It captures .artifacts/models-electron-smoke.png using an isolated profile. The actual operating-system file dialog, large production GGUF files, and live-provider metadata remain manual checks. The test also exercises streaming test inference against a local fixture; it makes no paid requests.
Testing a model instance
Test opens a prompt dialog with the provider, endpoint, execution location, and model visible. Run test sends one backend-only POST /chat/completions request using the saved system prompt, sampling settings, seed, penalties, and stop sequences. The output-token override starts from the saved limit, or 256 if unset. The dialog also has a 1–3,600 second inactivity timeout (default 60 seconds remotely and 180 seconds locally, configurable in Settings → Model testing). These temporary choices stay in the test dialog; saved model settings and application-wide Settings remain unchanged. The OpenAI preset uses max_completion_tokens; other compatible providers use max_tokens. Requests use SSE streaming with usage reporting enabled, with support for a provider returning a single JSON response. Unsupported parameters produce a visible error; no automatic retries or setting changes occur. See the Chat Completions reference for the wire contract.
Responses stream into the dialog; reasoning output, when supplied, is separate. Results show elapsed/first-output time, provider-reported token counts (including explicit zero), and finish reason. Stop cancels a test through the task manager. Closing the dialog, navigating away, and renderer reload leave background work running; Tasks and the model dialog can reattach. Application shutdown cancels queued/active work and releases owned processes. Partial output remains available in memory. Inference tasks are serialized; downloads use a separate queue. The service bounds input, output, response bytes, and time; credentials stay in the backend, active-key echoes are redacted across streaming chunk boundaries, and diagnostics never expose raw provider error bodies or transport exceptions. Stale provider/model snapshots are rejected before sending prompts, preventing tests against changed connections or settings.
Each attempted network test records a model-test Usage event with the actual provider/model, execution location, outcome, duration, and reported tokens when available. Test prompts/responses and system instructions are not persisted in the ledger or logged. Interrupted streams and stopped requests can have unavailable usage. Local GGUF tests use the downloaded, owned llama.cpp variant (CPU or CUDA) and record local usage with the instance name. Registered localhost providers also work. No local operation falls back to remote execution.
Metadata now uses chips for reported capabilities, supported parameters, modalities, boolean flags, and compact value lists. Capability summaries appear near the model heading. Compact nested objects use labelled property rows; large structures and truncated previews stay expandable. Search and a complete source JSON view preserve access to all stored fields.
tests/model-tests.test.mjs covers input/connection boundaries, saved-setting propagation, split SSE and UTF-8 parsing, credential redaction, usage, JSON responses, cancellation/timeouts/shutdown, malformed and bounded responses, and sanitized provider/transport failures. The Models Electron smoke covers the prompt dialog, partial streaming, stop/retry, error states, per-test overrides, Usage integration, local-runtime messaging, capability chips, and nested metadata. It also captures .artifacts/models-test-electron-smoke.png. Live-provider inference and model-specific parameter support still require manual validation.
Managed runtimes
Runtimes gathers third-party software in a card grid with local logos, installed status, green Install and red Remove actions. Open a card for runtime information and validated settings. llama.cpp has CPU/CUDA variants in one modal; Python · OCR manages Python, uv, OCR dependencies, and recognition preferences. Model files remain under Models. The application currently uses llama.cpp rather than Ollama.
Installed runtimes auto-start with the app by default, with models unloaded. llama.cpp starts a private authenticated loopback router with model auto-loading disabled; Python starts an isolated interpreter without importing Torch/Transformers or loading OCR weights. Missing software is skipped without downloads. Startup does not block opening the desktop. Runtime cards and modals show startup state and failures. Start automatically with Mio AI Lab in each modal applies next launch and persists separately in settings/runtime-startup-llama-cpp.json and settings/runtime-startup-python.json. The idle process stops before its normal model worker starts or its files are changed/removed; all owned processes stop at app exit. Model loading and retention after actual use keep their existing behavior. uv remains an installation helper rather than a resident service. The llama.cpp launch uses the pinned build's router mode.
Install queues a background task; progress and failures remain available in Tasks after navigation. Remove asks for confirmation, stops the owned idle runtime, and deletes only its application-managed runtime files. Models and preferences are preserved. Active work blocks removal; future local requests may automatically reinstall a required runtime. Application-wide download concurrency and timeouts remain in Settings → Background work.
Background tasks and local GGUF inference
Open a local instance under Models → Text Models → Test and choose Run test. Missing runtimes install automatically through Tasks; Download runtime remains available for advance installation. The request loads or reuses the original GGUF and applies its saved context, system instructions, sampling controls, penalties, seed, and stop sequences. The test output limit starts from the instance limit (or 256). Local tests default to 180 seconds of inactivity. Response activity resets this timer; there is no total generation deadline. Model loading uses the separate loading timeout; queued time does not consume either allowance.
Runtimes → llama.cpp manages CPU/CUDA selection, variant downloads and metadata, CUDA GPU layers, CPU threads (default at most 8, leaving two logical CPUs free where possible), default local context (4,096 tokens), loading timeout (120 seconds), and idle retention. Settings → Background work manages simultaneous downloads (2, adjustable 1–3) and a download request timeout (600 seconds, adjustable 60–86,400; applies to newly started archive requests). A saved instance context overrides the runtime default. Lower thread counts leave more CPU available for the desktop; larger contexts need more RAM. There is one inference lane, independent from the download lane. Preferences are validated and atomically stored in settings/execution.json.
The managed runtime is llama.cpp b11744, Windows x64, with CPU and CUDA 13.4 variants, downloaded from its official release. No third-party executables or model weights are bundled in the repository or application. The CPU archive (23,959,334 bytes) is pinned to SHA-256 e268ed355671854784889ccedeb8f55d46092f644cd84114a70d411424eeea8b. Downloads allow only HTTPS GitHub release hosts, bounded redirects, the exact pinned size, and the expected digest. Extraction rejects traversal, Windows path aliases, duplicate paths, links, encrypted entries, and excessive counts/sizes. Files are extracted into a unique application-owned stage and published atomically after verification; original license/dependency notices remain in the downloaded distribution. Cancellation cleans up the staging directory. Existing user-managed installations/files are never overwritten or removed. A damaged managed installation reports an error for review rather than overwriting unexpected files.
Variants live side by side under Electron application data tools/llama-cpp-b11744-cpu and tools/llama-cpp-b11744-cuda. A manifest records version, archive digest, and executable metadata. Tests perform inexpensive manifest/executable/source-file checks, not a full model or runtime checksum scan on every generation. The runtime executes directly without a shell or visible console, on a private loopback port with an ephemeral API key, offline mode, disabled web UI, and explicit variant, GPU-layer, context, and thread settings. Environment-based llama.cpp overrides are removed. Model readiness is checked against the private model alias. The shared resident runtime keeps the model loaded after standalone tests, complete agent turns, and translations. It stops for a model/configuration switch, explicit unload, configured idle timeout, or graceful app shutdown. Unsupported GGUF architectures, missing files, model-loading failures, memory pressure, and timeouts are visible. Managed downloads support Windows x64; CUDA requires a compatible NVIDIA GPU and driver. No runtime binaries are assumed on PATH.
Tasks has durable SQLite WAL metadata under tasks/tasks.sqlite. Both download and inference work has a stable task ID, queue/running/final state, phase, timestamps, cancellation, and error details. Downloads show byte progress and can be retried after failure/cancellation/interruption. A repeated active download returns the existing task. Publication has a short non-cancellable commit window. History retains up to 500 completed tasks; in-flight records become interrupted on restart, with no automatic inference replay or hidden downloads. Inference output is retained for the latest 50 tests in memory only; prompts, credentials, system instructions, and responses are absent from persistent task history. The global task indicator stays visible on every page. The selected task has a hash-backed URL.
tests/background.test.mjs covers independent queues, bounded concurrency, deduplication, queued/running cancellation, commit boundaries, restart recovery, history persistence, settings validation/persistence, download size/hash checks, unsafe ZIP paths/links, redirect rejection, cleanup, and keeping inference payloads out of task history. The existing Models Electron smoke now verifies that closing a test preserves work and that Tasks can cancel it.
Real validation used the downloaded official runtime and ggml-org's small stories15M GGUF fixture in an isolated profile. CPU generation, saved settings/context, streaming, local token accounting, runtime exit, Tasks output, navigation, and renderer reload passed. This is execution/lifecycle evidence, not model-quality, large-model, or packaged-distribution qualification. npm run test:local:electron repeats the optional real smoke with already-downloaded tools/model fixtures; set MIO_LIVE_RUNTIME_TOOLS and MIO_LIVE_GGUF to existing fixture paths, or use the default .artifacts/live-runtime/ layout. This optional test does not download assets automatically.
CPU and CUDA variants
Runtimes → llama.cpp → Local inference variant offers Automatic, CPU, or CUDA 13.4 for local chat, translation, and model tests. Automatic is the default and chooses CUDA when the first NVIDIA GPU reports compute capability 7.5+ and driver branch 580+; otherwise it selects CPU before loading. These baseline checks follow NVIDIA's CUDA compatibility guidance and architecture support guidance. Loading still requires actual confirmed GPU layer offload. A CUDA loading failure never triggers an automatic CPU retry. Explicit CPU/CUDA choices disable automatic selection and persist immediately. Settings shows the resolved variant. Hardware detection uses bounded, hidden, backend-only calls to the NVIDIA driver's nvidia-smi.exe at known absolute Windows locations, once per app lifetime; restart to refresh detection after hardware/driver changes.
Both variants belong to the single llama-cpp tool; both may be installed, but the shared inference queue runs only one instance at a time. The next local request installs its selected variant automatically if missing. Download CPU and Download CUDA remain available for advance installation. Downloads have task deduplication, aggregate byte progress, cancellation, and retries; a retry retains its original variant. Existing installations/manifests and other preferences are preserved. Legacy CPU preferences adopt Automatic, legacy CUDA preferences retain manual CUDA, and new manual choices remain explicit through runtimeSelection in settings/execution.json. Migration does not rewrite files during reads. CUDA GPU layers still default to 999.
CUDA is installed as one atomic variant from two separately downloaded and verified archives from the same official b11744 release:
| Component | Bytes | SHA-256 |
|---|---|---|
| llama.cpp CUDA 13.4 runtime | 159,578,798 | 60c1b55085e1f2834b3f39b08c6430dfc5d06546f8a3183a10794b299be12714 |
| CUDA 13.4 runtime/cuBLAS DLLs | 423,535,356 | 738f8c251ac22b70c3ae6f83a10cf222725df0395246a2cf58f32bdb85fbe668 |
Total download: 583,114,154 bytes (about 556 MiB), plus extraction space. Both components must pass exact size/SHA-256 validation before the combined installation is published. The CUDA extractor has bounded limits sized for the larger dependency DLLs (1 GiB per file, 2 GiB per archive); the tighter CPU bounds are unchanged. A failed dependency download/hash leaves CPU usable and publishes no partial CUDA installation. Distribution license notices remain with the downloaded files. Neither the app nor repository contains third-party runtime binaries or model weights; validation downloads live only under ignored .artifacts/ directories.
CUDA GPU layers accepts 1–999 (999 requests all model layers). CUDA explicitly targets the first visible NVIDIA device (CUDA0) and disables automatic memory fitting; CPU explicitly requests zero GPU layers. Choose fewer layers for intentional partial CPU/GPU offload, or reduce context/model size if VRAM is insufficient. Choose the CPU variant explicitly for CPU-only execution. The pinned server documentation describes these underlying controls. Local test requests capture the selected variant when queued, so later Settings changes cannot silently alter their execution location. Dialogs show the currently selected variant and the variant used by an attached task; Usage provider labels distinguish local CPU and local CUDA.
Missing CUDA installs, incompatible GPUs/drivers, dependency failures, and zero GPU offload produce actionable failures. There is no automatic CPU or remote fallback. The pinned runtime exposes layer-offload diagnostics at trace verbosity; the application captures only a bounded startup window and requires positive GPU layer offload before allowing generation. After readiness, process output is drained and discarded without retaining prompts or responses. All existing cancellation, loopback authentication, offline mode, model settings, owned-process release, and task persistence behavior applies to both variants.
Validation includes legacy CPU migration, independent variant installation, two-component integrity/publication, task identities/progress, CUDA launch arguments, no-fallback failures, positive offload confirmation, and preserving an explicitly queued CPU choice after preferences change. The optional Electron fixture supports npm run test:cuda:electron (or MIO_LIVE_RUNTIME_VARIANT=cuda with the local smoke). It requires an already-downloaded CUDA installation in MIO_LIVE_RUNTIME_TOOLS and an existing MIO_LIVE_GGUF; no assets download automatically during this test. Real generation was validated with the small stories15M GGUF on both CPU and an NVIDIA RTX 4070, including GPU offload, saved settings, local token accounting, task output after reload, persisted selection, one-tool counting, and retrying the original variant. This does not qualify large models, all NVIDIA architectures/drivers, or GPU performance.
Chat V2 workspace
Chat opens a focused transcript/composer workspace. New chat, search, pinned/recent chats, and an Archived view live in a secondary sidebar inside Conversations. The application sidebar contains only app sections. Projects appear as expandable folder groups with nested chats in this conversation-level navigation, above general Recents. V1 conversation UI, persistence, execution, IPC, response versions, and chat settings have been retired. On startup the application removes the V1-owned conversations directory and conversation image cache, and discards V1 conversation task records. There is no history migration.
Provider connections and encrypted credentials, model registrations/defaults, runtimes and downloads, translation, usage history, and Search settings are preserved. Search/page/image services, safe image loading and cache code, inference/context budgeting, and the generic tool runner remain as foundations; Chat V2 now runs explicit text turns through the shared inference service. The saved image policy is retained for V2.
Drafts save locally as you type, independently for the new-chat composer and each saved chat. A new chat becomes a saved record on its first Save message or Send submission. Choose Save messages only to avoid inference, or select a model to send the saved prompt and selected history to that model. Failed preparation keeps the user message available for an explicit retry. The composer shows Saving / Saved / Failed state and offers retry or explicit reload of the saved draft after errors. Drafts and messages are stored unencrypted in a separate versioned SQLite workspace at userData/chat-v2/workspace.sqlite.
Search matches chat names, selected-history message text, and saved drafts within the selected active/archive view. Pinned chats sort first. Rename, pin/unpin, archive/restore, and confirmed permanent deletion are available from each chat’s actions. Archive keeps messages and drafts, and blocks editing until restored. Delete removes the chat’s messages and draft while preserving usage and shared configuration. The sidebar shows up to 200 results; narrow the search to find older chats.
Projects are created from a name and optional description; they have no host-directory setting or filesystem access. Each project owns its chats, a separate new-chat draft, and saved instructions. Use Project context (or select the project folder) to edit its name, description, and instructions. Instructions are returned with every chat in that project, independently of general chats and other projects, and are included in text-turn context. Existing schema-1 chats and drafts migrate to the general scope in a transaction.
The context drawer includes Overview, Instructions, Sources, Memory, and Outputs. Name/description/instructions are editable and saved explicitly, with stale-revision rejection and a reload action that discards local editor changes. Sources, Memory, and Outputs currently show honest empty states; ingestion, recall, and artifact generation remain separate checklist work. Chat actions include Move chat between General chats and projects. The confirmation explains that visible content may contain previously recalled information. Messages, drafts, attachments, and outputs move together; old derived context is invalidated, and shared project sources/instructions stay behind. Active chat work blocks movement.
Project deletion and Clear general chats (beside Recents) show a review summary and require explicit acknowledgement. A changed scope requires refreshing the summary before confirmation. Deletion removes owned chats, drafts, context, and asset registrations, cancels active work, and prevents late publication. App-owned files are cleaned asynchronously. Other scopes, original files, shared configuration, and usage remain intact.
Use Edit on a user message to save a revised prompt as a new branch. The old prompt and continuation remain available through the compact alternative selector. Assistant answers can have sibling alternatives with independent continuations; switching an alternative follows its latest saved continuation. The selected history survives reload, and the unsent composer draft is preserved. Archived chats and chats with active work must be restored/stopped before changing history.
Schema 5 migrates existing linear messages without losing content. Backend context snapshots, message recall, and branch-owned assets follow only the selected ancestry. Branch changes invalidate unsupported derived context and reject stale saves/publication. All branches move with the chat and are removed by permanent chat/scope deletion. The text-turn runner generates sibling alternatives for Retry and Continue, preserving the original answer. Rich response parts remain later plan work.
Settings review: project instructions and metadata stay in the project context drawer rather than application Settings. Persistence is always enabled for this local workspace. Search/archive filters and chat actions belong in the conversation sub-navigation, with no additional application preferences needed yet. Appearance and reduced-motion settings apply. Editing and alternative selectors stay beside messages and add no application preferences. The model picker and response limits live beside the composer; rich responses and dedicated Sources/Memory/Tools settings remain planned in the Chat V2 design.
Validation: npm run test:chat:electron exercises draft reload, first submission, page navigation, search, pin/rename/archive/restore/delete and IPC validation using an isolated profile. It writes .artifacts/chat-v2-workspace.png. Backend tests cover restart persistence, V1 cleanup isolation, stale revisions, duplicate submissions, literal search, and cascade deletion. npm run test:projects:electron checks project creation, nested navigation, independent drafts, saved instructions, shared-context panels, reload, small-window layout, deletion confirmation, and IPC validation. Project tests also cover the schema-1 migration and cross-project replay protection. npm run test:scope-management:electron checks moving between projects and General, disclosure acknowledgement, draft retention, cancellation, stale deletion reviews, and scope isolation. Backend movement tests cover rollback, active work, replay protection, dependency invalidation, and owned-file cleanup. npm run test:branches:electron checks editing/cancel, prompt/answer alternative navigation, original continuations, draft retention, persisted selection, and IPC validation. tests/chat-branches.test.mjs covers migration, ancestry isolation, stale authority, derived evidence, rollback, and active-work guards.
Backend context isolation
Chat V2 now has chat-bound storage/retrieval, tool, asset, and background-job APIs. Scope is derived from the saved chat and revalidated before reads and publication; the global navigation catalog is reserved for explicit user browsing. Memory-ignored operations retain project instructions/sources while disabling recall and contributions. Job outputs remain staged until success, stale work cannot publish, and asset reads require ownership and integrity checks. See scope isolation for the access matrix, migration, settings review, and integration contract. Text generation is available; the dedicated source/memory/output workflows remain pending.
Shared inference and capabilities
Text/translation model details now show Inference capabilities, with Available, Unavailable, and Not reported states. Expand a row for its evidence and limitation. Reports distinguish implemented adapter features from saved catalog declarations and the existing reasoning-effort profiles. Discovery does not verify generation access. Unknown function-tool support is unavailable; image input, structured-output formats, embeddings, image generation, and request reconnection remain unsupported by this text adapter. Models explicitly reported as incompatible with text/streaming cannot run the streamed model test.
The backend shared InferenceClient/InferenceService handles text/SSE/JSON requests, function tools, reasoning fields, cancellation, inactivity timeouts, context budgeting, credential-safe errors, and usage. Translation uses it directly; model-test IPC/jobs retain their compatible facade. Capability inspection uses saved registrations/metadata and does not decrypt credentials, launch runtimes, contact providers, or send prompts. No settings or credentials were migrated, and no capability override preference was added. Chat V2's durable text-turn runner consumes this shared interface; question cards, tools, and rich response parts remain separate work. See the inference contract.
Validation: tests/inference.test.mjs covers capability evidence, unsupported/unknown gates, protocol history, streaming tool calls, non-streaming requests, selection revisions, cancellation/timeouts, safe error codes, and usage. npm run test:inference:electron checks read-only capability IPC, model details, disabled incompatible tests, and reload with zero inference calls. Existing model, agent, translation, reasoning, and runtime tests cover the shared execution foundation.
Durable text turns
Choose a response model beside the composer, then Send or Generate response. The picker shows provider, connection state, and local/remote location. Response options set the output limit, inactivity timeout, and supported thinking effort for the next turn. The configured text default or last recorded model is restored visibly; unavailable selections never fall back to another provider. Save messages only retains the local-only workflow.
Turns survive page navigation and renderer reloads. Stop response keeps the last committed partial output. Retry response generates a sibling alternative; Continue response creates a new request that supplies the selected partial answer and appends its continuation into a new alternative. Both are explicit provider requests, with normal usage attribution. Changed model/provider or project instructions require Retry with the reviewed current context. Partial answers stay labelled and are excluded from automatic past-chat recall.
Schema 6 stores turn identity/settings/context checkpoints, ordered streaming state, completion metadata, and a bounded event journal in the existing unencrypted Chat V2 database. On app restart, queued/running turns become interrupted; valid committed partials remain visible. The app never automatically repeats or reconnects an interrupted provider call. A backend waiting checkpoint survives restart, while question-card presentation/replies remain the next separate capability.
Moves are blocked during active turns and discard private execution checkpoints when completed chats move; visible replies and model labels are retained. Scope deletion counts saved turns, cancels active work, and removes its checkpoints/events. Shared configuration, provider credentials, models/runtimes, translation, and usage remain intact. See turn lifecycle and recovery for boundaries and limitations.
Validation: tests/chat-turns.test.mjs covers persistence, source isolation, sequence guards, active locks, duplicate requests, partial cancellation, failures, restart/shutdown recovery, explicit continuation, scope invalidation/deletion, and checkpoint cleanup on moves. npm run test:turns:electron uses an isolated local HTTP fixture to check startup recovery without replay, Send/stream/Stop, navigation/reload, Retry/Continue, failure recovery, usage, and small-window layout. These checks do not certify live provider compatibility or downloaded-model/GPU behavior.