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
fix(society): say what a waiting agent needs, e.g. "Sign in to Hacker News" (#1128)
Ruben Lütke795d3026d205
diff --git a/dodaios/ui/web/frontend/src/components/society/card/AgentHeader.tsx b/dodaios/ui/web/frontend/src/components/society/card/AgentHeader.tsxindex 905636b83f..3d0192c5ad 100644--- a/dodaios/ui/web/frontend/src/components/society/card/AgentHeader.tsx+++ b/dodaios/ui/web/frontend/src/components/society/card/AgentHeader.tsx@@ -23,7 +23,7 @@ import { AgentSwatch } from "../AgentSwatch";import { agentTint } from "../agentTint";import { rowToAgent, type SocietyAgent } from "../data";import { useAttentionStore } from "../attention/attentionStore";-import { previewText, readableWaiting, rosterStatus, waitingReasonOf } from "../roster/rosterPreview";+import { rosterStatus, waitingLine, waitingReasonOf } from "../roster/rosterPreview";import { StatusMark } from "../roster/RosterRow";import type { DetailsControl } from "./AgentChatLayout";import { AGENT_APPROVAL_MODES, modeSupported, runnerFor } from "./approvalModes";@@ -48,8 +48,7 @@ export function AgentHeader({ agent, details }: AgentHeaderProps) {let phrase: ReactNode = null;if (status === "needs-you") {- const summary = readableWaiting(previewText(reason?.summary), t);- phrase = <span className="as-pill-status text-warning">{summary ? `${t("society.shell.preview_needs_you")} · ${summary}` : t("society.shell.status_waiting")}</span>;+ phrase = <span className="as-pill-status text-warning">{waitingLine(reason, t) || t("society.shell.status_waiting")}</span>;} else if (status === "working") {phrase = <span className="as-pill-status as-shimmer">{t("society.shell.preview_working")}</span>;} else if (status === "paused") {diff --git a/dodaios/ui/web/frontend/src/components/society/roster/RosterHoverCard.tsx b/dodaios/ui/web/frontend/src/components/society/roster/RosterHoverCard.tsxindex 730b6f5610..c722f2aebb 100644--- a/dodaios/ui/web/frontend/src/components/society/roster/RosterHoverCard.tsx+++ b/dodaios/ui/web/frontend/src/components/society/roster/RosterHoverCard.tsx@@ -11,7 +11,7 @@ import { useT } from "@/i18n";import { AgentSwatch } from "../AgentSwatch";import { agentTint } from "../agentTint";import type { SocietyAgent } from "../data";-import { previewText, readableWaiting, type RosterStatus, type WaitingReason } from "./rosterPreview";+import { previewText, waitingLine, type RosterStatus, type WaitingReason } from "./rosterPreview";import { StatusMark, statusLabel } from "./RosterRow";export interface HoverCardData {@@ -63,9 +63,7 @@ export function RosterHoverCard({ data }: { data: HoverCardData }) {</div></div><p className={data.status === "needs-you" ? "mt-3 text-xs font-medium text-warning" : "mt-3 text-xs text-muted-foreground"}>- {data.status === "needs-you" && data.reason?.summary- ? `${t("society.shell.preview_needs_you")} · ${readableWaiting(previewText(data.reason.summary), t)}`- : statusLabel(data.status, t)}+ {(data.status === "needs-you" && waitingLine(data.reason, t)) || statusLabel(data.status, t)}{data.timeLabel ? <span className="text-muted-foreground"> · {data.timeLabel}</span> : null}</p>{last ? <p className="mt-2 line-clamp-3 text-[13px] leading-[19px] text-foreground">{last}</p> : null}diff --git a/dodaios/ui/web/frontend/src/components/society/roster/RosterRow.tsx b/dodaios/ui/web/frontend/src/components/society/roster/RosterRow.tsxindex 66092f3ac1..a0a96297f4 100644--- a/dodaios/ui/web/frontend/src/components/society/roster/RosterRow.tsx+++ b/dodaios/ui/web/frontend/src/components/society/roster/RosterRow.tsx@@ -17,7 +17,7 @@ import { cn } from "@/lib/utils";import { AgentSwatch } from "../AgentSwatch";import { agentTint } from "../agentTint";import type { SocietyAgent } from "../data";-import { readableWaiting, type RosterPreview, type RosterStatus } from "./rosterPreview";+import { readableWaiting, waitingLine, type RosterPreview, type RosterStatus } from "./rosterPreview";export function StatusMark({ status, className }: { status: RosterStatus; className?: string }) {const t = useT();@@ -51,6 +51,13 @@ export function statusLabel(status: RosterStatus, t: (key: string) => string): sexport function PreviewLine({ preview, className }: { preview: RosterPreview; className?: string }) {const t = useT();+ if (preview.kind === "waiting" && preview.waitingKind === "credential") {+ return (+ <span className={cn("as-row-preview", className)} data-kind="waiting" data-testid="roster-preview">+ {waitingLine({ kind: "credential", summary: preview.text }, t)}+ </span>+ );+ }if (preview.kind === "waiting") {return (<span className={cn("as-row-preview", className)} data-kind="waiting" data-testid="roster-preview">diff --git a/dodaios/ui/web/frontend/src/components/society/roster/rosterPreview.test.ts b/dodaios/ui/web/frontend/src/components/society/roster/rosterPreview.test.tsindex 72057fa751..a82153917d 100644--- a/dodaios/ui/web/frontend/src/components/society/roster/rosterPreview.test.ts+++ b/dodaios/ui/web/frontend/src/components/society/roster/rosterPreview.test.ts@@ -3,7 +3,7 @@ import { describe, expect, it } from "vitest";import type { SocietyAgent } from "../data";import en from "@/i18n/locales/en.json";import { markAnswered, resetAttentionStore } from "../attention/attentionStore";-import { formatRelative, needsYou, previewText, readableWaiting, relativeStamp, rosterPreview, rosterStatus, waitingReasonOf } from "./rosterPreview";+import { formatRelative, needsYou, previewText, readableWaiting, relativeStamp, rosterPreview, rosterStatus, waitingLine, waitingReasonOf } from "./rosterPreview";function agent(over: Partial<SocietyAgent> & Record<string, unknown> = {}): SocietyAgent {return {@@ -21,7 +21,7 @@ const reason = { kind: "question", summary: "Which **folder** should I use?", sedescribe("rosterPreview priority", () => {it("puts the waiting reason above a draft and the last message", () => {const preview = rosterPreview({ agent: agent({ waiting_reason: reason }), draft: "half a thought", lastMessage: "Done." });- expect(preview).toEqual({ kind: "waiting", text: "Which folder should I use?" });+ expect(preview).toEqual({ kind: "waiting", text: "Which folder should I use?", waitingKind: "question" });});it("falls back to the plain waiting state when the backend sends no reason", () => {@@ -128,3 +128,15 @@ describe("what the person already answered", () => {resetAttentionStore();});});++describe("waitingLine", () => {+ const t = (key: string) => (key === "login_card.title" ? "Sign in to {site}" : key);+ it("says a sign-in is missing, not just the site name", () => {+ expect(waitingLine({ kind: "credential", summary: "Hacker News" }, t))+ .toBe("society.shell.preview_needs_you · Sign in to Hacker News");+ });+ it("keeps a question's own summary", () => {+ expect(waitingLine({ kind: "question", summary: "Which folder?" }, t))+ .toBe("society.shell.preview_needs_you · Which folder?");+ });+});diff --git a/dodaios/ui/web/frontend/src/components/society/roster/rosterPreview.ts b/dodaios/ui/web/frontend/src/components/society/roster/rosterPreview.tsindex 487a1bcec8..e6d18246c4 100644--- a/dodaios/ui/web/frontend/src/components/society/roster/rosterPreview.ts+++ b/dodaios/ui/web/frontend/src/components/society/roster/rosterPreview.ts@@ -15,6 +15,7 @@*/import { hideAskBlocks } from "@/components/agentchat/askFence";import { friendlyToolName, isRawToolId } from "@/components/agentchat/traceEntries";+import { fill } from "@/i18n";import { stripInlineMarks } from "@/lib/plainMarks";import { wasAnswered } from "../attention/attentionStore";@@ -79,6 +80,22 @@ export function readableWaiting(text: string, t: (key: string) => string): strinreturn text && isRawToolId(text) ? friendlyToolName(text, t) : text;}+/**+ * What the person has to do, in words: "Needs you · Sign in to Hacker News".+ * A sign-in's summary is only the site name, which alone does not say that a+ * login is missing, so it reads as the sign-in card's own title.+ */+export function waitingLine(+ reason: Pick<WaitingReason, "kind" | "summary"> | null | undefined,+ t: (key: string) => string,+): string {+ const summary = readableWaiting(previewText(reason?.summary), t);+ if (reason?.kind === "credential") {+ return `${t("society.shell.preview_needs_you")} · ${fill(t("login_card.title"), { site: summary || t("society.shell.sign_in_site") })}`;+ }+ return summary ? `${t("society.shell.preview_needs_you")} · ${summary}` : "";+}+export type RosterStatus = "needs-you" | "working" | "unread" | "paused" | "idle";export function rosterStatus(agent: SocietyAgent, unread: boolean): RosterStatus {@@ -98,6 +115,8 @@ export type PreviewKind = "waiting" | "draft" | "message" | "role";export interface RosterPreview {kind: PreviewKind;text: string;+ /** For a waiting preview: what kind of answer the agent waits for. */+ waitingKind?: WaitingKind;}export interface PreviewSources {@@ -132,7 +151,7 @@ export function previewText(raw: string | null | undefined): string {export function rosterPreview({ agent, draft, lastMessage }: PreviewSources): RosterPreview {const reason = waitingReasonOf(agent);if (reason || agent.state === "waiting") {- return { kind: "waiting", text: previewText(reason?.summary) };+ return { kind: "waiting", text: previewText(reason?.summary), ...(reason ? { waitingKind: reason.kind } : {}) };}const unsent = previewText(draft);if (unsent) return { kind: "draft", text: unsent };diff --git a/dodaios/ui/web/frontend/src/i18n/locales/de.json b/dodaios/ui/web/frontend/src/i18n/locales/de.jsonindex 0ec3a94e1a..e669782080 100644--- a/dodaios/ui/web/frontend/src/i18n/locales/de.json+++ b/dodaios/ui/web/frontend/src/i18n/locales/de.json@@ -7522,6 +7522,7 @@"status_needs_you": "Braucht dich","status_waiting": "Wartet auf dich","preview_needs_you": "Braucht dich",+ "sign_in_site": "einer Website","preview_draft": "Entwurf:","preview_working": "Arbeitet…","time_now": "jetzt",diff --git a/dodaios/ui/web/frontend/src/i18n/locales/en.json b/dodaios/ui/web/frontend/src/i18n/locales/en.jsonindex 141912c4ed..2ed9ad23c3 100644--- a/dodaios/ui/web/frontend/src/i18n/locales/en.json+++ b/dodaios/ui/web/frontend/src/i18n/locales/en.json@@ -7522,6 +7522,7 @@"status_needs_you": "Needs you","status_waiting": "Waiting for you","preview_needs_you": "Needs you",+ "sign_in_site": "a site","preview_draft": "Draft:","preview_working": "Working…","time_now": "now",diff --git a/dodaios/ui/web/frontend/src/i18n/locales/es.json b/dodaios/ui/web/frontend/src/i18n/locales/es.jsonindex 9afea5f42b..ca3e70e0bf 100644--- a/dodaios/ui/web/frontend/src/i18n/locales/es.json+++ b/dodaios/ui/web/frontend/src/i18n/locales/es.json@@ -7522,6 +7522,7 @@"status_needs_you": "Te necesita","status_waiting": "Esperándote","preview_needs_you": "Te necesita",+ "sign_in_site": "un sitio","preview_draft": "Borrador:","preview_working": "Trabajando…","time_now": "ahora",diff --git a/dodaios/ui/web/frontend/src/i18n/locales/pt.json b/dodaios/ui/web/frontend/src/i18n/locales/pt.jsonindex 229ab1faee..031a86045c 100644--- a/dodaios/ui/web/frontend/src/i18n/locales/pt.json+++ b/dodaios/ui/web/frontend/src/i18n/locales/pt.json@@ -7522,6 +7522,7 @@"status_needs_you": "Precisa de você","status_waiting": "Esperando por você","preview_needs_you": "Precisa de você",+ "sign_in_site": "um site","preview_draft": "Rascunho:","preview_working": "Trabalhando…","time_now": "agora",diff --git a/dodaios/ui/web/frontend/src/i18n/locales/zh.json b/dodaios/ui/web/frontend/src/i18n/locales/zh.jsonindex c1d4d269af..03ea2f5ed6 100644--- a/dodaios/ui/web/frontend/src/i18n/locales/zh.json+++ b/dodaios/ui/web/frontend/src/i18n/locales/zh.json@@ -7522,6 +7522,7 @@"status_needs_you": "需要你","status_waiting": "正在等你","preview_needs_you": "需要你",+ "sign_in_site": "网站","preview_draft": "草稿:","preview_working": "工作中…","time_now": "刚刚",