A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.
Swift ai-agentsanthropicantigravityclaudeclaude-codecodexcursordynamic-islandgemini-cliiosiphonlinuxmacosmacos-appmenubar-appnotchopen-sourceswiftswiftuiwindows
Windows and Linux: the Coucou window, its Flow pages and the pill
Claudecb46e7364227
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.ymlindex bfceafad..8b084815 100644--- a/.github/workflows/linux.yml+++ b/.github/workflows/linux.yml@@ -47,16 +47,17 @@ jobs:with:persist-credentials: false- # webkit2gtk, gtk-layer-shell and appindicator to build against; patchelf- # and the GStreamer plugins for the AppImage, which carries its own- # GStreamer so the sounds play (WAV needs wavparse, in -good).+ # webkit2gtk, gtk-layer-shell and appindicator to build against, ALSA for+ # the microphone (Flow dictation, the Notetaker); patchelf and the+ # GStreamer plugins for the AppImage, which carries its own GStreamer so+ # the sounds play (WAV needs wavparse, in -good).- name: Install system librariesworking-directory: .run: |sudo apt-get updatesudo apt-get install -y \libwebkit2gtk-4.1-dev libgtk-layer-shell-dev libayatana-appindicator3-dev \- librsvg2-dev libssl-dev libdbus-1-dev patchelf \+ librsvg2-dev libssl-dev libdbus-1-dev libasound2-dev patchelf \gstreamer1.0-plugins-base gstreamer1.0-plugins-good- uses: actions/setup-node@v7diff --git a/.github/workflows/phone-link.yml b/.github/workflows/phone-link.ymlindex 6b55ae8f..871cbe3c 100644--- a/.github/workflows/phone-link.yml+++ b/.github/workflows/phone-link.yml@@ -56,7 +56,7 @@ jobs:run: |sudo apt-get updatesudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev \- librsvg2-dev libgtk-layer-shell-dev libsoup-3.0-dev libssl-dev libxdo-dev+ librsvg2-dev libgtk-layer-shell-dev libsoup-3.0-dev libssl-dev libxdo-dev libasound2-dev- uses: actions/cache@v6with:path: |@@ -109,7 +109,7 @@ jobs:run: |sudo apt-get updatesudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev \- librsvg2-dev libgtk-layer-shell-dev libsoup-3.0-dev libssl-dev libxdo-dev+ librsvg2-dev libgtk-layer-shell-dev libsoup-3.0-dev libssl-dev libxdo-dev libasound2-dev- uses: actions/cache@v6with:path: |diff --git a/windows/pill.html b/windows/pill.htmlnew file mode 100644index 00000000..b916b1a8--- /dev/null+++ b/windows/pill.html@@ -0,0 +1,12 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>Coucou</title>+ </head>+ <body>+ <div id="pill"></div>+ <script type="module" src="/src/pill/main.ts"></script>+ </body>+</html>diff --git a/windows/settings.html b/windows/settings.htmlindex 2f6d9ddf..e2c8a8b5 100644--- a/windows/settings.html+++ b/windows/settings.html@@ -3,10 +3,10 @@<head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />- <title>Settings — Coucou</title>+ <title>Coucou</title></head>- <body class="settings-window" style="background: #0b0c0e; color: #f5f6f8">- <div id="settings-root"><p style="padding: 24px">Loading…</p></div>+ <body class="settings-window hub-window" style="background: #000; color: #f5f6f8">+ <div id="hub"><p style="padding: 24px">Loading…</p></div><script type="module" src="/src/settings/main.ts"></script></body></html>diff --git a/windows/src-tauri/src/flow/mod.rs b/windows/src-tauri/src/flow/mod.rsindex 264c8b1c..0db2c29c 100644--- a/windows/src-tauri/src/flow/mod.rs+++ b/windows/src-tauri/src/flow/mod.rs@@ -461,6 +461,8 @@ pub struct FlowStatus {platform: &'static str,/// Coucou started with the computer.autostarted: bool,+ /// The user's first name, for "Hello Louis".+ user_name: Option<String>,}#[tauri::command]@@ -476,6 +478,9 @@ pub fn flow_status(flow: State<Arc<Flow>>) -> FlowStatus {mics: audio::input_devices(),platform: if cfg!(windows) { "windows" } else { "linux" },autostarted: crate::launched_at_login(),+ user_name: crate::platform::user_full_name()+ .and_then(|n| n.split_whitespace().next().map(String::from))+ .filter(|n| !n.is_empty()),}}diff --git a/windows/src-tauri/tauri.linux.conf.json b/windows/src-tauri/tauri.linux.conf.jsonindex 2e642420..1b199e82 100644--- a/windows/src-tauri/tauri.linux.conf.json+++ b/windows/src-tauri/tauri.linux.conf.json@@ -16,12 +16,14 @@},"deb": {"depends": [- "libgtk-layer-shell0 (>= 0.6)"+ "libgtk-layer-shell0 (>= 0.6)",+ "libasound2t64 | libasound2"]},"rpm": {"depends": [- "gtk-layer-shell"+ "gtk-layer-shell",+ "alsa-lib"]}}diff --git a/windows/src/core/flow.ts b/windows/src/core/flow.tsnew file mode 100644index 00000000..71f047a2--- /dev/null+++ b/windows/src/core/flow.ts@@ -0,0 +1,220 @@+// Flow dictation, the voice models and the Notetaker, as the Coucou window and+// the pill see them (src-tauri/src/flow, speech, notes).++import { invoke } from "@tauri-apps/api/core";++const IS_TAURI = typeof window !== "undefined" && "__TAURI_INTERNALS__" in window;++async function call<T>(cmd: string, args?: Record<string, unknown>): Promise<T | null> {+ if (!IS_TAURI) return null;+ try {+ return await invoke<T>(cmd, args);+ } catch (err) {+ console.error(`[coucou] ${cmd} failed`, err);+ return null;+ }+}++async function callOrThrow<T>(cmd: string, args?: Record<string, unknown>): Promise<T> {+ if (!IS_TAURI) throw new Error("not running inside Coucou");+ return invoke<T>(cmd, args);+}++export type FlowKey = "right_ctrl" | "right_alt" | "right_shift" | "left_ctrl_super";+export type Edge = "bottom" | "left" | "right";+export type Style = "verbatim" | "natural" | "polished";++export interface FlowPrefs {+ enabled: boolean;+ key: FlowKey;+ edge: Edge;+ mic: string;+ keepDays: number;+ cleanup: boolean;+ defaultStyle: Style;+ summaryEngine: "claude" | "off";+ openAtLaunch: boolean;+}++export type ModelState =+ | { state: "missing" }+ | { state: "downloading"; fraction: number }+ | { state: "ready" }+ | { state: "failed"; error: string };++export interface ModelsStatus {+ parakeet: ModelState;+ downloadMb: number;+}++export interface FlowStatus {+ prefs: FlowPrefs;+ models: ModelsStatus;+ /** "ok", or why the key can't be watched ("wayland", "no-display"). */+ keys: string;+ hasClaudeKey: boolean;+ mics: { name: string; default: boolean }[];+ platform: "windows" | "linux";+ autostarted: boolean;+ userName?: string | null;+}++export interface FlowEntry {+ id: string;+ date: number;+ text: string;+ app?: string | null;+ words: number;+ seconds: number;+}++export interface Totals {+ words: number;+ seconds: number;+ dictations: number;+ wordsPerMinute: number;+ minutesSaved: number;+}++export interface FlowStats {+ week: Totals;+ month: Totals;+ all: Totals;+ daily: [string, number][];+ apps: Record<string, number>;+ streak: number;+}++export interface Replacement {+ id: string;+ from: string;+ to: string;+}++export interface Snippet {+ id: string;+ trigger: string;+ text: string;+}++export interface AppStyle {+ id: string;+ name: string;+ style: Style;+}++export interface Speaker {+ id: string;+ name: string;+ color: number;+ isMe: boolean;+}++export interface NoteLine {+ id: string;+ speaker: string;+ start: number;+ end: number;+ text: string;+}++export interface Todo {+ id: string;+ text: string;+ owner?: string | null;+ due?: string | null;+ done: boolean;+}++export interface Note {+ id: string;+ title: string;+ titleEdited: boolean;+ start: number;+ end?: number | null;+ app?: string | null;+ status: "recording" | "processing" | "ready" | "failed";+ speakers: Speaker[];+ lines: NoteLine[];+ summary?: string | null;+ keyPoints: string[];+ todos: Todo[];+ error?: string | null;+ startLocal: string;+}++export interface NotesState {+ notes: Note[];+ recording: string | null;+ working: string[];+}++export interface Announcement {+ id: number;+ icon: string;+ tint: string;+ text: string;+ action?: string | null;+ actionId?: string | null;+}++export interface PillState {+ phase: "idle" | "listening" | "thinking" | "locked" | "copied" | "failed" | "pastedAgain";+ edge: Edge;+ key: FlowKey | "";+ noteStartedAt: number | null;+ announcement: Announcement | null;+ enabled: boolean;+}++export const FlowBridge = {+ status: () => call<FlowStatus>("flow_status"),+ setPrefs: (prefs: FlowPrefs) => call<void>("flow_set_prefs", { prefs }),+ history: () => call<FlowEntry[]>("flow_history"),+ deleteEntry: (id: string) => call<void>("flow_delete", { id }),+ clear: (everything: boolean) => call<void>("flow_clear", { everything }),+ stats: () => call<FlowStats>("flow_stats"),+ words: () => call<{ words: string[]; replacements: Replacement[] }>("flow_words"),+ setWords: (words: { words: string[]; replacements: Replacement[] }) => call<void>("flow_set_words", { words }),+ snippets: () => call<Snippet[]>("flow_snippets"),+ setSnippets: (snippets: Snippet[]) => call<void>("flow_set_snippets", { snippets }),+ styles: () => call<AppStyle[]>("flow_styles"),+ setStyles: (styles: AppStyle[]) => call<void>("flow_set_styles", { styles }),+ runningApps: () => call<{ id: string; name: string }[]>("flow_running_apps"),+ copy: (text: string) => call<boolean>("flow_copy", { text }),+ pasteAgain: () => call<void>("flow_paste_again"),+ download: () => call<void>("flow_models_download"),+ removeModels: () => call<void>("flow_models_remove"),++ notes: () => call<NotesState>("notes_state"),+ startNote: () => callOrThrow<string>("notes_start"),+ stopNote: () => call<void>("notes_stop"),+ renameNote: (id: string, title: string) => call<void>("notes_rename", { id, title }),+ renameSpeaker: (id: string, speaker: string, name: string) => call<void>("notes_rename_speaker", { id, speaker, name }),+ toggleTodo: (id: string, todo: string) => call<void>("notes_toggle_todo", { id, todo }),+ deleteNote: (id: string) => call<void>("notes_delete", { id }),+ summarize: (id: string) => call<void>("notes_summarize", { id }),+ retryNote: (id: string) => call<void>("notes_retry", { id }),+ markdown: (id: string) => call<string>("notes_markdown", { id }),+ exportNote: (id: string) => callOrThrow<string>("notes_export", { id }),++ pillState: () => call<PillState>("pill_state"),+ pillHot: (rects: [number, number, number, number][]) => call<void>("pill_hot", { rects }),+ pillHover: (inside: boolean) => call<void>("pill_hover", { inside }),+ pillAction: (action: string, id?: number) => call<void>("pill_action", { action, id: id ?? null }),+};++/** One colour per person in a call: you first, then the others. */+export const SPEAKER_COLORS = ["#3B9EFF", "#34D399", "#A78BFA", "#F7B32B", "#F472B6", "#22D3EE"];++export function speakerColor(index: number): string {+ return SPEAKER_COLORS[Math.max(0, index) % SPEAKER_COLORS.length];+}++/** 75 → "1:15", 3725 → "1:02:05". */+export function clock(seconds: number): string {+ const s = Math.max(0, Math.floor(seconds));+ const two = (n: number) => String(n).padStart(2, "0");+ if (s >= 3600) return `${Math.floor(s / 3600)}:${two(Math.floor((s % 3600) / 60))}:${two(s % 60)}`;+ return `${Math.floor(s / 60)}:${two(s % 60)}`;+}diff --git a/windows/src/hub/hero.ts b/windows/src/hub/hero.tsnew file mode 100644index 00000000..90866213--- /dev/null+++ b/windows/src/hub/hero.ts@@ -0,0 +1,428 @@+// The coloured band on top of each page of the Coucou window: a deep black+// with the page's colour breathing in a corner, particles that drift all the+// time and move away from the pointer, and the page's little Mochis walking on+// its floor — they hop, look around, wave, and react when poked. Also the+// glowing cards and the Mochis of empty pages. Port of FlowHubMochis.swift.+//+// One animation loop draws every live canvas; it stops when none is on screen+// or the window is hidden, so a hidden window costs nothing.++import { BotEngine, hexToRGB } from "../mochi/engine";+import type { BotEmoteName, BotStateName } from "../core/layout";+import type { Outfit } from "../mochi/wardrobe";++interface Animated {+ el: HTMLCanvasElement;+ draw(dt: number, t: number): void;+}++const live = new Set<Animated>();+let frame: number | null = null;+let last = performance.now();+const start = performance.now();++function loop(now: number) {+ frame = null;+ const dt = Math.min(0.05, (now - last) / 1000);+ last = now;+ const t = (now - start) / 1000;+ for (const a of live) {+ if (!a.el.isConnected) {+ live.delete(a);+ continue;+ }+ a.draw(dt, t);+ }+ if (live.size > 0 && document.visibilityState === "visible") frame = requestAnimationFrame(loop);+}++function wake() {+ if (frame === null && live.size > 0 && document.visibilityState === "visible") {+ last = performance.now();+ frame = requestAnimationFrame(loop);+ }+}++document.addEventListener("visibilitychange", wake);++function add(a: Animated) {+ live.add(a);+ wake();+}++function fit(canvas: HTMLCanvasElement): { w: number; h: number; ctx: CanvasRenderingContext2D | null } {+ const dpr = Math.min(2, window.devicePixelRatio || 1);+ const w = canvas.clientWidth;+ const h = canvas.clientHeight;+ if (canvas.width !== Math.round(w * dpr) || canvas.height !== Math.round(h * dpr)) {+ canvas.width = Math.round(w * dpr);+ canvas.height = Math.round(h * dpr);+ }+ const ctx = canvas.getContext("2d");+ ctx?.setTransform(dpr, 0, 0, dpr, 0, 0);+ return { w, h, ctx };+}++function rgba(hex: string, alpha: number): string {+ const [r, g, b] = hexToRGB(hex);+ return `rgba(${Math.round(r * 255)},${Math.round(g * 255)},${Math.round(b * 255)},${Math.max(0, Math.min(1, alpha))})`;+}++// ── The backdrop ──────────────────────────────────────────────────────────────++interface Particle {+ x: number;+ y: number;+ vx: number;+ vy: number;+ r: number;+ depth: number;+ phase: number;+ white: boolean;+}++/** The deep black, the colour and the particles, on `canvas`; `pointerFrom` is+ * the element whose pointer pushes the particles. */+export function backdrop(canvas: HTMLCanvasElement, color: string, pointerFrom: HTMLElement, radius = 18) {+ let particles: Particle[] = [];+ let pointer: { x: number; y: number } | null = null;+ let strength = 0;+ pointerFrom.addEventListener("pointermove", (e) => {+ const r = canvas.getBoundingClientRect();+ pointer = { x: e.clientX - r.left, y: e.clientY - r.top };+ });+ pointerFrom.addEventListener("pointerleave", () => (pointer = null));++ const seed = (w: number, h: number) => {+ const count = Math.round(Math.min(90, Math.max(24, (w * h) / 2600)));+ particles = Array.from({ length: count }, () => ({+ x: Math.random() * w,+ y: Math.random() * h,+ vx: (Math.random() - 0.5) * 6,+ vy: -2 - Math.random() * 6,+ r: 0.5 + Math.random() * 1.4,+ depth: 0.35 + Math.random() * 0.65,+ phase: Math.random() * Math.PI * 2,+ white: Math.random() < 0.35,+ }));+ };++ add({+ el: canvas,+ draw(dt, t) {+ const { w, h, ctx } = fit(canvas);+ if (!ctx || w === 0) return;+ if (particles.length === 0) seed(w, h);+ strength += ((pointer ? 1 : 0) - strength) * Math.min(1, dt * 4);+ ctx.clearRect(0, 0, w, h);+ ctx.save();+ ctx.beginPath();+ ctx.roundRect(0, 0, w, h, radius);+ ctx.clip();+ ctx.fillStyle = "#020203";+ ctx.fillRect(0, 0, w, h);+ const lin = ctx.createLinearGradient(w, 0, w * 0.35, h);+ lin.addColorStop(0, rgba(color, 0.1));+ lin.addColorStop(1, "rgba(0,0,0,0)");+ ctx.fillStyle = lin;+ ctx.fillRect(0, 0, w, h);+ const breath = 0.85 + 0.15 * Math.sin(t * 0.9);+ const rad = ctx.createRadialGradient(w * 0.92, -h * 0.15, 0, w * 0.92, -h * 0.15, Math.max(w, h) * 0.55 * breath);+ rad.addColorStop(0, rgba(color, 0.3 * breath));+ rad.addColorStop(0.5, rgba(color, 0.08));+ rad.addColorStop(1, "rgba(0,0,0,0)");+ ctx.fillStyle = rad;+ ctx.fillRect(0, 0, w, h);++ for (const p of particles) {+ // Drift, always; the pointer pushes them away.+ p.x += p.vx * dt * p.depth;+ p.y += p.vy * dt * p.depth;+ let alpha = (0.22 + 0.5 * (0.5 + 0.5 * Math.sin(t * (1.2 + p.depth) + p.phase))) * p.depth;+ let r = p.r;+ if (pointer && strength > 0.01) {+ const dx = p.x - pointer.x;+ const dy = p.y - pointer.y;+ const d = Math.hypot(dx, dy);+ if (d < 140 && d > 0.1) {+ const push = (1 - d / 140) * 90 * strength * dt;+ p.x += (dx / d) * push;+ p.y += (dy / d) * push;+ }+ if (d < 200) {+ const near = (1 - d / 200) * strength;+ alpha += near * 0.6;+ r *= 1 + near * 0.8;+ }+ }+ if (p.y < -4) p.y = h + 4;+ if (p.y > h + 4) p.y = -4;+ if (p.x < -4) p.x = w + 4;+ if (p.x > w + 4) p.x = -4;+ const tint = p.white ? "#FFFFFF" : color;+ if (r > 1.1) {+ ctx.fillStyle = rgba(tint, Math.min(1, alpha) * 0.12);+ ctx.beginPath();+ ctx.arc(p.x, p.y, r * 2.6, 0, Math.PI * 2);+ ctx.fill();+ }+ ctx.fillStyle = rgba(tint, Math.min(1, alpha));+ ctx.beginPath();+ ctx.arc(p.x, p.y, r, 0, Math.PI * 2);+ ctx.fill();+ }+ ctx.restore();+ },+ });+}++// ── The Mochis ────────────────────────────────────────────────────────────────++export interface MochiSpec {+ color: string;+ /** Body width in CSS pixels. */+ size: number;+ /** Where he starts along the floor, 0…1. */+ start: number;+ outfit?: Outfit;+ state?: BotStateName;+ /** False: he stays where he is (working, thinking, asleep). */+ roams?: boolean;+}++const EMOTES: BotEmoteName[] = ["love", "happy", "wink", "proud", "surprised"];++class Walker {+ engine = new BotEngine();+ x = 0;+ target = 0;+ dir = 1;+ hop = 0;+ hopV = 0;+ pause = 1 + Math.random() * 2;+ nextEvent = 2 + Math.random() * 4;+ waving = 0;++ constructor(public spec: MochiSpec) {+ this.engine.bodyColor = hexToRGB(spec.color);+ this.engine.setState(spec.state ?? "idle", true);+ if (spec.outfit && spec.outfit !== "none") this.engine.setOutfit(spec.outfit, false);+ }+}++/** The page's Mochis on the band's floor, in the right part of `canvas`. */+export function troupe(canvas: HTMLCanvasElement, cast: MochiSpec[], width: number) {+ const walkers = cast.map((spec) => new Walker(spec));+ let pointer: { x: number; y: number } | null = null;+ let placed = false;+ canvas.addEventListener("pointermove", (e) => {+ const r = canvas.getBoundingClientRect();+ pointer = { x: e.clientX - r.left, y: e.clientY - r.top };+ });+ canvas.addEventListener("pointerleave", () => (pointer = null));+ canvas.addEventListener("click", (e) => {+ const r = canvas.getBoundingClientRect();+ const px = e.clientX - r.left;+ for (const w of walkers) {+ if (Math.abs(px - w.x) < w.spec.size * 0.6) {+ w.engine.slap();+ w.hopV = 260;+ }+ }+ });++ add({+ el: canvas,+ draw(dt, t) {+ const { w: cw, h: ch, ctx } = fit(canvas);+ if (!ctx || cw === 0) return;+ const left = Math.max(0, cw - width - 18);+ const right = cw - 18;+ if (!placed) {+ placed = true;+ for (const w of walkers) {+ w.x = left + w.spec.size / 2 + (right - left - w.spec.size) * w.spec.start;+ w.target = w.x;+ }+ }+ ctx.clearRect(0, 0, cw, ch);+ for (const w of walkers) {+ const s = w.spec.size;+ const lo = left + s / 2;+ const hi = right - s / 2;+ if (w.spec.roams !== false) {+ if (Math.abs(w.target - w.x) < 1) {+ w.pause -= dt;+ if (w.pause <= 0) {+ w.target = lo + Math.random() * Math.max(1, hi - lo);+ w.pause = 1.5 + Math.random() * 3.5;+ }+ } else {+ const step = Math.sign(w.target - w.x) * Math.min(Math.abs(w.target - w.x), 28 * dt);+ w.x += step;+ w.dir = Math.sign(step) || w.dir;+ // A little bounce in the walk.+ if (w.hop === 0 && w.hopV === 0) w.hopV = 70;+ }+ }+ w.nextEvent -= dt;+ if (w.nextEvent <= 0) {+ w.nextEvent = 4 + Math.random() * 6;+ const roll = Math.random();+ if (roll < 0.35) w.hopV = 200;+ else if (roll < 0.6) w.engine.triggerEmote(EMOTES[Math.floor(Math.random() * EMOTES.length)]);+ else if (roll < 0.75) w.engine.greet();+ }+ // Hops: a simple ballistic jump.+ if (w.hopV !== 0 || w.hop > 0) {+ w.hopV -= 900 * dt;+ w.hop = Math.max(0, w.hop + w.hopV * dt);+ if (w.hop === 0 && w.hopV < 0) {+ w.hopV = 0;+ w.engine.squash();+ }+ }+ // Eyes: the pointer when it is over the band, else where they walk.+ if (pointer) {+ w.engine.lookX = Math.max(-1, Math.min(1, (pointer.x - w.x) / 160));+ w.engine.lookY = Math.max(-1, Math.min(1, (pointer.y - (ch - s * 0.6)) / 120));+ } else {+ w.engine.lookX = w.dir * 0.5;+ w.engine.lookY = 0.1 + 0.1 * Math.sin(t + w.spec.start * 7);+ }+ w.engine.update(dt);+ const box = s / 0.6;+ ctx.save();+ ctx.translate(w.x - box / 2, ch - box * 0.78 - w.hop);+ // A soft shadow on the floor.+ ctx.fillStyle = `rgba(0,0,0,${0.35 * (1 - Math.min(1, w.hop / 60))})`;+ ctx.beginPath();+ ctx.ellipse(box / 2, box * 0.78 + w.hop - 2, s * 0.42, s * 0.08, 0, 0, Math.PI * 2);+ ctx.fill();+ w.engine.draw(ctx, box, box);+ ctx.restore();+ }+ },+ });+}++/** One Mochi alone (the sidebar's logo, an empty page). */+export function liveMochi(canvas: HTMLCanvasElement, color = "#F5F6F8", state: BotStateName = "idle") {+ const engine = new BotEngine();+ engine.bodyColor = hexToRGB(color);+ engine.setState(state, true);+ canvas.addEventListener("click", () => engine.slap());+ let mouse: { x: number; y: number } | null = null;+ window.addEventListener("pointermove", (e) => {+ const r = canvas.getBoundingClientRect();+ mouse = { x: e.clientX - (r.left + r.width / 2), y: e.clientY - (r.top + r.height / 2) };+ });+ add({+ el: canvas,+ draw(dt) {+ const { w, h, ctx } = fit(canvas);+ if (!ctx || w === 0) return;+ if (mouse) {+ engine.lookX = Math.max(-1, Math.min(1, mouse.x / 300));+ engine.lookY = Math.max(-1, Math.min(1, mouse.y / 300));+ }+ engine.update(dt);+ ctx.clearRect(0, 0, w, h);+ engine.draw(ctx, w, h);+ },+ });+ return engine;+}++// ── Page themes ───────────────────────────────────────────────────────────────++export interface Theme {+ color: string;+ cast: MochiSpec[];+}++const m = (color: string, size: number, start: number, extra: Partial<MochiSpec> = {}): MochiSpec => ({+ color, size, start, ...extra,+});++export const THEMES: Record<string, Theme> = {+ dictation: { color: "#FB923C", cast: [m("#F5F6F8", 66, 0.2), m("#FB923C", 52, 0.65), m("#F472B6", 44, 0.95, { outfit: "bow" })] },+ notes: { color: "#3B9EFF", cast: [m("#3B9EFF", 58, 0.1, { outfit: "roundGlasses" }), m("#34D399", 50, 0.5), m("#A78BFA", 46, 0.9)] },+ insights: { color: "#34D399", cast: [m("#F7B32B", 62, 0.3, { outfit: "crown" }), m("#34D399", 48, 0.75), m("#F5F6F8", 40, 1)] },+ dictionary: { color: "#A78BFA", cast: [m("#A78BFA", 60, 0.2, { outfit: "roundGlasses" }), m("#F5F6F8", 48, 0.8, { outfit: "beanie" })] },+ snippets: { color: "#F7B32B", cast: [m("#F7B32B", 56, 0.15, { state: "working" }), m("#FB923C", 46, 0.6), m("#F5F6F8", 40, 0.95)] },+ styles: { color: "#F472B6", cast: [m("#F472B6", 60, 0.25, { outfit: "sunglasses" }), m("#F5F6F8", 48, 0.7, { outfit: "bow" }), m("#22D3EE", 42, 1, { outfit: "partyHat" })] },+ flowsettings: { color: "#8E939C", cast: [m("#F5F6F8", 56, 0.3), m("#8E939C", 46, 0.95, { state: "sleeping", roams: false })] },+ general: { color: "#8E939C", cast: [m("#F5F6F8", 60, 0.4, { outfit: "scarf" }), m("#FB923C", 46, 0.85)] },+ pills: {+ color: "#F5A524",+ cast: [m("#F5A524", 44, 0.05), m("#3B9EFF", 44, 0.3), m("#34D399", 44, 0.55), m("#E07950", 44, 0.8), m("#A78BFA", 44, 1)],+ },+ agents: {+ color: "#3B9EFF",+ cast: [m("#3B9EFF", 56, 0.1, { state: "working", roams: false }), m("#E07950", 50, 0.5, { state: "thinking", roams: false }), m("#34D399", 50, 0.9)],+ },+ chat: { color: "#E07950", cast: [m("#E07950", 58, 0.3, { state: "thinking", roams: false }), m("#F5F6F8", 48, 0.85)] },+ integrations: { color: "#7C5CFF", cast: [m("#7C5CFF", 54, 0.15), m("#22D3EE", 46, 0.55), m("#F7B32B", 42, 0.95)] },+ phone: { color: "#3DDC84", cast: [m("#3DDC84", 56, 0.25), m("#F5F6F8", 46, 0.8, { outfit: "beanie" })] },+ voice: { color: "#F97316", cast: [m("#F97316", 60, 0.3), m("#F5F6F8", 48, 0.85, { outfit: "roundGlasses" })] },+ shortcuts: { color: "#6366F1", cast: [m("#6366F1", 56, 0.2, { outfit: "sunglasses" }), m("#F5F6F8", 46, 0.8)] },+};++/** The band itself: title, line, actions, and the Mochis. */+export function hero(page: string, title: string, subtitle: string | null, actions: HTMLElement[] = [], compact = false): HTMLElement {+ const theme = THEMES[page] ?? THEMES.general;+ const el = document.createElement("div");+ el.className = compact ? "hub-hero compact" : "hub-hero";+ el.style.setProperty("--hero-line", rgba(theme.color, 0.16));+ const back = document.createElement("canvas");+ back.className = "backdrop";+ const mochis = document.createElement("canvas");+ mochis.className = "troupe";+ const copy = document.createElement("div");+ copy.className = "copy";+ const h1 = document.createElement("h1");+ h1.textContent = title;+ copy.append(h1);+ if (subtitle) {+ const p = document.createElement("p");+ p.textContent = subtitle;+ copy.append(p);+ }+ if (actions.length) {+ const row = document.createElement("div");+ row.className = "actions";+ row.append(...actions);+ copy.append(row);+ }+ el.append(back, mochis, copy);+ backdrop(back, theme.color, el);+ troupe(mochis, theme.cast, compact ? 280 : 340);+ return el;+}++/** A card in a colour: the band's black and particles behind `content`. */+export function glowCard(color: string, ...content: (HTMLElement | string)[]): HTMLElement {+ const el = document.createElement("div");+ el.className = "hub-glow";+ el.style.setProperty("--glow-line", rgba(color, 0.18));+ const canvas = document.createElement("canvas");+ const inner = document.createElement("div");+ inner.className = "inner";+ inner.append(...content);+ el.append(canvas, inner);+ backdrop(canvas, color, el, 14);+ return el;+}++/** An empty page: a Mochi asleep, and a line. */+export function emptyState(text: string, state: BotStateName = "sleeping", color = "#F5F6F8"): HTMLElement {+ const el = document.createElement("div");+ el.className = "hub-empty";+ const canvas = document.createElement("canvas");+ const p = document.createElement("div");+ p.textContent = text;+ el.append(canvas, p);+ liveMochi(canvas, color, state);+ return el;+}diff --git a/windows/src/hub/hub.css b/windows/src/hub/hub.cssnew file mode 100644index 00000000..1420c18a--- /dev/null+++ b/windows/src/hub/hub.css@@ -0,0 +1,919 @@+/* The Coucou window: an OLED-black sidebar, a dark panel holding the pages,+ and on top of each page a coloured band where little Mochis walk. Same+ look as the Mac's Coucou window (FlowHub.swift). */++:root {+ --hub-panel: #0e0f11;+ --hub-card: #18191c;+ --hub-field: #1f2024;+ --hub-line: rgba(255, 255, 255, 0.07);+ --hub-text: #f5f6f8;+ --hub-body: #e1e3e6;+ --hub-secondary: #8e939c;+ --hub-muted: #6b7079;+ --hub-accent: #fb923c;+ --hub-on-accent: #170c04;+ --hub-green: #34d399;+ --hub-red: #ff453a;+}++body.hub-window {+ background: #000;+ color: var(--hub-text);+ font: 400 13px/1.45 var(--font);+ -webkit-font-smoothing: antialiased;+ height: 100vh;+ overflow: hidden;+}++#hub {+ display: flex;+ height: 100vh;+}++/* ── Sidebar ──────────────────────────────────────────────────────────────── */++.hub-side {+ width: 228px;+ flex: 0 0 228px;+ display: flex;+ flex-direction: column;+ gap: 3px;+ padding: 18px 12px 12px;+ overflow-y: auto;+}++.hub-brand {+ display: flex;+ align-items: center;+ gap: 10px;+ padding: 4px 8px 14px;+ font: 700 18px var(--font);+}++.hub-brand canvas {+ width: 28px;+ height: 28px;+}++.hub-group {+ font: 700 10.5px var(--font);+ letter-spacing: 0.12em;+ text-transform: uppercase;+ color: var(--hub-muted);+ padding: 12px 10px 6px;+}++.hub-item {+ display: flex;+ align-items: center;+ gap: 11px;+ width: 100%;+ padding: 0 12px;+ height: 32px;+ border-radius: 9px;+ background: transparent;+ color: #c7cad0;+ font: 500 13.5px var(--font);+ text-align: start;+}++.hub-item svg {+ width: 17px;+ height: 17px;+ flex: 0 0 17px;+ fill: none;+ stroke: currentColor;+ stroke-width: 1.7;+ stroke-linecap: round;+ stroke-linejoin: round;+ opacity: 0.9;+}++.hub-item:hover:not(:disabled) {+ background: rgba(255, 255, 255, 0.05);+ transform: none;+}++.hub-item:active:not(:disabled) {+ transform: none;+}++.hub-item.on {+ background: rgba(255, 255, 255, 0.09);+ color: var(--hub-text);+ font-weight: 600;+}++.hub-side .spacer {+ flex: 1 1 auto;+ min-height: 12px;+}++.hub-status {+ display: flex;+ align-items: center;+ gap: 8px;+ padding: 10px 12px;+ border-radius: 11px;+ background: rgba(255, 255, 255, 0.05);+ color: var(--hub-secondary);+ font-size: 12px;+ line-height: 1.3;+}++.hub-status .dot {+ width: 7px;+ height: 7px;+}++.hub-version {+ color: var(--hub-muted);+ font-size: 11px;+ padding: 8px 12px 0;+}++/* ── Panel ────────────────────────────────────────────────────────────────── */++.hub-panel {+ flex: 1 1 auto;+ min-width: 0;+ margin: 12px 12px 12px 0;+ border-radius: 22px;+ background: var(--hub-panel);+ border: 1px solid var(--hub-line);+ overflow: hidden;+ display: flex;+ flex-direction: column;+}++.hub-scroll {+ flex: 1 1 auto;+ overflow-y: auto;+ padding: 24px 28px 28px;+}++.hub-page {+ max-width: 1100px;+ display: flex;+ flex-direction: column;+ gap: 18px;+}++/* The notch's pages keep their sections as they ship, at the panel's width. */+.hub-page #settings-root {+ max-width: none;+ margin: 0;+ padding: 0;+}++/* ── Hero band ────────────────────────────────────────────────────────────── */++.hub-hero {+ position: relative;+ height: 170px;+ border-radius: 18px;+ overflow: hidden;+ flex: 0 0 auto;+ border: 1px solid var(--hero-line, rgba(255, 255, 255, 0.1));+}++.hub-hero.compact {+ height: 116px;+}++.hub-hero canvas.backdrop,+.hub-hero canvas.troupe {+ position: absolute;+ inset: 0;+ width: 100%;+ height: 100%;+}++.hub-hero .copy {+ position: relative;+ display: flex;+ flex-direction: column;+ gap: 8px;+ padding: 26px;+ max-width: calc(100% - 340px);+ height: 100%;+ pointer-events: none;+}++.hub-hero.compact .copy {+ padding: 20px;+}++.hub-hero .copy > * {+ pointer-events: auto;+}++.hub-hero h1 {+ font: 700 30px var(--font);+ letter-spacing: -0.02em;+ line-height: 1.1;+}++.hub-hero.compact h1 {+ font-size: 24px;+}++.hub-hero p {+ font-size: 14px;+ color: #b7bbc2;+ max-width: 420px;+}++.hub-hero .actions {+ margin-top: auto;+ display: flex;+ gap: 8px;+ align-items: center;+}++/* ── Cards, rows and controls of the Flow pages ───────────────────────────── */++.hub-label {+ font: 700 11px var(--font);+ letter-spacing: 0.12em;+ text-transform: uppercase;+ color: var(--hub-muted);+ padding: 4px 2px 0;+}++.hub-card {+ background: var(--hub-card);+ border: 1px solid var(--hub-line);+ border-radius: 14px;+ padding: 18px;+ display: flex;+ flex-direction: column;+ gap: 12px;+}++.hub-row {+ display: flex;+ align-items: center;+ gap: 14px;+ min-height: 30px;+}++.hub-row .text {+ flex: 1 1 auto;+ display: flex;+ flex-direction: column;+ gap: 3px;+ min-width: 0;+}++.hub-row .title {+ font: 600 13.5px var(--font);+}++.hub-row .detail,+.hub-note {+ font-size: 12px;+ color: var(--hub-secondary);+}++.hub-divider {+ height: 1px;+ background: var(--hub-line);+ margin: 0 -2px;+}++.hub-keycap {+ font: 600 12.5px var(--font);+ padding: 0 10px;+ height: 26px;+ display: inline-flex;+ align-items: center;+ border-radius: 7px;+ background: rgba(255, 255, 255, 0.08);+ white-space: nowrap;+}++button.hub-btn {+ border-radius: 10px;+ padding: 8px 14px;+ font: 600 12.5px var(--font);+ background: rgba(255, 255, 255, 0.09);+ color: var(--hub-text);+}++button.hub-btn.primary {+ background: var(--hub-accent);+ color: var(--hub-on-accent);+}++button.hub-btn.primary:hover:not(:disabled) {+ background: #fdab63;+}++button.hub-btn.danger {+ background: rgba(255, 69, 58, 0.14);+ color: #ff8a80;+}++button.hub-btn.small {+ padding: 5px 10px;+ font-size: 12px;+}++button.hub-icon {+ width: 30px;+ height: 30px;+ padding: 0;+ border-radius: 8px;+ display: inline-flex;+ align-items: center;+ justify-content: center;+ background: rgba(255, 255, 255, 0.06);+ color: #c7cad0;+}++button.hub-icon svg {+ width: 15px;+ height: 15px;+ fill: none;+ stroke: currentColor;+ stroke-width: 1.8;+ stroke-linecap: round;+ stroke-linejoin: round;+}++.hub-input,+.hub-select,+.hub-textarea {+ font: 400 13px var(--font);+ color: var(--hub-text);+ background: var(--hub-field);+ border: 1px solid rgba(255, 255, 255, 0.08);+ border-radius: 9px;+ padding: 7px 10px;+ outline: none;+}++.hub-input:focus,+.hub-textarea:focus,+.hub-select:focus {+ border-color: rgba(251, 146, 60, 0.6);+}++.hub-textarea {+ resize: vertical;+ min-height: 80px;+ width: 100%;+}++.hub-segmented {+ display: inline-flex;+ padding: 2px;+ border-radius: 9px;+ background: rgba(255, 255, 255, 0.06);+ gap: 2px;+}++.hub-segmented button {+ border-radius: 7px;+ padding: 5px 14px;+ background: transparent;+ color: #c7cad0;+ font: 500 12.5px var(--font);+}++.hub-segmented button.on {+ background: rgba(255, 255, 255, 0.14);+ color: var(--hub-text);+}++.hub-radio {+ width: 17px;+ height: 17px;+ flex: 0 0 17px;+ border-radius: 50%;+ border: 1.5px solid #5a5f68;+}++.hub-radio.on {+ border: 5px solid var(--hub-accent);+}++.hub-progress {+ width: 120px;+ height: 6px;+ border-radius: 3px;+ background: rgba(255, 255, 255, 0.1);+ overflow: hidden;+}++.hub-progress > i {+ display: block;+ height: 100%;+ background: var(--hub-accent);+ border-radius: 3px;+}++.hub-ok {+ color: var(--hub-green);+ font-weight: 600;+ display: inline-flex;+ align-items: center;+ gap: 6px;+}++.hub-warn {+ border-radius: 12px;+ padding: 12px 14px;+ background: rgba(247, 179, 43, 0.1);+ border: 1px solid rgba(247, 179, 43, 0.22);+ color: #f5d28a;+ font-size: 12.5px;+}++/* ── Dictation page ───────────────────────────────────────────────────────── */++.hub-columns {+ display: grid;+ grid-template-columns: minmax(0, 1fr) 270px;+ gap: 20px;+ align-items: start;+}++.hub-history-head {+ display: flex;+ align-items: center;+ gap: 12px;+}++.hub-history-head .hub-input {+ margin-inline-start: auto;+ width: 210px;+}++.hub-day {+ font: 600 12.5px var(--font);+ color: var(--hub-secondary);+ padding: 6px 2px 0;+}++.hub-entries {+ background: var(--hub-card);+ border: 1px solid var(--hub-line);+ border-radius: 14px;+ overflow: hidden;+}++.hub-entry {+ display: flex;+ gap: 18px;+ padding: 16px 18px;+ border-top: 1px solid var(--hub-line);+}++.hub-entry:first-child {+ border-top: 0;+}++.hub-entry .when {+ width: 70px;+ flex: 0 0 70px;+ display: flex;+ flex-direction: column;+ gap: 6px;+ color: var(--hub-muted);+ font-size: 12px;+}++.hub-tag {+ display: inline-block;+ font-size: 11px;+ padding: 1px 7px;+ border-radius: 5px;+ background: rgba(255, 255, 255, 0.07);+ color: var(--hub-secondary);+ max-width: 100%;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ align-self: flex-start;+}++.hub-entry .words {+ flex: 1 1 auto;+ font-size: 14px;+ line-height: 1.5;+ color: var(--hub-body);+ white-space: pre-wrap;+ word-break: break-word;+ min-width: 0;+}++.hub-entry .tools {+ display: flex;+ gap: 6px;+ align-self: flex-start;+ opacity: 0.55;+}++.hub-entry:hover .tools {+ opacity: 1;+}++.hub-big-number {+ display: flex;+ align-items: baseline;+ gap: 9px;+}++.hub-big-number b {+ font: 700 32px var(--font);+ letter-spacing: -0.02em;+}++.hub-big-number span {+ color: var(--hub-secondary);+ font-size: 13px;+}++/* A card in a colour: the band's black and particles. */+.hub-glow {+ position: relative;+ border-radius: 14px;+ overflow: hidden;+ border: 1px solid var(--glow-line, rgba(255, 255, 255, 0.1));+}++.hub-glow canvas {+ position: absolute;+ inset: 0;+ width: 100%;+ height: 100%;+}++.hub-glow .inner {+ position: relative;+ padding: 20px;+ display: flex;+ flex-direction: column;+ gap: 10px;+}++.hub-link {+ background: none;+ padding: 0;+ color: var(--hub-accent);+ font: 600 13px var(--font);+ align-self: flex-start;+}++.hub-link:hover:not(:disabled) {+ background: none;+ text-decoration: underline;+}++.hub-empty {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: 10px;+ padding: 26px 20px;+ color: var(--hub-secondary);+ font-size: 13.5px;+ text-align: center;+}++.hub-empty canvas {+ width: 64px;+ height: 64px;+}++/* ── Statistics ───────────────────────────────────────────────────────────── */++.hub-stat-row {+ display: grid;+ grid-template-columns: repeat(4, minmax(0, 1fr));+ gap: 14px;+}++.hub-stat {+ background: var(--hub-card);+ border: 1px solid var(--hub-line);+ border-radius: 14px;+ padding: 16px 18px;+ display: flex;+ flex-direction: column;+ gap: 6px;+}++.hub-stat .label {+ color: var(--hub-secondary);+ font-size: 12.5px;+}++.hub-stat b {+ font: 700 28px var(--font);+ letter-spacing: -0.02em;+}++.hub-stat .sub {+ color: var(--hub-muted);+ font-size: 12px;+}++.hub-chart-row {+ display: grid;+ grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);+ gap: 14px;+ align-items: start;+}++.hub-bars {+ display: flex;+ align-items: flex-end;+ gap: 4px;+ height: 180px;+ border-bottom: 1px dashed rgba(251, 146, 60, 0.35);+}++.hub-bars i {+ flex: 1 1 0;+ border-radius: 4px 4px 1px 1px;+ background: var(--hub-accent);+ min-height: 0;+}++.hub-bars i.zero {+ background: transparent;+}++.hub-axis {+ display: flex;+ justify-content: space-between;+ color: var(--hub-muted);+ font-size: 11px;+}++.hub-app-bar {+ display: flex;+ flex-direction: column;+ gap: 5px;+}++.hub-app-bar .top {+ display: flex;+ justify-content: space-between;+ font-size: 13px;+}++.hub-app-bar .top span {+ color: var(--hub-secondary);+}++.hub-app-bar .track {+ height: 5px;+ border-radius: 3px;+ background: rgba(255, 255, 255, 0.08);+ overflow: hidden;+}++.hub-app-bar .track i {+ display: block;+ height: 100%;+ background: var(--hub-accent);+ border-radius: 3px;+}++/* ── Dictionary, snippets and styles ──────────────────────────────────────── */++.hub-chips {+ display: flex;+ flex-wrap: wrap;+ gap: 8px;+}++.hub-chip {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ padding: 5px 6px 5px 12px;+ border-radius: 999px;+ background: rgba(255, 255, 255, 0.07);+ font-size: 13px;+}++.hub-chip button {+ width: 20px;+ height: 20px;+ padding: 0;+ border-radius: 50%;+ background: transparent;+ color: var(--hub-secondary);+ display: inline-flex;+ align-items: center;+ justify-content: center;+}++.hub-chip button svg {+ width: 12px;+ height: 12px;+ stroke: currentColor;+ stroke-width: 2;+ fill: none;+}++.hub-pair {+ display: grid;+ grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr) auto;+ gap: 10px;+ align-items: center;+}++.hub-pair .arrow {+ color: var(--hub-muted);+ text-align: center;+}++.hub-list-row {+ display: flex;+ align-items: center;+ gap: 12px;+ padding: 10px 0;+ border-top: 1px solid var(--hub-line);+}++.hub-list-row:first-child {+ border-top: 0;+}++.hub-list-row .grow {+ flex: 1 1 auto;+ min-width: 0;+}++.hub-snippet-text {+ color: var(--hub-secondary);+ font-size: 12.5px;+ white-space: pre-wrap;+ overflow: hidden;+ display: -webkit-box;+ -webkit-line-clamp: 2;+ -webkit-box-orient: vertical;+}++.dimmed {+ opacity: 0.5;+}++/* ── Notetaker ────────────────────────────────────────────────────────────── */++.hub-notes {+ display: grid;+ grid-template-columns: 280px minmax(0, 1fr);+ min-height: 420px;+ border-radius: 14px;+ overflow: hidden;+ border: 1px solid var(--hub-line);+ background: rgba(0, 0, 0, 0.18);+}++.hub-notes-list {+ border-inline-end: 1px solid var(--hub-line);+ padding: 14px;+ display: flex;+ flex-direction: column;+ gap: 6px;+}++.hub-note-item {+ text-align: start;+ border-radius: 10px;+ padding: 10px 12px;+ background: transparent;+ display: flex;+ flex-direction: column;+ gap: 3px;+ color: var(--hub-text);+}++.hub-note-item.on {+ background: rgba(255, 255, 255, 0.08);+}++.hub-note-item .t {+ font: 600 13.5px var(--font);+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+}++.hub-note-item .m {+ color: var(--hub-muted);+ font-size: 12px;+}++.hub-note-detail {+ padding: 20px 24px;+ display: flex;+ flex-direction: column;+ gap: 14px;+ min-width: 0;+}++.hub-note-detail h2 {+ font: 700 22px var(--font);+ letter-spacing: -0.01em;+}++.hub-speakers {+ display: flex;+ flex-wrap: wrap;+ gap: 8px;+}++.hub-speaker {+ display: inline-flex;+ align-items: center;+ gap: 7px;+ padding: 4px 10px 4px 4px;+ border-radius: 999px;+ background: rgba(255, 255, 255, 0.06);+ font-size: 13px;+ color: var(--hub-text);+}++.hub-speaker .av {+ width: 22px;+ height: 22px;+ border-radius: 50%;+ display: inline-flex;+ align-items: center;+ justify-content: center;+ font: 700 11px var(--font);+ color: #0b0c0e;+}++.hub-line {+ display: grid;+ grid-template-columns: 56px minmax(0, 1fr);+ gap: 12px;+ padding: 6px 0;+}++.hub-line .ts {+ color: var(--hub-muted);+ font-size: 12px;+ padding-top: 2px;+}++.hub-line .who {+ font: 600 12.5px var(--font);+}++.hub-line .said {+ font-size: 14px;+ color: var(--hub-body);+ line-height: 1.5;+}++.hub-todo {+ display: flex;+ gap: 10px;+ align-items: flex-start;+ font-size: 13.5px;+}++.hub-todo input {+ margin-top: 3px;+ accent-color: var(--hub-accent);+}++.hub-todo .who {+ color: var(--hub-secondary);+ font-size: 12px;+}++.hub-rec {+ display: inline-flex;+ width: 8px;+ height: 8px;+ border-radius: 50%;+ background: var(--hub-red);+ box-shadow: 0 0 6px rgba(255, 69, 58, 0.7);+}++@media (max-width: 1000px) {+ .hub-columns {+ grid-template-columns: minmax(0, 1fr);+ }+ .hub-stat-row {+ grid-template-columns: repeat(2, minmax(0, 1fr));+ }+ .hub-chart-row {+ grid-template-columns: minmax(0, 1fr);+ }+ .hub-hero .copy {+ max-width: 100%;+ }+}diff --git a/windows/src/hub/pages.ts b/windows/src/hub/pages.tsnew file mode 100644index 00000000..afbeb50b--- /dev/null+++ b/windows/src/hub/pages.ts@@ -0,0 +1,20 @@+// The Flow pages of the Coucou window, by id (shell.ts draws the Notch ones+// from the island's settings).++import type { FlowPageRenderer, PageId } from "./shell";+import { dictationPage } from "./pages/dictation";+import { notesPage } from "./pages/notes";+import { insightsPage } from "./pages/insights";+import { dictionaryPage, snippetsPage } from "./pages/words";+import { stylesPage } from "./pages/styles";+import { flowSettingsPage } from "./pages/flowsettings";++export const FLOW_PAGE_RENDERERS: Partial<Record<PageId, FlowPageRenderer>> = {+ dictation: dictationPage,+ notes: notesPage,+ insights: insightsPage,+ dictionary: dictionaryPage,+ snippets: snippetsPage,+ styles: stylesPage,+ flowsettings: flowSettingsPage,+};diff --git a/windows/src/hub/pages/dictation.ts b/windows/src/hub/pages/dictation.tsnew file mode 100644index 00000000..42de6241--- /dev/null+++ b/windows/src/hub/pages/dictation.ts@@ -0,0 +1,148 @@+// Dictation: today's dictations with search and copy, the big numbers, and the+// way to the Notetaker. Until dictation is set up, the steps to get there.+// Port of FlowHubHome.swift.++import { h, clear } from "../../views/dom";+import { t } from "../../i18n/i18n";+import { onEvent } from "../../core/bridge";+import { FlowBridge, type FlowEntry, type FlowStats } from "../../core/flow";+import type { HubContext } from "../shell";+import { emptyState, glowCard } from "../hero";+import { button, card, icon, iconButton, keyLabel, label, number, row, shortCount, toggle } from "../ui";+import { modelsControl } from "./flowsettings";++function dayKey(ms: number): string {+ const d = new Date(ms);+ return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`;+}++function dayTitle(ms: number): string {+ const today = new Date();+ const yesterday = new Date(Date.now() - 86_400_000);+ if (dayKey(ms) === dayKey(today.getTime())) return t("Today");+ if (dayKey(ms) === dayKey(yesterday.getTime())) return t("Yesterday");+ return new Date(ms).toLocaleDateString(document.documentElement.lang || undefined, { weekday: "long", day: "numeric", month: "long" });+}++function time(ms: number): string {+ return new Date(ms).toLocaleTimeString(document.documentElement.lang || undefined, { hour: "2-digit", minute: "2-digit" });+}++export async function dictationPage(page: HTMLElement, ctx: HubContext) {+ const status = ctx.status;+ const key = keyLabel(status.prefs.key, status.platform);+ const ready = status.prefs.enabled && status.models.parakeet.state === "ready";++ const record = button(t("Record a call"), () => {+ void FlowBridge.startNote().then(() => ctx.navigate("notes"), (err) => alertLine.replaceChildren(String(err)));+ }, "primary");+ record.prepend(h("span", { class: "hub-rec", style: "background:#170c04;box-shadow:none;margin-inline-end:8px" }));+ const alertLine = h("div", { class: "hub-note" });+ const hello = status.userName ? t("Hello {0}", { 0: status.userName }) : t("Hello");+ page.append(ctx.hero("dictation", hello, t("Hold {0} anywhere, speak, let go: it's pasted.", { 0: key }), [record]));+ page.append(alertLine);++ if (!ready) page.append(setup(ctx));++ const [history, stats] = await Promise.all([FlowBridge.history(), FlowBridge.stats()]);+ let entries: FlowEntry[] = history ?? [];+ let query = "";++ const list = h("div", { style: "display:flex;flex-direction:column;gap:10px" });+ const search = h("input", { class: "hub-input", placeholder: t("Search dictations"), type: "search" }) as HTMLInputElement;+ search.addEventListener("input", () => {+ query = search.value.trim().toLowerCase();+ draw();+ });++ function draw() {+ clear(list);+ if (status.prefs.keepDays === 0) {+ list.append(emptyState(t("The history is off. Turn it on in Settings → Privacy.")));+ return;+ }+ const shown = query ? entries.filter((e) => e.text.toLowerCase().includes(query)) : entries;+ if (shown.length === 0) {+ list.append(emptyState(query ? t("No dictation matches.") : t("Your dictations will show here. Hold {0} in any app and speak.", { 0: key })));+ return;+ }+ let group: HTMLElement | null = null;+ let groupDay = "";+ for (const e of shown.slice(0, 300)) {+ const d = dayKey(e.date);+ if (d !== groupDay) {+ groupDay = d;+ list.append(h("div", { class: "hub-day", text: dayTitle(e.date) }));+ group = h("div", { class: "hub-entries" });+ list.append(group);+ }+ const when = h("div", { class: "when" }, h("span", { text: time(e.date) }));+ if (e.app) when.append(h("span", { class: "hub-tag", text: e.app, title: e.app }));+ const tools = h("div", { class: "tools" },+ iconButton("copy", t("Copy"), () => void FlowBridge.copy(e.text)),+ iconButton("trash", t("Delete"), () => {+ entries = entries.filter((x) => x.id !== e.id);+ void FlowBridge.deleteEntry(e.id);+ draw();+ }),+ );+ group!.append(h("div", { class: "hub-entry" }, when, h("div", { class: "words", text: e.text }), tools));+ }+ }++ const left = h("div", { style: "display:flex;flex-direction:column;gap:10px;min-width:0" },+ h("div", { class: "hub-history-head" }, label(t("History")), search),+ list,+ );+ const right = h("div", { style: "display:flex;flex-direction:column;gap:14px" }, numbers(stats), promo(ctx));+ page.append(h("div", { class: "hub-columns" }, left, right));+ draw();++ const unlisten = await onEvent<FlowEntry | null>("flow-history", (entry) => {+ if (!entry) return;+ entries = [entry, ...entries.filter((x) => x.id !== entry.id)];+ draw();+ void FlowBridge.stats().then((s) => right.firstElementChild?.replaceWith(numbers(s)));+ });+ ctx.onLeave = () => unlisten();+}++function numbers(stats: FlowStats | null): HTMLElement {+ const all = stats?.all;+ const big = (value: string, text: string) => h("div", { class: "hub-big-number" }, h("b", { text: value }), h("span", { text }));+ const ok = h("div", { class: "hub-ok" });+ ok.append(icon("check"), h("span", { text: t("Unlimited and free") }));+ ok.querySelector("svg")!.setAttribute("style", "width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2.2");+ return card(+ big(shortCount(all?.words ?? 0), t("words dictated")),+ big(number(all?.wordsPerMinute ?? 0), t("words/min")),+ big(number(stats?.streak ?? 0), t("days in a row")),+ h("div", { class: "hub-divider" }),+ ok,+ );+}++function promo(ctx: HubContext): HTMLElement {+ return glowCard(+ "#FB923C",+ h("div", { style: "font:700 15px var(--font)", text: t("The Notetaker") }),+ h("div", { class: "hub-note", style: "color:#b7bbc2", text: t("Your calls transcribed person by person, with a summary and the to-dos. No bot in the meeting.") }),+ h("button", { class: "hub-link", text: t("Open the Notetaker →"), onclick: () => ctx.navigate("notes") }),+ );+}++/** Until dictation works: turn it on, download the model. */+function setup(ctx: HubContext): HTMLElement {+ const status = ctx.status;+ const key = keyLabel(status.prefs.key, status.platform);+ const body = h("div", { style: "display:flex;flex-direction:column;gap:12px" });+ body.append(+ h("div", { style: "font:700 17px var(--font)", text: t("Dictate anywhere on your computer") }),+ h("div", { class: "hub-note", style: "color:#b7bbc2;font-size:13px", text: t("Hold {0} in any app, speak, let go: your words are pasted where you type.", { 0: key }) }),+ );+ body.append(row(t("Turn on dictation"), null, toggle(status.prefs.enabled, (on) => {+ void ctx.setPrefs((p) => (p.enabled = on)).then(() => ctx.navigate("dictation"));+ })));+ body.append(row(t("Parakeet, on your computer"), t("The most accurate, offline, 25 languages. Downloaded once (about {0} MB).", { 0: number(status.models.downloadMb) }), modelsControl(ctx, () => ctx.navigate("dictation"))));+ return glowCard("#FB923C", body);+}diff --git a/windows/src/hub/pages/flowsettings.ts b/windows/src/hub/pages/flowsettings.tsnew file mode 100644index 00000000..bf6be770--- /dev/null+++ b/windows/src/hub/pages/flowsettings.ts@@ -0,0 +1,152 @@+// Flow → Settings: the key, where the pill is, the microphone, the voice+// model, the Notetaker's summaries, the window and the history. Port of+// FlowHubSettings.swift.++import { h, clear } from "../../views/dom";+import { t } from "../../i18n/i18n";+import { onEvent } from "../../core/bridge";+import { FlowBridge, type Edge, type FlowKey, type ModelsStatus } from "../../core/flow";+import type { HubContext } from "../shell";+import { button, card, divider, keyKeycap, keycap, label, number, row, segmented, select, toggle } from "../ui";++/** Download / progress / installed, for the voice model. Redraws itself. */+export function modelsControl(ctx: HubContext, onReady?: () => void): HTMLElement {+ const el = h("div", { style: "display:flex;align-items:center;gap:8px" });+ let confirming = false;+ const draw = (models: ModelsStatus) => {+ clear(el);+ const m = models.parakeet;+ if (m.state === "missing") {+ el.append(button(t("Download"), () => void FlowBridge.download(), "primary"));+ } else if (m.state === "downloading") {+ const bar = h("div", { class: "hub-progress" }, h("i", { style: `width:${Math.round(m.fraction * 100)}%` }));+ el.append(bar, h("span", { class: "hub-note", text: `${Math.round(m.fraction * 100)} %` }));+ } else if (m.state === "failed") {+ el.append(h("span", { class: "hub-note", text: m.error, title: m.error, style: "max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap" }));+ el.append(button(t("Retry"), () => void FlowBridge.download()));+ } else if (confirming) {+ el.append(+ button(t("Remove the models"), () => {+ confirming = false;+ void FlowBridge.removeModels();+ }, "danger", true),+ button(t("Cancel"), () => {+ confirming = false;+ draw(ctx.status.models);+ }, "", true),+ );+ } else {+ const ok = h("button", { class: "hub-link", style: "color:var(--hub-green)", text: `✓ ${t("Installed")}`, title: t("Remove the models") });+ ok.addEventListener("click", () => {+ confirming = true;+ draw(ctx.status.models);+ });+ el.append(ok);+ }+ };+ draw(ctx.status.models);+ void onEvent<ModelsStatus>("speech-models", (models) => {+ if (!el.isConnected) return;+ const wasReady = ctx.status.models.parakeet.state === "ready";+ ctx.status.models = models;+ draw(models);+ if (!wasReady && models.parakeet.state === "ready") onReady?.();+ });+ return el;+}++export async function flowSettingsPage(page: HTMLElement, ctx: HubContext) {+ const status = await ctx.refresh();+ const prefs = status.prefs;+ page.append(ctx.hero("flowsettings", t("Settings"), null));++ // ── Keys ──+ const keys: [FlowKey, string][] = [+ ["right_ctrl", t("Right {0}", { 0: "Ctrl" })],+ ["right_alt", t("Right {0}", { 0: "Alt" })],+ ["right_shift", t("Right {0}", { 0: "Shift" })],+ ["left_ctrl_super", status.platform === "windows" ? "Ctrl + Win" : "Ctrl + Super"],+ ];+ const edges: [Edge, string][] = [["bottom", t("Bottom")], ["left", t("Left")], ["right", t("Right")]];+ page.append(label(t("Keys")));+ const keysCard = card(+ row(t("Hold a key to dictate anywhere"), null, toggle(prefs.enabled, (on) => void ctx.setPrefs((p) => (p.enabled = on)))),+ divider(),+ row(t("Hold to dictate"), prefs.key === "right_alt" ? t("On a keyboard with AltGr, the right Alt types characters: pick another key.") : null,+ select(keys, prefs.key, (key) => void ctx.setPrefs((p) => (p.key = key)).then(() => ctx.navigate("flowsettings")))),+ divider(),+ row(t("Where the pill is"), null, segmented(edges, prefs.edge, (edge) => void ctx.setPrefs((p) => (p.edge = edge)))),+ divider(),+ row(t("Hands-free"), t("Tap twice, speak as long as you like, tap once to paste."), keyKeycap(prefs.key, status.platform, true)),+ divider(),+ row(t("Paste the last dictation again"), t("When the words went to the wrong place."), button(t("Paste again"), () => void FlowBridge.pasteAgain(), "", true)),+ divider(),+ row(t("Cancel a dictation"), null, keycap(t("Esc"))),+ );+ if (status.keys === "wayland") {+ keysCard.append(h("div", {+ class: "hub-warn",+ text: t("Wayland lets no app watch the keyboard: click the microphone on the pill to dictate hands-free, then ✓ to finish. Your words are copied: paste them with Ctrl+V."),+ }));+ } else if (status.keys !== "ok") {+ keysCard.append(h("div", { class: "hub-warn", text: t("Coucou can't watch the keyboard here: use the pill's microphone to dictate.") }));+ }+ page.append(keysCard);++ // ── Microphone ──+ page.append(label(t("Microphone")));+ const mics: [string, string][] = [["", t("System default")], ...status.mics.map((m): [string, string] => [m.name, m.name])];+ if (prefs.mic && !mics.some(([id]) => id === prefs.mic)) mics.push([prefs.mic, prefs.mic]);+ page.append(card(row(t("Microphone"), t("The one Coucou listens to for dictation and calls."), select(mics, prefs.mic, (mic) => void ctx.setPrefs((p) => (p.mic = mic))))));++ // ── Recognition ──+ page.append(label(t("Recognition")));+ page.append(card(+ row(t("Parakeet, on your computer"), t("The most accurate, offline, 25 languages. Downloaded once (about {0} MB).", { 0: number(status.models.downloadMb) }), modelsControl(ctx)),+ h("div", { class: "hub-note", text: t("Your voice never leaves this computer: Parakeet turns it into text here, and the recording is dropped as soon as it is pasted.") }),+ ));++ // ── Notetaker ──+ page.append(label(t("Notetaker")));+ page.append(card(+ row(t("Summaries"), null, select([["claude", t("Claude (your key)")], ["off", t("No summary")]], prefs.summaryEngine, (engine) => void ctx.setPrefs((p) => (p.summaryEngine = engine)))),+ h("div", { class: "hub-note", text: t("With Claude, the transcript (never the audio) goes to Anthropic with your key from Notch → Chat.") }),+ divider(),+ h("div", { class: "hub-note", text: t("Everything stays on this computer. Tell the people in the call that you are recording.") }),+ ));++ // ── App ──+ page.append(label(t("App")));+ page.append(card(+ row(t("Open this window when you open Coucou"), t("Not when Coucou starts with the computer."), toggle(prefs.openAtLaunch, (on) => void ctx.setPrefs((p) => (p.openAtLaunch = on)))),+ ));++ // ── Privacy ──+ page.append(label(t("Privacy")));+ const keep: [string, string][] = [["0", t("Don't keep")], ["7", t("7 days")], ["30", t("30 days")], ["365", t("1 year")], ["-1", t("Forever")]];+ const confirmRow = h("div", { class: "hub-row" });+ const erase = () => {+ clear(confirmRow);+ confirmRow.append(+ button(t("Erase the history"), () => void FlowBridge.clear(false), "", true),+ button(t("Erase everything"), () => {+ clear(confirmRow);+ confirmRow.append(+ h("span", { class: "hub-note", style: "flex:1", text: t("Erase the history and the statistics?") }),+ button(t("Erase everything"), () => {+ void FlowBridge.clear(true);+ erase();+ }, "danger", true),+ button(t("Cancel"), erase, "", true),+ );+ }, "", true),+ );+ };+ erase();+ page.append(card(+ row(t("Keep the history"), null, select(keep, String(prefs.keepDays), (v) => void ctx.setPrefs((p) => (p.keepDays = Number(v))))),+ divider(),+ confirmRow,+ h("div", { class: "hub-note", text: t("The history, the statistics and your notes stay on this computer, in Coucou's folder. Dictations are never saved as audio; a call's audio is deleted as soon as its transcript is written.") }),+ ));+}diff --git a/windows/src/hub/pages/insights.ts b/windows/src/hub/pages/insights.tsnew file mode 100644index 00000000..a0c1f2c4--- /dev/null+++ b/windows/src/hub/pages/insights.ts@@ -0,0 +1,78 @@+// Statistics: words, time saved, speed, dictations, the words of each day and+// the apps you dictate in. Port of FlowHubInsights.swift.++import { h, clear } from "../../views/dom";+import { t } from "../../i18n/i18n";+import { FlowBridge, type FlowStats, type Totals } from "../../core/flow";+import type { HubContext } from "../shell";+import { emptyState } from "../hero";+import { number, segmented, shortCount } from "../ui";++type Period = "week" | "month" | "all";++function duration(minutes: number): string {+ const m = Math.round(minutes);+ if (m >= 60) return t("{0} h {1}", { 0: Math.floor(m / 60), 1: String(m % 60).padStart(2, "0") });+ return t("{0} min", { 0: m });+}++export async function insightsPage(page: HTMLElement, ctx: HubContext) {+ const stats: FlowStats | null = await FlowBridge.stats();+ let period: Period = "month";+ const body = h("div", { style: "display:flex;flex-direction:column;gap:14px" });+ const picker = segmented<Period>([["week", t("Week")], ["month", t("Month")], ["all", t("All")]], period, (p) => {+ period = p;+ draw();+ });+ page.append(ctx.hero("insights", t("Statistics"), t("What you dictated, how fast, and where."), [picker]), body);++ function stat(labelText: string, value: string, sub: string | null) {+ const el = h("div", { class: "hub-stat" }, h("div", { class: "label", text: labelText }), h("b", { text: value }));+ if (sub) el.append(h("div", { class: "sub", text: sub }));+ return el;+ }++ function draw() {+ clear(body);+ const totals: Totals = stats?.[period] ?? { words: 0, seconds: 0, dictations: 0, wordsPerMinute: 0, minutesSaved: 0 };+ body.append(h("div", { class: "hub-stat-row" },+ stat(t("Words dictated"), shortCount(totals.words), null),+ stat(t("Time saved"), duration(totals.minutesSaved), t("vs typing at 45 words/min")),+ stat(t("Speed"), number(totals.wordsPerMinute), t("words/min")),+ stat(t("Dictations"), number(totals.dictations), null),+ ));++ // Words per day, the last 30 days (or 7).+ const days = (stats?.daily ?? []).slice(period === "week" ? -7 : -30);+ const max = Math.max(1, ...days.map(([, w]) => w));+ const bars = h("div", { class: "hub-bars" });+ for (const [key, words] of days) {+ const bar = h("i", { class: words === 0 ? "zero" : "", title: `${key} · ${number(words)}` });+ bar.style.height = `${Math.max(words === 0 ? 0 : 3, (words / max) * 100)}%`;+ bars.append(bar);+ }+ const axis = h("div", { class: "hub-axis" });+ days.forEach(([key], i) => {+ if (i % (period === "week" ? 1 : 5) === 0 || i === days.length - 1) axis.append(h("span", { text: String(Number(key.split("-")[2])) }));+ });+ const chart = h("div", { class: "hub-card" }, h("div", { class: "title", style: "font:700 14px var(--font)", text: t("Words per day") }), bars, axis);++ const apps = Object.entries(stats?.apps ?? {}).sort((a, b) => b[1] - a[1]).slice(0, 8);+ const total = apps.reduce((s, [, w]) => s + w, 0);+ const appsCard = h("div", { class: "hub-card" }, h("div", { class: "title", style: "font:700 14px var(--font)", text: t("Where you dictate") }));+ if (apps.length === 0) {+ appsCard.append(emptyState(t("Dictate in an app and it shows here."), "idle"));+ } else {+ for (const [name, words] of apps) {+ const share = total > 0 ? words / total : 0;+ appsCard.append(h("div", { class: "hub-app-bar" },+ h("div", { class: "top" }, h("b", { text: name, style: "font-weight:500" }), h("span", { text: `${Math.round(share * 100)} %` })),+ h("div", { class: "track" }, h("i", { style: `width:${Math.max(2, share * 100)}%` })),+ ));+ }+ }+ body.append(h("div", { class: "hub-chart-row" }, chart, appsCard));+ body.append(h("div", { class: "hub-note", text: t("Counted on this computer, never sent anywhere.") }));+ }+ draw();+}diff --git a/windows/src/hub/pages/notes.ts b/windows/src/hub/pages/notes.tsnew file mode 100644index 00000000..b55ca883--- /dev/null+++ b/windows/src/hub/pages/notes.ts@@ -0,0 +1,265 @@+// The Notetaker: your calls, transcribed person by person, with a summary,+// the key points and the to-dos. Port of FlowHubNotes.swift.++import { h, clear } from "../../views/dom";+import { t } from "../../i18n/i18n";+import { onEvent } from "../../core/bridge";+import { FlowBridge, clock, speakerColor, type Note, type NotesState } from "../../core/flow";+import type { HubContext } from "../shell";+import { emptyState, glowCard } from "../hero";+import { button, iconButton, segmented } from "../ui";+import { modelsControl } from "./flowsettings";++const lang = () => document.documentElement.lang || undefined;++function minutes(note: Note): number {+ const end = note.end ?? Date.now();+ return Math.max(1, Math.round((end - note.start) / 60_000));+}++export async function notesPage(page: HTMLElement, ctx: HubContext) {+ let state: NotesState = (await FlowBridge.notes()) ?? { notes: [], recording: null, working: [] };+ let selected: string | null = state.recording ?? state.notes[0]?.id ?? null;+ let tab: "summary" | "transcript" = "summary";+ let startError = "";++ page.append(ctx.hero("notes", t("Notetaker"), t("Your calls transcribed person by person, with a summary and the to-dos. No bot in the meeting."), [], true));+ if (ctx.status.models.parakeet.state !== "ready") {+ page.append(glowCard(+ "#3B9EFF",+ h("div", { style: "font:700 15px var(--font)", text: t("One download, then offline") }),+ h("div", { class: "hub-note", style: "color:#b7bbc2", text: t("Coucou writes your calls on this computer with Parakeet, and tells the voices apart with a second small model. Both are downloaded once (about {0} MB), then everything works offline.", { 0: ctx.status.models.downloadMb }) }),+ modelsControl(ctx, () => ctx.navigate("notes")),+ ));+ }++ const listEl = h("div", { class: "hub-notes-list" });+ const detail = h("div", { class: "hub-note-detail" });+ page.append(h("div", { class: "hub-notes" }, listEl, detail));++ const reload = async () => {+ state = (await FlowBridge.notes()) ?? state;+ if (selected && !state.notes.some((n) => n.id === selected)) selected = state.notes[0]?.id ?? null;+ drawList();+ drawDetail();+ };++ function recordButton(): HTMLElement {+ if (state.recording) {+ const rec = state.notes.find((n) => n.id === state.recording);+ const b = button(`■ ${t("Stop")} · ${clock((Date.now() - (rec?.start ?? Date.now())) / 1000)}`, () => void FlowBridge.stopNote(), "danger");+ b.dataset.ticking = "1";+ return b;+ }+ const b = button(t("Record a call"), () => {+ startError = "";+ FlowBridge.startNote().then((id) => {+ selected = id;+ void reload();+ }, (err) => {+ startError = String(err);+ drawList();+ });+ }, "primary");+ b.prepend(h("span", { class: "hub-rec", style: "background:#170c04;box-shadow:none;margin-inline-end:8px" }));+ return b;+ }++ function drawList() {+ clear(listEl);+ const rb = recordButton();+ rb.style.width = "100%";+ listEl.append(rb);+ if (startError) listEl.append(h("div", { class: "hub-warn", text: startError }));+ if (state.notes.length === 0) {+ listEl.append(h("div", { class: "hub-note", style: "padding:14px 4px", text: t("Your calls will show here. Click Record a call when one starts.") }));+ }+ let day = "";+ for (const n of state.notes) {+ const d = new Date(n.start).toDateString();+ if (d !== day) {+ day = d;+ const isToday = d === new Date().toDateString();+ listEl.append(h("div", { class: "hub-group", style: "padding:10px 6px 2px", text: isToday ? t("Today") : new Date(n.start).toLocaleDateString(lang(), { day: "numeric", month: "long" }) }));+ }+ const meta = n.status === "recording"+ ? t("Recording…")+ : state.working.includes(n.id) || n.status === "processing"+ ? t("writing…")+ : n.status === "failed"+ ? t("failed")+ : `${new Date(n.start).toLocaleTimeString(lang(), { hour: "2-digit", minute: "2-digit" })} · ${t("{0} min", { 0: minutes(n) })}`;+ const item = h("button", { class: n.id === selected ? "hub-note-item on" : "hub-note-item", onclick: () => {+ selected = n.id;+ drawList();+ drawDetail();+ } }, h("span", { class: "t", text: n.title }), h("span", { class: "m", text: meta }));+ if (n.status === "recording") item.querySelector(".m")!.prepend(h("span", { class: "hub-rec", style: "margin-inline-end:6px" }));+ listEl.append(item);+ }+ listEl.append(h("div", { style: "flex:1" }), h("div", { class: "hub-note", style: "padding:10px;border-radius:10px;background:rgba(255,255,255,0.04)", text: t("Everything stays on this computer. Tell the people in the call that you are recording.") }));+ }++ function drawDetail() {+ clear(detail);+ const note = state.notes.find((n) => n.id === selected);+ if (!note) {+ detail.append(emptyState(t("Your calls will show here. Click Record a call when one starts."), "sleeping", "#3B9EFF"));+ return;+ }+ // Title, renamed in place.+ const title = h("h2", { text: note.title, title: t("Edit"), style: "cursor:text" });+ title.addEventListener("click", () => {+ const input = h("input", { class: "hub-input", style: "font:700 20px var(--font);width:100%" }) as HTMLInputElement;+ input.value = note.title;+ const done = () => void FlowBridge.renameNote(note.id, input.value);+ input.addEventListener("keydown", (e) => {+ if (e.key === "Enter") done();+ if (e.key === "Escape") drawDetail();+ });+ input.addEventListener("blur", done);+ title.replaceWith(input);+ input.focus();+ input.select();+ });+ const when = new Date(note.start).toLocaleString(lang(), { weekday: "long", day: "numeric", month: "long", hour: "2-digit", minute: "2-digit" });+ const copied = h("span", { class: "hub-note" });+ const tools = h("div", { class: "hub-row", style: "gap:8px" });+ const confirm = h("div", {});+ if (note.status === "ready") {+ tools.append(button(t("Copy as Markdown"), async () => {+ const md = await FlowBridge.markdown(note.id);+ if (md && (await FlowBridge.copy(md))) {+ copied.textContent = t("Copied");+ setTimeout(() => (copied.textContent = ""), 1500);+ }+ }, "", true));+ tools.append(button(t("Export as Markdown…"), () => void FlowBridge.exportNote(note.id).catch(() => {}), "", true));+ }+ if (note.status !== "recording") {+ tools.append(iconButton("trash", t("Delete"), () => {+ clear(confirm);+ confirm.append(h("div", { class: "hub-warn", style: "display:flex;align-items:center;gap:10px" },+ h("span", { style: "flex:1", text: t("Delete this call and its notes?") }),+ button(t("Delete"), () => void FlowBridge.deleteNote(note.id), "danger", true),+ button(t("Cancel"), () => clear(confirm), "", true),+ ));+ }));+ }+ detail.append(+ h("div", { class: "hub-row", style: "align-items:flex-start" },+ h("div", { style: "flex:1;min-width:0;display:flex;flex-direction:column;gap:4px" }, title, h("div", { class: "hub-note", text: note.app ? `${when} · ${note.app}` : when })),+ copied, tools,+ ),+ confirm,+ );++ // The people, renamed with a click.+ if (note.speakers.length) {+ const people = h("div", { class: "hub-speakers" });+ for (const s of note.speakers) {+ const chip = h("button", { class: "hub-speaker", title: t("Who is it?") },+ h("span", { class: "av", style: `background:${speakerColor(s.color)}`, text: s.name.slice(0, 1).toUpperCase() }),+ h("span", { text: s.name }),+ );+ chip.addEventListener("click", () => {+ const input = h("input", { class: "hub-input", placeholder: t("Name"), style: "width:150px" }) as HTMLInputElement;+ input.value = s.name;+ const done = () => void FlowBridge.renameSpeaker(note.id, s.id, input.value);+ input.addEventListener("keydown", (e) => e.key === "Enter" && done());+ input.addEventListener("blur", done);+ chip.replaceWith(input);+ input.focus();+ input.select();+ });+ people.append(chip);+ }+ detail.append(people);+ }++ if (note.status === "recording") {+ detail.append(h("div", { class: "hub-row" }, h("span", { class: "hub-rec" }), h("b", { text: t("Live") })));+ detail.append(transcript(note, t("The words show up here as people speak.")));+ return;+ }+ if (note.status === "processing" || state.working.includes(note.id) && note.lines.length === 0) {+ detail.append(emptyState(t("Coucou is writing the transcript, person by person…"), "working", "#3B9EFF"));+ return;+ }+ if (note.status === "failed") {+ detail.append(h("div", { class: "hub-warn", text: `${t("The transcript could not be written.")} ${note.error ?? ""}` }));+ detail.append(button(t("Retry"), () => void FlowBridge.retryNote(note.id)));+ return;+ }+ if (note.lines.length === 0) {+ detail.append(emptyState(t("Nobody was heard in this recording."), "idle", "#3B9EFF"));+ return;+ }+ const tabs = segmented<"summary" | "transcript">([["summary", t("Summary")], ["transcript", t("Transcript")]], tab, (next) => {+ tab = next;+ drawDetail();+ });+ detail.append(h("div", {}, tabs));+ detail.append(tab === "summary" ? summary(note) : transcript(note, ""));+ }++ function summary(note: Note): HTMLElement {+ const el = h("div", { style: "display:flex;flex-direction:column;gap:14px" });+ const busy = state.working.includes(note.id);+ if (!note.summary && note.keyPoints.length === 0 && note.todos.length === 0) {+ el.append(h("div", { class: "hub-note", text: busy ? t("Writing the summary…") : t("No summary yet.") }));+ if (!busy) el.append(button(t("Write the summary"), () => void FlowBridge.summarize(note.id), "primary", true));+ return el;+ }+ if (note.summary) el.append(h("div", { class: "hub-card", style: "font-size:14px;line-height:1.55;color:var(--hub-body)", text: note.summary }));+ if (note.keyPoints.length) {+ const ul = h("ul", { style: "margin:0;padding-inline-start:20px;display:flex;flex-direction:column;gap:6px;font-size:13.5px" });+ for (const p of note.keyPoints) ul.append(h("li", { text: p }));+ el.append(h("div", { class: "hub-label", text: t("Key points") }), ul);+ }+ if (note.todos.length) {+ el.append(h("div", { class: "hub-label", text: t("To do") }));+ for (const todo of note.todos) {+ const box = h("input", { type: "checkbox" }) as HTMLInputElement;+ box.checked = todo.done;+ box.addEventListener("change", () => void FlowBridge.toggleTodo(note.id, todo.id));+ const extra = [todo.owner, todo.due].filter(Boolean).join(" · ");+ el.append(h("label", { class: "hub-todo" }, box, h("span", {}, h("span", { text: todo.text, style: todo.done ? "text-decoration:line-through;opacity:.6" : "" }), extra ? h("div", { class: "who", text: extra }) : null)));+ }+ }+ el.append(button(busy ? t("Writing the summary…") : t("Write the summary again"), () => void FlowBridge.summarize(note.id), "", true));+ return el;+ }++ function transcript(note: Note, empty: string): HTMLElement {+ const el = h("div", { style: "display:flex;flex-direction:column" });+ if (note.lines.length === 0 && empty) el.append(h("div", { class: "hub-note", text: empty }));+ for (const line of note.lines) {+ const s = note.speakers.find((x) => x.id === line.speaker);+ const name = s?.name ?? (line.speaker === "me" ? t("Me") : t("Others"));+ const color = s ? speakerColor(s.color) : line.speaker === "me" ? speakerColor(0) : speakerColor(1);+ el.append(h("div", { class: "hub-line" },+ h("span", { class: "ts", text: clock(line.start) }),+ h("div", {}, h("div", { class: "who", style: `color:${color}`, text: name }), h("div", { class: "said", text: line.text })),+ ));+ }+ return el;+ }++ drawList();+ drawDetail();+ const unlisten = await onEvent<string>("notes-changed", () => void reload());+ // The recording's clock in the list.+ const timer = window.setInterval(() => {+ if (!state.recording) return;+ const b = listEl.querySelector<HTMLElement>("[data-ticking]");+ if (!b) return;+ const next = recordButton();+ next.style.width = "100%";+ b.replaceWith(next);+ }, 1000);+ ctx.onLeave = () => {+ unlisten();+ window.clearInterval(timer);+ };+}diff --git a/windows/src/hub/pages/styles.ts b/windows/src/hub/pages/styles.tsnew file mode 100644index 00000000..16996abc--- /dev/null+++ b/windows/src/hub/pages/styles.ts@@ -0,0 +1,79 @@+// Styles: an optional clean-up by Claude (no "um", no repeats, corrections+// applied), as said, natural or polished, per app. Port of the styles part of+// FlowHubWords.swift.++import { h, clear } from "../../views/dom";+import { t } from "../../i18n/i18n";+import { FlowBridge, type AppStyle, type Style } from "../../core/flow";+import type { HubContext } from "../shell";+import { card, divider, iconButton, label, row, select, toggle } from "../ui";++export function styleOptions(): [Style, string][] {+ return [["verbatim", t("As said")], ["natural", t("Natural")], ["polished", t("Polished")]];+}++export async function stylesPage(page: HTMLElement, ctx: HubContext) {+ const status = await ctx.refresh();+ let styles: AppStyle[] = (await FlowBridge.styles()) ?? [];+ const save = () => void FlowBridge.setStyles(styles);+ page.append(ctx.hero("styles", t("Styles"), t("Claude cleans up what you say, in the style of the app you write in.")));++ const perApp = h("div", {});+ const drawApps = () => {+ clear(perApp);+ perApp.classList.toggle("dimmed", !ctx.status.prefs.cleanup);+ styles.forEach((s, i) => {+ if (i > 0) perApp.append(divider());+ perApp.append(row(s.name, null,+ select(styleOptions(), s.style, (style) => {+ styles = styles.map((x) => (x.id === s.id ? { ...x, style } : x));+ save();+ }),+ iconButton("x", t("Delete"), () => {+ styles = styles.filter((x) => x.id !== s.id);+ save();+ drawApps();+ }),+ ));+ });+ };++ const keyNote = h("div", { class: "hub-warn", text: t("The clean-up uses your Claude key. Add it in Notch → Chat.") });+ keyNote.style.display = status.hasClaudeKey ? "none" : "";+ const defaultRow = row(t("Other apps"), null, select(styleOptions(), status.prefs.defaultStyle, (style) => void ctx.setPrefs((p) => (p.defaultStyle = style))));+ page.append(card(+ row(t("Clean up with Claude"), t("Removes the “um”, the repeats and the corrections you made while speaking, and fixes the punctuation."),+ toggle(status.prefs.cleanup, (on) => {+ void ctx.setPrefs((p) => (p.cleanup = on));+ perApp.classList.toggle("dimmed", !on);+ })),+ keyNote,+ divider(),+ defaultRow,+ h("div", { class: "hub-note", text: t("With the clean-up on, the text (never your voice) goes to Anthropic with your Claude key. Off, everything stays on this computer.") }),+ ));++ // "Add an app": the apps with a window right now.+ const add = h("select", { class: "hub-select" }) as HTMLSelectElement;+ const fillAdd = async () => {+ clear(add);+ add.append(h("option", { value: "", text: `+ ${t("Add an app")}` }));+ const running = ((await FlowBridge.runningApps()) ?? []).filter((a) => !styles.some((s) => s.id === a.id));+ if (running.length === 0) add.append(h("option", { value: "-", text: t("No other open app"), disabled: true }));+ for (const a of running) add.append(h("option", { value: `${a.id}\n${a.name}`, text: a.name }));+ add.value = "";+ };+ add.addEventListener("focus", () => void fillAdd());+ add.addEventListener("change", () => {+ const [id, name] = add.value.split("\n");+ if (!id || id === "-") return;+ styles = [...styles, { id, name: name ?? id, style: ctx.status.prefs.defaultStyle }];+ save();+ drawApps();+ void fillAdd();+ });+ void fillAdd();+ page.append(h("div", { class: "hub-row" }, label(t("Style per app")), h("span", { class: "spacer", style: "flex:1" }), add));+ page.append(card(perApp));+ drawApps();+}diff --git a/windows/src/hub/pages/words.ts b/windows/src/hub/pages/words.tsnew file mode 100644index 00000000..d5515ebd--- /dev/null+++ b/windows/src/hub/pages/words.ts@@ -0,0 +1,155 @@+// Dictionary (names Coucou always spells right, and replacements) and+// Snippets (say a short phrase, paste a whole text). Port of FlowHubWords.swift.++import { h, clear } from "../../views/dom";+import { t } from "../../i18n/i18n";+import { FlowBridge, type Replacement, type Snippet } from "../../core/flow";+import type { HubContext } from "../shell";+import { emptyState } from "../hero";+import { button, card, icon, iconButton, label } from "../ui";++function newId(): string {+ return `${Date.now().toString(16)}-${Math.random().toString(16).slice(2, 8)}`;+}++function input(placeholder: string, onEnter?: () => void): HTMLInputElement {+ const el = h("input", { class: "hub-input", placeholder }) as HTMLInputElement;+ if (onEnter) el.addEventListener("keydown", (e) => e.key === "Enter" && onEnter());+ return el;+}++export async function dictionaryPage(page: HTMLElement, ctx: HubContext) {+ const data = (await FlowBridge.words()) ?? { words: [], replacements: [] };+ let words = data.words;+ let replacements: Replacement[] = data.replacements;+ const save = () => void FlowBridge.setWords({ words, replacements });+ page.append(ctx.hero("dictionary", t("Dictionary"), t("Names and words Coucou must always spell right.")));++ // ── Words ──+ const chips = h("div", { class: "hub-chips" });+ const wordInput = input(t("Add a word, e.g. Supabase"), () => addWord());+ const addWord = () => {+ const w = wordInput.value.trim();+ if (!w || words.some((x) => x.toLowerCase() === w.toLowerCase())) return;+ words = [...words, w];+ wordInput.value = "";+ save();+ drawWords();+ };+ const drawWords = () => {+ clear(chips);+ if (words.length === 0) {+ chips.append(h("div", { class: "hub-note", text: t("No word yet. Add the names, brands and jargon Coucou gets wrong.") }));+ return;+ }+ for (const w of words) {+ const remove = h("button", { title: t("Delete"), "aria-label": t("Delete") });+ remove.append(icon("x"));+ remove.addEventListener("click", () => {+ words = words.filter((x) => x !== w);+ save();+ drawWords();+ });+ chips.append(h("span", { class: "hub-chip" }, h("span", { text: w }), remove));+ }+ };+ wordInput.style.flex = "1";+ page.append(card(h("div", { class: "hub-row" }, wordInput, button(t("Add"), addWord, "primary")), chips));+ drawWords();++ // ── Replacements ──+ page.append(label(t("Replacements")), h("div", { class: "hub-note", style: "margin-top:-10px", text: t("When Coucou hears the words on the left, it writes the ones on the right.") }));+ const list = h("div", {});+ const from = input(t("Heard, e.g. cloud code"));+ const to = input(t("Written, e.g. Claude Code"), () => addReplacement());+ const addReplacement = () => {+ const f = from.value.trim();+ const w = to.value.trim();+ if (!f || !w) return;+ replacements = [...replacements.filter((r) => r.from.toLowerCase() !== f.toLowerCase()), { id: newId(), from: f, to: w }];+ from.value = "";+ to.value = "";+ save();+ drawReplacements();+ };+ const drawReplacements = () => {+ clear(list);+ for (const r of replacements) {+ list.append(h("div", { class: "hub-list-row" },+ h("div", { class: "grow hub-pair" },+ h("span", { text: r.from }),+ h("span", { class: "arrow", text: "→" }),+ h("b", { text: r.to, style: "font-weight:600" }),+ iconButton("trash", t("Delete"), () => {+ replacements = replacements.filter((x) => x.id !== r.id);+ save();+ drawReplacements();+ }),+ ),+ ));+ }+ };+ page.append(card(h("div", { class: "hub-pair" }, from, h("span", { class: "arrow", text: "→" }), to, button(t("Add"), addReplacement)), list));+ drawReplacements();+}++export async function snippetsPage(page: HTMLElement, ctx: HubContext) {+ let snippets: Snippet[] = (await FlowBridge.snippets()) ?? [];+ const save = () => void FlowBridge.setSnippets(snippets);+ page.append(ctx.hero("snippets", t("Snippets"), t("Say the trigger while dictating: Coucou pastes the whole text in its place.")));++ let editing: Snippet | null = null;+ const formTitle = h("div", { style: "font:700 14px var(--font)" });+ const trigger = h("input", { class: "hub-input", placeholder: t("What you say, e.g. my signature") }) as HTMLInputElement;+ const text = h("textarea", { class: "hub-textarea", placeholder: t("The text Coucou pastes") }) as HTMLTextAreaElement;+ const cancel = button(t("Cancel"), () => edit(null));+ const saveButton = button(t("Save"), () => {+ const tr = trigger.value.trim();+ const tx = text.value;+ if (!tr || !tx.trim()) return;+ if (editing) {+ snippets = snippets.map((s) => (s.id === editing!.id ? { ...s, trigger: tr, text: tx } : s));+ } else {+ snippets = [...snippets, { id: newId(), trigger: tr, text: tx }];+ }+ save();+ edit(null);+ draw();+ }, "primary");+ const edit = (s: Snippet | null) => {+ editing = s;+ formTitle.textContent = s ? t("Edit the snippet") : t("New snippet");+ trigger.value = s?.trigger ?? "";+ text.value = s?.text ?? "";+ cancel.style.display = s ? "" : "none";+ };+ page.append(card(formTitle, h("div", { class: "hub-row" }, h("span", { class: "hub-note", style: "width:80px", text: t("You say") }), trigger), text, h("div", { class: "hub-row", style: "justify-content:flex-end" }, cancel, saveButton)));+ trigger.style.flex = "1";+ edit(null);++ const list = h("div", {});+ const listCard = card(list);+ page.append(listCard);+ const draw = () => {+ clear(list);+ if (snippets.length === 0) {+ list.append(emptyState(t("No snippet yet. Your booking link, your signature, your address: say a few words, get the whole text."), "idle", "#F7B32B"));+ return;+ }+ for (const s of snippets) {+ list.append(h("div", { class: "hub-list-row" },+ h("div", { class: "grow" }, h("div", { style: "font:600 13.5px var(--font)", text: `« ${s.trigger} »` }), h("div", { class: "hub-snippet-text", text: s.text })),+ iconButton("pencil", t("Edit"), () => {+ edit(s);+ trigger.focus();+ }),+ iconButton("trash", t("Delete"), () => {+ snippets = snippets.filter((x) => x.id !== s.id);+ save();+ draw();+ }),+ ));+ }+ };+ draw();+}diff --git a/windows/src/hub/shell.ts b/windows/src/hub/shell.tsnew file mode 100644index 00000000..31a2a3b7--- /dev/null+++ b/windows/src/hub/shell.ts@@ -0,0 +1,195 @@+// The Coucou window: a sidebar with Flow (dictation, the Notetaker, the+// statistics, the dictionary, the snippets, the styles and their settings)+// and Notch (every setting of the island), and the page on the right, under+// its coloured band. Port of FlowHub.swift.++import "./hub.css";+import { h, clear } from "../views/dom";+import { t } from "../i18n/i18n";+import { onEvent } from "../core/bridge";+import { FlowBridge, type FlowPrefs, type FlowStatus, type ModelsStatus } from "../core/flow";+import { hero, liveMochi } from "./hero";+import { icon, keyLabel } from "./ui";++export type PageId =+ | "dictation" | "notes" | "insights" | "dictionary" | "snippets" | "styles" | "flowsettings"+ | "general" | "pills" | "agents" | "chat" | "integrations" | "phone" | "shortcuts";++interface PageDef {+ id: PageId;+ icon: string;+ title: () => string;+ /** The band's line; none for pages that draw their own band. */+ subtitle?: () => string;+}++export const FLOW_PAGES: PageDef[] = [+ { id: "dictation", icon: "mic", title: () => t("Dictation") },+ { id: "notes", icon: "record", title: () => t("Notetaker") },+ { id: "insights", icon: "chart", title: () => t("Statistics") },+ { id: "dictionary", icon: "book", title: () => t("Dictionary") },+ { id: "snippets", icon: "bolt", title: () => t("Snippets") },+ { id: "styles", icon: "text", title: () => t("Styles") },+ { id: "flowsettings", icon: "sliders", title: () => t("Settings") },+];++export const NOTCH_PAGES: PageDef[] = [+ { id: "general", icon: "gear", title: () => t("General"), subtitle: () => t("Mochi, his sounds and how the island behaves.") },+ { id: "pills", icon: "grid", title: () => t("Active pills"), subtitle: () => t("The pills shown in the island, their order and their colours.") },+ { id: "agents", icon: "terminal", title: () => t("Agents"), subtitle: () => t("Claude Code, Codex and the other agents Mochi follows.") },+ { id: "chat", icon: "chat", title: () => t("Chat"), subtitle: () => t("The AI of the island's chat, with your own keys.") },+ { id: "integrations", icon: "puzzle", title: () => t("Integrations"), subtitle: () => t("Stripe, GitHub, Vercel, n8n, Notion and the rest.") },+ { id: "phone", icon: "phone", title: () => t("Android phone"), subtitle: () => t("Your agents and their approvals on your Android phone, over your Wi-Fi.") },+ { id: "shortcuts", icon: "keyboard", title: () => t("Shortcuts"), subtitle: () => t("The keys that open the island and its actions.") },+];++const ALL = [...FLOW_PAGES, ...NOTCH_PAGES];++/** What a page gets to draw itself and reach the rest of the window. */+export interface HubContext {+ status: FlowStatus;+ navigate(page: PageId): void;+ /** Reads the status again (prefs, models) and redraws the sidebar's line. */+ refresh(): Promise<FlowStatus>;+ /** Saves new preferences and keeps them as the window's. */+ setPrefs(change: (p: FlowPrefs) => void): Promise<void>;+ /** The band of a page, its Mochis walking. */+ hero(page: PageId, title: string, subtitle: string | null, actions?: HTMLElement[], compact?: boolean): HTMLElement;+ /** Set by a page: called when the page is left. */+ onLeave?: () => void;+}++export type FlowPageRenderer = (container: HTMLElement, ctx: HubContext) => void | Promise<void>;++export interface HubOptions {+ version: string;+ flowPages: Partial<Record<PageId, FlowPageRenderer>>;+ /** Draws the island's settings for one of the Notch pages into `container`. */+ renderNotch(page: PageId, container: HTMLElement): Promise<void>;+}++const DEFAULT_STATUS: FlowStatus = {+ prefs: {+ enabled: false, key: "right_ctrl", edge: "bottom", mic: "", keepDays: 30, cleanup: false,+ defaultStyle: "natural", summaryEngine: "claude", openAtLaunch: true,+ },+ models: { parakeet: { state: "missing" }, downloadMb: 700 },+ keys: "ok",+ hasClaudeKey: false,+ mics: [],+ platform: navigator.userAgent.includes("Windows") ? "windows" : "linux",+ autostarted: false,+};++export async function startHub(root: HTMLElement, opts: HubOptions) {+ document.body.classList.add("hub-window");+ let current: PageId = "dictation";+ let status: FlowStatus = (await FlowBridge.status()) ?? DEFAULT_STATUS;+ const items = new Map<PageId, HTMLElement>();+ const statusLine = h("div", { class: "hub-status" });+ const scroll = h("div", { class: "hub-scroll" });+ let rendering = 0;++ const ctx: HubContext = {+ get status() {+ return status;+ },+ navigate: (page) => void show(page),+ refresh: async () => {+ status = (await FlowBridge.status()) ?? status;+ drawStatus();+ return status;+ },+ setPrefs: async (change) => {+ const next = { ...status.prefs };+ change(next);+ status = { ...status, prefs: next };+ drawStatus();+ await FlowBridge.setPrefs(next);+ },+ hero: (page, title, subtitle, actions = [], compact = false) => hero(page, title, subtitle, actions, compact),+ };++ function drawStatus() {+ clear(statusLine);+ const models = status.models.parakeet.state;+ let color = "#6b7079";+ let text: string;+ if (!status.prefs.enabled) {+ text = t("Dictation is off");+ } else if (models !== "ready") {+ color = "#f7b32b";+ text = models === "downloading" ? t("Downloading the voice model…") : t("Download the voice model to dictate");+ } else if (status.keys === "wayland") {+ color = "#f7b32b";+ text = t("Use the pill's microphone to dictate");+ } else {+ color = "#34d399";+ text = t("Ready · hold {0}", { 0: keyLabel(status.prefs.key, status.platform) });+ }+ statusLine.append(h("i", { class: "dot", style: `background:${color}` }), h("span", { text }));+ }++ async function show(page: PageId) {+ const def = ALL.find((p) => p.id === page) ?? FLOW_PAGES[0];+ ctx.onLeave?.();+ ctx.onLeave = undefined;+ current = def.id;+ for (const [id, el] of items) el.classList.toggle("on", id === current);+ const token = ++rendering;+ const page_ = h("div", { class: "hub-page" });+ const renderer = opts.flowPages[def.id];+ if (renderer) {+ await renderer(page_, ctx);+ } else {+ page_.append(hero(def.id, def.title(), def.subtitle?.() ?? null));+ const container = h("div", { id: "settings-root" });+ page_.append(container);+ await opts.renderNotch(def.id, container);+ }+ if (token !== rendering) return;+ clear(scroll);+ scroll.append(page_);+ scroll.scrollTop = 0;+ }++ // ── The sidebar ──+ const side = h("nav", { class: "hub-side" });+ const logo = h("canvas", {});+ side.append(h("div", { class: "hub-brand" }, logo, h("span", { text: "Coucou" })));+ liveMochi(logo as HTMLCanvasElement);+ const group = (title: string, pages: PageDef[]) => {+ side.append(h("div", { class: "hub-group", text: title }));+ for (const p of pages) {+ const b = h("button", { class: "hub-item", onclick: () => void show(p.id) });+ b.append(icon(p.icon), h("span", { text: p.title() }));+ items.set(p.id, b);+ side.append(b);+ }+ };+ group("Flow", FLOW_PAGES);+ group(t("Notch"), NOTCH_PAGES);+ side.append(h("div", { class: "spacer" }), statusLine, h("div", { class: "hub-version", text: `Coucou ${opts.version}` }));++ clear(root);+ root.append(side, h("main", { class: "hub-panel" }, scroll));+ drawStatus();+ await show(current);++ void onEvent<string>("hub-page", (page) => {+ const id = (page === "settings" ? "flowsettings" : page) as PageId;+ if (ALL.some((p) => p.id === id)) void show(id);+ });+ void onEvent<FlowPrefs>("flow-prefs", (prefs) => {+ status = { ...status, prefs };+ drawStatus();+ });+ void onEvent<ModelsStatus>("speech-models", (models) => {+ status = { ...status, models };+ drawStatus();+ });+ return {+ redraw: () => void show(current),+ current: () => current,+ };+}diff --git a/windows/src/hub/ui.ts b/windows/src/hub/ui.tsnew file mode 100644index 00000000..573e748c--- /dev/null+++ b/windows/src/hub/ui.ts@@ -0,0 +1,154 @@+// Small pieces the Coucou window's pages are drawn with: icons, rows, cards,+// switches, segmented controls. Same look as the Mac's (FlowHub.swift).++import { h } from "../views/dom";+import { t } from "../i18n/i18n";+import type { FlowKey } from "../core/flow";++/** Stroke icons on a 24×24 grid, standing in for the Mac's SF Symbols. */+export const HUB_ICONS: Record<string, string> = {+ mic: "M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3zM5.5 11.5a6.5 6.5 0 0 0 13 0M12 18v3",+ record: "M12 3.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17zM12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6z",+ chart: "M5 20v-7M10 20V6M15 20v-9M20 20V9",+ book: "M5 4.5h10a3 3 0 0 1 3 3V20H8a3 3 0 0 1-3-3V4.5zM5 17a3 3 0 0 1 3-3h10",+ bolt: "M13 3 5 13h6l-1 8 8-10h-6l1-8z",+ text: "M3.5 18 8 6l4.5 12M5 14h6M17.5 11a2.8 2.8 0 1 0 0 5.6 2.8 2.8 0 0 0 0-5.6zM20.3 10.8V18",+ sliders: "M4 7h9M17 7h3M4 17h3M11 17h9M15 5v4M9 15v4",+ gear: "M12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM12 2.8v2.4M12 18.8v2.4M2.8 12h2.4M18.8 12h2.4M5.5 5.5l1.7 1.7M16.8 16.8l1.7 1.7M5.5 18.5l1.7-1.7M16.8 7.2l1.7-1.7",+ grid: "M4.5 4.5h6v6h-6zM13.5 4.5h6v6h-6zM4.5 13.5h6v6h-6zM13.5 13.5h6v6h-6z",+ terminal: "M3.5 5.5h17v13h-17zM7 10l3 2.5L7 15M12.5 15H17",+ chat: "M4 5.5h16v10H10l-4 3.5v-3.5H4z",+ puzzle: "M9 4h4v2a1.8 1.8 0 1 0 3.6 0V4H20v5.5h-2a1.8 1.8 0 1 0 0 3.6h2V20h-5.5v-2a1.8 1.8 0 1 0-3.6 0v2H4v-6.4h2a1.8 1.8 0 1 0 0-3.6H4V4h5z",+ phone: "M8 2.8h8a1.6 1.6 0 0 1 1.6 1.6v15.2a1.6 1.6 0 0 1-1.6 1.6H8a1.6 1.6 0 0 1-1.6-1.6V4.4A1.6 1.6 0 0 1 8 2.8zM11 18h2",+ wave: "M4 10v4M8 7v10M12 4v16M16 7v10M20 10v4",+ keyboard: "M3 6.5h18v11H3zM6.5 10h1M10 10h1M13.5 10h1M17 10h.5M7 14h10",+ copy: "M8.5 8.5h11v11.5h-11zM5 15.5V4h11",+ trash: "M5 7h14M10 4h4M7 7l1 13h8l1-13M10 11v6M14 11v6",+ x: "M6.5 6.5l11 11M17.5 6.5l-11 11",+ plus: "M12 5v14M5 12h14",+ pencil: "M4.5 19.5l4-1 10.5-10.5-3-3L5.5 15.5l-1 4z",+ download: "M12 4v11M7 10l5 5 5-5M5 20h14",+ check: "M5 12.5 9.5 17 19 7.5",+ dots: "M6 12h.01M12 12h.01M18 12h.01",+ lock: "M6.5 11h11v9h-11zM8.5 11V8a3.5 3.5 0 0 1 7 0v3",+ window: "M3.5 5h17v14h-17zM3.5 9h17",+};++export function icon(name: string): SVGSVGElement {+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");+ svg.setAttribute("viewBox", "0 0 24 24");+ svg.setAttribute("aria-hidden", "true");+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");+ path.setAttribute("d", HUB_ICONS[name] ?? "");+ svg.append(path);+ return svg;+}++export function iconButton(name: string, title: string, onclick: () => void): HTMLElement {+ const b = h("button", { class: "hub-icon", title, "aria-label": title, onclick });+ b.append(icon(name));+ return b;+}++export function label(text: string): HTMLElement {+ return h("div", { class: "hub-label", text });+}++export function card(...children: (HTMLElement | null | false)[]): HTMLElement {+ const el = h("div", { class: "hub-card" });+ for (const c of children) if (c) el.append(c);+ return el;+}++export function divider(): HTMLElement {+ return h("div", { class: "hub-divider" });+}++export function row(title: string, detail: string | null, ...trailing: (HTMLElement | null)[]): HTMLElement {+ const text = h("div", { class: "text" }, h("div", { class: "title", text: title }));+ if (detail) text.append(h("div", { class: "detail", text: detail }));+ const el = h("div", { class: "hub-row" }, text);+ for (const t of trailing) if (t) el.append(t);+ return el;+}++export function keycap(text: string): HTMLElement {+ return h("span", { class: "hub-keycap", text });+}++export function button(text: string, onclick: () => void, kind: "" | "primary" | "danger" = "", small = false): HTMLButtonElement {+ return h("button", {+ class: ["hub-btn", kind, small ? "small" : ""].filter(Boolean).join(" "),+ text,+ onclick,+ }) as HTMLButtonElement;+}++/** The settings window's switch, so both windows look alike. */+export function toggle(on: boolean, onChange: (v: boolean) => void): HTMLElement {+ const el = h("button", { class: on ? "switch on" : "switch", "aria-pressed": on });+ el.addEventListener("click", () => {+ const next = !el.classList.contains("on");+ el.classList.toggle("on", next);+ el.setAttribute("aria-pressed", String(next));+ onChange(next);+ });+ return el;+}++export function segmented<T extends string>(options: [T, string][], value: T, onChange: (v: T) => void): HTMLElement {+ const el = h("div", { class: "hub-segmented" });+ for (const [id, text] of options) {+ const b = h("button", { class: id === value ? "on" : "", text });+ b.addEventListener("click", () => {+ for (const other of el.querySelectorAll("button")) other.classList.toggle("on", other === b);+ onChange(id);+ });+ el.append(b);+ }+ return el;+}++export function select<T extends string>(options: [T, string][], value: T, onChange: (v: T) => void): HTMLSelectElement {+ const el = h("select", { class: "hub-select" }) as HTMLSelectElement;+ for (const [id, text] of options) el.append(h("option", { value: id, text }));+ el.value = value;+ el.addEventListener("change", () => onChange(el.value as T));+ return el;+}++/** "Right Ctrl", "Ctrl + Win"… */+export function keyLabel(key: FlowKey | "", platform: "windows" | "linux" = "windows"): string {+ switch (key) {+ case "right_alt":+ return t("Right {0}", { 0: "Alt" });+ case "right_shift":+ return t("Right {0}", { 0: "Shift" });+ case "left_ctrl_super":+ return platform === "windows" ? "Ctrl + Win" : "Ctrl + Super";+ default:+ return t("Right {0}", { 0: "Ctrl" });+ }+}++/** The key written as keycaps: "Right Ctrl" twice for hands-free. */+export function keyKeycap(key: FlowKey | "", platform: "windows" | "linux", twice = false): HTMLElement {+ const label = keyLabel(key, platform);+ return keycap(twice ? `${label} ${label}` : label);+}++/** A number written the way the language writes it. */+export function number(n: number, digits = 0): string {+ try {+ return new Intl.NumberFormat(document.documentElement.lang || undefined, { maximumFractionDigits: digits }).format(n);+ } catch {+ return String(Math.round(n));+ }+}++/** 36 800 → "36.8 k": short numbers for the stat cards. */+export function shortCount(n: number): string {+ if (n < 10_000) return number(n);+ const k = n / 1000;+ return `${number(k >= 100 ? Math.round(k) : Math.round(k * 10) / 10, 1)} k`;+}diff --git a/windows/src/i18n/extra.json b/windows/src/i18n/extra.jsonindex 9ba0b6ab..790ae551 100644--- a/windows/src/i18n/extra.json+++ b/windows/src/i18n/extra.json@@ -507,17 +507,6 @@"ru": "Сначала подключите {name} в «Настройки → Локальные модели».","id": "Hubungkan {name} dulu di Pengaturan → Model lokal."},- "Copied": {- "zh-Hans": "已复制",- "hi": "कॉपी हो गया",- "es": "Copiado",- "ar": "تم النسخ",- "fr": "Copié",- "bn": "কপি হয়েছে",- "pt-BR": "Copiado",- "ru": "Скопировано",- "id": "Disalin"- },"Copied — paste it anywhere.": {"zh-Hans": "已复制 — 可以粘贴到任何地方。","hi": "कॉपी हो गया — कहीं भी पेस्ट करें।",@@ -1508,17 +1497,6 @@"ru": "Открыть Claude","id": "Buka Claude"},- "Open Settings": {- "zh-Hans": "打开设置",- "hi": "सेटिंग्स खोलें",- "es": "Abrir Configuración",- "ar": "فتح الإعدادات",- "fr": "Ouvrir les réglages",- "bn": "সেটিংস খুলুন",- "pt-BR": "Abrir Configurações",- "ru": "Открыть настройки",- "id": "Buka Pengaturan"- },"Open in VS Code": {"zh-Hans": "在 VS Code 中打开","hi": "VS Code में खोलें",@@ -2036,17 +2014,6 @@"ru": "Сессии и «Разрешить / Отклонить» из острова","id": "Sesi, dan Izinkan / Tolak dari pulau"},- "Settings": {- "zh-Hans": "设置",- "hi": "सेटिंग्स",- "es": "Configuración",- "ar": "الإعدادات",- "fr": "Réglages",- "bn": "সেটিংস",- "pt-BR": "Configurações",- "ru": "Настройки",- "id": "Pengaturan"- },"Share your week": {"zh-Hans": "分享你的一周","hi": "अपना हफ़्ता शेयर करें",@@ -3899,6 +3866,347 @@"pt-BR": "Este código também inclui a chave de acesso e a chave de ponta a ponta do relay {host}. «Parear de novo» cria uma chave e uma sala novas.","ru": "Этот код также содержит ключ доступа и сквозной ключ для ретранслятора {host}. «Сопрячь заново» создаёт новый ключ и новую комнату.","id": "Kode ini juga memuat kunci akses dan kunci ujung ke ujung untuk relay {host}. «Sandingkan ulang» membuat kunci dan ruang baru."+ },+ "Dictate anywhere on your computer": {+ "zh-Hans": "在电脑上的任何地方听写",+ "hi": "अपने कंप्यूटर पर कहीं भी बोलकर लिखें",+ "es": "Dicta en cualquier parte de tu ordenador",+ "ar": "أملِ في أي مكان على حاسوبك",+ "fr": "Dicte partout sur ton ordinateur",+ "bn": "আপনার কম্পিউটারে যেকোনো জায়গায় ডিক্টেট করুন",+ "pt-BR": "Dite em qualquer lugar do seu computador",+ "ru": "Диктуйте где угодно на компьютере",+ "id": "Dikte di mana saja di komputermu"+ },+ "Parakeet, on your computer": {+ "zh-Hans": "Parakeet,在你的电脑上",+ "hi": "Parakeet, आपके कंप्यूटर पर",+ "es": "Parakeet, en tu ordenador",+ "ar": "Parakeet، على حاسوبك",+ "fr": "Parakeet, sur ton ordinateur",+ "bn": "Parakeet, আপনার কম্পিউটারে",+ "pt-BR": "Parakeet, no seu computador",+ "ru": "Parakeet на вашем компьютере",+ "id": "Parakeet, di komputermu"+ },+ "The most accurate, offline, 25 languages. Downloaded once (about {0} MB).": {+ "zh-Hans": "最准确,离线可用,支持 25 种语言。只需下载一次(约 {0} MB)。",+ "hi": "सबसे सटीक, ऑफ़लाइन, 25 भाषाएँ। एक बार डाउनलोड होता है (लगभग {0} MB)।",+ "es": "El más preciso, sin conexión, 25 idiomas. Se descarga una vez (unos {0} MB).",+ "ar": "الأدق، دون اتصال، 25 لغة. يُنزَّل مرة واحدة (نحو {0} ميغابايت).",+ "fr": "Le plus précis, hors ligne, 25 langues. Téléchargé une fois (environ {0} Mo).",+ "bn": "সবচেয়ে নির্ভুল, অফলাইন, ২৫টি ভাষা। একবার ডাউনলোড হয় (প্রায় {0} MB)।",+ "pt-BR": "O mais preciso, offline, 25 idiomas. Baixado uma vez (cerca de {0} MB).",+ "ru": "Самый точный, офлайн, 25 языков. Скачивается один раз (около {0} МБ).",+ "id": "Paling akurat, offline, 25 bahasa. Diunduh sekali (sekitar {0} MB)."+ },+ "On a keyboard with AltGr, the right Alt types characters: pick another key.": {+ "zh-Hans": "在带 AltGr 的键盘上,右 Alt 用于输入字符:请选择其他按键。",+ "hi": "AltGr वाले कीबोर्ड पर दायाँ Alt अक्षर टाइप करता है: कोई दूसरी कुंजी चुनें।",+ "es": "En un teclado con AltGr, el Alt derecho escribe caracteres: elige otra tecla.",+ "ar": "في لوحة مفاتيح فيها AltGr، يكتب Alt الأيمن حروفًا: اختر مفتاحًا آخر.",+ "fr": "Sur un clavier avec AltGr, l'Alt de droite tape des caractères : choisis une autre touche.",+ "bn": "AltGr থাকা কিবোর্ডে ডান Alt অক্ষর টাইপ করে: অন্য কী বেছে নিন।",+ "pt-BR": "Em um teclado com AltGr, o Alt direito digita caracteres: escolha outra tecla.",+ "ru": "На клавиатуре с AltGr правый Alt набирает символы: выберите другую клавишу.",+ "id": "Pada keyboard dengan AltGr, Alt kanan mengetik karakter: pilih tombol lain."+ },+ "Paste again": {+ "zh-Hans": "再次粘贴",+ "hi": "फिर से पेस्ट करें",+ "es": "Pegar de nuevo",+ "ar": "ألصق مجددًا",+ "fr": "Coller à nouveau",+ "bn": "আবার পেস্ট করুন",+ "pt-BR": "Colar de novo",+ "ru": "Вставить снова",+ "id": "Tempel lagi"+ },+ "Wayland lets no app watch the keyboard: click the microphone on the pill to dictate hands-free, then ✓ to finish. Your words are copied: paste them with Ctrl+V.": {+ "zh-Hans": "Wayland 不允许任何应用监听键盘:点击胶囊上的麦克风即可免提听写,完成后点 ✓。你的文字会被复制:用 Ctrl+V 粘贴。",+ "hi": "Wayland किसी ऐप को कीबोर्ड देखने नहीं देता: हैंड्स-फ़्री बोलने के लिए पिल पर माइक्रोफ़ोन दबाएँ, फिर ख़त्म करने के लिए ✓। आपके शब्द कॉपी हो जाते हैं: उन्हें Ctrl+V से पेस्ट करें।",+ "es": "Wayland no deja que ninguna app vigile el teclado: haz clic en el micrófono de la píldora para dictar sin manos y en ✓ para terminar. Tus palabras se copian: pégalas con Ctrl+V.",+ "ar": "لا يسمح Wayland لأي تطبيق بمراقبة لوحة المفاتيح: انقر على الميكروفون في الكبسولة لتملي دون يدين، ثم على ✓ لتنهي. تُنسَخ كلماتك: الصقها بـ Ctrl+V.",+ "fr": "Wayland ne laisse aucune app surveiller le clavier : clique sur le micro de la pilule pour dicter mains libres, puis sur ✓ pour finir. Tes mots sont copiés : colle-les avec Ctrl+V.",+ "bn": "Wayland কোনো অ্যাপকে কিবোর্ড দেখতে দেয় না: হ্যান্ডস-ফ্রি ডিক্টেট করতে পিলের মাইক্রোফোনে ক্লিক করুন, শেষ করতে ✓। আপনার শব্দ কপি হয়ে যায়: Ctrl+V দিয়ে পেস্ট করুন।",+ "pt-BR": "O Wayland não deixa nenhum app observar o teclado: clique no microfone da pílula para ditar sem as mãos e em ✓ para terminar. Suas palavras são copiadas: cole com Ctrl+V.",+ "ru": "Wayland не даёт приложениям следить за клавиатурой: нажмите на микрофон на пилюле, чтобы диктовать без рук, затем ✓, чтобы закончить. Слова копируются: вставьте их через Ctrl+V.",+ "id": "Wayland tidak mengizinkan aplikasi memantau keyboard: klik mikrofon pada pil untuk mendikte tanpa tangan, lalu ✓ untuk selesai. Kata-katamu disalin: tempel dengan Ctrl+V."+ },+ "Coucou can't watch the keyboard here: use the pill's microphone to dictate.": {+ "zh-Hans": "Coucou 在这里无法监听键盘:请用胶囊上的麦克风听写。",+ "hi": "Coucou यहाँ कीबोर्ड नहीं देख सकता: बोलकर लिखने के लिए पिल का माइक्रोफ़ोन इस्तेमाल करें।",+ "es": "Coucou no puede vigilar el teclado aquí: usa el micrófono de la píldora para dictar.",+ "ar": "لا يستطيع Coucou مراقبة لوحة المفاتيح هنا: استخدم ميكروفون الكبسولة للإملاء.",+ "fr": "Coucou ne peut pas surveiller le clavier ici : utilise le micro de la pilule pour dicter.",+ "bn": "Coucou এখানে কিবোর্ড দেখতে পারে না: ডিক্টেট করতে পিলের মাইক্রোফোন ব্যবহার করুন।",+ "pt-BR": "O Coucou não consegue observar o teclado aqui: use o microfone da pílula para ditar.",+ "ru": "Здесь Coucou не может следить за клавиатурой: диктуйте через микрофон на пилюле.",+ "id": "Coucou tidak bisa memantau keyboard di sini: gunakan mikrofon pil untuk mendikte."+ },+ "Microphone": {+ "zh-Hans": "麦克风",+ "hi": "माइक्रोफ़ोन",+ "es": "Micrófono",+ "ar": "الميكروفون",+ "fr": "Micro",+ "bn": "মাইক্রোফোন",+ "pt-BR": "Microfone",+ "ru": "Микрофон",+ "id": "Mikrofon"+ },+ "System default": {+ "zh-Hans": "系统默认",+ "hi": "सिस्टम डिफ़ॉल्ट",+ "es": "Predeterminado del sistema",+ "ar": "الافتراضي للنظام",+ "fr": "Celui du système",+ "bn": "সিস্টেমের ডিফল্ট",+ "pt-BR": "Padrão do sistema",+ "ru": "Системный по умолчанию",+ "id": "Bawaan sistem"+ },+ "The one Coucou listens to for dictation and calls.": {+ "zh-Hans": "Coucou 听写和录制通话时使用的麦克风。",+ "hi": "वह जिसे Coucou डिक्टेशन और कॉल के लिए सुनता है।",+ "es": "El que Coucou escucha para dictar y para las llamadas.",+ "ar": "الذي يستمع إليه Coucou للإملاء والمكالمات.",+ "fr": "Celui que Coucou écoute pour la dictée et les appels.",+ "bn": "যেটি Coucou ডিক্টেশন ও কলের জন্য শোনে।",+ "pt-BR": "O que o Coucou escuta para ditados e chamadas.",+ "ru": "Тот, который Coucou слушает для диктовки и звонков.",+ "id": "Yang didengarkan Coucou untuk dikte dan panggilan."+ },+ "Your voice never leaves this computer: Parakeet turns it into text here, and the recording is dropped as soon as it is pasted.": {+ "zh-Hans": "你的声音不会离开这台电脑:Parakeet 在本机把它转成文字,粘贴后录音即被丢弃。",+ "hi": "आपकी आवाज़ इस कंप्यूटर से बाहर नहीं जाती: Parakeet उसे यहीं टेक्स्ट में बदलता है, और पेस्ट होते ही रिकॉर्डिंग हटा दी जाती है।",+ "es": "Tu voz nunca sale de este ordenador: Parakeet la convierte en texto aquí y la grabación se descarta en cuanto se pega.",+ "ar": "لا يغادر صوتك هذا الحاسوب أبدًا: يحوّله Parakeet إلى نص هنا، ويُحذف التسجيل فور لصقه.",+ "fr": "Ta voix ne quitte jamais cet ordinateur : Parakeet la transforme en texte ici, et l'enregistrement est jeté dès qu'il est collé.",+ "bn": "আপনার কণ্ঠ এই কম্পিউটার ছেড়ে যায় না: Parakeet এখানেই এটিকে লেখায় রূপান্তর করে, আর পেস্ট হওয়ামাত্র রেকর্ডিং মুছে যায়।",+ "pt-BR": "Sua voz nunca sai deste computador: o Parakeet a transforma em texto aqui, e a gravação é descartada assim que é colada.",+ "ru": "Ваш голос не покидает этот компьютер: Parakeet превращает его в текст здесь, а запись удаляется сразу после вставки.",+ "id": "Suaramu tidak pernah meninggalkan komputer ini: Parakeet mengubahnya menjadi teks di sini, dan rekamannya dibuang begitu ditempel."+ },+ "With Claude, the transcript (never the audio) goes to Anthropic with your key from Notch → Chat.": {+ "zh-Hans": "使用 Claude 时,文字记录(绝不包括音频)会通过你在“Notch → 聊天”中设置的密钥发送给 Anthropic。",+ "hi": "Claude के साथ, ट्रांसक्रिप्ट (ऑडियो कभी नहीं) Notch → चैट में दी गई आपकी कुंजी के साथ Anthropic को जाता है।",+ "es": "Con Claude, la transcripción (nunca el audio) va a Anthropic con tu clave de Notch → Chat.",+ "ar": "مع Claude، يذهب النص المكتوب (لا الصوت أبدًا) إلى Anthropic بمفتاحك من Notch ← الدردشة.",+ "fr": "Avec Claude, la transcription (jamais l'audio) part chez Anthropic avec ta clé de Notch → Chat.",+ "bn": "Claude-এ, ট্রান্সক্রিপ্ট (অডিও কখনো নয়) Notch → চ্যাট থেকে আপনার কী দিয়ে Anthropic-এ যায়।",+ "pt-BR": "Com o Claude, a transcrição (nunca o áudio) vai para a Anthropic com sua chave de Notch → Chat.",+ "ru": "С Claude расшифровка (но никогда не звук) уходит в Anthropic с вашим ключом из Notch → Чат.",+ "id": "Dengan Claude, transkrip (tidak pernah audionya) dikirim ke Anthropic dengan kuncimu dari Notch → Obrolan."+ },+ "Everything stays on this computer. Tell the people in the call that you are recording.": {+ "zh-Hans": "所有内容都留在这台电脑上。请告知通话中的人你正在录音。",+ "hi": "सब कुछ इसी कंप्यूटर पर रहता है। कॉल में मौजूद लोगों को बताएँ कि आप रिकॉर्ड कर रहे हैं।",+ "es": "Todo se queda en este ordenador. Avisa a las personas de la llamada de que estás grabando.",+ "ar": "يبقى كل شيء على هذا الحاسوب. أخبر المشاركين في المكالمة أنك تسجّل.",+ "fr": "Tout reste sur cet ordinateur. Préviens les personnes de l'appel que tu enregistres.",+ "bn": "সবকিছু এই কম্পিউটারেই থাকে। কলে থাকা মানুষদের জানান যে আপনি রেকর্ড করছেন।",+ "pt-BR": "Tudo fica neste computador. Avise as pessoas da chamada que você está gravando.",+ "ru": "Всё остаётся на этом компьютере. Предупредите участников звонка, что вы ведёте запись.",+ "id": "Semuanya tetap di komputer ini. Beri tahu orang di panggilan bahwa kamu merekam."+ },+ "Not when Coucou starts with the computer.": {+ "zh-Hans": "Coucou 随电脑启动时不会打开。",+ "hi": "जब Coucou कंप्यूटर के साथ शुरू होता है तब नहीं।",+ "es": "No cuando Coucou se inicia con el ordenador.",+ "ar": "ليس عندما يبدأ Coucou مع الحاسوب.",+ "fr": "Pas quand Coucou démarre avec l'ordinateur.",+ "bn": "Coucou কম্পিউটারের সাথে চালু হলে নয়।",+ "pt-BR": "Não quando o Coucou inicia com o computador.",+ "ru": "Не при запуске Coucou вместе с компьютером.",+ "id": "Tidak saat Coucou mulai bersama komputer."+ },+ "The history, the statistics and your notes stay on this computer, in Coucou's folder. Dictations are never saved as audio; a call's audio is deleted as soon as its transcript is written.": {+ "zh-Hans": "历史记录、统计数据和你的笔记都留在这台电脑上的 Coucou 文件夹中。听写从不保存为音频;通话的音频在文字记录写好后立即删除。",+ "hi": "इतिहास, आँकड़े और आपके नोट्स इसी कंप्यूटर पर Coucou के फ़ोल्डर में रहते हैं। डिक्टेशन कभी ऑडियो के रूप में सेव नहीं होते; कॉल का ऑडियो ट्रांसक्रिप्ट लिखे जाते ही हटा दिया जाता है।",+ "es": "El historial, las estadísticas y tus notas se quedan en este ordenador, en la carpeta de Coucou. Los dictados nunca se guardan como audio; el audio de una llamada se borra en cuanto se escribe su transcripción.",+ "ar": "يبقى السجل والإحصاءات وملاحظاتك على هذا الحاسوب، في مجلد Coucou. لا تُحفظ الإملاءات أبدًا كصوت؛ ويُحذف صوت المكالمة فور كتابة نصها.",+ "fr": "L'historique, les statistiques et tes notes restent sur cet ordinateur, dans le dossier de Coucou. Les dictées ne sont jamais gardées en audio ; l'audio d'un appel est supprimé dès que sa transcription est écrite.",+ "bn": "ইতিহাস, পরিসংখ্যান আর আপনার নোট এই কম্পিউটারে Coucou-র ফোল্ডারেই থাকে। ডিক্টেশন কখনো অডিও হিসেবে সংরক্ষিত হয় না; কলের অডিও ট্রান্সক্রিপ্ট লেখা হলেই মুছে যায়।",+ "pt-BR": "O histórico, as estatísticas e suas notas ficam neste computador, na pasta do Coucou. Os ditados nunca são salvos como áudio; o áudio de uma chamada é apagado assim que a transcrição é escrita.",+ "ru": "История, статистика и ваши заметки остаются на этом компьютере, в папке Coucou. Диктовки никогда не сохраняются как звук; звук звонка удаляется сразу после записи расшифровки.",+ "id": "Riwayat, statistik, dan catatanmu tetap di komputer ini, di folder Coucou. Dikte tidak pernah disimpan sebagai audio; audio panggilan dihapus begitu transkripnya ditulis."+ },+ "{0} h {1}": {+ "zh-Hans": "{0} 小时 {1}",+ "hi": "{0} घं {1}",+ "es": "{0} h {1}",+ "ar": "{0} س {1}",+ "fr": "{0} h {1}",+ "bn": "{0} ঘ {1}",+ "pt-BR": "{0} h {1}",+ "ru": "{0} ч {1}",+ "id": "{0} j {1}"+ },+ "Counted on this computer, never sent anywhere.": {+ "zh-Hans": "在这台电脑上统计,从不发送到任何地方。",+ "hi": "इसी कंप्यूटर पर गिना गया, कहीं भेजा नहीं जाता।",+ "es": "Contado en este ordenador, nunca se envía a ningún sitio.",+ "ar": "تُحسب على هذا الحاسوب، ولا تُرسل إلى أي مكان.",+ "fr": "Compté sur cet ordinateur, jamais envoyé nulle part.",+ "bn": "এই কম্পিউটারেই গোনা হয়, কোথাও পাঠানো হয় না।",+ "pt-BR": "Contado neste computador, nunca enviado para lugar nenhum.",+ "ru": "Считается на этом компьютере и никуда не отправляется.",+ "id": "Dihitung di komputer ini, tidak pernah dikirim ke mana pun."+ },+ "Coucou writes your calls on this computer with Parakeet, and tells the voices apart with a second small model. Both are downloaded once (about {0} MB), then everything works offline.": {+ "zh-Hans": "Coucou 用 Parakeet 在这台电脑上转写你的通话,并用另一个小模型区分不同的声音。两者只需下载一次(约 {0} MB),之后一切都可离线运行。",+ "hi": "Coucou आपकी कॉल इसी कंप्यूटर पर Parakeet से लिखता है, और एक दूसरे छोटे मॉडल से आवाज़ें अलग पहचानता है। दोनों एक बार डाउनलोड होते हैं (लगभग {0} MB), फिर सब ऑफ़लाइन चलता है।",+ "es": "Coucou escribe tus llamadas en este ordenador con Parakeet y distingue las voces con un segundo modelo pequeño. Ambos se descargan una vez (unos {0} MB) y luego todo funciona sin conexión.",+ "ar": "يكتب Coucou مكالماتك على هذا الحاسوب باستخدام Parakeet، ويميّز الأصوات بنموذج صغير ثانٍ. يُنزَّل كلاهما مرة واحدة (نحو {0} ميغابايت)، ثم يعمل كل شيء دون اتصال.",+ "fr": "Coucou écrit tes appels sur cet ordinateur avec Parakeet, et distingue les voix avec un second petit modèle. Les deux se téléchargent une fois (environ {0} Mo), puis tout marche hors ligne.",+ "bn": "Coucou এই কম্পিউটারে Parakeet দিয়ে আপনার কল লেখে, আর দ্বিতীয় একটি ছোট মডেল দিয়ে কণ্ঠগুলো আলাদা করে। দুটোই একবার ডাউনলোড হয় (প্রায় {0} MB), তারপর সবকিছু অফলাইনে চলে।",+ "pt-BR": "O Coucou escreve suas chamadas neste computador com o Parakeet e distingue as vozes com um segundo modelo pequeno. Os dois são baixados uma vez (cerca de {0} MB) e depois tudo funciona offline.",+ "ru": "Coucou записывает ваши звонки на этом компьютере с помощью Parakeet и различает голоса второй небольшой моделью. Обе скачиваются один раз (около {0} МБ), дальше всё работает офлайн.",+ "id": "Coucou menulis panggilanmu di komputer ini dengan Parakeet, dan membedakan suara dengan model kecil kedua. Keduanya diunduh sekali (sekitar {0} MB), lalu semuanya bekerja offline."+ },+ "The clean-up uses your Claude key. Add it in Notch → Chat.": {+ "zh-Hans": "清理功能使用你的 Claude 密钥。请在“Notch → 聊天”中添加。",+ "hi": "सफ़ाई आपकी Claude कुंजी इस्तेमाल करती है। इसे Notch → चैट में जोड़ें।",+ "es": "La limpieza usa tu clave de Claude. Añádela en Notch → Chat.",+ "ar": "يستخدم التنظيف مفتاح Claude الخاص بك. أضفه في Notch ← الدردشة.",+ "fr": "Le nettoyage utilise ta clé Claude. Ajoute-la dans Notch → Chat.",+ "bn": "পরিষ্কার করতে আপনার Claude কী লাগে। Notch → চ্যাট-এ যোগ করুন।",+ "pt-BR": "A limpeza usa sua chave do Claude. Adicione-a em Notch → Chat.",+ "ru": "Для очистки нужен ваш ключ Claude. Добавьте его в Notch → Чат.",+ "id": "Pembersihan memakai kunci Claude-mu. Tambahkan di Notch → Obrolan."+ },+ "With the clean-up on, the text (never your voice) goes to Anthropic with your Claude key. Off, everything stays on this computer.": {+ "zh-Hans": "开启清理后,文字(绝不包括你的声音)会通过你的 Claude 密钥发送给 Anthropic。关闭时,一切都留在这台电脑上。",+ "hi": "सफ़ाई चालू होने पर टेक्स्ट (आपकी आवाज़ कभी नहीं) आपकी Claude कुंजी के साथ Anthropic को जाता है। बंद होने पर सब कुछ इसी कंप्यूटर पर रहता है।",+ "es": "Con la limpieza activada, el texto (nunca tu voz) va a Anthropic con tu clave de Claude. Desactivada, todo se queda en este ordenador.",+ "ar": "مع تفعيل التنظيف، يذهب النص (لا صوتك أبدًا) إلى Anthropic بمفتاح Claude الخاص بك. عند إيقافه، يبقى كل شيء على هذا الحاسوب.",+ "fr": "Nettoyage activé, le texte (jamais ta voix) part chez Anthropic avec ta clé Claude. Désactivé, tout reste sur cet ordinateur.",+ "bn": "পরিষ্কার চালু থাকলে লেখা (আপনার কণ্ঠ কখনো নয়) আপনার Claude কী দিয়ে Anthropic-এ যায়। বন্ধ থাকলে সবকিছু এই কম্পিউটারেই থাকে।",+ "pt-BR": "Com a limpeza ligada, o texto (nunca sua voz) vai para a Anthropic com sua chave do Claude. Desligada, tudo fica neste computador.",+ "ru": "Когда очистка включена, текст (но никогда не голос) уходит в Anthropic с вашим ключом Claude. Когда выключена, всё остаётся на этом компьютере.",+ "id": "Dengan pembersihan aktif, teks (tidak pernah suaramu) dikirim ke Anthropic dengan kunci Claude-mu. Saat nonaktif, semuanya tetap di komputer ini."+ },+ "Mochi, his sounds and how the island behaves.": {+ "zh-Hans": "Mochi、它的声音以及岛的行为方式。",+ "hi": "Mochi, उसकी आवाज़ें और आइलैंड कैसे काम करता है।",+ "es": "Mochi, sus sonidos y cómo se comporta la isla.",+ "ar": "Mochi وأصواته وطريقة عمل الجزيرة.",+ "fr": "Mochi, ses sons et le comportement de l'île.",+ "bn": "Mochi, তার শব্দ আর আইল্যান্ড কেমন আচরণ করে।",+ "pt-BR": "Mochi, seus sons e como a ilha se comporta.",+ "ru": "Mochi, его звуки и поведение острова.",+ "id": "Mochi, suaranya, dan cara pulau berperilaku."+ },+ "The pills shown in the island, their order and their colours.": {+ "zh-Hans": "岛中显示的胶囊、它们的顺序和颜色。",+ "hi": "आइलैंड में दिखने वाली पिल्स, उनका क्रम और उनके रंग।",+ "es": "Las píldoras que muestra la isla, su orden y sus colores.",+ "ar": "الكبسولات المعروضة في الجزيرة وترتيبها وألوانها.",+ "fr": "Les pilules affichées dans l'île, leur ordre et leurs couleurs.",+ "bn": "আইল্যান্ডে দেখানো পিলগুলো, তাদের ক্রম আর রং।",+ "pt-BR": "As pílulas mostradas na ilha, sua ordem e suas cores.",+ "ru": "Пилюли на острове, их порядок и цвета.",+ "id": "Pil yang ditampilkan di pulau, urutannya, dan warnanya."+ },+ "The AI of the island's chat, with your own keys.": {+ "zh-Hans": "岛内聊天使用的 AI,用你自己的密钥。",+ "hi": "आइलैंड की चैट का AI, आपकी अपनी कुंजियों के साथ।",+ "es": "La IA del chat de la isla, con tus propias claves.",+ "ar": "ذكاء دردشة الجزيرة الاصطناعي، بمفاتيحك الخاصة.",+ "fr": "L'IA du chat de l'île, avec tes propres clés.",+ "bn": "আইল্যান্ডের চ্যাটের AI, আপনার নিজের কী দিয়ে।",+ "pt-BR": "A IA do chat da ilha, com suas próprias chaves.",+ "ru": "ИИ чата острова — с вашими собственными ключами.",+ "id": "AI untuk obrolan pulau, dengan kuncimu sendiri."+ },+ "Your agents and their approvals on your Android phone, over your Wi-Fi.": {+ "zh-Hans": "通过你的 Wi-Fi,在 Android 手机上查看代理并批准请求。",+ "hi": "आपके Wi-Fi पर, आपके Android फ़ोन पर आपके एजेंट और उनकी मंज़ूरियाँ।",+ "es": "Tus agentes y sus aprobaciones en tu teléfono Android, por tu Wi-Fi.",+ "ar": "وكلاؤك وموافقاتهم على هاتف Android، عبر شبكة Wi-Fi لديك.",+ "fr": "Tes agents et leurs autorisations sur ton téléphone Android, par ton Wi-Fi.",+ "bn": "আপনার Wi-Fi-তে, আপনার Android ফোনে আপনার এজেন্ট আর তাদের অনুমোদন।",+ "pt-BR": "Seus agentes e as aprovações deles no seu celular Android, pelo seu Wi-Fi.",+ "ru": "Ваши агенты и их подтверждения на телефоне Android через ваш Wi-Fi.",+ "id": "Agenmu dan persetujuannya di ponsel Android, lewat Wi-Fi-mu."+ },+ "The keys that open the island and its actions.": {+ "zh-Hans": "打开岛及其操作的按键。",+ "hi": "वे कुंजियाँ जो आइलैंड और उसकी क्रियाएँ खोलती हैं।",+ "es": "Las teclas que abren la isla y sus acciones.",+ "ar": "المفاتيح التي تفتح الجزيرة وإجراءاتها.",+ "fr": "Les touches qui ouvrent l'île et ses actions.",+ "bn": "যে কী-গুলো আইল্যান্ড আর এর কাজগুলো খোলে।",+ "pt-BR": "As teclas que abrem a ilha e suas ações.",+ "ru": "Клавиши, открывающие остров и его действия.",+ "id": "Tombol yang membuka pulau dan tindakannya."+ },+ "Downloading the voice model…": {+ "zh-Hans": "正在下载语音模型…",+ "hi": "वॉइस मॉडल डाउनलोड हो रहा है…",+ "es": "Descargando el modelo de voz…",+ "ar": "جارٍ تنزيل نموذج الصوت…",+ "fr": "Téléchargement du modèle de voix…",+ "bn": "ভয়েস মডেল ডাউনলোড হচ্ছে…",+ "pt-BR": "Baixando o modelo de voz…",+ "ru": "Скачивается голосовая модель…",+ "id": "Mengunduh model suara…"+ },+ "Download the voice model to dictate": {+ "zh-Hans": "下载语音模型即可听写",+ "hi": "डिक्टेट करने के लिए वॉइस मॉडल डाउनलोड करें",+ "es": "Descarga el modelo de voz para dictar",+ "ar": "نزّل نموذج الصوت لتملي",+ "fr": "Télécharge le modèle de voix pour dicter",+ "bn": "ডিক্টেট করতে ভয়েস মডেল ডাউনলোড করুন",+ "pt-BR": "Baixe o modelo de voz para ditar",+ "ru": "Скачайте голосовую модель, чтобы диктовать",+ "id": "Unduh model suara untuk mendikte"+ },+ "Use the pill's microphone to dictate": {+ "zh-Hans": "用胶囊上的麦克风听写",+ "hi": "डिक्टेट करने के लिए पिल का माइक्रोफ़ोन इस्तेमाल करें",+ "es": "Usa el micrófono de la píldora para dictar",+ "ar": "استخدم ميكروفون الكبسولة للإملاء",+ "fr": "Utilise le micro de la pilule pour dicter",+ "bn": "ডিক্টেট করতে পিলের মাইক্রোফোন ব্যবহার করুন",+ "pt-BR": "Use o microfone da pílula para ditar",+ "ru": "Диктуйте через микрофон на пилюле",+ "id": "Gunakan mikrofon pil untuk mendikte"+ },+ "Copied · press Ctrl+V to paste": {+ "zh-Hans": "已复制 · 按 Ctrl+V 粘贴",+ "hi": "कॉपी हुआ · पेस्ट करने के लिए Ctrl+V दबाएँ",+ "es": "Copiado · pulsa Ctrl+V para pegar",+ "ar": "تم النسخ · اضغط Ctrl+V للصق",+ "fr": "Copié · Ctrl+V pour coller",+ "bn": "কপি হয়েছে · পেস্ট করতে Ctrl+V চাপুন",+ "pt-BR": "Copiado · pressione Ctrl+V para colar",+ "ru": "Скопировано · Ctrl+V, чтобы вставить",+ "id": "Disalin · tekan Ctrl+V untuk menempel"+ },+ "Download the voice model first, in Coucou → Settings → Recognition.": {+ "zh-Hans": "请先在“Coucou → 设置 → 识别”中下载语音模型。",+ "hi": "पहले Coucou → सेटिंग्स → पहचान में वॉइस मॉडल डाउनलोड करें।",+ "es": "Descarga primero el modelo de voz, en Coucou → Ajustes → Reconocimiento.",+ "ar": "نزّل نموذج الصوت أولًا، في Coucou ← الإعدادات ← التعرّف.",+ "fr": "Télécharge d'abord le modèle de voix, dans Coucou → Réglages → Reconnaissance.",+ "bn": "আগে Coucou → সেটিংস → রিকগনিশন-এ ভয়েস মডেল ডাউনলোড করুন।",+ "pt-BR": "Baixe primeiro o modelo de voz, em Coucou → Ajustes → Reconhecimento.",+ "ru": "Сначала скачайте голосовую модель: Coucou → Настройки → Распознавание.",+ "id": "Unduh model suara dulu, di Coucou → Pengaturan → Pengenalan."+ },+ "Your words are copied: click where you want them and press Ctrl+V.": {+ "zh-Hans": "你的文字已复制:点击想放的位置,然后按 Ctrl+V。",+ "hi": "आपके शब्द कॉपी हो गए: जहाँ चाहिए वहाँ क्लिक करें और Ctrl+V दबाएँ।",+ "es": "Tus palabras están copiadas: haz clic donde las quieras y pulsa Ctrl+V.",+ "ar": "نُسخت كلماتك: انقر حيث تريدها واضغط Ctrl+V.",+ "fr": "Tes mots sont copiés : clique où tu les veux et appuie sur Ctrl+V.",+ "bn": "আপনার শব্দ কপি হয়েছে: যেখানে চান সেখানে ক্লিক করে Ctrl+V চাপুন।",+ "pt-BR": "Suas palavras foram copiadas: clique onde quiser e pressione Ctrl+V.",+ "ru": "Слова скопированы: щёлкните, куда их вставить, и нажмите Ctrl+V.",+ "id": "Kata-katamu disalin: klik di tempat yang kamu mau lalu tekan Ctrl+V."}}}diff --git a/windows/src/pill/main.ts b/windows/src/pill/main.tsnew file mode 100644index 00000000..b47d8c12--- /dev/null+++ b/windows/src/pill/main.ts@@ -0,0 +1,424 @@+// Flow dictation's pill (pill.html). Port of FlowPillView (FlowPill.swift).+//+// What it shows comes whole from Rust in `pill-state` events; the nine dots+// come in `pill-bands` about 30 times a second while you speak. The page tells+// Rust where the pill and its bubble are (`pill_hot`), so the rest of the+// window lets clicks through; it draws only while something moves.++import "./pill.css";+import { Bridge, onEvent } from "../core/bridge";+import { FlowBridge, clock, type PillState } from "../core/flow";+import type { Settings } from "../core/state";+import { BotEngine, hexToRGB } from "../mochi/engine";+import { resolveLanguage, setLanguage, systemLanguages, t } from "../i18n/i18n";+import { HUB_ICONS, keyLabel } from "../hub/ui";++const RESTING_LENGTH = 44;+const RESTING_THICKNESS = 8;+const OPEN_THICKNESS = 34;+const BANDS = 9;++let state: PillState = { phase: "idle", edge: "bottom", key: "right_ctrl", noteStartedAt: null, announcement: null, enabled: false };+let platform: "windows" | "linux" = navigator.userAgent.includes("Windows") ? "windows" : "linux";+let hovered = false;+let tooltip: string | null = null;+let unhover: number | null = null;+let visible = false;+const levels = new Array<number>(BANDS).fill(0);+const target = new Array<number>(BANDS).fill(0);++const root = document.getElementById("pill")!;++function svgIcon(name: string): SVGSVGElement {+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");+ svg.setAttribute("viewBox", "0 0 24 24");+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");+ path.setAttribute("d", HUB_ICONS[name] ?? "");+ svg.append(path);+ return svg;+}++function el<K extends keyof HTMLElementTagNameMap>(tag: K, cls = "", text = ""): HTMLElementTagNameMap[K] {+ const e = document.createElement(tag);+ if (cls) e.className = cls;+ if (text) e.textContent = text;+ return e;+}++// ── Mochi ─────────────────────────────────────────────────────────────────────++const mochi = new BotEngine();+mochi.isMini = true;+mochi.bodyColor = hexToRGB("#F5F6F8");+mochi.setState("idle", true);+const mochiCanvas = el("canvas");++function mochiSlot(): HTMLElement {+ const slot = el("span", "mochi");+ slot.append(mochiCanvas);+ return slot;+}++// ── Looks ─────────────────────────────────────────────────────────────────────++type Look = "resting" | "toolbar" | "note" | "live" | "handsFree" | "message";++function look(): Look {+ switch (state.phase) {+ case "locked":+ return "handsFree";+ case "listening":+ case "thinking":+ return "live";+ case "copied":+ case "failed":+ case "pastedAgain":+ return "message";+ default:+ if (state.noteStartedAt) return "note";+ return hovered ? "toolbar" : "resting";+ }+}++const vertical = () => state.edge !== "bottom";++function messageText(): string | null {+ switch (state.phase) {+ case "copied":+ return t("Copied · press Ctrl+V to paste");+ case "failed":+ return t("Microphone unavailable");+ case "pastedAgain":+ return t("Last dictation pasted");+ default:+ return null;+ }+}++function measure(text: string): number {+ const c = document.createElement("canvas").getContext("2d")!;+ c.font = "500 12px system-ui, 'Segoe UI', sans-serif";+ return Math.ceil(c.measureText(text).width);+}++function openLength(l: Look): number {+ const hours = state.noteStartedAt ? Date.now() - state.noteStartedAt >= 3_600_000 : false;+ switch (l) {+ case "toolbar":+ return 150;+ case "note":+ return vertical() ? 128 : hours ? 152 : 136;+ case "handsFree":+ return 158;+ case "message":+ return vertical() ? 76 : measure(messageText() ?? "") + 22 + 9 + 26 + 2;+ default:+ return 118;+ }+}++function pillButton(icon: string, tip: string, action: () => void, opts: { small?: boolean; filled?: boolean } = {}): HTMLElement {+ const b = el("button", ["pbtn", opts.small ? "small" : "", opts.filled ? "filled" : ""].filter(Boolean).join(" "));+ b.append(svgIcon(icon));+ b.addEventListener("click", (e) => {+ e.stopPropagation();+ action();+ });+ b.addEventListener("pointerenter", () => {+ tooltip = tip;+ render();+ });+ b.addEventListener("pointerleave", () => {+ if (tooltip === tip) {+ tooltip = null;+ render();+ }+ });+ return b;+}++const barsEl = el("span", "bars");+for (let i = 0; i < BANDS; i++) barsEl.append(el("i"));++function noteClock(): HTMLElement {+ const span = el("span", "clock");+ span.dataset.clock = "1";+ span.textContent = clock((Date.now() - (state.noteStartedAt ?? Date.now())) / 1000);+ return span;+}++function content(l: Look): HTMLElement {+ const c = el("div", "content");+ const key = keyLabel(state.key, platform);+ switch (l) {+ case "toolbar": {+ c.style.gap = "4px";+ const m = mochiSlot();+ m.style.margin = vertical() ? "0 0 5px" : "0 5px 0 0";+ c.append(+ m,+ pillButton("mic", t("Dictate · {0}", { 0: key }), () => void FlowBridge.pillAction("dictate")),+ pillButton("record", t("Record a call"), () => void FlowBridge.pillAction("note")),+ pillButton("window", t("Open Coucou"), () => void FlowBridge.pillAction("hub")),+ );+ break;+ }+ case "handsFree":+ c.append(+ pillButton("x", t("Cancel"), () => void FlowBridge.pillAction("cancel"), { small: true }),+ barsEl,+ pillButton("check", t("Paste · or press {0}", { 0: key }), () => void FlowBridge.pillAction("finish"), { small: true, filled: true }),+ );+ break;+ case "message":+ if (vertical()) {+ const icon = el("span");+ icon.append(svgIcon(state.phase === "failed" ? "mic" : "copy"));+ icon.querySelector("svg")!.setAttribute("style", "width:13px;height:13px;fill:none;stroke:#e8e9ec;stroke-width:2");+ c.append(mochiSlot(), icon);+ } else {+ c.append(mochiSlot(), el("span", "message", messageText() ?? ""));+ }+ break;+ case "note": {+ c.style.gap = vertical() ? "6px" : "8px";+ const stop = el("button", "stop");+ stop.title = t("Stop");+ stop.append(el("i"));+ stop.addEventListener("click", (e) => {+ e.stopPropagation();+ void FlowBridge.pillAction("stopNote");+ });+ c.append(mochiSlot(), el("span", "rec"), noteClock(), stop);+ break;+ }+ default:+ c.append(mochiSlot(), barsEl);+ }+ return c;+}++function bubble(): HTMLElement | null {+ const a = state.announcement;+ if (a) {+ const b = el("div", "bubble announce");+ const icon = el("span", "icon");+ const name = { mic: "mic", lock: "lock", clipboard: "copy", download: "download", check: "check", error: "x" }[a.icon] ?? "check";+ icon.append(svgIcon(name));+ icon.style.color = a.tint;+ b.append(icon, el("span", "text", a.text));+ if (a.action) {+ const act = el("button", "act", a.action);+ act.addEventListener("click", () => void FlowBridge.pillAction("announcement", a.id));+ b.append(act);+ }+ const close = el("button", "close");+ close.title = t("Close");+ close.append(svgIcon("x"));+ close.addEventListener("click", () => void FlowBridge.pillAction("dismiss", a.id));+ b.append(close);+ return b;+ }+ const text = tooltip ?? (vertical() ? messageText() : null);+ return text ? el("div", "bubble", text) : null;+}++// ── Drawing ───────────────────────────────────────────────────────────────────++let capsule: HTMLElement | null = null;+let lastKey = "";++function render() {+ const l = look();+ const open = l !== "resting";+ const length = open ? openLength(l) : RESTING_LENGTH;+ const thickness = open ? OPEN_THICKNESS : RESTING_THICKNESS;+ root.className = `${state.edge}${vertical() ? " vertical" : ""}`;+ const key = `${l}|${state.edge}|${state.phase}|${state.key}|${state.noteStartedAt}|${platform}`;+ if (!capsule || key !== lastKey) {+ lastKey = key;+ const next = el("div", "capsule");+ next.append(content(l));+ if (capsule) {+ // Keep the size it had, so the new one grows from it.+ next.style.width = capsule.style.width;+ next.style.height = capsule.style.height;+ }+ capsule?.remove();+ capsule = next;+ }+ capsule.classList.toggle("open", open);+ capsule.classList.toggle("handsfree", l === "handsFree");+ requestAnimationFrame(() => {+ if (!capsule) return;+ capsule.style.width = `${vertical() ? thickness : length}px`;+ capsule.style.height = `${vertical() ? length : thickness}px`;+ });+ // Bubble first in the DOM: the flex direction puts it beside the pill.+ for (const old of root.querySelectorAll(".bubble")) old.remove();+ const b = bubble();+ root.replaceChildren(...(b ? [b] : []), capsule);+ mochi.setState(state.phase === "thinking" ? "thinking" : "idle");+ wake();+ // Where the mouse is taken, once the sizes have settled.+ setTimeout(reportHot, 60);+ setTimeout(reportHot, 420);+}++function reportHot() {+ const rects: [number, number, number, number][] = [];+ const W = window.innerWidth;+ const H = window.innerHeight;+ const open = look() !== "resting";+ // The pill: a generous zone around the small resting one, the capsule once open.+ if (state.edge === "bottom") {+ const w = open ? 200 : 96;+ const h = open ? 46 : 26;+ rects.push([(W - w) / 2, H - h, w, h]);+ } else {+ const w = open ? 46 : 26;+ const h = open ? 200 : 96;+ rects.push([state.edge === "left" ? 0 : W - w, (H - h) / 2, w, h]);+ }+ const b = root.querySelector<HTMLElement>(".bubble");+ if (b) {+ const r = b.getBoundingClientRect();+ rects.push([r.left - 6, r.top - 6, r.width + 12, r.height + 12]);+ }+ void FlowBridge.pillHot(rects);+}++// ── Hover ─────────────────────────────────────────────────────────────────────++function setHovered(inside: boolean) {+ if (inside) {+ if (unhover !== null) {+ clearTimeout(unhover);+ unhover = null;+ }+ if (!hovered) {+ hovered = true;+ void FlowBridge.pillHover(true);+ render();+ }+ } else if (hovered && unhover === null) {+ // A short grace, to move from the pill to its bubble.+ unhover = window.setTimeout(() => {+ unhover = null;+ hovered = false;+ tooltip = null;+ void FlowBridge.pillHover(false);+ render();+ }, 250);+ }+}++document.addEventListener("pointermove", (e) => {+ const overPill = capsule?.contains(e.target as Node) || (e.target as HTMLElement)?.closest?.(".bubble");+ const near = capsule ? distanceTo(capsule, e.clientX, e.clientY) < 14 : false;+ setHovered(Boolean(overPill || near));+});+document.addEventListener("pointerleave", () => setHovered(false));++function distanceTo(elm: HTMLElement, x: number, y: number): number {+ const r = elm.getBoundingClientRect();+ const dx = Math.max(r.left - x, 0, x - r.right);+ const dy = Math.max(r.top - y, 0, y - r.bottom);+ return Math.hypot(dx, dy);+}++// ── The animation loop (only while something moves) ───────────────────────────++let frame: number | null = null;+let last = performance.now();++function animating(): boolean {+ return visible && look() !== "resting";+}++function tick(now: number) {+ frame = null;+ const dt = Math.min(0.05, (now - last) / 1000);+ last = now;+ const l = look();+ // The dots: follow the voice, or a slow wave while thinking.+ for (let i = 0; i < BANDS; i++) {+ const goal = state.phase === "thinking" ? 0.25 + 0.25 * Math.sin(now / 160 - i * 0.7) : state.phase === "listening" || state.phase === "locked" ? target[i] : 0;+ levels[i] += (goal - levels[i]) * Math.min(1, dt * 14);+ const bar = barsEl.children[i] as HTMLElement;+ const size = 3.4 + 16 * Math.max(0, levels[i]);+ if (vertical()) bar.style.width = `${size}px`;+ else bar.style.height = `${size}px`;+ }+ // Mochi: his eyes wander while you speak; still while only a call shows.+ if (l !== "note" || hovered) {+ mochi.lookX = Math.sin(now / 900) * 0.6;+ mochi.lookY = Math.cos(now / 1300) * 0.3;+ mochi.update(dt);+ const dpr = Math.min(2, window.devicePixelRatio || 1);+ const size = 22 / 0.6;+ if (mochiCanvas.width !== Math.round(size * dpr)) {+ mochiCanvas.width = Math.round(size * dpr);+ mochiCanvas.height = Math.round(size * dpr);+ }+ const ctx = mochiCanvas.getContext("2d");+ if (ctx) {+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);+ ctx.clearRect(0, 0, size, size);+ mochi.draw(ctx, size, size);+ }+ }+ const c = root.querySelector<HTMLElement>("[data-clock]");+ if (c && state.noteStartedAt) c.textContent = clock((Date.now() - state.noteStartedAt) / 1000);+ if (animating()) {+ // A call alone: one frame a second is enough for its clock.+ if (l === "note" && !hovered) setTimeout(() => wake(), 1000);+ else frame = requestAnimationFrame(tick);+ }+}++function wake() {+ if (frame === null && visible) {+ last = performance.now();+ frame = requestAnimationFrame(tick);+ }+}++// ── Boot ──────────────────────────────────────────────────────────────────────++async function main() {+ const boot = await Bridge.boot();+ setLanguage(resolveLanguage(boot?.settings.language, systemLanguages()));+ const status = await FlowBridge.status();+ if (status) platform = status.platform;+ state = (await FlowBridge.pillState()) ?? state;+ visible = state.enabled || state.noteStartedAt !== null || state.announcement !== null;+ render();+ void onEvent<PillState>("pill-state", (s) => {+ state = s;+ if (s.phase === "listening") target.fill(0);+ render();+ });+ void onEvent<number[]>("pill-bands", (bands) => {+ for (let i = 0; i < BANDS; i++) target[i] = bands[i] ?? 0;+ wake();+ });+ void onEvent<boolean>("pill-visible", (v) => {+ visible = v;+ if (!v) {+ hovered = false;+ tooltip = null;+ }+ render();+ });+ // Windows: the cursor poll tells when the pointer is over the pill.+ void onEvent<boolean>("pill-pointer", (inside) => {+ if (!inside) setHovered(false);+ });+ void onEvent<Settings>("settings-changed", (s) => {+ setLanguage(resolveLanguage(s.language, systemLanguages()));+ render();+ });+}++void main();diff --git a/windows/src/pill/pill.css b/windows/src/pill/pill.cssnew file mode 100644index 00000000..f2d7a750--- /dev/null+++ b/windows/src/pill/pill.css@@ -0,0 +1,322 @@+/* Flow dictation's pill (FlowPill.swift): a see-through capsule resting on an+ edge of the screen, black once open, and a bubble beside it. */++* {+ box-sizing: border-box;+ margin: 0;+ padding: 0;+}++html,+body {+ width: 100%;+ height: 100%;+ overflow: hidden;+ background: transparent;+ user-select: none;+ -webkit-user-select: none;+ cursor: default;+ font: 500 12.5px system-ui, "Segoe UI Variable Text", "Segoe UI", "Noto Sans", sans-serif;+ color: #fff;+}++#pill {+ position: absolute;+ inset: 0;+ display: flex;+ gap: 8px;+}++#pill.bottom {+ flex-direction: column;+ align-items: center;+ justify-content: flex-end;+ padding-bottom: 2px;+}++#pill.left {+ flex-direction: row;+ align-items: center;+ justify-content: flex-start;+ padding-left: 2px;+}++#pill.right {+ flex-direction: row-reverse;+ align-items: center;+ justify-content: flex-start;+ padding-right: 2px;+}++.capsule {+ position: relative;+ flex: 0 0 auto;+ border-radius: 999px;+ overflow: hidden;+ background: rgba(0, 0, 0, 0.28);+ box-shadow: inset 0 0 0 1.2px rgba(255, 255, 255, 0.42);+ transition:+ width 0.36s cubic-bezier(0.34, 1.36, 0.64, 1),+ height 0.36s cubic-bezier(0.34, 1.36, 0.64, 1),+ background 0.2s,+ box-shadow 0.2s;+}++.capsule.open {+ background: rgba(0, 0, 0, 0.94);+ box-shadow:+ inset 0 0 0 1px rgba(255, 255, 255, 0.16),+ 0 4px 10px rgba(0, 0, 0, 0.35);+}++.capsule.handsfree {+ box-shadow:+ inset 0 0 0 1.5px rgba(249, 115, 22, 0.85),+ 0 4px 10px rgba(0, 0, 0, 0.35);+}++.content {+ position: absolute;+ inset: 0;+ display: flex;+ align-items: center;+ justify-content: center;+ gap: 9px;+ opacity: 0;+ transform: scale(0.5);+ transition:+ opacity 0.1s ease-in,+ transform 0.1s ease-in;+}++.capsule.open .content {+ opacity: 1;+ transform: scale(1);+ transition:+ opacity 0.2s ease-out 0.07s,+ transform 0.2s ease-out 0.07s;+}++.vertical .content {+ flex-direction: column;+}++.mochi {+ width: 22px;+ height: 22px;+ flex: 0 0 22px;+ position: relative;+}++.mochi canvas {+ position: absolute;+ left: -7.33px;+ top: -7.33px;+ width: 36.67px;+ height: 36.67px;+}++.pbtn {+ width: 28px;+ height: 28px;+ flex: 0 0 28px;+ border: 0;+ border-radius: 50%;+ background: transparent;+ color: #e8e9ec;+ display: inline-flex;+ align-items: center;+ justify-content: center;+ cursor: pointer;+ transition: background 0.12s;+}++.pbtn:hover {+ background: rgba(255, 255, 255, 0.14);+}++.pbtn.small {+ width: 22px;+ height: 22px;+ flex-basis: 22px;+ background: rgba(255, 255, 255, 0.16);+}++.pbtn.filled {+ background: #fff;+ color: #000;+}++.pbtn svg {+ width: 15px;+ height: 15px;+ fill: none;+ stroke: currentColor;+ stroke-width: 2;+ stroke-linecap: round;+ stroke-linejoin: round;+}++.pbtn.small svg {+ width: 11px;+ height: 11px;+ stroke-width: 2.6;+}++.bars {+ display: flex;+ align-items: center;+ gap: 3.2px;+ height: 22px;+}++.bars i {+ width: 3.4px;+ height: 3.4px;+ border-radius: 2px;+ background: rgba(255, 255, 255, 0.94);+}++.vertical .bars {+ flex-direction: column;+ height: auto;+ width: 22px;+}++.vertical .bars i {+ height: 3.4px;+}++.message {+ font: 500 12px system-ui, "Segoe UI", sans-serif;+ color: #e8e9ec;+ white-space: nowrap;+}++.rec {+ width: 8px;+ height: 8px;+ border-radius: 50%;+ background: #ff453a;+ box-shadow: 0 0 3px rgba(255, 69, 58, 0.6);+ flex: 0 0 8px;+}++.clock {+ font: 600 12px system-ui, "Segoe UI", sans-serif;+ font-variant-numeric: tabular-nums;+ color: #e8e9ec;+}++.vertical .clock {+ font-size: 10px;+}++.stop {+ width: 22px;+ height: 22px;+ border-radius: 50%;+ border: 0;+ background: rgba(255, 255, 255, 0.16);+ display: inline-flex;+ align-items: center;+ justify-content: center;+ cursor: pointer;+}++.stop i {+ width: 8px;+ height: 8px;+ border-radius: 2px;+ background: #fff;+}++/* The bubble beside the pill: a tip, a short message, an announcement. */+.bubble {+ flex: 0 0 auto;+ background: rgba(0, 0, 0, 0.94);+ box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);+ border-radius: 999px;+ padding: 0 14px;+ height: 30px;+ display: flex;+ align-items: center;+ font: 600 12.5px system-ui, "Segoe UI", sans-serif;+ white-space: nowrap;+ animation: pop 0.2s ease-out;+}++.bubble.announce {+ border-radius: 16px;+ height: auto;+ padding: 10px 10px 10px 14px;+ gap: 10px;+ white-space: normal;+ max-width: 420px;+ align-items: center;+}++.bubble .icon {+ width: 18px;+ height: 18px;+ flex: 0 0 18px;+}++.bubble .icon svg {+ width: 18px;+ height: 18px;+ fill: none;+ stroke: currentColor;+ stroke-width: 2;+ stroke-linecap: round;+ stroke-linejoin: round;+}++.bubble .text {+ font-weight: 500;+ line-height: 1.35;+ flex: 1 1 auto;+}++.bubble .act {+ border: 0;+ border-radius: 999px;+ padding: 6px 12px;+ background: #fff;+ color: #000;+ font: 600 12px system-ui, "Segoe UI", sans-serif;+ cursor: pointer;+ white-space: nowrap;+}++.bubble .close {+ border: 0;+ width: 22px;+ height: 22px;+ border-radius: 50%;+ background: rgba(255, 255, 255, 0.12);+ color: #c7cad0;+ cursor: pointer;+ display: inline-flex;+ align-items: center;+ justify-content: center;+}++.bubble .close svg {+ width: 10px;+ height: 10px;+ stroke: currentColor;+ stroke-width: 2.6;+ fill: none;+}++@keyframes pop {+ from {+ opacity: 0;+ transform: scale(0.8);+ }+ to {+ opacity: 1;+ transform: scale(1);+ }+}diff --git a/windows/src/settings/main.ts b/windows/src/settings/main.tsindex 7d0dfe6c..c3791c71 100644--- a/windows/src/settings/main.ts+++ b/windows/src/settings/main.ts@@ -1,6 +1,7 @@-// Settings window — the place where anything that writes to disk is confirmed.-// Stage 2 covers the Claude Code hooks and the general preferences; API keys and-// integrations land here too in a later stage.+// The Coucou window (settings.html): Flow dictation, the Notetaker and, under+// Notch, every setting of the island — the place where anything that writes to+// disk is confirmed. The window's frame and the Flow pages live in ../hub; the+// island's settings are drawn here, one Notch page at a time.import "./settings.css";import { Bridge, onEvent, type HookPreview, type HookStatus, type ShortcutsReport } from "../core/bridge";@@ -16,6 +17,8 @@ import {sanitizeDeclared, toggleDeclared, type PillDefinition,} from "../core/pills";import { h, clear } from "../views/dom";+import { startHub, type PageId } from "../hub/shell";+import { FLOW_PAGE_RENDERERS } from "../hub/pages";import { agentsSection } from "./agents";import { phoneSection } from "./phone";import { colorDot } from "./colors";@@ -32,7 +35,10 @@ const KEY_STORE = navigator.userAgent.includes("Windows")let settings: Settings = { ...DEFAULT_SETTINGS };let version = "";-const root = document.getElementById("settings-root")!;+const windowRoot = document.getElementById("hub")!;+/** Where the Notch page being shown draws its sections. */+let root: HTMLElement = windowRoot;+let hub: { redraw(): void; current(): PageId } | null = null;async function save() {await Bridge.saveSettings(settings);@@ -1263,30 +1269,7 @@ function applyLanguage() {function applyDirection() {document.documentElement.dir = isRtl() ? "rtl" : "ltr";- document.title = t("Settings — Coucou");-}--let rendering: Promise<void> | null = null;-let renderAgain = false;--/** Redraws every section from fresh state, keeping the scroll position. */-async function rerender() {- if (rendering) {- renderAgain = true;- return;- }- const scroll = document.scrollingElement?.scrollTop ?? 0;- rendering = render();- try {- await rendering;- } finally {- rendering = null;- }- if (document.scrollingElement) document.scrollingElement.scrollTop = scroll;- if (renderAgain) {- renderAgain = false;- await rerender();- }+ document.title = "Coucou";}// ── Boot ──────────────────────────────────────────────────────────────────────@@ -1299,11 +1282,19 @@ async function main() {}setLanguage(resolveLanguage(settings.language, systemLanguages()));applyDirection();+ hub = await startHub(windowRoot, {+ version,+ flowPages: FLOW_PAGE_RENDERERS,+ renderNotch: async (page, container) => {+ notchPage = page;+ root = container;+ await render();+ },+ });onLanguageChange(() => {applyDirection();- void rerender();+ hub?.redraw();});- await render();void onEvent<ShortcutsReport>("shortcuts-status", (fresh) => shortcutsListener?.report(fresh));void onEvent<Settings>("settings-changed", (s) => {@@ -1317,7 +1308,10 @@ async function main() {});}-/** Reads what the sections show and draws them all. */+/** The Notch page being shown. */+let notchPage: PageId = "general";++/** Reads what the sections of the Notch page show and draws them. */async function render() {const status = (await Bridge.hooksStatus()) ?? {installed: false, planRelayInstalled: false, settingsPath: "", hookPath: "", hookReady: false,@@ -1360,24 +1354,22 @@ async function render() {localRedraw = null;shortcutsListener = null;clear(root);- root.append(- h("h1", {}, h("span", { text: "Coucou" }), h("span", { class: "version", text: version })),- claudeSection(status),- agentsSection(agents),- planSection(status),- apiSection(hasKey),- chatProvidersSection(chatKeys, keyChanged),- localSection(customKey),- activePillsSection(connected),- integrationsSection(present),- phoneSection(settings.phoneLink ?? false, toggle, settings),- generalSection(),- shortcutsSection(shortcutReport),- h("div", {+ const sections: Partial<Record<PageId, () => HTMLElement[]>> = {+ general: () => [generalSection()],+ pills: () => [activePillsSection(connected)],+ agents: () => [claudeSection(status), agentsSection(agents), planSection(status)],+ chat: () => [apiSection(hasKey), chatProvidersSection(chatKeys, keyChanged), localSection(customKey)],+ integrations: () => [integrationsSection(present)],+ phone: () => [phoneSection(settings.phoneLink ?? false, toggle, settings)],+ shortcuts: () => [shortcutsSection(shortcutReport)],+ };+ root.append(...(sections[notchPage]?.() ?? []));+ if (notchPage === "general") {+ root.append(h("div", {class: "hint",text: t("No telemetry. Network requests only go to the services you configure yourself."),- }),- );+ }));+ }}void main();diff --git a/windows/tests/i18n.test.mjs b/windows/tests/i18n.test.mjsindex 7f836d54..af64a6c3 100644--- a/windows/tests/i18n.test.mjs+++ b/windows/tests/i18n.test.mjs@@ -257,6 +257,7 @@ const NOT_TEXT = new Set(["finished", // a task state and a pill badge"unknown", // a CI state"Resend", // the service's name (the Mac's "Resend" is a button: send again)+ "Stop", // Claude Code's hook event (the Mac's "Stop" is the Notetaker's button)]);test("no known user-facing English literal outside t() in the views and settings", () => {diff --git a/windows/vite.config.ts b/windows/vite.config.tsindex f9cb49f2..3ea7c7a2 100644--- a/windows/vite.config.ts+++ b/windows/vite.config.ts@@ -64,6 +64,7 @@ export default defineConfig({island: resolve(__dirname, "index.html"),settings: resolve(__dirname, "settings.html"),mochi: resolve(__dirname, "mochi.html"),+ pill: resolve(__dirname, "pill.html"),},},},