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): favorite agents and insights in one centred column

rubenluetke10-beep4f0cfaf72a84
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index e751057350..b9f05909ee 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -2072,8 +2072,20 @@
"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",
+ "stat_agent_tokens": "Agent-Tokens",
+ "top_agents_title": "Lieblings-Agenten",
+ "top_agents_runs": "{0} Läufe",
+ "top_agents_runs_one": "{0} Lauf",
+ "insights_title": "Einblicke",
+ "insight_active_days": "Aktive Tage",
+ "insight_words": "Gesprochene Wörter",
+ "insight_voice_time": "Zeit in Sprachgesprächen",
+ "insight_top_coder": "Meistgenutzter Coding-Agent",
+ "insight_top_chat": "Meistgenutzter Chat",
+ "insight_record": "Rekordtag",
+ "insight_record_value": "{0} · {1} Läufe",
+ "duration_hm": "{0} Std. {1} Min.",
"groups": {
"about": {
"title": "Über dich",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index ff27df3530..21e2d6ba75 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -2105,8 +2105,20 @@
"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",
+ "stat_agent_tokens": "Agent tokens",
+ "top_agents_title": "Favorite agents",
+ "top_agents_runs": "{0} runs",
+ "top_agents_runs_one": "{0} run",
+ "insights_title": "Insights",
+ "insight_active_days": "Active days",
+ "insight_words": "Words spoken",
+ "insight_voice_time": "Time in voice calls",
+ "insight_top_coder": "Most used coding agent",
+ "insight_top_chat": "Most used chat",
+ "insight_record": "Record day",
+ "insight_record_value": "{0} · {1} runs",
+ "duration_hm": "{0} h {1} min",
"groups": {
"about": {
"title": "About you",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 5b462b6d06..a9f045208d 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -2072,8 +2072,20 @@
"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",
+ "stat_agent_tokens": "Tokens de agentes",
+ "top_agents_title": "Agentes favoritos",
+ "top_agents_runs": "{0} ejecuciones",
+ "top_agents_runs_one": "{0} ejecución",
+ "insights_title": "Datos",
+ "insight_active_days": "Días activos",
+ "insight_words": "Palabras habladas",
+ "insight_voice_time": "Tiempo en llamadas de voz",
+ "insight_top_coder": "Agente de código más usado",
+ "insight_top_chat": "Chat más usado",
+ "insight_record": "Día récord",
+ "insight_record_value": "{0} · {1} ejecuciones",
+ "duration_hm": "{0} h {1} min",
"groups": {
"about": {
"title": "Sobre ti",
diff --git a/jarvis/ui/web/frontend/src/views/ProfileView.test.tsx b/jarvis/ui/web/frontend/src/views/ProfileView.test.tsx
index 811e9c9cc8..ccddda1fea 100644
--- a/jarvis/ui/web/frontend/src/views/ProfileView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/ProfileView.test.tsx
@@ -125,8 +125,41 @@ const BASE_ROUTES: Record<string, () => RouteResult> = {
},
}),
"/api/board/bio": () => ({ body: { text: null, generated_at: null } }),
+ "/api/society/agents": () => ({
+ body: {
+ agents: [
+ { agent_id: "lead", name: "Jarvis", tier: "lead", state: "active", stats: { runs: 3 } },
+ { agent_id: "scout", name: "Scout", tier: "specialist", state: "active", stats: { runs: 40 } },
+ { agent_id: "mail", name: "E-Mail-Agent", tier: "specialist", state: "active", stats: { runs: 90 } },
+ { agent_id: "old", name: "Retired", tier: "specialist", state: "archived", stats: { runs: 500 } },
+ ],
+ },
+ }),
"/api/board/insights": () => ({
- body: { agents: { available: true, sessions: 3795, turns: 0, tokens: 0, items: [] }, days: insightsDays() },
+ body: {
+ agents: {
+ available: true,
+ sessions: 3795,
+ turns: 0,
+ tokens: 1_655_054_844,
+ items: [
+ { agent: "codex-cli", sessions: 1760, sessions_30d: 0, turns: 0, turns_30d: 0, tokens: 0, last_ms: 0 },
+ { agent: "claude-cli", sessions: 1668, sessions_30d: 0, turns: 0, turns_30d: 0, tokens: 0, last_ms: 0 },
+ ],
+ },
+ voice: { available: true, sessions: 753, turns: 0, user_words: 22160, jarvis_words: 0, seconds: 81006 },
+ dictation: { available: true, words: 4531, dictations: 142, seconds: 0 },
+ chats: {
+ available: true,
+ sessions: 0,
+ messages: 0,
+ providers: [{ provider: "claude-api", sessions: 1, messages: 175, jarvis_sessions: 0 }],
+ },
+ streak: { current_days: 11, longest_days: 24, active_days: 117, first_day: "2026-01-29" },
+ records: { best_words_day: null, best_agent_day: { date: "2026-08-11", value: 372 } },
+ punch_card: Array.from({ length: 7 }, (_, d) => Array.from({ length: 24 }, (_, h) => (d === 2 && h === 10 ? 9 : 0))),
+ days: insightsDays(),
+ },
}),
"/api/settings/agent-instructions": () => ({
body: { content: "", exists: false, filename: "George.md", template: "", char_count: 0 },
@@ -204,12 +237,36 @@ describe("details", () => {
const hero = await screen.findByTestId("profile-hero");
expect(hero.textContent).toContain("Ruben");
- expect((await screen.findByTestId("open-details")).textContent).toContain("3 of 19 details");
+ expect((await screen.findByTestId("open-details")).textContent).toContain("3/19");
const stats = screen.getByTestId("profile-stats");
await waitFor(() => expect(stats.textContent).toContain("491"));
await waitFor(() => expect(stats.textContent).toContain("3,795"));
});
+ it("shows the Jarvis agents, lead first, then by runs, without archived ones", async () => {
+ installFetchMock(BASE_ROUTES);
+ renderWithClient(<ProfileView />);
+
+ const agents = await screen.findByTestId("profile-agents");
+ await waitFor(() => expect(within(agents).getAllByRole("listitem")).toHaveLength(3));
+ const names = within(agents).getAllByRole("listitem").map((li) => li.textContent);
+ expect(names[1]).toBe("E-Mail-Agent");
+ expect(names[2]).toBe("Scout");
+ expect(agents.textContent).not.toContain("Retired");
+ });
+
+ it("lists the insight facts", async () => {
+ installFetchMock(BASE_ROUTES);
+ renderWithClient(<ProfileView />);
+
+ const insights = await screen.findByTestId("profile-insights");
+ await waitFor(() => expect(insights.textContent).toContain("117"));
+ expect(insights.textContent).toContain("9 actions");
+ expect(insights.textContent).toContain("26,691");
+ expect(insights.textContent).toContain("22 h 30 min");
+ expect(insights.textContent).toContain("Codex");
+ });
+
it("keeps the detail groups off the page until the panel opens", async () => {
installFetchMock(BASE_ROUTES);
renderWithClient(<ProfileView />);
@@ -384,17 +441,19 @@ describe("a profile the backend is not serving", () => {
});
describe("activity", () => {
- it("shows the last seven days and switches series by tab", async () => {
+ it("draws one bar per week 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);
+ const bars = await screen.findByTestId("activity-bars");
+ // Two whole weeks and the Monday still running.
+ expect(bars.children).toHaveLength(3);
+ const lastBar = () => (screen.getByTestId("activity-bars").lastElementChild?.firstElementChild as HTMLElement).style.height;
+ const before = lastBar();
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");
+ // The Monday held one chat and two agent runs; the chat series keeps one.
+ await waitFor(() => expect(lastBar()).not.toBe(before));
});
});
diff --git a/jarvis/ui/web/frontend/src/views/ProfileView.tsx b/jarvis/ui/web/frontend/src/views/ProfileView.tsx
index 215ff5e9cc..308fca4b48 100644
--- a/jarvis/ui/web/frontend/src/views/ProfileView.tsx
+++ b/jarvis/ui/web/frontend/src/views/ProfileView.tsx
@@ -1,17 +1,21 @@
/**
* ProfileView — who you are to the assistant, on one screen.
*
- * ┌──────────────────────────────────────────────┐
- * │ 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 ›] │
- * └──────────────────────────────────────────────┘
+ * [Details 4/19] [Memory and privacy]
+ * ┌──────────────────────────────────────┐
+ * │ photo · name · facts │
+ * │ a sentence or two about you │
+ * │ Conversations │ Agent runs │ … │ … │ │
+ * │ Activity All Voice Chats … │
+ * │ ▁▂▃▅▇ one bar per week │
+ * │ Favorite agents: the roster figures │
+ * │ Insights: label ……………… figure │
+ * └──────────────────────────────────────┘
*
- * 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.
+ * One centred column, top to bottom. It scrolls only when the window is too
+ * short for it. Everything else — the detail groups, the portrait, memory and
+ * privacy, the raw file — opens in a side panel from the two quiet links at
+ * the top right.
*
* The raw-file query and its live WS subscription are held HERE because both
* panels need it: the details panel parses its audit trail for provenance,
@@ -19,7 +23,7 @@
*/
import { useCallback, useMemo, useState, type ReactNode } from "react";
import { useQuery } from "@tanstack/react-query";
-import { AlertTriangle, ArrowLeft, ChevronRight, Lock, RefreshCw, UserCircle2, UserRound } from "lucide-react";
+import { AlertTriangle, ArrowLeft, Lock, RefreshCw, UserCircle2, UserRound } from "lucide-react";
import { Button } from "@/components/ui/button";
import { EmptyState } from "@/components/ui/empty-state";
@@ -30,6 +34,7 @@ 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 { FavoriteAgents, InsightList } from "@/views/profile/ProfileInsights";
import { ProfileStats } from "@/views/profile/ProfileStats";
import { SourceCard, useSourceDocument } from "@/views/profile/SourceCard";
import { fetchJson, statusOf, type ProfileResponse } from "@/views/profile/api";
@@ -65,9 +70,28 @@ export function ProfileView() {
return (
<div className="relative h-full overflow-hidden bg-background">
- <div className="h-full overflow-y-auto px-8 scrollbar-jarvis">
+ <div className="relative 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">
+ {/* Inside the scroller, so the links scroll away with the page
+ instead of floating over it. */}
+ {data && (
+ <div className="absolute right-6 top-3 z-10 flex items-center gap-1">
+ <PanelLink
+ testId="open-details"
+ icon={<UserRound />}
+ label={t("profile_view.door_details_title")}
+ count={`${filled}/${TOTAL_FIELDS}`}
+ onClick={() => setPanel("details")}
+ />
+ <PanelLink
+ testId="open-memory"
+ icon={<Lock />}
+ label={t("profile_view.memory_title")}
+ onClick={() => setPanel("memory")}
+ />
+ </div>
+ )}
+ <div className="mx-auto flex min-h-full w-full max-w-3xl flex-col justify-center gap-8 py-14">
{isLoading && <ProfileSkeleton label={t("common.loading")} />}
{error && <ProfileErrorState error={error} onRetry={() => refetch()} />}
@@ -77,27 +101,14 @@ export function ProfileView() {
<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")}
- />
- <PanelDoor
- testId="open-memory"
- icon={<Lock />}
- title={t("profile_view.memory_title")}
- sub={t("profile_view.door_memory_sub")}
- onClick={() => setPanel("memory")}
- />
- </div>
+ <FavoriteAgents />
+ <InsightList />
</>
)}
</div>
</div>
+
{data && panel === "details" && (
<ProfileDrawer
testId="details-panel"
@@ -160,17 +171,17 @@ export function ProfileView() {
);
}
-/** One of the two rows at the foot of the page; each opens a side panel. */
-function PanelDoor({
+/** A quiet text link at the top right; each opens a side panel. */
+function PanelLink({
icon,
- title,
- sub,
+ label,
+ count,
onClick,
testId,
}: {
icon: ReactNode;
- title: string;
- sub: string;
+ label: string;
+ count?: string;
onClick: () => void;
testId: string;
}) {
@@ -179,16 +190,11 @@ function PanelDoor({
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"
+ className="flex h-9 items-center gap-2 rounded-md px-2.5 text-sm text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&>svg]:h-4 [&>svg]:w-4"
>
- <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" />
+ {icon}
+ <span>{label}</span>
+ {count && <span className="tabular-nums text-muted-foreground">{count}</span>}
</button>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/profile/ActivityChart.tsx b/jarvis/ui/web/frontend/src/views/profile/ActivityChart.tsx
index 3297a5c431..8ac16d43d0 100644
--- a/jarvis/ui/web/frontend/src/views/profile/ActivityChart.tsx
+++ b/jarvis/ui/web/frontend/src/views/profile/ActivityChart.tsx
@@ -1,27 +1,22 @@
/**
- * The profile's activity block: one bar per week, beside three plain figures.
+ * The profile's activity block: one bar per week since the first active one.
*
- * 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.
+ * One hue, a recessive two-line grid, month names under the weeks that hold
+ * a month's first day. 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.
+ * shared across tabs; only the heights change. The figures about the same
+ * data (last seven days, weekly mean, busiest weekday) live in the insight
+ * list below the chart.
*/
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";
+import { SERIES_IDS, summarize, type SeriesId, type WeekBar } from "@/views/profile/activity";
const TAB_KEY: Record<SeriesId, string> = {
all: "tab_all",
@@ -37,9 +32,6 @@ const UNIT_KEY: Record<SeriesId, string> = {
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();
@@ -54,12 +46,12 @@ export function ActivityChart() {
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">
+ <section data-testid="profile-activity" aria-labelledby="profile-activity-title" className="flex flex-col gap-3">
+ <div className="flex flex-wrap items-baseline justify-between gap-x-6 gap-y-1">
+ <h2 id="profile-activity-title" className="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">
+ <div role="tablist" aria-label={t("profile_view.activity_title")} className="flex gap-4">
{SERIES_IDS.map((id) => {
const on = id === series;
return (
@@ -73,10 +65,8 @@ export function ActivityChart() {
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",
+ "rounded-sm text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ on ? "font-medium text-foreground-strong" : "text-muted-foreground hover:text-foreground",
)}
>
{t(`profile_view.${TAB_KEY[id]}`)}
@@ -87,105 +77,31 @@ export function ActivityChart() {
</div>
{!summary ? (
- <ActivitySkeleton label={t("common.loading")} />
+ <div role="status" aria-busy="true" aria-label={t("common.loading")} className="h-40 animate-pulse rounded-lg bg-secondary" />
) : 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>
+ <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" }),
+ })}
+ />
)}
</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,
@@ -231,7 +147,7 @@ function Bars({
return (
<div className="flex min-w-0 flex-1 flex-col gap-1.5">
- <div className="relative h-[clamp(5rem,16vh,9rem)]">
+ <div className="relative h-36">
<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" />
@@ -305,15 +221,3 @@ function Bars({
</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/ProfileInsights.tsx b/jarvis/ui/web/frontend/src/views/profile/ProfileInsights.tsx
new file mode 100644
index 0000000000..aaddc694a4
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/profile/ProfileInsights.tsx
@@ -0,0 +1,180 @@
+/**
+ * The lower half of the profile: the Jarvis agents used most, and a plain
+ * list of facts drawn from the activity data.
+ *
+ * Favourite agents are the society roster's own figures (the lead first,
+ * then by runs). Insights are a label on the left and the figure on the
+ * right; every row is a real number from `/api/board/insights`, and a row
+ * whose source is empty is left out rather than shown as a zero.
+ */
+import { rankAgents } from "@/components/layout/SidebarAgents";
+import { AgentSwatch } from "@/components/society/AgentSwatch";
+import { useSocietyRoster } from "@/components/society/data";
+import { useBoardInsights, type BoardInsights } from "@/hooks/useBoardInsights";
+import { fill, useT, useUiLanguage } from "@/i18n";
+import { societyDisplayName } from "@/lib/societyDisplayName";
+import { useEventStore } from "@/store/events";
+import { agentLabel, chatProviderLabel, formatDay } from "@/lib/boardInsights";
+import { summarize, weekDelta } from "@/views/profile/activity";
+
+/** A Monday, so a weekday index 0…6 maps onto Monday…Sunday. */
+const A_MONDAY = new Date(2024, 0, 1);
+
+const FAVOURITES_MAX = 8;
+
+export function FavoriteAgents() {
+ const t = useT();
+ const ui = useUiLanguage();
+ const assistantName = useEventStore((s) => s.assistantName);
+ const roster = useSocietyRoster();
+
+ // The sample roster is a stand-in for an unreachable backend; showing its
+ // invented agents here would read as the person's own.
+ const agents = roster.data && !roster.data.sample ? roster.data.agents : [];
+ const lead = agents.find((a) => a.tier === "lead" && a.lifecycle !== "archived");
+ const shown = [...(lead ? [lead] : []), ...rankAgents(agents)].slice(0, FAVOURITES_MAX);
+ if (!roster.isLoading && shown.length === 0) return null;
+
+ return (
+ <section data-testid="profile-agents" aria-labelledby="profile-agents-title" className="flex flex-col gap-3">
+ <h2 id="profile-agents-title" className="text-base font-semibold text-foreground-strong">
+ {t("profile_view.top_agents_title")}
+ </h2>
+ {roster.isLoading ? (
+ <div aria-hidden className="flex gap-3">
+ {[0, 1, 2].map((i) => (
+ <div key={i} className="h-12 w-12 animate-pulse rounded-xl bg-secondary" />
+ ))}
+ </div>
+ ) : (
+ <ul className="flex flex-wrap gap-x-3 gap-y-4">
+ {shown.map((agent) => {
+ const name = societyDisplayName(agent, assistantName);
+ const runs = agent.stats?.runs ?? 0;
+ return (
+ <li
+ key={agent.agentId}
+ title={fill(t(runs === 1 ? "profile_view.top_agents_runs_one" : "profile_view.top_agents_runs"), {
+ 0: runs.toLocaleString(ui),
+ })}
+ className="flex w-20 flex-col items-center gap-1.5"
+ >
+ <span className="flex h-12 w-12 items-center justify-center rounded-xl border border-border bg-card">
+ <AgentSwatch agent={agent} size={30} />
+ </span>
+ <span className="w-full truncate text-center text-xs text-muted-foreground">{name}</span>
+ </li>
+ );
+ })}
+ </ul>
+ )}
+ </section>
+ );
+}
+
+interface Fact {
+ label: string;
+ value: string;
+}
+
+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),
+ });
+}
+
+export function profileFacts(data: BoardInsights, t: (key: string) => string, ui: string): Fact[] {
+ const out: Fact[] = [];
+ const num = (n: number) => n.toLocaleString(ui);
+ const week = summarize(data.days, "all");
+
+ if (week.weeks.length > 0) {
+ const delta = deltaText(t, weekDelta(week.last7, week.prev7), week.last7);
+ out.push({
+ label: t("profile_view.activity_last7"),
+ value: `${num(week.last7)} ${t("profile_view.unit_all")}${delta ? ` · ${delta}` : ""}`,
+ });
+ }
+ if (week.avgWeek !== null) {
+ out.push({ label: t("profile_view.activity_avg_week"), value: num(week.avgWeek) });
+ }
+ if (week.topWeekday !== null) {
+ const day = new Date(A_MONDAY.getFullYear(), A_MONDAY.getMonth(), A_MONDAY.getDate() + week.topWeekday);
+ out.push({
+ label: t("profile_view.activity_top_day"),
+ value: day.toLocaleDateString(ui, { weekday: "long" }),
+ });
+ }
+ if (data.streak.active_days > 0) {
+ out.push({ label: t("profile_view.insight_active_days"), value: num(data.streak.active_days) });
+ }
+
+ const words = data.voice.user_words + data.dictation.words;
+ if (words > 0) out.push({ label: t("profile_view.insight_words"), value: num(words) });
+
+ if (data.voice.seconds >= 60) {
+ const minutes = Math.round(data.voice.seconds / 60);
+ out.push({
+ label: t("profile_view.insight_voice_time"),
+ value: fill(t("profile_view.duration_hm"), { 0: num(Math.floor(minutes / 60)), 1: minutes % 60 }),
+ });
+ }
+
+ const coder = data.agents.items.find((a) => a.sessions > 0);
+ if (coder) {
+ out.push({ label: t("profile_view.insight_top_coder"), value: agentLabel(coder.agent) });
+ }
+
+ const chat = [...data.chats.providers].sort((a, b) => b.messages - a.messages)[0];
+ if (chat && chat.messages > 0) {
+ out.push({ label: t("profile_view.insight_top_chat"), value: chatProviderLabel(chat.provider) });
+ }
+
+ const record = data.records.best_agent_day;
+ if (record && record.value > 0) {
+ out.push({
+ label: t("profile_view.insight_record"),
+ value: fill(t("profile_view.insight_record_value"), {
+ 0: formatDay(record.date, ui),
+ 1: num(record.value),
+ }),
+ });
+ }
+ return out;
+}
+
+export function InsightList() {
+ const t = useT();
+ const ui = useUiLanguage();
+ const insights = useBoardInsights();
+ const rows = insights.data ? profileFacts(insights.data, t, ui) : [];
+
+ return (
+ <section data-testid="profile-insights" aria-labelledby="profile-insights-title" className="flex flex-col gap-2">
+ <h2 id="profile-insights-title" className="text-base font-semibold text-foreground-strong">
+ {t("profile_view.insights_title")}
+ </h2>
+ {insights.isLoading ? (
+ <div aria-hidden className="flex flex-col">
+ {[0, 1, 2, 3].map((i) => (
+ <div key={i} className="flex items-center justify-between py-2">
+ <div className="h-3.5 w-28 animate-pulse rounded-full bg-secondary" />
+ <div className="h-3.5 w-12 animate-pulse rounded-full bg-secondary" />
+ </div>
+ ))}
+ </div>
+ ) : (
+ <dl className="flex flex-col">
+ {rows.map((row) => (
+ <div key={row.label} className="flex items-baseline justify-between gap-4 py-1.5">
+ <dt className="truncate text-sm text-muted-foreground">{row.label}</dt>
+ <dd className="shrink-0 text-sm font-medium tabular-nums text-foreground-strong">{row.value}</dd>
+ </div>
+ ))}
+ </dl>
+ )}
+ </section>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/views/profile/ProfileStats.tsx b/jarvis/ui/web/frontend/src/views/profile/ProfileStats.tsx
index 1cff40bd2b..074e90f2d0 100644
--- a/jarvis/ui/web/frontend/src/views/profile/ProfileStats.tsx
+++ b/jarvis/ui/web/frontend/src/views/profile/ProfileStats.tsx
@@ -1,6 +1,6 @@
/**
- * Four figures under the profile header: conversations, agent runs, the
- * longest streak and the current one. Each comes from a real source (the
+ * Five figures under the profile header: conversations, agent runs, agent
+ * tokens, 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.
*/
@@ -20,18 +20,18 @@ function Stat({
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>
+ <div data-testid={testId} className="flex min-w-0 flex-col items-center gap-0.5 bg-card px-3 py-3 text-center">
{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">
+ <span className="flex min-w-0 items-baseline gap-1.5">
+ <span className="truncate text-lg font-semibold tabular-nums tracking-tight text-foreground-strong">
{value}
</span>
- {note && <span className="shrink-0 text-sm text-accent">{note}</span>}
+ {note && <span className="shrink-0 text-xs text-accent">{note}</span>}
</span>
)}
+ <span className="w-full truncate text-xs text-muted-foreground">{label}</span>
</div>
);
}
@@ -52,7 +52,7 @@ export function ProfileStats() {
<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"
+ className="grid grid-cols-2 gap-px overflow-hidden rounded-xl border border-border bg-border sm:grid-cols-5 [&>*:last-child]:col-span-2 sm:[&>*:last-child]:col-span-1"
>
<Stat
label={t("profile_view.stat_conversations")}
@@ -62,6 +62,18 @@ export function ProfileStats() {
label={t("profile_view.stat_agent_runs")}
value={insights.isLoading ? null : insights.data ? num(insights.data.agents.sessions) : "–"}
/>
+ <Stat
+ label={t("profile_view.stat_agent_tokens")}
+ value={
+ insights.isLoading
+ ? null
+ : insights.data
+ ? new Intl.NumberFormat(ui, { notation: "compact", maximumFractionDigits: 2 }).format(
+ insights.data.agents.tokens,
+ )
+ : "–"
+ }
+ />
<Stat
label={t("profile_view.stat_longest_streak")}
value={summary.isLoading ? null : s ? days(s.longest_streak) : "–"}