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(contacts): upgrade the section to an actionable, live master-detail
rubenluetke10-beep151c448848f6
diff --git a/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts b/jarvis/ui/web/frontend/src/hooks/useWebSocket.tsindex 0ff140a8c4..2bc73175ec 100644--- a/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts+++ b/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts@@ -412,6 +412,15 @@ export function useWebSocket(): void {window.dispatchEvent(new CustomEvent("jarvis:secret-configured", { detail: env.payload }));}+ if (env.event_name === "ContactChanged") {+ // Trigger only — ContactsView re-fetches its own list, so a contact+ // saved by voice (contact-upsert) appears without a manual refresh.+ // payload: { action: created|updated|deleted, slug, name }.+ window.dispatchEvent(+ new CustomEvent("jarvis:contact-changed", { detail: env.payload }),+ );+ }+if (env.event_name === "AgenticIdeTerminalsAdded" ||env.event_name === "AgenticIdeTerminalsClosed" ||diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex e2e4b144e0..72bdd0306e 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -209,6 +209,26 @@"words": "Wörter","dialogAddTitle": "Kontakt hinzufügen","dialogEditTitle": "Kontakt bearbeiten",+ "close": "Schließen",+ "filterAll": "Alle",+ "voiceHint": "Tipp: Du kannst Kontakte auch diktieren — „merk dir, Annas Nummer ist …“",+ "lastUpdated": "Zuletzt geändert",+ "copy": "Kopieren",+ "call": "Anrufen",+ "callTitle": "Anruf starten",+ "callConfirm": "Jetzt {0} unter {1} anrufen?",+ "callNote": "Der Anruf läuft über deine Telefonie-Einrichtung.",+ "callStarted": "Anruf gestartet.",+ "callFailed": "Anruf fehlgeschlagen:",+ "openWiki": "Wiki-Seite öffnen",+ "addAlias": "Alias hinzufügen…",+ "invalidEmail": "Das sieht nicht nach einer E-Mail-Adresse aus.",+ "invalidPhone": "Eine Telefonnummer braucht mindestens eine Ziffer.",+ "savedAs": "Gespeichert als",+ "discardTitle": "Änderungen verwerfen?",+ "discardBody": "Du hast ungespeicherte Änderungen.",+ "discard": "Verwerfen",+ "keepEditing": "Weiter bearbeiten","rel": {"family": "Familie","friend": "Freund",@@ -3120,6 +3140,8 @@"discord_cta_button": "#report-a-bug öffnen","discord_join_button": "Zuerst Discord beitreten","or_send_here": "oder hier direkt senden",+ "github_hint": "Diese Installation hat keinen direkten Feedback-Kanal — der Button öffnet deinen Bericht als vorausgefülltes GitHub-Issue im Browser.",+ "github_submit": "Vorausgefülltes GitHub-Issue öffnen","subtitle": "Öffne unseren Discord, um Fehler zu melden, Ideen zu teilen oder Fragen zu stellen.","type_label": "Typ","type_bug": "Bug",@@ -3133,11 +3155,13 @@"screenshot_pick": "Klicken, um einen Screenshot anzuhängen","screenshot_preview_alt": "Screenshot-Vorschau","screenshot_remove": "Screenshot entfernen",+ "screenshot_too_large": "Der Screenshot ist größer als 8 MB — bitte wähle ein kleineres Bild.","submit": "Senden","sending": "Sende…","result_sent": "Danke — wurde an unseren Discord gesendet!","result_not_configured": "Feedback-Kanal ist noch nicht eingerichtet — es wurde nichts gesendet.",- "result_error": "Discord nicht erreichbar, bitte später erneut versuchen."+ "result_error": "Discord nicht erreichbar, bitte später erneut versuchen.",+ "result_github_opened": "Im Browser geöffnet — prüfe und sende das Issue auf GitHub ab."},"ultrawiki": {"people": {diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex cfe3d9f479..ac8cc9ddbe 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -209,6 +209,26 @@"words": "words","dialogAddTitle": "Add contact","dialogEditTitle": "Edit contact",+ "close": "Close",+ "filterAll": "All",+ "voiceHint": "Tip: you can also just dictate — \"remember, Anna's number is …\"",+ "lastUpdated": "Last updated",+ "copy": "Copy",+ "call": "Call",+ "callTitle": "Place a call",+ "callConfirm": "Call {0} at {1} now?",+ "callNote": "The call is placed through your telephony setup.",+ "callStarted": "Call started.",+ "callFailed": "Call failed:",+ "openWiki": "Open wiki page",+ "addAlias": "Add alias…",+ "invalidEmail": "This doesn't look like an email address.",+ "invalidPhone": "A phone number needs at least one digit.",+ "savedAs": "Saved as",+ "discardTitle": "Discard changes?",+ "discardBody": "You have unsaved changes.",+ "discard": "Discard",+ "keepEditing": "Keep editing","rel": {"family": "Family","friend": "Friend",@@ -3120,6 +3140,8 @@"discord_cta_button": "Open #report-a-bug","discord_join_button": "Join Discord first","or_send_here": "or send it from here",+ "github_hint": "This install has no direct feedback channel — the button opens your report as a prefilled GitHub issue in your browser.",+ "github_submit": "Open a prefilled GitHub issue","subtitle": "Open our Discord to report a bug, share an idea, or ask a question.","type_label": "Type","type_bug": "Bug",@@ -3133,11 +3155,13 @@"screenshot_pick": "Click to attach a screenshot","screenshot_preview_alt": "Screenshot preview","screenshot_remove": "Remove screenshot",+ "screenshot_too_large": "Screenshot is larger than 8 MB — please choose a smaller image.","submit": "Submit","sending": "Sending…","result_sent": "Thanks — sent to our Discord!","result_not_configured": "Feedback channel isn't set up yet — nothing was sent.",- "result_error": "Couldn't reach Discord, please try again later."+ "result_error": "Couldn't reach Discord, please try again later.",+ "result_github_opened": "Opened in your browser — review and submit the issue on GitHub."},"ultrawiki": {"people": {diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 71dc773d04..4581d65db4 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -209,6 +209,26 @@"words": "palabras","dialogAddTitle": "Añadir contacto","dialogEditTitle": "Editar contacto",+ "close": "Cerrar",+ "filterAll": "Todos",+ "voiceHint": "Consejo: también puedes dictar — «recuerda, el número de Ana es …»",+ "lastUpdated": "Última modificación",+ "copy": "Copiar",+ "call": "Llamar",+ "callTitle": "Iniciar llamada",+ "callConfirm": "¿Llamar ahora a {0} al {1}?",+ "callNote": "La llamada se realiza a través de tu configuración de telefonía.",+ "callStarted": "Llamada iniciada.",+ "callFailed": "Error en la llamada:",+ "openWiki": "Abrir página wiki",+ "addAlias": "Añadir alias…",+ "invalidEmail": "Esto no parece una dirección de correo.",+ "invalidPhone": "Un número de teléfono necesita al menos un dígito.",+ "savedAs": "Se guarda como",+ "discardTitle": "¿Descartar cambios?",+ "discardBody": "Tienes cambios sin guardar.",+ "discard": "Descartar",+ "keepEditing": "Seguir editando","rel": {"family": "Familia","friend": "Amigo",@@ -3120,6 +3140,8 @@"discord_cta_button": "Abrir #report-a-bug","discord_join_button": "Unirse primero a Discord","or_send_here": "o envíalo desde aquí",+ "github_hint": "Esta instalación no tiene un canal de comentarios directo — el botón abre tu informe como una incidencia de GitHub rellenada en tu navegador.",+ "github_submit": "Abrir una incidencia de GitHub rellenada","subtitle": "Abre nuestro Discord para reportar un error, compartir una idea o hacer una pregunta.","type_label": "Tipo","type_bug": "Error",@@ -3133,11 +3155,13 @@"screenshot_pick": "Haz clic para adjuntar una captura","screenshot_preview_alt": "Vista previa de la captura","screenshot_remove": "Eliminar captura",+ "screenshot_too_large": "La captura supera los 8 MB — elige una imagen más pequeña.","submit": "Enviar","sending": "Enviando…","result_sent": "¡Gracias — enviado a nuestro Discord!","result_not_configured": "El canal de comentarios aún no está configurado — no se envió nada.",- "result_error": "No se pudo llegar a Discord, inténtalo de nuevo más tarde."+ "result_error": "No se pudo llegar a Discord, inténtalo de nuevo más tarde.",+ "result_github_opened": "Abierto en tu navegador — revisa y envía la incidencia en GitHub."},"ultrawiki": {"people": {diff --git a/jarvis/ui/web/frontend/src/store/events.ts b/jarvis/ui/web/frontend/src/store/events.tsindex 191c148432..5cdfeaed75 100644--- a/jarvis/ui/web/frontend/src/store/events.ts+++ b/jarvis/ui/web/frontend/src/store/events.ts@@ -360,6 +360,13 @@ interface EventStore {* Written by `requestVisual`, read by the section — see VisualStageRequest.*/visualStage: VisualStageRequest | null;+ /**+ * The pending "open this wiki page" request for the Wiki section, or null+ * when nobody has asked for one. Written by `requestWikiPage`, consumed by+ * WikiView — the same staging idiom as `visualStage`, so a request made+ * while the section is not mounted still lands once it is.+ */+ wikiPageRequest: { slug: string; seq: number } | null;transcription: string;transcriptionFinal: boolean;toasts: Toast[];@@ -437,6 +444,8 @@ interface EventStore {* `visualId(artifact)`, or omit the argument for the newest visual.*/requestVisual: (target?: string) => void;+ /** Stage a wiki page (by slug) and switch to the Wiki section. */+ requestWikiPage: (slug: string) => void;setTranscription: (text: string, isFinal: boolean) => void;pushToast: (kind: Toast["kind"],@@ -513,6 +522,7 @@ export const useEventStore = create<EventStore>((set, get) => ({),detachedViews: [],visualStage: null,+ wikiPageRequest: null,transcription: "",transcriptionFinal: true,toasts: [],@@ -561,6 +571,14 @@ export const useEventStore = create<EventStore>((set, get) => ({activeSection: state.solo ? state.activeSection : "visualization",})),+ requestWikiPage: (slug) =>+ set((state) => ({+ wikiPageRequest: { slug, seq: (state.wikiPageRequest?.seq ?? 0) + 1 },+ // Same solo rule as requestVisual: a detached window is pinned to its+ // one section, so only the staged request travels — never the section.+ activeSection: state.solo ? state.activeSection : "memory",+ })),+setTranscription: (text, isFinal) =>set({ transcription: text, transcriptionFinal: isFinal }),diff --git a/jarvis/ui/web/frontend/src/views/WikiView.tsx b/jarvis/ui/web/frontend/src/views/WikiView.tsxindex 5e046e1a49..40effed04b 100644--- a/jarvis/ui/web/frontend/src/views/WikiView.tsx+++ b/jarvis/ui/web/frontend/src/views/WikiView.tsx@@ -116,6 +116,14 @@ export function WikiView(): JSX.Element {const [isReindexing, setIsReindexing] = useState(false);const [reindexError, setReindexError] = useState<string | null>(null);+ // A staged "open this page" request from another section (e.g. the Contacts+ // detail's wiki link). Same consumption idiom as the Visualization stage:+ // `seq` bumps on every request, so re-opening the same slug still fires.+ const wikiPageRequest = useEventStore((s) => s.wikiPageRequest);+ useEffect(() => {+ if (wikiPageRequest) setSelectedSlug(wikiPageRequest.slug);+ }, [wikiPageRequest]);+// Tree query lives both here (for header stats + empty-state detection)// and inside TreeSidebar (for the list). React Query dedupes them.const treeQuery = useQuery({diff --git a/jarvis/ui/web/frontend/src/views/contacts/ContactDetail.tsx b/jarvis/ui/web/frontend/src/views/contacts/ContactDetail.tsxindex a97b566f15..533a604159 100644--- a/jarvis/ui/web/frontend/src/views/contacts/ContactDetail.tsx+++ b/jarvis/ui/web/frontend/src/views/contacts/ContactDetail.tsx@@ -1,10 +1,50 @@-import { Mail, MapPin, Pencil, Phone, Trash2 } from "lucide-react";+import { useEffect, useState } from "react";+import {+ BookOpen,+ Check,+ Copy,+ Loader2,+ Mail,+ MapPin,+ Pencil,+ Phone,+ PhoneCall,+ Trash2,+} from "lucide-react";+import ReactMarkdown from "react-markdown";+import remarkGfm from "remark-gfm";+import { useT } from "@/i18n";+import { useEventStore } from "@/store/events";import { relationshipLabel } from "./constants";+import { contactAvatarStyle, contactInitials } from "./avatar";import type { Contact } from "./api";-/** The detail (right) pane for the selected contact. Read view + edit/delete- * affordances; the parent owns the edit dialog + the actual delete call. */+/**+ * The detail (right) pane for the selected contact — a read view with actions:+ * call via the assistant (telephony), open the mirrored wiki person page,+ * copy any field, mailto/tel links, and the README rendered as Markdown.+ * The parent owns the edit dialog + the actual delete call.+ */++// The outbound route accepts E.164 only ("+" + digits) — never offer a call+// the backend would reject.+const E164_RE = /^\+\d{6,}$/;++// One status probe per app session: whether outbound calls are possible at+// all (twilio installed + configured + enabled). A failed probe means "no".+let telephonyProbe: Promise<boolean> | null = null;+function canPlaceCalls(): Promise<boolean> {+ telephonyProbe ??= fetch("/api/telephony/status")+ .then((res) => (res.ok ? res.json() : null))+ .then(+ (status: { available?: boolean; configured?: boolean; enabled?: boolean } | null) =>+ Boolean(status?.available && status?.configured && status?.enabled),+ )+ .catch(() => false);+ return telephonyProbe;+}+export function ContactDetail({contact,onEdit,@@ -15,49 +55,125 @@ export function ContactDetail({onDelete: () => void;}) {const t = useT();+ const requestWikiPage = useEventStore((s) => s.requestWikiPage);+ const pushToast = useEventStore((s) => s.pushToast);const rel = relationshipLabel(t, contact.relationship);const addr = formatAddress(contact);+ const updated = formatUpdated(contact.last_updated);++ const [callable, setCallable] = useState(false);+ const [confirmCall, setConfirmCall] = useState<string | null>(null);+ const [calling, setCalling] = useState(false);++ useEffect(() => {+ let cancelled = false;+ void canPlaceCalls().then((ok) => {+ if (!cancelled) setCallable(ok);+ });+ return () => {+ cancelled = true;+ };+ }, []);++ const callPhone = contact.phones.find((p) => E164_RE.test(p)) ?? null;++ async function placeCall(phone: string) {+ setCalling(true);+ try {+ const res = await fetch("/api/telephony/outbound", {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ to: phone }),+ });+ const data = (await res.json().catch(() => ({}))) as {+ ok?: boolean;+ error?: string;+ };+ if (res.ok && data.ok) {+ pushToast("success", t("contacts.callStarted"));+ } else {+ pushToast("error", `${t("contacts.callFailed")} ${data.error ?? res.status}`);+ }+ } catch (e) {+ pushToast("error", `${t("contacts.callFailed")} ${e instanceof Error ? e.message : e}`);+ } finally {+ setCalling(false);+ setConfirmCall(null);+ }+ }return (<div className="flex h-full flex-col overflow-y-auto scrollbar-jarvis">- <div className="flex items-start gap-4 border-b border-border p-6">- <span- aria-hidden- className="flex h-12 w-12 shrink-0 items-center justify-center rounded-full border border-border bg-secondary/50 text-lg font-semibold uppercase text-primary"- >- {contact.name.trim()[0]?.toUpperCase() ?? "?"}- </span>- <div className="min-w-0 flex-1">- <h3 className="font-display text-lg font-semibold tracking-tight">{contact.name}</h3>- {contact.aliases.length > 0 && (- <p className="truncate text-xs text-muted-foreground">- {t("contacts.aliases")}: {contact.aliases.join(", ")}- </p>- )}- {rel && (- <span className="mt-1 inline-block rounded-full bg-primary/15 px-2 py-0.5 text-[11px] font-medium text-primary">- {rel}- </span>- )}- </div>- <div className="flex shrink-0 items-center gap-2">- <button- type="button"- onClick={onEdit}- aria-label={t("contacts.edit")}- className="inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1.5 text-xs text-muted-foreground transition-colors hover:border-primary/40 hover:text-foreground"+ <div className="border-b border-border p-6">+ <div className="flex items-start gap-4">+ <span+ aria-hidden+ style={contactAvatarStyle(contact.name)}+ className="flex h-14 w-14 shrink-0 items-center justify-center rounded-full text-xl font-semibold">- <Pencil className="h-3.5 w-3.5" />- {t("contacts.edit")}- </button>+ {contactInitials(contact.name)}+ </span>+ <div className="min-w-0 flex-1">+ <h3 className="font-display text-lg font-semibold tracking-tight">{contact.name}</h3>+ {contact.aliases.length > 0 && (+ <p className="truncate text-xs text-muted-foreground">+ {t("contacts.aliases")}: {contact.aliases.join(", ")}+ </p>+ )}+ <div className="mt-1 flex flex-wrap items-center gap-2">+ {rel && (+ <span className="inline-block rounded-full bg-primary/15 px-2 py-0.5 text-[11px] font-medium text-primary">+ {rel}+ </span>+ )}+ {updated && (+ <span className="text-[11px] text-muted-foreground">+ {t("contacts.lastUpdated")}: {updated}+ </span>+ )}+ </div>+ </div>+ <div className="flex shrink-0 items-center gap-2">+ <button+ type="button"+ onClick={onEdit}+ aria-label={t("contacts.edit")}+ className="inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1.5 text-xs text-muted-foreground transition-colors hover:border-primary/40 hover:text-foreground"+ >+ <Pencil className="h-3.5 w-3.5" />+ {t("contacts.edit")}+ </button>+ <button+ type="button"+ onClick={onDelete}+ aria-label={t("contacts.delete")}+ className="inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1.5 text-xs text-muted-foreground transition-colors hover:border-destructive/50 hover:text-destructive"+ >+ <Trash2 className="h-3.5 w-3.5" />+ {t("contacts.delete")}+ </button>+ </div>+ </div>++ {/* Action row: what you can DO with this person from here. */}+ <div className="mt-4 flex flex-wrap items-center gap-2">+ {callable && callPhone && (+ <button+ type="button"+ onClick={() => setConfirmCall(callPhone)}+ className="inline-flex items-center gap-1.5 rounded-md border border-primary/40 bg-primary/10 px-3 py-1.5 text-xs font-medium text-primary hover:bg-primary/20"+ >+ <PhoneCall className="h-3.5 w-3.5" />+ {t("contacts.call")}+ </button>+ )}<buttontype="button"- onClick={onDelete}- aria-label={t("contacts.delete")}- className="inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1.5 text-xs text-muted-foreground transition-colors hover:border-destructive/50 hover:text-destructive"+ onClick={() => requestWikiPage(contact.slug)}+ className="inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs text-muted-foreground hover:border-primary/40 hover:text-foreground">- <Trash2 className="h-3.5 w-3.5" />- {t("contacts.delete")}+ <BookOpen className="h-3.5 w-3.5" />+ {t("contacts.openWiki")}</button></div></div>@@ -67,13 +183,14 @@ export function ContactDetail({<Field icon={<Mail className="h-4 w-4" />} label={t("contacts.emails")}><ul className="space-y-1">{contact.emails.map((e) => (- <li key={e}>+ <li key={e} className="flex items-center gap-1.5"><ahref={`mailto:${e}`}className="text-sm text-primary hover:underline">{e}</a>+ <CopyButton value={e} label={t("contacts.copy")} /></li>))}</ul>@@ -84,10 +201,11 @@ export function ContactDetail({<Field icon={<Phone className="h-4 w-4" />} label={t("contacts.phones")}><ul className="space-y-1">{contact.phones.map((p) => (- <li key={p}>+ <li key={p} className="flex items-center gap-1.5"><a href={`tel:${p}`} className="text-sm text-primary hover:underline">{p}</a>+ <CopyButton value={p} label={t("contacts.copy")} /></li>))}</ul>@@ -96,22 +214,91 @@ export function ContactDetail({{addr && (<Field icon={<MapPin className="h-4 w-4" />} label={t("contacts.address")}>- <p className="whitespace-pre-line text-sm text-foreground">{addr}</p>+ <div className="flex items-start gap-1.5">+ <p className="whitespace-pre-line text-sm text-foreground">{addr}</p>+ <CopyButton value={addr.replace(/\n/g, ", ")} label={t("contacts.copy")} />+ </div></Field>)}{contact.note.trim() && (<Field label={t("contacts.readme")}>- <p className="whitespace-pre-line text-sm leading-relaxed text-foreground">- {contact.note.trim()}- </p>+ <article className="prose prose-neutral max-w-none text-sm dark:prose-invert prose-a:text-primary prose-code:text-foreground prose-pre:border prose-pre:border-border prose-pre:bg-card/80">+ <ReactMarkdown remarkPlugins={[remarkGfm]}>{contact.note.trim()}</ReactMarkdown>+ </article></Field>)}</div>++ {confirmCall && (+ <div+ className="fixed inset-0 z-50 flex items-center justify-center bg-scrim/50 backdrop-blur-sm"+ onClick={() => !calling && setConfirmCall(null)}+ >+ <div+ className="w-full max-w-sm rounded-xl border border-border bg-card p-6 shadow-xl"+ onClick={(e) => e.stopPropagation()}+ >+ <h3 className="font-display text-base font-semibold">+ {t("contacts.callTitle")}+ </h3>+ <p className="mt-2 text-sm text-muted-foreground">+ {t("contacts.callConfirm")+ .replace("{0}", contact.name)+ .replace("{1}", confirmCall)}+ </p>+ <p className="mt-1 text-xs text-muted-foreground">{t("contacts.callNote")}</p>+ <div className="mt-5 flex justify-end gap-2">+ <button+ type="button"+ disabled={calling}+ onClick={() => setConfirmCall(null)}+ className="rounded-md border border-border px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground disabled:opacity-50"+ >+ {t("contacts.cancel")}+ </button>+ <button+ type="button"+ disabled={calling}+ onClick={() => void placeCall(confirmCall)}+ className="inline-flex items-center gap-2 rounded-md border border-primary/40 bg-primary/10 px-3 py-1.5 text-xs font-medium text-primary hover:bg-primary/20 disabled:opacity-50"+ >+ {calling && <Loader2 className="h-3 w-3 animate-spin" />}+ {t("contacts.call")}+ </button>+ </div>+ </div>+ </div>+ )}</div>);}+/** Small clipboard button; flips to a check mark for a moment on success. */+function CopyButton({ value, label }: { value: string; label: string }) {+ const [copied, setCopied] = useState(false);+ return (+ <button+ type="button"+ aria-label={label}+ title={label}+ onClick={() => {+ void navigator.clipboard?.writeText(value).then(() => {+ setCopied(true);+ window.setTimeout(() => setCopied(false), 1500);+ });+ }}+ className="rounded p-1 text-muted-foreground/60 transition-colors hover:bg-background/60 hover:text-foreground"+ >+ {copied ? (+ <Check className="h-3.5 w-3.5 text-primary" />+ ) : (+ <Copy className="h-3.5 w-3.5" />+ )}+ </button>+ );+}+function Field({icon,label,@@ -139,3 +326,10 @@ function formatAddress(contact: Contact): string {const line3 = a.country ?? "";return [line1, line2, line3].filter((s) => s && s.trim()).join("\n");}++function formatUpdated(iso: string | null): string | null {+ if (!iso) return null;+ const date = new Date(iso);+ if (Number.isNaN(date.getTime())) return null;+ return date.toLocaleString(undefined, { dateStyle: "medium", timeStyle: "short" });+}diff --git a/jarvis/ui/web/frontend/src/views/contacts/ContactEditDialog.tsx b/jarvis/ui/web/frontend/src/views/contacts/ContactEditDialog.tsxindex 575d17be32..8cc9580a95 100644--- a/jarvis/ui/web/frontend/src/views/contacts/ContactEditDialog.tsx+++ b/jarvis/ui/web/frontend/src/views/contacts/ContactEditDialog.tsx@@ -1,4 +1,4 @@-import { useState } from "react";+import { useEffect, useMemo, useRef, useState } from "react";import { Loader2, Plus, X } from "lucide-react";import { useT } from "@/i18n";import { cn } from "@/lib/utils";@@ -13,10 +13,28 @@ import {/*** Create / edit a contact. `initial === null` → create (POST); otherwise edit- * (PATCH the existing slug). Non-blocking modal (backdrop click closes), same- * shape as PairDialog. The README field shows a live word counter (the store is- * designed for a short ~300-word bio).+ * (PATCH the existing slug). Non-blocking modal, same shape as PairDialog —+ * but closing with unsaved changes asks before discarding. Aliases are chips+ * (Enter/comma commits, Backspace removes), e-mail/phone fields validate with+ * the same rules the store applies server-side, and a phone that will be+ * normalised shows its stored form up front. Esc closes (guarded),+ * Ctrl/Cmd+Enter saves. The README field keeps its live word counter (the+ * store is designed for a short ~300-word bio).*/++// Mirrors jarvis/contacts/store.py: _EMAIL_RE and _normalize_phone. Kept in+// sync by hand — these are hints; the server stays the authority.+const EMAIL_RE = /^[^@\s]+@[^@\s]+\.[^@\s]+$/;++function normalizePhonePreview(raw: string): string | null {+ const s = raw.trim();+ const digits = s.replace(/\D/g, "");+ if (!digits) return null;+ if (s.startsWith("+")) return `+${digits}`;+ if (s.startsWith("00")) return `+${digits.slice(2)}`;+ return digits;+}+export function ContactEditDialog({initial,onClose,@@ -28,7 +46,8 @@ export function ContactEditDialog({}) {const t = useT();const [name, setName] = useState(initial?.name ?? "");- const [aliases, setAliases] = useState((initial?.aliases ?? []).join(", "));+ const [aliases, setAliases] = useState<string[]>(initial?.aliases ?? []);+ const [aliasDraft, setAliasDraft] = useState("");const [relationship, setRelationship] = useState<Relationship | "">(initial?.relationship ?? "",);@@ -45,21 +64,72 @@ export function ContactEditDialog({const [note, setNote] = useState(initial?.note ?? "");const [saving, setSaving] = useState(false);const [error, setError] = useState<string | null>(null);+ const [confirmDiscard, setConfirmDiscard] = useState(false);const wordCount = note.trim() ? note.trim().split(/\s+/).length : 0;+ // Dirty tracking: snapshot the form once on mount, compare on every close+ // request. Cheap (JSON of a dozen small strings) and exact.+ const formSnapshot = JSON.stringify({+ name, aliases, aliasDraft, relationship, emails, phones,+ street, postal, city, country, note,+ });+ const initialSnapshot = useRef(formSnapshot);+ const dirty = formSnapshot !== initialSnapshot.current;++ function requestClose() {+ if (dirty) setConfirmDiscard(true);+ else onClose();+ }++ // Validation hints (the server is the authority; these prevent surprises).+ const emailErrors = useMemo(+ () => emails.map((e) => (e.trim() && !EMAIL_RE.test(e.trim()) ? t("contacts.invalidEmail") : null)),+ [emails, t],+ );+ const phoneErrors = useMemo(+ () =>+ phones.map((p) =>+ p.trim() && normalizePhonePreview(p) === null ? t("contacts.invalidPhone") : null,+ ),+ [phones, t],+ );+ const phoneHints = useMemo(+ () =>+ phones.map((p) => {+ const normalized = normalizePhonePreview(p);+ return normalized && normalized !== p.trim()+ ? `${t("contacts.savedAs")} ${normalized}`+ : null;+ }),+ [phones, t],+ );+ const hasInvalidField =+ emailErrors.some(Boolean) || phoneErrors.some(Boolean);++ function commitAliasDraft(): string[] {+ const value = aliasDraft.trim().replace(/,+$/, "");+ if (!value) return aliases;+ if (aliases.includes(value)) {+ setAliasDraft("");+ return aliases;+ }+ const next = [...aliases, value];+ setAliases(next);+ setAliasDraft("");+ return next;+ }+async function handleSave() {setError(null);if (!name.trim()) {setError(t("contacts.nameRequired"));return;}+ if (hasInvalidField || saving) return;const payload: ContactInput = {name: name.trim(),- aliases: aliases- .split(",")- .map((a) => a.trim())- .filter(Boolean),+ aliases: commitAliasDraft(),relationship: relationship === "" ? null : relationship,emails: emails.map((e) => e.trim()).filter(Boolean),phones: phones.map((p) => p.trim()).filter(Boolean),@@ -84,10 +154,27 @@ export function ContactEditDialog({}}+ // Keyboard: Esc closes (guarded — first Esc on a dirty form asks, Esc on+ // the ask keeps editing), Ctrl/Cmd+Enter saves from anywhere in the form.+ useEffect(() => {+ const onKey = (event: KeyboardEvent) => {+ if (event.key === "Escape") {+ event.stopPropagation();+ if (confirmDiscard) setConfirmDiscard(false);+ else requestClose();+ } else if (event.key === "Enter" && (event.ctrlKey || event.metaKey)) {+ event.preventDefault();+ void handleSave();+ }+ };+ window.addEventListener("keydown", onKey);+ return () => window.removeEventListener("keydown", onKey);+ });+return (<divclassName="fixed inset-0 z-50 flex items-center justify-center bg-scrim/50 backdrop-blur-sm"- onClick={onClose}+ onClick={requestClose}><divclassName="max-h-[90vh] w-full max-w-lg overflow-y-auto scrollbar-jarvis rounded-xl border border-border bg-card p-6 shadow-xl"@@ -99,8 +186,8 @@ export function ContactEditDialog({</h3><buttontype="button"- onClick={onClose}- aria-label={t("contacts.cancel")}+ onClick={requestClose}+ aria-label={t("contacts.close")}className="text-muted-foreground hover:text-foreground"><X className="h-4 w-4" />@@ -118,12 +205,61 @@ export function ContactEditDialog({</Labeled><Labeled label={t("contacts.aliases")}>- <input- value={aliases}- onChange={(e) => setAliases(e.target.value)}- className={inputClass}- placeholder="Chris, Chrissi"- />+ <div+ className={cn(+ inputClass,+ "flex min-h-[2.1rem] flex-wrap items-center gap-1.5 py-1",+ )}+ >+ {aliases.map((alias) => (+ <span+ key={alias}+ className="inline-flex items-center gap-1 rounded-full bg-primary/15 px-2 py-0.5 text-xs text-primary"+ >+ {alias}+ <button+ type="button"+ aria-label={`${t("contacts.delete")} ${alias}`}+ onClick={() => setAliases(aliases.filter((a) => a !== alias))}+ className="text-primary/70 hover:text-primary"+ >+ <X className="h-3 w-3" />+ </button>+ </span>+ ))}+ <input+ value={aliasDraft}+ onChange={(e) => {+ // A comma commits, exactly like Enter — people paste+ // "Chris, Chrissi" and expect chips.+ if (e.target.value.includes(",")) {+ const parts = e.target.value.split(",");+ const last = parts.pop() ?? "";+ const committed = parts.map((p) => p.trim()).filter(Boolean);+ if (committed.length) {+ setAliases((prev) => [+ ...prev,+ ...committed.filter((p) => !prev.includes(p)),+ ]);+ }+ setAliasDraft(last);+ } else {+ setAliasDraft(e.target.value);+ }+ }}+ onKeyDown={(e) => {+ if (e.key === "Enter") {+ e.preventDefault();+ commitAliasDraft();+ } else if (e.key === "Backspace" && !aliasDraft && aliases.length) {+ setAliases(aliases.slice(0, -1));+ }+ }}+ onBlur={() => commitAliasDraft()}+ placeholder={aliases.length ? "" : t("contacts.addAlias")}+ className="min-w-[6rem] flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"+ />+ </div></Labeled><Labeled label={t("contacts.relationship")}>@@ -151,6 +287,7 @@ export function ContactEditDialog({placeholder="[email protected]"type="email"addLabel={t("contacts.addEmail")}+ errors={emailErrors}/><ListField@@ -160,6 +297,8 @@ export function ContactEditDialog({placeholder="+49 151 2345 6789"type="tel"addLabel={t("contacts.addPhone")}+ errors={phoneErrors}+ hints={phoneHints}/><Labeled label={t("contacts.address")}>@@ -210,7 +349,7 @@ export function ContactEditDialog({<div className="flex justify-end gap-2 pt-2"><buttontype="button"- onClick={onClose}+ onClick={requestClose}className="rounded-md border border-border px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground">{t("contacts.cancel")}@@ -218,7 +357,7 @@ export function ContactEditDialog({<buttontype="button"onClick={() => void handleSave()}- disabled={saving}+ disabled={saving || hasInvalidField}className="inline-flex items-center gap-2 rounded-md border border-primary/40 bg-primary/10 px-3 py-1.5 text-xs font-medium text-primary hover:bg-primary/20 disabled:opacity-50">{saving && <Loader2 className="h-3 w-3 animate-spin" />}@@ -226,6 +365,38 @@ export function ContactEditDialog({</button></div></div>++ {confirmDiscard && (+ <div+ className="fixed inset-0 z-[60] flex items-center justify-center bg-scrim/60 backdrop-blur-sm"+ onClick={(e) => e.stopPropagation()}+ >+ <div className="w-full max-w-xs rounded-xl border border-border bg-card p-5 shadow-xl">+ <h4 className="font-display text-sm font-semibold">+ {t("contacts.discardTitle")}+ </h4>+ <p className="mt-1.5 text-xs text-muted-foreground">+ {t("contacts.discardBody")}+ </p>+ <div className="mt-4 flex justify-end gap-2">+ <button+ type="button"+ onClick={() => setConfirmDiscard(false)}+ className="rounded-md border border-border px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground"+ >+ {t("contacts.keepEditing")}+ </button>+ <button+ type="button"+ onClick={onClose}+ className="rounded-md border border-destructive/50 bg-destructive/10 px-3 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/20"+ >+ {t("contacts.discard")}+ </button>+ </div>+ </div>+ </div>+ )}</div></div>);@@ -252,6 +423,8 @@ function ListField({placeholder,type,addLabel,+ errors,+ hints,}: {label: string;values: string[];@@ -259,6 +432,8 @@ function ListField({placeholder: string;type: string;addLabel: string;+ errors?: (string | null)[];+ hints?: (string | null)[];}) {return (<div className="space-y-1">@@ -267,26 +442,36 @@ function ListField({</span><div className="space-y-2">{values.map((value, i) => (- <div key={i} className="flex gap-2">- <input- type={type}- value={value}- onChange={(e) => {- const next = values.slice();- next[i] = e.target.value;- onChange(next);- }}- className={inputClass}- placeholder={placeholder}- />- <button- type="button"- onClick={() => onChange(values.filter((_, j) => j !== i) || [])}- aria-label="remove"- className="shrink-0 rounded-md border border-border px-2 text-muted-foreground hover:border-destructive/50 hover:text-destructive"- >- <X className="h-3.5 w-3.5" />- </button>+ <div key={i}>+ <div className="flex gap-2">+ <input+ type={type}+ value={value}+ onChange={(e) => {+ const next = values.slice();+ next[i] = e.target.value;+ onChange(next);+ }}+ className={cn(+ inputClass,+ errors?.[i] && "border-destructive/50 focus:border-destructive/50",+ )}+ placeholder={placeholder}+ />+ <button+ type="button"+ onClick={() => onChange(values.filter((_, j) => j !== i) || [])}+ aria-label="remove"+ className="shrink-0 rounded-md border border-border px-2 text-muted-foreground hover:border-destructive/50 hover:text-destructive"+ >+ <X className="h-3.5 w-3.5" />+ </button>+ </div>+ {errors?.[i] ? (+ <p className="mt-0.5 text-[11px] text-destructive">{errors[i]}</p>+ ) : hints?.[i] ? (+ <p className="mt-0.5 text-[11px] text-muted-foreground">{hints[i]}</p>+ ) : null}</div>))}<buttondiff --git a/jarvis/ui/web/frontend/src/views/contacts/ContactRow.tsx b/jarvis/ui/web/frontend/src/views/contacts/ContactRow.tsxindex 351ef5d5a5..fd7a0d0d1d 100644--- a/jarvis/ui/web/frontend/src/views/contacts/ContactRow.tsx+++ b/jarvis/ui/web/frontend/src/views/contacts/ContactRow.tsx@@ -1,6 +1,7 @@import { cn } from "@/lib/utils";import { useT } from "@/i18n";import { relationshipLabel } from "./constants";+import { contactAvatarStyle, contactInitials } from "./avatar";import type { ContactSummary } from "./api";/** One row in the master (left) list of the Contacts master–detail view. */@@ -30,9 +31,10 @@ export function ContactRow({><spanaria-hidden- className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-border bg-secondary/50 text-xs font-semibold uppercase text-primary"+ style={contactAvatarStyle(contact.name)}+ className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-xs font-semibold">- {initial(contact.name)}+ {contactInitials(contact.name)}</span><span className="flex min-w-0 flex-1 flex-col"><span className="truncate text-sm font-medium text-foreground">{contact.name}</span>@@ -49,8 +51,3 @@ export function ContactRow({</li>);}--function initial(name: string): string {- const trimmed = name.trim();- return trimmed ? trimmed[0]!.toUpperCase() : "?";-}diff --git a/jarvis/ui/web/frontend/src/views/contacts/ContactsView.test.tsx b/jarvis/ui/web/frontend/src/views/contacts/ContactsView.test.tsxindex b09df9a884..3e01dadd98 100644--- a/jarvis/ui/web/frontend/src/views/contacts/ContactsView.test.tsx+++ b/jarvis/ui/web/frontend/src/views/contacts/ContactsView.test.tsx@@ -124,7 +124,9 @@ describe("ContactsView (master–detail)", () => {});render(<ContactsView />);- fireEvent.click(await screen.findByRole("button", { name: /add contact/i }));+ // Two "Add contact" buttons exist on an empty book: the header one and+ // the empty-state CTA. Either opens the same create dialog.+ fireEvent.click((await screen.findAllByRole("button", { name: /add contact/i }))[0]);// The dialog has a name field (a create form, not a detail view).expect(await screen.findByPlaceholderText("Christoph Meyer")).toBeTruthy();});@@ -136,4 +138,71 @@ describe("ContactsView (master–detail)", () => {render(<ContactsView />);expect(await screen.findByText(/no contacts yet/i)).toBeTruthy();});++ it("filters by relationship chips (toggle on/off)", async () => {+ installFetchMock({+ "GET /api/contacts": () => ({ body: { contacts: [CHRISTOPH_SUMMARY, LAURA_SUMMARY] } }),+ });+ render(<ContactsView />);+ await screen.findByText("Christoph Meyer");++ fireEvent.click(screen.getByRole("button", { name: /partner · 1/i }));+ expect(screen.queryByText("Christoph Meyer")).toBeNull();+ expect(screen.getByText("Laura")).toBeTruthy();++ // Clicking the active chip again clears the filter.+ fireEvent.click(screen.getByRole("button", { name: /partner · 1/i }));+ expect(screen.getByText("Christoph Meyer")).toBeTruthy();+ });++ it("groups the list by first letter", async () => {+ installFetchMock({+ "GET /api/contacts": () => ({ body: { contacts: [CHRISTOPH_SUMMARY, LAURA_SUMMARY] } }),+ });+ render(<ContactsView />);+ await screen.findByText("Christoph Meyer");+ // "C" appears only as Christoph's group header; "L" is both Laura's group+ // header and her avatar initial.+ expect(screen.getByText("C")).toBeTruthy();+ expect(screen.getAllByText("L").length).toBeGreaterThan(0);+ });++ it("reloads the list when a contact changes elsewhere (voice/CLI)", async () => {+ let listing: unknown[] = [CHRISTOPH_SUMMARY];+ installFetchMock({+ "GET /api/contacts": () => ({ body: { contacts: listing } }),+ });+ render(<ContactsView />);+ await screen.findByText("Christoph Meyer");+ expect(screen.queryByText("Laura")).toBeNull();++ listing = [CHRISTOPH_SUMMARY, LAURA_SUMMARY];+ fireEvent(+ window,+ new CustomEvent("jarvis:contact-changed", {+ detail: { action: "created", slug: "laura", name: "Laura" },+ }),+ );+ expect(await screen.findByText("Laura")).toBeTruthy();+ });++ it("asks before discarding unsaved dialog changes", async () => {+ installFetchMock({+ "GET /api/contacts": () => ({ body: { contacts: [] } }),+ });+ render(<ContactsView />);+ fireEvent.click((await screen.findAllByRole("button", { name: /add contact/i }))[0]);+ const nameInput = await screen.findByPlaceholderText("Christoph Meyer");+ fireEvent.change(nameInput, { target: { value: "Anna" } });++ fireEvent.click(screen.getByRole("button", { name: /^close$/i }));+ expect(await screen.findByText(/discard changes\?/i)).toBeTruthy();++ fireEvent.click(screen.getByRole("button", { name: /keep editing/i }));+ expect(screen.getByPlaceholderText("Christoph Meyer")).toBeTruthy();++ fireEvent.click(screen.getByRole("button", { name: /^close$/i }));+ fireEvent.click(await screen.findByRole("button", { name: /^discard$/i }));+ expect(screen.queryByPlaceholderText("Christoph Meyer")).toBeNull();+ });});diff --git a/jarvis/ui/web/frontend/src/views/contacts/ContactsView.tsx b/jarvis/ui/web/frontend/src/views/contacts/ContactsView.tsxindex bebfe48ec2..34a2d255b5 100644--- a/jarvis/ui/web/frontend/src/views/contacts/ContactsView.tsx+++ b/jarvis/ui/web/frontend/src/views/contacts/ContactsView.tsx@@ -1,11 +1,13 @@import { useCallback, useEffect, useMemo, useState } from "react";-import { Contact as ContactIcon, Loader2, Plus, Search } from "lucide-react";+import { Contact as ContactIcon, Loader2, Mic, Plus, Search } from "lucide-react";import { ViewHeader } from "@/views/ChatsView";import { useT } from "@/i18n";+import { cn } from "@/lib/utils";import { ContactRow } from "./ContactRow";import { ContactDetail } from "./ContactDetail";import { ContactEditDialog } from "./ContactEditDialog";+import { RELATIONSHIPS, relationshipLabel, type Relationship } from "./constants";import {deleteContact,getContact,@@ -15,9 +17,14 @@ import {} from "./api";/**- * Contacts — a user-curated address book (master–detail). Left: a searchable- * list of contacts; right: the selected contact's detail with edit/delete. The- * "Add" button and the edit pencil open the same dialog (create vs. PATCH).+ * Contacts — a user-curated address book (master–detail). Left: a searchable,+ * relationship-filterable list grouped by first letter; right: the selected+ * contact's detail with actions. The "Add" button and the edit pencil open the+ * same dialog (create vs. PATCH).+ *+ * Live: the view listens for the `jarvis:contact-changed` window event (the+ * bus `ContactChanged` envelope relayed by useWebSocket), so a contact saved+ * by voice (`contact-upsert`) appears without a manual refresh.** Distinct from the read-only "People around you" tab in ProfileView (the* auto-extracted Curator list) — this section is fully managed by the user and@@ -29,6 +36,7 @@ export function ContactsView() {const [loading, setLoading] = useState(true);const [error, setError] = useState<string | null>(null);const [query, setQuery] = useState("");+ const [relFilter, setRelFilter] = useState<Relationship | null>(null);const [selectedSlug, setSelectedSlug] = useState<string | null>(null);const [selected, setSelected] = useState<Contact | null>(null);const [dialog, setDialog] = useState<"create" | "edit" | null>(null);@@ -69,15 +77,66 @@ export function ContactsView() {};}, [selectedSlug]);+ // Live refresh: a contact changed somewhere else (voice upsert, CLI, another+ // window). Re-fetch the list; keep the open detail honest too.+ useEffect(() => {+ const onChanged = (event: Event) => {+ const detail = (event as CustomEvent).detail as+ | { action?: string; slug?: string }+ | undefined;+ void loadList();+ if (!detail?.slug || detail.slug !== selectedSlug) return;+ if (detail.action === "deleted") {+ setSelectedSlug(null);+ setSelected(null);+ } else {+ void getContact(detail.slug)+ .then(setSelected)+ .catch(() => setSelected(null));+ }+ };+ window.addEventListener("jarvis:contact-changed", onChanged);+ return () => window.removeEventListener("jarvis:contact-changed", onChanged);+ }, [loadList, selectedSlug]);++ // Relationship counts over the whole book (not the current search) — the+ // chips are a stable map of the book, not of the query.+ const relCounts = useMemo(() => {+ const counts = new Map<Relationship, number>();+ for (const c of contacts) {+ if (c.relationship) {+ counts.set(c.relationship, (counts.get(c.relationship) ?? 0) + 1);+ }+ }+ return counts;+ }, [contacts]);+const filtered = useMemo(() => {const q = query.trim().toLowerCase();- if (!q) return contacts;- return contacts.filter(- (c) =>+ return contacts.filter((c) => {+ if (relFilter && c.relationship !== relFilter) return false;+ if (!q) return true;+ return (c.name.toLowerCase().includes(q) ||- c.aliases.some((a) => a.toLowerCase().includes(q)),- );- }, [contacts, query]);+ c.aliases.some((a) => a.toLowerCase().includes(q)) ||+ (c.primary_email ?? "").toLowerCase().includes(q) ||+ (c.primary_phone ?? "").toLowerCase().includes(q)+ );+ });+ }, [contacts, query, relFilter]);++ // Group the (already name-sorted) list by first letter; non-letters → "#".+ const groups = useMemo(() => {+ const out: { letter: string; items: ContactSummary[] }[] = [];+ for (const c of filtered) {+ const first = c.name.trim()[0] ?? "#";+ const letter = /\p{L}/u.test(first) ? first.toUpperCase() : "#";+ const last = out[out.length - 1];+ if (last && last.letter === letter) last.items.push(c);+ else out.push({ letter, items: [c] });+ }+ return out;+ }, [filtered]);async function handleSaved(saved: Contact) {setDialog(null);@@ -101,6 +160,8 @@ export function ContactsView() {await loadList();}+ const hasContacts = contacts.length > 0;+return (<div className="flex h-full flex-col"><ViewHeader@@ -122,7 +183,7 @@ export function ContactsView() {<div className="flex min-h-0 flex-1">{/* Master list */}<div className="flex w-[320px] shrink-0 flex-col border-r border-border">- <div className="border-b border-border p-3">+ <div className="space-y-2 border-b border-border p-3"><div className="flex items-center gap-2 rounded-md border border-border bg-background/40 px-2.5 py-1.5"><Search className="h-3.5 w-3.5 text-muted-foreground" /><input@@ -132,6 +193,23 @@ export function ContactsView() {className="w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"/></div>+ {hasContacts && (+ <div className="flex flex-wrap gap-1">+ <FilterChip+ active={relFilter === null}+ onClick={() => setRelFilter(null)}+ label={`${t("contacts.filterAll")} · ${contacts.length}`}+ />+ {RELATIONSHIPS.filter((r) => (relCounts.get(r) ?? 0) > 0).map((r) => (+ <FilterChip+ key={r}+ active={relFilter === r}+ onClick={() => setRelFilter(relFilter === r ? null : r)}+ label={`${relationshipLabel(t, r)} · ${relCounts.get(r)}`}+ />+ ))}+ </div>+ )}</div><nav className="flex-1 overflow-y-auto scrollbar-jarvis p-2">{loading ? (@@ -140,21 +218,47 @@ export function ContactsView() {</div>) : error ? (<p className="px-3 py-6 text-center text-sm text-destructive">{error}</p>+ ) : !hasContacts ? (+ <div className="flex flex-col items-center gap-3 px-3 py-8 text-center">+ <ContactIcon className="h-8 w-8 text-muted-foreground/40" />+ <p className="text-sm text-muted-foreground">{t("contacts.empty")}</p>+ <button+ type="button"+ onClick={() => setDialog("create")}+ className="inline-flex items-center gap-1.5 rounded-md border border-primary/40 bg-primary/10 px-3 py-1.5 text-xs font-medium text-primary hover:bg-primary/20"+ >+ <Plus className="h-3.5 w-3.5" />+ {t("contacts.add")}+ </button>+ <p className="flex items-start gap-1.5 text-xs text-muted-foreground/80">+ <Mic className="mt-0.5 h-3.5 w-3.5 shrink-0" />+ {t("contacts.voiceHint")}+ </p>+ </div>) : filtered.length === 0 ? (<p className="px-3 py-6 text-center text-sm text-muted-foreground">- {query ? t("contacts.noMatches") : t("contacts.empty")}+ {t("contacts.noMatches")}</p>) : (- <ul className="space-y-0.5">- {filtered.map((c) => (- <ContactRow- key={c.slug}- contact={c}- active={c.slug === selectedSlug}- onClick={() => setSelectedSlug(c.slug)}- />+ <div className="space-y-1">+ {groups.map((group) => (+ <div key={group.letter}>+ <div className="px-3 pb-0.5 pt-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70">+ {group.letter}+ </div>+ <ul className="space-y-0.5">+ {group.items.map((c) => (+ <ContactRow+ key={c.slug}+ contact={c}+ active={c.slug === selectedSlug}+ onClick={() => setSelectedSlug(c.slug)}+ />+ ))}+ </ul>+ </div>))}- </ul>+ </div>)}</nav></div>@@ -221,3 +325,28 @@ export function ContactsView() {</div>);}++function FilterChip({+ active,+ onClick,+ label,+}: {+ active: boolean;+ onClick: () => void;+ label: string;+}) {+ return (+ <button+ type="button"+ onClick={onClick}+ className={cn(+ "rounded-full border px-2 py-0.5 text-[10px] font-medium transition-colors",+ active+ ? "border-primary/40 bg-primary/15 text-primary"+ : "border-border text-muted-foreground hover:border-primary/30 hover:text-foreground",+ )}+ >+ {label}+ </button>+ );+}diff --git a/jarvis/ui/web/frontend/src/views/contacts/avatar.ts b/jarvis/ui/web/frontend/src/views/contacts/avatar.tsnew file mode 100644index 0000000000..536ffe336a--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/contacts/avatar.ts@@ -0,0 +1,32 @@+/**+ * Deterministic identity color + initials for contact avatars.+ *+ * Same name → same hue, every session: the color carries recognition, not+ * meaning. A solid mid-lightness background with a white glyph stays readable+ * on both themes, so no per-theme variant is needed.+ */+import type { CSSProperties } from "react";++/** Stable djb2-xor string hash — platform-independent, no Math.random. */+function hashString(value: string): number {+ let hash = 5381;+ for (let i = 0; i < value.length; i++) {+ hash = (Math.imul(hash, 33) ^ value.charCodeAt(i)) >>> 0;+ }+ return hash;+}++/** Up to two initials: first letter of the first and of the last word. */+export function contactInitials(name: string): string {+ const words = name.trim().split(/\s+/).filter(Boolean);+ if (words.length === 0) return "?";+ const first = words[0]![0]!;+ const last = words.length > 1 ? words[words.length - 1]![0]! : "";+ return (first + last).toUpperCase();+}++/** Inline style for the avatar circle: hue from the name, fixed S/L. */+export function contactAvatarStyle(name: string): CSSProperties {+ const hue = hashString(name.trim().toLowerCase()) % 360;+ return { backgroundColor: `hsl(${hue} 42% 46%)`, color: "#fff" };+}