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(ui): put the assistant's files up front as pages with their content

rubenluetke10-beep528c9ac61381
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index f4b7cc4cd7..6a01a5620a 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -229,6 +229,12 @@
"file_notes_other": "{0} Notizen",
"file_chars_one": "{0} Zeichen",
"file_chars_other": "{0} Zeichen",
+ "file_empty_soul": "Leer. Schreib, wer {name} ist.",
+ "file_empty_instructions": "Noch keine Anweisungen. Schreib, wie {name} mit dir arbeiten soll.",
+ "file_empty_memory": "Noch nichts gemerkt.",
+ "file_empty_user": "Noch nichts über dich bemerkt.",
+ "file_open_edit": "Öffnen und bearbeiten",
+ "file_open_read": "Öffnen",
"editor_label": "{0} (Markdown)",
"soul_placeholder": "Beschreibe, wer {name} ist: Rolle, Stimmung, Ton, Grenzen …",
"instructions_placeholder": "Schreib, wie {name} mit dir arbeiten soll …",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 4b88953179..9125056315 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -229,6 +229,12 @@
"file_notes_other": "{0} notes",
"file_chars_one": "{0} character",
"file_chars_other": "{0} characters",
+ "file_empty_soul": "Empty. Write who {name} is.",
+ "file_empty_instructions": "No instructions yet. Write how {name} should work with you.",
+ "file_empty_memory": "Nothing remembered yet.",
+ "file_empty_user": "Nothing noticed about you yet.",
+ "file_open_edit": "Open and edit",
+ "file_open_read": "Open",
"editor_label": "{0} (Markdown)",
"soul_placeholder": "Describe who {name} is: role, vibe, tone, limits…",
"instructions_placeholder": "Write how {name} should work with you…",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 66f0a9b5ec..6487a764fb 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -229,6 +229,12 @@
"file_notes_other": "{0} notas",
"file_chars_one": "{0} carácter",
"file_chars_other": "{0} caracteres",
+ "file_empty_soul": "Vacío. Escribe quién es {name}.",
+ "file_empty_instructions": "Aún no hay instrucciones. Escribe cómo debe trabajar {name} contigo.",
+ "file_empty_memory": "Aún no ha recordado nada.",
+ "file_empty_user": "Aún no ha notado nada sobre ti.",
+ "file_open_edit": "Abrir y editar",
+ "file_open_read": "Abrir",
"editor_label": "{0} (Markdown)",
"soul_placeholder": "Describe quién es {name}: rol, estilo, tono, límites…",
"instructions_placeholder": "Escribe cómo debe trabajar {name} contigo…",
diff --git a/jarvis/ui/web/frontend/src/views/AssistantProfileView.test.tsx b/jarvis/ui/web/frontend/src/views/AssistantProfileView.test.tsx
index 6d1a4400af..c04d5eafa4 100644
--- a/jarvis/ui/web/frontend/src/views/AssistantProfileView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/AssistantProfileView.test.tsx
@@ -151,11 +151,17 @@ describe("AssistantProfileView", () => {
expect(within(recent).getByText("You said: “merk dir das”")).toBeTruthy();
});
- it("counts files in the right number", async () => {
+ it("shows each file with its own first lines and the right count", async () => {
installFetch({ "GET /api/soul": () => ({ body: profile() }) });
renderWithClient(<AssistantProfileView />);
- expect(within(await screen.findByTestId("assistant-file-memory")).getByText(/^1 note ·/)).toBeTruthy();
+ const soul = await screen.findByTestId("assistant-file-soul");
+ expect(within(soul).getByText("Name: Nova")).toBeTruthy();
+ expect(within(soul).queryByText(/My own persona/)).toBeNull();
+ expect(within(screen.getByTestId("assistant-file-instructions")).getByText("Call me Ruben, please.")).toBeTruthy();
+ const memory = screen.getByTestId("assistant-file-memory");
+ expect(within(memory).getByText(/^1 note ·/)).toBeTruthy();
+ expect(within(memory).getByText("The sister is called Lena.")).toBeTruthy();
expect(within(screen.getByTestId("assistant-file-user")).getByText("Not created yet")).toBeTruthy();
});
diff --git a/jarvis/ui/web/frontend/src/views/AssistantProfileView.tsx b/jarvis/ui/web/frontend/src/views/AssistantProfileView.tsx
index da02e96bd7..a774e3460f 100644
--- a/jarvis/ui/web/frontend/src/views/AssistantProfileView.tsx
+++ b/jarvis/ui/web/frontend/src/views/AssistantProfileView.tsx
@@ -14,14 +14,15 @@
* [pet] Helpful but not obsequious. Direct, … (the vibe, as the lead)
* ● Learning · 1 thing remembered · changed today
* ────────────────────────────────────────────────────────────
+ * Files four pages with their own first lines: SOUL.md,
+ * George.md, MEMORY.md, USER.md — open in place
+ * ────────────────────────────────────────────────────────────
* Character Edit
* Role … / Tone … / Limits …
* ────────────────────────────────────────────────────────────
* Memory [Remembered · About you · About itself]
* ────────────────────────────────────────────────────────────
* Recently learned — the ledger, with the person's words
- * ────────────────────────────────────────────────────────────
- * Files SOUL.md · George.md · MEMORY.md · USER.md →
*
* A file opens in place with a way back, like USER.md on the Profile page.
*/
@@ -106,10 +107,10 @@ export function AssistantProfileView() {
{data && !openFile && (
<div className="flex flex-col gap-10">
<Intro profile={data} />
+ <FilesSection files={data.files} onOpen={setOpen} />
<CharacterSection soul={fileOf(data, "soul")} onEdit={() => setOpen("soul")} />
<MemorySection profile={data} />
<RecentSection activity={data.activity} />
- <FilesSection files={data.files} onOpen={setOpen} />
</div>
)}
</div>
diff --git a/jarvis/ui/web/frontend/src/views/assistant/FilesSection.tsx b/jarvis/ui/web/frontend/src/views/assistant/FilesSection.tsx
index c035df2ddd..2d467eef56 100644
--- a/jarvis/ui/web/frontend/src/views/assistant/FilesSection.tsx
+++ b/jarvis/ui/web/frontend/src/views/assistant/FilesSection.tsx
@@ -1,13 +1,18 @@
/**
- * Files — what the assistant reads at the start of every conversation, as a
- * plain index: the file's name, what it is, how full it is and when it last
- * changed. A row opens the file in place.
+ * Files — what the assistant reads at the start of every conversation, right
+ * under the intro because they ARE the assistant: change a file and the
+ * assistant changes.
+ *
+ * Each file is shown as a page with its own first lines on it — the real
+ * content, not a description of it — so the person sees at a glance what
+ * the assistant is told about itself, what they told it, what it remembers
+ * and what it noticed. A page opens the file in place.
*/
-import { ChevronRight } from "lucide-react";
-
import { useT, useUiLanguage } from "@/i18n";
+import { cn } from "@/lib/utils";
import type { SoulFile, SoulFileId } from "@/views/assistant/api";
import { plural, relativeDay } from "@/views/assistant/format";
+import { splitDated } from "@/views/assistant/MemorySection";
import { Section } from "@/views/assistant/Section";
/** "1 note · today", or why there is nothing to show. */
@@ -25,6 +30,91 @@ export function useFileMeta(): (file: SoulFile) => string {
};
}
+/** Inline Markdown made readable: emphasis markers and comments dropped. */
+function clean(line: string): string {
+ return line
+ .replace(/<!--.*?-->/g, "")
+ .replace(/\*\*(.+?)\*\*/g, "$1")
+ .replace(/(^|\s)_([^_]+)_(?=[\s.,;:!?]|$)/g, "$1$2")
+ .replace(/^_|_$/g, "")
+ .trim();
+}
+
+/**
+ * The first readable items of a file: a notebook's newest notes, or a text
+ * file's paragraphs and list items with headings and comments left out
+ * (a wrapped paragraph becomes one item, not three fragments).
+ */
+export function previewLines(file: SoulFile, max = 4): string[] {
+ if ("entries" in file) {
+ return file.entries.slice(0, max).map((e) => splitDated(e.text).body.replace(/\s+/g, " ").trim());
+ }
+ const out: string[] = [];
+ let paragraph: string[] = [];
+ const flush = () => {
+ if (paragraph.length) out.push(paragraph.join(" "));
+ paragraph = [];
+ };
+ for (const raw of file.content.split("\n")) {
+ const trimmed = raw.trim();
+ if (!trimmed || trimmed.startsWith("#") || /^<!--.*-->$/.test(trimmed)) {
+ flush();
+ } else if (/^[-*]\s+/.test(trimmed)) {
+ flush();
+ const item = clean(trimmed.replace(/^[-*]\s+/, ""));
+ if (item) out.push(item);
+ } else {
+ const text = clean(trimmed);
+ if (text) paragraph.push(text);
+ }
+ if (out.length >= max) break;
+ }
+ flush();
+ return out.slice(0, max);
+}
+
+function FilePreview({ file, onOpen }: { file: SoulFile; onOpen: (id: SoulFileId) => void }) {
+ const t = useT();
+ const meta = useFileMeta();
+ const lines = file.exists ? previewLines(file, 3) : [];
+
+ return (
+ <button
+ type="button"
+ data-testid={`assistant-file-${file.id}`}
+ onClick={() => onOpen(file.id)}
+ className={cn(
+ "group flex h-[15.5rem] w-full flex-col rounded-xl border border-border bg-card p-5 text-left transition-colors",
+ "hover:border-border-strong focus-visible:border-accent focus-visible:outline-none",
+ )}
+ >
+ <div className="flex items-baseline justify-between gap-3">
+ <span className="truncate text-base font-semibold text-foreground-strong">{file.filename}</span>
+ <span className="shrink-0 text-sm tabular-nums text-foreground-faint">{meta(file)}</span>
+ </div>
+ <span className="mt-0.5 text-sm text-muted-foreground">{t(`assistant_view.file_role_${file.id}`)}</span>
+
+ <div className="mt-4 min-h-0 flex-1 overflow-hidden border-t border-border pt-3 [mask-image:linear-gradient(to_bottom,black_75%,transparent)]">
+ {lines.length > 0 ? (
+ <ul className="flex flex-col gap-1.5">
+ {lines.map((line, i) => (
+ <li key={i} className="line-clamp-2 text-sm leading-6 text-foreground/80">
+ {line}
+ </li>
+ ))}
+ </ul>
+ ) : (
+ <p className="text-sm leading-6 text-foreground-faint">{t(`assistant_view.file_empty_${file.id}`)}</p>
+ )}
+ </div>
+
+ <span className="mt-3 text-sm font-medium text-muted-foreground transition-colors group-hover:text-foreground">
+ {t(file.editable ? "assistant_view.file_open_edit" : "assistant_view.file_open_read")}
+ </span>
+ </button>
+ );
+}
+
export function FilesSection({
files,
onOpen,
@@ -33,32 +123,14 @@ export function FilesSection({
onOpen: (id: SoulFileId) => void;
}) {
const t = useT();
- const meta = useFileMeta();
return (
<Section testId="assistant-files" title={t("assistant_view.files_title")}>
- <p className="-mt-2 mb-3 text-base text-muted-foreground">{t("assistant_view.files_hint")}</p>
- <ul className="-mx-3">
+ <p className="-mt-2 mb-4 text-base text-muted-foreground">{t("assistant_view.files_hint")}</p>
+ <ul className="grid grid-cols-1 gap-3 sm:grid-cols-2">
{files.map((file) => (
<li key={file.id}>
- <button
- type="button"
- data-testid={`assistant-file-${file.id}`}
- onClick={() => onOpen(file.id)}
- className="group grid w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-x-6 rounded-lg px-3 py-3 text-left transition-colors hover:bg-secondary/60 focus-visible:bg-secondary/60 focus-visible:outline-none sm:grid-cols-[11rem_minmax(0,1fr)_auto]"
- >
- <span className="truncate text-base font-medium text-foreground-strong">{file.filename}</span>
- <span className="hidden truncate text-base text-muted-foreground sm:block">
- {t(`assistant_view.file_role_${file.id}`)}
- </span>
- <span className="flex items-center gap-3 text-sm tabular-nums text-foreground-faint">
- {meta(file)}
- <ChevronRight
- aria-hidden
- className="h-4 w-4 transition-transform group-hover:translate-x-0.5 group-hover:text-foreground"
- />
- </span>
- </button>
+ <FilePreview file={file} onOpen={onOpen} />
</li>
))}
</ul>