Commit Graph
37 Commits
Author SHA1 Message Date
Mao NakamotoandClaude Opus 4.8 e1d212ad1a fix(runner): purge dead fleetcrown.vercel.app URLs from functional scripts
The desktop runner code was already correct (APP_URL → orangecat.ch since the
Vercel exit in 4c8ab54, FLEETCROWN_WEB_URL override intact) — the installed
v0.7.9 binary is just stale, built before that. But import-from-local.sh
(publicly served at /import-from-local.sh) still defaulted FC_API to the dead
fleetcrown.vercel.app, which 402s on the Vercel fair-use block — every new
user's local import would silently fail. Repoint it and two ops/test scripts
to fleetcrown.orangecat.ch. Rebuilt desktop bundle verified: orangecat ×9,
vercel ×0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 01:30:32 +02:00
Mao NakamotoandClaude Opus 4.8 7432f16053 refactor(runner): rename daemon→runner across the live system, keep legacy contracts
The bash daemon was deleted in Session 4 of killing-the-bash-daemon; Fleet
Runner (the desktop poller) is the local executor now. This retires the
'daemon' name from everything describing the live system — constants
(DAEMON_*→RUNNER_*), types (DaemonStateKey→RunnerStateKey), the status
banner component, state-derivation fns, control props, CSS classes
(ui-control-fleet-daemon→-runner), and comments/UI strings.

Backward-compat shims (no breakage to deployed Fleet Runner installs):
- src/lib/constants/daemon.ts re-exports RUNNER_* under the old DAEMON_*
  names for the desktop Electron build until it points at the runner path.
- Fleet Doctor reads runner.env, falls back to legacy daemon.env.

Deliberately KEPT as 'daemon' (they name the genuinely-dead/legacy thing):
the deprecated DAEMON_TOKEN bearer contract, the /api/agent/daemon 410
tombstone, the legacyDaemon developer download, and historical
killing-the-bash-daemon references. systemctl daemon-reload / NX_DAEMON
left untouched (not ours).

tsc clean · eslint 0 errors · test:home 97/97 · smoke 44/44

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 01:05:12 +02:00
Mao NakamotoandClaude Fable 5 8db6028f6e feat(control): play/pause autopilot + AI-filled project profiles
One-click development UX:
- AutomationPolicyControl: fleet-wide Build all / Pause all button (was a
  select) — the one primary action on /control, pulsing dot while building
- ProjectAutopilotToggle: per-project Building/Paused play-pause (was a
  dropdown); toggling back to the inherited mode clears the override

No-forms context intake:
- lib/project-brief: Groq extraction of description/mission/vision/customers/
  stack/status/next_step from free-form text, applied to the entities +
  attributes SSOT
- POST /api/projects/[id]/brief: free-form text -> filled profile
- POST /api/projects/[id]/enrich: repo README + CLAUDE.md -> filled profile
  (entities.git_url with attrs.repo fallback, user GitHub token for private)
- ProjectBriefFill on the project overview tab: 'Describe it' textarea +
  'Fill from repo' one-click
- getGithubToken deduped out of three routes into lib/github-token (rule of 3)
- ProjectData gains first-class gitUrl (removes the dataAny escape hatch)

Thoughts: 'The Play Button Is the Product' — the vision piece behind this.
Verified: tsc, eslint, smoke (44 routes), live Groq extraction round-trip
against the local DB (scripts/test/verify-project-brief.ts).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 13:19:57 +02:00
Mao NakamotoandClaude Opus 4.7 2391c6f735 feat(autopilot): collapse 5 modes to off|on; delete strategist + beacon popup
Session 3 of killing-the-bash-daemon plan (/home/g/.claude/plans/
structured-baking-kazoo.md). Collapses the five-tier auto_inject_mode
ladder (off|queue_only|beacon|next_best|strategist) to binary off|on
and removes the dead complexity that protected the upper tiers.

What the modes meant (now retired):
  off         — manual, every dispatch is a click
  queue_only  — drain the queue, then stop
  beacon      — popup with countdown auto-pick (default for new users)
  next_best   — auto-fire canned template silently
  strategist  — Groq composes a fresh prompt from context

What "on" means now: when status:ready arrives, fire the queue head if
non-empty, else the canned next_best template. Safety rails (status:
working/blocked, blockers, no-op fuse, health/tests gate) all still
apply — being "on" doesn't override the agent's "not done" signal.
Most users only ever toggled between off and "fire when ready"; the
intermediate tiers added cognitive load without proportionate value.

DB migration applied to both local and Hetzner prod in this commit:
  UPDATE beacon_settings SET auto_inject_mode = CASE WHEN
    auto_inject_mode='off' THEN 'off' ELSE 'on' END
  UPDATE entities SET auto_inject_mode_override = (same CASE)
  ALTER TABLE ... ADD CONSTRAINT CHECK IN ('off','on')
  ALTER TABLE beacon_settings ALTER COLUMN auto_inject_mode
    SET DEFAULT 'on'
0 beacon_settings rows existed (both envs), 21 entities updated on
prod, 1324 on local. Constraints added cleanly.

Code deltas:
  - src/config/beacon.ts — AUTO_INJECT_MODE_VALUES is ["off","on"].
    LEGACY_AUTO_INJECT_MODE_VALUES + normalizeAutoInjectMode helper
    kept for tolerant reads of any unmigrated row.
  - src/lib/constants/control.ts — DEFAULT_AUTO_INJECT_MODE = "on".
  - src/db/schema/beacon-settings.ts — default "on".
  - src/lib/orchestration/dispatch-gates.ts — simplified to off/on
    decision; no fall-through to a composer. Safety rails preserved.
  - src/app/api/control/dispatch/route.ts — 361 → 160 LoC. Deleted
    buildPrompt, callGroq, parseGroqResponse, OrangeCat fetch, the
    strategist branch, and the gitBranch/recentCommits/mission
    decision inputs. DispatchResult.source union dropped "groq" +
    "fallback"; DispatchAction dropped "composed".
  - scripts/test/dispatch-gates.ts — rewrote for binary modes;
    11/11 pass.

Popup deletion (the L3 "beacon" mode's UI surface):
  - src/app/beacon/{layout,[id]/{page,BeaconClient},live/{page,
    BeaconLiveClient}}.tsx — the popup React tree
  - src/app/api/beacon/{[id],cancel,sse,window/{hide,show}}/route.ts
    — popup-specific API routes
KEPT: /api/beacon/queue (Fleet Runner uses it), /api/beacon/recent,
/api/beacon/transcribe, top-level /api/beacon/route.ts (other
consumers besides the popup import cancelActiveBeaconSessions).

UI updates (mode collapse fans through):
  - AutomationPolicyControl.tsx — 2 dots not 5
  - ControlFleetStatus.tsx — 2 hint strings
  - ProjectCard.tsx — automation labels for off/on only
  - use-project-card-actions.ts — strategist "composed" path removed

Verification: tsc clean, test:home 97/97, test:dispatch-gates 11/11,
test:control-presenter 19/19, lint clean (8 pre-existing warnings).

scripts/agent-hook-bridge.sh shows as dirty in the working tree from
earlier system-level edits today; intentionally left out of this
commit. It (and the rest of the bash scripts) gets deleted in
Session 4.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-11 07:37:51 +02:00
Mao Nakamoto 8b9b07b67c fix: make prompt activity use one display source 2026-06-10 15:49:29 +02:00
Mao Nakamoto cdc042a131 feat: ship activity runtime parity fixes 2026-06-10 14:57:19 +02:00
Mao Nakamoto ea86905967 feat(control): per-project autopilot and digests 2026-06-09 18:09:09 +02:00
Mao NakamotoandClaude Opus 4.7 9eeccc7b68 fix(control): rename 'Waiting for instructions' to 'Awaiting input'
The old label implied the project itself was dormant ("waiting for
instructions") when the actual underlying state is "agent process
detected, no recent handoff signal." It also disagreed with the
summary chip ("X awaiting input") that uses different wording for the
same fact.

Two consequences for a developer actively working on a project whose
Claude instance is at the prompt:
  - the row badge said "Waiting for instructions" (implies idle project)
  - the summary said "N awaiting input" (correct)
The user reasonably reads this as the UI lying.

Pick one honest, actionable phrase ("Awaiting input") and use it in
both places. No state-detection change — only wording.

The deeper truth gap (revampit's Claude isn't writing the
/tmp/agent-handoff-sent-* sentinel that would push the row to "Ready
for next step") is a separate hook-coverage issue that this rename
does not pretend to fix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-09 12:46:48 +02:00
Mao NakamotoandCursor a4f52b3fb2 test(control-presenter): align open-idle evidence label with badge wording
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-09 02:41:54 +02:00
Mao NakamotoandCursor 9ddcec86d7 test(autopilot): update daemon.env loader assertions for brand rename
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-09 02:31:55 +02:00
Mao NakamotoandCursor b1c4a3eb74 fix(control): stabilize autopilot injection and fleet observability
Align stop-hook, beacon, and UI dispatch gates so autopilot respects per-project pause, choice wire format, and typing blocks; add control audit trail, Fleet Doctor, and updated cloud-local docs.

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

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-08 18:46:30 +02:00
Mao Nakamoto 797fa998e7 fix(control): repair local project sync and desktop command draining 2026-06-08 09:09:21 +02:00
Mao Nakamoto b73bb9a8d4 feat(desktop+web): v0.7.2 — peek tab contents from /control
The hardest UX gap in /control was: you saw your tab NAMES + state chips
('Working', 'Awaiting input') but never the actual screen content. To know
what the agent was saying you had to alt-tab into Zellij and find the
right tab. Web-shell users saw even less.

v0.7.2 closes that. Per-tab eye-icon button on /control workspaces table
opens a drawer that captures the live screen of that Zellij tab and renders
it as a static terminal frame (monospace, dark background, scrollable).
Auto-refresh toggle re-peeks every 3s for watching long-running agents
without permanently leaving the user on the peeked tab.

Mechanism (sub-200ms round-trip):
  1. ZellijLiveRows eye-button → setPeekTab(name)
  2. PeekTabDrawer mounts → window.fleetRunner.peekTab(name)
  3. preload → IPC peek-tab → main process
  4. src/lib/zellij.peekTab: save focus, go-to-tab-name, dump-screen to
     /tmp file, restore focus, read+strip ANSI, unlink temp
  5. Returns content → drawer renders in <pre>

Same focus-dance pattern as injectIntoTab (already in zellij.ts) — users
have accepted that disruption budget for remote dispatch, this reuses it.

Outside Fleet Runner the button is hidden (one-tick mount probe of
window.fleetRunner.peekTab). No degraded "button that always errors"
experience for browser users.

Also in this drop:
  - desktop bump 0.7.1 → 0.7.2 (auto-update will pull this on next launch)
  - control-presenter test: "cockpit" string was a leftover from the rename,
    failed CI on the v0.7.1 push; now compares to 'FleetCrown' as intended
  - ZellijLivePanel daemon-offline CTA now points to /releases/latest
    instead of the hardcoded fleet-runner-v0.7.0 tag (was pointing users
    at the broken bundled-renderer build)

Next: v0.7.3 cloud-fallback (browser-only users get peek via the command
queue → daemon → result table → SSE), v0.8 inline terminal column.
2026-06-06 14:54:46 +02:00
Mao NakamotoandClaude Opus 4.7 209299c08f feat(onboarding): auto-onboard first-time users with a derivable username
Drops the "isReturning" gate in decideHealPatch so the heal fires on
first sign-in too. When a user signs in with OAuth (GitHub / Google /
Twitter) and we can derive a unique username from their display name
or email local-part, we set it + onboardedAt right there in the JWT
callback. They land authenticated with onboardingComplete=true and
middleware sends them straight to /control instead of via /onboarding.

User-visible effect: GitHub OAuth → /control in ONE page load instead
of two. The /control empty state's GitHubRepoSuggestions / LocalDev-
Suggestions / FleetRunnerAutoMint then take over from there.

Fallback (still works): users whose suggested username collides with
an existing one, or whose display name + email can't yield ≥2 chars
of [a-z0-9-], get null patch → middleware sends them to /onboarding
to pick manually. The page is no longer a forced gate — just a
fallback for the edge cases.

Side benefit: also skips the wasted "onboardedAt-only" write that
the old logic would do for returning users without a valid username,
since onboardedAt without a valid username is a no-op
(isOnboardingComplete still gates on both).

The /settings → Profile editor lets users change the auto-picked
username later, so we're not stealing their choice — just defaulting it.

Tests: 7/7 pass (npm run test:onboarding-heal). Updated existing
brand-new-user assertion to reflect the new policy and added a
collision-fallback test case.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-05 12:33:02 +02:00
Georgy Butaev e30c842869 feat(desktop) + fix(design,lint): project selection + auto-sync + Sync to Web (ck_* token); canonical injectIntoTab + real appendEvent bridge.dispatch/worker.started in Fleet Runner runtime (replaces fake in-memory); hardened zellij.ts (session resolution + -- write-chars); ui-public-download-* + --public-accent (zero design violations); full cockpit->fleetcrown rebrand in desktop/scripts/docs/thoughts/marketing/home; update desktop README + docs/desktop-app.md with capabilities + gaps (in-memory vs real log)
- desktop build clean, tsc clean, lint 0, home/ 89/89
- advances desktop-2/3: dispatches now produce durable events in ~/.fleetcrown/events.jsonl with proper runId/sentinel so stop-hooks and web control plane treat them as first-class
- still no embedded watcher (idle via co-running home/watcher.ts for now)

Refs: desktop-app.md phases, Cockpit.roadmap T1/T2, prior landing 2d98638
2026-06-02 14:54:51 +02:00
Georgy Butaev b08ac4da14 feat(desktop): project selection + auto-sync on connect + Sync to Web (agent token to /runtime-state); switch to canonical injectIntoTab; ui-public-download-* classes (zero design violations); forward custom prompts as queueHead; clean lint; broad docs/marketing/scripts updates for FleetCrown desktop runtime 2026-06-02 12:17:12 +02:00
g-butandClaude Opus 4.7 ddbfa8878d feat(autopilot): five-level trust ladder + restore Beacon popup wire
User clarified the actual product vision: autopilot is a TRUST LADDER,
not a config screen. Five levels, each adding one more thing Cockpit
decides on your behalf. The middle level (Beacon — popup + countdown
auto-pick) was orphaned by commit 848da6c "stop hook calls strategist
(no more popup race)" — that swap traded the popup race for a
loose-cannon strategist that fired AI-composed prompts without consent.
Bringing the popup back, without the old race (KDE D-Bus + Chrome
+ /tmp polling), since the SSE-driven Chromium window already
replaced the old multi-layer setup.

The five-level ladder, marketing-clear:

  L1  Manual       — only what you type    (Free tier)
  L2  Queue        — drains your queue     (Free tier)
  L3  Beacon       — popup + countdown     (Pro $20/mo) ← new default
  L4  Continuous   — auto-fires next-best  (Pro $20/mo)
  L5  Mission      — Groq composes from
                     mission/goals/roadmap (Mission $50/mo)

Concrete changes this commit:

- src/config/beacon.ts: AUTO_INJECT_MODE_VALUES gains "beacon" (the
  popup level). All five values have user-facing labels Manual / Queue
  / Beacon / Continuous / Mission with description lines that name the
  level number and the sales-grade one-line pitch.

- src/lib/constants/control.ts: DEFAULT_AUTO_INJECT_MODE flips from
  "strategist" (L5) to "beacon" (L3). New users start at the right
  trust level — Cockpit shows them every dispatch through a popup
  with countdown auto-pick, so they earn confidence in the system
  before opting into Continuous or Mission.

- scripts/agent-hook-bridge.sh:
  • autopilot_dispatch_and_inject() gains a new branch for
    mode="beacon": calls ./beacon.py stop $tab $session_file, captures
    the user's choice (or countdown auto-pick) on stdout, then
    dispatches via emit_or_inject_prompt with the chosen prompt key.
    Custom prompts come back as "__custom__<body>".
  • Bash defaults for _BEACON_AUTO_MODE change from "strategist" →
    "beacon" in both the API-fetch path and the Python-config
    fallback path, so a fresh install with no settings row lands at
    L3, not L5.

- src/components/control/AutomationPolicyControl.tsx: MODE_STYLE record
  gains the "beacon" case (cyan-dot, pulsing). Tooltips for all five
  cases rewritten with the level number + the one-line pitch so
  hovering the pill teaches the trust ladder.

- src/components/control/ControlFleetStatus.tsx: AUTOMATION_HINT
  record gains the "beacon" case. Hints under the fleet chips now
  describe the level in plain English (was: jargon like "strategist
  composes context-aware prompts" → now: "Mission — Cockpit composes
  context-aware prompts from project mission, goals, and history").

Note: the existing "strategist" code value is preserved as the L5
storage key. Mission as a customer-grade feature still needs the
work tracked in roadmap "## Proposed": project context loader,
quality gate, audit trail, sleep budget, trust score. Today's commit
is just the ladder + the missing beacon wire.

beacon.py itself was already installed at
~/.local/share/cockpit-beacon/beacon.py (orphaned since 848da6c);
this commit puts it back in the call path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-31 15:05:38 +02:00
g-butandClaude Opus 4.7 8866ca5e51 fix(control): replace "Saved agent context" jargon with "Idle"
Browser dogfood 2026-05-31: user typed into the /control textarea
"Fix the 'Saved agent context Xw ago' wording — it sounds like a
security leak. Use 'Idle · last active Xw ago' instead." Caught
that the label was opaque jargon — it describes the INTERNAL
data state ("we have a saved handoff blob") rather than the
OBSERVABLE state for the human reader ("the agent is idle").

control-presenter.ts:563 — handoff-present-but-no-live-observation
case now reads "Idle" instead of "Saved agent context". The row's
timestamp column already shows recency (Xw ago) so the prefix
doesn't need to duplicate it.

Test updated to match the new wording. 19/19 stays green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-31 13:53:03 +02:00
g-butandClaude Opus 4.7 60732f9ac4 fix(control): kill three info-leaks in the /control project rows
User audit 2026-05-31 surfaced three loud noise sources in the
project rows that were diluting every other signal on the page:

1. Saved-handoff dumps leaking into row activity text. Lines like
   "Saved handoff: Wait for user to (a) resolve the OAuth blocker
   by signing in with a fresh GitHub account..." were the agent's
   own internal notes being pasted verbatim into the user-facing
   table. getTabActivityText() now returns short lifecycle states
   only — "Ready — pick the next task", "Agent open · idle",
   "Closed", "Tab open · no agent process". Handoff content
   belongs in a per-project expand/tooltip, not the always-visible
   row.

2. "Last sync 6h ago" prefix repeated on every one of 21 project
   rows when the daemon was offline globally. staleEvidenceLabel()
   dropped the prefix in the common case — the global offline
   banner already owns the "system is stale" signal; rows should
   just describe last-known state. Preserve the prefix ONLY when
   there's no other evidence to show (rare).

3. "Tab #1 Unlinked" dangling scratch tabs surfacing in the
   workspace table. buildLiveTabRows now filters tabs that map to
   no registered project — they're visible noise that the user's
   actual zellij window already shows. The control surface is for
   fleet ops, not a generic tab list. Test updated to assert the
   filter behavior (Mystery tab dropped, registered tabs kept).

All three were silent UX papercuts that the SSOT and gate work
couldn't surface — the user had to point at the screenshot.
control-presenter tests stayed 19/19 after the test rewrite.

Items 2, 3, 4 of the 7-item Elon-team-pass plan. Items 5 (hierarchy)
+ 6 (header/rail vocab reconciliation) coming next.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-31 13:25:34 +02:00
g-butandClaude Opus 4.7 b89fdfc9d2 fix(dispatch): gate autopilot on status:working + pending blockers
Live-incident regression. Earlier today the autopilot injected a
2000-char next_best template into the user's keystrokes mid-typing
while they were composing a message to the agent, producing garbled
text like "wtf ust happened? what is this injecSetup (run, read
outputs):...". The session handoff said status:working — which is
documented in three places as the suppression signal — but the
daemon fired anyway because nothing in the dispatch pipeline
actually read the status field.

Root cause: agent-hook-bridge.sh:autopilot_dispatch_and_inject()
extracted done/next/tests/todos/health from the session file but
not status. The dispatch route's HandoffSchema didn't include
status either. The user trusted a guarantee the code never made.

Three coordinated fixes:

1. agent-hook-bridge.sh now reads `status:` from the session file
   AND counts files in ~/.claude/sessions/<P>.blockers/pending/.
   Either condition (status:working OR blockerCount>0) causes the
   daemon to skip the dispatch HTTP call entirely — saves a network
   round-trip and surfaces the gate in daemon logs.

2. The dispatch route's HandoffSchema gains a `status` field and
   the body gains `blockerCount`. Defence-in-depth: even if a
   custom integration or cloud-only caller bypasses the daemon's
   client-side gate, the route refuses to act on a working status
   or pending blockers. Two new DispatchResult.source values
   (status_gate, blocker_gate) make these refusals greppable in
   logs.

3. The gate logic moves out of the route handler into a pure
   helper at src/lib/orchestration/dispatch-gates.ts so the
   invariants can be unit-tested without spinning up a real Next
   request. 11 inline tests cover: status:working wins over every
   mode; blockers beat happy-path; legacy empty status preserves
   existing permissive behavior; etc. Wired into
   `npm run test:dispatch-gates`.

Closes the highest-impact symptom of the strategist's broken trust
model. The user can now leave autopilot on and trust that their
status:working handoff actually stops it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-31 06:45:24 +02:00
g-butandCursor 92757c655b fix(push): return 503 on bad VAPID keys instead of silent 500
Malformed Vercel VAPID keys caused setVapidDetails to throw; wrap configure
and notify in try/catch. Use STALE_CLAIM_SECONDS in reclaim SQL.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-30 21:27:41 +02:00
g-butandCursor 60f0cff749 feat(push): web push subscriptions and stop-hook notifications
Adds VAPID-backed subscribe/notify API, service worker, top-bar pill,
and Stop hook push_notify_stop for ambient agent-done signals on mobile.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-30 21:05:35 +02:00
g-butandCursor 31b01ff44e fix(control): show Working state and mobile fleet summary
Runtime presenter no longer requires agentRunning for Working; handoff
status:working does not stale an active prompt; fleet status bar for mobile.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-30 21:03:34 +02:00
g-butandCursor ee5314a5b4 fix(autopilot): keep loop running after agent stop without hooks
Session-handoff watchdog fires when status:ready is fresh; Stop hook runs
autopilot first and queues inject via /api/inject with bearer fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-30 21:01:38 +02:00
g-but e4cc0d9a8c Fix control runtime tabs and autopilot handoff 2026-05-30 15:39:00 +02:00
g-butandClaude Opus 4.7 848da6cec8 feat(autopilot): stop hook calls strategist (no more popup race)
Replaces the two-layer popup race (KDE D-Bus notification + Chrome --app
beacon window + /tmp/beacon-choice polling) with a single POST to
/api/control/dispatch. The hook now becomes a thin autopilot client:

  Stop → readyAt + finish_run + worker.finished (unchanged lifecycle)
       → push_notify_stop (Stage 5 lands the endpoint; silent until then)
       → autopilot_dispatch_and_inject:
            auto_inject_mode=off    → idle
            server returns composed → inject strategist prompt
            server returns queue    → inject queue head, dequeue
            server returns nextbest → inject canned next_best with session
            server returns off      → idle (queue empty, etc.)

Removes ~250 lines of choice-file race, beacon_launch helper, and slot/
custom/switch popup branches. handle_stop drops from ~280 lines to ~70.
beacon_launch is unreferenced and deleted; notify-choice.py + beacon.py
will be repurposed/removed in Stage 6.

Cockpit's promise is autopilot. The Stop hook is the moment that promise
pays off — and the popup was the thing in the way.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-29 16:21:16 +02:00
g-butandClaude Opus 4.7 997f1aa622 feat(autopilot): flip default auto_inject_mode to strategist
Cockpit's promise is autopilot — agents keep working when you're away.
The "queue_only" default introduced 2026-05-25 silenced the strategist on
day one, leaving new users in a non-autopilot product. Safety rails are
already in /api/control/dispatch (manual override, health gate, hard_stop,
queue priority) and the Stop hook respects them; the day-one risk that
prompted the flip no longer applies after /control became trustworthy in
6da8d7e + 7d7c40a.

Centralizes the default in DEFAULT_AUTO_INJECT_MODE (src/lib/constants/
control.ts) so the schema, queries, Settings UI, and Python/shell fallbacks
all source one constant. Adds an inline self-test (test:autopilot-defaults)
that pins every fallback to the autopilot value, wired into pre-push.

Existing users keep their explicit choice — only NEW rows get strategist.
The Drizzle migration is idempotent and reaffirms the column default.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-29 13:31:13 +02:00
g-butandClaude Opus 4.7 7d7c40a0cd fix(control): detect direct-typed Claude prompts as working
Adds a claude case to _agent_direct_activity that reads the most recent
~/.claude/projects/<dashed-cwd>/*.jsonl mtime. The daemon already consumes
this signal for grok; with claude wired in, prompts typed straight into the
TUI (no Cockpit dispatch sentinel) surface as Working instead of falling
through to Agent shell open.

Gates direct-terminal evidence on readyAt so a just-finished agent stays
Ready: a Stop hook fires after the last transcript write, and without the
gate the next daemon tick would re-promote the stale mtime back to Working
and overwrite the legitimate ready badge.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 15:58:35 +02:00
g-but 6da8d7ea1e fix(control): clarify live agent runtime states 2026-05-28 14:37:07 +02:00
g-but 7c28ab15f8 refactor(control): create trustworthy agent operations workspace 2026-05-27 19:02:18 +02:00
g-but 4dd97e05b2 fix(control): label saved handoffs as historical 2026-05-27 10:56:28 +02:00
g-but b869bedd4c feat(control): make local agent runtime self-healing 2026-05-26 19:34:14 +02:00
g-but 3e948b43e9 fix(control): report disconnected daemon truthfully 2026-05-26 12:38:50 +02:00
g-but 8f80b56b19 fix(orchestration): preserve LOOP v2 handoff signals 2026-05-26 10:38:51 +02:00
g-but 047e29ceb6 test(auth): pin heal decision logic with 6 unit tests via pure split
Extracted the branch logic from healReturningUserOnboarding into a
pure decideHealPatch() function in src/lib/onboarding-heal-decision.ts,
so it can be unit-tested without spinning up Postgres (the previous
location imported @/db/queries/* transitively, which fails at import
time without DATABASE_URL).

The I/O wrapper in onboarding-heal.ts now resolves projectCount and
suggested-username availability up front, then delegates the patch
decision to the pure function. Re-exports decideHealPatch + HealPatch
type so existing callers don't need to update import paths.

Test suite (npm run test:onboarding-heal) covers the six observable
branches:
  - brand-new user → no heal
  - returning user + free suggestion → both fields patched
  - returning user + taken suggestion → onboardedAt only
  - already-onboarded + valid username → no heal
  - legacy migrated row (onboardedAt set, no username) → username only
  - zero projects + onboardedAt set → still treated as returning

The never-throws contract on the I/O wrapper is verified by inspection
(try/catch wraps every await — there is no test-framework-friendly way
to inject a throw through the @/db import boundary without a real DB).
2026-05-24 23:43:12 +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