Commit Graph
287 Commits
Author SHA1 Message Date
Mao NakamotoandCursor f62565e9b8 feat(control): ship Phase 1 fleet play/pause hero UX
Prominent ui-control-hero autopilot card with Building/Paused status, large
Start/Pause CTA, per-project toggles, rail override chips, and refresh sync.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 11:09:33 +02:00
Mao NakamotoandCursor 308f32c833 chore(projects): retire swiss-longevity-hub and link Bitbaum runtime
Merge SLH into surf-your-life on prod, drop orphaned box DB, remove SLH from
hetzner manifest, and wire Bitbaum user_projects dir for local dispatch.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 10:39:39 +02:00
Mao NakamotoandCursor 3b94efbb67 chore(db): retire stale prod projects and add cleanup tooling
Merge Cockpit and empty dupes into canonical entities, delete infra/stub
rows, and ship retire-stale-projects.ts plus merge helpers for future hygiene.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 09:59:27 +02:00
Mao NakamotoandCursor 826dc5c92b fix(profiles): batch applyProjectProfile writes for prod enrich
Transaction upsert prevents remote DB timeouts. Replace placeholder
descriptions on enrich. Backfilled petvity, sbb-lost-found, Bitbaum.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 20:43:39 +02:00
Mao NakamotoandCursor 36d1802469 chore(profiles): backfill prod build-contract attrs from local repos
Re-ran enrich-prod-profiles against Hetzner — 16 projects now have
architecture/conventions/DoD. Add Groq retry for transient fetch failures.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 20:05:23 +02:00
Mao NakamotoandCursor 50b52301e1 feat(rag): Memory index health and Hetzner install SSOT
Surface fleet-knowledge chunk counts on /memory, document box RAG ops via
install-fleet-rag.sh, and add rag-retrieval test script. Reindex on production
already active (24 chunks across 21 project profiles).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 18:39:47 +02:00
Mao NakamotoandCursor 239e6d8ec4 fix(projects): cloud inject carries full project context to agents
Phone/Loki/beacon dispatches queued bare promptKey strings on the cloud host;
assembleInjectPrompt now matches orchestration/run. Persist architecture/
conventions/DoD from AI briefs, expand injected fields, add build-contract UI,
and reindex profile embeddings on save when RAG is enabled.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 18:19:55 +02:00
Mao NakamotoandCursor ba7ac4b328 fix(mobile): full-screen overlays and project drawer tap targets
Hide bottom nav and top bar while drawers/modals are open; improve project
profile header layout, tab bar, and card action sizes. Add mobile pages audit script.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 17:30:17 +02:00
Mao NakamotoandCursor 6dd74f2c2b feat(terminal,loki): mobile full-screen terminal and develop handoff
Expand/collapse on phones gives xterm usable height; Loki dispatches route
"let's develop" through next_best and link to watch the agent. Profile drawer
follows action-first hierarchy with filtered activity noise.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 16:22:30 +02:00
Mao NakamotoandCursor 215a4fe3ea fix(projects): merge duplicate entities and simplify fleet overview
Resolve case-insensitive duplicate project rows in Postgres, prevent
recurrence in entity creation, and redesign the Projects page hierarchy
(search-first, compact list, attention cards, activity redaction).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 12:13:43 +02:00
Mao NakamotoandClaude Opus 4.8 879b18ae68 feat(voice): Grok-style recording UX + enable self-hosted Whisper fallback on box
UX — the composer mic was a bare icon. While recording/transcribing it now
shows a Grok-style overlay over the composer: a live animated waveform, a
pulsing record dot, an elapsed timer, and cancel (✕) / confirm (✓) controls
(globals.css ui-voice-*). Transcript still appends to the input.

Backend (a)+(b): the route already orchestrates Groq-first → local-Whisper
fallback. Two fixes to make the fallback real on the box: (1) the local path was
gated by isRuntimeAvailable() (false on the stateless box) — now also enabled by
TRANSCRIBE_LOCAL_AVAILABLE so the box runs it; (2) transcribe.py switched from
openai-whisper (heavy torch) to faster-whisper (CTranslate2 int8, no torch) —
far lighter on the shared CX22. Groq (whisper-large-v3-turbo) verified working.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 12:37:07 +02:00
Mao NakamotoandClaude Opus 4.8 f0cc29ac1d feat(runner): box-runner clone-on-demand + unattended claude (P1 #1/#2)
Make a real Control dispatch run to completion on the box, not just spawn a PTY.

#2 clone-on-demand — src/lib/agent-execution/box-workspace.ts: a dispatch carries
the LAPTOP dir (absent on the box). ensureBoxWorkspace() resolves the project by
tab (name match) → gitUrl → git clone (GITHUB_TOKEN auth) into ~/dev/<key>, or
reuses the dir if it already exists. Hooked into launchAgentPty via dynamic
import gated by FLEETCROWN_BOX_PREPARE (keeps @/db + git off the desktop bundle).

#1 unattended claude — auth was never the blocker (the inference token launches
interactive claude); the blockers were claude's trust-folder gate and per-tool
permission prompts. box-workspace pre-seeds ~/.claude.json
projects[dir].hasTrustDialogAccepted, and the claude adapter adds
--dangerously-skip-permissions gated by FLEETCROWN_RUNNER_UNATTENDED (box-only;
desktop keeps interactive confirmations). Single-tenant owner box — acceptable
per the spec until SandboxExecutor lands.

Verified live: dispatched fleetcrown → cloned from github.com/maonakamoto, dir
pre-trusted, claude launched unattended in the clone.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 11:46:59 +02:00
Mao NakamotoandClaude Opus 4.8 fa8616e16f feat(runner): box-runner shipped (P1) — token mint, systemd install, spec update
The headless box-runner is live on the box and verified end-to-end with the
laptop off: presence online via bridge SSE, a launch_agent dispatch claimed +
executed in a FleetCrown-owned node-pty PTY, close_tab cleaned it up, PTY lives
in the box-runner's own process tree (deploy-independent from fleetcrown-app).

- scripts/mint-box-runner-token.ts — mints a ck_ token for the owner + writes it
  to the token file (the box-runner equivalent of desktop "install runner").
- scripts/hetzner/install-box-runner.sh — idempotent install/redeploy: rsync
  source, mint token if absent, write fleetcrown-box-runner.service, restart.
- Spec marked P0+P1 SHIPPED with the remaining follow-ups (claude /login full
  scopes, project clone-on-demand, SandboxExecutor before multi-tenant).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 11:29:12 +02:00
Mao NakamotoandClaude Opus 4.8 b62e3aeb19 feat(runner): headless box-runner scaffolding (P1) — Electron-free core + entry
Make the desktop runner core runnable headless on the box. pusher.ts loses its
lone Electron dependency (app.getVersion() → FLEETCROWN_RUNNER_VERSION env, set
by the desktop in index.ts so its behavior is unchanged). scripts/box-runner.ts
is the systemd entry: reuses the EXACT desktop poller + pusher (claim → execute
in owned PTY → stream → ack, presence via bridge SSE), graceful shutdown, run
via tsx from /opt/fleetcrown/runner. See docs/architecture/box-owned-pty-executor.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 11:13:10 +02:00
Mao NakamotoandClaude Opus 4.8 68ecdd2260 fix(terminal): copy-on-select, paste, and a detected-link bar for wrapped URLs
The embedded xterm had three real defects on the auth path (`claude
setup-token` prints a long OAuth URL):

- Copy was impossible: xterm keeps its selection in a canvas layer, not the
  DOM, so the browser's native copy grabbed nothing. Mirror every non-empty
  selection to the system clipboard (copy-on-select) + keep ⌘C/Ctrl-Shift-C.
- No paste: add ⌘V / Ctrl-Shift-V → clipboard into the PTY.
- Wrapped links were uncatchable: xterm's link addon detects per visual row,
  so a URL wrapped across 5 rows was clickable only on row 1. The byte stream
  keeps each URL on one logical line — scan the output and surface whole URLs
  in a real-DOM LinkBar (clickable + one-click Copy), independent of wrapping.

Font is already correct GeistMono (verified loaded); remaining gap vs a native
GPU terminal is inherent to a browser DOM-rendered grid.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25 21:21:20 +02:00
Mao Nakamoto 1b536283d9 refactor(brand): route display name through APP_NAME + add brand-SSOT guard
Make a future rename a one-place edit (APP_NAME in config/brand.ts + _brand.sh).
- Fixed identity chrome to use APP_NAME: PublicFooter copyright, BrandVersion,
  releases brand link, landing CTAs ("Open FleetCrown") + hero copy.
- Page metadata titles: dropped the hardcoded "— FleetCrown" suffix so the root
  layout's `%s — ${APP_NAME}` template supplies it (also fixes a latent
  double-brand). Covers quickstart/download/releases/terms/privacy/license/import-local.
- scripts/check-brand.sh: lists every display-name string that bypasses APP_NAME
  (the rename checklist); `--strict` gates CI. Exempts the lowercase `fleetcrown`
  SLUG (DB/unit/repo/domain — survives a display rebrand by design) and editorial
  prose in content/.

Architecture was already SSOT-correct (34 files use APP_NAME; layout fully
templated). Guard reports the remaining ~60 inline-copy/editorial escapes as the
explicit mop-up list for whenever the rename happens. tsc=0.
2026-06-25 18:44:49 +02:00
Mao Nakamoto 9690eb7021 feat(rag): fleet-knowledge pgvector index + cross-project context injection
Captain-layer RAG — index what only FleetCrown sees across the fleet, never repo
code (the runtime retrieves that itself). Context injection becomes relevance-
ranked instead of profile-dump.

- Local embeddings: scripts/embed-server.py — fastembed BAAI/bge-small-en-v1.5
  (384-dim) behind an OpenAI-compatible /v1/embeddings, on the box (no cloud key).
  systemd fleetcrown-embed.service.
- src/lib/rag/embeddings.ts — provider-agnostic client (ported from OrangeCat's
  convention; EMBEDDINGS_BASE_URL/MODEL/DIM, graceful-off when unset → local dev).
- knowledge_embeddings table (pgvector, vector(384), user_id-scoped) — Drizzle
  schema + raw-SQL ingest/cosine-retrieve in db/queries/knowledge-embeddings.ts.
- scripts/reindex-knowledge.ts — backfill project profiles + dev-logs (P0).
- inject-core: dispatches now get a "Relevant context from your other projects"
  block retrieved against the task, excluding the project it's for. The engine
  under cross-project reference's suggested-references, and the first real fix
  for the "memory is the weakest strut" gap.
- docs/architecture/{cross-project-reference,fleet-knowledge-rag}.md — specs.

Verified live on the box: retrieval is semantically accurate (bitcoin→orangecat,
refugee housing→aoz-housing). 24 chunks indexed across 21 projects. tsc=0, eslint=0.
2026-06-25 16:57:11 +02:00
Mao Nakamoto ff32e90aff feat(hosted-runner): fall back to GITHUB_TOKEN when no OAuth account is linked
On the hosted box there's no linked GitHub OAuth account (accounts table empty),
so getGithubToken returns null and Hermes couldn't push/PR. Fall back to
process.env.GITHUB_TOKEN (provided by `gh auth login` on the box → its stored
token, repo+workflow scopes). Verified live: the runner now clones, edits via
Hermes, pushes a branch, and opens a PR (fleetcrown#54).
2026-06-25 16:25:46 +02:00
Mao Nakamoto 51fc7d1250 feat(hosted-runner): Hermes goes live — auto-route offline dispatches, preserve work as a PR
Now that Hermes is installed + Nous-Portal-authed + verified executing agentic
code on the box, wire it end to end:

- run-hermes.ts: real invocation (`hermes -z "<task>" --yolo`, model+creds from
  ~/.hermes/config.yaml — dropped --ignore-user-config which bypassed the Nous
  config). Crucially, it now PRESERVES the work: after the agent edits, commit on
  a fresh `hermes/<slug>` branch, push, and open a PR via the GitHub API. No
  auto-merge — a human reviews. No-op runs report "no changes" honestly.
- inject-core.ts (producer): when a WORK dispatch queues with the local Fleet
  Runner offline, auto-enqueue a hosted_dispatch so Hermes makes the change and
  opens a PR instead of the command waiting forever. Gated: real git URL + not a
  lifecycle (close/stop) command. Hermes uses its own Nous model, so we don't
  pass the local agent's model pref. Response surfaces hostedDispatchId.
- hosted-runner.ts: surface the PR URL / branch in the executed-command result
  and dev log.

tsc=0, eslint=0.
2026-06-25 16:04:38 +02:00
GandClaude Opus 4.8 509f2a4189 feat(hosted-runner): wire runHermesTask via hosted_dispatch + positioning one-pager + harness essay (#52)
- hosted_dispatch command type + enqueueHostedDispatchCommand (pending-commands.ts):
  write-class tasks, distinct from read-only hosted_analyze and the local-runner path.
- scripts/hosted-runner.ts: the worker now claims BOTH hosted types and routes —
  hosted_analyze → Groq read-only analysis (Phase 0); hosted_dispatch → runHermesTask
  (Phase 1, orchestrate Hermes in its own sandbox). Verified: dispatch routes to
  Hermes and reports a clean needs-install result (no crash) until the CLI is
  provisioned. The whole path is ready the moment a Hermes credential lands.
- docs/positioning.md: the captain's-bridge one-pager — what we are (orchestration
  layer over runtimes), what we're NOT (a runtime), the layer model, the moat
  (cross-model verification + governance + economy), honest status.
- content/thoughts/the-harness-not-the-prompt.md: essay — leverage moved from
  prompt engineering to harness engineering; FleetCrown is a harness at fleet scale;
  maps our shipped pieces (profile-as-context, cross-model DoD gate, the loop) to
  harness primitives, and names memory as the weakest strut.

(Recovers the box too: the prior Hermes-spike deploy failed on a missing `ws`
dep the fleet's Loki-gateway commit added; npm install fixed local node_modules,
so this build is clean.) tsc=0, eslint=0.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25 14:04:23 +02:00
GandClaude Opus 4.8 4cf27f23f5 feat(hosted-runner): wire Phase 0 to presence + the claim queue (#50)
The read-only analysis core now runs the real runner loop, verified end-to-end:
- setRunnerConnected (runner-presence.ts): a hosted runner registers presence
  (no bridge SSE), so a project stops showing fully dark while the operator's
  laptop is off. Phase-0 simplification noted (shared presence boolean).
- hosted_analyze command type + enqueueHostedAnalyzeCommand (pending-commands.ts):
  its own type so it never collides with the local-runner dispatch/inject path.
- scripts/hosted-runner.ts: the worker loop. Persistent mode claims presence +
  polls; --once is a one-shot drain (cron-style) that does NOT claim persistent
  presence. Each claimed command → getProjectContext + getGithubToken →
  analyzeRepo → markCommandExecuted({ok,text}) + appendProjectDevLog so the
  result shows on the project. Stale-claim reclaim + purge come free from
  claimNextPendingCommand.

Verified locally: enqueue → presence ON → claim → clone+analyze a real repo →
report (result.ok, devlog) → presence reset. tsc=0, eslint=0.

Next (operational): run the worker as a box service (DATABASE_URL + GROQ_API_KEY)
so the founder's projects actually get a hosted runner; then a UI trigger
("Analyze on hosted runner"). Phase 1 swaps analyzeRepo for a sandboxed coding
agent. See docs/architecture/hosted-ephemeral-runner.md.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25 13:31:42 +02:00
GandClaude Opus 4.8 b303245a11 fix(auth): heal username/name drift + stop leaking the operator's real name; docs(thoughts): The Captain Needs a Ship (#48)
Privacy: the public /u/<username> profile + the greeting were showing the
operator's REAL name — "George" (hardcoded in seed.ts) and username "gbutaev"
(suggestUsername auto-derives a handle from the OAuth profile's real name). The
operator runs pseudonymously (Mao Nakamoto) and never typed either. Fixes:
- seed.ts seeds the pseudonym, never a real name (it surfaces on a public URL).
- The owning user's name/username were corrected to the pseudonym in both DBs.
- jwt callback now self-heals not just an orphaned id but a drifted username/name
  too (compares cached token to the DB), so renaming an account propagates to the
  session and the public profile it links to — instead of stranding the operator
  on a now-dead /u/<old-handle>. token.name is refreshed too (fixes the greeting).

Thoughts: "The Captain Needs a Ship" — the agent-tool landscape (Claude Code,
Grok Build, Hermes, Codex, OpenClaw) is converging on a worker substrate (loop,
verifier, skills, memory, HOSTED execution). FleetCrown's bet is the captain
tier, but it borrows the operator's laptop to run the fleet — the keystone gap
behind every "runner offline" wall. The essay ranks the substrate gaps and why
hosted ephemeral execution is the one that unblocks the rest.

tsc=0, eslint=0, test:auth 13/13.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25 13:08:21 +02:00
GandClaude Opus 4.8 c98607f8f6 fix(deploy): gate the local postbuild restart on the pinned ref too (#45)
The pinned-deploy guard protected the box but not local. deploy-hetzner.sh
--ref checks HEAD==REF after the build and aborts the BOX rsync on drift — but
`npm run build`'s postbuild (deploy-local.sh) had already restarted the LOCAL
systemd service with the just-built (possibly torn) standalone. So a `git
checkout` mid-build left local prod on a torn tree even though the box was safe,
and the "not shipping a torn tree" abort message was misleading.

Fix: deploy-hetzner.sh exports FLEETCROWN_DEPLOY_REF into the build env;
deploy-local.sh skips the local restart when that's set and HEAD has drifted
from it. Now a mid-build branch switch restarts nothing — local and box
consistent — and the abort message says so. (Root cause was running git ops
during a backgrounded deploy; the guard is now airtight against it on both ends.)

bash -n clean on both scripts.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25 12:29:36 +02:00
GandClaude Opus 4.8 4fcccef200 feat(autopilot): definition-of-done stop-gate — don't stop on the agent's own say-so (#43)
The /goal pattern. closeRunFromSession closes a run the moment the agent writes
status: ready — the agent grading its own homework (Ralph Wiggum). When a project
declares a definition_of_done (now a first-class profile field, injected into
every dispatch), the close is gated by a DIFFERENT-lineage model:

- dod-gate.ts: verifyDefinitionOfDone(dod, handoff) — gpt-oss-120b (not the
  worker's lineage) reads the handoff against the stated bar, returns {met, gap}.
  Fail-OPEN (a judge error lets the run close rather than wedge the loop).
- applyDoDGate (pure, unit-tested): a SUCCESS close with an unmet bar is
  downgraded to "partial" with the gap written into `next`, so autopilot's
  existing continue-loop keeps working instead of stopping. Only gates success;
  error/partial are untouched.
- Wired at the control close seam, fire-and-forget + an in-flight guard so the
  judge fires at most once per run and never blocks the control response.

This makes "done" an objective, cross-model-verified condition per project —
the lever the loop-engineering literature calls the real one. scripts/test/
dod-gate.ts (7 cases) added to the pre-push suite. tsc=0, eslint=0.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25 11:57:30 +02:00
GandClaude Opus 4.8 d3bceadf4e feat(frontier): self-improvement loop — digest → proposals → human-gated goals (#34)
The second half of the frontier loop, and the differentiated one: turn each
day's digest into concrete proposals for how FleetCrown should evolve. The loop
AUTO-PROPOSES ONLY — a human accepts (→ a roadmap goal) or dismisses; it never
builds on its own (building straight from a news feed is exactly the ungoverned
action to avoid). Decision history grounds the next run so nothing is re-proposed.

Brain (src/lib/frontier/propose.ts):
- generateProposals — Groq, grounded in FleetCrown's mission + the owner's
  active goals + already-considered titles. Returns ≤3 specific proposals, each
  tying a real frontier item to a FleetCrown capability; empty list is the
  correct (and common) answer. sourceUrls validated against the real digest.
- critiqueProposals — an adversarial reviewer that defaults to REJECTING and
  scores 0-100; only ≥70 reach a human. The `model` param is the cross-model
  verification swap point (callGroqText now takes a model override): point the
  judge at a different model than the generator for uncorrelated errors.
- Code-level Jaccard dedup as a net beyond the LLM instruction.

Wiring:
- run.ts runFrontierProposals: target = owner of the "fleetcrown" entity
  (resolved, not hardcoded) → generate → critique → store survivors.
- The daily cron runs it after the digest (best-effort; never fails the digest).
- frontier_proposals table (status proposed|accepted|dismissed, score, links).
- /api/frontier/proposals (GET list) + /[id] (POST accept→createGoal / dismiss),
  owner-gated via requirePrivateApiAccess.
- /system: FrontierProposalsCard inbox (server read) + ProposalRow (client
  Accept/Dismiss). Accept reuses createGoal; provenance links fold into the goal.

Verified: tsc=0, eslint=0; full local run drafted 3 / surfaced 3 real proposals
(78-90) from today's arXiv items; accept→goal path tested + cleaned up.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 06:33:44 +02:00
GandClaude Opus 4.8 38869edb1a feat(frontier): daily AI/robotics frontier digest — public surface (#33)
A daily auto-generated digest of the latest AI, robotics, and frontier-tech
developments. First increment of the dual-purpose goal: the public surface
(credibility + a daily reason to return). The self-improvement half (mining the
digest into roadmap proposals) is the next increment.

Pipeline (all server-side, no agent runtime):
- ingest.ts pulls curated sources — arXiv cs.AI/cs.RO/cs.LG RSS + Hacker News
  (Algolia, points-gated, 3-day window) — dedupes by URL. Titles/links always
  come from real feeds, so they can never be hallucinated.
- digest.ts has Groq act as editor: it returns only INDICES into the candidate
  pool plus a one-line "why it matters" per pick, a headline, and an intro.
  Deterministic fallback (top-N by source score) if the model errors/returns junk.
- run.ts ties ingest → rank → upsert (frontier_digests, one row per day).

Surfaces:
- /api/crons/frontier-digest — daily cron (requireCronAuth), 08:00 UTC via
  install-hetzner-crons.sh.
- /frontier — public page (PublicSurface), new ui-frontier-* Layer-3 classes.
  Added to the public route matcher (proxy.ts) and PUBLIC_NAV (config/auth.ts).
- scripts/seed-frontier.ts — manual regeneration / ranking iteration.

Verified: tsc=0, eslint=0; seed run produced a real 8-item digest from 19
candidates across 6 sources via llama-3.3-70b-versatile.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 05:49:17 +02:00
GandClaude Opus 4.8 c0372977bd fix(ux): audit quick-wins + always-surface capacity banner (#31)
* fix(ux): quick-win batch from the action audit

Four honest/routing fixes surfaced by the full UX audit:
- proxy.ts: /privacy /terms /license /docs/quickstart were auth-gated (missing
  from the public matcher) — logged-out footer clicks bounced to sign-in. Now public.
- projects/[id] GET: the response omitted gitUrl, so the project detail DRAWER
  showed no repo link for GitHub-imported projects (the grid card worked). Added.
- DesktopDownload: macOS + Windows were marked status:'ready' but ship no asset
  (Linux-only) → the auto-detected Download CTA 404'd. Flipped to 'comingSoon'
  and added the ComingSoonPanel branch (watch-releases + use-web CTA) the config
  comment always promised but was never implemented.
- changelog.ts: added the real v0.8.9 entry (was stale at 0.8.8 vs the live
  release) so the footer version pill + /releases are current.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(control): always surface the capacity banner when autopilot can't act

Chasing the auto-reroute banner gate (after the SSE/GET session fix made the
data correct) revealed a UX gap: shouldShowManualCapacityBanner returned false
under autopilot for 'tab-closed' — so a project that hit a rate-limit wall but
isn't running showed NO indicator and NO call to action. A capacity wall must
never be silently invisible.

Now surfaces the manual banner under autopilot whenever autopilot CANNOT act on
its own (all-tried / no-fallback / tab-closed). For a not-running project,
clicking Switch still persists the agent preference for the next launch. When
autopilot CAN act, the auto banner shows instead. Test asserts the tab-closed case.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 22:45:42 +02:00
GandClaude Opus 4.8 cd7eec4708 fix(control): one session resolver shared by GET route and SSE stream (#30)
Closes the SSE/GET divergence found while dogfooding auto-reroute. On the local
runtime the GET /api/control fell back to the persisted project_states row
(parseSession ?? dbState), but the SSE stream's local path (readFastState) was
file-only with no DB fallback. So a project whose session .md was absent but
whose project_states row persisted showed its session via GET yet null via the
live (SSE-driven) page — which hid the auto-reroute capacity banner.

src/lib/project-session.ts is the SSOT:
- dbRowToSession(r): the one project_states -> SessionState projection (was
  duplicated inline in the GET route and the stream's dbToFastState).
- resolveProjectSession(fileSession, dbRow) = fileSession ?? dbRowToSession(dbRow).

Used by all three sites: the GET fallback, the stream's dbToFastState (cloud),
and the stream's local scanProjects (which now fetches project_states and fills
null sessions — the fallback it was missing). The two paths can no longer drift.

Contract test (test:project-session, wired into pre-push): file-present wins,
file-absent-DB-present surfaces the row, neither -> null, GET/SSE identical.

Implements milestone 1 of the 'Single derived-state read-model' roadmap goal.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 21:42:40 +02:00
GandClaude Opus 4.8 2e407f34a6 feat(control): headless auto-reroute agents off capacity walls under autopilot (#27)
* feat(control): auto-reroute agents on capacity walls under autopilot

Closes the loop from 'we can resolve a fallback' to 'we reroute live.' When
a project hits a rate-limit/quota wall (detectCapacityIssueFromProject) and
autopilot is on, FleetCrown now switches to the next installed fallback agent
itself via the existing switch-agent path — no human click. With autopilot
off, the manual CapacityIssueBanner is unchanged.

- src/lib/auto-reroute.ts: pure, tested decision (decideAutoReroute +
  shouldShowManualCapacityBanner). Loop-safe: AGENT_FALLBACK_ORDER cycles, so
  a per-episode tried-set stops an all-exhausted fleet from churning and
  surfaces a manual banner instead.
- ProjectCard: act once per distinct session state (mtime + outgoing agent)
  so a switch landing (which lags the poll) can't re-fire or flash a false
  'exhausted'; autopilot-gated; reuses performAgentSwitch.
- CapacityIssueBanner: 'auto' (switching…) and 'exhausted' variants.
- scripts/test/auto-reroute.ts (npm run test:auto-reroute): 12 cases incl.
  loop safety + skip-gate priority.

First increment (client/control surface). Follow-up: same decision server-side
in the beacon path for headless reroute when no browser is open.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat(beacon): headless auto-reroute on capacity walls (no browser needed)

Increment 2: the /control auto-reroute only fires while the page is open.
The beacon path runs server-side when an agent's session ends, so it reroutes
unattended — the real fleet-operation win. The beacon already detected the
capacity issue + computed the fallback (resolveNextAvailableAgent) and only
stored it; now it acts.

- src/lib/auto-reroute.ts: decideHeadlessReroute + MAX_AUTO_REROUTES_PER_WINDOW.
  Loop safety without a client ref = DB guard: cap auto-switches per project
  per 15-min window (one full fallback cycle, then stop) + skip while a switch
  is still unclaimed.
- db/queries/pending-commands.ts: recentSwitchAgentStats(userId, tab) →
  {windowCount, pending}, windowed so a dead unclaimed command can't block.
- api/beacon/route.ts: on capacityIssue, resolve effective autopilot
  (per-project override ?? global) + dir/tab, then enqueue switch_agent.
  Best-effort — never blocks or fails beacon creation.
- 7 new headless test cases (19 total).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 07:08:22 +02:00
GandClaude Opus 4.8 3d99467a8b fix(deploy): pin push-deploy to the pushed ref, never ship a drifted branch (#29)
The push-deploy hook backgrounds the box deploy with `sleep 5 & disown`, then
deploy-hetzner ran `npm run build` on the floating working tree. If you switched
branches in that window, it built+shipped the WRONG ref — it once shipped an
off-main feature branch to the production box.

The hook now captures HEAD at push time and passes it as --ref. deploy-hetzner
guards on it: build only when the working tree is STILL on that commit, and
re-check HEAD after the build so a switch mid-build can't ship a torn tree; on
drift it skips loudly with recovery instructions rather than shipping wrong code.
(An isolated git worktree would auto-recover the right ref, but Turbopack rejects
an out-of-root node_modules symlink, so we guard in-place instead.)

Verified: --ref to a non-HEAD sha skips before building (exit 1, no box touch);
matching ref takes the unchanged build+rsync+verify path.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 06:30:53 +02:00
GandClaude Opus 4.8 9b8650d7db fix(deploy): atomic asset swap so deploys don't 500 marketing pages (#28)
deploy-local.sh did `rm -rf <dir>; cp -r <dir>` for static/public/content,
leaving a multi-second window where the LIVE standalone dir was missing or
half-populated. The running server reads content/*.md at request time, so
/whitepaper (and broken CSS/JS) 500'd on every deploy until the copy finished —
exactly the marketing-page outage window we want gone.

swap_dir() builds each tree in a sibling temp dir then renames it into place:
the only window where the live dir is absent is between two consecutive renames
on one filesystem (microseconds), not seconds. Applies to .next/static, public,
content, and the node-pty build. Also clears swap temporaries left by an
interrupted deploy. Verified: content swapped with no nesting, no stray temps,
/whitepaper stays 200.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 06:06:04 +02:00
G 0c07610a47 fix(brand): add the scripts/_brand.sh SSOT lever that brand.ts already promised (#26)
brand.ts documents scripts/_brand.sh as the shell-side mirror of APP_NAME /
APP_SLUG / APP_DOMAIN — the rebrand lever for shell consumers — but the file
never existed. Shell scripts had no SSOT to read from, so a future rename had
no lever on the shell side despite the docs claiming one (Ground Truth #2).

- Create scripts/_brand.sh: the four canonical values + derived URLs, sourcing
  guard, and a note on why APP_SLUG (infra id: DB, systemd unit, paths) stays
  stable on a display rebrand.
- Wire its one genuine consumer — scripts/hetzner/verify.sh now sources it for
  the FleetCrown health check + bridge domain (other products keep their own
  identifiers). Not a mass rewrite; slug-tied infra is intentionally untouched.
- Add scripts/test/brand-sync.ts (test:brand-sync) enforcing that the shell
  mirror never drifts from brand.ts, wired into the pre-push hook. Turns "keep
  in sync" from a comment into a guarantee.

tsc clean, eslint clean, 6/6 brand-sync assertions, drift case verified to fail.
2026-06-23 05:17:49 +02:00
GandClaude Opus 4.8 c545da37b5 feat(devops): verify box DB schema on every prod deploy (#21)
The pre-push schema-drift guard (#16) runs against the LAPTOP database, but the
Hetzner box has its own Postgres — so a table added in code but never pushed to
the box would silently 500 the first feature that queries it on prod (the same
failure that took down /prompts, /loki and System cron locally). deploy-hetzner
had no schema step at all.

- check-schema-drift.ts gains a `--print` mode: emit the schema-declared table
  names (no DB needed) so a remote deploy can compare against a database the
  laptop can't reach directly.
- deploy-hetzner.sh post-deploy verification now prints the declared tables,
  fetches the box's public tables over ssh (box reads its own DATABASE_URL),
  diffs them, and fails LOUDLY listing any missing — telling the operator to run
  drizzle-kit push rather than trusting a half-broken deploy.

Verified on a live deploy: "✓ schema: all 45 declared tables present on box".

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 18:01:21 +02:00
GandClaude Opus 4.8 c5cad9ba3a feat(db): read-only schema-drift guard to catch missing tables before they 500 (#16)
The Drizzle schema (src/db/schema) is the SSOT for what tables must exist, but
nothing in the deploy path runs drizzle-kit push. A table added in code reaches
the box unmigrated and silently 500s the first feature that queries it — exactly
how `prompts`, `cron_jobs`, `conversations` and `conversation_messages` went
missing and took down /prompts, /loki and the System cron list this session.

Add scripts/check-schema-drift.ts: compares schema-declared table names against
the live DB's public tables, exits 1 (listing the missing tables + the migrate
command) if any are absent. Strictly READ-ONLY — never creates/alters/drops.
Loads .env.local itself and skips cleanly (exit 0) when no DB is configured or
the DB is unreachable, so it never blocks a push for infra reasons.

Wired in two places:
- .husky/pre-push runs `npm run check:schema` — drift becomes a push-time error.
- scripts/deploy-local.sh prints a non-fatal warning on every local build, so
  drift surfaces at rebuild time too (a plain `npm run build` doesn't push).

Verified: reports "all 45 declared tables exist"; before this session's manual
table creation it would have listed the 4 missing ones.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 16:39:00 +02:00
GandClaude Opus 4.8 0780f4d99c fix(activity): strip harness scaffolding from prompt display titles (#10)
Dispatches can capture the fully-assembled prompt — context tiers plus harness
envelopes — so activity feeds rendered noise like "<task-notification><task-id>…"
as the title of every run. promptDisplayBody now runs a pure sanitizer that drops
<task-notification>/<system-reminder>/<command-*> blocks and stray harness tags,
falling through to the next source (resolved prompt → intent label) when a value
is all scaffolding. It only rewrites when a harness tag is actually present, so
clean prompts — and their whitespace — pass through verbatim. Fixes the titles on
both the /control Activity panel and the project-profile feed (PR #7).

Pure function, covered by 3 new prompt-history test cases (now 7/7).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 11:30:34 +02:00
GandClaude Opus 4.8 ed8333afa6 feat(context): seed FleetCrown's own roadmap goals + engineering-grade brief (#6)
Dogfood gap (2026-06-19): the `fleetcrown` project entity had a placeholder
description ("Local repository imported from …") and ZERO goals. getProjectContext
injects exactly the entity brief + active goals into every dispatch — so the
autopilot had no concrete roadmap and did generic work.

Add an idempotent, fleetcrown-scoped seed (scripts/seed-fleetcrown-roadmap.ts):
- Sets an engineering-grade brief (architecture: Fleet Runner executor, owned-PTY
  vs zellij, cloud/local split, 4-layer design tokens, SSOT conventions).
- Seeds the reliability/observability/context roadmap as 7 active goals, each with
  milestones that ARE its acceptance criteria (runner-stall recovery, run-outcome
  capture, truthful-state chips, owned-PTY migration, deploy+auto-migrate, one
  context assembler, i18n missing-key tooling).
- Re-runs touch only goals tagged metadata.roadmap=autopilot-reliability; manual
  goals are left alone.

Verified against local DB: getProjectContext('fleetcrown') now returns Global
standards + brief + all roadmap goals with next-milestones (3.9k chars vs the old
one-line placeholder). The box prod DB needs the same one-liner to affect live
dispatches (noted in feedback).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 10:49:42 +02:00
GandClaude Opus 4.8 ec3cab4f9d refactor(orchestration): build run summary from the SSOT field array (#5)
* feat(control): capture per-run commit SHA — truthful "did it ship?" state

Run outcomes recorded status/done/tests/health but never the commit a run
produced, so a self-reported "done" with no git trace looked identical to one
that actually landed code. Add `commit` to the orchestration summary contract
(SSOT), parse it from both the on-disk handoff and the finish API, and ask the
agent to emit `git rev-parse --short HEAD` in its handoff. The Previous-run
panel now shows the SHA, and flags a finished+done run that recorded no commit
with a "no commit" warning chip — surfacing the untruthful-state failure mode
the control loop must catch instead of trust.

Summary is JSONB, so no schema migration. block-reason/no-op-count remain
dropped by the two hand-written summary literals (separate follow-up).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(orchestration): build run summary from the SSOT field array

parseOrchestrationSummary and the /finish route each hand-wrote the summary
object, so block-reason and no-op-count — both in ORCHESTRATION_TASK_SUMMARY_FIELDS
— were silently dropped when a summary was persisted via the finish API (they
survived only on the session.md path, which builds generically). A self-throttled
agent reporting block-reason: awaiting_user would have that loop-control signal
thrown away on the cloud dispatch path.

Add buildOrchestrationSummary(fields) — Object.fromEntries over the SSOT array —
and use it in both places. Adding a field to the contract array now persists it
everywhere; no literal can drop one again. New test covers the previously-lost
fields.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 10:36:34 +02:00
GandClaude Opus 4.8 05c57b3208 feat(control): capture per-run commit SHA — truthful "did it ship?" state (#4)
Run outcomes recorded status/done/tests/health but never the commit a run
produced, so a self-reported "done" with no git trace looked identical to one
that actually landed code. Add `commit` to the orchestration summary contract
(SSOT), parse it from both the on-disk handoff and the finish API, and ask the
agent to emit `git rev-parse --short HEAD` in its handoff. The Previous-run
panel now shows the SHA, and flags a finished+done run that recorded no commit
with a "no commit" warning chip — surfacing the untruthful-state failure mode
the control loop must catch instead of trust.

Summary is JSONB, so no schema migration. block-reason/no-op-count remain
dropped by the two hand-written summary literals (separate follow-up).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 10:14:02 +02:00
Mao NakamotoandClaude Opus 4.8 46d39714c6 fix(control): fuzzy tab matching, stale-backlog purge, actionable launch timeout
The dispatch last-mile was failing on real edges once the runner went live:

- Project keys never matched the names users actually gave their Zellij tabs:
  "revampit" ≠ "revamp-it", so focus/inject/launch threw "tab not found". New
  SSOT findMatchingTab() (src/lib/tab-match.ts) normalizes case + punctuation
  and is used in all three matching sites (terminals/zellij, agent-runtime,
  desktop poller). Existing fuzzy-matched tabs are reused; only a genuinely
  absent tab is created under its canonical name.
- A runner reconnecting after days offline drained a stale command backlog
  against a changed Zellij and failed noisily. purgeStalePendingCommands()
  deletes unclaimed/unexecuted commands older than 20m before claiming.
- launch_agent against a detached session hung to the 6s timeout and surfaced a
  cryptic "spawnSync /bin/sh ETIMEDOUT"; now it says which session is detached
  and to `zellij attach` it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:43:24 +02:00
Mao NakamotoandClaude Opus 4.8 e76211aebf feat(brand): dense-coil spiral SSOT, Geist type, dark-first
One source for the brand mark (src/config/brand-mark.ts): a dense Archimedean
spiral that pulls into the center. `npm run generate:brand` renders every asset
from it — favicon, apple icon, 1024px app icon, the monochrome tray glyph, and
the OG marks — replacing the divergent hand-drawn copies and the wrong
"control-window" tray glyph. The desktop step now verifies committed icons
instead of redrawing them.

Also: switch typography to Geist + Geist Mono (the x.ai/grok grotesk) via the
--font-* token SSOT, default the theme to dark (Settings toggle still
overrides), and give the in-app mark a slow rotation + soft glow
(reduced-motion safe).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 14:23:25 +02:00
Mao NakamotoandClaude Opus 4.8 ed382a1f0c fix(deploy): copy node-pty native binary into standalone build
Phase 2b browser-verify exposed it: Next's standalone tracer copies node-pty's
JS (lib/, package.json) but not its dynamically-loaded build/Release/pty.node,
so /api/workspaces 500'd with 'Failed to load native module: pty.node'. The
postbuild deploy already copies tracer-missed assets (static/public/content) —
node-pty's binary belongs in the same step. Verified: with the binary present,
the embedded PTY terminal round-trips end-to-end in the browser (provision +
output stream + keystroke input + event-sourced status), zero zellij.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 08:17:30 +02:00
Mao NakamotoandClaude Opus 4.8 992aee23a8 feat(workspaces): Phase 2 — stream the owned PTY to the browser xterm
Connection plane for the agent-execution platform: the FleetCrown-owned PTY now
reaches the UI with no zellij in the path.

- Renamed the module src/lib/executor -> src/lib/agent-execution to avoid
  colliding with the pre-existing command-executor (src/lib/executor.ts:
  direct-zellij vs cloud pending_commands), which was shadowing the dir import.
- API: POST /api/workspaces (provision, idempotent per user+project) + GET
  (list); GET /api/workspaces/[id]/stream (SSE: replays retained history via
  Last-Event-ID, then live output/status/exit); POST /api/workspaces/[id]
  (input / resize / terminate). Auth by workspace-id prefix (userId:projectKey)
  — multi-tenant safe, node runtime.
- WorkspaceTerminal.tsx: wraps the @xterm/xterm already shipped, fed by the SSE
  stream, keystrokes -> POST. Drop-in replacement for the zellij screen-dump peek.

Executor test still 11/11 green. Next: wire Control's 'Open workspace' at this
+ provision-on-launch, then SandboxExecutor for multi-tenant prod.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 02:38:41 +02:00
Mao NakamotoandClaude Opus 4.8 0463521e9e feat(executor): Phase 1 — Executor interface + LocalPtyExecutor (own the PTY)
First step of the agent-execution-platform: FleetCrown owns each agent's PTY
instead of puppeting a zellij session by name. Terminal-agnostic by construction
— traffics in a stable workspace id, raw PTY bytes, and event-sourced status, not
session/tab names.

- src/lib/executor/types.ts — the Executor interface (the SSOT abstraction;
  LocalPty now, SandboxExecutor later, same interface, no control-plane changes).
- src/lib/executor/local-pty.ts — node-pty implementation: spawn/write/resize/
  subscribe/terminate, ring-buffered events with monotonic seq for reconnect
  replay, and status derived from the owned process (output=running, quiet=idle,
  exit=exited) — no /proc, no /tmp sentinel, no screen-scrape.
- src/lib/executor/index.ts — globalThis-pinned singleton (true process-wide
  PTY registry across Next module re-eval).
- node-pty dep + serverExternalPackages (native addon, Node runtime only).
- scripts/test/executor.ts — 11 round-trip assertions, all green.

Next (Phase 2): stream the PTY to the @xterm/xterm already shipped + input path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 02:00:11 +02:00
Mao NakamotoandClaude Opus 4.8 a991b36de6 feat(hetzner): reinstate sibling-app cron jobs as systemd timers
After the Vercel exit (2026-06-12), Vercel Cron stopped firing the
routes in each app's vercel.json crons array — daily/weekly jobs
(emails, reminders, dunning, digests, rebuilds) silently died. This
installer mirrors each app's schedule into systemd timers that call the
route on localhost with the app's CRON_SECRET (read from the app .env at
run time). Box is Etc/UTC. Idempotent. Mirror of the vercel.json crons
(the schedule SSOT). 22 jobs across 7 apps.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 22:26:14 +02:00
Mao NakamotoandClaude Opus 4.8 334b1bd404 docs: correct stale infra/brand drift to current reality
Bring docs + config in line with what's actually deployed (self-hosted
Hetzner, Postgres 'fleetcrown', no Vercel/Neon):

- .env.example: 'Production (Vercel)' -> self-hosted Hetzner; drop the
  removed-in-c6bc058 Neon fallback line (NEON_* is no longer read);
  cockpit-app -> fleetcrown-app; cockpit DB -> fleetcrown in example URL
- docker-compose.yml: local-dev Postgres db/user cockpit -> fleetcrown
  (matches the box DB name; was internally inconsistent)
- docs/debt-reduction-roadmap.md + scripts/fleet: dead /home/g/dev/cockpit/
  paths -> /home/g/dev/fleetcrown/ (repo was renamed; links were broken)
- scrub real-name/email leaks from committed content: 'George' -> 'a solo
  founder' in the kill-switch essay; real test email -> generic in the
  one-click dev plan (pseudonym hygiene)

Preserved all legitimate historical mentions (migration docs, thoughts
essays describing the exit from Vercel/Neon).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 20:00:25 +02:00
Mao NakamotoandClaude Opus 4.8 a949263413 chore(scripts): remove orphaned migrate-local-to-neon.sh wrapper
Neon is fully retired (Hetzner self-host). The wrapper had zero
references and only exec'd db/sync-user-data.sh — dead weight.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 19:41:58 +02:00
Mao Nakamoto 0cc2654fa9 chore: checkpoint working state (GitHub safety sync) 2026-06-16 19:15:02 +02:00
Mao NakamotoandClaude Opus 4.8 391c592e70 docs(infra): Ivy co-location runbook + migrate-openclaw.sh
Sequenced runbook for moving OpenClaw/Ivy onto the (now CX43, 16GB) box —
co-located, hardened (non-root user, pg_hba deny, loopback gateway), with the
off-box heartbeat that makes co-location safe. migrate-openclaw.sh automates
the mechanical parts (stop→package→transfer→restore→perms) and gates the
credentialed/judgment steps (gateway install, venv rebuild, WhatsApp re-pair).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 18:19:47 +02:00
Mao NakamotoandClaude Opus 4.8 5c3c6f5efd feat(infra): box-wide uptime/health watchdog + alerting
Closes the 'loud signal nobody hears' gap — we built /api/health (503 on
config rot), the email canary, and the deploy provider-assertion, but
nothing was watching them. (Today the app crash-looped for ~1min and the
only reason anyone noticed was a tailed journal.)

scripts/hetzner/install-watchdog.sh installs a systemd timer (every 5 min)
that checks FleetCrown /api/health + every public app domain (seeded from
apps.conf SSOT), redirect-aware (2xx/3xx = up; 000/4xx/5xx = down, so a 503
from the env guardrail alerts). Transition-only alerting (no per-tick spam),
via Telegram when /opt/monitoring/telegram.env has a token, else the journal
— same drop-in-to-activate pattern as backups' restic.env. Supports a
HEARTBEAT_URL dead-man's-switch for box-death (which a box-local watchdog
can't self-report).

Verified live: 15 targets, 0 false positives after making the check
redirect-aware (4 locale-redirect sites were 307→200).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 16:37:35 +02:00
Mao NakamotoandClaude Opus 4.8 eaf23c676f feat(auth/email): Tier 2 — auth self-tests + daily email canary
Tests (scripts/test/auth.ts, wired into pre-push): 13 framework-free,
DB-free assertions on the security-critical primitives — X 1.0a ticket
mint/verify/tamper/expiry/empty-secret, the env guardrail (whitespace
corruption, half-set provider pairs, missing AUTH_SECRET), password hash
round-trip. First real src/ test coverage.

Email canary (api/crons/email-canary, daily 06:00 via fc-cron timer): sends
to EMAIL_CANARY_TO and logs the outcome to debug_logs, so Resend key-rot /
domain breakage surfaces within 24h instead of when a user can't reset.

It worked on first fire: caught that prod EMAIL_FROM was Resend's test
domain (onboarding@resend.dev) — so ALL email to real users was silently
failing. Fixed on the box to the verified domain
(noreply@fleetcrown.orangecat.ch); canary now green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 16:21:48 +02:00