Skip to content

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.

feat(profile): fit the profile on one screen with a weekly activity chart

rubenluetke10-beepb1a37b052939
diff --git a/jarvis/memory/templates.py b/jarvis/memory/templates.py
index 1e78dab9a4..3350905646 100644
--- a/jarvis/memory/templates.py
+++ b/jarvis/memory/templates.py
@@ -45,6 +45,7 @@ identity:
timezone: Europe/Berlin
work_hours: null # "09:00-19:00" or open
devices: [] # "headset during the day", "speaker in the evening"
+ about: null # a short self-description in the user's own words
# ---- Cluster 2: Communication style (dynamic, calibrated) ----
communication:
diff --git a/jarvis/memory/user_profile.py b/jarvis/memory/user_profile.py
index 21af83b7c9..6a67a246f0 100644
--- a/jarvis/memory/user_profile.py
+++ b/jarvis/memory/user_profile.py
@@ -223,6 +223,8 @@ class UserProfile:
parts.append(f"- **Languages:** {', '.join(langs)} (Primary: {primary})")
if ident.get("timezone"):
parts.append(f"- **Timezone:** {ident['timezone']}")
+ if ident.get("about"):
+ parts.append(f"- **In their own words:** {ident['about']}")
# 2. Communication style — directly drives tone
comm = self._meta.get("communication", {}) or {}
diff --git a/jarvis/plugins/tool/profile_update.py b/jarvis/plugins/tool/profile_update.py
index fd5c6de558..b22036bbc1 100644
--- a/jarvis/plugins/tool/profile_update.py
+++ b/jarvis/plugins/tool/profile_update.py
@@ -51,7 +51,7 @@ log = logging.getLogger(__name__)
_CANONICAL_FIELDS: dict[str, frozenset[str]] = {
"identity": frozenset({
"name", "preferred_address", "pronouns", "primary_language",
- "languages", "timezone", "devices",
+ "languages", "timezone", "devices", "about",
}),
"communication": frozenset({
"directness", "formality", "verbosity", "humor_types", "emoji_ok",
@@ -139,7 +139,8 @@ class UpdateProfileTool:
"description": (
"Canonical field within the cluster. "
"identity: name, preferred_address, pronouns, primary_language, "
- "languages, timezone, devices. "
+ "languages, timezone, devices, about (a short self-description "
+ "in the user's own words; only when they dictate one). "
"communication: directness, formality, verbosity, humor_types, "
"emoji_ok. "
"work_style: focus_mode, planning_horizon. "
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 5bae868f8c..c3c4d1dad8 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -2041,6 +2041,35 @@
"stat_known": "Bekannte Details",
"stat_known_sub": "in deinem Profil",
"stat_updated": "Letzte Änderung",
+ "about_placeholder": "Ein, zwei Sätze über dich. {name} liest sie vor jeder Antwort.",
+ "hero_since": "seit {0}",
+ "stat_agent_runs": "Agent-Läufe",
+ "stat_longest_streak": "Längste Serie",
+ "stat_current_streak": "Aktuelle Serie",
+ "streak_running": "läuft",
+ "activity_title": "Aktivität",
+ "tab_all": "Alles",
+ "tab_voice": "Sprache",
+ "tab_chats": "Chats",
+ "tab_agents": "Agenten",
+ "unit_all": "Aktionen",
+ "unit_voice": "Sprach-Einsätze",
+ "unit_chats": "Nachrichten",
+ "unit_agents": "Agent-Läufe",
+ "activity_last7": "Letzte 7 Tage",
+ "delta_up": "+{0} % zur Woche davor",
+ "delta_down": "−{0} % zur Woche davor",
+ "delta_same": "wie die Woche davor",
+ "delta_new": "neu diese Woche",
+ "activity_avg_week": "Ø pro Woche",
+ "activity_top_day": "Stärkster Tag",
+ "activity_running": "läuft",
+ "activity_chart_label": "{0} pro Woche seit {1}",
+ "activity_empty": "Noch keine Aktivität. Das Diagramm füllt sich, sobald du {name} nutzt.",
+ "door_details_title": "Was {name} über dich weiß",
+ "door_details_sub": "{0} von {1} Details",
+ "door_memory_sub": "Regeln, Wiki-Seite und Profildatei",
+ "drawer_close": "Schließen",
"groups": {
"about": {
"title": "Über dich",
@@ -2109,6 +2138,7 @@
"languages": "Sprachen",
"timezone": "Zeitzone",
"devices": "Geräte",
+ "about": "Über dich",
"directness": "Direktheit",
"formality": "Förmlichkeit",
"verbosity": "Antwortlänge",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 4fc46264ef..5ff98adf9f 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -2074,6 +2074,35 @@
"stat_known": "Details known",
"stat_known_sub": "in your profile",
"stat_updated": "Last change",
+ "about_placeholder": "A sentence or two about you. {name} reads it before every answer.",
+ "hero_since": "since {0}",
+ "stat_agent_runs": "Agent runs",
+ "stat_longest_streak": "Longest streak",
+ "stat_current_streak": "Current streak",
+ "streak_running": "running",
+ "activity_title": "Activity",
+ "tab_all": "All",
+ "tab_voice": "Voice",
+ "tab_chats": "Chats",
+ "tab_agents": "Agents",
+ "unit_all": "actions",
+ "unit_voice": "voice uses",
+ "unit_chats": "messages",
+ "unit_agents": "agent runs",
+ "activity_last7": "Last 7 days",
+ "delta_up": "+{0} % on the week before",
+ "delta_down": "−{0} % on the week before",
+ "delta_same": "same as the week before",
+ "delta_new": "new this week",
+ "activity_avg_week": "Weekly avg.",
+ "activity_top_day": "Busiest day",
+ "activity_running": "in progress",
+ "activity_chart_label": "{0} per week since {1}",
+ "activity_empty": "No activity yet. The chart fills in as you use {name}.",
+ "door_details_title": "What {name} knows about you",
+ "door_details_sub": "{0} of {1} details",
+ "door_memory_sub": "Rules, wiki page and profile file",
+ "drawer_close": "Close",
"groups": {
"about": {
"title": "About you",
@@ -2142,6 +2171,7 @@
"languages": "Languages",
"timezone": "Time zone",
"devices": "Devices",
+ "about": "About you",
"directness": "Directness",
"formality": "Formality",
"verbosity": "Answer length",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 1ed517e115..e7edf4bfd3 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -2041,6 +2041,35 @@
"stat_known": "Datos conocidos",
"stat_known_sub": "en tu perfil",
"stat_updated": "Último cambio",
+ "about_placeholder": "Una o dos frases sobre ti. {name} las lee antes de cada respuesta.",
+ "hero_since": "desde {0}",
+ "stat_agent_runs": "Ejecuciones de agentes",
+ "stat_longest_streak": "Racha más larga",
+ "stat_current_streak": "Racha actual",
+ "streak_running": "en curso",
+ "activity_title": "Actividad",
+ "tab_all": "Todo",
+ "tab_voice": "Voz",
+ "tab_chats": "Chats",
+ "tab_agents": "Agentes",
+ "unit_all": "acciones",
+ "unit_voice": "usos de voz",
+ "unit_chats": "mensajes",
+ "unit_agents": "ejecuciones de agentes",
+ "activity_last7": "Últimos 7 días",
+ "delta_up": "+{0} % frente a la semana anterior",
+ "delta_down": "−{0} % frente a la semana anterior",
+ "delta_same": "igual que la semana anterior",
+ "delta_new": "nuevo esta semana",
+ "activity_avg_week": "Media semanal",
+ "activity_top_day": "Día más activo",
+ "activity_running": "en curso",
+ "activity_chart_label": "{0} por semana desde {1}",
+ "activity_empty": "Todavía no hay actividad. El gráfico se llena a medida que usas {name}.",
+ "door_details_title": "Lo que {name} sabe de ti",
+ "door_details_sub": "{0} de {1} datos",
+ "door_memory_sub": "Reglas, página wiki y archivo de perfil",
+ "drawer_close": "Cerrar",
"groups": {
"about": {
"title": "Sobre ti",
@@ -2109,6 +2138,7 @@
"languages": "Idiomas",
"timezone": "Zona horaria",
"devices": "Dispositivos",
+ "about": "Sobre ti",
"directness": "Franqueza",
"formality": "Formalidad",
"verbosity": "Longitud de respuesta",
diff --git a/jarvis/ui/web/frontend/src/views/ProfileView.test.tsx b/jarvis/ui/web/frontend/src/views/ProfileView.test.tsx
index 3df9f07453..811e9c9cc8 100644
--- a/jarvis/ui/web/frontend/src/views/ProfileView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/ProfileView.test.tsx
@@ -1,9 +1,11 @@
/**
* Component tests for the Profile section.
*
- * 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
+ * What these pin: the page is one screen (header, figures, the week chart)
+ * and everything else opens in a side panel; 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, the self-description saves as identity.about, 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.
*/
@@ -36,7 +38,8 @@ interface RouteResult {
* network calls surface as test failures.
*/
function installFetchMock(routes: Record<string, () => RouteResult>) {
- const fetchMock = vi.fn(async (input: RequestInfo | URL) => {
+ // `_init` is unused here but recorded, so a test can read a request body.
+ const fetchMock = vi.fn(async (input: RequestInfo | URL, _init?: RequestInit) => {
const url = String(input);
for (const prefix of Object.keys(routes)) {
if (url.startsWith(prefix)) {
@@ -87,6 +90,26 @@ const PROFILE_OK = {
has_avatar: false,
};
+/** Two whole weeks of one chat message a day, then a Monday with two agent runs. */
+function insightsDays() {
+ const days = [];
+ for (let i = 0; i < 15; i++) {
+ const d = new Date(2026, 8, 21 + i);
+ const iso = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
+ days.push({
+ date: iso,
+ dictations: 0,
+ dictation_words: 0,
+ voice_sessions: 0,
+ voice_words: 0,
+ chat_messages: 1,
+ agent_sessions: i === 14 ? 2 : 0,
+ agent_turns: 0,
+ });
+ }
+ return days;
+}
+
const BASE_ROUTES: Record<string, () => RouteResult> = {
"/api/profile/raw": () => ({
body: { content: RAW, path: "USER.md", mtime_ms: 1, size_bytes: RAW.length },
@@ -102,12 +125,25 @@ const BASE_ROUTES: Record<string, () => RouteResult> = {
},
}),
"/api/board/bio": () => ({ body: { text: null, generated_at: null } }),
+ "/api/board/insights": () => ({
+ body: { agents: { available: true, sessions: 3795, turns: 0, tokens: 0, items: [] }, days: insightsDays() },
+ }),
"/api/settings/agent-instructions": () => ({
body: { content: "", exists: false, filename: "George.md", template: "", char_count: 0 },
}),
"/api/wiki/page/": () => ({ status: 404, body: { detail: "no such page" } }),
};
+async function openDetails() {
+ fireEvent.click(await screen.findByTestId("open-details"));
+ return screen.findByTestId("details-panel");
+}
+
+async function openMemory() {
+ fireEvent.click(await screen.findByTestId("open-memory"));
+ return screen.findByTestId("memory-panel");
+}
+
afterEach(() => {
cleanup();
vi.restoreAllMocks();
@@ -117,6 +153,7 @@ describe("details", () => {
it("shows known details as rows and missing ones as add chips", async () => {
installFetchMock(BASE_ROUTES);
renderWithClient(<ProfileView />);
+ await openDetails();
await screen.findByText("Europe/Berlin");
const missing = await screen.findByTestId("missing-talk");
@@ -129,6 +166,7 @@ describe("details", () => {
it("opens the editor for a missing detail from its chip", async () => {
installFetchMock(BASE_ROUTES);
renderWithClient(<ProfileView />);
+ await openDetails();
const missing = await screen.findByTestId("missing-talk");
fireEvent.click(within(missing).getByRole("button", { name: /Answer length/ }));
@@ -153,20 +191,57 @@ describe("details", () => {
}),
});
renderWithClient(<ProfileView />);
+ await openDetails();
const row = await screen.findByTestId("field-verbosity");
expect(row.textContent).toContain("In depth");
expect(row.textContent).not.toContain("deep-dive");
});
- it("counts the known details in the header", async () => {
+ it("names the person and counts the known details on the panel door", async () => {
installFetchMock(BASE_ROUTES);
renderWithClient(<ProfileView />);
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"));
+ expect((await screen.findByTestId("open-details")).textContent).toContain("3 of 19 details");
+ const stats = screen.getByTestId("profile-stats");
+ await waitFor(() => expect(stats.textContent).toContain("491"));
+ await waitFor(() => expect(stats.textContent).toContain("3,795"));
+ });
+
+ it("keeps the detail groups off the page until the panel opens", async () => {
+ installFetchMock(BASE_ROUTES);
+ renderWithClient(<ProfileView />);
+
+ await screen.findByTestId("profile-hero");
+ expect(screen.queryByTestId("group-about")).toBeNull();
+ const panel = await openDetails();
+ expect(within(panel).getByTestId("group-about")).toBeTruthy();
+
+ fireEvent.click(within(panel).getByRole("button", { name: "Close" }));
+ await waitFor(() => expect(screen.queryByTestId("details-panel")).toBeNull());
+ });
+
+ it("saves the self-description as identity.about when the field is left", async () => {
+ const fetchMock = installFetchMock(BASE_ROUTES);
+ renderWithClient(<ProfileView />);
+
+ const about = (await screen.findByTestId("profile-about")) as HTMLTextAreaElement;
+ fireEvent.focus(about);
+ fireEvent.change(about, { target: { value: "Builds in public." } });
+ fireEvent.blur(about);
+
+ await waitFor(() => {
+ const patch = fetchMock.mock.calls.find((c) => String(c[0]) === "/api/profile/field");
+ expect(patch).toBeTruthy();
+ expect(JSON.parse(String(patch?.[1]?.body))).toEqual({
+ cluster: "identity",
+ field: "about",
+ operation: "set",
+ value: "Builds in public.",
+ });
+ });
});
it("asks for a name when the file has none", async () => {
@@ -187,6 +262,7 @@ describe("provenance", () => {
it("shows the date a detail was learned and the sentence behind it", async () => {
installFetchMock(BASE_ROUTES);
renderWithClient(<ProfileView />);
+ await openDetails();
const source = await screen.findByTestId("entry-source-primary_language");
expect(source.textContent).toContain("Learned");
@@ -198,6 +274,7 @@ describe("provenance", () => {
it("shows no date for a detail the audit trail never mentions", async () => {
installFetchMock(BASE_ROUTES);
renderWithClient(<ProfileView />);
+ await openDetails();
await screen.findByText("Europe/Berlin");
expect(screen.queryByTestId("entry-source-timezone")).toBeNull();
@@ -208,6 +285,7 @@ describe("portrait", () => {
it("offers to write the portrait when none exists", async () => {
installFetchMock(BASE_ROUTES);
renderWithClient(<ProfileView />);
+ await openDetails();
const empty = await screen.findByTestId("portrait-empty");
expect(empty.textContent).toContain("has not written a portrait");
@@ -221,6 +299,7 @@ describe("portrait", () => {
}),
});
renderWithClient(<ProfileView />);
+ await openDetails();
const text = await screen.findByTestId("portrait-text");
expect(text.textContent).toBe("Builds things at night.");
@@ -238,6 +317,7 @@ describe("portrait", () => {
}),
});
renderWithClient(<ProfileView />);
+ await openDetails();
await screen.findByTestId("portrait-cut-off");
expect(screen.queryByTestId("portrait-text")).toBeNull();
@@ -248,6 +328,7 @@ describe("memory and privacy", () => {
it("quotes the never-recorded categories out of the file", async () => {
installFetchMock(BASE_ROUTES);
renderWithClient(<ProfileView />);
+ await openMemory();
const list = await screen.findByTestId("never-stored");
expect(list.textContent).toContain("Political");
@@ -257,6 +338,7 @@ describe("memory and privacy", () => {
it("invites the wiki page rather than reporting a 404", async () => {
installFetchMock(BASE_ROUTES);
renderWithClient(<ProfileView />);
+ await openMemory();
await waitFor(() =>
expect(screen.getByTestId("wiki-empty").textContent).toContain("No page yet"),
@@ -266,13 +348,14 @@ describe("memory and privacy", () => {
it("opens the source file as a sub-page and comes back", async () => {
installFetchMock(BASE_ROUTES);
renderWithClient(<ProfileView />);
+ await openMemory();
const row = await screen.findByTestId("source-row");
fireEvent.click(within(row).getByRole("button", { name: /View file/ }));
await screen.findByTestId("profile-source-markdown");
fireEvent.click(screen.getByTestId("source-back"));
- await screen.findByTestId("profile-hero");
+ await screen.findByTestId("source-row");
});
});
@@ -299,3 +382,19 @@ describe("a profile the backend is not serving", () => {
expect(screen.queryByTestId("profile-hero")).toBeNull();
});
});
+
+describe("activity", () => {
+ it("shows the last seven days and switches series by tab", async () => {
+ installFetchMock(BASE_ROUTES);
+ renderWithClient(<ProfileView />);
+
+ const last7 = await screen.findByTestId("activity-last7");
+ // Seven chat messages plus two agent runs on the newest day.
+ expect(last7.textContent).toBe("9");
+ expect(screen.getByTestId("activity-bars").children).toHaveLength(3);
+
+ fireEvent.click(screen.getByRole("tab", { name: "Chats" }));
+ await waitFor(() => expect(screen.getByTestId("activity-last7").textContent).toBe("7"));
+ expect(screen.getByRole("tab", { name: "Chats" }).getAttribute("aria-selected")).toBe("true");
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/views/ProfileView.tsx b/jarvis/ui/web/frontend/src/views/ProfileView.tsx
index 7b587ad750..215ff5e9cc 100644
--- a/jarvis/ui/web/frontend/src/views/ProfileView.tsx
+++ b/jarvis/ui/web/frontend/src/views/ProfileView.tsx
@@ -1,65 +1,49 @@
/**
- * ProfileView — what the assistant knows about you, and how to change it.
+ * ProfileView — who you are to the assistant, on one screen.
*
- * Read top to bottom like any settings page (the detail groups sit two to a
- * row on a wide window):
+ * ┌──────────────────────────────────────────────┐
+ * │ photo · name · facts │
+ * │ a sentence or two about you │
+ * │ Conversations │ Agent runs │ Streaks │
+ * │ Activity: figures │ one bar per week │
+ * │ [What {name} knows ›] [Memory and privacy ›] │
+ * └──────────────────────────────────────────────┘
*
- * ┌────────────────────────────────────────────────────────────┐
- * │ 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 │
- * └────────────────────────────────────────────────────────────┘
- *
- * 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 page fits one window; nothing on it scrolls. Everything that does not
+ * fit — the detail groups, the portrait, memory and privacy, the raw file —
+ * opens in a side panel from the two rows at the foot.
*
* 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.
+ * panels need it: the details panel parses its audit trail for provenance,
+ * the memory panel renders it and reads its Do Not Record list.
*/
-import { useEffect, useMemo, useRef, useState } from "react";
+import { useCallback, useMemo, useState, type ReactNode } from "react";
import { useQuery } from "@tanstack/react-query";
-import { AlertTriangle, ArrowLeft, RefreshCw, UserCircle2 } from "lucide-react";
+import { AlertTriangle, ArrowLeft, ChevronRight, Lock, RefreshCw, UserCircle2, UserRound } from "lucide-react";
-import { PageHeader } from "@/components/layout/PageHeader";
import { Button } from "@/components/ui/button";
import { EmptyState } from "@/components/ui/empty-state";
-import { useT } from "@/i18n";
-import { cn } from "@/lib/utils";
+import { fill, useT } from "@/i18n";
+import { ActivityChart } from "@/views/profile/ActivityChart";
import { FieldGroup } from "@/views/profile/FieldGroup";
import { MemorySection } from "@/views/profile/MemorySection";
import { PortraitSection } from "@/views/profile/PortraitSection";
+import { ProfileDrawer } from "@/views/profile/ProfileDrawer";
import { ProfileHero } from "@/views/profile/ProfileHero";
+import { ProfileStats } from "@/views/profile/ProfileStats";
import { SourceCard, useSourceDocument } from "@/views/profile/SourceCard";
import { fetchJson, statusOf, type ProfileResponse } from "@/views/profile/api";
-import { PAGE_GROUPS } from "@/views/profile/ledger";
+import { PAGE_GROUPS, TOTAL_FIELDS, countFilled } from "@/views/profile/ledger";
import { parseObservations } from "@/views/profile/provenance";
-/**
- * The page runs the Settings hub column (which owns the measure); the detail
- * groups pair up two to a row once the window is wide enough.
- */
-const COLUMN = "w-full";
+type Panel = "details" | "memory" | null;
export function ProfileView() {
const t = useT();
+ const [panel, setPanel] = useState<Panel>(null);
const [showSource, setShowSource] = useState(false);
- // Switching between the page and the file sub-page starts at the top; the
- // scroll position of a long page would otherwise hide the back link.
- const scrollRef = useRef<HTMLDivElement | null>(null);
- useEffect(() => {
- scrollRef.current?.scrollTo?.({ top: 0 });
- }, [showSource]);
-
- const { data, isLoading, error, refetch, isRefetching } = useQuery<ProfileResponse, Error>({
+
+ const { data, isLoading, error, refetch } = useQuery<ProfileResponse, Error>({
queryKey: ["profile"],
queryFn: () => fetchJson<ProfileResponse>("/api/profile"),
retry: false,
@@ -70,89 +54,145 @@ export function ProfileView() {
const raw = source.data?.content ?? null;
const observations = useMemo(() => parseObservations(raw), [raw]);
- const meta = (data?.user.meta ?? {}) as Record<string, unknown>;
+ const meta = useMemo(() => (data?.user.meta ?? {}) as Record<string, unknown>, [data]);
+ const filled = useMemo(() => countFilled(meta), [meta]);
+
+ const closePanel = useCallback(() => {
+ source.cancelEditing();
+ setShowSource(false);
+ setPanel(null);
+ }, [source]);
return (
- <div
- ref={scrollRef}
- className="flex h-full flex-col overflow-y-auto bg-background px-8 pb-10 scrollbar-jarvis"
- >
- <div className={COLUMN}>
- <PageHeader
- icon={<UserCircle2 />}
- title={t("profile_view.title")}
- description={t("profile_view.subtitle")}
- actions={
- <Button
- type="button"
- size="icon"
- variant="ghost"
- className="text-muted-foreground"
- onClick={() => {
- void refetch();
- source.refetch();
- }}
- disabled={isRefetching}
- title={t("profile_view.reload_tooltip")}
- aria-label={t("profile_view.reload_tooltip")}
- >
- <RefreshCw className={cn(isRefetching && "animate-spin")} />
- </Button>
- }
- />
-
- {isLoading && <ProfileSkeleton label={t("common.loading")} />}
-
- {error && <ProfileErrorState error={error} onRetry={() => refetch()} />}
-
- {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 && !showSource && (
- <div className="flex flex-col gap-10">
- <ProfileHero data={data} meta={meta} />
- <div className="grid grid-cols-1 items-start gap-10 xl:grid-cols-2 xl:gap-x-8">
- {PAGE_GROUPS.map((g) => (
- <FieldGroup
- key={g.id}
- id={g.id}
- fields={g.fields}
- meta={meta}
- observations={observations}
+ <div className="relative h-full overflow-hidden bg-background">
+ <div className="h-full overflow-y-auto px-8 scrollbar-jarvis">
+ <h1 className="sr-only">{t("profile_view.title")}</h1>
+ <div className="mx-auto flex min-h-full w-full max-w-3xl flex-col justify-center gap-5 py-5 [@media(min-height:860px)]:gap-7 [@media(min-height:860px)]:py-8 [@media(min-height:1000px)]:gap-9">
+ {isLoading && <ProfileSkeleton label={t("common.loading")} />}
+
+ {error && <ProfileErrorState error={error} onRetry={() => refetch()} />}
+
+ {data && (
+ <>
+ <ProfileHero data={data} meta={meta} />
+ <ProfileStats />
+ <ActivityChart />
+ <div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
+ <PanelDoor
+ testId="open-details"
+ icon={<UserRound />}
+ title={t("profile_view.door_details_title")}
+ sub={fill(t("profile_view.door_details_sub"), { 0: filled, 1: TOTAL_FIELDS })}
+ onClick={() => setPanel("details")}
/>
- ))}
- </div>
+ <PanelDoor
+ testId="open-memory"
+ icon={<Lock />}
+ title={t("profile_view.memory_title")}
+ sub={t("profile_view.door_memory_sub")}
+ onClick={() => setPanel("memory")}
+ />
+ </div>
+ </>
+ )}
+ </div>
+ </div>
+
+ {data && panel === "details" && (
+ <ProfileDrawer
+ testId="details-panel"
+ title={t("profile_view.door_details_title")}
+ description={fill(t("profile_view.door_details_sub"), { 0: filled, 1: TOTAL_FIELDS })}
+ onClose={closePanel}
+ >
+ <div className="flex flex-col gap-8">
+ {PAGE_GROUPS.map((g) => (
+ <FieldGroup
+ key={g.id}
+ id={g.id}
+ fields={g.fields}
+ meta={meta}
+ observations={observations}
+ />
+ ))}
<PortraitSection />
+ </div>
+ </ProfileDrawer>
+ )}
+
+ {data && panel === "memory" && (
+ <ProfileDrawer
+ testId="memory-panel"
+ title={t("profile_view.memory_title")}
+ description={t("profile_view.memory_description")}
+ onClose={closePanel}
+ >
+ {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>
+ ) : (
<MemorySection
+ bare
name={data.user.name?.trim() || null}
raw={raw}
fileUpdatedMs={source.data?.mtime_ms ?? null}
onOpenSource={() => setShowSource(true)}
/>
- </div>
- )}
- </div>
+ )}
+ </ProfileDrawer>
+ )}
</div>
);
}
+/** One of the two rows at the foot of the page; each opens a side panel. */
+function PanelDoor({
+ icon,
+ title,
+ sub,
+ onClick,
+ testId,
+}: {
+ icon: ReactNode;
+ title: string;
+ sub: string;
+ onClick: () => void;
+ testId: string;
+}) {
+ return (
+ <button
+ type="button"
+ data-testid={testId}
+ onClick={onClick}
+ className="group flex min-h-11 items-center gap-3.5 rounded-xl border border-border bg-card px-4 py-3.5 text-left transition-colors hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ <span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-secondary text-foreground-secondary transition-colors group-hover:bg-background [&>svg]:h-4 [&>svg]:w-4">
+ {icon}
+ </span>
+ <span className="flex min-w-0 flex-1 flex-col gap-0.5">
+ <span className="truncate text-base font-medium text-foreground-strong">{title}</span>
+ <span className="truncate text-sm text-muted-foreground">{sub}</span>
+ </span>
+ <ChevronRight aria-hidden className="h-4 w-4 shrink-0 text-muted-foreground" />
+ </button>
+ );
+}
+
// ----------------------------------------------------------------------
// Loading and failure
// ----------------------------------------------------------------------
@@ -163,37 +203,15 @@ export function ProfileView() {
*/
function ProfileSkeleton({ label }: { label: string }) {
return (
- <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="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 role="status" aria-busy="true" aria-label={label} className="flex flex-col gap-9">
+ <div className="flex flex-col items-center gap-4">
+ <div className="h-20 w-20 animate-pulse rounded-3xl bg-secondary" />
+ <div className="h-7 w-40 animate-pulse rounded-md bg-secondary" />
+ <div className="h-3.5 w-72 max-w-full animate-pulse rounded-full bg-secondary" />
+ <div className="h-16 w-full max-w-lg animate-pulse rounded-xl 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 className="h-20 animate-pulse rounded-xl bg-secondary" />
+ <div className="h-48 animate-pulse rounded-xl bg-secondary" />
</div>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/profile/ActivityChart.tsx b/jarvis/ui/web/frontend/src/views/profile/ActivityChart.tsx
new file mode 100644
index 0000000000..3297a5c431
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/profile/ActivityChart.tsx
@@ -0,0 +1,319 @@
+/**
+ * The profile's activity block: one bar per week, beside three plain figures.
+ *
+ * Left: the last seven days (with the change against the seven before), the
+ * mean of the finished weeks, and the busiest weekday. Right: the weeks since
+ * the first active one, one hue, a recessive two-line grid. Hovering a bar
+ * names its week and its count; every other bar steps back. The week still
+ * running is drawn lighter, so a Monday never reads as a collapse.
+ *
+ * Four tabs pick the series (everything, voice, chats, agents). The axis is
+ * shared across tabs; only the heights and the figures change.
+ */
+import { useMemo, useState } from "react";
+
+import { useBoardInsights } from "@/hooks/useBoardInsights";
+import { fill, useT, useUiLanguage } from "@/i18n";
+import { cn } from "@/lib/utils";
+import {
+ SERIES_IDS,
+ summarize,
+ weekDelta,
+ type SeriesId,
+ type WeekBar,
+} from "@/views/profile/activity";
+
+const TAB_KEY: Record<SeriesId, string> = {
+ all: "tab_all",
+ voice: "tab_voice",
+ chats: "tab_chats",
+ agents: "tab_agents",
+};
+
+const UNIT_KEY: Record<SeriesId, string> = {
+ all: "unit_all",
+ voice: "unit_voice",
+ chats: "unit_chats",
+ agents: "unit_agents",
+};
+
+/** A Monday, so `weekday` index 0…6 maps onto Monday…Sunday. */
+const A_MONDAY = new Date(2024, 0, 1);
+
+export function ActivityChart() {
+ const t = useT();
+ const ui = useUiLanguage();
+ const insights = useBoardInsights();
+ const [series, setSeries] = useState<SeriesId>("all");
+ const [hovered, setHovered] = useState<number | null>(null);
+
+ const days = insights.data?.days;
+ const summary = useMemo(() => (days ? summarize(days, series) : null), [days, series]);
+
+ const num = (n: number) => n.toLocaleString(ui);
+ const unit = t(`profile_view.${UNIT_KEY[series]}`);
+
+ return (
+ <section data-testid="profile-activity" aria-labelledby="profile-activity-title" className="flex flex-col gap-4">
+ <div className="flex flex-wrap items-end justify-between gap-x-6 gap-y-2 border-b border-border">
+ <h2 id="profile-activity-title" className="pb-2.5 text-base font-semibold text-foreground-strong">
+ {t("profile_view.activity_title")}
+ </h2>
+ <div role="tablist" aria-label={t("profile_view.activity_title")} className="flex gap-5">
+ {SERIES_IDS.map((id) => {
+ const on = id === series;
+ return (
+ <button
+ key={id}
+ type="button"
+ role="tab"
+ aria-selected={on}
+ onClick={() => {
+ setSeries(id);
+ setHovered(null);
+ }}
+ className={cn(
+ "-mb-px border-b-2 pb-2.5 text-base transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ on
+ ? "border-foreground-strong font-medium text-foreground-strong"
+ : "border-transparent text-muted-foreground hover:text-foreground",
+ )}
+ >
+ {t(`profile_view.${TAB_KEY[id]}`)}
+ </button>
+ );
+ })}
+ </div>
+ </div>
+
+ {!summary ? (
+ <ActivitySkeleton label={t("common.loading")} />
+ ) : summary.weeks.length === 0 ? (
+ <p className="py-10 text-center text-base text-muted-foreground">
+ {t("profile_view.activity_empty")}
+ </p>
+ ) : (
+ <div className="flex flex-col gap-6 sm:flex-row sm:items-stretch sm:gap-7">
+ <Figures
+ last7={num(summary.last7)}
+ unit={unit}
+ delta={deltaText(t, weekDelta(summary.last7, summary.prev7), summary.last7)}
+ avgWeek={summary.avgWeek === null ? "–" : num(summary.avgWeek)}
+ topWeekday={
+ summary.topWeekday === null
+ ? "–"
+ : new Date(
+ A_MONDAY.getFullYear(),
+ A_MONDAY.getMonth(),
+ A_MONDAY.getDate() + summary.topWeekday,
+ ).toLocaleDateString(ui, { weekday: "long" })
+ }
+ labels={{
+ last7: t("profile_view.activity_last7"),
+ avg: t("profile_view.activity_avg_week"),
+ top: t("profile_view.activity_top_day"),
+ }}
+ />
+ <Bars
+ weeks={summary.weeks}
+ axisMax={summary.axisMax}
+ hovered={hovered}
+ onHover={setHovered}
+ ui={ui}
+ num={num}
+ unit={unit}
+ runningLabel={t("profile_view.activity_running")}
+ label={fill(t("profile_view.activity_chart_label"), {
+ 0: unit,
+ 1: summary.weeks[0].start.toLocaleDateString(ui, { day: "numeric", month: "short", year: "numeric" }),
+ })}
+ />
+ </div>
+ )}
+ </section>
+ );
+}
+
+function deltaText(t: (key: string) => string, delta: number | null, last7: number): string {
+ if (delta === null) return last7 > 0 ? t("profile_view.delta_new") : "";
+ if (delta === 0) return t("profile_view.delta_same");
+ return fill(t(delta > 0 ? "profile_view.delta_up" : "profile_view.delta_down"), {
+ 0: Math.abs(delta),
+ });
+}
+
+function Figures({
+ last7,
+ unit,
+ delta,
+ avgWeek,
+ topWeekday,
+ labels,
+}: {
+ last7: string;
+ unit: string;
+ delta: string;
+ avgWeek: string;
+ topWeekday: string;
+ labels: { last7: string; avg: string; top: string };
+}) {
+ return (
+ <div className="flex shrink-0 flex-col justify-between gap-4 sm:w-48">
+ <div className="flex flex-col gap-1">
+ <span className="text-sm text-muted-foreground">{labels.last7}</span>
+ <span className="flex min-w-0 items-baseline gap-1.5">
+ <span
+ data-testid="activity-last7"
+ className="font-display text-2xl tabular-nums leading-tight text-foreground-strong"
+ >
+ {last7}
+ </span>
+ <span className="truncate text-sm text-muted-foreground">{unit}</span>
+ </span>
+ {delta && <span className="text-sm text-muted-foreground">{delta}</span>}
+ </div>
+ <div className="grid grid-cols-2 gap-3 border-t border-border pt-3">
+ <span className="flex min-w-0 flex-col gap-0.5">
+ <span className="truncate text-sm text-muted-foreground">{labels.avg}</span>
+ <span className="truncate text-base font-medium tabular-nums text-foreground-strong">{avgWeek}</span>
+ </span>
+ <span className="flex min-w-0 flex-col gap-0.5">
+ <span className="truncate text-sm text-muted-foreground">{labels.top}</span>
+ <span className="truncate text-base font-medium text-foreground-strong">{topWeekday}</span>
+ </span>
+ </div>
+ </div>
+ );
+}
+
+function Bars({
+ weeks,
+ axisMax,
+ hovered,
+ onHover,
+ ui,
+ num,
+ unit,
+ runningLabel,
+ label,
+}: {
+ weeks: WeekBar[];
+ axisMax: number;
+ hovered: number | null;
+ onHover: (index: number | null) => void;
+ ui: string;
+ num: (n: number) => string;
+ unit: string;
+ runningLabel: string;
+ label: string;
+}) {
+ const heightPct = (total: number) => (total > 0 ? Math.max(2.5, (total / axisMax) * 100) : 0);
+ const short = (d: Date) => d.toLocaleDateString(ui, { day: "numeric", month: "short" });
+
+ // A month name sits under the week that holds that month's first day.
+ const months = useMemo(() => {
+ let last = -1;
+ return weeks.map((w) => {
+ for (let k = 0; k < 7; k++) {
+ const d = new Date(w.start.getFullYear(), w.start.getMonth(), w.start.getDate() + k);
+ if (d > w.end) break;
+ if (d.getDate() === 1 && d.getMonth() !== last) {
+ last = d.getMonth();
+ return d.toLocaleDateString(ui, { month: "short" });
+ }
+ }
+ return "";
+ });
+ }, [weeks, ui]);
+
+ const tip = hovered !== null ? weeks[hovered] : null;
+ const tipLeft = hovered !== null ? Math.min(Math.max(((hovered + 0.5) / weeks.length) * 100, 10), 90) : 0;
+
+ return (
+ <div className="flex min-w-0 flex-1 flex-col gap-1.5">
+ <div className="relative h-[clamp(5rem,16vh,9rem)]">
+ <div aria-hidden className="absolute inset-x-0 top-0 mr-10 border-t border-dashed border-border" />
+ <div aria-hidden className="absolute inset-x-0 top-1/2 mr-10 border-t border-dashed border-border" />
+ <div aria-hidden className="absolute inset-x-0 bottom-0 mr-10 border-t border-border-strong" />
+ <span aria-hidden className="absolute right-0 top-0 -translate-y-1/2 text-xs tabular-nums text-muted-foreground">
+ {num(axisMax)}
+ </span>
+ {/* A half like 12.5 reads as noise; the line alone carries it. */}
+ {Number.isInteger(axisMax / 2) && (
+ <span aria-hidden className="absolute right-0 top-1/2 -translate-y-1/2 text-xs tabular-nums text-muted-foreground">
+ {num(axisMax / 2)}
+ </span>
+ )}
+
+ <div
+ role="img"
+ aria-label={label}
+ data-testid="activity-bars"
+ onMouseLeave={() => onHover(null)}
+ className="absolute inset-y-0 left-0 right-10 flex items-end gap-0.5"
+ >
+ {weeks.map((w, i) => {
+ const dim = (hovered !== null && hovered !== i) || (hovered === null && w.partial);
+ return (
+ <div
+ key={w.start.getTime()}
+ onMouseEnter={() => onHover(i)}
+ className="flex h-full min-w-0 flex-1 items-end"
+ >
+ <span
+ className={cn(
+ "block w-full rounded-t-[4px] transition-colors duration-150",
+ dim ? "bg-[rgb(var(--accent-rgb)/0.38)]" : "bg-accent",
+ )}
+ style={{ height: `${heightPct(w.total)}%` }}
+ />
+ </div>
+ );
+ })}
+ </div>
+
+ {tip && (
+ <div
+ role="status"
+ className="pointer-events-none absolute z-10 flex -translate-x-1/2 -translate-y-full flex-col gap-0.5 whitespace-nowrap rounded-lg bg-popover px-2.5 py-2 shadow-float"
+ style={{
+ left: `calc((100% - 2.5rem) * ${tipLeft / 100})`,
+ top: `calc(${100 - heightPct(tip.total)}% - 0.5rem)`,
+ }}
+ >
+ <span className="text-xs text-muted-foreground">
+ {short(tip.start)} – {short(tip.end)}
+ {tip.partial && ` · ${runningLabel}`}
+ </span>
+ <span className="text-sm font-medium tabular-nums text-foreground-strong">
+ {num(tip.total)} {unit}
+ </span>
+ </div>
+ )}
+ </div>
+
+ <div aria-hidden className="mr-10 flex gap-0.5">
+ {months.map((m, i) => (
+ <span
+ key={i}
+ className="h-4 min-w-0 flex-1 overflow-visible whitespace-nowrap text-xs leading-4 text-muted-foreground"
+ >
+ {m}
+ </span>
+ ))}
+ </div>
+ </div>
+ );
+}
+
+function ActivitySkeleton({ label }: { label: string }) {
+ return (
+ <div role="status" aria-busy="true" aria-label={label} className="flex gap-7">
+ <div className="flex w-48 shrink-0 flex-col gap-2">
+ <div className="h-3.5 w-20 animate-pulse rounded-full bg-secondary" />
+ <div className="h-7 w-24 animate-pulse rounded-md bg-secondary" />
+ </div>
+ <div className="h-[clamp(5rem,16vh,9rem)] flex-1 animate-pulse rounded-lg bg-secondary" />
+ </div>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/views/profile/AvatarButton.tsx b/jarvis/ui/web/frontend/src/views/profile/AvatarButton.tsx
index ee1ba702b1..c73ba2ff4a 100644
--- a/jarvis/ui/web/frontend/src/views/profile/AvatarButton.tsx
+++ b/jarvis/ui/web/frontend/src/views/profile/AvatarButton.tsx
@@ -24,11 +24,14 @@ export function AvatarButton({
name,
hasAvatar,
size = "md",
+ shape = "circle",
}: {
name: string | null;
hasAvatar: boolean;
/** `xl` is the profile header; `md` keeps the old 56 px for anywhere else. */
size?: "md" | "lg" | "xl";
+ /** The profile header draws the photo as a rounded square. */
+ shape?: "circle" | "rounded";
}) {
const t = useT();
const queryClient = useQueryClient();
@@ -79,6 +82,7 @@ export function AvatarButton({
const busy = upload.isPending || remove.isPending;
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");
+ const round = shape === "rounded" ? "rounded-3xl" : "rounded-full";
return (
<div className="group/avatar relative shrink-0">
@@ -98,7 +102,8 @@ export function AvatarButton({
title={title}
aria-label={title}
className={cn(
- "relative flex items-center justify-center overflow-hidden rounded-full bg-secondary transition-colors",
+ "relative flex items-center justify-center overflow-hidden bg-secondary transition-colors",
+ round,
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:opacity-50",
box,
)}
@@ -111,7 +116,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}
+ className={cn(size === "xl" && "h-full w-full text-2xl", round)}
/>
) : hasAvatar ? (
<img
@@ -124,12 +129,12 @@ export function AvatarButton({
<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">
+ <span className={cn("pointer-events-none absolute inset-0 flex items-center justify-center bg-scrim/70", round, "opacity-0 transition-opacity duration-200 group-hover/avatar:opacity-100 group-focus-visible/avatar:opacity-100")}>
<Camera aria-hidden className="h-4 w-4 text-foreground-strong" />
</span>
{busy && (
- <span className="absolute inset-0 flex items-center justify-center rounded-full bg-scrim/70">
+ <span className={cn("absolute inset-0 flex items-center justify-center bg-scrim/70", round)}>
<Loader2 aria-hidden className="h-4 w-4 animate-spin text-foreground-strong" />
</span>
)}
diff --git a/jarvis/ui/web/frontend/src/views/profile/MemorySection.tsx b/jarvis/ui/web/frontend/src/views/profile/MemorySection.tsx
index 59d39e6e9e..324303f17a 100644
--- a/jarvis/ui/web/frontend/src/views/profile/MemorySection.tsx
+++ b/jarvis/ui/web/frontend/src/views/profile/MemorySection.tsx
@@ -74,11 +74,14 @@ export function MemorySection({
raw,
fileUpdatedMs,
onOpenSource,
+ bare = false,
}: {
name: string | null;
raw: string | null;
fileUpdatedMs: number | null;
onOpenSource: () => void;
+ /** Rendered inside a panel that already carries the section's title. */
+ bare?: boolean;
}) {
const t = useT();
const setActiveSection = useEventStore((s) => s.setActiveSection);
@@ -132,6 +135,7 @@ export function MemorySection({
testId="memory"
title={t("profile_view.memory_title")}
description={t("profile_view.memory_description")}
+ bare={bare}
>
<SettingRow
testId="rules-row"
diff --git a/jarvis/ui/web/frontend/src/views/profile/ProfileDrawer.tsx b/jarvis/ui/web/frontend/src/views/profile/ProfileDrawer.tsx
new file mode 100644
index 0000000000..09f2e505b5
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/profile/ProfileDrawer.tsx
@@ -0,0 +1,92 @@
+/**
+ * The side panel the profile page opens for everything that does not fit on
+ * its one screen: the detail groups, the portrait, memory and privacy.
+ *
+ * It lives inside the Settings hub's content column, not in a portal: the
+ * hub is itself a dialog, and a panel inside its content keeps focus and
+ * outside clicks with the hub. `aria-modal` on the panel tells the hub to
+ * leave Escape to us, so Escape closes the panel and not the whole hub.
+ */
+import { useEffect, useRef, type ReactNode } from "react";
+import { X } from "lucide-react";
+
+import { Button } from "@/components/ui/button";
+import { useT } from "@/i18n";
+
+export function ProfileDrawer({
+ title,
+ description,
+ onClose,
+ children,
+ testId,
+}: {
+ title: string;
+ description?: string;
+ onClose: () => void;
+ children: ReactNode;
+ testId?: string;
+}) {
+ const t = useT();
+ const closeRef = useRef<HTMLButtonElement | null>(null);
+ // Read through a ref so a new callback identity never re-runs the effect
+ // (which would pull focus back to the close button mid-edit).
+ const onCloseRef = useRef(onClose);
+ onCloseRef.current = onClose;
+
+ useEffect(() => {
+ closeRef.current?.focus();
+ const onKey = (e: KeyboardEvent) => {
+ if (e.key !== "Escape" || e.defaultPrevented) return;
+ // An open inline editor owns Escape: it cancels the edit, not the panel.
+ const target = e.target;
+ if (
+ target instanceof HTMLElement &&
+ (target.isContentEditable || target.closest("input, textarea, select"))
+ ) {
+ return;
+ }
+ onCloseRef.current();
+ };
+ window.addEventListener("keydown", onKey);
+ return () => window.removeEventListener("keydown", onKey);
+ }, []);
+
+ return (
+ <div className="absolute inset-0 z-20">
+ <button
+ type="button"
+ tabIndex={-1}
+ aria-label={t("profile_view.drawer_close")}
+ onClick={onClose}
+ className="absolute inset-0 h-full w-full cursor-default bg-scrim/50 animate-in fade-in-0 duration-150"
+ />
+ <aside
+ role="dialog"
+ aria-modal="true"
+ aria-label={title}
+ data-testid={testId}
+ className="absolute inset-y-0 right-0 flex w-full max-w-xl flex-col border-l border-border bg-background shadow-float animate-in slide-in-from-right-8 fade-in-0 duration-200"
+ >
+ <header className="flex items-start gap-3 border-b border-border px-6 pb-4 pt-6">
+ <div className="min-w-0 flex-1">
+ <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>
+ <Button
+ ref={closeRef}
+ type="button"
+ variant="ghost"
+ size="icon"
+ onClick={onClose}
+ aria-label={t("profile_view.drawer_close")}
+ title={t("profile_view.drawer_close")}
+ className="text-muted-foreground"
+ >
+ <X />
+ </Button>
+ </header>
+ <div className="min-h-0 flex-1 overflow-y-auto px-6 pb-8 pt-5 scrollbar-jarvis">{children}</div>
+ </aside>
+ </div>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/views/profile/ProfileGroup.tsx b/jarvis/ui/web/frontend/src/views/profile/ProfileGroup.tsx
index 606614b1a0..11732af27a 100644
--- a/jarvis/ui/web/frontend/src/views/profile/ProfileGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/profile/ProfileGroup.tsx
@@ -18,6 +18,7 @@ export function ProfileGroup({
children,
testId,
className,
+ bare = false,
}: {
title: string;
description?: string;
@@ -26,10 +27,12 @@ export function ProfileGroup({
children: ReactNode;
testId?: string;
className?: string;
+ /** Drop the visible heading when a surrounding panel already names the group. */
+ bare?: boolean;
}) {
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={cn("flex items-end justify-between gap-4 px-1", bare && "hidden")}>
<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>}
diff --git a/jarvis/ui/web/frontend/src/views/profile/ProfileHero.tsx b/jarvis/ui/web/frontend/src/views/profile/ProfileHero.tsx
index d9f92d27c4..61eb8bae7d 100644
--- a/jarvis/ui/web/frontend/src/views/profile/ProfileHero.tsx
+++ b/jarvis/ui/web/frontend/src/views/profile/ProfileHero.tsx
@@ -1,56 +1,38 @@
/**
- * The top of the profile: who this is, and four plain numbers.
+ * The top of the profile: the photo, the name, one line of facts, and a
+ * sentence or two the person writes about themselves.
*
* 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.
+ * The facts line only holds facts that exist — no dashes for gaps. The
+ * self-description is `identity.about`: it saves when the field loses focus
+ * and goes into every prompt as the person's own words.
*/
-import { useMemo, useState } from "react";
+import { useEffect, useState } from "react";
import { Check, Pencil } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
+import { Textarea } from "@/components/ui/textarea";
import { useBoardSummary } from "@/hooks/useBoard";
-import { useT, useUiLanguage } from "@/i18n";
+import { fill, 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,
- languageName,
-} from "@/views/profile/ledger";
+import { isEmptyValue, languageName } from "@/views/profile/ledger";
+
+/** The longest self-description the field takes; it rides in every prompt. */
+export const ABOUT_MAX_CHARS = 160;
/** A date stamp as a short local date; null when unparseable. */
-function shortDate(value: unknown): string | null {
+function shortDate(value: unknown, ui: string): 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" });
-}
-
-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>
- );
+ return d.toLocaleDateString(ui, { day: "numeric", month: "short", year: "numeric" });
}
function NameForm({ onDone }: { onDone?: () => void }) {
@@ -75,7 +57,7 @@ function NameForm({ onDone }: { onDone?: () => void }) {
return (
<form
- className="mt-2 flex max-w-sm items-center gap-2"
+ className="mt-1 flex w-full max-w-sm items-center gap-2"
onSubmit={(e) => {
e.preventDefault();
save();
@@ -99,6 +81,69 @@ function NameForm({ onDone }: { onDone?: () => void }) {
);
}
+function AboutField({ value }: { value: string }) {
+ const t = useT();
+ const pushToast = useEventStore((s) => s.pushToast);
+ const edit = useFieldEdit();
+ const [draft, setDraft] = useState(value);
+
+ // A save elsewhere (the assistant, the raw file) replaces the draft unless
+ // the person is mid-sentence in this field.
+ const [focused, setFocused] = useState(false);
+ useEffect(() => {
+ if (!focused) setDraft(value);
+ }, [value, focused]);
+
+ const save = () => {
+ const next = draft.trim();
+ if (next === value.trim()) return;
+ edit.mutate(
+ next
+ ? { cluster: "identity", field: "about", operation: "set", value: next }
+ : { cluster: "identity", field: "about", operation: "clear" },
+ { onSuccess: () => pushToast("success", t("profile_view.field_saved")) },
+ );
+ };
+
+ return (
+ <div className="relative w-full max-w-lg">
+ <Textarea
+ data-testid="profile-about"
+ value={draft}
+ rows={1}
+ maxLength={ABOUT_MAX_CHARS}
+ disabled={edit.isPending}
+ aria-label={t("profile_view.fields.about")}
+ placeholder={t("profile_view.about_placeholder")}
+ onFocus={() => setFocused(true)}
+ onChange={(e) => setDraft(e.target.value)}
+ onBlur={() => {
+ setFocused(false);
+ save();
+ }}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" && !e.shiftKey) {
+ e.preventDefault();
+ e.currentTarget.blur();
+ } else if (e.key === "Escape") {
+ e.stopPropagation();
+ setDraft(value);
+ e.currentTarget.blur();
+ }
+ }}
+ className="max-h-28 min-h-0 resize-none rounded-xl text-center text-base leading-relaxed [field-sizing:content]"
+ />
+ <span
+ aria-hidden
+ className="absolute -bottom-5 right-1 text-xs tabular-nums text-muted-foreground opacity-0 transition-opacity data-[on=true]:opacity-100"
+ data-on={focused}
+ >
+ {draft.length} / {ABOUT_MAX_CHARS}
+ </span>
+ </div>
+ );
+}
+
export function ProfileHero({
data,
meta,
@@ -115,7 +160,7 @@ export function ProfileHero({
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 about = typeof identity["about"] === "string" ? identity["about"] : "";
const facts: string[] = [];
if (preferred && preferred !== name) {
@@ -125,67 +170,47 @@ export function ProfileHero({
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"]);
+ const since = shortDate(board.data?.totals.first_day, ui);
+ if (since) facts.push(fill(t("profile_view.hero_since"), { 0: since }));
return (
<section
data-testid="profile-hero"
- className="overflow-hidden rounded-xl border border-border bg-card"
+ aria-label={t("profile_view.groups.about.title")}
+ className="flex flex-col items-center gap-3 text-center"
>
- <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 && name && !renaming && (
- <p className="mt-1 truncate text-base text-muted-foreground">{facts.join(" · ")}</p>
- )}
- </div>
- </div>
+ <AvatarButton name={name} hasAvatar={!!data.has_avatar} size="xl" shape="rounded" />
- <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 className="flex w-full flex-col items-center gap-1">
+ {name && !renaming ? (
+ <div className="group relative flex items-center justify-center">
+ <h2 className="truncate font-display text-2xl 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="absolute -right-10 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 && name && !renaming && (
+ <p className="max-w-full truncate text-base text-muted-foreground">{facts.join(" · ")}</p>
+ )}
</div>
+
+ <AboutField value={about} />
</section>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/profile/ProfileStats.tsx b/jarvis/ui/web/frontend/src/views/profile/ProfileStats.tsx
new file mode 100644
index 0000000000..1cff40bd2b
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/profile/ProfileStats.tsx
@@ -0,0 +1,77 @@
+/**
+ * Four figures under the profile header: conversations, agent runs, the
+ * longest streak and the current one. Each comes from a real source (the
+ * activity board); a figure that has not loaded shows a skeleton, never a
+ * zero, because a zero reads as a fact.
+ */
+import { useBoardSummary } from "@/hooks/useBoard";
+import { useBoardInsights } from "@/hooks/useBoardInsights";
+import { fill, useT, useUiLanguage } from "@/i18n";
+
+function Stat({
+ label,
+ value,
+ note,
+ testId,
+}: {
+ label: string;
+ value: string | null;
+ note?: string | null;
+ testId?: string;
+}) {
+ return (
+ <div data-testid={testId} className="flex min-w-0 flex-col gap-1 px-5 py-3.5">
+ <span className="truncate text-sm text-muted-foreground">{label}</span>
+ {value === null ? (
+ <span className="h-6 w-16 animate-pulse rounded-md bg-secondary" />
+ ) : (
+ <span className="flex min-w-0 items-baseline gap-2">
+ <span className="truncate text-xl font-semibold tabular-nums tracking-tight text-foreground-strong">
+ {value}
+ </span>
+ {note && <span className="shrink-0 text-sm text-accent">{note}</span>}
+ </span>
+ )}
+ </div>
+ );
+}
+
+export function ProfileStats() {
+ const t = useT();
+ const ui = useUiLanguage();
+ const summary = useBoardSummary();
+ const insights = useBoardInsights();
+
+ const num = (n: number) => n.toLocaleString(ui);
+ const days = (n: number) => fill(t("profile_view.stat_days"), { 0: num(n) });
+
+ const s = summary.data;
+ const current = s ? s.streak_days : null;
+
+ return (
+ <section
+ data-testid="profile-stats"
+ aria-label={t("profile_view.activity_title")}
+ className="grid grid-cols-2 overflow-hidden rounded-xl border border-border bg-card 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_conversations")}
+ value={summary.isLoading ? null : s ? num(s.totals.session_count) : "–"}
+ />
+ <Stat
+ label={t("profile_view.stat_agent_runs")}
+ value={insights.isLoading ? null : insights.data ? num(insights.data.agents.sessions) : "–"}
+ />
+ <Stat
+ label={t("profile_view.stat_longest_streak")}
+ value={summary.isLoading ? null : s ? days(s.longest_streak) : "–"}
+ />
+ <Stat
+ testId="stat-current-streak"
+ label={t("profile_view.stat_current_streak")}
+ value={summary.isLoading ? null : current !== null ? days(current) : "–"}
+ note={current ? t("profile_view.streak_running") : null}
+ />
+ </section>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/views/profile/activity.test.ts b/jarvis/ui/web/frontend/src/views/profile/activity.test.ts
new file mode 100644
index 0000000000..a9efcc1dec
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/profile/activity.test.ts
@@ -0,0 +1,94 @@
+/**
+ * The week-chart math: Monday-start weeks from the first active one, a
+ * running week flagged instead of read as a drop, a shared axis across
+ * series, and figures that never invent a comparison.
+ */
+import { describe, expect, it } from "vitest";
+
+import type { InsightsDay } from "@/hooks/useBoardInsights";
+import { niceCeil, summarize, weekDelta } from "@/views/profile/activity";
+
+function day(date: string, over: Partial<InsightsDay> = {}): InsightsDay {
+ return {
+ date,
+ dictations: 0,
+ dictation_words: 0,
+ voice_sessions: 0,
+ voice_words: 0,
+ chat_messages: 0,
+ agent_sessions: 0,
+ agent_turns: 0,
+ ...over,
+ };
+}
+
+/** `count` consecutive days from 2026-09-14 (a Monday). */
+function span(count: number, fill: (i: number) => Partial<InsightsDay>): InsightsDay[] {
+ return Array.from({ length: count }, (_, i) => {
+ const d = new Date(2026, 8, 14 + i);
+ const iso = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
+ return day(iso, fill(i));
+ });
+}
+
+describe("summarize", () => {
+ it("starts at the Monday of the first active week and flags the running week", () => {
+ // Nothing for nine days, then one chat a day from Wednesday 2026-09-23.
+ const days = span(22, (i) => (i >= 9 ? { chat_messages: 1 } : {}));
+ const s = summarize(days, "all");
+
+ expect(s.weeks).toHaveLength(3);
+ expect(s.weeks[0].start.getDate()).toBe(21);
+ expect(s.weeks[0].total).toBe(5);
+ expect(s.weeks[0].partial).toBe(false);
+ expect(s.weeks[1].total).toBe(7);
+ expect(s.weeks[2].total).toBe(1);
+ expect(s.weeks[2].partial).toBe(true);
+ });
+
+ it("keeps the axis when the series changes", () => {
+ const days = span(14, (i) => (i < 7 ? { agent_sessions: 3 } : { chat_messages: 2 }));
+ expect(summarize(days, "chats").weeks).toHaveLength(2);
+ expect(summarize(days, "agents").weeks).toHaveLength(2);
+ expect(summarize(days, "chats").weeks[0].total).toBe(0);
+ });
+
+ it("counts voice as sessions plus dictations", () => {
+ const days = span(7, () => ({ voice_sessions: 1, dictations: 2, chat_messages: 5 }));
+ expect(summarize(days, "voice").last7).toBe(21);
+ expect(summarize(days, "all").last7).toBe(56);
+ });
+
+ it("averages finished weeks only and names the busiest weekday", () => {
+ const days = span(15, (i) => ({ chat_messages: i % 7 === 2 ? 10 : 1 }));
+ const s = summarize(days, "chats");
+ expect(s.avgWeek).toBe(16);
+ expect(s.topWeekday).toBe(2);
+ });
+
+ it("has no figures for an empty history", () => {
+ const s = summarize(span(10, () => ({})), "all");
+ expect(s.weeks).toHaveLength(0);
+ expect(s.avgWeek).toBeNull();
+ expect(s.topWeekday).toBeNull();
+ });
+});
+
+describe("niceCeil", () => {
+ it("rounds up to 1, 2, 2.5 or 5 times a power of ten", () => {
+ expect(niceCeil(0)).toBe(1);
+ expect(niceCeil(7)).toBe(10);
+ expect(niceCeil(18)).toBe(20);
+ expect(niceCeil(230)).toBe(250);
+ expect(niceCeil(431)).toBe(500);
+ expect(niceCeil(1001)).toBe(2000);
+ });
+});
+
+describe("weekDelta", () => {
+ it("is a whole percent, and null without a week to compare", () => {
+ expect(weekDelta(9, 7)).toBe(29);
+ expect(weekDelta(5, 10)).toBe(-50);
+ expect(weekDelta(4, 0)).toBeNull();
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/views/profile/activity.ts b/jarvis/ui/web/frontend/src/views/profile/activity.ts
new file mode 100644
index 0000000000..4b334e8e3a
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/profile/activity.ts
@@ -0,0 +1,113 @@
+/**
+ * Activity math for the profile's week chart — pure and unit-tested.
+ *
+ * The chart shows one bar per Monday-start week, from the first week that
+ * holds any activity at all (in any series), so switching between series
+ * never moves the time axis. The newest week is usually still running; it is
+ * flagged so the chart can draw it as unfinished instead of as a drop.
+ */
+import type { InsightsDay } from "@/hooks/useBoardInsights";
+
+export type SeriesId = "all" | "voice" | "chats" | "agents";
+
+export const SERIES_IDS: readonly SeriesId[] = ["all", "voice", "chats", "agents"];
+
+export interface WeekBar {
+ start: Date;
+ end: Date;
+ total: number;
+ /** Fewer than seven days so far: the current week. */
+ partial: boolean;
+}
+
+export interface ActivitySummary {
+ weeks: WeekBar[];
+ /** The top of the value axis: the busiest week rounded up to 1, 2, 2.5 or 5 × 10ⁿ. */
+ axisMax: number;
+ last7: number;
+ prev7: number;
+ /** Mean over finished weeks; null before the first week has finished. */
+ avgWeek: number | null;
+ /** 0 = Monday … 6 = Sunday; null when the series is empty. */
+ topWeekday: number | null;
+}
+
+export function dayValue(day: InsightsDay, series: SeriesId): number {
+ const voice = day.voice_sessions + day.dictations;
+ if (series === "voice") return voice;
+ if (series === "chats") return day.chat_messages;
+ if (series === "agents") return day.agent_sessions;
+ return voice + day.chat_messages + day.agent_sessions;
+}
+
+/** "2026-10-05" as local midnight; the backend's dates are local days. */
+export function parseDay(iso: string): Date {
+ const [y, m, d] = iso.split("-").map(Number);
+ return new Date(y, (m ?? 1) - 1, d ?? 1);
+}
+
+/** Monday = 0 … Sunday = 6. */
+export function weekdayIndex(date: Date): number {
+ return (date.getDay() + 6) % 7;
+}
+
+export function niceCeil(value: number): number {
+ if (value <= 0) return 1;
+ const magnitude = Math.pow(10, Math.floor(Math.log10(value)));
+ for (const step of [1, 2, 2.5, 5, 10]) {
+ if (step * magnitude >= value) return step * magnitude;
+ }
+ return 10 * magnitude;
+}
+
+export function summarize(days: readonly InsightsDay[], series: SeriesId): ActivitySummary {
+ const values = days.map((d) => dayValue(d, series));
+ const firstActive = days.findIndex((d) => dayValue(d, "all") > 0);
+
+ const weeks: WeekBar[] = [];
+ if (firstActive >= 0) {
+ // The Monday of the first active week; it can sit before the first day
+ // the backend sent, in which case that week simply starts with the data.
+ const firstMonday = firstActive - weekdayIndex(parseDay(days[firstActive].date));
+ for (let monday = firstMonday; monday < days.length; monday += 7) {
+ const from = Math.max(0, monday);
+ const to = Math.min(monday + 6, days.length - 1);
+ let total = 0;
+ for (let i = from; i <= to; i++) total += values[i];
+ weeks.push({
+ start: parseDay(days[from].date),
+ end: parseDay(days[to].date),
+ total,
+ partial: monday + 6 > days.length - 1,
+ });
+ }
+ }
+
+ const sum = (from: number, to: number) =>
+ values.slice(Math.max(0, from), Math.max(0, to)).reduce((acc, v) => acc + v, 0);
+ const n = values.length;
+ const finished = weeks.filter((w) => !w.partial);
+
+ const byWeekday = [0, 0, 0, 0, 0, 0, 0];
+ days.forEach((d, i) => {
+ byWeekday[weekdayIndex(parseDay(d.date))] += values[i];
+ });
+ const busiest = Math.max(...byWeekday);
+
+ return {
+ weeks,
+ axisMax: niceCeil(Math.max(0, ...weeks.map((w) => w.total))),
+ last7: sum(n - 7, n),
+ prev7: sum(n - 14, n - 7),
+ avgWeek: finished.length
+ ? Math.round(finished.reduce((acc, w) => acc + w.total, 0) / finished.length)
+ : null,
+ topWeekday: busiest > 0 ? byWeekday.indexOf(busiest) : null,
+ };
+}
+
+/** Week-over-week change in whole percent; null when there is no prior week to compare. */
+export function weekDelta(last7: number, prev7: number): number | null {
+ if (prev7 <= 0) return null;
+ return Math.round(((last7 - prev7) / prev7) * 100);
+}
diff --git a/jarvis/ui/web/frontend/src/views/profile/ledger.test.ts b/jarvis/ui/web/frontend/src/views/profile/ledger.test.ts
index fa564771a4..c49fbccc79 100644
--- a/jarvis/ui/web/frontend/src/views/profile/ledger.test.ts
+++ b/jarvis/ui/web/frontend/src/views/profile/ledger.test.ts
@@ -53,13 +53,13 @@ function fullMeta(): Record<string, unknown> {
// ----------------------------------------------------------------------
describe("ledger field vocabulary", () => {
- it("counts 18 fields across the five clusters", () => {
+ it("counts 19 fields across the five clusters", () => {
const sum = CLUSTER_ORDER.reduce(
(acc, cid) => acc + CLUSTER_FIELD_KEYS[cid].length,
0,
);
- expect(sum).toBe(18);
- expect(TOTAL_FIELDS).toBe(18);
+ expect(sum).toBe(19);
+ expect(TOTAL_FIELDS).toBe(19);
});
});
@@ -129,7 +129,7 @@ describe("isEmptyValue", () => {
});
describe("countFilled", () => {
- it("is 0 for an empty meta and 18 for a full meta", () => {
+ it("is 0 for an empty meta and 19 for a full meta", () => {
expect(countFilled(EMPTY_META)).toBe(0);
expect(countFilled(fullMeta())).toBe(TOTAL_FIELDS);
});
diff --git a/jarvis/ui/web/frontend/src/views/profile/ledger.ts b/jarvis/ui/web/frontend/src/views/profile/ledger.ts
index ce4885db4e..9198a09969 100644
--- a/jarvis/ui/web/frontend/src/views/profile/ledger.ts
+++ b/jarvis/ui/web/frontend/src/views/profile/ledger.ts
@@ -29,6 +29,7 @@ export const CLUSTER_FIELD_KEYS: Record<ClusterId, string[]> = {
"languages",
"timezone",
"devices",
+ "about",
],
communication: ["directness", "formality", "verbosity", "humor_types", "emoji_ok"],
work_style: ["focus_mode", "planning_horizon"],
@@ -195,7 +196,13 @@ export interface FieldRef {
* 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: "about",
+ // The self-description is edited under the name at the top of the page.
+ fields: CLUSTER_FIELD_KEYS.identity
+ .filter((field) => field !== "about")
+ .map((field) => ({ cid: "identity", field })),
+ },
{
id: "talk",
fields: CLUSTER_FIELD_KEYS.communication.map((field) => ({ cid: "communication", field })),
diff --git a/tests/unit/memory/test_user_profile.py b/tests/unit/memory/test_user_profile.py
index f690855c5e..a37d477284 100644
--- a/tests/unit/memory/test_user_profile.py
+++ b/tests/unit/memory/test_user_profile.py
@@ -237,6 +237,12 @@ class TestRenderForPrompt:
# Header is still included
assert "About the User" in out
+ def test_render_includes_the_self_description(self, profile: UserProfile) -> None:
+ profile.set("identity", "name", "Ruben")
+ profile.set("identity", "about", "Builds in public. Short answers.")
+ out = profile.render_for_prompt()
+ assert "In their own words:** Builds in public. Short answers." in out
+
def test_render_stays_within_budget(self, profile: UserProfile) -> None:
"""Even with a lot of content, rendering must not exceed the budget cap."""
profile.set("identity", "name", "Ruben")
diff --git a/tests/unit/plugins/tool/test_profile_update.py b/tests/unit/plugins/tool/test_profile_update.py
index ab12c30aaa..0dd1f7479f 100644
--- a/tests/unit/plugins/tool/test_profile_update.py
+++ b/tests/unit/plugins/tool/test_profile_update.py
@@ -35,7 +35,7 @@ def test_canonical_fields_match_matrix_ui():
matrix_fields = {
"identity": {
"name", "preferred_address", "pronouns", "primary_language",
- "languages", "timezone", "devices",
+ "languages", "timezone", "devices", "about",
},
"communication": {"directness", "formality", "verbosity", "humor_types", "emoji_ok"},
"work_style": {"focus_mode", "planning_horizon"},
diff --git a/tests/unit/ui/test_profile_field_edit.py b/tests/unit/ui/test_profile_field_edit.py
index 80f092bb4f..c5e335e108 100644
--- a/tests/unit/ui/test_profile_field_edit.py
+++ b/tests/unit/ui/test_profile_field_edit.py
@@ -93,6 +93,17 @@ def test_set_scalar_overwrites_chef_to_koenig(ctx) -> None:
assert meta["identity"]["preferred_address"] == "König" # i18n-allow
+def test_set_self_description_round_trips(ctx) -> None:
+ res = _patch(ctx.client, cluster="identity", field="about",
+ operation="set", value="Builds in public. Short answers.")
+ assert res.status_code == 200, res.text
+ meta = ctx.client.get("/api/profile").json()["user"]["meta"]
+ assert meta["identity"]["about"] == "Builds in public. Short answers."
+ res = _patch(ctx.client, cluster="identity", field="about", operation="clear")
+ assert res.status_code == 200, res.text
+ assert ctx.profile.get("identity", "about") is None
+
+
def test_set_scalar_persists_to_disk(ctx) -> None:
_patch(ctx.client, cluster="identity", field="name", operation="set", value="Paul")
# A fresh load from disk sees the write (atomic persist happened).