Commit Graph
19 Commits
Author SHA1 Message Date
Mao Nakamoto cdc042a131 feat: ship activity runtime parity fixes 2026-06-10 14:57:19 +02:00
Mao NakamotoandClaude Opus 4.7 f0d4795945 feat(states): finish SSOT — bash vocab + agent prompt context + daemon banner
Phase B + C + D of /home/g/.claude/plans/ethereal-crunching-clover.md.

B1. Generate bash state vocabulary from the TS SSOT
   - scripts/generate-bash-state-vocab.ts reads STATE_DEFINITIONS from
     src/lib/control-states.ts and emits scripts/control-states.generated.sh
     with FC_LABEL_<KEY>, FC_DESCRIPTION_<KEY>, FC_COUNTER_CATEGORY_<KEY>
     for every state.
   - Wired into package.json's prebuild step so every `npm run build`
     refreshes the file. Daemon sources it; new states propagate without
     hand-editing any bash.

B2. Agent prompt context reads STATE_DEFINITIONS[k].description
   - buildPromptWithSession(base, tab, projectStateDescription?) gained
     a third optional argument. When passed, prepends
     "Project state: <description>" before the session-state block — the
     same one-line WHY the human sees on the badge hover tooltip.
   - deriveProjectStateKey() in control-states.ts maps the raw signal
     set (agentRunning / tabOpen / sessionStatus / readyAt / lockAt /
     closingAt / closedAt) to a ProjectStateKey without dragging in the
     full presenter machinery.
   - Threaded into /api/inject (promptKey path) and the Claude +
     Codex/Gemini paths in /api/orchestration/run. The agent now reads
     the same words the user reads.

C. ControlFleetStatus migrated to DAEMON_STATE_DEFINITIONS
   - lib/control-states.ts gains a sibling SSOT for daemon-side states
     (setup_needed / offline / state_unknown / connected). Same shape:
     label, description, dotClass, problem hint.
   - ControlFleetStatus reads from it for the banner label + tooltip +
     problem CTA, dropping the hand-rolled `daemonNeverSeen ? "Setup
     needed" : daemonOffline ? "Daemon offline" : ...` tree.
   - "Setup needed" surfaces an "Install Fleet Runner" action chip
     linking to /download with the longer how-to on hover — same
     pattern the per-project badge uses.
   - DaemonStatusBanner (the rich 320-line install/recovery card) is
     left alone — its UX is distinct from the status indicator.

D. Cleanup
   - fleetcrown-daemon.sh now traps EXIT in addition to INT/TERM and
     kills its forked sibling daemons (the multi-source polling forks
     spawned for each FLEETCROWN_BASE_URLS entry). Was a defensive
     improvement; the observed "12+ stale daemons" turned out to be
     normal subshell tree.
   - .env.vercel.production renamed to .OLD so an accidental
     `vercel --prod` from CLI doesn't reupload the stale Neon URLs over
     the live Hetzner Postgres (memory/pattern_vercel_cli_env_local_override.md).
     .gitignore extended to keep the .OLD file out of git too.
   - DATABASE_URL + DATABASE_POOL_URL moved from a single-branch preview
     scope to all-preview, so future PRs build without the
     "DATABASE_URL is required" build crash we hit on the
     arch/control-stream-no-poll branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-09 14:50:42 +02:00
Mao NakamotoandClaude Opus 4.7 83321fdbd1 fix(build): exclude desktop/ + squashfs-root from Next standalone bundle
CRITICAL — Vercel deploys had been failing silently for hours with:

  Error: A Serverless Function has exceeded the unzipped maximum size
  of 250 MB.

Every commit since I started bundling more in desktop/ (electron-updater,
@sentry/electron, bundled Zellij ~35 MB, AppImage build outputs ~500 MB)
made it worse, but the root cause was older: Next.js's output:
"standalone" tracer was copying the WHOLE `desktop/` subtree (542 MB —
the entire Electron app + its node_modules + AppImage artifacts) into
every serverless function bundle, even though nothing in the web app
imports from desktop/.

Result: bundle was 627 MB locally (one function ≥250 MB on Vercel) ⇒
deploy step errored ⇒ none of my last ~6 commits actually shipped to
production. Including the /control crash fix (95fb08b), the palette
close fix, and the prompt reordering. Users were still seeing the
broken page.

Fix: next.config.ts outputFileTracingExcludes["*"] now excludes
- ./desktop/** (the Electron subproject — never touched by the web app)
- ./squashfs-root/** (AppImage extraction artifact left from local debug)

Verified locally: standalone bundle 627 MB → 78 MB. Well under the limit.

.gitignore also now excludes squashfs-root/ so the next AppImage extract
doesn't surprise anyone.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 22:47:41 +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
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 4e529f207a fix(site,settings): escape quotes in JSX, remove unused APP_NAME import after updating copy to promote desktop 2026-06-02 11:36:20 +02:00
g-but f6dc058459 chore(repo): sharpen public repo surface 2026-05-28 12:47:41 +02:00
g-but b796f9f62d chore(security): gitignore .env*.local so vercel env pull files can't leak
Pulling prod secrets with `vercel env pull .env.production.local` is
the canonical way to query the prod DB from this repo, but that file
wasn't covered by .gitignore — only the older .env.local and
.env.vercel.production patterns were. One absent-minded `git add -A`
and the Neon DATABASE_URL, AUTH_SECRET, GITHUB_CLIENT_SECRET, etc.
would land in a public commit.

Add .env*.local to cover every Next.js env-overlay convention
(.env.production.local, .env.development.local, .env.test.local).
2026-05-24 23:24:31 +02:00
g-butandCursor ec6f423b0f feat(infra): Postgres portability, Oracle cutover scripts, and DB kill-switch essay
Vendor-neutral DATABASE_URL helpers, dump/restore/sync tooling, and one-command
Oracle migration after a single console VM step. Publishes the studio-stack
thoughts article and hardens build (dynamic layout, resilient sitemap).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-23 11:24:20 +02:00
g-butandClaude Sonnet 4.6 8e54940bf5 chore: remove unused readyAtKey import and isSessionOpen prop
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 14:43:40 +02:00
g-butandClaude Sonnet 4.6 ff7828e19a chore: ignore next-env.d.ts and Python __pycache__ in gitignore
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 21:28:48 +02:00
g-butandClaude Sonnet 4.6 d3ce6bbd73 fix(control): eliminate three correctness bugs and a SSOT naming collision
1. gitignore: add .local-toolchain/ and .python-vendor/ (584 MB of
   toolchain binaries that would never belong in the repo)

2. autoContinueEnabled: replace two-effect pattern (read + write) with
   a lazy useState initializer. The old pattern had a race where the
   write effect ran with the stale initial 'true' value before the read
   effect could correct it, silently overwriting a user's 'off' preference
   on every page load.

3. SENTINEL_VALIDITY_S: extract the duplicated 86400-second constant into
   constants/control.ts as SENTINEL_VALIDITY_S, separate from the display-
   window constants (READY/CLOSED/CLOSING_WINDOW_S). Two files had a
   local 'const READY_WINDOW_S = 86400' that shadowed and conflicted with
   the exported READY_WINDOW_S = 600 in constants/control.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 17:31:53 +02:00
g-butandClaude Sonnet 4.6 3ec355c750 chore: gitignore root-level screenshot artifacts (*.png, *.jpeg)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 20:36:33 +02:00
g-butandClaude Sonnet 4.6 ada41dc64f fix(today): stale contacts pill now only counts contacts with prior interactions
1279→106: importing WhatsApp contacts created 1279 "stale" entries because
the query matched IS NULL (never interacted). Contacts with no interaction
history are dormant imports, not contacts that need rekindling — only those
you've previously engaged deserve the "needs attention" signal.

Changed LEFT JOIN → JOIN and dropped OR max IS NULL clause. Updated pill
link to remove the `unknown` health filter for consistency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 19:46:44 +02:00
g-butandClaude Sonnet 4.6 3a56dbc748 chore: seed scripts, crons, sessions, docs, gitignore, package updates
- scripts/seed.ts + seed-goals.ts — updated entity/attribute seeding
- src/app/api/crons/route.ts — cron schedule updates
- src/app/api/sessions/route.ts — session handling fix
- docs/ — openclaw orchestration plan document
- .gitignore — added .next/logs to ignore list
- package.json/lock — dependency updates
- next-env.d.ts — auto-generated update

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 11:50:29 +02:00
g-butandClaude Opus 4.7 52a0e7aef1 refactor(api): extract readIdParam, drop 20× UUID-validation boilerplate
Every /api/.../[id]/route.ts handler started with the same three lines:

  const { id } = await params;
  if (!isValidUuid(id)) return NextResponse.json({ error: ... }, { status: 400 });

23 occurrences across 12 files, with drift between "Invalid id" /
"Invalid ID" / `null` payloads.

Centralise as src/lib/api/route-helpers.ts:readIdParam(params), which
returns the validated id or a 400 NextResponse the caller returns
as-is. Migrate 20 of the 23 sites; three outliers stay hand-coded:

- people/[id] GET and projects/[id] GET return `null` body for 4xx
  (consumer contract — `.then(d => setData(d))` relies on null)
- crons/run is a body-field check, not a route param

Capitalisation drift ("Invalid ID" → "Invalid id") collapses to one
canonical spelling. Also: ignore .claude/ session-state files.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 09:30:27 +02:00
g-butandClaude Opus 4.6 102c35c3e3 feat: Cockpit Phase 1 — full app with 6 active views
- Next.js 16 + Tailwind 4 + shadcn/ui + Drizzle ORM + PostgreSQL 17
- 9-table knowledge graph schema with UUIDs, JSONB, multi-user prep
- Seed script: knowledge.sqlite (33 entities) + contacts (1,278 people)
- Today: calendar (gog), weather, commitments, upcoming bills
- People: searchable grid of 1,286 contacts, detail panel
- Money: subscription tracker, monthly burn calculation
- Projects: project list + GitHub CI status
- System: gateway health, memory, disk, uptime
- Memory: knowledge graph stats and entity distribution
- Goals: placeholder (Phase 2)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 23:31:14 +02:00
g-but 0e0852330a feat: initial commit 2026-04-04 22:47:22 +02:00