User asked: 'I really want you to put the version number and changelog
when you do releases somewhere on the site for transparency and context.'
NEW src/config/changelog.ts:
SSOT for release history. One ReleaseEntry per fleet-runner-vX.Y.Z tag.
Fields: version, tag, date (ISO 8601 UTC), highlights[] (user-facing
bullets in plain English, not commit-message slang), breaking[] (compat
breaks the user must read before upgrading), notes (optional paragraph
on WHY this release matters).
Currently populated with v0.4.4 → v0.7.4 (9 releases).
Add a new entry per release going forward.
NEW src/app/releases/page.tsx (public marketing page):
/releases — vertical timeline of every release. Newest first, current
version pill on top entry. Each card: version + date + notes paragraph +
'What changed' bullets + 'Breaking' bullets (status-warning color) +
link to the GitHub release tag for binaries + raw asset list.
Footer paragraph explains the auto-update-on-.deb-Linux caveat
(electron-updater can't escalate sudo from userspace; manual dpkg -i
required until task #48 — apt repo — ships).
UPDATED src/components/public/PublicFooter.tsx:
• Added 'Releases' link to the Product group → /releases
• Version pill at bottom-right is now Link to /releases, sourcing the
string from CURRENT_RELEASE.version. The pre-this-commit value was
a stale hardcoded 'v0.4.0' from months ago — exactly the
'transparency' gap the user called out.
UPDATED src/app/globals.css @layer components:
• .ui-public-badge-current (accent-colored 'Current' pill)
• .ui-public-release-entry (rounded card per release)
• .ui-public-release-version, .ui-public-release-date,
.ui-public-release-notes, .ui-public-release-section-heading,
.ui-public-release-section-heading-breaking, .ui-public-release-list
Adding a new release going forward:
1. Append entry to FLEET_RUNNER_RELEASES (newest first) in
src/config/changelog.ts
2. The footer + /releases page auto-update on next Vercel deploy
3. (Optional) commit message can stay focused on code; the user-facing
'why' lives in the notes field of the changelog entry instead
tsc clean, 19/19 control-presenter tests pass.
Next: permanent fix for the .deb auto-update problem. Two real options:
(a) Self-hosted apt repo at https://fleetcrown.vercel.app/apt/ with
GPG-signed Packages — user does `apt update && apt upgrade`
with their normal package manager, no Fleet-Runner-specific UX.
(b) Switch Fleet Runner desktop to ship an in-app 'update available'
banner showing the exact dpkg -i command + Copy button when
electron-updater detects newer version but can't apply it.
(b) ships in one desktop release; (a) is the durable answer for Linux
users + sets up the path for self-host customers. Going to do (b) now,
plan (a) as a real follow-up.
The architecture discussion called out 'no metrics, no traces, no alerts'
as a real gap. Pre-this-commit, when something broke we had two signals:
console.warn lines that hopefully landed in Vercel logs, and the
debug_logs table that 12 routes write to (others use console). Counting
'how many dispatches in the last hour' or 'what's the error rate' was
not possible without writing the SQL by hand against prod.
This commit ships a JSON metrics endpoint built entirely on existing
tables — NO new infrastructure (no Prometheus, no OpenTelemetry, no
metrics_* table, no new deps). The signals operators actually want are
all already in the operational tables; aggregate them on demand.
NEW src/db/queries/metrics.ts (177 lines):
getDispatchMetrics(userId) → pending_commands: total24h, failed24h,
pending, avgLatencyMs
getRunMetrics(userId) → orchestration_runs: total24h + outcome map
getErrorLogMetrics() → debug_logs: totalErrors24h + bySource map
(system-wide — debug_logs has no user_id)
getTokenMetrics(userId) → agent_tokens: total + byLabel map
(spot the next leak before it hits 10 rows)
getDaemonMetrics(userId) → runtime_snapshots: lastSeenAt, secondsAgo
getProjectMetrics(userId) → user_projects: active, inactive, total
NEW src/app/api/metrics/route.ts:
GET /api/metrics → 6 parallel queries, returns a JSON snapshot.
Auth-gated via getSessionUserId; 401 when unauthenticated.
Cache-Control: no-store (real-time by design).
~50ms on healthy DB.
Why JSON not Prometheus text format: no scraper to feed. Add ?format=prom
later if we ever wire a scraper.
Why 24h window hardcoded: operators ask 'what happened today,' not
'what's the 99th percentile latency over the last week.' Premature
parameterization.
Cost of this approach: every /api/metrics hit runs 6 queries — fine for
operator on-demand use, would NOT scale to a per-second scraper. That's
the tradeoff we accept for zero new infra.
Verified: tsc clean (both web + desktop), 19/19 control-presenter tests.
Next: bootstrap the drizzle migration ledger so schema drift becomes
visible (task #57), and the deferred audit items (#56).
The command palette had nav + agent prompts + templates but no PROJECTS.
For a fleet-management product the most common Cmd-K intent is 'jump
to project X' — that wasn't possible. Now it is.
Each active user-project becomes a PaletteEntry with kind="project":
- label = project name
- sub = 'Project · <dirPath>'
- icon = FolderKanban (lucide)
- href = /control?focus=<name> (existing deep-link handler)
Projects render at the TOP of the default list (before nav), because
this is the highest-frequency use of the palette. The existing fuzzy
match works as-is — typing 'fl' surfaces FleetCrown.
Fetched lazily: useFetch('/api/user-projects') only fires while the
palette is open. Closed palette = zero network cost.
tsc clean, 19/19 control-presenter tests pass.
Linear-style Cmd-K parity: navigation ✓, agent prompts ✓, templates ✓,
PROJECTS ✓. Still missing: per-project quick-dispatch actions ('send
next-best to FleetCrown'), agent quick-switch ('switch to Codex'). Those
are deeper UX moves that touch the dispatch path — separate pass when
the underlying flow is hardened.
Mirror of Port 1 (AgentAdapter) — same architectural move applied to
the terminal-multiplexer layer. Pre-this-commit, src/lib/zellij.ts was
263 lines of hardcoded `zellij action ...` shellouts. Supporting tmux
or screen would have meant a sprawling code-search-and-replace across
15 call sites.
NEW STRUCTURE — src/lib/terminals/:
types.ts TerminalAdapter interface: detectAvailable, listOpenTabs,
getActiveTab, focusTab, injectText, sendRawKey, dumpScreen,
isUserTyping
zellij.ts The full Zellij implementation behind the adapter —
multi-session-aware, focus-dance HOF, ZSH typing-hook
detection, ANSI-stripped dump-screen
index.ts ALL_TERMINALS = [zellijAdapter], findTerminal(id),
activeTerminal() — picks first detectAvailable=true
ADDING A NEW MULTIPLEXER:
1. Write src/lib/terminals/tmux.ts exporting tmuxAdapter: TerminalAdapter
2. Add it to ALL_TERMINALS in index.ts
Done. The 15 call sites importing from @/lib/zellij keep working
unchanged (they go through the compat shim that delegates to whichever
adapter is active).
zellij.ts (263 → 57 lines): kept as a thin compat shim re-exporting the
historical function names (getZellijTabs, injectIntoTab, peekTab, etc.).
Existing consumers in:
- src/app/api/orchestration/run/route.ts
- src/app/api/control/{focus-tab,switch-agent,agent,stream}/route.ts
- src/app/api/control/route.ts
- src/app/api/project/{commit,clear-context}/route.ts
- src/lib/agents/{claude,grok,gemini,cursor}.ts (launch-command builders)
- src/lib/git-state.ts
- src/lib/orchestration/runners/openclaw.ts
- desktop/src/main/poller.ts
…all keep working without edits. Migration to direct @/lib/terminals
imports happens incrementally as those files are touched for other
reasons.
VERIFIED: tsc --noEmit clean on both web + desktop; 19/19 control-
presenter tests pass; no behavior change.
The two ports together (#58 + #59) deliver the strategic goal: 'we don't
own the model OR the terminal, but both are first-class plug-ins to our
coordination layer.' Adding a new agent OR a new multiplexer is now ONE
new file plus one line in the corresponding index.
Next: Port 3 — command palette (Cmd-K).
The strategic move from the architecture discussion: FleetCrown's value
isn't owning the model, it's being the COORDINATION LAYER where any
model plugs in. Pre-this-commit, agent-registry.ts mixed data + behavior
across 427 lines, with per-agent switch statements in buildAgentOption-
LaunchCommand and per-agent functions for availability detection.
Adding a new agent (Cline, Aider, opencode, etc.) meant hunting through
5+ files.
NEW STRUCTURE — src/lib/agents/:
types.ts AgentAdapter interface + AgentCapabilities + runtime config
helpers.ts commandExistsInPath, parseTomlStringField, dedupeStrings
(shared across adapters)
claude.ts Anthropic CLI — full capabilities, hooks-based activity
codex.ts OpenAI CLI — manual prompts, model from ~/.codex/config.toml
grok.ts x.ai CLI — native session log under ~/.grok/sessions
gemini.ts Google CLI — model via -m flag, no persistent config
cursor.ts Cursor 'agent' CLI — strict detection (version regex + path heuristic)
openclaw.ts FleetCrown bundled gateway agent (not user-switchable)
index.ts ALL_ADAPTERS = [claude, grok, cursor, codex, openclaw, gemini]
findAdapter(id), effectiveDefaultModel, effectiveModelSuggestions
ADDING A NEW AGENT:
1. Write src/lib/agents/newagent.ts exporting newagentAdapter: AgentAdapter
2. Import + add it to ALL_ADAPTERS in index.ts
Done. No edits to agent-registry.ts. No edits to api/control. No edits
to UI switch statements. The catalog, the launcher, the availability
badge, the install button all read from the adapter automatically.
agent-registry.ts (427 → 160 lines): kept as a thin compat shim that
maps the historical AgentRegistryEntry shape to the new adapters via
entryFromAdapter. All existing consumers (api/control, agent-catalog,
control-presenter, etc.) keep working unchanged. Long-term they should
migrate to importing from @/lib/agents directly; this shim stays until
that's complete.
Verified: tsc --noEmit clean, 19/19 control-presenter tests pass,
zero eslint issues. No behavior change for users.
Next: Port 2 (TerminalAdapter — same treatment for src/lib/zellij.ts
to enable tmux/screen/browser-shell plug-ins).
ARCHITECTURAL CLEANUP, first-principles pass per the design discussion.
PROBLEM:
Pre-0.7.4 Fleet Runner shipped TWO parallel UIs:
1. The Next.js app at fleetcrown.vercel.app (the real UI, full feature
set, accessible from any browser, phone, or workstation)
2. A 407-line bundled renderer at desktop/src/renderer/ that read
agent-projects.conf, talked to IPC for project state, and never
reached parity with /control
This violated:
- Ground truth #2 (one source of truth — two UIs is two truths)
- Ground truth #3 (design for change — every feature shipped twice)
- Ground truth #5 (complexity compounds — 2,135 LoC of dead/dual code)
The split also produced the v0.7.0 disaster, where the bundled renderer
became the default boot target and users saw 'YOUR MACHINES. YOUR AGENTS.'
+ '0 projects' + 'Sync error: Failed to fetch' — a half-working stub
instead of their actual /control page.
SOLUTION:
Fleet Runner is now what it really should be: a native Electron wrapper
around the cloud /control UI, with real local-execution services
(poller/pusher/watcher/peek) running in the main process. Same category
as Slack, Linear, Notion, Discord desktop apps.
DELETED:
- desktop/src/renderer/ (407 lines App.tsx, main.tsx, globals.css,
index.html — the bundled renderer that never reached parity)
- desktop/src/main/runtime.ts (224 lines — only the deleted renderer
called these IPC handlers; getLocalRuntimeStatus, getProjects,
dispatchIntent, getCurrentState are gone)
- electron.vite.config.ts renderer block (no more renderer build)
- The USE_WEB_SHELL conditional throughout main/index.ts — there's
only one mode now: web shell.
- loadBundledRenderer() function
- did-fail-load → loadBundledRenderer fallback (replaced with proper
branded offline page that has 'Try again' button)
- IPC handlers: ping, get-runtime-status, get-projects, dispatch-intent,
get-current-state, probe-cloud, switch-to-cloud
- Preload bridge methods for the above
- FleetRunnerBridge type entries for the above
- Dependencies no longer needed: @vitejs/plugin-react, autoprefixer,
postcss, react, react-dom, tailwindcss, @types/react, @types/react-dom
ADDED:
- reload-web-shell IPC handler (offline page → main → loadURL retry)
- reloadWebShell on preload + FleetRunnerBridge type
- Improved offline page copy: 'cloud surface is offline, your local
agents and Zellij tabs are running regardless' — honest about what's
affected, accurate about what isn't
NET: 2,135 lines removed, 136 added. Build still works: out/main 199 KB,
out/preload 2.5 KB. Both tsc --noEmit clean (web + desktop). No behavior
change for users in the default path; the bundled-renderer escape hatch
that produced the broken v0.7.0 boot is gone for good.
Version bump 0.7.3 → 0.7.4. Auto-update pulls this on next launch.
Live Hetzner DB inspection on 2026-06-07 surfaced two real defects.
BUG 1 — DUPLICATE NOTIFY TRIGGERS ON project_states
The table had two trigger sets firing on every INSERT/UPDATE:
* fc_notify_project_states (correct, from migration 0022 — emits on
the canonical 'fc:state' channel via fc_emit_change)
* project_states_notify (legacy pre-rename — emits on 'fleetcrown_state'
via fleetcrown_notify_project_state, which nothing listens to)
Every state push fired both, doubling bridge NOTIFY traffic + giving
every SSE subscriber two events to process for one change.
drizzle/0026_drop_legacy_project_states_trigger.sql: drops the legacy
trigger + its function. Applied directly to prod via psql (verified
before: 5 trigger rows; after: 3). Idempotent (IF EXISTS).
BUG 2 — TOKEN TABLE LEAKS ON EVERY BROWSER LOAD
/api/event-stream-token mints a fresh ck_* token on every call. The
file's own comment (lines 33-39) literally said 'we always mint a fresh
one regardless'. Result: my account had 10 stale event-stream rows over
36 hours, all live, no cleanup. At any user scale agent_tokens grows
unboundedly.
Fix (three parts):
a. NEW src/db/queries/agent-tokens.ts: getReusableEventStreamToken
returns the most-recent event-stream token if last_used_at < 7 days,
reused as-is.
b. /api/event-stream-token: try reuse first, mint only as fallback.
Response now includes {reused: true|false} for telemetry.
c. NEW src/db/queries/agent-tokens.ts: deleteStaleEventStreamTokens
deletes event-stream tokens with last_used_at older than 30 days
(never touches other labels — daemon tokens are persistent).
d. NEW src/app/api/crons/prune-agent-tokens/route.ts: Vercel Cron at
05:00 UTC daily runs the cleanup, logs result to debug_logs as a
heartbeat.
e. vercel.json: register the new cron path.
ONE-TIME CLEANUP (already applied to prod during inspection):
DELETE FROM agent_tokens WHERE label='event-stream' AND id NOT IN (
SELECT id FROM (most-recently-used event-stream row per user)
)
Result: 10 stale rows → 1 active token per user.
Both fixes are deploy-on-Vercel-push safe; the SQL is already on prod.
Vercel deploy picks up the new cron route + endpoint change.
DEFERRED (separate batch): bootstrap drizzle.__drizzle_migrations
ledger so future migrations are traceable. The schema arrived via
'drizzle-kit push' so the migrations table doesn't exist; not blocking
this round.
Audit honorable mentions, both small and low-risk:
1. Refresh-after-action durations consolidated in constants/timings.ts.
Pre-fix: 500/700/1500/3000ms inlined across use-control-data.ts and
ZellijLivePanel.tsx with no documented intent. Now four named
constants:
REFRESH_AFTER_DISPATCH_MS = 500 (inject → re-fetch)
REFRESH_AFTER_TAB_ACTION_MS = 700 (close-tab, tab-inject)
REFRESH_AFTER_LAUNCH_MS = 1500 (full project launch)
AGENT_COLD_START_MS = 3000 (wait between launch + 1st prompt)
Each has a one-paragraph rationale so future tuning has context.
2. PHASE_DOT_CLASS exported from control-presenter.ts.
Pre-fix: ProjectOperationsView.tsx had a 9-line ternary chain mapping
phase → Tailwind dot class. The ControlPhase enum and its visual
mapping lived in different files and couldn't be type-checked
against each other. Now: Record<ControlPhase, string> — adding a
new phase value forces an explicit color choice (the type errors
without one). ProjectOperationsView.tsx drops to one line:
const dotClass = PHASE_DOT_CLASS[snapshot.phase];
19/19 control-presenter tests pass; tsc --noEmit clean.
Audit item #3: sendRawKey, injectIntoTab, and peekTab in src/lib/zellij.ts
each ran the same 8-line dance:
1. findSessionForTab → session
2. getCurrentTab(session) → originalTab
3. exec('zellij [--session X] action go-to-tab-name <tab>')
4. waitForTabFocus or throw
5. do the per-function thing
6. if originalTab !== tab: exec('zellij [--session X] action go-to-tab-name <originalTab>')
Plus the 'session ? `zellij --session X action …` : `zellij action …`'
ternary appeared 8 times across the file.
Two helpers collapse this:
- zellijCmd(session, ...args): builds the command string with or
without --session. The 8 inline ternaries become one helper.
- withFocusedTab(tab, fn): focus → run fn(session) → restore. fn
is called with the resolved session so it can keep using zellijCmd
for follow-up actions.
The three public functions (sendRawKey, injectIntoTab, peekTab) drop
from ~20 lines each to 3-10 lines each. The dance now lives in ONE
place — if Zellij grows a 'write to non-focused pane' API we change
one HOF, not three call sites.
Behavior preserved:
- Same focus + restore logic
- Same 1s wait timeout, same throw on focus failure
- Same 0.1s sleep after write-chars before pressing Enter
- Same try/finally for tmp-file unlink in peekTab
- Same best-effort restore on error
Verification: 19/19 control-presenter tests still pass; both web and
desktop tsc --noEmit clean.
zellij.ts: 280 → 263 lines (6% smaller, much more readable).
Audit item #6: api/control/route.ts was a 537-line god route mixing
transport, slow-cache, git-shell, profile fuzzy-match, lifecycle event
derivation, and DB writeback. First extraction pass: pull the two pure
data-transformation chunks into lib/ where they belong.
NEW src/lib/git-state.ts — fetchAllGitStates(dirs)
The single-bash-invocation git probe (one fork, N background jobs per
dir, parallel wait). Returns Map<dir, GitState>. Behavior unchanged.
Future consumers (/projects page, cron heatmap) can call it without
importing the /control route.
NEW src/lib/project-profile-match.ts — rowToProfile + matchProfile +
matchProfileById + resolveAutoInjectOverride
The three near-identical fuzzy matchers were inline in route.ts with
subtle differences: matchProfile did bidirectional substring matches,
resolveAutoInjectOverride only exact-normalized. That meant a user
with slightly-different tab spelling could see their profile attach
but the autopilot override silently miss — "why isn't sleep mode
firing for this project even though it's clearly set?"
Consolidated normalizeName() helper inside the module; resolve uses
exact-normalized (intentional, matches the legacy precedent) but
shares the same string-prep logic with matchProfile so the two can't
drift. matchProfile still does the broader bidirectional substring
search it always did. No behavior change at the entry points.
Cleanup:
- Drop now-unused imports from route.ts: path, AUTO_INJECT_MODE_VALUES,
type AutoInjectMode, exec + promisify + execAsync local.
- Drop the 'Profile matching' section divider comment (the file's
section headers are stale anyway; will rewrite when batch 2b lands).
Size: route.ts 537 → 407 lines (24% smaller). Remaining batch 2 work:
- persistProjectSessionIfNewer + appendProjectDevLog writeback block
(lines 282-308 in current file) → lib/control-session-writeback.ts
- Inline tab/dir/project assembly inside the projects.map → split into
a buildProjectState helper
19/19 control-presenter tests still pass; tsc --noEmit clean both ways.
Code-quality-reviewer audit identified 10 SSOT/DRY/SoC violations across
/control + dispatch + auth. This commit handles the four lowest-risk ones
(plus the design-token violations I introduced yesterday in PeekTabDrawer).
No behavior change intended; all 19 control-presenter tests + 89 home/
tests pass; both desktop and web tsc --noEmit clean.
1. NEW src/lib/constants/daemon.ts
Three daemon timing numbers (heartbeat cadence, offline threshold,
long-poll wait) had to agree across desktop pusher, web ControlPanel,
and /api/control/commands but were edited independently. The pusher
source comment even said "the 90s threshold is too aggressive for
this 5min cadence" — UI briefly flickered "offline" between
heartbeats. Now: heartbeat is the input, threshold is heartbeat × 1.5
+ 30s grace (auto-scales), long-poll is shared.
Sites updated: ControlPanel.tsx, desktop pusher.ts + poller.ts,
api/control/commands/route.ts.
2. NEW desktop/src/main/token-store.ts
~/.config/fleetcrown/fleet-runner-token + loadToken read-and-trim was
copy-pasted across poller.ts, pusher.ts, and three IPC handlers + the
deep-link handler in index.ts (5 sites). A token-path rename would
silently leave callers on the stale path. Now one module owns the
path + load/save/clear with discriminated-result error handling.
Eliminates 5 duplicate paths + 3 duplicate loadToken functions.
3. NEW src/lib/ansi.ts
stripAnsi() — CSI + OSC regex was duplicated in zellij.ts's
cleanZellijLines (CSI only — missed OSC title-set / hyperlink) AND
peekTab (broader regex with both). cleanZellijLines now uses the
broader function too, so future zellij output that includes OSC
sequences won't quietly bleed escape codes into the parsed tab list.
4. api/control/route.ts: drop hardcoded ["claude","codex","gemini",
"cursor","grok","openclaw"] in daemonAvailability — derive from
listAgentRegistry() so adding a new agent in lib/agent-registry no
longer requires also remembering to update this list. Was a real
drift trap: 'openclaw' had been added to the registry but the
availability map still listed it manually anyway.
5. Cross-OS tmp-file path: peekTab now uses os.tmpdir() instead of /tmp.
Linux/mac behavior unchanged; this unblocks Windows builds (which the
desktop pipeline ships .exe for) from writing to a path that doesn't
exist on that platform.
6. Design-token cleanup (project CLAUDE.md four-layer rule):
- PeekTabDrawer.tsx: replaced bg-[#0a0a0a] + text-[#FAF8F5] with new
ui-control-terminal-frame / ui-control-terminal-surface classes
in globals.css @layer components. My violation, my fix.
- 4 sites of text-[9px] in control-* components → text-micro (10px
token, slight 1px upsize is fine, brings them under SSOT).
- money/page.tsx text-[10px] → text-micro (same).
Final design-token audit: 0 violations across src/.
Audit issues remaining for future batches (higher-risk, multi-file):
#1 ProjectState type derivation from Drizzle schema
#3 zellij focus-dance HOF
#5 collapse two dispatch entry points to one
#6 split 537-line /api/control/route.ts god route
#9 split useControlData into snapshot + form + mutations
The hardest UX gap in /control was: you saw your tab NAMES + state chips
('Working', 'Awaiting input') but never the actual screen content. To know
what the agent was saying you had to alt-tab into Zellij and find the
right tab. Web-shell users saw even less.
v0.7.2 closes that. Per-tab eye-icon button on /control workspaces table
opens a drawer that captures the live screen of that Zellij tab and renders
it as a static terminal frame (monospace, dark background, scrollable).
Auto-refresh toggle re-peeks every 3s for watching long-running agents
without permanently leaving the user on the peeked tab.
Mechanism (sub-200ms round-trip):
1. ZellijLiveRows eye-button → setPeekTab(name)
2. PeekTabDrawer mounts → window.fleetRunner.peekTab(name)
3. preload → IPC peek-tab → main process
4. src/lib/zellij.peekTab: save focus, go-to-tab-name, dump-screen to
/tmp file, restore focus, read+strip ANSI, unlink temp
5. Returns content → drawer renders in <pre>
Same focus-dance pattern as injectIntoTab (already in zellij.ts) — users
have accepted that disruption budget for remote dispatch, this reuses it.
Outside Fleet Runner the button is hidden (one-tick mount probe of
window.fleetRunner.peekTab). No degraded "button that always errors"
experience for browser users.
Also in this drop:
- desktop bump 0.7.1 → 0.7.2 (auto-update will pull this on next launch)
- control-presenter test: "cockpit" string was a leftover from the rename,
failed CI on the v0.7.1 push; now compares to 'FleetCrown' as intended
- ZellijLivePanel daemon-offline CTA now points to /releases/latest
instead of the hardcoded fleet-runner-v0.7.0 tag (was pointing users
at the broken bundled-renderer build)
Next: v0.7.3 cloud-fallback (browser-only users get peek via the command
queue → daemon → result table → SSE), v0.8 inline terminal column.
User report: clicking the Linux download CTA gives an AppImage that
KDE/KIO refuses to execute ('Aus Sicherheitsgründen ist es in diesem
Kontext nicht erlaubt'). The user has no idea what to do — dead end.
Flip: .deb becomes the primary Linux CTA. AppImage moves to secondary
for users on Arch/Fedora/immutable distros where .deb isn't right.
After-download instruction shows the one-line install + launch via
sudo dpkg, not chmod-and-pray.
KDE/KIO's policy refuses to execute any standalone binary that isn't
installed system-wide; .deb installed via dpkg goes through the
package manager and is never gated. .deb is also smaller (no
Chromium per-app sandbox payload) and gets a Start Menu entry +
desktop icon for free. For 90% of FleetCrown's likely user base
(Ubuntu/Debian/Mint/Pop) this Just Works.
The marketing footer 'AppImage / .deb' phrasing in the platform-
parity bullet stays — it documents what we ship, not what we
recommend.
User QA: cloud /control shows 'No live workspace data · The cloud
control plane needs your local daemon running and pushing state.
Start an agent workspace, then check the local connection in
Settings.' which is generic and dead-ends — the user has no idea
what to actually do.
Replaced with two concrete CTAs:
- 'Download Fleet Runner (desktop app)' → v0.7.0 release page
- 'Or run the bash daemon' → quickstart docs anchor
+ a one-liner explaining auto-mint flow so the install is one
click and 30s of waiting, not a doc treasure hunt.
The architecture is the v0.7 vision: Electron desktop owns local
execution, cloud is sync layer. This banner now reflects that
honestly — cloud literally can't see localhost Zellij without
something local pushing state, so the right UI is 'install the
local app' not 'why is this broken'.
Pre-v2.1 the prompt library was 41 templates baked into
src/config/prompt-library.ts. Users couldn't add their own, pin to a
project, or capture successful ad-hoc dispatches. v2.1 is the
structural fix — each user can now create their own prompts that
merge with the FC defaults on /prompts.
Multi-disciplinary design (product · UX · engineer · prompt engineer):
- Product: prompts are repeatable work units; users need their own +
per-project recipes. Library grows with use.
- UX: user-owned section above FC defaults; +New button opens an
inline form (modal in v2.2 if needed); edit/delete on each card;
scope toggle global vs project.
- Engineer: new prompts table (user_id, scope, project_id nullable,
body, variables JSONB, tags, source, run_count, success_count).
Migration applied to Hetzner.
- Prompt engineer: body supports {{name}} and {{name|default}}
placeholders; parsed once at insert time into a variables[] array
so v2.2's variables-at-run modal doesn't re-parse.
Shipped:
+ drizzle/0025_prompts.sql (applied to Hetzner)
+ src/db/schema/prompts.ts
+ src/db/queries/prompts.ts — parsePromptVariables, renderPromptBody,
CRUD helpers, listPromptsForUser, listPromptsForProject
+ src/app/api/prompts/route.ts (GET list, POST create)
+ src/app/api/prompts/[id]/route.ts (GET, PATCH, DELETE soft)
+ src/components/prompts/UserPromptsSection.tsx — list + inline
create / edit form with scope picker, tags, body textarea,
variable-syntax hint
~ src/components/prompts/PromptLibraryClient.tsx — accepts
optional userPrompts prop; renders UserPromptsSection above the
FC-defaults grid
~ src/app/(app)/prompts/page.tsx — fetches user prompts via
listPromptsForUser and passes to the client component
Roadmap noted in comments:
- v2.2: variables-at-run modal (quick-fill {{name}} placeholders
before sending)
- v2.3: "Save as prompt" capture from /history rows
- v2.3: success-rate analytics from orchestration_runs.outcome
- v2.4: scheduled prompts (cron, integrates with the autonomous
scheduler shipped in Change 5)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Root cause of the /today crash captured by the diagnostic shipped one
commit ago. Drizzle's raw sql template interpolation calls .toString()
on Date params — Postgres rejects the JS default ('Sat Jun 06 2026
00:00:00 GMT+0000') as an unparseable timestamp. The non-template
builder helpers (gte/lte/eq) serialize Date correctly; only the raw
sql interpolation in count(*) FILTER (WHERE ...) clauses tripped.
Fix: convert dayStart/weekStart to ISO strings and cast in-SQL as
::timestamptz. /today renders again.
The per-step try/catch + onRequestError instrumentation that found
this can come out in a later cleanup; leaving them in for now in
case other server-component pages hit the same pattern.
/today has been crashing in prod with an opaque Server Components
render error. Client telemetry and onRequestError aren't surfacing a
useful stack. Wrap each upstream call (getCurrentUserName, requirePage
UserId, getUserProjects, getOrgProjects) in a 'step' helper that logs
to debug_logs with the failure site + truncated stack, then re-throws
so the error boundary still renders.
Next /today crash lands a row keyed by source='today/page' with the
step label that threw. Once we have the root cause and a fix, this
diagnostic scaffold can come back out.
Pre-fix: even with N projects, the daemon-never-seen banner showed the
full two-card pitch (Start a new project + Install Fleet Runner). User
QA called it noise — they have a project; the 'start new' card is
redundant.
Now: when hasProjects=true AND daemonNeverSeen, banner shows ONLY the
'Install Fleet Runner' card with a single-line intro. The 'Start new'
pitch stays for empty-state users where the welcome cards aren't yet
visible.
Next.js prod strips error.message client-side, leaving only the digest
visible. vercel logs CLI doesn't reliably surface them from our local
env. onRequestError fires server-side on every uncaught render error;
logging digest + full message + stack to debug_logs gives a durable
correlation key the client-side telemetry can pair with.
Next /today crash will have a debug_logs row with the actual error.
Pre-fix: entity-creating routes (create-with-github, import-from-local,
bulk-from-github, the bootstrap modal cloud path) inserted only into
the entities table. /api/control reads from user_projects → a newly
created project was visible on /projects but missing from /control.
User dogfood surfaced this with truthseeker today.
Fix: createProject now ALSO inserts a user_projects row linked to the
new entity. dir_path stays null until the user clones locally and
registers the path via /control/import-local; v0.7.1 will surface a
"needs local clone" affordance for null-dir_path rows so /control
shows them with the right call to action instead of silently hiding.
Per-user org_id is auto-resolved from orgs.owner_id for consistency
with the existing createUserProject path.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The (app)/error.tsx boundary catches server-component throws and shows
"Something went wrong" — but the error message + digest only live in
Vercel runtime logs, requiring DevTools spelunking to find. User asked
to diagnose /today crashes "without my involvement"; this gets the
digest + path + user-agent into the debug_logs table on every crash so
the next instance is queryable directly.
+ src/app/api/debug-log/route.ts — POST endpoint, schema-validated,
no auth needed (client errors before sign-in still useful)
~ src/app/(app)/error.tsx — useEffect posts {digest, message, path}
fire-and-forget on mount. Never blocks the error UI.
When the next /today crash fires, the row lands in debug_logs with
source='app-error-boundary'. The digest correlates 1:1 with the same
digest in Vercel runtime logs — so we can grep server logs by digest
instead of by timestamp guesswork.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two issues surfaced from production.
(1) Production deploys stuck since Change 6.
Every push from Change 5 onward failed Vercel build validation with:
"Hobby accounts are limited to daily cron jobs. This cron expression
(*/30 * * * *) would run more than once per day."
The autonomous scheduler's */30 cadence exceeds Vercel Hobby's
once-per-day cron limit. Fix: change to "0 4 * * *" (daily at 04:00
UTC). Documented in the route comment as plan-limited — drop back to
*/30 on a Pro upgrade. Daily run still picks up any project idle >
IDLE_WINDOW_HOURS and nudges once; the cadence is the only regression
vs the original design.
The auto-deploy backlog means Changes 4, 5, 6 (Phase C, scheduler,
beacon DB, typed boundary, per-project autopilot) all land in the
same release once this commit unblocks the build.
(2) /control empty-state visual noise.
When the user has 0 projects, ControlFleetStatus still renders:
"Setup needed · Autopilot Manual · 0 working · 0 ready · 0 open ·
All clear · Beacon — popup with smart choices ..."
stacked under the empty-state welcome cards. The counters are
meaningless at 0; the autopilot pill + beacon hint are decorative.
User reported this as noise.
Fix: gate ControlFleetStatus on `data.projects.length > 0`. The
welcome cards already serve as the empty-state CTA; status panel
returns the moment a project exists.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pre-v0.7: /api/beacon wrote one JSON file per session to
/tmp/<APP_SLUG>-beacon/<id>.json. The SSE route polled the directory
every 150ms with fs.readdirSync(). That worked while traffic was
single-pod-single-user, but had three real drawbacks:
- /tmp isn't durable; a function instance restart loses pending
popups silently
- Cross-pod reads impossible — a popup written by pod A is invisible
to pod B (latent landmine that hasn't bitten yet)
- Filesystem polling on every SSE tick is exactly the work
NOTIFY/LISTEN was added to obsolete in v0.6
This change moves storage to a beacon_sessions DB table. Same product
behavior, durable + queryable + user-scoped. A NOTIFY trigger on the
table is the v2 step that obsoletes the poll loop entirely — the
bridge already has the LISTEN side. This commit keeps the SSE poll
cadence to keep the diff small.
The beacon product feature itself (L3 of the autopilot ladder — the
"popup with countdown" tier between Manual and Continuous) is
unchanged. This was the file-based hack INSIDE the L3 product, not
the product itself.
Files:
+ drizzle/0024_beacon_sessions.sql (applied to Hetzner prod)
+ src/db/schema/beacon-sessions.ts
+ src/db/queries/beacon-sessions.ts
~ src/app/api/beacon/route.ts — POST + helpers delegate to DB
~ src/app/api/beacon/[id]/route.ts — GET/PATCH via DB
~ src/app/api/beacon/cancel/route.ts — userId-scoped (was global)
~ src/app/api/beacon/sse/route.ts — polls DB instead of /tmp,
requires auth (was unauthenticated)
~ src/app/api/inject/route.ts — passes userId to cancel
~ src/app/api/orchestration/run/route.ts — passes userId to cancel
~ src/app/beacon/[id]/page.tsx — await readBeaconSession (now async)
~ src/app/beacon/live/page.tsx — userId-scoped + await
+ src/db/schema/index.ts — export beacon-sessions
Behavior changes worth flagging:
- SSE endpoint now requires auth (returns 401 unauthenticated).
Pre-Change-4 it served any /tmp content. The file version's lack
of auth was incidental, not intentional.
- cancelActiveBeaconSessions / readLatestPendingSession became
user-scoped. Callers updated to thread userId through.
- beaconPath export removed — meaningless for DB-backed storage,
no remaining callers after the migration.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The "tool → system" lever the v0.6 essay called for: when you walk
away, the system keeps moving on the projects you've trusted to keep
moving. Pre-v0.7: nothing moved unless an agent finished a run +
agent-hook-bridge.sh fired. Now a cron tick checks for idle projects
and fires the next-best template for users on L4 (Continuous).
v1 scope (deliberately narrow):
- Fires ONLY for users on auto_inject_mode = 'next_best' (L4). Beacon
(L3) is reactive to agent-finish events, not idle-poll. Strategist
(L5) needs session-handoff context the cron doesn't have. Both v2.
- Respects per-project auto_inject_mode_override (the toggle shipped
earlier today). "Paused" projects are never nudged.
- Conservative gates:
* No orchestration_runs started in last 2 hours (IDLE_WINDOW_HOURS)
* No pending_commands with executed_at IS NULL (don't pile on)
* entities.metadata.lastNudgedAt is NULL or > 6 hours ago (cooldown)
- Capped at MAX_NUDGES_PER_TICK = 25 nudges per cron tick. Runaway
misconfig protection.
Schedule: every 30 minutes (vercel.json crons). Conservative — the
downside of over-firing is more obvious to a user than under-firing.
Tune up after observing real usage.
Implementation:
- src/app/api/crons/nudge-idle/route.ts — GET handler, requireCronAuth
- Drizzle builder API (no raw SQL except the JSONB key extraction +
IS NULL check that don't compose cleanly through the builder)
- Reads NEXT-BEST-STEP template from src/config/prompt-library.ts so
there's no template duplication; renders {{project_name}} per-project
- Inserts pending_commands of type='inject' with the rendered prompt
- Updates entities.metadata to track lastNudgedAt for cooldown gating
- logDebug per tick (info on success, error on failure) so production
has telemetry of the scheduler's behavior
vercel.json updated to register the new cron at */30 * * * *.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pre-v0.7: a single user-level beacon_settings.auto_inject_mode applied
to every project. User question while dogfooding: "how can I easily
pause and continue auto-inject for different projects?"
Now each project entity carries an optional auto_inject_mode_override.
NULL = inherit the user-level mode (today's behavior). Any
AUTO_INJECT_MODE_VALUES value (typically "off") = pin this specific
project to a different tier. /api/control/dispatch reads the override
before falling back to the user default.
End-to-end:
Schema (drizzle/0023_entities_auto_inject_mode_override.sql):
+ entities.auto_inject_mode_override TEXT (nullable, no CHECK —
validation is at the API boundary so future enum churn doesn't
orphan rows).
Query layer (src/db/queries/projects.ts):
+ getProjectAutopilotOverride(userId, projectKey) → AutoInjectMode|null,
defensively coerces unknown stored values to null
+ patchProject() accepts autoInjectModeOverride: AutoInjectMode|null
+ PatchProjectBody validator extended (zod enum + null)
Dispatch route (src/app/api/control/dispatch/route.ts):
+ Reads project override before user default. Both lookups fail-safe
to default mode so a transient DB hiccup doesn't kill dispatch.
/api/control snapshot (src/app/api/control/route.ts):
+ ProjectState.autoInjectModeOverride populated per-project via
resolveAutoInjectOverride() helper. Mirror of matchProfile's
fuzzy-match (id-first, then tab/dir basename).
UI (src/components/control/ProjectAutopilotToggle.tsx + ProjectCard):
+ Pause/Play button on each ProjectCard. "Active" = inheriting the
user-level mode. "Paused" = override is "off". Hover-tooltip
shows the user-level mode so "Inherit" isn't opaque.
+ Hidden when projectId is null (legacy paths-only projects with
no entity row can't be overridden — PATCH would 404).
+ Fires FLEETCROWN_REFRESH_EVENT on success so /control refetches.
Full per-tier control per-project (off/queue/beacon/continuous/mission
per project, not just binary pause) is the v2 follow-up; binary
pause/resume covers the dominant use case in scan-light shape.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two small UX fixes from a real user observation during dogfood today:
1. NotificationsPill — was "[bell icon] Notifications off" in a pill.
Visually read as two elements (icon + text) for one button; users
asked if there were two notification controls. Collapsed to a
single bell-on/bell-off icon button matching the topbar's other
icon-only buttons (mobile search, Sessions drawer). The hover-title
carries the state explanation for users who need it.
2. SidebarFooter — dropped the full-width dark/light mode toggle.
Theme is a set-once-and-forget preference; full-width sidebar slot
was disproportionate. Settings → Appearance has the same toggle
(AppearanceSettings.tsx) which is the right home for it. Sidebar
slots now: collapse, Settings, Lock private zone (conditional),
Sign out — all frequent navigation/presence actions.
The third issue raised (prompt library showing prompts despite an
empty Hetzner DB) is by design — src/config/prompt-library.ts ships
~30 FleetCrown defaults baked into the build, independent of DB state.
User-defined / project-specific / personal prompts are a real feature
gap noted for a future sprint (needs a user_prompts table + UI to
manage; meaningful scope, separate change).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
GitHub provider config requested only the Auth.js defaults (read:user +
user:email). Those are enough for sign-in but not for POST /user/repos
— GitHub returns 404 Not Found rather than 403 (security through
obscurity) when the token lacks repo scope.
Surfaced during dogfood today: clicked "Start a new project" with name
truthseeker on /control/new-from-scratch, got "GitHub API rejected the
create (404) — Not Found" with no further hint. The /api/projects/
create-with-github route comment even called out 403-or-401 as the
expected failure modes; 404-because-of-missing-scope was the silent
third case.
Added 'repo' to the GitHub authorization scope params. New sign-ins
will mint tokens with the right scope automatically; existing users
must sign out + back in to upgrade their token's scope.
Documented inline that repo is required by /api/projects/create-with-
github AND /api/github/repos (the latter lists private repos too,
which also needs repo or it falls back to public-only).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
POST /api/projects/create-with-github runs a multi-call sequence (GitHub
create-repo → seed template via branches/main, parallel blobs, tree,
commit, patch ref → DB insert). Under normal latency that's 5-15s.
Vercel's default 10s function ceiling tripped a 502 mid-flight during
dogfood today — repo was never created on GitHub, client got a 502
from Vercel's edge with no JSON body, no error surfaced to the user.
Match the pattern established by /api/project/ai-brief (maxDuration = 90)
which faces similar third-party-API tail latency. 60s gives a comfortable
margin without inviting hung functions.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The bootstrap effect on /onboarding had [router, update] as its
dependency array. update() is the function returned by useSession()
in next-auth's React adapter. Each time the effect called update()
to sync the JWT from DB, the session state changed, useSession
returned a new update() reference, the effect's deps changed, and
React re-ran the effect — which called update() again. Result:
hundreds of concurrent GET /api/onboarding requests, all stuck in
"pending" state, page rendering only a spinner forever.
Observed live during dogfood today (2026-06-05) driving fleetcrown
.vercel.app in Chrome to create a new project. Network panel showed
217 fleetcrown.vercel.app requests in the first 4 seconds of the
page load — all /api/onboarding GETs, all pending.
Fix: hold update() in a ref so the bootstrap effect can call the
latest version without depending on its identity. Effect deps drop
to []. The auto-onboard heal path that POSTs /api/onboarding for
returning users now actually completes — under the old behavior, the
effect tore down before the POST resolved.
Validates the broader pattern: next-auth's update() is not stable
across renders. Any effect that calls it should ref it or call it
exactly once on mount with empty deps.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two paired architectural changes that move us off the surviving polling
loops and onto the bridge for everything that should be push.
Change 1 — Desktop poller subscribes to bridge SSE for fast command drain
The desktop's long-poll to /api/control/commands?wait=25 stays as the
safety net, but a new bridge-subscriber.ts opens an SSE connection to
bridge.orangecat.ch and listens for `pending_commands` INSERT events.
When one fires for our user, the subscriber aborts the in-flight wait=25
fetch; the loop's next iteration uses wait=0 and drains the queue
immediately. Dispatch latency goes from "up to 25s" (long-poll cycle)
to "<500ms" (NOTIFY → bridge fan-out → SSE frame → abort → re-poll →
command).
Old daemons in the wild keep working unchanged — they just don't have
the SSE subscriber, so they pay the long-poll latency. Atomic claim
(FOR UPDATE SKIP LOCKED) means commands still go to exactly one
consumer when both paths race.
The bridge already fans out pending_commands events: the trigger has
been in drizzle/0022_notify_triggers.sql since v0.6 phase A, and
bridge/src/subscriptions.ts:35 is table-agnostic. Only the consumer
was missing.
Change 3 — Delete /control polling setInterval
useControlData's polling baseline (5min when bridge configured, 30s
otherwise) is gone. Refresh triggers reduced to:
1. Mount (always)
2. visibilitychange (tab returns to foreground)
3. FLEETCROWN_REFRESH_EVENT (pull-to-refresh, manual button)
4. useEventStream onChange (any fc:state NOTIFY)
5. /api/control/stream EventSource projects-update patches (existing)
If both push pipelines silently fail, visibility-change is the human-
driven recovery. That's an acceptable failure mode for the egress
savings — and per the v0.6 "From Polling to Listening" essay, the
belt-and-braces was always meant to be temporary.
Code quality
SSOT: Bridge URL lives in src/config/brand.ts as BRIDGE_URL. Web and
desktop both consume it; env override available for dev (NEXT_PUBLIC_
FLEETCROWN_BRIDGE_URL for the cloud build, FLEETCROWN_BRIDGE_URL for
the desktop). Previously the web hardcoded the env-var-only path with
no fallback.
SSOT: ChangeEvent type lifted to src/lib/event-stream-types.ts, shared
by web (src/lib/event-stream.ts) and desktop (bridge-subscriber.ts).
Previously had three near-identical copies — one in bridge/, one in
event-stream.ts as BridgeChangeEvent, and an implicit one about to
appear in the desktop. The bridge package keeps its own copy at the
IPC boundary (separate deployable). 3 copies → 2 at the wire format
contract line.
DRY/SoC: bridge-subscriber.ts has one job (detect pending_commands
INSERT events and notify the poller). The poller decides what to do.
No data-fetch logic in the subscriber; no SSE state machine in the
poller. The two abort controllers (lifetimeCtrl for stop, inner
currentFetchCtrl for bridge-wake) keep the lifecycle scopes explicit.
YAGNI: No new dependency added. Built a ~150-line SSE client using
Node's https module directly. EventSource polyfill not needed at our
scale.
Dead code cleanup: isBridgeConfigured() removed (always true now),
EventStreamState "disabled" mode dropped, useEventStream "enabled"
option removed (single caller, never used). Total -42 lines from
event-stream.ts net of new code.
Tests: 89/89 home self-tests pass. tsc clean. eslint clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
EmptyStateWelcome detects window.fleetRunner via the desktop preload
IPC. When present, the "Install Fleet Runner" card is hidden (it
makes no sense to pitch the app the user already has open) and the
grid drops from lg:grid-cols-5 to lg:grid-cols-4 for clean wrapping.
Outside Fleet Runner (cloud browser) — unchanged 5-card layout.
The useEffect+setState pattern is explicitly documented in-line as
necessary for the RSC-vs-hydration boundary (lazy useState
initializers run on the SSR pass where window is undefined and are
then locked in via the RSC payload — the post-hydration effect is
the only way to read browser-only globals). Suppressed the eslint
rule on the specific line with the rationale comment.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MissingCLIsBanner (added in the v0.6.0 onboarding sprint) shows only
the CLIs that are actually missing on the user's PATH, via the new
window.fleetRunner.getInstalledCLIs IPC. The DaemonStatusBanner has
a separate 5-button "Install Grok / Claude / Cursor / Gemini / Codex"
grid that renders all five regardless of what's installed.
Inside Fleet Runner, both render on the same page — noisy and
contradictory (the smart banner says "claude is missing" while the
dumb grid offers all 5 install buttons next to it). Suppress the
DaemonStatusBanner grid when window.fleetRunner is present so
MissingCLIsBanner is the sole source of truth there.
Outside Fleet Runner (cloud install, daemon offline path), the grid
stays — there's no IPC to read PATH from, so showing all 5 install
buttons is the right blunt-but-honest fallback.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two small UX wins for the first-touch moment:
1. Suggesters now show a 1.5s success card after import succeeds —
"Imported 5 GitHub repos. Welcome to your fleet." / "Imported 3
local repos. Your fleet is alive." Without this the user clicks
"Import all 5", the suggester instantly unmounts, projects appear
below, and there's no felt sense of having done something. The
dwell gives the moment weight before the page transitions.
Same pattern in both GitHubRepoSuggestions and LocalDevSuggestions,
matching dwell constant. Kept inline (no toast library added) —
YAGNI for one celebration moment.
2. Project intent panel placeholder: "Custom prompt…" → "What should
the agent work on? e.g. summarize this repo". The old label
described the INPUT, not what to put in it. New users had no model
for the kind of thing to type; the example seeds a working first
try. Power users see the placeholder vanish on focus, so it's
first-touch-only.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drops the "isReturning" gate in decideHealPatch so the heal fires on
first sign-in too. When a user signs in with OAuth (GitHub / Google /
Twitter) and we can derive a unique username from their display name
or email local-part, we set it + onboardedAt right there in the JWT
callback. They land authenticated with onboardingComplete=true and
middleware sends them straight to /control instead of via /onboarding.
User-visible effect: GitHub OAuth → /control in ONE page load instead
of two. The /control empty state's GitHubRepoSuggestions / LocalDev-
Suggestions / FleetRunnerAutoMint then take over from there.
Fallback (still works): users whose suggested username collides with
an existing one, or whose display name + email can't yield ≥2 chars
of [a-z0-9-], get null patch → middleware sends them to /onboarding
to pick manually. The page is no longer a forced gate — just a
fallback for the edge cases.
Side benefit: also skips the wasted "onboardedAt-only" write that
the old logic would do for returning users without a valid username,
since onboardedAt without a valid username is a no-op
(isOnboardingComplete still gates on both).
The /settings → Profile editor lets users change the auto-picked
username later, so we're not stealing their choice — just defaulting it.
Tests: 7/7 pass (npm run test:onboarding-heal). Updated existing
brand-new-user assertion to reflect the new policy and added a
collision-fallback test case.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two hardcoded https://fleetcrown.vercel.app/ strings in the local-import
page replaced with APP_URL from src/config/brand.ts (already the
documented SSOT for the canonical host). When the domain eventually
moves off the .vercel.app placeholder, this page comes along for free.
Scope limited to the page I touched in the preceding refactor — the
remaining hardcoded URLs (DaemonStatusBanner copy, project-templates
README footers, marketing-content install one-liner) are deliberately
left alone so this commit stays minimal-blast-radius.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MissingCLIsBanner and LocalDevSuggestions each had their own local copy
of the type returned by the corresponding window.fleetRunner IPC method.
Two consumers, same shape, copy-pasted — a small SSOT violation.
Promoted both shapes to named exports in components/desktop/types.ts
(InstalledCLIs, LocalDevProject) and switched consumers to import them.
The FleetRunnerBridge function signatures now reference the named types
too, so the contract is declared once and propagates everywhere.
Note: desktop/src/main/index.ts still inlines its own copy. That's the
implementation side of the IPC boundary, and the desktop package can't
import from src/components/ without a cross-package alias. Living with
that duplication for now — it's the IPC contract surface, not internal
sharing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two fixes for the "minimum reading" goal:
1. EmptyStateWelcome — 5 near-identical card blocks reduced to a single
WelcomeCard subcomponent + 5 prop-driven instances. Original code was
the Rule of Three violated 5x: same icon/title/body/cta structure
copy-pasted with one-prop variations (Link vs button, accent vs muted).
Also tightened header copy: "Welcome to your fleet 🚀 / You don't have
any projects yet. Pick how you want to add the first one:" became
"Start your first project / Pick a path — every option is one click
away from a working fleet." Two fewer lines to read.
2. ControlPanel — suppress DaemonStatusBanner during the zero-project
daemon-never-seen state. That banner pitched "Start a new project" +
"Install Fleet Runner" as cards, and EmptyStateWelcome (rendered just
below) pitched the same two CTAs as cards. Same screen, same CTAs,
twice. Banner still fires for has-projects-but-no-daemon (legit:
they can't dispatch) and daemon-was-online-now-offline (legit:
troubleshoot).
No JSX palette colors, no arbitrary hex, no Tailwind palette utilities —
all tokens flow through globals.css → ui-* classes per the four-layer
design system.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two parallel "we already know your work" suggesters that turn the empty
/control state from "pick one of 5 cards and start typing" into "click
one button and you're done":
1. GitHubRepoSuggestions (browser + Fleet Runner alike)
When the user has a GitHub OAuth account linked AND no FleetCrown
projects yet, lists their 5 most-recently-updated owner-affiliated
repos and offers "Import all 5" via POST /api/projects/bulk-from-github.
Sits above EmptyStateWelcome so the easy path is the first option seen.
2. LocalDevSuggestions (Fleet Runner only)
New `getLocalDevProjects` IPC walks ~/dev, ~/code, ~/Code, ~/Projects
(overridable via FLEETCROWN_DEV_ROOTS env on the desktop process side)
to depth 3 for git repos. Returns the 50 most-recent. The web banner
shows the top 5 with "Import all 5" — POSTs to /api/projects/import-from-local
with the daemon's stored ck_* token. Skipped silently outside Fleet
Runner (no IPC method).
Also:
3. MissingCLIsBanner (Fleet Runner only)
New `getInstalledCLIs` IPC scans PATH for zellij + each of
claude/codex/grok/gemini/cursor. The banner renders ONLY when at
least one is missing, with per-CLI "Install Claude" buttons that
POST to /api/agent/install-cli (existing endpoint — daemon picks
the install up and opens a zellij tab with the installer pre-typed).
Replaces the silent-fail-on-dispatch problem.
UX north-star (per user direction today): "minimum reading, minimum
clicks, minimum page loads." Each banner is ≤4 lines of copy, single
primary action, fully collapsible (no banner shown when there's no
signal — e.g., no GitHub linked, no local repos, all CLIs installed).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds `window.fleetRunner.getInstalledCLIs()` so the web UI (when running
inside Fleet Runner) can render a clear "Install Claude" CTA instead of
silently dispatching to a missing binary — the prerequisite gap a new user
would hit on first launch.
Pieces:
1. desktop/src/main/index.ts: new `get-installed-clis` IPC handler.
Shell-exec'd `command -v <name>` against each of zellij, claude, codex,
grok, gemini, cursor. Result cached for the process lifetime (relaunch
to re-scan; mid-session installs are uncommon and don't need to be
reflected without a restart). Inherits PATH via shell -c so the scan
matches what `injectIntoTab` would see at dispatch time.
2. desktop/src/preload/index.ts: exposes `getInstalledCLIs` on the
`window.fleetRunner` bridge.
3. src/components/desktop/types.ts: adds the method to the canonical
FleetRunnerBridge type (optional, since older shipped builds won't
have it).
Web-side consumer (badge / banner in /control) will land in a follow-up
commit. Keeping the IPC change focused so the desktop release can ship
the prerequisite-scan capability even if the web UI for it isn't
deployed yet.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Right now if you're INSIDE Fleet Runner (the desktop app's BrowserWindow)
and need to pair the daemon, the flow was: go to /settings → mint a token
→ click "Open in Fleet Runner" deep-link → the protocol handler routes it
back to … the same process you're already in. Three clicks of friction for
no payload-vs-machine reason.
Two surfaces now detect `window.fleetRunner` and short-circuit straight to
IPC:
1. AgentTokenSettings (Settings → Agent tokens)
When the user mints a token AND we're inside Fleet Runner, auto-call
`window.fleetRunner.saveToken()` immediately and replace the deep-link
button with a "Paired with this Fleet Runner ✓" confirmation chip. If
the IPC fails (older desktop build missing the method, daemon refused
the token), show a retry button + error.
2. DaemonStatusBanner (the daemonNeverSeen banner on /control)
When inside Fleet Runner, the second CTA card transforms from "Install
Fleet Runner desktop" (silly — they already have it) to "Pair this
Fleet Runner" with a single "Pair now" button. The button mints a
fresh ck_* token labelled "Fleet Runner · MMM DD" and hands it to the
in-app daemon over IPC. Calls onRefresh() so the banner can self-hide
once the daemon's first push lands.
Solves the exact problem the user hit this week: after the Hetzner cutover,
their existing Fleet Runner daemon's old Neon-side token didn't validate
anymore, and the re-pair UX was opaque enough that they stayed broken.
Now it's one click from /control.
Defensive: window.fleetRunner methods are typed Optional in
src/components/desktop/types.ts (older shipped builds may lack newer
methods), so every call site checks for the method's presence before invoking
and falls back to the manual deep-link path otherwise.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was the bug behind 8 consecutive failed deploys today (every commit
since 9d95b3e). Production stayed pinned at the 2-hour-old odkjutalr
deploy while my afternoon shipped to /dev/null.
What broke:
- Earlier today I added AGENT_LABELS + ALL_AGENT_IDS to src/lib/agent-registry.ts
- control-presenter.ts (imported by ControlPanel "use client") imported them
- agent-registry.ts ALSO imports fs/child_process/path (for daemon-side
scanning/launch helpers)
- Turbopack pulls the full module graph for any reachable export, so the
client bundle for /control got dragged into fs/child_process resolution
- The Node built-ins are not resolvable in the browser/edge runtime →
"Module not found: Can't resolve 'fs'/'child_process'" → build fails
Fix:
- New src/lib/agent-labels.ts — a leaf file with NO Node imports.
Holds: ALL_AGENT_IDS (const tuple), AGENT_LABELS (record), AnyAgentId (type).
- src/lib/agent-registry.ts re-exports them for backward compat with
existing server-side callers.
- control-presenter.ts imports from agent-labels (clean) instead of
agent-registry (heavy).
Verified locally: `npm run build` Compiled successfully in 6.6min.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Closes 3 of 3 Tier-1 captain-mode surfaces from the 2026-06-04 thesis:
✓ Sessions drawer (cross-page inventory, live status)
✓ /decisions timeline (chronological feed of fleet activity)
✓ Fleet Brief card on /today (at-a-glance counts)
Where the prior two answer "what's happening now" and "what happened in
sequence", the brief answers "how busy was my week, at a glance" —
prerequisite signal for a captain deciding what to attend to.
Pieces:
1. components/today/FleetBriefCard.tsx
Pure server component. One paragraph of SQL aggregation:
- count(*) filter projects.createdAt >= today / week-start
- same for orchestration_runs.startedAt
- top 3 projects by run count this week
- active token count
Renders as a Today-page card alongside RecentRunsCard, CommitmentsCard,
etc. Three stat tiles (Projects / Runs week / Tokens) + a "most active
projects this week" list when populated.
Empty-state branches: if no projects yet, point to /control/new-from-
scratch. If projects exist but no activity, point to /control.
"See timeline" link in the header navigates to /decisions for the full
chronological feed.
2. /today page imports + Suspense-wraps the card above RecentRunsCard.
Performance: single SQL round-trip (4 parallel queries through one pool),
no daemon dependency, no shell-outs, no GitHub API calls. Cheap enough to
land on Today without bloating SSR time.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Completes 2 of 3 Tier-1 surfaces from the 2026-06-04 auto-injection thesis:
✓ Sessions Panel (drawer in AppShell) — done earlier today
✓ Decision Log (this commit) — "what did my fleet do and decide?"
○ Daily Brief (defer) — derives from these two
Pieces:
1. GET /api/decisions/feed?limit=N&project=<name>
Pulls from 3 cloud-side sources in parallel and merges by timestamp:
- entities (type=project) created → "Created project X"
- orchestration_runs finished → "<adapter> · <intent> on <project> (outcome)"
- agent_tokens minted → "Issued agent token"
No daemon required. Future sources to layer in: GitHub commits per
project (via OAuth token), debug_logs filtered to auth.*, cross-project
inbox messages.
2. /decisions page
Reverse-chronological list grouped by calendar day ("Today",
"Yesterday", "Tuesday Jun 3"). Per-project filter. Per-event icon +
tone (Sparkles for creation, Bot for runs, KeyRound for tokens).
Empty-state explains the gap when nothing has happened yet.
3. Navigation
Added NAV.decisions (icon: ScrollText, mobile: false) to the Work
group right after History. Showing up in sidebar between History
and System.
End-to-end:
Create project via cloud bootstrap → land on /decisions →
see "Today · 14:32 · Created project catsitting-startup" → click
Sessions drawer → see same project listed with its phase.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The auto-injection thesis (2026-06-04) flagged that /control answers
"what's happening on the focused project NOW" and /projects answers
"what's my inventory and health", but neither was a quick-glance "all
my agents at once" surface visible from any page. This is that surface.
Pieces:
1. GET /api/sessions/snapshot
Lightweight: joins entities + project_states + derives a coarse
phase (working / ready / open_idle / closed / offline / unknown).
No git shell-out, no zellij read, no agent process scan — pure DB
query. Suitable for polling every 30s from every authenticated page.
2. components/shell/SessionsDrawer.tsx
Slide-out right-side drawer, backdrop + Esc to close. Lists every
project with a colored phase dot, last-activity timestamp, and an
"Open repo" icon when entities.git_url is set. Clicking a project
navigates to /control?focus=<name> and auto-closes the drawer.
Empty state links to /control to create the first project.
Polls /api/sessions/snapshot every 30s while open; stops while closed.
3. AppShell wires open/close state and renders <SessionsDrawer/> at
the shell layer so the drawer is reachable from every authenticated
page (today, control, projects, money, …).
4. AppTopBar gets a LayoutPanelLeft icon button next to the
FleetRunner/Notifications pills. Optional `onOpenSessions` prop so
the bar still renders cleanly in isolation.
Deferred (not blocking):
- Cmd+J global keyboard shortcut (next iteration)
- SSE-driven updates instead of polling (the bridge already exists;
drawer just needs to subscribe to fc:state events for project_states
table changes)
- Filter / search inside the drawer when project count gets large
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The old banner promised "Generate a token below" but no token UI existed in
the banner. Three vague setup steps (install Zellij, pick an agent, run an
installer) without concrete commands. New users hit a dead end.
Rewrite of the daemon-never-seen branch:
- Lead with the two paths a builder actually chooses between:
A. "Start a new project" → /control/new-from-scratch (no install, works
today, GitHub repo + starter scaffold all from this website).
B. "Install Fleet Runner desktop" → /download (only required if you
specifically want to dispatch agents at LOCAL repos — clarified the
prerequisite).
- Collapsed advanced section for the terminal-only CLI installer path,
with the actual one-liner command pasted (curl … | node - init --token).
Rewrite of the daemon-offline branch (the situation a returning user is in
after the Hetzner cutover invalidated their old token):
- Surfaces a "Mint a fresh ck_* token" link to /settings so they can
re-pair Fleet Runner without hunting through the settings UI.
No new components — only DaemonStatusBanner JSX. The download page,
/control/new-from-scratch, /settings token-minting all already exist; this
just makes the paths to them discoverable from the first thing a new user
sees on /control.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Right now the GitHub URL for a project lived as text in the description
field (cloud bootstrap was concatenating it in) or as legacy attrs.repo.
Adding a real schema column makes it queryable, indexable, and a
predictable lookup path for the UI.
Schema:
- entities.git_url (text, nullable). Drizzle-kit push'd to Hetzner.
- All non-project entities (people, commitments, etc.) leave it null.
- Backward-compat: existing projects with attrs.repo still work — UI falls
back to that when the column is null.
Wired into:
- createProject(): accepts optional gitUrl in CreateProjectBody, persists.
- patchProject(): accepts optional gitUrl for inline edits.
- /api/projects/create-with-github (cloud bootstrap) → passes repo.html_url.
- /api/projects/bulk-from-github (multi-select import) → passes repo.html_url.
- /api/projects/import-from-local (terminal one-liner) → passes folder.remote_url
if the local repo has an origin remote configured.
- Description field for cloud-bootstrap no longer carries the URL inline —
it's now in the dedicated column, freeing description for actual prose.
UI:
- getProjectLinks() now takes an optional gitUrl as 2nd arg; entity column
wins over attrs.repo when both are set.
- ProjectGridCard's GitBranch quick-link icon (which was rendered behind
attrs.repo) now also lights up for projects with entities.git_url.
- ProjectDetailHeader same.
- /control's ProjectState type intentionally NOT extended yet — that pipeline
joins project_states + entities through a different code path; deferred to
a separate change (probably worth a small refactor to surface gitUrl on
ProjectState).
End-to-end: create a project via /control/new-from-scratch → repo gets
created with git_url populated → land on /projects → see the GitBranch
icon as a clickable link to the repo. One click from project list to repo.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>