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
fix: distinguish llama.cpp standby from setup gaps
Adam Eivy5233605e4877
diff --git a/client/src/components/providers/ProviderCard.jsx b/client/src/components/providers/ProviderCard.jsxindex 0bd693104a..0c11ba82f7 100644--- a/client/src/components/providers/ProviderCard.jsx+++ b/client/src/components/providers/ProviderCard.jsx@@ -18,7 +18,6 @@ import {PROVIDER_CARD_STATE,filterHardwareCompatibleProviderModels,isApiProvider,- isGrokBuildCli,gatewayForProvider,isPrivateNetworkEndpoint,isProcessProvider,@@ -33,7 +32,7 @@ import {import { formatContextLength } from '../../utils/formatters';import ProviderRuntimeStatus from './ProviderRuntimeStatus';import ProviderReadiness from './ProviderReadiness';-import { GrokUploadWarning, GatewayKeyHint } from './ProviderNotices';+import { GatewayKeyHint } from './ProviderNotices';// One phrasing for "this command isn't on the CoS Agent Runner's allowlist".// The editor states the same thing in its own inline banner, in prose.@@ -433,8 +432,6 @@ export default function ProviderCard({)}</div>- {isGrokBuildCli(provider) && <GrokUploadWarning className="max-w-3xl" />}-{gatewayForProvider(provider) && (<GatewayKeyHintgateway={gatewayForProvider(provider)}diff --git a/client/src/components/providers/ProviderNotices.jsx b/client/src/components/providers/ProviderNotices.jsxindex 812de063c8..b5ad0994fb 100644--- a/client/src/components/providers/ProviderNotices.jsx+++ b/client/src/components/providers/ProviderNotices.jsx@@ -1,29 +1,12 @@/**- * The two credential/privacy notices a provider surface renders: the Grok Build- * CLI's repo-upload disclosure and a gateway-backed OpenCode wrapper's "the key- * lives on the sibling API provider" hint.+ * Credential guidance shared by a provider card and editor: a gateway-backed+ * OpenCode wrapper's "the key lives on the sibling API provider" hint.*- * Shared because both the provider CARD and the provider EDITOR show them — the+ * Shared because both the provider CARD and the provider EDITOR show it — the* card so the state is visible at a glance, the editor so the user reads it* before enabling. Keeping one copy is what stops the two from drifting.*/-// Privacy disclosure for the Grok Build CLI/TUI: its harness uploads the entire-// working repo to xAI (GCP) as it works unless the user opts out. Shown both on-// the provider card and in the create/edit form (before enabling) — see-// isGrokBuildCli for which providers match.-export function GrokUploadWarning({ className = '' }) {- return (- <div className={`text-xs rounded-md border border-port-warning/40 bg-port-warning/10 text-port-warning px-2.5 py-2 leading-relaxed ${className}`}>- ⚠️ The Grok harness uploads your <span className="font-semibold">entire working repo</span> to- xAI (GCP) as it works. To keep your code local, add the following to{' '}- <code className="font-mono">~/.grok/config.toml</code> before enabling this provider:- <pre className="mt-1.5 whitespace-pre rounded bg-port-bg/60 px-2 py-1.5 font-mono text-[11px] text-port-warning">{`[harness]-disable_codebase_upload = true`}</pre>- </div>- );-}-// A gateway-backed OpenCode wrapper (opencode-orcarouter / opencode-openrouter// and their -tui twins) keeps no key of its own — at spawn time the server// copies the key from the sibling API provider whose id equals the gateway id.diff --git a/client/src/components/providers/ProviderReadiness.jsx b/client/src/components/providers/ProviderReadiness.jsxindex 21f9dafdcc..0b52cae1aa 100644--- a/client/src/components/providers/ProviderReadiness.jsx+++ b/client/src/components/providers/ProviderReadiness.jsx@@ -10,7 +10,7 @@* transcript.** `readiness` is one entry of the map from `GET /api/providers/readiness`- * (`{ kind, label, endpoint, ready, checks, manageUrl, setup }`).+ * (`{ kind, label, endpoint, ready, standby, checks, manageUrl, setup }`).* Renders nothing without one, so providers with no local dependency — and* cards drawn before the fetch resolves — show no checklist at all.*@@ -36,7 +36,7 @@*/import { Link } from 'react-router';-import { CheckCircle2, Download, HelpCircle, RefreshCw, Wand2, Wrench, XCircle } from 'lucide-react';+import { CheckCircle2, Download, HelpCircle, PauseCircle, RefreshCw, Wand2, Wrench, XCircle } from 'lucide-react';import Banner from '../ui/Banner';import Pill from '../ui/Pill';@@ -72,7 +72,7 @@ function CodeText({ text }) {export default function ProviderReadiness({ readiness, onAutoSetup, onUseServedModel, onServeWantedModel, serving = false, className = '' }) {if (!readiness || !Array.isArray(readiness.checks) || readiness.checks.length === 0) return null;- const { label, endpoint, ready, checks, manageUrl, setup } = readiness;+ const { label, endpoint, ready, standby, standbyDetail, checks, manageUrl, setup } = readiness;if (ready) {return (@@ -82,6 +82,23 @@ export default function ProviderReadiness({ readiness, onAutoSetup, onUseServedM);}+ if (standby) {+ return (+ <Banner+ tone="info"+ size="sm"+ icon={PauseCircle}+ className={className}+ title={`${label} installed · standby`}+ >+ {standbyDetail && <p className="mt-1 text-gray-400"><CodeText text={standbyDetail} /></p>}+ {manageUrl && (+ <Link to={manageUrl} className={`${ACTION_CLASS} mt-2`}>Open the LLMs page</Link>+ )}+ </Banner>+ );+ }+const blocked = checks.filter((check) => check.ok !== true).length;return (diff --git a/client/src/components/providers/ProviderReadiness.test.jsx b/client/src/components/providers/ProviderReadiness.test.jsxindex 6329551124..3dcd2b0b51 100644--- a/client/src/components/providers/ProviderReadiness.test.jsx+++ b/client/src/components/providers/ProviderReadiness.test.jsx@@ -40,6 +40,18 @@ describe('ProviderReadiness', () => {expect(screen.queryByText(/setup incomplete/)).toBeNull();});+ it('shows installed, stopped llama.cpp as standby instead of incomplete setup', () => {+ renderWithRouter(<ProviderReadiness readiness={readiness({+ standby: true,+ standbyDetail: 'No model server is running, which is a valid idle state. Choose a GGUF preset when needed.',+ })} />);++ expect(screen.getByText('llama.cpp installed · standby')).toBeTruthy();+ expect(screen.getByText(/valid idle state/)).toBeTruthy();+ expect(screen.getByText('Open the LLMs page').closest('a').getAttribute('href')).toBe('/models/llms');+ expect(screen.queryByText(/setup incomplete/)).toBeNull();+ });+it('counts only the unmet requirements, and shows each fix', () => {renderWithRouter(<ProviderReadiness readiness={readiness()} />);// The `server` failure plus the `model` check that could not be evaluated —diff --git a/client/src/pages/AIProviders.jsx b/client/src/pages/AIProviders.jsxindex d91730aff4..43d41d8ff9 100644--- a/client/src/pages/AIProviders.jsx+++ b/client/src/pages/AIProviders.jsx@@ -4,7 +4,7 @@ import { AlertTriangle, Gauge } from 'lucide-react';import toast from '../components/ui/Toast';import * as api from '../services/api';import socket from '../services/socket';-import { filterHardwareCompatibleProviderModels, filterSelectableModels, filterGenerationModels, isEmbeddingModel, isProviderHardwareCompatible, isProviderModelHardwareCompatible, mergeModelLists, configuredDefaultIn, localBackendForProvider, modelOptionLabel, providerTypeClass, isTuiProvider, isApiProvider, isProcessProvider, isGrokBuildCli, isLocalEndpoint, isLocalInstanceProvider, effectiveModelContextWindow, isRunnerAllowedCommand, effortLevelsForProvider, isOllamaBackedProvider, gatewayForProvider, isClaudeCommandProvider, generationControlsFor, providerRuntimeKey, providerCardState, PROVIDER_CARD_STATE } from '../utils/providers';+import { filterHardwareCompatibleProviderModels, filterSelectableModels, filterGenerationModels, isEmbeddingModel, isProviderHardwareCompatible, isProviderModelHardwareCompatible, mergeModelLists, configuredDefaultIn, localBackendForProvider, modelOptionLabel, providerTypeClass, isTuiProvider, isApiProvider, isProcessProvider, isLocalEndpoint, isLocalInstanceProvider, effectiveModelContextWindow, isRunnerAllowedCommand, effortLevelsForProvider, isOllamaBackedProvider, gatewayForProvider, isClaudeCommandProvider, generationControlsFor, providerRuntimeKey, providerCardState, PROVIDER_CARD_STATE } from '../utils/providers';import useLocalModels from '../hooks/useLocalModels';import { useAutoRefetch } from '../hooks/useAutoRefetch';import BrailleSpinner from '../components/BrailleSpinner';@@ -25,7 +25,7 @@ import useDrawerTab from '../hooks/useDrawerTab';import { FormField } from '../components/ui/FormField';import RuntimeInstallModal from '../components/install/RuntimeInstallModal';import ProviderCard from '../components/providers/ProviderCard';-import { GrokUploadWarning, GatewayKeyHint } from '../components/providers/ProviderNotices';+import { GatewayKeyHint } from '../components/providers/ProviderNotices';import CollapsibleSection from '../components/ui/CollapsibleSection';// The two local apps an API provider can front. Their installer lives on the@@ -1469,8 +1469,6 @@ function ProviderForm({ provider, onClose, onSave, onEditProvider, allProviders<span className="text-sm text-gray-400">Enabled</span></label>- {isGrokBuildCli({ type: formData.type, command: formData.command }) && <GrokUploadWarning />}-{gatewayForProvider(provider) && (<GatewayKeyHintgateway={gatewayForProvider(provider)}diff --git a/client/src/pages/AIProviders.test.jsx b/client/src/pages/AIProviders.test.jsxindex b50655ad5c..3748e99cc2 100644--- a/client/src/pages/AIProviders.test.jsx+++ b/client/src/pages/AIProviders.test.jsx@@ -138,6 +138,33 @@ describe('AIProviders page load error handling', () => {expect(screen.queryByRole('button', { name: /Install OpenCode CLI/ })).not.toBeInTheDocument();});+ it('does not recommend disabling Grok codebase upload on the card or editor', async () => {+ api.getProviders.mockResolvedValue({+ providers: [{+ id: 'grok-tui',+ name: 'Grok Build TUI',+ type: 'tui',+ command: 'grok',+ args: [],+ enabled: true,+ models: ['grok-configured-default'],+ defaultModel: 'grok-configured-default',+ }],+ activeProvider: 'grok-tui',+ });++ renderPage();++ expect(await screen.findByText('Grok Build TUI')).toBeInTheDocument();+ expect(screen.queryByText(/uploads your entire working repo/i)).not.toBeInTheDocument();+ expect(screen.queryByText(/disable_codebase_upload/i)).not.toBeInTheDocument();++ fireEvent.click(screen.getByRole('button', { name: 'Edit' }));+ expect(await screen.findByRole('heading', { name: 'Edit Provider' })).toBeInTheDocument();+ expect(screen.queryByText(/uploads your entire working repo/i)).not.toBeInTheDocument();+ expect(screen.queryByText(/disable_codebase_upload/i)).not.toBeInTheDocument();+ });+it('explains why the install action is unavailable and links the vendor instructions', async () => {api.getProviders.mockResolvedValue({providers: [{ id: 'opencode-ollama', name: 'OpenCode Ollama', type: 'cli', command: 'opencode', args: ['run'], enabled: true }],diff --git a/client/src/utils/providers.js b/client/src/utils/providers.jsindex 248a643e5b..fdbddcc0d8 100644--- a/client/src/utils/providers.js+++ b/client/src/utils/providers.js@@ -1433,12 +1433,9 @@ const credentialMissing = (provider, { keySetFor = null, envVarSet = null } = {}/*** Check if a provider is the Grok Build CLI/TUI (the `grok` command harness).- * Mirrors the Grok detection in `knownProviderContextWindow`: matches the shipped- * `grok-cli` / `grok-tui` samples or any process provider whose command basename- * is `grok`. Used to surface the `~/.grok/config.toml` privacy notice: the Grok- * harness uploads the entire working repo to xAI/GCP as it works unless the user- * opts out via `[harness] disable_codebase_upload = true`. The plain `grok` API- * provider (type `api`) doesn't run the harness, so it's intentionally excluded.+ * Matches the shipped `grok-cli` / `grok-tui` samples or any process provider+ * whose command basename is `grok`; the plain Grok API provider is excluded.+ * Reviewer-model discovery uses this for custom Grok process providers too.*/export const isGrokBuildCli = (provider) => {if (!isProcessProvider(provider)) return false;diff --git a/server/lib/README.md b/server/lib/README.mdindex 42c37ad340..be192419f0 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -172,7 +172,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| `providerGateways.js` | `PROVIDER_GATEWAYS` — one row per hosted OpenAI-compatible gateway an OpenCode CLI/TUI wrapper can front-end (`orcarouter`, `openrouter`), plus `PROVIDER_GATEWAY_IDS`, `gatewayById`, `isGatewayNamespace(ns)` and `gatewayForProvider(config)` → row or null. Each row's `id` is simultaneously the OpenCode provider namespace, the `gatewayBacked` marker value, and the id of the sibling `api` record that owns the key — so the sibling lookup is `providers[gateway.id]` and an OrcaRouter key can never satisfy an OpenRouter wrapper. Replaces the `orcarouterBacked` boolean + literal `'orcarouter'` that had been hand-copied across ~15 server and client files (namespace resolution, the OpenCode config builder, both zod schemas, the model-fetcher table, the sibling-key attach, the prerequisite check, and the two "not a local runtime" carve-outs in `cliChildEnv.js`/`localProviderRuntime.js`). Reads the legacy per-gateway boolean FOREVER, so stored records are never rewritten. Distinct from a local runtime (`ollamaBacked`, `vllmBacked`, …): remote, always authenticating, and no thinking toggle. Deliberately mirrored in `aiToolkit/internal/gateways.js` (the vendored toolkit may not import out) and `client/src/utils/providers.js` (the browser cannot import server code) — `providerGateways.parity.test.js` fails when the first two drift. Dependency-light: imports nothing. || `providerTranscriptUsage.js` | Parsers for the real per-message token counts the coding CLIs write to disk (0 tokens to read) — `parseClaudeTranscript` (`~/.claude/projects/<cwd-slug>/*.jsonl`), `parseCodexRollout` (`~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl`), `claudeProjectSlug`, `totalTranscriptTokens`. Both de-duplicate a format hazard that otherwise inflates counts badly: Claude repeats one response across several lines sharing a `message.id`, and Codex's `total_token_usage` is cumulative and repeated. Each parser returns per-model buckets (`byModel`) plus the message keys it counted (`countedKeys`), and accepts an `exclude` set — that is what stops two overlapping PortOS runs from both billing the same messages. Tolerant of truncated (mid-write) files; consumed by `services/usageReconciler.js`. || `opencodeConfig.js` | OpenCode config builder — `buildOpencodeEnvVars(provider, model)` builds dynamic `OPENCODE_CONFIG_CONTENT` declaring model ids under the namespace the provider's marker selects: a local runtime (`ollama` / `mtplx` / `llama` / `vllm` / `sglang`, bare ids) or a hosted gateway from `providerGateways.js` (`vendor/model` ids kept whole). Fixes --model rejection. Also attaches the key for a key-bearing namespace, and pins `small_model` to the run model for a gateway so OpenCode's own side calls (titles, summarization) can't land on its built-in default — a billed model the operator never chose. |-| `localProviderRuntime.js` | Which LOCAL daemon a provider talks to, and where — `LOCAL_RUNTIMES` (llama.cpp / Ollama / LM Studio / MTPLX / vLLM: label, binary, canonical base URL read from `opencodeConfig.js` rather than re-typed, manage/docs links, model-download hint), `localBackendForProvider` + `localEndpointPort` + `isLocalInstanceHost` (moved here from `services/localModelHealing.js`, which re-exports them, so the healing path and the readiness checklist classify a provider identically — loopback/bind-all only, so a LAN/Tailscale peer on port 11434 is NOT claimed as a local daemon), `localRuntimeKind(provider)` (the `*Backed` markers first, then that classifier; `orcarouter` excluded as a remote API), `localRuntimeForProvider(provider)` → the row with the endpoint the provider ITSELF configures (`OPENCODE_CONFIG_CONTENT`'s `baseURL`, `ANTHROPIC_BASE_URL`, or `endpoint`), then the `OLLAMA_URL`/`OLLAMA_HOST`/`LM_STUDIO_URL` override the backend managers read, then the canonical default — and `null` when that resolved endpoint fails `isLocalInstanceEndpoint` (an API provider on another machine has no local daemon to check, whatever its name says) — plus `normalizeOpenAiBaseUrl`. Pure; the probing half is `services/providerReadiness.js`. Optional `setupStateDetail` overrides `providerReadiness`'s per-state prose for a runtime whose local setup is not a model cache (vLLM's is a compose project). |+| `localProviderRuntime.js` | Which LOCAL daemon a provider talks to, and where — `LOCAL_RUNTIMES` (llama.cpp / Ollama / LM Studio / MTPLX / vLLM: label, binary, canonical base URL read from `opencodeConfig.js` rather than re-typed, manage/docs links, model-download hint), `localBackendForProvider` + `localEndpointPort` + `isLocalInstanceHost` (moved here from `services/localModelHealing.js`, which re-exports them, so the healing path and the readiness checklist classify a provider identically — loopback/bind-all only, so a LAN/Tailscale peer on port 11434 is NOT claimed as a local daemon), `localRuntimeKind(provider)` (the `*Backed` markers first, then that classifier; `orcarouter` excluded as a remote API), `localRuntimeForProvider(provider)` → the row with the endpoint the provider ITSELF configures (`OPENCODE_CONFIG_CONTENT`'s `baseURL`, `ANTHROPIC_BASE_URL`, or `endpoint`), then the `OLLAMA_URL`/`OLLAMA_HOST`/`LM_STUDIO_URL` override the backend managers read, then the canonical default — and `null` when that resolved endpoint fails `isLocalInstanceEndpoint` (an API provider on another machine has no local daemon to check, whatever its name says) — plus `normalizeOpenAiBaseUrl`. Pure; the probing half is `services/providerReadiness.js`. Optional `setupStateDetail` overrides `providerReadiness`'s per-state prose for a runtime whose local setup is not a model cache (vLLM's is a compose project); `standbyWhenStopped` marks an installed runtime such as llama.cpp whose stopped state is intentional standby rather than incomplete setup. || `managedDaemon.js` | Shared mechanism for the local daemons PortOS runs as optional PM2 processes (`services/llamaServerManager.js` → `portos-llama-server`, `services/mtplxServerManager.js` → `portos-mtplx`). Owns their PM2 process names — `LLAMA_APP`, `MTPLX_APP`, and the `isModelServerProcess(name)` predicate over them — so a caller like the CoS health monitor can recognize a model server without importing a manager; the managers re-export the two names. `createDaemonWatcher({...})` supplies the common PM2 launch-line re-adoption, endpoint probe, status skeleton, bounded log view, and port-release wait while managers retain daemon-specific parsing and lifecycle policy. `createDaemonLogBuffer({maxLines?})` is the bounded timestamped ring buffer of what PortOS logged around a launch, plus `withPm2Logs(output)` → that buffer followed by anything `pm2 logs` has which it doesn't already hold, deduped and re-capped (PM2's lines are a VIEW, never folded into the buffer — PM2 owns them and re-reads them every status call). `pm2ArgValue(args, flag)` reads one value back out of a PM2 process's recorded argv so a manager can recover a still-online daemon's launch config after a PortOS restart; `null` means the flag was absent, which a relaunch must leave off rather than defaulting. Also the shared **idle reaper**, for a daemon that cannot release its weights any other way: `registerIdleDaemon({name, getIdleMs, stop})` (seeds `lastUsedAt` to NOW, so a hand-started daemon gets a full window), `markDaemonUsed(name)` — call on real traffic, NEVER on a status poll — `daemonLastUsedAt(name)`, `idleWindowMs(minutes)` (minutes → ms; `0` = never, `null` = not configured, kept distinct), `reapIdleDaemons(now?)` → the names stopped, and `startIdleReaper({intervalMs?})` / `stopIdleReaper()` (ONE interval for all registrants, `unref`'d, idempotent). `mtplxServerManager` is the only registrant: llama.cpp releases its checkpoint in place via `--sleep-idle-seconds` and must NOT be stopped for it. Deliberately mechanism only — what a launch line means and when a daemon may start is exactly what differs between the two. || `mtplxModels.js` | `listMtplxCachedModels({command?})` → `{models, error}` from `mtplx models --json` (a local directory listing — no network, no model load) and `pickMtplxCachedModel(models)` → the repo id to hand `mtplx serve --model`. `models: null` means the cache could not be READ (no binary, command failed, unparseable) and is deliberately distinct from `[]` (read, and empty), because `services/localRuntimeSetup.js` starts MTPLX on its own default in the first case and refuses with the `mtplx pull` command in the second. Exists because `mtplx serve` defaults `--model` to one hard-coded checkpoint and exits 1 before binding when that repo is not cached — even on a host holding a different MTP model that serves fine. Picks only entries MTPLX itself calls complete (`validation.ok !== false`, so a half-finished pull is not served), preferring one with a recorded `mtplx_runtime.json` exactness contract. `describeMtplxCache(cache)` → `{state: 'unknown'\|'empty'\|'partial'\|'ready', model, count, error}` folds both into the one value `services/providerReadiness.js` puts on the checklist and `describeRuntimeSetup` picks a button from — so an empty cache is named up front instead of only inside the failure of a Start that could never work. || `vllmQwenProject.js` | `resolveVllmProjectDir()` / `inspectVllmQwenProject()` → `{dir, hasProject, composeFile, hasWeights, weightsRoot}` for the operator-cloned syv-ai/qwen38-27b-rtx3090 compose project, plus `vllmStartBlockedReason(project)` → the prose refusal (or `null`), and `vllmProjectSetupState(project)` → `ready`/`empty`/`unknown` for the readiness checklist. Directory reads only — never runs docker or touches a registry. `hasWeights` is tri-state: `true` found / `false` caches read and empty / `null` no cache readable (a docker-volume cache is invisible from a native-Win32 PortOS), and `services/localRuntimeSetup.js` refuses to `docker compose up` on anything but `true` so the start button can never kick off the ~20 GB prepare. Overrides: `VLLM_QWEN_PROJECT_DIR`, `VLLM_QWEN_WEIGHTS_DIR`. |diff --git a/server/lib/capabilityMap.js b/server/lib/capabilityMap.jsindex 3552e11626..b357028e56 100644--- a/server/lib/capabilityMap.js+++ b/server/lib/capabilityMap.js@@ -73,6 +73,7 @@ export function providersRow(let unavailable = 0;let blocked = 0;let unknown = 0;+ let standby = 0;let setupReady = 0;for (const p of enabled) {const prerequisite = hasPrerequisiteReadiness ? prerequisiteReadiness[p.id] : null;@@ -90,6 +91,10 @@ export function providersRow(}if (localReadinessRequested && localRuntimeForProvider(p)) {const local = hasLocalReadiness ? localReadiness[p.id] : null;+ if (local?.ready !== true && local?.standby === true) {+ standby += 1;+ continue;+ }if (local?.ready === false) {const checks = Array.isArray(local.checks) ? local.checks : [];if (checks.length > 0 && checks.every((check) => check?.ok !== false)) unknown += 1;@@ -107,18 +112,19 @@ export function providersRow(else unavailable += 1;}let status = OK;- if (available === 0) status = unknown > 0 ? WARN : ERROR;+ if (available === 0) status = unknown > 0 || standby > 0 ? WARN : ERROR;else if (unavailable > 0 || blocked > 0 || unknown > 0) status = WARN;const parts = [`${enabled.length} enabled`, `${available} ready`];if (unavailable > 0) parts.push(`${unavailable} unavailable`);if (blocked > 0) parts.push(`${blocked} need setup`);if (unknown > 0) parts.push(`${unknown} still checking`);+ if (standby > 0) parts.push(`${standby} standby`);return row('providers', 'AI Providers', '/ai', {status,configured: true,summary: parts.join(' · '),detail: prerequisiteReadinessRequested- ? { configured: enabled.length, available, unavailable, blocked, unknown, setupReady }+ ? { configured: enabled.length, available, unavailable, blocked, unknown, standby, setupReady }: { configured: enabled.length, available, unavailable },setupRequired: true,setupComplete: prerequisiteReadinessRequested ? setupReady > 0 : available > 0,diff --git a/server/lib/localProviderRuntime.js b/server/lib/localProviderRuntime.jsindex 0c42884564..bddaf89803 100644--- a/server/lib/localProviderRuntime.js+++ b/server/lib/localProviderRuntime.js@@ -149,6 +149,14 @@ export const LOCAL_RUNTIMES = Object.freeze({// `providerReadiness.js` offer to relaunch the same weights under the id the// provider asks for.aliasFlag: '--alias',+ // A stopped llama-server is not an incomplete installation. Unlike an+ // always-on API daemon, llama.cpp needs a concrete GGUF launch choice; once+ // started with idle release enabled it unloads that checkpoint in place+ // and reloads it on the next request. Keep the stopped state visible as+ // standby without turning every enabled llama-backed provider into a setup+ // failure on the capability map.+ standbyWhenStopped: true,+ standbyDetail: 'No model server is running, which is a valid idle state. Choose a GGUF preset in Models → LLMs when you want to start one; with idle release configured, llama.cpp unloads it in place and reloads it on the next request.',}),ollama: Object.freeze({id: 'ollama',@@ -323,7 +331,7 @@ export function localRuntimeKind(provider) {* The local runtime a provider needs, with the endpoint PortOS should probe.** @param {object|null|undefined} provider- * @returns {{kind:string,label:string,command:string|null,endpoint:string|null,manageUrl:string|null,docsUrl:string,modelsHint:string}|null}+ * @returns {{kind:string,label:string,command:string|null,endpoint:string|null,manageUrl:string|null,docsUrl:string,modelsHint:string,standbyWhenStopped?:boolean,standbyDetail?:string}|null}*/export function localRuntimeForProvider(provider) {const kind = localRuntimeKind(provider);diff --git a/server/routes/capabilities.test.js b/server/routes/capabilities.test.jsindex 8598724e8c..884f2b3c3b 100644--- a/server/routes/capabilities.test.js+++ b/server/routes/capabilities.test.js@@ -176,4 +176,34 @@ describe('GET /api/capabilities', () => {detail: { blocked: 1, setupReady: 0 },});});++ it('does not degrade runnable providers when installed llama.cpp providers are in standby', async () => {+ getAllProviders.mockResolvedValueOnce({+ activeProvider: 'cloud',+ providers: [+ { id: 'cloud', enabled: true, type: 'api', endpoint: 'https://api.example.com/v1', hasApiKey: true },+ { id: 'llama-cli', enabled: true, type: 'cli', command: 'opencode', llamaBacked: true, endpoint: 'http://127.0.0.1:5568/v1' },+ { id: 'llama-tui', enabled: true, type: 'tui', command: 'opencode', llamaBacked: true, endpoint: 'http://127.0.0.1:5568/v1' },+ ],+ });+ getProviderPrerequisiteReadinessMap.mockResolvedValueOnce({+ cloud: { status: 'ready', reasonCodes: [] },+ 'llama-cli': { status: 'ready', reasonCodes: [] },+ 'llama-tui': { status: 'ready', reasonCodes: [] },+ });+ getProviderReadinessMap.mockResolvedValueOnce({+ 'llama-cli': { ready: false, standby: true },+ 'llama-tui': { ready: false, standby: true },+ });++ const res = await request(makeApp()).get('/api/capabilities');++ expect(res.status).toBe(200);+ expect(byId(res.body, 'providers')).toMatchObject({+ status: 'ok',+ summary: '3 enabled · 1 ready · 2 standby',+ setupComplete: true,+ detail: { available: 1, blocked: 0, standby: 2, setupReady: 1 },+ });+ });});diff --git a/server/services/providerReadiness.js b/server/services/providerReadiness.jsindex a4f5d89065..a97f29fa8a 100644--- a/server/services/providerReadiness.js+++ b/server/services/providerReadiness.js@@ -373,6 +373,10 @@ export async function getProviderReadiness(provider, deps = {}) {// Resolved BEFORE the checks so each unmet one can point at the button that// fixes it rather than at a setup doc.const setup = describeRuntimeSetup(runtime.kind, { installed, running: result.reachable, weights });+ const standby = runtime.standbyWhenStopped === true+ && installed+ && !result.reachable+ && !weightsBlockStart(weights);const checks = [runtimeCheck(runtime, { onPath, appInstalled, installed, reachable: result.reachable, setup }),@@ -391,6 +395,11 @@ export async function getProviderReadiness(provider, deps = {}) {// `ready` is strict: a check that could not be evaluated (`ok: null`) is not// a pass, so the card never claims a provider is good to go on unknowns.ready: checks.every((check) => check.ok === true),+ // Standby is deliberately separate from `ready`: no endpoint is currently+ // available, but an installed model-selecting runtime is not missing setup+ // merely because no model was chosen to occupy resources right now.+ standby,+ standbyDetail: standby ? runtime.standbyDetail : null,checks,// What a one-click "set this up for me" button can do about the unmet// checks, or `null` when nothing here is auto-fixable (seediff --git a/server/services/providerReadiness.test.js b/server/services/providerReadiness.test.jsindex ada438eaef..6ebf30e912 100644--- a/server/services/providerReadiness.test.js+++ b/server/services/providerReadiness.test.js@@ -68,13 +68,14 @@ describe('getProviderReadiness', () => {expect(readiness.checks.map((check) => check.ok)).toEqual([true, true, true]);});- it('separates "not installed" from "installed but not running" — the two different fixes', async () => {+ it('separates missing llama.cpp from its installed, intentionally stopped standby state', async () => {const missing = await getProviderReadiness(llamaProvider(), {findCommand: () => null,probe: unreachable(),});expect(checkById(missing, 'runtime').ok).toBe(false);expect(checkById(missing, 'runtime').fixHint).toMatch(/Install llama\.cpp/);+ expect(missing.standby).toBe(false);const stopped = await getProviderReadiness(llamaProvider(), {findCommand: () => '/opt/homebrew/bin/llama-server',@@ -84,6 +85,15 @@ describe('getProviderReadiness', () => {expect(checkById(stopped, 'server').ok).toBe(false);expect(checkById(stopped, 'server').fixHint).toMatch(/Start llama\.cpp/);expect(stopped.ready).toBe(false);+ expect(stopped.standby).toBe(true);+ expect(stopped.standbyDetail).toMatch(/valid idle state/);++ const missingWeights = await getProviderReadiness(llamaProvider(), {+ findCommand: () => '/opt/homebrew/bin/llama-server',+ probe: unreachable(),+ readWeights: async () => 'empty',+ });+ expect(missingWeights.standby).toBe(false);});it('counts a responding endpoint as installed even with nothing on PATH', async () => {