Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(society): the lead asks once which teammates you want and creates the ones you pick
rubenluetke10-beep3b809a416e04
diff --git a/jarvis/society/runtime.py b/jarvis/society/runtime.pyindex 55fac42219..0dc467d09a 100644--- a/jarvis/society/runtime.py+++ b/jarvis/society/runtime.py@@ -232,15 +232,28 @@ class SocietyRuntime:await self._notify_chat(agent, payload)async def _notify_chat(self, agent: AgentRecord, payload: dict[str, Any]) -> None:- """A society notice in the agent's own chat (learned skill, login needed)."""+ """A society notice in the agent's own chat (learned skill, login needed).++ The LEAD is the one agent whose card shows the app's own Jarvis chat+ rather than a ``society:`` session, so its notices go to the newest+ session of that surface — otherwise they would land where nobody looks.+ """svc = self._get_chat()post = getattr(svc, "post_notice", None)if svc is None or post is None:return- session = svc.store.get_session(agent.session_id)- if session is None:+ session_id = agent.session_id+ if agent.agent_id == LEAD_AGENT_ID:+ try:+ seen = svc.store.list_sessions(limit=1, surface="jarvis")+ except Exception: # noqa: BLE001 — falls back to the society session below+ log.warning("society: could not read the Jarvis chat sessions", exc_info=True)+ seen = []+ if seen:+ session_id = seen[0].session_id+ if svc.store.get_session(session_id) is None:return- await post(agent.session_id, payload)+ await post(session_id, payload)def cache_agent(self, agent: AgentRecord) -> None:self._agent_cache[agent.agent_id] = agent@@ -570,6 +583,9 @@ class SocietyRuntime:+ len(await self.quests.list(state=QuestState.ASSIGNED))+ len(await self.quests.list(state=QuestState.RUNNING)),"db_path": str(self.store.path),+ # The frontend offers the lead's team card once; this says whether+ # that offer has already been made (seeds.ONBOARDING_KEY).+ "onboarding_done": await self.store.get_meta("onboarding_done", "0") == "1",}async def say(diff --git a/jarvis/society/seeds.py b/jarvis/society/seeds.pyindex 238abfd26c..5fb7e6038b 100644--- a/jarvis/society/seeds.py+++ b/jarvis/society/seeds.py@@ -23,9 +23,25 @@ from .events import Tierfrom .focus import derive_approval_rules, derive_focusfrom .roster import Roster-__all__ = ["STARTER_TEAM", "proposal_for_capability", "propose_seeds", "seed_first_run"]+__all__ = [+ "ONBOARDING_KEY",+ "STARTER_TEAM",+ "create_from_proposals",+ "onboarding_done",+ "proposal_for_capability",+ "propose_seeds",+ "seed_first_run",+]_SEEDED_KEY: Final[str] = "seeded_starter_team"+#: Set once the lead has offered a team in its chat — the offer is made ONCE+#: whether or not the person answers it (agent-definition §6).+ONBOARDING_KEY: Final[str] = "onboarding_done"+++async def onboarding_done(store: Any) -> bool:+ return await store.get_meta(ONBOARDING_KEY, "0") == "1"+STARTER_TEAM: Final[tuple[dict[str, Any], ...]] = ({diff --git a/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsx b/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsxindex bc1a3c3b62..207d463e0c 100644--- a/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsx+++ b/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsx@@ -63,6 +63,9 @@ const CHAT_MEASURE = "mx-auto w-full max-w-[820px]";/** The line appended to a message that names an agent; Jarvis delegates on it. */const DELEGATE_MARK = "[to jarvis]";+/** The team offer is asked for once per app load; the backend decides the rest. */+let onboardingAsked = false;+export interface AgentChatPanelProps {agent: SocietyAgent;roster: SocietyAgent[];@@ -204,6 +207,17 @@ function JarvisChat({ agent, roster }: AgentChatPanelProps) {void loadSessions();}, [loadCatalog, loadSessions]);+ // First time the lead's card opens on a fresh society: it offers a team.+ // The backend decides whether anything is offered and remembers that it+ // asked, so this may fire as often as it likes.+ useEffect(() => {+ if (onboardingAsked) return;+ onboardingAsked = true;+ void fetch("/api/society/onboarding/start", { method: "POST" })+ .then(() => loadSessions())+ .catch(() => undefined);+ }, [loadSessions]);+// The front page's current conversation, or the latest one when the card// opens before the front page ever did.useEffect(() => {@@ -625,11 +639,20 @@ function ProposalCard({ item }: { item: NoticeItem }) {const payload = (item.data.payload ?? {}) as Record<string, unknown>;const detail = proposalDetail(kind, payload);const outcome = item.text.includes("\n") ? item.text.slice(item.text.indexOf("\n") + 1) : "";+ // A team offer is a pick list: everyone is proposed, the person keeps the+ // ones they want and the picked names ride along in the decision's note.+ const offered = useMemo(() => {+ const rows = (payload.proposals ?? []) as { name?: string; title?: string }[];+ if (rows.length > 0) return rows.map((r) => ({ name: String(r.name ?? ""), title: String(r.title ?? "") }));+ return ((payload.names ?? []) as string[]).map((n) => ({ name: String(n), title: "" }));+ }, [payload]);+ const [picked, setPicked] = useState<string[] | null>(null);+ const chosen = picked ?? offered.map((o) => o.name);const decide = async (approve: boolean) => {setBusy(true);setError("");try {- await resolve(proposalId, approve);+ await resolve(proposalId, approve, kind === "team" && approve ? chosen.join(", ") : "");} catch (err) {setError(err instanceof Error ? err.message : String(err));} finally {@@ -661,7 +684,34 @@ function ProposalCard({ item }: { item: NoticeItem }) {<p className="text-[11px] uppercase tracking-wide text-muted-foreground">{kind ? t(`society.chat.proposal_kind_${kind}`) : ""}</p>- <p className="whitespace-pre-wrap leading-relaxed text-foreground">{detail || summary}</p>+ {kind === "team" && !item.resolved ? (+ <ul className="flex flex-col gap-1">+ {offered.map((row) => (+ <li key={row.name} className="flex items-center gap-2">+ <input+ type="checkbox"+ id={`${proposalId}-${row.name}`}+ checked={chosen.includes(row.name)}+ disabled={busy}+ onChange={(e) =>+ setPicked(+ e.target.checked+ ? [...chosen, row.name]+ : chosen.filter((name) => name !== row.name),+ )+ }+ className="h-3.5 w-3.5 accent-[var(--primary)]"+ />+ <label htmlFor={`${proposalId}-${row.name}`} className="cursor-pointer text-foreground">+ <span className="font-medium">{row.name}</span>+ {row.title ? <span className="text-muted-foreground"> — {row.title}</span> : null}+ </label>+ </li>+ ))}+ </ul>+ ) : (+ <p className="whitespace-pre-wrap leading-relaxed text-foreground">{detail || summary}</p>+ )}{reason ? (<p className="leading-relaxed text-muted-foreground"><span className="font-medium">{t("society.chat.proposal_reason")}: </span>diff --git a/jarvis/ui/web/society_routes.py b/jarvis/ui/web/society_routes.pyindex 893ba105a3..df3d673160 100644--- a/jarvis/ui/web/society_routes.py+++ b/jarvis/ui/web/society_routes.py@@ -880,6 +880,58 @@ async def list_proposals(request: Request, agent_id: str | None = None) -> dict[return {"proposals": [a.to_dict() for a in items], "total": len(items)}[email protected]("/onboarding/start")+async def start_onboarding(request: Request) -> dict[str, Any]:+ """Offer a team ONCE, in the lead's own chat.++ The lead asks which tools the person uses and proposes the teammates the+ connected capabilities suggest — as one ``team`` proposal card the person+ confirms with the names they want. A no-op when the offer was already made+ or the roster already has teammates; the flag is set as soon as the offer+ goes out, so an unanswered card is never re-sent.+ """+ from jarvis.society import proposals+ from jarvis.society.roster import LEAD_AGENT_ID+ from jarvis.society.seeds import ONBOARDING_KEY, onboarding_done, propose_seeds++ rt = await _runtime(request)+ if await onboarding_done(rt.store):+ return {"offered": False, "reason": "already_offered"}+ roster = await rt.roster.list(include_archived=True)+ if len(roster) > 1:+ await rt.store.set_meta(ONBOARDING_KEY, "1")+ return {"offered": False, "reason": "roster_not_empty"}+ lead = await rt.roster.get(LEAD_AGENT_ID)+ if lead is None:+ raise HTTPException(404, {"reason": str(FailureReason.TARGET_UNKNOWN)})+ candidates = propose_seeds(rt.catalog(), {a.name for a in roster})+ if not candidates:+ await rt.store.set_meta(ONBOARDING_KEY, "1")+ return {"offered": False, "reason": "nothing_connected"}+ try:+ item = await proposals.propose(+ rt,+ lead,+ kind="team",+ payload={+ "names": [c["name"] for c in candidates],+ "proposals": [+ {"name": c["name"], "title": c["title"], "reason": c.get("reason", "")}+ for c in candidates+ ],+ },+ reason=(+ "These teammates fit the tools you already have connected. "+ "Pick the ones you want; you can add more at any time."+ ),+ session_id=lead.session_id,+ )+ except proposals.ProposalRefused as exc:+ raise HTTPException(409, {"reason": str(exc.reason), "detail": exc.detail}) from exc+ await rt.store.set_meta(ONBOARDING_KEY, "1")+ return {"offered": True, "proposal": item.to_dict()}++@router.post("/proposals/{proposal_id}/resolve", openapi_extra={"x-jarvis-dangerous": True})async def resolve_proposal(proposal_id: str, body: ResolveProposalBody, request: Requestdiff --git a/tests/contract/test_agent_mcp_harmony.py b/tests/contract/test_agent_mcp_harmony.pyindex f0052aed26..258e9e1d01 100644--- a/tests/contract/test_agent_mcp_harmony.py+++ b/tests/contract/test_agent_mcp_harmony.py@@ -69,6 +69,9 @@ WITHHELD: Final[dict[str, str]] = {"confirming a proposal changes an agent's rules, routines or skills — the ""owner's decision at their own keyboard, never a remote client's"),+ "POST /api/society/onboarding/start": (+ "the one-time team offer is onboarding UI in the lead's chat, not an API verb"+ ),"GET /api/society/seeds": "starter-team proposals are onboarding UI, not an API verb","POST /api/society/seeds/apply": ("onboarding, and it creates several agents at once — quest_post forges "diff --git a/tests/unit/society/test_onboarding.py b/tests/unit/society/test_onboarding.pynew file mode 100644index 0000000000..105b6e9fd1--- /dev/null+++ b/tests/unit/society/test_onboarding.py@@ -0,0 +1,66 @@+"""Onboarding: the lead offers a team ONCE, the person picks, only the picked+teammates are created."""++from __future__ import annotations++from pathlib import Path+from types import SimpleNamespace++from fastapi import FastAPI+from fastapi.testclient import TestClient++from jarvis.society.runtime import SocietyRuntime+from jarvis.ui.web.society_routes import router+++def _tool(name: str, desc: str) -> SimpleNamespace:+ return SimpleNamespace(name=name, description=desc, risk_tier="monitor")+++TOOLS = {+ "gmail": _tool("gmail", "Read and send mail."),+ "cli_gh": _tool("cli_gh", "GitHub CLI."),+}+++def _client(tmp_path: Path) -> tuple[TestClient, SocietyRuntime]:+ runtime = SocietyRuntime(tmp_path, seed_starter_team=False, brain_tools=lambda: TOOLS)+ app = FastAPI()+ app.include_router(router)+ app.state.society_factory = lambda: runtime+ return TestClient(app), runtime+++def test_the_first_open_proposes_a_team_once(tmp_path: Path) -> None:+ client, _ = _client(tmp_path)+ with client as c:+ first = c.post("/api/society/onboarding/start").json()+ assert first["offered"] is True+ names = first["proposal"]["action"]["payload"]["names"]+ assert "Mailbox" in names and "Repo" in names+ assert c.get("/api/society/status").json()["onboarding_done"] is True+ again = c.post("/api/society/onboarding/start").json()+ assert again == {"offered": False, "reason": "already_offered"}+ assert c.get("/api/society/proposals").json()["total"] == 1+++def test_confirming_creates_only_the_picked_teammates(tmp_path: Path) -> None:+ client, _ = _client(tmp_path)+ with client as c:+ item = c.post("/api/society/onboarding/start").json()["proposal"]+ out = c.post(+ f"/api/society/proposals/{item['id']}/resolve",+ json={"approve": True, "note": "Mailbox"},+ ).json()+ assert out["applied"] is True and "mailbox" in out["detail"]+ names = {a["name"] for a in c.get("/api/society/agents").json()["agents"]}+ assert "Mailbox" in names and "Repo" not in names+++def test_a_roster_that_already_has_teammates_is_never_asked(tmp_path: Path) -> None:+ client, _ = _client(tmp_path)+ with client as c:+ c.post("/api/society/agents", json={"name": "Scout"})+ body = c.post("/api/society/onboarding/start").json()+ assert body == {"offered": False, "reason": "roster_not_empty"}+ assert c.get("/api/society/proposals").json()["total"] == 0