Commit Graph
1304 Commits
Author SHA1 Message Date
g-butandClaude Sonnet 4.6 97f65d1b7a feat(beacon): pre-warm live tab — web popup speed matches Python notify
Replace cold-open-per-session with a persistent /beacon/live tab that
stays open in the --app= frameless window. New SSE endpoint polls
/tmp/cockpit-beacon/ at 150ms and pushes fresh sessions to the tab,
so the popup appears in < 150ms with no browser cold start.

beacon.py now tracks the live-browser PID and focuses the existing
window instead of launching a new one. BeaconPageClient accepts onClose
so the live tab resets to standby instead of calling window.close().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 18:05:30 +02:00
g-butandClaude Sonnet 4.6 795f4b9974 fix(beacon): SSR initial session load + prefer Brave for popup
Two fixes to make the beacon popup work without requiring the browser to
be logged into Cockpit:

1. Server-side initial session read — page.tsx is now a Server Component
   that reads the beacon session directly from /tmp/cockpit-beacon/{id}.json
   before sending HTML to the browser.  The client receives a fully-populated
   initialSession prop and shows session content immediately — no client-side
   GET /api/beacon/{id} needed on page load.  The PATCH (recording the user's
   choice) and the cancel-detection poll still go through the API, which
   works as long as the browser that opens the popup has a Cockpit session.

2. Prefer Brave browser for the popup — beacon.py now checks for brave-browser
   before google-chrome in the candidate list.  The user's Cockpit session
   lives in Brave (the primary browser), so opening there means API calls
   from the beacon page are authenticated automatically.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 17:21:09 +02:00
g-butandClaude Sonnet 4.6 77aec7eca5 fix(today): surface habit toggle errors in HabitsList instead of silent revert
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 16:38:34 +02:00
g-butandClaude Sonnet 4.6 5b35c8b6f3 fix(beacon): unblock /api/beacon from middleware + fix PyQt crash
Two bugs preventing the popup from working:
1. /api/beacon was matched by the auth middleware (401 for unauthenticated
   beacon.py). Added api/beacon to the middleware exclusion list — sessions
   are /tmp UUIDs with no sensitive data.
2. FocusCancelTextEdit(QPlainTextEdit) called setAcceptRichText which does
   not exist on QPlainTextEdit (it's a QTextEdit method). Removed the
   redundant call — QPlainTextEdit is plain-text-only by definition.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 16:32:50 +02:00
g-butandClaude Sonnet 4.6 b739b6f02f fix(people): replace bare 'Loading...' name in PersonDetail sticky header with skeleton pill
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 16:26:59 +02:00
g-butandClaude Sonnet 4.6 8b750d9666 fix(control): replace bare 'Loading…' with structural skeletons
Header loading text becomes a pulse pill; sidepanel shows 4 skeleton
metric cards while useControlData fetches, matching the real 2×2 grid.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 16:24:47 +02:00
g-butandClaude Sonnet 4.6 bdf60a9086 fix(ui): replace bare loading text with structural skeletons in GitHubStatus and PersonDetail
GitHubStatus showed 'Checking repos...' text; now shows 3 repo-row
skeletons (status icon circle + name bar / PR count + CI name bars).

PersonDetail drawer showed 'Loading...' text; now shows description
block, 2x2 attribute grid, and 3 interaction-row placeholders — matching
the actual drawer body layout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 16:12:35 +02:00
g-butandClaude Sonnet 4.6 ae77749c8a fix(today): replace bare 'Loading...' text with structural skeletons in CalendarCard and WeatherCard
Both cards showed unstyled loading text while every other card on /today
used animate-pulse placeholder blocks. CalendarCard now shows 3 event-row
skeletons (time col + title/location); WeatherCard shows the icon + temp
+ condition block layout, keeping visual structure consistent during load.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 16:08:33 +02:00
g-butandClaude Sonnet 4.6 f6cb0dc681 fix: remove duplicate auth check in stripe portal, drop stale date, expand smoke to 36
- stripe/portal: remove copy-paste duplicate if (!userId) guard (dead code)
- money page: remove hardcoded Apr 2026 verification date that was already
  stale and would keep rotting; label remains without the date
- smoke.sh: add /api/setup (public), /api/checkout/personal, and
  /api/stripe/portal (accepts 401 + 503 when Stripe not configured);
  extend check_route with extra_ok_code param for integration-gated routes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 16:04:35 +02:00
g-butandClaude Sonnet 4.6 ad70f4f793 fix(habits): surface mutation errors in HabitCard instead of silent failure
All four operations (frequency change, active toggle, done toggle, delete)
previously swallowed errors silently after reverting optimistic state.
Now flash a 3-second inline error message below the card on failure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 15:59:40 +02:00
g-butandClaude Sonnet 4.6 e6c65d3778 fix(auth): gate owner-key tab on LOCAL_AUTH_PASSWORD, move sign-up link into form
The owner key tab was always visible even when LOCAL_AUTH_PASSWORD is not
set, confusing users who don't use local auth. Now conditional on the env
var (passed server-side to avoid hydration mismatch).

Also moves the "No account?" link inside the email AuthCard instead of
using AuthFooterLink below, which visually associates it with the form.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 15:58:50 +02:00
g-butandClaude Sonnet 4.6 5a815ceaba fix(people): surface search fetch errors with retry instead of silent failure
PeopleGrid was rethrowing non-abort errors into a discarded promise, leaving
users looking at stale results or an empty list with no indication that the
search failed. Now sets fetchError state, shows an inline error banner with a
Retry button, and clears the error on the next successful fetch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 12:10:09 +02:00
g-butandClaude Sonnet 4.6 dc791e5134 fix(ux): add SummaryBar loading skeleton, surface silent errors, fix reorder revert
- SummaryBar: add SummaryBarSkeleton (5 animated pills) as Suspense fallback
  instead of null — /today no longer shows blank space during DB queries
- ProfileSettings: show actual window.location.host instead of hardcoded
  'cockpit.app' in the username prefix — correct on localhost and Vercel
- BeaconSettings: surface load failure with an error message instead of
  silently rendering defaults when /api/beacon-settings is unreachable
- ProjectsSettings: reorder now reverts UI and shows error if any PATCH
  fails — previously silent failure left UI and server out of sync

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 12:00:24 +02:00
g-butandClaude Sonnet 4.6 632fcc16c8 feat(health): expose runtime and version in /api/health; purge stale beacon sessions
/api/health now returns { ok, runtime, version } — runtime signals whether this
is the local machine instance (RUNTIME_AVAILABLE=true) vs a cloud deployment,
enabling scripts and monitoring to distinguish the two without auth.

Beacon POST purges sessions older than 10 minutes from /tmp/cockpit-beacon/
on each new creation, preventing unbounded accumulation over time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 11:47:12 +02:00
g-butandClaude Sonnet 4.6 c54858345a fix(middleware): rename to proxy.ts, return 401 for unauthenticated API requests, exclude public API routes
- Renamed src/middleware.ts → src/proxy.ts (Next.js 16 convention)
- Removed stale src/middleware.ts that conflicted with proxy.ts
- authorized() callback now returns JSON 401 for /api/* routes instead
  of redirecting to sign-in (clients expect JSON, not HTML redirect)
- Added api/crons and api/system to matcher exclusions — these are
  intentionally public endpoints used by the daemon and monitoring

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 11:32:43 +02:00
g-butandClaude Sonnet 4.6 4e40609387 fix(security): guard /api/sessions and /api/prompts/agent against unauthenticated access
Both routes use fs.readFileSync without any Next.js dynamic API call, so
Next.js could statically pre-render them and bypass middleware. Added
`export const dynamic = "force-dynamic"` plus explicit getSessionUserId()
checks — /api/sessions also allows daemon bearer-token requests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 11:14:44 +02:00
g-butandClaude Sonnet 4.6 20b7a9dd49 feat(auth): add middleware.ts to activate global auth and onboarding gate
auth.config.ts had a complete authorized() callback (unauthenticated →
/sign-in, not-onboarded → /onboarding, daemon bearer token pass-through)
but no middleware.ts to wire it up — it was dead code.

Uses NextAuth(authConfig).auth, an edge-safe instance with no DB adapter
or Node.js crypto. The matcher uses .+ (not .*) so the bare / path
(public landing page) is excluded without needing extra matcher logic.

Matcher explicitly excludes all public surfaces: landing (/), auth pages
(sign-in, sign-up, forgot-password, reset-password, setup, invite),
public content (whitepaper, thoughts, u/, beacon), NextAuth internals
(api/auth), and infrastructure endpoints (api/health, api/setup).

Verified: landing 200, /today unauthenticated → /sign-in?callbackUrl=%2Ftoday,
sign-in 200, whitepaper 200. All 28 smoke routes green.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 11:01:03 +02:00
g-butandClaude Sonnet 4.6 f33d8dbcd1 feat(security): rate-limit register and forgot-password endpoints
Adds a sliding-window in-memory rate limiter (lib/rate-limit.ts).

- /api/auth/register:       10 requests / IP / hour  → 429 + Retry-After: 3600
- /api/auth/forgot-password: 5 requests / IP / 15 min → 429 + Retry-After: 900

Works correctly for the local-server deployment (single long-lived process).
On Vercel serverless, limits within a warm invocation — still raises the cost
of rapid-fire attacks without requiring Redis or external infrastructure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 10:45:28 +02:00
g-butandClaude Sonnet 4.6 5c82f81d0c fix(auth): move onboarding to public surface, auto-fire sign-out, fix copy
Onboarding was inside (app) and rendered wrapped in the full AppShell
(sidebar visible). Moved to top-level app/onboarding/ so it uses
AuthShell → PublicSurface — same clean layout as sign-in/sign-up.

Sign-out no longer shows a confirmation page; it fires signOut()
immediately on mount and shows a spinner. The confirmation added
friction without protecting anything meaningful in a personal tool.

Sign-up description updated from generic filler to copy that matches
the landing page voice.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 10:41:32 +02:00
g-butandClaude Sonnet 4.6 daa264286d feat(public): x.ai-style nav, owner-key tab, redesigned landing
- PublicSurface now accepts navLinks prop; renders desktop link row
  with a subtle border-bottom separating nav from content
- Landing page gets Features | Pricing | Whitepaper nav links with
  scroll anchors; hero drops the badge, adds dual CTAs (Sign in +
  Get started →) matching the x.ai pattern
- All auth pages inherit the same nav via AuthShell automatically
- Sign-in replaces the hidden "Use owner key" text link with a visible
  Email / Owner key tab switcher — owner password is no longer buried

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 10:27:28 +02:00
g-butandClaude Sonnet 4.6 b8fa8b89e9 fix(auth): trust localhost in production standalone server
Auth.js v5 in production rejects unrecognized hosts by default, causing
every session check at localhost:3000 to throw UntrustedHost and spam
the journal. The error prevented sign-in from working at all on the local
production server.

Fix: set trustHost from AUTH_TRUST_HOST env var (sourced from .env.local
by cockpit-app.sh at startup). Vercel keeps working via the existing
VERCEL=1 auto-trust. Local .env.local has AUTH_TRUST_HOST=true added.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 21:50:53 +02:00
g-butandClaude Sonnet 4.6 c8a0d6b7c4 fix(build): remove duplicate middleware.ts that conflicts with proxy.ts
Next.js 16 renamed middleware.ts → proxy.ts. The old file was never
deleted, causing the build to fail with "both middleware and proxy file
detected." Merged the missing public-route exclusions (sign-up,
forgot-password, reset-password) into proxy.ts and deleted middleware.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 21:04:11 +02:00
g-butandClaude Sonnet 4.6 b7c2bea591 fix(commands): drain queue for all user IDs, not just isDefault user
The daemon was calling claimNextPendingCommand(getDaemonUserId()), which
only claimed commands stored under the isDefault user's row. Commands
enqueued by a session authenticated via GitHub OAuth (a different DB row
for the same person) were silently ignored and never executed.

Fix: daemon now fetches all distinct userIds from user_projects and
claims commands for any of them. Also makes the claim atomic via a
transaction with FOR UPDATE SKIP LOCKED, preventing a theoretical
double-claim race if two pollers hit the endpoint simultaneously.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 20:52:40 +02:00
g-butandClaude Sonnet 4.6 2eda5b77cd fix: harden runtime-state lookup + remove dead prefer_browser_ready_ui setting
getUserIdsByProjectNames: replace case-sensitive inArray with lower()-based
equality so conf-file tab names with different casing still resolve the
right user. Also fixes potential LIKE-wildcard injection via ilike.

prefer_browser_ready_ui: the old "open browser window" beacon mode was
replaced by PyQt-primary months ago. The toggle has been a no-op ever
since — remove it from BeaconSettings and the API to stop misleading users.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 20:36:52 +02:00
g-butandClaude Sonnet 4.6 6291bc609b fix(control): resolve actual project owner in runtime-state push
getDaemonUserId() returns the isDefault user's ID, but the owner may be
logged in as a different user (e.g. GitHub OAuth creates a separate row
when the setup user has no email). This caused project_states to be stored
under user A while the SSE read for user B — showing all 20 projects idle
even with Claude running in multiple zellij tabs.

Fix: look up which user actually owns each project via user_projects, fall
back to daemonUserId only for unregistered projects.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 20:24:09 +02:00
g-butandClaude Sonnet 4.6 618a6cde1f fix(control): remove readProjectsMap fallback from clear-context route
Resolves canonical tab name from the user's own DB projects only,
consistent with the same fix applied to agent and inject routes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 20:16:53 +02:00
g-butandClaude Sonnet 4.6 f80cdccf33 fix(control): remove parseProjectsConf leaks from agent and inject routes
applyToOpenTabs in /api/control/agent was merging the owner's conf-file
projects with the current user's DB projects, allowing any authenticated
user to force-restart the owner's Claude sessions.

/api/inject was resolving canonical tab names and project paths from the
owner's conf file before falling back to DB — now DB-only for both.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 20:00:49 +02:00
g-butandClaude Sonnet 4.6 bd7929786b fix(middleware): exclude beacon and health routes from auth
beacon.py calls /api/health (to detect if Cockpit is up) and /api/beacon
(to create/poll/patch sessions) without a session cookie. With these
routes protected the calls were silently redirected to /sign-in, causing
_create_web_session() to always return None and breaking two-way sync
between the PyQt popup and the Control panel ReadyBanner.

/api/beacon writes only ephemeral /tmp data — no user-sensitive state.
/api/health is a no-op check. Both are safe to expose publicly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 19:53:18 +02:00
g-butandClaude Sonnet 4.6 bd0dfe4ddf chore: remove dead DEFAULT_USER_ID constant
No longer referenced in any application code after the data isolation
audit replaced all user-resolution paths with getSessionUserId().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 19:43:21 +02:00
g-butandClaude Sonnet 4.6 ce74277d1d fix(control): remove conf-file fallback that leaked owner projects to all users
Both /api/control and /api/control/stream fell back to parseProjectsConf()
when the authenticated user had no DB projects yet. The conf file contains
the owner's personal project list, so any signed-in user with no projects
of their own would see all of the owner's projects in their control panel.

Fix: drop the fallback entirely. Each user now sees only the projects in
their own user_projects rows. The owner already has their projects there,
so backward compatibility is unaffected. New users who skip onboarding
or haven't added projects yet see an empty control panel — correct.

Also removes the now-dead parseProjectsConf import from both routes and
collapses the usingUserProjects conditional into a single filter+map.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 19:35:52 +02:00
g-butandClaude Sonnet 4.6 fc6282e1fb feat(auth): enforce onboarding flow for new self-registered users
Three-part fix:

1. auth.config.ts — add session callback to propagate onboardedAt from
   the JWT payload so the middleware can check it without a DB lookup;
   add authorized() gate that redirects authenticated-but-not-onboarded
   users to /onboarding for all page routes (API routes pass through so
   the /api/me and /api/user-projects calls from the onboarding page work).

2. sign-up/page.tsx — redirect to /onboarding after registration instead
   of /today, so new users immediately enter the username + first-project
   setup flow.

3. db/queries/users.ts — remove the premature onboardedAt: new Date()
   from createUser(). New self-registered users now have onboardedAt=null
   until they complete /onboarding. createInitialUser() (owner account)
   and the invite flow keep their immediate onboardedAt, since those users
   don't need guided setup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 19:25:21 +02:00
g-butandClaude Sonnet 4.6 4d17f2a928 fix(control): don't label projects idle when daemon state is unknown
When accessing the control panel from Vercel (or any remote browser)
and the local daemon is offline or has never connected, the DB shows
agentRunning=false for every project — not because they're idle, but
because there's no live signal. This caused the Cockpit project itself
(with an active Claude session) to appear in the "Idle projects" section.

Fix: when daemon is offline/never-seen, collapse the active/idle split
entirely and show all projects in the main list. The DaemonStatusBanner
already explains why state is stale; the fleet view no longer claims
projects are idle when it simply doesn't know.

Also made ControlMetricCard.note optional so the "N idle" note can be
suppressed in the stat card when daemon state is unknown.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 19:16:19 +02:00
g-butandClaude Sonnet 4.6 fe282bf761 fix(auth): GitHub OAuth creates separate accounts per user
Replaced the hard-coded default-user link in the signIn callback.
Previously, every new GitHub login was linked to the default user.
Now allowDangerousEmailAccountLinking lets the DrizzleAdapter link
GitHub accounts to existing Cockpit users by email match (safe: GitHub
verifies email addresses). New users get their own account; returning
users continue via existing account lookup. signIn callback reduced to
profile field updates only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 18:59:23 +02:00
g-butandClaude Sonnet 4.6 689a315ca7 fix(auth): complete data isolation — remove DEFAULT_USER_ID fallback, add daemon bypass
Security fixes:
- auth.config.ts: middleware now allows COCKPIT_DAEMON_TOKEN bearer requests through,
  so the local daemon works correctly after middleware was added in the previous commit.
  Individual daemon routes still enforce their own auth; middleware is the first gate.
- lib/session.ts: removed DEFAULT_USER_ID fallback that silently returned the owner's
  data for unauthenticated requests. Replaced with:
    requirePageUserId()  — server components/actions: redirects to /sign-in if no session
    getSessionUserId()   — API routes: returns null for explicit 401 handling
  getCurrentUserId() is now a deprecated alias for requirePageUserId().

Call-site migrations:
- 22 server component files (pages + today/* + system/*): getCurrentUserId → requirePageUserId
- 35 API route files: getCurrentUserId → getSessionUserId + explicit 401 guard
  (one exception: beacon appendDevLog helper silently skips on no session to avoid
  breaking the beacon response for an internal logging side-effect)
- project-states/[key]: fixed concurrent Promise.all that mixed data fetch with auth

Result: every data-access path now explicitly enforces authentication. Unauthenticated
requests to server components redirect to /sign-in; API calls return 401 JSON. No path
silently falls back to owner data.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 18:47:51 +02:00
g-butandClaude Sonnet 4.6 9650985d97 fix(auth): remove unused imports in sign-up and reset-password pages
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 18:31:05 +02:00
g-butandClaude Sonnet 4.6 bbe92fae7a feat(auth): multi-user registration, email sign-in, forgot/reset password
Self-service registration flow:
- POST /api/auth/register — creates account (email+name+password)
- /sign-up — registration form; auto-signs-in after creation

Email+password sign-in:
- New 'email-password' Credentials provider in auth.ts
- SignInForm updated: email+password primary, 'forgot password?' link,
  'Create account →' footer; owner key accessible via collapsible fallback

Forgot/reset password flow:
- password_reset_tokens table (2-hr expiry, single-use, auto-invalidates)
- POST /api/auth/forgot-password — creates token, sends via Resend REST API
  (falls back to console log when RESEND_API_KEY is unset)
- POST /api/auth/reset-password — validates + consumes token, hashes new password
- /forgot-password — email input; always shows 'check your email' (no user enumeration)
- /reset-password/[token] — new password form, redirects to sign-in on success

Infrastructure:
- src/middleware.ts — NextAuth edge middleware protecting all app routes;
  excludes sign-in, sign-up, forgot-password, reset-password, invite, API auth
- src/lib/email.ts — thin Resend REST wrapper (no package dep)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 18:25:20 +02:00
g-butandClaude Sonnet 4.6 e9e85447cf feat(settings): transcription provider selector — local / groq / auto
Adds a per-setting choice between local Whisper and Groq cloud so the
operator can force local when Groq rate-limits hit, or force Groq when
the runtime isn't active. 'auto' preserves the old behavior.
Stored in ~/.config/agent-dashboard-settings.json alongside whisper_model.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 18:03:22 +02:00
g-butandClaude Sonnet 4.6 c1ca3909a6 fix(transcribe): strip codec suffix from Groq audio filename
MediaRecorder uses 'audio/webm;codecs=opus' as MIME type; splitting on '/'
gave 'webm;codecs=opus' as the extension, which Groq could not recognize.
Now strip everything after ';' so Groq receives 'audio.webm'.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 17:55:57 +02:00
g-butandClaude Sonnet 4.6 56e3e84360 feat(prompts): fleet control + security categories, comprehensive library
Add 'fleet' and 'security' as first-class categories, each with its own
color token (amber and red). Fleet Control leads with 'Next Best Step' as
the flagship prompt — the autonomous agent execution entry point — plus
Continue Task, Test & Fix, Commit & Push, Review & Clean, Full Health Check.

Security gets six prompts covering the full threat surface: Security Audit,
Auth & Session Audit (IDOR, CSRF, session fixation), Data Exposure & Privacy
Audit (PII mapping, GDPR), API Security Review, Dependency CVE Scan, and
OWASP Top 10 Check. All six are detailed, actionable, and tuned for the
multi-user / private-data context of the platform.

All fleet prompts are featured so they appear in Quick Access. The two new
categories are ordered first so they're the most discoverable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 17:43:34 +02:00
g-butandClaude Sonnet 4.6 f114a76696 fix(queue): wire onMergeItems to non-running QueueList
Multi-select merge was silently broken when the agent was waiting/idle
— the most common state for queue editing. The running-state branch
already passed the prop; the non-running branch was missing it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 17:31:57 +02:00
g-butandClaude Sonnet 4.6 e05f5a7056 feat(control): full-screen focus mode with project tab switcher
When a project is focused, the brain panel and metrics grid collapse
so the ProjectCard expands to fill the full page width. A compact
horizontal tab bar replaces the old banner — each active project
appears as a pill with a live status dot, clicking switches focus
without returning to the fleet view first.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 17:22:36 +02:00
g-butandClaude Sonnet 4.6 efe70bccec fix(queue): pure remove() updater + commander view consumes queue
Two behavioral fixes:

1. remove() side effects were inside the setQueue updater — React Strict Mode
   and concurrent mode can invoke updaters multiple times, causing double file
   writes and duplicate PUT requests to /api/beacon/queue. Moved localStorage
   write and writeToFile() call outside the updater; updater is now a pure
   filter. This matches the pre-existing pattern used by shift().

2. ProjectCommanderCard.advance() bypassed the queue entirely — it went straight
   to onRunWithBrain("next_best") even when items were queued. Switching to
   commander view silently broke queue dispatch. Fixed: now calls shiftQueue()
   first, injects the queued item if present, falls back to next_best otherwise.
   Also surfaces queue state in the card: context line shows queue[0] when ready,
   button shows "Send (N)" with a count tooltip instead of plain "Continue".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 17:10:42 +02:00
g-butandClaude Sonnet 4.6 048a66b8c7 fix(queue): clear selection on reorder, atomic remove() via setQueue updater
- After drag-to-reorder, selected Set still held old indices — item X selected
  could now refer to a different item at that position. Clear on drop instead.
- remove() was reading from localStorage which may lag behind React state when
  called immediately after enqueue(). Switch to setQueue updater form so next
  is derived from the authoritative React state, then write localStorage and
  file synchronously inside the updater before returning.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 16:43:59 +02:00
g-butandClaude Sonnet 4.6 b21a6d933a refactor(queue): smooth dnd-kit drag, content-based sync guard, multi-select merge
Queue was the most important interface — the bridge between the human's intent
and agent execution — and it had three reliability failures:
  1. Items "came back": time-based poll skip window raced with async writes
  2. Double-write on remove(): direct file write + effect-triggered write
  3. Janky drag: native HTML5 DnD with only a background flicker on hover

Fixes:
- content-based sync guard (lastWrittenRef): poll only applies updates when file
  content ≠ last write — our own echoes are silently skipped regardless of timing
- single write per action: remove()/shift() set lastWrittenRef before setQueue so
  the sync effect sees a no-op and returns early
- @dnd-kit/sortable: smooth animated displacement during drag, DragOverlay for the
  floating ghost, PointerSensor with distance:5 constraint prevents accidental drags
- multi-select: checkboxes on each item, "Merge (N)" concatenates selected items
  with double-newline at the first selected position, clears selection after

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 16:33:49 +02:00
g-butandClaude Sonnet 4.6 80f3313f9b feat(control): launch agent with initial task from web app
LaunchTabModal now has an optional "Initial task" textarea. When filled:
- Server writes the prompt to /tmp/agent-queue-{tab} immediately (queue
  file fallback — beacon auto-continue picks it up on first stop).
- Server polls /proc every 3s for the agent process to appear in the
  project dir, then injects directly via injectIntoTab (up to 30s / 10
  attempts). Queue file is cleared on successful direct inject.
- Button label changes from "Launch" → "Launch & run" when a task is set.

No changes to the no-prompt launch path — fully backwards compatible.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 16:08:13 +02:00
g-butandClaude Sonnet 4.6 6d39347e28 fix(system): error state + retry + 30s auto-refresh on SystemStats
Applies the same FetchErrorState pattern used by Weather/Calendar/GitHub
cards — shows a friendly message with a Retry button instead of bare static
text on fetch failure. Also adds intervalMs:30s so RAM/disk numbers stay
live without a manual page reload.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 15:30:50 +02:00
g-butandClaude Sonnet 4.6 a98541ce60 feat(live-cards): auto-refresh live data without loading flash
useFetch gains an optional intervalMs parameter that silently re-fetches
in the background. Uses setRevision (stable useState setter) directly in
the interval — no ref pattern needed.

Applied intervals: calendar 5 min, weather 10 min, GitHub CI 2 min —
so the Today page stays current for users who leave it open all day.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 15:19:41 +02:00
g-butandClaude Sonnet 4.6 640eb76e45 fix(ux): friendly error states with retry across Weather, Calendar, GitHub cards
All three cards were showing raw error strings ({error ?? data?.error})
to users with no recovery path. Fixed across the board:

- useFetch: add refetch() function (revision counter) + reset loading/error
  on re-fetch so stale state doesn't persist between attempts
- FetchErrorState: new shared component — friendly message + Retry button
- WeatherCard: add error/data.error branch → FetchErrorState; "Unavailable"
  now only shows when runtime is offline (not when tool actually fails)
- CalendarCard: replace raw error div with FetchErrorState + refetch
- GitHubStatus: same fix

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 14:54:36 +02:00
g-butandClaude Sonnet 4.6 b8504a2c63 feat(control): DaemonStatusBanner — actionable offline state instead of hidden tooltip
The daemon offline/never-connected state was surfaced only as a
hidden sm:inline span with a title tooltip — invisible on mobile,
cryptic on desktop. Replace with a full DaemonStatusBanner that:

- Renders below the main grid when daemonNeverSeen or daemonOffline
- Shows two states: "not connected" (first time) vs "offline" (went away)
- Displays the exact shell command to start/restart the daemon
- Notes where to find the COCKPIT_DAEMON_TOKEN
- Is dismissible per-session via local state
- Header retains a small amber dot indicator pointing to the banner

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 14:44:54 +02:00
g-butandClaude Sonnet 4.6 409930eb36 feat(billing): plan-based project limit gating
- src/lib/plan.ts: PLAN_LIMITS config (free=3, personal=5, pro/team=∞)
  with getProjectLimit() and isUnlimitedProjects() helpers
- db/queries/user-projects: add countActiveProjects() for efficient count
- POST /api/user-projects: enforces limit for non-default users; owners
  (isDefault=true) and unlimited-plan users are always allowed through
- ProjectsSettings: shows "N / limit projects" counter and "limit reached"
  badge when at cap; Add button disabled with upgrade tooltip; upgrade
  nudge banner links to /settings#billing
- Settings page: passes projectLimit=null for owner and unlimited plans,
  or the finite limit for free/personal users

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 14:35:44 +02:00