Phase B + C + D of /home/g/.claude/plans/ethereal-crunching-clover.md.
B1. Generate bash state vocabulary from the TS SSOT
- scripts/generate-bash-state-vocab.ts reads STATE_DEFINITIONS from
src/lib/control-states.ts and emits scripts/control-states.generated.sh
with FC_LABEL_<KEY>, FC_DESCRIPTION_<KEY>, FC_COUNTER_CATEGORY_<KEY>
for every state.
- Wired into package.json's prebuild step so every `npm run build`
refreshes the file. Daemon sources it; new states propagate without
hand-editing any bash.
B2. Agent prompt context reads STATE_DEFINITIONS[k].description
- buildPromptWithSession(base, tab, projectStateDescription?) gained
a third optional argument. When passed, prepends
"Project state: <description>" before the session-state block — the
same one-line WHY the human sees on the badge hover tooltip.
- deriveProjectStateKey() in control-states.ts maps the raw signal
set (agentRunning / tabOpen / sessionStatus / readyAt / lockAt /
closingAt / closedAt) to a ProjectStateKey without dragging in the
full presenter machinery.
- Threaded into /api/inject (promptKey path) and the Claude +
Codex/Gemini paths in /api/orchestration/run. The agent now reads
the same words the user reads.
C. ControlFleetStatus migrated to DAEMON_STATE_DEFINITIONS
- lib/control-states.ts gains a sibling SSOT for daemon-side states
(setup_needed / offline / state_unknown / connected). Same shape:
label, description, dotClass, problem hint.
- ControlFleetStatus reads from it for the banner label + tooltip +
problem CTA, dropping the hand-rolled `daemonNeverSeen ? "Setup
needed" : daemonOffline ? "Daemon offline" : ...` tree.
- "Setup needed" surfaces an "Install Fleet Runner" action chip
linking to /download with the longer how-to on hover — same
pattern the per-project badge uses.
- DaemonStatusBanner (the rich 320-line install/recovery card) is
left alone — its UX is distinct from the status indicator.
D. Cleanup
- fleetcrown-daemon.sh now traps EXIT in addition to INT/TERM and
kills its forked sibling daemons (the multi-source polling forks
spawned for each FLEETCROWN_BASE_URLS entry). Was a defensive
improvement; the observed "12+ stale daemons" turned out to be
normal subshell tree.
- .env.vercel.production renamed to .OLD so an accidental
`vercel --prod` from CLI doesn't reupload the stale Neon URLs over
the live Hetzner Postgres (memory/pattern_vercel_cli_env_local_override.md).
.gitignore extended to keep the .OLD file out of git too.
- DATABASE_URL + DATABASE_POOL_URL moved from a single-branch preview
scope to all-preview, so future PRs build without the
"DATABASE_URL is required" build crash we hit on the
arch/control-stream-no-poll branch.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CRITICAL — Vercel deploys had been failing silently for hours with:
Error: A Serverless Function has exceeded the unzipped maximum size
of 250 MB.
Every commit since I started bundling more in desktop/ (electron-updater,
@sentry/electron, bundled Zellij ~35 MB, AppImage build outputs ~500 MB)
made it worse, but the root cause was older: Next.js's output:
"standalone" tracer was copying the WHOLE `desktop/` subtree (542 MB —
the entire Electron app + its node_modules + AppImage artifacts) into
every serverless function bundle, even though nothing in the web app
imports from desktop/.
Result: bundle was 627 MB locally (one function ≥250 MB on Vercel) ⇒
deploy step errored ⇒ none of my last ~6 commits actually shipped to
production. Including the /control crash fix (95fb08b), the palette
close fix, and the prompt reordering. Users were still seeing the
broken page.
Fix: next.config.ts outputFileTracingExcludes["*"] now excludes
- ./desktop/** (the Electron subproject — never touched by the web app)
- ./squashfs-root/** (AppImage extraction artifact left from local debug)
Verified locally: standalone bundle 627 MB → 78 MB. Well under the limit.
.gitignore also now excludes squashfs-root/ so the next AppImage extract
doesn't surprise anyone.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The desktop subproject's package-lock.json was in .gitignore, so the
desktop-release workflow's strict `npm ci` had no lockfile to read and
failed with EUSAGE.
- Remove `desktop/package-lock.json` from .gitignore — workspace lockfiles
belong in version control for reproducible builds.
- Commit the generated lockfile.
- Add desktop/.npmrc with `legacy-peer-deps=true`. electron-vite@2.3.0
declares peer vite ^4||^5 but the project intentionally runs on vite@6.
Locking the flag at the project level keeps both local `npm ci` and the
workflow's `npm ci` happy without modifying every install call site.
Unblocks fleet-runner-v0.2.0 release build (second failure mode after the
root lockfile fix in 01d68b0).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collapses the new-customer install path from "download → install Zellij →
install agent CLI → copy token → paste in app" into "download → click
Open in Fleet Runner". Bumps Fleet Runner to v0.2.0.
Desktop (Fleet Runner v0.2.0)
- desktop/scripts/download-zellij.mjs (new): prebuild fetches the pinned
Zellij binary (v0.41.2) into desktop/resources/bin/ for the target
platform; electron-builder packs it into the AppImage / .deb / .dmg.
Idempotent — skips if the file is already present; FORCE=1 re-downloads.
Handles linux-x64/arm64, darwin-x64/arm64; PRs add more.
- desktop/src/main/index.ts: bundledBinDir() prepends the bundled binary
dir to process.env.PATH before any home/ or zellij call resolves, so
every existing exec("zellij ...") picks the bundled binary first with
the user's $PATH as fallback. Zero call-site changes.
- desktop/src/main/index.ts: fleetcrown:// protocol handler (single-
instance lock, mac open-url event, Linux/Win argv scan, cold-start
buffering). On a deep-link click, the token in ?token=ck_... is saved
via the same path as manual paste and the poller restarts immediately.
- desktop/package.json: version 0.1.0 → 0.2.0; prebuild now also runs
bundle:zellij so dist:linux/mac/win all ship the binary.
Web
- src/components/settings/AgentTokenSettings.tsx: "Open in Fleet Runner"
button next to the freshly-revealed token, hrefed to
fleetcrown://auth?token=<token>. Falls back gracefully if Fleet Runner
isn't installed or the protocol isn't registered.
- src/components/public/DesktopDownload.tsx: CopyableCommand wraps the
CLI command shown after download with a Copy button (Check icon for
2s on success). Clipboard API failures are silent — the code stays
selectable.
- src/app/globals.css: ui-public-download-command-row + -copy classes
to keep the SoC of the public-download surface intact.
- src/config/marketing-content.ts: install copy rewritten around the
new one-touch story (Linux command uses ~/Downloads/Fleet.Runner-*
wildcard; Claude Code becomes required since shipped agents don't ship
with a bundled CLI; prerequisites prose tightened).
.gitignore: excludes desktop/resources/bin/ — the binary is fetched at
build time, not source-controlled (10MB+ per platform).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Embedded watcher gains an optional onIdle subscriber; the desktop main
process passes a callback that fires an OS notification (with a health
badge prefix and the handoff "done" line) every time a dispatched agent
writes its handoff. Clicking the notification surfaces the main window.
This closes the fire-and-walk-away loop: dispatch an intent, switch
context, get pinged when it lands.
Tray + window icon: replaces the placeholder nativeImage.createEmpty()
with the FleetCrown control-window mark, pre-rendered to PNG by a small
pure-Node generator (scripts/generate-tray-icon.mjs — wired into
prebuild + dev). 22px tray, 44px @2x, 256px window/builder icon. Icons
checked in under desktop/resources/ with a targeted gitignore exception
so packaged binaries pick them up without a build step. electron-builder
config gains buildResources + extraResources so the PNGs ship with
AppImage / deb / dmg / nsis.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pulling prod secrets with `vercel env pull .env.production.local` is
the canonical way to query the prod DB from this repo, but that file
wasn't covered by .gitignore — only the older .env.local and
.env.vercel.production patterns were. One absent-minded `git add -A`
and the Neon DATABASE_URL, AUTH_SECRET, GITHUB_CLIENT_SECRET, etc.
would land in a public commit.
Add .env*.local to cover every Next.js env-overlay convention
(.env.production.local, .env.development.local, .env.test.local).
Vendor-neutral DATABASE_URL helpers, dump/restore/sync tooling, and one-command
Oracle migration after a single console VM step. Publishes the studio-stack
thoughts article and hardens build (dynamic layout, resilient sitemap).
Co-authored-by: Cursor <cursoragent@cursor.com>
1. gitignore: add .local-toolchain/ and .python-vendor/ (584 MB of
toolchain binaries that would never belong in the repo)
2. autoContinueEnabled: replace two-effect pattern (read + write) with
a lazy useState initializer. The old pattern had a race where the
write effect ran with the stale initial 'true' value before the read
effect could correct it, silently overwriting a user's 'off' preference
on every page load.
3. SENTINEL_VALIDITY_S: extract the duplicated 86400-second constant into
constants/control.ts as SENTINEL_VALIDITY_S, separate from the display-
window constants (READY/CLOSED/CLOSING_WINDOW_S). Two files had a
local 'const READY_WINDOW_S = 86400' that shadowed and conflicted with
the exported READY_WINDOW_S = 600 in constants/control.ts.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1279→106: importing WhatsApp contacts created 1279 "stale" entries because
the query matched IS NULL (never interacted). Contacts with no interaction
history are dormant imports, not contacts that need rekindling — only those
you've previously engaged deserve the "needs attention" signal.
Changed LEFT JOIN → JOIN and dropped OR max IS NULL clause. Updated pill
link to remove the `unknown` health filter for consistency.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Every /api/.../[id]/route.ts handler started with the same three lines:
const { id } = await params;
if (!isValidUuid(id)) return NextResponse.json({ error: ... }, { status: 400 });
23 occurrences across 12 files, with drift between "Invalid id" /
"Invalid ID" / `null` payloads.
Centralise as src/lib/api/route-helpers.ts:readIdParam(params), which
returns the validated id or a 400 NextResponse the caller returns
as-is. Migrate 20 of the 23 sites; three outliers stay hand-coded:
- people/[id] GET and projects/[id] GET return `null` body for 4xx
(consumer contract — `.then(d => setData(d))` relies on null)
- crons/run is a body-field check, not a route param
Capitalisation drift ("Invalid ID" → "Invalid id") collapses to one
canonical spelling. Also: ignore .claude/ session-state files.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>