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): choose name, runtime and companion when an agent is created

rubenluetke10-beep9d99d7615a1d
diff --git a/docs/agent-runtimes.md b/docs/agent-runtimes.md
index 5b739dca93..5f6c847aeb 100644
--- a/docs/agent-runtimes.md
+++ b/docs/agent-runtimes.md
@@ -8,6 +8,12 @@ A society agent runs on one of three runtimes:
| `hermes` | [Hermes Agent](https://github.com/NousResearch/hermes-agent) (NousResearch, MIT) | |
| `openclaw` | [OpenClaw](https://github.com/openclaw/openclaw) (MIT) | |
+The runtime is chosen once, in the "new agent" dialog every plus in the
+society opens (name, runtime, the companion bot that follows the agent), and
+is fixed for the agent's life: the roster refuses a change, because the
+agent's sessions, runtime folder and tools belong to it. The model menu of
+the agent's chat shows the runtime and offers its update when one is due.
+
The runtime decides which agent loop, native tools and session store a turn
uses. Everything that makes a Jarvis agent stays in Jarvis and is identical
on every runtime: the one endless chat, the briefing (identity, standing
diff --git a/jarvis/society/roster.py b/jarvis/society/roster.py
index 45681eee10..4064e2d36f 100644
--- a/jarvis/society/roster.py
+++ b/jarvis/society/roster.py
@@ -676,8 +676,13 @@ class Roster:
raise RosterError(
FailureReason.TIER_NOT_ALLOWED, "the lead always runs on this computer"
)
- if key == "runtime" and agent_id == LEAD_AGENT_ID and str(value) != "jarvis":
- raise RosterError(FailureReason.TIER_NOT_ALLOWED, "the lead always runs on Jarvis")
+ if key == "runtime" and str(value) != str(current.get("runtime") or "jarvis"):
+ # Chosen once, at creation: the agent's sessions, memory folder
+ # and tools all belong to that runtime.
+ raise RosterError(
+ FailureReason.BLOCKED_BY_POLICY,
+ "an agent's runtime is chosen when it is created and cannot change",
+ )
if key == "tier" and str(value) == str(Tier.LEAD) and agent_id != LEAD_AGENT_ID:
raise RosterError(FailureReason.TIER_NOT_ALLOWED, "only Jarvis is the lead")
if key == "parent_agent_id" and value:
diff --git a/jarvis/ui/web/frontend/src/App.tsx b/jarvis/ui/web/frontend/src/App.tsx
index 1807578894..0be6130f1f 100644
--- a/jarvis/ui/web/frontend/src/App.tsx
+++ b/jarvis/ui/web/frontend/src/App.tsx
@@ -42,6 +42,9 @@ import { shouldOpenShortcutOverlay } from "@/lib/shortcutOverlayTrigger";
Lazy for the same reason: the switcher carries every locale for its
cross-language search, and nobody needs it before the first Ctrl+Space.
*/
+const CreateAgentDialog = lazy(() =>
+ import("@/components/society/create/CreateAgentDialog").then((m) => ({ default: m.CreateAgentDialogHost })),
+);
const QuickSwitcher = lazy(() =>
import("@/components/QuickSwitcher").then((m) => ({ default: m.QuickSwitcher })),
);
@@ -50,6 +53,7 @@ import { useQuickSwitchSettings } from "@/store/quickSwitchSettings";
import { useAppZoom } from "@/hooks/useAppZoom";
import { ZoomIndicator } from "@/components/ZoomIndicator";
import { useQuickSwitcher } from "@/store/quickSwitcher";
+import { useCreateAgentDialog } from "@/components/society/create/createAgentStore";
import { JarvisDock } from "@/components/JarvisDock";
import { CliConnectPoller } from "@/components/CliConnectPoller";
import { OnboardingGate } from "@/components/onboarding/OnboardingGate";
@@ -128,6 +132,7 @@ export default function App() {
reach the recorder instead, so a recording session is skipped.
*/
const switcherOpen = useQuickSwitcher((s) => s.open);
+ const createAgentOpen = useCreateAgentDialog((s) => s.open);
const switcherEnabled = useQuickSwitchSettings((s) => s.enabled);
const switcherCombo = useQuickSwitchSettings((s) => s.combo);
useEffect(() => {
@@ -442,6 +447,12 @@ export default function App() {
/>
</Suspense>
)}
+ {/* Every plus in the agent society opens this; the chunk loads on first use. */}
+ {createAgentOpen && (
+ <Suspense fallback={null}>
+ <CreateAgentDialog />
+ </Suspense>
+ )}
{/* Names the level after Ctrl + Plus / Minus, like Chrome's zoom bubble. */}
<ZoomIndicator />
{/* `?` anywhere in the app opens this; the chunk loads on first use. */}
diff --git a/jarvis/ui/web/frontend/src/components/society/card/RuntimePicker.test.tsx b/jarvis/ui/web/frontend/src/components/society/card/RuntimePicker.test.tsx
index 8bad7bcaa7..59422547e5 100644
--- a/jarvis/ui/web/frontend/src/components/society/card/RuntimePicker.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/card/RuntimePicker.test.tsx
@@ -1,17 +1,15 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import type { ReactNode } from "react";
import { afterEach, describe, expect, test, vi } from "vitest";
import type { AgentRuntimesResponse } from "@/lib/agentRuntimesApi";
-import type { SocietyAgent } from "../data";
-import { RuntimePicker } from "./RuntimePicker";
+import { RuntimeChoice, RuntimeStatusRow } from "./RuntimePicker";
vi.mock("@/i18n", () => ({ useT: () => (key: string) => key }));
-const { updateModel, runtimes, setup } = vi.hoisted(() => ({
- updateModel: vi.fn(),
+const { runtimes, setup } = vi.hoisted(() => ({
setup: vi.fn(),
runtimes: { value: null as unknown },
}));
-vi.mock("../data", () => ({ useUpdateAgentModel: () => updateModel }));
vi.mock("@/lib/agentRuntimesApi", () => ({
fetchAgentRuntimes: () => Promise.resolve(runtimes.value),
startAgentRuntimeSetup: setup,
@@ -25,68 +23,51 @@ function status(runtime: "hermes" | "openclaw", ready: boolean, installed = read
};
}
-function mount(agent: Partial<SocietyAgent>, data: AgentRuntimesResponse) {
+function withData(data: AgentRuntimesResponse, node: ReactNode) {
runtimes.value = data;
- const full = {
- agentId: "scout", name: "Scout", provider: "openai", model: "gpt-5.2", effort: "",
- accountId: "", runtime: "jarvis", computerId: null, ...agent,
- } as SocietyAgent;
- return render(
- <QueryClientProvider client={new QueryClient()}>
- <RuntimePicker agent={full} />
- </QueryClientProvider>,
- );
+ return render(<QueryClientProvider client={new QueryClient()}>{node}</QueryClientProvider>);
}
-const READY: AgentRuntimesResponse = {
- runtimes: [status("hermes", true), status("openclaw", true)] as AgentRuntimesResponse["runtimes"],
- supported_providers: ["openai", "ollama"],
+const MIXED: AgentRuntimesResponse = {
+ runtimes: [status("hermes", true), status("openclaw", false)] as AgentRuntimesResponse["runtimes"],
+ supported_providers: ["openai"],
};
afterEach(() => { cleanup(); vi.clearAllMocks(); });
-describe("RuntimePicker", () => {
- test("switching keeps the agent's model and names the runtime", async () => {
- updateModel.mockResolvedValue(undefined);
- mount({}, READY);
- const hermes = await screen.findByRole("radio", { name: /society.runtime.hermes$/ });
- await waitFor(() => expect((hermes as HTMLButtonElement).disabled).toBe(false));
- fireEvent.click(hermes);
- await waitFor(() => expect(updateModel).toHaveBeenCalledWith("scout", {
- provider: "openai", model: "gpt-5.2", effort: "", account_id: "", runtime: "hermes",
- }));
+describe("RuntimeChoice", () => {
+ test("offers the three runtimes and reports the pick", async () => {
+ const onChange = vi.fn();
+ withData(MIXED, <RuntimeChoice value="jarvis" onChange={onChange} />);
+ fireEvent.click(await screen.findByRole("radio", { name: "society.runtime.hermes" }));
+ expect(onChange).toHaveBeenCalledWith("hermes");
+ expect(screen.getAllByRole("radio")).toHaveLength(3);
});
- test("a subscription model cannot move to an external runtime", async () => {
- mount({ provider: "openai-codex" }, READY);
- expect(await screen.findByText("society.runtime.model_hint")).toBeTruthy();
- const openclaw = screen.getByRole("radio", { name: /society.runtime.openclaw$/ });
- await waitFor(() => expect((openclaw as HTMLButtonElement).disabled).toBe(true));
- });
-
- test("a missing runtime offers its installer", async () => {
+ test("a chosen runtime that is missing offers its installer", async () => {
setup.mockResolvedValue({});
- mount({}, {
- runtimes: [status("hermes", false), status("openclaw", true)] as AgentRuntimesResponse["runtimes"],
- supported_providers: ["openai"],
- });
- const install = await screen.findByRole("button", { name: "society.runtime.install" });
- expect(screen.getByText("society.runtime.not_installed")).toBeTruthy();
- fireEvent.click(install);
- await waitFor(() => expect(setup).toHaveBeenCalledWith("hermes", "install"));
+ withData(MIXED, <RuntimeChoice value="openclaw" onChange={vi.fn()} />);
+ fireEvent.click(await screen.findByRole("button", { name: "society.runtime.install" }));
+ await waitFor(() => expect(setup).toHaveBeenCalledWith("openclaw", "install"));
});
+});
- test("an outdated runtime offers its updater", async () => {
- mount({}, {
- runtimes: [status("hermes", true), status("openclaw", false, true)] as AgentRuntimesResponse["runtimes"],
- supported_providers: ["openai"],
- });
+describe("RuntimeStatusRow", () => {
+ test("names the runtime and offers an update when it is outdated", async () => {
+ withData(
+ {
+ runtimes: [status("hermes", false, true), status("openclaw", true)] as AgentRuntimesResponse["runtimes"],
+ supported_providers: [],
+ },
+ <RuntimeStatusRow runtime="hermes" />,
+ );
expect(await screen.findByRole("button", { name: "society.runtime.update" })).toBeTruthy();
+ expect(screen.getByText(/society\.runtime\.runs_on/)).toBeTruthy();
});
- test("an agent on another computer stays on Jarvis", async () => {
- mount({ computerId: "box-1" }, READY);
- expect(await screen.findByText("society.runtime.remote_hint")).toBeTruthy();
- await waitFor(() => expect((screen.getByRole("radio", { name: /society.runtime.hermes$/ }) as HTMLButtonElement).disabled).toBe(true));
+ test("a Jarvis agent needs no setup", async () => {
+ withData(MIXED, <RuntimeStatusRow runtime="jarvis" />);
+ expect(await screen.findByText(/society\.runtime\.runs_on/)).toBeTruthy();
+ expect(screen.queryByRole("button")).toBeNull();
});
});
diff --git a/jarvis/ui/web/frontend/src/components/society/card/RuntimePicker.tsx b/jarvis/ui/web/frontend/src/components/society/card/RuntimePicker.tsx
index 47e04b119c..897da1761e 100644
--- a/jarvis/ui/web/frontend/src/components/society/card/RuntimePicker.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/card/RuntimePicker.tsx
@@ -1,23 +1,23 @@
/**
* The agent's runtime: Jarvis (default), Hermes or OpenClaw
- * (docs/agent-runtimes.md). Hermes and OpenClaw are installed and updated
- * here with their own official tools, only when the person presses the
- * button; switching keeps the agent's model, memory and one chat.
+ * (docs/agent-runtimes.md). It is chosen once, in the create dialog
+ * (`RuntimeChoice`), and fixed for the agent's life; the model menu only
+ * shows it (`RuntimeStatusRow`). Hermes and OpenClaw are installed and
+ * updated with their own official tools, only when the person presses the
+ * button.
*/
import { useState } from "react";
import { useQuery, useQueryClient } from "@tanstack/react-query";
-import { Loader2 } from "lucide-react";
+import { Bot, Loader2 } from "lucide-react";
import { ProviderLogo } from "@/components/providers/ProviderLogo";
import { useT } from "@/i18n";
import {
fetchAgentRuntimes,
startAgentRuntimeSetup,
type AgentRuntimeStatus,
- type ExternalRuntime,
} from "@/lib/agentRuntimesApi";
import { AGENT_RUNTIMES, type AgentRuntime } from "@/lib/societyApi";
import { cn } from "@/lib/utils";
-import { useUpdateAgentModel, type SocietyAgent } from "../data";
export const AGENT_RUNTIMES_QUERY_KEY = ["agent-runtimes"] as const;
@@ -36,136 +36,147 @@ function fill(text: string, ...values: string[]): string {
return values.reduce((out, value, index) => out.replace(`{${index}}`, value), text);
}
-export function RuntimePicker({ agent }: { agent: SocietyAgent }) {
+function statusesByName(data: ReturnType<typeof useAgentRuntimes>["data"]) {
+ const rows = Array.isArray(data?.runtimes) ? data.runtimes : [];
+ return new Map<string, AgentRuntimeStatus>(rows.map((row) => [row.runtime, row]));
+}
+
+function RuntimeMark({ runtime, label }: { runtime: AgentRuntime; label: string }) {
+ return runtime === "jarvis"
+ ? <Bot className="size-4 shrink-0 text-muted-foreground" aria-hidden />
+ : <ProviderLogo providerId={runtime} label={label} size="sm" />;
+}
+
+/** Install / update offer for one external runtime that is not ready. */
+function RuntimeSetup({ status }: { status: AgentRuntimeStatus }) {
const t = useT();
const client = useQueryClient();
- const updateModel = useUpdateAgentModel();
- const runtimes = useAgentRuntimes();
- const [saving, setSaving] = useState(false);
const [error, setError] = useState<string | null>(null);
- const current: AgentRuntime = agent.runtime ?? "jarvis";
- const byName = new Map<string, AgentRuntimeStatus>(
- (Array.isArray(runtimes.data?.runtimes) ? runtimes.data.runtimes : []).map((row) => [row.runtime, row]),
- );
- const supported = new Set(runtimes.data?.supported_providers ?? []);
- const remote = Boolean(agent.computerId);
- // Unknown until the list loaded: no hint flashes up meanwhile.
- const modelFits = !runtimes.data?.supported_providers || !agent.provider || supported.has(agent.provider);
+ const job = status.job;
+ const running = job?.state === "running";
+ // OpenClaw's own installer also adds the Node.js it needs.
+ const action: "install" | "update" =
+ status.installed && status.problem_kind !== "node" ? "update" : "install";
+ const label = t(`society.runtime.${status.runtime}`);
+ const problem =
+ status.problem_kind === "outdated"
+ ? fill(t("society.runtime.needs_update"), label, status.minimum_version)
+ : status.problem_kind === "node"
+ ? t("society.runtime.node_hint")
+ : status.problem_kind === "no_version"
+ ? fill(t("society.runtime.no_version"), label)
+ : fill(t("society.runtime.not_installed"), label);
- async function choose(runtime: AgentRuntime) {
- if (runtime === current || saving) return;
- setSaving(true);
+ async function setup() {
setError(null);
try {
- await updateModel(agent.agentId, {
- provider: agent.provider,
- model: agent.model,
- effort: agent.effort,
- account_id: agent.accountId ?? "",
- runtime,
- });
- } catch (exc) {
- setError(fill(t("society.runtime.switch_failed"), exc instanceof Error ? exc.message : String(exc)));
- } finally {
- setSaving(false);
- }
- }
-
- async function setup(runtime: ExternalRuntime, action: "install" | "update") {
- setError(null);
- try {
- await startAgentRuntimeSetup(runtime, action);
+ await startAgentRuntimeSetup(status.runtime, action);
} catch (exc) {
setError(fill(t("society.runtime.setup_failed"), exc instanceof Error ? exc.message : String(exc)));
}
await client.invalidateQueries({ queryKey: AGENT_RUNTIMES_QUERY_KEY });
}
- const chosen = byName.get(current);
return (
- <div className="flex flex-col gap-1.5" data-testid="runtime-picker">
- <span className="text-xs text-muted-foreground">{t("society.runtime.title")}</span>
- <div className="flex flex-wrap gap-1" role="radiogroup" aria-label={t("society.runtime.title")}>
+ <div className="flex flex-wrap items-center gap-2 text-xs text-muted-foreground">
+ <span>{problem}</span>
+ <button
+ type="button"
+ disabled={running}
+ onClick={() => void setup()}
+ className="inline-flex items-center gap-1 rounded-full border border-border px-2 py-0.5 text-xs text-foreground hover:bg-secondary disabled:opacity-60"
+ >
+ {running ? <Loader2 className="size-3 animate-spin" aria-hidden /> : null}
+ {running
+ ? t(job?.kind === "update" ? "society.runtime.updating" : "society.runtime.installing")
+ : t(`society.runtime.${action}`)}
+ </button>
+ {job?.state === "failed" ? (
+ <span role="alert" className="w-full text-destructive">
+ {fill(t("society.runtime.setup_failed"), job.message || job.log_tail.at(-1) || "")}
+ </span>
+ ) : null}
+ {running && job?.log_tail.length ? (
+ <span className="w-full truncate font-mono text-[11px]">{job.log_tail.at(-1)}</span>
+ ) : null}
+ {error ? <span role="alert" className="w-full text-destructive">{error}</span> : null}
+ </div>
+ );
+}
+
+/** Whether a runtime can run a turn right now (Jarvis always can). */
+export function runtimeReady(
+ runtime: AgentRuntime,
+ data: ReturnType<typeof useAgentRuntimes>["data"],
+): boolean {
+ return runtime === "jarvis" || Boolean(statusesByName(data).get(runtime)?.ready);
+}
+
+/** The create dialog's choice: three cards, and setup for one that is not ready. */
+export function RuntimeChoice({ value, onChange, disabled = false }: {
+ value: AgentRuntime; onChange: (runtime: AgentRuntime) => void; disabled?: boolean;
+}) {
+ const t = useT();
+ const runtimes = useAgentRuntimes();
+ const byName = statusesByName(runtimes.data);
+ const chosen = value === "jarvis" ? null : byName.get(value);
+ return (
+ <div className="flex flex-col gap-2" data-testid="runtime-choice">
+ <div className="grid grid-cols-3 gap-2" role="radiogroup" aria-label={t("society.runtime.title")}>
{AGENT_RUNTIMES.map((runtime) => {
const status = runtime === "jarvis" ? null : byName.get(runtime);
- const external = runtime !== "jarvis";
- const blocked = external && (remote || !modelFits || !status?.ready);
+ const label = t(`society.runtime.${runtime}`);
return (
<button
key={runtime}
type="button"
role="radio"
- aria-checked={current === runtime}
- disabled={saving || (blocked && current !== runtime)}
- onClick={() => void choose(runtime)}
- title={t(`society.runtime.${runtime}_hint`)}
+ aria-checked={value === runtime}
+ aria-label={label}
+ disabled={disabled}
+ onClick={() => onChange(runtime)}
className={cn(
- "inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs transition-colors disabled:opacity-50",
- current === runtime
+ "flex flex-col items-start gap-1 rounded-lg border p-2.5 text-left transition-colors disabled:opacity-50",
+ value === runtime
? "border-border-strong bg-secondary text-foreground"
: "border-border text-muted-foreground hover:bg-secondary",
)}
>
- {external ? (
- <ProviderLogo providerId={runtime} label={t(`society.runtime.${runtime}`)} size="sm" />
- ) : null}
- {t(`society.runtime.${runtime}`)}
+ <span className="inline-flex items-center gap-1.5 text-sm font-medium text-foreground">
+ <RuntimeMark runtime={runtime} label={label} />
+ {label}
+ </span>
+ <span className="text-[11px] leading-snug">
+ {status
+ ? status.ready
+ ? fill(t("society.runtime.version"), status.version)
+ : t(status.installed ? "society.runtime.needs_setup" : "society.runtime.not_installed_short")
+ : t("society.runtime.built_in")}
+ </span>
</button>
);
})}
- {saving ? <Loader2 className="size-3.5 animate-spin self-center text-muted-foreground" aria-hidden /> : null}
</div>
- <p className="text-xs text-muted-foreground">
- {t(`society.runtime.${current}_hint`)}
- {chosen?.version ? ` · ${fill(t("society.runtime.version"), chosen.version)}` : ""}
- </p>
- {remote ? <p className="text-xs text-muted-foreground">{t("society.runtime.remote_hint")}</p> : null}
- {!remote && !modelFits ? (
- <p className="text-xs text-muted-foreground">{t("society.runtime.model_hint")}</p>
- ) : null}
- {(["hermes", "openclaw"] as const).map((runtime) => {
- const status = byName.get(runtime);
- if (!status || status.ready) return null;
- const job = status.job;
- const running = job?.state === "running";
- // OpenClaw's own installer also adds the Node.js it needs.
- const action: "install" | "update" =
- status.installed && status.problem_kind !== "node" ? "update" : "install";
- const label = t(`society.runtime.${runtime}`);
- const problem =
- status.problem_kind === "outdated"
- ? fill(t("society.runtime.needs_update"), label, status.minimum_version)
- : status.problem_kind === "node"
- ? t("society.runtime.node_hint")
- : status.problem_kind === "no_version"
- ? fill(t("society.runtime.no_version"), label)
- : fill(t("society.runtime.not_installed"), label);
- return (
- <div key={runtime} className="flex flex-wrap items-center gap-2 text-xs text-muted-foreground">
- <span>{problem}</span>
- <button
- type="button"
- disabled={running}
- onClick={() => void setup(runtime, action)}
- className="inline-flex items-center gap-1 rounded-full border border-border px-2 py-0.5 text-xs text-foreground hover:bg-secondary disabled:opacity-60"
- >
- {running ? <Loader2 className="size-3 animate-spin" aria-hidden /> : null}
- {running
- ? t(job?.kind === "update" ? "society.runtime.updating" : "society.runtime.installing")
- : t(`society.runtime.${action}`)}
- </button>
- {job?.state === "failed" ? (
- <span role="alert" className="w-full text-destructive">
- {fill(t("society.runtime.setup_failed"), job.message || job.log_tail.at(-1) || "")}
- </span>
- ) : null}
- {running && job?.log_tail.length ? (
- <span className="w-full truncate font-mono text-[11px]">{job.log_tail.at(-1)}</span>
- ) : null}
- </div>
- );
- })}
- {error ? <p role="alert" className="text-xs text-destructive">{error}</p> : null}
+ <p className="text-xs text-muted-foreground">{t(`society.runtime.${value}_hint`)}</p>
+ {chosen && !chosen.ready ? <RuntimeSetup status={chosen} /> : null}
+ </div>
+ );
+}
+
+/** The model menu's line: the runtime the agent runs on, and its update when needed. */
+export function RuntimeStatusRow({ runtime }: { runtime: AgentRuntime }) {
+ const t = useT();
+ const runtimes = useAgentRuntimes();
+ const status = runtime === "jarvis" ? null : statusesByName(runtimes.data).get(runtime);
+ const label = t(`society.runtime.${runtime}`);
+ return (
+ <div className="flex flex-col gap-1.5" data-testid="runtime-status">
+ <span className="inline-flex items-center gap-1.5 text-xs text-muted-foreground">
+ <RuntimeMark runtime={runtime} label={label} />
+ {fill(t("society.runtime.runs_on"), label)}
+ {status?.version ? ` · ${fill(t("society.runtime.version"), status.version)}` : ""}
+ </span>
+ {status && !status.ready ? <RuntimeSetup status={status} /> : null}
</div>
);
}
diff --git a/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsx b/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsx
index 4ec7b022d8..d700e29a2f 100644
--- a/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsx
@@ -786,12 +786,6 @@ function NoticeLine({ item }: { item: NoticeItem }) {
{t("society.chat.message_not_sent").replace("{0}", item.text)}
</p>;
}
- if (item.kind === "runtime_changed") {
- const runtime = String(item.data.runtime ?? "jarvis");
- return <p className="py-1 text-center text-[11px] text-muted-foreground">
- {t("society.chat.runtime_changed").replace("{0}", t(`society.runtime.${runtime}`))}
- </p>;
- }
if (item.kind === "context_rollover") {
return <p className="py-1 text-center text-[11px] text-muted-foreground">{t("society.chat.context_rollover")}</p>;
}
diff --git a/jarvis/ui/web/frontend/src/components/society/chat/AgentModelPicker.tsx b/jarvis/ui/web/frontend/src/components/society/chat/AgentModelPicker.tsx
index fdaa0c1a1a..8b680b91d1 100644
--- a/jarvis/ui/web/frontend/src/components/society/chat/AgentModelPicker.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/chat/AgentModelPicker.tsx
@@ -12,7 +12,7 @@ import { useUpdateAgentModel, type SocietyAgent } from "../data";
import { collapsibleModels, matchesModel, modelEffort, modelGroupOrder, modelSeats, providerTitle, visibleModels } from "./modelChoices";
import { useModelMenuData } from "./useModelMenuData";
-import { RuntimePicker, useAgentRuntimes } from "../card/RuntimePicker";
+import { RuntimeStatusRow, useAgentRuntimes } from "../card/RuntimePicker";
type Submenu = { provider: string; model?: CuratedModel; anchor: DOMRect };
const menuRow = "flex w-full items-center gap-2 px-3 py-1.5 text-left text-[13px] text-popover-foreground hover:bg-secondary focus-visible:bg-secondary focus-visible:outline-none disabled:opacity-45";
@@ -55,9 +55,15 @@ export function AgentModelPicker({ agent, busy, onSavingChange }: {
// Hermes / OpenClaw run on an API key or a local model, never a subscription CLI.
if (!external || !supportedKey) return all;
const supported = new Set(supportedKey.split(","));
- // A dual row (Claude: subscription CLI or API key) runs on its API key here.
+ // A dual row (Claude: subscription CLI or API key) runs on its API key here,
+ // so the CLI's own aliases ("opusplan", "default") are not models to offer.
return all.filter((seat) => supported.has(seat.provider.id))
- .map((seat) => seat.kind === "subscription" ? { ...seat, kind: "api" as const, accounts: [] } : seat);
+ .map((seat) => seat.kind === "subscription" ? {
+ ...seat,
+ kind: "api" as const,
+ accounts: [],
+ provider: { ...seat.provider, curated_models: seat.provider.curated_models.filter((model) => /\d/.test(model.id)) },
+ } : seat);
}, [options, providers, live, defaultModelLabel, external, supportedKey]);
const currentAccount = (seat: BrainSeat) => accounts[seat.provider.id] ?? (agent.provider === seat.provider.id ? agent.accountId ?? "" : "");
const preferredEffort = (seat: BrainSeat, model: CuratedModel) => modelEffort(seat, model.id, seat.provider.id === agent.provider ? agent.effort : seat.provider.default_effort);
@@ -203,7 +209,7 @@ export function AgentModelPicker({ agent, busy, onSavingChange }: {
onKeyDown={(event) => moveFocus(event, panel.current)}>
{agent.tier !== "lead" ? (
<div className="shrink-0 border-b border-border px-3 py-2.5">
- <RuntimePicker agent={agent} />
+ <RuntimeStatusRow runtime={agent.runtime ?? "jarvis"} />
</div>
) : null}
<div className="flex shrink-0 items-center gap-2 border-b border-border px-3 py-2.5">
diff --git a/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.test.tsx b/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.test.tsx
new file mode 100644
index 0000000000..92341c3a44
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.test.tsx
@@ -0,0 +1,92 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
+import type { AgentRuntimesResponse } from "@/lib/agentRuntimesApi";
+import { CreateAgentDialogHost } from "./CreateAgentDialog";
+import { isCreateCancelled, useCreateAgentDialog } from "./createAgentStore";
+
+vi.mock("@/i18n", () => ({ useT: () => (key: string) => key }));
+vi.mock("../companion/CompanionEditor", () => ({
+ CompanionEditor: ({ value }: { value: { shape: string } }) => <div data-testid="companion-editor">{value.shape}</div>,
+}));
+const { createAgent, runtimes } = vi.hoisted(() => ({
+ createAgent: vi.fn(),
+ runtimes: { value: null as unknown },
+}));
+vi.mock("../data", async () => {
+ class AgentNameTaken extends Error {}
+ return { AgentNameTaken, useCreateSocietyAgent: () => createAgent };
+});
+vi.mock("@/lib/agentRuntimesApi", () => ({
+ fetchAgentRuntimes: () => Promise.resolve(runtimes.value),
+ startAgentRuntimeSetup: vi.fn(),
+}));
+
+const READY: AgentRuntimesResponse = {
+ runtimes: [
+ { runtime: "hermes", label: "Hermes", installed: true, version: "0.21.0", minimum_version: "0.20.6",
+ ready: true, problem: "", problem_kind: "", install_hint: "", job: null },
+ { runtime: "openclaw", label: "OpenClaw", installed: false, version: "", minimum_version: "2026.9.8",
+ ready: false, problem: "", problem_kind: "not_installed", install_hint: "", job: null },
+ ],
+ supported_providers: ["openai", "ollama"],
+};
+
+function mount() {
+ return render(
+ <QueryClientProvider client={new QueryClient()}>
+ <CreateAgentDialogHost />
+ </QueryClientProvider>,
+ );
+}
+
+beforeEach(() => { runtimes.value = READY; });
+afterEach(() => { cleanup(); vi.clearAllMocks(); act(() => useCreateAgentDialog.setState({ open: false })); });
+
+describe("CreateAgentDialog", () => {
+ test("creates a named Hermes agent with a provider and a companion", async () => {
+ const agent = { agentId: "agent-1", name: "Scout" };
+ createAgent.mockResolvedValue(agent);
+ mount();
+ let pending!: Promise<unknown>;
+ act(() => { pending = useCreateAgentDialog.getState().request(); });
+ fireEvent.change(await screen.findByTestId("create-agent-name"), { target: { value: "Scout" } });
+ fireEvent.click(await screen.findByRole("radio", { name: "society.runtime.hermes" }));
+ await screen.findByTestId("create-agent-provider");
+ fireEvent.click(screen.getByTestId("create-agent-submit"));
+ await expect(pending).resolves.toBe(agent);
+ const choice = createAgent.mock.calls[0][0];
+ expect(choice).toMatchObject({ name: "Scout", runtime: "hermes", provider: "openai" });
+ expect(choice.companion.shape).toBeTruthy();
+ expect(useCreateAgentDialog.getState().open).toBe(false);
+ });
+
+ test("a Jarvis agent needs nothing but the button", async () => {
+ createAgent.mockResolvedValue({ agentId: "agent-2" });
+ mount();
+ act(() => { void useCreateAgentDialog.getState().request(); });
+ fireEvent.click(await screen.findByTestId("create-agent-submit"));
+ await waitFor(() => expect(createAgent).toHaveBeenCalled());
+ expect(createAgent.mock.calls[0][0]).toMatchObject({ runtime: "jarvis", provider: undefined });
+ expect(screen.queryByTestId("create-agent-provider")).toBeNull();
+ });
+
+ test("a runtime that is not installed cannot be created yet", async () => {
+ mount();
+ act(() => { void useCreateAgentDialog.getState().request(); });
+ fireEvent.click(await screen.findByRole("radio", { name: "society.runtime.openclaw" }));
+ const submit = screen.getByTestId("create-agent-submit") as HTMLButtonElement;
+ await waitFor(() => expect(submit.disabled).toBe(true));
+ expect(screen.getByRole("button", { name: "society.runtime.install" })).toBeTruthy();
+ });
+
+ test("closing the dialog cancels the request quietly", async () => {
+ mount();
+ let pending!: Promise<unknown>;
+ act(() => { pending = useCreateAgentDialog.getState().request(); });
+ fireEvent.click(await screen.findByRole("button", { name: "society.create_agent.cancel" }));
+ const error = await pending.catch((exc: unknown) => exc);
+ expect(isCreateCancelled(error)).toBe(true);
+ expect(createAgent).not.toHaveBeenCalled();
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.tsx b/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.tsx
new file mode 100644
index 0000000000..2cf3314cfe
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/create/CreateAgentDialog.tsx
@@ -0,0 +1,185 @@
+/**
+ * "New agent": a name, the runtime it runs on (Jarvis, Hermes or OpenClaw —
+ * chosen here once and fixed for the agent's life) and the small companion
+ * bot that follows it. Everything is optional except the runtime's needs:
+ * Hermes and OpenClaw run on an API key or a local model, so they ask which.
+ * Mounted once (App.tsx); every plus opens it through `useCreateAgentDialog`.
+ */
+import { useEffect, useMemo, useState, Suspense, lazy } from "react";
+import * as Dialog from "@radix-ui/react-dialog";
+import { X } from "lucide-react";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { BrandedSelect } from "@/components/ui/select";
+import { ProviderLogo } from "@/components/providers/ProviderLogo";
+import { useT } from "@/i18n";
+import type { AgentRuntime } from "@/lib/societyApi";
+import { AgentNameTaken, useCreateSocietyAgent } from "../data";
+import { defaultCompanion, type CompanionAppearance } from "../companion/appearance";
+import { RuntimeChoice, runtimeReady, useAgentRuntimes } from "../card/RuntimePicker";
+import { useCreateAgentDialog } from "./createAgentStore";
+
+const CompanionEditor = lazy(() =>
+ import("../companion/CompanionEditor").then((m) => ({ default: m.CompanionEditor })),
+);
+
+/** Provider ids the runtimes route (`jarvis/agent_runtimes/model_map.py`). */
+const PROVIDER_NAMES: Record<string, string> = {
+ "claude-api": "Anthropic Claude",
+ openai: "OpenAI",
+ gemini: "Google Gemini",
+ grok: "xAI Grok",
+ openrouter: "OpenRouter",
+ nvidia: "NVIDIA NIM",
+ ollama: "Ollama",
+ "local-openai": "Local server",
+};
+
+function randomCompanion(): CompanionAppearance {
+ return defaultCompanion(`${Date.now()}:${Math.random()}`);
+}
+
+export function CreateAgentDialogHost() {
+ const open = useCreateAgentDialog((s) => s.open);
+ // A fresh form every time it opens.
+ return open ? <CreateAgentDialog /> : null;
+}
+
+function CreateAgentDialog() {
+ const t = useT();
+ const { finish, cancel } = useCreateAgentDialog.getState();
+ const createAgent = useCreateSocietyAgent();
+ const runtimes = useAgentRuntimes();
+ const [name, setName] = useState("");
+ const [runtime, setRuntime] = useState<AgentRuntime>("jarvis");
+ const [provider, setProvider] = useState("");
+ const [companion, setCompanion] = useState<CompanionAppearance>(randomCompanion);
+ const [saving, setSaving] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+
+ const providers = useMemo(
+ () => (Array.isArray(runtimes.data?.supported_providers) ? runtimes.data.supported_providers : []),
+ [runtimes.data],
+ );
+ const external = runtime !== "jarvis";
+ useEffect(() => {
+ // The first usable provider until the person picks one.
+ if (external && !providers.includes(provider)) setProvider(providers[0] ?? "");
+ }, [external, providers, provider]);
+
+ const ready = runtimeReady(runtime, runtimes.data);
+ const needsProvider = external && !provider;
+ const canCreate = !saving && ready && !needsProvider;
+
+ async function submit() {
+ if (!canCreate) return;
+ setSaving(true);
+ setError(null);
+ try {
+ const agent = await createAgent({
+ name,
+ runtime,
+ provider: external ? provider : undefined,
+ companion,
+ });
+ finish(agent);
+ } catch (exc) {
+ setError(
+ exc instanceof AgentNameTaken
+ ? t("society.create_agent.name_taken")
+ : exc instanceof Error ? exc.message : String(exc),
+ );
+ setSaving(false);
+ }
+ }
+
+ return (
+ <Dialog.Root open onOpenChange={(next) => { if (!next && !saving) cancel(); }}>
+ <Dialog.Portal>
+ <Dialog.Overlay className="fixed inset-0 z-50 bg-scrim/60 backdrop-blur-sm" />
+ <Dialog.Content
+ data-testid="create-agent-dialog"
+ className="fixed left-1/2 top-1/2 z-50 flex max-h-[90dvh] w-[min(560px,calc(100vw-24px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-border bg-popover text-foreground shadow-float"
+ >
+ <header className="flex items-center gap-3 border-b border-border p-4">
+ <div className="flex-1">
+ <Dialog.Title className="font-semibold">{t("society.create_agent.title")}</Dialog.Title>
+ <Dialog.Description className="text-sm text-muted-foreground">
+ {t("society.create_agent.subtitle")}
+ </Dialog.Description>
+ </div>
+ <button type="button" aria-label={t("society.card.close")} onClick={() => { if (!saving) cancel(); }} className="rounded p-2 hover:bg-secondary">
+ <X size={18} />
+ </button>
+ </header>
+ <form
+ className="flex min-h-0 flex-col"
+ onSubmit={(event) => { event.preventDefault(); void submit(); }}
+ >
+ <div className="flex min-h-0 flex-col gap-5 overflow-y-auto p-4">
+ <label className="flex flex-col gap-1.5 text-sm">
+ <span className="font-medium">{t("society.create_agent.name_label")}</span>
+ <Input
+ autoFocus
+ value={name}
+ maxLength={40}
+ onChange={(event) => setName(event.target.value)}
+ placeholder={t("society.create_agent.name_placeholder")}
+ disabled={saving}
+ data-testid="create-agent-name"
+ />
+ </label>
+
+ <div className="flex flex-col gap-1.5 text-sm">
+ <span className="font-medium">{t("society.create_agent.type_label")}</span>
+ <RuntimeChoice value={runtime} onChange={setRuntime} disabled={saving} />
+ <p className="text-xs text-muted-foreground">{t("society.create_agent.type_fixed")}</p>
+ </div>
+
+ {external ? (
+ <div className="flex flex-col gap-1.5 text-sm">
+ <span className="font-medium">{t("society.create_agent.provider_label")}</span>
+ {providers.length ? (
+ <BrandedSelect
+ value={provider}
+ onValueChange={setProvider}
+ ariaLabel={t("society.create_agent.provider_label")}
+ disabled={saving}
+ testId="create-agent-provider"
+ options={providers.map((id) => ({
+ value: id,
+ label: PROVIDER_NAMES[id] ?? id,
+ icon: <ProviderLogo providerId={id} label={PROVIDER_NAMES[id] ?? id} size="sm" />,
+ }))}
+ />
+ ) : (
+ <p className="text-xs text-muted-foreground">{t("society.create_agent.no_provider")}</p>
+ )}
+ <p className="text-xs text-muted-foreground">{t("society.create_agent.provider_hint")}</p>
+ </div>
+ ) : null}
+
+ <div className="flex flex-col gap-1.5 text-sm">
+ <span className="font-medium">{t("society.create_agent.companion_label")}</span>
+ <div className="-mx-4">
+ <Suspense fallback={null}>
+ <CompanionEditor value={companion} onChange={setCompanion} disabled={saving} />
+ </Suspense>
+ </div>
+ </div>
+ </div>
+ <footer className="flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-border p-4">
+ {error ? <p role="alert" className="mr-auto text-sm text-destructive">{error}</p> : null}
+ <Button type="button" variant="ghost" onClick={() => cancel()} disabled={saving}>
+ {t("society.create_agent.cancel")}
+ </Button>
+ <Button type="submit" disabled={!canCreate} data-testid="create-agent-submit">
+ {t(saving ? "society.create_agent.creating" : "society.create_agent.create")}
+ </Button>
+ </footer>
+ </form>
+ </Dialog.Content>
+ </Dialog.Portal>
+ </Dialog.Root>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/create/createAgentStore.ts b/jarvis/ui/web/frontend/src/components/society/create/createAgentStore.ts
new file mode 100644
index 0000000000..4c08fb6efc
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/create/createAgentStore.ts
@@ -0,0 +1,52 @@
+/**
+ * The "new agent" dialog, opened from every plus in the society (the Agents
+ * page, the office's reception, the foundry). `request()` opens it and
+ * settles once the person created an agent — or rejects with
+ * `CreateAgentCancelled` when they closed it — so each plus keeps its own
+ * "then open the new agent's chat" step.
+ */
+import { create } from "zustand";
+import type { SocietyAgent } from "../data";
+
+export class CreateAgentCancelled extends Error {
+ constructor() {
+ super("Agent creation cancelled");
+ this.name = "CreateAgentCancelled";
+ }
+}
+
+interface CreateAgentDialogState {
+ open: boolean;
+ request: () => Promise<SocietyAgent>;
+ /** The dialog created the agent: settle the pending request. */
+ finish: (agent: SocietyAgent) => void;
+ cancel: () => void;
+}
+
+let pending: { resolve: (agent: SocietyAgent) => void; reject: (error: Error) => void } | null = null;
+
+export const useCreateAgentDialog = create<CreateAgentDialogState>((set) => ({
+ open: false,
+ request: () => {
+ // A second plus while the dialog is open re-targets the same dialog.
+ pending?.reject(new CreateAgentCancelled());
+ return new Promise<SocietyAgent>((resolve, reject) => {
+ pending = { resolve, reject };
+ set({ open: true });
+ });
+ },
+ finish: (agent) => {
+ pending?.resolve(agent);
+ pending = null;
+ set({ open: false });
+ },
+ cancel: () => {
+ pending?.reject(new CreateAgentCancelled());
+ pending = null;
+ set({ open: false });
+ },
+}));
+
+export function isCreateCancelled(error: unknown): boolean {
+ return error instanceof CreateAgentCancelled;
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/data.ts b/jarvis/ui/web/frontend/src/components/society/data.ts
index db36c843b3..7f8c10fbf0 100644
--- a/jarvis/ui/web/frontend/src/components/society/data.ts
+++ b/jarvis/ui/web/frontend/src/components/society/data.ts
@@ -17,6 +17,9 @@ import { useQuery, useQueryClient, type QueryClient } from "@tanstack/react-quer
import type { MentionPlugin } from "./chat/mentionItems";
import type { AgentApprovalMode, AgentRuntime, Checkpoint, SocietyAgentRow } from "@/lib/societyApi";
+import type { CompanionAppearance } from "./companion/appearance";
+import { useCreateAgentDialog } from "./create/createAgentStore";
+
import { NEUTRAL_ASSISTANT_NAME } from "@/lib/assistantNameCache";
import { useEventStore } from "@/store/events";
@@ -25,6 +28,14 @@ import { SAMPLE_ROSTER } from "./mockRoster";
import { beginRetirement, retirementRunning, retirementStageMounted } from "./world/retireStore";
import { announceSpawn } from "./world/spawnStore";
+/** The create dialog named an agent that already exists. */
+export class AgentNameTaken extends Error {
+ constructor() {
+ super("An agent with this name already exists");
+ this.name = "AgentNameTaken";
+ }
+}
+
/** MASTERPLAN §2.5 — exactly one lead (Jarvis), orchestrators may ASSIGN. */
export type AgentTier = "lead" | "orchestrator" | "specialist";
@@ -187,11 +198,22 @@ const PROVIDER_LABELS: Record<string, string> = {
deepseek: "DeepSeek",
ollama: "Ollama (local)",
"local-openai": "Local server",
+ "claude-api": "Anthropic Claude",
+ grok: "xAI Grok",
+ openrouter: "OpenRouter",
+ nvidia: "NVIDIA NIM",
};
export function rowToAgent(row: SocietyAgentRow): SocietyAgent {
const tier = row.tier as AgentTier;
- const figure = recipeFromAvatar(row.avatar) ?? defaultFigureFor(row.agent_id, tier);
+ // A new agent's avatar may hold only its companion (the backend's random
+ // one, or the create dialog's pick): it rides on the default figure.
+ const stored = recipeFromAvatar(row.avatar);
+ const companion = row.avatar && typeof row.avatar === "object" ? row.avatar.companion : undefined;
+ const figure = stored
+ ?? (companion
+ ? ({ ...defaultFigureFor(row.agent_id, tier), companion } as FigureRecipe)
+ : defaultFigureFor(row.agent_id, tier));
const runState: AgentRunState =
row.state === "paused" ? "paused" : ((row.run_state as AgentRunState | undefined) ?? "idle");
return {
@@ -359,18 +381,44 @@ export function useSocietyCapabilities(enabled = true, mentionOpen = false) {
}
/**
- * One-click creation (`POST /api/society/agents` with no name): the backend
- * picks a placeholder name, a random look and the lead chat's current seat,
- * and the agent finds its role in its first conversation. A failure throws —
- * there is no local stand-in row, so the person sees the real error.
+ * Every plus in the society: opens the "new agent" dialog (name, runtime,
+ * companion) and settles with the created agent. Closing the dialog rejects
+ * with `CreateAgentCancelled` (`isCreateCancelled`), which is not an error.
*/
export function useQuickCreateAgent() {
+ return useCallback(() => useCreateAgentDialog.getState().request(), []);
+}
+
+/** What the create dialog sends; every field may be left out. */
+export interface NewAgentChoice {
+ /** Empty = a placeholder name; the agent proposes its own in its first chat. */
+ name?: string;
+ /** Fixed for the agent's life (docs/agent-runtimes.md). */
+ runtime?: AgentRuntime;
+ /** Required for Hermes / OpenClaw: an API-key or local provider. */
+ provider?: string;
+ /** The small companion bot that follows the agent. */
+ companion?: CompanionAppearance;
+}
+
+/**
+ * `POST /api/society/agents`: the backend fills in what is left out (a
+ * placeholder name, a random companion, the lead chat's current seat). A
+ * name that already exists is refused rather than adopting that agent. A
+ * failure throws with the server's own reason — there is no stand-in row.
+ */
+export function useCreateSocietyAgent() {
const client = useQueryClient();
- return useCallback(async (): Promise<SocietyAgent> => {
+ return useCallback(async (choice: NewAgentChoice = {}): Promise<SocietyAgent> => {
+ const body: Record<string, unknown> = { tier: "specialist" };
+ if (choice.name?.trim()) body.name = choice.name.trim();
+ if (choice.runtime && choice.runtime !== "jarvis") body.runtime = choice.runtime;
+ if (choice.provider) body.provider = choice.provider;
+ if (choice.companion) body.avatar = { companion: choice.companion };
const res = await fetch("/api/society/agents", {
method: "POST",
headers: { "Content-Type": "application/json" },
- body: JSON.stringify({ tier: "specialist" }),
+ body: JSON.stringify(body),
});
if (!res.ok) {
const detail = (await res.json().catch(() => null)) as { detail?: unknown } | null;
@@ -383,7 +431,8 @@ export function useQuickCreateAgent() {
: `create ${res.status}`,
);
}
- const created = (await res.json()) as { agent: SocietyAgentRow };
+ const created = (await res.json()) as { agent: SocietyAgentRow; created?: boolean };
+ if (created.created === false) throw new AgentNameTaken();
// The island owes this row an entrance: it walks out of the foundry.
announceSpawn(created.agent.agent_id);
const agent = rowToAgent(created.agent);
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx
index 844d460e45..1401d29a98 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx
@@ -18,6 +18,7 @@ import { useWebglSupported } from "@/lib/graphDimension";
import { useT } from "@/i18n";
import { useEventStore } from "@/store/events";
import { useQuickCreateAgent, useSocietyRoster, type SocietyAgent } from "../data";
+import { isCreateCancelled } from "../create/createAgentStore";
import { OfficeScene } from "./OfficeScene";
import { allDesks, buildOfficeLayout, countStates, MAX_SEATED } from "./officeLayout";
import { buildNavGrid } from "./officeNav";
@@ -305,7 +306,9 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen
if (creatingRef.current) return;
creatingRef.current = true;
void quickCreate()
- .catch((error) => console.warn("Agent creation failed", error))
+ .catch((error) => {
+ if (!isCreateCancelled(error)) console.warn("Agent creation failed", error);
+ })
.finally(() => { creatingRef.current = false; });
}, [onCreateAgent, layout, quickCreate]);
const actions = useMemo<OfficeActions>(() => ({
diff --git a/jarvis/ui/web/frontend/src/components/society/rowToAgent.test.ts b/jarvis/ui/web/frontend/src/components/society/rowToAgent.test.ts
new file mode 100644
index 0000000000..0619477fc8
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/rowToAgent.test.ts
@@ -0,0 +1,32 @@
+import { describe, expect, test } from "vitest";
+import type { SocietyAgentRow } from "@/lib/societyApi";
+import { rowToAgent } from "./data";
+
+function row(avatar: Record<string, unknown> | null, extra: Partial<SocietyAgentRow> = {}): SocietyAgentRow {
+ return {
+ agent_id: "agent-1", name: "Lumi", title: "", description: "", tier: "specialist",
+ parent_agent_id: null, state: "active", avatar, checkpoint: "home", provider: "openai",
+ model: "", effort: "", account_id: "", grant_mode: "all", grants: [], focus: [], denies: [],
+ skills: null, workspace_dir: "", wiki_namespace: "", knowledge_scope: "shared",
+ permission_ceiling: "ask", approval_mode: "bypass",
+ approval_rules: { require_approval: [], always_allow: [] }, daily_budget_usd: 0,
+ max_concurrent_runs: 1, browser_mode: "own", browser_allowed_domains: [], computer_id: null,
+ runtime: "openclaw", session_id: "society:agent-1", created_ms: 0, updated_ms: 0,
+ stats: { runs: 0, total_cost_usd: 0, last_active_ms: null },
+ ...extra,
+ } as SocietyAgentRow;
+}
+
+describe("rowToAgent", () => {
+ test("a companion-only avatar keeps the chosen companion", () => {
+ const companion = { shape: "triangle", color: "#b7cb78", eyes: "lines", enabled: true, sizeM: 0.5, followDistanceM: 1 };
+ const agent = rowToAgent(row({ companion }));
+ expect(agent.figure?.companion).toEqual(companion);
+ expect(agent.figure?.contract).toBe(1);
+ });
+
+ test("the runtime comes through and defaults to Jarvis", () => {
+ expect(rowToAgent(row(null)).runtime).toBe("openclaw");
+ expect(rowToAgent(row(null, { runtime: undefined as never })).runtime).toBe("jarvis");
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/society/world/FoundryDrawer.tsx b/jarvis/ui/web/frontend/src/components/society/world/FoundryDrawer.tsx
index 73a4b1c09c..4b4f4195cb 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/FoundryDrawer.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/world/FoundryDrawer.tsx
@@ -14,6 +14,7 @@ import { Factory, Plus, X } from "lucide-react";
import { fill, useT, useUiLanguage } from "@/i18n";
import { AgentSwatch } from "../AgentSwatch";
import { useQuickCreateAgent, useSocietyRoster, type SocietyAgent } from "../data";
+import { isCreateCancelled } from "../create/createAgentStore";
/** How many of the newest agents the drawer lists. */
const RECENT_LIMIT = 6;
@@ -74,7 +75,9 @@ export function FoundryDrawer({
if (onSelectAgent) onSelectAgent(agent.agentId);
else onClose();
})
- .catch((err) => setError(err instanceof Error ? err.message : String(err)))
+ .catch((err) => {
+ if (!isCreateCancelled(err)) setError(err instanceof Error ? err.message : String(err));
+ })
.finally(() => setCreating(false));
}, [creating, quickCreate, onSelectAgent, onClose]);
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 05c76c7288..f9e8c3949f 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -5398,7 +5398,6 @@
"message_waiting": "Wartet, bis die aktuelle Aufgabe fertig ist",
"message_not_sent": "Nicht gesendet: {0}",
"context_rollover": "Frischer Arbeitskontext – Gedächtnis und letzte Nachrichten übernommen",
- "runtime_changed": "Läuft jetzt auf {0} – Gedächtnis und letzte Nachrichten übernommen",
"allow_always": "Immer erlauben",
"history_chats": "Chats",
"history_voice": "Sprache",
@@ -5534,14 +5533,34 @@
"monitor": "Beobachten",
"ask": "Erst fragen"
},
+ "create_agent": {
+ "title": "Neuer Agent",
+ "subtitle": "Gib ihm einen Namen, wähle, worauf er läuft, und such seinen kleinen Begleiter aus.",
+ "name_label": "Name",
+ "name_placeholder": "Leer lassen – der Agent gibt sich selbst einen Namen",
+ "type_label": "Agent-Typ",
+ "type_fixed": "Der Typ lässt sich nach dem Erstellen nicht mehr ändern.",
+ "provider_label": "Modell-Anbieter",
+ "provider_hint": "Hermes und OpenClaw laufen mit einem API-Schlüssel oder einem lokalen Modell. Das Modell kannst du später im Chat ändern.",
+ "no_provider": "Noch kein API-Schlüssel und kein lokales Modell verbunden. Füge eines unter Einstellungen → API-Schlüssel hinzu.",
+ "companion_label": "Begleiter",
+ "cancel": "Abbrechen",
+ "create": "Agent erstellen",
+ "creating": "Wird erstellt …",
+ "name_taken": "Es gibt schon einen Agenten mit diesem Namen."
+ },
"runtime": {
+ "built_in": "Eingebaut",
+ "needs_setup": "Braucht ein Update",
+ "not_installed_short": "Nicht installiert",
+ "runs_on": "Läuft auf {0}",
"title": "Laufzeit",
"jarvis": "Jarvis",
"hermes": "Hermes",
"openclaw": "OpenClaw",
- "jarvis_hint": "Jarvis' eigene Agenten-Schleife auf dem Modell unten.",
- "hermes_hint": "Der Hermes-Agent mit seinen eigenen Werkzeugen, auf dem Modell unten, mit Gedächtnis, Skills und Jarvis-Werkzeugen dieses Agenten.",
- "openclaw_hint": "Der OpenClaw-Agent mit seinen eigenen Werkzeugen, auf dem Modell unten, mit Gedächtnis, Skills und Jarvis-Werkzeugen dieses Agenten.",
+ "jarvis_hint": "Jarvis' eigene Agenten-Schleife, auf dem Modell, das du im Chat wählst.",
+ "hermes_hint": "Der Hermes-Agent mit seinen eigenen Werkzeugen – dazu Gedächtnis, Skills und Werkzeuge aus Jarvis.",
+ "openclaw_hint": "Der OpenClaw-Agent mit seinen eigenen Werkzeugen – dazu Gedächtnis, Skills und Werkzeuge aus Jarvis.",
"install": "Installieren",
"update": "Aktualisieren",
"installing": "Wird installiert …",
@@ -5550,11 +5569,8 @@
"not_installed": "{0} ist auf diesem Computer nicht installiert.",
"needs_update": "{0} {1} oder neuer wird gebraucht.",
"setup_failed": "Einrichtung nicht abgeschlossen: {0}",
- "model_hint": "Hermes und OpenClaw laufen mit einem API-Schlüssel oder einem lokalen Modell. Wähle unten zuerst eines davon.",
"node_hint": "OpenClaw braucht Node.js 24.16 oder neuer. Sein Installer richtet eines nur für OpenClaw ein.",
- "no_version": "{0} ist installiert, meldet aber keine Version. Installiere es neu.",
- "remote_hint": "Hermes- und OpenClaw-Agenten laufen auf diesem Computer.",
- "switch_failed": "Wechsel nicht möglich: {0}"
+ "no_version": "{0} ist installiert, meldet aber keine Version. Installiere es neu."
},
"approval_mode": {
"title": "Agentenberechtigungen",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 5231b868e0..0623e191df 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -5398,7 +5398,6 @@
"message_waiting": "Waits until the current task is done",
"message_not_sent": "Not sent: {0}",
"context_rollover": "Fresh working context — memory and recent messages carried over",
- "runtime_changed": "Now running on {0} — memory and recent messages carried over",
"allow_always": "Always allow",
"history_chats": "Chats",
"history_voice": "Voice",
@@ -5534,14 +5533,34 @@
"monitor": "Monitor",
"ask": "Ask first"
},
+ "create_agent": {
+ "title": "New agent",
+ "subtitle": "Give it a name, pick what it runs on and choose its little companion.",
+ "name_label": "Name",
+ "name_placeholder": "Leave empty and the agent names itself",
+ "type_label": "Agent type",
+ "type_fixed": "The type is fixed once the agent exists.",
+ "provider_label": "Model provider",
+ "provider_hint": "Hermes and OpenClaw run on an API key or a local model. The model can be changed later in the chat.",
+ "no_provider": "No API key or local model is connected yet. Add one in Settings → API keys.",
+ "companion_label": "Companion",
+ "cancel": "Cancel",
+ "create": "Create agent",
+ "creating": "Creating…",
+ "name_taken": "An agent with this name already exists."
+ },
"runtime": {
+ "built_in": "Built in",
+ "needs_setup": "Needs an update",
+ "not_installed_short": "Not installed",
+ "runs_on": "Runs on {0}",
"title": "Runtime",
"jarvis": "Jarvis",
"hermes": "Hermes",
"openclaw": "OpenClaw",
- "jarvis_hint": "Jarvis' own agent loop on the model below.",
- "hermes_hint": "The Hermes agent with its own tools, on the model below, with this agent's memory, skills and Jarvis tools.",
- "openclaw_hint": "The OpenClaw agent with its own tools, on the model below, with this agent's memory, skills and Jarvis tools.",
+ "jarvis_hint": "Jarvis' own agent loop, on the model you pick in its chat.",
+ "hermes_hint": "The Hermes agent with its own tools — plus this agent's Jarvis memory, skills and tools.",
+ "openclaw_hint": "The OpenClaw agent with its own tools — plus this agent's Jarvis memory, skills and tools.",
"install": "Install",
"update": "Update",
"installing": "Installing…",
@@ -5550,11 +5569,8 @@
"not_installed": "{0} is not installed on this computer.",
"needs_update": "{0} {1} or newer is needed.",
"setup_failed": "Setup did not finish: {0}",
- "model_hint": "Hermes and OpenClaw run on an API key or a local model. Pick one of those below first.",
"node_hint": "OpenClaw needs Node.js 24.16 or newer. Its installer adds one for OpenClaw only.",
- "no_version": "{0} is installed but did not report its version. Reinstall it.",
- "remote_hint": "Hermes and OpenClaw agents run on this computer.",
- "switch_failed": "Could not switch: {0}"
+ "no_version": "{0} is installed but did not report its version. Reinstall it."
},
"approval_mode": {
"title": "Agent permissions",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 25a99735bf..0c18f3deef 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -5398,7 +5398,6 @@
"message_waiting": "Espera a que termine la tarea actual",
"message_not_sent": "No enviado: {0}",
"context_rollover": "Contexto de trabajo nuevo: se conservan la memoria y los mensajes recientes",
- "runtime_changed": "Ahora funciona con {0}; memoria y mensajes recientes conservados",
"allow_always": "Permitir siempre",
"history_chats": "Chats",
"history_voice": "Voz",
@@ -5534,14 +5533,34 @@
"monitor": "Supervisar",
"ask": "Preguntar primero"
},
+ "create_agent": {
+ "title": "Nuevo agente",
+ "subtitle": "Ponle un nombre, elige con qué funciona y escoge su pequeño acompañante.",
+ "name_label": "Nombre",
+ "name_placeholder": "Déjalo vacío y el agente elegirá su nombre",
+ "type_label": "Tipo de agente",
+ "type_fixed": "El tipo no se puede cambiar una vez creado el agente.",
+ "provider_label": "Proveedor del modelo",
+ "provider_hint": "Hermes y OpenClaw funcionan con una clave de API o un modelo local. El modelo se puede cambiar después en el chat.",
+ "no_provider": "Aún no hay ninguna clave de API ni modelo local conectados. Añade uno en Ajustes → Claves de API.",
+ "companion_label": "Acompañante",
+ "cancel": "Cancelar",
+ "create": "Crear agente",
+ "creating": "Creando…",
+ "name_taken": "Ya existe un agente con este nombre."
+ },
"runtime": {
+ "built_in": "Integrado",
+ "needs_setup": "Necesita una actualización",
+ "not_installed_short": "No instalado",
+ "runs_on": "Funciona con {0}",
"title": "Motor",
"jarvis": "Jarvis",
"hermes": "Hermes",
"openclaw": "OpenClaw",
- "jarvis_hint": "El bucle de agente propio de Jarvis con el modelo de abajo.",
- "hermes_hint": "El agente Hermes con sus propias herramientas, con el modelo de abajo, la memoria, las habilidades y las herramientas de Jarvis de este agente.",
- "openclaw_hint": "El agente OpenClaw con sus propias herramientas, con el modelo de abajo, la memoria, las habilidades y las herramientas de Jarvis de este agente.",
+ "jarvis_hint": "El bucle de agente propio de Jarvis, con el modelo que elijas en su chat.",
+ "hermes_hint": "El agente Hermes con sus propias herramientas, más la memoria, las habilidades y las herramientas de Jarvis.",
+ "openclaw_hint": "El agente OpenClaw con sus propias herramientas, más la memoria, las habilidades y las herramientas de Jarvis.",
"install": "Instalar",
"update": "Actualizar",
"installing": "Instalando…",
@@ -5550,11 +5569,8 @@
"not_installed": "{0} no está instalado en este equipo.",
"needs_update": "Se necesita {0} {1} o posterior.",
"setup_failed": "La instalación no terminó: {0}",
- "model_hint": "Hermes y OpenClaw funcionan con una clave de API o un modelo local. Elige primero uno de ellos abajo.",
"node_hint": "OpenClaw necesita Node.js 24.16 o posterior. Su instalador añade uno solo para OpenClaw.",
- "no_version": "{0} está instalado pero no indica su versión. Vuelve a instalarlo.",
- "remote_hint": "Los agentes Hermes y OpenClaw funcionan en este equipo.",
- "switch_failed": "No se pudo cambiar: {0}"
+ "no_version": "{0} está instalado pero no indica su versión. Vuelve a instalarlo."
},
"approval_mode": {
"title": "Permisos del agente",
diff --git a/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx b/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx
index f02a430935..3850c5dca3 100644
--- a/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx
+++ b/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx
@@ -12,6 +12,7 @@ import { BUILDING_CARDS, isBuildingPlace, type BuildingPlace } from "@/component
import { DeferredSocietyDialog } from "@/components/society/card/DeferredSocietyDialog";
import type { PlaceId } from "@/components/society/world/islandLayout";
import { useQuickCreateAgent, useSocietyRoster } from "@/components/society/data";
+import { isCreateCancelled } from "@/components/society/create/createAgentStore";
import { RosterRail } from "@/components/society/roster/RosterRail";
import { useModelMenuData } from "@/components/society/chat/useModelMenuData";
import { ChatGroupPanel } from "@/components/society/chat/ChatGroupPanel";
@@ -113,8 +114,8 @@ export function SocietyView() {
if (inDesktopShell()) void setMapFullscreen(next === "world").catch(() => setFullscreenError(true));
}, []);
- // One click creates the agent and opens its chat: no form first. The agent
- // introduces itself there and proposes its own name and role.
+ // The plus opens the "new agent" dialog (name, runtime, companion); the new
+ // agent's chat opens after it. Closing the dialog is not an error.
const createAgent = useCallback(() => {
if (creating) return;
setCreating(true);
@@ -124,7 +125,9 @@ export function SocietyView() {
selectAgent(agent.agentId);
switchMode("agents");
})
- .catch((error) => setCreateError(error instanceof Error ? error.message : String(error)))
+ .catch((error) => {
+ if (!isCreateCancelled(error)) setCreateError(error instanceof Error ? error.message : String(error));
+ })
.finally(() => setCreating(false));
}, [creating, quickCreate, selectAgent, switchMode]);
diff --git a/jarvis/ui/web/society_routes.py b/jarvis/ui/web/society_routes.py
index 894d826473..747afe067e 100644
--- a/jarvis/ui/web/society_routes.py
+++ b/jarvis/ui/web/society_routes.py
@@ -79,13 +79,12 @@ def _validated_chat_runner(
*,
approval_mode: str | None = None,
permission_ceiling: str | None = None,
- runtime: str | None = None,
) -> str:
"""Reject a runner change that cannot honor the effective chat approval."""
from jarvis.agent_chat.permissions import normalize_permission, society_mode_supported
from jarvis.agent_chat.service import resolve_runner
- chosen_runtime = str(runtime if runtime is not None else agent.runtime)
+ chosen_runtime = str(agent.runtime)
if chosen_runtime not in ("", "jarvis"):
from jarvis.agent_runtimes.model_map import supports
@@ -93,7 +92,7 @@ def _validated_chat_runner(
raise HTTPException(
422,
"Hermes and OpenClaw run on an API key or a local model. "
- "Pick one of those for this agent first.",
+ "Pick one of those for this agent.",
)
runner = resolve_runner(provider, surface="society", runtime=chosen_runtime)
mode = approval_mode if approval_mode is not None else (
@@ -147,7 +146,8 @@ class CreateAgentBody(BaseModel):
browser_allowed_domains: list[str] | None = None
#: Where the agent runs: "" = this computer, else a connected computer id.
computer_id: str | None = None
- #: The agent loop: "jarvis" (default), "hermes" or "openclaw".
+ #: The agent loop, chosen once here and fixed for the agent's life:
+ #: "jarvis" (default), "hermes" or "openclaw".
runtime: str | None = None
#: Structured brief (jarvis.society.brief); rendered into ``description``.
mission: str | None = Field(default=None, max_length=2_000)
@@ -186,8 +186,6 @@ class PatchAgentBody(BaseModel):
browser_allowed_domains: list[str] | None = None
#: Where the agent runs: "" = this computer, else a connected computer id.
computer_id: str | None = None
- #: The agent loop: "jarvis" (default), "hermes" or "openclaw".
- runtime: str | None = None
#: Structured brief (jarvis.society.brief); rendered into ``description``.
mission: str | None = Field(default=None, max_length=2_000)
responsibilities: list[str] | None = None
@@ -404,16 +402,13 @@ async def patch_agent(agent_id: str, body: PatchAgentBody, request: Request) ->
if has_brief(brief):
# A brief rewrites the standing instructions as a whole.
fields["description"] = compose_description(body.description or "", brief)
- if any(
- key in fields for key in ("provider", "approval_mode", "permission_ceiling", "runtime")
- ):
+ if any(key in fields for key in ("provider", "approval_mode", "permission_ceiling")):
_validated_chat_runner(
rt,
agent,
body.provider or agent.provider,
approval_mode=body.approval_mode,
permission_ceiling=fields.get("permission_ceiling"),
- runtime=body.runtime,
)
if ("title" in fields or "description" in fields) and "focus" not in fields:
# A prose edit must not wipe what the agent earned in its chat: the
@@ -801,9 +796,6 @@ class ModelBody(BaseModel):
model: str = ""
effort: str = ""
account_id: str = ""
- #: Switch the agent loop with the model ("jarvis" / "hermes" / "openclaw");
- #: None keeps the current runtime.
- runtime: str | None = None
@router.get("/providers")
@@ -864,7 +856,7 @@ async def switch_agent_model(agent_id: str, body: ModelBody, request: Request) -
422,
{"reason": str(FailureReason.BLOCKED_BY_POLICY), "detail": "provider not offered"},
)
- target_runner = _validated_chat_runner(rt, agent, body.provider, runtime=body.runtime)
+ target_runner = _validated_chat_runner(rt, agent, body.provider)
chat = rt._get_chat()
fields = {
"provider": body.provider.strip().lower(),
@@ -872,9 +864,6 @@ async def switch_agent_model(agent_id: str, body: ModelBody, request: Request) -
"effort": body.effort.strip(),
"account_id": body.account_id.strip(),
}
- runtime_changed = body.runtime is not None and body.runtime != str(agent.runtime)
- if body.runtime is not None:
- fields["runtime"] = body.runtime
if chat is not None and hasattr(chat, "controls"):
from jarvis.society.roster import PAIR_SESSION_MARKER
@@ -902,12 +891,6 @@ async def switch_agent_model(agent_id: str, body: ModelBody, request: Request) -
reseated = session.session_id
except PermissionError as exc:
log.info("society: %s re-seat deferred: %s", agent.agent_id, exc)
- if runtime_changed:
- # Marks in the one chat where the new agent loop took over.
- await svc.post_notice(
- updated.session_id,
- {"kind": "runtime_changed", "runtime": str(updated.runtime)},
- )
return {
"agent": _agent_row(updated, request),
"runner": target_runner,
diff --git a/tests/unit/society/test_agent_runtime_field.py b/tests/unit/society/test_agent_runtime_field.py
index ddd6778f63..d37cd107ad 100644
--- a/tests/unit/society/test_agent_runtime_field.py
+++ b/tests/unit/society/test_agent_runtime_field.py
@@ -33,13 +33,15 @@ async def test_new_agents_run_on_jarvis_by_default(roster: Roster):
assert scout.to_dict()["runtime"] == "jarvis"
-async def test_runtime_is_chosen_at_create_and_editable(roster: Roster):
+async def test_runtime_is_chosen_at_create_and_then_fixed(roster: Roster):
hermit, _ = await roster.create(name="Hermit", runtime="hermes")
assert hermit.runtime is AgentRuntime.HERMES
- moved = await roster.update("hermit", {"runtime": "openclaw"})
- assert moved.runtime is AgentRuntime.OPENCLAW
- with pytest.raises(RosterError):
- await roster.update("hermit", {"runtime": "skynet"})
+ for other in ("openclaw", "jarvis", "skynet"):
+ with pytest.raises(RosterError):
+ await roster.update("hermit", {"runtime": other})
+ # Naming the runtime it already has is not a change.
+ same = await roster.update("hermit", {"runtime": "hermes", "title": "Scout"})
+ assert same.runtime is AgentRuntime.HERMES and same.title == "Scout"
async def test_the_lead_always_runs_on_jarvis(roster: Roster):
@@ -54,9 +56,6 @@ async def test_external_runtime_stays_on_this_computer(roster: Roster, monkeypat
from jarvis.society import roster as roster_mod
monkeypatch.setattr(roster_mod, "_validate_computer", lambda value: value or None)
- remote, _ = await roster.create(name="Remote", computer_id="box-1")
- with pytest.raises(RosterError):
- await roster.update("remote", {"runtime": "hermes"})
with pytest.raises(RosterError):
await roster.create(name="Both", runtime="openclaw", computer_id="box-1")
local, _ = await roster.create(name="Local", runtime="hermes")
@@ -131,43 +130,20 @@ class _Svc:
return False
-async def test_switching_runtime_reseats_the_chat_and_drops_the_vendor_session(tmp_path: Path):
+async def test_a_new_hermes_agent_chat_runs_on_hermes(tmp_path: Path):
cfg = SimpleNamespace(memory=SimpleNamespace(data_dir=str(tmp_path / "data")))
rt = SocietyRuntime(tmp_path, seed_starter_team=False, cfg=lambda: cfg)
await rt.ensure_started()
svc = _Svc(AgentChatStore(tmp_path / "agent_chat.db"))
try:
- agent, _ = await rt.roster.create(name="Hermit", provider="openai", model="gpt-5.2")
- first = ensure_session(svc, cfg, agent)
- assert first.runtime == ""
- svc.store.update_session(first.session_id, vendor_session="claude-conv-1")
-
- moved = await rt.roster.update(agent.agent_id, {"runtime": "hermes"})
- reseated = ensure_session(svc, cfg, moved)
- assert reseated.runtime == "hermes"
- assert not reseated.vendor_session
- assert session_runner(reseated) == "hermes-cli"
-
- back = await rt.roster.update(agent.agent_id, {"runtime": "jarvis"})
- assert ensure_session(svc, cfg, back).runtime == ""
+ agent, _ = await rt.roster.create(
+ name="Hermit", provider="openai", model="gpt-5.2", runtime="hermes"
+ )
+ session = ensure_session(svc, cfg, agent)
+ assert session.runtime == "hermes"
+ assert session_runner(session) == "hermes-cli"
+ jarvis_agent, _ = await rt.roster.create(name="Plain", provider="openai")
+ assert ensure_session(svc, cfg, jarvis_agent).runtime == ""
finally:
svc.store.close()
await rt.close()
-
-
-def test_a_routine_run_never_moves_a_subscription_seat_onto_an_api_key(monkeypatch):
- from jarvis.society import routine_runner
-
- owner = SimpleNamespace(runtime="hermes", provider="openai")
- # The owner's own model keeps the owner's runtime.
- assert routine_runner._run_runtime(owner, "openai") == "hermes"
- # A pinned seat that is a subscription CLI runs on Jarvis instead.
- monkeypatch.setattr(
- "jarvis.agent_chat.service._claude_cli_installed", lambda: True
- )
- assert routine_runner._run_runtime(owner, "claude-api") == ""
- # A pinned API-key seat keeps the runtime; an unsupported one never does.
- assert routine_runner._run_runtime(owner, "openrouter") == "hermes"
- assert routine_runner._run_runtime(owner, "openai-codex") == ""
- jarvis_owner = SimpleNamespace(runtime="jarvis", provider="openai")
- assert routine_runner._run_runtime(jarvis_owner, "openai") == ""