Skip to content

Desktop app that records your on-screen work session and uses the GitHub Copilot SDK to reconstruct it as an intent + ordered steps, then builds a reusable Skill or Automation for Microsoft Autopilots like Scout, Microsoft Copilot Cowork, or Copilot Studio.

Split UI into recorder HUD + docked sessions library windows

adileid1480fda4703
diff --git a/electron/main.ts b/electron/main.ts
index ed53cce..b829de4 100644
--- a/electron/main.ts
+++ b/electron/main.ts
@@ -1,7 +1,8 @@
-import { app, globalShortcut, type BrowserWindow } from "electron";
+import { app, globalShortcut, ipcMain, BrowserWindow } from "electron";
import { IPC } from "../common/ipc";
import { createCollectors } from "./collectors";
+import { Describer } from "./describer/describer";
import { processSession } from "./pipeline";
import { registerIpc } from "./ipc";
import { createLogger } from "./logger";
@@ -9,11 +10,13 @@ import { RecorderController } from "./recorder/controller";
import { SettingsStore } from "./settings";
import { createTray } from "./tray";
import { VideoRecorder } from "./video/recorder";
-import { createMainWindow } from "./window";
+import { createLibraryWindow, createRecorderWindow, redockLibrary } from "./window";
const log = createLogger("Main");
-let mainWindow: BrowserWindow | null = null;
+let recorderWindow: BrowserWindow | null = null;
+let libraryWindow: BrowserWindow | null = null;
+let recorderHome: Electron.Rectangle | null = null;
let settings: SettingsStore | null = null;
const recorder = new RecorderController({
resolveConfig: () => (settings as SettingsStore).resolve(),
@@ -22,21 +25,52 @@ const recorder = new RecorderController({
postProcess: processSession,
});
+/** Send an event to every live window (recorder HUD + library, if open). */
+function broadcast(channel: string, payload: unknown): void {
+ for (const win of BrowserWindow.getAllWindows()) {
+ if (!win.isDestroyed()) win.webContents.send(channel, payload);
+ }
+}
+
+const describer = new Describer((progress) => broadcast(IPC.analyzeProgress, progress));
+
+/** Open, focus, and re-dock the Sessions library window (creating it lazily). */
+function openLibrary(): void {
+ if (!recorderWindow || recorderWindow.isDestroyed()) return;
+ if (libraryWindow && !libraryWindow.isDestroyed()) {
+ redockLibrary(recorderWindow, libraryWindow);
+ libraryWindow.show();
+ libraryWindow.focus();
+ return;
+ }
+ recorderHome = recorderWindow.getBounds();
+ libraryWindow = createLibraryWindow(recorderWindow);
+ libraryWindow.on("closed", () => {
+ libraryWindow = null;
+ // Return the recorder to where it sat before it made room for the library.
+ if (recorderWindow && !recorderWindow.isDestroyed() && recorderHome) {
+ recorderWindow.setBounds(recorderHome);
+ }
+ recorderHome = null;
+ });
+}
+
app.whenReady().then(() => {
settings = new SettingsStore();
- registerIpc(recorder, settings);
+ registerIpc(recorder, settings, describer);
log.info("Capture level:", settings.level);
- recorder.onStatusChanged((status) => {
- if (mainWindow && !mainWindow.isDestroyed()) {
- mainWindow.webContents.send(IPC.statusChanged, status);
- }
+ ipcMain.handle(IPC.openLibrary, () => openLibrary());
+ ipcMain.handle(IPC.closeLibrary, () => {
+ if (libraryWindow && !libraryWindow.isDestroyed()) libraryWindow.close();
});
- mainWindow = createMainWindow();
+ recorder.onStatusChanged((status) => broadcast(IPC.statusChanged, status));
+
+ recorderWindow = createRecorderWindow();
try {
- createTray(recorder, mainWindow);
+ createTray(recorder, recorderWindow);
} catch (err) {
log.warn("Tray unavailable:", err);
}
@@ -49,11 +83,11 @@ app.whenReady().then(() => {
}
app.on("activate", () => {
- if (!mainWindow || mainWindow.isDestroyed()) {
- mainWindow = createMainWindow();
+ if (!recorderWindow || recorderWindow.isDestroyed()) {
+ recorderWindow = createRecorderWindow();
} else {
- mainWindow.show();
- mainWindow.focus();
+ recorderWindow.show();
+ recorderWindow.focus();
}
});
});
@@ -65,6 +99,7 @@ app.on("window-all-closed", () => {
app.on("will-quit", () => {
globalShortcut.unregisterAll();
if (recorder.state === "recording") void recorder.stop();
+ void describer.dispose();
});
diff --git a/electron/window.ts b/electron/window.ts
index baedeb7..31fe36a 100644
--- a/electron/window.ts
+++ b/electron/window.ts
@@ -1,16 +1,37 @@
import path from "node:path";
import { fileURLToPath } from "node:url";
-import { BrowserWindow } from "electron";
+import { BrowserWindow, screen } from "electron";
const dirname = path.dirname(fileURLToPath(import.meta.url));
-export function createMainWindow(): BrowserWindow {
+/** Compact recording HUD — fixed footprint, never resizes. */
+const RECORDER = { width: 400, height: 600 };
+/** Library sizing bounds; actual width adapts to the space beside the recorder. */
+const LIBRARY = { desiredWidth: 1140, minWidth: 720, floorWidth: 520, maxHeight: 820 };
+const MARGIN = 12;
+const GAP = 10;
+
+type Bounds = { x: number; y: number; width: number; height: number };
+
+function loadRoute(win: BrowserWindow, hash?: string): void {
+ const devUrl = process.env.VITE_DEV_SERVER_URL;
+ if (devUrl) {
+ void win.loadURL(hash ? `${devUrl}#${hash}` : devUrl);
+ } else {
+ void win.loadFile(path.join(dirname, "..", "dist", "index.html"), hash ? { hash } : undefined);
+ }
+}
+
+export function createRecorderWindow(): BrowserWindow {
const win = new BrowserWindow({
- width: 420,
- height: 580,
+ width: RECORDER.width,
+ height: RECORDER.height,
+ resizable: false,
+ maximizable: false,
+ fullscreenable: false,
title: "Skill Recorder",
- backgroundColor: "#16181d",
+ backgroundColor: "#111318",
webPreferences: {
preload: path.join(dirname, "preload.cjs"),
contextIsolation: true,
@@ -18,12 +39,79 @@ export function createMainWindow(): BrowserWindow {
sandbox: false,
},
});
+ loadRoute(win);
+ return win;
+}
- const devUrl = process.env.VITE_DEV_SERVER_URL;
- if (devUrl) {
- void win.loadURL(devUrl);
+/**
+ * Lay the recorder and library out as an attached pair that is always fully
+ * visible. The recorder keeps its place and the library docks to its right
+ * whenever there's room; only when the right side is too tight do we slide the
+ * recorder left (and, on very small displays, shrink the library) so the two
+ * never overlap.
+ */
+function computeDock(recorder: BrowserWindow): { recorder: { x: number; y: number }; library: Bounds } {
+ const rb = recorder.getBounds();
+ const { workArea: wa } = screen.getDisplayMatching(rb);
+ const recW = rb.width;
+ const recH = rb.height;
+
+ const libH = Math.min(LIBRARY.maxHeight, wa.height - MARGIN * 2);
+ const pairTop = Math.max(
+ wa.y + MARGIN,
+ Math.min(rb.y, wa.y + wa.height - MARGIN - Math.max(recH, libH)),
+ );
+
+ let recX = rb.x;
+ let libX = recX + recW + GAP;
+ const rightRoom = wa.x + wa.width - MARGIN - libX;
+
+ let libW: number;
+ if (rightRoom >= LIBRARY.minWidth) {
+ libW = Math.min(rightRoom, LIBRARY.desiredWidth);
} else {
- void win.loadFile(path.join(dirname, "..", "dist", "index.html"));
+ const maxPairLibW = wa.width - MARGIN * 2 - recW - GAP;
+ libW = Math.max(LIBRARY.floorWidth, Math.min(LIBRARY.desiredWidth, maxPairLibW));
+ const totalW = recW + GAP + libW;
+ recX = Math.max(wa.x + MARGIN, wa.x + wa.width - MARGIN - totalW);
+ libX = recX + recW + GAP;
}
+
+ return {
+ recorder: { x: Math.round(recX), y: Math.round(pairTop) },
+ library: { x: Math.round(libX), y: Math.round(pairTop), width: Math.round(libW), height: Math.round(libH) },
+ };
+}
+
+export function createLibraryWindow(recorder: BrowserWindow): BrowserWindow {
+ const layout = computeDock(recorder);
+ const win = new BrowserWindow({
+ ...layout.library,
+ minWidth: 560,
+ minHeight: 480,
+ show: false,
+ title: "Skill Recorder — Sessions",
+ backgroundColor: "#111318",
+ webPreferences: {
+ preload: path.join(dirname, "preload.cjs"),
+ contextIsolation: true,
+ nodeIntegration: false,
+ sandbox: false,
+ },
+ });
+ // Move the recorder and reveal the library together so the pair appears docked.
+ win.once("ready-to-show", () => {
+ if (!recorder.isDestroyed()) recorder.setPosition(layout.recorder.x, layout.recorder.y, false);
+ win.show();
+ });
+ loadRoute(win, "library");
return win;
}
+
+/** Re-dock an already-open library beside the recorder and bring it forward. */
+export function redockLibrary(recorder: BrowserWindow, library: BrowserWindow): void {
+ if (library.isDestroyed() || recorder.isDestroyed()) return;
+ const layout = computeDock(recorder);
+ recorder.setPosition(layout.recorder.x, layout.recorder.y, false);
+ library.setBounds(layout.library, false);
+}
diff --git a/src/App.css b/src/App.css
index 82eff92..9258ee5 100644
--- a/src/App.css
+++ b/src/App.css
@@ -1,13 +1,18 @@
:root {
color-scheme: dark;
- --bg: #16181d;
- --panel: #1e2128;
- --text: #e7e9ee;
- --muted: #9aa0ab;
- --accent: #4f7cff;
- --rec: #e0483d;
- --good: #35c26b;
- --bad: #e0483d;
+ --deck: #111318;
+ --surface: #181b21;
+ --surface-2: #1f232b;
+ --line: #2a2f39;
+ --text: #e9ebf0;
+ --muted: #8b93a1;
+ --faint: #5c6472;
+ --rec: #ec4d3d;
+ --signal: #f0a641;
+ --signal-dim: rgba(240, 166, 65, 0.14);
+ --go: #43c26b;
+ --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
+ --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
}
* {
@@ -16,131 +21,352 @@
body {
margin: 0;
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
- background: var(--bg);
+ font-family: var(--sans);
+ background: var(--deck);
color: var(--text);
user-select: none;
+ -webkit-font-smoothing: antialiased;
}
-.app {
- padding: 22px 24px;
+/* --- Shared primitives ---------------------------------------------------- */
+
+.eyebrow {
+ font-family: var(--mono);
+ font-size: 10px;
+ text-transform: uppercase;
+ letter-spacing: 0.16em;
+ color: var(--faint);
+}
+
+.pill {
+ font-family: var(--mono);
+ font-size: 11px;
+ color: var(--muted);
+ background: var(--surface-2);
+ border-radius: 9px;
+ padding: 1px 8px;
+ line-height: 16px;
+ min-width: 18px;
+ text-align: center;
+}
+
+button {
+ font: inherit;
+ border: none;
+ border-radius: 10px;
+ cursor: pointer;
+ transition: filter 0.15s ease, opacity 0.15s ease, border-color 0.15s ease,
+ transform 0.12s ease;
+}
+
+button:disabled {
+ opacity: 0.45;
+ cursor: default;
+}
+
+button:focus-visible,
+.fb-input:focus-visible,
+.overall-fb:focus-visible {
+ outline: 2px solid var(--signal);
+ outline-offset: 2px;
+}
+
+/* Amber "signal" call-to-action — the primary action colour. */
+.record-cta {
+ background: var(--signal);
+ color: #1a1206;
+ font-weight: 600;
+ font-size: 13px;
+ padding: 9px 16px;
+}
+
+.record-cta:not(:disabled):hover {
+ filter: brightness(1.06);
+}
+
+.ghost {
+ background: transparent;
+ border: 1px solid var(--line);
+ color: var(--muted);
+ border-radius: 8px;
+ padding: 6px 12px;
+ font-size: 12px;
+}
+
+.ghost:hover {
+ border-color: var(--signal);
+ color: var(--text);
+}
+
+.secondary {
+ background: var(--surface-2);
+ color: var(--text);
+ font-size: 13px;
+ padding: 9px 14px;
+}
+
+.secondary:not(:disabled):hover {
+ filter: brightness(1.12);
+}
+
+.status-line {
+ display: flex;
+ align-items: center;
+ gap: 9px;
+ background: var(--surface);
+ border: 1px solid var(--line);
+ border-radius: 9px;
+ padding: 10px 12px;
+ font-size: 12.5px;
+ color: var(--muted);
+}
+
+.spinner {
+ width: 13px;
+ height: 13px;
+ border-radius: 50%;
+ border: 2px solid var(--line);
+ border-top-color: var(--signal);
+ animation: spin 0.7s linear infinite;
+ flex: 0 0 auto;
+}
+
+@keyframes spin {
+ to {
+ transform: rotate(360deg);
+ }
+}
+
+@keyframes pulse {
+ 0%,
+ 100% {
+ opacity: 1;
+ }
+ 50% {
+ opacity: 0.28;
+ }
+}
+
+.conf {
+ font-family: var(--mono);
+ font-size: 9px;
+ text-transform: uppercase;
+ letter-spacing: 0.06em;
+ padding: 2px 6px;
+ border-radius: 5px;
+ font-weight: 600;
+}
+
+.conf.high {
+ background: rgba(67, 194, 107, 0.18);
+ color: var(--go);
+}
+
+.conf.medium {
+ background: var(--signal-dim);
+ color: var(--signal);
+}
+
+.conf.low {
+ background: rgba(236, 77, 61, 0.16);
+ color: #f2a29a;
+}
+
+.tag {
+ font-family: var(--mono);
+ font-size: 9px;
+ text-transform: uppercase;
+ letter-spacing: 0.06em;
+ font-weight: 600;
+ padding: 2px 6px;
+ border-radius: 5px;
+ background: var(--surface-2);
+ color: var(--muted);
+}
+
+.tag.ok {
+ background: rgba(67, 194, 107, 0.16);
+ color: var(--go);
+}
+
+.tag.an {
+ background: var(--signal-dim);
+ color: var(--signal);
+}
+
+.tag.warn {
+ background: var(--surface-2);
+ color: var(--muted);
+}
+
+/* =========================================================================
+ Recorder HUD (compact window)
+ ========================================================================= */
+
+.hud {
display: flex;
flex-direction: column;
- gap: 14px;
+ gap: 12px;
+ padding: 16px 18px 14px;
+ height: 100vh;
}
-header {
+.hud-head {
display: flex;
- align-items: baseline;
+ align-items: center;
justify-content: space-between;
}
-h1 {
- font-size: 18px;
+.wordmark {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+
+.mark-lamp {
+ width: 10px;
+ height: 10px;
+ border-radius: 50%;
+ background: var(--signal);
+ box-shadow: 0 0 9px rgba(240, 166, 65, 0.55);
+}
+
+.mark-text {
+ font-size: 14px;
font-weight: 600;
- margin: 0;
}
-.status {
+.rec-chip {
display: inline-flex;
align-items: center;
gap: 6px;
- font-size: 13px;
+ font-family: var(--mono);
+ font-size: 10px;
+ letter-spacing: 0.14em;
+ text-transform: uppercase;
color: var(--muted);
}
-.status .dot {
- width: 9px;
- height: 9px;
+.rec-chip .lamp {
+ width: 7px;
+ height: 7px;
border-radius: 50%;
- background: var(--muted);
+ background: var(--faint);
}
-.status.rec {
+.rec-chip.rec {
color: var(--rec);
}
-.status.rec .dot {
+.rec-chip.rec .lamp {
background: var(--rec);
+ box-shadow: 0 0 8px rgba(236, 77, 61, 0.7);
animation: pulse 1.2s infinite ease-in-out;
}
-.timer {
- font-variant-numeric: tabular-nums;
- margin-left: 4px;
+/* The signature: a physical record transport. */
+.transport {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 9px;
+ padding: 10px 0 4px;
}
-@keyframes pulse {
- 0%,
- 100% {
- opacity: 1;
- }
- 50% {
- opacity: 0.3;
- }
+.record {
+ width: 76px;
+ height: 76px;
+ border-radius: 50%;
+ background: radial-gradient(circle at 50% 40%, #23262e, #14161b);
+ border: 1px solid var(--line);
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 8px 20px rgba(0, 0, 0, 0.45);
+ display: grid;
+ place-items: center;
}
-button {
- font: inherit;
- border: none;
- border-radius: 10px;
- padding: 12px 16px;
- cursor: pointer;
- transition: filter 0.15s ease, opacity 0.15s ease;
+.record:hover {
+ border-color: #3a4150;
+ transform: translateY(-1px);
}
-button:hover {
- filter: brightness(1.08);
+.record:active {
+ transform: translateY(0);
}
-button:disabled {
- opacity: 0.4;
- cursor: default;
+.record-glyph {
+ width: 26px;
+ height: 26px;
+ border-radius: 50%;
+ background: var(--rec);
+ box-shadow: 0 0 0 4px rgba(236, 77, 61, 0.16);
+ transition: width 0.18s ease, height 0.18s ease, border-radius 0.18s ease;
}
-.primary {
- font-size: 16px;
- font-weight: 600;
- color: white;
+.record.on {
+ border-color: rgba(236, 77, 61, 0.5);
+ animation: recpulse 1.7s ease-in-out infinite;
}
-.primary.start {
- background: var(--accent);
+.record.on .record-glyph {
+ width: 21px;
+ height: 21px;
+ border-radius: 5px;
}
-.primary.stop {
- background: var(--rec);
+@keyframes recpulse {
+ 0%,
+ 100% {
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 0 0 rgba(236, 77, 61, 0),
+ 0 8px 20px rgba(0, 0, 0, 0.45);
+ }
+ 50% {
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 0 7px rgba(236, 77, 61, 0.1),
+ 0 8px 20px rgba(0, 0, 0, 0.45);
+ }
}
-.secondary {
- background: var(--panel);
+.timecode {
+ font-family: var(--mono);
+ font-size: 34px;
+ font-weight: 600;
+ letter-spacing: 0.05em;
+ font-variant-numeric: tabular-nums;
+ color: var(--faint);
+ line-height: 1;
+}
+
+.timecode.live {
color: var(--text);
- font-size: 14px;
}
-.meta {
- margin: 2px 0;
+.transport-sub {
font-size: 12px;
color: var(--muted);
- font-variant-numeric: tabular-nums;
+ text-align: center;
+ min-height: 15px;
}
-.doctor {
- background: var(--panel);
- border-radius: 10px;
- padding: 10px 12px;
- display: flex;
- flex-direction: column;
- gap: 6px;
+.marker {
+ background: transparent;
+ border: 1px solid var(--line);
+ color: var(--muted);
+ font-size: 13px;
+ padding: 9px;
+}
+
+.marker:not(:disabled):hover {
+ border-color: #3a4150;
+ color: var(--text);
}
.capture {
- background: var(--panel);
- border-radius: 10px;
- padding: 10px 12px;
+ background: var(--surface);
+ border: 1px solid var(--line);
+ border-radius: 12px;
+ padding: 11px 12px;
display: flex;
flex-direction: column;
- gap: 8px;
+ gap: 9px;
}
.capture-head {
@@ -149,97 +375,625 @@ button:disabled {
justify-content: space-between;
}
-.capture-title {
- font-size: 13px;
- font-weight: 600;
-}
-
.capture-custom {
- font-size: 11px;
+ font-family: var(--mono);
+ font-size: 10px;
color: var(--muted);
- border: 1px solid var(--muted);
- border-radius: 6px;
- padding: 1px 6px;
}
.segmented {
display: flex;
gap: 4px;
- background: var(--bg);
- border-radius: 8px;
+ background: var(--deck);
+ border-radius: 9px;
padding: 3px;
}
.seg {
flex: 1;
- padding: 7px 8px;
- font-size: 13px;
+ padding: 7px 6px;
+ font-size: 12.5px;
border-radius: 6px;
background: transparent;
color: var(--muted);
+ font-weight: 500;
}
-.seg:hover:not(:disabled) {
- filter: none;
+.seg:hover:not(:disabled):not(.on) {
color: var(--text);
}
.seg.on {
- background: var(--accent);
- color: white;
+ background: var(--signal);
+ color: #1a1206;
+ font-weight: 600;
}
.capture-blurb {
margin: 0;
- font-size: 12px;
+ font-size: 11.5px;
color: var(--muted);
line-height: 1.4;
}
-.capture-note {
- margin: 0;
- font-size: 11px;
- color: var(--muted);
- font-style: italic;
+.sessions-open {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ background: var(--surface);
+ border: 1px solid var(--line);
+ color: var(--text);
+ font-size: 13px;
+ font-weight: 600;
+ border-radius: 11px;
+ padding: 11px 14px;
+}
+
+.sessions-open:hover {
+ border-color: var(--signal);
+}
+
+.sessions-open-right {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+
+.sessions-open .ext {
+ color: var(--signal);
+ font-size: 14px;
+}
+
+.doctor {
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ margin-top: auto;
}
.row {
display: flex;
align-items: center;
gap: 8px;
- font-size: 13px;
+ font-size: 12.5px;
}
.row-label {
flex: 1;
+ color: var(--muted);
}
.row-note {
- color: var(--muted);
+ font-family: var(--mono);
+ font-size: 11px;
+ color: var(--faint);
}
.badge {
- width: 18px;
- height: 18px;
+ width: 16px;
+ height: 16px;
border-radius: 50%;
display: inline-flex;
align-items: center;
justify-content: center;
- font-size: 11px;
- color: white;
+ font-size: 10px;
+ color: #0e0f13;
}
.badge.good {
- background: var(--good);
+ background: var(--go);
}
.badge.bad {
- background: var(--bad);
+ background: var(--rec);
}
.hint {
- margin: 4px 0 0;
+ margin: 0;
+ font-size: 11px;
+ color: var(--faint);
+ text-align: center;
+ font-family: var(--mono);
+ letter-spacing: 0.03em;
+}
+
+/* =========================================================================
+ Sessions library (resizable window)
+ ========================================================================= */
+
+.lib {
+ display: flex;
+ height: 100vh;
+}
+
+.lib-list {
+ width: 300px;
+ flex: 0 0 300px;
+ border-right: 1px solid var(--line);
+ display: flex;
+ flex-direction: column;
+ background: var(--deck);
+}
+
+.lib-list-head {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 16px 16px 10px;
+}
+
+.lib-list-scroll {
+ flex: 1;
+ overflow-y: auto;
+ padding: 0 12px 12px;
+}
+
+.sessions-empty {
+ margin: 8px 4px;
+ font-size: 12px;
+ color: var(--muted);
+}
+
+.sess-list {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+}
+
+.sess {
+ width: 100%;
+ text-align: left;
+ background: var(--surface);
+ border: 1px solid var(--line);
+ border-radius: 10px;
+ padding: 9px 11px;
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ color: var(--text);
+}
+
+.sess:hover {
+ border-color: #3a4150;
+}
+
+.sess.on {
+ border-color: var(--signal);
+ background: #201d16;
+}
+
+.sess-top {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 6px;
+}
+
+.sess-when {
+ font-family: var(--mono);
font-size: 11px;
color: var(--muted);
+}
+
+.sess-intent {
+ font-size: 12.5px;
+ font-weight: 600;
+ line-height: 1.3;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+}
+
+.sess-sub {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+ font-family: var(--mono);
+ font-size: 10px;
+ color: var(--faint);
+}
+
+.lib-detail {
+ flex: 1;
+ min-width: 0;
+ display: flex;
+}
+
+.detail-empty {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 10px;
+ color: var(--muted);
+ padding: 40px;
text-align: center;
}
+
+.detail-empty p {
+ max-width: 320px;
+ font-size: 13px;
+ line-height: 1.5;
+ margin: 0;
+}
+
+/* --- Analysis workspace --------------------------------------------------- */
+
+.ws {
+ display: flex;
+ flex-direction: column;
+ width: 100%;
+ height: 100vh;
+}
+
+.ws-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 10px;
+ padding: 16px 22px;
+ border-bottom: 1px solid var(--line);
+}
+
+.ws-titles {
+ display: flex;
+ align-items: baseline;
+ gap: 10px;
+}
+
+.ws-when {
+ font-family: var(--mono);
+ font-size: 12px;
+ color: var(--muted);
+}
+
+.ws-body {
+ flex: 1 1 auto;
+ overflow-y: auto;
+ padding: 26px 28px;
+ display: flex;
+ flex-direction: column;
+ gap: 16px;
+}
+
+.ws-note {
+ margin: 0;
+ color: var(--muted);
+ font-size: 13px;
+}
+
+.ws-empty {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 12px;
+ color: var(--muted);
+ font-size: 13px;
+}
+
+.analysis-error {
+ background: rgba(236, 77, 61, 0.12);
+ border: 1px solid rgba(236, 77, 61, 0.5);
+ color: #f2a29a;
+ border-radius: 8px;
+ padding: 9px 11px;
+ font-size: 12px;
+}
+
+.ws-read {
+ width: 100%;
+ max-width: 640px;
+ margin: 0 auto;
+ display: flex;
+ flex-direction: column;
+ gap: 24px;
+}
+
+.summary {
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+}
+
+.summary-text {
+ margin: 2px 0 0;
+ font-size: 21px;
+ font-weight: 650;
+ line-height: 1.32;
+ letter-spacing: -0.015em;
+ color: var(--text);
+}
+
+.summary-why {
+ margin: 0;
+ font-size: 13.5px;
+ color: var(--muted);
+ line-height: 1.55;
+}
+
+.summary-head {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 12px;
+}
+
+/* The one-sentence goal, shown under the short title. */
+.summary-goal {
+ margin: 0;
+ font-size: 14px;
+ color: var(--text);
+ line-height: 1.5;
+}
+
+.summary-edit {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ margin-top: 2px;
+}
+
+.edit-field {
+ display: flex;
+ flex-direction: column;
+ gap: 5px;
+}
+
+.edit-label {
+ font-family: var(--mono);
+ font-size: 10px;
+ text-transform: uppercase;
+ letter-spacing: 0.14em;
+ color: var(--faint);
+}
+
+.edit-title,
+.edit-intent {
+ width: 100%;
+ background: var(--deck);
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ color: var(--text);
+ font-family: inherit;
+ padding: 10px 12px;
+ user-select: text;
+}
+
+.edit-title {
+ font-size: 18px;
+ font-weight: 620;
+ letter-spacing: -0.012em;
+}
+
+.edit-intent {
+ font-size: 14px;
+ line-height: 1.5;
+ min-height: 58px;
+ resize: vertical;
+}
+
+.edit-title:focus,
+.edit-intent:focus {
+ outline: none;
+ border-color: var(--signal);
+}
+
+.edit-actions {
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
+ gap: 14px;
+}
+
+.summary .tag.ok {
+ align-self: flex-start;
+}
+
+.story {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+
+.story-step {
+ display: grid;
+ grid-template-columns: 30px 1fr;
+ gap: 16px;
+ padding: 20px 0;
+ border-top: 1px solid var(--line);
+}
+
+.story-step:first-child {
+ border-top: none;
+ padding-top: 2px;
+}
+
+.sstep-num {
+ font-family: var(--mono);
+ font-size: 15px;
+ font-weight: 700;
+ color: var(--signal);
+ line-height: 1.5;
+}
+
+.sstep-body {
+ min-width: 0;
+ display: flex;
+ flex-direction: column;
+}
+
+.sstep-title {
+ font-size: 15px;
+ font-weight: 600;
+ letter-spacing: -0.01em;
+ line-height: 1.4;
+ color: var(--text);
+}
+
+.sstep-detail {
+ margin: 5px 0 0;
+ font-size: 13.5px;
+ line-height: 1.6;
+ color: var(--muted);
+}
+
+.sstep-flag {
+ margin-top: 10px;
+ align-self: flex-start;
+ font-size: 11.5px;
+ color: var(--signal);
+ background: var(--signal-dim);
+ border-radius: 7px;
+ padding: 4px 9px;
+}
+
+.sstep-tools {
+ display: flex;
+ gap: 18px;
+ margin-top: 10px;
+}
+
+.linky {
+ background: none;
+ border: none;
+ padding: 0;
+ font-size: 12px;
+ color: var(--faint);
+ cursor: pointer;
+ font-family: inherit;
+}
+
+.linky:hover {
+ color: var(--signal);
+}
+
+.sstep-details {
+ margin-top: 12px;
+ padding: 10px 12px;
+ background: var(--surface);
+ border: 1px solid var(--line);
+ border-radius: 9px;
+ display: flex;
+ flex-direction: column;
+ gap: 7px;
+}
+
+.drow {
+ display: flex;
+ gap: 10px;
+ font-size: 12.5px;
+ color: var(--text);
+ align-items: baseline;
+}
+
+.dkey {
+ flex: none;
+ width: 52px;
+ font-family: var(--mono);
+ font-size: 10px;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--faint);
+}
+
+.dsignals {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 5px;
+}
+
+.sig {
+ font-family: var(--mono);
+ font-size: 10.5px;
+ color: var(--muted);
+ background: var(--surface-2);
+ border-radius: 6px;
+ padding: 2px 7px;
+}
+
+.sstep-fb {
+ margin-top: 12px;
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+}
+
+.fb-chips {
+ display: flex;
+ gap: 6px;
+}
+
+.fb-chip {
+ font-size: 11px;
+ padding: 4px 10px;
+ border-radius: 7px;
+ border: 1px solid var(--line);
+ background: transparent;
+ color: var(--muted);
+ cursor: pointer;
+}
+
+.fb-chip:hover {
+ border-color: var(--signal);
+ color: var(--text);
+}
+
+.fb-input,
+.overall-fb {
+ width: 100%;
+ background: var(--deck);
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ color: var(--text);
+ font-size: 13px;
+ padding: 9px 11px;
+ font-family: inherit;
+ user-select: text;
+}
+
+.overall-fb {
+ min-height: 66px;
+ resize: vertical;
+}
+
+.fb-input:focus,
+.overall-fb:focus {
+ outline: none;
+ border-color: var(--signal);
+}
+
+.overall-zone {
+ padding-top: 2px;
+}
+
+.ws-foot {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+ padding: 14px 22px;
+ border-top: 1px solid var(--line);
+}
+
+.ws-foot-actions {
+ display: flex;
+ gap: 10px;
+}
+
+.foot-status {
+ font-size: 12px;
+ color: var(--go);
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .record.on,
+ .rec-chip.rec .lamp {
+ animation: none;
+ }
+}
diff --git a/src/Library.tsx b/src/Library.tsx
new file mode 100644
index 0000000..f70ef2a
--- /dev/null
+++ b/src/Library.tsx
@@ -0,0 +1,480 @@
+import { useCallback, useEffect, useState } from "react";
+
+import type { Analysis } from "../common/analysis";
+import type { AnalyzeProgress, SessionSummary } from "../common/ipc";
+import { formatDur, formatMs, formatWhen } from "./format";
+
+export function Library() {
+ const [sessions, setSessions] = useState<SessionSummary[]>([]);
+ const [selectedId, setSelectedId] = useState<string | null>(null);
+ const [loaded, setLoaded] = useState(false);
+
+ const loadSessions = useCallback(async () => {
+ const list = await window.skillRecorder.listSessions();
+ setSessions(list);
+ setLoaded(true);
+ setSelectedId((prev) => prev ?? list[0]?.id ?? null);
+ }, []);
+
+ useEffect(() => {
+ void loadSessions();
+ return window.skillRecorder.onStatusChanged((s) => {
+ if (s.state !== "recording") void loadSessions();
+ });
+ }, [loadSessions]);
+
+ const selected = sessions.find((s) => s.id === selectedId) ?? null;
+
+ return (
+ <div className="lib">
+ <aside className="lib-list">
+ <div className="lib-list-head">
+ <span className="eyebrow">Sessions</span>
+ <span className="pill">{sessions.length}</span>
+ </div>
+ <div className="lib-list-scroll">
+ <SessionsList
+ sessions={sessions}
+ loaded={loaded}
+ selectedId={selectedId}
+ onSelect={setSelectedId}
+ />
+ </div>
+ </aside>
+ <main className="lib-detail">
+ {selected ? (
+ <AnalysisWorkspace key={selected.id} summary={selected} onChanged={loadSessions} />
+ ) : (
+ <div className="detail-empty">
+ <span className="eyebrow">No session selected</span>
+ <p>Pick a recording on the left to review its reconstructed intent and steps.</p>
+ </div>
+ )}
+ </main>
+ </div>
+ );
+}
+
+/* --- Sessions list -------------------------------------------------------- */
+
+function SessionsList({
+ sessions,
+ loaded,
+ selectedId,
+ onSelect,
+}: {
+ sessions: SessionSummary[];
+ loaded: boolean;
+ selectedId: string | null;
+ onSelect: (id: string) => void;
+}) {
+ if (sessions.length === 0) {
+ return <p className="sessions-empty">{loaded ? "No recordings yet." : "Loading…"}</p>;
+ }
+ return (
+ <ul className="sess-list">
+ {sessions.map((s) => (
+ <li key={s.id}>
+ <button
+ className={`sess ${s.id === selectedId ? "on" : ""}`}
+ onClick={() => onSelect(s.id)}
+ >
+ <div className="sess-top">
+ <span className="sess-when">{formatWhen(s.startedAt)}</span>
+ {s.analysis?.approved ? (
+ <span className="tag ok">approved</span>
+ ) : s.analysis ? (
+ <span className="tag an">analyzed</span>
+ ) : !s.processed ? (
+ <span className="tag warn">processing</span>
+ ) : null}
+ </div>
+ <div className="sess-intent">
+ {s.analysis?.title?.trim() || s.analysis?.intent || "Not analyzed yet"}
+ </div>
+ <div className="sess-sub">
+ {s.durationMs != null && <span>{formatDur(s.durationMs)}</span>}
+ {s.analysis && <span>{s.analysis.stepCount} steps</span>}
+ {s.hasVideo && <span>video</span>}
+ </div>
+ </button>
+ </li>
+ ))}
+ </ul>
+ );
+}
+
+/* --- Analysis workspace --------------------------------------------------- */
+
+const STEP_CHIPS = ["Not accurate", "Not needed"] as const;
+const CHIP_NOTE: Record<(typeof STEP_CHIPS)[number], string> = {
+ "Not accurate": "This isn't accurate.",
+ "Not needed": "This step isn't needed.",
+};
+
+function AnalysisWorkspace({
+ summary,
+ onChanged,
+}: {
+ summary: SessionSummary;
+ onChanged: () => void | Promise<void>;
+}) {
+ const sessionId = summary.id;
+
+ const [analysis, setAnalysis] = useState<Analysis | null>(null);
+ const [analyzing, setAnalyzing] = useState(false);
+ const [statusLine, setStatusLine] = useState("");
+ const [error, setError] = useState<string | null>(null);
+ const [overall, setOverall] = useState("");
+ const [overallOpen, setOverallOpen] = useState(false);
+ const [notes, setNotes] = useState<Record<string, string>>({});
+ const [editing, setEditing] = useState(false);
+ const [draftTitle, setDraftTitle] = useState("");
+ const [draftIntent, setDraftIntent] = useState("");
+
+ useEffect(() => {
+ let live = true;
+ void window.skillRecorder.getAnalysis(sessionId).then((a) => {
+ if (live) setAnalysis(a);
+ });
+ return () => {
+ live = false;
+ };
+ }, [sessionId]);
+
+ // Single latest status line (no growing log).
+ useEffect(() => {
+ return window.skillRecorder.onAnalyzeProgress((p: AnalyzeProgress) => {
+ if (p.sessionId !== sessionId) return;
+ setStatusLine(p.message);
+ if (p.phase === "done" || p.phase === "error") setAnalyzing(false);
+ });
+ }, [sessionId]);
+
+ const run = useCallback(async () => {
+ setAnalyzing(true);
+ setError(null);
+ setStatusLine("Starting…");
+ const res = await window.skillRecorder.analyze(sessionId);
+ if (res.ok && res.analysis) setAnalysis(res.analysis);
+ else setError(res.error ?? "Analysis failed");
+ setAnalyzing(false);
+ void onChanged();
+ }, [sessionId, onChanged]);
+
+ const hasFeedback =
+ overall.trim().length > 0 || Object.values(notes).some((n) => n.trim().length > 0);
+
+ const sendFeedback = useCallback(async () => {
+ const steps = Object.entries(notes)
+ .filter(([, note]) => note.trim())
+ .map(([stepId, note]) => ({ stepId, note: note.trim() }));
+ if (!overall.trim() && steps.length === 0) return;
+ setAnalyzing(true);
+ setError(null);
+ setStatusLine("Re-analyzing with your feedback…");
+ const res = await window.skillRecorder.analyzeFeedback({
+ sessionId,
+ overall: overall.trim() || undefined,
+ steps,
+ });
+ if (res.ok && res.analysis) {
+ setAnalysis(res.analysis);
+ setOverall("");
+ setOverallOpen(false);
+ setNotes({});
+ } else {
+ setError(res.error ?? "Re-analysis failed");
+ }
+ setAnalyzing(false);
+ void onChanged();
+ }, [notes, overall, sessionId, onChanged]);
+
+ const approve = useCallback(async () => {
+ const res = await window.skillRecorder.approveAnalysis(sessionId);
+ if (res.ok && res.analysis) setAnalysis(res.analysis);
+ else setError(res.error ?? "Could not save");
+ void onChanged();
+ }, [sessionId, onChanged]);
+
+ const startEdit = useCallback(() => {
+ if (!analysis) return;
+ setDraftTitle(analysis.title ?? "");
+ setDraftIntent(analysis.intent);
+ setError(null);
+ setEditing(true);
+ }, [analysis]);
+
+ const saveEdit = useCallback(async () => {
+ const res = await window.skillRecorder.updateAnalysis({
+ sessionId,
+ title: draftTitle.trim(),
+ intent: draftIntent.trim() || undefined,
+ });
+ if (res.ok && res.analysis) {
+ setAnalysis(res.analysis);
+ setEditing(false);
+ } else {
+ setError(res.error ?? "Could not save your changes");
+ }
+ void onChanged();
+ }, [sessionId, draftTitle, draftIntent, onChanged]);
+
+ const setNote = useCallback((stepId: string, note: string) => {
+ setNotes((prev) => ({ ...prev, [stepId]: note }));
+ }, []);
+
+ const approved = analysis?.approved ?? false;
+
+ return (
+ <section className="ws">
+ <div className="ws-head">
+ <div className="ws-titles">
+ <span className="eyebrow">Analysis</span>
+ <span className="ws-when">{formatWhen(summary.startedAt)}</span>
+ </div>
+ {analysis && !analyzing && (
+ <button className="ghost" onClick={run} title="Analyze this recording again from scratch">
+ Start over
+ </button>
+ )}
+ </div>
+
+ <div className="ws-body">
+ {!summary.processed && (
+ <p className="ws-note">Still processing this recording… try again in a moment.</p>
+ )}
+
+ {summary.processed && !analysis && !analyzing && (
+ <div className="ws-empty">
+ <p>See what you did in this recording, step by step.</p>
+ <button className="record-cta" onClick={run}>
+ Analyze recording
+ </button>
+ </div>
+ )}
+
+ {analyzing && (
+ <div className="status-line">
+ <span className="spinner" />
+ {statusLine || "Working…"}
+ </div>
+ )}
+
+ {error && <div className="analysis-error">{error}</div>}
+
+ {analysis && !analyzing && (
+ <div className="ws-read">
+ <div className="summary">
+ <div className="summary-head">
+ <span className="eyebrow">What you did</span>
+ {!editing && (
+ <button className="linky" onClick={startEdit}>
+ Edit
+ </button>
+ )}
+ </div>
+
+ {editing ? (
+ <div className="summary-edit">
+ <label className="edit-field">
+ <span className="edit-label">Name</span>
+ <input
+ className="edit-title"
+ value={draftTitle}
+ placeholder="Short name, e.g. Research habit articles"
+ autoFocus
+ onChange={(e) => setDraftTitle(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") {
+ e.preventDefault();
+ void saveEdit();
+ } else if (e.key === "Escape") setEditing(false);
+ }}
+ />
+ </label>
+ <label className="edit-field">
+ <span className="edit-label">Goal</span>
+ <textarea
+ className="edit-intent"
+ value={draftIntent}
+ placeholder="One sentence: what were you trying to do?"
+ onChange={(e) => setDraftIntent(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Escape") setEditing(false);
+ }}
+ />
+ </label>
+ <div className="edit-actions">
+ <button className="linky" onClick={() => setEditing(false)}>
+ Cancel
+ </button>
+ <button className="secondary" onClick={() => void saveEdit()}>
+ Save
+ </button>
+ </div>
+ </div>
+ ) : (
+ <>
+ <h2 className="summary-text">{analysis.title?.trim() || analysis.intent}</h2>
+ {analysis.title?.trim() && (
+ <p className="summary-goal">{analysis.intent}</p>
+ )}
+ {analysis.intentRationale && (
+ <p className="summary-why">{analysis.intentRationale}</p>
+ )}
+ {approved && <span className="tag ok">approved</span>}
+ </>
+ )}
+ </div>
+
+ <ol className="story">
+ {analysis.steps.map((s, i) => (
+ <StepCard
+ key={s.id}
+ index={i}
+ step={s}
+ note={notes[s.id] ?? ""}
+ onNote={(v) => setNote(s.id, v)}
+ />
+ ))}
+ </ol>
+
+ <div className="overall-zone">
+ {overallOpen || overall.trim() ? (
+ <textarea
+ className="overall-fb"
+ placeholder="Tell us what's off, or describe a step we missed…"
+ value={overall}
+ onChange={(e) => setOverall(e.target.value)}
+ />
+ ) : (
+ <button className="linky" onClick={() => setOverallOpen(true)}>
+ Something off, or did we miss a step?
+ </button>
+ )}
+ </div>
+ </div>
+ )}
+ </div>
+
+ {analysis && !analyzing && (
+ <div className="ws-foot">
+ <span className="foot-status">{approved ? "Saved" : ""}</span>
+ <div className="ws-foot-actions">
+ {hasFeedback && (
+ <button className="secondary" onClick={sendFeedback}>
+ Send feedback &amp; re-analyze
+ </button>
+ )}
+ {approved ? (
+ <button className="record-cta" disabled title="Skill generation is the next milestone">
+ Create skill →
+ </button>
+ ) : (
+ <button
+ className="record-cta"
+ onClick={approve}
+ disabled={hasFeedback}
+ title={hasFeedback ? "Send or clear your feedback first" : "Save as correct"}
+ >
+ Looks good — save
+ </button>
+ )}
+ </div>
+ </div>
+ )}
+ </section>
+ );
+}
+
+/* --- One step, told as plain language ------------------------------------- */
+
+function StepCard({
+ index,
+ step,
+ note,
+ onNote,
+}: {
+ index: number;
+ step: Analysis["steps"][number];
+ note: string;
+ onNote: (value: string) => void;
+}) {
+ const [showDetails, setShowDetails] = useState(false);
+ const [commenting, setCommenting] = useState(false);
+ const open = commenting || note.trim().length > 0;
+ const hasMeta = step.apps.length > 0 || step.startMs != null || step.evidence.length > 0;
+
+ return (
+ <li className="story-step">
+ <div className="sstep-num">{index + 1}</div>
+ <div className="sstep-body">
+ <div className="sstep-title">{step.title}</div>
+ <p className="sstep-detail">{step.detail}</p>
+
+ {step.confidence === "low" && (
+ <div className="sstep-flag">We&apos;re not fully sure about this one — worth a check.</div>
+ )}
+
+ <div className="sstep-tools">
+ {hasMeta && (
+ <button className="linky" onClick={() => setShowDetails((v) => !v)}>
+ {showDetails ? "Hide details" : "Details"}
+ </button>
+ )}
+ <button className="linky" onClick={() => setCommenting((v) => !v)}>
+ {open ? "Done" : "Suggest a change"}
+ </button>
+ </div>
+
+ {showDetails && hasMeta && (
+ <div className="sstep-details">
+ {step.apps.length > 0 && (
+ <div className="drow">
+ <span className="dkey">App</span>
+ <span>{step.apps.join(", ")}</span>
+ </div>
+ )}
+ {step.startMs != null && (
+ <div className="drow">
+ <span className="dkey">At</span>
+ <span>{formatMs(step.startMs)}</span>
+ </div>
+ )}
+ {step.evidence.length > 0 && (
+ <div className="drow">
+ <span className="dkey">Signals</span>
+ <span className="dsignals">
+ {step.evidence.map((e, i) => (
+ <span className="sig" key={i}>
+ {e}
+ </span>
+ ))}
+ </span>
+ </div>
+ )}
+ </div>
+ )}
+
+ {open && (
+ <div className="sstep-fb">
+ <div className="fb-chips">
+ {STEP_CHIPS.map((c) => (
+ <button key={c} className="fb-chip" onClick={() => onNote(CHIP_NOTE[c])}>
+ {c}
+ </button>
+ ))}
+ </div>
+ <input
+ className="fb-input"
+ placeholder="What should this say instead?"
+ value={note}
+ onChange={(e) => onNote(e.target.value)}
+ />
+ </div>
+ )}
+ </div>
+ </li>
+ );
+}
diff --git a/src/App.tsx b/src/Recorder.tsx
similarity index 54%
rename from src/App.tsx
rename to src/Recorder.tsx
index c441fe1..210baac 100644
--- a/src/App.tsx
+++ b/src/Recorder.tsx
@@ -2,22 +2,40 @@ import { useCallback, useEffect, useState } from "react";
import { CAPTURE_LEVEL_INFO, type CaptureLevel } from "../common/config";
import type { CaptureState, DoctorReport, RecorderStatus } from "../common/ipc";
+import { formatMs } from "./format";
-export function App() {
+const IS_MAC = typeof navigator !== "undefined" && /Mac/i.test(navigator.userAgent);
+/** Mirrors the main-process global shortcut "CommandOrControl+Shift+R", per OS. */
+const TOGGLE_SHORTCUT = IS_MAC ? "⌘⇧R" : "Ctrl+Shift+R";
+
+export function Recorder() {
const [status, setStatus] = useState<RecorderStatus | null>(null);
const [doctor, setDoctor] = useState<DoctorReport | null>(null);
const [capture, setCapture] = useState<CaptureState | null>(null);
const [elapsed, setElapsed] = useState(0);
+ const [sessionCount, setSessionCount] = useState(0);
+
+ const refreshCount = useCallback(async () => {
+ const list = await window.skillRecorder.listSessions();
+ setSessionCount(list.length);
+ }, []);
useEffect(() => {
void window.skillRecorder.status().then(setStatus);
void window.skillRecorder.doctor().then(setDoctor);
void window.skillRecorder.getCapture().then(setCapture);
+ void refreshCount();
return window.skillRecorder.onStatusChanged(setStatus);
- }, []);
+ }, [refreshCount]);
const recording = status?.state === "recording";
const startedAt = status?.startedAt ?? null;
+ const justSaved = !recording && status?.lastSession != null;
+
+ // Refresh the library count whenever a recording finishes.
+ useEffect(() => {
+ if (!recording) void refreshCount();
+ }, [recording, refreshCount]);
useEffect(() => {
if (!recording || startedAt == null) {
@@ -42,50 +60,76 @@ export function App() {
const chooseLevel = useCallback(async (level: Exclude<CaptureLevel, "custom">) => {
const next = await window.skillRecorder.setLevel(level);
setCapture(next);
- // Active-source list depends on the level, so refresh the doctor report too.
setDoctor(await window.skillRecorder.doctor());
}, []);
+ const openLibrary = useCallback(() => {
+ void window.skillRecorder.openLibrary();
+ }, []);
+
return (
- <div className="app">
- <header>
- <h1>Skill Recorder</h1>
- <div className={`status ${recording ? "rec" : "idle"}`}>
- <span className="dot" />
- {recording ? "Recording" : "Idle"}
- {recording && <span className="timer">{formatMs(elapsed)}</span>}
+ <div className="hud">
+ <header className="hud-head">
+ <div className="wordmark">
+ <span className="mark-lamp" />
+ <span className="mark-text">Skill Recorder</span>
</div>
+ <span className={`rec-chip ${recording ? "rec" : "idle"}`}>
+ <span className="lamp" />
+ {recording ? "REC" : "READY"}
+ </span>
</header>
- <button className={`primary ${recording ? "stop" : "start"}`} onClick={toggle}>
- {recording ? "Stop" : "Start"}
- </button>
- <button className="secondary" onClick={addMarker} disabled={!recording}>
+ <div className="transport">
+ <button
+ className={`record ${recording ? "on" : ""}`}
+ onClick={toggle}
+ aria-label={recording ? "Stop recording" : "Start recording"}
+ >
+ <span className="record-glyph" />
+ </button>
+ <div className={`timecode ${recording ? "live" : ""}`}>
+ {recording ? formatMs(elapsed) : "00:00"}
+ </div>
+ <div className="transport-sub">
+ {recording
+ ? `${status?.eventCount ?? 0} events captured`
+ : justSaved
+ ? "Capture saved — open Sessions to review"
+ : "Ready to capture"}
+ </div>
+ </div>
+
+ <button className="marker" onClick={addMarker} disabled={!recording}>
Add marker
</button>
- <p className="meta">
- {status?.sessionId
- ? `${status.sessionId} · ${status.eventCount} events`
- : "No active session"}
- </p>
-
{capture && (
- <CapturePicker
- level={capture.level}
- disabled={recording}
- onChoose={chooseLevel}
- />
+ <CapturePicker level={capture.level} disabled={recording} onChoose={chooseLevel} />
)}
+ <button className="sessions-open" onClick={openLibrary}>
+ <span className="sessions-open-label">Sessions</span>
+ <span className="sessions-open-right">
+ <span className="pill">{sessionCount}</span>
+ <span className="ext" aria-hidden>
+ ↗
+ </span>
+ </span>
+ </button>
+
{doctor && (
<div className="doctor">
- <Row label="ffmpeg" ok={doctor.ffmpeg.ok} note={doctor.ffmpeg.ok ? doctor.ffmpeg.source : "missing"} />
+ <Row
+ label="ffmpeg"
+ ok={doctor.ffmpeg.ok}
+ note={doctor.ffmpeg.ok ? doctor.ffmpeg.source : "missing"}
+ />
<Row label="copilot CLI" ok={doctor.copilotCli.ok} note={doctor.copilotCli.ok ? "found" : "missing"} />
</div>
)}
- <p className="hint">Global toggle: ⌘/Ctrl + Shift + R</p>
+ <p className="hint">{TOGGLE_SHORTCUT} toggles from anywhere</p>
</div>
);
}
@@ -103,7 +147,7 @@ function CapturePicker({
return (
<div className="capture">
<div className="capture-head">
- <span className="capture-title">Capture level</span>
+ <span className="eyebrow">Capture</span>
{level === "custom" && <span className="capture-custom">custom</span>}
</div>
<div className="segmented" role="group" aria-label="Capture level">
@@ -119,10 +163,7 @@ function CapturePicker({
</button>
))}
</div>
- <p className="capture-blurb">
- {active?.blurb ?? "A custom mix of sources is active."}
- </p>
- {disabled && <p className="capture-note">Stop recording to change the level.</p>}
+ <p className="capture-blurb">{active?.blurb ?? "A custom mix of sources is active."}</p>
</div>
);
}
@@ -136,10 +177,3 @@ function Row({ label, ok, note }: { label: string; ok: boolean; note: string })
</div>
);
}
-
-function formatMs(ms: number): string {
- const totalSeconds = Math.floor(ms / 1000);
- const minutes = Math.floor(totalSeconds / 60);
- const seconds = totalSeconds % 60;
- return `${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`;
-}
diff --git a/src/format.ts b/src/format.ts
new file mode 100644
index 0000000..ac080d4
--- /dev/null
+++ b/src/format.ts
@@ -0,0 +1,25 @@
+/** Timecode counter — mm:ss, for the live recorder readout. */
+export function formatMs(ms: number): string {
+ const totalSeconds = Math.floor(ms / 1000);
+ const minutes = Math.floor(totalSeconds / 60);
+ const seconds = totalSeconds % 60;
+ return `${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`;
+}
+
+/** Compact duration, e.g. "9s" or "1m 12s". */
+export function formatDur(ms: number): string {
+ const s = Math.round(ms / 1000);
+ if (s < 60) return `${s}s`;
+ return `${Math.floor(s / 60)}m ${s % 60}s`;
+}
+
+/** Human timestamp for a saved session, e.g. "Jul 25, 1:05 AM". */
+export function formatWhen(ms: number | null): string {
+ if (ms == null) return "—";
+ return new Date(ms).toLocaleString(undefined, {
+ month: "short",
+ day: "numeric",
+ hour: "numeric",
+ minute: "2-digit",
+ });
+}
diff --git a/src/main.tsx b/src/main.tsx
index c6ec0f8..a2a52fc 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -1,14 +1,16 @@
import React from "react";
import { createRoot } from "react-dom/client";
-import { App } from "./App";
+import { Library } from "./Library";
+import { Recorder } from "./Recorder";
import "./App.css";
const root = document.getElementById("root");
if (!root) throw new Error("Missing #root");
+const isLibrary = window.location.hash.replace("#", "") === "library";
+document.body.dataset.route = isLibrary ? "library" : "recorder";
+
createRoot(root).render(
- <React.StrictMode>
- <App />
- </React.StrictMode>,
+ <React.StrictMode>{isLibrary ? <Library /> : <Recorder />}</React.StrictMode>,
);