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(agentic-ide): polish agent allocation controls

Ruben Lütke5852b9766fbc
diff --git a/jarvis/ui/web/frontend/public/agent-logos/zai.svg b/jarvis/ui/web/frontend/public/agent-logos/zai.svg
new file mode 100644
index 0000000000..8a41b27a53
--- /dev/null
+++ b/jarvis/ui/web/frontend/public/agent-logos/zai.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30">
+ <path d="M24.51 28.51H5.49a4 4 0 0 1-4-4V5.49a4 4 0 0 1 4-4h19.03a4 4 0 0 1 4 4v19.03a4 4 0 0 1-4.01 3.99Z" fill="#2D2D2D" stroke="#FFFFFF" stroke-width=".6317"/>
+ <path d="m15.47 7.1-1.3 1.85c-.2.29-.54.47-.9.47h-7.1V7.09l9.3.01Zm8.83 0L13.14 22.91H5.7L16.86 7.1H24.3Zm-9.77 15.81 1.31-1.86c.2-.29.54-.47.9-.47h7.09v2.33h-9.3Z" fill="#FFFFFF"/>
+</svg>
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgentAllocation.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgentAllocation.test.tsx
index fec271e5ac..7ae32b8a10 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgentAllocation.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgentAllocation.test.tsx
@@ -40,6 +40,20 @@ const AGENTS: AgentStatus[] = [
version: null,
install_command: "npm install -g opencode-ai",
},
+ {
+ name: "kimi",
+ display_name: "Kimi Code",
+ installed: false,
+ version: null,
+ install_command: "npm install -g @moonshot-ai/kimi-code",
+ },
+ {
+ name: "glm",
+ display_name: "GLM Coding Plan",
+ installed: false,
+ version: null,
+ install_command: null,
+ },
];
const ACCOUNTS: AgentAccount[] = [
@@ -133,6 +147,60 @@ describe("AgentAllocation", () => {
expect(agents.filter((agent) => agent === "codex")).toHaveLength(7);
});
+ it("uses local product marks and keeps the selected agent logo visible", () => {
+ render(<Harness />);
+
+ const claudeMark = screen.getByTestId("agent-mark-claude");
+ expect(claudeMark.querySelector("img")?.getAttribute("src")).toBe(
+ "/provider-logos/claude.svg",
+ );
+ expect(
+ screen
+ .getByTestId("agent-mark-codex")
+ .querySelector("img")
+ ?.getAttribute("src"),
+ ).toBe("/provider-logos/openai.svg");
+ expect(
+ screen
+ .getByTestId("agent-mark-opencode")
+ .querySelector("img")
+ ?.getAttribute("src"),
+ ).toBe("/agent-logos/opencode.svg");
+ expect(
+ screen
+ .getByTestId("agent-mark-kimi")
+ .querySelector("img")
+ ?.getAttribute("src"),
+ ).toBe("/agent-logos/kimi.svg");
+ expect(
+ screen
+ .getByTestId("agent-mark-glm")
+ .querySelector("img")
+ ?.getAttribute("src"),
+ ).toBe("/agent-logos/zai.svg");
+
+ fireEvent.click(screen.getAllByRole("button", { name: "All" })[0]);
+ expect(claudeMark.querySelector("img")).toBeTruthy();
+ });
+
+ it("presents a wide keyboard-friendly count field without native spinners", () => {
+ render(<Harness count={17} />);
+
+ const input = screen.getByRole("spinbutton", {
+ name: "Terminal count for Codex",
+ }) as HTMLInputElement;
+ expect(input.inputMode).toBe("numeric");
+ expect(input.step).toBe("1");
+ expect(input.className).toContain("[appearance:textfield]");
+ expect(input.className).toContain(
+ "[&::-webkit-inner-spin-button]:appearance-none",
+ );
+ expect(input.value).toBe("0");
+ expect(screen.getByTestId("allocation-stepper-codex").textContent).toMatch(
+ /\/\s*17/,
+ );
+ });
+
it("splits every slot evenly across installed agents", () => {
render(<Harness />);
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgentAllocation.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgentAllocation.tsx
index d36ed6ed24..982fc38e2b 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgentAllocation.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgentAllocation.tsx
@@ -2,11 +2,12 @@
* Allocate terminal slots by agent instead of editing every pane separately.
* The backend still receives its existing one-entry-per-terminal plan.
*/
-import { Check, Minus, Plus, SquareTerminal } from "lucide-react";
+import { Check, Minus, Plus } from "lucide-react";
import { useT } from "@/i18n";
import { cn } from "@/lib/utils";
import type { AgentAccount } from "@/lib/agentAccountsApi";
import type { AgentStatus } from "@/lib/agenticIdeApi";
+import { AgentMark } from "./AgentMark";
import { Button, Select, SectionLabel } from "./controls";
export interface PlannedTerminal {
@@ -264,17 +265,24 @@ export function AgentAllocation({
disabled={!agent.installed}
onClick={() => setCount(agent.name, count > 0 ? 0 : 1)}
className={cn(
- "flex h-8 w-8 shrink-0 items-center justify-center rounded-control border transition-colors",
+ "relative flex h-10 w-10 shrink-0 items-center justify-center rounded-control transition-transform active:scale-95",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 disabled:cursor-not-allowed disabled:opacity-40",
- count > 0
- ? "border-primary/60 bg-primary text-primary-foreground"
- : "border-border bg-card/60 text-muted-foreground hover:border-primary/40",
)}
>
- {count > 0 ? (
- <Check className="h-4 w-4" />
- ) : (
- <SquareTerminal className="h-4 w-4" />
+ <AgentMark
+ agent={agent.name}
+ label={agent.display_name}
+ className={cn(
+ "transition-colors",
+ count > 0
+ ? "border-primary/70 bg-primary/[0.08]"
+ : "hover:border-primary/40",
+ )}
+ />
+ {count > 0 && (
+ <span className="absolute -bottom-0.5 -right-0.5 flex h-4 w-4 items-center justify-center rounded-full border-2 border-background bg-primary text-primary-foreground">
+ <Check className="h-2.5 w-2.5 stroke-[3]" />
+ </span>
)}
</button>
<div className="min-w-0">
@@ -327,16 +335,19 @@ export function AgentAllocation({
</div>
</div>
- <div className="flex items-center justify-end gap-1.5">
+ <div className="flex items-center justify-end gap-2">
<Button
variant="subtle"
- className="px-2 text-xs uppercase tracking-wide"
+ className="h-10 min-w-12 px-3 text-[10px] uppercase tracking-[0.12em]"
disabled={!agent.installed}
onClick={() => commitCounts({ [agent.name]: total })}
>
{t("workspace_launcher.agents.all")}
</Button>
- <div className="grid grid-cols-[2rem_3rem_2rem] items-center rounded-control border border-border bg-background">
+ <div
+ data-testid={`allocation-stepper-${agent.name}`}
+ className="grid grid-cols-[2.5rem_6.5rem_2.5rem] items-center overflow-hidden rounded-control border border-border bg-background shadow-inner transition-colors focus-within:border-primary/60 focus-within:ring-1 focus-within:ring-primary/20"
+ >
<button
type="button"
aria-label={t("workspace_launcher.agents.decrease").replace(
@@ -345,24 +356,40 @@ export function AgentAllocation({
)}
disabled={!agent.installed || count === 0}
onClick={() => setCount(agent.name, count - 1)}
- className="flex h-8 items-center justify-center text-muted-foreground hover:text-foreground disabled:opacity-30"
+ className="flex h-10 items-center justify-center text-muted-foreground transition-colors hover:bg-secondary/60 hover:text-foreground active:scale-95 disabled:opacity-30"
>
<Minus className="h-3.5 w-3.5" />
</button>
- <input
- type="number"
- min={0}
- max={total}
- value={count}
- aria-label={t(
- "workspace_launcher.agents.count_for",
- ).replace("{0}", agent.display_name)}
- disabled={!agent.installed}
- onChange={(event) =>
- setCount(agent.name, Number(event.target.value))
- }
- className="h-8 min-w-0 border-x border-border bg-transparent text-center font-mono text-sm tabular-nums text-foreground outline-none focus:bg-secondary/50 disabled:opacity-40"
- />
+ <label className="flex h-10 min-w-0 items-center justify-center border-x border-border bg-card/30 px-2 focus-within:bg-secondary/45">
+ <input
+ type="number"
+ inputMode="numeric"
+ step={1}
+ min={0}
+ max={total}
+ value={count}
+ aria-label={t(
+ "workspace_launcher.agents.count_for",
+ ).replace("{0}", agent.display_name)}
+ disabled={!agent.installed}
+ onFocus={(event) => event.currentTarget.select()}
+ onChange={(event) =>
+ setCount(
+ agent.name,
+ Number.isFinite(event.currentTarget.valueAsNumber)
+ ? event.currentTarget.valueAsNumber
+ : 0,
+ )
+ }
+ className="h-10 w-10 border-0 bg-transparent p-0 text-right font-mono text-base font-semibold tabular-nums text-foreground outline-none [appearance:textfield] disabled:opacity-40 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
+ />
+ <span
+ aria-hidden="true"
+ className="ml-1 whitespace-nowrap font-mono text-[10px] tabular-nums text-muted-foreground"
+ >
+ / {total}
+ </span>
+ </label>
<button
type="button"
aria-label={t("workspace_launcher.agents.increase").replace(
@@ -371,7 +398,7 @@ export function AgentAllocation({
)}
disabled={!agent.installed || count >= total}
onClick={() => setCount(agent.name, count + 1)}
- className="flex h-8 items-center justify-center text-muted-foreground hover:text-foreground disabled:opacity-30"
+ className="flex h-10 items-center justify-center text-muted-foreground transition-colors hover:bg-secondary/60 hover:text-foreground active:scale-95 disabled:opacity-30"
>
<Plus className="h-3.5 w-3.5" />
</button>
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgentMark.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgentMark.tsx
index 8a620e2f98..e2882c228b 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgentMark.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgentMark.tsx
@@ -6,14 +6,11 @@ import { cn } from "@/lib/utils";
const AGENT_LOGOS: Record<string, string> = {
claude: "/provider-logos/claude.svg",
codex: "/provider-logos/openai.svg",
+ glm: "/agent-logos/zai.svg",
kimi: "/agent-logos/kimi.svg",
opencode: "/agent-logos/opencode.svg",
};
-const AGENT_MONOGRAMS: Record<string, string> = {
- glm: "GLM",
-};
-
interface AgentMarkProps {
agent: string;
label: string;
@@ -37,8 +34,7 @@ export function AgentMark({
}: AgentMarkProps) {
const [failed, setFailed] = useState(false);
const logo = AGENT_LOGOS[agent];
- const monogram =
- AGENT_MONOGRAMS[agent] ?? (label.trim().slice(0, 2).toUpperCase() || "?");
+ const monogram = label.trim().slice(0, 2).toUpperCase() || "?";
const sizeClass =
size === "sm"
? "h-7 w-7 rounded-[5px]"