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(profile): rebuild the profile section as a clean settings page
rubenluetke10-beep96e78573c9c1
diff --git a/jarvis/board/profile.py b/jarvis/board/profile.pyindex 550273378e..653f819c50 100644--- a/jarvis/board/profile.py+++ b/jarvis/board/profile.py@@ -36,6 +36,7 @@ from __future__ import annotationsimport asyncioimport jsonimport logging+import reimport sqlite3import timefrom collections import Counter@@ -416,8 +417,25 @@ def _safe(fn: Callable[..., Any], *args: Any, **kwargs: Any) -> Any:return None+_SENTENCE_END = re.compile(r"[.!?…][\"'”»)\]]*(?=\s|$)")+++def _complete_sentences(text: str) -> str:+ """``text`` cut back to its last finished sentence; "" when it has none.++ A reply that hit the token limit or a dropped stream stops mid-word+ ("…and while your Tool-"). Stored as-is, that fragment became the+ portrait for weeks, so an unfinished tail is dropped instead.+ """+ last_end = 0+ for match in _SENTENCE_END.finditer(text):+ last_end = match.end()+ return text[:last_end].strip()++def _post_process(raw: str, *, max_words: int) -> str:- """Normalises the model output to a single paragraph within a word limit."""+ """Normalises the model output to a single paragraph of whole sentences+ within a word limit."""if not raw:return ""text = raw.strip().strip("`").strip('"').strip()@@ -427,9 +445,7 @@ def _post_process(raw: str, *, max_words: int) -> str:words = text.split()if len(words) > max_words:text = " ".join(words[:max_words])- if not text.endswith((".", "!", "?")):- text = text.rstrip(",;:") + "."- return text+ return _complete_sentences(text)def _peak_hour_from_jsonl(jsonl_dir: Path | None) -> int | None:diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 034559da20..75979d65f7 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -1786,116 +1786,163 @@},"profile_view": {"title": "Profil",- "subtitle": "Was der Assistent über dich weiß, woher er es weiß und was er nie speichert.",+ "subtitle": "Was {name} über dich weiß, woher jedes Detail stammt und was nie gespeichert wird.","reload_tooltip": "Neu laden",- "field_unknown": "noch nicht bekannt",- "no_user_hint": "{name} weiß deinen Namen noch nicht. Sag ihm einfach, wie du heißt — den Rest pickt sich der Curator nach und nach aus euren Gesprächen.",- "section_source": "Die Quelldatei",+ "no_user_hint": "Das Profil läuft in dieser Sitzung nicht. Es startet mit dem vollen Assistenten.",+ "unavailable_title": "Profil nicht verfügbar","error_title": "Das Profil konnte nicht geladen werden",- "group_filled": "{0} von {1} bekannt",+ "section_source": "Profildatei","source_updated": "Aktualisiert {0}","source_empty_title": "Noch nichts geschrieben",- "source_empty_body": "Der Curator hat noch nichts in diese Datei geschrieben. Du kannst die ersten Zeilen selbst schreiben.",- "value_yes": "ja",- "value_no": "nein",+ "source_empty_body": "In dieser Datei steht noch nichts. Du kannst die ersten Zeilen selbst schreiben.",+ "value_yes": "Ja",+ "value_no": "Nein","field_edit": "Bearbeiten",- "field_clear": "Löschen",+ "field_clear": "Entfernen","field_remove_item": "Entfernen","field_add": "Hinzufügen",- "field_add_placeholder": "Hinzufügen…",- "field_value_placeholder": "Wert…",+ "field_add_placeholder": "Eintippen und Enter drücken",+ "field_value_placeholder": "Wert eingeben","field_saved": "Gespeichert",+ "field_done": "Fertig","raw_edit": "Bearbeiten","raw_save": "Speichern","raw_saving": "Speichere…","raw_cancel": "Abbrechen","raw_saved": "USER.md gespeichert",- "raw_editing_hint": "Direkte Bearbeitung der Quelldatei. Das YAML-Frontmatter zwischen den --- steuert die Cluster oben.",- "raw_frontmatter_warning": "Gespeichert — aber das YAML-Frontmatter konnte nicht geparst werden. Die Cluster bleiben leer, bis du es korrigierst.",+ "raw_editing_hint": "Du bearbeitest die Datei direkt. Der Block zwischen den Zeilen mit --- enthält die Details der Profilseite.",+ "raw_frontmatter_warning": "Gespeichert, aber der Block zwischen den Zeilen mit --- ließ sich nicht lesen. Die Profildetails bleiben leer, bis er korrigiert ist.","just_updated": "gerade aktualisiert",- "avatar_alt": "Profilbild",- "avatar_upload": "Bild hochladen",- "avatar_change": "Bild ändern",- "avatar_remove": "Bild entfernen",- "avatar_uploaded": "Profilbild aktualisiert",- "avatar_removed": "Profilbild entfernt",- "clusters": {- "identity": {- "label": "Identität",- "description": "Name, Sprachen, Geräte, Basics."+ "avatar_alt": "Profilfoto",+ "avatar_upload": "Foto hochladen",+ "avatar_change": "Foto ändern",+ "avatar_remove": "Foto entfernen",+ "avatar_uploaded": "Profilfoto aktualisiert",+ "avatar_removed": "Profilfoto entfernt",+ "hero_ask_name": "Wie soll {name} dich nennen?",+ "hero_called": "Anrede „{0}“",+ "name_placeholder": "Dein Name",+ "stat_since": "Zusammen seit",+ "stat_days": "{0} Tage",+ "stat_conversations": "Gespräche",+ "stat_known": "Bekannte Details",+ "stat_known_sub": "in deinem Profil",+ "stat_updated": "Letzte Änderung",+ "groups": {+ "about": {+ "title": "Über dich",+ "description": "Die Grundlagen, die {name} in jeder Antwort nutzt."},- "communication": {- "label": "Kommunikation",- "description": "Wie {name} mit dir redet: Direktheit, Humor, Formality."+ "talk": {+ "title": "Wie {name} mit dir spricht",+ "description": "Ton, Länge und Stil der Antworten."},- "work_style": {- "label": "Arbeitsweise",- "description": "Fokus-Modus, Planungs-Horizont, Tools."+ "work": {+ "title": "Wie du arbeitest",+ "description": "Fokus, Planung und wie du Feedback magst."},"values": {- "label": "Werte",- "description": "Top-Werte, Pet-Peeves, Motivationen."- },- "relationship": {- "label": "Beziehung",- "description": "Wie {name} Feedback gibt, wie die Dynamik läuft."+ "title": "Was dir wichtig ist",+ "description": "Prioritäten, Antrieb und was dich nervt."}},- "fields": {- "name": "Name",- "preferred_address": "Anrede",- "pronouns": "Pronomen",- "primary_language": "Primärsprache",- "languages": "Sprachen",- "timezone": "Zeitzone",- "devices": "Geräte",- "directness": "Direktheit (1–5)",- "formality": "Formality (1–5)",- "verbosity": "Verbosity",- "humor_types": "Humor-Stile",- "emoji_ok": "Emojis OK?",- "focus_mode": "Fokus-Modus",- "planning_horizon": "Planungs-Horizont",- "top_values": "Top-Werte",- "pet_peeves": "Pet Peeves",- "motivations": "Motivationen",- "feedback_pref": "Feedback-Stil"+ "group_empty": "Hier steht noch nichts. {name} ergänzt das aus euren Gesprächen, oder du trägst es jetzt selbst ein.",+ "add_label": "Hinzufügen",+ "scale_hint": {+ "directness": "1 diplomatisch · 5 ohne Umschweife",+ "formality": "1 locker · 5 förmlich"},- "tab_file": "Die Akte",- "header_unnamed": "Noch ohne Namen",- "header_nothing_yet": "Noch nichts in der Akte",- "header_since": "seit {0}",- "header_conversations": "{0} Gespräche",- "header_entries": "{0} von {1} Einträgen",- "header_updated": "geändert {0}",- "gaps_show": "{0} offene Felder",- "gaps_hide": "Offene Felder ausblenden",- "source_show": "Woher das kommt",- "source_no_quote": "Ohne Zitat notiert.",- "source_learned": "gelernt am {0}",- "source_revisions": "{0} Einträge",- "portrait_title": "Wie {name} dich beschreibt",- "portrait_fits": "Trifft",- "portrait_misses": "Trifft nicht",- "portrait_harder": "Härter",- "portrait_thanks": "Notiert — das nächste Porträt berücksichtigt das.",+ "source_show": "Herkunft anzeigen",+ "source_no_quote": "Ohne Zitat gespeichert.",+ "source_learned": "Erfahren am {0}",+ "source_revisions": "{0}-mal geändert",+ "portrait_title": "Wie {name} dich sieht",+ "portrait_description": "Ein kurzes Porträt aus deiner Aktivität und euren Gesprächen.",+ "portrait_fits": "Passt",+ "portrait_misses": "Passt nicht",+ "portrait_harder": "Schärfer",+ "portrait_ask": "Trifft es zu?",+ "portrait_thanks": "Notiert. Das nächste Porträt berücksichtigt das.","portrait_written": "Porträt geschrieben.","portrait_rewrite": "Neu schreiben","portrait_write": "Porträt schreiben",- "portrait_empty_body": "{name} hat noch kein Porträt von dir geschrieben. Es entsteht aus deiner Aktivität, deiner Gedächtnisdatei und früheren Gesprächen.",+ "portrait_written_on": "Geschrieben am {0}",+ "portrait_empty_body": "{name} hat noch kein Porträt von dir geschrieben.",+ "portrait_cut_off": "Das letzte Porträt wurde mitten im Satz abgeschnitten.",+ "memory_title": "Gedächtnis und Privatsphäre",+ "memory_description": "Wo der Rest von dem liegt, was {name} weiß, und was nie gespeichert wird.",+ "open": "Öffnen","rules_title": "Deine festen Regeln","rules_open": "{0} Zeilen in {1}",- "rules_empty_body": "Du hast {name} noch keine festen Anweisungen gegeben. Sie gelten in jedem Zug, zusätzlich zu dem, was er selbst herausfindet.",+ "rules_empty_body": "Noch keine Regeln. Regeln gelten für jede Antwort.","rules_write": "Regeln schreiben",- "never_title": "Wird nie gespeichert",- "never_body": "{name} lehnt diese Kategorien grundsätzlich ab, egal was ein Gespräch enthält.",- "wiki_title": "Im Wiki",+ "wiki_title": "Wiki-Seite über dich","wiki_facts": "{0} Fakten","wiki_links": "{0} Verweise",- "wiki_words": "{0} Wörter",- "wiki_open": "Wiki öffnen",- "wiki_empty_body": "Im Wiki gibt es noch keine Seite über dich. Sie entsteht, sobald deine Gespräche etwas hergeben.",- "wiki_needs_name": "Sag {name} deinen Namen, dann legt er im Wiki eine Seite über dich an."+ "wiki_empty_body": "Noch keine Seite. Das Wiki legt eine an, sobald eure Gespräche etwas hergeben.",+ "wiki_needs_name": "Trag deinen Namen ein, dann kann das Wiki eine Seite über dich anlegen.",+ "file_title": "Profildatei",+ "file_hint": "USER.md, die Datei hinter dieser Seite",+ "file_hint_dated": "USER.md · geändert am {0}",+ "file_open": "Datei ansehen",+ "never_title": "Wird nie gespeichert",+ "never_body": "{name} speichert das grundsätzlich nicht, egal was im Gespräch vorkommt.",+ "back_to_profile": "Zurück zum Profil",+ "fields": {+ "name": "Name",+ "preferred_address": "Anrede",+ "pronouns": "Pronomen",+ "primary_language": "Hauptsprache",+ "languages": "Sprachen",+ "timezone": "Zeitzone",+ "devices": "Geräte",+ "directness": "Direktheit",+ "formality": "Förmlichkeit",+ "verbosity": "Antwortlänge",+ "humor_types": "Humor",+ "emoji_ok": "Emojis",+ "focus_mode": "Fokus",+ "planning_horizon": "Planungshorizont",+ "top_values": "Wichtigste Werte",+ "pet_peeves": "Was dich nervt",+ "motivations": "Motivation",+ "feedback_pref": "Feedback"+ },+ "choices": {+ "verbosity": {+ "tldr": "Kurz",+ "normal": "Normal",+ "deep-dive": "Ausführlich"+ },+ "focus_mode": {+ "deep-work": "Konzentriert am Stück",+ "fragment": "In kurzen Etappen",+ "mixed": "Gemischt"+ },+ "planning_horizon": {+ "now": "Jetzt",+ "today": "Heute",+ "week": "Diese Woche",+ "quarter": "Dieses Quartal"+ },+ "feedback_pref": {+ "direct-correct": "Direkt korrigieren",+ "suggest": "Vorschläge machen",+ "ask-then-act": "Erst fragen, dann handeln"+ },+ "humor_types": {+ "dry": "Trocken",+ "nerdy": "Nerdig",+ "sarcastic": "Sarkastisch",+ "warm": "Herzlich",+ "none": "Keiner"+ },+ "motivations": {+ "mastery": "Können",+ "autonomy": "Freiheit",+ "impact": "Wirkung"+ }+ }},"apikeys_view": {"title": "API-Keys & Provider",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex c5e0c1d4bc..35aa35638c 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -1819,116 +1819,163 @@},"profile_view": {"title": "Profile",- "subtitle": "What the assistant knows about you, how it learned it, and what it never records.",+ "subtitle": "What {name} knows about you, where each detail came from, and what it never keeps.","reload_tooltip": "Reload",- "field_unknown": "not known yet",- "no_user_hint": "{name} doesn't know your name yet. Just tell him what to call you — the curator picks up the rest from your conversations over time.",- "section_source": "The source file",+ "no_user_hint": "The profile is not running in this session. It starts with the full assistant.",+ "unavailable_title": "Profile not available","error_title": "The profile could not be loaded",- "group_filled": "{0} of {1} known",+ "section_source": "Profile file","source_updated": "Updated {0}","source_empty_title": "Nothing written yet",- "source_empty_body": "The curator has not put anything in this file. You can write the first lines yourself.",- "value_yes": "yes",- "value_no": "no",+ "source_empty_body": "Nothing has been written to this file yet. You can write the first lines yourself.",+ "value_yes": "Yes",+ "value_no": "No","field_edit": "Edit",- "field_clear": "Clear",+ "field_clear": "Remove","field_remove_item": "Remove","field_add": "Add",- "field_add_placeholder": "Add…",- "field_value_placeholder": "Value…",+ "field_add_placeholder": "Type and press Enter",+ "field_value_placeholder": "Type a value","field_saved": "Saved",+ "field_done": "Done","raw_edit": "Edit","raw_save": "Save","raw_saving": "Saving…","raw_cancel": "Cancel","raw_saved": "USER.md saved",- "raw_editing_hint": "Editing the source file directly. The YAML frontmatter between the --- drives the clusters above.",- "raw_frontmatter_warning": "Saved — but the YAML frontmatter couldn't be parsed. The clusters stay empty until you fix it.",+ "raw_editing_hint": "You are editing the file directly. The block between the --- lines holds the details shown on the profile page.",+ "raw_frontmatter_warning": "Saved, but the block between the --- lines could not be read. The profile details stay empty until it is fixed.","just_updated": "just updated",- "avatar_alt": "Profile picture",+ "avatar_alt": "Profile photo","avatar_upload": "Upload photo","avatar_change": "Change photo","avatar_remove": "Remove photo",- "avatar_uploaded": "Profile picture updated",- "avatar_removed": "Profile picture removed",- "clusters": {- "identity": {- "label": "Identity",- "description": "Name, languages, devices, basics."+ "avatar_uploaded": "Profile photo updated",+ "avatar_removed": "Profile photo removed",+ "hero_ask_name": "What should {name} call you?",+ "hero_called": "called “{0}”",+ "name_placeholder": "Your name",+ "stat_since": "Together since",+ "stat_days": "{0} days",+ "stat_conversations": "Conversations",+ "stat_known": "Details known",+ "stat_known_sub": "in your profile",+ "stat_updated": "Last change",+ "groups": {+ "about": {+ "title": "About you",+ "description": "The basics {name} uses in every reply."},- "communication": {- "label": "Communication",- "description": "How {name} talks to you: directness, humor, formality."+ "talk": {+ "title": "How {name} talks to you",+ "description": "Tone, length and style of answers."},- "work_style": {- "label": "Work Style",- "description": "Focus mode, planning horizon, tools."+ "work": {+ "title": "How you work",+ "description": "Focus, planning, and how you like feedback."},"values": {- "label": "Values",- "description": "Top values, pet peeves, motivations."- },- "relationship": {- "label": "Relationship",- "description": "How {name} gives feedback, how the dynamic runs."+ "title": "What matters to you",+ "description": "Priorities, motivation, and what gets on your nerves."}},- "fields": {- "name": "Name",- "preferred_address": "Address form",- "pronouns": "Pronouns",- "primary_language": "Primary language",- "languages": "Languages",- "timezone": "Timezone",- "devices": "Devices",- "directness": "Directness (1–5)",- "formality": "Formality (1–5)",- "verbosity": "Verbosity",- "humor_types": "Humor styles",- "emoji_ok": "Emojis OK?",- "focus_mode": "Focus mode",- "planning_horizon": "Planning horizon",- "top_values": "Top values",- "pet_peeves": "Pet peeves",- "motivations": "Motivations",- "feedback_pref": "Feedback style"+ "group_empty": "Nothing here yet. {name} fills this in from your conversations, or you can add details now.",+ "add_label": "Add",+ "scale_hint": {+ "directness": "1 diplomatic · 5 no fluff",+ "formality": "1 casual · 5 formal"},- "tab_file": "The file",- "header_unnamed": "No name on file",- "header_nothing_yet": "Nothing on file yet",- "header_since": "since {0}",- "header_conversations": "{0} conversations",- "header_entries": "{0} of {1} entries",- "header_updated": "updated {0}",- "gaps_show": "{0} open fields",- "gaps_hide": "Hide open fields",- "source_show": "Where this came from",- "source_no_quote": "Written without a quoted source.",- "source_learned": "learned {0}",- "source_revisions": "{0} entries",- "portrait_title": "How {name} describes you",+ "source_show": "Show where this came from",+ "source_no_quote": "Recorded without a quote.",+ "source_learned": "Learned {0}",+ "source_revisions": "Changed {0} times",+ "portrait_title": "How {name} sees you",+ "portrait_description": "A short portrait written from your activity and past conversations.","portrait_fits": "Fits","portrait_misses": "Misses","portrait_harder": "Be harder",- "portrait_thanks": "Noted — the next portrait will take that into account.",+ "portrait_ask": "Does it fit?",+ "portrait_thanks": "Noted. The next portrait takes this into account.","portrait_written": "Portrait written.",- "portrait_rewrite": "Write it again",+ "portrait_rewrite": "Write a new one","portrait_write": "Write the portrait",- "portrait_empty_body": "{name} has not written a portrait of you yet. It is drawn from your activity, your memory file and past conversations.",+ "portrait_written_on": "Written {0}",+ "portrait_empty_body": "{name} has not written a portrait of you yet.",+ "portrait_cut_off": "The last portrait was cut off before it was finished.",+ "memory_title": "Memory and privacy",+ "memory_description": "Where the rest of what {name} knows lives, and what it never keeps.",+ "open": "Open","rules_title": "Your standing rules","rules_open": "{0} lines in {1}",- "rules_empty_body": "You have not given {name} any standing instructions yet. They apply on every turn, on top of what it works out on its own.",- "rules_write": "Write your rules",- "never_title": "Never recorded",- "never_body": "{name} refuses these categories outright, whatever a conversation contains.",- "wiki_title": "In the wiki",+ "rules_empty_body": "No rules yet. Rules apply to every reply.",+ "rules_write": "Write rules",+ "wiki_title": "Wiki page about you","wiki_facts": "{0} facts","wiki_links": "{0} links",- "wiki_words": "{0} words",- "wiki_open": "Open the vault",- "wiki_empty_body": "The vault has no page about you yet. One is written once your conversations give it something to record.",- "wiki_needs_name": "Tell {name} your name and it will start a page about you in the vault."+ "wiki_empty_body": "No page yet. The wiki starts one once your conversations give it something to record.",+ "wiki_needs_name": "Add your name and the wiki can start a page about you.",+ "file_title": "Profile file",+ "file_hint": "USER.md, the file behind this page",+ "file_hint_dated": "USER.md · changed {0}",+ "file_open": "View file",+ "never_title": "Never recorded",+ "never_body": "{name} refuses to store these, whatever a conversation contains.",+ "back_to_profile": "Back to profile",+ "fields": {+ "name": "Name",+ "preferred_address": "What to call you",+ "pronouns": "Pronouns",+ "primary_language": "Main language",+ "languages": "Languages",+ "timezone": "Time zone",+ "devices": "Devices",+ "directness": "Directness",+ "formality": "Formality",+ "verbosity": "Answer length",+ "humor_types": "Humor",+ "emoji_ok": "Emojis",+ "focus_mode": "Focus",+ "planning_horizon": "Planning horizon",+ "top_values": "Top values",+ "pet_peeves": "Pet peeves",+ "motivations": "Motivations",+ "feedback_pref": "Feedback"+ },+ "choices": {+ "verbosity": {+ "tldr": "Short",+ "normal": "Normal",+ "deep-dive": "In depth"+ },+ "focus_mode": {+ "deep-work": "Deep work",+ "fragment": "Short bursts",+ "mixed": "Mixed"+ },+ "planning_horizon": {+ "now": "Right now",+ "today": "Today",+ "week": "This week",+ "quarter": "This quarter"+ },+ "feedback_pref": {+ "direct-correct": "Correct me directly",+ "suggest": "Suggest changes",+ "ask-then-act": "Ask, then act"+ },+ "humor_types": {+ "dry": "Dry",+ "nerdy": "Nerdy",+ "sarcastic": "Sarcastic",+ "warm": "Warm",+ "none": "None"+ },+ "motivations": {+ "mastery": "Mastery",+ "autonomy": "Autonomy",+ "impact": "Impact"+ }+ }},"apikeys_view": {"title": "API Keys & Providers",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 665f4ddc34..61be01a387 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -1786,116 +1786,163 @@},"profile_view": {"title": "Perfil",- "subtitle": "Lo que el asistente sabe de ti, cómo lo aprendió y lo que nunca guarda.",+ "subtitle": "Lo que {name} sabe de ti, de dónde viene cada dato y lo que nunca guarda.","reload_tooltip": "Recargar",- "field_unknown": "aún no conocido",- "no_user_hint": "{name} aún no sabe tu nombre. Solo dile cómo llamarte — el curador irá recogiendo el resto de tus conversaciones con el tiempo.",- "section_source": "El archivo fuente",+ "no_user_hint": "El perfil no está activo en esta sesión. Se inicia con el asistente completo.",+ "unavailable_title": "Perfil no disponible","error_title": "No se pudo cargar el perfil",- "group_filled": "{0} de {1} conocidos",+ "section_source": "Archivo de perfil","source_updated": "Actualizado {0}","source_empty_title": "Aún no hay nada escrito",- "source_empty_body": "El curador no ha puesto nada en este archivo. Puedes escribir las primeras líneas tú mismo.",- "value_yes": "sí",- "value_no": "no",+ "source_empty_body": "Este archivo todavía está vacío. Puedes escribir las primeras líneas tú mismo.",+ "value_yes": "Sí",+ "value_no": "No","field_edit": "Editar",- "field_clear": "Borrar",+ "field_clear": "Quitar","field_remove_item": "Quitar","field_add": "Añadir",- "field_add_placeholder": "Añadir…",- "field_value_placeholder": "Valor…",+ "field_add_placeholder": "Escribe y pulsa Enter",+ "field_value_placeholder": "Escribe un valor","field_saved": "Guardado",+ "field_done": "Listo","raw_edit": "Editar","raw_save": "Guardar","raw_saving": "Guardando…","raw_cancel": "Cancelar",- "raw_saved": "USER.md guardada",- "raw_editing_hint": "Editando el archivo fuente directamente. El frontmatter YAML entre los --- controla los clústeres de arriba.",- "raw_frontmatter_warning": "Guardado — pero no se pudo parsear el frontmatter YAML. Los clústeres quedan vacíos hasta que lo corrijas.",+ "raw_saved": "USER.md guardado",+ "raw_editing_hint": "Estás editando el archivo directamente. El bloque entre las líneas --- contiene los datos de la página de perfil.",+ "raw_frontmatter_warning": "Guardado, pero no se pudo leer el bloque entre las líneas ---. Los datos del perfil seguirán vacíos hasta corregirlo.","just_updated": "recién actualizado","avatar_alt": "Foto de perfil","avatar_upload": "Subir foto","avatar_change": "Cambiar foto",- "avatar_remove": "Eliminar foto",+ "avatar_remove": "Quitar foto","avatar_uploaded": "Foto de perfil actualizada","avatar_removed": "Foto de perfil eliminada",- "clusters": {- "identity": {- "label": "Identidad",- "description": "Nombre, idiomas, dispositivos, básicos."+ "hero_ask_name": "¿Cómo debe llamarte {name}?",+ "hero_called": "te llama «{0}»",+ "name_placeholder": "Tu nombre",+ "stat_since": "Juntos desde",+ "stat_days": "{0} días",+ "stat_conversations": "Conversaciones",+ "stat_known": "Datos conocidos",+ "stat_known_sub": "en tu perfil",+ "stat_updated": "Último cambio",+ "groups": {+ "about": {+ "title": "Sobre ti",+ "description": "Lo básico que {name} usa en cada respuesta."},- "communication": {- "label": "Comunicación",- "description": "Cómo {name} te habla: franqueza, humor, formalidad."+ "talk": {+ "title": "Cómo te habla {name}",+ "description": "Tono, longitud y estilo de las respuestas."},- "work_style": {- "label": "Estilo de trabajo",- "description": "Modo enfoque, horizonte de planificación, herramientas."+ "work": {+ "title": "Cómo trabajas",+ "description": "Enfoque, planificación y cómo prefieres el feedback."},"values": {- "label": "Valores",- "description": "Valores principales, manías, motivaciones."- },- "relationship": {- "label": "Relación",- "description": "Cómo {name} da feedback, cómo es la dinámica."+ "title": "Lo que te importa",+ "description": "Prioridades, motivación y lo que te molesta."}},+ "group_empty": "Aquí aún no hay nada. {name} lo completa con vuestras conversaciones, o puedes añadirlo ahora.",+ "add_label": "Añadir",+ "scale_hint": {+ "directness": "1 diplomático · 5 sin rodeos",+ "formality": "1 informal · 5 formal"+ },+ "source_show": "Ver de dónde viene",+ "source_no_quote": "Guardado sin cita.",+ "source_learned": "Aprendido el {0}",+ "source_revisions": "Cambiado {0} veces",+ "portrait_title": "Cómo te ve {name}",+ "portrait_description": "Un retrato breve escrito a partir de tu actividad y vuestras conversaciones.",+ "portrait_fits": "Acierta",+ "portrait_misses": "No acierta",+ "portrait_harder": "Más duro",+ "portrait_ask": "¿Acierta?",+ "portrait_thanks": "Anotado. El próximo retrato lo tendrá en cuenta.",+ "portrait_written": "Retrato escrito.",+ "portrait_rewrite": "Escribir otro",+ "portrait_write": "Escribir el retrato",+ "portrait_written_on": "Escrito el {0}",+ "portrait_empty_body": "{name} aún no ha escrito un retrato de ti.",+ "portrait_cut_off": "El último retrato se cortó antes de terminar.",+ "memory_title": "Memoria y privacidad",+ "memory_description": "Dónde está el resto de lo que sabe {name} y lo que nunca guarda.",+ "open": "Abrir",+ "rules_title": "Tus reglas fijas",+ "rules_open": "{0} líneas en {1}",+ "rules_empty_body": "Aún no hay reglas. Las reglas se aplican a cada respuesta.",+ "rules_write": "Escribir reglas",+ "wiki_title": "Página wiki sobre ti",+ "wiki_facts": "{0} datos",+ "wiki_links": "{0} enlaces",+ "wiki_empty_body": "Aún no hay página. La wiki crea una cuando vuestras conversaciones aportan algo.",+ "wiki_needs_name": "Añade tu nombre y la wiki podrá crear una página sobre ti.",+ "file_title": "Archivo de perfil",+ "file_hint": "USER.md, el archivo detrás de esta página",+ "file_hint_dated": "USER.md · cambiado el {0}",+ "file_open": "Ver archivo",+ "never_title": "Nunca se guarda",+ "never_body": "{name} se niega a guardar esto, diga lo que diga una conversación.",+ "back_to_profile": "Volver al perfil","fields": {"name": "Nombre",- "preferred_address": "Tratamiento",+ "preferred_address": "Cómo llamarte","pronouns": "Pronombres","primary_language": "Idioma principal","languages": "Idiomas","timezone": "Zona horaria","devices": "Dispositivos",- "directness": "Franqueza (1–5)",- "formality": "Formalidad (1–5)",- "verbosity": "Verbosidad",- "humor_types": "Estilos de humor",- "emoji_ok": "¿Emojis vale?",- "focus_mode": "Modo enfoque",+ "directness": "Franqueza",+ "formality": "Formalidad",+ "verbosity": "Longitud de respuesta",+ "humor_types": "Humor",+ "emoji_ok": "Emojis",+ "focus_mode": "Enfoque","planning_horizon": "Horizonte de planificación","top_values": "Valores principales",- "pet_peeves": "Manías",+ "pet_peeves": "Lo que te molesta","motivations": "Motivaciones",- "feedback_pref": "Estilo de feedback"+ "feedback_pref": "Feedback"},- "tab_file": "El expediente",- "header_unnamed": "Todavía sin nombre",- "header_nothing_yet": "Aún no hay nada en el expediente",- "header_since": "desde {0}",- "header_conversations": "{0} conversaciones",- "header_entries": "{0} de {1} entradas",- "header_updated": "actualizado {0}",- "gaps_show": "{0} campos abiertos",- "gaps_hide": "Ocultar campos abiertos",- "source_show": "De dónde viene esto",- "source_no_quote": "Anotado sin cita.",- "source_learned": "aprendido el {0}",- "source_revisions": "{0} entradas",- "portrait_title": "Cómo te describe {name}",- "portrait_fits": "Acierta",- "portrait_misses": "No acierta",- "portrait_harder": "Más duro",- "portrait_thanks": "Anotado: el próximo retrato lo tendrá en cuenta.",- "portrait_written": "Retrato escrito.",- "portrait_rewrite": "Escribirlo de nuevo",- "portrait_write": "Escribir el retrato",- "portrait_empty_body": "{name} todavía no ha escrito un retrato tuyo. Se compone de tu actividad, tu archivo de memoria y conversaciones anteriores.",- "rules_title": "Tus reglas fijas",- "rules_open": "{0} líneas en {1}",- "rules_empty_body": "Todavía no le has dado instrucciones fijas a {name}. Se aplican en cada turno, además de lo que deduce por su cuenta.",- "rules_write": "Escribir tus reglas",- "never_title": "Nunca se guarda",- "never_body": "{name} rechaza estas categorías por principio, sea cual sea el contenido de una conversación.",- "wiki_title": "En el wiki",- "wiki_facts": "{0} hechos",- "wiki_links": "{0} enlaces",- "wiki_words": "{0} palabras",- "wiki_open": "Abrir el wiki",- "wiki_empty_body": "El wiki aún no tiene una página sobre ti. Se crea en cuanto tus conversaciones aporten algo.",- "wiki_needs_name": "Dile tu nombre a {name} y creará una página sobre ti en el wiki."+ "choices": {+ "verbosity": {+ "tldr": "Breve",+ "normal": "Normal",+ "deep-dive": "Detallada"+ },+ "focus_mode": {+ "deep-work": "Trabajo profundo",+ "fragment": "En ratos cortos",+ "mixed": "Mixto"+ },+ "planning_horizon": {+ "now": "Ahora",+ "today": "Hoy",+ "week": "Esta semana",+ "quarter": "Este trimestre"+ },+ "feedback_pref": {+ "direct-correct": "Corrígeme directamente",+ "suggest": "Sugiere cambios",+ "ask-then-act": "Pregunta y luego actúa"+ },+ "humor_types": {+ "dry": "Seco",+ "nerdy": "Friki",+ "sarcastic": "Sarcástico",+ "warm": "Cálido",+ "none": "Ninguno"+ },+ "motivations": {+ "mastery": "Dominio",+ "autonomy": "Autonomía",+ "impact": "Impacto"+ }+ }},"apikeys_view": {"title": "Claves API y Proveedores",diff --git a/jarvis/ui/web/frontend/src/views/ProfileView.test.tsx b/jarvis/ui/web/frontend/src/views/ProfileView.test.tsxindex 32627b9385..304a2fe129 100644--- a/jarvis/ui/web/frontend/src/views/ProfileView.test.tsx+++ b/jarvis/ui/web/frontend/src/views/ProfileView.test.tsx@@ -1,17 +1,14 @@/**- * Component tests for the rebuilt Profile section.+ * Component tests for the Profile section.*- * What these pin is the contract the redesign was built on: the page states- * facts and folds gaps (rather than printing "not known yet" eighteen times),- * every known fact can show the sentence it was learned from, and each rail- * card has a designed empty state instead of a dead box.- *- * The three cards that were deleted are guarded too — the review queue, the- * people list and the "would love to know" prompt were all structurally unable- * to fill, and a later change should not quietly bring them back.+ * What these pin: known details are rows and missing ones are one line of+ * "add" chips (never a wall of "not set"), every known detail can show the+ * sentence it was learned from, an unnamed profile asks for a name, a portrait+ * that stops mid-word is never shown as if it were finished, and the raw file+ * opens as a sub-page. The dead review queue stays deleted.*/import { afterEach, describe, expect, it, vi } from "vitest";-import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";+import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import { ProfileView } from "@/views/ProfileView";@@ -116,65 +113,87 @@ afterEach(() => {vi.restoreAllMocks();});-describe("the file states facts and folds gaps", () => {- it("shows the known facts and never repeats 'not known yet' for the rest", async () => {+describe("details", () => {+ it("shows known details as rows and missing ones as add chips", async () => {installFetchMock(BASE_ROUTES);renderWithClient(<ProfileView />);await screen.findByText("Europe/Berlin");-- // Sixteen empty fields exist, and none of them is on the page yet.+ const missing = await screen.findByTestId("missing-talk");+ expect(missing.textContent).toContain("Answer length");+ // No wall of empty rows.+ expect(screen.queryByTestId("field-verbosity")).toBeNull();expect(screen.queryByText("not known yet")).toBeNull();});- it("counts the entries in the header instead of scoring the reader", async () => {+ it("opens the editor for a missing detail from its chip", async () => {installFetchMock(BASE_ROUTES);renderWithClient(<ProfileView />);- const count = await screen.findByTestId("dossier-count");- expect(count.textContent).toBe("3 of 18 entries");- // The old header asked "Who are you?" over a progress bar.- expect(screen.queryByRole("progressbar")).toBeNull();+ const missing = await screen.findByTestId("missing-talk");+ fireEvent.click(within(missing).getByRole("button", { name: /Answer length/ }));++ const row = await screen.findByTestId("field-verbosity");+ expect(within(row).getByRole("radio", { name: "In depth" })).toBeTruthy();});- it("puts the reader's name at the top, not a stage name", async () => {- installFetchMock(BASE_ROUTES);+ it("renders a choice value by its label, not its stored token", async () => {+ installFetchMock({+ ...BASE_ROUTES,+ "/api/profile": () => ({+ body: {+ ...PROFILE_OK,+ user: {+ ...PROFILE_OK.user,+ meta: { ...PROFILE_OK.user.meta, communication: { verbosity: "deep-dive" } },+ },+ },+ }),+ });renderWithClient(<ProfileView />);- const header = await screen.findByTestId("dossier-header");- expect(header.textContent).toContain("Ruben");- // The board summary lands a tick later; the line grows rather than- // reserving a slot with a zero in it.- await waitFor(() => expect(header.textContent).toContain("491 conversations"));- expect(header.textContent).toContain("since");+ const row = await screen.findByTestId("field-verbosity");+ expect(row.textContent).toContain("In depth");+ expect(row.textContent).not.toContain("deep-dive");});- it("opens a cluster's gaps on demand", async () => {+ it("counts the known details in the header", async () => {installFetchMock(BASE_ROUTES);renderWithClient(<ProfileView />);- const toggle = await screen.findByTestId("gaps-communication");- expect(toggle.textContent).toContain("5 open fields");- expect(screen.queryByText("Verbosity")).toBeNull();+ const hero = await screen.findByTestId("profile-hero");+ expect(hero.textContent).toContain("Ruben");+ expect(hero.textContent).toContain("3 / 18");+ await waitFor(() => expect(hero.textContent).toContain("491"));+ });- fireEvent.click(toggle);- await screen.findByText("Verbosity");+ it("asks for a name when the file has none", async () => {+ installFetchMock({+ ...BASE_ROUTES,+ "/api/profile": () => ({+ body: { ...PROFILE_OK, user: { ...PROFILE_OK.user, name: null } },+ }),+ });+ renderWithClient(<ProfileView />);++ const hero = await screen.findByTestId("profile-hero");+ expect(within(hero).getByPlaceholderText("Your name")).toBeTruthy();});});describe("provenance", () => {- it("shows the date a fact was learned and the sentence behind it", async () => {+ it("shows the date a detail was learned and the sentence behind it", async () => {installFetchMock(BASE_ROUTES);renderWithClient(<ProfileView />);const source = await screen.findByTestId("entry-source-primary_language");- expect(source.textContent).toContain("2026-08-29");+ expect(source.textContent).toContain("Learned");fireEvent.click(source);await screen.findByText("always answer me in German");});- it("shows no date for a fact the audit trail never mentions", async () => {+ it("shows no date for a detail the audit trail never mentions", async () => {installFetchMock(BASE_ROUTES);renderWithClient(<ProfileView />);@@ -183,7 +202,7 @@ describe("provenance", () => {});});-describe("the rail", () => {+describe("portrait", () => {it("offers to write the portrait when none exists", async () => {installFetchMock(BASE_ROUTES);renderWithClient(<ProfileView />);@@ -192,7 +211,7 @@ describe("the rail", () => {expect(empty.textContent).toContain("has not written a portrait");});- it("renders the portrait and its feedback when one exists", async () => {+ it("renders a finished portrait with its feedback", async () => {installFetchMock({...BASE_ROUTES,"/api/board/bio": () => ({@@ -206,6 +225,24 @@ describe("the rail", () => {expect(screen.getByRole("button", { name: "Fits" })).toBeTruthy();});+ it("never shows a portrait that stops mid-word as if it were finished", async () => {+ installFetchMock({+ ...BASE_ROUTES,+ "/api/board/bio": () => ({+ body: {+ text: "I have watched you for 34 days, and while your Tool-",+ generated_at: "2026-09-06T18:00:00Z",+ },+ }),+ });+ renderWithClient(<ProfileView />);++ await screen.findByTestId("portrait-cut-off");+ expect(screen.queryByTestId("portrait-text")).toBeNull();+ });+});++describe("memory and privacy", () => {it("quotes the never-recorded categories out of the file", async () => {installFetchMock(BASE_ROUTES);renderWithClient(<ProfileView />);@@ -219,31 +256,30 @@ describe("the rail", () => {installFetchMock(BASE_ROUTES);renderWithClient(<ProfileView />);- const empty = await screen.findByTestId("wiki-empty");- expect(empty.textContent).toContain("no page about you yet");+ await waitFor(() =>+ expect(screen.getByTestId("wiki-empty").textContent).toContain("No page yet"),+ );});-});-describe("the dead cards stay deleted", () => {- it("renders no review queue, no people list and no ask prompt", async () => {+ it("opens the source file as a sub-page and comes back", async () => {installFetchMock(BASE_ROUTES);renderWithClient(<ProfileView />);- await screen.findByTestId("dossier-header");- await waitFor(() => expect(screen.queryByTestId("never-stored")).not.toBeNull());+ const row = await screen.findByTestId("source-row");+ fireEvent.click(within(row).getByRole("button", { name: /View file/ }));+ await screen.findByTestId("profile-source-markdown");- expect(screen.queryByTestId("ask-next")).toBeNull();- expect(screen.queryByTestId("reviews-disabled")).toBeNull();- expect(screen.queryByTestId("reviews-error")).toBeNull();- expect(screen.queryByText("Waiting for your OK")).toBeNull();- expect(screen.queryByText("No people known yet")).toBeNull();+ fireEvent.click(screen.getByTestId("source-back"));+ await screen.findByTestId("profile-hero");});+});+describe("the dead review queue stays deleted", () => {it("never calls the review endpoint", async () => {const fetchMock = installFetchMock(BASE_ROUTES);renderWithClient(<ProfileView />);- await screen.findByTestId("dossier-header");+ await screen.findByTestId("profile-hero");const called = fetchMock.mock.calls.map((c) => String(c[0]));expect(called.some((u) => u.includes("/api/profile/reviews"))).toBe(false);});@@ -257,7 +293,7 @@ describe("a profile the backend is not serving", () => {});renderWithClient(<ProfileView />);- await screen.findByText("No name on file");- expect(screen.queryByTestId("dossier-header")).toBeNull();+ await screen.findByText("Profile not available");+ expect(screen.queryByTestId("profile-hero")).toBeNull();});});diff --git a/jarvis/ui/web/frontend/src/views/ProfileView.tsx b/jarvis/ui/web/frontend/src/views/ProfileView.tsxindex 717f8b803c..535707d0ef 100644--- a/jarvis/ui/web/frontend/src/views/ProfileView.tsx+++ b/jarvis/ui/web/frontend/src/views/ProfileView.tsx@@ -1,62 +1,53 @@/**- * ProfileView — the file the assistant keeps on you.+ * ProfileView — what the assistant knows about you, and how to change it.*- * The section answers one question: *what do you know about me, and how do you- * know it?* Everything on the page is either a fact, the receipt for a fact,- * or the boundary the assistant will not cross.+ * One column, read top to bottom like any settings page:*- * ┌──────────────────────────────────────────────────────────────────┐- * │ PageHeader — Profile · refresh · [ The file | Source ] │- * ├──────────────────────────────────────────────────────────────────┤- * │ Name · language · timezone · since · conversations 6 of 18 │- * ├───────────────────────────────────┬──────────────────────────────┤- * │ Entries — five sections, known │ How the assistant describes │- * │ facts listed, gaps folded into │ you · your standing rules · │- * │ one line, every entry showing │ what is never stored · the │- * │ the date it was learned │ long-form page in the wiki │- * └───────────────────────────────────┴──────────────────────────────┘+ * ┌────────────────────────────────────────────────────────────┐+ * │ Photo · name · language · timezone │+ * │ Since │ Conversations │ Details known │ Last change │+ * ├────────────────────────────────────────────────────────────┤+ * │ About you · How {name} talks to you · How you work · │+ * │ What matters to you — known details as rows, missing ones │+ * │ as one line of "add" chips per group │+ * ├────────────────────────────────────────────────────────────┤+ * │ How {name} sees you — the written portrait + feedback │+ * ├────────────────────────────────────────────────────────────┤+ * │ Memory and privacy — rules, wiki page, the file, and what │+ * │ is never recorded │+ * └────────────────────────────────────────────────────────────┘*- * Three cards were removed rather than restyled, because no styling makes an- * empty pipe full: the review queue (the legacy curator has been disabled- * since 2026-05-17, so it could never fill), the people list (it read- * `data/workspace/people/`, which is empty — Contacts owns people), and the- * "would love to know" prompt (it wrote to no endpoint; the gap expander in- * the ledger now fills fields for real).+ * The raw file (USER.md) opens in place as a sub-page with a back link,+ * rather than as a tab: it is the source behind the page, not a peer of it.*- * The raw-file query and its live WS subscription are held HERE rather than in- * the source tab, because both tabs need it: the source tab renders it, and- * the file tab parses its audit trail for provenance.+ * The raw-file query and its live WS subscription are held HERE because both+ * views need it: the sub-page renders it, and the main page parses its audit+ * trail for provenance and its Do Not Record list.*/import { useMemo, useState } from "react";import { useQuery } from "@tanstack/react-query";-import { AlertTriangle, RefreshCw, UserCircle2 } from "lucide-react";+import { AlertTriangle, ArrowLeft, RefreshCw, UserCircle2 } from "lucide-react";import { PageHeader } from "@/components/layout/PageHeader";-import { TabBar } from "@/components/layout/SectionTabBar";import { Button } from "@/components/ui/button";import { EmptyState } from "@/components/ui/empty-state";import { useT } from "@/i18n";import { cn } from "@/lib/utils";-import { DossierHeader } from "@/views/profile/DossierHeader";-import { EntryLedger } from "@/views/profile/EntryLedger";-import { NeverStoredCard } from "@/views/profile/NeverStoredCard";-import { PortraitCard } from "@/views/profile/PortraitCard";-import { RulesCard } from "@/views/profile/RulesCard";+import { FieldGroup } from "@/views/profile/FieldGroup";+import { MemorySection } from "@/views/profile/MemorySection";+import { PortraitSection } from "@/views/profile/PortraitSection";+import { ProfileHero } from "@/views/profile/ProfileHero";import { SourceCard, useSourceDocument } from "@/views/profile/SourceCard";-import { WikiCard } from "@/views/profile/WikiCard";import { fetchJson, statusOf, type ProfileResponse } from "@/views/profile/api";+import { PAGE_GROUPS } from "@/views/profile/ledger";import { parseObservations } from "@/views/profile/provenance";-type TabId = "file" | "source";--/** Entries left, rail right, and one column below 1280 px. */-const SPLIT = "grid gap-5 xl:grid-cols-[minmax(0,1fr)_360px]";-/** The rail: a row of cards under the entries until it can stand beside them. */-const RAIL = "grid gap-5 content-start sm:grid-cols-2 xl:grid-cols-1";+/** The reading column: wide enough for a row, narrow enough to scan. */+const COLUMN = "mx-auto w-full max-w-[880px]";export function ProfileView() {const t = useT();- const [tab, setTab] = useState<TabId>("file");+ const [showSource, setShowSource] = useState(false);const { data, isLoading, error, refetch, isRefetching } = useQuery<ProfileResponse, Error>({queryKey: ["profile"],@@ -72,8 +63,8 @@ export function ProfileView() {const meta = (data?.user.meta ?? {}) as Record<string, unknown>;return (- <div className="flex h-full flex-col overflow-hidden bg-background">- <div className="shrink-0 px-8">+ <div className="flex h-full flex-col overflow-y-auto bg-background px-8 pb-10 scrollbar-jarvis">+ <div className={COLUMN}><PageHeadericon={<UserCircle2 />}title={t("profile_view.title")}@@ -84,7 +75,10 @@ export function ProfileView() {size="icon"variant="ghost"className="text-muted-foreground"- onClick={() => refetch()}+ onClick={() => {+ void refetch();+ source.refetch();+ }}disabled={isRefetching}title={t("profile_view.reload_tooltip")}aria-label={t("profile_view.reload_tooltip")}@@ -92,40 +86,53 @@ export function ProfileView() {<RefreshCw className={cn(isRefetching && "animate-spin")} /></Button>}- tabs={- <TabBar- tabs={[- { id: "file", label: t("profile_view.tab_file") },- { id: "source", label: t("profile_view.section_source") },- ]}- active={tab}- onChange={(id) => setTab(id as TabId)}- />- }/>- </div>- <div className="min-h-0 flex-1 overflow-y-auto px-8 pb-8 pt-6 scrollbar-jarvis">{isLoading && <ProfileSkeleton label={t("common.loading")} />}{error && <ProfileErrorState error={error} onRetry={() => refetch()} />}- {data && tab === "file" && (- <div className="flex flex-col gap-5">- <DossierHeader data={data} meta={meta} />- <div className={SPLIT}>- <EntryLedger meta={meta} observations={observations} />- <aside className={RAIL}>- <PortraitCard />- <RulesCard />- <NeverStoredCard raw={raw} />- <WikiCard name={data.user.name?.trim() || null} />- </aside>- </div>+ {data && showSource && (+ <div className="flex flex-col gap-4">+ <Button+ type="button"+ variant="ghost"+ size="sm"+ className="self-start text-muted-foreground"+ onClick={() => {+ source.cancelEditing();+ setShowSource(false);+ }}+ data-testid="source-back"+ >+ <ArrowLeft aria-hidden />+ {t("profile_view.back_to_profile")}+ </Button>+ <SourceCard doc={source} /></div>)}- {data && tab === "source" && <SourceCard doc={source} />}+ {data && !showSource && (+ <div className="flex flex-col gap-10">+ <ProfileHero data={data} meta={meta} />+ {PAGE_GROUPS.map((g) => (+ <FieldGroup+ key={g.id}+ id={g.id}+ fields={g.fields}+ meta={meta}+ observations={observations}+ />+ ))}+ <PortraitSection />+ <MemorySection+ name={data.user.name?.trim() || null}+ raw={raw}+ fileUpdatedMs={source.data?.mtime_ms ?? null}+ onOpenSource={() => setShowSource(true)}+ />+ </div>+ )}</div></div>);@@ -136,47 +143,42 @@ export function ProfileView() {// ----------------------------------------------------------------------/**- * The real layout at its real height with skeleton bars. A centred spinner in- * an empty window is the state that reads as "broken", because it throws away- * every bit of structure the section is about to have — and a zero in a slot- * that has not loaded yet is worse, because it reads as a fact.+ * The real layout at its real height with skeleton bars. A zero in a slot+ * that has not loaded yet would read as a fact, so there are none.*/function ProfileSkeleton({ label }: { label: string }) {return (- <div role="status" aria-busy="true" aria-label={label} className="flex flex-col gap-5">- <div className="flex items-center gap-5 border-b border-border pb-5">- <div className="h-16 w-16 shrink-0 animate-pulse rounded-full bg-secondary" />- <div className="flex min-w-0 flex-1 flex-col gap-2">- <div className="h-6 w-56 max-w-full animate-pulse rounded-md bg-secondary" />- <div className="h-3 w-72 max-w-full animate-pulse rounded-full bg-secondary" />+ <div role="status" aria-busy="true" aria-label={label} className="flex flex-col gap-10">+ <div className="rounded-xl border border-border bg-card">+ <div className="flex items-center gap-5 p-6">+ <div className="h-20 w-20 shrink-0 animate-pulse rounded-full bg-secondary" />+ <div className="flex min-w-0 flex-1 flex-col gap-2.5">+ <div className="h-6 w-48 max-w-full animate-pulse rounded-md bg-secondary" />+ <div className="h-3.5 w-64 max-w-full animate-pulse rounded-full bg-secondary" />+ </div></div>- <div className="hidden h-3 w-32 shrink-0 animate-pulse rounded-full bg-secondary sm:block" />- </div>-- <div className={SPLIT}>- <div className="rounded-lg border border-border bg-card">- {[0, 1, 2, 3, 4].map((i) => (- <div key={i} className="border-b border-border px-5 py-4 last:border-b-0">- <div className="h-4 w-32 animate-pulse rounded-md bg-secondary" />- <div className="mt-3 flex flex-col gap-2">- <div className="h-3 w-full animate-pulse rounded-full bg-secondary" />- <div className="h-3 w-2/3 animate-pulse rounded-full bg-secondary" />- </div>+ <div className="grid grid-cols-2 border-t border-border sm:grid-cols-4">+ {[0, 1, 2, 3].map((i) => (+ <div key={i} className="px-5 py-4">+ <div className="h-3 w-16 animate-pulse rounded-full bg-secondary" />+ <div className="mt-2 h-5 w-20 animate-pulse rounded-md bg-secondary" /></div>))}</div>- <div className={RAIL}>- {[0, 1, 2].map((i) => (- <div key={i} className="rounded-lg border border-border bg-card p-5">- <div className="h-4 w-28 animate-pulse rounded-md bg-secondary" />- <div className="mt-4 flex flex-col gap-2">- <div className="h-3 w-full animate-pulse rounded-full bg-secondary" />- <div className="h-3 w-4/5 animate-pulse rounded-full bg-secondary" />+ </div>+ {[0, 1].map((i) => (+ <div key={i} className="flex flex-col gap-3">+ <div className="h-5 w-40 animate-pulse rounded-md bg-secondary" />+ <div className="divide-y divide-border rounded-xl border border-border bg-card">+ {[0, 1, 2].map((j) => (+ <div key={j} className="flex items-center justify-between px-5 py-4">+ <div className="h-3.5 w-28 animate-pulse rounded-full bg-secondary" />+ <div className="h-3.5 w-24 animate-pulse rounded-full bg-secondary" /></div>- </div>- ))}+ ))}+ </div></div>- </div>+ ))}</div>);}@@ -194,7 +196,7 @@ function ProfileErrorState({ error, onRetry }: { error: Error; onRetry: () => voreturn (<EmptyStateicon={<UserCircle2 />}- title={t("profile_view.header_unnamed")}+ title={t("profile_view.unavailable_title")}description={t("profile_view.no_user_hint")}actions={<Button size="sm" variant="outline" onClick={onRetry}>@@ -207,7 +209,7 @@ function ProfileErrorState({ error, onRetry }: { error: Error; onRetry: () => vo}return (- <div className="flex items-start gap-3 rounded-lg border border-destructive/20 bg-destructive/[0.12] p-5">+ <div className="flex items-start gap-3 rounded-xl border border-destructive/20 bg-destructive/[0.12] p-5"><AlertTriangle aria-hidden className="mt-0.5 h-4 w-4 shrink-0 text-destructive" /><div className="min-w-0 flex-1"><p className="text-base font-medium text-foreground-strong">diff --git a/jarvis/ui/web/frontend/src/views/profile/AvatarButton.tsx b/jarvis/ui/web/frontend/src/views/profile/AvatarButton.tsxindex eef27f78ed..ee1ba702b1 100644--- a/jarvis/ui/web/frontend/src/views/profile/AvatarButton.tsx+++ b/jarvis/ui/web/frontend/src/views/profile/AvatarButton.tsx@@ -27,8 +27,8 @@ export function AvatarButton({}: {name: string | null;hasAvatar: boolean;- /** `lg` is the dossier header; `md` keeps the old 56 px for anywhere else. */- size?: "md" | "lg";+ /** `xl` is the profile header; `md` keeps the old 56 px for anywhere else. */+ size?: "md" | "lg" | "xl";}) {const t = useT();const queryClient = useQueryClient();@@ -77,7 +77,7 @@ export function AvatarButton({};const busy = upload.isPending || remove.isPending;- const box = size === "lg" ? "h-16 w-16" : "h-14 w-14";+ const box = size === "xl" ? "h-20 w-20" : size === "lg" ? "h-16 w-16" : "h-14 w-14";const title = hasAvatar ? t("profile_view.avatar_change") : t("profile_view.avatar_upload");return (@@ -111,6 +111,7 @@ export function AvatarButton({size="lg"src={hasAvatar ? `/api/profile/avatar?t=${bust}` : null}alt={t("profile_view.avatar_alt")}+ className={size === "xl" ? "h-full w-full text-2xl" : undefined}/>) : hasAvatar ? (<img@@ -120,7 +121,7 @@ export function AvatarButton({draggable={false}/>) : (- <UserCircle2 aria-hidden className="h-6 w-6 text-muted-foreground" />+ <UserCircle2 aria-hidden className={cn("text-muted-foreground", size === "xl" ? "h-9 w-9" : "h-6 w-6")} />)}<span className="pointer-events-none absolute inset-0 flex items-center justify-center rounded-full bg-scrim/70 opacity-0 transition-opacity duration-200 group-hover/avatar:opacity-100 group-focus-visible/avatar:opacity-100">diff --git a/jarvis/ui/web/frontend/src/views/profile/DossierHeader.tsx b/jarvis/ui/web/frontend/src/views/profile/DossierHeader.tsxdeleted file mode 100644index 35cf1bfe48..0000000000--- a/jarvis/ui/web/frontend/src/views/profile/DossierHeader.tsx+++ /dev/null@@ -1,99 +0,0 @@-/**- * The cover line of the file.- *- * A dossier opens by naming its subject, not by reporting how complete it is.- * So the name is the largest thing on the screen, the line under it is only- * facts that actually exist (a missing timezone leaves no gap and no dash),- * and the count sits quietly on the right in the mono face the rest of the- * page uses for anything countable.- *- * The old header led with "Who are you? · First impressions" over a progress- * bar — a question and a score, neither of which is information about the- * reader. What replaced it is the first line of the record itself.- */-import { useMemo } from "react";-import { CalendarDays } from "lucide-react";--import { useBoardSummary } from "@/hooks/useBoard";-import { useT } from "@/i18n";-import { AvatarButton } from "@/views/profile/AvatarButton";-import { clusterDataOf, type ProfileResponse } from "@/views/profile/api";-import {- TOTAL_FIELDS,- countFilled,- displayAddress,- isEmptyValue,-} from "@/views/profile/ledger";--/** A YYYY-MM-DD or ISO stamp as a short local date; null when unparseable. */-function shortDate(value: unknown): string | null {- if (typeof value !== "string" || !value.trim()) return null;- const d = new Date(value);- if (Number.isNaN(d.getTime())) return null;- return d.toLocaleDateString(undefined, { day: "numeric", month: "short", year: "numeric" });-}--export function DossierHeader({- data,- meta,-}: {- data: ProfileResponse;- meta: Record<string, unknown>;-}) {- const t = useT();- const board = useBoardSummary();-- const name = data.user.name?.trim() || null;- const address = displayAddress(meta, name);- const filled = useMemo(() => countFilled(meta), [meta]);-- const identity = clusterDataOf(meta, "identity");- const since = shortDate(board.data?.totals.first_day);- const sessions = board.data?.totals.session_count ?? 0;- const updated = shortDate(meta["last_updated"]);-- // Only what is known appears. A dossier line with three dashes in it is the- // form we are getting away from.- const facts: string[] = [];- if (!isEmptyValue(identity["primary_language"])) facts.push(String(identity["primary_language"]));- if (!isEmptyValue(identity["timezone"])) facts.push(String(identity["timezone"]));- if (since) facts.push(t("profile_view.header_since").replace("{0}", since));- if (sessions > 0) {- facts.push(t("profile_view.header_conversations").replace("{0}", String(sessions)));- }-- return (- <header- data-testid="dossier-header"- className="profile-rise flex flex-wrap items-center gap-x-5 gap-y-3 border-b border-border pb-5"- >- <AvatarButton name={name} hasAvatar={!!data.has_avatar} size="lg" />-- <div className="min-w-0 flex-1 basis-72">- <h2 className="truncate font-display text-display text-foreground-strong">- {address ?? t("profile_view.header_unnamed")}- </h2>- <p className="mt-1 truncate text-meta text-muted-foreground">- {facts.length ? facts.join(" · ") : t("profile_view.header_nothing_yet")}- </p>- </div>-- <div className="flex shrink-0 flex-col items-end gap-1">- <span- data-testid="dossier-count"- className="font-mono text-meta tabular-nums text-foreground"- >- {t("profile_view.header_entries")- .replace("{0}", String(filled))- .replace("{1}", String(TOTAL_FIELDS))}- </span>- {updated && (- <span className="flex items-center gap-1.5 text-micro text-foreground-faint">- <CalendarDays aria-hidden className="h-3 w-3" />- {t("profile_view.header_updated").replace("{0}", updated)}- </span>- )}- </div>- </header>- );-}diff --git a/jarvis/ui/web/frontend/src/views/profile/EntryLedger.tsx b/jarvis/ui/web/frontend/src/views/profile/EntryLedger.tsxdeleted file mode 100644index b011ff72d7..0000000000--- a/jarvis/ui/web/frontend/src/views/profile/EntryLedger.tsx+++ /dev/null@@ -1,148 +0,0 @@-/**- * The entries — one file, five sections, and the gaps folded away.- *- * The old ledger listed all eighteen fields in five separate cards on the- * argument that "a blank field is as informative as a written one". On a- * profile the assistant has barely started, that produced sixteen rows of the- * same three words and five cards with nothing in the bottom two thirds. The- * page reported its own emptiness in more detail than it reported the reader.- *- * So: known facts are entries, and unknown fields collapse into one line per- * section that opens on click. The count stays visible on every section, so- * nothing is hidden — it is folded, and folding is what a file does with- * pages nobody has written yet.- *- * One card rather than five, because five boxes read as a dashboard and this- * is a document.- */-import { useState } from "react";-import { ChevronDown } from "lucide-react";--import { Badge } from "@/components/ui/badge";-import { Card } from "@/components/ui/card";-import { useT } from "@/i18n";-import { cn } from "@/lib/utils";-import { clusterDataOf } from "@/views/profile/api";-import { EntryRow } from "@/views/profile/EntryRow";-import {- CLUSTER_FIELD_KEYS,- CLUSTER_ORDER,- clusterFilledCount,- isEmptyValue,- type ClusterId,-} from "@/views/profile/ledger";-import { historyFor, latestFor, type Observation } from "@/views/profile/provenance";--export function EntryLedger({- meta,- observations,-}: {- meta: Record<string, unknown>;- observations: readonly Observation[];-}) {- return (- <Card className="profile-rise divide-y divide-border">- {CLUSTER_ORDER.map((cid, i) => (- <ClusterSection- key={cid}- cid={cid}- meta={meta}- observations={observations}- delayMs={60 + i * 40}- />- ))}- </Card>- );-}--function ClusterSection({- cid,- meta,- observations,- delayMs,-}: {- cid: ClusterId;- meta: Record<string, unknown>;- observations: readonly Observation[];- delayMs: number;-}) {- const t = useT();- const [showGaps, setShowGaps] = useState(false);-- const data = clusterDataOf(meta, cid);- const fields = CLUSTER_FIELD_KEYS[cid];- const filled = clusterFilledCount(meta, cid);- const complete = filled === fields.length;-- const known = fields.filter((key) => !isEmptyValue(data[key]));- const gaps = fields.filter((key) => isEmptyValue(data[key]));-- const countLabel = t("profile_view.group_filled")- .replace("{0}", String(filled))- .replace("{1}", String(fields.length));-- const row = (key: string) => (- <EntryRow- key={key}- cid={cid}- fieldKey={key}- value={data[key]}- latest={latestFor(observations, cid, key)}- history={historyFor(observations, cid, key)}- />- );-- return (- <section- className="profile-rise px-5 py-4"- style={{ animationDelay: `${delayMs}ms` }}- aria-label={t(`profile_view.clusters.${cid}.label`)}- >- <div className="flex items-center justify-between gap-3">- <h3 className="text-title font-semibold text-foreground-strong">- {t(`profile_view.clusters.${cid}.label`)}- </h3>- <Badge- variant={complete ? "success" : "secondary"}- aria-label={countLabel}- title={countLabel}- className="tabular-nums"- >- {filled}/{fields.length}- </Badge>- </div>-- {/* The rows keep a measure while the section header spans the card: a- fact set 1200 px wide has its two ends a hand-span apart, and the- empty right side then reads as margin rather than as a hole. */}- <div className="mt-2 max-w-reading">- {known.map(row)}-- {gaps.length > 0 && (- <>- {showGaps && <div className="mt-1">{gaps.map(row)}</div>}- <button- type="button"- onClick={() => setShowGaps((v) => !v)}- aria-expanded={showGaps}- data-testid={`gaps-${cid}`}- className={cn(- "-mx-2 mt-1 flex w-[calc(100%+1rem)] items-center gap-1.5 rounded-md px-2 py-1.5",- "text-meta text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground",- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",- )}- >- <ChevronDown- aria-hidden- className={cn("h-3.5 w-3.5 transition-transform", showGaps && "rotate-180")}- />- {showGaps- ? t("profile_view.gaps_hide")- : t("profile_view.gaps_show").replace("{0}", String(gaps.length))}- </button>- </>- )}- </div>- </section>- );-}diff --git a/jarvis/ui/web/frontend/src/views/profile/EntryRow.tsx b/jarvis/ui/web/frontend/src/views/profile/EntryRow.tsxdeleted file mode 100644index 33cc04c7f5..0000000000--- a/jarvis/ui/web/frontend/src/views/profile/EntryRow.tsx+++ /dev/null@@ -1,351 +0,0 @@-/**- * One entry in the file — the value, where it came from, and the editor.- *- * The disclosure is the point of the whole section. Every fact the assistant- * holds was written by one of three writers, each of which appends an audit- * line to USER.md saying what it wrote and which sentence it took it from- * (see provenance.ts). Opening a row shows that sentence. It is the only- * honest answer to "how do you know that about me?", and until now it was on- * disk with nothing reading it.- *- * The three editor shapes — text, a yes/no pair, removable chips — are lifted- * from the old KnowledgeLedger unchanged. They were right: the shape follows- * the field kind, and the field kind is pinned against the backend's- * _LIST_FIELDS / _BOOL_FIELDS by a parity test.- */-import { useEffect, useRef, useState } from "react";-import { Check, ChevronDown, Pencil, Plus, Quote, Trash2, X } from "lucide-react";--import { Badge } from "@/components/ui/badge";-import { Button } from "@/components/ui/button";-import { Input } from "@/components/ui/input";-import { useT } from "@/i18n";-import { cn } from "@/lib/utils";-import { useEventStore } from "@/store/events";-import { renderValue, useFieldEdit, type FieldOp } from "@/views/profile/api";-import { fieldKind, isEmptyValue, type ClusterId } from "@/views/profile/ledger";-import type { Observation } from "@/views/profile/provenance";--/** A 32 px square icon control, sized for a 40 px row. */-function RowIconButton({- icon: Icon,- onClick,- title,- variant = "ghost",- disabled,-}: {- icon: typeof Check;- onClick: () => void;- title: string;- variant?: "default" | "ghost" | "outline";- disabled?: boolean;-}) {- return (- <Button- type="button"- variant={variant}- size="icon"- className="h-8 w-8 shrink-0"- onClick={onClick}- title={title}- aria-label={title}- disabled={disabled}- >- <Icon />- </Button>- );-}--export function EntryRow({- cid,- fieldKey,- value,- latest,- history,-}: {- cid: ClusterId;- fieldKey: string;- value: unknown;- /** The audit line that explains the value on screen, if there is one. */- latest: Observation | null;- /** Every audit line for this field, oldest first. */- history: readonly Observation[];-}) {- const t = useT();- const pushToast = useEventStore((s) => s.pushToast);- const edit = useFieldEdit();- const kind = fieldKind(fieldKey);- const empty = isEmptyValue(value);- const label = t(`profile_view.fields.${fieldKey}`);-- const [editing, setEditing] = useState(false);- const [open, setOpen] = useState(false);- const [draft, setDraft] = useState("");- const inputRef = useRef<HTMLInputElement | null>(null);-- useEffect(() => {- if (editing) inputRef.current?.focus();- }, [editing]);-- const busy = edit.isPending;-- const startEdit = () => {- setDraft(kind === "scalar" && !empty ? String(value) : "");- setEditing(true);- };- const cancel = () => {- setDraft("");- setEditing(false);- };- const mutate = (- operation: FieldOp,- v?: unknown,- opts?: { keepOpen?: boolean; clearDraft?: boolean },- ) => {- edit.mutate(- { cluster: cid, field: fieldKey, operation, value: v },- {- onSuccess: () => {- pushToast("success", t("profile_view.field_saved"));- if (opts?.clearDraft) setDraft("");- if (opts?.keepOpen) inputRef.current?.focus();- else cancel();- },- },- );- };-- const saveScalar = () => {- const v = draft.trim();- if (v) mutate("set", v);- else mutate("clear");- };- const addItem = () => {- const v = draft.trim();- if (v) mutate("append", v, { keepOpen: true, clearDraft: true });- };-- // ------------------------------------------------------------------ editing- if (editing) {- return (- <div className="-mx-2 rounded-md bg-secondary px-2 py-2">- <p className="text-body font-medium text-foreground-strong">{label}</p>- <div className="mt-2">- {kind === "bool" ? (- <div className="flex flex-wrap items-center gap-2">- {([true, false] as const).map((b) => (- <Button- key={String(b)}- type="button"- size="sm"- variant={value === b ? "default" : "outline"}- disabled={busy}- onClick={() => mutate("set", b)}- >- {b ? t("profile_view.value_yes") : t("profile_view.value_no")}- </Button>- ))}- <span className="ml-auto flex items-center gap-1">- <RowIconButton- icon={X}- onClick={cancel}- title={t("profile_view.raw_cancel")}- disabled={busy}- />- {!empty && (- <RowIconButton- icon={Trash2}- onClick={() => mutate("clear")}- title={t("profile_view.field_clear")}- disabled={busy}- />- )}- </span>- </div>- ) : kind === "list" ? (- <div className="flex flex-col gap-2">- {!empty && (- <div className="flex flex-wrap gap-1">- {(value as unknown[]).map((item) => (- <Badge key={String(item)} variant="outline" className="pr-1 text-foreground">- {String(item)}- <button- type="button"- disabled={busy}- onClick={() => mutate("remove", String(item), { keepOpen: true })}- title={t("profile_view.field_remove_item")}- aria-label={`${t("profile_view.field_remove_item")}: ${String(item)}`}- className="rounded-sm p-0.5 text-muted-foreground transition-colors hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50"- >- <X aria-hidden className="h-3 w-3" />- </button>- </Badge>- ))}- </div>- )}- <div className="flex items-center gap-1">- <Input- ref={inputRef}- value={draft}- disabled={busy}- onChange={(e) => setDraft(e.target.value)}- onKeyDown={(e) => {- if (e.key === "Enter") addItem();- if (e.key === "Escape") cancel();- }}- placeholder={t("profile_view.field_add_placeholder")}- className="h-8"- />- <RowIconButton- icon={Plus}- onClick={addItem}- title={t("profile_view.field_add")}- variant="default"- disabled={busy}- />- <RowIconButton- icon={Check}- onClick={cancel}- title={t("profile_view.raw_save")}- disabled={busy}- />- {!empty && (- <RowIconButton- icon={Trash2}- onClick={() => mutate("clear")}- title={t("profile_view.field_clear")}- disabled={busy}- />- )}- </div>- </div>- ) : (- <div className="flex items-center gap-1">- <Input- ref={inputRef}- value={draft}- disabled={busy}- onChange={(e) => setDraft(e.target.value)}- onKeyDown={(e) => {- if (e.key === "Enter") saveScalar();- if (e.key === "Escape") cancel();- }}- placeholder={t("profile_view.field_value_placeholder")}- className="h-8"- />- <RowIconButton- icon={Check}- onClick={saveScalar}- title={t("profile_view.raw_save")}- variant="default"- disabled={busy}- />- <RowIconButton- icon={X}- onClick={cancel}- title={t("profile_view.raw_cancel")}- disabled={busy}- />- {!empty && (- <RowIconButton- icon={Trash2}- onClick={() => mutate("clear")}- title={t("profile_view.field_clear")}- disabled={busy}- />- )}- </div>- )}- </div>- </div>- );- }-- // ------------------------------------------------------------------ resting- const hasSource = latest !== null;-- return (- <div className="-mx-2">- {/* A file reads in columns: the field name in a fixed measure, the value- set immediately beside it. Pushing the value to the far edge of a- 1200 px card left the two ends of a fact a hand-span apart. */}- <div className="group grid min-h-10 grid-cols-[minmax(7rem,11rem)_minmax(0,1fr)_auto] items-center gap-3 rounded-md px-2 py-1 transition-colors hover:bg-secondary">- <span className="truncate text-body text-muted-foreground" title={label}>- {label}- </span>-- <span className="flex min-w-0 items-center gap-2">- {kind === "list" && !empty ? (- <span className="flex min-w-0 flex-wrap gap-1">- {(value as unknown[]).map((item) => (- <Badge key={String(item)} variant="secondary" className="text-foreground">- {String(item)}- </Badge>- ))}- </span>- ) : empty ? (- <span className="text-body text-foreground-faint">- {t("profile_view.field_unknown")}- </span>- ) : (- <span className="text-body text-foreground [overflow-wrap:anywhere]">- {renderValue(t, value)}- </span>- )}- </span>-- <span className="flex shrink-0 items-center gap-1">- {/* The signature: the date is a button, and the button is the file's- receipt for this line. No provenance means no marker — never an- invented one for a fact that predates the audit trail. */}- {hasSource && (- <button- type="button"- onClick={() => setOpen((v) => !v)}- aria-expanded={open}- data-testid={`entry-source-${fieldKey}`}- title={t("profile_view.source_show")}- className="flex shrink-0 items-center gap-0.5 rounded-sm px-1 font-mono text-micro tabular-nums text-foreground-faint transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"- >- {latest.date}- <ChevronDown- aria-hidden- className={cn("h-3 w-3 transition-transform", open && "rotate-180")}- />- </button>- )}-- <Button- type="button"- variant="ghost"- size="icon"- onClick={startEdit}- title={t("profile_view.field_edit")}- aria-label={`${t("profile_view.field_edit")}: ${label}`}- className="h-8 w-8 shrink-0 text-muted-foreground opacity-0 transition-opacity focus-visible:opacity-100 group-hover:opacity-100"- >- {empty ? <Plus /> : <Pencil />}- </Button>- </span>- </div>-- {open && hasSource && (- <div className="mb-1 ml-2 mr-2 rounded-md border-l-2 border-border-strong bg-secondary/60 px-3 py-2">- {latest.evidence ? (- <p className="flex gap-2 text-meta italic text-foreground">- <Quote aria-hidden className="mt-0.5 h-3 w-3 shrink-0 text-muted-foreground" />- <span className="[overflow-wrap:anywhere]">{latest.evidence}</span>- </p>- ) : (- <p className="text-meta text-muted-foreground">{t("profile_view.source_no_quote")}</p>- )}- <p className="mt-1.5 font-mono text-micro text-foreground-faint">- {t("profile_view.source_learned").replace("{0}", latest.date)}- {history.length > 1 &&- ` · ${t("profile_view.source_revisions").replace("{0}", String(history.length))}`}- </p>- </div>- )}- </div>- );-}diff --git a/jarvis/ui/web/frontend/src/views/profile/FieldGroup.tsx b/jarvis/ui/web/frontend/src/views/profile/FieldGroup.tsxnew file mode 100644index 0000000000..ed60d8b55d--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/profile/FieldGroup.tsx@@ -0,0 +1,93 @@+/**+ * One group of profile details — the known ones as rows, the missing ones as+ * a single line of "add" chips.+ *+ * A profile the assistant has barely started has sixteen empty fields. Listing+ * them as sixteen rows of "not set" makes the page a report on its own+ * emptiness; hiding them behind an "open fields" fold makes them impossible+ * to find. So every missing detail is one small chip at the foot of its group,+ * named, one click from its editor, and taking no more room than a sentence.+ */+import { useState } from "react";+import { Plus } from "lucide-react";++import { useT } from "@/i18n";+import { clusterDataOf } from "@/views/profile/api";+import { FieldRow } from "@/views/profile/FieldRow";+import { ProfileGroup } from "@/views/profile/ProfileGroup";+import { isEmptyValue, type FieldRef, type GroupId } from "@/views/profile/ledger";+import { historyFor, latestFor, type Observation } from "@/views/profile/provenance";++export function FieldGroup({+ id,+ fields,+ meta,+ observations,+}: {+ id: GroupId;+ fields: readonly FieldRef[];+ meta: Record<string, unknown>;+ observations: readonly Observation[];+}) {+ const t = useT();+ // The missing detail whose editor is open, if any. It renders as a row+ // until it is saved (then it is simply known) or closed.+ const [adding, setAdding] = useState<string | null>(null);++ const valueOf = (ref: FieldRef) => clusterDataOf(meta, ref.cid)[ref.field];+ const known = fields.filter((ref) => !isEmptyValue(valueOf(ref)));+ const missing = fields.filter((ref) => isEmptyValue(valueOf(ref)));+ const addingRef = missing.find((ref) => ref.field === adding) ?? null;+ const chips = missing.filter((ref) => ref.field !== adding);++ const row = (ref: FieldRef, initiallyEditing = false) => (+ <FieldRow+ key={ref.field}+ cid={ref.cid}+ field={ref.field}+ value={valueOf(ref)}+ latest={latestFor(observations, ref.cid, ref.field)}+ history={historyFor(observations, ref.cid, ref.field)}+ initiallyEditing={initiallyEditing}+ onClose={initiallyEditing ? () => setAdding(null) : undefined}+ />+ );++ return (+ <ProfileGroup+ testId={`group-${id}`}+ title={t(`profile_view.groups.${id}.title`)}+ description={t(`profile_view.groups.${id}.description`)}+ aside={+ <span className="font-mono text-sm tabular-nums text-muted-foreground">+ {known.length}/{fields.length}+ </span>+ }+ >+ {known.map((ref) => row(ref))}+ {addingRef && row(addingRef, true)}++ {chips.length > 0 && (+ <div data-testid={`missing-${id}`} className="px-5 py-4">+ {known.length === 0 && !addingRef && (+ <p className="mb-3 text-base text-muted-foreground">{t("profile_view.group_empty")}</p>+ )}+ <div className="flex flex-wrap items-center gap-1.5">+ <span className="mr-1 text-sm text-muted-foreground">{t("profile_view.add_label")}</span>+ {chips.map((ref) => (+ <button+ key={ref.field}+ type="button"+ onClick={() => setAdding(ref.field)}+ className="inline-flex items-center gap-1 rounded-full border border-border px-2.5 py-1 text-sm text-foreground transition-colors hover:border-border-strong hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"+ >+ <Plus aria-hidden className="h-3 w-3 text-muted-foreground" />+ {t(`profile_view.fields.${ref.field}`)}+ </button>+ ))}+ </div>+ </div>+ )}+ </ProfileGroup>+ );+}diff --git a/jarvis/ui/web/frontend/src/views/profile/FieldRow.tsx b/jarvis/ui/web/frontend/src/views/profile/FieldRow.tsxnew file mode 100644index 0000000000..23d7ce6a5a--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/profile/FieldRow.tsx@@ -0,0 +1,424 @@+/**+ * One profile detail: the value, where it came from, and its editor.+ *+ * Resting, a row is a label on the left and the value on the right — the+ * shape every settings list uses. Under the label sits the receipt: the date+ * the audit trail recorded the fact (see provenance.ts), and on click the+ * sentence it was taken from. A fact the trail never mentions shows no date+ * at all rather than an invented one.+ *+ * The editor follows the field's shape: a closed vocabulary is a segmented+ * control, a 1–5 scale is five steps, a yes/no is two buttons, a list is+ * removable chips plus suggestions, anything else is one text input. Picking+ * a choice saves at once; typed text saves on Enter. The shapes are pinned+ * against the backend's _LIST_FIELDS / _BOOL_FIELDS by a parity test.+ */+import { useEffect, useRef, useState } from "react";+import { Check, Pencil, Plus, Quote, X } from "lucide-react";++import { Button } from "@/components/ui/button";+import { Input } from "@/components/ui/input";+import { useT } from "@/i18n";+import { cn } from "@/lib/utils";+import { useEventStore } from "@/store/events";+import { useFieldEdit, type FieldOp } from "@/views/profile/api";+import {+ CHOICE_FIELDS,+ LIST_SUGGESTIONS,+ SCALE_FIELDS,+ fieldKind,+ isEmptyValue,+ scaleValue,+ type ClusterId,+} from "@/views/profile/ledger";+import type { Observation } from "@/views/profile/provenance";++type T = (key: string) => string;++/** A YYYY-MM-DD stamp as a readable local date. */+export function readableDate(iso: string): string {+ const d = new Date(`${iso}T12:00:00`);+ if (Number.isNaN(d.getTime())) return iso;+ return d.toLocaleDateString(undefined, { day: "numeric", month: "short", year: "numeric" });+}++/** The label a choice value shows, or the raw value when it is off-vocabulary. */+function choiceLabel(t: T, field: string, value: string): string {+ return CHOICE_FIELDS[field]?.includes(value) ? t(`profile_view.choices.${field}.${value}`) : value;+}++function ScaleMeter({ value }: { value: number }) {+ return (+ <span aria-hidden className="flex items-center gap-0.5">+ {[1, 2, 3, 4, 5].map((step) => (+ <span+ key={step}+ className={cn("h-2.5 w-1.5 rounded-full", step <= value ? "bg-accent" : "bg-foreground/15")}+ />+ ))}+ </span>+ );+}++/** The resting value, right-aligned in the row. */+function ValueView({ field, value }: { field: string; value: unknown }) {+ const t = useT();+ const kind = fieldKind(field);++ if (kind === "list") {+ return (+ <span className="flex flex-wrap justify-end gap-1">+ {(value as unknown[]).map((item) => (+ <span+ key={String(item)}+ className="rounded-md border border-border bg-secondary px-2 py-0.5 text-sm text-foreground"+ >+ {choiceLabel(t, field, String(item))}+ </span>+ ))}+ </span>+ );+ }+ if (kind === "bool") {+ return (+ <span className="text-base text-foreground">+ {value ? t("profile_view.value_yes") : t("profile_view.value_no")}+ </span>+ );+ }+ if (SCALE_FIELDS.has(field)) {+ const n = scaleValue(value);+ if (n !== null) {+ return (+ <span className="flex items-center gap-2.5 text-base text-foreground">+ <ScaleMeter value={n} />+ <span className="font-mono text-sm tabular-nums">{n}/5</span>+ </span>+ );+ }+ }+ return (+ <span className="text-right text-base text-foreground [overflow-wrap:anywhere]">+ {choiceLabel(t, field, String(value))}+ </span>+ );+}++/** One option in a segmented control. */+function Segment({+ active,+ disabled,+ onClick,+ children,+}: {+ active: boolean;+ disabled: boolean;+ onClick: () => void;+ children: React.ReactNode;+}) {+ return (+ <button+ type="button"+ role="radio"+ aria-checked={active}+ disabled={disabled}+ onClick={onClick}+ className={cn(+ "min-w-10 flex-1 rounded-md px-3 py-1.5 text-sm font-medium transition-colors",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",+ active+ ? "bg-card text-foreground-strong shadow-sm ring-1 ring-border"+ : "text-muted-foreground hover:text-foreground",+ )}+ >+ {children}+ </button>+ );+}++export function FieldRow({+ cid,+ field,+ value,+ latest,+ history,+ initiallyEditing = false,+ onClose,+}: {+ cid: ClusterId;+ field: string;+ value: unknown;+ /** The audit line that explains the value on screen, if there is one. */+ latest: Observation | null;+ /** Every audit line for this field, oldest first. */+ history: readonly Observation[];+ /** Open straight into the editor — used when a missing detail is added. */+ initiallyEditing?: boolean;+ /** Called when the editor closes. */+ onClose?: () => void;+}) {+ const t = useT();+ const pushToast = useEventStore((s) => s.pushToast);+ const edit = useFieldEdit();+ const kind = fieldKind(field);+ const empty = isEmptyValue(value);+ const label = t(`profile_view.fields.${field}`);++ const [editing, setEditing] = useState(initiallyEditing);+ const [showSource, setShowSource] = useState(false);+ const [draft, setDraft] = useState(kind === "scalar" && !empty ? String(value) : "");+ const inputRef = useRef<HTMLInputElement | null>(null);+ const busy = edit.isPending;++ useEffect(() => {+ if (editing) inputRef.current?.focus();+ }, [editing]);++ const open = () => {+ setDraft(kind === "scalar" && !empty ? String(value) : "");+ setEditing(true);+ };+ const close = () => {+ setEditing(false);+ setDraft("");+ onClose?.();+ };++ const mutate = (operation: FieldOp, v?: unknown, opts?: { keepOpen?: boolean }) => {+ edit.mutate(+ { cluster: cid, field, operation, value: v },+ {+ onSuccess: () => {+ pushToast("success", t("profile_view.field_saved"));+ if (opts?.keepOpen) {+ setDraft("");+ inputRef.current?.focus();+ } else {+ close();+ }+ },+ },+ );+ };++ const saveText = () => {+ const v = draft.trim();+ if (v) mutate("set", v);+ else if (!empty) mutate("clear");+ else close();+ };+ const addItem = (item: string) => {+ const v = item.trim();+ if (v) mutate("append", v, { keepOpen: true });+ };++ // ------------------------------------------------------------------ editing+ if (editing) {+ const choices = CHOICE_FIELDS[field];+ const items = kind === "list" && !empty ? (value as unknown[]).map(String) : [];+ const suggestions = (LIST_SUGGESTIONS[field] ?? []).filter((s) => !items.includes(s));+ const scaleHint = SCALE_FIELDS.has(field) ? t(`profile_view.scale_hint.${field}`) : null;++ let editor: React.ReactNode;+ if (choices || SCALE_FIELDS.has(field) || kind === "bool") {+ const options: { key: string; value: unknown; label: string }[] = choices+ ? choices.map((c) => ({ key: c, value: c, label: t(`profile_view.choices.${field}.${c}`) }))+ : kind === "bool"+ ? [+ { key: "yes", value: true, label: t("profile_view.value_yes") },+ { key: "no", value: false, label: t("profile_view.value_no") },+ ]+ : [1, 2, 3, 4, 5].map((n) => ({ key: String(n), value: n, label: String(n) }));+ const current = SCALE_FIELDS.has(field) ? scaleValue(value) : value;+ editor = (+ <div+ role="radiogroup"+ aria-label={label}+ className="flex w-full flex-wrap gap-1 rounded-lg bg-secondary p-1"+ >+ {options.map((o) => (+ <Segment+ key={o.key}+ active={current === o.value}+ disabled={busy}+ onClick={() => mutate("set", o.value)}+ >+ {o.label}+ </Segment>+ ))}+ </div>+ );+ } else if (kind === "list") {+ editor = (+ <div className="flex flex-col gap-3">+ {items.length > 0 && (+ <div className="flex flex-wrap gap-1.5">+ {items.map((item) => (+ <span+ key={item}+ className="inline-flex items-center gap-1 rounded-md border border-border bg-secondary py-0.5 pl-2 pr-1 text-sm text-foreground"+ >+ {choiceLabel(t, field, item)}+ <button+ type="button"+ disabled={busy}+ onClick={() => mutate("remove", item, { keepOpen: true })}+ aria-label={`${t("profile_view.field_remove_item")}: ${item}`}+ className="rounded-sm p-0.5 text-muted-foreground transition-colors hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"+ >+ <X aria-hidden className="h-3 w-3" />+ </button>+ </span>+ ))}+ </div>+ )}+ <div className="flex items-center gap-2">+ <Input+ ref={inputRef}+ value={draft}+ disabled={busy}+ onChange={(e) => setDraft(e.target.value)}+ onKeyDown={(e) => {+ if (e.key === "Enter") addItem(draft);+ if (e.key === "Escape") close();+ }}+ placeholder={t("profile_view.field_add_placeholder")}+ aria-label={label}+ className="h-9"+ />+ <Button type="button" size="sm" variant="secondary" disabled={busy || !draft.trim()} onClick={() => addItem(draft)}>+ <Plus aria-hidden />+ {t("profile_view.field_add")}+ </Button>+ </div>+ {suggestions.length > 0 && (+ <div className="flex flex-wrap gap-1.5">+ {suggestions.map((s) => (+ <button+ key={s}+ type="button"+ disabled={busy}+ onClick={() => addItem(s)}+ className="inline-flex items-center gap-1 rounded-md border border-dashed border-border px-2 py-0.5 text-sm text-muted-foreground transition-colors hover:border-border-strong hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"+ >+ <Plus aria-hidden className="h-3 w-3" />+ {choiceLabel(t, field, s)}+ </button>+ ))}+ </div>+ )}+ </div>+ );+ } else {+ editor = (+ <Input+ ref={inputRef}+ value={draft}+ disabled={busy}+ onChange={(e) => setDraft(e.target.value)}+ onKeyDown={(e) => {+ if (e.key === "Enter") saveText();+ if (e.key === "Escape") close();+ }}+ placeholder={t("profile_view.field_value_placeholder")}+ aria-label={label}+ className="h-9"+ />+ );+ }++ return (+ <div data-testid={`field-${field}`} className="bg-secondary/40 px-5 py-4">+ <div className="flex items-baseline justify-between gap-4">+ <p className="text-base font-medium text-foreground-strong">{label}</p>+ {scaleHint && <p className="text-sm text-muted-foreground">{scaleHint}</p>}+ </div>+ <div className="mt-3">{editor}</div>+ <div className="mt-3 flex items-center justify-between gap-2">+ {!empty ? (+ <Button+ type="button"+ size="sm"+ variant="ghost"+ className="text-muted-foreground hover:text-destructive"+ disabled={busy}+ onClick={() => mutate("clear")}+ >+ {t("profile_view.field_clear")}+ </Button>+ ) : (+ <span />+ )}+ <span className="flex items-center gap-2">+ <Button type="button" size="sm" variant="ghost" disabled={busy} onClick={close}>+ {kind === "scalar" ? t("profile_view.raw_cancel") : t("profile_view.field_done")}+ </Button>+ {kind === "scalar" && (+ <Button type="button" size="sm" disabled={busy} onClick={saveText}>+ <Check aria-hidden />+ {t("profile_view.raw_save")}+ </Button>+ )}+ </span>+ </div>+ </div>+ );+ }++ // ------------------------------------------------------------------ resting+ return (+ <div data-testid={`field-${field}`} className="group px-5 py-3.5 transition-colors hover:bg-secondary/40">+ <div className="flex items-center justify-between gap-6">+ <div className="min-w-0">+ <p className="text-base font-medium text-foreground">{label}</p>+ {latest && (+ <button+ type="button"+ onClick={() => setShowSource((v) => !v)}+ aria-expanded={showSource}+ data-testid={`entry-source-${field}`}+ title={t("profile_view.source_show")}+ className="mt-0.5 flex max-w-full items-center gap-1 rounded-sm text-left text-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"+ >+ <span className="truncate">+ {t("profile_view.source_learned").replace("{0}", readableDate(latest.date))}+ </span>+ </button>+ )}+ </div>+ <div className="flex min-w-0 items-center gap-2">+ <ValueView field={field} value={value} />+ <Button+ type="button"+ variant="ghost"+ size="icon"+ onClick={open}+ title={t("profile_view.field_edit")}+ aria-label={`${t("profile_view.field_edit")}: ${label}`}+ className="h-8 w-8 shrink-0 text-muted-foreground opacity-0 transition-opacity focus-visible:opacity-100 group-hover:opacity-100"+ >+ <Pencil />+ </Button>+ </div>+ </div>++ {showSource && latest && (+ <div className="mt-3 rounded-lg border border-border bg-background/60 px-3.5 py-2.5">+ {latest.evidence ? (+ <p className="flex gap-2 text-sm text-foreground">+ <Quote aria-hidden className="mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" />+ <span className="[overflow-wrap:anywhere]">{latest.evidence}</span>+ </p>+ ) : (+ <p className="text-sm text-muted-foreground">{t("profile_view.source_no_quote")}</p>+ )}+ {history.length > 1 && (+ <p className="mt-1.5 text-xs text-muted-foreground">+ {t("profile_view.source_revisions").replace("{0}", String(history.length))}+ </p>+ )}+ </div>+ )}+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/views/profile/MemorySection.tsx b/jarvis/ui/web/frontend/src/views/profile/MemorySection.tsxnew file mode 100644index 0000000000..59d39e6e9e--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/profile/MemorySection.tsx@@ -0,0 +1,215 @@+/**+ * Memory and privacy — where the rest of what the assistant knows lives, and+ * what it will never keep.+ *+ * Four rows, each pointing at a real source:+ * - your standing rules ({name}.md), edited in their own section;+ * - the wiki's long-form page about you, when the vault has one (the slug+ * comes from your name, so a nameless profile asks for nothing);+ * - the profile file itself, USER.md, which opens in place;+ * - the `## Do Not Record` categories, quoted from that file rather than+ * restated in code, so the page can never promise more than the file says.+ */+import { useQuery } from "@tanstack/react-query";+import { ChevronRight, FileText, NotebookPen, ScrollText, ShieldCheck } from "lucide-react";+import type { ReactNode } from "react";++import { Button } from "@/components/ui/button";+import { useAgentInstructions } from "@/hooks/useAgentInstructions";+import { useT } from "@/i18n";+import { useEventStore } from "@/store/events";+import { ProfileGroup, SettingRow } from "@/views/profile/ProfileGroup";+import { parseDoNotRecord, shortenCategory } from "@/views/profile/provenance";++interface WikiPage {+ ok: boolean;+ slug: string;+ title: string;+ body_md: string;+ wikilinks: string[];+ stats?: { words?: number };+}++/**+ * The vault's own slug rules: lowercase, diacritics folded, everything that is+ * not a letter or digit becomes a dash. "Renee Dubois" -> "renee-dubois".+ */+export function wikiSlug(name: string | null | undefined): string | null {+ if (!name) return null;+ const slug = name+ .normalize("NFD")+ .replace(/[̀-ͯ]/g, "") // combining marks, after NFD+ .toLowerCase()+ .replace(/[^a-z0-9]+/g, "-")+ .replace(/^-+|-+$/g, "");+ return slug || null;+}++/** Bullet lines under a `## Facts` heading — what the page actually asserts. */+function countFacts(bodyMd: string): number {+ const at = bodyMd.search(/^##\s+Facts\s*$/im);+ if (at < 0) return 0;+ const after = bodyMd.slice(at);+ const next = after.search(/\n##\s+/);+ const section = next > 0 ? after.slice(0, next) : after;+ return section.split("\n").filter((l) => /^-\s+\S/.test(l.trim())).length;+}++function RowLabel({ icon, children }: { icon: ReactNode; children: ReactNode }) {+ return (+ <span className="flex items-center gap-2.5">+ <span aria-hidden className="text-muted-foreground [&>svg]:h-4 [&>svg]:w-4">+ {icon}+ </span>+ {children}+ </span>+ );+}++/** Hints line up under the label text, past the icon. */+const HINT_INDENT = "pl-[1.625rem]";++export function MemorySection({+ name,+ raw,+ fileUpdatedMs,+ onOpenSource,+}: {+ name: string | null;+ raw: string | null;+ fileUpdatedMs: number | null;+ onOpenSource: () => void;+}) {+ const t = useT();+ const setActiveSection = useEventStore((s) => s.setActiveSection);+ const rules = useAgentInstructions();+ const slug = wikiSlug(name);+ const categories = parseDoNotRecord(raw);++ const wiki = useQuery<WikiPage, Error>({+ queryKey: ["profile", "wiki-page", slug],+ enabled: !!slug,+ retry: false,+ staleTime: 60_000,+ queryFn: async () => {+ const res = await fetch(`/api/wiki/page/${encodeURIComponent(slug as string)}`);+ if (!res.ok) throw new Error(`HTTP ${res.status}`);+ return res.json();+ },+ });++ const rulesContent = rules.config?.content?.trim() ?? "";+ const hasRules = !!rules.config?.exists && rulesContent.length > 0;+ const ruleLines = hasRules ? rulesContent.split("\n").filter((l) => l.trim()).length : 0;+ const rulesFile = rules.config?.filename ?? "";++ const page = wiki.data?.ok ? wiki.data : null;+ const facts = page ? countFacts(page.body_md ?? "") : 0;+ const wikiHint = page+ ? [+ `${page.slug}.md`,+ facts > 0 ? t("profile_view.wiki_facts").replace("{0}", String(facts)) : null,+ page.wikilinks.length > 0+ ? t("profile_view.wiki_links").replace("{0}", String(page.wikilinks.length))+ : null,+ ]+ .filter(Boolean)+ .join(" · ")+ : slug+ ? t("profile_view.wiki_empty_body")+ : t("profile_view.wiki_needs_name");++ const fileDate = fileUpdatedMs+ ? new Date(fileUpdatedMs).toLocaleDateString(undefined, {+ day: "numeric",+ month: "short",+ year: "numeric",+ })+ : null;++ return (+ <ProfileGroup+ testId="memory"+ title={t("profile_view.memory_title")}+ description={t("profile_view.memory_description")}+ >+ <SettingRow+ testId="rules-row"+ label={<RowLabel icon={<ScrollText />}>{t("profile_view.rules_title")}</RowLabel>}+ hint={+ <span className={HINT_INDENT}>+ {rules.loading+ ? "…"+ : hasRules+ ? t("profile_view.rules_open").replace("{0}", String(ruleLines)).replace("{1}", rulesFile)+ : t("profile_view.rules_empty_body")}+ </span>+ }+ control={+ <Button+ type="button"+ size="sm"+ variant="outline"+ onClick={() => setActiveSection("agent-instructions")}+ >+ {hasRules ? t("profile_view.open") : t("profile_view.rules_write")}+ </Button>+ }+ />++ <SettingRow+ testId="wiki-row"+ label={<RowLabel icon={<NotebookPen />}>{t("profile_view.wiki_title")}</RowLabel>}+ hint={+ <span className={HINT_INDENT} data-testid={page ? "wiki-found" : "wiki-empty"}>+ {wiki.isLoading ? "…" : wikiHint}+ </span>+ }+ control={+ page ? (+ <Button type="button" size="sm" variant="outline" onClick={() => setActiveSection("memory")}>+ {t("profile_view.open")}+ </Button>+ ) : undefined+ }+ />++ <SettingRow+ testId="source-row"+ label={<RowLabel icon={<FileText />}>{t("profile_view.file_title")}</RowLabel>}+ hint={+ <span className={HINT_INDENT}>+ {fileDate+ ? t("profile_view.file_hint_dated").replace("{0}", fileDate)+ : t("profile_view.file_hint")}+ </span>+ }+ control={+ <Button type="button" size="sm" variant="outline" onClick={onOpenSource}>+ {t("profile_view.file_open")}+ <ChevronRight aria-hidden />+ </Button>+ }+ />++ {categories.length > 0 && (+ <SettingRow+ label={<RowLabel icon={<ShieldCheck />}>{t("profile_view.never_title")}</RowLabel>}+ hint={<span className={HINT_INDENT}>{t("profile_view.never_body")}</span>}+ >+ <ul data-testid="never-stored" className={`mt-3 flex flex-wrap gap-1.5 ${HINT_INDENT}`}>+ {categories.map((c) => (+ <li+ key={c}+ title={c}+ className="rounded-md border border-border bg-secondary px-2 py-0.5 text-sm text-foreground"+ >+ {shortenCategory(c)}+ </li>+ ))}+ </ul>+ </SettingRow>+ )}+ </ProfileGroup>+ );+}diff --git a/jarvis/ui/web/frontend/src/views/profile/NeverStoredCard.tsx b/jarvis/ui/web/frontend/src/views/profile/NeverStoredCard.tsxdeleted file mode 100644index 99649171a7..0000000000--- a/jarvis/ui/web/frontend/src/views/profile/NeverStoredCard.tsx+++ /dev/null@@ -1,50 +0,0 @@-/**- * The categories the assistant refuses to hold.- *- * A file about a person is only trustworthy if it says what it will not- * contain, and this one does — `## Do Not Record` has been in USER.md from- * the beginning, enforced by `_DO_NOT_RECORD` in- * `jarvis/plugins/tool/profile_update.py`, and shown to the reader nowhere.- *- * Quoted from the file rather than restated in code, so the page can never- * promise something the file no longer says. Neutral, not `fault`: a- * boundary the product keeps on purpose is not an error state.- */-import { ShieldCheck } from "lucide-react";--import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";-import { useT } from "@/i18n";-import { parseDoNotRecord, shortenCategory } from "@/views/profile/provenance";--export function NeverStoredCard({ raw }: { raw: string | null | undefined }) {- const t = useT();- const categories = parseDoNotRecord(raw);-- if (categories.length === 0) return null;-- return (- <Card className="profile-rise">- <CardHeader className="pb-2">- <CardTitle className="flex items-center gap-2">- <ShieldCheck aria-hidden className="h-4 w-4 text-muted-foreground" />- {t("profile_view.never_title")}- </CardTitle>- </CardHeader>- <CardContent>- <p className="text-meta text-muted-foreground">{t("profile_view.never_body")}</p>- <ul data-testid="never-stored" className="mt-3 flex flex-col gap-1.5">- {categories.map((c) => (- <li- key={c}- title={c}- className="flex items-baseline gap-2 text-body text-foreground [overflow-wrap:anywhere]"- >- <span aria-hidden className="mt-1.5 h-1 w-1 shrink-0 rounded-full bg-muted-foreground" />- {shortenCategory(c)}- </li>- ))}- </ul>- </CardContent>- </Card>- );-}diff --git a/jarvis/ui/web/frontend/src/views/profile/PortraitCard.tsx b/jarvis/ui/web/frontend/src/views/profile/PortraitCard.tsxdeleted file mode 100644index bfdb9db524..0000000000--- a/jarvis/ui/web/frontend/src/views/profile/PortraitCard.tsx+++ /dev/null@@ -1,140 +0,0 @@-/**- * What the assistant would say about you if asked.- *- * `GET /api/board/bio` has held an LLM-written prose portrait of the user —- * generated from board statistics, awareness episodes, mission history and- * the memory file — since it was built, with a three-way feedback loop that- * calibrates the next generation. Nothing in the product rendered it. On a- * page whose whole subject is "what does it know about me", it is the single- * most direct answer available, so it opens the rail.- *- * The feedback is not a rating. It is the one signal that changes how the- * next portrait is written, which is why the buttons say what they do to the- * text rather than how the reader feels about it.- */-import { Loader2, RefreshCw, Sparkles } from "lucide-react";--import { Button } from "@/components/ui/button";-import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";-import { useBio, useBioFeedback, useBioRegenerate, type BioFeedbackKind } from "@/hooks/useBoard";-import { useT } from "@/i18n";-import { useEventStore } from "@/store/events";--/**- * The three signals the backend accepts. The strings are API contract values,- * matched by name in `jarvis/board/profile.py` — they are not display text and- * never reach the screen; the labels beside them come from the locale.- */-const FEEDBACK: { kind: BioFeedbackKind; labelKey: string }[] = [- { kind: "trifft", labelKey: "profile_view.portrait_fits" }, // i18n-allow: API contract value- { kind: "trifft_nicht", labelKey: "profile_view.portrait_misses" }, // i18n-allow: API contract value- { kind: "haerter", labelKey: "profile_view.portrait_harder" }, // i18n-allow: API contract value-];--export function PortraitCard() {- const t = useT();- const pushToast = useEventStore((s) => s.pushToast);- const bio = useBio();- const regenerate = useBioRegenerate();- const feedback = useBioFeedback();-- const text = bio.data?.text?.trim() || null;- const generatedAt = bio.data?.generated_at ?? null;-- const sendFeedback = (kind: BioFeedbackKind) => {- if (!generatedAt) return;- feedback.mutate(- { bio_generated_at: generatedAt, kind },- {- onSuccess: () => pushToast("success", t("profile_view.portrait_thanks")),- onError: (err: Error) => pushToast("error", err.message),- },- );- };-- const write = () =>- regenerate.mutate(- {},- {- onSuccess: () => pushToast("success", t("profile_view.portrait_written")),- onError: (err: Error) => pushToast("error", err.message),- },- );-- return (- <Card className="profile-rise">- <CardHeader className="flex-row items-center justify-between gap-3 pb-2">- <CardTitle className="flex items-center gap-2">- <Sparkles aria-hidden className="h-4 w-4 text-muted-foreground" />- {t("profile_view.portrait_title")}- </CardTitle>- {text && (- <Button- type="button"- size="icon"- variant="ghost"- className="h-8 w-8 text-muted-foreground"- onClick={write}- disabled={regenerate.isPending}- title={t("profile_view.portrait_rewrite")}- aria-label={t("profile_view.portrait_rewrite")}- >- {regenerate.isPending ? <Loader2 className="animate-spin" /> : <RefreshCw />}- </Button>- )}- </CardHeader>-- <CardContent>- {bio.isLoading ? (- <div role="status" aria-busy="true" className="flex flex-col gap-2">- <div className="h-3 w-full animate-pulse rounded-full bg-sheen/[0.06]" />- <div className="h-3 w-11/12 animate-pulse rounded-full bg-sheen/[0.06]" />- <div className="h-3 w-4/6 animate-pulse rounded-full bg-sheen/[0.06]" />- </div>- ) : text ? (- <>- <p- data-testid="portrait-text"- className="text-reading text-foreground [overflow-wrap:anywhere]"- >- {text}- </p>- <div className="mt-4 flex flex-wrap gap-2">- {FEEDBACK.map((f) => (- <Button- key={f.kind}- type="button"- size="sm"- variant="outline"- disabled={feedback.isPending || !generatedAt}- onClick={() => sendFeedback(f.kind)}- >- {t(f.labelKey)}- </Button>- ))}- </div>- </>- ) : (- // Not a failure: the portrait is written on demand and this box has- // never been asked. So it asks.- <div data-testid="portrait-empty">- <p className="text-body text-muted-foreground">- {t("profile_view.portrait_empty_body")}- </p>- <Button- type="button"- size="sm"- variant="outline"- className="mt-3"- onClick={write}- disabled={regenerate.isPending}- >- {regenerate.isPending ? <Loader2 className="animate-spin" /> : <Sparkles />}- {t("profile_view.portrait_write")}- </Button>- </div>- )}- </CardContent>- </Card>- );-}diff --git a/jarvis/ui/web/frontend/src/views/profile/PortraitSection.tsx b/jarvis/ui/web/frontend/src/views/profile/PortraitSection.tsxnew file mode 100644index 0000000000..5890b13ea2--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/profile/PortraitSection.tsx@@ -0,0 +1,153 @@+/**+ * How the assistant would describe you — the written portrait.+ *+ * `GET /api/board/bio` holds an LLM-written paragraph drawn from activity,+ * memory and past conversations, with a three-way feedback loop that steers+ * the next one. The feedback buttons say what they do to the next text, not+ * how the reader feels.+ *+ * A stored portrait that stops mid-word (an older generator kept a reply the+ * model never finished) is not shown as if it were the portrait: the page+ * says it was cut off and offers a new one.+ */+import { Loader2, RefreshCw, Sparkles } from "lucide-react";++import { Button } from "@/components/ui/button";+import { useBio, useBioFeedback, useBioRegenerate, type BioFeedbackKind } from "@/hooks/useBoard";+import { useT } from "@/i18n";+import { useEventStore } from "@/store/events";+import { ProfileGroup } from "@/views/profile/ProfileGroup";++/**+ * The three signals the backend accepts. The strings are API contract values,+ * matched by name in `jarvis/board/profile.py` — they are not display text and+ * never reach the screen; the labels beside them come from the locale.+ */+const FEEDBACK: { kind: BioFeedbackKind; labelKey: string }[] = [+ { kind: "trifft", labelKey: "profile_view.portrait_fits" }, // i18n-allow: API contract value+ { kind: "trifft_nicht", labelKey: "profile_view.portrait_misses" }, // i18n-allow: API contract value+ { kind: "haerter", labelKey: "profile_view.portrait_harder" }, // i18n-allow: API contract value+];++/** True when the text ends like a finished sentence. */+export function isFinishedText(text: string): boolean {+ return /[.!?…"'”»)\]]$/.test(text.trim());+}++export function PortraitSection() {+ const t = useT();+ const pushToast = useEventStore((s) => s.pushToast);+ const bio = useBio();+ const regenerate = useBioRegenerate();+ const feedback = useBioFeedback();++ const text = bio.data?.text?.trim() || null;+ const generatedAt = bio.data?.generated_at ?? null;+ const cutOff = !!text && !isFinishedText(text);+ const written = generatedAt+ ? new Date(generatedAt).toLocaleDateString(undefined, {+ day: "numeric",+ month: "short",+ year: "numeric",+ })+ : null;++ const sendFeedback = (kind: BioFeedbackKind) => {+ if (!generatedAt) return;+ feedback.mutate(+ { bio_generated_at: generatedAt, kind },+ {+ onSuccess: () => pushToast("success", t("profile_view.portrait_thanks")),+ onError: (err: Error) => pushToast("error", err.message),+ },+ );+ };++ const write = () =>+ regenerate.mutate(+ {},+ {+ onSuccess: () => pushToast("success", t("profile_view.portrait_written")),+ onError: (err: Error) => pushToast("error", err.message),+ },+ );++ const writeButton = (label: string) => (+ <Button type="button" size="sm" variant="outline" onClick={write} disabled={regenerate.isPending}>+ {regenerate.isPending ? <Loader2 className="animate-spin" /> : <Sparkles />}+ {label}+ </Button>+ );++ return (+ <ProfileGroup+ testId="portrait"+ title={t("profile_view.portrait_title")}+ description={t("profile_view.portrait_description")}+ aside={+ text && !cutOff ? (+ <Button+ type="button"+ size="sm"+ variant="ghost"+ className="text-muted-foreground"+ onClick={write}+ disabled={regenerate.isPending}+ >+ {regenerate.isPending ? <Loader2 className="animate-spin" /> : <RefreshCw />}+ {t("profile_view.portrait_rewrite")}+ </Button>+ ) : null+ }+ >+ <div className="px-6 py-5">+ {bio.isLoading ? (+ <div role="status" aria-busy="true" className="flex flex-col gap-2.5">+ <div className="h-3.5 w-full animate-pulse rounded-full bg-secondary" />+ <div className="h-3.5 w-11/12 animate-pulse rounded-full bg-secondary" />+ <div className="h-3.5 w-3/5 animate-pulse rounded-full bg-secondary" />+ </div>+ ) : text && !cutOff ? (+ <>+ <blockquote+ data-testid="portrait-text"+ className="border-l-2 border-accent pl-4 text-lg leading-relaxed text-foreground [overflow-wrap:anywhere]"+ >+ {text}+ </blockquote>+ <div className="mt-5 flex flex-wrap items-center justify-between gap-3">+ <p className="text-sm text-muted-foreground">+ {written && t("profile_view.portrait_written_on").replace("{0}", written)}+ </p>+ <div className="flex flex-wrap items-center gap-2">+ <span className="text-sm text-muted-foreground">{t("profile_view.portrait_ask")}</span>+ {FEEDBACK.map((f) => (+ <Button+ key={f.kind}+ type="button"+ size="sm"+ variant="outline"+ disabled={feedback.isPending || !generatedAt}+ onClick={() => sendFeedback(f.kind)}+ >+ {t(f.labelKey)}+ </Button>+ ))}+ </div>+ </div>+ </>+ ) : (+ <div+ data-testid={cutOff ? "portrait-cut-off" : "portrait-empty"}+ className="flex flex-wrap items-center justify-between gap-4"+ >+ <p className="max-w-prose text-base text-muted-foreground">+ {cutOff ? t("profile_view.portrait_cut_off") : t("profile_view.portrait_empty_body")}+ </p>+ {writeButton(cutOff ? t("profile_view.portrait_rewrite") : t("profile_view.portrait_write"))}+ </div>+ )}+ </div>+ </ProfileGroup>+ );+}diff --git a/jarvis/ui/web/frontend/src/views/profile/ProfileGroup.tsx b/jarvis/ui/web/frontend/src/views/profile/ProfileGroup.tsxnew file mode 100644index 0000000000..606614b1a0--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/profile/ProfileGroup.tsx@@ -0,0 +1,72 @@+/**+ * The two layout primitives every part of the Profile page is built from.+ *+ * `ProfileGroup` is a titled block: a heading and one plain sentence above a+ * single bordered list. `SettingRow` is one line inside it: a label and an+ * explanation on the left, the value or the action on the right. The same+ * row grammar the rest of the Settings hub uses (Appshots, Pets), so the+ * profile reads as part of the product rather than as a dashboard of cards.+ */+import type { ReactNode } from "react";++import { cn } from "@/lib/utils";++export function ProfileGroup({+ title,+ description,+ aside,+ children,+ testId,+ className,+}: {+ title: string;+ description?: string;+ /** Right-aligned beside the heading — a count or one quiet action. */+ aside?: ReactNode;+ children: ReactNode;+ testId?: string;+ className?: string;+}) {+ return (+ <section data-testid={testId} aria-label={title} className={cn("flex flex-col gap-3", className)}>+ <div className="flex items-end justify-between gap-4 px-1">+ <div className="min-w-0">+ <h2 className="text-lg font-semibold text-foreground-strong">{title}</h2>+ {description && <p className="mt-0.5 text-base text-muted-foreground">{description}</p>}+ </div>+ {aside && <div className="shrink-0">{aside}</div>}+ </div>+ <div className="divide-y divide-border overflow-hidden rounded-xl border border-border bg-card">+ {children}+ </div>+ </section>+ );+}++export function SettingRow({+ label,+ hint,+ control,+ children,+ testId,+}: {+ label: ReactNode;+ hint?: ReactNode;+ control?: ReactNode;+ /** Content that spans the full row width under the label line. */+ children?: ReactNode;+ testId?: string;+}) {+ return (+ <div data-testid={testId} className="px-5 py-4">+ <div className="flex items-center justify-between gap-6">+ <div className="min-w-0">+ <div className="text-base font-medium text-foreground">{label}</div>+ {hint && <div className="mt-0.5 text-sm text-muted-foreground">{hint}</div>}+ </div>+ {control && <div className="flex shrink-0 items-center gap-2">{control}</div>}+ </div>+ {children}+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/views/profile/ProfileHero.tsx b/jarvis/ui/web/frontend/src/views/profile/ProfileHero.tsxnew file mode 100644index 0000000000..bdd97f52f8--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/profile/ProfileHero.tsx@@ -0,0 +1,195 @@+/**+ * The top of the profile: who this is, and four plain numbers.+ *+ * The photo is the upload control. The name is the largest text on the page;+ * when the file has no name yet, that same spot is a one-field form, because+ * "No name on file" is a fact about the database while "What should we call+ * you?" is the one thing the reader can fix in a second.+ *+ * The line under the name only holds facts that exist — no dashes for gaps.+ * The strip below is four figures from real sources (the activity board and+ * the file's own count). A figure that has not loaded shows a skeleton, never+ * a zero, because a zero reads as a fact.+ */+import { useMemo, useState } from "react";+import { Check, Pencil } from "lucide-react";++import { Button } from "@/components/ui/button";+import { Input } from "@/components/ui/input";+import { useBoardSummary } from "@/hooks/useBoard";+import { useT, useUiLanguage } from "@/i18n";+import { useEventStore } from "@/store/events";+import { AvatarButton } from "@/views/profile/AvatarButton";+import { clusterDataOf, useFieldEdit, type ProfileResponse } from "@/views/profile/api";+import { TOTAL_FIELDS, countFilled, daysSince, isEmptyValue } from "@/views/profile/ledger";++/** A date stamp as a short local date; null when unparseable. */+function shortDate(value: unknown): string | null {+ if (typeof value !== "string" || !value.trim()) return null;+ const d = new Date(value);+ if (Number.isNaN(d.getTime())) return null;+ return d.toLocaleDateString(undefined, { day: "numeric", month: "short", year: "numeric" });+}++/** "de" → "German" in the interface language; the code itself when unknown. */+function languageName(code: string, ui: string): string {+ try {+ return new Intl.DisplayNames([ui], { type: "language" }).of(code) ?? code;+ } catch {+ // Intl rejects malformed tags; the raw value is the honest fallback.+ return code;+ }+}++function Stat({ label, value, sub }: { label: string; value: string | null; sub?: string | null }) {+ return (+ <div className="min-w-0 px-5 py-4">+ <p className="text-sm text-muted-foreground">{label}</p>+ {value === null ? (+ <div className="mt-1.5 h-5 w-20 animate-pulse rounded-md bg-secondary" />+ ) : (+ <p className="mt-0.5 truncate text-lg font-semibold tabular-nums text-foreground-strong">+ {value}+ </p>+ )}+ {sub && <p className="truncate text-sm text-muted-foreground">{sub}</p>}+ </div>+ );+}++function NameForm({ onDone }: { onDone?: () => void }) {+ const t = useT();+ const pushToast = useEventStore((s) => s.pushToast);+ const edit = useFieldEdit();+ const [draft, setDraft] = useState("");++ const save = () => {+ const v = draft.trim();+ if (!v) return;+ edit.mutate(+ { cluster: "identity", field: "name", operation: "set", value: v },+ {+ onSuccess: () => {+ pushToast("success", t("profile_view.field_saved"));+ onDone?.();+ },+ },+ );+ };++ return (+ <form+ className="mt-2 flex max-w-sm items-center gap-2"+ onSubmit={(e) => {+ e.preventDefault();+ save();+ }}+ >+ <Input+ autoFocus+ value={draft}+ disabled={edit.isPending}+ onChange={(e) => setDraft(e.target.value)}+ onKeyDown={(e) => e.key === "Escape" && onDone?.()}+ placeholder={t("profile_view.name_placeholder")}+ aria-label={t("profile_view.fields.name")}+ className="h-9"+ />+ <Button type="submit" size="sm" disabled={edit.isPending || !draft.trim()}>+ <Check aria-hidden />+ {t("profile_view.raw_save")}+ </Button>+ </form>+ );+}++export function ProfileHero({+ data,+ meta,+}: {+ data: ProfileResponse;+ meta: Record<string, unknown>;+}) {+ const t = useT();+ const ui = useUiLanguage();+ const board = useBoardSummary();+ const [renaming, setRenaming] = useState(false);++ const identity = clusterDataOf(meta, "identity");+ const name = data.user.name?.trim() || null;+ const preferred =+ typeof identity["preferred_address"] === "string" ? identity["preferred_address"].trim() : "";+ const filled = useMemo(() => countFilled(meta), [meta]);++ const facts: string[] = [];+ if (preferred && preferred !== name) {+ facts.push(t("profile_view.hero_called").replace("{0}", preferred));+ }+ if (!isEmptyValue(identity["primary_language"])) {+ facts.push(languageName(String(identity["primary_language"]), ui));+ }+ if (!isEmptyValue(identity["timezone"])) facts.push(String(identity["timezone"]));++ const totals = board.data?.totals;+ const since = totals ? shortDate(totals.first_day) : null;+ const days = totals ? daysSince(totals.first_day) : null;+ const updated = shortDate(meta["last_updated"]);++ return (+ <section+ data-testid="profile-hero"+ className="overflow-hidden rounded-xl border border-border bg-card"+ >+ <div className="flex items-center gap-5 p-6">+ <AvatarButton name={name} hasAvatar={!!data.has_avatar} size="xl" />++ <div className="min-w-0 flex-1">+ {name && !renaming ? (+ <div className="group flex items-center gap-1">+ <h2 className="truncate text-2xl font-semibold text-foreground-strong">{name}</h2>+ <Button+ type="button"+ variant="ghost"+ size="icon"+ onClick={() => setRenaming(true)}+ title={t("profile_view.field_edit")}+ aria-label={`${t("profile_view.field_edit")}: ${t("profile_view.fields.name")}`}+ className="h-8 w-8 shrink-0 text-muted-foreground opacity-0 transition-opacity focus-visible:opacity-100 group-hover:opacity-100"+ >+ <Pencil />+ </Button>+ </div>+ ) : (+ <>+ <h2 className="text-xl font-semibold text-foreground-strong">+ {name ? t("profile_view.fields.name") : t("profile_view.hero_ask_name")}+ </h2>+ <NameForm onDone={name ? () => setRenaming(false) : undefined} />+ </>+ )}+ {facts.length > 0 && !renaming && (+ <p className="mt-1 truncate text-base text-muted-foreground">{facts.join(" · ")}</p>+ )}+ </div>+ </div>++ <div className="grid grid-cols-2 border-t border-border sm:grid-cols-4 [&>*]:border-border [&>*:nth-child(even)]:border-l sm:[&>*:not(:first-child)]:border-l [&>*:nth-child(n+3)]:border-t sm:[&>*:nth-child(n+3)]:border-t-0">+ <Stat+ label={t("profile_view.stat_since")}+ value={board.isLoading ? null : (since ?? "–")}+ sub={days !== null ? t("profile_view.stat_days").replace("{0}", String(days)) : null}+ />+ <Stat+ label={t("profile_view.stat_conversations")}+ value={board.isLoading ? null : totals ? totals.session_count.toLocaleString() : "–"}+ />+ <Stat+ label={t("profile_view.stat_known")}+ value={`${filled} / ${TOTAL_FIELDS}`}+ sub={t("profile_view.stat_known_sub")}+ />+ <Stat label={t("profile_view.stat_updated")} value={updated ?? "–"} />+ </div>+ </section>+ );+}diff --git a/jarvis/ui/web/frontend/src/views/profile/RulesCard.tsx b/jarvis/ui/web/frontend/src/views/profile/RulesCard.tsxdeleted file mode 100644index e4338106b3..0000000000--- a/jarvis/ui/web/frontend/src/views/profile/RulesCard.tsx+++ /dev/null@@ -1,92 +0,0 @@-/**- * Your standing instructions to the assistant.- *- * These live in their own section and are edited there. They appear here- * because they belong to the same question the page answers: the profile is- * what the assistant worked out about you, and this is what you told it- * outright. Showing the first lines beside the inferred facts is the only- * place in the product where both halves of the record are visible at once.- *- * Read-only on purpose — one editor per file, and this file's editor is the- * section this card links to.- */-import { ArrowRight, ScrollText } from "lucide-react";--import { Button } from "@/components/ui/button";-import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";-import { useAgentInstructions } from "@/hooks/useAgentInstructions";-import { useT } from "@/i18n";-import { useEventStore } from "@/store/events";--/** The opening of the file: enough to recognise, never the whole document. */-function excerpt(content: string, maxLines = 4, maxChars = 220): string {- const lines = content- .split("\n")- .map((l) => l.trim())- .filter((l) => l && !l.startsWith("#"));- const head = lines.slice(0, maxLines).join(" ");- return head.length > maxChars ? `${head.slice(0, maxChars).trimEnd()}…` : head;-}--export function RulesCard() {- const t = useT();- const setActiveSection = useEventStore((s) => s.setActiveSection);- const { config, loading } = useAgentInstructions();-- const content = config?.content?.trim() ?? "";- const has = !!config?.exists && content.length > 0;- const lineCount = has ? content.split("\n").filter((l) => l.trim()).length : 0;-- return (- <Card className="profile-rise">- <CardHeader className="pb-2">- <CardTitle className="flex items-center gap-2">- <ScrollText aria-hidden className="h-4 w-4 text-muted-foreground" />- {t("profile_view.rules_title")}- </CardTitle>- </CardHeader>-- <CardContent>- {loading ? (- <div role="status" aria-busy="true" className="flex flex-col gap-2">- <div className="h-3 w-full animate-pulse rounded-full bg-sheen/[0.06]" />- <div className="h-3 w-3/4 animate-pulse rounded-full bg-sheen/[0.06]" />- </div>- ) : has ? (- <>- <blockquote- data-testid="rules-excerpt"- className="border-l-2 border-border-strong pl-3 text-meta italic text-foreground [overflow-wrap:anywhere]"- >- {excerpt(content)}- </blockquote>- <Button- type="button"- variant="link"- className="mt-3 px-0"- onClick={() => setActiveSection("agent-instructions")}- >- {t("profile_view.rules_open")- .replace("{0}", String(lineCount))- .replace("{1}", config?.filename ?? "")}- <ArrowRight />- </Button>- </>- ) : (- <div data-testid="rules-empty">- <p className="text-body text-muted-foreground">{t("profile_view.rules_empty_body")}</p>- <Button- type="button"- size="sm"- variant="outline"- className="mt-3"- onClick={() => setActiveSection("agent-instructions")}- >- {t("profile_view.rules_write")}- </Button>- </div>- )}- </CardContent>- </Card>- );-}diff --git a/jarvis/ui/web/frontend/src/views/profile/WikiCard.tsx b/jarvis/ui/web/frontend/src/views/profile/WikiCard.tsxdeleted file mode 100644index c692e6fb36..0000000000--- a/jarvis/ui/web/frontend/src/views/profile/WikiCard.tsx+++ /dev/null@@ -1,131 +0,0 @@-/**- * The long-form page the wiki keeps about you.- *- * The profile front matter holds eighteen short fields; the vault holds a- * written entity page — summary, facts, relationships, and dated sources for- * each one — built by the wiki consolidator from actual conversations. It is- * by a wide margin the richest thing the system knows about the reader, and- * the profile section has never linked to it.- *- * Best-effort by design: the slug is derived from the user's name, so a- * profile with no name asks for nothing and a vault with no such page shows- * the invitation instead of an error. A 404 here is a state, not a fault.- */-import { useQuery } from "@tanstack/react-query";-import { ArrowRight, NotebookPen } from "lucide-react";--import { Button } from "@/components/ui/button";-import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";-import { useT } from "@/i18n";-import { useEventStore } from "@/store/events";--interface WikiPage {- ok: boolean;- slug: string;- title: string;- body_md: string;- wikilinks: string[];- stats?: { words?: number };-}--/**- * The vault's own slug rules: lowercase, diacritics folded, everything that is- * not a letter or digit becomes a dash. "Renee Dubois" -> "renee-dubois".- */-export function wikiSlug(name: string | null | undefined): string | null {- if (!name) return null;- const slug = name- .normalize("NFD")- .replace(/[\u0300-\u036f]/g, "") // combining marks, after NFD- .toLowerCase()- .replace(/[^a-z0-9]+/g, "-")- .replace(/^-+|-+$/g, "");- return slug || null;-}--/** Bullet lines under a `## Facts` heading — what the page actually asserts. */-function countFacts(bodyMd: string): number {- const at = bodyMd.search(/^##\s+Facts\s*$/im);- if (at < 0) return 0;- const after = bodyMd.slice(at);- const next = after.search(/\n##\s+/);- const section = next > 0 ? after.slice(0, next) : after;- return section.split("\n").filter((l) => /^-\s+\S/.test(l.trim())).length;-}--export function WikiCard({ name }: { name: string | null }) {- const t = useT();- const setActiveSection = useEventStore((s) => s.setActiveSection);- const slug = wikiSlug(name);-- const page = useQuery<WikiPage, Error>({- queryKey: ["profile", "wiki-page", slug],- enabled: !!slug,- retry: false,- staleTime: 60_000,- queryFn: async () => {- const res = await fetch(`/api/wiki/page/${encodeURIComponent(slug as string)}`);- if (!res.ok) throw new Error(`HTTP ${res.status}`);- return res.json();- },- });-- const found = page.data?.ok ? page.data : null;- const facts = found ? countFacts(found.body_md ?? "") : 0;-- return (- <Card className="profile-rise">- <CardHeader className="pb-2">- <CardTitle className="flex items-center gap-2">- <NotebookPen aria-hidden className="h-4 w-4 text-muted-foreground" />- {t("profile_view.wiki_title")}- </CardTitle>- </CardHeader>-- <CardContent>- {page.isLoading ? (- <div role="status" aria-busy="true" className="flex flex-col gap-2">- <div className="h-3 w-2/3 animate-pulse rounded-full bg-sheen/[0.06]" />- <div className="h-3 w-1/2 animate-pulse rounded-full bg-sheen/[0.06]" />- </div>- ) : found ? (- <>- <p className="font-mono text-meta text-foreground" data-testid="wiki-slug">- {found.slug}.md- </p>- <ul className="mt-2 flex flex-col gap-1 text-meta text-muted-foreground">- {facts > 0 && (- <li className="tabular-nums">- {t("profile_view.wiki_facts").replace("{0}", String(facts))}- </li>- )}- {found.wikilinks.length > 0 && (- <li className="tabular-nums">- {t("profile_view.wiki_links").replace("{0}", String(found.wikilinks.length))}- </li>- )}- {!!found.stats?.words && (- <li className="tabular-nums">- {t("profile_view.wiki_words").replace("{0}", String(found.stats.words))}- </li>- )}- </ul>- <Button- type="button"- variant="link"- className="mt-3 px-0"- onClick={() => setActiveSection("memory")}- >- {t("profile_view.wiki_open")}- <ArrowRight />- </Button>- </>- ) : (- <p data-testid="wiki-empty" className="text-body text-muted-foreground">- {slug ? t("profile_view.wiki_empty_body") : t("profile_view.wiki_needs_name")}- </p>- )}- </CardContent>- </Card>- );-}diff --git a/jarvis/ui/web/frontend/src/views/profile/ledger.ts b/jarvis/ui/web/frontend/src/views/profile/ledger.tsindex ed6ab7c6b8..e1224ecc50 100644--- a/jarvis/ui/web/frontend/src/views/profile/ledger.ts+++ b/jarvis/ui/web/frontend/src/views/profile/ledger.ts@@ -145,3 +145,75 @@ export function displayAddress(return first ? first : null;}++// ----------------------------------------------------------------------+// Choice fields — the closed vocabularies the profile template documents+// ----------------------------------------------------------------------++/**+ * Fields whose value is one of a few words, as written in the USER.md+ * template comments. The editor offers them as a segmented control; a value+ * outside the list (the curator wrote free text) still renders verbatim and+ * stays editable, so nothing on disk is ever hidden by the vocabulary.+ */+export const CHOICE_FIELDS: Readonly<Record<string, readonly string[]>> = {+ verbosity: ["tldr", "normal", "deep-dive"],+ focus_mode: ["deep-work", "fragment", "mixed"],+ planning_horizon: ["now", "today", "week", "quarter"],+ feedback_pref: ["direct-correct", "suggest", "ask-then-act"],+};++/** 1–5 scales; the template defines both ends, the editor shows five steps. */+export const SCALE_FIELDS: ReadonlySet<string> = new Set(["directness", "formality"]);++/** Suggested chips for list fields whose template names a vocabulary. */+export const LIST_SUGGESTIONS: Readonly<Record<string, readonly string[]>> = {+ humor_types: ["dry", "nerdy", "sarcastic", "warm", "none"],+ motivations: ["mastery", "autonomy", "impact"],+};++/** A scale value as an integer 1–5, or null when it is not one. */+export function scaleValue(value: unknown): number | null {+ const n = typeof value === "number" ? value : Number(String(value ?? "").trim());+ return Number.isInteger(n) && n >= 1 && n <= 5 ? n : null;+}++// ----------------------------------------------------------------------+// Page groups — how the five clusters are presented+// ----------------------------------------------------------------------++export type GroupId = "about" | "talk" | "work" | "values";++export interface FieldRef {+ cid: ClusterId;+ field: string;+}++/**+ * Four groups a reader recognises, built from the five storage clusters.+ * Relationship holds a single field (how you like feedback), which belongs+ * with how you work; a section with one row reads as an accident.+ */+export const PAGE_GROUPS: readonly { id: GroupId; fields: readonly FieldRef[] }[] = [+ { id: "about", fields: CLUSTER_FIELD_KEYS.identity.map((field) => ({ cid: "identity", field })) },+ {+ id: "talk",+ fields: CLUSTER_FIELD_KEYS.communication.map((field) => ({ cid: "communication", field })),+ },+ {+ id: "work",+ fields: [+ ...CLUSTER_FIELD_KEYS.work_style.map((field) => ({ cid: "work_style" as const, field })),+ ...CLUSTER_FIELD_KEYS.relationship.map((field) => ({ cid: "relationship" as const, field })),+ ],+ },+ { id: "values", fields: CLUSTER_FIELD_KEYS.values.map((field) => ({ cid: "values", field })) },+];++/** Whole days between an ISO date and now; null when unparseable. */+export function daysSince(iso: unknown, now: Date = new Date()): number | null {+ if (typeof iso !== "string" || !iso.trim()) return null;+ const then = new Date(iso);+ if (Number.isNaN(then.getTime())) return null;+ return Math.max(0, Math.floor((now.getTime() - then.getTime()) / 86_400_000));+}diff --git a/tests/board/test_profile.py b/tests/board/test_profile.pyindex df676e5b5d..9bb6423b86 100644--- a/tests/board/test_profile.py+++ b/tests/board/test_profile.py@@ -318,6 +318,26 @@ async def test_empty_brain_response_does_not_persist(tmp_path: Path) -> None:assert BioStore(db).latest() is None+async def test_unfinished_reply_keeps_only_whole_sentences(tmp_path: Path) -> None:+ """A reply that stops mid-word must not become the stored portrait."""+ jsonl, db = _power_user_db(tmp_path)+ brain = FakeBrain("You build at night. Five tools a day, and while your Tool-")+ gen = _make_generator(brain, jsonl, db)+ result = await gen.generate_bio()+ assert result is not None+ assert result["text"] == "You build at night."+++async def test_fragment_without_any_sentence_keeps_old_bio(tmp_path: Path) -> None:+ jsonl, db = _power_user_db(tmp_path)+ fragment = FakeBrain("I have watched you for 34 days, and while your Tool-")+ gen = _make_generator(fragment, jsonl, db)+ assert await gen.generate_bio() is None+ assert BioStore(db).latest() is None++@pytest.mark.asyncioasync def test_no_resolver_returns_none(tmp_path: Path) -> None:jsonl, db = _power_user_db(tmp_path)