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(society): the budget, ceiling and concurrency are settable on the card

rubenluetke10-beepef86fc166077
diff --git a/jarvis/ui/web/frontend/src/components/society/card/AgentLimits.test.tsx b/jarvis/ui/web/frontend/src/components/society/card/AgentLimits.test.tsx
new file mode 100644
index 0000000000..6d2b678430
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/card/AgentLimits.test.tsx
@@ -0,0 +1,117 @@
+/**
+ * The card's Limits block — the budget, ceiling and concurrency a person can
+ * change after the agent exists.
+ *
+ * All three were settable only once, at creation, behind a disclosure labelled
+ * "More" that nobody opened, so the numbers on the card read as decoration
+ * (maintainer, 2026-09-03). What this pins is the part that would break
+ * silently: that Save sends the three fields the PATCH route enforces, and
+ * that it sends NOTHING else — the route re-derives an agent's focus whenever
+ * a title or description arrives, so a budget edit that carried prose along
+ * would quietly rewrite the tools the agent reaches for.
+ */
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
+
+import { AgentSpecSheet } from "@/components/society/card/AgentSpecSheet";
+import type { SocietyAgent } from "@/components/society/data";
+
+const AGENT: SocietyAgent = {
+ agentId: "gamil-agent",
+ name: "Gamil agent",
+ title: "Specialist",
+ description: "Look after the mail.",
+ tier: "specialist",
+ provider: "",
+ providerLabel: "",
+ model: "",
+ effort: "",
+ figure: null,
+ palette: { primary: "#2f6f4f", secondary: "#8a5a3b", accent: "#ffd166" },
+ grantMode: "all",
+ toolGrants: [],
+ focus: ["plugin:gmail"],
+ denies: [],
+ approvalRules: { requireApproval: [], alwaysAllow: [] },
+ permissionCeiling: "monitor",
+ dailyBudgetUsd: 2,
+ checkpoint: "idle",
+ state: "idle",
+ lifecycle: "active",
+ createdMs: 1_788_000_000_000,
+ maxConcurrentRuns: 1,
+ workspaceDir: "society/gamil-agent/workspace",
+ wikiNamespace: "society/gamil-agent/",
+ chatSessionId: "society:gamil-agent",
+ routines: [],
+ stats: { runs: 0, totalCostUsd: 0, spentTodayUsd: 0, lastActiveMs: null },
+};
+
+function renderCard() {
+ const client = new QueryClient({
+ defaultOptions: { queries: { retry: false, staleTime: Infinity } },
+ });
+ return render(
+ <QueryClientProvider client={client}>
+ <AgentSpecSheet agent={AGENT} />
+ </QueryClientProvider>,
+ );
+}
+
+let fetchMock: ReturnType<typeof vi.fn>;
+
+describe("the card's limits", () => {
+ beforeEach(() => {
+ fetchMock = vi.fn(async (url: string) => {
+ if (String(url).includes("/capabilities")) {
+ return { ok: true, json: async () => ({ capabilities: [] }) } as Response;
+ }
+ return { ok: true, json: async () => ({}) } as Response;
+ });
+ vi.stubGlobal("fetch", fetchMock);
+ });
+ afterEach(() => {
+ cleanup();
+ vi.unstubAllGlobals();
+ vi.restoreAllMocks();
+ });
+
+ test("shows the cap beside today's spend, so the budget reads as the gate it is", async () => {
+ renderCard();
+ await waitFor(() => expect(screen.getByTestId("agent-limits-edit")).toBeTruthy());
+ expect(screen.getByTestId("agent-card-sheet").textContent).toContain("$0.00 of $2.00");
+ });
+
+ test("saves the three enforced knobs, and nothing that would re-derive the tools", async () => {
+ renderCard();
+ fireEvent.click(await screen.findByTestId("agent-limits-edit"));
+
+ fireEvent.change(screen.getByTestId("agent-budget-input"), { target: { value: "7.5" } });
+ fireEvent.click(screen.getByText("Ask first"));
+ fireEvent.click(screen.getByText("Save"));
+
+ await waitFor(() => {
+ const patch = fetchMock.mock.calls.find((c) => c[1]?.method === "PATCH");
+ expect(patch).toBeTruthy();
+ const body = JSON.parse(String(patch?.[1]?.body));
+ expect(body).toEqual({
+ daily_budget_usd: 7.5,
+ permission_ceiling: "ask",
+ max_concurrent_runs: 1,
+ });
+ });
+ });
+
+ test("an empty budget means no cap rather than a broken number", async () => {
+ renderCard();
+ fireEvent.click(await screen.findByTestId("agent-limits-edit"));
+ fireEvent.change(screen.getByTestId("agent-budget-input"), { target: { value: "" } });
+ fireEvent.click(screen.getByText("Save"));
+
+ await waitFor(() => {
+ const patch = fetchMock.mock.calls.find((c) => c[1]?.method === "PATCH");
+ expect(JSON.parse(String(patch?.[1]?.body)).daily_budget_usd).toBe(0);
+ });
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/society/card/AgentSpecSheet.tsx b/jarvis/ui/web/frontend/src/components/society/card/AgentSpecSheet.tsx
index 232cf244b5..6caf8b1103 100644
--- a/jarvis/ui/web/frontend/src/components/society/card/AgentSpecSheet.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/card/AgentSpecSheet.tsx
@@ -41,10 +41,13 @@ import { cn } from "@/lib/utils";
import { RetireButton } from "./RetireButton";
import { CapabilityChip } from "../CapabilityChip";
import { useAgentActivity, useAgentRoutines, useAgentSkills, type AgentActivity } from "../cardData";
+import { PERMISSION_CEILINGS } from "@/lib/societyApi";
+
import {
useSetAgentPaused,
useSocietyCapabilities,
useUpdateAgentDescription,
+ useUpdateAgentLimits,
type AgentRunState,
type Capability,
type PermissionCeiling,
@@ -342,42 +345,18 @@ export function AgentSpecSheet({ agent, onOpenChat, onRetired }: AgentSpecSheetP
</section>
) : null}
- <section className="flex flex-col gap-2">
- <StepMeter
- label={t("society.card.permission")}
- steps={3}
- filled={CEILING_STEP[agent.permissionCeiling] ?? 0}
- value={t(`society.ceiling.${agent.permissionCeiling}`)}
- />
- <StepMeter
- label={t("society.card.meter_reach")}
- steps={REACH_STEPS}
- filled={reachFilled}
- value={reachValue}
- />
- <div className="ac-meter">
- <span className="ac-meter-label">{t("society.card.meter_today")}</span>
- <span
- className="ac-meter-bar"
- data-spent={exhausted ? "1" : "0"}
- role="img"
- aria-label={`${t("society.card.meter_today")}: $${spentToday.toFixed(2)}`}
- >
- <span className="ac-meter-fill" style={{ width: `${Math.round(spentShare * 100)}%` }} />
- </span>
- <span className="ac-meter-value">
- {capped
- ? t("society.card.spent_of")
- .replace("{0}", spentToday.toFixed(2))
- .replace("{1}", agent.dailyBudgetUsd.toFixed(2))
- : t("society.card.no_cap")}
- </span>
- </div>
- </section>
+ <LimitsSection
+ agent={agent}
+ reachFilled={reachFilled}
+ reachValue={reachValue}
+ spentToday={spentToday}
+ spentShare={spentShare}
+ capped={capped}
+ exhausted={exhausted}
+ />
- <section className="grid grid-cols-3 gap-2">
+ <section className="grid grid-cols-2 gap-2">
<Plate label={t("society.card.place")} value={t(`society.checkpoint.${agent.checkpoint}`)} />
- <Plate label={t("society.card.jobs_at_once")} value={String(agent.maxConcurrentRuns)} />
<Plate label={t("society.card.created")} value={formatDate(agent.createdMs, "—")} />
</section>
@@ -503,6 +482,201 @@ export function AgentSpecSheet({ agent, onOpenChat, onRetired }: AgentSpecSheetP
);
}
+/**
+ * The three knobs a person may turn after the agent exists, plus the reach
+ * they cannot (that one follows the grant mode).
+ *
+ * All three are enforced somewhere — the budget stops a dispatch, the ceiling
+ * decides what runs without asking, the concurrency caps runs in flight — and
+ * until now they could be set only once, at creation, behind the Advanced
+ * disclosure, and never again (maintainer, 2026-09-03). Read mode is the
+ * meters as before; Edit turns the same rows into controls and PATCHes the
+ * three together.
+ */
+function LimitsSection({
+ agent,
+ reachFilled,
+ reachValue,
+ spentToday,
+ spentShare,
+ capped,
+ exhausted,
+}: {
+ agent: SocietyAgent;
+ reachFilled: number;
+ reachValue: string;
+ spentToday: number;
+ spentShare: number;
+ capped: boolean;
+ exhausted: boolean;
+}) {
+ const t = useT();
+ const update = useUpdateAgentLimits();
+ const [editing, setEditing] = useState(false);
+ const [saving, setSaving] = useState(false);
+ const [error, setError] = useState("");
+ const [ceiling, setCeiling] = useState<PermissionCeiling>(agent.permissionCeiling);
+ const [budget, setBudget] = useState(String(agent.dailyBudgetUsd));
+ const [jobs, setJobs] = useState(String(agent.maxConcurrentRuns));
+
+ const begin = () => {
+ setCeiling(agent.permissionCeiling);
+ setBudget(String(agent.dailyBudgetUsd));
+ setJobs(String(agent.maxConcurrentRuns));
+ setError("");
+ setEditing(true);
+ };
+ const save = async () => {
+ setSaving(true);
+ setError("");
+ try {
+ await update(agent, {
+ permissionCeiling: ceiling,
+ dailyBudgetUsd: Number.parseFloat(budget) || 0,
+ maxConcurrentRuns: Number.parseInt(jobs, 10) || 1,
+ });
+ setEditing(false);
+ } catch (err) {
+ setError(err instanceof Error ? err.message : String(err));
+ } finally {
+ setSaving(false);
+ }
+ };
+
+ return (
+ <section className="flex flex-col gap-2">
+ <div className="mb-0.5 flex items-center justify-between gap-2">
+ <h3 className="ac-head">{t("society.card.limits")}</h3>
+ {editing ? null : (
+ <button
+ type="button"
+ onClick={begin}
+ data-testid="agent-limits-edit"
+ className="rounded-full border border-border px-2 py-0.5 text-xs text-muted-foreground hover:bg-secondary hover:text-foreground"
+ >
+ {t("society.card.edit")}
+ </button>
+ )}
+ </div>
+
+ {editing ? (
+ <div className="ac-prose flex flex-col gap-3">
+ <div className="flex flex-col gap-1">
+ <span className="text-xs text-muted-foreground">{t("society.card.permission")}</span>
+ <div className="flex flex-wrap gap-1">
+ {PERMISSION_CEILINGS.map((step) => (
+ <button
+ key={step}
+ type="button"
+ disabled={saving}
+ onClick={() => setCeiling(step)}
+ aria-pressed={ceiling === step}
+ className={cn(
+ "rounded-md border px-2.5 py-1 text-xs transition-colors disabled:opacity-50",
+ ceiling === step
+ ? "border-border-strong bg-secondary text-foreground"
+ : "border-border text-muted-foreground hover:bg-secondary",
+ )}
+ >
+ {t(`society.ceiling.${step}`)}
+ </button>
+ ))}
+ </div>
+ </div>
+
+ <div className="flex flex-wrap items-end gap-4">
+ <label className="flex flex-col gap-1">
+ <span className="text-xs text-muted-foreground">{t("society.create.budget")}</span>
+ <input
+ type="number"
+ min={0}
+ step={0.5}
+ inputMode="decimal"
+ disabled={saving}
+ value={budget}
+ onChange={(e) => setBudget(e.target.value)}
+ data-testid="agent-budget-input"
+ className="w-28 rounded-md border border-border bg-background px-2 py-1 font-mono text-sm text-foreground outline-none focus:border-primary disabled:opacity-50"
+ />
+ </label>
+ <label className="flex flex-col gap-1">
+ <span className="text-xs text-muted-foreground">{t("society.card.jobs_at_once")}</span>
+ <input
+ type="number"
+ min={1}
+ step={1}
+ inputMode="numeric"
+ disabled={saving}
+ value={jobs}
+ onChange={(e) => setJobs(e.target.value)}
+ className="w-20 rounded-md border border-border bg-background px-2 py-1 font-mono text-sm text-foreground outline-none focus:border-primary disabled:opacity-50"
+ />
+ </label>
+ </div>
+ <p className="text-xs text-muted-foreground">{t("society.card.budget_hint")}</p>
+
+ <div className="flex items-center gap-2">
+ <button
+ type="button"
+ disabled={saving}
+ onClick={() => void save()}
+ className="rounded-md bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50"
+ >
+ {saving ? t("society.card.saving") : t("society.card.save")}
+ </button>
+ <button
+ type="button"
+ disabled={saving}
+ onClick={() => setEditing(false)}
+ className="rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground hover:bg-muted disabled:opacity-50"
+ >
+ {t("society.card.cancel")}
+ </button>
+ {error ? <span className="text-xs text-destructive">{error}</span> : null}
+ </div>
+ </div>
+ ) : (
+ <>
+ <StepMeter
+ label={t("society.card.permission")}
+ steps={3}
+ filled={CEILING_STEP[agent.permissionCeiling] ?? 0}
+ value={t(`society.ceiling.${agent.permissionCeiling}`)}
+ />
+ <StepMeter
+ label={t("society.card.meter_reach")}
+ steps={REACH_STEPS}
+ filled={reachFilled}
+ value={reachValue}
+ />
+ <div className="ac-meter">
+ <span className="ac-meter-label">{t("society.card.meter_today")}</span>
+ <span
+ className="ac-meter-bar"
+ data-spent={exhausted ? "1" : "0"}
+ role="img"
+ aria-label={`${t("society.card.meter_today")}: $${spentToday.toFixed(2)}`}
+ >
+ <span className="ac-meter-fill" style={{ width: `${Math.round(spentShare * 100)}%` }} />
+ </span>
+ <span className="ac-meter-value">
+ {capped
+ ? t("society.card.spent_of")
+ .replace("{0}", spentToday.toFixed(2))
+ .replace("{1}", agent.dailyBudgetUsd.toFixed(2))
+ : t("society.card.no_cap")}
+ </span>
+ </div>
+ <div className="ac-meter">
+ <span className="ac-meter-label">{t("society.card.jobs_at_once")}</span>
+ <span className="ac-meter-value">{agent.maxConcurrentRuns}</span>
+ </div>
+ </>
+ )}
+ </section>
+ );
+}
+
/**
* A value on a short discrete ladder, drawn as filled notches. Only used for
* things that really are steps — the three permission ceilings, the share of
diff --git a/jarvis/ui/web/frontend/src/components/society/data.ts b/jarvis/ui/web/frontend/src/components/society/data.ts
index 6f5b02c847..788854773d 100644
--- a/jarvis/ui/web/frontend/src/components/society/data.ts
+++ b/jarvis/ui/web/frontend/src/components/society/data.ts
@@ -467,6 +467,55 @@ export function useUpdateAgentDescription() {
);
}
+/** The knobs the card lets a person turn after the agent exists. */
+export interface AgentLimits {
+ /** 0 means no cap — the scheduler skips the budget gate entirely. */
+ dailyBudgetUsd: number;
+ permissionCeiling: PermissionCeiling;
+ maxConcurrentRuns: number;
+}
+
+/**
+ * Change what the agent is allowed to spend, decide and run at once.
+ *
+ * All three are enforced — the budget by `society/scheduler`, the ceiling by
+ * `society/approvals.decide`, the concurrency by the scheduler's run count —
+ * and all three were settable only at creation, behind the Advanced
+ * disclosure, and never afterwards (maintainer, 2026-09-03). `PATCH` has
+ * always accepted them; nothing was calling it with them.
+ *
+ * The description is deliberately NOT sent along: the route re-derives focus
+ * whenever a title or description arrives, so a budget edit must not carry
+ * prose with it.
+ */
+export function useUpdateAgentLimits() {
+ const client = useQueryClient();
+ return useCallback(
+ async (agent: SocietyAgent, limits: AgentLimits): Promise<void> => {
+ const sample = SAMPLE_ROSTER.includes(agent) || LOCAL_ROSTER.includes(agent);
+ const body = {
+ daily_budget_usd: Math.max(0, limits.dailyBudgetUsd),
+ permission_ceiling: limits.permissionCeiling,
+ max_concurrent_runs: Math.max(1, Math.round(limits.maxConcurrentRuns)),
+ };
+ if (!sample) {
+ const res = await fetch(`/api/society/agents/${encodeURIComponent(agent.agentId)}`, {
+ method: "PATCH",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify(body),
+ });
+ if (!res.ok) throw new Error(`limits ${res.status}`);
+ } else {
+ agent.dailyBudgetUsd = body.daily_budget_usd;
+ agent.permissionCeiling = body.permission_ceiling;
+ agent.maxConcurrentRuns = body.max_concurrent_runs;
+ }
+ await client.invalidateQueries({ queryKey: ROSTER_QUERY_KEY });
+ },
+ [client],
+ );
+}
+
/** Pause or resume an agent (`PATCH /api/society/agents/{id}`); sample rows flip locally. */
export function useSetAgentPaused() {
const client = useQueryClient();
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 4cc3a42e98..396bb7ac13 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -5264,6 +5264,8 @@
"chat": "Chat",
"hands": "Hände",
"learned": "Gelernt",
+ "limits": "Grenzen",
+ "budget_hint": "0 heißt kein Limit. Der Verteiler gibt keinen Auftrag mehr, sobald die Tagesausgaben das erreichen.",
"recent": "Zuletzt",
"no_recent": "Von diesem Agenten steht noch nichts auf dem Brett.",
"active_runs": "{0} laufen",
@@ -5387,7 +5389,7 @@
"effort": "Stufe",
"focus_title": "Schwerpunkt",
"grant_mode_hint": "Alles, was Jarvis verbunden hat — Skills, Plugins, MCP-Server, Gedächtnis — bleibt verfügbar; der Schwerpunkt sagt nur, was zuerst kommt.",
- "advanced": "Mehr",
+ "advanced": "Grenzen und Rechte",
"provider": "Anbieter",
"provider_unknown": "Kein Anbieterkatalog erreichbar — der Agent behält das Standardgehirn von Jarvis.",
"catalog_loading": "Anbieterkatalog wird geladen…",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index ac750a26ec..ef5f394821 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -5297,6 +5297,8 @@
"chat": "Chat",
"hands": "Hands",
"learned": "Learned",
+ "limits": "Limits",
+ "budget_hint": "0 means no cap. The scheduler refuses a job once the day's spend reaches this.",
"recent": "Recent",
"no_recent": "Nothing on the board from this agent yet.",
"active_runs": "{0} running",
@@ -5420,7 +5422,7 @@
"effort": "Effort",
"focus_title": "Focus",
"grant_mode_hint": "Everything Jarvis has connected — skills, plugins, MCP servers, memory — stays available; the focus only says what comes first.",
- "advanced": "More",
+ "advanced": "Limits and permissions",
"provider": "Provider",
"provider_unknown": "No provider catalog reachable — the agent keeps Jarvis' default brain.",
"catalog_loading": "Loading the provider catalog…",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 2f8fd4682e..f881fcba9c 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -5264,6 +5264,8 @@
"chat": "Chat",
"hands": "Manos",
"learned": "Aprendido",
+ "limits": "Límites",
+ "budget_hint": "0 significa sin límite. El planificador deja de dar trabajos cuando el gasto del día llega aquí.",
"recent": "Reciente",
"no_recent": "Este agente aún no ha puesto nada en el tablón.",
"active_runs": "{0} en marcha",
@@ -5387,7 +5389,7 @@
"effort": "Esfuerzo",
"focus_title": "Enfoque",
"grant_mode_hint": "Todo lo que Jarvis tiene conectado — skills, plugins, servidores MCP, memoria — sigue disponible; el enfoque solo dice qué va primero.",
- "advanced": "Más",
+ "advanced": "Límites y permisos",
"provider": "Proveedor",
"provider_unknown": "No hay catálogo de proveedores — el agente conserva el cerebro predeterminado de Jarvis.",
"catalog_loading": "Cargando el catálogo de proveedores…",