The /whitepaper page reads content/whitepaper.md from process.cwd() at runtime.
That dir was supplied by a postbuild copy (deploy-local.sh) which raced with
next's standalone recreate, intermittently leaving .next/standalone/content
missing → /whitepaper 500 → repeated pre-push smoke failures that blocked
unrelated pushes.
Add ./content/** to outputFileTracingIncludes for /whitepaper so Next bundles
it into the standalone build output deterministically (no postbuild-copy race).
Verified after a clean rebuild: content present in standalone, /whitepaper 200,
service cwd is the live standalone.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
No version was shown anywhere in the app (only the public marketing footer had
one). Add a build stamp under the sidebar logo that links to /releases.
- next.config.ts bakes NEXT_PUBLIC_BUILD_SHA (git short SHA) + NEXT_PUBLIC_APP_
VERSION at build time. On the box the push-deploy hook builds locally then
rsyncs, so the SHA reflects the deployed commit.
- BrandVersion reads the User-Agent (via useSyncExternalStore, client snapshot
only — no hydration mismatch): the desktop app tags its UA FleetRunner/<ver>,
so the stamp shows "Fleet Runner <ver> · <sha>" in the desktop and
"build <sha>" in the browser. Makes the web-vs-desktop difference explicit —
the desktop wraps a deployed build that can lag your local server, so the
SHAs differ visibly.
- Click → /releases (existing changelog).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Session 4 of killing-the-bash-daemon plan, commit B — removes the
14 bash files that constituted the local execution stack the
TS consumers no longer reach (Session 4a wired Fleet Runner as the
sole local executor + retired the bundle endpoint).
Deleted (-4258 LoC):
scripts/fleetcrown-daemon.sh (1612)
scripts/agent-hook-bridge.sh ( 942)
scripts/agent-hook-lib.sh ( 528)
scripts/install-beacon.sh ( 214)
scripts/install-fleetcrown-daemon.sh ( 206)
scripts/fleetcrown-beacon-window.sh ( 111)
scripts/install-fleetcrown-beacon-window.sh ( 68)
scripts/_brand.sh ( 61)
scripts/smoke-beacon-stop.sh ( 63)
scripts/check-agent-runtime.sh ( 57)
scripts/install-fleetcrown-hooks.sh ( 53)
scripts/_agents.sh ( 47)
scripts/run-codex-task.sh ( 37)
scripts/run-gemini-task.sh ( 33)
Plus next.config.ts cleanup: the outputFileTracingIncludes block
for /api/agent/daemon listed 15 source paths (8 bash + 7 Python)
that Vercel's build needed in the deployment bundle. The route now
returns 410 Gone (Session 4a), so none of those paths need to be
traced — saves a few MB on each deploy and removes a class of
"build references deleted file" failures.
Net for Session 4 (a+b): -5527 LoC.
What survives:
Operational scripts unrelated to the bash daemon —
scripts/check-design-system.sh
scripts/control-states.generated.sh (regenerated by tsx)
scripts/deploy-local.sh
scripts/fleetcrown-app.sh
scripts/install-fleetcrown-app.sh
scripts/import-from-local.sh
scripts/migrate-local-to-neon.sh
scripts/mirror-desktop-release.sh
scripts/smoke.sh
scripts/test-home.sh
scripts/wait-for-vercel.sh
Plus the *.ts/*.mjs helpers under scripts/ that build the agent
bundle, run tests, generate types, etc.
Remaining ambient bash references in TS are doc comments naming
deleted files (orchestration/run, inject route, projects, watcher,
poller, config/brand, brand-env, control-presenter). They don't
break the build; they get swept in Session 4c (rename pass) along
with the cockpit→fleetcrown stale references.
The Python beacon stack (scripts/beacon.py, _beacon_config.py,
get-idle-secs.py, notify-choice.py, sync-agent-runtime-config.py,
transcribe.py) is left in place for this commit. It was called
only by the deleted bash bridge and is functionally dead, but it's
orthogonal to "no bash" — best handled in a follow-up Python-deletion
commit so this PR stays focused.
Verification: tsc clean, test:home 97/97, test:autopilot-defaults
11/11, test:dispatch-gates 11/11.
The acid test from content/thoughts/killing-the-bash-daemon.md is
fully met on this commit: `ps auxf | grep -E "bash|fleet"` shows
only fleet-runner-bin + next-server as FleetCrown-related processes.
A customer downloading Fleet Runner today never runs bash; the
founder's machine matches that stack.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The end-to-end push pipeline that replaces /api/control polling. This
commit ships the foundation; phases B-E light it up across the web,
desktop, and daemon. Read the architectural narrative in
/thoughts/from-polling-to-listening-fleetcrown-v0-6.
drizzle/0022_notify_triggers.sql
- Generic fc_emit_change() plpgsql function: receives (user_col,
key_col) via TG_ARGV, emits NOTIFY 'fc:state' with a compact
{t, u, k, op, ts} JSON payload. IDs only — no row content — so
the bus stays under Postgres's 8 KB NOTIFY limit even on bursts.
- AFTER INSERT/UPDATE/DELETE triggers on the five UI-relevant
tables: project_states, runtime_snapshots, pending_commands,
orchestration_runs, beacon_settings.
- Adding more tables in the future is two lines: drop + create
trigger pointing at the same fc_emit_change function.
bridge/ (new ~300-line Node service)
- src/server.ts — HTTP server with /sse (SSE endpoint, ?token=ck_*
auth, Last-Event-ID replay) and /healthz. CORS open; the bridge
sits on a different origin than Vercel and the desktop app.
- src/listen.ts — single dedicated pg Client running LISTEN
"fc:state" forever, with exponential-backoff reconnect on
disconnect. Notifications fan out to subscriptions.
- src/subscriptions.ts — in-memory Map<userId, Set<connection>>.
Per-user routing; fanout writes SSE frames; idempotent remove
on disconnect.
- src/auth.ts — validates ck_* tokens against agent_tokens using
the same plaintext lookup the cloud API uses (mirrors src/db/
queries/agent-tokens.ts validateAgentToken).
- src/types.ts — ChangeEvent and Subscription shapes.
- In-memory ring buffer (1000 events) for Last-Event-ID replay so
a brief disconnect doesn't drop state.
- Heartbeat (SSE comment) every 25s to keep proxies happy.
- Graceful SIGINT/SIGTERM shutdown with 5s hard-fail timeout.
- .env.example, .gitignore, README with the Oracle systemd deploy
runbook.
next.config.ts
- Exclude ./bridge/** from output: standalone tracing. Same lesson
as ./desktop/** — bridge has its own node_modules and is
deployed separately. Don't let Vercel bundle it into every
serverless function.
Verified end-to-end locally:
- psql UPDATE on project_states → fc_emit_change fires →
pg_notify reaches the bridge's LISTEN client → fanout to the
subscribed curl SSE connection in ~milliseconds.
- Per-user routing: a token bound to user A only receives events
for user A's rows; tested by minting under two different users.
- Last-Event-ID replay: reconnect with header skips already-
delivered events, then live events arrive immediately.
Next: Phase B (web client subscribes to the bridge instead of polling
/api/control). Phases C-E follow.
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>
- desktop build clean, tsc clean, lint 0, home/ 89/89
- advances desktop-2/3: dispatches now produce durable events in ~/.fleetcrown/events.jsonl with proper runId/sentinel so stop-hooks and web control plane treat them as first-class
- still no embedded watcher (idle via co-running home/watcher.ts for now)
Refs: desktop-app.md phases, Cockpit.roadmap T1/T2, prior landing 2d98638
After f3a08fd a new customer's daemon supports all three agents, but it
still dies on shell exit — the install incantation says "start the
daemon: ~/.local/share/cockpit/cockpit-daemon.sh" which is a foreground
process. The `--install` flag was supposed to register a systemd user
service via install-daemon.sh, but that file wasn't in the bundle and
the agent CLI only looked in process.cwd()/scripts/.
Three-file change:
• route.ts FILES + next.config.ts outputFileTracingIncludes add
install-daemon.sh (now 12 files in the bundle).
• cockpit-agent.js --install handler now prefers ${DAEMON_DIR}/
install-daemon.sh, falling back to process.cwd()/scripts/install-
daemon.sh for developers running from inside the repo.
install-daemon.sh's existing structure works in the flat ~/.local/share/
cockpit/ layout without modification: WorkingDirectory + ExecStart use
$SCRIPT_DIR (= the daemon dir, all 12 files siblings), and the token
arrives via env from the CLI's spawn — bypassing the PROJECT_DIR/
.env.local fallback that would have been wrong for non-clone users.
After this, `curl … | node - init --token ck_… --install` enrolls the
daemon as a systemd user service in one shot — survives shell exit,
reboot, and restarts on failure.
The 4-file bundle that 02c2551 shipped is enough for a new customer
running the Claude agent — but agent-hook-bridge.sh references seven
more sibling files at $SCRIPT_DIR, and absence is silent failure:
• run-codex-task.sh / run-gemini-task.sh — HARD fail when dispatching
those agents (the bridge invokes `bash $SCRIPT_DIR/run-<agent>-task.sh
...` with no fallback path; tab gets the command but the runner
doesn't exist)
• beacon.py (+ _beacon_config.py import) — audio beacon silently no-op
• get-idle-secs.py — X11 idle detection falls back to "always idle"
• notify-choice.py — zenity prompt silently fails
• sync-agent-runtime-config.py — silent no-op
Each Python helper is wrapped in `|| true` / `2>/dev/null` in the
bridge so the daemon doesn't crash, but the feature degrades and the
user has no signal why. The codex/gemini runners DO crash dispatch
for those agents.
Two-file change: add the 7 missing files to FILES in route.ts and to
outputFileTracingIncludes in next.config.ts. All cross-references in
the added files resolve within the bundle (run-*.sh call back into
agent-hook-bridge.sh; beacon.py imports _beacon_config — both shipped).
Bundle grows from 4 files / ~20 KB compressed to 11 files / ~28 KB —
still under one HTTP round trip.
Verified locally with the same pure-Node ustar builder the route uses
(scripts/test-tar-v2.mjs equivalent): all 11 files extract at the
destination root, bytes-identical to repo source, 0755 mode, valid
under system `tar -tz`. Tsc + eslint clean.
After this lands, a new customer's daemon supports Claude, Codex, AND
Gemini agent dispatch end-to-end without a repo clone.
Closes the second half of the connect-step gap. Last week's 422873a
made `curl|node - init --token X` reachable for new customers (the
agent CLI was served via /api/agent/install). 15727a7 added an
honesty disclaimer that the daemon scripts still required a Cockpit
repo clone. This commit removes the disclaimer by shipping the
scripts the same way.
• New /api/agent/daemon route spawns `tar -czf - -C scripts/ …`
with the 4 daemon files (~1500 lines bash: cockpit-daemon.sh,
_brand.sh, agent-hook-lib.sh, agent-hook-bridge.sh) and returns
the gzipped tarball (~20 KB).
• next.config.ts outputFileTracingIncludes pins those 4 source
files to the route so Vercel ships them in the bundle (the route
reads them via spawn at runtime — they'd otherwise be tree-shaken).
• src/proxy.ts matcher exception adds api/agent/daemon so the
download works pre-auth.
• packages/agent/bin/cockpit-agent.js gets a new downloadDaemon()
step inside `init`: after writeEnvFile, fetch the tarball, pipe
into `tar -xz -C ~/.local/share/cockpit`, chmod +x the two
executables. Soft-fail with a warning if it errors — the token
write still lands and the user can retry by re-running init.
• ConnectMachineStep step 3 drops the "requires repo clone, public
installer coming soon" caveat in favor of the actual path
(~/.local/share/cockpit/cockpit-daemon.sh).
After this, a brand-new customer's path is:
1. Sign up + onboarding (username + project + connect)
2. Generate token → copy one curl command → paste into terminal
3. ONE command installs both the env file AND the daemon scripts
4. Run ~/.local/share/cockpit/cockpit-daemon.sh and they're live
No repo clone. No npm publish dependency. Customer-#2-ready.
The connect step instructed new users to run
`npx @cockpit/agent init --token ck_...`, but:
• `@cockpit/agent` is NOT published to npm — `npm view` returns 404
• The repo is private, so raw GitHub fallback URLs are also gated
• Result: every new customer hit a dead end at step 3 of onboarding
The CLI itself is fully implemented at packages/agent/bin/cockpit-agent.js
(144 lines, no external deps — only Node builtins + global fetch). It just
isn't reachable from outside this repo.
Three-piece fix that ships value today without needing npm publish:
1. New route /api/agent/install (Node runtime) reads the script body
and serves it as application/javascript. Public, cached 5 min.
2. next.config.ts outputFileTracingIncludes pins packages/agent/bin/**
to that route so Vercel's tracer ships the file in the bundle
(otherwise tree-shaken — the route reads it via fs at runtime).
3. src/proxy.ts matcher exception adds api/agent/install so the
curl request reaches the route without a session cookie.
4. ConnectMachineStep init command swaps to:
curl -fsSL ${APP_URL}/api/agent/install | node - init --token ...
The npx form is left in a comment for the eventual swap-back when
@cockpit/agent ships to npm publicly.
What this still does NOT fix (out of scope for one commit): the daemon
script (`./scripts/cockpit-daemon.sh`) still requires a cockpit repo
clone — the agent CLI only writes the token env file. That's the next
layer of the "no public install path" gap.
First-run flow:
- /setup page + /api/setup: creates first user with hashed password
(Node crypto scrypt, no new deps). POST rejects if users already exist.
- Landing page redirects to /setup when DB has no users
- middleware.ts: protects app routes, passes public pages through
Auth:
- passwordHash column added to users schema (drizzle-kit push applied)
- src/lib/password.ts: hashPassword/verifyPassword via Node scrypt
- auth.ts Credentials: env var takes priority, falls back to DB hash
so packaged installs work without LOCAL_AUTH_PASSWORD
Multi-tenancy groundwork:
- Replaced DEFAULT_USER_ID with getCurrentUserId() across all 12 API
route files (people, subscriptions, events, goals, projects, commitments)
Docker:
- Dockerfile: multi-stage Node 22 alpine, standalone output
- docker-compose.yml: postgres + migrate + app services
- .dockerignore, .env.example with documented required vars
- next.config.ts: output: standalone
- package.json: added migrate script (drizzle-kit push)
- tsconfig.json: scope to src/ only, exclude .next generated files
Install: clone → cp .env.example .env.local → docker-compose up
First visit → /setup → create account → sign in → done.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Auth & multi-user:
- GitHub OAuth via next-auth DrizzleAdapter; signIn callback absorbs first
login into is_default=true user so all pre-auth data stays accessible
- getCurrentUserId() helper; onboarding + profile pages
- normalizeUsername() extracted to lib/username.ts (DRY fix)
Design system:
- All public pages (landing, sign-in, onboarding, settings) rebuilt to use
ui-* classes and semantic tokens only — zero raw Tailwind color violations
- ui-input, ui-btn-*, ui-panel, bg-surface-*, text-text-* throughout
Reliability (M1–M7):
- M1: Stale claude-stop-active lock cleanup on stop hook entry
- M2: /api/inject validates tab exists in Zellij before writing /tmp
- M3: Prompt SSOT unified — claude-prompts.json single array format
- M4: DBUS UID hardcode removed (already in dotfiles)
- M5: auth.ts signIn callback + AdapterAccountType cast
- M6: project_states DB table — persists ready/closing/closed/session/prompt
across reboots; stop.sh PATCHes on stop/close; control falls back to DB
when /tmp is empty (24h window); inject writes currentPrompt to DB
- M7: scheduleOpenClawWorker now async; waits for spawn event (2s timeout);
marks run as error in DB if worker fails to start
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>