Commit Graph
53 Commits
Author SHA1 Message Date
Mao NakamotoandClaude Fable 5 4c8ab5425c feat(infra): exit Vercel — FleetCrown lives at fleetcrown.orangecat.ch
- swap dead fleetcrown.vercel.app for fleetcrown.orangecat.ch across src/,
  desktop/, README (Vercel team blocked for fair-use; serving 402s)
- scripts/deploy-hetzner.sh: build + rsync standalone + restart the
  fleetcrown-app unit on the bitbaum box (Caddy already vhosts the domain)
- brand.ts APP_DOMAIN remains the SSOT; historical thoughts essays keep the
  old domain as written

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 13:47:00 +02:00
Mao NakamotoandClaude Opus 4.7 cc3cb65425 fix(desktop): wire dispatch decision through to /api/inject
Session 2's desktop/src/main/dispatch.ts POSTed /api/control/dispatch
and parsed back {action, reason} but never acted on the verdict —
"action=nextbest" sat in a console.log instead of becoming an
actual inject. The end-to-end loop was technically open.

Surfacing the gap mid-rebuild today (the founder asked to "try it
out"). The new postInject() helper closes the loop: when dispatch
returns action=queue we POST /api/inject with customPrompt set to
the queue head; when it returns nextbest we POST with promptKey:
"next_best" and let the cloud's prompt resolver expand it. The
cloud route queues a pending_command, Fleet Runner's poller.ts
(already wired since v0.4.0) claims it and types into zellij.

Mirrors the bash bridge's emit_or_inject_prompt that Session 1
retired — dispatch is still just the decision oracle; inject is
still the execute step; they're just both in TS now and live in
the same module.

action="off" or unknown → no inject. The decision was already
recorded in control_audit_events on the cloud side; nothing to do
locally.

Verification: tsc clean for both repo and desktop. End-to-end test
follows in the next Fleet Runner rebuild (currently in flight) +
acid-test fire when this turn ends with status: ready.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-11 08:15:55 +02:00
Mao NakamotoandClaude Opus 4.7 b39a05b406 feat(desktop): Fleet Runner becomes the autopilot trigger
Session 2 of killing-the-bash-daemon plan (/home/g/.claude/plans/
structured-baking-kazoo.md). Replaces the bash Stop hook bridge —
neutralized in Session 1 — with a pure-TS path that lives entirely
inside Fleet Runner.

New module: desktop/src/main/dispatch.ts (~140 LoC). Exports
dispatchAutopilot({project, handoff}) which:

  - Gates on handoff.status === 'ready' (only fire when the agent
    self-reports done)
  - Per-project cooldown (default 300s, env-tunable via
    FLEETCROWN_AUTOPILOT_COOLDOWN_S) — mirrors the bash bridge's
    cooldown that the 2026-05-31 revamp-it tight-loop incident
    introduced. The status gate alone doesn't break that loop; the
    cooldown does.
  - Fetches the queue from /api/beacon/queue/<project> with a 4s
    timeout (DB is authoritative; no /tmp mirror needed since Fleet
    Runner isn't a bash process).
  - POSTs the same DispatchBody shape the bash bridge sent — handoff,
    blockerCount, noOpCount, queue, projectName, projectKey. Cloud is
    authoritative on mode (auto_inject_mode=off returns action:off).
  - Retries with exponential backoff (3 attempts, 0/1000/4000ms) on
    5xx and network errors. 401/403 short-circuit because token
    rotation belongs to the pusher, not here.
  - Offline-tolerant: dispatch failure is non-fatal. The next
    status:ready transition tries again. The trigger is the session
    file write, which is durable.

Wire: desktop/src/main/index.ts notifyOnIdle (already invoked by the
embedded home/watcher.ts on every session-file change) now calls
dispatchAutopilot when handoff.status === 'ready'. Type annotation
widened from {done,next,health} to the full Handoff from @/lib/events
so dispatch.ts gets status/tests/todos correctly.

What this delivers:
  - Before this commit: bash Stop hook neutralized in Session 1, so
    autopilot fires required manual /control dispatch. Fleet Runner
    polled commands but had no trigger of its own.
  - After this commit: Fleet Runner detects status:ready via the
    embedded watcher → posts dispatch → cloud writes a pending_command
    → Fleet Runner's existing poller (poller.ts) picks it up and
    types into zellij. End-to-end TS, no bash anywhere in the path.

Verification (static): tsc clean for both repo and desktop, lint
clean, test:home 97/97.

Verification (end-to-end): requires a Fleet Runner rebuild +
reinstall (the currently-running v0.8.0 binary at /opt/Fleet Runner/
does NOT have this code). Run `cd desktop && npm run dist:linux`,
install the resulting package, restart Fleet Runner, then emit
status:ready and watch the Electron console for `[autopilot] <P>
dispatched: action=...` log lines.

Sessions 3-5 follow per the approved plan.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-11 06:56:27 +02:00
Mao Nakamoto 8b9b07b67c fix: make prompt activity use one display source 2026-06-10 15:49:29 +02:00
Mao Nakamoto cdc042a131 feat: ship activity runtime parity fixes 2026-06-10 14:57:19 +02:00
Mao NakamotoandClaude Opus 4.7 bdd4fc14f7 feat(fleet): cold-start restoration + reliable injection
After a PC restart, Fleet Runner now brings zellij + every agent back
without the user opening a terminal or typing CLI names. The last
runtime_snapshot.panes (extended with {tab, paneIndex, agentCli, cwd})
acts as SSOT for "what should be running" — Fleet Runner generates a KDL
layout with embedded `bash -c "cd … && claude"` per pane and spawns
`zellij --session fleet --layout`, bypassing zellij's press-ENTER
resurrection prompt entirely.

Injection is now self-healing end-to-end. Pre-flight ensureZellijReady
re-spawns the session if it died mid-day. /tmp/fc-cmd-<id>.done sentinels
make commands actually idempotent so a PATCH-ack retry can't fire the
same prompt twice. Post-flight watches ~/.claude/sessions/<tab>.md mtime
for 5s after inject and reports verified=false if the agent didn't pick
up — surfaced in AttentionBar via getRecentFailedCommands. The legacy
"No Zellij session found — start Zellij first" throw is replaced with a
synchronous spawn-default-session path so /api/agent/launch on
self-hosted servers self-heals too.

Settings → Agent gets a new Fleet Lifecycle section (auto-restore on/off,
fresh-spawn vs leave-alone for exited zellij sessions, session name,
auto-start at login). Stored as users.fleet_settings jsonb so future
knobs don't need a migration each time.

Bundled binary version-aware (Fleet Runner ≥0.4.0 ships zellij in
resources/bin and prepends to PATH). Inline tests for the KDL generator
run as a 9th suite under `npm run test:home` — 8/8 cases pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-08 18:47:58 +02:00
Mao NakamotoandClaude Opus 4.7 eaeaa44356 feat(control): agent switching v0.8.0
Users switch agents from the Control UI without typing quit commands in
Zellij — click the agent chip on a project card, pick from Cmd+K palette,
or accept the rate-limit banner's fallback suggestion. Detection lives in
agent-resolution.ts (client-safe) + agent-process-scan.ts (server /proc
walk); switch enqueues pending_commands type switch_agent which the Fleet
Runner poller executes locally, quitting every running agent in the dir
before launching the next.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-08 18:46:30 +02:00
Mao NakamotoandClaude Opus 4.7 729237cd69 feat(control): structured loop-control fields end-to-end
Phase 1 of the sustainable autopilot-control refactor. Adds explicit
block-reason + no-op-count fields to the session.md handoff, plumbs
them through parser → desktop pusher → API → DB → React, and updates
the bash guard to read them directly. Eliminates the three-vocabulary
problem that caused the OC no-op spiral on 2026-06-08, where agent's
"health: critical — awaiting user" string collided with the bash
guard's first-word match.

Schema:
- ORCHESTRATION_TASK_SUMMARY_FIELDS gains "block-reason" + "no-op-count"
- SessionState gains blockReason?: string + noOpCount?: number
- project_states adds session_block_reason + session_no_op_count columns

Pipeline:
- control-fast-state.parseSession projects kebab-case → camelCase
- desktop pusher payload + runtime-state route + persistSessionIfNewer
  all carry the new fields
- /api/control/route + /api/control/stream re-emit them to React

Consumers:
- session-state.ts derivations prefer structured fields, fall back to
  content-sniffing for pre-2026-06-08 sessions
- autopilot-needs-fire bash guard reads block-reason + no-op-count
  directly; same fallbacks active
- agent-hook-bridge + fleetcrown-daemon handoff templates and the
  blocker_create SPACE prompt now instruct agents to emit the fields

Memory of why this exists: OC ran 21 no-op turns (~60k tokens) in an
hour because three layers parsed the agent's intent from free text
with different rules. Phase 2 (daemon owns the should-fire decision)
follows; bash guard's content-sniff fallbacks live until every agent
has rotated through the new template.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-08 15:50:30 +02:00
Mao Nakamoto deda43539b fix(desktop): make remote zellij control reliable 2026-06-08 13:12:22 +02:00
Mao Nakamoto 964b1d67f4 fix(desktop): detect user-installed agent CLIs 2026-06-08 12:23:45 +02:00
Mao Nakamoto 40cbf877d4 fix(desktop): push rich runtime snapshots 2026-06-08 11:52:28 +02:00
Mao Nakamoto 948934158a feat(desktop): v0.7.6 remote command control 2026-06-08 09:16:13 +02:00
Mao Nakamoto 797fa998e7 fix(control): repair local project sync and desktop command draining 2026-06-08 09:09:21 +02:00
Mao Nakamoto 8604d97a69 feat(desktop): v0.7.4 — Phase 1, delete bundled renderer + dead IPC
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.
2026-06-07 16:14:19 +02:00
Mao Nakamoto c04bb464f1 fix(desktop): v0.7.3 — clear stale tokens on 401 + Cockpit title purge
Dogfooded v0.7.x today and hit two real bugs that kept the user stuck on
the broken bundled-renderer experience even with v0.7.2 binaries live.

ROOT CAUSE 1 — Permanently-stuck dead tokens.
The pusher and poller both stop on 401/403 but DID NOT delete the stale
token file. FleetRunnerAutoMint's bail check is 'if (existing) return',
so a user with a dead token (revoked, expired, server-side row gone) is
permanently locked offline: the daemon never recovers, no fresh token
gets minted, /control reads 'Daemon offline' forever.

Fix in BOTH desktop/src/main/{pusher,poller}.ts: on 401/403, call
clearToken() before stopping. Next time FleetRunnerAutoMint mounts in
/control (next page navigation or relaunch), it sees no existing token,
mints a fresh one from the user's signed-in session cookie, saves it
via IPC. saveToken() already restarts the poller + pusher, so recovery
is automatic from there.

Verified on my own machine: my saved token from 2026-06-06 14:24 is
returning 401 against /api/control/runtime-state (server doesn't
recognize it). Pre-fix: every subsequent launch reads the same dead
token, pusher 401s once, gives up. Post-fix: pusher 401s, deletes
file, gives up; next /control load triggers auto-mint to fresh token.

ROOT CAUSE 2 — Stale 'Cockpit Fleet Runner' window title.
Caught earlier this session: desktop/src/renderer/index.html still had
the pre-rename title hardcoded. Window manager picks that up before
the loaded /control page's title swaps it in, so taskbar showed
'Cockpit Fleet Runner' for a beat on every launch and as a permanent
state on bundled-renderer fallback. Already fixed in source, ships
with this release.

Version bump 0.7.2 → 0.7.3. Both bugs only affect FRESH desktop
binaries; v0.7.0 / v0.7.1 / v0.7.2 are unaffected at the source level
because the bugs were structural-in-shipping-code. After this commit
lands + CI builds + mirror finishes, electron-updater on v0.7.0+
installs will pick up v0.7.3 on next launch.
2026-06-07 14:22:59 +02:00
Mao Nakamoto 6fafd2233d fix(desktop): purge stale 'Cockpit' branding from renderer index.html
desktop/src/renderer/index.html still had <title>Cockpit Fleet Runner</title>
from before the FleetCrown rename. Caught it dogfooding v0.7.x today — the
running v0.7.0 install shows up in the window list as 'Cockpit Fleet Runner'
because the OS WM reads the document title before the web-shell loadURL
swaps it.

Impact:
  - v0.7.0 users: see 'Cockpit Fleet Runner' in their taskbar / alt-tab list
  - v0.7.2+ users in WEB-SHELL mode (default): never see it — the loaded
    page's title 'Control — FleetCrown' takes over within ms of paint
  - v0.7.2+ users in LOCAL mode (FLEETCROWN_WEB_URL=local) or on a cloud
    fallback: would still see it
  - User in dogfood today saw 'Cockpit Fleet Runner' in xdotool output and
    asked what was up

Title is now 'Fleet Runner'. Renderer-bundled fallback gets the same
branding as the cloud-loaded primary surface.

This is source-only — doesn't affect the already-shipped v0.7.1 / v0.7.2
binaries. Ships with the next desktop release (v0.7.3 or whenever).
2026-06-07 14:15:05 +02:00
Mao Nakamoto d7dfe0bb5c refactor(quality): batch 1 — daemon constants, token-store, ansi-strip, agent-list SSOT
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
2026-06-06 15:27:36 +02:00
Mao Nakamoto b73bb9a8d4 feat(desktop+web): v0.7.2 — peek tab contents from /control
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.
2026-06-06 14:54:46 +02:00
Mao Nakamoto d68ffbff24 fix(desktop): v0.7.1 — REVERT Phase C primary flip, web-shell default again
v0.7.0 shipped USE_WEB_SHELL=false; the bundled local renderer became
the boot target. User QA on 2026-06-06 launched the installed app and
saw:
  - '0 active projects' (renderer reads agent-projects.conf, NOT the
    cloud DB; user's actual FC projects invisible)
  - Dev-surface copy ('YOUR MACHINES. YOUR AGENTS. / BUILT FOR BUILDERS
    WHO RUN REAL FLEETS') that has no place in a customer build
  - 'Sync error: Failed to fetch' on the connect-to-cloud action

That's not the experience anyone should ship. The Phase C VISION
(local-first renderer with parity to /control) stands — it's
task #44, v0.7.1+ work, multi-day real build. Until that ships,
the default reverts to v0.6 behavior: Fleet Runner opens the
fleetcrown.vercel.app UI inside Electron. Same UI users know from
the browser, same projects, same dispatch, no surprise.

Cursor / Anthropic / Grok ship the same pattern at this stage.
Local-first renderer is the destination, not v0.7.0's reality.

Bundled renderer stays OPT-IN via FLEETCROWN_WEB_URL=local for
power-user dogfooding while parity work happens in the background.
desktop/package.json: 0.7.0 → 0.7.1. Existing v0.7.0 installs
auto-update on next launch (electron-updater wired since v0.3.0).
2026-06-06 14:28:44 +02:00
Mao NakamotoandClaude Opus 4.7 e433334429 feat(desktop): Change 6 — typed command boundary at the IPC
Pre-v0.7 handleCommand cast command.payload as { tab?, prompt? } — an
unchecked cast that worked while the cloud was the only source and we
trusted its serialization. Change 5 (autonomous scheduler) is about to
start INSERT'ing pending_commands unattended via cron; an unchecked
cast at the boundary lets a typo'd cron payload through to
injectIntoTab() where the failure mode is less actionable.

New: desktop/src/main/command-validator.ts. Discriminated-union
ValidatedCommand + per-type validateCommand(raw) returning either
{ok:true,command} or {ok:false,error}. Hand-rolled guards (no zod) to
keep the main-process bundle lean — one validator function isn't
worth a runtime dep. Mirrors the cloud-side per-type payload contracts
in src/db/schema/pending-commands.ts; keep the two in sync by hand
until a second command type joins the desktop's executor.

Poller updated to validate before dispatch:
  - inject: tab + prompt must be non-empty strings; optional fields
    type-checked when present (not just when absent)
  - unknown types: rejected with an actionable message naming the
    file where to add the new type
  - the catch around the executor remains for runtime injection errors
    (zellij subprocess failures), distinct from validation errors

Defensive prerequisite for Change 5. Standalone safe.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-05 20:04:48 +02:00
Mao NakamotoandClaude Opus 4.7 28f775c715 feat(desktop): v0.7 Phase C — bundled local renderer is primary
The v0.6 essay called for local-first: cloud as the thin sync layer,
local as the source of truth for project state and dispatch. The
desktop's USE_WEB_SHELL default was the lever blocking that — set to
true, every launch loaded fleetcrown.vercel.app inside Electron and
the bundled renderer was a fallback for cloud failure.

v0.7 flips it. Initial-mode resolution:

  - No saved ck_* token at ~/.config/fleetcrown/fleet-runner-token →
    boot CLOUD (user needs to sign in; auto-mint drops the token).
    Subsequent launches go local.
  - FLEETCROWN_WEB_URL=https://... → boot cloud (preserves dev /
    preview deploy workflows; also becomes the "Try cloud" target).
  - FLEETCROWN_WEB_URL=cloud → boot cloud at APP_URL.
  - FLEETCROWN_WEB_URL=local or unset, token present → boot LOCAL.

WEB_SHELL_URL is now always defined (defaults to APP_URL) so the
"Try cloud" button works regardless of initial mode. Pre-v0.7,
probe-cloud and switch-to-cloud both gated on USE_WEB_SHELL and
silently no-op'd when the user booted local — the button was broken
in exactly the mode that needed it most.

Factored the conflation: USE_WEB_SHELL now means "boot cloud?"
exclusively. WEB_SHELL_URL means "the cloud URL" exclusively. They
were one variable doing two jobs.

Bundled renderer (desktop/src/renderer/) already shows runtime
status, project list from agent-projects.conf, dispatch UI, token
management, and a "Try cloud" button. It is less feature-rich than
the cloud view today (no /control orchestration runs, no prompt
library) — those land via the cloud view click-through. Reaching
feature parity for the daily-driver flows is the Phase C follow-up.

desktop/package.json bumped 0.6.0 → 0.7.0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-05 16:04:50 +02:00
Mao NakamotoandClaude Opus 4.7 c400cbdfd2 feat(bridge): desktop poller subscribes to SSE; delete /control polling baseline
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>
2026-06-05 14:15:49 +02:00
Mao NakamotoandClaude Opus 4.7 475283ed9c feat(onboarding): one-click bulk-import from GitHub + local ~/dev
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>
2026-06-05 10:28:36 +02:00
Mao NakamotoandClaude Opus 4.7 a4440fe7b1 feat(desktop): IPC for local CLI detection — surface zellij + agent prerequisites
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>
2026-06-05 10:01:57 +02:00
Mao NakamotoandClaude Opus 4.7 0b77c876ac feat(desktop): v0.6.0 — version bump + tray quick-links
Two small but signalling changes:

1. desktop/package.json: 0.5.1 → 0.6.0
   Aligns the version with the v0.6 platform series (Postgres LISTEN/NOTIFY
   bridge + SSE + Hetzner cutover + cloud bootstrap + Sessions/Decisions/
   Brief surfaces). The auto-pair flow from this morning's commit lands
   under this version.
   The next `git tag fleet-runner-v0.6.0 && git push origin fleet-runner-v0.6.0`
   triggers .github/workflows/desktop-release.yml — releases are gated on
   the tag, not on this bump alone, so this commit is safe to merge before
   the user is ready to cut a build.

2. desktop/src/main/index.ts tray context menu
   Was: "Show Fleet Runner / Quit". Two items. Lacked any quick-navigation.
   Now: jumps directly to Control, /control/new-from-scratch, /decisions,
   or /settings via a single tray click. Replaces the BrowserWindow URL
   in web-shell mode (USE_WEB_SHELL); in bundled-renderer mode it just
   surfaces the window since the router state lives in the local React
   tree.

The tray quick-links use a shared `surfaceAt(path)` helper that show()s +
focus()es + loads the URL — minimal, fits the "tray = one-click bounce
to a page" model. Order matters: Control first (most common entry),
then create flow, then logs, then settings, then quit at the bottom
where it can't be misclicked.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-05 09:54:15 +02:00
Mao NakamotoandClaude Opus 4.7 e36beafafe feat(v0.6): Phase B + D — web SSE subscription, daemon event-driven push
Phase B (web client):
  src/lib/event-stream.ts — useEventStream() hook that opens an
    EventSource to the bridge for the component lifetime, mints a
    per-session ck_* token via /api/event-stream-token, fires onChange
    for every "change" frame. Auto-reconnect with Last-Event-ID replay.
    No-op gracefully when NEXT_PUBLIC_FLEETCROWN_BRIDGE_URL is unset.
  src/app/api/event-stream-token/route.ts — server-side endpoint that
    mints a fresh ck_* labeled "event-stream" for the signed-in user.
    no-store headers since the response contains a secret.
  src/hooks/use-control-data.ts — when bridge is configured, poll
    interval flips from 30s → 5min and SSE drives freshness. Bursts
    coalesced into a single refetch via 200ms debounce.

Phase D (desktop daemon):
  desktop/src/main/pusher.ts — heartbeat interval bumped from 60s to
    5min (now a liveness signal only). New pushNow() helper coalesces
    event-driven pushes so a burst of worker.idle events triggers one
    POST, not N.
  desktop/src/main/index.ts — notifyOnIdle now calls pushNow() so the
    cloud learns about agent state changes within seconds instead of
    waiting for the next heartbeat. Same code path that already shows
    the local OS notification — both ride the same watcher event.

Combined egress reduction once bridge is deployed on Oracle:
  /api/control polling:           9 GB → 0.4 GB/user/mo (22x)
  Daemon runtime-state heartbeat: 300 MB → 60 MB/user/mo (5x)
  +event-driven pushes on agent idle: ~10 MB/user/mo
  Total: ~18 GB → ~470 MB/user/month (38x reduction)

Activates by setting NEXT_PUBLIC_FLEETCROWN_BRIDGE_URL on Vercel and
deploying the bridge on Oracle (Phase E).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-04 11:23:07 +02:00
Mao NakamotoandClaude Opus 4.7 09c46bbb81 fix(desktop): v0.5.1 — single source of truth for the local-renderer swap
Manually dogfooded v0.5.0 by launching with FLEETCROWN_WEB_URL pointed
at an intentionally-unresolvable host. The fallback to the bundled
renderer worked — log shows "cloud unreachable (-105: ERR_NAME_NOT_RESOLVED)
... falling back to bundled local renderer" and "loaded bundled local
renderer (cloud-independent mode)" — but then:

  Failed to load URL: https://this-host-definitely-does-not-exist.invalid/
  with error: ERR_NAME_NOT_RESOLVED
  failed to load web shell: Error: ERR_ABORTED (-3) loading
  'file:///.../out/renderer/index.html'
  [desktop] loaded bundled local renderer (cloud-independent mode)  ← second call!

The bundled renderer was loading TWICE because two paths both called
loadBundledRenderer():
  1. setImmediate(...).catch on the cloud loadURL promise rejection
  2. did-fail-load on the network failure event

Both fire for the same DNS error. The second loadFile() aborted the
first with ERR_ABORTED, polluting the logs and risking torn state.

Fix: did-fail-load is the single source of truth for the swap. The
setImmediate catch just logs the error and lets did-fail-load do the
work. One swap, no race.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-04 08:33:36 +02:00
Mao NakamotoandClaude Opus 4.7 3190d062a4 feat(desktop): v0.5.0 — local-first fallback when cloud is unreachable
The local-first promise: Fleet Runner is functional when the cloud is
down. Before v0.5.0, a Vercel outage or DB quota event (like the one we
hit today) left the desktop app showing a "FleetCrown is offline" data
URL with a retry button — useless. v0.5.0 falls back to the bundled
local renderer instead, which talks to the main process via IPC and
keeps every local capability (dispatch into Zellij, watcher, agent
session inspection, token management) working without the cloud.

Flow:
  1. Boot → splash → try cloud web shell (fleetcrown.vercel.app)
  2. Cloud unreachable / did-fail-load → load bundled renderer
  3. User clicks "Try cloud" in the bundled renderer header
     → probe-cloud (fetch /api/health, 4s timeout)
     → if reachable: switch-to-cloud (loadURL the web shell)
     → if not: stay in local mode, surface the result

New IPC channels (preload bridge updated):
- probe-cloud   → boolean (fast reachability check)
- switch-to-cloud → boolean (navigate window back to web shell)

The bundled renderer already had IPC for dispatch/projects/token/poller
(see App.tsx — it was the dev-only renderer until now). v0.5.0 promotes
it from "developer surface" to "primary surface when cloud is down."

Limitation (documented, not blocking): the bundled renderer's UX is
simpler than the cloud web app — no full project cards, no /today, no
/settings. Future v0.6+ work: render those locally too by reading
~/.fleetcrown/events.jsonl + ~/.claude/sessions/*.md directly. The
plumbing for that already exists in home/ and the embedded watcher.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-04 08:21:20 +02:00
Mao NakamotoandClaude Opus 4.7 99c67f9bd4 perf(db): halve /api/control DB load via cache header + 60s pusher interval
Two cheap egress reductions before deeper restructuring:

1. /api/control GET response carries `Cache-Control: private, max-age=5`.
   Multi-tab users, rapid SWR refetches, and sub-component re-mounts now
   serve from the browser's local HTTP cache instead of running the full
   query chain on every navigation. Per-user payload so we use `private`
   (no shared edge cache). 5s freshness keeps the page feeling live while
   absorbing burst traffic.

2. Fleet Runner runtime-state pusher: 30s → 60s. The daemonOffline check
   considers >90s without a push as offline, so 60s still leaves a 30s
   safety margin while halving heartbeat egress. The daemon still shows
   "sync 30s ago" worst case, which is fine.

Context: the production Neon DB hit its data-transfer quota a couple of
hours ago, taking down every DB-backed endpoint (/control, /settings,
/system, sign-in, daemon poller, runtime-state pusher). Local Postgres
keeps working, but the prod outage exposed how chatty the cloud paths
were. These two changes plus the upcoming migration to self-hosted PG
(no egress charge) put us on a healthier baseline.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-04 08:10:27 +02:00
Mao NakamotoandClaude Opus 4.7 7c66e73437 fix(desktop): v0.4.4 — runtime-state pusher so daemon shows online on web
CRITICAL — v0.4.0 through v0.4.3 shipped the poller (cloud → local
commands) but no pusher (local → cloud heartbeat). Result: /control
correctly received dispatch but the web UI rendered "Local daemon
offline · last seen Xm ago" the whole time, because /api/control's
isRuntimeAvailable() check only flips to true after somebody POSTs to
/api/control/runtime-state within the last 90 seconds. Nobody was.

Added desktop/src/main/pusher.ts:
- Loads ~/.config/fleetcrown/fleet-runner-token (same path as poller).
- POSTs /api/control/runtime-state every 30s with: openTabs from
  getZellijTabs(), projects: [], observedAt: Date.now().
- Fires once immediately on start so the "daemon online" indicator
  flips within seconds of launch, not after the first 30s tick.
- On 401/403: stops itself (token rejected, nothing to retry).
- Other failures: logged, skipped, retried next tick (network blip,
  cloud outage, etc.). Daemon shows "offline" worst-case, no data loss.

Lifecycle wiring in src/main/index.ts:
- startPusher() in whenReady alongside startPoller()
- restartPusher() in save-token IPC + deep-link auth path
- stopPusher() in clear-token IPC + before-quit cleanup

Verification path: launch v0.4.4, ensure token in
~/.config/fleetcrown/fleet-runner-token, watch /control on the web —
the "Local daemon offline" banner should disappear within ~5s and
"sync just now" should appear instead. Then autopilot ("Autonomous"
mode) can be set and dispatched intents will fire end-to-end through
the poller → injectIntoTab → Zellij chain.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 23:00:39 +02:00
Mao NakamotoandClaude Opus 4.7 60b828ac98 fix(desktop): v0.4.3 — afterPack wraps Electron binary with --no-sandbox stub
v0.4.2 set linux.executableArgs: ["--no-sandbox"] but verification on a
fresh AppImage download showed it STILL crashed at FATAL setuid_sandbox_host.
Inspected the generated AppRun script and confirmed the flag was missing:
electron-builder only injects executableArgs into the .desktop file's
Exec= line, not the AppRun. So OS-menu launches via .desktop worked but
direct execution of the AppImage (double-click, ./binary from a shell,
electron-updater swap) did not.

Fix: a custom afterPack hook (desktop/scripts/afterPack.cjs) wraps the
real Electron binary in a small shell stub that bakes --no-sandbox into
argv before exec'ing the real binary. The AppRun unknowingly invokes the
wrapper, which in turn invokes the real binary with the flag. This is
the pattern Slack, Discord, VSCode, Cursor, and Obsidian all use.

Layout in appOutDir after afterPack:
  fleet-runner      ← bash wrapper (new, 0755)
  fleet-runner-bin  ← real Electron binary (renamed from fleet-runner)

Idempotent: skips if -bin already exists, so multi-arch builds don't
double-wrap. Scoped to electronPlatformName === 'linux'.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 18:23:07 +02:00
Mao NakamotoandClaude Opus 4.7 3e1222ba7f fix(desktop): v0.4.2 — AppImage --no-sandbox via executableArgs (not main.ts)
v0.4.1's app.commandLine.appendSwitch('no-sandbox') ran too late: the
SUID sandbox helper aborts the process at FATAL *before* Electron's
main.ts loads, so any switch we set in code never gets a chance to
take effect. v0.4.1 AppImage still crashed identically to v0.4.0.

Correct fix: linux.executableArgs in electron-builder config — adds
--no-sandbox to the AppRun wrapper script that launches the binary, so
the flag is in argv before chrome-sandbox is invoked.

.deb installs are unaffected (and don't need the flag) — dpkg postinst
chmod 4755's the chrome-sandbox helper at install time, so the SUID
sandbox works the normal way there. AppImage can't run postinst, hence
this asymmetry.

Replaced the misleading in-main.ts switch with a comment explaining the
ordering constraint, so future-me doesn't try the same thing again.

Verification approach: AppImage built by CI will be unpacked and the
AppRun script inspected to confirm --no-sandbox is included.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 18:07:09 +02:00
Mao NakamotoandClaude Opus 4.7 05effdf454 fix(desktop): v0.4.1 — Linux AppImage no-sandbox so it actually launches
CRITICAL: Fleet Runner v0.2.0 through v0.4.0 crashed on launch from a
fresh Linux AppImage install with:

  FATAL:setuid_sandbox_host.cc(163)] The SUID sandbox helper binary was
  found, but is not configured correctly. Rather than run without
  sandboxing I'm aborting now.

The Chromium browser-process sandbox needs chrome-sandbox to have mode
4755 owned by root. AppImage's squashfs mount strips setuid, so the
binary aborts before any of our code runs. This is the same wall every
Electron AppImage hits (Slack, Discord, VSCode, Cursor, Obsidian) — they
all ship --no-sandbox.

Fix: app.commandLine.appendSwitch('no-sandbox') at module load, scoped to
process.platform === 'linux' (mac .dmg / Windows .exe don't have the
SUID-host wrinkle and keep their browser-process sandbox on).

Verified: v0.4.0 AppImage launched cleanly with --no-sandbox CLI flag —
web shell loaded, embedded watcher picked up 22 registered projects from
~/.config/agent-projects.conf, auto-update fired and correctly reported
"no newer version." v0.4.1 with the flag baked in means users no longer
need to know about it.

Anyone on v0.2.0/0.3.0/0.4.0 needs to manually re-download once. From
v0.4.1 onward, electron-updater handles future upgrades without user
action.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 17:54:37 +02:00
Mao NakamotoandClaude Opus 4.7 fa5bcf734a refactor(control): extract ZellijLiveRows from ZellijLivePanel
ZellijLivePanel.tsx was 327 lines, with ~118 of those dedicated to
rendering the live tab rows in two flavors (desktop table at md+,
mobile card stack at smaller widths). Both render the same row data
with the same callbacks; the file's actual orchestration logic
(header, composer, empty states, refresh/repair actions) was buried
beneath the dual rendering.

Moved both renderings to ZellijLiveRows.tsx as a single component
taking rows + highlightTab + focusTab + closeTab + onFocusProject.
The desktop table and mobile cards are still mounted together (Tailwind
toggles via hidden md:block / md:hidden), behavior identical.

ZellijLivePanel.tsx now drops 3 transitive icon imports (Focus,
Terminal-no-wait-still-used-by-empty-state-icon, Trash2) used only by
the row renderings. The isHighlighted helper moved into the rows file
since both views consume it.

ZellijLivePanel.tsx: 327 → 214 lines.
ZellijLiveRows.tsx: 151 lines (new).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 15:59:41 +02:00
Mao NakamotoandClaude Opus 4.7 deca859893 feat(desktop): auto-update via electron-updater (v0.3.0)
Wires electron-updater so Fleet Runner checks for new releases on launch
and downloads them in the background. Users on v0.3.0+ never have to
manually re-download — the next-launch upgrade prompt takes care of it.

Implementation:
- Adds electron-updater@^6.8.3 to desktop deps.
- main.ts: setFeedURL points at maonakamoto/fleetcrown-releases (the
  canonical public host) regardless of where electron-builder publishes
  the build. This decouples the build pipeline's draft target from the
  user-visible update channel — the mirror script in
  scripts/mirror-desktop-release.sh reconciles them.
- checkForUpdatesAndNotify() fires once at boot, disabled in dev to avoid
  interfering with the local Electron cycle.
- Listener on 'update-downloaded' surfaces an OS notification "Update
  downloaded — restart Fleet Runner to apply it." The actual install is
  staged automatically via autoInstallOnAppQuit.

Caveat: existing v0.2.0 users still need one manual download to v0.3.0
(their binaries don't know about the new feed URL). From v0.3.0 onward,
every subsequent release auto-propagates.

Marketing copy (setup step 02) updated to mention the auto-update flow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 15:03:09 +02:00
Mao NakamotoandClaude Opus 4.7 cfc5d7eb2d fix(desktop): bump icon.png to 1024x1024 for macOS build
electron-builder's macOS target requires icon.png ≥ 512x512; the procedural
generator was emitting 256x256, blocking the macos-latest job in the v0.2.0
release with:

  ⨯ image desktop/resources/icon.png must be at least 512x512

Bumped to 1024x1024 (retina-ready) — well above the minimum and macOS's
iconset generation downscales automatically. Linux/Windows already accepted
256 so this is purely additive there.

Unblocks the macOS build leg of the fleet-runner-v0.2.0 release.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 14:35:55 +02:00
Mao NakamotoandClaude Opus 4.7 dd0ae0f540 chore(desktop): track desktop lockfile + pin legacy-peer-deps for CI
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>
2026-06-03 14:24:32 +02:00
Mao NakamotoandClaude Opus 4.7 7b26b90bf7 feat(install): one-touch Fleet Runner install — bundled Zellij, deep-link auth, copy button
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>
2026-06-03 13:14:15 +02:00
Mao NakamotoandClaude Opus 4.7 499ed05203 feat(desktop+web): close the web → local Zellij loop
Adds a command poller to the Fleet Runner main process that long-polls
/api/control/commands, executes 'inject' commands via the same
injectIntoTab primitive scripts/fleetcrown-daemon.sh uses, and PATCHes
each row done. Atomic claim (FOR UPDATE SKIP LOCKED) means Fleet Runner
and the bash daemon can run in parallel without collisions.

Desktop
- desktop/src/main/poller.ts — long-poll loop, status state machine
  (idle/connecting/connected/error), backoff, token-rejected detection,
  pure formatTrayTooltip helper.
- desktop/src/main/index.ts — wires the poller into the tray tooltip,
  broadcasts status to all renderers, restarts on save-token, stops
  cleanly on before-quit, adds clear-token + get-poller-status IPC.
- desktop/src/preload/index.ts — exposes clearToken, getPollerStatus,
  onPollerStatus on window.fleetRunner.

Web (renders inside web-shell mode; null in normal browsers)
- src/components/desktop/FleetRunnerAutoMint.tsx — when window.fleetRunner
  is present, mints a "Fleet Runner (auto)" agent token via the same
  NextAuth cookie session and persists it via IPC, restarting the poller.
- src/components/desktop/FleetRunnerStatusPill.tsx — top-bar chip
  subscribed to live poller status, with detailed tooltip.
- src/components/desktop/types.ts — single Window["fleetRunner"]
  declaration shared by both components.
- AppShell + AppTopBar — mount points.

Other command types (focus_tab, launch_agent, switch_agent,
repair_helper, auto_continue) report a clear "not yet supported" error
so they get cleared from the queue instead of jamming it — full
coverage stays with scripts/fleetcrown-daemon.sh until a follow-up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 12:00:27 +02:00
Mao NakamotoandClaude Opus 4.7 aaab630bd7 feat(desktop+marketing): web-shell default, multi-OS release pipeline, honest download UX
Desktop:
- Fleet Runner ships in web-shell mode by default — the AppImage loads
  https://fleetcrown.vercel.app (the same React tree the browser serves) so
  desktop and web stay at parity from one codebase. FLEETCROWN_WEB_URL overrides
  for previews/dev; `=local` disables web-shell for IPC dev work.
- Stable artifact naming via `artifactName: Fleet-Runner-${os}-${arch}.${ext}`
  so /releases/latest/download permalinks work; package.json publish target
  corrected from "cockpit" → "fleetcrown".

CI:
- New desktop-release.yml workflow: build matrix on macos-latest, windows-latest,
  ubuntu-latest fires on fleet-runner-v* tag push. Each runner produces signed
  installers via electron-builder --publish always and uploads to a GitHub
  Release. workflow_dispatch with dry_run=true builds-only for pipeline tests.

Download UX:
- Page redesigned for non-technical visitors: hero → web vs desktop comparison
  → platform-aware CTA → 3-step "what happens next" → plain-language prereqs
  with required/optional badges → developer drawer (collapsed).
- mac/Windows surfaces no longer point at the repo as a "download" — they show
  a Coming Soon panel with a release-feed subscription and an honest "Use the
  web app instead" escape hatch. Build-from-source demoted to a dev drawer.
- ~30 new ui-public-download-* semantic classes for the new patterns; design
  guard remains clean.

Navigation:
- /download added to the sidebar Site section so logged-in users have an in-app
  entry point to the desktop app.
- Homepage redirect dropped for signed-in users (onboarding flow preserved);
  hero + footer CTAs now surface "Open FleetCrown →" when authenticated.

Marketing copy:
- Roadmap NOW phase reflects the desktop ship (web-shell, embedded watcher,
  multi-OS pipeline); NEXT phase reframed to "Distribution and auto-update"
  with concrete remaining work (signed mac/Win binaries publicly shipping,
  auto-update, native package channels, IPC bridge polish).
- Investors "what we have built" copy updated to mention the desktop app + CI.

Pre-existing fixes folded in:
- Control surface: AttentionBar deduplicates the "Needs attention" reason chip;
  control-presenter labels the session-with-mtime-but-no-readiness case as Idle.
- Scripts: cockpit → fleetcrown rename sweep across beacon/install/deploy.
- /api/system/daemon route updates.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 10:37:30 +02:00
Mao NakamotoandClaude Opus 4.7 a3b13d3f84 chore: rename github handle g-but → maonakamoto across repo refs
Closes the loop on the github username rename. Replaces every
g-but → maonakamoto reference in:

- desktop/package.json (electron-updater publish.owner — drives auto-update)
- desktop/README.md, src/config/marketing-content.ts (clone/release URLs)
- scripts/install-fleetcrown-{app,daemon,beacon-window}.sh (systemd Documentation=)
- scripts/wait-for-vercel.sh (example output in code comment)
- src/app/api/project/bootstrap/route.ts (default github user fallback)
- legal/IP_ASSIGNMENT_MEMO.md (repository location only — natural-person
  identification preserved until bitbaum AG / FleetCrown GmbH incorporate)

Local + global git config (user.name, user.email) and the origin remote
URL already updated outside the tree. GitHub auto-redirects the old URLs
but flipping them eliminates the leak and matches the pseudonymous-founder
direction.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-02 18:52:47 +02:00
Georgy ButaevandClaude Opus 4.7 8fc676c488 feat(desktop): OS notifications on worker.idle + real tray/window icon
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>
2026-06-02 17:04:14 +02:00
Georgy Butaev 899b08ec56 feat(integration): FleetWave real customer setup with OrangeCat
- FleetCrown is customer of OrangeCat (stakeholder 'customer' edge, shared wallet).
- Both + FleetWave as projects/profiles on orangecat.ch for Mao Nakamoto.
- Added integration banner in /money page (visible UX for the customer relationship).
- Updated CLAUDE.md, README, legal/IP memo, marketing-content to reflect current names, FleetWave customer, rebrand.
- Legacy 'cockpit' paths kept per branding-design for transition.
- Data updated live in DB (rename, wallets, relations, new FleetWave project).
- Makes the full stack work for real customer FleetWave; scales to others.

Changes in both cockpit and orangecat for good UX and functioning product.
2026-06-02 16:09:46 +02:00
Georgy Butaev 84d9807935 polish(local): nicer runtime status in Fleet Runner
- Shows clear badges for "watcher embedded" and "real event log" (the new capabilities).
- Collapsible raw for debug.
- Makes the local app surface its functioning integration proudly and clearly.
2026-06-02 15:20:28 +02:00
Georgy Butaev a4b46331b1 polish(local): make Fleet Runner dispatch actually nice and functioning
- Added structured lastDispatch state.
- Dispatch result now renders as a proper .runner-card with:
  - Clear INJECTED / MANUAL PASTE NEEDED badge
  - "PROMPT SENT TO AGENT" block showing the actual renderedPrompt (the important thing the user/agent sees)
  - Tiny meta with project/intent/runId
- This turns the local app interaction from "JSON blob appears" into a usable, clear experience.
- Cleaned the last couple text-[10px] in the new card to use --text-micro var.

Website side already has the Download nav entry + explicit future promises.

Continuing the "impeccable website + functioning web + local apps" directive.
2026-06-02 15:18:59 +02:00
Georgy Butaev d348d8c866 polish: make website + local Fleet Runner impeccable + functioning
- Desktop renderer: refactored App.tsx to eliminate vast majority of raw hex (#000, #1f1f1f, #ff5c00 etc) and arbitrary text-[Npx] by using the existing runner CSS vars + newly added .runner-* component classes (header, card, input, btn, project, result, label, mono). Hero, connect, runtime, projects, command bar, results, footer all now class-driven.
- Extended desktop runner globals.css with additional primitives and --text-micro etc so the ultra-minimal x.ai aesthetic is still 100% defined in one CSS file (SSOT for this surface).
- Small functioning win: status pane now renders a tiny human summary (homeStack, watcher embedded, real log) on top of the raw JSON for debug.
- Public website: added "Download" to PUBLIC_NAV (SSOT) so visitors see the local app path clearly in the marketing nav.
- Fixed last user-facing rebrand leak in a tooltip (cockpit-daemon → fleetcrown-daemon).
- All changes keep strict design system, no new violations. Runner and main site build clean.

This advances "impeccable website and functioning app (web + local)" per the vision. The local Fleet Runner UI is now much closer to the quality bar of the rest of the product while preserving its pure black character. Web surfaces have better discoverability for the desktop download.
2026-06-02 15:16:06 +02:00
Georgy Butaev 74af023c69 feat(desktop): embed home/watcher in Electron main (startWatcher export + fs.watch + worker.idle on handoff)
- Refactor home/watcher.ts for dual use: library (startWatcher() returns {close}, no auto process.exit, conditional SIG handlers) + CLI (--start / --self-test unchanged, 8/8 tests pass).
- Wire in desktop/src/main/index.ts: import + start on whenReady (after createWindow), store closer, stop on before-quit.
- desktop runtime status now advertises hasWatcher + updated version string.
- Desktop main process now owns the full local event loop for its dispatches: append bridge.dispatch + started/crashed (with sentinel) on the way in, worker.idle (from real session.md changes) on the way out.
- Rebuilds clean; home/ 89/89; no separate watcher process required when Fleet Runner is the runtime.
- Docs + session updated.

This largely completes the "real worker idle path" part of desktop-2/3. GUI dogfood + projection verification in a graphical env still needed for the last mile.
2026-06-02 14:57:49 +02:00
Georgy Butaev e30c842869 feat(desktop) + fix(design,lint): project selection + auto-sync + Sync to Web (ck_* token); canonical injectIntoTab + real appendEvent bridge.dispatch/worker.started in Fleet Runner runtime (replaces fake in-memory); hardened zellij.ts (session resolution + -- write-chars); ui-public-download-* + --public-accent (zero design violations); full cockpit->fleetcrown rebrand in desktop/scripts/docs/thoughts/marketing/home; update desktop README + docs/desktop-app.md with capabilities + gaps (in-memory vs real log)
- 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
2026-06-02 14:54:51 +02:00
Georgy Butaev cd14a1d676 docs(desktop): record canonical injectIntoTab + fleetcrown config dir + auto-sync in current-state notes; refresh desktop/README status bullets 2026-06-02 12:19:00 +02:00
Georgy Butaev b08ac4da14 feat(desktop): project selection + auto-sync on connect + Sync to Web (agent token to /runtime-state); switch to canonical injectIntoTab; ui-public-download-* classes (zero design violations); forward custom prompts as queueHead; clean lint; broad docs/marketing/scripts updates for FleetCrown desktop runtime 2026-06-02 12:17:12 +02:00