Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions apps/desktop/design/tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,27 @@ isn't a substitute: it lacks the small-size optical tracking and reads 1–2 px
| "Codex" (sidebar title, cap 13 px) | ≈52 | 18/600 | `--text-lg` |
| "What should we build in coven-threads?" | 481 | 28/400 = 480 | `--text-xl` |

## Radii
## Radius scale

Since 2026-11-15 the renderer has one radius scale, chosen for a tighter, uniform look rather than
measured from the reference. It applies to every button and component in the desktop renderer, the
Store edition and the web demo.

| Step | Value | Tokens | Used for |
|---|---|---|---|
| Surface | 8 px | `--radius-md`, `--radius-composer`, `--radius-sheet` | composer, menus, cards, dialogs, message bubbles, code blocks, the content sheet |
| Control | 6 px | `--radius-sm`, `--radius-row`, `--radius-pill` | buttons, icon buttons, rows, options, fields, chips and badges |
| Part | 4 px | `--radius-xs` | pieces inside a control: tabs, icon tiles, inline code, key hints |

Only status dots, progress dots and spinners are round (`50%`). No stylesheet writes a radius as a
number: `scripts/test/radius-scale.test.mjs` fails on a hard-coded radius above 2 px and pins how
many circles each stylesheet has, so a new one is a deliberate edit. `--radius-pill` keeps its name
for the chips that use it, though nothing is pill-shaped any more.

### Original measurements (superseded)

Measured along the top edge of a filled box: the number of pixels, row by row, before the fill starts.
The inset profile is then compared with a circle.
The inset profile is then compared with a circle. These were the values until 2026-11-15.

| Token | Value | Profile (inset px, rows from the top edge) |
|---|---|---|
Expand Down
6 changes: 3 additions & 3 deletions apps/desktop/e2e/approval-policy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test, expect, type ElectronApplication, type Page } from "@playwright/t
import fs from "node:fs";
import path from "node:path";
import { UpdateRecovery } from "../dist/src/main/engine/update-recovery.js";
import { currentRow, items, launch, seedHome, tid } from "./support";
import { answerConfirm, currentRow, items, launch, seedHome, tid } from "./support";

let app: ElectronApplication;
let page: Page;
Expand Down Expand Up @@ -38,12 +38,12 @@ test("Always allow in thread answers the waiting card, shows a chip that turns i
await tid(page, "access-picker").click();
await expect(tid(page, "approvals-option").first()).toHaveAttribute("data-policy", "ask");
await expect(tid(page, "approvals-option").first()).toHaveAttribute("aria-checked", "true");
await page.evaluate(() => { window.confirm = () => false; });
await page.locator('[data-testid="approvals-option"][data-policy="yolo"]').click();
await answerConfirm(page, "cancel", "Turn on YOLO for this thread?");
await expect(chip).toHaveCount(0);
await tid(page, "access-picker").click();
await page.evaluate(() => { window.confirm = () => true; });
await page.locator('[data-testid="approvals-option"][data-policy="yolo"]').click();
await answerConfirm(page, "accept", "Your Never rules still refuse.");
await expect(chip).toHaveAttribute("data-policy", "yolo");
const stored = await page.evaluate(() => window.modex!.invoke("state:get", undefined));
expect(stored.threads[0]!.approvals).toBe("yolo");
Expand Down
106 changes: 106 additions & 0 deletions apps/desktop/e2e/confirm-dialog.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import { test, expect, type ElectronApplication, type Page } from "@playwright/test";
import fs from "node:fs";
import { answerConfirm, launch, seedHome, tid } from "./support";

/**
* Confirmations are answered in the app (components/ConfirmDialog.tsx), never in the browser's own
* confirm box: Cancel has focus when one opens, Escape cancels, focus stays inside it, and nothing
* behind it reacts to the keyboard.
*/
let app: ElectronApplication;
let page: Page;
let home: string;
let repo: string;
let nativeDialogs = 0;

test.beforeAll(async () => {
({ home, repo } = seedHome());
({ app, page } = await launch(home));
page.on("dialog", (dialog) => { nativeDialogs++; void dialog.dismiss(); });
});

test.afterAll(async () => {
await app?.close();
fs.rmSync(home, { recursive: true, force: true });
fs.rmSync(repo, { recursive: true, force: true });
});

async function askToRemoveProject() {
const project = tid(page, "project").first();
await project.hover();
await tid(project, "project-menu").click();
await tid(project, "project-remove").click();
const dialog = tid(page, "confirm-dialog");
await expect(dialog).toBeVisible();
return dialog;
}

test("removing a project asks in the app, Cancel has focus, and cancelling changes nothing", async () => {
const dialog = await askToRemoveProject();
await expect(dialog).toHaveAttribute("role", "alertdialog");
await expect(dialog).toHaveAttribute("aria-modal", "true");
await expect(dialog).toHaveAttribute("data-tone", "warn");
await expect(tid(dialog, "confirm-title")).toHaveText("Remove this project from Modex?");
await expect(tid(dialog, "confirm-fact").first()).toHaveText("Files on disk are not touched.");
await expect(tid(dialog, "confirm-fact").first()).toHaveAttribute("data-kind", "kept");
await expect(tid(dialog, "confirm-accept")).toHaveText("Remove project");
// Enter must never accept by default: the safe button holds focus, and Tab stays inside the dialog.
await expect(tid(dialog, "confirm-cancel")).toBeFocused();
await page.keyboard.press("Tab");
await expect(tid(dialog, "confirm-accept")).toBeFocused();
await page.keyboard.press("Tab");
await expect(tid(dialog, "confirm-cancel")).toBeFocused();
await page.keyboard.press("Shift+Tab");
await expect(tid(dialog, "confirm-accept")).toBeFocused();
await page.keyboard.press("Escape");
await expect(dialog).toHaveCount(0);
await expect(tid(page, "project")).toHaveCount(1);
expect(nativeDialogs).toBe(0);
});

test("shortcuts do nothing behind an open confirm", async () => {
const dialog = await askToRemoveProject();
await page.keyboard.press("Meta+Shift+p");
await expect(tid(page, "plan-chip")).toHaveCount(0);
await tid(dialog, "confirm-cancel").click();
await expect(dialog).toHaveCount(0);
// The same shortcut works once the dialog is gone, so the assertion above is not vacuous.
await page.keyboard.press("Meta+Shift+p");
await expect(tid(page, "plan-chip")).toBeVisible();
await page.keyboard.press("Meta+Shift+p");
await expect(tid(page, "plan-chip")).toHaveCount(0);
});

test("a confirm over Settings: Escape cancels the confirm and Settings stays open", async () => {
const current = await page.evaluate(() => window.modex!.invoke("routing:status", undefined));
await app.evaluate(({ ipcMain }, status) => {
ipcMain.removeHandler("routing:status");
ipcMain.handle("routing:status", async () => ({ ...status, fit: { ...status.fit, routes: 1 } }));
}, current);
await tid(page, "open-settings").click();
const settings = tid(page, "settings");
await settings.getByRole("button", { name: "Reset learning…" }).click();
const dialog = tid(page, "confirm-dialog");
await expect(tid(dialog, "confirm-title")).toHaveText("Reset Auto routing's learned preferences?");
await expect(dialog).toHaveAttribute("data-tone", "danger");
await expect(tid(dialog, "confirm-cancel")).toBeFocused();
await page.keyboard.press("Tab");
await expect(tid(dialog, "confirm-accept")).toBeFocused();
await page.keyboard.press("Escape");
await expect(dialog).toHaveCount(0);
await expect(settings).toBeVisible();
await expect(settings.getByRole("button", { name: "Reset learning…" })).toBeVisible();
await settings.getByRole("button", { name: "Cancel" }).click();
await expect(settings).toHaveCount(0);
});

test("the backdrop cancels, and accepting runs the action once", async () => {
const dialog = await askToRemoveProject();
await tid(page, "confirm-backdrop").click({ position: { x: 8, y: 8 } });
await expect(dialog).toHaveCount(0);
await expect(tid(page, "project")).toHaveCount(1);
await askToRemoveProject();
await answerConfirm(page, "accept", "Remove this project from Modex?");
await expect(tid(page, "project")).toHaveCount(0);
expect(nativeDialogs).toBe(0);
});
16 changes: 8 additions & 8 deletions apps/desktop/e2e/layout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ test.describe("Design tokens", () => {
"--border-pane": "#2b3144", "--border-rail": "#32384d", "--border-composer": "#42465e", "--rule": "#2b3347",
"--text-1": "#f8f3fa", "--text-2": "#d0cad9", "--text-3": "#aaa5b8", "--text-4": "#918da2", "--text-placeholder": "#a49eb2",
"--accent": "#ef7bcd", "--accent-strong": "#f386a1", "--accent-ink": "#1b1020", "--accent-warn": "#dc9258", "--text-sm": "13px", "--text-md": "14px", "--text-lg": "18px", "--text-xl": "28px",
"--radius-row": "10px", "--radius-composer": "20px",
"--radius-row": "6px", "--radius-composer": "8px",
};

test("tokens resolve to the chosen values", async () => {
Expand Down Expand Up @@ -165,7 +165,7 @@ test.describe("Phase 3 · shell", () => {
expect([rail.x, rail.y, rail.width]).toEqual([0, 42, 48]);
const sheet = await box(tid(page, "sheet"));
expect([sheet.x, sheet.y]).toEqual([48, 42]);
expect(await css(tid(page, "sheet"), "border-top-left-radius")).toBe("12px");
expect(await css(tid(page, "sheet"), "border-top-left-radius")).toBe("8px");
expect(await css(tid(page, "sheet"), "border-left-color")).toBe("rgb(50, 56, 77)");
});

Expand Down Expand Up @@ -200,15 +200,15 @@ test.describe("Phase 3 · shell", () => {
expect(project.y).toBe(166);
const row = await box(tid(page, "thread-row").first());
expect([row.x, row.y, row.width, row.height]).toEqual([57, 197, 213, 72]); // title, provider/model, and checkout/PR metadata
expect(await css(tid(page, "thread-row").first(), "border-top-left-radius")).toBe("10px");
expect(await css(tid(page, "thread-row").first(), "border-top-left-radius")).toBe("6px");
const label = await box(tid(page, "thread-row-title").first());
near(label.x, 89);
expect(await css(tid(page, "thread-row-title").first(), "font-size")).toBe("14px");
});
});

test.describe("Phase 4 · composer", () => {
// Reference #1: box 960×109; controls retain their insets; strip 38 px, inset 13 px; send a 34 px circle in the corner.
// Reference #1: box 960×109; controls retain their insets; strip 38 px, inset 13 px; send a 34 px square (control radius) in the corner.
const near = (got: number, want: number, tol = 1) => expect(Math.abs(got - want), `${got} vs ${want}`).toBeLessThanOrEqual(tol);

test("box is 960×109, centred in the main pane, 16 px off the bottom", async () => {
Expand All @@ -220,7 +220,7 @@ test.describe("Phase 4 · composer", () => {
near(c.x + c.width / 2, m.x + 1 + (m.width - 1) / 2);
expect(await css(tid(page, "composer-box"), "background-color")).toBe("rgb(29, 36, 53)");
expect(await css(tid(page, "composer-box"), "border-top-color")).toBe("rgb(66, 70, 94)");
expect(await css(tid(page, "composer-box"), "border-top-left-radius")).toBe("20px");
expect(await css(tid(page, "composer-box"), "border-top-left-radius")).toBe("8px");
});

test("context strip sits on the box: 38 px, inset 13 px, 13 px text", async () => {
Expand All @@ -231,7 +231,7 @@ test.describe("Phase 4 · composer", () => {
expect(await css(tid(page, "composer-context"), "font-size")).toBe("13px");
});

test("control row: + and access keep their insets, round send in the corner", async () => {
test("control row: + and access keep their insets, square send in the corner", async () => {
const c = await box(tid(page, "composer-box"));
const plus = await box(tid(page, "composer-plus"));
near(plus.x + plus.width / 2, c.x + 22); near(plus.y + plus.height / 2, c.y + c.height - 22);
Expand All @@ -242,7 +242,7 @@ test.describe("Phase 4 · composer", () => {
expect([send.width, send.height]).toEqual([34, 34]);
near(send.x + send.width, c.x + c.width - 2);
near(send.y + send.height, c.y + c.height - 2);
expect(await css(tid(page, "send"), "border-top-left-radius")).toBe("50%");
expect(await css(tid(page, "send"), "border-top-left-radius")).toBe("6px");
expect(await css(tid(page, "composer-input"), "font-size")).toBe("14px");
await expect(tid(page, "composer-input")).toHaveAttribute("placeholder", "Do anything");
});
Expand All @@ -263,7 +263,7 @@ test.describe("Phase 6 · transcript", () => {
expect(await css(label, "border-bottom-color")).toBe("rgb(43, 51, 71)");
const bubble = items(page, "user").first().locator('[data-testid="item-text"]');
expect(await css(bubble, "background-color")).toBe("rgb(27, 34, 50)");
expect(await css(bubble, "border-top-left-radius")).toBe("12px");
expect(await css(bubble, "border-top-left-radius")).toBe("8px");
const b = await box(bubble);
expect(Math.abs(b.x + b.width - (header.x + header.width))).toBeLessThanOrEqual(1);
const prose = items(page, "assistant").first();
Expand Down
10 changes: 4 additions & 6 deletions apps/desktop/e2e/local-model-acceptance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fs from "node:fs";
import path from "node:path";
import http from "node:http";
import type { AddressInfo } from "node:net";
import { appDir, seedHome, tid } from "./support.js";
import { answerConfirm, appDir, seedHome, tid } from "./support.js";
import { holdLocalDraftCreation, tryInputWhileLocalSelectionWaits, releaseLocalDraftCreation, restoreLocalDraftCreation } from "./fixtures/local-draft-selection.js";

// Full app composition with a scripted native transport injected by a temporary-home-only
Expand Down Expand Up @@ -129,14 +129,12 @@ test("editing a connection invalidates its selected revision and cloud return co
await expect(run.page.getByText(/changed or was deleted|destination changed/).first()).toBeVisible();
await choose(run.page);
await tid(run.page, "model-picker").click();
const dismissed = run.page.waitForEvent("dialog").then(async dialog => {
expect(dialog.message()).toContain("fixture-cloud"); await dialog.dismiss();
});
await tid(run.page, "model-local-clear").click(); await dismissed;
await tid(run.page, "model-local-clear").click();
await answerConfirm(run.page, "cancel", "fixture-cloud");
expect((await run.page.evaluate(() => window.modex!.invoke("state:get", undefined))).threads.some(t => t.localTarget)).toBe(true);
await tid(run.page, "model-picker").click();
run.page.once("dialog", dialog => void dialog.accept());
await tid(run.page, "model-local-clear").click();
await answerConfirm(run.page, "accept");
await expect.poll(async () => (await run.page.evaluate(() => window.modex!.invoke("state:get", undefined))).threads.some(t => t.localTarget)).toBe(false);
expect((await run.page.evaluate(() => window.modex!.invoke("state:get", undefined))).threads[0]?.model).toBe("fixture-cloud");
} finally { await run.app.close(); }
Expand Down
4 changes: 2 additions & 2 deletions apps/desktop/e2e/local-models.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import http from "node:http";
import fs from "node:fs";
import path from "node:path";
import type { AddressInfo } from "node:net";
import { launch, seedHome, tid } from "./support.js";
import { answerConfirm, launch, seedHome, tid } from "./support.js";
import { holdLocalDraftCreation, tryInputWhileLocalSelectionWaits, releaseLocalDraftCreation, restoreLocalDraftCreation } from "./fixtures/local-draft-selection.js";

// LM-4 (#381), LM Studio first: Settings → Local models and the model menu's local section, through the
Expand Down Expand Up @@ -122,8 +122,8 @@ test("Settings adds an LM Studio server, lists its models without loading one, a
// Refresh lists again; Remove asks first and then deletes the profile in main.
await tid(card.first(), "local-refresh").click();
await expect.poll(() => runtime.hits.length).toBe(2);
page.once("dialog", dialog => void dialog.accept());
await tid(stopped, "local-remove").click();
await answerConfirm(page, "accept", "Past conversations stay readable.");
await expect(tid(page, "local-connection")).toHaveCount(1);
const listed = await page.evaluate(() => window.modex!.invoke("local-models:command", { op: "list" }));
expect(listed.op === "list" && listed.connections.map(c => c.label)).toEqual(["LM Studio"]);
Expand Down
8 changes: 4 additions & 4 deletions apps/desktop/e2e/project-remove.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { execFileSync } from "node:child_process";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { launch, seedHome, tid } from "./support";
import { answerConfirm, launch, seedHome, tid } from "./support";

let app: ElectronApplication;
let page: Page;
Expand Down Expand Up @@ -55,10 +55,10 @@ test("removing a project protects its unsent draft, then replaces a cleared draf
await tid(page, "composer-input").fill("Unsent draft message in p2");

// Remove project 2
page.once("dialog", (d) => void d.accept());
await p2.hover();
await tid(p2, "project-menu").click();
await tid(p2, "project-remove").click();
await answerConfirm(page, "accept");

if (await page.evaluate(() => Boolean(window.modex!.nativeDrafts))) {
await expect(tid(page, "toast")).toContainText(/unsent draft/i);
Expand All @@ -67,8 +67,8 @@ test("removing a project protects its unsent draft, then replaces a cleared draf
expect(JSON.parse(fs.readFileSync(path.join(home, "app/update-recovery.json"), "utf8")).drafts.projects.find((row: any) => row.projectId === "p2").text).toBe("Unsent draft message in p2");
await tid(page, "toast").getByRole("button", { name: "Dismiss", exact: true }).click();
await tid(page, "composer-input").fill("");
page.once("dialog", d => void d.accept());
await p2.hover(); await tid(p2, "project-menu").click(); await tid(p2, "project-remove").click();
await answerConfirm(page, "accept");
}

// Project 2 is removed from sidebar
Expand All @@ -84,10 +84,10 @@ test("removing a project protects its unsent draft, then replaces a cleared draf

// Remove the last project (project 1)
const p1 = projects.filter({ hasText: path.basename(repo1) });
page.once("dialog", (d) => void d.accept());
await p1.hover();
await tid(p1, "project-menu").click();
await tid(p1, "project-remove").click();
await answerConfirm(page, "accept");

// All projects removed -> EmptyState is rendered immediately
await expect(tid(page, "project")).toHaveCount(0);
Expand Down
Loading
Loading