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(chat): @ in the Jarvis chat names your agents and connected plugins

rubenluetke10-beep4c46d7946692
diff --git a/jarvis/agent_chat/typeahead.py b/jarvis/agent_chat/typeahead.py
index 0bea8e85ce..36733bbd66 100644
--- a/jarvis/agent_chat/typeahead.py
+++ b/jarvis/agent_chat/typeahead.py
@@ -80,6 +80,8 @@ GROUP_ACCOUNT: Final[str] = "account"
GROUP_PLUGINS: Final[str] = "plugins"
GROUP_JARVIS: Final[str] = "jarvis"
GROUP_AGENTS: Final[str] = "agents"
+#: The user's own agents (the society roster) — not a CLI's subagents.
+GROUP_TEAMMATES: Final[str] = "teammates"
GROUP_FILES: Final[str] = "files"
#: Hidden directories that still hold things worth offering under ``@``.
@@ -124,8 +126,15 @@ class Suggestion:
#: but its chat completes teammates and capabilities with ``@`` as well.
TRIGGERS_BY_SURFACE: Final[dict[str, tuple[str, ...]]] = {
"society": (SLASH, MENTION),
+ # The front page's Jarvis chat: ``@`` names the user's agents here, and
+ # the composer adds the connected plugins and tools from the same catalog
+ # its Add menu reads (``/api/agent-chat/tools``), whatever seat answers.
+ "jarvis": (MENTION,),
}
+#: The society's lead is Jarvis itself — the front page never offers it.
+_LEAD_AGENT_ID: Final[str] = "jarvis"
+
def triggers_for(runner: str, surface: str = "") -> tuple[str, ...]:
"""The trigger characters a seat honours; unknown runners get none.
@@ -175,6 +184,11 @@ def suggest(
# Teammates and connected capabilities — never the folder's files: an
# agent works in its own workspace and reaches tools by name.
rows = _filter_definitions(teammates(agent_id) + connected_capabilities(), q)
+ elif surface == "jarvis":
+ # The Jarvis chat's folder is a scratch workspace, not a project, so
+ # its files are never what "@" means there. The agents are; the
+ # composer merges the plugin catalog in beside them.
+ rows = _filter_definitions(teammates(_LEAD_AGENT_ID), q)
else:
rows = claude_agents(folder) if runner in _CLAUDE_SHAPED else []
rows = _filter_definitions(rows, q) if q else rows
@@ -213,11 +227,12 @@ def teammates(agent_id: str) -> list[Suggestion]:
continue
out.append(
Suggestion(
- value=agent.name,
+ # "X Marketing" would end the @token at its space.
+ value=re.sub(r"\s+", "-", agent.name.strip()),
label=agent.name,
hint=agent.title,
kind="agent",
- group=GROUP_AGENTS,
+ group=GROUP_TEAMMATES,
)
)
return out
@@ -861,6 +876,7 @@ def file_suggestions(folder: Path | None, query: str, *, limit: int = 40) -> lis
__all__ = [
"GROUP_ACCOUNT",
"GROUP_AGENTS",
+ "GROUP_TEAMMATES",
"GROUP_FILES",
"GROUP_JARVIS",
"GROUP_PLUGINS",
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
index 6fca981441..ce01259c28 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
@@ -235,6 +235,8 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
provider: draft.provider,
cwd: draft.cwd,
triggers,
+ model: draft.model,
+ stance: draft.permissionMode,
}, fieldRef);
const running = runningTurn(timeline) !== null;
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/ComposerTypeahead.tsx b/jarvis/ui/web/frontend/src/components/agentchat/ComposerTypeahead.tsx
index c6e34663e6..38196d3c8c 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/ComposerTypeahead.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/ComposerTypeahead.tsx
@@ -3,6 +3,8 @@ import { createPortal } from "react-dom";
import { Bot, FileText, Folder, Sparkles, TerminalSquare } from "lucide-react";
import { groupRuns, type TypeaheadItem } from "@/components/agentchat/typeahead";
+import { ToolChoiceIcon } from "@/components/agentchat/ToolChoiceChips";
+import { toolIdentityStyle } from "@/components/agentchat/toolIdentity";
import { useT } from "@/i18n";
import { cn } from "@/lib/utils";
@@ -116,6 +118,10 @@ export function ComposerTypeahead({
runningIndex += 1;
const active = index === activeIndex;
const Icon = kindIcon(item.kind);
+ // A named thing (an agent, a plugin) reads by its name first,
+ // the way the agents' own picker shows it; a file or a command
+ // keeps the terse `@value` row.
+ const named = Boolean(item.choice) || (item.kind === "agent" && item.label !== item.value);
return (
<div
key={`${item.group}:${item.value}`}
@@ -130,13 +136,32 @@ export function ComposerTypeahead({
active ? "bg-primary/15 text-foreground" : "text-foreground",
)}
>
- <Icon className="h-3.5 w-3.5 shrink-0 text-muted-foreground" aria-hidden />
- <span className="shrink-0 font-mono text-meta">
- <span className="text-muted-foreground">{trigger}</span>
- {item.value}
- </span>
- {item.hint && (
- <span className="min-w-0 flex-1 truncate text-xs text-muted-foreground">{item.hint}</span>
+ {item.choice ? (
+ <span className="tool-identity inline-flex shrink-0" style={toolIdentityStyle(item.choice)} aria-hidden>
+ <ToolChoiceIcon row={item.choice} size={16} />
+ </span>
+ ) : (
+ <Icon className="h-3.5 w-3.5 shrink-0 text-muted-foreground" aria-hidden />
+ )}
+ {named ? (
+ <span className="flex min-w-0 flex-1 items-baseline gap-2">
+ <span className="shrink-0 font-medium">{item.label}</span>
+ <span className="shrink-0 font-mono text-xs text-muted-foreground">
+ {trigger}
+ {item.value}
+ </span>
+ {item.hint && <span className="min-w-0 truncate text-xs text-muted-foreground">{item.hint}</span>}
+ </span>
+ ) : (
+ <>
+ <span className="shrink-0 font-mono text-meta">
+ <span className="text-muted-foreground">{trigger}</span>
+ {item.value}
+ </span>
+ {item.hint && (
+ <span className="min-w-0 flex-1 truncate text-xs text-muted-foreground">{item.hint}</span>
+ )}
+ </>
)}
</div>
);
@@ -150,6 +175,8 @@ export function ComposerTypeahead({
}
function groupLabel(group: string, t: (key: string) => string): string {
+ // Catalog rows head their runs with the Add menu's own category names.
+ if (group.startsWith("tool:")) return t(`chat_tools.${group.slice(5)}`);
switch (group) {
case "project":
return t("agent_chat.typeahead_group_project");
@@ -161,6 +188,8 @@ function groupLabel(group: string, t: (key: string) => string): string {
return t("agent_chat.typeahead_group_jarvis");
case "agents":
return t("agent_chat.typeahead_group_agents");
+ case "teammates":
+ return t("nav.agents");
case "files":
return t("agent_chat.typeahead_group_files");
default:
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/composerTypeahead.test.tsx b/jarvis/ui/web/frontend/src/components/agentchat/composerTypeahead.test.tsx
index 35f8d354af..1beca8c46b 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/composerTypeahead.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/composerTypeahead.test.tsx
@@ -4,7 +4,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { AgentComposer } from "@/components/agentchat/AgentComposer";
import { AgentChatStoreProvider } from "@/components/agentchat/AgentChatStoreContext";
import { EMPTY_TIMELINE } from "@/components/agentchat/reduce";
-import { useAgentSessionStore as useAgentChatStore } from "@/store/agentChat";
+import { useAgentSessionStore as useAgentChatStore, useAgentChatStore as useJarvisChatStore } from "@/store/agentChat";
import { useEventStore } from "@/store/events";
import type { AgentChatCatalog } from "@/lib/agentChatApi";
@@ -223,4 +223,63 @@ describe("composer typeahead", () => {
expect(screen.queryByTestId("composer-typeahead")).toBeNull();
expect(fetchMock.mock.calls.some((c) => String(c[0]).includes("/typeahead"))).toBe(false);
});
+
+ it("names agents and connected plugins after @ in the Jarvis chat, and a picked plugin becomes its chip", async () => {
+ const tools = [
+ { id: "plugin:gmail", label: "Gmail", description: "Read and send mail", category: "plugins", group: "plugins",
+ brand: "gmail", available: true, tool_names: [], skill: "" },
+ { id: "plugin:notion", label: "Notion", description: "Pages", category: "plugins", group: "plugins",
+ brand: "notion", available: false, tool_names: [], skill: "" },
+ ];
+ fetchMock.mockImplementation(async (url: string) => {
+ const u = String(url);
+ if (u.includes("/api/agent-chat/typeahead")) {
+ return { ok: true, status: 200, json: async () => ({ trigger: "@", truncated: false,
+ items: [{ value: "Mailbox", label: "Mailbox", hint: "Gmail agent", kind: "agent", group: "teammates" }] }) } as Response;
+ }
+ if (u.includes("/api/agent-chat/tools")) {
+ return { ok: true, status: 200, json: async () => ({ items: tools, mode: "browse", total: tools.length }) } as Response;
+ }
+ return { ok: true, status: 200, json: async () => ({}) } as Response;
+ });
+ seedJarvis(catalog(["@"]));
+ render(
+ <AgentChatStoreProvider store={useJarvisChatStore}>
+ <AgentComposer />
+ </AgentChatStoreProvider>,
+ );
+ type("ask @");
+
+ await waitFor(() => expect(screen.getAllByTestId("composer-typeahead-item")).toHaveLength(2));
+ const rows = screen.getAllByTestId("composer-typeahead-item").map((r) => r.textContent);
+ // The agent first, then the connected plugin; the disconnected one waits for a search.
+ expect(rows[0]).toContain("@Mailbox");
+ expect(rows[1]).toContain("Gmail");
+ expect(screen.getByTestId("composer-typeahead").textContent).toContain("Agents");
+ const asked = fetchMock.mock.calls.map((c) => String(c[0]));
+ expect(asked.some((u) => u.includes("/api/agent-chat/typeahead") && u.includes("surface=jarvis"))).toBe(true);
+
+ fireEvent.click(screen.getAllByTestId("composer-typeahead-item")[1]);
+ await waitFor(() => expect(box().querySelector('[data-tool-chip][data-tool-id="plugin:gmail"]')).toBeTruthy());
+ });
});
+
+function seedJarvis(cat: AgentChatCatalog) {
+ useJarvisChatStore.setState({
+ catalog: cat,
+ connections: [{ jarvis: "claude-api", key_set: true, is_active_brain: true }],
+ catalogError: null,
+ backendOutdated: false,
+ liveModels: {},
+ sessions: [],
+ activeSessionId: "s-1",
+ activeSession: null,
+ timeline: EMPTY_TIMELINE,
+ draft: { provider: "claude-api", model: "", effort: "high", permissionMode: "default", buildMode: "default", cwd: "C:\work" },
+ busy: false,
+ lastError: null,
+ loadCatalog: async () => {},
+ loadSessions: async () => {},
+ loadModels: async () => {},
+ } as never);
+}
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/typeahead.ts b/jarvis/ui/web/frontend/src/components/agentchat/typeahead.ts
index 395e675775..de9372eb39 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/typeahead.ts
+++ b/jarvis/ui/web/frontend/src/components/agentchat/typeahead.ts
@@ -4,11 +4,16 @@
*
* Three gestures, the ones every coding CLI has: `/` for skills and commands,
* `@` for files (and Claude Code's subagents), `$` for Codex's explicit skill
- * mention. Which of them a chat honours is the backend's word — the catalog
+ * mention. In the front page's Jarvis chat `@` names the user's agents and
+ * the connected plugins and tools instead — a picked tool lands as the same
+ * brand chip the Add menu inserts. Which of them a chat honours is the backend's word — the catalog
* row's `typeahead` list, decided from the seat's runner — so the box never
* opens a `/` list for a seat that would read the slash as plain text.
*/
+import { choiceTag } from "./composerChips";
+import { browseToolRows, type ToolChoice } from "./toolChoices";
+
export interface TypeaheadItem {
/** What lands after the trigger character — `commit`, `github:issue`, `src/app.py`. */
value: string;
@@ -16,8 +21,10 @@ export interface TypeaheadItem {
hint: string;
/** skill | command | agent | file | folder */
kind: string;
- /** project | account | plugins | jarvis | agents | files */
+ /** project | account | plugins | jarvis | agents | teammates | files | tool:<category> */
group: string;
+ /** A plugin or tool from the composer's catalog: the pick becomes its chip. */
+ choice?: ToolChoice;
}
export interface TypeaheadResponse {
@@ -97,6 +104,22 @@ export function filterItems(items: readonly TypeaheadItem[], query: string): Typ
return ranked.map((r) => r.item);
}
+/**
+ * Catalog rows (`/api/agent-chat/tools`) as `@` rows, in the Add menu's order
+ * and with its rules: connectors, not the skills behind them, and nothing
+ * disconnected until someone types a name.
+ */
+export function toolTypeaheadItems(rows: readonly ToolChoice[], query: string): TypeaheadItem[] {
+ return browseToolRows([...rows], query).map((row) => ({
+ value: choiceTag(row),
+ label: row.label,
+ hint: row.description,
+ kind: "tool",
+ group: `tool:${row.category}`,
+ choice: row,
+ }));
+}
+
/** Triggers whose list is read once and filtered here; `@` asks the backend per keystroke. */
export function isStaticTrigger(trigger: string): boolean {
return trigger === "/" || trigger === "$";
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/useComposerTypeahead.ts b/jarvis/ui/web/frontend/src/components/agentchat/useComposerTypeahead.ts
index 65f1a9ae11..4019a084fc 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/useComposerTypeahead.ts
+++ b/jarvis/ui/web/frontend/src/components/agentchat/useComposerTypeahead.ts
@@ -2,11 +2,13 @@ import { useCallback, useEffect, useMemo, useRef, useState, type KeyboardEvent,
import type { ComposerChipFieldHandle } from "@/components/agentchat/ComposerChipField";
import { fetchTypeahead, type AgentChatSurface } from "@/lib/agentChatApi";
+import { searchTools } from "@/components/agentchat/toolChoices";
import {
activeToken,
applyPick,
filterItems,
isStaticTrigger,
+ toolTypeaheadItems,
type ActiveToken,
type TypeaheadItem,
} from "@/components/agentchat/typeahead";
@@ -39,6 +41,29 @@ interface Seat {
provider: string;
cwd: string;
triggers: readonly string[];
+ /** The Jarvis chat's model and permission stance — what its tool catalog is read for. */
+ model?: string;
+ stance?: string;
+}
+
+/**
+ * The Jarvis chat's `@` list: the agents the backend names, then the plugins
+ * and tools the Add menu offers. Either half failing leaves the other.
+ */
+async function jarvisMentions(seat: Seat, query: string, signal: AbortSignal): Promise<TypeaheadItem[]> {
+ const [agents, tools] = await Promise.allSettled([
+ fetchTypeahead({ surface: seat.surface, provider: seat.provider, cwd: seat.cwd, trigger: "@", q: query }, signal),
+ searchTools(
+ { provider: seat.provider, model: seat.model ?? "", cwd: seat.cwd, stance: seat.stance ?? "ask", q: query },
+ signal,
+ ),
+ ]);
+ if (signal.aborted) throw new DOMException("aborted", "AbortError");
+ if (agents.status === "rejected" && tools.status === "rejected") throw agents.reason;
+ return [
+ ...(agents.status === "fulfilled" ? agents.value.items : []),
+ ...(tools.status === "fulfilled" ? toolTypeaheadItems(tools.value.items, query) : []),
+ ];
}
/**
@@ -48,7 +73,8 @@ interface Seat {
* (`typeahead.ts`), the list for that trigger is shown, filtered by what was
* typed after it. `/` and `$` lists are read once per seat and folder and
* filtered here; `@` asks the backend per keystroke, because the folder's
- * file list is too large to ship. Escape dismisses the list for THIS token
+ * file list is too large to ship. On the Jarvis surface `@` also reads the
+ * tool catalog, and picking a tool writes its chip, not a bare word. Escape dismisses the list for THIS token
* only — a `/` typed on purpose as text must not keep re-opening, and the
* next token opens as usual.
*/
@@ -97,7 +123,7 @@ export function useComposerTypeahead(
refresh();
}, [value, refresh]);
- const seatKey = `${seat.surface}|${seat.provider}|${seat.cwd}`;
+ const seatKey = `${seat.surface}|${seat.provider}|${seat.cwd}|${seat.model ?? ""}|${seat.stance ?? ""}`;
const trigger = token?.trigger ?? null;
const query = token?.query ?? "";
@@ -123,20 +149,24 @@ export function useComposerTypeahead(
setLoading(true);
const timer = window.setTimeout(
() => {
- fetchTypeahead(
- {
- surface: wanted.surface,
- provider: wanted.provider,
- cwd: wanted.cwd,
- trigger,
- q: isStaticTrigger(trigger) ? "" : query,
- },
- controller.signal,
- )
- .then((res) => {
+ const request: Promise<TypeaheadItem[]> =
+ wanted.surface === "jarvis" && trigger === "@"
+ ? jarvisMentions(wanted, query, controller.signal)
+ : fetchTypeahead(
+ {
+ surface: wanted.surface,
+ provider: wanted.provider,
+ cwd: wanted.cwd,
+ trigger,
+ q: isStaticTrigger(trigger) ? "" : query,
+ },
+ controller.signal,
+ ).then((res) => res.items);
+ request
+ .then((rows) => {
if (controller.signal.aborted) return;
- if (isStaticTrigger(trigger)) staticCache.current.set(key, { at: Date.now(), items: res.items });
- setRawItems(res.items);
+ if (isStaticTrigger(trigger)) staticCache.current.set(key, { at: Date.now(), items: rows });
+ setRawItems(rows);
setLoading(false);
})
.catch(() => {
@@ -182,7 +212,13 @@ export function useComposerTypeahead(
if (!token) return;
const applied = applyPick(field?.getDraft().text ?? box?.value ?? value, token, item);
setValue(applied.text);
- if (field) field.hydrate(applied.text, field.getDraft().choices);
+ // A catalog tool joins the draft's choices, so hydrating turns its
+ // `@tag` into the brand chip the turn sends as a selection.
+ if (field) {
+ const choices = field.getDraft().choices;
+ const chosen = item.choice;
+ field.hydrate(applied.text, chosen && !choices.some((c) => c.id === chosen.id) ? [...choices, chosen] : choices);
+ }
dismissedStart.current = null;
setToken(null);
window.requestAnimationFrame(() => {
diff --git a/tests/unit/agent_chat/test_typeahead.py b/tests/unit/agent_chat/test_typeahead.py
index 27e73e05e8..ba454d423c 100644
--- a/tests/unit/agent_chat/test_typeahead.py
+++ b/tests/unit/agent_chat/test_typeahead.py
@@ -415,6 +415,30 @@ def test_a_society_session_lists_teammates_and_connected_capabilities(tmp_path,
assert slash["items"][0]["value"] == "weekly-digest" # its own skills first
+def test_the_jarvis_chat_mentions_agents_never_its_scratch_folder(tmp_path, monkeypatch):
+ """The front page's "@" names the user's agents on every seat; the chat's
+ workspace folder is scratch space, so its files never show up there."""
+ from types import SimpleNamespace
+
+ from jarvis.agent_chat import typeahead as ta
+
+ assert ta.triggers_for("brain", "jarvis") == ("/", "@")
+ assert ta.triggers_for("codex-cli", "jarvis") == ("@", "$")
+ (tmp_path / "0.26.0").write_text("", encoding="utf-8")
+ rows = [
+ SimpleNamespace(agent_id="jarvis", name="Jarvis", title="Lead", state="active"),
+ SimpleNamespace(agent_id="mailbox", name="Mailbox", title="Gmail agent", state="active"),
+ ]
+ runtime = SimpleNamespace(roster=SimpleNamespace(snapshot=lambda: rows), catalog=lambda: [])
+ monkeypatch.setattr(ta, "_society_runtime", lambda: runtime)
+
+ for runner in ("brain", "api", "claude-cli"):
+ got = ta.suggest(runner=runner, cwd=tmp_path, trigger="@", surface="jarvis")
+ assert [i["value"] for i in got["items"]] == ["Mailbox"] # the lead and files stay out
+ narrowed = ta.suggest(runner="api", cwd=tmp_path, trigger="@", surface="jarvis", query="zz")
+ assert narrowed["items"] == []
+
+
def test_a_society_lookup_without_a_runtime_is_empty_not_an_error(tmp_path, monkeypatch):
from jarvis.agent_chat import typeahead as ta