an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions
HTML agent-harnessagent-orchestrationagentsai-agentsautonomous-agentsclaude-codecodexcoding-agentsdesktop-appdeveloper-toolselectrongemini-cliharnessharness-engineeringlocal-firstmemorymulti-agentopencodeorchestrationtypescript
feat: start the hive on first run, and add Skills, Prerequisites and release drops
Chaitanya Giri1b821b3246bd
diff --git a/docs/hero.json b/docs/hero.jsonnew file mode 100644index 00000000..e1da0cb9--- /dev/null+++ b/docs/hero.json@@ -0,0 +1,9 @@+{+ "_comment": "Settings → General hero card. Edited here and fetched by the app at runtime, so plan copy and sponsors change WITHOUT shipping a build. Data only — every field renders as escaped text, never as markup. Unknown fields are ignored; anything malformed falls back to the app's built-in defaults. URLs must be https.",+ "plan": {+ "label": "Local",+ "blurb": "Every agent runs on your machine, in your folders, under your own keys. No seat limit, nothing metered."+ },+ "sponsor": null,+ "notice": null+}diff --git a/docs/release-drops.md b/docs/release-drops.mdnew file mode 100644index 00000000..0c2965c1--- /dev/null+++ b/docs/release-drops.md@@ -0,0 +1,93 @@+# Release drops++A **drop** is an authored release page — shown centered, at full size, the first+time a user's app sees the release. It replaces the corner toast's three-bullet+digest with whatever you design.++Releases without a drop are unaffected: they still get the digest toast. This is+additive, so no past release changes behaviour.++## Authoring++Put HTML between two markers anywhere in the GitHub release body:++```markdown+## What's new in 0.5.0++Regular markdown, for people reading this on github.com.++<!-- drop -->+<section class="hero">+ <h1>Windows agents can finally talk to each other.</h1>+ <p>Half our downloads. Silently broken. Not any more.</p>+ <video src="https://…/demo.mp4" autoplay muted loop playsinline></video>+</section>+<style>+ .hero { padding: 48px 40px; background: linear-gradient(160deg,#1b1524,#2e2140); color:#f4efe6; }+ .hero h1 { font-size: 2.4rem; letter-spacing:-.02em; }+</style>+<!-- /drop -->+```++Everything between the markers becomes the page. The markdown around it is left+alone, so the github.com release page still reads well.++Both markers must be present and in order. An unbalanced pair is ignored and the+release falls back to the digest — a half-parsed drop would render as broken+markup for every user, so it is treated as no drop at all.++## What you can use++Images, video, audio, web fonts, gradients, transforms, grid, flexbox, keyframe+animations, `prefers-color-scheme`, `prefers-reduced-motion`. Remote assets must+be **https** (or `data:`/`blob:`).++A small token palette is pre-defined — `--ink`, `--ink-soft`, `--paper`,+`--cream`, `--lemon`, `--mint`, `--coral` — so a drop can match the app without+restating its colours. Ignore them entirely for a bespoke look.++## What you cannot use, and why++**No JavaScript. No forms. No working links.**++The drop is remote, author-controlled markup. The renderer it would otherwise+land in has `window.cth` bridged onto it — `spawnPty`, `writeFileText`,+`updateConfig`. Script execution there is not a styling bug, it is arbitrary code+execution on the user's machine with the app's full authority, available to+anyone who can publish a release or intercept the fetch.++So the drop renders inside an iframe with `sandbox=""` (no scripts, no+same-origin, no forms, no popups, no top-level navigation) and its own+`default-src 'none'` CSP. Two independent controls, either sufficient alone.++Because nothing in the frame can navigate, **the modal's own buttons carry every+action** — "open releases", "restart to update", the star link, "later". Design+around them; don't put a call-to-action link in the drop expecting a click to+work.++If a drop ever genuinely needs scripting, the change is `allow-scripts` on the+iframe — and it must **never** be paired with `allow-same-origin`, because that+combination lets the frame remove its own sandbox.++## Previewing before you publish++The update path only runs in packaged builds, so dev has a simulate hook:++```js+await window.cth.updateSimulate({ version: '0.5.0', notes: '<paste the body>' })+```++Run it in DevTools (⌥⌘I → Console). Dev-only — hard-gated on `!app.isPackaged`.++To see the star ask again after it has been spent:++```js+localStorage.removeItem('cth.updateStarAsked')+```++## One thing to know about pre-release tags++`/releases/latest` excludes pre-releases and electron-updater's `latest` channel+skips them, so a `-rc` tag never triggers the toast or the drop for stable users.+Only a plain higher `X.Y.Z` does. Test drops with `updateSimulate`, not by+publishing an rc.diff --git a/package.json b/package.jsonindex 4fc91514..97bb375a 100644--- a/package.json+++ b/package.json@@ -19,7 +19,7 @@"typecheck:node": "tsc --noEmit -p tsconfig.node.json","typecheck:web": "tsc --noEmit -p tsconfig.web.json","typecheck": "npm run typecheck:node && npm run typecheck:web",- "test:focused": "node --test test/codex-remote.test.cjs test/control.test.cjs test/provider-automation.test.cjs test/provider-config.test.cjs test/queue-delivery.test.cjs test/terminal-automation.test.cjs test/terminal-recovery.test.cjs test/terminal-selection.test.cjs test/roster.test.cjs test/proc-kill.test.cjs test/expand-tilde.test.cjs test/hive-cwd.test.cjs test/hive-task-mutation.test.cjs test/hive-hook-node.test.cjs test/hive-roster-injection.test.cjs test/hive-runtime-path.test.cjs test/cli-install-ladder.test.cjs test/node-install.test.cjs test/office-gl-recovery.test.cjs test/update-state.test.cjs test/release-notes.test.cjs test/transcript-project-dir.test.cjs test/commit-graph.test.cjs test/ide-image.test.cjs test/win-cmd-shim.test.cjs test/hive-windows-prompt.test.cjs",+ "test:focused": "node --test test/codex-remote.test.cjs test/control.test.cjs test/provider-automation.test.cjs test/provider-config.test.cjs test/queue-delivery.test.cjs test/terminal-automation.test.cjs test/terminal-recovery.test.cjs test/terminal-selection.test.cjs test/roster.test.cjs test/proc-kill.test.cjs test/expand-tilde.test.cjs test/hive-cwd.test.cjs test/hive-task-mutation.test.cjs test/hive-hook-node.test.cjs test/hive-roster-injection.test.cjs test/hive-runtime-path.test.cjs test/cli-install-ladder.test.cjs test/node-install.test.cjs test/office-gl-recovery.test.cjs test/update-state.test.cjs test/release-notes.test.cjs test/transcript-project-dir.test.cjs test/commit-graph.test.cjs test/ide-image.test.cjs test/win-cmd-shim.test.cjs test/hive-windows-prompt.test.cjs test/release-drop.test.cjs test/skills.test.cjs test/skills-install.test.cjs test/hero-payload.test.cjs","check:links": "node tools/check-release-links.cjs","dist": "npm run build && electron-builder","dist:mac": "npm run build && electron-builder --mac",diff --git a/src/main/fetchText.ts b/src/main/fetchText.tsnew file mode 100644index 00000000..71366755--- /dev/null+++ b/src/main/fetchText.ts@@ -0,0 +1,35 @@+/**+ * One place that fetches text over https.+ *+ * Extracted from skills.ts when the hero payload needed the same thing: two+ * copies of redirect-following, timeout and status handling would drift, and the+ * one that drifted would be the one nobody was looking at.+ *+ * https only, by construction — every caller fetches from raw.githubusercontent+ * or a repo URL, and an http: fallback would silently downgrade content the app+ * then renders.+ */+import { request as httpsRequest } from 'node:https';++export function getText(url: string, opts: { timeoutMs?: number } = {}): Promise<string> {+ const timeoutMs = opts.timeoutMs ?? 12000;+ return new Promise((resolve, reject) => {+ const req = httpsRequest(url, { method: 'GET', headers: { 'user-agent': 'munder-difflin' } }, (res) => {+ // Follow a redirect once per hop; raw.githubusercontent does this for+ // branch aliases and the request just fails without it.+ if (res.statusCode && res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {+ res.resume();+ getText(res.headers.location, opts).then(resolve, reject);+ return;+ }+ if (res.statusCode !== 200) { res.resume(); reject(new Error(`HTTP ${res.statusCode}`)); return; }+ let body = '';+ res.setEncoding('utf8');+ res.on('data', (c) => { body += c; });+ res.on('end', () => resolve(body));+ });+ req.on('error', reject);+ req.setTimeout(timeoutMs, () => req.destroy(new Error('timed out')));+ req.end();+ });+}diff --git a/src/main/hero.ts b/src/main/hero.tsnew file mode 100644index 00000000..ae2d819a--- /dev/null+++ b/src/main/hero.ts@@ -0,0 +1,48 @@+/**+ * Fetch + cache the Settings hero payload.+ *+ * Same shape as the skills catalog: served from cache when fresh, refreshed in+ * the background otherwise, and NEVER fatal — a failed fetch falls back to the+ * cached copy, then to the defaults compiled into the app. The card must render+ * instantly and offline, because it sits at the top of a dialog people open to+ * change a folder.+ */+import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';+import { dirname } from 'node:path';+import { getText } from './fetchText';+import { parseHeroPayload, DEFAULT_HERO, type HeroPayload } from '../shared/heroPayload';++const HERO_URL =+ 'https://raw.githubusercontent.com/chaitanyagiri/munder-difflin/main/docs/hero.json';+/** Plan copy and sponsors change on a human timescale. */+const TTL_MS = 6 * 60 * 60 * 1000;++export async function loadHero(+ cachePath: string,+ opts: { force?: boolean } = {}+): Promise<{ hero: HeroPayload; fetchedAt: number; stale: boolean }> {+ let cached: { hero: HeroPayload; fetchedAt: number } | null = null;+ try {+ if (existsSync(cachePath)) cached = JSON.parse(readFileSync(cachePath, 'utf8'));+ } catch { cached = null; }++ if (cached && !opts.force && Date.now() - cached.fetchedAt < TTL_MS) {+ return { hero: cached.hero, fetchedAt: cached.fetchedAt, stale: false };+ }++ try {+ const body = await getText(HERO_URL, { timeoutMs: 8000 });+ // Parse the JSON and the SHAPE separately: valid JSON that is not a hero+ // payload must still degrade to defaults rather than render as undefined.+ const hero = parseHeroPayload(JSON.parse(body));+ const payload = { hero, fetchedAt: Date.now() };+ try {+ mkdirSync(dirname(cachePath), { recursive: true });+ writeFileSync(cachePath, JSON.stringify(payload));+ } catch { /* cache is an optimisation */ }+ return { ...payload, stale: false };+ } catch {+ if (cached) return { hero: cached.hero, fetchedAt: cached.fetchedAt, stale: true };+ return { hero: DEFAULT_HERO, fetchedAt: 0, stale: true };+ }+}diff --git a/src/main/index.ts b/src/main/index.tsindex 7cc20725..45d288e4 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -7,6 +7,7 @@ import {} from 'node:fs';import { randomBytes, createHash, timingSafeEqual } from 'node:crypto';import { join, resolve, sep, basename, dirname } from 'node:path';+import { homedir } from 'node:os';import { request as httpsRequest } from 'node:https';import { PtyManager, type SpawnOptions } from './pty';import { resolveCommand as resolveCliCommand } from './shellEnv';@@ -71,6 +72,9 @@ import {} from '../shared/agentProvider';import { buildMissingCliScript, chooseInstallRung } from './cliInstall';import { detectNodeVersion, nodeIsUsable, resolveNodeInstaller } from './nodeInstall';+import { toolCatalog, type ToolStatus } from '../shared/toolCatalog';+import { listLocalSkills, loadCatalog, installSkill, uninstallSkill, type LocalSkill } from './skills';+import { loadHero } from './hero';import {CODEX_REMOTE_SOCKET_RELATIVE,codexRemoteAliasPath,@@ -1058,6 +1062,14 @@ function runBreakerBeat(progressWindowMs: number): void {// (aggregateLive picks the most-recent live session id), so this gates on// "is there a live session" without changing any live-agent behavior.if (sample?.sessionId) hive.appendCostLedger(sample); // ledger covers everyone incl. god+ // Second source for the resume key. recordSession() is otherwise reachable+ // ONLY from the hook shim, so any window where hooks don't land leaves the+ // registry with no sessionId and "Restart & Continue" refuses to continue —+ // while this very sample proves the app knew the live session id all along+ // (it was already being written to the cost ledger one line above). Same id,+ // same liveness gate; recordSession writes only on change, so this is a+ // no-op once the hooks are flowing.+ if (sample?.sessionId) hive.recordSession(id, sample.sessionId);if (id === reg.godId) continue; // breaker skips god// Progress = fresh coordination files OR a recent OTel tool span. The span// leg closes the background-work blind spot: subagent/Workflow tool calls@@ -2902,9 +2914,30 @@ ipcMain.handle('integrations:test', async (_evt, payload: unknown) => {// ─── IPC: config ────────────────────────────────────────────────────────────ipcMain.handle('config:get', (): HarnessConfig => readConfig());ipcMain.handle('config:update', (_evt, patch: Partial<HarnessConfig>) => {+ // FIRST RUN: every hive-bound service is started by bootstrapHiveServices(),+ // which runs once at app-ready and early-returns on `!hive.enabled()` — i.e.+ // whenever harnessHome is still null, which is exactly the state a fresh+ // install boots in. Onboarding then sets harnessHome through THIS handler and+ // nothing re-bootstrapped, so the hook server, message router, telemetry+ // collector and mission scheduler all stayed dead for the rest of the session.+ //+ // Symptom: agents spawn and run (the PTY is not hive-bound), but no hook ever+ // reaches the app — no `hooks.sock` on disk, so no SessionStart, which means+ // recordSession() is never called and "Restart & Continue" fails with "No+ // recorded session ID"; the cards also sit on "ctx no status tick yet" and 0+ // tool calls. Everything healed on the next app launch, which is what hid it.+ //+ // changeHome() has always handled this by relaunching; onboarding does not+ // relaunch, so bootstrap here on the null → set transition. Gated on the+ // transition so ordinary config writes never re-enter it.+ const hiveWasEnabled = hive.enabled();const next = writeConfig(patch);// Live opt-in/out from Settings → Privacy (TELEMETRY.md).if (typeof patch?.telemetryEnabled === 'boolean') analytics.setEnabled(patch.telemetryEnabled);+ if (!hiveWasEnabled && hive.enabled()) {+ console.log('[hive] harnessHome configured — bootstrapping hive services');+ try { bootstrapHiveServices(); } catch (e) { console.error('[hive] bootstrap after onboarding:', e); }+ }return next;});ipcMain.handle('config:ensureHome', (_evt, path: unknown) => {@@ -3156,6 +3189,105 @@ ipcMain.handle('hive:setArchived', (_evt, id: unknown, archived: unknown) => {return { ok: true };});+// ─── IPC: Settings hero payload (remote data, cached) ───────────────────────+/** Plan copy and sponsor, fetched from the repo so they can change without a+ * release. Validated in shared/heroPayload before it reaches the renderer. */+ipcMain.handle('hero:payload', async (_evt, force: unknown) =>+ loadHero(join(app.getPath('userData'), 'hero.json'), { force: force === true }));++// ─── IPC: skills (installed locally, and the browsable catalog) ─────────────+/** Skills the CLIs on this machine can already use. Scans the registered repos+ * plus the agent's own cwd, so a project-scoped skill shows up where it applies. */+ipcMain.handle('skills:local', (_evt, cwd: unknown): LocalSkill[] => {+ const cfg = readConfig();+ const cwds = [+ ...(typeof cwd === 'string' && cwd ? [cwd] : []),+ ...(cfg.registeredRepos ?? [])+ ];+ try {+ return listLocalSkills({ cwds, bundledDir: skillsResourceDir() });+ } catch (e) {+ console.error('[skills] local scan failed:', e);+ return [];+ }+});+/** The skills catalog, parsed from its README and cached in userData.+ * `force` is the explicit refresh button; everything else is served from a+ * day-old cache so opening the tab never waits on the network. */+ipcMain.handle('skills:catalog', async (_evt, force: unknown) => {+ const cachePath = join(app.getPath('userData'), 'skill-catalog.json');+ return loadCatalog(cachePath, { force: force === true });+});++/** Install one catalog skill into ~/.claude/skills. Structured refusals, never a+ * throw: the UI distinguishes "not installable" from "install failed". */+ipcMain.handle('skills:install', async (_evt, url: unknown, name: unknown) => {+ if (typeof url !== 'string' || typeof name !== 'string') {+ return { ok: false as const, error: 'bad request' };+ }+ return installSkill(url, name);+});+/** Delete an installed skill. The guard rails live in uninstallSkill — it refuses+ * any path it cannot prove is a skill folder inside a skills root. */+ipcMain.handle('skills:uninstall', (_evt, path: unknown) => {+ if (typeof path !== 'string') return { ok: false as const, error: 'bad request' };+ const cfg = readConfig();+ return uninstallSkill(path, { cwds: cfg.registeredRepos ?? [] });+});+/** Reveal a skill on disk. `openExternal` is deliberately https-only, so a+ * file:// URL cannot (and should not) be smuggled through it. */+ipcMain.handle('skills:reveal', (_evt, path: unknown) => {+ if (typeof path !== 'string' || !path.trim()) return { ok: false, error: 'bad request' };+ const skillRoots = [join(homedir(), '.claude', 'skills'), join(homedir(), '.config', 'opencode')];+ const target = resolve(path);+ const inRoot = skillRoots.some((r) => target.startsWith(resolve(r) + sep))+ || (readConfig().registeredRepos ?? []).some((c) => target.startsWith(resolve(c) + sep));+ if (!inRoot) return { ok: false, error: 'outside a managed skills directory' };+ shell.showItemInFolder(target);+ return { ok: true };+});++// ─── IPC: setup catalog (which external tools are actually here) ────────────+/**+ * Probe every catalog row against THIS machine.+ *+ * Presence is a PATH resolution, not a spawn: running each candidate to read a+ * --version would be a dozen process launches on every panel open, and several of+ * these CLIs boot a TUI when invoked bare. `resolveCommand` returns its input+ * unchanged when it finds nothing, so "resolved to a real, existing path that is+ * not just the bare name" is the found test.+ *+ * mempalace is the one row that does NOT come from PATH: the memory subsystem+ * already resolves it (including uv/pip locations PATH may not carry for a+ * Finder-launched app) and knows whether the palace is initialised, so it is+ * authoritative and reused rather than re-probed differently here.+ */+ipcMain.handle('tools:status', (): ToolStatus[] => {+ const win = process.platform === 'win32';+ const mem = (() => { try { memory.resetBinCache(); return memory.status(); } catch { return null; } })();+ return toolCatalog().map((spec): ToolStatus => {+ const installCommand = win ? spec.install.win32 : spec.install.posix;+ if (spec.id === 'mempalace') {+ return {+ ...spec,+ installCommand,+ found: !!mem?.available,+ path: mem?.bin ?? null,+ detail: mem?.available+ ? (mem.initialized ? 'palace initialised' : 'installed — palace not built yet')+ : undefined+ };+ }+ if (!spec.bin) return { ...spec, installCommand, found: false, path: null };+ let path: string | null = null;+ try {+ const resolved = resolveCliCommand(spec.bin);+ if (resolved !== spec.bin && existsSync(resolved)) path = resolved;+ } catch { /* a probe must never take the panel down */ }+ return { ...spec, installCommand, found: !!path, path };+ });+});+// ─── IPC: semantic memory (MemPalace CLI) ───────────────────────────────────ipcMain.handle('hive:memoryStatus', () => { memory.resetBinCache(); return memory.status(); });ipcMain.handle('hive:searchMemory', (_evt, query: unknown, wing: unknown) => {diff --git a/src/main/skills.ts b/src/main/skills.tsnew file mode 100644index 00000000..98a9488c--- /dev/null+++ b/src/main/skills.ts@@ -0,0 +1,467 @@+/**+ * SKILLS — what the coding agents on this machine can actually do, plus a+ * browsable catalog of what they could.+ *+ * Two halves, deliberately separate:+ *+ * 1. LOCAL — skills already installed, discovered by walking the directories+ * each CLI reads. Claude Code is the well-specified one: a skill is a folder+ * containing SKILL.md whose YAML frontmatter carries `name` and+ * `description`. OpenCode and Codex use plugin/config directories instead,+ * so they are reported as plugins rather than pretending they share a format.+ *+ * 2. CATALOG — abubakarsiddik31/claude-skills-collection: 227 skills in 13+ * categories, as markdown tables with a GitHub source link per row. It has no+ * JSON index (checked), so entries are parsed from the raw markdown and+ * cached on disk. Network failure is never fatal: a stale cache, then an+ * empty list, then the UI says so.+ *+ * Nothing here installs anything. Discovery and browsing only — installing a+ * third-party skill means running someone else's instructions inside an agent+ * that has the user's tools, and that decision stays with the user.+ */+import { existsSync, readFileSync, readdirSync, statSync, writeFileSync, mkdirSync, rmSync } from 'node:fs';+import { join, basename, dirname, resolve, sep } from 'node:path';+import { homedir } from 'node:os';+import { getText } from './fetchText';++export interface LocalSkill {+ id: string;+ name: string;+ description: string;+ /** Which CLI reads this directory. */+ provider: 'claude' | 'opencode' | 'codex';+ /** 'user' = global for the whole machine, 'project' = one repo, 'bundled' = ships with the app. */+ scope: 'user' | 'project' | 'bundled';+ path: string;+}++export interface CatalogSkill {+ name: string;+ description: string;+ url: string;+ category: string;+ /** The publisher, taken from the source URL's GitHub owner — anthropics,+ * stripe, supabase. The names in this list are bare (`docx`, `pdf`), so the+ * URL is the only place the publisher appears. */+ owner: string;+}++/** Strip a leading YAML frontmatter block and pull the two fields we render.+ * Deliberately not a YAML parser: `name` and `description` are all the UI shows,+ * and description is routinely a multi-line `|` block, which a naive+ * key:value split would truncate at the first line. */+export function parseSkillFrontmatter(md: string): { name?: string; description?: string } {+ const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(md);+ if (!m) return {};+ const body = m[1];+ const out: { name?: string; description?: string } = {};+ const nameM = /^name:\s*(.+)$/m.exec(body);+ if (nameM) out.name = nameM[1].trim().replace(/^["']|["']$/g, '');+ // Block scalar (`description: |`) → take the indented lines that follow.+ // Consecutive INDENTED lines after `description: |`. The earlier lookahead+ // form ended at `\r?\n?$`, which under /m matches the end of the FIRST line —+ // so every multi-line description silently arrived truncated to one line.+ const blockM = /^description:\s*[|>]-?[ \t]*\r?\n((?:[ \t]+.*(?:\r?\n|$))+)/m.exec(body);+ if (blockM) {+ out.description = blockM[1].split(/\r?\n/).map((l) => l.trim()).filter(Boolean).join(' ').trim();+ } else {+ const inlineM = /^description:\s*(.+)$/m.exec(body);+ if (inlineM) out.description = inlineM[1].trim().replace(/^["']|["']$/g, '');+ }+ return out;+}++/** Every folder under `dir` holding a SKILL.md, read into a LocalSkill. */+function scanSkillDir(+ dir: string,+ provider: LocalSkill['provider'],+ scope: LocalSkill['scope']+): LocalSkill[] {+ const out: LocalSkill[] = [];+ try {+ if (!existsSync(dir) || !statSync(dir).isDirectory()) return out;+ for (const entry of readdirSync(dir)) {+ const skillDir = join(dir, entry);+ const md = join(skillDir, 'SKILL.md');+ try {+ if (!statSync(skillDir).isDirectory() || !existsSync(md)) continue;+ const fm = parseSkillFrontmatter(readFileSync(md, 'utf8'));+ out.push({+ id: `${scope}:${entry}`,+ name: fm.name || entry,+ description: fm.description || '',+ provider,+ scope,+ path: skillDir+ });+ } catch { /* one unreadable skill must not hide the rest */ }+ }+ } catch { /* unreadable root → report nothing rather than throw into IPC */ }+ return out;+}++/** Plugin directories for the CLIs that do not use Claude's SKILL.md format.+ * Reported as entries so the tab tells the truth about what a provider has,+ * instead of implying only Claude Code is extensible. */+function scanPluginDir(dir: string, provider: LocalSkill['provider'], scope: LocalSkill['scope']): LocalSkill[] {+ const out: LocalSkill[] = [];+ try {+ if (!existsSync(dir) || !statSync(dir).isDirectory()) return out;+ for (const entry of readdirSync(dir)) {+ if (entry.startsWith('.')) continue;+ out.push({+ id: `${scope}:${provider}:${entry}`,+ name: entry.replace(/\.(m|c)?js$/i, ''),+ description: `Plugin in ${basename(dirname(dir))}/${basename(dir)}`,+ provider,+ scope,+ path: join(dir, entry)+ });+ }+ } catch { /* noop */ }+ return out;+}++/**+ * Everything installed, deduped by (provider, name) with the most specific scope+ * winning — a project skill shadows the user's, which shadows the bundled copy,+ * which is the same precedence the CLIs themselves apply.+ */+export function listLocalSkills(opts: { cwds: string[]; bundledDir: string | null }): LocalSkill[] {+ const home = homedir();+ const found: LocalSkill[] = [+ ...(opts.bundledDir ? scanSkillDir(opts.bundledDir, 'claude', 'bundled') : []),+ ...scanSkillDir(join(home, '.claude', 'skills'), 'claude', 'user'),+ ...scanPluginDir(join(home, '.config', 'opencode', 'plugin'), 'opencode', 'user'),+ ...scanPluginDir(join(home, '.codex', 'plugins'), 'codex', 'user')+ ];+ for (const cwd of opts.cwds) {+ if (!cwd) continue;+ found.push(...scanSkillDir(join(cwd, '.claude', 'skills'), 'claude', 'project'));+ found.push(...scanPluginDir(join(cwd, '.opencode', 'plugin'), 'opencode', 'project'));+ }+ const rank = { project: 3, user: 2, bundled: 1 } as const;+ const best = new Map<string, LocalSkill>();+ for (const s of found) {+ const key = `${s.provider}:${s.name.toLowerCase()}`;+ const prev = best.get(key);+ if (!prev || rank[s.scope] > rank[prev.scope]) best.set(key, s);+ }+ return [...best.values()].sort((a, b) => a.name.localeCompare(b.name));+}++const CATALOG_URL =+ 'https://raw.githubusercontent.com/abubakarsiddik31/claude-skills-collection/main/README.md';+/** A curated list changes on a human timescale; a day-old copy is fine and keeps+ * the tab instant on every open after the first. */+const CATALOG_TTL_MS = 24 * 60 * 60 * 1000;++/**+ * Parse the catalog README into entries.+ *+ * The list is markdown TABLES under `## <emoji> Category` headings:+ *+ * | Name | Description | Link |+ * |------|-------------|------|+ * | **docx** | Create and edit Word documents | [Source](https://github.com/…/tree/main/skills/docx) |+ *+ * Rows that are not skill rows — the header row, the `|---|` rule, the overview+ * table that counts skills per category — are skipped by requiring three cells+ * AND a resolvable https link. Anything else is dropped rather than guessed at:+ * a catalog missing a row is honest, one full of parsed headers is not.+ */+export function parseCatalogMarkdown(md: string): CatalogSkill[] {+ const out: CatalogSkill[] = [];+ let category = 'Skills';+ const seen = new Set<string>();+ for (const raw of md.split(/\r?\n/)) {+ const line = raw.trim();+ const h = /^#{2,3}\s+(.+?)\s*$/.exec(line);+ if (h) {+ category = h[1]+ .replace(/\[([^\]]+)\]\([^)]*\)/g, '$1')+ .replace(/[*_`]/g, '')+ // Leading pictographs only — a blanket non-alphanumeric strip would eat+ // the dot off a name like ".NET".+ .replace(/^[\p{Extended_Pictographic}\uFE0F\s]+/u, '')+ .trim() || category;+ continue;+ }+ if (!line.startsWith('|')) continue;+ const cells = line.split('|').slice(1, -1).map((c) => c.trim());+ if (cells.length < 3) continue;+ if (/^-{3,}$/.test(cells[0].replace(/:/g, ''))) continue; // the |---| rule+ const name = cells[0].replace(/[*`]/g, '').trim();+ const description = cells[1].replace(/[*`]/g, '').trim();+ const linkM = /\((https?:\/\/[^)]+)\)/.exec(cells[2]) || /(https?:\/\/\S+)/.exec(cells[2]);+ if (!name || !linkM) continue;+ const url = linkM[1].trim();+ const key = `${name}|${url}`;+ if (seen.has(key)) continue;+ seen.add(key);+ const ghOwner = /^https:\/\/github\.com\/([^/]+)/i.exec(url);+ out.push({+ name,+ description,+ url,+ category,+ owner: ghOwner ? ghOwner[1].toLowerCase() : 'other'+ });+ }+ return out;+}+++/**+ * The catalog, from cache when fresh and from the network otherwise. A failed+ * refresh falls back to whatever is cached — an offline user still gets to+ * browse, flagged as stale, instead of an empty tab and no explanation.+ */+export async function loadCatalog(+ cachePath: string,+ opts: { force?: boolean } = {}+): Promise<{ skills: CatalogSkill[]; fetchedAt: number; stale: boolean; error?: string }> {+ let cached: { skills: CatalogSkill[]; fetchedAt: number } | null = null;+ try {+ if (existsSync(cachePath)) cached = JSON.parse(readFileSync(cachePath, 'utf8'));+ } catch { cached = null; }++ const fresh = cached && Date.now() - cached.fetchedAt < CATALOG_TTL_MS;+ if (fresh && !opts.force) return { skills: cached!.skills, fetchedAt: cached!.fetchedAt, stale: false };++ try {+ const md = await getText(CATALOG_URL);+ const skills = parseCatalogMarkdown(md);+ // An empty parse means the README's shape changed under us. Keep the cache.+ if (skills.length === 0 && cached) {+ return { skills: cached.skills, fetchedAt: cached.fetchedAt, stale: true, error: 'catalog format changed' };+ }+ const payload = { skills, fetchedAt: Date.now() };+ try {+ mkdirSync(dirname(cachePath), { recursive: true });+ writeFileSync(cachePath, JSON.stringify(payload));+ } catch { /* cache is an optimisation, not a requirement */ }+ return { ...payload, stale: false };+ } catch (e) {+ const error = e instanceof Error ? e.message : String(e);+ if (cached) return { skills: cached.skills, fetchedAt: cached.fetchedAt, stale: true, error };+ return { skills: [], fetchedAt: 0, stale: true, error };+ }+}++/* ── Install / uninstall ──────────────────────────────────────────────────────+ *+ * A skill is INSTRUCTIONS THAT RUN INSIDE AN AGENT holding the user's tools and+ * keys, so this half of the file is written as if the source is hostile, because+ * from the app's point of view it is: it is arbitrary content from a public list+ * that anyone can PR into.+ *+ * Every limit below exists to bound a specific abuse:+ * - the destination name is sanitised, so `../../.claude/settings.json` cannot+ * be a "skill name";+ * - each downloaded path is re-checked to be inside the destination AFTER+ * resolution, so a crafted API response cannot escape it;+ * - file count, total bytes and depth are capped, so a repo cannot fill a disk;+ * - only regular files are written — a `symlink` or `submodule` entry from the+ * contents API is skipped, never followed.+ *+ * Uninstall is the more dangerous verb and is treated as such: it deletes a+ * directory, so it refuses anything that is not INSIDE a known skills root and+ * does not itself contain a SKILL.md. A bundled skill can never be removed — it+ * ships inside the app and would reappear on the next spawn anyway.+ */++/** GitHub's per-directory listing. Only the fields we actually consume. */+interface GhEntry { name: string; path: string; type: string; size?: number; download_url?: string | null }++const MAX_FILES = 60;+const MAX_TOTAL_BYTES = 2 * 1024 * 1024;+const MAX_DEPTH = 5;++/**+ * A GitHub source URL → the pieces the contents API needs.+ *+ * Two shapes, because the catalog uses both: a folder inside a repo+ * (`owner/repo/tree/<ref>/<path>`, 145 entries) and a whole repo whose root IS+ * the skill (`owner/repo`, 81 entries). For the latter `ref` is empty and the+ * caller omits it, which makes the API use the repo's default branch — there is+ * no reliable way to guess between `main` and `master` and no need to.+ */+export function parseGitHubSourceUrl(url: string): { owner: string; repo: string; ref: string; path: string } | null {+ const clean = url.trim().replace(/[#?].*$/, '').replace(/\/+$/, '');+ const tree = /^https:\/\/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)\/?(.*)$/.exec(clean);+ if (tree) {+ const [, owner, repo, ref, path] = tree;+ if (!owner || !repo || !ref) return null;+ return { owner, repo, ref, path: path.replace(/\/+$/, '') };+ }+ const root = /^https:\/\/github\.com\/([^/]+)\/([^/]+)$/.exec(clean);+ if (root) {+ const [, owner, repo] = root;+ // Reserved paths that are not repositories.+ if (['orgs', 'topics', 'collections', 'sponsors', 'features'].includes(owner.toLowerCase())) return null;+ return { owner, repo: repo.replace(/\.git$/i, ''), ref: '', path: '' };+ }+ return null;+}++/** A folder name we are willing to create. Anything with a separator, a dot-dot,+ * or a leading dot is rejected outright rather than massaged into safety. */+export function safeSkillDirName(raw: string): string | null {+ const base = raw.trim().split('/').pop() ?? '';+ if (!base || base === '.' || base === '..') return null;+ if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.test(base)) return null;+ if (base.includes('..')) return null;+ return base;+}++function getJson<T>(url: string): Promise<T> {+ return getText(url).then((t) => JSON.parse(t) as T);+}++/** officialskills.sh pages are a rendering of a GitHub folder and link back to+ * it. Resolving that link is one request and turns 578 otherwise un-installable+ * catalog rows into installable ones. */+async function resolveSourceUrl(url: string): Promise<string | null> {+ if (parseGitHubSourceUrl(url)) return url;+ if (!/^https:\/\/(www\.)?officialskills\.sh\//i.test(url)) return null;+ try {+ const html = await getText(url);+ const m = /https:\/\/github\.com\/[^/"'\s]+\/[^/"'\s]+\/tree\/[^"'\s<>)]+/.exec(html);+ return m ? m[0].replace(/[.,)]+$/, '') : null;+ } catch { return null; }+}++/**+ * Download one skill folder into the user's Claude skills directory.+ *+ * Returns a structured refusal rather than throwing, so the UI can say WHY —+ * "not installable" and "install failed" are different answers for the user.+ */+export async function installSkill(+ entryUrl: string,+ entryName: string+): Promise<{ ok: true; path: string } | { ok: false; error: string; unsupported?: boolean }> {+ const source = await resolveSourceUrl(entryUrl);+ if (!source) {+ return { ok: false, unsupported: true, error: 'No downloadable source — open Learn more to install it by hand.' };+ }+ const gh = parseGitHubSourceUrl(source);+ if (!gh) return { ok: false, unsupported: true, error: 'Source is not a GitHub folder.' };++ const dirName = safeSkillDirName(gh.path || entryName);+ if (!dirName) return { ok: false, error: 'That skill has a name this app will not create a folder for.' };++ const root = join(homedir(), '.claude', 'skills');+ const dest = join(root, dirName);+ if (existsSync(dest)) return { ok: false, error: `Already installed at ${dest}` };++ // An empty ref means "the repo's default branch" — omit the parameter entirely+ // rather than guessing main vs master.+ const api = (p: string) =>+ `https://api.github.com/repos/${gh.owner}/${gh.repo}/contents/${p ? encodeURI(p) : ''}`+ + (gh.ref ? `?ref=${encodeURIComponent(gh.ref)}` : '');++ const files: { path: string; url: string; size: number }[] = [];+ let total = 0;+ const walk = async (path: string, depth: number): Promise<string | null> => {+ if (depth > MAX_DEPTH) return 'the folder nests deeper than this installer will follow';+ let listing: GhEntry[];+ try {+ const res = await getJson<GhEntry[] | GhEntry>(api(path));+ listing = Array.isArray(res) ? res : [res];+ } catch (e) {+ return e instanceof Error ? e.message : String(e);+ }+ for (const it of listing) {+ if (files.length >= MAX_FILES) return 'that skill has more files than this installer will fetch';+ if (it.type === 'dir') {+ const err = await walk(it.path, depth + 1);+ if (err) return err;+ continue;+ }+ // Only regular files. A symlink/submodule entry is skipped, never followed.+ if (it.type !== 'file' || !it.download_url) continue;+ const size = it.size ?? 0;+ total += size;+ if (total > MAX_TOTAL_BYTES) return 'that skill is larger than this installer will fetch';+ const rel = gh.path ? it.path.slice(gh.path.length).replace(/^\/+/, '') : it.path;+ files.push({ path: rel, url: it.download_url, size });+ }+ return null;+ };++ const walkErr = await walk(gh.path, 0);+ if (walkErr) return { ok: false, error: walkErr };+ if (files.length === 0) return { ok: false, error: 'No files found at that source.' };++ // Write only after the whole tree resolved, so a mid-download failure cannot+ // leave a half-installed skill that an agent would then load.+ const written: string[] = [];+ try {+ for (const f of files) {+ const target = resolve(dest, f.path);+ // Post-resolution containment: the only check that survives a crafted path.+ if (target !== dest && !target.startsWith(dest + sep)) {+ throw new Error(`refusing to write outside the skill folder: ${f.path}`);+ }+ const body = await getText(f.url);+ mkdirSync(dirname(target), { recursive: true });+ writeFileSync(target, body);+ written.push(target);+ }+ } catch (e) {+ try { rmSync(dest, { recursive: true, force: true }); } catch { /* best effort */ }+ return { ok: false, error: e instanceof Error ? e.message : String(e) };+ }+ return { ok: true, path: dest };+}++/**+ * Remove an installed skill. Refuses anything it cannot prove is a skill folder+ * inside a skills root — the failure mode of getting this wrong is deleting a+ * directory of the user's work.+ */+export function uninstallSkill(+ skillPath: string,+ opts: { cwds: string[] }+): { ok: true } | { ok: false; error: string } {+ if (typeof skillPath !== 'string' || !skillPath.trim()) return { ok: false, error: 'no path given' };+ let target: string;+ try { target = resolve(skillPath); } catch { return { ok: false, error: 'unreadable path' }; }++ const roots = [+ join(homedir(), '.claude', 'skills'),+ join(homedir(), '.config', 'opencode', 'plugin'),+ join(homedir(), '.codex', 'plugins'),+ ...opts.cwds.filter(Boolean).flatMap((c) => [+ join(c, '.claude', 'skills'),+ join(c, '.opencode', 'plugin')+ ])+ ].map((r) => resolve(r));++ const root = roots.find((r) => target.startsWith(r + sep));+ if (!root) return { ok: false, error: 'That folder is not inside a skills directory this app manages.' };+ if (target === root) return { ok: false, error: 'refusing to delete the skills directory itself' };+ if (!existsSync(target)) return { ok: false, error: 'Already gone.' };++ // A directory must look like a skill; a plugin entry must be a plain file.+ try {+ const st = statSync(target);+ if (st.isDirectory()) {+ if (!existsSync(join(target, 'SKILL.md'))) {+ return { ok: false, error: 'That folder has no SKILL.md — refusing to delete it.' };+ }+ } else if (!st.isFile()) {+ return { ok: false, error: 'Not a file or folder this app will remove.' };+ }+ } catch { return { ok: false, error: 'could not inspect that path' }; }++ try {+ rmSync(target, { recursive: true, force: true });+ return { ok: true };+ } catch (e) {+ return { ok: false, error: e instanceof Error ? e.message : String(e) };+ }+}diff --git a/src/main/updater.ts b/src/main/updater.tsindex 2427267a..a9603a80 100644--- a/src/main/updater.ts+++ b/src/main/updater.ts@@ -4,6 +4,7 @@ import { request as httpsRequest } from 'node:https';import { appendFileSync, mkdirSync } from 'node:fs';import { join } from 'node:path';import { readConfig } from './config';+import { DEFAULT_DROP_HTML } from '../shared/releaseDrop';import { reduceStatus, clampPercent, isNewer, type UpdateStatus } from '../shared/updateState';/**@@ -203,6 +204,35 @@ async function runDownload(): Promise<{ ok: boolean; error?: string }> {* Start the updater. Call once from app.whenReady with an accessor for the* primary window's webContents. Safe to call in dev (registers IPC, no polling).*/+/** DEV ONLY — a realistic release body for `update:simulate`.+ *+ * Structurally a copy of the REAL v0.4.4 release body, not of CHANGELOG.md, and+ * the difference is load-bearing: summarizeReleaseNotes digests the first section+ * that yields list items, so it must skip a title, a marketing paragraph, a rule+ * and a `> [!IMPORTANT]` block before reaching the bullets. Fed the CHANGELOG+ * shape instead (bold lead paragraph, then `### Fixed`) it returns ONE bullet —+ * the lead paragraph, clipped mid-sentence. Verified against the published+ * v0.4.4-rc.1 body: this shape yields the same 3 bullets the real toast shows. */+const SIMULATED_NOTES = `# Munder Difflin v9.9.9++**A local hive of Claude Code, Antigravity, Codex, Grok & Copilot agents that run themselves** —+messaging, routing, and remembering, coordinated by your clone, Michael, who you talk to.++---++## What's new in 9.9.9 — *simulated release*++**On Windows, agents were never told they could message each other.** They started, rendered, and+looked perfectly healthy — but a multi-line prompt handed to a CLI through \`cmd.exe\` is cut off at+its first newline.++- **Agent-to-agent messaging works on Windows.** Prompt-carrying spawns now run the CLI's real+ interpreter directly instead of routing through \`cmd.exe\`, so the whole protocol survives.+- **Setup can finish again.** Accepting the suggested \`~/HarnessAgents\` folder wrote a literal+ \`~\`, and the wizard then died on \`ENOENT: mkdir '~/HarnessAgents'\`.+- **Copying from a terminal is clean.** The Edit menu was intercepting ⌘C before the terminal saw it.+- **Agent terminals are UTF-8.** They ran with no locale at all.`;+export function initAutoUpdater(getWebContents: () => WebContents | null): void {sendTo = getWebContents;@@ -230,6 +260,36 @@ export function initAutoUpdater(getWebContents: () => WebContents | null): void});/** Re-serve the last known status to a freshly loaded window. */ipcMain.handle('update:current', () => lastStatus ?? { state: 'idle' });+ /**+ * DEV ONLY — push a synthetic status so the update toast can be seen without a+ * real release. The toast renders for exactly two states ('downloaded' and+ * 'available-manual'), and a dev build can reach NEITHER: the whole polling+ * block below is behind `app.isPackaged`, and checkNow/download refuse above.+ * So the one UI that only ever appears at release time was the one UI nobody+ * could look at while building it.+ *+ * Hard-gated on `!app.isPackaged` — in a shipped build this handler answers+ * `{ok:false}` and can never fabricate an update for a real user.+ */+ ipcMain.handle('update:simulate', (_evt, opts: unknown) => {+ if (app.isPackaged) return { ok: false, error: 'simulate is dev-only' };+ const o = (opts ?? {}) as { state?: string; version?: string; notes?: string; drop?: boolean };+ const version = typeof o.version === 'string' && o.version ? o.version : '9.9.9';+ // `drop: true` previews the centered release page built from the default+ // template; without it you get the corner digest toast. Both paths ship, so+ // both need to be previewable — defaulting to one would leave the other+ // only ever seen by users.+ const notes = typeof o.notes === 'string'+ ? o.notes+ : o.drop === true+ ? `<!-- drop -->\n${DEFAULT_DROP_HTML}\n<!-- /drop -->`+ : SIMULATED_NOTES;+ emit(o.state === 'downloaded'+ ? { state: 'downloaded', version, notes }+ : { state: 'available-manual', version, notes, url: `https://github.com/${REPO}/releases/tag/v${version}` });+ logLine(`SIMULATED ${o.state === 'downloaded' ? 'downloaded' : 'available-manual'} ${version} (dev only)`);+ return { ok: true };+ });ipcMain.handle('update:openRelease', (_evt, url: unknown) => {const href = typeof url === 'string' ? url : `https://github.com/${REPO}/releases/latest`;// Only ever open the project's releases page — this is not a generic opener.diff --git a/src/preload/index.ts b/src/preload/index.tsindex 8b4ab883..e6909511 100644--- a/src/preload/index.ts+++ b/src/preload/index.ts@@ -6,6 +6,12 @@ import type { IntegrationRecord, IntegrationTemplate } from '../shared/integratiexport type { IntegrationRecord, IntegrationTemplate } from '../shared/integrations';import type { UpdateStatus } from '../shared/updateState';export type { UpdateStatus } from '../shared/updateState';+import type { ToolStatus } from '../shared/toolCatalog';+export type { ToolStatus } from '../shared/toolCatalog';+import type { HeroPayload } from '../shared/heroPayload';+export type { HeroPayload } from '../shared/heroPayload';+import type { LocalSkill, CatalogSkill } from '../main/skills';+export type { LocalSkill, CatalogSkill } from '../main/skills';import type {ContextRule, ContextTriggerConfig, OrgTriggerConfig, TriggerHistoryEntry, WebhookTrigger} from '../shared/triggers';@@ -746,6 +752,29 @@ const api = {// ─── Semantic memory (MemPalace CLI) ─────────────────────────────────────memoryStatus: (): Promise<MemoryStatus> => ipcRenderer.invoke('hive:memoryStatus'),+ /** Which external tools (uv, mempalace, git, each agent engine) are actually+ * present on this machine, with a platform-resolved install command each. */+ toolsStatus: (): Promise<ToolStatus[]> => ipcRenderer.invoke('tools:status'),+ /** Settings hero payload — plan + sponsor, fetched from the repo and cached. */+ heroPayload: (force?: boolean): Promise<{ hero: HeroPayload; fetchedAt: number; stale: boolean }> =>+ ipcRenderer.invoke('hero:payload', force),+ /** Skills already installed for the coding agents on this machine. */+ skillsLocal: (cwd?: string): Promise<LocalSkill[]> => ipcRenderer.invoke('skills:local', cwd),+ /** The browsable skills catalog (cached; `force` re-fetches). */+ skillsCatalog: (force?: boolean): Promise<{+ skills: CatalogSkill[]; fetchedAt: number; stale: boolean; error?: string;+ }> => ipcRenderer.invoke('skills:catalog', force),+ /** Install a catalog skill into ~/.claude/skills. `unsupported` distinguishes+ * "there is no downloadable source" from "the download failed". */+ skillsInstall: (url: string, name: string): Promise<+ { ok: true; path: string } | { ok: false; error: string; unsupported?: boolean }+ > => ipcRenderer.invoke('skills:install', url, name),+ /** Delete an installed skill. Main refuses any path outside a skills root. */+ skillsUninstall: (path: string): Promise<{ ok: boolean; error?: string }> =>+ ipcRenderer.invoke('skills:uninstall', path),+ /** Show a skill's folder in the OS file manager. */+ skillsReveal: (path: string): Promise<{ ok: boolean; error?: string }> =>+ ipcRenderer.invoke('skills:reveal', path),searchMemory: (query: string, wing?: string): Promise<{ ok: boolean; output: string; error?: string }> =>ipcRenderer.invoke('hive:searchMemory', query, wing),memoryWakeUp: (wing?: string): Promise<{ ok: boolean; output: string; error?: string }> =>@@ -1319,7 +1348,21 @@ const api = {ipcRenderer.invoke('update:download'),/** Open the project's releases page for a notify-only update. */updateOpenRelease: (url?: string): Promise<{ ok: boolean }> =>- ipcRenderer.invoke('update:openRelease', url)+ ipcRenderer.invoke('update:openRelease', url),+ /** DEV ONLY — fabricate an update status so the toast can be inspected without+ * cutting a release. Refused (`{ok:false}`) in a packaged build; see the+ * handler in updater.ts. Call it from the devtools console:+ * await window.cth.updateSimulate() // notify-only digest toast+ * await window.cth.updateSimulate({ state: 'downloaded' }) // restart-to-update toast+ * await window.cth.updateSimulate({ drop: true }) // the centered release page+ * await window.cth.updateSimulate({ notes: '<!-- drop -->…' }) // your own drop */+ updateSimulate: (opts?: {+ state?: 'downloaded' | 'available-manual';+ version?: string;+ notes?: string;+ /** Preview the centered release page using the default drop template. */+ drop?: boolean;+ }): Promise<{ ok: boolean; error?: string }> => ipcRenderer.invoke('update:simulate', opts)};contextBridge.exposeInMainWorld('cth', api);diff --git a/src/renderer/src/components/MemoryPanel.tsx b/src/renderer/src/components/MemoryPanel.tsxindex d12d6eb0..0c6a5822 100644--- a/src/renderer/src/components/MemoryPanel.tsx+++ b/src/renderer/src/components/MemoryPanel.tsx@@ -124,25 +124,29 @@ export function MemoryPanel() {fontSize: 12, color: 'var(--cth-ink-700)', lineHeight: 1.6,background: 'var(--cth-cream-100)', boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)', padding: 10}}>- Meaning-based search isn't installed yet. Run these commands to set it up:- <div style={{ marginTop: 8, display: 'flex', flexDirection: 'column', gap: 3 }}>- <div style={{ color: 'var(--cth-ink-500)', fontSize: 11, marginBottom: 2 }}>- If{' '}- <code style={{ fontFamily: 'var(--cth-font-mono)', background: 'var(--cth-paper-100)', padding: '1px 4px', boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)' }}>uv</code>- {' '}isn't installed yet, install it first:- </div>- {[- 'curl -LsSf https://astral.sh/uv/install.sh | sh',- 'source ~/.zshrc # or restart the terminal',- 'uv tool install mempalace',- ].map((cmd) => (- <code key={cmd} style={{- display: 'block',- fontFamily: 'var(--cth-font-mono)', fontSize: 11, color: 'var(--cth-ink-900)',- background: 'var(--cth-paper-100)', padding: '3px 6px',- boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)'- }}>{cmd}</code>- ))}+ Meaning-based search isn't installed yet.+ {/* The commands used to be inlined here, hardcoded for macOS+ (`curl … | sh`, `source ~/.zshrc`) — dead text under cmd.exe or+ PowerShell, on the platform most likely to be missing the tool.+ Setup owns the platform-correct commands now, plus the uv+ dependency, the live detected state, and the delegate-to-Michael+ path. One source of truth beats two that disagree by OS. */}+ <div style={{ marginTop: 8 }}>+ <PixelButton+ variant="primary"+ size="sm"+ onClick={() => {+ // Prerequisites moved from a Command Center tab into+ // Settings; requesting the old tab key is now a no-op that+ // silently does nothing on click.+ window.dispatchEvent(new CustomEvent('cth:open-settings', {+ detail: { section: 'Prerequisites' }+ }));+ setOpen(false);+ }}+ >+ set it up in Prerequisites →+ </PixelButton></div><div style={{ marginTop: 8, color: 'var(--cth-ink-500)' }}>Agents still keep plain notes without it.diff --git a/src/renderer/src/components/MessageQueueComposer.tsx b/src/renderer/src/components/MessageQueueComposer.tsxindex 4d063b72..bf007ce1 100644--- a/src/renderer/src/components/MessageQueueComposer.tsx+++ b/src/renderer/src/components/MessageQueueComposer.tsx@@ -1,4 +1,5 @@-import { ClipboardEvent, DragEvent, KeyboardEvent, useEffect, useLayoutEffect, useRef, useState } from 'react';+import { ClipboardEvent, DragEvent, KeyboardEvent, type MouseEvent as ReactMouseEvent, useEffect, useLayoutEffect, useRef, useState } from 'react';+import { createPortal } from 'react-dom';import { PixelButton } from './PixelButton';import { Icon } from './Icon';import { useStore, type Agent, type QueuedMessage } from '@/store/store';@@ -546,27 +547,167 @@ function FreeFlowButton({ agentId, hasGroqKey }: { agentId: string; hasGroqKey:// Block while another agent's clip is recording/uploading (single recorder).const busyElsewhere = ff.status !== 'idle' && !mine;const noKey = !hasGroqKey;++ const hintRef = useRef<HTMLSpanElement | null>(null);+ const iconRef = useRef<HTMLButtonElement | null>(null);+ const panelRef = useRef<HTMLDivElement | null>(null);+ const [hint, setHint] = useState<{ left: number; top: number } | null>(null);+ const hintOpen = hint !== null;++ const HINT_W = 244;+ const HINT_GAP = 8;+ const EST_H = 188;+const title = noKey- ? 'Add a Groq API key in Settings → Free Flow to use voice mode.'+ ? 'Dictation needs a free Groq API key. Click the info mark for the steps.': recording ? 'Stop & transcribe': transcribing ? 'Transcribing…'- : 'Free Flow — dictate into the queue (push to talk)';- // Wrap in a (non-disabled) span so the native title tooltip still shows on hover- // even when the inner button is disabled — Chromium suppresses tooltips on a- // disabled <button> itself.+ : 'Free Flow — dictate into the queue. Click, or hold Option (⌥).';++ /** Same placement rule as RealtimeMichaelToggle's hint: prefer above (the+ * composer sits low in the panel), flip below only when there is no room, and+ * clamp both axes so it can never hang off an edge. */+ const toggleHint = (e: ReactMouseEvent): void => {+ e.stopPropagation();+ if (hint) { setHint(null); return; }+ const r = iconRef.current?.getBoundingClientRect();+ if (!r) return;+ const above = r.top - HINT_GAP - EST_H;+ const top = above >= 8 ? above : Math.min(r.bottom + HINT_GAP, window.innerHeight - EST_H - 8);+ const left = Math.max(8, Math.min(r.left, window.innerWidth - HINT_W - 8));+ setHint({ left, top: Math.max(8, top) });+ };++ useEffect(() => {+ if (!hintOpen) return;+ const onDown = (ev: globalThis.MouseEvent): void => {+ const t = ev.target as Node;+ // Portalled, so an inside-click has to be tested against BOTH nodes.+ if (hintRef.current?.contains(t) || panelRef.current?.contains(t)) return;+ setHint(null);+ };+ const onKey = (ev: globalThis.KeyboardEvent): void => { if (ev.key === 'Escape') setHint(null); };+ const onReflow = (): void => setHint(null);+ document.addEventListener('mousedown', onDown);+ document.addEventListener('keydown', onKey);+ window.addEventListener('resize', onReflow);+ window.addEventListener('scroll', onReflow, true);+ return () => {+ document.removeEventListener('mousedown', onDown);+ document.removeEventListener('keydown', onKey);+ window.removeEventListener('resize', onReflow);+ window.removeEventListener('scroll', onReflow, true);+ };+ }, [hintOpen]);++ const openKeySettings = (e: ReactMouseEvent): void => {+ e.stopPropagation();+ setHint(null);+ window.dispatchEvent(new CustomEvent('cth:open-settings', { detail: { section: 'Voice' } }));+ };+return (- <span title={title} style={{ display: 'inline-flex' }}>- <PixelButton- variant={recording ? 'destructive' : 'secondary'}- size="sm"- onClick={() => { if (noKey) return; freeflowRecorder.toggle(agentId); }}- disabled={noKey || transcribing || busyElsewhere}- >- <span style={{ display: 'inline-flex', gap: 6, alignItems: 'center' }}>- <Icon name="mic" />- {transcribing ? '…' : recording ? 'stop' : 'voice'}+ <span style={{ display: 'inline-flex', alignItems: 'center', gap: noKey ? 4 : 0, minWidth: 0 }}>+ {/* Wrap in a (non-disabled) span so the native tooltip still shows on hover+ even when the inner button is disabled — Chromium suppresses tooltips on+ a disabled <button> itself. */}+ <span title={title} style={{ display: 'inline-flex' }}>+ <PixelButton+ variant={recording ? 'destructive' : 'secondary'}+ size="sm"+ onClick={() => { if (noKey) return; freeflowRecorder.toggle(agentId); }}+ disabled={noKey || transcribing || busyElsewhere}+ >+ <span style={{ display: 'inline-flex', gap: 6, alignItems: 'center' }}>+ <Icon name="mic" />+ {transcribing ? '…' : recording ? 'stop' : 'voice'}+ </span>+ </PixelButton>+ </span>++ {/* A missing key is a SETUP STATE, not a failure — the same treatment Talk+ already gets. Without this the button is simply dead on click, and the+ two facts that would make someone act (it is FREE, and there is a+ hold-to-talk shortcut) were written down nowhere in the UI. */}+ {noKey && (+ <span ref={hintRef} style={{ display: 'inline-flex', flexShrink: 0 }}>+ <button+ ref={iconRef}+ type="button"+ aria-label="How do I enable dictation?"+ aria-expanded={hintOpen}+ onClick={toggleHint}+ style={{+ border: 'none', background: 'none', padding: 0, cursor: 'pointer',+ display: 'inline-flex', alignItems: 'center',+ color: 'var(--cth-ink-500)',+ opacity: hintOpen ? 1 : 0.75+ }}+ >+ <Icon name="info" />+ </button>++ {hint && createPortal(+ <div+ ref={panelRef}+ role="dialog"+ onClick={(e) => e.stopPropagation()}+ style={{+ position: 'fixed', left: hint.left, top: hint.top, zIndex: 460,+ width: HINT_W, padding: '10px 12px', boxSizing: 'border-box',+ display: 'flex', flexDirection: 'column', gap: 7,+ background: 'var(--cth-paper-100)',+ boxShadow: 'inset 0 0 0 1.5px var(--cth-ink-500), 4px 4px 0 rgba(26,19,32,0.25)',+ fontFamily: 'var(--cth-font-ui)', fontSize: 11, lineHeight: '15px',+ color: 'var(--cth-ink-900)', textAlign: 'left', whiteSpace: 'normal'+ }}+ >+ <span style={{+ fontFamily: 'var(--cth-font-display)', fontSize: 9, letterSpacing: 0.5,+ textTransform: 'uppercase', color: 'var(--cth-ink-500)'+ }}>Set up dictation</span>++ {/* Lead with the cost, because "add an API key" reads as "this will+ bill me" and that assumption is what stops people here. */}+ <span>+ Speak instead of typing. Groq transcribes it, and their free tier+ covers this — <strong>no card, no cost</strong>.+ </span>++ <ol style={{ margin: 0, paddingLeft: 16, display: 'flex', flexDirection: 'column', gap: 3 }}>+ <li>+ Create a free key at{' '}+ <a+ href="https://console.groq.com/keys"+ onClick={(e) => { e.preventDefault(); void window.cth.openExternal('https://console.groq.com/keys'); }}+ style={{ color: 'var(--cth-ink-900)' }}+ >console.groq.com/keys</a>+ </li>+ <li>Paste it into Settings → Voice → Groq API key</li>+ <li>Click <strong>voice</strong>, or hold the <strong>right Option</strong> key to talk</li>+ </ol>++ <span style={{ color: 'var(--cth-ink-500)' }}>+ Hold it ALONE for a moment to start; release to transcribe into+ the composer, where you can edit before sending. Either Option key+ works, and Option+key combos still reach the terminal untouched.+ </span>++ <button+ type="button"+ onClick={openKeySettings}+ style={{+ border: 'none', background: 'none', padding: 0, cursor: 'pointer',+ alignSelf: 'flex-start',+ fontFamily: 'var(--cth-font-ui)', fontSize: 11, lineHeight: '15px',+ color: 'var(--cth-ink-900)', textDecoration: 'underline'+ }}+ >set it up now</button>+ </div>,+ document.body+ )}</span>- </PixelButton>+ )}</span>);}diff --git a/src/renderer/src/components/ReleaseDrop.tsx b/src/renderer/src/components/ReleaseDrop.tsxnew file mode 100644index 00000000..7080b278--- /dev/null+++ b/src/renderer/src/components/ReleaseDrop.tsx@@ -0,0 +1,172 @@+/**+ * The release drop — a centered, full-bleed "what's new" moment.+ *+ * A corner toast with three clipped bullets is a changelog notification. This is+ * the other thing: a page the release author designs, shown once, at the size the+ * work deserves. The chrome here is deliberately thin — a header, a frame, a+ * footer of actions — because everything that should carry personality lives+ * inside the authored HTML, and the app's job is to present it and get out of+ * the way.+ *+ * The authored HTML runs in an iframe with `sandbox=""` and a `default-src 'none'`+ * CSP (see shared/releaseDrop.ts for why that is not negotiable). Two consequences+ * shape this component:+ *+ * 1. Links inside the drop cannot navigate — no scripts, no popups. So every+ * real action (read the release, star, dismiss, restart) is a chrome button+ * OUT here, where it is ordinary app code with ordinary permissions.+ * 2. The frame's height cannot be measured (that needs a postMessage bridge,+ * which needs allow-scripts). So the modal is a fixed viewport-relative box+ * and the drop scrolls inside it, rather than the box growing to fit.+ */+import { useEffect, useMemo } from 'react';+import { buildDropSrcDoc } from '../../../shared/releaseDrop';++export interface ReleaseDropProps {+ version: string;+ /** Authored HTML, already extracted from the release body. */+ html: string;+ /** 'downloaded' offers a restart; 'available-manual' offers the releases page. */+ canRestart: boolean;+ busy: boolean;+ showStar: boolean;+ onRestart: () => void;+ onOpenRelease: () => void;+ onStar: () => void;+ onDismiss: () => void;+}++export function ReleaseDrop({+ version, html, canRestart, busy, showStar,+ onRestart, onOpenRelease, onStar, onDismiss+}: ReleaseDropProps) {+ const srcDoc = useMemo(() => buildDropSrcDoc(html), [html]);++ // Esc dismisses. A modal this large with no keyboard exit feels like a trap,+ // and "later" is always a legitimate answer to an update.+ useEffect(() => {+ const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') onDismiss(); };+ window.addEventListener('keydown', onKey);+ return () => window.removeEventListener('keydown', onKey);+ }, [onDismiss]);++ // The chrome deliberately drops the app's pixel idiom. Inside this dialog the+ // drop is the subject and the surrounding UI should read as a quiet frame+ // around it — sharp 2px borders and hard drop-shadows fight a modern page.+ const INK = '#14131A';+ const INK_SOFT = '#6C6875';+ const LINE = 'rgba(20,19,26,0.10)';+ const button = (primary: boolean): React.CSSProperties => ({+ padding: '9px 18px',+ borderRadius: 999,+ background: primary ? INK : 'transparent',+ color: primary ? '#FBFAF8' : INK_SOFT,+ border: primary ? '1px solid ' + INK : `1px solid ${LINE}`,+ fontFamily: 'inherit', fontSize: 13.5, fontWeight: primary ? 600 : 500,+ cursor: busy ? 'not-allowed' : 'pointer',+ opacity: busy && primary ? 0.6 : 1+ });++ return (+ <div+ // Backdrop. Clicking it dismisses — same meaning as "later".+ onClick={onDismiss}+ style={{+ position: 'fixed', inset: 0, zIndex: 500,+ background: 'rgba(26,19,32,0.55)',+ display: 'flex', alignItems: 'center', justifyContent: 'center',+ padding: 24,+ // Same lesson as the onboarding overlay: center with auto margins on the+ // child, and let the overlay scroll, so a tall dialog is never clipped+ // at the top where it cannot be scrolled back to.+ overflowY: 'auto'+ }}+ >+ <div+ onClick={(e) => e.stopPropagation()}+ style={{+ margin: 'auto',+ // Roughly 1:1 at 80% of the viewport height. Deriving the width FROM the+ // height is what keeps it square as the window changes; `min(…, 94vw)`+ // is the escape hatch for a window too narrow to hold a square that+ // tall, where it becomes a portrait sheet rather than overflowing.+ height: '80vh',+ width: 'min(80vh, 94vw)',+ minHeight: 380,+ display: 'flex', flexDirection: 'column',+ background: '#FBFAF8',+ // Soft, modern elevation — not the app's pixel drop-shadow. The drop is+ // an authored artifact presented BY the app, not a piece of its chrome.+ borderRadius: 20,+ overflow: 'hidden', // so the frame's corners are clipped to the radius+ boxShadow: '0 24px 70px rgba(20,19,26,0.34), 0 2px 8px rgba(20,19,26,0.18)',+ // The app's own UI font is part of its pixel identity and reads as+ // retro chrome wrapped around a modern page. The dialog uses the system+ // stack instead, matching the drop inside it — one typographic voice+ // from the title bar to the buttons.+ fontFamily: '-apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif'+ }}+ >+ {/* Header — a thin, quiet bar. The drop supplies its own title. */}+ <div style={{+ flexShrink: 0, display: 'flex', alignItems: 'center', gap: 10,+ padding: '14px 18px 12px', borderBottom: `1px solid ${LINE}`,+ background: '#FBFAF8'+ }}>+ <span style={{+ fontSize: 11.5, fontWeight: 600, letterSpacing: '.1em',+ textTransform: 'uppercase', color: INK_SOFT, flex: 1, minWidth: 0+ }}>+ Munder Difflin · {version}+ </span>+ <button+ onClick={onDismiss}+ aria-label="Close"+ style={{+ width: 28, height: 28, borderRadius: 999, flexShrink: 0,+ border: `1px solid ${LINE}`, background: 'transparent', cursor: 'pointer',+ fontFamily: 'inherit', fontSize: 14, lineHeight: 1, color: INK_SOFT,+ display: 'flex', alignItems: 'center', justifyContent: 'center'+ }}+ >✕</button>+ </div>++ {/* The drop itself — authored HTML, fully sandboxed. */}+ <iframe+ title={`What's new in ${version}`}+ srcDoc={srcDoc}+ sandbox=""+ referrerPolicy="no-referrer"+ style={{+ flex: 1, minHeight: 0, width: '100%', border: 'none',+ background: '#FBFAF8'+ }}+ />++ {/* Actions live out here: the frame cannot navigate, by design. */}+ <div style={{+ flexShrink: 0, display: 'flex', alignItems: 'center', gap: 10, flexWrap: 'wrap',+ padding: '14px 18px', borderTop: `1px solid ${LINE}`,+ background: '#FBFAF8'+ }}>+ {showStar && (+ <button onClick={onStar} style={{+ border: 'none', background: 'transparent', cursor: 'pointer', padding: 0,+ fontFamily: 'inherit', fontSize: 13, fontWeight: 500,+ color: INK_SOFT, textDecoration: 'underline', textUnderlineOffset: 3+ }}>⭐ Star us on GitHub</button>+ )}+ <span style={{ flex: 1 }} />+ <button onClick={onDismiss} style={button(false)}>Later</button>+ {canRestart ? (+ <button onClick={onRestart} disabled={busy} style={button(true)}>+ {busy ? 'Restarting…' : 'Restart to update'}+ </button>+ ) : (+ <button onClick={onOpenRelease} style={button(true)}>Open releases</button>+ )}+ </div>+ </div>+ </div>+ );+}diff --git a/src/renderer/src/components/SettingsHeroCard.tsx b/src/renderer/src/components/SettingsHeroCard.tsxnew file mode 100644index 00000000..05a40733--- /dev/null+++ b/src/renderer/src/components/SettingsHeroCard.tsx@@ -0,0 +1,158 @@+/**+ * The hero card at the top of Settings → General.+ *+ * One card that answers "what is this install, and what can I do about it" —+ * the running version, the plan it is on, and the handful of actions that do not+ * belong to any individual setting below (re-read the release notes, star, back+ * the project).+ *+ * Its contents come from docs/hero.json IN THIS REPO, fetched at runtime and+ * cached — so plan copy, a sponsor, or a one-line notice can change without+ * shipping a build. That payload is DATA, never markup: every field below is a+ * React text node, so it is escaped, and shared/heroPayload.ts validates types,+ * caps lengths and requires https before any of it reaches here.+ *+ * It renders instantly from the app's built-in defaults and upgrades in place+ * when the fetch lands, so the dialog never waits on the network and reads the+ * same offline. A sponsor slot with nothing in it renders NOTHING rather than a+ * "your logo here" placeholder.+ *+ * Deliberately not a marketing panel: no gradient, no pitch. It sits above the+ * update section in a settings dialog, and anything louder than the settings it+ * introduces would be noise every time someone opens this to change a folder.+ */+import { useEffect, useState } from 'react';+import { PixelButton } from './PixelButton';+import { Icon } from './Icon';+import { DEFAULT_HERO, type HeroPayload } from '@shared/heroPayload';++const GITHUB_REPO_URL = 'https://github.com/chaitanyagiri/munder-difflin';++export function SettingsHeroCard() {+ const [version, setVersion] = useState<string | null>(null);+ // Starts on the compiled-in defaults, so there is no empty frame or spinner+ // while the fetch is in flight — it just fills in if anything changed.+ const [hero, setHero] = useState<HeroPayload>(DEFAULT_HERO);++ useEffect(() => {+ let alive = true;+ window.cth.appInfo()+ .then((i) => { if (alive) setVersion(i.version); })+ .catch(() => { /* the card is still useful without it */ });+ window.cth.heroPayload()+ .then((r) => { if (alive) setHero(r.hero); })+ .catch(() => { /* defaults already rendered */ });+ return () => { alive = false; };+ }, []);++ const PLAN = hero.plan;+ const SPONSOR = hero.sponsor;++ /** Re-show the release notes. UpdateToast owns that surface — it holds the+ * last status and the drop renderer — so this asks rather than duplicating+ * it, via the same CustomEvent convention App uses for opening Settings. */+ const showReleaseNotes = () => {+ window.dispatchEvent(new CustomEvent('cth:show-release-notes'));+ };++ return (+ <div style={{+ display: 'flex', flexDirection: 'column', gap: 14,+ padding: 16,+ background: 'var(--cth-cream-100)',+ boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)'+ }}>+ {/* Identity */}+ <div style={{ display: 'flex', alignItems: 'flex-start', gap: 12, flexWrap: 'wrap' }}>+ <div style={{ flex: 1, minWidth: 200 }}>+ <div style={{ display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' }}>+ <span style={{+ fontFamily: 'var(--cth-font-display)', fontSize: 13, lineHeight: '20px',+ color: 'var(--cth-ink-900)'+ }}>MUNDER DIFFLIN</span>+ {version && (+ <span style={{+ fontFamily: 'var(--cth-font-mono, monospace)', fontSize: 12,+ color: 'var(--cth-ink-500)'+ }}>v{version}</span>+ )}+ <span style={{+ fontFamily: 'var(--cth-font-display)', fontSize: 9, letterSpacing: 0.5,+ textTransform: 'uppercase', padding: '2px 7px',+ background: 'var(--cth-mint-light)',+ boxShadow: 'inset 0 0 0 1px var(--cth-mint)',+ color: 'var(--cth-ink-900)'+ }}>{PLAN.label}</span>+ </div>+ <div style={{+ marginTop: 6, fontSize: 12.5, lineHeight: 1.5, color: 'var(--cth-ink-700)', maxWidth: '58ch'+ }}>{PLAN.blurb}</div>+ </div>++ {PLAN.upgrade && (+ <PixelButton+ variant="primary"+ size="sm"+ onClick={() => void window.cth.openExternal(PLAN.upgrade!.url)}+ >{PLAN.upgrade.label}</PixelButton>+ )}+ </div>++ {/* A one-line notice (an incident, a migration heads-up), when set. */}+ {hero.notice && (+ <div style={{+ padding: '8px 10px', fontSize: 12, lineHeight: 1.5,+ color: 'var(--cth-ink-900)',+ background: 'var(--cth-lemon-light)',+ boxShadow: 'inset 0 0 0 1px var(--cth-lemon)'+ }}>{hero.notice}</div>+ )}++ {/* Sponsor — only when there is one. */}+ {SPONSOR && (+ <div style={{+ display: 'flex', alignItems: 'center', gap: 10, flexWrap: 'wrap',+ padding: 10,+ background: 'var(--cth-paper-100)',+ boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)'+ }}>+ <span style={{+ fontFamily: 'var(--cth-font-display)', fontSize: 9, letterSpacing: 0.5,+ textTransform: 'uppercase', color: 'var(--cth-ink-500)', flexShrink: 0+ }}>Sponsored by</span>+ <span style={{ fontSize: 13, color: 'var(--cth-ink-900)', flexShrink: 0 }}>{SPONSOR.name}</span>+ <span style={{ flex: 1, minWidth: 120, fontSize: 12, color: 'var(--cth-ink-700)' }}>{SPONSOR.blurb}</span>+ <PixelButton variant="ghost" size="sm" onClick={() => void window.cth.openExternal(SPONSOR.url)}>+ visit+ </PixelButton>+ </div>+ )}++ {/* Actions that belong to the app rather than to any setting below. */}+ <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap', alignItems: 'center' }}>+ <PixelButton variant="secondary" size="sm" onClick={showReleaseNotes}>+ <span title="Show the release notes for the update you were last told about"+ style={{ display: 'inline-flex', alignItems: 'center', gap: 4 }}>+ <Icon name="sparkle" /> what’s new+ </span>+ </PixelButton>+ <PixelButton variant="secondary" size="sm" onClick={() => void window.cth.openExternal(GITHUB_REPO_URL)}>+ <span style={{ display: 'inline-flex', alignItems: 'center', gap: 4 }}>+ ⭐ star on GitHub+ </span>+ </PixelButton>+ <PixelButton+ variant="ghost"+ size="sm"+ onClick={() => void window.cth.openExternal(`${GITHUB_REPO_URL}/issues/new`)}+ >report a problem</PixelButton>+ <span style={{ flex: 1 }} />+ <a+ href={`${GITHUB_REPO_URL}/blob/main/CHANGELOG.md`}+ onClick={(e) => { e.preventDefault(); void window.cth.openExternal(`${GITHUB_REPO_URL}/blob/main/CHANGELOG.md`); }}+ style={{ fontSize: 12, color: 'var(--cth-ink-500)' }}+ >full changelog →</a>+ </div>+ </div>+ );+}diff --git a/src/renderer/src/components/SettingsModal.tsx b/src/renderer/src/components/SettingsModal.tsxindex 4973fd73..aa82659e 100644--- a/src/renderer/src/components/SettingsModal.tsx+++ b/src/renderer/src/components/SettingsModal.tsx@@ -13,6 +13,8 @@ import {import { PixelPanel } from './PixelPanel';import { PixelButton } from './PixelButton';import { UpdatesSection } from './UpdatesSection';+import { SettingsHeroCard } from './SettingsHeroCard';+import { SetupPanel } from './SetupPanel';import { Icon } from './Icon';import { OfficeThemePicker } from './OfficeThemePicker';import { McpDefaultsSettings } from './McpDefaultsSettings';@@ -154,8 +156,8 @@ function clearLocalState(): void {// v0.3.4 redesign: six tabs, one topic each. 'AI Engines' folded into// Agents & Models; MCP + Slack + webhook + REST live together in Connections;// voice gets its own tab; Danger Zone became a red row at the bottom of General.-export type Section = 'General' | 'Agents & Models' | 'Autonomy & Budgets' | 'Connections' | 'Voice' | 'Memory & Knowledge';-const NAV_SECTIONS: Section[] = ['General', 'Agents & Models', 'Autonomy & Budgets', 'Connections', 'Voice', 'Memory & Knowledge'];+export type Section = 'General' | 'Prerequisites' | 'Agents & Models' | 'Autonomy & Budgets' | 'Connections' | 'Voice' | 'Memory & Knowledge';+const NAV_SECTIONS: Section[] = ['General', 'Prerequisites', 'Agents & Models', 'Autonomy & Budgets', 'Connections', 'Voice', 'Memory & Knowledge'];export function SettingsModal({ config, onClose, initialSection }: SettingsModalProps) {const [confirming, setConfirming] = useState(false);@@ -867,10 +869,18 @@ export function SettingsModal({ config, onClose, initialSection }: SettingsModal{/* GENERAL */}{activeSection === 'General' && (<>- {/* Updates — first, because "am I on the latest?" is the- question people open Settings to answer, and the- toolbar chip says nothing at all when the answer is- yes. */}+ {/* Who you are and what this install is — version, plan,+ sponsor, and the app-level actions that belong to none+ of the settings below. Slots for a future subscription+ and a sponsor live here; both render nothing until set. */}+ <SettingsHeroCard />++ <div style={{ height: 1, background: 'var(--cth-ink-300)' }} />++ {/* Updates — first among the settings proper, because "am I+ on the latest?" is the question people open Settings to+ answer, and the toolbar chip says nothing at all when+ the answer is yes. */}<UpdatesSection /><div style={{ height: 1, background: 'var(--cth-ink-300)' }} />@@ -1032,6 +1042,12 @@ export function SettingsModal({ config, onClose, initialSection }: SettingsModal)}{/* AGENTS & MODELS — what powers the office */}+ {/* PREREQUISITES — the external tools the app leans on and+ whether this machine has them. It was a Command Center tab,+ which was the wrong home: it is machine-wide state, not+ something about the agent whose terminal you are reading. */}+ {activeSection === 'Prerequisites' && <SetupPanel onDone={onClose} />}+{activeSection === 'Agents & Models' && (<><div>diff --git a/src/renderer/src/components/SetupPanel.tsx b/src/renderer/src/components/SetupPanel.tsxnew file mode 100644index 00000000..c7b3c8f7--- /dev/null+++ b/src/renderer/src/components/SetupPanel.tsx@@ -0,0 +1,205 @@+/**+ * PREREQUISITES — the external tools this app needs, and whether you have them.+ *+ * Several of the harness's best features are thin wrappers over tools that live+ * OUTSIDE the app bundle: mempalace for semantic memory, uv to install it, git+ * for worktrees, one CLI per agent engine. Every one of them degrades silently+ * when missing — which is the right runtime behaviour and a terrible diagnostic+ * one, because "off" and "broken" look identical from the floor. This page is the+ * single place that distinguishes them, and the only place that says what each+ * tool actually buys you.+ *+ * The primary action delegates rather than executes: installing software touches+ * the user's machine and can need a password, so the button SEEDS Michael's+ * dispatch box with an exact, verified-by-him contract instead of shelling out+ * from the renderer. The user still presses dispatch. That keeps a real+ * confirmation step in front of anything that writes outside the app.+ */+import { useCallback, useEffect, useMemo, useState } from 'react';+import { PixelButton } from './PixelButton';+import { Icon } from './Icon';+import { useStore } from '@/store/store';+import { setupPrompt, type ToolStatus, type ToolKind } from '../../../shared/toolCatalog';++const SECTIONS: { kind: ToolKind; title: string; blurb: string }[] = [+ { kind: 'prerequisite', title: 'Prerequisites', blurb: 'The groundwork everything else builds on.' },+ { kind: 'memory', title: 'Memory layer', blurb: 'Meaning-based recall across everything your agents learn.' },+ { kind: 'engine', title: 'Agent engines', blurb: 'The CLIs your agents run on. You need whichever ones you actually use — not all of them.' }+];++function StatusChip({ tool }: { tool: ToolStatus }) {+ const ready = tool.found;+ return (+ <span style={{+ fontFamily: 'var(--cth-font-display)', fontSize: 9, letterSpacing: 0.5,+ padding: '2px 6px', flexShrink: 0, whiteSpace: 'nowrap',+ background: ready ? 'var(--cth-mint-light)' : 'var(--cth-cream-200)',+ boxShadow: `inset 0 0 0 1px ${ready ? 'var(--cth-mint)' : 'var(--cth-ink-300)'}`,+ color: 'var(--cth-ink-900)'+ }}>+ {ready ? 'READY' : tool.essential ? 'MISSING' : 'NOT SET UP'}+ </span>+ );+}++function ToolRow({ tool }: { tool: ToolStatus }) {+ const [copied, setCopied] = useState(false);+ const copy = () => {+ void navigator.clipboard.writeText(tool.installCommand).then(+ () => { setCopied(true); setTimeout(() => setCopied(false), 1200); },+ () => { /* clipboard denied — the text is on screen to select by hand */ }+ );+ };+ return (+ <div style={{+ padding: 10, display: 'flex', flexDirection: 'column', gap: 6,+ background: 'var(--cth-paper-100)', boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)'+ }}>+ <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>+ <span style={{ fontFamily: 'var(--cth-font-display)', fontSize: 11, flex: 1, minWidth: 0 }}>+ {tool.label.toUpperCase()}+ </span>+ {tool.essential && !tool.found && (+ <span style={{ fontSize: 10, color: 'var(--cth-ink-500)', flexShrink: 0 }}>recommended</span>+ )}+ <StatusChip tool={tool} />+ </div>++ <div style={{ fontSize: 12, color: 'var(--cth-ink-700)', lineHeight: 1.5 }}>{tool.why}</div>++ {/* Found: show WHERE, so a "ready" claim is verifiable rather than trusted. */}+ {tool.found && tool.path && (+ <div style={{+ fontFamily: 'var(--cth-font-mono)', fontSize: 11, color: 'var(--cth-ink-500)',+ wordBreak: 'break-all'+ }}>+ {tool.path}{tool.detail ? ` · ${tool.detail}` : ''}+ </div>+ )}++ {/* Missing WITH a scripted install: the exact command, one click to copy. */}+ {!tool.found && tool.installCommand && (+ <div style={{ display: 'flex', gap: 6, alignItems: 'stretch' }}>+ <code style={{+ flex: 1, minWidth: 0, fontFamily: 'var(--cth-font-mono)', fontSize: 11,+ padding: '4px 6px', background: 'var(--cth-cream-100)',+ boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)',+ color: 'var(--cth-ink-900)', overflowX: 'auto', whiteSpace: 'pre'+ }}>{tool.installCommand}</code>+ <button+ onClick={copy}+ style={{+ flexShrink: 0, fontFamily: 'var(--cth-font-ui)', fontSize: 11, padding: '0 8px',+ background: 'var(--cth-cream-200)', boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)',+ border: 'none', cursor: 'pointer', color: 'var(--cth-ink-900)'+ }}+ >{copied ? 'copied' : 'copy'}</button>+ </div>+ )}++ {(tool.note || tool.docsUrl) && (+ <div style={{ fontSize: 11, color: 'var(--cth-ink-500)', display: 'flex', gap: 8, flexWrap: 'wrap' }}>+ {tool.note && <span>{tool.note}</span>}+ {tool.docsUrl && (+ <a+ href={tool.docsUrl}+ onClick={(e) => { e.preventDefault(); void window.cth.openExternal(tool.docsUrl!); }}+ style={{ color: 'var(--cth-ink-700)' }}+ >docs →</a>+ )}+ </div>+ )}+ </div>+ );+}++export function SetupPanel({ onDone }: { onDone?: () => void } = {}) {+ const [tools, setTools] = useState<ToolStatus[] | null>(null);+ const [busy, setBusy] = useState(false);+ const requestDispatchSeed = useStore((s) => s.requestDispatchSeed);+ const requestCommandCenterTab = useStore((s) => s.requestCommandCenterTab);++ const refresh = useCallback(async () => {+ setBusy(true);+ try { setTools(await window.cth.toolsStatus()); }+ catch { setTools([]); }+ finally { setBusy(false); }+ }, []);+ useEffect(() => { void refresh(); }, [refresh]);++ // Only ESSENTIALS are handed to Michael. Installing all eight engine CLIs+ // because they happen to be listed would be a wild overreach of one click.+ const missingEssential = useMemo(+ () => (tools ?? []).filter((t) => !t.found && t.essential),+ [tools]+ );+ const readyCount = (tools ?? []).filter((t) => t.found).length;++ const askMichael = () => {+ if (missingEssential.length === 0) return;+ requestDispatchSeed(setupPrompt(missingEssential));+ requestCommandCenterTab('floor'); // the dispatch box lives on the monitor tab+ // This panel lives in a modal now — leaving it open would hide the very box+ // we just filled in.+ onDone?.();+ };++ return (+ <div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>+ <div style={{ display: 'flex', alignItems: 'flex-start', gap: 8, flexWrap: 'wrap' }}>+ <div style={{ flex: 1, minWidth: 200 }}>+ <div style={{ fontFamily: 'var(--cth-font-display)', fontSize: 12 }}>PREREQUISITES</div>+ <div style={{ fontSize: 12, color: 'var(--cth-ink-500)', marginTop: 2 }}>+ {tools === null+ ? 'Checking what is installed…'+ : `${readyCount} of ${tools.length} ready${missingEssential.length ? ` · ${missingEssential.length} recommended missing` : ''}`}+ </div>+ </div>+ <PixelButton variant="ghost" size="md" onClick={() => void refresh()} disabled={busy}>+ {busy ? 'checking…' : 're-check'}+ </PixelButton>+ </div>++ {/* The headline action. Present but disabled when nothing is missing, so the+ page reads the same either way rather than the button vanishing. */}+ <div style={{+ padding: 10, display: 'flex', gap: 10, alignItems: 'center', flexWrap: 'wrap',+ background: missingEssential.length ? 'var(--cth-lemon-light)' : 'var(--cth-cream-100)',+ boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)'+ }}>+ <div style={{ flex: 1, minWidth: 220, fontSize: 12, color: 'var(--cth-ink-700)', lineHeight: 1.5 }}>+ {missingEssential.length+ ? <>Michael can install the {missingEssential.length} missing recommended {missingEssential.length === 1 ? 'tool' : 'tools'} for you. This fills in his dispatch box — nothing runs until you press dispatch.</>+ : <>Everything recommended is installed. Individual engines above are optional — set up only the ones you use.</>}+ </div>+ <PixelButton+ variant="primary"+ size="md"+ onClick={askMichael}+ disabled={missingEssential.length === 0}+ >+ <span style={{ display: 'inline-flex', gap: 4, alignItems: 'center' }}>+ <Icon name="sparkle" /> ask Michael to set up everything+ </span>+ </PixelButton>+ </div>++ {SECTIONS.map((section) => {+ const rows = (tools ?? []).filter((t) => t.kind === section.kind);+ if (rows.length === 0) return null;+ return (+ <div key={section.kind} style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>+ <div style={{+ fontFamily: 'var(--cth-font-display)', fontSize: 10, letterSpacing: 0.5,+ color: 'var(--cth-ink-500)', textTransform: 'uppercase'+ }}>{section.title}</div>+ <div style={{ fontSize: 11, color: 'var(--cth-ink-500)', marginTop: -2 }}>{section.blurb}</div>+ <div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>+ {rows.map((t) => <ToolRow key={t.id} tool={t} />)}+ </div>+ </div>+ );+ })}+ </div>+ );+}diff --git a/src/renderer/src/components/SkillsTab.tsx b/src/renderer/src/components/SkillsTab.tsxnew file mode 100644index 00000000..a4e4b199--- /dev/null+++ b/src/renderer/src/components/SkillsTab.tsx@@ -0,0 +1,354 @@+/**+ * SKILLS — what the coding agents here can already do, and 1,200 more they could.+ *+ * Two modes behind one toggle rather than two tabs: "installed" answers "why did+ * my agent just do that?", "browse" answers "what else is out there?", and they+ * share the same search box because the user's question is usually just a word.+ *+ * Nothing here installs anything. A skill is instructions that run inside an+ * agent holding the user's tools and keys, so adding one is a decision, not a+ * click — the catalog links out and the user chooses.+ */+import { useCallback, useEffect, useMemo, useState } from 'react';+import { PixelButton } from './PixelButton';+import type { LocalSkill, CatalogSkill } from '../../../preload';++type Mode = 'installed' | 'browse';++const PROVIDER_LABEL: Record<LocalSkill['provider'], string> = {+ claude: 'Claude Code',+ opencode: 'OpenCode',+ codex: 'Codex'+};++function Chip({ text, tone = 'quiet' }: { text: string; tone?: 'quiet' | 'accent' }) {+ return (+ <span style={{+ fontSize: 10, fontFamily: 'var(--cth-font-display)', letterSpacing: 0.4,+ padding: '2px 6px', flexShrink: 0, textTransform: 'uppercase',+ color: 'var(--cth-ink-900)',+ background: tone === 'accent' ? 'var(--cth-mint-light)' : 'var(--cth-cream-200)',+ boxShadow: `inset 0 0 0 1px ${tone === 'accent' ? 'var(--cth-mint)' : 'var(--cth-ink-300)'}`+ }}>{text}</span>+ );+}++export function SkillsTab({ agentCwd }: { agentCwd?: string }) {+ const [mode, setMode] = useState<Mode>('installed');+ const [query, setQuery] = useState('');+ const [local, setLocal] = useState<LocalSkill[] | null>(null);+ const [catalog, setCatalog] = useState<CatalogSkill[] | null>(null);+ const [catalogMeta, setCatalogMeta] = useState<{ stale: boolean; error?: string; fetchedAt: number } | null>(null);+ const [owner, setOwner] = useState<string>('all');+ const [category, setCategory] = useState<string>('all');+ const [busy, setBusy] = useState(false);+ /** Per-row action state, keyed by catalog url / local path. Keeps one row's+ * spinner or error from being mistaken for the whole tab failing. */+ const [action, setAction] = useState<Record<string, { busy?: boolean; error?: string; done?: string }>>({});+ /** Uninstall is destructive, so it is two clicks: the first arms this, the+ * second does it. No modal — the row itself becomes the confirmation. */+ const [confirming, setConfirming] = useState<string | null>(null);++ const loadLocal = useCallback(async () => {+ try { setLocal(await window.cth.skillsLocal(agentCwd)); } catch { setLocal([]); }+ }, [agentCwd]);++ const loadCatalog = useCallback(async (force = false) => {+ setBusy(true);+ try {+ const res = await window.cth.skillsCatalog(force);+ setCatalog(res.skills);+ setCatalogMeta({ stale: res.stale, error: res.error, fetchedAt: res.fetchedAt });+ } catch {+ setCatalog([]);+ setCatalogMeta({ stale: true, error: 'could not reach the catalog', fetchedAt: 0 });+ } finally { setBusy(false); }+ }, []);++ useEffect(() => { void loadLocal(); }, [loadLocal]);+ // The catalog is fetched only when the user actually opens Browse — no network+ // call for someone who just wanted to see what is installed.+ useEffect(() => { if (mode === 'browse' && catalog === null) void loadCatalog(); }, [mode, catalog, loadCatalog]);++ const q = query.trim().toLowerCase();++ const shownLocal = useMemo(() => {+ const list = local ?? [];+ if (!q) return list;+ return list.filter((s) =>+ s.name.toLowerCase().includes(q) || s.description.toLowerCase().includes(q));+ }, [local, q]);++ const owners = useMemo(() => {+ const counts = new Map<string, number>();+ for (const s of catalog ?? []) counts.set(s.owner, (counts.get(s.owner) ?? 0) + 1);+ return [...counts.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));+ }, [catalog]);++ const categories = useMemo(() => {+ const counts = new Map<string, number>();+ for (const s of catalog ?? []) counts.set(s.category, (counts.get(s.category) ?? 0) + 1);+ return [...counts.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));+ }, [catalog]);++ const shownCatalog = useMemo(() => {+ let list = catalog ?? [];+ if (owner !== 'all') list = list.filter((s) => s.owner === owner);+ if (category !== 'all') list = list.filter((s) => s.category === category);+ if (q) {+ list = list.filter((s) =>+ s.name.toLowerCase().includes(q) || s.description.toLowerCase().includes(q));+ }+ // Bounded render: 1,200 rows in a DOM list makes the panel janky, and nobody+ // scrolls past a few hundred. The count below always states the real total.+ return list.slice(0, 300);+ }, [catalog, owner, category, q]);++ const totalMatching = useMemo(() => {+ let list = catalog ?? [];+ if (owner !== 'all') list = list.filter((s) => s.owner === owner);+ if (category !== 'all') list = list.filter((s) => s.category === category);+ if (!q) return list.length;+ return list.filter((s) =>+ s.name.toLowerCase().includes(q) || s.description.toLowerCase().includes(q)).length;+ }, [catalog, owner, category, q]);++ const install = async (c: CatalogSkill) => {+ setAction((a) => ({ ...a, [c.url]: { busy: true } }));+ try {+ const res = await window.cth.skillsInstall(c.url, c.name);+ if (res.ok) {+ setAction((a) => ({ ...a, [c.url]: { done: 'Installed' } }));+ void loadLocal(); // the installed pane must reflect it immediately+ } else {+ setAction((a) => ({ ...a, [c.url]: { error: res.error } }));+ }+ } catch (e) {+ setAction((a) => ({ ...a, [c.url]: { error: e instanceof Error ? e.message : 'install failed' } }));+ }+ };++ const uninstall = async (sk: LocalSkill) => {+ setConfirming(null);+ setAction((a) => ({ ...a, [sk.path]: { busy: true } }));+ try {+ const res = await window.cth.skillsUninstall(sk.path);+ if (res.ok) { setAction((a) => { const n = { ...a }; delete n[sk.path]; return n; }); void loadLocal(); }+ else setAction((a) => ({ ...a, [sk.path]: { error: res.error ?? 'could not remove it' } }));+ } catch (e) {+ setAction((a) => ({ ...a, [sk.path]: { error: e instanceof Error ? e.message : 'uninstall failed' } }));+ }+ };++ const actionBtn = (kind: 'primary' | 'quiet' | 'danger'): React.CSSProperties => ({+ padding: '3px 9px 2px', border: 'none', cursor: 'pointer', flexShrink: 0,+ fontFamily: 'var(--cth-font-ui)', fontSize: 11,+ color: 'var(--cth-ink-900)',+ background:+ kind === 'primary' ? 'var(--cth-mint-light)'+ : kind === 'danger' ? 'var(--cth-coral-light)'+ : 'var(--cth-cream-200)',+ boxShadow: `inset 0 0 0 1px ${+ kind === 'primary' ? 'var(--cth-mint)' : kind === 'danger' ? 'var(--cth-coral)' : 'var(--cth-ink-300)'+ }`+ });++ const tabBtn = (m: Mode, label: string): React.CSSProperties => ({+ padding: '4px 10px 3px', border: 'none', cursor: 'pointer',+ fontFamily: 'var(--cth-font-ui)', fontSize: 12,+ background: mode === m ? 'var(--cth-lemon-light)' : 'var(--cth-cream-200)',+ boxShadow: `inset 0 0 0 1px ${mode === m ? 'var(--cth-lemon)' : 'var(--cth-ink-300)'}`,+ color: 'var(--cth-ink-900)'+ });++ return (+ <div style={{ display: 'flex', flexDirection: 'column', minHeight: 0, height: '100%' }}>+ {/* Controls */}+ <div style={{+ flexShrink: 0, display: 'flex', gap: 8, alignItems: 'center', flexWrap: 'wrap',+ padding: 10, borderBottom: '1px solid var(--cth-ink-300)'+ }}>+ <button onClick={() => setMode('installed')} style={tabBtn('installed', 'installed')}>+ installed{local ? ` (${local.length})` : ''}+ </button>+ <button onClick={() => setMode('browse')} style={tabBtn('browse', 'browse')}>+ browse{catalog ? ` (${catalog.length})` : ''}+ </button>+ <input+ value={query}+ onChange={(e) => setQuery(e.target.value)}+ placeholder={mode === 'installed' ? 'Search installed skills…' : 'Search the skills catalog…'}+ style={{+ flex: 1, minWidth: 140, padding: '4px 8px',+ background: 'var(--cth-paper-100)', color: 'var(--cth-ink-900)',+ border: 'none', boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)',+ fontFamily: 'var(--cth-font-ui)', fontSize: 12+ }}+ />+ {mode === 'browse' && (+ <select+ value={category}+ onChange={(e) => setCategory(e.target.value)}+ title="Categories as published by the catalog"+ style={{+ padding: '4px 6px', maxWidth: 210,+ background: 'var(--cth-paper-100)', color: 'var(--cth-ink-900)',+ border: 'none', boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)',+ fontFamily: 'var(--cth-font-ui)', fontSize: 12+ }}+ >+ <option value="all">all categories</option>+ {categories.map(([c, n]) => <option key={c} value={c}>{c} ({n})</option>)}+ </select>+ )}+ {mode === 'browse' && (+ <select+ value={owner}+ onChange={(e) => setOwner(e.target.value)}+ style={{+ padding: '4px 6px', maxWidth: 190,+ background: 'var(--cth-paper-100)', color: 'var(--cth-ink-900)',+ border: 'none', boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)',+ fontFamily: 'var(--cth-font-ui)', fontSize: 12+ }}+ >+ <option value="all">all publishers</option>+ {owners.map(([o, n]) => <option key={o} value={o}>{o} ({n})</option>)}+ </select>+ )}+ <PixelButton+ variant="ghost"+ size="sm"+ onClick={() => (mode === 'installed' ? void loadLocal() : void loadCatalog(true))}+ disabled={busy}+ >{busy ? 'loading…' : 'refresh'}</PixelButton>+ </div>++ {/* Body */}+ <div style={{ flex: 1, minHeight: 0, overflowY: 'auto', padding: 10 }}>+ {mode === 'installed' ? (+ local === null ? <Muted>Scanning…</Muted>+ : shownLocal.length === 0 ? (+ <Muted>+ {local.length === 0+ ? 'No skills installed yet. Open Browse to see what is available.'+ : 'Nothing matches that search.'}+ </Muted>+ ) : (+ <div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>+ {shownLocal.map((s) => (+ <div key={s.id + s.path} style={rowStyle}>+ <div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>+ <span style={{ fontFamily: 'var(--cth-font-display)', fontSize: 11, flex: 1, minWidth: 0 }}>+ {s.name.toUpperCase()}+ </span>+ <Chip text={PROVIDER_LABEL[s.provider]} />+ <Chip text={s.scope} tone={s.scope === 'project' ? 'accent' : 'quiet'} />+ </div>+ {s.description && (+ <div style={{ fontSize: 12, color: 'var(--cth-ink-700)', lineHeight: 1.45 }}>+ {s.description.length > 220 ? `${s.description.slice(0, 220)}…` : s.description}+ </div>+ )}+ <div style={{+ fontFamily: 'var(--cth-font-mono)', fontSize: 10.5,+ color: 'var(--cth-ink-500)', wordBreak: 'break-all'+ }}>{s.path}</div>+ <div style={{ display: 'flex', gap: 6, alignItems: 'center', flexWrap: 'wrap' }}>+ <button onClick={() => void window.cth.skillsReveal(s.path)} style={actionBtn('quiet')}>+ open folder+ </button>+ {s.scope === 'bundled' ? (+ // Bundled skills ship inside the app and are re-copied into+ // every agent on spawn, so "removing" one would silently come+ // back. Say that instead of offering a button that lies.+ <span style={{ fontSize: 11, color: 'var(--cth-ink-500)' }}>+ ships with the app+ </span>+ ) : confirming === s.path ? (+ <>+ <button onClick={() => void uninstall(s)} style={actionBtn('danger')}>+ delete {s.name}?+ </button>+ <button onClick={() => setConfirming(null)} style={actionBtn('quiet')}>cancel</button>+ </>+ ) : (+ <button+ onClick={() => setConfirming(s.path)}+ disabled={action[s.path]?.busy}+ style={actionBtn('quiet')}+ >{action[s.path]?.busy ? 'removing…' : 'uninstall'}</button>+ )}+ {action[s.path]?.error && (+ <span style={{ fontSize: 11, color: 'var(--cth-coral)' }}>{action[s.path]?.error}</span>+ )}+ </div>+ </div>+ ))}+ </div>+ )+ ) : catalog === null ? <Muted>Loading the catalog…</Muted>+ : (+ <>+ {catalogMeta?.error && (+ <div style={{+ marginBottom: 8, padding: 8, fontSize: 12, color: 'var(--cth-ink-900)',+ background: 'var(--cth-coral-light)', boxShadow: 'inset 0 0 0 1px var(--cth-coral)'+ }}>+ Showing a cached copy — {catalogMeta.error}.+ </div>+ )}+ <div style={{ fontSize: 11, color: 'var(--cth-ink-500)', marginBottom: 8 }}>+ {totalMatching} matching{totalMatching > shownCatalog.length ? ` · showing the first ${shownCatalog.length}` : ''}+ {' · '}curated by abubakarsiddik31/claude-skills-collection+ </div>+ <div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>+ {shownCatalog.map((s) => (+ <div key={s.url + s.name} style={rowStyle}>+ <div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>+ <span style={{ fontFamily: 'var(--cth-font-display)', fontSize: 11, flex: 1, minWidth: 0 }}>+ {s.name.toUpperCase()}+ </span>+ <Chip text={s.category} />+ <Chip text={s.owner} />+ </div>+ <div style={{ fontSize: 12, color: 'var(--cth-ink-700)', lineHeight: 1.45 }}>+ {s.description}+ </div>+ <div style={{ display: 'flex', gap: 6, alignItems: 'center', flexWrap: 'wrap' }}>+ <button+ onClick={() => void install(s)}+ disabled={!!action[s.url]?.busy || !!action[s.url]?.done}+ style={actionBtn(action[s.url]?.done ? 'quiet' : 'primary')}+ >+ {action[s.url]?.busy ? 'installing…' : action[s.url]?.done ?? 'install'}+ </button>+ <button+ onClick={() => void window.cth.openExternal(s.url)}+ style={actionBtn('quiet')}+ >learn more</button>+ {action[s.url]?.error && (+ <span style={{ fontSize: 11, color: 'var(--cth-coral)', flex: 1, minWidth: 0 }}>+ {action[s.url]?.error}+ </span>+ )}+ </div>+ </div>+ ))}+ </div>+ </>+ )}+ </div>+ </div>+ );+}++const rowStyle: React.CSSProperties = {+ display: 'flex', flexDirection: 'column', gap: 5, padding: 10,+ background: 'var(--cth-paper-100)', boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)',+ color: 'var(--cth-ink-900)'+};++function Muted({ children }: { children: React.ReactNode }) {+ return <div style={{ fontSize: 12, color: 'var(--cth-ink-500)', padding: 6 }}>{children}</div>;+}diff --git a/src/renderer/src/components/UpdateToast.tsx b/src/renderer/src/components/UpdateToast.tsxindex b19d3c6e..821d6481 100644--- a/src/renderer/src/components/UpdateToast.tsx+++ b/src/renderer/src/components/UpdateToast.tsx@@ -37,6 +37,8 @@import { useEffect, useMemo, useState } from 'react';import { Icon } from '@/components/Icon';import { summarizeReleaseNotes } from '@shared/releaseNotes';+import { extractDropHtml } from '@shared/releaseDrop';+import { ReleaseDrop } from '@/components/ReleaseDrop';import type { UpdateStatus } from '@shared/updateState';/** The toast is the LOUD half — it only interrupts for the two states a user has@@ -95,11 +97,41 @@ export function UpdateToast() {if (t) setStatus(t);}), []);+ // Settings' hero card asks to re-open the release notes. This surface owns the+ // last status and the drop renderer, so it answers rather than duplicating+ // either. `updateCurrent()` is used instead of the remembered state because+ // "later" clears the local copy while main still holds it — dismissing a+ // release must not make it unreadable afterwards. With genuinely nothing to+ // show (a dev build, or an install already on the newest release) the honest+ // answer is the releases page, not an empty modal.+ useEffect(() => {+ const onShow = async () => {+ try {+ const cur = await window.cth.updateCurrent();+ const t = toastable(cur);+ if (t) { setStatus(t); return; }+ } catch { /* fall through to the page */ }+ void window.cth.updateOpenRelease();+ };+ window.addEventListener('cth:show-release-notes', onShow);+ return () => window.removeEventListener('cth:show-release-notes', onShow);+ }, []);+const notes = useMemo(() => summarizeReleaseNotes(status?.notes), [status?.notes]);+ /** An authored <!-- drop --> block in the release body upgrades this whole+ * moment from a corner toast to a centered release page. Absent (every+ * release published so far), everything below behaves exactly as before —+ * the digest path stays the default, not a fallback nobody exercises. */+ const dropHtml = useMemo(() => extractDropHtml(status?.notes), [status?.notes]);const version = status?.version ?? null;// Shown = spent. Not "clicked" — an ask the user read and ignored is an// answer too, and asking again next release is exactly what rule 3 forbids.- const showStar = starAsk && notes.length > 0 && (starSpentOn === null || starSpentOn === version);+ // `notes.length > 0` was standing in for "this toast has something to show".+ // A drop-only release body digests to zero bullets while being the richest+ // release page we ship, so it has to count too — otherwise the star ask+ // silently disappears on exactly the releases most worth starring.+ const showStar = starAsk && (notes.length > 0 || !!dropHtml)+ && (starSpentOn === null || starSpentOn === version);useEffect(() => {if (showStar && version && starSpentOn === null) {setStarSpentOn(version);@@ -123,6 +155,25 @@ export function UpdateToast() {void window.cth.updateOpenRelease(status.state === 'available-manual' ? status.url : undefined);};+ // An authored release: hand the whole moment to the centered drop instead of+ // the corner toast. Every action it can take is passed in from here, so the+ // sandboxed frame never needs (and never gets) a route back into the app.+ if (dropHtml && version) {+ return (+ <ReleaseDrop+ version={version}+ html={dropHtml}+ canRestart={status.state === 'downloaded'}+ busy={busy}+ showStar={showStar}+ onRestart={() => void restart()}+ onOpenRelease={openRelease}+ onStar={() => void window.cth.openExternal(GITHUB_REPO_URL)}+ onDismiss={() => setStatus(null)}+ />+ );+ }+const buttonStyle: React.CSSProperties = {padding: '3px 10px 1px',background: 'var(--cth-mint-light, #d0f0e0)',diff --git a/src/renderer/src/store/config.ts b/src/renderer/src/store/config.tsindex 875a8e74..a019f7a4 100644--- a/src/renderer/src/store/config.ts+++ b/src/renderer/src/store/config.ts@@ -223,7 +223,13 @@ export const QWEN_MODELS: ModelOption[] = [* field stays editable; `opencode models` / models.dev is the source of truth).* // TODO-verify exact live slugs (humanQA — they drift). */export const OPENCODE_MODELS: ModelOption[] = [- { id: undefined, label: 'default' },+ // "CLI default", not "default" — the distinction ANTIGRAVITY_MODELS already+ // draws: pass NO --model and run whatever OpenCode itself is configured and+ // authenticated for. That is not the harness's own default model, and calling+ // both "default" is what made the two impossible to tell apart. This is now the+ // PRESELECTED entry for OpenCode, because a BYOK slug the user holds no key for+ // fails silently — see the recommendedOrchestratorModel note in agentProvider.ts.+ { id: undefined, label: 'CLI default' },{ id: 'anthropic/claude-sonnet-4-5', label: 'Claude Sonnet 4.5 (Anthropic)' },{ id: 'anthropic/claude-haiku-4-5', label: 'Claude Haiku 4.5 (Anthropic)' },{ id: 'openai/gpt-5', label: 'GPT-5 (OpenAI)' },diff --git a/src/shared/agentProvider.ts b/src/shared/agentProvider.tsindex 5d748e1d..75f65b2c 100644--- a/src/shared/agentProvider.ts+++ b/src/shared/agentProvider.ts@@ -347,7 +347,19 @@ export const AGENT_PROVIDER_PRESETS: AgentProviderPreset[] = [// inbox-wake nudge (useHive.ts) is the guaranteed fallback so a god still drains.canReceiveInbox: true,initialPromptFlag: '--prompt', // opencode --prompt "<orchestrator/worker brief>"- recommendedOrchestratorModel: 'anthropic/claude-sonnet-4-5', // OpenCode's own default; user may pick opus+ // NO recommended model — deliberately. This used to preselect+ // `anthropic/claude-sonnet-4-5` under the comment "OpenCode's own default",+ // which was wrong on both halves: it is not OpenCode's default, and it is a+ // BYOK slug that resolves only for a user who has authenticated Anthropic+ // inside OpenCode. Without that key OpenCode SILENTLY falls back to whatever+ // it can reach (observed live on Windows: "DeepSeek V4 Flash Free" via+ // OpenCode Zen) while every surface in this app went on reporting Claude+ // Sonnet 4.5 — the picker said one model, the agent ran another, and nothing+ // flagged the divergence. Undefined means buildSpawnCommand emits no+ // `--model` at all, so OpenCode uses the model the user actually configured;+ // every BYOK slug in OPENCODE_MODELS stays one click away for whoever has+ // the key.+ recommendedOrchestratorModel: undefined,// Capturing the TUI session id for resume is unverified; spawn fresh on respawn// (protocol re-injected as the initial prompt), matching codex.resumeFlag: undefined,diff --git a/src/shared/heroPayload.ts b/src/shared/heroPayload.tsnew file mode 100644index 00000000..f9c106ca--- /dev/null+++ b/src/shared/heroPayload.ts@@ -0,0 +1,109 @@+/**+ * The Settings hero card's remote payload.+ *+ * Lives as JSON in this repo and is fetched at runtime, so plan copy and+ * sponsors can change without shipping a build. It is DATA, never markup — that+ * distinction is the whole security story here:+ *+ * - every field is rendered by React as a text node, so it is escaped; there is+ * no `dangerouslySetInnerHTML` anywhere on this path and adding one would+ * turn a config file into a script-injection surface;+ * - URLs are validated to https and opened through the existing `openExternal`+ * bridge, which independently refuses anything that is not https;+ * - strings are LENGTH-CAPPED, because the failure mode of unbounded remote+ * text is not a security hole but a wrecked layout in a dialog the user+ * cannot then use;+ * - unknown fields are ignored and a malformed payload falls back to the baked+ * defaults, so a bad edit degrades to "looks like it always did" rather than+ * to an empty or broken card.+ *+ * The parse is deliberately total: `parseHeroPayload` never throws and always+ * returns something renderable.+ */++export interface HeroPlan {+ label: string;+ blurb: string;+ /** Rendered as a button only when present AND https. */+ upgrade?: { label: string; url: string };+}++export interface HeroSponsor {+ name: string;+ blurb: string;+ url: string;+}++export interface HeroPayload {+ plan: HeroPlan;+ /** Null renders nothing — never a "your logo here" placeholder. */+ sponsor: HeroSponsor | null;+ /** Optional one-line notice (an incident, a migration heads-up). */+ notice: string | null;+}++/** What ships in the binary. Also the fallback whenever the fetch or the parse+ * fails, so the card is never empty and never waits on the network to render. */+export const DEFAULT_HERO: HeroPayload = {+ plan: {+ label: 'Local',+ blurb: 'Every agent runs on your machine, in your folders, under your own keys. No seat limit, nothing metered.'+ },+ sponsor: null,+ notice: null+};++const MAX = { label: 24, blurb: 240, name: 48, notice: 160, url: 300 };++function str(v: unknown, cap: number): string | null {+ if (typeof v !== 'string') return null;+ const t = v.trim();+ if (!t) return null;+ return t.length > cap ? `${t.slice(0, cap - 1)}…` : t;+}++/** https only. `openExternal` enforces this again at the bridge; doing it here+ * too means a bad URL never even renders as a clickable affordance. */+function httpsUrl(v: unknown): string | null {+ const s = str(v, MAX.url);+ if (!s) return null;+ try {+ const u = new URL(s);+ return u.protocol === 'https:' ? u.toString() : null;+ } catch { return null; }+}++/**+ * Turn whatever came off the network into a renderable payload. Any field that+ * fails validation is dropped back to its default rather than failing the whole+ * card — a broken sponsor entry should not cost the user their plan line.+ */+export function parseHeroPayload(raw: unknown): HeroPayload {+ if (!raw || typeof raw !== 'object') return DEFAULT_HERO;+ const o = raw as Record<string, unknown>;++ const planIn = (o.plan && typeof o.plan === 'object' ? o.plan : {}) as Record<string, unknown>;+ const plan: HeroPlan = {+ label: str(planIn.label, MAX.label) ?? DEFAULT_HERO.plan.label,+ blurb: str(planIn.blurb, MAX.blurb) ?? DEFAULT_HERO.plan.blurb+ };+ const upIn = (planIn.upgrade && typeof planIn.upgrade === 'object' ? planIn.upgrade : null) as Record<string, unknown> | null;+ if (upIn) {+ const label = str(upIn.label, MAX.label);+ const url = httpsUrl(upIn.url);+ // Both or neither: a button with no destination is worse than no button.+ if (label && url) plan.upgrade = { label, url };+ }++ let sponsor: HeroSponsor | null = null;+ const spIn = (o.sponsor && typeof o.sponsor === 'object' ? o.sponsor : null) as Record<string, unknown> | null;+ if (spIn) {+ const name = str(spIn.name, MAX.name);+ const url = httpsUrl(spIn.url);+ if (name && url) {+ sponsor = { name, blurb: str(spIn.blurb, MAX.blurb) ?? '', url };+ }+ }++ return { plan, sponsor, notice: str(o.notice, MAX.notice) };+}diff --git a/src/shared/releaseDrop.ts b/src/shared/releaseDrop.tsnew file mode 100644index 00000000..eb3d3f9d--- /dev/null+++ b/src/shared/releaseDrop.ts@@ -0,0 +1,475 @@+/**+ * RELEASE DROPS — a full-bleed, authored "what's new" moment instead of a corner+ * toast with three clipped bullets.+ *+ * The author writes ordinary HTML inside a marked block in the GitHub release+ * body. Everything between the markers is the drop; the rest of the body stays+ * plain markdown for people reading the release on github.com, who should still+ * get a sensible page. A release with no drop block falls back to the existing+ * digest toast, so this is purely additive — no release has to change.+ *+ * <!-- drop -->+ * <section class="hero"> … any HTML/CSS, <img>, <video> … </section>+ * <!-- /drop -->+ *+ * ── Why this file is paranoid ──────────────────────────────────────────────+ * This renders REMOTE, AUTHOR-CONTROLLED markup inside the app. The renderer it+ * would otherwise land in has `window.cth` bridged onto it — spawnPty,+ * writeFileText, updateConfig. Script execution in that context is not a bug,+ * it is arbitrary code execution on the user's machine with the app's full+ * authority, reachable by anyone who can publish a release (or MITM the fetch).+ *+ * So the drop NEVER runs in the app's renderer. It is handed to an iframe with+ * `sandbox=""` — the maximally restrictive value: no scripts, no same-origin, no+ * forms, no popups, no top-level navigation — and, inside that, a CSP of+ * `default-src 'none'` that re-blocks scripts independently. Two unrelated+ * mechanisms, either sufficient alone. `allow-scripts` must NEVER be added+ * alongside `allow-same-origin`: that pair lets the frame reach out and remove+ * its own sandbox.+ *+ * What still works, which is everything a launch page actually needs: images,+ * video, audio, web fonts, gradients, transforms, keyframe animations, grid.+ * What does not: scripts, forms, and links (there is no way to honour a click+ * without a script bridge) — the modal's own chrome carries the real actions.+ */++const DROP_OPEN = '<!-- drop -->';+const DROP_CLOSE = '<!-- /drop -->';++/**+ * Pull the authored HTML out of a release body, or null when there is none.+ * Deliberately literal: an exact marker pair, first opener to the next closer.+ * Anything unbalanced returns null and the caller falls back to the digest —+ * a half-parsed drop would render as broken markup in front of every user.+ */+export function extractDropHtml(body: string | null | undefined): string | null {+ if (typeof body !== 'string') return null;+ const start = body.indexOf(DROP_OPEN);+ if (start === -1) return null;+ const from = start + DROP_OPEN.length;+ const end = body.indexOf(DROP_CLOSE, from);+ if (end === -1) return null;+ const html = body.slice(from, end).trim();+ return html.length > 0 ? html : null;+}++/**+ * Defence in depth ONLY — the sandbox and the CSP are the real controls.+ *+ * This exists because a CSP typo or a future `allow-scripts` would otherwise be+ * a single point of failure, not because a regex is a competent HTML sanitizer:+ * it is not, and nothing here should ever be relied on as one. It removes the+ * two shapes that would be most damaging if the primary controls ever lapsed.+ */+function stripActiveContent(html: string): string {+ return html+ .replace(/<script\b[\s\S]*?<\/script\s*>/gi, '')+ .replace(/<script\b[^>]*\/?>/gi, '')+ // on*= handlers, quoted or bare. Blocked by CSP too (inline handlers are+ // script, and script-src falls back to default-src 'none').+ .replace(/\son[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, '');+}++/** Design tokens mirrored into the frame. The drop cannot read the app's CSS+ * variables across the origin boundary, so the ones worth having are restated+ * here — an author writing `var(--ink)` gets the app's palette for free, while+ * a fully bespoke drop can ignore them entirely. */+const FRAME_BASE_CSS = `+ :root {+ --paper: #FBFAF8; /* clean off-white — the page, not the app chrome */+ --ink: #14131A;+ --ink-soft: #6C6875;+ --line: rgba(20,19,26,0.10);+ --accent: #1B7F5A;+ --radius: 16px;+ --pad: clamp(28px, 5.2vw, 60px);+ --font-ui: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;+ }+ * { box-sizing: border-box; }+ html, body { margin: 0; padding: 0; }+ body {+ background: var(--paper); color: var(--ink);+ font-family: var(--font-ui);+ font-size: 16px; line-height: 1.55;+ -webkit-font-smoothing: antialiased;+ /* The frame owns scrolling: the modal chrome around it stays put while a+ tall drop scrolls, which is what makes a long launch page workable in a+ fixed-height dialog. */+ overflow-x: hidden;+ }++ /* The default layout. An author who writes nothing but semantic HTML — an+ eyebrow, an h1, a lede, a <ul class="features"> — gets the designed result+ without writing a line of CSS. Everything here is overridable. */+ .drop { padding: var(--pad); max-width: 780px; margin: 0 auto; }++ .eyebrow {+ font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;+ color: var(--accent); margin: 0 0 14px;+ }+ h1 {+ font-size: clamp(2rem, 5.2vw, 3.1rem); line-height: 1.04;+ letter-spacing: -0.033em; font-weight: 680; margin: 0 0 .35em;+ text-wrap: balance;+ }+ h2 {+ font-size: clamp(1.15rem, 2.4vw, 1.45rem); line-height: 1.2;+ letter-spacing: -0.018em; font-weight: 650; margin: 0 0 .3em;+ }+ .lede {+ font-size: clamp(1rem, 1.9vw, 1.2rem); line-height: 1.5;+ color: var(--ink-soft); max-width: 54ch; margin: 0 0 2.2em;+ text-wrap: pretty;+ }+ p { margin: 0 0 1em; }+ a { color: var(--accent); }+ hr { border: none; border-top: 1px solid var(--line); margin: 2.4em 0; }++ /* Feature list — stacked rows, each with its own media block. */+ ul.features { list-style: none; padding: 0; margin: 0; display: grid; gap: clamp(30px, 5vw, 52px); }+ ul.features > li { display: grid; gap: 16px; }+ ul.features p { color: var(--ink-soft); margin: 0; max-width: 58ch; }++ /* Media. Images, video and the placeholder all share one silhouette so a drop+ built with placeholders looks identical once real assets land. */+ img, video, canvas, svg, .placeholder {+ display: block; width: 100%; max-width: 100%; height: auto;+ border-radius: var(--radius); border: 1px solid var(--line);+ }+ figure { margin: 0; }+ figcaption { font-size: 13px; color: var(--ink-soft); margin-top: 10px; }++ /* Drop-in placeholder: <div class="placeholder" data-label="Hero"></div>+ Pure CSS, so it needs no asset and cannot 404 in front of a user. */+ .placeholder {+ aspect-ratio: 16 / 9;+ display: flex; align-items: center; justify-content: center;+ background:+ repeating-linear-gradient(135deg,+ rgba(20,19,26,0.035) 0 10px, rgba(20,19,26,0.055) 10px 20px);+ color: var(--ink-soft); font-size: 13px; letter-spacing: .04em;+ }+ .placeholder::after { content: attr(data-label); }+ .placeholder.square { aspect-ratio: 1 / 1; }+ .placeholder.wide { aspect-ratio: 21 / 9; }++ /* Deliberately NOT theme-aware. A drop is an authored artifact — a launch page,+ not app chrome — and it must look the same for everyone who receives it. An+ automatic dark inversion silently recolours a design the author never saw and+ wrecks any image chosen against a light ground. A drop that WANTS dark styles+ it explicitly. */+ @media (prefers-reduced-motion: reduce) {+ * { animation-duration: .01ms !important; transition-duration: .01ms !important; }+ }+`;+++/**+ * The v0.4.4 release page — and the reference for what a drop can be.+ *+ * Six pages with working Back/Next, built WITHOUT a line of JavaScript, because+ * the frame runs under `sandbox=""` and nothing in it will ever execute. The deck+ * is radio inputs plus `:checked ~` sibling selectors: a <label for> is a real+ * click target, checking a radio is not scripting, and CSS does the paging.+ * Verified in a real sandboxed iframe, not assumed.+ *+ * The nav is repeated inside each page rather than shared, so each page names its+ * own neighbours and no selector has to compute "current + 1".+ *+ * Every page is sized to FIT the square modal without scrolling — a page that+ * scrolls cuts a sentence in half at the fold, which is what a launch page must+ * never do. That constraint is why the closing note is its own page rather than+ * the tail of the list.+ *+ * Kept as the simulate payload so `updateSimulate({ drop: true })` renders+ * exactly what ships in the release body.+ */+export const DEFAULT_DROP_HTML = `<style>+ html, body { height: 100%; }+ body { overflow: hidden; }+ .stage { height: 100%; }+ .pg { position: absolute; opacity: 0; pointer-events: none; }++ .page { display: none; height: 100%; flex-direction: column;+ padding: clamp(24px, 4vw, 46px); }+ #pg1:checked ~ .stage .p1,+ #pg2:checked ~ .stage .p2,+ #pg3:checked ~ .stage .p3,+ #pg4:checked ~ .stage .p4,+ #pg5:checked ~ .stage .p5,+ #pg6:checked ~ .stage .p6 { display: flex; animation: rise .34s cubic-bezier(.2,.7,.3,1) both; }+ @keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }++ .content { flex: 1; min-height: 0; overflow-y: auto; }+ .center { display: flex; flex-direction: column; justify-content: center; }+ .nav { flex-shrink: 0; display: flex; align-items: center; gap: 12px;+ padding-top: 16px; margin-top: 12px; border-top: 1px solid var(--line); }+ .dots { display: flex; gap: 7px; flex: 1; }+ .dot { width: 7px; height: 7px; border-radius: 999px; background: rgba(20,19,26,.16);+ cursor: pointer; transition: background .2s, transform .2s; }+ .dot:hover { background: rgba(20,19,26,.34); }+ .dot.on { background: var(--accent); transform: scale(1.25); }+ .btn { cursor: pointer; border-radius: 999px; font-size: 13.5px; font-weight: 600;+ padding: 9px 18px; border: 1px solid var(--line); color: var(--ink-soft);+ user-select: none; transition: background .16s, color .16s; }+ .btn:hover { background: rgba(20,19,26,.04); }+ .btn.primary { background: var(--ink); border-color: var(--ink); color: #FBFAF8; }+ .btn.primary:hover { background: #2a2733; }++ .kicker { font-size: 11.5px; font-weight: 700; letter-spacing: .14em;+ text-transform: uppercase; color: var(--accent); margin: 0 0 14px; }+ h1 { font-size: clamp(1.8rem, 4.4vw, 2.7rem); }+ .lede { margin-bottom: 1.4em; }+ .big { font-size: clamp(3.2rem, 10vw, 5.4rem); line-height: .92; letter-spacing: -.045em;+ font-weight: 700; margin: 0 0 .1em;+ background: linear-gradient(135deg, #14131A 20%, #1B7F5A 115%);+ -webkit-background-clip: text; background-clip: text; color: transparent; }+ .stat { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 24px;+ padding-top: 18px; border-top: 1px solid var(--line); }+ .stat b { display: block; font-size: 1.5rem; letter-spacing: -.03em; font-weight: 680; }+ .stat span { font-size: 12px; color: var(--ink-soft); }++ .tag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .1em;+ text-transform: uppercase; color: var(--accent);+ background: rgba(27,127,90,.09); padding: 4px 9px; border-radius: 999px; }+ .quote { border-left: 2px solid var(--accent); padding-left: 15px; margin: 18px 0 0;+ color: var(--ink-soft); font-size: 14.5px; }+ .rows { list-style: none; padding: 0; margin: 0; }+ .rows li { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: baseline;+ padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }+ .rows i { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .09em;+ text-transform: uppercase; color: var(--ink-soft); }+ .rows b { font-weight: 620; }+ .rows p { margin: 1px 0 0; color: var(--ink-soft); font-size: 12.5px; }+ .card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }+ .card h2 { margin: 10px 0 .2em; font-size: 1.15rem; }+ .card p { margin: 0; color: var(--ink-soft); font-size: 13.5px; }+ .split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }+ /* 16:10, not 4:3 — the taller ratio pushed the second row past the fold, and a+ drop page that scrolls cuts a sentence in half at the boundary. */+ .split .placeholder { aspect-ratio: 16 / 10; }+</style>++<input class="pg" type="radio" name="pg" id="pg1" checked>+<input class="pg" type="radio" name="pg" id="pg2">+<input class="pg" type="radio" name="pg" id="pg3">+<input class="pg" type="radio" name="pg" id="pg4">+<input class="pg" type="radio" name="pg" id="pg5">+<input class="pg" type="radio" name="pg" id="pg6">++<div class="stage">++ <section class="page p1">+ <div class="content center">+ <p class="kicker">Munder Difflin</p>+ <h1 class="big">0.4.4</h1>+ <p class="lede" style="font-size:clamp(1.05rem,2.1vw,1.3rem);margin-top:.5em">+ The release where Windows finally joined the floor — and the first run+ stopped quietly failing.+ </p>+ <div class="stat">+ <div><b>27</b><span>fixes</span></div>+ <div><b>4</b><span>new surfaces</span></div>+ <div><b>1</b><span>platform unbroken</span></div>+ </div>+ </div>+ <div class="nav">+ <div class="dots">+ <label class="dot on" for="pg1"></label><label class="dot" for="pg2"></label>+ <label class="dot" for="pg3"></label><label class="dot" for="pg4"></label>+ <label class="dot" for="pg5"></label><label class="dot" for="pg6"></label>+ </div>+ <label class="btn primary" for="pg2">Start →</label>+ </div>+ </section>++ <section class="page p2">+ <div class="content">+ <p class="kicker">The headline</p>+ <h1>Agents can talk to each other on Windows.</h1>+ <p class="lede">Roughly half of all downloads run on Windows, where+ agent-to-agent messaging had never worked at all.</p>+ <div class="placeholder" data-label="Two agents messaging" style="aspect-ratio:24/9"></div>+ <p class="quote">Every agent booted, rendered, and looked completely healthy.+ None of them had been told they had an inbox.</p>+ <p style="margin-top:16px;color:var(--ink-soft);font-size:14px">Any CLI that is+ not an .exe was launched through cmd.exe, which cuts a multi-line argument at+ its first newline — taking the protocol block with it. Spawns now launch the+ real interpreter with an argument array, so the whole prompt survives.</p>+ </div>+ <div class="nav">+ <div class="dots">+ <label class="dot" for="pg1"></label><label class="dot on" for="pg2"></label>+ <label class="dot" for="pg3"></label><label class="dot" for="pg4"></label>+ <label class="dot" for="pg5"></label><label class="dot" for="pg6"></label>+ </div>+ <label class="btn" for="pg1">← Back</label>+ <label class="btn primary" for="pg3">Next →</label>+ </div>+ </section>++ <section class="page p3">+ <div class="content">+ <p class="kicker">The first five minutes</p>+ <h1>Setup finishes. The floor wakes up.</h1>+ <p class="lede">Four separate bugs sat on the very first thing a new user does.</p>+ <ul class="rows">+ <li><i>Wizard</i><div><b>The suggested folder works</b>+ <p>Accepting ~/HarnessAgents stored a literal tilde and died on ENOENT.+ It now resolves to a real path — and the field actually suggests it.</p></div></li>+ <li><i>Wizard</i><div><b>It tells you at step one</b>+ <p>An empty folder used to walk you through all four steps before bouncing+ you back. The panel no longer overflows a short screen either.</p></div></li>+ <li><i>Hive</i><div><b>Services start at setup, not next launch</b>+ <p>On a fresh install the message router, hooks and telemetry stayed dead+ until you restarted — so mail never moved and agents never reported.</p></div></li>+ <li><i>Agents</i><div><b>Restart & Continue has something to resume</b>+ <p>The live session id is recorded from a second source, so continuing+ works even when a hook never lands.</p></div></li>+ </ul>+ </div>+ <div class="nav">+ <div class="dots">+ <label class="dot" for="pg1"></label><label class="dot" for="pg2"></label>+ <label class="dot on" for="pg3"></label><label class="dot" for="pg4"></label>+ <label class="dot" for="pg5"></label><label class="dot" for="pg6"></label>+ </div>+ <label class="btn" for="pg2">← Back</label>+ <label class="btn primary" for="pg4">Next →</label>+ </div>+ </section>++ <section class="page p4">+ <div class="content">+ <p class="kicker">New</p>+ <h1>Four things that were not here before.</h1>+ <div class="split">+ <div class="card">+ <span class="tag">Skills</span>+ <h2>Every skill your agents can use</h2>+ <p>What is installed across Claude Code, OpenCode and Codex — and a+ browsable catalog of 227 more, with search, filters, install and+ uninstall.</p>+ </div>+ <div class="card">+ <span class="tag">Prerequisites</span>+ <h2>Whether you actually have the tools</h2>+ <p>MemPalace, uv, git and every agent engine, with live status and where+ each one sits on disk. One button asks Michael to fill in the gaps.</p>+ </div>+ <div class="card">+ <span class="tag">Release drops</span>+ <h2>This page</h2>+ <p>Update notes used to be three clipped bullets in the corner. A release+ can now carry its own designed page, and you are reading the first one.</p>+ </div>+ <div class="card">+ <span class="tag">Dark mode</span>+ <h2>Rebuilt for reading</h2>+ <p>Every control border measured under 2:1 against its background, so the+ edges defining them were invisible. Re-tuned and measured, not eyeballed.</p>+ </div>+ </div>+ <div class="nav">+ <div class="dots">+ <label class="dot" for="pg1"></label><label class="dot" for="pg2"></label>+ <label class="dot" for="pg3"></label><label class="dot on" for="pg4"></label>+ <label class="dot" for="pg5"></label><label class="dot" for="pg6"></label>+ </div>+ <label class="btn" for="pg3">← Back</label>+ <label class="btn primary" for="pg5">Next →</label>+ </div>+ </section>++ <section class="page p5">+ <div class="content">+ <p class="kicker">Everything else</p>+ <h1>The rest of the list.</h1>+ <ul class="rows">+ <li><i>Terminal</i><div><b>Copy comes back clean</b>+ <p>The quote rail is stripped and terminals run in UTF-8, so an em dash+ survives the trip to another app.</p></div></li>+ <li><i>Terminal</i><div><b>Dictation pastes what you just said</b></div></li>+ <li><i>IDE</i><div><b>Images open as images</b>+ <p>PNG, SVG and embedded screenshots render. The title names the agent.</p></div></li>+ <li><i>Agents</i><div><b>Restart & Continue revives a dead agent</b></div></li>+ <li><i>Agents</i><div><b>Grok 4.6 in the model picker</b></div></li>+ <li><i>Agents</i><div><b>OpenCode runs the model you actually have</b></div></li>+ <li><i>Board</i><div><b>Task cards stop going missing</b></div></li>+ <li><i>Hive</i><div><b>A wake nudge survives an odd message id</b></div></li>+ <li><i>Hive</i><div><b>Compact fires once, not every hour</b></div></li>+ <li><i>Hive</i><div><b>The cost ledger is out of your git history</b></div></li>+ <li><i>Office</i><div><b>The floor stops rendering when nobody is looking</b></div></li>+ <li><i>Layout</i><div><b>Michael sits first on the dock again</b></div></li>+ </ul>+ </div>+ <div class="nav">+ <div class="dots">+ <label class="dot" for="pg1"></label><label class="dot" for="pg2"></label>+ <label class="dot" for="pg3"></label><label class="dot" for="pg4"></label>+ <label class="dot on" for="pg5"></label><label class="dot" for="pg6"></label>+ </div>+ <label class="btn" for="pg4">← Back</label>+ <label class="btn primary" for="pg6">Next →</label>+ </div>+ </section>++ <section class="page p6">+ <div class="content center">+ <p class="kicker">One last thing</p>+ <h1 style="font-size:clamp(1.9rem,4.6vw,2.9rem)">Thank you for running this+ on your own machine.</h1>+ <p class="lede" style="margin-top:.4em">Every agent here starts on your+ hardware, in your folders, under your keys. Nothing about that changes.</p>+ <p class="quote">If it has been useful, a star is the entire marketing budget.+ The button is just below this page.</p>+ </div>+ <div class="nav">+ <div class="dots">+ <label class="dot" for="pg1"></label><label class="dot" for="pg2"></label>+ <label class="dot" for="pg3"></label><label class="dot" for="pg4"></label>+ <label class="dot" for="pg5"></label><label class="dot on" for="pg6"></label>+ </div>+ <label class="btn" for="pg5">← Back</label>+ <label class="btn" for="pg1">Start over</label>+ </div>+ </section>++</div>`;++/**+ * Wrap authored HTML into a complete, self-contained document for `srcdoc`.+ *+ * The CSP is the load-bearing line. `default-src 'none'` means an omitted+ * directive denies rather than allows, so script-src, connect-src, frame-src and+ * object-src are all closed without being named. Only the media a launch page+ * needs is opened back up, and only over https or data:.+ */+export function buildDropSrcDoc(html: string): string {+ const csp = [+ "default-src 'none'",+ 'img-src https: data: blob:',+ 'media-src https: data: blob:',+ "style-src 'unsafe-inline' https:",+ 'font-src https: data:'+ // No script-src, no connect-src, no form-action: default-src 'none' denies+ // them. Spelled out here so a future edit has to remove a comment to widen it.+ //+ // The CSP `sandbox` directive is deliberately NOT listed: it is ignored when+ // delivered via <meta> (header-only, per spec), so including it would read as+ // a third control while doing nothing. The iframe's own sandbox attribute is+ // the real one.+ ].join('; ');+ return `<!doctype html>+<html>+<head>+<meta charset="utf-8">+<meta name="viewport" content="width=device-width, initial-scale=1">+<meta http-equiv="Content-Security-Policy" content="${csp}">+<style>${FRAME_BASE_CSS}</style>+</head>+<body>+${stripActiveContent(html)}+</body>+</html>`;+}diff --git a/src/shared/toolCatalog.ts b/src/shared/toolCatalog.tsnew file mode 100644index 00000000..6f1459a2--- /dev/null+++ b/src/shared/toolCatalog.ts@@ -0,0 +1,167 @@+/**+ * The setup catalog — every EXTERNAL tool the harness can use, what it buys the+ * user, and how to install it on this platform.+ *+ * Why this file exists: the app ships as one Electron bundle, but several of its+ * best features are thin wrappers over tools that live outside it — mempalace for+ * semantic memory, uv to install mempalace, git for worktrees, and one CLI per+ * agent engine. Every one of them degrades SILENTLY when absent (that is the+ * deliberate design — `memory.start()` is a documented no-op without mempalace),+ * which is friendly right up until the user cannot tell "off" from "broken" and+ * has no single place that says which is which. This catalog is that place.+ *+ * The engine rows are DERIVED from AGENT_PROVIDER_PRESETS rather than restated+ * here: those presets already carry `defaultCommand`, `installCommand`,+ * `nativeInstallCommand` and `docsUrl`, and a second hand-maintained copy would+ * drift the moment a provider is added.+ */++import { AGENT_PROVIDER_PRESETS } from './agentProvider';++export type ToolKind = 'prerequisite' | 'memory' | 'engine';++export interface ToolSpec {+ /** Stable row id. For a probed binary this is also the name we look up. */+ id: string;+ /** The executable to probe on PATH, or null when presence is derived some+ * other way (mempalace comes from the memory subsystem's own status). */+ bin: string | null;+ label: string;+ kind: ToolKind;+ /** One line, benefit-framed: what the user LOSES without it. */+ why: string;+ /** Part of "set up everything". Everything else is opt-in. */+ essential: boolean;+ /** Install command per platform. Empty string = no scripted install. */+ install: { posix: string; win32: string };+ /** Shown when there is no scripted install, or as extra context. */+ note?: string;+ docsUrl?: string;+}++/** Base rows — the non-engine tools. Engines are appended by `toolCatalog()`. */+const BASE_TOOLS: ToolSpec[] = [+ {+ id: 'uv',+ bin: 'uv',+ label: 'uv',+ kind: 'prerequisite',+ why: 'Installs and runs mempalace. A self-contained Python toolchain — it does not touch any Python you already have.',+ essential: true,+ install: {+ posix: 'curl -LsSf https://astral.sh/uv/install.sh | sh',+ // PowerShell, not cmd.exe: astral ships install.ps1 for Windows and there+ // is no .bat equivalent. Quoted so it survives being pasted into either.+ win32: 'powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"'+ },+ docsUrl: 'https://docs.astral.sh/uv/'+ },+ {+ id: 'mempalace',+ bin: null, // presence comes from MemoryStatus.available, not a PATH probe+ label: 'MemPalace — semantic memory',+ kind: 'memory',+ why: 'Meaning-based recall across everything your agents have learned. Without it they still keep plain markdown notes, but cannot search them by meaning.',+ essential: true,+ install: {+ posix: 'uv tool install mempalace',+ win32: 'uv tool install mempalace'+ },+ note: 'Needs uv first.'+ },+ {+ id: 'git',+ bin: 'git',+ label: 'git',+ kind: 'prerequisite',+ why: "Worktrees let agents work in parallel without fighting over one checkout, and the hive keeps its own history in git.",+ essential: true,+ install: {+ posix: 'xcode-select --install # macOS · or: sudo apt install git',+ win32: 'winget install --id Git.Git -e'+ },+ docsUrl: 'https://git-scm.com/downloads'+ },+ {+ id: 'node',+ bin: 'node',+ label: 'Node.js',+ kind: 'prerequisite',+ why: 'Runs the npm-installed agent engines (OpenCode, and Claude Code on machines without the native build).',+ essential: false,+ // Deliberately no scripted command: the app already ships a checksum-verified+ // Node installer (nodeInstall.ts) that runs automatically when an engine needs+ // one. Printing a rival curl|sh here would compete with it.+ install: { posix: '', win32: '' },+ note: 'The app installs this for you when an engine needs it — nothing to do by hand.',+ docsUrl: 'https://nodejs.org'+ }+];++/**+ * The full catalog for a platform. `platform` is a `process.platform` value; only+ * win32 vs everything-else matters.+ */+export function toolCatalog(): ToolSpec[] {+ const engines: ToolSpec[] = AGENT_PROVIDER_PRESETS+ // `custom` is whatever the user typed — there is nothing to detect or install.+ .filter((p) => p.id !== 'custom' && !!p.defaultCommand)+ .map((p) => ({+ id: `engine:${p.id}`,+ bin: p.defaultCommand,+ label: p.label,+ kind: 'engine' as const,+ why: `Agent engine — ${p.defaultCommand}.`,+ // Claude Code is the recommended engine and the only one the floor assumes+ // by default, so it is the one engine "set up everything" will install.+ essential: p.id === 'claude',+ install: {+ posix: p.installCommand ?? p.nativeInstallCommand?.posix ?? '',+ win32: p.installCommand ?? p.nativeInstallCommand?.win32 ?? ''+ },+ docsUrl: p.docsUrl+ }));+ return [...BASE_TOOLS, ...engines];+}++/** A catalog row plus what we found on THIS machine. */+export interface ToolStatus extends ToolSpec {+ found: boolean;+ /** Absolute path when found, or null. */+ path: string | null;+ /** Extra live context — e.g. "palace initialised", a version string. */+ detail?: string;+ /** `install` already resolved for the running platform. */+ installCommand: string;+}++/**+ * The prompt handed to Michael by "ask Michael to set up everything".+ *+ * Written as an explicit contract rather than a wish: name the exact commands so+ * he does not have to guess or search, tell him to VERIFY rather than assume, and+ * make the ordering dependency (uv before mempalace) explicit — an orchestrator+ * that installs mempalace first just fails and reports failure.+ */+export function setupPrompt(missing: ToolStatus[]): string {+ if (missing.length === 0) return '';+ const lines = missing.map((t) => {+ const cmd = t.installCommand ? `\n install: ${t.installCommand}` : '';+ const note = t.note ? `\n note: ${t.note}` : '';+ return `- ${t.label} (${t.id})${cmd}${note}`;+ });+ return [+ 'Set up my missing local tooling. These are the tools this harness uses that are not installed on this machine:',+ '',+ ...lines,+ '',+ 'For each one: run the install command in your own terminal, then VERIFY it actually resolves',+ '(`which <bin>`, or `where <bin>` on Windows) before moving on — do not assume an installer that',+ 'printed no error succeeded. Install uv BEFORE mempalace; mempalace is installed BY uv and will',+ 'fail outright without it.',+ '',+ 'If a command needs my password or a decision only I can make, stop and ask me rather than',+ 'guessing or working around it. When you are done, report one line per tool: installed, already',+ 'present, or failed with the reason.'+ ].join('\n');+}diff --git a/test/hero-payload.test.cjs b/test/hero-payload.test.cjsnew file mode 100644index 00000000..b2e78032--- /dev/null+++ b/test/hero-payload.test.cjs@@ -0,0 +1,89 @@+'use strict';++/**+ * The hero payload is REMOTE data that renders in Settings. It is fetched from a+ * file in this repo, so the trust level is "whatever is on main" — which is high,+ * but not high enough to render unvalidated, because the failure modes are silent:+ * a typo'd URL becomes a dead button, an unbounded string wrecks the dialog, and+ * a malformed edit could blank the card for every user at once.+ *+ * So the parser is total — it never throws and always returns something+ * renderable — and these pin that.+ */+const test = require('node:test');+const assert = require('node:assert/strict');+const loadTs = require('./load-ts.cjs');+const { parseHeroPayload, DEFAULT_HERO } = loadTs('src/shared/heroPayload.ts');++test('a well-formed payload comes through intact', () => {+ const h = parseHeroPayload({+ plan: { label: 'Pro', blurb: 'Extra things.', upgrade: { label: 'Upgrade', url: 'https://example.com/pro' } },+ sponsor: { name: 'Acme', blurb: 'They paid.', url: 'https://acme.example' },+ notice: 'Scheduled maintenance Friday.'+ });+ assert.equal(h.plan.label, 'Pro');+ assert.deepEqual(h.plan.upgrade, { label: 'Upgrade', url: 'https://example.com/pro' });+ assert.equal(h.sponsor.name, 'Acme');+ assert.equal(h.notice, 'Scheduled maintenance Friday.');+});++test('garbage of every shape degrades to the built-in defaults', () => {+ for (const bad of [null, undefined, 42, 'a string', [], { plan: 'not an object' }]) {+ const h = parseHeroPayload(bad);+ assert.equal(h.plan.label, DEFAULT_HERO.plan.label, `for ${JSON.stringify(bad)}`);+ assert.equal(h.sponsor, null);+ }+});++test('one broken field does not cost the user the rest of the card', () => {+ const h = parseHeroPayload({+ plan: { label: 'Pro', blurb: 'Extra things.' },+ sponsor: { name: 'Acme' } // no url → not renderable+ });+ assert.equal(h.plan.label, 'Pro', 'the plan survives a broken sponsor');+ assert.equal(h.sponsor, null);+});++test('non-https URLs are refused, so a bad link never renders as a button', () => {+ for (const url of ['http://example.com', 'javascript:alert(1)', 'file:///etc/passwd', 'data:text/html,x', 'not a url']) {+ const h = parseHeroPayload({ plan: { label: 'P', blurb: 'b', upgrade: { label: 'Go', url } } });+ assert.equal(h.plan.upgrade, undefined, `must refuse ${url}`);+ const s = parseHeroPayload({ sponsor: { name: 'A', blurb: 'b', url } });+ assert.equal(s.sponsor, null, `must refuse sponsor ${url}`);+ }+});++test('an upgrade needs BOTH a label and a destination', () => {+ assert.equal(parseHeroPayload({ plan: { upgrade: { url: 'https://x.example' } } }).plan.upgrade, undefined);+ assert.equal(parseHeroPayload({ plan: { upgrade: { label: 'Go' } } }).plan.upgrade, undefined);+});++test('overlong strings are capped rather than allowed to wreck the dialog', () => {+ const h = parseHeroPayload({+ plan: { label: 'x'.repeat(500), blurb: 'y'.repeat(5000) },+ notice: 'z'.repeat(5000)+ });+ assert.ok(h.plan.label.length <= 24, `label was ${h.plan.label.length}`);+ assert.ok(h.plan.blurb.length <= 240);+ assert.ok(h.notice.length <= 160);+ assert.ok(h.plan.label.endsWith('…'), 'truncation is visible, not silent');+});++test('empty and whitespace-only strings fall back rather than rendering blank', () => {+ const h = parseHeroPayload({ plan: { label: ' ', blurb: '' }, notice: ' ' });+ assert.equal(h.plan.label, DEFAULT_HERO.plan.label);+ assert.equal(h.plan.blurb, DEFAULT_HERO.plan.blurb);+ assert.equal(h.notice, null);+});++test('unknown fields are ignored, so adding one later cannot break older builds', () => {+ const h = parseHeroPayload({ plan: { label: 'P', blurb: 'b' }, futureThing: { a: 1 }, banner: '<script>' });+ assert.equal(h.plan.label, 'P');+ assert.equal(Object.keys(h).sort().join(','), 'notice,plan,sponsor');+});++test('the shipped docs/hero.json parses to a renderable payload', () => {+ const raw = JSON.parse(require('node:fs').readFileSync('docs/hero.json', 'utf8'));+ const h = parseHeroPayload(raw);+ assert.ok(h.plan.label && h.plan.blurb, 'the file we actually ship must render');+});diff --git a/test/release-drop.test.cjs b/test/release-drop.test.cjsnew file mode 100644index 00000000..fc3cf79f--- /dev/null+++ b/test/release-drop.test.cjs@@ -0,0 +1,91 @@+'use strict';++/**+ * Release drops render REMOTE, AUTHOR-CONTROLLED HTML inside the app. The+ * renderer it would otherwise reach has `window.cth` bridged onto it — spawnPty,+ * writeFileText, updateConfig — so script execution there is arbitrary code+ * execution with the app's authority, available to anyone who can publish a+ * release.+ *+ * The controls are (1) `sandbox=""` on the iframe and (2) `default-src 'none'`+ * in the document's own CSP. This file pins the half that lives in shared code.+ * The sandbox attribute is asserted in ReleaseDrop.tsx and is deliberately NOT+ * the only thing standing between a release body and the user's machine.+ */++const test = require('node:test');+const assert = require('node:assert/strict');+const loadTs = require('./load-ts.cjs');++const { extractDropHtml, buildDropSrcDoc } = loadTs('src/shared/releaseDrop.ts');++const wrap = (inner) => `# Release\n\nblurb\n\n<!-- drop -->\n${inner}\n<!-- /drop -->\n\nfooter`;++test('extracts the authored block and leaves the surrounding markdown behind', () => {+ const html = extractDropHtml(wrap('<h1>Hello</h1>'));+ assert.equal(html, '<h1>Hello</h1>');+});++test('a release body with no drop block returns null (digest path stays default)', () => {+ assert.equal(extractDropHtml('## What\'s new\n\n- a bullet'), null);+ assert.equal(extractDropHtml(''), null);+ assert.equal(extractDropHtml(null), null);+ assert.equal(extractDropHtml(undefined), null);+});++test('an unbalanced marker pair returns null rather than half a document', () => {+ assert.equal(extractDropHtml('intro <!-- drop --> <h1>truncated'), null);+ assert.equal(extractDropHtml('intro <!-- /drop --> trailing'), null);+});++test('an empty drop block is treated as no drop', () => {+ assert.equal(extractDropHtml(wrap(' \n ')), null);+});++test('the CSP denies scripts by omission, not by an allowlist that could widen', () => {+ const doc = buildDropSrcDoc('<h1>hi</h1>');+ // Match the CSP meta specifically — a bare /content="…"/ picks up the+ // viewport tag, which precedes it.+ const csp = /http-equiv="Content-Security-Policy"\s+content="([^"]+)"/.exec(doc);+ assert.ok(csp, 'a CSP meta tag is present');+ const policy = csp[1];+ assert.match(policy, /default-src 'none'/);+ // The point of default-src 'none': an unlisted directive DENIES. If someone+ // ever adds an explicit script-src, this catches it.+ assert.doesNotMatch(policy, /script-src/);+ assert.doesNotMatch(policy, /connect-src/);+ assert.doesNotMatch(policy, /'unsafe-eval'/);+ // Media a launch page genuinely needs, https/data only — never http:.+ assert.match(policy, /img-src https: data: blob:/);+ assert.match(policy, /media-src https: data: blob:/);+ assert.doesNotMatch(policy, /img-src[^;]*\bhttp:/);+});++test('defence in depth: script tags and inline handlers are stripped from the body', () => {+ const doc = buildDropSrcDoc([+ '<h1>Launch</h1>',+ '<script>window.parent.cth.spawnPty({})</script>',+ '<script src="https://evil.example/x.js"></script>',+ '<img src="x.png" onerror="window.parent.cth.writeFileText(\'/tmp/x\',\'y\')">',+ '<div ONCLICK=steal()>click</div>'+ ].join('\n'));+ assert.doesNotMatch(doc, /<script/i);+ assert.doesNotMatch(doc, /onerror/i);+ assert.doesNotMatch(doc, /onclick/i);+ // …while the legitimate content around them survives intact.+ assert.match(doc, /<h1>Launch<\/h1>/);+ assert.match(doc, /<img src="x\.png"/);+});++test('authored markup that merely LOOKS active is preserved', () => {+ // A drop describing the update mechanism shouldn't have its prose mangled.+ const doc = buildDropSrcDoc('<p>We removed the old <code>onclick</code> handler.</p>');+ assert.match(doc, /<code>onclick<\/code>/);+});++test('the document is self-contained and declares its charset before content', () => {+ const doc = buildDropSrcDoc('<h1>é — 🎉</h1>');+ assert.match(doc, /^<!doctype html>/i);+ assert.ok(doc.indexOf('charset') < doc.indexOf('<body'), 'charset precedes the body');+ assert.match(doc, /🎉/);+});diff --git a/test/skills-install.test.cjs b/test/skills-install.test.cjsnew file mode 100644index 00000000..6420140f--- /dev/null+++ b/test/skills-install.test.cjs@@ -0,0 +1,87 @@+'use strict';++/**+ * Install/uninstall guards.+ *+ * These bound real damage. Install writes files the user did not author into a+ * directory their agents load from; uninstall deletes directories. Both are+ * driven by a public list anyone can open a PR against, so the REFUSALS are the+ * feature — each test below is a way the app could have destroyed or executed+ * something it should not have.+ */+const test = require('node:test');+const assert = require('node:assert/strict');+const os = require('node:os');+const fs = require('node:fs');+const path = require('node:path');+const loadTs = require('./load-ts.cjs');++const { parseGitHubSourceUrl, safeSkillDirName, uninstallSkill } =+ loadTs('src/main/skills.ts');++const tmpdir = (t) => {+ const d = fs.mkdtempSync(path.join(os.tmpdir(), 'md-skill-'));+ t.after(() => fs.rmSync(d, { recursive: true, force: true }));+ return d;+};++test('a GitHub tree URL is split into owner/repo/ref/path', () => {+ assert.deepEqual(+ parseGitHubSourceUrl('https://github.com/mongodb/agent-skills/tree/main/skills/mongodb-mcp-setup'),+ { owner: 'mongodb', repo: 'agent-skills', ref: 'main', path: 'skills/mongodb-mcp-setup' }+ );+ assert.equal(parseGitHubSourceUrl('https://officialskills.sh/mongodb/skills/x'), null);+ // A repo ROOT is also a valid source — 81 catalog entries are shaped that way.+ assert.deepEqual(parseGitHubSourceUrl('https://github.com/zarazhangrui/frontend-slides'),+ { owner: 'zarazhangrui', repo: 'frontend-slides', ref: '', path: '' });+ assert.equal(parseGitHubSourceUrl('https://github.com/orgs/anthropics'), null);+});++test('a skill folder name that could escape its directory is refused', () => {+ assert.equal(safeSkillDirName('redis-development'), 'redis-development');+ assert.equal(safeSkillDirName('skills/redis-development'), 'redis-development');+ for (const bad of ['..', '.', '', '.hidden', 'x y', '-leading', 'a b/../c d']) {+ assert.equal(safeSkillDirName(bad), null, 'must refuse ' + JSON.stringify(bad));+ }+ // A traversal reduces to its LAST segment, which is a plain, safe folder name —+ // the caller joins it onto the skills root, so there is nothing left to escape.+ assert.equal(safeSkillDirName('a/../../b'), 'b');+});++test('uninstall refuses anything outside a managed skills root', (t) => {+ const tmp = tmpdir(t);+ const victim = path.join(tmp, 'important-work');+ fs.mkdirSync(victim, { recursive: true });+ const res = uninstallSkill(victim, { cwds: [] });+ assert.equal(res.ok, false);+ assert.match(res.error, /not inside a skills directory/i);+ assert.ok(fs.existsSync(victim), 'the folder must still be there');+});++test('uninstall refuses a folder inside a skills root with no SKILL.md', (t) => {+ const tmp = tmpdir(t);+ const notASkill = path.join(tmp, '.claude', 'skills', 'src');+ fs.mkdirSync(notASkill, { recursive: true });+ fs.writeFileSync(path.join(notASkill, 'index.ts'), 'export {}');+ const res = uninstallSkill(notASkill, { cwds: [tmp] });+ assert.equal(res.ok, false);+ assert.match(res.error, /SKILL/i);+ assert.ok(fs.existsSync(notASkill));+});++test('uninstall removes a real skill folder inside a project root', (t) => {+ const tmp = tmpdir(t);+ const skill = path.join(tmp, '.claude', 'skills', 'demo');+ fs.mkdirSync(skill, { recursive: true });+ fs.writeFileSync(path.join(skill, 'SKILL.md'), '---\nname: demo\n---\n');+ assert.equal(uninstallSkill(skill, { cwds: [tmp] }).ok, true);+ assert.ok(!fs.existsSync(skill));+});++test('uninstall will not delete the skills root itself', (t) => {+ const tmp = tmpdir(t);+ const root = path.join(tmp, '.claude', 'skills');+ fs.mkdirSync(root, { recursive: true });+ assert.equal(uninstallSkill(root, { cwds: [tmp] }).ok, false);+ assert.ok(fs.existsSync(root));+});diff --git a/test/skills.test.cjs b/test/skills.test.cjsnew file mode 100644index 00000000..756c4b06--- /dev/null+++ b/test/skills.test.cjs@@ -0,0 +1,92 @@+'use strict';++/**+ * The skills catalog is parsed out of a hand-maintained README with no machine+ * index, so its shape is a moving target owned by someone else. These pin the+ * failures that would be SILENT: entries that stop parsing (an empty tab that+ * reads as "no skills exist") and non-entry rows leaking in as skills.+ */+const test = require('node:test');+const assert = require('node:assert/strict');+const loadTs = require('./load-ts.cjs');+const { parseCatalogMarkdown, parseSkillFrontmatter } = loadTs('src/main/skills.ts');++const MD = [+ '## 📈 Overview',+ '',+ '| Category | Skills |', // the overview table — counts, not skills+ '|----------|--------|',+ '| 💻 Development & Code Tools | 74 |',+ '',+ '## 📄 Document Skills',+ '',+ '| Name | Description | Link |',+ '|------|-------------|------|',+ '| **docx** | Create and edit Word documents | [Source](https://github.com/anthropics/skills/tree/main/skills/docx) |',+ '| **pdf** | Extract content from PDFs | [Source](https://github.com/anthropics/skills/tree/main/skills/pdf) |',+ '',+ '## 🎨 Creative & Design',+ '',+ '| Name | Description | Link |',+ '|------|-------------|------|',+ '| **frontend-slides** | Build slide decks | [Source](https://github.com/zarazhangrui/frontend-slides) |'+].join('\n');++test('table rows parse into name, description, url and category', () => {+ const s = parseCatalogMarkdown(MD);+ assert.equal(s.length, 3);+ assert.equal(s[0].name, 'docx');+ assert.equal(s[0].description, 'Create and edit Word documents');+ assert.equal(s[0].url, 'https://github.com/anthropics/skills/tree/main/skills/docx');+ assert.equal(s[0].category, 'Document Skills');+});++test('the category emoji is stripped but the words are kept intact', () => {+ const s = parseCatalogMarkdown(MD);+ assert.equal(s[2].category, 'Creative & Design');+ assert.ok(!s.some((x) => x.category.includes('📄')));+});++test('publisher comes from the GitHub owner, since names here are bare', () => {+ const s = parseCatalogMarkdown(MD);+ assert.equal(s[0].owner, 'anthropics');+ assert.equal(s[2].owner, 'zarazhangrui');+});++test('the overview counts table does not leak in as skills', () => {+ const s = parseCatalogMarkdown(MD);+ // "74" is a count, not a skill, and its row carries no link.+ assert.ok(!s.some((x) => x.description === '74'));+ assert.ok(!s.some((x) => x.name.includes('Development & Code Tools')));+});++test('header rows and separator rules are skipped', () => {+ const s = parseCatalogMarkdown(MD);+ assert.ok(!s.some((x) => x.name === 'Name'));+ assert.ok(!s.some((x) => /^-+$/.test(x.name)));+});++test('a row without a resolvable link is dropped rather than guessed at', () => {+ const s = parseCatalogMarkdown(['## X', '| **orphan** | no link at all | TBD |'].join('\n'));+ assert.equal(s.length, 0);+});++test('SKILL.md frontmatter reads a multi-line block description whole', () => {+ const fm = parseSkillFrontmatter([+ '---',+ 'name: md-audit',+ 'description: |',+ ' Read-only code quality audit — scan the cwd',+ ' and return a prioritised report.',+ 'version: 1.0.0',+ '---',+ '# body'+ ].join('\n'));+ assert.equal(fm.name, 'md-audit');+ assert.match(fm.description, /scan the cwd and return a prioritised report/);+});++test('inline frontmatter description and absent frontmatter both behave', () => {+ assert.equal(parseSkillFrontmatter('---\nname: x\ndescription: one liner\n---').description, 'one liner');+ assert.deepEqual(parseSkillFrontmatter('# no frontmatter'), {});+});