Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
refactor(society): keep agent cards focused on chat
rubenluetke10-beepb2037205124f
diff --git a/jarvis/ui/web/frontend/src/components/society/card/AgentCardOverlay.tsx b/jarvis/ui/web/frontend/src/components/society/card/AgentCardOverlay.tsxindex 948d4131ca..369a504d3b 100644--- a/jarvis/ui/web/frontend/src/components/society/card/AgentCardOverlay.tsx+++ b/jarvis/ui/web/frontend/src/components/society/card/AgentCardOverlay.tsx@@ -1,56 +1,20 @@/**- * The agent model card: a near-full-screen window above the world, the- * world still visible through a dimmed, blurred scrim (MASTERPLAN §4.2).- * Esc and ✕ close it.- *- * The card has TWO faces, and the chat is the one you land on (maintainer,- * 2026-09-02). Read across a viewport cut into eight:- *- * chat face roster (1/8) | chat (6/8) | options (1/8)- * profile face roster (1/8) | specs | 3D figure- *- * The chat used to be a narrow third column beside the specs and the figure,- * which made the thing you actually talk to the smallest pane on screen. Now- * the chat owns the middle six eighths, the roster rail from the island moves- * in on the left so you can switch agents without closing the card, and the- * right rail holds the agent's screen, its routines, and a tucked-away Retire- * (⋯). Retire archives the row AND has the island play the execution- * (`world/retirement.ts`), which is why the card closes on its way out.- *- * Clicking the agent's identity in the header (or "Profile") turns the card- * over: specs and the 3D figure, no chat, exactly the two panes the old card- * had beside it. "Chat" turns it back.- *- * Radix Dialog gives the focus trap and Escape for free; the content is an- * inset window rather than a centred box so the stage shows around it.- * `components/layout/overlay-stacking.test.ts` guards the shell so a fixed- * overlay like this one is never trapped under the nav column.- *- * The chat column is the ordinary agent chat once the roster row carries a- * session (M2). A sample row carries none, and the column says so instead- * of inventing a transcript.+ * The agent card is a chat workspace: agent selection, conversation and actions.+ * The identity header is informational; there is no separate profile view.+ * Radix Dialog provides focus containment and Escape-to-close.*/-import { useCallback, useEffect, useState } from "react";import * as Dialog from "@radix-ui/react-dialog";-import { MessageSquare, User, X } from "lucide-react";+import { X } from "lucide-react";import { Badge } from "@/components/ui/badge";-import { Button } from "@/components/ui/button";import { useLocaleChunk, useT } from "@/i18n";-import { cn } from "@/lib/utils";import { AgentSwatch } from "../AgentSwatch";import type { SocietyAgent } from "../data";import { AgentChatPanel } from "../chat/AgentChatPanel";-import { AgentFigureViewer } from "../figures/AgentFigureViewer";import { RosterRail } from "../roster/RosterRail";-import { AgentStudio } from "./AgentStudio";-import type { FigureRecipe } from "../figures/figureRecipe";import { OptionsRail } from "./OptionsRail";-/** Which face of the card is showing. */-type CardFace = "chat" | "profile";-export interface AgentCardOverlayProps {agent: SocietyAgent | null;/** Every agent — the rail lists them, the chat @mentions them. */@@ -77,81 +41,28 @@ export function AgentCardOverlay({}: AgentCardOverlayProps) {const t = useT();useLocaleChunk("society");- const open = agent !== null;- const [face, setFace] = useState<CardFace>("chat");- const [preview, setPreview] = useState<FigureRecipe | null>(null);- const [editGuard, setEditGuard] = useState({ dirty: false, busy: false });- const updateGuard = useCallback((dirty: boolean, busy: boolean) => setEditGuard({ dirty, busy }), []);- const leaveEditor = (action: () => void) => {- if (editGuard.busy) return;- if (editGuard.dirty && !window.confirm(t("society.studio.leave"))) return;- setEditGuard({ dirty: false, busy: false });- setPreview(null);- action();- };-- // Every opening starts on the chat. The face survives a switch between- // agents inside the card — comparing two profiles is a real thing to do —- // but never leaks from one opening of the card to the next.- useEffect(() => {- if (!open) {- setFace("chat");- setPreview(null);- setEditGuard({ dirty: false, busy: false });- }- }, [open]);-return (- <Dialog.Root open={open} onOpenChange={(next) => (next ? undefined : leaveEditor(onClose))}>+ <Dialog.Root open={agent !== null} onOpenChange={(next) => (next ? undefined : onClose())}><Dialog.Portal><Dialog.Overlay className="fixed inset-0 z-40 bg-scrim/60 backdrop-blur-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-reduce:animate-none" /><Dialog.Contentdata-testid="agent-card"- data-face={face}className="fixed inset-4 z-50 flex flex-col overflow-hidden rounded-lg border border-border bg-card shadow-float focus:outline-none data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 motion-reduce:animate-none lg:inset-10">{agent ? (<><header className="flex shrink-0 items-center gap-3 border-b border-border px-5 py-3">- <button- type="button"- onClick={() => setFace("profile")}- aria-label={t("society.card.open_profile")}- data-testid="agent-card-identity"- className={cn(- "-mx-2 flex min-w-0 flex-1 items-center gap-3 rounded-md px-2 py-1 text-left transition-colors",- "hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-strong",- )}- >+ <div data-testid="agent-card-identity" className="flex min-w-0 flex-1 items-center gap-3"><AgentSwatch agent={agent} size={40} />- {/* Title and description render as spans: a heading and a- paragraph are not valid inside a button, and Radix still- wires the dialog's labelling through `asChild`. */}- <span className="min-w-0 flex-1">- <Dialog.Title asChild>- <span className="block truncate font-display text-base font-semibold tracking-tight text-foreground">- {agent.name}- </span>+ <div className="min-w-0 flex-1">+ <Dialog.Title className="truncate font-display text-base font-semibold tracking-tight text-foreground">+ {agent.name}</Dialog.Title>- <Dialog.Description asChild>- <span className="block truncate text-xs text-muted-foreground">{agent.title}</span>+ <Dialog.Description className="truncate text-xs text-muted-foreground">+ {agent.title}</Dialog.Description>- </span>- </button>- <Button- size="sm"- variant={face === "profile" ? "secondary" : "outline"}- className="gap-1.5"- onClick={() => leaveEditor(() => setFace(face === "chat" ? "profile" : "chat"))}- data-testid="agent-card-face-toggle"- >- {face === "chat" ? (- <User className="h-3.5 w-3.5" aria-hidden />- ) : (- <MessageSquare className="h-3.5 w-3.5" aria-hidden />- )}- {face === "chat" ? t("society.card.profile") : t("society.card.chat")}- </Button>+ </div>+ </div><Badge variant="outline">{t(`society.state.${agent.state}`)}</Badge><Dialog.Closearia-label={t("society.card.close")}@@ -160,58 +71,25 @@ export function AgentCardOverlay({<X className="h-4 w-4" aria-hidden /></Dialog.Close></header>- <div- className={cn(- "agent-card-layout grid min-h-0 flex-1",- face === "chat"- ? "grid-cols-[minmax(220px,1fr)_minmax(0,5fr)_minmax(300px,320px)]"- : "grid-cols-[minmax(180px,1fr)_minmax(440px,3.5fr)_minmax(260px,3.5fr)]",- )}- >+ <div className="grid min-h-0 flex-1 grid-cols-[minmax(220px,1fr)_minmax(0,5fr)_minmax(300px,320px)]"><RosterRailagents={roster}loading={rosterLoading}sample={sample}activeAgentId={agent.agentId}- onOpen={(id) => { if (id !== agent.agentId) leaveEditor(() => onSelectAgent?.(id)); }}- onCreate={() => leaveEditor(() => onCreate?.())}+ onOpen={(id) => { if (id !== agent.agentId) onSelectAgent?.(id); }}+ onCreate={() => onCreate?.()}side="left"className="w-full"/>- {face === "chat" ? (- <>- <section- className="flex min-h-0 flex-col"- aria-label={t("society.card.chat")}- data-testid="agent-card-chat"- >- <AgentChatPanel agent={agent} roster={roster} />- </section>- <OptionsRail agent={agent} onRetired={onClose} sample={sample} />- </>- ) : (- <>- {/* No app border here: the sheet is a card of the world and- carries its own edge — its parchment against the figure's- lit lobby is the separation. */}- <section- className="min-h-0"- aria-label={t("society.card.specs")}- data-testid="agent-card-specs"- >- <AgentStudio key={agent.agentId} agent={agent} sample={sample}- onOpenChat={() => leaveEditor(() => setFace("chat"))} onRetired={onClose}- onPreview={setPreview} onGuardChange={updateGuard} />- </section>- <section- className="society-figure-column relative min-h-0"- aria-label={t("society.card.figure")}- data-testid="agent-card-figure"- >- <AgentFigureViewer recipe={preview ?? agent.figure} />- </section>- </>- )}+ <section+ className="flex min-h-0 flex-col"+ aria-label={t("society.card.chat")}+ data-testid="agent-card-chat"+ >+ <AgentChatPanel agent={agent} roster={roster} />+ </section>+ <OptionsRail agent={agent} onRetired={onClose} sample={sample} /></div></>) : null}diff --git a/jarvis/ui/web/frontend/src/components/society/card/AgentStudio.test.tsx b/jarvis/ui/web/frontend/src/components/society/card/AgentStudio.test.tsxdeleted file mode 100644index c2d06488e0..0000000000--- a/jarvis/ui/web/frontend/src/components/society/card/AgentStudio.test.tsx+++ /dev/null@@ -1,137 +0,0 @@-import { QueryClient, QueryClientProvider } from "@tanstack/react-query";-import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";-import { afterEach, beforeAll, describe, expect, test, vi } from "vitest";-import { loadLocaleChunk } from "@/i18n";-import type { SocietyAgentRow } from "@/lib/societyApi";-import { rowToAgent } from "../data";-import { AgentStudio } from "./AgentStudio";-import { AgentStudioModel } from "./AgentStudioModel";-import { AgentStudioRoutines } from "./AgentStudioRoutines";-import { studioDraft, studioPatch, validStudioLimits } from "./agentStudioData";--const ROW: SocietyAgentRow = {- agent_id: "studio-test", name: "Test agent", title: "Specialist", description: "Keep notes.", tier: "specialist",- parent_agent_id: null, state: "active", avatar: { contract: 1, archetype: "biped", base: "rogue", parts: {} },- checkpoint: "idle", provider: "test-provider", model: "model-a", effort: "medium", account_id: "saved-seat",- grant_mode: "all", grants: [], focus: ["plugin:notes"], denies: ["plugin:blocked"], skills: null,- workspace_dir: "society/studio-test/workspace", wiki_namespace: "society/studio-test", knowledge_scope: "own",- permission_ceiling: "monitor", approval_rules: { require_approval: ["plugin:notes:delete"], always_allow: [] },- daily_budget_usd: 2, max_concurrent_runs: 1, browser_mode: "own", browser_allowed_domains: [], session_id: "society:studio-test",- created_ms: 1000, updated_ms: 1000, stats: { runs: 2, total_cost_usd: 0.5, last_active_ms: null },-};-const AGENT = rowToAgent(ROW);-const ok = (body: object) => new Response(JSON.stringify(body), { status: 200, headers: { "Content-Type": "application/json" } });-function wrap(node: React.ReactNode) {- const client = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } });- return <QueryClientProvider client={client}>{node}</QueryClientProvider>;-}-function props() { return { agent: AGENT, onOpenChat: vi.fn(), onRetired: vi.fn(), onPreview: vi.fn(), onGuardChange: vi.fn() }; }-beforeAll(async () => { await loadLocaleChunk("society"); });-afterEach(() => { cleanup(); vi.unstubAllGlobals(); });--describe("agent studio drafts", () => {- test("a budget edit does not overwrite instructions, tool grants or approvals", () => {- const base = studioDraft(AGENT);- expect(studioPatch(base, { ...base, dailyBudget: "0", concurrentRuns: "3" })).toEqual({ daily_budget_usd: 0, max_concurrent_runs: 3 });- });- test("rejects empty, non-finite, negative and fractional limits", () => {- const base = studioDraft(AGENT);- for (const dailyBudget of ["", " ", "-1", "Infinity", "NaN"]) expect(validStudioLimits({ ...base, dailyBudget })).toBe(false);- for (const concurrentRuns of ["", "0", "1.5", "Infinity"]) expect(validStudioLimits({ ...base, concurrentRuns })).toBe(false);- expect(validStudioLimits({ ...base, dailyBudget: "0", concurrentRuns: "2" })).toBe(true);- });- test("saves only the edited role and reports persistence", async () => {- const fetcher = vi.fn(async (_url: string, init?: RequestInit) => ok({ agent: { ...ROW, ...JSON.parse(String(init?.body ?? "{}")) } }));- vi.stubGlobal("fetch", fetcher);- render(wrap(<AgentStudio {...props()} />));- fireEvent.change(screen.getByRole("textbox", { name: "Role" }), { target: { value: "Research partner" } });- fireEvent.click(screen.getByRole("button", { name: "Save changes" }));- await screen.findByText("Changes saved");- const writes = fetcher.mock.calls.filter((call) => call[1]?.method === "PATCH");- expect(writes).toHaveLength(1);- expect(JSON.parse(String(writes[0][1]?.body))).toEqual({ title: "Research partner" });- });- test("a failed save retains the draft and allows a retry", async () => {- vi.stubGlobal("fetch", vi.fn(async () => new Response(JSON.stringify({ detail: "Save unavailable" }), { status: 503 })));- render(wrap(<AgentStudio {...props()} />));- fireEvent.change(screen.getByRole("textbox", { name: "Role" }), { target: { value: "Keep this draft" } });- fireEvent.click(screen.getByRole("button", { name: "Save changes" }));- await screen.findByRole("alert");- expect((screen.getByRole("textbox", { name: "Role" }) as HTMLInputElement).value).toBe("Keep this draft");- expect((screen.getByRole("button", { name: "Save changes" }) as HTMLButtonElement).disabled).toBe(false);- });- test("polling cannot erase a draft, and discard restores the initial values", async () => {- vi.stubGlobal("fetch", vi.fn(async () => ok({})));- const controls = props();- const client = new QueryClient();- const tree = (agent = AGENT) => <QueryClientProvider client={client}><AgentStudio {...controls} agent={agent} /></QueryClientProvider>;- const view = render(tree());- fireEvent.change(screen.getByRole("textbox", { name: "Role" }), { target: { value: "Unsaved role" } });- view.rerender(tree({ ...AGENT, state: "working" }));- expect((screen.getByRole("textbox", { name: "Role" }) as HTMLInputElement).value).toBe("Unsaved role");- expect(controls.onGuardChange).toHaveBeenLastCalledWith(true, false);- fireEvent.click(screen.getByRole("button", { name: "Discard" }));- expect((screen.getByRole("textbox", { name: "Role" }) as HTMLInputElement).value).toBe("Specialist");- });- test("appearance edits preview immediately without a write; discard restores the figure", async () => {- const fetcher = vi.fn(async () => ok({}));- vi.stubGlobal("fetch", fetcher);- const controls = props();- render(wrap(<AgentStudio {...controls} />));- fireEvent.mouseDown(screen.getByRole("tab", { name: "Appearance" }), { button: 0 });- fireEvent.click(await screen.findByRole("button", { name: "Surprise me" }));- await waitFor(() => expect(controls.onGuardChange).toHaveBeenLastCalledWith(true, false));- expect(controls.onPreview.mock.lastCall?.[0]).not.toEqual(AGENT.figure);- expect(fetcher).not.toHaveBeenCalled();- fireEvent.click(screen.getByRole("button", { name: "Discard" }));- expect(controls.onPreview.mock.lastCall?.[0]).toEqual(AGENT.figure);- });- test("sample previews never claim to save", () => {- render(wrap(<AgentStudio {...props()} sample />));- expect((screen.getByRole("button", { name: "Save changes" }) as HTMLButtonElement).disabled).toBe(true);- expect(screen.getByText(/sample agents cannot be saved/)).toBeTruthy();- });-});--test("model changes use the reseating route and preserve the saved account", async () => {- const provider = { id: ROW.provider, family: "test", label: "Test provider", runner: "api", models_source: "curated",- curated_models: [{ id: "model-a", label: "A" }, { id: "model-b", label: "B" }], default_model: "model-a", keyless: false,- native_resume: false, effort_levels: ["low", "medium"], default_effort: "medium", permission_modes: [], default_permission_mode: "", cli_installed: null };- const fetcher = vi.fn(async (url: string, init?: RequestInit) => {- if (init?.method === "POST") return ok({ agent: { ...ROW, ...JSON.parse(String(init.body)) } });- if (url.includes("/catalog")) return ok({ providers: [provider] });- if (url === "/api/jarvis-agent/status") return ok({ mapping: [{ jarvis: ROW.provider, key_set: true, api_key_set: true }] });- if (url === "/api/society/providers") return ok({ providers: [{ ...provider, subscription: false, accounts: [] }] });- return ok({ agent: ROW });- });- vi.stubGlobal("fetch", fetcher);- render(wrap(<AgentStudioModel agent={AGENT} sample={false} onGuardChange={vi.fn()} />));- await screen.findByRole("option", { name: "Test provider" });- await waitFor(() => expect(screen.getByRole("combobox", { name: "Provider" }).closest("fieldset")?.disabled).toBe(false));- fireEvent.change(screen.getByRole("combobox", { name: "Model" }), { target: { value: "model-b" } });- await waitFor(() => expect((screen.getByRole("button", { name: "Apply model" }) as HTMLButtonElement).disabled).toBe(false));- fireEvent.click(screen.getByRole("button", { name: "Apply model" }));- await screen.findByText("Changes saved");- const write = fetcher.mock.calls.find((call) => call[1]?.method === "POST");- expect(write?.[0]).toBe("/api/society/agents/studio-test/model");- expect(JSON.parse(String(write?.[1]?.body))).toEqual({ provider: ROW.provider, model: "model-b", effort: "medium", account_id: "saved-seat" });-});--test("routine creation sends the agent task and interval, and protects its draft", async () => {- const fetcher = vi.fn(async () => ok({ routines: [] }));- vi.stubGlobal("fetch", fetcher);- const guard = vi.fn();- render(wrap(<AgentStudioRoutines agentId={AGENT.agentId} sample={false} onGuardChange={guard} />));- fireEvent.click(screen.getByRole("button", { name: "Add routine" }));- fireEvent.change(screen.getByRole("textbox", { name: "Routine name" }), { target: { value: "Daily summary" } });- fireEvent.change(screen.getByRole("textbox", { name: "What should this agent do?" }), { target: { value: "Summarize the project notes." } });- expect(guard).toHaveBeenLastCalledWith(true, false);- const create = screen.getAllByRole("button", { name: "Add routine" }).find((button) => !(button as HTMLButtonElement).disabled)!;- fireEvent.click(create);- await waitFor(() => expect(screen.queryByRole("textbox", { name: "Routine name" })).toBeNull());- const calls = fetcher.mock.calls as unknown as [string, RequestInit | undefined][];- const write = calls.find((call) => call[1]?.method === "POST");- expect(write?.[0]).toBe("/api/society/agents/studio-test/routines");- expect(JSON.parse(String(write?.[1]?.body))).toEqual({ title: "Daily summary", prompt: "Summarize the project notes.", schedule: { kind: "every", interval_seconds: 86400 } });- expect(guard).toHaveBeenLastCalledWith(false, false);-});diff --git a/jarvis/ui/web/frontend/src/components/society/card/AgentStudio.tsx b/jarvis/ui/web/frontend/src/components/society/card/AgentStudio.tsxdeleted file mode 100644index 2deec33274..0000000000--- a/jarvis/ui/web/frontend/src/components/society/card/AgentStudio.tsx+++ /dev/null@@ -1,168 +0,0 @@-import { useCallback, useEffect, useId, useRef, useState } from "react";-import { useQueryClient } from "@tanstack/react-query";-import * as Tabs from "@radix-ui/react-tabs";-import { Activity, Check, Cpu, MessageSquare, Palette, Pause, Play, Save, Shield, SlidersHorizontal, UserRound } from "lucide-react";-import { useLocaleChunk, useT } from "@/i18n";-import { PERMISSION_CEILINGS } from "@/lib/societyApi";-import { rowToAgent, useSetAgentPaused, type SocietyAgent } from "../data";-import { useAgentActivity } from "../cardData";-import type { FigureRecipe } from "../figures/figureRecipe";-import { LeadBrain, LeadInstructions } from "./LeadSections";-import { RetireButton } from "./RetireButton";-import { AgentStudioRoutines } from "./AgentStudioRoutines";-import { AgentStudioAppearance } from "./AgentStudioAppearance";-import { AgentStudioModel } from "./AgentStudioModel";-import { saveStudioAgent, studioDraft, studioPatch, validStudioLimits, type StudioDraft } from "./agentStudioData";-import "./agentStudio.css";--const SECTIONS = [- { id: "profile", icon: UserRound }, { id: "model", icon: Cpu },- { id: "appearance", icon: Palette }, { id: "limits", icon: Shield }, { id: "activity", icon: Activity },-] as const;--export interface AgentStudioProps {- agent: SocietyAgent;- sample?: boolean;- onOpenChat: () => void;- onRetired: () => void;- onPreview: (recipe: FigureRecipe | null) => void;- onGuardChange: (dirty: boolean, busy: boolean) => void;-}--/** A fresh editing surface; the roster and the figure share the saved identity. */-export function AgentStudio({ agent, sample = false, onOpenChat, onRetired, onPreview, onGuardChange }: AgentStudioProps) {- useLocaleChunk("society");- const t = useT();- const id = useId();- const client = useQueryClient();- const setPaused = useSetAgentPaused();- const [base, setBase] = useState(() => studioDraft(agent));- const [draft, setDraft] = useState(base);- const [section, setSection] = useState("profile");- const [modelOpened, setModelOpened] = useState(false);- const [activityOpened, setActivityOpened] = useState(false);- const [modelGuard, setModelGuard] = useState({ dirty: false, busy: false });- const [routineGuard, setRoutineGuard] = useState({ dirty: false, busy: false });- const [busy, setBusy] = useState(false);- const [error, setError] = useState("");- const [saved, setSaved] = useState(false);- const previous = useRef(agent);- const dirty = JSON.stringify(base) !== JSON.stringify(draft);- const guard = useCallback((dirty: boolean, busy: boolean) => setModelGuard({ dirty, busy }), []);- const guardRoutine = useCallback((dirty: boolean, busy: boolean) => setRoutineGuard({ dirty, busy }), []);- useEffect(() => { onGuardChange(dirty || modelGuard.dirty || routineGuard.dirty, busy || modelGuard.busy || routineGuard.busy); }, [dirty, modelGuard, routineGuard, busy, onGuardChange]);- useEffect(() => { onPreview(draft.figure); }, [draft.figure, onPreview]);- // Background status polling may refresh the row, but never replaces an open draft.- useEffect(() => {- if (previous.current === agent) return;- previous.current = agent;- if (dirty || busy) return;- const next = studioDraft(agent);- setBase(next);- setDraft(next);- }, [agent, busy, dirty]);-- const edit = <K extends keyof StudioDraft>(key: K, value: StudioDraft[K]) => {- setDraft((current) => ({ ...current, [key]: value })); setSaved(false); setError("");- };- const save = async () => {- if (busy || !dirty || !validStudioLimits(draft) || sample) return;- setBusy(true); setError("");- try {- const row = await saveStudioAgent(agent.agentId, studioPatch(base, draft));- const next = studioDraft(rowToAgent(row));- setBase(next); setDraft(next); setSaved(true);- void client.invalidateQueries({ queryKey: ["society", "roster"] });- } catch (err) { setError(err instanceof Error ? err.message : String(err)); }- finally { setBusy(false); }- };- const paused = agent.lifecycle === "paused" || agent.state === "paused";- const togglePaused = async () => {- setBusy(true); setError("");- try { await setPaused(agent, !paused); }- catch (err) { setError(err instanceof Error ? err.message : String(err)); }- finally { setBusy(false); }- };- const lead = agent.tier === "lead";- return <div className="agent-studio" data-testid="agent-studio">- <header className="as-header">- <div className="as-eyebrow"><SlidersHorizontal size={14} aria-hidden />{t("society.studio.eyebrow")}</div>- <h2>{t("society.studio.heading")}</h2>- <p>{t("society.studio.subtitle")}</p>- <div className="as-identity"><span>{agent.name}</span><span>{t(`society.tier.${agent.tier}`)}</span><span className="as-status">{t(`society.state.${agent.state}`)}</span></div>- </header>- <Tabs.Root value={section} onValueChange={(value) => { setSection(value); if (value === "model") setModelOpened(true); if (value === "activity") setActivityOpened(true); }} className="as-tabs">- <Tabs.List className="as-tab-list" aria-label={t("society.studio.sections")}>- {SECTIONS.map(({ id, icon: Icon }) => <Tabs.Trigger className="as-tab" value={id} key={id}><Icon size={16} aria-hidden /><span>{t(`society.studio.${id}`)}</span></Tabs.Trigger>)}- </Tabs.List>- <div className="as-scroll">- <Tabs.Content value="profile" className="as-panel">- <div className="as-section-title"><h3>{t("society.studio.profile_heading")}</h3><span>01 / 05</span></div>- <fieldset className="as-stack" disabled={busy || sample}>- <label className="as-field"><span>{t("society.studio.role")}</span><input value={draft.title} onChange={(event) => edit("title", event.target.value)} placeholder={t("society.studio.role_placeholder")} /></label>- {!lead ? <label className="as-field"><span>{t("society.card.description")}</span>- <textarea value={draft.description} onChange={(event) => edit("description", event.target.value)} rows={8} placeholder={t("society.studio.instructions_placeholder")} />- <small>{t("society.studio.instructions_hint")}</small>- </label> : <LeadInstructions />}- </fieldset>- <div className="as-note"><Shield size={16} aria-hidden /><span>{t("society.studio.tools_hint")}</span></div>- <button type="button" className="as-secondary as-wide" onClick={onOpenChat}><MessageSquare size={16} aria-hidden />{t("society.studio.chat_action")}</button>- </Tabs.Content>- <Tabs.Content value="model" forceMount={modelOpened ? true : undefined} className="as-panel">- <div className="as-section-title"><h3>{t("society.studio.model_heading")}</h3><span>02 / 05</span></div>- {lead ? <><LeadBrain /><button className="as-secondary" type="button" onClick={onOpenChat}>{t("society.studio.chat_action")}</button></> : modelOpened ? <AgentStudioModel agent={agent} sample={sample} onGuardChange={guard} /> : null}- </Tabs.Content>- <Tabs.Content value="appearance" className="as-panel">- <div className="as-section-title"><h3>{t("society.studio.appearance_heading")}</h3><span>03 / 05</span></div>- <fieldset disabled={busy}><AgentStudioAppearance recipe={draft.figure} lead={lead} onChange={(recipe) => edit("figure", recipe)} /></fieldset>- </Tabs.Content>- <Tabs.Content value="limits" className="as-panel">- <div className="as-section-title"><h3>{t("society.studio.limits_heading")}</h3><span>04 / 05</span></div>- <fieldset disabled={busy || sample} className="as-stack">- <fieldset className="as-stack"><legend className="as-label">{t("society.card.permission")}</legend>- <div className="as-ceilings">{PERMISSION_CEILINGS.map((ceiling) => <label key={ceiling} className="as-ceiling" data-selected={draft.ceiling === ceiling}>- <input type="radio" name={`${id}-ceiling`} value={ceiling} checked={draft.ceiling === ceiling} onChange={() => edit("ceiling", ceiling)} />- <span><strong>{t(`society.ceiling.${ceiling}`)}</strong><small>{t(`society.studio.ceiling_${ceiling}`)}</small></span>- </label>)}</div>- </fieldset>- <div className="as-grid">- <label className="as-field"><span>{t("society.studio.budget")}</span><input type="number" min="0" step="0.01" value={draft.dailyBudget} onChange={(event) => edit("dailyBudget", event.target.value)} /><small>{t("society.studio.budget_hint")}</small></label>- <label className="as-field"><span>{t("society.studio.concurrency")}</span><input type="number" min="1" step="1" value={draft.concurrentRuns} onChange={(event) => edit("concurrentRuns", event.target.value)} /><small>{t("society.studio.concurrency_hint")}</small></label>- </div>- {!validStudioLimits(draft) ? <p className="as-error" role="alert">{t("society.studio.invalid_limits")}</p> : null}- </fieldset>- <div className="as-note">{t("society.studio.spent_today").replace("{amount}", agent.stats.spentTodayUsd.toFixed(2))}</div>- </Tabs.Content>- <Tabs.Content value="activity" forceMount={activityOpened ? true : undefined} className="as-panel">- <div className="as-section-title"><h3>{t("society.studio.activity_heading")}</h3><span>05 / 05</span></div>- <div className="as-stats"><div><strong>{agent.stats.runs}</strong><span>{t("society.card.runs")}</span></div><div><strong>${agent.stats.totalCostUsd.toFixed(2)}</strong><span>{t("society.studio.total_spent")}</span></div></div>- {activityOpened ? <AgentStudioRoutines agentId={agent.agentId} sample={sample} onGuardChange={guardRoutine} /> : null}- <StudioActivity agentId={agent.agentId} />- <div className="as-paths"><label>{t("society.card.workspace")}<code>{agent.workspaceDir}</code></label><label>{t("society.studio.notes")}<code>{agent.wikiNamespace}</code></label></div>- <div className="as-section-title"><h3>{t("society.studio.manage")}</h3></div>- <div className="as-actions"><button type="button" className="as-secondary" disabled={busy || modelGuard.busy || sample} onClick={() => void togglePaused()}>- {paused ? <Play size={15} aria-hidden /> : <Pause size={15} aria-hidden />}{t(paused ? "society.card.resume" : "society.card.pause")}- </button><fieldset disabled={busy || modelGuard.busy || routineGuard.busy || dirty || modelGuard.dirty || routineGuard.dirty || sample}><RetireButton agent={agent} onRetired={onRetired} /></fieldset></div>- </Tabs.Content>- </div>- </Tabs.Root>- <footer className="as-footer">- {error ? <p role="alert" className="as-error">{error}</p> : null}- {sample ? <p className="as-note">{t("society.studio.sample")}</p> : null}- <div className="as-save-row"><span className="as-save-status" role="status">- {saved && !dirty ? <><Check size={15} aria-hidden />{t("society.studio.saved")}</> : t(dirty ? "society.studio.unsaved" : "society.studio.ready")}- </span><button className="as-secondary" type="button" disabled={!dirty || busy} onClick={() => { setDraft(base); setSaved(false); setError(""); }}>{t("society.studio.discard")}</button>- <button type="button" className="as-primary" disabled={!dirty || busy || sample || !validStudioLimits(draft)} onClick={() => void save()}><Save size={15} aria-hidden />{t(busy ? "society.card.saving" : "society.studio.save")}</button>- </div>- </footer>- </div>;-}--function StudioActivity({ agentId }: { agentId: string }) {- const t = useT();- const activity = useAgentActivity(agentId);- return <div className="as-stack"><h3 className="as-label">{t("society.studio.recent")}</h3>- {activity.isLoading ? <p className="as-note">{t("society.studio.loading")}</p> : activity.isError ? <p className="as-error" role="alert">{t("society.studio.load_error")}</p> : !activity.data?.events.length ? <p className="as-note">{t("society.studio.no_activity")}</p> :- <ul className="as-activity">{activity.data.events.slice(0, 8).map((entry) => <li key={entry.id}><span>{entry.type}</span><p>{entry.fromAgent} → {entry.toAgent ?? agentId}</p><time dateTime={new Date(entry.tsMs).toISOString()}>{new Date(entry.tsMs).toLocaleString()}</time></li>)}</ul>}- </div>;-}diff --git a/jarvis/ui/web/frontend/src/components/society/card/AgentStudioAppearance.tsx b/jarvis/ui/web/frontend/src/components/society/card/AgentStudioAppearance.tsxdeleted file mode 100644index ed2a31814e..0000000000--- a/jarvis/ui/web/frontend/src/components/society/card/AgentStudioAppearance.tsx+++ /dev/null@@ -1,78 +0,0 @@-import { RotateCcw, Shuffle } from "lucide-react";-import { useT } from "@/i18n";-import { EDITABLE_CELLS, PALETTE_PRESETS, resolvePalette, shufflePalette, type FigureRecipe } from "../figures/figureRecipe";-import { CATALOG, catalogBaseFor, isReservedStyle, keepablePartsFor, partsForSlot, slotsWithParts } from "../figures/figureRegistry";--export function AgentStudioAppearance({ recipe, onChange, lead }: {- recipe: FigureRecipe;- onChange: (recipe: FigureRecipe) => void;- lead: boolean;-}) {- const t = useT();- const palette = resolvePalette(recipe);- const base = catalogBaseFor(recipe);- const slots = recipe.model ? [] : slotsWithParts(recipe.archetype, recipe.style ?? null, base?.family ?? null, base?.fitSize ?? null);- return (- <div className="as-stack">- <div className="as-note">{t("society.studio.preview_hint")}</div>- {!lead ? <label className="as-field">- <span>{t("society.studio.character")}</span>- <select value={recipe.model ? "imported" : base?.id ?? `${recipe.archetype}/${recipe.base}`} onChange={(event) => {- const next = CATALOG.bases.find((entry) => entry.id === event.target.value);- if (!next) return;- onChange({ contract: 1, archetype: next.archetype, base: next.base, style: next.styles[0],- heightM: next.heightM, palette: { ...next.palette },- parts: keepablePartsFor(recipe.parts, next.archetype, next.styles[0], next.family ?? null, next.fitSize) });- }}>- {recipe.model ? <option value="imported">{t("society.studio.imported")}</option> : null}- {CATALOG.bases.filter((entry) => !entry.styles.some(isReservedStyle)).map((entry) => <option key={entry.id} value={entry.id}>{entry.label}</option>)}- </select>- </label> : null}- <div className="as-section-title"><h3>{t("society.studio.palette")}</h3>- <button type="button" className="as-text-button" onClick={() => onChange({ ...recipe, palette: shufflePalette() })}>- <Shuffle size={14} aria-hidden />{t("society.studio.shuffle")}- </button>- </div>- <div className="as-presets">- {PALETTE_PRESETS.map((preset) => <button type="button" key={preset.id}- className="as-preset" onClick={() => onChange({ ...recipe, palette: { ...preset.palette } })}>- <span className="as-preset-colors" aria-hidden>{["primary", "secondary", "accent"].map((cell) =>- <span key={cell} style={{ backgroundColor: preset.palette[cell as "primary"] }} />)}</span>- {t(`society.presets.${preset.labelKey}`)}- </button>)}- </div>- <div className="as-color-grid">- {EDITABLE_CELLS.map((cell) => <label key={cell} className="as-color">- <input type="color" value={palette[cell]} onChange={(event) => {- const next = { ...recipe.palette, [cell]: event.target.value };- if (cell === "skin") delete next.skin_shade;- if (cell === "primary") delete next.primary_shade;- if (cell === "secondary") delete next.secondary_shade;- onChange({ ...recipe, palette: next });- }} />- <span>{t(`society.cell.${cell}`)}</span>- <small>{palette[cell].toUpperCase()}</small>- </label>)}- </div>- {slots.length ? <h3 className="as-section-title">{t("society.studio.wardrobe")}</h3> : null}- <div className="as-grid">- {slots.map((slot) => <label className="as-field" key={slot}>- <span>{t(`society.slot.${slot}`)}</span>- <select value={recipe.parts[slot] ?? ""} onChange={(event) => onChange({ ...recipe, parts: { ...recipe.parts, [slot]: event.target.value } })}>- <option value="">{t("society.studio.none")}</option>- {partsForSlot(slot, recipe.archetype, recipe.style ?? null, base?.family ?? null, base?.fitSize ?? null)- .map((part) => <option key={part.id} value={part.id}>{part.label}</option>)}- </select>- </label>)}- </div>- <label className="as-field"><span>{t("society.create.height")} <output>{(recipe.heightM ?? base?.heightM ?? 1.75).toFixed(2)} m</output></span>- <input type="range" min={recipe.model ? 0.6 : (base?.heightM ?? 1.75) * 0.75}- max={recipe.model ? 2.4 : (base?.heightM ?? 1.75) * 1.25} step="0.01"- value={recipe.heightM ?? base?.heightM ?? 1.75} onChange={(event) => onChange({ ...recipe, heightM: Number(event.target.value) })} />- </label>- <button className="as-text-button" type="button" onClick={() => onChange({ ...recipe, palette: {}, heightM: base?.heightM, parts: {} })}>- <RotateCcw size={14} aria-hidden />{t("society.studio.reset_look")}- </button>- </div>- );-}diff --git a/jarvis/ui/web/frontend/src/components/society/card/AgentStudioModel.tsx b/jarvis/ui/web/frontend/src/components/society/card/AgentStudioModel.tsxdeleted file mode 100644index a83d4b6821..0000000000--- a/jarvis/ui/web/frontend/src/components/society/card/AgentStudioModel.tsx+++ /dev/null@@ -1,142 +0,0 @@-import { useEffect, useMemo, useState } from "react";-import { useQuery, useQueryClient } from "@tanstack/react-query";-import { Check, Save } from "lucide-react";-import { useT } from "@/i18n";-import { fetchAgentChatCatalog, fetchAgentConnections, fetchProviderModels, type CuratedModel } from "@/lib/agentChatApi";-import { fetchSocietyProviders, type SocietyAgentRow } from "@/lib/societyApi";-import { joinProviderOptions } from "@/store/agentChat";-import { brainSeats, effortsFor, modelsFor } from "../create/brainPicker";-import type { SocietyAgent } from "../data";-import { saveStudioAgent } from "./agentStudioData";--export function AgentStudioModel({ agent, sample, onGuardChange }: {- agent: SocietyAgent;- sample: boolean;- onGuardChange: (dirty: boolean, busy: boolean) => void;-}) {- const t = useT();- const client = useQueryClient();- const [selection, setSelection] = useState({ provider: agent.provider, model: agent.model, effort: agent.effort, account_id: "" });- const [initial, setInitial] = useState<typeof selection | null>(null);- const [busy, setBusy] = useState(false);- const [error, setError] = useState("");- const [saved, setSaved] = useState(false);- const catalog = useQuery({- queryKey: ["society", "studio-model-catalog"],- queryFn: async () => {- const [catalog, connections, providers] = await Promise.all([- fetchAgentChatCatalog("society"), fetchAgentConnections(), fetchSocietyProviders(),- ]);- return { catalog, connections, providers };- },- enabled: !sample, staleTime: 60_000, retry: false,- });- const current = useQuery({- queryKey: ["society", "studio-model", agent.agentId],- queryFn: async () => {- const response = await fetch(`/api/society/agents/${encodeURIComponent(agent.agentId)}`);- if (!response.ok) throw new Error(`Agent settings ${response.status}`);- return (await response.json() as { agent: SocietyAgentRow }).agent;- },- enabled: !sample, retry: false,- });- useEffect(() => {- if (initial || !current.data) return;- const { provider, model, effort, account_id } = current.data;- const next = { provider, model, effort, account_id };- setInitial(next);- setSelection(next);- }, [current.data, initial]);-- const liveIds = useMemo(() => (catalog.data?.catalog.providers ?? [])- .filter((provider) => provider.models_source === "live" && (provider.keyless || provider.id === selection.provider))- .map((provider) => provider.id), [catalog.data, selection.provider]);- const live = useQuery({- queryKey: ["society", "studio-live-models", liveIds],- queryFn: async () => Object.fromEntries(await Promise.all(liveIds.map(async (id) => [id,- (await fetchProviderModels(id)).map((model): CuratedModel => ({ id: model.id, label: model.label ?? model.name ?? model.id })),- ]))),- enabled: Boolean(catalog.data), retry: false, staleTime: 60_000,- });- const seats = useMemo(() => {- if (!catalog.data) return [];- const { catalog: rows, connections, providers } = catalog.data;- return brainSeats(joinProviderOptions(rows.providers, connections), providers, live.data ?? {}, new Set(connections.map((row) => row.jarvis)));- }, [catalog.data, live.data]);- const seat = seats.find((entry) => entry.provider.id === selection.provider) ?? null;- const models = modelsFor(seat);- const efforts = effortsFor(seat, selection.model);- const dirty = Boolean(initial && JSON.stringify(initial) !== JSON.stringify(selection));- useEffect(() => { onGuardChange(dirty, busy); }, [dirty, busy, onGuardChange]);- const change = (next: typeof selection) => { setSelection(next); setSaved(false); setError(""); };- const save = async () => {- if (busy || !dirty || !seat) return;- setBusy(true);- setError("");- try {- const row = await saveStudioAgent(agent.agentId, selection, true);- const next = { provider: row.provider, model: row.model, effort: row.effort, account_id: row.account_id };- setSelection(next);- setInitial(next);- setSaved(true);- void client.invalidateQueries({ queryKey: ["society", "roster"] });- void client.invalidateQueries({ queryKey: ["society", "studio-model", agent.agentId] });- void client.invalidateQueries({ queryKey: ["agent-chat"] });- } catch (err) { setError(err instanceof Error ? err.message : String(err)); }- finally { setBusy(false); }- };- const loading = catalog.isLoading || current.isLoading;- const failed = catalog.isError || current.isError || live.isError;- return <div className="as-stack">- <p className="as-note">{t("society.studio.model_hint")}</p>- {sample ? <p className="as-note">{t("society.studio.sample")}</p> : null}- {loading ? <p role="status">{t("society.chat.models_loading")}</p> : null}- {failed ? <div role="alert" className="as-error">{t("society.studio.load_error")}- <button type="button" className="as-text-button" onClick={() => { void catalog.refetch(); void current.refetch(); void live.refetch(); }}>{t("society.studio.retry")}</button>- </div> : null}- <fieldset disabled={busy || loading || sample || !initial} className="as-stack">- <label className="as-field"><span>{t("society.studio.provider")}</span>- <select value={selection.provider} onChange={(event) => {- const next = seats.find((entry) => entry.provider.id === event.target.value);- if (!next) return;- const model = next.provider.default_model;- const ladder = effortsFor(next, model);- change({ provider: next.provider.id, model, effort: ladder.includes(next.provider.default_effort) ? next.provider.default_effort : ladder[0] ?? "", account_id: "" });- }}>- {!seat ? <option value={selection.provider}>{selection.provider || t("society.card.default_brain")}</option> : null}- {seats.map((entry) => <option value={entry.provider.id} key={entry.provider.id}>{entry.provider.label}</option>)}- </select>- </label>- <label className="as-field"><span>{t("society.chat.model")}</span>- <input list={`studio-models-${agent.agentId}`} value={selection.model} onChange={(event) => {- const ladder = effortsFor(seat, event.target.value);- change({ ...selection, model: event.target.value, effort: ladder.includes(selection.effort) ? selection.effort : ladder[0] ?? "" });- }} placeholder={t("society.chat.model_provider_default")} />- <datalist id={`studio-models-${agent.agentId}`}>{models.map((model) => <option key={model.id} value={model.id}>{model.label}</option>)}</datalist>- </label>- <label className="as-field"><span>{t("society.chat.effort")}</span>- <select value={selection.effort} onChange={(event) => change({ ...selection, effort: event.target.value })}>- <option value="">{t("society.chat.effort_default")}</option>- {selection.effort && !efforts.includes(selection.effort) ? <option value={selection.effort}>{selection.effort}</option> : null}- {efforts.filter(Boolean).map((effort) => <option key={effort} value={effort}>{effort}</option>)}- </select>- </label>- {seat?.kind === "subscription" ? <label className="as-field"><span>{t("society.studio.account")}</span>- <select value={selection.account_id} onChange={(event) => change({ ...selection, account_id: event.target.value })}>- <option value="">{t("society.studio.active_account")}</option>- {selection.account_id && !seat.accounts.some((account) => account.id === selection.account_id) ? <option value={selection.account_id}>{t("society.studio.saved_account")}</option> : null}- {seat.accounts.map((account) => <option key={account.id} value={account.id}>{account.label}</option>)}- </select>- </label> : null}- </fieldset>- {!loading && !failed && !sample && !seat ? <p className="as-note">{t("society.studio.connect_hint")}</p> : null}- {error ? <p className="as-error" role="alert">{error}</p> : null}- <div className="as-model-actions">- <span role="status">{saved ? <><Check size={14} aria-hidden />{t("society.studio.saved")}</> : dirty ? t("society.studio.unsaved") : ""}</span>- <button type="button" className="as-secondary" disabled={!dirty || busy} onClick={() => { if (initial) change(initial); }}>{t("society.studio.discard")}</button>- <button type="button" className="as-primary" disabled={!dirty || busy || !seat || failed} onClick={() => void save()}>- <Save size={15} aria-hidden />{t(busy ? "society.card.saving" : "society.studio.save_model")}- </button>- </div>- </div>;-}diff --git a/jarvis/ui/web/frontend/src/components/society/card/AgentStudioRoutines.tsx b/jarvis/ui/web/frontend/src/components/society/card/AgentStudioRoutines.tsxdeleted file mode 100644index ab63891219..0000000000--- a/jarvis/ui/web/frontend/src/components/society/card/AgentStudioRoutines.tsx+++ /dev/null@@ -1,53 +0,0 @@-import { useEffect, useState } from "react";-import { useQueryClient } from "@tanstack/react-query";-import { Plus } from "lucide-react";-import { useT } from "@/i18n";-import { useAgentRoutines } from "../cardData";--export function AgentStudioRoutines({ agentId, sample, onGuardChange }: {- agentId: string;- sample: boolean;- onGuardChange: (dirty: boolean, busy: boolean) => void;-}) {- const t = useT();- const client = useQueryClient();- const routines = useAgentRoutines(sample ? null : agentId);- const [open, setOpen] = useState(false);- const [title, setTitle] = useState("");- const [prompt, setPrompt] = useState("");- const [hours, setHours] = useState("24");- const [busy, setBusy] = useState(false);- const [error, setError] = useState("");- const dirty = Boolean(title || prompt || hours !== "24");- useEffect(() => { onGuardChange(dirty, busy); }, [dirty, busy, onGuardChange]);- const reset = () => { setTitle(""); setPrompt(""); setHours("24"); setError(""); setOpen(false); };- const valid = title.trim() && prompt.trim() && Number.isFinite(Number(hours)) && Number(hours) >= 1;- const create = async () => {- if (!valid || sample || busy) return;- setBusy(true); setError("");- try {- const response = await fetch(`/api/society/agents/${encodeURIComponent(agentId)}/routines`, {- method: "POST", headers: { "Content-Type": "application/json" },- body: JSON.stringify({ title: title.trim(), prompt: prompt.trim(), schedule: { kind: "every", interval_seconds: Number(hours) * 3600 } }),- });- if (!response.ok) throw new Error(`${t("society.studio.routine_error")} (HTTP ${response.status})`);- reset();- void client.invalidateQueries({ queryKey: ["society", "agent-routines", agentId] });- } catch (err) { setError(err instanceof Error ? err.message : String(err)); }- finally { setBusy(false); }- };- return <section className="as-stack">- <div className="as-section-title"><h3>{t("society.card.routines")}</h3>- <button type="button" className="as-text-button" disabled={sample || open} onClick={() => setOpen(true)}><Plus size={15} aria-hidden />{t("society.studio.add_routine")}</button>- </div>- {open ? <fieldset disabled={busy} className="as-stack">- <label className="as-field"><span>{t("society.studio.routine_title")}</span><input autoFocus value={title} maxLength={200} onChange={(event) => setTitle(event.target.value)} /></label>- <label className="as-field"><span>{t("society.studio.routine_task")}</span><textarea rows={3} maxLength={16000} value={prompt} onChange={(event) => setPrompt(event.target.value)} /></label>- <label className="as-field"><span>{t("society.studio.routine_hours")}</span><input type="number" min="1" step="1" value={hours} onChange={(event) => setHours(event.target.value)} /></label>- <div className="as-actions"><button type="button" className="as-primary" disabled={!valid || busy} onClick={() => void create()}>{t(busy ? "society.card.saving" : "society.studio.add_routine")}</button>- <button type="button" className="as-secondary" onClick={reset}>{t("society.studio.discard")}</button></div>- {error ? <p role="alert" className="as-error">{error}</p> : null}- </fieldset> : null}- {routines.data?.length ? <ul className="as-activity">{routines.data.map((routine) => <li key={routine.id}><strong>{routine.title.replace(/^\[agent:[^\]]+\]\s*/i, "")}</strong><p>{routine.schedule}</p></li>)}</ul> : <p className="as-note">{t("society.card.no_routines")}</p>}- </section>;-}diff --git a/jarvis/ui/web/frontend/src/components/society/card/agentStudio.css b/jarvis/ui/web/frontend/src/components/society/card/agentStudio.cssdeleted file mode 100644index 2ee3814ceb..0000000000--- a/jarvis/ui/web/frontend/src/components/society/card/agentStudio.css+++ /dev/null@@ -1,84 +0,0 @@-.agent-studio { height:100%; min-height:0; display:flex; flex-direction:column; color:hsl(var(--foreground)); background:hsl(var(--background)); font-family:var(--font-sans, Inter, sans-serif); }-.as-header { padding:26px 28px 20px; border-bottom:1px solid hsl(var(--border)); background:linear-gradient(120deg,hsl(var(--primary)/.08),transparent 75%); }-.as-eyebrow { display:flex; align-items:center; gap:8px; color:hsl(var(--muted-foreground)); font-size:11px; font-weight:650; letter-spacing:.15em; text-transform:uppercase; }-.as-header h2 { margin:12px 0 6px; font-family:"Space Grotesk",sans-serif; font-size:clamp(23px,2vw,32px); line-height:1.2; font-weight:600; letter-spacing:-.04em; }-.as-header > p { color:hsl(var(--muted-foreground)); font-size:13px; line-height:1.6; }-.as-identity { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-top:18px; font-size:12px; }-.as-identity > span:first-child { font-weight:650; }-.as-identity > span:not(:first-child) { padding:3px 8px; border:1px solid hsl(var(--border)); border-radius:5px; color:hsl(var(--muted-foreground)); }-.as-identity .as-status { margin-left:auto; }-.as-tabs { display:flex; flex:1; flex-direction:column; min-height:0; }-.as-tab-list { display:flex; flex-shrink:0; gap:4px; padding:10px 20px 0; border-bottom:1px solid hsl(var(--border)); overflow-x:auto; }-.as-tab { display:flex; flex:1; justify-content:center; align-items:center; gap:7px; min-height:44px; padding:8px; white-space:nowrap; border-bottom:2px solid transparent; color:hsl(var(--muted-foreground)); font-size:12px; font-weight:550; }-.as-tab[data-state=active] { border-color:hsl(var(--primary)); color:hsl(var(--foreground)); background:hsl(var(--primary)/.07); }-.as-scroll { overflow:auto; flex:1; min-height:0; scrollbar-gutter:stable; }-.as-panel { padding:24px 28px 32px; display:flex; flex-direction:column; gap:22px; }-.as-panel[data-state=inactive] { display:none; }-.as-section-title { display:flex; align-items:center; justify-content:space-between; gap:12px; font-size:14px; font-weight:600; }-.as-section-title > span { color:hsl(var(--muted-foreground)); font-size:10px; font-family:monospace; }-.as-stack { display:flex; flex-direction:column; gap:16px; min-width:0; }-.as-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }-.as-field { display:flex; min-width:0; flex-direction:column; gap:8px; font-size:13px; }-.as-field > span,.as-label { font-weight:600; font-size:12px; }-.as-field > span { display:flex; justify-content:space-between; gap:10px; }-.as-field small,.as-note { color:hsl(var(--muted-foreground)); font-size:12px; font-weight:400; line-height:1.6; }-.as-field input:not([type=range]),.as-field select,.as-field textarea { width:100%; min-width:0; min-height:44px; padding:10px 12px; border:1px solid hsl(var(--border)); border-radius:7px; background:hsl(var(--card)); color:hsl(var(--foreground)); font-size:13px; line-height:1.5; }-.as-field textarea { resize:vertical; min-height:150px; }-.as-field input[type=range] { width:100%; min-height:32px; accent-color:hsl(var(--primary)); }-.as-note { display:flex; align-items:flex-start; gap:10px; }-.as-note > svg { flex-shrink:0; margin-top:2px; }-.agent-studio button { cursor:pointer; transition:background-color 150ms,color 150ms,border-color 150ms; }-.agent-studio :is(button,input,select,textarea):focus-visible { outline:2px solid hsl(var(--ring)); outline-offset:3px; }-.agent-studio button:disabled,.agent-studio fieldset:disabled { opacity:.55; }-.agent-studio button:disabled { cursor:not-allowed; }-.as-primary,.as-secondary,.as-text-button { display:inline-flex; align-items:center; justify-content:center; gap:7px; min-height:40px; padding:8px 12px; border-radius:7px; font-size:12px; font-weight:550; }-.as-primary { background:hsl(var(--primary)); color:hsl(var(--primary-foreground)); border:1px solid hsl(var(--primary)); }-.as-primary:hover:not(:disabled) { background:hsl(var(--primary)/.85); }-.as-secondary { background:hsl(var(--card)); border:1px solid hsl(var(--border)); }-.as-secondary:hover:not(:disabled),.as-preset:hover,.as-tab:hover { background:hsl(var(--secondary)); }-.as-text-button { color:hsl(var(--muted-foreground)); padding:5px 0; justify-content:flex-start; }-.as-text-button:hover { color:hsl(var(--foreground)); }-.as-wide { width:100%; justify-content:flex-start; }-.as-footer { padding:14px 20px; border-top:1px solid hsl(var(--border)); background:hsl(var(--card)); display:flex; flex-direction:column; gap:10px; }-.as-save-row,.as-model-actions,.as-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }-.as-save-status,.as-model-actions > span { display:flex; align-items:center; gap:6px; margin-right:auto; font-size:11px; color:hsl(var(--muted-foreground)); }-.as-error { color:hsl(var(--destructive)); font-size:12px; line-height:1.5; overflow-wrap:anywhere; }-.as-ceilings { display:flex; flex-direction:column; gap:8px; }-.as-ceiling { display:flex; align-items:center; gap:12px; border:1px solid hsl(var(--border)); padding:13px; border-radius:7px; cursor:pointer; }-.as-ceiling[data-selected=true] { border-color:hsl(var(--primary)); background:hsl(var(--primary)/.07); }-.as-ceiling input { accent-color:hsl(var(--primary)); }-.as-ceiling strong,.as-ceiling small { display:block; font-size:12px; }-.as-ceiling small { color:hsl(var(--muted-foreground)); margin-top:4px; font-weight:400; }-.as-presets { display:grid; grid-template-columns:repeat(auto-fit,minmax(84px,1fr)); gap:8px; }-.as-preset { border:1px solid hsl(var(--border)); border-radius:7px; padding:9px; font-size:11px; text-align:left; }-.as-preset-colors { display:flex; height:22px; border-radius:3px; overflow:hidden; margin-bottom:8px; }-.as-preset-colors > span { flex:1; }-.as-color-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }-.as-color { display:grid; grid-template-columns:38px 1fr; align-items:center; column-gap:10px; padding:8px; border:1px solid hsl(var(--border)); border-radius:7px; font-size:12px; }-.as-color input { grid-row:span 2; width:36px; height:36px; cursor:pointer; background:none; border:0; }-.as-color small { color:hsl(var(--muted-foreground)); font-size:10px; font-family:monospace; }-.as-stats { display:grid; grid-template-columns:1fr 1fr; border:1px solid hsl(var(--border)); border-radius:8px; }-.as-stats > div { display:flex; flex-direction:column; gap:4px; padding:16px; }-.as-stats > div + div { border-left:1px solid hsl(var(--border)); }-.as-stats strong { font-size:24px; font-family:"Space Grotesk",sans-serif; }-.as-stats span,.as-paths { font-size:12px; color:hsl(var(--muted-foreground)); }-.as-paths { display:flex; flex-direction:column; gap:14px; }-.as-paths code { display:block; margin-top:4px; overflow-wrap:anywhere; color:hsl(var(--foreground)); }-.as-activity li { border-bottom:1px solid hsl(var(--border)); padding:10px 0; font-size:12px; }-.as-activity li > span { color:hsl(var(--muted-foreground)); font-size:10px; text-transform:uppercase; }-.as-activity p { overflow-wrap:anywhere; margin-top:4px; }-@media(max-width:1100px) { .as-header { padding:20px; } .as-panel { padding:20px; } .as-tab-list { padding-inline:8px; } .as-tab { flex-direction:column; gap:4px; font-size:10px; } }-@media(prefers-reduced-motion:reduce) { .agent-studio button { transition:none; } }-@media(max-width:1000px) {- [data-face=profile] .agent-card-layout { grid-template-columns:minmax(400px,1fr) minmax(0,.8fr); }- [data-face=profile] .agent-card-layout > :first-child { display:none; }-}-@media(max-width:740px) {- [data-face=profile] .agent-card-layout { display:flex; flex-direction:column; overflow-y:auto; }- [data-face=profile] [data-testid=agent-card-specs] { flex-shrink:0; height:max(620px,calc(100dvh - 110px)); }- [data-face=profile] [data-testid=agent-card-figure] { flex-shrink:0; height:320px; }- .as-header,.as-panel { padding:18px 16px; }- .as-grid { grid-template-columns:minmax(0,1fr); }- .as-field input:not([type=range]),.as-field select,.as-field textarea { font-size:16px; }- .as-save-status { flex-basis:100%; }-}diff --git a/jarvis/ui/web/frontend/src/components/society/card/agentStudioData.ts b/jarvis/ui/web/frontend/src/components/society/card/agentStudioData.tsdeleted file mode 100644index 1d8ca7aea7..0000000000--- a/jarvis/ui/web/frontend/src/components/society/card/agentStudioData.ts+++ /dev/null@@ -1,58 +0,0 @@-import type { SocietyAgentRow } from "@/lib/societyApi";-import { defaultFigureFor, type SocietyAgent } from "../data";-import type { FigureRecipe } from "../figures/figureRecipe";--export interface StudioDraft {- title: string;- description: string;- dailyBudget: string;- concurrentRuns: string;- ceiling: SocietyAgent["permissionCeiling"];- figure: FigureRecipe;-}--export function studioDraft(agent: SocietyAgent): StudioDraft {- return {- title: agent.title,- description: agent.description,- dailyBudget: String(agent.dailyBudgetUsd),- concurrentRuns: String(agent.maxConcurrentRuns),- ceiling: agent.permissionCeiling,- figure: agent.figure ?? defaultFigureFor(agent.agentId, agent.tier),- };-}--/** Only edited fields cross the wire: unrelated saves cannot re-derive focus. */-export function studioPatch(base: StudioDraft, draft: StudioDraft) {- const patch: Partial<Pick<SocietyAgentRow,- "title" | "description" | "daily_budget_usd" | "max_concurrent_runs" | "permission_ceiling" | "avatar"- >> = {};- if (base.title !== draft.title) patch.title = draft.title.trim();- if (base.description !== draft.description) patch.description = draft.description;- if (base.dailyBudget !== draft.dailyBudget) patch.daily_budget_usd = Number(draft.dailyBudget);- if (base.concurrentRuns !== draft.concurrentRuns) patch.max_concurrent_runs = Number(draft.concurrentRuns);- if (base.ceiling !== draft.ceiling) patch.permission_ceiling = draft.ceiling;- if (JSON.stringify(base.figure) !== JSON.stringify(draft.figure)) patch.avatar = { ...draft.figure };- return patch;-}--export function validStudioLimits(draft: StudioDraft): boolean {- const budget = Number(draft.dailyBudget);- const runs = Number(draft.concurrentRuns);- return draft.dailyBudget.trim() !== "" && Number.isFinite(budget) && budget >= 0- && draft.concurrentRuns.trim() !== "" && Number.isSafeInteger(runs) && runs >= 1;-}--export async function saveStudioAgent(agentId: string, body: object, model = false): Promise<SocietyAgentRow> {- const response = await fetch(`/api/society/agents/${encodeURIComponent(agentId)}${model ? "/model" : ""}`, {- method: model ? "POST" : "PATCH",- headers: { "Content-Type": "application/json" },- body: JSON.stringify(body),- });- const payload = await response.json() as { agent?: SocietyAgentRow; detail?: unknown };- if (!response.ok || !payload.agent) {- const detail = payload.detail;- throw new Error(typeof detail === "string" ? detail : `Save failed (HTTP ${response.status})`);- }- return payload.agent;-}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json b/jarvis/ui/web/frontend/src/i18n/locales/society/de.jsonindex 63c7c92077..d514ff76a0 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json@@ -1,72 +1,5 @@{"society": {- "studio": {- "add_routine": "Routine hinzufügen",- "routine_title": "Name der Routine",- "routine_task": "Was soll dieser Agent tun?",- "routine_hours": "Wiederholen alle (Stunden)",- "routine_error": "Die Routine konnte nicht erstellt werden.",- "eyebrow": "Agenten-Studio",- "heading": "Mach diesen Agenten zu deinem.",- "subtitle": "Gestalte, wie er denkt, arbeitet und aussieht.",- "sections": "Agenten-Einstellungen",- "profile": "Profil",- "model": "Modell",- "appearance": "Aussehen",- "limits": "Grenzen",- "activity": "Aktivität",- "profile_heading": "Eine klare Rolle. Deine Anweisungen.",- "model_heading": "Wähle, wie er denkt.",- "appearance_heading": "Gib ihm einen Charakter.",- "limits_heading": "Lege seine Grenzen fest.",- "activity_heading": "Arbeit, Routinen und Aktionen.",- "role": "Rolle",- "role_placeholder": "Wofür ist dieser Agent zuständig?",- "instructions_placeholder": "Beschreibe seine Aufgabe, Prioritäten und wie er mit dir arbeiten soll.",- "instructions_hint": "Diese Anweisungen gelten für künftige Aufgaben. Bestehende Werkzeugpräferenzen und Freigaberegeln bleiben erhalten.",- "tools_hint": "Der Werkzeugzugriff richtet sich nach verbundenen Werkzeugen und den Berechtigungen des Agenten. Ändere seinen Fokus oder fordere neue Fähigkeiten im Chat an.",- "chat_action": "Agenten-Chat öffnen",- "preview_hint": "Änderungen erscheinen sofort an der Figur. Speichere, wenn dir das Ergebnis gefällt.",- "character": "Figur",- "imported": "Deine importierte Figur",- "palette": "Farbpalette",- "shuffle": "Überrasch mich",- "wardrobe": "Kleidung & Zubehör",- "none": "Keine",- "reset_look": "Farben und Zubehör zurücksetzen",- "provider": "Anbieter",- "account": "Konto",- "active_account": "Aktives Konto",- "saved_account": "Gespeichertes Konto",- "model_hint": "Wähle einen verbundenen Anbieter, ein Modell und die Denktiefe. Modelländerungen werden separat gespeichert; der Gesprächsverlauf bleibt erhalten.",- "connect_hint": "Verbinde diesen Anbieter unter Agenten oder API-Schlüssel, um hier sein Modell zu ändern.",- "save_model": "Modell übernehmen",- "budget": "Tagesbudget (USD)",- "budget_hint": "0 bedeutet unbegrenzt. Das Budget wird um Mitternacht UTC zurückgesetzt.",- "concurrency": "Parallele Aufgaben",- "concurrency_hint": "Maximale Anzahl gleichzeitig laufender Aufgaben.",- "ceiling_safe": "Nur Werkzeuge der Stufe Sicher zulassen.",- "ceiling_monitor": "Werkzeuge der Stufen Sicher und Überwachen zulassen.",- "ceiling_ask": "Auch Werkzeuge zulassen, die eine Freigabe benötigen.",- "invalid_limits": "Gib ein Budget ab 0 und eine ganze Anzahl von mindestens 1 Aufgabe ein.",- "spent_today": "Heute ausgegeben: ${amount}",- "total_spent": "Gesamtausgaben",- "notes": "Wiki-Notizen",- "manage": "Agent verwalten",- "recent": "Letzte Aktivitäten",- "loading": "Aktivitäten werden geladen…",- "no_activity": "Noch keine Aktivität. Gib diesem Agenten im Chat seine erste Aufgabe.",- "saved": "Änderungen gespeichert",- "unsaved": "Ungespeicherte Änderungen",- "ready": "Bereit zum Bearbeiten",- "save": "Änderungen speichern",- "discard": "Verwerfen",- "sample": "Nur Vorschau: Beispielagenten können nicht auf dem Server gespeichert werden.",- "load_error": "Diese Einstellungen konnten nicht geladen werden.",- "retry": "Erneut versuchen",- "leave": "Ungespeicherte Änderungen am Agenten verwerfen?",- "saving_wait": "Bitte warte, bis das Speichern abgeschlossen ist."- },"world": {"talk_kind_query": "fragt","talk_kind_answer": "antwortet",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json b/jarvis/ui/web/frontend/src/i18n/locales/society/en.jsonindex d84cbc4336..c9f8e4454d 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json@@ -1,72 +1,5 @@{"society": {- "studio": {- "add_routine": "Add routine",- "routine_title": "Routine name",- "routine_task": "What should this agent do?",- "routine_hours": "Repeat every (hours)",- "routine_error": "Could not create the routine.",- "eyebrow": "Agent studio",- "heading": "Make this agent yours.",- "subtitle": "Shape how it thinks, works and looks.",- "sections": "Agent settings",- "profile": "Profile",- "model": "Model",- "appearance": "Appearance",- "limits": "Limits",- "activity": "Activity",- "profile_heading": "A clear role. Your instructions.",- "model_heading": "Choose how it thinks.",- "appearance_heading": "Give it a character.",- "limits_heading": "Set its boundaries.",- "activity_heading": "Work, routines and actions.",- "role": "Role",- "role_placeholder": "What is this agent responsible for?",- "instructions_placeholder": "Describe its job, priorities and how it should work with you.",- "instructions_hint": "These instructions guide future tasks. Existing tool preferences and approval rules are preserved.",- "tools_hint": "Tool access follows your connected tools and this agent’s permissions. Use its chat to change its focus or request new capabilities.",- "chat_action": "Open agent chat",- "preview_hint": "Changes appear on the figure immediately. Save when you like the result.",- "character": "Character",- "imported": "Your imported character",- "palette": "Color palette",- "shuffle": "Surprise me",- "wardrobe": "Clothing & accessories",- "none": "None",- "reset_look": "Reset colors and accessories",- "provider": "Provider",- "account": "Account",- "active_account": "Active account",- "saved_account": "Saved account",- "model_hint": "Choose a connected provider, model and thinking effort. Model changes are saved separately and keep the conversation.",- "connect_hint": "Connect this provider in Agents or API Keys to change its model here.",- "save_model": "Apply model",- "budget": "Daily budget (USD)",- "budget_hint": "0 means unlimited. The budget resets at midnight UTC.",- "concurrency": "Parallel jobs",- "concurrency_hint": "Maximum tasks running at the same time.",- "ceiling_safe": "Allow only tools rated Safe.",- "ceiling_monitor": "Allow Safe and Monitor tools.",- "ceiling_ask": "Also allow tools that require approval.",- "invalid_limits": "Enter a budget of 0 or more and a whole number of jobs of at least 1.",- "spent_today": "Spent today: ${amount}",- "total_spent": "Total spent",- "notes": "Wiki notes",- "manage": "Manage agent",- "recent": "Recent activity",- "loading": "Loading activity…",- "no_activity": "No activity yet. Start a conversation to give this agent its first task.",- "saved": "Changes saved",- "unsaved": "Unsaved changes",- "ready": "Ready to edit",- "save": "Save changes",- "discard": "Discard",- "sample": "Preview only: sample agents cannot be saved to the server.",- "load_error": "Could not load these settings.",- "retry": "Try again",- "leave": "Discard unsaved agent changes?",- "saving_wait": "Please wait until saving has finished."- },"world": {"talk_kind_query": "asks","talk_kind_answer": "answers",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json b/jarvis/ui/web/frontend/src/i18n/locales/society/es.jsonindex 5a1d4c885e..5d2b4d58d6 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json@@ -1,72 +1,5 @@{"society": {- "studio": {- "add_routine": "Añadir rutina",- "routine_title": "Nombre de la rutina",- "routine_task": "¿Qué debe hacer este agente?",- "routine_hours": "Repetir cada (horas)",- "routine_error": "No se pudo crear la rutina.",- "eyebrow": "Estudio de agentes",- "heading": "Haz tuyo este agente.",- "subtitle": "Define cómo piensa, trabaja y se ve.",- "sections": "Ajustes del agente",- "profile": "Perfil",- "model": "Modelo",- "appearance": "Aspecto",- "limits": "Límites",- "activity": "Actividad",- "profile_heading": "Un rol claro. Tus instrucciones.",- "model_heading": "Elige cómo piensa.",- "appearance_heading": "Dale un personaje.",- "limits_heading": "Define sus límites.",- "activity_heading": "Trabajo, rutinas y acciones.",- "role": "Rol",- "role_placeholder": "¿De qué se encarga este agente?",- "instructions_placeholder": "Describe su trabajo, prioridades y cómo debe colaborar contigo.",- "instructions_hint": "Estas instrucciones guían las próximas tareas. Se conservan las preferencias de herramientas y las reglas de aprobación.",- "tools_hint": "El acceso depende de las herramientas conectadas y los permisos del agente. Usa su chat para cambiar su enfoque o solicitar nuevas capacidades.",- "chat_action": "Abrir chat del agente",- "preview_hint": "Los cambios aparecen al instante en el personaje. Guarda cuando te guste el resultado.",- "character": "Personaje",- "imported": "Tu personaje importado",- "palette": "Paleta de colores",- "shuffle": "Sorpréndeme",- "wardrobe": "Ropa y accesorios",- "none": "Ninguno",- "reset_look": "Restablecer colores y accesorios",- "provider": "Proveedor",- "account": "Cuenta",- "active_account": "Cuenta activa",- "saved_account": "Cuenta guardada",- "model_hint": "Elige un proveedor conectado, un modelo y el esfuerzo de razonamiento. Los cambios de modelo se guardan por separado y conservan la conversación.",- "connect_hint": "Conecta este proveedor en Agentes o Claves API para cambiar su modelo aquí.",- "save_model": "Aplicar modelo",- "budget": "Presupuesto diario (USD)",- "budget_hint": "0 significa sin límite. Se restablece a medianoche UTC.",- "concurrency": "Tareas paralelas",- "concurrency_hint": "Máximo de tareas que se ejecutan a la vez.",- "ceiling_safe": "Permitir solo herramientas de nivel Seguro.",- "ceiling_monitor": "Permitir herramientas de nivel Seguro y Supervisar.",- "ceiling_ask": "Permitir también herramientas que requieren aprobación.",- "invalid_limits": "Introduce un presupuesto de 0 o más y un número entero de tareas de al menos 1.",- "spent_today": "Gastado hoy: ${amount}",- "total_spent": "Gasto total",- "notes": "Notas wiki",- "manage": "Gestionar agente",- "recent": "Actividad reciente",- "loading": "Cargando actividad…",- "no_activity": "Aún no hay actividad. Dale su primera tarea en el chat.",- "saved": "Cambios guardados",- "unsaved": "Cambios sin guardar",- "ready": "Listo para editar",- "save": "Guardar cambios",- "discard": "Descartar",- "sample": "Solo vista previa: los agentes de ejemplo no se guardan en el servidor.",- "load_error": "No se pudieron cargar estos ajustes.",- "retry": "Reintentar",- "leave": "¿Descartar los cambios del agente sin guardar?",- "saving_wait": "Espera hasta que termine de guardar."- },"world": {"talk_kind_query": "pregunta","talk_kind_answer": "responde",