Commit Graph
66 Commits
Author SHA1 Message Date
g-butandClaude Sonnet 4.6 d851185c26 feat(beacon): install-beacon.sh — standalone installer for any machine
Cockpit Beacon can now be installed independently of the Next.js web app.
The popup (PyQt6 session-stop overlay + queue + prompt dispatch) works
without a running Cockpit server — web sync is an optional enhancement.

Changes:
- scripts/install-beacon.sh  — new installer
  Copies beacon scripts to ~/.local/share/cockpit-beacon/
  Wires ~/.claude/hooks/stop.sh and notification.sh (backs up existing)
  Creates ~/.config/agent-prompts.json with a working default prompt set
  Creates ~/.config/agent-projects.conf with format instructions
  Checks for PyQt6, jq, zellij, xrandr and prints targeted install hints

- scripts/agent-hook-bridge.sh  — PyQt6 detection order fixed
  beacon_python() now prefers system PyQt6 (pip install PyQt6 or
  apt install python3-pyqt6) and falls back to the .python-vendor
  bundle only when system install is absent — making standalone use
  work without the Cockpit repo on disk

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 16:56:13 +02:00
g-butandClaude Sonnet 4.6 d244ffa668 feat(beacon): PyQt-primary popup with queue always visible + recent prompts
- beacon.py: PyQt opens immediately; web session only created when Cockpit
  is already running (2s check). Eliminates 1-3s startup delay. Web poll
  runs in daemon thread every 3s to sync control-panel choice back to popup.

- _beacon_popups.py: queue section always visible with hint text when
  empty ("Alt+Enter to add · runs automatically when session ends").
  Adds collapsible "Recent" section showing last 5 dispatched custom prompts,
  stored in ~/.local/share/cockpit/prompt-history.json. Clicking a recent
  item fills the custom input for editing before send.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 15:48:00 +02:00
g-butandClaude Sonnet 4.6 3c0e029678 fix(daemon): resolve promptKey to full prompt text on inject
Cloud mode queues inject commands with prompt=promptKey (the raw key string)
because the full text isn't available server-side. The daemon now reads
promptKey from the payload and calls _resolve_prompt(), which looks up the
prompt text via get_prompt() from agent-prompts.json and wraps it with
session context (mirroring buildPromptWithSession in TypeScript), so the
correct expanded prompt is injected into the Zellij tab instead of the
literal key name.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 15:02:55 +02:00
g-butandClaude Sonnet 4.6 3d956e2356 feat(control): agent switching in cloud mode via daemon queue
switch-agent route returned 503 in cloud mode. Now enqueues a
switch_agent pending command instead, which the local daemon claims
within its 5s poll cycle and executes:
  1. injects the quit command for the current agent (e.g. /exit for claude)
  2. waits 1s for exit, then injects the launch command for the new agent

Schema: adds SwitchAgentPayload type and "switch_agent" to the type comment.
Queries: adds enqueueSwitchAgentCommand.
Daemon: adds execute_switch_agent + _agent_quit_cmd + _agent_launch_cmd
  helpers; adds switch_agent case to the main dispatch loop.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 13:37:43 +02:00
g-butandClaude Sonnet 4.6 e3a779a4b3 feat(runtime-bridge): tabOpen detection + remote transcription relay
Daemon now detects whether each project's Zellij tab is actually open
and pushes tabOpen:boolean with every runtime state heartbeat.
Control panel on Vercel reads this from project_states instead of
calling getZellijTabs() locally — fixes the always-closed tab display
in cloud mode.

Beacon transcribe falls back to pending_commands queue when runtime is
unavailable (Vercel), so voice commands relay to local Whisper daemon.
Command results now carry a text field for transcription payloads.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 08:38:47 +02:00
g-butandClaude Sonnet 4.6 7814c5c6fe fix(daemon): inject_prompt finds zellij session by tab name — was silently failing from systemd
Without ZELLIJ_SESSION_NAME set, `zellij action` outside a session lists
sessions instead of targeting one, so write-chars fired nowhere despite
returning 0. Now `_find_session_for_tab` scans all sessions via
query-tab-names to find the right one, then prefixes every action with
ZELLIJ_SESSION_NAME. Also removes expandedCount from the OPEN TABS
metric card — UI expansion state doesn't belong in a Zellij-backed
tab count.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 07:51:54 +02:00
g-butandClaude Sonnet 4.6 f93b90c304 fix(daemon): respect typing guard before executing queued inject commands
Queued (remote) injects bypassed the typing guard and could garble input
the user was actively composing in Zellij. Daemon now checks the same
/tmp/cockpit-typing-* marker files the API route uses, waiting up to 30s
for the user to finish before firing — and skipping if they're still typing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 22:37:54 +02:00
g-butandClaude Sonnet 4.6 44d651a19a feat(inject): skip injection when user is actively typing at Zellij prompt
Adds isUserTypingInTab() that reads /tmp/cockpit-typing-<PANE_ID> marker
files written by ZSH zle hooks. The inject route returns
{ ok: true, blocked: true, reason: "user-typing" } instead of firing
write-chars into a tab where the user is mid-keystroke.

Includes scripts/install-cockpit-hooks.sh for one-shot ~/.zshrc setup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 21:53:25 +02:00
g-butandClaude Sonnet 4.6 b5d9263b26 feat(control): local→cloud state push — daemon heartbeat keeps Vercel in sync
- Add agentRunning, activeAgents, lockAt columns to project_states schema
- New POST /api/control/runtime-state endpoint (daemon bearer auth)
  accepts per-project runtime patches and upserts to DB
- control/route.ts: use DB agentRunning/activeAgents/currentPrompt
  when isRuntimeAvailable()=false (Vercel sees live fleet state)
- stream/route.ts: DB polling path when !isRuntimeAvailable()
  maps project_states rows → FastProjectState for SSE clients
- cockpit-daemon.sh: _push_loop runs in background every 2s,
  reads /proc + /tmp sentinels + current-prompt files and pushes
  all 7 tab states to the new endpoint

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 12:46:34 +02:00
g-butandClaude Sonnet 4.6 9af1893ba2 chore(scripts): annotate model defaults with TS SSOT reference
Cross-reference comments point bash defaults to AGENT_DEFAULT_MODELS in
agent-registry.ts so the coupling is visible without runtime import.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 07:20:40 +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 c8f368bea2 chore(daemon): update default BASE_URL to cockpitapp.vercel.app
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 19:21:53 +02:00
g-butandClaude Sonnet 4.6 e33cd22d2c chore(data): add local→Neon migration script; run migration
Migrates all 15 user-data tables from local Postgres to Neon, rewriting
the default user_id (00000000-...) to the GitHub OAuth user_id. Uses
COPY format (binary-safe, no quoting issues) and imports in FK dependency
order. Re-runnable: skips already-populated tables unless --force is passed.

Result: 1324 entities, 2315 interactions, 20 projects, 638 orchestration
events, and all other data now live in Neon — deployed Cockpit now shows
the same data as localhost.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 17:49:19 +02:00
g-butandClaude Sonnet 4.6 b635422eaa fix(daemon): use stable Vercel alias as default COCKPIT_BASE_URL
Deployment-specific URLs expire; the stable alias cockpit-orangecat.vercel.app always resolves to production.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 15:59:39 +02:00
g-butandClaude Sonnet 4.6 bc66ae99ef fix(daemon): resolve user by is_default instead of env var user ID
The daemon token authenticates the machine; the server finds the default
user automatically. Removes COCKPIT_DAEMON_USER_ID requirement so the
daemon works before the operator knows the Neon-assigned UUID.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 15:04:10 +02:00
g-butandClaude Sonnet 4.6 a2480b8a75 feat(daemon): add command bridge — API routes + local polling daemon script
Adds the missing link between cloud dispatch and local execution:
- GET /api/control/commands — claim next pending command (daemon auth via bearer token)
- PATCH /api/control/commands/[id] — mark command executed with result
- scripts/cockpit-daemon.sh — polls Vercel every 5s, executes inject/focus_tab via zellij

The daemon authenticates with COCKPIT_DAEMON_TOKEN. COCKPIT_DAEMON_USER_ID lets it
claim commands without a session cookie so it can run headlessly as a background service.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 14:50:14 +02:00
g-butandClaude Sonnet 4.6 0795e3d851 chore: commit accumulated session work across control, orchestration, and schema
- Control panel: ProjectTile, control-presenter, project-card-helpers,
  project-composer, project-intent-panel, control-panel-helpers updates
- Orchestration: run route hardening, adapters, contract, state refinements
- Schema: orchestration-events, orchestration-runs, project-states,
  prompt-history, user-projects additive field updates
- Queries: orchestration-runs, project-states, prompt-history, user-projects
  extended query support
- Agents: agent-catalog, agent-config, agent-preferences, agent-registry
  updates including Gemini runner script
- Beacon: route and PyQt popup/bridge script updates
- System: AutopilotCard and JobDetail minor updates
- Shared: DevLogList, SessionHandoff, project-activity-ledger
- Hooks: use-control-data, use-project-lifecycle-sync
- Config: prompt-library additions, session-handoff-copy
- Lib: control-fast-state, control-types, crons, crons-shared,
  orchestration state refinements

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 14:09:48 +02:00
g-butandClaude Sonnet 4.6 64692abb26 fix(control): sync auto-continue pause state to PyQt beacon popup
Previously the PyQt popup always started with auto-continue ON, ignoring
any pause set in the web control panel (only mattered when Cockpit was
down at popup-open time).

Fix: write/delete /tmp/cockpit-auto-continue-<tab> whenever the web app
toggles or resets auto-continue state (new API route). PyQt reads the
sentinel on init and skips starting the countdown when paused.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 12:43:54 +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
g-butandClaude Sonnet 4.6 f31003062a refactor(sentinels): consolidate dual agent-*/claude-* sentinel names
Bash was writing identical /tmp sentinel files under both naming schemes
simultaneously (agent-ready-{tab} AND claude-ready-{tab}) and TypeScript
was reading with double-fallback (?? stateFile.claudeReady) logic.

Now:
- Bash stop handler writes only agent-* sentinels (new canonical names)
- Dual-delete lines kept so stale claude-* files on disk are still cleaned up
- TypeScript reads only agent-* (no ?? fallback); 4 dead stateFile.claude*
  helpers removed (claudeClosing, claudeSentinel, claudePrompt, claudeLock)
- claudeReady + claudeClosed kept for the cleanup unlinkSync calls in
  inject/orchestration routes
- notification handler simplified: single-name checks, 6 dead lines removed
- agent-config.ts comment updated to "legacy names — cleanup only"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 01:30:33 +02:00
g-butandClaude Sonnet 4.6 47d12b65ca refactor(session): collapse duplicate .md file parsers into parseSessionFile SSOT
control-fast-state.ts had a single-line regex parser; sessions/route.ts had a
more capable multi-line buffering parser that stops at ## sections. Both parsed
the same on-disk handoff format (done/next/tests/todos/health).

Add parseSessionFile(raw) to session-content.ts — the canonical implementation
using the multi-line algorithm. Both callers now import it; the local parse
functions are deleted. control-fast-state.ts shrinks from 17 lines to 5.

The Python beacon's _build_summary keeps its own single-line parse (language
boundary) but now has a cross-reference comment to parseSessionFile.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 01:23:17 +02:00
g-butandClaude Sonnet 4.6 e4cf6f5fca refactor(scripts): extract COCKPIT_URL constant — eliminate hardcoded localhost:3000
beacon.py had 5 raw "http://localhost:3000" literals spread across 3 functions
(_open_cockpit, _cockpit_poll, _web_stop) plus a tooltip string.
agent-hook-bridge.sh had 2 more.

Both scripts now read COCKPIT_URL from the environment with a localhost:3000
default, defined once at the top of each file (module constant in Python,
readonly variable in bash). A single env-var override now propagates everywhere
without touching code — covers non-default ports, remote deployments, and CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 01:14:50 +02:00
g-butandClaude Sonnet 4.6 e389067016 refactor(control+beacon): SSOT fixes, hydration fix, queue UX, x.ai design
- Extract useLocalStorageState generic hook (SSR-safe, ping-pong fix)
- Extract control-storage.ts: localStorage key construction + sync read
- Add CUSTOM_CHOICE_PREFIX constant shared across TS, Python, bash
- Add DEFAULT_BEACON_COUNTDOWN_S constant (was hardcoded 30/12)
- Add splitSessionItems export; parseSessionText uses it (M3)
- Import BeaconSession+AgentPrompt from API routes, drop local defs (H2)
- Fix AppShell hydration mismatch: defer localStorage read to useEffect
- ReadyBanner: pipeline preview line + countdown reset on queue arrival
- QueueList: flat terminal-style dividers; drag-to-reorder; click-to-edit
- "Agent's plan" label replaces "Up Next" across all surfaces (H7)
- x.ai design: reduced border radii, monospace timers, tighter layout
- Add AI queue merge via /api/control/merge-prompts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 00:34:46 +02:00
g-butandClaude Sonnet 4.6 4a068b1c45 fix(beacon): treat choice="" as cancellation, not timeout in _poll_choice
_poll_choice used `if data.get("choice")` — Python truthiness — which
silently skips an empty string. When cancelActiveBeaconSessions writes
choice:"" to the session file, the poll loop would see "" and keep waiting
until the full timeout, then exit with code 1. The bash caller then falls
into the "native popup failed → fallback slot 1" branch and injects a
second prompt on top of the one already sent by the control panel.

Fix: use `is not None` so empty string is returned immediately. The
caller also switches from `if choice` to `if choice is not None` so ""
is printed to stdout and bash correctly exits via [ -z "$choice" ] && exit 0.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 18:16:09 +02:00
g-butandClaude Sonnet 4.6 76fdb10350 fix(beacon): three-part fix for double-injection race (Bug Three)
Part 1 — atomic bash lock: replace TOCTOU check-then-write on
agent-stop-active-<tab> with POSIX noclobber `( set -C; : > lock ) 2>/dev/null`.
Concurrent stop hooks that both used to pass the test-before-write now
race atomically; only one wins. Stale locks (>90s) are overwritten.

Part 2 — cancel open beacons on panel inject: cancelActiveBeaconSessions()
scans /tmp/cockpit-beacon/*.json for active sessions matching the tab and
sets choice="" — the empty-string sentinel that causes beacon.py's polling
loop to return "" and bash to `exit 0` cleanly.
/api/inject calls this immediately after injectIntoTab() succeeds.

Part 3 — beacon popup auto-closes on cancellation: polls GET /api/beacon/:id
every 2 s; calls window.close() as soon as choice !== null (set by Part 2).
Clears on unmount or when the user submits their own choice first.

Together these three parts prevent the popup and the control panel from
both injecting prompts into the same Zellij tab.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 18:06:53 +02:00
g-butandClaude Sonnet 4.6 dde05aee3f fix(inject): replace 0.3s sleep heuristic with verified tab-switch in both paths
go-to-tab-name is fire-and-forget — it returns before Zellij has switched
the visible tab. Under load the 0.3s sleep was too short, causing write-chars
to type the prompt into whichever pane happened to be focused at that moment.

Both inject paths now poll zellij action dump-layout after go-to-tab-name and
wait until the focused tab matches the target (up to 1s, 50ms intervals).
In the common case the switch completes in <50ms, so typical injection is
faster than before; the edge case where it was silently misfiring is fixed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 17:56:52 +02:00
g-butandClaude Sonnet 4.6 cddba861c4 fix(hook): bash prompt-building now matches TypeScript 5-field session format
Path A (beacon popup → bash inject) was telling Claude to write only
'done' and 'next', while Path B (control panel → TypeScript inject)
told it to write all five: done, next, tests, todos, health.

The control panel and SSE stream read all five fields; the missing
three caused projects injected via popup to show no test count,
no TODO count, and no health status until the next TypeScript inject.

Both paths now use identical wording:
  'When done, update {file} with exactly these lines:
   done / next / tests / todos / health'

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 17:51:58 +02:00
g-butandClaude Sonnet 4.6 78780e7414 feat(mic): replace Web Speech API with Whisper in control panel; harden beacon popup mic
- Add useWhisperMic hook — MediaRecorder → /api/beacon/transcribe (local Whisper)
  replaces useSpeechRecognition in project-card-sections; always available, no Google
- PromptInput: processing spinner, error display below input, waveform placeholder text
- beacon.py WhisperThread: emit failed() on silence/empty/no-frames instead of silently
  resetting; add level pyqtSignal for real-time peak tracking; rec_tick shows ▮▯ meter
- beacon page: peakRef tracks amplitude via AnalyserNode; flat-waveform warning after 2s;
  amplitude guard before sending to Whisper; actionable permission-denied messages
- Thoughts post: anatomy of broken injection pipeline (18-min deep-dive)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 17:33:00 +02:00
g-butandClaude Sonnet 4.6 afa1f3ab44 fix(beacon): three-part fix for OrangeCat injection failure
Root cause: beacon.py called _cockpit_ready() using /api/control (slow DB+git
endpoint, 4+ seconds cold) with a 2s timeout. When OrangeCat fired rapid
consecutive stop hooks, this check failed even with Cockpit running, so
_start_cockpit() spawned extra npm run dev processes that inherited the bash
command substitution pipe (stdout). Their startup output flooded the captured
`choice`, jq parsing failed, and the script exited silently with no injection.

Fix 1: Add /api/health endpoint (instant response) — beacon.py now uses this
  instead of /api/control for all liveness checks; also fixes the curl check
  in agent-hook-bridge.sh.

Fix 2: Redirect _start_cockpit() subprocess stdout/stderr to DEVNULL — like
  _open_browser() already does. Prevents npm run dev from inheriting the pipe
  and polluting the captured choice.

Fix 3: Add concurrent stop guard at top of handle_stop — skips the popup if
  another stop is already active for the same tab (within 90s). Prevents
  beacon storms from rapid turn completions.

Also increased _poll_choice timeout from 3s to 8s to tolerate cold route
compilation without dropping choices.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 16:21:03 +02:00
g-butandClaude Sonnet 4.6 b2079c909f fix(beacon): popup positions on terminal screen, not cursor screen
Three fixes for the wrong-monitor popup problem:
- beacon.py: fallback uses primary screen instead of cursor position —
  cursor can be on any screen but the terminal is usually on primary
- agent-hook-bridge.sh: writes claude-screen-<PANE_ID> from xrandr at
  stop hook time if missing (context-limit continuations bypass the
  claude() bash wrapper which normally writes it at launch)
- ProjectCard.tsx: auto-continue defaults OFF — require explicit opt-in
  to prevent the Cockpit UI from auto-injecting a second prompt while
  the user is already typing their own message in the same terminal tab

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 15:16:40 +02:00
g-butandClaude Sonnet 4.6 8fb1323796 fix(beacon): custom input click prevents auto-dismiss on X11/Linux
WindowDoesNotAcceptFocus is an X11 WM hint that blocks keyboard focus
even on deliberate clicks — so typing went to the terminal, the input
stayed empty, and the countdown/dismiss fired as if nothing was typed.

Fix: FocusCancelInput.mousePressEvent strips the flag and re-shows the
window so the WM routes keystrokes here. Track _input_engaged so _tick,
_choose, and _dismiss all respect a click (not just non-empty text).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 14:50:23 +02:00
g-butandClaude Sonnet 4.6 b8ceebd421 fix(hooks): sync state after bash injection so Control panel & beacon stay aligned
Root disconnect: when a choice was injected via bash (web beacon or PyQt popup),
the /tmp state files were never updated — agent-ready-<TAB> stayed written
(UI showed "waiting for input"), agent-current-prompt-<TAB> was never written
(no "running" banner), and the Control panel stayed stale until the NEXT stop
hook fired.

Fixes:
- agent-hook-lib.sh: add write_inject_state(tab, key, label) that clears the
  ready/closed sentinels and writes the current-prompt sentinel immediately
  after injection — same state update that /api/inject does for Control panel
  inject button flows
- agent-hook-bridge.sh: extract inject_key and inject_label from the resolved
  choice, then call write_inject_state after emit_or_inject_prompt
- agent-hook-lib.sh: add -- before prompt in write-chars call to prevent
  prompts starting with - from being parsed as flags

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 14:09:12 +02:00
g-butandClaude Sonnet 4.6 8958642289 fix(beacon): countdown and whisper model now read from settings file
Both were SSOT violations — PyQt respected ~/.config/agent-dashboard-settings.json
but the web beacon hardcoded its own values.

- beacon.py _web_stop: reads countdown_seconds from settings, passes as
  ?countdown=N query param when opening the Chrome app URL
- beacon page: reads ?countdown from window.location.search on load
  (lazy useState initializer, SSR-safe via typeof window guard)
- /api/beacon/transcribe: reads whisper_model from settings file before
  invoking transcribe.py, falls back to "base" if missing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 12:21:37 +02:00
g-butandClaude Sonnet 4.6 9241b7db67 feat(beacon): local Whisper mic transcription via MediaRecorder
Replace Web Speech API (cloud, silent failures) with MediaRecorder →
POST audio blob → Python Whisper (local, no internet) pipeline. Adds
real-time waveform visualisation, recording timer, and a clear
idle/recording/processing state machine with never-silent error display.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 11:49:33 +02:00
g-butandClaude Sonnet 4.6 6e8b63676f fix(beacon): popups always appear on terminal screen, not cursor screen
Record the terminal's screen at claude startup (cursor is in terminal then)
via record-terminal-screen.py using ctypes+libX11 on XWayland DISPLAY=:1.
_terminal_screen_position() reads /tmp/claude-screen-<ZELLIJ_PANE_ID> as
the primary source — drops the unreliable xdotool path that never worked
on KDE Wayland with Kitty.

Both PyQt popup and Chrome web beacon use this path, so neither will
appear on the movie screen when cursor drifts there mid-session.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 11:27:23 +02:00
g-butandClaude Sonnet 4.6 6bf9fefd2c fix(beacon): remove WA_TranslucentBackground — end PyQt transparency bug
Root cause: WA_TranslucentBackground + QGraphicsDropShadowEffect causes
fully-transparent windows on Linux without compositor support (common on
NVIDIA/X11 setups). Both the stop and confirm popups were affected.

Fix:
- Remove WA_TranslucentBackground from BasePopup
- Use QPalette to paint solid card-color background on the window itself
  (window bg = card bg = seamless visual, rounded border still visible)
- Remove QGraphicsDropShadowEffect — only meaningful with transparency
- Collapse outer layout margins 16→0 (were shadow bleed space only)
- Remove QGraphicsDropShadowEffect import (unused)

Applies to both ContinuePopup (stop mode) and ConfirmPopup (destructive
command confirmations). Both inherit from BasePopup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 11:08:35 +02:00
g-butandClaude Sonnet 4.6 6be78c045b fix(beacon): auto-fit web window to content, remove dead space
- Remove min-h-screen so the page doesn't expand to fill fixed height
- On load: resizeTo(520, scrollHeight) + moveTo to keep bottom-right
  anchor (reads screenLeft/screenTop before resize to reposition)
- Reduce initial Chrome window from 820→640px so less blank area before
  JS fires; loading/submitted states use compact fixed heights
- Sync _terminal_screen_position default height to match

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 10:47:33 +02:00
g-butandClaude Sonnet 4.6 dbe0a275bf feat(beacon): design SSOT — export globals.css tokens to PyQt theme
scripts/export-beacon-theme.py reads Cockpit's oklch design tokens,
converts them to hex, and writes ~/.config/agent-dashboard-theme.json
so beacon.py's PyQt palette stays pixel-identical to the web UI.

Run after any colour change in globals.css:
  python3 scripts/export-beacon-theme.py

beacon.py: fix _load_theme to read nested {dark/light} JSON structure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 10:39:46 +02:00
g-butandClaude Sonnet 4.6 c7fc16ad11 fix(beacon): open on terminal's screen instead of cursor screen
Use $WINDOWID or xdotool getactivewindow to find the terminal's screen
geometry, then position at bottom-right of that screen. Falls back to
cursor position if xdotool is unavailable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 10:35:41 +02:00
g-butandClaude Sonnet 4.6 df84ba957e feat(control+beacon): dev log per project + web beacon replaces transparent PyQt popup
- beacon.py: main() now calls _web_stop (Cockpit web page) instead of PyQt6 for stop
  mode — eliminates WA_TranslucentBackground transparency bug on Linux compositors
- _cursor_screen_position(): calculates bottom-right of cursor's screen via PyQt and
  passes --window-position to Chrome so the app window opens in the right place
- user_projects: add devLog JSONB column (array of DevLogEntry: date/done/next/tests/
  todos/health); schema pushed to DB
- beacon PATCH API: appends a DevLogEntry to the matched project when a choice is set —
  fire-and-forget so it never blocks the beacon response
- GET /api/user-projects/[id]: new endpoint so ProjectProfile can fetch devLog
- ProjectProfile: new DevLogSection (collapsed by default) shows last 12 entries with
  date, health badge, done summary, and next step — auto-populated from beacon sessions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 09:55:00 +02:00
g-butandClaude Sonnet 4.6 f19104934a fix(beacon): draggable via DraggableCard subclass using startSystemMove
Mouse events on the card are consumed by child widgets (buttons, labels)
before reaching BasePopup, so drag on BasePopup never fires. DraggableCard
puts the drag handler on the card itself; clicks on non-interactive areas
(margins, dividers, labels) call windowHandle().startSystemMove() which
asks the X11 WM to move the window natively — works through any compositor.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 09:24:04 +02:00
g-butandClaude Sonnet 4.6 8dfdfea1c8 fix(beacon): appear on cursor screen, draggable, match system light/dark
- Position popup on whichever screen the cursor is on (was always primary screen)
- Add mouse drag support (LeftButton drag to move — no title bar needed)
- Delete ~/.config/agent-dashboard-theme.json which hardcoded dark colors,
  overriding the system light/dark detection added in previous commit
- Softer drop shadow in light mode (60 alpha vs 200) to match Cockpit CSS shadows
- Card border-radius 24→16px to match Cockpit panel radius

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 09:19:12 +02:00
g-butandClaude Sonnet 4.6 9a914346e5 feat(beacon): adaptive light/dark theme + improved summary sections
- Detect system color scheme (GNOME color-scheme + KDE ColorScheme + GTK theme)
- Define _DARK_PALETTE / _LIGHT_PALETTE matching Cockpit design tokens exactly
- Primary button now uses btn_primary_bg/fg keys so it reads in both modes
- UP NEXT / DONE labels now use theme-adaptive label_next / label_progress colors
- Revert main() to _pyqt_stop — stop mode no longer opens a Brave window

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 08:51:52 +02:00
g-butandClaude Sonnet 4.6 50025a1cbd feat(beacon): replace PyQt6 popup with Cockpit web page for true design SSOT
- beacon.py stop mode now opens localhost:3000/beacon/<id> (Chrome --app mode)
  instead of a PyQt6 window; PyQt6 confirm popup stays for sync blocking
- /api/beacon + /api/beacon/[id] routes create/poll/submit sessions via /tmp files
- /beacon/[id] page uses the same ui-btn-primary, ui-panel, ui-kicker components as
  the rest of Cockpit — fonts, tokens, and layout are literally the same code
- Per-project agent+model prefs: modelPref column added to user_projects (pushed);
  ProjectState now carries id/agentPref/modelPref; launch modal pre-fills saved
  prefs and saves choice back after every launch; ProjectProfile agent selector
  persists to DB immediately
- Default agent changed from codex to claude in agent-preferences + hook fallback

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 08:21:24 +02:00
g-butandClaude Sonnet 4.6 ec633b4f3c fix(beacon): scrollable summary card so all UP NEXT/DONE content is reachable
Wraps session summary in a QScrollArea (max 55% screen height) so content
never overflows the screen. DONE toggle now scrolls to reveal items instead
of resizing the window. Also bumps ai-brief timeout to 90s with user-visible
"~30s" hint so the CLI invocation no longer times out.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 21:25:36 +02:00
g-butandClaude Sonnet 4.6 f59a0cc88c refactor(beacon): redesign session summary from first principles
Information architecture: UP NEXT + IN PROGRESS always fully visible
(these are actionable); DONE collapsed by default showing only a count
chip + ▸ expand toggle (historical, not a call-to-action). Removes the
health/tests/todos strip (that data lives in Cockpit, not a popup).
No QScrollArea complexity — content stays predictably sized.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 20:51:03 +02:00
g-butandClaude Sonnet 4.6 7995493ef3 fix(beacon): set scroll viewport background to prevent white flash
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 20:48:09 +02:00
g-butandClaude Sonnet 4.6 05ab5e93bc fix(beacon): scrollable session summary — all bullets visible without truncation
Replace expand/collapse approach with a QScrollArea (max-height 300px). All
UP NEXT / IN PROGRESS / DONE bullets render in full; user scrolls within the
card rather than clicking through expand buttons. Also clamps popup position
so it never clips off the top of the screen on tall sessions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 20:45:39 +02:00
g-butandClaude Sonnet 4.6 884a224a29 feat(control): bootstrap wizard + beacon progressive disclosure
- New /api/project/ai-brief — calls claude --json-schema to parse free-form startup idea into structured brief (name, tagline, features, stack, etc.)
- New /api/project/bootstrap — creates local dir, GitHub repo, Neon DB, registers in Cockpit; returns YC-style launchPrompt for Claude Code
- New BootstrapModal 4-step wizard: describe → review/edit → creating → launch (wired to "New" button in ControlPanel)
- beacon.py: progressive disclosure in session summary — first item always visible, "Show N more ↓" expands rest per section (UP NEXT / IN PROGRESS / DONE)
- beacon.py: card widened to 600px, summary card border-radius 12px, expand hover uses accent color

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 20:40:49 +02:00
g-butandClaude Sonnet 4.6 b112cc926a fix(ux): bullet-point session summary in both web card and beacon popup
Both surfaces now split next/done/in_progress on '; ' to render each clause
as its own labeled bullet row (→ for next/in-progress, ✓ for done). Web card
adds 'Up next' / 'Done' section headers. Beacon uses colored bullet chars
matching the existing color scheme. Removes the 'show more' expand pattern
in beacon — items are already short when split.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 20:04:39 +02:00