Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(computers): Settings -> Computers section with add wizard and console
rubenluetke10-beep9e86b7849546
diff --git a/jarvis/plugins/tool/navigate.py b/jarvis/plugins/tool/navigate.pyindex ff1dd7d713..c1e3800e74 100644--- a/jarvis/plugins/tool/navigate.py+++ b/jarvis/plugins/tool/navigate.py@@ -43,6 +43,8 @@ KNOWN: frozenset[str] = frozenset("apikeys",# Local models: the Ollama server, installed models and the catalogue."local-models",+ # Computers: the user's servers and local VMs, reached over SSH.+ "computers","settings","telephony","telephony-setup",@@ -159,6 +161,15 @@ _ALIASES: dict[str, str] = {"wiki": "memory","local models": "local-models","local-models": "local-models",+ "computers": "computers",+ "servers": "computers",+ "vps": "computers",+ "virtual machines": "computers",+ "virtual machine": "computers",+ "vms": "computers",+ "virtuelle maschinen": "computers", # i18n-allow: input vocab+ "ordenadores": "computers", # i18n-allow: input vocab+ "servidores": "computers", # i18n-allow: input vocab"local model": "local-models","ollama": "local-models","lokale modelle": "local-models", # i18n-allow: input vocabdiff --git a/jarvis/ui/web/frontend/src/assets/providers/LOGOS.md b/jarvis/ui/web/frontend/src/assets/providers/LOGOS.mdindex 0c0614011d..00a26ab823 100644--- a/jarvis/ui/web/frontend/src/assets/providers/LOGOS.md+++ b/jarvis/ui/web/frontend/src/assets/providers/LOGOS.md@@ -52,10 +52,13 @@ Two render paths, chosen per file and recorded in the table:| antigravity | lobehub/lobe-icons `antigravity-color.svg` | MIT | colour | 2026-08-23 || cartesia | Cartesia's own site icon, `https://cartesia.ai/favicon.svg` | vendor asset | own ground | 2026-08-23 || claude | lobehub/lobe-icons `claude-color.svg` | MIT | colour | 2026-08-23 |+| digitalocean | simple-icons `digitalocean.svg` (Computers section, cloud import) | CC0-1.0 | mono | 2026-09-28 || elevenlabs | lobehub/lobe-icons `elevenlabs.svg` | MIT | mono | 2026-08-23 || gemini | lobehub/lobe-icons `gemini-color.svg` | MIT | colour | 2026-08-23 || google-cloud | lobehub/lobe-icons `googlecloud-color.svg` (Vertex AI cards) | MIT | colour | 2026-08-23 || groq | lobehub/lobe-icons `groq.svg` | MIT | mono | 2026-08-23 |+| hetzner | simple-icons `hetzner.svg` (Computers section, cloud import) | CC0-1.0 | mono | 2026-09-28 |+| hostinger | simple-icons `hostinger.svg` (Computers section, cloud import) | CC0-1.0 | mono | 2026-09-28 || inworld | Inworld's own site icon, `https://inworld.ai/icon.png` (PNG, 180 px) | vendor asset | own ground | 2026-08-23 || nvidia | lobehub/lobe-icons `nvidia-color.svg` | MIT | colour | 2026-08-23 || ollama | lobehub/lobe-icons `ollama.svg` | MIT | mono | 2026-08-23 |diff --git a/jarvis/ui/web/frontend/src/assets/providers/digitalocean.svg b/jarvis/ui/web/frontend/src/assets/providers/digitalocean.svgnew file mode 100644index 0000000000..df79e20586--- /dev/null+++ b/jarvis/ui/web/frontend/src/assets/providers/digitalocean.svg@@ -0,0 +1 @@+<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12.04 0C5.408-.02.005 5.37.005 11.992h4.638c0-4.923 4.882-8.731 10.064-6.855a6.95 6.95 0 014.147 4.148c1.889 5.177-1.924 10.055-6.84 10.064v-4.61H7.391v4.623h4.61V24c7.86 0 13.967-7.588 11.397-15.83-1.115-3.59-3.985-6.446-7.575-7.575A12.8 12.8 0 0012.039 0zM7.39 19.362H3.828v3.564H7.39zm-3.563 0v-2.978H.85v2.978z"/></svg>\ No newline at end of filediff --git a/jarvis/ui/web/frontend/src/assets/providers/hetzner.svg b/jarvis/ui/web/frontend/src/assets/providers/hetzner.svgnew file mode 100644index 0000000000..e9604913ba--- /dev/null+++ b/jarvis/ui/web/frontend/src/assets/providers/hetzner.svg@@ -0,0 +1 @@+<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M0 0v24h24V0H0zm4.602 4.025h2.244c.509 0 .716.215.716.717v5.64h8.883v-5.64c0-.509.215-.717.717-.717h2.229c.5 0 .71.23.724.717v14.516c0 .509-.215.717-.717.717h-2.23c-.51 0-.717-.215-.717-.717v-5.735H7.562v5.735c0 .516-.215.717-.716.717H4.602c-.51 0-.717-.208-.717-.717V4.742c0-.509.207-.717.717-.717z"/></svg>\ No newline at end of filediff --git a/jarvis/ui/web/frontend/src/assets/providers/hostinger.svg b/jarvis/ui/web/frontend/src/assets/providers/hostinger.svgnew file mode 100644index 0000000000..7bb829384d--- /dev/null+++ b/jarvis/ui/web/frontend/src/assets/providers/hostinger.svg@@ -0,0 +1 @@+<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M16.415 0v7.16l5.785 3.384V2.949L16.415 0ZM1.8 0v11.237h18.815L14.89 8.09l-7.457-.003V3.024L1.8 0Zm14.615 20.894v-5.019l-7.514-.005c.007.033-5.82-3.197-5.82-3.197l19.119.091V24l-5.785-3.106ZM1.8 13.551v7.343l5.633 2.949v-6.988L1.8 13.551Z"/></svg>\ No newline at end of filediff --git a/jarvis/ui/web/frontend/src/components/layout/MainView.tsx b/jarvis/ui/web/frontend/src/components/layout/MainView.tsxindex 19366046e2..495f2f0d7c 100644--- a/jarvis/ui/web/frontend/src/components/layout/MainView.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/MainView.tsx@@ -510,6 +510,7 @@ function SwitchOnActiveSection({ active }: { active: string }) {case "telephony":case "telephony-setup":case "local-models":+ case "computers":case "wallpaper":case "costs":case "feedback":diff --git a/jarvis/ui/web/frontend/src/components/layout/navGroups.ts b/jarvis/ui/web/frontend/src/components/layout/navGroups.tsindex c4c2dd8727..0b43cb5334 100644--- a/jarvis/ui/web/frontend/src/components/layout/navGroups.ts+++ b/jarvis/ui/web/frontend/src/components/layout/navGroups.ts@@ -21,6 +21,7 @@ import {Mic,Notebook,ScrollText,+ Server,Settings,Shapes,Share2,@@ -213,6 +214,14 @@ export const NAV_GROUPS: NavItem[][] = [icon: OllamaIcon,fallbackLabel: "Local models",},+ // Computers: the servers and virtual machines Jarvis can work on besides+ // this one — a rented VPS, a hosting-account import, a local Multipass VM.+ {+ id: "computers",+ labelKey: "nav.computers",+ icon: Server,+ fallbackLabel: "Computers",+ },{id: "settings",labelKey: "nav.settings",@@ -277,6 +286,7 @@ export const SETTINGS_HUB_IDS: readonly SectionId[] = ["telephony","telephony-setup","local-models",+ "computers","wallpaper","costs","feedback",diff --git a/jarvis/ui/web/frontend/src/components/providers/ProviderLogo.tsx b/jarvis/ui/web/frontend/src/components/providers/ProviderLogo.tsxindex 2d5db20ea3..b25df17d86 100644--- a/jarvis/ui/web/frontend/src/components/providers/ProviderLogo.tsx+++ b/jarvis/ui/web/frontend/src/components/providers/ProviderLogo.tsx@@ -29,11 +29,14 @@ interface FamilyLogo {const PROVIDER_FAMILY_LOGOS: Record<string, FamilyLogo> = {antigravity: { file: "antigravity.svg", render: "colour" },cartesia: { file: "cartesia.svg", render: "own" },+ digitalocean: { file: "digitalocean.svg", render: "mono" },claude: { file: "claude.svg", render: "colour" },elevenlabs: { file: "elevenlabs.svg", render: "mono" },gemini: { file: "gemini.svg", render: "colour" },"google-cloud": { file: "google-cloud.svg", render: "colour" },groq: { file: "groq.svg", render: "mono" },+ hetzner: { file: "hetzner.svg", render: "mono" },+ hostinger: { file: "hostinger.svg", render: "mono" },inworld: { file: "inworld.png", render: "own" },nvidia: { file: "nvidia.svg", render: "colour" },ollama: { file: "ollama.svg", render: "mono" },@@ -79,13 +82,18 @@ export function providerFamily(providerId: string): string | null {if (id.includes("cartesia")) return "cartesia";if (id.includes("inworld")) return "inworld";if (id.includes("nvidia") || id.includes("nemotron")) return "nvidia";+ // Hosting providers (Settings -> Computers cloud import).+ if (id.includes("hostinger")) return "hostinger";+ if (id.includes("hetzner")) return "hetzner";+ if (id.includes("digitalocean")) return "digitalocean";return null;}/** An on-device engine or a self-hosted server: a capability, not a brand. */function localGlyph(providerId: string): "device" | "server" | null {const id = providerId.toLowerCase();- if (id.startsWith("local-")) return "server";+ if (id.startsWith("local-") || id === "generic") return "server";+ if (id === "multipass") return "device";if (id.includes("faster-whisper") || id.includes("piper")) return "device";return null;}diff --git a/jarvis/ui/web/frontend/src/hooks/useComputers.ts b/jarvis/ui/web/frontend/src/hooks/useComputers.tsnew file mode 100644index 0000000000..badc7f0f29--- /dev/null+++ b/jarvis/ui/web/frontend/src/hooks/useComputers.ts@@ -0,0 +1,109 @@+/**+ * React Query hooks for the Computers section.+ *+ * The list polls only while something is moving — a VM being created, a+ * record still provisioning — and stays quiet otherwise, so an idle Settings+ * page opens no sockets (AP-33). Every mutation writes its answer straight+ * into the cached list, so a check or a rename paints without a refetch.+ */+import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";+import {+ computersApi,+ type Computer,+ type CloudProviderId,+} from "@/lib/computersApi";++export const computerKeys = {+ all: ["computers"] as const,+ list: () => ["computers", "list"] as const,+ identity: () => ["computers", "identity"] as const,+ cloud: () => ["computers", "cloud"] as const,+ cloudServers: (p: CloudProviderId) => ["computers", "cloud", p, "servers"] as const,+ local: () => ["computers", "local"] as const,+};++const MOVING_POLL_MS = 4000;++function isMoving(rows: Computer[] | undefined): boolean {+ return Boolean(rows?.some((c) => c.busy || c.health.status === "provisioning"));+}++export function useComputers() {+ return useQuery({+ queryKey: computerKeys.list(),+ queryFn: computersApi.list,+ refetchInterval: (query) => (isMoving(query.state.data) ? MOVING_POLL_MS : false),+ });+}++export function useIdentity() {+ return useQuery({+ queryKey: computerKeys.identity(),+ queryFn: computersApi.identity,+ staleTime: Infinity,+ });+}++export function useCloudProviders() {+ return useQuery({ queryKey: computerKeys.cloud(), queryFn: computersApi.cloudProviders });+}++export function useCloudServers(provider: CloudProviderId, enabled: boolean) {+ return useQuery({+ queryKey: computerKeys.cloudServers(provider),+ queryFn: () => computersApi.cloudServers(provider),+ enabled,+ retry: false,+ });+}++export function useLocalStatus(enabled = true) {+ return useQuery({+ queryKey: computerKeys.local(),+ queryFn: computersApi.localStatus,+ enabled,+ retry: false,+ });+}++/** Put one fresh record into the cached list (insert or replace). */+export function useUpsertComputer() {+ const qc = useQueryClient();+ return (computer: Computer) => {+ qc.setQueryData<Computer[]>(computerKeys.list(), (rows) => {+ const list = rows ?? [];+ const index = list.findIndex((c) => c.id === computer.id);+ if (index === -1) return [...list, computer];+ const next = list.slice();+ next[index] = computer;+ return next;+ });+ };+}++export function useCheckComputer() {+ const upsert = useUpsertComputer();+ return useMutation({ mutationFn: computersApi.check, onSuccess: upsert });+}++export function useCheckAll() {+ const qc = useQueryClient();+ return useMutation({+ mutationFn: computersApi.checkAll,+ onSuccess: (rows) => qc.setQueryData(computerKeys.list(), rows),+ });+}++export function useRemoveComputer() {+ const qc = useQueryClient();+ return useMutation({+ mutationFn: ({ id, destroyVm }: { id: string; destroyVm: boolean }) =>+ computersApi.remove(id, destroyVm),+ onSuccess: (_result, { id }) => {+ qc.setQueryData<Computer[]>(computerKeys.list(), (rows) =>+ (rows ?? []).filter((c) => c.id !== id),+ );+ void qc.invalidateQueries({ queryKey: computerKeys.cloud() });+ },+ });+}diff --git a/jarvis/ui/web/frontend/src/i18n/index.ts b/jarvis/ui/web/frontend/src/i18n/index.tsindex d215368fbd..e8c812ca25 100644--- a/jarvis/ui/web/frontend/src/i18n/index.ts+++ b/jarvis/ui/web/frontend/src/i18n/index.ts@@ -79,7 +79,7 @@ const RESOURCES: Record<UiLanguage, Record<string, unknown>> = {* it mounts. Until the chunk has arrived, `t()` returns the key, so a view* that cares waits for `ready` before it paints.*/-export type LocaleChunk = "marketplace" | "local_models" | "society";+export type LocaleChunk = "marketplace" | "local_models" | "society" | "computers";const CHUNK_LOADERS: Record<LocaleChunk, Record<UiLanguage, () => Promise<unknown>>> = {marketplace: {@@ -97,6 +97,11 @@ const CHUNK_LOADERS: Record<LocaleChunk, Record<UiLanguage, () => Promise<unknowde: () => import("./locales/society/de.json"),es: () => import("./locales/society/es.json"),},+ computers: {+ en: () => import("./locales/computers/en.json"),+ de: () => import("./locales/computers/de.json"),+ es: () => import("./locales/computers/es.json"),+ },};const EXTRA: Record<UiLanguage, Record<string, unknown>[]> = { en: [], de: [], es: [] };diff --git a/jarvis/ui/web/frontend/src/i18n/locales/computers/de.json b/jarvis/ui/web/frontend/src/i18n/locales/computers/de.jsonnew file mode 100644index 0000000000..38f358bfe4--- /dev/null+++ b/jarvis/ui/web/frontend/src/i18n/locales/computers/de.json@@ -0,0 +1,171 @@+{+ "computers": {+ "title": "Computer",+ "subtitle": "Server und virtuelle Maschinen, auf denen {name} neben diesem Rechner arbeiten kann.",+ "loading": "Deine Computer werden geladen…",+ "load_failed": "Die Computerliste konnte nicht geladen werden. Läuft das Backend?",+ "add": "Computer hinzufügen",+ "add_title": "Computer hinzufügen",+ "add_subtitle": "Wähle, wo der Computer steht. Du kannst beliebig viele hinzufügen.",+ "check_all": "Alle prüfen",+ "check_now": "Jetzt prüfen",+ "check_again": "Erneut prüfen",+ "checked": "Geprüft",+ "never_checked": "nie",+ "just_now": "gerade eben",+ "back": "Zurück",+ "close": "Schließen",+ "cancel": "Abbrechen",+ "copy": "Kopieren",+ "copied": "Kopiert",+ "refresh": "Aktualisieren",+ "recommended": "Empfohlen",+ "all_computers": "Alle Computer",+ "rename": "Umbenennen",+ "remove": "Entfernen",+ "remove_confirm": "„{computer}“ aus {name} entfernen? Der Computer selbst läuft weiter; {name} verbindet sich nur nicht mehr mit ihm.",+ "remove_destroy_vm": "Auch die virtuelle Maschine samt Festplatte von diesem Rechner löschen",+ "welcome_badge": "Neu",+ "welcome_title": "Gib {name} mehr Computer",+ "welcome_body": "Verbinde einen gemieteten Server, importiere einen aus deinem Hosting-Konto oder lass {name} direkt hier eine virtuelle Maschine anlegen. Jede Maschine wird auf dieselbe sichere Weise erreicht: per SSH, mit einem Schlüssel, den nur {name} besitzt.",+ "how_1_title": "Computer hinzufügen",+ "how_1_body": "Adresse eintippen, Server aus dem Hosting-Konto wählen oder eine lokale VM anlegen.",+ "how_2_title": "{name} richtet seinen Schlüssel ein",+ "how_2_body": "Ein Passwort wird einmal benutzt, um den eigenen Schlüssel von {name} zu hinterlegen – danach wird es vergessen.",+ "how_3_title": "Immer überprüft",+ "how_3_body": "{name} merkt sich die Identität jedes Servers und warnt dich, falls sie sich ändert.",+ "path_server_title": "Ein gemieteter Server",+ "path_server_body": "Jeder VPS oder Rechner, den du per SSH erreichst – Hostinger, Strato, IONOS, ein Raspberry Pi zu Hause.",+ "path_server_lead": "Gib die Adresse und den Login ein, die dir dein Anbieter gegeben hat.",+ "path_cloud_title": "Aus deinem Hosting-Konto",+ "path_cloud_body": "Verbinde Hostinger, Hetzner oder DigitalOcean einmal und wähle Server aus einer Liste – ohne IPs abzutippen.",+ "path_cloud_lead": "{name} liest deine Serverliste mit einem API-Token, das du bei deinem Anbieter erstellst.",+ "path_local_title": "Eine virtuelle Maschine hier",+ "path_local_body": "{name} legt einen frischen Ubuntu-Rechner in diesem Computer an – eine sichere Spielwiese zum Ausprobieren.",+ "path_local_lead": "Eine abgeschottete Ubuntu-Maschine auf diesem Rechner, betrieben mit Multipass.",+ "path_local_foot": "Windows · macOS · Linux",+ "field_host": "IP-Adresse oder Hostname",+ "field_host_hint": "Steht im Panel deines Anbieters, zum Beispiel „203.0.113.10“.",+ "field_port": "Port",+ "field_name": "Name",+ "field_name_placeholder": "Mein VPS",+ "field_username": "Login",+ "field_password": "Passwort",+ "password_for": "Passwort für {user}",+ "login_title": "Wie soll sich {name} anmelden?",+ "login_once_title": "Passwort einmal verwenden",+ "login_once_body": "{name} meldet sich einmal an, hinterlegt seinen eigenen Schlüssel und vergisst das Passwort. Die sicherste Wahl.",+ "login_key_title": "Ich habe den Schlüssel von {name} selbst hinterlegt",+ "login_key_body": "Du hast den öffentlichen Schlüssel von {name} im Panel deines Anbieters oder in authorized_keys eingetragen.",+ "login_keep_title": "Weiter mit Passwort anmelden",+ "login_keep_body": "Das Passwort liegt im Schlüsselbund deines Systems. Funktioniert, aber ein Schlüssel ist sicherer.",+ "password_once_hint": "Nur für diese eine Anmeldung. Es wird nie gespeichert.",+ "password_keep_hint": "Verschlüsselt im Schlüsselbund deines Systems gespeichert, nie in einer Datei.",+ "key_paste_hint": "Öffentlicher Schlüssel von {name} – füge ihn bei den SSH-Schlüsseln deines Anbieters ein",+ "connect": "Verbinden",+ "connecting": "Verbinde…",+ "cloud_provider": "Hosting-Anbieter",+ "account_connected": "Verbunden",+ "account_not_connected": "Nicht verbunden",+ "token_title": "Dein {provider}-Konto verbinden",+ "token_body": "{name} braucht ein API-Token, um deine Server aufzulisten. Es liest nur die Liste – und hinterlegt bei Hostinger den Schlüssel von {name} auf dem gewählten Server.",+ "token_open": "Token-Seite von {provider} öffnen",+ "token_paste": "Token erstellen, kopieren und hier einfügen.",+ "token_placeholder": "API-Token einfügen",+ "token_save": "Token speichern",+ "token_storage": "Das Token liegt im Schlüsselbund deines Systems und wird nur an deinen Anbieter gesendet.",+ "disconnect_account": "Trennen",+ "pick_server": "Server auswählen",+ "no_servers_in_account": "In diesem Konto gibt es noch keine Server.",+ "no_ip": "noch keine öffentliche IP",+ "already_added": "Schon hinzugefügt",+ "auto_key_title": "Kein Passwort nötig",+ "auto_key_body": "{name} hinterlegt seinen eigenen Schlüssel über {provider} auf diesem Server. Es kann eine Minute dauern, bis der Server ihn annimmt.",+ "use_password_instead": "Stattdessen das Root-Passwort verwenden",+ "local_checking": "Suche Multipass auf diesem Rechner…",+ "local_missing_title": "Installiere zuerst Multipass",+ "local_missing_body": "Multipass ist Canonicals kostenloses Open-Source-Werkzeug, das Ubuntu-VMs unter Windows, macOS und Linux betreibt. {name} nutzt es, um deine lokalen VMs anzulegen und zu steuern.",+ "local_get_multipass": "Multipass holen",+ "local_missing_foot": "Unter Windows braucht es Hyper-V (Windows Pro) oder VirtualBox. Nach der Installation auf „Erneut prüfen“ klicken.",+ "field_vm_name": "Name",+ "vm_name_hint": "Kleinbuchstaben, Ziffern und Bindestriche.",+ "vm_name_invalid": "2–40 Kleinbuchstaben, Ziffern oder Bindestriche, beginnend mit einem Buchstaben.",+ "field_image": "System",+ "field_cpus": "Prozessorkerne",+ "field_memory": "Arbeitsspeicher",+ "field_disk": "Festplatte",+ "local_key_note": "Die VM startet mit dem Schlüssel von {name} bereits an Bord. Es wird nie ein Passwort angelegt.",+ "create_vm": "Virtuelle Maschine anlegen",+ "provisioning_title": "Virtuelle Maschine wird angelegt",+ "status_unknown": "Noch nicht geprüft",+ "status_online": "Online",+ "status_offline": "Nicht erreichbar",+ "status_auth_failed": "Anmeldung abgelehnt",+ "status_host_key_changed": "Identität geändert",+ "status_provisioning": "Wird angelegt",+ "status_stopped": "Gestoppt",+ "status_error": "Problem",+ "provider_hostinger": "Hostinger",+ "provider_hetzner": "Hetzner Cloud",+ "provider_digitalocean": "DigitalOcean",+ "provider_multipass": "Lokale VM",+ "fix_auth_title": "{name} kann sich noch nicht anmelden",+ "fix_auth_body": "Gib das Passwort einmal ein und {name} hinterlegt seinen eigenen Schlüssel – das Passwort wird nicht gespeichert.",+ "fix_auth_manual": "Oder den Schlüssel selbst hinterlegen",+ "install_key": "Schlüssel von {name} installieren",+ "fix_hostkey_title": "Die Identität dieses Servers hat sich geändert",+ "fix_hostkey_body": "Das passiert, wenn ein Server neu installiert wird – oder wenn sich jemand als er ausgibt. {name} verbindet sich deshalb nicht mehr. Vertraue der neuen Identität nur, wenn du den Server selbst neu aufgesetzt hast.",+ "pinned_identity": "Bekannte Identität",+ "trust_new_identity": "Ich habe ihn neu installiert – neuer Identität vertrauen",+ "fix_offline_title": "{name} erreicht diesen Computer nicht",+ "fix_error_title": "Etwas ist schiefgelaufen",+ "start_vm": "Starten",+ "stop_vm": "Stoppen",+ "vitals_title": "Zustand",+ "meter_cpu": "CPU",+ "meter_cpu_long": "Prozessorlast",+ "meter_memory": "Speicher",+ "meter_disk": "Festplatte",+ "uptime": "Läuft seit",+ "latency": "Antwortzeit",+ "facts_title": "System",+ "facts_empty": "Die Angaben erscheinen nach der ersten erfolgreichen Prüfung.",+ "fact_os": "Betriebssystem",+ "fact_kernel": "Kernel",+ "fact_arch": "Architektur",+ "fact_cpu": "Prozessor",+ "fact_memory": "Arbeitsspeicher",+ "fact_disk": "Festplatte",+ "fact_hostname": "Hostname",+ "security_title": "Zugang",+ "auth_key": "Eigener Schlüssel von {name}",+ "auth_key_body": "{name} meldet sich mit seinem Schlüssel an. Nirgends ist ein Passwort gespeichert.",+ "auth_password": "Passwort",+ "auth_password_body": "Das Passwort liegt im Schlüsselbund deines Systems. Installiere den Schlüssel von {name}, um darauf zu verzichten.",+ "server_identity": "Server-Identität (Fingerabdruck)",+ "jarvis_key": "Öffentlicher Schlüssel von {name}",+ "console_title": "Konsole",+ "console_clear": "Leeren",+ "console_empty": "Führe einen Befehl auf diesem Computer aus. Mit ↑ holst du frühere zurück.",+ "console_placeholder": "Befehl eingeben und Enter drücken",+ "console_offline": "Die Konsole ist verfügbar, solange der Computer online ist",+ "console_exit": "Exit",+ "console_truncated": "Ausgabe gekürzt",+ "identity_title": "Schlüssel von {name}",+ "identity_body": "Ein Schlüssel für all deine Computer. Füge ihn im Panel eines Anbieters ein, damit {name} ohne Passwort hineinkommt.",+ "stat_total": "Computer",+ "stat_vms": "lokale VMs",+ "stat_no_vms": "keine lokalen VMs",+ "stat_online": "Online",+ "stat_online_hint": "antworten gerade",+ "stat_attention": "Brauchen Aufmerksamkeit",+ "stat_attention_hint": "öffne einen, um es zu beheben",+ "stat_all_good": "alles in Ordnung",+ "stat_latency": "Antwortzeit",+ "stat_latency_hint": "Durchschnitt der Online-Computer",+ "unit_cpu": "Kerne",+ "unit_days": "T",+ "unit_hours": "Std",+ "unit_minutes": "Min"+ }+}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/computers/en.json b/jarvis/ui/web/frontend/src/i18n/locales/computers/en.jsonnew file mode 100644index 0000000000..2fde0944b8--- /dev/null+++ b/jarvis/ui/web/frontend/src/i18n/locales/computers/en.json@@ -0,0 +1,171 @@+{+ "computers": {+ "title": "Computers",+ "subtitle": "Servers and virtual machines {name} can work on, besides this one.",+ "loading": "Loading your computers…",+ "load_failed": "The computer list could not be loaded. Is the backend running?",+ "add": "Add computer",+ "add_title": "Add a computer",+ "add_subtitle": "Choose where the computer lives. You can add as many as you like.",+ "check_all": "Check all",+ "check_now": "Check now",+ "check_again": "Check again",+ "checked": "Checked",+ "never_checked": "never",+ "just_now": "just now",+ "back": "Back",+ "close": "Close",+ "cancel": "Cancel",+ "copy": "Copy",+ "copied": "Copied",+ "refresh": "Refresh",+ "recommended": "Recommended",+ "all_computers": "All computers",+ "rename": "Rename",+ "remove": "Remove",+ "remove_confirm": "Remove “{computer}” from {name}? The computer itself keeps running; {name} just stops connecting to it.",+ "remove_destroy_vm": "Also delete the virtual machine and its disk from this computer",+ "welcome_badge": "New",+ "welcome_title": "Give {name} more computers",+ "welcome_body": "Connect a server you rent, import one from your hosting account, or let {name} create a virtual machine right here. Every machine is reached the same safe way: over SSH, with a key only {name} holds.",+ "how_1_title": "Add a computer",+ "how_1_body": "Type an address, pick a server from your hosting account, or create a local VM.",+ "how_2_title": "{name} sets up its key",+ "how_2_body": "A password is used once to plant {name}’s own key, then forgotten.",+ "how_3_title": "Always checked",+ "how_3_body": "{name} pins each server’s identity and warns you if it ever changes.",+ "path_server_title": "A server you rent",+ "path_server_body": "Any VPS or machine you can reach over SSH — Hostinger, Strato, IONOS, a Raspberry Pi at home.",+ "path_server_lead": "Enter the address and login your hosting provider gave you.",+ "path_cloud_title": "From your hosting account",+ "path_cloud_body": "Connect Hostinger, Hetzner or DigitalOcean once and pick servers from a list — no IPs to copy.",+ "path_cloud_lead": "{name} reads your server list with an API token you create at your provider.",+ "path_local_title": "A virtual machine here",+ "path_local_body": "{name} creates a fresh Ubuntu computer inside this one — a safe sandbox to try things in.",+ "path_local_lead": "An isolated Ubuntu machine on this computer, powered by Multipass.",+ "path_local_foot": "Windows · macOS · Linux",+ "field_host": "IP address or host name",+ "field_host_hint": "You find it in your provider’s panel, for example “203.0.113.10”.",+ "field_port": "Port",+ "field_name": "Name",+ "field_name_placeholder": "My VPS",+ "field_username": "Login",+ "field_password": "Password",+ "password_for": "Password for {user}",+ "login_title": "How should {name} log in?",+ "login_once_title": "Use the password once",+ "login_once_body": "{name} logs in once, adds its own key and forgets the password. The safest choice.",+ "login_key_title": "I added {name}’s key myself",+ "login_key_body": "You pasted {name}’s public key into your provider’s panel or the server’s authorized_keys.",+ "login_keep_title": "Keep using the password",+ "login_keep_body": "The password is stored in your system’s keychain. Works, but a key is safer.",+ "password_once_hint": "Used only for this one login. It is never saved.",+ "password_keep_hint": "Stored encrypted in your system’s keychain, never in a file.",+ "key_paste_hint": "{name}’s public key — paste it into your provider’s SSH-key settings",+ "connect": "Connect",+ "connecting": "Connecting…",+ "cloud_provider": "Hosting provider",+ "account_connected": "Connected",+ "account_not_connected": "Not connected",+ "token_title": "Connect your {provider} account",+ "token_body": "{name} needs an API token to list your servers. It only reads the list — and on Hostinger adds {name}’s key to the server you pick.",+ "token_open": "Open the {provider} token page",+ "token_paste": "Create a token, copy it and paste it here.",+ "token_placeholder": "Paste the API token",+ "token_save": "Save token",+ "token_storage": "The token is stored in your system’s keychain and only ever sent to your provider.",+ "disconnect_account": "Disconnect",+ "pick_server": "Pick a server",+ "no_servers_in_account": "This account has no servers yet.",+ "no_ip": "no public IP yet",+ "already_added": "Already added",+ "auto_key_title": "No password needed",+ "auto_key_body": "{name} adds its own key to this server through {provider}. It can take a minute until the server accepts it.",+ "use_password_instead": "Use the root password instead",+ "local_checking": "Looking for Multipass on this computer…",+ "local_missing_title": "Install Multipass first",+ "local_missing_body": "Multipass is Canonical’s free, open-source tool that runs Ubuntu virtual machines on Windows, macOS and Linux. {name} uses it to create and manage your local VMs.",+ "local_get_multipass": "Get Multipass",+ "local_missing_foot": "On Windows it needs Hyper-V (Windows Pro) or VirtualBox. After installing, click “Check again”.",+ "field_vm_name": "Name",+ "vm_name_hint": "Lowercase letters, digits and hyphens.",+ "vm_name_invalid": "Use 2–40 lowercase letters, digits or hyphens, starting with a letter.",+ "field_image": "System",+ "field_cpus": "Processor cores",+ "field_memory": "Memory",+ "field_disk": "Disk",+ "local_key_note": "The VM starts with {name}’s key already inside. No password is ever created.",+ "create_vm": "Create virtual machine",+ "provisioning_title": "Creating the virtual machine",+ "status_unknown": "Not checked yet",+ "status_online": "Online",+ "status_offline": "Unreachable",+ "status_auth_failed": "Login refused",+ "status_host_key_changed": "Identity changed",+ "status_provisioning": "Being created",+ "status_stopped": "Stopped",+ "status_error": "Problem",+ "provider_hostinger": "Hostinger",+ "provider_hetzner": "Hetzner Cloud",+ "provider_digitalocean": "DigitalOcean",+ "provider_multipass": "Local VM",+ "fix_auth_title": "{name} cannot log in yet",+ "fix_auth_body": "Enter the password once and {name} adds its own key — the password is not saved.",+ "fix_auth_manual": "Or add the key yourself",+ "install_key": "Install {name}’s key",+ "fix_hostkey_title": "This server’s identity changed",+ "fix_hostkey_body": "That happens when a server is reinstalled — or when someone pretends to be it. {name} stopped connecting. Only trust the new identity if you rebuilt the server yourself.",+ "pinned_identity": "Known identity",+ "trust_new_identity": "I reinstalled it — trust the new identity",+ "fix_offline_title": "{name} cannot reach this computer",+ "fix_error_title": "Something went wrong",+ "start_vm": "Start",+ "stop_vm": "Stop",+ "vitals_title": "Vitals",+ "meter_cpu": "CPU",+ "meter_cpu_long": "Processor load",+ "meter_memory": "Memory",+ "meter_disk": "Disk",+ "uptime": "Running for",+ "latency": "Response time",+ "facts_title": "System",+ "facts_empty": "Facts appear after the first successful check.",+ "fact_os": "Operating system",+ "fact_kernel": "Kernel",+ "fact_arch": "Architecture",+ "fact_cpu": "Processor",+ "fact_memory": "Memory",+ "fact_disk": "Disk",+ "fact_hostname": "Host name",+ "security_title": "Access",+ "auth_key": "{name}’s own key",+ "auth_key_body": "{name} logs in with its key. No password is stored anywhere.",+ "auth_password": "Password",+ "auth_password_body": "The password sits in your system’s keychain. Install {name}’s key to drop it.",+ "server_identity": "Server identity (fingerprint)",+ "jarvis_key": "{name}’s public key",+ "console_title": "Console",+ "console_clear": "Clear",+ "console_empty": "Run a command on this computer. Press ↑ for earlier ones.",+ "console_placeholder": "Type a command and press Enter",+ "console_offline": "The console is available while the computer is online",+ "console_exit": "exit",+ "console_truncated": "output shortened",+ "identity_title": "{name}’s key",+ "identity_body": "One key for all your computers. Paste it into a provider panel to let {name} in without a password.",+ "stat_total": "Computers",+ "stat_vms": "local VMs",+ "stat_no_vms": "no local VMs",+ "stat_online": "Online",+ "stat_online_hint": "answering right now",+ "stat_attention": "Need attention",+ "stat_attention_hint": "open one to fix it",+ "stat_all_good": "all good",+ "stat_latency": "Response time",+ "stat_latency_hint": "average of online computers",+ "unit_cpu": "cores",+ "unit_days": "d",+ "unit_hours": "h",+ "unit_minutes": "min"+ }+}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/computers/es.json b/jarvis/ui/web/frontend/src/i18n/locales/computers/es.jsonnew file mode 100644index 0000000000..0c54ceb5e4--- /dev/null+++ b/jarvis/ui/web/frontend/src/i18n/locales/computers/es.json@@ -0,0 +1,171 @@+{+ "computers": {+ "title": "Ordenadores",+ "subtitle": "Servidores y máquinas virtuales en los que {name} puede trabajar, además de este.",+ "loading": "Cargando tus ordenadores…",+ "load_failed": "No se pudo cargar la lista de ordenadores. ¿Está funcionando el backend?",+ "add": "Añadir ordenador",+ "add_title": "Añadir un ordenador",+ "add_subtitle": "Elige dónde está el ordenador. Puedes añadir tantos como quieras.",+ "check_all": "Comprobar todos",+ "check_now": "Comprobar ahora",+ "check_again": "Volver a comprobar",+ "checked": "Comprobado",+ "never_checked": "nunca",+ "just_now": "ahora mismo",+ "back": "Atrás",+ "close": "Cerrar",+ "cancel": "Cancelar",+ "copy": "Copiar",+ "copied": "Copiado",+ "refresh": "Actualizar",+ "recommended": "Recomendado",+ "all_computers": "Todos los ordenadores",+ "rename": "Renombrar",+ "remove": "Quitar",+ "remove_confirm": "¿Quitar «{computer}» de {name}? El ordenador sigue funcionando; {name} solo deja de conectarse a él.",+ "remove_destroy_vm": "Borrar también la máquina virtual y su disco de este ordenador",+ "welcome_badge": "Nuevo",+ "welcome_title": "Dale a {name} más ordenadores",+ "welcome_body": "Conecta un servidor que alquilas, impórtalo desde tu cuenta de hosting o deja que {name} cree aquí mismo una máquina virtual. Todas se alcanzan de la misma forma segura: por SSH, con una clave que solo tiene {name}.",+ "how_1_title": "Añade un ordenador",+ "how_1_body": "Escribe una dirección, elige un servidor de tu cuenta de hosting o crea una VM local.",+ "how_2_title": "{name} instala su clave",+ "how_2_body": "La contraseña se usa una sola vez para dejar la clave propia de {name} y después se olvida.",+ "how_3_title": "Siempre verificado",+ "how_3_body": "{name} recuerda la identidad de cada servidor y te avisa si alguna vez cambia.",+ "path_server_title": "Un servidor alquilado",+ "path_server_body": "Cualquier VPS o máquina a la que llegues por SSH: Hostinger, Strato, IONOS, una Raspberry Pi en casa.",+ "path_server_lead": "Introduce la dirección y el usuario que te dio tu proveedor.",+ "path_cloud_title": "Desde tu cuenta de hosting",+ "path_cloud_body": "Conecta Hostinger, Hetzner o DigitalOcean una vez y elige servidores de una lista, sin copiar IPs.",+ "path_cloud_lead": "{name} lee tu lista de servidores con un token de API que creas en tu proveedor.",+ "path_local_title": "Una máquina virtual aquí",+ "path_local_body": "{name} crea un ordenador Ubuntu nuevo dentro de este: un entorno seguro para probar cosas.",+ "path_local_lead": "Una máquina Ubuntu aislada en este ordenador, gracias a Multipass.",+ "path_local_foot": "Windows · macOS · Linux",+ "field_host": "Dirección IP o nombre de host",+ "field_host_hint": "Lo encuentras en el panel de tu proveedor, por ejemplo «203.0.113.10».",+ "field_port": "Puerto",+ "field_name": "Nombre",+ "field_name_placeholder": "Mi VPS",+ "field_username": "Usuario",+ "field_password": "Contraseña",+ "password_for": "Contraseña de {user}",+ "login_title": "¿Cómo debe iniciar sesión {name}?",+ "login_once_title": "Usar la contraseña una vez",+ "login_once_body": "{name} entra una vez, añade su propia clave y olvida la contraseña. La opción más segura.",+ "login_key_title": "Ya añadí la clave de {name}",+ "login_key_body": "Pegaste la clave pública de {name} en el panel de tu proveedor o en authorized_keys.",+ "login_keep_title": "Seguir usando la contraseña",+ "login_keep_body": "La contraseña se guarda en el llavero de tu sistema. Funciona, pero una clave es más segura.",+ "password_once_hint": "Solo para este inicio de sesión. Nunca se guarda.",+ "password_keep_hint": "Guardada cifrada en el llavero de tu sistema, nunca en un archivo.",+ "key_paste_hint": "Clave pública de {name}: pégala en los ajustes de claves SSH de tu proveedor",+ "connect": "Conectar",+ "connecting": "Conectando…",+ "cloud_provider": "Proveedor de hosting",+ "account_connected": "Conectado",+ "account_not_connected": "Sin conectar",+ "token_title": "Conecta tu cuenta de {provider}",+ "token_body": "{name} necesita un token de API para listar tus servidores. Solo lee la lista y, en Hostinger, añade la clave de {name} al servidor que elijas.",+ "token_open": "Abrir la página de tokens de {provider}",+ "token_paste": "Crea un token, cópialo y pégalo aquí.",+ "token_placeholder": "Pega el token de API",+ "token_save": "Guardar token",+ "token_storage": "El token se guarda en el llavero de tu sistema y solo se envía a tu proveedor.",+ "disconnect_account": "Desconectar",+ "pick_server": "Elige un servidor",+ "no_servers_in_account": "Esta cuenta todavía no tiene servidores.",+ "no_ip": "aún sin IP pública",+ "already_added": "Ya añadido",+ "auto_key_title": "No hace falta contraseña",+ "auto_key_body": "{name} añade su propia clave a este servidor a través de {provider}. Puede tardar un minuto en aceptarla.",+ "use_password_instead": "Usar la contraseña de root",+ "local_checking": "Buscando Multipass en este ordenador…",+ "local_missing_title": "Instala Multipass primero",+ "local_missing_body": "Multipass es la herramienta gratuita y de código abierto de Canonical para ejecutar máquinas virtuales Ubuntu en Windows, macOS y Linux. {name} la usa para crear y gestionar tus VM locales.",+ "local_get_multipass": "Descargar Multipass",+ "local_missing_foot": "En Windows necesita Hyper-V (Windows Pro) o VirtualBox. Tras instalarlo, pulsa «Volver a comprobar».",+ "field_vm_name": "Nombre",+ "vm_name_hint": "Minúsculas, números y guiones.",+ "vm_name_invalid": "Usa de 2 a 40 minúsculas, números o guiones, empezando por una letra.",+ "field_image": "Sistema",+ "field_cpus": "Núcleos",+ "field_memory": "Memoria",+ "field_disk": "Disco",+ "local_key_note": "La VM arranca con la clave de {name} ya dentro. Nunca se crea una contraseña.",+ "create_vm": "Crear máquina virtual",+ "provisioning_title": "Creando la máquina virtual",+ "status_unknown": "Sin comprobar",+ "status_online": "En línea",+ "status_offline": "Inaccesible",+ "status_auth_failed": "Acceso rechazado",+ "status_host_key_changed": "Identidad cambiada",+ "status_provisioning": "Creándose",+ "status_stopped": "Detenida",+ "status_error": "Problema",+ "provider_hostinger": "Hostinger",+ "provider_hetzner": "Hetzner Cloud",+ "provider_digitalocean": "DigitalOcean",+ "provider_multipass": "VM local",+ "fix_auth_title": "{name} aún no puede iniciar sesión",+ "fix_auth_body": "Introduce la contraseña una vez y {name} añadirá su propia clave; la contraseña no se guarda.",+ "fix_auth_manual": "O añade la clave tú mismo",+ "install_key": "Instalar la clave de {name}",+ "fix_hostkey_title": "La identidad de este servidor ha cambiado",+ "fix_hostkey_body": "Ocurre cuando se reinstala un servidor, o cuando alguien se hace pasar por él. {name} ha dejado de conectarse. Confía en la nueva identidad solo si reinstalaste el servidor tú mismo.",+ "pinned_identity": "Identidad conocida",+ "trust_new_identity": "Lo reinstalé: confiar en la nueva identidad",+ "fix_offline_title": "{name} no puede alcanzar este ordenador",+ "fix_error_title": "Algo salió mal",+ "start_vm": "Iniciar",+ "stop_vm": "Detener",+ "vitals_title": "Estado",+ "meter_cpu": "CPU",+ "meter_cpu_long": "Carga del procesador",+ "meter_memory": "Memoria",+ "meter_disk": "Disco",+ "uptime": "Encendido desde hace",+ "latency": "Tiempo de respuesta",+ "facts_title": "Sistema",+ "facts_empty": "Los datos aparecen tras la primera comprobación correcta.",+ "fact_os": "Sistema operativo",+ "fact_kernel": "Kernel",+ "fact_arch": "Arquitectura",+ "fact_cpu": "Procesador",+ "fact_memory": "Memoria",+ "fact_disk": "Disco",+ "fact_hostname": "Nombre de host",+ "security_title": "Acceso",+ "auth_key": "Clave propia de {name}",+ "auth_key_body": "{name} entra con su clave. No hay ninguna contraseña guardada.",+ "auth_password": "Contraseña",+ "auth_password_body": "La contraseña está en el llavero de tu sistema. Instala la clave de {name} para prescindir de ella.",+ "server_identity": "Identidad del servidor (huella)",+ "jarvis_key": "Clave pública de {name}",+ "console_title": "Consola",+ "console_clear": "Limpiar",+ "console_empty": "Ejecuta un comando en este ordenador. Pulsa ↑ para los anteriores.",+ "console_placeholder": "Escribe un comando y pulsa Intro",+ "console_offline": "La consola está disponible mientras el ordenador esté en línea",+ "console_exit": "salida",+ "console_truncated": "salida recortada",+ "identity_title": "Clave de {name}",+ "identity_body": "Una clave para todos tus ordenadores. Pégala en el panel de un proveedor para que {name} entre sin contraseña.",+ "stat_total": "Ordenadores",+ "stat_vms": "VM locales",+ "stat_no_vms": "sin VM locales",+ "stat_online": "En línea",+ "stat_online_hint": "respondiendo ahora",+ "stat_attention": "Requieren atención",+ "stat_attention_hint": "abre uno para arreglarlo",+ "stat_all_good": "todo bien",+ "stat_latency": "Tiempo de respuesta",+ "stat_latency_hint": "media de los ordenadores en línea",+ "unit_cpu": "núcleos",+ "unit_days": "d",+ "unit_hours": "h",+ "unit_minutes": "min"+ }+}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 986398ff9f..d6cdad0493 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -146,6 +146,7 @@"wiki": "Wiki","apikeys": "API-Keys","local_models": "Lokale Modelle",+ "computers": "Computer","settings": "Einstellungen","dictionary": "Wörterbuch","dictation": "Diktat",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex ffc6e3fea4..ca70cf9c21 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -146,6 +146,7 @@"wiki": "Wiki","apikeys": "API Keys","local_models": "Local models",+ "computers": "Computers","settings": "Settings","dictionary": "Dictionary","dictation": "Dictation",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex d5f392cc75..89de435f1b 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -146,6 +146,7 @@"wiki": "Wiki","apikeys": "Claves API","local_models": "Modelos locales",+ "computers": "Ordenadores","settings": "Ajustes","dictionary": "Diccionario","dictation": "Dictado",diff --git a/jarvis/ui/web/frontend/src/lib/computersApi.ts b/jarvis/ui/web/frontend/src/lib/computersApi.tsnew file mode 100644index 0000000000..e130104692--- /dev/null+++ b/jarvis/ui/web/frontend/src/lib/computersApi.ts@@ -0,0 +1,227 @@+/**+ * Typed client for the Computers REST API (jarvis/ui/web/computers_routes.py).+ *+ * The shapes mirror `jarvis/computers/models.py` field for field; the backend+ * stays the authority. Errors arrive as `{detail: {message, kind}}` and are+ * rethrown as `ComputerApiError` so a view can branch on `kind` ("auth",+ * "host_key_changed", …) without parsing sentences.+ */++export type ComputerKind = "server" | "local_vm";+export type ProviderId = "generic" | "hostinger" | "hetzner" | "digitalocean" | "multipass";+export type CloudProviderId = "hostinger" | "hetzner" | "digitalocean";+export type AuthMethod = "key" | "password";+export type HealthStatus =+ | "unknown"+ | "online"+ | "offline"+ | "auth_failed"+ | "host_key_changed"+ | "provisioning"+ | "stopped"+ | "error";++export interface ComputerFacts {+ hostname: string | null;+ os_id: string | null;+ os_name: string | null;+ kernel: string | null;+ arch: string | null;+ cpu_count: number | null;+ mem_total_mb: number | null;+ disk_total_gb: number | null;+}++export interface ComputerHealth {+ status: HealthStatus;+ checked_at: number | null;+ latency_ms: number | null;+ message: string | null;+ load_1m: number | null;+ mem_used_pct: number | null;+ disk_used_pct: number | null;+ uptime_s: number | null;+}++export interface Computer {+ id: string;+ name: string;+ kind: ComputerKind;+ provider: ProviderId;+ host: string;+ port: number;+ username: string;+ auth: AuthMethod;+ provider_ref: string | null;+ region: string | null;+ plan: string | null;+ host_key: string | null;+ host_fingerprint: string | null;+ created_at: number;+ facts: ComputerFacts | null;+ health: ComputerHealth;+ /** A background job (VM creation) is still running for this record. */+ busy: boolean;+}++export interface Identity {+ public_key: string;+ fingerprint: string;+ algorithm: string;+}++export interface CloudProvider {+ id: CloudProviderId;+ name: string;+ connected: boolean;+ console_url: string;+ setup_hint: string;+ attaches_keys: boolean;+}++export interface CloudServer {+ id: string;+ name: string;+ host: string | null;+ status: string;+ running: boolean;+ os: string | null;+ plan: string | null;+ region: string | null;+ cpus: number | null;+ memory_mb: number | null;+ disk_gb: number | null;+ /** The computer id this server is already connected as, if any. */+ added_as: string | null;+}++export interface LocalInstance {+ name: string;+ state: string;+ ipv4: string | null;+ release: string | null;+}++export interface LocalStatus {+ backend: "multipass";+ available: boolean;+ version: string | null;+ install_url: string;+ install_hint: string;+ images: string[];+ instances: LocalInstance[];+ error: string | null;+}++export interface CommandResult {+ exit_status: number | null;+ stdout: string;+ stderr: string;+ duration_ms: number;+ truncated: boolean;+}++export interface AddServerInput {+ name: string;+ host: string;+ port: number;+ username: string;+ auth: AuthMethod;+ password?: string;+ keep_password?: boolean;+}++export interface LocalVmInput {+ name: string;+ cpus: number;+ memory_gb: number;+ disk_gb: number;+ image: string;+}++export class ComputerApiError extends Error {+ readonly kind: string | null;+ readonly status: number;++ constructor(message: string, status: number, kind: string | null) {+ super(message);+ this.name = "ComputerApiError";+ this.status = status;+ this.kind = kind;+ }+}++const BASE = "/api/computers";++async function request<T>(path: string, init?: RequestInit): Promise<T> {+ const res = await fetch(`${BASE}${path}`, {+ ...init,+ headers: init?.body ? { "Content-Type": "application/json" } : undefined,+ });+ if (!res.ok) {+ let message = `${res.status} ${res.statusText}`;+ let kind: string | null = null;+ try {+ const body = (await res.json()) as { detail?: unknown };+ const detail = body.detail;+ if (typeof detail === "string") message = detail;+ else if (detail && typeof detail === "object") {+ const d = detail as { message?: unknown; kind?: unknown };+ if (typeof d.message === "string") message = d.message;+ if (typeof d.kind === "string") kind = d.kind;+ }+ } catch {+ /* non-JSON body: keep the status line */+ }+ throw new ComputerApiError(message, res.status, kind);+ }+ return (await res.json()) as T;+}++const post = (body?: unknown): RequestInit => ({+ method: "POST",+ body: body === undefined ? undefined : JSON.stringify(body),+});++export const computersApi = {+ list: () => request<{ computers: Computer[] }>("").then((r) => r.computers),+ identity: () => request<Identity>("/identity"),+ add: (input: AddServerInput) => request<Computer>("", post(input)),+ checkAll: () => request<{ computers: Computer[] }>("/check-all", post()).then((r) => r.computers),+ check: (id: string) => request<Computer>(`/${encodeURIComponent(id)}/check`, post()),+ update: (id: string, patch: Partial<Pick<Computer, "name" | "host" | "port" | "username">>) =>+ request<Computer>(`/${encodeURIComponent(id)}`, {+ method: "PATCH",+ body: JSON.stringify(patch),+ }),+ remove: (id: string, destroyVm = false) =>+ request<{ removed: boolean }>(+ `/${encodeURIComponent(id)}${destroyVm ? "?destroy_vm=true" : ""}`,+ { method: "DELETE" },+ ),+ run: (id: string, command: string, timeoutS = 60) =>+ request<CommandResult>(`/${encodeURIComponent(id)}/run`, post({ command, timeout_s: timeoutS })),+ installKey: (id: string, password: string) =>+ request<Computer>(`/${encodeURIComponent(id)}/install-key`, post({ password })),+ trustHostKey: (id: string) =>+ request<Computer>(`/${encodeURIComponent(id)}/trust-host-key`, post()),+ power: (id: string, action: "start" | "stop") =>+ request<Computer>(`/${encodeURIComponent(id)}/power`, post({ action })),+ cloudProviders: () =>+ request<{ providers: CloudProvider[] }>("/cloud").then((r) => r.providers),+ saveCloudToken: (provider: CloudProviderId, token: string) =>+ request<{ connected: boolean; servers: CloudServer[] }>(`/cloud/${provider}/token`, {+ method: "PUT",+ body: JSON.stringify({ token }),+ }),+ forgetCloudToken: (provider: CloudProviderId) =>+ request<{ connected: boolean }>(`/cloud/${provider}/token`, { method: "DELETE" }),+ cloudServers: (provider: CloudProviderId) =>+ request<{ servers: CloudServer[] }>(`/cloud/${provider}/servers`).then((r) => r.servers),+ importCloudServer: (+ provider: CloudProviderId,+ body: { server_id: string; name?: string; username?: string; password?: string },+ ) => request<Computer>(`/cloud/${provider}/import`, post(body)),+ localStatus: () => request<LocalStatus>("/local"),+ createLocalVm: (input: LocalVmInput) => request<Computer>("/local", post(input)),+};diff --git a/jarvis/ui/web/frontend/src/store/events.ts b/jarvis/ui/web/frontend/src/store/events.tsindex a03e707e66..e76d98bc06 100644--- a/jarvis/ui/web/frontend/src/store/events.ts+++ b/jarvis/ui/web/frontend/src/store/events.ts@@ -74,6 +74,8 @@ export type SectionId =// Local models: the Ollama server, its installed models and the catalogue,// in one section instead of a card body inside API Keys.| "local-models"+ // Computers: the user's own servers and local VMs, reached over SSH.+ | "computers"| "settings"| "telephony"| "telephony-setup"@@ -127,6 +129,7 @@ export const SECTION_IDS = ["memory","apikeys","local-models",+ "computers","settings","telephony","telephony-setup",@@ -216,6 +219,7 @@ export const SECTION_LABELS: Record<SectionId, string> = {memory: "Notes",apikeys: "API Keys","local-models": "Local models",+ computers: "Computers",settings: "Settings",telephony: "Telephony","telephony-setup": "Telephony setup",diff --git a/jarvis/ui/web/frontend/src/views/ComputersView.test.tsx b/jarvis/ui/web/frontend/src/views/ComputersView.test.tsxnew file mode 100644index 0000000000..af9dd71781--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/ComputersView.test.tsx@@ -0,0 +1,173 @@+/**+ * ComputersView: the empty page opens onto the three ways in; a machine in the+ * list opens its detail page; the console runs a command; the server form+ * sends the password-once login and paints the returned machine.+ */+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";++import { ComputersView } from "@/views/ComputersView";+import { loadLocaleChunk, setUiLanguage } from "@/i18n";+import type { Computer } from "@/lib/computersApi";++interface Call {+ url: string;+ method: string;+ body: unknown;+}++function installFetch(routes: Record<string, (body: unknown) => unknown>) {+ const calls: Call[] = [];+ const fetchMock = vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => {+ const url = String(input);+ const method = (init?.method ?? "GET").toUpperCase();+ const body = init?.body ? JSON.parse(String(init.body)) : undefined;+ calls.push({ url, method, body });+ const key = Object.keys(routes)+ .sort((a, b) => b.length - a.length)+ .find((k) => {+ const [m, path] = k.split(" ");+ return m === method && url === path;+ });+ if (!key) throw new Error(`unexpected fetch ${method} ${url}`);+ const payload = routes[key](body);+ return {+ ok: true,+ status: 200,+ statusText: "OK",+ json: async () => payload,+ } as Response;+ });+ (globalThis as unknown as { fetch: typeof fetch }).fetch = fetchMock as unknown as typeof fetch;+ return calls;+}++const IDENTITY = {+ public_key: "ssh-ed25519 AAAAC3Nza personal-jarvis@desk",+ fingerprint: "SHA256:abc",+ algorithm: "ssh-ed25519",+};++const VPS: Computer = {+ id: "c_1",+ name: "Hostinger VPS",+ kind: "server",+ provider: "hostinger",+ host: "203.0.113.15",+ port: 22,+ username: "root",+ auth: "key",+ provider_ref: "17923",+ region: "Phoenix",+ plan: "KVM 4",+ host_key: "ssh-ed25519 AAAA",+ host_fingerprint: "SHA256:server",+ created_at: 1_700_000_000,+ facts: {+ hostname: "srv17923",+ os_id: "ubuntu",+ os_name: "Ubuntu 24.04.1 LTS",+ kernel: "Linux 6.8.0",+ arch: "x86_64",+ cpu_count: 4,+ mem_total_mb: 8192,+ disk_total_gb: 50,+ },+ health: {+ status: "online",+ checked_at: Date.now() / 1000,+ latency_ms: 42,+ message: null,+ load_1m: 0.5,+ mem_used_pct: 30,+ disk_used_pct: 25,+ uptime_s: 90_000,+ },+ busy: false,+};++function renderView() {+ const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });+ return render(+ <QueryClientProvider client={client}>+ <ComputersView />+ </QueryClientProvider>,+ );+}++describe("ComputersView", () => {+ beforeEach(async () => {+ setUiLanguage("en");+ await loadLocaleChunk("computers");+ });+ afterEach(() => cleanup());++ it("opens onto the three ways in when nothing is connected", async () => {+ installFetch({ "GET /api/computers": () => ({ computers: [] }) });+ renderView();++ expect(await screen.findByTestId("computers-welcome")).toBeTruthy();+ expect(screen.getByText(/^Give .+ more computers$/)).toBeTruthy();+ for (const path of ["server", "cloud", "local"]) {+ expect(screen.getByTestId(`computers-path-${path}`)).toBeTruthy();+ }+ });++ it("adds a server with the password-once login", async () => {+ let rows: Computer[] = [];+ const calls = installFetch({+ "GET /api/computers": () => ({ computers: rows }),+ "GET /api/computers/identity": () => IDENTITY,+ "POST /api/computers": () => {+ rows = [VPS];+ return VPS;+ },+ });+ renderView();++ fireEvent.click(await screen.findByTestId("computers-path-server"));+ const dialog = await screen.findByTestId("computers-add-dialog");+ fireEvent.change(screen.getByPlaceholderText("203.0.113.10"), {+ target: { value: "203.0.113.15" },+ });+ const password = dialog.querySelector('input[type="password"]') as HTMLInputElement;+ fireEvent.change(password, { target: { value: "hunter2" } });+ fireEvent.click(screen.getByRole("button", { name: /^Connect$/ }));++ await screen.findByTestId("computer-detail");+ const post = calls.find((c) => c.method === "POST" && c.url === "/api/computers");+ expect(post?.body).toMatchObject({+ host: "203.0.113.15",+ username: "root",+ auth: "password",+ password: "hunter2",+ keep_password: false,+ });+ });++ it("lists a machine, opens it and runs a console command", async () => {+ const calls = installFetch({+ "GET /api/computers": () => ({ computers: [VPS] }),+ "GET /api/computers/identity": () => IDENTITY,+ "POST /api/computers/c_1/run": () => ({+ exit_status: 0,+ stdout: " 12:00 up 1 day\n",+ stderr: "",+ duration_ms: 80,+ truncated: false,+ }),+ });+ renderView();++ fireEvent.click(await screen.findByTestId("computer-row-c_1"));+ expect(await screen.findByTestId("computer-detail")).toBeTruthy();+ expect(screen.getByText("Ubuntu 24.04.1 LTS")).toBeTruthy();++ fireEvent.click(screen.getByRole("button", { name: "uptime" }));+ await waitFor(() =>+ expect(screen.getByTestId("computer-console-output").textContent).toContain("12:00 up 1 day"),+ );+ expect(calls.some((c) => c.url === "/api/computers/c_1/run" && (c.body as { command: string }).command === "uptime")).toBe(true);+ });+});diff --git a/jarvis/ui/web/frontend/src/views/ComputersView.tsx b/jarvis/ui/web/frontend/src/views/ComputersView.tsxnew file mode 100644index 0000000000..ae247c2d72--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/ComputersView.tsx@@ -0,0 +1,238 @@+/**+ * Computers — the machines Jarvis can work on besides this one.+ *+ * A rented VPS (any SSH host, or imported from Hostinger / Hetzner /+ * DigitalOcean) and local virtual machines created through Multipass, in one+ * list. The list is the landing: a row of headline numbers, then one "rack+ * unit" per machine with its live meters; a row opens the detail page in+ * place. An empty section opens straight onto the three ways in, so the first+ * visit is a choice, not a blank table.+ *+ * Every machine is reached the same way — over SSH with Jarvis's own key —+ * which is what later features (deploying Jarvis to a server, agents working+ * on a remote box) build on.+ */+import { useMemo, useState } from "react";+import {+ Fingerprint,+ KeyRound,+ Loader2,+ Plus,+ RefreshCw,+ Server,+ ShieldCheck,+ Sparkles,+} from "lucide-react";+import { Panel, StatGroup, StatTile } from "@/components/extensions/primitives";+import { PageHeader } from "@/components/layout/PageHeader";+import { ScrollArea } from "@/components/ui/scroll-area";+import { Button } from "@/components/ui/button";+import { useCheckAll, useComputers, useIdentity } from "@/hooks/useComputers";+import { useLocaleChunk, useT } from "@/i18n";+import type { Computer } from "@/lib/computersApi";+import { AddComputerDialog, PathChoices, type AddPath } from "@/views/computers/AddComputerDialog";+import { ComputerDetail } from "@/views/computers/ComputerDetail";+import { ComputerRow } from "@/views/computers/ComputerRow";+import { CopyField, needsAttention } from "@/views/computers/parts";++/** Keyframes the provisioning bar uses; scoped by name, shipped with the view. */+const KEYFRAMES = `@keyframes computers-indeterminate {+ 0% { transform: translateX(-100%); }+ 100% { transform: translateX(300%); }+}`;++function Welcome({ onPick }: { onPick: (path: AddPath) => void }) {+ const t = useT();+ const steps = [+ { icon: <Plus />, title: t("computers.how_1_title"), body: t("computers.how_1_body") },+ { icon: <KeyRound />, title: t("computers.how_2_title"), body: t("computers.how_2_body") },+ { icon: <ShieldCheck />, title: t("computers.how_3_title"), body: t("computers.how_3_body") },+ ];+ return (+ <div className="flex flex-col gap-8" data-testid="computers-welcome">+ <div className="relative overflow-hidden rounded-xl border border-border bg-card px-8 py-10">+ {/* A quiet rack of status lights: decoration drawn from the section's own vocabulary. */}+ <div aria-hidden className="pointer-events-none absolute right-8 top-1/2 hidden -translate-y-1/2 gap-2 lg:flex">+ {[0, 1, 2].map((col) => (+ <div key={col} className="flex flex-col gap-2">+ {[0, 1, 2, 3].map((row) => (+ <div+ key={row}+ className="flex h-7 w-28 items-center gap-2 rounded-md border border-border bg-background/60 px-2.5"+ >+ <span+ className="h-1.5 w-1.5 rounded-full bg-success motion-safe:animate-pulse"+ style={{ animationDelay: `${(col * 4 + row) * 180}ms`, opacity: (row + col) % 3 === 0 ? 1 : 0.45 }}+ />+ <span className="h-1 flex-1 rounded-full bg-secondary" />+ </div>+ ))}+ </div>+ ))}+ </div>+ <div className="relative max-w-xl">+ <span className="inline-flex items-center gap-1.5 rounded-full border border-border px-2.5 py-1 text-xs font-medium text-muted-foreground">+ <Sparkles className="h-3 w-3" aria-hidden />+ {t("computers.welcome_badge")}+ </span>+ <h2 className="mt-4 text-2xl font-semibold text-foreground-strong">{t("computers.welcome_title")}</h2>+ <p className="mt-2 text-base text-muted-foreground">{t("computers.welcome_body")}</p>+ </div>+ </div>++ <PathChoices onPick={onPick} />++ <ol className="grid gap-4 md:grid-cols-3">+ {steps.map((step, index) => (+ <li key={step.title} className="flex gap-3">+ <span className="flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-border text-xs tabular-nums text-muted-foreground">+ {index + 1}+ </span>+ <span>+ <span className="block text-base font-medium text-foreground-strong">{step.title}</span>+ <span className="mt-0.5 block text-sm text-muted-foreground">{step.body}</span>+ </span>+ </li>+ ))}+ </ol>+ </div>+ );+}++function IdentityStrip() {+ const t = useT();+ const identity = useIdentity();+ if (!identity.data) return null;+ return (+ <Panel className="p-5">+ <div className="flex items-start gap-3">+ <Fingerprint className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" aria-hidden />+ <div className="min-w-0 flex-1">+ <div className="text-base font-semibold text-foreground-strong">{t("computers.identity_title")}</div>+ <p className="mt-0.5 text-sm text-muted-foreground">{t("computers.identity_body")}</p>+ <div className="mt-4">+ <CopyField+ label={`${identity.data.algorithm} · ${identity.data.fingerprint}`}+ value={identity.data.public_key}+ copyLabel={t("computers.copy")}+ copiedLabel={t("computers.copied")}+ />+ </div>+ </div>+ </div>+ </Panel>+ );+}++export function ComputersView() {+ const t = useT();+ useLocaleChunk("computers");+ const computers = useComputers();+ const checkAll = useCheckAll();+ const [openId, setOpenId] = useState<string | null>(null);+ const [adding, setAdding] = useState<{ path: AddPath | null } | null>(null);++ const rows = useMemo(() => computers.data ?? [], [computers.data]);+ const open = rows.find((c) => c.id === openId) ?? null;+ const stats = useMemo(() => {+ const online = rows.filter((c) => c.health.status === "online");+ const latencies = online.map((c) => c.health.latency_ms).filter((v): v is number => v !== null);+ return {+ total: rows.length,+ online: online.length,+ attention: rows.filter(needsAttention).length,+ vms: rows.filter((c) => c.kind === "local_vm").length,+ latency: latencies.length ? Math.round(latencies.reduce((a, b) => a + b, 0) / latencies.length) : null,+ };+ }, [rows]);++ const onAdded = (computer: Computer) => {+ setAdding(null);+ setOpenId(computer.id);+ };++ return (+ <div className="flex h-full min-h-0 w-full flex-col" data-testid="computers-view">+ <style>{KEYFRAMES}</style>+ <div className="w-full shrink-0 px-8">+ <PageHeader+ icon={<Server />}+ title={t("computers.title")}+ description={t("computers.subtitle")}+ actions={+ rows.length > 0 && !open ? (+ <>+ <Button+ variant="outline"+ onClick={() => checkAll.mutate()}+ disabled={checkAll.isPending}+ data-testid="computers-check-all"+ >+ {checkAll.isPending ? <Loader2 className="animate-spin" /> : <RefreshCw />}+ {t("computers.check_all")}+ </Button>+ <Button onClick={() => setAdding({ path: null })} data-testid="computers-add">+ <Plus />+ {t("computers.add")}+ </Button>+ </>+ ) : null+ }+ />+ </div>++ <ScrollArea className="min-h-0 flex-1">+ <div className="flex w-full flex-col gap-5 px-8 pb-10">+ {computers.isLoading && (+ <div className="flex items-center gap-2 py-10 text-sm text-muted-foreground">+ <Loader2 className="h-4 w-4 animate-spin" /> {t("computers.loading")}+ </div>+ )}+ {computers.isError && (+ <Panel className="p-5 text-sm text-destructive">{t("computers.load_failed")}</Panel>+ )}++ {open && <ComputerDetail key={open.id} computer={open} onBack={() => setOpenId(null)} />}++ {!open && computers.isSuccess && rows.length === 0 && (+ <Welcome onPick={(path) => setAdding({ path })} />+ )}++ {!open && rows.length > 0 && (+ <>+ <StatGroup>+ <StatTile cell icon={<Server className="h-4 w-4" />} label={t("computers.stat_total")} value={stats.total} hint={stats.vms ? `${stats.vms} ${t("computers.stat_vms")}` : t("computers.stat_no_vms")} />+ <StatTile cell tone="success" icon={<span className="block h-2 w-2 rounded-full bg-success" />} label={t("computers.stat_online")} value={`${stats.online}/${stats.total}`} hint={t("computers.stat_online_hint")} />+ <StatTile cell tone={stats.attention ? "warn" : "ok"} icon={<ShieldCheck className="h-4 w-4" />} label={t("computers.stat_attention")} value={stats.attention} hint={stats.attention ? t("computers.stat_attention_hint") : t("computers.stat_all_good")} />+ <StatTile cell icon={<RefreshCw className="h-4 w-4" />} label={t("computers.stat_latency")} value={stats.latency === null ? "—" : `${stats.latency} ms`} hint={t("computers.stat_latency_hint")} />+ </StatGroup>++ <Panel className="overflow-hidden p-0">+ <ul className="divide-y divide-border" data-testid="computers-list">+ {rows.map((computer) => (+ <ComputerRow+ key={computer.id}+ computer={computer}+ checking={checkAll.isPending}+ onOpen={() => setOpenId(computer.id)}+ />+ ))}+ </ul>+ </Panel>++ <IdentityStrip />+ </>+ )}+ </div>+ </ScrollArea>++ {adding && (+ <AddComputerDialog+ initialPath={adding.path}+ onClose={() => setAdding(null)}+ onAdded={onAdded}+ />+ )}+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/views/SettingsHubView.tsx b/jarvis/ui/web/frontend/src/views/SettingsHubView.tsxindex 0a39fc3339..68785384d2 100644--- a/jarvis/ui/web/frontend/src/views/SettingsHubView.tsx+++ b/jarvis/ui/web/frontend/src/views/SettingsHubView.tsx@@ -19,7 +19,7 @@ import { cn } from "@/lib/utils";* section on the right:** General: Settings, Profile, {name}.md, Contacts, Socials- * System: API Keys, Local models, Wallpaper+ * System: API Keys, Local models, Computers, Wallpaper* Activity: Spend, Feedback** Same merged-section pattern as VoiceHubView / ClisHubView: the active@@ -71,6 +71,9 @@ const LocalModelsTab = lazy(() =>default: m.LocalModelsView,})),);+const ComputersTab = lazy(() =>+ import("@/views/ComputersView").then((m) => ({ default: m.ComputersView })),+);const WallpaperTab = lazy(() =>import("@/views/WallpaperView").then((m) => ({ default: m.WallpaperView })),);@@ -83,7 +86,7 @@ const FeedbackTab = lazy(() =>})),);-/** The ten entries of the left navigation, in display order. */+/** The eleven entries of the left navigation, in display order. */type HubNavId =| "settings"| "profile"@@ -92,6 +95,7 @@ type HubNavId =| "socials"| "apikeys"| "local-models"+ | "computers"| "wallpaper"| "costs"| "feedback";@@ -103,7 +107,7 @@ const HUB_NAV_GROUPS: readonly { labelKey: string; ids: readonly HubNavId[] }[]},{labelKey: "settings_hub.group_system",- ids: ["apikeys", "local-models", "wallpaper"],+ ids: ["apikeys", "local-models", "computers", "wallpaper"],},{labelKey: "settings_hub.group_activity",@@ -120,6 +124,7 @@ const TAB_CONTENT: Record<HubNavId | "telephony-setup", LazyExoticComponent<Compapikeys: ApiKeysTab,"telephony-setup": TelephonySetupTab,"local-models": LocalModelsTab,+ computers: ComputersTab,wallpaper: WallpaperTab,costs: CostsTab,feedback: FeedbackTab,@@ -147,6 +152,8 @@ function resolveHubTab(active: string): { content: HubNavId | "telephony-setup";return { content: "telephony-setup", highlight: "apikeys" };case "local-models":return { content: "local-models", highlight: "local-models" };+ case "computers":+ return { content: "computers", highlight: "computers" };case "wallpaper":return { content: "wallpaper", highlight: "wallpaper" };case "costs":@@ -201,7 +208,7 @@ export function SettingsHubView() {const matches = (item: NavItem) =>needle === "" || resolveNavLabel(t, item).toLowerCase().includes(needle);- // Ten entries — filtered inline; no memo needed at this size.+ // Eleven entries — filtered inline; no memo needed at this size.const visibleGroups = HUB_NAV_GROUPS.map((group) => ({...group,items: group.ids.map(findNavItem).filter(matches),diff --git a/jarvis/ui/web/frontend/src/views/computers/AddComputerDialog.tsx b/jarvis/ui/web/frontend/src/views/computers/AddComputerDialog.tsxnew file mode 100644index 0000000000..44bbf7dd56--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/computers/AddComputerDialog.tsx@@ -0,0 +1,972 @@+/**+ * "Add a computer" — one dialog, three doors:+ *+ * 1. A server you rent any SSH host: IP, login, and a password used+ * ONCE so Jarvis can plant its own key.+ * 2. From a hosting account Hostinger / Hetzner / DigitalOcean: save an API+ * token, pick the server from the account's list.+ * Hostinger even takes the key through its API.+ * 3. A VM on this computer Multipass creates Ubuntu with Jarvis's key+ * already inside; no password ever exists.+ *+ * The door the user picked is the only form on screen. Every failure is the+ * backend's sentence, shown where the user's eyes already are.+ */+import { useEffect, useMemo, useState, type ReactNode } from "react";+import { useQueryClient } from "@tanstack/react-query";+import {+ ArrowLeft,+ Cloud,+ ExternalLink,+ KeyRound,+ Loader2,+ MonitorSmartphone,+ RefreshCw,+ Server,+ ShieldCheck,+ X,+} from "lucide-react";+import { Button } from "@/components/ui/button";+import { ProviderLogo } from "@/components/providers/ProviderLogo";+import {+ computerKeys,+ useCloudProviders,+ useCloudServers,+ useIdentity,+ useLocalStatus,+ useUpsertComputer,+} from "@/hooks/useComputers";+import { useT } from "@/i18n";+import { openExternalUrl } from "@/lib/openExternal";+import { cn } from "@/lib/utils";+import {+ computersApi,+ type CloudProviderId,+ type CloudServer,+ type Computer,+} from "@/lib/computersApi";+import { CopyField, Field, inputClass, formatMemory } from "./parts";++export type AddPath = "server" | "cloud" | "local";++function errorText(error: unknown): string {+ return error instanceof Error ? error.message : String(error);+}++/** The three doors, used by the dialog AND the empty page. */+export function PathChoices({ onPick }: { onPick: (path: AddPath) => void }) {+ const t = useT();+ const doors: { id: AddPath; icon: ReactNode; title: string; body: string; foot: ReactNode }[] = [+ {+ id: "server",+ icon: <Server />,+ title: t("computers.path_server_title"),+ body: t("computers.path_server_body"),+ foot: <span className="font-mono text-xs">ssh [email protected]</span>,+ },+ {+ id: "cloud",+ icon: <Cloud />,+ title: t("computers.path_cloud_title"),+ body: t("computers.path_cloud_body"),+ foot: (+ <span className="flex items-center gap-1.5">+ {(["hostinger", "hetzner", "digitalocean"] as const).map((p) => (+ <ProviderLogo key={p} providerId={p} label={p} size="sm" />+ ))}+ </span>+ ),+ },+ {+ id: "local",+ icon: <MonitorSmartphone />,+ title: t("computers.path_local_title"),+ body: t("computers.path_local_body"),+ foot: <span className="text-xs">{t("computers.path_local_foot")}</span>,+ },+ ];+ return (+ <div className="grid gap-3 md:grid-cols-3">+ {doors.map((door) => (+ <button+ key={door.id}+ type="button"+ data-testid={`computers-path-${door.id}`}+ onClick={() => onPick(door.id)}+ className={cn(+ "group flex min-h-[176px] flex-col rounded-lg border border-border bg-card p-5 text-left transition-[border-color,background-color,transform] duration-200",+ "hover:-translate-y-0.5 hover:border-border-strong hover:bg-secondary/40",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",+ )}+ >+ <span className="flex h-9 w-9 items-center justify-center rounded-md bg-secondary text-foreground [&>svg]:h-[18px] [&>svg]:w-[18px]">+ {door.icon}+ </span>+ <span className="mt-4 text-title font-medium text-foreground-strong">{door.title}</span>+ <span className="mt-1 text-sm text-muted-foreground">{door.body}</span>+ <span className="mt-auto pt-4 text-muted-foreground">{door.foot}</span>+ </button>+ ))}+ </div>+ );+}++/** Pick one value from a short list — used for sizes, images, login modes. */+function Choice<T extends string | number>({+ value,+ options,+ onChange,+ label,+}: {+ value: T;+ options: { id: T; label: string }[];+ onChange: (value: T) => void;+ label: string;+}) {+ return (+ <div role="radiogroup" aria-label={label} className="flex flex-wrap gap-1.5">+ {options.map((o) => {+ const active = o.id === value;+ return (+ <button+ key={String(o.id)}+ type="button"+ role="radio"+ aria-checked={active}+ onClick={() => onChange(o.id)}+ className={cn(+ "h-8 rounded-md border px-3 text-sm font-medium tabular-nums transition-colors",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",+ active+ ? "border-accent bg-accent-soft text-foreground-strong"+ : "border-border text-muted-foreground hover:border-border-strong hover:text-foreground",+ )}+ >+ {o.label}+ </button>+ );+ })}+ </div>+ );+}++/** A radio card for the login mode: title, one line of why. */+function ModeCard({+ active,+ onClick,+ title,+ body,+ badge,+}: {+ active: boolean;+ onClick: () => void;+ title: string;+ body: string;+ badge?: string;+}) {+ return (+ <button+ type="button"+ role="radio"+ aria-checked={active}+ onClick={onClick}+ className={cn(+ "flex w-full items-start gap-3 rounded-md border px-3.5 py-3 text-left transition-colors",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",+ active ? "border-accent bg-accent-soft" : "border-border hover:border-border-strong",+ )}+ >+ <span+ aria-hidden+ className={cn(+ "mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full border",+ active ? "border-accent" : "border-border-strong",+ )}+ >+ {active && <span className="h-2 w-2 rounded-full bg-accent" />}+ </span>+ <span className="min-w-0">+ <span className="flex items-center gap-2 text-base font-medium text-foreground-strong">+ {title}+ {badge && (+ <span className="rounded-full bg-secondary px-2 py-0.5 text-xs font-medium text-foreground-secondary">+ {badge}+ </span>+ )}+ </span>+ <span className="mt-0.5 block text-sm text-muted-foreground">{body}</span>+ </span>+ </button>+ );+}++function ErrorNote({ message }: { message: string | null }) {+ if (!message) return null;+ return (+ <p+ role="alert"+ className="rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-foreground"+ >+ {message}+ </p>+ );+}++// ---------------------------------------------------------------------------+// Door 1 — a server over SSH+// ---------------------------------------------------------------------------++type LoginMode = "password_once" | "key_added" | "keep_password";++function ServerForm({ onAdded }: { onAdded: (computer: Computer) => void }) {+ const t = useT();+ const identity = useIdentity();+ const [name, setName] = useState("");+ const [host, setHost] = useState("");+ const [port, setPort] = useState("22");+ const [username, setUsername] = useState("root");+ const [mode, setMode] = useState<LoginMode>("password_once");+ const [password, setPassword] = useState("");+ const [busy, setBusy] = useState(false);+ const [error, setError] = useState<string | null>(null);++ const needsPassword = mode !== "key_added";+ const portNumber = Number(port);+ const valid =+ host.trim() !== "" &&+ username.trim() !== "" &&+ Number.isInteger(portNumber) &&+ portNumber >= 1 &&+ portNumber <= 65535 &&+ (!needsPassword || password !== "");++ async function submit() {+ if (!valid || busy) return;+ setBusy(true);+ setError(null);+ try {+ const computer = await computersApi.add({+ name: name.trim() || host.trim(),+ host: host.trim(),+ port: portNumber,+ username: username.trim(),+ auth: needsPassword ? "password" : "key",+ password: needsPassword ? password : undefined,+ keep_password: mode === "keep_password",+ });+ onAdded(computer);+ } catch (e) {+ setError(errorText(e));+ } finally {+ setBusy(false);+ }+ }++ return (+ <form+ className="space-y-5"+ onSubmit={(e) => {+ e.preventDefault();+ void submit();+ }}+ >+ <div className="grid gap-4 sm:grid-cols-[minmax(0,1fr)_96px]">+ <Field label={t("computers.field_host")} hint={t("computers.field_host_hint")}>+ <input+ className={cn(inputClass, "font-mono")}+ value={host}+ onChange={(e) => setHost(e.target.value)}+ placeholder="203.0.113.10"+ autoFocus+ spellCheck={false}+ autoComplete="off"+ />+ </Field>+ <Field label={t("computers.field_port")}>+ <input+ className={cn(inputClass, "font-mono")}+ value={port}+ inputMode="numeric"+ onChange={(e) => setPort(e.target.value.replace(/[^0-9]/g, ""))}+ />+ </Field>+ </div>+ <div className="grid gap-4 sm:grid-cols-2">+ <Field label={t("computers.field_name")}>+ <input+ className={inputClass}+ value={name}+ onChange={(e) => setName(e.target.value)}+ placeholder={t("computers.field_name_placeholder")}+ />+ </Field>+ <Field label={t("computers.field_username")}>+ <input+ className={cn(inputClass, "font-mono")}+ value={username}+ onChange={(e) => setUsername(e.target.value)}+ spellCheck={false}+ autoComplete="off"+ />+ </Field>+ </div>++ <div>+ <div className="mb-2 text-sm font-medium text-foreground-secondary">+ {t("computers.login_title")}+ </div>+ <div role="radiogroup" aria-label={t("computers.login_title")} className="space-y-2">+ <ModeCard+ active={mode === "password_once"}+ onClick={() => setMode("password_once")}+ title={t("computers.login_once_title")}+ body={t("computers.login_once_body")}+ badge={t("computers.recommended")}+ />+ <ModeCard+ active={mode === "key_added"}+ onClick={() => setMode("key_added")}+ title={t("computers.login_key_title")}+ body={t("computers.login_key_body")}+ />+ <ModeCard+ active={mode === "keep_password"}+ onClick={() => setMode("keep_password")}+ title={t("computers.login_keep_title")}+ body={t("computers.login_keep_body")}+ />+ </div>+ </div>++ {needsPassword ? (+ <Field+ label={t("computers.field_password")}+ hint={mode === "password_once" ? t("computers.password_once_hint") : t("computers.password_keep_hint")}+ >+ <input+ type="password"+ className={inputClass}+ value={password}+ onChange={(e) => setPassword(e.target.value)}+ autoComplete="new-password"+ />+ </Field>+ ) : identity.data ? (+ <CopyField+ multiline+ label={t("computers.key_paste_hint")}+ value={identity.data.public_key}+ copyLabel={t("computers.copy")}+ copiedLabel={t("computers.copied")}+ />+ ) : null}++ <ErrorNote message={error} />++ <div className="flex items-center justify-end gap-2 pt-1">+ <Button type="submit" disabled={!valid || busy}>+ {busy ? <Loader2 className="animate-spin" /> : <ShieldCheck />}+ {busy ? t("computers.connecting") : t("computers.connect")}+ </Button>+ </div>+ </form>+ );+}++// ---------------------------------------------------------------------------+// Door 2 — a hosting account+// ---------------------------------------------------------------------------++function CloudServerRow({+ server,+ selected,+ onSelect,+}: {+ server: CloudServer;+ selected: boolean;+ onSelect: () => void;+}) {+ const t = useT();+ const disabled = Boolean(server.added_as) || !server.host;+ const specs = [+ server.os,+ server.cpus ? `${server.cpus} ${t("computers.unit_cpu")}` : null,+ formatMemory(server.memory_mb),+ server.region,+ ].filter(Boolean);+ return (+ <li>+ <button+ type="button"+ role="radio"+ aria-checked={selected}+ disabled={disabled}+ onClick={onSelect}+ className={cn(+ "flex w-full items-center gap-3 px-4 py-3 text-left transition-colors",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",+ selected ? "bg-accent-soft" : "hover:bg-secondary/60",+ disabled && "cursor-not-allowed opacity-55 hover:bg-transparent",+ )}+ >+ <span+ aria-hidden+ className={cn(+ "flex h-4 w-4 shrink-0 items-center justify-center rounded-full border",+ selected ? "border-accent" : "border-border-strong",+ )}+ >+ {selected && <span className="h-2 w-2 rounded-full bg-accent" />}+ </span>+ <span className="min-w-0 flex-1">+ <span className="flex items-center gap-2">+ <span className="truncate text-base font-medium text-foreground-strong">{server.name}</span>+ <span+ className={cn(+ "h-1.5 w-1.5 shrink-0 rounded-full",+ server.running ? "bg-success" : "bg-foreground-faint",+ )}+ aria-hidden+ />+ <span className="shrink-0 text-xs text-muted-foreground">{server.status}</span>+ </span>+ <span className="mt-0.5 block truncate text-sm text-muted-foreground">+ <span className="font-mono text-xs">{server.host ?? t("computers.no_ip")}</span>+ {specs.length > 0 && ` · ${specs.join(" · ")}`}+ </span>+ </span>+ {server.added_as && (+ <span className="shrink-0 rounded-full bg-secondary px-2 py-0.5 text-xs text-foreground-secondary">+ {t("computers.already_added")}+ </span>+ )}+ </button>+ </li>+ );+}++function CloudForm({ onAdded }: { onAdded: (computer: Computer) => void }) {+ const t = useT();+ const qc = useQueryClient();+ const providers = useCloudProviders();+ const [providerId, setProviderId] = useState<CloudProviderId>("hostinger");+ const provider = providers.data?.find((p) => p.id === providerId);+ const connected = Boolean(provider?.connected);+ const servers = useCloudServers(providerId, connected);+ const [token, setToken] = useState("");+ const [selected, setSelected] = useState<string | null>(null);+ const [usePassword, setUsePassword] = useState(false);+ const [password, setPassword] = useState("");+ const [username, setUsername] = useState("root");+ const [busy, setBusy] = useState(false);+ const [error, setError] = useState<string | null>(null);++ useEffect(() => {+ setSelected(null);+ setError(null);+ setToken("");+ setPassword("");+ setUsePassword(false);+ }, [providerId]);++ const needsPassword = !provider?.attaches_keys || usePassword;++ async function saveToken() {+ if (token.trim().length < 8 || busy) return;+ setBusy(true);+ setError(null);+ try {+ const result = await computersApi.saveCloudToken(providerId, token.trim());+ qc.setQueryData(computerKeys.cloudServers(providerId), result.servers);+ await qc.invalidateQueries({ queryKey: computerKeys.cloud(), exact: true });+ setToken("");+ } catch (e) {+ setError(errorText(e));+ } finally {+ setBusy(false);+ }+ }++ async function disconnect() {+ setBusy(true);+ try {+ await computersApi.forgetCloudToken(providerId);+ await qc.invalidateQueries({ queryKey: computerKeys.cloud() });+ } catch (e) {+ setError(errorText(e));+ } finally {+ setBusy(false);+ }+ }++ async function importServer() {+ if (!selected || busy) return;+ if (needsPassword && !password) return;+ setBusy(true);+ setError(null);+ try {+ const computer = await computersApi.importCloudServer(providerId, {+ server_id: selected,+ username: username.trim() || "root",+ password: needsPassword ? password : undefined,+ });+ onAdded(computer);+ } catch (e) {+ setError(errorText(e));+ } finally {+ setBusy(false);+ }+ }++ return (+ <div className="space-y-5">+ <div role="tablist" aria-label={t("computers.cloud_provider")} className="grid grid-cols-3 gap-2">+ {(providers.data ?? []).map((p) => (+ <button+ key={p.id}+ type="button"+ role="tab"+ aria-selected={p.id === providerId}+ onClick={() => setProviderId(p.id)}+ className={cn(+ "flex items-center gap-2.5 rounded-md border px-3 py-2.5 text-left transition-colors",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",+ p.id === providerId+ ? "border-accent bg-accent-soft"+ : "border-border hover:border-border-strong",+ )}+ >+ <ProviderLogo providerId={p.id} label={p.name} className="h-8 w-8" />+ <span className="min-w-0">+ <span className="block truncate text-sm font-medium text-foreground-strong">{p.name}</span>+ <span className="flex items-center gap-1 text-xs text-muted-foreground">+ <span+ className={cn("h-1.5 w-1.5 rounded-full", p.connected ? "bg-success" : "bg-foreground-faint")}+ aria-hidden+ />+ {p.connected ? t("computers.account_connected") : t("computers.account_not_connected")}+ </span>+ </span>+ </button>+ ))}+ </div>++ {providers.isLoading && <Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />}++ {provider && !connected && (+ <div className="space-y-4 rounded-lg border border-border bg-card p-4">+ <div>+ <div className="text-base font-medium text-foreground-strong">+ {t("computers.token_title").replace("{provider}", provider.name)}+ </div>+ <p className="mt-1 text-sm text-muted-foreground">{t("computers.token_body")}</p>+ </div>+ <ol className="space-y-1.5 text-sm text-foreground-secondary">+ <li className="flex gap-2">+ <span className="tabular-nums text-foreground-faint">1</span>+ <span>+ <button+ type="button"+ onClick={() => void openExternalUrl(provider.console_url)}+ className="inline-flex items-center gap-1 font-medium text-accent underline-offset-4 hover:underline"+ >+ {t("computers.token_open").replace("{provider}", provider.name)}+ <ExternalLink className="h-3.5 w-3.5" aria-hidden />+ </button>+ <span className="block text-xs text-muted-foreground">{provider.setup_hint}</span>+ </span>+ </li>+ <li className="flex gap-2">+ <span className="tabular-nums text-foreground-faint">2</span>+ <span>{t("computers.token_paste")}</span>+ </li>+ </ol>+ <form+ className="flex gap-2"+ onSubmit={(e) => {+ e.preventDefault();+ void saveToken();+ }}+ >+ <input+ type="password"+ className={cn(inputClass, "font-mono")}+ value={token}+ onChange={(e) => setToken(e.target.value)}+ placeholder={t("computers.token_placeholder")}+ aria-label={t("computers.token_placeholder")}+ autoComplete="off"+ />+ <Button type="submit" disabled={token.trim().length < 8 || busy}>+ {busy ? <Loader2 className="animate-spin" /> : <KeyRound />}+ {t("computers.token_save")}+ </Button>+ </form>+ <p className="text-xs text-muted-foreground">{t("computers.token_storage")}</p>+ </div>+ )}++ {provider && connected && (+ <div className="space-y-4">+ <div className="flex items-center justify-between gap-3">+ <div className="text-sm font-medium text-foreground-secondary">+ {t("computers.pick_server")}+ </div>+ <div className="flex items-center gap-1">+ <Button+ type="button"+ variant="ghost"+ size="sm"+ onClick={() => void servers.refetch()}+ disabled={servers.isFetching}+ >+ {servers.isFetching ? <Loader2 className="animate-spin" /> : <RefreshCw />}+ {t("computers.refresh")}+ </Button>+ <Button type="button" variant="ghost" size="sm" onClick={() => void disconnect()} disabled={busy}>+ {t("computers.disconnect_account")}+ </Button>+ </div>+ </div>+ {servers.isError && <ErrorNote message={errorText(servers.error)} />}+ {servers.data && servers.data.length === 0 && (+ <p className="rounded-md border border-dashed border-border px-4 py-6 text-center text-sm text-muted-foreground">+ {t("computers.no_servers_in_account")}+ </p>+ )}+ {servers.data && servers.data.length > 0 && (+ <ul+ role="radiogroup"+ aria-label={t("computers.pick_server")}+ className="max-h-64 divide-y divide-border overflow-y-auto rounded-lg border border-border scrollbar-jarvis"+ >+ {servers.data.map((server) => (+ <CloudServerRow+ key={server.id}+ server={server}+ selected={selected === server.id}+ onSelect={() => setSelected(server.id)}+ />+ ))}+ </ul>+ )}++ {selected && (+ <div className="space-y-3 rounded-lg border border-border bg-card p-4">+ {provider.attaches_keys && !usePassword ? (+ <div className="flex items-start gap-3">+ <ShieldCheck className="mt-0.5 h-4 w-4 shrink-0 text-success" aria-hidden />+ <div className="min-w-0 text-sm">+ <div className="font-medium text-foreground-strong">+ {t("computers.auto_key_title")}+ </div>+ <p className="mt-0.5 text-muted-foreground">+ {t("computers.auto_key_body").replace("{provider}", provider.name)}+ </p>+ <button+ type="button"+ className="mt-1.5 text-sm text-accent underline-offset-4 hover:underline"+ onClick={() => setUsePassword(true)}+ >+ {t("computers.use_password_instead")}+ </button>+ </div>+ </div>+ ) : (+ <div className="grid gap-3 sm:grid-cols-[120px_minmax(0,1fr)]">+ <Field label={t("computers.field_username")}>+ <input+ className={cn(inputClass, "font-mono")}+ value={username}+ onChange={(e) => setUsername(e.target.value)}+ />+ </Field>+ <Field label={t("computers.field_password")} hint={t("computers.password_once_hint")}>+ <input+ type="password"+ className={inputClass}+ value={password}+ onChange={(e) => setPassword(e.target.value)}+ autoComplete="new-password"+ />+ </Field>+ </div>+ )}+ </div>+ )}++ <ErrorNote message={error} />++ <div className="flex justify-end">+ <Button+ type="button"+ onClick={() => void importServer()}+ disabled={!selected || busy || (needsPassword && !password)}+ >+ {busy ? <Loader2 className="animate-spin" /> : <ShieldCheck />}+ {busy ? t("computers.connecting") : t("computers.connect")}+ </Button>+ </div>+ </div>+ )}++ {!connected && <ErrorNote message={error} />}+ </div>+ );+}++// ---------------------------------------------------------------------------+// Door 3 — a local virtual machine+// ---------------------------------------------------------------------------++function nextFreeName(taken: string[]): string {+ if (!taken.includes("jarvis-vm")) return "jarvis-vm";+ for (let i = 2; i < 100; i += 1) {+ const candidate = `jarvis-vm-${i}`;+ if (!taken.includes(candidate)) return candidate;+ }+ return "jarvis-vm-x";+}++function LocalForm({ onAdded }: { onAdded: (computer: Computer) => void }) {+ const t = useT();+ const status = useLocalStatus();+ const taken = useMemo(() => (status.data?.instances ?? []).map((i) => i.name), [status.data]);+ const [name, setName] = useState("");+ const [image, setImage] = useState("24.04");+ const [cpus, setCpus] = useState(2);+ const [memory, setMemory] = useState(4);+ const [disk, setDisk] = useState(20);+ const [busy, setBusy] = useState(false);+ const [error, setError] = useState<string | null>(null);++ useEffect(() => {+ if (!name && status.data) setName(nextFreeName(taken));+ }, [name, status.data, taken]);++ const nameValid = /^[a-z][a-z0-9-]{0,38}[a-z0-9]$/.test(name);++ async function create() {+ if (!nameValid || busy) return;+ setBusy(true);+ setError(null);+ try {+ const computer = await computersApi.createLocalVm({+ name,+ cpus,+ memory_gb: memory,+ disk_gb: disk,+ image,+ });+ onAdded(computer);+ } catch (e) {+ setError(errorText(e));+ } finally {+ setBusy(false);+ }+ }++ if (status.isLoading) {+ return (+ <div className="flex items-center gap-2 py-8 text-sm text-muted-foreground">+ <Loader2 className="h-4 w-4 animate-spin" /> {t("computers.local_checking")}+ </div>+ );+ }++ const data = status.data;+ if (!data || !data.available) {+ return (+ <div className="space-y-4 rounded-lg border border-border bg-card p-5">+ <div>+ <div className="text-title font-medium text-foreground-strong">{t("computers.local_missing_title")}</div>+ <p className="mt-1 text-sm text-muted-foreground">{t("computers.local_missing_body")}</p>+ </div>+ {data && (+ <code className="block rounded-md border border-border bg-surface-raised px-3 py-2 font-mono text-xs text-foreground-secondary">+ {data.install_hint}+ </code>+ )}+ <div className="flex flex-wrap gap-2">+ {data && (+ <Button type="button" onClick={() => void openExternalUrl(data.install_url)}>+ <ExternalLink />+ {t("computers.local_get_multipass")}+ </Button>+ )}+ <Button type="button" variant="outline" onClick={() => void status.refetch()}>+ <RefreshCw />+ {t("computers.check_again")}+ </Button>+ </div>+ <p className="text-xs text-muted-foreground">{t("computers.local_missing_foot")}</p>+ </div>+ );+ }++ return (+ <form+ className="space-y-5"+ onSubmit={(e) => {+ e.preventDefault();+ void create();+ }}+ >+ {data.error && <ErrorNote message={data.error} />}+ <Field+ label={t("computers.field_vm_name")}+ hint={nameValid || !name ? t("computers.vm_name_hint") : t("computers.vm_name_invalid")}+ >+ <input+ className={cn(inputClass, "font-mono")}+ value={name}+ onChange={(e) => setName(e.target.value.toLowerCase())}+ spellCheck={false}+ autoFocus+ />+ </Field>+ <div className="grid gap-5 sm:grid-cols-2">+ <div>+ <div className="mb-1.5 text-sm font-medium text-foreground-secondary">{t("computers.field_image")}</div>+ <Choice+ label={t("computers.field_image")}+ value={image}+ onChange={setImage}+ options={data.images.map((i) => ({ id: i, label: `Ubuntu ${i}` }))}+ />+ </div>+ <div>+ <div className="mb-1.5 text-sm font-medium text-foreground-secondary">{t("computers.field_cpus")}</div>+ <Choice+ label={t("computers.field_cpus")}+ value={cpus}+ onChange={setCpus}+ options={[1, 2, 4, 8].map((n) => ({ id: n, label: String(n) }))}+ />+ </div>+ <div>+ <div className="mb-1.5 text-sm font-medium text-foreground-secondary">{t("computers.field_memory")}</div>+ <Choice+ label={t("computers.field_memory")}+ value={memory}+ onChange={setMemory}+ options={[2, 4, 8, 16].map((n) => ({ id: n, label: `${n} GB` }))}+ />+ </div>+ <div>+ <div className="mb-1.5 text-sm font-medium text-foreground-secondary">{t("computers.field_disk")}</div>+ <Choice+ label={t("computers.field_disk")}+ value={disk}+ onChange={setDisk}+ options={[10, 20, 40, 80].map((n) => ({ id: n, label: `${n} GB` }))}+ />+ </div>+ </div>+ <div className="flex items-start gap-3 rounded-lg border border-border bg-card p-4 text-sm">+ <ShieldCheck className="mt-0.5 h-4 w-4 shrink-0 text-success" aria-hidden />+ <p className="text-muted-foreground">{t("computers.local_key_note")}</p>+ </div>+ <ErrorNote message={error} />+ <div className="flex items-center justify-between gap-3">+ <span className="text-xs text-muted-foreground">+ Multipass {data.version ?? ""}+ </span>+ <Button type="submit" disabled={!nameValid || busy}>+ {busy ? <Loader2 className="animate-spin" /> : <MonitorSmartphone />}+ {t("computers.create_vm")}+ </Button>+ </div>+ </form>+ );+}++// ---------------------------------------------------------------------------+// The dialog+// ---------------------------------------------------------------------------++export function AddComputerDialog({+ initialPath,+ onClose,+ onAdded,+}: {+ initialPath: AddPath | null;+ onClose: () => void;+ onAdded: (computer: Computer) => void;+}) {+ const t = useT();+ const upsert = useUpsertComputer();+ const [path, setPath] = useState<AddPath | null>(initialPath);++ useEffect(() => {+ const onKey = (e: KeyboardEvent) => {+ if (e.key === "Escape") onClose();+ };+ window.addEventListener("keydown", onKey);+ return () => window.removeEventListener("keydown", onKey);+ }, [onClose]);++ const titles: Record<AddPath, string> = {+ server: t("computers.path_server_title"),+ cloud: t("computers.path_cloud_title"),+ local: t("computers.path_local_title"),+ };++ const finish = (computer: Computer) => {+ upsert(computer);+ onAdded(computer);+ };++ return (+ <div+ className="fixed inset-0 z-50 flex items-center justify-center bg-scrim/50 p-4 backdrop-blur-sm motion-safe:animate-in motion-safe:fade-in"+ onClick={onClose}+ >+ <div+ role="dialog"+ aria-modal="true"+ aria-label={t("computers.add_title")}+ data-testid="computers-add-dialog"+ className={cn(+ "max-h-[90vh] w-full overflow-y-auto rounded-xl bg-popover p-6 shadow-float scrollbar-jarvis",+ path ? "max-w-xl" : "max-w-3xl",+ )}+ onClick={(e) => e.stopPropagation()}+ >+ <header className="mb-5 flex items-start gap-3">+ {path && initialPath === null && (+ <button+ type="button"+ onClick={() => setPath(null)}+ aria-label={t("computers.back")}+ className="mt-0.5 rounded-md p-1 text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"+ >+ <ArrowLeft className="h-4 w-4" />+ </button>+ )}+ <div className="min-w-0 flex-1">+ <h2 className="text-lg font-semibold text-foreground-strong">+ {path ? titles[path] : t("computers.add_title")}+ </h2>+ <p className="mt-0.5 text-sm text-muted-foreground">+ {path ? t(`computers.path_${path}_lead`) : t("computers.add_subtitle")}+ </p>+ </div>+ <button+ type="button"+ onClick={onClose}+ aria-label={t("computers.close")}+ className="rounded-md p-1 text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"+ >+ <X className="h-4 w-4" />+ </button>+ </header>++ {path === null && <PathChoices onPick={setPath} />}+ {path === "server" && <ServerForm onAdded={finish} />}+ {path === "cloud" && <CloudForm onAdded={finish} />}+ {path === "local" && <LocalForm onAdded={finish} />}+ </div>+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/views/computers/ComputerDetail.tsx b/jarvis/ui/web/frontend/src/views/computers/ComputerDetail.tsxnew file mode 100644index 0000000000..1ff6f0e442--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/computers/ComputerDetail.tsx@@ -0,0 +1,688 @@+/**+ * One computer, full page: what is wrong (and the one button that fixes it),+ * its vitals, the facts, a console for one-off commands, and how Jarvis logs+ * in. Replaces the list in place, with "← All computers" on top — the same+ * detail pattern as the rest of Settings.+ */+import { useEffect, useRef, useState, type ReactNode } from "react";+import {+ Activity,+ KeyRound,+ Loader2,+ Pencil,+ Play,+ Power,+ RefreshCw,+ ShieldAlert,+ ShieldCheck,+ SquareTerminal,+ Trash2,+} from "lucide-react";+import { BackLink, FactRows, Panel } from "@/components/extensions/primitives";+import { Button } from "@/components/ui/button";+import { ProviderLogo } from "@/components/providers/ProviderLogo";+import {+ useCheckComputer,+ useIdentity,+ useRemoveComputer,+ useUpsertComputer,+} from "@/hooks/useComputers";+import { useT } from "@/i18n";+import { cn } from "@/lib/utils";+import { computersApi, type CommandResult, type Computer } from "@/lib/computersApi";+import { statusLabel } from "./ComputerRow";+import {+ CopyField,+ Meter,+ StatusLight,+ formatAgo,+ formatMemory,+ formatUptime,+ inputClass,+ loadPct,+ statusTone,+} from "./parts";++function errorText(error: unknown): string {+ return error instanceof Error ? error.message : String(error);+}++function Card({+ title,+ icon,+ actions,+ children,+ className,+}: {+ title: string;+ icon: ReactNode;+ actions?: ReactNode;+ children: ReactNode;+ className?: string;+}) {+ return (+ <Panel className={cn("p-5", className)}>+ <div className="mb-4 flex items-center gap-2.5">+ <span className="text-muted-foreground [&>svg]:h-4 [&>svg]:w-4">{icon}</span>+ <h3 className="flex-1 text-base font-semibold text-foreground-strong">{title}</h3>+ {actions}+ </div>+ {children}+ </Panel>+ );+}++// ---------------------------------------------------------------------------+// The attention banner: what is wrong, and the fix right there+// ---------------------------------------------------------------------------++function AttentionBanner({ computer }: { computer: Computer }) {+ const t = useT();+ const upsert = useUpsertComputer();+ const check = useCheckComputer();+ const identity = useIdentity();+ const [password, setPassword] = useState("");+ const [busy, setBusy] = useState(false);+ const [error, setError] = useState<string | null>(null);+ const status = computer.health.status;++ async function act(fn: () => Promise<Computer>) {+ setBusy(true);+ setError(null);+ try {+ upsert(await fn());+ setPassword("");+ } catch (e) {+ setError(errorText(e));+ } finally {+ setBusy(false);+ }+ }++ if (status === "provisioning") {+ return (+ <div+ className="relative overflow-hidden rounded-lg border border-border bg-card p-5"+ data-testid="computer-provisioning"+ >+ <div className="flex items-start gap-3">+ <Loader2 className="mt-0.5 h-4 w-4 shrink-0 animate-spin text-info" aria-hidden />+ <div>+ <div className="text-base font-medium text-foreground-strong">{t("computers.provisioning_title")}</div>+ <p className="mt-0.5 text-sm text-muted-foreground">{computer.health.message}</p>+ </div>+ </div>+ <div className="absolute inset-x-0 bottom-0 h-0.5 overflow-hidden bg-secondary">+ <div className="h-full w-1/3 animate-[computers-indeterminate_1.6s_ease-in-out_infinite] bg-info" />+ </div>+ </div>+ );+ }++ if (status === "auth_failed") {+ return (+ <div className="space-y-4 rounded-lg border border-warning/50 bg-warning/10 p-5">+ <div className="flex items-start gap-3">+ <KeyRound className="mt-0.5 h-4 w-4 shrink-0 text-warning" aria-hidden />+ <div>+ <div className="text-base font-medium text-foreground-strong">{t("computers.fix_auth_title")}</div>+ <p className="mt-0.5 text-sm text-muted-foreground">+ {computer.health.message ? `${computer.health.message} ` : ""}+ {t("computers.fix_auth_body")}+ </p>+ </div>+ </div>+ <form+ className="flex flex-col gap-2 sm:flex-row"+ onSubmit={(e) => {+ e.preventDefault();+ if (password) void act(() => computersApi.installKey(computer.id, password));+ }}+ >+ <input+ type="password"+ className={inputClass}+ value={password}+ onChange={(e) => setPassword(e.target.value)}+ placeholder={t("computers.password_for").replace("{user}", computer.username)}+ aria-label={t("computers.field_password")}+ autoComplete="off"+ />+ <Button type="submit" disabled={!password || busy}>+ {busy ? <Loader2 className="animate-spin" /> : <ShieldCheck />}+ {t("computers.install_key")}+ </Button>+ </form>+ {identity.data && (+ <details className="text-sm">+ <summary className="cursor-pointer text-muted-foreground hover:text-foreground">+ {t("computers.fix_auth_manual")}+ </summary>+ <div className="mt-3">+ <CopyField+ multiline+ label={t("computers.key_paste_hint")}+ value={identity.data.public_key}+ copyLabel={t("computers.copy")}+ copiedLabel={t("computers.copied")}+ />+ </div>+ </details>+ )}+ {error && <p role="alert" className="text-sm text-destructive">{error}</p>}+ </div>+ );+ }++ if (status === "host_key_changed") {+ return (+ <div className="space-y-3 rounded-lg border border-destructive/50 bg-destructive/10 p-5">+ <div className="flex items-start gap-3">+ <ShieldAlert className="mt-0.5 h-4 w-4 shrink-0 text-destructive" aria-hidden />+ <div>+ <div className="text-base font-medium text-foreground-strong">{t("computers.fix_hostkey_title")}</div>+ <p className="mt-0.5 text-sm text-muted-foreground">{t("computers.fix_hostkey_body")}</p>+ {computer.host_fingerprint && (+ <p className="mt-2 font-mono text-xs text-foreground-secondary">+ {t("computers.pinned_identity")}: {computer.host_fingerprint}+ </p>+ )}+ </div>+ </div>+ <div className="flex flex-wrap gap-2">+ <Button+ type="button"+ variant="outline"+ disabled={busy}+ onClick={() => void act(() => computersApi.trustHostKey(computer.id))}+ >+ {busy ? <Loader2 className="animate-spin" /> : <ShieldCheck />}+ {t("computers.trust_new_identity")}+ </Button>+ </div>+ {error && <p role="alert" className="text-sm text-destructive">{error}</p>}+ </div>+ );+ }++ if (status === "offline" || status === "error") {+ return (+ <div className="flex flex-col gap-3 rounded-lg border border-destructive/40 bg-destructive/[0.07] p-5 sm:flex-row sm:items-center">+ <div className="min-w-0 flex-1">+ <div className="text-base font-medium text-foreground-strong">+ {status === "offline" ? t("computers.fix_offline_title") : t("computers.fix_error_title")}+ </div>+ <p className="mt-0.5 text-sm text-muted-foreground">{computer.health.message}</p>+ </div>+ <Button+ type="button"+ variant="outline"+ disabled={check.isPending}+ onClick={() => check.mutate(computer.id)}+ >+ {check.isPending ? <Loader2 className="animate-spin" /> : <RefreshCw />}+ {t("computers.check_again")}+ </Button>+ </div>+ );+ }++ return null;+}++// ---------------------------------------------------------------------------+// The console: one command at a time, output kept for the visit+// ---------------------------------------------------------------------------++interface ConsoleEntry {+ id: number;+ command: string;+ result: CommandResult | null;+ error: string | null;+}++const QUICK_COMMANDS = ["uptime", "df -h /", "free -h", "docker ps", "systemctl --failed"];++function Console({ computer }: { computer: Computer }) {+ const t = useT();+ const [command, setCommand] = useState("");+ const [entries, setEntries] = useState<ConsoleEntry[]>([]);+ const [running, setRunning] = useState(false);+ const [history, setHistory] = useState<string[]>([]);+ const [cursor, setCursor] = useState<number | null>(null);+ const scroller = useRef<HTMLDivElement>(null);+ const counter = useRef(0);+ const online = computer.health.status === "online";++ useEffect(() => {+ const el = scroller.current;+ if (el) el.scrollTop = el.scrollHeight;+ }, [entries]);++ async function run(text: string) {+ const cmd = text.trim();+ if (!cmd || running) return;+ counter.current += 1;+ const id = counter.current;+ setEntries((rows) => [...rows, { id, command: cmd, result: null, error: null }]);+ setHistory((rows) => [...rows.filter((r) => r !== cmd), cmd].slice(-50));+ setCursor(null);+ setCommand("");+ setRunning(true);+ try {+ const result = await computersApi.run(computer.id, cmd);+ setEntries((rows) => rows.map((r) => (r.id === id ? { ...r, result } : r)));+ } catch (e) {+ setEntries((rows) => rows.map((r) => (r.id === id ? { ...r, error: errorText(e) } : r)));+ } finally {+ setRunning(false);+ }+ }++ const prompt = `${computer.username}@${computer.facts?.hostname ?? computer.name}`;++ return (+ <Card+ title={t("computers.console_title")}+ icon={<SquareTerminal />}+ actions={+ entries.length > 0 ? (+ <Button type="button" variant="ghost" size="sm" onClick={() => setEntries([])}>+ {t("computers.console_clear")}+ </Button>+ ) : null+ }+ >+ <div className="overflow-hidden rounded-lg border border-border bg-surface-raised">+ <div+ ref={scroller}+ className="h-72 overflow-y-auto px-4 py-3 font-mono text-xs leading-5 scrollbar-jarvis"+ data-testid="computer-console-output"+ >+ {entries.length === 0 && (+ <p className="text-muted-foreground">{t("computers.console_empty")}</p>+ )}+ {entries.map((entry) => (+ <div key={entry.id} className="mb-3">+ <div className="text-foreground-strong">+ <span className="text-success">{prompt}</span>+ <span className="text-muted-foreground"> $ </span>+ {entry.command}+ </div>+ {entry.result === null && entry.error === null && (+ <Loader2 className="mt-1 h-3 w-3 animate-spin text-muted-foreground" />+ )}+ {entry.result && (+ <>+ {entry.result.stdout && (+ <pre className="whitespace-pre-wrap break-words text-foreground-secondary">+ {entry.result.stdout}+ </pre>+ )}+ {entry.result.stderr && (+ <pre className="whitespace-pre-wrap break-words text-warning">{entry.result.stderr}</pre>+ )}+ <div className="text-[11px] text-foreground-faint">+ {t("computers.console_exit")} {entry.result.exit_status ?? "?"} · {entry.result.duration_ms} ms+ {entry.result.truncated ? ` · ${t("computers.console_truncated")}` : ""}+ </div>+ </>+ )}+ {entry.error && <div className="text-destructive">{entry.error}</div>}+ </div>+ ))}+ </div>+ <form+ className="flex items-center gap-2 border-t border-border px-4 py-2.5"+ onSubmit={(e) => {+ e.preventDefault();+ void run(command);+ }}+ >+ <span className="shrink-0 font-mono text-xs text-muted-foreground">$</span>+ <input+ className="min-w-0 flex-1 bg-transparent font-mono text-xs text-foreground placeholder:text-foreground-faint focus:outline-none"+ value={command}+ onChange={(e) => setCommand(e.target.value)}+ onKeyDown={(e) => {+ if (e.key === "ArrowUp" && history.length > 0) {+ e.preventDefault();+ const next = cursor === null ? history.length - 1 : Math.max(0, cursor - 1);+ setCursor(next);+ setCommand(history[next]);+ } else if (e.key === "ArrowDown" && cursor !== null) {+ e.preventDefault();+ const next = cursor + 1;+ if (next >= history.length) {+ setCursor(null);+ setCommand("");+ } else {+ setCursor(next);+ setCommand(history[next]);+ }+ }+ }}+ placeholder={online ? t("computers.console_placeholder") : t("computers.console_offline")}+ aria-label={t("computers.console_title")}+ disabled={!online}+ spellCheck={false}+ autoComplete="off"+ />+ {running && <Loader2 className="h-3.5 w-3.5 animate-spin text-muted-foreground" />}+ </form>+ </div>+ <div className="mt-3 flex flex-wrap gap-1.5">+ {QUICK_COMMANDS.map((q) => (+ <button+ key={q}+ type="button"+ disabled={!online || running}+ onClick={() => void run(q)}+ className="rounded-md border border-border px-2 py-1 font-mono text-xs text-muted-foreground transition-colors hover:border-border-strong hover:text-foreground disabled:opacity-50"+ >+ {q}+ </button>+ ))}+ </div>+ </Card>+ );+}++// ---------------------------------------------------------------------------+// Remove: a small confirm in place, with the "delete the VM too" choice+// ---------------------------------------------------------------------------++function RemoveConfirm({+ computer,+ onCancel,+ onRemoved,+}: {+ computer: Computer;+ onCancel: () => void;+ onRemoved: () => void;+}) {+ const t = useT();+ const remove = useRemoveComputer();+ const [destroyVm, setDestroyVm] = useState(false);+ return (+ <div className="space-y-3 rounded-lg border border-destructive/40 bg-destructive/[0.07] p-4">+ <p className="text-sm text-foreground">+ {t("computers.remove_confirm").replace("{computer}", computer.name)}+ </p>+ {computer.kind === "local_vm" && (+ <label className="flex items-center gap-2 text-sm text-foreground-secondary">+ <input+ type="checkbox"+ checked={destroyVm}+ onChange={(e) => setDestroyVm(e.target.checked)}+ className="h-4 w-4 accent-[hsl(var(--destructive))]"+ />+ {t("computers.remove_destroy_vm")}+ </label>+ )}+ {remove.isError && <p role="alert" className="text-sm text-destructive">{errorText(remove.error)}</p>}+ <div className="flex gap-2">+ <Button+ type="button"+ variant="destructive"+ disabled={remove.isPending}+ onClick={() => remove.mutate({ id: computer.id, destroyVm }, { onSuccess: onRemoved })}+ >+ {remove.isPending ? <Loader2 className="animate-spin" /> : <Trash2 />}+ {t("computers.remove")}+ </Button>+ <Button type="button" variant="ghost" onClick={onCancel}>+ {t("computers.cancel")}+ </Button>+ </div>+ </div>+ );+}++// ---------------------------------------------------------------------------+// The page+// ---------------------------------------------------------------------------++export function ComputerDetail({ computer, onBack }: { computer: Computer; onBack: () => void }) {+ const t = useT();+ const check = useCheckComputer();+ const upsert = useUpsertComputer();+ const identity = useIdentity();+ const [renaming, setRenaming] = useState(false);+ const [draftName, setDraftName] = useState(computer.name);+ const [confirmRemove, setConfirmRemove] = useState(false);+ const [powerBusy, setPowerBusy] = useState(false);+ const [powerError, setPowerError] = useState<string | null>(null);++ const { facts, health } = computer;+ const online = health.status === "online";+ const tone = statusTone(health.status);+ const isVm = computer.kind === "local_vm";++ async function saveName() {+ const name = draftName.trim();+ setRenaming(false);+ if (!name || name === computer.name) return;+ try {+ upsert(await computersApi.update(computer.id, { name }));+ } catch (e) {+ setDraftName(computer.name);+ setPowerError(errorText(e));+ }+ }++ async function power(action: "start" | "stop") {+ setPowerBusy(true);+ setPowerError(null);+ try {+ upsert(await computersApi.power(computer.id, action));+ } catch (e) {+ setPowerError(errorText(e));+ } finally {+ setPowerBusy(false);+ }+ }++ const providerLine = [+ computer.provider === "generic" ? null : t(`computers.provider_${computer.provider}`),+ computer.region,+ computer.plan,+ ].filter(Boolean);++ return (+ <div className="flex w-full flex-col gap-5" data-testid="computer-detail">+ <BackLink label={t("computers.all_computers")} onClick={onBack} />++ <header className="flex flex-col gap-4 md:flex-row md:items-start">+ <div className="flex min-w-0 flex-1 items-start gap-4">+ <ProviderLogo providerId={computer.provider} label={computer.name} className="h-12 w-12" />+ <div className="min-w-0 flex-1">+ {renaming ? (+ <input+ className={cn(inputClass, "h-10 max-w-md text-xl font-semibold")}+ value={draftName}+ autoFocus+ onChange={(e) => setDraftName(e.target.value)}+ onBlur={() => void saveName()}+ onKeyDown={(e) => {+ if (e.key === "Enter") void saveName();+ if (e.key === "Escape") {+ setDraftName(computer.name);+ setRenaming(false);+ }+ }}+ aria-label={t("computers.field_name")}+ />+ ) : (+ <button+ type="button"+ onClick={() => {+ setDraftName(computer.name);+ setRenaming(true);+ }}+ className="group flex max-w-full items-center gap-2 text-left"+ title={t("computers.rename")}+ >+ <h2 className="truncate text-xl font-semibold text-foreground-strong">{computer.name}</h2>+ <Pencil className="h-3.5 w-3.5 shrink-0 text-foreground-faint opacity-0 transition-opacity group-hover:opacity-100" />+ </button>+ )}+ <div className="mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted-foreground">+ <span className="inline-flex items-center gap-1.5">+ <StatusLight tone={tone} />+ <span className="text-foreground-secondary">{statusLabel(computer, t)}</span>+ </span>+ <span className="font-mono text-xs">+ {computer.username}@{computer.host === "0.0.0.0" ? "…" : computer.host}+ {computer.port !== 22 ? `:${computer.port}` : ""}+ </span>+ {providerLine.length > 0 && <span>{providerLine.join(" · ")}</span>}+ </div>+ </div>+ </div>+ <div className="flex shrink-0 flex-wrap items-center gap-2">+ {isVm && health.status === "stopped" && (+ <Button type="button" variant="outline" disabled={powerBusy} onClick={() => void power("start")}>+ {powerBusy ? <Loader2 className="animate-spin" /> : <Play />}+ {t("computers.start_vm")}+ </Button>+ )}+ {isVm && online && (+ <Button type="button" variant="outline" disabled={powerBusy} onClick={() => void power("stop")}>+ {powerBusy ? <Loader2 className="animate-spin" /> : <Power />}+ {t("computers.stop_vm")}+ </Button>+ )}+ <Button+ type="button"+ variant="outline"+ disabled={check.isPending || health.status === "provisioning"}+ onClick={() => check.mutate(computer.id)}+ >+ {check.isPending ? <Loader2 className="animate-spin" /> : <RefreshCw />}+ {t("computers.check_now")}+ </Button>+ <Button+ type="button"+ variant="ghost"+ size="icon"+ aria-label={t("computers.remove")}+ title={t("computers.remove")}+ onClick={() => setConfirmRemove((v) => !v)}+ >+ <Trash2 />+ </Button>+ </div>+ </header>++ {confirmRemove && (+ <RemoveConfirm computer={computer} onCancel={() => setConfirmRemove(false)} onRemoved={onBack} />+ )}+ {powerError && <p role="alert" className="text-sm text-destructive">{powerError}</p>}++ <AttentionBanner computer={computer} />++ <div className="grid gap-5 xl:grid-cols-[minmax(0,1fr)_minmax(0,1.25fr)]">+ <div className="flex min-w-0 flex-col gap-5">+ <Card+ title={t("computers.vitals_title")}+ icon={<Activity />}+ actions={+ <span className="text-xs text-muted-foreground">+ {t("computers.checked")} {formatAgo(health.checked_at, t)}+ </span>+ }+ >+ <div className="space-y-4">+ <Meter+ label={t("computers.meter_cpu_long")}+ pct={online ? loadPct(computer) : null}+ value={online && health.load_1m !== null ? `${health.load_1m.toFixed(2)}` : undefined}+ />+ <Meter+ label={t("computers.meter_memory")}+ pct={online ? health.mem_used_pct : null}+ />+ <Meter label={t("computers.meter_disk")} pct={online ? health.disk_used_pct : null} />+ </div>+ <div className="mt-5 grid grid-cols-2 gap-3 border-t border-border pt-4">+ <div>+ <div className="text-xs text-muted-foreground">{t("computers.uptime")}</div>+ <div className="mt-0.5 text-base tabular-nums text-foreground-strong">+ {online ? formatUptime(health.uptime_s, t) : "—"}+ </div>+ </div>+ <div>+ <div className="text-xs text-muted-foreground">{t("computers.latency")}</div>+ <div className="mt-0.5 text-base tabular-nums text-foreground-strong">+ {online && health.latency_ms !== null ? `${health.latency_ms} ms` : "—"}+ </div>+ </div>+ </div>+ </Card>++ <Card title={t("computers.facts_title")} icon={<SquareTerminal />}>+ {facts ? (+ <FactRows+ className="text-base"+ rows={[+ { label: t("computers.fact_os"), value: facts.os_name },+ { label: t("computers.fact_kernel"), value: facts.kernel },+ { label: t("computers.fact_arch"), value: facts.arch },+ {+ label: t("computers.fact_cpu"),+ value: facts.cpu_count ? `${facts.cpu_count} ${t("computers.unit_cpu")}` : null,+ },+ { label: t("computers.fact_memory"), value: formatMemory(facts.mem_total_mb) },+ {+ label: t("computers.fact_disk"),+ value: facts.disk_total_gb ? `${facts.disk_total_gb} GB` : null,+ },+ { label: t("computers.fact_hostname"), value: facts.hostname },+ ]}+ />+ ) : (+ <p className="text-sm text-muted-foreground">{t("computers.facts_empty")}</p>+ )}+ </Card>++ <Card title={t("computers.security_title")} icon={<ShieldCheck />}>+ <div className="space-y-4">+ <div className="flex items-start gap-3 text-sm">+ <KeyRound className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" aria-hidden />+ <div>+ <div className="font-medium text-foreground-strong">+ {computer.auth === "key" ? t("computers.auth_key") : t("computers.auth_password")}+ </div>+ <p className="text-muted-foreground">+ {computer.auth === "key" ? t("computers.auth_key_body") : t("computers.auth_password_body")}+ </p>+ </div>+ </div>+ {computer.host_fingerprint && (+ <CopyField+ label={t("computers.server_identity")}+ value={computer.host_fingerprint}+ copyLabel={t("computers.copy")}+ copiedLabel={t("computers.copied")}+ />+ )}+ {identity.data && (+ <CopyField+ label={t("computers.jarvis_key")}+ value={identity.data.public_key}+ copyLabel={t("computers.copy")}+ copiedLabel={t("computers.copied")}+ />+ )}+ </div>+ </Card>+ </div>++ <div className="min-w-0">+ <Console computer={computer} />+ </div>+ </div>+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/views/computers/ComputerRow.tsx b/jarvis/ui/web/frontend/src/views/computers/ComputerRow.tsxnew file mode 100644index 0000000000..fa3cb0d465--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/computers/ComputerRow.tsx@@ -0,0 +1,93 @@+/**+ * One machine in the list — a "rack unit": identity on the left, its state+ * in the middle, three live meters on the right. The whole row opens the+ * detail page.+ */+import { ChevronRight, Loader2 } from "lucide-react";+import { ProviderLogo } from "@/components/providers/ProviderLogo";+import { useT } from "@/i18n";+import { cn } from "@/lib/utils";+import type { Computer } from "@/lib/computersApi";+import { Meter, StatusLight, formatMemory, loadPct, statusTone } from "./parts";++export function statusLabel(computer: Computer, t: (k: string) => string): string {+ return t(`computers.status_${computer.health.status}`);+}++export function ComputerRow({+ computer,+ checking,+ onOpen,+}: {+ computer: Computer;+ checking: boolean;+ onOpen: () => void;+}) {+ const t = useT();+ const { facts, health } = computer;+ const tone = statusTone(health.status);+ const online = health.status === "online";+ const specs = [+ facts?.os_name,+ facts?.cpu_count ? `${facts.cpu_count} ${t("computers.unit_cpu")}` : null,+ formatMemory(facts?.mem_total_mb),+ computer.region,+ ].filter(Boolean);++ return (+ <li>+ <button+ type="button"+ onClick={onOpen}+ data-testid={`computer-row-${computer.id}`}+ className={cn(+ "group grid w-full grid-cols-1 items-center gap-x-6 gap-y-3 px-5 py-4 text-left transition-colors",+ "md:grid-cols-[minmax(0,1.5fr)_minmax(0,1fr)_20px]",+ "hover:bg-secondary/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",+ )}+ >+ <div className="flex min-w-0 items-center gap-3.5">+ <ProviderLogo providerId={computer.provider} label={computer.name} />+ <div className="min-w-0">+ <div className="flex min-w-0 items-center gap-2.5">+ <span className="truncate text-title font-medium text-foreground-strong">+ {computer.name}+ </span>+ <span className="inline-flex shrink-0 items-center gap-1.5 text-sm text-muted-foreground">+ {checking || computer.busy ? (+ <Loader2 className="h-3 w-3 animate-spin" aria-hidden />+ ) : (+ <StatusLight tone={tone} />+ )}+ {statusLabel(computer, t)}+ {online && health.latency_ms !== null && (+ <span className="tabular-nums text-foreground-faint">· {health.latency_ms} ms</span>+ )}+ </span>+ </div>+ <div className="mt-0.5 flex min-w-0 items-center gap-2 text-sm text-muted-foreground">+ <span className="truncate font-mono text-xs">+ {computer.username}@{computer.host === "0.0.0.0" ? "…" : computer.host}+ {computer.port !== 22 ? `:${computer.port}` : ""}+ </span>+ {specs.length > 0 && (+ <span className="hidden truncate lg:inline">· {specs.join(" · ")}</span>+ )}+ </div>+ </div>+ </div>++ <div className="grid min-w-0 grid-cols-3 gap-4">+ <Meter compact label={t("computers.meter_cpu")} pct={online ? loadPct(computer) : null} />+ <Meter compact label={t("computers.meter_memory")} pct={online ? health.mem_used_pct : null} />+ <Meter compact label={t("computers.meter_disk")} pct={online ? health.disk_used_pct : null} />+ </div>++ <ChevronRight+ aria-hidden+ className="hidden h-4 w-4 text-foreground-faint transition-transform group-hover:translate-x-0.5 group-hover:text-foreground md:block"+ />+ </button>+ </li>+ );+}diff --git a/jarvis/ui/web/frontend/src/views/computers/parts.tsx b/jarvis/ui/web/frontend/src/views/computers/parts.tsxnew file mode 100644index 0000000000..7f360f9381--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/computers/parts.tsx@@ -0,0 +1,224 @@+/**+ * Small shared pieces of the Computers section: the status light, the vital+ * meters, the copy field and the number formatting. Theme tokens only — hue+ * appears on status alone (success / warning / destructive), everything else+ * is ink on the neutral ladder, so light and dark mode need no second path.+ */+import { useState, type ReactNode } from "react";+import { Check, Copy } from "lucide-react";+import { robustCopy } from "@/lib/clipboard";+import { cn } from "@/lib/utils";+import type { Computer, HealthStatus } from "@/lib/computersApi";++export type Tone = "ok" | "warn" | "error" | "off" | "busy";++export function statusTone(status: HealthStatus): Tone {+ switch (status) {+ case "online":+ return "ok";+ case "provisioning":+ return "busy";+ case "auth_failed":+ case "host_key_changed":+ return "warn";+ case "offline":+ case "error":+ return "error";+ default:+ return "off";+ }+}++/** A computer needs the user's hand (not just "is off"). */+export function needsAttention(computer: Computer): boolean {+ const s = computer.health.status;+ return s === "auth_failed" || s === "host_key_changed" || s === "error" || s === "offline";+}++const TONE_DOT: Record<Tone, string> = {+ ok: "bg-success",+ busy: "bg-info",+ warn: "bg-warning",+ error: "bg-destructive",+ off: "bg-foreground-faint",+};++/** The status light: a dot with a soft halo while it is live or moving. */+export function StatusLight({ tone, className }: { tone: Tone; className?: string }) {+ const live = tone === "ok" || tone === "busy";+ return (+ <span className={cn("relative inline-flex h-2.5 w-2.5 shrink-0", className)} aria-hidden>+ {live && (+ <span+ className={cn(+ "absolute inset-0 rounded-full opacity-40 motion-safe:animate-ping",+ TONE_DOT[tone],+ tone === "ok" && "[animation-duration:2.4s]",+ )}+ />+ )}+ <span className={cn("relative inline-flex h-2.5 w-2.5 rounded-full", TONE_DOT[tone])} />+ </span>+ );+}++/** Colour of a fill level: ink until it gets tight, then status hues. */+function fillClass(pct: number): string {+ if (pct >= 90) return "bg-destructive";+ if (pct >= 75) return "bg-warning";+ return "bg-foreground-secondary";+}++/** One vital as a thin bar: label left, value right, the level beneath. */+export function Meter({+ label,+ pct,+ value,+ compact = false,+}: {+ label: string;+ /** 0-100; null draws an empty track and a dash. */+ pct: number | null;+ value?: ReactNode;+ compact?: boolean;+}) {+ const clamped = pct === null ? 0 : Math.max(0, Math.min(100, pct));+ return (+ <div className="min-w-0" role="group" aria-label={label}>+ <div+ className={cn(+ "flex items-baseline justify-between gap-2",+ compact ? "text-xs" : "text-sm",+ )}+ >+ <span className="truncate text-muted-foreground">{label}</span>+ <span className="shrink-0 tabular-nums text-foreground-secondary">+ {value ?? (pct === null ? "—" : `${Math.round(clamped)} %`)}+ </span>+ </div>+ <div+ className={cn(+ "mt-1.5 overflow-hidden rounded-full bg-secondary",+ compact ? "h-1" : "h-1.5",+ )}+ role="meter"+ aria-valuemin={0}+ aria-valuemax={100}+ aria-valuenow={pct === null ? undefined : Math.round(clamped)}+ aria-label={label}+ >+ <div+ className={cn(+ "h-full rounded-full transition-[width] duration-700 ease-out",+ fillClass(clamped),+ )}+ style={{ width: `${clamped}%` }}+ />+ </div>+ </div>+ );+}++/** Load average as a share of the cores it can use. */+export function loadPct(computer: Computer): number | null {+ const load = computer.health.load_1m;+ const cores = computer.facts?.cpu_count;+ if (load === null || !cores) return null;+ return (100 * load) / cores;+}++export function formatUptime(seconds: number | null, t: (k: string) => string): string {+ if (seconds === null) return "—";+ const days = Math.floor(seconds / 86400);+ const hours = Math.floor((seconds % 86400) / 3600);+ const minutes = Math.floor((seconds % 3600) / 60);+ if (days > 0) return `${days} ${t("computers.unit_days")} ${hours} ${t("computers.unit_hours")}`;+ if (hours > 0) return `${hours} ${t("computers.unit_hours")} ${minutes} ${t("computers.unit_minutes")}`;+ return `${minutes} ${t("computers.unit_minutes")}`;+}++export function formatMemory(mb: number | null | undefined): string | null {+ if (!mb) return null;+ return mb >= 1024 ? `${Math.round((mb / 1024) * 10) / 10} GB` : `${mb} MB`;+}++export function formatAgo(epochS: number | null, t: (k: string) => string): string {+ if (!epochS) return t("computers.never_checked");+ const diff = Math.max(0, Date.now() / 1000 - epochS);+ if (diff < 45) return t("computers.just_now");+ if (diff < 3600) return `${Math.round(diff / 60)} ${t("computers.unit_minutes")}`;+ if (diff < 86400) return `${Math.round(diff / 3600)} ${t("computers.unit_hours")}`;+ return `${Math.round(diff / 86400)} ${t("computers.unit_days")}`;+}++/** Monospace value with a copy button — the public key, a fingerprint. */+export function CopyField({+ value,+ label,+ copyLabel,+ copiedLabel,+ multiline = false,+}: {+ value: string;+ label: string;+ copyLabel: string;+ copiedLabel: string;+ multiline?: boolean;+}) {+ const [copied, setCopied] = useState(false);+ return (+ <div className="min-w-0">+ <div className="mb-1.5 text-sm text-muted-foreground">{label}</div>+ <div className="flex items-stretch gap-2">+ <code+ className={cn(+ "min-w-0 flex-1 rounded-md border border-border bg-surface-raised px-3 py-2 font-mono text-xs text-foreground-secondary",+ multiline ? "break-all" : "truncate",+ )}+ title={value}+ >+ {value}+ </code>+ <button+ type="button"+ onClick={() => {+ void robustCopy(value).then((ok) => {+ if (!ok) return;+ setCopied(true);+ window.setTimeout(() => setCopied(false), 1600);+ });+ }}+ className="inline-flex shrink-0 items-center gap-1.5 rounded-md border border-border-strong px-3 text-sm font-medium text-foreground transition-colors hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"+ aria-label={copyLabel}+ >+ {copied ? <Check className="h-4 w-4 text-success" /> : <Copy className="h-4 w-4" />}+ {copied ? copiedLabel : copyLabel}+ </button>+ </div>+ </div>+ );+}++/** A labelled form field in the section's quiet style. */+export function Field({+ label,+ hint,+ children,+ className,+}: {+ label: string;+ hint?: ReactNode;+ children: ReactNode;+ className?: string;+}) {+ return (+ <label className={cn("block min-w-0", className)}>+ <span className="mb-1.5 block text-sm font-medium text-foreground-secondary">{label}</span>+ {children}+ {hint && <span className="mt-1.5 block text-xs text-muted-foreground">{hint}</span>}+ </label>+ );+}++export const inputClass =+ "h-9 w-full rounded-md border border-border-strong bg-input px-3 text-base text-foreground placeholder:text-foreground-faint transition-colors focus:border-accent focus:outline-none focus:ring-2 focus:ring-ring";