Commit Graph
13 Commits
Author SHA1 Message Date
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
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-but 30c446e865 chore(orchestration,beacon,history): reference canonical contract; deprecate local prompt meta; note events in history subtitle 2026-06-02 09:23:43 +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 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-but 09f7bfb770 fix(control): make operations state race-safe 2026-05-27 21:52:33 +02:00
g-butandClaude Opus 4.7 41a1c5b1d6 refactor(beacon): finish PyQt retirement, drop zenity start-cockpit popup
Web popup at /beacon/live is the sole popup surface. Deletes the dead
PyQt vendored modules, the foreign-UI zenity/kdialog/notify-send dialog
that asked the user whether to start Cockpit, and the PyQt-import gates
in the install/smoke/runtime check scripts. The session JSON is now
written unconditionally; if Cockpit is unreachable, beacon.py
fire-and-forgets `systemctl --user start cockpit-app` and exits — the
session surfaces via SSE once the service is up.

Also fixes a pre-existing react-hooks/purity error in StuckGoalsCard
(impure Date.now() inside server component body) that was blocking the
pre-commit lint hook for the whole repo.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 14:55:25 +02:00
g-butandClaude Sonnet 4.6 d362b964fd feat(beacon): per-user DB-backed settings — popup mode, countdown, idle gate, transcription
Moves beacon settings from a shared machine file to a per-user `beacon_settings`
Postgres table so every account has independent control. Adds `popup_mode` (web /
pyqt / both / disabled) with pros/cons shown in the settings UI.

- New `beacon_settings` table (userId unique FK, all existing fields + popup_mode)
- `db/queries/beacon-settings.ts` — getBeaconSettings / upsertBeaconSettings
- GET /api/beacon-settings now requires auth; both verbs read/write DB
- beacon.py reads popup_mode via get_popup_mode() and gates PyQt / web accordingly
- _beacon_config.load_settings() fetches from API with 5-min /tmp cache, falls back
  to legacy file when Cockpit is offline
- agent-hook-bridge.sh fetches settings via Bearer token; exports BEACON_POPUP_MODE;
  both stop and notification handlers gate immediately on popup_mode=disabled
- Settings page: 4-card popup mode selector with per-option pros/cons descriptions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 11:24:11 +02:00
g-butandClaude Sonnet 4.6 6c87676f7e feat(beacon): configurable idle gate — default 0 (always show popup)
Replace hardcoded 60s idle threshold with min_idle_seconds setting.
Default is 0 which fires the popup every session end regardless of
keyboard activity. Setting lives in beacon.json, surfaced in Settings UI.
Both the stop-hook beacon and the notification auto-inject respect it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 10:50:25 +02:00
g-butandClaude Sonnet 4.6 955a082702 fix(beacon): compute nextAgent + capacityIssue in local session creation
beacon.py writes sessions directly to /tmp when Cockpit is running locally,
bypassing the TypeScript API. It hardcoded nextAgent: null and
capacityIssue: false, silently breaking the auto-switch-on-capacity-issue
flow that the user specifically asked for.

Add looks_like_capacity_issue() and resolve_next_agent() to _beacon_config.py
as Python mirrors of the TypeScript equivalents in src/lib/agent-registry.ts,
and wire them into _write_beacon_session(). The "capacity issue" banner and
auto-continue switch now fire correctly in the local path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 00:17:22 +02:00
g-butandClaude Sonnet 4.6 75bced70ab feat(beacon): write gitBranch into session JSON; show agent+branch chips in Python popup
- _beacon_config.py: add read_project_git_branch() (mirrors server-side parseProjectsConf logic)
- beacon.py: embed gitBranch in session JSON at write time so SSE/web consumers get it without a server-side lookup
- _beacon_popups.py: rewrite ContinuePopup header — green dot, project name, "Ready" badge, then chips row with agent chip + git branch chip; matches web beacon header exactly
- sse/route.ts: add git branch fallback enrichment for sessions written before this change

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 11:58:21 +02:00
g-butandClaude Sonnet 4.6 ebdac2d404 fix(ssot): centralise SWITCH_CHOICE_PREFIX wire constant across all three languages
SWITCH_CHOICE_PREFIX="switch:" was defined locally in beacon/[id]/page.tsx
(TypeScript) and _beacon_popups.py (Python), while its sibling CUSTOM_CHOICE_PREFIX
already lived in src/lib/constants/control.ts and _beacon_config.py respectively.

- Add SWITCH_CHOICE_PREFIX to constants/control.ts alongside CUSTOM_CHOICE_PREFIX
- Remove local const from beacon/[id]/page.tsx; import from constants instead
- Move SWITCH_CHOICE_PREFIX from _beacon_popups.py into _beacon_config.py; import it
- Update shell script comment to cover both prefixes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 06:15:09 +02:00
g-butandClaude Sonnet 4.6 d63d82eaf2 refactor(beacon): split 1925-line beacon.py into 5 focused modules
- _beacon_theme.py  — color palettes + theme loading (no PyQt)
- _beacon_config.py — runtime constants + settings helpers (no PyQt)
- _beacon_audio.py  — WhisperThread speech-to-text
- _beacon_popups.py — Qt stylesheet, all widget classes
- beacon.py         — thin 198-line entry point

Also fix inject_prompt in agent-hook-lib.sh: add || true to zellij
commands so set -euo pipefail doesn't abort before Enter is pressed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 11:26:46 +02:00