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(self-build): redesign Built for you so anyone gets it at a glance (#865)

Ruben Lütkea3c3d3e9a40f
diff --git a/docs/self-build.md b/docs/self-build.md
index e7c7786516..b3e9c9ef17 100644
--- a/docs/self-build.md
+++ b/docs/self-build.md
@@ -276,20 +276,36 @@ detail.
## In the app
-- **Built for you** (sidebar, under Agents; section id `self-build`) lists
- every build on the shelf of what it asks of the person: waiting for a yes,
- on trial, being built, kept, archived and undone. A row shows the build's
- one sentence, its kind, how often the need was seen and a small lifecycle
- rail; proposals and trials carry their actions inline. A build opens into
- its case file: why, what it noticed, how it was checked, what it made, use,
- cost and every state change. Undo is one click with no confirmation.
-- The **digest** is one line at the top: what was built, proposed, kept,
- archived or undone in the last 24 hours, and how much is live. The nav row
- shows how many proposals wait. Nothing is announced: no toast, no sound, no
- voice.
-- **Pause building** is the loop's kill switch. **Stop all agents** engages
- the society kill switch after a confirmation (which pauses building too);
- while it is engaged the page says so and offers Release.
+- **Built for you** (sidebar, under Agents; section id `self-build`) is one
+ reading column. At the top, one sentence says what the page is and whether
+ it is working, with a ring: the quiet first days fill day by day (with the
+ date suggestions may start), while watching it holds the number of helpers
+ running, paused / off / stopped show their glyph and the one button that
+ undoes that state. Under it, how far the assistant may go per kind, in plain
+ words ("Asks you first", "Tries it, with undo").
+- Then, in the order a person asks about it: **Needs you** (proposals with
+ their first "why" sentence and Build it / Not this), **Working for you**
+ (trials with day and use progress, builds in progress), **Noticed so far**,
+ **Kept**, and **Archived and undone** (folded). While nothing is built, a
+ three-step "How it works" sits above the lists; afterwards it moves small to
+ the bottom. A build opens as a sheet on the right with its case file: why,
+ what it noticed, how it was checked, what it made, use, cost and every state
+ change. Undo is one click with no confirmation.
+- **Noticed so far** comes from `GET /api/self-build/noticed` (read-only): each
+ request the person made more than once in the miner's window, labelled with
+ their own latest wording (cut to 90 characters), how often and on how many
+ days, pips toward the repeat threshold, and where it stands (counting, ready,
+ answered directly, suggested, declined, nothing to build). Requests made
+ once are only counted. Needs that became a live or kept build are left out.
+ The response also carries when the quiet start ends.
+- The **digest** is one quiet line under the top: what was proposed, built,
+ kept, archived or undone in the last 24 hours (hidden when nothing was). The
+ nav row shows how many proposals wait. Nothing is announced: no toast, no
+ sound, no voice.
+- **Pause building** is the loop's kill switch. **Stop all agents** sits in
+ the page footer and engages the society kill switch after a confirmation
+ (which pauses building too); while it is engaged the top says so and offers
+ Release.
- **Settings → General → Self-building** edits `[self_build]`, including the
repositories whose loop pull requests merge on green CI (`code_land_repos`),
shown with a warning that a listed repository changes without a review.
diff --git a/dodaios/ui/web/frontend/src/hooks/useSelfBuild.ts b/dodaios/ui/web/frontend/src/hooks/useSelfBuild.ts
index 3655bae246..6ab9506ca1 100644
--- a/dodaios/ui/web/frontend/src/hooks/useSelfBuild.ts
+++ b/dodaios/ui/web/frontend/src/hooks/useSelfBuild.ts
@@ -24,6 +24,7 @@ export const selfBuildKeys = {
detail: (id: string) => ["self-build", "detail", id] as const,
digest: (hours: number) => ["self-build", "digest", hours] as const,
settings: () => ["self-build", "settings"] as const,
+ noticed: () => ["self-build", "noticed"] as const,
provenance: () => ["self-build", "provenance"] as const,
societyKill: () => ["society", "kill-switch"] as const,
};
@@ -64,6 +65,19 @@ export function useSelfBuildDigest(hours = 24) {
});
}
+/**
+ * What the loop is counting so far. It moves with every turn of the person,
+ * not with a build, so it refreshes on a short interval while the page is open.
+ */
+export function useSelfBuildNoticed() {
+ return useQuery({
+ queryKey: selfBuildKeys.noticed(),
+ queryFn: ({ signal }) => selfBuildApi.noticed(signal),
+ refetchInterval: 60_000,
+ retry: false,
+ });
+}
+
function patchList(list: BuildList | undefined, build: Build): BuildList | undefined {
if (!list) return list;
const builds = list.builds.some((b) => b.id === build.id)
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/self_build/de.json b/dodaios/ui/web/frontend/src/i18n/locales/self_build/de.json
index e09dffac94..0cb27263d5 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/self_build/de.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/self_build/de.json
@@ -1,13 +1,13 @@
{
"self_build": {
"title": "Für dich gebaut",
- "subtitle": "Was {name} von sich aus gebaut hat, warum, und wie du es zurücknimmst.",
"loading": "Bauten werden geladen…",
"status": {
- "running": "Baut von sich aus",
+ "running": "Beobachtet",
"paused": "Pausiert",
- "silent": "Macht nur Notizen",
- "off": "Aus"
+ "silent": "Lernt",
+ "off": "Aus",
+ "stopped": "Gestoppt"
},
"pause": "Bauen pausieren",
"resume": "Bauen fortsetzen",
@@ -20,9 +20,6 @@
"cancel": "Abbrechen",
"notes": {
"paused": "Das Bauen ist pausiert. Nichts wird bemerkt, gebaut oder abgeschlossen, bis du fortsetzt.",
- "silent": "Die ersten Tage sind ruhig: {name} notiert, was du wiederholst, und baut noch nichts.",
- "off": "Selbstbau ist aus. Nichts wird bemerkt oder gebaut.",
- "stopped": "Alle Agenten sind gestoppt. Routinen und Missionen bleiben angehalten, bis du sie freigibst.",
"release": "Freigeben",
"turn_on": "Einstellungen öffnen"
},
@@ -37,16 +34,14 @@
"nothing": "Nichts Neues."
},
"shelf": {
- "waiting": "Wartet auf dich",
- "waiting_hint": "Nichts wird gebaut, bevor du Ja sagst.",
- "trial": "Auf Probe",
- "trial_hint": "Live und gekennzeichnet. Rückgängig entfernt es vollständig.",
- "working": "Wird gebaut",
- "working_hint": "Wird geprüft, bevor es live geht.",
+ "waiting": "Braucht dich",
+ "waiting_hint": "Nichts wird gebaut, bevor du ja sagst.",
"kept": "Behalten",
- "kept_hint": "Hat sich bewährt. Weiter rückgängig zu machen.",
+ "kept_hint": "Hat sich bewährt. Weiterhin rückgängig zu machen.",
"past": "Archiviert und rückgängig gemacht",
- "past_hint": "Archivierte Bauten lassen sich wiederherstellen."
+ "past_hint": "Archivierte Helfer lassen sich wiederherstellen.",
+ "live": "Arbeitet für dich",
+ "live_hint": "Auf Probe und gekennzeichnet. Rückgängig entfernt es vollständig."
},
"show_past": "{count} anzeigen",
"hide_past": "Ausblenden",
@@ -75,7 +70,6 @@
"trial": "Probe",
"kept": "Behalten"
},
- "seen": "{count}× gesehen",
"trial_progress": "Tag {days} von {dayLimit} · {uses} von {useLimit} Nutzungen",
"action": {
"accept": "Bauen",
@@ -86,7 +80,6 @@
},
"no_builder": "{name} kann diese Art noch nicht bauen. Es bleibt ein Vorschlag.",
"detail": {
- "select": "Wähle einen Bau, um zu sehen, warum es ihn gibt, wie er geprüft wurde und was er gekostet hat.",
"close": "Schließen",
"why": "Warum",
"noticed": "Was es bemerkt hat",
@@ -119,21 +112,93 @@
"corrected": "korrigiert",
"ignored": "ignoriert"
},
- "empty": {
- "title": "Noch nichts gebaut",
- "body": "{name} achtet auf Dinge, die du immer wieder von Hand tust. Wiederholt sich etwas, baut es das Kleinste, das es dir abnimmt, prüft es und lässt es dich ausprobieren, mit Rückgängig per Klick.",
- "loop": {
- "notice": "Bemerken",
- "decide": "Entscheiden",
- "build": "Bauen",
- "check": "Prüfen",
- "trial": "Probe",
- "keep": "Behalten"
- }
- },
"error": {
"unavailable": "Das Bau-Register läuft nicht. Starte die App neu, um es zu öffnen.",
"action": "Das hat nicht geklappt: {detail}"
- }
+ },
+ "hero": {
+ "silent_title": "{name} lernt gerade, wie du arbeitest.",
+ "silent_body": "Wenn du immer wieder um dasselbe bittest, baut {name} einen kleinen Helfer, der es für dich erledigt. In den ersten {days} Tagen macht es sich nur Notizen und fragt, bevor es etwas baut. Ab {date} darf es Kleines selbst ausprobieren, immer mit Rückgängig.",
+ "silent_body_nodate": "Wenn du immer wieder um dasselbe bittest, baut {name} einen kleinen Helfer, der es für dich erledigt. In den ersten {days} Tagen macht es sich nur Notizen und fragt, bevor es etwas baut.",
+ "running_title": "{name} achtet auf Wiederholungen.",
+ "running_body": "Wenn du an verschiedenen Tagen um dasselbe bittest, baut {name} den kleinsten Helfer, der es dir abnimmt, prüft ihn und lässt dich ihn mit Rückgängig per Klick ausprobieren.",
+ "ideas_title_one": "{name} hat {count} Idee für dich.",
+ "ideas_title_other": "{name} hat {count} Ideen für dich.",
+ "ideas_body": "Es hat etwas bemerkt, das du immer wieder von Hand machst. Sieh es dir unten an und sag ja oder nein. Ohne dich wird nichts gebaut.",
+ "paused_title": "Das Bauen ist pausiert.",
+ "paused_body": "{name} bemerkt und baut gerade nichts. Die Helfer, die es schon gebaut hat, laufen weiter.",
+ "off_title": "Für dich bauen ist aus.",
+ "off_body": "Schalte es ein, und {name} bemerkt, was du wiederholst. Du entscheidest, wie weit es gehen darf.",
+ "stopped_title": "Alle Agenten sind gestoppt.",
+ "stopped_body": "Routinen, Missionen und das Bauen bleiben angehalten, bis du sie freigibst. Nichts wurde gelöscht.",
+ "ring_day": "Tag {day} von {days}",
+ "ring_of_days": "von {days} Tagen",
+ "ring_live_one": "{count} Helfer läuft",
+ "ring_live_other": "{count} Helfer laufen",
+ "ring_helper_one": "Helfer",
+ "ring_helper_other": "Helfer"
+ },
+ "reach": {
+ "title": "Was {name} darf",
+ "off": "Nie",
+ "suggest": "Fragt dich zuerst",
+ "trial": "Probiert es, mit Rückgängig",
+ "full": "Macht es selbst"
+ },
+ "kinds": {
+ "memory": "Erinnerungen",
+ "skill": "Skills",
+ "routine": "Routinen",
+ "agent": "Agenten",
+ "code": "Code-Änderungen"
+ },
+ "noticed": {
+ "title": "Bisher bemerkt",
+ "hint": "Es zählt nur, worum du selbst bittest.",
+ "empty": "Noch wiederholt sich nichts.",
+ "empty_hint": "Arbeite einfach wie gewohnt. {name} zählt still auf diesem Computer mit.",
+ "once_one": "{count} Anfrage bisher einmal notiert.",
+ "once_other": "{count} Anfragen bisher einmal notiert.",
+ "more": "{count} weitere Wiederholungen",
+ "times": "{count}-mal gefragt",
+ "days_one": "an {count} Tag",
+ "days_other": "an {count} Tagen",
+ "quote_open": "„",
+ "quote_close": "“",
+ "progress": "{count} von {total} Tagen",
+ "more_days_one": "Noch {count} Tag",
+ "more_days_other": "Noch {count} Tage",
+ "more_times_one": "Noch {count}-mal",
+ "more_times_other": "Noch {count}-mal",
+ "stage": {
+ "ready": "Bereit. {name} sieht es sich bald an",
+ "proposed": "Zum Vorschlag",
+ "direct": "{name} beantwortet das direkt",
+ "declined": "Du hast nein gesagt",
+ "served": "Ein Skill erledigt das schon",
+ "nothing": "Nichts, das sich zu bauen lohnt",
+ "ready_paused": "Bereit. Wartet, bis du fortsetzt"
+ }
+ },
+ "how": {
+ "title": "So funktioniert es",
+ "notice_title": "Es bemerkt",
+ "notice_body": "Du bittest an verschiedenen Tagen um dasselbe. {name} zählt mit, auf diesem Computer.",
+ "suggest_title": "Es schlägt vor",
+ "suggest_body": "Den kleinsten passenden Helfer: etwas zum Merken, einen Skill, eine Routine, einen Agenten oder eine Code-Änderung.",
+ "try_title": "Du probierst es",
+ "try_body": "Er läuft als gekennzeichnete Probe. Behalte ihn oder mach ihn mit einem Klick rückgängig."
+ },
+ "suggested": {
+ "memory": "Vorgeschlagene Erinnerung",
+ "skill": "Vorgeschlagener Skill",
+ "routine": "Vorgeschlagene Routine",
+ "agent": "Vorgeschlagener Agent",
+ "code": "Vorgeschlagene Code-Änderung"
+ },
+ "based_on_one": "Aus {count} Anfrage",
+ "based_on_other": "Aus {count} Anfragen",
+ "details": "Details",
+ "stop_footer": "Soll alles auf einmal anhalten?"
}
}
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/self_build/en.json b/dodaios/ui/web/frontend/src/i18n/locales/self_build/en.json
index 0ee1cb08d0..ec101eca48 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/self_build/en.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/self_build/en.json
@@ -1,13 +1,13 @@
{
"self_build": {
"title": "Built for you",
- "subtitle": "What {name} built on its own, why it did, and how to take it back.",
"loading": "Loading builds…",
"status": {
- "running": "Building on its own",
+ "running": "Watching",
"paused": "Paused",
- "silent": "Taking notes only",
- "off": "Off"
+ "silent": "Learning",
+ "off": "Off",
+ "stopped": "Stopped"
},
"pause": "Pause building",
"resume": "Resume building",
@@ -20,9 +20,6 @@
"cancel": "Cancel",
"notes": {
"paused": "Building is paused. Nothing is noticed, built or settled until you resume.",
- "silent": "The first days are quiet: {name} notes what you repeat and builds nothing yet.",
- "off": "Self-building is off. Nothing is noticed or built.",
- "stopped": "All agents are stopped. Routines and missions stay halted until you release them.",
"release": "Release",
"turn_on": "Open settings"
},
@@ -37,16 +34,14 @@
"nothing": "Nothing new."
},
"shelf": {
- "waiting": "Waiting for you",
+ "waiting": "Needs you",
"waiting_hint": "Nothing is built until you say yes.",
- "trial": "On trial",
- "trial_hint": "Live and labelled. Undo removes it completely.",
- "working": "Being built",
- "working_hint": "Checked before it goes live.",
"kept": "Kept",
"kept_hint": "Earned its place. Still undoable.",
"past": "Archived and undone",
- "past_hint": "Archived builds can be restored."
+ "past_hint": "Archived helpers can be restored.",
+ "live": "Working for you",
+ "live_hint": "On trial and labelled. Undo removes it completely."
},
"show_past": "Show {count}",
"hide_past": "Hide",
@@ -75,7 +70,6 @@
"trial": "Trial",
"kept": "Kept"
},
- "seen": "seen {count}×",
"trial_progress": "Day {days} of {dayLimit} · {uses} of {useLimit} uses",
"action": {
"accept": "Build it",
@@ -86,7 +80,6 @@
},
"no_builder": "{name} cannot build this kind yet. It stays a suggestion.",
"detail": {
- "select": "Pick a build to see why it exists, how it was checked and what it cost.",
"close": "Close",
"why": "Why",
"noticed": "What it noticed",
@@ -119,21 +112,93 @@
"corrected": "corrected",
"ignored": "ignored"
},
- "empty": {
- "title": "Nothing built yet",
- "body": "{name} watches for things you keep doing by hand. When something repeats, it builds the smallest thing that takes it off you, checks it, and lets you try it with one-click undo.",
- "loop": {
- "notice": "Notice",
- "decide": "Decide",
- "build": "Build",
- "check": "Check",
- "trial": "Trial",
- "keep": "Keep"
- }
- },
"error": {
"unavailable": "The build ledger is not running. Restart the app to open it.",
"action": "That did not work: {detail}"
- }
+ },
+ "hero": {
+ "silent_title": "{name} is getting to know how you work.",
+ "silent_body": "When you ask for the same thing again and again, {name} builds a small helper that does it for you. For the first {days} days it only takes notes and asks before it builds anything. From {date} it may try small things on its own, always with undo.",
+ "silent_body_nodate": "When you ask for the same thing again and again, {name} builds a small helper that does it for you. For the first {days} days it only takes notes and asks before it builds anything.",
+ "running_title": "{name} is watching for repeats.",
+ "running_body": "When you ask for the same thing on different days, {name} builds the smallest helper that takes it off you, checks it, and lets you try it with one-click undo.",
+ "ideas_title_one": "{name} has {count} idea for you.",
+ "ideas_title_other": "{name} has {count} ideas for you.",
+ "ideas_body": "It noticed something you keep doing by hand. Have a look below and say yes or no. Nothing is built without you.",
+ "paused_title": "Building is paused.",
+ "paused_body": "{name} is not noticing or building anything right now. The helpers it already built keep working.",
+ "off_title": "Building for you is off.",
+ "off_body": "Turn it on and {name} starts noticing what you repeat. You decide how far it may go.",
+ "stopped_title": "All agents are stopped.",
+ "stopped_body": "Routines, missions and building stay halted until you release them. Nothing was deleted.",
+ "ring_day": "Day {day} of {days}",
+ "ring_of_days": "of {days} days",
+ "ring_live_one": "{count} helper running",
+ "ring_live_other": "{count} helpers running",
+ "ring_helper_one": "helper",
+ "ring_helper_other": "helpers"
+ },
+ "reach": {
+ "title": "What {name} may do",
+ "off": "Never",
+ "suggest": "Asks you first",
+ "trial": "Tries it, with undo",
+ "full": "Does it on its own"
+ },
+ "kinds": {
+ "memory": "Memories",
+ "skill": "Skills",
+ "routine": "Routines",
+ "agent": "Agents",
+ "code": "Code changes"
+ },
+ "noticed": {
+ "title": "Noticed so far",
+ "hint": "Only what you ask for yourself counts.",
+ "empty": "Nothing repeated yet.",
+ "empty_hint": "Keep working as usual. {name} counts quietly on this computer.",
+ "once_one": "{count} request noted once so far.",
+ "once_other": "{count} requests noted once so far.",
+ "more": "{count} more repeats",
+ "times": "Asked {count} times",
+ "days_one": "on {count} day",
+ "days_other": "on {count} days",
+ "quote_open": "“",
+ "quote_close": "”",
+ "progress": "{count} of {total} days",
+ "more_days_one": "{count} more day to go",
+ "more_days_other": "{count} more days to go",
+ "more_times_one": "{count} more time to go",
+ "more_times_other": "{count} more times to go",
+ "stage": {
+ "ready": "Ready. {name} looks at it soon",
+ "proposed": "See the suggestion",
+ "direct": "{name} answers this directly",
+ "declined": "You said no",
+ "served": "A skill already does this",
+ "nothing": "Nothing worth building",
+ "ready_paused": "Ready. Waits until you resume"
+ }
+ },
+ "how": {
+ "title": "How it works",
+ "notice_title": "It notices",
+ "notice_body": "You ask for the same thing on different days. {name} counts it, on this computer.",
+ "suggest_title": "It suggests",
+ "suggest_body": "The smallest helper that fits: something to remember, a skill, a routine, an agent or a code change.",
+ "try_title": "You try it",
+ "try_body": "It runs on a labelled trial. Keep it, or undo it with one click."
+ },
+ "suggested": {
+ "memory": "Suggested memory",
+ "skill": "Suggested skill",
+ "routine": "Suggested routine",
+ "agent": "Suggested agent",
+ "code": "Suggested code change"
+ },
+ "based_on_one": "Based on {count} request",
+ "based_on_other": "Based on {count} requests",
+ "details": "Details",
+ "stop_footer": "Need everything to stop at once?"
}
}
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/self_build/es.json b/dodaios/ui/web/frontend/src/i18n/locales/self_build/es.json
index 46c63b4c40..1d86d8b8a2 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/self_build/es.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/self_build/es.json
@@ -1,13 +1,13 @@
{
"self_build": {
"title": "Hecho para ti",
- "subtitle": "Lo que {name} construyó por su cuenta, por qué lo hizo y cómo deshacerlo.",
"loading": "Cargando construcciones…",
"status": {
- "running": "Construye por su cuenta",
+ "running": "Observando",
"paused": "En pausa",
- "silent": "Solo toma notas",
- "off": "Desactivado"
+ "silent": "Aprendiendo",
+ "off": "Desactivado",
+ "stopped": "Detenido"
},
"pause": "Pausar la construcción",
"resume": "Reanudar la construcción",
@@ -20,9 +20,6 @@
"cancel": "Cancelar",
"notes": {
"paused": "La construcción está en pausa. No se nota, construye ni cierra nada hasta que la reanudes.",
- "silent": "Los primeros días son tranquilos: {name} anota lo que repites y todavía no construye nada.",
- "off": "La autoconstrucción está desactivada. No se nota ni se construye nada.",
- "stopped": "Todos los agentes están detenidos. Las rutinas y misiones siguen paradas hasta que las liberes.",
"release": "Liberar",
"turn_on": "Abrir ajustes"
},
@@ -37,16 +34,14 @@
"nothing": "Nada nuevo."
},
"shelf": {
- "waiting": "Esperando por ti",
- "waiting_hint": "No se construye nada hasta que digas que sí.",
- "trial": "En prueba",
- "trial_hint": "Activo y señalado. Deshacer lo quita por completo.",
- "working": "En construcción",
- "working_hint": "Se comprueba antes de activarse.",
- "kept": "Conservados",
- "kept_hint": "Se ganó su lugar. Todavía se puede deshacer.",
- "past": "Archivados y deshechos",
- "past_hint": "Las construcciones archivadas se pueden restaurar."
+ "waiting": "Te necesita",
+ "waiting_hint": "Nada se crea hasta que digas que sí.",
+ "kept": "Conservado",
+ "kept_hint": "Se ganó su sitio. Aún se puede deshacer.",
+ "past": "Archivado y deshecho",
+ "past_hint": "Los ayudantes archivados se pueden restaurar.",
+ "live": "Trabajando para ti",
+ "live_hint": "En prueba y señalado. Deshacer lo quita por completo."
},
"show_past": "Mostrar {count}",
"hide_past": "Ocultar",
@@ -75,7 +70,6 @@
"trial": "Prueba",
"kept": "Conservado"
},
- "seen": "visto {count}×",
"trial_progress": "Día {days} de {dayLimit} · {uses} de {useLimit} usos",
"action": {
"accept": "Construirlo",
@@ -86,7 +80,6 @@
},
"no_builder": "{name} todavía no puede construir este tipo. Se queda como sugerencia.",
"detail": {
- "select": "Elige una construcción para ver por qué existe, cómo se comprobó y cuánto costó.",
"close": "Cerrar",
"why": "Por qué",
"noticed": "Lo que notó",
@@ -119,21 +112,93 @@
"corrected": "corregido",
"ignored": "ignorado"
},
- "empty": {
- "title": "Todavía no hay nada construido",
- "body": "{name} se fija en lo que haces a mano una y otra vez. Cuando algo se repite, construye lo más pequeño que te lo quite de encima, lo comprueba y te deja probarlo con deshacer en un clic.",
- "loop": {
- "notice": "Notar",
- "decide": "Decidir",
- "build": "Construir",
- "check": "Comprobar",
- "trial": "Prueba",
- "keep": "Conservar"
- }
- },
"error": {
"unavailable": "El registro de construcciones no está en marcha. Reinicia la app para abrirlo.",
"action": "No funcionó: {detail}"
- }
+ },
+ "hero": {
+ "silent_title": "{name} está conociendo tu forma de trabajar.",
+ "silent_body": "Cuando pides lo mismo una y otra vez, {name} crea un pequeño ayudante que lo hace por ti. Durante los primeros {days} días solo toma notas y pregunta antes de crear nada. Desde el {date} podrá probar cosas pequeñas por su cuenta, siempre con deshacer.",
+ "silent_body_nodate": "Cuando pides lo mismo una y otra vez, {name} crea un pequeño ayudante que lo hace por ti. Durante los primeros {days} días solo toma notas y pregunta antes de crear nada.",
+ "running_title": "{name} está atento a lo que repites.",
+ "running_body": "Cuando pides lo mismo en días distintos, {name} crea el ayudante más pequeño que te lo quite de encima, lo comprueba y te deja probarlo con deshacer en un clic.",
+ "ideas_title_one": "{name} tiene {count} idea para ti.",
+ "ideas_title_other": "{name} tiene {count} ideas para ti.",
+ "ideas_body": "Notó algo que sigues haciendo a mano. Échale un vistazo abajo y di sí o no. Nada se crea sin ti.",
+ "paused_title": "La creación está en pausa.",
+ "paused_body": "{name} no nota ni crea nada ahora mismo. Los ayudantes que ya creó siguen funcionando.",
+ "off_title": "Crear para ti está desactivado.",
+ "off_body": "Actívalo y {name} empezará a notar lo que repites. Tú decides hasta dónde puede llegar.",
+ "stopped_title": "Todos los agentes están detenidos.",
+ "stopped_body": "Las rutinas, misiones y la creación siguen detenidas hasta que las liberes. No se borró nada.",
+ "ring_day": "Día {day} de {days}",
+ "ring_of_days": "de {days} días",
+ "ring_live_one": "{count} ayudante activo",
+ "ring_live_other": "{count} ayudantes activos",
+ "ring_helper_one": "ayudante",
+ "ring_helper_other": "ayudantes"
+ },
+ "reach": {
+ "title": "Lo que {name} puede hacer",
+ "off": "Nunca",
+ "suggest": "Te pregunta antes",
+ "trial": "Lo prueba, con deshacer",
+ "full": "Lo hace por su cuenta"
+ },
+ "kinds": {
+ "memory": "Recuerdos",
+ "skill": "Habilidades",
+ "routine": "Rutinas",
+ "agent": "Agentes",
+ "code": "Cambios de código"
+ },
+ "noticed": {
+ "title": "Notado hasta ahora",
+ "hint": "Solo cuenta lo que pides tú.",
+ "empty": "Todavía no se repite nada.",
+ "empty_hint": "Sigue trabajando como siempre. {name} cuenta en silencio en este ordenador.",
+ "once_one": "{count} petición anotada una vez hasta ahora.",
+ "once_other": "{count} peticiones anotadas una vez hasta ahora.",
+ "more": "{count} repeticiones más",
+ "times": "Pedido {count} veces",
+ "days_one": "en {count} día",
+ "days_other": "en {count} días",
+ "quote_open": "«",
+ "quote_close": "»",
+ "progress": "{count} de {total} días",
+ "more_days_one": "Falta {count} día",
+ "more_days_other": "Faltan {count} días",
+ "more_times_one": "Falta {count} vez",
+ "more_times_other": "Faltan {count} veces",
+ "stage": {
+ "ready": "Listo. {name} lo mirará pronto",
+ "proposed": "Ver la sugerencia",
+ "direct": "{name} lo responde directamente",
+ "declined": "Dijiste que no",
+ "served": "Una habilidad ya lo hace",
+ "nothing": "Nada que merezca crearse",
+ "ready_paused": "Listo. Espera a que reanudes"
+ }
+ },
+ "how": {
+ "title": "Cómo funciona",
+ "notice_title": "Lo nota",
+ "notice_body": "Pides lo mismo en días distintos. {name} lo cuenta, en este ordenador.",
+ "suggest_title": "Lo sugiere",
+ "suggest_body": "El ayudante más pequeño que encaje: algo que recordar, una habilidad, una rutina, un agente o un cambio de código.",
+ "try_title": "Tú lo pruebas",
+ "try_body": "Funciona en una prueba señalada. Quédatelo o deshazlo con un clic."
+ },
+ "suggested": {
+ "memory": "Recuerdo sugerido",
+ "skill": "Habilidad sugerida",
+ "routine": "Rutina sugerida",
+ "agent": "Agente sugerido",
+ "code": "Cambio de código sugerido"
+ },
+ "based_on_one": "Basado en {count} petición",
+ "based_on_other": "Basado en {count} peticiones",
+ "details": "Detalles",
+ "stop_footer": "¿Necesitas que todo se detenga a la vez?"
}
}
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/self_build/pt.json b/dodaios/ui/web/frontend/src/i18n/locales/self_build/pt.json
index 045384aebe..2772c6d154 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/self_build/pt.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/self_build/pt.json
@@ -1,13 +1,13 @@
{
"self_build": {
"title": "Feito para si",
- "subtitle": "O que {name} construiu por iniciativa própria, porquê, e como o desfazer.",
"loading": "A carregar construções…",
"status": {
- "running": "Constrói por iniciativa própria",
- "paused": "Em pausa",
- "silent": "Só toma notas",
- "off": "Desligado"
+ "running": "Observando",
+ "paused": "Pausado",
+ "silent": "Aprendendo",
+ "off": "Desligado",
+ "stopped": "Parado"
},
"pause": "Pausar construção",
"resume": "Retomar construção",
@@ -20,9 +20,6 @@
"cancel": "Cancelar",
"notes": {
"paused": "A construção está em pausa. Nada é notado, construído ou concluído até retomar.",
- "silent": "Os primeiros dias são calmos: {name} anota o que repete e ainda não constrói nada.",
- "off": "A autoconstrução está desligada. Nada é notado nem construído.",
- "stopped": "Todos os agentes estão parados. Rotinas e missões ficam paradas até as libertar.",
"release": "Libertar",
"turn_on": "Abrir definições"
},
@@ -37,16 +34,14 @@
"nothing": "Nada de novo."
},
"shelf": {
- "waiting": "À sua espera",
- "waiting_hint": "Nada é construído antes de dizer que sim.",
- "trial": "Em ensaio",
- "trial_hint": "Ativo e assinalado. Anular remove-o por completo.",
- "working": "Em construção",
- "working_hint": "É verificado antes de ficar ativo.",
- "kept": "Mantidos",
- "kept_hint": "Mereceu o lugar. Ainda pode ser anulado.",
- "past": "Arquivados e anulados",
- "past_hint": "As construções arquivadas podem ser restauradas."
+ "waiting": "Precisa de você",
+ "waiting_hint": "Nada é criado até você dizer sim.",
+ "kept": "Mantido",
+ "kept_hint": "Mereceu seu lugar. Ainda pode ser desfeito.",
+ "past": "Arquivado e desfeito",
+ "past_hint": "Ajudantes arquivados podem ser restaurados.",
+ "live": "Trabalhando para você",
+ "live_hint": "Em teste e identificado. Desfazer remove por completo."
},
"show_past": "Mostrar {count}",
"hide_past": "Ocultar",
@@ -75,7 +70,6 @@
"trial": "Ensaio",
"kept": "Mantido"
},
- "seen": "visto {count}×",
"trial_progress": "Dia {days} de {dayLimit} · {uses} de {useLimit} utilizações",
"action": {
"accept": "Construir",
@@ -86,7 +80,6 @@
},
"no_builder": "{name} ainda não consegue construir este tipo. Fica como sugestão.",
"detail": {
- "select": "Escolha uma construção para ver porque existe, como foi verificada e quanto custou.",
"close": "Fechar",
"why": "Porquê",
"noticed": "O que notou",
@@ -119,21 +112,93 @@
"corrected": "corrigido",
"ignored": "ignorado"
},
- "empty": {
- "title": "Ainda nada construído",
- "body": "{name} repara no que faz à mão vezes sem conta. Quando algo se repete, constrói a coisa mais pequena que lhe tira esse trabalho, verifica-a e deixa-o experimentá-la com anulação num clique.",
- "loop": {
- "notice": "Reparar",
- "decide": "Decidir",
- "build": "Construir",
- "check": "Verificar",
- "trial": "Ensaio",
- "keep": "Manter"
- }
- },
"error": {
"unavailable": "O registo de construções não está a correr. Reinicie a app para o abrir.",
"action": "Não resultou: {detail}"
- }
+ },
+ "hero": {
+ "silent_title": "{name} está conhecendo o seu jeito de trabalhar.",
+ "silent_body": "Quando você pede a mesma coisa várias vezes, {name} cria um pequeno ajudante que faz isso por você. Nos primeiros {days} dias ele só toma notas e pergunta antes de criar qualquer coisa. A partir de {date} pode testar coisas pequenas sozinho, sempre com desfazer.",
+ "silent_body_nodate": "Quando você pede a mesma coisa várias vezes, {name} cria um pequeno ajudante que faz isso por você. Nos primeiros {days} dias ele só toma notas e pergunta antes de criar qualquer coisa.",
+ "running_title": "{name} está atento às repetições.",
+ "running_body": "Quando você pede a mesma coisa em dias diferentes, {name} cria o menor ajudante que tira isso das suas mãos, verifica e deixa você testar com desfazer em um clique.",
+ "ideas_title_one": "{name} tem {count} ideia para você.",
+ "ideas_title_other": "{name} tem {count} ideias para você.",
+ "ideas_body": "Ele percebeu algo que você continua fazendo à mão. Veja abaixo e diga sim ou não. Nada é criado sem você.",
+ "paused_title": "A criação está pausada.",
+ "paused_body": "{name} não está percebendo nem criando nada agora. Os ajudantes que já criou continuam funcionando.",
+ "off_title": "Criar para você está desligado.",
+ "off_body": "Ligue e {name} começa a perceber o que você repete. Você decide até onde ele pode ir.",
+ "stopped_title": "Todos os agentes estão parados.",
+ "stopped_body": "Rotinas, missões e a criação ficam paradas até você liberá-las. Nada foi apagado.",
+ "ring_day": "Dia {day} de {days}",
+ "ring_of_days": "de {days} dias",
+ "ring_live_one": "{count} ajudante ativo",
+ "ring_live_other": "{count} ajudantes ativos",
+ "ring_helper_one": "ajudante",
+ "ring_helper_other": "ajudantes"
+ },
+ "reach": {
+ "title": "O que {name} pode fazer",
+ "off": "Nunca",
+ "suggest": "Pergunta antes",
+ "trial": "Testa, com desfazer",
+ "full": "Faz sozinho"
+ },
+ "kinds": {
+ "memory": "Memórias",
+ "skill": "Habilidades",
+ "routine": "Rotinas",
+ "agent": "Agentes",
+ "code": "Mudanças de código"
+ },
+ "noticed": {
+ "title": "Percebido até agora",
+ "hint": "Só conta o que você mesmo pede.",
+ "empty": "Nada se repetiu ainda.",
+ "empty_hint": "Continue trabalhando normalmente. {name} conta em silêncio neste computador.",
+ "once_one": "{count} pedido anotado uma vez até agora.",
+ "once_other": "{count} pedidos anotados uma vez até agora.",
+ "more": "{count} repetições a mais",
+ "times": "Pedido {count} vezes",
+ "days_one": "em {count} dia",
+ "days_other": "em {count} dias",
+ "quote_open": "“",
+ "quote_close": "”",
+ "progress": "{count} de {total} dias",
+ "more_days_one": "Falta {count} dia",
+ "more_days_other": "Faltam {count} dias",
+ "more_times_one": "Falta {count} vez",
+ "more_times_other": "Faltam {count} vezes",
+ "stage": {
+ "ready": "Pronto. {name} vai olhar em breve",
+ "proposed": "Ver a sugestão",
+ "direct": "{name} responde isso direto",
+ "declined": "Você disse não",
+ "served": "Uma habilidade já faz isso",
+ "nothing": "Nada que valha criar",
+ "ready_paused": "Pronto. Espera você retomar"
+ }
+ },
+ "how": {
+ "title": "Como funciona",
+ "notice_title": "Ele percebe",
+ "notice_body": "Você pede a mesma coisa em dias diferentes. {name} conta, neste computador.",
+ "suggest_title": "Ele sugere",
+ "suggest_body": "O menor ajudante que serve: algo para lembrar, uma habilidade, uma rotina, um agente ou uma mudança de código.",
+ "try_title": "Você testa",
+ "try_body": "Ele roda em um teste identificado. Fique com ele ou desfaça com um clique."
+ },
+ "suggested": {
+ "memory": "Memória sugerida",
+ "skill": "Habilidade sugerida",
+ "routine": "Rotina sugerida",
+ "agent": "Agente sugerido",
+ "code": "Mudança de código sugerida"
+ },
+ "based_on_one": "Com base em {count} pedido",
+ "based_on_other": "Com base em {count} pedidos",
+ "details": "Detalhes",
+ "stop_footer": "Precisa que tudo pare de uma vez?"
}
}
diff --git a/dodaios/ui/web/frontend/src/i18n/locales/self_build/zh.json b/dodaios/ui/web/frontend/src/i18n/locales/self_build/zh.json
index eab8176871..ffa742ae43 100644
--- a/dodaios/ui/web/frontend/src/i18n/locales/self_build/zh.json
+++ b/dodaios/ui/web/frontend/src/i18n/locales/self_build/zh.json
@@ -1,13 +1,13 @@
{
"self_build": {
"title": "为你构建",
- "subtitle": "{name} 主动构建了什么、为什么构建,以及如何撤回。",
"loading": "正在加载构建…",
"status": {
- "running": "正在主动构建",
+ "running": "正在留意",
"paused": "已暂停",
- "silent": "只做记录",
- "off": "关闭"
+ "silent": "正在了解",
+ "off": "已关闭",
+ "stopped": "已停止"
},
"pause": "暂停构建",
"resume": "继续构建",
@@ -20,9 +20,6 @@
"cancel": "取消",
"notes": {
"paused": "构建已暂停。在你继续之前,不会留意、构建或结束任何东西。",
- "silent": "最初几天很安静:{name} 记录你重复的事情,暂时不构建任何东西。",
- "off": "自主构建已关闭。不留意也不构建任何东西。",
- "stopped": "所有智能体已停止。例程和任务会一直停着,直到你解除。",
"release": "解除",
"turn_on": "打开设置"
},
@@ -37,16 +34,14 @@
"nothing": "没有新内容。"
},
"shelf": {
- "waiting": "等待你的决定",
- "waiting_hint": "在你同意之前不会构建任何东西。",
- "trial": "试用中",
- "trial_hint": "已上线并有标记。撤销会把它完全移除。",
- "working": "构建中",
- "working_hint": "上线前会先检查。",
+ "waiting": "需要你",
+ "waiting_hint": "你同意之前,什么都不会构建。",
"kept": "已保留",
"kept_hint": "证明了自己的价值。仍可撤销。",
"past": "已归档和已撤销",
- "past_hint": "已归档的构建可以恢复。"
+ "past_hint": "已归档的助手可以恢复。",
+ "live": "正在为你工作",
+ "live_hint": "试用中并已标记。撤销会完全移除。"
},
"show_past": "显示 {count} 个",
"hide_past": "隐藏",
@@ -75,7 +70,6 @@
"trial": "试用",
"kept": "已保留"
},
- "seen": "见过 {count} 次",
"trial_progress": "第 {days} / {dayLimit} 天 · {uses} / {useLimit} 次使用",
"action": {
"accept": "构建",
@@ -86,7 +80,6 @@
},
"no_builder": "{name} 还不能构建这种类型。它会保持为建议。",
"detail": {
- "select": "选择一个构建,查看它为何存在、如何检查以及花费多少。",
"close": "关闭",
"why": "原因",
"noticed": "它留意到了什么",
@@ -119,21 +112,93 @@
"corrected": "已修正",
"ignored": "已忽略"
},
- "empty": {
- "title": "还没有构建任何东西",
- "body": "{name} 会留意你一再手动去做的事情。当某件事重复出现时,它会构建能替你完成它的最小的东西,进行检查,并让你在可一键撤销的情况下试用。",
- "loop": {
- "notice": "留意",
- "decide": "决定",
- "build": "构建",
- "check": "检查",
- "trial": "试用",
- "keep": "保留"
- }
- },
"error": {
"unavailable": "构建记录未在运行。重启应用即可打开。",
"action": "操作失败:{detail}"
- }
+ },
+ "hero": {
+ "silent_title": "{name} 正在了解你的工作方式。",
+ "silent_body": "当你一次又一次地提出同样的请求时,{name} 会做一个替你完成它的小助手。最初 {days} 天它只做记录,动手之前会先问你。从 {date} 起,它可以自己尝试一些小事,并且随时可以撤销。",
+ "silent_body_nodate": "当你一次又一次地提出同样的请求时,{name} 会做一个替你完成它的小助手。最初 {days} 天它只做记录,动手之前会先问你。",
+ "running_title": "{name} 正在留意重复的事。",
+ "running_body": "当你在不同的日子提出同样的请求时,{name} 会做出最小的助手替你分担,先检查,再让你试用,一键即可撤销。",
+ "ideas_title_one": "{name} 有 {count} 个想法给你。",
+ "ideas_title_other": "{name} 有 {count} 个想法给你。",
+ "ideas_body": "它注意到你一直在手动做某件事。看看下面,说行或不行。没有你的同意,什么都不会做。",
+ "paused_title": "构建已暂停。",
+ "paused_body": "{name} 现在不留意也不构建任何东西。已经做好的助手照常工作。",
+ "off_title": "为你构建已关闭。",
+ "off_body": "打开后,{name} 会开始留意你重复的事。它能走多远由你决定。",
+ "stopped_title": "所有智能体已停止。",
+ "stopped_body": "例程、任务和构建会一直停着,直到你解除。没有删除任何东西。",
+ "ring_day": "第 {day} 天,共 {days} 天",
+ "ring_of_days": "共 {days} 天",
+ "ring_live_one": "{count} 个助手在运行",
+ "ring_live_other": "{count} 个助手在运行",
+ "ring_helper_one": "个助手",
+ "ring_helper_other": "个助手"
+ },
+ "reach": {
+ "title": "{name} 可以做什么",
+ "off": "从不",
+ "suggest": "先问你",
+ "trial": "先试用,可撤销",
+ "full": "自己完成"
+ },
+ "kinds": {
+ "memory": "记忆",
+ "skill": "技能",
+ "routine": "例程",
+ "agent": "智能体",
+ "code": "代码改动"
+ },
+ "noticed": {
+ "title": "目前留意到的",
+ "hint": "只统计你自己提出的请求。",
+ "empty": "还没有重复的事。",
+ "empty_hint": "照常工作就好。{name} 会在这台电脑上悄悄统计。",
+ "once_one": "目前有 {count} 个请求只记录过一次。",
+ "once_other": "目前有 {count} 个请求只记录过一次。",
+ "more": "还有 {count} 项重复",
+ "times": "问过 {count} 次",
+ "days_one": "{count} 天内",
+ "days_other": "{count} 天内",
+ "quote_open": "“",
+ "quote_close": "”",
+ "progress": "{total} 天中的 {count} 天",
+ "more_days_one": "还差 {count} 天",
+ "more_days_other": "还差 {count} 天",
+ "more_times_one": "还差 {count} 次",
+ "more_times_other": "还差 {count} 次",
+ "stage": {
+ "ready": "已就绪,{name} 很快会看",
+ "proposed": "查看建议",
+ "direct": "{name} 会直接回答",
+ "declined": "你说了不要",
+ "served": "已有技能能做到",
+ "nothing": "没有值得构建的",
+ "ready_paused": "已就绪,等你恢复后处理"
+ }
+ },
+ "how": {
+ "title": "工作方式",
+ "notice_title": "它会留意",
+ "notice_body": "你在不同的日子提出同样的请求。{name} 在这台电脑上统计。",
+ "suggest_title": "它会建议",
+ "suggest_body": "最合适的最小助手:一条要记住的事、一个技能、一个例程、一个智能体或一处代码改动。",
+ "try_title": "你来试用",
+ "try_body": "它以带标记的试用方式运行。留下它,或一键撤销。"
+ },
+ "suggested": {
+ "memory": "建议的记忆",
+ "skill": "建议的技能",
+ "routine": "建议的例程",
+ "agent": "建议的智能体",
+ "code": "建议的代码改动"
+ },
+ "based_on_one": "基于 {count} 个请求",
+ "based_on_other": "基于 {count} 个请求",
+ "details": "详情",
+ "stop_footer": "需要一次性停下所有东西吗?"
}
}
diff --git a/dodaios/ui/web/frontend/src/lib/selfBuildApi.ts b/dodaios/ui/web/frontend/src/lib/selfBuildApi.ts
index 8fabe9db41..bb2b2d74d1 100644
--- a/dodaios/ui/web/frontend/src/lib/selfBuildApi.ts
+++ b/dodaios/ui/web/frontend/src/lib/selfBuildApi.ts
@@ -126,6 +126,40 @@ export interface SelfBuildSettingsPayload {
bounds: Partial<Record<keyof SelfBuildSettings, { min: number | null; max: number | null }>>;
}
+/** Where a noticed request stands against the repeat threshold (self_build_routes.noticed_payload). */
+export type NoticedStage =
+ | "counting"
+ | "ready"
+ | "direct"
+ | "proposed"
+ | "declined"
+ | "served"
+ | "nothing";
+
+export interface NoticedNeed {
+ id: number;
+ /** The person's own latest wording, cut short. */
+ label: string;
+ times: number;
+ days: number;
+ first_ms: number;
+ last_ms: number;
+ stage: NoticedStage;
+ /** The proposal this need became, when `stage` is "proposed". */
+ build_id: string;
+}
+
+export interface Noticed {
+ needs: NoticedNeed[];
+ /** Requests made only once so far (counted, not listed). */
+ once: number;
+ /** Repeated requests beyond the ones listed. */
+ more: number;
+ threshold: { times: number; days: number; window_days: number };
+ /** The quiet first days: `until_ms` is 0 when there are none. */
+ quiet_start: { days: number; since_ms: number; until_ms: number };
+}
+
export interface ProvenanceItem {
build_id: string;
type: string;
@@ -181,6 +215,7 @@ export const selfBuildApi = {
settings: (signal?: AbortSignal) => call<SelfBuildSettingsPayload>("/settings", { signal }),
saveSettings: (patch: Partial<SelfBuildSettings>) =>
call<SelfBuildSettingsPayload>("/settings", { method: "PUT", body: JSON.stringify(patch) }),
+ noticed: (signal?: AbortSignal) => call<Noticed>("/noticed", { signal }),
provenance: (type?: string, signal?: AbortSignal) =>
call<{ items: Record<string, ProvenanceItem> }>(
`/provenance${type ? `?type=${encodeURIComponent(type)}` : ""}`,
diff --git a/dodaios/ui/web/frontend/src/views/SelfBuildView.test.tsx b/dodaios/ui/web/frontend/src/views/SelfBuildView.test.tsx
index 6addabe6a4..c737a4d244 100644
--- a/dodaios/ui/web/frontend/src/views/SelfBuildView.test.tsx
+++ b/dodaios/ui/web/frontend/src/views/SelfBuildView.test.tsx
@@ -15,7 +15,7 @@ import { useIdeThreadsStore } from "@/store/ideThreads";
import { loadLocaleChunk, setUiLanguage } from "@/i18n";
import { useEventStore } from "@/store/events";
import { useSelfBuildFocus } from "@/store/selfBuildFocus";
-import type { Build, SelfBuildStatus } from "@/lib/selfBuildApi";
+import type { Build, Noticed, SelfBuildStatus } from "@/lib/selfBuildApi";
const NOW = Date.now();
@@ -81,10 +81,21 @@ interface Call {
body: unknown;
}
-function installFetch(status: SelfBuildStatus = STATUS, kill = false) {
+const NOTICED: Noticed = {
+ needs: [
+ { id: 1, label: "Did I get any important emails?", times: 4, days: 2, first_ms: NOW - 2 * 86_400_000, last_ms: NOW - 3_600_000, stage: "counting", build_id: "" },
+ { id: 2, label: "Summarise the open pull requests", times: 3, days: 3, first_ms: NOW - 3 * 86_400_000, last_ms: NOW - 7_200_000, stage: "proposed", build_id: "p1" },
+ ],
+ once: 5,
+ more: 0,
+ threshold: { times: 3, days: 3, window_days: 28 },
+ quiet_start: { days: 7, since_ms: NOW - 2.5 * 86_400_000, until_ms: NOW + 4.5 * 86_400_000 },
+};
+
+function installFetch(status: SelfBuildStatus = STATUS, kill = false, builds: Build[] = BUILDS, noticed: Noticed = NOTICED) {
const calls: Call[] = [];
const routes: Record<string, (body: unknown) => unknown> = {
- "GET /api/self-build": () => ({ builds: BUILDS, status }),
+ "GET /api/self-build": () => ({ builds, status }),
"GET /api/self-build/digest?hours=24": () => ({
since_ms: NOW - 86_400_000,
until_ms: NOW,
@@ -110,6 +121,7 @@ function installFetch(status: SelfBuildStatus = STATUS, kill = false) {
cost: { tokens: 1200, usd: 0 },
}),
"GET /api/society/status": () => ({ kill_switch: kill }),
+ "GET /api/self-build/noticed": () => noticed,
"POST /api/self-build/p1/accept": () => ({ build: { ...BUILDS[0], state: "building" } }),
"POST /api/self-build/p2/undo": () => ({ build: { ...BUILDS[1], state: "rejected" } }),
"POST /api/self-build/t1/keep": () => ({ build: { ...BUILDS[2], state: "kept" } }),
@@ -151,7 +163,7 @@ describe("SelfBuildView", () => {
renderWith(<SelfBuildView />);
const waiting = await screen.findByTestId("shelf-waiting");
expect(within(waiting).getAllByTestId("build-row").map((r) => r.dataset.buildId)).toEqual(["p1", "p2"]);
- expect(within(screen.getByTestId("shelf-trial")).getByText("A standup digest")).toBeTruthy();
+ expect(within(screen.getByTestId("shelf-live")).getByText("A standup digest")).toBeTruthy();
expect(within(screen.getByTestId("shelf-kept")).getByText("Mail humanizer")).toBeTruthy();
// The past shelf is folded until asked for.
const past = screen.getByTestId("shelf-past");
@@ -160,7 +172,8 @@ describe("SelfBuildView", () => {
expect(within(past).getByText("Fix the flaky test")).toBeTruthy();
// The digest reads as one line.
expect(screen.getByTestId("self-build-digest").textContent).toMatch(/2 proposed/);
- expect(screen.getByTestId("self-build-digest").textContent).toMatch(/2 live now/);
+ // Two ideas wait: the hero says so in a sentence.
+ expect(screen.getByTestId("self-build-hero").textContent).toMatch(/has 2 ideas for you/);
});
it("builds a proposal or turns it down in one click; a kind without a builder cannot be built", async () => {
@@ -216,6 +229,37 @@ describe("SelfBuildView", () => {
expect((within(first).getByTestId("build-accept") as HTMLButtonElement).disabled).toBe(true);
});
+ it("teaches the idea and shows what it is counting during the quiet start", async () => {
+ installFetch({ ...STATUS, silent: true }, false, []);
+ renderWith(<SelfBuildView />);
+ const hero = await screen.findByTestId("self-build-hero");
+ expect(hero.dataset.tone).toBe("silent");
+ expect(hero.textContent).toMatch(/getting to know how you work/);
+ await waitFor(() => expect(screen.getByTestId("self-build-ring").getAttribute("aria-label")).toBe("Day 3 of 7"));
+ expect(within(screen.getByTestId("self-build-reach")).getByText("Tries it, with undo")).toBeTruthy();
+ expect(screen.getByTestId("self-build-how")).toBeTruthy();
+ const needs = await screen.findAllByTestId("noticed-need");
+ expect(needs[0].textContent).toMatch(/Did I get any important emails\?/);
+ expect(needs[0].textContent).toMatch(/Asked 4 times · on 2 days/);
+ expect(needs[0].textContent).toMatch(/1 more day to go/);
+ expect(screen.getByTestId("self-build-noticed").textContent).toMatch(/5 requests noted once/);
+ });
+
+ it("links a need that became a suggestion to it", async () => {
+ installFetch();
+ renderWith(<SelfBuildView />);
+ const needs = await screen.findAllByTestId("noticed-need");
+ fireEvent.click(within(needs[1]).getByRole("button", { name: /see the suggestion/i }));
+ expect((await screen.findByTestId("build-detail")).dataset.buildId).toBe("p1");
+ });
+
+ it("says nothing repeated yet when the miner has nothing", async () => {
+ installFetch(STATUS, false, [], { ...NOTICED, needs: [], once: 0 });
+ renderWith(<SelfBuildView />);
+ expect(await screen.findByTestId("noticed-empty")).toBeTruthy();
+ expect(screen.getByTestId("self-build-hero").textContent).toMatch(/watching for repeats/);
+ });
+
it("opens on the build a badge asked for", async () => {
installFetch();
useSelfBuildFocus.getState().request("t1");
diff --git a/dodaios/ui/web/frontend/src/views/SelfBuildView.tsx b/dodaios/ui/web/frontend/src/views/SelfBuildView.tsx
index c372245e13..e415d51474 100644
--- a/dodaios/ui/web/frontend/src/views/SelfBuildView.tsx
+++ b/dodaios/ui/web/frontend/src/views/SelfBuildView.tsx
@@ -1,19 +1,20 @@
/**
- * "Built for you" — everything the self-building loop made on its own.
+ * "Built for you": what the assistant notices the person keeps doing, and the
+ * small helpers it builds to take that off them.
*
- * The person is no longer asked about every build, so this page is the
- * counterweight: every build is on it with the one sentence it exists for,
- * where it stands, and the action that applies to it. The page is organised
- * by what each build asks of the person — waiting for a yes, on trial, being
- * built, kept, gone — not as a table of rows. A build opens into its case file
- * on the right (`BuildDetail`).
+ * One reading column, top to bottom, in the order a person asks about it:
+ * what is this and is it working (the hero), what needs me (suggestions),
+ * what is running for me (trials, builds in progress), what has it noticed so
+ * far (the repeats it is counting), what did I keep, and what is gone. A
+ * build opens as a sheet on the right with its full case file
+ * (`BuildDetail`). While nothing is built, the page teaches the idea in three
+ * steps instead of standing empty.
*
- * It never interrupts: no toast, no sound, no voice. New builds show up here,
- * as a quiet count on the nav row, and in the one-line digest at the top.
- * Live through `SelfBuildChanged` (hooks/useWebSocket.ts). docs/self-build.md.
+ * It never interrupts: no toast, no sound, no voice. Live through
+ * `SelfBuildChanged` (hooks/useWebSocket.ts). docs/self-build.md.
*/
import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";
-import { ChevronDown, Loader2, Pause, Play, Settings2, OctagonX } from "lucide-react";
+import { ChevronDown, ChevronRight, Loader2, OctagonX, Pause, Play, Settings2 } from "lucide-react";
import { fill, useLocaleChunk, useT } from "@/i18n";
import { useRunLocale } from "@/components/runs/format";
import { cn } from "@/lib/utils";
@@ -24,6 +25,7 @@ import {
useBuildAction,
useSelfBuildDigest,
useSelfBuildList,
+ useSelfBuildNoticed,
useSelfBuildPause,
useSelfBuildSettings,
useSetSocietyKillSwitch,
@@ -32,26 +34,32 @@ import {
} from "@/hooks/useSelfBuild";
import {
SelfBuildApiError,
- reachedStep,
shelfOf,
trialProgress,
type Build,
type BuildDigest,
type SelfBuildStatus,
- type Shelf,
} from "@/lib/selfBuildApi";
import { BuildActions } from "./selfBuild/BuildActions";
import { BuildDetail } from "./selfBuild/BuildDetail";
-import { KindIcon, LifecycleRail, relativeTime } from "./selfBuild/shared";
+import { Hero, heroTone, type HeroTone } from "./selfBuild/Hero";
+import { HowItWorks, NoticedSection, SectionHead } from "./selfBuild/Noticed";
+import { KindIcon, relativeTime } from "./selfBuild/shared";
-const SHELVES: readonly Shelf[] = ["waiting", "trial", "working", "kept", "past"];
+type Limits = { trial_days: number; trial_uses: number } | undefined;
export function SelfBuildView() {
const ready = useLocaleChunk("self_build");
const t = useT();
+ const locale = useRunLocale();
const list = useSelfBuildList();
const digest = useSelfBuildDigest(24);
+ const noticed = useSelfBuildNoticed();
const settings = useSelfBuildSettings();
+ const kill = useSocietyKillSwitch();
+ const setKill = useSetSocietyKillSwitch();
+ const pause = useSelfBuildPause();
+ const setActive = useEventStore((s) => s.setActiveSection);
const act = useBuildAction();
const [selectedId, setSelectedId] = useState<string | null>(() => useSelfBuildFocus.getState().take());
const [error, setError] = useState<string | null>(null);
@@ -66,11 +74,27 @@ export function SelfBuildView() {
const status = list.data?.status;
const selected = builds.find((b) => b.id === selectedId) ?? null;
const limits = settings.data?.settings;
+ const stopped = kill.data === true;
+ const tone = heroTone(status, stopped);
// Accepting starts a build, so it waits while building is paused.
const canBuild = (build: Build) => Boolean(status?.builders.includes(build.kind)) && !status?.paused;
const blockedTitle = (build: Build) =>
status?.paused ? t("self_build.notes.paused") : !status?.builders.includes(build.kind) ? t("self_build.no_builder") : undefined;
+ const groups = useMemo(() => {
+ const by = { waiting: [] as Build[], live: [] as Build[], kept: [] as Build[], past: [] as Build[] };
+ for (const build of builds) {
+ const shelf = shelfOf(build);
+ if (shelf === "waiting") by.waiting.push(build);
+ else if (shelf === "trial" || shelf === "working") by.live.push(build);
+ else if (shelf === "kept") by.kept.push(build);
+ else by.past.push(build);
+ }
+ // Trials first (they can be kept or undone), then what is still being built.
+ by.live.sort((a, b) => Number(b.state === "trial") - Number(a.state === "trial"));
+ return by;
+ }, [builds]);
+
const onAction = (build: Build, action: BuildAction) => {
setError(null);
act.mutate(
@@ -78,366 +102,379 @@ export function SelfBuildView() {
{ onError: (err) => setError(fill(t("self_build.error.action"), { detail: err.message })) },
);
};
+ const openSettings = () => {
+ useSettingsJump.getState().request("self-build");
+ setActive("settings");
+ };
+ const select = (build: Build) => setSelectedId(build.id === selectedId ? null : build.id);
+ const busyId = act.isPending ? act.variables?.id ?? null : null;
if (!ready) return <Centered><Loader2 className="h-5 w-5 animate-spin text-muted-foreground" aria-hidden /></Centered>;
const unavailable = list.error instanceof SelfBuildApiError && list.error.status === 503;
+ const helpersLive = groups.live.filter((b) => b.state === "trial").length + groups.kept.length;
+ const nothingBuilt = builds.length === 0;
+
+ const heroAction =
+ tone === "paused"
+ ? { label: t("self_build.resume"), onClick: () => pause.mutate(false), busy: pause.isPending, testId: "self-build-resume", icon: <Play className="h-4 w-4" aria-hidden /> }
+ : tone === "off"
+ ? { label: t("self_build.notes.turn_on"), onClick: openSettings, testId: "self-build-turn-on" }
+ : tone === "stopped"
+ ? { label: t("self_build.notes.release"), onClick: () => setKill.mutate(false), busy: setKill.isPending, testId: "self-build-release" }
+ : undefined;
return (
<div data-testid="self-build-view" className="flex h-full min-h-0 flex-col overflow-y-auto">
- <div className="mx-auto flex w-full max-w-[1240px] flex-1 flex-col px-6 pb-16 pt-10 sm:px-10">
- <Header status={status} />
- <Notes status={status} />
- <DigestLine digest={digest.data} />
- {error && (
- <p role="alert" className="mt-4 rounded-lg border border-destructive/40 px-3 py-2 text-sm text-destructive">
- {error}
- </p>
- )}
+ <div className="mx-auto flex w-full max-w-[1000px] flex-1 flex-col px-6 pb-12 pt-10 sm:px-10">
+ <TopBar tone={tone} paused={Boolean(status?.paused)} enabled={Boolean(status?.enabled)} onSettings={openSettings} />
{list.isPending ? (
<Centered><Loader2 className="h-5 w-5 animate-spin text-muted-foreground" aria-label={t("self_build.loading")} /></Centered>
) : unavailable || list.error ? (
<p role="alert" className="mt-10 text-base text-muted-foreground">{t("self_build.error.unavailable")}</p>
- ) : builds.length === 0 ? (
- <EmptyLoop />
) : (
- <div className="mt-8 grid min-h-0 flex-1 grid-cols-1 items-start gap-8 lg:grid-cols-[minmax(0,1fr)_minmax(360px,440px)]">
- <div className="min-w-0 space-y-9" data-testid="self-build-shelves">
- {SHELVES.map((shelf) => (
- <ShelfSection
- key={shelf}
- shelf={shelf}
- builds={builds.filter((b) => shelfOf(b) === shelf)}
- selectedId={selectedId}
- onSelect={(b) => setSelectedId(b.id === selectedId ? null : b.id)}
- canBuild={canBuild}
- blockedTitle={blockedTitle}
- busyId={act.isPending ? act.variables?.id ?? null : null}
- onAction={onAction}
- limits={limits}
- />
- ))}
- </div>
- <aside className="min-w-0 lg:sticky lg:top-6 lg:max-h-[calc(100vh-7rem)] lg:min-h-[420px] lg:[&>article]:max-h-[calc(100vh-7rem)]">
- {selected ? (
- <BuildDetail
- key={selected.id}
- build={selected}
- limits={limits}
- canBuild={canBuild(selected)}
- blockedTitle={blockedTitle(selected)}
- busy={act.isPending && act.variables?.id === selected.id}
- onAction={onAction}
- onClose={() => setSelectedId(null)}
- />
- ) : (
- <PickHint />
- )}
- </aside>
- </div>
+ <>
+ {tone && (
+ <Hero
+ tone={tone}
+ status={status}
+ quiet={noticed.data?.quiet_start}
+ waiting={groups.waiting.length}
+ live={helpersLive}
+ locale={locale}
+ action={heroAction}
+ />
+ )}
+ <StateNotes status={status} stopped={stopped} />
+ <DigestLine digest={digest.data} />
+ {error && (
+ <p role="alert" className="mt-4 rounded-lg border border-destructive/40 px-3 py-2 text-sm text-destructive">
+ {error}
+ </p>
+ )}
+
+ {nothingBuilt && <HowItWorks />}
+
+ {groups.waiting.length > 0 && (
+ <section data-testid="shelf-waiting" aria-labelledby="shelf-waiting-title" className="mt-12">
+ <SectionHead id="shelf-waiting-title" title={t("self_build.shelf.waiting")} hint={t("self_build.shelf.waiting_hint")} count={groups.waiting.length} />
+ <ul className="space-y-3">
+ {groups.waiting.map((build) => (
+ <ProposalCard
+ key={build.id}
+ build={build}
+ selected={build.id === selectedId}
+ onSelect={() => select(build)}
+ canBuild={canBuild(build)}
+ blockedTitle={blockedTitle(build)}
+ busy={busyId === build.id}
+ onAction={onAction}
+ locale={locale}
+ />
+ ))}
+ </ul>
+ </section>
+ )}
+
+ {groups.live.length > 0 && (
+ <Shelf id="live" title={t("self_build.shelf.live")} hint={t("self_build.shelf.live_hint")} count={groups.live.length}>
+ {groups.live.map((build) => (
+ <BuildRow key={build.id} build={build} selected={build.id === selectedId} onSelect={() => select(build)} busy={busyId === build.id} onAction={onAction} limits={limits} locale={locale} />
+ ))}
+ </Shelf>
+ )}
+
+ <NoticedSection
+ data={noticed.data}
+ locale={locale}
+ paused={Boolean(status?.paused) || stopped}
+ onOpenBuild={(id) => setSelectedId(id)}
+ />
+
+ {groups.kept.length > 0 && (
+ <Shelf id="kept" title={t("self_build.shelf.kept")} hint={t("self_build.shelf.kept_hint")} count={groups.kept.length}>
+ {groups.kept.map((build) => (
+ <BuildRow key={build.id} build={build} selected={build.id === selectedId} onSelect={() => select(build)} busy={busyId === build.id} onAction={onAction} limits={limits} locale={locale} />
+ ))}
+ </Shelf>
+ )}
+
+ {groups.past.length > 0 && (
+ <PastShelf builds={groups.past} selectedId={selectedId} onSelect={select} busyId={busyId} onAction={onAction} limits={limits} locale={locale} />
+ )}
+
+ {!nothingBuilt && <HowItWorks compact />}
+ </>
)}
+
+ <Footer stopped={stopped} busy={setKill.isPending} onStop={() => setKill.mutate(true)} />
</div>
+
+ {selected && (
+ <DetailSheet onClose={() => setSelectedId(null)}>
+ <BuildDetail
+ key={selected.id}
+ build={selected}
+ limits={limits}
+ canBuild={canBuild(selected)}
+ blockedTitle={blockedTitle(selected)}
+ busy={act.isPending && act.variables?.id === selected.id}
+ onAction={onAction}
+ onClose={() => setSelectedId(null)}
+ />
+ </DetailSheet>
+ )}
</div>
);
}
-// ------------------------------------------------------------------ header
+// ------------------------------------------------------------------ top bar
-function Header({ status }: { status: SelfBuildStatus | undefined }) {
+function TopBar({
+ tone,
+ paused,
+ enabled,
+ onSettings,
+}: {
+ tone: HeroTone | null;
+ paused: boolean;
+ enabled: boolean;
+ onSettings: () => void;
+}) {
const t = useT();
const pause = useSelfBuildPause();
- const setActive = useEventStore((s) => s.setActiveSection);
- const [confirmStop, setConfirmStop] = useState(false);
- const kill = useSocietyKillSwitch();
- const setKill = useSetSocietyKillSwitch();
- const paused = Boolean(status?.paused);
- const tone = !status ? "idle" : !status.enabled ? "off" : paused ? "paused" : status.silent ? "silent" : "running";
-
- const openSettings = () => {
- useSettingsJump.getState().request("self-build");
- setActive("settings");
- };
-
return (
- <header className="flex flex-wrap items-end gap-x-6 gap-y-4">
+ <header className="flex flex-wrap items-center gap-x-4 gap-y-3">
<div className="min-w-0 flex-1">
- <h1 className="font-display text-2xl font-semibold text-foreground-strong">{t("self_build.title")}</h1>
- <p className="mt-1 max-w-xl text-base text-muted-foreground">{t("self_build.subtitle")}</p>
+ <h1 className="font-display text-xl font-semibold text-foreground-strong">{t("self_build.title")}</h1>
</div>
- <div className="flex flex-wrap items-center gap-2">
- {status && (
+ {tone && (
+ <span data-testid="self-build-status" data-tone={tone} className="inline-flex items-center gap-2 text-sm text-muted-foreground">
<span
- data-testid="self-build-status"
- data-tone={tone}
- className="mr-1 inline-flex items-center gap-2 text-sm text-muted-foreground"
- >
- <span
- aria-hidden
- className={cn(
- "h-2 w-2 rounded-full",
- tone === "running" && "bg-success",
- tone === "paused" && "bg-warning",
- tone === "silent" && "bg-info",
- tone === "off" && "bg-border-strong",
- )}
- />
- {t(`self_build.status.${tone === "idle" ? "running" : tone}`)}
- </span>
- )}
- {status?.enabled && (
- <button
- type="button"
- data-testid="self-build-pause"
- aria-pressed={paused}
- title={t("self_build.pause_hint")}
- disabled={pause.isPending}
- onClick={() => pause.mutate(!paused)}
+ aria-hidden
className={cn(
- "inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
- paused ? "bg-primary text-primary-foreground hover:bg-primary/90" : "border border-border-strong text-foreground hover:bg-secondary",
+ "h-2 w-2 rounded-full",
+ tone === "running" && "bg-success",
+ tone === "silent" && "bg-accent",
+ tone === "paused" && "bg-warning",
+ tone === "stopped" && "bg-destructive",
+ tone === "off" && "bg-border-strong",
)}
- >
- {paused ? <Play className="h-3.5 w-3.5" aria-hidden /> : <Pause className="h-3.5 w-3.5" aria-hidden />}
- {paused ? t("self_build.resume") : t("self_build.pause")}
- </button>
- )}
+ />
+ {t(`self_build.status.${tone}`)}
+ </span>
+ )}
+ {enabled && (
<button
type="button"
- onClick={openSettings}
- aria-label={t("self_build.settings")}
- title={t("self_build.settings")}
- data-testid="self-build-settings"
- className="inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ data-testid="self-build-pause"
+ aria-pressed={paused}
+ title={t("self_build.pause_hint")}
+ disabled={pause.isPending}
+ onClick={() => pause.mutate(!paused)}
+ className="inline-flex h-8 items-center gap-1.5 rounded-md border border-border-strong px-3 text-sm font-medium text-foreground transition-colors hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50"
>
- <Settings2 className="h-4 w-4" aria-hidden />
+ {paused ? <Play className="h-3.5 w-3.5" aria-hidden /> : <Pause className="h-3.5 w-3.5" aria-hidden />}
+ {paused ? t("self_build.resume") : t("self_build.pause")}
</button>
- {kill.data !== true && (
- <button
- type="button"
- data-testid="society-stop-all"
- title={t("self_build.stop_all_hint")}
- onClick={() => setConfirmStop(true)}
- className="inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-sm text-destructive hover:bg-destructive/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
- >
- <OctagonX className="h-4 w-4" aria-hidden />
- {t("self_build.stop_all")}
- </button>
- )}
- </div>
- {confirmStop && (
- <ConfirmStop
- busy={setKill.isPending}
- onCancel={() => setConfirmStop(false)}
- onConfirm={() => setKill.mutate(true, { onSettled: () => setConfirmStop(false) })}
- />
)}
+ <button
+ type="button"
+ onClick={onSettings}
+ aria-label={t("self_build.settings")}
+ title={t("self_build.settings")}
+ data-testid="self-build-settings"
+ className="inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ <Settings2 className="h-4 w-4" aria-hidden />
+ </button>
</header>
);
}
-function Notes({ status }: { status: SelfBuildStatus | undefined }) {
- const t = useT();
- const kill = useSocietyKillSwitch();
- const setKill = useSetSocietyKillSwitch();
- const setActive = useEventStore((s) => s.setActiveSection);
- const notes: ReactNode[] = [];
- if (kill.data === true) {
- notes.push(
- <Note key="stopped" tone="destructive" testId="note-stopped"
- action={{ label: t("self_build.notes.release"), onClick: () => setKill.mutate(false), busy: setKill.isPending }}>
- {t("self_build.notes.stopped")}
- </Note>,
- );
- }
- if (status && !status.enabled) {
- notes.push(
- <Note key="off" tone="muted" testId="note-off"
- action={{
- label: t("self_build.notes.turn_on"),
- onClick: () => {
- useSettingsJump.getState().request("self-build");
- setActive("settings");
- },
- }}>
- {t("self_build.notes.off")}
- </Note>,
- );
- } else if (status?.paused) {
- notes.push(
- // The resume button sits in the header right above; the note only says why.
- <Note key="paused" tone="warning" testId="note-paused">
- {t("self_build.notes.paused")}
- </Note>,
- );
- } else if (status?.silent) {
- notes.push(<Note key="silent" tone="muted" testId="note-silent">{t("self_build.notes.silent")}</Note>);
- }
- if (!notes.length) return null;
- return <div className="mt-6 space-y-2">{notes}</div>;
-}
-
-function Note({
- tone,
- children,
- action,
- testId,
-}: {
- tone: "muted" | "warning" | "destructive";
- children: ReactNode;
- action?: { label: string; onClick: () => void; busy?: boolean };
- testId: string;
-}) {
+/** Machine-readable markers for the states the hero already explains in words. */
+function StateNotes({ status, stopped }: { status: SelfBuildStatus | undefined; stopped: boolean }) {
return (
- <div
- data-testid={testId}
- className={cn(
- "flex flex-wrap items-center gap-x-4 gap-y-2 rounded-lg border px-4 py-2.5 text-sm",
- tone === "muted" && "border-border text-muted-foreground",
- tone === "warning" && "border-warning/40 text-foreground",
- tone === "destructive" && "border-destructive/40 text-foreground",
- )}
- >
- <span
- aria-hidden
- className={cn(
- "h-1.5 w-1.5 shrink-0 rounded-full",
- tone === "muted" && "bg-border-strong",
- tone === "warning" && "bg-warning",
- tone === "destructive" && "bg-destructive",
- )}
- />
- <span className="min-w-0 flex-1">{children}</span>
- {action && (
- <button
- type="button"
- onClick={action.onClick}
- disabled={action.busy}
- className="shrink-0 rounded-md px-2 py-1 text-sm font-medium text-foreground underline-offset-4 hover:underline disabled:opacity-50"
- >
- {action.label}
- </button>
- )}
- </div>
+ <>
+ {stopped && <span data-testid="note-stopped" hidden />}
+ {status && !status.enabled && <span data-testid="note-off" hidden />}
+ {status?.enabled && status.paused && <span data-testid="note-paused" hidden />}
+ {status?.enabled && !status.paused && status.silent && <span data-testid="note-silent" hidden />}
+ </>
);
}
// ------------------------------------------------------------------ digest
-/**
- * The daily glance as one sentence-like line, not a row of stat tiles: what
- * changed since yesterday, and how much is live now.
- */
+/** What changed since yesterday, as one quiet line; nothing when nothing did. */
function DigestLine({ digest }: { digest: BuildDigest | undefined }) {
const t = useT();
if (!digest) return null;
const counts = digest.counts;
const built = (counts.trial ?? 0) + (counts.building ?? 0) + (counts.proving ?? 0);
const parts: [string, number][] = [
- ["built", built],
["proposed", counts.proposed ?? 0],
+ ["built", built],
["kept", counts.kept ?? 0],
["archived", counts.archived ?? 0],
["undone", counts.undone ?? 0],
];
const shown = parts.filter(([, n]) => n > 0);
+ if (!shown.length) return null;
return (
- <p data-testid="self-build-digest" className="mt-6 flex flex-wrap items-baseline gap-x-3 gap-y-1 border-y border-border py-3 text-base">
- <span className="text-sm font-medium text-muted-foreground">{t("self_build.digest.label")}</span>
- {shown.length === 0 ? (
- <span className="text-muted-foreground">{t("self_build.digest.nothing")}</span>
- ) : (
- shown.map(([key, n], index) => (
- <span key={key} className="text-foreground">
- {index > 0 && <span aria-hidden className="mr-3 text-border-strong">·</span>}
- <Count text={fill(t(`self_build.digest.${key}`), { count: n })} n={n} />
- </span>
- ))
- )}
- <span className="ml-auto text-sm text-muted-foreground">
- <Count text={fill(t("self_build.digest.live"), { count: digest.live })} n={digest.live} />
- </span>
+ <p data-testid="self-build-digest" className="mt-4 flex flex-wrap items-baseline gap-x-2 gap-y-1 px-1 text-sm text-muted-foreground">
+ <span className="font-medium">{t("self_build.digest.label")}</span>
+ {shown.map(([key, n]) => (
+ <span key={key} className="text-foreground">
+ <span aria-hidden className="mr-2 text-border-strong">·</span>
+ {fill(t(`self_build.digest.${key}`), { count: n })}
+ </span>
+ ))}
</p>
);
}
-/** Puts the number of a "{count} built" string in strong ink, wherever the locale placed it. */
-function Count({ text, n }: { text: string; n: number }) {
- const digits = String(n);
- const at = text.indexOf(digits);
- if (at < 0) return <>{text}</>;
+// ------------------------------------------------------------------ suggestions
+
+/** The first sentence of the case: the plain "why" under a suggestion. */
+function whyOf(build: Build): string {
+ const line = (build.case || "").split("\n").map((l) => l.trim()).find(Boolean) ?? "";
+ return line.length > 220 ? `${line.slice(0, 219).trimEnd()}…` : line;
+}
+
+function ProposalCard({
+ build,
+ selected,
+ onSelect,
+ canBuild,
+ blockedTitle,
+ busy,
+ onAction,
+ locale,
+}: {
+ build: Build;
+ selected: boolean;
+ onSelect: () => void;
+ canBuild: boolean;
+ blockedTitle?: string;
+ busy: boolean;
+ onAction: (build: Build, action: BuildAction) => void;
+ locale: string;
+}) {
+ const t = useT();
+ const why = whyOf(build);
return (
- <>
- {text.slice(0, at)}
- <span className="font-semibold tabular-nums text-foreground-strong">{digits}</span>
- {text.slice(at + digits.length)}
- </>
+ <li>
+ <div
+ data-testid="build-row"
+ data-build-id={build.id}
+ data-state={build.state}
+ data-selected={selected || undefined}
+ onClick={onSelect}
+ className={cn(
+ "cursor-pointer rounded-xl border bg-card px-6 py-5 transition-colors",
+ selected ? "border-accent/60" : "border-border hover:border-border-strong",
+ )}
+ >
+ <p className="flex items-center gap-2 text-sm text-muted-foreground">
+ <KindIcon kind={build.kind} />
+ <span>{t(`self_build.suggested.${build.kind}`)}</span>
+ <span aria-hidden>·</span>
+ <span>{relativeTime(build.created_ms, locale)}</span>
+ </p>
+ <p className="mt-2 text-lg font-medium leading-snug text-foreground-strong">{build.title}</p>
+ {why && <p className="mt-1.5 line-clamp-2 text-base leading-relaxed text-muted-foreground">{why}</p>}
+ <div className="mt-4 flex flex-wrap items-center gap-x-4 gap-y-2">
+ <BuildActions build={build} canBuild={canBuild} blockedTitle={blockedTitle} busy={busy} onAction={onAction} size="default" />
+ <span className="text-sm text-muted-foreground">
+ {build.evidence.length > 0
+ ? fill(t(build.evidence.length === 1 ? "self_build.based_on_one" : "self_build.based_on_other"), { count: build.evidence.length })
+ : ""}
+ </span>
+ <OpenButton selected={selected} onSelect={onSelect} className="ml-auto" />
+ </div>
+ </div>
+ </li>
+ );
+}
+
+/** The keyboard way into a build's case file (the whole card also opens it on click). */
+function OpenButton({ selected, onSelect, className }: { selected: boolean; onSelect: () => void; className?: string }) {
+ const t = useT();
+ return (
+ <button
+ type="button"
+ data-testid="build-open"
+ aria-expanded={selected}
+ onClick={(event) => {
+ event.stopPropagation();
+ onSelect();
+ }}
+ className={cn(
+ "inline-flex h-8 items-center gap-0.5 rounded-md px-2 text-sm text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ className,
+ )}
+ >
+ {t("self_build.details")}
+ <ChevronRight className="h-3.5 w-3.5" aria-hidden />
+ </button>
);
}
// ------------------------------------------------------------------ shelves
-function ShelfSection({
- shelf,
+function Shelf({ id, title, hint, count, children }: { id: string; title: string; hint: string; count: number; children: ReactNode }) {
+ return (
+ <section data-testid={`shelf-${id}`} aria-labelledby={`shelf-${id}-title`} className="mt-12">
+ <SectionHead id={`shelf-${id}-title`} title={title} hint={hint} count={count} />
+ <ul className="overflow-hidden rounded-xl border border-border bg-card">{children}</ul>
+ </section>
+ );
+}
+
+function PastShelf({
builds,
selectedId,
onSelect,
- canBuild,
- blockedTitle,
busyId,
onAction,
limits,
+ locale,
}: {
- shelf: Shelf;
builds: Build[];
selectedId: string | null;
onSelect: (build: Build) => void;
- canBuild: (build: Build) => boolean;
- blockedTitle: (build: Build) => string | undefined;
busyId: string | null;
onAction: (build: Build, action: BuildAction) => void;
- limits: { trial_days: number; trial_uses: number } | undefined;
+ limits: Limits;
+ locale: string;
}) {
const t = useT();
- const collapsible = shelf === "past";
- const [open, setOpen] = useState(!collapsible);
- const holdsSelection = builds.some((b) => b.id === selectedId);
- if (!builds.length) return null;
- const expanded = open || holdsSelection;
+ const [open, setOpen] = useState(false);
+ const expanded = open || builds.some((b) => b.id === selectedId);
return (
- <section data-testid={`shelf-${shelf}`} aria-labelledby={`shelf-${shelf}-title`}>
+ <section data-testid="shelf-past" aria-labelledby="shelf-past-title" className="mt-12">
<div className="mb-3 flex items-baseline gap-3">
- <h2 id={`shelf-${shelf}-title`} className="text-base font-semibold text-foreground-strong">
- {t(`self_build.shelf.${shelf}`)}
+ <h2 id="shelf-past-title" className="text-lg font-semibold text-foreground-strong">
+ {t("self_build.shelf.past")}
<span className="ml-2 font-normal tabular-nums text-muted-foreground">{builds.length}</span>
</h2>
- <span className="truncate text-sm text-muted-foreground">{t(`self_build.shelf.${shelf}_hint`)}</span>
- {collapsible && (
- <button
- type="button"
- onClick={() => setOpen((v) => !v)}
- aria-expanded={expanded}
- className="ml-auto inline-flex shrink-0 items-center gap-1 text-sm text-muted-foreground hover:text-foreground"
- >
- {expanded ? t("self_build.hide_past") : fill(t("self_build.show_past"), { count: builds.length })}
- <ChevronDown className={cn("h-3.5 w-3.5 transition-transform", expanded && "rotate-180")} aria-hidden />
- </button>
- )}
+ <p className="hidden truncate text-sm text-muted-foreground sm:block">{t("self_build.shelf.past_hint")}</p>
+ <button
+ type="button"
+ onClick={() => setOpen((v) => !v)}
+ aria-expanded={expanded}
+ className="ml-auto inline-flex shrink-0 items-center gap-1 rounded-sm text-sm text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ {expanded ? t("self_build.hide_past") : fill(t("self_build.show_past"), { count: builds.length })}
+ <ChevronDown className={cn("h-3.5 w-3.5 transition-transform", expanded && "rotate-180")} aria-hidden />
+ </button>
</div>
{expanded && (
- <ul className="space-y-2">
+ <ul className="overflow-hidden rounded-xl border border-border">
{builds.map((build) => (
- <BuildRow
- key={build.id}
- build={build}
- selected={build.id === selectedId}
- onSelect={() => onSelect(build)}
- canBuild={canBuild(build)}
- blockedTitle={blockedTitle(build)}
- busy={busyId === build.id}
- onAction={onAction}
- limits={limits}
- />
+ <BuildRow key={build.id} build={build} selected={build.id === selectedId} onSelect={() => onSelect(build)} busy={busyId === build.id} onAction={onAction} limits={limits} locale={locale} />
))}
</ul>
)}
@@ -449,130 +486,129 @@ function BuildRow({
build,
selected,
onSelect,
- canBuild,
- blockedTitle,
busy,
onAction,
limits,
+ locale,
}: {
build: Build;
selected: boolean;
onSelect: () => void;
- canBuild: boolean;
- blockedTitle?: string;
busy: boolean;
onAction: (build: Build, action: BuildAction) => void;
- limits: { trial_days: number; trial_uses: number } | undefined;
+ limits: Limits;
+ locale: string;
}) {
const t = useT();
- const locale = useRunLocale();
const trial = trialProgress(build, limits);
- const quiet = shelfOf(build) === "past";
+ const shelf = shelfOf(build);
+ const quiet = shelf === "past";
+ const working = shelf === "working";
const ref = useRef<HTMLLIElement>(null);
useEffect(() => {
if (selected) ref.current?.scrollIntoView?.({ block: "nearest" });
}, [selected]);
const meta = useMemo(() => {
- const bits = [t(`self_build.kind.${build.kind}`)];
- if (quiet) bits.push(t(`self_build.state.${build.state}`));
- if (build.evidence.length > 1) bits.push(fill(t("self_build.seen"), { count: build.evidence.length }));
- bits.push(relativeTime(build.updated_ms, locale));
+ const bits = [t(`self_build.kind.${build.kind}`), t(`self_build.state.${build.state}`)];
+ if (build.uses > 0) bits.push(fill(t("self_build.detail.uses"), { count: build.uses }));
+ bits.push(relativeTime(build.last_used_ms || build.updated_ms, locale));
return bits.join(" · ");
- }, [build, quiet, t, locale]);
+ }, [build, t, locale]);
return (
- <li ref={ref}>
+ <li ref={ref} className="border-t border-border first:border-t-0">
<div
- role="button"
- tabIndex={0}
data-testid="build-row"
data-build-id={build.id}
data-state={build.state}
- aria-pressed={selected}
+ data-selected={selected || undefined}
onClick={onSelect}
- onKeyDown={(event) => {
- if (event.key === "Enter" || event.key === " ") {
- event.preventDefault();
- onSelect();
- }
- }}
className={cn(
- "group flex cursor-pointer items-start gap-3 rounded-lg border px-4 py-3 transition-colors",
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
- selected ? "border-border-strong bg-secondary" : "border-border bg-card hover:border-border-strong",
- quiet && !selected && "bg-transparent",
+ "flex cursor-pointer flex-wrap items-center gap-x-4 gap-y-3 px-5 py-4 transition-colors",
+ selected ? "bg-accent/10" : "hover:bg-secondary/60",
)}
>
- <span className={cn("mt-0.5", quiet ? "text-muted-foreground" : "text-foreground")}>
- <KindIcon kind={build.kind} />
+ <span className={cn("flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-secondary", quiet ? "text-muted-foreground" : "text-foreground")}>
+ {working ? <Loader2 className="h-4 w-4 animate-spin" aria-hidden /> : <KindIcon kind={build.kind} />}
</span>
- <div className="min-w-0 flex-1">
- <p className={cn("line-clamp-2 text-[15px] leading-snug", quiet ? "text-muted-foreground" : "text-foreground-strong")}>
- {build.title}
- </p>
- <p className="mt-1 truncate text-sm text-muted-foreground">{meta}</p>
+ <div className="min-w-0 flex-1 basis-[260px]">
+ <p className={cn("line-clamp-2 text-base leading-snug", quiet ? "text-muted-foreground" : "text-foreground-strong")}>{build.title}</p>
+ <p className="mt-0.5 truncate text-sm text-muted-foreground">{meta}</p>
{trial && (
<div className="mt-2 flex items-center gap-3">
- <div className="h-1 w-32 overflow-hidden rounded-full bg-secondary" aria-hidden>
+ <div className="h-1 w-32 overflow-hidden rounded-full bg-surface-raised" aria-hidden>
<div className="h-full rounded-full bg-accent" style={{ width: `${Math.round(trial.share * 100)}%` }} />
</div>
<span className="truncate text-xs tabular-nums text-muted-foreground">
- {fill(t("self_build.trial_progress"), {
- days: trial.days,
- dayLimit: trial.dayLimit,
- uses: trial.uses,
- useLimit: trial.useLimit,
- })}
+ {fill(t("self_build.trial_progress"), { days: trial.days, dayLimit: trial.dayLimit, uses: trial.uses, useLimit: trial.useLimit })}
</span>
</div>
)}
</div>
- <div className="flex shrink-0 flex-col items-end gap-2.5">
- <LifecycleRail state={build.state} reached={reachedStep(build)} compact />
- {(build.state === "proposed" || build.state === "trial") && (
- <BuildActions build={build} canBuild={canBuild} blockedTitle={blockedTitle} busy={busy} onAction={onAction} />
+ <div className="flex shrink-0 items-center gap-3">
+ {(build.state === "trial" || build.state === "kept") && (
+ <BuildActions build={build} canBuild={false} busy={busy} onAction={onAction} />
)}
+ <OpenButton selected={selected} onSelect={onSelect} />
</div>
</div>
</li>
);
}
-// ------------------------------------------------------------------ calm states
+// ------------------------------------------------------------------ sheet, footer
-function PickHint() {
- const t = useT();
+function DetailSheet({ onClose, children }: { onClose: () => void; children: ReactNode }) {
+ const panel = useRef<HTMLDivElement>(null);
+ useEffect(() => {
+ const onKey = (event: KeyboardEvent) => {
+ if (event.key === "Escape") onClose();
+ };
+ window.addEventListener("keydown", onKey);
+ panel.current?.focus();
+ return () => window.removeEventListener("keydown", onKey);
+ }, [onClose]);
return (
- <div className="rounded-xl border border-dashed border-border px-6 py-10 text-center">
- <p className="mx-auto max-w-xs text-sm text-muted-foreground">{t("self_build.detail.select")}</p>
- <LoopLine className="mt-6 justify-center" />
+ <div className="fixed inset-0 z-[100] flex justify-end" data-testid="build-sheet">
+ <div role="presentation" className="absolute inset-0 bg-background/50" onPointerDown={onClose} />
+ <div
+ ref={panel}
+ tabIndex={-1}
+ className="relative flex h-full w-full max-w-[520px] flex-col p-3 outline-none motion-safe:animate-in motion-safe:slide-in-from-right-4 [&>article]:h-full [&>article]:shadow-float"
+ >
+ {children}
+ </div>
</div>
);
}
-const LOOP = ["notice", "decide", "build", "check", "trial", "keep"] as const;
-
-function LoopLine({ className }: { className?: string }) {
- const t = useT();
- return (
- <ol className={cn("flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground", className)}>
- {LOOP.map((step, index) => (
- <li key={step} className="flex items-center gap-2">
- {index > 0 && <span aria-hidden className="text-border-strong">→</span>}
- <span>{t(`self_build.empty.loop.${step}`)}</span>
- </li>
- ))}
- </ol>
- );
-}
-
-function EmptyLoop() {
+function Footer({ stopped, busy, onStop }: { stopped: boolean; busy: boolean; onStop: () => void }) {
const t = useT();
+ const [confirm, setConfirm] = useState(false);
+ if (stopped) return null;
return (
- <section data-testid="self-build-empty" className="mt-16 max-w-2xl">
- <h2 className="font-display text-xl text-foreground-strong">{t("self_build.empty.title")}</h2>
- <p className="mt-2 text-base leading-relaxed text-muted-foreground">{t("self_build.empty.body")}</p>
- <LoopLine className="mt-6" />
- </section>
+ <footer className="mt-16 flex flex-wrap items-center gap-x-3 gap-y-2 border-t border-border pt-5 text-sm text-muted-foreground">
+ <span className="flex-1">{t("self_build.stop_footer")}</span>
+ <button
+ type="button"
+ data-testid="society-stop-all"
+ title={t("self_build.stop_all_hint")}
+ onClick={() => setConfirm(true)}
+ className="inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-sm text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ <OctagonX className="h-4 w-4" aria-hidden />
+ {t("self_build.stop_all")}
+ </button>
+ {confirm && (
+ <ConfirmStop
+ busy={busy}
+ onCancel={() => setConfirm(false)}
+ onConfirm={() => {
+ onStop();
+ setConfirm(false);
+ }}
+ />
+ )}
+ </footer>
);
}
diff --git a/dodaios/ui/web/frontend/src/views/selfBuild/Hero.tsx b/dodaios/ui/web/frontend/src/views/selfBuild/Hero.tsx
new file mode 100644
index 0000000000..47f9050701
--- /dev/null
+++ b/dodaios/ui/web/frontend/src/views/selfBuild/Hero.tsx
@@ -0,0 +1,211 @@
+/**
+ * The top of "Built for you": one sentence that says what this page is and
+ * whether it is working, a ring that shows it at a glance (the quiet start's
+ * days, the helpers running, or paused), and how far the assistant may go per
+ * kind of helper, in plain words.
+ */
+import type { ReactNode } from "react";
+import { Loader2, OctagonX, Pause, Power } from "lucide-react";
+import { fill, useT } from "@/i18n";
+import { cn } from "@/lib/utils";
+import { BUILD_KINDS, DAY_MS, type Autonomy, type SelfBuildStatus } from "@/lib/selfBuildApi";
+import { KindIcon } from "./shared";
+
+export type HeroTone = "silent" | "running" | "paused" | "off" | "stopped";
+
+export function heroTone(status: SelfBuildStatus | undefined, stopped: boolean): HeroTone | null {
+ if (stopped) return "stopped";
+ if (!status) return null;
+ if (!status.enabled) return "off";
+ if (status.paused) return "paused";
+ return status.silent ? "silent" : "running";
+}
+
+/** Day `n` of the quiet start, counted from 1, never past its last day. */
+export function quietDay(sinceMs: number, days: number, now = Date.now()): number {
+ if (!sinceMs || days <= 0) return 0;
+ return Math.min(days, Math.max(1, Math.floor((now - sinceMs) / DAY_MS) + 1));
+}
+
+export function Hero({
+ tone,
+ status,
+ quiet,
+ waiting,
+ live,
+ locale,
+ action,
+}: {
+ tone: HeroTone;
+ status: SelfBuildStatus | undefined;
+ quiet: { days: number; since_ms: number; until_ms: number } | undefined;
+ waiting: number;
+ live: number;
+ locale: string;
+ action?: { label: string; onClick: () => void; busy?: boolean; testId: string; icon?: ReactNode };
+}) {
+ const t = useT();
+ const day = quiet ? quietDay(quiet.since_ms, quiet.days) : 0;
+ const until =
+ quiet && quiet.until_ms
+ ? new Date(quiet.until_ms).toLocaleDateString(locale, { weekday: "long", day: "numeric", month: "long" })
+ : "";
+
+ let headline: string;
+ let body: string;
+ if (tone === "silent") {
+ headline = t("self_build.hero.silent_title");
+ body = fill(t(until ? "self_build.hero.silent_body" : "self_build.hero.silent_body_nodate"), {
+ days: quiet?.days ?? 7,
+ date: until,
+ });
+ } else if (tone === "running") {
+ headline =
+ waiting > 0
+ ? fill(t(waiting === 1 ? "self_build.hero.ideas_title_one" : "self_build.hero.ideas_title_other"), { count: waiting })
+ : t("self_build.hero.running_title");
+ body = t(waiting > 0 ? "self_build.hero.ideas_body" : "self_build.hero.running_body");
+ } else {
+ headline = t(`self_build.hero.${tone}_title`);
+ body = t(`self_build.hero.${tone}_body`);
+ }
+
+ return (
+ <section
+ data-testid="self-build-hero"
+ data-tone={tone}
+ aria-labelledby="self-build-hero-title"
+ className="mt-6 overflow-hidden rounded-2xl border border-border bg-card"
+ >
+ <div className="flex flex-col gap-6 px-6 py-7 sm:flex-row sm:items-center sm:gap-8 sm:px-8 sm:py-8">
+ <Ring tone={tone} day={day} days={quiet?.days ?? 0} live={live} />
+ <div className="min-w-0 flex-1">
+ <h2
+ id="self-build-hero-title"
+ className="font-display text-2xl font-semibold leading-[34px] tracking-[-0.02em] text-foreground-strong"
+ >
+ {headline}
+ </h2>
+ <p className="mt-2 max-w-[60ch] text-lg leading-relaxed text-muted-foreground">{body}</p>
+ {action && (
+ <button
+ type="button"
+ data-testid={action.testId}
+ onClick={action.onClick}
+ disabled={action.busy}
+ className="mt-5 inline-flex h-9 items-center gap-2 rounded-md bg-primary px-4 text-base font-medium text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60"
+ >
+ {action.busy ? <Loader2 className="h-4 w-4 animate-spin" aria-hidden /> : action.icon}
+ {action.label}
+ </button>
+ )}
+ </div>
+ </div>
+ {status && tone !== "off" && <Reach status={status} />}
+ </section>
+ );
+}
+
+const RING_R = 44;
+const RING_C = 2 * Math.PI * RING_R;
+
+/**
+ * The ring: the quiet start fills day by day; while watching it is whole and
+ * holds the number of helpers running; paused, off and stopped are grey with
+ * their glyph.
+ */
+function Ring({ tone, day, days, live }: { tone: HeroTone; day: number; days: number; live: number }) {
+ const t = useT();
+ const share = tone === "silent" ? (days > 0 ? day / days : 0) : tone === "running" ? 1 : 0;
+ const label =
+ tone === "silent"
+ ? fill(t("self_build.hero.ring_day"), { day, days })
+ : tone === "running"
+ ? fill(t(live === 1 ? "self_build.hero.ring_live_one" : "self_build.hero.ring_live_other"), { count: live })
+ : t(`self_build.status.${tone}`);
+ return (
+ <div
+ className="relative h-[112px] w-[112px] shrink-0"
+ role="img"
+ aria-label={label}
+ data-testid="self-build-ring"
+ >
+ <svg viewBox="0 0 112 112" className="h-full w-full -rotate-90" aria-hidden>
+ <circle cx="56" cy="56" r={RING_R} fill="none" strokeWidth="7" className="stroke-secondary" />
+ <circle
+ cx="56"
+ cy="56"
+ r={RING_R}
+ fill="none"
+ strokeWidth="7"
+ strokeLinecap="round"
+ strokeDasharray={RING_C}
+ strokeDashoffset={RING_C * (1 - share)}
+ className={cn(
+ "transition-[stroke-dashoffset] duration-700 ease-out",
+ tone === "running" ? "stroke-success" : "stroke-accent",
+ )}
+ />
+ </svg>
+ <div className="absolute inset-0 flex flex-col items-center justify-center text-center" aria-hidden>
+ {tone === "silent" ? (
+ <>
+ <span className="font-display text-[30px] font-semibold leading-none tabular-nums text-foreground-strong">{day}</span>
+ <span className="mt-1 text-xs text-muted-foreground">{fill(t("self_build.hero.ring_of_days"), { days })}</span>
+ </>
+ ) : tone === "running" ? (
+ live > 0 ? (
+ <>
+ <span className="font-display text-[30px] font-semibold leading-none tabular-nums text-foreground-strong">{live}</span>
+ <span className="mt-1 text-xs text-muted-foreground">{t(live === 1 ? "self_build.hero.ring_helper_one" : "self_build.hero.ring_helper_other")}</span>
+ </>
+ ) : (
+ <span className="relative flex h-3 w-3">
+ <span className="absolute inline-flex h-full w-full rounded-full bg-success opacity-60 motion-safe:animate-ping" />
+ <span className="relative inline-flex h-3 w-3 rounded-full bg-success" />
+ </span>
+ )
+ ) : tone === "paused" ? (
+ <Pause className="h-7 w-7 text-muted-foreground" strokeWidth={1.6} />
+ ) : tone === "stopped" ? (
+ <OctagonX className="h-7 w-7 text-destructive" strokeWidth={1.6} />
+ ) : (
+ <Power className="h-7 w-7 text-muted-foreground" strokeWidth={1.6} />
+ )}
+ </div>
+ </div>
+ );
+}
+
+const LEVEL_TONE: Record<Autonomy, string> = {
+ off: "text-foreground-faint",
+ suggest: "text-foreground",
+ trial: "text-foreground",
+ full: "text-foreground",
+};
+
+/** How far it may go, per kind of helper, in the words a person uses. */
+function Reach({ status }: { status: SelfBuildStatus }) {
+ const t = useT();
+ return (
+ <div className="border-t border-border px-6 py-4 sm:px-8" data-testid="self-build-reach">
+ <p className="mb-3 text-sm font-medium text-muted-foreground">{t("self_build.reach.title")}</p>
+ <ul className="grid grid-cols-2 gap-x-6 gap-y-3 sm:grid-cols-3 lg:grid-cols-5">
+ {BUILD_KINDS.map((kind) => {
+ const level = status.autonomy[kind] ?? "suggest";
+ return (
+ <li key={kind} className="flex min-w-0 items-start gap-2.5" data-kind={kind} data-level={level}>
+ <span className="mt-0.5 text-muted-foreground">
+ <KindIcon kind={kind} />
+ </span>
+ <span className="min-w-0">
+ <span className="block truncate text-sm text-muted-foreground">{t(`self_build.kinds.${kind}`)}</span>
+ <span className={cn("block text-base leading-snug", LEVEL_TONE[level])}>{t(`self_build.reach.${level}`)}</span>
+ </span>
+ </li>
+ );
+ })}
+ </ul>
+ </div>
+ );
+}
diff --git a/dodaios/ui/web/frontend/src/views/selfBuild/Noticed.tsx b/dodaios/ui/web/frontend/src/views/selfBuild/Noticed.tsx
new file mode 100644
index 0000000000..be972793d8
--- /dev/null
+++ b/dodaios/ui/web/frontend/src/views/selfBuild/Noticed.tsx
@@ -0,0 +1,249 @@
+/**
+ * "Noticed so far": the requests the person repeats, each with how often and
+ * on how many days, and how far it is from becoming a suggestion. It is the
+ * proof that the page is working before anything is built. Only the person's
+ * own requests count (dodaios/self_build/miner.py); the labels are their own
+ * latest wording, cut short by the route.
+ *
+ * Also "How it works": three steps, shown big while nothing is built yet and
+ * small once there is.
+ */
+import { Hand, MessageSquareText, Sparkles } from "lucide-react";
+import { fill, useT } from "@/i18n";
+import { cn } from "@/lib/utils";
+import type { Noticed as NoticedData, NoticedNeed } from "@/lib/selfBuildApi";
+import { relativeTime } from "./shared";
+
+export function NoticedSection({
+ data,
+ locale,
+ paused = false,
+ onOpenBuild,
+}: {
+ data: NoticedData | undefined;
+ locale: string;
+ /** Building is paused: a ready need waits for the resume, not for a look. */
+ paused?: boolean;
+ onOpenBuild: (id: string) => void;
+}) {
+ const t = useT();
+ if (!data) return null;
+ const { needs, once, more, threshold } = data;
+ return (
+ <section data-testid="self-build-noticed" aria-labelledby="noticed-title" className="mt-12">
+ <SectionHead id="noticed-title" title={t("self_build.noticed.title")} hint={t("self_build.noticed.hint")} />
+ {needs.length === 0 ? (
+ <div className="rounded-xl border border-dashed border-border px-6 py-8 text-center" data-testid="noticed-empty">
+ <p className="text-base text-foreground">{t("self_build.noticed.empty")}</p>
+ <p className="mt-1 text-sm text-muted-foreground">
+ {once > 0
+ ? fill(t(once === 1 ? "self_build.noticed.once_one" : "self_build.noticed.once_other"), { count: once })
+ : t("self_build.noticed.empty_hint")}
+ </p>
+ </div>
+ ) : (
+ <>
+ <ul className="overflow-hidden rounded-xl border border-border bg-card">
+ {needs.map((need, index) => (
+ <NeedRow
+ key={need.id}
+ need={need}
+ days={threshold.days}
+ times={threshold.times}
+ locale={locale}
+ paused={paused}
+ first={index === 0}
+ onOpenBuild={onOpenBuild}
+ />
+ ))}
+ </ul>
+ {(once > 0 || more > 0) && (
+ <p className="mt-3 text-sm text-muted-foreground">
+ {[
+ more > 0 ? fill(t("self_build.noticed.more"), { count: more }) : "",
+ once > 0
+ ? fill(t(once === 1 ? "self_build.noticed.once_one" : "self_build.noticed.once_other"), { count: once })
+ : "",
+ ]
+ .filter(Boolean)
+ .join(" · ")}
+ </p>
+ )}
+ </>
+ )}
+ </section>
+ );
+}
+
+function NeedRow({
+ need,
+ days,
+ times,
+ locale,
+ paused,
+ first,
+ onOpenBuild,
+}: {
+ need: NoticedNeed;
+ days: number;
+ times: number;
+ locale: string;
+ paused: boolean;
+ first: boolean;
+ onOpenBuild: (id: string) => void;
+}) {
+ const t = useT();
+ const reached = Math.min(need.days, days);
+ const meta = [
+ fill(t("self_build.noticed.times"), { count: need.times }),
+ fill(t(need.days === 1 ? "self_build.noticed.days_one" : "self_build.noticed.days_other"), { count: need.days }),
+ relativeTime(need.last_ms, locale),
+ ].join(" · ");
+ const { text, tone } = stageText(need, days, times, paused, t);
+ const stage =
+ need.stage === "proposed" && need.build_id ? (
+ <button
+ type="button"
+ onClick={() => onOpenBuild(need.build_id)}
+ className="rounded-sm text-sm font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ {text}
+ </button>
+ ) : (
+ <span className={cn("text-sm", tone)}>{text}</span>
+ );
+ return (
+ <li
+ data-testid="noticed-need"
+ data-stage={need.stage}
+ className={cn("flex flex-wrap items-center gap-x-6 gap-y-2 px-5 py-4", !first && "border-t border-border")}
+ >
+ <div className="min-w-0 flex-1 basis-[280px]">
+ <p className="truncate text-base text-foreground-strong" title={need.label}>
+ {t("self_build.noticed.quote_open")}
+ {need.label}
+ {t("self_build.noticed.quote_close")}
+ </p>
+ <p className="mt-0.5 text-sm text-muted-foreground">{meta}</p>
+ </div>
+ <div className="flex shrink-0 items-center gap-4">
+ <span
+ className="flex items-center gap-1.5"
+ role="img"
+ aria-label={fill(t("self_build.noticed.progress"), { count: reached, total: days })}
+ >
+ {Array.from({ length: days }, (_, i) => (
+ <span
+ key={i}
+ aria-hidden
+ className={cn(
+ "h-2 w-2 rounded-full",
+ i >= reached
+ ? "bg-surface-raised"
+ : need.stage === "counting"
+ ? "bg-foreground-strong"
+ : need.stage === "ready" || need.stage === "proposed"
+ ? "bg-accent"
+ : "bg-foreground-faint",
+ )}
+ />
+ ))}
+ </span>
+ <span className="w-[240px] text-right">{stage}</span>
+ </div>
+ </li>
+ );
+}
+
+function stageText(
+ need: NoticedNeed,
+ days: number,
+ times: number,
+ paused: boolean,
+ t: (key: string) => string,
+): { text: string; tone: string } {
+ switch (need.stage) {
+ case "counting": {
+ const moreDays = Math.max(0, days - need.days);
+ if (moreDays > 0) {
+ return {
+ text: fill(t(moreDays === 1 ? "self_build.noticed.more_days_one" : "self_build.noticed.more_days_other"), { count: moreDays }),
+ tone: "text-muted-foreground",
+ };
+ }
+ const moreTimes = Math.max(1, times - need.times);
+ return {
+ text: fill(t(moreTimes === 1 ? "self_build.noticed.more_times_one" : "self_build.noticed.more_times_other"), { count: moreTimes }),
+ tone: "text-muted-foreground",
+ };
+ }
+ case "ready":
+ return paused
+ ? { text: t("self_build.noticed.stage.ready_paused"), tone: "text-muted-foreground" }
+ : { text: t("self_build.noticed.stage.ready"), tone: "text-accent" };
+ case "proposed":
+ return { text: t("self_build.noticed.stage.proposed"), tone: "text-accent" };
+ default:
+ return { text: t(`self_build.noticed.stage.${need.stage}`), tone: "text-muted-foreground" };
+ }
+}
+
+export function SectionHead({ id, title, hint, count }: { id: string; title: string; hint?: string; count?: number }) {
+ return (
+ <div className="mb-3 flex flex-wrap items-baseline gap-x-3 gap-y-0.5">
+ <h2 id={id} className="text-lg font-semibold text-foreground-strong">
+ {title}
+ {count !== undefined && <span className="ml-2 font-normal tabular-nums text-muted-foreground">{count}</span>}
+ </h2>
+ {hint && <p className="text-sm text-muted-foreground">{hint}</p>}
+ </div>
+ );
+}
+
+// ------------------------------------------------------------------ how it works
+
+const STEPS = [
+ { key: "notice", Icon: MessageSquareText },
+ { key: "suggest", Icon: Sparkles },
+ { key: "try", Icon: Hand },
+] as const;
+
+export function HowItWorks({ compact = false }: { compact?: boolean }) {
+ const t = useT();
+ return (
+ <section
+ data-testid="self-build-how"
+ data-compact={compact || undefined}
+ aria-labelledby="how-title"
+ className={compact ? "mt-14" : "mt-10"}
+ >
+ <h2 id="how-title" className={cn(compact ? "mb-3 text-sm font-medium text-muted-foreground" : "sr-only")}>
+ {t("self_build.how.title")}
+ </h2>
+ <ol className="grid grid-cols-1 gap-4 sm:grid-cols-3">
+ {STEPS.map(({ key, Icon }, index) => (
+ <li key={key} className={cn("min-w-0", !compact && "rounded-xl border border-border px-5 py-5")}>
+ <div className="flex items-center gap-3">
+ <span
+ aria-hidden
+ className={cn(
+ "inline-flex shrink-0 items-center justify-center rounded-lg bg-secondary text-foreground",
+ compact ? "h-7 w-7" : "h-9 w-9",
+ )}
+ >
+ <Icon className={compact ? "h-3.5 w-3.5" : "h-[18px] w-[18px]"} strokeWidth={1.6} />
+ </span>
+ <p className={cn("font-medium text-foreground-strong", compact ? "text-base" : "text-lg")}>
+ <span className="mr-1.5 tabular-nums text-muted-foreground">{index + 1}</span>
+ {t(`self_build.how.${key}_title`)}
+ </p>
+ </div>
+ <p className={cn("text-muted-foreground", compact ? "mt-1.5 text-sm" : "mt-3 text-base leading-relaxed")}>
+ {t(`self_build.how.${key}_body`)}
+ </p>
+ </li>
+ ))}
+ </ol>
+ </section>
+ );
+}
diff --git a/dodaios/ui/web/self_build_routes.py b/dodaios/ui/web/self_build_routes.py
index 28ebace4ee..6269c9a249 100644
--- a/dodaios/ui/web/self_build_routes.py
+++ b/dodaios/ui/web/self_build_routes.py
@@ -10,6 +10,7 @@ Endpoints (all under ``/api/self-build``)::
POST /{build_id}/keep Keep a build on trial (or restore an archived one)
POST /{build_id}/undo Remove what the build created, or reject the proposal
GET /provenance Which agents, skills and routines a build created (the badge)
+ GET /noticed What the loop is counting so far, and when the quiet start ends
GET /settings ``[self_build]`` with each number's range
PUT /settings Change ``[self_build]``; written to jarvis.toml, applied at once
@@ -107,6 +108,133 @@ async def provenance(request: Request, type: str = "") -> dict[str, Any]: # noq
return {"items": await asyncio.to_thread(service.provenance, type or None)}
+# ------------------------------------------------------------------ noticed
+
+#: Needs shown on the page; the rest are only counted.
+_NOTICED_LIMIT = 8
+#: A label is the person's latest wording of the request, cut to this length.
+_LABEL_CHARS = 90
+_MENTION = re.compile(r"^(?:@\S+\s+)+")
+
+
+def _signals(request: Request) -> Any:
+ store = getattr(request.app.state, "self_build_signals", None)
+ if store is not None:
+ return store
+ from dodaios.self_build import loop as loop_module
+
+ running = loop_module.current()
+ return running.store if running is not None else None
+
+
+def _label(text: str) -> str:
+ words = _MENTION.sub("", " ".join(text.split())).strip()
+ if len(words) <= _LABEL_CHARS:
+ return words
+ return words[: _LABEL_CHARS - 1].rstrip() + "…"
+
+
+def _quiet_start(service: SelfBuild) -> dict[str, int]:
+ """When the quiet first days end (``until_ms`` 0 when there are none)."""
+ from dodaios.self_build import policy
+
+ cfg = policy.section(service.config())
+ days = int(getattr(cfg, "silent_days", 0) or 0) if cfg is not None else 0
+ first = policy.first_seen_ms(service.ledger)
+ until = first + days * 86_400_000 if days > 0 else 0
+ return {"days": days, "since_ms": first, "until_ms": until}
+
+
+def noticed_payload(service: SelfBuild, store: Any, *, now: int | None = None) -> dict[str, Any]:
+ """What the loop is counting, as the page shows it. Blocking (SQLite).
+
+ One entry per request the person made more than once in the miner's
+ window: a short label (their own latest wording), how often and on how
+ many days, and where it stands against the repeat threshold. Requests
+ made once are only counted. Needs that already became a live or kept
+ build are left out: the page shows the build instead.
+ """
+ from dodaios.self_build.ledger import now_ms
+ from dodaios.self_build.miner import (
+ PANE,
+ REPEAT_DAYS,
+ REPEAT_TIMES,
+ TOOL_SHARE,
+ WINDOW_DAYS,
+ consistent_tools,
+ )
+ from dodaios.self_build.records import State
+
+ stamp = now if now is not None else now_ms()
+ quiet = _quiet_start(service)
+ out: dict[str, Any] = {
+ "needs": [],
+ "once": 0,
+ "more": 0,
+ "threshold": {"times": REPEAT_TIMES, "days": REPEAT_DAYS, "window_days": WINDOW_DAYS},
+ "quiet_start": quiet,
+ }
+ if store is None:
+ return out
+ since = stamp - WINDOW_DAYS * 86_400_000
+ needs: list[dict[str, Any]] = []
+ once = 0
+ for cluster in store.clusters_since(since):
+ turns = store.turns_of(cluster.id, since_ms=since)
+ if len(turns) < 2:
+ once += len(turns)
+ continue
+ builds = service.ledger.ever_for(cluster.signature)
+ latest = builds[-1] if builds else None
+ if latest is not None and latest.state in (
+ State.BUILDING,
+ State.PROVING,
+ State.TRIAL,
+ State.KEPT,
+ ):
+ continue
+ days = len({t.day for t in turns})
+ delegated = sum(1 for t in turns if t.channel == PANE)
+ needs_tool = not consistent_tools(turns) and delegated < len(turns) * TOOL_SHARE
+ decision = store.decision(cluster.signature)
+ if latest is not None and latest.state == State.PROPOSED:
+ stage = "proposed"
+ elif latest is not None and latest.state in (State.REJECTED, State.UNDONE):
+ stage = "declined"
+ elif decision is not None and decision[1] == "served":
+ stage = "served"
+ elif decision is not None and decision[1] == "nothing":
+ stage = "nothing"
+ elif len(turns) >= REPEAT_TIMES and days >= REPEAT_DAYS:
+ stage = "direct" if needs_tool else "ready"
+ else:
+ stage = "counting"
+ needs.append(
+ {
+ "id": cluster.id,
+ "label": _label(turns[-1].text),
+ "times": len(turns),
+ "days": days,
+ "first_ms": turns[0].ts_ms,
+ "last_ms": turns[-1].ts_ms,
+ "stage": stage,
+ "build_id": latest.id if latest is not None and stage == "proposed" else "",
+ }
+ )
+ needs.sort(key=lambda n: (-min(n["days"], REPEAT_DAYS), -n["times"], -n["last_ms"]))
+ out["needs"] = needs[:_NOTICED_LIMIT]
+ out["once"] = once
+ out["more"] = max(0, len(needs) - _NOTICED_LIMIT)
+ return out
+
+
[email protected]("/noticed")
+async def noticed(request: Request) -> dict[str, Any]:
+ """What the loop has noticed so far (read-only): the "Noticed so far" list."""
+ service = _service(request)
+ return await asyncio.to_thread(noticed_payload, service, _signals(request))
+
+
# ------------------------------------------------------------------ settings
_LEVELS = ("off", "suggest", "trial", "full")
diff --git a/tests/unit/self_build/test_self_build_noticed_route.py b/tests/unit/self_build/test_self_build_noticed_route.py
new file mode 100644
index 0000000000..ef2620906d
--- /dev/null
+++ b/tests/unit/self_build/test_self_build_noticed_route.py
@@ -0,0 +1,79 @@
+"""``GET /api/self-build/noticed``: what the loop counts so far, for the page."""
+
+from __future__ import annotations
+
+from pathlib import Path
+from types import SimpleNamespace
+
+from fastapi import FastAPI
+from fastapi.testclient import TestClient
+
+from dodaios.core.config import SelfBuildConfig
+from dodaios.self_build import Kind, SelfBuild
+from dodaios.self_build.miner import Miner, Observation
+from dodaios.self_build.signals import SignalStore
+
+DAY = 86_400_000
+
+
+def _client(tmp_path: Path, store: SignalStore | None) -> tuple[TestClient, SelfBuild]:
+ from dodaios.ui.web.self_build_routes import router
+
+ cfg = SimpleNamespace(self_build=SelfBuildConfig(silent_days=7))
+ svc = SelfBuild(tmp_path, lambda: cfg)
+ app = FastAPI()
+ app.state.self_build = svc
+ app.state.config = cfg
+ app.state.self_build_signals = store
+ app.include_router(router)
+ return TestClient(app), svc
+
+
+def _ask(miner: Miner, text: str, ts: int, tools: tuple[str, ...] = ()) -> None:
+ obs = Observation(text=text, channel="chat", conversation=f"c{ts}", ts_ms=ts, tools=tools)
+ miner.observe(obs)
+
+
+def test_noticed_lists_repeats_with_progress_and_counts_one_offs(tmp_path: Path) -> None:
+ import time
+
+ now = int(time.time() * 1000)
+ store = SignalStore(tmp_path / "signals.db")
+ miner = Miner(store)
+ mail = "@gmail did I get any important emails today"
+ for day in (3, 2, 1):
+ _ask(miner, mail, now - day * DAY, tools=("mcp:gmail/search",))
+ _ask(miner, "what is on my calendar tomorrow morning", now - 2 * DAY)
+ _ask(miner, "what is on my calendar tomorrow morning", now - DAY)
+ _ask(miner, "translate this sentence into french please", now - DAY)
+
+ client, svc = _client(tmp_path, store)
+ body = client.get("/api/self-build/noticed").json()
+
+ assert body["threshold"] == {"times": 3, "days": 3, "window_days": 28}
+ assert body["quiet_start"]["days"] == 7
+ assert body["quiet_start"]["until_ms"] - body["quiet_start"]["since_ms"] == 7 * DAY
+ assert body["once"] == 1
+ labels = [n["label"] for n in body["needs"]]
+ assert labels == [
+ "did I get any important emails today",
+ "what is on my calendar tomorrow morning",
+ ]
+ first, second = body["needs"]
+ assert (first["times"], first["days"], first["stage"]) == (3, 3, "ready")
+ assert (second["times"], second["days"], second["stage"]) == (2, 2, "counting")
+
+ # A need that became a proposal points at it; a live build drops off the list.
+ sig = store.cluster(first["id"]).signature
+ record = svc.ledger.open_case(Kind.SKILL, sig, "Check important mail")
+ proposed = client.get("/api/self-build/noticed").json()["needs"][0]
+ assert (proposed["stage"], proposed["build_id"]) == ("proposed", record.id)
+ store.close()
+ svc.ledger.close()
+
+
+def test_noticed_is_empty_without_the_signal_store(tmp_path: Path) -> None:
+ client, svc = _client(tmp_path, None)
+ body = client.get("/api/self-build/noticed").json()
+ assert body["needs"] == [] and body["once"] == 0
+ svc.ledger.close()