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(app-actions): redesign the Jarvis actions page around plain answers

rubenluetke10-beep2e24db264cde
diff --git a/jarvis/ui/web/app_actions_routes.py b/jarvis/ui/web/app_actions_routes.py
index eb263fe10a..f18fb3c5fd 100644
--- a/jarvis/ui/web/app_actions_routes.py
+++ b/jarvis/ui/web/app_actions_routes.py
@@ -52,14 +52,65 @@ def set_app_action_mode(action_id: str, body: ModeBody) -> dict[str, Any]:
return {"id": action_id, "mode": policy.get(action_id), "tier": effective_tier(entry, policy)}
+def _kind(method: str) -> str:
+ """What a call does, in the page's words: reads, changes or deletes."""
+ method = method.upper()
+ if method == "GET":
+ return "read"
+ return "delete" if method == "DELETE" else "change"
+
+
+def _describe(action_id: str, catalog: dict[str, Any]) -> dict[str, Any]:
+ """A readable name, area and kind for one history row.
+
+ Rows come from two callers: the generic app-action tool records the
+ catalog's operation id, the curated voice commands record their own
+ kebab-case id (``tasks-list``). A command is matched to the catalog entry
+ behind the same endpoint, so its row links to the permission that governs
+ it; without one it still gets the command's own title instead of its id.
+ """
+ entry = catalog.get(action_id)
+ if entry is not None:
+ return {
+ "title": entry.title,
+ "description": entry.description,
+ "area": entry.area,
+ "kind": _kind(entry.method),
+ "catalog_id": entry.id,
+ }
+ from jarvis.commands.registry import get_command
+
+ command = get_command(action_id)
+ if command is None:
+ return {"title": action_id, "description": "", "area": "", "kind": "", "catalog_id": None}
+ match = next(
+ (
+ e
+ for e in catalog.values()
+ if e.method == command.method.upper() and e.path == command.path
+ ),
+ None,
+ )
+ return {
+ "title": command.title,
+ "description": command.description,
+ "area": match.area if match else command.ui_section,
+ "kind": _kind(command.method),
+ "catalog_id": match.id if match else None,
+ }
+
+
@router.get("/history")
def app_action_history(limit: int = 50) -> dict[str, Any]:
from jarvis.app_actions import history
from jarvis.app_actions.catalog import live_catalog
catalog = live_catalog()
+ described: dict[str, dict[str, Any]] = {}
rows = []
for row in history.recent(min(max(limit, 1), 200)):
- entry = catalog.get(str(row.get("action")))
- rows.append({**row, "title": entry.title if entry else row.get("action")})
+ action_id = str(row.get("action"))
+ if action_id not in described:
+ described[action_id] = _describe(action_id, catalog)
+ rows.append({**row, **described[action_id]})
return {"history": rows}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 26690d9f24..1a8735774c 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -6713,7 +6713,7 @@
"subtitle": "Alles, was Jarvis in dieser App tun kann. Wähle pro Aktion, ob sie frei läuft, vorher nachfragt oder nie ausgeführt wird.",
"search_placeholder": "Aktionen suchen",
"area_all": "Alle Bereiche",
- "changed_only": "Nur geänderte",
+ "changed_only": "Von dir geändert",
"mode_default": "Standard",
"mode_allow": "Erlaubt",
"mode_ask": "Nachfragen",
@@ -6730,7 +6730,36 @@
"outcome_failed": "Fehlgeschlagen",
"outcome_blocked": "Gesperrt",
"load_error": "Die Aktionen konnten nicht geladen werden.",
- "save_error": "Die Änderung konnte nicht gespeichert werden."
+ "save_error": "Die Änderung konnte nicht gespeichert werden.",
+ "overview_headline": "{name} kann {count} Aktionen in dieser App nutzen",
+ "overview_hint": "Die meisten schauen nur etwas nach. Alles, was etwas ändert oder löscht, folgt den Regeln, die du hier festlegst.",
+ "group_safe": "Liest selbstständig",
+ "group_safe_hint": "Schaut nach, ändert nichts",
+ "group_monitor": "Handelt selbstständig",
+ "group_monitor_hint": "Läuft sofort und erscheint im Verlauf",
+ "group_ask": "Fragt dich vorher",
+ "group_ask_hint": "Wartet auf dein Ja",
+ "group_block": "Läuft nie",
+ "group_block_hint": "Gesperrt, auch auf Nachfrage",
+ "activity_days": "Letzte 14 Tage",
+ "activity_day_tooltip": "{ran} ausgeführt, {failed} fehlgeschlagen, {blocked} gesperrt",
+ "activity_unknown": "Ältere Einträge werden nicht aufbewahrt",
+ "history_hint": "Was {name} in der App getan hat, neueste zuerst. Klicke einen Eintrag an, um seine Berechtigung zu ändern.",
+ "did_read": "hat etwas nachgeschaut",
+ "did_change": "hat etwas geändert",
+ "did_delete": "hat etwas gelöscht",
+ "open_permission": "Berechtigung dieser Aktion anzeigen",
+ "show_older": "Ältere anzeigen",
+ "mode_allow_hint": "Läuft, ohne dich zu fragen",
+ "mode_ask_hint": "Fragt dich jedes Mal, bevor sie läuft",
+ "mode_block_hint": "Läuft nie, auch wenn du darum bittest",
+ "set_by_you": "Deine Wahl",
+ "permissions_title": "Berechtigungen",
+ "permissions_hint": "Jede Aktion, nach Bereich sortiert. Wähle, wie {name} sie nutzen darf.",
+ "focus_label": "Angezeigt: {title}",
+ "focus_clear": "Alle anzeigen",
+ "no_results": "Keine Aktion passt zu diesen Filtern.",
+ "area_other": "Sonstiges"
},
"appshots": {
"recording_title": "Bildschirmaufnahme",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 68209290d3..0943d74fda 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -6713,7 +6713,7 @@
"subtitle": "Everything Jarvis can do in this app. Choose per action whether it runs freely, asks you first, or never runs.",
"search_placeholder": "Search actions",
"area_all": "All areas",
- "changed_only": "Only changed",
+ "changed_only": "Changed by you",
"mode_default": "Default",
"mode_allow": "Allowed",
"mode_ask": "Ask",
@@ -6730,7 +6730,36 @@
"outcome_failed": "Failed",
"outcome_blocked": "Blocked",
"load_error": "Could not load the actions.",
- "save_error": "Could not save the change."
+ "save_error": "Could not save the change.",
+ "overview_headline": "{name} can use {count} actions in this app",
+ "overview_hint": "Most of them only look things up. Anything that changes or deletes something follows the rules you set here.",
+ "group_safe": "Reads on its own",
+ "group_safe_hint": "Looks things up, changes nothing",
+ "group_monitor": "Acts on its own",
+ "group_monitor_hint": "Runs right away and shows in the activity",
+ "group_ask": "Asks you first",
+ "group_ask_hint": "Waits for your yes",
+ "group_block": "Never runs",
+ "group_block_hint": "Blocked, even when asked",
+ "activity_days": "Last 14 days",
+ "activity_day_tooltip": "{ran} ran, {failed} failed, {blocked} blocked",
+ "activity_unknown": "Older entries are not kept",
+ "history_hint": "What {name} did in the app, newest first. Click an entry to change its permission.",
+ "did_read": "looked something up",
+ "did_change": "changed something",
+ "did_delete": "deleted something",
+ "open_permission": "Show this action's permission",
+ "show_older": "Show older",
+ "mode_allow_hint": "Runs without asking you",
+ "mode_ask_hint": "Asks you every time before it runs",
+ "mode_block_hint": "Never runs, even when you ask for it",
+ "set_by_you": "Your choice",
+ "permissions_title": "Permissions",
+ "permissions_hint": "Every action, grouped by area. Pick how {name} may use each one.",
+ "focus_label": "Showing: {title}",
+ "focus_clear": "Show all",
+ "no_results": "No action matches these filters.",
+ "area_other": "Other"
},
"appshots": {
"recording_title": "Screen recording",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index b9b5807760..c3f1795e2a 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -6713,7 +6713,7 @@
"subtitle": "Todo lo que Jarvis puede hacer en esta app. Elige por acción si se ejecuta libremente, pregunta antes o nunca se ejecuta.",
"search_placeholder": "Buscar acciones",
"area_all": "Todas las áreas",
- "changed_only": "Solo cambiadas",
+ "changed_only": "Cambiadas por ti",
"mode_default": "Predeterminado",
"mode_allow": "Permitida",
"mode_ask": "Preguntar",
@@ -6730,7 +6730,36 @@
"outcome_failed": "Falló",
"outcome_blocked": "Bloqueada",
"load_error": "No se pudieron cargar las acciones.",
- "save_error": "No se pudo guardar el cambio."
+ "save_error": "No se pudo guardar el cambio.",
+ "overview_headline": "{name} puede usar {count} acciones en esta app",
+ "overview_hint": "La mayoría solo consultan algo. Todo lo que cambia o elimina algo sigue las reglas que fijes aquí.",
+ "group_safe": "Lee por su cuenta",
+ "group_safe_hint": "Consulta, no cambia nada",
+ "group_monitor": "Actúa por su cuenta",
+ "group_monitor_hint": "Se ejecuta enseguida y aparece en la actividad",
+ "group_ask": "Te pregunta antes",
+ "group_ask_hint": "Espera tu sí",
+ "group_block": "Nunca se ejecuta",
+ "group_block_hint": "Bloqueada, aunque se pida",
+ "activity_days": "Últimos 14 días",
+ "activity_day_tooltip": "{ran} ejecutadas, {failed} fallidas, {blocked} bloqueadas",
+ "activity_unknown": "No se guardan entradas más antiguas",
+ "history_hint": "Lo que {name} hizo en la app, lo más reciente primero. Haz clic en una entrada para cambiar su permiso.",
+ "did_read": "consultó algo",
+ "did_change": "cambió algo",
+ "did_delete": "eliminó algo",
+ "open_permission": "Mostrar el permiso de esta acción",
+ "show_older": "Mostrar anteriores",
+ "mode_allow_hint": "Se ejecuta sin preguntarte",
+ "mode_ask_hint": "Te pregunta cada vez antes de ejecutarse",
+ "mode_block_hint": "Nunca se ejecuta, aunque lo pidas",
+ "set_by_you": "Tu elección",
+ "permissions_title": "Permisos",
+ "permissions_hint": "Cada acción, agrupada por área. Elige cómo puede usarla {name}.",
+ "focus_label": "Mostrando: {title}",
+ "focus_clear": "Mostrar todas",
+ "no_results": "Ninguna acción coincide con estos filtros.",
+ "area_other": "Otras"
},
"appshots": {
"recording_title": "Grabación de pantalla",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/zh.json b/jarvis/ui/web/frontend/src/i18n/locales/zh.json
index 4361716ce8..947593e9f1 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/zh.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/zh.json
@@ -6698,7 +6698,7 @@
"subtitle": "Jarvis 在这个应用中能做的所有事。可为每个操作选择:直接运行、先询问你,或永不运行。",
"search_placeholder": "搜索操作",
"area_all": "所有区域",
- "changed_only": "仅显示已更改",
+ "changed_only": "你更改过的",
"mode_default": "默认",
"mode_allow": "允许",
"mode_ask": "询问",
@@ -6715,7 +6715,36 @@
"outcome_failed": "失败",
"outcome_blocked": "已拦截",
"load_error": "无法加载操作。",
- "save_error": "无法保存更改。"
+ "save_error": "无法保存更改。",
+ "overview_headline": "{name} 可以在这个应用中使用 {count} 个操作",
+ "overview_hint": "大多数操作只是查询信息。任何会更改或删除内容的操作,都遵循你在这里设定的规则。",
+ "group_safe": "自行读取",
+ "group_safe_hint": "只查询,不做更改",
+ "group_monitor": "自行执行",
+ "group_monitor_hint": "立即运行,并显示在活动中",
+ "group_ask": "先询问你",
+ "group_ask_hint": "等待你的同意",
+ "group_block": "永不运行",
+ "group_block_hint": "已禁止,即使被要求也不运行",
+ "activity_days": "最近 14 天",
+ "activity_day_tooltip": "已运行 {ran} 个,失败 {failed} 个,已拦截 {blocked} 个",
+ "activity_unknown": "不保留更早的记录",
+ "history_hint": "{name} 在应用中做过的事,最新的在前。点击一条记录可更改其权限。",
+ "did_read": "查询了信息",
+ "did_change": "做了更改",
+ "did_delete": "删除了内容",
+ "open_permission": "显示此操作的权限",
+ "show_older": "显示更早的",
+ "mode_allow_hint": "不询问你直接运行",
+ "mode_ask_hint": "每次运行前都先询问你",
+ "mode_block_hint": "永不运行,即使你要求",
+ "set_by_you": "你的选择",
+ "permissions_title": "权限",
+ "permissions_hint": "所有操作按区域分组。为每个操作选择 {name} 的使用方式。",
+ "focus_label": "当前显示:{title}",
+ "focus_clear": "显示全部",
+ "no_results": "没有符合这些筛选条件的操作。",
+ "area_other": "其他"
},
"appshots": {
"recording_title": "屏幕录制",
diff --git a/jarvis/ui/web/frontend/src/lib/appActionsApi.ts b/jarvis/ui/web/frontend/src/lib/appActionsApi.ts
index 32ad558a59..843f002457 100644
--- a/jarvis/ui/web/frontend/src/lib/appActionsApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/appActionsApi.ts
@@ -25,9 +25,18 @@ export interface AppActionCatalog {
count: number;
}
+export type ActionKind = "read" | "change" | "delete";
+
export interface AppActionHistoryRow {
action: string;
+ /** A readable name: the catalog's or the voice command's title, else the raw id. */
title: string;
+ description: string;
+ area: string;
+ /** Empty when the action is no longer known to the app. */
+ kind: ActionKind | "";
+ /** The catalog entry whose permission governs this action, if any. */
+ catalog_id: string | null;
outcome: "ran" | "failed" | "blocked";
detail: string;
via: string;
diff --git a/jarvis/ui/web/frontend/src/views/JarvisActionsView.test.tsx b/jarvis/ui/web/frontend/src/views/JarvisActionsView.test.tsx
new file mode 100644
index 0000000000..3d50001eec
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/JarvisActionsView.test.tsx
@@ -0,0 +1,91 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { cleanup, fireEvent, render, screen, within } from "@testing-library/react";
+import { afterEach, beforeEach, expect, it, vi } from "vitest";
+
+import { JarvisActionsView } from "./JarvisActionsView";
+
+vi.mock("@/i18n", () => ({
+ useT: () => (key: string) => key,
+ useUiLanguage: () => "en",
+ fill: (template: string, vars: Record<string, string | number>) =>
+ template.replace(/\{(\w+)\}/g, (m, k: string) => (k in vars ? String(vars[k]) : m)),
+}));
+
+const now = Date.now() / 1000;
+const action = (id: string, area: string, title: string, method = "GET") => ({
+ id,
+ method,
+ path: `/api/${id}`,
+ area,
+ title,
+ description: "",
+ dangerous: false,
+ default_tier: method === "GET" ? "safe" : "monitor",
+ mode: null,
+ tier: method === "GET" ? "safe" : "monitor",
+});
+const catalog = {
+ actions: [
+ action("list_tasks", "tasks", "List tasks"),
+ action("rename_pane", "agentic-ide", "Rename a pane", "POST"),
+ ],
+ areas: ["agentic-ide", "tasks"],
+ count: 2,
+};
+const row = (at: number, outcome = "ran") => ({
+ action: "tasks-list",
+ title: "List tasks",
+ description: "",
+ area: "tasks",
+ kind: "read",
+ catalog_id: "list_tasks",
+ outcome,
+ detail: "",
+ via: "app-command",
+ at,
+});
+
+beforeEach(() => {
+ vi.stubGlobal(
+ "fetch",
+ vi.fn(async (url: string) =>
+ new Response(
+ JSON.stringify(
+ url.includes("/history")
+ ? { history: [row(now), row(now - 5), row(now - 10, "failed")] }
+ : catalog,
+ ),
+ ),
+ ),
+ );
+ render(
+ <QueryClientProvider client={new QueryClient()}>
+ <JarvisActionsView />
+ </QueryClientProvider>,
+ );
+});
+afterEach(() => {
+ cleanup();
+ vi.unstubAllGlobals();
+});
+
+it("names history rows, folds repeats and opens the action's permission", async () => {
+ const timeline = await screen.findByTestId("jarvis-actions-history");
+ expect(await within(timeline).findByText("×2")).toBeTruthy();
+ expect(within(timeline).getAllByText("List tasks")).toHaveLength(2);
+ expect(within(timeline).queryByText("tasks-list")).toBeNull();
+
+ fireEvent.click(within(timeline).getAllByTitle("jarvis_actions.open_permission")[0]);
+ expect(screen.getAllByTestId("jarvis-action-row")).toHaveLength(1);
+ fireEvent.click(screen.getByText("jarvis_actions.focus_clear"));
+ expect(screen.getAllByTestId("jarvis-action-row")).toHaveLength(2);
+});
+
+it("groups permissions by a readable area and filters by tier", async () => {
+ expect(await screen.findByText("Agentic IDE")).toBeTruthy();
+ const overview = screen.getByTestId("jarvis-actions-overview");
+ fireEvent.click(within(overview).getByText("jarvis_actions.group_monitor").closest("button")!);
+ const rows = screen.getAllByTestId("jarvis-action-row");
+ expect(rows).toHaveLength(1);
+ expect(within(rows[0]).getByText("Rename a pane")).toBeTruthy();
+});
diff --git a/jarvis/ui/web/frontend/src/views/JarvisActionsView.tsx b/jarvis/ui/web/frontend/src/views/JarvisActionsView.tsx
index d3d3f5baa6..f7ed4440a5 100644
--- a/jarvis/ui/web/frontend/src/views/JarvisActionsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/JarvisActionsView.tsx
@@ -1,18 +1,31 @@
-import { useMemo, useState } from "react";
+import { useMemo, useState, type ReactNode } from "react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
-import { ShieldCheck } from "lucide-react";
+import {
+ AlertTriangle,
+ Ban,
+ Check,
+ Eye,
+ PenLine,
+ Search,
+ ShieldCheck,
+ Trash2,
+ X,
+ type LucideIcon,
+} from "lucide-react";
import { PageHeader } from "@/components/layout/PageHeader";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { BrandedSelect, type BrandedSelectOption } from "@/components/ui/select";
-import { Switch } from "@/components/ui/switch";
-import { useT } from "@/i18n";
+import { fill, useT, useUiLanguage } from "@/i18n";
import {
appActionsApi,
+ type ActionKind,
type ActionMode,
+ type ActionTier,
type AppAction,
type AppActionCatalog,
+ type AppActionHistoryRow,
} from "@/lib/appActionsApi";
import { cn } from "@/lib/utils";
@@ -22,6 +35,10 @@ import { cn } from "@/lib/utils";
* the person's choice per action: Default, Allowed, Ask, Blocked. The backend
* applies the choice as the call's risk tier, so Blocked is enforced there,
* not here.
+ *
+ * The page reads top to bottom as three answers: how much Jarvis may do on
+ * its own (the overview, whose groups double as filters), what it actually
+ * did (the activity timeline), and where to change it (the permission list).
*/
const KEYS = {
@@ -29,15 +46,475 @@ const KEYS = {
history: ["app-actions", "history"] as const,
};
const PAGE = 120;
+const HISTORY_LIMIT = 200;
+const HISTORY_PAGE = 14;
+const STRIP_DAYS = 14;
const ALL = "__all__";
+const DAY_MS = 86_400_000;
type Choice = "default" | ActionMode;
-const CHOICES: readonly { value: Choice; labelKey: string }[] = [
- { value: "default", labelKey: "jarvis_actions.mode_default" },
- { value: "allow", labelKey: "jarvis_actions.mode_allow" },
- { value: "ask", labelKey: "jarvis_actions.mode_ask" },
- { value: "block", labelKey: "jarvis_actions.mode_block" },
-];
+const CHOICES: readonly Choice[] = ["default", "allow", "ask", "block"];
+const TIERS: readonly ActionTier[] = ["safe", "monitor", "ask", "block"];
+
+/** One status hue per effective tier; reading is neutral, not a signal. */
+const TIER_DOT: Record<ActionTier, string> = {
+ safe: "bg-foreground/35",
+ monitor: "bg-accent",
+ ask: "bg-warning",
+ block: "bg-destructive",
+};
+const CHOICE_DOT: Record<Choice, string> = {
+ default: "bg-foreground/35",
+ allow: "bg-success",
+ ask: "bg-warning",
+ block: "bg-destructive",
+};
+
+const KIND_ICON: Record<ActionKind, LucideIcon> = { read: Eye, change: PenLine, delete: Trash2 };
+
+function kindOf(method: string): ActionKind {
+ const m = method.toUpperCase();
+ if (m === "GET") return "read";
+ return m === "DELETE" ? "delete" : "change";
+}
+
+const ACRONYMS: Record<string, string> = {
+ ide: "IDE",
+ mcp: "MCP",
+ mcps: "MCPs",
+ cli: "CLI",
+ clis: "CLIs",
+ ws: "WS",
+ pty: "PTY",
+ api: "API",
+ ui: "UI",
+};
+
+/** `agentic-ide-git` → "Agentic IDE git": OpenAPI tags, read as words. */
+function humanArea(area: string): string {
+ const words = area
+ .split(/[-_\s]+/)
+ .filter(Boolean)
+ .map((w) => ACRONYMS[w.toLowerCase()] ?? w.toLowerCase());
+ const text = words.join(" ");
+ return text.charAt(0).toUpperCase() + text.slice(1);
+}
+
+function startOfDay(ms: number): number {
+ const d = new Date(ms);
+ d.setHours(0, 0, 0, 0);
+ return d.getTime();
+}
+
+function Skeleton({ className }: { className?: string }) {
+ return <div aria-hidden className={cn("animate-pulse rounded-md bg-foreground/10", className)} />;
+}
+
+// ---------------------------------------------------------------- overview
+
+function Overview({
+ catalog,
+ history,
+ tierFilter,
+ onTierFilter,
+}: {
+ catalog: AppActionCatalog | undefined;
+ history: AppActionHistoryRow[] | undefined;
+ tierFilter: ActionTier | null;
+ onTierFilter: (tier: ActionTier | null) => void;
+}) {
+ const t = useT();
+ const counts = useMemo(() => {
+ const out: Record<ActionTier, number> = { safe: 0, monitor: 0, ask: 0, block: 0 };
+ for (const a of catalog?.actions ?? []) out[a.tier] += 1;
+ return out;
+ }, [catalog?.actions]);
+ const total = catalog?.count ?? 0;
+
+ return (
+ <section
+ data-testid="jarvis-actions-overview"
+ className="grid gap-px overflow-hidden rounded-lg border border-border bg-border lg:grid-cols-[minmax(0,1fr)_340px]"
+ >
+ <div className="bg-card p-5">
+ {catalog ? (
+ <>
+ <p className="font-display text-xl font-semibold text-foreground-strong">
+ {fill(t("jarvis_actions.overview_headline"), { count: total.toLocaleString() })}
+ </p>
+ <p className="mt-1 text-sm text-muted-foreground">{t("jarvis_actions.overview_hint")}</p>
+ <div className="mt-5 flex h-2 w-full gap-0.5 overflow-hidden rounded-full" aria-hidden>
+ {TIERS.filter((tier) => counts[tier] > 0).map((tier) => (
+ <span
+ key={tier}
+ className={cn(
+ "h-full transition-opacity",
+ TIER_DOT[tier],
+ tierFilter && tierFilter !== tier && "opacity-25",
+ )}
+ style={{ width: `${(counts[tier] / Math.max(total, 1)) * 100}%`, minWidth: 6 }}
+ />
+ ))}
+ </div>
+ </>
+ ) : (
+ <>
+ <Skeleton className="h-7 w-80 max-w-full" />
+ <Skeleton className="mt-2 h-4 w-96 max-w-full" />
+ <Skeleton className="mt-5 h-2 w-full rounded-full" />
+ </>
+ )}
+ <div className="mt-4 grid grid-cols-2 gap-2 sm:grid-cols-4">
+ {TIERS.map((tier) => {
+ const active = tierFilter === tier;
+ return (
+ <button
+ key={tier}
+ type="button"
+ aria-pressed={active}
+ disabled={!catalog}
+ onClick={() => onTierFilter(active ? null : tier)}
+ className={cn(
+ "rounded-md border px-3 py-2.5 text-left transition-colors",
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ active
+ ? "border-accent bg-accent-soft"
+ : "border-border hover:border-border-strong hover:bg-secondary",
+ )}
+ >
+ <span className="flex items-center gap-2 text-xs font-medium text-muted-foreground">
+ <span className={cn("h-2 w-2 shrink-0 rounded-full", TIER_DOT[tier])} />
+ <span className="truncate">{t(`jarvis_actions.group_${tier}`)}</span>
+ </span>
+ {catalog ? (
+ <span className="mt-1 block text-xl font-semibold tabular-nums text-foreground-strong">
+ {counts[tier].toLocaleString()}
+ </span>
+ ) : (
+ <Skeleton className="mt-1.5 h-6 w-12" />
+ )}
+ <span className="mt-0.5 block text-xs text-foreground-faint">
+ {t(`jarvis_actions.group_${tier}_hint`)}
+ </span>
+ </button>
+ );
+ })}
+ </div>
+ </div>
+ <ActivityStrip history={history} />
+ </section>
+ );
+}
+
+/**
+ * Fourteen day columns, each stacked ran / failed / blocked. The history keeps
+ * a bounded number of entries, so days older than the oldest kept entry are
+ * drawn as "unknown", never as an invented quiet day.
+ */
+function ActivityStrip({ history }: { history: AppActionHistoryRow[] | undefined }) {
+ const t = useT();
+ const lang = useUiLanguage();
+ const days = useMemo(() => {
+ const today = startOfDay(Date.now());
+ const rows = history ?? [];
+ const capped = rows.length >= HISTORY_LIMIT;
+ const knownFrom = capped ? startOfDay(rows[rows.length - 1].at * 1000) : -Infinity;
+ return Array.from({ length: STRIP_DAYS }, (_, i) => {
+ const start = today - (STRIP_DAYS - 1 - i) * DAY_MS;
+ const tally = { ran: 0, failed: 0, blocked: 0 };
+ for (const r of rows) {
+ const at = r.at * 1000;
+ if (at >= start && at < start + DAY_MS) tally[r.outcome] += 1;
+ }
+ return { start, known: start >= knownFrom, ...tally };
+ });
+ }, [history]);
+ const totals = days.reduce(
+ (acc, d) => ({ ran: acc.ran + d.ran, failed: acc.failed + d.failed, blocked: acc.blocked + d.blocked }),
+ { ran: 0, failed: 0, blocked: 0 },
+ );
+ const peak = Math.max(1, ...days.map((d) => d.ran + d.failed + d.blocked));
+ const dateLabel = (ms: number) =>
+ new Date(ms).toLocaleDateString(lang, { day: "numeric", month: "short" });
+
+ return (
+ <div className="flex flex-col bg-card p-5">
+ <div className="flex items-baseline justify-between gap-3">
+ <span className="text-sm font-medium text-foreground">{t("jarvis_actions.activity_days")}</span>
+ {history ? (
+ <span className="text-xl font-semibold tabular-nums text-foreground-strong">
+ {(totals.ran + totals.failed + totals.blocked).toLocaleString()}
+ </span>
+ ) : (
+ <Skeleton className="h-6 w-10" />
+ )}
+ </div>
+ <div className="mt-4 flex h-24 items-end gap-1" role="img" aria-label={t("jarvis_actions.activity_days")}>
+ {days.map((d) => {
+ const sum = d.ran + d.failed + d.blocked;
+ const label = `${dateLabel(d.start)} · ${
+ d.known
+ ? fill(t("jarvis_actions.activity_day_tooltip"), {
+ ran: d.ran,
+ failed: d.failed,
+ blocked: d.blocked,
+ })
+ : t("jarvis_actions.activity_unknown")
+ }`;
+ return (
+ <div key={d.start} title={label} className="flex h-full flex-1 flex-col justify-end">
+ {!history ? (
+ <Skeleton className="h-1/3 w-full rounded-sm" />
+ ) : !d.known ? (
+ <div className="h-1 w-full rounded-full border border-dashed border-border-strong" />
+ ) : sum === 0 ? (
+ <div className="h-1 w-full rounded-full bg-foreground/10" />
+ ) : (
+ <div
+ className="flex w-full flex-col-reverse overflow-hidden rounded-sm"
+ style={{ height: `${Math.max(8, (sum / peak) * 100)}%` }}
+ >
+ <span className="bg-success/80" style={{ flexGrow: d.ran }} />
+ <span className="bg-warning" style={{ flexGrow: d.failed }} />
+ <span className="bg-destructive" style={{ flexGrow: d.blocked }} />
+ </div>
+ )}
+ </div>
+ );
+ })}
+ </div>
+ <div className="mt-1.5 flex justify-between text-xs text-foreground-faint">
+ <span>{dateLabel(days[0].start)}</span>
+ <span>{dateLabel(days[days.length - 1].start)}</span>
+ </div>
+ <div className="mt-auto flex flex-wrap gap-x-4 gap-y-1 pt-4 text-xs text-muted-foreground">
+ {(["ran", "failed", "blocked"] as const).map((o) => (
+ <span key={o} className="inline-flex items-center gap-1.5">
+ <span
+ className={cn(
+ "h-2 w-2 rounded-full",
+ o === "ran" && "bg-success/80",
+ o === "failed" && "bg-warning",
+ o === "blocked" && "bg-destructive",
+ )}
+ />
+ <span className="tabular-nums text-foreground">{totals[o]}</span>
+ {t(`jarvis_actions.outcome_${o}`)}
+ </span>
+ ))}
+ </div>
+ </div>
+ );
+}
+
+// ---------------------------------------------------------------- activity
+
+const OUTCOME_STYLE: Record<
+ AppActionHistoryRow["outcome"],
+ { icon: LucideIcon; badge: string; text: string }
+> = {
+ ran: { icon: Check, badge: "bg-success/15 text-success", text: "text-success" },
+ failed: { icon: AlertTriangle, badge: "bg-warning/15 text-warning", text: "text-warning" },
+ blocked: { icon: Ban, badge: "bg-destructive/15 text-destructive", text: "text-destructive" },
+};
+
+interface ActivityItem extends AppActionHistoryRow {
+ repeat: number;
+}
+
+/** Consecutive identical runs on one day read as one line with a count. */
+function collapse(rows: AppActionHistoryRow[]): ActivityItem[] {
+ const out: ActivityItem[] = [];
+ for (const row of rows) {
+ const last = out[out.length - 1];
+ if (
+ last &&
+ last.action === row.action &&
+ last.outcome === row.outcome &&
+ startOfDay(last.at * 1000) === startOfDay(row.at * 1000)
+ ) {
+ last.repeat += 1;
+ continue;
+ }
+ out.push({ ...row, repeat: 1 });
+ }
+ return out;
+}
+
+function ActivityTimeline({
+ history,
+ isLoading,
+ onOpen,
+}: {
+ history: AppActionHistoryRow[] | undefined;
+ isLoading: boolean;
+ onOpen: (catalogId: string) => void;
+}) {
+ const t = useT();
+ const lang = useUiLanguage();
+ const [limit, setLimit] = useState(HISTORY_PAGE);
+ const items = useMemo(() => collapse(history ?? []), [history]);
+ const shown = items.slice(0, limit);
+
+ const days = useMemo(() => {
+ const groups: { day: number; items: ActivityItem[] }[] = [];
+ for (const item of shown) {
+ const day = startOfDay(item.at * 1000);
+ const group = groups[groups.length - 1];
+ if (group && group.day === day) group.items.push(item);
+ else groups.push({ day, items: [item] });
+ }
+ return groups;
+ }, [shown]);
+
+ const dayLabel = (day: number) => {
+ const diff = Math.round((startOfDay(Date.now()) - day) / DAY_MS);
+ if (diff <= 1) {
+ const text = new Intl.RelativeTimeFormat(lang, { numeric: "auto" }).format(-diff, "day");
+ return text.charAt(0).toUpperCase() + text.slice(1);
+ }
+ return new Date(day).toLocaleDateString(lang, { weekday: "long", day: "numeric", month: "long" });
+ };
+ const time = (at: number) =>
+ new Date(at * 1000).toLocaleTimeString(lang, { hour: "2-digit", minute: "2-digit" });
+
+ return (
+ <section
+ data-testid="jarvis-actions-history"
+ className="flex min-h-0 flex-col rounded-lg border border-border bg-card"
+ >
+ <header className="border-b border-border px-5 py-4">
+ <h2 className="text-base font-semibold text-foreground-strong">
+ {t("jarvis_actions.history_title")}
+ </h2>
+ <p className="mt-0.5 text-sm text-muted-foreground">{t("jarvis_actions.history_hint")}</p>
+ </header>
+ <div className="min-h-0 flex-1 overflow-y-auto px-5 py-4 scrollbar-jarvis">
+ {isLoading ? (
+ <div className="space-y-4">
+ {Array.from({ length: 6 }, (_, i) => (
+ <div key={i} className="flex gap-3">
+ <Skeleton className="h-7 w-7 rounded-full" />
+ <div className="flex-1 space-y-1.5">
+ <Skeleton className="h-4 w-2/3" />
+ <Skeleton className="h-3 w-1/3" />
+ </div>
+ </div>
+ ))}
+ </div>
+ ) : items.length === 0 ? (
+ <div className="flex flex-col items-center py-10 text-center">
+ <span className="flex h-10 w-10 items-center justify-center rounded-full bg-secondary text-muted-foreground">
+ <ShieldCheck className="h-5 w-5" />
+ </span>
+ <p className="mt-3 max-w-xs text-sm text-muted-foreground">
+ {t("jarvis_actions.history_empty")}
+ </p>
+ </div>
+ ) : (
+ <div className="space-y-5">
+ {days.map((group) => (
+ <div key={group.day}>
+ <h3 className="mb-2 text-xs font-medium uppercase tracking-wide text-foreground-faint">
+ {dayLabel(group.day)}
+ </h3>
+ <ol className="relative">
+ {group.items.map((item, index) => {
+ const style = OUTCOME_STYLE[item.outcome];
+ const Icon = style.icon;
+ const last = index === group.items.length - 1;
+ const clickable = Boolean(item.catalog_id);
+ const meta = [
+ item.area ? humanArea(item.area) : null,
+ item.kind ? t(`jarvis_actions.did_${item.kind}`) : null,
+ ].filter(Boolean);
+ const body = (
+ <>
+ <span className="relative flex w-7 shrink-0 justify-center">
+ {!last && (
+ <span
+ aria-hidden
+ className="absolute left-1/2 top-7 h-[calc(100%-4px)] w-px -translate-x-1/2 bg-border"
+ />
+ )}
+ <span
+ className={cn(
+ "relative flex h-7 w-7 items-center justify-center rounded-full",
+ style.badge,
+ )}
+ >
+ <Icon className="h-3.5 w-3.5" strokeWidth={2.25} />
+ </span>
+ </span>
+ <span className="min-w-0 flex-1 pb-4">
+ <span className="flex items-baseline gap-2">
+ <span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">
+ {item.title}
+ </span>
+ {item.repeat > 1 && (
+ <span className="shrink-0 rounded-sm bg-secondary px-1.5 text-xs tabular-nums text-muted-foreground">
+ ×{item.repeat}
+ </span>
+ )}
+ <span className="shrink-0 text-xs tabular-nums text-foreground-faint">
+ {time(item.at)}
+ </span>
+ </span>
+ <span className="mt-0.5 block truncate text-xs text-muted-foreground">
+ <span className={style.text}>{t(`jarvis_actions.outcome_${item.outcome}`)}</span>
+ {meta.map((m) => (
+ <span key={m}> · {m}</span>
+ ))}
+ </span>
+ {item.outcome !== "ran" && item.detail && (
+ <span
+ className="mt-1.5 block line-clamp-2 rounded-md bg-secondary px-2 py-1 text-xs text-foreground-secondary"
+ title={item.detail}
+ >
+ {item.detail}
+ </span>
+ )}
+ </span>
+ </>
+ );
+ return (
+ <li key={`${item.at}-${item.action}`}>
+ {clickable ? (
+ <button
+ type="button"
+ title={t("jarvis_actions.open_permission")}
+ onClick={() => onOpen(item.catalog_id as string)}
+ className="-mx-2 flex w-[calc(100%+1rem)] gap-3 rounded-md px-2 pt-1 text-left transition-colors hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ {body}
+ </button>
+ ) : (
+ <div className="flex gap-3 pt-1">{body}</div>
+ )}
+ </li>
+ );
+ })}
+ </ol>
+ </div>
+ ))}
+ {items.length > shown.length && (
+ <Button
+ variant="outline"
+ size="sm"
+ className="w-full"
+ onClick={() => setLimit((n) => n + HISTORY_PAGE * 2)}
+ >
+ {t("jarvis_actions.show_older")}
+ </Button>
+ )}
+ </div>
+ )}
+ </div>
+ </section>
+ );
+}
+
+// ---------------------------------------------------------------- permissions
function ModeControl({
action,
@@ -52,27 +529,39 @@ function ModeControl({
<div
role="radiogroup"
aria-label={action.title}
- className="inline-flex shrink-0 rounded-lg border border-border bg-background p-0.5"
+ className="inline-flex shrink-0 rounded-md bg-secondary p-0.5"
>
- {CHOICES.map(({ value, labelKey }) => {
+ {CHOICES.map((value) => {
const active = current === value;
+ const hint =
+ value === "default"
+ ? t(`jarvis_actions.tier_${action.default_tier}`)
+ : t(`jarvis_actions.mode_${value}_hint`);
return (
<button
key={value}
type="button"
role="radio"
aria-checked={active}
+ title={hint}
onClick={() => onChange(value === "default" ? null : value)}
className={cn(
- "rounded-md px-2.5 py-1 text-xs font-medium transition-colors",
+ "inline-flex items-center gap-1.5 rounded-sm px-2.5 py-1 text-xs font-medium transition-colors",
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
active
- ? value === "block"
- ? "bg-destructive text-destructive-foreground"
- : "bg-primary text-primary-foreground"
- : "text-muted-foreground hover:bg-secondary hover:text-foreground",
+ ? "bg-card text-foreground-strong ring-1 ring-border-strong"
+ : "text-muted-foreground hover:text-foreground",
)}
>
- {t(labelKey)}
+ <span
+ aria-hidden
+ className={cn(
+ "h-1.5 w-1.5 rounded-full transition-opacity",
+ CHOICE_DOT[value],
+ !active && "opacity-40",
+ )}
+ />
+ {t(`jarvis_actions.mode_${value}`)}
</button>
);
})}
@@ -80,43 +569,83 @@ function ModeControl({
);
}
-function RecentActions() {
+function ActionRow({
+ action,
+ onChange,
+}: {
+ action: AppAction;
+ onChange: (mode: ActionMode | null) => void;
+}) {
const t = useT();
- const { data } = useQuery({
- queryKey: KEYS.history,
- queryFn: () => appActionsApi.history(30),
- });
- const rows = data?.history ?? [];
+ const kind = kindOf(action.method);
+ const Icon = KIND_ICON[kind];
return (
- <section className="rounded-xl border border-border bg-card p-5">
- <h3 className="font-medium text-foreground">{t("jarvis_actions.history_title")}</h3>
- {rows.length === 0 ? (
- <p className="mt-2 text-sm text-muted-foreground">{t("jarvis_actions.history_empty")}</p>
- ) : (
- <ul className="mt-3 divide-y divide-border">
- {rows.map((row) => (
- <li key={`${row.at}-${row.action}`} className="flex items-baseline gap-3 py-2 text-sm">
- <span
- className={cn(
- "w-24 shrink-0 text-xs font-medium",
- row.outcome === "ran" && "text-success",
- row.outcome === "failed" && "text-warning",
- row.outcome === "blocked" && "text-destructive",
- )}
- >
- {t(`jarvis_actions.outcome_${row.outcome}`)}
- </span>
- <span className="min-w-0 flex-1 truncate text-foreground" title={row.detail}>
- {row.title}
- </span>
- <span className="shrink-0 text-xs text-foreground-faint">
- {new Date(row.at * 1000).toLocaleString()}
- </span>
- </li>
- ))}
- </ul>
+ <li
+ data-testid="jarvis-action-row"
+ className="relative flex flex-wrap items-center gap-x-4 gap-y-3 px-5 py-3.5"
+ >
+ {action.mode && (
+ <span aria-hidden className="absolute inset-y-3 left-0 w-0.5 rounded-full bg-accent" />
)}
- </section>
+ <span
+ aria-hidden
+ className={cn(
+ "flex h-8 w-8 shrink-0 items-center justify-center rounded-md",
+ action.dangerous ? "bg-warning/15 text-warning" : "bg-secondary text-muted-foreground",
+ )}
+ >
+ <Icon className="h-4 w-4" />
+ </span>
+ <div className="min-w-0 flex-1 basis-64">
+ <div className="text-sm font-medium text-foreground">{action.title}</div>
+ {action.description && action.description !== action.title && (
+ <p className="mt-0.5 line-clamp-2 text-xs text-muted-foreground">{action.description}</p>
+ )}
+ <div className="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-foreground-faint">
+ <span className="inline-flex items-center gap-1.5">
+ <span className={cn("h-1.5 w-1.5 rounded-full", TIER_DOT[action.default_tier])} />
+ {t(`jarvis_actions.tier_${action.default_tier}`)}
+ </span>
+ {action.dangerous && (
+ <span className="inline-flex items-center gap-1 text-warning">
+ <AlertTriangle className="h-3 w-3" />
+ {t("jarvis_actions.dangerous")}
+ </span>
+ )}
+ {action.mode && (
+ <span className="font-medium text-accent">{t("jarvis_actions.set_by_you")}</span>
+ )}
+ </div>
+ </div>
+ <ModeControl action={action} onChange={onChange} />
+ </li>
+ );
+}
+
+function FilterChip({
+ active,
+ onClick,
+ children,
+}: {
+ active: boolean;
+ onClick: () => void;
+ children: ReactNode;
+}) {
+ return (
+ <button
+ type="button"
+ aria-pressed={active}
+ onClick={onClick}
+ className={cn(
+ "inline-flex h-9 items-center gap-2 rounded-md border px-3 text-sm transition-colors",
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ active
+ ? "border-accent bg-accent-soft text-foreground-strong"
+ : "border-border text-muted-foreground hover:bg-secondary hover:text-foreground",
+ )}
+ >
+ {children}
+ </button>
);
}
@@ -126,8 +655,14 @@ export function JarvisActionsView() {
const [query, setQuery] = useState("");
const [area, setArea] = useState(ALL);
const [changedOnly, setChangedOnly] = useState(false);
+ const [tierFilter, setTierFilter] = useState<ActionTier | null>(null);
+ const [focusId, setFocusId] = useState<string | null>(null);
const [limit, setLimit] = useState(PAGE);
const catalog = useQuery({ queryKey: KEYS.catalog, queryFn: appActionsApi.list });
+ const history = useQuery({
+ queryKey: KEYS.history,
+ queryFn: () => appActionsApi.history(HISTORY_LIMIT),
+ });
const setMode = useMutation({
mutationFn: ({ id, mode }: { id: string; mode: ActionMode | null }) =>
@@ -149,25 +684,42 @@ export function JarvisActionsView() {
const areaOptions = useMemo<BrandedSelectOption[]>(
() => [
{ value: ALL, label: t("jarvis_actions.area_all") },
- ...(catalog.data?.areas ?? []).map((a) => ({ value: a, label: a })),
+ ...(catalog.data?.areas ?? []).map((a) => ({ value: a, label: humanArea(a) })),
],
[catalog.data?.areas, t],
);
+ const changedCount = useMemo(
+ () => (catalog.data?.actions ?? []).filter((a) => a.mode).length,
+ [catalog.data?.actions],
+ );
+
const filtered = useMemo(() => {
+ const actions = catalog.data?.actions ?? [];
+ if (focusId) return actions.filter((a) => a.id === focusId);
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
- return (catalog.data?.actions ?? []).filter((a) => {
+ return actions.filter((a) => {
if (area !== ALL && a.area !== area) return false;
if (changedOnly && !a.mode) return false;
- const text = `${a.title} ${a.description} ${a.area} ${a.path}`.toLowerCase();
+ if (tierFilter && a.tier !== tierFilter) return false;
+ const text =
+ `${a.title} ${a.description} ${a.area} ${humanArea(a.area)} ${a.path}`.toLowerCase();
return words.every((w) => text.includes(w));
});
- }, [catalog.data?.actions, query, area, changedOnly]);
+ }, [catalog.data?.actions, query, area, changedOnly, tierFilter, focusId]);
const shown = filtered.slice(0, limit);
- const count = t("jarvis_actions.count")
- .replace("{shown}", String(shown.length))
- .replace("{total}", String(filtered.length));
+ const groups = useMemo(() => {
+ const out: { area: string; actions: AppAction[] }[] = [];
+ for (const action of shown) {
+ const group = out[out.length - 1];
+ if (group && group.area === action.area) group.actions.push(action);
+ else out.push({ area: action.area, actions: [action] });
+ }
+ return out;
+ }, [shown]);
+ const focused = focusId ? catalog.data?.actions.find((a) => a.id === focusId) : undefined;
+ const resetPaging = () => setLimit(PAGE);
return (
<div
@@ -181,84 +733,160 @@ export function JarvisActionsView() {
description={t("jarvis_actions.subtitle")}
/>
- <RecentActions />
-
- <section className="rounded-xl border border-border bg-card p-5">
- <div className="flex flex-wrap items-center gap-3">
- <Input
- value={query}
- onChange={(e) => {
- setQuery(e.target.value);
- setLimit(PAGE);
- }}
- placeholder={t("jarvis_actions.search_placeholder")}
- aria-label={t("jarvis_actions.search_placeholder")}
- className="max-w-sm"
- />
- <BrandedSelect
- value={area}
- options={areaOptions}
- onValueChange={(value) => {
- setArea(value);
- setLimit(PAGE);
- }}
- ariaLabel={t("jarvis_actions.area_all")}
- className="w-56"
- />
- <label className="flex items-center gap-2 text-sm text-muted-foreground">
- <Switch
- checked={changedOnly}
- onCheckedChange={setChangedOnly}
- aria-label={t("jarvis_actions.changed_only")}
- />
- {t("jarvis_actions.changed_only")}
- </label>
- <span className="ml-auto text-xs text-foreground-faint">{count}</span>
- </div>
-
- {catalog.isError && (
- <p className="mt-4 text-sm text-destructive">{t("jarvis_actions.load_error")}</p>
- )}
- {setMode.isError && (
- <p className="mt-4 text-sm text-destructive">{t("jarvis_actions.save_error")}</p>
- )}
+ <Overview
+ catalog={catalog.data}
+ history={history.data?.history}
+ tierFilter={tierFilter}
+ onTierFilter={(tier) => {
+ setTierFilter(tier);
+ setFocusId(null);
+ resetPaging();
+ }}
+ />
- <ul className="mt-4 divide-y divide-border">
- {shown.map((action) => (
- <li key={action.id} className="flex flex-wrap items-center gap-4 py-3">
- <div className="min-w-0 flex-1">
- <div className="flex flex-wrap items-baseline gap-2">
- <span className="font-medium text-foreground">{action.title}</span>
- <span className="text-xs text-foreground-faint">{action.area}</span>
- {action.dangerous && (
- <span className="text-xs text-warning">{t("jarvis_actions.dangerous")}</span>
- )}
+ <div className="grid items-start gap-5 xl:grid-cols-[minmax(0,1fr)_400px]">
+ <section className="min-w-0 rounded-lg border border-border bg-card">
+ <header className="space-y-3 border-b border-border px-5 py-4">
+ <div className="flex flex-wrap items-baseline justify-between gap-2">
+ <div>
+ <h2 className="text-base font-semibold text-foreground-strong">
+ {t("jarvis_actions.permissions_title")}
+ </h2>
+ <p className="mt-0.5 text-sm text-muted-foreground">
+ {t("jarvis_actions.permissions_hint")}
+ </p>
+ </div>
+ {catalog.data && (
+ <span className="text-xs tabular-nums text-foreground-faint">
+ {fill(t("jarvis_actions.count"), {
+ shown: shown.length,
+ total: filtered.length,
+ })}
+ </span>
+ )}
+ </div>
+ {focused ? (
+ <div className="flex items-center gap-2 rounded-md bg-accent-soft px-3 py-2 text-sm text-foreground">
+ <span className="min-w-0 flex-1 truncate">
+ {fill(t("jarvis_actions.focus_label"), { title: focused.title })}
+ </span>
+ <Button variant="ghost" size="sm" onClick={() => setFocusId(null)}>
+ <X className="h-3.5 w-3.5" />
+ {t("jarvis_actions.focus_clear")}
+ </Button>
+ </div>
+ ) : (
+ <div className="flex flex-wrap items-center gap-2">
+ <div className="relative min-w-[200px] flex-1 basis-64">
+ <Search
+ aria-hidden
+ className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-foreground-faint"
+ />
+ <Input
+ value={query}
+ onChange={(e) => {
+ setQuery(e.target.value);
+ resetPaging();
+ }}
+ placeholder={t("jarvis_actions.search_placeholder")}
+ aria-label={t("jarvis_actions.search_placeholder")}
+ className="pl-9"
+ />
</div>
- {action.description && (
- <p className="mt-0.5 line-clamp-2 text-xs text-muted-foreground">
- {action.description}
- </p>
+ <BrandedSelect
+ value={area}
+ options={areaOptions}
+ onValueChange={(value) => {
+ setArea(value);
+ resetPaging();
+ }}
+ ariaLabel={t("jarvis_actions.area_all")}
+ className="w-52"
+ />
+ <FilterChip
+ active={changedOnly}
+ onClick={() => {
+ setChangedOnly((v) => !v);
+ resetPaging();
+ }}
+ >
+ {t("jarvis_actions.changed_only")}
+ <span className="tabular-nums text-foreground-faint">{changedCount}</span>
+ </FilterChip>
+ {tierFilter && (
+ <FilterChip active onClick={() => setTierFilter(null)}>
+ <span className={cn("h-2 w-2 rounded-full", TIER_DOT[tierFilter])} />
+ {t(`jarvis_actions.group_${tierFilter}`)}
+ <X className="h-3.5 w-3.5" />
+ </FilterChip>
)}
- <p className="mt-0.5 text-xs text-foreground-faint">
- {t(`jarvis_actions.tier_${action.default_tier}`)}
- </p>
</div>
- <ModeControl
- action={action}
- onChange={(mode) => setMode.mutate({ id: action.id, mode })}
- />
- </li>
- ))}
- </ul>
+ )}
+ {catalog.isError && (
+ <p className="text-sm text-destructive">{t("jarvis_actions.load_error")}</p>
+ )}
+ {setMode.isError && (
+ <p className="text-sm text-destructive">{t("jarvis_actions.save_error")}</p>
+ )}
+ </header>
- {filtered.length > shown.length && (
- <div className="mt-4 flex justify-center">
- <Button variant="outline" size="sm" onClick={() => setLimit((n) => n + PAGE)}>
- {t("jarvis_actions.show_more")}
- </Button>
- </div>
- )}
- </section>
+ {catalog.isLoading ? (
+ <div className="divide-y divide-border">
+ {Array.from({ length: 6 }, (_, i) => (
+ <div key={i} className="flex items-center gap-4 px-5 py-4">
+ <Skeleton className="h-8 w-8" />
+ <div className="flex-1 space-y-1.5">
+ <Skeleton className="h-4 w-1/3" />
+ <Skeleton className="h-3 w-2/3" />
+ </div>
+ <Skeleton className="h-7 w-64" />
+ </div>
+ ))}
+ </div>
+ ) : catalog.data && filtered.length === 0 ? (
+ <p className="px-5 py-12 text-center text-sm text-muted-foreground">
+ {t("jarvis_actions.no_results")}
+ </p>
+ ) : (
+ groups.map((group) => (
+ <div key={group.area}>
+ <h3 className="sticky top-0 z-10 flex items-center justify-between border-b border-border bg-card/95 px-5 py-2 text-xs font-medium uppercase tracking-wide text-foreground-faint backdrop-blur">
+ <span>{group.area ? humanArea(group.area) : t("jarvis_actions.area_other")}</span>
+ <span className="tabular-nums">{group.actions.length}</span>
+ </h3>
+ <ul className="divide-y divide-border">
+ {group.actions.map((action) => (
+ <ActionRow
+ key={action.id}
+ action={action}
+ onChange={(mode) => setMode.mutate({ id: action.id, mode })}
+ />
+ ))}
+ </ul>
+ </div>
+ ))
+ )}
+
+ {filtered.length > shown.length && (
+ <div className="flex justify-center border-t border-border p-4">
+ <Button variant="outline" size="sm" onClick={() => setLimit((n) => n + PAGE)}>
+ {t("jarvis_actions.show_more")}
+ </Button>
+ </div>
+ )}
+ </section>
+
+ <div className="xl:sticky xl:top-6 xl:flex xl:max-h-[calc(100vh-3rem)] xl:flex-col">
+ <ActivityTimeline
+ history={history.data?.history}
+ isLoading={history.isLoading}
+ onOpen={(id) => {
+ setFocusId(id);
+ setTierFilter(null);
+ }}
+ />
+ </div>
+ </div>
</div>
</div>
);
diff --git a/tests/unit/app_actions/test_app_actions.py b/tests/unit/app_actions/test_app_actions.py
index 991c401b60..efa277cb78 100644
--- a/tests/unit/app_actions/test_app_actions.py
+++ b/tests/unit/app_actions/test_app_actions.py
@@ -169,6 +169,24 @@ async def test_settings_routes_list_set_and_show_history(app: FastAPI) -> None:
assert rows[0]["action"] == action_id
+async def test_history_names_a_voice_command_and_links_its_permission(app: FastAPI) -> None:
+ @app.get("/api/skills/brief", tags=["skills"])
+ async def skills_brief() -> dict[str, Any]:
+ """Brief skill list."""
+ return {"skills": []}
+
+ history.record("skills-list", "ran", "x", via="app-command")
+ history.record("no-such-command", "failed", "x")
+ transport = httpx.ASGITransport(app=app)
+ async with httpx.AsyncClient(transport=transport, base_url="http://t") as client:
+ rows = (await client.get("/api/app-actions/history?limit=2")).json()["history"]
+ unknown, command = rows
+ assert command["title"] == "List installed skills"
+ assert command["area"] == "skills" and command["kind"] == "read"
+ assert command["catalog_id"] == _id(app, "/api/skills/brief", "GET")
+ assert unknown["title"] == "no-such-command" and unknown["catalog_id"] is None
+
+
@pytest.mark.parametrize("area", ["IDE", "IDE panes and workspaces", "agentic-ide", "nonsense"])
async def test_area_is_a_hint_not_an_exact_slug(app: FastAPI, area: str) -> None:
# Live 2026-10-01: the model passed the human label from the description