Commit Graph
9 Commits
Author SHA1 Message Date
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 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 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
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
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-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