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 chat shows a proposal card with Confirm and Reject
rubenluetke10-beep51fc260de1fc
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/reduce.test.ts b/jarvis/ui/web/frontend/src/components/agentchat/reduce.test.tsindex e580acc02c..c826ad20a9 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/reduce.test.ts+++ b/jarvis/ui/web/frontend/src/components/agentchat/reduce.test.ts@@ -208,4 +208,43 @@ describe("agent-chat reduce: notices", () => {it("drops an empty notice", () => {expect(reduceEvent(EMPTY_TIMELINE, ev("notice", {}, false))).toBe(EMPTY_TIMELINE);});++ it("folds a proposal notice and its resolution into one row", () => {+ const tl = reduceEvents(EMPTY_TIMELINE, [+ ev("notice", {+ kind: "proposal",+ proposal_id: "p1",+ proposal_kind: "rule",+ summary: "Add a standing rule: Always answer in English.",+ payload: { text: "Always answer in English." },+ reason: "asked",+ status: "pending",+ agent_id: "mailbox",+ agent_name: "Mailbox",+ text: "Add a standing rule: Always answer in English.",+ }),+ ev("notice", {+ kind: "proposal_resolved",+ proposal_id: "p1",+ status: "applied",+ text: "standing rule added to the description",+ agent_id: "mailbox",+ agent_name: "Mailbox",+ }),+ ]);+ expect(tl.items).toHaveLength(1);+ const card = tl.items[0];+ if (card.type !== "notice") throw new Error("unreachable");+ expect(card.kind).toBe("proposal");+ expect(card.resolved).toBe("applied");+ expect(card.data.proposal_kind).toBe("rule");+ expect((card.data.payload as { text: string }).text).toBe("Always answer in English.");+ expect(card.text).toContain("standing rule added");+ // An outcome for a card this timeline never saw is still shown, as its own row.+ const orphan = reduceEvent(+ EMPTY_TIMELINE,+ ev("notice", { kind: "proposal_resolved", proposal_id: "p9", status: "rejected", text: "Rejected." }),+ );+ expect(orphan.items).toHaveLength(1);+ });});diff --git a/jarvis/ui/web/frontend/src/components/agentchat/reduce.ts b/jarvis/ui/web/frontend/src/components/agentchat/reduce.tsindex 5ae88294e3..d4a4e6fd1c 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/reduce.ts+++ b/jarvis/ui/web/frontend/src/components/agentchat/reduce.ts@@ -133,6 +133,10 @@ export interface NoticeItem {/** "done" | "blocked" | "" for notices that carry no outcome. */status: string;tsMs: number;+ /** The raw notice payload — a proposal card reads its kind, summary, reason, payload. */+ data: Record<string, unknown>;+ /** A proposal's outcome once the person decided: "applied" | "rejected" | "failed" | "". */+ resolved: string;}export type TimelineItem = UserItem | TurnItem | ErrorItem | NoticeItem;@@ -574,6 +578,25 @@ export function reduceEvent(tl: Timeline, ev: AgentChatEvent): Timeline {const text = str(p.text);const kind = str(p.kind);if (!text && !kind) return base;+ if (kind === "proposal_resolved") {+ // The outcome of a proposal patches the card it answers, never a second row.+ const proposalId = str(p.proposal_id);+ const index = base.items.findIndex(+ (item) => item.type === "notice" && item.kind === "proposal" && str(item.data.proposal_id) === proposalId,+ );+ if (index >= 0) {+ const card = base.items[index] as NoticeItem;+ return {+ ...base,+ items: replaceAt(base.items, index, {+ ...card,+ resolved: str(p.status) || "applied",+ status: str(p.status),+ text: text ? `${card.text}\n${text}` : card.text,+ }),+ };+ }+ }return {...base,items: [@@ -587,6 +610,8 @@ export function reduceEvent(tl: Timeline, ev: AgentChatEvent): Timeline {agentId: str(p.agent_id),status: str(p.status),tsMs: ev.ts_ms,+ data: p as Record<string, unknown>,+ resolved: "",},],};diff --git a/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsx b/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsxindex a3057cf4b2..09dce25259 100644--- a/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsx+++ b/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsx@@ -47,7 +47,7 @@ import { createAgentChatStore, useAgentChatStore } from "@/store/agentChat";import type { AgentChatSurface } from "@/lib/agentChatApi";import { AgentSwatch } from "../AgentSwatch";-import type { SocietyAgent } from "../data";+import { useResolveProposal, type SocietyAgent } from "../data";/** A gap this long between messages earns a fresh time stamp. */const STAMP_GAP_MS = 30 * 60_000;@@ -530,7 +530,11 @@ function Transcript({) : item.type === "turn" ? (<TurnBubble item={item} onDecide={onDecide} />) : item.type === "notice" ? (- <NoticeLine item={item} />+ item.kind === "proposal" ? (+ <ProposalCard item={item} />+ ) : (+ <NoticeLine item={item} />+ )) : (<p className="self-start rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive">{item.text}</p>)}@@ -574,6 +578,127 @@ function NoticeLine({ item }: { item: NoticeItem }) {);}+/** One human-readable line per proposal kind, read off the typed payload. */+function proposalDetail(kind: string, payload: Record<string, unknown>): string {+ const list = (v: unknown): string => (Array.isArray(v) ? v.map(String).join(", ") : "");+ switch (kind) {+ case "rule":+ return String(payload.text ?? "");+ case "skill":+ return `${String(payload.name ?? "")}: ${String(payload.goal ?? "")}`;+ case "routine": {+ const schedule = (payload.schedule ?? {}) as Record<string, unknown>;+ const when = Object.entries(schedule)+ .map(([k, v]) => `${k}=${String(v)}`)+ .join(" ");+ return `${String(payload.title ?? "")} — ${when}`;+ }+ case "approval_rule": {+ const parts: string[] = [];+ if (list(payload.require_approval)) parts.push(`ask first: ${list(payload.require_approval)}`);+ if (list(payload.always_allow)) parts.push(`always allow: ${list(payload.always_allow)}`);+ return parts.join(" · ");+ }+ case "focus":+ return list(payload.focus);+ case "team":+ return list(payload.names);+ default:+ return "";+ }+}++/**+ * The agent proposed a change to itself (a standing rule, a skill, a routine,+ * approval rules, its focus). Nothing has changed yet: the person decides here,+ * and the outcome patches this same card.+ */+function ProposalCard({ item }: { item: NoticeItem }) {+ const t = useT();+ const resolve = useResolveProposal();+ const [busy, setBusy] = useState(false);+ const [error, setError] = useState("");+ const kind = String(item.data.proposal_kind ?? "");+ const proposalId = String(item.data.proposal_id ?? "");+ const summary = String(item.data.summary ?? item.text);+ const reason = String(item.data.reason ?? "");+ 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) : "";+ const decide = async (approve: boolean) => {+ setBusy(true);+ setError("");+ try {+ await resolve(proposalId, approve);+ } catch (err) {+ setError(err instanceof Error ? err.message : String(err));+ } finally {+ setBusy(false);+ }+ };+ const resolvedLabel =+ item.resolved === "applied"+ ? t("society.chat.proposal_applied")+ : item.resolved === "rejected"+ ? t("society.chat.proposal_rejected")+ : item.resolved+ ? t("society.chat.proposal_failed")+ : "";+ return (+ <div+ className={cn(+ "flex max-w-[85%] flex-col gap-1.5 self-start rounded-2xl rounded-bl-md border px-3.5 py-2.5 text-xs",+ item.resolved === "applied"+ ? "border-primary/40 bg-primary/5"+ : item.resolved+ ? "border-border bg-card"+ : "border-primary/60 bg-card",+ )}+ >+ <p className="font-medium text-foreground">+ {t("society.chat.proposal_title").replace("{0}", item.agentName || t("society.chat.result_agent"))}+ </p>+ <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>+ {reason ? (+ <p className="leading-relaxed text-muted-foreground">+ <span className="font-medium">{t("society.chat.proposal_reason")}: </span>+ {reason}+ </p>+ ) : null}+ {item.resolved ? (+ <p className={cn("font-medium", item.resolved === "failed" ? "text-destructive" : "text-foreground")}>+ {resolvedLabel}+ {outcome ? <span className="font-normal text-muted-foreground"> — {outcome}</span> : null}+ </p>+ ) : (+ <div className="mt-1 flex items-center gap-2">+ <button+ type="button"+ disabled={busy}+ onClick={() => void decide(true)}+ className="rounded-md bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50"+ >+ {t("society.chat.proposal_confirm")}+ </button>+ <button+ type="button"+ disabled={busy}+ onClick={() => void decide(false)}+ className="rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground hover:bg-muted disabled:opacity-50"+ >+ {t("society.chat.proposal_reject")}+ </button>+ <span className="text-muted-foreground">{t("society.chat.proposal_pending")}</span>+ </div>+ )}+ {error ? <p className="text-destructive">{error}</p> : null}+ </div>+ );+}+/** What the person typed, without the delegation line the composer added. */function visibleUserText(text: string): string {return textdiff --git a/jarvis/ui/web/frontend/src/components/society/data.ts b/jarvis/ui/web/frontend/src/components/society/data.tsindex e317bed3de..6ca58c60d9 100644--- a/jarvis/ui/web/frontend/src/components/society/data.ts+++ b/jarvis/ui/web/frontend/src/components/society/data.ts@@ -400,6 +400,27 @@ export function useCreateAgent() {);}+/**+ * Decide a configuration proposal the agent made in its chat+ * (`POST /api/society/proposals/{id}/resolve`). A yes APPLIES the change on+ * the roster, so the roster query is refreshed afterwards.+ */+export function useResolveProposal() {+ const client = useQueryClient();+ return useCallback(+ async (proposalId: string, approve: boolean, note = ""): Promise<void> => {+ const res = await fetch(`/api/society/proposals/${encodeURIComponent(proposalId)}/resolve`, {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ approve, note }),+ });+ if (!res.ok) throw new Error(`proposal ${res.status}`);+ await client.invalidateQueries({ queryKey: ROSTER_QUERY_KEY });+ },+ [client],+ );+}+/** Pause or resume an agent (`PATCH /api/society/agents/{id}`); sample rows flip locally. */export function useSetAgentPaused() {const client = useQueryClient();diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 2c0e29f636..e2d07d2e06 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -5099,6 +5099,20 @@"proposal_kind_routine": "Routine","proposal_kind_approval_rule": "Freigaberegeln","proposal_kind_focus": "Werkzeuge, die zuerst genutzt werden",+ "proposal_kind_team": "Teammitglieder",+ "proposal_title": "{0} schlägt eine Änderung vor",+ "proposal_reason": "Warum",+ "proposal_confirm": "Bestätigen",+ "proposal_reject": "Ablehnen",+ "proposal_pending": "Wartet auf deine Entscheidung",+ "proposal_applied": "Übernommen",+ "proposal_rejected": "Abgelehnt",+ "proposal_failed": "Konnte nicht übernommen werden",+ "proposal_kind_rule": "Feste Regel",+ "proposal_kind_skill": "Als Skill sichern",+ "proposal_kind_routine": "Routine",+ "proposal_kind_approval_rule": "Freigaberegeln",+ "proposal_kind_focus": "Werkzeuge, die zuerst genutzt werden","proposal_kind_team": "Teammitglieder"},"world": {diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 0b94d5761e..7ff1754b28 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -5132,6 +5132,20 @@"proposal_kind_routine": "Routine","proposal_kind_approval_rule": "Approval rules","proposal_kind_focus": "Tools to reach for first",+ "proposal_kind_team": "Teammates",+ "proposal_title": "{0} proposes a change",+ "proposal_reason": "Why",+ "proposal_confirm": "Confirm",+ "proposal_reject": "Reject",+ "proposal_pending": "Waiting for your decision",+ "proposal_applied": "Applied",+ "proposal_rejected": "Rejected",+ "proposal_failed": "Could not be applied",+ "proposal_kind_rule": "Standing rule",+ "proposal_kind_skill": "Save as a skill",+ "proposal_kind_routine": "Routine",+ "proposal_kind_approval_rule": "Approval rules",+ "proposal_kind_focus": "Tools to reach for first","proposal_kind_team": "Teammates"},"world": {diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 109860fe90..6c8c2e6fcc 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -5099,6 +5099,20 @@"proposal_kind_routine": "Rutina","proposal_kind_approval_rule": "Reglas de aprobación","proposal_kind_focus": "Herramientas a usar primero",+ "proposal_kind_team": "Compañeros de equipo",+ "proposal_title": "{0} propone un cambio",+ "proposal_reason": "Por qué",+ "proposal_confirm": "Confirmar",+ "proposal_reject": "Rechazar",+ "proposal_pending": "Esperando tu decisión",+ "proposal_applied": "Aplicado",+ "proposal_rejected": "Rechazado",+ "proposal_failed": "No se pudo aplicar",+ "proposal_kind_rule": "Regla fija",+ "proposal_kind_skill": "Guardar como habilidad",+ "proposal_kind_routine": "Rutina",+ "proposal_kind_approval_rule": "Reglas de aprobación",+ "proposal_kind_focus": "Herramientas a usar primero","proposal_kind_team": "Compañeros de equipo"},"world": {